! function(e, t) { "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define("babylonjs", [], t) : "object" == typeof exports ? exports.babylonjs = t() : e.BABYLON = t() }("undefined" != typeof self ? self : "undefined" != typeof global ? global : this, function() { return function(e) { var t = {}; function i(n) { if (t[n]) return t[n].exports; var r = t[n] = { i: n, l: !1, exports: {} }; return e[n].call(r.exports, r, r.exports, i), r.l = !0, r.exports } return i.m = e, i.c = t, i.d = function(e, t, n) { i.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: n }) }, i.r = function(e) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 }) }, i.t = function(e, t) { if (1 & t && (e = i(e)), 8 & t) return e; if (4 & t && "object" == typeof e && e && e.__esModule) return e; var n = Object.create(null); if (i.r(n), Object.defineProperty(n, "default", { enumerable: !0, 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 s }), i.d(t, "v", function() { return a }), i.d(t, "h", function() { return c }), i.d(t, "e", function() { return l }), i.d(t, "f", function() { return u }), i.d(t, "w", function() { return h }), i.d(t, "x", function() { return d }), i.d(t, "y", function() { return f }), i.d(t, "r", function() { return p }), i.d(t, "q", function() { return _ }), i.d(t, "j", function() { return g }), i.d(t, "n", function() { return m }), i.d(t, "z", function() { return v }), i.d(t, "i", function() { return y }), i.d(t, "s", function() { return n }), i.d(t, "c", function() { return T }), i.d(t, "d", function() { return E }), i.d(t, "k", function() { return b }), i.d(t, "a", function() { return A }), i.d(t, "b", function() { return x }), i.d(t, "l", function() { return R }), i.d(t, "m", function() { return P }), i.d(t, "g", function() { return S }), i.d(t, "p", function() { return C }), i.d(t, "o", function() { return M }), i.d(t, "t", function() { return O }); var n, r = i(34), o = i(12), s = 1 / 2.2, a = 2.2, c = .001, l = 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 e = 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 u(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, a), e.g = Math.pow(this.g, a), e.b = Math.pow(this.b, 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, s), e.g = Math.pow(this.g, s), e.b = Math.pow(this.b, s), 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: !0, configurable: !0 }), 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 }(), u = 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), e[t] = this.r, e[t + 1] = this.g, e[t + 2] = this.b, e[t + 3] = this.a, 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, 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, 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), 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.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 e = 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, a), e.g = Math.pow(this.g, a), e.b = Math.pow(this.b, a), 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, s), e.g = Math.pow(this.g, s), e.b = Math.pow(this.b, s), 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), 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 e = 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.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 s = o * o, a = o * s; return new e(.5 * (2 * i.x + (-t.x + n.x) * o + (2 * t.x - 5 * i.x + 4 * n.x - r.x) * s + (-t.x + 3 * i.x - 3 * n.x + r.x) * a), .5 * (2 * i.y + (-t.y + n.y) * o + (2 * t.y - 5 * i.y + 4 * n.y - r.y) * s + (-t.y + 3 * i.y - 3 * n.y + r.y) * a)) }, 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 s = o * o, a = o * s, c = 2 * a - 3 * s + 1, l = -2 * a + 3 * s, u = a - 2 * s + o, h = a - s; return new e(t.x * c + n.x * l + i.x * u + r.x * h, t.y * c + n.y * l + i.y * u + 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 = .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, s = (t.y * n.x - t.x * n.y + (n.y - t.y) * e.x + (t.x - n.x) * e.y) * o, a = (t.x * i.y - t.y * i.x + (t.y - i.y) * e.x + (i.x - t.x) * e.y) * o; return s > 0 && a > 0 && s + a < 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), s = Math.max(0, Math.min(1, e.Dot(t.subtract(i), o) / r)), a = i.add(o.multiplyByFloats(s, s)); return e.Distance(t, a) }, e }(), d = 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 e = 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.toQuaternion = function() { return _.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), 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 !0; 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 !0; var i = Math.abs(this.z); return e !== i || t !== i }, enumerable: !0, configurable: !0 }), 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 : (I.Vector3[0].copyFrom(this), ["x", "y", "z"].forEach(function(i, n) { t[i] = I.Vector3[0][e[n]] }), this) }, e.prototype.rotateByQuaternionToRef = function(t, i) { return t.toRotationMatrix(I.Matrix[0]), e.TransformCoordinatesToRef(this, I.Matrix[0], i), i }, e.prototype.rotateByQuaternionAroundPointToRef = function(e, t, i) { return this.subtractToRef(t, I.Vector3[0]), I.Vector3[0].rotateByQuaternionToRef(e, I.Vector3[0]), t.addToRef(I.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(I.Vector3[1]), o = i.normalizeToRef(I.Vector3[2]), s = e.Dot(r, o), a = I.Vector3[3]; return e.CrossToRef(r, o, a), e.Dot(a, n) > 0 ? Math.acos(s) : -Math.acos(s) }, 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: !0, configurable: !0 }), 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.TransformCoordinatesFromFloatsToRef = function(e, t, i, n, r) { var o = n.m, s = e * o[0] + t * o[4] + i * o[8] + o[12], a = e * o[1] + t * o[5] + i * o[9] + o[13], c = e * o[2] + t * o[6] + i * o[10] + o[14], l = 1 / (e * o[3] + t * o[7] + i * o[11] + o[15]); r.x = s * l, r.y = a * l, r.z = c * l }, 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 s = o * o, a = o * s; return new e(.5 * (2 * i.x + (-t.x + n.x) * o + (2 * t.x - 5 * i.x + 4 * n.x - r.x) * s + (-t.x + 3 * i.x - 3 * n.x + r.x) * a), .5 * (2 * i.y + (-t.y + n.y) * o + (2 * t.y - 5 * i.y + 4 * n.y - r.y) * s + (-t.y + 3 * i.y - 3 * n.y + r.y) * a), .5 * (2 * i.z + (-t.z + n.z) * o + (2 * t.z - 5 * i.z + 4 * n.z - r.z) * s + (-t.z + 3 * i.z - 3 * n.z + r.z) * a)) }, 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 s = e.z; s = (s = s > i.z ? i.z : s) < t.z ? t.z : s, n.copyFromFloats(r, o, s) }, e.Hermite = function(t, i, n, r, o) { var s = o * o, a = o * s, c = 2 * a - 3 * s + 1, l = -2 * a + 3 * s, u = a - 2 * s + o, h = a - s; return new e(t.x * c + n.x * l + i.x * u + r.x * h, t.y * c + n.y * l + i.y * u + r.y * h, t.z * c + n.z * l + i.z * u + 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, s = r.height, a = r.x, c = r.y, l = I.Matrix[1]; g.FromValuesToRef(o / 2, 0, 0, 0, 0, -s / 2, 0, 0, 0, 0, .5, 0, a + o / 2, s / 2 + c, .5, 1, l); var u = I.Matrix[0]; return i.multiplyToRef(n, u), u.multiplyToRef(l, u), e.TransformCoordinates(t, u) }, e._UnprojectFromInvertedMatrixToRef = function(t, i, n) { e.TransformCoordinatesToRef(t, i, n); var r = i.m, s = t.x * r[3] + t.y * r[7] + t.z * r[11] + r[15]; o.a.WithinEpsilon(s, 1) && n.scaleInPlace(1 / s) }, e.UnprojectFromTransform = function(t, i, n, r, o) { var s = I.Matrix[0]; r.multiplyToRef(o, s), s.invert(), t.x = t.x / i * 2 - 1, t.y = -(t.y / n * 2 - 1); var a = new e; return e._UnprojectFromInvertedMatrixToRef(t, s, a), a }, e.Unproject = function(t, i, n, r, o, s) { var a = e.Zero(); return e.UnprojectToRef(t, i, n, r, o, s, a), a }, e.UnprojectToRef = function(t, i, n, r, o, s, a) { e.UnprojectFloatsToRef(t.x, t.y, t.z, i, n, r, o, s, a) }, e.UnprojectFloatsToRef = function(t, i, n, r, o, s, a, c, l) { var u = I.Matrix[0]; s.multiplyToRef(a, u), u.multiplyToRef(c, u), u.invert(); var h = I.Vector3[0]; h.x = t / r * 2 - 1, h.y = -(i / o * 2 - 1), h.z = 2 * n - 1, e._UnprojectFromInvertedMatrixToRef(h, u, l) }, 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 = I.Quaternion[0]; _.RotationQuaternionFromAxisToRef(e, t, i, r), r.toEulerAnglesToRef(n) }, e._UpReadOnly = e.Up(), e }(), f = 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 e = 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, 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, this }, 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, 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, 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, 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, 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.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, 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, 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.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.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 d(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, 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], s = e.x * n[2] + e.y * n[6] + e.z * n[10]; i.x = r, i.y = o, i.z = s, i.w = e.w }, e.TransformNormalFromFloatsToRef = function(e, t, i, n, r, o) { var s = r.m; o.x = e * s[0] + t * s[4] + i * s[8], o.y = e * s[1] + t * s[5] + i * s[9], o.z = e * s[2] + t * s[6] + i * s[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 e = 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: !0, configurable: !0 }), 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 }(), _ = 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 e = 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 = d.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, s = t * t, a = i * i, c = n * n, l = n * t - i * r; return l < -.4999999 ? (e.y = 2 * Math.atan2(n, r), e.x = Math.PI / 2, e.z = 0) : l > .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), -s - a + c + o), e.x = Math.asin(-2 * (t * n - i * r)), e.y = Math.atan2(2 * (t * i + n * r), s - a - 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], s = n[8], a = n[1], c = n[5], l = n[9], u = n[2], h = n[6], d = n[10], f = r + c + d; f > 0 ? (i = .5 / Math.sqrt(f + 1), t.w = .25 / i, t.x = (h - l) * i, t.y = (s - u) * i, t.z = (a - o) * i) : r > c && r > d ? (i = 2 * Math.sqrt(1 + r - c - d), t.w = (h - l) / i, t.x = .25 * i, t.y = (o + a) / i, t.z = (s + u) / i) : c > d ? (i = 2 * Math.sqrt(1 + c - r - d), t.w = (s - u) / i, t.x = (o + a) / i, t.y = .25 * i, t.z = (l + h) / i) : (i = 2 * Math.sqrt(1 + d - r - c), t.w = (a - o) / i, t.x = (s + u) / i, t.y = (l + 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, s = .5 * e, a = Math.sin(r), c = Math.cos(r), l = Math.sin(o), u = Math.cos(o), h = Math.sin(s), d = Math.cos(s); n.x = d * l * c + h * u * a, n.y = h * u * c - d * l * a, n.z = d * u * a - h * l * c, n.w = d * u * c + h * l * a }, 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), s = .5 * t; n.x = Math.cos(o) * Math.sin(s), n.y = Math.sin(o) * Math.sin(s), n.z = Math.sin(r) * Math.cos(s), n.w = Math.cos(r) * Math.cos(s) }, 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 = I.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, s = e.x * t.x + e.y * t.y + e.z * t.z + e.w * t.w, a = !1; if (s < 0 && (a = !0, s = -s), s > .999999) o = 1 - i, r = a ? -i : i; else { var c = Math.acos(s), l = 1 / Math.sin(c); o = Math.sin((1 - i) * c) * l, r = a ? -Math.sin(i * c) * l : Math.sin(i * c) * l } 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 s = o * o, a = o * s, c = 2 * a - 3 * s + 1, l = -2 * a + 3 * s, u = a - 2 * s + o, h = a - s; return new e(t.x * c + n.x * l + i.x * u + r.x * h, t.y * c + n.y * l + i.y * u + r.y * h, t.z * c + n.z * l + i.z * u + r.z * h, t.w * c + n.w * l + i.w * u + r.w * h) }, e }(), g = function() { function e() { this._isIdentity = !1, this._isIdentityDirty = !0, this._isIdentity3x2 = !0, this._isIdentity3x2Dirty = !0, this.updateFlag = -1, this._m = new Float32Array(16), this._updateIdentityStatus(!1) } return Object.defineProperty(e.prototype, "m", { get: function() { return this._m }, enumerable: !0, configurable: !0 }), e.prototype._markAsUpdated = function() { this.updateFlag = e._updateFlagSeed++, this._isIdentity = !1, this._isIdentity3x2 = !1, this._isIdentityDirty = !0, this._isIdentity3x2Dirty = !0 }, e.prototype._updateIdentityStatus = function(t, i, n, r) { void 0 === i && (i = !1), void 0 === n && (n = !1), void 0 === r && (r = !0), 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 = !1; 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 = !1, 1 !== this._m[0] || 1 !== this._m[5] || 1 !== this._m[15] ? this._isIdentity3x2 = !1 : 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 = !1 : this._isIdentity3x2 = !0), this._isIdentity3x2 }, e.prototype.determinant = function() { if (!0 === this._isIdentity) return 1; var e = this._m, t = e[0], i = e[1], n = e[2], r = e[3], o = e[4], s = e[5], a = e[6], c = e[7], l = e[8], u = e[9], h = e[10], d = e[11], f = e[12], p = e[13], _ = e[14], g = e[15], m = h * g - _ * d, v = u * g - p * d, y = u * _ - p * h, b = l * g - f * d, T = l * _ - h * f, E = l * p - f * u; return t * +(s * m - a * v + c * y) + i * -(o * m - a * b + c * T) + n * +(o * v - s * b + c * E) + r * -(o * y - s * T + a * E) }, 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(!1), 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(), 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 (!0 === this._isIdentity) return e.IdentityToRef(t), this; var i = this._m, n = i[0], r = i[1], o = i[2], s = i[3], a = i[4], c = i[5], l = i[6], u = i[7], h = i[8], d = i[9], f = i[10], p = i[11], _ = i[12], g = i[13], m = i[14], v = i[15], y = f * v - m * p, b = d * v - g * p, T = d * m - g * f, E = h * v - _ * p, A = h * m - f * _, x = h * g - _ * d, R = +(c * y - l * b + u * T), P = -(a * y - l * E + u * A), S = +(a * b - c * E + u * x), C = -(a * T - c * A + l * x), M = n * R + r * P + o * S + s * C; if (0 === M) return t.copyFrom(this), this; var O = 1 / M, I = l * v - m * u, D = c * v - g * u, L = c * m - g * l, w = a * v - _ * u, F = a * m - _ * l, N = a * g - _ * c, B = l * p - f * u, U = c * p - d * u, V = c * f - d * l, G = a * p - h * u, k = a * f - h * l, z = a * d - h * c, j = -(r * y - o * b + s * T), H = +(n * y - o * E + s * A), W = -(n * b - r * E + s * x), X = +(n * T - r * A + o * x), Y = +(r * I - o * D + s * L), K = -(n * I - o * w + s * F), Q = +(n * D - r * w + s * N), q = -(n * L - r * F + o * N), Z = -(r * B - o * U + s * V), J = +(n * B - o * G + s * k), $ = -(n * U - r * G + s * z), ee = +(n * V - r * k + o * z); return e.FromValuesToRef(R * O, j * O, Y * O, Z * O, P * O, H * O, K * O, J * O, S * O, W * O, Q * O, $ * O, C * O, X * O, q * O, ee * O, t), this }, 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.addTranslationFromFloats = function(e, t, i) { return this._m[12] += e, this._m[13] += t, this._m[14] += i, this._markAsUpdated(), this }, e.prototype.setTranslation = function(e) { return this.setTranslationFromFloats(e.x, e.y, e.z) }, e.prototype.getTranslation = function() { return new d(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.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.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], s = n[1], a = n[2], c = n[3], l = n[4], u = n[5], h = n[6], d = n[7], f = n[8], p = n[9], _ = n[10], g = n[11], m = n[12], v = n[13], y = n[14], b = n[15], T = r[0], E = r[1], A = r[2], x = r[3], R = r[4], P = r[5], S = r[6], C = r[7], M = r[8], O = r[9], I = r[10], D = r[11], L = r[12], w = r[13], F = r[14], N = r[15]; return t[i] = o * T + s * R + a * M + c * L, t[i + 1] = o * E + s * P + a * O + c * w, t[i + 2] = o * A + s * S + a * I + c * F, t[i + 3] = o * x + s * C + a * D + c * N, t[i + 4] = l * T + u * R + h * M + d * L, t[i + 5] = l * E + u * P + h * O + d * w, t[i + 6] = l * A + u * S + h * I + d * F, t[i + 7] = l * x + u * C + h * D + d * N, t[i + 8] = f * T + p * R + _ * M + g * L, t[i + 9] = f * E + p * P + _ * O + g * w, t[i + 10] = f * A + p * S + _ * I + g * F, t[i + 11] = f * x + p * C + _ * D + g * N, t[i + 12] = m * T + v * R + y * M + b * L, t[i + 13] = m * E + v * P + y * O + b * w, t[i + 14] = m * A + v * S + y * I + b * F, t[i + 15] = m * x + v * C + y * D + b * N, this }, e.prototype.equals = function(e) { var t = e; if (!t) return !1; 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), !0; var r = this._m; if (n && n.copyFromFloats(r[12], r[13], r[14]), (t = t || I.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), !1; if (i) { var o = 1 / t.x, s = 1 / t.y, a = 1 / t.z; e.FromValuesToRef(r[0] * o, r[1] * o, r[2] * o, 0, r[4] * s, r[5] * s, r[6] * s, 0, r[8] * a, r[9] * a, r[10] * a, 0, 0, 0, 0, 1, I.Matrix[0]), _.FromRotationMatrixToRef(I.Matrix[0], i) } return !0 }, e.prototype.getRow = function(e) { if (e < 0 || e > 3) return null; var t = 4 * e; return new f(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 = I.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 = I.Vector3[0]; if (!this.decompose(i)) return e.IdentityToRef(t), this; var n = this._m, r = 1 / i.x, o = 1 / i.y, s = 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] * s, n[9] * s, n[10] * s, 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: !0, configurable: !0 }), e.FromValuesToRef = function(e, t, i, n, r, o, s, a, c, l, u, h, d, f, p, _, g) { var m = g._m; m[0] = e, m[1] = t, m[2] = i, m[3] = n, m[4] = r, m[5] = o, m[6] = s, m[7] = a, m[8] = c, m[9] = l, m[10] = u, m[11] = h, m[12] = d, m[13] = f, m[14] = p, m[15] = _, g._markAsUpdated() }, e.FromValues = function(t, i, n, r, o, s, a, c, l, u, h, d, f, p, _, g) { var m = new e, v = m._m; return v[0] = t, v[1] = i, v[2] = n, v[3] = r, v[4] = o, v[5] = s, v[6] = a, v[7] = c, v[8] = l, v[9] = u, v[10] = h, v[11] = d, v[12] = f, v[13] = p, v[14] = _, v[15] = g, m._markAsUpdated(), m }, 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, s = t.y, a = t.z, c = t.w, l = o + o, u = s + s, h = a + a, d = o * l, f = o * u, p = o * h, _ = s * u, g = s * h, m = a * h, v = c * l, y = c * u, b = c * h, T = e.x, E = e.y, A = e.z; r[0] = (1 - (_ + m)) * T, r[1] = (f + b) * T, r[2] = (p - y) * T, r[3] = 0, r[4] = (f - b) * E, r[5] = (1 - (d + m)) * E, r[6] = (g + v) * E, r[7] = 0, r[8] = (p + y) * A, r[9] = (g - v) * A, r[10] = (1 - (d + _)) * 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(!0), 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(!0) }, 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(!1), 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), 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), 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 s = i._m; s[0] = e.x * e.x * o + r, s[1] = e.x * e.y * o - e.z * n, s[2] = e.x * e.z * o + e.y * n, s[3] = 0, s[4] = e.y * e.x * o + e.z * n, s[5] = e.y * e.y * o + r, s[6] = e.y * e.z * o - e.x * n, s[7] = 0, s[8] = e.z * e.x * o - e.y * n, s[9] = e.z * e.y * o + e.x * n, s[10] = e.z * e.z * o + r, s[11] = 0, s[12] = 0, s[13] = 0, s[14] = 0, s[15] = 1, i._markAsUpdated() }, e.RotationAlignToRef = function(e, t, i) { var n = d.Cross(t, e), r = d.Dot(t, e), o = 1 / (1 + r), s = i._m; s[0] = n.x * n.x * o + r, s[1] = n.y * n.x * o - n.z, s[2] = n.z * n.x * o + n.y, s[3] = 0, s[4] = n.x * n.y * o + n.z, s[5] = n.y * n.y * o + r, s[6] = n.z * n.y * o - n.x, s[7] = 0, s[8] = n.x * n.z * o - n.y, s[9] = n.y * n.z * o + n.x, s[10] = n.z * n.z * o + r, s[11] = 0, s[12] = 0, s[13] = 0, s[14] = 0, s[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) { _.RotationYawPitchRollToRef(e, t, i, I.Quaternion[0]), I.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), 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, s = t.m, a = 0; a < 16; a++) r[a] = o[a] * (1 - i) + s[a] * 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 = I.Vector3[0], s = I.Quaternion[0], a = I.Vector3[1]; t.decompose(o, s, a); var c = I.Vector3[2], l = I.Quaternion[1], u = I.Vector3[3]; i.decompose(c, l, u); var h = I.Vector3[4]; d.LerpToRef(o, c, n, h); var f = I.Quaternion[2]; _.SlerpToRef(s, l, n, f); var p = I.Vector3[5]; d.LerpToRef(a, u, n, p), e.ComposeToRef(h, f, 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 = I.Vector3[0], s = I.Vector3[1], a = I.Vector3[2]; i.subtractToRef(t, a), a.normalize(), d.CrossToRef(n, a, o); var c = o.lengthSquared(); 0 === c ? o.x = 1 : o.normalizeFromLength(Math.sqrt(c)), d.CrossToRef(a, o, s), s.normalize(); var l = -d.Dot(o, t), u = -d.Dot(s, t), h = -d.Dot(a, t); e.FromValuesToRef(o.x, s.x, a.x, 0, o.y, s.y, a.y, 0, o.z, s.z, a.z, 0, l, u, h, 1, r) }, 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 = I.Vector3[0], s = I.Vector3[1], a = I.Vector3[2]; t.subtractToRef(i, a), a.normalize(), d.CrossToRef(n, a, o); var c = o.lengthSquared(); 0 === c ? o.x = 1 : o.normalizeFromLength(Math.sqrt(c)), d.CrossToRef(a, o, s), s.normalize(); var l = -d.Dot(o, t), u = -d.Dot(s, t), h = -d.Dot(a, t); e.FromValuesToRef(o.x, s.x, a.x, 0, o.y, s.y, a.y, 0, o.z, s.z, a.z, 0, l, u, 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 s = 2 / t, a = 2 / i, c = 2 / (r - n), l = -(r + n) / (r - n); e.FromValuesToRef(s, 0, 0, 0, 0, a, 0, 0, 0, 0, c, 0, 0, 0, l, 1, o), o._updateIdentityStatus(1 === s && 1 === a && 1 === c && 0 === l) }, e.OrthoOffCenterLH = function(t, i, n, r, o, s) { var a = new e; return e.OrthoOffCenterLHToRef(t, i, n, r, o, s, a), a }, e.OrthoOffCenterLHToRef = function(t, i, n, r, o, s, a) { var c = 2 / (i - t), l = 2 / (r - n), u = 2 / (s - o), h = -(s + o) / (s - o), d = (t + i) / (t - i), f = (r + n) / (n - r); e.FromValuesToRef(c, 0, 0, 0, 0, l, 0, 0, 0, 0, u, 0, d, f, h, 1, a), a._markAsUpdated() }, e.OrthoOffCenterRH = function(t, i, n, r, o, s) { var a = new e; return e.OrthoOffCenterRHToRef(t, i, n, r, o, s, a), a }, e.OrthoOffCenterRHToRef = function(t, i, n, r, o, s, a) { e.OrthoOffCenterLHToRef(t, i, n, r, o, s, a), a._m[10] *= -1 }, e.PerspectiveLH = function(t, i, n, r) { var o = new e, s = 2 * n / t, a = 2 * n / i, c = (r + n) / (r - n), l = -2 * r * n / (r - n); return e.FromValuesToRef(s, 0, 0, 0, 0, a, 0, 0, 0, 0, c, 1, 0, 0, l, 0, o), o._updateIdentityStatus(!1), 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, s) { void 0 === s && (s = !0); var a = n, c = r, l = 1 / Math.tan(.5 * t), u = s ? l / i : l, h = s ? l : l * i, d = (c + a) / (c - a), f = -2 * c * a / (c - a); e.FromValuesToRef(u, 0, 0, 0, 0, h, 0, 0, 0, 0, d, 1, 0, 0, f, 0, o), o._updateIdentityStatus(!1) }, 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, s) { void 0 === s && (s = !0); var a = n, c = r, l = 1 / Math.tan(.5 * t), u = s ? l / i : l, h = s ? l : l * i, d = -(c + a) / (c - a), f = -2 * c * a / (c - a); e.FromValuesToRef(u, 0, 0, 0, 0, h, 0, 0, 0, 0, d, -1, 0, 0, f, 0, o), o._updateIdentityStatus(!1) }, e.PerspectiveFovWebVRToRef = function(e, t, i, n, r) { void 0 === r && (r = !1); var o = r ? -1 : 1, s = Math.tan(e.upDegrees * Math.PI / 180), a = Math.tan(e.downDegrees * Math.PI / 180), c = Math.tan(e.leftDegrees * Math.PI / 180), l = Math.tan(e.rightDegrees * Math.PI / 180), u = 2 / (c + l), h = 2 / (s + a), d = n._m; d[0] = u, d[1] = d[2] = d[3] = d[4] = 0, d[5] = h, d[6] = d[7] = 0, d[8] = (c - l) * u * .5, d[9] = -(s - a) * h * .5, d[10] = -i / (t - i), d[11] = 1 * o, d[12] = d[13] = d[15] = 0, d[14] = -2 * i * t / (i - t), n._markAsUpdated() }, e.GetFinalMatrix = function(t, i, n, r, o, s) { var a = t.width, c = t.height, l = t.x, u = t.y, h = e.FromValues(a / 2, 0, 0, 0, 0, -c / 2, 0, 0, 0, 0, s - o, 0, l + a / 2, c / 2 + u, o, 1), d = I.Matrix[0]; return i.multiplyToRef(n, d), d.multiplyToRef(r, d), d.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), 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, s = -2 * n, a = -2 * r, c = -2 * o; e.FromValuesToRef(s * n + 1, a * n, c * n, 0, s * r, a * r + 1, c * r, 0, s * o, a * o, c * o + 1, 0, s * t.d, a * 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, s = e.z * e.w, a = e.z * e.x, c = e.y * e.w, l = e.y * e.z, u = e.x * e.w; t._m[0] = 1 - 2 * (n + r), t._m[1] = 2 * (o + s), t._m[2] = 2 * (a - c), t._m[3] = 0, t._m[4] = 2 * (o - s), t._m[5] = 1 - 2 * (r + i), t._m[6] = 2 * (l + u), t._m[7] = 0, t._m[8] = 2 * (a + c), t._m[9] = 2 * (l - u), 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 }(), m = function() { function e(e, t, i, n) { this.normal = new d(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 e = 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 = I.Matrix[0]; g.TransposeToRef(t, i); var n = i.m, r = this.normal.x, o = this.normal.y, s = this.normal.z, a = this.d; return new e(r * n[0] + o * n[1] + s * n[2] + a * n[3], r * n[4] + o * n[5] + s * n[6] + a * n[7], r * n[8] + o * n[9] + s * n[10] + a * n[11], r * n[12] + o * n[13] + s * n[14] + a * 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, s = t.z - e.z, a = i.x - e.x, c = i.y - e.y, l = i.z - e.z, u = o * l - s * c, h = s * a - r * l, d = r * c - o * a, f = Math.sqrt(u * u + h * h + d * d); return n = 0 !== f ? 1 / f : 0, this.normal.x = u * n, this.normal.y = h * n, this.normal.z = d * 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 d.Dot(this.normal, e) <= t }, e.prototype.signedDistanceTo = function(e) { return d.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 d.Dot(i, t) + n }, 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, 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 m(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 }(); ! function(e) { e[e.LOCAL = 0] = "LOCAL", e[e.WORLD = 1] = "WORLD", e[e.BONE = 2] = "BONE" }(n || (n = {})); var b, T = function() { function e() {} return e.X = new d(1, 0, 0), e.Y = new d(0, 1, 0), e.Z = new d(0, 0, 1), e }(), E = function() { function e() {} return e.Interpolate = function(e, t, i, n, r) { for (var o = 1 - 3 * n + 3 * t, s = 3 * n - 6 * t, a = 3 * t, c = e, l = 0; l < 5; l++) { var u = c * c; c -= (o * (u * c) + s * u + a * c - e) * (1 / (3 * o * u + 2 * s * c + a)), 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) }, e }(), x = function() { return 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, s = (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)) / s, ((e.x - t.x) * o - (t.x - i.x) * r) / s), this.radius = this.centerPoint.subtract(this.startPoint).length(), this.startAngle = A.BetweenTwoPoints(this.centerPoint, this.startPoint); var a = this.startAngle.degrees(), c = A.BetweenTwoPoints(this.centerPoint, this.midPoint).degrees(), l = A.BetweenTwoPoints(this.centerPoint, this.endPoint).degrees(); c - a > 180 && (c -= 360), c - a < -180 && (c += 360), l - c > 180 && (l -= 360), l - c < -180 && (l += 360), this.orientation = c - a < 0 ? b.CW : b.CCW, this.angle = A.FromDegrees(this.orientation === b.CW ? a - l : l - a) } }(), R = function() { function e(e, t) { this._points = new Array, this._length = 0, this.closed = !1, 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], s = new h(e, t), a = new h(i, n), c = new x(o, s, a), l = c.angle.radians() / r; c.orientation === b.CW && (l *= -1); for (var u = c.startAngle.radians() + l, d = 0; d < r; d++) { var f = Math.cos(u) * c.radius + c.centerPoint.x, p = Math.sin(u) * c.radius + c.centerPoint.y; this.addLineTo(f, p), u += l } return this }, e.prototype.close = function() { return this.closed = !0, 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], s = this._points[r].subtract(o), a = s.length() + i; if (t >= i && t <= a) { var c = s.normalize(), l = t - i; return new h(o.x + c.x * l, o.y + c.y * l) } i = a } return h.Zero() }, e.StartingAt = function(t, i) { return new e(t, i) }, e }(), P = 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 || !1, 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._raw || this._tangents[t - 1].normalize(); var i, n, r, o, s = this._tangents[0], a = this._normalVector(s, e); this._normals[0] = a, this._raw || this._normals[0].normalize(), this._binormals[0] = d.Cross(s, 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._tangents[c].normalize()), this._distances[c] = this._distances[c - 1] + i.length(), r = this._tangents[c], o = this._binormals[c - 1], this._normals[c] = d.Cross(o, r), this._raw || this._normals[c].normalize(), this._binormals[c] = d.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(); (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) ? d.Zero() : new d(0, 0, 1) : new d(1, 0, 0) : new d(0, -1, 0), i = d.Cross(e, n)) : (i = d.Cross(e, t), d.CrossToRef(i, e, i)); return i.normalize(), i }, e }(), S = 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, s = function(e, t, i, n) { return (1 - e) * (1 - e) * t + 2 * e * (1 - e) * i + e * e * n }, a = 0; a <= r; a++) o.push(new d(s(a / r, t.x, i.x, n.x), s(a / r, t.y, i.y, n.y), s(a / 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 s = new Array, a = 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++) s.push(new d(a(c / o, t.x, i.x, n.x, r.x), a(c / o, t.y, i.y, n.y, r.y), a(c / o, t.z, i.z, n.z, r.z))); return new e(s) }, e.CreateHermiteSpline = function(t, i, n, r, o) { for (var s = new Array, a = 1 / o, c = 0; c <= o; c++) s.push(d.Hermite(t, i, n, r, c * a)); return new e(s) }, e.CreateCatmullRomSpline = function(t, i, n) { var r = new Array, o = 1 / i, s = 0; if (n) { for (var a = t.length, c = 0; c < a; c++) { s = 0; for (var l = 0; l < i; l++) r.push(d.CatmullRom(t[c % a], t[(c + 1) % a], t[(c + 2) % a], t[(c + 3) % a], s)), s += o } r.push(r[0]) } else { var u = new Array; u.push(t[0].clone()), Array.prototype.push.apply(u, t), u.push(t[t.length - 1].clone()); for (c = 0; c < u.length - 3; c++) { s = 0; for (l = 0; l < i; l++) r.push(d.CatmullRom(u[c], u[c + 1], u[c + 2], u[c + 3], s)), s += o } c--, r.push(d.CatmullRom(u[c], u[c + 1], u[c + 2], u[c + 3], s)) } 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 }(), C = function() { function e(e, t) { void 0 === e && (e = d.Zero()), void 0 === t && (t = d.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 = d.Zero()), void 0 === t && (t = d.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, l.Black), e.Color4 = r.a.BuildArray(3, function() { return new u(0, 0, 0, 0) }), e.Vector2 = r.a.BuildArray(3, h.Zero), e.Vector3 = r.a.BuildArray(13, d.Zero), e.Vector4 = r.a.BuildArray(3, f.Zero), e.Quaternion = r.a.BuildArray(2, _.Zero), e.Matrix = r.a.BuildArray(8, g.Identity), e }(), I = function() { function e() {} return e.Vector3 = r.a.BuildArray(6, d.Zero), e.Matrix = r.a.BuildArray(2, g.Identity), e.Quaternion = r.a.BuildArray(3, _.Zero), e }() }, function(e, t, i) { "use strict"; i.d(t, "d", function() { return r }), i.d(t, "a", function() { return o }), i.d(t, "c", function() { return s }), i.d(t, "b", function() { return a }), i.d(t, "e", function() { return c }); /*! ***************************************************************************** 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 License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ var n = function(e, t) { return (n = 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 r(e, t) { function i() { this.constructor = e } n(e, t), e.prototype = null === t ? Object.create(t) : (i.prototype = t.prototype, new i) } var o = function() { return (o = 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, s = o < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, i) : n; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, i, n); else for (var a = e.length - 1; a >= 0; a--)(r = e[a]) && (s = (o < 3 ? r(s) : o > 3 ? r(t, i, s) : r(t, i)) || s); return o > 3 && s && Object.defineProperty(t, i, s), s } function a(e, t, i, n) { return new(i || (i = Promise))(function(r, o) { function s(e) { try { c(n.next(e)) } catch (e) { o(e) } } function a(e) { try { c(n.throw(e)) } catch (e) { o(e) } } function c(e) { e.done ? r(e.value) : new i(function(t) { t(e.value) }).then(s, a) } c((n = n.apply(e, t || [])).next()) }) } function c(e, t) { var i, n, r, o, s = { label: 0, sent: function() { if (1 & r[0]) throw r[1]; return r[1] }, trys: [], ops: [] }; return o = { next: a(0), throw: a(1), return: a(2) }, "function" == typeof Symbol && (o[Symbol.iterator] = function() { return this }), o; function a(o) { return function(a) { return function(o) { if (i) throw new TypeError("Generator is already executing."); for (; s;) 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 s.label++, { value: o[1], done: !1 }; case 5: s.label++, n = o[1], o = [0]; continue; case 7: o = s.ops.pop(), s.trys.pop(); continue; default: if (!(r = (r = s.trys).length > 0 && r[r.length - 1]) && (6 === o[0] || 2 === o[0])) { s = 0; continue } if (3 === o[0] && (!r || o[1] > r[0] && o[1] < r[3])) { s.label = o[1]; break } if (6 === o[0] && s.label < r[1]) { s.label = r[1], r = o; break } if (r && s.label < r[2]) { s.label = r[2], s.ops.push(o); break } r[2] && s.ops.pop(), s.trys.pop(); continue } o = t.call(e, s) } 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: !0 } }([o, a]) } } } }, function(e, t, i) { "use strict"; i.d(t, "b", function() { return h }), i.d(t, "c", function() { return d }), i.d(t, "m", function() { return f }), i.d(t, "e", function() { return p }), i.d(t, "h", function() { return _ }), i.d(t, "n", function() { return g }), i.d(t, "o", function() { return m }), 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 T }), i.d(t, "l", function() { return E }), i.d(t, "j", function() { return A }), i.d(t, "d", function() { return x }), i.d(t, "a", function() { return R }); var n = i(29), r = i(0), o = i(19), s = {}, a = {}, c = function(e, t, i) { var r = e(); n.a && n.a.AddTagsTo(r, t.tags); var o = l(r); for (var s in o) { var a = o[s], c = t[s], u = a.type; if (null != c && "uniqueId" !== s) switch (u) { case 0: case 6: case 11: r[s] = c; break; case 1: r[s] = i || c.isRenderTarget ? c : c.clone(); break; case 2: case 3: case 4: case 5: case 7: case 10: case 12: r[s] = i ? c : c.clone() } } return r }; function l(e) { var t = e.getClassName(); if (a[t]) return a[t]; a[t] = {}; for (var i = a[t], n = e, r = t; r;) { var o = s[r]; for (var c in o) i[c] = o[c]; var l = void 0, u = !1; do { if (!(l = Object.getPrototypeOf(n)).getClassName) { u = !0; break } if (l.getClassName() !== r) break; n = l } while (l); if (u) break; r = l.getClassName(), n = l } return i } function u(e, t) { return function(i, n) { var r = function(e) { var t = e.getClassName(); return s[t] || (s[t] = {}), s[t] }(i); 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: !0, configurable: !0 }) } }(e, t) } function d(e) { return u(0, e) } function f(e) { return u(1, e) } function p(e) { return u(2, e) } function _(e) { return u(3, e) } function g(e) { return u(4, e) } function m(e) { return u(5, e) } function v(e) { return u(6, e) } function y(e) { return u(7, e) } function b(e) { return u(8, e) } function T(e) { return u(9, e) } function E(e) { return u(10, e) } function A(e) { return u(12, e) } function x(e) { return u(11, e) } var R = 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 = l(e); for (var r in i) { var o = i[r], s = o.sourceName || r, a = o.type, c = e[r]; if (null != c) switch (a) { case 0: t[s] = c; break; case 1: t[s] = c.serialize(); break; case 2: t[s] = c.asArray(); break; case 3: t[s] = c.serialize(); break; case 4: case 5: t[s] = c.asArray(); break; case 6: t[s] = c.id; break; case 7: t[s] = c.serialize(); break; case 8: t[s] = c.asArray(); break; case 9: t[s] = c.serialize(); break; case 10: t[s] = c.asArray(); break; case 11: t[s] = c.id; case 12: t[s] = c.asArray() } } return t }, e.Parse = function(t, i, o, s) { void 0 === s && (s = null); var a = t(); s || (s = ""), n.a && n.a.AddTagsTo(a, i.tags); var c = l(a); for (var u in c) { var h = c[u], d = i[h.sourceName || u], f = h.type; if (null != d) { var p = a; switch (f) { case 0: p[u] = d; break; case 1: o && (p[u] = e._TextureParser(d, o, s)); break; case 2: p[u] = r.e.FromArray(d); break; case 3: p[u] = e._FresnelParametersParser(d); break; case 4: p[u] = r.w.FromArray(d); break; case 5: p[u] = r.x.FromArray(d); break; case 6: o && (p[u] = o.getLastMeshByID(d)); break; case 7: p[u] = e._ColorCurvesParser(d); break; case 8: p[u] = r.f.FromArray(d); break; case 9: p[u] = e._ImageProcessingConfigurationParser(d); break; case 10: p[u] = r.q.FromArray(d); break; case 11: o && (p[u] = o.getCameraByID(d)); case 12: p[u] = r.j.FromArray(d) } } } return a }, e.Clone = function(e, t) { return c(e, t, !1) }, e.Instanciate = function(e, t) { return c(e, t, !0) }, 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, s) { void 0 === n && (n = 0), void 0 === r && (r = !1), void 0 === o && (o = !1), void 0 === s && (s = !1), e.getScene ? this._engine = e.getScene().getEngine() : this._engine = e, this._updatable = i, this._instanced = o, this._data = t, this.byteStride = s ? n : n * Float32Array.BYTES_PER_ELEMENT, r || this.create() } return e.prototype.createVertexBuffer = function(e, t, i, n, o, s) { void 0 === s && (s = !1); var a = s ? t : t * Float32Array.BYTES_PER_ELEMENT, c = n ? s ? n : n * Float32Array.BYTES_PER_ELEMENT : this.byteStride; return new r(this._engine, this, e, this._updatable, !0, c, void 0 === o ? this._instanced : o, a, i, void 0, void 0, !0) }, 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 = !1), 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, s, a, c, l, u, h, d, f) { if (void 0 === d && (d = !1), void 0 === f && (f = !1), i instanceof n ? (this._buffer = i, this._ownsBuffer = !1) : (this._buffer = new n(t, i, o, a, s, c, f), this._ownsBuffer = !0), 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 _ = e.GetTypeByteLength(this.type); f ? (this._size = u || (a ? a / _ : e.DeduceStride(r)), this.byteStride = a || this._buffer.byteStride || this._size * _, this.byteOffset = l || 0) : (this._size = u || a || e.DeduceStride(r), this.byteStride = a ? a * _ : this._buffer.byteStride || this._size * _, this.byteOffset = (l || 0) * _), this.normalized = d, 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: !0, configurable: !0 }), 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 = !1), 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; case e.NormalKind: case e.PositionKind: return 3; case e.ColorKind: case e.MatricesIndicesKind: case e.MatricesIndicesExtraKind: case e.MatricesWeightsKind: case e.MatricesWeightsExtraKind: case e.TangentKind: return 4; default: throw new Error("Invalid kind '" + t + "'") } }, e.GetTypeByteLength = function(t) { switch (t) { case e.BYTE: case e.UNSIGNED_BYTE: return 1; case e.SHORT: case e.UNSIGNED_SHORT: return 2; case e.INT: case e.FLOAT: return 4; default: throw new Error("Invalid type '" + t + "'") } }, e.ForEach = function(t, i, n, r, o, s, a, c) { if (t instanceof Array) for (var l = i / 4, u = n / 4, h = 0; h < s; h += r) { for (var d = 0; d < r; d++) c(t[l + d], h + d); l += u } else { var f = t instanceof ArrayBuffer ? new DataView(t) : new DataView(t.buffer, t.byteOffset, t.byteLength), p = e.GetTypeByteLength(o); for (h = 0; h < s; h += r) { var _ = i; for (d = 0; d < r; d++) { c(e._GetFloatValue(f, o, _, a), h + d), _ += 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: o = t.getUint8(n); return r && (o /= 255), o; case e.SHORT: o = t.getInt16(n, !0); return r && (o = Math.max(o / 16383, -1)), o; case e.UNSIGNED_SHORT: o = t.getUint16(n, !0); return r && (o /= 65535), o; case e.FLOAT: return t.getFloat32(n, !0); 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 a }), i.d(t, "b", function() { return c }), i.d(t, "a", function() { return l }); var n = i(8), r = i(3), o = i(35), s = i(6), a = 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: !0, configurable: !0 }), e.prototype.reduce = function(e, t) { if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0 && this._mesh.material) { this._mesh.computeBonesUsingShaders = !1, e = e.replace("#define NUM_BONE_INFLUENCERS " + this._mesh.numBoneInfluencers, "#define NUM_BONE_INFLUENCERS 0"), t._bonesComputationForcedToCPU = !0; 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 = !1; else if (r.subMeshes) for (var o = 0, s = r.subMeshes; o < s.length; o++) { if (s[o].effect === t) { r.computeBonesUsingShaders = !1; break } } } } else { var a = this._defines[this._currentRank]; if (a) for (n = 0; n < a.length; n++) e = e.replace("#define " + a[n], ""); this._currentRank++ } return e }, e }(), c = function() { return function() {} }(), l = function() { function e(t, i, r, o, s, a, c, l, u, h) { var d, f, p = this; if (void 0 === o && (o = null), void 0 === a && (a = null), void 0 === c && (c = null), void 0 === l && (l = null), void 0 === u && (u = 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 = !1, this._uniformBuffersNames = {}, this._samplers = {}, this._isReady = !1, 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 _ = i; if (this._engine = r, this._attributesNames = _.attributes, this._uniformsNames = _.uniformsNames.concat(_.samplers), this._samplerList = _.samplers.slice(), this.defines = _.defines, this.onError = _.onError, this.onCompiled = _.onCompiled, this._fallbacks = _.fallbacks, this._indexParameters = _.indexParameters, this._transformFeedbackVaryings = _.transformFeedbackVaryings, _.uniformBuffersNames) for (var g = 0; g < _.uniformBuffersNames.length; g++) this._uniformBuffersNames[_.uniformBuffersNames[g]] = g } else this._engine = s, this.defines = null == a ? "" : a, this._uniformsNames = r.concat(o), this._samplerList = o ? o.slice() : [], this._attributesNames = i, this.onError = u, this.onCompiled = l, this._indexParameters = h, this._fallbacks = c; this.uniqueId = e._uniqueIdSeed++, t.vertexElement ? (d = document.getElementById(t.vertexElement)) || (d = t.vertexElement) : d = t.vertex || t, t.fragmentElement ? (f = document.getElementById(t.fragmentElement)) || (f = t.fragmentElement) : f = t.fragment || t, this._loadVertexShader(d, function(e) { p._processIncludes(e, function(e) { p._processShaderConversion(e, !1, function(e) { p._loadFragmentShader(f, function(i) { p._processIncludes(i, function(i) { p._processShaderConversion(i, !0, 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "key", { get: function() { return this._key }, enumerable: !0, configurable: !0 }), 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; if (o.a.IsWindowObjectExist() && t instanceof HTMLElement) return void 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; if (o.a.IsWindowObjectExist() && t instanceof HTMLElement) return void 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, a = "\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" }); this.name.vertexElement ? (s.a.Error("Vertex shader: " + this.name.vertexElement + a), s.a.Error("Fragment shader: " + this.name.fragmentElement + c)) : this.name.vertex ? (s.a.Error("Vertex shader: " + this.name.vertex + a), s.a.Error("Fragment shader: " + this.name.fragment + c)) : (s.a.Error("Vertex shader: " + this.name + a), s.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), s = new String(t); null != o;) { var a = o[1]; if (-1 !== a.indexOf("__decl__") && (a = a.replace(/__decl__/, ""), this._engine.supportsUniformBuffers && (a = (a = a.replace(/Vertex/, "Ubo")).replace(/Fragment/, "Ubo")), a += "Declaration"), !e.IncludesShadersStore[a]) { var c = e.ShadersRepository + "ShadersInclude/" + a + ".fx"; return void this._engine._loadFile(c, function(t) { e.IncludesShadersStore[a] = t, n._processIncludes(s, i) }) } var l = e.IncludesShadersStore[a]; if (o[2]) for (var u = o[3].split(","), h = 0; h < u.length; h += 2) { var d = new RegExp(u[h], "g"), f = u[h + 1]; l = l.replace(d, f) } if (o[4]) { var p = o[5]; if (-1 !== p.indexOf("..")) { var _ = p.split(".."), g = parseInt(_[0]), m = parseInt(_[1]), v = l.slice(0); l = "", isNaN(m) && (m = this._indexParameters[_[1]]); for (var y = g; y < m; y++) this._engine.supportsUniformBuffers || (v = v.replace(/light\{X\}.(\w*)/g, function(e, t) { return t + "{X}" })), l += v.replace(/\{X\}/g, y.toString()) + "\n" } else this._engine.supportsUniformBuffers || (l = l.replace(/light\{X\}.(\w*)/g, function(e, t) { return t + "{X}" })), l = l.replace(/\{X\}/g, p) } s = s.replace(o[0], l), o = r.exec(t) } i(s) }, 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 = !1, 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 a = this._rebuildProgram.bind(this); this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride ? o._preparePipelineContext(this._pipelineContext, this._vertexSourceCodeOverride, this._fragmentSourceCodeOverride, !0, a, null, this._transformFeedbackVaryings) : o._preparePipelineContext(this._pipelineContext, this._vertexSourceCode, this._fragmentSourceCode, !1, a, 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 = !0, 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, s.a.Error("Unable to compile effect:"), s.a.Error("Uniforms: " + this._uniformsNames.map(function(e) { return " " + e })), s.a.Error("Attributes: " + t.map(function(e) { return " " + e })), s.a.Error("Error: " + this._compilationError), r && (this._pipelineContext = r, this._isReady = !0, this.onError && this.onError(this, this._compilationError), this.onErrorObservable.notifyObservers(this)), n && n.isMoreFallbacks ? (s.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: !0, configurable: !0 }), 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, !0) }, e.prototype._cacheFloat2 = function(e, t, i) { var n = this._valueCache[e]; if (!n) return n = [t, i], this._valueCache[e] = n, !0; var r = !1; return n[0] !== t && (n[0] = t, r = !0), n[1] !== i && (n[1] = i, r = !0), 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, !0; var o = !1; return r[0] !== t && (r[0] = t, o = !0), r[1] !== i && (r[1] = i, o = !0), r[2] !== n && (r[2] = n, o = !0), 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, !0; var s = !1; return o[0] !== t && (o[0] = t, s = !0), o[1] !== i && (o[1] = i, s = !0), o[2] !== n && (o[2] = n, s = !0), o[3] !== r && (o[3] = r, s = !0), s }, 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, this._engine.setIntArray2(this._uniforms[e], t), this }, 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, this._engine.setIntArray4(this._uniforms[e], t), this }, 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, this._engine.setFloatArray2(this._uniforms[e], t), this }, 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, this._engine.setFloatArray4(this._uniforms[e], t), this }, 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, this._engine.setArray2(this._uniforms[e], t), this }, 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, 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), this }, 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, 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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 d }); var n = i(1), r = i(2), o = i(8), s = i(9), a = i(0), c = i(44), l = i(3), u = i(22), h = i(19), d = function(e) { function t(i, n, r, a, c, u, h, d, f, p) { void 0 === r && (r = !1), void 0 === a && (a = !0), void 0 === c && (c = t.TRILINEAR_SAMPLINGMODE), void 0 === u && (u = null), void 0 === h && (h = null), void 0 === d && (d = null), void 0 === f && (f = !1); var _ = e.call(this, n) || this; if (_.url = null, _.uOffset = 0, _.vOffset = 0, _.uScale = 1, _.vScale = 1, _.uAng = 0, _.vAng = 0, _.wAng = 0, _.uRotationCenter = .5, _.vRotationCenter = .5, _.wRotationCenter = .5, _.inspectableCustomProperties = null, _._noMipmap = !1, _._invertY = !1, _._rowGenerationMatrix = null, _._cachedTextureMatrix = null, _._projectionModeMatrix = null, _._t0 = null, _._t1 = null, _._t2 = null, _._cachedUOffset = -1, _._cachedVOffset = -1, _._cachedUScale = 0, _._cachedVScale = 0, _._cachedUAng = -1, _._cachedVAng = -1, _._cachedWAng = -1, _._cachedProjectionMatrixId = -1, _._cachedCoordinatesMode = -1, _._initialSamplingMode = t.BILINEAR_SAMPLINGMODE, _._buffer = null, _._deleteBuffer = !1, _._format = null, _._delayedOnLoad = null, _._delayedOnError = null, _.onLoadObservable = new o.c, _._isBlocking = !0, _.name = i || "", _.url = i, _._noMipmap = r, _._invertY = a, _._initialSamplingMode = c, _._buffer = d, _._deleteBuffer = f, p && (_._format = p), !(n = _.getScene())) return _; n.getEngine().onBeforeTextureInitObservable.notifyObservers(_); var g = function() { _._texture && _._texture._invertVScale && (_.vScale = -1), _.onLoadObservable.hasObservers() && _.onLoadObservable.notifyObservers(_), u && u(), !_.isBlocking && n && n.resetCachedMaterial() }; return _.url ? (_._texture = _._getFromCache(_.url, r, c, a), _._texture ? _._texture.isReady ? s.h.SetImmediate(function() { return g() }) : _._texture.onLoadedObservable.add(g) : n.useDelayedTextureLoading ? (_.delayLoadState = l.a.DELAYLOADSTATE_NOTLOADED, _._delayedOnLoad = g, _._delayedOnError = h) : (_._texture = n.getEngine().createTexture(_.url, r, a, n, c, g, h, _._buffer, void 0, _._format), f && delete _._buffer), _) : (_._delayedOnLoad = g, _._delayedOnError = h, _) } return n.d(t, e), Object.defineProperty(t.prototype, "noMipmap", { get: function() { return this._noMipmap }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "isBlocking", { get: function() { return this._isBlocking }, set: function(e) { this._isBlocking = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "samplingMode", { get: function() { return this._texture ? this._texture.samplingMode : this._initialSamplingMode }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "invertY", { get: function() { return this._invertY }, enumerable: !0, configurable: !0 }), t.prototype.updateURL = function(e, t, i) { void 0 === t && (t = null), this.url && (this.releaseInternalTexture(), this.getScene().markAllMaterialsAsDirty(l.a.MATERIAL_TextureDirtyFlag)), this.url = e, this._buffer = t, this.delayLoadState = l.a.DELAYLOADSTATE_NOTLOADED, i && (this._delayedOnLoad = i), this.delayLoad() }, t.prototype.delayLoad = function() { if (this.delayLoadState === l.a.DELAYLOADSTATE_NOTLOADED) { var e = this.getScene(); e && (this.delayLoadState = l.a.DELAYLOADSTATE_LOADED, this._texture = this._getFromCache(this.url, this._noMipmap, this.samplingMode, this._invertY), this._texture ? this._delayedOnLoad && (this._texture.isReady ? s.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, a.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 = a.j.Zero(), this._rowGenerationMatrix = new a.j, this._t0 = a.x.Zero(), this._t1 = a.x.Zero(), this._t2 = a.x.Zero()), a.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), a.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(l.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 = a.j.Zero()), this._projectionModeMatrix || (this._projectionModeMatrix = a.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: a.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: a.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; default: a.j.IdentityToRef(this._cachedTextureMatrix) } return i.markAllMaterialsAsDirty(l.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 }, 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 = s.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 = !0; if (e.noMipmap && (o = !1), e.mirrorPlane) { var s = t._CreateMirror(e.name, e.renderTargetSize, i, o); return s._waitingRenderList = e.renderList, s.mirrorPlane = a.n.FromArray(e.mirrorPlane), s } if (e.isRenderTarget) { var c = null; if (e.isCube) { if (i.reflectionProbes) for (var l = 0; l < i.reflectionProbes.length; l++) { var u = i.reflectionProbes[l]; if (u.name === e.name) return u.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 l = e.samplingMode; c && c.samplingMode !== l && c.updateSamplingMode(l) } if (c && e.animations) for (var h = 0; h < e.animations.length; h++) { var d = e.animations[h], f = u.a.GetClass("BABYLON.Animation"); f && c.animations.push(f.Parse(d)) } return c }, t.CreateFromBase64String = function(e, i, n, r, o, s, a, c, u) { return void 0 === s && (s = t.TRILINEAR_SAMPLINGMODE), void 0 === a && (a = null), void 0 === c && (c = null), void 0 === u && (u = l.a.TEXTUREFORMAT_RGBA), new t("data:" + i, n, r, o, s, a, c, e, !1, u) }, t.LoadFromDataString = function(e, i, n, r, o, s, a, c, u, h) { return void 0 === r && (r = !1), void 0 === o && (o = !1), void 0 === s && (s = !0), void 0 === a && (a = t.TRILINEAR_SAMPLINGMODE), void 0 === c && (c = null), void 0 === u && (u = null), void 0 === h && (h = l.a.TEXTUREFORMAT_RGBA), "data:" !== e.substr(0, 5) && (e = "data:" + e), new t(e, n, o, s, a, c, u, 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 = l.a.TEXTURE_NEAREST_SAMPLINGMODE, t.NEAREST_NEAREST_MIPLINEAR = l.a.TEXTURE_NEAREST_NEAREST_MIPLINEAR, t.BILINEAR_SAMPLINGMODE = l.a.TEXTURE_BILINEAR_SAMPLINGMODE, t.LINEAR_LINEAR_MIPNEAREST = l.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST, t.TRILINEAR_SAMPLINGMODE = l.a.TEXTURE_TRILINEAR_SAMPLINGMODE, t.LINEAR_LINEAR_MIPLINEAR = l.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR, t.NEAREST_NEAREST_MIPNEAREST = l.a.TEXTURE_NEAREST_NEAREST_MIPNEAREST, t.NEAREST_LINEAR_MIPNEAREST = l.a.TEXTURE_NEAREST_LINEAR_MIPNEAREST, t.NEAREST_LINEAR_MIPLINEAR = l.a.TEXTURE_NEAREST_LINEAR_MIPLINEAR, t.NEAREST_LINEAR = l.a.TEXTURE_NEAREST_LINEAR, t.NEAREST_NEAREST = l.a.TEXTURE_NEAREST_NEAREST, t.LINEAR_NEAREST_MIPNEAREST = l.a.TEXTURE_LINEAR_NEAREST_MIPNEAREST, t.LINEAR_NEAREST_MIPLINEAR = l.a.TEXTURE_LINEAR_NEAREST_MIPLINEAR, t.LINEAR_LINEAR = l.a.TEXTURE_LINEAR_LINEAR, t.LINEAR_NEAREST = l.a.TEXTURE_LINEAR_NEAREST, t.EXPLICIT_MODE = l.a.TEXTURE_EXPLICIT_MODE, t.SPHERICAL_MODE = l.a.TEXTURE_SPHERICAL_MODE, t.PLANAR_MODE = l.a.TEXTURE_PLANAR_MODE, t.CUBIC_MODE = l.a.TEXTURE_CUBIC_MODE, t.PROJECTION_MODE = l.a.TEXTURE_PROJECTION_MODE, t.SKYBOX_MODE = l.a.TEXTURE_SKYBOX_MODE, t.INVCUBIC_MODE = l.a.TEXTURE_INVCUBIC_MODE, t.EQUIRECTANGULAR_MODE = l.a.TEXTURE_EQUIRECTANGULAR_MODE, t.FIXED_EQUIRECTANGULAR_MODE = l.a.TEXTURE_FIXED_EQUIRECTANGULAR_MODE, t.FIXED_EQUIRECTANGULAR_MIRRORED_MODE = l.a.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE, t.CLAMP_ADDRESSMODE = l.a.TEXTURE_CLAMP_ADDRESSMODE, t.WRAP_ADDRESSMODE = l.a.TEXTURE_WRAP_ADDRESSMODE, t.MIRROR_ADDRESSMODE = l.a.TEXTURE_MIRROR_ADDRESSMODE, t.UseSerializedUrlIfAny = !1, 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), n.c([Object(r.c)()], t.prototype, "uScale", void 0), n.c([Object(r.c)()], t.prototype, "vScale", void 0), 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, "isBlocking", null), t }(c.a); r.a._TextureParser = d.Parse }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return n }), i.d(t, "d", function() { return r }), i.d(t, "b", function() { return o }), i.d(t, "c", function() { return s }); var n = function() { function e(e, t, i, n) { void 0 === t && (t = !1), this.initalize(e, t, i, n) } return e.prototype.initalize = function(e, t, i, n) { return void 0 === t && (t = !1), this.mask = e, this.skipNextObservers = t, this.target = i, this.currentTarget = n, this }, e }(), r = function() { return function(e, t, i) { void 0 === i && (i = null), this.callback = e, this.mask = t, this.scope = i, this._willBeUnregistered = !1, this.unregisterOnNextCall = !1 } }(), o = 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 s = 0, a = t; s < a.length; s++) { var c = a[s].add(i, n, !1, r); c && o._observers.push(c) } return o }, e }(), s = function() { function e(e) { this._observers = new Array, this._eventState = new n(0), e && (this._onObserverAdded = e) } return e.prototype.add = function(e, t, i, n, o) { if (void 0 === t && (t = -1), void 0 === i && (i = !1), void 0 === n && (n = null), void 0 === o && (o = !1), !e) return null; var s = new r(e, t, n); return s.unregisterOnNextCall = o, i ? this._observers.unshift(s) : this._observers.push(s), this._onObserverAdded && this._onObserverAdded(s), s }, e.prototype.addOnce = function(e) { return this.add(e, void 0, void 0, void 0, !0) }, e.prototype.remove = function(e) { return !!e && (-1 !== this._observers.indexOf(e) && (this._deferUnregister(e), !0)) }, 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]), !0; return !1 }, e.prototype._deferUnregister = function(e) { var t = this; e.unregisterOnNextCall = !1, e._willBeUnregistered = !0, setTimeout(function() { t._remove(e) }, 0) }, e.prototype._remove = function(e) { if (!e) return !1; var t = this._observers.indexOf(e); return -1 !== t && (this._observers.splice(t, 1), !0) }, 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 !0; var r = this._eventState; r.mask = t, r.target = i, r.currentTarget = n, r.skipNextObservers = !1, r.lastReturnValue = e; for (var o = 0, s = this._observers; o < s.length; o++) { var a = s[o]; if (!a._willBeUnregistered && (a.mask & t && (a.scope ? r.lastReturnValue = a.callback.apply(a.scope, [e, r]) : r.lastReturnValue = a.callback(e, r), a.unregisterOnNextCall && this._deferUnregister(a)), r.skipNextObservers)) return !1 } return !0 }, e.prototype.notifyObserversWithPromise = function(e, t, i, n) { var r = this; void 0 === t && (t = -1); var o = Promise.resolve(e); if (!this._observers.length) return o; var s = this._eventState; return s.mask = t, s.target = i, s.currentTarget = n, s.skipNextObservers = !1, this._observers.forEach(function(i) { s.skipNextObservers || i._willBeUnregistered || i.mask & t && (o = i.scope ? o.then(function(t) { return s.lastReturnValue = t, i.callback.apply(i.scope, [e, s]) }) : o.then(function(t) { return s.lastReturnValue = t, i.callback(e, s) }), i.unregisterOnNextCall && r._deferUnregister(i)) }), o.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 = !1, 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 !0 } return !1 }, e }() }, function(e, t, i) { "use strict"; i.d(t, "c", function() { return g }), i.d(t, "b", function() { return m }), i.d(t, "d", function() { return v }), i.d(t, "e", function() { return y }), i.d(t, "g", function() { return b }), i.d(t, "h", function() { return T }), i.d(t, "f", function() { return E }), i.d(t, "i", function() { return A }), i.d(t, "a", function() { return x }); var n = i(1), r = i(0), o = i(12), s = i(8), a = i(59), c = i(3), l = i(35), u = i(6), h = i(22), d = i(32), f = i(47), p = i(19), _ = i(60), g = function() { function e() {} return e.prototype.getColorToRef = function(e) { this.color2 ? r.f.LerpToRef(this.color1, this.color2, Math.random(), e) : e.copyFrom(this.color1) }, e }(), m = function() { return function() {} }(), v = function() { function e() {} return e.prototype.getFactor = function() { return void 0 === this.factor2 ? this.factor1 : o.a.Lerp(this.factor1, this.factor2, Math.random()) }, e }(), y = 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 n.d(t, e), t._setPrototypeOf = Object.setPrototypeOf || function(e, t) { return e.__proto__ = t, e }, t }(Error), b = 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 } }, e }(), T = function() { function e() {} return e.FetchToRef = function(e, t, i, n, r, o) { var s = 4 * ((Math.abs(e) * i % i | 0) + (Math.abs(t) * n % n | 0) * i); o.r = r[s] / 255, o.g = r[s + 1] / 255, o.b = r[s + 2] / 255, o.a = r[s + 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 = h.a.GetClass(t); if (i) return i; u.a.Warn(t + " not found, you may have missed an import."); for (var n = t.split("."), r = window || this, o = 0, s = n.length; o < s; 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) { l.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 |= 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 = c.a.SCALEMODE_NEAREST), n) { case c.a.SCALEMODE_FLOOR: r = e.FloorPOT(t); break; case c.a.SCALEMODE_NEAREST: r = e.NearestPOT(t); break; case c.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 = !1); 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, s, a, c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", l = "", u = 0, h = new Uint8Array(e); u < h.length;) r = (t = h[u++]) >> 2, o = (3 & t) << 4 | (i = u < h.length ? h[u++] : Number.NaN) >> 4, s = (15 & i) << 2 | (n = u < h.length ? h[u++] : Number.NaN) >> 6, a = 63 & n, isNaN(i) ? s = a = 64 : isNaN(n) && (a = 64), l += c.charAt(r) + c.charAt(o) + c.charAt(s) + c.charAt(a); return "data:image/png;base64," + l }, e.ExtractMinAndMaxIndexed = function(e, t, i, n, o) { void 0 === o && (o = null); for (var s = new r.x(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), a = new r.x(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE), c = i; c < i + n; c++) { var l = 3 * t[c], u = e[l], h = e[l + 1], d = e[l + 2]; s.minimizeInPlaceFromFloats(u, h, d), a.maximizeInPlaceFromFloats(u, h, d) } return o && (s.x -= s.x * o.x + o.y, s.y -= s.y * o.x + o.y, s.z -= s.z * o.x + o.y, a.x += a.x * o.x + o.y, a.y += a.y * o.x + o.y, a.z += a.z * o.x + o.y), { minimum: s, maximum: a } }, e.ExtractMinAndMax = function(e, t, i, n, o) { void 0 === n && (n = null); var s = new r.x(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), a = new r.x(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); o || (o = 3); for (var c = t, l = t * o; c < t + i; c++, l += o) { var u = e[l], h = e[l + 1], d = e[l + 2]; s.minimizeInPlaceFromFloats(u, h, d), a.maximizeInPlaceFromFloats(u, h, d) } return n && (s.x -= s.x * n.x + n.y, s.y -= s.y * n.x + n.y, s.z -= s.z * n.x + n.y, a.x += a.x * n.x + n.y, a.y += a.y * n.x + n.y, a.z += a.z * n.x + n.y), { minimum: s, maximum: a } }, e.MakeArray = function(e, t) { return !0 === t || void 0 !== e && null != e ? Array.isArray(e) ? e : [e] : null }, e.GetPointerPrefix = function() { var e = "pointer"; return !l.a.IsWindowObjectExist() || window.PointerEvent || navigator.pointerEnabled || (e = "mouse"), e }, e.QueueNewFrame = function(e, t) { return l.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 = e.replace(/#/gm, "%23") }, e.LoadImage = function(t, i, n, r) { var o, s = !1; t instanceof ArrayBuffer ? (o = URL.createObjectURL(new Blob([t])), s = !0) : t instanceof Blob ? (o = URL.createObjectURL(t), s = !0) : (o = e.CleanUrl(t), o = e.PreprocessUrl(t)); var c = new Image; e.SetCorsBehavior(o, c); var l = function() { c.removeEventListener("load", l), c.removeEventListener("error", h), i(c), s && c.src && URL.revokeObjectURL(c.src) }, h = function(e) { c.removeEventListener("load", l), c.removeEventListener("error", h), u.a.Error("Error while trying to load image: " + t), n && n("Error while trying to load image: " + t, e), s && c.src && URL.revokeObjectURL(c.src) }; c.addEventListener("load", l), c.addEventListener("error", h); var d = function() { c.src = o }; if ("data:" !== o.substr(0, 5) && r && r.enableTexturesOffline) r.open(function() { r && r.loadImage(o, c) }, d); else { if (-1 !== o.indexOf("file:")) { var f = decodeURIComponent(o.substring(5).toLowerCase()); if (a.a.FilesToLoad[f]) { try { var p; try { p = URL.createObjectURL(a.a.FilesToLoad[f]) } catch (e) { p = URL.createObjectURL(a.a.FilesToLoad[f]) } c.src = p, s = !0 } catch (e) { c.src = "" } return c } } d() } return c }, e.LoadFile = function(t, i, n, r, o, c) { if (t = e.CleanUrl(t), -1 !== (t = e.PreprocessUrl(t)).indexOf("file:")) { var u = decodeURIComponent(t.substring(5).toLowerCase()); if (a.a.FilesToLoad[u]) return e.ReadFile(a.a.FilesToLoad[u], i, n, o) } var h = e.BaseUrl + t, d = !1, f = { onCompleteObservable: new s.c, abort: function() { return d = !0 } }, p = function() { var t = new _.a, r = null; f.abort = function() { d = !0, t.readyState !== (XMLHttpRequest.DONE || 4) && t.abort(), null !== r && (clearTimeout(r), r = null) }; var s = function(a) { t.open("GET", h), o && (t.responseType = "arraybuffer"), n && t.addEventListener("progress", n); var u = function() { t.removeEventListener("loadend", u), f.onCompleteObservable.notifyObservers(f), f.onCompleteObservable.clear() }; t.addEventListener("loadend", u); var p = function() { if (!d && t.readyState === (XMLHttpRequest.DONE || 4)) { if (t.removeEventListener("readystatechange", p), t.status >= 200 && t.status < 300 || 0 === t.status && (!l.a.IsWindowObjectExist() || e.IsFileURL())) return void i(o ? t.response : t.responseText, t.responseURL); var n = e.DefaultRetryStrategy; if (n) { var f = n(h, t, a); if (-1 !== f) return t.removeEventListener("loadend", u), t = new _.a, void(r = setTimeout(function() { return s(a + 1) }, f)) } var g = new y("Error status: " + t.status + " " + t.statusText + " - Unable to load " + h, t); if (!c) throw g; c(t, g) } }; t.addEventListener("readystatechange", p), t.send() }; s(0) }; if (r && r.enableSceneOffline) { var g = function(e) { e && e.status > 400 ? c && c(e) : d || p() }; r.open(function() { d || r && r.loadFile(t, function(e) { d || i(e), f.onCompleteObservable.notifyObservers(f) }, n ? function(e) { d || n(e) } : void 0, g, o) }, g) } else p(); return f }, e.LoadScript = function(e, t, i, n) { if (l.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 Promise(function(i, n) { if (l.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(!0) }, o.onerror = function(e) { i(!1) }, r.appendChild(o) } else i(!1) }) }, 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() } }; return r.onloadend = function(e) { return o.onCompleteObservable.notifyObservers(o) }, r.onerror = function(i) { u.a.Log("Error while reading file: " + e.name), t(JSON.stringify({ autoClear: !0, clearColor: [1, 0, 0], ambientColor: [0, 0, 0], gravity: [0, -9.807, 0], meshes: [], cameras: [], 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) { d.a.DeepCopy(e, t, i, n) }, e.IsEmpty = function(e) { for (var t in e) if (e.hasOwnProperty(t)) return !1; return !0 }, 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, !1); try { window.parent && window.parent.addEventListener(i.name, i.handler, !1) } 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, s) { void 0 === o && (o = "image/png"); for (var a = 4 * t, c = i / 2, l = n.readPixels(0, 0, t, i), u = 0; u < c; u++) for (var h = 0; h < a; h++) { var d = h + u * a, f = h + (i - u - 1) * a, p = l[d]; l[d] = l[f], l[f] = p } e._ScreenshotCanvas || (e._ScreenshotCanvas = document.createElement("canvas")), e._ScreenshotCanvas.width = t, e._ScreenshotCanvas.height = i; var _ = e._ScreenshotCanvas.getContext("2d"); if (_) { var g = _.createImageData(t, i); g.data.set(l), _.putImageData(g, 0, 0), e.EncodeScreenshotCanvasData(r, o, s) } }, 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, s = new Uint8Array(o), a = 0; a < o; a++) s[a] = r.charCodeAt(a); e(new Blob([s])) }) }), 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), s = window.open(""); if (!s) return; var a = s.document.createElement("img"); a.onload = function() { URL.revokeObjectURL(o) }, a.src = o, s.document.body.appendChild(a) } }, 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"), p.a.WarnImport("ScreenshotTools") }, e.CreateScreenshotUsingRenderTarget = function(e, t, i, n, r, o, s, a) { throw void 0 === r && (r = "image/png"), void 0 === o && (o = 1), void 0 === s && (s = !1), p.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 u.a.errorsCount }, enumerable: !0, configurable: !0 }), e.Log = function(e) { u.a.Log(e) }, e.Warn = function(e) { u.a.Warn(e) }, e.Error = function(e) { u.a.Error(e) }, Object.defineProperty(e, "LogCache", { get: function() { return u.a.LogCache }, enumerable: !0, configurable: !0 }), e.ClearLogCache = function() { u.a.ClearLogCache() }, Object.defineProperty(e, "LogLevels", { set: function(e) { u.a.LogLevels = e }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), e._StartPerformanceCounterDisabled = function(e, t) {}, e._EndPerformanceCounterDisabled = function(e, t) {}, e._StartUserMark = function(t, i) { if (void 0 === i && (i = !0), !e._performance) { if (!l.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 = !0), 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 = !0), i && (e._StartUserMark(t, i), console.time && console.time(t)) }, e._EndPerformanceConsole = function(t, i) { void 0 === i && (i = !0), i && (e._EndUserMark(t, i), console.time && console.timeEnd(t)) }, Object.defineProperty(e, "Now", { get: function() { return f.a.Now }, enumerable: !0, configurable: !0 }), e.GetClassName = function(e, t) { void 0 === t && (t = !1); var i = null; if (!t && e.getClassName) i = e.getClassName(); else { if (e instanceof Object) i = (t ? e : Object.getPrototypeOf(e)).constructor.__bjsclassName__; i || (i = typeof e) } return 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 } return null }, e.getFullClassName = function(e, t) { void 0 === t && (t = !1); 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 = typeof e) } return i ? (null != n ? n + "." : "") + i : null }, e.DelayAsync = function(e) { return new Promise(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 s = t.length - 1; i(t[s], t[s], 1) }, e.BaseUrl = "", e.UseCustomRequestHeaders = !1, e.CustomRequestHeaders = _.a.CustomRequestHeaders, e.DefaultRetryStrategy = b.ExponentialBackoff(), e.CorsBehavior = "anonymous", e.UseFallbackTexture = !0, 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 = l.a.GetDOMTextContent, e.PreprocessUrl = function(e) { return e }, e.NoneLogLevel = u.a.NoneLogLevel, e.MessageLogLevel = u.a.MessageLogLevel, e.WarningLogLevel = u.a.WarningLogLevel, e.ErrorLogLevel = u.a.ErrorLogLevel, e.AllLogLevel = u.a.AllLogLevel, e.IsWindowObjectExist = l.a.IsWindowObjectExist, e.PerformanceNoneLogLevel = 0, e.PerformanceUserMarkLogLevel = 1, e.PerformanceConsoleLogLevel = 2, e.StartPerformanceCounter = e._StartPerformanceCounterDisabled, e.EndPerformanceCounter = e._EndPerformanceCounterDisabled, e }(), E = 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "max", { get: function() { return this._max }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "average", { get: function() { return this._average }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "lastSecAverage", { get: function() { return this._lastSecAverage }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "current", { get: function() { return this._current }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "total", { get: function() { return this._totalAccumulated }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "count", { get: function() { return this._totalValueCount }, enumerable: !0, configurable: !0 }), 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 = f.a.Now) }, e.prototype.endMonitoring = function(t) { if (void 0 === t && (t = !0), e.Enabled) { t && this.fetchNewFrame(); var i = f.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 = f.a.Now; e - this._lastSecTime > 1e3 && (this._lastSecAverage = this._lastSecAccumulated / this._lastSecValueCount, this._lastSecTime = e, this._lastSecAccumulated = 0, this._lastSecValueCount = 0) }, e.Enabled = !0, e }(); function A(e, t) { return function(i) { i.__bjsclassName__ = e, i.__bjsmoduleName__ = null != t ? t : null } } var x = function() { function e(e, t, i, n) { void 0 === n && (n = 0), this.iterations = e, this.index = n - 1, this._done = !1, 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 = !0, 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, s) { return void 0 === s && (s = 0), e.Run(Math.ceil(t / i), function(e) { o && o() ? e.breakLoop() : setTimeout(function() { for (var r = 0; r < i; ++r) { var s = e.index * i + r; if (s >= t) break; if (n(s), o && o()) { e.breakLoop(); break } } e.executeNext() }, s) }, r) }, e }() }, function(e, t, i) { "use strict"; i.d(t, "d", function() { return x }), i.d(t, "a", function() { return R }), i.d(t, "c", function() { return P }), i.d(t, "b", function() { return S }); var n = i(1), r = i(8), o = i(105), s = i(61), a = i(106), c = i(9), l = i(0), u = i(12), h = i(5), d = i(20), f = i(26), p = i(94), _ = i(3), g = i(35), m = i(6), v = i(23), y = i(92), b = i(19), T = i(107), E = i(73), A = function() { return function() {} }(), x = function() { return function() {} }(), R = function() { return function() {} }(), P = function() { return function() {} }(), S = function() { function e(t, i, n, s) { var u = this; void 0 === s && (s = !1), this.forcePOTTextures = !1, this.isFullscreen = !1, this.isPointerLock = !1, this.cullBackFaces = !0, this.renderEvenInBackground = !0, this.preventCacheWipeBetweenFrames = !1, this.enableOfflineSupport = !1, this.disableManifestCheck = !1, this.scenes = new Array, this.onNewSceneAddedObservable = new r.c, this.postProcesses = new Array, this.validateShaderPrograms = !1, this.onResizeObservable = new r.c, this.onCanvasBlurObservable = new r.c, this.onCanvasFocusObservable = new r.c, this.onCanvasPointerOutObservable = new r.c, this.onBeforeTextureInitObservable = new r.c, this.disableUniformBuffers = !1, this._uniformBuffers = new Array, this.onBeginFrameObservable = new r.c, this.customAnimationFrameRequester = null, this.onEndFrameObservable = new r.c, this.onBeforeShaderCompilationObservable = new r.c, this.onAfterShaderCompilationObservable = new r.c, this._windowIsBackground = !1, this._webGLVersion = 1, this._highPrecisionShadersAllowed = !0, this._badOS = !1, this._badDesktopOS = !1, this._colorWrite = !0, this._drawCalls = new c.f, this._renderingQueueLaunched = !1, this._activeRenderLoops = new Array, this._deterministicLockstep = !1, this._lockstepMaxSteps = 4, this.onContextLostObservable = new r.c, this.onContextRestoredObservable = new r.c, this._contextWasLost = !1, this._doNotHandleContextLost = !1, this._performanceMonitor = new o.a, this._fps = 60, this._deltaTime = 0, this.disablePerformanceMonitorInBackground = !1, this.disableVertexArrayObjects = !1, this._depthCullingState = new p.b, this._stencilState = new p.c, this._alphaState = new p.a, this._alphaMode = e.ALPHA_DISABLE, this._internalTexturesCache = new Array, this._activeChannel = 0, this._currentTextureChannel = -1, this._boundTexturesCache = {}, this._compiledEffects = {}, this._vertexAttribArraysEnabled = [], this._uintIndicesCurrentlySet = !1, this._currentBoundBuffer = new Array, this._currentFramebuffer = null, this._currentBufferPointers = new Array, this._currentInstanceLocations = new Array, this._currentInstanceBuffers = new Array, this._vaoRecordInProgress = !1, this._mustWipeVertexAttributes = !1, this._nextFreeTextureSlots = new Array, this._maxSimultaneousTextures = 0, this._activeRequests = new Array, this._texturesSupported = new Array, this.premultipliedAlpha = !0, this._viewportCached = new l.y(0, 0, 0, 0), this._unpackFlipYCached = null, this.enableUnpackFlipYCached = !0, this._boundUniforms = {}, a.a.Apply(); var h = null; if (e.Instances.push(this), t) { if (n = n || {}, t.getContext) { if (h = t, this._renderingCanvas = h, null != i && (n.antialias = i), void 0 === n.deterministicLockstep && (n.deterministicLockstep = !1), void 0 === n.lockstepMaxSteps && (n.lockstepMaxSteps = 4), void 0 === n.preserveDrawingBuffer && (n.preserveDrawingBuffer = !1), void 0 === n.audioEngine && (n.audioEngine = !0), void 0 === n.stencil && (n.stencil = !0), !1 === n.premultipliedAlpha && (this.premultipliedAlpha = !1), this._deterministicLockstep = n.deterministicLockstep, this._lockstepMaxSteps = n.lockstepMaxSteps, this._doNotHandleContextLost = !!n.doNotHandleContextLost, navigator && navigator.userAgent) for (var d = navigator.userAgent, f = 0, _ = e.ExceptionList; f < _.length; f++) { var v = _[f], y = v.key, b = v.targets; if (new RegExp(y).test(d)) { if (v.capture && v.captureConstraint) { var T = v.capture, E = v.captureConstraint, x = new RegExp(T).exec(d); if (x && x.length > 0) if (parseInt(x[x.length - 1]) >= E) continue } for (var R = 0, P = b; R < P.length; R++) { switch (P[R]) { case "uniformBuffer": this.disableUniformBuffers = !0; break; case "vao": this.disableVertexArrayObjects = !0 } } } } if (!n.disableWebGL2Support) try { this._gl = h.getContext("webgl2", n) || h.getContext("experimental-webgl2", n), this._gl && (this._webGLVersion = 2, this._gl.deleteQuery || (this._webGLVersion = 1)) } catch (e) {} if (!this._gl) { if (!h) throw new Error("The provided canvas is null or undefined."); try { this._gl = h.getContext("webgl", n) || h.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() { u.onCanvasFocusObservable.notifyObservers(u) }, this._onCanvasBlur = function() { u.onCanvasBlurObservable.notifyObservers(u) }, h.addEventListener("focus", this._onCanvasFocus), h.addEventListener("blur", this._onCanvasBlur), this._onBlur = function() { u.disablePerformanceMonitorInBackground && u._performanceMonitor.disable(), u._windowIsBackground = !0 }, this._onFocus = function() { u.disablePerformanceMonitorInBackground && u._performanceMonitor.enable(), u._windowIsBackground = !1 }, this._onCanvasPointerOut = function(e) { u.onCanvasPointerOutObservable.notifyObservers(e) }, g.a.IsWindowObjectExist() && (window.addEventListener("blur", this._onBlur), window.addEventListener("focus", this._onFocus)), h.addEventListener("pointerout", this._onCanvasPointerOut), this._doNotHandleContextLost || (this._onContextLost = function(e) { e.preventDefault(), u._contextWasLost = !0, m.a.Warn("WebGL context lost."), u.onContextLostObservable.notifyObservers(u) }, this._onContextRestored = function() { setTimeout(function() { u._initGLContext(), u._rebuildEffects(), u._rebuildInternalTextures(), u._rebuildBuffers(), u.wipeCaches(!0), m.a.Warn("WebGL context successfully restored."), u.onContextRestoredObservable.notifyObservers(u), u._contextWasLost = !1 }, 0) }, h.addEventListener("webglcontextlost", this._onContextLost, !1), h.addEventListener("webglcontextrestored", this._onContextRestored, !1)), n.doNotHandleTouchAction || this._disableTouchAction() } else { this._gl = t, this._renderingCanvas = this._gl.canvas, this._gl.renderbufferStorageMultisample && (this._webGLVersion = 2); var S = this._gl.getContextAttributes(); S && (n.stencil = S.stencil) } void 0 !== n.useHighPrecisionFloats && (this._highPrecisionShadersAllowed = n.useHighPrecisionFloats); var C = g.a.IsWindowObjectExist() && window.devicePixelRatio || 1, M = n.limitDeviceRatio || C; if (this._hardwareScalingLevel = s ? 1 / Math.min(M, C) : 1, this.resize(), this._isStencilEnable = !!n.stencil, this._initGLContext(), h) { var O = document; this._onFullscreenChange = function() { void 0 !== O.fullscreen ? u.isFullscreen = O.fullscreen : void 0 !== O.mozFullScreen ? u.isFullscreen = O.mozFullScreen : void 0 !== O.webkitIsFullScreen ? u.isFullscreen = O.webkitIsFullScreen : void 0 !== O.msIsFullScreen && (u.isFullscreen = O.msIsFullScreen), u.isFullscreen && u._pointerLockRequested && h && (h.requestPointerLock = h.requestPointerLock || h.msRequestPointerLock || h.mozRequestPointerLock || h.webkitRequestPointerLock, h.requestPointerLock && h.requestPointerLock()) }, document.addEventListener("fullscreenchange", this._onFullscreenChange, !1), document.addEventListener("mozfullscreenchange", this._onFullscreenChange, !1), document.addEventListener("webkitfullscreenchange", this._onFullscreenChange, !1), document.addEventListener("msfullscreenchange", this._onFullscreenChange, !1), this._onPointerLockChange = function() { u.isPointerLock = O.mozPointerLockElement === h || O.webkitPointerLockElement === h || O.msPointerLockElement === h || O.pointerLockElement === h }, document.addEventListener("pointerlockchange", this._onPointerLockChange, !1), document.addEventListener("mspointerlockchange", this._onPointerLockChange, !1), document.addEventListener("mozpointerlockchange", this._onPointerLockChange, !1), document.addEventListener("webkitpointerlockchange", this._onPointerLockChange, !1), this._connectVREvents(h, O) }!e.audioEngine && n.audioEngine && e.AudioEngineFactory && (e.audioEngine = e.AudioEngineFactory(this.getRenderingCanvas())); for (var I = 0; I < this._caps.maxVertexAttribs; I++) this._currentBufferPointers[I] = new A; 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 v.a.Instances }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "LastCreatedEngine", { get: function() { return v.a.LastCreatedEngine }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "LastCreatedScene", { get: function() { return v.a.LastCreatedScene }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), Object.defineProperty(e, "Version", { get: function() { return "4.0.3" }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "description", { get: function() { var e = "WebGL" + this.webGLVersion; return this._caps.parallelShaderCompile && (e += " - Parallel shader compilation"), e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "ShadersRepository", { get: function() { return h.a.ShadersRepository }, set: function(e) { h.a.ShadersRepository = e }, enumerable: !0, configurable: !0 }), e.DefaultLoadingScreenFactory = function(e) { throw b.a.WarnImport("LoadingScreen") }, Object.defineProperty(e.prototype, "supportsUniformBuffers", { get: function() { return this.webGLVersion > 1 && !this.disableUniformBuffers }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "_shouldUseHighPrecisionShader", { get: function() { return this._caps.highPrecisionShaderSupported && this._highPrecisionShadersAllowed }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "needPOTTextures", { get: function() { return this._webGLVersion < 2 || this.forcePOTTextures }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "doNotHandleContextLost", { get: function() { return this._doNotHandleContextLost }, set: function(e) { this._doNotHandleContextLost = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "performanceMonitor", { get: function() { return this._performanceMonitor }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "texturesSupported", { get: function() { return this._texturesSupported }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "textureFormatInUse", { get: function() { return this._textureFormatInUse }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "currentViewport", { get: function() { return this._cachedViewport }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "emptyTexture", { get: function() { return this._emptyTexture || (this._emptyTexture = this.createRawTexture(new Uint8Array(4), 1, 1, e.TEXTUREFORMAT_RGBA, !1, !1, e.TEXTURE_NEAREST_SAMPLINGMODE)), this._emptyTexture }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "emptyTexture3D", { get: function() { return this._emptyTexture3D || (this._emptyTexture3D = this.createRawTexture3D(new Uint8Array(4), 1, 1, 1, e.TEXTUREFORMAT_RGBA, !1, !1, e.TEXTURE_NEAREST_SAMPLINGMODE)), this._emptyTexture3D }, enumerable: !0, configurable: !0 }), 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, !1, !1, e.TEXTURE_NEAREST_SAMPLINGMODE) } return this._emptyCubeTexture }, enumerable: !0, configurable: !0 }), e.prototype.initWebVR = function() { throw b.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 !1 }, 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() } h.a.ResetCache() }, e.prototype.areAllEffectsReady = function() { for (var e in this._compiledEffects) { if (!this._compiledEffects[e].isReady()) return !1 } return !0 }, 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 P, 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 = !1, 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 = !0; else { var t = this._gl.getExtension("WEBGL_draw_buffers"); if (null !== t) { this._caps.drawBuffersExtension = !0, 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 = !1 } if (this._caps.parallelShaderCompile = this._gl.getExtension("KHR_parallel_shader_compile"), this._webGLVersion > 1) this._caps.depthTextureExtension = !0; else { var n = this._gl.getExtension("WEBGL_depth_texture"); null != n && (this._caps.depthTextureExtension = !0, this._gl.UNSIGNED_INT_24_8 = n.UNSIGNED_INT_24_8_WEBGL) } if (this.disableVertexArrayObjects) this._caps.vertexArrayObject = !1; else if (this._webGLVersion > 1) this._caps.vertexArrayObject = !0; else { var r = this._gl.getExtension("OES_vertex_array_object"); null != r ? (this._caps.vertexArrayObject = !0, this._gl.createVertexArray = r.createVertexArrayOES.bind(r), this._gl.bindVertexArray = r.bindVertexArrayOES.bind(r), this._gl.deleteVertexArray = r.deleteVertexArrayOES.bind(r)) : this._caps.vertexArrayObject = !1 } if (this._webGLVersion > 1) this._caps.instancedArrays = !0; else { var o = this._gl.getExtension("ANGLE_instanced_arrays"); null != o ? (this._caps.instancedArrays = !0, this._gl.drawArraysInstanced = o.drawArraysInstancedANGLE.bind(o), this._gl.drawElementsInstanced = o.drawElementsInstancedANGLE.bind(o), this._gl.vertexAttribDivisor = o.vertexAttribDivisorANGLE.bind(o)) : this._caps.instancedArrays = !1 } 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 s = this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER, this._gl.HIGH_FLOAT), a = this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER, this._gl.HIGH_FLOAT); s && a && (this._caps.highPrecisionShaderSupported = 0 !== s.precision && 0 !== a.precision) } this.setDepthBuffer(!0), this.setDepthFunctionToLessOrEqual(), this.setDepthWrite(!0), 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "isStencilEnable", { get: function() { return this._isStencilEnable }, enumerable: !0, configurable: !0 }), 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 = !1); var i = e.viewport; return this.getRenderWidth(t) * i.width / (this.getRenderHeight(t) * i.height) }, e.prototype.getScreenAspectRatio = function() { return this.getRenderWidth(!0) / this.getRenderHeight(!0) }, e.prototype.getRenderWidth = function(e) { return void 0 === e && (e = !1), !e && this._currentRenderTarget ? this._currentRenderTarget.width : this._gl.drawingBufferWidth }, e.prototype.getRenderHeight = function(e) { return void 0 === e && (e = !1), !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 = !0; if (!this.renderEvenInBackground && this._windowIsBackground && (e = !1), 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 = c.h.QueueNewFrame(this.customAnimationFrameRequester.renderFunction || this._bindedRenderFunction, this.customAnimationFrameRequester), this._frameHandler = this.customAnimationFrameRequester.requestID) : this.isVRPresenting() ? this._requestVRFrame() : this._frameHandler = c.h.QueueNewFrame(this._bindedRenderFunction) : this._renderingQueueLaunched = !1 }, e.prototype.runRenderLoop = function(e) { -1 === this._activeRenderLoops.indexOf(e) && (this._activeRenderLoops.push(e), this._renderingQueueLaunched || (this._renderingQueueLaunched = !0, this._bindedRenderFunction = this._renderLoop.bind(this), this._frameHandler = c.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 && c.h.RequestFullscreen(this._renderingCanvas)) }, e.prototype.exitFullscreen = function() { this.isFullscreen && c.h.ExitFullscreen() }, e.prototype.clear = function(e, t, i, n) { void 0 === n && (n = !1), 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, !0, !0, !0), 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, s = e.y || 0; this._cachedViewport = e, this._viewport(o * n, s * 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(), 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, s) { void 0 === s && (s = 0), this._currentRenderTarget && this.unBindFramebuffer(this._currentRenderTarget), this._currentRenderTarget = e, this._bindUnboundFramebuffer(e._MSAAFramebuffer ? e._MSAAFramebuffer : e._framebuffer); var a = this._gl; e.isCube && (void 0 === t && (t = 0), a.framebufferTexture2D(a.FRAMEBUFFER, a.COLOR_ATTACHMENT0, a.TEXTURE_CUBE_MAP_POSITIVE_X + t, e._webGLTexture, s), o && (o._generateStencilBuffer ? a.framebufferTexture2D(a.FRAMEBUFFER, a.DEPTH_STENCIL_ATTACHMENT, a.TEXTURE_CUBE_MAP_POSITIVE_X + t, o._webGLTexture, s) : a.framebufferTexture2D(a.FRAMEBUFFER, a.DEPTH_ATTACHMENT, a.TEXTURE_CUBE_MAP_POSITIVE_X + t, o._webGLTexture, s))), this._cachedViewport && !r ? this.setViewport(this._cachedViewport, i, n) : (i || (i = e.width, s && (i /= Math.pow(2, s))), n || (n = e.height, s && (n /= Math.pow(2, s))), 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 = !1), 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, !0), 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, !0), 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 E.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 }, e.prototype.createDynamicUniformBuffer = function(e) { var t = this._gl.createBuffer(); if (!t) throw new Error("Unable to create dynamic uniform buffer"); var i = new E.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 }, 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 E.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 }, e.prototype.createDynamicVertexBuffer = function(e) { var t = this._gl.createBuffer(); if (!t) throw new Error("Unable to create dynamic vertex buffer"); var i = new E.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 }, 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), 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 E.a(n); if (!n) throw new Error("Unable to create index buffer"); this.bindIndexBuffer(r); var o = !1; if (e instanceof Uint16Array) i = e; else if (this._caps.uintIndices) if (e instanceof Uint32Array) i = e, o = !0; else { for (var s = 0; s < e.length; s++) if (e[s] > 65535) { o = !0; break } 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 }, 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, s) { var a = this._currentBufferPointers[t], c = !1; a.active ? (a.buffer !== e && (a.buffer = e, c = !0), a.size !== i && (a.size = i, c = !0), a.type !== n && (a.type = n, c = !0), a.normalized !== r && (a.normalized = r, c = !0), a.stride !== o && (a.stride = o, c = !0), a.offset !== s && (a.offset = s, c = !0)) : (c = !0, a.active = !0, a.index = t, a.size = i, a.type = n, a.normalized = r, a.stride = o, a.offset = s, a.buffer = e), (c || this._vaoRecordInProgress) && (this.bindArrayBuffer(e), this._gl.vertexAttribPointer(t, i, n, r, o, s)) }, 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.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] = !0); var s = o.getBuffer(); s && (this._vertexAttribPointer(s, 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(s)))) } } }, e.prototype.recordVertexArrayObject = function(e, t, i) { var n = this._gl.createVertexArray(); return this._vaoRecordInProgress = !0, this._gl.bindVertexArray(n), this._mustWipeVertexAttributes = !0, this._bindVertexBuffersAttributes(e, i), this.bindIndexBuffer(t), this._vaoRecordInProgress = !1, this._gl.bindVertexArray(null), n }, 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 = !0) }, 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 s = 0, a = 0; a < o; a++) if (a < i.length) { var c = r.getAttributeLocation(a); c >= 0 && (this._gl.enableVertexAttribArray(c), this._vertexAttribArraysEnabled[c] = !0, this._vertexAttribPointer(e, c, i[a], this._gl.FLOAT, !1, n, s)), s += 4 * i[a] } } 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), !0) }, e.prototype.createInstancesBuffer = function(e) { var t = this._gl.createBuffer(); if (!t) throw new Error("Unable to create instance buffer"); var i = new E.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] = !0), this._vertexAttribPointer(e, o.index, o.attributeSize, o.attribyteType || this._gl.FLOAT, o.normalized || !1, n, o.offset), this._gl.vertexAttribDivisor(o.index, 1), this._currentInstanceLocations.push(o.index), this._currentInstanceBuffers.push(e) } } else for (var s = 0; s < 4; s++) { var a = i[s]; this._vertexAttribArraysEnabled[a] || (this._gl.enableVertexAttribArray(a), this._vertexAttribArraysEnabled[a] = !0), this._vertexAttribPointer(e, a, 4, this._gl.FLOAT, !1, 64, 16 * s), this._gl.vertexAttribDivisor(a, 1), this._currentInstanceLocations.push(a), 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 ? d.a.TriangleFillMode : d.a.WireFrameFillMode, t, i, n) }, e.prototype.drawPointClouds = function(e, t, i) { this.drawArraysType(d.a.PointFillMode, e, t, i) }, e.prototype.drawUnIndexed = function(e, t, i, n) { this.drawArraysType(e ? d.a.TriangleFillMode : d.a.WireFrameFillMode, t, i, n) }, e.prototype.drawElementsType = function(e, t, i, n) { this.applyStates(), this._drawCalls.addCount(1, !1); var r = this._drawMode(e), o = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT, s = this._uintIndicesCurrentlySet ? 4 : 2; n ? this._gl.drawElementsInstanced(r, i, o, t * s, n) : this._gl.drawElements(r, i, o, t * s) }, e.prototype.drawArraysType = function(e, t, i, n) { this.applyStates(), this._drawCalls.addCount(1, !1); 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 d.a.TriangleFillMode: return this._gl.TRIANGLES; case d.a.PointFillMode: return this._gl.POINTS; case d.a.WireFrameFillMode: return this._gl.LINES; case d.a.PointListDrawMode: return this._gl.POINTS; case d.a.LineListDrawMode: return this._gl.LINES; case d.a.LineLoopDrawMode: return this._gl.LINE_LOOP; case d.a.LineStripDrawMode: return this._gl.LINE_STRIP; case d.a.TriangleStripDrawMode: return this._gl.TRIANGLE_STRIP; case d.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, s, a, c) { var l = (e.vertexElement || e.vertex || e) + "+" + (e.fragmentElement || e.fragment || e) + "@" + (r || t.defines); if (this._compiledEffects[l]) { var u = this._compiledEffects[l]; return s && u.isReady() && s(u), u } var d = new h.a(e, t, i, n, this, r, o, s, a, c); return d._key = l, this._compiledEffects[l] = d, d }, 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"), s = this._compileRawShader(i, "fragment"); return this._createShaderProgram(e, o, s, 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 s = this._webGLVersion > 1 ? "#version 300 es\n#define WEBGL2 \n" : "", a = this._compileShader(t, "vertex", n, s), c = this._compileShader(i, "fragment", n, s), l = this._createShaderProgram(e, a, c, r, o); return this.onAfterShaderCompilationObservable.notifyObservers(this), l }, e.prototype.createPipelineContext = function() { var e = new T.a; return e.engine = this, this._caps.parallelShaderCompile && (e.isParallelCompiled = !0), 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 s = this.createTransformFeedback(); this.bindTransformFeedback(s), this.setTranformFeedbackVaryings(o, r), e.transformFeedback = s } 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, s; if (!this._gl.getShaderParameter(i, this._gl.COMPILE_STATUS)) if (o = this._gl.getShaderInfoLog(i)) throw new Error(o); if (!this._gl.getShaderParameter(n, this._gl.COMPILE_STATUS)) if (o = this._gl.getShaderInfoLog(n)) throw new Error(o); if (s = t.getProgramInfoLog(r)) throw new Error(s) } if (this.validateShaderPrograms && (t.validateProgram(r), !t.getProgramParameter(r, t.VALIDATE_STATUS) && (s = t.getProgramInfoLog(r)))) throw new Error(s); 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, s) { var a = e; a.program = n ? this.createRawShaderProgram(a, t, i, void 0, s) : this.createShaderProgram(a, t, i, o, void 0, s), a.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), !0) }, 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, !1, t) }, e.prototype.setMatrix = function(e, t) { e && this._gl.uniformMatrix4fv(e, !1, t.toArray()) }, e.prototype.setMatrix3x3 = function(e, t) { e && this._gl.uniformMatrix3fv(e, !1, t) }, e.prototype.setMatrix2x2 = function(e, t) { e && this._gl.uniformMatrix2fv(e, !1, 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 = !1), (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 = !1), this._alphaMode !== t) { switch (t) { case e.ALPHA_DISABLE: this._alphaState.alphaBlend = !1; 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 = !0; 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 = !0; 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 = !0; break; case e.ALPHA_ONEONE: this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ZERO, this._gl.ONE), this._alphaState.alphaBlend = !0; break; case e.ALPHA_ADD: this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ONE), this._alphaState.alphaBlend = !0; 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 = !0; break; case e.ALPHA_MULTIPLY: this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR, this._gl.ZERO, this._gl.ONE, this._gl.ONE), this._alphaState.alphaBlend = !0; 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 = !0; 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 = !0; 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 = !0 } 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; case e.TEXTURE_TRILINEAR_SAMPLINGMODE: 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; case e.TEXTURE_NEAREST_NEAREST_MIPNEAREST: 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; case e.TEXTURE_NEAREST_LINEAR_MIPLINEAR: r = n.NEAREST, o = i ? n.LINEAR_MIPMAP_LINEAR : n.LINEAR; break; case e.TEXTURE_NEAREST_LINEAR: r = n.NEAREST, o = n.LINEAR; break; case e.TEXTURE_NEAREST_NEAREST: 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; case e.TEXTURE_LINEAR_NEAREST_MIPLINEAR: r = n.LINEAR, o = i ? n.NEAREST_MIPMAP_LINEAR : n.NEAREST; break; case e.TEXTURE_LINEAR_LINEAR: 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, s, a, l, u, h, d, p) { var _ = this; void 0 === o && (o = e.TEXTURE_TRILINEAR_SAMPLINGMODE), void 0 === s && (s = null), void 0 === a && (a = null), void 0 === l && (l = null), void 0 === u && (u = null), void 0 === h && (h = null), void 0 === d && (d = null), void 0 === p && (p = []); for (var g = String(t), m = "data:" === g.substr(0, 5), v = "blob:" === g.substr(0, 5), y = m && -1 !== g.indexOf(";base64,"), b = u || new f.a(this, f.a.DATASOURCE_URL), T = g.lastIndexOf("."), E = d || (T > -1 ? g.substring(T).toLowerCase() : ""), A = null, x = 0, R = e._TextureLoaders; x < R.length; x++) { var P = R[x]; if (-1 === p.indexOf(P) && P.canLoad(E, this._textureFormatInUse, u, y, !!l)) { A = P; break } } A && (g = A.transformUrl(g, this._textureFormatInUse)), r && r._addPendingData(b), b.url = g, b.generateMipMaps = !i, b.samplingMode = o, b.invertY = n, this._doNotHandleContextLost || (b._buffer = l); var S = null; s && !u && (S = b.onLoadedObservable.add(s)), u || this._internalTexturesCache.push(b); var C = function(e, n) { r && r._removePendingData(b); var s = !1; A && (A.getFallbackTextureUrl(g, _._textureFormatInUse) && (s = !0, p.push(A), c.h.Warn(A.constructor.name + " failed when trying to load " + b.url + ", falling back to the next supported loader"), _.createTexture(t, i, b.invertY, r, o, null, null, l, b, void 0, void 0, p))); s || (S && b.onLoadedObservable.remove(S), c.h.UseFallbackTexture && _.createTexture(c.h.fallbackTexture, i, b.invertY, r, o, null, null, l, b)), a && a(e || "Unknown error", n) }; if (A) { var M = function(e) { A.loadData(e, b, function(e, t, i, n, s, a) { a ? C("TextureLoader failed to load data") : _._prepareWebGLTexture(b, r, e, t, b.invertY, !i, n, function() { return s(), !1 }, o) }) }; l ? M(l) : this._loadFile(g, M, void 0, r ? r.offlineProvider : void 0, !0, function(e, t) { C("Unable to load " + (e && e.responseURL, t)) }) } else { var O = function(t) { v && !_._doNotHandleContextLost && (b._buffer = t), _._prepareWebGLTexture(b, r, t.width, t.height, b.invertY, i, !1, function(i, n, o) { var s = _._gl, a = t.width === i && t.height === n, c = h ? _._getInternalFormat(h) : ".jpg" === E ? s.RGB : s.RGBA; if (a) return s.texImage2D(s.TEXTURE_2D, 0, c, c, s.UNSIGNED_BYTE, t), !1; var l = _._caps.maxTextureSize; if (t.width > l || t.height > l || null === e._RescalePostProcessFactory) return _._prepareWorkingCanvas(), !(!_._workingCanvas || !_._workingContext) && (_._workingCanvas.width = i, _._workingCanvas.height = n, _._workingContext.drawImage(t, 0, 0, t.width, t.height, 0, 0, i, n), s.texImage2D(s.TEXTURE_2D, 0, c, c, s.UNSIGNED_BYTE, _._workingCanvas), b.width = i, b.height = n, !1); var u = new f.a(_, f.a.DATASOURCE_TEMP); return _._bindTextureDirectly(s.TEXTURE_2D, u, !0), s.texImage2D(s.TEXTURE_2D, 0, c, c, s.UNSIGNED_BYTE, t), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MAG_FILTER, s.LINEAR), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MIN_FILTER, s.LINEAR), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_S, s.CLAMP_TO_EDGE), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_T, s.CLAMP_TO_EDGE), _._rescaleTexture(u, b, r, c, function() { _._releaseTexture(u), _._bindTextureDirectly(s.TEXTURE_2D, b, !0), o() }), !0 }, o) }; !m || y ? l instanceof HTMLImageElement ? O(l) : c.h.LoadImage(g, O, C, r ? r.offlineProvider : null) : "string" == typeof l || l instanceof ArrayBuffer || l instanceof Blob ? c.h.LoadImage(l, O, C, r ? r.offlineProvider : null) : O(l) } return b }, e.prototype._rescaleTexture = function(t, i, n, r, o) { var s = this, a = this.createRenderTargetTexture({ width: i.width, height: i.height }, { generateMipMaps: !1, type: e.TEXTURETYPE_UNSIGNED_INT, samplingMode: e.TEXTURE_BILINEAR_SAMPLINGMODE, generateDepthBuffer: !1, generateStencilBuffer: !1 }); !this._rescalePostProcess && e._RescalePostProcessFactory && (this._rescalePostProcess = e._RescalePostProcessFactory(this)), this._rescalePostProcess.getEffect().executeWhenCompiled(function() { s._rescalePostProcess.onApply = function(e) { e._bindTexture("textureSampler", t) }; var e = n; e || (e = s.scenes[s.scenes.length - 1]), e.postProcessManager.directRender([s._rescalePostProcess], a, !0), s._bindTextureDirectly(s._gl.TEXTURE_2D, i, !0), s._gl.copyTexImage2D(s._gl.TEXTURE_2D, 0, r, 0, 0, i.width, i.height, 0), s.unBindFramebuffer(a), s._releaseTexture(a), o && o() }) }, e.prototype.createRawTexture = function(t, i, n, r, o, s, a, c, l) { throw void 0 === c && (c = null), void 0 === l && (l = e.TEXTURETYPE_UNSIGNED_INT), b.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 f.a(this, f.a.DATASOURCE_DYNAMIC); return r.baseWidth = e, r.baseHeight = t, i && (e = this.needPOTTextures ? c.h.GetExponentOfTwo(e, this._caps.maxTextureSize) : e, t = this.needPOTTextures ? c.h.GetExponentOfTwo(t, this._caps.maxTextureSize) : t), r.width = e, r.height = t, r.isReady = !1, 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 = !1), void 0 === o && (o = !1), e) { this._bindTextureDirectly(this._gl.TEXTURE_2D, e, !0, o), this._unpackFlipY(i), n && this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1); var s = r ? this._getInternalFormat(r) : this._gl.RGBA; this._gl.texImage2D(this._gl.TEXTURE_2D, 0, s, s, 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 = !0 } }, e.prototype.updateVideoTexture = function(e, t, i) { if (e && !e._isDisabled) { var n = this._bindTextureDirectly(this._gl.TEXTURE_2D, e, !0); 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 = !1 : this._videoTextureSupported = !0), 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 = !0 } catch (t) { e._isDisabled = !0 } } }, e.prototype.updateTextureComparisonFunction = function(t, i) { if (1 !== this.webGLVersion) { var n = this._gl; t.isCube ? (this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, t, !0), 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, !0), 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 m.a.Error("WebGL 1 does not support texture comparison.") }, e.prototype._setupDepthStencilTexture = function(t, i, n, r, o) { var s = i.width || i, a = i.height || i; t.baseWidth = s, t.baseHeight = a, t.width = s, t.height = a, t.isReady = !0, t.samples = 1, t.generateMipMaps = !1, t._generateDepthBuffer = !0, 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, l = t.isCube ? c.TEXTURE_CUBE_MAP : c.TEXTURE_2D, u = this._getSamplingParameters(t.samplingMode, !1); c.texParameteri(l, c.TEXTURE_MAG_FILTER, u.mag), c.texParameteri(l, c.TEXTURE_MIN_FILTER, u.min), c.texParameteri(l, c.TEXTURE_WRAP_S, c.CLAMP_TO_EDGE), c.texParameteri(l, c.TEXTURE_WRAP_T, c.CLAMP_TO_EDGE), 0 === o ? (c.texParameteri(l, c.TEXTURE_COMPARE_FUNC, e.LEQUAL), c.texParameteri(l, c.TEXTURE_COMPARE_MODE, c.NONE)) : (c.texParameteri(l, c.TEXTURE_COMPARE_FUNC, o), c.texParameteri(l, 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 f.a(this, f.a.DATASOURCE_DEPTHTEXTURE); if (!this._caps.depthTextureExtension) return m.a.Error("Depth texture is not supported by your browser or hardware."), i; var r = n.a({ bilinearFiltering: !1, comparisonFunction: 0, generateStencil: !1 }, t), o = this._gl; return this._bindTextureDirectly(o.TEXTURE_2D, i, !0), this._setupDepthStencilTexture(i, e, r.generateStencil, r.bilinearFiltering, r.comparisonFunction), this.webGLVersion > 1 ? r.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) : r.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 y.a; void 0 !== i && "object" == typeof 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 = !0, n.generateStencilBuffer = !1, 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 f.a(this, f.a.DATASOURCE_RENDERTARGET); this._bindTextureDirectly(r.TEXTURE_2D, o, !0); var s = t.width || t, a = t.height || t, c = this._getSamplingParameters(n.samplingMode, !!n.generateMipMaps); n.type !== e.TEXTURETYPE_FLOAT || this._caps.textureFloat || (n.type = e.TEXTURETYPE_UNSIGNED_INT, m.a.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type")), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, c.mag), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, c.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), s, a, 0, this._getInternalFormat(n.format), this._getWebGLTextureType(n.type), null); var l = this._currentFramebuffer, u = r.createFramebuffer(); return this._bindUnboundFramebuffer(u), r.framebufferTexture2D(r.FRAMEBUFFER, r.COLOR_ATTACHMENT0, r.TEXTURE_2D, o._webGLTexture, 0), o._depthStencilBuffer = this._setupFramebufferDepthAttachments(!!n.generateStencilBuffer, n.generateDepthBuffer, s, a), 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 = u, o.baseWidth = s, o.baseHeight = a, o.width = s, o.height = a, o.isReady = !0, 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, s = this._gl; return e ? (o = s.createRenderbuffer(), s.bindRenderbuffer(s.RENDERBUFFER, o), r > 1 ? s.renderbufferStorageMultisample(s.RENDERBUFFER, r, s.DEPTH24_STENCIL8, i, n) : s.renderbufferStorage(s.RENDERBUFFER, s.DEPTH_STENCIL, i, n), s.framebufferRenderbuffer(s.FRAMEBUFFER, s.DEPTH_STENCIL_ATTACHMENT, s.RENDERBUFFER, o)) : t && (o = s.createRenderbuffer(), s.bindRenderbuffer(s.RENDERBUFFER, o), r > 1 ? s.renderbufferStorageMultisample(s.RENDERBUFFER, r, s.DEPTH_COMPONENT16, i, n) : s.renderbufferStorage(s.RENDERBUFFER, s.DEPTH_COMPONENT16, i, n), s.framebufferRenderbuffer(s.FRAMEBUFFER, s.DEPTH_ATTACHMENT, s.RENDERBUFFER, o)), o }, 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, 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, s) { void 0 === o && (o = 0), void 0 === s && (s = 0); var a = this._gl, c = a.TEXTURE_2D; e.isCube && (c = a.TEXTURE_CUBE_MAP_POSITIVE_X + o), this._gl.compressedTexImage2D(c, s, 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), s = this._getInternalFormat(e.format), a = this._getRGBABufferInternalSizedFormat(e.type, s); this._unpackFlipY(e.invertY); var c = r.TEXTURE_2D; e.isCube && (c = r.TEXTURE_CUBE_MAP_POSITIVE_X + i); var l = Math.round(u.a.Log2(e.width)), h = Math.round(u.a.Log2(e.height)), d = Math.pow(2, Math.max(l - n, 0)), f = Math.pow(2, Math.max(h - n, 0)); r.texImage2D(c, n, a, d, f, 0, s, 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, !0), this._uploadDataToTextureDirectly(e, t, i, n), this._bindTextureDirectly(o, null, !0) }, 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), s = this._getInternalFormat(e.format), a = this._getRGBABufferInternalSizedFormat(e.type, s), c = e.isCube ? r.TEXTURE_CUBE_MAP : r.TEXTURE_2D; this._bindTextureDirectly(c, e, !0), this._unpackFlipY(e.invertY); var l = r.TEXTURE_2D; e.isCube && (l = r.TEXTURE_CUBE_MAP_POSITIVE_X + i), r.texImage2D(l, n, a, s, o, t), this._bindTextureDirectly(c, null, !0) }, 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, s, a) { throw void 0 === a && (a = null), b.a.WarnImport("Engine.RawTexture") }, e.prototype.createRawTexture3D = function(t, i, n, r, o, s, a, c, l, u) { throw void 0 === l && (l = null), void 0 === u && (u = e.TEXTURETYPE_UNSIGNED_INT), b.a.WarnImport("Engine.RawTexture") }, e.prototype._prepareWebGLTextureContinuation = function(e, t, i, n, r) { var o = this._gl; if (o) { var s = this._getSamplingParameters(r, !i); o.texParameteri(o.TEXTURE_2D, o.TEXTURE_MAG_FILTER, s.mag), o.texParameteri(o.TEXTURE_2D, o.TEXTURE_MIN_FILTER, s.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, s, a, l, u) { var h = this; void 0 === u && (u = e.TEXTURE_TRILINEAR_SAMPLINGMODE); var d = this.getCaps().maxTextureSize, f = Math.min(d, this.needPOTTextures ? c.h.GetExponentOfTwo(n, d) : n), p = Math.min(d, this.needPOTTextures ? c.h.GetExponentOfTwo(r, d) : r), _ = this._gl; _ && (t._webGLTexture ? (this._bindTextureDirectly(_.TEXTURE_2D, t, !0), this._unpackFlipY(void 0 === o || !!o), t.baseWidth = n, t.baseHeight = r, t.width = f, t.height = p, t.isReady = !0, l(f, p, function() { h._prepareWebGLTextureContinuation(t, i, s, a, u) }) || this._prepareWebGLTextureContinuation(t, i, s, a, 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 s = 0; s < i; s++) for (var a = 0; a < n; a++) { var c = 3 * (a * i + s), l = 4 * (a * i + s); o[l + 0] = t[c + 0], o[l + 1] = t[c + 1], o[l + 2] = t[c + 2], o[l + 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), t.deleteTexture(e._webGLTexture), this.unbindAllTextures(); 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 = !1), void 0 === n && (n = !1); var r = !1, 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 = !0, 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, !1, !0) : 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; case e.TEXTURE_CLAMP_ADDRESSMODE: 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 = !1), void 0 === r && (r = !1), !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)), !1; if (i.video) this._activeChannel = t, i.update(); else if (i.delayLoadState === e.DELAYLOADSTATE_NOTLOADED) return i.delayLoad(), !1; 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 s = !0; if (this._boundTexturesCache[t] === o && (n || this._bindSamplerUniformToChannel(o._associatedChannel, t), s = !1), this._activeChannel = t, o && o.isMultiview) s && this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, o, n); else if (o && o.is3D) s && 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 (s && this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, o, n), o._cachedCoordinatesMode !== i.coordinatesMode) { o._cachedCoordinatesMode = i.coordinatesMode; var a = 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, a, o), this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_WRAP_T, a) } this._setAnisotropicLevel(this._gl.TEXTURE_CUBE_MAP, i) } else s && 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 !0 }, 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], !0) } }, 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, !0, !0), this._gl.texParameterf(e, t, i) }, e.prototype._setTextureParameterInteger = function(e, t, i, n) { n && this._bindTextureDirectly(e, n, !0, !0), 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), this._externalData.add(e, t) }, 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), this._externalData.getOrAddWithFactory(e, t) }, 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 = !1; for (var e = 0; e < this._caps.maxVertexAttribs; e++) this._gl.disableVertexAttribArray(e), this._vertexAttribArraysEnabled[e] = !1, this._currentBufferPointers[e].active = !1 } 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] = !1, this._currentBufferPointers[e].active = !1) } }, 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.disableVR(), g.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(), this.onCanvasPointerOutObservable.clear(), this.onBeginFrameObservable.clear(), this.onEndFrameObservable.clear(), h.a.ResetCache(); for (var i = 0, n = this._activeRequests; i < n.length; i++) { n[i].abort() } }, e.prototype.displayLoadingUI = function() { if (g.a.IsWindowObjectExist()) { var e = this.loadingScreen; e && e.displayLoadingUI() } }, e.prototype.hideLoadingUI = function() { if (g.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "loadingUIText", { set: function(e) { this.loadingScreen.loadingUIText = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "loadingUIBackgroundColor", { set: function(e) { this.loadingScreen.loadingUIBackgroundColor = e }, enumerable: !0, configurable: !0 }), e.prototype.attachContextLostEvent = function(e) { this._renderingCanvas && this._renderingCanvas.addEventListener("webglcontextlost", e, !1) }, e.prototype.attachContextRestoredEvent = function(e) { this._renderingCanvas && this._renderingCanvas.addEventListener("webglcontextrestored", e, !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 s = this._gl; if (!this._dummyFramebuffer) { var a = s.createFramebuffer(); if (!a) throw new Error("Unable to create dummy framebuffer"); this._dummyFramebuffer = a } s.bindFramebuffer(s.FRAMEBUFFER, this._dummyFramebuffer), n > -1 ? s.framebufferTexture2D(s.FRAMEBUFFER, s.COLOR_ATTACHMENT0, s.TEXTURE_CUBE_MAP_POSITIVE_X + n, e._webGLTexture, r) : s.framebufferTexture2D(s.FRAMEBUFFER, s.COLOR_ATTACHMENT0, s.TEXTURE_2D, e._webGLTexture, r); var c = void 0 !== e.type ? this._getWebGLTextureType(e.type) : s.UNSIGNED_BYTE; switch (c) { case s.UNSIGNED_BYTE: o || (o = new Uint8Array(4 * t * i)), c = s.UNSIGNED_BYTE; break; default: o || (o = new Float32Array(4 * t * i)), c = s.FLOAT } return s.readPixels(0, 0, t, i, s.RGBA, c, o), s.bindFramebuffer(s.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 = !0, 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 s = t.RGBA, a = t.UNSIGNED_BYTE, c = new Uint8Array(4); t.readPixels(0, 0, 1, 1, s, a, 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 } 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: 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 } 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) { 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 s = this, a = c.h.LoadFile(e, t, i, n, r, o); return this._activeRequests.push(a), a.onCompleteObservable.add(function(e) { s._activeRequests.splice(s._activeRequests.indexOf(e), 1) }), a }, e.prototype._loadFileAsync = function(e, t, i) { var n = this; return new Promise(function(r, o) { n._loadFile(e, function(e) { r(e) }, void 0, t, i, 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 !1 } }, e.ExceptionList = [{ key: "Chrome/63.0", capture: "63\\.0\\.3239\\.(\\d+)", captureConstraint: 108, targets: ["uniformBuffer"] }, { key: "Firefox/58", capture: null, captureConstraint: null, targets: ["uniformBuffer"] }, { key: "Firefox/59", capture: null, captureConstraint: null, targets: ["uniformBuffer"] }, { key: "Chrome/72.+?Mobile", capture: null, captureConstraint: null, targets: ["vao"] }, { key: "Chrome/73.+?Mobile", capture: null, captureConstraint: null, targets: ["vao"] }, { key: "Chrome/74.+?Mobile", capture: null, captureConstraint: null, targets: ["vao"] }, { key: "Mac OS.+Chrome/71", capture: null, captureConstraint: null, 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, e }() }, function(e, t, i) { "use strict"; i.d(t, "b", function() { return P }), i.d(t, "c", function() { return C }), i.d(t, "a", function() { return O }); var n = i(1), r = i(8), o = i(9), s = i(32), a = i(29), c = i(0), l = i(25), u = i(4), h = i(13), d = i(57), f = i(24), p = i(49), _ = i(43), g = i(20), m = i(66), v = i(55), y = i(3), b = i(2), T = i(6), E = i(22), A = i(19), x = i(14), R = i(110), P = function() { return function() {} }(), S = function() { return function() { this.visibleInstances = {}, this.batchCache = new C, this.instancesBufferSize = 2048 } }(), C = function() { return function() { this.mustReturn = !1, this.visibleInstances = new Array, this.renderSelf = new Array, this.hardwareInstancedRendering = new Array } }(), M = function() { return function() { this._areNormalsFrozen = !1, 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, l) { void 0 === n && (n = null), void 0 === r && (r = null), void 0 === o && (o = null), void 0 === l && (l = !0); var u = e.call(this, i, n) || this; if (u._internalMeshDataInfo = new M, u.delayLoadState = y.a.DELAYLOADSTATE_NONE, u.instances = new Array, u._creationDataStorage = null, u._geometry = null, u._instanceDataStorage = new S, u._effectiveMaterial = null, u._shouldGenerateFlatShading = !1, u._originalBuilderSideOrientation = t.DEFAULTSIDE, u.overrideMaterialSideOrientation = null, n = u.getScene(), o) { if (o._geometry && o._geometry.applyToMesh(u), s.a.DeepCopy(o, u, ["name", "material", "skeleton", "instances", "parent", "uniqueId", "source", "metadata", "hasLODLevels", "geometry", "isBlocked", "areNormalsFrozen", "onBeforeDrawObservable", "onBeforeRenderObservable", "onAfterRenderObservable", "onBeforeDraw", "onAfterWorldMatrixUpdateObservable", "onCollideObservable", "onCollisionPositionChangeObservable", "onRebuildObservable", "onDisposeObservable"], ["_poseMatrix"]), u._internalMeshDataInfo._source = o, n.useClonedMeshhMap && (o._internalMeshDataInfo.meshMap || (o._internalMeshDataInfo.meshMap = {}), o._internalMeshDataInfo.meshMap[u.uniqueId] = u), u._originalBuilderSideOrientation = o._originalBuilderSideOrientation, u._creationDataStorage = o._creationDataStorage, o._ranges) { var h = o._ranges; for (var i in h) h.hasOwnProperty(i) && h[i] && u.createAnimationRange(i, h[i].from, h[i].to) } var d; if (o.metadata && o.metadata.clone ? u.metadata = o.metadata.clone() : u.metadata = o.metadata, a.a && a.a.HasTags(o) && a.a.AddTagsTo(u, a.a.GetTags(o, !0)), u.parent = o.parent, u.setPivotMatrix(o.getPivotMatrix()), u.id = i + "." + o.id, u.material = o.material, !c) for (var f = o.getDescendants(!0), p = 0; p < f.length; p++) { var _ = f[p]; _.clone && _.clone(i + "." + _.name, u) } if (n.getPhysicsEngine) { var g = n.getPhysicsEngine(); if (l && g) { var m = g.getImpostorForPhysicsObject(o); m && (u.physicsImpostor = m.clone(u)) } } for (d = 0; d < n.particleSystems.length; d++) { var v = n.particleSystems[d]; v.emitter === o && v.clone(v.name, u) } u.refreshBoundingInfo(), u.computeWorldMatrix(!0) } return null !== r && (u.parent = r), u._instanceDataStorage.hardwareInstancedRendering = u.getEngine().getCaps().instancedArrays, u } 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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onBeforeBindObservable", { get: function() { return this._internalMeshDataInfo._onBeforeBindObservable || (this._internalMeshDataInfo._onBeforeBindObservable = new r.c), this._internalMeshDataInfo._onBeforeBindObservable }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onAfterRenderObservable", { get: function() { return this._internalMeshDataInfo._onAfterRenderObservable || (this._internalMeshDataInfo._onAfterRenderObservable = new r.c), this._internalMeshDataInfo._onAfterRenderObservable }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onBeforeDrawObservable", { get: function() { return this._internalMeshDataInfo._onBeforeDrawObservable || (this._internalMeshDataInfo._onBeforeDrawObservable = new r.c), this._internalMeshDataInfo._onBeforeDrawObservable }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onBeforeDraw", { set: function(e) { this._onBeforeDrawObserver && this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver), this._onBeforeDrawObserver = this.onBeforeDrawObservable.add(e) }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "source", { get: function() { return this._internalMeshDataInfo._source }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "isUnIndexed", { get: function() { return this._unIndexed }, set: function(e) { this._unIndexed !== e && (this._unIndexed = e, this._markSubMeshesAsAttributesDirty()) }, enumerable: !0, configurable: !0 }), t.prototype.getClassName = function() { return "Mesh" }, Object.defineProperty(t.prototype, "_isMesh", { get: function() { return !0 }, enumerable: !0, configurable: !0 }), 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(u.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: !0, configurable: !0 }), 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 T.a.Warn("You cannot use a mesh as LOD level twice"), this; var i = new R.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(), this }, t.prototype.getLOD = function(e, t) { var i, n = this._internalMeshDataInfo; if (!n._LODLevels || 0 === n._LODLevels.length) return this; t ? i = t : i = this.getBoundingInfo().boundingSphere; var r = i.centerWorld.subtract(e.globalPosition).length(); if (n._LODLevels[n._LODLevels.length - 1].distance > r) return this.onLODLevelSelection && this.onLODLevelSelection(r, this, n._LODLevels[n._LODLevels.length - 1].mesh), this; for (var o = 0; o < n._LODLevels.length; o++) { var s = n._LODLevels[o]; if (s.distance < r) return s.mesh && (s.mesh._preActivate(), s.mesh._updateSubMeshesBoundingInfo(this.worldMatrixFromCache)), this.onLODLevelSelection && this.onLODLevelSelection(r, this, s.mesh), s.mesh } return this.onLODLevelSelection && this.onLODLevelSelection(r, this, this), this }, Object.defineProperty(t.prototype, "geometry", { get: function() { return this._geometry }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), t.prototype.isReady = function(t, i) { if (void 0 === t && (t = !1), void 0 === i && (i = !1), this.delayLoadState === y.a.DELAYLOADSTATE_LOADING) return !1; if (!e.prototype.isReady.call(this, t)) return !1; if (!this.subMeshes || 0 === this.subMeshes.length) return !0; if (!t) return !0; var n = this.getEngine(), r = this.getScene(), o = i || n.getCaps().instancedArrays && this.instances.length > 0; this.computeWorldMatrix(); var s = this.material || r.defaultMaterial; if (s) if (s._storeEffectOnSubMeshes) for (var a = 0, c = this.subMeshes; a < c.length; a++) { var l = (_ = c[a]).getMaterial(); if (l) if (l._storeEffectOnSubMeshes) { if (!l.isReadyForSubMesh(this, _, o)) return !1 } else if (!l.isReady(this, o)) return !1 } else if (!s.isReady(this, o)) return !1; for (var u = 0, h = this.lightSources; u < h.length; u++) { var d = h[u].getShadowGenerator(); if (d) for (var f = 0, p = this.subMeshes; f < p.length; f++) { var _ = p[f]; if (!d.isReady(_, o)) return !1 } } for (var g = 0, m = this._internalMeshDataInfo._LODLevels; g < m.length; g++) { var v = m[g]; if (v.mesh && !v.mesh.isReady(o)) return !1 } return !0 }, Object.defineProperty(t.prototype, "areNormalsFrozen", { get: function() { return this._internalMeshDataInfo._areNormalsFrozen }, enumerable: !0, configurable: !0 }), t.prototype.freezeNormals = function() { return this._internalMeshDataInfo._areNormalsFrozen = !0, this }, t.prototype.unfreezeNormals = function() { return this._internalMeshDataInfo._areNormalsFrozen = !1, this }, Object.defineProperty(t.prototype, "overridenInstanceCount", { set: function(e) { this._instanceDataStorage.overridenInstanceCount = e }, enumerable: !0, configurable: !0 }), 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 = { defaultRenderId: t, 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 = !1), this._boundingInfo && this._boundingInfo.isLocked) 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 = !1; if (e) r = !0; else for (var o = 0, s = this.subMeshes; o < s.length; o++) { var a = s[o]; if (a.indexStart + a.indexCount >= n) { r = !0; break } if (a.verticesStart + a.verticesCount >= t) { r = !0; 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 = !1), this._geometry) this._geometry.setVerticesData(e, t, i, n); else { var r = new h.a; r.set(t, e); var o = this.getScene(); new d.a(d.a.RandomId(), o, r, i, this) } return this }, t.prototype.markVerticesDataAsUpdatable = function(e, t) { void 0 === t && (t = !0); 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 = d.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, !1)) : this._geometry.updateVerticesData(e, t, i), this) : this }, t.prototype.updateMeshPositions = function(e, t) { void 0 === t && (t = !0); var i = this.getVerticesData(u.b.PositionKind); if (!i) return this; if (e(i), this.updateVerticesData(u.b.PositionKind, i, !1, !1), t) { var n = this.getIndices(), r = this.getVerticesData(u.b.NormalKind); if (!r) return this; h.a.ComputeNormals(i, n, r), this.updateVerticesData(u.b.NormalKind, r, !1, !1) } return this }, t.prototype.makeGeometryUnique = function() { if (!this._geometry) return this; var e = this._geometry, t = this._geometry.copy(d.a.RandomId()); return e.releaseForMesh(this, !0), t.applyToMesh(this), this }, t.prototype.setIndices = function(e, t, i) { if (void 0 === t && (t = null), void 0 === i && (i = !1), this._geometry) this._geometry.setIndices(e, t, i); else { var n = new h.a; n.indices = e; var r = this.getScene(); new d.a(d.a.RandomId(), r, n, i, this) } return this }, t.prototype.updateIndices = function(e, t, i) { return void 0 === i && (i = !1), 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; 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 = !1, r.renderSelf[e] = !n && this.isEnabled() && this.isVisible, r.visibleInstances[e] = null, this._instanceDataStorage.visibleInstances) { var o = this._instanceDataStorage.visibleInstances, s = t.getRenderId(), a = i ? o.intermediateDefaultRenderId : o.defaultRenderId; r.visibleInstances[e] = o[s], !r.visibleInstances[e] && a && (r.visibleInstances[e] = o[a]) } 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 s = this._instanceDataStorage, a = s.instancesBufferSize, c = s.instancesBuffer, l = 16 * (o.length + 1) * 4; s.instancesBufferSize < l;) s.instancesBufferSize *= 2; s.instancesData && a == s.instancesBufferSize || (s.instancesData = new Float32Array(s.instancesBufferSize / 4)); var h = 0, d = 0, f = this._effectiveMesh.getWorldMatrix(); if (i.renderSelf[e._id] && (f.copyToArray(s.instancesData, h), h += 16, d++), o) for (var p = 0; p < o.length; p++) { o[p].getWorldMatrix().copyToArray(s.instancesData, h), h += 16, d++ } return c && a == s.instancesBufferSize ? c.updateDirectly(s.instancesData, 0, d) : (c && c.dispose(), c = new u.a(r, s.instancesData, !0, 16, !1, !0), s.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, d), r.unbindInstanceAttributes(), this }, t.prototype._processRendering = function(e, t, i, n, r, o, s) { var a = this.getScene().getEngine(); if (r) this._renderWithInstances(e, i, n, t, a); else { n.renderSelf[e._id] && (o && o(!1, this._effectiveMesh.getWorldMatrix(), s), this._draw(e, i, this._instanceDataStorage.overridenInstanceCount)); var c = n.visibleInstances[e._id]; if (c) for (var l = 0; l < c.length; l++) { var u = c[l].getWorldMatrix(); o && o(!0, u, s), this._draw(e, i) } } return this }, t.prototype._freeze = function() { if (this._instanceDataStorage.isFrozen = !0, this.subMeshes) for (var e = 0; e < this.subMeshes.length; e++) this._getInstancesRenderList(e) }, t.prototype._unFreeze = function() { this._instanceDataStorage.isFrozen = !1 }, t.prototype.render = function(e, t) { var i = this.getScene(); if (i._isInIntermediateRendering() ? this._internalAbstractMeshDataInfo._isActiveIntermediate = !1 : this._internalAbstractMeshDataInfo._isActive = !1, 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(), s = n.hardwareInstancedRendering[e._id], a = this._instanceDataStorage, c = e.getMaterial(); if (!c) return this; if (!a.isFrozen || !this._effectiveMaterial || this._effectiveMaterial !== c) if (this._effectiveMaterial = c, this._effectiveMaterial._storeEffectOnSubMeshes) { if (!this._effectiveMaterial.isReadyForSubMesh(this, e, s)) return this } else if (!this._effectiveMaterial.isReady(this, s)) return this; t && o.setAlphaMode(this._effectiveMaterial.alphaMode); for (var l = 0, u = i._beforeRenderingMeshStage; l < u.length; l++) { u[l].action(this, e, n) } if (!(r = this._effectiveMaterial._storeEffectOnSubMeshes ? e.effect : this._effectiveMaterial.getEffect())) return this; var h, d = this._effectiveMesh; a.isFrozen ? h = a.sideOrientation : (null == (h = this.overrideMaterialSideOrientation) && (h = this._effectiveMaterial.sideOrientation, d._getWorldMatrixDeterminant() < 0 && (h = h === g.a.ClockWiseSideOrientation ? g.a.CounterClockWiseSideOrientation : g.a.ClockWiseSideOrientation)), a.sideOrientation = h); var f = this._effectiveMaterial._preBind(r, h); this._effectiveMaterial.forceDepthWrite && o.setDepthWrite(!0); var p = i.forcePointsCloud ? g.a.PointFillMode : i.forceWireframe ? g.a.WireFrameFillMode : this._effectiveMaterial.fillMode; this._internalMeshDataInfo._onBeforeBindObservable && this._internalMeshDataInfo._onBeforeBindObservable.notifyObservers(this), s || this._bind(e, r, p); var _ = d.getWorldMatrix(); this._effectiveMaterial._storeEffectOnSubMeshes ? this._effectiveMaterial.bindForSubMesh(_, this, e) : this._effectiveMaterial.bind(_, this), !this._effectiveMaterial.backFaceCulling && this._effectiveMaterial.separateCullingPass && (o.setState(!0, this._effectiveMaterial.zOffset, !1, !f), this._processRendering(e, r, p, n, s, this._onBeforeDraw, this._effectiveMaterial), o.setState(!0, this._effectiveMaterial.zOffset, !1, f)), this._processRendering(e, r, p, n, s, this._onBeforeDraw, this._effectiveMaterial), this._effectiveMaterial.unbind(); for (var m = 0, v = i._afterRenderingMeshStage; m < v.length; m++) { v[m].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(u.b.MatricesWeightsKind) && (this.isVerticesDataPresent(u.b.MatricesWeightsExtraKind) ? this.normalizeSkinWeightsAndExtra() : this.normalizeSkinFourWeights()) }, t.prototype.normalizeSkinFourWeights = function() { for (var e = this.getVerticesData(u.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(u.b.MatricesWeightsKind, e) }, t.prototype.normalizeSkinWeightsAndExtra = function() { for (var e = this.getVerticesData(u.b.MatricesWeightsExtraKind), t = this.getVerticesData(u.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(u.b.MatricesWeightsKind, t), this.setVerticesData(u.b.MatricesWeightsKind, e) }, t.prototype.validateSkinning = function() { var e = this.getVerticesData(u.b.MatricesWeightsExtraKind), t = this.getVerticesData(u.b.MatricesWeightsKind); if (null === t || null == this.skeleton) return { skinned: !1, valid: !0, report: "not skinned" }; for (var i = t.length, n = 0, r = 0, o = 0, s = 0, a = null === e ? 4 : 8, c = new Array, l = 0; l <= a; l++) c[l] = 0; for (l = 0; l < i; l += 4) { for (var h = t[l], d = h, f = 0 === d ? 0 : 1, p = 1; p < a; p++) { var _ = p < 4 ? t[l + p] : e[l + p - 4]; _ > h && n++, 0 !== _ && f++, d += _, h = _ } if (c[f]++, f > o && (o = f), 0 === d) r++; else { var g = 1 / d, m = 0; for (p = 0; p < a; p++) m += p < 4 ? Math.abs(t[l + p] - t[l + p] * g) : Math.abs(e[l + p - 4] - e[l + p - 4] * g); m > .001 && s++ } } var v = this.skeleton.bones.length, y = this.getVerticesData(u.b.MatricesIndicesKind), b = this.getVerticesData(u.b.MatricesIndicesExtraKind), T = 0; for (l = 0; l < i; l++) for (p = 0; p < a; p++) { var E = p < 4 ? y[p] : b[p - 4]; (E >= v || E < 0) && T++ } return { skinned: !0, valid: 0 === r && 0 === s && 0 === T, report: "Number of Weights = " + i / 4 + "\nMaximum influences = " + o + "\nMissing Weights = " + r + "\nNot Sorted = " + n + "\nNot Normalized = " + s + "\nWeightCounts = [" + c + "]\nNumber of bones = " + v + "\nBad Bone Indices = " + T } }, 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), this }, t.prototype.isInFrustum = function(t) { return this.delayLoadState !== y.a.DELAYLOADSTATE_LOADING && (!!e.prototype.isInFrustum.call(this, t) && (this._checkDelayState(), !0)) }, 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(u.b.PositionKind)) return this; var t = this.subMeshes.splice(0); this._resetPointsArrayCache(); var i, n = this.getVerticesData(u.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(u.b.PositionKind, r, this.getVertexBuffer(u.b.PositionKind).isUpdatable()), this.isVerticesDataPresent(u.b.NormalKind)) { for (n = this.getVerticesData(u.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(u.b.NormalKind, r, this.getVertexBuffer(u.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(!0)), 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: !0, configurable: !0 }), 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 = !0), new t(e, this.getScene(), i, this, n, r) }, t.prototype.dispose = function(t, i) { void 0 === i && (i = !1), this.morphTargetManager = null, this._geometry && this._geometry.releaseForMesh(this, !0); 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) { (a = n.meshMap[r]) && (a._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, s = this.getScene().meshes; o < s.length; o++) { var a; (a = s[o])._internalMeshDataInfo && a._internalMeshDataInfo._source && a._internalMeshDataInfo._source === this && (a._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, s, a) { var c = this; void 0 === a && (a = !1); var l = this.getScene(); return o.h.LoadImage(e, function(e) { var o = document.createElement("canvas"), l = o.getContext("2d"), u = e.width, h = e.height; o.width = u, o.height = h, l.drawImage(e, 0, 0); var d = l.getImageData(0, 0, u, h).data; c.applyDisplacementMapFromBuffer(d, u, h, t, i, r, s, a), n && n(c) }, function() {}, l.offlineProvider), this }, t.prototype.applyDisplacementMapFromBuffer = function(e, t, i, n, r, o, s, a) { if (void 0 === a && (a = !1), !this.isVerticesDataPresent(u.b.PositionKind) || !this.isVerticesDataPresent(u.b.NormalKind) || !this.isVerticesDataPresent(u.b.UVKind)) return T.a.Warn("Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing"), this; var l = this.getVerticesData(u.b.PositionKind, !0, !0), d = this.getVerticesData(u.b.NormalKind), f = this.getVerticesData(u.b.UVKind), p = c.x.Zero(), _ = c.x.Zero(), g = c.w.Zero(); o = o || c.w.Zero(), s = s || new c.w(1, 1); for (var m = 0; m < l.length; m += 3) { c.x.FromArrayToRef(l, m, p), c.x.FromArrayToRef(d, m, _), c.w.FromArrayToRef(f, m / 3 * 2, g); var v = 4 * ((Math.abs(g.x * s.x + o.x) * t % t | 0) + (Math.abs(g.y * s.y + o.y) * i % i | 0) * t), y = .3 * (e[v] / 255) + .59 * (e[v + 1] / 255) + .11 * (e[v + 2] / 255); _.normalize(), _.scaleInPlace(n + (r - n) * y), (p = p.add(_)).toArray(l, m) } return h.a.ComputeNormals(l, this.getIndices(), d), a ? (this.setVerticesData(u.b.PositionKind, l), this.setVerticesData(u.b.NormalKind, d)) : (this.updateVerticesData(u.b.PositionKind, l), this.updateVerticesData(u.b.NormalKind, d)), this }, t.prototype.convertToFlatShadedMesh = function() { var e, t, i = this.getVerticesDataKinds(), n = {}, r = {}, o = {}, s = !1; for (e = 0; e < i.length; e++) { t = i[e]; var a = this.getVertexBuffer(t); t !== u.b.NormalKind ? (n[t] = a, r[t] = n[t].getData(), o[t] = []) : (s = a.isUpdatable(), i.splice(e, 1), e--) } var l, h = this.subMeshes.slice(0), d = this.getIndices(), f = this.getTotalIndices(); for (l = 0; l < f; l++) { var _ = d[l]; for (e = 0; e < i.length; e++) for (var g = n[t = i[e]].getStrideSize(), m = 0; m < g; m++) o[t].push(r[t][_ * g + m]) } var v = [], y = o[u.b.PositionKind]; for (l = 0; l < f; l += 3) { d[l] = l, d[l + 1] = l + 1, d[l + 2] = l + 2; for (var b = c.x.FromArray(y, 3 * l), T = c.x.FromArray(y, 3 * (l + 1)), E = c.x.FromArray(y, 3 * (l + 2)), A = b.subtract(T), x = E.subtract(T), R = c.x.Normalize(c.x.Cross(A, x)), P = 0; P < 3; P++) v.push(R.x), v.push(R.y), v.push(R.z) } for (this.setIndices(d), this.setVerticesData(u.b.NormalKind, v, s), e = 0; e < i.length; e++) t = i[e], this.setVerticesData(t, o[t], n[t].isUpdatable()); this.releaseSubMeshes(); for (var S = 0; S < h.length; S++) { var C = h[S]; p.b.AddToMesh(C.materialIndex, C.indexStart, C.indexCount, C.indexStart, C.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 s = this.getVertexBuffer(t); n[t] = s, r[t] = n[t].getData(), o[t] = [] } var a, c = this.subMeshes.slice(0), l = this.getIndices(), u = this.getTotalIndices(); for (a = 0; a < u; a++) { var h = l[a]; for (e = 0; e < i.length; e++) for (var d = n[t = i[e]].getStrideSize(), f = 0; f < d; f++) o[t].push(r[t][h * d + f]) } for (a = 0; a < u; a += 3) l[a] = a, l[a + 1] = a + 1, l[a + 2] = a + 2; for (this.setIndices(l), e = 0; e < i.length; e++) t = i[e], this.setVerticesData(t, o[t], n[t].isUpdatable()); this.releaseSubMeshes(); for (var _ = 0; _ < c.length; _++) { var g = c[_]; p.b.AddToMesh(g.materialIndex, g.indexStart, g.indexCount, g.indexStart, g.indexCount, this) } return this._unIndexed = !0, this.synchronizeInstances(), this }, t.prototype.flipFaces = function(e) { void 0 === e && (e = !1); var t, i, n = h.a.ExtractFromMesh(this); if (e && this.isVerticesDataPresent(u.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) T.a.Warn("VertexData contains null entries"); else { for (var s, a, l = e + 1, u = new Array, d = 0; d < l + 1; d++) u[d] = new Array; var f, p = new c.x(0, 0, 0), _ = new c.x(0, 0, 0), g = new c.w(0, 0), m = new Array, v = new Array, y = new Array, b = r.length, E = i.length; for (d = 0; d < n.length; d += 3) { v[0] = n[d], v[1] = n[d + 1], v[2] = n[d + 2]; for (var A = 0; A < 3; A++) if (s = v[A], a = v[(A + 1) % 3], void 0 === y[s] && void 0 === y[a] ? (y[s] = new Array, y[a] = new Array) : (void 0 === y[s] && (y[s] = new Array), void 0 === y[a] && (y[a] = new Array)), void 0 === y[s][a] && void 0 === y[a][s]) { y[s][a] = [], p.x = (r[3 * a] - r[3 * s]) / l, p.y = (r[3 * a + 1] - r[3 * s + 1]) / l, p.z = (r[3 * a + 2] - r[3 * s + 2]) / l, _.x = (o[3 * a] - o[3 * s]) / l, _.y = (o[3 * a + 1] - o[3 * s + 1]) / l, _.z = (o[3 * a + 2] - o[3 * s + 2]) / l, g.x = (i[2 * a] - i[2 * s]) / l, g.y = (i[2 * a + 1] - i[2 * s + 1]) / l, y[s][a].push(s); for (var x = 1; x < l; x++) y[s][a].push(r.length / 3), r[b] = r[3 * s] + x * p.x, o[b++] = o[3 * s] + x * _.x, r[b] = r[3 * s + 1] + x * p.y, o[b++] = o[3 * s + 1] + x * _.y, r[b] = r[3 * s + 2] + x * p.z, o[b++] = o[3 * s + 2] + x * _.z, i[E++] = i[2 * s] + x * g.x, i[E++] = i[2 * s + 1] + x * g.y; y[s][a].push(a), y[a][s] = new Array, f = y[s][a].length; for (var R = 0; R < f; R++) y[a][s][R] = y[s][a][f - 1 - R] } u[0][0] = n[d], u[1][0] = y[n[d]][n[d + 1]][1], u[1][1] = y[n[d]][n[d + 2]][1]; for (x = 2; x < l; x++) { u[x][0] = y[n[d]][n[d + 1]][x], u[x][x] = y[n[d]][n[d + 2]][x], p.x = (r[3 * u[x][x]] - r[3 * u[x][0]]) / x, p.y = (r[3 * u[x][x] + 1] - r[3 * u[x][0] + 1]) / x, p.z = (r[3 * u[x][x] + 2] - r[3 * u[x][0] + 2]) / x, _.x = (o[3 * u[x][x]] - o[3 * u[x][0]]) / x, _.y = (o[3 * u[x][x] + 1] - o[3 * u[x][0] + 1]) / x, _.z = (o[3 * u[x][x] + 2] - o[3 * u[x][0] + 2]) / x, g.x = (i[2 * u[x][x]] - i[2 * u[x][0]]) / x, g.y = (i[2 * u[x][x] + 1] - i[2 * u[x][0] + 1]) / x; for (A = 1; A < x; A++) u[x][A] = r.length / 3, r[b] = r[3 * u[x][0]] + A * p.x, o[b++] = o[3 * u[x][0]] + A * _.x, r[b] = r[3 * u[x][0] + 1] + A * p.y, o[b++] = o[3 * u[x][0] + 1] + A * _.y, r[b] = r[3 * u[x][0] + 2] + A * p.z, o[b++] = o[3 * u[x][0] + 2] + A * _.z, i[E++] = i[2 * u[x][0]] + A * g.x, i[E++] = i[2 * u[x][0] + 1] + A * g.y } u[l] = y[n[d + 1]][n[d + 2]], m.push(u[0][0], u[1][0], u[1][1]); for (x = 1; x < l; x++) { for (A = 0; A < x; A++) m.push(u[x][A], u[x + 1][A], u[x + 1][A + 1]), m.push(u[x][A], u[x + 1][A + 1], u[x][A + 1]); m.push(u[x][A], u[x + 1][A], u[x + 1][A + 1]) } } t.indices = m, 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) T.a.Warn("VertexData contains null entries"); else { for (var o, s, a = new Array, c = new Array, l = new Array, u = new Array, d = 0, f = new Array, p = 0; p < i.length; p += 3) { s = [i[p], i[p + 1], i[p + 2]], u = new Array; for (var _ = 0; _ < 3; _++) { u[_] = ""; for (var g = 0; g < 3; g++) Math.abs(n[3 * s[_] + g]) < 1e-8 && (n[3 * s[_] + g] = 0), u[_] += n[3 * s[_] + g] + "|"; u[_] = u[_].slice(0, -1) } if (u[0] != u[1] && u[0] != u[2] && u[1] != u[2]) for (_ = 0; _ < 3; _++) { if ((o = f.indexOf(u[_])) < 0) { f.push(u[_]), o = d++; for (g = 0; g < 3; g++) a.push(n[3 * s[_] + g]); for (g = 0; g < 2; g++) l.push(t[2 * s[_] + g]) } c.push(o) } } var m = new Array; h.a.ComputeNormals(a, c, m), e.positions = a, e.indices = c, e.normals = m, e.uvs = l, 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(u.b.PositionKind); if (!n || !i) return this; for (var r = new Array, s = 0; s < n.length; s += 3) r.push(c.x.FromArray(n, s)); var a = 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)) { a[t] = n; break } } }, function() { for (var n = 0; n < i.length; ++n) i[n] = a[i[n]] || i[n]; var r = t.subMeshes.slice(0); 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(), a.a && a.a.HasTags(this) && (e.tags = a.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(!1), 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 }) } } 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.metadata && (e.metadata = this.metadata), e.instances = []; for (var s = 0; s < this.instances.length; s++) { var c = this.instances[s]; if (!c.doNotSerialize) { var l = { name: c.name, id: c.id, position: c.position.asArray(), scaling: c.scaling.asArray() }; c.parent && (l.parentId = c.parent.id), c.rotationQuaternion ? l.rotationQuaternion = c.rotationQuaternion.asArray() : c.rotation && (l.rotation = c.rotation.asArray()), e.instances.push(l), b.a.AppendSerializedAnimations(c, l), l.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() { if (this.geometry) { this._markSubMeshesAsAttributesDirty(); var e = this._internalMeshDataInfo._morphTargetManager; if (e && e.vertexCount) { if (e.vertexCount !== this.getTotalVertices()) return T.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 T.a.Error("Invalid morph target. Target must have positions."); this.geometry.setVerticesData(u.b.PositionKind + t, n, !1, 3); var r = i.getNormals(); r && this.geometry.setVerticesData(u.b.NormalKind + t, r, !1, 3); var o = i.getTangents(); o && this.geometry.setVerticesData(u.b.TangentKind + t, o, !1, 3) } } else for (t = 0; this.geometry.isVerticesDataPresent(u.b.PositionKind + t);) this.geometry.removeVerticesData(u.b.PositionKind + t), this.geometry.isVerticesDataPresent(u.b.NormalKind + t) && this.geometry.removeVerticesData(u.b.NormalKind + t), this.geometry.isVerticesDataPresent(u.b.TangentKind + t) && this.geometry.removeVerticesData(u.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, a.a && a.a.AddTagsTo(r, e.tags), 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)), r.setEnabled(e.isEnabled), 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.isBlocker && (r.isBlocker = e.isBlocker), 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 _.a(c.x.FromArray(e.boundingBoxMinimum), c.x.FromArray(e.boundingBoxMaximum)), e._binaryInfo && (r._binaryInfo = e._binaryInfo), r._delayInfo = [], e.hasUVs && r._delayInfo.push(u.b.UVKind), e.hasUVs2 && r._delayInfo.push(u.b.UV2Kind), e.hasUVs3 && r._delayInfo.push(u.b.UV3Kind), e.hasUVs4 && r._delayInfo.push(u.b.UV4Kind), e.hasUVs5 && r._delayInfo.push(u.b.UV5Kind), e.hasUVs6 && r._delayInfo.push(u.b.UV6Kind), e.hasColors && r._delayInfo.push(u.b.ColorKind), e.hasMatricesIndices && r._delayInfo.push(u.b.MatricesIndicesKind), e.hasMatricesWeights && r._delayInfo.push(u.b.MatricesWeightsKind), r._delayLoadingFunction = d.a._ImportGeometry, v.a.ForceFullSceneLoadingForIncremental && r._checkDelayState()) : d.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 s = e.animations[o]; (g = E.a.GetClass("BABYLON.Animation")) && r.animations.push(g.Parse(s)) } l.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 = { ids: e.lodMeshIds, distances: e.lodDistances ? e.lodDistances : null, coverages: e.lodCoverages ? e.lodCoverages : null }), e.instances) for (var h = 0; h < e.instances.length; h++) { var f = e.instances[h], p = r.createInstance(f.name); if (f.id && (p.id = f.id), a.a && (f.tags ? a.a.AddTagsTo(p, f.tags) : a.a.AddTagsTo(p, e.tags)), p.position = c.x.FromArray(f.position), void 0 !== f.metadata && (p.metadata = f.metadata), f.parentId && (p._waitingParentId = f.parentId), f.rotationQuaternion ? p.rotationQuaternion = c.q.FromArray(f.rotationQuaternion) : f.rotation && (p.rotation = c.x.FromArray(f.rotation)), p.scaling = c.x.FromArray(f.scaling), null != f.checkCollisions && null != f.checkCollisions && (p.checkCollisions = f.checkCollisions), null != f.pickable && null != f.pickable && (p.isPickable = f.pickable), null != f.showBoundingBox && null != f.showBoundingBox && (p.showBoundingBox = f.showBoundingBox), null != f.showSubMeshesBoundingBox && null != f.showSubMeshesBoundingBox && (p.showSubMeshesBoundingBox = f.showSubMeshesBoundingBox), null != f.alphaIndex && null != f.showSubMeshesBoundingBox && (p.alphaIndex = f.alphaIndex), f.physicsImpostor && t._PhysicsImpostorParser(i, p, f), f.animations) { for (o = 0; o < f.animations.length; o++) { var g; s = f.animations[o], (g = E.a.GetClass("BABYLON.Animation")) && p.animations.push(g.Parse(s)) } l.a.ParseAnimationRanges(p, f, i), f.autoAnimate && i.beginAnimation(p, f.autoAnimateFrom, f.autoAnimateTo, f.autoAnimateLoop, f.autoAnimateSpeed || 1) } } return r }, t.CreateRibbon = function(e, t, i, n, r, o, s, a, 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, s, a, c) { throw A.a.WarnImport("MeshBuilder") }, t.CreateTorus = function(e, t, i, n, r, o, s) { throw A.a.WarnImport("MeshBuilder") }, t.CreateTorusKnot = function(e, t, i, n, r, o, s, a, c, l) { throw A.a.WarnImport("MeshBuilder") }, t.CreateLines = function(e, t, i, n, r) { throw void 0 === i && (i = null), void 0 === n && (n = !1), void 0 === r && (r = null), A.a.WarnImport("MeshBuilder") }, t.CreateDashedLines = function(e, t, i, n, r, o, s, a) { throw void 0 === o && (o = null), A.a.WarnImport("MeshBuilder") }, t.CreatePolygon = function(e, t, i, n, r, o, s) { throw void 0 === s && (s = earcut), A.a.WarnImport("MeshBuilder") }, t.ExtrudePolygon = function(e, t, i, n, r, o, s, a) { throw void 0 === a && (a = earcut), A.a.WarnImport("MeshBuilder") }, t.ExtrudeShape = function(e, t, i, n, r, o, s, a, c, l) { throw void 0 === s && (s = null), A.a.WarnImport("MeshBuilder") }, t.ExtrudeShapeCustom = function(e, t, i, n, r, o, s, a, c, l, u, h) { throw A.a.WarnImport("MeshBuilder") }, t.CreateLathe = function(e, t, i, n, r, o, s) { 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, s, a, c) { throw A.a.WarnImport("MeshBuilder") }, t.CreateGroundFromHeightMap = function(e, t, i, n, r, o, s, a, c, l, u) { throw A.a.WarnImport("MeshBuilder") }, t.CreateTube = function(e, t, i, n, r, o, s, a, c, l) { 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(u.b.PositionKind); if (!t) return e._sourcePositions; e._sourcePositions = new Float32Array(t), this.isVertexBufferUpdatable(u.b.PositionKind) || this.setVerticesData(u.b.PositionKind, t, !0) } return e._sourcePositions }, t.prototype.setNormalsForCPUSkinning = function() { var e = this._internalMeshDataInfo; if (!e._sourceNormals) { var t = this.getVerticesData(u.b.NormalKind); if (!t) return e._sourceNormals; e._sourceNormals = new Float32Array(t), this.isVertexBufferUpdatable(u.b.NormalKind) || this.setVerticesData(u.b.NormalKind, t, !0) } 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(u.b.PositionKind)) return this; if (!this.isVerticesDataPresent(u.b.NormalKind)) return this; if (!this.isVerticesDataPresent(u.b.MatricesIndicesKind)) return this; if (!this.isVerticesDataPresent(u.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(u.b.PositionKind); if (!n) return this; n instanceof Float32Array || (n = new Float32Array(n)); var r = this.getVerticesData(u.b.NormalKind); if (!r) return this; r instanceof Float32Array || (r = new Float32Array(r)); var o = this.getVerticesData(u.b.MatricesIndicesKind), s = this.getVerticesData(u.b.MatricesWeightsKind); if (!s || !o) return this; for (var a, l = this.numBoneInfluencers > 4, h = l ? this.getVerticesData(u.b.MatricesIndicesExtraKind) : null, d = l ? this.getVerticesData(u.b.MatricesWeightsExtraKind) : null, f = e.getTransformMatrices(this), p = c.x.Zero(), _ = new c.j, g = new c.j, m = 0, v = 0; v < n.length; v += 3, m += 4) { var y; for (a = 0; a < 4; a++)(y = s[m + a]) > 0 && (c.j.FromFloat32ArrayToRefScaled(f, Math.floor(16 * o[m + a]), y, g), _.addToSelf(g)); if (l) for (a = 0; a < 4; a++)(y = d[m + a]) > 0 && (c.j.FromFloat32ArrayToRefScaled(f, Math.floor(16 * h[m + a]), y, g), _.addToSelf(g)); c.x.TransformCoordinatesFromFloatsToRef(t._sourcePositions[v], t._sourcePositions[v + 1], t._sourcePositions[v + 2], _, p), p.toArray(n, v), c.x.TransformNormalFromFloatsToRef(t._sourceNormals[v], t._sourceNormals[v + 1], t._sourceNormals[v + 2], _, p), p.toArray(r, v), _.reset() } return this.updateVerticesData(u.b.PositionKind, n), this.updateVerticesData(u.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 && 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, s) { var a; if (void 0 === i && (i = !0), !n) { var c = 0; for (a = 0; a < e.length; a++) if (e[a] && (c += e[a].getTotalVertices()) > 65536) return T.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 (s) { var l, u, d = null; o = !1 } var f, _ = new Array, g = new Array, v = null, y = new Array, b = null; for (a = 0; a < e.length; a++) if (e[a]) { var E = e[a]; if (E.isAnInstance) return T.a.Warn("Cannot merge instance meshes."), null; var A = E.computeWorldMatrix(!0); if ((f = h.a.ExtractFromMesh(E, !0, !0)).transform(A), v ? v.merge(f, n) : (v = f, b = E), o && y.push(E.getTotalIndices()), s) if (E.material) { var x = E.material; if (x instanceof m.a) { for (u = 0; u < x.subMaterials.length; u++) _.indexOf(x.subMaterials[u]) < 0 && _.push(x.subMaterials[u]); for (l = 0; l < E.subMeshes.length; l++) g.push(_.indexOf(x.subMaterials[E.subMeshes[l].materialIndex])), y.push(E.subMeshes[l].indexCount) } else for (_.indexOf(x) < 0 && _.push(x), l = 0; l < E.subMeshes.length; l++) g.push(_.indexOf(x)), y.push(E.subMeshes[l].indexCount) } else for (l = 0; l < E.subMeshes.length; l++) g.push(0), y.push(E.subMeshes[l].indexCount) } if (b = b, r || (r = new t(b.name + "_merged", b.getScene())), v.applyToMesh(r), r.checkCollisions = b.checkCollisions, i) for (a = 0; a < e.length; a++) e[a] && e[a].dispose(); if (o || s) { r.releaseSubMeshes(), a = 0; for (var R = 0; a < y.length;) p.b.CreateFromIndices(0, R, y[a], r), R += y[a], a++ } if (s) { for ((d = new m.a(b.name + "_merged", b.getScene())).subMaterials = _, l = 0; l < r.subMeshes.length; l++) r.subMeshes[l].materialIndex = g[l]; r.material = d } 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") }, t }(f.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, s = r * o; return e * (2 * s - 3 * o + 1) + i * (-2 * s + 3 * o) + t * (s - 2 * o + r) + n * (s - 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 s }); var n = i(0), r = i(4), o = i(19), s = function() { function e() {} return e.prototype.set = function(e, t) { switch (t) { case r.b.PositionKind: this.positions = e; break; case r.b.NormalKind: this.normals = e; break; case r.b.TangentKind: this.tangents = e; break; case r.b.UVKind: this.uvs = e; break; case r.b.UV2Kind: this.uvs2 = e; break; case r.b.UV3Kind: this.uvs3 = e; break; case r.b.UV4Kind: this.uvs4 = e; break; case r.b.UV5Kind: this.uvs5 = e; break; case r.b.UV6Kind: this.uvs6 = e; break; case r.b.ColorKind: this.colors = e; break; case r.b.MatricesIndicesKind: this.matricesIndices = e; break; case r.b.MatricesWeightsKind: this.matricesWeights = e; break; case r.b.MatricesIndicesExtraKind: 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 = !1), 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 }, 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 } if (this.normals) { var s = n.x.Zero(); for (t = 0; t < this.normals.length; t += 3) n.x.FromArrayToRef(this.normals, t, s), n.x.TransformNormalToRef(s, e, r), this.normals[t] = r.x, this.normals[t + 1] = r.y, this.normals[t + 2] = r.z } if (this.tangents) { var a = n.y.Zero(), c = n.y.Zero(); for (t = 0; t < this.tangents.length; t += 4) n.y.FromArrayToRef(this.tangents, t, a), n.y.TransformNormalToRef(a, 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 l = this.indices[t + 1]; this.indices[t + 1] = this.indices[t + 2], this.indices[t + 2] = l } return this }, e.prototype.merge = function(e, t) { if (void 0 === t && (t = !1), 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, s = 0; s < e.indices.length; s++) r[o + s] = e.indices[s] + i; this.indices = r } else for (s = 0; s < e.indices.length; s++) this.indices.push(e.indices[s] + 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 s = e.slice(0), a = 0; for (i = t.length; a < i; a++) s.push(t[a]); return s } 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.tangents && i(r.b.TangentKind, this.tangents), this.uvs && i(r.b.UVKind, this.uvs), this.uvs2 && i(r.b.UV2Kind, this.uvs2), this.uvs3 && i(r.b.UV3Kind, this.uvs3), this.uvs4 && i(r.b.UV4Kind, this.uvs4), 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.normals && (e.normals = this.normals), this.tangents && (e.tangents = this.tangents), this.uvs && (e.uvs = this.uvs), this.uvs2 && (e.uvs2 = this.uvs2), this.uvs3 && (e.uvs3 = this.uvs3), this.uvs4 && (e.uvs4 = this.uvs4), 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 = !0), this.matricesWeights && (e.matricesWeights = this.matricesWeights), this.matricesIndicesExtra && (e.matricesIndicesExtra = this.matricesIndicesExtra, e.matricesIndicesExtra._isExpanded = !0), 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), 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, s) { 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, s = 0, a = 0, c = 0, l = 0, u = 0, h = 0, d = 0, f = 0, p = 0, _ = 0, g = 0, m = 0, v = 0, y = 0, b = 0, T = 0, E = 0, A = 0, x = 0, R = !1, P = !1, S = !1, C = !1, M = 1, O = 0, I = null; if (r && (R = !!r.facetNormals, P = !!r.facetPositions, S = !!r.facetPartitioning, M = !0 === r.useRightHandedSystem ? -1 : 1, O = r.ratio || 0, C = !!r.depthSort, I = r.distanceTo, C)) { void 0 === I && (I = n.x.Zero()); var D = r.depthSortedFacets } var L = 0, w = 0, F = 0, N = 0; if (S && r && r.bbSize) { var B = 0, U = 0, V = 0, G = 0, k = 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, L = r.subDiv.X * O / r.bbSize.x, w = r.subDiv.Y * O / r.bbSize.y, F = r.subDiv.Z * O / r.bbSize.z, N = 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 (m = (g = 3 * t[3 * o]) + 1, v = g + 2, b = (y = 3 * t[3 * o + 1]) + 1, T = y + 2, A = (E = 3 * t[3 * o + 2]) + 1, x = E + 2, s = e[g] - e[y], a = e[m] - e[b], c = e[v] - e[T], l = e[E] - e[y], u = e[A] - e[b], d = M * (a * (h = e[x] - e[T]) - c * u), f = M * (c * l - s * h), p = M * (s * u - a * l), d /= _ = 0 === (_ = Math.sqrt(d * d + f * f + p * p)) ? 1 : _, f /= _, p /= _, R && r && (r.facetNormals[o].x = d, r.facetNormals[o].y = f, r.facetNormals[o].z = p), P && r && (r.facetPositions[o].x = (e[g] + e[y] + e[E]) / 3, r.facetPositions[o].y = (e[m] + e[b] + e[A]) / 3, r.facetPositions[o].z = (e[v] + e[T] + e[x]) / 3), S && r && (B = Math.floor((r.facetPositions[o].x - r.bInfo.minimum.x * O) * L), U = Math.floor((r.facetPositions[o].y - r.bInfo.minimum.y * O) * w), V = Math.floor((r.facetPositions[o].z - r.bInfo.minimum.z * O) * F), G = Math.floor((e[g] - r.bInfo.minimum.x * O) * L), k = Math.floor((e[m] - r.bInfo.minimum.y * O) * w), z = Math.floor((e[v] - r.bInfo.minimum.z * O) * F), j = Math.floor((e[y] - r.bInfo.minimum.x * O) * L), H = Math.floor((e[b] - r.bInfo.minimum.y * O) * w), W = Math.floor((e[T] - r.bInfo.minimum.z * O) * F), X = Math.floor((e[E] - r.bInfo.minimum.x * O) * L), Y = Math.floor((e[A] - r.bInfo.minimum.y * O) * w), K = Math.floor((e[x] - r.bInfo.minimum.z * O) * F), q = G + r.subDiv.max * k + N * z, Z = j + r.subDiv.max * H + N * W, J = X + r.subDiv.max * Y + N * K, Q = B + r.subDiv.max * U + N * V, 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)), C && r && r.facetPositions) { var te = D[o]; te.ind = 3 * o, te.sqDistance = n.x.DistanceSquared(r.facetPositions[o], I) } i[g] += d, i[m] += f, i[v] += p, i[y] += d, i[b] += f, i[T] += p, i[E] += d, i[A] += f, i[x] += p } for (o = 0; o < i.length / 3; o++) d = i[3 * o], f = i[3 * o + 1], p = i[3 * o + 2], d /= _ = 0 === (_ = Math.sqrt(d * d + f * f + p * p)) ? 1 : _, f /= _, p /= _, i[3 * o] = d, i[3 * o + 1] = f, i[3 * o + 2] = p }, e._ComputeSides = function(t, i, r, o, s, a, c) { var l, u, h = r.length, d = o.length; switch (t = t || e.DEFAULTSIDE) { case e.FRONTSIDE: break; case e.BACKSIDE: var f; for (l = 0; l < h; l += 3) f = r[l], r[l] = r[l + 2], r[l + 2] = f; for (u = 0; u < d; u++) o[u] = -o[u]; break; case e.DOUBLESIDE: for (var p = i.length, _ = p / 3, g = 0; g < p; g++) i[p + g] = i[g]; for (l = 0; l < h; l += 3) r[l + h] = r[l + 2] + _, r[l + 1 + h] = r[l + 1] + _, r[l + 2 + h] = r[l] + _; for (u = 0; u < d; u++) o[d + u] = -o[u]; var m = s.length, v = 0; for (v = 0; v < m; v++) s[v + m] = s[v]; for (a = a || new n.y(0, 0, 1, 1), c = c || new n.y(0, 0, 1, 1), v = 0, l = 0; l < m / 2; l++) s[v] = a.x + (a.z - a.x) * s[v], s[v + 1] = a.y + (a.w - a.y) * s[v + 1], s[v + m] = c.x + (c.z - c.x) * s[v + m], s[v + m + 1] = c.y + (c.w - c.y) * s[v + m + 1], v += 2 } }, e.ImportVertexData = function(t, i) { var o = new e, s = t.positions; s && o.set(s, r.b.PositionKind); var a = t.normals; a && o.set(a, r.b.NormalKind); var c = t.tangents; c && o.set(c, r.b.TangentKind); var l = t.uvs; l && o.set(l, r.b.UVKind); var u = t.uv2s; u && o.set(u, r.b.UV2Kind); var h = t.uv3s; h && o.set(h, r.b.UV3Kind); var d = t.uv4s; d && o.set(d, r.b.UV4Kind); var f = t.uv5s; f && o.set(f, r.b.UV5Kind); var p = t.uv6s; p && o.set(p, r.b.UV6Kind); var _ = t.colors; _ && o.set(n.f.CheckColors4(_, s.length / 3), r.b.ColorKind); var g = t.matricesIndices; g && o.set(g, r.b.MatricesIndicesKind); var m = t.matricesWeights; m && o.set(m, 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 }); 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; n++) { if (e < this[n].index) break } this.splice(n, 0, { index: e, component: t, action: i.bind(t) }) }, t.prototype.clear = function() { this.length = 0 }, t }(Array) }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return l }); var n = i(6), r = i(16), o = i(0), s = i(23), a = i(4), c = i(38), l = 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 = !0, t[i] = !0, e.getTextureMatrix().isIdentityAs3x2() ? (t[i + "DIRECTUV"] = e.coordinatesIndex + 1, 0 === e.coordinatesIndex ? t.MAINUV1 = !0 : t.MAINUV2 = !0) : 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, s, a) { a._areMiscDirty && (a.LOGARITHMICDEPTH = i, a.POINTSIZE = n, a.FOG = t.fogEnabled && e.applyFog && t.fogMode !== r.a.FOGMODE_NONE && o, a.NONUNIFORMSCALING = e.nonUniformScaling, a.ALPHATEST = s) }, e.PrepareDefinesForFrameBoundValues = function(e, t, i, n, r) { void 0 === r && (r = null); var o, s, a, c, l = !1; o = null == r ? void 0 !== e.clipPlane && null !== e.clipPlane : r, s = null == r ? void 0 !== e.clipPlane2 && null !== e.clipPlane2 : r, a = 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, l = !0), i.CLIPPLANE2 !== s && (i.CLIPPLANE2 = s, l = !0), i.CLIPPLANE3 !== a && (i.CLIPPLANE3 = a, l = !0), i.CLIPPLANE4 !== c && (i.CLIPPLANE4 = c, l = !0), i.DEPTHPREPASS !== !t.getColorWrite() && (i.DEPTHPREPASS = !i.DEPTHPREPASS, l = !0), i.INSTANCES !== n && (i.INSTANCES = n, l = !0), l && i.markAsUnprocessed() }, e.PrepareDefinesForAttributes = function(e, t, i, n, r, o) { if (void 0 === r && (r = !1), void 0 === o && (o = !0), !t._areAttributesDirty && t._needNormals === t._normals && t._needUVs === t._uvs) return !1; if (t._normals = t._needNormals, t._uvs = t._needUVs, t.NORMAL = t._needNormals && e.isVerticesDataPresent(a.b.NormalKind), t._needNormals && e.isVerticesDataPresent(a.b.TangentKind) && (t.TANGENT = !0), t._needUVs ? (t.UV1 = e.isVerticesDataPresent(a.b.UVKind), t.UV2 = e.isVerticesDataPresent(a.b.UV2Kind)) : (t.UV1 = !1, t.UV2 = !1), i) { var s = e.useVertexColors && e.isVerticesDataPresent(a.b.ColorKind); t.VERTEXCOLOR = s, t.VERTEXALPHA = e.hasVertexAlpha && s && 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 = !0 : (t.BonesPerMesh = e.skeleton.bones.length + 1, t.BONETEXTURE = !c && void 0) } else t.NUM_BONE_INFLUENCERS = 0, t.BonesPerMesh = 0; if (r) { var l = e.morphTargetManager; l ? (t.MORPHTARGETS_TANGENT = l.supportsTangents && t.TANGENT, t.MORPHTARGETS_NORMAL = l.supportsNormals && t.NORMAL, t.MORPHTARGETS = l.numInfluencers > 0, t.NUM_MORPH_INFLUENCERS = l.numInfluencers) : (t.MORPHTARGETS_TANGENT = !1, t.MORPHTARGETS_NORMAL = !1, t.MORPHTARGETS = !1, t.NUM_MORPH_INFLUENCERS = 0) } return !0 }, 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 = !1), !i._areLightsDirty) return i._needNormals; var s = 0, a = !1, l = !1, u = !1, h = !1, d = !1; if (e.lightsEnabled && !o) for (var f = 0, p = t.lightSources; f < p.length; f++) { var _ = p[f]; switch (a = !0, void 0 === i["LIGHT" + s] && (l = !0), i["LIGHT" + s] = !0, i["SPOTLIGHT" + s] = !1, i["HEMILIGHT" + s] = !1, i["POINTLIGHT" + s] = !1, i["DIRLIGHT" + s] = !1, _.prepareLightSpecificDefines(i, s), i["LIGHT_FALLOFF_PHYSICAL" + s] = !1, i["LIGHT_FALLOFF_GLTF" + s] = !1, i["LIGHT_FALLOFF_STANDARD" + s] = !1, _.falloffType) { case c.a.FALLOFF_GLTF: i["LIGHT_FALLOFF_GLTF" + s] = !0; break; case c.a.FALLOFF_PHYSICAL: i["LIGHT_FALLOFF_PHYSICAL" + s] = !0; break; case c.a.FALLOFF_STANDARD: i["LIGHT_FALLOFF_STANDARD" + s] = !0 } if (n && !_.specular.equalsFloats(0, 0, 0) && (d = !0), i["SHADOW" + s] = !1, i["SHADOWPCF" + s] = !1, i["SHADOWPCSS" + s] = !1, i["SHADOWPOISSON" + s] = !1, i["SHADOWESM" + s] = !1, i["SHADOWCUBE" + s] = !1, i["SHADOWLOWQUALITY" + s] = !1, i["SHADOWMEDIUMQUALITY" + s] = !1, t && t.receiveShadows && e.shadowsEnabled && _.shadowEnabled) { var g = _.getShadowGenerator(); if (g) { var m = g.getShadowMap(); m && m.renderList && m.renderList.length > 0 && (h = !0, g.prepareDefines(i, s)) } } if (_.lightmapMode != c.a.LIGHTMAP_DEFAULT ? (u = !0, i["LIGHTMAPEXCLUDED" + s] = !0, i["LIGHTMAPNOSPECULAR" + s] = _.lightmapMode == c.a.LIGHTMAP_SHADOWSONLY) : (i["LIGHTMAPEXCLUDED" + s] = !1, i["LIGHTMAPNOSPECULAR" + s] = !1), ++s === r) break } i.SPECULARTERM = d, i.SHADOWS = h; for (var v = s; v < r; v++) void 0 !== i["LIGHT" + v] && (i["LIGHT" + v] = !1, i["HEMILIGHT" + v] = !1, i["POINTLIGHT" + v] = !1, i["DIRLIGHT" + v] = !1, i["SPOTLIGHT" + v] = !1, i["SHADOW" + v] = !1, i["SHADOWPCF" + v] = !1, i["SHADOWPCSS" + v] = !1, i["SHADOWPOISSON" + v] = !1, i["SHADOWESM" + v] = !1, i["SHADOWCUBE" + v] = !1, i["SHADOWLOWQUALITY" + v] = !1, i["SHADOWMEDIUMQUALITY" + v] = !1); var y = e.getEngine().getCaps(); return void 0 === i.SHADOWFLOAT && (l = !0), i.SHADOWFLOAT = h && (y.textureFloatRender && y.textureFloatLinearFiltering || y.textureHalfFloatRender && y.textureHalfFloatLinearFiltering), i.LIGHTMAPEXCLUDED = u, l && i.rebuild(), a }, e.PrepareUniformsAndSamplersList = function(e, t, i, n) { var r; void 0 === n && (n = 4); var o = null; if (e.uniformsNames) { var s = e; r = s.uniformsNames, o = s.uniformBuffersNames, t = s.samplers, i = s.defines, n = s.maxSimultaneousLights } else r = e, t || (t = []); for (var a = 0; a < n && i["LIGHT" + a]; a++) r.push("vLightData" + a, "vLightDiffuse" + a, "vLightSpecular" + a, "vLightDirection" + a, "vLightFalloff" + a, "vLightGround" + a, "lightMatrix" + a, "shadowsInfo" + a, "depthValues" + a), o && o.push("Light" + a), t.push("shadowSampler" + a), t.push("depthSampler" + a), i["PROJECTEDLIGHTTEXTURE" + a] && (t.push("projectionLightSampler" + a), r.push("textureProjectionMatrix" + a)); 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 && s.a.LastCreatedEngine) for (var o = s.a.LastCreatedEngine.getCaps().maxVertexAttribs, c = t.morphTargetManager, l = c && c.supportsNormals && i.NORMAL, u = c && c.supportsTangents && i.TANGENT, h = 0; h < r; h++) e.push(a.b.PositionKind + h), l && e.push(a.b.NormalKind + h), u && e.push(a.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(a.b.MatricesIndicesKind), e.push(a.b.MatricesWeightsKind), i.NUM_BONE_INFLUENCERS > 4 && (e.push(a.b.MatricesIndicesExtraKind), e.push(a.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, s, a) { void 0 === s && (s = 4), void 0 === a && (a = !1); for (var c = Math.min(i.lightSources.length, s), l = 0; l < c; l++) { var u = i.lightSources[l], h = l.toString(), d = u.getScaledIntensity(); u._uniformBuffer.bindToEffect(n, "Light" + l), e.BindLightProperties(u, n, l), u.diffuse.scaleToRef(d, o.t.Color3[0]), u._uniformBuffer.updateColor4("vLightDiffuse", o.t.Color3[0], a ? u.radius : u.range, h), r.SPECULARTERM && (u.specular.scaleToRef(d, o.t.Color3[1]), u._uniformBuffer.updateColor3("vLightSpecular", o.t.Color3[1], h)), t.shadowsEnabled && this.BindLightShadow(u, i, h, n), u._uniformBuffer.update() } }, e.BindFogParameters = function(e, t, i, n) { void 0 === n && (n = !1), e.fogEnabled && t.applyFog && e.fogMode !== r.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 = !1), 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) } if (t.clipPlane2) { i = t.clipPlane2; e.setFloat4("vClipPlane2", i.normal.x, i.normal.y, i.normal.z, i.d) } if (t.clipPlane3) { i = t.clipPlane3; e.setFloat4("vClipPlane3", i.normal.x, i.normal.y, i.normal.z, i.d) } if (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, i) { "use strict"; var n = i(1), r = i(9), o = i(47), s = i(8), a = i(28), c = i(61), l = i(29), u = i(0), h = i(42), d = i(24), f = i(21), p = i(30), _ = i(31), g = i(63), m = i(38), v = i(50), y = i(36), b = i(83), T = i(91), E = i(14), A = i(3), x = i(35), R = i(6), P = i(23), S = i(19), C = i(17), M = i(79), O = i(51), I = function() { function e() { this._singleClick = !1, this._doubleClick = !1, this._hasSwiped = !1, this._ignore = !1 } return Object.defineProperty(e.prototype, "singleClick", { get: function() { return this._singleClick }, set: function(e) { this._singleClick = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "doubleClick", { get: function() { return this._doubleClick }, set: function(e) { this._doubleClick = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "hasSwiped", { get: function() { return this._hasSwiped }, set: function(e) { this._hasSwiped = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "ignore", { get: function() { return this._ignore }, set: function(e) { this._ignore = e }, enumerable: !0, configurable: !0 }), e }(), D = function() { function e(e) { this._wheelEventName = "", this._meshPickProceed = !1, this._currentPickResult = null, this._previousPickResult = null, this._totalPointersPressed = 0, this._doubleClickOccured = !1, this._pointerX = 0, this._pointerY = 0, this._startingPointerPosition = new u.w(0, 0), this._previousStartingPointerPosition = new u.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "unTranslatedPointer", { get: function() { return new u.w(this._unTranslatedPointerX, this._unTranslatedPointerY) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "pointerX", { get: function() { return this._pointerX }, set: function(e) { this._pointerX = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "pointerY", { get: function() { return this._pointerY }, set: function(e) { this._pointerY = e }, enumerable: !0, configurable: !0 }), 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, s = i._pointerMoveStage; o < s.length; o++) { e = s[o].action(this._unTranslatedPointerX, this._unTranslatedPointerY, e, r, n) } if (e) { var a = t.type === this._wheelEventName ? C.a.POINTERWHEEL : C.a.POINTERMOVE; if (i.onPointerMove && i.onPointerMove(t, e, a), i.onPointerObservable.hasObservers()) { var c = new C.b(a, t, e); this._setRayOnPointerInfo(c), i.onPointerObservable.notifyObservers(c, a) } } } }, 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, u.j.Identity(), t.activeCamera))) }, e.prototype._checkPrePointerObservable = function(e, t, i) { var n = this._scene, r = new C.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, C.a.POINTERMOVE) || this._processPointerMove(e, i) }, e.prototype.simulatePointerDown = function(e, t) { var i = new PointerEvent("pointerdown", t); this._checkPrePointerObservable(e, i, C.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(A.a.ACTION_OnPickDownTrigger, y.a.CreateNew(t.pickedMesh, i)), i.button) { case 0: o.processTrigger(A.a.ACTION_OnLeftPickTrigger, y.a.CreateNew(t.pickedMesh, i)); break; case 1: o.processTrigger(A.a.ACTION_OnCenterPickTrigger, y.a.CreateNew(t.pickedMesh, i)); break; case 2: o.processTrigger(A.a.ACTION_OnRightPickTrigger, y.a.CreateNew(t.pickedMesh, i)) } o.hasSpecificTrigger(A.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(A.a.ACTION_OnLongPressTrigger) && e == n._pickedDownMesh }, !1, r.cameraToUseForPointers); t && t.hit && t.pickedMesh && o && 0 !== n._totalPointersPressed && Date.now() - n._startingPointerTime > e.LongPressDelay && !n._isPointerSwiping() && (n._startingPointerTime = 0, o.processTrigger(A.a.ACTION_OnLongPressTrigger, y.a.CreateNew(t.pickedMesh, i))) }, e.LongPressDelay) } } else for (var s = 0, a = r._pointerDownStage; s < a.length; s++) { t = a[s].action(this._unTranslatedPointerX, this._unTranslatedPointerY, t, i) } if (t) { var c = C.a.POINTERDOWN; if (r.onPointerDown && r.onPointerDown(i, t, c), r.onPointerObservable.hasObservers()) { var l = new C.b(c, i, t); this._setRayOnPointerInfo(l), r.onPointerObservable.notifyObservers(l, c) } } }, 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 = !0 : r.singleClick = !0, this._checkPrePointerObservable(e, n, C.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 = C.a.POINTERPICK, o = new C.b(r, t, e); this._setRayOnPointerInfo(o), n.onPointerObservable.notifyObservers(o, r) } var s = e.pickedMesh._getActionManagerForTrigger(); if (s && !i.ignore) { s.processTrigger(A.a.ACTION_OnPickUpTrigger, y.a.CreateNew(e.pickedMesh, t)), !i.hasSwiped && i.singleClick && s.processTrigger(A.a.ACTION_OnPickTrigger, y.a.CreateNew(e.pickedMesh, t)); var a = e.pickedMesh._getActionManagerForTrigger(A.a.ACTION_OnDoublePickTrigger); i.doubleClick && a && a.processTrigger(A.a.ACTION_OnDoublePickTrigger, y.a.CreateNew(e.pickedMesh, t)) } } else if (!i.ignore) for (var c = 0, l = n._pointerUpStage; c < l.length; c++) { e = l[c].action(this._unTranslatedPointerX, this._unTranslatedPointerY, e, t) } if (this._pickedDownMesh && this._pickedDownMesh !== this._pickedUpMesh) { var u = this._pickedDownMesh._getActionManagerForTrigger(A.a.ACTION_OnPickOutTrigger); u && u.processTrigger(A.a.ACTION_OnPickOutTrigger, y.a.CreateNew(this._pickedDownMesh, t)) } var h = 0; if (n.onPointerObservable.hasObservers()) { if (!i.ignore && !i.hasSwiped && (i.singleClick && n.onPointerObservable.hasSpecificMask(C.a.POINTERTAP) ? h = C.a.POINTERTAP : i.doubleClick && n.onPointerObservable.hasSpecificMask(C.a.POINTERDOUBLETAP) && (h = C.a.POINTERDOUBLETAP), h)) { o = new C.b(h, t, e); this._setRayOnPointerInfo(o), n.onPointerObservable.notifyObservers(o, h) } if (!i.ignore) { h = C.a.POINTERUP; o = new C.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 o = this; void 0 === t && (t = !0), void 0 === i && (i = !0), void 0 === n && (n = !0); var s = this._scene, a = s.getEngine().getRenderingCanvas(); if (a) { var c = s.getEngine(); this._initActionManager = function(e, t) { if (!o._meshPickProceed) { var i = s.pick(o._unTranslatedPointerX, o._unTranslatedPointerY, s.pointerDownPredicate, !1, s.cameraToUseForPointers); o._currentPickResult = i, i && (e = i.hit && i.pickedMesh ? i.pickedMesh._getActionManagerForTrigger() : null), o._meshPickProceed = !0 } return e }, this._delayedSimpleClick = function(t, i, n) { (Date.now() - o._previousStartingPointerTime > e.DoubleClickDelay && !o._doubleClickOccured || t !== o._previousButtonPressed) && (o._doubleClickOccured = !1, i.singleClick = !0, i.ignore = !1, n(i, o._currentPickResult)) }, this._initClickEvent = function(t, i, n, r) { var s = new I; o._currentPickResult = null; var a = null, c = t.hasSpecificMask(C.a.POINTERPICK) || i.hasSpecificMask(C.a.POINTERPICK) || t.hasSpecificMask(C.a.POINTERTAP) || i.hasSpecificMask(C.a.POINTERTAP) || t.hasSpecificMask(C.a.POINTERDOUBLETAP) || i.hasSpecificMask(C.a.POINTERDOUBLETAP); !c && M.a && (a = o._initActionManager(a, s)) && (c = a.hasPickTriggers); var l = !1; if (c) { var u = n.button; if (s.hasSwiped = o._isPointerSwiping(), !s.hasSwiped) { var h = !e.ExclusiveDoubleClickMode; h || (h = !t.hasSpecificMask(C.a.POINTERDOUBLETAP) && !i.hasSpecificMask(C.a.POINTERDOUBLETAP)) && !M.a.HasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger) && (a = o._initActionManager(a, s)) && (h = !a.hasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger)), h ? (Date.now() - o._previousStartingPointerTime > e.DoubleClickDelay || u !== o._previousButtonPressed) && (s.singleClick = !0, r(s, o._currentPickResult), l = !0) : (o._previousDelayedSimpleClickTimeout = o._delayedSimpleClickTimeout, o._delayedSimpleClickTimeout = window.setTimeout(o._delayedSimpleClick.bind(o, u, s, r), e.DoubleClickDelay)); var d = t.hasSpecificMask(C.a.POINTERDOUBLETAP) || i.hasSpecificMask(C.a.POINTERDOUBLETAP); !d && M.a.HasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger) && (a = o._initActionManager(a, s)) && (d = a.hasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger)), d && (u === o._previousButtonPressed && Date.now() - o._previousStartingPointerTime < e.DoubleClickDelay && !o._doubleClickOccured ? (s.hasSwiped || o._isPointerSwiping() ? (o._doubleClickOccured = !1, o._previousStartingPointerTime = o._startingPointerTime, o._previousStartingPointerPosition.x = o._startingPointerPosition.x, o._previousStartingPointerPosition.y = o._startingPointerPosition.y, o._previousButtonPressed = u, e.ExclusiveDoubleClickMode ? (o._previousDelayedSimpleClickTimeout && clearTimeout(o._previousDelayedSimpleClickTimeout), o._previousDelayedSimpleClickTimeout = o._delayedSimpleClickTimeout, r(s, o._previousPickResult)) : r(s, o._currentPickResult)) : (o._previousStartingPointerTime = 0, o._doubleClickOccured = !0, s.doubleClick = !0, s.ignore = !1, e.ExclusiveDoubleClickMode && o._previousDelayedSimpleClickTimeout && clearTimeout(o._previousDelayedSimpleClickTimeout), o._previousDelayedSimpleClickTimeout = o._delayedSimpleClickTimeout, r(s, o._currentPickResult)), l = !0) : (o._doubleClickOccured = !1, o._previousStartingPointerTime = o._startingPointerTime, o._previousStartingPointerPosition.x = o._startingPointerPosition.x, o._previousStartingPointerPosition.y = o._startingPointerPosition.y, o._previousButtonPressed = u)) } } l || r(s, o._currentPickResult) }, this._onPointerMove = function(e) { if (o._updatePointerPosition(e), !o._checkPrePointerObservable(null, e, e.type === o._wheelEventName ? C.a.POINTERWHEEL : C.a.POINTERMOVE) && (s.cameraToUseForPointers || s.activeCamera)) { s.pointerMovePredicate || (s.pointerMovePredicate = function(e) { return e.isPickable && e.isVisible && e.isReady() && e.isEnabled() && (e.enablePointerMoveEvents || s.constantlyUpdateMeshUnderPointer || null !== e.actionManager && void 0 !== e.actionManager) && (!s.cameraToUseForPointers || 0 != (s.cameraToUseForPointers.layerMask & e.layerMask)) }); var t = s.pick(o._unTranslatedPointerX, o._unTranslatedPointerY, s.pointerMovePredicate, !1, s.cameraToUseForPointers); o._processPointerMove(t, e) } }, this._onPointerDown = function(e) { if (o._totalPointersPressed++, o._pickedDownMesh = null, o._meshPickProceed = !1, o._updatePointerPosition(e), s.preventDefaultOnPointerDown && a && (e.preventDefault(), a.focus()), o._startingPointerPosition.x = o._pointerX, o._startingPointerPosition.y = o._pointerY, o._startingPointerTime = Date.now(), !o._checkPrePointerObservable(null, e, C.a.POINTERDOWN) && (s.cameraToUseForPointers || s.activeCamera)) { o._pointerCaptures[e.pointerId] = !0, s.pointerDownPredicate || (s.pointerDownPredicate = function(e) { return e.isPickable && e.isVisible && e.isReady() && e.isEnabled() && (!s.cameraToUseForPointers || 0 != (s.cameraToUseForPointers.layerMask & e.layerMask)) }), o._pickedDownMesh = null; var t = s.pick(o._unTranslatedPointerX, o._unTranslatedPointerY, s.pointerDownPredicate, !1, s.cameraToUseForPointers); o._processPointerDown(t, e) } }, this._onPointerUp = function(e) { 0 !== o._totalPointersPressed && (o._totalPointersPressed--, o._pickedUpMesh = null, o._meshPickProceed = !1, o._updatePointerPosition(e), s.preventDefaultOnPointerUp && a && (e.preventDefault(), a.focus()), o._initClickEvent(s.onPrePointerObservable, s.onPointerObservable, e, function(t, i) { if (s.onPrePointerObservable.hasObservers() && !t.ignore) { if (!t.hasSwiped) { if (t.singleClick && s.onPrePointerObservable.hasSpecificMask(C.a.POINTERTAP) && o._checkPrePointerObservable(null, e, C.a.POINTERTAP)) return; if (t.doubleClick && s.onPrePointerObservable.hasSpecificMask(C.a.POINTERDOUBLETAP) && o._checkPrePointerObservable(null, e, C.a.POINTERDOUBLETAP)) return } if (o._checkPrePointerObservable(null, e, C.a.POINTERUP)) return } o._pointerCaptures[e.pointerId] && (o._pointerCaptures[e.pointerId] = !1, (s.cameraToUseForPointers || s.activeCamera) && (s.pointerUpPredicate || (s.pointerUpPredicate = function(e) { return e.isPickable && e.isVisible && e.isReady() && e.isEnabled() && (!s.cameraToUseForPointers || 0 != (s.cameraToUseForPointers.layerMask & e.layerMask)) }), !o._meshPickProceed && (M.a && M.a.HasTriggers || s.onPointerObservable.hasObservers()) && o._initActionManager(null, t), i || (i = o._currentPickResult), o._processPointerUp(i, e, t), o._previousPickResult = o._currentPickResult)) })) }, this._onKeyDown = function(e) { var t = O.a.KEYDOWN; if (s.onPreKeyboardObservable.hasObservers()) { var i = new O.c(t, e); if (s.onPreKeyboardObservable.notifyObservers(i, t), i.skipOnPointerObservable) return } if (s.onKeyboardObservable.hasObservers()) { i = new O.b(t, e); s.onKeyboardObservable.notifyObservers(i, t) } s.actionManager && s.actionManager.processTrigger(A.a.ACTION_OnKeyDownTrigger, y.a.CreateNewFromScene(s, e)) }, this._onKeyUp = function(e) { var t = O.a.KEYUP; if (s.onPreKeyboardObservable.hasObservers()) { var i = new O.c(t, e); if (s.onPreKeyboardObservable.notifyObservers(i, t), i.skipOnPointerObservable) return } if (s.onKeyboardObservable.hasObservers()) { i = new O.b(t, e); s.onKeyboardObservable.notifyObservers(i, t) } s.actionManager && s.actionManager.processTrigger(A.a.ACTION_OnKeyUpTrigger, y.a.CreateNewFromScene(s, e)) }, this._onCanvasFocusObserver = c.onCanvasFocusObservable.add(function() { a && (a.addEventListener("keydown", o._onKeyDown, !1), a.addEventListener("keyup", o._onKeyUp, !1)) }), this._onCanvasBlurObserver = c.onCanvasBlurObservable.add(function() { a && (a.removeEventListener("keydown", o._onKeyDown), a.removeEventListener("keyup", o._onKeyUp)) }); var l = r.h.GetPointerPrefix(); n && (a.addEventListener(l + "move", this._onPointerMove, !1), this._wheelEventName = "onwheel" in document.createElement("div") ? "wheel" : void 0 !== document.onmousewheel ? "mousewheel" : "DOMMouseScroll", a.addEventListener(this._wheelEventName, this._onPointerMove, !1)), i && a.addEventListener(l + "down", this._onPointerDown, !1), t && window.addEventListener(l + "up", this._onPointerUp, !1) } }, e.prototype.detachControl = function() { var e = r.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), 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(A.a.ACTION_OnPointerOutTrigger)) && t.processTrigger(A.a.ACTION_OnPointerOutTrigger, y.a.CreateNew(this._pointerOverMesh)), this._pointerOverMesh = e, this._pointerOverMesh && (t = this._pointerOverMesh._getActionManagerForTrigger(A.a.ACTION_OnPointerOverTrigger)) && t.processTrigger(A.a.ACTION_OnPointerOverTrigger, y.a.CreateNew(this._pointerOverMesh))) }, e.prototype.getPointerOverMesh = function() { return this._pointerOverMesh }, e.DragMovementThreshold = 10, e.LongPressDelay = 500, e.DoubleClickDelay = 300, e.ExclusiveDoubleClickMode = !1, e }(); i.d(t, "a", function() { return L }); var L = function(e) { function t(i, n) { var o = e.call(this) || this; return o._inputManager = new D(o), o.cameraToUseForPointers = null, o._isScene = !0, o.autoClear = !0, o.autoClearDepthAndStencil = !0, o.clearColor = new u.f(.2, .2, .3, 1), o.ambientColor = new u.e(0, 0, 0), o._forceWireframe = !1, o._forcePointsCloud = !1, o.animationsEnabled = !0, o._animationPropertiesOverride = null, o.useConstantAnimationDeltaTime = !1, o.constantlyUpdateMeshUnderPointer = !1, o.hoverCursor = "pointer", o.defaultCursor = "", o.preventDefaultOnPointerDown = !0, o.preventDefaultOnPointerUp = !0, o.metadata = null, o.reservedDataStore = null, o.disableOfflineSupportExceptionRules = new Array, o.onDisposeObservable = new s.c, o._onDisposeObserver = null, o.onBeforeRenderObservable = new s.c, o._onBeforeRenderObserver = null, o.onAfterRenderObservable = new s.c, o._onAfterRenderObserver = null, o.onBeforeAnimationsObservable = new s.c, o.onAfterAnimationsObservable = new s.c, o.onBeforeDrawPhaseObservable = new s.c, o.onAfterDrawPhaseObservable = new s.c, o.onReadyObservable = new s.c, o.onBeforeCameraRenderObservable = new s.c, o._onBeforeCameraRenderObserver = null, o.onAfterCameraRenderObservable = new s.c, o._onAfterCameraRenderObserver = null, o.onBeforeActiveMeshesEvaluationObservable = new s.c, o.onAfterActiveMeshesEvaluationObservable = new s.c, o.onBeforeParticlesRenderingObservable = new s.c, o.onAfterParticlesRenderingObservable = new s.c, o.onDataLoadedObservable = new s.c, o.onNewCameraAddedObservable = new s.c, o.onCameraRemovedObservable = new s.c, o.onNewLightAddedObservable = new s.c, o.onLightRemovedObservable = new s.c, o.onNewGeometryAddedObservable = new s.c, o.onGeometryRemovedObservable = new s.c, o.onNewTransformNodeAddedObservable = new s.c, o.onTransformNodeRemovedObservable = new s.c, o.onNewMeshAddedObservable = new s.c, o.onMeshRemovedObservable = new s.c, o.onNewSkeletonAddedObservable = new s.c, o.onSkeletonRemovedObservable = new s.c, o.onNewMaterialAddedObservable = new s.c, o.onMaterialRemovedObservable = new s.c, o.onNewTextureAddedObservable = new s.c, o.onTextureRemovedObservable = new s.c, o.onBeforeRenderTargetsRenderObservable = new s.c, o.onAfterRenderTargetsRenderObservable = new s.c, o.onBeforeStepObservable = new s.c, o.onAfterStepObservable = new s.c, o.onActiveCameraChanged = new s.c, o.onBeforeRenderingGroupObservable = new s.c, o.onAfterRenderingGroupObservable = new s.c, o.onMeshImportedObservable = new s.c, o._registeredForLateAnimationBindings = new a.b(256), o.onPrePointerObservable = new s.c, o.onPointerObservable = new s.c, o.onPreKeyboardObservable = new s.c, o.onKeyboardObservable = new s.c, o._useRightHandedSystem = !1, o._timeAccumulator = 0, o._currentStepId = 0, o._currentInternalStep = 0, o._fogEnabled = !0, o._fogMode = t.FOGMODE_NONE, o.fogColor = new u.e(.2, .2, .3), o.fogDensity = .1, o.fogStart = 0, o.fogEnd = 1e3, o._shadowsEnabled = !0, o._lightsEnabled = !0, o.activeCameras = new Array, o._texturesEnabled = !0, o.particlesEnabled = !0, o.spritesEnabled = !0, o._skeletonsEnabled = !0, o.lensFlaresEnabled = !0, o.collisionsEnabled = !0, o.gravity = new u.x(0, -9.807, 0), o.postProcessesEnabled = !0, o.postProcesses = new Array, o.renderTargetsEnabled = !0, o.dumpNextRenderTargets = !1, o.customRenderTargets = new Array, o.importedMeshesFiles = new Array, o.probesEnabled = !0, o._meshesForIntersections = new a.b(256), o.proceduralTexturesEnabled = !0, o._totalVertices = new r.f, o._activeIndices = new r.f, o._activeParticles = new r.f, o._activeBones = new r.f, o._animationTime = 0, o.animationTimeScale = 1, o._renderId = 0, o._frameId = 0, o._executeWhenReadyTimeoutId = -1, o._intermediateRendering = !1, o._viewUpdateFlag = -1, o._projectionUpdateFlag = -1, o._toBeDisposed = new Array(256), o._activeRequests = new Array, o._pendingData = new Array, o._isDisposed = !1, o.dispatchAllSubMeshesOfActiveMeshes = !1, o._activeMeshes = new a.a(256), o._processedMaterials = new a.a(256), o._renderTargets = new a.b(256), o._activeParticleSystems = new a.a(256), o._activeSkeletons = new a.b(32), o._softwareSkinnedMeshes = new a.b(32), o._activeAnimatables = new Array, o._transformMatrix = u.j.Zero(), o.requireLightSorting = !1, o._components = [], o._serializableComponents = [], o._transientComponents = [], o._beforeCameraUpdateStage = E.b.Create(), o._beforeClearStage = E.b.Create(), o._gatherRenderTargetsStage = E.b.Create(), o._gatherActiveCameraRenderTargetsStage = E.b.Create(), o._isReadyForMeshStage = E.b.Create(), o._beforeEvaluateActiveMeshStage = E.b.Create(), o._evaluateSubMeshStage = E.b.Create(), o._activeMeshStage = E.b.Create(), o._cameraDrawRenderTargetStage = E.b.Create(), o._beforeCameraDrawStage = E.b.Create(), o._beforeRenderTargetDrawStage = E.b.Create(), o._beforeRenderingGroupDrawStage = E.b.Create(), o._beforeRenderingMeshStage = E.b.Create(), o._afterRenderingMeshStage = E.b.Create(), o._afterRenderingGroupDrawStage = E.b.Create(), o._afterCameraDrawStage = E.b.Create(), o._afterRenderTargetDrawStage = E.b.Create(), o._afterRenderStage = E.b.Create(), o._pointerMoveStage = E.b.Create(), o._pointerDownStage = E.b.Create(), o._pointerUpStage = E.b.Create(), o.geometriesByUniqueId = null, o._defaultMeshCandidates = { data: [], length: 0 }, o._defaultSubMeshCandidates = { data: [], length: 0 }, o._preventFreeActiveMeshesAndRenderingGroups = !1, o._activeMeshesFrozen = !1, o._allowPostProcessClearColor = !0, o.getDeterministicFrameTime = function() { return 1e3 / 60 }, o._blockMaterialDirtyMechanism = !1, o._engine = i || P.a.LastCreatedEngine, n && n.virtual || (P.a._LastCreatedScene = o, o._engine.scenes.push(o)), o._uid = null, o._renderingManager = new T.b(o), b.a && (o.postProcessManager = new b.a(o)), x.a.IsWindowObjectExist() && o.attachControl(), o._createUbo(), _.a && (o._imageProcessingConfiguration = new _.a), o.setDefaultCandidateProviders(), n && !0 === n.useGeometryUniqueIdsMap && (o.geometriesByUniqueId = {}), o.useMaterialMeshMap = n && n.useGeometryUniqueIdsMap || !1, o.useClonedMeshhMap = n && n.useClonedMeshhMap || !1, n && n.virtual || o._engine.onNewSceneAddedObservable.notifyObservers(o), o } return n.d(t, e), t.DefaultMaterialFactory = function(e) { throw S.a.WarnImport("StandardMaterial") }, t.CollisionCoordinatorFactory = function() { throw S.a.WarnImport("DefaultCollisionCoordinator") }, Object.defineProperty(t.prototype, "environmentTexture", { get: function() { return this._environmentTexture }, set: function(e) { this._environmentTexture !== e && (this._environmentTexture = e, this.markAllMaterialsAsDirty(A.a.MATERIAL_TextureDirtyFlag)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "imageProcessingConfiguration", { get: function() { return this._imageProcessingConfiguration }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "forceWireframe", { get: function() { return this._forceWireframe }, set: function(e) { this._forceWireframe !== e && (this._forceWireframe = e, this.markAllMaterialsAsDirty(A.a.MATERIAL_MiscDirtyFlag)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "forcePointsCloud", { get: function() { return this._forcePointsCloud }, set: function(e) { this._forcePointsCloud !== e && (this._forcePointsCloud = e, this.markAllMaterialsAsDirty(A.a.MATERIAL_MiscDirtyFlag)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "animationPropertiesOverride", { get: function() { return this._animationPropertiesOverride }, set: function(e) { this._animationPropertiesOverride = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onDispose", { set: function(e) { this._onDisposeObserver && this.onDisposeObservable.remove(this._onDisposeObserver), this._onDisposeObserver = this.onDisposeObservable.add(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "beforeRender", { set: function(e) { this._onBeforeRenderObserver && this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver), e && (this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(e)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "afterRender", { set: function(e) { this._onAfterRenderObserver && this.onAfterRenderObservable.remove(this._onAfterRenderObserver), e && (this._onAfterRenderObserver = this.onAfterRenderObservable.add(e)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "beforeCameraRender", { set: function(e) { this._onBeforeCameraRenderObserver && this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver), this._onBeforeCameraRenderObserver = this.onBeforeCameraRenderObservable.add(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "afterCameraRender", { set: function(e) { this._onAfterCameraRenderObserver && this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver), this._onAfterCameraRenderObserver = this.onAfterCameraRenderObservable.add(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "unTranslatedPointer", { get: function() { return this._inputManager.unTranslatedPointer }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "DragMovementThreshold", { get: function() { return D.DragMovementThreshold }, set: function(e) { D.DragMovementThreshold = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "LongPressDelay", { get: function() { return D.LongPressDelay }, set: function(e) { D.LongPressDelay = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "DoubleClickDelay", { get: function() { return D.DoubleClickDelay }, set: function(e) { D.DoubleClickDelay = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "ExclusiveDoubleClickMode", { get: function() { return D.ExclusiveDoubleClickMode }, set: function(e) { D.ExclusiveDoubleClickMode = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "useRightHandedSystem", { get: function() { return this._useRightHandedSystem }, set: function(e) { this._useRightHandedSystem !== e && (this._useRightHandedSystem = e, this.markAllMaterialsAsDirty(A.a.MATERIAL_MiscDirtyFlag)) }, enumerable: !0, configurable: !0 }), 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(A.a.MATERIAL_MiscDirtyFlag)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "fogMode", { get: function() { return this._fogMode }, set: function(e) { this._fogMode !== e && (this._fogMode = e, this.markAllMaterialsAsDirty(A.a.MATERIAL_MiscDirtyFlag)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "shadowsEnabled", { get: function() { return this._shadowsEnabled }, set: function(e) { this._shadowsEnabled !== e && (this._shadowsEnabled = e, this.markAllMaterialsAsDirty(A.a.MATERIAL_LightDirtyFlag)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "lightsEnabled", { get: function() { return this._lightsEnabled }, set: function(e) { this._lightsEnabled !== e && (this._lightsEnabled = e, this.markAllMaterialsAsDirty(A.a.MATERIAL_LightDirtyFlag)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "activeCamera", { get: function() { return this._activeCamera }, set: function(e) { e !== this._activeCamera && (this._activeCamera = e, this.onActiveCameraChanged.notifyObservers(this)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "defaultMaterial", { get: function() { return this._defaultMaterial || (this._defaultMaterial = t.DefaultMaterialFactory(this)), this._defaultMaterial }, set: function(e) { this._defaultMaterial = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "texturesEnabled", { get: function() { return this._texturesEnabled }, set: function(e) { this._texturesEnabled !== e && (this._texturesEnabled = e, this.markAllMaterialsAsDirty(A.a.MATERIAL_TextureDirtyFlag)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "skeletonsEnabled", { get: function() { return this._skeletonsEnabled }, set: function(e) { this._skeletonsEnabled !== e && (this._skeletonsEnabled = e, this.markAllMaterialsAsDirty(A.a.MATERIAL_AttributesDirtyFlag)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "collisionCoordinator", { get: function() { return this._collisionCoordinator || (this._collisionCoordinator = t.CollisionCoordinatorFactory(), this._collisionCoordinator.init(this)), this._collisionCoordinator }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "frustumPlanes", { get: function() { return this._frustumPlanes }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "pointerX", { get: function() { return this._inputManager.pointerX }, set: function(e) { this._inputManager.pointerX = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "pointerY", { get: function() { return this._inputManager.pointerY }, set: function(e) { this._inputManager.pointerY = e }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), t.prototype.getActiveIndices = function() { return this._activeIndices.current }, Object.defineProperty(t.prototype, "totalActiveIndicesPerfCounter", { get: function() { return this._activeIndices }, enumerable: !0, configurable: !0 }), t.prototype.getActiveParticles = function() { return this._activeParticles.current }, Object.defineProperty(t.prototype, "activeParticlesPerfCounter", { get: function() { return this._activeParticles }, enumerable: !0, configurable: !0 }), t.prototype.getActiveBones = function() { return this._activeBones.current }, Object.defineProperty(t.prototype, "activeBonesPerfCounter", { get: function() { return this._activeBones }, enumerable: !0, configurable: !0 }), 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 g.a(this._engine, void 0, !0), 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 = !0), void 0 === t && (t = !0), void 0 === i && (i = !0), this._inputManager.attachControl(e, t, i) }, t.prototype.detachControl = function() { this._inputManager.detachControl() }, t.prototype.isReady = function() { if (this._isDisposed) return !1; var e, t = this.getEngine(); if (!t.areAllEffectsReady()) return !1; if (this._pendingData.length > 0) return !1; 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(!0)) return !1; 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 !1 } } } for (e = 0; e < this.geometries.length; e++) { if (this.geometries[e].delayLoadState === A.a.DELAYLOADSTATE_LOADING) return !1 } if (this.activeCameras && this.activeCameras.length > 0) for (var s = 0, a = this.activeCameras; s < a.length; s++) { if (!a[s].isReady(!0)) return !1 } else if (this.activeCamera && !this.activeCamera.isReady(!0)) return !1; for (var c = 0, l = this.particleSystems; c < l.length; c++) { if (!l[c].isReady()) return !1 } return !0 }, 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, i = function() { e(), setTimeout(function() { t.unregisterBeforeRender(i) }) }; this.registerBeforeRender(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: !0, configurable: !0 }), 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 Promise(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: !0, configurable: !0 }), t.prototype.resetLastAnimationTimeFrame = function() { this._animationTimeLast = o.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 ? u.i.GetPlanesToRef(this._transformMatrix, this._frustumPlanes) : this._frustumPlanes = u.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 = !1), 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 = !1); 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(m.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 = !0); 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 !1 } else if ((t = this.geometries.indexOf(e)) < 0) return !1; 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), !0 }, 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); if (r) return r; var o = this.getBoneByID(e); return o || 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); if (r) return r; var o = this.getBoneByName(e); return o || 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 = r.h.RandomId()), this._uid }, enumerable: !0, configurable: !0 }), t.prototype.addExternalData = function(e, t) { return this._externalData || (this._externalData = new c.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 c.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, !1), 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: !0, configurable: !0 }), 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 = !0; 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 = !1, this }, t.prototype._evaluateActiveMeshes = function() { if (this._activeMeshesFrozen && this._activeMeshes.length) for (var e = this._activeMeshes.length, t = 0; t < e; t++) { (s = 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 s; if (!(s = r.data[t]).isBlocked && (this._totalVertices.addCount(s.getTotalVertices(), !1), s.isReady() && s.isEnabled() && 0 !== s.scaling.lengthSquared())) { s.computeWorldMatrix(), s.actionManager && s.actionManager.hasSpecificTriggers2(A.a.ACTION_OnIntersectionEnterTrigger, A.a.ACTION_OnIntersectionExitTrigger) && this._meshesForIntersections.pushNoDuplicate(s); var a = this.customLODSelector ? this.customLODSelector(s, this.activeCamera) : s.getLOD(this.activeCamera); null != a && (a !== s && a.billboardMode !== h.a.BILLBOARDMODE_NONE && a.computeWorldMatrix(), s._preActivate(), s.isVisible && s.visibility > 0 && 0 != (s.layerMask & this.activeCamera.layerMask) && (s.alwaysSelectAsActiveMesh || s.isInFrustum(this._frustumPlanes)) && (this._activeMeshes.push(s), this.activeCamera._activeMeshes.push(s), a !== s && a._activate(this._renderId, !1), s._activate(this._renderId, !1) && (s.isAnInstance || (a._internalAbstractMeshDataInfo._onlyForInstances = !1), a._internalAbstractMeshDataInfo._isActive = !0, this._activeMesh(s, a)), s._postActivate())) } } if (this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this), this.particlesEnabled) { this.onBeforeParticlesRenderingObservable.notifyObservers(this); for (var c = 0; c < this.particleSystems.length; c++) { var l = this.particleSystems[c]; if (l.isStarted() && l.emitter) { var u = l.emitter; u.position && !u.isEnabled() || (this._activeParticleSystems.push(l), l.animate(), this._renderingManager.dispatchParticles(l)) } } 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, s = 0; s < o; s++) { var a = r.data[s]; this._evaluateSubMesh(a, 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) : R.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 o = this._softwareSkinnedMeshes.data[n]; o.applySkeleton(o.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 s = 0, a = this._gatherActiveCameraRenderTargetsStage; s < a.length; s++) { a[s].action(this._renderTargets) } if (this.renderTargetsEnabled) { this._intermediateRendering = !0; var c = !1; if (this._renderTargets.length > 0) { r.h.StartPerformanceCounter("Render targets", this._renderTargets.length > 0); for (var l = 0; l < this._renderTargets.length; l++) { var u = this._renderTargets.data[l]; if (u._shouldRender()) { this._renderId++; var h = u.activeCamera && u.activeCamera !== this.activeCamera; u.render(h, this.dumpNextRenderTargets), c = !0 } } r.h.EndPerformanceCounter("Render targets", this._renderTargets.length > 0), this._renderId++ } for (var d = 0, f = this._cameraDrawRenderTargetStage; d < f.length; d++) { c = f[d].action(this.activeCamera) || c } this._intermediateRendering = !1, c && this._bindFrameBuffer() } this.onAfterRenderTargetsRenderObservable.notifyObservers(this), this.postProcessManager && !e._multiviewTexture && this.postProcessManager._prepareFrame(); for (var p = 0, _ = this._beforeCameraDrawStage; p < _.length; p++) { _[p].action(this.activeCamera) } this.onBeforeDrawPhaseObservable.notifyObservers(this), this._renderingManager.render(null, null, !0, !0), this.onAfterDrawPhaseObservable.notifyObservers(this); for (var g = 0, m = this._afterCameraDrawStage; g < m.length; g++) { m[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 === f.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 === A.a.ACTION_OnIntersectionEnterTrigger || n.trigger === A.a.ACTION_OnIntersectionExitTrigger) { var r = n.getTriggerParameter(), o = r instanceof d.a ? r : r.mesh, s = o.intersectsMesh(t, r.usePreciseIntersection), a = t._intersectionsInProgress.indexOf(o); s && -1 === a ? n.trigger === A.a.ACTION_OnIntersectionEnterTrigger ? (n._executeCurrent(y.a.CreateNew(t, void 0, o)), t._intersectionsInProgress.push(o)) : n.trigger === A.a.ACTION_OnIntersectionExitTrigger && t._intersectionsInProgress.push(o) : !s && a > -1 && (n.trigger === A.a.ACTION_OnIntersectionExitTrigger && n._executeCurrent(y.a.CreateNew(t, void 0, o)), t.actionManager.hasSpecificTrigger(A.a.ACTION_OnIntersectionExitTrigger, function(e) { var t = e instanceof d.a ? e : e.mesh; return o === t }) && n.trigger !== A.a.ACTION_OnIntersectionExitTrigger || t._intersectionsInProgress.splice(a, 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 = !0), void 0 === t && (t = !1), !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(A.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 o = 0; o < this.activeCameras.length; o++) { var s = this.activeCameras[o]; if (s.update(), s.cameraRigMode !== f.a.RIG_MODE_NONE) for (var a = 0; a < s._rigCameras.length; a++) s._rigCameras[a].update() } else if (this.activeCamera && (this.activeCamera.update(), this.activeCamera.cameraRigMode !== f.a.RIG_MODE_NONE)) for (a = 0; a < this.activeCamera._rigCameras.length; a++) this.activeCamera._rigCameras[a].update(); this.onBeforeRenderObservable.notifyObservers(this), this.onBeforeRenderTargetsRenderObservable.notifyObservers(this); var c = this.getEngine(), l = this.activeCamera; if (this.renderTargetsEnabled) { r.h.StartPerformanceCounter("Custom render targets", this.customRenderTargets.length > 0), this._intermediateRendering = !0; for (var u = 0; u < this.customRenderTargets.length; u++) { var h = this.customRenderTargets[u]; 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(l !== this.activeCamera, this.dumpNextRenderTargets) } } r.h.EndPerformanceCounter("Custom render targets", this.customRenderTargets.length > 0), this._intermediateRendering = !1, this._renderId++ } this.activeCamera = l, this._bindFrameBuffer(), this.onAfterRenderTargetsRenderObservable.notifyObservers(this); for (var d = 0, p = this._beforeClearStage; d < p.length; d++) { p[d].action() }(this.autoClearDepthAndStencil || this.autoClear) && this._engine.clear(this.clearColor, this.autoClear || this.forceWireframe || this.forcePointsCloud, this.autoClearDepthAndStencil, this.autoClearDepthAndStencil); for (var _ = 0, g = this._gatherRenderTargetsStage; _ < g.length; _++) { g[_].action(this._renderTargets) } if (this.activeCameras.length > 0) for (o = 0; o < this.activeCameras.length; o++) o > 0 && this._engine.clear(null, !1, !0, !0), this._processSubCameras(this.activeCameras[o]); else { if (!this.activeCamera) throw new Error("No camera defined"); this._processSubCameras(this.activeCamera) } this._checkIntersections(); for (var m = 0, v = this._afterRenderStage; m < v.length; m++) { v[m].action() } if (this.afterRender && this.afterRender(), this.onAfterRenderObservable.notifyObservers(this), this._toBeDisposed.length) { for (a = 0; a < this._toBeDisposed.length; a++) { var y = this._toBeDisposed[a]; y && y.dispose() } this._toBeDisposed = [] } this.dumpNextRenderTargets && (this.dumpNextRenderTargets = !1), this._activeBones.addCount(0, !0), this._activeIndices.addCount(0, !0), this._activeParticles.addCount(0, !0) } }, 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(!0); for (; this.transformNodes.length;) this.transformNodes[0].dispose(!0); 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(!0), this._isDisposed = !0 }, Object.defineProperty(t.prototype, "isDisposed", { get: function() { return this._isDisposed }, enumerable: !0, configurable: !0 }), 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 u.x(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), i = new u.x(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); return e = e || function() { return !0 }, this.meshes.filter(e).forEach(function(e) { if (e.computeWorldMatrix(!0), e.subMeshes && 0 !== e.subMeshes.length && !e.infiniteDistance) { var n = e.getBoundingInfo(), o = n.boundingBox.minimumWorld, s = n.boundingBox.maximumWorld; r.h.CheckExtends(o, t, i), r.h.CheckExtends(s, t, i) } }), { min: t, max: i } }, t.prototype.createPickingRay = function(e, t, i, n, r) { throw void 0 === r && (r = !1), S.a.WarnImport("Ray") }, t.prototype.createPickingRayToRef = function(e, t, i, n, r, o) { throw void 0 === o && (o = !1), S.a.WarnImport("Ray") }, t.prototype.createPickingRayInCameraSpace = function(e, t, i) { throw S.a.WarnImport("Ray") }, t.prototype.createPickingRayInCameraSpaceToRef = function(e, t, i, n) { throw S.a.WarnImport("Ray") }, t.prototype.pick = function(e, t, i, n, r, o) { var s = new v.a; return s._pickingUnavailable = !0, s }, t.prototype.pickWithRay = function(e, t, i, n) { throw S.a.WarnImport("Ray") }, t.prototype.multiPick = function(e, t, i, n, r) { throw S.a.WarnImport("Ray") }, t.prototype.multiPickWithRay = function(e, t, i) { throw S.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 s = 0, a = this.particleSystems; s < a.length; s++) { a[s].rebuild() } }, t.prototype._rebuildTextures = function() { for (var e = 0, t = this.textures; e < t.length; e++) { t[e]._rebuild() } this.markAllMaterialsAsDirty(A.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 = !0), void 0 === n && (n = !0), 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(A.a.MATERIAL_AllDirtyFlag)) }, enumerable: !0, configurable: !0 }), 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, o, s) { var a = this, c = r.h.LoadFile(e, t, i, n ? this.offlineProvider : void 0, o, s); return this._activeRequests.push(c), c.onCompleteObservable.add(function(e) { a._activeRequests.splice(a._activeRequests.indexOf(e), 1) }), c }, t.prototype._loadFileAsync = function(e, t, i) { var n = this; return new Promise(function(r, o) { n._loadFile(e, function(e) { r(e) }, void 0, t, i, 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 }(p.a) }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return o }), i.d(t, "c", function() { return s }), i.d(t, "d", function() { return a }), 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 }(), s = function() { return function(e, t) { this.type = e, this.event = t } }(), a = function(e) { function t(t, i, n, o) { var s = e.call(this, t, i) || this; return s.ray = null, s.skipOnPointerObservable = !1, s.localPosition = new r.w(n, o), s } return n.d(t, e), t }(s), 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 }(s) }, 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), e._DiffuseTextureEnabled = !0, e._AmbientTextureEnabled = !0, e._OpacityTextureEnabled = !0, e._ReflectionTextureEnabled = !0, e._EmissiveTextureEnabled = !0, e._SpecularTextureEnabled = !0, e._BumpTextureEnabled = !0, e._LightmapTextureEnabled = !0, e._RefractionTextureEnabled = !0, e._ColorGradingTextureEnabled = !0, e._FresnelEnabled = !0, e._ClearCoatTextureEnabled = !0, e._ClearCoatBumpTextureEnabled = !0, e._ClearCoatTintTextureEnabled = !0, e._SheenTextureEnabled = !0, e._AnisotropicTextureEnabled = !0, e._ThicknessTextureEnabled = !0, 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, i) { "use strict"; i.d(t, "a", function() { return f }); var n = i(1), r = i(2), o = i(9), s = i(8), a = i(0), c = i(23), l = i(49), u = i(63), h = i(3), d = i(6), f = function() { function e(t, i, n) { this.metadata = null, this.reservedDataStore = null, this.checkReadyOnEveryCall = !1, this.checkReadyOnlyOnce = !1, this.state = "", this._alpha = 1, this._backFaceCulling = !0, this.onCompiled = null, this.onError = null, this.getRenderTargetTextures = null, this.doNotSerialize = !1, this._storeEffectOnSubMeshes = !1, this.animations = null, this.onDisposeObservable = new s.c, this._onDisposeObserver = null, this._onUnBindObservable = null, this._onBindObserver = null, this._alphaMode = h.a.ALPHA_COMBINE, this._needDepthPrePass = !1, this.disableDepthWrite = !1, this.forceDepthWrite = !1, this.separateCullingPass = !1, this._fogEnabled = !0, this.pointSize = 1, this.zOffset = 0, this._effect = null, this._wasPreviouslyReady = !1, this._useUBO = !1, this._fillMode = e.TriangleFillMode, this._cachedDepthWriteState = !1, this._indexInSceneMaterialArray = -1, this.meshMap = null, this.name = t, this.id = t || o.h.RandomId(), this._scene = i || c.a.LastCreatedScene, this.uniqueId = this._scene.getUniqueId(), this._scene.useRightHandedSystem ? this.sideOrientation = e.ClockWiseSideOrientation : this.sideOrientation = e.CounterClockWiseSideOrientation, this._uniformBuffer = new u.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "backFaceCulling", { get: function() { return this._backFaceCulling }, set: function(t) { this._backFaceCulling !== t && (this._backFaceCulling = t, this.markAsDirty(e.TextureDirtyFlag)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "hasRenderTargetTextures", { get: function() { return !1 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "onDispose", { set: function(e) { this._onDisposeObserver && this.onDisposeObservable.remove(this._onDisposeObserver), this._onDisposeObserver = this.onDisposeObservable.add(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "onBindObservable", { get: function() { return this._onBindObservable || (this._onBindObservable = new s.c), this._onBindObservable }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "onBind", { set: function(e) { this._onBindObserver && this.onBindObservable.remove(this._onBindObserver), this._onBindObserver = this.onBindObservable.add(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "onUnBindObservable", { get: function() { return this._onUnBindObservable || (this._onUnBindObservable = new s.c), this._onUnBindObservable }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "alphaMode", { get: function() { return this._alphaMode }, set: function(t) { this._alphaMode !== t && (this._alphaMode = t, this.markAsDirty(e.TextureDirtyFlag)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "needDepthPrePass", { get: function() { return this._needDepthPrePass }, set: function(e) { this._needDepthPrePass !== e && (this._needDepthPrePass = e, this._needDepthPrePass && (this.checkReadyOnEveryCall = !0)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "fogEnabled", { get: function() { return this._fogEnabled }, set: function(t) { this._fogEnabled !== t && (this._fogEnabled = t, this.markAsDirty(e.MiscDirtyFlag)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "wireframe", { get: function() { switch (this._fillMode) { case e.WireFrameFillMode: case e.LineListDrawMode: case e.LineLoopDrawMode: case e.LineStripDrawMode: return !0 } return this._scene.forceWireframe }, set: function(t) { this.fillMode = t ? e.WireFrameFillMode : e.TriangleFillMode }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "pointsCloud", { get: function() { switch (this._fillMode) { case e.PointFillMode: case e.PointListDrawMode: return !0 } return this._scene.forcePointsCloud }, set: function(t) { this.fillMode = t ? e.PointFillMode : e.TriangleFillMode }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "fillMode", { get: function() { return this._fillMode }, set: function(t) { this._fillMode !== t && (this._fillMode = t, this.markAsDirty(e.MiscDirtyFlag)) }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), e.prototype.freeze = function() { this.checkReadyOnlyOnce = !0 }, e.prototype.unfreeze = function() { this.checkReadyOnlyOnce = !1 }, e.prototype.isReady = function(e, t) { return !0 }, e.prototype.isReadyForSubMesh = function(e, t, i) { return !1 }, 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 !1 }, e.prototype.getAlphaTestTexture = function() { return null }, e.prototype.markDirty = function() { this._wasPreviouslyReady = !1 }, 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, !1, 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(!1) } }, 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 !1 }, 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 this._scene.meshes.filter(function(t) { return t.material === e }) }, e.prototype.forceCompilation = function(e, t, i) { var r = this, o = n.a({ clipPlane: !1 }, i), s = new l.a, c = this.getScene(), u = function() { if (r._scene && r._scene.getEngine()) { s._materialDefines && (s._materialDefines._renderId = -1); var i = c.clipPlane; o.clipPlane && (c.clipPlane = new a.n(0, 0, 0, 1)), r._storeEffectOnSubMeshes ? r.isReadyForSubMesh(e, s) ? t && t(r) : setTimeout(u, 16) : r.isReady() ? t && t(r) : setTimeout(u, 16), o.clipPlane && (c.clipPlane = i) } }; u() }, e.prototype.forceCompilationAsync = function(e, t) { var i = this; return new Promise(function(n) { i.forceCompilation(e, function() { n() }, 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 s = o[r]; s.getMaterial() === this && (s._materialDefines && e(s._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), n.freeProcessedMaterials(), n.removeMaterial(this), !0 !== i) if (this.meshMap) for (var r in this.meshMap) { (a = this.meshMap[r]) && (a.material = null, this.releaseVertexArrayObject(a, e)) } else for (var o = 0, s = n.meshes; o < s.length; o++) { var a; (a = s[o]).material !== this || a.sourceMesh || (a.material = null, this.releaseVertexArrayObject(a, 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 r.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 o.h.Instantiate(e.customType).Parse(e, t, i) }, e.TriangleFillMode = h.a.MATERIAL_TriangleFillMode, e.WireFrameFillMode = h.a.MATERIAL_WireFrameFillMode, e.PointFillMode = h.a.MATERIAL_PointFillMode, e.PointListDrawMode = h.a.MATERIAL_PointListDrawMode, e.LineListDrawMode = h.a.MATERIAL_LineListDrawMode, e.LineLoopDrawMode = h.a.MATERIAL_LineLoopDrawMode, e.LineStripDrawMode = h.a.MATERIAL_LineStripDrawMode, e.TriangleStripDrawMode = h.a.MATERIAL_TriangleStripDrawMode, e.TriangleFanDrawMode = h.a.MATERIAL_TriangleFanDrawMode, e.ClockWiseSideOrientation = h.a.MATERIAL_ClockWiseSideOrientation, e.CounterClockWiseSideOrientation = h.a.MATERIAL_CounterClockWiseSideOrientation, e.TextureDirtyFlag = h.a.MATERIAL_TextureDirtyFlag, e.LightDirtyFlag = h.a.MATERIAL_LightDirtyFlag, e.FresnelDirtyFlag = h.a.MATERIAL_FresnelDirtyFlag, e.AttributesDirtyFlag = h.a.MATERIAL_AttributesDirtyFlag, e.MiscDirtyFlag = h.a.MATERIAL_MiscDirtyFlag, e.AllDirtyFlag = h.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) } }, n.c([Object(r.c)()], e.prototype, "id", void 0), 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, "checkReadyOnEveryCall", void 0), n.c([Object(r.c)()], e.prototype, "checkReadyOnlyOnce", void 0), n.c([Object(r.c)()], e.prototype, "state", void 0), n.c([Object(r.c)("alpha")], e.prototype, "_alpha", void 0), n.c([Object(r.c)("backFaceCulling")], e.prototype, "_backFaceCulling", void 0), n.c([Object(r.c)()], e.prototype, "sideOrientation", void 0), n.c([Object(r.c)("alphaMode")], e.prototype, "_alphaMode", void 0), n.c([Object(r.c)()], e.prototype, "_needDepthPrePass", void 0), n.c([Object(r.c)()], e.prototype, "disableDepthWrite", void 0), n.c([Object(r.c)()], e.prototype, "forceDepthWrite", void 0), n.c([Object(r.c)()], e.prototype, "separateCullingPass", void 0), n.c([Object(r.c)("fogEnabled")], e.prototype, "_fogEnabled", void 0), n.c([Object(r.c)()], e.prototype, "pointSize", void 0), n.c([Object(r.c)()], e.prototype, "zOffset", void 0), n.c([Object(r.c)()], e.prototype, "wireframe", null), n.c([Object(r.c)()], e.prototype, "pointsCloud", null), n.c([Object(r.c)()], e.prototype, "fillMode", null), e }() }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return f }); var n = i(1), r = i(2), o = i(28), s = i(9), a = i(8), c = i(0), l = i(25), u = i(6), h = i(22), d = i(19), f = function(e) { function t(i, n, r, s) { void 0 === s && (s = !0); var l = e.call(this, i, r) || this; return l._position = c.x.Zero(), l.upVector = c.x.Up(), l.orthoLeft = null, l.orthoRight = null, l.orthoBottom = null, l.orthoTop = null, l.fov = .8, l.minZ = 1, l.maxZ = 1e4, l.inertia = .9, l.mode = t.PERSPECTIVE_CAMERA, l.isIntermediate = !1, l.viewport = new c.z(0, 0, 1, 1), l.layerMask = 268435455, l.fovMode = t.FOVMODE_VERTICAL_FIXED, l.cameraRigMode = t.RIG_MODE_NONE, l.customRenderTargets = new Array, l.outputRenderTarget = null, l.onViewMatrixChangedObservable = new a.c, l.onProjectionMatrixChangedObservable = new a.c, l.onAfterCheckInputsObservable = new a.c, l.onRestoreStateObservable = new a.c, l._rigCameras = new Array, l._webvrViewMatrix = c.j.Identity(), l._skipRendering = !1, l._projectionMatrix = new c.j, l._postProcesses = new Array, l._activeMeshes = new o.a(256), l._globalPosition = c.x.Zero(), l._computedViewMatrix = c.j.Identity(), l._doNotComputeProjectionMatrix = !1, l._transformMatrix = c.j.Zero(), l._refreshFrustumPlanes = !0, l._isCamera = !0, l._isLeftCamera = !1, l._isRightCamera = !0, l.getScene().addCamera(l), s && !l.getScene().activeCamera && (l.getScene().activeCamera = l), l.position = n, l } return n.d(t, e), Object.defineProperty(t.prototype, "position", { get: function() { return this._position }, set: function(e) { this._position = e }, enumerable: !0, configurable: !0 }), t.prototype.storeState = function() { return this._stateStored = !0, this._storedFov = this.fov, this }, t.prototype._restoreStateValues = function() { return !!this._stateStored && (this.fov = this._storedFov, !0) }, t.prototype.restoreState = function() { return !!this._restoreStateValues() && (this.onRestoreStateObservable.notifyObservers(this), !0) }, 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: !0, configurable: !0 }), 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 = !1), t) for (var i = 0, n = this._postProcesses; i < n.length; i++) { var r = n[i]; if (r && !r.isReady()) return !1 } 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 !1; var i = this.getEngine(); return e = 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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "rigPostProcess", { get: function() { return this._rigPostProcess }, enumerable: !0, configurable: !0 }), 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; if (r) "pass" === r.getEffectName() && (n.isIntermediate = 0 === this._postProcesses.length), n._postProcesses = this._postProcesses.slice(0).concat(r), r.markTextureDirty(); else 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 ? (u.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 = !0, 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 = !0, void 0 !== e && (this._projectionMatrix = e) }, t.prototype.unfreezeProjectionMatrix = function() { this._doNotComputeProjectionMatrix = !1 }, 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 = !0; 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), this._projectionMatrix }, 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 = !1) }, t.prototype.isInFrustum = function(e, t) { if (void 0 === t && (t = !1), this._updateFrustumPlanes(), t && this.rigCameras.length > 0) { var i = !1; 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), d.a.WarnImport("Ray") }, t.prototype.dispose = function(i, n) { for (void 0 === n && (n = !1), 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 s = this._postProcesses[o]; s && s.dispose(this) } for (o = this.customRenderTargets.length; --o >= 0;) this.customRenderTargets[o].dispose(); this.customRenderTargets = [], this._activeMeshes.dispose(), e.prototype.dispose.call(this, i, n) }, Object.defineProperty(t.prototype, "isLeftCamera", { get: function() { return this._isLeftCamera }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "isRightCamera", { get: function() { return this._isRightCamera }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "leftCamera", { get: function() { return this._rigCameras.length < 1 ? null : this._rigCameras[0] }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "rightCamera", { get: function() { return this._rigCameras.length < 2 ? null : this._rigCameras[1] }, enumerable: !0, configurable: !0 }), 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 = s.h.ToRadians(this._cameraRigParams.interaxialDistance / .0637), this.cameraRigMode !== t.RIG_MODE_NONE) { var r = this.createRigCamera(this.name + "_L", 0); r && (r._isLeftCamera = !0); var o = this.createRigCamera(this.name + "_R", 1); o && (o._isRightCamera = !0), 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 = s.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(), this.parent && (e.parentId = this.parent.id), this.inputs && this.inputs.serialize(e), r.a.AppendSerializedAnimations(this, e), 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) { void 0 === r && (r = 0), void 0 === o && (o = !0); var s = l.a.Construct(e, i, n, { interaxial_distance: r, isStereoscopicSideBySide: o }); return s || 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), s = r.a.Parse(o, e, i); if (e.parentId && (s._waitingParentId = e.parentId), s.inputs && (s.inputs.parse(e), s._setupInputs()), s.setPosition && (s.position.copyFromFloats(0, 0, 0), s.setPosition(c.x.FromArray(e.position))), e.target && s.setTarget && s.setTarget(c.x.FromArray(e.target)), e.cameraRigMode) { var a = e.interaxial_distance ? { interaxialDistance: e.interaxial_distance } : {}; s.setCameraRigMode(e.cameraRigMode, a) } if (e.animations) { for (var u = 0; u < e.animations.length; u++) { var d = e.animations[u], f = h.a.GetClass("BABYLON.Animation"); f && s.animations.push(f.Parse(d)) } l.a.ParseAnimationRanges(s, e, i) } return e.autoAnimate && i.beginAnimation(s, e.autoAnimateFrom, e.autoAnimateTo, e.autoAnimateLoop, e.autoAnimateSpeed || 1), s }, t._createDefaultParsedCamera = function(e, t) { throw d.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 = !1, 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), n.c([Object(r.c)()], t.prototype, "orthoBottom", void 0), n.c([Object(r.c)()], t.prototype, "orthoTop", void 0), n.c([Object(r.c)()], t.prototype, "fov", void 0), n.c([Object(r.c)()], t.prototype, "minZ", void 0), n.c([Object(r.c)()], t.prototype, "maxZ", void 0), n.c([Object(r.c)()], t.prototype, "inertia", void 0), n.c([Object(r.c)()], t.prototype, "mode", void 0), 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), t }(l.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: !0, configurable: !0 }), Object.defineProperty(e, "LastCreatedScene", { get: function() { return this._LastCreatedScene }, enumerable: !0, configurable: !0 }), 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), s = i(0), a = i(10), c = i(4), l = i(13), u = i(42), h = i(50), d = i(43), f = i(3), p = i(108), _ = i(19), g = function() { return function() { this.facetNb = 0, this.partitioningSubdivisions = 10, this.partitioningBBoxRatio = 1.01, this.facetDataEnabled = !1, this.facetParameters = {}, this.bbSize = s.x.Zero(), this.subDiv = { max: 1, X: 1, Y: 1, Z: 1 }, this.facetDepthSort = !1, this.facetDepthSortEnabled = !1 } }(), m = function() { return function() { this._hasVertexAlpha = !1, this._useVertexColors = !0, this._numBoneInfluencers = 4, this._applyFog = !0, this._receiveShadows = !1, this._facetData = new g, this._visibility = 1, this._skeleton = null, this._layerMask = 268435455, this._computeBonesUsingShaders = !0, this._isActive = !1, this._onlyForInstances = !1, this._isActiveIntermediate = !1, this._onlyForInstancesIntermediate = !1 } }(), v = function(e) { function t(i, n) { void 0 === n && (n = null); var r = e.call(this, i, n, !1) || this; return r._internalAbstractMeshDataInfo = new m, r.cullingStrategy = t.CULLINGSTRATEGY_STANDARD, r.onCollideObservable = new o.c, r.onCollisionPositionChangeObservable = new o.c, r.onMaterialChangedObservable = new o.c, r.definedFacingForward = !0, r._occlusionQuery = null, r._renderingGroup = null, r.alphaIndex = Number.MAX_VALUE, r.isVisible = !0, r.isPickable = !0, r.showSubMeshesBoundingBox = !1, r.isBlocker = !1, r.enablePointerMoveEvents = !1, r.renderingGroupId = 0, r._material = null, r.outlineColor = s.e.Red(), r.outlineWidth = .02, r.overlayColor = s.e.Red(), r.overlayAlpha = .5, r.useOctreeForRenderingSelection = !0, r.useOctreeForPicking = !0, r.useOctreeForCollisions = !0, r.alwaysSelectAsActiveMesh = !1, r.doNotSyncBoundingInfo = !1, r.actionManager = null, r._meshCollisionData = new p.a, r.ellipsoid = new s.x(.5, 1, .5), r.ellipsoidOffset = new s.x(0, 0, 0), r.edgesWidth = 1, r.edgesColor = new s.f(1, 0, 0, 1), r._edgesRenderer = null, r._masterMesh = null, r._boundingInfo = null, r._renderId = 0, r._intersectionsInProgress = new Array, r._unIndexed = !1, 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() > a.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 u.a.BILLBOARDMODE_NONE }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "BILLBOARDMODE_X", { get: function() { return u.a.BILLBOARDMODE_X }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "BILLBOARDMODE_Y", { get: function() { return u.a.BILLBOARDMODE_Y }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "BILLBOARDMODE_Z", { get: function() { return u.a.BILLBOARDMODE_Z }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "BILLBOARDMODE_ALL", { get: function() { return u.a.BILLBOARDMODE_ALL }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "facetNb", { get: function() { return this._internalAbstractMeshDataInfo._facetData.facetNb }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "partitioningSubdivisions", { get: function() { return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions }, set: function(e) { this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "partitioningBBoxRatio", { get: function() { return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio }, set: function(e) { this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "mustDepthSortFacets", { get: function() { return this._internalAbstractMeshDataInfo._facetData.facetDepthSort }, set: function(e) { this._internalAbstractMeshDataInfo._facetData.facetDepthSort = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "facetDepthSortFrom", { get: function() { return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom }, set: function(e) { this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "isFacetDataEnabled", { get: function() { return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled }, enumerable: !0, configurable: !0 }), t.prototype._updateNonUniformScalingState = function(t) { return !!e.prototype._updateNonUniformScalingState.call(this, t) && (this._markSubMeshesAsMiscDirty(), !0) }, Object.defineProperty(t.prototype, "onCollide", { set: function(e) { this._meshCollisionData._onCollideObserver && this.onCollideObservable.remove(this._meshCollisionData._onCollideObserver), this._meshCollisionData._onCollideObserver = this.onCollideObservable.add(e) }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "useVertexColors", { get: function() { return this._internalAbstractMeshDataInfo._useVertexColors }, set: function(e) { this._internalAbstractMeshDataInfo._useVertexColors !== e && (this._internalAbstractMeshDataInfo._useVertexColors = e, this._markSubMeshesAsAttributesDirty()) }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "collisionMask", { get: function() { return this._meshCollisionData._collisionMask }, set: function(e) { this._meshCollisionData._collisionMask = isNaN(e) ? -1 : e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "collisionGroup", { get: function() { return this._meshCollisionData._collisionGroup }, set: function(e) { this._meshCollisionData._collisionGroup = isNaN(e) ? -1 : e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "lightSources", { get: function() { return this._lightSources }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "_positions", { get: function() { return null }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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 !== u.a.BILLBOARDMODE_NONE ? this._masterMesh : e.prototype._getEffectiveParent.call(this) }, t.prototype._getActionManagerForTrigger = function(e, t) { if (void 0 === t && (t = !0), 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, !1) : 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(f.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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "isBlocked", { get: function() { return !1 }, enumerable: !0, configurable: !0 }), 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 !1 }, 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 = !0), void 0 === t && (t = !1); 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), s = Math.max(o.x, o.y, o.z); if (0 === s) return this; var a = 1 / s; return this.scaling.scaleInPlace(a), 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 }, Object.defineProperty(t.prototype, "useBones", { get: function() { return this.skeleton && this.getScene().skeletonsEnabled && this.isVerticesDataPresent(c.b.MatricesIndicesKind) && this.isVerticesDataPresent(c.b.MatricesWeightsKind) }, enumerable: !0, configurable: !0 }), t.prototype._preActivate = function() {}, t.prototype._preActivateForIntermediateRendering = function(e) {}, t.prototype._activate = function(e, t) { return this._renderId = e, !0 }, t.prototype._postActivate = function() {}, t.prototype._freeze = function() {}, t.prototype._unFreeze = function() {}, t.prototype.getWorldMatrix = function() { return this._masterMesh && this.billboardMode === u.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 !1 }, enumerable: !0, configurable: !0 }), 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 s.j; (this.rotationQuaternion ? this.rotationQuaternion : s.q.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z)).toRotationMatrix(n); var r = s.x.Zero(), o = this.definedFacingForward ? -1 : 1; return s.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 s.x(e * n, t, i * n) }, t.prototype.refreshBoundingInfo = function(e) { return void 0 === e && (e = !1), 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 d.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, a = o ? this.getVerticesData(c.b.MatricesIndicesExtraKind) : null, l = o ? this.getVerticesData(c.b.MatricesWeightsExtraKind) : null; this.skeleton.prepare(); for (var u = this.skeleton.getTransformMatrices(this), h = s.t.Vector3[0], d = s.t.Matrix[0], f = s.t.Matrix[1], p = 0, _ = 0; _ < t.length; _ += 3, p += 4) { var g, m; for (d.reset(), g = 0; g < 4; g++)(m = n[p + g]) > 0 && (s.j.FromFloat32ArrayToRefScaled(u, Math.floor(16 * i[p + g]), m, f), d.addToSelf(f)); if (o) for (g = 0; g < 4; g++)(m = l[p + g]) > 0 && (s.j.FromFloat32ArrayToRefScaled(u, Math.floor(16 * a[p + g]), m, f), d.addToSelf(f)); s.x.TransformCoordinatesFromFloatsToRef(t[_], t[_ + 1], t[_ + 2], d, h), h.toArray(t, _), this._positions && this._positions[_ / 3].copyFrom(h) } } } return t }, t.prototype._updateBoundingInfo = function() { var e = this._effectiveMesh; return this._boundingInfo ? this._boundingInfo.update(e.worldMatrixFromCache) : this._boundingInfo = new d.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: !0, configurable: !0 }), 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 = !1), !this._boundingInfo || !e._boundingInfo) return !1; if (this._boundingInfo.intersects(e._boundingInfo, t)) return !0; if (i) for (var n = 0, r = this.getChildMeshes(); n < r.length; n++) { if (r[n].intersectsMesh(e, t, !0)) return !0 } return !1 }, 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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "collider", { get: function() { return this._meshCollisionData._collider }, enumerable: !0, configurable: !0 }), 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(s.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 = s.t.Matrix[0], i = s.t.Matrix[1]; return s.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 !1 }, 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 a = null, c = this._scene.getIntersectingSubMeshCandidates(this, e), l = c.length, u = 0; u < l; u++) { var d = c.data[u]; if (!(l > 1) || d.canIntersects(e)) { var f = d.intersects(e, this._positions, this.getIndices(), t, i); if (f && (t || !a || f.distance < a.distance) && ((a = f).subMeshId = u, t)) break } } if (a) { var p = this.getWorldMatrix(), _ = s.t.Vector3[0], g = s.t.Vector3[1]; s.x.TransformCoordinatesToRef(e.origin, p, _), e.direction.scaleToRef(a.distance, g); var m = s.x.TransformNormal(g, p).addInPlace(_); return n.hit = !0, n.distance = s.x.Distance(_, m), n.pickedPoint = m, n.pickedMesh = this, n.bu = a.bu || 0, n.bv = a.bv || 0, n.faceId = a.faceId, n.subMeshId = a.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 = !1), 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], s = o._intersectionsInProgress.indexOf(this); o._intersectionsInProgress.splice(s, 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 a = this.getScene().getEngine(); if (this._occlusionQuery && (this.isOcclusionQueryInProgress = !1, a.deleteQuery(this._occlusionQuery), this._occlusionQuery = null), a.wipeCaches(), this.getScene().removeMesh(this), i && this.material && ("MultiMaterial" === this.material.getClassName() ? this.material.dispose(!1, !0, !0) : this.material.dispose(!1, !0)), !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(), 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] = s.x.Zero(), e.facetPositions[t] = s.x.Zero(); return e.facetDataEnabled = !0, 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 = !0, i instanceof Uint16Array) e.depthSortedIndices = new Uint16Array(i); else if (i instanceof Uint32Array) e.depthSortedIndices = new Uint32Array(i); else { for (var o = !1, a = 0; a < i.length; a++) if (i[a] > 65535) { o = !0; break } e.depthSortedIndices = o ? new Uint32Array(i) : new Uint16Array(i) } if (e.facetDepthSortFunction = function(e, t) { return t.sqDistance - e.sqDistance }, !e.facetDepthSortFrom) { var u = this.getScene().activeCamera; e.facetDepthSortFrom = u ? u.position : s.x.Zero() } e.depthSortedFacets = []; for (var h = 0; h < e.facetNb; h++) { var d = { ind: 3 * h, sqDistance: 0 }; e.depthSortedFacets.push(d) } e.invertedMatrix = s.j.Identity(), e.facetDepthSortOrigin = s.x.Zero() } e.bbSize.x = r.maximum.x - r.minimum.x > s.h ? r.maximum.x - r.minimum.x : s.h, e.bbSize.y = r.maximum.y - r.minimum.y > s.h ? r.maximum.y - r.minimum.y : s.h, e.bbSize.z = r.maximum.z - r.minimum.z > s.h ? r.maximum.z - r.minimum.z : s.h; var f = e.bbSize.x > e.bbSize.y ? e.bbSize.x : e.bbSize.y; if (f = f > e.bbSize.z ? f : e.bbSize.z, e.subDiv.max = e.partitioningSubdivisions, e.subDiv.X = Math.floor(e.subDiv.max * e.bbSize.x / f), e.subDiv.Y = Math.floor(e.subDiv.max * e.bbSize.y / f), e.subDiv.Z = Math.floor(e.subDiv.max * e.bbSize.z / f), 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(!0), this._worldMatrix.invertToRef(e.invertedMatrix), s.x.TransformCoordinatesToRef(e.facetDepthSortFrom, e.invertedMatrix, e.facetDepthSortOrigin), e.facetParameters.distanceTo = e.facetDepthSortOrigin), e.facetParameters.depthSortedFacets = e.depthSortedFacets, l.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 _ = e.depthSortedFacets[h].ind; e.depthSortedIndices[3 * h] = i[_], e.depthSortedIndices[3 * h + 1] = i[_ + 1], e.depthSortedIndices[3 * h + 2] = i[_ + 2] } this.updateIndices(e.depthSortedIndices, void 0, !0) } 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(), e.facetPartitioning }, t.prototype.getFacetPosition = function(e) { var t = s.x.Zero(); return this.getFacetPositionToRef(e, t), t }, t.prototype.getFacetPositionToRef = function(e, t) { var i = this.getFacetLocalPositions()[e], n = this.getWorldMatrix(); return s.x.TransformCoordinatesToRef(i, n, t), this }, t.prototype.getFacetNormal = function(e) { var t = s.x.Zero(); return this.getFacetNormalToRef(e, t), t }, t.prototype.getFacetNormalToRef = function(e, t) { var i = this.getFacetLocalNormals()[e]; return s.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), s = Math.floor((t - n.minimum.y * r.partitioningBBoxRatio) * r.subDiv.Y * r.partitioningBBoxRatio / r.bbSize.y), a = Math.floor((i - n.minimum.z * r.partitioningBBoxRatio) * r.subDiv.Z * r.partitioningBBoxRatio / r.bbSize.z); return o < 0 || o > r.subDiv.max || s < 0 || s > r.subDiv.max || a < 0 || a > r.subDiv.max ? null : r.facetPartitioning[o + r.subDiv.max * s + r.subDiv.max * r.subDiv.max * a] }, t.prototype.getClosestFacetAtCoordinates = function(e, t, i, n, r, o) { void 0 === r && (r = !1), void 0 === o && (o = !0); var a = this.getWorldMatrix(), c = s.t.Matrix[5]; a.invertToRef(c); var l = s.t.Vector3[8]; s.x.TransformCoordinatesFromFloatsToRef(e, t, i, c, l); var u = this.getClosestFacetAtLocalCoordinates(l.x, l.y, l.z, n, r, o); return n && s.x.TransformCoordinatesFromFloatsToRef(n.x, n.y, n.z, a, n), u }, t.prototype.getClosestFacetAtLocalCoordinates = function(e, t, i, n, r, o) { void 0 === r && (r = !1), void 0 === o && (o = !0); var s = null, a = 0, c = 0, l = 0, u = 0, h = 0, d = 0, f = 0, p = 0, _ = this.getFacetLocalPositions(), g = this.getFacetLocalNormals(), m = this.getFacetsAtLocalCoordinates(e, t, i); if (!m) return null; for (var v, y, b, T = Number.MAX_VALUE, E = T, A = 0; A < m.length; A++) y = g[v = m[A]], u = (e - (b = _[v]).x) * y.x + (t - b.y) * y.y + (i - b.z) * y.z, (!r || r && o && u >= 0 || r && !o && u <= 0) && (u = y.x * b.x + y.y * b.y + y.z * b.z, h = -(y.x * e + y.y * t + y.z * i - u) / (y.x * y.x + y.y * y.y + y.z * y.z), (E = (a = (d = e + y.x * h) - e) * a + (c = (f = t + y.y * h) - t) * c + (l = (p = i + y.z * h) - i) * l) < T && (T = E, s = v, n && (n.x = d, n.y = f, n.z = p))); return s }, t.prototype.getFacetDataParameters = function() { return this._internalAbstractMeshDataInfo._facetData.facetParameters }, t.prototype.disableFacetData = function() { var e = this._internalAbstractMeshDataInfo._facetData; return e.facetDataEnabled && (e.facetDataEnabled = !1, 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 = !1), 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) : [], l.a.ComputeNormals(i, n, t, { useRightHandedSystem: this.getScene().useRightHandedSystem }), this.setVerticesData(c.b.NormalKind, t, e), this }, t.prototype.alignWithNormal = function(e, t) { t || (t = s.c.Y); var i = s.t.Vector3[0], n = s.t.Vector3[1]; return s.x.CrossToRef(t, e, n), s.x.CrossToRef(e, n, i), this.rotationQuaternion ? s.q.RotationQuaternionFromAxisToRef(i, e, n, this.rotationQuaternion) : s.x.RotationFromAxisToRef(i, e, n, this.rotation), this }, t.prototype._checkOcclusionQuery = function() { return !1 }, t.prototype.disableEdgesRendering = function() { throw _.a.WarnImport("EdgesRenderer") }, t.prototype.enableEdgesRendering = function(e, t) { throw _.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 = f.a.MESHES_CULLINGSTRATEGY_STANDARD, t.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = f.a.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY, t.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = f.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION, t.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = f.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY, t }(u.a) }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return u }); var n = i(1), r = i(0), o = i(2), s = i(8), a = i(23), c = i(19), l = i(9), u = function() { function e(e, t, i) { void 0 === t && (t = null), void 0 === i && (i = !0), this.state = "", this.metadata = null, this.reservedDataStore = null, this.doNotSerialize = !1, this._isDisposed = !1, this.animations = new Array, this._ranges = {}, this.onReady = null, this._isEnabled = !0, this._isParentEnabled = !0, this._isReady = !0, 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 = !0, this._sceneRootNodesIndex = -1, this._animationPropertiesOverride = null, this._isNode = !0, this.onDisposeObservable = new s.c, this._onDisposeObserver = null, this._behaviors = new Array, this.name = e, this.id = e, this._scene = t || a.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: !0, configurable: !0 }), 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 }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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 = !1), -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: !0, configurable: !0 }), 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 = !1, this._worldMatrixDeterminant = this._worldMatrix.determinant()), this._worldMatrixDeterminant }, Object.defineProperty(e.prototype, "worldMatrixFromCache", { get: function() { return this._worldMatrix }, enumerable: !0, configurable: !0 }), 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 = !0), this.parent ? this.parent._getActionManagerForTrigger(e, !1) : null }, e.prototype._updateCache = function(e) {}, e.prototype._isSynchronized = function() { return !0 }, 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, !1) : !(this._parentNode && !this.isSynchronizedWithParent()) && this._isSynchronized() }, e.prototype.isReady = function(e) { return void 0 === e && (e = !1), this._isReady }, e.prototype.isEnabled = function(e) { return void 0 === e && (e = !0), !1 === 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 = !1), 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, !1, 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 = !0), this.getDescendants(t, e) }, e.prototype._setReady = function(e) { e !== this._isReady && (e ? (this.onReady && this.onReady(this), this._isReady = !0) : this._isReady = !1) }, 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 = !0); 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()), this._worldMatrix }, e.prototype.dispose = function(e, t) { if (void 0 === t && (t = !1), this._isDisposed = !0, !e) for (var i = 0, n = this.getDescendants(!0); 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; void 0 === e && (e = !0), void 0 === t && (t = null), this.getScene().incrementRenderId(), this.computeWorldMatrix(!0); if (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 s = 0, a = this.getDescendants(!1); s < a.length; s++) { var c = a[s]; if (c.computeWorldMatrix(!0), (!t || t(c)) && c.getBoundingInfo && 0 !== c.getTotalVertices()) { var u = c.getBoundingInfo().boundingBox, h = u.minimumWorld, d = u.maximumWorld; l.h.CheckExtends(h, i, n), l.h.CheckExtends(d, i, n) } } 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 a }); var n = i(8), r = i(92), o = i(3), s = i(19), a = function() { function e(t, i, r) { void 0 === r && (r = !1), this.isReady = !1, this.isCube = !1, this.is3D = !1, this.isMultiview = !1, this.url = "", this.samplingMode = -1, this.generateMipMaps = !1, 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 = !1, this._invertVScale = !1, 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 = !1, this._compression = null, this._generateStencilBuffer = !1, this._generateDepthBuffer = !1, 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 = !1, 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: !0, configurable: !0 }), 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 = !1, this._cachedCoordinatesMode = null, this._cachedWrapU = null, this._cachedWrapV = null, this._cachedAnisotropicFilteringLevel = null, this._dataSource) { case e.DATASOURCE_TEMP: 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 = !0 }, 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 = !0); 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 = !0); 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, !0); 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, this.isCube) t = this._engine.createRenderTargetCubeTexture(this.width, n); else { var s = { width: this.width, height: this.height }; t = this._engine.createRenderTargetTexture(s, n) } return t._swapAndDie(this), void(this.isReady = !0); case e.DATASOURCE_DEPTHTEXTURE: var a = { 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 }, a))._swapAndDie(this), void(this.isReady = !0); case e.DATASOURCE_CUBE: return void(t = this._engine.createCubeTexture(this.url, null, this._files, !this.generateMipMaps, function() { t._swapAndDie(i), i.isReady = !0 }, 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 = !0); 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 = !0 }); 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 = !0 }, 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 s.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 l }); var n = i(6), r = i(34), o = i(0), s = i(24), a = i(11), c = i(37); a.a._PhysicsImpostorParser = function(e, t, i) { return new l(t, i.physicsImpostor, { mass: i.physicsMass, friction: i.physicsFriction, restitution: i.physicsRestitution }, e) }; var l = function() { function e(e, t, i, r) { var s = this; void 0 === i && (i = { mass: 0 }), this.object = e, this.type = t, this._options = i, this._scene = r, this._pluginData = {}, this._bodyUpdateRequired = !1, this._onBeforePhysicsStepCallbacks = new Array, this._onAfterPhysicsStepCallbacks = new Array, this._onPhysicsCollideCallbacks = [], this._deltaPosition = o.x.Zero(), this._isDisposed = !1, this.soft = !1, this.segments = 0, this._tmpQuat = new o.q, this._tmpQuat2 = new o.q, this.beforeStep = function() { s._physicsEngine && (s.object.translate(s._deltaPosition, -1), s._deltaRotationConjugated && s.object.rotationQuaternion && s.object.rotationQuaternion.multiplyToRef(s._deltaRotationConjugated, s.object.rotationQuaternion), s.object.computeWorldMatrix(!1), s.object.parent && s.object.rotationQuaternion ? (s.getParentsRotation(), s._tmpQuat.multiplyToRef(s.object.rotationQuaternion, s._tmpQuat)) : s._tmpQuat.copyFrom(s.object.rotationQuaternion || new o.q), s._options.disableBidirectionalTransformation || s.object.rotationQuaternion && s._physicsEngine.getPhysicsPlugin().setPhysicsBodyTransformation(s, s.object.getAbsolutePosition(), s._tmpQuat), s._onBeforePhysicsStepCallbacks.forEach(function(e) { e(s) })) }, this.afterStep = function() { s._physicsEngine && (s._onAfterPhysicsStepCallbacks.forEach(function(e) { e(s) }), s._physicsEngine.getPhysicsPlugin().setTransformationFromPhysicsBody(s), s.object.parent && s.object.rotationQuaternion && (s.getParentsRotation(), s._tmpQuat.conjugateInPlace(), s._tmpQuat.multiplyToRef(s.object.rotationQuaternion, s.object.rotationQuaternion)), s.object.setAbsolutePosition(s.object.position), s._deltaRotation && s.object.rotationQuaternion && s.object.rotationQuaternion.multiplyToRef(s._deltaRotation, s.object.rotationQuaternion), s.object.translate(s._deltaPosition, 1)) }, this.onCollideEvent = null, this.onCollide = function(e) { if ((s._onPhysicsCollideCallbacks.length || s.onCollideEvent) && s._physicsEngine) { var t = s._physicsEngine.getImpostorWithPhysicsBody(e.body); t && (s.onCollideEvent && s.onCollideEvent(s, t), s._onPhysicsCollideCallbacks.filter(function(e) { return -1 !== e.otherImpostors.indexOf(t) }).forEach(function(e) { e.callback(s, t) })) } }, this.object ? (!this._scene && e.getScene && (this._scene = e.getScene()), this._scene && (this.type > 100 && (this.soft = !0), 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "mass", { get: function() { return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyMass(this) : 0 }, set: function(e) { this.setMass(e) }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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 s.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "parent", { get: function() { return !this._options.ignoreParent && this._parent ? this._parent : null }, set: function(e) { this._parent = e }, enumerable: !0, configurable: !0 }), e.prototype.resetUpdateFlags = function() { this._bodyUpdateRequired = !1 }, 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(!0); var i = this.object.getBoundingInfo().boundingBox.extendSizeWorld.scale(2); return this.object.rotationQuaternion = t, this.object.computeWorldMatrix && this.object.computeWorldMatrix(!0), 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 = !0 }, 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 !1 }) ? 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 = !0) }, 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, s) { var a = e._tmpVecs[0], c = this.object; if (c.rotationQuaternion) if (s) { var l = e._tmpQuat; c.rotationQuaternion.multiplyToRef(s, l), t.setRotationQuaternion(l, o.s.WORLD, i) } else t.setRotationQuaternion(c.rotationQuaternion, o.s.WORLD, i); a.x = 0, a.y = 0, a.z = 0, n && (a.x = n.x, a.y = n.y, a.z = n.z, t.getDirectionToRef(a, i, a), null == r && (r = n.length()), a.x *= r, a.y *= r, a.z *= r), t.getParent() ? (a.addInPlace(c.getAbsolutePosition()), t.setAbsolutePosition(a, i)) : (i.setAbsolutePosition(c.getAbsolutePosition()), i.position.x -= a.x, i.position.y -= a.y, i.position.z -= a.z) }, e.prototype.syncImpostorWithBone = function(t, i, n, r, s, a) { var c = this.object; if (c.rotationQuaternion) if (s) { var l = e._tmpQuat; t.getRotationQuaternionToRef(o.s.WORLD, i, l), l.multiplyToRef(s, c.rotationQuaternion) } else t.getRotationQuaternionToRef(o.s.WORLD, i, c.rotationQuaternion); var u = e._tmpVecs[0], h = e._tmpVecs[1]; a || ((a = e._tmpVecs[2]).x = 0, a.y = 1, a.z = 0), t.getDirectionToRef(a, i, h), t.getAbsolutePositionToRef(i, u), null == r && n && (r = n.length()), null != r && (u.x += h.x * r, u.y += h.y * r, u.z += h.z * r), c.setAbsolutePosition(u) }, 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, 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), 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 }(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 = !0), !e._tags) return null; if (t) { var i = []; for (var n in e._tags) e._tags.hasOwnProperty(n) && !0 === 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] = !0)) }, 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 }); 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 u }), i.d(t, "a", function() { return h }); var n = i(1), r = i(2), o = i(8), s = i(9), a = i(0), c = i(64), l = i(93), u = function(e) { function t() { var t = e.call(this) || this; return t.IMAGEPROCESSING = !1, t.VIGNETTE = !1, t.VIGNETTEBLENDMODEMULTIPLY = !1, t.VIGNETTEBLENDMODEOPAQUE = !1, t.TONEMAPPING = !1, t.TONEMAPPING_ACES = !1, t.CONTRAST = !1, t.COLORCURVES = !1, t.COLORGRADING = !1, t.COLORGRADING3D = !1, t.SAMPLER3DGREENDEPTH = !1, t.SAMPLER3DBGRMAP = !1, t.IMAGEPROCESSINGPOSTPROCESS = !1, t.EXPOSURE = !1, t.rebuild(), t } return n.d(t, e), t }(c.a), h = function() { function e() { this.colorCurves = new l.a, this._colorCurvesEnabled = !1, this._colorGradingEnabled = !1, this._colorGradingWithGreenDepth = !0, this._colorGradingBGR = !0, this._exposure = 1, this._toneMappingEnabled = !1, this._toneMappingType = e.TONEMAPPING_STANDARD, this._contrast = 1, this.vignetteStretch = 0, this.vignetteCentreX = 0, this.vignetteCentreY = 0, this.vignetteWeight = 1.5, this.vignetteColor = new a.f(0, 0, 0, 0), this.vignetteCameraFov = .5, this._vignetteBlendMode = e.VIGNETTEMODE_MULTIPLY, this._vignetteEnabled = !1, this._applyByPostProcess = !1, this._isEnabled = !0, 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "colorGradingTexture", { get: function() { return this._colorGradingTexture }, set: function(e) { this._colorGradingTexture !== e && (this._colorGradingTexture = e, this._updateParameters()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "colorGradingEnabled", { get: function() { return this._colorGradingEnabled }, set: function(e) { this._colorGradingEnabled !== e && (this._colorGradingEnabled = e, this._updateParameters()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "colorGradingWithGreenDepth", { get: function() { return this._colorGradingWithGreenDepth }, set: function(e) { this._colorGradingWithGreenDepth !== e && (this._colorGradingWithGreenDepth = e, this._updateParameters()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "colorGradingBGR", { get: function() { return this._colorGradingBGR }, set: function(e) { this._colorGradingBGR !== e && (this._colorGradingBGR = e, this._updateParameters()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "exposure", { get: function() { return this._exposure }, set: function(e) { this._exposure !== e && (this._exposure = e, this._updateParameters()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "toneMappingEnabled", { get: function() { return this._toneMappingEnabled }, set: function(e) { this._toneMappingEnabled !== e && (this._toneMappingEnabled = e, this._updateParameters()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "toneMappingType", { get: function() { return this._toneMappingType }, set: function(e) { this._toneMappingType !== e && (this._toneMappingType = e, this._updateParameters()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "contrast", { get: function() { return this._contrast }, set: function(e) { this._contrast !== e && (this._contrast = e, this._updateParameters()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "vignetteBlendMode", { get: function() { return this._vignetteBlendMode }, set: function(e) { this._vignetteBlendMode !== e && (this._vignetteBlendMode = e, this._updateParameters()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "vignetteEnabled", { get: function() { return this._vignetteEnabled }, set: function(e) { this._vignetteEnabled !== e && (this._vignetteEnabled = e, this._updateParameters()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "applyByPostProcess", { get: function() { return this._applyByPostProcess }, set: function(e) { this._applyByPostProcess !== e && (this._applyByPostProcess = e, this._updateParameters()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "isEnabled", { get: function() { return this._isEnabled }, set: function(e) { this._isEnabled !== e && (this._isEnabled = e, this._updateParameters()) }, enumerable: !0, configurable: !0 }), 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 && l.a.PrepareUniforms(e) }, e.PrepareSamplers = function(e, t) { t.COLORGRADING && e.push("txColorTransform") }, e.prototype.prepareDefines = function(t, i) { if (void 0 === i && (i = !1), i !== this.applyByPostProcess || !this._isEnabled) return t.VIGNETTE = !1, t.TONEMAPPING = !1, t.TONEMAPPING_ACES = !1, t.CONTRAST = !1, t.EXPOSURE = !1, t.COLORCURVES = !1, t.COLORGRADING = !1, t.COLORGRADING3D = !1, t.IMAGEPROCESSING = !1, 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 = !0; break; default: t.TONEMAPPING_ACES = !1 } 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 = !1, 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 && l.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, a = Math.sqrt(o * r); o = s.h.Mix(o, a, this.vignetteStretch), r = s.h.Mix(r, a, 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 u = this.colorGradingTexture.getSize().height; e.setFloat4("colorTransformSettings", (u - 1) / u, .5 / u, u, 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 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "VIGNETTEMODE_OPAQUE", { get: function() { return this._VIGNETTEMODE_OPAQUE }, enumerable: !0, configurable: !0 }), 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, "_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, "_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, "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, "_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 s = e[o], a = typeof s; if ("function" !== a) try { if ("object" === a) if (s instanceof Array) { if (t[o] = [], s.length > 0) if ("object" == typeof s[0]) for (var c = 0; c < s.length; c++) { var l = n(s[c], t); - 1 === t[o].indexOf(l) && t[o].push(l) } else t[o] = s.slice(0) } else t[o] = n(s, t); else t[o] = s } catch (e) {} } }, e }() }, function(e, t, i) { "use strict"; var n = i(1), r = i(2), o = i(28), s = i(16), a = i(0), c = i(4), l = i(31), u = i(5), h = i(64), d = i(75), f = i(15), p = i(7), _ = i(22), g = i(18), m = "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"; u.a.IncludesShadersStore.defaultFragmentDeclaration = m; var v = "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"; u.a.IncludesShadersStore.defaultUboDeclaration = v; i(56), i(84), i(85), i(120), i(112); var y = "#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"; u.a.IncludesShadersStore.fresnelFunction = y; i(113), i(86), i(87), i(121), i(95), i(88), i(98), i(89), i(122), i(123), i(114), i(115), i(99); var b = "#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"; u.a.ShadersStore.defaultPixelShader = b; var T = "\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"; u.a.IncludesShadersStore.defaultVertexDeclaration = T; i(67), i(68), i(124), i(96), i(100), i(101), i(102), i(103), i(69), i(70), i(125), i(90), i(116), i(117); u.a.IncludesShadersStore.pointCloudVertex = "#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif"; i(118); var E = "#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"; u.a.ShadersStore.defaultVertexShader = E; var A = i(3); i.d(t, "b", function() { return x }), i.d(t, "a", function() { return R }); var x = function(e) { function t() { var t = e.call(this) || this; return t.MAINUV1 = !1, t.MAINUV2 = !1, t.DIFFUSE = !1, t.DIFFUSEDIRECTUV = 0, t.AMBIENT = !1, t.AMBIENTDIRECTUV = 0, t.OPACITY = !1, t.OPACITYDIRECTUV = 0, t.OPACITYRGB = !1, t.REFLECTION = !1, t.EMISSIVE = !1, t.EMISSIVEDIRECTUV = 0, t.SPECULAR = !1, t.SPECULARDIRECTUV = 0, t.BUMP = !1, t.BUMPDIRECTUV = 0, t.PARALLAX = !1, t.PARALLAXOCCLUSION = !1, t.SPECULAROVERALPHA = !1, t.CLIPPLANE = !1, t.CLIPPLANE2 = !1, t.CLIPPLANE3 = !1, t.CLIPPLANE4 = !1, t.ALPHATEST = !1, t.DEPTHPREPASS = !1, t.ALPHAFROMDIFFUSE = !1, t.POINTSIZE = !1, t.FOG = !1, t.SPECULARTERM = !1, t.DIFFUSEFRESNEL = !1, t.OPACITYFRESNEL = !1, t.REFLECTIONFRESNEL = !1, t.REFRACTIONFRESNEL = !1, t.EMISSIVEFRESNEL = !1, t.FRESNEL = !1, t.NORMAL = !1, t.UV1 = !1, t.UV2 = !1, t.VERTEXCOLOR = !1, t.VERTEXALPHA = !1, t.NUM_BONE_INFLUENCERS = 0, t.BonesPerMesh = 0, t.BONETEXTURE = !1, t.INSTANCES = !1, t.GLOSSINESS = !1, t.ROUGHNESS = !1, t.EMISSIVEASILLUMINATION = !1, t.LINKEMISSIVEWITHDIFFUSE = !1, t.REFLECTIONFRESNELFROMSPECULAR = !1, t.LIGHTMAP = !1, t.LIGHTMAPDIRECTUV = 0, t.OBJECTSPACE_NORMALMAP = !1, t.USELIGHTMAPASSHADOWMAP = !1, t.REFLECTIONMAP_3D = !1, t.REFLECTIONMAP_SPHERICAL = !1, t.REFLECTIONMAP_PLANAR = !1, t.REFLECTIONMAP_CUBIC = !1, t.USE_LOCAL_REFLECTIONMAP_CUBIC = !1, t.REFLECTIONMAP_PROJECTION = !1, t.REFLECTIONMAP_SKYBOX = !1, t.REFLECTIONMAP_SKYBOX_TRANSFORMED = !1, t.REFLECTIONMAP_EXPLICIT = !1, t.REFLECTIONMAP_EQUIRECTANGULAR = !1, t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = !1, t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = !1, t.INVERTCUBICMAP = !1, t.LOGARITHMICDEPTH = !1, t.REFRACTION = !1, t.REFRACTIONMAP_3D = !1, t.REFLECTIONOVERALPHA = !1, t.TWOSIDEDLIGHTING = !1, t.SHADOWFLOAT = !1, t.MORPHTARGETS = !1, t.MORPHTARGETS_NORMAL = !1, t.MORPHTARGETS_TANGENT = !1, t.NUM_MORPH_INFLUENCERS = 0, t.NONUNIFORMSCALING = !1, t.PREMULTIPLYALPHA = !1, t.IMAGEPROCESSING = !1, t.VIGNETTE = !1, t.VIGNETTEBLENDMODEMULTIPLY = !1, t.VIGNETTEBLENDMODEOPAQUE = !1, t.TONEMAPPING = !1, t.TONEMAPPING_ACES = !1, t.CONTRAST = !1, t.COLORCURVES = !1, t.COLORGRADING = !1, t.COLORGRADING3D = !1, t.SAMPLER3DGREENDEPTH = !1, t.SAMPLER3DBGRMAP = !1, t.IMAGEPROCESSINGPOSTPROCESS = !1, t.MULTIVIEW = !1, t.IS_REFLECTION_LINEAR = !1, t.IS_REFRACTION_LINEAR = !1, t.EXPOSURE = !1, 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), R = 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 a.e(0, 0, 0), r.diffuseColor = new a.e(1, 1, 1), r.specularColor = new a.e(1, 1, 1), r.emissiveColor = new a.e(0, 0, 0), r.specularPower = 64, r._useAlphaFromDiffuseTexture = !1, r._useEmissiveAsIllumination = !1, r._linkEmissiveWithDiffuse = !1, r._useSpecularOverAlpha = !1, r._useReflectionOverAlpha = !1, r._disableLighting = !1, r._useObjectSpaceNormalMap = !1, r._useParallax = !1, r._useParallaxOcclusion = !1, r.parallaxScaleBias = .05, r._roughness = 0, r.indexOfRefraction = .98, r.invertRefractionY = !0, r.alphaCutOff = .4, r._useLightmapAsShadowmap = !1, r._useReflectionFresnelFromSpecular = !1, r._useGlossinessFromSpecularMapAlpha = !1, r._maxSimultaneousLights = 4, r._invertNormalMapX = !1, r._invertNormalMapY = !1, r._twoSidedLighting = !1, r._renderTargets = new o.a(16), r._worldViewProjectionMatrix = a.j.Zero(), r._globalAmbientColor = new a.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() }, enumerable: !0, configurable: !0 }), 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 }, set: function(e) { this.imageProcessingConfiguration.colorCurvesEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorGradingEnabled", { get: function() { return this.imageProcessingConfiguration.colorGradingEnabled }, set: function(e) { this.imageProcessingConfiguration.colorGradingEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraToneMappingEnabled", { get: function() { return this._imageProcessingConfiguration.toneMappingEnabled }, set: function(e) { this._imageProcessingConfiguration.toneMappingEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraExposure", { get: function() { return this._imageProcessingConfiguration.exposure }, set: function(e) { this._imageProcessingConfiguration.exposure = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraContrast", { get: function() { return this._imageProcessingConfiguration.contrast }, set: function(e) { this._imageProcessingConfiguration.contrast = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorGradingTexture", { get: function() { return this._imageProcessingConfiguration.colorGradingTexture }, set: function(e) { this._imageProcessingConfiguration.colorGradingTexture = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorCurves", { get: function() { return this._imageProcessingConfiguration.colorCurves }, set: function(e) { this._imageProcessingConfiguration.colorCurves = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "hasRenderTargetTextures", { get: function() { return !!(t.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) || !!(t.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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 = !1), i.effect && this.isFrozen && this._wasPreviouslyReady) return !0; i._materialDefines || (i._materialDefines = new x); var r = this.getScene(), o = i._materialDefines; if (!this.checkReadyOnEveryCall && i.effect && o._renderId === r.getRenderId()) return !0; var s = r.getEngine(); if (o._needNormals = f.a.PrepareDefinesForLights(r, e, o, !0, this._maxSimultaneousLights, this._disableLighting), f.a.PrepareDefinesForMultiview(r, o), o._areTexturesDirty) { if (o._needUVs = !1, o.MAINUV1 = !1, o.MAINUV2 = !1, r.texturesEnabled) { if (this._diffuseTexture && t.DiffuseTextureEnabled) { if (!this._diffuseTexture.isReadyOrNotBlocking()) return !1; f.a.PrepareDefinesForMergedUV(this._diffuseTexture, o, "DIFFUSE") } else o.DIFFUSE = !1; if (this._ambientTexture && t.AmbientTextureEnabled) { if (!this._ambientTexture.isReadyOrNotBlocking()) return !1; f.a.PrepareDefinesForMergedUV(this._ambientTexture, o, "AMBIENT") } else o.AMBIENT = !1; if (this._opacityTexture && t.OpacityTextureEnabled) { if (!this._opacityTexture.isReadyOrNotBlocking()) return !1; f.a.PrepareDefinesForMergedUV(this._opacityTexture, o, "OPACITY"), o.OPACITYRGB = this._opacityTexture.getAlphaFromRGB } else o.OPACITY = !1; if (this._reflectionTexture && t.ReflectionTextureEnabled) { if (!this._reflectionTexture.isReadyOrNotBlocking()) return !1; switch (o._needNormals = !0, o.REFLECTION = !0, 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 = !1; if (this._emissiveTexture && t.EmissiveTextureEnabled) { if (!this._emissiveTexture.isReadyOrNotBlocking()) return !1; f.a.PrepareDefinesForMergedUV(this._emissiveTexture, o, "EMISSIVE") } else o.EMISSIVE = !1; if (this._lightmapTexture && t.LightmapTextureEnabled) { if (!this._lightmapTexture.isReadyOrNotBlocking()) return !1; f.a.PrepareDefinesForMergedUV(this._lightmapTexture, o, "LIGHTMAP"), o.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap } else o.LIGHTMAP = !1; if (this._specularTexture && t.SpecularTextureEnabled) { if (!this._specularTexture.isReadyOrNotBlocking()) return !1; f.a.PrepareDefinesForMergedUV(this._specularTexture, o, "SPECULAR"), o.GLOSSINESS = this._useGlossinessFromSpecularMapAlpha } else o.SPECULAR = !1; if (r.getEngine().getCaps().standardDerivatives && this._bumpTexture && t.BumpTextureEnabled) { if (!this._bumpTexture.isReady()) return !1; f.a.PrepareDefinesForMergedUV(this._bumpTexture, o, "BUMP"), o.PARALLAX = this._useParallax, o.PARALLAXOCCLUSION = this._useParallaxOcclusion, o.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap } else o.BUMP = !1; if (this._refractionTexture && t.RefractionTextureEnabled) { if (!this._refractionTexture.isReadyOrNotBlocking()) return !1; o._needUVs = !0, o.REFRACTION = !0, o.REFRACTIONMAP_3D = this._refractionTexture.isCube } else o.REFRACTION = !1; o.TWOSIDEDLIGHTING = !this._backFaceCulling && this._twoSidedLighting } else o.DIFFUSE = !1, o.AMBIENT = !1, o.OPACITY = !1, o.REFLECTION = !1, o.EMISSIVE = !1, o.LIGHTMAP = !1, o.BUMP = !1, o.REFRACTION = !1; o.ALPHAFROMDIFFUSE = this._shouldUseAlphaFromDiffuseTexture(), o.EMISSIVEASILLUMINATION = this._useEmissiveAsIllumination, o.LINKEMISSIVEWITHDIFFUSE = this._linkEmissiveWithDiffuse, o.SPECULAROVERALPHA = this._useSpecularOverAlpha, o.PREMULTIPLYALPHA = this.alphaMode === A.a.ALPHA_PREMULTIPLIED || this.alphaMode === A.a.ALPHA_PREMULTIPLIED_PORTERDUFF } if (o._areImageProcessingDirty && this._imageProcessingConfiguration) { if (!this._imageProcessingConfiguration.isReady()) return !1; 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 = !0, o.FRESNEL = !0) : o.FRESNEL = !1), f.a.PrepareDefinesForMisc(e, r, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(e), o), f.a.PrepareDefinesForAttributes(e, o, !0, !0, !0), f.a.PrepareDefinesForFrameBoundValues(r, s, o, n), o.isDirty) { o.markAsProcessed(); var a = new u.c; o.REFLECTION && a.addFallback(0, "REFLECTION"), o.SPECULAR && a.addFallback(0, "SPECULAR"), o.BUMP && a.addFallback(0, "BUMP"), o.PARALLAX && a.addFallback(1, "PARALLAX"), o.PARALLAXOCCLUSION && a.addFallback(0, "PARALLAXOCCLUSION"), o.SPECULAROVERALPHA && a.addFallback(0, "SPECULAROVERALPHA"), o.FOG && a.addFallback(1, "FOG"), o.POINTSIZE && a.addFallback(0, "POINTSIZE"), o.LOGARITHMICDEPTH && a.addFallback(0, "LOGARITHMICDEPTH"), f.a.HandleFallbacksForShadows(o, a, this._maxSimultaneousLights), o.SPECULARTERM && a.addFallback(0, "SPECULARTERM"), o.DIFFUSEFRESNEL && a.addFallback(1, "DIFFUSEFRESNEL"), o.OPACITYFRESNEL && a.addFallback(2, "OPACITYFRESNEL"), o.REFLECTIONFRESNEL && a.addFallback(3, "REFLECTIONFRESNEL"), o.EMISSIVEFRESNEL && a.addFallback(4, "EMISSIVEFRESNEL"), o.FRESNEL && a.addFallback(4, "FRESNEL"), o.MULTIVIEW && a.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), f.a.PrepareAttributesForBones(h, e, o, a), f.a.PrepareAttributesForInstances(h, o), f.a.PrepareAttributesForMorphTargets(h, e, o); var d = "default", _ = ["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"], m = ["Material", "Scene"]; l.a && (l.a.PrepareUniforms(_, o), l.a.PrepareSamplers(g, o)), f.a.PrepareUniformsAndSamplersList({ uniformsNames: _, uniformBuffersNames: m, samplers: g, defines: o, maxSimultaneousLights: this._maxSimultaneousLights }), this.customShaderNameResolve && (d = this.customShaderNameResolve(d, _, m, g, o)); var v = o.toString(), y = i.effect, b = r.getEngine().createEffect(d, { attributes: h, uniformsNames: _, uniformBuffersNames: m, samplers: g, defines: v, fallbacks: a, onCompiled: this.onCompiled, onError: this.onError, indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: o.NUM_MORPH_INFLUENCERS } }, s); b && (this.allowShaderHotSwapping && y && !b.isReady() ? (b = y, o.markAsUnprocessed()) : (r.resetCachedMaterial(), i.setEffect(b, o), this.buildUniformLayout())) } return !(!i.effect || !i.effect.isReady()) && (o._renderId = r.getRenderId(), this._wasPreviouslyReady = !0, !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), e.addUniform("reflectionRightColor", 4), e.addUniform("refractionLeftColor", 4), e.addUniform("refractionRightColor", 4), e.addUniform("emissiveLeftColor", 4), e.addUniform("emissiveRightColor", 4), e.addUniform("vDiffuseInfos", 2), e.addUniform("vAmbientInfos", 2), e.addUniform("vOpacityInfos", 2), e.addUniform("vReflectionInfos", 2), e.addUniform("vReflectionPosition", 3), e.addUniform("vReflectionSize", 3), e.addUniform("vEmissiveInfos", 2), e.addUniform("vLightmapInfos", 2), e.addUniform("vSpecularInfos", 2), e.addUniform("vBumpInfos", 3), e.addUniform("diffuseMatrix", 16), e.addUniform("ambientMatrix", 16), e.addUniform("opacityMatrix", 16), e.addUniform("reflectionMatrix", 16), e.addUniform("emissiveMatrix", 16), e.addUniform("lightmapMatrix", 16), e.addUniform("specularMatrix", 16), e.addUniform("bumpMatrix", 16), e.addUniform("vTangentSpaceParams", 2), e.addUniform("pointSize", 1), e.addUniform("refractionMatrix", 16), e.addUniform("vRefractionInfos", 4), e.addUniform("vSpecularColor", 4), e.addUniform("vEmissiveColor", 3), e.addUniform("visibility", 1), e.addUniform("vDiffuseColor", 4), e.create() }, t.prototype.unbind = function() { if (this._activeEffect) { var t = !1; this._reflectionTexture && this._reflectionTexture.isRenderTarget && (this._activeEffect.setTexture("reflection2DSampler", null), t = !0), this._refractionTexture && this._refractionTexture.isRenderTarget && (this._activeEffect.setTexture("refraction2DSampler", null), t = !0), 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 l = this._mustRebind(r, c, i.visibility); f.a.BindBonesParameters(i, c); var u = this._uniformBuffer; if (l) { if (u.bindToEffect(c, "Material"), this.bindViewProjection(c), !u.useUbo || !this.isFrozen || !u.isSync) { if (t.FresnelEnabled && o.FRESNEL && (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled && (u.updateColor4("diffuseLeftColor", this.diffuseFresnelParameters.leftColor, this.diffuseFresnelParameters.power), u.updateColor4("diffuseRightColor", this.diffuseFresnelParameters.rightColor, this.diffuseFresnelParameters.bias)), this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled && u.updateColor4("opacityParts", new a.e(this.opacityFresnelParameters.leftColor.toLuminance(), this.opacityFresnelParameters.rightColor.toLuminance(), this.opacityFresnelParameters.bias), this.opacityFresnelParameters.power), this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled && (u.updateColor4("reflectionLeftColor", this.reflectionFresnelParameters.leftColor, this.reflectionFresnelParameters.power), u.updateColor4("reflectionRightColor", this.reflectionFresnelParameters.rightColor, this.reflectionFresnelParameters.bias)), this.refractionFresnelParameters && this.refractionFresnelParameters.isEnabled && (u.updateColor4("refractionLeftColor", this.refractionFresnelParameters.leftColor, this.refractionFresnelParameters.power), u.updateColor4("refractionRightColor", this.refractionFresnelParameters.rightColor, this.refractionFresnelParameters.bias)), this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled && (u.updateColor4("emissiveLeftColor", this.emissiveFresnelParameters.leftColor, this.emissiveFresnelParameters.power), u.updateColor4("emissiveRightColor", this.emissiveFresnelParameters.rightColor, this.emissiveFresnelParameters.bias))), r.texturesEnabled) { if (this._diffuseTexture && t.DiffuseTextureEnabled && (u.updateFloat2("vDiffuseInfos", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level), f.a.BindTextureMatrix(this._diffuseTexture, u, "diffuse"), this._diffuseTexture.hasAlpha && c.setFloat("alphaCutOff", this.alphaCutOff)), this._ambientTexture && t.AmbientTextureEnabled && (u.updateFloat2("vAmbientInfos", this._ambientTexture.coordinatesIndex, this._ambientTexture.level), f.a.BindTextureMatrix(this._ambientTexture, u, "ambient")), this._opacityTexture && t.OpacityTextureEnabled && (u.updateFloat2("vOpacityInfos", this._opacityTexture.coordinatesIndex, this._opacityTexture.level), f.a.BindTextureMatrix(this._opacityTexture, u, "opacity")), this._reflectionTexture && t.ReflectionTextureEnabled && (u.updateFloat2("vReflectionInfos", this._reflectionTexture.level, this.roughness), u.updateMatrix("reflectionMatrix", this._reflectionTexture.getReflectionTextureMatrix()), this._reflectionTexture.boundingBoxSize)) { var h = this._reflectionTexture; u.updateVector3("vReflectionPosition", h.boundingBoxPosition), u.updateVector3("vReflectionSize", h.boundingBoxSize) } if (this._emissiveTexture && t.EmissiveTextureEnabled && (u.updateFloat2("vEmissiveInfos", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level), f.a.BindTextureMatrix(this._emissiveTexture, u, "emissive")), this._lightmapTexture && t.LightmapTextureEnabled && (u.updateFloat2("vLightmapInfos", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level), f.a.BindTextureMatrix(this._lightmapTexture, u, "lightmap")), this._specularTexture && t.SpecularTextureEnabled && (u.updateFloat2("vSpecularInfos", this._specularTexture.coordinatesIndex, this._specularTexture.level), f.a.BindTextureMatrix(this._specularTexture, u, "specular")), this._bumpTexture && r.getEngine().getCaps().standardDerivatives && t.BumpTextureEnabled && (u.updateFloat3("vBumpInfos", this._bumpTexture.coordinatesIndex, 1 / this._bumpTexture.level, this.parallaxScaleBias), f.a.BindTextureMatrix(this._bumpTexture, u, "bump"), r._mirroredCameraPosition ? u.updateFloat2("vTangentSpaceParams", this._invertNormalMapX ? 1 : -1, this._invertNormalMapY ? 1 : -1) : u.updateFloat2("vTangentSpaceParams", this._invertNormalMapX ? -1 : 1, this._invertNormalMapY ? -1 : 1)), this._refractionTexture && t.RefractionTextureEnabled) { var d = 1; this._refractionTexture.isCube || (u.updateMatrix("refractionMatrix", this._refractionTexture.getReflectionTextureMatrix()), this._refractionTexture.depth && (d = this._refractionTexture.depth)), u.updateFloat4("vRefractionInfos", this._refractionTexture.level, this.indexOfRefraction, d, this.invertRefractionY ? -1 : 1) } } this.pointsCloud && u.updateFloat("pointSize", this.pointSize), o.SPECULARTERM && u.updateColor4("vSpecularColor", this.specularColor, this.specularPower), u.updateColor3("vEmissiveColor", t.EmissiveTextureEnabled ? this.emissiveColor : a.e.BlackReadOnly), u.updateFloat("visibility", i.visibility), u.updateColor4("vDiffuseColor", this.diffuseColor, this.alpha) } if (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)) { d = 1; this._refractionTexture.isCube ? c.setTexture("refractionCubeSampler", this._refractionTexture) : c.setTexture("refraction2DSampler", this._refractionTexture) } f.a.BindClipPlane(c, r), r.ambientColor.multiplyToRef(this.ambientColor, this._globalAmbientColor), f.a.BindEyePosition(c, r), c.setColor3("vAmbientColor", this._globalAmbientColor) }!l && this.isFrozen || (r.lightsEnabled && !this._disableLighting && f.a.BindLights(r, i, c, o, this._maxSimultaneousLights), (r.fogEnabled && i.applyFog && r.fogMode !== s.a.FOGMODE_NONE || this._reflectionTexture || this._refractionTexture) && this.bindView(c), f.a.BindFogParameters(r, i, c), o.NUM_MORPH_INFLUENCERS && f.a.BindMorphTargetParameters(i, c), f.a.BindLogDepth(o, c, r), this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess && this._imageProcessingConfiguration.bind(this._activeEffect)), u.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), e }, 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._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), 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(), 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._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); 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) }, Object.defineProperty(t, "DiffuseTextureEnabled", { get: function() { return g.a.DiffuseTextureEnabled }, set: function(e) { g.a.DiffuseTextureEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "AmbientTextureEnabled", { get: function() { return g.a.AmbientTextureEnabled }, set: function(e) { g.a.AmbientTextureEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "OpacityTextureEnabled", { get: function() { return g.a.OpacityTextureEnabled }, set: function(e) { g.a.OpacityTextureEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "ReflectionTextureEnabled", { get: function() { return g.a.ReflectionTextureEnabled }, set: function(e) { g.a.ReflectionTextureEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "EmissiveTextureEnabled", { get: function() { return g.a.EmissiveTextureEnabled }, set: function(e) { g.a.EmissiveTextureEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "SpecularTextureEnabled", { get: function() { return g.a.SpecularTextureEnabled }, set: function(e) { g.a.SpecularTextureEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "BumpTextureEnabled", { get: function() { return g.a.BumpTextureEnabled }, set: function(e) { g.a.BumpTextureEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "LightmapTextureEnabled", { get: function() { return g.a.LightmapTextureEnabled }, set: function(e) { g.a.LightmapTextureEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "RefractionTextureEnabled", { get: function() { return g.a.RefractionTextureEnabled }, set: function(e) { g.a.RefractionTextureEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "ColorGradingTextureEnabled", { get: function() { return g.a.ColorGradingTextureEnabled }, set: function(e) { g.a.ColorGradingTextureEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "FresnelEnabled", { get: function() { return g.a.FresnelEnabled }, set: function(e) { g.a.FresnelEnabled = e }, enumerable: !0, configurable: !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)()], 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), t }(d.a); _.a.RegisteredTypes["BABYLON.StandardMaterial"] = R, s.a.DefaultMaterialFactory = function(e) { return new R("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 } 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, "d", function() { return s }), i.d(t, "c", function() { return a }), 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "physicsPlugin", { set: function(e) { this._physicsPlugin = e }, enumerable: !0, configurable: !0 }), 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) }, t }(r), s = 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), a = 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 }(s), 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 }(s) }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return l }); var n = i(1), r = i(2), o = i(0), s = i(25), a = i(63), c = i(22), l = 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 = !0, r._excludeWithLayerMask = 0, r._includeOnlyWithLayerMask = 0, r._lightmapMode = 0, r._excludedMeshesIds = new Array, r._includedOnlyMeshesIds = new Array, r._isLight = !0, r.getScene().addLight(r), r._uniformBuffer = new a.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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "intensityMode", { get: function() { return this._intensityMode }, set: function(e) { this._intensityMode = e, this._computePhotometricScale() }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "radius", { get: function() { return this._radius }, set: function(e) { this._radius = e, this._computePhotometricScale() }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "shadowEnabled", { get: function() { return this._shadowEnabled }, set: function(e) { this._shadowEnabled !== e && (this._shadowEnabled = e, this._markMeshesAsLightDirty()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "includedOnlyMeshes", { get: function() { return this._includedOnlyMeshes }, set: function(e) { this._includedOnlyMeshes = e, this._hookArrayForIncludedOnly(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "excludedMeshes", { get: function() { return this._excludedMeshes }, set: function(e) { this._excludedMeshes = e, this._hookArrayForExcluded(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "excludeWithLayerMask", { get: function() { return this._excludeWithLayerMask }, set: function(e) { this._excludeWithLayerMask = e, this._resyncMeshes() }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "includeOnlyWithLayerMask", { get: function() { return this._includeOnlyWithLayerMask }, set: function(e) { this._includeOnlyWithLayerMask = e, this._resyncMeshes() }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "lightmapMode", { get: function() { return this._lightmapMode }, set: function(e) { this._lightmapMode !== e && (this._lightmapMode = e, this._markMeshesAsLightDirty()) }, enumerable: !0, configurable: !0 }), 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 = !1), 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(), 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(), 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) })), r.a.AppendSerializedAnimations(this, e), e.ranges = this.serializeAnimationRanges(), e }, t.GetConstructorFromName = function(e, t, i) { var n = s.a.Construct("Light_Type_" + e, t, i); return n || 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 a = 0; a < e.animations.length; a++) { var l = e.animations[a], u = c.a.GetClass("BABYLON.Animation"); u && o.animations.push(u.Parse(l)) } s.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), s = 0, a = n; s < a.length; s++) { a[s]._resyncLighSource(t) } return o }; var n = e.splice; e.splice = function(i, r) { for (var o = n.apply(e, [i, r]), s = 0, a = o; s < a.length; s++) { a[s]._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) { case t.INTENSITYMODE_LUMINOUSPOWER: e = 1 / (4 * Math.PI); break; case t.INTENSITYMODE_LUMINOUSINTENSITY: e = 1; break; case t.INTENSITYMODE_LUMINANCE: e = this.radius * this.radius } break; case t.LIGHTTYPEID_DIRECTIONALLIGHT: switch (n) { case t.INTENSITYMODE_ILLUMINANCE: 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; case t.LIGHTTYPEID_HEMISPHERICLIGHT: e = 1 } return e }, t.prototype._reorderLightsInScene = function() { var e = this.getScene(); 0 != this._renderPriority && (e.requireLightSorting = !0), 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), n.c([Object(r.c)()], t.prototype, "intensity", void 0), 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), t }(s.a) }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return l }); var n = i(34), r = i(0), o = i(50), s = i(81), a = i(16), c = i(21), l = 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, s, a, c = e.TmpVector3[0].copyFromFloats(t.x - n, t.y - n, t.z - n), l = e.TmpVector3[1].copyFromFloats(i.x + n, i.y + n, i.z + n), u = 0, h = Number.MAX_VALUE; if (Math.abs(this.direction.x) < 1e-7) { if (this.origin.x < c.x || this.origin.x > l.x) return !1 } else if (r = 1 / this.direction.x, o = (c.x - this.origin.x) * r, (s = (l.x - this.origin.x) * r) === -1 / 0 && (s = 1 / 0), o > s && (a = o, o = s, s = a), (u = Math.max(o, u)) > (h = Math.min(s, h))) return !1; if (Math.abs(this.direction.y) < 1e-7) { if (this.origin.y < c.y || this.origin.y > l.y) return !1 } else if (r = 1 / this.direction.y, o = (c.y - this.origin.y) * r, (s = (l.y - this.origin.y) * r) === -1 / 0 && (s = 1 / 0), o > s && (a = o, o = s, s = a), (u = Math.max(o, u)) > (h = Math.min(s, h))) return !1; if (Math.abs(this.direction.z) < 1e-7) { if (this.origin.z < c.z || this.origin.z > l.z) return !1 } else if (r = 1 / this.direction.z, o = (c.z - this.origin.z) * r, (s = (l.z - this.origin.z) * r) === -1 / 0 && (s = 1 / 0), o > s && (a = o, o = s, s = a), (u = Math.max(o, u)) > (h = Math.min(s, h))) return !1; return !0 }, 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, s = e.radius + t, a = s * s; if (o <= a) return !0; var c = i * this.direction.x + n * this.direction.y + r * this.direction.z; return !(c < 0) && o - c * c <= a }, e.prototype.intersectsTriangle = function(t, i, n) { var o = e.TmpVector3[0], a = e.TmpVector3[1], c = e.TmpVector3[2], l = e.TmpVector3[3], u = e.TmpVector3[4]; i.subtractToRef(t, o), n.subtractToRef(t, a), r.x.CrossToRef(this.direction, a, c); var h = r.x.Dot(o, c); if (0 === h) return null; var d = 1 / h; this.origin.subtractToRef(t, l); var f = r.x.Dot(l, c) * d; if (f < 0 || f > 1) return null; r.x.CrossToRef(l, o, u); var p = r.x.Dot(this.direction, u) * d; if (p < 0 || f + p > 1) return null; var _ = r.x.Dot(a, u) * d; return _ > this.length ? null : new s.a(f, p, _) }, 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, s = r.t.Vector3[0], a = r.t.Vector3[1], c = r.t.Vector3[2], l = r.t.Vector3[3]; i.subtractToRef(t, s), this.direction.scaleToRef(e.rayl, c), o.addToRef(c, a), t.subtractToRef(o, l); var u, h, d, f, p = r.x.Dot(s, s), _ = r.x.Dot(s, c), g = r.x.Dot(c, c), m = r.x.Dot(s, l), v = r.x.Dot(c, l), y = p * g - _ * _, b = y, T = y; y < e.smallnum ? (h = 0, b = 1, f = v, T = g) : (f = p * v - _ * m, (h = _ * v - g * m) < 0 ? (h = 0, f = v, T = g) : h > b && (h = b, f = v + _, T = g)), f < 0 ? (f = 0, -m < 0 ? h = 0 : -m > p ? h = b : (h = -m, b = p)) : f > T && (f = T, -m + _ < 0 ? h = 0 : -m + _ > p ? h = b : (h = -m + _, b = p)), u = Math.abs(h) < e.smallnum ? 0 : h / b, d = Math.abs(f) < e.smallnum ? 0 : f / T; var E = r.t.Vector3[4]; c.scaleToRef(d, E); var A = r.t.Vector3[5]; s.scaleToRef(u, A), A.addInPlace(l); var x = r.t.Vector3[6]; return A.subtractToRef(E, x), d > 0 && d <= this.length && x.lengthSquared() < n * n ? A.length() : -1 }, e.prototype.update = function(e, t, i, n, r, o, s) { return this.unprojectRayToRef(e, t, i, n, r, o, s), this }, e.Zero = function() { return new e(r.x.Zero(), r.x.Zero()) }, e.CreateNew = function(t, i, n, r, o, s, a) { return e.Zero().update(t, i, n, r, o, s, a) }, e.CreateNewFromTo = function(t, i, n) { void 0 === n && (n = r.j.IdentityReadOnly); var o = i.subtract(t), s = Math.sqrt(o.x * o.x + o.y * o.y + o.z * o.z); return o.normalize(), e.Transform(new e(t, o, s), 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 s = 1 / o; n.x *= s, n.y *= s, n.z *= s, i.length *= o } }, e.prototype.unprojectRayToRef = function(e, t, i, n, o, s, a) { var c = r.t.Matrix[0]; o.multiplyToRef(s, c), c.multiplyToRef(a, c), c.invert(); var l = r.t.Vector3[0]; l.x = e / i * 2 - 1, l.y = -(t / n * 2 - 1), l.z = -1; var u = r.t.Vector3[1].copyFromFloats(l.x, l.y, 1), h = r.t.Vector3[2], d = r.t.Vector3[3]; r.x._UnprojectFromInvertedMatrixToRef(l, c, h), r.x._UnprojectFromInvertedMatrixToRef(u, c, d), this.origin.copyFrom(h), d.subtractToRef(h, this.direction), this.direction.normalize() }, e.TmpVector3 = n.a.BuildArray(6, r.x.Zero), e.smallnum = 1e-8, e.rayl = 1e9, e }(); a.a.prototype.createPickingRay = function(e, t, i, n, r) { void 0 === r && (r = !1); var o = l.Zero(); return this.createPickingRayToRef(e, t, i, o, n, r), o }, a.a.prototype.createPickingRayToRef = function(e, t, i, n, o, s) { void 0 === s && (s = !1); var a = this.getEngine(); if (!o) { if (!this.activeCamera) throw new Error("Active camera not set"); o = this.activeCamera } var c = o.viewport.toGlobal(a.getRenderWidth(), a.getRenderHeight()); return e = e / a.getHardwareScalingLevel() - c.x, t = t / a.getHardwareScalingLevel() - (a.getRenderHeight() - c.y - c.height), n.update(e, t, c.width, c.height, i || r.j.IdentityReadOnly, s ? r.j.IdentityReadOnly : o.getViewMatrix(), o.getProjectionMatrix()), this }, a.a.prototype.createPickingRayInCameraSpace = function(e, t, i) { var n = l.Zero(); return this.createPickingRayInCameraSpaceToRef(e, t, n, i), n }, a.a.prototype.createPickingRayInCameraSpaceToRef = function(e, t, i, n) { if (!o.a) return this; var s = this.getEngine(); if (!n) { if (!this.activeCamera) throw new Error("Active camera not set"); n = this.activeCamera } var a = n.viewport.toGlobal(s.getRenderWidth(), s.getRenderHeight()), c = r.j.Identity(); return e = e / s.getHardwareScalingLevel() - a.x, t = t / s.getHardwareScalingLevel() - (s.getRenderHeight() - a.y - a.height), i.update(e, t, a.width, a.height, c, c, n.getProjectionMatrix()), this }, a.a.prototype._internalPick = function(e, t, i, n) { if (!o.a) return null; for (var r = null, s = 0; s < this.meshes.length; s++) { var a = this.meshes[s]; if (t) { if (!t(a)) continue } else if (!a.isEnabled() || !a.isVisible || !a.isPickable) continue; var c = e(a.getWorldMatrix()), l = a.intersects(c, i, n); if (l && l.hit && ((i || null == r || !(l.distance >= r.distance)) && (r = l, i))) break } return r || new o.a }, a.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 s = this.meshes[r]; if (t) { if (!t(s)) continue } else if (!s.isEnabled() || !s.isVisible || !s.isPickable) continue; var a = e(s.getWorldMatrix()), c = s.intersects(a, !1, i); c && c.hit && n.push(c) } return n }, a.a.prototype.pick = function(e, t, i, n, s, a) { var c = this; if (!o.a) return null; var u = this._internalPick(function(i) { return c._tempPickingRay || (c._tempPickingRay = l.Zero()), c.createPickingRayToRef(e, t, i, c._tempPickingRay, s || null), c._tempPickingRay }, i, n, a); return u && (u.ray = this.createPickingRay(e, t, r.j.Identity(), s || null)), u }, a.a.prototype.pickWithRay = function(e, t, i, n) { var o = this, s = this._internalPick(function(t) { return o._pickWithRayInverseMatrix || (o._pickWithRayInverseMatrix = r.j.Identity()), t.invertToRef(o._pickWithRayInverseMatrix), o._cachedRayForTransform || (o._cachedRayForTransform = l.Zero()), l.TransformToRef(e, o._pickWithRayInverseMatrix, o._cachedRayForTransform), o._cachedRayForTransform }, t, i, n); return s && (s.ray = e), s }, a.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) }, a.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 = l.Zero()), l.TransformToRef(e, n._pickWithRayInverseMatrix, n._cachedRayForTransform), n._cachedRayForTransform }, 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), s = r.x.Normalize(o); return new l(i, s, e) } }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return c }); var n = i(0), r = i(11), o = i(13), s = i(72), a = i(4); o.a.CreateLineSystem = function(e) { for (var t = [], i = [], n = e.lines, r = e.colors, s = [], a = 0, c = 0; c < n.length; c++) for (var l = n[c], u = 0; u < l.length; u++) { if (i.push(l[u].x, l[u].y, l[u].z), r) { var h = r[c]; s.push(h[u].r, h[u].g, h[u].b, h[u].a) } u > 0 && (t.push(a - 1), t.push(a)), a++ } var d = new o.a; return d.indices = t, d.positions = i, r && (d.colors = s), d }, o.a.CreateDashedLines = function(e) { var t, i, r = e.dashSize || 3, s = e.gapSize || 1, a = e.dashNb || 200, c = e.points, l = new Array, u = new Array, h = n.x.Zero(), d = 0, f = 0, p = 0, _ = 0, g = 0; for (g = 0; g < c.length - 1; g++) c[g + 1].subtractToRef(c[g], h), d += h.length(); for (i = r * (t = d / a) / (r + s), g = 0; g < c.length - 1; g++) { c[g + 1].subtractToRef(c[g], h), f = Math.floor(h.length() / t), h.normalize(); for (var m = 0; m < f; m++) p = t * m, l.push(c[g].x + p * h.x, c[g].y + p * h.y, c[g].z + p * h.z), l.push(c[g].x + (p + i) * h.x, c[g].y + (p + i) * h.y, c[g].z + (p + i) * h.z), u.push(_, _ + 1), _ += 2 } var v = new o.a; return v.positions = l, v.indices = u, v }, r.a.CreateLines = function(e, t, i, n, r) { void 0 === i && (i = null), void 0 === n && (n = !1), 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, s, a) { void 0 === o && (o = null); var l = { points: t, dashSize: i, gapSize: n, dashNb: r, updatable: s, instance: a }; return c.CreateDashedLines(e, l, 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 l, u, h = n.getVerticesData(a.b.PositionKind); c && (l = n.getVerticesData(a.b.ColorKind)); for (var d = 0, f = 0, p = 0; p < r.length; p++) for (var _ = r[p], g = 0; g < _.length; g++) h[d] = _[g].x, h[d + 1] = _[g].y, h[d + 2] = _[g].z, c && l && (u = c[p], l[f] = u[g].r, l[f + 1] = u[g].g, l[f + 2] = u[g].b, l[f + 3] = u[g].a, f += 4), d += 3; return n.updateVerticesData(a.b.PositionKind, h, !1, !1), c && l && n.updateVerticesData(a.b.ColorKind, l, !1, !1), n } var m = !!c, v = new s.b(e, i, null, void 0, void 0, m, 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 a = t.points, c = t.instance, l = t.gapSize || 1, u = t.dashSize || 3; if (c) { return c.updateMeshPositions(function(e) { var t, i, r = n.x.Zero(), o = e.length / 6, s = 0, l = 0, u = 0, h = 0, d = 0, f = 0; for (d = 0; d < a.length - 1; d++) a[d + 1].subtractToRef(a[d], r), s += r.length(); t = s / o; var p = c._creationDataStorage.dashSize; for (i = p * t / (p + c._creationDataStorage.gapSize), d = 0; d < a.length - 1; d++) for (a[d + 1].subtractToRef(a[d], r), l = Math.floor(r.length() / t), r.normalize(), f = 0; f < l && h < e.length;) u = t * f, e[h] = a[d].x + u * r.x, e[h + 1] = a[d].y + u * r.y, e[h + 2] = a[d].z + u * r.z, e[h + 3] = a[d].x + (u + i) * r.x, e[h + 4] = a[d].y + (u + i) * r.y, e[h + 5] = a[d].z + (u + i) * r.z, h += 6, f++; for (; h < e.length;) e[h] = a[d].x, e[h + 1] = a[d].y, e[h + 2] = a[d].z, h += 3 }, !1), c } var h = new s.b(e, i); return o.a.CreateDashedLines(t).applyToMesh(h, t.updatable), h._creationDataStorage = new r.b, h._creationDataStorage.dashSize = u, h._creationDataStorage.gapSize = l, h }, e }() }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return l }); var n = i(16), r = i(8), o = i(17), s = i(23), a = i(65), c = i(0), l = function() { function e(e, t) { var i = this; void 0 === t && (t = !0), this.originalScene = e, this._pointerCaptures = {}, this._lastPointerEvents = {}, this._sharedGizmoLight = null, this.pickUtilitySceneFirst = !0, this.shouldRender = !0, this.onlyCheckPointerDownEvents = !0, this.processAllEvents = !1, this.onPointerOutObservable = new r.c, this.utilityLayerScene = new n.a(e.getEngine(), { virtual: !0 }), this.utilityLayerScene.useRightHandedSystem = e.useRightHandedSystem, this.utilityLayerScene._allowPostProcessClearColor = !1, 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] = !1; else { var s = t.ray ? i.utilityLayerScene.pickWithRay(t.ray) : i.utilityLayerScene.pick(e.pointerX, e.pointerY); if (!t.ray && s && (t.ray = s.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, s)), void(t.type === o.a.POINTERUP && i._pointerCaptures[r.pointerId] && (i._pointerCaptures[r.pointerId] = !1)); if (i.utilityLayerScene.autoClearDepthAndStencil || i.pickUtilitySceneFirst) s && s.hit && (t.skipOnPointerObservable || i.utilityLayerScene.onPointerObservable.notifyObservers(new o.b(t.type, t.event, s)), t.skipOnPointerObservable = !0); else { var a = t.ray ? e.pickWithRay(t.ray) : e.pick(e.pointerX, e.pointerY), c = t.event; a && s && (0 === s.distance && a.pickedMesh ? i.mainSceneTrackerPredicate && i.mainSceneTrackerPredicate(a.pickedMesh) ? (i._notifyObservers(t, a, c), t.skipOnPointerObservable = !0) : t.type === o.a.POINTERDOWN ? i._pointerCaptures[c.pointerId] = !0 : i._lastPointerEvents[c.pointerId] && (i.onPointerOutObservable.notifyObservers(c.pointerId), delete i._lastPointerEvents[c.pointerId]) : !i._pointerCaptures[c.pointerId] && (s.distance < a.distance || 0 === a.distance) ? (i._notifyObservers(t, s, c), t.skipOnPointerObservable || (t.skipOnPointerObservable = s.distance > 0)) : !i._pointerCaptures[c.pointerId] && s.distance > a.distance && (i.mainSceneTrackerPredicate && i.mainSceneTrackerPredicate(a.pickedMesh) ? (i._notifyObservers(t, a, c), t.skipOnPointerObservable = !0) : 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] = !1)) } } } }), this._originalPointerObserver && e.onPrePointerObservable.makeObserverTopPriority(this._originalPointerObserver)), this.utilityLayerScene.autoClear = !1, 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 a.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(s.a.LastCreatedScene), e._DefaultUtilityLayer.originalScene.onDisposeObservable.addOnce(function() { e._DefaultUtilityLayer = null })), e._DefaultUtilityLayer }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "DefaultKeepDepthUtilityLayer", { get: function() { return null == e._DefaultKeepDepthUtilityLayer && (e._DefaultKeepDepthUtilityLayer = new e(s.a.LastCreatedScene), e._DefaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil = !1, e._DefaultKeepDepthUtilityLayer.originalScene.onDisposeObservable.addOnce(function() { e._DefaultKeepDepthUtilityLayer = null })), e._DefaultKeepDepthUtilityLayer }, enumerable: !0, configurable: !0 }), 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] = !0) }, 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(!1), 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 a }); var n = i(1), r = i(2), o = i(8), s = i(0), a = function(e) { function t(i, n, r) { void 0 === n && (n = null), void 0 === r && (r = !0); var a = e.call(this, i, n) || this; return a._forward = new s.x(0, 0, 1), a._forwardInverted = new s.x(0, 0, -1), a._up = new s.x(0, 1, 0), a._right = new s.x(1, 0, 0), a._rightInverted = new s.x(-1, 0, 0), a._position = s.x.Zero(), a._rotation = s.x.Zero(), a._rotationQuaternion = null, a._scaling = s.x.One(), a._isDirty = !1, a._transformToBoneReferal = null, a._billboardMode = t.BILLBOARDMODE_NONE, a._preserveParentRotationForBillboard = !1, a.scalingDeterminant = 1, a._infiniteDistance = !1, a.ignoreNonUniformScaling = !1, a.reIntegrateRotationIntoRotationQuaternion = !1, a._poseMatrix = null, a._localMatrix = s.j.Zero(), a._usePivotMatrix = !1, a._absolutePosition = s.x.Zero(), a._pivotMatrix = s.j.Identity(), a._postMultiplyPivotMatrix = !1, a._isWorldMatrixFrozen = !1, a._indexInSceneTransformNodesArray = -1, a.onAfterWorldMatrixUpdateObservable = new o.c, a._nonUniformScaling = !1, r && a.getScene().addTransformNode(a), a } return n.d(t, e), Object.defineProperty(t.prototype, "billboardMode", { get: function() { return this._billboardMode }, set: function(e) { this._billboardMode !== e && (this._billboardMode = e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "preserveParentRotationForBillboard", { get: function() { return this._preserveParentRotationForBillboard }, set: function(e) { e !== this._preserveParentRotationForBillboard && (this._preserveParentRotationForBillboard = e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "infiniteDistance", { get: function() { return this._infiniteDistance }, set: function(e) { this._infiniteDistance !== e && (this._infiniteDistance = e) }, enumerable: !0, configurable: !0 }), t.prototype.getClassName = function() { return "TransformNode" }, Object.defineProperty(t.prototype, "position", { get: function() { return this._position }, set: function(e) { this._position = e, this._isDirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "rotation", { get: function() { return this._rotation }, set: function(e) { this._rotation = e, this._rotationQuaternion = null, this._isDirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "scaling", { get: function() { return this._scaling }, set: function(e) { this._scaling = e, this._isDirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "rotationQuaternion", { get: function() { return this._rotationQuaternion }, set: function(e) { this._rotationQuaternion = e, e && this._rotation.setAll(0), this._isDirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "forward", { get: function() { return s.x.Normalize(s.x.TransformNormal(this.getScene().useRightHandedSystem ? this._forwardInverted : this._forward, this.getWorldMatrix())) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "up", { get: function() { return s.x.Normalize(s.x.TransformNormal(this._up, this.getWorldMatrix())) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "right", { get: function() { return s.x.Normalize(s.x.TransformNormal(this.getScene().useRightHandedSystem ? this._rightInverted : this._right, this.getWorldMatrix())) }, enumerable: !0, configurable: !0 }), 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 = s.j.Identity()), this._poseMatrix }, t.prototype._isSynchronized = function() { var e = this._cache; if (this.billboardMode !== e.billboardMode || this.billboardMode !== t.BILLBOARDMODE_NONE) return !1; if (e.pivotMatrixUpdated) return !1; if (this.infiniteDistance) return !1; if (!e.position.equals(this._position)) return !1; if (this._rotationQuaternion) { if (!e.rotationQuaternion.equals(this._rotationQuaternion)) return !1 } else if (!e.rotation.equals(this._rotation)) return !1; return !!e.scaling.equals(this._scaling) }, t.prototype._initCache = function() { e.prototype._initCache.call(this); var t = this._cache; t.localMatrixUpdated = !1, t.position = s.x.Zero(), t.scaling = s.x.Zero(), t.rotation = s.x.Zero(), t.rotationQuaternion = new s.q(0, 0, 0, 0), t.billboardMode = -1, t.infiniteDistance = !1 }, t.prototype.markAsDirty = function(e) { return this._currentRenderId = Number.MAX_VALUE, this._isDirty = !0, this }, Object.defineProperty(t.prototype, "absolutePosition", { get: function() { return this._absolutePosition }, enumerable: !0, configurable: !0 }), t.prototype.setPreTransformMatrix = function(e) { return this.setPivotMatrix(e, !1) }, t.prototype.setPivotMatrix = function(e, t) { return void 0 === t && (t = !0), this._pivotMatrix.copyFrom(e), this._usePivotMatrix = !this._pivotMatrix.isIdentity(), this._cache.pivotMatrixUpdated = !0, this._postMultiplyPivotMatrix = t, this._postMultiplyPivotMatrix && (this._pivotMatrixInverse ? this._pivotMatrix.invertToRef(this._pivotMatrixInverse) : this._pivotMatrixInverse = s.j.Invert(this._pivotMatrix)), this }, t.prototype.getPivotMatrix = function() { return this._pivotMatrix }, t.prototype.freezeWorldMatrix = function() { return this._isWorldMatrixFrozen = !1, this.computeWorldMatrix(!0), this._isWorldMatrixFrozen = !0, this }, t.prototype.unfreezeWorldMatrix = function() { return this._isWorldMatrixFrozen = !1, this.computeWorldMatrix(!0), this }, Object.defineProperty(t.prototype, "isWorldMatrixFrozen", { get: function() { return this._isWorldMatrixFrozen }, enumerable: !0, configurable: !0 }), 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 = s.t.Matrix[0]; this.parent.getWorldMatrix().invertToRef(r), s.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 = s.x.TransformNormal(e, this._localMatrix), this }, t.prototype.getPositionExpressedInLocalSpace = function() { this.computeWorldMatrix(); var e = s.t.Matrix[0]; return this._localMatrix.invertToRef(e), s.x.TransformNormal(this.position, e) }, t.prototype.locallyTranslate = function(e) { return this.computeWorldMatrix(!0), this.position = s.x.TransformCoordinates(e, this._localMatrix), this }, 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 = s.s.LOCAL); var a = t._lookAtVectorCache, c = o === s.s.LOCAL ? this.position : this.getAbsolutePosition(); if (e.subtractToRef(c, a), this.setDirection(a, i, n, r), o === s.s.WORLD && this.parent) if (this.rotationQuaternion) { var l = s.t.Matrix[0]; this.rotationQuaternion.toRotationMatrix(l); var u = s.t.Matrix[1]; this.parent.getWorldMatrix().getRotationMatrixToRef(u), u.invert(), l.multiplyToRef(u, l), this.rotationQuaternion.fromRotationMatrix(l) } else { var h = s.t.Quaternion[0]; s.q.FromEulerVectorToRef(this.rotation, h); l = s.t.Matrix[0]; h.toRotationMatrix(l); u = s.t.Matrix[1]; this.parent.getWorldMatrix().getRotationMatrixToRef(u), u.invert(), l.multiplyToRef(u, l), h.fromRotationMatrix(l), h.toEulerAnglesToRef(this.rotation) } return this }, t.prototype.getDirection = function(e) { var t = s.x.Zero(); return this.getDirectionToRef(e, t), t }, t.prototype.getDirectionToRef = function(e, t) { return s.x.TransformNormalToRef(e, this.getWorldMatrix(), t), this }, 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), a = -Math.atan2(e.y, o); return this.rotationQuaternion ? s.q.RotationYawPitchRollToRef(r + t, a + i, n, this.rotationQuaternion) : (this.rotation.x = a + i, this.rotation.y = r + t, this.rotation.z = n), this }, t.prototype.setPivotPoint = function(e, t) { void 0 === t && (t = s.s.LOCAL), 0 == this.getScene().getRenderId() && this.computeWorldMatrix(!0); var i = this.getWorldMatrix(); if (t == s.s.WORLD) { var n = s.t.Matrix[0]; i.invertToRef(n), e = s.x.TransformCoordinates(e, n) } return this.setPivotMatrix(s.j.Translation(-e.x, -e.y, -e.z), !0) }, t.prototype.getPivotPoint = function() { var e = s.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 = s.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), s.x.TransformCoordinatesToRef(e, this.getWorldMatrix(), e), this }, t.prototype.setParent = function(e) { if (!e && !this.parent) return this; var t = s.t.Quaternion[0], i = s.t.Vector3[0], n = s.t.Vector3[1]; if (e) { var r = s.t.Matrix[0], o = s.t.Matrix[1]; this.computeWorldMatrix(!0), e.computeWorldMatrix(!0), e.getWorldMatrix().invertToRef(o), this.getWorldMatrix().multiplyToRef(o, r), r.decompose(n, t, i) } else this.parent && this.parent.computeWorldMatrix && this.parent.computeWorldMatrix(!0), this.computeWorldMatrix(!0), 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 }, Object.defineProperty(t.prototype, "nonUniformScaling", { get: function() { return this._nonUniformScaling }, enumerable: !0, configurable: !0 }), t.prototype._updateNonUniformScalingState = function(e) { return this._nonUniformScaling !== e && (this._nonUniformScaling = e, !0) }, 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 !== s.s.LOCAL) { if (this.parent) { var o = s.t.Matrix[0]; this.parent.getWorldMatrix().invertToRef(o), e = s.x.TransformNormal(e, o) }(r = s.q.RotationAxisToRef(e, i, t._rotationAxisCache)).multiplyToRef(this.rotationQuaternion, this.rotationQuaternion) } else r = s.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 = s.q.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z), this.rotation.setAll(0)); var n = s.t.Vector3[0], r = s.t.Vector3[1], o = s.t.Vector3[2], a = s.t.Quaternion[0], c = s.t.Matrix[0], l = s.t.Matrix[1], u = s.t.Matrix[2], h = s.t.Matrix[3]; return e.subtractToRef(this.position, n), s.j.TranslationToRef(n.x, n.y, n.z, c), s.j.TranslationToRef(-n.x, -n.y, -n.z, l), s.j.RotationAxisToRef(t, i, u), l.multiplyToRef(u, h), h.multiplyToRef(c, h), h.decompose(r, a, o), this.position.addInPlace(o), a.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion), this }, t.prototype.translate = function(e, t, i) { var n = e.scale(t); if (i && i !== s.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 = s.t.Quaternion[1], s.q.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, n)); var r = s.t.Quaternion[0]; return s.q.RotationYawPitchRollToRef(t, e, i, r), n.multiplyInPlace(r), 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 = !1, n.billboardMode = this.billboardMode, n.infiniteDistance = this.infiniteDistance, this._currentRenderId = i, this._childUpdateId++, this._isDirty = !1; var r = this._getEffectiveParent(), o = this._billboardMode !== t.BILLBOARDMODE_NONE && !this.preserveParentRotationForBillboard, a = this.getScene().activeCamera, c = n.scaling, l = n.position; if (this._infiniteDistance) if (!this.parent && a) { var u = a.getWorldMatrix(), h = new s.x(u.m[12], u.m[13], u.m[14]); l.copyFromFloats(this._position.x + h.x, this._position.y + h.y, this._position.z + h.z) } else l.copyFrom(this._position); else l.copyFrom(this._position); c.copyFromFloats(this._scaling.x * this.scalingDeterminant, this._scaling.y * this.scalingDeterminant, this._scaling.z * this.scalingDeterminant); var d = n.rotationQuaternion; if (this._rotationQuaternion) { if (this.reIntegrateRotationIntoRotationQuaternion) this.rotation.lengthSquared() && (this._rotationQuaternion.multiplyInPlace(s.q.RotationYawPitchRoll(this._rotation.y, this._rotation.x, this._rotation.z)), this._rotation.copyFromFloats(0, 0, 0)); d.copyFrom(this._rotationQuaternion) } else s.q.RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, d), n.rotation.copyFrom(this._rotation); if (this._usePivotMatrix) { var f = s.t.Matrix[1]; s.j.ScalingToRef(c.x, c.y, c.z, f); var p = s.t.Matrix[0]; d.toRotationMatrix(p), this._pivotMatrix.multiplyToRef(f, s.t.Matrix[4]), s.t.Matrix[4].multiplyToRef(p, this._localMatrix), this._postMultiplyPivotMatrix && this._localMatrix.multiplyToRef(this._pivotMatrixInverse, this._localMatrix), this._localMatrix.addTranslationFromFloats(l.x, l.y, l.z) } else s.j.ComposeToRef(c, d, l, this._localMatrix); if (r && r.getWorldMatrix) { if (o) { this._transformToBoneReferal ? r.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), s.t.Matrix[7]) : s.t.Matrix[7].copyFrom(r.getWorldMatrix()); var _ = s.t.Vector3[5], g = s.t.Vector3[6]; s.t.Matrix[7].decompose(g, void 0, _), s.j.ScalingToRef(g.x, g.y, g.z, s.t.Matrix[7]), s.t.Matrix[7].setTranslation(_), this._localMatrix.multiplyToRef(s.t.Matrix[7], this._worldMatrix) } else this._transformToBoneReferal ? (this._localMatrix.multiplyToRef(r.getWorldMatrix(), s.t.Matrix[6]), s.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 && a) { var m = s.t.Vector3[0]; if (this._worldMatrix.getTranslationToRef(m), s.t.Matrix[1].copyFrom(a.getViewMatrix()), s.t.Matrix[1].setTranslationFromFloats(0, 0, 0), s.t.Matrix[1].invertToRef(s.t.Matrix[0]), (this.billboardMode & t.BILLBOARDMODE_ALL) !== t.BILLBOARDMODE_ALL) { s.t.Matrix[0].decompose(void 0, s.t.Quaternion[0], void 0); var v = s.t.Vector3[1]; s.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), s.j.RotationYawPitchRollToRef(v.y, v.x, v.z, s.t.Matrix[0]) } this._worldMatrix.setTranslationFromFloats(0, 0, 0), this._worldMatrix.multiplyToRef(s.t.Matrix[0], this._worldMatrix), this._worldMatrix.setTranslation(s.t.Vector3[0]) } return this.ignoreNonUniformScaling ? this._updateNonUniformScalingState(!1) : this._scaling.isNonUniform ? this._updateNonUniformScalingState(!0) : r && r._nonUniformScaling ? this._updateNonUniformScalingState(r._nonUniformScaling) : this._updateNonUniformScalingState(!1), 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 = s.j.Invert(this._worldMatrix)), this._worldMatrixDeterminantIsDirty = !0, this._worldMatrix }, 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.getPositionInCameraSpace = function(e) { return void 0 === e && (e = null), e || (e = this.getScene().activeCamera), s.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, s = r.a.Clone(function() { return new t(e, o.getScene()) }, this); if (s.name = e, s.id = e, i && (s.parent = i), !n) for (var a = this.getDescendants(!0), c = 0; c < a.length; c++) { var l = a[c]; l.clone && l.clone(e + "." + l.name, s) } return s }, 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(), 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(s.j.FromArray(e.localMatrix)) : e.pivotMatrix && o.setPivotMatrix(s.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 }), n }, t.prototype.dispose = function(t, i) { if (void 0 === i && (i = !1), this.getScene().stopAnimation(this), this.getScene().removeTransformNode(this), this.onAfterWorldMatrixUpdateObservable.clear(), t) for (var n = 0, r = this.getChildTransformNodes(!0); n < r.length; n++) { var o = r[n]; o.parent = null, o.computeWorldMatrix(!0) } 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 s.x(0, 0, 0), t._rotationAxisCache = new s.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 d }); var n = i(34), r = i(0), o = i(3), s = i(77), a = i(82), c = { min: 0, max: 0 }, l = { min: 0, max: 0 }, u = 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 u(e, t, c), u(e, i, l), !(c.min > l.max || l.min > c.max) }, d = function() { function e(e, t, i) { this._isLocked = !1, this.boundingBox = new s.a(e, t, i), this.boundingSphere = new a.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "maximum", { get: function() { return this.boundingBox.maximum }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "isLocked", { get: function() { return this._isLocked }, set: function(e) { this._isLocked = e }, enumerable: !0, configurable: !0 }), 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), 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: !0, configurable: !0 }), 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 (!a.a.Intersects(this.boundingSphere, e.boundingSphere)) return !1; if (!s.a.Intersects(this.boundingBox, e.boundingBox)) return !1; if (!t) return !0; 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), s = i(9), a = i(71), c = i(0), l = i(23), u = i(3), h = function() { function e(t) { this.metadata = null, this.reservedDataStore = null, this._hasAlpha = !1, this.getAlphaFromRGB = !1, this.level = 1, this.coordinatesIndex = 0, this._coordinatesMode = u.a.TEXTURE_EXPLICIT_MODE, this.wrapU = u.a.TEXTURE_WRAP_ADDRESSMODE, this.wrapV = u.a.TEXTURE_WRAP_ADDRESSMODE, this.wrapR = u.a.TEXTURE_WRAP_ADDRESSMODE, this.anisotropicFilteringLevel = e.DEFAULT_ANISOTROPIC_FILTERING_LEVEL, this.gammaSpace = !0, this.invertZ = !1, this.lodLevelInAlpha = !1, this.isRenderTarget = !1, this.animations = new Array, this.onDisposeObservable = new o.c, this._onDisposeObserver = null, this.delayLoadState = u.a.DELAYLOADSTATE_NONE, this._scene = null, this._texture = null, this._uid = null, this._cachedSize = c.r.Zero(), this._scene = t || l.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(u.a.MATERIAL_TextureDirtyFlag | u.a.MATERIAL_MiscDirtyFlag)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "coordinatesMode", { get: function() { return this._coordinatesMode }, set: function(e) { this._coordinatesMode !== e && (this._coordinatesMode = e, this._scene && this._scene.markAllMaterialsAsDirty(u.a.MATERIAL_TextureDirtyFlag)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "isCube", { get: function() { return !!this._texture && this._texture.isCube }, set: function(e) { this._texture && (this._texture.isCube = e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "is3D", { get: function() { return !!this._texture && this._texture.is3D }, set: function(e) { this._texture && (this._texture.is3D = e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "isRGBD", { get: function() { return null != this._texture && this._texture._isRGBD }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "noMipmap", { get: function() { return !1 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "lodGenerationOffset", { get: function() { return this._texture ? this._texture._lodGenerationOffset : 0 }, set: function(e) { this._texture && (this._texture._lodGenerationOffset = e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "lodGenerationScale", { get: function() { return this._texture ? this._texture._lodGenerationScale : 0 }, set: function(e) { this._texture && (this._texture._lodGenerationScale = e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "uid", { get: function() { return this._uid || (this._uid = s.h.RandomId()), this._uid }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "isBlocking", { get: function() { return !0 }, enumerable: !0, configurable: !0 }), 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 === u.a.DELAYLOADSTATE_NOTLOADED ? (this.delayLoad(), !1) : !!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 !1 }, enumerable: !0, configurable: !0 }), 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 s = r[o]; if (!(void 0 !== n && n !== s.invertY || s.url !== e || s.generateMipMaps !== !t || i && i !== s.samplingMode)) return s.incrementReferences(), s } 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 : u.a.TEXTURETYPE_UNSIGNED_INT }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "textureFormat", { get: function() { return this._texture && void 0 !== this._texture.format ? this._texture.format : u.a.TEXTUREFORMAT_RGBA }, enumerable: !0, configurable: !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, s = this.getScene(); if (!s) return null; var a = s.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 ? a._readTexturePixels(this._texture, r, o, e, t, i) : a._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 && a.a && this.isReady() ? (this._texture._sphericalPolynomial || (this._texture._sphericalPolynomial = a.a.ConvertCubeMapTextureToSphericalPolynomial(this)), this._texture._sphericalPolynomial) : null }, set: function(e) { this._texture && (this._texture._sphericalPolynomial = e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "_lodTextureHigh", { get: function() { return this._texture ? this._texture._lodTextureHigh : null }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "_lodTextureMid", { get: function() { return this._texture ? this._texture._lodTextureMid : null }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "_lodTextureLow", { get: function() { return this._texture ? this._texture._lodTextureLow : null }, enumerable: !0, configurable: !0 }), 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[s]).isReady()) 0 == --i && t(); else { r = n.onLoadObservable; var o = function() { r.removeCallback(o), 0 == --i && t() }; r.add(o) } }, s = 0; s < e.length; s++) 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)()], 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, "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, "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, "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), 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, e }() }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return s }); 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, s = e.diameterZ || e.diameter || 1, a = e.arc && (e.arc <= 0 || e.arc > 1) ? 1 : e.arc || 1, c = e.slice && e.slice <= 0 ? 1 : e.slice || 1, l = 0 === e.sideOrientation ? 0 : e.sideOrientation || o.a.DEFAULTSIDE, u = new n.x(i / 2, r / 2, s / 2), h = 2 + t, d = 2 * h, f = [], p = [], _ = [], g = [], m = 0; m <= h; m++) { for (var v = m / h, y = v * Math.PI * c, b = 0; b <= d; b++) { var T = b / d, E = T * Math.PI * 2 * a, A = n.j.RotationZ(-y), x = n.j.RotationY(E), R = n.x.TransformCoordinates(n.x.Up(), A), P = n.x.TransformCoordinates(R, x), S = P.multiply(u), C = P.divide(u).normalize(); p.push(S.x, S.y, S.z), _.push(C.x, C.y, C.z), g.push(T, v) } if (m > 0) for (var M = p.length / 3, O = M - 2 * (d + 1); O + d + 2 < M; O++) f.push(O), f.push(O + 1), f.push(O + d + 1), f.push(O + d + 1), f.push(O + 1), f.push(O + d + 2) } o.a._ComputeSides(l, p, f, _, g, e.frontUVs, e.backUVs); var I = new o.a; return I.indices = f, I.positions = p, I.normals = _, I.uvs = g, I }, r.a.CreateSphere = function(e, t, i, n, r, o) { var a = { segments: t, diameterX: i, diameterY: i, diameterZ: i, sideOrientation: o, updatable: r }; return s.CreateSphere(e, a, n) }; var s = 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: !0, configurable: !0 }), e }() }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return s }); var n = i(0), r = i(11), o = i(41), s = 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 = !1, this.updateGizmoRotationToMatchAttachedMesh = !0, this.updateGizmoPositionToMatchAttachedMesh = !0, this._updateScale = !0, this._interactionsEnabled = !0, 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: !0, configurable: !0 }), 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 = !0 }, 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 l }), i.d(t, "b", function() { return u }); var n = i(1), r = i(9), o = i(4), s = i(81), a = i(43), c = i(3), l = function() { function e() { this._materialDefines = null, this._materialEffect = null } return Object.defineProperty(e.prototype, "effect", { get: function() { return this._materialEffect }, enumerable: !0, configurable: !0 }), 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 }(), u = function(e) { function t(t, i, n, r, o, s, a, c) { void 0 === c && (c = !0); var l = e.call(this) || this; return l.materialIndex = t, l.verticesStart = i, l.verticesCount = n, l.indexStart = r, l.indexCount = o, l._linesIndexCount = 0, l._linesIndexBuffer = null, l._lastColliderWorldVertices = null, l._lastColliderTransformMatrix = null, l._renderId = 0, l._alphaIndex = 0, l._distanceToCamera = 0, l._currentMaterial = null, l._mesh = s, l._renderingMesh = a || s, s.subMeshes.push(l), l._trianglePlanes = [], l._id = s.subMeshes.length - 1, c && (l.refreshBoundingInfo(), s.computeWorldMatrix(!0)), l } return n.d(t, e), t.AddToMesh = function(e, i, n, r, o, s, a, c) { return void 0 === c && (c = !0), new t(e, i, n, r, o, s, a, c) }, Object.defineProperty(t.prototype, "IsGlobal", { get: function() { return 0 === this.verticesStart && this.verticesCount === this._mesh.getTotalVertices() }, enumerable: !0, configurable: !0 }), 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 a.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.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) { 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, a = this.indexStart; a < this.indexStart + this.indexCount; a += 2) { var c = t[i[a]], l = t[i[a + 1]], u = e.intersectionSegment(c, l, n); if (!(u < 0) && ((r || !o || u < o.distance) && ((o = new s.a(null, null, u)).faceId = a / 2, r))) break } return o }, t.prototype._intersectUnIndexedLines = function(e, t, i, n, r) { for (var o = null, a = this.verticesStart; a < this.verticesStart + this.verticesCount; a += 2) { var c = t[a], l = t[a + 1], u = e.intersectionSegment(c, l, n); if (!(u < 0) && ((r || !o || u < o.distance) && ((o = new s.a(null, null, u)).faceId = a / 2, r))) break } return o }, t.prototype._intersectTriangles = function(e, t, i, n, r) { for (var o = null, s = this.indexStart; s < this.indexStart + this.indexCount; s += 3) { var a = t[i[s]], c = t[i[s + 1]], l = t[i[s + 2]]; if (!r || r(a, c, l, e)) { var u = e.intersectsTriangle(a, c, l); if (u) { if (u.distance < 0) continue; if ((n || !o || u.distance < o.distance) && ((o = u).faceId = s / 3, n)) break } } } return o }, t.prototype._intersectUnIndexedTriangles = function(e, t, i, n, r) { for (var o = null, s = this.verticesStart; s < this.verticesStart + this.verticesCount; s += 3) { var a = t[s], c = t[s + 1], l = t[s + 2]; if (!r || r(a, c, l, e)) { var u = e.intersectsTriangle(a, c, l); if (u) { if (u.distance < 0) continue; if ((n || !o || u.distance < o.distance) && ((o = u).faceId = s / 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, !1); if (!this.IsGlobal) { var r = this.getBoundingInfo(); if (!r) return n; n._boundingInfo = new a.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 s = Number.MAX_VALUE, a = -Number.MAX_VALUE, c = (o || r).getIndices(), l = i; l < i + n; l++) { var u = c[l]; u < s && (s = u), u > a && (a = u) } return new t(e, s, a - s + 1, i, n, r, o) }, t }(l) }, 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 = !1, this.hit = !1, 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 = !1), void 0 === t && (t = !0), !this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(r.b.NormalKind)) return null; var i, o = this.pickedMesh.getIndices(); if (!o) return null; if (t) { var s = this.pickedMesh.getVerticesData(r.b.NormalKind), a = n.x.FromArray(s, 3 * o[3 * this.faceId]), c = n.x.FromArray(s, 3 * o[3 * this.faceId + 1]), l = n.x.FromArray(s, 3 * o[3 * this.faceId + 2]); a = a.scale(this.bu), c = c.scale(this.bv), l = l.scale(1 - this.bu - this.bv), i = new n.x(a.x + c.x + l.x, a.y + c.y + l.y, a.z + c.z + l.z) } else { var u = this.pickedMesh.getVerticesData(r.b.PositionKind), h = n.x.FromArray(u, 3 * o[3 * this.faceId]), d = n.x.FromArray(u, 3 * o[3 * this.faceId + 1]), f = n.x.FromArray(u, 3 * o[3 * this.faceId + 2]), p = h.subtract(d), _ = f.subtract(d); i = n.x.Cross(p, _) } 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]), s = n.w.FromArray(t, 2 * e[3 * this.faceId + 2]); return i = i.scale(1 - this.bu - this.bv), o = o.scale(this.bu), s = s.scale(this.bv), new n.w(i.x + o.x + s.x, i.y + o.y + s.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 s }); var n = i(1), r = function() { function e() {} return e.KEYDOWN = 1, e.KEYUP = 2, e }(), o = function() { return function(e, t) { this.type = e, this.event = t } }(), s = function(e) { function t(t, i) { var n = e.call(this, t, i) || this; return n.type = t, n.event = i, n.skipOnPointerObservable = !1, n } return n.d(t, e), t }(o) }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return s }); 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], s = [], a = e.width || e.size || 1, c = e.height || e.size || 1, l = e.depth || e.size || 1, u = e.wrap || !1, h = void 0 === e.topBaseAt ? 1 : e.topBaseAt, d = void 0 === e.bottomBaseAt ? 0 : e.bottomBaseAt, f = [2, 0, 3, 1][h = (h + 4) % 4], p = [2, 0, 1, 3][d = (d + 4) % 4], _ = [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 (u) { 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], _ = [-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] ], m = [ [-1, -1, 1], [1, -1, 1], [1, -1, -1], [-1, -1, -1] ], v = [17, 18, 19, 16], y = [22, 23, 20, 21]; f > 0;) g.unshift(g.pop()), v.unshift(v.pop()), f--; for (; p > 0;) m.unshift(m.pop()), y.unshift(y.pop()), p--; g = g.flat(), m = m.flat(), _ = _.concat(g).concat(m), 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 = [a / 2, c / 2, l / 2]; t = _.reduce(function(e, t, i) { return e.concat(t * b[i % 3]) }, []); for (var T = 0 === e.sideOrientation ? 0 : e.sideOrientation || o.a.DEFAULTSIDE, E = e.faceUV || new Array(6), A = e.faceColors, x = [], R = 0; R < 6; R++) void 0 === E[R] && (E[R] = new n.y(0, 0, 1, 1)), A && void 0 === A[R] && (A[R] = new n.f(1, 1, 1, 1)); for (var P = 0; P < 6; P++) if (s.push(E[P].z, E[P].w), s.push(E[P].x, E[P].w), s.push(E[P].x, E[P].y), s.push(E[P].z, E[P].y), A) for (var S = 0; S < 4; S++) x.push(A[P].r, A[P].g, A[P].b, A[P].a); o.a._ComputeSides(T, t, i, r, s, e.frontUVs, e.backUVs); var C = new o.a; if (C.indices = i, C.positions = t, C.normals = r, C.uvs = s, A) { var M = T === o.a.DOUBLESIDE ? x.concat(x) : x; C.colors = M } return C }, r.a.CreateBox = function(e, t, i, n, r) { void 0 === i && (i = null); var o = { size: t, sideOrientation: r, updatable: n }; return s.CreateBox(e, o, i) }; var s = 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, i) { "use strict"; i.d(t, "a", function() { return a }); var n = i(0), r = i(11), o = i(13), s = i(16); o.a.CreateCylinder = function(e) { var t, i = e.height || 2, r = 0 === e.diameterTop ? 0 : e.diameterTop || e.diameter || 1, s = 0 === e.diameterBottom ? 0 : e.diameterBottom || e.diameter || 1, a = e.tessellation || 24, c = e.subdivisions || 1, l = !!e.hasRings, u = !!e.enclose, h = e.arc && (e.arc <= 0 || e.arc > 1) ? 1 : e.arc || 1, d = 0 === e.sideOrientation ? 0 : e.sideOrientation || o.a.DEFAULTSIDE, f = e.faceUV || new Array(3), p = e.faceColors, _ = 2 + (1 + (1 !== h && u ? 2 : 0)) * (l ? c : 1); for (t = 0; t < _; t++) p && void 0 === p[t] && (p[t] = new n.f(1, 1, 1, 1)); for (t = 0; t < _; t++) f && void 0 === f[t] && (f[t] = new n.y(0, 0, 1, 1)); var g, m, v, y, b, T, E = new Array, A = new Array, x = new Array, R = new Array, P = new Array, S = 2 * Math.PI * h / a, C = (s - r) / 2 / i, M = n.x.Zero(), O = n.x.Zero(), I = n.x.Zero(), D = n.x.Zero(), L = n.x.Zero(), w = n.c.Y, F = 1, N = 1, B = 0, U = 0; for (y = 0; y <= c; y++) for (v = ((m = y / c) * (r - s) + s) / 2, F = l && 0 !== y && y !== c ? 2 : 1, T = 0; T < F; T++) { for (l && (N += T), u && (N += 2 * T), b = 0; b <= a; b++) g = b * S, M.x = Math.cos(-g) * v, M.y = -i / 2 + m * i, M.z = Math.sin(-g) * v, 0 === r && y === c ? (O.x = x[x.length - 3 * (a + 1)], O.y = x[x.length - 3 * (a + 1) + 1], O.z = x[x.length - 3 * (a + 1) + 2]) : (O.x = M.x, O.z = M.z, O.y = Math.sqrt(O.x * O.x + O.z * O.z) * C, O.normalize()), 0 === b && (I.copyFrom(M), D.copyFrom(O)), A.push(M.x, M.y, M.z), x.push(O.x, O.y, O.z), U = l ? B !== N ? f[N].y : f[N].w : f[N].y + (f[N].w - f[N].y) * m, R.push(f[N].x + (f[N].z - f[N].x) * b / a, U), p && P.push(p[N].r, p[N].g, p[N].b, p[N].a); 1 !== h && u && (A.push(M.x, M.y, M.z), A.push(0, M.y, 0), A.push(0, M.y, 0), A.push(I.x, I.y, I.z), n.x.CrossToRef(w, O, L), L.normalize(), x.push(L.x, L.y, L.z, L.x, L.y, L.z), n.x.CrossToRef(D, w, L), L.normalize(), x.push(L.x, L.y, L.z, L.x, L.y, L.z), U = l ? B !== N ? f[N + 1].y : f[N + 1].w : f[N + 1].y + (f[N + 1].w - f[N + 1].y) * m, R.push(f[N + 1].x, U), R.push(f[N + 1].z, U), U = l ? B !== N ? f[N + 2].y : f[N + 2].w : f[N + 2].y + (f[N + 2].w - f[N + 2].y) * m, R.push(f[N + 2].x, U), R.push(f[N + 2].z, U), p && (P.push(p[N + 1].r, p[N + 1].g, p[N + 1].b, p[N + 1].a), P.push(p[N + 1].r, p[N + 1].g, p[N + 1].b, p[N + 1].a), P.push(p[N + 2].r, p[N + 2].g, p[N + 2].b, p[N + 2].a), P.push(p[N + 2].r, p[N + 2].g, p[N + 2].b, p[N + 2].a))), B !== N && (B = N) } var V = 1 !== h && u ? a + 4 : a; for (y = 0, N = 0; N < c; N++) { var G = 0, k = 0, z = 0, j = 0; for (b = 0; b < a; b++) G = y * (V + 1) + b, k = (y + 1) * (V + 1) + b, z = y * (V + 1) + (b + 1), j = (y + 1) * (V + 1) + (b + 1), E.push(G, k, z), E.push(j, z, k); 1 !== h && u && (E.push(G + 2, k + 2, z + 2), E.push(j + 2, z + 2, k + 2), E.push(G + 4, k + 4, z + 4), E.push(j + 4, z + 4, k + 4)), y = l ? y + 2 : y + 1 } var H = function(e) { var t = e ? r / 2 : s / 2; if (0 !== t) { var o, c, l, u = e ? f[_ - 1] : f[0], d = null; p && (d = e ? p[_ - 1] : p[0]); var g = A.length / 3, m = e ? i / 2 : -i / 2, v = new n.x(0, m, 0); A.push(v.x, v.y, v.z), x.push(0, e ? 1 : -1, 0), R.push(u.x + .5 * (u.z - u.x), u.y + .5 * (u.w - u.y)), d && P.push(d.r, d.g, d.b, d.a); var y = new n.w(.5, .5); for (l = 0; l <= a; l++) { o = 2 * Math.PI * l * h / a; var b = Math.cos(-o), T = Math.sin(-o); c = new n.x(b * t, m, T * t); var S = new n.w(b * y.x + .5, T * y.y + .5); A.push(c.x, c.y, c.z), x.push(0, e ? 1 : -1, 0), R.push(u.x + (u.z - u.x) * S.x, u.y + (u.w - u.y) * S.y), d && P.push(d.r, d.g, d.b, d.a) } for (l = 0; l < a; l++) e ? (E.push(g), E.push(g + (l + 2)), E.push(g + (l + 1))) : (E.push(g), E.push(g + (l + 1)), E.push(g + (l + 2))) } }; H(!1), H(!0), o.a._ComputeSides(d, A, E, x, R, e.frontUVs, e.backUVs); var W = new o.a; return W.indices = E, W.positions = A, W.normals = x, W.uvs = R, p && (W.colors = P), W }, r.a.CreateCylinder = function(e, t, i, n, o, c, l, u, h) { void 0 !== l && l instanceof s.a || (void 0 !== l && (h = u || r.a.DEFAULTSIDE, u = l), l = c, c = 1); var d = { height: t, diameterTop: i, diameterBottom: n, tessellation: o, subdivisions: c, sideOrientation: h, updatable: u }; return a.CreateCylinder(e, d, l) }; var a = 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, i) { "use strict"; i.d(t, "a", function() { return u }); var n = i(11), r = i(16), o = i(8), s = i(0), a = i(17), c = i(39), l = i(45), u = (i(80), function() { function e(e) { this._useAlternatePickedPointAboveMaxDragAngleDragSpeed = -1.1, this.maxDragAngle = 0, this._useAlternatePickedPointAboveMaxDragAngle = !1, this.currentDraggingPointerID = -1, this.dragging = !1, this.dragDeltaRatio = .2, this.updateDragPlane = !0, this._debugMode = !1, this._moving = !1, this.onDragObservable = new o.c, this.onDragStartObservable = new o.c, this.onDragEndObservable = new o.c, this.moveAttached = !0, this.enabled = !0, this.detachCameraControls = !0, this.useObjectOrienationForDragging = !0, this.validateDrag = function(e) { return !0 }, this._tmpVector = new s.x(0, 0, 0), this._alternatePickedPoint = new s.x(0, 0, 0), this._worldDragAxis = new s.x(0, 0, 0), this._targetPosition = new s.x(0, 0, 0), this._attachedElement = null, this._startDragRay = new c.a(new s.x, new s.x), this._lastPointerRay = {}, this._dragDelta = new s.x, this._pointA = new s.x(0, 0, 0), this._pointB = new s.x(0, 0, 0), this._pointC = new s.x(0, 0, 0), this._lineA = new s.x(0, 0, 0), this._lineB = new s.x(0, 0, 0), this._localAxis = new s.x(0, 0, 0), this._lookAt = new s.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: !0, configurable: !0 }), 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 r.a(this._scene.getEngine(), { virtual: !0 }), 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, !1, n.a.DOUBLESIDE), this.lastDragPosition = new s.x(0, 0, 0); this._pointerObserver = this._scene.onPointerObservable.add(function(t, n) { var r; if (i.enabled) if (t.type == a.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 == a.a.POINTERUP) i.currentDraggingPointerID == t.event.pointerId && i.releaseDrag(); else if (t.type == a.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 s.x, new s.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 && (l.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), l.a._RestorePivotPoint(i._attachedNode)) }) }, e.prototype.releaseDrag = function() { this.dragging = !1, this.onDragEndObservable.notifyObservers({ dragPlanePoint: this.lastDragPosition, pointerId: this.currentDraggingPointerID }), this.currentDraggingPointerID = -1, this._moving = !1, this.detachCameraControls && this._attachedElement && this._scene.activeCamera && !this._scene.activeCamera.leftCamera && this._scene.activeCamera.attachControl(this._attachedElement, !0) }, 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) { l.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 = !0, 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)), l.a._RestorePivotPoint(this._attachedNode) } }, e.prototype._moveDrag = function(e) { this._moving = !0; var t = this._pickWithRayOnDragPlane(e); if (t) { this.updateDragPlane && this._updateDragPlanePosition(e, t); var i = 0; this._options.dragAxis ? (s.x.TransformCoordinatesToRef(this._options.dragAxis, this._attachedNode.getWorldMatrix().getRotationMatrix(), this._worldDragAxis), t.subtractToRef(this.lastDragPosition, this._tmpVector), i = s.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(s.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 * s.x.Dot(this._alternatePickedPoint, this._tmpVector)), this._tmpVector.addInPlace(this._alternatePickedPoint); var r = s.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 ? s.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), s.x.CrossToRef(this._lineA, this._lineB, this._lookAt), s.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 ? s.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(!0) }, 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: !0, configurable: !0 }), Object.defineProperty(e, "ShowLoadingScreen", { get: function() { return e._ShowLoadingScreen }, set: function(t) { e._ShowLoadingScreen = t }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "loggingLevel", { get: function() { return e._loggingLevel }, set: function(t) { e._loggingLevel = t }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "CleanBoneMatrixWeights", { get: function() { return e._CleanBoneMatrixWeights }, set: function(t) { e._CleanBoneMatrixWeights = t }, enumerable: !0, configurable: !0 }), e._ForceFullSceneLoadingForIncremental = !1, e._ShowLoadingScreen = !0, e._CleanBoneMatrixWeights = !1, e._loggingLevel = n.a.SCENELOADER_NO_LOGGING, e }() }, function(e, t, i) { "use strict"; var n = "helperFunctions", r = "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}"; i(5).a.IncludesShadersStore[n] = r }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return d }); var n = i(0), r = i(13), o = i(4), s = i(49), a = i(55), c = i(43), l = i(3), u = i(9), h = i(29), d = function() { function e(e, t, i, n, r) { void 0 === n && (n = !1), void 0 === r && (r = null), this.delayLoadState = l.a.DELAYLOADSTATE_NONE, this._totalVertices = 0, this._isDisposed = !1, this._indexBufferIsUpdatable = !1, 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(!0)) } 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(!0, null) }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), e.prototype.getScene = function() { return this._scene }, e.prototype.getEngine = function() { return this._engine }, e.prototype.isReady = function() { return this.delayLoadState === l.a.DELAYLOADSTATE_LOADED || this.delayLoadState === l.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 !1; return !0 }, enumerable: !0, configurable: !0 }), 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 = !1); 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, s = r.length, a = 0; a < s; a++) { var l = r[a]; l._boundingInfo = new c.a(this._extend.minimum, this._extend.maximum), l._createGlobalSubMesh(!1), l.computeWorldMatrix(!0) } } this.notifyUpdate(i), this._vertexArrayObjects && (this._disposeVertexArrayObjects(), this._vertexArrayObjects = {}) }, e.prototype.updateVerticesDataDirectly = function(e, t, i, n) { void 0 === n && (n = !1); 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 = !1); 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, s = r.subMeshes; o < s.length; o++) { s[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)) } }, 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 s = n.getSize() * o.b.GetTypeByteLength(n.type), a = this._totalVertices * n.getSize(); if (n.type !== o.b.FLOAT || n.byteStride !== s) { var c = []; return n.forEach(a, function(e) { return c.push(e) }), c } if (!(r instanceof Array || r instanceof Float32Array) || 0 !== n.byteOffset || r.length !== a) { if (r instanceof Array) { var l = n.byteOffset / 4; return u.h.Slice(r, l, l + a) } if (r instanceof ArrayBuffer) return new Float32Array(r, n.byteOffset, a); l = r.byteOffset + n.byteOffset; if (i || t && 1 !== this._meshes.length) { var h = new Float32Array(a), d = new Float32Array(r.buffer, l, a); return h.set(d), h } return new Float32Array(r.buffer, l, a) } return i || t && 1 !== this._meshes.length ? u.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 = !1), 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(!0) } } else this.setIndices(e, null, !0) }, e.prototype.setIndices = function(e, t, i) { void 0 === t && (t = null), void 0 === i && (i = !1), 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)), null != t && (this._totalVertices = t); for (var n = 0, r = this._meshes; n < r.length; n++) { r[n]._createGlobalSubMesh(!0) } 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 = u.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(!1), 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 !== l.a.DELAYLOADSTATE_LOADING && (this.isReady() ? t && t() : (this.delayLoadState = l.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 = l.a.DELAYLOADSTATE_LOADED, i._delayInfo = [], e._removePendingData(i); for (var r = i._meshes, o = r.length, s = 0; s < o; s++) i._applyToMesh(r[s]); t && t() } }, void 0, !0)) }, e.prototype.toLeftHanded = function() { var e = this.getIndices(!1); 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) } var n = this.getVerticesData(o.b.PositionKind, !1); 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, !1) } var r = this.getVerticesData(o.b.NormalKind, !1); 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, !1) } }, e.prototype._resetPointsArrayCache = function() { this._positions = null }, e.prototype._generatePointsArray = function() { if (this._positions) return !0; var e = this.getVerticesData(o.b.PositionKind); if (!e || 0 === e.length) return !1; this._positions = []; for (var t = 0; t < e.length; t += 3) this._positions.push(n.x.FromArray(e, t)); return !0 }, 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 = l.a.DELAYLOADSTATE_NONE, this.delayLoadingFile = null, this._delayLoadingFunction = null, this._delayInfo = [], this._boundingInfo = null, this._scene.removeGeometry(this), this._isDisposed = !0 }, 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 s, a = !1, l = !1; for (s in this._vertexBuffers) { var u = this.getVerticesData(s); if (u && (u instanceof Float32Array ? i.set(new Float32Array(u), s) : i.set(u.slice(0), s), !l)) { var h = this.getVertexBuffer(s); h && (l = !(a = h.isUpdatable())) } } var d = new e(t, this._scene, i, a); for (s in d.delayLoadState = this.delayLoadState, d.delayLoadingFile = this.delayLoadingFile, d._delayLoadingFunction = this._delayLoadingFunction, this._delayInfo) d._delayInfo = d._delayInfo || [], d._delayInfo.push(s); return d._boundingInfo = new c.a(this._extend.minimum, this._extend.maximum), d }, 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 = !0)), this.isVerticesDataPresent(o.b.NormalKind) && (e.normals = this.toNumberArray(this.getVerticesData(o.b.NormalKind)), this.isVertexBufferUpdatable(o.b.NormalKind) && (e.normals._updatable = !0)), this.isVerticesDataPresent(o.b.TangentKind) && (e.tangets = this.toNumberArray(this.getVerticesData(o.b.TangentKind)), this.isVertexBufferUpdatable(o.b.TangentKind) && (e.tangets._updatable = !0)), this.isVerticesDataPresent(o.b.UVKind) && (e.uvs = this.toNumberArray(this.getVerticesData(o.b.UVKind)), this.isVertexBufferUpdatable(o.b.UVKind) && (e.uvs._updatable = !0)), this.isVerticesDataPresent(o.b.UV2Kind) && (e.uv2s = this.toNumberArray(this.getVerticesData(o.b.UV2Kind)), this.isVertexBufferUpdatable(o.b.UV2Kind) && (e.uv2s._updatable = !0)), this.isVerticesDataPresent(o.b.UV3Kind) && (e.uv3s = this.toNumberArray(this.getVerticesData(o.b.UV3Kind)), this.isVertexBufferUpdatable(o.b.UV3Kind) && (e.uv3s._updatable = !0)), this.isVerticesDataPresent(o.b.UV4Kind) && (e.uv4s = this.toNumberArray(this.getVerticesData(o.b.UV4Kind)), this.isVertexBufferUpdatable(o.b.UV4Kind) && (e.uv4s._updatable = !0)), this.isVerticesDataPresent(o.b.UV5Kind) && (e.uv5s = this.toNumberArray(this.getVerticesData(o.b.UV5Kind)), this.isVertexBufferUpdatable(o.b.UV5Kind) && (e.uv5s._updatable = !0)), this.isVerticesDataPresent(o.b.UV6Kind) && (e.uv6s = this.toNumberArray(this.getVerticesData(o.b.UV6Kind)), this.isVertexBufferUpdatable(o.b.UV6Kind) && (e.uv6s._updatable = !0)), this.isVerticesDataPresent(o.b.ColorKind) && (e.colors = this.toNumberArray(this.getVerticesData(o.b.ColorKind)), this.isVertexBufferUpdatable(o.b.ColorKind) && (e.colors._updatable = !0)), this.isVerticesDataPresent(o.b.MatricesIndicesKind) && (e.matricesIndices = this.toNumberArray(this.getVerticesData(o.b.MatricesIndicesKind)), e.matricesIndices._isExpanded = !0, this.isVertexBufferUpdatable(o.b.MatricesIndicesKind) && (e.matricesIndices._updatable = !0)), this.isVerticesDataPresent(o.b.MatricesWeightsKind) && (e.matricesWeights = this.toNumberArray(this.getVerticesData(o.b.MatricesWeightsKind)), this.isVertexBufferUpdatable(o.b.MatricesWeightsKind) && (e.matricesWeights._updatable = !0)), 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 u.h.RandomId() }, e._ImportGeometry = function(t, i) { var r = i.getScene(), a = t.geometryId; if (a) { var c = r.getGeometryByID(a); c && c.applyToMesh(i) } else if (t instanceof ArrayBuffer) { var l = i._binaryInfo; if (l.positionsAttrDesc && l.positionsAttrDesc.count > 0) { var u = new Float32Array(t, l.positionsAttrDesc.offset, l.positionsAttrDesc.count); i.setVerticesData(o.b.PositionKind, u, !1) } if (l.normalsAttrDesc && l.normalsAttrDesc.count > 0) { var h = new Float32Array(t, l.normalsAttrDesc.offset, l.normalsAttrDesc.count); i.setVerticesData(o.b.NormalKind, h, !1) } if (l.tangetsAttrDesc && l.tangetsAttrDesc.count > 0) { var d = new Float32Array(t, l.tangetsAttrDesc.offset, l.tangetsAttrDesc.count); i.setVerticesData(o.b.TangentKind, d, !1) } if (l.uvsAttrDesc && l.uvsAttrDesc.count > 0) { var f = new Float32Array(t, l.uvsAttrDesc.offset, l.uvsAttrDesc.count); i.setVerticesData(o.b.UVKind, f, !1) } if (l.uvs2AttrDesc && l.uvs2AttrDesc.count > 0) { var p = new Float32Array(t, l.uvs2AttrDesc.offset, l.uvs2AttrDesc.count); i.setVerticesData(o.b.UV2Kind, p, !1) } if (l.uvs3AttrDesc && l.uvs3AttrDesc.count > 0) { var _ = new Float32Array(t, l.uvs3AttrDesc.offset, l.uvs3AttrDesc.count); i.setVerticesData(o.b.UV3Kind, _, !1) } if (l.uvs4AttrDesc && l.uvs4AttrDesc.count > 0) { var g = new Float32Array(t, l.uvs4AttrDesc.offset, l.uvs4AttrDesc.count); i.setVerticesData(o.b.UV4Kind, g, !1) } if (l.uvs5AttrDesc && l.uvs5AttrDesc.count > 0) { var m = new Float32Array(t, l.uvs5AttrDesc.offset, l.uvs5AttrDesc.count); i.setVerticesData(o.b.UV5Kind, m, !1) } if (l.uvs6AttrDesc && l.uvs6AttrDesc.count > 0) { var v = new Float32Array(t, l.uvs6AttrDesc.offset, l.uvs6AttrDesc.count); i.setVerticesData(o.b.UV6Kind, v, !1) } if (l.colorsAttrDesc && l.colorsAttrDesc.count > 0) { var y = new Float32Array(t, l.colorsAttrDesc.offset, l.colorsAttrDesc.count); i.setVerticesData(o.b.ColorKind, y, !1, l.colorsAttrDesc.stride) } if (l.matricesIndicesAttrDesc && l.matricesIndicesAttrDesc.count > 0) { for (var b = new Int32Array(t, l.matricesIndicesAttrDesc.offset, l.matricesIndicesAttrDesc.count), T = [], E = 0; E < b.length; E++) { var A = b[E]; T.push(255 & A), T.push((65280 & A) >> 8), T.push((16711680 & A) >> 16), T.push(A >> 24) } i.setVerticesData(o.b.MatricesIndicesKind, T, !1) } if (l.matricesWeightsAttrDesc && l.matricesWeightsAttrDesc.count > 0) { var x = new Float32Array(t, l.matricesWeightsAttrDesc.offset, l.matricesWeightsAttrDesc.count); i.setVerticesData(o.b.MatricesWeightsKind, x, !1) } if (l.indicesAttrDesc && l.indicesAttrDesc.count > 0) { var R = new Int32Array(t, l.indicesAttrDesc.offset, l.indicesAttrDesc.count); i.setIndices(R, null) } if (l.subMeshesAttrDesc && l.subMeshesAttrDesc.count > 0) { var P = new Int32Array(t, l.subMeshesAttrDesc.offset, 5 * l.subMeshesAttrDesc.count); i.subMeshes = []; for (E = 0; E < l.subMeshesAttrDesc.count; E++) { var S = P[5 * E + 0], C = P[5 * E + 1], M = P[5 * E + 2], O = P[5 * E + 3], I = P[5 * E + 4]; s.b.AddToMesh(S, C, M, O, I, 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 (T = [], E = 0; E < t.matricesIndices.length; E++) { var D = t.matricesIndices[E]; T.push(255 & D), T.push((65280 & D) >> 8), T.push((16711680 & D) >> 16), T.push(D >> 24) } i.setVerticesData(o.b.MatricesIndicesKind, T, 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 (T = [], E = 0; E < t.matricesIndicesExtra.length; E++) { D = t.matricesIndicesExtra[E]; T.push(255 & D), T.push((65280 & D) >> 8), T.push((16711680 & D) >> 16), T.push(D >> 24) } i.setVerticesData(o.b.MatricesIndicesExtraKind, T, 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 L = 0; L < t.subMeshes.length; L++) { var w = t.subMeshes[L]; s.b.AddToMesh(w.materialIndex, w.verticesStart, w.verticesCount, w.indexStart, w.indexCount, i) } } i._shouldGenerateFlatShading && (i.convertToFlatShadedMesh(), delete i._shouldGenerateFlatShading), i.computeWorldMatrix(!0), r.onMeshImportedObservable.notifyObservers(i) }, e._CleanMatricesWeights = function(e, t) { if (a.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), s = t.getVerticesData(o.b.MatricesIndicesExtraKind), c = e.matricesWeights, l = e.matricesWeightsExtra, u = e.numBoneInfluencer, h = c.length, d = 0; d < h; d += 4) { for (var f = 0, p = -1, _ = 0; _ < 4; _++) { f += g = c[d + _], g < .001 && p < 0 && (p = _) } if (l) for (_ = 0; _ < 4; _++) { var g; f += g = l[d + _], g < .001 && p < 0 && (p = _ + 4) } if ((p < 0 || p > u - 1) && (p = u - 1), f > .001) { var m = 1 / f; for (_ = 0; _ < 4; _++) c[d + _] *= m; if (l) for (_ = 0; _ < 4; _++) l[d + _] *= m } else p >= 4 ? (l[d + p - 4] = 1 - f, s[d + p - 4] = i) : (c[d + p] = 1 - f, r[d + p] = i) } t.setVerticesData(o.b.MatricesIndicesKind, r), e.matricesWeightsExtra && t.setVerticesData(o.b.MatricesIndicesExtraKind, s) } } } }, e.Parse = function(t, i, s) { if (i.getGeometryByID(t.id)) return null; var a = new e(t.id, i, void 0, t.updatable); return h.a && h.a.AddTagsTo(a, t.tags), t.delayLoadingFile ? (a.delayLoadState = l.a.DELAYLOADSTATE_NOTLOADED, a.delayLoadingFile = s + t.delayLoadingFile, a._boundingInfo = new c.a(n.x.FromArray(t.boundingBoxMinimum), n.x.FromArray(t.boundingBoxMaximum)), a._delayInfo = [], t.hasUVs && a._delayInfo.push(o.b.UVKind), t.hasUVs2 && a._delayInfo.push(o.b.UV2Kind), t.hasUVs3 && a._delayInfo.push(o.b.UV3Kind), t.hasUVs4 && a._delayInfo.push(o.b.UV4Kind), t.hasUVs5 && a._delayInfo.push(o.b.UV5Kind), t.hasUVs6 && a._delayInfo.push(o.b.UV6Kind), t.hasColors && a._delayInfo.push(o.b.ColorKind), t.hasMatricesIndices && a._delayInfo.push(o.b.MatricesIndicesKind), t.hasMatricesWeights && a._delayInfo.push(o.b.MatricesWeightsKind), a._delayLoadingFunction = r.a.ImportVertexData) : r.a.ImportVertexData(t, a), i.pushGeometry(a, !0), a }, e }() }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return d }); var n = i(1), r = i(8), o = i(0), s = i(42), a = i(53), c = i(54), l = i(48), u = i(41), h = i(33), d = function(e) { function t(i, n, s) { void 0 === n && (n = o.e.Gray()), void 0 === s && (s = u.a.DefaultUtilityLayer); var a = e.call(this, s) || this; a._pointerObserver = null, a.snapDistance = 0, a.onSnapObservable = new r.c; var l = new h.a("", s.utilityLayerScene); l.diffuseColor = n, l.specularColor = n.subtract(new o.e(.1, .1, .1)); var d = new h.a("", s.utilityLayerScene); d.diffuseColor = n.add(new o.e(.3, .3, .3)); var f = t._CreateArrow(s.utilityLayerScene, l); f.lookAt(a._rootMesh.position.add(i)), f.scaling.scaleInPlace(1 / 3), f.parent = a._rootMesh; var p = 0, _ = new o.x, g = { snapDistance: 0 }; a.dragBehavior = new c.a({ dragAxis: i }), a.dragBehavior.moveAttached = !1, a._rootMesh.addBehavior(a.dragBehavior); var m = new o.x, v = new o.j; a.dragBehavior.onDragObservable.add(function(e) { if (a.attachedMesh) if (a.attachedMesh.parent ? (a.attachedMesh.parent.computeWorldMatrix().invertToRef(v), v.setTranslationFromFloats(0, 0, 0), o.x.TransformCoordinatesToRef(e.delta, v, m)) : m.copyFrom(e.delta), 0 == a.snapDistance) a.attachedMesh.position.addInPlace(m); else if (p += e.dragDistance, Math.abs(p) > a.snapDistance) { var t = Math.floor(Math.abs(p) / a.snapDistance); p %= a.snapDistance, m.normalizeToRef(_), _.scaleInPlace(a.snapDistance * t), a.attachedMesh.position.addInPlace(_), g.snapDistance = a.snapDistance * t, a.onSnapObservable.notifyObservers(g) } }), a._pointerObserver = s.utilityLayerScene.onPointerObservable.add(function(e) { if (!a._customMeshSet) { var t = e.pickInfo && -1 != a._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh) ? d : l; a._rootMesh.getChildMeshes().forEach(function(e) { e.material = t, e.color && (e.color = t.diffuseColor) }) } }); var y = s._getSharedGizmoLight(); return y.includedOnlyMeshes = y.includedOnlyMeshes.concat(a._rootMesh.getChildMeshes(!1)), a } return n.d(t, e), t._CreateArrow = function(e, t) { var i = new s.a("arrow", e), n = a.a.CreateCylinder("cylinder", { diameterTop: 0, height: .075, diameterBottom: .0375, tessellation: 96 }, e), r = a.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, i }, t._CreateArrowInstance = function(e, t) { for (var i = new s.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) }, t }(l.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "readyState", { get: function() { return this._xhr.readyState }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "status", { get: function() { return this._xhr.status }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "statusText", { get: function() { return this._xhr.statusText }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "response", { get: function() { return this._xhr.response }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "responseURL", { get: function() { return this._xhr.responseURL }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "responseText", { get: function() { return this._xhr.responseText }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "responseType", { get: function() { return this._xhr.responseType }, set: function(e) { this._xhr.responseType = e }, enumerable: !0, configurable: !0 }), 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, !0) }, 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, !0) }, e.prototype.set = function(e, t) { return void 0 !== this._data[e] && (this._data[e] = t, !0) }, 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, !0) }, e.prototype.clear = function() { this._data = {}, this._count = 0 }, Object.defineProperty(e.prototype, "count", { get: function() { return this._count }, enumerable: !0, configurable: !0 }), 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 l }); 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 }], s = function(e, t) { return r[e] * o[e](t) }, a = [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 = !1, 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(s(0, e))), this.l1_1 = this.l1_1.add(r.scale(s(1, e))), this.l10 = this.l10.add(r.scale(s(2, e))), this.l11 = this.l11.add(r.scale(s(3, e))), this.l2_2 = this.l2_2.add(r.scale(s(4, e))), this.l2_1 = this.l2_1.add(r.scale(s(5, e))), this.l20 = this.l20.add(r.scale(s(6, e))), this.l21 = this.l21.add(r.scale(s(7, e))), this.l22 = this.l22.add(r.scale(s(8, e))) }, e.prototype.scaleInPlace = function(e) { this.l00.scaleInPlace(e), this.l1_1.scaleInPlace(e), this.l10.scaleInPlace(e), this.l11.scaleInPlace(e), this.l2_2.scaleInPlace(e), this.l2_1.scaleInPlace(e), this.l20.scaleInPlace(e), this.l21.scaleInPlace(e), this.l22.scaleInPlace(e) }, e.prototype.convertIncidentRadianceToIrradiance = function() { this.l00.scaleInPlace(a[0]), this.l1_1.scaleInPlace(a[1]), this.l10.scaleInPlace(a[2]), this.l11.scaleInPlace(a[3]), this.l2_2.scaleInPlace(a[4]), this.l2_1.scaleInPlace(a[5]), this.l20.scaleInPlace(a[6]), this.l21.scaleInPlace(a[7]), this.l22.scaleInPlace(a[8]) }, e.prototype.convertIrradianceToLambertianRadiance = function() { this.scaleInPlace(1 / Math.PI) }, e.prototype.preScaleForRendering = function() { this.preScaled = !0, this.l00.scaleInPlace(r[0]), this.l1_1.scaleInPlace(r[1]), this.l10.scaleInPlace(r[2]), this.l11.scaleInPlace(r[3]), this.l2_2.scaleInPlace(r[4]), 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), 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), n.x.FromArrayToRef(t[4], 0, i.l2_2), n.x.FromArrayToRef(t[5], 0, i.l2_1), n.x.FromArrayToRef(t[6], 0, i.l20), 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)), i.l1_1.scaleInPlace(-1), i.l11.scaleInPlace(-1), i.l2_1.scaleInPlace(-1), i.l21.scaleInPlace(-1), i.scaleInPlace(Math.PI), i }, e }(), l = 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: !0, configurable: !0 }), 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), this.yy.scaleInPlace(e), 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), i.scaleInPlace(1 / Math.PI), i }, 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), n.x.FromArrayToRef(t[4], 0, i.yy), n.x.FromArrayToRef(t[5], 0, i.zz), n.x.FromArrayToRef(t[6], 0, i.yz), 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 = !1, 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "isSync", { get: function() { return !this._needSync }, enumerable: !0, configurable: !0 }), 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) } this._fillAlignment(t), this._uniformSizes[e] = t, this._uniformLocations[e] = this._uniformLocationPointer, this._uniformLocationPointer += t; for (n = 0; n < t; n++) this._data.push(i[n]); this._needSync = !0 } }, 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 = !0) }, 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 = !1) : 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 (s = 0; s < i; s++) this._bufferData[r + s] = t[s]; else { for (var o = !1, s = 0; s < i; s++) this._bufferData[r + s] !== t[s] && (o = !0, this._bufferData[r + s] = t[s]); 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 = !0, this._areLightsDirty = !0, this._areAttributesDirty = !0, this._areTexturesDirty = !0, this._areFresnelDirty = !0, this._areMiscDirty = !0, this._areImageProcessingDirty = !0, this._normals = !1, this._uvs = !1, this._needNormals = !1, this._needUVs = !1 } return Object.defineProperty(e.prototype, "isDirty", { get: function() { return this._isDirty }, enumerable: !0, configurable: !0 }), e.prototype.markAsProcessed = function() { this._isDirty = !1, this._areAttributesDirty = !1, this._areTexturesDirty = !1, this._areFresnelDirty = !1, this._areLightsDirty = !1, this._areMiscDirty = !1, this._areImageProcessingDirty = !1 }, e.prototype.markAsUnprocessed = function() { this._isDirty = !0 }, e.prototype.markAllAsDirty = function() { this._areTexturesDirty = !0, this._areAttributesDirty = !0, this._areLightsDirty = !0, this._areFresnelDirty = !0, this._areMiscDirty = !0, this._areImageProcessingDirty = !0, this._isDirty = !0 }, e.prototype.markAsImageProcessingDirty = function() { this._areImageProcessingDirty = !0, this._isDirty = !0 }, e.prototype.markAsLightDirty = function() { this._areLightsDirty = !0, this._isDirty = !0 }, e.prototype.markAsAttributesDirty = function() { this._areAttributesDirty = !0, this._isDirty = !0 }, e.prototype.markAsTexturesDirty = function() { this._areTexturesDirty = !0, this._isDirty = !0 }, e.prototype.markAsFresnelDirty = function() { this._areFresnelDirty = !0, this._isDirty = !0 }, e.prototype.markAsMiscDirty = function() { this._areMiscDirty = !0, this._isDirty = !0 }, 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 !1; for (var t = 0; t < this._keys.length; t++) { var i = this._keys[t]; if (this[i] !== e[i]) return !1 } return !0 }, 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 (typeof this[t]) { case "number": this[t] = 0; break; case "string": this[t] = ""; break; default: this[t] = !1 } } }, e.prototype.toString = function() { for (var e = "", t = 0; t < this._keys.length; t++) { var i = this._keys[t], n = this[i]; switch (typeof 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), s = i(25), a = i(38); s.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 a.a.LIGHTTYPEID_HEMISPHERICLIGHT }, t.prototype.prepareLightSpecificDefines = function(e, t) { e["HEMILIGHT" + t] = !0 }, n.c([Object(r.e)()], t.prototype, "groundColor", void 0), n.c([Object(r.o)()], t.prototype, "direction", void 0), t }(a.a) }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return a }); var n = i(1), r = i(20), o = i(29), s = i(22), a = function(e) { function t(t, i) { var n = e.call(this, t, i, !0) || this; return i.multiMaterials.push(n), n.subMaterials = new Array, n._storeEffectOnSubMeshes = !0, 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: !0, configurable: !0 }), 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 !1; continue } if (!r.isReady(e)) return !1 } } return !0 }, t.prototype.clone = function(e, i) { for (var n = new t(e, this.getScene()), r = 0; r < this.subMaterials.length; r++) { var o = null, s = this.subMaterials[r]; o = i && s ? s.clone(e + "-" + s.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 s = this.subMaterials[o]; s && s.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 s = e.materials[r]; s ? n.subMaterials.push(i.getMaterialByID(s)) : n.subMaterials.push(null) } return n }, t }(r.a); s.a.RegisteredTypes["BABYLON.MultiMaterial"] = a }, function(e, t, i) { "use strict"; var n = "bonesDeclaration", r = "#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"; i(5).a.IncludesShadersStore[n] = r }, function(e, t, i) { "use strict"; var n = "instancesDeclaration", r = "#ifdef INSTANCES\nattribute vec4 world0;\nattribute vec4 world1;\nattribute vec4 world2;\nattribute vec4 world3;\n#else\nuniform mat4 world;\n#endif"; i(5).a.IncludesShadersStore[n] = r }, function(e, t, i) { "use strict"; var n = "instancesVertex", r = "#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#else\nmat4 finalWorld=world;\n#endif"; i(5).a.IncludesShadersStore[n] = r }, function(e, t, i) { "use strict"; var n = "#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"; i(5).a.IncludesShadersStore.bonesVertex = n }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return c }); var n = i(0), r = i(12), o = i(62), s = i(3), a = function() { return 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 a = e.readPixels(4), c = e.readPixels(5), l = e.gammaSpace, u = s.a.TEXTUREFORMAT_RGBA, h = s.a.TEXTURETYPE_UNSIGNED_INT; e.textureType && e.textureType !== s.a.TEXTURETYPE_UNSIGNED_INT && (h = s.a.TEXTURETYPE_FLOAT); var d = { size: n, right: r, left: o, up: t, down: i, front: a, back: c, format: u, type: h, gammaSpace: l }; return this.ConvertCubeMapToSphericalPolynomial(d) }, e.ConvertCubeMapToSphericalPolynomial = function(e) { for (var t = new o.a, i = 0, a = 2 / e.size, c = a, l = .5 * a - 1, u = 0; u < 6; u++) for (var h = this.FileFaces[u], d = e[h.name], f = l, p = e.format === s.a.TEXTUREFORMAT_RGBA ? 4 : 3, _ = 0; _ < e.size; _++) { for (var g = l, m = 0; m < e.size; m++) { var v = h.worldAxisForFileX.scale(g).add(h.worldAxisForFileY.scale(f)).add(h.worldAxisForNormal); v.normalize(); var y = Math.pow(1 + g * g + f * f, -1.5), b = d[_ * e.size * p + m * p + 0], T = d[_ * e.size * p + m * p + 1], E = d[_ * e.size * p + m * p + 2]; e.type === s.a.TEXTURETYPE_UNSIGNED_INT && (b /= 255, T /= 255, E /= 255), e.gammaSpace && (b = Math.pow(r.a.Clamp(b), n.v), T = Math.pow(r.a.Clamp(T), n.v), E = Math.pow(r.a.Clamp(E), n.v)); var A = new n.e(b, T, E); t.addLight(v, A, y), i += y, g += a } f += c } var x = 6 * (4 * Math.PI) / 6 / i; return t.scaleInPlace(x), t.convertIncidentRadianceToIrradiance(), t.convertIrradianceToLambertianRadiance(), o.b.FromHarmonics(t) }, e.FileFaces = [new a("right", new n.x(1, 0, 0), new n.x(0, 0, -1), new n.x(0, -1, 0)), new a("left", new n.x(-1, 0, 0), new n.x(0, 0, 1), new n.x(0, -1, 0)), new a("up", new n.x(0, 1, 0), new n.x(1, 0, 0), new n.x(0, 0, 1)), new a("down", new n.x(0, -1, 0), new n.x(1, 0, 0), new n.x(0, 0, -1)), new a("front", new n.x(0, 0, 1), new n.x(1, 0, 0), new n.x(0, -1, 0)), new a("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 d }); var n = i(1), r = i(0), o = i(4), s = i(11), a = i(111), c = i(20), l = i(76), u = (i(126), i(127), i(15)), h = function(e) { function t(t, i, n, s, a, c, u) { void 0 === i && (i = null), void 0 === n && (n = null); var h = e.call(this, t, i, n, s, a) || this; h.useVertexColor = c, h.useVertexAlpha = u, h.color = new r.e(1, 1, 1), h.alpha = 1, s && (h.color = s.color.clone(), h.alpha = s.alpha, h.useVertexColor = s.useVertexColor, h.useVertexAlpha = s.useVertexAlpha), h.intersectionThreshold = .1; var d = { attributes: [o.b.PositionKind, "world0", "world1", "world2", "world3"], uniforms: ["vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "world", "viewProjection"], needAlphaBlending: !0, defines: [] }; return !1 === u && (d.needAlphaBlending = !1), c ? (d.defines.push("#define VERTEXCOLOR"), d.attributes.push(o.b.ColorKind)) : d.uniforms.push("color"), h._colorShader = new l.a("colorShader", h.getScene(), "color", d), 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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "checkCollisions", { get: function() { return !1 }, enumerable: !0, configurable: !0 }), 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)), u.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), this }, t.prototype.dispose = function(t) { this._colorShader.dispose(!1, !1, !0), 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 d(e, this) }, t }(s.a), d = 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 }(a.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: !0, configurable: !0 }), t }(i(78).a) }, function(e, t, i) { "use strict"; i.r(t); var n = i(0), r = i(33), o = i(58), s = function() { function e(t, i, s, a, c, l) { if (void 0 === i && (i = 1), void 0 === s && (s = 2), this._scaleLinesFactor = 4, this._instanced = !1, this.scaleLines = 1, this.scaleLines = i, !a) { var u = new r.a("", t); u.disableLighting = !0, u.emissiveColor = n.e.Red().scale(.5), a = o.a._CreateArrow(t, u) } if (!c) { var h = new r.a("", t); h.disableLighting = !0, h.emissiveColor = n.e.Green().scale(.5), c = o.a._CreateArrow(t, h) } if (!l) { var d = new r.a("", t); d.disableLighting = !0, d.emissiveColor = n.e.Blue().scale(.5), l = o.a._CreateArrow(t, d) } this._xAxis = a, this._xAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor), this._yAxis = c, this._yAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor), this._zAxis = l, this._zAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor), null != s && (e._SetRenderingGroupId(this._xAxis, s), e._SetRenderingGroupId(this._yAxis, s), e._SetRenderingGroupId(this._zAxis, s)), this.scene = t, this.update(new n.x, n.x.Right(), n.x.Up(), n.x.Forward()) } return Object.defineProperty(e.prototype, "xAxis", { get: function() { return this._xAxis }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "yAxis", { get: function() { return this._yAxis }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "zAxis", { get: function() { return this._zAxis }, enumerable: !0, configurable: !0 }), 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._yAxis.position.copyFrom(e), this._yAxis.setDirection(i), 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 = o.a._CreateArrowInstance(this.scene, this._xAxis), i = o.a._CreateArrowInstance(this.scene, this._yAxis), n = o.a._CreateArrowInstance(this.scene, this._zAxis), r = new e(this.scene, this.scaleLines, null, t, i, n); return r._instanced = !0, r }, e.prototype.dispose = function() { this._xAxis && (this._xAxis.dispose(!1, !this._instanced), delete this._xAxis), this._yAxis && (this._yAxis.dispose(!1, !this._instanced), delete this._yAxis), this._zAxis && (this._zAxis.dispose(!1, !this._instanced), delete this._zAxis), delete this.scene }, e._SetRenderingGroupId = function(e, t) { e.getChildMeshes().forEach(function(e) { e.renderingGroupId = t }) }, e }(), a = i(1), c = function(e) { function t(t, i, r, o) { void 0 === o && (o = 1); var s = e.call(this, t, o) || this; return s.pos = n.x.Zero(), s.xaxis = n.x.Zero(), s.yaxis = n.x.Zero(), s.zaxis = n.x.Zero(), s.mesh = r, s.bone = i, s } return a.d(t, e), t.prototype.update = function() { if (this.mesh && this.bone) { var t = this.bone; t.getAbsolutePositionToRef(this.mesh, this.pos), t.getDirectionToRef(n.c.X, this.mesh, this.xaxis), t.getDirectionToRef(n.c.Y, this.mesh, this.yaxis), t.getDirectionToRef(n.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 = i(9), u = i(8), h = i(16), d = i(10); Object.defineProperty(h.a.prototype, "debugLayer", { get: function() { return this._debugLayer || (this._debugLayer = new f(this)), this._debugLayer }, enumerable: !0, configurable: !0 }); var f = function() { function e(e) { var t = this; this.BJSINSPECTOR = this._getGlobalInspector(), this.onPropertyChangedObservable = new u.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 = a.a({ overlay: !1, showExplorer: !0, showInspector: !0, embedMode: !1, handleResize: !0, enablePopup: !0 }, 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 i = this; return new Promise(function(n, r) { if (void 0 === i.BJSINSPECTOR) { var o = t && t.inspectorURL ? t.inspectorURL : e.InspectorURL; l.h.LoadScript(o, function() { i._createInspector(t), n(i) }) } else i._createInspector(t), n(i) }) }, e.InspectorURL = "https://unpkg.com/babylonjs-inspector@" + d.b.Version + "/babylon.inspector.bundle.js", e }(), p = i(11), _ = i(52), g = i(46), m = i(23), v = i(27), y = i(41), b = i(53), T = function() { function e(e) { this._impostors = [], this._meshes = [], this._numMeshes = 0, this._debugMeshMeshes = new Array, this._scene = e || m.a.LastCreatedScene; var t = this._scene.getPhysicsEngine(); t && (this._physicsEnginePlugin = t.getPhysicsPlugin()), this._utilityLayer = new y.a(this._scene, !1), this._utilityLayer.pickUtilitySceneFirst = !1, this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = !0 } 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 === v.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 = !1, 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 = !0; break } t && 0 === this._numMeshes && this._scene.unregisterBeforeRender(this._renderFunction) } }, e.prototype._getDebugMaterial = function(e) { return this._debugMaterial || (this._debugMaterial = new r.a("", e), this._debugMaterial.wireframe = !0, this._debugMaterial.emissiveColor = n.e.White(), this._debugMaterial.disableLighting = !0), this._debugMaterial }, e.prototype._getDebugBoxMesh = function(e) { return this._debugBoxMesh || (this._debugBoxMesh = _.a.CreateBox("physicsBodyBoxViewMesh", { size: 1 }, e), this._debugBoxMesh.rotationQuaternion = n.q.Identity(), this._debugBoxMesh.material = this._getDebugMaterial(e), this._debugBoxMesh.setEnabled(!1)), this._debugBoxMesh.createInstance("physicsBodyBoxViewInstance") }, e.prototype._getDebugSphereMesh = function(e) { return this._debugSphereMesh || (this._debugSphereMesh = g.a.CreateSphere("physicsBodySphereViewMesh", { diameter: 1 }, e), this._debugSphereMesh.rotationQuaternion = n.q.Identity(), this._debugSphereMesh.material = this._getDebugMaterial(e), this._debugSphereMesh.setEnabled(!1)), this._debugSphereMesh.createInstance("physicsBodyBoxViewInstance") }, e.prototype._getDebugCylinderMesh = function(e) { return this._debugCylinderMesh || (this._debugCylinderMesh = b.a.CreateCylinder("physicsBodyCylinderViewMesh", { diameterTop: 1, diameterBottom: 1, height: 1 }, e), this._debugCylinderMesh.rotationQuaternion = n.q.Identity(), this._debugCylinderMesh.material = this._getDebugMaterial(e), this._debugCylinderMesh.setEnabled(!1)), this._debugCylinderMesh.createInstance("physicsBodyBoxViewInstance") }, e.prototype._getDebugMeshMesh = function(e, t) { var i = new p.a(e.name, t, null, e); return i.position = n.x.Zero(), i.setParent(e), 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) { case v.a.BoxImpostor: n = this._getDebugBoxMesh(r), e.getBoxSizeToRef(n.scaling); break; case v.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; case v.a.MeshImpostor: t && (n = this._getDebugMeshMesh(t, r)); break; case v.a.NoImpostor: if (t) t.getChildMeshes().filter(function(e) { return e.physicsImpostor ? 1 : 0 }).forEach(function(e) { i._getDebugBoxMesh(r).parent = e }); break; case v.a.CylinderImpostor: n = this._getDebugCylinderMesh(r); var s = e.object.getBoundingInfo(); n.scaling.x = s.boundingBox.maximum.x - s.boundingBox.minimum.x, n.scaling.y = s.boundingBox.maximum.y - s.boundingBox.minimum.y, n.scaling.z = s.boundingBox.maximum.z - s.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) }, e }(), E = i(40), A = 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 = p.a.CreateLines("ray", this._renderPoints, e, !0), 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), p.a.CreateLines("ray", this._renderPoints, this._scene, !0, this._renderLine) } }, e.prototype.attachToMesh = function(e, t, i, r) { this._attachedToMesh = e; var o = this.ray; o && (o.direction || (o.direction = n.x.Zero()), o.origin || (o.origin = n.x.Zero()), r && (o.length = r), i || (i = n.x.Zero()), t || (t = new n.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), n.x.TransformCoordinatesToRef(this._meshSpaceOrigin, this._attachedToMesh.getWorldMatrix(), e.origin))) }, e.prototype.dispose = function() { this.hide(), this.detachFromMesh(), this.ray = null }, e }(), x = function() { function e(e, t, i, r, o) { void 0 === r && (r = !0), void 0 === o && (o = 1), this.skeleton = e, this.mesh = t, this.autoUpdateBonesMatrices = r, this.renderingGroupId = o, this.color = n.e.White(), this._debugLines = new Array, this._isEnabled = !1, this._scene = i, this._utilityLayer = new y.a(this._scene, !1), this._utilityLayer.pickUtilitySceneFirst = !1, this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = !0, this.update(), this._renderFunction = this.update.bind(this) } return Object.defineProperty(e.prototype, "debugMesh", { get: function() { return this._debugMesh }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), e.prototype._getBonePosition = function(e, t, i, r, o, s) { void 0 === r && (r = 0), void 0 === o && (o = 0), void 0 === s && (s = 0); var a = n.t.Matrix[0], c = t.getParent(); if (a.copyFrom(t.getLocalMatrix()), 0 !== r || 0 !== o || 0 !== s) { var l = n.t.Matrix[1]; n.j.IdentityToRef(l), l.setTranslationFromFloats(r, o, s), l.multiplyToRef(a, a) } c && a.multiplyToRef(c.getAbsoluteTransform(), a), a.multiplyToRef(i, a), e.x = a.m[12], e.y = a.m[13], e.z = a.m[14] }, e.prototype._getLinesForBonesWithLength = function(e, t) { for (var i = e.length, r = this.mesh._effectiveMesh.position, o = 0; o < i; o++) { var s = e[o], a = this._debugLines[o]; a || (a = [n.x.Zero(), n.x.Zero()], this._debugLines[o] = a), this._getBonePosition(a[0], s, t), this._getBonePosition(a[1], s, t, 0, s.length, 0), a[0].subtractInPlace(r), a[1].subtractInPlace(r) } }, e.prototype._getLinesForBonesNoLength = function(e, t) { for (var i = e.length, r = 0, o = this.mesh._effectiveMesh, s = o.position, a = i - 1; a >= 0; a--) { var c = e[a], l = c.getParent(); if (l) { var u = this._debugLines[r]; u || (u = [n.x.Zero(), n.x.Zero()], this._debugLines[r] = u), c.getAbsolutePositionToRef(o, u[0]), l.getAbsolutePositionToRef(o, u[1]), u[0].subtractInPlace(s), u[1].subtractInPlace(s), r++ } } }, 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 ? E.a.CreateLineSystem("", { lines: this._debugLines, updatable: !0, instance: this._debugMesh }, t) : (this._debugMesh = E.a.CreateLineSystem("", { lines: this._debugLines, updatable: !0, 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 = !1, this._debugMesh && (this.isEnabled = !1, this._debugMesh.dispose(), this._debugMesh = null), this._utilityLayer && (this._utilityLayer.dispose(), this._utilityLayer = null) }, e }(); i.d(t, "AxesViewer", function() { return s }), i.d(t, "BoneAxesViewer", function() { return c }), i.d(t, "DebugLayer", function() { return f }), i.d(t, "PhysicsViewer", function() { return T }), i.d(t, "RayHelper", function() { return A }), i.d(t, "SkeletonViewer", function() { return x }) }, 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 = !0, n._storeEffectOnSubMeshes = !0, 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 d }); var n = i(1), r = i(2), o = i(0), s = i(4), a = i(7), c = i(15), l = i(5), u = i(20), h = i(22), d = function(e) { function t(t, i, r, s) { void 0 === s && (s = {}); var a = e.call(this, t, i) || this; return a._textures = {}, a._textureArrays = {}, a._floats = {}, a._ints = {}, a._floatsArrays = {}, a._colors3 = {}, a._colors3Arrays = {}, a._colors4 = {}, a._vectors2 = {}, a._vectors3 = {}, a._vectors4 = {}, a._matrices = {}, a._matrices3x3 = {}, a._matrices2x2 = {}, a._vectors2Arrays = {}, a._vectors3Arrays = {}, a._cachedWorldViewMatrix = new o.j, a._shaderPath = r, a._options = n.a({ needAlphaBlending: !1, needAlphaTesting: !1, attributes: ["position", "normal", "uv"], uniforms: ["worldViewProjection"], uniformBuffers: [], samplers: [], defines: [] }, s), a } return n.d(t, e), Object.defineProperty(t.prototype, "options", { get: function() { return this._options }, enumerable: !0, configurable: !0 }), 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), this._checkUniform(e), this._textureArrays[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.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"), !1) }, 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 !0; for (var r = [], o = [], a = new l.c, u = 0; u < this._options.defines.length; u++) r.push(this._options.defines[u]); for (u = 0; u < this._options.attributes.length; u++) o.push(this._options.attributes[u]); if (e && e.isVerticesDataPresent(s.b.ColorKind) && (o.push(s.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(s.b.MatricesIndicesKind), o.push(s.b.MatricesWeightsKind), e.numBoneInfluencers > 4 && (o.push(s.b.MatricesIndicesExtraKind), o.push(s.b.MatricesWeightsExtraKind)); var h = e.skeleton; r.push("#define NUM_BONE_INFLUENCERS " + e.numBoneInfluencers), a.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 d in this._textures) if (!this._textures[d].isReady()) return !1; e && this._shouldTurnAlphaTestOn(e) && r.push("#define ALPHATEST"); var f = this._effect, p = r.join("\n"); return this._effect = n.createEffect(this._shaderPath, { attributes: o, uniformsNames: this._options.uniforms, uniformBuffersNames: this._options.uniformBuffers, samplers: this._options.samplers, defines: p, fallbacks: a, onCompiled: this.onCompiled, onError: this.onError }, n), !!this._effect.isReady() && (f !== this._effect && i.resetCachedMaterial(), this._renderId = i.getRenderId(), !0) }, 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]) } 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 !0; for (var i in this._textures) if (this._textures[i] === t) return !0; for (var i in this._textureArrays) for (var n = this._textureArrays[i], r = 0; r < n.length; r++) if (n[r] === t) return !0; return !1 }, 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], s = 0; s < o.length; s++) o[s].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 s, c = r.a.Parse(function() { return new t(e.name, i, e.shaderPath, e.options) }, e, i, n); for (s in e.textures) c.setTexture(s, a.a.Parse(e.textures[s], i, n)); for (s in e.textureArrays) { for (var l = e.textureArrays[s], u = new Array, h = 0; h < l.length; h++) u.push(a.a.Parse(l[h], i, n)); c.setTextureArray(s, u) } for (s in e.floats) c.setFloat(s, e.floats[s]); for (s in e.floatsArrays) c.setFloats(s, e.floatsArrays[s]); for (s in e.colors3) c.setColor3(s, o.e.FromArray(e.colors3[s])); for (s in e.colors3Arrays) { var d = e.colors3Arrays[s].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(s, d) } for (s in e.colors4) c.setColor4(s, o.f.FromArray(e.colors4[s])); for (s in e.vectors2) c.setVector2(s, o.w.FromArray(e.vectors2[s])); for (s in e.vectors3) c.setVector3(s, o.x.FromArray(e.vectors3[s])); for (s in e.vectors4) c.setVector4(s, o.y.FromArray(e.vectors4[s])); for (s in e.matrices) c.setMatrix(s, o.j.FromArray(e.matrices[s])); for (s in e.matrices3x3) c.setMatrix3x3(s, e.matrices3x3[s]); for (s in e.matrices2x2) c.setMatrix2x2(s, e.matrices2x2[s]); for (s in e.vectors2Arrays) c.setArray2(s, e.vectors2Arrays[s]); for (s in e.vectors3Arrays) c.setArray3(s, e.vectors3Arrays[s]); return c }, t }(u.a); h.a.RegisteredTypes["BABYLON.ShaderMaterial"] = d }, 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, s = e.z, a = t.x, c = t.y, l = t.z, u = this.vectors; this.minimum.copyFromFloats(n, o, s), this.maximum.copyFromFloats(a, c, l), u[0].copyFromFloats(n, o, s), u[1].copyFromFloats(a, c, l), u[2].copyFromFloats(a, o, s), u[3].copyFromFloats(n, c, s), u[4].copyFromFloats(n, o, l), u[5].copyFromFloats(a, c, s), u[6].copyFromFloats(n, c, l), u[7].copyFromFloats(a, o, l), 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, s = n.scaleInPlace(.5 * o), a = this.center.subtractToRef(s, i[1]), c = this.center.addToRef(s, i[2]); return this.reConstruct(a, 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, s = this.vectors; if (e.isIdentity()) { t.copyFrom(this.minimum), i.copyFrom(this.maximum); for (a = 0; a < 8; ++a) o[a].copyFrom(s[a]); this.extendSizeWorld.copyFrom(this.extendSize), this.centerWorld.copyFrom(this.center) } else { t.setAll(Number.MAX_VALUE), i.setAll(-Number.MAX_VALUE); for (var a = 0; a < 8; ++a) { var c = o[a]; r.x.TransformCoordinatesToRef(s[a], e, c), t.minimizeInPlace(c), i.maximizeInPlace(c) } i.subtractToRef(t, this.extendSizeWorld).scaleInPlace(.5), i.addToRef(t, this.centerWorld).scaleInPlace(.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, s = t.z, a = i.x, c = i.y, l = i.z, u = e.x, h = e.y, d = e.z, f = -r.h; return !(a - u < f || f > u - n) && (!(c - h < f || f > h - o) && !(l - d < f || f > d - s)) }, 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, s = i.z, a = n.x, c = n.y, l = n.z, u = e.x, h = e.y, d = e.z, f = t.x, p = t.y, _ = t.z; return !(a < u || r > f) && (!(c < h || o > p) && !(l < d || s > _)) }, e.Intersects = function(e, t) { return e.intersectsMinMax(t.minimumWorld, t.maximumWorld) }, e.IntersectsSphere = function(t, i, n, o) { var s = e.TmpVector3[0]; return r.x.ClampToRef(n, t, i, s), r.x.DistanceSquared(n, s) <= 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 !1; return !0 }, e.IsInFrustum = function(e, t) { for (var i = 0; i < 6; ++i) { for (var n = !0, r = t[i], o = 0; o < 8; ++o) if (r.dotCoordinate(e[o]) >= 0) { n = !1; break } if (n) return !1 } return !0 }, 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 = !1 } return Object.defineProperty(e.prototype, "underlyingResource", { get: function() { return null }, enumerable: !0, configurable: !0 }), 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 = !1 } return Object.defineProperty(e, "HasTriggers", { get: function() { for (var t in e.Triggers) if (e.Triggers.hasOwnProperty(t)) return !0; return !1 }, enumerable: !0, configurable: !0 }), 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 !0 } return !1 }, enumerable: !0, configurable: !0 }), e.HasSpecificTrigger = function(t) { for (var i in e.Triggers) { if (e.Triggers.hasOwnProperty(i)) if (parseInt(i) === t) return !0 } return !1 }, e.Triggers = {}, e }() }, 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 = [], s = e.width || e.size || 1, a = e.height || e.size || 1, c = 0 === e.sideOrientation ? 0 : e.sideOrientation || r.a.DEFAULTSIDE, l = s / 2, u = a / 2; i.push(-l, -u, 0), n.push(0, 0, -1), o.push(0, 0), i.push(l, -u, 0), n.push(0, 0, -1), o.push(1, 0), i.push(l, u, 0), n.push(0, 0, -1), o.push(1, 1), i.push(-l, u, 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 s = { size: t, width: t, height: t, sideOrientation: r, updatable: n }; return o.CreatePlane(e, s, 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), o.setDirection(t.sourcePlane.normal.scale(-1))), o }, e }() }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return n }); var n = function() { return 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]), s = this.center.addToRef(r, n[2]); return this.reConstruct(o, s, 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 !1; return !0 }, e.prototype.isCenterInFrustum = function(e) { for (var t = this.centerWorld, i = 0; i < 6; i++) if (e[i].dotCoordinate(t) < 0) return !1; return !0 }, 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 s }); var n = i(20), r = i(4), o = i(3), s = 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, !1, !1, 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), !0)) }, e.prototype.directRender = function(e, t, i, r, o) { void 0 === t && (t = null), void 0 === i && (i = !1), void 0 === r && (r = 0), void 0 === o && (o = 0); for (var s = this._scene.getEngine(), a = 0; a < e.length; a++) { a < e.length - 1 ? e[a + 1].activate(this._scene.activeCamera, t) : t ? s.bindFramebuffer(t, r, void 0, void 0, i, void 0, o) : s.restoreDefaultFramebuffer(); var c = e[a], l = c.apply(); l && (c.onBeforeRenderObservable.notifyObservers(l), this._prepareBuffers(), s.bindBuffers(this._vertexBuffers, this._indexBuffer, l), s.drawElementsType(n.a.TriangleFillMode, 0, 6), c.onAfterRenderObservable.notifyObservers(l)) } s.setDepthBuffer(!0), s.setDepthWrite(!0) }, e.prototype._finalizeFrame = function(e, t, i, r, s) { void 0 === s && (s = !1); var a = this._scene.activeCamera; if (a && 0 !== (r = r || a._postProcesses.filter(function(e) { return null != e })).length && this._scene.postProcessesEnabled) { for (var c = this._scene.getEngine(), l = 0, u = r.length; l < u; l++) { var h = r[l]; if (l < u - 1 ? h._outputTexture = r[l + 1].activate(a, t) : t ? (c.bindFramebuffer(t, i, void 0, void 0, s), h._outputTexture = t) : (c.restoreDefaultFramebuffer(), h._outputTexture = null), e) break; var d = h.apply(); d && (h.onBeforeRenderObservable.notifyObservers(d), this._prepareBuffers(), c.bindBuffers(this._vertexBuffers, this._indexBuffer, d), c.drawElementsType(n.a.TriangleFillMode, 0, 6), h.onAfterRenderObservable.notifyObservers(d)) } c.setDepthBuffer(!0), c.setDepthWrite(!0), 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"; var n = "lightFragmentDeclaration", r = "#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"; i(5).a.IncludesShadersStore[n] = r }, function(e, t, i) { "use strict"; var n = "lightUboDeclaration", r = "#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"; i(5).a.IncludesShadersStore[n] = r }, function(e, t, i) { "use strict"; var n = "imageProcessingDeclaration", r = "#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"; i(5).a.IncludesShadersStore[n] = r }, function(e, t, i) { "use strict"; var n = "imageProcessingFunctions", r = "#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}"; i(5).a.IncludesShadersStore[n] = r }, function(e, t, i) { "use strict"; var n = "logDepthDeclaration", r = "#ifdef LOGARITHMICDEPTH\nuniform float logarithmicDepthConstant;\nvarying float vFragmentDepth;\n#endif"; i(5).a.IncludesShadersStore[n] = r }, function(e, t, i) { "use strict"; var n = "clipPlaneFragment", r = "#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"; i(5).a.IncludesShadersStore[n] = r }, function(e, t, i) { "use strict"; var n = "clipPlaneVertex", r = "#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"; i(5).a.IncludesShadersStore[n] = r }, 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() { return function() {} }(), o = function() { function e(t) { this._useSceneAutoClearSetup = !1, 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: !0, depth: !0, stencil: !0 } } return e.prototype._clearDepthStencilBuffer = function(e, t) { void 0 === e && (e = !0), void 0 === t && (t = !0), this._depthStencilBufferAlreadyCleaned || (this._scene.getEngine().clear(null, !1, e, t), this._depthStencilBufferAlreadyCleaned = !0) }, 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 s = 0; s < this._scene.spriteManagers.length; s++) { var a = this._scene.spriteManagers[s]; this.dispatchSprites(a) } for (s = e.MIN_RENDERINGGROUPS; s < e.MAX_RENDERINGGROUPS; s++) { this._depthStencilBufferAlreadyCleaned = s === e.MIN_RENDERINGGROUPS; var c = this._renderingGroups[s]; if (c) { var l = Math.pow(2, s); if (o.renderingGroupId = s, this._scene.onBeforeRenderingGroupObservable.notifyObservers(o, l), e.AUTOCLEAR) { var u = this._useSceneAutoClearSetup ? this._scene.getAutoClearDepthStencilSetup(s) : this._autoClearDepthStencil[s]; u && u.autoClear && this._clearDepthStencilBuffer(u.depth, u.stencil) } for (var h = 0, d = this._scene._beforeRenderingGroupDrawStage; h < d.length; h++) { d[h].action(s) } c.render(t, r, n, i); for (var f = 0, p = this._scene._afterRenderingGroupDrawStage; f < p.length; f++) { p[f].action(s) } this._scene.onAfterRenderingGroupObservable.notifyObservers(o, l) } } }, 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 = !0), void 0 === n && (n = !0), 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 = !0, e }() }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return n }); var n = function() { return function() {} }() }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return s }); var n = i(1), r = i(2), o = i(0), s = function() { function e() { this._dirty = !0, 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 = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "globalDensity", { get: function() { return this._globalDensity }, set: function(e) { this._globalDensity = e, this._dirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "globalSaturation", { get: function() { return this._globalSaturation }, set: function(e) { this._globalSaturation = e, this._dirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "globalExposure", { get: function() { return this._globalExposure }, set: function(e) { this._globalExposure = e, this._dirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "highlightsHue", { get: function() { return this._highlightsHue }, set: function(e) { this._highlightsHue = e, this._dirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "highlightsDensity", { get: function() { return this._highlightsDensity }, set: function(e) { this._highlightsDensity = e, this._dirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "highlightsSaturation", { get: function() { return this._highlightsSaturation }, set: function(e) { this._highlightsSaturation = e, this._dirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "highlightsExposure", { get: function() { return this._highlightsExposure }, set: function(e) { this._highlightsExposure = e, this._dirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "midtonesHue", { get: function() { return this._midtonesHue }, set: function(e) { this._midtonesHue = e, this._dirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "midtonesDensity", { get: function() { return this._midtonesDensity }, set: function(e) { this._midtonesDensity = e, this._dirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "midtonesSaturation", { get: function() { return this._midtonesSaturation }, set: function(e) { this._midtonesSaturation = e, this._dirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "midtonesExposure", { get: function() { return this._midtonesExposure }, set: function(e) { this._midtonesExposure = e, this._dirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "shadowsHue", { get: function() { return this._shadowsHue }, set: function(e) { this._shadowsHue = e, this._dirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "shadowsDensity", { get: function() { return this._shadowsDensity }, set: function(e) { this._shadowsDensity = e, this._dirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "shadowsSaturation", { get: function() { return this._shadowsSaturation }, set: function(e) { this._shadowsSaturation = e, this._dirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "shadowsExposure", { get: function() { return this._shadowsExposure }, set: function(e) { this._shadowsExposure = e, this._dirty = !0 }, enumerable: !0, configurable: !0 }), 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 = !1, 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), 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), t *= 100 }, e.fromHSBToRef = function(t, i, n, r) { var o = e.clamp(t, 0, 360), s = e.clamp(i / 100, 0, 1), a = e.clamp(n / 100, 0, 1); if (0 === s) r.r = a, r.g = a, r.b = a; else { o /= 60; var c = Math.floor(o), l = o - c, u = a * (1 - s), h = a * (1 - s * l), d = a * (1 - s * (1 - l)); switch (c) { case 0: r.r = a, r.g = d, r.b = u; break; case 1: r.r = h, r.g = a, r.b = u; break; case 2: r.r = u, r.g = a, r.b = d; break; case 3: r.r = u, r.g = h, r.b = a; break; case 4: r.r = d, r.g = u, r.b = a; break; default: r.r = a, r.g = u, 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) }, 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, "_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, "_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), e }(); r.a._ColorCurvesParser = s.Parse }, function(e, t, i) { "use strict"; var n = function() { function e() { this._isAlphaBlendDirty = !1, this._isBlendFunctionParametersDirty = !1, this._isBlendEquationParametersDirty = !1, this._isBlendConstantsDirty = !1, this._alphaBlend = !1, 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "alphaBlend", { get: function() { return this._alphaBlend }, set: function(e) { this._alphaBlend !== e && (this._alphaBlend = e, this._isAlphaBlendDirty = !0) }, enumerable: !0, configurable: !0 }), 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 = !0) }, 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 = !0) }, e.prototype.setAlphaEquationParameters = function(e, t) { this._blendEquationParameters[0] === e && this._blendEquationParameters[1] === t || (this._blendEquationParameters[0] = e, this._blendEquationParameters[1] = t, this._isBlendEquationParametersDirty = !0) }, e.prototype.reset = function() { this._alphaBlend = !1, 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 = !0, this._isBlendFunctionParametersDirty = !1, this._isBlendEquationParametersDirty = !1, this._isBlendConstantsDirty = !1 }, e.prototype.apply = function(e) { this.isDirty && (this._isAlphaBlendDirty && (this._alphaBlend ? e.enable(e.BLEND) : e.disable(e.BLEND), this._isAlphaBlendDirty = !1), this._isBlendFunctionParametersDirty && (e.blendFuncSeparate(this._blendFunctionParameters[0], this._blendFunctionParameters[1], this._blendFunctionParameters[2], this._blendFunctionParameters[3]), this._isBlendFunctionParametersDirty = !1), this._isBlendEquationParametersDirty && (e.blendEquationSeparate(this._blendEquationParameters[0], this._blendEquationParameters[1]), this._isBlendEquationParametersDirty = !1), this._isBlendConstantsDirty && (e.blendColor(this._blendConstants[0], this._blendConstants[1], this._blendConstants[2], this._blendConstants[3]), this._isBlendConstantsDirty = !1)) }, e }(), r = function() { function e() { this._isDepthTestDirty = !1, this._isDepthMaskDirty = !1, this._isDepthFuncDirty = !1, this._isCullFaceDirty = !1, this._isCullDirty = !1, this._isZOffsetDirty = !1, this._isFrontFaceDirty = !1, 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "zOffset", { get: function() { return this._zOffset }, set: function(e) { this._zOffset !== e && (this._zOffset = e, this._isZOffsetDirty = !0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "cullFace", { get: function() { return this._cullFace }, set: function(e) { this._cullFace !== e && (this._cullFace = e, this._isCullFaceDirty = !0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "cull", { get: function() { return this._cull }, set: function(e) { this._cull !== e && (this._cull = e, this._isCullDirty = !0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "depthFunc", { get: function() { return this._depthFunc }, set: function(e) { this._depthFunc !== e && (this._depthFunc = e, this._isDepthFuncDirty = !0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "depthMask", { get: function() { return this._depthMask }, set: function(e) { this._depthMask !== e && (this._depthMask = e, this._isDepthMaskDirty = !0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "depthTest", { get: function() { return this._depthTest }, set: function(e) { this._depthTest !== e && (this._depthTest = e, this._isDepthTestDirty = !0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "frontFace", { get: function() { return this._frontFace }, set: function(e) { this._frontFace !== e && (this._frontFace = e, this._isFrontFaceDirty = !0) }, enumerable: !0, configurable: !0 }), e.prototype.reset = function() { this._depthMask = !0, this._depthTest = !0, this._depthFunc = null, this._cullFace = null, this._cull = null, this._zOffset = 0, this._frontFace = null, this._isDepthTestDirty = !0, this._isDepthMaskDirty = !0, this._isDepthFuncDirty = !1, this._isCullFaceDirty = !1, this._isCullDirty = !1, this._isZOffsetDirty = !1, this._isFrontFaceDirty = !1 }, e.prototype.apply = function(e) { this.isDirty && (this._isCullDirty && (this.cull ? e.enable(e.CULL_FACE) : e.disable(e.CULL_FACE), this._isCullDirty = !1), this._isCullFaceDirty && (e.cullFace(this.cullFace), this._isCullFaceDirty = !1), this._isDepthMaskDirty && (e.depthMask(this.depthMask), this._isDepthMaskDirty = !1), this._isDepthTestDirty && (this.depthTest ? e.enable(e.DEPTH_TEST) : e.disable(e.DEPTH_TEST), this._isDepthTestDirty = !1), this._isDepthFuncDirty && (e.depthFunc(this.depthFunc), this._isDepthFuncDirty = !1), this._isZOffsetDirty && (this.zOffset ? (e.enable(e.POLYGON_OFFSET_FILL), e.polygonOffset(this.zOffset, 0)) : e.disable(e.POLYGON_OFFSET_FILL), this._isZOffsetDirty = !1), this._isFrontFaceDirty && (e.frontFace(this.frontFace), this._isFrontFaceDirty = !1)) }, e }(), o = i(3), s = function() { function e() { this._isStencilTestDirty = !1, this._isStencilMaskDirty = !1, this._isStencilFuncDirty = !1, this._isStencilOpDirty = !1, this.reset() } return Object.defineProperty(e.prototype, "isDirty", { get: function() { return this._isStencilTestDirty || this._isStencilMaskDirty || this._isStencilFuncDirty || this._isStencilOpDirty }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "stencilFunc", { get: function() { return this._stencilFunc }, set: function(e) { this._stencilFunc !== e && (this._stencilFunc = e, this._isStencilFuncDirty = !0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "stencilFuncRef", { get: function() { return this._stencilFuncRef }, set: function(e) { this._stencilFuncRef !== e && (this._stencilFuncRef = e, this._isStencilFuncDirty = !0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "stencilFuncMask", { get: function() { return this._stencilFuncMask }, set: function(e) { this._stencilFuncMask !== e && (this._stencilFuncMask = e, this._isStencilFuncDirty = !0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "stencilOpStencilFail", { get: function() { return this._stencilOpStencilFail }, set: function(e) { this._stencilOpStencilFail !== e && (this._stencilOpStencilFail = e, this._isStencilOpDirty = !0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "stencilOpDepthFail", { get: function() { return this._stencilOpDepthFail }, set: function(e) { this._stencilOpDepthFail !== e && (this._stencilOpDepthFail = e, this._isStencilOpDirty = !0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "stencilOpStencilDepthPass", { get: function() { return this._stencilOpStencilDepthPass }, set: function(e) { this._stencilOpStencilDepthPass !== e && (this._stencilOpStencilDepthPass = e, this._isStencilOpDirty = !0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "stencilMask", { get: function() { return this._stencilMask }, set: function(e) { this._stencilMask !== e && (this._stencilMask = e, this._isStencilMaskDirty = !0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "stencilTest", { get: function() { return this._stencilTest }, set: function(e) { this._stencilTest !== e && (this._stencilTest = e, this._isStencilTestDirty = !0) }, enumerable: !0, configurable: !0 }), e.prototype.reset = function() { this._stencilTest = !1, 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 = !0, this._isStencilMaskDirty = !0, this._isStencilFuncDirty = !0, this._isStencilOpDirty = !0 }, e.prototype.apply = function(e) { this.isDirty && (this._isStencilTestDirty && (this.stencilTest ? e.enable(e.STENCIL_TEST) : e.disable(e.STENCIL_TEST), this._isStencilTestDirty = !1), this._isStencilMaskDirty && (e.stencilMask(this.stencilMask), this._isStencilMaskDirty = !1), this._isStencilFuncDirty && (e.stencilFunc(this.stencilFunc, this.stencilFuncRef, this.stencilFuncMask), this._isStencilFuncDirty = !1), this._isStencilOpDirty && (e.stencilOp(this.stencilOpStencilFail, this.stencilOpDepthFail, this.stencilOpStencilDepthPass), this._isStencilOpDirty = !1)) }, 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, "b", function() { return r }), i.d(t, "c", function() { return s }) }, function(e, t, i) { "use strict"; var n = "clipPlaneFragmentDeclaration", r = "#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"; i(5).a.IncludesShadersStore[n] = r }, function(e, t, i) { "use strict"; var n = "clipPlaneVertexDeclaration", r = "#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"; i(5).a.IncludesShadersStore[n] = r }, function(e, t, i) { "use strict"; i.r(t); var n = i(30), r = i(8), o = i(0), s = i(22), a = function() { function e(e, t) { this.triggerOptions = e, this.onBeforeExecuteObservable = new r.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 = !1); t._currentResult = !0 } } 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, 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 o.w ? e.x + ", " + e.y : e instanceof o.x ? e.x + ", " + e.y + ", " + e.z : e instanceof o.e ? e.r + ", " + e.g + ", " + e.b : e instanceof o.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"] = a; var c = i(36), l = i(1), u = function() { function e(e) { this._actionManager = e } return e.prototype.isValid = function() { return !0 }, 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 }(), h = function(e) { function t(i, n, r, o, s) { void 0 === s && (s = t.IsEqual); var a = e.call(this, i) || this; return a.propertyPath = r, a.value = o, a.operator = s, a._target = n, a._effectiveTarget = a._getEffectiveTarget(n, a.propertyPath), a._property = a._getProperty(a.propertyPath), a } return l.d(t, e), Object.defineProperty(t, "IsEqual", { get: function() { return t._IsEqual }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "IsDifferent", { get: function() { return t._IsDifferent }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "IsGreater", { get: function() { return t._IsGreater }, enumerable: !0, configurable: !0 }), Object.defineProperty(t, "IsLesser", { get: function() { return t._IsLesser }, enumerable: !0, configurable: !0 }), t.prototype.isValid = function() { switch (this.operator) { case t.IsGreater: return this._effectiveTarget[this._property] > this.value; case t.IsLesser: 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], this.operator === t.IsEqual ? e : !e } return !1 }, t.prototype.serialize = function() { return this._serialize({ name: "ValueCondition", properties: [a._GetTargetProperty(this._target), { name: "propertyPath", value: this.propertyPath }, { name: "value", value: a._SerializeValueAsString(this.value) }, { name: "operator", value: t.GetOperatorName(this.operator) }] }) }, t.GetOperatorName = function(e) { switch (e) { case t._IsEqual: return "IsEqual"; case t._IsDifferent: return "IsDifferent"; case t._IsGreater: return "IsGreater"; case t._IsLesser: return "IsLesser"; default: return "" } }, t._IsEqual = 0, t._IsDifferent = 1, t._IsGreater = 2, t._IsLesser = 3, t }(u), d = function(e) { function t(t, i) { var n = e.call(this, t) || this; return n.predicate = i, n } return l.d(t, e), t.prototype.isValid = function() { return this.predicate() }, t }(u), f = function(e) { function t(t, i, n) { var r = e.call(this, t) || this; return r.value = n, r._target = i, r } return l.d(t, e), t.prototype.isValid = function() { return this._target.state === this.value }, t.prototype.serialize = function() { return this._serialize({ name: "StateCondition", properties: [a._GetTargetProperty(this._target), { name: "value", value: this.value }] }) }, t }(u); s.a.RegisteredTypes["BABYLON.ValueCondition"] = h, s.a.RegisteredTypes["BABYLON.PredicateCondition"] = d, s.a.RegisteredTypes["BABYLON.StateCondition"] = f; var p = i(6), _ = i(3), g = 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 l.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: [a._GetTargetProperty(this._target), { name: "propertyPath", value: this.propertyPath }] }, t) }, t }(a), m = 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 l.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: [a._GetTargetProperty(this._target), { name: "value", value: this.value }] }, t) }, t }(a), v = function(e) { function t(t, i, n, r, o) { var s = e.call(this, t, o) || this; return s.propertyPath = n, s.value = r, s._target = s._effectiveTarget = i, s } return l.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: [a._GetTargetProperty(this._target), { name: "propertyPath", value: this.propertyPath }, { name: "value", value: a._SerializeValueAsString(this.value) }] }, t) }, t }(a), y = function(e) { function t(t, i, n, r, o) { var s = e.call(this, t, o) || this; return s.propertyPath = n, s.value = r, s._target = s._effectiveTarget = i, s } return l.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] && p.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: [a._GetTargetProperty(this._target), { name: "propertyPath", value: this.propertyPath }, { name: "value", value: a._SerializeValueAsString(this.value) }] }, t) }, t }(a), b = function(e) { function t(t, i, n, r, o, s) { var a = e.call(this, t, s) || this; return a.from = n, a.to = r, a.loop = o, a._target = i, a } return l.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: [a._GetTargetProperty(this._target), { name: "from", value: String(this.from) }, { name: "to", value: String(this.to) }, { name: "loop", value: a._SerializeValueAsString(this.loop) || !1 }] }, t) }, t }(a), T = function(e) { function t(t, i, n) { var r = e.call(this, t, n) || this; return r._target = i, r } return l.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: [a._GetTargetProperty(this._target)] }, t) }, t }(a), E = function(e) { function t(t, i) { return void 0 === t && (t = _.a.ACTION_NothingTrigger), e.call(this, t, i) || this } return l.d(t, e), t.prototype.execute = function() {}, t.prototype.serialize = function(t) { return e.prototype._serialize.call(this, { name: "DoNothingAction", properties: [] }, t) }, t }(a), A = function(e) { function t(t, i, n) { var r = e.call(this, t, n) || this; return r.children = i, r } return l.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 }(a), x = function(e) { function t(t, i, n) { var r = e.call(this, t, n) || this; return r.func = i, r } return l.d(t, e), t.prototype.execute = function(e) { this.func(e) }, t }(a), R = 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 l.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 = o.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: [a._GetTargetProperty(this._target), a._GetTargetProperty(this._parent)] }, t) }, t }(a); s.a.RegisteredTypes["BABYLON.SetParentAction"] = R, s.a.RegisteredTypes["BABYLON.ExecuteCodeAction"] = x, s.a.RegisteredTypes["BABYLON.DoNothingAction"] = E, s.a.RegisteredTypes["BABYLON.StopAnimationAction"] = T, s.a.RegisteredTypes["BABYLON.PlayAnimationAction"] = b, s.a.RegisteredTypes["BABYLON.IncrementValueAction"] = y, s.a.RegisteredTypes["BABYLON.SetValueAction"] = v, s.a.RegisteredTypes["BABYLON.SetStateAction"] = m, s.a.RegisteredTypes["BABYLON.SetParentAction"] = R; var P = i(23), S = i(32), C = function(e) { function t(t) { var i = e.call(this) || this; return i._scene = t || P.a.LastCreatedScene, t.actionManagers.push(i), i } return l.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 !0 } return !1 }, 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 !0 } return !1 }, 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 !0; if (t(n.getTriggerParameter())) return !0 } } return !1 }, 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 !0 } return !1 }, enumerable: !0, configurable: !0 }), 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 !0 } return !1 }, enumerable: !0, configurable: !0 }), t.prototype.registerAction = function(e) { return e.trigger === t.OnEveryFrameTrigger && this.getScene().actionManager !== this ? (p.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, !0) }, 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 s = o.toLowerCase(); if (s !== i.sourceEvent.key) { var a = i.sourceEvent.charCode ? i.sourceEvent.charCode : i.sourceEvent.keyCode; if (String.fromCharCode(a).toLowerCase() !== s) 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, 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(a._GetTargetProperty(o.parameter)); else { var s = {}; S.a.DeepCopy(o.parameter, s, ["mesh"]), o.parameter && o.parameter.mesh && (s._meshId = o.parameter.mesh.id), r.properties.push({ name: "parameter", targetType: null, value: s }) } 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 a = function(e, t, i, n) { if (null === n) { var r = parseFloat(t); return "true" === t || "false" === t ? "true" === t : isNaN(r) ? t : r } for (var s = n.split("."), a = t.split(","), c = 0; c < s.length; c++) i = i[s[c]]; if ("boolean" == typeof i) return "true" === a[0]; if ("string" == typeof i) return a[0]; var l = new Array; for (c = 0; c < a.length; c++) l.push(parseFloat(a[c])); return i instanceof o.x ? o.x.FromArray(l) : i instanceof o.y ? o.y.FromArray(l) : i instanceof o.e ? o.e.FromArray(l) : i instanceof o.f ? o.f.FromArray(l) : parseFloat(a[0]) }, c = function(e, i, o, l, d) { if (void 0 === d && (d = null), !e.detached) { var f = new Array, p = null, _ = null, g = e.combine && e.combine.length > 0; if (2 === e.type ? f.push(r) : f.push(i), g) { for (var m = new Array, v = 0; v < e.combine.length; v++) c(e.combine[v], t.NothingTrigger, o, l, m); f.push(m) } else for (var y = 0; y < e.properties.length; y++) { var b = e.properties[y].value, T = e.properties[y].name, A = e.properties[y].targetType; "target" === T ? b = p = null !== A && "SceneProperties" === A ? n : n.getNodeByName(b) : "parent" === T ? b = n.getNodeByName(b) : "sound" === T ? n.getSoundByName && (b = n.getSoundByName(b)) : "propertyPath" !== T ? b = 2 === e.type && "operator" === T ? h[b] : a(0, b, p, "value" === T ? _ : null) : _ = b, f.push(b) } if (null === d ? f.push(o) : f.push(null), "InterpolateValueAction" === e.name) { var x = f[f.length - 2]; f[f.length - 1] = x, f[f.length - 2] = o } var R = 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 } }(e.name, f); if (R instanceof u && null !== o) { var P = new E(i, o); l ? l.then(P) : r.registerAction(P), l = P } null === d ? R instanceof u ? (o = R, R = l) : (o = null, l ? l.then(R) : r.registerAction(R)) : d.push(R); for (y = 0; y < e.children.length; y++) c(e.children[y], i, o, R, null) } }, l = 0; l < e.children.length; l++) { var d, f = e.children[l]; if (f.properties.length > 0) { var p = f.properties[0].value, _ = null === f.properties[0].targetType ? p : n.getMeshByName(p); _._meshId && (_.mesh = n.getMeshByID(_._meshId)), d = { trigger: t[f.name], parameter: _ } } else d = t[f.name]; for (var g = 0; g < f.children.length; g++) f.detached || c(f.children[g], d, null, null) } }, t.GetTriggerName = function(e) { switch (e) { case 0: return "NothingTrigger"; case 1: return "OnPickTrigger"; case 2: return "OnLeftPickTrigger"; case 3: return "OnRightPickTrigger"; case 4: return "OnCenterPickTrigger"; case 5: return "OnPickDownTrigger"; case 6: return "OnPickUpTrigger"; case 7: return "OnLongPressTrigger"; case 8: return "OnPointerOverTrigger"; case 9: return "OnPointerOutTrigger"; case 10: return "OnEveryFrameTrigger"; case 11: return "OnIntersectionEnterTrigger"; case 12: return "OnIntersectionExitTrigger"; case 13: return "OnKeyDownTrigger"; case 14: return "OnKeyUpTrigger"; case 15: 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, t }(i(79).a), M = function(e) { function t(t, i, n) { var r = e.call(this, t, n) || this; return r._sound = i, r } return l.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 }(a), O = function(e) { function t(t, i, n) { var r = e.call(this, t, n) || this; return r._sound = i, r } return l.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 }(a); s.a.RegisteredTypes["BABYLON.PlaySoundAction"] = O, s.a.RegisteredTypes["BABYLON.StopSoundAction"] = O; var I, D = i(12), L = i(2); ! function(e) { e[e.STEP = 1] = "STEP" }(I || (I = {})); var w = 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 }(), F = i(25), N = function() { return function() {} }(), B = function() { function e(t, i, n, r, o, s) { this.name = t, this.targetProperty = i, this.framePerSecond = n, this.dataType = r, this.loopMode = o, this.enableBlending = s, 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, s, a, c, l) { var u = void 0; if (!isNaN(parseFloat(s)) && isFinite(s) ? u = e.ANIMATIONTYPE_FLOAT : s instanceof o.q ? u = e.ANIMATIONTYPE_QUATERNION : s instanceof o.x ? u = e.ANIMATIONTYPE_VECTOR3 : s instanceof o.w ? u = e.ANIMATIONTYPE_VECTOR2 : s instanceof o.e ? u = e.ANIMATIONTYPE_COLOR3 : s instanceof o.r && (u = e.ANIMATIONTYPE_SIZE), null == u) return null; var h = new e(t, i, n, u, c), d = [{ frame: 0, value: s }, { frame: r, value: a }]; return h.setKeys(d), void 0 !== l && h.setEasingFunction(l), 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, s, a, c, l, u) { var h = e._PrepareAnimation(t, n, r, o, s, a, c, l); return h ? i.getScene().beginDirectAnimation(i, [h], 0, o, 1 === h.loopMode, 1, u) : null }, e.CreateAndStartHierarchyAnimation = function(t, i, n, r, o, s, a, c, l, u, h) { var d = e._PrepareAnimation(t, r, o, s, a, c, l, u); return d ? i.getScene().beginDirectHierarchyAnimation(i, n, [d], 0, s, 1 === d.loopMode, 1, h) : null }, e.CreateMergeAndStartAnimation = function(t, i, n, r, o, s, a, c, l, u) { var h = e._PrepareAnimation(t, n, r, o, s, a, c, l); return h ? (i.animations.push(h), i.getScene().beginAnimation(i, 0, o, 1 === h.loopMode, 1, u)) : null }, e.TransitionTo = function(e, t, i, n, r, o, s, a) { if (void 0 === a && (a = null), s <= 0) return i[e] = t, a && a(), null; var c = r * (s / 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 l = n.beginAnimation(i, 0, c, !1); return l.onAnimationEnd = a, l }, Object.defineProperty(e.prototype, "runtimeAnimations", { get: function() { return this._runtimeAnimations }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "hasRunningRuntimeAnimations", { get: function() { for (var e = 0, t = this._runtimeAnimations; e < t.length; e++) { if (!t[e].isStopped) return !0 } return !1 }, enumerable: !0, configurable: !0 }), 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 = !0; for (var n in this._ranges) i && (t += ", ", i = !1), t += n; t += "}" } 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 w(e, t, i)) }, e.prototype.deleteRange = function(e, t) { void 0 === t && (t = !0); 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 D.a.Lerp(e, t, i) }, e.prototype.floatInterpolateFunctionWithTangents = function(e, t, i, n, r) { return D.a.Hermite(e, t, i, n, r) }, e.prototype.quaternionInterpolateFunction = function(e, t, i) { return o.q.Slerp(e, t, i) }, e.prototype.quaternionInterpolateFunctionWithTangents = function(e, t, i, n, r) { return o.q.Hermite(e, t, i, n, r).normalize() }, e.prototype.vector3InterpolateFunction = function(e, t, i) { return o.x.Lerp(e, t, i) }, e.prototype.vector3InterpolateFunctionWithTangents = function(e, t, i, n, r) { return o.x.Hermite(e, t, i, n, r) }, e.prototype.vector2InterpolateFunction = function(e, t, i) { return o.w.Lerp(e, t, i) }, e.prototype.vector2InterpolateFunctionWithTangents = function(e, t, i, n, r) { return o.w.Hermite(e, t, i, n, r) }, e.prototype.sizeInterpolateFunction = function(e, t, i) { return o.r.Lerp(e, t, i) }, e.prototype.color3InterpolateFunction = function(e, t, i) { return o.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 s = n[o + 1]; if (s.frame >= t) { i.key = o; var a = n[o], c = this._getKeyValue(a.value); if (a.interpolation === I.STEP) return c; var l = this._getKeyValue(s.value), u = void 0 !== a.outTangent && void 0 !== s.inTangent, h = s.frame - a.frame, d = (t - a.frame) / h, f = this.getEasingFunction(); switch (null != f && (d = f.ease(d)), this.dataType) { case e.ANIMATIONTYPE_FLOAT: var p = u ? this.floatInterpolateFunctionWithTangents(c, a.outTangent * h, l, s.inTangent * h, d) : this.floatInterpolateFunction(c, l, d); 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 _ = u ? this.quaternionInterpolateFunctionWithTangents(c, a.outTangent.scale(h), l, s.inTangent.scale(h), d) : this.quaternionInterpolateFunction(c, l, d); switch (i.loopMode) { case e.ANIMATIONLOOPMODE_CYCLE: case e.ANIMATIONLOOPMODE_CONSTANT: return _; case e.ANIMATIONLOOPMODE_RELATIVE: return _.addInPlace(i.offsetValue.scale(i.repeatCount)) } return _; case e.ANIMATIONTYPE_VECTOR3: var g = u ? this.vector3InterpolateFunctionWithTangents(c, a.outTangent.scale(h), l, s.inTangent.scale(h), d) : this.vector3InterpolateFunction(c, l, d); 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 m = u ? this.vector2InterpolateFunctionWithTangents(c, a.outTangent.scale(h), l, s.inTangent.scale(h), d) : this.vector2InterpolateFunction(c, l, d); switch (i.loopMode) { case e.ANIMATIONLOOPMODE_CYCLE: case e.ANIMATIONLOOPMODE_CONSTANT: return m; case e.ANIMATIONLOOPMODE_RELATIVE: return m.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, l, d); case e.ANIMATIONLOOPMODE_RELATIVE: return this.sizeInterpolateFunction(c, l, d).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, l, d); case e.ANIMATIONLOOPMODE_RELATIVE: return this.color3InterpolateFunction(c, l, d).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, l, d, 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 ? (o.j.DecomposeLerpToRef(t, i, n, r), r) : o.j.DecomposeLerp(t, i, n) : r ? (o.j.LerpToRef(t, i, n, r), r) : o.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], s = {}; switch (s.frame = o.frame, i) { case e.ANIMATIONTYPE_FLOAT: s.values = [o.value]; break; case e.ANIMATIONTYPE_QUATERNION: case e.ANIMATIONTYPE_MATRIX: case e.ANIMATIONTYPE_VECTOR3: case e.ANIMATIONTYPE_COLOR3: s.values = o.value.asArray() } t.keys.push(s) } for (var a in t.ranges = [], this._ranges) { var c = this._ranges[a]; if (c) { var l = {}; l.name = a, l.from = c.from, l.to = c.to, t.ranges.push(l) } } return t }, Object.defineProperty(e, "ANIMATIONTYPE_FLOAT", { get: function() { return e._ANIMATIONTYPE_FLOAT }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "ANIMATIONTYPE_VECTOR3", { get: function() { return e._ANIMATIONTYPE_VECTOR3 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "ANIMATIONTYPE_VECTOR2", { get: function() { return e._ANIMATIONTYPE_VECTOR2 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "ANIMATIONTYPE_SIZE", { get: function() { return e._ANIMATIONTYPE_SIZE }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "ANIMATIONTYPE_QUATERNION", { get: function() { return e._ANIMATIONTYPE_QUATERNION }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "ANIMATIONTYPE_MATRIX", { get: function() { return e._ANIMATIONTYPE_MATRIX }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "ANIMATIONTYPE_COLOR3", { get: function() { return e._ANIMATIONTYPE_COLOR3 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "ANIMATIONLOOPMODE_RELATIVE", { get: function() { return e._ANIMATIONLOOPMODE_RELATIVE }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "ANIMATIONLOOPMODE_CYCLE", { get: function() { return e._ANIMATIONLOOPMODE_CYCLE }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "ANIMATIONLOOPMODE_CONSTANT", { get: function() { return e._ANIMATIONLOOPMODE_CONSTANT }, enumerable: !0, configurable: !0 }), 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), s = t.dataType, a = []; for (t.enableBlending && (r.enableBlending = t.enableBlending), t.blendingSpeed && (r.blendingSpeed = t.blendingSpeed), n = 0; n < t.keys.length; n++) { var c, l, u = t.keys[n]; switch (s) { case e.ANIMATIONTYPE_FLOAT: i = u.values[0], u.values.length >= 1 && (c = u.values[1]), u.values.length >= 2 && (l = u.values[2]); break; case e.ANIMATIONTYPE_QUATERNION: if (i = o.q.FromArray(u.values), u.values.length >= 8) { var h = o.q.FromArray(u.values.slice(4, 8)); h.equals(o.q.Zero()) || (c = h) } if (u.values.length >= 12) { var d = o.q.FromArray(u.values.slice(8, 12)); d.equals(o.q.Zero()) || (l = d) } break; case e.ANIMATIONTYPE_MATRIX: i = o.j.FromArray(u.values); break; case e.ANIMATIONTYPE_COLOR3: i = o.e.FromArray(u.values); break; case e.ANIMATIONTYPE_VECTOR3: default: i = o.x.FromArray(u.values) } var f = {}; f.frame = u.frame, f.value = i, null != c && (f.inTangent = c), null != l && (f.outTangent = l), a.push(f) } if (r.setKeys(a), 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) { L.a.AppendSerializedAnimations(e, t) }, e.AllowMatricesInterpolation = !1, e.AllowMatrixDecomposeForInterpolation = !0, 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"] = B, F.a._AnimationRangeFactory = function(e, t, i) { return new w(e, t, i) }; var U = function(e) { function t(t, i, n, o, s, a, c, l) { void 0 === s && (s = 1e3); var u = e.call(this, t, a) || this; return u.duration = 1e3, u.onInterpolationDoneObservable = new r.c, u.propertyPath = n, u.value = o, u.duration = s, u.stopOtherAnimations = c, u.onInterpolationDone = l, u._target = u._effectiveTarget = i, u } return l.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 = B.ANIMATIONTYPE_FLOAT; else if (this.value instanceof o.e) e = B.ANIMATIONTYPE_COLOR3; else if (this.value instanceof o.x) e = B.ANIMATIONTYPE_VECTOR3; else if (this.value instanceof o.j) e = B.ANIMATIONTYPE_MATRIX; else { if (!(this.value instanceof o.q)) return void p.a.Warn("InterpolateValueAction: Unsupported type (" + typeof this.value + ")"); e = B.ANIMATIONTYPE_QUATERNION } var r = new B("InterpolateValueAction", this._property, 1e3 / this.duration * 100, e, B.ANIMATIONLOOPMODE_CONSTANT); r.setKeys(n), this.stopOtherAnimations && i.stopAnimation(this._effectiveTarget); i.beginDirectAnimation(this._effectiveTarget, [r], 0, 100, !1, 1, function() { t.onInterpolationDoneObservable.notifyObservers(t), t.onInterpolationDone && t.onInterpolationDone() }) }, t.prototype.serialize = function(t) { return e.prototype._serialize.call(this, { name: "InterpolateValueAction", properties: [a._GetTargetProperty(this._target), { name: "propertyPath", value: this.propertyPath }, { name: "value", value: a._SerializeValueAsString(this.value) }, { name: "duration", value: a._SerializeValueAsString(this.duration) }, { name: "stopOtherAnimations", value: a._SerializeValueAsString(this.stopOtherAnimations) || !1 }] }, t) }, t }(a); s.a.RegisteredTypes["BABYLON.InterpolateValueAction"] = U; var V = Object.freeze(new o.q(0, 0, 0, 0)), G = Object.freeze(o.x.Zero()), k = Object.freeze(o.w.Zero()), z = Object.freeze(o.r.Zero()), j = Object.freeze(o.e.Black()), H = 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 = !1, 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 = !1, 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 === B.ANIMATIONTYPE_MATRIX && (this._animationState.workValue = o.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 s = { frame: 0, value: this._minValue }; this._keys.splice(0, 0, s) } if (this._target instanceof Array) { for (var a = 0, c = 0, l = this._target; c < l.length; c++) { var u = l[c]; this._preparePath(u, a), this._getOriginalValues(a), a++ } this._targetIsArray = !0 } else this._preparePath(this._target), this._getOriginalValues(), this._targetIsArray = !1, 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "weight", { get: function() { return this._weight }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "currentValue", { get: function() { return this._currentValue }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "targetPath", { get: function() { return this._targetPath }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "target", { get: function() { return this._currentActiveTarget }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), e.prototype.reset = function(e) { if (void 0 === e && (e = !1), 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); this._offsetsCache = {}, this._highLimitsCache = {}, this._currentFrame = 0, this._blendingFactor = 0; for (t = 0; t < this._events.length; t++) this._events[t].isDone = !1 }, 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) } 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 s = t[this._targetPath]; s.clone ? this._originalBlendValue = s.clone() : this._originalBlendValue = s } this._originalBlendValue.m ? B.AllowMatrixDecomposeForInterpolation ? this._currentValue ? o.j.DecomposeLerpToRef(this._originalBlendValue, i, this._blendingFactor, this._currentValue) : this._currentValue = o.j.DecomposeLerp(this._originalBlendValue, i, this._blendingFactor) : this._currentValue ? o.j.LerpToRef(this._originalBlendValue, i, this._blendingFactor, this._currentValue) : this._currentValue = o.j.Lerp(this._originalBlendValue, i, this._blendingFactor) : this._currentValue = B._UniversalLerp(this._originalBlendValue, i, this._blendingFactor); var a = e && e.animationPropertiesOverride ? e.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed; this._blendingFactor += a } 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 s = this._animation, a = s.targetPropertyPath; if (!a || a.length < 1) return this._stopped = !0, !1; var c = !0; (t < this._minFrame || t > this._maxFrame) && (t = this._minFrame), (i < this._minFrame || i > this._maxFrame) && (i = this._maxFrame); var l, u, h = i - t, d = e * (s.framePerSecond * r) / 1e3 + this._ratioOffset, f = 0; if (this._previousDelay = e, this._previousRatio = d, !n && i >= t && d >= h) c = !1, f = s._getKeyValue(this._maxValue); else if (!n && t >= i && d <= h) c = !1, f = s._getKeyValue(this._minValue); else if (this._animationState.loopMode !== B.ANIMATIONLOOPMODE_CYCLE) { var p = i.toString() + t.toString(); if (!this._offsetsCache[p]) { this._animationState.repeatCount = 0, this._animationState.loopMode = B.ANIMATIONLOOPMODE_CYCLE; var _ = s._interpolate(t, this._animationState), g = s._interpolate(i, this._animationState); switch (this._animationState.loopMode = this._getCorrectLoopMode(), s.dataType) { case B.ANIMATIONTYPE_FLOAT: this._offsetsCache[p] = g - _; break; case B.ANIMATIONTYPE_QUATERNION: this._offsetsCache[p] = g.subtract(_); break; case B.ANIMATIONTYPE_VECTOR3: this._offsetsCache[p] = g.subtract(_); case B.ANIMATIONTYPE_VECTOR2: this._offsetsCache[p] = g.subtract(_); case B.ANIMATIONTYPE_SIZE: this._offsetsCache[p] = g.subtract(_); case B.ANIMATIONTYPE_COLOR3: this._offsetsCache[p] = g.subtract(_) } this._highLimitsCache[p] = g } f = this._highLimitsCache[p], l = this._offsetsCache[p] } if (void 0 === l) switch (s.dataType) { case B.ANIMATIONTYPE_FLOAT: l = 0; break; case B.ANIMATIONTYPE_QUATERNION: l = V; break; case B.ANIMATIONTYPE_VECTOR3: l = G; break; case B.ANIMATIONTYPE_VECTOR2: l = k; break; case B.ANIMATIONTYPE_SIZE: l = z; break; case B.ANIMATIONTYPE_COLOR3: l = j } if (this._host && this._host.syncRoot) { var m = this._host.syncRoot; u = t + (i - t) * ((m.masterFrame - m.fromFrame) / (m.toFrame - m.fromFrame)) } else u = c && 0 !== h ? t + d % h : i; var v = this._events; if ((h > 0 && this.currentFrame > u || h < 0 && this.currentFrame < u) && (this._onLoop(), v.length)) for (var y = 0; y < v.length; y++) v[y].onlyOnce || (v[y].isDone = !1); this._currentFrame = u, this._animationState.repeatCount = 0 === h ? 0 : d / h >> 0, this._animationState.highLimitValue = f, this._animationState.offsetValue = l; var b = s._interpolate(u, this._animationState); if (this.setValue(b, o), v.length) for (y = 0; y < v.length; y++) if (h > 0 && u >= v[y].frame && v[y].frame >= t || h < 0 && u <= v[y].frame && v[y].frame <= t) { var T = v[y]; T.isDone || (T.onlyOnce && (v.splice(y, 1), y--), T.isDone = !0, T.action(u)) } return c || (this._stopped = !0), c }, e }(), W = i(16), X = i(47), Y = i(34), K = function(e) { function t(t, i, n, r, s, a, c) { void 0 === n && (n = null), void 0 === r && (r = null), void 0 === s && (s = null), void 0 === a && (a = null), void 0 === c && (c = null); var l = e.call(this, t, i.getScene(), !1) || this; return l.name = t, l.children = new Array, l.animations = new Array, l._index = null, l._absoluteTransform = new o.j, l._invertedAbsoluteTransform = new o.j, l._scalingDeterminant = 1, l._worldTransform = new o.j, l._needToDecompose = !0, l._needToCompose = !1, l._linkedTransformNode = null, l._waitingTransformNodeId = null, l._skeleton = i, l._localMatrix = r ? r.clone() : o.j.Identity(), l._restPose = s || l._localMatrix.clone(), l._baseMatrix = a || l._localMatrix.clone(), l._index = c, i.bones.push(l), l.setParent(n, !1), (a || r) && l._updateDifferenceMatrix(), l } return l.d(t, e), Object.defineProperty(t.prototype, "_matrix", { get: function() { return this._compose(), this._localMatrix }, set: function(e) { this._localMatrix.copyFrom(e), this._needToDecompose = !0 }, enumerable: !0, configurable: !0 }), 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 = !0), 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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "rotation", { get: function() { return this.getRotation() }, set: function(e) { this.setRotation(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "rotationQuaternion", { get: function() { return this._decompose(), this._localRotation }, set: function(e) { this.setRotationQuaternion(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "scaling", { get: function() { return this.getScale() }, set: function(e) { this.setScale(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "animationPropertiesOverride", { get: function() { return this._skeleton.animationPropertiesOverride }, enumerable: !0, configurable: !0 }), t.prototype._decompose = function() { this._needToDecompose && (this._needToDecompose = !1, this._localScaling || (this._localScaling = o.x.Zero(), this._localRotation = o.q.Zero(), this._localPosition = o.x.Zero()), this._localMatrix.decompose(this._localScaling, this._localRotation, this._localPosition)) }, t.prototype._compose = function() { this._needToCompose && (this._needToCompose = !1, o.j.ComposeToRef(this._localScaling, this._localRotation, this._localPosition, this._localMatrix)) }, t.prototype.updateMatrix = function(e, t, i) { void 0 === t && (t = !0), void 0 === i && (i = !0), 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 = !0), e || (e = this._baseMatrix), 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++, this._childUpdateId++, this._skeleton._markAsDirty() }, t.prototype._markAsDirtyAndCompose = function() { this.markAsDirty(), this._needToCompose = !0 }, t.prototype._markAsDirtyAndDecompose = function() { this.markAsDirty(), this._needToDecompose = !0 }, t.prototype.translate = function(e, i, n) { void 0 === i && (i = o.s.LOCAL); var r = this.getLocalMatrix(); if (i == o.s.LOCAL) r.addAtIndex(12, e.x), r.addAtIndex(13, e.y), r.addAtIndex(14, e.z); else { var s = null; n && (s = n.getWorldMatrix()), this._skeleton.computeAbsoluteTransforms(); var a = t._tmpMats[0], c = t._tmpVecs[0]; this._parent && (n && s ? (a.copyFrom(this._parent.getAbsoluteTransform()), a.multiplyToRef(s, a)) : a.copyFrom(this._parent.getAbsoluteTransform())), a.setTranslationFromFloats(0, 0, 0), a.invert(), o.x.TransformCoordinatesToRef(e, a, 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 = o.s.LOCAL); var r = this.getLocalMatrix(); if (i == o.s.LOCAL) r.setTranslationFromFloats(e.x, e.y, e.z); else { var s = null; n && (s = n.getWorldMatrix()), this._skeleton.computeAbsoluteTransforms(); var a = t._tmpMats[0], c = t._tmpVecs[0]; this._parent && (n && s ? (a.copyFrom(this._parent.getAbsoluteTransform()), a.multiplyToRef(s, a)) : a.copyFrom(this._parent.getAbsoluteTransform())), a.invert(), o.x.TransformCoordinatesToRef(e, a, c), r.setTranslationFromFloats(c.x, c.y, c.z) } this._markAsDirtyAndDecompose() }, t.prototype.setAbsolutePosition = function(e, t) { this.setPosition(e, o.s.WORLD, t) }, t.prototype.scale = function(e, i, n, r) { void 0 === r && (r = !1); var s = this.getLocalMatrix(), a = t._tmpMats[0]; o.j.ScalingToRef(e, i, n, a), a.multiplyToRef(s, s), a.invert(); for (var c = 0, l = this.children; c < l.length; c++) { var u = (f = l[c]).getLocalMatrix(); u.multiplyToRef(a, u), u.multiplyAtIndex(12, e), u.multiplyAtIndex(13, i), u.multiplyAtIndex(14, n), f._markAsDirtyAndDecompose() } if (this._markAsDirtyAndDecompose(), r) for (var h = 0, d = this.children; h < d.length; h++) { var f; (f = d[h]).scale(e, i, n, r) } }, 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, s) { if (void 0 === r && (r = o.s.LOCAL), r === o.s.LOCAL) { var a = t._tmpQuat; return o.q.RotationYawPitchRollToRef(e, i, n, a), void this.setRotationQuaternion(a, r, s) } var c = t._tmpMats[0]; if (this._getNegativeRotationToRef(c, s)) { var l = t._tmpMats[1]; o.j.RotationYawPitchRollToRef(e, i, n, l), c.multiplyToRef(l, l), this._rotateWithMatrix(l, r, s) } }, t.prototype.rotate = function(e, i, n, r) { void 0 === n && (n = o.s.LOCAL); var s = t._tmpMats[0]; s.setTranslationFromFloats(0, 0, 0), o.j.RotationAxisToRef(e, i, s), this._rotateWithMatrix(s, n, r) }, t.prototype.setAxisAngle = function(e, i, n, r) { if (void 0 === n && (n = o.s.LOCAL), n === o.s.LOCAL) { var s = t._tmpQuat; return o.q.RotationAxisToRef(e, i, s), void this.setRotationQuaternion(s, n, r) } var a = t._tmpMats[0]; if (this._getNegativeRotationToRef(a, r)) { var c = t._tmpMats[1]; o.j.RotationAxisToRef(e, i, c), a.multiplyToRef(c, c), this._rotateWithMatrix(c, n, r) } }, t.prototype.setRotation = function(e, t, i) { void 0 === t && (t = o.s.LOCAL), this.setYawPitchRoll(e.y, e.x, e.z, t, i) }, t.prototype.setRotationQuaternion = function(e, i, n) { if (void 0 === i && (i = o.s.LOCAL), i === o.s.LOCAL) return this._decompose(), this._localRotation.copyFrom(e), void this._markAsDirtyAndCompose(); var r = t._tmpMats[0]; if (this._getNegativeRotationToRef(r, n)) { var s = t._tmpMats[1]; o.j.FromQuaternionToRef(e, s), r.multiplyToRef(s, s), this._rotateWithMatrix(s, i, n) } }, t.prototype.setRotationMatrix = function(e, i, n) { if (void 0 === i && (i = o.s.LOCAL), i === o.s.LOCAL) { var r = t._tmpQuat; return o.q.FromRotationMatrixToRef(e, r), void this.setRotationQuaternion(r, i, n) } var s = t._tmpMats[0]; if (this._getNegativeRotationToRef(s, n)) { var a = t._tmpMats[1]; a.copyFrom(e), s.multiplyToRef(e, a), this._rotateWithMatrix(a, i, n) } }, t.prototype._rotateWithMatrix = function(e, i, n) { void 0 === i && (i = o.s.LOCAL); var r = this.getLocalMatrix(), s = r.m[12], a = r.m[13], c = r.m[14], l = this.getParent(), u = t._tmpMats[3], h = t._tmpMats[4]; l && i == o.s.WORLD ? (n ? (u.copyFrom(n.getWorldMatrix()), l.getAbsoluteTransform().multiplyToRef(u, u)) : u.copyFrom(l.getAbsoluteTransform()), h.copyFrom(u), h.invert(), r.multiplyToRef(u, r), r.multiplyToRef(e, r), r.multiplyToRef(h, r)) : i == o.s.WORLD && n ? (u.copyFrom(n.getWorldMatrix()), h.copyFrom(u), h.invert(), r.multiplyToRef(u, r), r.multiplyToRef(e, r), r.multiplyToRef(h, r)) : r.multiplyToRef(e, r), r.setTranslationFromFloats(s, a, 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), o.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), !0) }, t.prototype.getPosition = function(e, t) { void 0 === e && (e = o.s.LOCAL), void 0 === t && (t = null); var i = o.x.Zero(); return this.getPositionToRef(e, t, i), i }, t.prototype.getPositionToRef = function(e, i, n) { if (void 0 === e && (e = o.s.LOCAL), e == o.s.LOCAL) { var r = this.getLocalMatrix(); n.x = r.m[12], n.y = r.m[13], n.z = r.m[14] } else { var s = null; i && (s = i.getWorldMatrix()), this._skeleton.computeAbsoluteTransforms(); var a = t._tmpMats[0]; i && s ? (a.copyFrom(this.getAbsoluteTransform()), a.multiplyToRef(s, a)) : a = this.getAbsoluteTransform(), n.x = a.m[12], n.y = a.m[13], n.z = a.m[14] } }, t.prototype.getAbsolutePosition = function(e) { void 0 === e && (e = null); var t = o.x.Zero(); return this.getPositionToRef(o.s.WORLD, e, t), t }, t.prototype.getAbsolutePositionToRef = function(e, t) { this.getPositionToRef(o.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 = o.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 s = t._tmpMats[0]; s.copyFrom(this.getAbsoluteTransform()), i && r && s.multiplyToRef(r, s), o.x.TransformNormalToRef(e, s, n), n.normalize() }, t.prototype.getRotation = function(e, t) { void 0 === e && (e = o.s.LOCAL), void 0 === t && (t = null); var i = o.x.Zero(); return this.getRotationToRef(e, t, i), i }, t.prototype.getRotationToRef = function(e, i, n) { void 0 === e && (e = o.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 = o.s.LOCAL), void 0 === t && (t = null); var i = o.q.Identity(); return this.getRotationQuaternionToRef(e, t, i), i }, t.prototype.getRotationQuaternionToRef = function(e, i, n) { if (void 0 === e && (e = o.s.LOCAL), void 0 === i && (i = null), e == o.s.LOCAL) this._decompose(), n.copyFrom(this._localRotation); else { var r = t._tmpMats[0], s = this.getAbsoluteTransform(); i ? s.multiplyToRef(i.getWorldMatrix(), r) : r.copyFrom(s), 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 = o.s.LOCAL); var i = o.j.Identity(); return this.getRotationMatrixToRef(e, t, i), i }, t.prototype.getRotationMatrixToRef = function(e, i, n) { if (void 0 === e && (e = o.s.LOCAL), e == o.s.LOCAL) this.getLocalMatrix().getRotationMatrixToRef(n); else { var r = t._tmpMats[0], s = this.getAbsoluteTransform(); i ? s.multiplyToRef(i.getWorldMatrix(), r) : r.copyFrom(s), 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 = o.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 s = t._tmpMats[0]; i && r ? (s.copyFrom(this.getAbsoluteTransform()), s.multiplyToRef(r, s)) : s = this.getAbsoluteTransform(), o.x.TransformCoordinatesToRef(e, s, n) }, t.prototype.getLocalPositionFromAbsolute = function(e, t) { void 0 === t && (t = null); var i = o.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 s = t._tmpMats[0]; s.copyFrom(this.getAbsoluteTransform()), i && r && s.multiplyToRef(r, s), s.invert(), o.x.TransformCoordinatesToRef(e, s, n) }, t._tmpVecs = Y.a.BuildArray(2, o.x.Zero), t._tmpQuat = o.q.Identity(), t._tmpMats = Y.a.BuildArray(5, o.j.Identity), t }(F.a), Q = function() { function e(e, t, i, n, o, s, a, c, l) { void 0 === i && (i = 0), void 0 === n && (n = 100), void 0 === o && (o = !1), void 0 === s && (s = 1), this.target = t, this.fromFrame = i, this.toFrame = n, this.loopAnimation = o, this.onAnimationEnd = a, this.onAnimationLoop = l, this._localDelayOffset = null, this._pausedDelay = null, this._runtimeAnimations = new Array, this._paused = !1, this._speedRatio = 1, this._weight = -1, this._syncRoot = null, this.disposeOnEnd = !0, this.animationStarted = !1, this.onAnimationEndObservable = new r.c, this.onAnimationLoopObservable = new r.c, this._scene = e, c && this.appendAnimations(t, c), this._speedRatio = s, e._activeAnimatables.push(this) } return Object.defineProperty(e.prototype, "syncRoot", { get: function() { return this._syncRoot }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "masterFrame", { get: function() { return 0 === this._runtimeAnimations.length ? 0 : this._runtimeAnimations[0].currentFrame }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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 H(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(!0); 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 = !0, t[i].animation.blendingSpeed = e }, e.prototype.disableBlending = function() { for (var e = this._runtimeAnimations, t = 0; t < e.length; t++) e[t].animation.enableBlending = !1 }, 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 = !0) }, e.prototype.restart = function() { this._paused = !1 }, 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 Promise(function(t, i) { e.onAnimationEndObservable.add(function() { t(e) }, void 0, void 0, e, !0) }) }, e.prototype._animate = function(e) { if (this._paused) return this.animationStarted = !1, null === this._pausedDelay && (this._pausedDelay = e), !0; 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 !0; var t, i = !1, 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 }, e }(); W.a.prototype._animate = function() { if (this.animationsEnabled) { var e = this._activeAnimatables; if (0 !== e.length) { var t = X.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() } } }, W.a.prototype.beginWeightedAnimation = function(e, t, i, n, r, o, s, a, c, l) { void 0 === n && (n = 1), void 0 === o && (o = 1); var u = this.beginAnimation(e, t, i, r, o, s, a, !1, c, l); return u.weight = n, u }, W.a.prototype.beginAnimation = function(e, t, i, n, r, o, s, a, c, l) { void 0 === r && (r = 1), void 0 === a && (a = !0), t > i && r > 0 && (r *= -1), a && this.stopAnimation(e, void 0, c), s || (s = new Q(this, e, t, i, n, r, o, void 0, l)); var u = !c || c(e); if (e.animations && u && s.appendAnimations(e, e.animations), e.getAnimatables) for (var h = e.getAnimatables(), d = 0; d < h.length; d++) this.beginAnimation(h[d], t, i, n, r, o, s, a, c, l); return s.reset(), s }, W.a.prototype.beginHierarchyAnimation = function(e, t, i, n, r, o, s, a, c, l, u) { void 0 === o && (o = 1), void 0 === c && (c = !0); var h = e.getDescendants(t), d = []; d.push(this.beginAnimation(e, i, n, r, o, s, a, c, l)); for (var f = 0, p = h; f < p.length; f++) { var _ = p[f]; d.push(this.beginAnimation(_, i, n, r, o, s, a, c, l)) } return d }, W.a.prototype.beginDirectAnimation = function(e, t, i, n, r, o, s, a) { return void 0 === o && (o = 1), new Q(this, e, i, n, r, o, s, t, a) }, W.a.prototype.beginDirectHierarchyAnimation = function(e, t, i, n, r, o, s, a, c) { var l = e.getDescendants(t), u = []; u.push(this.beginDirectAnimation(e, i, n, r, o, s, a, c)); for (var h = 0, d = l; h < d.length; h++) { var f = d[h]; u.push(this.beginDirectAnimation(f, i, n, r, o, s, a, c)) } return u }, W.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 }, W.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 }, W.a.prototype.stopAnimation = function(e, t, i) { for (var n = 0, r = this.getAllAnimatablesByTarget(e); n < r.length; n++) { r[n].stop(t, i) } }, W.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() } }, W.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 }, W.a.prototype._processLateAnimationBindingsForMatrices = function(e) { var t = 1, i = o.t.Vector3[0], n = o.t.Vector3[1], r = o.t.Quaternion[0], s = 0, a = e.animations[0], c = e.originalValue, l = 1; if (e.totalWeight < 1) c.decompose(n, r, i), l = 1 - e.totalWeight; else if (s = 1, t = e.totalWeight, a.currentValue.decompose(n, r, i), 1 == (l = a.weight / t)) return a.currentValue; n.scaleInPlace(l), i.scaleInPlace(l), r.scaleInPlace(l); for (var u = s; u < e.animations.length; u++) { var h = e.animations[u], d = (l = h.weight / t, o.t.Vector3[2]), f = o.t.Vector3[3], p = o.t.Quaternion[1]; h.currentValue.decompose(f, p, d), f.scaleAndAddToRef(l, n), p.scaleAndAddToRef(l, r), d.scaleAndAddToRef(l, i) } var _ = a._animationState.workValue; return o.j.ComposeToRef(n, r, i, _), _ }, W.a.prototype._processLateAnimationBindingsForQuaternions = function(e, t) { var i = e.animations[0], n = e.originalValue; if (1 === e.animations.length) return o.q.SlerpToRef(n, i.currentValue, Math.min(1, e.totalWeight), t), t; var r, s, a = 1; if (e.totalWeight < 1) { var c = 1 - e.totalWeight; s = [], (r = []).push(n), s.push(c) } else { if (2 === e.animations.length) return o.q.SlerpToRef(e.animations[0].currentValue, e.animations[1].currentValue, e.animations[1].weight / e.totalWeight, t), t; r = [], s = [], a = e.totalWeight } for (var l = 0; l < e.animations.length; l++) { var u = e.animations[l]; r.push(u.currentValue), s.push(u.weight / a) } for (var h = 0, d = null, f = 0; f < r.length;) d ? (h += s[f], o.q.SlerpToRef(d, r[f], s[f] / h, d), f++) : (o.q.SlerpToRef(r[f], r[f + 1], s[f + 1] / (s[f] + s[f + 1]), t), d = t, h = s[f] + s[f + 1], f += 2); return d }, W.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], s = n.originalValue, a = B.AllowMatrixDecomposeForInterpolation && s.m, c = t[i]; if (a) c = this._processLateAnimationBindingsForMatrices(n); else if (void 0 !== s.w) c = this._processLateAnimationBindingsForQuaternions(n, c || o.q.Identity()); else { var l = 0, u = 1; if (n.totalWeight < 1) c = s.scale ? s.scale(1 - n.totalWeight) : s * (1 - n.totalWeight); else { u = n.totalWeight; var h = r.weight / u; c = 1 !== h ? r.currentValue.scale ? r.currentValue.scale(h) : r.currentValue * h : r.currentValue, l = 1 } for (var d = l; d < n.animations.length; d++) { var f = n.animations[d], p = f.weight / u; f.currentValue.scaleAndAddToRef ? f.currentValue.scaleAndAddToRef(p, c) : c += f.currentValue * p } } t[i] = c } t._lateAnimationHolders = {} } this._registeredForLateAnimationBindings.reset() } }, K.prototype.copyAnimationRange = function(e, t, i, n, r) { void 0 === n && (n = !1), void 0 === r && (r = null), 0 === this.animations.length && (this.animations.push(new B(this.name, "_matrix", e.animations[0].framePerSecond, B.ANIMATIONTYPE_MATRIX, 0)), this.animations[0].setKeys([])); var o = e.animations[0].getRange(t); if (!o) return !1; for (var s, a, c, l = o.from, u = o.to, h = e.animations[0].getKeys(), d = e.length, f = e.getParent(), p = this.getParent(), _ = n && f && d && this.length && d !== this.length, g = _ && p && f ? p.length / f.length : 1, m = 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++)(s = h[y]).frame >= l && s.frame <= u && (n ? (c = s.value.clone(), _ ? (a = c.getTranslation(), c.setTranslation(a.scaleInPlace(g))) : m && r ? (a = c.getTranslation(), c.setTranslation(a.multiplyInPlace(r))) : c = s.value) : c = s.value, v.push({ frame: s.frame + i, value: c })); return this.animations[0].createRange(t, l + i, u + i), !0 }; var q = function() { return function() {} }(), Z = 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 = !1, this.onAnimationEndObservable = new r.c, this.onAnimationLoopObservable = new r.c, this.onAnimationGroupEndObservable = new r.c, this.onAnimationGroupPauseObservable = new r.c, this.onAnimationGroupPlayObservable = new r.c, this._scene = t || P.a.LastCreatedScene, this.uniqueId = this._scene.getUniqueId(), this._scene.animationGroups.push(this) } return Object.defineProperty(e.prototype, "from", { get: function() { return this._from }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "to", { get: function() { return this._to }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "isStarted", { get: function() { return this._isStarted }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "isPlaying", { get: function() { return this._isStarted && !this._isPaused }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "targetedAnimations", { get: function() { return this._targetedAnimations }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "animatables", { get: function() { return this._animatables }, enumerable: !0, configurable: !0 }), 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), 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 s = { frame: e, value: r.value, inTangent: r.inTangent, outTangent: r.outTangent, interpolation: r.interpolation }; n.splice(0, 0, s) } if (o.frame < t) { s = { frame: t, value: o.value, inTangent: o.outTangent, outTangent: o.outTangent, interpolation: o.interpolation }; n.push(s) } } return this._from = e, this._to = t, this }, e.prototype.start = function(e, t, i, n) { var r = this; if (void 0 === e && (e = !1), void 0 === t && (t = 1), this._isStarted || 0 === this._targetedAnimations.length) return this; this._loopAnimation = e; for (var o = function(o) { var a = s._scene.beginDirectAnimation(o.target, [o.animation], void 0 !== i ? i : s._from, void 0 !== n ? n : s._to, e, t); a.onAnimationEnd = function() { r.onAnimationEndObservable.notifyObservers(o), r._checkAnimationGroupEnded(a) }, a.onAnimationLoop = function() { r.onAnimationLoopObservable.notifyObservers(o) }, s._animatables.push(a) }, s = this, a = 0, c = this._targetedAnimations; a < c.length; a++) { o(c[a]) } if (this._speedRatio = t, void 0 !== i && void 0 !== n) if (i < n && this._speedRatio < 0) { var l = n; n = i, i = l } else i > n && this._speedRatio > 0 && (this._speedRatio = -t); return this._isStarted = !0, this._isPaused = !1, this.onAnimationGroupPlayObservable.notifyObservers(this), this }, e.prototype.pause = function() { if (!this._isStarted) return this; this._isPaused = !0; 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 = !1, 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 = !1, 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 = !1, 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 s = o[r]; n.addTargetedAnimation(s.animation.clone(), i ? i(s.target) : s.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], s = B.Parse(o.animation), a = o.targetId; if ("influence" === o.animation.property) { var c = i.getMorphTargetById(a); c && n.addTargetedAnimation(s, c) } else { var l = i.getNodeByID(a); null != l && n.addTargetedAnimation(s, l) } } 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), t }, e }(), J = function() { return function() { this.enableBlending = !1, this.blendingSpeed = .01, this.loopMode = B.ANIMATIONLOOPMODE_CYCLE } }(), $ = 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); 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, e }(), ee = function(e) { function t() { return null !== e && e.apply(this, arguments) || this } return l.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 = function(e) { function t(t) { void 0 === t && (t = 1); var i = e.call(this) || this; return i.amplitude = t, i } return l.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 }($), ie = 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 l.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, s = e * o, a = Math.log(-s * (1 - i) + 1) / Math.log(i), c = Math.floor(a), l = c + 1, u = (1 - Math.pow(i, c)) / (r * o), h = .5 * (u + (1 - Math.pow(i, l)) / (r * o)), d = e - h, f = h - u; return -Math.pow(1 / i, t - c) / (f * f) * (d - f) * (d + f) }, t }($), ne = function(e) { function t() { return null !== e && e.apply(this, arguments) || this } return l.d(t, e), t.prototype.easeInCore = function(e) { return e * e * e }, t }($), re = 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 l.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 }($), oe = function(e) { function t(t) { void 0 === t && (t = 2); var i = e.call(this) || this; return i.exponent = t, i } return l.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 }($), se = function(e) { function t(t) { void 0 === t && (t = 2); var i = e.call(this) || this; return i.power = t, i } return l.d(t, e), t.prototype.easeInCore = function(e) { var t = Math.max(0, this.power); return Math.pow(e, t) }, t }($), ae = function(e) { function t() { return null !== e && e.apply(this, arguments) || this } return l.d(t, e), t.prototype.easeInCore = function(e) { return e * e }, t }($), ce = function(e) { function t() { return null !== e && e.apply(this, arguments) || this } return l.d(t, e), t.prototype.easeInCore = function(e) { return e * e * e * e }, t }($), le = function(e) { function t() { return null !== e && e.apply(this, arguments) || this } return l.d(t, e), t.prototype.easeInCore = function(e) { return e * e * e * e * e }, t }($), ue = function(e) { function t() { return null !== e && e.apply(this, arguments) || this } return l.d(t, e), t.prototype.easeInCore = function(e) { return 1 - Math.sin(1.5707963267948966 * (1 - e)) }, t }($), he = 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 l.d(t, e), t.prototype.easeInCore = function(e) { return o.d.Interpolate(e, this.x1, this.y1, this.x2, this.y2) }, t }($), de = function() { function e(e, t, i) { this.frame = e, this.action = t, this.onlyOnce = i, this.isDone = !1 } return e.prototype._clone = function() { return new e(this.frame, this.action, this.onlyOnce) }, e }(), fe = i(11), pe = function(e) { function t() { return null !== e && e.apply(this, arguments) || this } return l.d(t, e), t }(n.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 l.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.meshes.forEach(function(t) { e.scene.addMesh(t) }), this.skeletons.forEach(function(t) { e.scene.addSkeleton(t) }), this.animations.forEach(function(t) { e.scene.addAnimation(t) }), this.animationGroups.forEach(function(t) { e.scene.addAnimationGroup(t) }), this.multiMaterials.forEach(function(t) { e.scene.addMultiMaterial(t) }), this.materials.forEach(function(t) { e.scene.addMaterial(t) }), this.morphTargetManagers.forEach(function(t) { e.scene.addMorphTargetManager(t) }), this.geometries.forEach(function(t) { e.scene.addGeometry(t) }), this.transformNodes.forEach(function(t) { e.scene.addTransformNode(t) }), this.actionManagers.forEach(function(t) { e.scene.addActionManager(t) }), this.textures.forEach(function(t) { e.scene.addTexture(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.meshes.forEach(function(t) { e.scene.removeMesh(t) }), this.skeletons.forEach(function(t) { e.scene.removeSkeleton(t) }), this.animations.forEach(function(t) { e.scene.removeAnimation(t) }), this.animationGroups.forEach(function(t) { e.scene.removeAnimationGroup(t) }), this.multiMaterials.forEach(function(t) { e.scene.removeMultiMaterial(t) }), this.materials.forEach(function(t) { e.scene.removeMaterial(t) }), this.morphTargetManagers.forEach(function(t) { e.scene.removeMorphTargetManager(t) }), this.geometries.forEach(function(t) { e.scene.removeGeometry(t) }), this.transformNodes.forEach(function(t) { e.scene.removeTransformNode(t) }), this.actionManagers.forEach(function(t) { e.scene.removeActionManager(t) }), this.textures.forEach(function(t) { e.scene.removeTexture(t) }), this.reflectionProbes.forEach(function(t) { e.scene.removeReflectionProbe(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.lights = [], this.meshes.forEach(function(e) { e.dispose() }), this.meshes = [], this.skeletons.forEach(function(e) { e.dispose() }), this.skeletons = [], this.animationGroups.forEach(function(e) { e.dispose() }), this.animationGroups = [], this.multiMaterials.forEach(function(e) { e.dispose() }), this.multiMaterials = [], this.materials.forEach(function(e) { e.dispose() }), this.materials = [], this.geometries.forEach(function(e) { e.dispose() }), this.geometries = [], this.transformNodes.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, !0) } }, t.prototype._moveAssets = function(e, t, i) { if (e) for (var n = 0, r = e; n < r.length; n++) { var o = r[n], s = !0; if (i) for (var a = 0, c = i; a < c.length; a++) { if (o === c[a]) { s = !1; break } } s && t.push(o) } }, t.prototype.moveAllFromScene = function(e) { for (var t in void 0 === e && (e = new pe), 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 fe.a("assetContainerRootMesh", this.scene); return this.meshes.forEach(function(t) { t.parent || e.addChild(t) }), this.meshes.unshift(e), e }, t }(n.a), ge = i(10), me = 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 = ge.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, s = this.DEBUGCANVASSIZE.width / this.getFrequencyBinCount(), a = i / this.getFrequencyBinCount() * 360; this._debugCanvasContext.fillStyle = "hsl(" + a + ", 100%, 50%)", this._debugCanvasContext.fillRect(i * s, o, s, 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 }(); ge.b.AudioEngineFactory = function(e) { return new ve(e) }; var ve = function() { function e(e) { var t = this; void 0 === e && (e = null), this._audioContext = null, this._audioContextInitialized = !1, this._muteButton = null, this.canUseWebAudio = !1, this.WarnedWebAudioUnsupported = !1, this.isMP3supported = !1, this.isOGGsupported = !1, this.unlocked = !0, this.useCustomUnlockedButton = !1, this.onAudioUnlockedObservable = new r.c, this.onAudioLockedObservable = new r.c, this._tryToRun = !1, this._onResize = function() { t._moveButtonToTopLeft() }, void 0 === window.AudioContext && void 0 === window.webkitAudioContext || (window.AudioContext = window.AudioContext || window.webkitAudioContext, this.canUseWebAudio = !0); var i = document.createElement("audio"); this._hostElement = e; try { i && i.canPlayType && i.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/, "") && (this.isMP3supported = !0) } catch (e) {} try { i && i.canPlayType && i.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, "") && (this.isOGGsupported = !0) } catch (e) {} } return Object.defineProperty(e.prototype, "audioContext", { get: function() { return this._audioContextInitialized ? this.unlocked || this._muteButton || this._displayMuteButton() : this._initializeAudioContext(), this._audioContext }, enumerable: !0, configurable: !0 }), 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 || Promise.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 = !0, "running" === this._audioContext.state && this._triggerRunningState()) } catch (e) { this.canUseWebAudio = !1, p.a.Error("Web Audio: " + e.message) } }, e.prototype._triggerRunningState = function() { var e = this; this._tryToRun || (this._tryToRun = !0, this._resumeAudioContext().then(function() { e._tryToRun = !1, e._muteButton && e._hideMuteButton() }).catch(function() { e._tryToRun = !1, e.unlocked = !1 }), this.unlocked = !0, this.onAudioUnlockedObservable.notifyObservers(this)) }, e.prototype._triggerSuspendedState = function() { this.unlocked = !1, 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() }, !0), this._muteButton.addEventListener("click", function() { e._triggerRunningState() }, !0), 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 = !1, 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)) }, e }(), ye = i(9), be = i(19), Te = function() { function e(t, i, n, s, a) { var c = this; if (void 0 === s && (s = null), this.autoplay = !1, this.loop = !1, this.useCustomAttenuation = !1, this.isPlaying = !1, this.isPaused = !1, this.spatialSound = !1, this.refDistance = 1, this.rolloffFactor = 1, this.maxDistance = 100, this.distanceModel = "linear", this.onEndedObservable = new r.c, this._panningModel = "equalpower", this._playbackRate = 1, this._streaming = !1, this._startTime = 0, this._startOffset = 0, this._position = o.x.Zero(), this._positionInEmitterSpace = !1, this._localDirection = new o.x(1, 0, 0), this._volume = 1, this._isReadyToPlay = !1, this._isDirectional = !1, this._coneInnerAngle = 360, this._coneOuterAngle = 360, this._coneOuterGain = 0, this._isOutputConnected = !1, this._urlType = "Unknown", this.name = t, this._scene = n, e._SceneComponentInitialization(n), this._readyToPlayCallback = s, this._customAttenuationFunction = function(e, t, i, n, r) { return t < i ? e * (1 - t / i) : 0 }, a && (this.autoplay = a.autoplay || !1, this.loop = a.loop || !1, void 0 !== a.volume && (this._volume = a.volume), this.spatialSound = a.spatialSound || !1, this.maxDistance = a.maxDistance || 100, this.useCustomAttenuation = a.useCustomAttenuation || !1, this.rolloffFactor = a.rolloffFactor || 1, this.refDistance = a.refDistance || 1, this.distanceModel = a.distanceModel || "linear", this._playbackRate = a.playbackRate || 1, this._streaming = a.streaming || !1), ge.b.audioEngine.canUseWebAudio && ge.b.audioEngine.audioContext) { this._soundGain = ge.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 l = !0; 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 u = [], h = !1; switch (this._urlType) { case "MediaStream": this._streaming = !0, this._isReadyToPlay = !0, this._streamingSource = ge.b.audioEngine.audioContext.createMediaStreamSource(i), this.autoplay && this.play(), this._readyToPlayCallback && this._readyToPlayCallback(); break; case "ArrayBuffer": i.byteLength > 0 && (h = !0, this._soundLoaded(i)); break; case "String": u.push(i); case "Array": 0 === u.length && (u = i); for (var d = 0; d < u.length; d++) { var f = u[d]; if (-1 !== f.indexOf(".mp3", f.length - 4) && ge.b.audioEngine.isMP3supported && (h = !0), -1 !== f.indexOf(".ogg", f.length - 4) && ge.b.audioEngine.isOGGsupported && (h = !0), -1 !== f.indexOf(".wav", f.length - 4) && (h = !0), -1 !== f.indexOf("blob:") && (h = !0), h) { this._streaming ? (this._htmlAudioElement = new Audio(f), this._htmlAudioElement.controls = !1, this._htmlAudioElement.loop = this.loop, ye.h.SetCorsBehavior(f, this._htmlAudioElement), this._htmlAudioElement.preload = "auto", this._htmlAudioElement.addEventListener("canplaythrough", function() { c._isReadyToPlay = !0, c.autoplay && c.play(), c._readyToPlayCallback && c._readyToPlayCallback() }), document.body.appendChild(this._htmlAudioElement), this._htmlAudioElement.load()) : this._scene._loadFile(f, function(e) { c._soundLoaded(e) }, void 0, !0, !0, function(e) { e && p.a.Error("XHR " + e.status + " error on: " + f + "."), p.a.Error("Sound creation aborted."), c._scene.mainSoundTrack.RemoveSound(c) }); break } } break; default: l = !1 } l ? h || (this._isReadyToPlay = !0, this._readyToPlayCallback && window.setTimeout(function() { c._readyToPlayCallback && c._readyToPlayCallback() }, 1e3)) : p.a.Error("Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.") } catch (e) { p.a.Error("Unexpected error. Sound creation aborted."), this._scene.mainSoundTrack.RemoveSound(this) } } else this._scene.mainSoundTrack.AddSound(this), ge.b.audioEngine.WarnedWebAudioUnsupported || (p.a.Error("Web Audio is not supported by your browser."), ge.b.audioEngine.WarnedWebAudioUnsupported = !0), this._readyToPlayCallback && window.setTimeout(function() { c._readyToPlayCallback && c._readyToPlayCallback() }, 1e3) } return e.prototype.dispose = function() { ge.b.audioEngine.canUseWebAudio && (this.isPlaying && this.stop(), this._isReadyToPlay = !1, -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; ge.b.audioEngine.audioContext && ge.b.audioEngine.audioContext.decodeAudioData(e, function(e) { t._audioBuffer = e, t._isReadyToPlay = !0, t.autoplay && t.play(), t._readyToPlayCallback && t._readyToPlayCallback() }, function(e) { p.a.Error("Error while decoding audio data for: " + t.name + " / Error: " + e) }) }, e.prototype.setAudioBuffer = function(e) { ge.b.audioEngine.canUseWebAudio && (this._audioBuffer = e, this._isReadyToPlay = !0) }, 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() { ge.b.audioEngine.canUseWebAudio && ge.b.audioEngine.audioContext && (this._scene.headphone && (this._panningModel = "HRTF"), this._soundPanner = ge.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() { ge.b.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner && (this._soundPanner.panningModel = this._panningModel) }, e.prototype.connectToSoundTrackAudioNode = function(e) { ge.b.audioEngine.canUseWebAudio && (this._isOutputConnected && this._outputAudioNode.disconnect(), this._outputAudioNode.connect(e), this._isOutputConnected = !0) }, e.prototype.setDirectionalCone = function(e, t, i) { t < e ? p.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 = !0, 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 p.a.Error("directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle."); this._coneInnerAngle = e, ge.b.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner && (this._soundPanner.coneInnerAngle = this._coneInnerAngle) } }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "directionalConeOuterAngle", { get: function() { return this._coneOuterAngle }, set: function(e) { if (e != this._coneOuterAngle) { if (e < this._coneInnerAngle) return void p.a.Error("directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle."); this._coneOuterAngle = e, ge.b.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner && (this._soundPanner.coneOuterAngle = this._coneOuterAngle) } }, enumerable: !0, configurable: !0 }), e.prototype.setPosition = function(e) { this._position = e, ge.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, ge.b.audioEngine.canUseWebAudio && this._connectedTransformNode && this.isPlaying && this._updateDirection() }, e.prototype._updateDirection = function() { if (this._connectedTransformNode && this._soundPanner) { var e = this._connectedTransformNode.getWorldMatrix(), t = o.x.TransformNormal(this._localDirection, e); t.normalize(), this._soundPanner.setOrientation(t.x, t.y, t.z) } }, e.prototype.updateDistanceFromListener = function() { if (ge.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 && ge.b.audioEngine.audioContext) try { this._startOffset < 0 && (e = -this._startOffset, this._startOffset = 0); var n = e ? ge.b.audioEngine.audioContext.currentTime + e : ge.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) { if (this._streamingSource || (this._streamingSource = ge.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 (ge.b.audioEngine.unlocked) { var e = i._htmlAudioElement.play(); void 0 !== e && e.catch(function(e) { ge.b.audioEngine.lock(), (i.loop || i.autoplay) && ge.b.audioEngine.onAudioUnlockedObservable.addOnce(function() { r() }) }) } else(i.loop || i.autoplay) && ge.b.audioEngine.onAudioUnlockedObservable.addOnce(function() { r() }) })() } else { var r = function() { ge.b.audioEngine.audioContext && (i._soundSource = ge.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 ? ge.b.audioEngine.audioContext.currentTime + e : ge.b.audioEngine.audioContext.currentTime, i._soundSource.start(n, i.isPaused ? i._startOffset % i._soundSource.buffer.duration : t || 0)) }; "suspended" === ge.b.audioEngine.audioContext.state ? setTimeout(function() { "suspended" === ge.b.audioEngine.audioContext.state ? (ge.b.audioEngine.lock(), (i.loop || i.autoplay) && ge.b.audioEngine.onAudioUnlockedObservable.addOnce(function() { r() })) : r() }, 500) : r() } this._startTime = n, this.isPlaying = !0, this.isPaused = !1 } catch (e) { p.a.Error("Error while trying to play audio: " + this.name + ", " + e.message) } }, e.prototype._onended = function() { this.isPlaying = !1, 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 = !1; else if (ge.b.audioEngine.audioContext && this._soundSource) { var i = e ? ge.b.audioEngine.audioContext.currentTime + e : ge.b.audioEngine.audioContext.currentTime; this._soundSource.stop(i), this._soundSource.onended = function() { t.isPlaying = !1 }, this.isPaused || (this._startOffset = 0) } }, e.prototype.pause = function() { this.isPlaying && (this.isPaused = !0, this._streaming ? this._htmlAudioElement ? this._htmlAudioElement.pause() : this._streamingSource.disconnect() : ge.b.audioEngine.audioContext && (this.stop(0), this._startOffset += ge.b.audioEngine.audioContext.currentTime - this._startTime)) }, e.prototype.setVolume = function(e, t) { ge.b.audioEngine.canUseWebAudio && this._soundGain && (t && ge.b.audioEngine.audioContext ? (this._soundGain.gain.cancelScheduledValues(ge.b.audioEngine.audioContext.currentTime), this._soundGain.gain.setValueAtTime(this._soundGain.gain.value, ge.b.audioEngine.audioContext.currentTime), this._soundGain.gain.linearRampToValueAtTime(e, ge.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 = !0, 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(o.t.Matrix[0]), this.setPosition(o.t.Matrix[0].getTranslation()); else { var i = t.getBoundingInfo(); this.setPosition(i.boundingSphere.centerWorld) } ge.b.audioEngine.canUseWebAudio && this._isDirectional && this.isPlaying && this._updateDirection() } }, e.prototype.clone = function() { var t = this; if (this._streaming) return null; var i = function() { t._isReadyToPlay ? (r._audioBuffer = t.getAudioBuffer(), r._isReadyToPlay = !0, r.autoplay && r.play()) : window.setTimeout(i, 300) }, n = { 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 }, r = new e(this.name + "_cloned", new ArrayBuffer(0), this._scene, null, n); return this.useCustomAttenuation && r.setAttenuationFunction(this._customAttenuationFunction), r.setPosition(this._position), r.setPlaybackRate(this._playbackRate), i(), r }, 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 s, a = t.name; s = t.url ? n + t.url : n + a; var c, l = { 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) { var u = function() { r._isReadyToPlay ? (c._audioBuffer = r.getAudioBuffer(), c._isReadyToPlay = !0, c.autoplay && c.play()) : window.setTimeout(u, 300) }; c = new e(a, new ArrayBuffer(0), i, null, l), u() } else c = new e(a, s, i, function() { i._removePendingData(c) }, l), i._addPendingData(c); if (t.position) { var h = o.x.FromArray(t.position); c.setPosition(h) } if (t.isDirectional && (c.setDirectionalCone(t.coneInnerAngle || 360, t.coneOuterAngle || 360, t.coneOuterGain || 0), t.localDirectionToMesh)) { var d = o.x.FromArray(t.localDirectionToMesh); c.setLocalDirectionToMesh(d) } if (t.connectedMeshId) { var f = i.getMeshByID(t.connectedMeshId); f && c.attachToMesh(f) } return c }, e._SceneComponentInitialization = function(e) { throw be.a.WarnImport("AudioSceneComponent") }, e }(), Ee = function() { function e(e, t) { void 0 === t && (t = {}), this.id = -1, this._isMainTrack = !1, this._isInitialized = !1, 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() { ge.b.audioEngine.canUseWebAudio && ge.b.audioEngine.audioContext && (this._outputAudioNode = ge.b.audioEngine.audioContext.createGain(), this._outputAudioNode.connect(ge.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 = !0) }, e.prototype.dispose = function() { if (ge.b.audioEngine && ge.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(), ge.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) { ge.b.audioEngine.canUseWebAudio && this._outputAudioNode && (this._outputAudioNode.gain.value = e) }, e.prototype.switchPanningModelToHRTF = function() { if (ge.b.audioEngine.canUseWebAudio) for (var e = 0; e < this.soundCollection.length; e++) this.soundCollection[e].switchPanningModelToHRTF() }, e.prototype.switchPanningModelToEqualPower = function() { if (ge.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, ge.b.audioEngine.canUseWebAudio && this._outputAudioNode && (this._outputAudioNode.disconnect(), this._connectedAnalyser.connectAudioNodes(this._outputAudioNode, ge.b.audioEngine.masterGain)) }, e }(), Ae = i(14); n.a.AddParser(Ae.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 s = 0, a = e.sounds.length; s < a; s++) { var c = e.sounds[s]; ge.b.audioEngine.canUseWebAudio ? (c.url || (c.url = c.name), o[c.url] ? i.sounds.push(Te.Parse(c, t, n, o[c.url])) : (r = Te.Parse(c, t, n), o[c.url] = r, i.sounds.push(r))) : i.sounds.push(new Te(c.name, null, t)) } o = [] }), Object.defineProperty(W.a.prototype, "mainSoundTrack", { get: function() { var e = this._getComponent(Ae.a.NAME_AUDIO); return e || (e = new xe(this), this._addComponent(e)), this._mainSoundTrack || (this._mainSoundTrack = new Ee(this, { mainTrack: !0 })), this._mainSoundTrack }, enumerable: !0, configurable: !0 }), W.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(W.a.prototype, "audioEnabled", { get: function() { var e = this._getComponent(Ae.a.NAME_AUDIO); return e || (e = new xe(this), this._addComponent(e)), e.audioEnabled }, set: function(e) { var t = this._getComponent(Ae.a.NAME_AUDIO); t || (t = new xe(this), this._addComponent(t)), e ? t.enableAudio() : t.disableAudio() }, enumerable: !0, configurable: !0 }), Object.defineProperty(W.a.prototype, "headphone", { get: function() { var e = this._getComponent(Ae.a.NAME_AUDIO); return e || (e = new xe(this), this._addComponent(e)), e.headphone }, set: function(e) { var t = this._getComponent(Ae.a.NAME_AUDIO); t || (t = new xe(this), this._addComponent(t)), e ? t.switchAudioModeForHeadphones() : t.switchAudioModeForNormalSpeakers() }, enumerable: !0, configurable: !0 }); var xe = function() { function e(e) { this.name = Ae.a.NAME_AUDIO, this._audioEnabled = !0, this._headphone = !1, this.scene = e, e.soundTracks = new Array, e.sounds = new Array } return Object.defineProperty(e.prototype, "audioEnabled", { get: function() { return this._audioEnabled }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "headphone", { get: function() { return this._headphone }, enumerable: !0, configurable: !0 }), e.prototype.register = function() { this.scene._afterRenderStage.registerStep(Ae.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 = !0, t.scene.mainSoundTrack.AddSound(e) }) }, e.prototype.removeFromContainer = function(e, t) { var i = this; void 0 === t && (t = !1), e.sounds && e.sounds.forEach(function(e) { e.stop(), e.autoplay = !1, 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 = !1, 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 = !0, 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 = !0, 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 = !1, 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 = ge.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 = o.j.Invert(t.getViewMatrix()), s = o.x.TransformNormal(new o.x(0, 0, -1), r); for (s.normalize(), isNaN(s.x) || isNaN(s.y) || isNaN(s.z) || i.audioContext.listener.setOrientation(s.x, s.y, s.z, 0, 1, 0), n = 0; n < e.mainSoundTrack.soundCollection.length; n++) { var a = e.mainSoundTrack.soundCollection[n]; a.useCustomAttenuation && a.updateDistanceFromListener() } if (e.soundTracks) for (n = 0; n < e.soundTracks.length; n++) for (var c = 0; c < e.soundTracks[n].soundCollection.length; c++)(a = e.soundTracks[n].soundCollection[c]).useCustomAttenuation && a.updateDistanceFromListener() } } }, e }(); Te._SceneComponentInitialization = function(e) { var t = e._getComponent(Ae.a.NAME_AUDIO); t || (t = new xe(e), e._addComponent(t)) }; var Re = function() { function e(e, t, i) { var n = this; if (this.loop = !1, this._coneInnerAngle = 360, this._coneOuterAngle = 360, this._volume = 1, this.isPlaying = !1, this.isPaused = !1, 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, s = i; o < s.length; o++) { r += s[o] } for (var a = r > 0 ? 1 / r : 0, c = 0; c < this._weights.length; c++) this._weights[c] *= a; this._sounds = t; for (var l = 0, u = this._sounds; l < u.length; l++) { u[l].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 p.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "directionalConeOuterAngle", { get: function() { return this._coneOuterAngle }, set: function(e) { if (e !== this._coneOuterAngle) { if (e < this._coneInnerAngle) return void p.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: !0, configurable: !0 }), 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: !0, configurable: !0 }), e.prototype._onended = function() { void 0 !== this._currentIndex && (this._sounds[this._currentIndex].autoplay = !1), this.loop && this.isPlaying ? this.play() : this.isPlaying = !1 }, e.prototype.pause = function() { this.isPaused = !0, void 0 !== this._currentIndex && this._sounds[this._currentIndex].pause() }, e.prototype.stop = function() { this.isPlaying = !1, 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 = !0, this.isPlaying = !0, this.isPaused = !1 }, e }(), Pe = i(17), Se = function() { function e() { this._zoomStopsAnimation = !1, this._idleRotationSpeed = .05, this._idleRotationWaitTime = 2e3, this._idleRotationSpinupTime = 2e3, this._isPointerDown = !1, this._lastFrameTime = null, this._lastInteractionTime = -1 / 0, this._cameraRotationSpeed = 0, this._lastFrameRadius = 0 } return Object.defineProperty(e.prototype, "name", { get: function() { return "AutoRotation" }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "zoomStopsAnimation", { get: function() { return this._zoomStopsAnimation }, set: function(e) { this._zoomStopsAnimation = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "idleRotationSpeed", { get: function() { return this._idleRotationSpeed }, set: function(e) { this._idleRotationSpeed = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "idleRotationWaitTime", { get: function() { return this._idleRotationWaitTime }, set: function(e) { this._idleRotationWaitTime = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "idleRotationSpinupTime", { get: function() { return this._idleRotationSpinupTime }, set: function(e) { this._idleRotationSpinupTime = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "rotationInProgress", { get: function() { return Math.abs(this._cameraRotationSpeed) > 0 }, enumerable: !0, configurable: !0 }), 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 !== Pe.a.POINTERDOWN ? e.type === Pe.a.POINTERUP && (t._isPointerDown = !1) : t._isPointerDown = !0 }), this._onAfterCheckInputsObserver = e.onAfterCheckInputsObservable.add(function() { var e = X.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 !1; var e = !1; return this._lastFrameRadius === this._attachedCamera.radius && 0 !== this._attachedCamera.inertialRadiusOffset && (e = !0), this._lastFrameRadius = this._attachedCamera.radius, this._zoomStopsAnimation ? e : this._userIsZooming() }, e.prototype._applyUserInteraction = function() { this._userIsMoving() && !this._shouldAnimationStopForInteraction() && (this._lastInteractionTime = X.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 }(), Ce = function() { function e() { this.transitionDuration = 450, this.lowerRadiusTransitionRange = 2, this.upperRadiusTransitionRange = -2, this._autoTransitionRange = !1, this._radiusIsAnimating = !1, this._radiusBounceTransition = null, this._animatables = new Array } return Object.defineProperty(e.prototype, "name", { get: function() { return "Bouncing" }, enumerable: !0, configurable: !0 }), 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(!0); var i = e.getBoundingInfo().diagonalLength; t.lowerRadiusTransitionRange = .05 * i, t.upperRadiusTransitionRange = .05 * i } }) : this._onMeshTargetChangedObserver && i.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver)) } }, enumerable: !0, configurable: !0 }), 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 = B.CreateAnimation("radius", B.ANIMATIONTYPE_FLOAT, 60, e.EasingFunction)), this._cachedWheelPrecision = this._attachedCamera.wheelPrecision, this._attachedCamera.wheelPrecision = 1 / 0, this._attachedCamera.inertialRadiusOffset = 0, this.stopAllAnimations(), this._radiusIsAnimating = !0; var n = B.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 = !1, 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 te(.3), e.EasingMode = $.EASINGMODE_EASEOUT, e }(), Me = function() { function e() { this._mode = e.FitFrustumSidesMode, this._radiusScale = 1, this._positionScale = .5, this._defaultElevation = .3, this._elevationReturnTime = 1500, this._elevationReturnWaitTime = 1e3, this._zoomStopsAnimation = !1, this._framingTime = 1500, this.autoCorrectCameraLimitsAndSensibility = !0, this._isPointerDown = !1, this._lastInteractionTime = -1 / 0, this._animatables = new Array, this._betaIsAnimating = !1 } return Object.defineProperty(e.prototype, "name", { get: function() { return "Framing" }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "mode", { get: function() { return this._mode }, set: function(e) { this._mode = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "radiusScale", { get: function() { return this._radiusScale }, set: function(e) { this._radiusScale = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "positionScale", { get: function() { return this._positionScale }, set: function(e) { this._positionScale = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "defaultElevation", { get: function() { return this._defaultElevation }, set: function(e) { this._defaultElevation = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "elevationReturnTime", { get: function() { return this._elevationReturnTime }, set: function(e) { this._elevationReturnTime = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "elevationReturnWaitTime", { get: function() { return this._elevationReturnWaitTime }, set: function(e) { this._elevationReturnWaitTime = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "zoomStopsAnimation", { get: function() { return this._zoomStopsAnimation }, set: function(e) { this._zoomStopsAnimation = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "framingTime", { get: function() { return this._framingTime }, set: function(e) { this._framingTime = e }, enumerable: !0, configurable: !0 }), 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 !== Pe.a.POINTERDOWN ? e.type === Pe.a.POINTERUP && (i._isPointerDown = !1) : i._isPointerDown = !0 }), 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 = !1), void 0 === i && (i = null), e.computeWorldMatrix(!0); var n = e.getBoundingInfo().boundingBox; this.zoomOnBoundingInfo(n.minimumWorld, n.maximumWorld, t, i) }, e.prototype.zoomOnMeshHierarchy = function(e, t, i) { void 0 === t && (t = !1), void 0 === i && (i = null), e.computeWorldMatrix(!0); var n = e.getHierarchyBoundingVectors(!0); this.zoomOnBoundingInfo(n.min, n.max, t, i) }, e.prototype.zoomOnMeshesHierarchy = function(e, t, i) { void 0 === t && (t = !1), void 0 === i && (i = null); for (var n = new o.x(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), r = new o.x(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE), s = 0; s < e.length; s++) { var a = e[s].getHierarchyBoundingVectors(!0); ye.h.CheckExtends(a.min, n, r), ye.h.CheckExtends(a.max, n, r) } this.zoomOnBoundingInfo(n, r, t, i) }, e.prototype.zoomOnBoundingInfo = function(t, i, n, r) { var s, a = this; if (void 0 === n && (n = !1), void 0 === r && (r = null), this._attachedCamera) { var c = t.y, l = c + (i.y - c) * this._positionScale, u = i.subtract(t).scale(.5); if (n) s = new o.x(0, l, 0); else { var h = t.add(u); s = new o.x(h.x, l, h.z) } this._vectorTransition || (this._vectorTransition = B.CreateAnimation("target", B.ANIMATIONTYPE_VECTOR3, 60, e.EasingFunction)), this._betaIsAnimating = !0; var d = B.TransitionTo("target", s, this._attachedCamera, this._attachedCamera.getScene(), 60, this._vectorTransition, this._framingTime); d && this._animatables.push(d); var f = 0; if (this._mode === e.FitFrustumSidesMode) { var p = this._calculateLowerRadiusFromModelBoundingSphere(t, i); this.autoCorrectCameraLimitsAndSensibility && (this._attachedCamera.lowerRadiusLimit = u.length() + this._attachedCamera.minZ), f = p } else this._mode === e.IgnoreBoundsSizeMode && (f = this._calculateLowerRadiusFromModelBoundingSphere(t, i), this.autoCorrectCameraLimitsAndSensibility && null === this._attachedCamera.lowerRadiusLimit && (this._attachedCamera.lowerRadiusLimit = this._attachedCamera.minZ)); if (this.autoCorrectCameraLimitsAndSensibility) { var _ = i.subtract(t).length(); this._attachedCamera.panningSensibility = 5e3 / _, this._attachedCamera.wheelPrecision = 100 / f } this._radiusTransition || (this._radiusTransition = B.CreateAnimation("radius", B.ANIMATIONTYPE_FLOAT, 60, e.EasingFunction)), (d = B.TransitionTo("radius", f, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusTransition, this._framingTime, function() { a.stopAllAnimations(), r && r(), a._attachedCamera && a._attachedCamera.useInputToRestoreState && a._attachedCamera.storeState() })) && this._animatables.push(d) } }, e.prototype._calculateLowerRadiusFromModelBoundingSphere = function(t, i) { var n = i.subtract(t).length(), r = this._getFrustumSlope(), o = .5 * n * this._radiusScale, s = o * Math.sqrt(1 + 1 / (r.x * r.x)), a = o * Math.sqrt(1 + 1 / (r.y * r.y)), c = Math.max(s, a), l = this._attachedCamera; return l ? (l.lowerRadiusLimit && this._mode === e.IgnoreBoundsSizeMode && (c = c < l.lowerRadiusLimit ? l.lowerRadiusLimit : c), l.upperRadiusLimit && (c = c > l.upperRadiusLimit ? l.upperRadiusLimit : c), c) : 0 }, e.prototype._maintainCameraAboveGround = function() { var t = this; if (!(this._elevationReturnTime < 0)) { var i = X.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 = !0, this.stopAllAnimations(), this._betaTransition || (this._betaTransition = B.CreateAnimation("beta", B.ANIMATIONTYPE_FLOAT, 60, e.EasingFunction)); var o = B.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 o.w.Zero(); var t = e.getScene().getEngine().getAspectRatio(e), i = Math.tan(e.fov / 2), n = i * t; return new o.w(n, i) }, e.prototype._clearAnimationLocks = function() { this._betaIsAnimating = !1 }, e.prototype._applyUserInteraction = function() { this.isUserIsMoving && (this._lastInteractionTime = X.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: !0, configurable: !0 }), e.EasingFunction = new oe, e.EasingMode = $.EASINGMODE_EASEINOUT, e.IgnoreBoundsSizeMode = 0, e.FitFrustumSidesMode = 1, e }(), Oe = function() { return function(e, t, i, n) { void 0 === t && (t = new o.x), void 0 === i && (i = 0), void 0 === n && (n = !1), this.direction = e, this.rotatedDirection = t, this.diff = i, this.ignore = n } }(), Ie = function() { function e(e) { this.ui = e, this.name = "AttachToBoxBehavior", this.distanceAwayFromFace = .15, this.distanceAwayFromBottomOfFace = .15, this._faceVectors = [new Oe(o.x.Up()), new Oe(o.x.Down()), new Oe(o.x.Left()), new Oe(o.x.Right()), new Oe(o.x.Forward()), new Oe(o.x.Forward().scaleInPlace(-1))], this._tmpMatrix = new o.j, this._tmpVector = new o.x, this._zeroVector = o.x.Zero(), this._lookAtTmpMatrix = new o.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 = o.q.RotationYawPitchRoll(t._target.rotation.y, t._target.rotation.x, t._target.rotation.z)), t._target.rotationQuaternion.toRotationMatrix(t._tmpMatrix), o.x.TransformCoordinatesToRef(i.direction, t._tmpMatrix, i.rotatedDirection), i.diff = o.x.GetAngleBetweenVectors(i.rotatedDirection, e, o.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[0]) }, e.prototype._lookAtToRef = function(e, t, i) { void 0 === t && (t = new o.x(0, 1, 0)), o.j.LookAtLHToRef(this._zeroVector, e, t, this._lookAtTmpMatrix), this._lookAtTmpMatrix.invert(), o.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), o.x.TransformCoordinatesToRef(o.x.Up(), t._tmpMatrix, t._tmpVector), t._faceVectors.forEach(function(e) { n.direction.x && e.direction.x && (e.ignore = !0), n.direction.y && e.direction.y && (e.ignore = !0), n.direction.z && e.direction.z && (e.ignore = !0) }); var r = t._closestFace(t._tmpVector); t._faceVectors.forEach(function(e) { e.ignore = !1 }), 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 = o.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) } }) }, e.prototype.detach = function() { this._scene.onBeforeRenderObservable.remove(this._onRenderObserver) }, e }(), De = function() { function e() { var e = this; this.delay = 0, this.fadeInTime = 300, this._millisecondsPerFrame = 1e3 / 60, this._hovered = !1, 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: !0, configurable: !0 }), 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 }(), Le = i(54), we = function() { function e() { this._startDistance = 0, this._initialScale = new o.x(0, 0, 0), this._targetScale = new o.x(0, 0, 0), this._sceneRenderObserver = null, this._dragBehaviorA = new Le.a({}), this._dragBehaviorA.moveAttached = !1, this._dragBehaviorB = new Le.a({}), this._dragBehaviorB.moveAttached = !1 } return Object.defineProperty(e.prototype, "name", { get: function() { return "MultiPointerScale" }, enumerable: !0, configurable: !0 }), 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) } }) }), 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) } }) }, 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 }(), Fe = i(24), Ne = i(21), Be = i(45), Ue = function() { function e() { this._sceneRenderObserver = null, this._targetPosition = new o.x(0, 0, 0), this._moving = !1, this._startingOrientation = new o.q, this.zDragFactor = 3, this.rotateDraggedObject = !0, this.dragging = !1, this.dragDeltaRatio = .2, this.currentDraggingPointerID = -1, this.detachCameraControls = !0, this.onDragStartObservable = new r.c, this.onDragEndObservable = new r.c } return Object.defineProperty(e.prototype, "name", { get: function() { return "SixDofDrag" }, enumerable: !0, configurable: !0 }), 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 W.a(this._scene.getEngine()), e._virtualScene.detachControl(), this._scene.getEngine().scenes.pop()); var n = null, r = new o.x(0, 0, 0); this._virtualOriginMesh = new Fe.a("", e._virtualScene), this._virtualOriginMesh.rotationQuaternion = new o.q, this._virtualDragMesh = new Fe.a("", e._virtualScene), this._virtualDragMesh.rotationQuaternion = new o.q; var s = null; this._pointerObserver = this._scene.onPointerObservable.add(function(e, t) { if (e.type == Pe.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 == Ne.a.RIG_MODE_NONE && e.pickInfo.ray.origin.copyFrom(i._scene.activeCamera.globalPosition), n = i._ownerNode, Be.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 = o.q.RotationYawPitchRoll(n.rotation.y, n.rotation.x, n.rotation.z)); var a = n.parent; n.setParent(null), i._virtualDragMesh.rotationQuaternion.copyFrom(n.rotationQuaternion), n.setParent(a), i._virtualOriginMesh.addChild(i._virtualDragMesh), i._targetPosition.copyFrom(i._virtualDragMesh.absolutePosition), i.dragging = !0, i.currentDraggingPointerID = e.event.pointerId, i.detachCameraControls && i._scene.activeCamera && !i._scene.activeCamera.leftCamera && (i._scene.activeCamera.inputs.attachedElement ? (s = i._scene.activeCamera.inputs.attachedElement, i._scene.activeCamera.detachControl(i._scene.activeCamera.inputs.attachedElement)) : s = null), Be.a._RestorePivotPoint(n), i.onDragStartObservable.notifyObservers({}) } } else if (e.type == Pe.a.POINTERUP) i.currentDraggingPointerID == e.event.pointerId && (i.dragging = !1, i._moving = !1, i.currentDraggingPointerID = -1, n = null, i._virtualOriginMesh.removeChild(i._virtualDragMesh), i.detachCameraControls && s && i._scene.activeCamera && !i._scene.activeCamera.leftCamera && i._scene.activeCamera.attachControl(s, !0), i.onDragEndObservable.notifyObservers({})); else if (e.type == Pe.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 == Ne.a.RIG_MODE_NONE && (e.pickInfo.ray.origin.copyFrom(i._scene.activeCamera.globalPosition), c = 0); var l = e.pickInfo.ray.origin.subtract(r); r.copyFrom(e.pickInfo.ray.origin); var u = -o.x.Dot(l, e.pickInfo.ray.direction); i._virtualOriginMesh.addChild(i._virtualDragMesh), i._virtualDragMesh.position.z -= i._virtualDragMesh.position.z < 1 ? u * i.zDragFactor : u * 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 && o.x.TransformCoordinatesToRef(i._targetPosition, o.j.Invert(n.parent.getWorldMatrix()), i._targetPosition), i._moving || i._startingOrientation.copyFrom(i._virtualDragMesh.rotationQuaternion), i._moving = !0 } var h }); var a = new o.q; this._sceneRenderObserver = t.getScene().onBeforeRenderObservable.add(function() { if (i.dragging && i._moving && n) { if (Be.a._RemoveAndStorePivotPoint(n), n.position.addInPlace(i._targetPosition.subtract(n.position).scale(i.dragDeltaRatio)), i.rotateDraggedObject) { a.copyFrom(i._startingOrientation), a.x = -a.x, a.y = -a.y, a.z = -a.z, i._virtualDragMesh.rotationQuaternion.multiplyToRef(a, a), o.q.RotationYawPitchRollToRef(a.toEulerAngles("xyz").y, 0, 0, a), a.multiplyToRef(i._startingOrientation, a); var e = n.parent; (!e || e.scaling && !e.scaling.isNonUniformWithinEpsilon(.001)) && (n.setParent(null), o.q.SlerpToRef(n.rotationQuaternion, a, i.dragDeltaRatio, n.rotationQuaternion), n.setParent(e)) } Be.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 }(), Ve = function() { function e(e, t, i) { if (this.targetPosition = o.x.Zero(), this.poleTargetPosition = o.x.Zero(), this.poleTargetLocalOffset = o.x.Zero(), this.poleAngle = 0, this.slerpAmount = 1, this._bone1Quat = o.q.Identity(), this._bone1Mat = o.j.Identity(), this._bone2Ang = Math.PI, this._maxAngle = Math.PI, this._rightHandedSystem = !1, this._bendAxis = o.x.Right(), this._slerping = !1, 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 = !0, 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(), s = this._bone2.getScale(); this._bone1Length = this._bone1.length * r.y * this.mesh.scaling.y, this._bone2Length = this._bone2.length * s.y * this.mesh.scaling.y } else if (this._bone1.children[0]) { e.computeWorldMatrix(!0); var a = this._bone2.children[0].getAbsolutePosition(e), c = this._bone2.getAbsolutePosition(e), l = this._bone1.getAbsolutePosition(e); this._bone1Length = o.x.Distance(a, c), this._bone2Length = o.x.Distance(c, l) } this._bone1.getRotationMatrixToRef(o.s.WORLD, e, this._bone1Mat), this.maxAngle = Math.PI, i && (i.targetMesh && (this.targetMesh = i.targetMesh, this.targetMesh.computeWorldMatrix(!0)), i.poleTargetMesh ? (this.poleTargetMesh = i.poleTargetMesh, this.poleTargetMesh.computeWorldMatrix(!0)) : 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: !0, configurable: !0 }), 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], s = e._tmpMats[1]; this.targetMesh && i.copyFrom(this.targetMesh.getAbsolutePosition()), this.poleTargetBone ? this.poleTargetBone.getAbsolutePositionFromLocalToRef(this.poleTargetLocalOffset, this.mesh, n) : this.poleTargetMesh && o.x.TransformCoordinatesToRef(this.poleTargetLocalOffset, this.poleTargetMesh.getWorldMatrix(), n); var a = e._tmpVecs[0], c = e._tmpVecs[1], l = e._tmpVecs[2], u = e._tmpVecs[3], h = e._tmpVecs[4], d = e._tmpQuat; t.getAbsolutePositionToRef(this.mesh, a), n.subtractToRef(a, h), 0 == h.x && 0 == h.y && 0 == h.z ? h.y = 1 : h.normalize(), i.subtractToRef(a, u), u.normalize(), o.x.CrossToRef(u, h, c), c.normalize(), o.x.CrossToRef(u, c, l), l.normalize(), o.j.FromXYZAxesToRef(l, u, c, r); var f = this._bone1Length, p = this._bone2Length, _ = o.x.Distance(a, i); this._maxReach > 0 && (_ = Math.min(this._maxReach, _)); var g = (p * p + _ * _ - f * f) / (2 * p * _), m = (_ * _ + f * f - p * p) / (2 * _ * f); g > 1 && (g = 1), m > 1 && (m = 1), g < -1 && (g = -1), m < -1 && (m = -1); var v = Math.acos(g), y = Math.acos(m), b = -v - y; if (this._rightHandedSystem) o.j.RotationYawPitchRollToRef(0, 0, this._adjustRoll, s), s.multiplyToRef(r, r), o.j.RotationAxisToRef(this._bendAxis, y, s), s.multiplyToRef(r, r); else { var T = e._tmpVecs[5]; T.copyFrom(this._bendAxis), T.x *= -1, o.j.RotationAxisToRef(T, -y, s), s.multiplyToRef(r, r) } this.poleAngle && (o.j.RotationAxisToRef(u, this.poleAngle, s), r.multiplyToRef(s, r)), this._bone1 && (this.slerpAmount < 1 ? (this._slerping || o.q.FromRotationMatrixToRef(this._bone1Mat, this._bone1Quat), o.q.FromRotationMatrixToRef(r, d), o.q.SlerpToRef(this._bone1Quat, d, this.slerpAmount, this._bone1Quat), b = this._bone2Ang * (1 - this.slerpAmount) + b * this.slerpAmount, this._bone1.setRotationQuaternion(this._bone1Quat, o.s.WORLD, this.mesh), this._slerping = !0) : (this._bone1.setRotationMatrix(r, o.s.WORLD, this.mesh), this._bone1Mat.copyFrom(r), this._slerping = !1)), this._bone2.setAxisAngle(this._bendAxis, b, o.s.LOCAL), this._bone2Ang = b } }, e._tmpVecs = [o.x.Zero(), o.x.Zero(), o.x.Zero(), o.x.Zero(), o.x.Zero(), o.x.Zero()], e._tmpQuat = o.q.Identity(), e._tmpMats = [o.j.Identity(), o.j.Identity()], e }(), Ge = function() { function e(e, t, i, n) { if (this.upAxis = o.x.Up(), this.upAxisSpace = o.s.LOCAL, this.adjustYaw = 0, this.adjustPitch = 0, this.adjustRoll = 0, this.slerpAmount = 1, this._boneQuat = o.q.Identity(), this._slerping = !1, this._firstFrameSkipped = !1, this._fowardAxis = o.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.upAxis && (this.upAxis = n.upAxis), null != n.upAxisSpace && (this.upAxisSpace = n.upAxisSpace), null != n.yawAxis || null != n.pitchAxis)) { var r = o.c.Y, s = o.c.X; null != n.yawAxis && (r = n.yawAxis.clone()).normalize(), null != n.pitchAxis && (s = n.pitchAxis.clone()).normalize(); var a = o.x.Cross(s, r); this._transformYawPitch = o.j.Identity(), o.j.FromXYZAxesToRef(s, r, a, this._transformYawPitch), this._transformYawPitchInv = this._transformYawPitch.clone(), this._transformYawPitch.invert() } t.getParent() || this.upAxisSpace != o.s.BONE || (this.upAxisSpace = o.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 = .5 * this._getAngleDiff(this._minYaw, this._maxYaw) + this._minYaw, this._yawRange = this._maxYaw - this._minYaw) }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "minPitch", { get: function() { return this._minPitch }, set: function(e) { this._minPitch = e, this._minPitchTan = Math.tan(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "maxPitch", { get: function() { return this._maxPitch }, set: function(e) { this._maxPitch = e, this._maxPitchTan = Math.tan(e) }, enumerable: !0, configurable: !0 }), e.prototype.update = function() { if (this.slerpAmount < 1 && !this._firstFrameSkipped) this._firstFrameSkipped = !0; else { var t = this.bone, i = e._tmpVecs[0]; t.getAbsolutePositionToRef(this.mesh, i); var n = this.target, r = e._tmpMats[0], s = e._tmpMats[1], a = this.mesh, c = t.getParent(), l = e._tmpVecs[1]; l.copyFrom(this.upAxis), this.upAxisSpace == o.s.BONE && c ? (this._transformYawPitch && o.x.TransformCoordinatesToRef(l, this._transformYawPitchInv, l), c.getDirectionToRef(l, this.mesh, l)) : this.upAxisSpace == o.s.LOCAL && (a.getDirectionToRef(l, l), 1 == a.scaling.x && 1 == a.scaling.y && 1 == a.scaling.z || l.normalize()); var u = !1, h = !1; if (this._maxYaw == Math.PI && this._minYaw == -Math.PI || (u = !0), this._maxPitch == Math.PI && this._minPitch == -Math.PI || (h = !0), u || h) { var d = e._tmpMats[2], f = e._tmpMats[3]; if (this.upAxisSpace == o.s.BONE && 1 == l.y && c) c.getRotationMatrixToRef(o.s.WORLD, this.mesh, d); else if (this.upAxisSpace != o.s.LOCAL || 1 != l.y || c) { (_ = e._tmpVecs[2]).copyFrom(this._fowardAxis), this._transformYawPitch && o.x.TransformCoordinatesToRef(_, this._transformYawPitchInv, _), c ? c.getDirectionToRef(_, this.mesh, _) : a.getDirectionToRef(_, _); var p = o.x.Cross(l, _); p.normalize(); var _ = o.x.Cross(p, l); o.j.FromXYZAxesToRef(p, l, _, d) } else d.copyFrom(a.getWorldMatrix()); d.invertToRef(f); var g = null; if (h) { var m = e._tmpVecs[3]; n.subtractToRef(i, m), o.x.TransformCoordinatesToRef(m, f, m), g = Math.sqrt(m.x * m.x + m.z * m.z); var v = Math.atan2(m.y, g), y = v; v > this._maxPitch ? (m.y = this._maxPitchTan * g, y = this._maxPitch) : v < this._minPitch && (m.y = this._minPitchTan * g, y = this._minPitch), v != y && (o.x.TransformCoordinatesToRef(m, d, m), m.addInPlace(i), n = m) } if (u) { m = e._tmpVecs[4]; n.subtractToRef(i, m), o.x.TransformCoordinatesToRef(m, f, m); var b = Math.atan2(m.x, m.z), T = b; if ((b > this._maxYaw || b < this._minYaw) && (null == g && (g = Math.sqrt(m.x * m.x + m.z * m.z)), this._yawRange > Math.PI ? this._isAngleBetween(b, this._maxYaw, this._midYawConstraint) ? (m.z = this._maxYawCos * g, m.x = this._maxYawSin * g, T = this._maxYaw) : this._isAngleBetween(b, this._midYawConstraint, this._minYaw) && (m.z = this._minYawCos * g, m.x = this._minYawSin * g, T = this._minYaw) : b > this._maxYaw ? (m.z = this._maxYawCos * g, m.x = this._maxYawSin * g, T = this._maxYaw) : b < this._minYaw && (m.z = this._minYawCos * g, m.x = this._minYawSin * g, T = this._minYaw)), this._slerping && this._yawRange > Math.PI) { var E = e._tmpVecs[8]; E.copyFrom(o.c.Z), this._transformYawPitch && o.x.TransformCoordinatesToRef(E, this._transformYawPitchInv, E); var A = e._tmpMats[4]; this._boneQuat.toRotationMatrix(A), this.mesh.getWorldMatrix().multiplyToRef(A, A), o.x.TransformCoordinatesToRef(E, A, E), o.x.TransformCoordinatesToRef(E, f, E); var x = Math.atan2(E.x, E.z); if (this._getAngleBetween(x, b) > this._getAngleBetween(x, this._midYawConstraint)) { null == g && (g = Math.sqrt(m.x * m.x + m.z * m.z)); var R = this._getAngleBetween(x, this._maxYaw); this._getAngleBetween(x, this._minYaw) < R ? (T = x + .75 * Math.PI, m.z = Math.cos(T) * g, m.x = Math.sin(T) * g) : (T = x - .75 * Math.PI, m.z = Math.cos(T) * g, m.x = Math.sin(T) * g) } } b != T && (o.x.TransformCoordinatesToRef(m, d, m), m.addInPlace(i), n = m) } } var P = e._tmpVecs[5], S = e._tmpVecs[6], C = e._tmpVecs[7], M = e._tmpQuat; n.subtractToRef(i, P), P.normalize(), o.x.CrossToRef(l, P, S), S.normalize(), o.x.CrossToRef(P, S, C), C.normalize(), o.j.FromXYZAxesToRef(S, C, P, r), 0 === S.x && 0 === S.y && 0 === S.z || 0 === C.x && 0 === C.y && 0 === C.z || 0 === P.x && 0 === P.y && 0 === P.z || ((this.adjustYaw || this.adjustPitch || this.adjustRoll) && (o.j.RotationYawPitchRollToRef(this.adjustYaw, this.adjustPitch, this.adjustRoll, s), s.multiplyToRef(r, r)), this.slerpAmount < 1 ? (this._slerping || this.bone.getRotationQuaternionToRef(o.s.WORLD, this.mesh, this._boneQuat), this._transformYawPitch && this._transformYawPitch.multiplyToRef(r, r), o.q.FromRotationMatrixToRef(r, M), o.q.SlerpToRef(this._boneQuat, M, this.slerpAmount, this._boneQuat), this.bone.setRotationQuaternion(this._boneQuat, o.s.WORLD, this.mesh), this._slerping = !0) : (this._transformYawPitch && this._transformYawPitch.multiplyToRef(r, r), this.bone.setRotationMatrix(r, o.s.WORLD, this.mesh), this._slerping = !1)) } }, 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), 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 !0 } else if (e > i && e < t) return !0; return !1 }, e._tmpVecs = Y.a.BuildArray(10, o.x.Zero), e._tmpQuat = o.q.Identity(), e._tmpMats = Y.a.BuildArray(5, o.j.Identity), e }(), ke = i(7), ze = i(26); ge.b.prototype.updateRawTexture = function(e, t, i, n, r, o) { if (void 0 === r && (r = null), void 0 === o && (o = ge.b.TEXTURETYPE_UNSIGNED_INT), e) { var s = this._getRGBABufferInternalSizedFormat(o, i), a = this._getInternalFormat(i), c = this._getWebGLTextureType(o); this._bindTextureDirectly(this._gl.TEXTURE_2D, e, !0), 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, s, e.width, e.height, 0, a, c, t), e.generateMipMaps && this._gl.generateMipmap(this._gl.TEXTURE_2D), this._bindTextureDirectly(this._gl.TEXTURE_2D, null), e.isReady = !0 } }, ge.b.prototype.createRawTexture = function(e, t, i, n, r, o, s, a, c) { void 0 === a && (a = null), void 0 === c && (c = ge.b.TEXTURETYPE_UNSIGNED_INT); var l = new ze.a(this, ze.a.DATASOURCE_RAW); l.baseWidth = t, l.baseHeight = i, l.width = t, l.height = i, l.format = n, l.generateMipMaps = r, l.samplingMode = s, l.invertY = o, l._compression = a, l.type = c, this._doNotHandleContextLost || (l._bufferView = e), this.updateRawTexture(l, e, n, o, a, c), this._bindTextureDirectly(this._gl.TEXTURE_2D, l, !0); var u = this._getSamplingParameters(s, r); return this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, u.mag), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, u.min), r && this._gl.generateMipmap(this._gl.TEXTURE_2D), this._bindTextureDirectly(this._gl.TEXTURE_2D, null), this._internalTexturesCache.push(l), l }, ge.b.prototype.createRawCubeTexture = function(e, t, i, n, r, o, s, a) { void 0 === a && (a = null); var c = this._gl, l = new ze.a(this, ze.a.DATASOURCE_CUBERAW); l.isCube = !0, l.format = i, l.type = n, this._doNotHandleContextLost || (l._bufferViewArray = e); var u = this._getWebGLTextureType(n), h = this._getInternalFormat(i); h === c.RGB && (h = c.RGBA), u !== c.FLOAT || this._caps.textureFloatLinearFiltering ? u !== this._gl.HALF_FLOAT_OES || this._caps.textureHalfFloatLinearFiltering ? u !== c.FLOAT || this._caps.textureFloatRender ? u !== c.HALF_FLOAT || this._caps.colorBufferFloat || (r = !1, p.a.Warn("Render to half float textures is not supported. Mipmap generation forced to false.")) : (r = !1, p.a.Warn("Render to float textures is not supported. Mipmap generation forced to false.")) : (r = !1, s = ge.b.TEXTURE_NEAREST_SAMPLINGMODE, p.a.Warn("Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.")) : (r = !1, s = ge.b.TEXTURE_NEAREST_SAMPLINGMODE, p.a.Warn("Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.")); var d = t, f = d; l.width = d, l.height = f, !this.needPOTTextures || ye.h.IsExponentOfTwo(l.width) && ye.h.IsExponentOfTwo(l.height) || (r = !1), e && this.updateRawCubeTexture(l, e, i, n, o, a), this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, l, !0), e && r && this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP); var _ = this._getSamplingParameters(s, r); return c.texParameteri(c.TEXTURE_CUBE_MAP, c.TEXTURE_MAG_FILTER, _.mag), c.texParameteri(c.TEXTURE_CUBE_MAP, c.TEXTURE_MIN_FILTER, _.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), l.generateMipMaps = r, l }, ge.b.prototype.updateRawCubeTexture = function(e, t, i, n, r, o, s) { void 0 === o && (o = null), void 0 === s && (s = 0), e._bufferViewArray = t, e.format = i, e.type = n, e.invertY = r, e._compression = o; var a = this._gl, c = this._getWebGLTextureType(n), l = this._getInternalFormat(i), u = this._getRGBABufferInternalSizedFormat(n), h = !1; l === a.RGB && (l = a.RGBA, h = !0), this._bindTextureDirectly(a.TEXTURE_CUBE_MAP, e, !0), this._unpackFlipY(void 0 === r || !!r), e.width % 4 != 0 && a.pixelStorei(a.UNPACK_ALIGNMENT, 1); for (var d = 0; d < 6; d++) { var f = t[d]; o ? a.compressedTexImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X + d, s, this.getCaps().s3tc[o], e.width, e.height, 0, f) : (h && (f = this._convertRGBtoRGBATextureData(f, e.width, e.height, n)), a.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X + d, s, u, e.width, e.height, 0, l, c, f)) }(!this.needPOTTextures || ye.h.IsExponentOfTwo(e.width) && ye.h.IsExponentOfTwo(e.height)) && e.generateMipMaps && 0 === s && this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP), this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null), e.isReady = !0 }, ge.b.prototype.createRawCubeTextureFromUrl = function(e, t, i, n, r, o, s, a, c, l, u, h) { var d = this; void 0 === c && (c = null), void 0 === l && (l = null), void 0 === u && (u = ge.b.TEXTURE_TRILINEAR_SAMPLINGMODE), void 0 === h && (h = !1); var f = this._gl, p = this.createRawCubeTexture(null, i, n, r, !o, h, u); t._addPendingData(p), p.url = e, this._internalTexturesCache.push(p); return this._loadFile(e, function(e) { ! function(e) { var i = p.width, o = s(e); if (o) { if (a) { var l = d._getWebGLTextureType(r), u = d._getInternalFormat(n), _ = d._getRGBABufferInternalSizedFormat(r), g = !1; u === f.RGB && (u = f.RGBA, g = !0), d._bindTextureDirectly(f.TEXTURE_CUBE_MAP, p, !0), d._unpackFlipY(!1); for (var m = a(o), v = 0; v < m.length; v++) for (var y = i >> v, b = 0; b < 6; b++) { var T = m[v][b]; g && (T = d._convertRGBtoRGBATextureData(T, y, y, r)), f.texImage2D(b, v, _, y, y, 0, u, l, T) } d._bindTextureDirectly(f.TEXTURE_CUBE_MAP, null) } else d.updateRawCubeTexture(p, o, n, r, h); p.isReady = !0, t._removePendingData(p), c && c() } }(e) }, void 0, t.offlineProvider, !0, function(e, i) { t._removePendingData(p), l && e && l(e.status + " " + e.statusText, i) }), p }, ge.b.prototype.createRawTexture3D = function(e, t, i, n, r, o, s, a, c, l) { void 0 === c && (c = null), void 0 === l && (l = ge.b.TEXTURETYPE_UNSIGNED_INT); var u = new ze.a(this, ze.a.DATASOURCE_RAW3D); u.baseWidth = t, u.baseHeight = i, u.baseDepth = n, u.width = t, u.height = i, u.depth = n, u.format = r, u.type = l, u.generateMipMaps = o, u.samplingMode = a, u.is3D = !0, this._doNotHandleContextLost || (u._bufferView = e), this.updateRawTexture3D(u, e, r, s, c, l), this._bindTextureDirectly(this._gl.TEXTURE_3D, u, !0); var h = this._getSamplingParameters(a, 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(u), u }, ge.b.prototype.updateRawTexture3D = function(e, t, i, n, r, o) { void 0 === r && (r = null), void 0 === o && (o = ge.b.TEXTURETYPE_UNSIGNED_INT); var s = this._getWebGLTextureType(o), a = this._getInternalFormat(i), c = this._getRGBABufferInternalSizedFormat(o, i); this._bindTextureDirectly(this._gl.TEXTURE_3D, e, !0), 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, a, s, t), e.generateMipMaps && this._gl.generateMipmap(this._gl.TEXTURE_3D), this._bindTextureDirectly(this._gl.TEXTURE_3D, null), e.isReady = !0 }; var je = function(e) { function t(t, i, n, r, o, s, a, c, l) { void 0 === s && (s = !0), void 0 === a && (a = !1), void 0 === c && (c = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), void 0 === l && (l = _.a.TEXTURETYPE_UNSIGNED_INT); var u = e.call(this, null, o, !s, a) || this; return u.format = r, u._engine = o.getEngine(), u._texture = o.getEngine().createRawTexture(t, i, n, r, s, a, c, null, l), u.wrapU = ke.a.CLAMP_ADDRESSMODE, u.wrapV = ke.a.CLAMP_ADDRESSMODE, u } return l.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, s, a) { return void 0 === o && (o = !0), void 0 === s && (s = !1), void 0 === a && (a = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), new t(e, i, n, _.a.TEXTUREFORMAT_LUMINANCE, r, o, s, a) }, t.CreateLuminanceAlphaTexture = function(e, i, n, r, o, s, a) { return void 0 === o && (o = !0), void 0 === s && (s = !1), void 0 === a && (a = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), new t(e, i, n, _.a.TEXTUREFORMAT_LUMINANCE_ALPHA, r, o, s, a) }, t.CreateAlphaTexture = function(e, i, n, r, o, s, a) { return void 0 === o && (o = !0), void 0 === s && (s = !1), void 0 === a && (a = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), new t(e, i, n, _.a.TEXTUREFORMAT_ALPHA, r, o, s, a) }, t.CreateRGBTexture = function(e, i, n, r, o, s, a, c) { return void 0 === o && (o = !0), void 0 === s && (s = !1), void 0 === a && (a = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), void 0 === c && (c = _.a.TEXTURETYPE_UNSIGNED_INT), new t(e, i, n, _.a.TEXTUREFORMAT_RGB, r, o, s, a, c) }, t.CreateRGBATexture = function(e, i, n, r, o, s, a, c) { return void 0 === o && (o = !0), void 0 === s && (s = !1), void 0 === a && (a = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), void 0 === c && (c = _.a.TEXTURETYPE_UNSIGNED_INT), new t(e, i, n, _.a.TEXTUREFORMAT_RGBA, r, o, s, a, c) }, t.CreateRTexture = function(e, i, n, r, o, s, a, c) { return void 0 === o && (o = !0), void 0 === s && (s = !1), void 0 === a && (a = ke.a.TRILINEAR_SAMPLINGMODE), void 0 === c && (c = _.a.TEXTURETYPE_FLOAT), new t(e, i, n, _.a.TEXTUREFORMAT_R, r, o, s, a, c) }, t }(ke.a), He = function() { function e(e, t, i) { this.name = e, this.id = t, this.bones = new Array, this.needInitialSkinMatrix = !1, this.overrideMesh = null, this._isDirty = !0, this._meshesWithPoseMatrix = new Array, this._identity = o.j.Identity(), this._ranges = {}, this._lastAbsoluteTransformsUpdateId = -1, this._canUseTextureForBones = !1, this._uniqueId = 0, this._numBonesWithLinkedTransformNode = 0, this._hasWaitingData = null, this.doNotSerialize = !1, this._useTextureToStoreBoneMatrices = !0, this._animationPropertiesOverride = null, this.onBeforeComputeObservable = new r.c, this.bones = [], this._scene = i || P.a.LastCreatedScene, this._uniqueId = this._scene.getUniqueId(), this._scene.addSkeleton(this), this._isDirty = !0; 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() }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "animationPropertiesOverride", { get: function() { return this._animationPropertiesOverride ? this._animationPropertiesOverride : this._scene.animationPropertiesOverride }, set: function(e) { this._animationPropertiesOverride = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "isUsingTextureForMatrices", { get: function() { return this.useTextureToStoreBoneMatrices && this._canUseTextureForBones && !this.needInitialSkinMatrix }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "uniqueId", { get: function() { return this._uniqueId }, enumerable: !0, configurable: !0 }), 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 = !0; for (var n in this._ranges) i && (t += ", ", i = !1), 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 w(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 = !0); 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 = !1), this._ranges[t] || !e.getAnimationRange(t)) return !1; var n, r, o = !0, s = this._getHighestAnimationFrame() + 1, a = {}, c = e.bones; for (r = 0, n = c.length; r < n; r++) a[c[r].name] = c[r]; this.bones.length !== c.length && (p.a.Warn("copyAnimationRange: this rig has " + this.bones.length + " bones, while source as " + c.length), o = !1); var l = i && this.dimensionsAtRest && e.dimensionsAtRest ? this.dimensionsAtRest.divide(e.dimensionsAtRest) : null; for (r = 0, n = this.bones.length; r < n; r++) { var u = this.bones[r].name, h = a[u]; h ? o = o && this.bones[r].copyAnimationRange(h, t, s, i, l) : (p.a.Warn("copyAnimationRange: not same rig, missing source bone " + u), o = !1) } var d = e.getAnimationRange(t); return d && (this._ranges[t] = new w(t, d.from + s, d.to + s)), o }, 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 = !0 }, 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], s = 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 a = 0; a < this.bones.length; a++) { var c = this.bones[a]; if (!c.getParent()) c.getBaseMatrix().multiplyToRef(s, o.t.Matrix[1]), c._updateDifferenceMatrix(o.t.Matrix[1]) } } this._computeTransformMatrices(r._bonesTransformMatrices, s) } 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 = je.CreateRGBATexture(this._transformMatrices, 4 * (this.bones.length + 1), 1, this._scene, !1, !1, _.a.TEXTURE_NEAREST_SAMPLINGMODE, _.a.TEXTURETYPE_FLOAT))), this._computeTransformMatrices(this._transformMatrices, null), this.isUsingTextureForMatrices && this._transformMatrixTexture && this._transformMatrixTexture.update(this._transformMatrices); this._isDirty = !1, this._scene._activeBones.addCount(this.bones.length, !1) } }, 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], s = null, a = o.getParent(); if (a) { var c = this.bones.indexOf(a); s = n.bones[c] } var l = new K(o.name, n, s, o.getBaseMatrix().clone(), o.getRestPose().clone()); S.a.DeepCopy(o.animations, l.animations) } if (this._ranges) for (var u in n._ranges = {}, this._ranges) { var h = this._ranges[u]; h && (n._ranges[u] = h.clone()) } return this._isDirty = !0, n }, e.prototype.enableBlending = function(e) { void 0 === e && (e = .01), this.bones.forEach(function(t) { t.animations.forEach(function(t) { t.enableBlending = !0, 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 s = this._ranges[o]; if (s) { var a = {}; a.name = o, a.from = s.from, a.to = s.to, e.ranges.push(a) } } } return e }, e.Parse = function(t, i) { var n, r = new e(t.name, t.id, i); for (t.dimensionsAtRest && (r.dimensionsAtRest = o.x.FromArray(t.dimensionsAtRest)), r.needInitialSkinMatrix = t.needInitialSkinMatrix, n = 0; n < t.bones.length; n++) { var s = t.bones[n], a = null; s.parentBoneIndex > -1 && (a = r.bones[s.parentBoneIndex]); var c = s.rest ? o.j.FromArray(s.rest) : null, l = new K(s.name, r, a, o.j.FromArray(s.matrix), c); void 0 !== s.id && null !== s.id && (l.id = s.id), s.length && (l.length = s.length), s.metadata && (l.metadata = s.metadata), s.animation && l.animations.push(B.Parse(s.animation)), void 0 !== s.linkedTransformNodeId && null !== s.linkedTransformNodeId && (r._hasWaitingData = !0, l._waitingTransformNodeId = s.linkedTransformNodeId) } if (t.ranges) for (n = 0; n < t.ranges.length; n++) { var u = t.ranges[n]; r.createAnimationRange(u.name, u.from, u.to) } return r }, e.prototype.computeAbsoluteTransforms = function(e) { void 0 === e && (e = !1); 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] = !0; 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 }(), We = {}, Xe = 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] ? p.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 = !1), !this.attachedElement) for (var i in t = !Ne.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 = !1), 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, !0), 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 = L.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 = We[i]) { var n = t[i], r = L.a.Parse(function() { return new o }, n, null); this.add(r) } } else for (var i in this.attached) { var o; if (o = We[this.attached[i].getClassName()]) { r = L.a.Parse(function() { return new o }, e, null); this.remove(this.attached[i]), this.add(r) } } }, e }(), Ye = function() { return function(e, t) { this.x = e, this.y = t } }(), Ke = function() { function e(t, i, n, r, o, s, a) { void 0 === r && (r = 0), void 0 === o && (o = 1), void 0 === s && (s = 2), void 0 === a && (a = 3), this.id = t, this.index = i, this.browserGamepad = n, this._leftStick = { x: 0, y: 0 }, this._rightStick = { x: 0, y: 0 }, this._isConnected = !0, this._invertLeftStickY = !1, this.type = e.GAMEPAD, this._leftStickAxisX = r, this._leftStickAxisY = o, this._rightStickAxisX = s, this._rightStickAxisY = a, 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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 = { 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, e }(), Qe = function(e) { function t(t, i, n) { var o = e.call(this, t, i, n) || this; return o.onButtonDownObservable = new r.c, o.onButtonUpObservable = new r.c, o.type = Ke.GENERIC, o._buttons = new Array(n.buttons.length), o } return l.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), this.onButtonDownObservable.clear(), this.onButtonUpObservable.clear() }, t }(Ke), qe = 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 !== Ke.POSE_ENABLED && (i.gamepad && e.type !== Ke.XBOX || (i.gamepad = e)) }), this._onGamepadDisconnectedObserver = n.onGamepadDisconnectedObservable.add(function(e) { i.gamepad === e && (i.gamepad = null) }), this.gamepad = n.getGamepadByType(Ke.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) } } }, e.prototype.getClassName = function() { return "ArcRotateCameraGamepadInput" }, e.prototype.getSimpleName = function() { return "gamepad" }, l.c([Object(L.c)()], e.prototype, "gamepadRotationSensibility", void 0), l.c([Object(L.c)()], e.prototype, "gamepadMoveSensibility", void 0), e }(); We.ArcRotateCameraGamepadInput = qe; var Ze = i(51), Je = 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 = !0, 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 === Ze.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" }, l.c([Object(L.c)()], e.prototype, "keysUp", void 0), l.c([Object(L.c)()], e.prototype, "keysDown", void 0), l.c([Object(L.c)()], e.prototype, "keysLeft", void 0), l.c([Object(L.c)()], e.prototype, "keysRight", void 0), l.c([Object(L.c)()], e.prototype, "keysReset", void 0), l.c([Object(L.c)()], e.prototype, "panningSensibility", void 0), l.c([Object(L.c)()], e.prototype, "zoomingSensibility", void 0), l.c([Object(L.c)()], e.prototype, "useAltToZoom", void 0), l.c([Object(L.c)()], e.prototype, "angularSpeed", void 0), e }(); We.ArcRotateCameraKeyboardMoveInput = Je; var $e = 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 === Pe.a.POINTERWHEEL) { var r = e.event, o = 0, s = r; if (s.wheelDelta) if (i.wheelDeltaPercentage) { if ((o = i.computeDeltaFromMouseWheelLegacyEvent(s, i.camera.radius)) > 0) { for (var a = i.camera.radius, c = i.camera.inertialRadiusOffset + o, l = 0; l < 20 && Math.abs(c) > .001; l++) a -= c, c *= i.camera.inertia; a = D.a.Clamp(a, 0, Number.MAX_VALUE), o = i.computeDeltaFromMouseWheelLegacyEvent(s, a) } } else o = s.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, Pe.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" }, l.c([Object(L.c)()], e.prototype, "wheelPrecision", void 0), l.c([Object(L.c)()], e.prototype, "wheelDeltaPercentage", void 0), e }(); We.ArcRotateCameraMouseWheelInput = $e; var et = 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 = !1, this._ctrlKey = !1, this._metaKey = !1, this._shiftKey = !1, this._buttonsPressed = 0, this._pointerInput = function(s, a) { var c = s.event, l = "touch" === c.pointerType; if (!n.isInVRExclusivePointerMode && (s.type === Pe.a.POINTERMOVE || -1 !== i.buttons.indexOf(c.button))) { var u = 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, d = c.movementY || c.mozMovementY || c.webkitMovementY || c.msMovementY || 0; i.onTouch(null, h, d), i.pointA = null, i.pointB = null } else if (s.type === Pe.a.POINTERDOWN && u) { try { u.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 (s.type === Pe.a.POINTERDOUBLETAP) i.onDoubleTap(c.pointerType); else if (s.type === Pe.a.POINTERUP && u) { try { u.releasePointerCapture(c.pointerId) } catch (e) {} l || (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 (s.type === Pe.a.POINTERMOVE) if (t || c.preventDefault(), i.pointA && null === i.pointB) { h = c.clientX - i.pointA.x, d = c.clientY - i.pointA.y; i.onTouch(i.pointA, h, d), i.pointA.x = c.clientX, i.pointA.y = c.clientY } else if (i.pointA && i.pointB) { var f = i.pointA.pointerId === c.pointerId ? i.pointA : i.pointB; f.x = c.clientX, f.y = c.clientY; var p = i.pointA.x - i.pointB.x, _ = i.pointA.y - i.pointB.y, g = p * p + _ * _, m = { x: (i.pointA.x + i.pointB.x) / 2, y: (i.pointA.y + i.pointB.y) / 2, pointerId: c.pointerId, type: s.type }; i.onMultiTouch(i.pointA, i.pointB, r, g, o, m), o = m, r = g } } }, this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, Pe.a.POINTERDOWN | Pe.a.POINTERUP | Pe.a.POINTERMOVE), this._onLostFocus = function() { i.pointA = i.pointB = null, r = 0, o = null, i.onLostFocus() }, e.addEventListener("contextmenu", this.onContextMenu.bind(this), !1), ye.h.RegisterTopRootEvents([{ name: "blur", handler: this._onLostFocus }]) }, e.prototype.detachControl = function(e) { this._onLostFocus && ye.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 = !1, this._ctrlKey = !1, this._metaKey = !1, this._shiftKey = !1, 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() {}, l.c([Object(L.c)()], e.prototype, "buttons", void 0), e }(), tt = 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 = !0, t.multiTouchPanAndZoom = !0, t.pinchInwards = !0, t._isPanClick = !1, t._twoFingerActivityCount = 0, t._isPinching = !1, t } return l.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 s = 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 * s * (this.angularSensibilityX + this.angularSensibilityY) / 2), 0 !== this.panningSensibility && r && o) { var a = o.x - r.x, c = o.y - r.y; this.camera.inertialPanningX += -a / this.panningSensibility, this.camera.inertialPanningY += c / this.panningSensibility } } else { this._twoFingerActivityCount++; var l = Math.sqrt(i), u = Math.sqrt(n); if (this._isPinching || this._twoFingerActivityCount < 20 && Math.abs(u - l) > this.camera.pinchToPanMaxDistance) this.pinchDeltaPercentage ? this.camera.inertialRadiusOffset += .001 * (n - i) * this.camera.radius * this.pinchDeltaPercentage : this.camera.inertialRadiusOffset += (n - i) / (this.pinchPrecision * s * (this.angularSensibilityX + this.angularSensibilityY) / 2), this._isPinching = !0; else if (0 !== this.panningSensibility && this.multiTouchPanning && o && r) { a = o.x - r.x, c = o.y - r.y; this.camera.inertialPanningX += -a / 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 = !1 }, t.prototype.onLostFocus = function() { this._isPanClick = !1, this._twoFingerActivityCount = 0, this._isPinching = !1 }, l.c([Object(L.c)()], t.prototype, "buttons", void 0), l.c([Object(L.c)()], t.prototype, "angularSensibilityX", void 0), l.c([Object(L.c)()], t.prototype, "angularSensibilityY", void 0), l.c([Object(L.c)()], t.prototype, "pinchPrecision", void 0), l.c([Object(L.c)()], t.prototype, "pinchDeltaPercentage", void 0), l.c([Object(L.c)()], t.prototype, "panningSensibility", void 0), l.c([Object(L.c)()], t.prototype, "multiTouchPanning", void 0), l.c([Object(L.c)()], t.prototype, "multiTouchPanAndZoom", void 0), t }(et); We.ArcRotateCameraPointersInput = tt; var it = function(e) { function t(t) { return e.call(this, t) || this } return l.d(t, e), t.prototype.addMouseWheel = function() { return this.add(new $e), this }, t.prototype.addPointers = function() { return this.add(new tt), this }, t.prototype.addKeyboard = function() { return this.add(new Je), this }, t }(Xe); it.prototype.addVRDeviceOrientation = function() { return this.add(new nt), this }; var nt = function() { function e() { this.alphaCorrection = 1, this.gammaCorrection = 1, this._alpha = 0, this._gamma = 0, this._dirty = !1, 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 = !0 }, e.prototype.checkInputs = function() { this._dirty && (this._dirty = !1, 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 }(); We.ArcRotateCameraVRDeviceOrientationInput = nt; var rt = 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 === Ze.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), o.x.TransformNormalToRef(e._localDirection, e._cameraTransformMatrix, e._transformedDirection), e.cameraDirection.addInPlace(e._transformedDirection) } }, l.c([Object(L.c)()], e.prototype, "keysForward", void 0), l.c([Object(L.c)()], e.prototype, "keysBackward", void 0), l.c([Object(L.c)()], e.prototype, "keysUp", void 0), l.c([Object(L.c)()], e.prototype, "keysDown", void 0), l.c([Object(L.c)()], e.prototype, "keysRight", void 0), l.c([Object(L.c)()], e.prototype, "keysLeft", void 0), e }(); We.FlyCameraKeyboardInput = rt; var ot = function() { function e(e) { void 0 === e && (e = !0), 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) }, Pe.a.POINTERDOWN | Pe.a.POINTERUP | Pe.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, !1) }, 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 === Pe.a.POINTERMOVE || -1 !== this.buttons.indexOf(i.button))) { var r = i.srcElement || i.target; if (e.type === Pe.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 === Pe.a.POINTERUP && r) { try { r.releasePointerCapture(i.pointerId) } catch (i) {} this.activeButton = -1, this.previousPosition = null, this.noPreventDefault || i.preventDefault() } else if (e.type === Pe.a.POINTERMOVE) { if (!this.previousPosition || n.isPointerLock) return; var o = i.clientX - this.previousPosition.x, s = i.clientY - this.previousPosition.y; this.rotateCamera(o, s), 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, s = e / this.angularSensibility, a = t / this.angularSensibility, c = o.q.RotationYawPitchRoll(n.rotation.y, n.rotation.x, n.rotation.z); if (this.buttonsPitch.some(function(e) { return e === i.activeButton }) && (r = o.q.RotationAxis(o.c.X, a), c.multiplyInPlace(r)), this.buttonsYaw.some(function(e) { return e === i.activeButton })) { r = o.q.RotationAxis(o.c.Y, s), c.multiplyInPlace(r); var l = n.bankedTurnLimit + n._trackRoll; if (n.bankedTurn && -l < n.rotation.z && n.rotation.z < l) { var u = n.bankedTurnMultiplier * -s; r = o.q.RotationAxis(o.c.Z, u), c.multiplyInPlace(r) } } this.buttonsRoll.some(function(e) { return e === i.activeButton }) && (r = o.q.RotationAxis(o.c.Z, -s), n._trackRoll -= s, c.multiplyInPlace(r)), c.toEulerAnglesToRef(n.rotation) }, l.c([Object(L.c)()], e.prototype, "buttons", void 0), l.c([Object(L.c)()], e.prototype, "angularSensibility", void 0), e }(); We.FlyCameraMouseInput = ot; var st = function() { function e() { this.keysHeightOffsetIncr = [38], this.keysHeightOffsetDecr = [40], this.keysHeightOffsetModifierAlt = !1, this.keysHeightOffsetModifierCtrl = !1, this.keysHeightOffsetModifierShift = !1, this.keysRotationOffsetIncr = [37], this.keysRotationOffsetDecr = [39], this.keysRotationOffsetModifierAlt = !1, this.keysRotationOffsetModifierCtrl = !1, this.keysRotationOffsetModifierShift = !1, this.keysRadiusIncr = [40], this.keysRadiusDecr = [38], this.keysRadiusModifierAlt = !0, this.keysRadiusModifierCtrl = !1, this.keysRadiusModifierShift = !1, 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 === Ze.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 }, l.c([Object(L.c)()], e.prototype, "keysHeightOffsetIncr", void 0), l.c([Object(L.c)()], e.prototype, "keysHeightOffsetDecr", void 0), l.c([Object(L.c)()], e.prototype, "keysHeightOffsetModifierAlt", void 0), l.c([Object(L.c)()], e.prototype, "keysHeightOffsetModifierCtrl", void 0), l.c([Object(L.c)()], e.prototype, "keysHeightOffsetModifierShift", void 0), l.c([Object(L.c)()], e.prototype, "keysRotationOffsetIncr", void 0), l.c([Object(L.c)()], e.prototype, "keysRotationOffsetDecr", void 0), l.c([Object(L.c)()], e.prototype, "keysRotationOffsetModifierAlt", void 0), l.c([Object(L.c)()], e.prototype, "keysRotationOffsetModifierCtrl", void 0), l.c([Object(L.c)()], e.prototype, "keysRotationOffsetModifierShift", void 0), l.c([Object(L.c)()], e.prototype, "keysRadiusIncr", void 0), l.c([Object(L.c)()], e.prototype, "keysRadiusDecr", void 0), l.c([Object(L.c)()], e.prototype, "keysRadiusModifierAlt", void 0), l.c([Object(L.c)()], e.prototype, "keysRadiusModifierCtrl", void 0), l.c([Object(L.c)()], e.prototype, "keysRadiusModifierShift", void 0), l.c([Object(L.c)()], e.prototype, "heightSensibility", void 0), l.c([Object(L.c)()], e.prototype, "rotationSensibility", void 0), l.c([Object(L.c)()], e.prototype, "radiusSensibility", void 0), e }(); We.FollowCameraKeyboardMoveInput = st; var at = function() { function e() { this.axisControlRadius = !0, this.axisControlHeight = !1, this.axisControlRotation = !1, this.wheelPrecision = 3, this.wheelDeltaPercentage = 0 } return e.prototype.attachControl = function(e, t) { var i = this; this._wheel = function(e, n) { if (e.type === Pe.a.POINTERWHEEL) { var r = e.event, o = 0, s = 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 * s * i.wheelDeltaPercentage * i.camera.radius : i.axisControlHeight ? o = .01 * s * i.wheelDeltaPercentage * i.camera.heightOffset : i.axisControlRotation && (o = .01 * s * i.wheelDeltaPercentage * i.camera.rotationOffset)) : o = s * 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, Pe.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" }, l.c([Object(L.c)()], e.prototype, "axisControlRadius", void 0), l.c([Object(L.c)()], e.prototype, "axisControlHeight", void 0), l.c([Object(L.c)()], e.prototype, "axisControlRotation", void 0), l.c([Object(L.c)()], e.prototype, "wheelPrecision", void 0), l.c([Object(L.c)()], e.prototype, "wheelDeltaPercentage", void 0), e }(); We.FollowCameraMouseWheelInput = at; var ct = 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 = !1, t.axisXControlHeight = !1, t.axisXControlRotation = !0, t.axisYControlRadius = !1, t.axisYControlHeight = !0, t.axisYControlRotation = !1, t.axisPinchControlRadius = !0, t.axisPinchControlHeight = !1, t.axisPinchControlRotation = !1, t.warningEnable = !0, t._warningCounter = 0, t } return l.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 s = (n - i) / (this.pinchPrecision * (this.angularSensibilityX + this.angularSensibilityY) / 2); this.pinchDeltaPercentage ? (s *= .01 * this.pinchDeltaPercentage, this.axisPinchControlRotation && (this.camera.rotationOffset += s * this.camera.rotationOffset), this.axisPinchControlHeight && (this.camera.heightOffset += s * this.camera.heightOffset), this.axisPinchControlRadius && (this.camera.radius -= s * this.camera.radius)) : (this.axisPinchControlRotation && (this.camera.rotationOffset += s), this.axisPinchControlHeight && (this.camera.heightOffset += s), this.axisPinchControlRadius && (this.camera.radius -= s)) } }, 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) } }, l.c([Object(L.c)()], t.prototype, "angularSensibilityX", void 0), l.c([Object(L.c)()], t.prototype, "angularSensibilityY", void 0), l.c([Object(L.c)()], t.prototype, "pinchPrecision", void 0), l.c([Object(L.c)()], t.prototype, "pinchDeltaPercentage", void 0), l.c([Object(L.c)()], t.prototype, "axisXControlRadius", void 0), l.c([Object(L.c)()], t.prototype, "axisXControlHeight", void 0), l.c([Object(L.c)()], t.prototype, "axisXControlRotation", void 0), l.c([Object(L.c)()], t.prototype, "axisYControlRadius", void 0), l.c([Object(L.c)()], t.prototype, "axisYControlHeight", void 0), l.c([Object(L.c)()], t.prototype, "axisYControlRotation", void 0), l.c([Object(L.c)()], t.prototype, "axisPinchControlRadius", void 0), l.c([Object(L.c)()], t.prototype, "axisPinchControlHeight", void 0), l.c([Object(L.c)()], t.prototype, "axisPinchControlRotation", void 0), t }(et); We.FollowCameraPointersInput = ct; var lt = 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 === Ze.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), o.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" }, l.c([Object(L.c)()], e.prototype, "keysUp", void 0), l.c([Object(L.c)()], e.prototype, "keysDown", void 0), l.c([Object(L.c)()], e.prototype, "keysLeft", void 0), l.c([Object(L.c)()], e.prototype, "keysRight", void 0), e }(); We.FreeCameraKeyboardMoveInput = lt; var ut = function() { function e(e) { void 0 === e && (e = !0), this.touchEnabled = e, this.buttons = [0, 1, 2], this.angularSensibility = 2e3, this.previousPosition = null, this.onPointerMovedObservable = new r.c, this._allowCameraRotation = !0 } 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 === Pe.a.POINTERMOVE || -1 !== i.buttons.indexOf(o.button))) { var s = o.srcElement || o.target; if (r.type === Pe.a.POINTERDOWN && s) { try { s.setPointerCapture(o.pointerId) } catch (e) {} i.previousPosition = { x: o.clientX, y: o.clientY }, t || (o.preventDefault(), e.focus()) } else if (r.type === Pe.a.POINTERUP && s) { try { s.releasePointerCapture(o.pointerId) } catch (e) {} i.previousPosition = null, t || o.preventDefault() } else if (r.type === Pe.a.POINTERMOVE) { if (!i.previousPosition || n.isPointerLock) return; var a = o.clientX - i.previousPosition.x, c = o.clientY - i.previousPosition.y; i.camera.getScene().useRightHandedSystem && (a *= -1), i.camera.parent && i.camera.parent._getWorldMatrixDeterminant() < 0 && (a *= -1), i._allowCameraRotation && (i.camera.cameraRotation.y += a / i.angularSensibility, i.camera.cameraRotation.x += c / i.angularSensibility), i.onPointerMovedObservable.notifyObservers({ offsetX: a, 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, Pe.a.POINTERDOWN | Pe.a.POINTERUP | Pe.a.POINTERMOVE), e.addEventListener("mousemove", this._onMouseMove, !1), e.addEventListener("contextmenu", this.onContextMenu.bind(this), !1) }, 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" }, l.c([Object(L.c)()], e.prototype, "buttons", void 0), l.c([Object(L.c)()], e.prototype, "angularSensibility", void 0), e }(); We.FreeCameraMouseInput = ut; var ht = 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 === Pe.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 === Pe.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 === Pe.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, Pe.a.POINTERDOWN | Pe.a.POINTERUP | Pe.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 o.x(0, 0, t * this._offsetY / this.touchMoveSensibility); o.j.RotationYawPitchRollToRef(e.rotation.y, e.rotation.x, 0, e._cameraRotationMatrix), e.cameraDirection.addInPlace(o.x.TransformCoordinates(i, e._cameraRotationMatrix)) } } }, e.prototype.getClassName = function() { return "FreeCameraTouchInput" }, e.prototype.getSimpleName = function() { return "touch" }, l.c([Object(L.c)()], e.prototype, "touchAngularSensibility", void 0), l.c([Object(L.c)()], e.prototype, "touchMoveSensibility", void 0), e }(); We.FreeCameraTouchInput = ht; var dt = function(e) { function t(t) { var i = e.call(this, t) || this; return i._mouseInput = null, i } return l.d(t, e), t.prototype.addKeyboard = function() { return this.add(new lt), this }, t.prototype.addMouse = function(e) { return void 0 === e && (e = !0), this._mouseInput || (this._mouseInput = new ut(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 ht), this }, t.prototype.clear = function() { e.prototype.clear.call(this), this._mouseInput = null }, t }(Xe); dt.prototype.addDeviceOrientation = function() { return this._deviceOrientationInput || (this._deviceOrientationInput = new ft, this.add(this._deviceOrientationInput)), this }; var ft = function() { function e() { var e = this; this._screenOrientationAngle = 0, this._screenQuaternion = new o.q, this._alpha = 0, this._beta = 0, this._gamma = 0, this._onDeviceOrientationChangedObservable = new r.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 = -ye.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 o.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 o.q), this._camera && this._camera.onDisposeObservable.add(function() { t._onDeviceOrientationChangedObservable.clear() }) }, enumerable: !0, configurable: !0 }), 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 && (o.q.RotationYawPitchRollToRef(ye.h.ToRadians(this._alpha), ye.h.ToRadians(this._beta), -ye.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 }(); We.FreeCameraDeviceOrientationInput = ft; var pt = function() { function e() { this.gamepadAngularSensibility = 200, this.gamepadMoveSensibility = 40, this._cameraTransform = o.j.Identity(), this._deltaTransform = o.x.Zero(), this._vector3 = o.x.Zero(), this._vector2 = o.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 !== Ke.POSE_ENABLED && (i.gamepad && e.type !== Ke.XBOX || (i.gamepad = e)) }), this._onGamepadDisconnectedObserver = n.onGamepadDisconnectedObservable.add(function(e) { i.gamepad === e && (i.gamepad = null) }), this.gamepad = n.getGamepadByType(Ke.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 s = r.x / this.gamepadAngularSensibility, a = r.y / this.gamepadAngularSensibility; r.x = Math.abs(s) > .001 ? 0 + s : 0, r.y = Math.abs(a) > .001 ? 0 + a : 0 } else r = { x: 0, y: 0 }; e.rotationQuaternion ? e.rotationQuaternion.toRotationMatrix(this._cameraTransform) : o.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), o.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" }, l.c([Object(L.c)()], e.prototype, "gamepadAngularSensibility", void 0), l.c([Object(L.c)()], e.prototype, "gamepadMoveSensibility", void 0), e }(); We.FreeCameraGamepadInput = pt; var _t, gt = i(61); ! function(e) { e[e.X = 0] = "X", e[e.Y = 1] = "Y", e[e.Z = 2] = "Z" }(_t || (_t = {})); var mt = function() { function e(t) { var i = this; if (this._leftJoystick = !!t, e._globalJoystickIndex++, this._axisTargetedByLeftAndRight = _t.X, this._axisTargetedByUpAndDown = _t.Y, this.reverseLeftRight = !1, this.reverseUpDown = !1, this._touches = new gt.a, this.deltaPosition = o.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, !1), 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 = !1, this._joystickColor = "cyan", this._joystickPointerID = -1, this._joystickPointerPos = new o.w(0, 0), this._joystickPreviousPointerPos = new o.w(0, 0), this._joystickPointerStartPos = new o.w(0, 0), this._deltaJoystickVector = new o.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, !1), e.Canvas.addEventListener("pointermove", this._onPointerMoveHandlerRef, !1), e.Canvas.addEventListener("pointerup", this._onPointerUpHandlerRef, !1), e.Canvas.addEventListener("pointerout", this._onPointerUpHandlerRef, !1), e.Canvas.addEventListener("contextmenu", function(e) { e.preventDefault() }, !1), 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(), (!0 === 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 = !0, 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 = !1; 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, !0), 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, !0), 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, !0), e.vjCanvasContext.stroke(), e.vjCanvasContext.closePath(), 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.beginPath(), e.vjCanvasContext.strokeStyle = "red", e.vjCanvasContext.lineWidth = 6, e.vjCanvasContext.arc(n.x, n.y, 40, 0, 2 * Math.PI, !0), e.vjCanvasContext.stroke(), e.vjCanvasContext.closePath(), 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 }(); dt.prototype.addVirtualJoystick = function() { return this.add(new vt), this }; var vt = 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 = o.j.RotationYawPitchRoll(e.rotation.y, e.rotation.x, 0), n = o.x.TransformCoordinates(new o.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 mt(!0), this._leftjoystick.setAxisForUpDown(_t.Z), this._leftjoystick.setAxisForLeftRight(_t.X), this._leftjoystick.setJoystickSensibility(.15), this._rightjoystick = new mt(!1), this._rightjoystick.setAxisForUpDown(_t.X), this._rightjoystick.setAxisForLeftRight(_t.Y), this._rightjoystick.reverseUpDown = !0, 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 }(); We.FreeCameraVirtualJoystickInput = vt; var yt = function(e) { function t(t, i, n, r) { void 0 === r && (r = !0); var s = e.call(this, t, i, n, r) || this; return s.cameraDirection = new o.x(0, 0, 0), s.cameraRotation = new o.w(0, 0), s.updateUpVectorFromRotation = !1, s._tmpQuaternion = new o.q, s.rotation = new o.x(0, 0, 0), s.speed = 2, s.noRotationConstraint = !1, s.lockedTarget = null, s._currentTarget = o.x.Zero(), s._initialFocalDistance = 1, s._viewMatrix = o.j.Zero(), s._camMatrix = o.j.Zero(), s._cameraTransformMatrix = o.j.Zero(), s._cameraRotationMatrix = o.j.Zero(), s._referencePoint = new o.x(0, 0, 1), s._transformedReferencePoint = o.x.Zero(), s._globalCurrentTarget = o.x.Zero(), s._globalCurrentUpVector = o.x.Zero(), s._defaultUp = o.x.Up(), s._cachedRotationZ = 0, s._cachedQuaternionRotationZ = 0, s } return l.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()), 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()), this.cameraDirection.copyFromFloats(0, 0, 0), this.cameraRotation.copyFromFloats(0, 0), !0) }, t.prototype._initCache = function() { e.prototype._initCache.call(this), this._cache.lockedTarget = new o.x(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), this._cache.rotation = new o.x(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), this._cache.rotationQuaternion = new o.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 !1; 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 += o.h), o.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, 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 && o.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(o.t.Matrix[0]), o.x.TransformNormalToRef(this.cameraDirection, o.t.Matrix[0], o.t.Vector3[0]), void this.position.addInPlace(o.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) { if (this.rotation.x += this.cameraRotation.x, this.rotation.y += this.cameraRotation.y, this.rotationQuaternion) this.rotation.lengthSquared() && o.q.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this.rotationQuaternion); if (!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 * o.h && (this.cameraDirection.x = 0), Math.abs(this.cameraDirection.y) < this.speed * o.h && (this.cameraDirection.y = 0), Math.abs(this.cameraDirection.z) < this.speed * o.h && (this.cameraDirection.z = 0), this.cameraDirection.scaleInPlace(this.inertia)), i && (Math.abs(this.cameraRotation.x) < this.speed * o.h && (this.cameraRotation.x = 0), Math.abs(this.cameraRotation.y) < this.speed * o.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) : o.j.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix) }, t.prototype._rotateUpVectorWithCameraRotationMatrix = function() { return o.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), o.x.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint), this.position.addToRef(this._transformedReferencePoint, this._currentTarget), this.updateUpVectorFromRotation && (this.rotationQuaternion ? o.c.Y.rotateByQuaternionToRef(this.rotationQuaternion, this.upVector) : (o.q.FromEulerVectorToRef(this.rotation, this._tmpQuaternion), o.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(); o.x.TransformCoordinatesToRef(e, n, this._globalPosition), o.x.TransformCoordinatesToRef(t, n, this._globalCurrentTarget), o.x.TransformNormalToRef(i, n, this._globalCurrentUpVector), this._markSyncedWithParent() } else this._globalPosition.copyFrom(e), this._globalCurrentTarget.copyFrom(t), this._globalCurrentUpVector.copyFrom(i); this.getScene().useRightHandedSystem ? o.j.LookAtRHToRef(this._globalPosition, this._globalCurrentTarget, this._globalCurrentUpVector, this._viewMatrix) : o.j.LookAtLHToRef(this._globalPosition, this._globalCurrentTarget, this._globalCurrentUpVector, this._viewMatrix) }, t.prototype.createRigCamera = function(e, i) { if (this.cameraRigMode !== Ne.a.RIG_MODE_NONE) { var n = new t(e, this.position.clone(), this.getScene()); return this.cameraRigMode !== Ne.a.RIG_MODE_VR && this.cameraRigMode !== Ne.a.RIG_MODE_WEBVR || (this.rotationQuaternion || (this.rotationQuaternion = new o.q), n._cameraRigParams = {}, n.rotationQuaternion = new o.q), n } return null }, t.prototype._updateRigCameras = function() { var t = this._rigCameras[0], i = this._rigCameras[1]; switch (this.computeWorldMatrix(), this.cameraRigMode) { case Ne.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH: case Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: case Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: case Ne.a.RIG_MODE_STEREOSCOPIC_OVERUNDER: var n = this.cameraRigMode === Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED ? 1 : -1, r = this.cameraRigMode === Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED ? -1 : 1; this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * n, t), this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * r, i); break; case Ne.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.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); o.j.TranslationToRef(-n.x, -n.y, -n.z, t._TargetTransformMatrix), t._TargetTransformMatrix.multiplyToRef(o.j.RotationY(e), t._RigCamTransformMatrix), o.j.TranslationToRef(n.x, n.y, n.z, t._TargetTransformMatrix), t._RigCamTransformMatrix.multiplyToRef(t._TargetTransformMatrix, t._RigCamTransformMatrix), o.x.TransformCoordinatesToRef(this.position, t._RigCamTransformMatrix, i.position), i.setTarget(n) }, t.prototype.getClassName = function() { return "TargetCamera" }, t._RigCamTransformMatrix = new o.j, t._TargetTransformMatrix = new o.j, t._TargetFocalPoint = new o.x, l.c([Object(L.o)()], t.prototype, "rotation", void 0), l.c([Object(L.c)()], t.prototype, "speed", void 0), l.c([Object(L.k)("lockedTargetId")], t.prototype, "lockedTarget", void 0), t }(Ne.a), bt = function(e) { function t(t, i, n, r) { void 0 === r && (r = !0); var s = e.call(this, t, i, n, r) || this; return s.ellipsoid = new o.x(.5, 1, .5), s.ellipsoidOffset = new o.x(0, 0, 0), s.checkCollisions = !1, s.applyGravity = !1, s._needMoveForGravity = !1, s._oldPosition = o.x.Zero(), s._diffPosition = o.x.Zero(), s._newPosition = o.x.Zero(), s._collisionMask = -1, s._onCollisionPositionChange = function(e, t, i) { void 0 === i && (i = null); var n; n = t, s._newPosition.copyFrom(n), s._newPosition.subtractToRef(s._oldPosition, s._diffPosition), s._diffPosition.length() > ge.b.CollisionsEpsilon && (s.position.addInPlace(s._diffPosition), s.onCollide && i && s.onCollide(i)) }, s.inputs = new dt(s), s.inputs.addKeyboard().addMouse(), s } return l.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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), t.prototype.attachControl = function(e, t) { this.inputs.attachElement(e, t) }, t.prototype.detachControl = function(e) { this.inputs.detachElement(e), this.cameraDirection = new o.x(0, 0, 0), this.cameraRotation = new o.w(0, 0) }, Object.defineProperty(t.prototype, "collisionMask", { get: function() { return this._collisionMask }, set: function(e) { this._collisionMask = isNaN(e) ? -1 : e }, enumerable: !0, configurable: !0 }), t.prototype._collideWithWorld = function(e) { (this.parent ? o.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 = o.x.Zero(), this._transformedDirection = o.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" }, l.c([Object(L.o)()], t.prototype, "ellipsoid", void 0), l.c([Object(L.o)()], t.prototype, "ellipsoidOffset", void 0), l.c([Object(L.c)()], t.prototype, "checkCollisions", void 0), l.c([Object(L.c)()], t.prototype, "applyGravity", void 0), t }(yt); F.a.AddNodeConstructor("TouchCamera", function(e, t) { return function() { return new Tt(e, o.x.Zero(), t) } }); var Tt = function(e) { function t(t, i, n) { var r = e.call(this, t, i, n) || this; return r.inputs.addTouch(), r._setupInputs(), r } return l.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: !0, configurable: !0 }), 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: !0, configurable: !0 }), t.prototype.getClassName = function() { return "TouchCamera" }, t.prototype._setupInputs = function() { var e = this.inputs.attached.mouse; e && (e.touchEnabled = !1) }, t }(bt); F.a.AddNodeConstructor("ArcRotateCamera", function(e, t) { return function() { return new Et(e, 0, 0, 1, o.x.Zero(), t) } }); var Et = function(e) { function t(t, i, n, s, a, c, l) { void 0 === l && (l = !0); var u = e.call(this, t, o.x.Zero(), c, l) || this; return u._upVector = o.x.Up(), u.inertialAlphaOffset = 0, u.inertialBetaOffset = 0, u.inertialRadiusOffset = 0, u.lowerAlphaLimit = null, u.upperAlphaLimit = null, u.lowerBetaLimit = .01, u.upperBetaLimit = Math.PI - .01, u.lowerRadiusLimit = null, u.upperRadiusLimit = null, u.inertialPanningX = 0, u.inertialPanningY = 0, u.pinchToPanMaxDistance = 20, u.panningDistanceLimit = null, u.panningOriginTarget = o.x.Zero(), u.panningInertia = .9, u.zoomOnFactor = 1, u.targetScreenOffset = o.w.Zero(), u.allowUpsideDown = !0, u.useInputToRestoreState = !0, u._viewMatrix = new o.j, u.panningAxis = new o.x(1, 1, 0), u.onMeshTargetChangedObservable = new r.c, u.checkCollisions = !1, u.collisionRadius = new o.x(.5, .5, .5), u._previousPosition = o.x.Zero(), u._collisionVelocity = o.x.Zero(), u._newPosition = o.x.Zero(), u._computationVector = o.x.Zero(), u._onCollisionPositionChange = function(e, t, i) { void 0 === i && (i = null), i ? (u.setPosition(t), u.onCollide && u.onCollide(i)) : u._previousPosition.copyFrom(u._position); var n = Math.cos(u.alpha), r = Math.sin(u.alpha), o = Math.cos(u.beta), s = Math.sin(u.beta); 0 === s && (s = 1e-4); var a = u._getTargetPosition(); u._computationVector.copyFromFloats(u.radius * n * s, u.radius * o, u.radius * r * s), a.addToRef(u._computationVector, u._newPosition), u._position.copyFrom(u._newPosition); var c = u.upVector; u.allowUpsideDown && u.beta < 0 && (c = (c = c.clone()).negate()), u._computeViewMatrix(u._position, a, c), u._viewMatrix.addAtIndex(12, u.targetScreenOffset.x), u._viewMatrix.addAtIndex(13, u.targetScreenOffset.y), u._collisionTriggered = !1 }, u._target = o.x.Zero(), a && u.setTarget(a), u.alpha = i, u.beta = n, u.radius = s, u.getViewMatrix(), u.inputs = new it(u), u.inputs.addKeyboard().addMouseWheel().addPointers(), u } return l.d(t, e), Object.defineProperty(t.prototype, "target", { get: function() { return this._target }, set: function(e) { this.setTarget(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "position", { get: function() { return this._position }, set: function(e) { this.setPosition(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "upVector", { get: function() { return this._upVector }, set: function(e) { this._upToYMatrix || (this._YToUpMatrix = new o.j, this._upToYMatrix = new o.j, this._upVector = o.x.Zero()), e.normalize(), this._upVector.copyFrom(e), this.setMatUp() }, enumerable: !0, configurable: !0 }), t.prototype.setMatUp = function() { o.j.RotationAlignToRef(o.x.UpReadOnly, this._upVector, this._YToUpMatrix), o.j.RotationAlignToRef(this._upVector, o.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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "bouncingBehavior", { get: function() { return this._bouncingBehavior }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "useBouncingBehavior", { get: function() { return null != this._bouncingBehavior }, set: function(e) { e !== this.useBouncingBehavior && (e ? (this._bouncingBehavior = new Ce, this.addBehavior(this._bouncingBehavior)) : this._bouncingBehavior && (this.removeBehavior(this._bouncingBehavior), this._bouncingBehavior = null)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "framingBehavior", { get: function() { return this._framingBehavior }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "useFramingBehavior", { get: function() { return null != this._framingBehavior }, set: function(e) { e !== this.useFramingBehavior && (e ? (this._framingBehavior = new Me, this.addBehavior(this._framingBehavior)) : this._framingBehavior && (this.removeBehavior(this._framingBehavior), this._framingBehavior = null)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "autoRotationBehavior", { get: function() { return this._autoRotationBehavior }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "useAutoRotationBehavior", { get: function() { return null != this._autoRotationBehavior }, set: function(e) { e !== this.useAutoRotationBehavior && (e ? (this._autoRotationBehavior = new Se, this.addBehavior(this._autoRotationBehavior)) : this._autoRotationBehavior && (this.removeBehavior(this._autoRotationBehavior), this._autoRotationBehavior = null)) }, enumerable: !0, configurable: !0 }), t.prototype._initCache = function() { e.prototype._initCache.call(this), this._cache._target = new o.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 = o.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) } var t = this._getLockedTargetPosition(); return t || 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, !0) }, 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 = !0), 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) < o.h && (this.inertialAlphaOffset = 0), Math.abs(this.inertialBetaOffset) < o.h && (this.inertialBetaOffset = 0), Math.abs(this.inertialRadiusOffset) < this.speed * o.h && (this.inertialRadiusOffset = 0) } if (0 !== this.inertialPanningX || 0 !== this.inertialPanningY) { if (this._localDirection || (this._localDirection = o.x.Zero(), this._transformedDirection = o.x.Zero()), this._localDirection.copyFromFloats(this.inertialPanningX, this.inertialPanningY, this.inertialPanningY), this._localDirection.multiplyInPlace(this.panningAxis), this._viewMatrix.invertToRef(this._cameraTransformMatrix), o.x.TransformNormalToRef(this._localDirection, this._cameraTransformMatrix, this._transformedDirection), this.panningAxis.y || (this._transformedDirection.y = 0), !this._targetHost) if (this.panningDistanceLimit) this._transformedDirection.addInPlace(this._target), o.x.DistanceSquared(this._transformedDirection, this.panningOriginTarget) <= this.panningDistanceLimit * this.panningDistanceLimit && this._target.copyFrom(this._transformedDirection); else this._target.addInPlace(this._transformedDirection); this.inertialPanningX *= this.panningInertia, this.inertialPanningY *= this.panningInertia, Math.abs(this.inertialPanningX) < this.speed * o.h && (this.inertialPanningX = 0), Math.abs(this.inertialPanningY) < this.speed * o.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 || o.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 = !1), void 0 === i && (i = !1), 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 || o.x.TransformCoordinatesToRef(this._computationVector, this._YToUpMatrix, this._computationVector), r.addToRef(this._computationVector, this._newPosition), this.getScene().collisionsEnabled && this.checkCollisions) { var s = this.getScene().collisionCoordinator; this._collider || (this._collider = s.createCollider()), this._collider._radius = this.collisionRadius, this._newPosition.subtractToRef(this._position, this._collisionVelocity), this._collisionTriggered = !0, s.getNewPosition(this._position, this._collisionVelocity, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId) } else { this._position.copyFrom(this._newPosition); var a = this.upVector; this.allowUpsideDown && n < 0 && (a = (a = a.clone()).negate()), this._computeViewMatrix(this._position, r, a), 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 = !1), e = e || this.getScene().meshes; var i = fe.a.MinMax(e), n = o.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 = !1), void 0 === e.min) { var r = e || this.getScene().meshes; i = fe.a.MinMax(r), n = o.x.Distance(i.min, i.max) } else { i = e, n = e.distance } this._target = fe.a.Center(i), t || (this.maxZ = 2 * n) }, t.prototype.createRigCamera = function(e, i) { var n = 0; switch (this.cameraRigMode) { case Ne.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH: case Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: case Ne.a.RIG_MODE_STEREOSCOPIC_OVERUNDER: case Ne.a.RIG_MODE_VR: n = this._cameraRigParams.stereoHalfAngle * (0 === i ? 1 : -1); break; case Ne.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 Ne.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH: case Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: case Ne.a.RIG_MODE_STEREOSCOPIC_OVERUNDER: case Ne.a.RIG_MODE_VR: t.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle, i.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle; break; case Ne.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" }, l.c([Object(L.c)()], t.prototype, "alpha", void 0), l.c([Object(L.c)()], t.prototype, "beta", void 0), l.c([Object(L.c)()], t.prototype, "radius", void 0), l.c([Object(L.o)("target")], t.prototype, "_target", void 0), l.c([Object(L.o)("upVector")], t.prototype, "_upVector", void 0), l.c([Object(L.c)()], t.prototype, "inertialAlphaOffset", void 0), l.c([Object(L.c)()], t.prototype, "inertialBetaOffset", void 0), l.c([Object(L.c)()], t.prototype, "inertialRadiusOffset", void 0), l.c([Object(L.c)()], t.prototype, "lowerAlphaLimit", void 0), l.c([Object(L.c)()], t.prototype, "upperAlphaLimit", void 0), l.c([Object(L.c)()], t.prototype, "lowerBetaLimit", void 0), l.c([Object(L.c)()], t.prototype, "upperBetaLimit", void 0), l.c([Object(L.c)()], t.prototype, "lowerRadiusLimit", void 0), l.c([Object(L.c)()], t.prototype, "upperRadiusLimit", void 0), l.c([Object(L.c)()], t.prototype, "inertialPanningX", void 0), l.c([Object(L.c)()], t.prototype, "inertialPanningY", void 0), l.c([Object(L.c)()], t.prototype, "pinchToPanMaxDistance", void 0), l.c([Object(L.c)()], t.prototype, "panningDistanceLimit", void 0), l.c([Object(L.o)()], t.prototype, "panningOriginTarget", void 0), l.c([Object(L.c)()], t.prototype, "panningInertia", void 0), l.c([Object(L.c)()], t.prototype, "zoomOnFactor", void 0), l.c([Object(L.c)()], t.prototype, "targetScreenOffset", void 0), l.c([Object(L.c)()], t.prototype, "allowUpsideDown", void 0), l.c([Object(L.c)()], t.prototype, "useInputToRestoreState", void 0), t }(yt); F.a.AddNodeConstructor("DeviceOrientationCamera", function(e, t) { return function() { return new At(e, o.x.Zero(), t) } }); var At = function(e) { function t(t, i, n) { var r = e.call(this, t, i, n) || this; return r._tmpDragQuaternion = new o.q, r._disablePointerInputWhenUsingDeviceOrientation = !0, r._dragFactor = 0, r._quaternionCache = new o.q, r.inputs.addDeviceOrientation(), r.inputs._deviceOrientationInput && r.inputs._deviceOrientationInput._onDeviceOrientationChangedObservable.addOnce(function() { r._disablePointerInputWhenUsingDeviceOrientation && r.inputs._mouseInput && (r.inputs._mouseInput._allowCameraRotation = !1, r.inputs._mouseInput.onPointerMovedObservable.add(function(e) { 0 != r._dragFactor && (r._initialQuaternion || (r._initialQuaternion = new o.q), o.q.FromEulerAnglesToRef(0, e.offsetX * r._dragFactor, 0, r._tmpDragQuaternion), r._initialQuaternion.multiplyToRef(r._tmpDragQuaternion, r._initialQuaternion)) })) }), r } return l.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), 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 = o.c.Y), this.rotationQuaternion && (this._initialQuaternion || (this._initialQuaternion = new o.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 }(bt), xt = function(e) { function t(t) { return e.call(this, t) || this } return l.d(t, e), t.prototype.addKeyboard = function() { return this.add(new rt), this }, t.prototype.addMouse = function(e) { return void 0 === e && (e = !0), this.add(new ot(e)), this }, t }(Xe), Rt = function(e) { function t(t, i, n, r) { void 0 === r && (r = !0); var s = e.call(this, t, i, n, r) || this; return s.ellipsoid = new o.x(1, 1, 1), s.ellipsoidOffset = new o.x(0, 0, 0), s.checkCollisions = !1, s.applyGravity = !1, s.cameraDirection = o.x.Zero(), s._trackRoll = 0, s.rollCorrect = 100, s.bankedTurn = !1, s.bankedTurnLimit = Math.PI / 2, s.bankedTurnMultiplier = 1, s._needMoveForGravity = !1, s._oldPosition = o.x.Zero(), s._diffPosition = o.x.Zero(), s._newPosition = o.x.Zero(), s._collisionMask = -1, s._onCollisionPositionChange = function(e, t, i) { void 0 === i && (i = null); var n; n = t, s._newPosition.copyFrom(n), s._newPosition.subtractToRef(s._oldPosition, s._diffPosition), s._diffPosition.length() > ge.b.CollisionsEpsilon && (s.position.addInPlace(s._diffPosition), s.onCollide && i && s.onCollide(i)) }, s.inputs = new xt(s), s.inputs.addKeyboard().addMouse(), s } return l.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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), t.prototype.attachControl = function(e, t) { this.inputs.attachElement(e, t) }, t.prototype.detachControl = function(e) { this.inputs.detachElement(e), this.cameraDirection = new o.x(0, 0, 0) }, Object.defineProperty(t.prototype, "collisionMask", { get: function() { return this._collisionMask }, set: function(e) { this._collisionMask = isNaN(e) ? -1 : e }, enumerable: !0, configurable: !0 }), t.prototype._collideWithWorld = function(e) { (this.parent ? o.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 = o.x.Zero(), this._transformedDirection = o.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" }, l.c([Object(L.o)()], t.prototype, "ellipsoid", void 0), l.c([Object(L.o)()], t.prototype, "ellipsoidOffset", void 0), l.c([Object(L.c)()], t.prototype, "checkCollisions", void 0), l.c([Object(L.c)()], t.prototype, "applyGravity", void 0), t }(yt), Pt = function(e) { function t(t) { return e.call(this, t) || this } return l.d(t, e), t.prototype.addKeyboard = function() { return this.add(new st), this }, t.prototype.addMouseWheel = function() { return this.add(new at), this }, t.prototype.addPointers = function() { return this.add(new ct), this }, t.prototype.addVRDeviceOrientation = function() { return console.warn("DeviceOrientation support not yet implemented for FollowCamera."), this }, t }(Xe); F.a.AddNodeConstructor("FollowCamera", function(e, t) { return function() { return new Ct(e, o.x.Zero(), t) } }), F.a.AddNodeConstructor("ArcFollowCamera", function(e, t) { return function() { return new Mt(e, 0, 0, 1, null, t) } }); var St, Ct = 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 Pt(o), o.inputs.addKeyboard().addMouseWheel().addPointers(), o } return l.d(t, e), t.prototype._follow = function(e) { if (e) { var t; if (e.rotationQuaternion) { var i = new o.j; e.rotationQuaternion.toRotationMatrix(i), t = Math.atan2(i.m[8], i.m[10]) } else t = e.rotation.y; var n = ye.h.ToRadians(this.rotationOffset) + t, r = e.getAbsolutePosition(), s = r.x + Math.sin(n) * this.radius, a = r.z + Math.cos(n) * this.radius, c = s - this.position.x, l = r.y + this.heightOffset - this.position.y, u = a - this.position.z, h = c * this.cameraAcceleration * 2, d = l * this.cameraAcceleration, f = u * this.cameraAcceleration * 2; (h > this.maxCameraSpeed || h < -this.maxCameraSpeed) && (h = h < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed), (d > this.maxCameraSpeed || d < -this.maxCameraSpeed) && (d = d < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed), (f > this.maxCameraSpeed || f < -this.maxCameraSpeed) && (f = f < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed), this.position = new o.x(this.position.x + h, this.position.y + d, this.position.z + f), 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" }, l.c([Object(L.c)()], t.prototype, "radius", void 0), l.c([Object(L.c)()], t.prototype, "lowerRadiusLimit", void 0), l.c([Object(L.c)()], t.prototype, "upperRadiusLimit", void 0), l.c([Object(L.c)()], t.prototype, "rotationOffset", void 0), l.c([Object(L.c)()], t.prototype, "lowerRotationOffsetLimit", void 0), l.c([Object(L.c)()], t.prototype, "upperRotationOffsetLimit", void 0), l.c([Object(L.c)()], t.prototype, "heightOffset", void 0), l.c([Object(L.c)()], t.prototype, "lowerHeightOffsetLimit", void 0), l.c([Object(L.c)()], t.prototype, "upperHeightOffsetLimit", void 0), l.c([Object(L.c)()], t.prototype, "cameraAcceleration", void 0), l.c([Object(L.c)()], t.prototype, "maxCameraSpeed", void 0), l.c([Object(L.k)("lockedTargetId")], t.prototype, "lockedTarget", void 0), t }(yt), Mt = function(e) { function t(t, i, n, r, s, a) { var c = e.call(this, t, o.x.Zero(), a) || this; return c.alpha = i, c.beta = n, c.radius = r, c.target = s, c._cartesianCoordinates = o.x.Zero(), c._follow(), c } return l.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 }(yt), Ot = i(35), It = i(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" }(St || (St = {})); var Dt, Lt, wt = 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 }(), Ft = function(e) { function t(t) { var i = e.call(this, t.id, t.index, t) || this; return i._deviceRoomPosition = o.x.Zero(), i._deviceRoomRotationQuaternion = new o.q, i.devicePosition = o.x.Zero(), i.deviceRotationQuaternion = new o.q, i.deviceScaleFactor = 1, i._trackPosition = !0, i._maxRotationDistFromHeadset = Math.PI / 5, i._draggedRoomRotation = 0, i._leftHandSystemQuaternion = new o.q, i._deviceToWorld = o.j.Identity(), i._pointingPoseNode = null, i._workingMatrix = o.j.Identity(), i._meshAttachedObservable = new r.c, i.type = Ke.POSE_ENABLED, i.controllerType = St.GENERIC, i.position = o.x.Zero(), i.rotationQuaternion = new o.q, i._calculatedPosition = o.x.Zero(), i._calculatedRotation = new o.q, o.q.RotationYawPitchRollToRef(Math.PI, 0, 0, i._leftHandSystemQuaternion), i } return l.d(t, e), t.prototype._disableTrackPosition = function(e) { this._trackPosition && (this._calculatedPosition.copyFrom(e), this._trackPosition = !1) }, 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 && P.a.LastCreatedScene && P.a.LastCreatedScene.activeCamera && P.a.LastCreatedScene.activeCamera.devicePosition) && ((t = P.a.LastCreatedScene.activeCamera)._computeDevicePosition(), this._deviceToWorld.setTranslation(t.devicePosition), t.deviceRotationQuaternion)) { var t; (t = t)._deviceRoomRotationQuaternion.toEulerAnglesToRef(o.t.Vector3[0]); var i = Math.atan2(Math.sin(o.t.Vector3[0].y - this._draggedRoomRotation), Math.cos(o.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), s = Math.cos(-n); this._calculatedPosition.x = this._calculatedPosition.x * s - this._calculatedPosition.z * r, this._calculatedPosition.z = this._calculatedPosition.x * r + this._calculatedPosition.z * s } } o.x.TransformCoordinatesToRef(this._calculatedPosition, this._deviceToWorld, this.devicePosition), this._deviceToWorld.getRotationMatrixToRef(this._workingMatrix), o.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 o.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(!0) }) } 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: !0, configurable: !0 }), t.prototype.getForwardRay = function(e) { if (void 0 === e && (e = 100), !this.mesh) return new It.a(o.x.Zero(), new o.x(0, 0, 1), e); var t = this._pointingPoseNode ? this._pointingPoseNode.getWorldMatrix() : this.mesh.getWorldMatrix(), i = t.getTranslation(), n = new o.x(0, 0, -1), r = o.x.TransformNormal(n, t), s = o.x.Normalize(r); return new It.a(i, s, e) }, t.POINTING_POSE = "POINTING_POSE", t }(Ke); ! 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" }(Dt || (Dt = {})), function(e) { e[e.Up = 0] = "Up", e[e.Down = 1] = "Down", e[e.Left = 2] = "Left", e[e.Right = 3] = "Right" }(Lt || (Lt = {})); var Nt = function(e) { function t(t, i, n, o) { void 0 === o && (o = !1); var s = e.call(this, t, i, n, 0, 1, 2, 3) || this; return s._leftTrigger = 0, s._rightTrigger = 0, s.onButtonDownObservable = new r.c, s.onButtonUpObservable = new r.c, s.onPadDownObservable = new r.c, s.onPadUpObservable = new r.c, s._buttonA = 0, s._buttonB = 0, s._buttonX = 0, s._buttonY = 0, s._buttonBack = 0, s._buttonStart = 0, s._buttonLB = 0, s._buttonRB = 0, s._buttonLeftStick = 0, s._buttonRightStick = 0, s._dPadUp = 0, s._dPadDown = 0, s._dPadLeft = 0, s._dPadRight = 0, s._isXboxOnePad = !1, s.type = Ke.XBOX, s._isXboxOnePad = o, s } return l.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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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))), e }, Object.defineProperty(t.prototype, "buttonA", { get: function() { return this._buttonA }, set: function(e) { this._buttonA = this._setButtonValue(e, this._buttonA, Dt.A) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "buttonB", { get: function() { return this._buttonB }, set: function(e) { this._buttonB = this._setButtonValue(e, this._buttonB, Dt.B) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "buttonX", { get: function() { return this._buttonX }, set: function(e) { this._buttonX = this._setButtonValue(e, this._buttonX, Dt.X) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "buttonY", { get: function() { return this._buttonY }, set: function(e) { this._buttonY = this._setButtonValue(e, this._buttonY, Dt.Y) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "buttonStart", { get: function() { return this._buttonStart }, set: function(e) { this._buttonStart = this._setButtonValue(e, this._buttonStart, Dt.Start) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "buttonBack", { get: function() { return this._buttonBack }, set: function(e) { this._buttonBack = this._setButtonValue(e, this._buttonBack, Dt.Back) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "buttonLB", { get: function() { return this._buttonLB }, set: function(e) { this._buttonLB = this._setButtonValue(e, this._buttonLB, Dt.LB) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "buttonRB", { get: function() { return this._buttonRB }, set: function(e) { this._buttonRB = this._setButtonValue(e, this._buttonRB, Dt.RB) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "buttonLeftStick", { get: function() { return this._buttonLeftStick }, set: function(e) { this._buttonLeftStick = this._setButtonValue(e, this._buttonLeftStick, Dt.LeftStick) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "buttonRightStick", { get: function() { return this._buttonRightStick }, set: function(e) { this._buttonRightStick = this._setButtonValue(e, this._buttonRightStick, Dt.RightStick) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "dPadUp", { get: function() { return this._dPadUp }, set: function(e) { this._dPadUp = this._setDPadValue(e, this._dPadUp, Lt.Up) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "dPadDown", { get: function() { return this._dPadDown }, set: function(e) { this._dPadDown = this._setDPadValue(e, this._dPadDown, Lt.Down) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "dPadLeft", { get: function() { return this._dPadLeft }, set: function(e) { this._dPadLeft = this._setDPadValue(e, this._dPadLeft, Lt.Left) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "dPadRight", { get: function() { return this._dPadRight }, set: function(e) { this._dPadRight = this._setDPadValue(e, this._dPadRight, Lt.Right) }, enumerable: !0, configurable: !0 }), 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 }(Ke), Bt = function() { function e(e) { var t = this; this._scene = e, this._babylonGamepads = [], this._oneGamepadConnected = !1, this._isMonitoring = !1, this.onGamepadDisconnectedObservable = new r.c, Ot.a.IsWindowObjectExist() ? (this._gamepadEventSupported = "GamepadEvent" in window, this._gamepadSupport = navigator.getGamepads || navigator.webkitGetGamepads || navigator.msGetGamepads || navigator.webkitGamepads) : this._gamepadEventSupported = !1, this.onGamepadConnectedObservable = new r.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 = !0) : 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 = !1, t.onGamepadDisconnectedObservable.notifyObservers(r); break } }, this._gamepadSupport && (this._updateGamepadObjects(), this._babylonGamepads.length && this._startMonitoringGamepads(), this._gamepadEventSupported ? (window.addEventListener("gamepadconnected", this._onGamepadConnectedEvent, !1), window.addEventListener("gamepaddisconnected", this._onGamepadDisconnectedEvent, !1)) : this._startMonitoringGamepads()) } return Object.defineProperty(e.prototype, "gamepads", { get: function() { return this._babylonGamepads }, enumerable: !0, configurable: !0 }), e.prototype.getGamepadByType = function(e) { void 0 === e && (e = Ke.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 = !1, this._stopMonitoringGamepads(), this._babylonGamepads = [] }, e.prototype._addNewGamepad = function(e) { var t; this._oneGamepadConnected || (this._oneGamepadConnected = !0); var i = -1 !== e.id.search("Xbox One"); return t = i || -1 !== e.id.search("Xbox 360") || -1 !== e.id.search("xinput") ? new Nt(e.id, e.index, e, i) : e.pose ? wt.InitiateController(e) : new Qe(e.id, e.index, e), this._babylonGamepads[t.index] = t, t }, e.prototype._startMonitoringGamepads = function() { this._isMonitoring || (this._isMonitoring = !0, this._scene || this._checkGamepadsStatus()) }, e.prototype._stopMonitoringGamepads = function() { this._isMonitoring = !1 }, 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 && ye.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 = !0, this.onGamepadConnectedObservable.notifyObservers(this._babylonGamepads[t])); else { var n = this._addNewGamepad(i); this.onGamepadConnectedObservable.notifyObservers(n) } } }, e }(); Object.defineProperty(W.a.prototype, "gamepadManager", { get: function() { if (!this._gamepadManager) { this._gamepadManager = new Bt(this); var e = this._getComponent(Ae.a.NAME_GAMEPAD); e || (e = new Ut(this), this._addComponent(e)) } return this._gamepadManager }, enumerable: !0, configurable: !0 }), dt.prototype.addGamepad = function() { return this.add(new pt), this }, it.prototype.addGamepad = function() { return this.add(new qe), this }; var Ut = function() { function e(e) { this.name = Ae.a.NAME_GAMEPAD, this.scene = e } return e.prototype.register = function() { this.scene._beforeCameraUpdateStage.registerStep(Ae.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 }(); F.a.AddNodeConstructor("FreeCamera", function(e, t) { return function() { return new Vt(e, o.x.Zero(), t) } }); var Vt = function(e) { function t(t, i, n) { var r = e.call(this, t, i, n) || this; return r.inputs.addGamepad(), r } return l.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: !0, configurable: !0 }), 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: !0, configurable: !0 }), t.prototype.getClassName = function() { return "UniversalCamera" }, t }(Tt); Ne.a._createDefaultParsedCamera = function(e, t) { return new Vt(e, o.x.Zero(), t) }, F.a.AddNodeConstructor("GamepadCamera", function(e, t) { return function() { return new Gt(e, o.x.Zero(), t) } }); var Gt = function(e) { function t(t, i, n) { return e.call(this, t, i, n) || this } return l.d(t, e), t.prototype.getClassName = function() { return "GamepadCamera" }, t }(Vt), kt = i(28), zt = i(5), jt = "\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}"; zt.a.ShadersStore.postprocessVertexShader = jt; var Ht = function() { function e(e, t, i, n, s, a, c, l, u, h, d, f, p, g) { void 0 === c && (c = _.a.TEXTURE_NEAREST_SAMPLINGMODE), void 0 === h && (h = null), void 0 === d && (d = _.a.TEXTURETYPE_UNSIGNED_INT), void 0 === f && (f = "postprocess"), void 0 === g && (g = !1), this.name = e, this.width = -1, this.height = -1, this._outputTexture = null, this.autoClear = !0, this.alphaMode = _.a.ALPHA_DISABLE, this.animations = new Array, this.enablePixelPerfectMode = !1, this.forceFullscreenViewport = !0, this.scaleMode = _.a.SCALEMODE_FLOOR, this.alwaysForcePOT = !1, this._samples = 1, this.adaptScaleToCurrentViewport = !1, this._reusable = !1, this._textures = new kt.a(2), this._currentRenderTextureInd = 0, this._scaleRatio = new o.w(1, 1), this._texelSize = o.w.Zero(), this.onActivateObservable = new r.c, this.onSizeChangedObservable = new r.c, this.onApplyObservable = new r.c, this.onBeforeRenderObservable = new r.c, this.onAfterRenderObservable = new r.c, null != a ? (this._camera = a, this._scene = a.getScene(), a.attachPostProcess(this), this._engine = this._scene.getEngine(), this._scene.postProcesses.push(this), this.uniqueId = this._scene.getUniqueId()) : l && (this._engine = l, this._engine.postProcesses.push(this)), this._options = s, this.renderTargetSamplingMode = c || _.a.TEXTURE_NEAREST_SAMPLINGMODE, this._reusable = u || !1, this._textureType = d, this._samplers = n || [], this._samplers.push("textureSampler"), this._fragmentUrl = t, this._vertexUrl = f, this._parameters = i || [], this._parameters.push("scale"), this._indexParameters = p, g || 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "onSizeChanged", { set: function(e) { this._onSizeChangedObserver && this.onSizeChangedObservable.remove(this._onSizeChangedObserver), this._onSizeChangedObserver = this.onSizeChangedObservable.add(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "onApply", { set: function(e) { this._onApplyObserver && this.onApplyObservable.remove(this._onApplyObserver), this._onApplyObserver = this.onApplyObservable.add(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "onBeforeRender", { set: function(e) { this._onBeforeRenderObserver && this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver), this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "onAfterRender", { set: function(e) { this._onAfterRenderObserver && this.onAfterRenderObservable.remove(this._onAfterRenderObserver), this._onAfterRenderObserver = this.onAfterRenderObservable.add(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "inputTexture", { get: function() { return this._textures.data[this._currentRenderTextureInd] }, set: function(e) { this._forcedOutputTexture = e }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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 kt.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(), s = o.getCaps().maxTextureSize, a = (t ? t.width : this._engine.getRenderWidth(!0)) * this._options | 0, c = (t ? t.height : this._engine.getRenderHeight(!0)) * this._options | 0, l = e.parent; !l || l.leftCamera != e && l.rightCamera != e || (a /= 2); var u, h = this._options.width || a, d = this._options.height || c; if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) { if (this.adaptScaleToCurrentViewport) { var f = o.currentViewport; f && (h *= f.width, d *= f.height) } if ((this.renderTargetSamplingMode === _.a.TEXTURE_TRILINEAR_SAMPLINGMODE || this.alwaysForcePOT) && (this._options.width || (h = o.needPOTTextures ? ye.h.GetExponentOfTwo(h, s, this.scaleMode) : h), this._options.height || (d = o.needPOTTextures ? ye.h.GetExponentOfTwo(d, s, this.scaleMode) : d)), this.width !== h || this.height !== d) { 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 = d; var g = { width: this.width, height: this.height }, m = { generateMipMaps: !1, 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(g, m)), this._reusable && this._textures.push(this._engine.createRenderTargetTexture(g, m)), 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) }) } return this._shareOutputWithPostProcess ? u = this._shareOutputWithPostProcess.inputTexture : this._forcedOutputTexture ? (u = this._forcedOutputTexture, this.width = this._forcedOutputTexture.width, this.height = this._forcedOutputTexture.height) : u = this.inputTexture, this.enablePixelPerfectMode ? (this._scaleRatio.copyFromFloats(a / h, c / d), this._engine.bindFramebuffer(u, 0, a, c, this.forceFullscreenViewport)) : (this._scaleRatio.copyFromFloats(1, 1), this._engine.bindFramebuffer(u, 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, !0, !0), this._reusable && (this._currentRenderTextureInd = (this._currentRenderTextureInd + 1) % 2), u }, Object.defineProperty(e.prototype, "isSupported", { get: function() { return this._effect.isSupported }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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(!1), this._engine.setDepthBuffer(!1), this._engine.setDepthWrite(!1), 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._effect._bindTexture("textureSampler", e), this._effect.setVector2("scale", this._scaleRatio), this.onApplyObservable.notifyObservers(this._effect), 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.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() } }, e }(), Wt = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\n}"; zt.a.ShadersStore.passPixelShader = Wt; var Xt = "\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}"; zt.a.ShadersStore.passCubePixelShader = Xt; var Yt = function(e) { function t(t, i, n, r, o, s, a, c) { return void 0 === n && (n = null), void 0 === a && (a = _.a.TEXTURETYPE_UNSIGNED_INT), void 0 === c && (c = !1), e.call(this, t, "pass", null, null, i, n, r, o, s, void 0, a, void 0, null, c) || this } return l.d(t, e), t }(Ht), Kt = function(e) { function t(t, i, n, r, o, s, a, c) { void 0 === n && (n = null), void 0 === a && (a = _.a.TEXTURETYPE_UNSIGNED_INT), void 0 === c && (c = !1); var l = e.call(this, t, "passCube", null, null, i, n, r, o, s, "#define POSITIVEX", a, void 0, null, c) || this; return l._face = 0, l } return l.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: !0, configurable: !0 }), t }(Ht); ge.b._RescalePostProcessFactory = function(e) { return new Yt("rescale", 1, null, ge.b.TEXTURE_BILINEAR_SAMPLINGMODE, e, !1, ge.b.TEXTURETYPE_UNSIGNED_INT) }; var Qt = "\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}"; zt.a.ShadersStore.anaglyphPixelShader = Qt; var qt = function(e) { function t(t, i, n, r, o, s) { var a = e.call(this, t, "anaglyph", null, ["leftSampler"], i, n[1], r, o, s) || this; return a._passedProcess = n[0]._rigPostProcess, a.onApplyObservable.add(function(e) { e.setTextureFromPostProcess("leftSampler", a._passedProcess) }), a } return l.d(t, e), t }(Ht); Ne.a._setStereoscopicAnaglyphRigMode = function(e) { e._rigCameras[0]._rigPostProcess = new Yt(e.name + "_passthru", 1, e._rigCameras[0]), e._rigCameras[1]._rigPostProcess = new qt(e.name + "_anaglyph", 1, e._rigCameras) }, F.a.AddNodeConstructor("AnaglyphArcRotateCamera", function(e, t, i) { return function() { return new Zt(e, 0, 0, 1, o.x.Zero(), i.interaxial_distance, t) } }); var Zt = function(e) { function t(t, i, n, r, o, s, a) { var c = e.call(this, t, i, n, r, o, a) || this; return c.interaxialDistance = s, c.setCameraRigMode(Ne.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: s }), c } return l.d(t, e), t.prototype.getClassName = function() { return "AnaglyphArcRotateCamera" }, t }(Et); F.a.AddNodeConstructor("AnaglyphFreeCamera", function(e, t, i) { return function() { return new Jt(e, o.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(Ne.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: n }), o } return l.d(t, e), t.prototype.getClassName = function() { return "AnaglyphFreeCamera" }, t }(bt); F.a.AddNodeConstructor("AnaglyphGamepadCamera", function(e, t, i) { return function() { return new $t(e, o.x.Zero(), i.interaxial_distance, t) } }); var $t = function(e) { function t(t, i, n, r) { var o = e.call(this, t, i, r) || this; return o.interaxialDistance = n, o.setCameraRigMode(Ne.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: n }), o } return l.d(t, e), t.prototype.getClassName = function() { return "AnaglyphGamepadCamera" }, t }(Gt); F.a.AddNodeConstructor("AnaglyphUniversalCamera", function(e, t, i) { return function() { return new ei(e, o.x.Zero(), i.interaxial_distance, t) } }); var ei = function(e) { function t(t, i, n, r) { var o = e.call(this, t, i, r) || this; return o.interaxialDistance = n, o.setCameraRigMode(Ne.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: n }), o } return l.d(t, e), t.prototype.getClassName = function() { return "AnaglyphUniversalCamera" }, t }(Vt), ti = "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}"; zt.a.ShadersStore.stereoscopicInterlacePixelShader = ti; var ii = function(e) { function t(t, i, n, r, s, a) { var c = e.call(this, t, "stereoscopicInterlace", ["stepSize"], ["camASampler"], 1, i[1], r, s, a, n ? "#define IS_STEREOSCOPIC_HORIZ 1" : void 0) || this; return c._passedProcess = i[0]._rigPostProcess, c._stepSize = new o.w(1 / c.width, 1 / c.height), c.onSizeChangedObservable.add(function() { c._stepSize = new o.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 l.d(t, e), t }(Ht); Ne.a._setStereoscopicRigMode = function(e) { var t = e.cameraRigMode === Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL || e.cameraRigMode === Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED; e._rigCameras[0]._rigPostProcess = new Yt(e.name + "_passthru", 1, e._rigCameras[0]), e._rigCameras[1]._rigPostProcess = new ii(e.name + "_stereoInterlace", e._rigCameras, t) }, F.a.AddNodeConstructor("StereoscopicArcRotateCamera", function(e, t, i) { return function() { return new ni(e, 0, 0, 1, o.x.Zero(), i.interaxial_distance, i.isStereoscopicSideBySide, t) } }); var ni = function(e) { function t(t, i, n, r, o, s, a, c) { var l = e.call(this, t, i, n, r, o, c) || this; return l.interaxialDistance = s, l.isStereoscopicSideBySide = a, l.setCameraRigMode(a ? Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : Ne.a.RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: s }), l } return l.d(t, e), t.prototype.getClassName = function() { return "StereoscopicArcRotateCamera" }, t }(Et); F.a.AddNodeConstructor("StereoscopicFreeCamera", function(e, t, i) { return function() { return new ri(e, o.x.Zero(), i.interaxial_distance, i.isStereoscopicSideBySide, t) } }); var ri = function(e) { function t(t, i, n, r, o) { var s = e.call(this, t, i, o) || this; return s.interaxialDistance = n, s.isStereoscopicSideBySide = r, s.setCameraRigMode(r ? Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : Ne.a.RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: n }), s } return l.d(t, e), t.prototype.getClassName = function() { return "StereoscopicFreeCamera" }, t }(bt); F.a.AddNodeConstructor("StereoscopicGamepadCamera", function(e, t, i) { return function() { return new oi(e, o.x.Zero(), i.interaxial_distance, i.isStereoscopicSideBySide, t) } }); var oi = function(e) { function t(t, i, n, r, o) { var s = e.call(this, t, i, o) || this; return s.interaxialDistance = n, s.isStereoscopicSideBySide = r, s.setCameraRigMode(r ? Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : Ne.a.RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: n }), s } return l.d(t, e), t.prototype.getClassName = function() { return "StereoscopicGamepadCamera" }, t }(Gt); F.a.AddNodeConstructor("StereoscopicFreeCamera", function(e, t, i) { return function() { return new si(e, o.x.Zero(), i.interaxial_distance, i.isStereoscopicSideBySide, t) } }); var si = function(e) { function t(t, i, n, r, o) { var s = e.call(this, t, i, o) || this; return s.interaxialDistance = n, s.isStereoscopicSideBySide = r, s.setCameraRigMode(r ? Ne.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : Ne.a.RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: n }), s } return l.d(t, e), t.prototype.getClassName = function() { return "StereoscopicUniversalCamera" }, t }(Vt); F.a.AddNodeConstructor("VirtualJoysticksCamera", function(e, t) { return function() { return new ai(e, o.x.Zero(), t) } }); var ai = function(e) { function t(t, i, n) { var r = e.call(this, t, i, n) || this; return r.inputs.addVirtualJoystick(), r } return l.d(t, e), t.prototype.getClassName = function() { return "VirtualJoysticksCamera" }, t }(bt), ci = function() { function e() { this.compensateDistortion = !0, this.multiviewEnabled = !1 } return Object.defineProperty(e.prototype, "aspectRatio", { get: function() { return this.hResolution / (2 * this.vResolution) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "aspectRatioFov", { get: function() { return 2 * Math.atan(this.postProcessScaleFactor * this.vScreenSize / (2 * this.eyeToScreenDistance)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "leftHMatrix", { get: function() { var e = 4 * (this.hScreenSize / 4 - this.lensSeparationDistance / 2) / this.hScreenSize; return o.j.Translation(e, 0, 0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "rightHMatrix", { get: function() { var e = 4 * (this.hScreenSize / 4 - this.lensSeparationDistance / 2) / this.hScreenSize; return o.j.Translation(-e, 0, 0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "leftPreViewMatrix", { get: function() { return o.j.Translation(.5 * this.interpupillaryDistance, 0, 0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "rightPreViewMatrix", { get: function() { return o.j.Translation(-.5 * this.interpupillaryDistance, 0, 0) }, enumerable: !0, configurable: !0 }), 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, t }, e }(), li = "\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}"; zt.a.ShadersStore.vrDistortionCorrectionPixelShader = li; var ui = function(e) { function t(t, i, n, r) { var s = e.call(this, t, "vrDistortionCorrection", ["LensCenter", "Scale", "ScaleIn", "HmdWarpParam"], null, r.postProcessScaleFactor, i, ke.a.BILINEAR_SAMPLINGMODE) || this; return s._isRightEye = n, s._distortionFactors = r.distortionK, s._postProcessScaleFactor = r.postProcessScaleFactor, s._lensCenterOffset = r.lensCenterOffset, s.adaptScaleToCurrentViewport = !0, s.onSizeChangedObservable.add(function() { s._scaleIn = new o.w(2, 2 / s.aspectRatio), s._scaleFactor = new o.w(1 / s._postProcessScaleFactor * .5, 1 / s._postProcessScaleFactor * .5 * s.aspectRatio), s._lensCenter = new o.w(s._isRightEye ? .5 - .5 * s._lensCenterOffset : .5 + .5 * s._lensCenterOffset, .5) }), s.onApplyObservable.add(function(e) { e.setFloat2("LensCenter", s._lensCenter.x, s._lensCenter.y), e.setFloat2("Scale", s._scaleFactor.x, s._scaleFactor.y), e.setFloat2("ScaleIn", s._scaleIn.x, s._scaleIn.y), e.setFloat4("HmdWarpParam", s._distortionFactors[0], s._distortionFactors[1], s._distortionFactors[2], s._distortionFactors[3]) }), s } return l.d(t, e), t }(Ht), hi = "#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}"; zt.a.ShadersStore.vrMultiviewToSingleviewPixelShader = hi; var di = i(63), fi = i(83), pi = i(91); ge.b.prototype.createRenderTargetCubeTexture = function(e, t) { var i = l.a({ generateMipMaps: !0, generateDepthBuffer: !0, generateStencilBuffer: !1, type: ge.b.TEXTURETYPE_UNSIGNED_INT, samplingMode: ge.b.TEXTURE_TRILINEAR_SAMPLINGMODE, format: ge.b.TEXTUREFORMAT_RGBA }, t); i.generateStencilBuffer = i.generateDepthBuffer && i.generateStencilBuffer, (i.type !== ge.b.TEXTURETYPE_FLOAT || this._caps.textureFloatLinearFiltering) && (i.type !== ge.b.TEXTURETYPE_HALF_FLOAT || this._caps.textureHalfFloatLinearFiltering) || (i.samplingMode = ge.b.TEXTURE_NEAREST_SAMPLINGMODE); var n = this._gl, r = new ze.a(this, ze.a.DATASOURCE_RENDERTARGET); this._bindTextureDirectly(n.TEXTURE_CUBE_MAP, r, !0); var o = this._getSamplingParameters(i.samplingMode, i.generateMipMaps); i.type !== ge.b.TEXTURETYPE_FLOAT || this._caps.textureFloat || (i.type = ge.b.TEXTURETYPE_UNSIGNED_INT, p.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 s = 0; s < 6; s++) n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X + s, 0, this._getRGBABufferInternalSizedFormat(i.type, i.format), e, e, 0, this._getInternalFormat(i.format), this._getWebGLTextureType(i.type), null); var a = n.createFramebuffer(); return this._bindUnboundFramebuffer(a), 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 = a, r.width = e, r.height = e, r.isReady = !0, r.isCube = !0, 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 _i = function(e) { function t(t, i, n, s, a, c, l, u, h, d, f, p, g) { void 0 === a && (a = !0), void 0 === c && (c = _.a.TEXTURETYPE_UNSIGNED_INT), void 0 === l && (l = !1), void 0 === u && (u = ke.a.TRILINEAR_SAMPLINGMODE), void 0 === h && (h = !0), void 0 === d && (d = !1), void 0 === f && (f = !1), void 0 === p && (p = _.a.TEXTUREFORMAT_RGBA), void 0 === g && (g = !1); var m = e.call(this, null, n, !s) || this; return m.isCube = l, m.renderParticles = !0, m.renderSprites = !1, m.coordinatesMode = ke.a.PROJECTION_MODE, m.ignoreCameraViewport = !1, m.onBeforeBindObservable = new r.c, m.onAfterUnbindObservable = new r.c, m.onBeforeRenderObservable = new r.c, m.onAfterRenderObservable = new r.c, m.onClearObservable = new r.c, m._currentRefreshId = -1, m._refreshRate = 1, m._samples = 1, m.boundingBoxPosition = o.x.Zero(), (n = m.getScene()) ? (m.renderList = new Array, m._engine = n.getEngine(), m.name = t, m.isRenderTarget = !0, m._initialSizeParameter = i, m._processSizeParameter(i), m._resizeObserver = m.getScene().getEngine().onResizeObservable.add(function() {}), m._generateMipMaps = !!s, m._doNotChangeAspectRatio = a, m._renderingManager = new pi.b(n), m._renderingManager._useSceneAutoClearSetup = !0, f ? m : (m._renderTargetOptions = { generateMipMaps: s, type: c, format: p, samplingMode: u, generateDepthBuffer: h, generateStencilBuffer: d }, u === ke.a.NEAREST_SAMPLINGMODE && (m.wrapU = ke.a.CLAMP_ADDRESSMODE, m.wrapV = ke.a.CLAMP_ADDRESSMODE), g || (l ? (m._texture = n.getEngine().createRenderTargetCubeTexture(m.getRenderSize(), m._renderTargetOptions), m.coordinatesMode = ke.a.INVCUBIC_MODE, m._textureMatrix = o.j.Identity()) : m._texture = n.getEngine().createRenderTargetTexture(m._size, m._renderTargetOptions)), m)) : m } return l.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: !0, configurable: !0 }), 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, s = i.apply(e, n); return o && t.getScene().meshes.forEach(function(e) { e._markSubMeshesAsLightDirty() }), s }; 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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onBeforeRender", { set: function(e) { this._onBeforeRenderObserver && this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver), this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onAfterRender", { set: function(e) { this._onAfterRenderObserver && this.onAfterRenderObservable.remove(this._onAfterRenderObserver), this._onAfterRenderObserver = this.onAfterRenderObservable.add(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onClear", { set: function(e) { this._onClearObserver && this.onClearObservable.remove(this._onClearObserver), this._onClearObserver = this.onClearObservable.add(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "renderTargetOptions", { get: function() { return this._renderTargetOptions }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), t.prototype.createDepthStencilTexture = function(e, t, i) { if (void 0 === e && (e = 0), void 0 === t && (t = !0), void 0 === i && (i = !1), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), t.prototype.addPostProcess = function(e) { if (!this._postProcessManager) { var t = this.getScene(); if (!t) return; this._postProcessManager = new fi.a(t), this._postProcesses = new Array } this._postProcesses.push(e), this._postProcesses[0].autoClear = !1 }, t.prototype.clearPostProcesses = function(e) { if (void 0 === e && (e = !1), 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 = !1)) } }, t.prototype._shouldRender = function() { return -1 === this._currentRefreshId ? (this._currentRefreshId = 1, !0) : this.refreshRate === this._currentRefreshId ? (this._currentRefreshId = 1, !0) : (this._currentRefreshId++, !1) }, 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 !0 }, enumerable: !0, configurable: !0 }), 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 = !1), void 0 === t && (t = !1), a = this.getScene()) { var i, n = a.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], s = a.getMeshByID(o); s && this.renderList.push(s) } delete this._waitingRenderList } if (this.renderListPredicate) { var a; if (this.renderList ? this.renderList.length = 0 : this.renderList = [], !(a = this.getScene())) return; var c = a.meshes; for (r = 0; r < c.length; r++) { var l = c[r]; this.renderListPredicate(l) && this.renderList.push(l) } } this.onBeforeBindObservable.notifyObservers(this), this.activeCamera ? (i = this.activeCamera, n.setViewport(this.activeCamera.viewport, this.getRenderWidth(), this.getRenderHeight()), this.activeCamera !== a.activeCamera && a.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(!0))) : (i = a.activeCamera) && n.setViewport(i.viewport, this.getRenderWidth(), this.getRenderHeight()), this._renderingManager.reset(); for (var u = this.renderList ? this.renderList : a.getActiveMeshes().data, h = this.renderList ? this.renderList.length : a.getActiveMeshes().length, d = a.getRenderId(), f = 0; f < h; f++) { if (l = u[f]) { if (!l.isReady(0 === this.refreshRate)) { this.resetRefreshCounter(); continue } l._preActivateForIntermediateRendering(d); var p = void 0; if (p = !(this.renderList || !i) && 0 == (l.layerMask & i.layerMask), l.isEnabled() && l.isVisible && l.subMeshes && !p && l._activate(d, !0)) { l.isAnInstance ? l = l.sourceMesh : l._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = !1, l._internalAbstractMeshDataInfo._isActiveIntermediate = !0; for (var _ = 0; _ < l.subMeshes.length; _++) { var g = l.subMeshes[_]; a._activeIndices.addCount(g.indexCount, !1), this._renderingManager.dispatch(g, l) } } } } for (var m = 0; m < a.particleSystems.length; m++) { var v = a.particleSystems[m], y = v.emitter; v.isStarted() && y && y.position && y.isEnabled() && (u.indexOf(y) >= 0 && this._renderingManager.dispatchParticles(v)) } if (this.isCube) for (var b = 0; b < 6; b++) this.renderToTarget(b, u, e, t), a.incrementRenderId(), a.resetCachedMaterial(); else this.renderToTarget(0, u, e, t); this.onAfterUnbindObservable.notifyObservers(this), a.activeCamera && (this.activeCamera && this.activeCamera !== a.activeCamera && a.setTransformMatrix(a.activeCamera.getViewMatrix(), a.activeCamera.getProjectionMatrix(!0)), n.setViewport(a.activeCamera.viewport)), a.resetCachedMaterial() } }, t.prototype._bestReflectionRenderTargetDimension = function(e, t) { var i = e * t, n = ye.h.NearestPOT(i + 16384 / (128 + i)); return Math.min(ye.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, !0, !0, !0), this._doNotChangeAspectRatio || r.updateTransformMatrix(!0); for (var s = 0, a = r._beforeRenderTargetDrawStage; s < a.length; s++) { a[s].action(this) } this._renderingManager.render(this.customRenderFunction, t, this.renderParticles, this.renderSprites); for (var c = 0, l = r._afterRenderTargetDrawStage; c < l.length; c++) { l[c].action(this) } this._postProcessManager ? this._postProcessManager._finalizeFrame(!1, this._texture, e, this._postProcesses, this.ignoreCameraViewport) : i && r.postProcessManager._finalizeFrame(!1, this._texture, e), this._doNotChangeAspectRatio || r.updateTransformMatrix(!0), n && ye.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 = !1 }, 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(!0), 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 }(ke.a); ke.a._CreateRenderTargetTexture = function(e, t, i, n) { return new _i(e, t, i, n) }; var gi = function(e) { function t(t, i) { void 0 === i && (i = 512); var n = e.call(this, "multiview rtt", i, t, !1, !0, ze.a.DATASOURCE_UNKNOWN, !1, void 0, !1, !1, !0, void 0, !0) || this, r = t.getEngine().createMultiviewRenderTargetTexture(n.getRenderWidth(), n.getRenderHeight()); return r.isMultiview = !0, n._texture = r, n } return l.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 }(_i); ge.b.prototype.createMultiviewRenderTargetTexture = function(e, t) { var i = this._gl; if (!this.getCaps().multiview) throw "Multiview is not supported"; var n = new ze.a(this, ze.a.DATASOURCE_UNKNOWN, !0); 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 = !0, n }, ge.b.prototype.bindMultiviewFramebuffer = function(e) { var t = this._gl, i = this.getCaps().multiview; if (this.bindFramebuffer(e, void 0, void 0, void 0, !0), 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) }, Ne.a.prototype._useMultiviewToSingleView = !1, Ne.a.prototype._multiviewTexture = null, Ne.a.prototype._resizeOrCreateMultiviewTexture = function(e, t) { this._multiviewTexture ? this._multiviewTexture.getRenderWidth() == e && this._multiviewTexture.getRenderHeight() == t || (this._multiviewTexture.dispose(), this._multiviewTexture = new gi(this.getScene(), { width: e, height: t })) : this._multiviewTexture = new gi(this.getScene(), { width: e, height: t }) }, W.a.prototype._transformMatrixR = o.j.Zero(), W.a.prototype._multiviewSceneUbo = null, W.a.prototype._createMultiviewUbo = function() { this._multiviewSceneUbo = new di.a(this.getEngine(), void 0, !0), this._multiviewSceneUbo.addUniform("viewProjection", 16), this._multiviewSceneUbo.addUniform("viewProjectionR", 16), this._multiviewSceneUbo.addUniform("view", 16) }, W.a.prototype._updateMultiviewUbo = function(e, t) { e && t && e.multiplyToRef(t, this._transformMatrixR), e && t && (e.multiplyToRef(t, o.t.Matrix[0]), o.i.GetRightPlaneToRef(o.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()) }, W.a.prototype._renderMultiviewToSingleView = function(e) { e._resizeOrCreateMultiviewTexture(e._rigPostProcess && e._rigPostProcess && e._rigPostProcess.width > 0 ? e._rigPostProcess.width / 2 : this.getEngine().getRenderWidth(!0) / 2, e._rigPostProcess && e._rigPostProcess && e._rigPostProcess.height > 0 ? e._rigPostProcess.height : this.getEngine().getRenderHeight(!0)), 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 mi = function(e) { function t(t, i, n) { var r = e.call(this, t, "vrMultiviewToSingleview", ["imageIndex"], ["multiviewSampler"], n, i, ke.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 l.d(t, e), t }(Ht); Ne.a._setVRRigMode = function(e, t) { var i = t.vrCameraMetrics || ci.GetDefault(); e._rigCameras[0]._cameraRigParams.vrMetrics = i, e._rigCameras[0].viewport = new o.z(0, 0, .5, 1), e._rigCameras[0]._cameraRigParams.vrWorkMatrix = new o.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 o.z(.5, 0, .5, 1), e._rigCameras[1]._cameraRigParams.vrWorkMatrix = new o.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 = !0, e._rigPostProcess = new mi("VRMultiviewToSingleview", e, i.postProcessScaleFactor)) : (p.a.Warn("Multiview is not supported, falling back to standard rendering"), i.multiviewEnabled = !1)), i.compensateDistortion && (e._rigCameras[0]._rigPostProcess = new ui("VR_Distort_Compensation_Left", e._rigCameras[0], !1, i), e._rigCameras[1]._rigPostProcess = new ui("VR_Distort_Compensation_Right", e._rigCameras[1], !0, i)) }, F.a.AddNodeConstructor("VRDeviceOrientationFreeCamera", function(e, t) { return function() { return new vi(e, 0, 0, 1, o.x.Zero(), t) } }); var vi = function(e) { function t(t, i, n, r, o, s, a, c) { void 0 === a && (a = !0), void 0 === c && (c = ci.GetDefault()); var l = e.call(this, t, i, n, r, o, s) || this; return c.compensateDistortion = a, l.setCameraRigMode(Ne.a.RIG_MODE_VR, { vrCameraMetrics: c }), l.inputs.addVRDeviceOrientation(), l } return l.d(t, e), t.prototype.getClassName = function() { return "VRDeviceOrientationArcRotateCamera" }, t }(Et); F.a.AddNodeConstructor("VRDeviceOrientationFreeCamera", function(e, t) { return function() { return new yi(e, o.x.Zero(), t) } }); var yi = function(e) { function t(t, i, n, r, o) { void 0 === r && (r = !0), void 0 === o && (o = ci.GetDefault()); var s = e.call(this, t, i, n) || this; return o.compensateDistortion = r, s.setCameraRigMode(Ne.a.RIG_MODE_VR, { vrCameraMetrics: o }), s } return l.d(t, e), t.prototype.getClassName = function() { return "VRDeviceOrientationFreeCamera" }, t }(At); F.a.AddNodeConstructor("VRDeviceOrientationGamepadCamera", function(e, t) { return function() { return new bi(e, o.x.Zero(), t) } }); var bi = function(e) { function t(t, i, n, r, o) { void 0 === r && (r = !0), void 0 === o && (o = ci.GetDefault()); var s = e.call(this, t, i, n, r, o) || this; return s.inputs.addGamepad(), s } return l.d(t, e), t.prototype.getClassName = function() { return "VRDeviceOrientationGamepadCamera" }, t }(yi), Ti = i(65); Ne.a._setWebVRRigMode = function(e, t) { if (t.vrDisplay) { var i = t.vrDisplay.getEyeParameters("left"), n = t.vrDisplay.getEyeParameters("right"); e._rigCameras[0].viewport = new o.z(0, 0, .5, 1), e._rigCameras[0].setCameraRigParameter("left", !0), 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 o.j, e._rigCameras[0].getProjectionMatrix = e._getWebVRProjectionMatrix, e._rigCameras[0].parent = e, e._rigCameras[0]._getViewMatrix = e._getWebVRViewMatrix, e._rigCameras[1].viewport = new o.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 o.j, e._rigCameras[1].getProjectionMatrix = e._getWebVRProjectionMatrix, e._rigCameras[1].parent = e, e._rigCameras[1]._getViewMatrix = e._getWebVRViewMatrix } }, Object.defineProperty(ge.b.prototype, "isInVRExclusivePointerMode", { get: function() { return this._vrExclusivePointerMode }, enumerable: !0, configurable: !0 }), ge.b.prototype._prepareVRComponent = function() { this._vrSupported = !1, this._vrExclusivePointerMode = !1, this.onVRDisplayChangedObservable = new r.c, this.onVRRequestPresentComplete = new r.c, this.onVRRequestPresentStart = new r.c }, ge.b.prototype.isVRDevicePresent = function() { return !!this._vrDisplay }, ge.b.prototype.getVRDevice = function() { return this._vrDisplay }, ge.b.prototype.initWebVR = function() { return this.initWebVRAsync(), this.onVRDisplayChangedObservable }, ge.b.prototype.initWebVRAsync = function() { var e = this, t = function() { var t = { vrDisplay: e._vrDisplay, vrSupported: e._vrSupported }; e.onVRDisplayChangedObservable.notifyObservers(t), e._webVRInitPromise = new Promise(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 = ye.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 }, ge.b.prototype._getVRDisplaysAsync = function() { var e = this; return new Promise(function(t) { navigator.getVRDisplays ? navigator.getVRDisplays().then(function(i) { e._vrSupported = !0, e._vrDisplay = i[0], t({ vrDisplay: e._vrDisplay, vrSupported: e._vrSupported }) }) : (e._vrDisplay = void 0, e._vrSupported = !1, t({ vrDisplay: e._vrDisplay, vrSupported: e._vrSupported })) }) }, ge.b.prototype.enableVR = function() { var e = this; if (this._vrDisplay && !this._vrDisplay.isPresenting) { this.onVRRequestPresentStart.notifyObservers(this), this._vrDisplay.requestPresent([{ source: this.getRenderingCanvas() }]).then(function() { e.onVRRequestPresentComplete.notifyObservers(!0), e._onVRFullScreenTriggered() }).catch(function() { e.onVRRequestPresentComplete.notifyObservers(!1) }) } }, ge.b.prototype._onVRFullScreenTriggered = function() { if (this._vrDisplay && this._vrDisplay.isPresenting) { this._oldSize = new o.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) }, ge.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() }), Ot.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)) }, ge.b.prototype._connectVREvents = function(e, t) { this._onVRDisplayPointerRestricted = function() { e && e.requestPointerLock() }, this._onVRDisplayPointerUnrestricted = function() { t.exitPointerLock && t.exitPointerLock() }, Ot.a.IsWindowObjectExist() && (window.addEventListener("vrdisplaypointerrestricted", this._onVRDisplayPointerRestricted, !1), window.addEventListener("vrdisplaypointerunrestricted", this._onVRDisplayPointerUnrestricted, !1)) }, ge.b.prototype._submitVRFrame = function() { if (this._vrDisplay && this._vrDisplay.isPresenting) try { this._vrDisplay.submitFrame() } catch (e) { ye.h.Warn("webVR submitFrame has had an unexpected failure: " + e) } }, ge.b.prototype.isVRPresenting = function() { return this._vrDisplay && this._vrDisplay.isPresenting }, ge.b.prototype._requestVRFrame = function() { this._frameHandler = ye.h.QueueNewFrame(this._bindedRenderFunction, this._vrDisplay) }, F.a.AddNodeConstructor("WebVRFreeCamera", function(e, t) { return function() { return new Ei(e, o.x.Zero(), t) } }), F.a.AddNodeConstructor("WebVRGamepadCamera", function(e, t) { return function() { return new Ei(e, o.x.Zero(), t) } }); var Ei = function(e) { function t(t, i, n, s) { void 0 === s && (s = {}); var a = e.call(this, t, i, n) || this; a.webVROptions = s, a._vrDevice = null, a.rawPose = null, a._specsVersion = "1.1", a._attached = !1, a._descendants = [], a._deviceRoomPosition = o.x.Zero(), a._deviceRoomRotationQuaternion = o.q.Identity(), a._standingMatrix = null, a.devicePosition = o.x.Zero(), a.deviceRotationQuaternion = o.q.Identity(), a.deviceScaleFactor = 1, a._deviceToWorld = o.j.Identity(), a._worldToDevice = o.j.Identity(), a.controllers = [], a.onControllersAttachedObservable = new r.c, a.onControllerMeshLoadedObservable = new r.c, a.onPoseUpdatedFromDeviceObservable = new r.c, a._poseSet = !1, a.rigParenting = !0, a._defaultHeight = void 0, a._htmlElementAttached = null, a._detachIfAttached = function() { var e = a.getEngine().getVRDevice(); e && !e.isPresenting && a._htmlElementAttached && a.detachControl(a._htmlElementAttached) }, a._workingVector = o.x.Zero(), a._oneVector = o.x.One(), a._workingMatrix = o.j.Identity(), a._tmpMatrix = new o.j, a._cache.position = o.x.Zero(), s.defaultHeight && (a._defaultHeight = s.defaultHeight, a.position.y = a._defaultHeight), a.minZ = .1, 5 === arguments.length && (a.webVROptions = arguments[4]), null == a.webVROptions.trackPosition && (a.webVROptions.trackPosition = !0), null == a.webVROptions.controllerMeshes && (a.webVROptions.controllerMeshes = !0), null == a.webVROptions.defaultLightingOnControllers && (a.webVROptions.defaultLightingOnControllers = !0), a.rotationQuaternion = new o.q, a.webVROptions && a.webVROptions.positionScale && (a.deviceScaleFactor = a.webVROptions.positionScale); var c = a.getEngine(); return a._onVREnabled = function(e) { e && a.initControllers() }, c.onVRRequestPresentComplete.add(a._onVREnabled), c.initWebVR().add(function(e) { e.vrDisplay && a._vrDevice !== e.vrDisplay && (a._vrDevice = e.vrDisplay, a.setCameraRigMode(Ne.a.RIG_MODE_WEBVR, { parentCamera: a, vrDisplay: a._vrDevice, frameData: a._frameData, specs: a._specsVersion }), a._attached && a.getEngine().enableVR()) }), "undefined" != typeof VRFrameData && (a._frameData = new VRFrameData), s.useMultiview && (a.getScene().getEngine().getCaps().multiview ? (a._useMultiviewToSingleView = !0, a._rigPostProcess = new mi("VRMultiviewToSingleview", a, 1)) : (p.a.Warn("Multiview is not supported, falling back to standard rendering"), a._useMultiviewToSingleView = !1)), n.onBeforeCameraRenderObservable.add(function(e) { e.parent === a && a.rigParenting && (a._descendants = a.getDescendants(!0, function(e) { var t = a.controllers.some(function(t) { return t._mesh === e }), i = -1 !== a._rigCameras.indexOf(e); return !t && !i }), a._descendants.forEach(function(t) { t.parent = e })) }), n.onAfterCameraRenderObservable.add(function(e) { e.parent === a && a.rigParenting && a._descendants.forEach(function(e) { e.parent = a }) }), a } return l.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 o.j, o.j.FromFloat32ArrayToRefScaled(i.vrDisplay.stageParameters.sittingToStandingTransform, 0, 1, t._standingMatrix), t.getScene().useRightHandedSystem || t._standingMatrix && t._standingMatrix.toggleModelMatrixHandInPlace(), e(!0)) : e(!1) }) }, t.prototype.useStandingMatrixAsync = function() { var e = this; return new Promise(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 }, Object.defineProperty(t.prototype, "leftController", { get: function() { return this._leftController || (this._leftController = this.getControllerByName("left")), this._leftController }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "rightController", { get: function() { return this._rightController || (this._rightController = this.getControllerByName("right")), this._rightController }, enumerable: !0, configurable: !0 }), 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 = !0) }, t.prototype.attachControl = function(t, i) { e.prototype.attachControl.call(this, t, i), this._attached = !0, this._htmlElementAttached = t, i = !Ne.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), e.prototype.detachControl.call(this, t), this._attached = !1, 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), e.position.copyFrom(this._deviceRoomPosition), t.position.copyFrom(this._deviceRoomPosition) }, t.prototype._correctPositionIfNotTrackPosition = function(e, t) { void 0 === t && (t = !1), this.rawPose && this.rawPose.position && !this.webVROptions.trackPosition && (o.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 = !0, this.update()), this.rotationQuaternion.toRotationMatrix(this._workingMatrix), o.x.TransformCoordinatesToRef(this._deviceRoomPosition, this._workingMatrix, this._workingVector), this.devicePosition.subtractToRef(this._workingVector, this._workingVector), o.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._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() })), t || e.prototype._updateCache.call(this), this.updateCacheCalled = !1 }, t.prototype._computeDevicePosition = function() { o.x.TransformCoordinatesToRef(this._deviceRoomPosition, this._deviceToWorld, this.devicePosition) }, t.prototype.update = function() { this._computeDevicePosition(), o.j.FromQuaternionToRef(this._deviceRoomRotationQuaternion, this._workingMatrix), this._workingMatrix.multiplyToRef(this._deviceToWorld, this._workingMatrix), o.q.FromRotationMatrixToRef(this._workingMatrix, this.deviceRotationQuaternion), this._poseSet && this.onPoseUpdatedFromDeviceObservable.notifyObservers(null), e.prototype.update.call(this) }, t.prototype._getViewMatrix = function() { return o.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 o.j.FromArrayToRef(t, 0, this._webvrViewMatrix), this.getScene().useRightHandedSystem || this._webvrViewMatrix.toggleModelMatrixHandInPlace(), this._webvrViewMatrix.getRotationMatrixToRef(this._cameraRotationMatrix), o.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, !0), e._worldToDevice.multiplyToRef(this._webvrViewMatrix, this._webvrViewMatrix), this._workingMatrix = this._workingMatrix || o.j.Identity(), this._webvrViewMatrix.invertToRef(this._workingMatrix), 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 o.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 === Ke.POSE_ENABLED) { var i = t; i.defaultModel && i.defaultModel.setEnabled(!1), "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 === Ke.POSE_ENABLED) { var i = t; if (e.webVROptions.trackPosition || (i._disableTrackPosition(new o.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(!0) : i.initControllerMesh(e.getScene(), function(t) { if (t.scaling.scaleInPlace(e.deviceScaleFactor), e.onControllerMeshLoadedObservable.notifyObservers(i), e.webVROptions.defaultLightingOnControllers) { e._lightOnControllers || (e._lightOnControllers = new Ti.a("vrControllersLight", new o.x(0, 1, 0), e.getScene())); var n = function(e, t) { var i = e.getChildren(); i && 0 !== i.length && i.forEach(function(e) { t.includedOnlyMeshes.push(e), n(e, t) }) }; e._lightOnControllers.includedOnlyMeshes.push(t), n(t, e._lightOnControllers) } })), i.attachToPoseControlledCamera(e), -1 === e.controllers.indexOf(i)) { e.controllers.push(i); for (var n = !1, r = 0; r < e.controllers.length; r++) e.controllers[r].controllerType === St.VIVE && (n ? e.controllers[r].hand = "right" : (n = !0, e.controllers[r].hand = "left")); e.controllers.length >= 2 && e.onControllersAttachedObservable.notifyObservers(e.controllers) } } }) }, t }(bt), Ai = function(e) { function t(t) { var i = e.call(this, t) || this; return i.onTriggerStateChangedObservable = new r.c, i.onMainButtonStateChangedObservable = new r.c, i.onSecondaryButtonStateChangedObservable = new r.c, i.onPadStateChangedObservable = new r.c, i.onPadValuesChangedObservable = new r.c, i.pad = { x: 0, y: 0 }, i._changes = { pressChanged: !1, touchChanged: !1, valueChanged: !1, changed: !1 }, i._buttons = new Array(t.buttons.length), i.hand = t.hand, i } return l.d(t, e), t.prototype.onButtonStateChange = function(e) { this._onButtonStateChange = e }, Object.defineProperty(t.prototype, "defaultModel", { get: function() { return this._defaultModel }, enumerable: !0, configurable: !0 }), 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: !1, touched: !1, 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, this._changes }, t.prototype.dispose = function() { e.prototype.dispose.call(this), this.onTriggerStateChangedObservable.clear(), this.onMainButtonStateChangedObservable.clear(), this.onSecondaryButtonStateChangedObservable.clear(), this.onPadStateChangedObservable.clear(), this.onPadValuesChangedObservable.clear() }, t }(Ft), xi = i(31), Ri = i(33), Pi = function(e) { function t(t, i, n, r, o, s) { void 0 === n && (n = null), void 0 === o && (o = _.a.TEXTURE_TRILINEAR_SAMPLINGMODE), void 0 === s && (s = _.a.TEXTUREFORMAT_RGBA); var a = e.call(this, null, n, !r, void 0, o, void 0, void 0, void 0, void 0, s) || this; a.name = t, a._engine = a.getScene().getEngine(), a.wrapU = ke.a.CLAMP_ADDRESSMODE, a.wrapV = ke.a.CLAMP_ADDRESSMODE, a._generateMipMaps = r, i.getContext ? (a._canvas = i, a._texture = a._engine.createDynamicTexture(i.width, i.height, r, o)) : (a._canvas = document.createElement("canvas"), i.width || 0 === i.width ? a._texture = a._engine.createDynamicTexture(i.width, i.height, r, o) : a._texture = a._engine.createDynamicTexture(i, i, r, o)); var c = a.getSize(); return a._canvas.width = c.width, a._canvas.height = c.height, a._context = a._canvas.getContext("2d"), a } return l.d(t, e), t.prototype.getClassName = function() { return "DynamicTexture" }, Object.defineProperty(t.prototype, "canRescale", { get: function() { return !0 }, enumerable: !0, configurable: !0 }), 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 = !1), 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, s, a) { void 0 === a && (a = !0); 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 l = this._context.measureText(e); t = (c.width - l.width) / 2 } if (null == i) { var u = parseInt(n.replace(/\D/g, "")); i = c.height / 2 + u / 3.65 } this._context.fillStyle = r, this._context.fillText(e, t, i), a && this.update(s) }, 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() && p.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 }(ke.a), Si = (i(86), i(56), i(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}"); zt.a.ShadersStore.imageProcessingPixelShader = Si; var Ci = function(e) { function t(t, i, n, r, o, s, a, c) { void 0 === n && (n = null), void 0 === a && (a = _.a.TEXTURETYPE_UNSIGNED_INT); var l = e.call(this, t, "imageProcessing", [], [], i, n, r, o, s, null, a, "postprocess", null, !0) || this; return l._fromLinearSpace = !0, l._defines = { IMAGEPROCESSING: !1, VIGNETTE: !1, VIGNETTEBLENDMODEMULTIPLY: !1, VIGNETTEBLENDMODEOPAQUE: !1, TONEMAPPING: !1, TONEMAPPING_ACES: !1, CONTRAST: !1, COLORCURVES: !1, COLORGRADING: !1, COLORGRADING3D: !1, FROMLINEARSPACE: !1, SAMPLER3DGREENDEPTH: !1, SAMPLER3DBGRMAP: !1, IMAGEPROCESSINGPOSTPROCESS: !1, EXPOSURE: !1 }, c ? (c.applyByPostProcess = !0, l._attachImageProcessingConfiguration(c, !0), l.fromLinearSpace = !1) : (l._attachImageProcessingConfiguration(null, !0), l.imageProcessingConfiguration.applyByPostProcess = !0), l.onApply = function(e) { l.imageProcessingConfiguration.bind(e, l.aspectRatio) }, l } return l.d(t, e), Object.defineProperty(t.prototype, "imageProcessingConfiguration", { get: function() { return this._imageProcessingConfiguration }, set: function(e) { this._attachImageProcessingConfiguration(e) }, enumerable: !0, configurable: !0 }), t.prototype._attachImageProcessingConfiguration = function(e, t) { var i = this; if (void 0 === t && (t = !1), 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 s = r.scenes; n = s[s.length - 1] } else n = P.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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "colorCurvesEnabled", { get: function() { return this.imageProcessingConfiguration.colorCurvesEnabled }, set: function(e) { this.imageProcessingConfiguration.colorCurvesEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "colorGradingTexture", { get: function() { return this.imageProcessingConfiguration.colorGradingTexture }, set: function(e) { this.imageProcessingConfiguration.colorGradingTexture = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "colorGradingEnabled", { get: function() { return this.imageProcessingConfiguration.colorGradingEnabled }, set: function(e) { this.imageProcessingConfiguration.colorGradingEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "exposure", { get: function() { return this.imageProcessingConfiguration.exposure }, set: function(e) { this.imageProcessingConfiguration.exposure = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "toneMappingEnabled", { get: function() { return this._imageProcessingConfiguration.toneMappingEnabled }, set: function(e) { this._imageProcessingConfiguration.toneMappingEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "toneMappingType", { get: function() { return this._imageProcessingConfiguration.toneMappingType }, set: function(e) { this._imageProcessingConfiguration.toneMappingType = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "contrast", { get: function() { return this.imageProcessingConfiguration.contrast }, set: function(e) { this.imageProcessingConfiguration.contrast = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "vignetteStretch", { get: function() { return this.imageProcessingConfiguration.vignetteStretch }, set: function(e) { this.imageProcessingConfiguration.vignetteStretch = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "vignetteCentreX", { get: function() { return this.imageProcessingConfiguration.vignetteCentreX }, set: function(e) { this.imageProcessingConfiguration.vignetteCentreX = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "vignetteCentreY", { get: function() { return this.imageProcessingConfiguration.vignetteCentreY }, set: function(e) { this.imageProcessingConfiguration.vignetteCentreY = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "vignetteWeight", { get: function() { return this.imageProcessingConfiguration.vignetteWeight }, set: function(e) { this.imageProcessingConfiguration.vignetteWeight = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "vignetteColor", { get: function() { return this.imageProcessingConfiguration.vignetteColor }, set: function(e) { this.imageProcessingConfiguration.vignetteColor = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "vignetteCameraFov", { get: function() { return this.imageProcessingConfiguration.vignetteCameraFov }, set: function(e) { this.imageProcessingConfiguration.vignetteCameraFov = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "vignetteBlendMode", { get: function() { return this.imageProcessingConfiguration.vignetteBlendMode }, set: function(e) { this.imageProcessingConfiguration.vignetteBlendMode = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "vignetteEnabled", { get: function() { return this.imageProcessingConfiguration.vignetteEnabled }, set: function(e) { this.imageProcessingConfiguration.vignetteEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "fromLinearSpace", { get: function() { return this._fromLinearSpace }, set: function(e) { this._fromLinearSpace !== e && (this._fromLinearSpace = e, this._updateParameters()) }, enumerable: !0, configurable: !0 }), t.prototype.getClassName = function() { return "ImageProcessingPostProcess" }, t.prototype._updateParameters = function() { this._defines.FROMLINEARSPACE = this._fromLinearSpace, this.imageProcessingConfiguration.prepareDefines(this._defines, !0); var e = ""; for (var t in this._defines) this._defines[t] && (e += "#define " + t + ";\r\n"); var i = ["textureSampler"], n = ["scale"]; xi.a && (xi.a.PrepareSamplers(i, this._defines), xi.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 = !1) }, l.c([Object(L.c)()], t.prototype, "_fromLinearSpace", void 0), t }(Ht), Mi = i(13), Oi = i(4); fe.a._GroundMeshParser = function(e, t) { return Ii.Parse(e, t) }; var Ii = function(e) { function t(t, i) { var n = e.call(this, t, i) || this; return n.generateOctree = !1, n } return l.d(t, e), t.prototype.getClassName = function() { return "GroundMesh" }, Object.defineProperty(t.prototype, "subdivisions", { get: function() { return Math.min(this._subdivisionsX, this._subdivisionsY) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "subdivisionsX", { get: function() { return this._subdivisionsX }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "subdivisionsY", { get: function() { return this._subdivisionsY }, enumerable: !0, configurable: !0 }), 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 = o.t.Matrix[5]; i.invertToRef(n); var r = o.t.Vector3[8]; if (o.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 s = this._getFacetAt(e, t), a = -(s.x * e + s.z * t + s.w) / s.y; return o.x.TransformCoordinatesFromFloatsToRef(0, a, 0, i, r), r.y }, t.prototype.getNormalAtCoordinates = function(e, t) { var i = new o.x(0, 1, 0); return this.getNormalAtCoordinatesToRef(e, t, i), i }, t.prototype.getNormalAtCoordinatesToRef = function(e, t, i) { var n = this.getWorldMatrix(), r = o.t.Matrix[5]; n.invertToRef(r); var s = o.t.Vector3[8]; if (o.x.TransformCoordinatesFromFloatsToRef(e, 0, t, r, s), e = s.x, t = s.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 a = this._getFacetAt(e, t); return o.x.TransformNormalFromFloatsToRef(a.x, a.y, a.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: o.w.Zero(), facet1: new o.y(0, 0, 0, 0), facet2: new o.y(0, 0, 0, 0) }; this._heightQuads[i * e + n] = r } return this }, t.prototype._computeHeightQuads = function() { var e = this.getVerticesData(Oi.b.PositionKind); if (!e) return this; for (var t = o.t.Vector3[3], i = o.t.Vector3[2], n = o.t.Vector3[1], r = o.t.Vector3[0], s = o.t.Vector3[4], a = o.t.Vector3[5], c = o.t.Vector3[6], l = o.t.Vector3[7], u = o.t.Vector3[8], h = 0, d = 0, f = 0, p = 0, _ = 0, g = 0, m = 0, v = this._subdivisionsX, y = this._subdivisionsY, b = 0; b < y; b++) for (var T = 0; T < v; T++) { h = 3 * T, d = b * (v + 1) * 3, f = (b + 1) * (v + 1) * 3, t.x = e[d + h], t.y = e[d + h + 1], t.z = e[d + h + 2], i.x = e[d + h + 3], i.y = e[d + h + 4], i.z = e[d + h + 5], n.x = e[f + h], n.y = e[f + h + 1], n.z = e[f + h + 2], r.x = e[f + h + 3], r.y = e[f + h + 4], r.z = e[f + h + 5], p = (r.z - t.z) / (r.x - t.x), _ = t.z - p * t.x, i.subtractToRef(t, s), n.subtractToRef(t, a), r.subtractToRef(t, c), o.x.CrossToRef(c, a, l), o.x.CrossToRef(s, c, u), l.normalize(), u.normalize(), g = -(l.x * t.x + l.y * t.y + l.z * t.z), m = -(u.x * i.x + u.y * i.y + u.z * i.z); var E = this._heightQuads[b * v + T]; E.slope.copyFromFloats(p, _), E.facet1.copyFromFloats(l.x, l.y, l.z, g), E.facet2.copyFromFloats(u.x, u.y, u.z, m) } 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 }(fe.a); Mi.a.CreateGround = function(e) { var t, i, n = [], r = [], s = [], a = [], c = e.width || 1, l = e.height || 1, u = e.subdivisionsX || e.subdivisions || 1, h = e.subdivisionsY || e.subdivisions || 1; for (t = 0; t <= h; t++) for (i = 0; i <= u; i++) { var d = new o.x(i * c / u - c / 2, 0, (h - t) * l / h - l / 2), f = new o.x(0, 1, 0); r.push(d.x, d.y, d.z), s.push(f.x, f.y, f.z), a.push(i / u, 1 - t / h) } for (t = 0; t < h; t++) for (i = 0; i < u; i++) n.push(i + 1 + (t + 1) * (u + 1)), n.push(i + 1 + t * (u + 1)), n.push(i + t * (u + 1)), n.push(i + (t + 1) * (u + 1)), n.push(i + 1 + (t + 1) * (u + 1)), n.push(i + t * (u + 1)); var p = new Mi.a; return p.indices = n, p.positions = r, p.normals = s, p.uvs = a, p }, Mi.a.CreateTiledGround = function(e) { var t, i, n, r, s = void 0 !== e.xmin && null !== e.xmin ? e.xmin : -1, a = void 0 !== e.zmin && null !== e.zmin ? e.zmin : -1, c = void 0 !== e.xmax && null !== e.xmax ? e.xmax : 1, l = void 0 !== e.zmax && null !== e.zmax ? e.zmax : 1, u = e.subdivisions || { w: 1, h: 1 }, h = e.precision || { w: 1, h: 1 }, d = new Array, f = new Array, p = new Array, _ = new Array; u.h = u.h < 1 ? 1 : u.h, u.w = u.w < 1 ? 1 : u.w, h.w = h.w < 1 ? 1 : h.w, h.h = h.h < 1 ? 1 : h.h; var g = (c - s) / u.w, m = (l - a) / u.h; function v(e, n, r, s) { var a = f.length / 3, c = h.w + 1; for (t = 0; t < h.h; t++) for (i = 0; i < h.w; i++) { var l = [a + i + t * c, a + (i + 1) + t * c, a + (i + 1) + (t + 1) * c, a + i + (t + 1) * c]; d.push(l[1]), d.push(l[2]), d.push(l[3]), d.push(l[0]), d.push(l[1]), d.push(l[3]) } var u = o.x.Zero(), g = new o.x(0, 1, 0); for (t = 0; t <= h.h; t++) for (u.z = t * (s - n) / h.h + n, i = 0; i <= h.w; i++) u.x = i * (r - e) / h.w + e, u.y = 0, f.push(u.x, u.y, u.z), p.push(g.x, g.y, g.z), _.push(i / h.w, t / h.h) } for (n = 0; n < u.h; n++) for (r = 0; r < u.w; r++) v(s + r * g, a + n * m, s + (r + 1) * g, a + (n + 1) * m); var y = new Mi.a; return y.indices = d, y.positions = f, y.normals = p, y.uvs = _, y }, Mi.a.CreateGroundFromHeightMap = function(e) { var t, i, n = [], r = [], s = [], a = [], c = e.colorFilter || new o.e(.3, .59, .11), l = e.alphaFilter || 0, u = !1; if (e.minHeight > e.maxHeight) { u = !0; 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 d = new o.x(i * e.width / e.subdivisions - e.width / 2, 0, (e.subdivisions - t) * e.height / e.subdivisions - e.height / 2), f = 4 * (((d.x + e.width / 2) / e.width * (e.bufferWidth - 1) | 0) + ((1 - (d.z + e.height / 2) / e.height) * (e.bufferHeight - 1) | 0) * e.bufferWidth), p = e.buffer[f] / 255, _ = e.buffer[f + 1] / 255, g = e.buffer[f + 2] / 255, m = e.buffer[f + 3] / 255; u && (p = 1 - p, _ = 1 - _, g = 1 - g); var v = p * c.r + _ * c.g + g * c.b; d.y = m >= l ? e.minHeight + (e.maxHeight - e.minHeight) * v : e.minHeight - o.h, r.push(d.x, d.y, d.z), s.push(0, 0, 0), a.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), T = i + t * (e.subdivisions + 1), E = i + (t + 1) * (e.subdivisions + 1), A = r[3 * y + 1] >= e.minHeight, x = r[3 * b + 1] >= e.minHeight, R = r[3 * T + 1] >= e.minHeight; A && x && R && (n.push(y), n.push(b), n.push(T)), r[3 * E + 1] >= e.minHeight && A && R && (n.push(E), n.push(y), n.push(T)) } Mi.a.ComputeNormals(r, n, s); var P = new Mi.a; return P.indices = n, P.positions = r, P.normals = s, P.uvs = a, P }, fe.a.CreateGround = function(e, t, i, n, r, o) { var s = { width: t, height: i, subdivisions: n, updatable: o }; return Di.CreateGround(e, s, r) }, fe.a.CreateTiledGround = function(e, t, i, n, r, o, s, a, c) { var l = { xmin: t, zmin: i, xmax: n, zmax: r, subdivisions: o, precision: s, updatable: c }; return Di.CreateTiledGround(e, l, a) }, fe.a.CreateGroundFromHeightMap = function(e, t, i, n, r, o, s, a, c, l, u) { var h = { width: i, height: n, subdivisions: r, minHeight: o, maxHeight: s, updatable: c, onReady: l, alphaFilter: u }; return Di.CreateGroundFromHeightMap(e, t, h, a) }; var Di = function() { function e() {} return e.CreateGround = function(e, t, i) { var n = new Ii(e, i); return n._setReady(!1), 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, Mi.a.CreateGround(t).applyToMesh(n, t.updatable), n._setReady(!0), n }, e.CreateTiledGround = function(e, t, i) { void 0 === i && (i = null); var n = new fe.a(e, i); return Mi.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, s = i.height || 10, a = i.subdivisions || 1, c = i.minHeight || 0, l = i.maxHeight || 1, u = i.colorFilter || new o.e(.3, .59, .11), h = i.alphaFilter || 0, d = i.updatable, f = i.onReady; n = n || P.a.LastCreatedScene; var p = new Ii(e, n); p._subdivisionsX = a, p._subdivisionsY = a, p._width = r, p._height = s, p._maxX = p._width / 2, p._maxZ = p._height / 2, p._minX = -p._maxX, p._minZ = -p._maxZ, p._setReady(!1); return ye.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 o = e.width, _ = e.height; t.width = o, t.height = _, i.drawImage(e, 0, 0); var g = i.getImageData(0, 0, o, _).data; Mi.a.CreateGroundFromHeightMap({ width: r, height: s, subdivisions: a, minHeight: c, maxHeight: l, colorFilter: u, buffer: g, bufferWidth: o, bufferHeight: _, alphaFilter: h }).applyToMesh(p, d), f && f(p), p._setReady(!0) } }, function() {}, n.offlineProvider), p }, e }(); Mi.a.CreateTorus = function(e) { for (var t = [], i = [], n = [], r = [], s = e.diameter || 1, a = e.thickness || .5, c = e.tessellation || 16, l = 0 === e.sideOrientation ? 0 : e.sideOrientation || Mi.a.DEFAULTSIDE, u = c + 1, h = 0; h <= c; h++) for (var d = h / c, f = h * Math.PI * 2 / c - Math.PI / 2, p = o.j.Translation(s / 2, 0, 0).multiply(o.j.RotationY(f)), _ = 0; _ <= c; _++) { var g = 1 - _ / c, m = _ * Math.PI * 2 / c + Math.PI, v = Math.cos(m), y = Math.sin(m), b = new o.x(v, y, 0), T = b.scale(a / 2), E = new o.w(d, g); T = o.x.TransformCoordinates(T, p), b = o.x.TransformNormal(b, p), i.push(T.x, T.y, T.z), n.push(b.x, b.y, b.z), r.push(E.x, E.y); var A = (h + 1) % u, x = (_ + 1) % u; t.push(h * u + _), t.push(h * u + x), t.push(A * u + _), t.push(h * u + x), t.push(A * u + x), t.push(A * u + _) } Mi.a._ComputeSides(l, i, t, n, r, e.frontUVs, e.backUVs); var R = new Mi.a; return R.indices = t, R.positions = i, R.normals = n, R.uvs = r, R }, fe.a.CreateTorus = function(e, t, i, n, r, o, s) { var a = { diameter: t, thickness: i, tessellation: n, sideOrientation: s, updatable: o }; return wi.CreateTorus(e, a, r) }; var Li, wi = function() { function e() {} return e.CreateTorus = function(e, t, i) { var n = new fe.a(e, i); return t.sideOrientation = fe.a._GetDefaultSideOrientation(t.sideOrientation), n._originalBuilderSideOrientation = t.sideOrientation, Mi.a.CreateTorus(t).applyToMesh(n, t.updatable), n }, e }(), Fi = i(53), Ni = function() { function e(t, i) { if (void 0 === i && (i = null), this.scene = t, this._pointerDownOnMeshAsked = !1, this._isActionableMesh = !1, this._teleportationRequestInitiated = !1, this._teleportationBackRequestInitiated = !1, this._rotationRightAsked = !1, this._rotationLeftAsked = !1, this._dpadPressed = !0, this._activePointer = !1, this._id = e._idCounter++, i) this._gazeTracker = i.clone("gazeTracker"); else { this._gazeTracker = fe.a.CreateTorus("gazeTracker", .0035, .0025, 20, t, !1), this._gazeTracker.bakeCurrentTransformIntoVertices(), this._gazeTracker.isPickable = !1, this._gazeTracker.isVisible = !1; var n = new Ri.a("targetMat", t); n.specularColor = o.e.Black(), n.emissiveColor = new o.e(.7, .7, .7), n.backFaceCulling = !1, this._gazeTracker.material = n } } return e.prototype._getForwardRay = function(e) { return new It.a(o.x.Zero(), new o.x(0, 0, e)) }, e.prototype._selectionPointerDown = function() { this._pointerDownOnMeshAsked = !0, 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 = !1 }, e.prototype._activatePointer = function() { this._activePointer = !0 }, e.prototype._deactivatePointer = function() { this._activePointer = !1 }, e.prototype._updatePointerDistance = function(e) { void 0 === e && (e = 100) }, e.prototype.dispose = function() { this._interactionsEnabled = !1, this._teleportationEnabled = !1, this._gazeTracker && this._gazeTracker.dispose() }, e._idCounter = 0, e }(), Bi = function(e) { function t(t, i, n) { var r = e.call(this, i, n) || this; r.webVRController = t, r._laserPointer = fe.a.CreateCylinder("laserPointer", 1, .004, 2e-4, 20, 1, i, !1); var s = new Ri.a("laserPointerMat", i); if (s.emissiveColor = new o.e(.7, .7, .7), s.alpha = .6, r._laserPointer.material = s, r._laserPointer.rotation.x = Math.PI / 2, r._laserPointer.position.z = -.5, r._laserPointer.isVisible = !1, r._laserPointer.isPickable = !1, !t.mesh) { var a = new fe.a("preloadControllerMesh", i), c = new fe.a(Ft.POINTING_POSE, i); c.rotation.x = -.7, a.addChild(c), t.attachToMesh(a) } return r._setLaserPointerParent(t.mesh), r._meshAttachedObserver = t._meshAttachedObservable.add(function(e) { r._setLaserPointerParent(e) }), r } return l.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 = !0 }, t.prototype._deactivatePointer = function() { e.prototype._deactivatePointer.call(this), this._laserPointer.isVisible = !1 }, t.prototype._setLaserPointerColor = function(e) { this._laserPointer.material.emissiveColor = e }, t.prototype._setLaserPointerParent = function(e) { var t = function(e) { e.isPickable = !1, e.getChildMeshes().forEach(function(e) { t(e) }) }; t(e); var i = e.getChildren(void 0, !1), n = e; this.webVRController._pointingPoseNode = null; for (var r = 0; r < i.length; r++) if (i[r].name && i[r].name.indexOf(Ft.POINTING_POSE) >= 0) { n = i[r], this.webVRController._pointingPoseNode = n; break } this._laserPointer.parent = n }, 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) }, t }(Ni), Ui = function(e) { function t(t, i) { var n = e.call(this, i) || this; return n.getCamera = t, n } return l.d(t, e), t.prototype._getForwardRay = function(e) { var t = this.getCamera(); return t ? t.getForwardRay(e) : new It.a(o.x.Zero(), o.x.Forward()) }, t }(Ni), Vi = function() { return function() {} }(), Gi = function() { function e(e, t) { var i = this; if (void 0 === t && (t = {}), this.webVROptions = t, this._webVRsupported = !1, this._webVRready = !1, this._webVRrequesting = !1, this._webVRpresenting = !1, this._fullscreenVRpresenting = !1, this.onEnteringVRObservable = new r.c, this.onAfterEnteringVRObservable = new r.c, this.onExitingVRObservable = new r.c, this.onControllerMeshLoadedObservable = new r.c, this._useCustomVRButton = !1, this._teleportationRequested = !1, this._teleportActive = !1, this._floorMeshesCollection = [], this._rotationAllowed = !0, this._teleportBackwardsVector = new o.x(0, -1, -1), this._isDefaultTeleportationTarget = !0, this._teleportationFillColor = "#444444", this._teleportationBorderColor = "#FFFFFF", this._rotationAngle = 0, this._haloCenter = new o.x(0, 0, 0), this._padSensibilityUp = .65, this._padSensibilityDown = .35, this._leftController = null, this._rightController = null, this.onNewMeshSelected = new r.c, this.onNewMeshPicked = new r.c, this.onBeforeCameraTeleport = new r.c, this.onAfterCameraTeleport = new r.c, this.onSelectedMeshUnselected = new r.c, this.teleportationEnabled = !0, this._teleportationInitialized = !1, this._interactionsEnabled = !1, this._interactionsRequested = !1, this._displayGaze = !0, this._displayLaserPointer = !0, this.updateGazeTrackerScale = !0, this.updateGazeTrackerColor = !0, this.requestPointerLockOnFullScreen = !0, 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 = !1 }, this._onNewGamepadConnected = function(e) { if (e.type !== Ke.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 === Ke.XBOX && (e.onbuttondown(function(e) { i._interactionsEnabled && e === Dt.A && i._cameraGazer._selectionPointerDown() }), e.onbuttonup(function(e) { i._interactionsEnabled && e === Dt.A && i._cameraGazer._selectionPointerUp() })); else { var t = e, n = new Bi(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 Ai && ("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 = o.x.Zero(), this._workingQuaternion = o.q.Identity(), this._workingMatrix = o.j.Identity(), this._scene = e, this._canvas = e.getEngine().getRenderingCanvas(), void 0 === t.createFallbackVRDeviceOrientationFreeCamera && (t.createFallbackVRDeviceOrientationFreeCamera = !0), void 0 === t.createDeviceOrientationCamera && (t.createDeviceOrientationCamera = !0), void 0 === t.laserToggle && (t.laserToggle = !0), void 0 === t.defaultHeight && (t.defaultHeight = 1.7), t.useCustomVRButton && (this._useCustomVRButton = !0, 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 = !1, this._scene.activeCamera ? this._position = this._scene.activeCamera.position.clone() : this._position = new o.x(0, this._defaultHeight, 0), t.createDeviceOrientationCamera || !this._scene.activeCamera) { if (this._deviceOrientationCamera = new At("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 yt && this._scene.activeCamera.rotation)) { var n = this._scene.activeCamera; n.rotationQuaternion ? this._deviceOrientationCamera.rotationQuaternion.copyFrom(n.rotationQuaternion) : this._deviceOrientationCamera.rotationQuaternion.copyFrom(o.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 = ci.GetDefault()), t.vrDeviceOrientationCameraMetrics.multiviewEnabled = !0), this._vrDeviceOrientationCamera = new yi("VRDeviceOrientationVRHelper", this._position, this._scene, !0, t.vrDeviceOrientationCameraMetrics), this._vrDeviceOrientationCamera.angularSensibility = Number.MAX_VALUE), this._webVRCamera = new Ei("WebVRHelper", this._position, this._scene, t), this._webVRCamera.useStandingMatrix(), this._cameraGazer = new Ui(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"; ".babylonVRicon.vrdisplaypresenting { display: none; }"; var s = document.createElement("style"); s.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(s), 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, !1), document.addEventListener("mozfullscreenchange", this._onFullscreenChange, !1), document.addEventListener("webkitfullscreenchange", this._onFullscreenChange, !1), document.addEventListener("msfullscreenchange", this._onFullscreenChange, !1), 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()) }, Pe.a.POINTERDOUBLETAP, !1), this._onVRDisplayChanged = function(e) { return i.onVRDisplayChanged(e) }, this._onVrDisplayPresentChange = function() { return i.onVrDisplayPresentChange() }, this._onVRRequestPresentStart = function() { i._webVRrequesting = !0, i.updateButtonVisibility() }, this._onVRRequestPresentComplete = function() { i._webVRrequesting = !1, 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 ee, this._circleEase.setEasingMode($.EASINGMODE_EASEINOUT), this.webVROptions.floorMeshes && this.enableTeleportation({ floorMeshes: this.webVROptions.floorMeshes }) } return Object.defineProperty(e.prototype, "onEnteringVR", { get: function() { return this.onEnteringVRObservable }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "onExitingVR", { get: function() { return this.onExitingVRObservable }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "onControllerMeshLoaded", { get: function() { return this.onControllerMeshLoadedObservable }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "teleportationTarget", { get: function() { return this._teleportationTarget }, set: function(e) { e && (e.name = "teleportationTarget", this._isDefaultTeleportationTarget = !1, this._teleportationTarget = e) }, enumerable: !0, configurable: !0 }), 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 = !1, this._cameraGazer._gazeTracker.isVisible = !1, 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "leftControllerGazeTrackerMesh", { get: function() { return this._leftController ? this._leftController._gazeTracker : null }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "rightControllerGazeTrackerMesh", { get: function() { return this._rightController ? this._rightController._gazeTracker : null }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "displayGaze", { get: function() { return this._displayGaze }, set: function(e) { this._displayGaze = e, e || (this._cameraGazer._gazeTracker.isVisible = !1, this._leftController && (this._leftController._gazeTracker.isVisible = !1), this._rightController && (this._rightController._gazeTracker.isVisible = !1)) }, enumerable: !0, configurable: !0 }), 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 = !1), this._leftController && (this._leftController._deactivatePointer(), this._leftController._gazeTracker.isVisible = !1)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "deviceOrientationCamera", { get: function() { return this._deviceOrientationCamera }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "currentVRCamera", { get: function() { return this._webVRready ? this._webVRCamera : this._scene.activeCamera }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "webVRCamera", { get: function() { return this._webVRCamera }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "vrDeviceOrientationCamera", { get: function() { return this._vrDeviceOrientationCamera }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "_teleportationRequestInitiated", { get: function() { return this._cameraGazer._teleportationRequestInitiated || null !== this._leftController && this._leftController._teleportationRequestInitiated || null !== this._rightController && this._rightController._teleportationRequestInitiated }, enumerable: !0, configurable: !0 }), 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) { p.a.Warn("Error in your custom logic onControllerMeshLoaded: " + e) } }, Object.defineProperty(e.prototype, "isInVRMode", { get: function() { return this._webVRpresenting || this._fullscreenVRpresenting }, enumerable: !0, configurable: !0 }), 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 p.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 = !0) }, 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) { p.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 = o.q.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles(), this.vrDeviceOrientationCamera.angularSensibility = 2e3), this.webVRCamera) { var t = this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y, i = o.q.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y - t, n = this.webVRCamera.rotationQuaternion.toEulerAngles().y; this.webVRCamera.rotationQuaternion = o.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._vrDeviceOrientationCamera.onViewMatrixChangedObservable.addOnce(function() { e.onAfterEnteringVRObservable.notifyObservers({ success: !0 }) })), 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 = !0) }, e.prototype.exitVR = function() { if (this._hasEnteredVR) { if (this.onExitingVRObservable) try { this.onExitingVRObservable.notifyObservers(this) } catch (e) { p.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 = !1, this._leftController && (this._leftController._gazeTracker.isVisible = !1), this._rightController && (this._rightController._gazeTracker.isVisible = !1)), this._scene.getEngine().resize(), [this._leftController, this._rightController].forEach(function(e) { e && e._deactivatePointer() }), this._hasEnteredVR = !1; 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: !0, configurable: !0 }), e.prototype.enableInteractions = function() { var e = this; this._interactionsEnabled || (this._interactionsRequested = !0, 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 !0 }, 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 = !0) }, Object.defineProperty(e.prototype, "_noControllerIsActive", { get: function() { return !(this._leftController && this._leftController._activePointer || this._rightController && this._rightController._activePointer) }, enumerable: !0, configurable: !0 }), e.prototype._isTeleportationFloor = function(e) { for (var t = 0; t < this._floorMeshesCollection.length; t++) if (this._floorMeshesCollection[t].id === e.id) return !0; 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 = !0, 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 xi.a; t.vignetteColor = new o.f(0, 0, 0, 0), t.vignetteEnabled = !0, this._postProcessMove = new Ci("postProcessMove", 1, this._webVRCamera, void 0, void 0, void 0, void 0, t), this._webVRCamera.detachPostProcess(this._postProcessMove), this._teleportationInitialized = !0, this._isDefaultTeleportationTarget && (this._createTeleportationCircles(), this._teleportationTarget.scaling.scaleInPlace(this._webVRCamera.deviceScaleFactor)) } }, e.prototype._enableInteractionOnController = function(e) { var t = this; e.webVRController.mesh && (e._interactionsEnabled = !0, 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 = !1) : e.y < -this._padSensibilityUp && t._dpadPressed && (t._activatePointer(), t._teleportationRequestInitiated = !0)) }, e.prototype._checkRotate = function(e, t) { t._teleportationRequestInitiated || (t._rotationLeftAsked ? e.x > -this._padSensibilityDown && (t._rotationLeftAsked = !1) : e.x < -this._padSensibilityUp && t._dpadPressed && (t._rotationLeftAsked = !0, this._rotationAllowed && this._rotateCamera(!1)), t._rotationRightAsked ? e.x < this._padSensibilityDown && (t._rotationRightAsked = !1) : e.x > this._padSensibilityUp && t._dpadPressed && (t._rotationRightAsked = !0, this._rotationAllowed && this._rotateCamera(!0))) }, 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 = o.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, o.q.RotationYawPitchRollToRef(this._workingVector.y, this._workingVector.x, this._workingVector.z, this._workingQuaternion), this._workingQuaternion.toRotationMatrix(this._workingMatrix), o.x.TransformCoordinatesToRef(this._teleportBackwardsVector, this._workingMatrix, this._workingVector); var r = new It.a(n, this._workingVector), s = this._scene.pickWithRay(r, this._raySelectionPredicate); s && s.pickedPoint && s.pickedMesh && this._isTeleportationFloor(s.pickedMesh) && s.distance < 5 && this.teleportCamera(s.pickedPoint), t._teleportationBackRequestInitiated = !0 } } else t._teleportationBackRequestInitiated = !1 }, e.prototype._enableTeleportationOnController = function(e) { var t = this; e.webVRController.mesh && (e._interactionsEnabled || this._enableInteractionOnController(e), e._interactionsEnabled = !0, e._teleportationEnabled = !0, e.webVRController.controllerType === St.VIVE && (e._dpadPressed = !1, e.webVRController.onPadStateChangedObservable.add(function(t) { e._dpadPressed = t.pressed, e._dpadPressed || (e._rotationLeftAsked = !1, e._rotationRightAsked = !1, e._teleportationBackRequestInitiated = !1) })), 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 = fe.a.CreateGround("teleportationTarget", 2, 2, 2, this._scene), this._teleportationTarget.isPickable = !1; var e = new Pi("DynamicTexture", 512, this._scene, !0); e.hasAlpha = !0; var t = e.getContext(); t.beginPath(), t.arc(256, 256, 200, 0, 2 * Math.PI, !1), t.fillStyle = this._teleportationFillColor, t.fill(), t.lineWidth = 10, t.strokeStyle = this._teleportationBorderColor, t.stroke(), t.closePath(), e.update(); var i = new Ri.a("TextPlaneMaterial", this._scene); i.diffuseTexture = e, this._teleportationTarget.material = i; var n = fe.a.CreateTorus("torusTeleportation", .75, .1, 25, this._scene, !1); n.isPickable = !1, n.parent = this._teleportationTarget; var r = new B("animationInnerCircle", "position.y", 30, B.ANIMATIONTYPE_FLOAT, B.ANIMATIONLOOPMODE_CYCLE), o = []; o.push({ frame: 0, value: 0 }), o.push({ frame: 30, value: .4 }), o.push({ frame: 60, value: 0 }), r.setKeys(o); var s = new ue; s.setEasingMode($.EASINGMODE_EASEINOUT), r.setEasingFunction(s), n.animations = [], n.animations.push(r), this._scene.beginAnimation(n, 0, 60, !0), this._hideTeleportationTarget() }, e.prototype._displayTeleportationTarget = function() { this._teleportActive = !0, this._teleportationInitialized && (this._teleportationTarget.isVisible = !0, this._isDefaultTeleportationTarget && (this._teleportationTarget.getChildren()[0].isVisible = !0)) }, e.prototype._hideTeleportationTarget = function() { this._teleportActive = !1, this._teleportationInitialized && (this._teleportationTarget.isVisible = !1, this._isDefaultTeleportationTarget && (this._teleportationTarget.getChildren()[0].isVisible = !1)) }, e.prototype._rotateCamera = function(e) { var t = this; if (this.currentVRCamera instanceof bt) { e ? this._rotationAngle++ : this._rotationAngle--, this.currentVRCamera.animations = []; var i = o.q.FromRotationMatrix(o.j.RotationY(Math.PI / 4 * this._rotationAngle)), n = new B("animationRotation", "rotationQuaternion", 90, B.ANIMATIONTYPE_QUATERNION, B.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 s = new B("animationPP", "vignetteWeight", 90, B.ANIMATIONTYPE_FLOAT, B.ANIMATIONLOOPMODE_CONSTANT), a = []; a.push({ frame: 0, value: 0 }), a.push({ frame: 3, value: 4 }), a.push({ frame: 6, value: 0 }), s.setKeys(a), s.setEasingFunction(this._circleEase), this._postProcessMove.animations.push(s); var c = new B("animationPP2", "vignetteStretch", 90, B.ANIMATIONTYPE_FLOAT, B.ANIMATIONLOOPMODE_CONSTANT), l = []; l.push({ frame: 0, value: 0 }), l.push({ frame: 3, value: 10 }), l.push({ frame: 6, value: 0 }), c.setKeys(l), 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, !1, 1, function() { t._webVRCamera.detachPostProcess(t._postProcessMove) }), this._scene.beginAnimation(this.currentVRCamera, 0, 6, !1, 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(!0, !1), i); if (n) { var r = o.x.Cross(o.c.Y, n), s = o.x.Cross(n, r); o.x.RotationFromAxisToRef(s, n, r, this._teleportationTarget.rotation) } this._teleportationTarget.position.y += .1 } }, e.prototype.teleportCamera = function(e) { var t = this; if (this.currentVRCamera instanceof bt) { 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 B("animationCameraTeleportation", "position", 90, B.ANIMATIONTYPE_VECTOR3, B.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 B("animationPP", "vignetteWeight", 90, B.ANIMATIONTYPE_FLOAT, B.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 s = new B("animationPP2", "vignetteStretch", 90, B.ANIMATIONTYPE_FLOAT, B.ANIMATIONLOOPMODE_CONSTANT), a = []; a.push({ frame: 0, value: 0 }), a.push({ frame: 5, value: 10 }), a.push({ frame: 11, value: 0 }), s.setKeys(a), this._postProcessMove.animations.push(s), this._postProcessMove.imageProcessingConfiguration.vignetteWeight = 0, this._postProcessMove.imageProcessingConfiguration.vignetteStretch = 0, this._webVRCamera.attachPostProcess(this._postProcessMove), this._scene.beginAnimation(this._postProcessMove, 0, 11, !1, 1, function() { t._webVRCamera.detachPostProcess(t._postProcessMove) }), this._scene.beginAnimation(this.currentVRCamera, 0, 11, !1, 1, function() { t.onAfterCameraTeleport.notifyObservers(t._workingVector) }), this._hideTeleportationTarget() } }, e.prototype._convertNormalToDirectionOfRay = function(e, t) { e && (Math.acos(o.x.Dot(e, t.direction)) < Math.PI / 2 && e.scaleInPlace(-1)); return e }, e.prototype._castRayAndSelectObject = function(e) { if (this.currentVRCamera instanceof bt) { 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 })), e._currentHit = i, i && i.pickedPoint) { if (this._displayGaze) { var n = 1; e._gazeTracker.isVisible = !0, 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 s = o.x.Cross(o.c.Y, r), a = o.x.Cross(r, s); o.x.RotationFromAxisToRef(a, r, s, 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) } else e._updatePointerDistance(), e._gazeTracker.isVisible = !1; 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 o.e(0, 0, 1)), this.changeLaserColor(new o.e(.2, .2, 1)), e._isActionableMesh = !0) : (this.changeGazeColor(new o.e(.7, .7, .7)), this.changeLaserColor(new o.e(.7, .7, .7)), e._isActionableMesh = !1); try { this.onNewMeshSelected.notifyObservers(i.pickedMesh) } catch (e) { p.a.Warn("Error in your custom logic onNewMeshSelected: " + e) } } else this._notifySelectedMeshUnselected(e._currentMeshSelected), e._currentMeshSelected = null, this.changeGazeColor(new o.e(.7, .7, .7)), this.changeLaserColor(new o.e(.7, .7, .7)) } else this._notifySelectedMeshUnselected(e._currentMeshSelected), e._currentMeshSelected = null, this.changeGazeColor(new o.e(.7, .7, .7)), this.changeLaserColor(new o.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._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._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), 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" }, e }(), ki = function(e) { function t(t, i) { var n = e.call(this, t, o.x.Zero(), i) || this; return n.minZ = 0, n.rotationQuaternion = new o.q, n.cameraRigMode = Ne.a.RIG_MODE_CUSTOM, n.updateUpVectorFromRotation = !0, n._updateNumberOfRigCameras(1), n } return l.d(t, e), t.prototype._updateNumberOfRigCameras = function(e) { for (void 0 === e && (e = 1); this.rigCameras.length < e;) { var t = new yt("view: " + this.rigCameras.length, o.x.Zero(), this.getScene()); t.minZ = 0, t.parent = this, t.rotationQuaternion = new o.q, t.updateUpVectorFromRotation = !0, 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), this._updateNumberOfRigCameras(2), this.rigCameras[0].viewport = new o.z(0, 0, .5, 1), this.rigCameras[0].position.x = -e / 2, this.rigCameras[0].outputRenderTarget = null, this.rigCameras[1].viewport = new o.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 !1; var n = e._currentXRFrame.getDevicePose(e._frameOfReference); return !(!n || !n.poseModelMatrix) && (o.j.FromFloat32ArrayToRefScaled(n.poseModelMatrix, 0, 1, t._TmpMatrix), this._scene.useRightHandedSystem || t._TmpMatrix.toggleModelMatrixHandInPlace(), t._TmpMatrix.getTranslationToRef(this.position), t._TmpMatrix.getRotationMatrixToRef(t._TmpMatrix), o.q.FromRotationMatrixToRef(t._TmpMatrix, this.rotationQuaternion), this.computeWorldMatrix(), this._updateNumberOfRigCameras(e._currentXRFrame.views.length), e._currentXRFrame.views.forEach(function(t, r) { o.j.FromFloat32ArrayToRefScaled(n.getViewMatrix(t), 0, 1, i.rigCameras[r]._computedViewMatrix), o.j.FromFloat32ArrayToRefScaled(t.projectionMatrix, 0, 1, i.rigCameras[r]._projectionMatrix), i._scene.useRightHandedSystem || (i.rigCameras[r]._computedViewMatrix.toggleModelMatrixHandInPlace(), i.rigCameras[r]._projectionMatrix.toggleProjectionMatrixHandInPlace()); var s = e._xrSession.baseLayer.getViewport(t), a = e._xrSession.baseLayer.framebufferWidth, c = e._xrSession.baseLayer.framebufferHeight; i.rigCameras[r].viewport.width = s.width / a, i.rigCameras[r].viewport.height = s.height / c, i.rigCameras[r].viewport.x = s.x / a, i.rigCameras[r].viewport.y = s.y / c, i.rigCameras[r].outputRenderTarget = e._sessionRenderTargetTexture }), !0) }, t._TmpMatrix = new o.j, t }(bt), zi = function() { function e(e) { this.scene = e, this.onXRFrameObservable = new r.c, this.onXRSessionEnded = new r.c, this._sessionRenderTargetTexture = null, this._tmpMatrix = new o.j } return e.prototype.initializeAsync = function() { var e = this; return p.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) }) : Promise.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: !0 }), 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, 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 Promise(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) { o.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) }) }) }, e.prototype.supportsSessionAsync = function(e) { return this._xrDevice.supportsSession(e).then(function() { return !0 }).catch(function() { return !1 }) }, e._CreateRenderTargetTextureFromSession = function(e, t) { var i = new ze.a(t.getEngine(), ze.a.DATASOURCE_UNKNOWN, !0); i.width = e.baseLayer.framebufferWidth, i.height = e.baseLayer.framebufferHeight, i._framebuffer = e.baseLayer.framebuffer; var n = new _i("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, !0); 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" }(Li || (Li = {})); var ji, Hi = function() { function e(e) { this.scene = e, this.state = Li.NOT_IN_XR, this.onStateChangedObservable = new r.c, this._nonVRCamera = null, this._originalSceneAutoClear = !0, this._supported = !1, this.camera = new ki("", e), this._sessionManager = new zi(e), this.container = new Fe.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 = !0, i }).catch(function() { return i }) }, e.prototype.exitXRAsync = function() { return this._setState(Li.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(Li.ENTERING_XR), this._sessionManager.enterXRAsync(e, t).then(function() { i._originalSceneAutoClear = i.scene.autoClear, i._nonVRCamera = i.scene.activeCamera, i.scene.autoClear = !1, 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(Li.NOT_IN_XR) }), i._setState(Li.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 = o.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) : Promise.resolve(!1) }, e.prototype.dispose = function() { this.camera.dispose(), this.container.dispose(), this.onStateChangedObservable.clear(), this._sessionManager.dispose() }, e._TmpVector = new o.x, e }(), Wi = function() { function e(e, t) { this.element = e, this.initializationOptions = t } return e.prototype.update = function(e) {}, e }(), Xi = function() { return function() {} }(), Yi = function() { function e(e, t) { var i = this; if (this.scene = e, this._buttons = [], this._activeButton = null, this.activeButtonChangedObservable = new r.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 Wi(n, { immersive: !0, 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 o = document.createElement("button"); o.style.cssText = n.style.cssText, o.innerText = "Window", this._buttons.push(new Wi(o, { immersive: !1, environmentIntegration: !0, 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 s = e.getEngine().getRenderingCanvas(); s && s.parentNode && (s.parentNode.appendChild(this._overlay), e.onDisposeObservable.addOnce(function() { i.dispose() })) } return e.CreateAsync = function(t, i, n) { var r = this, o = new e(t, n), s = o._buttons.map(function(e) { return i.supportsSessionAsync(e.initializationOptions) }); return i.onStateChangedObservable.add(function(e) { e == Li.NOT_IN_XR && o._updateButtons(null) }), Promise.all(s).then(function(e) { return e.forEach(function(e, t) { e && (o._overlay.appendChild(o._buttons[t].element), o._buttons[t].element.onclick = function() { return l.b(r, void 0, void 0, function() { return l.e(this, function(e) { switch (e.label) { case 0: return i.state != Li.IN_XR ? [3, 2] : (o._updateButtons(null), [4, i.exitXRAsync()]); case 1: return e.sent(), [2]; case 2: return i.state != Li.NOT_IN_XR ? [3, 4] : (o._updateButtons(o._buttons[t]), [4, i.enterXRAsync(o._buttons[t].initializationOptions, "eye-level")]); case 3: e.sent(), e.label = 4; case 4: return [2] } }) }) }) }), o }) }, 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() }, e }(), Ki = function() { function e(e) { this.pointer = new Fe.a("controllerPointer", e) } return e.prototype.dispose = function() { this.grip && this.grip.dispose(), this.pointer.dispose() }, e }(), Qi = function() { function e(e) { var t = this; this.helper = e, this.controllers = [], this._tmpMatrix = new o.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 s = i.getInputPose(n, e._sessionManager._frameOfReference); if (s) { t.controllers.length <= r && t.controllers.push(new Ki(e.container.getScene())); var a = t.controllers[r]; s.gripMatrix && (a.grip || (a.grip = new Fe.a("controllerGrip", e.container.getScene())), o.j.FromFloat32ArrayToRefScaled(s.gripMatrix, 0, 1, t._tmpMatrix), a.grip.getScene().useRightHandedSystem || t._tmpMatrix.toggleModelMatrixHandInPlace(), a.grip.rotationQuaternion || (a.grip.rotationQuaternion = new o.q), t._tmpMatrix.decompose(a.grip.scaling, a.grip.rotationQuaternion, a.grip.position)), o.j.FromFloat32ArrayToRefScaled(s.targetRay.transformMatrix, 0, 1, t._tmpMatrix), a.pointer.getScene().useRightHandedSystem || t._tmpMatrix.toggleModelMatrixHandInPlace(), a.pointer.rotationQuaternion || (a.pointer.rotationQuaternion = new o.q), t._tmpMatrix.decompose(a.pointer.scaling, a.pointer.rotationQuaternion, a.pointer.position) } }) } }) } return e.prototype.dispose = function() { this.controllers.forEach(function(e) { e.dispose() }), this.helper._sessionManager.onXRFrameObservable.remove(this._frameObserver) }, e }(), qi = 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 == Li.ENTERING_XR ? i._addCanvas() : e.state == Li.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 }(), Zi = (ji = { root: 0, found: !1 }, function(e, t, i, n) { ji.root = 0, ji.found = !1; var r = t * t - 4 * e * i; if (r < 0) return ji; var o = Math.sqrt(r), s = (-t - o) / (2 * e), a = (-t + o) / (2 * e); if (s > a) { var c = a; a = s, s = c } return s > 0 && s < n ? (ji.root = s, ji.found = !0, ji) : a > 0 && a < n ? (ji.root = a, ji.found = !0, ji) : ji }), Ji = function() { function e() { this._collisionPoint = o.x.Zero(), this._planeIntersectionPoint = o.x.Zero(), this._tempVector = o.x.Zero(), this._tempVector2 = o.x.Zero(), this._tempVector3 = o.x.Zero(), this._tempVector4 = o.x.Zero(), this._edge = o.x.Zero(), this._baseToVertex = o.x.Zero(), this._destinationPoint = o.x.Zero(), this._slidePlaneNormal = o.x.Zero(), this._displacementVector = o.x.Zero(), this._radius = o.x.One(), this._retry = 0, this._basePointWorld = o.x.Zero(), this._velocityWorld = o.x.Zero(), this._normalizedVelocity = o.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "slidePlaneNormal", { get: function() { return this._slidePlaneNormal }, enumerable: !0, configurable: !0 }), e.prototype._initialize = function(e, t, i) { this._velocity = t, o.x.NormalizeToRef(t, this._normalizedVelocity), 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 = !1 }, e.prototype._checkPointInTriangle = function(e, t, i, n, r) { t.subtractToRef(e, this._tempVector), i.subtractToRef(e, this._tempVector2), o.x.CrossToRef(this._tempVector, this._tempVector2, this._tempVector4); var s = o.x.Dot(this._tempVector4, r); return !(s < 0) && (n.subtractToRef(e, this._tempVector3), o.x.CrossToRef(this._tempVector2, this._tempVector3, this._tempVector4), !((s = o.x.Dot(this._tempVector4, r)) < 0) && (o.x.CrossToRef(this._tempVector3, this._tempVector, this._tempVector4), (s = o.x.Dot(this._tempVector4, r)) >= 0)) }, e.prototype._canDoCollision = function(e, t, i, n) { var r = o.x.Distance(this._basePointWorld, e), s = Math.max(this._radius.x, this._radius.y, this._radius.z); return !(r > this._velocityWorldLength + s + 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 + s) }, e.prototype._testTriangle = function(e, t, i, n, r, s) { var a, c = !1; t || (t = []), t[e] || (t[e] = new o.n(0, 0, 0, 0), t[e].copyFromPoints(i, n, r)); var l = t[e]; if (s || l.isFrontFacingTo(this._normalizedVelocity, 0)) { var u = l.signedDistanceTo(this._basePoint), h = o.x.Dot(l.normal, this._velocity); if (0 == h) { if (Math.abs(u) >= 1) return; c = !0, a = 0 } else { var d = (1 - u) / h; if ((a = (-1 - u) / h) > d) { var f = d; d = a, a = f } if (a > 1 || d < 0) return; a < 0 && (a = 0), a > 1 && (a = 1) } this._collisionPoint.copyFromFloats(0, 0, 0); var p = !1, _ = 1; if (c || (this._basePoint.subtractToRef(l.normal, this._planeIntersectionPoint), this._velocity.scaleToRef(a, this._tempVector), this._planeIntersectionPoint.addInPlace(this._tempVector), this._checkPointInTriangle(this._planeIntersectionPoint, i, n, r, l.normal) && (p = !0, _ = a, this._collisionPoint.copyFrom(this._planeIntersectionPoint))), !p) { var g = this._velocity.lengthSquared(), m = g; this._basePoint.subtractToRef(i, this._tempVector); var v = 2 * o.x.Dot(this._velocity, this._tempVector), y = this._tempVector.lengthSquared() - 1, b = Zi(m, v, y, _); b.found && (_ = b.root, p = !0, this._collisionPoint.copyFrom(i)), this._basePoint.subtractToRef(n, this._tempVector), v = 2 * o.x.Dot(this._velocity, this._tempVector), y = this._tempVector.lengthSquared() - 1, (b = Zi(m, v, y, _)).found && (_ = b.root, p = !0, this._collisionPoint.copyFrom(n)), this._basePoint.subtractToRef(r, this._tempVector), v = 2 * o.x.Dot(this._velocity, this._tempVector), y = this._tempVector.lengthSquared() - 1, (b = Zi(m, v, y, _)).found && (_ = b.root, p = !0, this._collisionPoint.copyFrom(r)), n.subtractToRef(i, this._edge), i.subtractToRef(this._basePoint, this._baseToVertex); var T = this._edge.lengthSquared(), E = o.x.Dot(this._edge, this._velocity), A = o.x.Dot(this._edge, this._baseToVertex); if (m = T * -g + E * E, v = T * (2 * o.x.Dot(this._velocity, this._baseToVertex)) - 2 * E * A, y = T * (1 - this._baseToVertex.lengthSquared()) + A * A, (b = Zi(m, v, y, _)).found) { var x = (E * b.root - A) / T; x >= 0 && x <= 1 && (_ = b.root, p = !0, this._edge.scaleInPlace(x), i.addToRef(this._edge, this._collisionPoint)) } r.subtractToRef(n, this._edge), n.subtractToRef(this._basePoint, this._baseToVertex), T = this._edge.lengthSquared(), E = o.x.Dot(this._edge, this._velocity), A = o.x.Dot(this._edge, this._baseToVertex), m = T * -g + E * E, v = T * (2 * o.x.Dot(this._velocity, this._baseToVertex)) - 2 * E * A, y = T * (1 - this._baseToVertex.lengthSquared()) + A * A, (b = Zi(m, v, y, _)).found && (x = (E * b.root - A) / T) >= 0 && x <= 1 && (_ = b.root, p = !0, this._edge.scaleInPlace(x), n.addToRef(this._edge, this._collisionPoint)), i.subtractToRef(r, this._edge), r.subtractToRef(this._basePoint, this._baseToVertex), T = this._edge.lengthSquared(), E = o.x.Dot(this._edge, this._velocity), A = o.x.Dot(this._edge, this._baseToVertex), m = T * -g + E * E, v = T * (2 * o.x.Dot(this._velocity, this._baseToVertex)) - 2 * E * A, y = T * (1 - this._baseToVertex.lengthSquared()) + A * A, (b = Zi(m, v, y, _)).found && (x = (E * b.root - A) / T) >= 0 && x <= 1 && (_ = b.root, p = !0, this._edge.scaleInPlace(x), r.addToRef(this._edge, this._collisionPoint)) } if (p) { var R = _ * this._velocity.length(); (!this.collisionFound || R < this._nearestDistance) && (this.intersectionPoint ? this.intersectionPoint.copyFrom(this._collisionPoint) : this.intersectionPoint = this._collisionPoint.clone(), this._nearestDistance = R, this.collisionFound = !0) } } }, e.prototype._collide = function(e, t, i, n, r, o, s) { for (var a = n; a < r; a += 3) { var c = t[i[a] - o], l = t[i[a + 1] - o], u = t[i[a + 2] - o]; this._testTriangle(a, e, u, l, c, s) } }, 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), this._slidePlaneNormal.normalize(), this._slidePlaneNormal.scaleToRef(this._epsilon, this._displacementVector), e.addInPlace(this._displacementVector), this.intersectionPoint.addInPlace(this._displacementVector), this._slidePlaneNormal.scaleInPlace(o.n.SignedDistanceToPlaneFromPositionAndNormal(this.intersectionPoint, this._slidePlaneNormal, this._destinationPoint)), this._destinationPoint.subtractInPlace(this._slidePlaneNormal), this._destinationPoint.subtractToRef(this.intersectionPoint, t) }, e }(), $i = function() { function e() { this._scaledPosition = o.x.Zero(), this._scaledVelocity = o.x.Zero(), this._finalPosition = o.x.Zero() } return e.prototype.getNewPosition = function(e, t, i, n, r, o, s) { 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), this._finalPosition.multiplyInPlace(i._radius), o(s, this._finalPosition, i.collidedMesh) }, e.prototype.createCollider = function() { return new Ji }, e.prototype.init = function(e) { this._scene = e }, e.prototype._collideWithWorld = function(e, t, i, n, r, o) { void 0 === o && (o = null); var s = 10 * ge.b.CollisionsEpsilon; if (i._retry >= n) r.copyFrom(e); else { var a = o ? o.collisionMask : i.collisionMask; i._initialize(e, t, s); for (var c = 0; c < this._scene.meshes.length; c++) { var l = this._scene.meshes[c]; l.isEnabled() && l.checkCollisions && l.subMeshes && l !== o && 0 != (a & l.collisionGroup) && l._checkCollision(i) } i.collisionFound ? (0 === t.x && 0 === t.y && 0 === t.z || i._getResponse(e, t), t.length() <= s ? r.copyFrom(e) : (i._retry++, this._collideWithWorld(e, t, i, n, r, o))) : e.addToRef(t, r) } }, e }(); W.a.CollisionCoordinatorFactory = function() { return new $i }; var en = i(50), tn = i(81), nn = i(108), rn = i(77), on = i(43), sn = i(82), an = 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "minPoint", { get: function() { return this._minPoint }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "maxPoint", { get: function() { return this._maxPoint }, enumerable: !0, configurable: !0 }), 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 (rn.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) } }, e.prototype.intersects = function(e, t, i, n) { if (rn.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, s, a, c, l) { c.blocks = new Array; for (var u = new o.x((i.x - t.x) / 2, (i.y - t.y) / 2, (i.z - t.z) / 2), h = 0; h < 2; h++) for (var d = 0; d < 2; d++) for (var f = 0; f < 2; f++) { var p = new e(t.add(u.multiplyByFloats(h, d, f)), t.add(u.multiplyByFloats(h + 1, d + 1, f + 1)), r, s + 1, a, l); p.addEntries(n), c.blocks.push(p) } }, e }(), cn = 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 kt.b(1024), this._creationFunc = e } return e.prototype.update = function(e, t, i) { an._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), 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), 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 }(); W.a.prototype.createOrUpdateSelectionOctree = function(e, t) { void 0 === e && (e = 64), void 0 === t && (t = 2); var i = this._getComponent(Ae.a.NAME_OCTREE); i || (i = new ln(this), this._addComponent(i)), this._selectionOctree || (this._selectionOctree = new cn(cn.CreationFuncForMeshes, e, t)); var n = this.getWorldExtends(); return this._selectionOctree.update(n.min, n.max, this.meshes), this._selectionOctree }, Object.defineProperty(W.a.prototype, "selectionOctree", { get: function() { return this._selectionOctree }, enumerable: !0, configurable: !0 }), Fe.a.prototype.createOrUpdateSubmeshesOctree = function(e, t) { void 0 === e && (e = 64), void 0 === t && (t = 2); var i = this.getScene(), n = i._getComponent(Ae.a.NAME_OCTREE); n || (n = new ln(i), i._addComponent(n)), this._submeshesOctree || (this._submeshesOctree = new cn(cn.CreationFuncForSubMeshes, e, t)), this.computeWorldMatrix(!0); var r = this.getBoundingInfo().boundingBox; return this._submeshesOctree.update(r.minimumWorld, r.maximumWorld, this.subMeshes), this._submeshesOctree }; var ln = function() { function e(e) { this.name = Ae.a.NAME_OCTREE, this.checksIsEnabled = !0, this._tempRay = new It.a(o.x.Zero(), new o.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 ? (It.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 }(), un = i(74), hn = i(128), dn = function() { return function() { this._timeElapsedQueryEnded = !1 } }(), fn = function() { return function() { this.occlusionInternalRetryCounter = 0, this.isOcclusionQueryInProgress = !1, this.isOccluded = !1, this.occlusionRetryCount = -1, this.occlusionType = Fe.a.OCCLUSION_TYPE_NONE, this.occlusionQueryAlgorithmType = Fe.a.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE } }(); ge.b.prototype.createQuery = function() { return this._gl.createQuery() }, ge.b.prototype.deleteQuery = function(e) { return this._gl.deleteQuery(e), this }, ge.b.prototype.isQueryResultAvailable = function(e) { return this._gl.getQueryParameter(e, this._gl.QUERY_RESULT_AVAILABLE) }, ge.b.prototype.getQueryResult = function(e) { return this._gl.getQueryParameter(e, this._gl.QUERY_RESULT) }, ge.b.prototype.beginOcclusionQuery = function(e, t) { var i = this._getGlAlgorithmType(e); return this._gl.beginQuery(i, t), this }, ge.b.prototype.endOcclusionQuery = function(e) { var t = this._getGlAlgorithmType(e); return this._gl.endQuery(t), this }, ge.b.prototype._createTimeQuery = function() { var e = this.getCaps().timerQuery; return e.createQueryEXT ? e.createQueryEXT() : this.createQuery() }, ge.b.prototype._deleteTimeQuery = function(e) { var t = this.getCaps().timerQuery; t.deleteQueryEXT ? t.deleteQueryEXT(e) : this.deleteQuery(e) }, ge.b.prototype._getTimeQueryResult = function(e) { var t = this.getCaps().timerQuery; return t.getQueryObjectEXT ? t.getQueryObjectEXT(e, t.QUERY_RESULT_EXT) : this.getQueryResult(e) }, ge.b.prototype._getTimeQueryAvailability = function(e) { var t = this.getCaps().timerQuery; return t.getQueryObjectEXT ? t.getQueryObjectEXT(e, t.QUERY_RESULT_AVAILABLE_EXT) : this.isQueryResultAvailable(e) }, ge.b.prototype.startTimeQuery = function() { var e = this.getCaps(), t = e.timerQuery; if (!t) return null; var i = new dn; 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 }, ge.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 = !0 } var n = this._gl.getParameter(i.GPU_DISJOINT_EXT), r = !1; 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 s = this._getTimeQueryResult(e._startTimeQuery); o = this._getTimeQueryResult(e._endTimeQuery) - s, 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 = !1, this._currentNonTimestampToken = null } return o } return -1 }, ge.b.prototype._getGlAlgorithmType = function(e) { return e === Fe.a.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE ? this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE : this._gl.ANY_SAMPLES_PASSED }, Object.defineProperty(Fe.a.prototype, "isOcclusionQueryInProgress", { get: function() { return this._occlusionDataStorage.isOcclusionQueryInProgress }, enumerable: !1, configurable: !0 }), Object.defineProperty(Fe.a.prototype, "_occlusionDataStorage", { get: function() { return this.__occlusionDataStorage || (this.__occlusionDataStorage = new fn), this.__occlusionDataStorage }, enumerable: !1, configurable: !0 }), Object.defineProperty(Fe.a.prototype, "isOccluded", { get: function() { return this._occlusionDataStorage.isOccluded }, set: function(e) { this._occlusionDataStorage.isOccluded = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(Fe.a.prototype, "occlusionQueryAlgorithmType", { get: function() { return this._occlusionDataStorage.occlusionQueryAlgorithmType }, set: function(e) { this._occlusionDataStorage.occlusionQueryAlgorithmType = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(Fe.a.prototype, "occlusionType", { get: function() { return this._occlusionDataStorage.occlusionType }, set: function(e) { this._occlusionDataStorage.occlusionType = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(Fe.a.prototype, "occlusionRetryCount", { get: function() { return this._occlusionDataStorage.occlusionRetryCount }, set: function(e) { this._occlusionDataStorage.occlusionRetryCount = e }, enumerable: !0, configurable: !0 }), Fe.a.prototype._checkOcclusionQuery = function() { var e = this._occlusionDataStorage; if (e.occlusionType === Fe.a.OCCLUSION_TYPE_NONE) return e.isOccluded = !1, !1; var t = this.getEngine(); if (t.webGLVersion < 2) return e.isOccluded = !1, !1; if (!t.isQueryResultAvailable) return e.isOccluded = !1, !1; if (this.isOcclusionQueryInProgress && this._occlusionQuery) if (t.isQueryResultAvailable(this._occlusionQuery)) { var i = t.getQueryResult(this._occlusionQuery); e.isOcclusionQueryInProgress = !1, e.occlusionInternalRetryCounter = 0, e.isOccluded = 1 !== i } else { if (e.occlusionInternalRetryCounter++, !(-1 !== e.occlusionRetryCount && e.occlusionInternalRetryCounter > e.occlusionRetryCount)) return !1; e.isOcclusionQueryInProgress = !1, e.occlusionInternalRetryCounter = 0, e.isOccluded = e.occlusionType !== Fe.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 = !0 } return e.isOccluded }; ge.b.prototype.createTransformFeedback = function() { return this._gl.createTransformFeedback() }, ge.b.prototype.deleteTransformFeedback = function(e) { this._gl.deleteTransformFeedback(e) }, ge.b.prototype.bindTransformFeedback = function(e) { this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK, e) }, ge.b.prototype.beginTransformFeedback = function(e) { void 0 === e && (e = !0), this._gl.beginTransformFeedback(e ? this._gl.POINTS : this._gl.TRIANGLES) }, ge.b.prototype.endTransformFeedback = function() { this._gl.endTransformFeedback() }, ge.b.prototype.setTranformFeedbackVaryings = function(e, t) { this._gl.transformFeedbackVaryings(e, t, this._gl.INTERLEAVED_ATTRIBS) }, ge.b.prototype.bindTransformFeedbackBuffer = function(e) { this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER, 0, e ? e.underlyingResource : null) }; var pn = i(107), _n = function() { function e() {} return e.COPY = 1, e.CUT = 2, e.PASTE = 3, e }(), gn = function() { function e(e, t) { this.type = e, this.event = t } return e.GetTypeFromCharacter = function(e) { switch (e) { case 67: return _n.COPY; case 86: return _n.PASTE; case 88: return _n.CUT; default: return -1 } }, e }(), mn = i(59), vn = i(55), yn = 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 }(), bn = function() { function e() {} return Object.defineProperty(e, "ForceFullSceneLoadingForIncremental", { get: function() { return vn.a.ForceFullSceneLoadingForIncremental }, set: function(e) { vn.a.ForceFullSceneLoadingForIncremental = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "ShowLoadingScreen", { get: function() { return vn.a.ShowLoadingScreen }, set: function(e) { vn.a.ShowLoadingScreen = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "loggingLevel", { get: function() { return vn.a.loggingLevel }, set: function(e) { vn.a.loggingLevel = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "CleanBoneMatrixWeights", { get: function() { return vn.a.CleanBoneMatrixWeights }, set: function(e) { vn.a.CleanBoneMatrixWeights = e }, enumerable: !0, configurable: !0 }), e._getDefaultPlugin = function() { return e._registeredPlugins[".babylon"] }, e._getPluginForExtension = function(t) { var i = e._registeredPlugins[t]; return i || (p.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, s, a) { var c, l = e._getDirectLoad(t.name), u = a ? e._getPluginForExtension(a) : l ? e._getPluginForDirectLoad(t.name) : e._getPluginForFilename(t.name); if (!(c = u.plugin.createPlugin ? u.plugin.createPlugin() : u.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, d = u.isBinary; e.OnPluginActivatedObservable.notifyObservers(c); var f = function(e, t) { i.isDisposed ? o("Scene has been disposed") : (i.offlineProvider = h, n(c, e, t)) }, p = null, _ = !1, g = c.onDisposeObservable; g && g.add(function() { _ = !0, p && (p.abort(), p = null), s() }); var m = function() { _ || (p = ye.h.LoadFile(t.url, f, r ? function(e) { r(yn.FromProgressEvent(e)) } : void 0, h, d, function(e, t) { o("Failed to load scene." + (t ? " " + t.message : ""), t) })) }; if (l) return f(l), c; var v = t.file || mn.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 T = !1, E = 0, A = i.disableOfflineSupportExceptionRules; E < A.length; E++) { if (A[E].test(t.url)) { T = !0; break } } b = !T } b && ge.b.OfflineProviderFactory ? h = ge.b.OfflineProviderFactory(t.url, m, y.disableManifestCheck) : m() } else v ? p = ye.h.ReadFile(v, f, r, d) : 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 s = t; if ("/" === s.substr(0, 1)) return ye.h.Error("Wrong sceneFilename parameter"), null; i = e + s, n = s } else i = e, n = ye.h.GetFilename(e), e = ye.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: !1 } } 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, s, a, c) { if (void 0 === n && (n = ""), void 0 === r && (r = P.a.LastCreatedScene), void 0 === o && (o = null), void 0 === s && (s = null), void 0 === a && (a = null), void 0 === c && (c = null), !r) return p.a.Error("No scene available to import mesh to"), null; var l = e._getFileInfo(i, n); if (!l) return null; var u = {}; r._addPendingData(u); var h = function() { r._removePendingData(u) }, d = function(e, t) { var i = "Unable to import meshes from " + l.url + ": " + e; a ? a(r, i, t) : p.a.Error(i), h() }, f = s ? function(e) { try { s(e) } catch (e) { d("Error in onProgress callback", e) } } : void 0, _ = function(e, t, i, n) { if (r.importedMeshesFiles.push(l.url), o) try { o(e, t, i, n) } catch (e) { d("Error in onSuccess callback", e) } r._removePendingData(u) }; return e._loadData(l, r, function(e, i, n) { if (e.rewriteRootURL && (l.rootUrl = e.rewriteRootURL(l.rootUrl, n)), e.importMesh) { var o = e, s = new Array, a = new Array, c = new Array; if (!o.importMesh(t, r, i, l.rootUrl, s, a, c, d)) return; r.loadingPluginName = e.name, _(s, a, c, []) } else { e.importMeshAsync(t, r, i, l.rootUrl, f, l.name).then(function(t) { r.loadingPluginName = e.name, _(t.meshes, t.particleSystems, t.skeletons, t.animationGroups) }).catch(function(e) { d(e.message, e) }) } }, f, d, h, c) }, e.ImportMeshAsync = function(t, i, n, r, o, s) { return void 0 === n && (n = ""), void 0 === r && (r = P.a.LastCreatedScene), void 0 === o && (o = null), void 0 === s && (s = null), new Promise(function(a, c) { e.ImportMesh(t, i, n, r, function(e, t, i, n) { a({ meshes: e, particleSystems: t, skeletons: i, animationGroups: n }) }, o, function(e, t, i) { c(i || new Error(t)) }, s) }) }, e.Load = function(t, i, n, r, o, s, a) { return void 0 === i && (i = ""), void 0 === n && (n = P.a.LastCreatedEngine), void 0 === r && (r = null), void 0 === o && (o = null), void 0 === s && (s = null), void 0 === a && (a = null), n ? e.Append(t, i, new W.a(n), r, o, s, a) : (ye.h.Error("No engine available"), null) }, e.LoadAsync = function(t, i, n, r, o) { return void 0 === i && (i = ""), void 0 === n && (n = P.a.LastCreatedEngine), void 0 === r && (r = null), void 0 === o && (o = null), new Promise(function(s, a) { e.Load(t, i, n, function(e) { s(e) }, r, function(e, t, i) { a(i || new Error(t)) }, o) }) }, e.Append = function(t, i, n, r, o, s, a) { if (void 0 === i && (i = ""), void 0 === n && (n = P.a.LastCreatedScene), void 0 === r && (r = null), void 0 === o && (o = null), void 0 === s && (s = null), void 0 === a && (a = null), !n) return p.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 l = {}; n._addPendingData(l); var u = function() { n._removePendingData(l), n.getEngine().hideLoadingUI() }, h = function(e, t) { var i = "Unable to load from " + c.url + (e ? ": " + e : ""); s ? s(n, i, t) : p.a.Error(i), u() }, d = o ? function(e) { try { o(e) } catch (e) { h("Error in onProgress callback", e) } } : void 0, f = function() { if (r) try { r(n) } catch (e) { h("Error in onSuccess callback", e) } n._removePendingData(l) }; return e._loadData(c, n, function(t, i) { if (t.load) { if (!t.load(n, i, c.rootUrl, h)) return; n.loadingPluginName = t.name, f() } else { t.loadAsync(n, i, c.rootUrl, d, c.name).then(function() { n.loadingPluginName = t.name, f() }).catch(function(e) { h(e.message, e) }) } e.ShowLoadingScreen && n.executeWhenReady(function() { n.getEngine().hideLoadingUI() }) }, d, h, u, a) }, e.AppendAsync = function(t, i, n, r, o) { return void 0 === i && (i = ""), void 0 === n && (n = P.a.LastCreatedScene), void 0 === r && (r = null), void 0 === o && (o = null), new Promise(function(s, a) { e.Append(t, i, n, function(e) { s(e) }, r, function(e, t, i) { a(i || new Error(t)) }, o) }) }, e.LoadAssetContainer = function(t, i, n, r, o, s, a) { if (void 0 === i && (i = ""), void 0 === n && (n = P.a.LastCreatedScene), void 0 === r && (r = null), void 0 === o && (o = null), void 0 === s && (s = null), void 0 === a && (a = null), !n) return p.a.Error("No scene available to load asset container to"), null; var c = e._getFileInfo(t, i); if (!c) return null; var l = {}; n._addPendingData(l); var u = function() { n._removePendingData(l) }, h = function(e, t) { var i = "Unable to load assets from " + c.url + (e ? ": " + e : ""); s ? s(n, i, t) : p.a.Error(i), u() }, d = o ? function(e) { try { o(e) } catch (e) { h("Error in onProgress callback", e) } } : void 0, f = function(e) { if (r) try { r(e) } catch (e) { h("Error in onSuccess callback", e) } n._removePendingData(l) }; 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, f(r) } else if (t.loadAssetContainerAsync) { t.loadAssetContainerAsync(n, i, c.rootUrl, d, c.name).then(function(e) { n.loadingPluginName = t.name, f(e) }).catch(function(e) { h(e.message, e) }) } else 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() }) }, d, h, u, a) }, e.LoadAssetContainerAsync = function(t, i, n, r, o) { return void 0 === i && (i = ""), void 0 === n && (n = P.a.LastCreatedScene), void 0 === r && (r = null), void 0 === o && (o = null), new Promise(function(s, a) { e.LoadAssetContainer(t, i, n, function(e) { s(e) }, r, function(e, t, i) { a(i || new Error(t)) }, o) }) }, 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 r.c, e._registeredPlugins = {}, e }(), Tn = function(e) { function t(t) { var i = e.call(this, t) || this; return i.controllerType = St.DAYDREAM, i } return l.d(t, e), t.prototype.initControllerMesh = function(e, i) { var n = this; bn.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 p.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 }(Ai); wt._ControllerFactories.push({ canCreate: function(e) { return 0 === e.id.indexOf(Tn.GAMEPAD_ID_PREFIX) }, create: function(e) { return new Tn(e) } }); var En = function(e) { function t(t) { var i = e.call(this, t) || this; return i._buttonIndexToObservableNameMap = ["onPadStateChangedObservable", "onTriggerStateChangedObservable"], i.controllerType = St.GEAR_VR, i._calculatedPosition = new o.x("left" == i.hand ? -.15 : .15, -.5, .25), i._disableTrackPosition(i._calculatedPosition), i } return l.d(t, e), t.prototype.initControllerMesh = function(e, i) { var n = this; bn.ImportMesh("", t.MODEL_BASE_URL, t.MODEL_FILENAME, e, function(t) { var r = new fe.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) } }, t.MODEL_BASE_URL = "https://controllers.babylonjs.com/generic/", t.MODEL_FILENAME = "generic.babylon", t.GAMEPAD_ID_PREFIX = "Gear VR", t }(Ai); wt._ControllerFactories.push({ canCreate: function(e) { return 0 === e.id.indexOf(En.GAMEPAD_ID_PREFIX) || -1 !== e.id.indexOf("Oculus Go") }, create: function(e) { return new En(e) } }); var An = function(e) { function t(t) { return e.call(this, t) || this } return l.d(t, e), t.prototype.initControllerMesh = function(e, i) { var n = this; bn.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 }(Ai); wt._DefaultControllerFactory = function(e) { return new An(e) }; var xn = function(e) { function t(t) { var i = e.call(this, t) || this; return i.onSecondaryTriggerStateChangedObservable = new r.c, i.onThumbRestChangedObservable = new r.c, i.controllerType = St.OCULUS, i } return l.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, bn.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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onBButtonStateChangedObservable", { get: function() { if ("right" === this.hand) return this.onSecondaryButtonStateChangedObservable; throw new Error("No B button on left hand") }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onXButtonStateChangedObservable", { get: function() { if ("left" === this.hand) return this.onMainButtonStateChangedObservable; throw new Error("No X button on right hand") }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onYButtonStateChangedObservable", { get: function() { if ("left" === this.hand) return this.onSecondaryButtonStateChangedObservable; throw new Error("No Y button on right hand") }, enumerable: !0, configurable: !0 }), 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 }(Ai); wt._ControllerFactories.push({ canCreate: function(e) { return -1 !== e.id.indexOf("Oculus Touch") }, create: function(e) { return new xn(e) } }); var Rn = function(e) { function t(t) { var i = e.call(this, t) || this; return i.controllerType = St.VIVE, i._invertLeftStickY = !0, i } return l.d(t, e), t.prototype.initControllerMesh = function(e, i) { var n = this; bn.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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onRightButtonStateChangedObservable", { get: function() { return this.onMainButtonStateChangedObservable }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onMenuButtonStateChangedObservable", { get: function() { return this.onSecondaryButtonStateChangedObservable }, enumerable: !0, configurable: !0 }), 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 }(Ai); wt._ControllerFactories.push({ canCreate: function(e) { return -1 !== e.id.toLowerCase().indexOf("openvr") }, create: function(e) { return new Rn(e) } }); var Pn = function() { return function() { this.buttonMeshes = {}, this.axisMeshes = {} } }(), Sn = 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: Ft.POINTING_POSE }, i.onTrackpadChangedObservable = new r.c, i.onTrackpadValuesChangedObservable = new r.c, i.trackpad = { x: 0, y: 0 }, i.controllerType = St.WINDOWS, i._loadedMeshInfo = null, i } return l.d(t, e), Object.defineProperty(t.prototype, "onTriggerButtonStateChangedObservable", { get: function() { return this.onTriggerStateChangedObservable }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onMenuButtonStateChangedObservable", { get: function() { return this.onSecondaryButtonStateChangedObservable }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onGripButtonStateChangedObservable", { get: function() { return this.onMainButtonStateChangedObservable }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onThumbstickButtonStateChangedObservable", { get: function() { return this.onPadStateChangedObservable }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onTouchpadButtonStateChangedObservable", { get: function() { return this.onTrackpadChangedObservable }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "onTouchpadValuesChangedObservable", { get: function() { return this.onTrackpadValuesChangedObservable }, enumerable: !0, configurable: !0 }), 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._lerpButtonTransform = function(e, t) { if (this._loadedMeshInfo) { var i = this._loadedMeshInfo.buttonMeshes[e]; i.unpressed.rotationQuaternion && i.pressed.rotationQuaternion && i.value.rotationQuaternion && (o.q.SlerpToRef(i.unpressed.rotationQuaternion, i.pressed.rotationQuaternion, t, i.value.rotationQuaternion), o.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 = .5 * t + .5; o.q.SlerpToRef(i.min.rotationQuaternion, i.max.rotationQuaternion, n, i.value.rotationQuaternion), o.x.LerpToRef(i.min.position, i.max.position, n, i.value.position) } } }, t.prototype.initControllerMesh = function(e, i, n) { var r, o, s = this; if (void 0 === n && (n = !1), bn.IsPluginForExtensionAvailable(".glb")) { var a = "default"; if (this.id && !n) { var c = this.id.match(t.GAMEPAD_ID_PATTERN); a = c && c[0] || a } o = "left" === this.hand ? t.MODEL_LEFT_FILENAME : t.MODEL_RIGHT_FILENAME, r = t.MODEL_BASE_URL + a + "/" } else p.a.Warn("You need to reference GLTF loader to load Windows Motion Controllers model. Falling back to generic models"), r = An.MODEL_BASE_URL, o = An.MODEL_FILENAME; bn.ImportMesh("", r, o, e, function(t) { s._loadedMeshInfo = s.processModel(e, t), s._loadedMeshInfo && (s._defaultModel = s._loadedMeshInfo.rootNode, s.attachToMesh(s._defaultModel), i && i(s._defaultModel)) }, null, function(e, t) { p.a.Log(t), p.a.Warn("Failed to retrieve controller model from the remote server: " + r + o), n || s.initControllerMesh(e, i, !0) }) }, t.prototype.processModel = function(e, t) { for (var i = null, n = new fe.a(this.id + " " + this.hand, e), r = null, o = 0; o < t.length; o++) { var s = t[o]; if (!s.parent) { s.isPickable = !1, r = s; break } } return r ? (r.setParent(n), i = this.createMeshInfo(n)) : p.a.Warn("Could not find root node in model file."), i }, t.prototype.createMeshInfo = function(e) { var t, i = new Pn; 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 = l(e, n); if (r) { var o = { index: t, value: u(r, "VALUE"), pressed: u(r, "PRESSED"), unpressed: u(r, "UNPRESSED") }; o.value && o.pressed && o.unpressed ? i.buttonMeshes[this._mapping.buttons[t]] = o : p.a.Warn("Missing button submesh under mesh with name: " + n + "(VALUE: " + !!o.value + ", PRESSED: " + !!o.pressed + ", UNPRESSED:" + !!o.unpressed + ")") } else p.a.Warn("Missing button mesh with name: " + n) } else p.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 s = this._mapping.axisMeshNames[t]; if (s) { var a = l(e, s); if (a) { var c = { index: t, value: u(a, "VALUE"), min: u(a, "MIN"), max: u(a, "MAX") }; c.value && c.min && c.max ? i.axisMeshes[t] = c : p.a.Warn("Missing axis submesh under mesh with name: " + s + "(VALUE: " + !!c.value + ", MIN: " + !!c.min + ", MAX:" + !!c.max + ")") } else p.a.Warn("Missing axis mesh with name: " + s) } else p.a.Log("Skipping unknown axis at index: " + t) } return i.pointingPoseNode = l(e, this._mapping.pointingPoseMeshName), i.pointingPoseNode ? this._pointingPoseNode = i.pointingPoseNode : p.a.Warn("Missing pointing pose mesh with name: " + this._mapping.pointingPoseMeshName), i; function l(e, t) { return e.getChildren(function(e) { return e.name === t }, !1)[0] } function u(e, t) { return e.getChildren(function(e) { return e.name == t }, !0)[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 o.x(0, 0, -1), s = o.x.TransformNormal(r, i), a = o.x.Normalize(s); return new It.a(n, a, 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 }(Ai); wt._ControllerFactories.push({ canCreate: function(e) { return 0 === e.id.indexOf(Sn.GAMEPAD_ID_PREFIX) }, create: function(e) { return new Sn(e) } }); var Cn = i(58), Mn = i(52), On = i(48), In = i(41), Dn = function(e) { function t(t, i, n) { void 0 === i && (i = o.e.Gray()), void 0 === n && (n = In.a.DefaultUtilityLayer); var s = e.call(this, n) || this; s._pointerObserver = null, s.snapDistance = 0, s.onSnapObservable = new r.c, s.uniformScaling = !1, s._coloredMaterial = new Ri.a("", n.utilityLayerScene), s._coloredMaterial.diffuseColor = i, s._coloredMaterial.specularColor = i.subtract(new o.e(.1, .1, .1)); var a = new Ri.a("", n.utilityLayerScene); a.diffuseColor = i.add(new o.e(.3, .3, .3)); var c = new Fe.a("", n.utilityLayerScene), l = Mn.a.CreateBox("yPosMesh", { size: .4 }, n.utilityLayerScene), u = Fi.a.CreateCylinder("cylinder", { diameterTop: .005, height: .275, diameterBottom: .005, tessellation: 96 }, n.utilityLayerScene); u.material = s._coloredMaterial, c.addChild(l), c.addChild(u), l.scaling.scaleInPlace(.1), l.material = s._coloredMaterial, l.rotation.x = Math.PI / 2, l.position.z += .3, u.position.z += .1375, u.rotation.x = Math.PI / 2, c.lookAt(s._rootMesh.position.add(t)), s._rootMesh.addChild(c), c.scaling.scaleInPlace(1 / 3), s.dragBehavior = new Le.a({ dragAxis: t }), s.dragBehavior.moveAttached = !1, s._rootMesh.addBehavior(s.dragBehavior); var h = 0, d = new o.x, f = { snapDistance: 0 }; s.dragBehavior.onDragObservable.add(function(e) { if (s.attachedMesh) { var i = e.dragDistance * (3 * s.scaleRatio / s._rootMesh.scaling.length()), n = !1, r = 0; s.uniformScaling ? (s.attachedMesh.scaling.normalizeToRef(d), d.y < 0 && d.scaleInPlace(-1)) : d.copyFrom(t), 0 == s.snapDistance ? d.scaleToRef(i, d) : (h += i, Math.abs(h) > s.snapDistance ? (r = Math.floor(Math.abs(h) / s.snapDistance), h < 0 && (r *= -1), h %= s.snapDistance, d.scaleToRef(s.snapDistance * r, d), n = !0) : d.scaleInPlace(0)), s.attachedMesh.scaling.addInPlace(d), n && (f.snapDistance = s.snapDistance * r, s.onSnapObservable.notifyObservers(f)) } }), s._pointerObserver = n.utilityLayerScene.onPointerObservable.add(function(e) { if (!s._customMeshSet) { var t = e.pickInfo && -1 != s._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh) ? a : s._coloredMaterial; s._rootMesh.getChildMeshes().forEach(function(e) { e.material = t, e.color && (e.color = t.diffuseColor) }) } }); var p = n._getSharedGizmoLight(); return p.includedOnlyMeshes = p.includedOnlyMeshes.concat(s._rootMesh.getChildMeshes()), s } return l.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 = !1), 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 = !1) }, t }(On.a), Ln = i(46), wn = i(40), Fn = function(e) { function t(t, i) { void 0 === t && (t = o.e.Gray()), void 0 === i && (i = In.a.DefaultKeepDepthUtilityLayer); var n = e.call(this, i) || this; n._boundingDimensions = new o.x(1, 1, 1), n._renderObserver = null, n._pointerObserver = null, n._scaleDragSpeed = .2, n._tmpQuaternion = new o.q, n._tmpVector = new o.x(0, 0, 0), n._tmpRotationMatrix = new o.j, n.ignoreChildren = !1, n.includeChildPredicate = null, n.rotationSphereSize = .1, n.scaleBoxSize = .1, n.fixedDragMeshScreenSize = !1, n.fixedDragMeshScreenSizeDistanceFactor = 10, n.onDragStartObservable = new r.c, n.onScaleBoxDragObservable = new r.c, n.onScaleBoxDragEndObservable = new r.c, n.onRotationSphereDragObservable = new r.c, n.onRotationSphereDragEndObservable = new r.c, n.scalePivot = null, n._existingMeshScale = new o.x, n._dragMesh = null, n.pointerDragBehavior = new Le.a, n._updateScale = !1, n._anchorMesh = new Fe.a("anchor", i.utilityLayerScene), n.coloredMaterial = new Ri.a("", i.utilityLayerScene), n.coloredMaterial.disableLighting = !0, n.hoverColoredMaterial = new Ri.a("", i.utilityLayerScene), n.hoverColoredMaterial.disableLighting = !0, n._lineBoundingBox = new Fe.a("", i.utilityLayerScene), n._lineBoundingBox.rotationQuaternion = new o.q; var s = []; s.push(wn.a.CreateLines("lines", { points: [new o.x(0, 0, 0), new o.x(n._boundingDimensions.x, 0, 0)] }, i.utilityLayerScene)), s.push(wn.a.CreateLines("lines", { points: [new o.x(0, 0, 0), new o.x(0, n._boundingDimensions.y, 0)] }, i.utilityLayerScene)), s.push(wn.a.CreateLines("lines", { points: [new o.x(0, 0, 0), new o.x(0, 0, n._boundingDimensions.z)] }, i.utilityLayerScene)), s.push(wn.a.CreateLines("lines", { points: [new o.x(n._boundingDimensions.x, 0, 0), new o.x(n._boundingDimensions.x, n._boundingDimensions.y, 0)] }, i.utilityLayerScene)), s.push(wn.a.CreateLines("lines", { points: [new o.x(n._boundingDimensions.x, 0, 0), new o.x(n._boundingDimensions.x, 0, n._boundingDimensions.z)] }, i.utilityLayerScene)), s.push(wn.a.CreateLines("lines", { points: [new o.x(0, n._boundingDimensions.y, 0), new o.x(n._boundingDimensions.x, n._boundingDimensions.y, 0)] }, i.utilityLayerScene)), s.push(wn.a.CreateLines("lines", { points: [new o.x(0, n._boundingDimensions.y, 0), new o.x(0, n._boundingDimensions.y, n._boundingDimensions.z)] }, i.utilityLayerScene)), s.push(wn.a.CreateLines("lines", { points: [new o.x(0, 0, n._boundingDimensions.z), new o.x(n._boundingDimensions.x, 0, n._boundingDimensions.z)] }, i.utilityLayerScene)), s.push(wn.a.CreateLines("lines", { points: [new o.x(0, 0, n._boundingDimensions.z), new o.x(0, n._boundingDimensions.y, n._boundingDimensions.z)] }, i.utilityLayerScene)), s.push(wn.a.CreateLines("lines", { points: [new o.x(n._boundingDimensions.x, n._boundingDimensions.y, n._boundingDimensions.z), new o.x(0, n._boundingDimensions.y, n._boundingDimensions.z)] }, i.utilityLayerScene)), s.push(wn.a.CreateLines("lines", { points: [new o.x(n._boundingDimensions.x, n._boundingDimensions.y, n._boundingDimensions.z), new o.x(n._boundingDimensions.x, 0, n._boundingDimensions.z)] }, i.utilityLayerScene)), s.push(wn.a.CreateLines("lines", { points: [new o.x(n._boundingDimensions.x, n._boundingDimensions.y, n._boundingDimensions.z), new o.x(n._boundingDimensions.x, n._boundingDimensions.y, 0)] }, i.utilityLayerScene)), s.forEach(function(e) { e.color = t, e.position.addInPlace(new o.x(-n._boundingDimensions.x / 2, -n._boundingDimensions.y / 2, -n._boundingDimensions.z / 2)), e.isPickable = !1, n._lineBoundingBox.addChild(e) }), n._rootMesh.addChild(n._lineBoundingBox), n.setColor(t), n._rotateSpheresParent = new Fe.a("", i.utilityLayerScene), n._rotateSpheresParent.rotationQuaternion = new o.q; for (var a = function(e) { var t = Ln.a.CreateSphere("", { diameter: 1 }, i.utilityLayerScene); t.rotationQuaternion = new o.q, t.material = c.coloredMaterial, (d = new Le.a({})).moveAttached = !1, d.updateDragPlane = !1, t.addBehavior(d); var r = new o.x(1, 0, 0), s = 0; d.onDragStartObservable.add(function() { r.copyFrom(t.forward), s = 0 }), d.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 p.a.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling"); Be.a._RemoveAndStorePivotPoint(n.attachedMesh); var a = r, c = t.dragPlaneNormal.scale(o.x.Dot(t.dragPlaneNormal, a)), l = a.subtract(c).normalizeToNew(), u = o.x.Dot(l, t.delta) < 0 ? Math.abs(t.delta.length()) : -Math.abs(t.delta.length()); u = u / n._boundingDimensions.length() * n._anchorMesh.scaling.length(), n.attachedMesh.rotationQuaternion || (n.attachedMesh.rotationQuaternion = o.q.RotationYawPitchRoll(n.attachedMesh.rotation.y, n.attachedMesh.rotation.x, n.attachedMesh.rotation.z)), n._anchorMesh.rotationQuaternion || (n._anchorMesh.rotationQuaternion = o.q.RotationYawPitchRoll(n._anchorMesh.rotation.y, n._anchorMesh.rotation.x, n._anchorMesh.rotation.z)), s += u, Math.abs(s) <= 2 * Math.PI && (e >= 8 ? o.q.RotationYawPitchRollToRef(0, 0, u, n._tmpQuaternion) : e >= 4 ? o.q.RotationYawPitchRollToRef(u, 0, 0, n._tmpQuaternion) : o.q.RotationYawPitchRollToRef(0, u, 0, n._tmpQuaternion), n._anchorMesh.addChild(n.attachedMesh), n._anchorMesh.rotationQuaternion.multiplyToRef(n._tmpQuaternion, n._anchorMesh.rotationQuaternion), n._anchorMesh.removeChild(n.attachedMesh), n.attachedMesh.setParent(i)), n.updateBoundingBox(), Be.a._RestorePivotPoint(n.attachedMesh) } n._updateDummy() }), d.onDragStartObservable.add(function() { n.onDragStartObservable.notifyObservers({}), n._selectNode(t) }), d.onDragEndObservable.add(function() { n.onRotationSphereDragEndObservable.notifyObservers({}), n._selectNode(null), n._updateDummy() }), c._rotateSpheresParent.addChild(t) }, c = this, l = 0; l < 12; l++) a(l); n._rootMesh.addChild(n._rotateSpheresParent), n._scaleBoxesParent = new Fe.a("", i.utilityLayerScene), n._scaleBoxesParent.rotationQuaternion = new o.q; for (var u = 0; u < 2; u++) for (var h = 0; h < 2; h++) for (var d, f = function() { var e = Mn.a.CreateBox("", { size: 1 }, i.utilityLayerScene); e.material = _.coloredMaterial; var t = new o.x(0 == u ? -1 : 1, 0 == h ? -1 : 1, 0 == g ? -1 : 1); (d = new Le.a({ dragAxis: t })).moveAttached = !1, e.addBehavior(d), d.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 p.a.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling"); Be.a._RemoveAndStorePivotPoint(n.attachedMesh); var r = t.dragDistance / n._boundingDimensions.length() * n._anchorMesh.scaling.length(), s = new o.x(r, r, r); s.scaleInPlace(n._scaleDragSpeed), n.updateBoundingBox(), n.scalePivot ? (n.attachedMesh.getWorldMatrix().getRotationMatrixToRef(n._tmpRotationMatrix), n._boundingDimensions.scaleToRef(.5, n._tmpVector), o.x.TransformCoordinatesToRef(n._tmpVector, n._tmpRotationMatrix, n._tmpVector), n._anchorMesh.position.subtractInPlace(n._tmpVector), n._boundingDimensions.multiplyToRef(n.scalePivot, n._tmpVector), o.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(s), (n._anchorMesh.scaling.x < 0 || n._anchorMesh.scaling.y < 0 || n._anchorMesh.scaling.z < 0) && n._anchorMesh.scaling.subtractInPlace(s), n._anchorMesh.removeChild(n.attachedMesh), n.attachedMesh.setParent(i), Be.a._RestorePivotPoint(n.attachedMesh) } n._updateDummy() }), d.onDragStartObservable.add(function() { n.onDragStartObservable.notifyObservers({}), n._selectNode(e) }), d.onDragEndObservable.add(function() { n.onScaleBoxDragEndObservable.notifyObservers({}), n._selectNode(null), n._updateDummy() }), _._scaleBoxesParent.addChild(e) }, _ = this, g = 0; g < 2; g++) f(); n._rootMesh.addChild(n._scaleBoxesParent); var m = new Array; return n._pointerObserver = i.utilityLayerScene.onPointerObservable.add(function(e) { m[e.event.pointerId] ? e.pickInfo && e.pickInfo.pickedMesh != m[e.event.pointerId] && (m[e.event.pointerId].material = n.coloredMaterial, delete m[e.event.pointerId]) : n._rotateSpheresParent.getChildMeshes().concat(n._scaleBoxesParent.getChildMeshes()).forEach(function(t) { e.pickInfo && e.pickInfo.pickedMesh == t && (m[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 l.d(t, e), t.prototype.setColor = function(e) { this.coloredMaterial.emissiveColor = e, this.hoverColoredMaterial.emissiveColor = e.clone().add(new o.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) { Be.a._RemoveAndStorePivotPoint(e); var i = e.parent; this._anchorMesh.addChild(e), this._anchorMesh.removeChild(e), e.setParent(i), Be.a._RestorePivotPoint(e), this.updateBoundingBox(), e.getChildMeshes(!1).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) { Be.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 = o.q.RotationYawPitchRoll(this.attachedMesh.rotation.y, this.attachedMesh.rotation.x, this.attachedMesh.rotation.z)), this._anchorMesh.rotationQuaternion || (this._anchorMesh.rotationQuaternion = o.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), Be.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 o.x(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2)), e[r].lookAt(o.x.Cross(e[r].position.normalizeToNew(), o.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 o.x(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2)), e[r].lookAt(o.x.Cross(e[r].position.normalizeToNew(), o.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 o.x(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2)), e[r].lookAt(o.x.Cross(e[r].position.normalizeToNew(), o.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 s = this.rotationSphereSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor; e[r].scaling.set(s, s, s) } 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 o.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 s = this.scaleBoxSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor; e[r].scaling.set(s, s, s) } 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 = fe.a.CreateBox("dummy", 1, this.gizmoLayer.utilityLayerScene), this._dragMesh.visibility = 0, this._dragMesh.rotationQuaternion = new o.q, this.pointerDragBehavior.useObjectOrienationForDragging = !1, 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) { var t = function(e) { e.isPickable = !1, e.getChildMeshes().forEach(function(e) { t(e) }) }; t(e), e.rotationQuaternion || (e.rotationQuaternion = o.q.RotationYawPitchRoll(e.rotation.y, e.rotation.x, e.rotation.z)); var i = e.position.clone(), n = e.rotationQuaternion.clone(); e.rotationQuaternion.set(0, 0, 0, 1), e.position.set(0, 0, 0); var r = Mn.a.CreateBox("box", { size: 1 }, e.getScene()), s = e.getHierarchyBoundingVectors(); return s.max.subtractToRef(s.min, r.scaling), 0 === r.scaling.y && (r.scaling.y = o.h), 0 === r.scaling.x && (r.scaling.x = o.h), 0 === r.scaling.z && (r.scaling.z = o.h), r.position.set((s.max.x + s.min.x) / 2, (s.max.y + s.min.y) / 2, (s.max.z + s.min.z) / 2), e.addChild(r), e.rotationQuaternion.copyFrom(n), e.position.copyFrom(i), e.removeChild(r), r.addChild(e), r.visibility = 0, r }, t.prototype.setCustomMesh = function(e) { p.a.Error("Custom meshes are not supported on this gizmo") }, t }(On.a), Nn = function(e) { function t(t, i, n, s) { void 0 === i && (i = o.e.Gray()), void 0 === n && (n = In.a.DefaultUtilityLayer), void 0 === s && (s = 32); var a = e.call(this, n) || this; a._pointerObserver = null, a.snapDistance = 0, a.onSnapObservable = new r.c; var c = new Ri.a("", n.utilityLayerScene); c.diffuseColor = i, c.specularColor = i.subtract(new o.e(.1, .1, .1)); var l = new Ri.a("", n.utilityLayerScene); l.diffuseColor = i.add(new o.e(.3, .3, .3)); var u = new Fe.a("", n.utilityLayerScene), h = fe.a.CreateTorus("", .6, .03, s, n.utilityLayerScene); h.visibility = 0; var d = fe.a.CreateTorus("", .6, .005, s, n.utilityLayerScene); d.material = c, d.rotation.x = Math.PI / 2, h.rotation.x = Math.PI / 2, u.addChild(d), u.addChild(h), u.lookAt(a._rootMesh.position.add(t)), a._rootMesh.addChild(u), u.scaling.scaleInPlace(1 / 3), a.dragBehavior = new Le.a({ dragPlaneNormal: t }), a.dragBehavior.moveAttached = !1, a.dragBehavior.maxDragAngle = 9 * Math.PI / 20, a.dragBehavior._useAlternatePickedPointAboveMaxDragAngle = !0, a._rootMesh.addBehavior(a.dragBehavior); var f = new o.x; a.dragBehavior.onDragStartObservable.add(function(e) { a.attachedMesh && f.copyFrom(e.dragPlanePoint) }); var p = new o.j, _ = new o.x, g = new o.x, m = { snapDistance: 0 }, v = 0, y = new o.j, b = new o.x, T = new o.q; a.dragBehavior.onDragObservable.add(function(e) { if (a.attachedMesh) { a.attachedMesh.rotationQuaternion || (a.attachedMesh.rotationQuaternion = o.q.RotationYawPitchRoll(a.attachedMesh.rotation.y, a.attachedMesh.rotation.x, a.attachedMesh.rotation.z)); var i = a.attachedMesh.parent; i && a.attachedMesh.setParent(null); var r = e.dragPlanePoint.subtract(a.attachedMesh.absolutePosition).normalize(), s = f.subtract(a.attachedMesh.absolutePosition).normalize(), c = o.x.Cross(r, s), l = o.x.Dot(r, s), u = Math.atan2(c.length(), l); if (_.copyFrom(t), g.copyFrom(t), a.updateGizmoRotationToMatchAttachedMesh && (a.attachedMesh.rotationQuaternion.toRotationMatrix(p), g = o.x.TransformCoordinates(_, p)), n.utilityLayerScene.activeCamera) { var h = n.utilityLayerScene.activeCamera.position.subtract(a.attachedMesh.position); o.x.Dot(h, g) > 0 && (_.scaleInPlace(-1), g.scaleInPlace(-1)) } o.x.Dot(g, c) > 0 && (u = -u); var d = !1; if (0 != a.snapDistance) if (v += u, Math.abs(v) > a.snapDistance) { var E = Math.floor(Math.abs(v) / a.snapDistance); v < 0 && (E *= -1), v %= a.snapDistance, u = a.snapDistance * E, d = !0 } else u = 0; y.reset(), a.attachedMesh.parent && (a.attachedMesh.parent.computeWorldMatrix().invertToRef(y), y.getRotationMatrixToRef(y), o.x.TransformCoordinatesToRef(_, y, _)); var A = Math.sin(u / 2); T.set(_.x * A, _.y * A, _.z * A, Math.cos(u / 2)), y.determinant() > 0 && (T.toEulerAnglesToRef(b), o.q.RotationYawPitchRollToRef(b.y, -b.x, -b.z, T)), a.updateGizmoRotationToMatchAttachedMesh ? a.attachedMesh.rotationQuaternion.multiplyToRef(T, a.attachedMesh.rotationQuaternion) : T.multiplyToRef(a.attachedMesh.rotationQuaternion, a.attachedMesh.rotationQuaternion), f.copyFrom(e.dragPlanePoint), d && (m.snapDistance = u, a.onSnapObservable.notifyObservers(m)), i && a.attachedMesh.setParent(i) } }), a._pointerObserver = n.utilityLayerScene.onPointerObservable.add(function(e) { if (!a._customMeshSet) { var t = e.pickInfo && -1 != a._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh) ? l : c; a._rootMesh.getChildMeshes().forEach(function(e) { e.material = t, e.color && (e.color = t.diffuseColor) }) } }); var E = n._getSharedGizmoLight(); return E.includedOnlyMeshes = E.includedOnlyMeshes.concat(a._rootMesh.getChildMeshes(!1)), a } return l.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 }(On.a), Bn = function(e) { function t(t, i) { void 0 === t && (t = In.a.DefaultUtilityLayer), void 0 === i && (i = 32); var n = e.call(this, t) || this; return n.onDragStartObservable = new r.c, n.onDragEndObservable = new r.c, n.xGizmo = new Nn(new o.x(1, 0, 0), o.e.Red().scale(.5), t, i), n.yGizmo = new Nn(new o.x(0, 1, 0), o.e.Green().scale(.5), t, i), n.zGizmo = new Nn(new o.x(0, 0, 1), o.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 l.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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), t.prototype.dispose = function() { this.xGizmo.dispose(), this.yGizmo.dispose(), this.zGizmo.dispose(), this.onDragStartObservable.clear(), this.onDragEndObservable.clear() }, t.prototype.setCustomMesh = function(e) { p.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 }(On.a), Un = function(e) { function t(t) { void 0 === t && (t = In.a.DefaultUtilityLayer); var i = e.call(this, t) || this; return i.onDragStartObservable = new r.c, i.onDragEndObservable = new r.c, i.xGizmo = new Cn.a(new o.x(1, 0, 0), o.e.Red().scale(.5), t), i.yGizmo = new Cn.a(new o.x(0, 1, 0), o.e.Green().scale(.5), t), i.zGizmo = new Cn.a(new o.x(0, 0, 1), o.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, i } return l.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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), t.prototype.dispose = function() { this.xGizmo.dispose(), this.yGizmo.dispose(), this.zGizmo.dispose(), this.onDragStartObservable.clear(), this.onDragEndObservable.clear() }, t.prototype.setCustomMesh = function(e) { p.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 }(On.a); Mi.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, s, a, c, l = e.type && (e.type < 0 || e.type >= t.length) ? 0 : e.type || 0, u = e.size, h = e.sizeX || u || 1, d = e.sizeY || u || 1, f = e.sizeZ || u || 1, p = e.custom || t[l], _ = 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 || Mi.a.DEFAULTSIDE, b = new Array, T = new Array, E = new Array, A = new Array, x = new Array, R = 0, P = 0, S = new Array, C = 0, M = 0; if (v) for (M = 0; M < _; M++) m && void 0 === m[M] && (m[M] = new o.f(1, 1, 1, 1)), g && void 0 === g[M] && (g[M] = new o.y(0, 0, 1, 1)); if (v) for (M = 0; M < _; M++) { var O = p.face[M].length; for (r = 2 * Math.PI / O, s = .5 * Math.tan(r / 2), a = .5, C = 0; C < O; C++) b.push(p.vertex[p.face[M][C]][0] * h, p.vertex[p.face[M][C]][1] * d, p.vertex[p.face[M][C]][2] * f), S.push(R), R++, i = g[M].x + (g[M].z - g[M].x) * (.5 + s), n = g[M].y + (g[M].w - g[M].y) * (a - .5), A.push(i, n), c = s * Math.cos(r) - a * Math.sin(r), a = s * Math.sin(r) + a * Math.cos(r), s = c, m && x.push(m[M].r, m[M].g, m[M].b, m[M].a); for (C = 0; C < O - 2; C++) T.push(S[0 + P], S[C + 2 + P], S[C + 1 + P]); P += O } else { for (C = 0; C < p.vertex.length; C++) b.push(p.vertex[C][0] * h, p.vertex[C][1] * d, p.vertex[C][2] * f), A.push(0, 0); for (M = 0; M < _; M++) for (C = 0; C < p.face[M].length - 2; C++) T.push(p.face[M][0], p.face[M][C + 2], p.face[M][C + 1]) } Mi.a.ComputeNormals(b, T, E), Mi.a._ComputeSides(y, b, T, E, A, e.frontUVs, e.backUVs); var I = new Mi.a; return I.positions = b, I.indices = T, I.normals = E, I.uvs = A, m && v && (I.colors = x), I }, fe.a.CreatePolyhedron = function(e, t, i) { return Vn.CreatePolyhedron(e, t, i) }; var Vn = function() { function e() {} return e.CreatePolyhedron = function(e, t, i) { void 0 === i && (i = null); var n = new fe.a(e, i); return t.sideOrientation = fe.a._GetDefaultSideOrientation(t.sideOrientation), n._originalBuilderSideOrientation = t.sideOrientation, Mi.a.CreatePolyhedron(t).applyToMesh(n, t.updatable), n }, e }(), Gn = function(e) { function t(t) { void 0 === t && (t = In.a.DefaultUtilityLayer); var i = e.call(this, t) || this; i.onDragStartObservable = new r.c, i.onDragEndObservable = new r.c, i.xGizmo = new Dn(new o.x(1, 0, 0), o.e.Red().scale(.5), t), i.yGizmo = new Dn(new o.x(0, 1, 0), o.e.Green().scale(.5), t), i.zGizmo = new Dn(new o.x(0, 0, 1), o.e.Blue().scale(.5), t), i.uniformScaleGizmo = new Dn(new o.x(0, 1, 0), o.e.Yellow().scale(.5), t), i.uniformScaleGizmo.updateGizmoRotationToMatchAttachedMesh = !1, i.uniformScaleGizmo.uniformScaling = !0; var n = Vn.CreatePolyhedron("", { type: 1 }, i.uniformScaleGizmo.gizmoLayer.utilityLayerScene); n.scaling.scaleInPlace(.02), n.visibility = 0; var s = Vn.CreatePolyhedron("", { type: 1 }, i.uniformScaleGizmo.gizmoLayer.utilityLayerScene); s.scaling.scaleInPlace(.007), n.addChild(s), i.uniformScaleGizmo.setCustomMesh(n, !0); var a = t._getSharedGizmoLight(); return a.includedOnlyMeshes = a.includedOnlyMeshes.concat(s), [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({}) }) }), i.attachedMesh = null, i } return l.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, this.uniformScaleGizmo.attachedMesh = e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "updateGizmoRotationToMatchAttachedMesh", { get: function() { return this.xGizmo.updateGizmoRotationToMatchAttachedMesh }, set: function(e) { e || p.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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), t.prototype.dispose = function() { this.xGizmo.dispose(), this.yGizmo.dispose(), this.zGizmo.dispose(), this.uniformScaleGizmo.dispose(), this.onDragStartObservable.clear(), this.onDragEndObservable.clear() }, t }(On.a), kn = function() { function e(e) { var t = this; this.scene = e, this.clearGizmoOnEmptyPointerEvent = !1, this.onAttachedToMeshObservable = new r.c, this._gizmosEnabled = { positionGizmo: !1, rotationGizmo: !1, scaleGizmo: !1, boundingBoxGizmo: !1 }, this._pointerObserver = null, this._attachedMesh = null, this._boundingBoxColor = o.e.FromHexString("#0984e3"), this.boundingBoxDragBehavior = new Ue, this.attachableMeshes = null, this.usePointerToAttachGizmos = !0, this._defaultKeepDepthUtilityLayer = new In.a(e), this._defaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil = !1, this._defaultUtilityLayer = In.a.DefaultUtilityLayer, this.gizmos = { positionGizmo: null, rotationGizmo: null, scaleGizmo: null, boundingBoxGizmo: null }, this._pointerObserver = e.onPointerObservable.add(function(e) { if (t.usePointerToAttachGizmos && e.type == Pe.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 = !1; t.attachableMeshes.forEach(function(e) { i && (i == e || i.isDescendantOf(e)) && (i = e, n = !0) }), n || (i = null) } i instanceof Fe.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) } 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 Un(this._defaultUtilityLayer)), this.gizmos.positionGizmo.attachedMesh = this._attachedMesh) : this.gizmos.positionGizmo && (this.gizmos.positionGizmo.attachedMesh = null), this._gizmosEnabled.positionGizmo = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "rotationGizmoEnabled", { get: function() { return this._gizmosEnabled.rotationGizmo }, set: function(e) { e ? (this.gizmos.rotationGizmo || (this.gizmos.rotationGizmo = new Bn(this._defaultUtilityLayer)), this.gizmos.rotationGizmo.attachedMesh = this._attachedMesh) : this.gizmos.rotationGizmo && (this.gizmos.rotationGizmo.attachedMesh = null), this._gizmosEnabled.rotationGizmo = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "scaleGizmoEnabled", { get: function() { return this._gizmosEnabled.scaleGizmo }, set: function(e) { e ? (this.gizmos.scaleGizmo = this.gizmos.scaleGizmo || new Gn(this._defaultUtilityLayer), this.gizmos.scaleGizmo.attachedMesh = this._attachedMesh) : this.gizmos.scaleGizmo && (this.gizmos.scaleGizmo.attachedMesh = null), this._gizmosEnabled.scaleGizmo = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "boundingBoxGizmoEnabled", { get: function() { return this._gizmosEnabled.boundingBoxGizmo }, set: function(e) { e ? (this.gizmos.boundingBoxGizmo = this.gizmos.boundingBoxGizmo || new Fn(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: !0, configurable: !0 }), 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 }(), zn = i(38), jn = function(e) { function t() { var t = null !== e && e.apply(this, arguments) || this; return t._needProjectionMatrixCompute = !0, t } return l.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: !0, configurable: !0 }), 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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "shadowMinZ", { get: function() { return this._shadowMinZ }, set: function(e) { this._shadowMinZ = e, this.forceProjectionMatrixCompute() }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "shadowMaxZ", { get: function() { return this._shadowMaxZ }, set: function(e) { this._shadowMaxZ = e, this.forceProjectionMatrixCompute() }, enumerable: !0, configurable: !0 }), t.prototype.computeTransformedInformation = function() { return !(!this.parent || !this.parent.getWorldMatrix) && (this.transformedPosition || (this.transformedPosition = o.x.Zero()), o.x.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition), this.direction && (this.transformedDirection || (this.transformedDirection = o.x.Zero()), o.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 = o.x.Normalize(e.subtract(this.position)), this.direction }, t.prototype.getRotation = function() { this.direction.normalize(); var e = o.x.Cross(this.direction, o.c.Y), t = o.x.Cross(e, this.direction); return o.x.RotationFromAxis(e, t, this.direction) }, t.prototype.needCube = function() { return !1 }, t.prototype.needProjectionMatrixCompute = function() { return this._needProjectionMatrixCompute }, t.prototype.forceProjectionMatrixCompute = function() { this._needProjectionMatrixCompute = !0 }, t.prototype._initCache = function() { e.prototype._initCache.call(this), this._cache.position = o.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 = o.j.Identity()), o.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 = !0, 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 }, l.c([Object(L.o)()], t.prototype, "position", null), l.c([Object(L.o)()], t.prototype, "direction", null), l.c([Object(L.c)()], t.prototype, "shadowMinZ", null), l.c([Object(L.c)()], t.prototype, "shadowMaxZ", null), t }(zn.a); F.a.AddNodeConstructor("Light_Type_1", function(e, t) { return function() { return new Hn(e, o.x.Zero(), t) } }); var Hn = function(e) { function t(t, i, n) { var r = e.call(this, t, n) || this; return r._shadowFrustumSize = 0, r._shadowOrthoScale = .1, r.autoUpdateExtends = !0, 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 l.d(t, e), Object.defineProperty(t.prototype, "shadowFrustumSize", { get: function() { return this._shadowFrustumSize }, set: function(e) { this._shadowFrustumSize = e, this.forceProjectionMatrixCompute() }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "shadowOrthoScale", { get: function() { return this._shadowOrthoScale }, set: function(e) { this._shadowOrthoScale = e, this.forceProjectionMatrixCompute() }, enumerable: !0, configurable: !0 }), t.prototype.getClassName = function() { return "DirectionalLight" }, t.prototype.getTypeID = function() { return zn.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 && o.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 = o.x.Zero(); this._orthoLeft = Number.MAX_VALUE, this._orthoRight = Number.MIN_VALUE, this._orthoTop = Number.MIN_VALUE, this._orthoBottom = Number.MAX_VALUE; for (var s = 0; s < i.length; s++) { var a = i[s]; if (a) for (var c = a.getBoundingInfo().boundingBox, l = 0; l < c.vectorsWorld.length; l++) o.x.TransformCoordinatesToRef(c.vectorsWorld[l], 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 u = this._orthoRight - this._orthoLeft, h = this._orthoTop - this._orthoBottom; o.j.OrthoOffCenterLHToRef(this._orthoLeft - u * this.shadowOrthoScale, this._orthoRight + u * 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] = !0 }, l.c([Object(L.c)()], t.prototype, "shadowFrustumSize", null), l.c([Object(L.c)()], t.prototype, "shadowOrthoScale", null), l.c([Object(L.c)()], t.prototype, "autoUpdateExtends", void 0), t }(jn); fe.a.CreateHemisphere = function(e, t, i, n) { var r = { segments: t, diameter: i }; return Wn.CreateHemisphere(e, r, n) }; var Wn = function() { function e() {} return e.CreateHemisphere = function(e, t, i) { t.diameter || (t.diameter = 1), t.segments || (t.segments = 16); var n = Ln.a.CreateSphere("", { slice: .5, diameter: t.diameter, segments: t.segments }, i), r = fe.a.CreateDisc("", t.diameter / 2, 3 * t.segments + (4 - t.segments), i); r.rotation.x = -Math.PI / 2, r.parent = n; var o = fe.a.MergeMeshes([r, n], !0); return o.name = e, o }, e }(); F.a.AddNodeConstructor("Light_Type_2", function(e, t) { return function() { return new Xn(e, o.x.Zero(), o.x.Zero(), 0, 0, t) } }); var Xn = function(e) { function t(t, i, n, r, s, a) { var c = e.call(this, t, a) || this; return c._innerAngle = 0, c._projectionTextureMatrix = o.j.Zero(), c._projectionTextureLightNear = 1e-6, c._projectionTextureLightFar = 1e3, c._projectionTextureUpDirection = o.x.Up(), c._projectionTextureViewLightDirty = !0, c._projectionTextureProjectionLightDirty = !0, c._projectionTextureDirty = !0, c._projectionTextureViewTargetVector = o.x.Zero(), c._projectionTextureViewLightMatrix = o.j.Zero(), c._projectionTextureProjectionLightMatrix = o.j.Zero(), c._projectionTextureScalingMatrix = o.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 = s, c } return l.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 = !0, this.forceProjectionMatrixCompute(), this._computeAngleValues() }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "innerAngle", { get: function() { return this._innerAngle }, set: function(e) { this._innerAngle = e, this._computeAngleValues() }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "shadowAngleScale", { get: function() { return this._shadowAngleScale }, set: function(e) { this._shadowAngleScale = e, this.forceProjectionMatrixCompute() }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "projectionTextureMatrix", { get: function() { return this._projectionTextureMatrix }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "projectionTextureLightNear", { get: function() { return this._projectionTextureLightNear }, set: function(e) { this._projectionTextureLightNear = e, this._projectionTextureProjectionLightDirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "projectionTextureLightFar", { get: function() { return this._projectionTextureLightFar }, set: function(e) { this._projectionTextureLightFar = e, this._projectionTextureProjectionLightDirty = !0 }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "projectionTextureUpDirection", { get: function() { return this._projectionTextureUpDirection }, set: function(e) { this._projectionTextureUpDirection = e, this._projectionTextureProjectionLightDirty = !0 }, enumerable: !0, configurable: !0 }), 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 = !0, this._projectionTexture && !this._projectionTexture.isReady())) { var i = this._projectionTexture; i.onLoadObservable && i.onLoadObservable.addOnce(function() { t._markMeshesAsLightDirty() }) } }, enumerable: !0, configurable: !0 }), t.prototype.getClassName = function() { return "SpotLight" }, t.prototype.getTypeID = function() { return zn.a.LIGHTTYPEID_SPOTLIGHT }, t.prototype._setDirection = function(t) { e.prototype._setDirection.call(this, t), this._projectionTextureViewLightDirty = !0 }, t.prototype._setPosition = function(t) { e.prototype._setPosition.call(this, t), this._projectionTextureViewLightDirty = !0 }, 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; o.j.PerspectiveFovLHToRef(r, 1, this.getDepthMinZ(n), this.getDepthMaxZ(n), e) } }, t.prototype._computeProjectionTextureViewLightMatrix = function() { this._projectionTextureViewLightDirty = !1, this._projectionTextureDirty = !0, this.position.addToRef(this.direction, this._projectionTextureViewTargetVector), o.j.LookAtLHToRef(this.position, this._projectionTextureViewTargetVector, this._projectionTextureUpDirection, this._projectionTextureViewLightMatrix) }, t.prototype._computeProjectionTextureProjectionLightMatrix = function() { this._projectionTextureProjectionLightDirty = !1, this._projectionTextureDirty = !0; var e = this.projectionTextureLightFar, t = this.projectionTextureLightNear, i = e / (e - t), n = -i * t, r = 1 / Math.tan(this._angle / 2); o.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 = !1, 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 = o.x.Normalize(this.transformedDirection)) : (this._uniformBuffer.updateFloat4("vLightData", this.position.x, this.position.y, this.position.z, this.exponent, t), i = o.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] = !0, e["PROJECTEDLIGHTTEXTURE" + t] = !(!this.projectionTexture || !this.projectionTexture.isReady()) }, l.c([Object(L.c)()], t.prototype, "angle", null), l.c([Object(L.c)()], t.prototype, "innerAngle", null), l.c([Object(L.c)()], t.prototype, "shadowAngleScale", null), l.c([Object(L.c)()], t.prototype, "exponent", void 0), l.c([Object(L.c)()], t.prototype, "projectionTextureLightNear", null), l.c([Object(L.c)()], t.prototype, "projectionTextureLightFar", null), l.c([Object(L.c)()], t.prototype, "projectionTextureUpDirection", null), l.c([Object(L.m)("projectedLightTexture")], t.prototype, "_projectionTexture", void 0), t }(jn), Yn = function(e) { function t(t) { var i = e.call(this, t) || this; return i.cachedPosition = new o.x, i.cachedForward = new o.x(0, 0, 1), i._light = null, i.attachedMesh = new Fe.a("", i.gizmoLayer.utilityLayerScene), i._material = new Ri.a("light", i.gizmoLayer.originalScene), i._material.diffuseColor = new o.e(.5, .5, .5), i._material.specularColor = new o.e(.1, .1, .1), i } return l.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 Ti.a ? this._lightMesh = t._CreateHemisphericLightMesh(this.gizmoLayer.utilityLayerScene) : this._lightMesh = e instanceof Hn ? t._CreateDirectionalLightMesh(this.gizmoLayer.utilityLayerScene) : e instanceof Xn ? t._CreateSpotLightMesh(this.gizmoLayer.utilityLayerScene) : t._CreatePointLightMesh(this.gizmoLayer.utilityLayerScene), this._lightMesh.getChildMeshes(!1).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(!1)), this._lightMesh.rotationQuaternion = new o.q, e.position && this.attachedMesh.position.copyFrom(e.position), e.direction && this.attachedMesh.setDirection(e.direction), this._update() } }, enumerable: !0, configurable: !0 }), 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 && (o.x.DistanceSquared(this.attachedMesh.forward, this.cachedForward) > 1e-4 ? (this._light.direction.copyFrom(this.attachedMesh.forward), this.cachedForward.copyFrom(this.attachedMesh.forward)) : o.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 fe.a("hemisphereLight", e), n = Wn.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, r.position.z, i.scaling.scaleInPlace(t._Scale), i.rotation.x = Math.PI / 2, i }, t._CreatePointLightMesh = function(e) { var i = new fe.a("pointLight", e), n = Ln.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, i.scaling.scaleInPlace(t._Scale), i.rotation.x = Math.PI / 2, i }, t._CreateSpotLightMesh = function(e) { var i = new fe.a("spotLight", e); Ln.a.CreateSphere(i.name, { segments: 10, diameter: 1 }, e).parent = i; var n = Wn.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 }, t._CreateDirectionalLightMesh = function(e) { var i = new fe.a("directionalLight", e), n = new fe.a(i.name, e); n.parent = i, Ln.a.CreateSphere(i.name, { diameter: 1.2, segments: 10 }, e).parent = n; var r = fe.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, (s = r.clone(i.name)).scaling.y = .5, s.position.x += -1.25; var o, s, a = fe.a.CreateCylinder(i.name, 1, 0, .6, 6, 1, e); return a.position.y += 3, a.parent = n, (o = a.clone(i.name)).position.y = 1.5, o.position.x += 1.25, (s = a.clone(i.name)).position.y = 1.5, s.position.x += -1.25, n.scaling.scaleInPlace(t._Scale), n.rotation.z = Math.PI / 2, n.rotation.y = Math.PI / 2, i }, t._Scale = .007, t._createLightLines = function(e, t) { var i = new fe.a("root", t); i.rotation.x = Math.PI / 2; var n = new fe.a("linePivot", t); n.parent = i; var r = fe.a.CreateCylinder("line", 2, .2, .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++) { (s = n.clone("lineParentClone")).rotation.z = Math.PI / 4, s.rotation.y = Math.PI / 2 + Math.PI / 2 * o, s.getChildMeshes()[0].scaling.y = .5, s.getChildMeshes()[0].scaling.x = s.getChildMeshes()[0].scaling.z = .8, s.getChildMeshes()[0].position.y = s.getChildMeshes()[0].scaling.y / 2 + 1.2 } if (e < 3) return i; for (o = 0; o < 4; o++) { (s = n.clone("linePivotClone")).rotation.z = Math.PI / 2, s.rotation.y = Math.PI / 2 * o } if (e < 4) return i; for (o = 0; o < 4; o++) { var s; (s = n.clone("linePivotClone")).rotation.z = Math.PI + Math.PI / 4, s.rotation.y = Math.PI / 2 + Math.PI / 2 * o, s.getChildMeshes()[0].scaling.y = .5, s.getChildMeshes()[0].scaling.x = s.getChildMeshes()[0].scaling.z = .8, s.getChildMeshes()[0].position.y = s.getChildMeshes()[0].scaling.y / 2 + 1.2 } return e < 5 ? i : ((s = n.clone("linePivotClone")).rotation.z = Math.PI, i) }, t }(On.a), Kn = i(44); zt.a.IncludesShadersStore.kernelBlurVaryingDeclaration = "varying vec2 sampleCoord{X};"; var Qn = "#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"; zt.a.IncludesShadersStore.kernelBlurFragment = Qn; var qn = "#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"; zt.a.IncludesShadersStore.kernelBlurFragment2 = qn; var Zn = "\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}"; zt.a.ShadersStore.kernelBlurPixelShader = Zn; zt.a.IncludesShadersStore.kernelBlurVertex = "sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};"; var Jn = "\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}"; zt.a.ShadersStore.kernelBlurVertexShader = Jn; var $n = function(e) { function t(t, i, n, r, o, s, a, c, l, u, h) { void 0 === s && (s = ke.a.BILINEAR_SAMPLINGMODE), void 0 === l && (l = _.a.TEXTURETYPE_UNSIGNED_INT), void 0 === u && (u = ""), void 0 === h && (h = !1); var d = e.call(this, t, "kernelBlur", ["delta", "direction", "cameraMinMaxZ"], ["circleOfConfusionSampler"], r, o, s, a, c, null, l, "kernelBlur", { varyingCount: 0, depCount: 0 }, !0) || this; return d.direction = i, d.blockCompilation = h, d._packedFloat = !1, d._staticDefines = "", d._staticDefines = u, d.onApplyObservable.add(function(e) { d._outputTexture ? e.setFloat2("delta", 1 / d._outputTexture.width * d.direction.x, 1 / d._outputTexture.height * d.direction.y) : e.setFloat2("delta", 1 / d.width * d.direction.x, 1 / d.height * d.direction.y) }), d.kernel = n, d } return l.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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "packedFloat", { get: function() { return this._packedFloat }, set: function(e) { this._packedFloat !== e && (this._packedFloat = e, this.blockCompilation || this._updateParameters()) }, enumerable: !0, configurable: !0 }), 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 = [], s = [], a = 0, c = 0; c < n; c++) { var l = c / (n - 1), u = this._gaussianWeight(2 * l - 1); o[c] = c - r, s[c] = u, a += u } for (c = 0; c < s.length; c++) s[c] /= a; var h = [], d = [], f = []; for (c = 0; c <= r; c += 2) { var p = Math.min(c + 1, Math.floor(r)); if (c === p) f.push({ o: o[c], w: s[c] }); else { var _ = p === r, g = s[c] + s[p] * (_ ? .5 : 1), m = o[c] + 1 / (1 + s[c] / s[p]); 0 === m ? (f.push({ o: o[c], w: s[c] }), f.push({ o: o[c + 1], w: s[c + 1] })) : (f.push({ o: m, w: g }), f.push({ o: -m, w: g })) } } for (c = 0; c < f.length; c++) d[c] = f[c].o, h[c] = f[c].w; o = d, s = h; var v = this.getEngine().getCaps().maxVaryingVectors, y = Math.max(v, 0) - 1, b = Math.min(o.length, y), T = ""; T += this._staticDefines, -1 != this._staticDefines.indexOf("DOF") && (T += "#define CENTER_WEIGHT " + this._glslFloat(s[b - 1]) + "\r\n", b--); for (c = 0; c < b; c++) T += "#define KERNEL_OFFSET" + c + " " + this._glslFloat(o[c]) + "\r\n", T += "#define KERNEL_WEIGHT" + c + " " + this._glslFloat(s[c]) + "\r\n"; var E = 0; for (c = y; c < o.length; c++) T += "#define KERNEL_DEP_OFFSET" + E + " " + this._glslFloat(o[c]) + "\r\n", T += "#define KERNEL_DEP_WEIGHT" + E + " " + this._glslFloat(s[c]) + "\r\n", E++; this.packedFloat && (T += "#define PACKEDFLOAT 1"), this.blockCompilation = !1, e.prototype.updateEffect.call(this, T, null, null, { varyingCount: b, depCount: E }, 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 }(Ht), er = function(e) { function t(t, i, n, r, s, a, c) { void 0 === s && (s = _.a.TEXTURETYPE_UNSIGNED_INT), void 0 === a && (a = ke.a.BILINEAR_SAMPLINGMODE), void 0 === c && (c = !0); var l = e.call(this, t, i, n, r, !0, s, !1, a, c) || this; return l.scene = n, l.mirrorPlane = new o.n(0, 1, 0, 1), l._transformMatrix = o.j.Zero(), l._mirrorMatrix = o.j.Zero(), l._adaptiveBlurKernel = 0, l._blurKernelX = 0, l._blurKernelY = 0, l._blurRatio = 1, l.ignoreCameraViewport = !0, l._updateGammaSpace(), l._imageProcessingConfigChangeObserver = n.imageProcessingConfiguration.onUpdateParameters.add(function() { l._updateGammaSpace }), l.onBeforeRenderObservable.add(function() { o.j.ReflectionToRef(l.mirrorPlane, l._mirrorMatrix), l._savedViewMatrix = n.getViewMatrix(), l._mirrorMatrix.multiplyToRef(l._savedViewMatrix, l._transformMatrix), n.setTransformMatrix(l._transformMatrix, n.getProjectionMatrix()), n.clipPlane = l.mirrorPlane, n.getEngine().cullBackFaces = !1, n._mirroredCameraPosition = o.x.TransformCoordinates(n.activeCamera.globalPosition, l._mirrorMatrix) }), l.onAfterRenderObservable.add(function() { n.setTransformMatrix(l._savedViewMatrix, n.getProjectionMatrix()), n.getEngine().cullBackFaces = !0, n._mirroredCameraPosition = null, n.clipPlane = null }), l } return l.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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "adaptiveBlurKernel", { set: function(e) { this._adaptiveBlurKernel = e, this._autoComputeBlurKernel() }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "blurKernel", { set: function(e) { this.blurKernelX = e, this.blurKernelY = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "blurKernelX", { get: function() { return this._blurKernelX }, set: function(e) { this._blurKernelX !== e && (this._blurKernelX = e, this._preparePostProcesses()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "blurKernelY", { get: function() { return this._blurKernelY }, set: function(e) { this._blurKernelY !== e && (this._blurKernelY = e, this._preparePostProcesses()) }, enumerable: !0, configurable: !0 }), 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(!0), this._blurKernelX && this._blurKernelY) { var e = this.getScene().getEngine(), t = e.getCaps().textureFloatRender ? _.a.TEXTURETYPE_FLOAT : _.a.TEXTURETYPE_HALF_FLOAT; this._blurX = new $n("horizontal blur", new o.w(1, 0), this._blurKernelX, this._blurRatio, null, ke.a.BILINEAR_SAMPLINGMODE, e, !1, t), this._blurX.autoClear = !1, 1 === this._blurRatio && this.samples < 2 && this._texture ? this._blurX.inputTexture = this._texture : this._blurX.alwaysForcePOT = !0, this._blurY = new $n("vertical blur", new o.w(0, 1), this._blurKernelY, this._blurRatio, null, ke.a.BILINEAR_SAMPLINGMODE, e, !1, t), this._blurY.autoClear = !1, 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)), 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 }(_i); ke.a._CreateMirror = function(e, t, i, n) { return new er(e, t, i, n) }, ge.b.prototype._createDepthStencilCubeTexture = function(e, t) { var i = new ze.a(this, ze.a.DATASOURCE_UNKNOWN); if (i.isCube = !0, 1 === this.webGLVersion) return p.a.Error("Depth cube texture is not supported by WebGL 1."), i; var n = l.a({ bilinearFiltering: !1, comparisonFunction: 0, generateStencil: !1 }, t), r = this._gl; this._bindTextureDirectly(r.TEXTURE_CUBE_MAP, i, !0), 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 }, ge.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, !0, function(e, t) { r && e && r(e.status + " " + e.statusText, t) }) }, ge.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) }, ge.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) }, ge.b.prototype._partialLoadImg = function(e, t, i, n, r, o) { var s; void 0 === o && (o = null); s = ye.h.LoadImage(e, function() { i[t] = s, i._internalCount++, n && n._removePendingData(s), 6 === i._internalCount && r(i) }, function(e, t) { n && n._removePendingData(s), o && o(e, t) }, n ? n.offlineProvider : null), n && n._addPendingData(s) }, ge.b.prototype.createCubeTexture = function(e, t, i, n, r, o, s, a, c, l, u, h, d) { var f = this; void 0 === r && (r = null), void 0 === o && (o = null), void 0 === a && (a = null), void 0 === c && (c = !1), void 0 === l && (l = 0), void 0 === u && (u = 0), void 0 === h && (h = null), void 0 === d && (d = []); var _ = this._gl, g = h || new ze.a(this, ze.a.DATASOURCE_CUBE); g.isCube = !0, g.url = e, g.generateMipMaps = !n, g._lodGenerationScale = l, g._lodGenerationOffset = u, this._doNotHandleContextLost || (g._extension = a, g._files = i); for (var m = e.lastIndexOf("."), v = a || (m > -1 ? e.substring(m).toLowerCase() : ""), y = null, b = 0, T = ge.b._TextureLoaders; b < T.length; b++) { var E = T[b]; if (-1 === d.indexOf(E) && E.canLoad(v, this._textureFormatInUse, h, !1, !1)) { y = E; break } } if (y) { e = y.transformUrl(e, this._textureFormatInUse); var A = function(e) { f._bindTextureDirectly(_.TEXTURE_CUBE_MAP, g, !0), y.loadCubeData(e, g, c, r, o) }; i && 6 === i.length ? y.supportCascades ? this._cascadeLoadFiles(t, A, i, o) : o ? o("Textures type does not support cascades.") : p.a.Warn("Texture loader does not support cascades.") : this._loadFile(e, A, void 0, void 0, !0, function(e, a) { if (y) { var h = y.getFallbackTextureUrl(g.url, f._textureFormatInUse); if (p.a.Warn(y.constructor.name + " failed when trying to load " + g.url + ", falling back to the next supported loader"), h) return d.push(y), void f.createCubeTexture(h, t, i, n, r, o, s, v, c, l, u, g, d) } o && e && o(e.status + " " + e.statusText, a) }) } else { if (!i) throw new Error("Cannot load cubemap because files were not defined"); this._cascadeLoadImgs(t, function(e) { var t = f.needPOTTextures ? ye.h.GetExponentOfTwo(e[0].width, f._caps.maxCubemapTextureSize) : e[0].width, i = t; if (f._prepareWorkingCanvas(), f._workingCanvas && f._workingContext) { f._workingCanvas.width = t, f._workingCanvas.height = i; var o = [_.TEXTURE_CUBE_MAP_POSITIVE_X, _.TEXTURE_CUBE_MAP_POSITIVE_Y, _.TEXTURE_CUBE_MAP_POSITIVE_Z, _.TEXTURE_CUBE_MAP_NEGATIVE_X, _.TEXTURE_CUBE_MAP_NEGATIVE_Y, _.TEXTURE_CUBE_MAP_NEGATIVE_Z]; f._bindTextureDirectly(_.TEXTURE_CUBE_MAP, g, !0), f._unpackFlipY(!1); for (var a = s ? f._getInternalFormat(s) : f._gl.RGBA, c = 0; c < o.length; c++) e[c].width !== t || e[c].height !== i ? (f._workingContext.drawImage(e[c], 0, 0, e[c].width, e[c].height, 0, 0, t, i), _.texImage2D(o[c], 0, a, a, _.UNSIGNED_BYTE, f._workingCanvas)) : _.texImage2D(o[c], 0, a, a, _.UNSIGNED_BYTE, e[c]); n || _.generateMipmap(_.TEXTURE_CUBE_MAP), f._setCubeMapTextureParams(!n), g.width = t, g.height = i, g.isReady = !0, s && (g.format = s), g.onLoadedObservable.notifyObservers(g), g.onLoadedObservable.clear(), r && r() } }, i, o) } return this._internalTexturesCache.push(g), g }; var tr = function(e) { function t(t, i, n, r, s, a, c, l, u, h, d, f, p) { void 0 === n && (n = null), void 0 === r && (r = !1), void 0 === s && (s = null), void 0 === a && (a = null), void 0 === c && (c = null), void 0 === l && (l = _.a.TEXTUREFORMAT_RGBA), void 0 === u && (u = !1), void 0 === h && (h = null), void 0 === d && (d = !1), void 0 === f && (f = .8), void 0 === p && (p = 0); var g = e.call(this, i) || this; if (g.boundingBoxPosition = o.x.Zero(), g._rotationY = 0, g._prefiltered = !1, g.name = t, g.url = t, g._noMipmap = r, g.hasAlpha = !1, g._format = l, g.isCube = !0, g._textureMatrix = o.j.Identity(), g._createPolynomials = d, g.coordinatesMode = ke.a.CUBIC_MODE, !t && !s) return g; var m = t.lastIndexOf("."), v = h || (m > -1 ? t.substring(m).toLowerCase() : ""), y = ".dds" === v, b = ".env" === v; if (b ? (g.gammaSpace = !1, g._prefiltered = !1) : (g._prefiltered = u, u && (g.gammaSpace = !1)), g._texture = g._getFromCache(t, r), !s && (b || y || n || (n = ["_px.jpg", "_py.jpg", "_pz.jpg", "_nx.jpg", "_ny.jpg", "_nz.jpg"]), s = [], n)) for (var T = 0; T < n.length; T++) s.push(t + n[T]); return g._files = s, g._texture ? a && (g._texture.isReady ? ye.h.SetImmediate(function() { return a() }) : g._texture.onLoadedObservable.add(a)) : i.useDelayedTextureLoading ? g.delayLoadState = _.a.DELAYLOADSTATE_NOTLOADED : g._texture = u ? i.getEngine().createPrefilteredCubeTexture(t, i, f, p, a, c, l, h, g._createPolynomials) : i.getEngine().createCubeTexture(t, i, s, r, a, c, g._format, h, !1, f, p), g } return l.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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "rotationY", { get: function() { return this._rotationY }, set: function(e) { this._rotationY = e, this.setReflectionTextureMatrix(o.j.RotationY(this._rotationY)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "noMipmap", { get: function() { return this._noMipmap }, enumerable: !0, configurable: !0 }), 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 = !0), new t(e, i, null, !1, null, null, null, void 0, !0, n, r) }, Object.defineProperty(t.prototype, "isPrefiltered", { get: function() { return this._prefiltered }, enumerable: !0, configurable: !0 }), 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 = !1, 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))) } }, 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 = L.a.Parse(function() { var r = !1; return e.prefiltered && (r = e.prefiltered), new t(n + e.name, i, e.extensions, !1, null, null, null, void 0, r) }, e, i); if (e.boundingBoxPosition && (r.boundingBoxPosition = o.x.FromArray(e.boundingBoxPosition)), e.boundingBoxSize && (r.boundingBoxSize = o.x.FromArray(e.boundingBoxSize)), e.animations) for (var a = 0; a < e.animations.length; a++) { var c = e.animations[a], l = s.a.GetClass("BABYLON.Animation"); l && r.animations.push(l.Parse(c)) } return r }, t.prototype.clone = function() { var e = this, i = this.getScene(), n = 0, r = L.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 }, l.c([Object(L.c)("rotationY")], t.prototype, "rotationY", null), l.c([Object(L.j)("textureMatrix")], t.prototype, "_textureMatrix", void 0), t }(Kn.a); ke.a._CubeTextureParser = tr.Parse, s.a.RegisteredTypes["BABYLON.CubeTexture"] = tr; var ir = i(15), nr = i(64), rr = i(75), or = i(18), sr = " 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"; zt.a.IncludesShadersStore.backgroundFragmentDeclaration = sr; var ar = "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};"; zt.a.IncludesShadersStore.backgroundUboDeclaration = ar; i(113), i(84), i(85), i(120), i(112), i(95), i(98), i(89), i(114), i(99); var cr = "#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"; zt.a.ShadersStore.backgroundPixelShader = cr; var lr = "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"; zt.a.IncludesShadersStore.backgroundVertexDeclaration = lr; i(67), i(68), i(96), i(100), i(69), i(70), i(90), i(116), i(117); var ur = "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"; zt.a.ShadersStore.backgroundVertexShader = ur; var hr = function(e) { function t() { var t = e.call(this) || this; return t.DIFFUSE = !1, t.DIFFUSEDIRECTUV = 0, t.GAMMADIFFUSE = !1, t.DIFFUSEHASALPHA = !1, t.OPACITYFRESNEL = !1, t.REFLECTIONBLUR = !1, t.REFLECTIONFRESNEL = !1, t.REFLECTIONFALLOFF = !1, t.TEXTURELODSUPPORT = !1, t.PREMULTIPLYALPHA = !1, t.USERGBCOLOR = !1, t.USEHIGHLIGHTANDSHADOWCOLORS = !1, t.NOISE = !1, t.REFLECTIONBGR = !1, t.IMAGEPROCESSING = !1, t.VIGNETTE = !1, t.VIGNETTEBLENDMODEMULTIPLY = !1, t.VIGNETTEBLENDMODEOPAQUE = !1, t.TONEMAPPING = !1, t.TONEMAPPING_ACES = !1, t.CONTRAST = !1, t.COLORCURVES = !1, t.COLORGRADING = !1, t.COLORGRADING3D = !1, t.SAMPLER3DGREENDEPTH = !1, t.SAMPLER3DBGRMAP = !1, t.IMAGEPROCESSINGPOSTPROCESS = !1, t.EXPOSURE = !1, t.MULTIVIEW = !1, t.REFLECTION = !1, t.REFLECTIONMAP_3D = !1, t.REFLECTIONMAP_SPHERICAL = !1, t.REFLECTIONMAP_PLANAR = !1, t.REFLECTIONMAP_CUBIC = !1, t.REFLECTIONMAP_PROJECTION = !1, t.REFLECTIONMAP_SKYBOX = !1, t.REFLECTIONMAP_SKYBOX_TRANSFORMED = !1, t.REFLECTIONMAP_EXPLICIT = !1, t.REFLECTIONMAP_EQUIRECTANGULAR = !1, t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = !1, t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = !1, t.INVERTCUBICMAP = !1, t.REFLECTIONMAP_OPPOSITEZ = !1, t.LODINREFLECTIONALPHA = !1, t.GAMMAREFLECTION = !1, t.RGBDREFLECTION = !1, t.EQUIRECTANGULAR_RELFECTION_FOV = !1, t.MAINUV1 = !1, t.MAINUV2 = !1, t.UV1 = !1, t.UV2 = !1, t.CLIPPLANE = !1, t.CLIPPLANE2 = !1, t.CLIPPLANE3 = !1, t.CLIPPLANE4 = !1, t.POINTSIZE = !1, t.FOG = !1, t.NORMAL = !1, t.NUM_BONE_INFLUENCERS = 0, t.BonesPerMesh = 0, t.INSTANCES = !1, t.SHADOWFLOAT = !1, t.rebuild(), t } return l.d(t, e), t }(nr.a), dr = function(e) { function t(t, i) { var n = e.call(this, t, i) || this; return n.primaryColor = o.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 = o.x.Zero(), n.opacityFresnel = !0, n.reflectionFresnel = !1, n.reflectionFalloffDistance = 0, n.reflectionAmount = 1, n.reflectionReflectance0 = .05, n.reflectionReflectance90 = .5, n.useRGBColor = !0, n.enableNoise = !1, n._fovMultiplier = 1, n.useEquirectangularFOV = !1, n._maxSimultaneousLights = 4, n.maxSimultaneousLights = 4, n._imageProcessingObserver = null, n.switchToBGR = !1, n._renderTargets = new kt.a(16), n._reflectionControls = o.y.Zero(), n._white = o.e.White(), n._primaryShadowColor = o.e.Black(), n._primaryHighlightColor = o.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 l.d(t, e), Object.defineProperty(t.prototype, "_perceptualColor", { get: function() { return this.__perceptualColor }, set: function(e) { this.__perceptualColor = e, this._computePrimaryColorFromPerceptualColor(), this._markAllSubMeshesAsLightsDirty() }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "primaryColorShadowLevel", { get: function() { return this._primaryColorShadowLevel }, set: function(e) { this._primaryColorShadowLevel = e, this._computePrimaryColors(), this._markAllSubMeshesAsLightsDirty() }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "primaryColorHighlightLevel", { get: function() { return this._primaryColorHighlightLevel }, set: function(e) { this._primaryColorHighlightLevel = e, this._computePrimaryColors(), this._markAllSubMeshesAsLightsDirty() }, enumerable: !0, configurable: !0 }), 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) }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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 }, set: function(e) { this._attachImageProcessingConfiguration(e), this._markAllSubMeshesAsTexturesDirty() }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorCurvesEnabled", { get: function() { return this.imageProcessingConfiguration.colorCurvesEnabled }, set: function(e) { this.imageProcessingConfiguration.colorCurvesEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorGradingEnabled", { get: function() { return this.imageProcessingConfiguration.colorGradingEnabled }, set: function(e) { this.imageProcessingConfiguration.colorGradingEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraToneMappingEnabled", { get: function() { return this._imageProcessingConfiguration.toneMappingEnabled }, set: function(e) { this._imageProcessingConfiguration.toneMappingEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraExposure", { get: function() { return this._imageProcessingConfiguration.exposure }, set: function(e) { this._imageProcessingConfiguration.exposure = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraContrast", { get: function() { return this._imageProcessingConfiguration.contrast }, set: function(e) { this._imageProcessingConfiguration.contrast = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorGradingTexture", { get: function() { return this._imageProcessingConfiguration.colorGradingTexture }, set: function(e) { this.imageProcessingConfiguration.colorGradingTexture = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorCurves", { get: function() { return this.imageProcessingConfiguration.colorCurves }, set: function(e) { this.imageProcessingConfiguration.colorCurves = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "hasRenderTargetTextures", { get: function() { return !(!this._diffuseTexture || !this._diffuseTexture.isRenderTarget) || !(!this._reflectionTexture || !this._reflectionTexture.isRenderTarget) }, enumerable: !0, configurable: !0 }), t.prototype.needAlphaTesting = function() { return !0 }, 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 = !1), t.effect && this.isFrozen && this._wasPreviouslyReady) return !0; t._materialDefines || (t._materialDefines = new hr); var r = this.getScene(), o = t._materialDefines; if (!this.checkReadyOnEveryCall && t.effect && o._renderId === r.getRenderId()) return !0; var s = r.getEngine(); if (ir.a.PrepareDefinesForLights(r, e, o, !1, this._maxSimultaneousLights), o._needNormals = !0, ir.a.PrepareDefinesForMultiview(r, o), o._areTexturesDirty) { if (o._needUVs = !1, r.texturesEnabled) { if (r.getEngine().getCaps().textureLOD && (o.TEXTURELODSUPPORT = !0), this._diffuseTexture && or.a.DiffuseTextureEnabled) { if (!this._diffuseTexture.isReadyOrNotBlocking()) return !1; ir.a.PrepareDefinesForMergedUV(this._diffuseTexture, o, "DIFFUSE"), o.DIFFUSEHASALPHA = this._diffuseTexture.hasAlpha, o.GAMMADIFFUSE = this._diffuseTexture.gammaSpace, o.OPACITYFRESNEL = this._opacityFresnel } else o.DIFFUSE = !1, o.DIFFUSEHASALPHA = !1, o.GAMMADIFFUSE = !1, o.OPACITYFRESNEL = !1; var a = this._reflectionTexture; if (a && or.a.ReflectionTextureEnabled) { if (!a.isReadyOrNotBlocking()) return !1; switch (o.REFLECTION = !0, o.GAMMAREFLECTION = a.gammaSpace, o.RGBDREFLECTION = a.isRGBD, o.REFLECTIONBLUR = this._reflectionBlur > 0, o.REFLECTIONMAP_OPPOSITEZ = this.getScene().useRightHandedSystem ? !a.invertZ : a.invertZ, o.LODINREFLECTIONALPHA = a.lodLevelInAlpha, o.EQUIRECTANGULAR_RELFECTION_FOV = this.useEquirectangularFOV, o.REFLECTIONBGR = this.switchToBGR, a.coordinatesMode === ke.a.INVCUBIC_MODE && (o.INVERTCUBICMAP = !0), o.REFLECTIONMAP_3D = a.isCube, a.coordinatesMode) { case ke.a.EXPLICIT_MODE: o.REFLECTIONMAP_EXPLICIT = !0; break; case ke.a.PLANAR_MODE: o.REFLECTIONMAP_PLANAR = !0; break; case ke.a.PROJECTION_MODE: o.REFLECTIONMAP_PROJECTION = !0; break; case ke.a.SKYBOX_MODE: o.REFLECTIONMAP_SKYBOX = !0, o.REFLECTIONMAP_SKYBOX_TRANSFORMED = !a.getReflectionTextureMatrix().isIdentity(); break; case ke.a.SPHERICAL_MODE: o.REFLECTIONMAP_SPHERICAL = !0; break; case ke.a.EQUIRECTANGULAR_MODE: o.REFLECTIONMAP_EQUIRECTANGULAR = !0; break; case ke.a.FIXED_EQUIRECTANGULAR_MODE: o.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = !0; break; case ke.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE: o.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = !0; break; case ke.a.CUBIC_MODE: case ke.a.INVCUBIC_MODE: default: o.REFLECTIONMAP_CUBIC = !0 } this.reflectionFresnel ? (o.REFLECTIONFRESNEL = !0, 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 = !1, o.REFLECTIONFALLOFF = !1) } else o.REFLECTION = !1, o.REFLECTIONFRESNEL = !1, o.REFLECTIONFALLOFF = !1, o.REFLECTIONBLUR = !1, o.REFLECTIONMAP_3D = !1, o.REFLECTIONMAP_SPHERICAL = !1, o.REFLECTIONMAP_PLANAR = !1, o.REFLECTIONMAP_CUBIC = !1, o.REFLECTIONMAP_PROJECTION = !1, o.REFLECTIONMAP_SKYBOX = !1, o.REFLECTIONMAP_SKYBOX_TRANSFORMED = !1, o.REFLECTIONMAP_EXPLICIT = !1, o.REFLECTIONMAP_EQUIRECTANGULAR = !1, o.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = !1, o.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = !1, o.INVERTCUBICMAP = !1, o.REFLECTIONMAP_OPPOSITEZ = !1, o.LODINREFLECTIONALPHA = !1, o.GAMMAREFLECTION = !1, o.RGBDREFLECTION = !1 } 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 !1; this._imageProcessingConfiguration.prepareDefines(o) } if (ir.a.PrepareDefinesForMisc(e, r, !1, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(e), o), ir.a.PrepareDefinesForFrameBoundValues(r, s, o, i), ir.a.PrepareDefinesForAttributes(e, o, !1, !0, !1) && e && (r.getEngine().getCaps().standardDerivatives || e.isVerticesDataPresent(Oi.b.NormalKind) || (e.createNormals(!0), p.a.Warn("BackgroundMaterial: Normals have been created for the mesh: " + e.name))), o.isDirty) { o.markAsProcessed(), r.resetCachedMaterial(); var c = new zt.c; o.FOG && c.addFallback(0, "FOG"), o.POINTSIZE && c.addFallback(1, "POINTSIZE"), o.MULTIVIEW && c.addFallback(0, "MULTIVIEW"), ir.a.HandleFallbacksForShadows(o, c, this._maxSimultaneousLights), o.NUM_BONE_INFLUENCERS > 0 && c.addCPUSkinningFallback(0, e); var l = [Oi.b.PositionKind]; o.NORMAL && l.push(Oi.b.NormalKind), o.UV1 && l.push(Oi.b.UVKind), o.UV2 && l.push(Oi.b.UV2Kind), ir.a.PrepareAttributesForBones(l, e, o, c), ir.a.PrepareAttributesForInstances(l, o); var u = ["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"], d = ["Material", "Scene"]; xi.a && (xi.a.PrepareUniforms(u, o), xi.a.PrepareSamplers(h, o)), ir.a.PrepareUniformsAndSamplersList({ uniformsNames: u, uniformBuffersNames: d, samplers: h, defines: o, maxSimultaneousLights: this._maxSimultaneousLights }); var f = o.toString(); t.setEffect(r.getEngine().createEffect("background", { attributes: l, uniformsNames: u, uniformBuffersNames: d, samplers: h, defines: f, fallbacks: c, onCompiled: function(e) { n.onCompiled && n.onCompiled(e), n.bindSceneUniformBuffer(e, r.getSceneUniformBuffer()) }, onError: this.onError, indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights } }, s), o), this.buildUniformLayout() } return !(!t.effect || !t.effect.isReady()) && (o._renderId = r.getRenderId(), this._wasPreviouslyReady = !0, !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("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), ir.a.BindBonesParameters(t, this._activeEffect); var s = this._mustRebind(n, o, t.visibility); if (s) { this._uniformBuffer.bindToEffect(o, "Material"), this.bindViewProjection(o); var a = this._reflectionTexture; this._uniformBuffer.useUbo && this.isFrozen && this._uniformBuffer.isSync || (n.texturesEnabled && (this._diffuseTexture && or.a.DiffuseTextureEnabled && (this._uniformBuffer.updateFloat2("vDiffuseInfos", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level), ir.a.BindTextureMatrix(this._diffuseTexture, this._uniformBuffer, "diffuse")), a && or.a.ReflectionTextureEnabled && (this._uniformBuffer.updateMatrix("reflectionMatrix", a.getReflectionTextureMatrix()), this._uniformBuffer.updateFloat2("vReflectionInfos", a.level, this._reflectionBlur), this._uniformBuffer.updateFloat3("vReflectionMicrosurfaceInfos", a.getSize().width, a.lodGenerationScale, a.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 && or.a.DiffuseTextureEnabled && this._uniformBuffer.setTexture("diffuseSampler", this._diffuseTexture), a && or.a.ReflectionTextureEnabled && (r.REFLECTIONBLUR && r.TEXTURELODSUPPORT ? this._uniformBuffer.setTexture("reflectionSampler", a) : r.REFLECTIONBLUR ? (this._uniformBuffer.setTexture("reflectionSampler", a._lodTextureMid || a), this._uniformBuffer.setTexture("reflectionSamplerLow", a._lodTextureLow || a), this._uniformBuffer.setTexture("reflectionSamplerHigh", a._lodTextureHigh || a)) : this._uniformBuffer.setTexture("reflectionSampler", a), 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)))), ir.a.BindClipPlane(this._activeEffect, n), ir.a.BindEyePosition(o, n) }!s && this.isFrozen || (n.lightsEnabled && ir.a.BindLights(n, t, this._activeEffect, r, this._maxSimultaneousLights, !1), this.bindView(o), ir.a.BindFogParameters(n, t, this._activeEffect, !0), 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 = !1), void 0 === i && (i = !1), 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 L.a.Clone(function() { return new t(e, i.getScene()) }, this) }, t.prototype.serialize = function() { var e = L.a.Serialize(this); return e.customType = "BABYLON.BackgroundMaterial", e }, t.prototype.getClassName = function() { return "BackgroundMaterial" }, t.Parse = function(e, i, n) { return L.a.Parse(function() { return new t(e.name, i) }, e, i, n) }, t.StandardReflectance0 = .05, t.StandardReflectance90 = .5, l.c([Object(L.e)()], t.prototype, "_primaryColor", void 0), l.c([Object(L.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "primaryColor", void 0), l.c([Object(L.e)()], t.prototype, "__perceptualColor", void 0), l.c([Object(L.c)()], t.prototype, "_primaryColorShadowLevel", void 0), l.c([Object(L.c)()], t.prototype, "_primaryColorHighlightLevel", void 0), l.c([Object(L.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "primaryColorHighlightLevel", null), l.c([Object(L.m)()], t.prototype, "_reflectionTexture", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionTexture", void 0), l.c([Object(L.c)()], t.prototype, "_reflectionBlur", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionBlur", void 0), l.c([Object(L.m)()], t.prototype, "_diffuseTexture", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "diffuseTexture", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "shadowLights", void 0), l.c([Object(L.c)()], t.prototype, "_shadowLevel", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "shadowLevel", void 0), l.c([Object(L.o)()], t.prototype, "_sceneCenter", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "sceneCenter", void 0), l.c([Object(L.c)()], t.prototype, "_opacityFresnel", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "opacityFresnel", void 0), l.c([Object(L.c)()], t.prototype, "_reflectionFresnel", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionFresnel", void 0), l.c([Object(L.c)()], t.prototype, "_reflectionFalloffDistance", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionFalloffDistance", void 0), l.c([Object(L.c)()], t.prototype, "_reflectionAmount", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionAmount", void 0), l.c([Object(L.c)()], t.prototype, "_reflectionReflectance0", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionReflectance0", void 0), l.c([Object(L.c)()], t.prototype, "_reflectionReflectance90", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionReflectance90", void 0), l.c([Object(L.c)()], t.prototype, "_useRGBColor", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useRGBColor", void 0), l.c([Object(L.c)()], t.prototype, "_enableNoise", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "enableNoise", void 0), l.c([Object(L.c)()], t.prototype, "_maxSimultaneousLights", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "maxSimultaneousLights", void 0), l.c([Object(L.i)()], t.prototype, "_imageProcessingConfiguration", void 0), t }(rr.a); s.a.RegisteredTypes["BABYLON.BackgroundMaterial"] = dr; var fr = i(80), pr = function() { function e(t, i) { var n = this; this._errorHandler = function(e, t) { n.onErrorObservable.notifyObservers({ message: e, exception: t }) }, this._options = l.a({}, e._getDefaultOptions(), t), this._scene = i, this.onErrorObservable = new r.c, this._setupBackground(), this._setupImageProcessing() } return e._getDefaultOptions = function() { return { createGround: !0, groundSize: 15, groundTexture: this._groundTextureCDNUrl, groundColor: new o.e(.2, .2, .3).toLinearSpace().scale(3), groundOpacity: .9, enableGroundShadow: !0, groundShadowLevel: .5, enableGroundMirror: !1, groundMirrorSizeRatio: .3, groundMirrorBlurKernel: 64, groundMirrorAmount: 1, groundMirrorFresnelWeight: 1, groundMirrorFallOffDistance: 0, groundMirrorTextureType: _.a.TEXTURETYPE_UNSIGNED_INT, groundYBias: 1e-5, createSkybox: !0, skyboxSize: 20, skyboxTexture: this._skyboxTextureCDNUrl, skyboxColor: new o.e(.2, .2, .3).toLinearSpace().scale(3), backgroundYRotation: 0, sizeAuto: !0, rootPosition: o.x.Zero(), setupImageProcessing: !0, environmentTexture: this._environmentTextureCDNUrl, cameraExposure: .8, cameraContrast: 1.2, toneMappingEnabled: !0 } }, Object.defineProperty(e.prototype, "rootMesh", { get: function() { return this._rootMesh }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "skybox", { get: function() { return this._skybox }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "skyboxTexture", { get: function() { return this._skyboxTexture }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "skyboxMaterial", { get: function() { return this._skyboxMaterial }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "ground", { get: function() { return this._ground }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "groundTexture", { get: function() { return this._groundTexture }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "groundMirror", { get: function() { return this._groundMirror }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "groundMirrorRenderList", { get: function() { return this._groundMirror ? this._groundMirror.renderList : null }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "groundMaterial", { get: function() { return this._groundMaterial }, enumerable: !0, configurable: !0 }), e.prototype.updateOptions = function(e) { var t = l.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 o.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 Kn.a) this._scene.environmentTexture = this._options.environmentTexture; else { var e = tr.CreateFromPrefilteredData(this._options.environmentTexture, this._scene); this._scene.environmentTexture = e } }, e.prototype._setupBackground = function() { this._rootMesh || (this._rootMesh = new fe.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._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 Et && this._scene.activeCamera.upperRadiusLimit && (i = t = 2 * this._scene.activeCamera.upperRadiusLimit); var s = o.length(); s > t && (i = t = 2 * s), t *= 1.1, i *= 1.5, (n = r.min.add(o.scale(.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 = fe.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 dr("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 = !1, this._groundMaterial.enableNoise = !0, this._ground && (this._ground.material = this._groundMaterial) }, e.prototype._setupGroundDiffuseTexture = function() { if (this._groundMaterial && !this._groundTexture) if (this._options.groundTexture instanceof Kn.a) this._groundMaterial.diffuseTexture = this._options.groundTexture; else { var e = new ke.a(this._options.groundTexture, this._scene, void 0, void 0, void 0, void 0, this._errorHandler); e.gammaSpace = !1, e.hasAlpha = !0, this._groundMaterial.diffuseTexture = e } }, e.prototype._setupGroundMirrorTexture = function(e) { var t = ke.a.CLAMP_ADDRESSMODE; if (!this._groundMirror && (this._groundMirror = new er("BackgroundPlaneMirrorTexture", { ratio: this._options.groundMirrorSizeRatio }, this._scene, !1, this._options.groundMirrorTextureType, ke.a.BILINEAR_SAMPLINGMODE, !0), this._groundMirror.mirrorPlane = new o.n(0, -1, 0, e.rootPosition.y), this._groundMirror.anisotropicFilteringLevel = 1, this._groundMirror.wrapU = t, this._groundMirror.wrapV = t, this._groundMirror.gammaSpace = !1, 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 o.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 = !0, 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 = fe.a.CreateBox("BackgroundSkybox", e.skyboxSize, this._scene, void 0, fe.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 dr("BackgroundSkyboxMaterial", this._scene)), this._skyboxMaterial.useRGBColor = !1, this._skyboxMaterial.primaryColor = this._options.skyboxColor, this._skyboxMaterial.enableNoise = !0, this._skybox.material = this._skyboxMaterial) }, e.prototype._setupSkyboxReflectionTexture = function() { this._skyboxMaterial && (this._skyboxTexture || (this._options.skyboxTexture instanceof Kn.a ? this._skyboxMaterial.reflectionTexture = this._options.skyboxTexture : (this._skyboxTexture = new tr(this._options.skyboxTexture, this._scene, void 0, void 0, void 0, void 0, this._errorHandler), this._skyboxTexture.coordinatesMode = ke.a.SKYBOX_MODE, this._skyboxTexture.gammaSpace = !1, this._skyboxMaterial.reflectionTexture = this._skyboxTexture))) }, e.prototype.dispose = function() { this._groundMaterial && this._groundMaterial.dispose(!0, !0), this._skyboxMaterial && this._skyboxMaterial.dispose(!0, !0), this._rootMesh.dispose(!1) }, 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 }(), _r = i(42), gr = function(e) { function t(t, i, n, s, a) { void 0 === a && (a = null); var c = e.call(this, t, s) || this; c._useDirectMapping = !1, c.onLoadErrorObservable = new r.c, t = t || "photoDome", n.resolution = 0 | Math.abs(n.resolution) || 32, n.size = Math.abs(n.size) || (s.activeCamera ? .48 * s.activeCamera.maxZ : 1e3), void 0 === n.useDirectMapping ? c._useDirectMapping = !0 : c._useDirectMapping = n.useDirectMapping, void 0 === n.faceForward && (n.faceForward = !0), c._setReady(!1); var l = c._material = new dr(t + "_material", s); if (c._mesh = fe.a.CreateSphere(t + "_mesh", n.resolution, n.size, s, !1, fe.a.BACKSIDE), l.opacityFresnel = !1, l.useEquirectangularFOV = !0, l.fovMultiplier = 1, c.photoTexture = new ke.a(i, s, !0, !c._useDirectMapping, void 0, void 0, function(e, t) { c.onLoadErrorObservable.notifyObservers(e || "Unknown error occured"), a && a(e, t) }), c.photoTexture.onLoadObservable.addOnce(function() { c._setReady(!0) }), c._mesh.material = l, c._mesh.parent = c, n.faceForward && s.activeCamera) { var u = s.activeCamera, h = o.x.Forward(), d = o.x.TransformNormal(h, u.getViewMatrix()); d.normalize(), c.rotation.y = Math.acos(o.x.Dot(h, d)) } return c } return l.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 = ke.a.CLAMP_ADDRESSMODE, this._photoTexture.wrapV = ke.a.CLAMP_ADDRESSMODE, this._material.diffuseTexture = this._photoTexture) : (this._photoTexture.coordinatesMode = ke.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE, this._photoTexture.wrapV = ke.a.CLAMP_ADDRESSMODE, this._material.reflectionTexture = this._photoTexture)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "fovMultiplier", { get: function() { return this._material.fovMultiplier }, set: function(e) { this._material.fovMultiplier = e }, enumerable: !0, configurable: !0 }), t.prototype.dispose = function(t, i) { void 0 === i && (i = !1), this._photoTexture.dispose(), this._mesh.dispose(), this._material.dispose(), this.onLoadErrorObservable.clear(), e.prototype.dispose.call(this, t, i) }, t }(_r.a), mr = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include\nvoid main(void)\n{\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\n}"; zt.a.ShadersStore.rgbdDecodePixelShader = mr; var vr = function() { function e() {} return e._ExpandDefaultBRDFTexture = function(e) { var t = e.getEngine(), i = t.getCaps(), n = !1; if (i.textureHalfFloatRender && i.textureHalfFloatLinearFiltering ? (n = !0, e.type = _.a.TEXTURETYPE_HALF_FLOAT) : i.textureFloatRender && i.textureFloatLinearFiltering && (n = !0, e.type = _.a.TEXTURETYPE_FLOAT), n) { e.isReady = !1; var r = new Ht("rgbdDecode", "rgbdDecode", null, null, 1, null, _.a.TEXTURE_TRILINEAR_SAMPLINGMODE, t, !1, void 0, e.type, void 0, null, !1); e._isRGBD = !1, e.invertY = !1; var o = t.createRenderTargetTexture(e.width, { generateDepthBuffer: !1, generateMipMaps: !1, generateStencilBuffer: !1, 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, !0), t.restoreDefaultFramebuffer(), t._releaseTexture(e), t._releaseFramebufferObjects(o), r && r.dispose(), o._swapAndDie(e), e.isReady = !0 }) } }, e.GetEnvironmentBRDFTexture = function(e) { var t = this; if (!e.environmentBRDFTexture) { var i = e.useDelayedTextureLoading; e.useDelayedTextureLoading = !1; var n = ke.a.CreateFromBase64String(this._environmentBRDFBase64Texture, "EnvironmentBRDFTexture", e, !0, !0, ke.a.BILINEAR_SAMPLINGMODE); n._texture._isRGBD = !0, n.wrapU = ke.a.CLAMP_ADDRESSMODE, n.wrapV = ke.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 }(), yr = function() { function e(t) { this._isEnabled = !1, this.isEnabled = !1, 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 = !1, this.isTintEnabled = !1, this.tintColor = o.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 && or.a.ClearCoatTextureEnabled && !this._texture.isReadyOrNotBlocking()) return !1; if (i.getCaps().standardDerivatives && this._bumpTexture && or.a.ClearCoatBumpTextureEnabled && !n && !this._bumpTexture.isReady()) return !1; if (this._isTintEnabled && this._tintTexture && or.a.ClearCoatTintTextureEnabled && !this._tintTexture.isReadyOrNotBlocking()) return !1 } return !0 }, e.prototype.prepareDefines = function(t, i) { this._isEnabled ? (t.CLEARCOAT = !0, t._areTexturesDirty && i.texturesEnabled && (this._texture && or.a.ClearCoatTextureEnabled ? ir.a.PrepareDefinesForMergedUV(this._texture, t, "CLEARCOAT_TEXTURE") : t.CLEARCOAT_TEXTURE = !1, this._bumpTexture && or.a.ClearCoatBumpTextureEnabled ? ir.a.PrepareDefinesForMergedUV(this._bumpTexture, t, "CLEARCOAT_BUMP") : t.CLEARCOAT_BUMP = !1, t.CLEARCOAT_DEFAULTIOR = this._indiceOfRefraction === e._DefaultIndiceOfRefraction, this._isTintEnabled ? (t.CLEARCOAT_TINT = !0, this._tintTexture && or.a.ClearCoatTintTextureEnabled ? ir.a.PrepareDefinesForMergedUV(this._tintTexture, t, "CLEARCOAT_TINT_TEXTURE") : t.CLEARCOAT_TINT_TEXTURE = !1) : (t.CLEARCOAT_TINT = !1, t.CLEARCOAT_TINT_TEXTURE = !1))) : (t.CLEARCOAT = !1, t.CLEARCOAT_TEXTURE = !1, t.CLEARCOAT_BUMP = !1, t.CLEARCOAT_TINT = !1, t.CLEARCOAT_TINT_TEXTURE = !1) }, e.prototype.bindForSubMesh = function(e, t, i, n, r, o, s) { if (!e.useUbo || !r || !e.isSync) { this._texture && or.a.ClearCoatTextureEnabled && (e.updateFloat2("vClearCoatInfos", this._texture.coordinatesIndex, this._texture.level), ir.a.BindTextureMatrix(this._texture, e, "clearCoat")), this._bumpTexture && i.getCaps().standardDerivatives && or.a.ClearCoatTextureEnabled && !n && (e.updateFloat2("vClearCoatBumpInfos", this._bumpTexture.coordinatesIndex, this._bumpTexture.level), ir.a.BindTextureMatrix(this._bumpTexture, e, "clearCoatBump"), t._mirroredCameraPosition ? e.updateFloat2("vClearCoatTangentSpaceParams", o ? 1 : -1, s ? 1 : -1) : e.updateFloat2("vClearCoatTangentSpaceParams", o ? -1 : 1, s ? -1 : 1)), this._tintTexture && or.a.ClearCoatTintTextureEnabled && (e.updateFloat2("vClearCoatTintInfos", this._tintTexture.coordinatesIndex, this._tintTexture.level), ir.a.BindTextureMatrix(this._tintTexture, e, "clearCoatTint")), e.updateFloat2("vClearCoatParams", this.intensity, this.roughness); var a = 1 - this._indiceOfRefraction, c = 1 + this._indiceOfRefraction, l = Math.pow(-a / c, 2), u = 1 / this._indiceOfRefraction; e.updateFloat4("vClearCoatRefractionParams", l, u, a, 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 && or.a.ClearCoatTextureEnabled && e.setTexture("clearCoatSampler", this._texture), this._bumpTexture && i.getCaps().standardDerivatives && or.a.ClearCoatBumpTextureEnabled && !n && e.setTexture("clearCoatBumpSampler", this._bumpTexture), this._isTintEnabled && this._tintTexture && or.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._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"), 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.addUniform("vClearCoatRefractionParams", 4), e.addUniform("vClearCoatInfos", 2), e.addUniform("clearCoatMatrix", 16), e.addUniform("vClearCoatBumpInfos", 2), e.addUniform("vClearCoatTangentSpaceParams", 2), e.addUniform("clearCoatBumpMatrix", 16), e.addUniform("vClearCoatTintParams", 4), e.addUniform("clearCoatColorAtDistance", 1), e.addUniform("vClearCoatTintInfos", 2), e.addUniform("clearCoatTintMatrix", 16) }, e.prototype.copyTo = function(e) { L.a.Clone(function() { return e }, this) }, e.prototype.serialize = function() { return L.a.Serialize(this) }, e.prototype.parse = function(e) { var t = this; L.a.Parse(function() { return t }, e, null) }, e._DefaultIndiceOfRefraction = 1.5, l.c([Object(L.c)()], e.prototype, "_isEnabled", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "isEnabled", void 0), l.c([Object(L.c)()], e.prototype, "intensity", void 0), l.c([Object(L.c)()], e.prototype, "roughness", void 0), l.c([Object(L.c)()], e.prototype, "_indiceOfRefraction", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "indiceOfRefraction", void 0), l.c([Object(L.m)()], e.prototype, "_texture", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "texture", void 0), l.c([Object(L.m)()], e.prototype, "_bumpTexture", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "bumpTexture", void 0), l.c([Object(L.c)()], e.prototype, "_isTintEnabled", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "isTintEnabled", void 0), l.c([Object(L.e)()], e.prototype, "tintColor", void 0), l.c([Object(L.c)()], e.prototype, "tintColorAtDistance", void 0), l.c([Object(L.c)()], e.prototype, "tintThickness", void 0), l.c([Object(L.m)()], e.prototype, "_tintTexture", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "tintTexture", void 0), e }(), br = function() { function e(e) { this._isEnabled = !1, this.isEnabled = !1, this.intensity = 1, this.direction = new o.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 && or.a.AnisotropicTextureEnabled && !this._texture.isReadyOrNotBlocking()) }, e.prototype.prepareDefines = function(e, t, i) { this._isEnabled ? (e.ANISOTROPIC = this._isEnabled, this._isEnabled && !t.isVerticesDataPresent(Oi.b.TangentKind) && (e._needUVs = !0, e.MAINUV1 = !0), e._areTexturesDirty && i.texturesEnabled && (this._texture && or.a.AnisotropicTextureEnabled ? ir.a.PrepareDefinesForMergedUV(this._texture, e, "ANISOTROPIC_TEXTURE") : e.ANISOTROPIC_TEXTURE = !1)) : (e.ANISOTROPIC = !1, e.ANISOTROPIC_TEXTURE = !1) }, e.prototype.bindForSubMesh = function(e, t, i) { e.useUbo && i && e.isSync || (this._texture && or.a.AnisotropicTextureEnabled && (e.updateFloat2("vAnisotropyInfos", this._texture.coordinatesIndex, this._texture.level), ir.a.BindTextureMatrix(this._texture, e, "anisotropy")), e.updateFloat3("vAnisotropy", this.direction.x, this.direction.y, this.intensity)), t.texturesEnabled && this._texture && or.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) { L.a.Clone(function() { return e }, this) }, e.prototype.serialize = function() { return L.a.Serialize(this) }, e.prototype.parse = function(e) { var t = this; L.a.Parse(function() { return t }, e, null) }, l.c([Object(L.c)()], e.prototype, "_isEnabled", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "isEnabled", void 0), l.c([Object(L.c)()], e.prototype, "intensity", void 0), l.c([Object(L.n)()], e.prototype, "direction", void 0), l.c([Object(L.m)()], e.prototype, "_texture", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "texture", void 0), e }(), Tr = 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) { L.a.Clone(function() { return e }, this) }, e.prototype.serialize = function() { return L.a.Serialize(this) }, e.prototype.parse = function(e) { var t = this; L.a.Parse(function() { return t }, e, null) }, e.DEFAULT_USE_ENERGY_CONSERVATION = !0, e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED = !0, e.DEFAULT_USE_SPHERICAL_HARMONICS = !0, l.c([Object(L.c)()], e.prototype, "_useEnergyConservation", void 0), l.c([Object(L.b)("_markAllSubMeshesAsMiscDirty")], e.prototype, "useEnergyConservation", void 0), l.c([Object(L.c)()], e.prototype, "_useSmithVisibilityHeightCorrelated", void 0), l.c([Object(L.b)("_markAllSubMeshesAsMiscDirty")], e.prototype, "useSmithVisibilityHeightCorrelated", void 0), l.c([Object(L.c)()], e.prototype, "_useSphericalHarmonics", void 0), l.c([Object(L.b)("_markAllSubMeshesAsMiscDirty")], e.prototype, "useSphericalHarmonics", void 0), e }(), Er = function() { function e(e) { this._isEnabled = !1, this.isEnabled = !1, this._linkSheenWithAlbedo = !1, this.linkSheenWithAlbedo = !1, this.intensity = 1, this.color = o.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 && or.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 && or.a.SheenTextureEnabled ? ir.a.PrepareDefinesForMergedUV(this._texture, e, "SHEEN_TEXTURE") : e.SHEEN_TEXTURE = !1)) : (e.SHEEN = !1, e.SHEEN_TEXTURE = !1, e.SHEEN_LINKWITHALBEDO = !1) }, e.prototype.bindForSubMesh = function(e, t, i) { e.useUbo && i && e.isSync || (this._texture && or.a.SheenTextureEnabled && (e.updateFloat2("vSheenInfos", this._texture.coordinatesIndex, this._texture.level), ir.a.BindTextureMatrix(this._texture, e, "sheen")), e.updateFloat4("vSheenColor", this.color.r, this.color.g, this.color.b, this.intensity)), t.texturesEnabled && this._texture && or.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) { L.a.Clone(function() { return e }, this) }, e.prototype.serialize = function() { return L.a.Serialize(this) }, e.prototype.parse = function(e) { var t = this; L.a.Parse(function() { return t }, e, null) }, l.c([Object(L.c)()], e.prototype, "_isEnabled", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "isEnabled", void 0), l.c([Object(L.c)()], e.prototype, "_linkSheenWithAlbedo", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "linkSheenWithAlbedo", void 0), l.c([Object(L.c)()], e.prototype, "intensity", void 0), l.c([Object(L.e)()], e.prototype, "color", void 0), l.c([Object(L.m)()], e.prototype, "_texture", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "texture", void 0), e }(), Ar = function() { function e(e) { this._isRefractionEnabled = !1, this.isRefractionEnabled = !1, this._isTranslucencyEnabled = !1, this.isTranslucencyEnabled = !1, this._isScatteringEnabled = !1, 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 = !1, this.invertRefractionY = !1, this._linkRefractionWithTransparency = !1, this.linkRefractionWithTransparency = !1, this.minimumThickness = 0, this.maximumThickness = 1, this.tintColor = o.e.White(), this.tintColorAtDistance = 1, this.diffusionDistance = o.e.White(), this._useMaskFromThicknessTexture = !1, this.useMaskFromThicknessTexture = !1, this._internalMarkAllSubMeshesAsTexturesDirty = e } return e.prototype._markAllSubMeshesAsTexturesDirty = function() { this._internalMarkAllSubMeshesAsTexturesDirty() }, e.prototype.isReadyForSubMesh = function(e, t) { if (e._areTexturesDirty && t.texturesEnabled) { if (this._thicknessTexture && or.a.ThicknessTextureEnabled && !this._thicknessTexture.isReadyOrNotBlocking()) return !1; var i = this._getRefractionTexture(t); if (i && or.a.RefractionTextureEnabled && !i.isReadyOrNotBlocking()) return !1 } return !0 }, e.prototype.prepareDefines = function(e, t) { if (e._areTexturesDirty && (e.SUBSURFACE = !1, e.SS_TRANSLUCENCY = this._isTranslucencyEnabled, e.SS_SCATERRING = this._isScatteringEnabled, e.SS_THICKNESSANDMASK_TEXTURE = !1, e.SS_MASK_FROM_THICKNESS_TEXTURE = !1, e.SS_REFRACTION = !1, e.SS_REFRACTIONMAP_3D = !1, e.SS_GAMMAREFRACTION = !1, e.SS_RGBDREFRACTION = !1, e.SS_REFRACTIONMAP_OPPOSITEZ = !1, e.SS_LODINREFRACTIONALPHA = !1, e.SS_LINKREFRACTIONTOTRANSPARENCY = !1, (this._isRefractionEnabled || this._isTranslucencyEnabled || this._isScatteringEnabled) && (e.SUBSURFACE = !0, e._areTexturesDirty && t.texturesEnabled && this._thicknessTexture && or.a.ThicknessTextureEnabled && ir.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 && or.a.RefractionTextureEnabled && (e.SS_REFRACTION = !0, 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 && or.a.ThicknessTextureEnabled && (e.updateFloat2("vThicknessInfos", this._thicknessTexture.coordinatesIndex, this._thicknessTexture.level), ir.a.BindTextureMatrix(this._thicknessTexture, e, "thickness")), e.updateFloat2("vThicknessParam", this.minimumThickness, this.maximumThickness - this.minimumThickness), o && or.a.RefractionTextureEnabled) { e.updateMatrix("refractionMatrix", o.getReflectionTextureMatrix()); var s = 1; o.isCube || o.depth && (s = o.depth), e.updateFloat4("vRefractionInfos", o.level, 1 / this._indexOfRefraction, s, 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 && or.a.ThicknessTextureEnabled && e.setTexture("thicknessSampler", this._thicknessTexture), o && or.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: !0, configurable: !0 }), e.prototype.fillRenderTargetTextures = function(e) { or.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 !!(or.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.addUniform("vRefractionInfos", 4), e.addUniform("refractionMatrix", 16), e.addUniform("vThicknessInfos", 2), e.addUniform("thicknessMatrix", 16), e.addUniform("vThicknessParam", 2), e.addUniform("vDiffusionDistance", 3), e.addUniform("vTintColor", 4), e.addUniform("vSubSurfaceIntensity", 3) }, e.prototype.copyTo = function(e) { L.a.Clone(function() { return e }, this) }, e.prototype.serialize = function() { return L.a.Serialize(this) }, e.prototype.parse = function(e) { var t = this; L.a.Parse(function() { return t }, e, null) }, l.c([Object(L.c)()], e.prototype, "_isRefractionEnabled", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "isRefractionEnabled", void 0), l.c([Object(L.c)()], e.prototype, "_isTranslucencyEnabled", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "isTranslucencyEnabled", void 0), l.c([Object(L.c)()], e.prototype, "_isScatteringEnabled", void 0), l.c([Object(L.c)()], e.prototype, "refractionIntensity", void 0), l.c([Object(L.c)()], e.prototype, "translucencyIntensity", void 0), l.c([Object(L.c)()], e.prototype, "scatteringIntensity", void 0), l.c([Object(L.m)()], e.prototype, "_thicknessTexture", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "thicknessTexture", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "refractionTexture", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "indexOfRefraction", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "invertRefractionY", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "linkRefractionWithTransparency", void 0), l.c([Object(L.c)()], e.prototype, "minimumThickness", void 0), l.c([Object(L.c)()], e.prototype, "maximumThickness", void 0), l.c([Object(L.e)()], e.prototype, "tintColor", void 0), l.c([Object(L.c)()], e.prototype, "tintColorAtDistance", void 0), l.c([Object(L.e)()], e.prototype, "diffusionDistance", void 0), l.c([Object(L.c)()], e.prototype, "_useMaskFromThicknessTexture", void 0), l.c([Object(L.b)("_markAllSubMeshesAsTexturesDirty")], e.prototype, "useMaskFromThicknessTexture", void 0), e }(), xr = "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"; zt.a.IncludesShadersStore.pbrFragmentDeclaration = xr; var Rr = "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};"; zt.a.IncludesShadersStore.pbrUboDeclaration = Rr; var Pr = "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"; zt.a.IncludesShadersStore.pbrFragmentExtraDeclaration = Pr; var Sr = "#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"; zt.a.IncludesShadersStore.pbrFragmentSamplersDeclaration = Sr; i(88); var Cr = "\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"; zt.a.IncludesShadersStore.pbrHelperFunctions = Cr; var Mr = "#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"; zt.a.IncludesShadersStore.harmonicsFunctions = Mr; var Or = "\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}"; zt.a.IncludesShadersStore.pbrDirectLightingSetupFunctions = Or; var Ir = "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}"; zt.a.IncludesShadersStore.pbrDirectLightingFalloffFunctions = Ir; var Dr = "\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"; zt.a.IncludesShadersStore.pbrBRDFFunctions = Dr; var Lr = "#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"; zt.a.IncludesShadersStore.pbrDirectLightingFunctions = Lr; var wr = "#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"; zt.a.IncludesShadersStore.pbrIBLFunctions = wr; i(121), i(122), i(123), i(115); var Fr = "#if DEBUGMODE>0\nif (vClipSpacePosition.x/vClipSpacePosition.w= 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 !0; t._materialDefines || (t._materialDefines = new Vr); var n = t._materialDefines; if (!this.checkReadyOnEveryCall && t.effect && n._renderId === this.getScene().getRenderId()) return !0; var r = this.getScene(), o = r.getEngine(); if (n._areTexturesDirty && r.texturesEnabled) { if (this._albedoTexture && or.a.DiffuseTextureEnabled && !this._albedoTexture.isReadyOrNotBlocking()) return !1; if (this._ambientTexture && or.a.AmbientTextureEnabled && !this._ambientTexture.isReadyOrNotBlocking()) return !1; if (this._opacityTexture && or.a.OpacityTextureEnabled && !this._opacityTexture.isReadyOrNotBlocking()) return !1; var s = this._getReflectionTexture(); if (s && or.a.ReflectionTextureEnabled && !s.isReadyOrNotBlocking()) return !1; if (this._lightmapTexture && or.a.LightmapTextureEnabled && !this._lightmapTexture.isReadyOrNotBlocking()) return !1; if (this._emissiveTexture && or.a.EmissiveTextureEnabled && !this._emissiveTexture.isReadyOrNotBlocking()) return !1; if (or.a.SpecularTextureEnabled) { if (this._metallicTexture) { if (!this._metallicTexture.isReadyOrNotBlocking()) return !1 } else if (this._reflectivityTexture && !this._reflectivityTexture.isReadyOrNotBlocking()) return !1; if (this._microSurfaceTexture && !this._microSurfaceTexture.isReadyOrNotBlocking()) return !1 } if (o.getCaps().standardDerivatives && this._bumpTexture && or.a.BumpTextureEnabled && !this._disableBumpMap && !this._bumpTexture.isReady()) return !1; if (this._environmentBRDFTexture && or.a.ReflectionTextureEnabled && !this._environmentBRDFTexture.isReady()) return !1 } 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 !1; if (n._areImageProcessingDirty && this._imageProcessingConfiguration && !this._imageProcessingConfiguration.isReady()) return !1; o.getCaps().standardDerivatives || e.isVerticesDataPresent(Oi.b.NormalKind) || (e.createNormals(!0), p.a.Warn("PBRMaterial: Normals have been created for the mesh: " + e.name)); var a = t.effect, c = this._prepareEffect(e, n, this.onCompiled, this.onError, i); return c && (this.allowShaderHotSwapping && a && !c.isReady() ? (c = a, n.markAsUnprocessed()) : (r.resetCachedMaterial(), t.setEffect(c, n), this.buildUniformLayout())), !(!t.effect || !t.effect.isReady()) && (n._renderId = r.getRenderId(), this._wasPreviouslyReady = !0, !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 s = this.getScene().getEngine(), a = new zt.c, c = 0; t.USESPHERICALINVERTEX && a.addFallback(c++, "USESPHERICALINVERTEX"), t.FOG && a.addFallback(c, "FOG"), t.SPECULARAA && a.addFallback(c, "SPECULARAA"), t.POINTSIZE && a.addFallback(c, "POINTSIZE"), t.LOGARITHMICDEPTH && a.addFallback(c, "LOGARITHMICDEPTH"), t.PARALLAX && a.addFallback(c, "PARALLAX"), t.PARALLAXOCCLUSION && a.addFallback(c++, "PARALLAXOCCLUSION"), c = br.AddFallbacks(t, a, c), c = br.AddFallbacks(t, a, c), c = Ar.AddFallbacks(t, a, c), c = Er.AddFallbacks(t, a, c), t.ENVIRONMENTBRDF && a.addFallback(c++, "ENVIRONMENTBRDF"), t.TANGENT && a.addFallback(c++, "TANGENT"), t.BUMP && a.addFallback(c++, "BUMP"), c = ir.a.HandleFallbacksForShadows(t, a, this._maxSimultaneousLights, c++), t.SPECULARTERM && a.addFallback(c++, "SPECULARTERM"), t.USESPHERICALFROMREFLECTIONMAP && a.addFallback(c++, "USESPHERICALFROMREFLECTIONMAP"), t.LIGHTMAP && a.addFallback(c++, "LIGHTMAP"), t.NORMAL && a.addFallback(c++, "NORMAL"), t.AMBIENT && a.addFallback(c++, "AMBIENT"), t.EMISSIVE && a.addFallback(c++, "EMISSIVE"), t.VERTEXCOLOR && a.addFallback(c++, "VERTEXCOLOR"), t.NUM_BONE_INFLUENCERS > 0 && a.addCPUSkinningFallback(c++, e), t.MORPHTARGETS && a.addFallback(c++, "MORPHTARGETS"), t.MULTIVIEW && a.addFallback(0, "MULTIVIEW"); var l = [Oi.b.PositionKind]; t.NORMAL && l.push(Oi.b.NormalKind), t.TANGENT && l.push(Oi.b.TangentKind), t.UV1 && l.push(Oi.b.UVKind), t.UV2 && l.push(Oi.b.UV2Kind), t.VERTEXCOLOR && l.push(Oi.b.ColorKind), ir.a.PrepareAttributesForBones(l, e, t, a), ir.a.PrepareAttributesForInstances(l, t), ir.a.PrepareAttributesForMorphTargets(l, e, t); var u = "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"], d = ["albedoSampler", "reflectivitySampler", "ambientSampler", "emissiveSampler", "bumpSampler", "lightmapSampler", "opacitySampler", "reflectionSampler", "reflectionSamplerLow", "reflectionSamplerHigh", "microSurfaceSampler", "environmentBrdfSampler", "boneSampler"], f = ["Material", "Scene"]; Ar.AddUniforms(h), Ar.AddSamplers(d), yr.AddUniforms(h), yr.AddSamplers(d), br.AddUniforms(h), br.AddSamplers(d), Er.AddUniforms(h), Er.AddSamplers(d), xi.a && (xi.a.PrepareUniforms(h, t), xi.a.PrepareSamplers(d, t)), ir.a.PrepareUniformsAndSamplersList({ uniformsNames: h, uniformBuffersNames: f, samplers: d, defines: t, maxSimultaneousLights: this._maxSimultaneousLights }), this.customShaderNameResolve && (u = this.customShaderNameResolve(u, h, f, d, t)); var p = t.toString(); return s.createEffect(u, { attributes: l, uniformsNames: h, uniformBuffersNames: f, samplers: d, defines: p, fallbacks: a, onCompiled: i, onError: n, indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: t.NUM_MORPH_INFLUENCERS } }, s) }, t.prototype._prepareDefines = function(e, i, n, r) { void 0 === n && (n = null), void 0 === r && (r = null); var o = this.getScene(), s = o.getEngine(); if (ir.a.PrepareDefinesForLights(o, e, i, !0, this._maxSimultaneousLights, this._disableLighting), i._needNormals = !0, ir.a.PrepareDefinesForMultiview(o, i), i.METALLICWORKFLOW = this.isMetallicWorkflow(), i._areTexturesDirty) { if (i._needUVs = !1, o.texturesEnabled) { o.getEngine().getCaps().textureLOD && (i.LODBASEDMICROSFURACE = !0), this._albedoTexture && or.a.DiffuseTextureEnabled ? ir.a.PrepareDefinesForMergedUV(this._albedoTexture, i, "ALBEDO") : i.ALBEDO = !1, this._ambientTexture && or.a.AmbientTextureEnabled ? (ir.a.PrepareDefinesForMergedUV(this._ambientTexture, i, "AMBIENT"), i.AMBIENTINGRAYSCALE = this._useAmbientInGrayScale) : i.AMBIENT = !1, this._opacityTexture && or.a.OpacityTextureEnabled ? (ir.a.PrepareDefinesForMergedUV(this._opacityTexture, i, "OPACITY"), i.OPACITYRGB = this._opacityTexture.getAlphaFromRGB) : i.OPACITY = !1; var a = this._getReflectionTexture(); if (a && or.a.ReflectionTextureEnabled) { switch (i.REFLECTION = !0, i.GAMMAREFLECTION = a.gammaSpace, i.RGBDREFLECTION = a.isRGBD, i.REFLECTIONMAP_OPPOSITEZ = this.getScene().useRightHandedSystem ? !a.invertZ : a.invertZ, i.LODINREFLECTIONALPHA = a.lodLevelInAlpha, a.coordinatesMode === ke.a.INVCUBIC_MODE && (i.INVERTCUBICMAP = !0), i.REFLECTIONMAP_3D = a.isCube, i.REFLECTIONMAP_CUBIC = !1, i.REFLECTIONMAP_EXPLICIT = !1, i.REFLECTIONMAP_PLANAR = !1, i.REFLECTIONMAP_PROJECTION = !1, i.REFLECTIONMAP_SKYBOX = !1, i.REFLECTIONMAP_SPHERICAL = !1, i.REFLECTIONMAP_EQUIRECTANGULAR = !1, i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = !1, i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = !1, i.REFLECTIONMAP_SKYBOX_TRANSFORMED = !1, a.coordinatesMode) { case ke.a.EXPLICIT_MODE: i.REFLECTIONMAP_EXPLICIT = !0; break; case ke.a.PLANAR_MODE: i.REFLECTIONMAP_PLANAR = !0; break; case ke.a.PROJECTION_MODE: i.REFLECTIONMAP_PROJECTION = !0; break; case ke.a.SKYBOX_MODE: i.REFLECTIONMAP_SKYBOX = !0; break; case ke.a.SPHERICAL_MODE: i.REFLECTIONMAP_SPHERICAL = !0; break; case ke.a.EQUIRECTANGULAR_MODE: i.REFLECTIONMAP_EQUIRECTANGULAR = !0; break; case ke.a.FIXED_EQUIRECTANGULAR_MODE: i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = !0; break; case ke.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE: i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = !0; break; case ke.a.CUBIC_MODE: case ke.a.INVCUBIC_MODE: default: i.REFLECTIONMAP_CUBIC = !0, i.USE_LOCAL_REFLECTIONMAP_CUBIC = !!a.boundingBoxSize } a.coordinatesMode !== ke.a.SKYBOX_MODE ? a.sphericalPolynomial && (i.USESPHERICALFROMREFLECTIONMAP = !0, this._forceIrradianceInFragment || o.getEngine().getCaps().maxVaryingVectors <= 8 ? i.USESPHERICALINVERTEX = !1 : i.USESPHERICALINVERTEX = !0) : i.REFLECTIONMAP_SKYBOX_TRANSFORMED = !a.getReflectionTextureMatrix().isIdentity() } else i.REFLECTION = !1, i.REFLECTIONMAP_3D = !1, i.REFLECTIONMAP_SPHERICAL = !1, i.REFLECTIONMAP_PLANAR = !1, i.REFLECTIONMAP_CUBIC = !1, i.USE_LOCAL_REFLECTIONMAP_CUBIC = !1, i.REFLECTIONMAP_PROJECTION = !1, i.REFLECTIONMAP_SKYBOX = !1, i.REFLECTIONMAP_SKYBOX_TRANSFORMED = !1, i.REFLECTIONMAP_EXPLICIT = !1, i.REFLECTIONMAP_EQUIRECTANGULAR = !1, i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = !1, i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = !1, i.INVERTCUBICMAP = !1, i.USESPHERICALFROMREFLECTIONMAP = !1, i.USESPHERICALINVERTEX = !1, i.REFLECTIONMAP_OPPOSITEZ = !1, i.LODINREFLECTIONALPHA = !1, i.GAMMAREFLECTION = !1, i.RGBDREFLECTION = !1; this._lightmapTexture && or.a.LightmapTextureEnabled ? (ir.a.PrepareDefinesForMergedUV(this._lightmapTexture, i, "LIGHTMAP"), i.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap, i.GAMMALIGHTMAP = this._lightmapTexture.gammaSpace) : i.LIGHTMAP = !1, this._emissiveTexture && or.a.EmissiveTextureEnabled ? ir.a.PrepareDefinesForMergedUV(this._emissiveTexture, i, "EMISSIVE") : i.EMISSIVE = !1, or.a.SpecularTextureEnabled ? (this._metallicTexture ? (ir.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 ? (ir.a.PrepareDefinesForMergedUV(this._reflectivityTexture, i, "REFLECTIVITY"), i.MICROSURFACEFROMREFLECTIVITYMAP = this._useMicroSurfaceFromReflectivityMapAlpha, i.MICROSURFACEAUTOMATIC = this._useAutoMicroSurfaceFromReflectivityMap) : i.REFLECTIVITY = !1, this._microSurfaceTexture ? ir.a.PrepareDefinesForMergedUV(this._microSurfaceTexture, i, "MICROSURFACEMAP") : i.MICROSURFACEMAP = !1) : (i.REFLECTIVITY = !1, i.MICROSURFACEMAP = !1), o.getEngine().getCaps().standardDerivatives && this._bumpTexture && or.a.BumpTextureEnabled && !this._disableBumpMap ? (ir.a.PrepareDefinesForMergedUV(this._bumpTexture, i, "BUMP"), this._useParallax && this._albedoTexture && or.a.DiffuseTextureEnabled ? (i.PARALLAX = !0, i.PARALLAXOCCLUSION = !!this._useParallaxOcclusion) : i.PARALLAX = !1, i.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap) : i.BUMP = !1, this._environmentBRDFTexture && or.a.ReflectionTextureEnabled ? (i.ENVIRONMENTBRDF = !0, i.ENVIRONMENTBRDF_RGBD = this._environmentBRDFTexture.isRGBD) : (i.ENVIRONMENTBRDF = !1, i.ENVIRONMENTBRDF_RGBD = !1), this._shouldUseAlphaFromAlbedoTexture() ? i.ALPHAFROMALBEDO = !0 : i.ALPHAFROMALBEDO = !1 } i.SPECULAROVERALPHA = this._useSpecularOverAlpha, this._lightFalloff === t.LIGHTFALLOFF_STANDARD ? (i.USEPHYSICALLIGHTFALLOFF = !1, i.USEGLTFLIGHTFALLOFF = !1) : this._lightFalloff === t.LIGHTFALLOFF_GLTF ? (i.USEPHYSICALLIGHTFALLOFF = !1, i.USEGLTFLIGHTFALLOFF = !0) : (i.USEPHYSICALLIGHTFALLOFF = !0, i.USEGLTFLIGHTFALLOFF = !1), i.RADIANCEOVERALPHA = this._useRadianceOverAlpha, !this.backFaceCulling && this._twoSidedLighting ? i.TWOSIDEDLIGHTING = !0 : i.TWOSIDEDLIGHTING = !1, 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 && (ir.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(Oi.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), ir.a.PrepareDefinesForFrameBoundValues(o, s, i, !!n, r), ir.a.PrepareDefinesForAttributes(e, i, !0, !0, !0, this._transparencyMode !== t.PBRMATERIAL_OPAQUE) }, t.prototype.forceCompilation = function(e, t, i) { var n = this, r = l.a({ clipPlane: !1 }, i), o = new Vr, s = this._prepareEffect(e, o, void 0, void 0, void 0, r.clipPlane); s.isReady() ? t && t(this) : s.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), e.addUniform("vLightmapInfos", 2), e.addUniform("vReflectivityInfos", 3), e.addUniform("vMicroSurfaceSamplerInfos", 2), e.addUniform("vReflectionInfos", 2), e.addUniform("vReflectionPosition", 3), e.addUniform("vReflectionSize", 3), e.addUniform("vBumpInfos", 3), e.addUniform("albedoMatrix", 16), e.addUniform("ambientMatrix", 16), e.addUniform("opacityMatrix", 16), e.addUniform("emissiveMatrix", 16), e.addUniform("lightmapMatrix", 16), e.addUniform("reflectivityMatrix", 16), e.addUniform("microSurfaceSamplerMatrix", 16), e.addUniform("bumpMatrix", 16), e.addUniform("vTangentSpaceParams", 2), e.addUniform("reflectionMatrix", 16), e.addUniform("vReflectionColor", 3), e.addUniform("vAlbedoColor", 4), e.addUniform("vLightingIntensity", 4), e.addUniform("vReflectionMicrosurfaceInfos", 3), e.addUniform("pointSize", 1), e.addUniform("vReflectivityColor", 4), e.addUniform("vEmissiveColor", 3), e.addUniform("visibility", 1), yr.PrepareUniformBuffer(e), br.PrepareUniformBuffer(e), Er.PrepareUniformBuffer(e), Ar.PrepareUniformBuffer(e), e.create() }, t.prototype.unbind = function() { if (this._activeEffect) { var t = !1; this._reflectionTexture && this._reflectionTexture.isRenderTarget && (this._activeEffect.setTexture("reflection2DSampler", null), t = !0), this.subSurface.unbind(this._activeEffect) && (t = !0), t && this._markAllSubMeshesAsTexturesDirty() } e.prototype.unbind.call(this) }, t.prototype.bindForSubMesh = function(e, i, n) { var r = this.getScene(), s = n._materialDefines; if (s) { var a = n.effect; if (a) { this._activeEffect = a, s.INSTANCES || this.bindOnlyWorldMatrix(e), s.OBJECTSPACE_NORMALMAP && (e.toNormalMatrix(this._normalMatrix), this.bindOnlyNormalMatrix(this._normalMatrix)); var c = this._mustRebind(r, a, i.visibility); ir.a.BindBonesParameters(i, this._activeEffect); var l = null, u = this._uniformBuffer; if (c) { var h = r.getEngine(); if (u.bindToEffect(a, "Material"), this.bindViewProjection(a), l = this._getReflectionTexture(), !u.useUbo || !this.isFrozen || !u.isSync) { if (r.texturesEnabled) { if (this._albedoTexture && or.a.DiffuseTextureEnabled && (u.updateFloat2("vAlbedoInfos", this._albedoTexture.coordinatesIndex, this._albedoTexture.level), ir.a.BindTextureMatrix(this._albedoTexture, u, "albedo")), this._ambientTexture && or.a.AmbientTextureEnabled && (u.updateFloat4("vAmbientInfos", this._ambientTexture.coordinatesIndex, this._ambientTexture.level, this._ambientTextureStrength, this._ambientTextureImpactOnAnalyticalLights), ir.a.BindTextureMatrix(this._ambientTexture, u, "ambient")), this._opacityTexture && or.a.OpacityTextureEnabled && (u.updateFloat2("vOpacityInfos", this._opacityTexture.coordinatesIndex, this._opacityTexture.level), ir.a.BindTextureMatrix(this._opacityTexture, u, "opacity")), l && or.a.ReflectionTextureEnabled) { if (u.updateMatrix("reflectionMatrix", l.getReflectionTextureMatrix()), u.updateFloat2("vReflectionInfos", l.level, 0), l.boundingBoxSize) { var d = l; u.updateVector3("vReflectionPosition", d.boundingBoxPosition), u.updateVector3("vReflectionSize", d.boundingBoxSize) } var f = l.sphericalPolynomial; if (s.USESPHERICALFROMREFLECTIONMAP && f) if (s.SPHERICAL_HARMONICS) { var p = f.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", f.x.x, f.x.y, f.x.z), this._activeEffect.setFloat3("vSphericalY", f.y.x, f.y.y, f.y.z), this._activeEffect.setFloat3("vSphericalZ", f.z.x, f.z.y, f.z.z), this._activeEffect.setFloat3("vSphericalXX_ZZ", f.xx.x - f.zz.x, f.xx.y - f.zz.y, f.xx.z - f.zz.z), this._activeEffect.setFloat3("vSphericalYY_ZZ", f.yy.x - f.zz.x, f.yy.y - f.zz.y, f.yy.z - f.zz.z), this._activeEffect.setFloat3("vSphericalZZ", f.zz.x, f.zz.y, f.zz.z), this._activeEffect.setFloat3("vSphericalXY", f.xy.x, f.xy.y, f.xy.z), this._activeEffect.setFloat3("vSphericalYZ", f.yz.x, f.yz.y, f.yz.z), this._activeEffect.setFloat3("vSphericalZX", f.zx.x, f.zx.y, f.zx.z); u.updateFloat3("vReflectionMicrosurfaceInfos", l.getSize().width, l.lodGenerationScale, l.lodGenerationOffset) } this._emissiveTexture && or.a.EmissiveTextureEnabled && (u.updateFloat2("vEmissiveInfos", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level), ir.a.BindTextureMatrix(this._emissiveTexture, u, "emissive")), this._lightmapTexture && or.a.LightmapTextureEnabled && (u.updateFloat2("vLightmapInfos", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level), ir.a.BindTextureMatrix(this._lightmapTexture, u, "lightmap")), or.a.SpecularTextureEnabled && (this._metallicTexture ? (u.updateFloat3("vReflectivityInfos", this._metallicTexture.coordinatesIndex, this._metallicTexture.level, this._ambientTextureStrength), ir.a.BindTextureMatrix(this._metallicTexture, u, "reflectivity")) : this._reflectivityTexture && (u.updateFloat3("vReflectivityInfos", this._reflectivityTexture.coordinatesIndex, this._reflectivityTexture.level, 1), ir.a.BindTextureMatrix(this._reflectivityTexture, u, "reflectivity")), this._microSurfaceTexture && (u.updateFloat2("vMicroSurfaceSamplerInfos", this._microSurfaceTexture.coordinatesIndex, this._microSurfaceTexture.level), ir.a.BindTextureMatrix(this._microSurfaceTexture, u, "microSurfaceSampler"))), this._bumpTexture && h.getCaps().standardDerivatives && or.a.BumpTextureEnabled && !this._disableBumpMap && (u.updateFloat3("vBumpInfos", this._bumpTexture.coordinatesIndex, this._bumpTexture.level, this._parallaxScaleBias), ir.a.BindTextureMatrix(this._bumpTexture, u, "bump"), r._mirroredCameraPosition ? u.updateFloat2("vTangentSpaceParams", this._invertNormalMapX ? 1 : -1, this._invertNormalMapY ? 1 : -1) : u.updateFloat2("vTangentSpaceParams", this._invertNormalMapX ? -1 : 1, this._invertNormalMapY ? -1 : 1)) } this.pointsCloud && u.updateFloat("pointSize", this.pointSize), s.METALLICWORKFLOW ? (o.t.Color3[0].r = void 0 === this._metallic || null === this._metallic ? 1 : this._metallic, o.t.Color3[0].g = void 0 === this._roughness || null === this._roughness ? 1 : this._roughness, u.updateColor4("vReflectivityColor", o.t.Color3[0], 0)) : u.updateColor4("vReflectivityColor", this._reflectivityColor, this._microSurface), u.updateColor3("vEmissiveColor", or.a.EmissiveTextureEnabled ? this._emissiveColor : o.e.BlackReadOnly), u.updateColor3("vReflectionColor", this._reflectionColor), u.updateColor4("vAlbedoColor", this._albedoColor, this.alpha), u.updateFloat("visibility", i.visibility), this._lightingInfos.x = this._directIntensity, this._lightingInfos.y = this._emissiveIntensity, this._lightingInfos.z = this._environmentIntensity, this._lightingInfos.w = this._specularIntensity, u.updateVector4("vLightingIntensity", this._lightingInfos) } r.texturesEnabled && (this._albedoTexture && or.a.DiffuseTextureEnabled && u.setTexture("albedoSampler", this._albedoTexture), this._ambientTexture && or.a.AmbientTextureEnabled && u.setTexture("ambientSampler", this._ambientTexture), this._opacityTexture && or.a.OpacityTextureEnabled && u.setTexture("opacitySampler", this._opacityTexture), l && or.a.ReflectionTextureEnabled && (s.LODBASEDMICROSFURACE ? u.setTexture("reflectionSampler", l) : (u.setTexture("reflectionSampler", l._lodTextureMid || l), u.setTexture("reflectionSamplerLow", l._lodTextureLow || l), u.setTexture("reflectionSamplerHigh", l._lodTextureHigh || l))), s.ENVIRONMENTBRDF && u.setTexture("environmentBrdfSampler", this._environmentBRDFTexture), this._emissiveTexture && or.a.EmissiveTextureEnabled && u.setTexture("emissiveSampler", this._emissiveTexture), this._lightmapTexture && or.a.LightmapTextureEnabled && u.setTexture("lightmapSampler", this._lightmapTexture), or.a.SpecularTextureEnabled && (this._metallicTexture ? u.setTexture("reflectivitySampler", this._metallicTexture) : this._reflectivityTexture && u.setTexture("reflectivitySampler", this._reflectivityTexture), this._microSurfaceTexture && u.setTexture("microSurfaceSampler", this._microSurfaceTexture)), this._bumpTexture && h.getCaps().standardDerivatives && or.a.BumpTextureEnabled && !this._disableBumpMap && u.setTexture("bumpSampler", this._bumpTexture)), this.subSurface.bindForSubMesh(u, r, h, this.isFrozen, s.LODBASEDMICROSFURACE), this.clearCoat.bindForSubMesh(u, r, h, this._disableBumpMap, this.isFrozen, this._invertNormalMapX, this._invertNormalMapY), this.anisotropy.bindForSubMesh(u, r, this.isFrozen), this.sheen.bindForSubMesh(u, r, this.isFrozen), ir.a.BindClipPlane(this._activeEffect, r), r.ambientColor.multiplyToRef(this._ambientColor, this._globalAmbientColor); var _ = r._forcedViewPosition ? r._forcedViewPosition : r._mirroredCameraPosition ? r._mirroredCameraPosition : r.activeCamera.globalPosition, g = r.useRightHandedSystem === (null != r._mirroredCameraPosition); a.setFloat4("vEyePosition", _.x, _.y, _.z, g ? -1 : 1), a.setColor3("vAmbientColor", this._globalAmbientColor), a.setFloat2("vDebugMode", this.debugLimit, this.debugFactor) }!c && this.isFrozen || (r.lightsEnabled && !this._disableLighting && ir.a.BindLights(r, i, this._activeEffect, s, this._maxSimultaneousLights, this._lightFalloff !== t.LIGHTFALLOFF_STANDARD), (r.fogEnabled && i.applyFog && r.fogMode !== W.a.FOGMODE_NONE || l) && this.bindView(a), ir.a.BindFogParameters(r, i, this._activeEffect, !0), s.NUM_MORPH_INFLUENCERS && ir.a.BindMorphTargetParameters(i, this._activeEffect), this._imageProcessingConfiguration.bind(this._activeEffect), ir.a.BindLogDepth(s, this._activeEffect, r)), u.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), 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), this._ambientTexture && t.push(this._ambientTexture), this._opacityTexture && t.push(this._opacityTexture), this._reflectionTexture && t.push(this._reflectionTexture), this._emissiveTexture && t.push(this._emissiveTexture), this._reflectivityTexture && t.push(this._reflectivityTexture), this._metallicTexture && t.push(this._metallicTexture), this._microSurfaceTexture && t.push(this._microSurfaceTexture), this._bumpTexture && t.push(this._bumpTexture), this._lightmapTexture && t.push(this._lightmapTexture), this.subSurface.getActiveTextures(t), this.clearCoat.getActiveTextures(t), 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(), 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._bumpTexture && this._bumpTexture.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, l.c([Object(L.i)()], t.prototype, "_imageProcessingConfiguration", void 0), l.c([Object(L.b)("_markAllSubMeshesAsMiscDirty")], t.prototype, "debugMode", void 0), l.c([Object(L.c)()], t.prototype, "useLogarithmicDepth", null), l.c([Object(L.c)()], t.prototype, "transparencyMode", null), t }(rr.a), kr = 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 = !1, r.ambientTextureStrength = 1, r.ambientTextureImpactOnAnalyticalLights = t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS, r.ambientColor = new o.e(0, 0, 0), r.albedoColor = new o.e(1, 1, 1), r.reflectivityColor = new o.e(1, 1, 1), r.reflectionColor = new o.e(1, 1, 1), r.emissiveColor = new o.e(0, 0, 0), r.microSurface = 1, r.useLightmapAsShadowmap = !1, r.useAlphaFromAlbedoTexture = !1, r.forceAlphaTest = !1, r.alphaCutOff = .4, r.useSpecularOverAlpha = !0, r.useMicroSurfaceFromReflectivityMapAlpha = !1, r.useRoughnessFromMetallicTextureAlpha = !0, r.useRoughnessFromMetallicTextureGreen = !1, r.useMetallnessFromMetallicTextureBlue = !1, r.useAmbientOcclusionFromMetallicTextureRed = !1, r.useAmbientInGrayScale = !1, r.useAutoMicroSurfaceFromReflectivityMap = !1, r.useRadianceOverAlpha = !0, r.useObjectSpaceNormalMap = !1, r.useParallax = !1, r.useParallaxOcclusion = !1, r.parallaxScaleBias = .05, r.disableLighting = !1, r.forceIrradianceInFragment = !1, r.maxSimultaneousLights = 4, r.invertNormalMapX = !1, r.invertNormalMapY = !1, r.twoSidedLighting = !1, r.useAlphaFresnel = !1, r.useLinearAlphaFresnel = !1, r.environmentBRDFTexture = null, r.forceNormalForward = !1, r.enableSpecularAntiAliasing = !1, r.useHorizonOcclusion = !0, r.useRadianceOcclusion = !0, r.unlit = !1, r._environmentBRDFTexture = vr.GetEnvironmentBRDFTexture(n), r } return l.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 = !0 : this.subSurface.linkRefractionWithTransparency || (this.subSurface.isRefractionEnabled = !1) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "indexOfRefraction", { get: function() { return 1 / this.subSurface.indexOfRefraction }, set: function(e) { this.subSurface.indexOfRefraction = 1 / e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "invertRefractionY", { get: function() { return this.subSurface.invertRefractionY }, set: function(e) { this.subSurface.invertRefractionY = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "linkRefractionWithTransparency", { get: function() { return this.subSurface.linkRefractionWithTransparency }, set: function(e) { this.subSurface.linkRefractionWithTransparency = e, e && (this.subSurface.isRefractionEnabled = !0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "usePhysicalLightFalloff", { get: function() { return this._lightFalloff === Gr.LIGHTFALLOFF_PHYSICAL }, set: function(e) { e !== this.usePhysicalLightFalloff && (this._markAllSubMeshesAsTexturesDirty(), this._lightFalloff = e ? Gr.LIGHTFALLOFF_PHYSICAL : Gr.LIGHTFALLOFF_STANDARD) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "useGLTFLightFalloff", { get: function() { return this._lightFalloff === Gr.LIGHTFALLOFF_GLTF }, set: function(e) { e !== this.useGLTFLightFalloff && (this._markAllSubMeshesAsTexturesDirty(), this._lightFalloff = e ? Gr.LIGHTFALLOFF_GLTF : Gr.LIGHTFALLOFF_STANDARD) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "imageProcessingConfiguration", { get: function() { return this._imageProcessingConfiguration }, set: function(e) { this._attachImageProcessingConfiguration(e), this._markAllSubMeshesAsTexturesDirty() }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorCurvesEnabled", { get: function() { return this.imageProcessingConfiguration.colorCurvesEnabled }, set: function(e) { this.imageProcessingConfiguration.colorCurvesEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorGradingEnabled", { get: function() { return this.imageProcessingConfiguration.colorGradingEnabled }, set: function(e) { this.imageProcessingConfiguration.colorGradingEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraToneMappingEnabled", { get: function() { return this._imageProcessingConfiguration.toneMappingEnabled }, set: function(e) { this._imageProcessingConfiguration.toneMappingEnabled = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraExposure", { get: function() { return this._imageProcessingConfiguration.exposure }, set: function(e) { this._imageProcessingConfiguration.exposure = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraContrast", { get: function() { return this._imageProcessingConfiguration.contrast }, set: function(e) { this._imageProcessingConfiguration.contrast = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorGradingTexture", { get: function() { return this._imageProcessingConfiguration.colorGradingTexture }, set: function(e) { this._imageProcessingConfiguration.colorGradingTexture = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "cameraColorCurves", { get: function() { return this._imageProcessingConfiguration.colorCurves }, set: function(e) { this._imageProcessingConfiguration.colorCurves = e }, enumerable: !0, configurable: !0 }), t.prototype.getClassName = function() { return "PBRMaterial" }, t.prototype.clone = function(e) { var i = this, n = L.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 = L.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 = L.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 = Gr.PBRMATERIAL_OPAQUE, t.PBRMATERIAL_ALPHATEST = Gr.PBRMATERIAL_ALPHATEST, t.PBRMATERIAL_ALPHABLEND = Gr.PBRMATERIAL_ALPHABLEND, t.PBRMATERIAL_ALPHATESTANDBLEND = Gr.PBRMATERIAL_ALPHATESTANDBLEND, t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = Gr.DEFAULT_AO_ON_ANALYTICAL_LIGHTS, l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "directIntensity", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "emissiveIntensity", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "environmentIntensity", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "specularIntensity", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "disableBumpMap", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "albedoTexture", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "ambientTexture", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "ambientTextureStrength", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "ambientTextureImpactOnAnalyticalLights", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], t.prototype, "opacityTexture", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionTexture", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "emissiveTexture", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectivityTexture", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "metallicTexture", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "metallic", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "roughness", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "microSurfaceTexture", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "bumpTexture", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty", null)], t.prototype, "lightmapTexture", void 0), l.c([Object(L.e)("ambient"), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "ambientColor", void 0), l.c([Object(L.e)("albedo"), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "albedoColor", void 0), l.c([Object(L.e)("reflectivity"), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectivityColor", void 0), l.c([Object(L.e)("reflection"), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "reflectionColor", void 0), l.c([Object(L.e)("emissive"), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "emissiveColor", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "microSurface", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useLightmapAsShadowmap", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], t.prototype, "useAlphaFromAlbedoTexture", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], t.prototype, "forceAlphaTest", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesAndMiscDirty")], t.prototype, "alphaCutOff", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useSpecularOverAlpha", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useMicroSurfaceFromReflectivityMapAlpha", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useRoughnessFromMetallicTextureAlpha", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useRoughnessFromMetallicTextureGreen", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useMetallnessFromMetallicTextureBlue", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useAmbientOcclusionFromMetallicTextureRed", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useAmbientInGrayScale", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useAutoMicroSurfaceFromReflectivityMap", void 0), l.c([Object(L.c)()], t.prototype, "usePhysicalLightFalloff", null), l.c([Object(L.c)()], t.prototype, "useGLTFLightFalloff", null), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useRadianceOverAlpha", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useObjectSpaceNormalMap", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useParallax", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useParallaxOcclusion", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "parallaxScaleBias", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "disableLighting", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "forceIrradianceInFragment", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "maxSimultaneousLights", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "invertNormalMapX", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "invertNormalMapY", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "twoSidedLighting", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useAlphaFresnel", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useLinearAlphaFresnel", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "environmentBRDFTexture", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "forceNormalForward", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "enableSpecularAntiAliasing", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useHorizonOcclusion", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useRadianceOcclusion", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsMiscDirty")], t.prototype, "unlit", void 0), t }(Gr); s.a.RegisteredTypes["BABYLON.PBRMaterial"] = kr; var zr = i(62), jr = i(71); function Hr(e) { return e.charCodeAt(0) + (e.charCodeAt(1) << 8) + (e.charCodeAt(2) << 16) + (e.charCodeAt(3) << 24) } var Wr = Hr("DXT1"), Xr = Hr("DXT3"), Yr = Hr("DXT5"), Kr = Hr("DX10"), Qr = 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 === Kr ? i[32] : 0, s = _.a.TEXTURETYPE_UNSIGNED_INT; switch (r) { case 113: s = _.a.TEXTURETYPE_HALF_FLOAT; break; case 116: s = _.a.TEXTURETYPE_FLOAT; break; case Kr: if (10 === o) { s = _.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 === Wr || r === Xr || r === Yr, dxgiFormat: o, textureType: s } }, 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, s) { for (var a = new Float32Array(r), c = new Uint16Array(o, n), l = 0, u = 0; u < i; u++) for (var h = 0; h < t; h++) { var d = 4 * (h + u * t); a[l] = e._FromHalfFloat(c[d]), a[l + 1] = e._FromHalfFloat(c[d + 1]), a[l + 2] = e._FromHalfFloat(c[d + 2]), e.StoreLODInAlphaChannel ? a[l + 3] = s : a[l + 3] = e._FromHalfFloat(c[d + 3]), l += 4 } return a }, e._GetHalfFloatRGBAArrayBuffer = function(t, i, n, r, o, s) { if (e.StoreLODInAlphaChannel) { for (var a = new Uint16Array(r), c = new Uint16Array(o, n), l = 0, u = 0; u < i; u++) for (var h = 0; h < t; h++) { var d = 4 * (h + u * t); a[l] = c[d], a[l + 1] = c[d + 1], a[l + 2] = c[d + 2], a[l + 3] = e._ToHalfFloat(s), l += 4 } return a } return new Uint16Array(o, n, r) }, e._GetFloatRGBAArrayBuffer = function(t, i, n, r, o, s) { if (e.StoreLODInAlphaChannel) { for (var a = new Float32Array(r), c = new Float32Array(o, n), l = 0, u = 0; u < i; u++) for (var h = 0; h < t; h++) { var d = 4 * (h + u * t); a[l] = c[d], a[l + 1] = c[d + 1], a[l + 2] = c[d + 2], a[l + 3] = s, l += 4 } return a } return new Float32Array(o, n, r) }, e._GetFloatAsUIntRGBAArrayBuffer = function(t, i, n, r, o, s) { for (var a = new Uint8Array(r), c = new Float32Array(o, n), l = 0, u = 0; u < i; u++) for (var h = 0; h < t; h++) { var d = 4 * (h + u * t); a[l] = 255 * D.a.Clamp(c[d]), a[l + 1] = 255 * D.a.Clamp(c[d + 1]), a[l + 2] = 255 * D.a.Clamp(c[d + 2]), e.StoreLODInAlphaChannel ? a[l + 3] = s : a[l + 3] = 255 * D.a.Clamp(c[d + 3]), l += 4 } return a }, e._GetHalfFloatAsUIntRGBAArrayBuffer = function(t, i, n, r, o, s) { for (var a = new Uint8Array(r), c = new Uint16Array(o, n), l = 0, u = 0; u < i; u++) for (var h = 0; h < t; h++) { var d = 4 * (h + u * t); a[l] = 255 * D.a.Clamp(e._FromHalfFloat(c[d])), a[l + 1] = 255 * D.a.Clamp(e._FromHalfFloat(c[d + 1])), a[l + 2] = 255 * D.a.Clamp(e._FromHalfFloat(c[d + 2])), e.StoreLODInAlphaChannel ? a[l + 3] = s : a[l + 3] = 255 * D.a.Clamp(e._FromHalfFloat(c[d + 3])), l += 4 } return a }, e._GetRGBAArrayBuffer = function(e, t, i, n, r, o, s, a, c) { for (var l = new Uint8Array(n), u = new Uint8Array(r, i), h = 0, d = 0; d < t; d++) for (var f = 0; f < e; f++) { var p = 4 * (f + d * e); l[h] = u[p + o], l[h + 1] = u[p + s], l[h + 2] = u[p + a], l[h + 3] = u[p + c], h += 4 } return l }, 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, s, a) { for (var c = new Uint8Array(n), l = new Uint8Array(r, i), u = 0, h = 0; h < t; h++) for (var d = 0; d < e; d++) { var f = 3 * (d + h * e); c[u] = l[f + o], c[u + 1] = l[f + s], c[u + 2] = l[f + a], u += 3 } return c }, e._GetLuminanceArrayBuffer = function(e, t, i, n, r) { for (var o = new Uint8Array(n), s = new Uint8Array(r, i), a = 0, c = 0; c < t; c++) for (var l = 0; l < e; l++) { var u = l + c * e; o[a] = s[u], a++ } return o }, e.UploadDDSLevels = function(t, i, n, r, o, s, a, c) { void 0 === a && (a = -1); var l = null; r.sphericalPolynomial && (l = new Array); var u, h, d, f, g, m, v, y = t.getCaps().s3tc, b = new Int32Array(n, 0, 31), T = 0, E = 0, A = 1; if (542327876 === b[0]) if (r.isFourCC || r.isRGB || r.isLuminance) if (!r.isCompressed || y) { var x = b[22]; f = b[1] + 4; var R, P = !1; if (r.isFourCC) switch (u = b[21]) { case Wr: A = 8, E = y.COMPRESSED_RGBA_S3TC_DXT1_EXT; break; case Xr: A = 16, E = y.COMPRESSED_RGBA_S3TC_DXT3_EXT; break; case Yr: A = 16, E = y.COMPRESSED_RGBA_S3TC_DXT5_EXT; break; case 113: case 116: P = !0; break; case Kr: f += 20; var S = !1; switch (r.dxgiFormat) { case 10: P = !0, S = !0; break; case 88: r.isRGB = !0, r.isFourCC = !1, x = 32, S = !0 } if (S) break; default: return void console.error("Unsupported FourCC code:", (R = u, String.fromCharCode(255 & R, R >> 8 & 255, R >> 16 & 255, R >> 24 & 255))) } var C = e._ExtractLongWordOrder(b[23]), M = e._ExtractLongWordOrder(b[24]), O = e._ExtractLongWordOrder(b[25]), I = e._ExtractLongWordOrder(b[26]); P && (E = t._getRGBABufferInternalSizedFormat(r.textureType)), m = 1, 131072 & b[2] && !1 !== o && (m = Math.max(1, b[7])); for (var D = c || 0; D < s; D++) { for (h = b[4], d = b[3], v = 0; v < m; ++v) { if (-1 === a || a === v) { var L = -1 === a ? v : 0; if (!r.isCompressed && r.isFourCC) { i.format = _.a.TEXTUREFORMAT_RGBA, T = h * d * 4; var w = null; t._badOS || t._badDesktopOS || !t.getCaps().textureHalfFloat && !t.getCaps().textureFloat ? (128 === x ? (w = e._GetFloatAsUIntRGBAArrayBuffer(h, d, f, T, n, L), l && 0 == L && l.push(e._GetFloatRGBAArrayBuffer(h, d, f, T, n, L))) : 64 === x && (w = e._GetHalfFloatAsUIntRGBAArrayBuffer(h, d, f, T, n, L), l && 0 == L && l.push(e._GetHalfFloatAsFloatRGBAArrayBuffer(h, d, f, T, n, L))), i.type = _.a.TEXTURETYPE_UNSIGNED_INT) : 128 === x ? (i.type = _.a.TEXTURETYPE_FLOAT, w = e._GetFloatRGBAArrayBuffer(h, d, f, T, n, L), l && 0 == L && l.push(w)) : 64 !== x || t.getCaps().textureHalfFloat ? (i.type = _.a.TEXTURETYPE_HALF_FLOAT, w = e._GetHalfFloatRGBAArrayBuffer(h, d, f, T, n, L), l && 0 == L && l.push(e._GetHalfFloatAsFloatRGBAArrayBuffer(h, d, f, T, n, L))) : (i.type = _.a.TEXTURETYPE_FLOAT, w = e._GetHalfFloatAsFloatRGBAArrayBuffer(h, d, f, T, n, L), l && 0 == L && l.push(w)), w && t._uploadDataToTextureDirectly(i, w, D, L) } else if (r.isRGB) i.type = _.a.TEXTURETYPE_UNSIGNED_INT, 24 === x ? (i.format = _.a.TEXTUREFORMAT_RGB, T = h * d * 3, g = e._GetRGBArrayBuffer(h, d, f, T, n, C, M, O), t._uploadDataToTextureDirectly(i, g, D, L)) : (i.format = _.a.TEXTUREFORMAT_RGBA, T = h * d * 4, g = e._GetRGBAArrayBuffer(h, d, f, T, n, C, M, O, I), t._uploadDataToTextureDirectly(i, g, D, L)); else if (r.isLuminance) { var F = t._getUnpackAlignement(), N = h; T = Math.floor((h + F - 1) / F) * F * (d - 1) + N, g = e._GetLuminanceArrayBuffer(h, d, f, T, n), i.format = _.a.TEXTUREFORMAT_LUMINANCE, i.type = _.a.TEXTURETYPE_UNSIGNED_INT, t._uploadDataToTextureDirectly(i, g, D, L) } else T = Math.max(4, h) / 4 * Math.max(4, d) / 4 * A, g = new Uint8Array(n, f, T), i.type = _.a.TEXTURETYPE_UNSIGNED_INT, t._uploadCompressedDataToTextureDirectly(i, E, h, d, g, D, L) } f += x ? h * d * (x / 8) : T, h *= .5, d *= .5, h = Math.max(1, h), d = Math.max(1, d) } if (void 0 !== c) break } l && l.length > 0 ? r.sphericalPolynomial = jr.a.ConvertCubeMapToSphericalPolynomial({ size: b[4], right: l[0], left: l[1], up: l[2], down: l[3], front: l[4], back: l[5], format: _.a.TEXTUREFORMAT_RGBA, type: _.a.TEXTURETYPE_FLOAT, gammaSpace: !1 }) : r.sphericalPolynomial = void 0 } else p.a.Error("Compressed textures are not supported on this platform."); else p.a.Error("Unsupported format, must contain a FourCC, RGB or LUMINANCE code"); else p.a.Error("Invalid magic number in DDS header") }, e.StoreLODInAlphaChannel = !1, e }(); ge.b.prototype.createPrefilteredCubeTexture = function(e, t, i, n, r, o, s, a, c) { var l = this; void 0 === r && (r = null), void 0 === o && (o = null), void 0 === a && (a = null), void 0 === c && (c = !0); return this.createCubeTexture(e, t, null, !1, function(e) { if (e) { var o = e.texture; if (c ? e.info.sphericalPolynomial && (o._sphericalPolynomial = e.info.sphericalPolynomial) : o._sphericalPolynomial = new zr.b, o._dataSource = ze.a.DATASOURCE_CUBEPREFILTERED, l.getCaps().textureLOD) r && r(o); else { var s = l._gl, a = e.width; if (a) { for (var u = [], h = 0; h < 3; h++) { var d = 1 - h / 2, f = n, _ = D.a.Log2(a) * i + n, g = f + (_ - f) * d, m = Math.round(Math.min(Math.max(g, 0), _)), v = new ze.a(l, ze.a.DATASOURCE_TEMP); if (v.type = o.type, v.format = o.format, v.width = Math.pow(2, Math.max(D.a.Log2(a) - m, 0)), v.height = v.width, v.isCube = !0, l._bindTextureDirectly(s.TEXTURE_CUBE_MAP, v, !0), s.texParameteri(s.TEXTURE_CUBE_MAP, s.TEXTURE_MAG_FILTER, s.LINEAR), s.texParameteri(s.TEXTURE_CUBE_MAP, s.TEXTURE_MIN_FILTER, s.LINEAR), s.texParameteri(s.TEXTURE_CUBE_MAP, s.TEXTURE_WRAP_S, s.CLAMP_TO_EDGE), s.texParameteri(s.TEXTURE_CUBE_MAP, s.TEXTURE_WRAP_T, s.CLAMP_TO_EDGE), e.isDDS) { var y = e.info, b = e.data; l._unpackFlipY(y.isCompressed), Qr.UploadDDSLevels(l, v, b, y, !0, 6, m) } else p.a.Warn("DDS is the only prefiltered cube map supported so far."); l._bindTextureDirectly(s.TEXTURE_CUBE_MAP, null); var T = new Kn.a(t); T.isCube = !0, T._texture = v, v.isReady = !0, u.push(T) } o._lodTextureHigh = u[2], o._lodTextureMid = u[1], o._lodTextureLow = u[0], r && r(o) } } } else r && r(null) }, o, s, a, c, i, n) }; var qr = function() { function e() { this.supportCascades = !0 } 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, s = t.getEngine(), a = !1; if (Array.isArray(e)) for (var c = 0; c < e.length; c++) { var l = e[c]; o = Qr.GetDDSInfo(l), t.width = o.width, t.height = o.height, a = (o.isRGB || o.isLuminance || o.mipmapCount > 1) && t.generateMipMaps, s._unpackFlipY(o.isCompressed), Qr.UploadDDSLevels(s, t, l, o, a, 6, -1, c), o.isFourCC || 1 !== o.mipmapCount || s.generateMipMapsForCubemap(t) } else { var u = e; o = Qr.GetDDSInfo(u), t.width = o.width, t.height = o.height, i && (o.sphericalPolynomial = new zr.b), a = (o.isRGB || o.isLuminance || o.mipmapCount > 1) && t.generateMipMaps, s._unpackFlipY(o.isCompressed), Qr.UploadDDSLevels(s, t, u, o, a, 6), o.isFourCC || 1 !== o.mipmapCount || s.generateMipMapsForCubemap(t) } s._setCubeMapTextureParams(a), t.isReady = !0, n && n({ isDDS: !0, width: t.width, info: o, data: e, texture: t }) }, e.prototype.loadData = function(e, t, i) { var n = Qr.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() { Qr.UploadDDSLevels(t.getEngine(), t, e, n, r, 1) }) }, e }(); ge.b._TextureLoaders.push(new qr); var Zr = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include\nvoid main(void)\n{\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\n}"; zt.a.ShadersStore.rgbdEncodePixelShader = Zr; var Jr = 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 p.a.Error("Not a babylon environment map"), null; for (var o = "", s = 0; s = i.getUint8(n++);) o += String.fromCharCode(s); var a = JSON.parse(o); return a.specular && (a.specular.specularDataPosition = n, a.specular.lodGenerationScale = a.specular.lodGenerationScale || .8), a }, e.CreateEnvTextureAsync = function(t) { var i = this, n = t.getInternalTexture(); if (!n) return Promise.reject("The cube texture is invalid."); if (!t._prefiltered) return Promise.reject("The cube texture is invalid (not prefiltered)."); var r = n.getEngine(); if (r && r.premultipliedAlpha) return Promise.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 Promise.reject("The cube texture should allow HDR (Full Float or Half Float)."); var o = r.getRenderingCanvas(); if (!o) return Promise.reject("Env texture can only be created when the engine is associated to a canvas."); var s = _.a.TEXTURETYPE_FLOAT; if (!r.getCaps().textureFloatRender && (s = _.a.TEXTURETYPE_HALF_FLOAT, !r.getCaps().textureHalfFloatRender)) return Promise.reject("Env texture can only be created when the browser supports half float or full float rendering."); var a = n.width, c = new W.a(r), l = {}, u = [], h = D.a.Log2(n.width); h = Math.round(h); for (var d = function(e) { for (var i = Math.pow(2, h - e), n = function(n) { var a = t.readPixels(n, e), h = r.createRawTexture(a, i, i, _.a.TEXTUREFORMAT_RGBA, !1, !1, _.a.TEXTURE_NEAREST_SAMPLINGMODE, null, s), d = new Promise(function(t, s) { var a = new Ht("rgbdEncode", "rgbdEncode", null, null, 1, null, _.a.TEXTURE_NEAREST_SAMPLINGMODE, r, !1, void 0, _.a.TEXTURETYPE_UNSIGNED_INT, void 0, null, !1); a.getEffect().executeWhenCompiled(function() { a.onApply = function(e) { e._bindTexture("textureSampler", h) }; var s = r.getRenderWidth(), u = r.getRenderHeight(); r.setSize(i, i), c.postProcessManager.directRender([a], null), ye.h.ToBlob(o, function(i) { var r = new FileReader; r.onload = function(i) { var r = i.target.result; l[6 * e + n] = r, t() }, r.readAsArrayBuffer(i) }), r.setSize(s, u) }) }); u.push(d) }, a = 0; a < 6; a++) n(a) }, f = 0; f <= h; f++) d(f); return Promise.all(u).then(function() { c.dispose(); for (var n = { version: 1, width: a, irradiance: i._CreateEnvTextureIrradiance(t), specular: { mipmaps: [], lodGenerationScale: t.lodGenerationScale } }, r = 0, o = 0; o <= h; o++) for (var s = 0; s < 6; s++) { var u = l[6 * o + s].byteLength; n.specular.mipmaps.push({ length: u, position: r }), r += u } for (var d = JSON.stringify(n), f = new ArrayBuffer(d.length + 1), p = new Uint8Array(f), _ = (o = 0, d.length); o < _; o++) p[o] = d.charCodeAt(o); p[d.length] = 0; var g = e._MagicBytes.length + r + f.byteLength, m = new ArrayBuffer(g), v = new Uint8Array(m), y = new DataView(m), b = 0; for (o = 0; o < e._MagicBytes.length; o++) y.setUint8(b++, e._MagicBytes[o]); v.set(new Uint8Array(f), b), b += f.byteLength; for (o = 0; o <= h; o++) for (s = 0; s < 6; s++) { var T = l[6 * o + s]; v.set(new Uint8Array(T), b), b += T.byteLength } return m }) }, 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] } }, e.UploadEnvLevelsAsync = function(t, i, n) { if (1 !== n.version) throw new Error('Unsupported babylon environment map version "' + n.version + '"'); var r = n.specular; if (!r) return Promise.resolve(); var o = D.a.Log2(n.width); if (o = Math.round(o) + 1, r.mipmaps.length !== 6 * o) throw new Error('Unsupported specular mipmaps number "' + r.mipmaps.length + '"'); t._lodGenerationScale = r.lodGenerationScale; for (var s = new Array(o), a = 0; a < o; a++) { s[a] = new Array(6); for (var c = 0; c < 6; c++) { var l = r.mipmaps[6 * a + c]; s[a][c] = new Uint8Array(i, r.specularDataPosition + l.position, l.length) } } return e.UploadLevelsAsync(t, s) }, e.UploadLevelsAsync = function(e, t) { if (!ye.h.IsExponentOfTwo(e.width)) throw new Error("Texture size must be a power of two"); var i = Math.round(D.a.Log2(e.width)) + 1, n = e.getEngine(), r = !1, o = !1, s = null, a = null, c = null, l = n.getCaps(); if (e.format = _.a.TEXTUREFORMAT_RGBA, e.type = _.a.TEXTURETYPE_UNSIGNED_INT, e.generateMipMaps = !0, n.updateTextureSamplingMode(_.a.TEXTURE_TRILINEAR_SAMPLINGMODE, e), l.textureLOD ? n.webGLVersion < 2 ? r = !1 : l.textureHalfFloatRender && l.textureHalfFloatLinearFiltering ? (r = !0, e.type = _.a.TEXTURETYPE_HALF_FLOAT) : l.textureFloatRender && l.textureFloatLinearFiltering && (r = !0, e.type = _.a.TEXTURETYPE_FLOAT) : (r = !1, o = !0, c = {}), r) s = new Ht("rgbdDecode", "rgbdDecode", null, null, 1, null, _.a.TEXTURE_TRILINEAR_SAMPLINGMODE, n, !1, void 0, e.type, void 0, null, !1), e._isRGBD = !1, e.invertY = !1, a = n.createRenderTargetCubeTexture(e.width, { generateDepthBuffer: !1, generateMipMaps: !0, generateStencilBuffer: !1, samplingMode: _.a.TEXTURE_TRILINEAR_SAMPLINGMODE, type: e.type, format: _.a.TEXTUREFORMAT_RGBA }); else if (e._isRGBD = !0, e.invertY = !0, o) for (var u = e._lodGenerationScale, h = e._lodGenerationOffset, d = 0; d < 3; d++) { var f = (i - 1) * u + h, p = h + (f - h) * (1 - d / 2), g = Math.round(Math.min(Math.max(p, 0), f)), m = new ze.a(n, ze.a.DATASOURCE_TEMP); m.isCube = !0, m.invertY = !0, m.generateMipMaps = !1, n.updateTextureSamplingMode(_.a.TEXTURE_LINEAR_LINEAR, m); var v = new Kn.a(null); switch (v.isCube = !0, v._texture = m, c[g] = v, d) { case 0: e._lodTextureLow = v; break; case 1: e._lodTextureMid = v; break; case 2: e._lodTextureHigh = v } } var y = [], b = function(i) { for (var l = function(l) { var u = t[i][l], h = new Blob([u], { type: "image/png" }), d = URL.createObjectURL(h), f = new Image; f.src = d; var p = new Promise(function(t, u) { f.onload = function() { if (r) { var h = n.createTexture(null, !0, !0, null, _.a.TEXTURE_NEAREST_SAMPLINGMODE, null, function(e) { u(e) }, f); s.getEffect().executeWhenCompiled(function() { s.onApply = function(e) { e._bindTexture("textureSampler", h), e.setFloat2("scale", 1, 1) }, n.scenes[0].postProcessManager.directRender([s], a, !0, l, i), n.restoreDefaultFramebuffer(), h.dispose(), window.URL.revokeObjectURL(d), t() }) } else { if (n._uploadImageToTexture(e, f, l, i), o) { var p = c[i]; p && n._uploadImageToTexture(p._texture, f, l, 0) } t() } }, f.onerror = function(e) { u(e) } }); y.push(p) }, u = 0; u < 6; u++) l(u) }; for (d = 0; d < t.length; d++) b(d); if (t.length < i) { var T = void 0, E = Math.pow(2, i - 1 - t.length), A = E * E * 4; switch (e.type) { case _.a.TEXTURETYPE_UNSIGNED_INT: T = new Uint8Array(A); break; case _.a.TEXTURETYPE_HALF_FLOAT: T = new Uint16Array(A); break; case _.a.TEXTURETYPE_FLOAT: T = new Float32Array(A) } for (d = t.length; d < i; d++) for (var x = 0; x < 6; x++) n._uploadArrayBufferViewToTexture(e, T, x, d) } return Promise.all(y).then(function() { a && (n._releaseFramebufferObjects(a), a._swapAndDie(e)), s && s.dispose(), o && (e._lodTextureHigh && e._lodTextureHigh._texture && (e._lodTextureHigh._texture.isReady = !0), e._lodTextureMid && e._lodTextureMid._texture && (e._lodTextureMid._texture.isReady = !0), e._lodTextureLow && e._lodTextureLow._texture && (e._lodTextureLow._texture.isReady = !0)) }) }, e.UploadEnvSpherical = function(e, t) { 1 !== t.version && p.a.Warn('Unsupported babylon environment map version "' + t.version + '"'); var i = t.irradiance; if (i) { var n = new zr.b; o.x.FromArrayToRef(i.x, 0, n.x), o.x.FromArrayToRef(i.y, 0, n.y), o.x.FromArrayToRef(i.z, 0, n.z), o.x.FromArrayToRef(i.xx, 0, n.xx), o.x.FromArrayToRef(i.yy, 0, n.yy), o.x.FromArrayToRef(i.zz, 0, n.zz), o.x.FromArrayToRef(i.yz, 0, n.yz), o.x.FromArrayToRef(i.zx, 0, n.zx), o.x.FromArrayToRef(i.xy, 0, n.xy), e._sphericalPolynomial = n } }, e._UpdateRGBDAsync = function(t, i, n, r, o) { return t._dataSource = ze.a.DATASOURCE_CUBERAW_RGBD, t._bufferViewArrayArray = i, t._lodGenerationScale = r, t._lodGenerationOffset = o, t._sphericalPolynomial = n, e.UploadLevelsAsync(t, i).then(function() { t.isReady = !0 }) }, e._MagicBytes = [134, 22, 135, 150, 246, 214, 150, 54], e }(); ze.a._UpdateRGBDAsync = Jr._UpdateRGBDAsync; var $r = function() { function e() { this.supportCascades = !1 } 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 = Jr.GetEnvInfo(e); o ? (t.width = o.width, t.height = o.width, Jr.UploadEnvSpherical(t, o), Jr.UploadEnvLevelsAsync(t, e, o).then(function() { t.isReady = !0, 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 }(); ge.b._TextureLoaders.push(new $r); var eo = function() { function e(t, i, n, r) { this.arrayBuffer = t, this.isInvalid = !1; 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 = !0, void p.a.Error("texture missing KTX identifier"); var s = Uint32Array.BYTES_PER_ELEMENT, a = new DataView(this.arrayBuffer, 12, 13 * s), c = 67305985 === a.getUint32(0, !0); this.glType = a.getUint32(1 * s, c), this.glTypeSize = a.getUint32(2 * s, c), this.glFormat = a.getUint32(3 * s, c), this.glInternalFormat = a.getUint32(4 * s, c), this.glBaseInternalFormat = a.getUint32(5 * s, c), this.pixelWidth = a.getUint32(6 * s, c), this.pixelHeight = a.getUint32(7 * s, c), this.pixelDepth = a.getUint32(8 * s, c), this.numberOfArrayElements = a.getUint32(9 * s, c), this.numberOfFaces = a.getUint32(10 * s, c), this.numberOfMipmapLevels = a.getUint32(11 * s, c), this.bytesOfKeyValueData = a.getUint32(12 * s, 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 : p.a.Error("number of faces expected" + i + ", but found " + this.numberOfFaces) : p.a.Error("texture arrays not currently supported") : p.a.Error("only 2D textures currently supported")) : p.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, s = i ? this.numberOfMipmapLevels : 1, a = 0; a < s; a++) { var c = new Int32Array(this.arrayBuffer, n, 1)[0]; n += 4; for (var l = 0; l < this.numberOfFaces; l++) { var u = new Uint8Array(this.arrayBuffer, n, c); t.getEngine()._uploadCompressedDataToTextureDirectly(t, this.glInternalFormat, r, o, u, l, a), 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, e }(), to = function() { function e() { this.supportCascades = !1 } 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(), s = new eo(e, 6), a = s.numberOfMipmapLevels > 1 && t.generateMipMaps; o._unpackFlipY(!0), s.uploadLevels(t, t.generateMipMaps), t.width = s.pixelWidth, t.height = s.pixelHeight, o._setCubeMapTextureParams(a), t.isReady = !0 } }, e.prototype.loadData = function(e, t, i) { t._invertVScale = !t.invertY; var n = new eo(e, 1); i(n.pixelWidth, n.pixelHeight, !1, !0, function() { n.uploadLevels(t, t.generateMipMaps) }, n.isInvalid) }, e }(); ge.b._TextureLoaders.unshift(new to); W.a.prototype.createDefaultLight = function(e) { if (void 0 === e && (e = !1), e && this.lights) for (var t = 0; t < this.lights.length; t++) this.lights[t].dispose(); 0 === this.lights.length && new Ti.a("default light", o.x.Up(), this) }, W.a.prototype.createDefaultCamera = function(e, t, i) { if (void 0 === e && (e = !1), void 0 === t && (t = !1), void 0 === i && (i = !1), t && this.activeCamera && (this.activeCamera.dispose(), this.activeCamera = null), !this.activeCamera) { var n, r = this.getWorldExtends(), s = r.max.subtract(r.min), a = r.min.add(s.scale(.5)), c = 1.5 * s.length(); if (isFinite(c) || (c = 1, a.copyFromFloats(0, 0, 0)), e) { var l = new Et("default camera", -Math.PI / 2, Math.PI / 2, c, a, this); l.lowerRadiusLimit = .01 * c, l.wheelPrecision = 100 / c, n = l } else { var u = new bt("default camera", new o.x(a.x, a.y, -c), this); u.setTarget(a), n = u } 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) } }, W.a.prototype.createDefaultCameraOrLight = function(e, t, i) { void 0 === e && (e = !1), void 0 === t && (t = !1), void 0 === i && (i = !1), this.createDefaultLight(t), this.createDefaultCamera(e, t, i) }, W.a.prototype.createDefaultSkybox = function(e, t, i, n, r) { if (void 0 === t && (t = !1), void 0 === i && (i = 1e3), void 0 === n && (n = 0), void 0 === r && (r = !0), !e) return p.a.Warn("Can not create default skybox without environment texture."), null; r && e && (this.environmentTexture = e); var o = fe.a.CreateBox("hdrSkyBox", i, this); if (t) { var s = new kr("skyBox", this); s.backFaceCulling = !1, s.reflectionTexture = e.clone(), s.reflectionTexture && (s.reflectionTexture.coordinatesMode = ke.a.SKYBOX_MODE), s.microSurface = 1 - n, s.disableLighting = !0, s.twoSidedLighting = !0, o.infiniteDistance = !0, o.material = s } else { var a = new Ri.a("skyBox", this); a.backFaceCulling = !1, a.reflectionTexture = e.clone(), a.reflectionTexture && (a.reflectionTexture.coordinatesMode = ke.a.SKYBOX_MODE), a.disableLighting = !0, o.infiniteDistance = !0, o.material = a } return o.isPickable = !1, o }, W.a.prototype.createDefaultEnvironment = function(e) { return pr ? new pr(e, this) : null }, W.a.prototype.createDefaultVRExperience = function(e) { return void 0 === e && (e = {}), new Gi(this, e) }, W.a.prototype.createDefaultXRExperienceAsync = function() { var e = this; return Hi.CreateAsync(this).then(function(t) { var i = new qi(t); return Yi.CreateAsync(e, t, { outputCanvasContext: i.canvasContext }).then(function(e) { return new Qi(t), t }) }) }; var io = function(e) { function t(t, i, n, r, o, s, a) { void 0 === r && (r = !1), void 0 === o && (o = !1), void 0 === s && (s = ke.a.TRILINEAR_SAMPLINGMODE), void 0 === a && (a = { autoPlay: !0, loop: !0, autoUpdateTexture: !0 }); var c = e.call(this, null, n, !r, o) || this; c._onUserActionRequestedObservable = null, c._stillImageCaptured = !1, c._displayingPosterTexture = !1, c._createInternalTexture = function() { if (null != c._texture) { if (!c._displayingPosterTexture) return; c._texture.dispose(), c._displayingPosterTexture = !1 } if (!c._engine.needPOTTextures || ye.h.IsExponentOfTwo(c.video.videoWidth) && ye.h.IsExponentOfTwo(c.video.videoHeight) ? (c.wrapU = ke.a.WRAP_ADDRESSMODE, c.wrapV = ke.a.WRAP_ADDRESSMODE) : (c.wrapU = ke.a.CLAMP_ADDRESSMODE, c.wrapV = ke.a.CLAMP_ADDRESSMODE, c._generateMipMaps = !1), c._texture = c._engine.createDynamicTexture(c.video.videoWidth, c.video.videoHeight, c._generateMipMaps, c.samplingMode), c.video.autoplay || c._settings.poster) c._texture.isReady = !0, c._updateInternalTexture(), c.onLoadObservable.hasObservers() && c.onLoadObservable.notifyObservers(c); else { var e = c.video.onplaying, t = !1, i = c.video.muted; c.video.muted = !0, c.video.onplaying = function() { c.video.muted = i, c.video.onplaying = e, c._texture.isReady = !0, 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 = !0, c._onUserActionRequestedObservable && c._onUserActionRequestedObservable.hasObservers() && c._onUserActionRequestedObservable.notifyObservers(c) }) : (c.video.onplaying = e, c._texture.isReady = !0, 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 = s, c.autoUpdateTexture = a.autoUpdateTexture, c.name = t || c._getName(i), c.video = c._getVideo(i), c._settings = a, a.poster && (c.video.poster = a.poster), void 0 !== a.autoPlay && (c.video.autoplay = a.autoPlay), void 0 !== a.loop && (c.video.loop = a.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 = a.poster && !a.autoPlay ? "play" : "canplay", c.video.addEventListener(c._createInternalTextureOnEvent, c._createInternalTexture); var l = c.video.readyState >= c.video.HAVE_CURRENT_DATA; return !a.poster || a.autoPlay && l ? l && c._createInternalTexture() : (c._texture = c._engine.createTexture(a.poster, !1, !0, n), c._displayingPosterTexture = !0), c } return l.d(t, e), Object.defineProperty(t.prototype, "onUserActionRequestedObservable", { get: function() { return this._onUserActionRequestedObservable || (this._onUserActionRequestedObservable = new r.c), this._onUserActionRequestedObservable }, enumerable: !0, configurable: !0 }), t.prototype._getName = function(e) { return e instanceof HTMLVideoElement ? e.currentSrc : "object" == typeof e ? e.toString() : e }, t.prototype._getVideo = function(e) { if (e instanceof HTMLVideoElement) return ye.h.SetCorsBehavior(e.currentSrc, e), e; var t = document.createElement("video"); return "string" == typeof e ? (ye.h.SetCorsBehavior(e, t), t.src = e) : (ye.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(!0) }, t.prototype.updateTexture = function(e) { e && (this.video.paused && this._stillImageCaptured || (this._stillImageCaptured = !0, 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, i) { var n = document.createElement("video"); return n.setAttribute("autoplay", ""), n.setAttribute("muted", "true"), n.setAttribute("playsinline", ""), n.muted = !0, void 0 !== n.mozSrcObject ? n.mozSrcObject = i : "object" == typeof n.srcObject ? n.srcObject = i : (window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL, n.src = window.URL && window.URL.createObjectURL(i)), new Promise(function(i) { var r = function() { i(new t("video", n, e, !0, !0)), n.removeEventListener("playing", r) }; n.addEventListener("playing", r), n.play() }) }, t.CreateFromWebCamAsync = function(e, t, i) { var n, r = this; return void 0 === i && (i = !1), t && t.deviceId && (n = { exact: t.deviceId }), navigator.mediaDevices ? navigator.mediaDevices.getUserMedia({ video: t, audio: i }).then(function(t) { return r.CreateFromStreamAsync(e, t) }) : (navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia, navigator.getUserMedia && navigator.getUserMedia({ video: { deviceId: n, width: { min: t && t.minWidth || 256, max: t && t.maxWidth || 640 }, height: { min: t && t.minHeight || 256, max: t && t.maxHeight || 480 } }, audio: i }, function(t) { return r.CreateFromStreamAsync(e, t) }, function(e) { p.a.Error(e.name) }), Promise.reject("No support for userMedia on this device")) }, t.CreateFromWebCam = function(e, t, i, n) { void 0 === n && (n = !1), this.CreateFromWebCamAsync(e, i, n).then(function(e) { t && t(e) }).catch(function(e) { p.a.Error(e.name) }) }, t }(ke.a), no = function(e) { function t(i, n, r, s) { var a = e.call(this, i, s) || this; a._useDirectMapping = !1, a._videoMode = t.MODE_MONOSCOPIC, a._onBeforeCameraRenderObserver = null, s = a.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) || (s.activeCamera ? .48 * s.activeCamera.maxZ : 1e3), void 0 === r.useDirectMapping ? a._useDirectMapping = !0 : a._useDirectMapping = r.useDirectMapping, void 0 === r.faceForward && (r.faceForward = !0), a._setReady(!1); var c = { loop: r.loop, autoPlay: r.autoPlay, autoUpdateTexture: !0, poster: r.poster }, l = a._material = new dr(i + "_material", s), u = a._videoTexture = new io(i + "_texture", n, s, !1, a._useDirectMapping, ke.a.TRILINEAR_SAMPLINGMODE, c); if (a._mesh = fe.a.CreateSphere(i + "_mesh", r.resolution, r.size, s, !1, fe.a.BACKSIDE), u.onLoadObservable.addOnce(function() { a._setReady(!0) }), l.useEquirectangularFOV = !0, l.fovMultiplier = 1, l.opacityFresnel = !1, a._useDirectMapping ? (u.wrapU = ke.a.CLAMP_ADDRESSMODE, u.wrapV = ke.a.CLAMP_ADDRESSMODE, l.diffuseTexture = u) : (u.coordinatesMode = ke.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE, u.wrapV = ke.a.CLAMP_ADDRESSMODE, l.reflectionTexture = u), a._mesh.material = l, a._mesh.parent = a, r.clickToPlay && (s.onPointerUp = function() { a._videoTexture.video.play() }), r.faceForward && s.activeCamera) { var h = s.activeCamera, d = o.x.Forward(), f = o.x.TransformNormal(d, h.getViewMatrix()); f.normalize(), a.rotation.y = Math.acos(o.x.Dot(d, f)) } return a } return l.d(t, e), Object.defineProperty(t.prototype, "videoTexture", { get: function() { return this._videoTexture }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "fovMultiplier", { get: function() { return this._material.fovMultiplier }, set: function(e) { this._material.fovMultiplier = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "videoMode", { get: function() { return this._videoMode }, set: function(e) { this._videoMode !== e && this._changeVideoMode(e) }, enumerable: !0, configurable: !0 }), 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; 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 = !1), 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, t }(_r.a), ro = function() { function e(e) { this.engine = e, this._captureGPUFrameTime = !1, this._gpuFrameTime = new ye.f, this._captureShaderCompilationTime = !1, this._shaderCompilationTime = new ye.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: !0, configurable: !0 }), 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, !0)) } })) : (this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver), this._onBeginFrameObserver = null, this.engine.onEndFrameObservable.remove(this._onEndFrameObserver), this._onEndFrameObserver = null)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "shaderCompilationTimeCounter", { get: function() { return this._shaderCompilationTime }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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 }(), oo = function() { function e(e) { var t = this; this.scene = e, this._captureActiveMeshesEvaluationTime = !1, this._activeMeshesEvaluationTime = new ye.f, this._captureRenderTargetsRenderTime = !1, this._renderTargetsRenderTime = new ye.f, this._captureFrameTime = !1, this._frameTime = new ye.f, this._captureRenderTime = !1, this._renderTime = new ye.f, this._captureInterFrameTime = !1, this._interFrameTime = new ye.f, this._captureParticlesRenderTime = !1, this._particlesRenderTime = new ye.f, this._captureSpritesRenderTime = !1, this._spritesRenderTime = new ye.f, this._capturePhysicsTime = !1, this._physicsTime = new ye.f, this._captureAnimationsTime = !1, this._animationsTime = new ye.f, this._captureCameraRenderTime = !1, this._cameraRenderTime = new ye.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 && (ye.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 && (ye.h.EndPerformanceCounter("Scene rendering"), t._frameTime.endMonitoring()), t._captureRenderTime && t._renderTime.endMonitoring(!1), t._captureInterFrameTime && t._interFrameTime.beginMonitoring() }) } return Object.defineProperty(e.prototype, "activeMeshesEvaluationTimeCounter", { get: function() { return this._activeMeshesEvaluationTime }, enumerable: !0, configurable: !0 }), 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() { ye.h.StartPerformanceCounter("Active meshes evaluation"), t._activeMeshesEvaluationTime.beginMonitoring() }), this._onAfterActiveMeshesEvaluationObserver = this.scene.onAfterActiveMeshesEvaluationObservable.add(function() { ye.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "renderTargetsRenderTimeCounter", { get: function() { return this._renderTargetsRenderTime }, enumerable: !0, configurable: !0 }), 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() { ye.h.StartPerformanceCounter("Render targets rendering"), t._renderTargetsRenderTime.beginMonitoring() }), this._onAfterRenderTargetsRenderObserver = this.scene.onAfterRenderTargetsRenderObservable.add(function() { ye.h.EndPerformanceCounter("Render targets rendering"), t._renderTargetsRenderTime.endMonitoring(!1) })) : (this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver), this._onBeforeRenderTargetsRenderObserver = null, this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver), this._onAfterRenderTargetsRenderObserver = null)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "particlesRenderTimeCounter", { get: function() { return this._particlesRenderTime }, enumerable: !0, configurable: !0 }), 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() { ye.h.StartPerformanceCounter("Particles"), t._particlesRenderTime.beginMonitoring() }), this._onAfterParticlesRenderingObserver = this.scene.onAfterParticlesRenderingObservable.add(function() { ye.h.EndPerformanceCounter("Particles"), t._particlesRenderTime.endMonitoring(!1) })) : (this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver), this._onBeforeParticlesRenderingObserver = null, this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver), this._onAfterParticlesRenderingObserver = null)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "spritesRenderTimeCounter", { get: function() { return this._spritesRenderTime }, enumerable: !0, configurable: !0 }), 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() { ye.h.StartPerformanceCounter("Sprites"), t._spritesRenderTime.beginMonitoring() }), this._onAfterSpritesRenderingObserver = this.scene.onAfterSpritesRenderingObservable.add(function() { ye.h.EndPerformanceCounter("Sprites"), t._spritesRenderTime.endMonitoring(!1) })) : (this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver), this._onBeforeSpritesRenderingObserver = null, this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver), this._onAfterSpritesRenderingObserver = null))) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "physicsTimeCounter", { get: function() { return this._physicsTime }, enumerable: !0, configurable: !0 }), 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() { ye.h.StartPerformanceCounter("Physics"), t._physicsTime.beginMonitoring() }), this._onAfterPhysicsObserver = this.scene.onAfterPhysicsObservable.add(function() { ye.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "animationsTimeCounter", { get: function() { return this._animationsTime }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "frameTimeCounter", { get: function() { return this._frameTime }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "captureFrameTime", { get: function() { return this._captureFrameTime }, set: function(e) { this._captureFrameTime = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "interFrameTimeCounter", { get: function() { return this._interFrameTime }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "captureInterFrameTime", { get: function() { return this._captureInterFrameTime }, set: function(e) { this._captureInterFrameTime = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "renderTimeCounter", { get: function() { return this._renderTime }, enumerable: !0, configurable: !0 }), 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(), ye.h.StartPerformanceCounter("Main render") }), this._onAfterDrawPhaseObserver = this.scene.onAfterDrawPhaseObservable.add(function() { t._renderTime.endMonitoring(!1), ye.h.EndPerformanceCounter("Main render") })) : (this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver), this._onBeforeDrawPhaseObserver = null, this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver), this._onAfterDrawPhaseObserver = null)) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "cameraRenderTimeCounter", { get: function() { return this._cameraRenderTime }, enumerable: !0, configurable: !0 }), 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(), ye.h.StartPerformanceCounter("Rendering camera " + e.name) }), this._onAfterCameraRenderObserver = this.scene.onAfterCameraRenderObservable.add(function(e) { t._cameraRenderTime.endMonitoring(!1), ye.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "drawCallsCounter", { get: function() { return this.scene.getEngine()._drawCalls }, enumerable: !0, configurable: !0 }), 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 }(), so = i(20), ao = "#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 4 && (o.push(Oi.b.MatricesIndicesExtraKind), o.push(Oi.b.MatricesWeightsExtraKind)), r.push("#define NUM_BONE_INFLUENCERS " + s.numBoneInfluencers), r.push("#define BonesPerMesh " + (s.skeleton ? s.skeleton.bones.length + 1 : 0))) : r.push("#define NUM_BONE_INFLUENCERS 0"); var f = s.morphTargetManager, p = 0; f && f.numInfluencers > 0 && (r.push("#define MORPHTARGETS"), p = f.numInfluencers, r.push("#define NUM_MORPH_INFLUENCERS " + p), ir.a.PrepareAttributesForMorphTargets(o, s, { 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 _ = r.join("\n"); return this._cachedDefines !== _ && (this._cachedDefines = _, this._effectLayerMapGenerationEffect = this._scene.getEngine().createEffect("glowMapGeneration", o, ["world", "mBones", "viewProjection", "glowColor", "morphTargetInfluences", "diffuseMatrix", "emissiveMatrix", "opacityMatrix", "opacityIntensity"], ["diffuseSampler", "emissiveSampler", "opacitySampler"], _, 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(!1), 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 !0 }, e.prototype._canRenderMesh = function(e, t) { return !t.needAlphaBlendingForMesh(e) }, e.prototype._shouldRenderEmissiveTextureForMesh = function() { return !0 }, e.prototype._renderSubMesh = function(e, t) { var i = this; if (void 0 === t && (t = !1), this.shouldRender()) { var n = e.getMaterial(), r = e.getRenderingMesh(), o = this._scene, s = o.getEngine(); if (r._internalAbstractMeshDataInfo._isActiveIntermediate = !1, n && this._canRenderMesh(r, n)) { s.setState(n.backFaceCulling); var a = r._getInstancesRenderList(e._id); if (!a.mustReturn && this._shouldRenderMesh(r)) { var c = a.hardwareInstancedRendering[e._id]; if (this._setEmissiveTextureAndColor(r, e, n), this._isReady(e, c, this._emissiveTextureAndColor.texture)) { s.enableEffect(this._effectLayerMapGenerationEffect), r._bind(e, this._effectLayerMapGenerationEffect, so.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 l = n.needAlphaTesting(), u = n.getAlphaTestTexture(), h = u && u.hasAlpha && (n.useAlphaFromDiffuseTexture || n._useAlphaFromAlbedoTexture); if (u && (l || h)) this._effectLayerMapGenerationEffect.setTexture("diffuseSampler", u), (d = u.getTextureMatrix()) && this._effectLayerMapGenerationEffect.setMatrix("diffuseMatrix", d); var d, f = n.opacityTexture; if (f) this._effectLayerMapGenerationEffect.setTexture("opacitySampler", f), this._effectLayerMapGenerationEffect.setFloat("opacityIntensity", f.level), (d = f.getTextureMatrix()) && this._effectLayerMapGenerationEffect.setMatrix("opacityMatrix", d); 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)), ir.a.BindMorphTargetParameters(r, this._effectLayerMapGenerationEffect), t && s.setAlphaMode(n.alphaMode), r._processRendering(e, this._effectLayerMapGenerationEffect, so.a.TriangleFillMode, a, c, function(e, t) { return i._effectLayerMapGenerationEffect.setMatrix("world", t) }) } else this._mainTexture.resetRefreshCounter() } } } }, e.prototype._rebuild = function() { var e = this._vertexBuffers[Oi.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(); this._postProcesses = []; for (e = 0; e < this._textures.length; e++) this._textures[e] && this._textures[e].dispose(); this._textures = [] }, e.prototype.dispose = function() { var e = this._vertexBuffers[Oi.b.PositionKind]; e && (e.dispose(), this._vertexBuffers[Oi.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 ye.h.Instantiate(e.customType).Parse(e, t, i) }, e._SceneComponentInitialization = function(e) { throw be.a.WarnImport("EffectLayerSceneComponent") }, l.c([Object(L.c)()], e.prototype, "name", void 0), l.c([Object(L.f)()], e.prototype, "neutralColor", void 0), l.c([Object(L.c)()], e.prototype, "isEnabled", void 0), l.c([Object(L.d)()], e.prototype, "camera", null), l.c([Object(L.c)()], e.prototype, "renderingGroupId", null), e }(); n.a.AddParser(Ae.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 = lo.Parse(e.effectLayers[r], t, n); i.effectLayers.push(o) } } }), n.a.prototype.removeEffectLayer = function(e) { var t = this.effectLayers.indexOf(e); return -1 !== t && this.effectLayers.splice(t, 1), t }, n.a.prototype.addEffectLayer = function(e) { this.effectLayers.push(e) }; var uo = function() { function e(e) { this.name = Ae.a.NAME_EFFECTLAYER, this._renderEffects = !1, this._needStencil = !1, this._previousStencilState = !1, this.scene = e, this._engine = e.getEngine(), e.effectLayers = new Array } return e.prototype.register = function() { this.scene._isReadyForMeshStage.registerStep(Ae.a.STEP_ISREADYFORMESH_EFFECTLAYER, this, this._isReadyForMesh), this.scene._cameraDrawRenderTargetStage.registerStep(Ae.a.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER, this, this._renderMainTexture), this.scene._beforeCameraDrawStage.registerStep(Ae.a.STEP_BEFORECAMERADRAW_EFFECTLAYER, this, this._setStencil), this.scene._afterRenderingGroupDrawStage.registerStep(Ae.a.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW, this, this._drawRenderingGroup), this.scene._afterCameraDrawStage.registerStep(Ae.a.STEP_AFTERCAMERADRAW_EFFECTLAYER, this, this._setStencilBack), this.scene._afterCameraDrawStage.registerStep(Ae.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, s = e.subMeshes; o < s.length; o++) { var a = s[o]; if (!r.isReady(a, t)) return !1 } } return !0 }, e.prototype._renderMainTexture = function(e) { this._renderEffects = !1, this._needStencil = !1; var t = !1, 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 === Ne.a.RIG_MODE_NONE && e === o.camera || o.camera.cameraRigMode !== Ne.a.RIG_MODE_NONE && o.camera._rigCameras.indexOf(e) > -1)) { this._renderEffects = !0, this._needStencil = this._needStencil || o.needStencil(); var s = o._mainTexture; s._shouldRender() && (this.scene.incrementRenderId(), s.render(!1, !1), t = !0) } } this.scene.incrementRenderId() } return t }, e.prototype._setStencil = function() { this._needStencil && this._engine.setStencilBuffer(!0) }, e.prototype._setStencilBack = function() { this._needStencil && this._engine.setStencilBuffer(this._previousStencilState) }, e.prototype._draw = function(e) { if (this._renderEffects) { this._engine.setDepthBuffer(!1); 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(!0) } }, e.prototype._drawCamera = function() { this._renderEffects && this._draw(-1) }, e.prototype._drawRenderingGroup = function(e) { !this.scene._isInIntermediateRendering() && this._renderEffects && this._draw(e) }, e }(); lo._SceneComponentInitialization = function(e) { var t = e._getComponent(Ae.a.NAME_EFFECTLAYER); t || (t = new uo(e), e._addComponent(t)) }; var ho = "\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}"; zt.a.ShadersStore.glowMapMergePixelShader = ho; var fo = "\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}"; zt.a.ShadersStore.glowMapMergeVertexShader = fo; n.a.prototype.getGlowLayerByName = function(e) { for (var t = 0; t < this.effectLayers.length; t++) if (this.effectLayers[t].name === e && this.effectLayers[t].getEffectName() === po.EffectName) return this.effectLayers[t]; return null }; var po = function(e) { function t(i, n, r) { var s = e.call(this, i, n) || this; return s._intensity = 1, s._includedOnlyMeshes = [], s._excludedMeshes = [], s.neutralColor = new o.f(0, 0, 0, 1), s._options = l.a({ mainTextureRatio: t.DefaultTextureRatio, blurKernelSize: 32, mainTextureFixedSize: void 0, camera: null, mainTextureSamples: 1, renderingGroupId: -1 }, r), s._init({ alphaBlendingMode: _.a.ALPHA_ADD, camera: s._options.camera, mainTextureFixedSize: s._options.mainTextureFixedSize, mainTextureRatio: s._options.mainTextureRatio, renderingGroupId: s._options.renderingGroupId }), s } return l.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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "intensity", { get: function() { return this._intensity }, set: function(e) { this._intensity = e }, enumerable: !0, configurable: !0 }), t.prototype.getEffectName = function() { return t.EffectName }, t.prototype._createMergeEffect = function() { return this._engine.createEffect("glowMapMerge", [Oi.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 ? ye.h.GetExponentOfTwo(t, this._maxSize) : t, i = this._engine.needPOTTextures ? ye.h.GetExponentOfTwo(i, this._maxSize) : i; var n = 0; n = this._engine.getCaps().textureHalfFloatRender ? _.a.TEXTURETYPE_HALF_FLOAT : _.a.TEXTURETYPE_UNSIGNED_INT, this._blurTexture1 = new _i("GlowLayerBlurRTT", { width: t, height: i }, this._scene, !1, !0, n), this._blurTexture1.wrapU = ke.a.CLAMP_ADDRESSMODE, this._blurTexture1.wrapV = ke.a.CLAMP_ADDRESSMODE, this._blurTexture1.updateSamplingMode(ke.a.BILINEAR_SAMPLINGMODE), this._blurTexture1.renderParticles = !1, this._blurTexture1.ignoreCameraViewport = !0; var r = Math.floor(t / 2), s = Math.floor(i / 2); this._blurTexture2 = new _i("GlowLayerBlurRTT2", { width: r, height: s }, this._scene, !1, !0, n), this._blurTexture2.wrapU = ke.a.CLAMP_ADDRESSMODE, this._blurTexture2.wrapV = ke.a.CLAMP_ADDRESSMODE, this._blurTexture2.updateSamplingMode(ke.a.BILINEAR_SAMPLINGMODE), this._blurTexture2.renderParticles = !1, this._blurTexture2.ignoreCameraViewport = !0, this._textures = [this._blurTexture1, this._blurTexture2], this._horizontalBlurPostprocess1 = new $n("GlowLayerHBP1", new o.w(1, 0), this._options.blurKernelSize / 2, { width: t, height: i }, null, ke.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, n), this._horizontalBlurPostprocess1.width = t, this._horizontalBlurPostprocess1.height = i, this._horizontalBlurPostprocess1.onApplyObservable.add(function(t) { t.setTexture("textureSampler", e._mainTexture) }), this._verticalBlurPostprocess1 = new $n("GlowLayerVBP1", new o.w(0, 1), this._options.blurKernelSize / 2, { width: t, height: i }, null, ke.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, n), this._horizontalBlurPostprocess2 = new $n("GlowLayerHBP2", new o.w(1, 0), this._options.blurKernelSize / 2, { width: r, height: s }, null, ke.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, n), this._horizontalBlurPostprocess2.width = r, this._horizontalBlurPostprocess2.height = s, this._horizontalBlurPostprocess2.onApplyObservable.add(function(t) { t.setTexture("textureSampler", e._blurTexture1) }), this._verticalBlurPostprocess2 = new $n("GlowLayerVBP2", new o.w(0, 1), this._options.blurKernelSize / 2, { width: r, height: s }, null, ke.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, 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, !0), (t = e._blurTexture2.getInternalTexture()) && e._scene.postProcessManager.directRender(e._postProcesses2, t, !0)) }), this._postProcesses.map(function(e) { e.autoClear = !1 }) }, t.prototype.isReady = function(t, i) { var n = t.getMaterial(), r = t.getRenderingMesh(); if (!n || !r) return !1; var o = n.emissiveTexture; return e.prototype._isReady.call(this, t, i, o) }, t.prototype.needStencil = function() { return !1 }, t.prototype._canRenderMesh = function(e, t) { return !0 }, 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(!1), t.drawElementsType(so.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 = L.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 = L.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.includedMeshes.length; r++) { var s; (s = i.getMeshByID(e.includedMeshes[r])) && o.addIncludedOnlyMesh(s) } return o }, t.EffectName = "GlowLayer", t.DefaultBlurKernelSize = 32, t.DefaultTextureRatio = .5, l.c([Object(L.c)()], t.prototype, "blurKernelSize", null), l.c([Object(L.c)()], t.prototype, "intensity", null), l.c([Object(L.c)("options")], t.prototype, "_options", void 0), t }(lo); s.a.RegisteredTypes["BABYLON.GlowLayer"] = po; var _o = "\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}"; zt.a.ShadersStore.glowBlurPostProcessPixelShader = _o; n.a.prototype.getHighlightLayerByName = function(e) { for (var t = 0; t < this.effectLayers.length; t++) if (this.effectLayers[t].name === e && this.effectLayers[t].getEffectName() === mo.EffectName) return this.effectLayers[t]; return null }; var go = function(e) { function t(t, i, n, r, o, s, a, c) { void 0 === s && (s = ke.a.BILINEAR_SAMPLINGMODE); var l = e.call(this, t, "glowBlurPostProcess", ["screenSize", "direction", "blurWidth"], null, r, o, s, a, c) || this; return l.direction = i, l.kernel = n, l.onApplyObservable.add(function(e) { e.setFloat2("screenSize", l.width, l.height), e.setVector2("direction", l.direction), e.setFloat("blurWidth", l.kernel) }), l } return l.d(t, e), t }(Ht), mo = function(e) { function t(i, n, o) { var s = e.call(this, i, n) || this; return s.name = i, s.innerGlow = !0, s.outerGlow = !0, s.onBeforeBlurObservable = new r.c, s.onAfterBlurObservable = new r.c, s._instanceGlowingMeshStencilReference = t.GlowingMeshStencilReference++, s._meshes = {}, s._excludedMeshes = {}, s.neutralColor = t.NeutralColor, s._engine.isStencilEnable || p.a.Warn("Rendering the Highlight Layer requires the stencil to be active on the canvas. var engine = new Engine(canvas, antialias, { stencil: true }"), s._options = l.a({ mainTextureRatio: .5, blurTextureSizeRatio: .5, blurHorizontalSize: 1, blurVerticalSize: 1, alphaBlendingMode: _.a.ALPHA_COMBINE, camera: null, renderingGroupId: -1 }, o), s._init({ alphaBlendingMode: s._options.alphaBlendingMode, camera: s._options.camera, mainTextureFixedSize: s._options.mainTextureFixedSize, mainTextureRatio: s._options.mainTextureRatio, renderingGroupId: s._options.renderingGroupId }), s._shouldRender = !1, s } return l.d(t, e), Object.defineProperty(t.prototype, "blurHorizontalSize", { get: function() { return this._horizontalBlurPostprocess.kernel }, set: function(e) { this._horizontalBlurPostprocess.kernel = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "blurVerticalSize", { get: function() { return this._verticalBlurPostprocess.kernel }, set: function(e) { this._verticalBlurPostprocess.kernel = e }, enumerable: !0, configurable: !0 }), t.prototype.getEffectName = function() { return t.EffectName }, t.prototype._createMergeEffect = function() { return this._engine.createEffect("glowMapMerge", [Oi.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 ? ye.h.GetExponentOfTwo(t, this._maxSize) : t, i = this._engine.needPOTTextures ? ye.h.GetExponentOfTwo(i, this._maxSize) : i; var n = 0; n = this._engine.getCaps().textureHalfFloatRender ? _.a.TEXTURETYPE_HALF_FLOAT : _.a.TEXTURETYPE_UNSIGNED_INT, this._blurTexture = new _i("HighlightLayerBlurRTT", { width: t, height: i }, this._scene, !1, !0, n), this._blurTexture.wrapU = ke.a.CLAMP_ADDRESSMODE, this._blurTexture.wrapV = ke.a.CLAMP_ADDRESSMODE, this._blurTexture.anisotropicFilteringLevel = 16, this._blurTexture.updateSamplingMode(ke.a.TRILINEAR_SAMPLINGMODE), this._blurTexture.renderParticles = !1, this._blurTexture.ignoreCameraViewport = !0, this._textures = [this._blurTexture], this._options.alphaBlendingMode === _.a.ALPHA_COMBINE ? (this._downSamplePostprocess = new Yt("HighlightLayerPPP", this._options.blurTextureSizeRatio, null, ke.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine()), this._downSamplePostprocess.onApplyObservable.add(function(t) { t.setTexture("textureSampler", e._mainTexture) }), this._horizontalBlurPostprocess = new go("HighlightLayerHBP", new o.w(1, 0), this._options.blurHorizontalSize, 1, null, ke.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine()), this._horizontalBlurPostprocess.onApplyObservable.add(function(e) { e.setFloat2("screenSize", t, i) }), this._verticalBlurPostprocess = new go("HighlightLayerVBP", new o.w(0, 1), this._options.blurVerticalSize, 1, null, ke.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 $n("HighlightLayerHBP", new o.w(1, 0), this._options.blurHorizontalSize / 2, { width: t, height: i }, null, ke.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, n), this._horizontalBlurPostprocess.width = t, this._horizontalBlurPostprocess.height = i, this._horizontalBlurPostprocess.onApplyObservable.add(function(t) { t.setTexture("textureSampler", e._mainTexture) }), this._verticalBlurPostprocess = new $n("HighlightLayerVBP", new o.w(0, 1), this._options.blurVerticalSize / 2, { width: t, height: i }, null, ke.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, 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, !0), e.onAfterBlurObservable.notifyObservers(e) }), this._postProcesses.map(function(e) { e.autoClear = !1 }) }, t.prototype.needStencil = function() { return !0 }, t.prototype.isReady = function(t, i) { var n = t.getMaterial(), r = t.getRenderingMesh(); if (!n || !r || !this._meshes) return !1; var o = null, s = this._meshes[r.uniqueId]; return s && s.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.setStencilOperationPass(_.a.REPLACE), t.setStencilOperationFail(_.a.KEEP), t.setStencilOperationDepthFail(_.a.KEEP), t.setStencilMask(0), t.setStencilBuffer(!0), t.setStencilFunctionReference(this._instanceGlowingMeshStencilReference), this.outerGlow && (e.setFloat("offset", 0), t.setStencilFunction(_.a.NOTEQUAL), t.drawElementsType(so.a.TriangleFillMode, 0, 6)), this.innerGlow && (e.setFloat("offset", 1), t.setStencilFunction(_.a.EQUAL), t.drawElementsType(so.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(!1) }), afterRender: e.onAfterRenderObservable.add(function(e) { e.getEngine().setStencilBuffer(!0) }) })) }, 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 = !1), 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 = !0 } }, 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 = !1, this._meshes) if (this._meshes[i]) { this._shouldRender = !0; 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)) } this._excludedMeshes = null } e.prototype.dispose.call(this) }, t.prototype.getClassName = function() { return "HighlightLayer" }, t.prototype.serialize = function() { var e = L.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, s = L.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])) && s.addExcludedMesh(a) } for (r = 0; r < e.meshes.length; r++) { var a, c = e.meshes[r]; (a = i.getMeshByID(c.meshId)) && s.addMesh(a, o.e.FromArray(c.color), c.glowEmissiveOnly) } return s }, t.EffectName = "HighlightLayer", t.NeutralColor = new o.f(0, 0, 0, 0), t.GlowingMeshStencilReference = 2, t.NormalMeshStencilReference = 1, l.c([Object(L.c)()], t.prototype, "innerGlow", void 0), l.c([Object(L.c)()], t.prototype, "outerGlow", void 0), l.c([Object(L.c)()], t.prototype, "blurHorizontalSize", null), l.c([Object(L.c)()], t.prototype, "blurVerticalSize", null), l.c([Object(L.c)("options")], t.prototype, "_options", void 0), t }(lo); s.a.RegisteredTypes["BABYLON.HighlightLayer"] = mo; var vo = function() { function e(e) { this.name = Ae.a.NAME_LAYER, this.scene = e, this._engine = e.getEngine(), e.layers = new Array } return e.prototype.register = function() { this.scene._beforeCameraDrawStage.registerStep(Ae.a.STEP_BEFORECAMERADRAW_LAYER, this, this._drawCameraBackground), this.scene._afterCameraDrawStage.registerStep(Ae.a.STEP_AFTERCAMERADRAW_LAYER, this, this._drawCameraForeground), this.scene._beforeRenderTargetDrawStage.registerStep(Ae.a.STEP_BEFORERENDERTARGETDRAW_LAYER, this, this._drawRenderTargetBackground), this.scene._afterRenderTargetDrawStage.registerStep(Ae.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(!1); for (var i = 0, n = t; i < n.length; i++) { var r = n[i]; e(r) && r.render() } this._engine.setDepthBuffer(!0) } }, 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, !0, e.layerMask) }) }, e.prototype._drawCameraForeground = function(e) { var t = this; this._draw(function(i) { return t._drawCameraPredicate(i, !1, 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, !0, t.scene.activeCamera.layerMask, e) }) }, e.prototype._drawRenderTargetForeground = function(e) { var t = this; this._draw(function(i) { return t._drawRenderTargetPredicate(i, !1, t.scene.activeCamera.layerMask, e) }) }, e }(), yo = "\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}"; zt.a.ShadersStore.layerPixelShader = yo; var bo = "\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}"; zt.a.ShadersStore.layerVertexShader = bo; var To = function() { function e(e, t, i, n, s) { this.name = e, this.scale = new o.w(1, 1), this.offset = new o.w(0, 0), this.alphaBlendingMode = _.a.ALPHA_COMBINE, this.layerMask = 268435455, this.renderTargetTextures = [], this.renderOnlyInRenderTargetTextures = !1, this._vertexBuffers = {}, this.onDisposeObservable = new r.c, this.onBeforeRenderObservable = new r.c, this.onAfterRenderObservable = new r.c, this.texture = t ? new ke.a(t, i, !0) : null, this.isBackground = void 0 === n || n, this.color = void 0 === s ? new o.f(1, 1, 1, 1) : s, this._scene = i || P.a.LastCreatedScene; var a = this._scene._getComponent(Ae.a.NAME_LAYER); a || (a = new vo(this._scene), this._scene._addComponent(a)), this._scene.layers.push(this); var c = this._scene.getEngine(), l = []; l.push(1, 1), l.push(-1, 1), l.push(-1, -1), l.push(1, -1); var u = new Oi.b(c, l, Oi.b.PositionKind, !1, !1, 2); this._vertexBuffers[Oi.b.PositionKind] = u, this._createIndexBuffer(), this._effect = c.createEffect("layer", [Oi.b.PositionKind], ["textureMatrix", "color", "scale", "offset"], ["textureSampler"], ""), this._alphaTestEffect = c.createEffect("layer", [Oi.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "onBeforeRender", { set: function(e) { this._onBeforeRenderObserver && this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver), this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "onAfterRender", { set: function(e) { this._onAfterRenderObserver && this.onAfterRenderObservable.remove(this._onAfterRenderObserver), this._onAfterRenderObserver = this.onAfterRenderObservable.add(e) }, enumerable: !0, configurable: !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[Oi.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(!1), 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(so.a.TriangleFillMode, 0, 6) : (t.setAlphaMode(this.alphaBlendingMode), t.drawElementsType(so.a.TriangleFillMode, 0, 6), t.setAlphaMode(_.a.ALPHA_DISABLE)), this.onAfterRenderObservable.notifyObservers(this) } }, e.prototype.dispose = function() { var e = this._vertexBuffers[Oi.b.PositionKind]; e && (e.dispose(), this._vertexBuffers[Oi.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 }(), Eo = function() { function e(e, t, i, n, r) { this.size = e, this.position = t, this.alphaMode = _.a.ALPHA_ONEONE, this.color = i || new o.e(1, 1, 1), this.texture = n ? new ke.a(n, r.getScene(), !0) : 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 }(), Ao = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\ngl_FragColor=baseColor*color;\n}"; zt.a.ShadersStore.lensFlarePixelShader = Ao; var xo = "\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}"; zt.a.ShadersStore.lensFlareVertexShader = xo; var Ro = 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 = !0, this._scene = n || P.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[Oi.b.PositionKind] = new Oi.b(r, o, Oi.b.PositionKind, !1, !1, 2); var s = []; s.push(0), s.push(1), s.push(2), s.push(0), s.push(2), s.push(3), this._indexBuffer = r.createIndexBuffer(s), this._effect = r.createEffect("lensFlare", [Oi.b.PositionKind], ["color", "viewportMatrix"], ["textureSampler"], "") } return Object.defineProperty(e.prototype, "isEnabled", { get: function() { return this._isEnabled }, set: function(e) { this._isEnabled = e }, enumerable: !0, configurable: !0 }), 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 = o.x.Project(t, o.j.Identity(), this._scene.getTransformMatrix(), e), this._positionX = t.x, this._positionY = t.y, t = o.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), !0) }, e.prototype._isVisible = function() { if (!this._isEnabled || !this._scene.activeCamera) return !1; var e = this.getEmitterPosition().subtract(this._scene.activeCamera.globalPosition), t = e.length(); e.normalize(); var i = new It.a(this._scene.activeCamera.globalPosition, e), n = this._scene.pickWithRay(i, this.meshesSelectionPredicate, !0); return !n || !n.hit || n.distance > t }, e.prototype.render = function() { if (!this._effect.isReady() || !this._scene.activeCamera) return !1; var e, t, i = this._scene.getEngine(), n = this._scene.activeCamera.viewport.toGlobal(i.getRenderWidth(!0), i.getRenderHeight(!0)); if (!this.computeEffectivePosition(n)) return !1; if (!this._isVisible()) return !1; 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 s = 1 - D.a.Clamp(r / this.borderLimit, 0, 1); if (s < 0) return !1; s > 1 && (s = 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 a = n.x + n.width / 2, c = n.y + n.height / 2, l = a - this._positionX, u = c - this._positionY; i.enableEffect(this._effect), i.setState(!1), i.setDepthBuffer(!1), i.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect); for (var h = 0; h < this.lensFlares.length; h++) { var d = this.lensFlares[h]; i.setAlphaMode(d.alphaMode); var f = a - l * d.position, p = c - u * d.position, g = d.size, m = d.size * i.getAspectRatio(this._scene.activeCamera, !0), v = f / (n.width + 2 * n.x) * 2 - 1, y = 1 - p / (n.height + 2 * n.y) * 2, b = o.j.FromValues(g / 2, 0, 0, 0, 0, m / 2, 0, 0, 0, 0, 1, 0, v, y, 0, 1); this._effect.setMatrix("viewportMatrix", b), this._effect.setTexture("textureSampler", d.texture), this._effect.setFloat4("color", d.color.r * s, d.color.g * s, d.color.b * s, 1), i.drawElementsType(so.a.TriangleFillMode, 0, 6) } return i.setDepthBuffer(!0), i.setAlphaMode(_.a.ALPHA_DISABLE), !0 }, e.prototype.dispose = function() { var e = this._vertexBuffers[Oi.b.PositionKind]; for (e && (e.dispose(), this._vertexBuffers[Oi.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), s = t.name || "lensFlareSystem#" + t.emitterId, a = new e(s, r, i); a.id = t.id || s, a.borderLimit = t.borderLimit; for (var c = 0; c < t.flares.length; c++) { var l = t.flares[c]; Eo.AddFlare(l.size, l.position, o.e.FromArray(l.color), l.textureName ? n + l.textureName : "", a) } return a }, 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: ye.h.GetFilename(i.texture ? i.texture.name : "") }) } return e }, e._SceneComponentInitialization = function(e) { throw be.a.WarnImport("LensFlareSystemSceneComponent") }, e }(); n.a.AddParser(Ae.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 s = e.lensFlareSystems[r], a = Ro.Parse(s, t, n); i.lensFlareSystems.push(a) } } }), n.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 }, n.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 }, n.a.prototype.removeLensFlareSystem = function(e) { var t = this.lensFlareSystems.indexOf(e); return -1 !== t && this.lensFlareSystems.splice(t, 1), t }, n.a.prototype.addLensFlareSystem = function(e) { this.lensFlareSystems.push(e) }; var Po = function() { function e(e) { this.name = Ae.a.NAME_LENSFLARESYSTEM, this.scene = e, e.lensFlareSystems = new Array } return e.prototype.register = function() { this.scene._afterCameraDrawStage.registerStep(Ae.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; ye.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() } ye.h.EndPerformanceCounter("Lens flares", t.length > 0) } }, e }(); Ro._SceneComponentInitialization = function(e) { var t = e._getComponent(Ae.a.NAME_LENSFLARESYSTEM); t || (t = new Po(e), e._addComponent(t)) }; var So = "#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}"; zt.a.ShadersStore.shadowMapPixelShader = So; var Co = "\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}"; zt.a.ShadersStore.shadowMapVertexShader = Co; var Mo = "\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}"; zt.a.ShadersStore.depthBoxBlurPixelShader = Mo; var Oo = function() { function e(t, i, n) { this.onBeforeShadowMapRenderObservable = new r.c, this.onBeforeShadowMapRenderMeshObservable = new r.c, this._bias = 5e-5, this._normalBias = 0, this._blurBoxOffset = 1, this._blurScale = 2, this._blurKernel = 1, this._useKernelBlur = !1, this._filter = e.FILTER_NONE, this._filteringQuality = e.QUALITY_HIGH, this._contactHardeningLightSizeUVRatio = .1, this._darkness = 0, this._transparencyShadow = !1, this.frustumEdgeFalloff = 0, this.forceBackFacesOnly = !1, this._lightDirection = o.x.Zero(), this._viewMatrix = o.j.Zero(), this._projectionMatrix = o.j.Zero(), this._transformMatrix = o.j.Zero(), this._cachedPosition = new o.x(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), this._cachedDirection = new o.x(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), this._currentFaceIndex = 0, this._currentFaceIndexCache = 0, this._defaultTextureMatrix = o.j.Identity(), this._mapSize = t, this._light = i, this._scene = i.getScene(), i._shadowGenerator = this, e._SceneComponentInitialization(this._scene); var s = this._scene.getEngine().getCaps(); n ? s.textureFloatRender && s.textureFloatLinearFiltering ? this._textureType = _.a.TEXTURETYPE_FLOAT : s.textureHalfFloatRender && s.textureHalfFloatLinearFiltering ? this._textureType = _.a.TEXTURETYPE_HALF_FLOAT : this._textureType = _.a.TEXTURETYPE_UNSIGNED_INT : s.textureHalfFloatRender && s.textureHalfFloatLinearFiltering ? this._textureType = _.a.TEXTURETYPE_HALF_FLOAT : s.textureFloatRender && s.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "normalBias", { get: function() { return this._normalBias }, set: function(e) { this._normalBias = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "blurBoxOffset", { get: function() { return this._blurBoxOffset }, set: function(e) { this._blurBoxOffset !== e && (this._blurBoxOffset = e, this._disposeBlurPostProcesses()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "blurScale", { get: function() { return this._blurScale }, set: function(e) { this._blurScale !== e && (this._blurScale = e, this._disposeBlurPostProcesses()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "blurKernel", { get: function() { return this._blurKernel }, set: function(e) { this._blurKernel !== e && (this._blurKernel = e, this._disposeBlurPostProcesses()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "useKernelBlur", { get: function() { return this._useKernelBlur }, set: function(e) { this._useKernelBlur !== e && (this._useKernelBlur = e, this._disposeBlurPostProcesses()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "depthScale", { get: function() { return void 0 !== this._depthScale ? this._depthScale : this._light.getDepthScale() }, set: function(e) { this._depthScale = e }, enumerable: !0, configurable: !0 }), 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 = !0); if (t === e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP) return void(this.useCloseExponentialShadowMap = !0); if (t === e.FILTER_PCF || t === e.FILTER_PCSS) return void(this.usePoissonSampling = !0) } 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 = !0 }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "filteringQuality", { get: function() { return this._filteringQuality }, set: function(e) { this._filteringQuality = e }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "contactHardeningLightSizeUVRatio", { get: function() { return this._contactHardeningLightSizeUVRatio }, set: function(e) { this._contactHardeningLightSizeUVRatio = e }, enumerable: !0, configurable: !0 }), 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 = !0), 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 = !0), !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 _i(this._light.name + "_shadowMap", this._mapSize, this._scene, !1, !0, this._textureType, this._light.needCube(), void 0, !1, !1), this._shadowMap.createDepthStencilTexture(_.a.LESS, !0)) : this._shadowMap = new _i(this._light.name + "_shadowMap", this._mapSize, this._scene, !1, !0, this._textureType, this._light.needCube()), this._shadowMap.wrapU = ke.a.CLAMP_ADDRESSMODE, this._shadowMap.wrapV = ke.a.CLAMP_ADDRESSMODE, this._shadowMap.anisotropicFilteringLevel = 1, this._shadowMap.updateSamplingMode(ke.a.BILINEAR_SAMPLINGMODE), this._shadowMap.renderParticles = !1, this._shadowMap.ignoreCameraViewport = !0, this._shadowMap.onBeforeRenderObservable.add(function(n) { t._currentFaceIndex = n, t._filter === e.FILTER_PCF && i.setColorWrite(!1) }), this._shadowMap.customRenderFunction = this._renderForShadowMap.bind(this), this._shadowMap.onAfterUnbindObservable.add(function() { if (t._filter === e.FILTER_PCF && i.setColorWrite(!0), t.useBlurExponentialShadowMap || t.useBlurCloseExponentialShadowMap) { var n = t.getShadowMapForRendering(); n && t._scene.postProcessManager.directRender(t._blurPostProcesses, n.getInternalTexture(), !0) } }); var n = new o.f(0, 0, 0, 0), r = new o.f(1, 1, 1, 1); this._shadowMap.onClearObservable.add(function(i) { t._filter === e.FILTER_PCF ? i.clear(r, !1, !0, !1) : t.useExponentialShadowMap || t.useBlurExponentialShadowMap ? i.clear(n, !0, !0, !1) : i.clear(r, !0, !0, !1) }) }, e.prototype._initializeBlurRTTAndPostProcesses = function() { var e = this, t = this._scene.getEngine(), i = this._mapSize / this.blurScale; this.useKernelBlur && 1 === this.blurScale || (this._shadowMap2 = new _i(this._light.name + "_shadowMap2", i, this._scene, !1, !0, this._textureType), this._shadowMap2.wrapU = ke.a.CLAMP_ADDRESSMODE, this._shadowMap2.wrapV = ke.a.CLAMP_ADDRESSMODE, this._shadowMap2.updateSamplingMode(ke.a.BILINEAR_SAMPLINGMODE)), this.useKernelBlur ? (this._kernelBlurXPostprocess = new $n(this._light.name + "KernelBlurX", new o.w(1, 0), this.blurKernel, 1, null, ke.a.BILINEAR_SAMPLINGMODE, t, !1, this._textureType), this._kernelBlurXPostprocess.width = i, this._kernelBlurXPostprocess.height = i, this._kernelBlurXPostprocess.onApplyObservable.add(function(t) { t.setTexture("textureSampler", e._shadowMap) }), this._kernelBlurYPostprocess = new $n(this._light.name + "KernelBlurY", new o.w(0, 1), this.blurKernel, 1, null, ke.a.BILINEAR_SAMPLINGMODE, t, !1, this._textureType), this._kernelBlurXPostprocess.autoClear = !1, this._kernelBlurYPostprocess.autoClear = !1, this._textureType === _.a.TEXTURETYPE_UNSIGNED_INT && (this._kernelBlurXPostprocess.packedFloat = !0, this._kernelBlurYPostprocess.packedFloat = !0), this._blurPostProcesses = [this._kernelBlurXPostprocess, this._kernelBlurYPostprocess]) : (this._boxBlurPostprocess = new Ht(this._light.name + "DepthBoxBlur", "depthBoxBlur", ["screenSize", "boxOffset"], [], 1, null, ke.a.BILINEAR_SAMPLINGMODE, t, !1, "#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 = !1, this._blurPostProcesses = [this._boxBlurPostprocess]) }, e.prototype._renderForShadowMap = function(e, t, i, n) { var r, o = this._scene.getEngine(); if (n.length) { for (o.setColorWrite(!1), r = 0; r < n.length; r++) this._renderSubMeshForShadowMap(n.data[r]); o.setColorWrite(!0) } 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 = !1, o && 0 !== e.verticesCount) { r.setState(o.backFaceCulling); var s = i._getInstancesRenderList(e._id); if (!s.mustReturn) { var a = r.getCaps().instancedArrays && null !== s.visibleInstances[e._id] && void 0 !== s.visibleInstances[e._id]; if (this.isReady(e, a)) { if (r.enableEffect(this._effect), i._bind(e, this._effect, so.a.TriangleFillMode), this._effect.setFloat3("biasAndScale", this.bias, this.normalBias, this.depthScale), this._effect.setMatrix("viewProjection", this.getTransformMatrix()), this.getLight().getTypeID() === zn.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 l = i.skeleton; if (l.isUsingTextureForMatrices) { var u = l.getTransformMatrixTexture(); if (!u) return; this._effect.setTexture("boneSampler", u), this._effect.setFloat("boneTextureWidth", 4 * (l.bones.length + 1)) } else this._effect.setMatrices("mBones", l.getTransformMatrices(i)) } ir.a.BindMorphTargetParameters(i, this._effect), this.forceBackFacesOnly && r.setState(!0, 0, !1, !0), this.onBeforeShadowMapRenderMeshObservable.notifyObservers(i), this.onBeforeShadowMapRenderObservable.notifyObservers(this._effect), i._processRendering(e, this._effect, so.a.TriangleFillMode, s, a, function(e, i) { return t._effect.setMatrix("world", i) }), this.forceBackFacesOnly && r.setState(!0, 0, !1, !1) } 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(ke.a.NEAREST_SAMPLINGMODE) : this._shadowMap.updateSamplingMode(ke.a.BILINEAR_SAMPLINGMODE)) }, e.prototype.forceCompilation = function(e, t) { var i = this, n = l.a({ useInstances: !1 }, t), r = this.getShadowMap(); if (r) { var o = r.renderList; if (o) { for (var s = new Array, a = 0, c = o; a < c.length; a++) { var u = c[a]; s.push.apply(s, u.subMeshes) } if (0 !== s.length) { var h = 0, d = function() { if (i._scene && i._scene.getEngine()) { for (; i.isReady(s[h], n.useInstances);) if (++h >= s.length) return void(e && e(i)); setTimeout(d, 16) } }; d() } else e && e(this) } else e && e(this) } else e && e(this) }, e.prototype.forceCompilationAsync = function(e) { var t = this; return new Promise(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 = [Oi.b.PositionKind], r = e.getMesh(), o = e.getMaterial(); if (this.normalBias && r.isVerticesDataPresent(Oi.b.NormalKind) && (n.push(Oi.b.NormalKind), i.push("#define NORMAL"), r.nonUniformScaling && i.push("#define NONUNIFORMSCALING"), this.getLight().getTypeID() === zn.a.LIGHTTYPEID_DIRECTIONALLIGHT && i.push("#define DIRECTIONINLIGHTDATA")), o && o.needAlphaTesting()) { var s = o.getAlphaTestTexture(); s && (i.push("#define ALPHATEST"), r.isVerticesDataPresent(Oi.b.UVKind) && (n.push(Oi.b.UVKind), i.push("#define UV1")), r.isVerticesDataPresent(Oi.b.UV2Kind) && 1 === s.coordinatesIndex && (n.push(Oi.b.UV2Kind), i.push("#define UV2"))) } if (r.useBones && r.computeBonesUsingShaders && r.skeleton) { n.push(Oi.b.MatricesIndicesKind), n.push(Oi.b.MatricesWeightsKind), r.numBoneInfluencers > 4 && (n.push(Oi.b.MatricesIndicesExtraKind), n.push(Oi.b.MatricesWeightsExtraKind)); var a = r.skeleton; i.push("#define NUM_BONE_INFLUENCERS " + r.numBoneInfluencers), a.isUsingTextureForMatrices ? i.push("#define BONETEXTURE") : i.push("#define BonesPerMesh " + (a.bones.length + 1)) } else i.push("#define NUM_BONE_INFLUENCERS 0"); var c = r.morphTargetManager, l = 0; if (c && c.numInfluencers > 0 && (i.push("#define MORPHTARGETS"), l = c.numInfluencers, i.push("#define NUM_MORPH_INFLUENCERS " + l), ir.a.PrepareAttributesForMorphTargets(n, r, { NUM_MORPH_INFLUENCERS: l })), t && (i.push("#define INSTANCES"), n.push("world0"), n.push("world1"), n.push("world2"), n.push("world3")), this.customShaderOptions && this.customShaderOptions.defines) for (var u = 0, h = this.customShaderOptions.defines; u < h.length; u++) { var d = h[u]; - 1 === i.indexOf(d) && i.push(d) } var f = i.join("\n"); if (this._cachedDefines !== f) { this._cachedDefines = f; var p = "shadowMap", g = ["world", "mBones", "viewProjection", "diffuseMatrix", "lightData", "depthValues", "biasAndScale", "morphTargetInfluences", "boneTextureWidth"], m = ["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 T = 0, E = this.customShaderOptions.uniforms; T < E.length; T++) { var A = E[T]; - 1 === g.indexOf(A) && g.push(A) } if (this.customShaderOptions.samplers) for (var x = 0, R = this.customShaderOptions.samplers; x < R.length; x++) { var P = R[x]; - 1 === m.indexOf(P) && m.push(P) } } this._effect = this._scene.getEngine().createEffect(p, n, g, m, f, void 0, void 0, void 0, { maxSimultaneousMorphTargets: l }) } 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] = !0, this.useContactHardeningShadow && (t["SHADOWPCSS" + i] = !0, this._filteringQuality === e.QUALITY_LOW ? t["SHADOWLOWQUALITY" + i] = !0 : this._filteringQuality === e.QUALITY_MEDIUM && (t["SHADOWMEDIUMQUALITY" + i] = !0)), this.usePercentageCloserFiltering ? (t["SHADOWPCF" + i] = !0, this._filteringQuality === e.QUALITY_LOW ? t["SHADOWLOWQUALITY" + i] = !0 : this._filteringQuality === e.QUALITY_MEDIUM && (t["SHADOWMEDIUMQUALITY" + i] = !0)) : this.usePoissonSampling ? t["SHADOWPOISSON" + i] = !0 : this.useExponentialShadowMap || this.useBlurExponentialShadowMap ? t["SHADOWESM" + i] = !0 : (this.useCloseExponentialShadowMap || this.useBlurCloseExponentialShadowMap) && (t["SHADOWCLOSEESM" + i] = !0), r.needCube() && (t["SHADOWCUBE" + i] = !0)) }, 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 s = this.getShadowMap(); s && (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(), s.getSize().width, 1 / s.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 / s.getSize().width, this._contactHardeningLightSizeUVRatio * s.getSize().width, this.frustumEdgeFalloff, t)) : (i.setTexture("shadowSampler" + t, this.getShadowMapForRendering()), n._uniformBuffer.updateFloat4("shadowsInfo", this.getDarkness(), this.blurScale / s.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), o.x.NormalizeToRef(this._light.getShadowDirection(this._currentFaceIndex), this._lightDirection), 1 === Math.abs(o.x.Dot(this._lightDirection, o.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), o.j.LookAtLHToRef(t, t.add(this._lightDirection), o.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 }, 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(), s = 0; s < t.renderList.length; s++) { i.getMeshesByID(t.renderList[s]).forEach(function(e) { o && (o.renderList || (o.renderList = []), o.renderList.push(e)) }) } return t.usePoissonSampling ? r.usePoissonSampling = !0 : t.useExponentialShadowMap ? r.useExponentialShadowMap = !0 : t.useBlurExponentialShadowMap ? r.useBlurExponentialShadowMap = !0 : t.useCloseExponentialShadowMap ? r.useCloseExponentialShadowMap = !0 : t.useBlurCloseExponentialShadowMap ? r.useBlurCloseExponentialShadowMap = !0 : t.usePercentageCloserFiltering ? r.usePercentageCloserFiltering = !0 : t.useContactHardeningShadow && (r.useContactHardeningShadow = !0), t.filteringQuality && (r.filteringQuality = t.filteringQuality), t.contactHardeningLightSizeUVRatio ? r.contactHardeningLightSizeUVRatio = t.contactHardeningLightSizeUVRatio : t.useVarianceShadowMap ? r.useExponentialShadowMap = !0 : t.useBlurVarianceShadowMap && (r.useBlurExponentialShadowMap = !0), 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(!0), 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 be.a.WarnImport("ShadowGeneratorSceneComponent") }, e }(); n.a.AddParser(Ae.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]; Oo.Parse(r, t) } }); var Io = function() { function e(e) { this.name = Ae.a.NAME_SHADOWGENERATOR, this.scene = e } return e.prototype.register = function() { this.scene._gatherRenderTargetsStage.registerStep(Ae.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 }(); Oo._SceneComponentInitialization = function(e) { var t = e._getComponent(Ae.a.NAME_SHADOWGENERATOR); t || (t = new Io(e), e._addComponent(t)) }, F.a.AddNodeConstructor("Light_Type_0", function(e, t) { return function() { return new Do(e, o.x.Zero(), t) } }); var Do = 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 l.d(t, e), Object.defineProperty(t.prototype, "shadowAngle", { get: function() { return this._shadowAngle }, set: function(e) { this._shadowAngle = e, this.forceProjectionMatrixCompute() }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), t.prototype.getClassName = function() { return "PointLight" }, t.prototype.getTypeID = function() { return zn.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 o.x(1, 0, 0); case 1: return new o.x(-1, 0, 0); case 2: return new o.x(0, -1, 0); case 3: return new o.x(0, 1, 0); case 4: return new o.x(0, 0, 1); case 5: return new o.x(0, 0, -1) } return o.x.Zero() }, t.prototype._setDefaultShadowProjectionMatrix = function(e, t, i) { var n = this.getScene().activeCamera; n && o.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 }, t.prototype.prepareLightSpecificDefines = function(e, t) { e["POINTLIGHT" + t] = !0 }, l.c([Object(L.c)()], t.prototype, "shadowAngle", null), t }(jn), Lo = 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; if (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 }, set: function(e) { this._loadingText = e, this._loadingTextDiv && (this._loadingTextDiv.innerHTML = this._loadingText) }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), e.DefaultLogoUrl = "", e.DefaultSpinnerUrl = "", e }(); ge.b.DefaultLoadingScreenFactory = function(e) { return new Lo(e) }; var wo = i(57), Fo = i(66), No = 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: !1 } }, e.CreateCubemapTexture = function(e, t, i, n, r) { for (var o = new ArrayBuffer(e * e * 4 * 3), s = new Float32Array(o), a = t[1].subtract(t[0]).scale(1 / e), c = t[3].subtract(t[2]).scale(1 / e), l = 1 / e, u = 0, h = 0; h < e; h++) { for (var d = t[0], f = t[2], p = 0; p < e; p++) { var _ = f.subtract(d).scale(u).add(d); _.normalize(); var g = this.CalcProjectionSpherical(_, i, n, r); s[h * e * 3 + 3 * p + 0] = g.r, s[h * e * 3 + 3 * p + 1] = g.g, s[h * e * 3 + 3 * p + 2] = g.b, d = d.add(a), f = f.add(c) } u += l } return s }, 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 s = r / Math.PI, a = o / Math.PI; s = .5 * s + .5; var c = Math.round(s * i); c < 0 ? c = 0 : c >= i && (c = i - 1); var l = Math.round(a * n); l < 0 ? l = 0 : l >= n && (l = n - 1); var u = n - l - 1; return { r: t[u * i * 3 + 3 * c + 0], g: t[u * i * 3 + 3 * c + 1], b: t[u * i * 3 + 3 * c + 2] } }, e.FACE_FRONT = [new o.x(-1, -1, -1), new o.x(1, -1, -1), new o.x(-1, 1, -1), new o.x(1, 1, -1)], e.FACE_BACK = [new o.x(1, -1, 1), new o.x(-1, -1, 1), new o.x(1, 1, 1), new o.x(-1, 1, 1)], e.FACE_RIGHT = [new o.x(1, -1, -1), new o.x(1, -1, 1), new o.x(1, 1, -1), new o.x(1, 1, 1)], e.FACE_LEFT = [new o.x(-1, -1, 1), new o.x(-1, -1, -1), new o.x(-1, 1, 1), new o.x(-1, 1, -1)], e.FACE_DOWN = [new o.x(-1, 1, -1), new o.x(1, 1, -1), new o.x(-1, 1, 1), new o.x(1, 1, 1)], e.FACE_UP = [new o.x(-1, -1, 1), new o.x(1, -1, 1), new o.x(-1, -1, -1), new o.x(1, -1, -1)], e }(), Bo = 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 = !1, o = !1, s = 0; do { s += n.length + 1, "FORMAT=32-bit_rle_rgbe" == (n = this.readStringLine(e, s)) ? o = !0 : 0 == n.length && (r = !0) } while (!r); if (!o) throw "HDR Bad header format, unsupported FORMAT"; s += n.length + 1, n = this.readStringLine(e, s); var a = /^\-Y (.*) \+X (.*)$/g.exec(n); if (!a || a.length < 3) throw "HDR Bad header format, no size"; if (i = parseInt(a[2]), t = parseInt(a[1]), i < 8 || i > 32767) throw "HDR Bad header format, unsupported size"; return { height: t, width: i, dataPosition: s += 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 No.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, s, a = t.height, c = t.width, l = t.dataPosition, u = 0, h = 0, d = 0, f = new ArrayBuffer(4 * c), p = new Uint8Array(f), _ = new ArrayBuffer(t.width * t.height * 4 * 3), g = new Float32Array(_); a > 0;) { if (i = e[l++], n = e[l++], r = e[l++], o = e[l++], 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 (u = 0, d = 0; d < 4; d++) for (h = (d + 1) * c; u < h;) if (i = e[l++], n = e[l++], i > 128) { if (0 == (s = i - 128) || s > h - u) throw "HDR Bad Format, bad scanline data (run)"; for (; s-- > 0;) p[u++] = n } else { if (0 == (s = i) || s > h - u) throw "HDR Bad Format, bad scanline data (non-run)"; if (p[u++] = n, --s > 0) for (var m = 0; m < s; m++) p[u++] = e[l++] } for (d = 0; d < c; d++) i = p[d], n = p[d + c], r = p[d + 2 * c], o = p[d + 3 * c], this.Rgbe2float(g, i, n, r, o, (t.height - a) * c * 3 + 3 * d); a-- } return g }, e }(), Uo = function(e) { function t(t, i, n, r, s, a, c, l, u) { void 0 === r && (r = !1), void 0 === s && (s = !0), void 0 === a && (a = !1), void 0 === c && (c = !1), void 0 === l && (l = null), void 0 === u && (u = null); var h = e.call(this, i) || this; return h._generateHarmonics = !0, h._onLoad = null, h._onError = null, h.coordinatesMode = ke.a.CUBIC_MODE, h._isBlocking = !0, h._rotationY = 0, h.boundingBoxPosition = o.x.Zero(), t ? (h.name = t, h.url = t, h.hasAlpha = !1, h.isCube = !0, h._textureMatrix = o.j.Identity(), h._onLoad = l, h._onError = u, h.gammaSpace = a, h._noMipmap = r, h._size = n, h._texture = h._getFromCache(t, h._noMipmap), h._texture ? l && (h._texture.isReady ? ye.h.SetImmediate(function() { return l() }) : h._texture.onLoadedObservable.add(l)) : i.useDelayedTextureLoading ? h.delayLoadState = ge.b.DELAYLOADSTATE_NOTLOADED : h.loadTexture(), h) : h } return l.d(t, e), Object.defineProperty(t.prototype, "isBlocking", { get: function() { return this._isBlocking }, set: function(e) { this._isBlocking = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "rotationY", { get: function() { return this._rotationY }, set: function(e) { this._rotationY = e, this.setReflectionTextureMatrix(o.j.RotationY(this._rotationY)) }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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, ge.b.TEXTUREFORMAT_RGB, i.getEngine().getCaps().textureFloat ? ge.b.TEXTURETYPE_FLOAT : ge.b.TEXTURETYPE_UNSIGNED_INT, this._noMipmap, function(i) { e.lodGenerationOffset = 0, e.lodGenerationScale = .8; var n = e.getScene(); if (!n) return null; var r = Bo.GetCubeMapTextureData(i, e._size); if (e._generateHarmonics) { var s = jr.a.ConvertCubeMapToSphericalPolynomial(r); e.sphericalPolynomial = s } for (var a = [], c = null, l = 0; l < 6; l++) { if (!n.getEngine().getCaps().textureFloat) { var u = new ArrayBuffer(e._size * e._size * 3); c = new Uint8Array(u) } var h = r[t._facesMapping[l]]; if (e.gammaSpace || c) for (var d = 0; d < e._size * e._size; d++) if (e.gammaSpace && (h[3 * d + 0] = Math.pow(h[3 * d + 0], o.u), h[3 * d + 1] = Math.pow(h[3 * d + 1], o.u), h[3 * d + 2] = Math.pow(h[3 * d + 2], o.u)), c) { var f = Math.max(255 * h[3 * d + 0], 0), p = Math.max(255 * h[3 * d + 1], 0), _ = Math.max(255 * h[3 * d + 2], 0), g = Math.max(Math.max(f, p), _); if (g > 255) { var m = 255 / g; f *= m, p *= m, _ *= m } c[3 * d + 0] = f, c[3 * d + 1] = p, c[3 * d + 2] = _ } c ? a.push(c) : a.push(h) } return a }, 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 === ge.b.DELAYLOADSTATE_NOTLOADED && (this.delayLoadState = ge.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 = o.x.FromArray(e.boundingBoxPosition)), e.boundingBoxSize && (r.boundingBoxSize = o.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 = !0, 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 }(Kn.a); s.a.RegisteredTypes["BABYLON.HDRCubeTexture"] = Uo; var Vo = 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 r.c, this._onDataLayoutChanged = new r.c, this._animationPropertiesOverride = null, this._scene = i || P.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "animationPropertiesOverride", { get: function() { return !this._animationPropertiesOverride && this._scene ? this._scene.animationPropertiesOverride : this._animationPropertiesOverride }, set: function(e) { this._animationPropertiesOverride = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "hasPositions", { get: function() { return !!this._positions }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "hasNormals", { get: function() { return !!this._normals }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "hasTangents", { get: function() { return !!this._tangents }, enumerable: !0, configurable: !0 }), 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())), L.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), 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(Oi.b.PositionKind)), t.isVerticesDataPresent(Oi.b.NormalKind) && r.setNormals(t.getVerticesData(Oi.b.NormalKind)), t.isVerticesDataPresent(Oi.b.TangentKind) && r.setTangents(t.getVerticesData(Oi.b.TangentKind)), r }, l.c([Object(L.c)()], e.prototype, "id", void 0), e }(), Go = function() { function e(e) { void 0 === e && (e = null), this._targets = new Array, this._targetInfluenceChangedObservers = new Array, this._targetDataLayoutChangedObservers = new Array, this._activeTargets = new kt.a(16), this._supportsNormals = !1, this._supportsTangents = !1, this._vertexCount = 0, this._uniqueId = 0, this._tempInfluences = new Array, e || (e = P.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "vertexCount", { get: function() { return this._vertexCount }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "supportsNormals", { get: function() { return this._supportsNormals }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "supportsTangents", { get: function() { return this._supportsTangents }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "numTargets", { get: function() { return this._targets.length }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "numInfluencers", { get: function() { return this._activeTargets.length }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "influences", { get: function() { return this._influences }, enumerable: !0, configurable: !0 }), 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(!0) })), this._syncActiveTargets(!0) }, 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(!0)) }, 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 = !0, this._supportsTangents = !0, 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 s = o.length / 3; if (0 === this._vertexCount) this._vertexCount = s; else if (this._vertexCount !== s) return void p.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 a = 0; a < t; a++) this._influences[a] = this._tempInfluences[a]; 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 s = o[r]; n.addTarget(Vo.Parse(s)) } return n }, e }(), ko = i(27), zo = i(37), jo = 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 o.x(0, -9.807, 0), this.setGravity(t), this.setTimeStep() } return e.DefaultPluginFactory = function() { throw be.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, e }(), Ho = function() { function e() { this._hasHit = !1, this._hitDistance = 0, this._hitNormalWorld = o.x.Zero(), this._hitPointWorld = o.x.Zero(), this._rayFromWorld = o.x.Zero(), this._rayToWorld = o.x.Zero() } return Object.defineProperty(e.prototype, "hasHit", { get: function() { return this._hasHit }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "hitDistance", { get: function() { return this._hitDistance }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "hitNormalWorld", { get: function() { return this._hitNormalWorld }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "hitPointWorld", { get: function() { return this._hitPointWorld }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "rayFromWorld", { get: function() { return this._rayFromWorld }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "rayToWorld", { get: function() { return this._rayToWorld }, enumerable: !0, configurable: !0 }), e.prototype.setHitData = function(e, t) { this._hasHit = !0, this._hitNormalWorld = new o.x(e.x, e.y, e.z), this._hitPointWorld = new o.x(t.x, t.y, t.z) }, e.prototype.setHitDistance = function(e) { this._hitDistance = e }, e.prototype.calculateHitDistance = function() { this._hitDistance = o.x.Distance(this._rayFromWorld, this._hitPointWorld) }, e.prototype.reset = function(e, t) { void 0 === e && (e = o.x.Zero()), void 0 === t && (t = o.x.Zero()), this._rayFromWorld = e, this._rayToWorld = t, this._hasHit = !1, this._hitDistance = 0, this._hitNormalWorld = o.x.Zero(), this._hitPointWorld = o.x.Zero() }, e }(), Wo = function() { function e(e, t, i) { void 0 === e && (e = !0), 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 o.q(-.7071067811865475, 0, 0, .7071067811865475), this._plus90X = new o.q(.7071067811865475, 0, 0, .7071067811865475), this._tmpPosition = o.x.Zero(), this._tmpDeltaPosition = o.x.Zero(), this._tmpUnityRotation = new o.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 Ho) : p.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; ig.useTheCorrectBabylon = true; this.world.step(this._fixedTimeStep, this._useDeltaForWorldStep ? e * ig.gameScene.physicsDeltaFactor : 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 s in o) o.hasOwnProperty(s) && (r[s] = o[s]); 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) } }, e.prototype._processChildMeshes = function(e) { var t = this, i = e.object.getChildMeshes ? e.object.getChildMeshes(!0) : [], n = e.object.rotationQuaternion; if (i.length) { var r = function(i, s) { if (n && s.rotationQuaternion) { var a = s.getPhysicsImpostor(); if (a) if (a.parent !== e) { var c = s.getAbsolutePosition().subtract(e.object.getAbsolutePosition()), l = s.rotationQuaternion.multiply(o.q.Inverse(n)); a.physicsBody && (t.removePhysicsBody(a), a.physicsBody = null), a.parent = e, a.resetUpdateFlags(), e.physicsBody.addShape(t._createShape(a), new t.BJSCANNON.Vec3(c.x, c.y, c.z), new t.BJSCANNON.Quaternion(l.x, l.y, l.z, l.w)), e.physicsBody.mass += a.getParam("mass") } n.multiplyInPlace(s.rotationQuaternion), s.getChildMeshes(!0).filter(function(e) { return !!e.physicsImpostor }).forEach(r.bind(t, s.getAbsolutePosition())) } }; i.filter(function(e) { return !!e.physicsImpostor }).forEach(r.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 zo.e.HingeJoint: case zo.e.Hinge2Joint: n = new this.BJSCANNON.HingeConstraint(t, i, o); break; case zo.e.DistanceJoint: n = new this.BJSCANNON.DistanceConstraint(t, i, r.maxDistance || 2); break; case zo.e.SpringJoint: var s = r; n = new this.BJSCANNON.Spring(t, i, { restLength: s.length, stiffness: s.stiffness, damping: s.damping, localAnchorA: o.pivotA, localAnchorB: o.pivotB }); break; case zo.e.LockJoint: n = new this.BJSCANNON.LockConstraint(t, i, o); break; case zo.e.PointToPointJoint: case zo.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 !== zo.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 !== zo.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 < jo.Epsilon ? jo.Epsilon : e }, e.prototype._createShape = function(e) { var t, i = e.object, n = e.getObjectExtendSize(); switch (e.type) { case ko.a.SphereImpostor: var r = n.x, s = n.y, a = n.z; t = new this.BJSCANNON.Sphere(Math.max(this._checkWithEpsilon(r), this._checkWithEpsilon(s), this._checkWithEpsilon(a)) / 2); break; case ko.a.CylinderImpostor: var c = e.getParam("nativeOptions"); c || (c = {}); var l = void 0 !== c.radiusTop ? c.radiusTop : this._checkWithEpsilon(n.x) / 2, u = void 0 !== c.radiusBottom ? c.radiusBottom : this._checkWithEpsilon(n.x) / 2, h = void 0 !== c.height ? c.height : this._checkWithEpsilon(n.y), d = void 0 !== c.numSegments ? c.numSegments : 16; t = new this.BJSCANNON.Cylinder(l, u, h, d); var f = new this.BJSCANNON.Quaternion; f.setFromAxisAngle(new this.BJSCANNON.Vec3(1, 0, 0), -Math.PI / 2); var _ = new this.BJSCANNON.Vec3(0, 0, 0); t.transformAllPoints(_, f); break; case ko.a.BoxImpostor: var g = n.scale(.5); t = new this.BJSCANNON.Box(new this.BJSCANNON.Vec3(this._checkWithEpsilon(g.x), this._checkWithEpsilon(g.y), this._checkWithEpsilon(g.z))); break; case ko.a.PlaneImpostor: p.a.Warn("Attention, PlaneImposter might not behave as you expect. Consider using BoxImposter instead"), t = new this.BJSCANNON.Plane; break; case ko.a.MeshImpostor: var m = i.getVerticesData ? i.getVerticesData(Oi.b.PositionKind) : [], v = i.getIndices ? i.getIndices() : []; if (!m) return; var y = i.position.clone(), b = i.rotation && i.rotation.clone(), T = 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 E, A = i.computeWorldMatrix(!0), x = new Array; for (E = 0; E < m.length; E += 3) o.x.TransformCoordinates(o.x.FromArray(m, E), A).toArray(x, E); p.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), T && i.rotationQuaternion && i.rotationQuaternion.copyFrom(T); break; case ko.a.HeightmapImpostor: var R = i.position.clone(), P = i.rotation && i.rotation.clone(), S = 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.position.copyFrom(R), P && i.rotation && i.rotation.copyFrom(P), S && i.rotationQuaternion && i.rotationQuaternion.copyFrom(S), i.computeWorldMatrix(!0); break; case ko.a.ParticleImpostor: t = new this.BJSCANNON.Particle; break; case ko.a.NoImpostor: 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(Oi.b.PositionKind), r = e.computeWorldMatrix(!0), s = new Array; for (i = 0; i < n.length; i += 3) o.x.TransformCoordinates(o.x.FromArray(n, i), r).toArray(s, i); n = s; for (var a = new Array, c = t || ~~(Math.sqrt(n.length / 3) - 1), l = e.getBoundingInfo(), u = Math.min(l.boundingBox.extendSizeWorld.x, l.boundingBox.extendSizeWorld.y), h = l.boundingBox.extendSizeWorld.z, d = 2 * u / c, f = 0; f < n.length; f += 3) { var p = Math.round(n[f + 0] / d + c / 2), _ = Math.round(-1 * (n[f + 1] / d - c / 2)), g = -n[f + 2] + h; a[p] || (a[p] = []), a[p][_] || (a[p][_] = g), a[p][_] = Math.max(g, a[p][_]) } for (p = 0; p <= c; ++p) { if (!a[p]) { for (var m = 1; !a[(p + m) % c];) m++; a[p] = a[(p + m) % c].slice() } for (_ = 0; _ <= c; ++_) if (!a[p][_]) { var v; for (m = 1; void 0 === v;) v = a[p][(_ + m++) % c]; a[p][_] = v } } var y = new this.BJSCANNON.Heightfield(a, { elementSize: d }); return y.minY = h, y }, e.prototype._updatePhysicsBodyTransformation = function(e) { var t = e.object; if (t.computeWorldMatrix && t.computeWorldMatrix(!0), 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 !== ko.a.PlaneImpostor && e.type !== ko.a.HeightmapImpostor || (n = n.multiply(this._minus90X), e.setDeltaRotation(this._plus90X)), e.type === ko.a.HeightmapImpostor) { var r = t, s = r.getBoundingInfo(), a = r.rotationQuaternion; r.rotationQuaternion = this._tmpUnityRotation, r.computeWorldMatrix(!0); var c = i.clone(), l = r.getPivotMatrix(); l = l ? l.clone() : o.j.Identity(); var u = o.j.Translation(s.boundingBox.extendSizeWorld.x, 0, -s.boundingBox.extendSizeWorld.z); r.setPreTransformMatrix(u), r.computeWorldMatrix(!0); var h = s.boundingBox.centerWorld.subtract(i).subtract(r.position).negate(); this._tmpPosition.copyFromFloats(h.x, h.y - s.boundingBox.extendSizeWorld.y, h.z), this._tmpDeltaPosition.copyFrom(s.boundingBox.centerWorld.subtract(c)), this._tmpDeltaPosition.y += s.boundingBox.extendSizeWorld.y, r.rotationQuaternion = a, r.setPreTransformMatrix(l), r.computeWorldMatrix(!0) } else e.type === ko.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 o.x(t.x, t.y, t.z) : null }, e.prototype.getAngularVelocity = function(e) { var t = e.physicsBody.angularVelocity; return t ? new o.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 s = performance.now(), a = 0; a !== o && (this.internalStep(i), !(performance.now() - s > 1e3 * i)); a++); this.time += n; for (var c = this.time % i / i, l = e, u = this.bodies, h = 0; h !== u.length; h++) { var d = u[h]; d.type !== t.Body.STATIC && d.sleepState !== t.Body.SLEEPING ? (d.position.vsub(d.previousPosition, l), l.scale(c, l), d.position.vadd(l, d.interpolatedPosition)) : (d.interpolatedPosition.copy(d.position), d.interpolatedQuaternion.copy(d.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 }(); jo.DefaultPluginFactory = function() { return new Wo }; var Xo = function() { function e(e, t) { void 0 === t && (t = OIMO), this.name = "OimoJSPlugin", this._tmpImpostorsArray = [], this._tmpPositionVector = o.x.Zero(), this.BJSOIMO = t, this.world = new this.BJSOIMO.World({ iterations: e }), this.world.clear(), this._raycastResult = new Ho } 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) { p.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]; (a = e.object).getChildMeshes && a.getChildMeshes().forEach(function(e) { e.physicsImpostor && n.push(e.physicsImpostor) }); var r = function(e) { return Math.max(e, jo.Epsilon) }, s = new o.q; n.forEach(function(n) { if (n.object.rotationQuaternion) { var o = n.object.rotationQuaternion; s = o.clone(); var a = o.toEulerAngles(), c = n.getObjectExtendSize(); if (n === e) { var l = e.getObjectCenter(); e.object.getAbsolutePivotPoint().subtractToRef(l, t._tmpPositionVector), t._tmpPositionVector.divideInPlace(e.object.scaling), i.pos.push(l.x), i.pos.push(l.y), i.pos.push(l.z), i.posShape.push(0, 0, 0), i.rotShape.push(0, 0, 0) } else { var u = n.object.getAbsolutePosition().subtract(e.object.getAbsolutePosition()); i.posShape.push(u.x), i.posShape.push(u.y), i.posShape.push(u.z), i.pos.push(0, 0, 0), i.rotShape.push(57.29577951308232 * a.x), i.rotShape.push(57.29577951308232 * a.y), i.rotShape.push(57.29577951308232 * a.z) } switch (n.type) { case ko.a.ParticleImpostor: p.a.Warn("No Particle support in OIMO.js. using SphereImpostor instead"); case ko.a.SphereImpostor: var h = c.x, d = c.y, f = c.z, _ = Math.max(r(h), r(d), r(f)) / 2; i.type.push("sphere"), i.size.push(_), i.size.push(_), i.size.push(_); break; case ko.a.CylinderImpostor: var g = r(c.x) / 2, m = r(c.y); i.type.push("cylinder"), i.size.push(g), i.size.push(m), i.size.push(m); break; case ko.a.PlaneImpostor: case ko.a.BoxImpostor: default: g = r(c.x), m = r(c.y); var v = r(c.z); i.type.push("box"), i.size.push(g), i.size.push(m), i.size.push(v) } n.object.rotationQuaternion = o } }), e.physicsBody = this.world.add(i), e.physicsBody.resetQuaternion(s), e.physicsBody.updatePosition(0) } else this._tmpPositionVector.copyFromFloats(0, 0, 0); var a; 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 || {}, s = { 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 zo.e.BallAndSocketJoint: n = "jointBall"; break; case zo.e.SpringJoint: p.a.Warn("OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead"); var a = r; s.min = a.length || s.min, s.max = Math.max(s.min, s.max); case zo.e.DistanceJoint: n = "jointDistance", s.max = r.maxDistance; break; case zo.e.PrismaticJoint: n = "jointPrisme"; break; case zo.e.SliderJoint: n = "jointSlide"; break; case zo.e.WheelJoint: n = "jointWheel"; break; case zo.e.HingeJoint: default: n = "jointHinge" } s.type = n, e.joint.physicsJoint = this.world.add(s) } }, e.prototype.removeJoint = function(e) { try { this.world.removeJoint(e.joint.physicsJoint) } catch (e) { p.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 o.x(t.x, t.y, t.z) : null }, e.prototype.getAngularVelocity = function(e) { var t = e.physicsBody.angularVelocity; return t ? new o.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 ? p.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 p.a.Warn("raycast is not currently supported by the Oimo physics plugin"), this._raycastResult.reset(e, t), this._raycastResult }, e }(); Mi.a.CreateRibbon = function(e) { var t = e.pathArray, i = e.closeArray || !1, n = e.closePath || !1, r = e.invertUV || !1, o = Math.floor(t[0].length / 2), s = e.offset || o; s = s > o ? o : Math.floor(s); var a, c, l, u, h = 0 === e.sideOrientation ? 0 : e.sideOrientation || Mi.a.DEFAULTSIDE, d = e.uvs, f = e.colors, p = [], _ = [], g = [], m = [], v = [], y = [], b = [], T = [], E = [], A = []; if (t.length < 2) { var x = [], R = []; for (l = 0; l < t[0].length - s; l++) x.push(t[0][l]), R.push(t[0][l + s]); t = [x, R] } var P, S, C, M, O, I = 0, D = n ? 1 : 0; for (a = t[0].length, c = 0; c < t.length; c++) { for (b[c] = 0, v[c] = [0], a = a < (S = (P = t[c]).length) ? a : S, u = 0; u < S;) p.push(P[u].x, P[u].y, P[u].z), u > 0 && (C = P[u].subtract(P[u - 1]).length() + b[c], v[c].push(C), b[c] = C), u++; n && (u--, p.push(P[0].x, P[0].y, P[0].z), C = P[u].subtract(P[0]).length() + b[c], v[c].push(C), b[c] = C), E[c] = S + D, A[c] = I, I += S + D } var L, w, F = null, N = null; for (l = 0; l < a + D; l++) { for (T[l] = 0, y[l] = [0], c = 0; c < t.length - 1; c++) M = t[c], O = t[c + 1], l === a ? (F = M[0], N = O[0]) : (F = M[l], N = O[l]), C = N.subtract(F).length() + T[l], y[l].push(C), T[l] = C; i && N && F && (M = t[c], O = t[0], l === a && (N = O[0]), C = N.subtract(F).length() + T[l], T[l] = C) } if (d) for (c = 0; c < d.length; c++) m.push(d[c].x, d[c].y); else for (c = 0; c < t.length; c++) for (l = 0; l < a + D; l++) L = 0 != b[c] ? v[c][l] / b[c] : 0, w = 0 != T[l] ? y[l][c] / T[l] : 0, r ? m.push(w, L) : m.push(L, w); for (var B = 0, U = E[c = 0] - 1, V = E[c + 1] - 1, G = U < V ? U : V, k = A[1] - A[0], z = i ? E.length : E.length - 1; B <= G && c < z;) _.push(B, B + k, B + 1), _.push(B + k + 1, B + 1, B + k), (B += 1) === G && (++c === E.length - 1 ? (k = A[0] - A[c], U = E[c] - 1, V = E[0] - 1) : (k = A[c + 1] - A[c], U = E[c] - 1, V = E[c + 1] - 1), B = A[c], G = U < V ? U + B : V + B); if (Mi.a.ComputeNormals(p, _, 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] } Mi.a._ComputeSides(h, p, _, g, m, e.frontUVs, e.backUVs); var W = null; if (f) { W = new Float32Array(4 * f.length); for (var X = 0; X < f.length; X++) W[4 * X] = f[X].r, W[4 * X + 1] = f[X].g, W[4 * X + 2] = f[X].b, W[4 * X + 3] = f[X].a } var Y = new Mi.a, K = new Float32Array(p), Q = new Float32Array(g), q = new Float32Array(m); return Y.indices = _, Y.positions = K, Y.normals = Q, Y.uvs = q, W && Y.set(W, Oi.b.ColorKind), n && (Y._idx = A), Y }, fe.a.CreateRibbon = function(e, t, i, n, r, o, s, a, c) { return void 0 === i && (i = !1), void 0 === s && (s = !1), Yo.CreateRibbon(e, { pathArray: t, closeArray: i, closePath: n, offset: r, updatable: s, sideOrientation: a, instance: c }, o) }; var Yo = function() { function e() {} return e.CreateRibbon = function(e, t, i) { void 0 === i && (i = null); var n = t.pathArray, r = t.closeArray, s = t.closePath, a = fe.a._GetDefaultSideOrientation(t.sideOrientation), c = t.instance, l = t.updatable; if (c) { var u = o.t.Vector3[0].setAll(Number.MAX_VALUE), h = o.t.Vector3[1].setAll(-Number.MAX_VALUE), d = c.getVerticesData(Oi.b.PositionKind); if (function(e) { for (var t = n[0].length, i = c, r = 0, o = i._originalBuilderSideOrientation === fe.a.DOUBLESIDE ? 2 : 1, s = 1; s <= o; ++s) for (var a = 0; a < n.length; ++a) { var l = n[a], d = l.length; t = t < d ? t : d; for (var f = 0; f < t; ++f) { var p = l[f]; e[r] = p.x, e[r + 1] = p.y, e[r + 2] = p.z, u.minimizeInPlaceFromFloats(p.x, p.y, p.z), h.maximizeInPlaceFromFloats(p.x, p.y, p.z), r += 3 } i._creationDataStorage && i._creationDataStorage.closePath && (p = l[0], e[r] = p.x, e[r + 1] = p.y, e[r + 2] = p.z, r += 3) } }(d), c._boundingInfo ? c._boundingInfo.reConstruct(u, h, c._worldMatrix) : c._boundingInfo = new on.a(u, h, c._worldMatrix), c.updateVerticesData(Oi.b.PositionKind, d, !1, !1), t.colors) { for (var f = c.getVerticesData(Oi.b.ColorKind), p = 0, _ = 0; p < t.colors.length; p++, _ += 4) { var g = t.colors[p]; f[_] = g.r, f[_ + 1] = g.g, f[_ + 2] = g.b, f[_ + 3] = g.a } c.updateVerticesData(Oi.b.ColorKind, f, !1, !1) } if (t.uvs) { for (var m = c.getVerticesData(Oi.b.UVKind), v = 0; v < t.uvs.length; v++) m[2 * v] = t.uvs[v].x, m[2 * v + 1] = t.uvs[v].y; c.updateVerticesData(Oi.b.UVKind, m, !1, !1) } if (!c.areNormalsFrozen || c.isFacetDataEnabled) { var y = c.getIndices(), b = c.getVerticesData(Oi.b.NormalKind), T = c.isFacetDataEnabled ? c.getFacetDataParameters() : null; if (Mi.a.ComputeNormals(d, y, b, T), c._creationDataStorage && c._creationDataStorage.closePath) for (var E = 0, A = 0, x = 0; x < n.length; x++) E = 3 * c._creationDataStorage.idx[x], A = x + 1 < n.length ? 3 * (c._creationDataStorage.idx[x + 1] - 1) : b.length - 3, b[E] = .5 * (b[E] + b[A]), b[E + 1] = .5 * (b[E + 1] + b[A + 1]), b[E + 2] = .5 * (b[E + 2] + b[A + 2]), b[A] = b[E], b[A + 1] = b[E + 1], b[A + 2] = b[E + 2]; c.areNormalsFrozen || c.updateVerticesData(Oi.b.NormalKind, b, !1, !1) } return c } var R = new fe.a(e, i); R._originalBuilderSideOrientation = a, R._creationDataStorage = new fe.b; var P = Mi.a.CreateRibbon(t); return s && (R._creationDataStorage.idx = P._idx), R._creationDataStorage.closePath = s, R._creationDataStorage.closeArray = r, P.applyToMesh(R, l), R }, e }(); fe.a.ExtrudeShape = function(e, t, i, n, r, o, s, a, c, l) { void 0 === s && (s = null); var u = { shape: t, path: i, scale: n, rotation: r, cap: 0 === o ? 0 : o || fe.a.NO_CAP, sideOrientation: c, instance: l, updatable: a }; return Ko.ExtrudeShape(e, u, s) }, fe.a.ExtrudeShapeCustom = function(e, t, i, n, r, o, s, a, c, l, u, h) { var d = { shape: t, path: i, scaleFunction: n, rotationFunction: r, ribbonCloseArray: o, ribbonClosePath: s, cap: 0 === a ? 0 : a || fe.a.NO_CAP, sideOrientation: u, instance: h, updatable: l }; return Ko.ExtrudeShapeCustom(e, d, c) }; var Ko = function() { function e() {} return e.ExtrudeShape = function(t, i, n) { void 0 === n && (n = null); var r = i.path, o = i.shape, s = i.scale || 1, a = i.rotation || 0, c = 0 === i.cap ? 0 : i.cap || fe.a.NO_CAP, l = i.updatable, u = fe.a._GetDefaultSideOrientation(i.sideOrientation), h = i.instance || null, d = i.invertUV || !1; return e._ExtrudeShapeGeneric(t, o, r, s, a, null, null, !1, !1, c, !1, n, !!l, u, h, d, i.frontUVs || null, i.backUVs || null) }, e.ExtrudeShapeCustom = function(t, i, n) { void 0 === n && (n = null); var r = i.path, o = i.shape, s = i.scaleFunction || function() { return 1 }, a = i.rotationFunction || function() { return 0 }, c = i.ribbonCloseArray || !1, l = i.ribbonClosePath || !1, u = 0 === i.cap ? 0 : i.cap || fe.a.NO_CAP, h = i.updatable, d = fe.a._GetDefaultSideOrientation(i.sideOrientation), f = i.instance, p = i.invertUV || !1; return e._ExtrudeShapeGeneric(t, o, r, null, null, s, a, c, l, u, !0, n, !!h, d, f || null, p, i.frontUVs || null, i.backUVs || null) }, e._ExtrudeShapeGeneric = function(e, t, i, n, r, s, a, c, l, u, h, d, f, p, _, g, m, v) { var y, b, T = function(e, t, i, n, r, s, a, c, l, u) { for (var h = i.getTangents(), d = i.getNormals(), f = i.getBinormals(), p = i.getDistances(), _ = 0, g = u && c ? c : function() { return null !== s ? s : 0 }, m = u && a ? a : function() { return null !== r ? r : 1 }, v = l === fe.a.NO_CAP || l === fe.a.CAP_END ? 0 : 2, y = o.t.Matrix[0], b = 0; b < t.length; b++) { for (var T = new Array, E = g(b, p[b]), A = m(b, p[b]), x = 0; x < e.length; x++) { o.j.RotationAxisToRef(h[b], _, y); var R = h[b].scale(e[x].z).add(d[b].scale(e[x].x)).add(f[b].scale(e[x].y)), P = T[x] ? T[x] : o.x.Zero(); o.x.TransformCoordinatesToRef(R, y, P), P.scaleInPlace(A).addInPlace(t[b]), T[x] = P } n[v] = T, _ += E, v++ } var S = function(e) { var t, i = Array(), n = o.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 (l) { case fe.a.NO_CAP: break; case fe.a.CAP_START: n[0] = S(n[2]), n[1] = n[2]; break; case fe.a.CAP_END: n[v] = n[v - 1], n[v + 1] = S(n[v - 1]); break; case fe.a.CAP_ALL: n[0] = S(n[2]), n[1] = n[2], n[v] = n[v - 1], n[v + 1] = S(n[v - 1]) } return n }; if (_) { var E = _._creationDataStorage; return y = E.path3D.update(i), b = T(t, i, E.path3D, E.pathArray, n, r, s, a, E.cap, h), _ = fe.a.CreateRibbon("", b, !1, !1, 0, d || void 0, !1, 0, _) } b = T(t, i, y = new o.m(i), new Array, n, r, s, a, u = u < 0 || u > 3 ? 0 : u, h); var A = Yo.CreateRibbon(e, { pathArray: b, closeArray: c, closePath: l, updatable: f, sideOrientation: p, invertUV: g, frontUVs: m || void 0, backUVs: v || void 0 }, d); return A._creationDataStorage.pathArray = b, A._creationDataStorage.path3D = y, A._creationDataStorage.cap = u, A }, e }(), Qo = function() { function e(e, t) { var i = this; void 0 === e && (e = !0), 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 o.q, this._tmpContactCallbackResult = !1, this._tmpVector = new o.x, this._tmpMatrix = new o.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 = !0 }, this._raycastResult = new Ho, 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)) : p.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 = !1, this.world.contactTest(e.physicsBody, this._tmpAmmoConcreteContactResultCallback), this._tmpContactCallbackResult }, e.prototype._isImpostorPairInContact = function(e, t) { return this._tmpContactCallbackResult = !1, 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), 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, s = t; o < s.length; o++) { var a = s[o]; if (a.soft ? this._afterSoftStep(a) : a.afterStep(), a._onPhysicsCollideCallbacks.length > 0 && this._isImpostorInContact(a)) for (var c = 0, l = a._onPhysicsCollideCallbacks; c < l.length; c++) for (var u = 0, h = l[c].otherImpostors; u < h.length; u++) { var d = h[u]; (a.physicsBody.isActive() || d.physicsBody.isActive()) && this._isImpostorPairInContact(a, d) && (a.onCollide({ body: d.physicsBody }), d.onCollide({ body: a.physicsBody })) } } }, e.prototype._afterSoftStep = function(e) { e.type === ko.a.RopeImpostor ? this._ropeStep(e) : this._softbodyOrClothStep(e) }, e.prototype._ropeStep = function(e) { for (var t, i, n, r, s = e.physicsBody.get_m_nodes(), a = s.size(), c = new Array, l = 0; l < a; l++) i = (t = s.at(l).get_m_x()).x(), n = t.y(), r = t.z(), c.push(new o.x(i, n, r)); var u = e.object, h = e.getParam("shape"); e._isFromLine ? e.object = wn.a.CreateLines("lines", { points: c, instance: u }) : e.object = Ko.ExtrudeShape("ext", { shape: h, path: c, instance: u }) }, e.prototype._softbodyOrClothStep = function(e) { var t = e.type === ko.a.ClothImpostor ? 1 : -1, i = e.object, n = i.getVerticesData(Oi.b.PositionKind); n || (n = []); var r = i.getVerticesData(Oi.b.NormalKind); r || (r = []); for (var o, s, a, c, l, u, h, d, f = n.length / 3, p = e.physicsBody.get_m_nodes(), _ = 0; _ < f; _++) { var g; a = (s = (o = p.at(_)).get_m_x()).x(), c = s.y(), l = s.z() * t, u = (g = o.get_m_n()).x(), h = g.y(), d = g.z() * t, n[3 * _] = a, n[3 * _ + 1] = c, n[3 * _ + 2] = l, r[3 * _] = u, r[3 * _ + 1] = h, r[3 * _ + 2] = d } var m = new Mi.a; m.positions = n, m.normals = r, m.uvs = i.getVerticesData(Oi.b.UVKind), m.colors = i.getVerticesData(Oi.b.ColorKind), i && i.getIndices && (m.indices = i.getIndices()), m.applyToMesh(i) }, e.prototype.applyImpulse = function(e, t, i) { if (e.soft) p.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), o.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) p.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), o.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 === ko.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 s = new Ammo.btDefaultMotionState(o), a = new Ammo.btRigidBodyConstructionInfo(n, s, i, r), c = new Ammo.btRigidBody(a); 0 === n && (c.setCollisionFlags(c.getCollisionFlags() | e.KINEMATIC_FLAG), c.setActivationState(e.DISABLE_DEACTIVATION_FLAG)), t.type != ko.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, a, s, o, r, i]) } 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 o.x(0, 0, 0)), r.connectedPivot || (r.connectedPivot = new o.x(0, 0, 0)), e.joint.type) { case zo.e.DistanceJoint: var s = r.maxDistance; s && (r.mainPivot = new o.x(0, -s / 2, 0), r.connectedPivot = new o.x(0, s / 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 zo.e.HingeJoint: r.mainAxis || (r.mainAxis = new o.x(0, 0, 0)), r.connectedAxis || (r.connectedAxis = new o.x(0, 0, 0)); var a = 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), a, c); break; case zo.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: p.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 } }, 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 s = i.getIndices(); s || (s = []); var a = i.getVerticesData(Oi.b.PositionKind); a || (a = []), i.computeWorldMatrix(!1); for (var c = s.length / 3, l = 0; l < c; l++) { for (var u = [], h = 0; h < 3; h++) { var d, f = new o.x(a[3 * s[3 * l + h] + 0], a[3 * s[3 * l + h] + 1], a[3 * s[3 * l + h] + 2]); o.j.ScalingToRef(i.scaling.x, i.scaling.y, i.scaling.z, this._tmpMatrix), f = o.x.TransformCoordinates(f, this._tmpMatrix), (d = 0 == h ? this._tmpAmmoVectorA : 1 == h ? this._tmpAmmoVectorB : this._tmpAmmoVectorC).setValue(f.x, f.y, f.z), u.push(d) } e.addTriangle(u[0], u[1], u[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(Oi.b.PositionKind); n || (n = []); var r = t.getVerticesData(Oi.b.NormalKind); r || (r = []), t.computeWorldMatrix(!1); for (var s = [], a = [], c = 0; c < n.length; c += 3) { var l = new o.x(n[c], n[c + 1], n[c + 2]), u = new o.x(r[c], r[c + 1], r[c + 2]); l = o.x.TransformCoordinates(l, t.getWorldMatrix()), u = o.x.TransformNormal(u, t.getWorldMatrix()), s.push(l.x, l.y, l.z), a.push(u.x, u.y, u.z) } var h = new Mi.a; return h.positions = s, h.normals = a, h.uvs = t.getVerticesData(Oi.b.UVKind), h.colors = t.getVerticesData(Oi.b.ColorKind), t && t.getIndices && (h.indices = t.getIndices()), h.applyToMesh(t), t.position = o.x.Zero(), t.rotationQuaternion = null, t.rotation = o.x.Zero(), t.computeWorldMatrix(!0), h } return Mi.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, s = n.normals; if (null === r || null === s) return new Ammo.btCompoundShape; for (var a = [], c = [], l = 0; l < r.length; l += 3) { var u = new o.x(r[l], r[l + 1], r[l + 2]), h = new o.x(s[l], s[l + 1], s[l + 2]); a.push(u.x, u.y, -u.z), c.push(h.x, h.y, -h.z) } var d = (new Ammo.btSoftBodyHelpers).CreateFromTriMesh(this.world.getWorldInfo(), a, t.getIndices(), i.length / 3, !0), f = r.length / 3, p = d.get_m_nodes(); for (l = 0; l < f; l++) { var _; (_ = p.at(l).get_m_n()).setX(c[3 * l]), _.setY(c[3 * l + 1]), _.setZ(c[3 * l + 2]) } return d } }, 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 s = r.length, a = Math.sqrt(s / 3); e.segments = a; var c = a - 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[s - 3], r[s - 2], r[s - 1]), this._tmpAmmoVectorC.setValue(r[s - 3 - 3 * c], r[s - 2 - 3 * c], r[s - 1 - 3 * c]), (new Ammo.btSoftBodyHelpers).CreatePatch(this.world.getWorldInfo(), this._tmpAmmoVectorA, this._tmpAmmoVectorB, this._tmpAmmoVectorC, this._tmpAmmoVectorD, a, a, e.getParam("fixedPoints"), !0) } }, 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; n.applyToMesh(e.object, !0), e._isFromLine = !0; if (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 = !1; var s = e.getParam("path"); if (null === e.getParam("shape")) return p.a.Warn("No shape available for extruded mesh"), new Ammo.btCompoundShape; if (r.length % (3 * s.length) != 0) return p.a.Warn("Path does not match extrusion"), new Ammo.btCompoundShape; i = (t = s.length) - 1, this._tmpAmmoVectorA.setValue(s[0].x, s[0].y, s[0].z), this._tmpAmmoVectorB.setValue(s[t - 1].x, s[t - 1].y, s[t - 1].z) } e.segments = i; var a = e.getParam("fixedPoints"); a = a > 3 ? 3 : a; var c = (new Ammo.btSoftBodyHelpers).CreateRope(this.world.getWorldInfo(), this._tmpAmmoVectorA, this._tmpAmmoVectorB, i - 1, a); 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 s = i.getIndices(); s || (s = []); var a = i.getVerticesData(Oi.b.PositionKind); a || (a = []), i.computeWorldMatrix(!1); for (var c = s.length / 3, l = 0; l < c; l++) { for (var u = [], h = 0; h < 3; h++) { var d, f = new o.x(a[3 * s[3 * l + h] + 0], a[3 * s[3 * l + h] + 1], a[3 * s[3 * l + h] + 2]); o.j.ScalingToRef(i.scaling.x, i.scaling.y, i.scaling.z, this._tmpMatrix), f = o.x.TransformCoordinates(f, this._tmpMatrix), (d = 0 == h ? this._tmpAmmoVectorA : 1 == h ? this._tmpAmmoVectorB : this._tmpAmmoVectorC).setValue(f.x, f.y, f.z), u.push(d) } e.addPoint(u[0], !0), e.addPoint(u[1], !0), e.addPoint(u[2], !0), r++ } 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 = !1); var n, r = e.object, s = e.getObjectExtendSize(); if (!t) { var a = e.object.getChildMeshes ? e.object.getChildMeshes(!0) : []; n = new Ammo.btCompoundShape; var c = 0; if (a.forEach(function(e) { var t = e.getPhysicsImpostor(); if (t) { if (t.type == ko.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), s = e.parent.getWorldMatrix().clone(), a = new o.x; s.decompose(a), i._tmpAmmoTransform.getOrigin().setValue(e.position.x * a.x, e.position.y * a.y, e.position.z * a.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 != ko.a.NoImpostor) { var l = this._createShape(e, !0); l && (this._tmpAmmoTransform.getOrigin().setValue(0, 0, 0), this._tmpAmmoQuaternion.setValue(0, 0, 0, 1), this._tmpAmmoTransform.setRotation(this._tmpAmmoQuaternion), n.addChildShape(this._tmpAmmoTransform, l)) } return n } Ammo.destroy(n), n = null } switch (e.type) { case ko.a.SphereImpostor: n = new Ammo.btSphereShape(s.x / 2); break; case ko.a.CylinderImpostor: this._tmpAmmoVectorA.setValue(s.x / 2, s.y / 2, s.z / 2), n = new Ammo.btCylinderShape(this._tmpAmmoVectorA); break; case ko.a.PlaneImpostor: case ko.a.BoxImpostor: this._tmpAmmoVectorA.setValue(s.x / 2, s.y / 2, s.z / 2), n = new Ammo.btBoxShape(this._tmpAmmoVectorA); break; case ko.a.MeshImpostor: if (0 == e.getParam("mass")) { var u = new Ammo.btTriangleMesh; e._pluginData.toDispose.push(u); var h = this._addMeshVerts(u, r, r); n = 0 == h ? new Ammo.btCompoundShape : new Ammo.btBvhTriangleMeshShape(u); break } case ko.a.ConvexHullImpostor: var d = new Ammo.btConvexHullShape; 0 == (h = this._addHullVerts(d, r, r)) ? (e._pluginData.toDispose.push(d), n = new Ammo.btCompoundShape) : n = d; break; case ko.a.NoImpostor: n = new Ammo.btSphereShape(s.x / 2); break; case ko.a.SoftbodyImpostor: n = this._createSoftbody(e); break; case ko.a.ClothImpostor: n = this._createCloth(e); break; case ko.a.RopeImpostor: n = this._createRope(e); break; default: p.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 o.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 o.x(t.x(), t.y(), t.z()); return Ammo.destroy(t), i }, e.prototype.setBodyMass = function(e, t) { e.soft ? e.physicsBody.setTotalMass(t, !1) : 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 : (p.a.Warn("Pressure is not a property of a rigid body"), 0) }, e.prototype.setBodyPressure = function(e, t) { e.soft ? e.type === ko.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) : p.a.Warn("Pressure can only be applied to a softbody") }, e.prototype.getBodyStiffness = function(e) { return e.soft ? e._pluginData.stiffness || 0 : (p.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) : p.a.Warn("Stiffness cannot be applied to a rigid body") }, e.prototype.getBodyVelocityIterations = function(e) { return e.soft ? e._pluginData.velocityIterations || 0 : (p.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) : p.a.Warn("Velocity iterations cannot be applied to a rigid body") }, e.prototype.getBodyPositionIterations = function(e) { return e.soft ? e._pluginData.positionIterations || 0 : (p.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) : p.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 = !1); var s = e.segments, a = Math.round((s - 1) * i) + s * (s - 1 - Math.round((s - 1) * n)); e.physicsBody.appendAnchor(a, t.physicsBody, o, r) }, e.prototype.appendHook = function(e, t, i, n, r) { void 0 === n && (n = 1), void 0 === r && (r = !1); var o = Math.round(e.segments * i); e.physicsBody.appendAnchor(o, t.physicsBody, r, n) }, e.prototype.sleepBody = function(e) { p.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) { p.a.Warn("updateDistanceJoint is not currently supported by the Ammo physics plugin") }, e.prototype.setMotor = function(e, t, i, n) { e.physicsJoint.enableAngularMotor(!0, t, i) }, e.prototype.setLimit = function(e, t, i) { p.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), Ammo.destroy(this._collisionConfiguration), Ammo.destroy(this._tmpAmmoVectorA), Ammo.destroy(this._tmpAmmoVectorB), 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), 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()), 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 }(); n.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 }, n.a.prototype.addReflectionProbe = function(e) { this.reflectionProbes || (this.reflectionProbes = []), this.reflectionProbes.push(e) }; var qo = function() { function e(e, t, i, n, r) { var s = this; void 0 === n && (n = !0), void 0 === r && (r = !1), this.name = e, this._viewMatrix = o.j.Identity(), this._target = o.x.Zero(), this._add = o.x.Zero(), this._invertYAxis = !1, this.position = o.x.Zero(), this._scene = i, this._scene.reflectionProbes || (this._scene.reflectionProbes = new Array), this._scene.reflectionProbes.push(this), this._renderTargetTexture = new _i(e, t, i, n, !0, r ? _.a.TEXTURETYPE_FLOAT : _.a.TEXTURETYPE_UNSIGNED_INT, !0), this._renderTargetTexture.onBeforeRenderObservable.add(function(e) { switch (e) { case 0: s._add.copyFromFloats(1, 0, 0); break; case 1: s._add.copyFromFloats(-1, 0, 0); break; case 2: s._add.copyFromFloats(0, s._invertYAxis ? 1 : -1, 0); break; case 3: s._add.copyFromFloats(0, s._invertYAxis ? -1 : 1, 0); break; case 4: s._add.copyFromFloats(0, 0, 1); break; case 5: s._add.copyFromFloats(0, 0, -1) } s._attachedMesh && s.position.copyFrom(s._attachedMesh.getAbsolutePosition()), s.position.addToRef(s._add, s._target), o.j.LookAtLHToRef(s.position, s._target, o.x.Up(), s._viewMatrix), i.activeCamera && (s._projectionMatrix = o.j.PerspectiveFovLH(Math.PI / 2, 1, i.activeCamera.minZ, i.activeCamera.maxZ), i.setTransformMatrix(s._viewMatrix, s._projectionMatrix)), i._forcedViewPosition = s.position }), this._renderTargetTexture.onAfterUnbindObservable.add(function() { i._forcedViewPosition = null, i.updateTransformMatrix(!0) }) } return Object.defineProperty(e.prototype, "samples", { get: function() { return this._renderTargetTexture.samples }, set: function(e) { this._renderTargetTexture.samples = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "refreshRate", { get: function() { return this._renderTargetTexture.refreshRate }, set: function(e) { this._renderTargetTexture.refreshRate = e }, enumerable: !0, configurable: !0 }), e.prototype.getScene = function() { return this._scene }, Object.defineProperty(e.prototype, "cubeTexture", { get: function() { return this._renderTargetTexture }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "renderList", { get: function() { return this._renderTargetTexture.renderList }, enumerable: !0, configurable: !0 }), 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)), t }, e.prototype.getClassName = function() { return "ReflectionProbe" }, e.prototype.serialize = function() { var e = L.a.Serialize(this, this._renderTargetTexture.serialize()); return e.isReflectionProbe = !0, e }, e.Parse = function(t, i, n) { var r = null; if (i.reflectionProbes) for (var o = 0; o < i.reflectionProbes.length; o++) { var s = i.reflectionProbes[o]; if (s.name === t.name) { r = s; break } } return (r = L.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 }, l.c([Object(L.k)()], e.prototype, "_attachedMesh", void 0), l.c([Object(L.o)()], e.prototype, "position", void 0), e }(), Zo = function(e, t, i, n) { for (var r = 0, o = t.materials.length; r < o; r++) { var s = t.materials[r]; if (s.id === e) return so.a.Parse(s, i, n) } return null }, Jo = function(e, t, i) { for (var n in t) if (e.name === t[n]) return i.push(e.id), !0; return !(!e.parentId || -1 === i.indexOf(e.parentId)) && (i.push(e.id), !0) }, $o = function(e, t) { return e + " of " + (t ? t.file + " from " + t.name + " version: " + t.version + ", exporter version: " + t.exporter_version : "unknown") }, es = 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(!1); if (t._waitingData.lods.distances) { var o = t._waitingData.lods.distances; if (o.length >= n.length) { var s = o.length > n.length ? o[o.length - 1] : 0; i.setEnabled(!1); for (var a = 0; a < n.length; a++) { var c = n[a], l = e.getMeshByID(c); null != l && i.addLODLevel(o[a], l) } s > 0 && i.addLODLevel(s, null), !0 === r && i.setEnabled(!0) } else ye.h.Warn("Invalid level of detail distances for " + t.name) } } t._waitingData.lods = null } }, ts = function(e, t, i, r, o) { void 0 === o && (o = !1); var a = new _e(e), c = "importScene has failed JSON parse"; try { var l = JSON.parse(t); c = ""; var u, h, d = bn.loggingLevel === bn.DETAILED_LOGGING; if (void 0 !== l.environmentTexture && null !== l.environmentTexture) { var f = void 0 === l.isPBR || l.isPBR; if (l.environmentTextureType && "BABYLON.HDRCubeTexture" === l.environmentTextureType) { var _ = l.environmentTextureSize ? l.environmentTextureSize : 128, g = new Uo((l.environmentTexture.match(/https?:\/\//g) ? "" : i) + l.environmentTexture, e, _, !0, !f); l.environmentTextureRotationY && (g.rotationY = l.environmentTextureRotationY), e.environmentTexture = g } else if (ye.h.EndsWith(l.environmentTexture, ".env")) { var m = new tr((l.environmentTexture.match(/https?:\/\//g) ? "" : i) + l.environmentTexture, e); l.environmentTextureRotationY && (m.rotationY = l.environmentTextureRotationY), e.environmentTexture = m } else { var v = tr.CreateFromPrefilteredData((l.environmentTexture.match(/https?:\/\//g) ? "" : i) + l.environmentTexture, e); l.environmentTextureRotationY && (v.rotationY = l.environmentTextureRotationY), e.environmentTexture = v } if (!0 === l.createDefaultSkybox) { var y = void 0 !== e.activeCamera && null !== e.activeCamera ? (e.activeCamera.maxZ - e.activeCamera.minZ) / 2 : 1e3, b = l.skyboxBlurLevel || 0; e.createDefaultSkybox(e.environmentTexture, f, y, b) } a.environmentTexture = e.environmentTexture } if (void 0 !== l.lights && null !== l.lights) for (u = 0, h = l.lights.length; u < h; u++) { var T = l.lights[u], E = zn.a.Parse(T, e); E && (a.lights.push(E), c += 0 === u ? "\n\tLights:" : "", c += "\n\t\t" + E.toString(d)) } if (void 0 !== l.reflectionProbes && null !== l.reflectionProbes) for (u = 0, h = l.reflectionProbes.length; u < h; u++) { var A = l.reflectionProbes[u], x = qo.Parse(A, e, i); x && (a.reflectionProbes.push(x), c += 0 === u ? "\n\tReflection Probes:" : "", c += "\n\t\t" + x.toString(d)) } if (void 0 !== l.animations && null !== l.animations) for (u = 0, h = l.animations.length; u < h; u++) { var R = l.animations[u], P = s.a.GetClass("BABYLON.Animation"); if (P) { var S = P.Parse(R); e.animations.push(S), a.animations.push(S), c += 0 === u ? "\n\tAnimations:" : "", c += "\n\t\t" + S.toString(d) } } if (void 0 !== l.materials && null !== l.materials) for (u = 0, h = l.materials.length; u < h; u++) { var M = l.materials[u], O = so.a.Parse(M, e, i); if (O) a.materials.push(O), c += 0 === u ? "\n\tMaterials:" : "", c += "\n\t\t" + O.toString(d), O.getActiveTextures().forEach(function(e) { -1 == a.textures.indexOf(e) && a.textures.push(e) }) } if (void 0 !== l.multiMaterials && null !== l.multiMaterials) for (u = 0, h = l.multiMaterials.length; u < h; u++) { var I = l.multiMaterials[u], D = Fo.a.ParseMultiMaterial(I, e); a.multiMaterials.push(D), c += 0 === u ? "\n\tMultiMaterials:" : "", c += "\n\t\t" + D.toString(d), D.getActiveTextures().forEach(function(e) { -1 == a.textures.indexOf(e) && a.textures.push(e) }) } if (void 0 !== l.morphTargetManagers && null !== l.morphTargetManagers) for (var L = 0, w = l.morphTargetManagers; L < w.length; L++) { var F = w[L]; a.morphTargetManagers.push(Go.Parse(F, e)) } if (void 0 !== l.skeletons && null !== l.skeletons) for (u = 0, h = l.skeletons.length; u < h; u++) { var N = l.skeletons[u], B = He.Parse(N, e); a.skeletons.push(B), c += 0 === u ? "\n\tSkeletons:" : "", c += "\n\t\t" + B.toString(d) } var U = l.geometries; if (null != U) { var V = new Array, G = U.vertexData; if (null != G) for (u = 0, h = G.length; u < h; u++) { var k = G[u]; V.push(wo.a.Parse(k, e, i)) } V.forEach(function(e) { e && a.geometries.push(e) }) } if (void 0 !== l.transformNodes && null !== l.transformNodes) for (u = 0, h = l.transformNodes.length; u < h; u++) { var z = l.transformNodes[u], j = _r.a.Parse(z, e, i); a.transformNodes.push(j) } if (void 0 !== l.meshes && null !== l.meshes) for (u = 0, h = l.meshes.length; u < h; u++) { var H = l.meshes[u], W = fe.a.Parse(H, e, i); a.meshes.push(W), c += 0 === u ? "\n\tMeshes:" : "", c += "\n\t\t" + W.toString(d) } if (void 0 !== l.cameras && null !== l.cameras) for (u = 0, h = l.cameras.length; u < h; u++) { var X = l.cameras[u], Y = Ne.a.Parse(X, e); a.cameras.push(Y), c += 0 === u ? "\n\tCameras:" : "", c += "\n\t\t" + Y.toString(d) } if (void 0 !== l.animationGroups && null !== l.animationGroups) for (u = 0, h = l.animationGroups.length; u < h; u++) { var K = l.animationGroups[u], Q = Z.Parse(K, e); a.animationGroups.push(Q), c += 0 === u ? "\n\tAnimationGroups:" : "", c += "\n\t\t" + Q.toString(d) } for (u = 0, h = e.cameras.length; u < h; u++) { (Y = e.cameras[u])._waitingParentId && (Y.parent = e.getLastEntryByID(Y._waitingParentId), Y._waitingParentId = null) } for (u = 0, h = e.lights.length; u < h; u++) { var q = e.lights[u]; q && q._waitingParentId && (q.parent = e.getLastEntryByID(q._waitingParentId), q._waitingParentId = null) } for (u = 0, h = e.transformNodes.length; u < h; u++) { var J = e.transformNodes[u]; J._waitingParentId && (J.parent = e.getLastEntryByID(J._waitingParentId), J._waitingParentId = null) } for (u = 0, h = e.meshes.length; u < h; u++) { (W = e.meshes[u])._waitingParentId && (W.parent = e.getLastEntryByID(W._waitingParentId), W._waitingParentId = null), W._waitingData.lods && es(e, W) } for (u = 0, h = e.skeletons.length; u < h; u++) { (B = e.skeletons[u])._hasWaitingData && (null != B.bones && B.bones.forEach(function(t) { if (t._waitingTransformNodeId) { var i = e.getLastEntryByID(t._waitingTransformNodeId); i && t.linkTransformNode(i), t._waitingTransformNodeId = null } }), B._hasWaitingData = null) } for (u = 0, h = e.meshes.length; u < h; u++) { var $ = e.meshes[u]; $._waitingData.freezeWorldMatrix ? ($.freezeWorldMatrix(), $._waitingData.freezeWorldMatrix = null) : $.computeWorldMatrix(!0) } for (u = 0, h = e.lights.length; u < h; u++) { var ee = e.lights[u]; 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 (n.a.Parse(l, e, a, i), u = 0, h = e.meshes.length; u < h; u++) { (W = e.meshes[u])._waitingData.actions && (C.Parse(W._waitingData.actions, W, e), W._waitingData.actions = null) } void 0 !== l.actions && null !== l.actions && C.Parse(l.actions, null, e), o || a.removeAllFromScene() } catch (e) { var oe = $o("loadAssets", l ? l.producer : "Unknown") + c; if (!r) throw p.a.Log(oe), e; r(oe, e) } finally { null !== c && bn.loggingLevel !== bn.NO_LOGGING && p.a.Log($o("loadAssets", l ? l.producer : "Unknown") + (bn.loggingLevel !== bn.MINIMAL_LOGGING ? c : "")) } return a }; bn.RegisterPlugin({ name: "babylon.js", extensions: ".babylon", canDirectLoad: function(e) { return -1 !== e.indexOf("babylon") }, importMesh: function(e, t, i, r, o, s, a, c) { var l = "importMesh has failed JSON parse"; try { var u = JSON.parse(i); l = ""; var h = bn.loggingLevel === bn.DETAILED_LOGGING; e ? Array.isArray(e) || (e = [e]) : e = null; var d = new Array; if (void 0 !== u.meshes && null !== u.meshes) { var f, _, g, m = [], v = []; for (f = 0, _ = u.meshes.length; f < _; f++) { var y = u.meshes[f]; if (null === e || Jo(y, e, d)) { if (null !== e && delete e[e.indexOf(y.name)], void 0 !== y.geometryId && null !== y.geometryId && void 0 !== u.geometries && null !== u.geometries) { var b = !1; ["boxes", "spheres", "cylinders", "toruses", "grounds", "planes", "torusKnots", "vertexData"].forEach(function(e) { !0 !== b && u.geometries[e] && Array.isArray(u.geometries[e]) && u.geometries[e].forEach(function(i) { if (i.id === y.geometryId) { switch (e) { case "vertexData": wo.a.Parse(i, t, r) } b = !0 } }) }), !1 === b && p.a.Warn("Geometry not found for mesh " + y.id) } if (y.materialId) { var T = -1 !== v.indexOf(y.materialId); if (!1 === T && void 0 !== u.multiMaterials && null !== u.multiMaterials) for (var E = 0, A = u.multiMaterials.length; E < A; E++) { var x = u.multiMaterials[E]; if (x.id === y.materialId) { for (var R = 0, P = x.materials.length; R < P; R++) { var S, C = x.materials[R]; v.push(C), (S = Zo(C, u, t, r)) && (l += "\n\tMaterial " + S.toString(h)) } v.push(x.id); var M = Fo.a.ParseMultiMaterial(x, t); M && (T = !0, l += "\n\tMulti-Material " + M.toString(h)); break } } if (!1 === T) v.push(y.materialId), (S = Zo(y.materialId, u, t, r)) ? l += "\n\tMaterial " + S.toString(h) : p.a.Warn("Material not found for mesh " + y.id) } if (y.skeletonId > -1 && void 0 !== u.skeletons && null !== u.skeletons) if (!1 === m.indexOf(y.skeletonId) > -1) for (var O = 0, I = u.skeletons.length; O < I; O++) { var D = u.skeletons[O]; if (D.id === y.skeletonId) { var L = He.Parse(D, t); a.push(L), m.push(D.id), l += "\n\tSkeleton " + L.toString(h) } } if (void 0 !== u.morphTargetManagers && null !== u.morphTargetManagers) for (var w = 0, F = u.morphTargetManagers; w < F.length; w++) { var N = F[w]; Go.Parse(N, t) } var B = fe.a.Parse(y, t, r); o.push(B), l += "\n\tMesh " + B.toString(h) } } for (f = 0, _ = t.meshes.length; f < _; f++)(g = t.meshes[f])._waitingParentId && (g.parent = t.getLastEntryByID(g._waitingParentId), g._waitingParentId = null), g._waitingData.lods && es(t, g); for (f = 0, _ = t.skeletons.length; f < _; f++) { (L = t.skeletons[f])._hasWaitingData && (null != L.bones && L.bones.forEach(function(e) { if (e._waitingTransformNodeId) { var i = t.getLastEntryByID(e._waitingTransformNodeId); i && e.linkTransformNode(i), e._waitingTransformNodeId = null } }), L._hasWaitingData = null) } for (f = 0, _ = t.meshes.length; f < _; f++)(g = t.meshes[f])._waitingData.freezeWorldMatrix ? (g.freezeWorldMatrix(), g._waitingData.freezeWorldMatrix = null) : g.computeWorldMatrix(!0) } if (void 0 !== u.particleSystems && null !== u.particleSystems) { var U = n.a.GetIndividualParser(Ae.a.NAME_PARTICLESYSTEM); if (U) for (f = 0, _ = u.particleSystems.length; f < _; f++) { var V = u.particleSystems[f]; - 1 !== d.indexOf(V.emitterId) && s.push(U(V, t, r)) } } return !0 } catch (e) { var G = $o("importMesh", u ? u.producer : "Unknown") + l; if (!c) throw p.a.Log(G), e; c(G, e) } finally { null !== l && bn.loggingLevel !== bn.NO_LOGGING && p.a.Log($o("importMesh", u ? u.producer : "Unknown") + (bn.loggingLevel !== bn.MINIMAL_LOGGING ? l : "")) } return !1 }, load: function(e, t, i, n) { var r = "importScene has failed JSON parse"; try { var s = JSON.parse(t); if (r = "", void 0 !== s.useDelayedTextureLoading && null !== s.useDelayedTextureLoading && (e.useDelayedTextureLoading = s.useDelayedTextureLoading && !bn.ForceFullSceneLoadingForIncremental), void 0 !== s.autoClear && null !== s.autoClear && (e.autoClear = s.autoClear), void 0 !== s.clearColor && null !== s.clearColor && (e.clearColor = o.f.FromArray(s.clearColor)), void 0 !== s.ambientColor && null !== s.ambientColor && (e.ambientColor = o.e.FromArray(s.ambientColor)), void 0 !== s.gravity && null !== s.gravity && (e.gravity = o.x.FromArray(s.gravity)), s.fogMode && 0 !== s.fogMode) switch (e.fogMode = s.fogMode, e.fogColor = o.e.FromArray(s.fogColor), e.fogStart = s.fogStart, e.fogEnd = s.fogEnd, e.fogDensity = s.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 (s.physicsEnabled) { var a; "cannon" === s.physicsEngine ? a = new Wo : "oimo" === s.physicsEngine ? a = new Xo : "ammo" === s.physicsEngine && (a = new Qo), r = "\tPhysics engine " + (s.physicsEngine ? s.physicsEngine : "oimo") + " enabled\n"; var c = s.physicsGravity ? o.x.FromArray(s.physicsGravity) : null; e.enablePhysics(c, a) } if (void 0 !== s.metadata && null !== s.metadata && (e.metadata = s.metadata), void 0 !== s.collisionsEnabled && null !== s.collisionsEnabled && (e.collisionsEnabled = s.collisionsEnabled), !ts(e, t, i, n, !0)) return !1; if (s.autoAnimate && e.beginAnimation(e, s.autoAnimateFrom, s.autoAnimateTo, s.autoAnimateLoop, s.autoAnimateSpeed || 1), void 0 !== s.activeCameraID && null !== s.activeCameraID && e.setActiveCameraByID(s.activeCameraID), void 0 !== s.environmentTexture && null !== s.environmentTexture) { var l = void 0 === s.isPBR || s.isPBR; if (s.environmentTextureType && "BABYLON.HDRCubeTexture" === s.environmentTextureType) { var u = s.environmentTextureSize ? s.environmentTextureSize : 128, h = new Uo(i + s.environmentTexture, e, u, !0, !l); s.environmentTextureRotationY && (h.rotationY = s.environmentTextureRotationY), e.environmentTexture = h } else if (ye.h.EndsWith(s.environmentTexture, ".env")) { var d = new tr(i + s.environmentTexture, e); s.environmentTextureRotationY && (d.rotationY = s.environmentTextureRotationY), e.environmentTexture = d } else { var f = tr.CreateFromPrefilteredData(i + s.environmentTexture, e); s.environmentTextureRotationY && (f.rotationY = s.environmentTextureRotationY), e.environmentTexture = f } if (!0 === s.createDefaultSkybox) { var _ = void 0 !== e.activeCamera && null !== e.activeCamera ? (e.activeCamera.maxZ - e.activeCamera.minZ) / 2 : 1e3, g = s.skyboxBlurLevel || 0; e.createDefaultSkybox(e.environmentTexture, l, _, g) } } return !0 } catch (e) { var m = $o("importScene", s ? s.producer : "Unknown") + r; if (!n) throw p.a.Log(m), e; n(m, e) } finally { null !== r && bn.loggingLevel !== bn.NO_LOGGING && p.a.Log($o("importScene", s ? s.producer : "Unknown") + (bn.loggingLevel !== bn.MINIMAL_LOGGING ? r : "")) } return !1 }, loadAssetContainer: function(e, t, i, n) { return ts(e, t, i, n) } }); var is = i(93), ns = function() { function e() { this._isEnabled = !0, this.leftColor = o.e.White(), this.rightColor = o.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, ge.b.MarkAllMaterialsAsDirty(_.a.MATERIAL_FresnelDirtyFlag | _.a.MATERIAL_MiscDirtyFlag)) }, enumerable: !0, configurable: !0 }), e.prototype.clone = function() { var t = new e; return S.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 = o.e.FromArray(t.leftColor), i.rightColor = o.e.FromArray(t.rightColor), i.bias = t.bias, i.power = t.power || 1, i }, e }(); L.a._FresnelParametersParser = ns.Parse; var rs = function(e) { function t(t, i) { var n = e.call(this, t, i) || this; return n.maxSimultaneousLights = 4, n.disableLighting = !1, n.invertNormalMapX = !1, n.invertNormalMapY = !1, n.emissiveColor = new o.e(0, 0, 0), n.occlusionStrength = 1, n.useLightmapAsShadowmap = !1, n._useAlphaFromAlbedoTexture = !0, n._useAmbientInGrayScale = !0, n } return l.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: !0, configurable: !0 }), t.prototype.getClassName = function() { return "PBRBaseSimpleMaterial" }, l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "maxSimultaneousLights", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsLightsDirty")], t.prototype, "disableLighting", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty", "_reflectionTexture")], t.prototype, "environmentTexture", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "invertNormalMapX", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "invertNormalMapY", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty", "_bumpTexture")], t.prototype, "normalTexture", void 0), l.c([Object(L.e)("emissive"), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "emissiveColor", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "emissiveTexture", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty", "_ambientTextureStrength")], t.prototype, "occlusionStrength", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty", "_ambientTexture")], t.prototype, "occlusionTexture", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty", "_alphaCutOff")], t.prototype, "alphaCutOff", void 0), l.c([Object(L.c)()], t.prototype, "doubleSided", null), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty", null)], t.prototype, "lightmapTexture", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "useLightmapAsShadowmap", void 0), t }(Gr), os = function(e) { function t(t, i) { var n = e.call(this, t, i) || this; return n._useRoughnessFromMetallicTextureAlpha = !1, n._useRoughnessFromMetallicTextureGreen = !0, n._useMetallnessFromMetallicTextureBlue = !0, n.metallic = 1, n.roughness = 1, n } return l.d(t, e), t.prototype.getClassName = function() { return "PBRMetallicRoughnessMaterial" }, t.prototype.clone = function(e) { var i = this, n = L.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 = L.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 = L.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 }, l.c([Object(L.e)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty", "_albedoColor")], t.prototype, "baseColor", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty", "_albedoTexture")], t.prototype, "baseTexture", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "metallic", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty")], t.prototype, "roughness", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty", "_metallicTexture")], t.prototype, "metallicRoughnessTexture", void 0), t }(rs); s.a.RegisteredTypes["BABYLON.PBRMetallicRoughnessMaterial"] = os; var ss = function(e) { function t(t, i) { var n = e.call(this, t, i) || this; return n._useMicroSurfaceFromReflectivityMapAlpha = !0, n } return l.d(t, e), t.prototype.getClassName = function() { return "PBRSpecularGlossinessMaterial" }, t.prototype.clone = function(e) { var i = this, n = L.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 = L.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 = L.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 }, l.c([Object(L.e)("diffuse"), Object(L.b)("_markAllSubMeshesAsTexturesDirty", "_albedoColor")], t.prototype, "diffuseColor", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty", "_albedoTexture")], t.prototype, "diffuseTexture", void 0), l.c([Object(L.e)("specular"), Object(L.b)("_markAllSubMeshesAsTexturesDirty", "_reflectivityColor")], t.prototype, "specularColor", void 0), l.c([Object(L.c)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty", "_microSurface")], t.prototype, "glossiness", void 0), l.c([Object(L.m)(), Object(L.b)("_markAllSubMeshesAsTexturesDirty", "_reflectivityTexture")], t.prototype, "specularGlossinessTexture", void 0), t }(rs); s.a.RegisteredTypes["BABYLON.PBRSpecularGlossinessMaterial"] = ss; var as = i(76), cs = function(e) { function t(t, i) { var n = e.call(this, i) || this; return t ? (n._engine = i.getEngine(), n._textureMatrix = o.j.Identity(), n.name = t, n.url = t, n.hasAlpha = !1, n.isCube = !1, 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, !0), n._texture || (i.useDelayedTextureLoading ? n.delayLoadState = _.a.DELAYLOADSTATE_NOTLOADED : n.loadTexture()), n) : n } return l.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, !1, !1, _.a.TEXTURE_BILINEAR_SAMPLINGMODE) : i.createRawTexture3D(null, 1, 1, 1, _.a.TEXTUREFORMAT_RGBA, !1, !1, _.a.TEXTURE_BILINEAR_SAMPLINGMODE), this._texture = e; var n = function(n) { if ("string" == typeof n) { for (var r, o = null, s = null, a = n.split("\n"), c = 0, l = 0, u = 0, h = 0, d = 0, f = 0; f < a.length; f++) if (r = a[f], t._noneEmptyLineRegex.test(r) && 0 !== r.indexOf("#")) { var p = r.split(" "); if (0 !== c) { if (0 != c) { var g = Math.max(parseInt(p[0]), 0), m = Math.max(parseInt(p[1]), 0), v = Math.max(parseInt(p[2]), 0); d = Math.max(g, d), d = Math.max(m, d), d = Math.max(v, d); var y = 4 * (l + h * c + u * c * c); s && (s[y + 0] = g, s[y + 1] = m, s[y + 2] = v), ++u % c == 0 && (u = 0, ++h % c == 0 && (l++, h = 0)) } } else c = p.length, o = new Uint8Array(c * c * c * 4), s = new Float32Array(c * c * c * 4) } if (s && o) for (f = 0; f < s.length; f++) if (f > 0 && (f + 1) % 4 == 0) o[f] = 255; else { var b = s[f]; o[f] = b / d * 255 } e.is3D ? (e.updateSize(c, c, c), i.updateRawTexture3D(e, o, _.a.TEXTUREFORMAT_RGBA, !1)) : (e.updateSize(c * c, c), i.updateRawTexture(e, o, _.a.TEXTUREFORMAT_RGBA, !1)) } }, 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, !0), 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 }(Kn.a); s.a.RegisteredTypes["BABYLON.ColorGradingTexture"] = cs; var ls = function(e) { function t(t, i, n, r, o, s, a) { void 0 === r && (r = !1), void 0 === o && (o = !0), void 0 === s && (s = null), void 0 === a && (a = null); var c = e.call(this, i) || this; if (c._onLoad = null, c._onError = null, c.coordinatesMode = ke.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 = s, c._onError = a, c.hasAlpha = !1, c.isCube = !0, c._texture = c._getFromCache(t, c._noMipmap), c._texture ? s && (c._texture.isReady ? ye.h.SetImmediate(function() { return s() }) : c._texture.onLoadedObservable.add(s)) : i.useDelayedTextureLoading ? c.delayLoadState = ge.b.DELAYLOADSTATE_NOTLOADED : c.loadImage(c.loadTexture.bind(c), c._onError), c } return l.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, ge.b.TEXTUREFORMAT_RGB, i.getEngine().getCaps().textureFloat ? ge.b.TEXTURETYPE_FLOAT : ge.b.TEXTURETYPE_UNSIGNED_INTEGER, this._noMipmap, function() { for (var i = e.getFloat32ArrayFromArrayBuffer(e._buffer), n = No.ConvertPanoramaToCubemap(i, e._width, e._height, e._size), r = [], o = 0; o < 6; o++) { var s = n[t._FacesMapping[o]]; r.push(s) } 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 }(Kn.a), us = 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) p.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) p.a.Error("Unable to load TGA file - Not enough data"); else { n += r.id_length; var o, s = !1, a = !1, c = !1; switch (r.image_type) { case e._TYPE_RLE_INDEXED: s = !0; case e._TYPE_INDEXED: a = !0; break; case e._TYPE_RLE_RGB: s = !0; case e._TYPE_RGB: break; case e._TYPE_RLE_GREY: s = !0; case e._TYPE_GREY: c = !0 } var l, u, h, d, f, _, g, m = r.pixel_size >> 3, v = r.width * r.height * m; if (a && (l = i.subarray(n, n += r.colormap_length * (r.colormap_size >> 3))), s) { var y, b, T; o = new Uint8Array(v); for (var E = 0, A = new Uint8Array(m); n < v && E < v;) if (b = 1 + (127 & (y = i[n++])), 128 & y) { for (T = 0; T < m; ++T) A[T] = i[n++]; for (T = 0; T < b; ++T) o.set(A, E + T * m); E += m * b } else { for (b *= m, T = 0; T < b; ++T) o[E + T] = i[n++]; E += b } } else o = i.subarray(n, n += a ? r.width * r.height : v); switch ((r.flags & e._ORIGIN_MASK) >> e._ORIGIN_SHIFT) { default: case e._ORIGIN_UL: u = 0, d = 1, g = r.width, h = 0, f = 1, _ = r.height; break; case e._ORIGIN_BL: u = 0, d = 1, g = r.width, h = r.height - 1, f = -1, _ = -1; break; case e._ORIGIN_UR: u = r.width - 1, d = -1, g = -1, h = 0, f = 1, _ = r.height; break; case e._ORIGIN_BR: u = r.width - 1, d = -1, g = -1, h = r.height - 1, f = -1, _ = -1 } var x = e["_getImageData" + (c ? "Grey" : "") + r.pixel_size + "bits"](r, l, o, h, f, _, u, d, g); t.getEngine()._uploadDataToTextureDirectly(t, x) } } }, e._getImageData8bits = function(e, t, i, n, r, o, s, a, c) { var l, u, h, d = i, f = t, p = e.width, _ = e.height, g = 0, m = new Uint8Array(p * _ * 4); for (h = n; h !== o; h += r) for (u = s; u !== c; u += a, g++) l = d[g], m[4 * (u + p * h) + 3] = 255, m[4 * (u + p * h) + 2] = f[3 * l + 0], m[4 * (u + p * h) + 1] = f[3 * l + 1], m[4 * (u + p * h) + 0] = f[3 * l + 2]; return m }, e._getImageData16bits = function(e, t, i, n, r, o, s, a, c) { var l, u, h, d = i, f = e.width, p = e.height, _ = 0, g = new Uint8Array(f * p * 4); for (h = n; h !== o; h += r) for (u = s; u !== c; u += a, _ += 2) { var m = 255 * ((31744 & (l = d[_ + 0] + (d[_ + 1] << 8))) >> 10) / 31 | 0, v = 255 * ((992 & l) >> 5) / 31 | 0, y = 255 * (31 & l) / 31 | 0; g[4 * (u + f * h) + 0] = m, g[4 * (u + f * h) + 1] = v, g[4 * (u + f * h) + 2] = y, g[4 * (u + f * h) + 3] = 32768 & l ? 0 : 255 } return g }, e._getImageData24bits = function(e, t, i, n, r, o, s, a, c) { var l, u, h = i, d = e.width, f = e.height, p = 0, _ = new Uint8Array(d * f * 4); for (u = n; u !== o; u += r) for (l = s; l !== c; l += a, p += 3) _[4 * (l + d * u) + 3] = 255, _[4 * (l + d * u) + 2] = h[p + 0], _[4 * (l + d * u) + 1] = h[p + 1], _[4 * (l + d * u) + 0] = h[p + 2]; return _ }, e._getImageData32bits = function(e, t, i, n, r, o, s, a, c) { var l, u, h = i, d = e.width, f = e.height, p = 0, _ = new Uint8Array(d * f * 4); for (u = n; u !== o; u += r) for (l = s; l !== c; l += a, p += 4) _[4 * (l + d * u) + 2] = h[p + 0], _[4 * (l + d * u) + 1] = h[p + 1], _[4 * (l + d * u) + 0] = h[p + 2], _[4 * (l + d * u) + 3] = h[p + 3]; return _ }, e._getImageDataGrey8bits = function(e, t, i, n, r, o, s, a, c) { var l, u, h, d = i, f = e.width, p = e.height, _ = 0, g = new Uint8Array(f * p * 4); for (h = n; h !== o; h += r) for (u = s; u !== c; u += a, _++) l = d[_], g[4 * (u + f * h) + 0] = l, g[4 * (u + f * h) + 1] = l, g[4 * (u + f * h) + 2] = l, g[4 * (u + f * h) + 3] = 255; return g }, e._getImageDataGrey16bits = function(e, t, i, n, r, o, s, a, c) { var l, u, h = i, d = e.width, f = e.height, p = 0, _ = new Uint8Array(d * f * 4); for (u = n; u !== o; u += r) for (l = s; l !== c; l += a, p += 2) _[4 * (l + d * u) + 0] = h[p + 0], _[4 * (l + d * u) + 1] = h[p + 0], _[4 * (l + d * u) + 2] = h[p + 0], _[4 * (l + d * u) + 3] = h[p + 1]; return _ }, 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 }(), hs = function() { function e() { this.supportCascades = !1 } 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 = us.GetTGAHeader(n); i(r.width, r.height, t.generateMipMaps, !1, function() { us.UploadContent(t, n) }) }, e }(); ge.b._TextureLoaders.push(new hs), ge.b.prototype.unBindMultiColorAttachmentFramebuffer = function(e, t, i) { void 0 === t && (t = !1), 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 s = e[o], a = 0; a < r.length; a++) r[a] = 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, s.width, s.height, 0, 0, s.width, s.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++) { !(s = e[o]).generateMipMaps || t || s.isCube || (this._bindTextureDirectly(n.TEXTURE_2D, s), n.generateMipmap(n.TEXTURE_2D), this._bindTextureDirectly(n.TEXTURE_2D, null)) } i && (e[0]._MSAAFramebuffer && this._bindUnboundFramebuffer(e[0]._framebuffer), i()), this._bindUnboundFramebuffer(null) }, ge.b.prototype.createMultipleRenderTarget = function(e, t) { var i = !1, n = !0, r = !1, o = !1, s = 1, a = ge.b.TEXTURETYPE_UNSIGNED_INT, c = ge.b.TEXTURE_TRILINEAR_SAMPLINGMODE, l = new Array, u = 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, s = t.textureCount || 1, t.types && (l = t.types), t.samplingModes && (u = t.samplingModes)); var h = this._gl, d = h.createFramebuffer(); this._bindUnboundFramebuffer(d); for (var f = e.width || e, _ = e.height || e, g = [], m = [], v = this._setupFramebufferDepthAttachments(r, n, f, _), y = 0; y < s; y++) { var b = u[y] || c, T = l[y] || a; (T !== ge.b.TEXTURETYPE_FLOAT || this._caps.textureFloatLinearFiltering) && (T !== ge.b.TEXTURETYPE_HALF_FLOAT || this._caps.textureHalfFloatLinearFiltering) || (b = ge.b.TEXTURE_NEAREST_SAMPLINGMODE); var E = this._getSamplingParameters(b, i); T !== ge.b.TEXTURETYPE_FLOAT || this._caps.textureFloat || (T = ge.b.TEXTURETYPE_UNSIGNED_INT, p.a.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type")); var A = new ze.a(this, ze.a.DATASOURCE_MULTIRENDERTARGET), x = h[this.webGLVersion > 1 ? "COLOR_ATTACHMENT" + y : "COLOR_ATTACHMENT" + y + "_WEBGL"]; g.push(A), m.push(x), h.activeTexture(h["TEXTURE" + y]), h.bindTexture(h.TEXTURE_2D, A._webGLTexture), h.texParameteri(h.TEXTURE_2D, h.TEXTURE_MAG_FILTER, E.mag), h.texParameteri(h.TEXTURE_2D, h.TEXTURE_MIN_FILTER, E.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(T), f, _, 0, h.RGBA, this._getWebGLTextureType(T), 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 = d, A._depthStencilBuffer = v, A.baseWidth = f, A.baseHeight = _, A.width = f, A.height = _, A.isReady = !0, A.samples = 1, A.generateMipMaps = i, A.samplingMode = b, A.type = T, A._generateDepthBuffer = n, A._generateStencilBuffer = r, A._attachments = m, this._internalTexturesCache.push(A) } if (o && this._caps.depthTextureExtension) { var R = new ze.a(this, ze.a.DATASOURCE_MULTIRENDERTARGET); h.activeTexture(h.TEXTURE0), h.bindTexture(h.TEXTURE_2D, R._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, f, _, 0, h.DEPTH_COMPONENT, h.UNSIGNED_SHORT, null), h.framebufferTexture2D(h.FRAMEBUFFER, h.DEPTH_ATTACHMENT, h.TEXTURE_2D, R._webGLTexture, 0), R._framebuffer = d, R.baseWidth = f, R.baseHeight = _, R.width = f, R.height = _, R.isReady = !0, R.samples = 1, R.generateMipMaps = i, R.samplingMode = h.NEAREST, R._generateDepthBuffer = n, R._generateStencilBuffer = r, g.push(R), this._internalTexturesCache.push(R) } return h.drawBuffers(m), h.bindRenderbuffer(h.RENDERBUFFER, null), this._bindUnboundFramebuffer(null), this.resetTextureCache(), g }, ge.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); for (var n = 0; n < e.length; n++) 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), s = []; for (n = 0; n < e.length; n++) { var a = e[n], c = i[this.webGLVersion > 1 ? "COLOR_ATTACHMENT" + n : "COLOR_ATTACHMENT" + n + "_WEBGL"], l = i.createRenderbuffer(); if (!l) throw new Error("Unable to create multi sampled framebuffer"); i.bindRenderbuffer(i.RENDERBUFFER, l), i.renderbufferStorageMultisample(i.RENDERBUFFER, t, this._getRGBAMultiSampleBufferFormat(a.type), a.width, a.height), i.framebufferRenderbuffer(i.FRAMEBUFFER, c, i.RENDERBUFFER, l), a._MSAAFramebuffer = r, a._MSAARenderBuffer = l, a.samples = t, a._depthStencilBuffer = o, i.bindRenderbuffer(i.RENDERBUFFER, null), s.push(c) } i.drawBuffers(s) } else this._bindUnboundFramebuffer(e[0]._framebuffer); return this._bindUnboundFramebuffer(null), t }; var ds = function(e) { function t(t, i, n, r, o) { var s = this, a = !(!o || !o.generateMipMaps) && o.generateMipMaps, c = !(!o || !o.generateDepthTexture) && o.generateDepthTexture, l = !o || void 0 === o.doNotChangeAspectRatio || o.doNotChangeAspectRatio; if ((s = e.call(this, t, i, r, a, l) || this)._engine = r.getEngine(), s.isSupported) { for (var u = [], h = [], d = 0; d < n; d++) o && o.types && void 0 !== o.types[d] ? u.push(o.types[d]) : u.push(o && o.defaultType ? o.defaultType : _.a.TEXTURETYPE_UNSIGNED_INT), o && o.samplingModes && void 0 !== o.samplingModes[d] ? h.push(o.samplingModes[d]) : h.push(ke.a.BILINEAR_SAMPLINGMODE); var f = !o || void 0 === o.generateDepthBuffer || o.generateDepthBuffer, p = !(!o || void 0 === o.generateStencilBuffer) && o.generateStencilBuffer; return s._size = i, s._multiRenderTargetOptions = { samplingModes: h, generateMipMaps: a, generateDepthBuffer: f, generateStencilBuffer: p, generateDepthTexture: c, types: u, textureCount: n }, s._createInternalTextures(), s._createTextures(), s } s.dispose() } return l.d(t, e), Object.defineProperty(t.prototype, "isSupported", { get: function() { return this._engine.webGLVersion > 1 || this._engine.getCaps().drawBuffersExtension }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "textures", { get: function() { return this._textures }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "depthTexture", { get: function() { return this._textures[this._textures.length - 1] }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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 ke.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: !0, configurable: !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 }(_i), fs = function() { function e(e) { this.name = Ae.a.NAME_PROCEDURALTEXTURE, this.scene = e, this.scene.proceduralTextures = new Array, e.layers = new Array } return e.prototype.register = function() { this.scene._beforeClearStage.registerStep(Ae.a.STEP_BEFORECLEAR_PROCEDURALTEXTURE, this, this._beforeClear) }, e.prototype.rebuild = function() {}, e.prototype.dispose = function() {}, e.prototype._beforeClear = function() { if (this.scene.proceduralTexturesEnabled) { ye.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() } ye.h.EndPerformanceCounter("Procedural textures", this.scene.proceduralTextures.length > 0) } }, e }(), ps = "\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}"; zt.a.ShadersStore.proceduralVertexShader = ps; var _s = function(e) { function t(t, i, n, o, s, a, c) { void 0 === s && (s = null), void 0 === a && (a = !0), void 0 === c && (c = !1); var l = e.call(this, null, o, !a) || this; l.isCube = c, l.isEnabled = !0, l.autoClear = !0, l.onGeneratedObservable = new r.c, l._textures = {}, l._currentRefreshId = -1, l._refreshRate = 1, l._vertexBuffers = {}, l._uniforms = new Array, l._samplers = new Array, l._floats = {}, l._ints = {}, l._floatsArrays = {}, l._colors3 = {}, l._colors4 = {}, l._vectors2 = {}, l._vectors3 = {}, l._matrices = {}, l._fallbackTextureUsed = !1, l._cachedDefines = "", l._contentUpdateId = -1; var u = (o = l.getScene())._getComponent(Ae.a.NAME_PROCEDURALTEXTURE); u || (u = new fs(o), o._addComponent(u)), o.proceduralTextures.push(l), l._engine = o.getEngine(), l.name = t, l.isRenderTarget = !0, l._size = i, l._generateMipMaps = a, l.setFragment(n), l._fallbackTexture = s, c ? (l._texture = l._engine.createRenderTargetCubeTexture(i, { generateMipMaps: a, generateDepthBuffer: !1, generateStencilBuffer: !1 }), l.setFloat("face", 0)) : l._texture = l._engine.createRenderTargetTexture(i, { generateMipMaps: a, generateDepthBuffer: !1, generateStencilBuffer: !1 }); var h = []; return h.push(1, 1), h.push(-1, 1), h.push(-1, -1), h.push(1, -1), l._vertexBuffers[Oi.b.PositionKind] = new Oi.b(l._engine, h, Oi.b.PositionKind, !1, !1, 2), l._createIndexBuffer(), l } return l.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[Oi.b.PositionKind]; e && e._rebuild(), this._createIndexBuffer(), this.refreshRate === _i.REFRESHRATE_RENDER_ONCE && (this.refreshRate = _i.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 !1; if (this._fallbackTextureUsed) return !0; 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, [Oi.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 = !0 }), 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: !0, configurable: !0 }), 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 = !1), !1) }, 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(!1), 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, !0), i.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect), this._effect.setFloat("face", o), this.autoClear && i.clear(t.clearColor, !0, !1, !1), i.drawElementsType(so.a.TriangleFillMode, 0, 6), 5 === o && i.generateMipMapsForCubemap(this._texture); else i.bindFramebuffer(this._texture, 0, void 0, void 0, !0), i.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect), this.autoClear && i.clear(t.clearColor, !0, !1, !1), i.drawElementsType(so.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[Oi.b.PositionKind]; n && (n.dispose(), this._vertexBuffers[Oi.b.PositionKind] = null), this._indexBuffer && this._engine._releaseBuffer(this._indexBuffer) && (this._indexBuffer = null), e.prototype.dispose.call(this) } }, l.c([Object(L.c)()], t.prototype, "isEnabled", void 0), l.c([Object(L.c)()], t.prototype, "autoClear", void 0), l.c([Object(L.c)()], t.prototype, "_generateMipMaps", void 0), l.c([Object(L.c)()], t.prototype, "_size", void 0), l.c([Object(L.c)()], t.prototype, "refreshRate", null), t }(ke.a), gs = i(60), ms = function(e) { function t(t, i, n, r, o, s) { var a = e.call(this, t, n, null, r, o, s) || this; return a._animate = !0, a._time = 0, a._texturePath = i, a._loadJson(i), a.refreshRate = 1, a } return l.d(t, e), t.prototype._loadJson = function(e) { var t = this, i = function() { p.a.Log("No config file found in " + e + " trying to use ShadersStore or DOM element"); try { t.setFragment(t._texturePath) } catch (e) { p.a.Error("No json or ShaderStore or DOM element found for CustomProceduralTexture") } }, n = e + "/config.json", r = new gs.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() }, !1), r.addEventListener("error", function() { i() }, !1); try { r.send() } catch (e) { p.a.Error("CustomProceduralTexture: Error on XHR send request.") } }, t.prototype.isReady = function() { if (!e.prototype.isReady.call(this)) return !1; for (var t in this._textures) { if (!this._textures[t].isReady()) return !1 } return !0 }, t.prototype.render = function(t) { var i = this.getScene(); this._animate && i && (this._time += .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 ke.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 o.e(t.r, t.g, t.b)); break; case "color4": this.setColor4(t.name, new o.f(t.r, t.g, t.b, t.a)); break; case "vector2": this.setVector2(t.name, new o.w(t.x, t.y)); break; case "vector3": this.setVector3(t.name, new o.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: !0, configurable: !0 }), t }(_s), vs = "\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; l |= h, u.push(h) } switch (l) { case 0: (o.x.Dot(this.normal, t.plane.normal) > 0 ? i : n).push(t); break; case 1: r.push(t); break; case 2: s.push(t); break; case 3: var d, f = [], p = []; for (a = 0; a < t.vertices.length; a++) { var _ = (a + 1) % t.vertices.length, g = u[a], m = u[_], v = t.vertices[a], y = t.vertices[_]; if (2 !== g && f.push(v), 1 !== g && p.push(2 !== g ? v.clone() : v), 3 == (g | m)) { c = (this.w - o.x.Dot(this.normal, v.pos)) / o.x.Dot(this.normal, y.pos.subtract(v.pos)); var b = v.interpolate(y, c); f.push(b), p.push(b.clone()) } } f.length >= 3 && (d = new ws(f, t.shared)).plane && r.push(d), p.length >= 3 && (d = new ws(p, t.shared)).plane && s.push(d) } }, e.EPSILON = 1e-5, e }(), ws = function() { function e(e, t) { this.vertices = e, this.shared = t, this.plane = Ls.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() }), this.plane.flip() }, e }(), Fs = 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(), 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) : [], t.concat(i) }, 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 && (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 }(), Ns = function() { function e() { this.polygons = new Array } return e.FromMesh = function(t) { var i, n, r, s, a, c, l, u, h, d, f = new Array, p = null; if (!(t instanceof fe.a)) throw "BABYLON.CSG: Wrong Mesh type, must be BABYLON.Mesh"; t.computeWorldMatrix(!0), l = t.getWorldMatrix(), u = t.position.clone(), h = t.rotation.clone(), t.rotationQuaternion && (p = t.rotationQuaternion.clone()), d = t.scaling.clone(); for (var _ = t.getIndices(), g = t.getVerticesData(Oi.b.PositionKind), m = t.getVerticesData(Oi.b.NormalKind), v = t.getVerticesData(Oi.b.UVKind), y = t.subMeshes, b = 0, T = y.length; b < T; b++) for (var E = y[b].indexStart, A = y[b].indexCount + y[b].indexStart; E < A; E += 3) { c = []; for (var x = 0; x < 3; x++) { var R = new o.x(m[3 * _[E + x]], m[3 * _[E + x] + 1], m[3 * _[E + x] + 2]); r = new o.w(v[2 * _[E + x]], v[2 * _[E + x] + 1]); var P = new o.x(g[3 * _[E + x]], g[3 * _[E + x] + 1], g[3 * _[E + x] + 2]); s = o.x.TransformCoordinates(P, l), n = o.x.TransformNormal(R, l), i = new Ds(s, n, r), c.push(i) }(a = new ws(c, { subMeshId: b, meshId: Is, materialIndex: y[b].materialIndex })).plane && f.push(a) } var S = e.FromPolygons(f); return S.matrix = l, S.position = u, S.rotation = h, S.scaling = d, S.rotationQuaternion = p, Is++, S }, 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 Fs(this.clone().polygons), n = new Fs(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 Fs(this.polygons), i = new Fs(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 Fs(this.clone().polygons), n = new Fs(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 Fs(this.polygons), i = new Fs(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 Fs(this.clone().polygons), n = new Fs(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 Fs(this.polygons), i = new Fs(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, s, a, c = new fe.a(e, t), l = [], u = [], h = [], d = [], f = o.x.Zero(), p = o.x.Zero(), _ = o.w.Zero(), g = this.polygons, m = [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 T = 0, E = g.length; T < E; T++) { b[(r = g[T]).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 }), a = b[r.shared.meshId][r.shared.subMeshId]; for (var A = 2, x = r.vertices.length; A < x; A++) { m[0] = 0, m[1] = A - 1, m[2] = A; for (var R = 0; R < 3; R++) { f.copyFrom(r.vertices[m[R]].pos), p.copyFrom(r.vertices[m[R]].normal), _.copyFrom(r.vertices[m[R]].uv); var P = o.x.TransformCoordinates(f, n), S = o.x.TransformNormal(p, n); void 0 !== (s = v[P.x + "," + P.y + "," + P.z]) && h[3 * s] === S.x && h[3 * s + 1] === S.y && h[3 * s + 2] === S.z && d[2 * s] === _.x && d[2 * s + 1] === _.y || (l.push(P.x, P.y, P.z), d.push(_.x, _.y), h.push(p.x, p.y, p.z), s = v[P.x + "," + P.y + "," + P.z] = l.length / 3 - 1), u.push(s), a.indexStart = Math.min(y, a.indexStart), a.indexEnd = Math.max(y, a.indexEnd), y++ } } } if (c.setVerticesData(Oi.b.PositionKind, l), c.setVerticesData(Oi.b.NormalKind, h), c.setVerticesData(Oi.b.UVKind, d), c.setIndices(u, null), i) { var C, M = 0; for (var O in c.subMeshes = new Array, b) { for (var I in C = -1, b[O]) a = b[O][I], Os.b.CreateFromIndices(a.materialIndex + M, a.indexStart, a.indexEnd - a.indexStart + 1, c), C = Math.max(a.materialIndex, C); M += ++C } } 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()), r.scaling.copyFrom(this.scaling), r.computeWorldMatrix(!0), r }, e }(), Bs = function(e) { function t(t, i, n, r, s, a) { void 0 === r && (r = 1), void 0 === s && (s = 60), void 0 === a && (a = !0); var c = e.call(this, t, n) || this; c._sectionPolygonPointsCount = 4, c._running = !1, c._autoStart = a, c._generator = i, c._diameter = r, c._length = s, c._sectionVectors = [], c._sectionNormalVectors = []; for (var l = 0; l < c._sectionPolygonPointsCount; l++) c._sectionVectors[l] = o.x.Zero(), c._sectionNormalVectors[l] = o.x.Zero(); return c._createMesh(), c } return l.d(t, e), t.prototype.getClassName = function() { return "TrailMesh" }, t.prototype._createMesh = function() { var e = new Mi.a, t = [], i = [], n = [], r = o.x.Zero(); this._generator._boundingInfo && (r = this._generator._boundingInfo.boundingBox.centerWorld); for (var s = 2 * Math.PI / this._sectionPolygonPointsCount, a = 0; a < this._sectionPolygonPointsCount; a++) t.push(r.x + Math.cos(a * s) * this._diameter, r.y + Math.sin(a * s) * this._diameter, r.z); for (a = 1; a <= this._length; a++) { for (var c = 0; c < this._sectionPolygonPointsCount; c++) t.push(r.x + Math.cos(c * s) * this._diameter, r.y + Math.sin(c * s) * this._diameter, r.z); var l = t.length / 3 - 2 * this._sectionPolygonPointsCount; for (c = 0; c < this._sectionPolygonPointsCount - 1; c++) n.push(l + c, l + c + this._sectionPolygonPointsCount, l + c + this._sectionPolygonPointsCount + 1), n.push(l + c, l + c + this._sectionPolygonPointsCount + 1, l + c + 1); n.push(l + this._sectionPolygonPointsCount - 1, l + this._sectionPolygonPointsCount - 1 + this._sectionPolygonPointsCount, l + this._sectionPolygonPointsCount), n.push(l + this._sectionPolygonPointsCount - 1, l + this._sectionPolygonPointsCount, l) } Mi.a.ComputeNormals(t, n, i), e.positions = t, e.normals = i, e.indices = n, e.applyToMesh(this, !0), this._autoStart && this.start() }, t.prototype.start = function() { var e = this; this._running || (this._running = !0, this._beforeRenderObserver = this.getScene().onBeforeRenderObservable.add(function() { e.update() })) }, t.prototype.stop = function() { this._beforeRenderObserver && this._running && (this._running = !1, this.getScene().onBeforeRenderObservable.remove(this._beforeRenderObserver)) }, t.prototype.update = function() { var e = this.getVerticesData(Oi.b.PositionKind), t = this.getVerticesData(Oi.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, s = 2 * Math.PI / this._sectionPolygonPointsCount; for (n = 0; n < this._sectionPolygonPointsCount; n++) this._sectionVectors[n].copyFromFloats(Math.cos(n * s) * this._diameter, Math.sin(n * s) * this._diameter, 0), this._sectionNormalVectors[n].copyFromFloats(Math.cos(n * s), Math.sin(n * s), 0), o.x.TransformCoordinatesToRef(this._sectionVectors[n], i, this._sectionVectors[n]), o.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(Oi.b.PositionKind, e, !0, !1), this.updateVerticesData(Oi.b.NormalKind, t, !0, !1) } }, 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 }(fe.a), Us = i(111), Vs = i(72); Mi.a.CreateDisc = function(e) { var t = new Array, i = new Array, n = new Array, r = new Array, o = e.radius || .5, s = e.tessellation || 64, a = e.arc && (e.arc <= 0 || e.arc > 1) ? 1 : e.arc || 1, c = 0 === e.sideOrientation ? 0 : e.sideOrientation || Mi.a.DEFAULTSIDE; t.push(0, 0, 0), r.push(.5, .5); for (var l = 2 * Math.PI * a, u = l / s, h = 0; h < l; h += u) { var d = Math.cos(h), f = Math.sin(h), p = (d + 1) / 2, _ = (1 - f) / 2; t.push(o * d, o * f, 0), r.push(p, _) } 1 === a && (t.push(t[3], t[4], t[5]), r.push(r[2], r[3])); for (var g = t.length / 3, m = 1; m < g - 1; m++) i.push(m + 1, 0, m); Mi.a.ComputeNormals(t, i, n), Mi.a._ComputeSides(c, t, i, n, r, e.frontUVs, e.backUVs); var v = new Mi.a; return v.indices = i, v.positions = t, v.normals = n, v.uvs = r, v }, fe.a.CreateDisc = function(e, t, i, n, r, o) { void 0 === n && (n = null); var s = { radius: t, tessellation: i, sideOrientation: o, updatable: r }; return Gs.CreateDisc(e, s, n) }; var Gs = function() { function e() {} return e.CreateDisc = function(e, t, i) { void 0 === i && (i = null); var n = new fe.a(e, i); return t.sideOrientation = fe.a._GetDefaultSideOrientation(t.sideOrientation), n._originalBuilderSideOrientation = t.sideOrientation, Mi.a.CreateDisc(t).applyToMesh(n, t.updatable), n }, e }(); Mi.a.CreateTorusKnot = function(e) { var t, i, n = new Array, r = new Array, s = new Array, a = new Array, c = e.radius || 2, l = e.tube || .5, u = e.radialSegments || 32, h = e.tubularSegments || 32, d = e.p || 2, f = e.q || 3, p = 0 === e.sideOrientation ? 0 : e.sideOrientation || Mi.a.DEFAULTSIDE, _ = function(e) { var t = Math.cos(e), i = Math.sin(e), n = f / d * e, r = Math.cos(n), s = c * (2 + r) * .5 * t, a = c * (2 + r) * i * .5, l = c * Math.sin(n) * .5; return new o.x(s, a, l) }; for (t = 0; t <= u; t++) { var g = t % u / u * 2 * d * Math.PI, m = _(g), v = _(g + .01), y = v.subtract(m), b = v.add(m), T = o.x.Cross(y, b); for (b = o.x.Cross(T, y), T.normalize(), b.normalize(), i = 0; i < h; i++) { var E = i % h / h * 2 * Math.PI, A = -l * Math.cos(E), x = l * Math.sin(E); r.push(m.x + A * b.x + x * T.x), r.push(m.y + A * b.y + x * T.y), r.push(m.z + A * b.z + x * T.z), a.push(t / u), a.push(i / h) } } for (t = 0; t < u; t++) for (i = 0; i < h; i++) { var R = (i + 1) % h, P = t * h + i, S = (t + 1) * h + i, C = (t + 1) * h + R, M = t * h + R; n.push(M), n.push(S), n.push(P), n.push(M), n.push(C), n.push(S) } Mi.a.ComputeNormals(r, n, s), Mi.a._ComputeSides(p, r, n, s, a, e.frontUVs, e.backUVs); var O = new Mi.a; return O.indices = n, O.positions = r, O.normals = s, O.uvs = a, O }, fe.a.CreateTorusKnot = function(e, t, i, n, r, o, s, a, c, l) { var u = { radius: t, tube: i, radialSegments: n, tubularSegments: r, p: o, q: s, sideOrientation: l, updatable: c }; return ks.CreateTorusKnot(e, u, a) }; var ks = function() { function e() {} return e.CreateTorusKnot = function(e, t, i) { var n = new fe.a(e, i); return t.sideOrientation = fe.a._GetDefaultSideOrientation(t.sideOrientation), n._originalBuilderSideOrientation = t.sideOrientation, Mi.a.CreateTorusKnot(t).applyToMesh(n, t.updatable), n }, e }(), zs = function(e) { function t(t, i) { var n = e.call(this, t.x, t.y) || this; return n.index = i, n } return l.d(t, e), t }(o.w), js = 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 zs(e, t.elements.length); i.push(n), t.elements.push(n) } }), i }, e.prototype.computeBounds = function() { var e = new o.w(this.elements[0].x, this.elements[0].y), t = new o.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 } }, e }(), Hs = function() { function e() {} return e.Rectangle = function(e, t, i, n) { return [new o.w(e, t), new o.w(i, t), new o.w(i, n), new o.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, s = 0, a = 2 * Math.PI / n, c = 0; c < n; c++) r.push(new o.w(t + Math.cos(s) * e, i + Math.sin(s) * e)), s -= a; 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 o.w(i[t], i[t + 1])); return n }, e.StartingAt = function(e, t) { return o.l.StartingAt(e, t) }, e }(), Ws = function() { function e(e, t, i, n) { var r; void 0 === n && (n = earcut), this._points = new js, this._outlinepoints = new js, this._holes = new Array, this._epoints = new Array, this._eholes = new Array, this.bjsEarcut = n, this._name = e, this._scene = i || ge.b.LastCreatedScene, r = t instanceof o.l ? t.getPoints() : t, this._addToepoint(r), this._points.add(r), this._outlinepoints.add(r), void 0 === this.bjsEarcut && p.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 js; 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 = !1), void 0 === t && (t = 0); var i = new fe.a(this._name, this._scene), n = this.buildVertexData(t); return i.setVerticesData(Oi.b.PositionKind, n.positions, e), i.setVerticesData(Oi.b.NormalKind, n.normals, e), i.setVerticesData(Oi.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 Mi.a, n = new Array, r = new Array, o = new Array, s = 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 - s.min.x) / s.width, (e.y - s.min.y) / s.height) }); for (var a = new Array, c = this.bjsEarcut(this._epoints, this._eholes, 2), l = 0; l < c.length; l++) a.push(c[l]); if (e > 0) { var u = 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 - s.min.x) / s.width, 1 - (t.y - s.min.y) / s.height) }); var h = a.length; for (l = 0; l < h; l += 3) { var d = a[l + 0], f = a[l + 1], p = a[l + 2]; a.push(p + u), a.push(f + u), a.push(d + u) } this.addSide(r, n, o, a, s, this._outlinepoints, e, !1), this._holes.forEach(function(i) { t.addSide(r, n, o, a, s, i, e, !0) }) } return i.indices = a, i.positions = r, i.normals = n, i.uvs = o, i }, e.prototype.addSide = function(e, t, i, n, r, s, a, c) { for (var l = e.length / 3, u = 0, h = 0; h < s.elements.length; h++) { var d, f = s.elements[h]; d = h + 1 > s.elements.length - 1 ? s.elements[0] : s.elements[h + 1], e.push(f.x, 0, f.y), e.push(f.x, -a, f.y), e.push(d.x, 0, d.y), e.push(d.x, -a, d.y); var p = new o.x(f.x, 0, f.y), _ = new o.x(d.x, 0, d.y).subtract(p), g = new o.x(0, 1, 0), m = o.x.Cross(_, g); m = m.normalize(), i.push(u / r.width, 0), i.push(u / r.width, 1), u += _.length(), i.push(u / r.width, 0), i.push(u / r.width, 1), c ? (t.push(m.x, m.y, m.z), t.push(m.x, m.y, m.z), t.push(m.x, m.y, m.z), t.push(m.x, m.y, m.z), n.push(l), n.push(l + 2), n.push(l + 1), n.push(l + 1), n.push(l + 2), n.push(l + 3)) : (t.push(-m.x, -m.y, -m.z), t.push(-m.x, -m.y, -m.z), t.push(-m.x, -m.y, -m.z), t.push(-m.x, -m.y, -m.z), n.push(l), n.push(l + 1), n.push(l + 2), n.push(l + 1), n.push(l + 3), n.push(l + 2)), l += 4 } }, e }(); Mi.a.CreatePolygon = function(e, t, i, n, r, s) { for (var a = i || new Array(3), c = n, l = [], u = 0; u < 3; u++) void 0 === a[u] && (a[u] = new o.y(0, 0, 1, 1)), c && void 0 === c[u] && (c[u] = new o.f(1, 1, 1, 1)); for (var h = e.getVerticesData(Oi.b.PositionKind), d = e.getVerticesData(Oi.b.NormalKind), f = e.getVerticesData(Oi.b.UVKind), p = e.getIndices(), _ = 0, g = 0, m = 0; m < d.length; m += 3) Math.abs(d[m + 1]) < .001 && (g = 1), Math.abs(d[m + 1] - 1) < .001 && (g = 0), Math.abs(d[m + 1] + 1) < .001 && (g = 2), f[2 * (_ = m / 3)] = (1 - f[2 * _]) * a[g].x + f[2 * _] * a[g].z, f[2 * _ + 1] = (1 - f[2 * _ + 1]) * a[g].y + f[2 * _ + 1] * a[g].w, c && l.push(c[g].r, c[g].g, c[g].b, c[g].a); Mi.a._ComputeSides(t, h, p, d, f, r, s); var v = new Mi.a; if (v.indices = p, v.positions = h, v.normals = d, v.uvs = f, c) { var y = t === Mi.a.DOUBLESIDE ? l.concat(l) : l; v.colors = y } return v }, fe.a.CreatePolygon = function(e, t, i, n, r, o, s) { void 0 === s && (s = earcut); var a = { shape: t, holes: n, updatable: r, sideOrientation: o }; return Xs.CreatePolygon(e, a, i, s) }, fe.a.ExtrudePolygon = function(e, t, i, n, r, o, s, a) { void 0 === a && (a = earcut); var c = { shape: t, holes: r, depth: i, updatable: o, sideOrientation: s }; return Xs.ExtrudePolygon(e, c, n, a) }; var Xs = function() { function e() {} return e.CreatePolygon = function(e, t, i, n) { void 0 === i && (i = null), void 0 === n && (n = earcut), t.sideOrientation = fe.a._GetDefaultSideOrientation(t.sideOrientation); for (var r = t.shape, s = t.holes || [], a = t.depth || 0, c = [], l = [], u = 0; u < r.length; u++) c[u] = new o.w(r[u].x, r[u].z); c[0].equalsWithEpsilon(c[c.length - 1], 1e-8) && c.pop(); for (var h = new Ws(e, c, i || P.a.LastCreatedScene, n), d = 0; d < s.length; d++) { l = []; for (var f = 0; f < s[d].length; f++) l.push(new o.w(s[d][f].x, s[d][f].z)); h.addHole(l) } var p = h.build(t.updatable, a); return p._originalBuilderSideOrientation = t.sideOrientation, Mi.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 }(); fe.a.CreateLathe = function(e, t, i, n, r, o, s) { var a = { shape: t, radius: i, tessellation: n, sideOrientation: s, updatable: o }; return Ys.CreateLathe(e, a, r) }; var Ys = 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, s = void 0 === t.closed || t.closed, a = t.shape, c = t.radius || 1, l = t.tessellation || 64, u = t.clip || 0, h = t.updatable, d = fe.a._GetDefaultSideOrientation(t.sideOrientation), f = t.cap || fe.a.NO_CAP, p = 2 * Math.PI, _ = new Array, g = t.invertUV || !1, m = 0, v = 0, y = p / l * r, b = new Array; for (m = 0; m <= l - u; m++) { b = []; for (f != fe.a.CAP_START && f != fe.a.CAP_ALL || (b.push(new o.x(0, a[0].y, 0)), b.push(new o.x(Math.cos(m * y) * a[0].x * c, a[0].y, Math.sin(m * y) * a[0].x * c))), v = 0; v < a.length; v++) n = new o.x(Math.cos(m * y) * a[v].x * c, a[v].y, Math.sin(m * y) * a[v].x * c), b.push(n); f != fe.a.CAP_END && f != fe.a.CAP_ALL || (b.push(new o.x(Math.cos(m * y) * a[a.length - 1].x * c, a[a.length - 1].y, Math.sin(m * y) * a[a.length - 1].x * c)), b.push(new o.x(0, a[a.length - 1].y, 0))), _.push(b) } return Yo.CreateRibbon(e, { pathArray: _, closeArray: s, sideOrientation: d, updatable: h, invertUV: g, frontUVs: t.frontUVs, backUVs: t.backUVs }, i) }, e }(); fe.a.CreateTube = function(e, t, i, n, r, o, s, a, c, l) { var u = { path: t, radius: i, tessellation: n, radiusFunction: r, arc: 1, cap: o, updatable: a, sideOrientation: c, instance: l }; return Ks.CreateTube(e, u, s) }; var Ks = function() { function e() {} return e.CreateTube = function(e, t, i) { void 0 === i && (i = null); var n = t.path, r = t.instance, s = 1; void 0 !== t.radius ? s = t.radius : r && (s = r._creationDataStorage.radius); var a = t.tessellation || 64, c = t.radiusFunction || null, l = t.cap || fe.a.NO_CAP, u = t.invertUV || !1, h = t.updatable, d = fe.a._GetDefaultSideOrientation(t.sideOrientation); t.arc = t.arc && (t.arc <= 0 || t.arc > 1) ? 1 : t.arc || 1; var f, p, _ = function(e, t, i, n, r, s, a, c) { for (var l, u, h, d, f = t.getTangents(), p = t.getNormals(), _ = t.getDistances(), g = 2 * Math.PI / r * c, m = s || function() { return n }, v = o.t.Matrix[0], y = a === fe.a.NO_CAP || a === fe.a.CAP_END ? 0 : 2, b = 0; b < e.length; b++) { u = m(b, _[b]), l = Array(), h = p[b]; for (var T = 0; T < r; T++) o.j.RotationAxisToRef(f[b], g * T, v), d = l[T] ? l[T] : o.x.Zero(), o.x.TransformCoordinatesToRef(h, v, d), d.scaleInPlace(u).addInPlace(e[b]), l[T] = d; i[y] = l, y++ } var E = function(t, i) { for (var n = Array(), r = 0; r < t; r++) n.push(e[i]); return n }; switch (a) { case fe.a.NO_CAP: break; case fe.a.CAP_START: i[0] = E(r, 0), i[1] = i[2].slice(0); break; case fe.a.CAP_END: i[y] = i[y - 1].slice(0), i[y + 1] = E(r, e.length - 1); break; case fe.a.CAP_ALL: i[0] = E(r, 0), i[1] = i[2].slice(0), i[y] = i[y - 1].slice(0), i[y + 1] = E(r, e.length - 1) } return i }; if (r) { var g = r._creationDataStorage, m = t.arc || g.arc; return p = _(n, f = g.path3D.update(n), g.pathArray, s, g.tessellation, c, g.cap, m), r = Yo.CreateRibbon("", { pathArray: p, instance: r }), g.path3D = f, g.pathArray = p, g.arc = m, g.radius = s, r } p = _(n, f = new o.m(n), new Array, s, a, c, l = l < 0 || l > 3 ? 0 : l, t.arc); var v = Yo.CreateRibbon(e, { pathArray: p, closePath: !0, closeArray: !1, updatable: h, sideOrientation: d, invertUV: u, frontUVs: t.frontUVs, backUVs: t.backUVs }, i); return v._creationDataStorage.pathArray = p, v._creationDataStorage.path3D = f, v._creationDataStorage.tessellation = a, v._creationDataStorage.cap = l, v._creationDataStorage.arc = t.arc, v._creationDataStorage.radius = s, v }, e }(); Mi.a.CreateIcoSphere = function(e) { var t, i = e.sideOrientation || Mi.a.DEFAULTSIDE, n = e.radius || 1, r = void 0 === e.flat || e.flat, s = e.subdivisions || 4, a = e.radiusX || n, c = e.radiusY || n, l = e.radiusZ || n, u = (1 + Math.sqrt(5)) / 2, h = [-1, u, -0, 1, u, 0, -1, -u, 0, 1, -u, 0, 0, -1, -u, 0, 1, -u, 0, -1, u, 0, 1, u, u, 0, 1, u, 0, -1, -u, 0, 1, -u, 0, -1], d = [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], f = [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], _ = [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0], g = new Array, m = new Array, v = new Array, y = new Array, b = 0, T = new Array(3), E = new Array(3); for (t = 0; t < 3; t++) T[t] = o.x.Zero(), E[t] = o.w.Zero(); for (var A = 0; A < 20; A++) { for (t = 0; t < 3; t++) { var x = d[3 * A + t]; T[t].copyFromFloats(h[3 * f[x]], h[3 * f[x] + 1], h[3 * f[x] + 2]), T[t].normalize().scaleInPlace(n), E[t].copyFromFloats(p[2 * x] * (138 / 1024) + 60 / 1024 + _[A] * (-40 / 1024), p[2 * x + 1] * (239 / 1024) + 26 / 1024 + _[A] * (20 / 1024)) } for (var R = function(e, t, i, n) { var u, h = o.x.Lerp(T[0], T[2], t / s), d = o.x.Lerp(T[1], T[2], t / s), f = s === t ? T[2] : o.x.Lerp(h, d, e / (s - t)); if (f.normalize(), r) { var p = o.x.Lerp(T[0], T[2], n / s), _ = o.x.Lerp(T[1], T[2], n / s); u = o.x.Lerp(p, _, i / (s - n)) } else u = new o.x(f.x, f.y, f.z); u.x /= a, u.y /= c, u.z /= l, u.normalize(); var A = o.w.Lerp(E[0], E[2], t / s), x = o.w.Lerp(E[1], E[2], t / s), R = s === t ? E[2] : o.w.Lerp(A, x, e / (s - t)); m.push(f.x * a, f.y * c, f.z * l), v.push(u.x, u.y, u.z), y.push(R.x, R.y), g.push(b), b++ }, P = 0; P < s; P++) for (var S = 0; S + P < s; S++) R(S, P, S + 1 / 3, P + 1 / 3), R(S + 1, P, S + 1 / 3, P + 1 / 3), R(S, P + 1, S + 1 / 3, P + 1 / 3), S + P + 1 < s && (R(S + 1, P, S + 2 / 3, P + 2 / 3), R(S + 1, P + 1, S + 2 / 3, P + 2 / 3), R(S, P + 1, S + 2 / 3, P + 2 / 3)) } Mi.a._ComputeSides(i, m, g, v, y, e.frontUVs, e.backUVs); var C = new Mi.a; return C.indices = g, C.positions = m, C.normals = v, C.uvs = y, C }, fe.a.CreateIcoSphere = function(e, t, i) { return Qs.CreateIcoSphere(e, t, i) }; var Qs = function() { function e() {} return e.CreateIcoSphere = function(e, t, i) { void 0 === i && (i = null); var n = new fe.a(e, i); return t.sideOrientation = fe.a._GetDefaultSideOrientation(t.sideOrientation), n._originalBuilderSideOrientation = t.sideOrientation, Mi.a.CreateIcoSphere(t).applyToMesh(n, t.updatable), n }, e }(); fe.a.CreateDecal = function(e, t, i, n, r, o) { var s = { position: i, normal: n, size: r, angle: o }; return Zs.CreateDecal(e, t, s) }; var qs, Zs = function() { function e() {} return e.CreateDecal = function(e, t, i) { var n = t.getIndices(), r = t.getVerticesData(Oi.b.PositionKind), s = t.getVerticesData(Oi.b.NormalKind), a = i.position || o.x.Zero(), c = i.normal || o.x.Up(), l = i.size || o.x.One(), u = i.angle || 0; if (!c) { var h = new o.x(0, 0, 1), d = t.getScene().activeCamera, f = o.x.TransformCoordinates(h, d.getWorldMatrix()); c = d.globalPosition.subtract(f) } var p = -Math.atan2(c.z, c.x) - Math.PI / 2, _ = Math.sqrt(c.x * c.x + c.z * c.z), g = Math.atan2(c.y, _), m = o.j.RotationYawPitchRoll(p, g, u).multiply(o.j.Translation(a.x, a.y, a.z)), v = o.j.Invert(m), y = t.getWorldMatrix().multiply(v), b = new Mi.a; b.indices = [], b.positions = [], b.normals = [], b.uvs = []; for (var T = 0, E = function(e) { var t = new o.p; if (!n || !r || !s) return t; var i = n[e]; return t.position = new o.x(r[3 * i], r[3 * i + 1], r[3 * i + 2]), t.position = o.x.TransformCoordinates(t.position, y), t.normal = new o.x(s[3 * i], s[3 * i + 1], s[3 * i + 2]), t.normal = o.x.TransformNormal(t.normal, y), t }, A = function(e, t) { if (0 === e.length) return e; for (var i = .5 * Math.abs(o.x.Dot(l, t)), n = function(e, n) { var r = o.x.GetClipFactor(e.position, n.position, t, i); return new o.p(o.x.Lerp(e.position, n.position, r), o.x.Lerp(e.normal, n.normal, r)) }, r = new Array, s = 0; s < e.length; s += 3) { var a, c, u, h = null, d = null, f = null, p = null; switch (((a = o.x.Dot(e[s].position, t) - i > 0) ? 1 : 0) + ((c = o.x.Dot(e[s + 1].position, t) - i > 0) ? 1 : 0) + ((u = o.x.Dot(e[s + 2].position, t) - i > 0) ? 1 : 0)) { case 0: r.push(e[s]), r.push(e[s + 1]), r.push(e[s + 2]); break; case 1: if (a && (h = e[s + 1], d = e[s + 2], f = n(e[s], h), p = n(e[s], d)), c) { h = e[s], d = e[s + 2], f = n(e[s + 1], h), p = n(e[s + 1], d), r.push(f), r.push(d.clone()), r.push(h.clone()), r.push(d.clone()), r.push(f.clone()), r.push(p); break } u && (h = e[s], d = e[s + 1], f = n(e[s + 2], h), p = n(e[s + 2], d)), h && d && f && p && (r.push(h.clone()), r.push(d.clone()), r.push(f), r.push(p), r.push(f.clone()), r.push(d.clone())); break; case 2: a || (d = n(h = e[s].clone(), e[s + 1]), f = n(h, e[s + 2]), r.push(h), r.push(d), r.push(f)), c || (d = n(h = e[s + 1].clone(), e[s + 2]), f = n(h, e[s]), r.push(h), r.push(d), r.push(f)), u || (d = n(h = e[s + 2].clone(), e[s]), f = n(h, e[s + 1]), r.push(h), r.push(d), r.push(f)) } } return r }, x = 0; x < n.length; x += 3) { var R = new Array; if (R.push(E(x)), R.push(E(x + 1)), R.push(E(x + 2)), R = A(R, new o.x(1, 0, 0)), R = A(R, new o.x(-1, 0, 0)), R = A(R, new o.x(0, 1, 0)), R = A(R, new o.x(0, -1, 0)), R = A(R, new o.x(0, 0, 1)), 0 !== (R = A(R, new o.x(0, 0, -1))).length) for (var P = 0; P < R.length; P++) { var S = R[P]; b.indices.push(T), S.position.toArray(b.positions, 3 * T), S.normal.toArray(b.normals, 3 * T), b.uvs.push(.5 + S.position.x / l.x), b.uvs.push(.5 + S.position.y / l.y), T++ } } var C = new fe.a(e, t.getScene()); return b.applyToMesh(C), C.position = a.clone(), C.rotation = new o.x(g, p, u), C }, e }(), Js = function() { function e() {} return e.CreateBox = function(e, t, i) { return void 0 === i && (i = null), Mn.a.CreateBox(e, t, i) }, e.CreateSphere = function(e, t, i) { return void 0 === i && (i = null), Ln.a.CreateSphere(e, t, i) }, e.CreateDisc = function(e, t, i) { return void 0 === i && (i = null), Gs.CreateDisc(e, t, i) }, e.CreateIcoSphere = function(e, t, i) { return void 0 === i && (i = null), Qs.CreateIcoSphere(e, t, i) }, e.CreateRibbon = function(e, t, i) { return void 0 === i && (i = null), Yo.CreateRibbon(e, t, i) }, e.CreateCylinder = function(e, t, i) { return void 0 === i && (i = null), Fi.a.CreateCylinder(e, t, i) }, e.CreateTorus = function(e, t, i) { return void 0 === i && (i = null), wi.CreateTorus(e, t, i) }, e.CreateTorusKnot = function(e, t, i) { return void 0 === i && (i = null), ks.CreateTorusKnot(e, t, i) }, e.CreateLineSystem = function(e, t, i) { return wn.a.CreateLineSystem(e, t, i) }, e.CreateLines = function(e, t, i) { return void 0 === i && (i = null), wn.a.CreateLines(e, t, i) }, e.CreateDashedLines = function(e, t, i) { return void 0 === i && (i = null), wn.a.CreateDashedLines(e, t, i) }, e.ExtrudeShape = function(e, t, i) { return void 0 === i && (i = null), Ko.ExtrudeShape(e, t, i) }, e.ExtrudeShapeCustom = function(e, t, i) { return void 0 === i && (i = null), Ko.ExtrudeShapeCustom(e, t, i) }, e.CreateLathe = function(e, t, i) { return void 0 === i && (i = null), Ys.CreateLathe(e, t, i) }, e.CreatePlane = function(e, t, i) { return void 0 === i && (i = null), fr.a.CreatePlane(e, t, i) }, e.CreateGround = function(e, t, i) { return void 0 === i && (i = null), Di.CreateGround(e, t, i) }, e.CreateTiledGround = function(e, t, i) { return void 0 === i && (i = null), Di.CreateTiledGround(e, t, i) }, e.CreateGroundFromHeightMap = function(e, t, i, n) { return void 0 === n && (n = null), Di.CreateGroundFromHeightMap(e, t, i, n) }, e.CreatePolygon = function(e, t, i, n) { return void 0 === i && (i = null), void 0 === n && (n = earcut), Xs.CreatePolygon(e, t, i, n) }, e.ExtrudePolygon = function(e, t, i, n) { return void 0 === i && (i = null), void 0 === n && (n = earcut), Xs.ExtrudePolygon(e, t, i, n) }, e.CreateTube = function(e, t, i) { return void 0 === i && (i = null), Ks.CreateTube(e, t, i) }, e.CreatePolyhedron = function(e, t, i) { return void 0 === i && (i = null), Vn.CreatePolyhedron(e, t, i) }, e.CreateDecal = function(e, t, i) { return Zs.CreateDecal(e, t, i) }, e }(), $s = function() { return function(e, t, i) { this.quality = e, this.distance = t, this.optimizeMesh = i } }(), ea = function() { function e() { this.running = !1, this._simplificationArray = [] } return e.prototype.addTask = function(e) { this._simplificationArray.push(e) }, e.prototype.executeNext = function() { var e = this._simplificationArray.pop(); e ? (this.running = !0, this.runSimplification(e)) : this.running = !1 }, 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 = !0, i.quality === e.settings[e.settings.length - 1].quality && e.successCallback && e.successCallback(), t.executeNext() }) }); else { var i = this.getSimplifier(e); ye.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 = !0, r() }) }, function() { e.successCallback && e.successCallback(), t.executeNext() }) } }, e.prototype.getSimplifier = function(e) { switch (e.simplificationType) { case qs.QUADRATIC: default: return new oa(e.mesh) } }, e }(); ! function(e) { e[e.QUADRATIC = 0] = "QUADRATIC" }(qs || (qs = {})); var ta = function() { return function(e) { this.vertices = e, this.error = new Array(4), this.deleted = !1, this.isDirty = !1, this.deletePending = !1, this.borderFactor = 0 } }(), ia = function() { function e(e, t) { this.position = e, this.id = t, this.isBorder = !0, this.q = new na, this.triangleCount = 0, this.triangleStart = 0, this.originalOffsets = [] } return e.prototype.updatePosition = function(e) { this.position.copyFrom(e) }, e }(), na = 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, s, a, c) { return this.data[e] * this.data[r] * this.data[c] + this.data[i] * this.data[n] * this.data[a] + this.data[t] * this.data[o] * this.data[s] - this.data[i] * this.data[r] * this.data[s] - this.data[e] * this.data[o] * this.data[a] - 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 }(), ra = function() { return function(e, t) { this.vertexId = e, this.triangleId = t } }(), oa = function() { function e(e) { this._mesh = e, this.syncIterations = 5e3, this.aggressiveness = 7, this.decimationIterations = 100, this.boundingBoxEpsilon = o.h } return e.prototype.simplify = function(e, t) { var i = this; this.initDecimatedMesh(), ye.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), s = 0, a = this.triangles.length; ye.a.Run(this.decimationIterations, function(e) { var t, i; a - s <= 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 = !1; var c = 1e-9 * Math.pow(t + 3, n.aggressiveness); ye.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 a = [], l = [], u = i.vertices[r], h = i.vertices[(r + 1) % 3]; if (u.isBorder || h.isBorder) continue; var d = o.x.Zero(); n.calculateError(u, h, d); var f = new Array; if (n.isFlipped(u, h, d, a, f)) continue; if (n.isFlipped(h, u, d, l, f)) continue; if (a.indexOf(!0) < 0 || l.indexOf(!0) < 0) continue; var p = new Array; if (f.forEach(function(e) { -1 === p.indexOf(e) && (e.deletePending = !0, p.push(e)) }), p.length % 2 != 0) continue; u.q = h.q.add(u.q), u.updatePosition(d); var _ = n.references.length; s = n.updateTriangles(u, u, a, s), s = n.updateTriangles(u, h, l, s); var g = n.references.length - _; if (g <= u.triangleCount) { if (g) for (var m = 0; m < g; m++) n.references[u.triangleStart + m] = n.references[_ + m] } else u.triangleStart = _; u.triangleCount = g; break } }, i, function() { return a - s <= 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(Oi.b.PositionKind), s = this._mesh.getIndices(), a = this._mesh.subMeshes[e], c = [], l = a.verticesCount; ye.a.SyncAsyncForLoop(l, this.syncIterations / 4 >> 0, function(e) { if (r) { var t = e + a.verticesStart, s = o.x.FromArray(r, 3 * t), l = 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 }(s) || new ia(s, n.vertices.length); l.originalOffsets.push(t), l.id === n.vertices.length && n.vertices.push(l), c.push(l.id) } }, function() { ye.a.SyncAsyncForLoop(a.indexCount / 3, n.syncIterations, function(e) { if (s) { var t = 3 * (a.indexStart / 3 + e), i = s[t + 0], r = s[t + 1], o = s[t + 2], l = n.vertices[c[i - a.verticesStart]], u = n.vertices[c[r - a.verticesStart]], h = n.vertices[c[o - a.verticesStart]], d = new ta([l, u, h]); d.originalOffset = t, n.triangles.push(d) } }, function() { n.init(t) }) }) }, e.prototype.init = function(e) { var t = this; ye.a.SyncAsyncForLoop(this.triangles.length, this.syncIterations, function(e) { var i = t.triangles[e]; i.normal = o.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(na.DataFromNumbers(i.normal.x, i.normal.y, i.normal.z, -o.x.Dot(i.normal, i.vertices[0].position))) }, function() { ye.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) } var o = this._reconstructedMesh.getVerticesData(Oi.b.PositionKind) || [], s = this._reconstructedMesh.getVerticesData(Oi.b.NormalKind) || [], a = this._reconstructedMesh.getVerticesData(Oi.b.UVKind) || [], c = this._reconstructedMesh.getVerticesData(Oi.b.ColorKind) || [], l = this._mesh.getVerticesData(Oi.b.NormalKind), u = this._mesh.getVerticesData(Oi.b.UVKind), h = this._mesh.getVerticesData(Oi.b.ColorKind), d = 0; for (t = 0; t < this.vertices.length; ++t) { var f = this.vertices[t]; f.id = d, f.triangleCount && f.originalOffsets.forEach(function(e) { l && (o.push(f.position.x), o.push(f.position.y), o.push(f.position.z), s.push(l[3 * e]), s.push(l[3 * e + 1]), s.push(l[3 * e + 2]), u && u.length && (a.push(u[2 * e]), a.push(u[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])), ++d) }) } var p = this._reconstructedMesh.getTotalIndices(), _ = this._reconstructedMesh.getTotalVertices(), g = this._reconstructedMesh.subMeshes; this._reconstructedMesh.subMeshes = []; var m = 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), m.push(i.vertices[e].id + n + _) }); this._reconstructedMesh.setIndices(m), this._reconstructedMesh.setVerticesData(Oi.b.PositionKind, o), this._reconstructedMesh.setVerticesData(Oi.b.NormalKind, s), a.length > 0 && this._reconstructedMesh.setVerticesData(Oi.b.UVKind, a), c.length > 0 && this._reconstructedMesh.setVerticesData(Oi.b.ColorKind, c); var y = this._mesh.subMeshes[e]; e > 0 && (this._reconstructedMesh.subMeshes = [], g.forEach(function(e) { Os.b.AddToMesh(e.materialIndex, e.verticesStart, e.verticesCount, e.indexStart, e.indexCount, e.getMesh()) }), Os.b.AddToMesh(y.materialIndex, _, d, p, 3 * r.length, this._reconstructedMesh)) }, e.prototype.initDecimatedMesh = function() { this._reconstructedMesh = new fe.a(this._mesh.name + "Decimated", this._mesh.getScene()), this._reconstructedMesh.material = this._mesh.material, this._reconstructedMesh.parent = this._mesh.parent, this._reconstructedMesh.isVisible = !1, this._reconstructedMesh.renderingGroupId = this._mesh.renderingGroupId }, e.prototype.isFlipped = function(e, t, i, n, r) { for (var s = 0; s < e.triangleCount; ++s) { var a = this.triangles[this.references[e.triangleStart + s].triangleId]; if (!a.deleted) { var c = this.references[e.triangleStart + s].vertexId, l = a.vertices[(c + 1) % 3], u = a.vertices[(c + 2) % 3]; if (l !== t && u !== t) { var h = l.position.subtract(i); h = h.normalize(); var d = u.position.subtract(i); if (d = d.normalize(), Math.abs(o.x.Dot(h, d)) > .999) return !0; var f = o.x.Cross(h, d).normalize(); if (n[s] = !1, o.x.Dot(f, a.normal) < .2) return !0 } else n[s] = !0, r.push(a) } } return !1 }, e.prototype.updateTriangles = function(e, t, i, n) { for (var r = n, o = 0; o < t.triangleCount; ++o) { var s = this.references[t.triangleStart + o], a = this.triangles[s.triangleId]; a.deleted || (i[o] && a.deletePending ? (a.deleted = !0, r++) : (a.vertices[s.vertexId] = e, a.isDirty = !0, a.error[0] = this.calculateError(a.vertices[0], a.vertices[1]) + a.borderFactor / 2, a.error[1] = this.calculateError(a.vertices[1], a.vertices[2]) + a.borderFactor / 2, a.error[2] = this.calculateError(a.vertices[2], a.vertices[0]) + a.borderFactor / 2, a.error[3] = Math.min(a.error[0], a.error[1], a.error[2]), this.references.push(s))) } 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], s = 0; s < 3; s++) { for (var a = 0, c = o.vertices[s]; a < i.length && n[a] !== c.id;) ++a; a === i.length ? (i.push(1), n.push(c.id)) : i[a]++ } for (t = 0; t < i.length; ++t) 1 === i[t] ? this.vertices[n[t]].isBorder = !0 : this.vertices[n[t]].isBorder = !1 } }, e.prototype.updateMesh = function(e) { var t, i, n, r; if (void 0 === e && (e = !1), !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; for (t = 0; t < this.triangles.length; ++t) for (i = this.triangles[t], n = 0; n < 3; ++n)(r = i.vertices[n]).triangleCount++; var s = 0; for (t = 0; t < this.vertices.length; ++t) this.vertices[t].triangleStart = s, s += this.vertices[t].triangleCount, this.vertices[t].triangleCount = 0; var a = new Array(3 * this.triangles.length); for (t = 0; t < this.triangles.length; ++t) for (i = this.triangles[t], n = 0; n < 3; ++n) a[(r = i.vertices[n]).triangleStart + r.triangleCount] = new ra(n, t), r.triangleCount++; this.references = a, 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, s = 0, a = n.det(0, 1, 2, 1, 4, 5, 2, 5, 7); if (0 === a || r) { var c = e.position.add(t.position).divide(new o.x(2, 2, 2)), l = this.vertexError(n, e.position), u = this.vertexError(n, t.position), h = this.vertexError(n, c); (s = Math.min(l, u, h)) === l ? i && i.copyFrom(e.position) : s === u ? i && i.copyFrom(t.position) : i && i.copyFrom(c) } else i || (i = o.x.Zero()), i.x = -1 / a * n.det(1, 2, 3, 4, 5, 6, 5, 7, 8), i.y = 1 / a * n.det(0, 2, 3, 1, 5, 6, 2, 7, 8), i.z = -1 / a * n.det(0, 1, 3, 1, 4, 6, 2, 5, 8), s = this.vertexError(n, i); return s }, e }(); Object.defineProperty(W.a.prototype, "simplificationQueue", { get: function() { if (!this._simplificationQueue) { this._simplificationQueue = new ea; var e = this._getComponent(Ae.a.NAME_SIMPLIFICATIONQUEUE); e || (e = new sa(this), this._addComponent(e)) } return this._simplificationQueue }, set: function(e) { this._simplificationQueue = e }, enumerable: !0, configurable: !0 }), fe.a.prototype.simplify = function(e, t, i, n) { return void 0 === t && (t = !0), void 0 === i && (i = qs.QUADRATIC), this.getScene().simplificationQueue.addTask({ settings: e, parallelProcessing: t, mesh: this, simplificationType: i, successCallback: n }), this }; var sa = function() { function e(e) { this.name = Ae.a.NAME_SIMPLIFICATIONQUEUE, this.scene = e } return e.prototype.register = function() { this.scene._beforeCameraUpdateStage.registerStep(Ae.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 }(), aa = i(110), ca = i(78), la = i(73); ge.b.OfflineProviderFactory = function(e, t, i) { return void 0 === i && (i = !1), new ha(e, t, i) }; var ua, ha = function() { function e(t, i, n) { var r = this; void 0 === n && (n = !1), this._idbFactory = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB, this._callbackManifestChecked = i, this._currentSceneUrl = e._ReturnFullUrlLocation(t), this._db = null, this._enableSceneOffline = !1, this._enableTexturesOffline = !1, this._manifestVersionFound = 0, this._mustUpdateRessources = !1, this._hasReachedQuota = !1, e.IDBStorageEnabled ? n ? (this._enableSceneOffline = !0, this._enableTexturesOffline = !0, this._manifestVersionFound = 1, ye.h.SetImmediate(function() { r._callbackManifestChecked(!0) })) : this._checkManifestFile() : this._callbackManifestChecked(!0) } return Object.defineProperty(e.prototype, "enableSceneOffline", { get: function() { return this._enableSceneOffline }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "enableTexturesOffline", { get: function() { return this._enableTexturesOffline }, enumerable: !0, configurable: !0 }), e.prototype._checkManifestFile = function() { var t = this, i = function() { t._enableSceneOffline = !1, t._enableTexturesOffline = !1, t._callbackManifestChecked(!1) }, n = !1, r = this._currentSceneUrl + ".manifest", o = new gs.a; navigator.onLine && (n = !0, r = r + (null == r.match(/\?/) ? "?" : "&") + Date.now()), o.open("GET", r), 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(!0) } catch (e) { i() } else i() }, !1), o.addEventListener("error", function() { if (n) { n = !1; var e = t._currentSceneUrl + ".manifest"; o.open("GET", e), o.send() } else i() }, !1); try { o.send() } catch (e) { p.a.Error("Error on XHR send request."), this._callbackManifestChecked(!1) } }, e.prototype.open = function(e, t) { var i = this, n = function() { i._isSupported = !1, t && t() }; if (this._idbFactory && (this._enableSceneOffline || this._enableTexturesOffline)) if (this._db) e && e(); else { this._hasReachedQuota = !1, this._isSupported = !0; var r = this._idbFactory.open("babylonjs", 1); r.onerror = function() { n() }, r.onblocked = function() { p.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) { p.a.Error("Error while creating object stores. Exception: " + e.message), n() } } } else this._isSupported = !1, 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) }; 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() { p.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() { p.a.Error("Error loading texture " + e + " from DB."), t.src = e } } else p.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) } } e && (i.src = e) }; if (e.IsUASupportingBlobStorage) { var o, s = new gs.a; s.open("GET", t), s.responseType = "blob", s.addEventListener("load", function() { if (200 === s.status && n._db) { o = s.response; var a = n._db.transaction(["textures"], "readwrite"); a.onabort = function(e) { try { var t = (e.srcElement || e.target).error; t && "QuotaExceededError" === t.name && (n._hasReachedQuota = !0) } catch (e) {} r() }, a.oncomplete = function() { r() }; var c = { textureUrl: t, data: o }; try { var l = a.objectStore("textures").put(c); l.onsuccess = function() {}, l.onerror = function() { r() } } catch (r) { 25 === r.code && (e.IsUASupportingBlobStorage = !1, n._enableTexturesOffline = !1), i.src = t } } else i.src = t }, !1), s.addEventListener("error", function() { p.a.Error("Error in XHR request in BABYLON.Database."), i.src = t }, !1), s.send() } else i.src = t } else p.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 = !0, i()) : t(n.data) : (r._mustUpdateRessources = !0, i()) }, o.onabort = function() { t(-1) }; var s = o.objectStore("versions").get(e); s.onsuccess = function(e) { n = e.target.result }, s.onerror = function() { p.a.Error("Error loading version for scene " + e + " from DB."), t(-1) } } catch (e) { p.a.Error("Error while accessing 'versions' object store (READ OP). Exception: " + e.message), t(-1) } else p.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 = !0) } 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() { p.a.Error("Error in DB add version request in BABYLON.Database.") } } catch (e) { p.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 s = this, a = e._ReturnFullUrlLocation(t), c = function() { s._saveFileAsync(a, i, n, o, r) }; this._checkVersionFromDB(a, function(e) { -1 !== e ? s._mustUpdateRessources ? s._saveFileAsync(a, i, n, o, r) : s._loadFileAsync(a, 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 s = o.objectStore(n).get(e); s.onsuccess = function(e) { r = e.target.result }, s.onerror = function() { p.a.Error("Error loading file " + e + " from DB."), i() } } else p.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 s = this; if (this._isSupported) { var a; a = -1 !== t.indexOf(".babylon") ? "scenes" : "textures"; var c, l = new gs.a; l.open("GET", t + "?" + Date.now()), r && (l.responseType = "arraybuffer"), n && (l.onprogress = n), l.addEventListener("load", function() { if (200 === l.status || l.status < 400 && e._ValidateXHRData(l, r ? 6 : 1)) if (c = r ? l.response : l.responseText, !s._hasReachedQuota && s._db) { var n, u = s._db.transaction([a], "readwrite"); u.onabort = function(e) { try { var t = e.srcElement.error; t && "QuotaExceededError" === t.name && (s._hasReachedQuota = !0) } catch (e) {} i(c) }, u.oncomplete = function() { i(c) }, n = "scenes" === a ? { sceneUrl: t, data: c, version: s._manifestVersionFound } : { textureUrl: t, data: c }; try { var h = u.objectStore(a).put(n); h.onsuccess = function() {}, h.onerror = function() { p.a.Error("Error in DB add file request in BABYLON.Database.") } } catch (e) { i(c) } } else i(c); else l.status >= 400 && o ? o(l) : i() }, !1), l.addEventListener("error", function() { p.a.Error("error on XHR request."), i() }, !1), l.send() } else p.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 !0; if (1 === t) return !1 } if (2 & t) { var i = us.GetTGAHeader(e.response); if (i.width && i.height && i.width > 0 && i.height > 0) return !0; if (2 === t) return !1 } if (4 & t) { var n = new Uint8Array(e.response, 0, 3); return 68 === n[0] && 68 === n[1] && 83 === n[2] } } catch (e) {} return !1 }, e.IsUASupportingBlobStorage = !0, e.IDBStorageEnabled = !1, 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 }(), da = function() { function e() { this.direction1 = new o.x(0, 1, 0), this.direction2 = new o.x(0, 1, 0), this.minEmitBox = new o.x(-.5, -.5, -.5), this.maxEmitBox = new o.x(.5, .5, .5) } return e.prototype.startDirectionFunction = function(e, t, i) { var n = D.a.RandomRange(this.direction1.x, this.direction2.x), r = D.a.RandomRange(this.direction1.y, this.direction2.y), s = D.a.RandomRange(this.direction1.z, this.direction2.z); o.x.TransformNormalFromFloatsToRef(n, r, s, e, t) }, e.prototype.startPositionFunction = function(e, t, i) { var n = D.a.RandomRange(this.minEmitBox.x, this.maxEmitBox.x), r = D.a.RandomRange(this.minEmitBox.y, this.maxEmitBox.y), s = D.a.RandomRange(this.minEmitBox.z, this.maxEmitBox.z); o.x.TransformCoordinatesFromFloatsToRef(n, r, s, e, t) }, e.prototype.clone = function() { var t = new e; return S.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 }, e.prototype.parse = function(e) { o.x.FromArrayToRef(e.direction1, 0, this.direction1), o.x.FromArrayToRef(e.direction2, 0, this.direction2), o.x.FromArrayToRef(e.minEmitBox, 0, this.minEmitBox), o.x.FromArrayToRef(e.maxEmitBox, 0, this.maxEmitBox) }, e }(), fa = 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 = !1, 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "angle", { get: function() { return this._angle }, set: function(e) { this._angle = e, this._buildHeight() }, enumerable: !0, configurable: !0 }), 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))) o.x.TransformNormalFromFloatsToRef(0, 1, 0, e, t); else { var n = i.position.subtract(e.getTranslation()).normalize(), r = D.a.RandomRange(0, this.directionRandomizer), s = D.a.RandomRange(0, this.directionRandomizer), a = D.a.RandomRange(0, this.directionRandomizer); n.x += r, n.y += s, n.z += a, n.normalize(), o.x.TransformNormalFromFloatsToRef(n.x, n.y, n.z, e, t) } }, e.prototype.startPositionFunction = function(e, t, i) { var n, r = D.a.RandomRange(0, 2 * Math.PI); n = this.emitFromSpawnPointOnly ? 1e-4 : 1 - (n = D.a.RandomRange(0, this.heightRange)) * n; var s = this._radius - D.a.RandomRange(0, this._radius * this.radiusRange), a = (s *= n) * Math.sin(r), c = s * Math.cos(r), l = n * this._height; o.x.TransformCoordinatesFromFloatsToRef(a, l, c, e, t) }, e.prototype.clone = function() { var t = new e(this._radius, this._angle, this.directionRandomizer); return S.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 }, 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 }(), pa = 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 = D.a.RandomRange(-this.directionRandomizer / 2, this.directionRandomizer / 2), s = Math.atan2(n.x, n.z); s += D.a.RandomRange(-Math.PI / 2, Math.PI / 2) * this.directionRandomizer, n.y = r, n.x = Math.sin(s), n.z = Math.cos(s), n.normalize(), o.x.TransformNormalFromFloatsToRef(n.x, n.y, n.z, e, t) }, e.prototype.startPositionFunction = function(e, t, i) { var n = D.a.RandomRange(-this.height / 2, this.height / 2), r = D.a.RandomRange(0, 2 * Math.PI), s = D.a.RandomRange((1 - this.radiusRange) * (1 - this.radiusRange), 1), a = Math.sqrt(s) * this.radius, c = a * Math.cos(r), l = a * Math.sin(r); o.x.TransformCoordinatesFromFloatsToRef(c, n, l, e, t) }, e.prototype.clone = function() { var t = new e(this.radius, this.directionRandomizer); return S.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 }, e.prototype.parse = function(e) { this.radius = e.radius, this.height = e.height, this.radiusRange = e.radiusRange, this.directionRandomizer = e.directionRandomizer }, e }(), _a = function(e) { function t(t, i, n, r, s) { void 0 === t && (t = 1), void 0 === i && (i = 1), void 0 === n && (n = 1), void 0 === r && (r = new o.x(0, 1, 0)), void 0 === s && (s = new o.x(0, 1, 0)); var a = e.call(this, t, i, n) || this; return a.direction1 = r, a.direction2 = s, a } return l.d(t, e), t.prototype.startDirectionFunction = function(e, t, i) { var n = D.a.RandomRange(this.direction1.x, this.direction2.x), r = D.a.RandomRange(this.direction1.y, this.direction2.y), s = D.a.RandomRange(this.direction1.z, this.direction2.z); o.x.TransformNormalFromFloatsToRef(n, r, s, e, t) }, t.prototype.clone = function() { var e = new t(this.radius, this.height, this.radiusRange, this.direction1, this.direction2); return S.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(), t }, t.prototype.parse = function(t) { e.prototype.parse.call(this, t), this.direction1.copyFrom(t.direction1), this.direction2.copyFrom(t.direction2) }, t }(pa), ga = 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 = D.a.RandomRange(0, this.directionRandomizer), s = D.a.RandomRange(0, this.directionRandomizer), a = D.a.RandomRange(0, this.directionRandomizer); n.x += r, n.y += s, n.z += a, n.normalize(), o.x.TransformNormalFromFloatsToRef(n.x, n.y, n.z, e, t) }, e.prototype.startPositionFunction = function(e, t, i) { var n = this.radius - D.a.RandomRange(0, this.radius * this.radiusRange), r = D.a.RandomRange(0, 1), s = D.a.RandomRange(0, 2 * Math.PI), a = Math.acos(2 * r - 1), c = n * Math.cos(s) * Math.sin(a), l = n * Math.cos(a), u = n * Math.sin(s) * Math.sin(a); o.x.TransformCoordinatesFromFloatsToRef(c, Math.abs(l), u, e, t) }, e.prototype.clone = function() { var t = new e(this.radius, this.directionRandomizer); return S.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 }, e.prototype.parse = function(e) { this.radius = e.radius, this.radiusRange = e.radiusRange, this.directionRandomizer = e.directionRandomizer }, e }(), ma = function() { function e() { this.direction1 = new o.x(0, 1, 0), this.direction2 = new o.x(0, 1, 0) } return e.prototype.startDirectionFunction = function(e, t, i) { var n = D.a.RandomRange(this.direction1.x, this.direction2.x), r = D.a.RandomRange(this.direction1.y, this.direction2.y), s = D.a.RandomRange(this.direction1.z, this.direction2.z); o.x.TransformNormalFromFloatsToRef(n, r, s, e, t) }, e.prototype.startPositionFunction = function(e, t, i) { o.x.TransformCoordinatesFromFloatsToRef(0, 0, 0, e, t) }, e.prototype.clone = function() { var t = new e; return S.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) { o.x.FromArrayToRef(e.direction1, 0, this.direction1), o.x.FromArrayToRef(e.direction2, 0, this.direction2) }, e }(), va = 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 = D.a.RandomRange(0, this.directionRandomizer), s = D.a.RandomRange(0, this.directionRandomizer), a = D.a.RandomRange(0, this.directionRandomizer); n.x += r, n.y += s, n.z += a, n.normalize(), o.x.TransformNormalFromFloatsToRef(n.x, n.y, n.z, e, t) }, e.prototype.startPositionFunction = function(e, t, i) { var n = this.radius - D.a.RandomRange(0, this.radius * this.radiusRange), r = D.a.RandomRange(0, 1), s = D.a.RandomRange(0, 2 * Math.PI), a = Math.acos(2 * r - 1), c = n * Math.cos(s) * Math.sin(a), l = n * Math.cos(a), u = n * Math.sin(s) * Math.sin(a); o.x.TransformCoordinatesFromFloatsToRef(c, l, u, e, t) }, e.prototype.clone = function() { var t = new e(this.radius, this.directionRandomizer); return S.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 }, e.prototype.parse = function(e) { this.radius = e.radius, this.radiusRange = e.radiusRange, this.directionRandomizer = e.directionRandomizer }, e }(), ya = function(e) { function t(t, i, n) { void 0 === t && (t = 1), void 0 === i && (i = new o.x(0, 1, 0)), void 0 === n && (n = new o.x(0, 1, 0)); var r = e.call(this, t) || this; return r.direction1 = i, r.direction2 = n, r } return l.d(t, e), t.prototype.startDirectionFunction = function(e, t, i) { var n = D.a.RandomRange(this.direction1.x, this.direction2.x), r = D.a.RandomRange(this.direction1.y, this.direction2.y), s = D.a.RandomRange(this.direction1.z, this.direction2.z); o.x.TransformNormalFromFloatsToRef(n, r, s, e, t) }, t.prototype.clone = function() { var e = new t(this.radius, this.direction1, this.direction2); return S.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(), t }, t.prototype.parse = function(t) { e.prototype.parse.call(this, t), this.direction1.copyFrom(t.direction1), this.direction2.copyFrom(t.direction2) }, t }(va), ba = 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 = !1, 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 = !1, this.noiseStrength = new o.x(10, 10, 10), this.onAnimationEnd = null, this.blendMode = e.BLENDMODE_ONEONE, this.forceDepthWrite = !1, this.preWarmCycles = 0, this.preWarmStepOffset = 1, this.spriteCellChangeSpeed = 1, this.startSpriteCellID = 0, this.endSpriteCellID = 0, this.spriteCellWidth = 0, this.spriteCellHeight = 0, this.spriteRandomStartCell = !1, this.translationPivot = new o.w(0, 0), this.beginAnimationOnStart = !1, this.beginAnimationFrom = 0, this.beginAnimationTo = 60, this.beginAnimationLoop = !1, this.worldOffset = new o.x(0, 0, 0), this.gravity = o.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 o.f(1, 1, 1, 1), this.color2 = new o.f(1, 1, 1, 1), this.colorDead = new o.f(0, 0, 0, 1), this.textureMask = new o.f(1, 1, 1, 1), this._isSubEmitter = !1, this.billboardMode = _.a.PARTICLES_BILLBOARDMODE_ALL, this._isBillboardBased = !0, this._imageProcessingConfigurationDefines = new xi.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "isAnimationSheetEnabled", { get: function() { return this._isAnimationSheetEnabled }, set: function(e) { this._isAnimationSheetEnabled != e && (this._isAnimationSheetEnabled = e, this._reset()) }, enumerable: !0, configurable: !0 }), 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 : o.x.Zero() }, set: function(e) { this.particleEmitterType.direction1 && (this.particleEmitterType.direction1 = e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "direction2", { get: function() { return this.particleEmitterType.direction2 ? this.particleEmitterType.direction2 : o.x.Zero() }, set: function(e) { this.particleEmitterType.direction2 && (this.particleEmitterType.direction2 = e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "minEmitBox", { get: function() { return this.particleEmitterType.minEmitBox ? this.particleEmitterType.minEmitBox : o.x.Zero() }, set: function(e) { this.particleEmitterType.minEmitBox && (this.particleEmitterType.minEmitBox = e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "maxEmitBox", { get: function() { return this.particleEmitterType.maxEmitBox ? this.particleEmitterType.maxEmitBox : o.x.Zero() }, set: function(e) { this.particleEmitterType.maxEmitBox && (this.particleEmitterType.maxEmitBox = e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "isBillboardBased", { get: function() { return this._isBillboardBased }, set: function(e) { this._isBillboardBased !== e && (this._isBillboardBased = e, this._reset()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "imageProcessingConfiguration", { get: function() { return this._imageProcessingConfiguration }, set: function(e) { this._attachImageProcessingConfiguration(e) }, enumerable: !0, configurable: !0 }), 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++ } return i && i.dispose(), this }, e.prototype.createPointEmitter = function(e, t) { var i = new ma; 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 ga(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 va(e, t); return this.particleEmitterType = i, i }, e.prototype.createDirectedSphereEmitter = function(e, t, i) { void 0 === e && (e = 1), void 0 === t && (t = new o.x(0, 1, 0)), void 0 === i && (i = new o.x(0, 1, 0)); var n = new ya(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 pa(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 o.x(0, 1, 0)), void 0 === r && (r = new o.x(0, 1, 0)); var s = new _a(e, t, i, n, r); return this.particleEmitterType = s, s }, e.prototype.createConeEmitter = function(e, t) { void 0 === e && (e = 1), void 0 === t && (t = Math.PI / 4); var i = new fa(e, t); return this.particleEmitterType = i, i }, e.prototype.createBoxEmitter = function(e, t, i, n) { var r = new da; 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 }(), Ta = function() { function e(t) { this.particleSystem = t, this.position = o.x.Zero(), this.direction = o.x.Zero(), this.color = new o.f(0, 0, 0, 0), this.colorStep = new o.f(0, 0, 0, 0), this.lifeTime = 1, this.age = 0, this.size = 0, this.scale = new o.w(1, 1), this.angle = 0, this.angularSpeed = 0, this.cellIndex = 0, this._attachedSubEmitters = null, this._currentColor1 = new o.f(0, 0, 0, 0), this._currentColor2 = new o.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 = D.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, o.t.Vector3[0]), t.lookAt(o.t.Vector3[0], 0, Math.PI / 2)) } else { e.particleSystem.emitter.copyFrom(this.position) } this.direction.scaleToRef(e.inheritedVelocityAmount / 2, o.t.Vector3[0]), e.particleSystem._inheritedVelocityOffset.copyFrom(o.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, 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.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 }(); ! function(e) { e[e.ATTACHED = 0] = "ATTACHED", e[e.END = 1] = "END" }(ua || (ua = {})); var Ea = function() { function e(e) { this.particleSystem = e, this.type = ua.END, this.inheritDirection = !1, this.inheritedVelocityAmount = 0, e.emitter && e.emitter.dispose || (e.emitter = new Fe.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 o.x ? t = t.clone() : t instanceof Fe.a && ((t = new fe.a("", t.getScene())).isVisible = !1) : t = new o.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 = !0, i.particleSystem.disposeOnStop = !0, 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 be.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 = !0, o }, e.prototype.dispose = function() { this.particleSystem.dispose() }, e }(), Aa = "\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}"; zt.a.ShadersStore.particlesPixelShader = Aa; var xa = "\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}"; zt.a.ShadersStore.particlesVertexShader = xa; var Ra = function(e) { function t(t, i, n, s, a, c) { void 0 === s && (s = null), void 0 === a && (a = !1), void 0 === c && (c = .01); var l = e.call(this, t) || this; return l._inheritedVelocityOffset = new o.x, l.onDisposeObservable = new r.c, l._particles = new Array, l._stockParticles = new Array, l._newPartsExcess = 0, l._vertexBuffers = {}, l._scaledColorStep = new o.f(0, 0, 0, 0), l._colorDiff = new o.f(0, 0, 0, 0), l._scaledDirection = o.x.Zero(), l._scaledGravity = o.x.Zero(), l._currentRenderId = -1, l._useInstancing = !1, l._started = !1, l._stopped = !1, l._actualFrame = 0, l._currentEmitRate1 = 0, l._currentEmitRate2 = 0, l._currentStartSize1 = 0, l._currentStartSize2 = 0, l._rawTextureWidth = 256, l._useRampGradients = !1, l._disposeEmitterOnDispose = !1, l.recycleParticle = function(e) { var t = l._particles.pop(); t !== e && t.copyTo(e), l._stockParticles.push(t) }, l._createParticle = function() { var e; if (0 !== l._stockParticles.length ? (e = l._stockParticles.pop())._reset() : e = new Ta(l), l._subEmitters && l._subEmitters.length > 0) { var t = l._subEmitters[Math.floor(Math.random() * l._subEmitters.length)]; e._attachedSubEmitters = [], t.forEach(function(t) { if (t.type === ua.ATTACHED) { var i = t.clone(); e._attachedSubEmitters.push(i), i.particleSystem.start() } }) } return e }, l._emitFromParticle = function(e) { if (l._subEmitters && 0 !== l._subEmitters.length) { var t = Math.floor(Math.random() * l._subEmitters.length); l._subEmitters[t].forEach(function(t) { if (t.type === ua.END) { var i = t.clone(); e._inheritParticleInfoToSubEmitter(i), i.particleSystem._rootParticleSystem = l, l.activeSubSystems.push(i.particleSystem), i.particleSystem.start() } }) } }, l._capacity = i, l._epsilon = c, l._isAnimationSheetEnabled = a, l._scene = n || P.a.LastCreatedScene, l._attachImageProcessingConfiguration(null), l._customEffect = s, l._scene.particleSystems.push(l), l._useInstancing = l._scene.getEngine().getCaps().instancedArrays, l._createIndexBuffer(), l._createVertexBuffers(), l.particleEmitterType = new da, l.updateFunction = function(e) { var t = null, i = null; l.noiseTexture && (t = l.noiseTexture.getSize(), i = l.noiseTexture.getContent()); for (var n, r = function() { n = e[s]; var r = l._scaledUpdateSpeed, a = n.age; if (n.age += r, n.age > n.lifeTime) { var c = n.age - a; r = (n.lifeTime - a) * r / c, n.age = n.lifeTime } var u = n.age / n.lifeTime; l._colorGradients && l._colorGradients.length > 0 ? ye.h.GetCurrentGradient(u, l._colorGradients, function(e, t, i) { e !== n._currentColorGradient && (n._currentColor1.copyFrom(n._currentColor2), t.getColorToRef(n._currentColor2), n._currentColorGradient = e), o.f.LerpToRef(n._currentColor1, n._currentColor2, i, n.color) }) : (n.colorStep.scaleToRef(r, l._scaledColorStep), n.color.addInPlace(l._scaledColorStep), n.color.a < 0 && (n.color.a = 0)), l._angularSpeedGradients && l._angularSpeedGradients.length > 0 && ye.h.GetCurrentGradient(u, l._angularSpeedGradients, function(e, t, i) { e !== n._currentAngularSpeedGradient && (n._currentAngularSpeed1 = n._currentAngularSpeed2, n._currentAngularSpeed2 = t.getFactor(), n._currentAngularSpeedGradient = e), n.angularSpeed = D.a.Lerp(n._currentAngularSpeed1, n._currentAngularSpeed2, i) }), n.angle += n.angularSpeed * r; var h = r; if (l._velocityGradients && l._velocityGradients.length > 0 && ye.h.GetCurrentGradient(u, l._velocityGradients, function(e, t, i) { e !== n._currentVelocityGradient && (n._currentVelocity1 = n._currentVelocity2, n._currentVelocity2 = t.getFactor(), n._currentVelocityGradient = e), h *= D.a.Lerp(n._currentVelocity1, n._currentVelocity2, i) }), n.direction.scaleToRef(h, l._scaledDirection), l._limitVelocityGradients && l._limitVelocityGradients.length > 0 && ye.h.GetCurrentGradient(u, l._limitVelocityGradients, function(e, t, i) { e !== n._currentLimitVelocityGradient && (n._currentLimitVelocity1 = n._currentLimitVelocity2, n._currentLimitVelocity2 = t.getFactor(), n._currentLimitVelocityGradient = e); var r = D.a.Lerp(n._currentLimitVelocity1, n._currentLimitVelocity2, i); n.direction.length() > r && n.direction.scaleInPlace(l.limitVelocityDamping) }), l._dragGradients && l._dragGradients.length > 0 && ye.h.GetCurrentGradient(u, l._dragGradients, function(e, t, i) { e !== n._currentDragGradient && (n._currentDrag1 = n._currentDrag2, n._currentDrag2 = t.getFactor(), n._currentDragGradient = e); var r = D.a.Lerp(n._currentDrag1, n._currentDrag2, i); l._scaledDirection.scaleInPlace(1 - r) }), n.position.addInPlace(l._scaledDirection), i && t && n._randomNoiseCoordinates1) { var d = l._fetchR(n._randomNoiseCoordinates1.x, n._randomNoiseCoordinates1.y, t.width, t.height, i), f = l._fetchR(n._randomNoiseCoordinates1.z, n._randomNoiseCoordinates2.x, t.width, t.height, i), p = l._fetchR(n._randomNoiseCoordinates2.y, n._randomNoiseCoordinates2.z, t.width, t.height, i), _ = o.t.Vector3[0], g = o.t.Vector3[1]; _.copyFromFloats((2 * d - 1) * l.noiseStrength.x, (2 * f - 1) * l.noiseStrength.y, (2 * p - 1) * l.noiseStrength.z), _.scaleToRef(r, g), n.direction.addInPlace(g) } if (l.gravity.scaleToRef(r, l._scaledGravity), n.direction.addInPlace(l._scaledGravity), l._sizeGradients && l._sizeGradients.length > 0 && ye.h.GetCurrentGradient(u, l._sizeGradients, function(e, t, i) { e !== n._currentSizeGradient && (n._currentSize1 = n._currentSize2, n._currentSize2 = t.getFactor(), n._currentSizeGradient = e), n.size = D.a.Lerp(n._currentSize1, n._currentSize2, i) }), l._useRampGradients && (l._colorRemapGradients && l._colorRemapGradients.length > 0 && ye.h.GetCurrentGradient(u, l._colorRemapGradients, function(e, t, i) { var r = D.a.Lerp(e.factor1, t.factor1, i), o = D.a.Lerp(e.factor2, t.factor2, i); n.remapData.x = r, n.remapData.y = o - r }), l._alphaRemapGradients && l._alphaRemapGradients.length > 0 && ye.h.GetCurrentGradient(u, l._alphaRemapGradients, function(e, t, i) { var r = D.a.Lerp(e.factor1, t.factor1, i), o = D.a.Lerp(e.factor2, t.factor2, i); n.remapData.z = r, n.remapData.w = o - r })), l._isAnimationSheetEnabled && n.updateCellIndex(), n._inheritParticleInfoToSubEmitters(), n.age >= n.lifeTime) return l._emitFromParticle(n), n._attachedSubEmitters && (n._attachedSubEmitters.forEach(function(e) { e.particleSystem.disposeOnStop = !0, e.particleSystem.stop() }), n._attachedSubEmitters = null), l.recycleParticle(n), s--, "continue" }, s = 0; s < e.length; s++) r() }, l } return l.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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "useRampGradients", { get: function() { return this._useRampGradients }, set: function(e) { this._useRampGradients !== e && (this._useRampGradients = e, this._resetEffect()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "particles", { get: function() { return this._particles }, enumerable: !0, configurable: !0 }), t.prototype.getClassName = function() { return "ParticleSystem" }, t.prototype._addFactorGradient = function(e, t, i, n) { var r = new ye.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 = o.t.Color3[0], i = 0; i < this._rawTextureWidth; i++) { var n = i / this._rawTextureWidth; ye.h.GetCurrentGradient(n, this._rampGradients, function(n, r, s) { o.e.LerpToRef(n.color, r.color, s, 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 = je.CreateRGBATexture(e, this._rawTextureWidth, 1, this._scene, !1, !1, ke.a.NEAREST_SAMPLINGMODE) } }, t.prototype.getRampGradients = function() { return this._rampGradients }, t.prototype.addRampGradient = function(e, t) { this._rampGradients || (this._rampGradients = []); var i = new ye.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 ye.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 Oi.a(e, this._vertexData, !0, this._vertexBufferSize); var i = 0, n = this._vertexBuffer.createVertexBuffer(Oi.b.PositionKind, i, 3, this._vertexBufferSize, this._useInstancing); this._vertexBuffers[Oi.b.PositionKind] = n, i += 3; var r = this._vertexBuffer.createVertexBuffer(Oi.b.ColorKind, i, 4, this._vertexBufferSize, this._useInstancing); this._vertexBuffers[Oi.b.ColorKind] = r, i += 4; var o = this._vertexBuffer.createVertexBuffer("angle", i, 1, this._vertexBufferSize, this._useInstancing); this._vertexBuffers.angle = o, i += 1; var s, a = this._vertexBuffer.createVertexBuffer("size", i, 2, this._vertexBufferSize, this._useInstancing); if (this._vertexBuffers.size = a, 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 l = this._vertexBuffer.createVertexBuffer("direction", i, 3, this._vertexBufferSize, this._useInstancing); this._vertexBuffers.direction = l, i += 3 } if (this._useRampGradients) { var u = this._vertexBuffer.createVertexBuffer("remapData", i, 4, this._vertexBufferSize, this._useInstancing); this._vertexBuffers.remapData = u, i += 4 } if (this._useInstancing) { var h = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]); this._spriteBuffer = new Oi.a(e, h, !1, 2), s = this._spriteBuffer.createVertexBuffer("offset", 0, 2) } else s = this._vertexBuffer.createVertexBuffer("offset", i, 2, this._vertexBufferSize, this._useInstancing), i += 2; this._vertexBuffers.offset = s }, 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 Ea(i)]) : i instanceof Ea ? 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 = !0, this._stopped = !1, 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 Fe.a && this.emitter.computeWorldMatrix(!0); var i = this.noiseTexture; if (i && i.onGeneratedObservable) i.onGeneratedObservable.addOnce(function() { setTimeout(function() { for (var e = 0; e < t.preWarmCycles; e++) t.animate(!0), i.render() }) }); else for (var n = 0; n < this.preWarmCycles; n++) this.animate(!0) } 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 = !0), this._stopped = !0, 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(!0) }), 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 = o.j.Translation(r.x, r.y, r.z) } this.updateFunction(this._particles); for (var s, a = function() { if (c._particles.length === c._capacity) return "break"; t = c._createParticle(), c._particles.push(t); var e = D.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 = D.a.Clamp(c._actualFrame / c.targetStopDuration); ye.h.GetCurrentGradient(n, c._lifeTimeGradients, function(e, i) { var r = e, o = i, s = r.getFactor(), a = o.getFactor(), c = (n - r.gradient) / (o.gradient - r.gradient); t.lifeTime = D.a.Lerp(s, a, c) }) } else t.lifeTime = D.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 = D.a.RandomRange(c.minSize, c.maxSize), t.scale.copyFromFloats(D.a.RandomRange(c.minScaleX, c.maxScaleX), D.a.RandomRange(c.minScaleY, c.maxScaleY)), c._startSizeGradients && c._startSizeGradients[0] && c.targetStopDuration) { var r = c._actualFrame / c.targetStopDuration; ye.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 = D.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 = D.a.RandomRange(c.minAngularSpeed, c.maxAngularSpeed), t.angle = D.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)) : (s = D.a.RandomRange(0, 1), o.f.LerpToRef(c.color1, c.color2, s, 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 o.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 o.x(Math.random(), Math.random(), Math.random()), t._randomNoiseCoordinates2 = new o.x(Math.random(), Math.random(), Math.random()))), t._inheritParticleInfoToSubEmitters() }, c = this, l = 0; l < e; l++) { if ("break" === a()) break } }, t._GetAttributeNamesOrOptions = function(e, t, i) { void 0 === e && (e = !1), void 0 === t && (t = !1), void 0 === i && (i = !1); var n = [Oi.b.PositionKind, Oi.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 = !1); 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), s = ["diffuseSampler", "rampSampler"]; xi.a && (xi.a.PrepareUniforms(o, this._imageProcessingConfigurationDefines), xi.a.PrepareSamplers(s, this._imageProcessingConfigurationDefines)), this._effect = this._scene.getEngine().createEffect("particles", r, o, s, n) } return this._effect }, t.prototype.animate = function(e) { var t = this; if (void 0 === e && (e = !1), 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; ye.h.GetCurrentGradient(r, this._emitRateGradients, function(e, i, r) { e !== t._currentEmitRateGradient && (t._currentEmitRate1 = t._currentEmitRate2, t._currentEmitRate2 = i.getFactor(), t._currentEmitRateGradient = e), n = D.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 = !1, 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 = !1, this.onAnimationEnd && this.onAnimationEnd(), this.disposeOnStop && this._scene._toBeDisposed.push(this))), !e) { for (var o = 0, s = 0; s < this._particles.length; s++) { var a = this._particles[s]; this._appendParticleVertices(o, a), 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 !1; if (this.blendMode !== t.BLENDMODE_MULTIPLYADD) { if (!this._getEffect(this.blendMode).isReady()) return !1 } else { if (!this._getEffect(t.BLENDMODE_MULTIPLY).isReady()) return !1; if (!this._getEffect(t.BLENDMODE_ADD).isReady()) return !1 } return !0 }, 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 s = this._scene.activeCamera; i.setVector3("eyePosition", s.globalPosition) } if (this._rampGradientsTexture && i.setTexture("rampSampler", this._rampGradientsTexture), this._scene.clipPlane || this._scene.clipPlane2 || this._scene.clipPlane3 || this._scene.clipPlane4) { var a = r.clone(); a.invert(), i.setMatrix("invView", a), ir.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(so.a.TriangleFanDrawMode, 0, 4, this._particles.length) : n.drawElementsType(so.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(!1), this.forceDepthWrite && e.setDepthWrite(!0); 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 = !0), 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(!0), (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 s = new t(e, this._capacity, this._scene, n); return s.customShader = r, S.a.DeepCopy(this, s, ["particles", "customShader", "noiseTexture"]), void 0 === i && (i = this.emitter), s.noiseTexture = this.noiseTexture, s.emitter = i, this.particleTexture && (s.particleTexture = new ke.a(this.particleTexture.url, this._scene)), this._colorGradients && this._colorGradients.forEach(function(e) { s.addColorGradient(e.gradient, e.color1, e.color2) }), this._dragGradients && this._dragGradients.forEach(function(e) { s.addDragGradient(e.gradient, e.factor1, e.factor2) }), this._angularSpeedGradients && this._angularSpeedGradients.forEach(function(e) { s.addAngularSpeedGradient(e.gradient, e.factor1, e.factor2) }), this._emitRateGradients && this._emitRateGradients.forEach(function(e) { s.addEmitRateGradient(e.gradient, e.factor1, e.factor2) }), this._lifeTimeGradients && this._lifeTimeGradients.forEach(function(e) { s.addLifeTimeGradient(e.gradient, e.factor1, e.factor2) }), this._limitVelocityGradients && this._limitVelocityGradients.forEach(function(e) { s.addLimitVelocityGradient(e.gradient, e.factor1, e.factor2) }), this._sizeGradients && this._sizeGradients.forEach(function(e) { s.addSizeGradient(e.gradient, e.factor1, e.factor2) }), this._startSizeGradients && this._startSizeGradients.forEach(function(e) { s.addStartSizeGradient(e.gradient, e.factor1, e.factor2) }), this._velocityGradients && this._velocityGradients.forEach(function(e) { s.addVelocityGradient(e.gradient, e.factor1, e.factor2) }), this._rampGradients && this._rampGradients.forEach(function(e) { s.addRampGradient(e.gradient, e.color) }), this._colorRemapGradients && this._colorRemapGradients.forEach(function(e) { s.addColorRemapGradient(e.gradient, e.factor1, e.factor2) }), this._alphaRemapGradients && this._alphaRemapGradients.forEach(function(e) { s.addAlphaRemapGradient(e.gradient, e.factor1, e.factor2) }), this.preventAutoStart || s.start(), s }, 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, s = n[i]; o < s.length; o++) { var a = s[o]; r.push(a.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), L.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, s = r; o < s.length; o++) { var a = s[o], c = { gradient: a.gradient, color1: a.color1.asArray() }; a.color2 && (c.color2 = a.color2.asArray()), e.colorGradients.push(c) } } var l = t.getRampGradients(); if (l) { e.rampGradients = []; for (var u = 0, h = l; u < h.length; u++) { var d = h[u]; c = { gradient: d.gradient, color: d.color.asArray() }; e.rampGradients.push(c) } e.useRampGradients = t.useRampGradients } var f = t.getColorRemapGradients(); if (f) { e.colorRemapGradients = []; for (var p = 0, _ = f; p < _.length; p++) { var g = _[p]; c = { gradient: g.gradient, factor1: g.factor1 }; void 0 !== g.factor2 && (c.factor2 = g.factor2), e.colorRemapGradients.push(c) } } var m = t.getAlphaRemapGradients(); if (m) { e.alphaRemapGradients = []; for (var v = 0, y = m; 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 T = t.getSizeGradients(); if (T) { e.sizeGradients = []; for (var E = 0, A = T; E < A.length; E++) { var x = A[E]; c = { gradient: x.gradient, factor1: x.factor1 }; void 0 !== x.factor2 && (c.factor2 = x.factor2), e.sizeGradients.push(c) } } var R = t.getAngularSpeedGradients(); if (R) { e.angularSpeedGradients = []; for (var P = 0, S = R; P < S.length; P++) { var C = S[P]; c = { gradient: C.gradient, factor1: C.factor1 }; void 0 !== C.factor2 && (c.factor2 = C.factor2), e.angularSpeedGradients.push(c) } } var M = t.getVelocityGradients(); if (M) { e.velocityGradients = []; for (var O = 0, I = M; O < I.length; O++) { var D = I[O]; c = { gradient: D.gradient, factor1: D.factor1 }; void 0 !== D.factor2 && (c.factor2 = D.factor2), e.velocityGradients.push(c) } } var w = t.getDragGradients(); if (w) { e.dragyGradients = []; for (var F = 0, N = w; F < N.length; F++) { var B = N[F]; c = { gradient: B.gradient, factor1: B.factor1 }; void 0 !== B.factor2 && (c.factor2 = B.factor2), e.dragGradients.push(c) } } var U = t.getEmitRateGradients(); if (U) { e.emitRateGradients = []; for (var V = 0, G = U; V < G.length; V++) { var k = G[V]; c = { gradient: k.gradient, factor1: k.factor1 }; void 0 !== k.factor2 && (c.factor2 = k.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 ke.a(n + e.textureName, i, !1, 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 = o.x.FromArray(e.emitter) : t.emitter = o.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 a = e.animations[r], c = s.a.GetClass("BABYLON.Animation"); c && t.animations.push(c.Parse(a)) } 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 = o.x.FromArray(e.gravity), e.noiseStrength && (t.noiseStrength = o.x.FromArray(e.noiseStrength)), t.color1 = o.f.FromArray(e.color1), t.color2 = o.f.FromArray(e.color2), t.colorDead = o.f.FromArray(e.colorDead), t.updateSpeed = e.updateSpeed, t.targetStopDuration = e.targetStopDuration, t.blendMode = e.blendMode, e.colorGradients) for (var l = 0, u = e.colorGradients; l < u.length; l++) { var h = u[l]; t.addColorGradient(h.gradient, o.f.FromArray(h.color1), h.color2 ? o.f.FromArray(h.color2) : void 0) } if (e.rampGradients) { for (var d = 0, f = e.rampGradients; d < f.length; d++) { var p = f[d]; t.addRampGradient(p.gradient, o.e.FromArray(p.color)) } t.useRampGradients = e.useRampGradients } if (e.colorRemapGradients) for (var _ = 0, g = e.colorRemapGradients; _ < g.length; _++) { var m = g[_]; t.addColorRemapGradient(m.gradient, void 0 !== m.factor1 ? m.factor1 : m.factor, m.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 T = 0, E = e.sizeGradients; T < E.length; T++) { var A = E[T]; t.addSizeGradient(A.gradient, void 0 !== A.factor1 ? A.factor1 : A.factor, A.factor2) } if (e.sizeGradients) for (var x = 0, R = e.sizeGradients; x < R.length; x++) { A = R[x]; t.addSizeGradient(A.gradient, void 0 !== A.factor1 ? A.factor1 : A.factor, A.factor2) } if (e.angularSpeedGradients) for (var P = 0, S = e.angularSpeedGradients; P < S.length; P++) { var C = S[P]; t.addAngularSpeedGradient(C.gradient, void 0 !== C.factor1 ? C.factor1 : C.factor, C.factor2) } if (e.velocityGradients) for (var M = 0, O = e.velocityGradients; M < O.length; M++) { var I = O[M]; t.addVelocityGradient(I.gradient, void 0 !== I.factor1 ? I.factor1 : I.factor, I.factor2) } if (e.dragGradients) for (var D = 0, L = e.dragGradients; D < L.length; D++) { var w = L[D]; t.addDragGradient(w.gradient, void 0 !== w.factor1 ? w.factor1 : w.factor, w.factor2) } if (e.emitRateGradients) for (var F = 0, N = e.emitRateGradients; F < N.length; F++) { var B = N[F]; t.addEmitRateGradient(B.gradient, void 0 !== B.factor1 ? B.factor1 : B.factor, B.factor2) } if (e.startSizeGradients) for (var U = 0, V = e.startSizeGradients; U < V.length; U++) { var G = V[U]; t.addStartSizeGradient(G.gradient, void 0 !== G.factor1 ? G.factor1 : G.factor, G.factor2) } if (e.lifeTimeGradients) for (var k = 0, z = e.lifeTimeGradients; k < z.length; k++) { var j = z[k]; 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 = _s.Parse(e.noiseTexture, i, n)), e.particleEmitterType) { switch (e.particleEmitterType.type) { case "SphereParticleEmitter": Y = new va; break; case "SphereDirectedParticleEmitter": Y = new ya; break; case "ConeEmitter": case "ConeParticleEmitter": Y = new fa; break; case "CylinderParticleEmitter": Y = new pa; break; case "HemisphericParticleEmitter": Y = new ga; break; case "BoxEmitter": case "BoxParticleEmitter": default: Y = new da } Y.parse(e.particleEmitterType) } else(Y = new da).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 = !1); var s = e.name, a = null, c = null; if (e.customShader) { var l = (c = e.customShader).shaderOptions.defines.length > 0 ? c.shaderOptions.defines.join("\n") : ""; a = i.getEngine().createEffectForParticles(c.shaderPath.fragmentElement, c.shaderOptions.uniforms, c.shaderOptions.samplers, l) } var u = new t(s, e.capacity, i, a, e.isAnimationSheetEnabled); if (u.customShader = c, e.id && (u.id = e.id), e.subEmitters) { u.subEmitters = []; for (var h = 0, d = e.subEmitters; h < d.length; h++) { for (var f = [], p = 0, _ = d[h]; p < _.length; p++) { var g = _[p]; f.push(Ea.Parse(g, i, n)) } u.subEmitters.push(f) } } return t._Parse(e, u, i, n), u.textureMask = o.f.FromArray(e.textureMask), e.preventAutoStart && (u.preventAutoStart = e.preventAutoStart), r || u.preventAutoStart || u.start(), u }, t.BILLBOARDMODE_Y = _.a.PARTICLES_BILLBOARDMODE_Y, t.BILLBOARDMODE_ALL = _.a.PARTICLES_BILLBOARDMODE_ALL, t.BILLBOARDMODE_STRETCHED = _.a.PARTICLES_BILLBOARDMODE_STRETCHED, t }(ba); Ea._ParseParticleSystem = Ra.Parse; zt.a.ShadersStore.gpuUpdateParticlesPixelShader = "#version 300 es\nvoid main() {\ndiscard;\n}\n"; var Pa = "#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}"; zt.a.ShadersStore.gpuUpdateParticlesVertexShader = Pa; var Sa = "#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"; zt.a.IncludesShadersStore.clipPlaneFragmentDeclaration2 = Sa; var Ca = "#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"; zt.a.ShadersStore.gpuRenderParticlesPixelShader = Ca; var Ma = "#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"; zt.a.IncludesShadersStore.clipPlaneVertexDeclaration2 = Ma; var Oa = "#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}"; zt.a.ShadersStore.gpuRenderParticlesVertexShader = Oa; var Ia = function(e) { function t(t, i, n, o) { void 0 === o && (o = !1); var s = e.call(this, t) || this; s.layerMask = 268435455, s._accumulatedCount = 0, s._targetIndex = 0, s._currentRenderId = -1, s._started = !1, s._stopped = !1, s._timeDelta = 0, s._actualFrame = 0, s._rawTextureWidth = 256, s.onDisposeObservable = new r.c, s.forceDepthWrite = !1, s._preWarmDone = !1, s._scene = n || P.a.LastCreatedScene, s._attachImageProcessingConfiguration(null), s._engine = s._scene.getEngine(), i.randomTextureSize || delete i.randomTextureSize; var a = l.a({ capacity: 5e4, randomTextureSize: s._engine.getCaps().maxTextureSize }, i), c = i; isFinite(c) && (a.capacity = c), s._capacity = a.capacity, s._activeCount = a.capacity, s._currentActiveCount = 0, s._isAnimationSheetEnabled = o, s._scene.particleSystems.push(s), s._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: [] }, s.particleEmitterType = new da; for (var u = Math.min(s._engine.getCaps().maxTextureSize, a.randomTextureSize), h = [], d = 0; d < u; ++d) h.push(Math.random()), h.push(Math.random()), h.push(Math.random()), h.push(Math.random()); s._randomTexture = new je(new Float32Array(h), u, 1, _.a.TEXTUREFORMAT_RGBA, s._scene, !1, !1, _.a.TEXTURE_NEAREST_SAMPLINGMODE, _.a.TEXTURETYPE_FLOAT), s._randomTexture.wrapU = ke.a.WRAP_ADDRESSMODE, s._randomTexture.wrapV = ke.a.WRAP_ADDRESSMODE, h = []; for (d = 0; d < u; ++d) h.push(Math.random()), h.push(Math.random()), h.push(Math.random()), h.push(Math.random()); return s._randomTexture2 = new je(new Float32Array(h), u, 1, _.a.TEXTUREFORMAT_RGBA, s._scene, !1, !1, _.a.TEXTURE_NEAREST_SAMPLINGMODE, _.a.TEXTURETYPE_FLOAT), s._randomTexture2.wrapU = ke.a.WRAP_ADDRESSMODE, s._randomTexture2.wrapV = ke.a.WRAP_ADDRESSMODE, s._randomTextureSize = u, s } return l.d(t, e), Object.defineProperty(t, "IsSupported", { get: function() { return !!P.a.LastCreatedEngine && P.a.LastCreatedEngine.webGLVersion > 1 }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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(), !1) }, 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 = !0, this._stopped = !1, this._preWarmDone = !1, this.beginAnimationOnStart && this.animations && this.animations.length > 0 && this.getScene().beginAnimation(this, this.beginAnimationFrom, this.beginAnimationTo, this.beginAnimationLoop)) }, t.prototype.stop = function() { this._stopped = !0 }, 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 ye.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 ye.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 !1 }, set: function(e) {}, enumerable: !0, configurable: !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, !0), i.age = e.createVertexBuffer("age", 3, 1, this._attributesStrideSize, !0), i.life = e.createVertexBuffer("life", 4, 1, this._attributesStrideSize, !0), i.size = e.createVertexBuffer("size", 9, 3, this._attributesStrideSize, !0); var n = 12; this._colorGradientsTexture || (i.color = e.createVertexBuffer("color", n, 4, this._attributesStrideSize, !0), n += 4), this.billboardMode === Ra.BILLBOARDMODE_STRETCHED && (i.direction = e.createVertexBuffer("direction", n, 3, this._attributesStrideSize, !0)), n += 3, this._isBillboardBased || (i.initialDirection = e.createVertexBuffer("initialDirection", n, 3, this._attributesStrideSize, !0), n += 3), i.angle = e.createVertexBuffer("angle", n, 1, this._attributesStrideSize, !0), this._angularSpeedGradientsTexture ? n++ : n += 2, this._isAnimationSheetEnabled && (i.cellIndex = e.createVertexBuffer("cellIndex", n, 1, this._attributesStrideSize, !0), n += 1, this.spriteRandomStartCell && (i.cellStartOffset = e.createVertexBuffer("cellStartOffset", n, 1, this._attributesStrideSize, !0), n += 1)), this.noiseTexture && (i.noiseCoordinates1 = e.createVertexBuffer("noiseCoordinates1", n, 3, this._attributesStrideSize, !0), n += 3, i.noiseCoordinates2 = e.createVertexBuffer("noiseCoordinates2", n, 3, this._attributesStrideSize, !0), 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 = !1), !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 Oi.a(t, i, !1, this._attributesStrideSize), this._buffer1 = new Oi.a(t, i, !1, this._attributesStrideSize), this._spriteBuffer = new Oi.a(t, r, !1, 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 zt.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 === Ra.BLENDMODE_MULTIPLY && (e = "\n#define BLENDMULTIPLYMODE"), this._isBillboardBased) switch (e += "\n#define BILLBOARD", this.billboardMode) { case Ra.BILLBOARDMODE_Y: e += "\n#define BILLBOARDY"; break; case Ra.BILLBOARDMODE_STRETCHED: e += "\n#define BILLBOARDSTRETCHED"; break; case Ra.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"]; xi.a && (xi.a.PrepareUniforms(t, this._imageProcessingConfigurationDefines), xi.a.PrepareSamplers(i, this._imageProcessingConfigurationDefines)), this._renderEffect = new zt.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 = !1), 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; ye.h.GetCurrentGradient(o, e, function(e, t, i) { n[r] = D.a.Lerp(e.factor1, t.factor1, i) }) } this[t] = je.CreateRTexture(n, this._rawTextureWidth, 1, this._scene, !1, !1, ke.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 = o.t.Color4[0], i = 0; i < this._rawTextureWidth; i++) { var n = i / this._rawTextureWidth; ye.h.GetCurrentGradient(n, this._colorGradients, function(n, r, s) { o.f.LerpToRef(n.color1, r.color1, s, 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 = je.CreateRGBATexture(e, this._rawTextureWidth, 1, this._scene, !1, !1, ke.a.NEAREST_SAMPLINGMODE) } }, t.prototype.render = function(e) { if (void 0 === e && (e = !1), !this._started) return 0; if (this._createColorGradientTexture(), this._createSizeGradientTexture(), this._createAngularSpeedGradientTexture(), this._createVelocityGradientTexture(), this._createLimitVelocityGradientTexture(), this._createDragGradientTexture(), 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(!0), this.render(!0); this._preWarmDone = !0 } 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(!1), 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.emitter.position) { n = this.emitter.getWorldMatrix() } else { var r = this.emitter; n = o.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(!1), this._engine.beginTransformFeedback(!0), this._engine.drawArraysType(so.a.PointListDrawMode, 0, this._currentActiveCount), this._engine.endTransformFeedback(), this._engine.setRasterizerState(!0), this._engine.bindTransformFeedbackBuffer(null), !e) { this._engine.enableEffect(this._renderEffect); var s = this._scene.getViewMatrix(); if (this._renderEffect.setMatrix("view", s), 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 a = this.particleTexture.getBaseSize(); this._renderEffect.setFloat3("sheetInfos", this.spriteCellWidth / a.width, this.spriteCellHeight / a.height, a.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 l = s.clone(); l.invert(), this._renderEffect.setMatrix("invView", l), ir.a.BindClipPlane(this._renderEffect, this._scene) } switch (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess && this._imageProcessingConfiguration.bind(this._renderEffect), this.blendMode) { case Ra.BLENDMODE_ADD: this._engine.setAlphaMode(_.a.ALPHA_ADD); break; case Ra.BLENDMODE_ONEONE: this._engine.setAlphaMode(_.a.ALPHA_ONEONE); break; case Ra.BLENDMODE_STANDARD: this._engine.setAlphaMode(_.a.ALPHA_COMBINE); break; case Ra.BLENDMODE_MULTIPLY: this._engine.setAlphaMode(_.a.ALPHA_MULTIPLY) } this.forceDepthWrite && this._engine.setDepthWrite(!0), this._engine.bindVertexArrayObject(this._renderVAO[this._targetIndex], null), this._engine.drawArraysType(so.a.TriangleFanDrawMode, 0, 4, this._currentActiveCount), this._engine.setAlphaMode(_.a.ALPHA_DISABLE) } this._targetIndex++, 2 === this._targetIndex && (this._targetIndex = 0); var u = this._sourceBuffer; return this._sourceBuffer = this._targetBuffer, this._targetBuffer = u, this._currentActiveCount }, t.prototype.rebuild = function() { this._initialize(!0) }, 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]); this._updateVAO = []; for (e = 0; e < this._renderVAO.length; e++) this._engine.releaseVertexArrayObject(this._renderVAO[e]); this._renderVAO = [] } }, t.prototype.dispose = function(e) { void 0 === e && (e = !0); 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.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 S.a.DeepCopy(this, n), void 0 === i && (i = this.emitter), n.emitter = i, this.particleTexture && (n.particleTexture = new ke.a(this.particleTexture.url, this._scene)), n }, t.prototype.serialize = function() { var e = {}; return Ra._Serialize(e, this), e.activeParticleCount = this.activeParticleCount, e }, t.Parse = function(e, i, n, r) { void 0 === r && (r = !1); var o = new t(e.name, { capacity: e.capacity, randomTextureSize: e.randomTextureSize }, i); return e.activeParticleCount && (o.activeParticleCount = e.activeParticleCount), Ra._Parse(e, o, i, n), e.preventAutoStart && (o.preventAutoStart = e.preventAutoStart), r || o.preventAutoStart || o.start(), o }, t }(ba), Da = (function() {}(), function() { function e() { this.systems = new Array } return Object.defineProperty(e.prototype, "emitterNode", { get: function() { return this._emitterNode }, enumerable: !0, configurable: !0 }), e.prototype.setEmitterAsSphere = function(e, t, i) { this._emitterNode && this._emitterNode.dispose(), this._emitterCreationOptions = { kind: "Sphere", options: e, renderingGroupId: t }; var n = Ln.a.CreateSphere("emitterSphere", { diameter: e.diameter, segments: e.segments }, i); n.renderingGroupId = t; var r = new Ri.a("emitterSphereMaterial", i); r.emissiveColor = e.color, n.material = r; for (var o = 0, s = this.systems; o < s.length; o++) { s[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 = !1); var r = new e, s = _.a.PARTICLES_BaseAssetsUrl + "/textures/"; i = i || P.a.LastCreatedScene; for (var a = 0, c = t.systems; a < c.length; a++) { var l = c[a]; r.systems.push(n ? Ia.Parse(l, i, s, !0) : Ra.Parse(l, i, s, !0)) } if (t.emitter) { var u = t.emitter.options; switch (t.emitter.kind) { case "Sphere": r.setEmitterAsSphere({ diameter: u.diameter, segments: u.segments, color: o.e.FromArray(u.color) }, t.emitter.renderingGroupId, i) } } return r }, e }()), La = function() { function e() {} return e.CreateDefault = function(e, t, i, n) { var r; return void 0 === t && (t = 500), void 0 === n && (n = !1), (r = n ? new Ia("default system", { capacity: t }, i) : new Ra("default system", t, i)).emitter = e, r.particleTexture = new ke.a("https://www.babylonjs.com/assets/Flare.png", r.getScene()), r.createConeEmitter(.1, Math.PI / 4), r.color1 = new o.f(1, 1, 1, 1), r.color2 = new o.f(1, 1, 1, 1), r.colorDead = new o.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 }, e.CreateAsync = function(t, i, n) { void 0 === n && (n = !1), i || (i = P.a.LastCreatedScene); var r = {}; return i._addPendingData(r), new Promise(function(o, s) { if (n && !Ia.IsSupported) return i._removePendingData(r), s("Particle system with GPU is not supported."); ye.h.LoadFile(e.BaseAssetsUrl + "/systems/" + t + ".json", function(e) { i._removePendingData(r); var t = JSON.parse(e.toString()); return o(Da.Parse(t, i, n)) }, void 0, void 0, void 0, function() { return i._removePendingData(r), s("An error occured while the creation of your particle system. Check if your type '" + t + "' exists.") }) }) }, e.ExportSet = function(e) { for (var t = new Da, i = 0, n = e; i < n.length; i++) { var r = n[i]; t.systems.push(r) } return t }, e.BaseAssetsUrl = _.a.PARTICLES_BaseAssetsUrl, e }(); n.a.AddParser(Ae.a.NAME_PARTICLESYSTEM, function(e, t, i, r) { var o = n.a.GetIndividualParser(Ae.a.NAME_PARTICLESYSTEM); if (o && void 0 !== e.particleSystems && null !== e.particleSystems) for (var s = 0, a = e.particleSystems.length; s < a; s++) { var c = e.particleSystems[s]; i.particleSystems.push(o(c, t, r)) } }), n.a.AddIndividualParser(Ae.a.NAME_PARTICLESYSTEM, function(e, t, i) { return e.activeParticleCount ? Ia.Parse(e, t, i) : Ra.Parse(e, t, i) }), ge.b.prototype.createEffectForParticles = function(e, t, i, n, r, o, s) { void 0 === t && (t = []), void 0 === i && (i = []), void 0 === n && (n = ""); var a = Ra._GetAttributeNamesOrOptions(), c = Ra._GetEffectCreationOptions(); return -1 === n.indexOf(" BILLBOARD") && (n += "\n#define BILLBOARD\n"), -1 === i.indexOf("diffuseSampler") && i.push("diffuseSampler"), this.createEffect({ vertex: "particles", fragmentElement: e }, a, c.concat(t), i, n, r, o, s) }, fe.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 }, fe.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) } return e }; var wa = function() { function e(e, t, i, n, r, s, a, c) { void 0 === c && (c = null), this.idx = 0, this.color = new o.f(1, 1, 1, 1), this.position = o.x.Zero(), this.rotation = o.x.Zero(), this.scaling = o.x.One(), this.uvs = new o.y(0, 0, 1, 1), this.velocity = o.x.Zero(), this.pivot = o.x.Zero(), this.translateFromPivot = !1, this.alive = !0, this.isVisible = !0, this._pos = 0, this._ind = 0, this.shapeId = 0, this.idxInShape = 0, this._stillInvisible = !1, this._rotationMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1], this.parentId = null, this.cullingStrategy = Fe.a.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY, this._globalPosition = o.x.Zero(), this.idx = e, this._pos = t, this._ind = i, this._model = n, this.shapeId = r, this.idxInShape = s, this._sps = a, c && (this._modelBoundingInfo = c, this._boundingInfo = new on.a(c.minimum, c.maximum)) } return Object.defineProperty(e.prototype, "scale", { get: function() { return this.scaling }, set: function(e) { this.scaling = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "quaternion", { get: function() { return this.rotationQuaternion }, set: function(e) { this.rotationQuaternion = e }, enumerable: !0, configurable: !0 }), e.prototype.intersectsMesh = function(e) { return !(!this._boundingInfo || !e._boundingInfo) && (this._sps._bSphereOnly ? sn.a.Intersects(this._boundingInfo.boundingSphere, e._boundingInfo.boundingSphere) : this._boundingInfo.intersects(e._boundingInfo, !1)) }, 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 = o.t.Quaternion[0]; var i = this.rotation; o.q.RotationYawPitchRollToRef(i.y, i.x, i.z, t) } t.toRotationMatrix(e) }, e }(), Fa = function() { return 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 } }(), Na = function() { return function() { this.ind = 0, this.indicesLength = 0, this.sqDistance = 0 } }(), Ba = function(e, t) { return t.sqDistance - e.sqDistance }, Ua = function() { function e(e, t, i) { this.particles = new Array, this.nbParticles = 0, this.billboard = !1, this.recomputeNormals = !0, this.counter = 0, this.vars = {}, this._bSphereOnly = !1, 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 = !0, this._pickable = !1, this._isVisibilityBoxLocked = !1, this._alwaysVisible = !1, this._depthSort = !1, this._shapeCounter = 0, this._copy = new wa(0, 0, 0, null, 0, 0, this), this._color = new o.f(0, 0, 0, 0), this._computeParticleColor = !0, this._computeParticleTexture = !0, this._computeParticleRotation = !0, this._computeParticleVertex = !1, this._computeBoundingBox = !1, this._depthSortParticles = !0, this._mustUnrotateFixedNormals = !1, this._particlesIntersect = !1, this._needs32Bits = !1, this.name = e, this._scene = t || P.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 = !0, this._pickable && (this.pickedParticles = []), this._depthSort && (this.depthSortedParticles = []) } return e.prototype.buildMesh = function() { if (0 === this.nbParticles) { var e = Gs.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 && Mi.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 Mi.a; t.indices = this._depthSort ? this._indices : this._indices32, t.set(this._positions32, Oi.b.PositionKind), t.set(this._normals32, Oi.b.NormalKind), this._uvs32.length > 0 && t.set(this._uvs32, Oi.b.UVKind), this._colors32.length > 0 && t.set(this._colors32, Oi.b.ColorKind); var i = new fe.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._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, s = e.getVerticesData(Oi.b.PositionKind), a = e.getIndices(), c = e.getVerticesData(Oi.b.UVKind), l = e.getVerticesData(Oi.b.ColorKind), u = e.getVerticesData(Oi.b.NormalKind), h = 0, d = a.length / 3; n ? (n = n > d ? d : n, i = Math.round(d / n), r = 0) : i = i > d ? d : i; for (var f = [], p = [], _ = [], g = [], m = o.x.Zero(), v = i; h < d;) { h > d - (i = v + Math.floor((1 + r) * Math.random())) && (i = d - h), f.length = 0, p.length = 0, _.length = 0, g.length = 0; for (var y = 0, b = 3 * h; b < 3 * (h + i); b++) { p.push(y); var T = a[b]; f.push(s[3 * T], s[3 * T + 1], s[3 * T + 2]), c && _.push(c[2 * T], c[2 * T + 1]), l && g.push(l[4 * T], l[4 * T + 1], l[4 * T + 2], l[4 * T + 3]), y++ } var E, A, x = this.nbParticles, R = this._posToShape(f), P = this._uvsToShapeUV(_); for (E = 0; E < R.length; E++) m.addInPlace(R[E]); for (m.scaleInPlace(1 / R.length), E = 0; E < R.length; E++) R[E].subtractInPlace(m); this._particlesIntersect && (A = new on.a(m, m)); var S = new Fa(this._shapeCounter, R, 3 * i, P, null, null), C = this._positions.length, M = this._indices.length; this._meshBuilder(this._index, R, this._positions, p, this._indices, _, this._uvs, g, this._colors, u, this._normals, x, 0, null), this._addParticle(x, C, M, S, this._shapeCounter, 0, A), this.particles[this.nbParticles].position.addInPlace(m), this._index += R.length, x++, this.nbParticles++, this._shapeCounter++, h += i } return this }, e.prototype._unrotateFixedNormals = function() { for (var e = 0, t = 0, i = o.t.Vector3[0], n = o.t.Quaternion[0], r = o.t.Matrix[0], s = 0; s < this.particles.length; s++) { var a = this.particles[s], c = a._model._shape; if (a.rotationQuaternion) a.rotationQuaternion.conjugateToRef(n); else { var l = a.rotation; o.q.RotationYawPitchRollToRef(l.y, l.x, l.z, n), n.conjugateInPlace() } n.toRotationMatrix(r); for (var u = 0; u < c.length; u++) t = e + 3 * u, o.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.scaling.setAll(1), e.uvs.copyFromFloats(0, 0, 1, 1), e.color = null, e.translateFromPivot = !1 }, e.prototype._meshBuilder = function(e, t, i, n, r, s, a, c, l, u, h, d, f, p) { var _, g = 0, m = 0, v = 0; this._resetCopy(); var y = this._copy; p && p.positionFunction && (p.positionFunction(y, d, f), this._mustUnrotateFixedNormals = !0); var b = o.t.Matrix[0], T = o.t.Vector3[0], E = o.t.Vector3[1], A = o.t.Vector3[2], x = o.t.Vector3[3]; for (y.getRotationMatrix(b), y.pivot.multiplyToRef(y.scaling, x), y.translateFromPivot ? A.setAll(0) : A.copyFrom(x), _ = 0; _ < t.length; _++) { if (T.copyFrom(t[_]), p && p.vertexFunction && p.vertexFunction(y, T, _), T.multiplyInPlace(y.scaling).subtractInPlace(x), o.x.TransformCoordinatesToRef(T, b, E), E.addInPlace(A).addInPlace(y.position), i.push(E.x, E.y, E.z), s) { var R = y.uvs; a.push((R.z - R.x) * s[g] + R.x, (R.w - R.y) * s[g + 1] + R.y), g += 2 } if (y.color) this._color = y.color; else { var P = this._color; c && void 0 !== c[m] ? (P.r = c[m], P.g = c[m + 1], P.b = c[m + 2], P.a = c[m + 3]) : (P.r = 1, P.g = 1, P.b = 1, P.a = 1) } l.push(this._color.r, this._color.g, this._color.b, this._color.a), m += 4, !this.recomputeNormals && u && (T.x = u[v], T.y = u[v + 1], T.z = u[v + 2], o.x.TransformNormalToRef(T, b, T), h.push(T.x, T.y, T.z), v += 3) } for (_ = 0; _ < n.length; _++) { var S = e + n[_]; r.push(S), S > 65535 && (this._needs32Bits = !0) } if (this._pickable) { var C = n.length / 3; for (_ = 0; _ < C; _++) this.pickedParticles.push({ idx: d, faceId: _ }) } return this._depthSort && this.depthSortedParticles.push(new Na), y }, e.prototype._posToShape = function(e) { for (var t = [], i = 0; i < e.length; i += 3) t.push(o.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, s) { void 0 === s && (s = null); var a = new wa(e, t, i, n, r, o, this, s); return this.particles.push(a), a }, e.prototype.addShape = function(e, t, i) { var n, r = e.getVerticesData(Oi.b.PositionKind), o = e.getIndices(), s = e.getVerticesData(Oi.b.UVKind), a = e.getVerticesData(Oi.b.ColorKind), c = e.getVerticesData(Oi.b.NormalKind); this._particlesIntersect && (n = e.getBoundingInfo()); for (var l, u, h = this._posToShape(r), d = this._uvsToShapeUV(s), f = i ? i.positionFunction : null, p = i ? i.vertexFunction : null, _ = new Fa(this._shapeCounter, h, o.length, d, f, p), g = this.nbParticles, m = 0; m < t; m++) { var v = this._positions.length, y = this._indices.length; u = this._meshBuilder(this._index, h, this._positions, o, this._indices, s, this._uvs, a, this._colors, c, this._normals, g, m, i), this._updatable && ((l = this._addParticle(g, v, y, _, this._shapeCounter, m, n)).position.copyFrom(u.position), l.rotation.copyFrom(u.rotation), u.rotationQuaternion && l.rotationQuaternion && l.rotationQuaternion.copyFrom(u.rotationQuaternion), u.color && l.color && l.color.copyFrom(u.color), l.scaling.copyFrom(u.scaling), l.uvs.copyFrom(u.uvs)), 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 = o.t.Matrix[0], n = o.t.Vector3[0], r = o.t.Vector3[1], s = o.t.Vector3[2], a = o.t.Vector3[3]; t.getRotationMatrix(i), e.pivot.multiplyToRef(e.scaling, a), t.translateFromPivot ? s.copyFromFloats(0, 0, 0) : s.copyFrom(a); for (var c = e._model._shape, l = 0; l < c.length; l++) n.copyFrom(c[l]), e._model._vertexFunction && e._model._vertexFunction(t, n, l), n.multiplyInPlace(t.scaling).subtractInPlace(a), o.x.TransformCoordinatesToRef(n, i, r), r.addInPlace(s).addInPlace(t.position).toArray(this._positions32, e._pos + 3 * l); e.position.setAll(0), e.rotation.setAll(0), e.rotationQuaternion = null, e.scaling.setAll(1), e.uvs.setAll(0), e.pivot.setAll(0), e.translateFromPivot = !1, 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(Oi.b.PositionKind, this._positions32, !1, !1), this }, e.prototype.setParticles = function(e, t, i) { if (void 0 === e && (e = 0), void 0 === t && (t = this.nbParticles - 1), void 0 === i && (i = !0), !this._updatable) return this; this.beforeUpdateParticles(e, t, i); var n = o.t.Matrix[0], r = o.t.Matrix[1], s = this.mesh, a = this._colors32, c = this._positions32, l = this._normals32, u = this._uvs32, h = this._indices32, d = this._indices, f = this._fixedNormal32, p = o.t.Vector3, _ = p[5].copyFromFloats(1, 0, 0), g = p[6].copyFromFloats(0, 1, 0), m = 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(!0), this.mesh._worldMatrix.invertToRef(r)), this.billboard) { var T = p[0]; this._camera.getDirectionToRef(o.c.Z, T), o.x.TransformNormalToRef(T, r, m), m.normalize(); var E = this._camera.getViewMatrix(!0); o.x.TransformNormalFromFloatsToRef(E.m[1], E.m[5], E.m[9], r, g), o.x.CrossToRef(g, m, _), g.normalize(), _.normalize() } this._depthSort && o.x.TransformCoordinatesToRef(this._camera.globalPosition, r, b), o.j.IdentityToRef(n); var A = 0, x = 0, R = 0, P = 0, S = 0, C = 0, M = 0; if (this.mesh.isFacetDataEnabled && (this._computeBoundingBox = !0), 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 I = (x = this.particles[e]._pos) / 3 | 0; P = 4 * I, C = 2 * I; for (var D = e; D <= t; D++) { var L = this.particles[D]; this.updateParticle(L); var w = L._model._shape, F = L._model._shapeUV, N = L._rotationMatrix, B = L.position, U = L.rotation, V = L.scaling, G = L._globalPosition; if (this._depthSort && this._depthSortParticles) { var k = this.depthSortedParticles[D]; k.ind = L._ind, k.indicesLength = L._model._indicesLength, k.sqDistance = o.x.DistanceSquared(L.position, b) } if (!L.alive || L._stillInvisible && !L.isVisible) x += 3 * (M = w.length), P += 4 * M, C += 2 * M; else { if (L.isVisible) { L._stillInvisible = !1; var z = p[12]; if (L.pivot.multiplyToRef(V, z), this.billboard && (U.x = 0, U.y = 0), (this._computeParticleRotation || this.billboard) && L.getRotationMatrix(n), null !== L.parentId) { var j = this.particles[L.parentId], H = j._rotationMatrix, W = j._globalPosition, X = B.x * H[1] + B.y * H[4] + B.z * H[7], Y = B.x * H[0] + B.y * H[3] + B.z * H[6], K = B.x * H[2] + B.y * H[5] + B.z * H[8]; if (G.x = W.x + Y, G.y = W.y + X, G.z = W.z + K, this._computeParticleRotation || this.billboard) { var Q = n.m; N[0] = Q[0] * H[0] + Q[1] * H[3] + Q[2] * H[6], N[1] = Q[0] * H[1] + Q[1] * H[4] + Q[2] * H[7], N[2] = Q[0] * H[2] + Q[1] * H[5] + Q[2] * H[8], N[3] = Q[4] * H[0] + Q[5] * H[3] + Q[6] * H[6], N[4] = Q[4] * H[1] + Q[5] * H[4] + Q[6] * H[7], N[5] = Q[4] * H[2] + Q[5] * H[5] + Q[6] * H[8], N[6] = Q[8] * H[0] + Q[9] * H[3] + Q[10] * H[6], N[7] = Q[8] * H[1] + Q[9] * H[4] + Q[10] * H[7], N[8] = Q[8] * H[2] + Q[9] * H[5] + Q[10] * H[8] } } else if (G.x = B.x, G.y = B.y, G.z = B.z, this._computeParticleRotation || this.billboard) { Q = n.m; N[0] = Q[0], N[1] = Q[1], N[2] = Q[2], N[3] = Q[4], N[4] = Q[5], N[5] = Q[6], N[6] = Q[8], N[7] = Q[9], N[8] = Q[10] } var q = p[11]; for (L.translateFromPivot ? q.setAll(0) : q.copyFrom(z), M = 0; M < w.length; M++) { A = x + 3 * M, R = P + 4 * M, S = C + 2 * M, (T = p[0]).copyFrom(w[M]), this._computeParticleVertex && this.updateParticleVertex(L, T, M); var Z = T.x * V.x - z.x, J = T.y * V.y - z.y, $ = T.z * V.z - z.z; Y = Z * N[0] + J * N[3] + $ * N[6], X = Z * N[1] + J * N[4] + $ * N[7], K = Z * N[2] + J * N[5] + $ * N[8]; Y += q.x, X += q.y, K += q.z; var ee = c[A] = G.x + _.x * Y + g.x * X + m.x * K, te = c[A + 1] = G.y + _.y * Y + g.y * X + m.y * K, ie = c[A + 2] = G.z + _.z * Y + g.z * X + m.z * K; if (this._computeBoundingBox && (v.minimizeInPlaceFromFloats(ee, te, ie), y.maximizeInPlaceFromFloats(ee, te, ie)), !this._computeParticleVertex) { var ne = f[A], re = f[A + 1], oe = f[A + 2], se = ne * N[0] + re * N[3] + oe * N[6], ae = ne * N[1] + re * N[4] + oe * N[7], ce = ne * N[2] + re * N[5] + oe * N[8]; l[A] = _.x * se + g.x * ae + m.x * ce, l[A + 1] = _.y * se + g.y * ae + m.y * ce, l[A + 2] = _.z * se + g.z * ae + m.z * ce } if (this._computeParticleColor && L.color) { var le = L.color, ue = this._colors32; ue[R] = le.r, ue[R + 1] = le.g, ue[R + 2] = le.b, ue[R + 3] = le.a } if (this._computeParticleTexture) { var he = L.uvs; u[S] = F[2 * M] * (he.z - he.x) + he.x, u[S + 1] = F[2 * M + 1] * (he.w - he.y) + he.y } } } else for (L._stillInvisible = !0, M = 0; M < w.length; M++) { if (R = P + 4 * M, S = C + 2 * M, c[A = x + 3 * M] = c[A + 1] = c[A + 2] = 0, l[A] = l[A + 1] = l[A + 2] = 0, this._computeParticleColor && L.color) { le = L.color; a[R] = le.r, a[R + 1] = le.g, a[R + 2] = le.b, a[R + 3] = le.a } if (this._computeParticleTexture) { he = L.uvs; u[S] = F[2 * M] * (he.z - he.x) + he.x, u[S + 1] = F[2 * M + 1] * (he.w - he.y) + he.y } } if (this._particlesIntersect) { var de = L._boundingInfo, fe = de.boundingBox, pe = de.boundingSphere, _e = L._modelBoundingInfo; if (!this._bSphereOnly) { var ge = _e.boundingBox.vectors, me = p[1], ve = p[2]; me.setAll(Number.MAX_VALUE), ve.setAll(-Number.MAX_VALUE); for (var ye = 0; ye < 8; ye++) { var be = ge[ye].x * V.x, Te = ge[ye].y * V.y, Ee = ge[ye].z * V.z, Ae = (Y = be * N[0] + Te * N[3] + Ee * N[6], X = be * N[1] + Te * N[4] + Ee * N[7], K = be * N[2] + Te * N[5] + Ee * N[8], B.x + _.x * Y + g.x * X + m.x * K), xe = B.y + _.y * Y + g.y * X + m.y * K, Re = B.z + _.z * Y + g.z * X + m.z * K; me.minimizeInPlaceFromFloats(Ae, xe, Re), ve.maximizeInPlaceFromFloats(Ae, xe, Re) } fe.reConstruct(me, ve, s._worldMatrix) } var Pe = _e.minimum.multiplyToRef(V, p[1]), Se = _e.maximum.multiplyToRef(V, p[2]), Ce = Se.addToRef(Pe, p[3]).scaleInPlace(.5).addInPlace(G), Me = Se.subtractToRef(Pe, p[4]).scaleInPlace(.5 * this._bSphereRadiusFactor), Oe = Ce.subtractToRef(Me, p[1]), Ie = Ce.addToRef(Me, p[2]); pe.reConstruct(Oe, Ie, s._worldMatrix) } x = A + 3, P = R + 4, C = S + 2 } } if (i) { if (this._computeParticleColor && s.updateVerticesData(Oi.b.ColorKind, a, !1, !1), this._computeParticleTexture && s.updateVerticesData(Oi.b.UVKind, u, !1, !1), s.updateVerticesData(Oi.b.PositionKind, c, !1, !1), !s.areNormalsFrozen || s.isFacetDataEnabled) { if (this._computeParticleVertex || s.isFacetDataEnabled) { var De = s.isFacetDataEnabled ? s.getFacetDataParameters() : null; Mi.a.ComputeNormals(c, h, l, De); for (var Le = 0; Le < l.length; Le++) f[Le] = l[Le] } s.areNormalsFrozen || s.updateVerticesData(Oi.b.NormalKind, l, !1, !1) } if (this._depthSort && this._depthSortParticles) { var we = this.depthSortedParticles; we.sort(Ba); for (var Fe = we.length, Ne = 0, Be = 0; Be < Fe; Be++) { var Ue = we[Be].indicesLength, Ve = we[Be].ind; for (Le = 0; Le < Ue; Le++) h[Ne] = d[Ve + Le], Ne++ } s.updateIndices(h) } } return this._computeBoundingBox && (s._boundingInfo ? s._boundingInfo.reConstruct(v, y, s._worldMatrix) : s._boundingInfo = new on.a(v, y, s._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(), this }, e.prototype.setVisibilityBox = function(e) { var t = e / 2; this.mesh._boundingInfo = new on.a(new o.x(-t, -t, -t), new o.x(t, t, t)) }, Object.defineProperty(e.prototype, "isAlwaysVisible", { get: function() { return this._alwaysVisible }, set: function(e) { this._alwaysVisible = e, this.mesh.alwaysSelectAsActiveMesh = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "isVisibilityBoxLocked", { get: function() { return this._isVisibilityBoxLocked }, set: function(e) { this._isVisibilityBoxLocked = e, this.mesh.getBoundingInfo().isLocked = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "computeParticleRotation", { get: function() { return this._computeParticleRotation }, set: function(e) { this._computeParticleRotation = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "computeParticleColor", { get: function() { return this._computeParticleColor }, set: function(e) { this._computeParticleColor = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "computeParticleTexture", { get: function() { return this._computeParticleTexture }, set: function(e) { this._computeParticleTexture = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "computeParticleVertex", { get: function() { return this._computeParticleVertex }, set: function(e) { this._computeParticleVertex = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "computeBoundingBox", { get: function() { return this._computeBoundingBox }, set: function(e) { this._computeBoundingBox = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "depthSortParticles", { get: function() { return this._depthSortParticles }, set: function(e) { this._depthSortParticles = e }, enumerable: !0, configurable: !0 }), 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 }(); W.a.prototype.getPhysicsEngine = function() { return this._physicsEngine }, W.a.prototype.enablePhysics = function(e, t) { if (void 0 === e && (e = null), this._physicsEngine) return !0; var i = this._getComponent(Ae.a.NAME_PHYSICSENGINE); i || (i = new ka(this), this._addComponent(i)); try { return this._physicsEngine = new jo(e, t), !0 } catch (e) { return p.a.Error(e.message), !1 } }, W.a.prototype.disablePhysicsEngine = function() { this._physicsEngine && (this._physicsEngine.dispose(), this._physicsEngine = null) }, W.a.prototype.isPhysicsEnabled = function() { return void 0 !== this._physicsEngine }, W.a.prototype.deleteCompoundImpostor = function(e) { var t = e.parts[0].mesh; t.physicsImpostor && (t.physicsImpostor.dispose(), t.physicsImpostor = null) }, W.a.prototype._advancePhysicsEngineStep = function(e) { this._physicsEngine && (this.onBeforePhysicsObservable.notifyObservers(this), this._physicsEngine._step(e / 1e3), this.onAfterPhysicsObservable.notifyObservers(this)) }, Object.defineProperty(Fe.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: !0, configurable: !0 }), Fe.a.prototype.getPhysicsImpostor = function() { return this.physicsImpostor }, Fe.a.prototype.applyImpulse = function(e, t) { return this.physicsImpostor ? (this.physicsImpostor.applyImpulse(e, t), this) : this }, Fe.a.prototype.setPhysicsLinkWith = function(e, t, i, n) { return this.physicsImpostor && e.physicsImpostor ? (this.physicsImpostor.createJoint(e.physicsImpostor, zo.e.HingeJoint, { mainPivot: t, connectedPivot: i, nativeParams: n }), this) : this }; var Va, Ga, ka = function() { function e(e) { var t = this; this.name = Ae.a.NAME_PHYSICSENGINE, this.scene = e, this.scene.onBeforePhysicsObservable = new r.c, this.scene.onAfterPhysicsObservable = new r.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 }(), za = function() { function e(e) { this._scene = e, this._physicsEngine = this._scene.getPhysicsEngine(), this._physicsEngine || p.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 p.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 Ya).radius = t, t.strength = i || t.strength, t.falloff = n || t.falloff); var o = new ja(this._scene, t), s = Array(); return r.forEach(function(t) { var i = o.getImpostorHitData(t, e); i && (t.applyImpulse(i.force, i.contactPoint), s.push({ impostor: t, hitData: i })) }), o.triggerAffectedImpostorsCallback(s), o.dispose(!1), o }, e.prototype.applyRadialExplosionForce = function(e, t, i, n) { if (!this._physicsEngine) return p.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 Ya).radius = t, t.strength = i || t.strength, t.falloff = n || t.falloff); var o = new ja(this._scene, t), s = Array(); return r.forEach(function(t) { var i = o.getImpostorHitData(t, e); i && (t.applyForce(i.force, i.contactPoint), s.push({ impostor: t, hitData: i })) }), o.triggerAffectedImpostorsCallback(s), o.dispose(!1), o }, e.prototype.gravitationalField = function(e, t, i, n) { if (!this._physicsEngine) return p.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 Ya).radius = t, t.strength = i || t.strength, t.falloff = n || t.falloff); var r = new Ha(this, this._scene, e, t); return r.dispose(!1), r }, e.prototype.updraft = function(e, t, i, n, r) { if (!this._physicsEngine) return p.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 Ka).radius = t, t.strength = i || t.strength, t.height = n || t.height, t.updraftMode = r || t.updraftMode); var o = new Wa(this._scene, e, t); return o.dispose(!1), o }, e.prototype.vortex = function(e, t, i, n) { if (!this._physicsEngine) return p.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); var r = new Xa(this._scene, e, t); return r.dispose(!1), r }, e }(), ja = function() { function e(e, t) { this._scene = e, this._options = t, this._dataFetched = !1, this._options = l.a({}, new Ya, this._options) } return e.prototype.getData = function() { return this._dataFetched = !0, { sphere: this._sphere } }, 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 It.a(t, i, this._options.radius).intersectsMesh(e.object).pickedPoint; if (!n) return null; var r = o.x.Distance(t, n); if (r > this._options.radius) return null; var s = this._options.falloff === Va.Constant ? this._options.strength : this._options.strength * (1 - r / this._options.radius); return { force: i.multiplyByFloats(s, s, s), 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 = !0), e ? this._sphere.dispose() : setTimeout(function() { t._dataFetched || t._sphere.dispose() }, 0) }, e.prototype._prepareSphere = function() { this._sphere || (this._sphere = Ln.a.CreateSphere("radialExplosionEventSphere", this._options.sphere, this._scene), this._sphere.isVisible = !1) }, e.prototype._intersectsWithSphere = function(e, t, i) { var n = e.object; return this._prepareSphere(), this._sphere.position = t, this._sphere.scaling = new o.x(2 * i, 2 * i, 2 * i), this._sphere._updateBoundingInfo(), this._sphere.computeWorldMatrix(!0), this._sphere.intersectsMesh(n, !0) }, e }(), Ha = function() { function e(e, t, i, n) { this._physicsHelper = e, this._scene = t, this._origin = i, this._options = n, this._dataFetched = !1, this._options = l.a({}, new Ya, this._options), this._tickCallback = this._tick.bind(this), this._options.strength = -1 * this._options.strength } return e.prototype.getData = function() { return this._dataFetched = !0, { 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 = !0), 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 }(), Wa = function() { function e(e, t, i) { this._scene = e, this._origin = t, this._options = i, this._originTop = o.x.Zero(), this._originDirection = o.x.Zero(), this._cylinderPosition = o.x.Zero(), this._dataFetched = !1, this._physicsEngine = this._scene.getPhysicsEngine(), this._options = l.a({}, new Ka, this._options), this._origin.addToRef(new o.x(0, this._options.height / 2, 0), this._cylinderPosition), this._origin.addToRef(new o.x(0, this._options.height, 0), this._originTop), this._options.updraftMode === Ga.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 = !0, { 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 = !0), 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 === Ga.Perpendicular) var i = this._originDirection; else i = t.subtract(this._originTop); var n = o.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 = Fi.a.CreateCylinder("updraftEventCylinder", { height: this._options.height, diameter: 2 * this._options.radius }, this._scene), this._cylinder.isVisible = !1) }, e.prototype._intersectsWithCylinder = function(e) { var t = e.object; return this._cylinder.position = this._cylinderPosition, this._cylinder.intersectsMesh(t, !0) }, e }(), Xa = function() { function e(e, t, i) { this._scene = e, this._origin = t, this._options = i, this._originTop = o.x.Zero(), this._cylinderPosition = o.x.Zero(), this._dataFetched = !1, this._physicsEngine = this._scene.getPhysicsEngine(), this._options = l.a({}, new Qa, this._options), this._origin.addToRef(new o.x(0, this._options.height / 2, 0), this._cylinderPosition), this._origin.addToRef(new o.x(0, this._options.height, 0), this._originTop), this._tickCallback = this._tick.bind(this), this._prepareCylinder() } return e.prototype.getData = function() { return this._dataFetched = !0, { 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 = !0), 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 o.x(this._origin.x, t.y, this._origin.z), n = t.subtract(i), r = new It.a(i, n, this._options.radius).intersectsMesh(e.object), s = r.pickedPoint; if (!s) return null; var a = r.distance / this._options.radius, c = s.normalize(); if (a > this._options.centripetalForceThreshold && (c = c.negate()), a > this._options.centripetalForceThreshold) var l = c.x * this._options.centripetalForceMultiplier, u = c.y * this._options.updraftForceMultiplier, h = c.z * this._options.centripetalForceMultiplier; else { var d = o.x.Cross(i, t).normalize(); l = (d.x + c.x) * this._options.centrifugalForceMultiplier, u = this._originTop.y * this._options.updraftForceMultiplier, h = (d.z + c.z) * this._options.centrifugalForceMultiplier } var f = new o.x(l, u, h); return { force: f = f.multiplyByFloats(this._options.strength, this._options.strength, this._options.strength), contactPoint: t, distanceFromOrigin: a } }, 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 = Fi.a.CreateCylinder("vortexEventCylinder", { height: this._options.height, diameter: 2 * this._options.radius }, this._scene), this._cylinder.isVisible = !1) }, e.prototype._intersectsWithCylinder = function(e) { var t = e.object; return this._cylinder.position = this._cylinderPosition, this._cylinder.intersectsMesh(t, !0) }, e }(), Ya = function() { return function() { this.radius = 5, this.strength = 10, this.falloff = Va.Constant, this.sphere = { segments: 32, diameter: 1 } } }(), Ka = function() { return function() { this.radius = 5, this.strength = 10, this.height = 10, this.updraftMode = Ga.Center } }(), Qa = function() { return 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" }(Va || (Va = {})), function(e) { e[e.Center = 0] = "Center", e[e.Perpendicular = 1] = "Perpendicular" }(Ga || (Ga = {})); var qa = "\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}"; zt.a.ShadersStore.blackAndWhitePixelShader = qa; var Za = function(e) { function t(t, i, n, r, o, s) { var a = e.call(this, t, "blackAndWhite", ["degree"], null, i, n, r, o, s) || this; return a.degree = 1, a.onApplyObservable.add(function(e) { e.setFloat("degree", a.degree) }), a } return l.d(t, e), t }(Ht), Ja = function() { function e(e, t, i, n) { this._name = t, this._singleInstance = n || !0, 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 !1; return !0 }, enumerable: !0, configurable: !0 }), e.prototype._update = function() {}, e.prototype._attachCameras = function(e) { var t, i = this, n = ye.h.MakeArray(e || this._cameras); if (n) for (var r = 0; r < n.length; r++) { var o = n[r], s = o.name; if (t = this._singleInstance ? 0 : s, !this._postProcesses[t]) { var a = this._getPostProcesses(); a && (this._postProcesses[t] = Array.isArray(a) ? a : [a]) } this._indicesForCamera[s] || (this._indicesForCamera[s] = []), this._postProcesses[t].forEach(function(e) { var t = o.attachPostProcess(e); i._indicesForCamera[s].push(t) }), this._cameras[s] || (this._cameras[s] = o) } }, e.prototype._detachCameras = function(e) { var t = ye.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 = ye.h.MakeArray(e || this._cameras); if (i) for (var n = 0; n < i.length; n++) for (var r = i[n], o = r.name, s = 0; s < this._indicesForCamera[o].length; s++) void 0 !== r._postProcesses[this._indicesForCamera[o][s]] && null !== r._postProcesses[this._indicesForCamera[o][s]] || this._postProcesses[this._singleInstance ? 0 : o].forEach(function(e) { i[n].attachPostProcess(e, t._indicesForCamera[o][s]) }) }, e.prototype._disable = function(e) { var t = ye.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 }(), $a = "#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}"; zt.a.ShadersStore.extractHighlightsPixelShader = $a; var ec = function(e) { function t(t, i, n, r, s, a, c, l) { void 0 === c && (c = _.a.TEXTURETYPE_UNSIGNED_INT), void 0 === l && (l = !1); var u = e.call(this, t, "extractHighlights", ["threshold", "exposure"], null, i, n, r, s, a, null, c, void 0, null, l) || this; return u.threshold = .9, u._exposure = 1, u._inputPostProcess = null, u.onApplyObservable.add(function(e) { u._inputPostProcess && e.setTextureFromPostProcess("textureSampler", u._inputPostProcess), e.setFloat("threshold", Math.pow(u.threshold, o.u)), e.setFloat("exposure", u._exposure) }), u } return l.d(t, e), t }(Ht), tc = "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"; zt.a.ShadersStore.bloomMergePixelShader = tc; var ic = function(e) { function t(t, i, n, r, o, s, a, c, l, u, h) { void 0 === u && (u = _.a.TEXTURETYPE_UNSIGNED_INT), void 0 === h && (h = !1); var d = e.call(this, t, "bloomMerge", ["bloomWeight"], ["circleOfConfusionSampler", "blurStep0", "blurStep1", "blurStep2", "bloomBlur"], o, s, a, c, l, null, u, void 0, null, !0) || this; return d.weight = r, d.onApplyObservable.add(function(e) { e.setTextureFromPostProcess("textureSampler", i), e.setTextureFromPostProcessOutput("bloomBlur", n), e.setFloat("bloomWeight", d.weight) }), h || d.updateEffect(), d } return l.d(t, e), t }(Ht), nc = function(e) { function t(t, i, n, r, s, a) { void 0 === s && (s = 0), void 0 === a && (a = !1); var c = e.call(this, t.getEngine(), "bloom", function() { return c._effects }, !0) || this; return c.bloomScale = i, c._effects = [], c._downscale = new ec("highlights", 1, null, ke.a.BILINEAR_SAMPLINGMODE, t.getEngine(), !1, s, a), c._blurX = new $n("horizontal blur", new o.w(1, 0), 10, i, null, ke.a.BILINEAR_SAMPLINGMODE, t.getEngine(), !1, s, void 0, a), c._blurX.alwaysForcePOT = !0, c._blurX.autoClear = !1, c._blurY = new $n("vertical blur", new o.w(0, 1), 10, i, null, ke.a.BILINEAR_SAMPLINGMODE, t.getEngine(), !1, s, void 0, a), c._blurY.alwaysForcePOT = !0, c._blurY.autoClear = !1, c.kernel = r, c._effects = [c._downscale, c._blurX, c._blurY], c._merge = new ic("bloomMerge", c._downscale, c._blurY, n, i, null, ke.a.BILINEAR_SAMPLINGMODE, t.getEngine(), !1, s, a), c._merge.autoClear = !1, c._effects.push(c._merge), c } return l.d(t, e), Object.defineProperty(t.prototype, "threshold", { get: function() { return this._downscale.threshold }, set: function(e) { this._downscale.threshold = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "weight", { get: function() { return this._merge.weight }, set: function(e) { this._merge.weight = e }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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 !1; return !0 }, t }(Ja), rc = "\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}"; zt.a.ShadersStore.chromaticAberrationPixelShader = rc; var oc = function(e) { function t(t, i, n, r, s, a, c, l, u, h) { void 0 === u && (u = _.a.TEXTURETYPE_UNSIGNED_INT), void 0 === h && (h = !1); var d = e.call(this, t, "chromaticAberration", ["chromatic_aberration", "screen_width", "screen_height", "direction", "radialIntensity", "centerPosition"], [], r, s, a, c, l, null, u, void 0, null, h) || this; return d.aberrationAmount = 30, d.radialIntensity = 0, d.direction = new o.w(.707, .707), d.centerPosition = new o.w(.5, .5), d.onApplyObservable.add(function(e) { e.setFloat("chromatic_aberration", d.aberrationAmount), e.setFloat("screen_width", i), e.setFloat("screen_height", n), e.setFloat("radialIntensity", d.radialIntensity), e.setFloat2("direction", d.direction.x, d.direction.y), e.setFloat2("centerPosition", d.centerPosition.x, d.centerPosition.y) }), d } return l.d(t, e), t }(Ht), sc = "\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"; zt.a.ShadersStore.circleOfConfusionPixelShader = sc; var ac = function(e) { function t(t, i, n, r, o, s, a, c, l) { void 0 === c && (c = _.a.TEXTURETYPE_UNSIGNED_INT), void 0 === l && (l = !1); var u = e.call(this, t, "circleOfConfusion", ["cameraMinMaxZ", "focusDistance", "cocPrecalculation"], ["depthSampler"], n, r, o, s, a, null, c, void 0, null, l) || this; return u.lensSize = 50, u.fStop = 1.4, u.focusDistance = 2e3, u.focalLength = 50, u._depthTexture = null, u._depthTexture = i, u.onApplyObservable.add(function(e) { if (u._depthTexture) { e.setTexture("depthSampler", u._depthTexture); var t = u.lensSize / u.fStop * u.focalLength / (u.focusDistance - u.focalLength); e.setFloat("focusDistance", u.focusDistance), e.setFloat("cocPrecalculation", t), e.setFloat2("cameraMinMaxZ", u._depthTexture.activeCamera.minZ, u._depthTexture.activeCamera.maxZ) } else p.a.Warn("No depth texture set on CircleOfConfusionPostProcess") }), u } return l.d(t, e), Object.defineProperty(t.prototype, "depthTexture", { set: function(e) { this._depthTexture = e }, enumerable: !0, configurable: !0 }), t }(Ht), cc = "\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}"; zt.a.ShadersStore.colorCorrectionPixelShader = cc; var lc = function(e) { function t(t, i, n, r, o, s, a) { var c = e.call(this, t, "colorCorrection", null, ["colorTable"], n, r, o, s, a) || this; return c._colorTableTexture = new ke.a(i, r.getScene(), !0, !1, ke.a.TRILINEAR_SAMPLINGMODE), c._colorTableTexture.anisotropicFilteringLevel = 1, c._colorTableTexture.wrapU = ke.a.CLAMP_ADDRESSMODE, c._colorTableTexture.wrapV = ke.a.CLAMP_ADDRESSMODE, c.onApply = function(e) { e.setTexture("colorTable", c._colorTableTexture) }, c } return l.d(t, e), t }(Ht), uc = "\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}"; zt.a.ShadersStore.convolutionPixelShader = uc; var hc = function(e) { function t(t, i, n, r, o, s, a, c) { void 0 === c && (c = _.a.TEXTURETYPE_UNSIGNED_INT); var l = e.call(this, t, "convolution", ["kernel", "screenSize"], null, n, r, o, s, a, null, c) || this; return l.kernel = i, l.onApply = function(e) { e.setFloat2("screenSize", l.width, l.height), e.setArray("kernel", l.kernel) }, l } return l.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 }(Ht), dc = function(e) { function t(t, i, n, r, o, s, a, c, l, u, h, d, f) { void 0 === c && (c = null), void 0 === l && (l = ke.a.BILINEAR_SAMPLINGMODE), void 0 === d && (d = _.a.TEXTURETYPE_UNSIGNED_INT), void 0 === f && (f = !1); var p = e.call(this, t, n, r, o, s, l = _.a.TEXTURE_BILINEAR_SAMPLINGMODE, u, h, d = _.a.TEXTURETYPE_UNSIGNED_INT, "#define DOF 1\r\n", f) || this; return p.direction = n, p.onApplyObservable.add(function(e) { null != c && e.setTextureFromPostProcess("textureSampler", c), e.setTextureFromPostProcessOutput("circleOfConfusionSampler", a), i.activeCamera && e.setFloat2("cameraMinMaxZ", i.activeCamera.minZ, i.activeCamera.maxZ) }), p } return l.d(t, e), t }($n), fc = "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"; zt.a.ShadersStore.depthOfFieldMergePixelShader = fc; var pc, _c = function() { return function() {} }(), gc = function(e) { function t(t, i, n, r, o, s, a, c, l, u, h) { void 0 === u && (u = _.a.TEXTURETYPE_UNSIGNED_INT), void 0 === h && (h = !1); var d = e.call(this, t, "depthOfFieldMerge", [], ["circleOfConfusionSampler", "blurStep0", "blurStep1", "blurStep2"], o, s, a, c, l, null, u, void 0, null, !0) || this; return d.blurSteps = r, d.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 || d.updateEffect(), d } return l.d(t, e), t.prototype.updateEffect = function(t, i, n, r, o, s) { 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, s) }, t }(Ht); ! function(e) { e[e.Low = 0] = "Low", e[e.Medium = 1] = "Medium", e[e.High = 2] = "High" }(pc || (pc = {})); var mc = function(e) { function t(t, i, n, r, s) { void 0 === n && (n = pc.Low), void 0 === r && (r = 0), void 0 === s && (s = !1); var a = e.call(this, t.getEngine(), "depth of field", function() { return a._effects }, !0) || this; a._effects = [], a._circleOfConfusion = new ac("circleOfConfusion", i, 1, null, ke.a.BILINEAR_SAMPLINGMODE, t.getEngine(), !1, r, s), a._depthOfFieldBlurY = [], a._depthOfFieldBlurX = []; var c = 1, l = 15; switch (n) { case pc.High: c = 3, l = 51; break; case pc.Medium: c = 2, l = 31; break; default: l = 15, c = 1 } for (var u = l / Math.pow(2, c - 1), h = 1, d = 0; d < c; d++) { var f = new dc("verticle blur", t, new o.w(0, 1), u, h, null, a._circleOfConfusion, 0 == d ? a._circleOfConfusion : null, ke.a.BILINEAR_SAMPLINGMODE, t.getEngine(), !1, r, s); f.autoClear = !1, h = .75 / Math.pow(2, d); var p = new dc("horizontal blur", t, new o.w(1, 0), u, h, null, a._circleOfConfusion, null, ke.a.BILINEAR_SAMPLINGMODE, t.getEngine(), !1, r, s); p.autoClear = !1, a._depthOfFieldBlurY.push(f), a._depthOfFieldBlurX.push(p) } a._effects = [a._circleOfConfusion]; for (d = 0; d < a._depthOfFieldBlurX.length; d++) a._effects.push(a._depthOfFieldBlurY[d]), a._effects.push(a._depthOfFieldBlurX[d]); return a._dofMerge = new gc("dofMerge", a._circleOfConfusion, a._circleOfConfusion, a._depthOfFieldBlurX, h, null, ke.a.BILINEAR_SAMPLINGMODE, t.getEngine(), !1, r, s), a._dofMerge.autoClear = !1, a._effects.push(a._dofMerge), a } return l.d(t, e), Object.defineProperty(t.prototype, "focalLength", { get: function() { return this._circleOfConfusion.focalLength }, set: function(e) { this._circleOfConfusion.focalLength = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "fStop", { get: function() { return this._circleOfConfusion.fStop }, set: function(e) { this._circleOfConfusion.fStop = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "focusDistance", { get: function() { return this._circleOfConfusion.focusDistance }, set: function(e) { this._circleOfConfusion.focusDistance = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "lensSize", { get: function() { return this._circleOfConfusion.lensSize }, set: function(e) { this._circleOfConfusion.lensSize = e }, enumerable: !0, configurable: !0 }), t.prototype.getClassName = function() { return "DepthOfFieldEffect" }, Object.defineProperty(t.prototype, "depthTexture", { set: function(e) { this._circleOfConfusion.depthTexture = e }, enumerable: !0, configurable: !0 }), 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 !1; return !0 }, t }(Ja), vc = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D passSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(passSampler,vUV);\n}"; zt.a.ShadersStore.displayPassPixelShader = vc; var yc = function(e) { function t(t, i, n, r, o, s) { return e.call(this, t, "displayPass", ["passSampler"], ["passSampler"], i, n, r, o, s) || this } return l.d(t, e), t }(Ht), bc = "\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}"; zt.a.ShadersStore.filterPixelShader = bc; var Tc = function(e) { function t(t, i, n, r, o, s, a) { var c = e.call(this, t, "filter", ["kernelMatrix"], null, n, r, o, s, a) || this; return c.kernelMatrix = i, c.onApply = function(e) { e.setMatrix("kernelMatrix", c.kernelMatrix) }, c } return l.d(t, e), t }(Ht), Ec = "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 }(Ht), Rc = "#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}"; zt.a.ShadersStore.grainPixelShader = Rc; var Pc = function(e) { function t(t, i, n, r, o, s, a, c) { void 0 === a && (a = _.a.TEXTURETYPE_UNSIGNED_INT), void 0 === c && (c = !1); var l = e.call(this, t, "grain", ["intensity", "animatedSeed"], [], i, n, r, o, s, null, a, void 0, null, c) || this; return l.intensity = 30, l.animated = !1, l.onApplyObservable.add(function(e) { e.setFloat("intensity", l.intensity), e.setFloat("animatedSeed", l.animated ? Math.random() + 1 : 1) }), l } return l.d(t, e), t }(Ht), Sc = "\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}"; zt.a.ShadersStore.highlightsPixelShader = Sc; var Cc = function(e) { function t(t, i, n, r, o, s, a) { return void 0 === a && (a = _.a.TEXTURETYPE_UNSIGNED_INT), e.call(this, t, "highlights", null, null, i, n, r, o, s, null, a) || this } return l.d(t, e), t }(Ht); zt.a.IncludesShadersStore.mrtFragmentDeclaration = "#if __VERSION__>=200\nlayout(location=0) out vec4 glFragData[{X}];\n#endif\n"; var Mc = "#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}"; zt.a.ShadersStore.geometryPixelShader = Mc; var Oc = "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}"; zt.a.ShadersStore.geometryVertexShader = Oc; var Ic = function() { function e(t, i) { void 0 === i && (i = 1), this._previousTransformationMatrices = {}, this._previousBonesTransformationMatrices = {}, this.excludedSkinnedMeshesFromVelocity = [], this._enablePosition = !1, this._enableVelocity = !1, 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "isSupported", { get: function() { return this._multiRenderTarget.isSupported }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "enableVelocity", { get: function() { return this._enableVelocity }, set: function(e) { this._enableVelocity = e, e || (this._previousTransformationMatrices = {}), this.dispose(), this._createRenderTargets() }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "scene", { get: function() { return this._scene }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "ratio", { get: function() { return this._ratio }, enumerable: !0, configurable: !0 }), e.prototype.isReady = function(e, t) { var i = e.getMaterial(); if (i && i.disableDepthWrite) return !1; var n = [], r = [Oi.b.PositionKind, Oi.b.NormalKind], o = e.getMesh(); i && i.needAlphaTesting() && (n.push("#define ALPHATEST"), o.isVerticesDataPresent(Oi.b.UVKind) && (r.push(Oi.b.UVKind), n.push("#define UV1")), o.isVerticesDataPresent(Oi.b.UV2Kind) && (r.push(Oi.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(Oi.b.MatricesIndicesKind), r.push(Oi.b.MatricesWeightsKind), o.numBoneInfluencers > 4 && (r.push(Oi.b.MatricesIndicesExtraKind), r.push(Oi.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 s = n.join("\n"); return this._cachedDefines !== s && (this._cachedDefines = s, this._effect = this._scene.getEngine().createEffect("geometry", r, ["world", "mBones", "viewProjection", "diffuseMatrix", "view", "previousWorld", "previousViewProjection", "mPreviousBones"], ["diffuseSampler"], s, 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: !0, configurable: !0 }), 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 ds("gBuffer", { width: t.getRenderWidth() * this._ratio, height: t.getRenderHeight() * this._ratio }, i, this._scene, { generateMipMaps: !1, generateDepthTexture: !0, defaultType: _.a.TEXTURETYPE_FLOAT }), this.isSupported) { this._multiRenderTarget.wrapU = ke.a.CLAMP_ADDRESSMODE, this._multiRenderTarget.wrapV = ke.a.CLAMP_ADDRESSMODE, this._multiRenderTarget.refreshRate = 1, this._multiRenderTarget.renderParticles = !1, this._multiRenderTarget.renderList = null, this._multiRenderTarget.onClearObservable.add(function(e) { e.clear(new o.f(0, 0, 0, 1), !0, !0, !0) }); var n = function(t) { var i = t.getRenderingMesh(), n = e._scene, r = n.getEngine(), s = t.getMaterial(); if (s) { if (e._enableVelocity && !e._previousTransformationMatrices[i.uniqueId] && (e._previousTransformationMatrices[i.uniqueId] = { world: o.j.Identity(), viewProjection: n.getTransformMatrix() }, i.skeleton)) { var a = i.skeleton.getTransformMatrices(i); e._previousBonesTransformationMatrices[i.uniqueId] = e._copyBonesTransformationMatrices(a, new Float32Array(a.length)) } r.setState(s.backFaceCulling, 0, !1, n.useRightHandedSystem); var c = i._getInstancesRenderList(t._id); if (!c.mustReturn) { var l = r.getCaps().instancedArrays && null !== c.visibleInstances[t._id]; if (e.isReady(t, l)) { if (r.enableEffect(e._effect), i._bind(t, e._effect, so.a.TriangleFillMode), e._effect.setMatrix("viewProjection", n.getTransformMatrix()), e._effect.setMatrix("view", n.getViewMatrix()), s && s.needAlphaTesting()) { var u = s.getAlphaTestTexture(); u && (e._effect.setTexture("diffuseSampler", u), e._effect.setMatrix("diffuseMatrix", u.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, so.a.TriangleFillMode, c, l, 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 s; if (o.length) { for (t.setColorWrite(!1), s = 0; s < o.length; s++) n(o.data[s]); t.setColorWrite(!0) } for (s = 0; s < e.length; s++) n(e.data[s]); for (s = 0; s < i.length; s++) n(i.data[s]) } } }, 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 be.a.WarnImport("GeometryBufferRendererSceneComponent") }, e }(); Object.defineProperty(W.a.prototype, "geometryBufferRenderer", { get: function() { this._geometryBufferRenderer }, set: function(e) { e && e.isSupported && (this._geometryBufferRenderer = e) }, enumerable: !0, configurable: !0 }), W.a.prototype.enableGeometryBufferRenderer = function(e) { return void 0 === e && (e = 1), this._geometryBufferRenderer ? this._geometryBufferRenderer : (this._geometryBufferRenderer = new Ic(this, e), this._geometryBufferRenderer.isSupported || (this._geometryBufferRenderer = null), this._geometryBufferRenderer) }, W.a.prototype.disableGeometryBufferRenderer = function() { this._geometryBufferRenderer && (this._geometryBufferRenderer.dispose(), this._geometryBufferRenderer = null) }; var Dc = function() { function e(e) { this.name = Ae.a.NAME_GEOMETRYBUFFERRENDERER, this.scene = e } return e.prototype.register = function() { this.scene._gatherRenderTargetsStage.registerStep(Ae.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 }(); Ic._SceneComponentInitialization = function(e) { var t = e._getComponent(Ae.a.NAME_GEOMETRYBUFFERRENDERER); t || (t = new Dc(e), e._addComponent(t)) }; var Lc = "\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"; zt.a.ShadersStore.motionBlurPixelShader = Lc; var wc = function(e) { function t(t, i, n, r, s, a, c, l, u) { void 0 === l && (l = _.a.TEXTURETYPE_UNSIGNED_INT), void 0 === u && (u = !1); var h = e.call(this, t, "motionBlur", ["motionStrength", "motionScale", "screenSize"], ["velocitySampler"], n, r, s, a, c, "#define GEOMETRY_SUPPORTED\n#define SAMPLES 64.0", l, void 0, null, u) || this; return h.motionStrength = 1, h._motionBlurSamples = 32, h._geometryBufferRenderer = i.enableGeometryBufferRenderer(), h._geometryBufferRenderer ? (h._geometryBufferRenderer.enableVelocity = !0, h.onApply = function(e) { if (e.setVector2("screenSize", new o.w(h.width, h.height)), e.setFloat("motionScale", i.getAnimationRatio()), e.setFloat("motionStrength", h.motionStrength), h._geometryBufferRenderer) { var t = h._geometryBufferRenderer.getTextureIndex(Ic.VELOCITY_TEXTURE_TYPE); e.setTexture("velocitySampler", h._geometryBufferRenderer.getGBuffer().textures[t]) } }) : (p.a.Warn("Multiple Render Target support needed to compute object based motion blur"), h.updateEffect()), h } return l.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: !0, configurable: !0 }), 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 }(Ht), Fc = "\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}"; zt.a.ShadersStore.refractionPixelShader = Fc; var Nc = function(e) { function t(t, i, n, r, o, s, a, c, l, u) { var h = e.call(this, t, "refraction", ["baseColor", "depth", "colorLevel"], ["refractionSampler"], s, a, c, l, u) || this; return h.color = n, h.depth = r, h.colorLevel = o, h._ownRefractionTexture = !0, h.onActivateObservable.add(function(e) { h._refTexture = h._refTexture || new ke.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 l.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 = !1 }, enumerable: !0, configurable: !0 }), t.prototype.dispose = function(t) { this._refTexture && this._ownRefractionTexture && (this._refTexture.dispose(), this._refTexture = null), e.prototype.dispose.call(this, t) }, t }(Ht), Bc = "\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}"; zt.a.ShadersStore.sharpenPixelShader = Bc; var Uc = function(e) { function t(t, i, n, r, o, s, a, c) { void 0 === a && (a = _.a.TEXTURETYPE_UNSIGNED_INT), void 0 === c && (c = !1); var l = e.call(this, t, "sharpen", ["sharpnessAmounts", "screenSize"], null, i, n, r, o, s, null, a, void 0, null, c) || this; return l.colorAmount = 1, l.edgeAmount = .3, l.onApply = function(e) { e.setFloat2("screenSize", l.width, l.height), e.setFloat2("sharpnessAmounts", l.edgeAmount, l.colorAmount) }, l } return l.d(t, e), t }(Ht), Vc = 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: !0, configurable: !0 }), 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 !1; return !0 }, enumerable: !0, configurable: !0 }), 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(ye.h.MakeArray(t || this._cameras)) }, e.prototype._disableEffect = function(e, t) { var i = this._renderEffects[e]; i && i._disable(ye.h.MakeArray(t || this._cameras)) }, e.prototype._attachCameras = function(e, t) { var i = ye.h.MakeArray(e || this._cameras); if (i) { var n, r = []; for (n = 0; n < i.length; n++) { var o = i[n], s = o.name; - 1 === this._cameras.indexOf(o) ? this._cameras[s] = o : t && r.push(n) } for (n = 0; n < r.length; n++) e.splice(r[n], 1); for (var a in this._renderEffects) this._renderEffects.hasOwnProperty(a) && this._renderEffects[a]._attachCameras(i) } }, e.prototype._detachCameras = function(e) { var t = ye.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 !1; if (t.length > 0) { var i = this._renderEffects[t[0]].getPostProcesses(); i && (i[0].samples = e) } return !0 }, e.prototype.dispose = function() {}, l.c([Object(L.c)()], e.prototype, "_name", void 0), e }(), Gc = 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: !0, configurable: !0 }), e.prototype.addPipeline = function(e) { this._renderPipelines[e._name] = e }, e.prototype.attachCamerasToRenderPipeline = function(e, t, i) { void 0 === i && (i = !1); 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) { if (this._renderPipelines.hasOwnProperty(e)) this._renderPipelines[e]._rebuild() } }, e.prototype.dispose = function() { for (var e in this._renderPipelines) { if (this._renderPipelines.hasOwnProperty(e)) this._renderPipelines[e].dispose() } }, e }(); Object.defineProperty(W.a.prototype, "postProcessRenderPipelineManager", { get: function() { if (!this._postProcessRenderPipelineManager) { var e = this._getComponent(Ae.a.NAME_POSTPROCESSRENDERPIPELINEMANAGER); e || (e = new kc(this), this._addComponent(e)), this._postProcessRenderPipelineManager = new Gc } return this._postProcessRenderPipelineManager }, enumerable: !0, configurable: !0 }); var kc = function() { function e(e) { this.name = Ae.a.NAME_POSTPROCESSRENDERPIPELINEMANAGER, this.scene = e } return e.prototype.register = function() { this.scene._gatherRenderTargetsStage.registerStep(Ae.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 }(), zc = function(e) { function t(t, i, n, r, o) { void 0 === t && (t = ""), void 0 === i && (i = !0), void 0 === n && (n = P.a.LastCreatedScene), void 0 === o && (o = !0); var s = e.call(this, n.getEngine(), t) || this; s._camerasToBeAttached = [], s.SharpenPostProcessId = "SharpenPostProcessEffect", s.ImageProcessingPostProcessId = "ImageProcessingPostProcessEffect", s.FxaaPostProcessId = "FxaaPostProcessEffect", s.ChromaticAberrationPostProcessId = "ChromaticAberrationPostProcessEffect", s.GrainPostProcessId = "GrainPostProcessEffect", s._glowLayer = null, s.animations = [], s._imageProcessingConfigurationObserver = null, s._sharpenEnabled = !1, s._bloomEnabled = !1, s._depthOfFieldEnabled = !1, s._depthOfFieldBlurLevel = pc.Low, s._fxaaEnabled = !1, s._imageProcessingEnabled = !0, s._bloomScale = .5, s._chromaticAberrationEnabled = !1, s._grainEnabled = !1, s._buildAllowed = !0, s._resizeObserver = null, s._hardwareScaleLevel = 1, s._bloomKernel = 64, s._bloomWeight = .15, s._bloomThreshold = .9, s._samples = 1, s._hasCleared = !1, s._prevPostProcess = null, s._prevPrevPostProcess = null, s._depthOfFieldSceneObserver = null, s._cameras = r || n.cameras, s._cameras = s._cameras.slice(), s._camerasToBeAttached = s._cameras.slice(), s._buildAllowed = o, s._scene = n; var a = s._scene.getEngine().getCaps(); s._hdr = i && (a.textureHalfFloatRender || a.textureFloatRender), s._hdr ? a.textureHalfFloatRender ? s._defaultPipelineTextureType = _.a.TEXTURETYPE_HALF_FLOAT : a.textureFloatRender && (s._defaultPipelineTextureType = _.a.TEXTURETYPE_FLOAT) : s._defaultPipelineTextureType = _.a.TEXTURETYPE_UNSIGNED_INT, n.postProcessRenderPipelineManager.addPipeline(s); var c = s._scene.getEngine(); return s.sharpen = new Uc("sharpen", 1, null, ke.a.BILINEAR_SAMPLINGMODE, c, !1, s._defaultPipelineTextureType, !0), s._sharpenEffect = new Ja(c, s.SharpenPostProcessId, function() { return s.sharpen }, !0), s.depthOfField = new mc(s._scene, null, s._depthOfFieldBlurLevel, s._defaultPipelineTextureType, !0), s.bloom = new nc(s._scene, s._bloomScale, s._bloomWeight, s.bloomKernel, s._defaultPipelineTextureType, !0), s.chromaticAberration = new oc("ChromaticAberration", c.getRenderWidth(), c.getRenderHeight(), 1, null, ke.a.BILINEAR_SAMPLINGMODE, c, !1, s._defaultPipelineTextureType, !0), s._chromaticAberrationEffect = new Ja(c, s.ChromaticAberrationPostProcessId, function() { return s.chromaticAberration }, !0), s.grain = new Pc("Grain", 1, null, ke.a.BILINEAR_SAMPLINGMODE, c, !1, s._defaultPipelineTextureType, !0), s._grainEffect = new Ja(c, s.GrainPostProcessId, function() { return s.grain }, !0), s._resizeObserver = c.onResizeObservable.add(function() { s._hardwareScaleLevel = c.getHardwareScalingLevel(), s.bloomKernel = s.bloomKernel }), s._imageProcessingConfigurationObserver = s._scene.imageProcessingConfiguration.onUpdateParameters.add(function() { s.bloom._downscale._exposure = s._scene.imageProcessingConfiguration.exposure }), s._buildPipeline(), s } return l.d(t, e), Object.defineProperty(t.prototype, "scene", { get: function() { return this._scene }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "sharpenEnabled", { get: function() { return this._sharpenEnabled }, set: function(e) { this._sharpenEnabled !== e && (this._sharpenEnabled = e, this._buildPipeline()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "bloomKernel", { get: function() { return this._bloomKernel }, set: function(e) { this._bloomKernel = e, this.bloom.kernel = e / this._hardwareScaleLevel }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "bloomWeight", { get: function() { return this._bloomWeight }, set: function(e) { this._bloomWeight !== e && (this.bloom.weight = e, this._bloomWeight = e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "bloomThreshold", { get: function() { return this._bloomThreshold }, set: function(e) { this._bloomThreshold !== e && (this.bloom.threshold = e, this._bloomThreshold = e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "bloomScale", { get: function() { return this._bloomScale }, set: function(e) { this._bloomScale !== e && (this._bloomScale = e, this._rebuildBloom(), this._buildPipeline()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "bloomEnabled", { get: function() { return this._bloomEnabled }, set: function(e) { this._bloomEnabled !== e && (this._bloomEnabled = e, this._buildPipeline()) }, enumerable: !0, configurable: !0 }), t.prototype._rebuildBloom = function() { var e = this.bloom; this.bloom = new nc(this._scene, this.bloomScale, this._bloomWeight, this.bloomKernel, this._defaultPipelineTextureType, !1), 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 }, set: function(e) { this._depthOfFieldEnabled !== e && (this._depthOfFieldEnabled = e, this._buildPipeline()) }, enumerable: !0, configurable: !0 }), 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 mc(this._scene, null, this._depthOfFieldBlurLevel, this._defaultPipelineTextureType, !1), 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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "fxaaEnabled", { get: function() { return this._fxaaEnabled }, set: function(e) { this._fxaaEnabled !== e && (this._fxaaEnabled = e, this._buildPipeline()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "samples", { get: function() { return this._samples }, set: function(e) { this._samples !== e && (this._samples = e, this._buildPipeline()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "imageProcessingEnabled", { get: function() { return this._imageProcessingEnabled }, set: function(e) { this._imageProcessingEnabled !== e && (this._imageProcessingEnabled = e, this._buildPipeline()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "glowLayerEnabled", { get: function() { return null != this._glowLayer }, set: function(e) { e && !this._glowLayer ? this._glowLayer = new po("", this._scene) : !e && this._glowLayer && (this._glowLayer.dispose(), this._glowLayer = null) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "glowLayer", { get: function() { return this._glowLayer }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "chromaticAberrationEnabled", { get: function() { return this._chromaticAberrationEnabled }, set: function(e) { this._chromaticAberrationEnabled !== e && (this._chromaticAberrationEnabled = e, this._buildPipeline()) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "grainEnabled", { get: function() { return this._grainEnabled }, set: function(e) { this._grainEnabled !== e && (this._grainEnabled = e, this._buildPipeline()) }, enumerable: !0, configurable: !0 }), t.prototype.getClassName = function() { return "DefaultRenderingPipeline" }, t.prototype.prepare = function() { var e = this._buildAllowed; this._buildAllowed = !0, this._buildPipeline(), this._buildAllowed = e }, t.prototype._setAutoClearAndTextureSharing = function(e, t) { void 0 === t && (t = !1), this._hasCleared ? e.autoClear = !1 : (e.autoClear = !0, this._scene.autoClear = !1, this._hasCleared = !0), 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 = !0; 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 = !1, 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 = !0 } 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], !0) } 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], !0)), this._imageProcessingEnabled && (this.imageProcessing = new Ci("imageProcessing", 1, null, ke.a.BILINEAR_SAMPLINGMODE, t, !1, this._defaultPipelineTextureType), this._hdr ? (this.addEffect(new Ja(t, this.ImageProcessingPostProcessId, function() { return e.imageProcessing }, !0)), this._setAutoClearAndTextureSharing(this.imageProcessing)) : this._scene.imageProcessingConfiguration.applyByPostProcess = !1), 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.addEffect(this._grainEffect), this._setAutoClearAndTextureSharing(this.grain)), this.chromaticAberrationEnabled && (this.chromaticAberration.isReady() || this.chromaticAberration.updateEffect(), this.addEffect(this._chromaticAberrationEffect), this._setAutoClearAndTextureSharing(this.chromaticAberration)), this.fxaaEnabled && (this.fxaa = new xc("fxaa", 1, null, ke.a.BILINEAR_SAMPLINGMODE, t, !1, this._defaultPipelineTextureType), this.addEffect(new Ja(t, this.FxaaPostProcessId, function() { return e.fxaa }, !0)), this._setAutoClearAndTextureSharing(this.fxaa, !0)), null !== this._cameras && this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras), !this._enableMSAAOnFirstPostProcess(this.samples) && this.samples > 1 && p.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 = !1); 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.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(!0), this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras), this._scene.autoClear = !0, 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 = L.a.Serialize(this); return e.customType = "DefaultRenderingPipeline", e }, t.Parse = function(e, i, n) { return L.a.Parse(function() { return new t(e._name, e._name._hdr, i) }, e, i, n) }, l.c([Object(L.c)()], t.prototype, "sharpenEnabled", null), l.c([Object(L.c)()], t.prototype, "bloomKernel", null), l.c([Object(L.c)()], t.prototype, "_bloomWeight", void 0), l.c([Object(L.c)()], t.prototype, "_bloomThreshold", void 0), l.c([Object(L.c)()], t.prototype, "_hdr", void 0), l.c([Object(L.c)()], t.prototype, "bloomWeight", null), l.c([Object(L.c)()], t.prototype, "bloomThreshold", null), l.c([Object(L.c)()], t.prototype, "bloomScale", null), l.c([Object(L.c)()], t.prototype, "bloomEnabled", null), l.c([Object(L.c)()], t.prototype, "depthOfFieldEnabled", null), l.c([Object(L.c)()], t.prototype, "depthOfFieldBlurLevel", null), l.c([Object(L.c)()], t.prototype, "fxaaEnabled", null), l.c([Object(L.c)()], t.prototype, "samples", null), l.c([Object(L.c)()], t.prototype, "imageProcessingEnabled", null), l.c([Object(L.c)()], t.prototype, "glowLayerEnabled", null), l.c([Object(L.c)()], t.prototype, "chromaticAberrationEnabled", null), l.c([Object(L.c)()], t.prototype, "grainEnabled", null), t }(Vc); s.a.RegisteredTypes["BABYLON.DefaultRenderingPipeline"] = zc; var jc = "\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}"; zt.a.ShadersStore.lensHighlightsPixelShader = jc; var Hc = "\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"; zt.a.ShadersStore.depthOfFieldPixelShader = Hc; var Wc = function(e) { function t(t, i, n, r, o) { void 0 === r && (r = 1); var s = e.call(this, n.getEngine(), t) || this; return s.LensChromaticAberrationEffect = "LensChromaticAberrationEffect", s.HighlightsEnhancingEffect = "HighlightsEnhancingEffect", s.LensDepthOfFieldEffect = "LensDepthOfFieldEffect", s._pentagonBokehIsEnabled = !1, s._scene = n, s._depthTexture = n.enableDepthRenderer().getDepthMap(), i.grain_texture ? s._grainTexture = i.grain_texture : s._createGrainTexture(), s._edgeBlur = i.edge_blur ? i.edge_blur : 0, s._grainAmount = i.grain_amount ? i.grain_amount : 0, s._chromaticAberration = i.chromatic_aberration ? i.chromatic_aberration : 0, s._distortion = i.distortion ? i.distortion : 0, s._highlightsGain = void 0 !== i.dof_gain ? i.dof_gain : -1, s._highlightsThreshold = i.dof_threshold ? i.dof_threshold : 1, s._dofDistance = void 0 !== i.dof_focus_distance ? i.dof_focus_distance : -1, s._dofAperture = i.dof_aperture ? i.dof_aperture : 1, s._dofDarken = i.dof_darken ? i.dof_darken : 0, s._dofPentagon = void 0 === i.dof_pentagon || i.dof_pentagon, s._blurNoise = void 0 === i.blur_noise || i.blur_noise, s._createChromaticAberrationPostProcess(r), s._createHighlightsPostProcess(r), s._createDepthOfFieldPostProcess(r / 4), s.addEffect(new Ja(n.getEngine(), s.LensChromaticAberrationEffect, function() { return s._chromaticAberrationPostProcess }, !0)), s.addEffect(new Ja(n.getEngine(), s.HighlightsEnhancingEffect, function() { return s._highlightsPostProcess }, !0)), s.addEffect(new Ja(n.getEngine(), s.LensDepthOfFieldEffect, function() { return s._depthOfFieldPostProcess }, !0)), -1 === s._highlightsGain && s._disableEffect(s.HighlightsEnhancingEffect, null), n.postProcessRenderPipelineManager.addPipeline(s), o && n.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(t, o), s } return l.d(t, e), t.prototype.getClassName = function() { return "LensRenderingPipeline" }, Object.defineProperty(t.prototype, "scene", { get: function() { return this._scene }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "edgeBlur", { get: function() { return this._edgeBlur }, set: function(e) { this.setEdgeBlur(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "grainAmount", { get: function() { return this._grainAmount }, set: function(e) { this.setGrainAmount(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "chromaticAberration", { get: function() { return this._chromaticAberration }, set: function(e) { this.setChromaticAberration(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "dofAperture", { get: function() { return this._dofAperture }, set: function(e) { this.setAperture(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "edgeDistortion", { get: function() { return this._distortion }, set: function(e) { this.setEdgeDistortion(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "dofDistortion", { get: function() { return this._dofDistance }, set: function(e) { this.setFocusDistance(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "darkenOutOfFocus", { get: function() { return this._dofDarken }, set: function(e) { this.setDarkenOutOfFocus(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "blurNoise", { get: function() { return this._blurNoise }, set: function(e) { this._blurNoise = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "pentagonBokeh", { get: function() { return this._pentagonBokehIsEnabled }, set: function(e) { e ? this.enablePentagonBokeh() : this.disablePentagonBokeh() }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "highlightsGain", { get: function() { return this._highlightsGain }, set: function(e) { this.setHighlightsGain(e) }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "highlightsThreshold", { get: function() { return this._highlightsThreshold }, set: function(e) { this.setHighlightsThreshold(e) }, enumerable: !0, configurable: !0 }), 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 = !0 }, t.prototype.disablePentagonBokeh = function() { this._pentagonBokehIsEnabled = !1, this._highlightsPostProcess.updateEffect() }, t.prototype.enableNoiseBlur = function() { this._blurNoise = !0 }, t.prototype.disableNoiseBlur = function() { this._blurNoise = !1 }, 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 = !1), 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 Ht("LensChromaticAberration", "chromaticAberration", ["chromatic_aberration", "screen_width", "screen_height", "direction", "radialIntensity", "centerPosition"], [], e, null, ke.a.TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1), 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 Ht("LensHighlights", "lensHighlights", ["gain", "threshold", "screen_width", "screen_height"], [], e, null, ke.a.TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, 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 Ht("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, ke.a.TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1), 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 Pi("LensNoiseTexture", 512, this._scene, !1, ke.a.BILINEAR_SAMPLINGMODE), this._grainTexture.wrapU = ke.a.WRAP_ADDRESSMODE, this._grainTexture.wrapV = ke.a.WRAP_ADDRESSMODE; for (var e, t, i, n = this._grainTexture.getContext(), r = 0; r < 512; r++) for (var o = 0; o < 512; o++) e = Math.floor(255 * (t = .42, i = .58, Math.random() * (i - t) + t)), n.fillStyle = "rgb(" + e + ", " + e + ", " + e + ")", n.fillRect(r, o, 1, 1); this._grainTexture.update(!1) }, t }(Vc), Xc = "\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; 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 Ht("BlurV", "ssao2", ["outSize", "samplerOffsets", "near", "far", "radius"], ["depthSampler"], t, null, ke.a.TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, "#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 = !1)) }, this._blurHPostProcess.samples = this.textureSamples, this._blurVPostProcess.samples = this.textureSamples }, t.prototype._rebuild = function() { this._firstUpdate = !0, 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 o.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 Ht("ssao2", "ssao2", ["sampleSphere", "samplesFactor", "randTextureTiles", "totalStrength", "radius", "base", "range", "projection", "near", "far", "texelSize", "xViewport", "yViewport", "maxZ", "minZAspect"], ["randomSampler", "normalSampler"], e, null, ke.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1, "#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.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, !0)), 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 Ht("ssaoCombine", "ssaoCombine", [], ["originalColor", "viewport"], e, null, ke.a.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), !1), this._ssaoCombinePostProcess.onApply = function(e) { var i = t._scene.activeCamera.viewport; e.setVector4("viewport", o.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 Pi("SSAORandomTexture", 128, this._scene, !1, ke.a.TRILINEAR_SAMPLINGMODE), this._randomTexture.wrapU = ke.a.WRAP_ADDRESSMODE, this._randomTexture.wrapV = ke.a.WRAP_ADDRESSMODE; for (var e = this._randomTexture.getContext(), t = function(e, t) { return Math.random() * (t - e) + e }, i = o.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(!1) }, t.prototype.serialize = function() { var e = L.a.Serialize(this); return e.customType = "SSAO2RenderingPipeline", e }, t.Parse = function(e, i, n) { return L.a.Parse(function() { return new t(e._name, i, e._ratio) }, e, i, n) }, l.c([Object(L.c)()], t.prototype, "totalStrength", void 0), l.c([Object(L.c)()], t.prototype, "maxZ", void 0), l.c([Object(L.c)()], t.prototype, "minZAspect", void 0), l.c([Object(L.c)("samples")], t.prototype, "_samples", void 0), l.c([Object(L.c)("textureSamples")], t.prototype, "_textureSamples", void 0), l.c([Object(L.c)()], t.prototype, "_ratio", void 0), l.c([Object(L.c)("expensiveBlur")], t.prototype, "_expensiveBlur", void 0), l.c([Object(L.c)()], t.prototype, "radius", void 0), l.c([Object(L.c)()], t.prototype, "base", void 0), t }(Vc); s.a.RegisteredTypes["BABYLON.SSAO2RenderingPipeline"] = Kc; var Qc = "\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; i 1 && p.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 Ht("HDRDownSampleX4", "standard", ["dsOffsets"], [], t, null, ke.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#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, s = -2; s < 2; s++) for (var a = -2; a < 2; a++) n[t] = (s + .5) * (1 / r), n[t + 1] = (a + .5) * (1 / o), t += 2; e.setArray2("dsOffsets", n) }, this.addEffect(new Ja(e.getEngine(), "HDRDownSampleX4", function() { return i.downSampleX4PostProcess }, !0)) }, t.prototype._createBrightPassPostProcess = function(e, t) { var i = this, n = new Array(8); this.brightPassPostProcess = new Ht("HDRBrightPass", "standard", ["dsOffsets", "brightThreshold"], [], t, null, ke.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#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 Ja(e.getEngine(), "HDRBrightPass", function() { return i.brightPassPostProcess }, !0)) }, t.prototype._createBlurPostProcesses = function(e, t, i, n) { var r = this; void 0 === n && (n = "blurWidth"); var s = e.getEngine(), a = new $n("HDRBlurH_" + i, new o.w(1, 0), this[n], t, null, ke.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, _.a.TEXTURETYPE_UNSIGNED_INT), c = new $n("HDRBlurV_" + i, new o.w(0, 1), this[n], t, null, ke.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, _.a.TEXTURETYPE_UNSIGNED_INT); a.onActivateObservable.add(function() { var e = a.width / s.getRenderWidth(); a.kernel = r[n] * e }), c.onActivateObservable.add(function() { var e = c.height / s.getRenderHeight(); c.kernel = r.horizontalBlur ? 64 * e : r[n] * e }), this.addEffect(new Ja(e.getEngine(), "HDRBlurH" + i, function() { return a }, !0)), this.addEffect(new Ja(e.getEngine(), "HDRBlurV" + i, function() { return c }, !0)), this.blurHPostProcesses.push(a), this.blurVPostProcesses.push(c) }, t.prototype._createTextureAdderPostProcess = function(e, t) { var i = this; this.textureAdderPostProcess = new Ht("HDRTextureAdder", "standard", ["exposure"], ["otherSampler", "lensSampler"], t, null, ke.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#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 Ja(e.getEngine(), "HDRTextureAdder", function() { return i.textureAdderPostProcess }, !0)) }, t.prototype._createVolumetricLightPostProcess = function(e, t) { var i = this, n = e.enableGeometryBufferRenderer(); n.enablePosition = !0; var r = n.getGBuffer(); this.volumetricLightPostProcess = new Ht("HDRVLS", "standard", ["shadowViewProjection", "cameraPosition", "sunDirection", "sunColor", "scatteringCoefficient", "scatteringPower", "depthValues"], ["shadowMapSampler", "positionSampler"], t / 8, null, ke.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#define VLS\n#define NB_STEPS " + this._volumetricLightStepsCount.toFixed(1)); var s = o.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), s.x = i.sourceLight.getDepthMinZ(i._scene.activeCamera), s.y = i.sourceLight.getDepthMaxZ(i._scene.activeCamera), e.setVector2("depthValues", s) } }, this.addEffect(new Ja(e.getEngine(), "HDRVLS", function() { return i.volumetricLightPostProcess }, !0)), this._createBlurPostProcesses(e, t / 4, 0, "volumetricLightBlurScale"), this.volumetricLightMergePostProces = new Ht("HDRVLSMerge", "standard", [], ["originalSampler"], t, null, ke.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#define VLSMERGE"), this.volumetricLightMergePostProces.onApply = function(e) { e.setTextureFromPostProcess("originalSampler", i._bloomEnabled ? i.textureAdderFinalPostProcess : i.originalPostProcess), i._currentDepthOfFieldSource = i.volumetricLightFinalPostProcess }, this.addEffect(new Ja(e.getEngine(), "HDRVLSMerge", function() { return i.volumetricLightMergePostProces }, !0)) }, t.prototype._createLuminancePostProcesses = function(e, i) { var n = this, r = Math.pow(3, t.LuminanceSteps); this.luminancePostProcess = new Ht("HDRLuminance", "standard", ["lumOffsets"], [], { width: r, height: r }, null, ke.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#define LUMINANCE", i); var s = []; this.luminancePostProcess.onApply = function(e) { var t = 1 / n.luminancePostProcess.width, i = 1 / n.luminancePostProcess.height; s[0] = -.5 * t, s[1] = .5 * i, s[2] = .5 * t, s[3] = .5 * i, s[4] = -.5 * t, s[5] = -.5 * i, s[6] = .5 * t, s[7] = -.5 * i, e.setArray2("lumOffsets", s) }, this.addEffect(new Ja(e.getEngine(), "HDRLuminance", function() { return n.luminancePostProcess }, !0)); for (var a = t.LuminanceSteps - 1; a >= 0; a--) { r = Math.pow(3, a); var c = "#define LUMINANCE_DOWN_SAMPLE\n"; 0 === a && (c += "#define FINAL_DOWN_SAMPLER"); var l = new Ht("HDRLuminanceDownSample" + a, "standard", ["dsOffsets", "halfDestPixelSize"], [], { width: r, height: r }, null, ke.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, c, i); this.luminanceDownSamplePostProcesses.push(l) } var u = this.luminancePostProcess; this.luminanceDownSamplePostProcesses.forEach(function(t, i) { var r = new Array(18); t.onApply = function(e) { if (u) { for (var o = 0, s = -1; s < 2; s++) for (var a = -1; a < 2; a++) r[o] = s / u.width, r[o + 1] = a / u.height, o += 2; e.setArray2("dsOffsets", r), e.setFloat("halfDestPixelSize", .5 / u.width), u = 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 o.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 Ja(e.getEngine(), "HDRLuminanceDownSample" + i, function() { return t }, !0)) }) }, t.prototype._createHdrPostProcess = function(e, t) { var i = this, n = ["#define HDR"]; this._hdrAutoExposure && n.push("#define AUTO_EXPOSURE"), this.hdrPostProcess = new Ht("HDR", "standard", ["averageLuminance"], ["textureAdderSampler"], t, null, ke.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, n.join("\n"), _.a.TEXTURETYPE_UNSIGNED_INT); var r = 1, o = 0, s = 0; this.hdrPostProcess.onApply = function(t) { if (t.setTextureFromPostProcess("textureAdderSampler", i._currentDepthOfFieldSource), o += e.getEngine().getDeltaTime(), r < 0) r = i._hdrCurrentLuminance; else { var n = (s - 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 = D.a.Clamp(r, i.hdrMinimumLuminance, 1e20), t.setFloat("averageLuminance", r)), s = o, i._currentDepthOfFieldSource = i.hdrFinalPostProcess }, this.addEffect(new Ja(e.getEngine(), "HDR", function() { return i.hdrPostProcess }, !0)) }, t.prototype._createLensFlarePostProcess = function(e, t) { var i = this; this.lensFlarePostProcess = new Ht("HDRLensFlare", "standard", ["strength", "ghostDispersal", "haloWidth", "resolution", "distortionStrength"], ["lensColorSampler"], t / 2, null, ke.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#define LENS_FLARE", _.a.TEXTURETYPE_UNSIGNED_INT), this.addEffect(new Ja(e.getEngine(), "HDRLensFlare", function() { return i.lensFlarePostProcess }, !0)), this._createBlurPostProcesses(e, t / 4, 2), this.lensFlareComposePostProcess = new Ht("HDRLensFlareCompose", "standard", ["lensStarMatrix"], ["otherSampler", "lensDirtSampler", "lensStarSampler"], t, null, ke.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#define LENS_FLARE_COMPOSE", _.a.TEXTURETYPE_UNSIGNED_INT), this.addEffect(new Ja(e.getEngine(), "HDRLensFlareCompose", function() { return i.lensFlareComposePostProcess }, !0)); var n = new o.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 = o.j.FromValues(2, 0, -1, 0, 0, 2, -1, 0, 0, 0, 1, 0, 0, 0, 0, 1), s = o.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), a = o.x.Dot(t.toVector3(), new o.x(1, 0, 0)) + o.x.Dot(n.toVector3(), new o.x(0, 0, 1)); a *= 4; var c = o.j.FromValues(.5 * Math.cos(a), -Math.sin(a), 0, 0, Math.sin(a), .5 * Math.cos(a), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), l = s.multiply(c).multiply(r); e.setMatrix("lensStarMatrix", l), i._currentDepthOfFieldSource = i.lensFlareFinalPostProcess } } }, t.prototype._createDepthOfFieldPostProcess = function(e, t) { var i = this; this.depthOfFieldPostProcess = new Ht("HDRDepthOfField", "standard", ["distance"], ["otherSampler", "depthSampler"], t, null, ke.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#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 Ja(e.getEngine(), "HDRDepthOfField", function() { return i.depthOfFieldPostProcess }, !0)) }, t.prototype._createMotionBlurPostProcess = function(e, t) { var i = this; this.motionBlurPostProcess = new Ht("HDRMotionBlur", "standard", ["inverseViewProjection", "prevViewProjection", "screenSize", "motionScale", "motionStrength"], ["depthSampler"], t, null, ke.a.BILINEAR_SAMPLINGMODE, e.getEngine(), !1, "#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES " + this.motionBlurSamples.toFixed(1), _.a.TEXTURETYPE_UNSIGNED_INT); var n = 0, r = o.j.Identity(), s = o.j.Identity(), a = o.j.Identity(), c = o.w.Zero(); this.motionBlurPostProcess.onApply = function(t) { (a = e.getProjectionMatrix().multiply(e.getViewMatrix())).invertToRef(s), t.setMatrix("inverseViewProjection", s), t.setMatrix("prevViewProjection", r), r = a, 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 Ja(e.getEngine(), "HDRMotionBlur", function() { return i.motionBlurPostProcess }, !0)) }, 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); 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); for (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 = L.a.Serialize(this); return this.sourceLight && (e.sourceLightId = this.sourceLight.id), e.customType = "StandardRenderingPipeline", e }, t.Parse = function(e, i, n) { var r = L.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, l.c([Object(L.c)()], t.prototype, "brightThreshold", void 0), l.c([Object(L.c)()], t.prototype, "blurWidth", void 0), l.c([Object(L.c)()], t.prototype, "horizontalBlur", void 0), l.c([Object(L.c)()], t.prototype, "exposure", null), l.c([Object(L.m)("lensTexture")], t.prototype, "lensTexture", void 0), l.c([Object(L.c)()], t.prototype, "volumetricLightCoefficient", void 0), l.c([Object(L.c)()], t.prototype, "volumetricLightPower", void 0), l.c([Object(L.c)()], t.prototype, "volumetricLightBlurScale", void 0), l.c([Object(L.c)()], t.prototype, "hdrMinimumLuminance", void 0), l.c([Object(L.c)()], t.prototype, "hdrDecreaseRate", void 0), l.c([Object(L.c)()], t.prototype, "hdrIncreaseRate", void 0), l.c([Object(L.c)()], t.prototype, "hdrAutoExposure", null), l.c([Object(L.m)("lensColorTexture")], t.prototype, "lensColorTexture", void 0), l.c([Object(L.c)()], t.prototype, "lensFlareStrength", void 0), l.c([Object(L.c)()], t.prototype, "lensFlareGhostDispersal", void 0), l.c([Object(L.c)()], t.prototype, "lensFlareHaloWidth", void 0), l.c([Object(L.c)()], t.prototype, "lensFlareDistortionStrength", void 0), l.c([Object(L.m)("lensStarTexture")], t.prototype, "lensStarTexture", void 0), l.c([Object(L.m)("lensFlareDirtTexture")], t.prototype, "lensFlareDirtTexture", void 0), l.c([Object(L.c)()], t.prototype, "depthOfFieldDistance", void 0), l.c([Object(L.c)()], t.prototype, "depthOfFieldBlurWidth", void 0), l.c([Object(L.c)()], t.prototype, "motionStrength", void 0), l.c([Object(L.c)()], t.prototype, "_ratio", void 0), l.c([Object(L.c)()], t.prototype, "BloomEnabled", null), l.c([Object(L.c)()], t.prototype, "DepthOfFieldEnabled", null), l.c([Object(L.c)()], t.prototype, "LensFlareEnabled", null), l.c([Object(L.c)()], t.prototype, "HDREnabled", null), l.c([Object(L.c)()], t.prototype, "VLSEnabled", null), l.c([Object(L.c)()], t.prototype, "MotionBlurEnabled", null), l.c([Object(L.c)()], t.prototype, "fxaaEnabled", null), l.c([Object(L.c)()], t.prototype, "volumetricLightStepsCount", null), l.c([Object(L.c)()], t.prototype, "motionBlurSamples", null), l.c([Object(L.c)()], t.prototype, "samples", null), t }(Vc); s.a.RegisteredTypes["BABYLON.StandardRenderingPipeline"] = Jc; var $c = "\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}"; zt.a.ShadersStore.tonemapPixelShader = $c; var el; ! function(e) { e[e.Hable = 0] = "Hable", e[e.Reinhard = 1] = "Reinhard", e[e.HejiDawson = 2] = "HejiDawson", e[e.Photographic = 3] = "Photographic" }(el || (el = {})); var tl = function(e) { function t(t, i, n, r, o, s, a) { void 0 === o && (o = _.a.TEXTURE_BILINEAR_SAMPLINGMODE), void 0 === a && (a = _.a.TEXTURETYPE_UNSIGNED_INT); var c = e.call(this, t, "tonemap", ["_ExposureAdjustment"], null, 1, r, o, s, !0, null, a) || this; c._operator = i, c.exposureAdjustment = n; var l = "#define "; return c._operator === el.Hable ? l += "HABLE_TONEMAPPING" : c._operator === el.Reinhard ? l += "REINHARD_TONEMAPPING" : c._operator === el.HejiDawson ? l += "OPTIMIZED_HEJIDAWSON_TONEMAPPING" : c._operator === el.Photographic && (l += "PHOTOGRAPHIC_TONEMAPPING"), c.updateEffect(l), c.onApply = function(e) { e.setFloat("_ExposureAdjustment", c.exposureAdjustment) }, c } return l.d(t, e), t }(Ht), il = "\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}"; zt.a.ShadersStore.depthVertexShader = il; var nl = "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 _i("volumetricLightScatteringMap", { width: n.getRenderWidth() * t, height: n.getRenderHeight() * t }, e, !1, !0, _.a.TEXTURETYPE_UNSIGNED_INT), this._volumetricLightScatteringRTT.wrapU = ke.a.CLAMP_ADDRESSMODE, this._volumetricLightScatteringRTT.wrapV = ke.a.CLAMP_ADDRESSMODE, this._volumetricLightScatteringRTT.renderList = null, this._volumetricLightScatteringRTT.renderParticles = !1, this._volumetricLightScatteringRTT.ignoreCameraViewport = !0; var r = this.getCamera(); r ? r.customRenderTargets.push(this._volumetricLightScatteringRTT) : e.customRenderTargets.push(this._volumetricLightScatteringRTT); var s, a = 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 s = t._getInstancesRenderList(e._id); if (!s.mustReturn) { var a = o.getCaps().instancedArrays && null !== s.visibleInstances[e._id]; if (i._isReady(e, a)) { var c = i._volumetricLightScatteringPass; if (t === i.mesh && (c = e.effect ? e.effect : n.getEffect()), o.enableEffect(c), t._bind(e, c, so.a.TriangleFillMode), t === i.mesh) n.bind(t.getWorldMatrix(), t); else { if (i._volumetricLightScatteringPass.setMatrix("viewProjection", r.getTransformMatrix()), n && n.needAlphaTesting()) { var l = n.getAlphaTestTexture(); i._volumetricLightScatteringPass.setTexture("diffuseSampler", l), l && i._volumetricLightScatteringPass.setMatrix("diffuseMatrix", l.getTextureMatrix()) } t.useBones && t.computeBonesUsingShaders && t.skeleton && i._volumetricLightScatteringPass.setMatrices("mBones", t.skeleton.getTransformMatrices(t)) } t._processRendering(e, i._volumetricLightScatteringPass, so.a.TriangleFillMode, s, a, function(e, t) { return c.setMatrix("world", t) }) } } } } }, c = new o.f(0, 0, 0, 1); this._volumetricLightScatteringRTT.onBeforeRenderObservable.add(function() { s = e.clearColor, e.clearColor = c }), this._volumetricLightScatteringRTT.onAfterRenderObservable.add(function() { e.clearColor = s }), this._volumetricLightScatteringRTT.customRenderFunction = function(t, i, n, r) { var o, s = e.getEngine(); if (r.length) { for (s.setColorWrite(!1), o = 0; o < r.length; o++) a(r.data[o]); s.setColorWrite(!0) } for (o = 0; o < t.length; o++) a(t.data[o]); for (o = 0; o < i.length; o++) a(i.data[o]); if (n.length) { for (o = 0; o < n.length; o++) { var c = n.data[o], l = c.getBoundingInfo(); l && e.activeCamera && (c._alphaIndex = c.getMesh().alphaIndex, c._distanceToCamera = l.boundingSphere.centerWorld.subtract(e.activeCamera.position).length()) } var u = n.data.slice(0, n.length); for (u.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 }), s.setAlphaMode(_.a.ALPHA_COMBINE), o = 0; o < u.length; o++) a(u[o]); s.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 = o.x.Project(t, o.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 = fe.a.CreatePlane(e, 1, t); i.billboardMode = Fe.a.BILLBOARDMODE_ALL; var n = new Ri.a(e + "Material", t); return n.emissiveColor = new o.e(1, 1, 1), i.material = n, i }, l.c([Object(L.o)()], t.prototype, "customMeshPosition", void 0), l.c([Object(L.c)()], t.prototype, "useCustomMeshPosition", void 0), l.c([Object(L.c)()], t.prototype, "invert", void 0), l.c([Object(L.k)()], t.prototype, "mesh", void 0), l.c([Object(L.c)()], t.prototype, "excludedMeshes", void 0), l.c([Object(L.c)()], t.prototype, "exposure", void 0), l.c([Object(L.c)()], t.prototype, "decay", void 0), l.c([Object(L.c)()], t.prototype, "weight", void 0), l.c([Object(L.c)()], t.prototype, "density", void 0), t }(Ht); i(126), i(127); Object.defineProperty(W.a.prototype, "forceShowBoundingBoxes", { get: function() { return this._forceShowBoundingBoxes || !1 }, set: function(e) { this._forceShowBoundingBoxes = e, e && this.getBoundingBoxRenderer() }, enumerable: !0, configurable: !0 }), W.a.prototype.getBoundingBoxRenderer = function() { return this._boundingBoxRenderer || (this._boundingBoxRenderer = new sl(this)), this._boundingBoxRenderer }, Object.defineProperty(Fe.a.prototype, "showBoundingBox", { get: function() { return this._showBoundingBox || !1 }, set: function(e) { this._showBoundingBox = e, e && this.getScene().getBoundingBoxRenderer() }, enumerable: !0, configurable: !0 }); var sl = function() { function e(e) { this.name = Ae.a.NAME_BOUNDINGBOXRENDERER, this.frontColor = new o.e(1, 1, 1), this.backColor = new o.e(.1, .1, .1), this.showBackLines = !0, this.renderList = new kt.a(32), this._vertexBuffers = {}, this.scene = e, e._addComponent(this) } return e.prototype.register = function() { this.scene._beforeEvaluateActiveMeshStage.registerStep(Ae.a.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER, this, this.reset), this.scene._activeMeshStage.registerStep(Ae.a.STEP_ACTIVEMESH_BOUNDINGBOXRENDERER, this, this._activeMesh), this.scene._evaluateSubMeshStage.registerStep(Ae.a.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER, this, this._evaluateSubMesh), this.scene._afterRenderingGroupDrawStage.registerStep(Ae.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)) } }, 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 as.a("colorShader", this.scene, "color", { attributes: [Oi.b.PositionKind], uniforms: ["world", "viewProjection", "color"] }); var e = this.scene.getEngine(), t = Mi.a.CreateBox({ size: 1 }); this._vertexBuffers[Oi.b.PositionKind] = new Oi.b(e, t.positions, Oi.b.PositionKind, !1), 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[Oi.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(!1), 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, s = n.maximum.subtract(r), a = r.add(s.scale(.5)), c = o.j.Scaling(s.x, s.y, s.z).multiply(o.j.Translation(a.x, a.y, a.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(so.a.LineListDrawMode, 0, 24)), t.setDepthFunctionToLess(), this.scene.resetCachedMaterial(), this._colorShader.setColor4("color", this.frontColor.toColor4()), this._colorShader.bind(c), t.drawElementsType(so.a.LineListDrawMode, 0, 24) } } this._colorShader.unbind(), t.setDepthFunctionToLessOrEqual(), t.setDepthWrite(!0) } }, e.prototype.renderOcclusionBoundingBox = function(e) { if (this._prepareRessources(), this._colorShader.isReady() && e._boundingInfo) { var t = this.scene.getEngine(); t.setDepthWrite(!1), t.setColorWrite(!1), this._colorShader._preBind(); var i = e._boundingInfo.boundingBox, n = i.minimum, r = i.maximum.subtract(n), s = n.add(r.scale(.5)), a = o.j.Scaling(r.x, r.y, r.z).multiply(o.j.Translation(s.x, s.y, s.z)).multiply(i.getWorldMatrix()); t.bindBuffers(this._vertexBuffers, this._indexBuffer, this._colorShader.getEffect()), t.setDepthFunctionToLess(), this.scene.resetCachedMaterial(), this._colorShader.bind(a), t.drawElementsType(so.a.LineListDrawMode, 0, 24), this._colorShader.unbind(), t.setDepthFunctionToLessOrEqual(), t.setDepthWrite(!0), t.setColorWrite(!0) } }, e.prototype.dispose = function() { if (this._colorShader) { this.renderList.dispose(), this._colorShader.dispose(); var e = this._vertexBuffers[Oi.b.PositionKind]; e && (e.dispose(), this._vertexBuffers[Oi.b.PositionKind] = null), this.scene.getEngine()._releaseBuffer(this._indexBuffer) } }, e }(), al = "#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}"; zt.a.ShadersStore.depthPixelShader = al; var cl = function() { function e(t, i, n) { var r = this; void 0 === i && (i = _.a.TEXTURETYPE_FLOAT), void 0 === n && (n = null), this.useOnlyInActiveCamera = !1, this._scene = t, e._SceneComponentInitialization(this._scene), this._camera = n; var s = t.getEngine(); this._depthMap = new _i("depthMap", { width: s.getRenderWidth(), height: s.getRenderHeight() }, this._scene, !1, !0, i), this._depthMap.wrapU = ke.a.CLAMP_ADDRESSMODE, this._depthMap.wrapV = ke.a.CLAMP_ADDRESSMODE, this._depthMap.refreshRate = 1, this._depthMap.renderParticles = !1, this._depthMap.renderList = null, this._depthMap.activeCamera = this._camera, this._depthMap.ignoreCameraViewport = !0, this._depthMap.useCameraPostProcesses = !1, this._depthMap.onClearObservable.add(function(e) { e.clear(new o.f(1, 1, 1, 1), !0, !0, !0) }); var a = function(e) { var t = e.getRenderingMesh(), i = r._scene, n = i.getEngine(), o = e.getMaterial(); if (o) { n.setState(o.backFaceCulling, 0, !1, i.useRightHandedSystem); var s = t._getInstancesRenderList(e._id); if (!s.mustReturn) { var a = n.getCaps().instancedArrays && null !== s.visibleInstances[e._id], c = r._camera || i.activeCamera; if (r.isReady(e, a) && c) { if (n.enableEffect(r._effect), t._bind(e, r._effect, so.a.TriangleFillMode), r._effect.setMatrix("viewProjection", i.getTransformMatrix()), r._effect.setFloat2("depthValues", c.minZ, c.minZ + c.maxZ), o && o.needAlphaTesting()) { var l = o.getAlphaTestTexture(); l && (r._effect.setTexture("diffuseSampler", l), r._effect.setMatrix("diffuseMatrix", l.getTextureMatrix())) } t.useBones && t.computeBonesUsingShaders && t.skeleton && r._effect.setMatrices("mBones", t.skeleton.getTransformMatrices(t)), t._processRendering(e, r._effect, so.a.TriangleFillMode, s, a, function(e, t) { return r._effect.setMatrix("world", t) }) } } } }; this._depthMap.customRenderFunction = function(e, t, i, n) { var r; if (n.length) { for (s.setColorWrite(!1), r = 0; r < n.length; r++) a(n.data[r]); s.setColorWrite(!0) } for (r = 0; r < e.length; r++) a(e.data[r]); for (r = 0; r < t.length; r++) a(t.data[r]) } } return e.prototype.isReady = function(e, t) { var i = e.getMaterial(); if (i.disableDepthWrite) return !1; var n = [], r = [Oi.b.PositionKind], o = e.getMesh(); i && i.needAlphaTesting() && i.getAlphaTestTexture() && (n.push("#define ALPHATEST"), o.isVerticesDataPresent(Oi.b.UVKind) && (r.push(Oi.b.UVKind), n.push("#define UV1")), o.isVerticesDataPresent(Oi.b.UV2Kind) && (r.push(Oi.b.UV2Kind), n.push("#define UV2"))), o.useBones && o.computeBonesUsingShaders ? (r.push(Oi.b.MatricesIndicesKind), r.push(Oi.b.MatricesWeightsKind), o.numBoneInfluencers > 4 && (r.push(Oi.b.MatricesIndicesExtraKind), r.push(Oi.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 s = n.join("\n"); return this._cachedDefines !== s && (this._cachedDefines = s, this._effect = this._scene.getEngine().createEffect("depth", r, ["world", "mBones", "viewProjection", "diffuseMatrix", "depthValues"], ["diffuseSampler"], s)), this._effect.isReady() }, e.prototype.getDepthMap = function() { return this._depthMap }, e.prototype.dispose = function() { this._depthMap.dispose() }, e._SceneComponentInitialization = function(e) { throw be.a.WarnImport("DepthRendererSceneComponent") }, e }(); W.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 cl(this, t, e) } return this._depthRenderer[e.id] }, W.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 ll = function() { function e(e) { this.name = Ae.a.NAME_DEPTHRENDERER, this.scene = e } return e.prototype.register = function() { this.scene._gatherRenderTargetsStage.registerStep(Ae.a.STEP_GATHERRENDERTARGETS_DEPTHRENDERER, this, this._gatherRenderTargets), this.scene._gatherActiveCameraRenderTargetsStage.registerStep(Ae.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 }(); cl._SceneComponentInitialization = function(e) { var t = e._getComponent(Ae.a.NAME_DEPTHRENDERER); t || (t = new ll(e), e._addComponent(t)) }; var ul = "uniform vec4 color;\nvoid main(void) {\ngl_FragColor=color;\n}"; zt.a.ShadersStore.linePixelShader = ul; var hl = "\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}"; zt.a.ShadersStore.lineVertexShader = hl; Fe.a.prototype.disableEdgesRendering = function() { return this._edgesRenderer && (this._edgesRenderer.dispose(), this._edgesRenderer = null), this }, Fe.a.prototype.enableEdgesRendering = function(e, t) { return void 0 === e && (e = .95), void 0 === t && (t = !1), this.disableEdgesRendering(), this._edgesRenderer = new fl(this, e, t), this }, Object.defineProperty(Fe.a.prototype, "edgesRenderer", { get: function() { return this._edgesRenderer }, enumerable: !0, configurable: !0 }), Vs.b.prototype.enableEdgesRendering = function(e, t) { return void 0 === e && (e = .95), void 0 === t && (t = !1), this.disableEdgesRendering(), this._edgesRenderer = new pl(this, e, t), this }, Vs.a.prototype.enableEdgesRendering = function(e, t) { return void 0 === e && (e = .95), void 0 === t && (t = !1), Vs.b.prototype.enableEdgesRendering.apply(this, arguments), this }; var dl = function() { return function() { this.edges = new Array, this.edgesConnectedCount = 0 } }(), fl = function() { function e(e, t, i, n) { var r = this; void 0 === t && (t = .95), void 0 === i && (i = !1), void 0 === n && (n = !0), this.edgesWidthScalerForOrthographic = 1e3, this.edgesWidthScalerForPerspective = 50, this._linesPositions = new Array, this._linesNormals = new Array, this._linesIndices = new Array, this._buffers = {}, this._checkVerticesInsteadOfIndices = !1, this.isEnabled = !0, 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 as.a("lineShader", this._source.getScene(), "line", { attributes: ["position", "normal"], uniforms: ["worldViewProjection", "color", "width", "aspectRatio"] }), this._lineShader.disableDepthWrite = !0, this._lineShader.backFaceCulling = !1) }, e.prototype._rebuild = function() { var e = this._buffers[Oi.b.PositionKind]; e && e._rebuild(), (e = this._buffers[Oi.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[Oi.b.PositionKind]; e && (e.dispose(), this._buffers[Oi.b.PositionKind] = null), (e = this._buffers[Oi.b.NormalKind]) && (e.dispose(), this._buffers[Oi.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) { var s; void 0 === t ? s = !0 : s = o.x.Dot(i[e], i[t]) < this._epsilon; s && 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(Oi.b.PositionKind), t = this._source.getIndices(); if (t && e) { var i, n, r = new Array, s = new Array; for (i = 0; i < t.length; i += 3) { n = new dl; var a = t[i], c = t[i + 1], l = t[i + 2]; n.p0 = new o.x(e[3 * a], e[3 * a + 1], e[3 * a + 2]), n.p1 = new o.x(e[3 * c], e[3 * c + 1], e[3 * c + 2]), n.p2 = new o.x(e[3 * l], e[3 * l + 1], e[3 * l + 2]); var u = o.x.Cross(n.p1.subtract(n.p0), n.p2.subtract(n.p1)); u.normalize(), s.push(u), r.push(n) } for (i = 0; i < r.length; i++) { n = r[i]; for (var h = i + 1; h < r.length; h++) { var d = r[h]; if (3 === n.edgesConnectedCount) break; if (3 !== d.edgesConnectedCount) for (var f = t[3 * h], p = t[3 * h + 1], _ = t[3 * h + 2], g = 0; g < 3; g++) { var m = 0; if (void 0 === n.edges[g]) { switch (g) { case 0: m = this._checkVerticesInsteadOfIndices ? this._processEdgeForAdjacenciesWithVertices(n.p0, n.p1, d.p0, d.p1, d.p2) : this._processEdgeForAdjacencies(t[3 * i], t[3 * i + 1], f, p, _); break; case 1: m = this._checkVerticesInsteadOfIndices ? this._processEdgeForAdjacenciesWithVertices(n.p1, n.p2, d.p0, d.p1, d.p2) : this._processEdgeForAdjacencies(t[3 * i + 1], t[3 * i + 2], f, p, _); break; case 2: m = this._checkVerticesInsteadOfIndices ? this._processEdgeForAdjacenciesWithVertices(n.p2, n.p0, d.p0, d.p1, d.p2) : this._processEdgeForAdjacencies(t[3 * i + 2], t[3 * i], f, p, _) } if (-1 !== m && (n.edges[g] = h, d.edges[m] = i, n.edgesConnectedCount++, d.edgesConnectedCount++, 3 === n.edgesConnectedCount)) break } } } } for (i = 0; i < r.length; i++) { var v = r[i]; this._checkEdge(i, v.edges[0], s, v.p0, v.p1), this._checkEdge(i, v.edges[1], s, v.p1, v.p2), this._checkEdge(i, v.edges[2], s, v.p2, v.p0) } var y = this._source.getScene().getEngine(); this._buffers[Oi.b.PositionKind] = new Oi.b(y, this._linesPositions, Oi.b.PositionKind, !1), this._buffers[Oi.b.NormalKind] = new Oi.b(y, this._linesNormals, Oi.b.NormalKind, !1, !1, 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 === Ne.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(so.a.TriangleFillMode, 0, this._indicesCount), this._lineShader.unbind() } }, e }(), pl = function(e) { function t(t, i, n) { void 0 === i && (i = .95), void 0 === n && (n = !1); var r = e.call(this, t, i, n, !1) || this; return r._generateEdgesLines(), r } return l.d(t, e), t.prototype._generateEdgesLines = function() { var e = this._source.getVerticesData(Oi.b.PositionKind), t = this._source.getIndices(); if (t && e) { for (var i = o.t.Vector3[0], n = o.t.Vector3[1], r = t.length - 1, s = 0, a = 0; s < r; s += 2, a += 4) o.x.FromArrayToRef(e, 3 * t[s], i), o.x.FromArrayToRef(e, 3 * t[s + 1], n), this.createLine(i, n, a); var c = this._source.getScene().getEngine(); this._buffers[Oi.b.PositionKind] = new Oi.b(c, this._linesPositions, Oi.b.PositionKind, !1), this._buffers[Oi.b.NormalKind] = new Oi.b(c, this._linesNormals, Oi.b.NormalKind, !1, !1, 4), this._ib = c.createIndexBuffer(this._linesIndices), this._indicesCount = this._linesIndices.length } }, t }(fl), _l = "#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}"; zt.a.ShadersStore.outlinePixelShader = _l; var gl = "\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"; zt.a.ShadersStore.outlineVertexShader = gl; W.a.prototype.getOutlineRenderer = function() { return this._outlineRenderer || (this._outlineRenderer = new ml(this)), this._outlineRenderer }, Object.defineProperty(Fe.a.prototype, "renderOutline", { get: function() { return this._renderOutline }, set: function(e) { e && this.getScene().getOutlineRenderer(), this._renderOutline = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(Fe.a.prototype, "renderOverlay", { get: function() { return this._renderOverlay }, set: function(e) { e && this.getScene().getOutlineRenderer(), this._renderOverlay = e }, enumerable: !0, configurable: !0 }); var ml = function() { function e(e) { this.name = Ae.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(Ae.a.STEP_BEFORERENDERINGMESH_OUTLINE, this, this._beforeRenderingMesh), this.scene._afterRenderingMeshStage.registerStep(Ae.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 = !1); var r = this.scene, o = r.getEngine(), s = o.getCaps().instancedArrays && null !== t.visibleInstances[e._id] && void 0 !== t.visibleInstances[e._id]; if (this.isReady(e, s)) { var a = 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 : a.outlineWidth), this._effect.setColor4("color", i ? a.overlayColor : a.outlineColor, i ? a.overlayAlpha : c.alpha), this._effect.setMatrix("viewProjection", r.getTransformMatrix()), a.useBones && a.computeBonesUsingShaders && a.skeleton && this._effect.setMatrices("mBones", a.skeleton.getTransformMatrices(a)), a._bind(e, this._effect, so.a.TriangleFillMode), c && c.needAlphaTesting()) { var l = c.getAlphaTestTexture(); l && (this._effect.setTexture("diffuseSampler", l), this._effect.setMatrix("diffuseMatrix", l.getTextureMatrix())) } o.setZOffset(-this.zOffset), a._processRendering(e, this._effect, so.a.TriangleFillMode, t, s, function(e, t) { n._effect.setMatrix("world", t) }), o.setZOffset(0) } } }, e.prototype.isReady = function(e, t) { var i = [], n = [Oi.b.PositionKind, Oi.b.NormalKind], r = e.getMesh(), o = e.getMaterial(); o && (o.needAlphaTesting() && (i.push("#define ALPHATEST"), r.isVerticesDataPresent(Oi.b.UVKind) && (n.push(Oi.b.UVKind), i.push("#define UV1")), r.isVerticesDataPresent(Oi.b.UV2Kind) && (n.push(Oi.b.UV2Kind), i.push("#define UV2"))), o.useLogarithmicDepth && i.push("#define LOGARITHMICDEPTH")), r.useBones && r.computeBonesUsingShaders ? (n.push(Oi.b.MatricesIndicesKind), n.push(Oi.b.MatricesWeightsKind), r.numBoneInfluencers > 4 && (n.push(Oi.b.MatricesIndicesExtraKind), n.push(Oi.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 s = i.join("\n"); return this._cachedDefines !== s && (this._cachedDefines = s, this._effect = this.scene.getEngine().createEffect("outline", n, ["world", "mBones", "viewProjection", "diffuseMatrix", "offset", "color", "logarithmicDepthConstant"], ["diffuseSampler"], s)), 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(!1), this._engine.setColorWrite(!1), this._engine.setStencilBuffer(!0), this._engine.setStencilOperationPass(_.a.REPLACE), this._engine.setStencilFunction(_.a.ALWAYS), this._engine.setStencilMask(e._StencilReference), this._engine.setStencilFunctionReference(e._StencilReference), this.render(i, n, !0), this._engine.setColorWrite(!0), this._engine.setStencilFunction(_.a.NOTEQUAL)), this._engine.setDepthWrite(!1), 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, !0), this._engine.setAlphaMode(n) } e.renderOutline && this._savedDepthWrite && (this._engine.setDepthWrite(!0), this._engine.setColorWrite(!1), this.render(t, i), this._engine.setColorWrite(!0)) }, e._StencilReference = 4, e }(), vl = i(109), yl = function() { function e(e, t) { this.name = e, this.color = new o.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 = !1, this._animationStarted = !1, this._loopAnimation = !1, this._fromIndex = 0, this._toIndex = 0, this._delay = 0, this._direction = 1, this._time = 0, this.isVisible = !0, this._manager = t, this._manager.sprites.push(this), this.position = o.x.Zero() } return Object.defineProperty(e.prototype, "size", { get: function() { return this.width }, set: function(e) { this.width = e, this.height = e }, enumerable: !0, configurable: !0 }), e.prototype.playAnimation = function(e, t, i, n, r) { this._fromIndex = e, this._toIndex = t, this._loopAnimation = i, this._delay = n, this._animationStarted = !0, 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 = !1 }, 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 = !1, 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 }(); W.a.prototype._internalPickSprites = function(e, t, i, n) { if (!en.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 s = this.spriteManagers[o]; if (s.isPickable) { var a = s.intersects(e, n, t, i); if (a && a.hit && (i || null == r || !(a.distance >= r.distance)) && (r = a, i)) break } } return r || new en.a }, W.a.prototype.pickSprite = function(e, t, i, n, r) { return this.createPickingRayInCameraSpaceToRef(e, t, this._tempSpritePickingRay, r), this._internalPickSprites(this._tempSpritePickingRay, i, n, r) }, W.a.prototype.pickSpriteWithRay = function(e, t, i, n) { if (!this._tempSpritePickingRay) return null; if (!n) { if (!this.activeCamera) return null; n = this.activeCamera } return It.a.TransformToRef(e, n.getViewMatrix(), this._tempSpritePickingRay), this._internalPickSprites(this._tempSpritePickingRay, t, i, n) }, W.a.prototype.setPointerOverSprite = function(e) { this._pointerOverSprite !== e && (this._pointerOverSprite && this._pointerOverSprite.actionManager && this._pointerOverSprite.actionManager.processTrigger(_.a.ACTION_OnPointerOutTrigger, c.a.CreateNewFromSprite(this._pointerOverSprite, this)), this._pointerOverSprite = e, this._pointerOverSprite && this._pointerOverSprite.actionManager && this._pointerOverSprite.actionManager.processTrigger(_.a.ACTION_OnPointerOverTrigger, c.a.CreateNewFromSprite(this._pointerOverSprite, this))) }, W.a.prototype.getPointerOverSprite = function() { return this._pointerOverSprite }; var bl = function() { function e(e) { this.name = Ae.a.NAME_SPRITE, this.scene = e, this.scene.spriteManagers = new Array, this.scene._tempSpritePickingRay = It.a ? It.a.Zero() : null, this.scene.onBeforeSpritesRenderingObservable = new r.c, this.scene.onAfterSpritesRenderingObservable = new r.c, this._spritePredicate = function(e) { return !!e.actionManager && (e.isPickable && e.actionManager.hasPointerTriggers) } } return e.prototype.register = function() { this.scene._pointerMoveStage.registerStep(Ae.a.STEP_POINTERMOVE_SPRITE, this, this._pointerMove), this.scene._pointerDownStage.registerStep(Ae.a.STEP_POINTERDOWN_SPRITE, this, this._pointerDown), this.scene._pointerUpStage.registerStep(Ae.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, !1, 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, !1, 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, c.a.CreateNewFromSprite(i.pickedSprite, r, n)); break; case 1: i.pickedSprite.actionManager.processTrigger(_.a.ACTION_OnCenterPickTrigger, c.a.CreateNewFromSprite(i.pickedSprite, r, n)); break; case 2: i.pickedSprite.actionManager.processTrigger(_.a.ACTION_OnRightPickTrigger, c.a.CreateNewFromSprite(i.pickedSprite, r, n)) } i.pickedSprite.actionManager && i.pickedSprite.actionManager.processTrigger(_.a.ACTION_OnPickDownTrigger, c.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, !1, r.cameraToUseForPointers || void 0); o && (o.hit && o.pickedSprite && o.pickedSprite.actionManager && (o.pickedSprite.actionManager.processTrigger(_.a.ACTION_OnPickUpTrigger, c.a.CreateNewFromSprite(o.pickedSprite, r, n)), o.pickedSprite.actionManager && (this.scene._inputManager._isPointerSwiping() || o.pickedSprite.actionManager.processTrigger(_.a.ACTION_OnPickTrigger, c.a.CreateNewFromSprite(o.pickedSprite, r, n)))), r._pickedDownSprite && r._pickedDownSprite.actionManager && r._pickedDownSprite !== o.pickedSprite && r._pickedDownSprite.actionManager.processTrigger(_.a.ACTION_OnPickOutTrigger, c.a.CreateNewFromSprite(r._pickedDownSprite, r, n))) } return i }, e }(), Tl = "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}"; zt.a.ShadersStore.spritesPixelShader = Tl; var El = "\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}"; zt.a.ShadersStore.spritesVertexShader = El; var Al, xl = function() { function e(e, t, i, n, o, s, a) { if (void 0 === s && (s = .01), void 0 === a && (a = ke.a.TRILINEAR_SAMPLINGMODE), this.name = e, this.sprites = new Array, this.renderingGroupId = 0, this.layerMask = 268435455, this.fogEnabled = !0, this.isPickable = !1, this.onDisposeObservable = new r.c, this._vertexBuffers = {}, o._getComponent(Ae.a.NAME_SPRITE) || o._addComponent(new bl(o)), this._capacity = i, this._spriteTexture = new ke.a(t, o, !0, !1, a), this._spriteTexture.wrapU = ke.a.CLAMP_ADDRESSMODE, this._spriteTexture.wrapV = ke.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 = s, this._scene = o, this._scene.spriteManagers.push(this); for (var c = [], l = 0, u = 0; u < i; u++) c.push(l), c.push(l + 1), c.push(l + 2), c.push(l), c.push(l + 2), c.push(l + 3), l += 4; this._indexBuffer = o.getEngine().createIndexBuffer(c), this._vertexData = new Float32Array(16 * i * 4), this._buffer = new Oi.a(o.getEngine(), this._vertexData, !0, 16); var h = this._buffer.createVertexBuffer(Oi.b.PositionKind, 0, 4), d = this._buffer.createVertexBuffer("options", 4, 4), f = this._buffer.createVertexBuffer("cellInfo", 8, 4), p = this._buffer.createVertexBuffer(Oi.b.ColorKind, 12, 4); this._vertexBuffers[Oi.b.PositionKind] = h, this._vertexBuffers.options = d, this._vertexBuffers.cellInfo = f, this._vertexBuffers[Oi.b.ColorKind] = p, this._effectBase = this._scene.getEngine().createEffect("sprites", [Oi.b.PositionKind, "options", "cellInfo", Oi.b.ColorKind], ["view", "projection", "textureInfos", "alphaTest"], ["diffuseSampler"], ""), this._effectFog = this._scene.getEngine().createEffect("sprites", [Oi.b.PositionKind, "options", "cellInfo", Oi.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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "texture", { get: function() { return this._spriteTexture }, set: function(e) { this._spriteTexture = e }, enumerable: !0, configurable: !0 }), 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 s = t.cellIndex / r >> 0; this._vertexData[o + 10] = t.cellIndex - s * r, this._vertexData[o + 11] = s, 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), s = o.x.Zero(), a = o.x.Zero(), c = Number.MAX_VALUE, l = null, u = o.x.Zero(), h = o.x.Zero(), d = t.getViewMatrix(), f = 0; f < r; f++) { var p = this.sprites[f]; if (p) { if (i) { if (!i(p)) continue } else if (!p.isPickable) continue; if (o.x.TransformCoordinatesToRef(p.position, d, h), s.copyFromFloats(h.x - p.width / 2, h.y - p.height / 2, h.z), a.copyFromFloats(h.x + p.width / 2, h.y + p.height / 2, h.z), e.intersectsBoxMinMax(s, a)) { var _ = o.x.Distance(h, e.origin); if (c > _ && (c = _, l = p, n)) break } } } if (l) { var g = new en.a; d.invertToRef(o.t.Matrix[0]), g.hit = !0, g.pickedSprite = l, g.distance = c; var m = o.t.Vector3[0]; return m.copyFrom(e.direction), m.normalize(), m.scaleInPlace(c), e.origin.addToRef(m, u), g.pickedPoint = o.x.TransformCoordinates(u, o.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, s = !0, a = 0; a < n; a++) { var c = this.sprites[a]; c && c.isVisible && (s = !1, 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 (!s) { this._buffer.update(this._vertexData); var l = this._effectBase; this._scene.fogEnabled && this._scene.fogMode !== W.a.FOGMODE_NONE && this.fogEnabled && (l = this._effectFog), e.enableEffect(l); var u = this._scene.getViewMatrix(); l.setTexture("diffuseSampler", this._spriteTexture), l.setMatrix("view", u), l.setMatrix("projection", this._scene.getProjectionMatrix()), l.setFloat2("textureInfos", this.cellWidth / t.width, this.cellHeight / t.height), this._scene.fogEnabled && this._scene.fogMode !== W.a.FOGMODE_NONE && this.fogEnabled && (l.setFloat4("vFogInfos", this._scene.fogMode, this._scene.fogStart, this._scene.fogEnd, this._scene.fogDensity), l.setColor3("vFogColor", this._scene.fogColor)), e.bindBuffers(this._vertexBuffers, this._indexBuffer, l), e.setDepthFunctionToLessOrEqual(), l.setBool("alphaTest", !0), e.setColorWrite(!1), e.drawElementsType(so.a.TriangleFillMode, 0, o / 4 * 6), e.setColorWrite(!0), l.setBool("alphaTest", !1), e.setAlphaMode(_.a.ALPHA_COMBINE), e.drawElementsType(so.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), this.onDisposeObservable.notifyObservers(this), this.onDisposeObservable.clear() }, e }(), Rl = i(94), Pl = i(104); ! function(e) { e[e.INIT = 0] = "INIT", e[e.RUNNING = 1] = "RUNNING", e[e.DONE = 2] = "DONE", e[e.ERROR = 3] = "ERROR" }(Al || (Al = {})); var Sl, Cl = function() { function e(e) { this.name = e, this._isCompleted = !1, this._taskState = Al.INIT } return Object.defineProperty(e.prototype, "isCompleted", { get: function() { return this._isCompleted }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "taskState", { get: function() { return this._taskState }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "errorObject", { get: function() { return this._errorObject }, enumerable: !0, configurable: !0 }), 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 = Al.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 = Al.INIT }, e.prototype.onErrorCallback = function(e, t, i) { this._taskState = Al.ERROR, this._errorObject = { message: t, exception: i }, this.onError && this.onError(this, t, i), e() }, e.prototype.onDoneCallback = function(e, t) { try { this._taskState = Al.DONE, this._isCompleted = !0, this.onSuccess && this.onSuccess(this), e() } catch (e) { this.onErrorCallback(t, "Task is done, error executing success callback(s)", e) } }, e }(), Ml = function() { return function(e, t, i) { this.remainingCount = e, this.totalCount = t, this.task = i } }(), Ol = 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 l.d(t, e), t.prototype.runTask = function(e, t, i) { var n = this; bn.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 }(Cl), Il = function(e) { function t(t, i) { var n = e.call(this, t) || this; return n.name = t, n.url = i, n } return l.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, !1, !1, function(e, t) { e && i(e.status + " " + e.statusText, t) }) }, t }(Cl), Dl = function(e) { function t(t, i) { var n = e.call(this, t) || this; return n.name = t, n.url = i, n } return l.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, !0, !0, function(e, t) { e && i(e.status + " " + e.statusText, t) }) }, t }(Cl), Ll = function(e) { function t(t, i) { var n = e.call(this, t) || this; return n.name = t, n.url = i, n } return l.d(t, e), t.prototype.runTask = function(e, t, i) { var n = this, r = new Image; ye.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 }(Cl), wl = function(e) { function t(t, i, n, r, o) { void 0 === o && (o = ke.a.TRILINEAR_SAMPLINGMODE); var s = e.call(this, t) || this; return s.name = t, s.url = i, s.noMipmap = n, s.invertY = r, s.samplingMode = o, s } return l.d(t, e), t.prototype.runTask = function(e, t, i) { this.texture = new ke.a(this.url, e, this.noMipmap, this.invertY, this.samplingMode, function() { t() }, function(e, t) { i(e, t) }) }, t }(Cl), Fl = function(e) { function t(t, i, n, r, o) { var s = e.call(this, t) || this; return s.name = t, s.url = i, s.extensions = n, s.noMipmap = r, s.files = o, s } return l.d(t, e), t.prototype.runTask = function(e, t, i) { this.texture = new tr(this.url, e, this.extensions, this.noMipmap, this.files, function() { t() }, function(e, t) { i(e, t) }) }, t }(Cl), Nl = function(e) { function t(t, i, n, r, o, s, a) { void 0 === r && (r = !1), void 0 === o && (o = !0), void 0 === s && (s = !1), void 0 === a && (a = !1); 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 = s, c.reserved = a, c } return l.d(t, e), t.prototype.runTask = function(e, t, i) { this.texture = new Uo(this.url, e, this.size, this.noMipmap, this.generateHarmonics, this.gammaSpace, this.reserved, function() { t() }, function(e, t) { i(e, t) }) }, t }(Cl), Bl = function(e) { function t(t, i, n, r, o) { void 0 === r && (r = !1), void 0 === o && (o = !0); var s = e.call(this, t) || this; return s.name = t, s.url = i, s.size = n, s.noMipmap = r, s.gammaSpace = o, s } return l.d(t, e), t.prototype.runTask = function(e, t, i) { this.texture = new ls(this.url, e, this.size, this.noMipmap, this.gammaSpace, function() { t() }, function(e, t) { i(e, t) }) }, t }(Cl), Ul = function() { function e(e) { this._isLoading = !1, this._tasks = new Array, this._waitingTasksCount = 0, this._totalTasksCount = 0, this.onTaskSuccessObservable = new r.c, this.onTaskErrorObservable = new r.c, this.onTasksDoneObservable = new r.c, this.onProgressObservable = new r.c, this.useDefaultLoadingScreen = !0, this._scene = e } return e.prototype.addMeshTask = function(e, t, i, n) { var r = new Ol(e, t, i, n); return this._tasks.push(r), r }, e.prototype.addTextFileTask = function(e, t) { var i = new Il(e, t); return this._tasks.push(i), i }, e.prototype.addBinaryFileTask = function(e, t) { var i = new Dl(e, t); return this._tasks.push(i), i }, e.prototype.addImageTask = function(e, t) { var i = new Ll(e, t); return this._tasks.push(i), i }, e.prototype.addTextureTask = function(e, t, i, n, r) { void 0 === r && (r = ke.a.TRILINEAR_SAMPLINGMODE); var o = new wl(e, t, i, n, r); return this._tasks.push(o), o }, e.prototype.addCubeTextureTask = function(e, t, i, n, r) { var o = new Fl(e, t, i, n, r); return this._tasks.push(o), o }, e.prototype.addHDRCubeTextureTask = function(e, t, i, n, r, o, s) { void 0 === n && (n = !1), void 0 === r && (r = !0), void 0 === o && (o = !1), void 0 === s && (s = !1); var a = new Nl(e, t, i, n, r, o, s); return this._tasks.push(a), a }, e.prototype.addEquiRectangularCubeTextureAssetTask = function(e, t, i, n, r) { void 0 === n && (n = !1), void 0 === r && (r = !0); var o = new Bl(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 Ml(this._waitingTasksCount, this._totalTasksCount, e)) } catch (e) { p.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 === Al.DONE) { var r = this._tasks.indexOf(e); r > -1 && this._tasks.splice(r, 1) } } this.onTasksDoneObservable.notifyObservers(this._tasks) } catch (e) { p.a.Error("Error running tasks-done callbacks."), console.log(e) } this._isLoading = !1, 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) }; 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 = !1, this._tasks = new Array, this }, e.prototype.load = function() { if (this._isLoading) return this; if (this._isLoading = !0, this._waitingTasksCount = this._tasks.length, this._totalTasksCount = this._tasks.length, 0 === this._waitingTasksCount) return this._isLoading = !1, 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 === Al.INIT && this._runTask(t) } return this }, e.prototype.loadAsync = function() { var e = this; return new Promise(function(t, i) { e.onTasksDoneObservable.addOnce(function(e) { e && e.length ? i(e) : t() }) }) }, e }(), Vl = function() { function e() { var e = this; this.promise = new Promise(function(t, i) { e._resolve = t, e._reject = i }) } return Object.defineProperty(e.prototype, "resolve", { get: function() { return this._resolve }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "reject", { get: function() { return this._reject }, enumerable: !0, configurable: !0 }), e }(), Gl = function() { function e(e, t) { this._meshesOrigins = [], this._toCenterVectors = [], this._scaledDirection = o.x.Zero(), this._newPosition = o.x.Zero(), this._centerPosition = o.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] = o.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 = o.x.Zero(), t = o.x.Zero(), i = Number.MAX_VALUE, n = 0; n < this._meshes.length; n++) { if (this._meshes[n])(s = (r = this._meshes[n]).getBoundingInfo()) && t.addInPlace(s.boundingBox.centerWorld) } e = t.scale(1 / this._meshes.length); for (n = 0; n < this._meshes.length; n++) { var r, s; if (this._meshes[n]) if (s = (r = this._meshes[n]).getBoundingInfo()) { var a = s.boundingBox.centerWorld.subtract(e).lengthSquared(); a < i && (this._centerMesh = r, i = a) } } }, 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 }(), kl = function() { function e(e, t, i, n, r, o, s, a, c) { this.onProcessFileCallback = function() { return !0 }, this._engine = e, this._currentScene = t, this._sceneLoadedCallback = i, this._progressCallback = n, this._additionalRenderLoopLogicCallback = r, this._textureLoadingCallback = o, this._startingProcessingFilesCallback = s, this._onReloadCallback = a, this._errorCallback = c } return Object.defineProperty(e, "FilesToLoad", { get: function() { return mn.a.FilesToLoad }, enumerable: !0, configurable: !0 }), 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, !1), this._elementToMonitor.addEventListener("dragover", this._dragOverHandler, !1), this._elementToMonitor.addEventListener("drop", this._dropHandler, !1)) }, 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(), e.preventDefault(), this.loadFiles(e) }, e.prototype._traverseFolder = function(e, t, i, n) { var r = this, o = e.createReader(), s = e.fullPath.replace(/^\//, "").replace(/(.+?)\/?$/, "$1/"); o.readEntries(function(e) { i.count += e.length; for (var o = 0, a = e; o < a.length; o++) { var c = a[o]; c.isFile ? c.file(function(e) { e.correctName = s + 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 s = this._filesToLoad[o], a = s.name.toLowerCase(), c = void 0; if (s.correctName = a, r) { var l = r[o]; l.getAsEntry ? c = l.getAsEntry() : l.webkitGetAsEntry && (c = l.webkitGetAsEntry()) } c && c.isDirectory ? n.push(c) : i.push(s) } if (0 === n.length) this._processFiles(i), this._processReload(); else for (var u = { count: n.length }, h = 0, d = n; h < d.length; h++) { var f = d[h]; this._traverseFolder(f, i, u, function() { t._processFiles(i), 0 === u.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 && (p.a.errorsCount > 0 && p.a.ClearLogCache(), this._engine.stopRenderLoop()), bn.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) })) : p.a.Error("Please provide a valid .babylon file.") }, e }(), zl = i(105), jl = i(106), Hl = 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 !0 }, e }(), Wl = 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 l.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 = !0, 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 = !1) } } return i }, t }(Hl), Xl = 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 l.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 }(Hl), Yl = function(e) { function t() { return null !== e && e.apply(this, arguments) || this } return l.d(t, e), t.prototype.getDescription = function() { return "Turning shadows on/off" }, t.prototype.apply = function(e, t) { return e.shadowsEnabled = t.isInImprovementMode, !0 }, t }(Hl), Kl = function(e) { function t() { return null !== e && e.apply(this, arguments) || this } return l.d(t, e), t.prototype.getDescription = function() { return "Turning post-processes on/off" }, t.prototype.apply = function(e, t) { return e.postProcessesEnabled = t.isInImprovementMode, !0 }, t }(Hl), Ql = function(e) { function t() { return null !== e && e.apply(this, arguments) || this } return l.d(t, e), t.prototype.getDescription = function() { return "Turning lens flares on/off" }, t.prototype.apply = function(e, t) { return e.lensFlaresEnabled = t.isInImprovementMode, !0 }, t }(Hl), ql = function(e) { function t() { return null !== e && e.apply(this, arguments) || this } return l.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 }(Hl), Zl = function(e) { function t() { return null !== e && e.apply(this, arguments) || this } return l.d(t, e), t.prototype.getDescription = function() { return "Turning particles on/off" }, t.prototype.apply = function(e, t) { return e.particlesEnabled = t.isInImprovementMode, !0 }, t }(Hl), Jl = function(e) { function t() { return null !== e && e.apply(this, arguments) || this } return l.d(t, e), t.prototype.getDescription = function() { return "Turning render targets off" }, t.prototype.apply = function(e, t) { return e.renderTargetsEnabled = t.isInImprovementMode, !0 }, t }(Hl), $l = function(e) { function t() { var t = null !== e && e.apply(this, arguments) || this; return t._canBeMerged = function(e) { if (!(e instanceof fe.a)) return !1; var t = e; return !t.isDisposed() && (!(!t.isVisible || !t.isEnabled()) && (!(t.instances.length > 0) && (!t.skeleton && !t.hasLODLevels))) }, t } return l.d(t, e), Object.defineProperty(t, "UpdateSelectionTree", { get: function() { return t._UpdateSelectionTree }, set: function(e) { t._UpdateSelectionTree = e }, enumerable: !0, configurable: !0 }), 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, s = 0; s < o; s++) { var a = new Array, c = r[s]; if (this._canBeMerged(c)) { a.push(c); for (var l = s + 1; l < o; l++) { var u = r[l]; this._canBeMerged(u) && (u.material === c.material && u.checkCollisions === c.checkCollisions && (a.push(u), o--, r.splice(l, 1), l--)) } a.length < 2 || fe.a.MergeMeshes(a, void 0, !0) } } var h = e; return h.createOrUpdateSelectionOctree && (null != n ? n && h.createOrUpdateSelectionOctree() : t.UpdateSelectionTree && h.createOrUpdateSelectionOctree()), !0 }, t._UpdateSelectionTree = !1, t }(Hl), eu = 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 ql(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 $l(n)), i.addOptimization(new Yl(n)), i.addOptimization(new Ql(n)), n++, i.addOptimization(new Kl(n)), i.addOptimization(new Zl(n)), n++, i.addOptimization(new Wl(n, 1024)), i }, e.ModerateDegradationAllowed = function(t) { var i = new e(t), n = 0; return i.addOptimization(new $l(n)), i.addOptimization(new Yl(n)), i.addOptimization(new Ql(n)), n++, i.addOptimization(new Kl(n)), i.addOptimization(new Zl(n)), n++, i.addOptimization(new Wl(n, 512)), n++, i.addOptimization(new Jl(n)), n++, i.addOptimization(new Xl(n, 2)), i }, e.HighDegradationAllowed = function(t) { var i = new e(t), n = 0; return i.addOptimization(new $l(n)), i.addOptimization(new Yl(n)), i.addOptimization(new Ql(n)), n++, i.addOptimization(new Kl(n)), i.addOptimization(new Zl(n)), n++, i.addOptimization(new Wl(n, 256)), n++, i.addOptimization(new Jl(n)), n++, i.addOptimization(new Xl(n, 4)), i }, e }(), tu = function() { function e(e, t, i, n) { var o = this; if (void 0 === i && (i = !0), void 0 === n && (n = !1), this._isRunning = !1, this._currentPriorityLevel = 0, this._targetFrameRate = 60, this._trackerDuration = 2e3, this._currentFrameRate = 0, this._improvementMode = !1, this.onSuccessObservable = new r.c, this.onNewOptimizationAppliedObservable = new r.c, this.onFailureObservable = new r.c, this._options = t || new eu, this._options.targetFrameRate && (this._targetFrameRate = this._options.targetFrameRate), this._options.trackerDuration && (this._trackerDuration = this._options.trackerDuration), i) for (var s = 0, a = 0, c = this._options.optimizations; a < c.length; a++) { c[a].priority = s++ } this._improvementMode = n, this._scene = e || P.a.LastCreatedScene, this._sceneDisposeObserver = this._scene.onDisposeObservable.add(function() { o._sceneDisposeObserver = null, o.dispose() }) } return Object.defineProperty(e.prototype, "isInImprovementMode", { get: function() { return this._improvementMode }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "currentPriorityLevel", { get: function() { return this._currentPriorityLevel }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "currentFrameRate", { get: function() { return this._currentFrameRate }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "targetFrameRate", { get: function() { return this._targetFrameRate }, set: function(e) { this._targetFrameRate = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "trackerDuration", { get: function() { return this._trackerDuration }, set: function(e) { this._trackerDuration = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "optimizations", { get: function() { return this._options.optimizations }, enumerable: !0, configurable: !0 }), e.prototype.stop = function() { this._isRunning = !1 }, e.prototype.reset = function() { this._currentPriorityLevel = 0 }, e.prototype.start = function() { var e = this; this._isRunning || (this._isRunning = !0, 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 = !1, void this.onSuccessObservable.notifyObservers(this); for (var n = !0, r = !0, o = 0; o < i.optimizations.length; o++) { var s = i.optimizations[o]; s.priority === this._currentPriorityLevel && (r = !1, n = n && s.apply(t, this), this.onNewOptimizationAppliedObservable.notifyObservers(s)) } if (r) return this._isRunning = !1, 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 || eu.ModerateDegradationAllowed(), !1); return n && o.onSuccessObservable.add(function() { n() }), r && o.onFailureObservable.add(function() { r() }), o.start(), o }, e }(), iu = [], nu = function(e, t) { iu[e.id] || e.doNotSerialize || (t.vertexData.push(e.serializeVerticeData()), iu[e.id] = !0) }, ru = function(e, t) { var i = {}, n = e._geometry; return n && (e.getScene().getGeometryByID(n.id) || nu(n, t.geometries)), e.serialize && e.serialize(i), i }, ou = function() { function e() {} return e.ClearCache = function() { iu = [] }, 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 s = t.getPhysicsEngine(); s && (o.physicsEnabled = !0, o.physicsGravity = s.gravity.asArray(), o.physicsEngine = s.getPhysicsPluginName()) } t.metadata && (o.metadata = t.metadata), o.morphTargetManagers = []; for (var a = 0, c = t.meshes; a < c.length; a++) { var l = (m = c[a]).morphTargetManager; l && o.morphTargetManagers.push(l.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 u = t.cameras[i]; u.doNotSerialize || o.cameras.push(u.serialize()) } if (t.activeCamera && (o.activeCameraID = t.activeCamera.id), L.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 d = t.multiMaterials[i]; o.multiMaterials.push(d.serialize()) } for (t.environmentTexture && (o.environmentTexture = t.environmentTexture.name), o.skeletons = [], i = 0; i < t.skeletons.length; i++) { var f = t.skeletons[i]; f.doNotSerialize || o.skeletons.push(f.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 = [], iu = []; var p = t.getGeometries(); for (i = 0; i < p.length; i++) { var g = p[i]; g.isReady() && nu(g, o.geometries) } for (o.meshes = [], i = 0; i < t.meshes.length; i++) { var m; if ((m = t.meshes[i]) instanceof fe.a) { var v = m; v.doNotSerialize || v.delayLoadState !== _.a.DELAYLOADSTATE_LOADED && v.delayLoadState !== _.a.DELAYLOADSTATE_NONE || o.meshes.push(ru(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 = !1), void 0 === n && (n = !1); 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 fe.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 Fo.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 = []), nu(o, t.geometries)), e.skeleton && (t.skeletons = t.skeletons || [], t.skeletons.push(e.skeleton.serialize())), t.meshes = t.meshes || [], t.meshes.push(ru(e, t)) } }(e, r) }), r }, e }(), su = i(29), au = function() { function e() {} return e.CreateResizedCopy = function(e, t, i, n) { void 0 === n && (n = !0); var r = e.getScene(), o = r.getEngine(), s = new _i("resized" + e.name, { width: t, height: i }, r, !e.noMipmap, !0, e._texture.type, !1, e.samplingMode, !1); s.wrapU = e.wrapU, s.wrapV = e.wrapV, s.uOffset = e.uOffset, s.vOffset = e.vOffset, s.uScale = e.uScale, s.vScale = e.vScale, s.uAng = e.uAng, s.vAng = e.vAng, s.wAng = e.wAng, s.coordinatesIndex = e.coordinatesIndex, s.level = e.level, s.anisotropicFilteringLevel = e.anisotropicFilteringLevel, s._texture.isReady = !1, e.wrapU = ke.a.CLAMP_ADDRESSMODE, e.wrapV = ke.a.CLAMP_ADDRESSMODE; var a = new Yt("pass", 1, null, n ? ke.a.BILINEAR_SAMPLINGMODE : ke.a.NEAREST_SAMPLINGMODE, o, !1, _.a.TEXTURETYPE_UNSIGNED_INT); return a.getEffect().executeWhenCompiled(function() { a.onApply = function(t) { t.setTexture("textureSampler", e) }; var t = s.getInternalTexture(); t && (r.postProcessManager.directRender([a], t), o.unBindFramebuffer(t), s.disposeFramebufferObjects(), a.dispose(), t.isReady = !0) }), s }, e }(), cu = 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 = !1, this._options = l.a({}, e._defaultOptions, i); var r = this._canvas.captureStream(this._options.fps); if (this._options.audioTracks) for (var o = 0, s = this._options.audioTracks; o < s.length; o++) { var a = s[o]; r.addTrack(a) } 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: !0, configurable: !0 }), e.prototype.stopRecording = function() { this._canvas && this._mediaRecorder && this.isRecording && (this._canvas.isRecording = !1, this._mediaRecorder.stop()) }, e.prototype.startRecording = function(e, t) { var i = 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() { i.stopRecording() }, 1e3 * t), this._fileName = e, this._recordedChunks = [], this._resolve = null, this._reject = null, this._canvas.isRecording = !0, this._mediaRecorder.start(this._options.recordChunckSize), new Promise(function(e, t) { i._resolve = e, i._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 && ye.h.Download(e, this._fileName) }, e._defaultOptions = { mimeType: "video/webm", fps: 25, recordChunckSize: 3e3 }, e }(), lu = function() { function e() {} return e.CreateScreenshot = function(e, t, i, n, r) { var o, s; if (void 0 === r && (r = "image/png"), i.precision) o = Math.round(e.getRenderWidth() * i.precision), s = Math.round(o / e.getAspectRatio(t)); else if (i.width && i.height) o = i.width, s = i.height; else if (i.width && !i.height) o = i.width, s = Math.round(o / e.getAspectRatio(t)); else if (i.height && !i.width) s = i.height, o = Math.round(s * e.getAspectRatio(t)); else { if (isNaN(i)) return void p.a.Error("Invalid 'size' parameter !"); s = i, o = i } ye.h._ScreenshotCanvas || (ye.h._ScreenshotCanvas = document.createElement("canvas")), ye.h._ScreenshotCanvas.width = o, ye.h._ScreenshotCanvas.height = s; var a = ye.h._ScreenshotCanvas.getContext("2d"), c = e.getRenderWidth() / e.getRenderHeight(), l = o, u = l / c; u > s && (l = (u = s) * c); var h = Math.max(0, o - l) / 2, d = Math.max(0, s - u) / 2, f = e.getRenderingCanvas(); a && f && a.drawImage(f, h, d, l, u), ye.h.EncodeScreenshotCanvasData(n, r) }, e.CreateScreenshotUsingRenderTarget = function(e, t, i, n, r, o, s, a) { var c, l; if (void 0 === r && (r = "image/png"), void 0 === o && (o = 1), void 0 === s && (s = !1), i.precision) c = Math.round(e.getRenderWidth() * i.precision), l = Math.round(c / e.getAspectRatio(t)), i = { width: c, height: l }; else if (i.width && i.height) c = i.width, l = i.height; else if (i.width && !i.height) c = i.width, l = Math.round(c / e.getAspectRatio(t)), i = { width: c, height: l }; else if (i.height && !i.width) l = i.height, i = { width: c = Math.round(l * e.getAspectRatio(t)), height: l }; else { if (isNaN(i)) return void p.a.Error("Invalid 'size' parameter !"); l = i, c = i } var u = t.getScene(), h = null; u.activeCamera !== t && (h = u.activeCamera, u.activeCamera = t); var d = e.getRenderingCanvas(); if (d) { var f = { width: d.width, height: d.height }; e.setSize(c, l), u.render(); var g = new _i("screenShot", i, u, !1, !1, _.a.TEXTURETYPE_UNSIGNED_INT, !1, ke.a.NEAREST_SAMPLINGMODE); g.renderList = null, g.samples = o, s && g.addPostProcess(new xc("antialiasing", 1, u.activeCamera)), g.onAfterRenderObservable.add(function() { ye.h.DumpFramebuffer(c, l, e, n, r, a) }), u.incrementRenderId(), u.resetCachedMaterial(), g.render(!0), g.dispose(), h && (u.activeCamera = h), e.setSize(f.width, f.height), t.getProjectionMatrix(!0) } else p.a.Error("No rendering canvas found !") }, e }(); ye.h.CreateScreenshot = lu.CreateScreenshot, ye.h.CreateScreenshotUsingRenderTarget = lu.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" }(Sl || (Sl = {})), i.d(t, "AbstractScene", function() { return n.a }), i.d(t, "Action", function() { return a }), i.d(t, "ActionEvent", function() { return c.a }), i.d(t, "ActionManager", function() { return C }), i.d(t, "Condition", function() { return u }), i.d(t, "ValueCondition", function() { return h }), i.d(t, "PredicateCondition", function() { return d }), i.d(t, "StateCondition", function() { return f }), i.d(t, "SwitchBooleanAction", function() { return g }), i.d(t, "SetStateAction", function() { return m }), i.d(t, "SetValueAction", function() { return v }), i.d(t, "IncrementValueAction", function() { return y }), i.d(t, "PlayAnimationAction", function() { return b }), i.d(t, "StopAnimationAction", function() { return T }), i.d(t, "DoNothingAction", function() { return E }), i.d(t, "CombineAction", function() { return A }), i.d(t, "ExecuteCodeAction", function() { return x }), i.d(t, "SetParentAction", function() { return R }), i.d(t, "PlaySoundAction", function() { return M }), i.d(t, "StopSoundAction", function() { return O }), i.d(t, "InterpolateValueAction", function() { return U }), i.d(t, "Animatable", function() { return Q }), i.d(t, "_IAnimationState", function() { return N }), i.d(t, "Animation", function() { return B }), i.d(t, "TargetedAnimation", function() { return q }), i.d(t, "AnimationGroup", function() { return Z }), i.d(t, "AnimationPropertiesOverride", function() { return J }), i.d(t, "EasingFunction", function() { return $ }), i.d(t, "CircleEase", function() { return ee }), i.d(t, "BackEase", function() { return te }), i.d(t, "BounceEase", function() { return ie }), i.d(t, "CubicEase", function() { return ne }), i.d(t, "ElasticEase", function() { return re }), i.d(t, "ExponentialEase", function() { return oe }), i.d(t, "PowerEase", function() { return se }), i.d(t, "QuadraticEase", function() { return ae }), i.d(t, "QuarticEase", function() { return ce }), i.d(t, "QuinticEase", function() { return le }), i.d(t, "SineEase", function() { return ue }), i.d(t, "BezierCurveEase", function() { return he }), i.d(t, "RuntimeAnimation", function() { return H }), i.d(t, "AnimationEvent", function() { return de }), i.d(t, "AnimationKeyInterpolation", function() { return I }), i.d(t, "AnimationRange", function() { return w }), i.d(t, "KeepAssets", function() { return pe }), i.d(t, "AssetContainer", function() { return _e }), i.d(t, "Analyser", function() { return me }), i.d(t, "AudioEngine", function() { return ve }), i.d(t, "AudioSceneComponent", function() { return xe }), i.d(t, "Sound", function() { return Te }), i.d(t, "SoundTrack", function() { return Ee }), i.d(t, "WeightedSound", function() { return Re }), i.d(t, "AutoRotationBehavior", function() { return Se }), i.d(t, "BouncingBehavior", function() { return Ce }), i.d(t, "FramingBehavior", function() { return Me }), i.d(t, "AttachToBoxBehavior", function() { return Ie }), i.d(t, "FadeInOutBehavior", function() { return De }), i.d(t, "MultiPointerScaleBehavior", function() { return we }), i.d(t, "PointerDragBehavior", function() { return Le.a }), i.d(t, "SixDofDragBehavior", function() { return Ue }), i.d(t, "Bone", function() { return K }), i.d(t, "BoneIKController", function() { return Ve }), i.d(t, "BoneLookController", function() { return Ge }), i.d(t, "Skeleton", function() { return He }), i.d(t, "CameraInputTypes", function() { return We }), i.d(t, "CameraInputsManager", function() { return Xe }), i.d(t, "Camera", function() { return Ne.a }), i.d(t, "TargetCamera", function() { return yt }), i.d(t, "FreeCamera", function() { return bt }), i.d(t, "FreeCameraInputsManager", function() { return dt }), i.d(t, "TouchCamera", function() { return Tt }), i.d(t, "ArcRotateCamera", function() { return Et }), i.d(t, "ArcRotateCameraInputsManager", function() { return it }), i.d(t, "DeviceOrientationCamera", function() { return At }), i.d(t, "FlyCamera", function() { return Rt }), i.d(t, "FlyCameraInputsManager", function() { return xt }), i.d(t, "FollowCamera", function() { return Ct }), i.d(t, "ArcFollowCamera", function() { return Mt }), i.d(t, "GamepadCamera", function() { return Gt }), i.d(t, "UniversalCamera", function() { return Vt }), i.d(t, "VirtualJoysticksCamera", function() { return ai }), i.d(t, "ArcRotateCameraGamepadInput", function() { return qe }), i.d(t, "ArcRotateCameraKeyboardMoveInput", function() { return Je }), i.d(t, "ArcRotateCameraMouseWheelInput", function() { return $e }), i.d(t, "ArcRotateCameraPointersInput", function() { return tt }), i.d(t, "ArcRotateCameraVRDeviceOrientationInput", function() { return nt }), i.d(t, "FlyCameraKeyboardInput", function() { return rt }), i.d(t, "FlyCameraMouseInput", function() { return ot }), i.d(t, "FollowCameraKeyboardMoveInput", function() { return st }), i.d(t, "FollowCameraMouseWheelInput", function() { return at }), i.d(t, "FollowCameraPointersInput", function() { return ct }), i.d(t, "FreeCameraDeviceOrientationInput", function() { return ft }), i.d(t, "FreeCameraGamepadInput", function() { return pt }), i.d(t, "FreeCameraKeyboardMoveInput", function() { return lt }), i.d(t, "FreeCameraMouseInput", function() { return ut }), i.d(t, "FreeCameraTouchInput", function() { return ht }), i.d(t, "FreeCameraVirtualJoystickInput", function() { return vt }), i.d(t, "AnaglyphArcRotateCamera", function() { return Zt }), i.d(t, "AnaglyphFreeCamera", function() { return Jt }), i.d(t, "AnaglyphGamepadCamera", function() { return $t }), i.d(t, "AnaglyphUniversalCamera", function() { return ei }), i.d(t, "StereoscopicArcRotateCamera", function() { return ni }), i.d(t, "StereoscopicFreeCamera", function() { return ri }), i.d(t, "StereoscopicGamepadCamera", function() { return oi }), i.d(t, "StereoscopicUniversalCamera", function() { return si }), i.d(t, "VRCameraMetrics", function() { return ci }), i.d(t, "VRDeviceOrientationArcRotateCamera", function() { return vi }), i.d(t, "VRDeviceOrientationFreeCamera", function() { return yi }), i.d(t, "VRDeviceOrientationGamepadCamera", function() { return bi }), i.d(t, "OnAfterEnteringVRObservableEvent", function() { return Vi }), i.d(t, "VRExperienceHelper", function() { return Gi }), i.d(t, "WebVRFreeCamera", function() { return Ei }), i.d(t, "WebXRCamera", function() { return ki }), i.d(t, "WebXREnterExitUIButton", function() { return Wi }), i.d(t, "WebXREnterExitUIOptions", function() { return Xi }), i.d(t, "WebXREnterExitUI", function() { return Yi }), i.d(t, "WebXRState", function() { return Li }), i.d(t, "WebXRExperienceHelper", function() { return Hi }), i.d(t, "WebXRController", function() { return Ki }), i.d(t, "WebXRInput", function() { return Qi }), i.d(t, "WebXRManagedOutputCanvas", function() { return qi }), i.d(t, "WebXRSessionManager", function() { return zi }), i.d(t, "Collider", function() { return Ji }), i.d(t, "DefaultCollisionCoordinator", function() { return $i }), i.d(t, "PickingInfo", function() { return en.a }), i.d(t, "IntersectionInfo", function() { return tn.a }), i.d(t, "_MeshCollisionData", function() { return nn.a }), i.d(t, "BoundingBox", function() { return rn.a }), i.d(t, "BoundingInfo", function() { return on.a }), i.d(t, "BoundingSphere", function() { return sn.a }), i.d(t, "Ray", function() { return It.a }), i.d(t, "Octree", function() { return cn }), i.d(t, "OctreeBlock", function() { return an }), i.d(t, "OctreeSceneComponent", function() { return ln }), i.d(t, "AxesViewer", function() { return un.AxesViewer }), i.d(t, "BoneAxesViewer", function() { return un.BoneAxesViewer }), i.d(t, "DebugLayer", function() { return un.DebugLayer }), i.d(t, "PhysicsViewer", function() { return un.PhysicsViewer }), i.d(t, "RayHelper", function() { return un.RayHelper }), i.d(t, "SkeletonViewer", function() { return un.SkeletonViewer }), i.d(t, "Constants", function() { return _.a }), i.d(t, "InstancingAttributeInfo", function() { return ge.d }), i.d(t, "DepthTextureCreationOptions", function() { return ge.a }), i.d(t, "EngineCapabilities", function() { return ge.c }), i.d(t, "Engine", function() { return ge.b }), i.d(t, "EngineStore", function() { return P.a }), i.d(t, "NullEngineOptions", function() { return hn.b }), i.d(t, "NullEngine", function() { return hn.a }), i.d(t, "WebGLPipelineContext", function() { return pn.a }), i.d(t, "_OcclusionDataStorage", function() { return fn }), i.d(t, "_forceTransformFeedbackToBundle", function() { return !0 }), i.d(t, "KeyboardEventTypes", function() { return Ze.a }), i.d(t, "KeyboardInfo", function() { return Ze.b }), i.d(t, "KeyboardInfoPre", function() { return Ze.c }), i.d(t, "PointerEventTypes", function() { return Pe.a }), i.d(t, "PointerInfoBase", function() { return Pe.c }), i.d(t, "PointerInfoPre", function() { return Pe.d }), i.d(t, "PointerInfo", function() { return Pe.b }), i.d(t, "ClipboardEventTypes", function() { return _n }), i.d(t, "ClipboardInfo", function() { return gn }), i.d(t, "DaydreamController", function() { return Tn }), i.d(t, "GearVRController", function() { return En }), i.d(t, "GenericController", function() { return An }), i.d(t, "OculusTouchController", function() { return xn }), i.d(t, "PoseEnabledControllerType", function() { return St }), i.d(t, "PoseEnabledControllerHelper", function() { return wt }), i.d(t, "PoseEnabledController", function() { return Ft }), i.d(t, "ViveController", function() { return Rn }), i.d(t, "WebVRController", function() { return Ai }), i.d(t, "WindowsMotionController", function() { return Sn }), i.d(t, "StickValues", function() { return Ye }), i.d(t, "Gamepad", function() { return Ke }), i.d(t, "GenericPad", function() { return Qe }), i.d(t, "GamepadManager", function() { return Bt }), i.d(t, "GamepadSystemSceneComponent", function() { return Ut }), i.d(t, "Xbox360Button", function() { return Dt }), i.d(t, "Xbox360Dpad", function() { return Lt }), i.d(t, "Xbox360Pad", function() { return Nt }), i.d(t, "AxisDragGizmo", function() { return Cn.a }), i.d(t, "AxisScaleGizmo", function() { return Dn }), i.d(t, "BoundingBoxGizmo", function() { return Fn }), i.d(t, "Gizmo", function() { return On.a }), i.d(t, "GizmoManager", function() { return kn }), i.d(t, "PlaneRotationGizmo", function() { return Nn }), i.d(t, "PositionGizmo", function() { return Un }), i.d(t, "RotationGizmo", function() { return Bn }), i.d(t, "ScaleGizmo", function() { return Gn }), i.d(t, "LightGizmo", function() { return Yn }), i.d(t, "EnvironmentHelper", function() { return pr }), i.d(t, "PhotoDome", function() { return gr }), i.d(t, "_forceSceneHelpersToBundle", function() { return !0 }), i.d(t, "VideoDome", function() { return no }), i.d(t, "EngineInstrumentation", function() { return ro }), i.d(t, "SceneInstrumentation", function() { return oo }), i.d(t, "_TimeToken", function() { return dn }), i.d(t, "EffectLayer", function() { return lo }), i.d(t, "EffectLayerSceneComponent", function() { return uo }), i.d(t, "GlowLayer", function() { return po }), i.d(t, "HighlightLayer", function() { return mo }), i.d(t, "Layer", function() { return To }), i.d(t, "LayerSceneComponent", function() { return vo }), i.d(t, "LensFlare", function() { return Eo }), i.d(t, "LensFlareSystem", function() { return Ro }), i.d(t, "LensFlareSystemSceneComponent", function() { return Po }), i.d(t, "Light", function() { return zn.a }), i.d(t, "ShadowLight", function() { return jn }), i.d(t, "DirectionalLight", function() { return Hn }), i.d(t, "HemisphericLight", function() { return Ti.a }), i.d(t, "PointLight", function() { return Do }), i.d(t, "SpotLight", function() { return Xn }), i.d(t, "ShadowGenerator", function() { return Oo }), i.d(t, "ShadowGeneratorSceneComponent", function() { return Io }), i.d(t, "DefaultLoadingScreen", function() { return Lo }), i.d(t, "SceneLoaderProgressEvent", function() { return yn }), i.d(t, "SceneLoader", function() { return bn }), i.d(t, "SceneLoaderFlags", function() { return vn.a }), i.d(t, "_BabylonLoaderRegistered", function() { return !0 }), i.d(t, "ColorCurves", function() { return is.a }), i.d(t, "EffectFallbacks", function() { return zt.c }), i.d(t, "EffectCreationOptions", function() { return zt.b }), i.d(t, "Effect", function() { return zt.a }), i.d(t, "FresnelParameters", function() { return ns }), i.d(t, "ImageProcessingConfigurationDefines", function() { return xi.b }), i.d(t, "ImageProcessingConfiguration", function() { return xi.a }), i.d(t, "Material", function() { return so.a }), i.d(t, "MaterialDefines", function() { return nr.a }), i.d(t, "MaterialHelper", function() { return ir.a }), i.d(t, "MultiMaterial", function() { return Fo.a }), i.d(t, "PushMaterial", function() { return rr.a }), i.d(t, "ShaderMaterial", function() { return as.a }), i.d(t, "StandardMaterialDefines", function() { return Ri.b }), i.d(t, "StandardMaterial", function() { return Ri.a }), i.d(t, "BaseTexture", function() { return Kn.a }), i.d(t, "CubeTexture", function() { return tr }), i.d(t, "EquiRectangularCubeTexture", function() { return ls }), i.d(t, "HDRCubeTexture", function() { return Uo }), i.d(t, "InternalTexture", function() { return ze.a }), i.d(t, "MirrorTexture", function() { return er }), i.d(t, "MultiRenderTarget", function() { return ds }), i.d(t, "RenderTargetTexture", function() { return _i }), i.d(t, "Texture", function() { return ke.a }), i.d(t, "UniformBuffer", function() { return di.a }), i.d(t, "MaterialFlags", function() { return or.a }), i.d(t, "BackgroundMaterial", function() { return dr }), i.d(t, "PBRMaterialDefines", function() { return Vr }), i.d(t, "PBRBaseMaterial", function() { return Gr }), i.d(t, "PBRBaseSimpleMaterial", function() { return rs }), i.d(t, "PBRMaterial", function() { return kr }), i.d(t, "PBRMetallicRoughnessMaterial", function() { return os }), i.d(t, "PBRSpecularGlossinessMaterial", function() { return ss }), i.d(t, "ColorGradingTexture", function() { return cs }), i.d(t, "DynamicTexture", function() { return Pi }), i.d(t, "ProceduralTexture", function() { return _s }), i.d(t, "RawCubeTexture", function() { return bs }), i.d(t, "RawTexture", function() { return je }), i.d(t, "RawTexture3D", function() { return Ts }), i.d(t, "RefractionTexture", function() { return Es }), i.d(t, "VideoTexture", function() { return io }), i.d(t, "HtmlElementTexture", function() { return As }), i.d(t, "_DDSTextureLoader", function() { return qr }), i.d(t, "_ENVTextureLoader", function() { return $r }), i.d(t, "_KTXTextureLoader", function() { return to }), i.d(t, "_TGATextureLoader", function() { return hs }), i.d(t, "CustomProceduralTexture", function() { return ms }), i.d(t, "NoiseProceduralTexture", function() { return ys }), i.d(t, "ProceduralTextureSceneComponent", function() { return fs }), i.d(t, "Scalar", function() { return D.a }), i.d(t, "ToGammaSpace", function() { return o.u }), i.d(t, "ToLinearSpace", function() { return o.v }), i.d(t, "Epsilon", function() { return o.h }), i.d(t, "Color3", function() { return o.e }), i.d(t, "Color4", function() { return o.f }), i.d(t, "Vector2", function() { return o.w }), i.d(t, "Vector3", function() { return o.x }), i.d(t, "Vector4", function() { return o.y }), i.d(t, "Size", function() { return o.r }), i.d(t, "Quaternion", function() { return o.q }), i.d(t, "Matrix", function() { return o.j }), i.d(t, "Plane", function() { return o.n }), i.d(t, "Viewport", function() { return o.z }), i.d(t, "Frustum", function() { return o.i }), i.d(t, "Space", function() { return o.s }), i.d(t, "Axis", function() { return o.c }), i.d(t, "BezierCurve", function() { return o.d }), i.d(t, "Orientation", function() { return o.k }), i.d(t, "Angle", function() { return o.a }), i.d(t, "Arc2", function() { return o.b }), i.d(t, "Path2", function() { return o.l }), i.d(t, "Path3D", function() { return o.m }), i.d(t, "Curve3", function() { return o.g }), i.d(t, "PositionNormalVertex", function() { return o.p }), i.d(t, "PositionNormalTextureVertex", function() { return o.o }), i.d(t, "Tmp", function() { return o.t }), i.d(t, "SphericalHarmonics", function() { return zr.a }), i.d(t, "SphericalPolynomial", function() { return zr.b }), i.d(t, "AbstractMesh", function() { return Fe.a }), i.d(t, "Buffer", function() { return Oi.a }), i.d(t, "VertexBuffer", function() { return Oi.b }), i.d(t, "CSG", function() { return Ns }), i.d(t, "Geometry", function() { return wo.a }), i.d(t, "GroundMesh", function() { return Ii }), i.d(t, "TrailMesh", function() { return Bs }), i.d(t, "InstancedMesh", function() { return Us.a }), i.d(t, "LinesMesh", function() { return Vs.b }), i.d(t, "InstancedLinesMesh", function() { return Vs.a }), i.d(t, "_CreationDataStorage", function() { return fe.b }), i.d(t, "_InstancesBatch", function() { return fe.c }), i.d(t, "Mesh", function() { return fe.a }), i.d(t, "VertexData", function() { return Mi.a }), i.d(t, "MeshBuilder", function() { return Js }), i.d(t, "SimplificationSettings", function() { return $s }), i.d(t, "SimplificationQueue", function() { return ea }), i.d(t, "SimplificationType", function() { return qs }), i.d(t, "SimplicationQueueSceneComponent", function() { return sa }), i.d(t, "Polygon", function() { return Hs }), i.d(t, "PolygonMeshBuilder", function() { return Ws }), i.d(t, "BaseSubMesh", function() { return Os.a }), i.d(t, "SubMesh", function() { return Os.b }), i.d(t, "MeshLODLevel", function() { return aa.a }), i.d(t, "TransformNode", function() { return _r.a }), i.d(t, "BoxBuilder", function() { return Mn.a }), i.d(t, "SphereBuilder", function() { return Ln.a }), i.d(t, "CylinderBuilder", function() { return Fi.a }), i.d(t, "LinesBuilder", function() { return wn.a }), i.d(t, "PlaneBuilder", function() { return fr.a }), i.d(t, "DataBuffer", function() { return ca.a }), i.d(t, "WebGLDataBuffer", function() { return la.a }), i.d(t, "DracoCompression", function() { return Ms }), i.d(t, "DiscBuilder", function() { return Gs }), i.d(t, "RibbonBuilder", function() { return Yo }), i.d(t, "HemisphereBuilder", function() { return Wn }), i.d(t, "TorusBuilder", function() { return wi }), i.d(t, "TorusKnotBuilder", function() { return ks }), i.d(t, "PolygonBuilder", function() { return Xs }), i.d(t, "ShapeBuilder", function() { return Ko }), i.d(t, "LatheBuilder", function() { return Ys }), i.d(t, "GroundBuilder", function() { return Di }), i.d(t, "TubeBuilder", function() { return Ks }), i.d(t, "PolyhedronBuilder", function() { return Vn }), i.d(t, "IcoSphereBuilder", function() { return Qs }), i.d(t, "DecalBuilder", function() { return Zs }), i.d(t, "MorphTarget", function() { return Vo }), i.d(t, "MorphTargetManager", function() { return Go }), i.d(t, "Node", function() { return F.a }), i.d(t, "Database", function() { return ha }), i.d(t, "BaseParticleSystem", function() { return ba }), i.d(t, "GPUParticleSystem", function() { return Ia }), i.d(t, "Particle", function() { return Ta }), i.d(t, "ParticleHelper", function() { return La }), i.d(t, "ParticleSystem", function() { return Ra }), i.d(t, "_IDoNeedToBeInTheBuild", function() { return 42 }), i.d(t, "ParticleSystemSet", function() { return Da }), i.d(t, "SolidParticle", function() { return wa }), i.d(t, "ModelShape", function() { return Fa }), i.d(t, "DepthSortedParticle", function() { return Na }), i.d(t, "SolidParticleSystem", function() { return Ua }), i.d(t, "SubEmitterType", function() { return ua }), i.d(t, "SubEmitter", function() { return Ea }), i.d(t, "BoxParticleEmitter", function() { return da }), i.d(t, "ConeParticleEmitter", function() { return fa }), i.d(t, "CylinderParticleEmitter", function() { return pa }), i.d(t, "CylinderDirectedParticleEmitter", function() { return _a }), i.d(t, "HemisphericParticleEmitter", function() { return ga }), i.d(t, "PointParticleEmitter", function() { return ma }), i.d(t, "SphereParticleEmitter", function() { return va }), i.d(t, "SphereDirectedParticleEmitter", function() { return ya }), i.d(t, "PhysicsEngine", function() { return jo }), i.d(t, "PhysicsEngineSceneComponent", function() { return ka }), i.d(t, "PhysicsHelper", function() { return za }), i.d(t, "PhysicsRadialExplosionEventOptions", function() { return Ya }), i.d(t, "PhysicsUpdraftEventOptions", function() { return Ka }), i.d(t, "PhysicsVortexEventOptions", function() { return Qa }), i.d(t, "PhysicsRadialImpulseFalloff", function() { return Va }), i.d(t, "PhysicsUpdraftMode", function() { return Ga }), i.d(t, "PhysicsImpostor", function() { return ko.a }), i.d(t, "PhysicsJoint", function() { return zo.e }), i.d(t, "DistanceJoint", function() { return zo.a }), i.d(t, "MotorEnabledJoint", function() { return zo.d }), i.d(t, "HingeJoint", function() { return zo.c }), i.d(t, "Hinge2Joint", function() { return zo.b }), i.d(t, "CannonJSPlugin", function() { return Wo }), i.d(t, "AmmoJSPlugin", function() { return Qo }), i.d(t, "OimoJSPlugin", function() { return Xo }), i.d(t, "AnaglyphPostProcess", function() { return qt }), i.d(t, "BlackAndWhitePostProcess", function() { return Za }), i.d(t, "BloomEffect", function() { return nc }), i.d(t, "BloomMergePostProcess", function() { return ic }), i.d(t, "BlurPostProcess", function() { return $n }), i.d(t, "ChromaticAberrationPostProcess", function() { return oc }), i.d(t, "CircleOfConfusionPostProcess", function() { return ac }), i.d(t, "ColorCorrectionPostProcess", function() { return lc }), i.d(t, "ConvolutionPostProcess", function() { return hc }), i.d(t, "DepthOfFieldBlurPostProcess", function() { return dc }), i.d(t, "DepthOfFieldEffectBlurLevel", function() { return pc }), i.d(t, "DepthOfFieldEffect", function() { return mc }), i.d(t, "DepthOfFieldMergePostProcessOptions", function() { return _c }), i.d(t, "DepthOfFieldMergePostProcess", function() { return gc }), i.d(t, "DisplayPassPostProcess", function() { return yc }), i.d(t, "ExtractHighlightsPostProcess", function() { return ec }), i.d(t, "FilterPostProcess", function() { return Tc }), i.d(t, "FxaaPostProcess", function() { return xc }), i.d(t, "GrainPostProcess", function() { return Pc }), i.d(t, "HighlightsPostProcess", function() { return Cc }), i.d(t, "ImageProcessingPostProcess", function() { return Ci }), i.d(t, "MotionBlurPostProcess", function() { return wc }), i.d(t, "PassPostProcess", function() { return Yt }), i.d(t, "PassCubePostProcess", function() { return Kt }), i.d(t, "PostProcess", function() { return Ht }), i.d(t, "PostProcessManager", function() { return fi.a }), i.d(t, "RefractionPostProcess", function() { return Nc }), i.d(t, "SharpenPostProcess", function() { return Uc }), i.d(t, "StereoscopicInterlacePostProcess", function() { return ii }), i.d(t, "TonemappingOperator", function() { return el }), i.d(t, "TonemapPostProcess", function() { return tl }), i.d(t, "VolumetricLightScatteringPostProcess", function() { return ol }), i.d(t, "VRDistortionCorrectionPostProcess", function() { return ui }), i.d(t, "VRMultiviewToSingleviewPostProcess", function() { return mi }), i.d(t, "PostProcessRenderEffect", function() { return Ja }), i.d(t, "PostProcessRenderPipeline", function() { return Vc }), i.d(t, "PostProcessRenderPipelineManager", function() { return Gc }), i.d(t, "PostProcessRenderPipelineManagerSceneComponent", function() { return kc }), i.d(t, "DefaultRenderingPipeline", function() { return zc }), i.d(t, "LensRenderingPipeline", function() { return Wc }), i.d(t, "SSAO2RenderingPipeline", function() { return Kc }), i.d(t, "SSAORenderingPipeline", function() { return qc }), i.d(t, "StandardRenderingPipeline", function() { return Jc }), i.d(t, "ReflectionProbe", function() { return qo }), i.d(t, "BoundingBoxRenderer", function() { return sl }), i.d(t, "DepthRenderer", function() { return cl }), i.d(t, "DepthRendererSceneComponent", function() { return ll }), i.d(t, "EdgesRenderer", function() { return fl }), i.d(t, "LineEdgesRenderer", function() { return pl }), i.d(t, "GeometryBufferRenderer", function() { return Ic }), i.d(t, "GeometryBufferRendererSceneComponent", function() { return Dc }), i.d(t, "OutlineRenderer", function() { return ml }), i.d(t, "RenderingGroup", function() { return vl.a }), i.d(t, "RenderingGroupInfo", function() { return pi.a }), i.d(t, "RenderingManager", function() { return pi.b }), i.d(t, "UtilityLayerRenderer", function() { return In.a }), i.d(t, "Scene", function() { return W.a }), i.d(t, "SceneComponentConstants", function() { return Ae.a }), i.d(t, "Stage", function() { return Ae.b }), i.d(t, "Sprite", function() { return yl }), i.d(t, "SpriteManager", function() { return xl }), i.d(t, "SpriteSceneComponent", function() { return bl }), i.d(t, "_AlphaState", function() { return Rl.a }), i.d(t, "_DepthCullingState", function() { return Rl.b }), i.d(t, "_StencilState", function() { return Rl.c }), i.d(t, "AndOrNotEvaluator", function() { return Pl.a }), i.d(t, "AssetTaskState", function() { return Al }), i.d(t, "AbstractAssetTask", function() { return Cl }), i.d(t, "AssetsProgressEvent", function() { return Ml }), i.d(t, "MeshAssetTask", function() { return Ol }), i.d(t, "TextFileAssetTask", function() { return Il }), i.d(t, "BinaryFileAssetTask", function() { return Dl }), i.d(t, "ImageAssetTask", function() { return Ll }), i.d(t, "TextureAssetTask", function() { return wl }), i.d(t, "CubeTextureAssetTask", function() { return Fl }), i.d(t, "HDRCubeTextureAssetTask", function() { return Nl }), i.d(t, "EquiRectangularCubeTextureAssetTask", function() { return Bl }), i.d(t, "AssetsManager", function() { return Ul }), i.d(t, "DDSTools", function() { return Qr }), i.d(t, "expandToProperty", function() { return L.b }), i.d(t, "serialize", function() { return L.c }), i.d(t, "serializeAsTexture", function() { return L.m }), i.d(t, "serializeAsColor3", function() { return L.e }), i.d(t, "serializeAsFresnelParameters", function() { return L.h }), i.d(t, "serializeAsVector2", function() { return L.n }), i.d(t, "serializeAsVector3", function() { return L.o }), i.d(t, "serializeAsMeshReference", function() { return L.k }), i.d(t, "serializeAsColorCurves", function() { return L.g }), i.d(t, "serializeAsColor4", function() { return L.f }), i.d(t, "serializeAsImageProcessingConfiguration", function() { return L.i }), i.d(t, "serializeAsQuaternion", function() { return L.l }), i.d(t, "serializeAsMatrix", function() { return L.j }), i.d(t, "serializeAsCameraReference", function() { return L.d }), i.d(t, "SerializationHelper", function() { return L.a }), i.d(t, "Deferred", function() { return Vl }), i.d(t, "EnvironmentTextureTools", function() { return Jr }), i.d(t, "MeshExploder", function() { return Gl }), i.d(t, "FilesInput", function() { return kl }), i.d(t, "KhronosTextureContainer", function() { return eo }), i.d(t, "EventState", function() { return r.a }), i.d(t, "Observer", function() { return r.d }), i.d(t, "MultiObserver", function() { return r.b }), i.d(t, "Observable", function() { return r.c }), i.d(t, "PerformanceMonitor", function() { return zl.a }), i.d(t, "RollingAverage", function() { return zl.b }), i.d(t, "PromisePolyfill", function() { return jl.a }), i.d(t, "SceneOptimization", function() { return Hl }), i.d(t, "TextureOptimization", function() { return Wl }), i.d(t, "HardwareScalingOptimization", function() { return Xl }), i.d(t, "ShadowsOptimization", function() { return Yl }), i.d(t, "PostProcessesOptimization", function() { return Kl }), i.d(t, "LensFlaresOptimization", function() { return Ql }), i.d(t, "CustomOptimization", function() { return ql }), i.d(t, "ParticlesOptimization", function() { return Zl }), i.d(t, "RenderTargetsOptimization", function() { return Jl }), i.d(t, "MergeMeshesOptimization", function() { return $l }), i.d(t, "SceneOptimizerOptions", function() { return eu }), i.d(t, "SceneOptimizer", function() { return tu }), i.d(t, "SceneSerializer", function() { return ou }), i.d(t, "SmartArray", function() { return kt.a }), i.d(t, "SmartArrayNoDuplicate", function() { return kt.b }), i.d(t, "StringDictionary", function() { return gt.a }), i.d(t, "Tags", function() { return su.a }), i.d(t, "TextureTools", function() { return au }), i.d(t, "TGATools", function() { return us }), i.d(t, "ColorGradient", function() { return ye.c }), i.d(t, "Color3Gradient", function() { return ye.b }), i.d(t, "FactorGradient", function() { return ye.d }), i.d(t, "LoadFileError", function() { return ye.e }), i.d(t, "RetryStrategy", function() { return ye.g }), i.d(t, "Tools", function() { return ye.h }), i.d(t, "PerfCounter", function() { return ye.f }), i.d(t, "className", function() { return ye.i }), i.d(t, "AsyncLoop", function() { return ye.a }), i.d(t, "VideoRecorder", function() { return cu }), i.d(t, "JoystickAxis", function() { return _t }), i.d(t, "VirtualJoystick", function() { return mt }), i.d(t, "WorkerPool", function() { return xs }), i.d(t, "Logger", function() { return p.a }), i.d(t, "_TypeStore", function() { return s.a }), i.d(t, "FilesInputStore", function() { return mn.a }), i.d(t, "DeepCopier", function() { return S.a }), i.d(t, "PivotTools", function() { return Be.a }), i.d(t, "PrecisionDate", function() { return X.a }), i.d(t, "ScreenshotTools", function() { return lu }), i.d(t, "WebRequest", function() { return gs.a }), i.d(t, "InspectableType", function() { return Sl }), i.d(t, "CubeMapToSphericalPolynomialTools", function() { return jr.a }), i.d(t, "HDRTools", function() { return Bo }), i.d(t, "PanoramaToCubeMapTools", function() { return No }) }, function(e, t, i) { "use strict"; var n = "fogFragmentDeclaration", r = "#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"; i(5).a.IncludesShadersStore[n] = r }, function(e, t, i) { "use strict"; var n = "#ifdef FOG\nfloat fog=CalcFogFactor();\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\n#endif"; i(5).a.IncludesShadersStore.fogFragment = n }, function(e, t, i) { "use strict"; var n = "fogVertexDeclaration", r = "#ifdef FOG\nvarying vec3 vFogDistance;\n#endif"; i(5).a.IncludesShadersStore[n] = r }, function(e, t, i) { "use strict"; var n = "morphTargetsVertexGlobalDeclaration", r = "#ifdef MORPHTARGETS\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\n#endif"; i(5).a.IncludesShadersStore[n] = r }, function(e, t, i) { "use strict"; var n = "morphTargetsVertexDeclaration", r = "#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"; i(5).a.IncludesShadersStore[n] = r }, function(e, t, i) { "use strict"; var n = "morphTargetsVertex", r = "#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"; i(5).a.IncludesShadersStore[n] = r }, 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 s = e._SimplifyNegation(r[o].trim()), a = s.split("&&"); if (a.length > 1) for (var c = 0; c < a.length; ++c) { var l = e._SimplifyNegation(a[c].trim()); if (!(n = "true" !== l && "false" !== l ? "!" === l[0] ? !i(l.substring(1)) : i(l) : "true" === l)) { s = "false"; break } } if (n || "true" === s) { n = !0; break } n = "true" !== s && "false" !== s ? "!" === s[0] ? !i(s.substring(1)) : i(s) : "true" === s } 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 = !0, 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 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "averageFrameTimeVariance", { get: function() { return this._rollingFrameTime.variance }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "instantaneousFrameTime", { get: function() { return this._rollingFrameTime.history(0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "averageFPS", { get: function() { return 1e3 / this._rollingFrameTime.average }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "instantaneousFPS", { get: function() { var e = this._rollingFrameTime.history(0); return 0 === e ? 0 : 1e3 / e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "isSaturated", { get: function() { return this._rollingFrameTime.isSaturated() }, enumerable: !0, configurable: !0 }), e.prototype.enable = function() { this._enabled = !0 }, e.prototype.disable = function() { this._enabled = !1, this._lastFrameTimeMs = null }, Object.defineProperty(e.prototype, "isEnabled", { get: function() { return this._enabled }, enumerable: !0, configurable: !0 }), 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, 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, i) { "use strict"; i.d(t, "a", function() { return a }); var n, r = i(9); ! function(e) { e[e.Pending = 0] = "Pending", e[e.Fulfilled = 1] = "Fulfilled", e[e.Rejected = 2] = "Rejected" }(n || (n = {})); var o = function() { return function() { this.count = 0, this.target = 0, this.results = [] } }(), s = function() { function e(e) { var t = this; if (this._state = n.Pending, this._children = new Array, this._rejectWasConsumed = !1, 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: !0, configurable: !0 }), e.prototype.catch = function(e) { return this.then(void 0, e) }, e.prototype.then = function(t, i) { var o = this, s = new e; return s._onFulfilled = t, s._onRejected = i, this._children.push(s), s._parent = this, this._state !== n.Pending && r.h.SetImmediate(function() { if (o._state === n.Fulfilled || o._rejectWasConsumed) { var e = s._resolve(o._result); if (null != e) if (void 0 !== e._state) { var t = e; s._children.push(t), t._parent = s, s = t } else s._result = e } else s._reject(o._reason) }), s }, 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 === n.Fulfilled) for (var r = 0, o = this._children; r < o.length; r++) { o[r]._resolve(this._result) } else if (this._state === n.Rejected) for (var s = 0, a = this._children; s < a.length; s++) { a[s]._reject(this._reason) } }, e.prototype._resolve = function(e) { try { this._state = n.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 r = 0, o = this._children; r < o.length; r++) { o[r]._resolve(e) } this._children.length = 0, delete this._onFulfilled, delete this._onRejected } catch (e) { this._reject(e, !0) } }, e.prototype._reject = function(e, t) { if (void 0 === t && (t = !1), this._state = n.Rejected, this._reason = e, this._onRejected && !t) try { this._onRejected(e), this._rejectWasConsumed = !0 } catch (t) { e = t } for (var i = 0, r = this._children; i < r.length; i++) { var o = r[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, t.count++, t.count === t.target && t.rootPromise._resolve(t.results), null }, function(e) { t.rootPromise._state !== n.Rejected && t.rootPromise._reject(e) }) }, e.all = function(t) { var i = new e, n = new o; 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 }(), a = function() { function e() {} return e.Apply = function(e) { (void 0 === e && (e = !1), e || "undefined" == typeof Promise) && (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 }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "isReady", { get: function() { return !!this.program && (!this.isParallelCompiled || this.engine._isRenderingStateCompiled(this)) }, enumerable: !0, configurable: !0 }), 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() { return function() { this._checkCollisions = !1, 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 s }); var n = i(28), r = i(0), o = i(3), s = 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: !0, configurable: !0 }), Object.defineProperty(e.prototype, "alphaTestSortCompareFn", { set: function(t) { this._alphaTestSortCompareFn = t, this._renderAlphaTest = t ? this.renderAlphaTestSorted : e.renderUnsorted }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "transparentSortCompareFn", { set: function(t) { this._transparentSortCompareFn = t || e.defaultTransparentSortCompare, this._renderTransparent = this.renderTransparentSorted }, enumerable: !0, configurable: !0 }), 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(!1), this._renderAlphaTest(this._depthOnlySubMeshes), r.setColorWrite(!0)), 0 !== this._opaqueSubMeshes.length && this._renderOpaque(this._opaqueSubMeshes), 0 !== this._alphaTestSubMeshes.length && this._renderAlphaTest(this._alphaTestSubMeshes); var s = r.getStencilBuffer(); if (r.setStencilBuffer(!1), 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(!1), this._edgesRenderers.length) { for (var a = 0; a < this._edgesRenderers.length; a++) this._edgesRenderers.data[a].render(); r.setAlphaMode(o.a.ALPHA_DISABLE) } r.setStencilBuffer(s) } }, e.prototype.renderOpaqueSorted = function(t) { return e.renderSorted(t, this._opaqueSortCompareFn, this._scene.activeCamera, !1) }, e.prototype.renderAlphaTestSorted = function(t) { return e.renderSorted(t, this._alphaTestSortCompareFn, this._scene.activeCamera, !1) }, e.prototype.renderTransparentSorted = function(t) { return e.renderSorted(t, this._transparentSortCompareFn, this._scene.activeCamera, !0) }, e.renderSorted = function(e, t, i, n) { for (var s, a = 0, c = i ? i.globalPosition : r.x.Zero(); a < e.length; a++)(s = e.data[a])._alphaIndex = s.getMesh().alphaIndex, s._distanceToCamera = s.getBoundingInfo().boundingSphere.centerWorld.subtract(c).length(); var l = e.data.slice(0, e.length); for (t && l.sort(t), a = 0; a < l.length; a++) { if (s = l[a], n) { var u = s.getMaterial(); if (u && u.needDepthPrePass) { var h = u.getScene().getEngine(); h.setColorWrite(!1), h.setAlphaMode(o.a.ALPHA_DISABLE), s.render(!1), h.setColorWrite(!0) } } s.render(n) } }, e.renderUnsorted = function(e) { for (var t = 0; t < e.length; t++) { e.data[t].render(!1) } }, 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._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()), 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(), !1) } } 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() { return function(e, t) { this.distance = e, this.mesh = t } }() }, function(e, t, i) { "use strict"; i.d(t, "a", function() { return u }); var n = i(1), r = i(0), o = i(6), s = i(24), a = i(11), c = i(32), l = i(42); a.a._instancedMeshFactory = function(e, t) { return new u(e, t) }; var u = 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 } return n.d(t, e), t.prototype.getClassName = function() { return "InstancedMesh" }, Object.defineProperty(t.prototype, "lightSources", { get: function() { return this._sourceMesh._lightSources }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), Object.defineProperty(t.prototype, "material", { get: function() { return this._sourceMesh.material }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "visibility", { get: function() { return this._sourceMesh.visibility }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "skeleton", { get: function() { return this._sourceMesh.skeleton }, enumerable: !0, configurable: !0 }), 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: !0, configurable: !0 }), 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: !0, configurable: !0 }), t.prototype.isReady = function(e) { return void 0 === e && (e = !1), this._sourceMesh.isReady(e, !0) }, 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: !0, configurable: !0 }), t.prototype.refreshBoundingInfo = function(e) { if (void 0 === e && (e = !1), 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 = !0, !0 } else if (!this._currentLOD._internalAbstractMeshDataInfo._isActive) return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances = !0, !0; return !1 }, 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 !== l.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(!0)), this._currentLOD._masterMesh = t, r.t.Matrix[0] } return e.prototype.getWorldMatrix.call(this) }, Object.defineProperty(t.prototype, "isAnInstance", { get: function() { return !0 }, enumerable: !0, configurable: !0 }), 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(!0), n }, t.prototype.dispose = function(t, i) { void 0 === i && (i = !1), this._sourceMesh.removeInstance(this), e.prototype.dispose.call(this, t, i) }, t }(s.a) }, function(e, t, i) { "use strict"; var n = "shadowsFragmentFunctions", r = "#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 c && (clearInterval(e), MobileAdInGamePreroll.boxContents.close.css("left", MobileAdInGamePreroll.boxContents.body.width() - 23), MobileAdInGamePreroll.boxContents.close.show(), MobileAdInGamePreroll.boxContents.header.html(MobileAdInGamePreroll.close), MobileAdInGamePreroll.boxContents.footer.text("")) }, 1E3) }, Close: function() { this.boxContents.close.hide(); this.overlay.hide() } }; var MobileAdInGameHeader = { ad_duration: _SETTINGS.Ad.Mobile.Header.Duration, ad_width: _SETTINGS.Ad.Mobile.Header.Width, ad_height: _SETTINGS.Ad.Mobile.Header.Height, Initialize: function() { if (_SETTINGS.Ad.Mobile.Header.Rotation.Enabled) { var b = _SETTINGS.Ad.Mobile.Header.Rotation.Weight, c = b.MobileAdInGameHeader, e = c + b.MobileAdInGameHeader2, b = e + b.MobileAdInGameHeader3, d = Math.floor(100 * Math.random()); console.log("seed: ", d); d <= c ? this.selectedOverlayName = "MobileAdInGameHeader" : d <= e ? this.selectedOverlayName = "MobileAdInGameHeader2" : d <= b && (this.selectedOverlayName = "MobileAdInGameHeader3"); console.log("Ad rotating header enabled") } else this.selectedOverlayName = "MobileAdInGameHeader", console.log("Ad rotating header disabled"); this.div = $("#" + this.selectedOverlayName); this.game = $("#game"); this.div.width(this.ad_width); this.div.height(this.ad_height); this.div.css("left", this.game.position().left + (this.game.width() - this.div.width()) / 2); this.div.css("top", 0); this.div.show(this.Timer(this.ad_duration)) }, Timer: function(b) { var c = setInterval(function() { b--; 0 > b && (MobileAdInGameHeader.div.hide(), clearInterval(c)) }, 1E3) } }; var MobileAdInGameFooter = { ad_duration: _SETTINGS.Ad.Mobile.Footer.Duration, ad_width: _SETTINGS.Ad.Mobile.Footer.Width, ad_height: _SETTINGS.Ad.Mobile.Footer.Height, Initialize: function() { if (_SETTINGS.Ad.Mobile.Footer.Rotation.Enabled) { var b = _SETTINGS.Ad.Mobile.Footer.Rotation.Weight, c = b.MobileAdInGameFooter, e = c + b.MobileAdInGameFooter2, b = e + b.MobileAdInGameFooter3, d = Math.floor(100 * Math.random()); console.log("seed: ", d); d <= c ? this.selectedOverlayName = "MobileAdInGameFooter" : d <= e ? this.selectedOverlayName = "MobileAdInGameFooter2" : d <= b && (this.selectedOverlayName = "MobileAdInGameFooter3"); console.log("Ad rotating footer enabled") } else this.selectedOverlayName = "MobileAdInGameFooter", console.log("Ad rotating footer disabled"); this.div = $("#" + this.selectedOverlayName); this.game = $("#game"); this.div.width(this.ad_width); this.div.height(this.ad_height); this.div.css("left", this.game.position().left + (this.game.width() - this.div.width()) / 2); this.div.css("top", this.game.height() - this.div.height() - 5); this.div.show(this.Timer(this.ad_duration)) }, Timer: function(b) { var c = setInterval(function() { b--; 0 > b && (MobileAdInGameFooter.div.hide(), clearInterval(c)) }, 1E3) } }; var MobileAdInGameEnd = { ad_duration: _SETTINGS.Ad.Mobile.End.Duration, ad_width: _SETTINGS.Ad.Mobile.End.Width, ad_height: _SETTINGS.Ad.Mobile.End.Height, ready_in: _STRINGS.Ad.Mobile.End.ReadyIn, loading: _STRINGS.Ad.Mobile.End.Loading, close: _STRINGS.Ad.Mobile.End.Close + "          ", Initialize: function() { if (_SETTINGS.Ad.Mobile.End.Rotation.Enabled) { var b = _SETTINGS.Ad.Mobile.End.Rotation.Weight, c = b.MobileAdInGameEnd, e = c + b.MobileAdInGameEnd2, b = e + b.MobileAdInGameEnd3, d = Math.floor(100 * Math.random()); console.log("seed: ", d); d <= c ? this.selectedOverlayName = "MobileAdInGameEnd" : d <= e ? this.selectedOverlayName = "MobileAdInGameEnd2" : d <= b && (this.selectedOverlayName = "MobileAdInGameEnd3"); console.log("Ad rotating end enabled") } else this.selectedOverlayName = "MobileAdInGameEnd", console.log("Ad rotating end disabled"); console.log("selected:", this.selectedOverlayName); this.overlay = $("#" + this.selectedOverlayName); this.box = $("#" + this.selectedOverlayName + "-Box"); this.game = $("#game"); this.boxContents = { footer: $("#" + this.selectedOverlayName + "-Box-Footer"), header: $("#" + this.selectedOverlayName + "-Box-Header"), close: $("#" + this.selectedOverlayName + "-Box-Close"), body: $("#" + this.selectedOverlayName + "-Box-Body") }; this.box.width(this.ad_width); this.box.height(this.ad_height); this.box.css("left", (this.overlay.width() - this.box.width()) / 2); this.box.css("top", (this.overlay.height() - this.box.height() - this.boxContents.header.height() - this.boxContents.footer.height()) / 2); this.overlay.show(this.Timer(this.ad_duration)) }, Timer: function(b) { var c = b, e = setInterval(function() { MobileAdInGameEnd.boxContents.header.text(MobileAdInGameEnd.ready_in + c + "..."); MobileAdInGameEnd.boxContents.footer.text(MobileAdInGameEnd.loading); c--; 0 > c && (clearInterval(e), MobileAdInGameEnd.boxContents.close.css("left", MobileAdInGameEnd.boxContents.body.width() - 23), MobileAdInGameEnd.boxContents.close.show(), MobileAdInGameEnd.boxContents.header.html(MobileAdInGameEnd.close), MobileAdInGameEnd.boxContents.footer.text("")) }, 1E3) }, Close: function() { this.boxContents.close.hide(); this.overlay.hide() } }; ! function(b, c) { "object" == typeof module && "object" == typeof module.exports ? module.exports = b.document ? c(b, !0) : function(b) { if (!b.document) throw Error("jQuery requires a window with a document"); return c(b) } : c(b) }("undefined" != typeof window ? window : this, function(b, c) { function e(b, c) { c = c || M; var d = c.createElement("script"); d.text = b; c.head.appendChild(d).parentNode.removeChild(d) } function d(b) { var c = !!b && "length" in b && b.length, d = p.type(b); return "function" !== d && !p.isWindow(b) && ("array" === d || 0 === c || "number" == typeof c && 0 < c && c - 1 in b) } function g(b, c) { return b.nodeName && b.nodeName.toLowerCase() === c.toLowerCase() } function f(b, c, d) { return p.isFunction(c) ? p.grep(b, function(b, e) { return !!c.call(b, e, b) !== d }) : c.nodeType ? p.grep(b, function(b) { return b === c !== d }) : "string" != typeof c ? p.grep(b, function(b) { return -1 < Va.call(c, b) !== d }) : Ic.test(c) ? p.filter(c, b, d) : (c = p.filter(c, b), p.grep(b, function(b) { return -1 < Va.call(c, b) !== d && 1 === b.nodeType })) } function m(b, c) { for (; (b = b[c]) && 1 !== b.nodeType;); return b } function l(b) { return b } function j(b) { throw b; } function q(b, c, d, e) { var j; try { b && p.isFunction(j = b.promise) ? j.call(b).done(c).fail(d) : b && p.isFunction(j = b.then) ? j.call(b, c, d) : c.apply(void 0, [b].slice(e)) } catch (f) { d.apply(void 0, [f]) } } function n() { M.removeEventListener("DOMContentLoaded", n); b.removeEventListener("load", n); p.ready() } function r() { this.expando = p.expando + r.uid++ } function s(b, c, d) { var e; if (void 0 === d && 1 === b.nodeType) if (e = "data-" + c.replace(Jc, "-$&").toLowerCase(), d = b.getAttribute(e), "string" == typeof d) { try { d = "true" === d || "false" !== d && ("null" === d ? null : d === +d + "" ? +d : Kc.test(d) ? JSON.parse(d) : d) } catch (j) {} ka.set(b, c, d) } else d = void 0; return d } function t(b, c, d, e) { var j, f = 1, g = 20, n = e ? function() { return e.cur() } : function() { return p.css(b, c, "") }, q = n(), l = d && d[3] || (p.cssNumber[c] ? "" : "px"), r = (p.cssNumber[c] || "px" !== l && +q) && lb.exec(p.css(b, c)); if (r && r[3] !== l) { l = l || r[3]; d = d || []; r = +q || 1; do f = f || ".5", r /= f, p.style(b, c, r + l); while (f !== (f = n() / q) && 1 !== f && --g) } return d && (r = +r || +q || 0, j = d[1] ? r + (d[1] + 1) * d[2] : +d[2], e && (e.unit = l, e.start = r, e.end = j)), j } function u(b, c) { for (var d, e, j = [], f = 0, g = b.length; f < g; f++) if (e = b[f], e.style) if (d = e.style.display, c) { if ("none" === d && (j[f] = R.get(e, "display") || null, j[f] || (e.style.display = "")), "" === e.style.display && tb(e)) { d = j; var n = f, q, l = void 0; q = e.ownerDocument; var r = e.nodeName; q = (e = Yb[r]) ? e : (l = q.body.appendChild(q.createElement(r)), e = p.css(l, "display"), l.parentNode.removeChild(l), "none" === e && (e = "block"), Yb[r] = e, e); d[n] = q } } else "none" !== d && (j[f] = "none", R.set(e, "display", d)); for (f = 0; f < g; f++) null != j[f] && (b[f].style.display = j[f]); return b } function y(b, c) { var d; return d = "undefined" != typeof b.getElementsByTagName ? b.getElementsByTagName(c || "*") : "undefined" != typeof b.querySelectorAll ? b.querySelectorAll(c || "*") : [], void 0 === c || c && g(b, c) ? p.merge([b], d) : d } function z(b, c) { for (var d = 0, e = b.length; d < e; d++) R.set(b[d], "globalEval", !c || R.get(c[d], "globalEval")) } function x(b, c, d, e, j) { for (var f, g, n, q, l = c.createDocumentFragment(), r = [], s = 0, m = b.length; s < m; s++) if (f = b[s], f || 0 === f) if ("object" === p.type(f)) p.merge(r, f.nodeType ? [f] : f); else if (Lc.test(f)) { g = g || l.appendChild(c.createElement("div")); n = (Zb.exec(f) || ["", ""])[1].toLowerCase(); n = oa[n] || oa._default; g.innerHTML = n[1] + p.htmlPrefilter(f) + n[2]; for (n = n[0]; n--;) g = g.lastChild; p.merge(r, g.childNodes); g = l.firstChild; g.textContent = "" } else r.push(c.createTextNode(f)); l.textContent = ""; for (s = 0; f = r[s++];) if (e && -1 < p.inArray(f, e)) j && j.push(f); else if (q = p.contains(f.ownerDocument, f), g = y(l.appendChild(f), "script"), q && z(g), d) for (n = 0; f = g[n++];) $b.test(f.type || "") && d.push(f); return l } function C() { return !0 } function B() { return !1 } function E() { try { return M.activeElement } catch (b) {} } function G(b, c, d, e, j, f) { var g, n; if ("object" == typeof c) { "string" != typeof d && (e = e || d, d = void 0); for (n in c) G(b, n, d, e, c[n], f); return b } if (null == e && null == j ? (j = d, e = d = void 0) : null == j && ("string" == typeof d ? (j = e, e = void 0) : (j = e, e = d, d = void 0)), !1 === j) j = B; else if (!j) return b; return 1 === f && (g = j, j = function(b) { return p().off(b), g.apply(this, arguments) }, j.guid = g.guid || (g.guid = p.guid++)), b.each(function() { p.event.add(this, c, j, e, d) }) } function D(b, c) { return g(b, "table") && g(11 !== c.nodeType ? c : c.firstChild, "tr") ? p(">tbody", b)[0] || b : b } function A(b) { return b.type = (null !== b.getAttribute("type")) + "/" + b.type, b } function H(b) { var c = Mc.exec(b.type); return c ? b.type = c[1] : b.removeAttribute("type"), b } function O(b, c) { var d, e, j, f, g, n; if (1 === c.nodeType) { if (R.hasData(b) && (d = R.access(b), e = R.set(c, d), n = d.events)) for (j in delete e.handle, e.events = {}, n) { d = 0; for (e = n[j].length; d < e; d++) p.event.add(c, j, n[j][d]) } ka.hasData(b) && (f = ka.access(b), g = p.extend({}, f), ka.set(c, g)) } } function K(b, c, d, j) { c = Ha.apply([], c); var f, g, n, q, l = 0, r = b.length, s = r - 1, m = c[0], t = p.isFunction(m); if (t || 1 < r && "string" == typeof m && !W.checkClone && Nc.test(m)) return b.each(function(e) { var f = b.eq(e); t && (c[0] = m.call(this, e, f.html())); K(f, c, d, j) }); if (r && (f = x(c, b[0].ownerDocument, !1, b, j), g = f.firstChild, 1 === f.childNodes.length && (f = g), g || j)) { g = p.map(y(f, "script"), A); for (n = g.length; l < r; l++) q = f, l !== s && (q = p.clone(q, !0, !0), n && p.merge(g, y(q, "script"))), d.call(b[l], q, l); if (n) { f = g[g.length - 1].ownerDocument; p.map(g, H); for (l = 0; l < n; l++) q = g[l], $b.test(q.type || "") && !R.access(q, "globalEval") && p.contains(f, q) && (q.src ? p._evalUrl && p._evalUrl(q.src) : e(q.textContent.replace(Pc, ""), f)) } } return b } function S(b, c, d) { for (var e = c ? p.filter(c, b) : b, j = 0; null != (c = e[j]); j++) d || 1 !== c.nodeType || p.cleanData(y(c)), c.parentNode && (d && p.contains(c.ownerDocument, c) && z(y(c, "script")), c.parentNode.removeChild(c)); return b } function J(b, c, d) { var e, j, f, g, n = b.style; return d = d || ub(b), d && (g = d.getPropertyValue(c) || d[c], "" !== g || p.contains(b.ownerDocument, b) || (g = p.style(b, c)), !W.pixelMarginRight() && Lb.test(g) && ac.test(c) && (e = n.width, j = n.minWidth, f = n.maxWidth, n.minWidth = n.maxWidth = n.width = g, g = d.width, n.width = e, n.minWidth = j, n.maxWidth = f)), void 0 !== g ? g + "" : g } function Y(b, c) { return { get: function() { return b() ? void delete this.get : (this.get = c).apply(this, arguments) } } } function ca(b) { var c = p.cssProps[b]; if (!c) { var c = p.cssProps, d; a: if (d = b, !(d in bc)) { for (var e = d[0].toUpperCase() + d.slice(1), j = cc.length; j--;) if (d = cc[j] + e, d in bc) break a; d = void 0 } c = c[b] = d || b } return c } function F(b, c, d) { return (b = lb.exec(c)) ? Math.max(0, b[2] - (d || 0)) + (b[3] || "px") : c } function N(b, c, d, e, j) { var f = 0; for (c = d === (e ? "border" : "content") ? 4 : "width" === c ? 1 : 0; 4 > c; c += 2) "margin" === d && (f += p.css(b, d + Wa[c], !0, j)), e ? ("content" === d && (f -= p.css(b, "padding" + Wa[c], !0, j)), "margin" !== d && (f -= p.css(b, "border" + Wa[c] + "Width", !0, j))) : (f += p.css(b, "padding" + Wa[c], !0, j), "padding" !== d && (f += p.css(b, "border" + Wa[c] + "Width", !0, j))); return f } function da(b, c, d) { var e, j = ub(b), f = J(b, c, j), g = "border-box" === p.css(b, "boxSizing", !1, j); return Lb.test(f) ? f : (e = g && (W.boxSizingReliable() || f === b.style[c]), "auto" === f && (f = b["offset" + c[0].toUpperCase() + c.slice(1)]), f = parseFloat(f) || 0, f + N(b, c, d || (g ? "border" : "content"), e, j) + "px") } function T(b, c, d, e, j) { return new T.prototype.init(b, c, d, e, j) } function P() { vb && (!1 === M.hidden && b.requestAnimationFrame ? b.requestAnimationFrame(P) : b.setTimeout(P, p.fx.interval), p.fx.tick()) } function L() { return b.setTimeout(function() { bb = void 0 }), bb = p.now() } function I(b, c) { var d, e = 0, j = { height: b }; for (c = c ? 1 : 0; 4 > e; e += 2 - c) d = Wa[e], j["margin" + d] = j["padding" + d] = b; return c && (j.opacity = j.width = b), j } function X(b, c, d) { for (var e, j = (aa.tweeners[c] || []).concat(aa.tweeners["*"]), f = 0, g = j.length; f < g; f++) if (e = j[f].call(d, c, b)) return e } function aa(b, c, d) { var e, j, f = 0, g = aa.prefilters.length, n = p.Deferred().always(function() { delete q.elem }), q = function() { if (j) return !1; for (var c = bb || L(), c = Math.max(0, l.startTime + l.duration - c), d = 1 - (c / l.duration || 0), e = 0, f = l.tweens.length; e < f; e++) l.tweens[e].run(d); return n.notifyWith(b, [l, d, c]), 1 > d && f ? c : (f || n.notifyWith(b, [l, 1, 0]), n.resolveWith(b, [l]), !1) }, l = n.promise({ elem: b, props: p.extend({}, c), opts: p.extend(!0, { specialEasing: {}, easing: p.easing._default }, d), originalProperties: c, originalOptions: d, startTime: bb || L(), duration: d.duration, tweens: [], createTween: function(c, d) { var e = p.Tween(b, l.opts, c, d, l.opts.specialEasing[c] || l.opts.easing); return l.tweens.push(e), e }, stop: function(c) { var d = 0, e = c ? l.tweens.length : 0; if (j) return this; for (j = !0; d < e; d++) l.tweens[d].run(1); return c ? (n.notifyWith(b, [l, 1, 0]), n.resolveWith(b, [l, c])) : n.rejectWith(b, [l, c]), this } }); c = l.props; d = l.opts.specialEasing; var r, s, m, t; for (e in c) if (r = p.camelCase(e), s = d[r], m = c[e], Array.isArray(m) && (s = m[1], m = c[e] = m[0]), e !== r && (c[r] = m, delete c[e]), t = p.cssHooks[r], t && "expand" in t) for (e in m = t.expand(m), delete c[r], m) e in c || (c[e] = m[e], d[e] = s); else d[r] = s; for (; f < g; f++) if (e = aa.prefilters[f].call(l, b, c, l.opts)) return p.isFunction(e.stop) && (p._queueHooks(l.elem, l.opts.queue).stop = p.proxy(e.stop, e)), e; return p.map(c, X, l), p.isFunction(l.opts.start) && l.opts.start.call(b, l), l.progress(l.opts.progress).done(l.opts.done, l.opts.complete).fail(l.opts.fail).always(l.opts.always), p.fx.timer(p.extend(q, { elem: b, anim: l, queue: l.opts.queue })), l } function la(b) { return (b.match(pa) || []).join(" ") } function qa(b) { return b.getAttribute && b.getAttribute("class") || "" } function ea(b, c, d, e) { var j; if (Array.isArray(c)) p.each(c, function(c, j) { d || Qc.test(b) ? e(b, j) : ea(b + "[" + ("object" == typeof j && null != j ? c : "") + "]", j, d, e) }); else if (d || "object" !== p.type(c)) e(b, c); else for (j in c) ea(b + "[" + j + "]", c[j], d, e) } function va(b) { return function(c, d) { "string" != typeof c && (d = c, c = "*"); var e, j = 0, f = c.toLowerCase().match(pa) || []; if (p.isFunction(d)) for (; e = f[j++];) "+" === e[0] ? (e = e.slice(1) || "*", (b[e] = b[e] || []).unshift(d)) : (b[e] = b[e] || []).push(d) } } function wa(b, c, d, e) { function j(n) { var q; return f[n] = !0, p.each(b[n] || [], function(b, fa) { var n = fa(c, d, e); return "string" != typeof n || g || f[n] ? g ? !(q = n) : void 0 : (c.dataTypes.unshift(n), j(n), !1) }), q } var f = {}, g = b === Mb; return j(c.dataTypes[0]) || !f["*"] && j("*") } function Na(b, c) { var d, e, j = p.ajaxSettings.flatOptions || {}; for (d in c) void 0 !== c[d] && ((j[d] ? b : e || (e = {}))[d] = c[d]); return e && p.extend(!0, b, e), b } var ma = [], M = b.document, Xa = Object.getPrototypeOf, ja = ma.slice, Ha = ma.concat, Oa = ma.push, Va = ma.indexOf, cb = {}, wb = cb.toString, db = cb.hasOwnProperty, xb = db.toString, Nb = xb.call(Object), W = {}, p = function(b, c) { return new p.fn.init(b, c) }, Ob = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, Pb = /^-ms-/, Ca = /-([a-z])/g, Ia = function(b, c) { return c.toUpperCase() }; p.fn = p.prototype = { jquery: "3.2.1", constructor: p, length: 0, toArray: function() { return ja.call(this) }, get: function(b) { return null == b ? ja.call(this) : 0 > b ? this[b + this.length] : this[b] }, pushStack: function(b) { b = p.merge(this.constructor(), b); return b.prevObject = this, b }, each: function(b) { return p.each(this, b) }, map: function(b) { return this.pushStack(p.map(this, function(c, d) { return b.call(c, d, c) })) }, slice: function() { return this.pushStack(ja.apply(this, arguments)) }, first: function() { return this.eq(0) }, last: function() { return this.eq(-1) }, eq: function(b) { var c = this.length; b = +b + (0 > b ? c : 0); return this.pushStack(0 <= b && b < c ? [this[b]] : []) }, end: function() { return this.prevObject || this.constructor() }, push: Oa, sort: ma.sort, splice: ma.splice }; p.extend = p.fn.extend = function() { var b, c, d, e, j, f, g = arguments[0] || {}, n = 1, q = arguments.length, l = !1; "boolean" == typeof g && (l = g, g = arguments[n] || {}, n++); "object" == typeof g || p.isFunction(g) || (g = {}); for (n === q && (g = this, n--); n < q; n++) if (null != (b = arguments[n])) for (c in b) d = g[c], e = b[c], g !== e && (l && e && (p.isPlainObject(e) || (j = Array.isArray(e))) ? (j ? (j = !1, f = d && Array.isArray(d) ? d : []) : f = d && p.isPlainObject(d) ? d : {}, g[c] = p.extend(l, f, e)) : void 0 !== e && (g[c] = e)); return g }; p.extend({ expando: "jQuery" + ("3.2.1" + Math.random()).replace(/\D/g, ""), isReady: !0, error: function(b) { throw Error(b); }, noop: function() {}, isFunction: function(b) { return "function" === p.type(b) }, isWindow: function(b) { return null != b && b === b.window }, isNumeric: function(b) { var c = p.type(b); return ("number" === c || "string" === c) && !isNaN(b - parseFloat(b)) }, isPlainObject: function(b) { var c, d; return !(!b || "[object Object]" !== wb.call(b)) && (!(c = Xa(b)) || (d = db.call(c, "constructor") && c.constructor, "function" == typeof d && xb.call(d) === Nb)) }, isEmptyObject: function(b) { for (var c in b) return !1; return !0 }, type: function(b) { return null == b ? b + "" : "object" == typeof b || "function" == typeof b ? cb[wb.call(b)] || "object" : typeof b }, globalEval: function(b) { e(b) }, camelCase: function(b) { return b.replace(Pb, "ms-").replace(Ca, Ia) }, each: function(b, c) { var e, j = 0; if (d(b)) for (e = b.length; j < e && !1 !== c.call(b[j], j, b[j]); j++); else for (j in b) if (!1 === c.call(b[j], j, b[j])) break; return b }, trim: function(b) { return null == b ? "" : (b + "").replace(Ob, "") }, makeArray: function(b, c) { var e = c || []; return null != b && (d(Object(b)) ? p.merge(e, "string" == typeof b ? [b] : b) : Oa.call(e, b)), e }, inArray: function(b, c, d) { return null == c ? -1 : Va.call(c, b, d) }, merge: function(b, c) { for (var d = +c.length, e = 0, j = b.length; e < d; e++) b[j++] = c[e]; return b.length = j, b }, grep: function(b, c, d) { for (var e = [], j = 0, f = b.length, g = !d; j < f; j++) d = !c(b[j], j), d !== g && e.push(b[j]); return e }, map: function(b, c, e) { var j, f, g = 0, n = []; if (d(b)) for (j = b.length; g < j; g++) f = c(b[g], g, e), null != f && n.push(f); else for (g in b) f = c(b[g], g, e), null != f && n.push(f); return Ha.apply([], n) }, guid: 1, proxy: function(b, c) { var d, e, j; if ("string" == typeof c && (d = b[c], c = b, b = d), p.isFunction(b)) return e = ja.call(arguments, 2), j = function() { return b.apply(c || this, e.concat(ja.call(arguments))) }, j.guid = b.guid = b.guid || p.guid++, j }, now: Date.now, support: W }); "function" == typeof Symbol && (p.fn[Symbol.iterator] = ma[Symbol.iterator]); p.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function(b, c) { cb["[object " + c + "]"] = c.toLowerCase() }); var ra, mb = b, V = function(b, c, d, e) { var j, f, g, n, q, l = c && c.ownerDocument, r = c ? c.nodeType : 9; if (d = d || [], "string" != typeof b || !b || 1 !== r && 9 !== r && 11 !== r) return d; if (!e && ((c ? c.ownerDocument || c : sa) !== U && Pa(c), c = c || U, ta)) { if (11 !== r && (n = Rc.exec(b))) if (j = n[1]) if (9 === r) { if (!(f = c.getElementById(j))) return d; if (f.id === j) return d.push(f), d } else { if (l && (f = l.getElementById(j)) && nb(c, f) && f.id === j) return d.push(f), d } else { if (n[2]) return Qa.apply(d, c.getElementsByTagName(b)), d; if ((j = n[3]) && ba.getElementsByClassName && c.getElementsByClassName) return Qa.apply(d, c.getElementsByClassName(j)), d } if (ba.qsa && !yb[b + " "] && (!ia || !ia.test(b))) { if (1 !== r) l = c, q = b; else if ("object" !== c.nodeName.toLowerCase()) { (g = c.getAttribute("id")) ? g = g.replace(dc, ec): c.setAttribute("id", g = Z); f = ob(b); for (j = f.length; j--;) f[j] = "#" + g + " " + xa(f[j]); q = f.join(","); l = Qb.test(b) && Da(c.parentNode) || c } if (q) try { return Qa.apply(d, l.querySelectorAll(q)), d } catch (s) {} finally { g === Z && c.removeAttribute("id") } } } return fc(b.replace(zb, "$1"), c, d, e) }, Ra = function() { function b(d, e) { return c.push(d + " ") > Q.cacheLength && delete b[c.shift()], b[d + " "] = e } var c = []; return b }, ha = function(b) { return b[Z] = !0, b }, na = function(b) { var c = U.createElement("fieldset"); try { return !!b(c) } catch (d) { return !1 } finally { c.parentNode && c.parentNode.removeChild(c) } }, Sa = function(b, c) { for (var d = b.split("|"), e = d.length; e--;) Q.attrHandle[d[e]] = c }, Ja = function(b, c) { var d = c && b, e = d && 1 === b.nodeType && 1 === c.nodeType && b.sourceIndex - c.sourceIndex; if (e) return e; if (d) for (; d = d.nextSibling;) if (d === c) return -1; return b ? 1 : -1 }, Ab = function(b) { return function(c) { return "input" === c.nodeName.toLowerCase() && c.type === b } }, Ta = function(b) { return function(c) { var d = c.nodeName.toLowerCase(); return ("input" === d || "button" === d) && c.type === b } }, eb = function(b) { return function(c) { return "form" in c ? c.parentNode && !1 === c.disabled ? "label" in c ? "label" in c.parentNode ? c.parentNode.disabled === b : c.disabled === b : c.isDisabled === b || c.isDisabled !== !b && Sc(c) === b : c.disabled === b : "label" in c && c.disabled === b } }, Ea = function(b) { return ha(function(c) { return c = +c, ha(function(d, e) { for (var j, f = b([], d.length, c), g = f.length; g--;) d[j = f[g]] && (d[j] = !(e[j] = d[j])) }) }) }, Da = function(b) { return b && "undefined" != typeof b.getElementsByTagName && b }, Fa = function() {}, xa = function(b) { for (var c = 0, d = b.length, e = ""; c < d; c++) e += b[c].value; return e }, Ya = function(b, c, d) { var e = c.dir, j = c.next, f = j || e, g = d && "parentNode" === f, n = Tc++; return c.first ? function(c, d, j) { for (; c = c[e];) if (1 === c.nodeType || g) return b(c, d, j); return !1 } : function(c, d, q) { var l, r, ga, s = [Ga, n]; if (q) for (; c = c[e];) { if ((1 === c.nodeType || g) && b(c, d, q)) return !0 } else for (; c = c[e];) if (1 === c.nodeType || g) if (ga = c[Z] || (c[Z] = {}), r = ga[c.uniqueID] || (ga[c.uniqueID] = {}), j && j === c.nodeName.toLowerCase()) c = c[e] || c; else { if ((l = r[f]) && l[0] === Ga && l[1] === n) return s[2] = l[2]; if (r[f] = s, s[2] = b(c, d, q)) return !0 } return !1 } }, ya = function(b) { return 1 < b.length ? function(c, d, e) { for (var j = b.length; j--;) if (!b[j](c, d, e)) return !1; return !0 } : b[0] }, za = function(b, c, d, e, j) { for (var f, g = [], n = 0, q = b.length, l = null != c; n < q; n++)(f = b[n]) && (d && !d(f, e, j) || (g.push(f), l && c.push(n))); return g }, Aa = function(b, c, d, e, j, f) { return e && !e[Z] && (e = Aa(e)), j && !j[Z] && (j = Aa(j, f)), ha(function(f, g, n, q) { var l, r, s = [], m = [], p = g.length, t; if (!(t = f)) { t = c || "*"; for (var u = n.nodeType ? [n] : n, y = [], Kb = 0, z = u.length; Kb < z; Kb++) V(t, u[Kb], y); t = y } t = !b || !f && c ? t : za(t, s, b, n, q); u = d ? j || (f ? b : p || e) ? [] : g : t; if (d && d(t, u, n, q), e) { l = za(u, m); e(l, [], n, q); for (n = l.length; n--;)(r = l[n]) && (u[m[n]] = !(t[m[n]] = r)) } if (f) { if (j || b) { if (j) { l = []; for (n = u.length; n--;)(r = u[n]) && l.push(t[n] = r); j(null, u = [], l, q) } for (n = u.length; n--;)(r = u[n]) && -1 < (l = j ? Za(f, r) : s[n]) && (f[l] = !(g[l] = r)) } } else u = za(u === g ? u.splice(p, u.length) : u), j ? j(null, g, u, q) : Qa.apply(g, u) }) }, Rb = function(b) { var c, d, e, j = b.length, f = Q.relative[b[0].type]; d = f || Q.relative[" "]; for (var g = f ? 1 : 0, n = Ya(function(b) { return b === c }, d, !0), q = Ya(function(b) { return -1 < Za(c, b) }, d, !0), l = [function(b, d, e) { b = !f && (e || d !== fb) || ((c = d).nodeType ? n(b, d, e) : q(b, d, e)); return c = null, b }]; g < j; g++) if (d = Q.relative[b[g].type]) l = [Ya(ya(l), d)]; else { if (d = Q.filter[b[g].type].apply(null, b[g].matches), d[Z]) { for (e = ++g; e < j && !Q.relative[b[e].type]; e++); return Aa(1 < g && ya(l), 1 < g && xa(b.slice(0, g - 1).concat({ value: " " === b[g - 2].type ? "*" : "" })).replace(zb, "$1"), d, g < e && Rb(b.slice(g, e)), e < j && Rb(b = b.slice(e)), e < j && xa(b)) } l.push(d) } return ya(l) }, gb, ba, Q, Bb, gc, ob, Sb, fc, fb, Ua, hb, Pa, U, ua, ta, ia, $a, Cb, nb, Z = "sizzle" + 1 * new Date, sa = mb.document, Ga = 0, Tc = 0, hc = Ra(), ic = Ra(), yb = Ra(), Tb = function(b, c) { return b === c && (hb = !0), 0 }, Uc = {}.hasOwnProperty, ab = [], Vc = ab.pop, Wc = ab.push, Qa = ab.push, jc = ab.slice, Za = function(b, c) { for (var d = 0, e = b.length; d < e; d++) if (b[d] === c) return d; return -1 }, Xc = /[\x20\t\r\n\f]+/g, zb = /^[\x20\t\r\n\f]+|((?:^|[^\\])(?:\\.)*)[\x20\t\r\n\f]+$/g, Yc = /^[\x20\t\r\n\f]*,[\x20\t\r\n\f]*/, Zc = /^[\x20\t\r\n\f]*([>+~]|[\x20\t\r\n\f])[\x20\t\r\n\f]*/, $c = /=[\x20\t\r\n\f]*([^\]'"]*?)[\x20\t\r\n\f]*\]/g, ad = RegExp(":((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|((?:\\\\.|[\\w-]|[^\x00-\\xa0])+))|)[\\x20\\t\\r\\n\\f]*\\])*)|.*)\\)|)"), bd = /^(?:\\.|[\w-]|[^\x00-\xa0])+$/, Db = { ID: /^#((?:\\.|[\w-]|[^\x00-\xa0])+)/, CLASS: /^\.((?:\\.|[\w-]|[^\x00-\xa0])+)/, TAG: /^((?:\\.|[\w-]|[^\x00-\xa0])+|[*])/, ATTR: RegExp("^\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|((?:\\\\.|[\\w-]|[^\x00-\\xa0])+))|)[\\x20\\t\\r\\n\\f]*\\]"), PSEUDO: RegExp("^:((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|((?:\\\\.|[\\w-]|[^\x00-\\xa0])+))|)[\\x20\\t\\r\\n\\f]*\\])*)|.*)\\)|)"), CHILD: RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\([\\x20\\t\\r\\n\\f]*(even|odd|(([+-]|)(\\d*)n|)[\\x20\\t\\r\\n\\f]*(?:([+-]|)[\\x20\\t\\r\\n\\f]*(\\d+)|))[\\x20\\t\\r\\n\\f]*\\)|)", "i"), bool: RegExp("^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$", "i"), needsContext: RegExp("^[\\x20\\t\\r\\n\\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\([\\x20\\t\\r\\n\\f]*((?:-\\d)?\\d*)[\\x20\\t\\r\\n\\f]*\\)|)(?=[^-]|$)", "i") }, cd = /^(?:input|select|textarea|button)$/i, dd = /^h\d$/i, pb = /^[^{]+\{\s*\[native \w/, Rc = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, Qb = /[+~]/, Ka = /\\([\da-f]{1,6}[\x20\t\r\n\f]?|([\x20\t\r\n\f])|.)/ig, La = function(b, c, d) { b = "0x" + c - 65536; return b !== b || d ? c : 0 > b ? String.fromCharCode(b + 65536) : String.fromCharCode(b >> 10 | 55296, 1023 & b | 56320) }, dc = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, ec = function(b, c) { return c ? "\x00" === b ? "\ufffd" : b.slice(0, -1) + "\\" + b.charCodeAt(b.length - 1).toString(16) + " " : "\\" + b }, kc = function() { Pa() }, Sc = Ya(function(b) { return !0 === b.disabled && ("form" in b || "label" in b) }, { dir: "parentNode", next: "legend" }); try { Qa.apply(ab = jc.call(sa.childNodes), sa.childNodes), ab[sa.childNodes.length].nodeType } catch (Gd) { Qa = { apply: ab.length ? function(b, c) { Wc.apply(b, jc.call(c)) } : function(b, c) { for (var d = b.length, e = 0; b[d++] = c[e++];); b.length = d - 1 } } } ba = V.support = {}; gc = V.isXML = function(b) { b = b && (b.ownerDocument || b).documentElement; return !!b && "HTML" !== b.nodeName }; Pa = V.setDocument = function(b) { var c, d; b = b ? b.ownerDocument || b : sa; return b !== U && 9 === b.nodeType && b.documentElement ? (U = b, ua = U.documentElement, ta = !gc(U), sa !== U && (d = U.defaultView) && d.top !== d && (d.addEventListener ? d.addEventListener("unload", kc, !1) : d.attachEvent && d.attachEvent("onunload", kc)), ba.attributes = na(function(b) { return b.className = "i", !b.getAttribute("className") }), ba.getElementsByTagName = na(function(b) { return b.appendChild(U.createComment("")), !b.getElementsByTagName("*").length }), ba.getElementsByClassName = pb.test(U.getElementsByClassName), ba.getById = na(function(b) { return ua.appendChild(b).id = Z, !U.getElementsByName || !U.getElementsByName(Z).length }), ba.getById ? (Q.filter.ID = function(b) { var c = b.replace(Ka, La); return function(b) { return b.getAttribute("id") === c } }, Q.find.ID = function(b, c) { if ("undefined" != typeof c.getElementById && ta) { var d = c.getElementById(b); return d ? [d] : [] } }) : (Q.filter.ID = function(b) { var c = b.replace(Ka, La); return function(b) { return (b = "undefined" != typeof b.getAttributeNode && b.getAttributeNode("id")) && b.value === c } }, Q.find.ID = function(b, c) { if ("undefined" != typeof c.getElementById && ta) { var d, e, j, f = c.getElementById(b); if (f) { if (d = f.getAttributeNode("id"), d && d.value === b) return [f]; j = c.getElementsByName(b); for (e = 0; f = j[e++];) if (d = f.getAttributeNode("id"), d && d.value === b) return [f] } return [] } }), Q.find.TAG = ba.getElementsByTagName ? function(b, c) { return "undefined" != typeof c.getElementsByTagName ? c.getElementsByTagName(b) : ba.qsa ? c.querySelectorAll(b) : void 0 } : function(b, c) { var d, e = [], j = 0, f = c.getElementsByTagName(b); if ("*" === b) { for (; d = f[j++];) 1 === d.nodeType && e.push(d); return e } return f }, Q.find.CLASS = ba.getElementsByClassName && function(b, c) { if ("undefined" != typeof c.getElementsByClassName && ta) return c.getElementsByClassName(b) }, $a = [], ia = [], (ba.qsa = pb.test(U.querySelectorAll)) && (na(function(b) { ua.appendChild(b).innerHTML = ""; b.querySelectorAll("[msallowcapture^='']").length && ia.push("[*^$]=[\\x20\\t\\r\\n\\f]*(?:''|\"\")"); b.querySelectorAll("[selected]").length || ia.push("\\[[\\x20\\t\\r\\n\\f]*(?:value|checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)"); b.querySelectorAll("[id~=" + Z + "-]").length || ia.push("~="); b.querySelectorAll(":checked").length || ia.push(":checked"); b.querySelectorAll("a#" + Z + "+*").length || ia.push(".#.+[+~]") }), na(function(b) { b.innerHTML = ""; var c = U.createElement("input"); c.setAttribute("type", "hidden"); b.appendChild(c).setAttribute("name", "D"); b.querySelectorAll("[name=d]").length && ia.push("name[\\x20\\t\\r\\n\\f]*[*^$|!~]?="); 2 !== b.querySelectorAll(":enabled").length && ia.push(":enabled", ":disabled"); ua.appendChild(b).disabled = !0; 2 !== b.querySelectorAll(":disabled").length && ia.push(":enabled", ":disabled"); b.querySelectorAll("*,:x"); ia.push(",.*:") })), (ba.matchesSelector = pb.test(Cb = ua.matches || ua.webkitMatchesSelector || ua.mozMatchesSelector || ua.oMatchesSelector || ua.msMatchesSelector)) && na(function(b) { ba.disconnectedMatch = Cb.call(b, "*"); Cb.call(b, "[s!='']:x"); $a.push("!=", ":((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|((?:\\\\.|[\\w-]|[^\x00-\\xa0])+))|)[\\x20\\t\\r\\n\\f]*\\])*)|.*)\\)|)") }), ia = ia.length && RegExp(ia.join("|")), $a = $a.length && RegExp($a.join("|")), c = pb.test(ua.compareDocumentPosition), nb = c || pb.test(ua.contains) ? function(b, c) { var d = 9 === b.nodeType ? b.documentElement : b, e = c && c.parentNode; return b === e || !(!e || 1 !== e.nodeType || !(d.contains ? d.contains(e) : b.compareDocumentPosition && 16 & b.compareDocumentPosition(e))) } : function(b, c) { if (c) for (; c = c.parentNode;) if (c === b) return !0; return !1 }, Tb = c ? function(b, c) { if (b === c) return hb = !0, 0; var d = !b.compareDocumentPosition - !c.compareDocumentPosition; return d ? d : (d = (b.ownerDocument || b) === (c.ownerDocument || c) ? b.compareDocumentPosition(c) : 1, 1 & d || !ba.sortDetached && c.compareDocumentPosition(b) === d ? b === U || b.ownerDocument === sa && nb(sa, b) ? -1 : c === U || c.ownerDocument === sa && nb(sa, c) ? 1 : Ua ? Za(Ua, b) - Za(Ua, c) : 0 : 4 & d ? -1 : 1) } : function(b, c) { if (b === c) return hb = !0, 0; var d, e = 0; d = b.parentNode; var j = c.parentNode, f = [b], g = [c]; if (!d || !j) return b === U ? -1 : c === U ? 1 : d ? -1 : j ? 1 : Ua ? Za(Ua, b) - Za(Ua, c) : 0; if (d === j) return Ja(b, c); for (d = b; d = d.parentNode;) f.unshift(d); for (d = c; d = d.parentNode;) g.unshift(d); for (; f[e] === g[e];) e++; return e ? Ja(f[e], g[e]) : f[e] === sa ? -1 : g[e] === sa ? 1 : 0 }, U) : U }; V.matches = function(b, c) { return V(b, null, null, c) }; V.matchesSelector = function(b, c) { if ((b.ownerDocument || b) !== U && Pa(b), c = c.replace($c, "='$1']"), ba.matchesSelector && ta && !yb[c + " "] && (!$a || !$a.test(c)) && (!ia || !ia.test(c))) try { var d = Cb.call(b, c); if (d || ba.disconnectedMatch || b.document && 11 !== b.document.nodeType) return d } catch (e) {} return 0 < V(c, U, null, [b]).length }; V.contains = function(b, c) { return (b.ownerDocument || b) !== U && Pa(b), nb(b, c) }; V.attr = function(b, c) { (b.ownerDocument || b) !== U && Pa(b); var d = Q.attrHandle[c.toLowerCase()], d = d && Uc.call(Q.attrHandle, c.toLowerCase()) ? d(b, c, !ta) : void 0; return void 0 !== d ? d : ba.attributes || !ta ? b.getAttribute(c) : (d = b.getAttributeNode(c)) && d.specified ? d.value : null }; V.escape = function(b) { return (b + "").replace(dc, ec) }; V.error = function(b) { throw Error("Syntax error, unrecognized expression: " + b); }; V.uniqueSort = function(b) { var c, d = [], e = 0, j = 0; if (hb = !ba.detectDuplicates, Ua = !ba.sortStable && b.slice(0), b.sort(Tb), hb) { for (; c = b[j++];) c === b[j] && (e = d.push(j)); for (; e--;) b.splice(d[e], 1) } return Ua = null, b }; Bb = V.getText = function(b) { var c, d = "", e = 0; if (c = b.nodeType) if (1 === c || 9 === c || 11 === c) { if ("string" == typeof b.textContent) return b.textContent; for (b = b.firstChild; b; b = b.nextSibling) d += Bb(b) } else { if (3 === c || 4 === c) return b.nodeValue } else for (; c = b[e++];) d += Bb(c); return d }; Q = V.selectors = { cacheLength: 50, createPseudo: ha, match: Db, attrHandle: {}, find: {}, relative: { ">": { dir: "parentNode", first: !0 }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: !0 }, "~": { dir: "previousSibling" } }, preFilter: { ATTR: function(b) { return b[1] = b[1].replace(Ka, La), b[3] = (b[3] || b[4] || b[5] || "").replace(Ka, La), "~=" === b[2] && (b[3] = " " + b[3] + " "), b.slice(0, 4) }, CHILD: function(b) { return b[1] = b[1].toLowerCase(), "nth" === b[1].slice(0, 3) ? (b[3] || V.error(b[0]), b[4] = +(b[4] ? b[5] + (b[6] || 1) : 2 * ("even" === b[3] || "odd" === b[3])), b[5] = +(b[7] + b[8] || "odd" === b[3])) : b[3] && V.error(b[0]), b }, PSEUDO: function(b) { var c, d = !b[6] && b[2]; return Db.CHILD.test(b[0]) ? null : (b[3] ? b[2] = b[4] || b[5] || "" : d && ad.test(d) && (c = ob(d, !0)) && (c = d.indexOf(")", d.length - c) - d.length) && (b[0] = b[0].slice(0, c), b[2] = d.slice(0, c)), b.slice(0, 3)) } }, filter: { TAG: function(b) { var c = b.replace(Ka, La).toLowerCase(); return "*" === b ? function() { return !0 } : function(b) { return b.nodeName && b.nodeName.toLowerCase() === c } }, CLASS: function(b) { var c = hc[b + " "]; return c || (c = RegExp("(^|[\\x20\\t\\r\\n\\f])" + b + "([\\x20\\t\\r\\n\\f]|$)")) && hc(b, function(b) { return c.test("string" == typeof b.className && b.className || "undefined" != typeof b.getAttribute && b.getAttribute("class") || "") }) }, ATTR: function(b, c, d) { return function(e) { e = V.attr(e, b); return null == e ? "!=" === c : !c || (e += "", "=" === c ? e === d : "!=" === c ? e !== d : "^=" === c ? d && 0 === e.indexOf(d) : "*=" === c ? d && -1 < e.indexOf(d) : "$=" === c ? d && e.slice(-d.length) === d : "~=" === c ? -1 < (" " + e.replace(Xc, " ") + " ").indexOf(d) : "|=" === c && (e === d || e.slice(0, d.length + 1) === d + "-")) } }, CHILD: function(b, c, d, e, j) { var f = "nth" !== b.slice(0, 3), g = "last" !== b.slice(-4), n = "of-type" === c; return 1 === e && 0 === j ? function(b) { return !!b.parentNode } : function(c, d, q) { var l, r, s, m, ga, t; d = f !== g ? "nextSibling" : "previousSibling"; var p = c.parentNode, kb = n && c.nodeName.toLowerCase(); q = !q && !n; var u = !1; if (p) { if (f) { for (; d;) { for (m = c; m = m[d];) if (n ? m.nodeName.toLowerCase() === kb : 1 === m.nodeType) return !1; t = d = "only" === b && !t && "nextSibling" } return !0 } if (t = [g ? p.firstChild : p.lastChild], g && q) { m = p; s = m[Z] || (m[Z] = {}); r = s[m.uniqueID] || (s[m.uniqueID] = {}); l = r[b] || []; u = (ga = l[0] === Ga && l[1]) && l[2]; for (m = ga && p.childNodes[ga]; m = ++ga && m && m[d] || (u = ga = 0) || t.pop();) if (1 === m.nodeType && ++u && m === c) { r[b] = [Ga, ga, u]; break } } else if (q && (m = c, s = m[Z] || (m[Z] = {}), r = s[m.uniqueID] || (s[m.uniqueID] = {}), l = r[b] || [], ga = l[0] === Ga && l[1], u = ga), !1 === u) for (; (m = ++ga && m && m[d] || (u = ga = 0) || t.pop()) && (!(n ? m.nodeName.toLowerCase() === kb : 1 === m.nodeType) || !++u || !(q && (s = m[Z] || (m[Z] = {}), r = s[m.uniqueID] || (s[m.uniqueID] = {}), r[b] = [Ga, u]), m === c));); return u -= j, u === e || 0 === u % e && 0 <= u / e } } }, PSEUDO: function(b, c) { var d, e = Q.pseudos[b] || Q.setFilters[b.toLowerCase()] || V.error("unsupported pseudo: " + b); return e[Z] ? e(c) : 1 < e.length ? (d = [b, b, "", c], Q.setFilters.hasOwnProperty(b.toLowerCase()) ? ha(function(b, d) { for (var j, f = e(b, c), g = f.length; g--;) j = Za(b, f[g]), b[j] = !(d[j] = f[g]) }) : function(b) { return e(b, 0, d) }) : e } }, pseudos: { not: ha(function(b) { var c = [], d = [], e = Sb(b.replace(zb, "$1")); return e[Z] ? ha(function(b, c, d, j) { var f; d = e(b, null, j, []); for (j = b.length; j--;)(f = d[j]) && (b[j] = !(c[j] = f)) }) : function(b, j, f) { return c[0] = b, e(c, null, f, d), c[0] = null, !d.pop() } }), has: ha(function(b) { return function(c) { return 0 < V(b, c).length } }), contains: ha(function(b) { return b = b.replace(Ka, La), function(c) { return -1 < (c.textContent || c.innerText || Bb(c)).indexOf(b) } }), lang: ha(function(b) { return bd.test(b || "") || V.error("unsupported lang: " + b), b = b.replace(Ka, La).toLowerCase(), function(c) { var d; do if (d = ta ? c.lang : c.getAttribute("xml:lang") || c.getAttribute("lang")) return d = d.toLowerCase(), d === b || 0 === d.indexOf(b + "-"); while ((c = c.parentNode) && 1 === c.nodeType); return !1 } }), target: function(b) { var c = mb.location && mb.location.hash; return c && c.slice(1) === b.id }, root: function(b) { return b === ua }, focus: function(b) { return b === U.activeElement && (!U.hasFocus || U.hasFocus()) && !(!b.type && !b.href && !~b.tabIndex) }, enabled: eb(!1), disabled: eb(!0), checked: function(b) { var c = b.nodeName.toLowerCase(); return "input" === c && !!b.checked || "option" === c && !!b.selected }, selected: function(b) { return b.parentNode && b.parentNode.selectedIndex, !0 === b.selected }, empty: function(b) { for (b = b.firstChild; b; b = b.nextSibling) if (6 > b.nodeType) return !1; return !0 }, parent: function(b) { return !Q.pseudos.empty(b) }, header: function(b) { return dd.test(b.nodeName) }, input: function(b) { return cd.test(b.nodeName) }, button: function(b) { var c = b.nodeName.toLowerCase(); return "input" === c && "button" === b.type || "button" === c }, text: function(b) { var c; return "input" === b.nodeName.toLowerCase() && "text" === b.type && (null == (c = b.getAttribute("type")) || "text" === c.toLowerCase()) }, first: Ea(function() { return [0] }), last: Ea(function(b, c) { return [c - 1] }), eq: Ea(function(b, c, d) { return [0 > d ? d + c : d] }), even: Ea(function(b, c) { for (var d = 0; d < c; d += 2) b.push(d); return b }), odd: Ea(function(b, c) { for (var d = 1; d < c; d += 2) b.push(d); return b }), lt: Ea(function(b, c, d) { for (c = 0 > d ? d + c : d; 0 <= --c;) b.push(c); return b }), gt: Ea(function(b, c, d) { for (d = 0 > d ? d + c : d; ++d < c;) b.push(d); return b }) } }; Q.pseudos.nth = Q.pseudos.eq; for (gb in { radio: !0, checkbox: !0, file: !0, password: !0, image: !0 }) Q.pseudos[gb] = Ab(gb); for (gb in { submit: !0, reset: !0 }) Q.pseudos[gb] = Ta(gb); Fa.prototype = Q.filters = Q.pseudos; Q.setFilters = new Fa; ob = V.tokenize = function(b, c) { var d, e, j, f, g, n, q; if (g = ic[b + " "]) return c ? 0 : g.slice(0); g = b; n = []; for (q = Q.preFilter; g;) { d && !(e = Yc.exec(g)) || (e && (g = g.slice(e[0].length) || g), n.push(j = [])); d = !1; (e = Zc.exec(g)) && (d = e.shift(), j.push({ value: d, type: e[0].replace(zb, " ") }), g = g.slice(d.length)); for (f in Q.filter) !(e = Db[f].exec(g)) || q[f] && !(e = q[f](e)) || (d = e.shift(), j.push({ value: d, type: f, matches: e }), g = g.slice(d.length)); if (!d) break } return c ? g.length : g ? V.error(b) : ic(b, n).slice(0) }; ra = (Sb = V.compile = function(b, c) { var d, e = [], j = [], f = yb[b + " "]; if (!f) { c || (c = ob(b)); for (d = c.length; d--;) f = Rb(c[d]), f[Z] ? e.push(f) : j.push(f); d = yb; var g = 0 < e.length, n = 0 < j.length, f = function(b, c, d, f, q) { var l, fa, r, s = 0, m = "0", ga = b && [], t = [], p = fb, u = b || n && Q.find.TAG("*", q), kb = Ga += null == p ? 1 : Math.random() || 0.1, y = u.length; for (q && (fb = c === U || c || q); m !== y && null != (l = u[m]); m++) { if (n && l) { fa = 0; for (c || l.ownerDocument === U || (Pa(l), d = !ta); r = j[fa++];) if (r(l, c || U, d)) { f.push(l); break } q && (Ga = kb) } g && ((l = !r && l) && s--, b && ga.push(l)) } if (s += m, g && m !== s) { for (fa = 0; r = e[fa++];) r(ga, t, c, d); if (b) { if (0 < s) for (; m--;) ga[m] || t[m] || (t[m] = Vc.call(f)); t = za(t) } Qa.apply(f, t); q && !b && 0 < t.length && 1 < s + e.length && V.uniqueSort(f) } return q && (Ga = kb, fb = p), ga }, f = g ? ha(f) : f, f = d(b, f); f.selector = b } return f }, fc = V.select = function(b, c, d, e) { var j, f, g, n, q, l = "function" == typeof b && b, r = !e && ob(b = l.selector || b); if (d = d || [], 1 === r.length) { if (f = r[0] = r[0].slice(0), 2 < f.length && "ID" === (g = f[0]).type && 9 === c.nodeType && ta && Q.relative[f[1].type]) { if (c = (Q.find.ID(g.matches[0].replace(Ka, La), c) || [])[0], !c) return d; l && (c = c.parentNode); b = b.slice(f.shift().value.length) } for (j = Db.needsContext.test(b) ? 0 : f.length; j-- && !(g = f[j], Q.relative[n = g.type]);) if ((q = Q.find[n]) && (e = q(g.matches[0].replace(Ka, La), Qb.test(f[0].type) && Da(c.parentNode) || c))) { if (f.splice(j, 1), b = e.length && xa(f), !b) return Qa.apply(d, e), d; break } } return (l || Sb(b, r))(e, c, !ta, d, !c || Qb.test(b) && Da(c.parentNode) || c), d }, ba.sortStable = Z.split("").sort(Tb).join("") === Z, ba.detectDuplicates = !!hb, Pa(), ba.sortDetached = na(function(b) { return 1 & b.compareDocumentPosition(U.createElement("fieldset")) }), na(function(b) { return b.innerHTML = "", "#" === b.firstChild.getAttribute("href") }) || Sa("type|href|height|width", function(b, c, d) { if (!d) return b.getAttribute(c, "type" === c.toLowerCase() ? 1 : 2) }), ba.attributes && na(function(b) { return b.innerHTML = "", b.firstChild.setAttribute("value", ""), "" === b.firstChild.getAttribute("value") }) || Sa("value", function(b, c, d) { if (!d && "input" === b.nodeName.toLowerCase()) return b.defaultValue }), na(function(b) { return null == b.getAttribute("disabled") }) || Sa("checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", function(b, c, d) { var e; if (!d) return !0 === b[c] ? c.toLowerCase() : (e = b.getAttributeNode(c)) && e.specified ? e.value : null }), V); p.find = ra; p.expr = ra.selectors; p.expr[":"] = p.expr.pseudos; p.uniqueSort = p.unique = ra.uniqueSort; p.text = ra.getText; p.isXMLDoc = ra.isXML; p.contains = ra.contains; p.escapeSelector = ra.escape; var ib = function(b, c, d) { for (var e = [], j = void 0 !== d; (b = b[c]) && 9 !== b.nodeType;) if (1 === b.nodeType) { if (j && p(b).is(d)) break; e.push(b) } return e }, lc = function(b, c) { for (var d = []; b; b = b.nextSibling) 1 === b.nodeType && b !== c && d.push(b); return d }, mc = p.expr.match.needsContext, nc = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i, Ic = /^.[^:#\[\.,]*$/; p.filter = function(b, c, d) { var e = c[0]; return d && (b = ":not(" + b + ")"), 1 === c.length && 1 === e.nodeType ? p.find.matchesSelector(e, b) ? [e] : [] : p.find.matches(b, p.grep(c, function(b) { return 1 === b.nodeType })) }; p.fn.extend({ find: function(b) { var c, d, e = this.length, j = this; if ("string" != typeof b) return this.pushStack(p(b).filter(function() { for (c = 0; c < e; c++) if (p.contains(j[c], this)) return !0 })); d = this.pushStack([]); for (c = 0; c < e; c++) p.find(b, j[c], d); return 1 < e ? p.uniqueSort(d) : d }, filter: function(b) { return this.pushStack(f(this, b || [], !1)) }, not: function(b) { return this.pushStack(f(this, b || [], !0)) }, is: function(b) { return !!f(this, "string" == typeof b && mc.test(b) ? p(b) : b || [], !1).length } }); var oc, ed = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/; (p.fn.init = function(b, c, d) { var e, j; if (!b) return this; if (d = d || oc, "string" == typeof b) { if (e = "<" === b[0] && ">" === b[b.length - 1] && 3 <= b.length ? [null, b, null] : ed.exec(b), !e || !e[1] && c) return !c || c.jquery ? (c || d).find(b) : this.constructor(c).find(b); if (e[1]) { if (c = c instanceof p ? c[0] : c, p.merge(this, p.parseHTML(e[1], c && c.nodeType ? c.ownerDocument || c : M, !0)), nc.test(e[1]) && p.isPlainObject(c)) for (e in c) p.isFunction(this[e]) ? this[e](c[e]) : this.attr(e, c[e]); return this } return j = M.getElementById(e[2]), j && (this[0] = j, this.length = 1), this } return b.nodeType ? (this[0] = b, this.length = 1, this) : p.isFunction(b) ? void 0 !== d.ready ? d.ready(b) : b(p) : p.makeArray(b, this) }).prototype = p.fn; oc = p(M); var fd = /^(?:parents|prev(?:Until|All))/, gd = { children: !0, contents: !0, next: !0, prev: !0 }; p.fn.extend({ has: function(b) { var c = p(b, this), d = c.length; return this.filter(function() { for (var b = 0; b < d; b++) if (p.contains(this, c[b])) return !0 }) }, closest: function(b, c) { var d, e = 0, j = this.length, f = [], g = "string" != typeof b && p(b); if (!mc.test(b)) for (; e < j; e++) for (d = this[e]; d && d !== c; d = d.parentNode) if (11 > d.nodeType && (g ? -1 < g.index(d) : 1 === d.nodeType && p.find.matchesSelector(d, b))) { f.push(d); break } return this.pushStack(1 < f.length ? p.uniqueSort(f) : f) }, index: function(b) { return b ? "string" == typeof b ? Va.call(p(b), this[0]) : Va.call(this, b.jquery ? b[0] : b) : this[0] && this[0].parentNode ? this.first().prevAll().length : -1 }, add: function(b, c) { return this.pushStack(p.uniqueSort(p.merge(this.get(), p(b, c)))) }, addBack: function(b) { return this.add(null == b ? this.prevObject : this.prevObject.filter(b)) } }); p.each({ parent: function(b) { return (b = b.parentNode) && 11 !== b.nodeType ? b : null }, parents: function(b) { return ib(b, "parentNode") }, parentsUntil: function(b, c, d) { return ib(b, "parentNode", d) }, next: function(b) { return m(b, "nextSibling") }, prev: function(b) { return m(b, "previousSibling") }, nextAll: function(b) { return ib(b, "nextSibling") }, prevAll: function(b) { return ib(b, "previousSibling") }, nextUntil: function(b, c, d) { return ib(b, "nextSibling", d) }, prevUntil: function(b, c, d) { return ib(b, "previousSibling", d) }, siblings: function(b) { return lc((b.parentNode || {}).firstChild, b) }, children: function(b) { return lc(b.firstChild) }, contents: function(b) { return g(b, "iframe") ? b.contentDocument : (g(b, "template") && (b = b.content || b), p.merge([], b.childNodes)) } }, function(b, c) { p.fn[b] = function(d, e) { var j = p.map(this, c, d); return "Until" !== b.slice(-5) && (e = d), e && "string" == typeof e && (j = p.filter(e, j)), 1 < this.length && (gd[b] || p.uniqueSort(j), fd.test(b) && j.reverse()), this.pushStack(j) } }); var pa = /[^\x20\t\r\n\f]+/g; p.Callbacks = function(b) { var c; if ("string" == typeof b) { var d = {}; c = (p.each(b.match(pa) || [], function(b, c) { d[c] = !0 }), d) } else c = p.extend({}, b); b = c; var e, j, f, g, n = [], q = [], l = -1, r = function() { g = g || b.once; for (f = e = !0; q.length; l = -1) for (j = q.shift(); ++l < n.length;) !1 === n[l].apply(j[0], j[1]) && b.stopOnFalse && (l = n.length, j = !1); b.memory || (j = !1); e = !1; g && (n = j ? [] : "") }, s = { add: function() { return n && (j && !e && (l = n.length - 1, q.push(j)), function Oc(c) { p.each(c, function(c, d) { p.isFunction(d) ? b.unique && s.has(d) || n.push(d) : d && d.length && "string" !== p.type(d) && Oc(d) }) }(arguments), j && !e && r()), this }, remove: function() { return p.each(arguments, function(b, c) { for (var d; - 1 < (d = p.inArray(c, n, d));) n.splice(d, 1), d <= l && l-- }), this }, has: function(b) { return b ? -1 < p.inArray(b, n) : 0 < n.length }, empty: function() { return n && (n = []), this }, disable: function() { return g = q = [], n = j = "", this }, disabled: function() { return !n }, lock: function() { return g = q = [], j || e || (n = j = ""), this }, locked: function() { return !!g }, fireWith: function(b, c) { return g || (c = c || [], c = [b, c.slice ? c.slice() : c], q.push(c), e || r()), this }, fire: function() { return s.fireWith(this, arguments), this }, fired: function() { return !!f } }; return s }; p.extend({ Deferred: function(c) { var d = [ ["notify", "progress", p.Callbacks("memory"), p.Callbacks("memory"), 2], ["resolve", "done", p.Callbacks("once memory"), p.Callbacks("once memory"), 0, "resolved"], ["reject", "fail", p.Callbacks("once memory"), p.Callbacks("once memory"), 1, "rejected" ] ], e = "pending", f = { state: function() { return e }, always: function() { return g.done(arguments).fail(arguments), this }, "catch": function(b) { return f.then(null, b) }, pipe: function() { var b = arguments; return p.Deferred(function(c) { p.each(d, function(d, e) { var j = p.isFunction(b[e[4]]) && b[e[4]]; g[e[1]](function() { var b = j && j.apply(this, arguments); b && p.isFunction(b.promise) ? b.promise().progress(c.notify).done(c.resolve).fail(c.reject) : c[e[0] + "With"](this, j ? [b] : arguments) }) }); b = null }).promise() }, then: function(c, e, f) { function g(c, d, e, f) { return function() { var q = this, r = arguments, fa = function() { var b, fa; if (!(c < n)) { if (b = e.apply(q, r), b === d.promise()) throw new TypeError("Thenable self-resolution"); fa = b && ("object" == typeof b || "function" == typeof b) && b.then; p.isFunction(fa) ? f ? fa.call(b, g(n, d, l, f), g(n, d, j, f)) : (n++, fa.call(b, g(n, d, l, f), g(n, d, j, f), g(n, d, l, d.notifyWith))) : (e !== l && (q = void 0, r = [b]), (f || d.resolveWith)(q, r)) } }, s = f ? fa : function() { try { fa() } catch (b) { p.Deferred.exceptionHook && p.Deferred.exceptionHook(b, s.stackTrace), c + 1 >= n && (e !== j && (q = void 0, r = [b]), d.rejectWith(q, r)) } }; c ? s() : (p.Deferred.getStackHook && (s.stackTrace = p.Deferred.getStackHook()), b.setTimeout(s)) } } var n = 0; return p.Deferred(function(b) { d[0][3].add(g(0, b, p.isFunction(f) ? f : l, b.notifyWith)); d[1][3].add(g(0, b, p.isFunction(c) ? c : l)); d[2][3].add(g(0, b, p.isFunction(e) ? e : j)) }).promise() }, promise: function(b) { return null != b ? p.extend(b, f) : f } }, g = {}; return p.each(d, function(b, c) { var j = c[2], n = c[5]; f[c[1]] = j.add; n && j.add(function() { e = n }, d[3 - b][2].disable, d[0][2].lock); j.add(c[3].fire); g[c[0]] = function() { return g[c[0] + "With"](this === g ? void 0 : this, arguments), this }; g[c[0] + "With"] = j.fireWith }), f.promise(g), c && c.call(g, g), g }, when: function(b) { var c = arguments.length, d = c, e = Array(d), j = ja.call(arguments), f = p.Deferred(), g = function(b) { return function(d) { e[b] = this; j[b] = 1 < arguments.length ? ja.call(arguments) : d; --c || f.resolveWith(e, j) } }; if (1 >= c && (q(b, f.done(g(d)).resolve, f.reject, !c), "pending" === f.state() || p.isFunction(j[d] && j[d].then))) return f.then(); for (; d--;) q(j[d], g(d), f.reject); return f.promise() } }); var hd = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; p.Deferred.exceptionHook = function(c, d) { b.console && b.console.warn && c && hd.test(c.name) && b.console.warn("jQuery.Deferred exception: " + c.message, c.stack, d) }; p.readyException = function(c) { b.setTimeout(function() { throw c; }) }; var Ub = p.Deferred(); p.fn.ready = function(b) { return Ub.then(b)["catch"](function(b) { p.readyException(b) }), this }; p.extend({ isReady: !1, readyWait: 1, ready: function(b) { (!0 === b ? --p.readyWait : p.isReady) || (p.isReady = !0, !0 !== b && 0 < --p.readyWait || Ub.resolveWith(M, [p])) } }); p.ready.then = Ub.then; "complete" === M.readyState || "loading" !== M.readyState && !M.documentElement.doScroll ? b.setTimeout(p.ready) : (M.addEventListener("DOMContentLoaded", n), b.addEventListener("load", n)); var Ma = function(b, c, d, e, j, f, g) { var n = 0, q = b.length, l = null == d; if ("object" === p.type(d)) for (n in j = !0, d) Ma(b, c, n, d[n], !0, f, g); else if (void 0 !== e && (j = !0, p.isFunction(e) || (g = !0), l && (g ? (c.call(b, e), c = null) : (l = c, c = function(b, c, d) { return l.call(p(b), d) })), c)) for (; n < q; n++) c(b[n], d, g ? e : e.call(b[n], n, c(b[n], d))); return j ? b : l ? c.call(b) : q ? c(b[0], d) : f }, Eb = function(b) { return 1 === b.nodeType || 9 === b.nodeType || !+b.nodeType }; r.uid = 1; r.prototype = { cache: function(b) { var c = b[this.expando]; return c || (c = {}, Eb(b) && (b.nodeType ? b[this.expando] = c : Object.defineProperty(b, this.expando, { value: c, configurable: !0 }))), c }, set: function(b, c, d) { var e; b = this.cache(b); if ("string" == typeof c) b[p.camelCase(c)] = d; else for (e in c) b[p.camelCase(e)] = c[e]; return b }, get: function(b, c) { return void 0 === c ? this.cache(b) : b[this.expando] && b[this.expando][p.camelCase(c)] }, access: function(b, c, d) { return void 0 === c || c && "string" == typeof c && void 0 === d ? this.get(b, c) : (this.set(b, c, d), void 0 !== d ? d : c) }, remove: function(b, c) { var d, e = b[this.expando]; if (void 0 !== e) { if (void 0 !== c) { Array.isArray(c) ? c = c.map(p.camelCase) : (c = p.camelCase(c), c = c in e ? [c] : c.match(pa) || []); for (d = c.length; d--;) delete e[c[d]] }(void 0 === c || p.isEmptyObject(e)) && (b.nodeType ? b[this.expando] = void 0 : delete b[this.expando]) } }, hasData: function(b) { b = b[this.expando]; return void 0 !== b && !p.isEmptyObject(b) } }; var R = new r, ka = new r, Kc = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, Jc = /[A-Z]/g; p.extend({ hasData: function(b) { return ka.hasData(b) || R.hasData(b) }, data: function(b, c, d) { return ka.access(b, c, d) }, removeData: function(b, c) { ka.remove(b, c) }, _data: function(b, c, d) { return R.access(b, c, d) }, _removeData: function(b, c) { R.remove(b, c) } }); p.fn.extend({ data: function(b, c) { var d, e, j, f = this[0], g = f && f.attributes; if (void 0 === b) { if (this.length && (j = ka.get(f), 1 === f.nodeType && !R.get(f, "hasDataAttrs"))) { for (d = g.length; d--;) g[d] && (e = g[d].name, 0 === e.indexOf("data-") && (e = p.camelCase(e.slice(5)), s(f, e, j[e]))); R.set(f, "hasDataAttrs", !0) } return j } return "object" == typeof b ? this.each(function() { ka.set(this, b) }) : Ma(this, function(c) { var d; if (f && void 0 === c) { if ((d = ka.get(f, b), void 0 !== d) || (d = s(f, b), void 0 !== d)) return d } else this.each(function() { ka.set(this, b, c) }) }, null, c, 1 < arguments.length, null, !0) }, removeData: function(b) { return this.each(function() { ka.remove(this, b) }) } }); p.extend({ queue: function(b, c, d) { var e; if (b) return c = (c || "fx") + "queue", e = R.get(b, c), d && (!e || Array.isArray(d) ? e = R.access(b, c, p.makeArray(d)) : e.push(d)), e || [] }, dequeue: function(b, c) { c = c || "fx"; var d = p.queue(b, c), e = d.length, j = d.shift(), f = p._queueHooks(b, c), g = function() { p.dequeue(b, c) }; "inprogress" === j && (j = d.shift(), e--); j && ("fx" === c && d.unshift("inprogress"), delete f.stop, j.call(b, g, f)); !e && f && f.empty.fire() }, _queueHooks: function(b, c) { var d = c + "queueHooks"; return R.get(b, d) || R.access(b, d, { empty: p.Callbacks("once memory").add(function() { R.remove(b, [c + "queue", d]) }) }) } }); p.fn.extend({ queue: function(b, c) { var d = 2; return "string" != typeof b && (c = b, b = "fx", d--), arguments.length < d ? p.queue(this[0], b) : void 0 === c ? this : this.each(function() { var d = p.queue(this, b, c); p._queueHooks(this, b); "fx" === b && "inprogress" !== d[0] && p.dequeue(this, b) }) }, dequeue: function(b) { return this.each(function() { p.dequeue(this, b) }) }, clearQueue: function(b) { return this.queue(b || "fx", []) }, promise: function(b, c) { var d, e = 1, j = p.Deferred(), f = this, g = this.length, n = function() { --e || j.resolveWith(f, [f]) }; "string" != typeof b && (c = b, b = void 0); for (b = b || "fx"; g--;)(d = R.get(f[g], b + "queueHooks")) && d.empty && (e++, d.empty.add(n)); return n(), j.promise(c) } }); var pc = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, lb = RegExp("^(?:([+-])=|)(" + pc + ")([a-z%]*)$", "i"), Wa = ["Top", "Right", "Bottom", "Left"], tb = function(b, c) { return b = c || b, "none" === b.style.display || "" === b.style.display && p.contains(b.ownerDocument, b) && "none" === p.css(b, "display") }, qc = function(b, c, d, e) { var j, f = {}; for (j in c) f[j] = b.style[j], b.style[j] = c[j]; d = d.apply(b, e || []); for (j in c) b.style[j] = f[j]; return d }, Yb = {}; p.fn.extend({ show: function() { return u(this, !0) }, hide: function() { return u(this) }, toggle: function(b) { return "boolean" == typeof b ? b ? this.show() : this.hide() : this.each(function() { tb(this) ? p(this).show() : p(this).hide() }) } }); var rc = /^(?:checkbox|radio)$/i, Zb = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i, $b = /^$|\/(?:java|ecma)script/i, oa = { option: [1, ""], thead: [1, "", "
"], col: [2, "", "
"], tr: [2, "", "
"], td: [3, "", "
"], _default: [0, "", ""] }; oa.optgroup = oa.option; oa.tbody = oa.tfoot = oa.colgroup = oa.caption = oa.thead; oa.th = oa.td; var Lc = /<|&#?\w+;/, Fb = M.createDocumentFragment().appendChild(M.createElement("div")), Gb = M.createElement("input"); Gb.setAttribute("type", "radio"); Gb.setAttribute("checked", "checked"); Gb.setAttribute("name", "t"); Fb.appendChild(Gb); W.checkClone = Fb.cloneNode(!0).cloneNode(!0).lastChild.checked; Fb.innerHTML = ""; W.noCloneChecked = !!Fb.cloneNode(!0).lastChild.defaultValue; !0; var Hb = M.documentElement, id = /^key/, jd = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, sc = /^([^.]*)(?:\.(.+)|)/; p.event = { global: {}, add: function(b, c, d, e, j) { var f, g, n, q, l, r, s, m, t, u; if (l = R.get(b)) { d.handler && (f = d, d = f.handler, j = f.selector); j && p.find.matchesSelector(Hb, j); d.guid || (d.guid = p.guid++); (q = l.events) || (q = l.events = {}); (g = l.handle) || (g = l.handle = function(c) { return "undefined" != typeof p && p.event.triggered !== c.type ? p.event.dispatch.apply(b, arguments) : void 0 }); c = (c || "").match(pa) || [""]; for (l = c.length; l--;) n = sc.exec(c[l]) || [], t = u = n[1], n = (n[2] || "").split(".").sort(), t && (s = p.event.special[t] || {}, t = (j ? s.delegateType : s.bindType) || t, s = p.event.special[t] || {}, r = p.extend({ type: t, origType: u, data: e, handler: d, guid: d.guid, selector: j, needsContext: j && p.expr.match.needsContext.test(j), namespace: n.join(".") }, f), (m = q[t]) || (m = q[t] = [], m.delegateCount = 0, s.setup && !1 !== s.setup.call(b, e, n, g) || b.addEventListener && b.addEventListener(t, g)), s.add && (s.add.call(b, r), r.handler.guid || (r.handler.guid = d.guid)), j ? m.splice(m.delegateCount++, 0, r) : m.push(r), p.event.global[t] = !0) } }, remove: function(b, c, d, e, j) { var f, g, n, q, l, r, s, m, t, u, y, z = R.hasData(b) && R.get(b); if (z && (q = z.events)) { c = (c || "").match(pa) || [""]; for (l = c.length; l--;) if (n = sc.exec(c[l]) || [], t = y = n[1], u = (n[2] || "").split(".").sort(), t) { s = p.event.special[t] || {}; t = (e ? s.delegateType : s.bindType) || t; m = q[t] || []; n = n[2] && RegExp("(^|\\.)" + u.join("\\.(?:.*\\.|)") + "(\\.|$)"); for (g = f = m.length; f--;) r = m[f], !j && y !== r.origType || d && d.guid !== r.guid || n && !n.test(r.namespace) || e && e !== r.selector && ("**" !== e || !r.selector) || (m.splice(f, 1), r.selector && m.delegateCount--, s.remove && s.remove.call(b, r)); g && !m.length && (s.teardown && !1 !== s.teardown.call(b, u, z.handle) || p.removeEvent(b, t, z.handle), delete q[t]) } else for (t in q) p.event.remove(b, t + c[l], d, e, !0); p.isEmptyObject(q) && R.remove(b, "handle events") } }, dispatch: function(b) { var c = p.event.fix(b), d, e, j, f, g, n, q = Array(arguments.length); e = (R.get(this, "events") || {})[c.type] || []; var l = p.event.special[c.type] || {}; q[0] = c; for (d = 1; d < arguments.length; d++) q[d] = arguments[d]; if (c.delegateTarget = this, !l.preDispatch || !1 !== l.preDispatch.call(this, c)) { n = p.event.handlers.call(this, c, e); for (d = 0; (f = n[d++]) && !c.isPropagationStopped();) { c.currentTarget = f.elem; for (e = 0; (g = f.handlers[e++]) && !c.isImmediatePropagationStopped();) c.rnamespace && !c.rnamespace.test(g.namespace) || (c.handleObj = g, c.data = g.data, j = ((p.event.special[g.origType] || {}).handle || g.handler).apply(f.elem, q), void 0 !== j && !1 === (c.result = j) && (c.preventDefault(), c.stopPropagation())) } return l.postDispatch && l.postDispatch.call(this, c), c.result } }, handlers: function(b, c) { var d, e, j, f, g, n = [], q = c.delegateCount, l = b.target; if (q && l.nodeType && !("click" === b.type && 1 <= b.button)) for (; l !== this; l = l.parentNode || this) if (1 === l.nodeType && ("click" !== b.type || !0 !== l.disabled)) { f = []; g = {}; for (d = 0; d < q; d++) e = c[d], j = e.selector + " ", void 0 === g[j] && (g[j] = e.needsContext ? -1 < p(j, this).index(l) : p.find(j, this, null, [l]).length), g[j] && f.push(e); f.length && n.push({ elem: l, handlers: f }) } return l = this, q < c.length && n.push({ elem: l, handlers: c.slice(q) }), n }, addProp: function(b, c) { Object.defineProperty(p.Event.prototype, b, { enumerable: !0, configurable: !0, get: p.isFunction(c) ? function() { if (this.originalEvent) return c(this.originalEvent) } : function() { if (this.originalEvent) return this.originalEvent[b] }, set: function(c) { Object.defineProperty(this, b, { enumerable: !0, configurable: !0, writable: !0, value: c }) } }) }, fix: function(b) { return b[p.expando] ? b : new p.Event(b) }, special: { load: { noBubble: !0 }, focus: { trigger: function() { if (this !== E() && this.focus) return this.focus(), !1 }, delegateType: "focusin" }, blur: { trigger: function() { if (this === E() && this.blur) return this.blur(), !1 }, delegateType: "focusout" }, click: { trigger: function() { if ("checkbox" === this.type && this.click && g(this, "input")) return this.click(), !1 }, _default: function(b) { return g(b.target, "a") } }, beforeunload: { postDispatch: function(b) { void 0 !== b.result && b.originalEvent && (b.originalEvent.returnValue = b.result) } } } }; p.removeEvent = function(b, c, d) { b.removeEventListener && b.removeEventListener(c, d) }; p.Event = function(b, c) { return this instanceof p.Event ? (b && b.type ? (this.originalEvent = b, this.type = b.type, this.isDefaultPrevented = b.defaultPrevented || void 0 === b.defaultPrevented && !1 === b.returnValue ? C : B, this.target = b.target && 3 === b.target.nodeType ? b.target.parentNode : b.target, this.currentTarget = b.currentTarget, this.relatedTarget = b.relatedTarget) : this.type = b, c && p.extend(this, c), this.timeStamp = b && b.timeStamp || p.now(), void(this[p.expando] = !0)) : new p.Event(b, c) }; p.Event.prototype = { constructor: p.Event, isDefaultPrevented: B, isPropagationStopped: B, isImmediatePropagationStopped: B, isSimulated: !1, preventDefault: function() { var b = this.originalEvent; this.isDefaultPrevented = C; b && !this.isSimulated && b.preventDefault() }, stopPropagation: function() { var b = this.originalEvent; this.isPropagationStopped = C; b && !this.isSimulated && b.stopPropagation() }, stopImmediatePropagation: function() { var b = this.originalEvent; this.isImmediatePropagationStopped = C; b && !this.isSimulated && b.stopImmediatePropagation(); this.stopPropagation() } }; p.each({ altKey: !0, bubbles: !0, cancelable: !0, changedTouches: !0, ctrlKey: !0, detail: !0, eventPhase: !0, metaKey: !0, pageX: !0, pageY: !0, shiftKey: !0, view: !0, "char": !0, charCode: !0, key: !0, keyCode: !0, button: !0, buttons: !0, clientX: !0, clientY: !0, offsetX: !0, offsetY: !0, pointerId: !0, pointerType: !0, screenX: !0, screenY: !0, targetTouches: !0, toElement: !0, touches: !0, which: function(b) { var c = b.button; return null == b.which && id.test(b.type) ? null != b.charCode ? b.charCode : b.keyCode : !b.which && void 0 !== c && jd.test(b.type) ? 1 & c ? 1 : 2 & c ? 3 : 4 & c ? 2 : 0 : b.which } }, p.event.addProp); p.each({ mouseenter: "mouseover", mouseleave: "mouseout", pointerenter: "pointerover", pointerleave: "pointerout" }, function(b, c) { p.event.special[b] = { delegateType: c, bindType: c, handle: function(b) { var d, e = b.relatedTarget, j = b.handleObj; return e && (e === this || p.contains(this, e)) || (b.type = j.origType, d = j.handler.apply(this, arguments), b.type = c), d } } }); p.fn.extend({ on: function(b, c, d, e) { return G(this, b, c, d, e) }, one: function(b, c, d, e) { return G(this, b, c, d, e, 1) }, off: function(b, c, d) { var e, j; if (b && b.preventDefault && b.handleObj) return e = b.handleObj, p(b.delegateTarget).off(e.namespace ? e.origType + "." + e.namespace : e.origType, e.selector, e.handler), this; if ("object" == typeof b) { for (j in b) this.off(j, c, b[j]); return this } return !1 !== c && "function" != typeof c || (d = c, c = void 0), !1 === d && (d = B), this.each(function() { p.event.remove(this, b, d, c) }) } }); var kd = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, ld = /\s*$/g; p.extend({ htmlPrefilter: function(b) { return b.replace(kd, "<$1>") }, clone: function(b, c, d) { var e, j, f, g, n = b.cloneNode(!0), q = p.contains(b.ownerDocument, b); if (!W.noCloneChecked && !(1 !== b.nodeType && 11 !== b.nodeType || p.isXMLDoc(b))) { g = y(n); f = y(b); e = 0; for (j = f.length; e < j; e++) { var l = f[e], r = g[e], s = r.nodeName.toLowerCase(); "input" === s && rc.test(l.type) ? r.checked = l.checked : "input" !== s && "textarea" !== s || (r.defaultValue = l.defaultValue) } } if (c) if (d) { f = f || y(b); g = g || y(n); e = 0; for (j = f.length; e < j; e++) O(f[e], g[e]) } else O(b, n); return g = y(n, "script"), 0 < g.length && z(g, !q && y(b, "script")), n }, cleanData: function(b) { for (var c, d, e, j = p.event.special, f = 0; void 0 !== (d = b[f]); f++) if (Eb(d)) { if (c = d[R.expando]) { if (c.events) for (e in c.events) j[e] ? p.event.remove(d, e) : p.removeEvent(d, e, c.handle); d[R.expando] = void 0 } d[ka.expando] && (d[ka.expando] = void 0) } } }); p.fn.extend({ detach: function(b) { return S(this, b, !0) }, remove: function(b) { return S(this, b) }, text: function(b) { return Ma(this, function(b) { return void 0 === b ? p.text(this) : this.empty().each(function() { 1 !== this.nodeType && 11 !== this.nodeType && 9 !== this.nodeType || (this.textContent = b) }) }, null, b, arguments.length) }, append: function() { return K(this, arguments, function(b) { (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) && D(this, b).appendChild(b) }) }, prepend: function() { return K(this, arguments, function(b) { if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) { var c = D(this, b); c.insertBefore(b, c.firstChild) } }) }, before: function() { return K(this, arguments, function(b) { this.parentNode && this.parentNode.insertBefore(b, this) }) }, after: function() { return K(this, arguments, function(b) { this.parentNode && this.parentNode.insertBefore(b, this.nextSibling) }) }, empty: function() { for (var b, c = 0; null != (b = this[c]); c++) 1 === b.nodeType && (p.cleanData(y(b, !1)), b.textContent = ""); return this }, clone: function(b, c) { return b = null != b && b, c = null == c ? b : c, this.map(function() { return p.clone(this, b, c) }) }, html: function(b) { return Ma(this, function(b) { var c = this[0] || {}, d = 0, e = this.length; if (void 0 === b && 1 === c.nodeType) return c.innerHTML; if ("string" == typeof b && !ld.test(b) && !oa[(Zb.exec(b) || ["", ""])[1].toLowerCase()]) { b = p.htmlPrefilter(b); try { for (; d < e; d++) c = this[d] || {}, 1 === c.nodeType && (p.cleanData(y(c, !1)), c.innerHTML = b); c = 0 } catch (j) {} } c && this.empty().append(b) }, null, b, arguments.length) }, replaceWith: function() { var b = []; return K(this, arguments, function(c) { var d = this.parentNode; 0 > p.inArray(this, b) && (p.cleanData(y(this)), d && d.replaceChild(c, this)) }, b) } }); p.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function(b, c) { p.fn[b] = function(b) { for (var d = [], e = p(b), j = e.length - 1, f = 0; f <= j; f++) b = f === j ? this : this.clone(!0), p(e[f])[c](b), Oa.apply(d, b.get()); return this.pushStack(d) } }); var ac = /^margin/, Lb = RegExp("^(" + pc + ")(?!px)[a-z%]+$", "i"), ub = function(c) { var d = c.ownerDocument.defaultView; return d && d.opener || (d = b), d.getComputedStyle(c) }, Jb = function() { if (Ba) { Ba.style.cssText = "box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%"; Ba.innerHTML = ""; Hb.appendChild(Ib); var c = b.getComputedStyle(Ba); tc = "1%" !== c.top; uc = "2px" === c.marginLeft; vc = "4px" === c.width; Ba.style.marginRight = "50%"; wc = "4px" === c.marginRight; Hb.removeChild(Ib); Ba = null } }, tc, vc, wc, uc, Ib = M.createElement("div"), Ba = M.createElement("div"); Ba.style && (Ba.style.backgroundClip = "content-box", Ba.cloneNode(!0).style.backgroundClip = "", W.clearCloneStyle = "content-box" === Ba.style.backgroundClip, Ib.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute", Ib.appendChild(Ba), p.extend(W, { pixelPosition: function() { return Jb(), tc }, boxSizingReliable: function() { return Jb(), vc }, pixelMarginRight: function() { return Jb(), wc }, reliableMarginLeft: function() { return Jb(), uc } })); !0; var md = /^(none|table(?!-c[ea]).+)/, xc = /^--/, nd = { position: "absolute", visibility: "hidden", display: "block" }, yc = { letterSpacing: "0", fontWeight: "400" }, cc = ["Webkit", "Moz", "ms"], bc = M.createElement("div").style; p.extend({ cssHooks: { opacity: { get: function(b, c) { if (c) { var d = J(b, "opacity"); return "" === d ? "1" : d } } } }, cssNumber: { animationIterationCount: !0, columnCount: !0, fillOpacity: !0, flexGrow: !0, flexShrink: !0, fontWeight: !0, lineHeight: !0, opacity: !0, order: !0, orphans: !0, widows: !0, zIndex: !0, zoom: !0 }, cssProps: { "float": "cssFloat" }, style: function(b, c, d, e) { if (b && 3 !== b.nodeType && 8 !== b.nodeType && b.style) { var j, f, g, n = p.camelCase(c), q = xc.test(c), l = b.style; return q || (c = ca(n)), g = p.cssHooks[c] || p.cssHooks[n], void 0 === d ? g && "get" in g && void 0 !== (j = g.get(b, !1, e)) ? j : l[c] : (f = typeof d, "string" === f && (j = lb.exec(d)) && j[1] && (d = t(b, c, j), f = "number"), null != d && d === d && ("number" === f && (d += j && j[3] || (p.cssNumber[n] ? "" : "px")), W.clearCloneStyle || "" !== d || 0 !== c.indexOf("background") || (l[c] = "inherit"), g && "set" in g && void 0 === (d = g.set(b, d, e)) || (q ? l.setProperty(c, d) : l[c] = d)), void 0) } }, css: function(b, c, d, e) { var j, f, g, n = p.camelCase(c); return xc.test(c) || (c = ca(n)), g = p.cssHooks[c] || p.cssHooks[n], g && "get" in g && (j = g.get(b, !0, d)), void 0 === j && (j = J(b, c, e)), "normal" === j && c in yc && (j = yc[c]), "" === d || d ? (f = parseFloat(j), !0 === d || isFinite(f) ? f || 0 : j) : j } }); p.each(["height", "width"], function(b, c) { p.cssHooks[c] = { get: function(b, d, e) { if (d) return !md.test(p.css(b, "display")) || b.getClientRects().length && b.getBoundingClientRect().width ? da(b, c, e) : qc(b, nd, function() { return da(b, c, e) }) }, set: function(b, d, e) { var j, f = e && ub(b); e = e && N(b, c, e, "border-box" === p.css(b, "boxSizing", !1, f), f); return e && (j = lb.exec(d)) && "px" !== (j[3] || "px") && (b.style[c] = d, d = p.css(b, c)), F(b, d, e) } } }); p.cssHooks.marginLeft = Y(W.reliableMarginLeft, function(b, c) { if (c) return (parseFloat(J(b, "marginLeft")) || b.getBoundingClientRect().left - qc(b, { marginLeft: 0 }, function() { return b.getBoundingClientRect().left })) + "px" }); p.each({ margin: "", padding: "", border: "Width" }, function(b, c) { p.cssHooks[b + c] = { expand: function(d) { var e = 0, j = {}; for (d = "string" == typeof d ? d.split(" ") : [d]; 4 > e; e++) j[b + Wa[e] + c] = d[e] || d[e - 2] || d[0]; return j } }; ac.test(b) || (p.cssHooks[b + c].set = F) }); p.fn.extend({ css: function(b, c) { return Ma(this, function(b, c, d) { var e, j = {}, f = 0; if (Array.isArray(c)) { d = ub(b); for (e = c.length; f < e; f++) j[c[f]] = p.css(b, c[f], !1, d); return j } return void 0 !== d ? p.style(b, c, d) : p.css(b, c) }, b, c, 1 < arguments.length) } }); p.Tween = T; T.prototype = { constructor: T, init: function(b, c, d, e, j, f) { this.elem = b; this.prop = d; this.easing = j || p.easing._default; this.options = c; this.start = this.now = this.cur(); this.end = e; this.unit = f || (p.cssNumber[d] ? "" : "px") }, cur: function() { var b = T.propHooks[this.prop]; return b && b.get ? b.get(this) : T.propHooks._default.get(this) }, run: function(b) { var c, d = T.propHooks[this.prop]; return this.options.duration ? this.pos = c = p.easing[this.easing](b, this.options.duration * b, 0, 1, this.options.duration) : this.pos = c = b, this.now = (this.end - this.start) * c + this.start, this.options.step && this.options.step.call(this.elem, this.now, this), d && d.set ? d.set(this) : T.propHooks._default.set(this), this } }; T.prototype.init.prototype = T.prototype; T.propHooks = { _default: { get: function(b) { var c; return 1 !== b.elem.nodeType || null != b.elem[b.prop] && null == b.elem.style[b.prop] ? b.elem[b.prop] : (c = p.css(b.elem, b.prop, ""), c && "auto" !== c ? c : 0) }, set: function(b) { p.fx.step[b.prop] ? p.fx.step[b.prop](b) : 1 !== b.elem.nodeType || null == b.elem.style[p.cssProps[b.prop]] && !p.cssHooks[b.prop] ? b.elem[b.prop] = b.now : p.style(b.elem, b.prop, b.now + b.unit) } } }; T.propHooks.scrollTop = T.propHooks.scrollLeft = { set: function(b) { b.elem.nodeType && b.elem.parentNode && (b.elem[b.prop] = b.now) } }; p.easing = { linear: function(b) { return b }, swing: function(b) { return 0.5 - Math.cos(b * Math.PI) / 2 }, _default: "swing" }; p.fx = T.prototype.init; p.fx.step = {}; var bb, vb, od = /^(?:toggle|show|hide)$/, pd = /queueHooks$/; p.Animation = p.extend(aa, { tweeners: { "*": [function(b, c) { var d = this.createTween(b, c); return t(d.elem, b, lb.exec(c), d), d }] }, tweener: function(b, c) { p.isFunction(b) ? (c = b, b = ["*"]) : b = b.match(pa); for (var d, e = 0, j = b.length; e < j; e++) d = b[e], aa.tweeners[d] = aa.tweeners[d] || [], aa.tweeners[d].unshift(c) }, prefilters: [function(b, c, d) { var e, j, f, g, n, q, l, r, s = "width" in c || "height" in c, m = this, t = {}, y = b.style, z = b.nodeType && tb(b), L = R.get(b, "fxshow"); d.queue || (g = p._queueHooks(b, "fx"), null == g.unqueued && (g.unqueued = 0, n = g.empty.fire, g.empty.fire = function() { g.unqueued || n() }), g.unqueued++, m.always(function() { m.always(function() { g.unqueued--; p.queue(b, "fx").length || g.empty.fire() }) })); for (e in c) if (j = c[e], od.test(j)) { if (delete c[e], f = f || "toggle" === j, j === (z ? "hide" : "show")) { if ("show" !== j || !L || void 0 === L[e]) continue; z = !0 } t[e] = L && L[e] || p.style(b, e) } if (q = !p.isEmptyObject(c), q || !p.isEmptyObject(t)) for (e in s && 1 === b.nodeType && (d.overflow = [y.overflow, y.overflowX, y.overflowY], l = L && L.display, null == l && (l = R.get(b, "display")), r = p.css(b, "display"), "none" === r && (l ? r = l : (u([b], !0), l = b.style.display || l, r = p.css(b, "display"), u([b]))), ("inline" === r || "inline-block" === r && null != l) && "none" === p.css(b, "float") && (q || (m.done(function() { y.display = l }), null == l && (r = y.display, l = "none" === r ? "" : r)), y.display = "inline-block")), d.overflow && (y.overflow = "hidden", m.always(function() { y.overflow = d.overflow[0]; y.overflowX = d.overflow[1]; y.overflowY = d.overflow[2] })), q = !1, t) q || (L ? "hidden" in L && (z = L.hidden) : L = R.access(b, "fxshow", { display: l }), f && (L.hidden = !z), z && u([b], !0), m.done(function() { z || u([b]); R.remove(b, "fxshow"); for (e in t) p.style(b, e, t[e]) })), q = X(z ? L[e] : 0, e, m), e in L || (L[e] = q.start, z && (q.end = q.start, q.start = 0)) }], prefilter: function(b, c) { c ? aa.prefilters.unshift(b) : aa.prefilters.push(b) } }); p.speed = function(b, c, d) { var e = b && "object" == typeof b ? p.extend({}, b) : { complete: d || !d && c || p.isFunction(b) && b, duration: b, easing: d && c || c && !p.isFunction(c) && c }; return p.fx.off ? e.duration = 0 : "number" != typeof e.duration && (e.duration in p.fx.speeds ? e.duration = p.fx.speeds[e.duration] : e.duration = p.fx.speeds._default), null != e.queue && !0 !== e.queue || (e.queue = "fx"), e.old = e.complete, e.complete = function() { p.isFunction(e.old) && e.old.call(this); e.queue && p.dequeue(this, e.queue) }, e }; p.fn.extend({ fadeTo: function(b, c, d, e) { return this.filter(tb).css("opacity", 0).show().end().animate({ opacity: c }, b, d, e) }, animate: function(b, c, d, e) { var j = p.isEmptyObject(b), f = p.speed(c, d, e); c = function() { var c = aa(this, p.extend({}, b), f); (j || R.get(this, "finish")) && c.stop(!0) }; return c.finish = c, j || !1 === f.queue ? this.each(c) : this.queue(f.queue, c) }, stop: function(b, c, d) { var e = function(b) { var c = b.stop; delete b.stop; c(d) }; return "string" != typeof b && (d = c, c = b, b = void 0), c && !1 !== b && this.queue(b || "fx", []), this.each(function() { var c = !0, j = null != b && b + "queueHooks", f = p.timers, g = R.get(this); if (j) g[j] && g[j].stop && e(g[j]); else for (j in g) g[j] && g[j].stop && pd.test(j) && e(g[j]); for (j = f.length; j--;) f[j].elem !== this || null != b && f[j].queue !== b || (f[j].anim.stop(d), c = !1, f.splice(j, 1)); !c && d || p.dequeue(this, b) }) }, finish: function(b) { return !1 !== b && (b = b || "fx"), this.each(function() { var c, d = R.get(this), e = d[b + "queue"]; c = d[b + "queueHooks"]; var j = p.timers, f = e ? e.length : 0; d.finish = !0; p.queue(this, b, []); c && c.stop && c.stop.call(this, !0); for (c = j.length; c--;) j[c].elem === this && j[c].queue === b && (j[c].anim.stop(!0), j.splice(c, 1)); for (c = 0; c < f; c++) e[c] && e[c].finish && e[c].finish.call(this); delete d.finish }) } }); p.each(["toggle", "show", "hide"], function(b, c) { var d = p.fn[c]; p.fn[c] = function(b, e, j) { return null == b || "boolean" == typeof b ? d.apply(this, arguments) : this.animate(I(c, !0), b, e, j) } }); p.each({ slideDown: I("show"), slideUp: I("hide"), slideToggle: I("toggle"), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } }, function(b, c) { p.fn[b] = function(b, d, e) { return this.animate(c, b, d, e) } }); p.timers = []; p.fx.tick = function() { var b, c = 0, d = p.timers; for (bb = p.now(); c < d.length; c++) b = d[c], b() || d[c] !== b || d.splice(c--, 1); d.length || p.fx.stop(); bb = void 0 }; p.fx.timer = function(b) { p.timers.push(b); p.fx.start() }; p.fx.interval = 13; p.fx.start = function() { vb || (vb = !0, P()) }; p.fx.stop = function() { vb = null }; p.fx.speeds = { slow: 600, fast: 200, _default: 400 }; p.fn.delay = function(c, d) { return c = p.fx ? p.fx.speeds[c] || c : c, d = d || "fx", this.queue(d, function(d, e) { var j = b.setTimeout(d, c); e.stop = function() { b.clearTimeout(j) } }) }; var jb = M.createElement("input"), qd = M.createElement("select").appendChild(M.createElement("option")); jb.type = "checkbox"; W.checkOn = "" !== jb.value; W.optSelected = qd.selected; jb = M.createElement("input"); jb.value = "t"; jb.type = "radio"; W.radioValue = "t" === jb.value; var zc, qb = p.expr.attrHandle; p.fn.extend({ attr: function(b, c) { return Ma(this, p.attr, b, c, 1 < arguments.length) }, removeAttr: function(b) { return this.each(function() { p.removeAttr(this, b) }) } }); p.extend({ attr: function(b, c, d) { var e, j, f = b.nodeType; if (3 !== f && 8 !== f && 2 !== f) return "undefined" == typeof b.getAttribute ? p.prop(b, c, d) : (1 === f && p.isXMLDoc(b) || (j = p.attrHooks[c.toLowerCase()] || (p.expr.match.bool.test(c) ? zc : void 0)), void 0 !== d ? null === d ? void p.removeAttr(b, c) : j && "set" in j && void 0 !== (e = j.set(b, d, c)) ? e : (b.setAttribute(c, d + ""), d) : j && "get" in j && null !== (e = j.get(b, c)) ? e : (e = p.find.attr(b, c), null == e ? void 0 : e)) }, attrHooks: { type: { set: function(b, c) { if (!W.radioValue && "radio" === c && g(b, "input")) { var d = b.value; return b.setAttribute("type", c), d && (b.value = d), c } } } }, removeAttr: function(b, c) { var d, e = 0, j = c && c.match(pa); if (j && 1 === b.nodeType) for (; d = j[e++];) b.removeAttribute(d) } }); zc = { set: function(b, c, d) { return !1 === c ? p.removeAttr(b, d) : b.setAttribute(d, d), d } }; p.each(p.expr.match.bool.source.match(/\w+/g), function(b, c) { var d = qb[c] || p.find.attr; qb[c] = function(b, c, e) { var j, f, g = c.toLowerCase(); return e || (f = qb[g], qb[g] = j, j = null != d(b, c, e) ? g : null, qb[g] = f), j } }); var rd = /^(?:input|select|textarea|button)$/i, sd = /^(?:a|area)$/i; p.fn.extend({ prop: function(b, c) { return Ma(this, p.prop, b, c, 1 < arguments.length) }, removeProp: function(b) { return this.each(function() { delete this[p.propFix[b] || b] }) } }); p.extend({ prop: function(b, c, d) { var e, j, f = b.nodeType; if (3 !== f && 8 !== f && 2 !== f) return 1 === f && p.isXMLDoc(b) || (c = p.propFix[c] || c, j = p.propHooks[c]), void 0 !== d ? j && "set" in j && void 0 !== (e = j.set(b, d, c)) ? e : b[c] = d : j && "get" in j && null !== (e = j.get(b, c)) ? e : b[c] }, propHooks: { tabIndex: { get: function(b) { var c = p.find.attr(b, "tabindex"); return c ? parseInt(c, 10) : rd.test(b.nodeName) || sd.test(b.nodeName) && b.href ? 0 : -1 } } }, propFix: { "for": "htmlFor", "class": "className" } }); W.optSelected || (p.propHooks.selected = { get: function(b) { b = b.parentNode; return b && b.parentNode && b.parentNode.selectedIndex, null }, set: function(b) { b = b.parentNode; b && (b.selectedIndex, b.parentNode && b.parentNode.selectedIndex) } }); p.each("tabIndex readOnly maxLength cellSpacing cellPadding rowSpan colSpan useMap frameBorder contentEditable".split(" "), function() { p.propFix[this.toLowerCase()] = this }); p.fn.extend({ addClass: function(b) { var c, d, e, j, f, g, n = 0; if (p.isFunction(b)) return this.each(function(c) { p(this).addClass(b.call(this, c, qa(this))) }); if ("string" == typeof b && b) for (c = b.match(pa) || []; d = this[n++];) if (j = qa(d), e = 1 === d.nodeType && " " + la(j) + " ") { for (g = 0; f = c[g++];) 0 > e.indexOf(" " + f + " ") && (e += f + " "); e = la(e); j !== e && d.setAttribute("class", e) } return this }, removeClass: function(b) { var c, d, e, j, f, g, n = 0; if (p.isFunction(b)) return this.each(function(c) { p(this).removeClass(b.call(this, c, qa(this))) }); if (!arguments.length) return this.attr("class", ""); if ("string" == typeof b && b) for (c = b.match(pa) || []; d = this[n++];) if (j = qa(d), e = 1 === d.nodeType && " " + la(j) + " ") { for (g = 0; f = c[g++];) for (; - 1 < e.indexOf(" " + f + " ");) e = e.replace(" " + f + " ", " "); e = la(e); j !== e && d.setAttribute("class", e) } return this }, toggleClass: function(b, c) { var d = typeof b; return "boolean" == typeof c && "string" === d ? c ? this.addClass(b) : this.removeClass(b) : p.isFunction(b) ? this.each(function(d) { p(this).toggleClass(b.call(this, d, qa(this), c), c) }) : this.each(function() { var c, e, j, f; if ("string" === d) { e = 0; j = p(this); for (f = b.match(pa) || []; c = f[e++];) j.hasClass(c) ? j.removeClass(c) : j.addClass(c) } else void 0 !== b && "boolean" !== d || (c = qa(this), c && R.set(this, "__className__", c), this.setAttribute && this.setAttribute("class", c || !1 === b ? "" : R.get(this, "__className__") || "")) }) }, hasClass: function(b) { var c, d = 0; for (b = " " + b + " "; c = this[d++];) if (1 === c.nodeType && -1 < (" " + la(qa(c)) + " ").indexOf(b)) return !0; return !1 } }); var td = /\r/g; p.fn.extend({ val: function(b) { var c, d, e, j = this[0]; if (arguments.length) return e = p.isFunction(b), this.each(function(d) { var j; 1 === this.nodeType && (j = e ? b.call(this, d, p(this).val()) : b, null == j ? j = "" : "number" == typeof j ? j += "" : Array.isArray(j) && (j = p.map(j, function(b) { return null == b ? "" : b + "" })), c = p.valHooks[this.type] || p.valHooks[this.nodeName.toLowerCase()], c && "set" in c && void 0 !== c.set(this, j, "value") || (this.value = j)) }); if (j) return c = p.valHooks[j.type] || p.valHooks[j.nodeName.toLowerCase()], c && "get" in c && void 0 !== (d = c.get(j, "value")) ? d : (d = j.value, "string" == typeof d ? d.replace(td, "") : null == d ? "" : d) } }); p.extend({ valHooks: { option: { get: function(b) { var c = p.find.attr(b, "value"); return null != c ? c : la(p.text(b)) } }, select: { get: function(b) { var c, d, e = b.options, j = b.selectedIndex, f = "select-one" === b.type, n = f ? null : [], q = f ? j + 1 : e.length; for (d = 0 > j ? q : f ? j : 0; d < q; d++) if (c = e[d], (c.selected || d === j) && !c.disabled && (!c.parentNode.disabled || !g(c.parentNode, "optgroup"))) { if (b = p(c).val(), f) return b; n.push(b) } return n }, set: function(b, c) { for (var d, e, j = b.options, f = p.makeArray(c), g = j.length; g--;) e = j[g], (e.selected = -1 < p.inArray(p.valHooks.option.get(e), f)) && (d = !0); return d || (b.selectedIndex = -1), f } } } }); p.each(["radio", "checkbox"], function() { p.valHooks[this] = { set: function(b, c) { if (Array.isArray(c)) return b.checked = -1 < p.inArray(p(b).val(), c) } }; W.checkOn || (p.valHooks[this].get = function(b) { return null === b.getAttribute("value") ? "on" : b.value }) }); var Ac = /^(?:focusinfocus|focusoutblur)$/; p.extend(p.event, { trigger: function(c, d, e, j) { var f, g, n, q, l, r, s, m = [e || M], t = db.call(c, "type") ? c.type : c; f = db.call(c, "namespace") ? c.namespace.split(".") : []; if (g = n = e = e || M, 3 !== e.nodeType && 8 !== e.nodeType && !Ac.test(t + p.event.triggered) && (-1 < t.indexOf(".") && (f = t.split("."), t = f.shift(), f.sort()), l = 0 > t.indexOf(":") && "on" + t, c = c[p.expando] ? c : new p.Event(t, "object" == typeof c && c), c.isTrigger = j ? 2 : 3, c.namespace = f.join("."), c.rnamespace = c.namespace ? RegExp("(^|\\.)" + f.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, c.result = void 0, c.target || (c.target = e), d = null == d ? [c] : p.makeArray(d, [c]), s = p.event.special[t] || {}, j || !s.trigger || !1 !== s.trigger.apply(e, d))) { if (!j && !s.noBubble && !p.isWindow(e)) { q = s.delegateType || t; for (Ac.test(q + t) || (g = g.parentNode); g; g = g.parentNode) m.push(g), n = g; n === (e.ownerDocument || M) && m.push(n.defaultView || n.parentWindow || b) } for (f = 0; (g = m[f++]) && !c.isPropagationStopped();) c.type = 1 < f ? q : s.bindType || t, (r = (R.get(g, "events") || {})[c.type] && R.get(g, "handle")) && r.apply(g, d), (r = l && g[l]) && r.apply && Eb(g) && (c.result = r.apply(g, d), !1 === c.result && c.preventDefault()); return c.type = t, j || c.isDefaultPrevented() || s._default && !1 !== s._default.apply(m.pop(), d) || !Eb(e) || l && p.isFunction(e[t]) && !p.isWindow(e) && (n = e[l], n && (e[l] = null), p.event.triggered = t, e[t](), p.event.triggered = void 0, n && (e[l] = n)), c.result } }, simulate: function(b, c, d) { b = p.extend(new p.Event, d, { type: b, isSimulated: !0 }); p.event.trigger(b, null, c) } }); p.fn.extend({ trigger: function(b, c) { return this.each(function() { p.event.trigger(b, c, this) }) }, triggerHandler: function(b, c) { var d = this[0]; if (d) return p.event.trigger(b, c, d, !0) } }); p.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "), function(b, c) { p.fn[c] = function(b, d) { return 0 < arguments.length ? this.on(c, null, b, d) : this.trigger(c) } }); p.fn.extend({ hover: function(b, c) { return this.mouseenter(b).mouseleave(c || b) } }); W.focusin = "onfocusin" in b; W.focusin || p.each({ focus: "focusin", blur: "focusout" }, function(b, c) { var d = function(b) { p.event.simulate(c, b.target, p.event.fix(b)) }; p.event.special[c] = { setup: function() { var e = this.ownerDocument || this, j = R.access(e, c); j || e.addEventListener(b, d, !0); R.access(e, c, (j || 0) + 1) }, teardown: function() { var e = this.ownerDocument || this, j = R.access(e, c) - 1; j ? R.access(e, c, j) : (e.removeEventListener(b, d, !0), R.remove(e, c)) } } }); var rb = b.location, Bc = p.now(), Vb = /\?/; p.parseXML = function(c) { var d; if (!c || "string" != typeof c) return null; try { d = (new b.DOMParser).parseFromString(c, "text/xml") } catch (e) { d = void 0 } return d && !d.getElementsByTagName("parsererror").length || p.error("Invalid XML: " + c), d }; var Qc = /\[\]$/, Cc = /\r?\n/g, ud = /^(?:submit|button|image|reset|file)$/i, vd = /^(?:input|select|textarea|keygen)/i; p.param = function(b, c) { var d, e = [], j = function(b, c) { var d = p.isFunction(c) ? c() : c; e[e.length] = encodeURIComponent(b) + "=" + encodeURIComponent(null == d ? "" : d) }; if (Array.isArray(b) || b.jquery && !p.isPlainObject(b)) p.each(b, function() { j(this.name, this.value) }); else for (d in b) ea(d, b[d], c, j); return e.join("&") }; p.fn.extend({ serialize: function() { return p.param(this.serializeArray()) }, serializeArray: function() { return this.map(function() { var b = p.prop(this, "elements"); return b ? p.makeArray(b) : this }).filter(function() { var b = this.type; return this.name && !p(this).is(":disabled") && vd.test(this.nodeName) && !ud.test(b) && (this.checked || !rc.test(b)) }).map(function(b, c) { var d = p(this).val(); return null == d ? null : Array.isArray(d) ? p.map(d, function(b) { return { name: c.name, value: b.replace(Cc, "\r\n") } }) : { name: c.name, value: d.replace(Cc, "\r\n") } }).get() } }); var wd = /%20/g, xd = /#.*$/, yd = /([?&])_=[^&]*/, zd = /^(.*?):[ \t]*([^\r\n]*)$/gm, Ad = /^(?:GET|HEAD)$/, Bd = /^\/\//, Dc = {}, Mb = {}, Ec = "*/".concat("*"), Wb = M.createElement("a"); Wb.href = rb.href; p.extend({ active: 0, lastModified: {}, etag: {}, ajaxSettings: { url: rb.href, type: "GET", isLocal: /^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(rb.protocol), global: !0, processData: !0, async: !0, contentType: "application/x-www-form-urlencoded; charset=UTF-8", accepts: { "*": Ec, text: "text/plain", html: "text/html", xml: "application/xml, text/xml", json: "application/json, text/javascript" }, contents: { xml: /\bxml\b/, html: /\bhtml/, json: /\bjson\b/ }, responseFields: { xml: "responseXML", text: "responseText", json: "responseJSON" }, converters: { "* text": String, "text html": !0, "text json": JSON.parse, "text xml": p.parseXML }, flatOptions: { url: !0, context: !0 } }, ajaxSetup: function(b, c) { return c ? Na(Na(b, p.ajaxSettings), c) : Na(p.ajaxSettings, b) }, ajaxPrefilter: va(Dc), ajaxTransport: va(Mb), ajax: function(c, d) { function e(c, d, n, l) { var m, t, I, G, A = d; if (!r) { r = !0; q && b.clearTimeout(q); j = void 0; g = l || ""; x.readyState = 0 < c ? 4 : 0; l = 200 <= c && 300 > c || 304 === c; if (n) { I = u; for (var Aa = x, P, H, J, F, N = I.contents, Q = I.dataTypes; "*" === Q[0];) Q.shift(), void 0 === P && (P = I.mimeType || Aa.getResponseHeader("Content-Type")); if (P) for (H in N) if (N[H] && N[H].test(P)) { Q.unshift(H); break } if (Q[0] in n) J = Q[0]; else { for (H in n) { if (!Q[0] || I.converters[H + " " + Q[0]]) { J = H; break } F || (F = H) } J = J || F } I = n = J ? (J !== Q[0] && Q.unshift(J), n[J]) : void 0 } var C; a: { n = u;P = I;H = x;J = l; var K, fa, X;I = {};Aa = n.dataTypes.slice(); if (Aa[1]) for (K in n.converters) I[K.toLowerCase()] = n.converters[K]; for (F = Aa.shift(); F;) if (n.responseFields[F] && (H[n.responseFields[F]] = P), !X && J && n.dataFilter && (P = n.dataFilter(P, n.dataType)), X = F, F = Aa.shift()) if ("*" === F) F = X; else if ("*" !== X && X !== F) { if (K = I[X + " " + F] || I["* " + F], !K) for (C in I) if (fa = C.split(" "), fa[1] === F && (K = I[X + " " + fa[0]] || I["* " + fa[0]])) { !0 === K ? K = I[C] : !0 !== I[C] && (F = fa[0], Aa.unshift(fa[1])); break } if (!0 !== K) if (K && n["throws"]) P = K(P); else try { P = K(P) } catch (fb) { C = { state: "parsererror", error: K ? fb : "No conversion from " + X + " to " + F }; break a } } C = { state: "success", data: P } } I = C; l ? (u.ifModified && (G = x.getResponseHeader("Last-Modified"), G && (p.lastModified[f] = G), G = x.getResponseHeader("etag"), G && (p.etag[f] = G)), 204 === c || "HEAD" === u.type ? A = "nocontent" : 304 === c ? A = "notmodified" : (A = I.state, m = I.data, t = I.error, l = !t)) : (t = A, !c && A || (A = "error", 0 > c && (c = 0))); x.status = c; x.statusText = (d || A) + ""; l ? L.resolveWith(y, [m, A, x]) : L.rejectWith(y, [x, A, t]); x.statusCode(D); D = void 0; s && z.trigger(l ? "ajaxSuccess" : "ajaxError", [x, u, l ? m : t]); O.fireWith(y, [x, A]); s && (z.trigger("ajaxComplete", [x, u]), --p.active || p.event.trigger("ajaxStop")) } } "object" == typeof c && (d = c, c = void 0); d = d || {}; var j, f, g, n, q, l, r, s, m, t, u = p.ajaxSetup({}, d), y = u.context || u, z = u.context && (y.nodeType || y.jquery) ? p(y) : p.event, L = p.Deferred(), O = p.Callbacks("once memory"), D = u.statusCode || {}, I = {}, G = {}, A = "canceled", x = { readyState: 0, getResponseHeader: function(b) { var c; if (r) { if (!n) for (n = {}; c = zd.exec(g);) n[c[1].toLowerCase()] = c[2]; c = n[b.toLowerCase()] } return null == c ? null : c }, getAllResponseHeaders: function() { return r ? g : null }, setRequestHeader: function(b, c) { return null == r && (b = G[b.toLowerCase()] = G[b.toLowerCase()] || b, I[b] = c), this }, overrideMimeType: function(b) { return null == r && (u.mimeType = b), this }, statusCode: function(b) { var c; if (b) if (r) x.always(b[x.status]); else for (c in b) D[c] = [D[c], b[c]]; return this }, abort: function(b) { b = b || A; return j && j.abort(b), e(0, b), this } }; if (L.promise(x), u.url = ((c || u.url || rb.href) + "").replace(Bd, rb.protocol + "//"), u.type = d.method || d.type || u.method || u.type, u.dataTypes = (u.dataType || "*").toLowerCase().match(pa) || [""], null == u.crossDomain) { l = M.createElement("a"); try { l.href = u.url, l.href = l.href, u.crossDomain = Wb.protocol + "//" + Wb.host != l.protocol + "//" + l.host } catch (Aa) { u.crossDomain = !0 } } if (u.data && u.processData && "string" != typeof u.data && (u.data = p.param(u.data, u.traditional)), wa(Dc, u, d, x), r) return x; (s = p.event && u.global) && 0 === p.active++ && p.event.trigger("ajaxStart"); u.type = u.type.toUpperCase(); u.hasContent = !Ad.test(u.type); f = u.url.replace(xd, ""); u.hasContent ? u.data && u.processData && 0 === (u.contentType || "").indexOf("application/x-www-form-urlencoded") && (u.data = u.data.replace(wd, "+")) : (t = u.url.slice(f.length), u.data && (f += (Vb.test(f) ? "&" : "?") + u.data, delete u.data), !1 === u.cache && (f = f.replace(yd, "$1"), t = (Vb.test(f) ? "&" : "?") + "_=" + Bc++ + t), u.url = f + t); u.ifModified && (p.lastModified[f] && x.setRequestHeader("If-Modified-Since", p.lastModified[f]), p.etag[f] && x.setRequestHeader("If-None-Match", p.etag[f])); (u.data && u.hasContent && !1 !== u.contentType || d.contentType) && x.setRequestHeader("Content-Type", u.contentType); x.setRequestHeader("Accept", u.dataTypes[0] && u.accepts[u.dataTypes[0]] ? u.accepts[u.dataTypes[0]] + ("*" !== u.dataTypes[0] ? ", " + Ec + "; q=0.01" : "") : u.accepts["*"]); for (m in u.headers) x.setRequestHeader(m, u.headers[m]); if (u.beforeSend && (!1 === u.beforeSend.call(y, x, u) || r)) return x.abort(); if (A = "abort", O.add(u.complete), x.done(u.success), x.fail(u.error), j = wa(Mb, u, d, x)) { if (x.readyState = 1, s && z.trigger("ajaxSend", [x, u]), r) return x; u.async && 0 < u.timeout && (q = b.setTimeout(function() { x.abort("timeout") }, u.timeout)); try { r = !1, j.send(I, e) } catch (P) { if (r) throw P; e(-1, P) } } else e(-1, "No Transport"); return x }, getJSON: function(b, c, d) { return p.get(b, c, d, "json") }, getScript: function(b, c) { return p.get(b, void 0, c, "script") } }); p.each(["get", "post"], function(b, c) { p[c] = function(b, d, e, j) { return p.isFunction(d) && (j = j || e, e = d, d = void 0), p.ajax(p.extend({ url: b, type: c, dataType: j, data: d, success: e }, p.isPlainObject(b) && b)) } }); p._evalUrl = function(b) { return p.ajax({ url: b, type: "GET", dataType: "script", cache: !0, async: !1, global: !1, "throws": !0 }) }; p.fn.extend({ wrapAll: function(b) { var c; return this[0] && (p.isFunction(b) && (b = b.call(this[0])), c = p(b, this[0].ownerDocument).eq(0).clone(!0), this[0].parentNode && c.insertBefore(this[0]), c.map(function() { for (var b = this; b.firstElementChild;) b = b.firstElementChild; return b }).append(this)), this }, wrapInner: function(b) { return p.isFunction(b) ? this.each(function(c) { p(this).wrapInner(b.call(this, c)) }) : this.each(function() { var c = p(this), d = c.contents(); d.length ? d.wrapAll(b) : c.append(b) }) }, wrap: function(b) { var c = p.isFunction(b); return this.each(function(d) { p(this).wrapAll(c ? b.call(this, d) : b) }) }, unwrap: function(b) { return this.parent(b).not("body").each(function() { p(this).replaceWith(this.childNodes) }), this } }); p.expr.pseudos.hidden = function(b) { return !p.expr.pseudos.visible(b) }; p.expr.pseudos.visible = function(b) { return !(!b.offsetWidth && !b.offsetHeight && !b.getClientRects().length) }; p.ajaxSettings.xhr = function() { try { return new b.XMLHttpRequest } catch (c) {} }; var Cd = { "0": 200, 1223: 204 }, sb = p.ajaxSettings.xhr(); W.cors = !!sb && "withCredentials" in sb; W.ajax = sb = !!sb; p.ajaxTransport(function(c) { var d, e; if (W.cors || sb && !c.crossDomain) return { send: function(j, f) { var g, n = c.xhr(); if (n.open(c.type, c.url, c.async, c.username, c.password), c.xhrFields) for (g in c.xhrFields) n[g] = c.xhrFields[g]; c.mimeType && n.overrideMimeType && n.overrideMimeType(c.mimeType); c.crossDomain || j["X-Requested-With"] || (j["X-Requested-With"] = "XMLHttpRequest"); for (g in j) n.setRequestHeader(g, j[g]); d = function(b) { return function() { d && (d = e = n.onload = n.onerror = n.onabort = n.onreadystatechange = null, "abort" === b ? n.abort() : "error" === b ? "number" != typeof n.status ? f(0, "error") : f(n.status, n.statusText) : f(Cd[n.status] || n.status, n.statusText, "text" !== (n.responseType || "text") || "string" != typeof n.responseText ? { binary: n.response } : { text: n.responseText }, n.getAllResponseHeaders())) } }; n.onload = d(); e = n.onerror = d("error"); void 0 !== n.onabort ? n.onabort = e : n.onreadystatechange = function() { 4 === n.readyState && b.setTimeout(function() { d && e() }) }; d = d("abort"); try { n.send(c.hasContent && c.data || null) } catch (q) { if (d) throw q; } }, abort: function() { d && d() } } }); p.ajaxPrefilter(function(b) { b.crossDomain && (b.contents.script = !1) }); p.ajaxSetup({ accepts: { script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, contents: { script: /\b(?:java|ecma)script\b/ }, converters: { "text script": function(b) { return p.globalEval(b), b } } }); p.ajaxPrefilter("script", function(b) { void 0 === b.cache && (b.cache = !1); b.crossDomain && (b.type = "GET") }); p.ajaxTransport("script", function(b) { if (b.crossDomain) { var c, d; return { send: function(e, j) { c = p("