{ "pandav:/dist/reshadergl.es.js": { "cubeCode": "Cube(\"pandav:/npm/@maptalks/reshader.gl/0.107.1/dist/reshadergl.es\", [\"pandav:/npm/gl-matrix/3.4.4\", \"pandav:/npm/@maptalks/tbn-packer/1.4.5\"], function (module, exports, require, load, process, global) {\n\n function _typeof(o) {\"@babel/helpers - typeof\";return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {return typeof o;} : function (o) {return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;}, _typeof(o);}\n Object.defineProperty(exports, \"__esModule\", {\n value: true });\n\n exports.earcut = exports.WireframeShader = exports.WireFrameMaterial = exports.WaterShader = exports.Util = exports.Texture2D = exports.StandardLiteShader = exports.StandardLiteMaterial = exports.SsrPass = exports.SkyboxShader = exports.ShadowPass = exports.ShadowMapShader = exports.ShadowDisplayShader = exports.ShaderLib = exports.Shader = exports.Scene = exports.ScanEffectShader = exports.ScanEffectPass = exports.ResourceLoader = exports.Renderer = exports.RainRipplesPass = exports.REGLHelper = exports.QuadShader = exports.PostProcessShader = exports.PointLineShader = exports.Plane = exports.PhongSpecularGlossinessMaterial = exports.PhongShader = exports.PhongMaterial = exports.MeshShader = exports.Mesh = exports.Material = exports.KHRTechniquesWebglManager = exports.Jitter = exports.InstancedMesh = exports.HeatmapShader = exports.HeatmapDisplayShader = exports.HDR = exports.Geometry = exports.GLTFManager = exports.GLTFHelper = exports.FxaaShader = exports.FogShader = exports.FogPass = exports.FBORayPicking = exports.ExtentPass = exports.EdgeShader = exports.EdgeGeometry = exports.CopyShader = exports.Constants = exports.BoxBlurShader = exports.BoundingBox = exports.BloomPass = exports.AbstractTexture = void 0;\n Object.defineProperty(exports, \"glMatrix\", {\n enumerable: true,\n get: function get() {\n return _glMatrix.glMatrix;\n } });\n\n Object.defineProperty(exports, \"mat2\", {\n enumerable: true,\n get: function get() {\n return _glMatrix.mat2;\n } });\n\n Object.defineProperty(exports, \"mat2d\", {\n enumerable: true,\n get: function get() {\n return _glMatrix.mat2d;\n } });\n\n Object.defineProperty(exports, \"mat3\", {\n enumerable: true,\n get: function get() {\n return _glMatrix.mat3;\n } });\n\n Object.defineProperty(exports, \"mat4\", {\n enumerable: true,\n get: function get() {\n return _glMatrix.mat4;\n } });\n\n exports.pbr = void 0;\n Object.defineProperty(exports, \"quat\", {\n enumerable: true,\n get: function get() {\n return _glMatrix.quat;\n } });\n\n Object.defineProperty(exports, \"quat2\", {\n enumerable: true,\n get: function get() {\n return _glMatrix.quat2;\n } });\n\n Object.defineProperty(exports, \"vec2\", {\n enumerable: true,\n get: function get() {\n return _glMatrix.vec2;\n } });\n\n Object.defineProperty(exports, \"vec3\", {\n enumerable: true,\n get: function get() {\n return _glMatrix.vec3;\n } });\n\n Object.defineProperty(exports, \"vec4\", {\n enumerable: true,\n get: function get() {\n return _glMatrix.vec4;\n } });\n\n var _glMatrix = require('pandav:/npm/gl-matrix/3.4.4');\n var _tbnPacker = require('pandav:/npm/@maptalks/tbn-packer/1.4.5');\n function _superPropGet(t, o, e, r) {var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e);return 2 & r && \"function\" == typeof p ? function (t) {return p.apply(e, t);} : p;}\n function _get() {return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {var p = _superPropBase(e, t);if (p) {var n = Object.getOwnPropertyDescriptor(p, t);return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value;}}, _get.apply(null, arguments);}\n function _superPropBase(t, o) {for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t)););return t;}\n function _toConsumableArray(r) {return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();}\n function _nonIterableSpread() {throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");}\n function _iterableToArray(r) {if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r);}\n function _arrayWithoutHoles(r) {if (Array.isArray(r)) return _arrayLikeToArray(r);}\n function _createForOfIteratorHelper(r, e) {var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];if (!t) {if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {t && (r = t);var _n63 = 0,F = function F() {};return { s: F, n: function n() {return _n63 >= r.length ? { done: !0 } : { done: !1, value: r[_n63++] };}, e: function e(r) {throw r;}, f: F };}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");}var o,a = !0,u = !1;return { s: function s() {t = t.call(r);}, n: function n() {var r = t.next();return a = r.done, r;}, e: function e(r) {u = !0, o = r;}, f: function f() {try {a || null == t.return || t.return();} finally {if (u) throw o;}} };}\n function _unsupportedIterableToArray(r, a) {if (r) {if (\"string\" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}\n function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}\n function _classCallCheck(a, n) {if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\");}\n function _defineProperties(e, r) {for (var t = 0; t < r.length; t++) {var o = r[t];o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);}}\n function _createClass(e, r, t) {return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e;}\n function _toPropertyKey(t) {var i = _toPrimitive(t, \"string\");return \"symbol\" == _typeof(i) ? i : i + \"\";}\n function _toPrimitive(t, r) {if (\"object\" != _typeof(t) || !t) return t;var e = t[Symbol.toPrimitive];if (void 0 !== e) {var i = e.call(t, r || \"default\");if (\"object\" != _typeof(i)) return i;throw new TypeError(\"@@toPrimitive must return a primitive value.\");}return (\"string\" === r ? String : Number)(t);}\n function _callSuper(t, o, e) {return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));}\n function _possibleConstructorReturn(t, e) {if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e;if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\");return _assertThisInitialized(t);}\n function _assertThisInitialized(e) {if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return e;}\n function _isNativeReflectConstruct() {try {var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));} catch (t) {}return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {return !!t;})();}\n function _getPrototypeOf(t) {return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {return t.__proto__ || Object.getPrototypeOf(t);}, _getPrototypeOf(t);}\n function _inherits(t, e) {if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\");t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e);}\n function _setPrototypeOf(t, e) {return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {return t.__proto__ = e, t;}, _setPrototypeOf(t, e);}\n var l = function l() {\n if (\"undefined\" != typeof globalThis) return globalThis;\n if (\"undefined\" != typeof self) return self;\n if (\"undefined\" != typeof window) return window;\n if (\"undefined\" != typeof global) return global;\n throw new Error(\"unable to locate global object\");\n };\n function f() {\n return l().maptalks_gltf_loader;\n }\n function d(e) {\n return !u(e) && (\"string\" == typeof e || null !== e.constructor && e.constructor === String);\n }\n function u(e) {\n return null == e;\n }\n function h(e) {\n return !u(e);\n }\n function m(e) {\n return !u(e) && (\"function\" == typeof e || null !== e.constructor && e.constructor === Function);\n }\n function v(e) {\n for (var _len = arguments.length, t = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n t[_key - 1] = arguments[_key];\n }\n return Object.assign.apply(Object, [e].concat(t)), e;\n }\n function _(e) {\n for (var _n2 = 0; _n2 < (arguments.length <= 1 ? 0 : arguments.length - 1); _n2++) {\n var _r2 = _n2 + 1 < 1 || arguments.length <= _n2 + 1 ? undefined : arguments[_n2 + 1];\n for (var _t2 in _r2) null != _r2[_t2] && (e[_t2] = _r2[_t2]);\n }\n return e;\n }\n function g(e) {\n return \"number\" == typeof e && !isNaN(e);\n }\n function x(e, t, n) {\n return e * (1 - n) + t * n;\n }\n function p(e) {\n return Array.isArray(e) || e instanceof Uint8Array || e instanceof Int8Array || e instanceof Uint16Array || e instanceof Int16Array || e instanceof Uint32Array || e instanceof Int32Array || e instanceof Uint8ClampedArray || e instanceof Float32Array || e instanceof Float64Array;\n }\n function b(e) {\n return (e = Math.abs(e)) < 128 ? Int8Array : e < 32768 ? Int16Array : Float32Array;\n }\n function y(e, t, n) {\n return Math.min(n, Math.max(t, e));\n }\n function A(e) {\n return e && e.hasExtension(\"oes_vertex_array_object\");\n }\n function S(e, t) {\n return Object.prototype.hasOwnProperty.call(e, t);\n }\n function T(e) {\n if (e.data) {\n if (e.data.BYTES_PER_ELEMENT) return e.data.length * e.data.BYTES_PER_ELEMENT;\n if (e.data.length) return 4 * e.data.length;\n } else {\n if (e.BYTES_PER_ELEMENT) return e.length * e.BYTES_PER_ELEMENT;\n if (e.length) return 4 * e.length;\n if (e.buffer && e.buffer.destroy) return e.buffer._buffer.byteLength;\n }\n return 0;\n }\n function M(e) {\n return e.width * e.height * C(e.format) * O(e.type) * (\"textureCube\" === e._reglType ? 6 : 1);\n }\n function O(e) {\n return \"uint8\" === e ? 1 : \"uint16\" === e || \"float16\" === e || \"half float\" === e ? 2 : \"uint32\" === e || \"float\" === e || \"float32\" === e ? 4 : 0;\n }\n function C(e) {\n return \"depth\" === e || \"alpha\" === e || \"luminance\" === e ? 1 : \"luminance alpha\" === e || \"depth stencil\" === e ? 2 : \"srgba\" === e || \"rgb5 a1\" === e || \"rgba\" === e.substring(0, 4) ? 4 : \"srgb\" === e || \"rgb\" === e.substring(0, 3) ? 3 : 1;\n }\n function E(e) {\n if (!e.componentType) return !1;\n var t = f().GLTFLoader.getTypedArrayCtor(e.componentType);\n return e.byteStride > 0 && e.byteStride !== e.itemSize * t.BYTES_PER_ELEMENT;\n }\n function P(e) {\n return e && (e.stride > 0 || E(e));\n }\n function w(e) {\n var t = 0;\n var n = e && e.length || 0;\n if (!n) return t;\n var r;\n for (var _i2 = 0; _i2 < n; _i2++) r = e.charCodeAt(_i2), t = (t << 5) - t + r, t |= 0;\n return t;\n }\n function I(e) {\n return !(e & e - 1) && 0 !== e;\n }\n function R(e) {\n return Math.pow(2, Math.floor(Math.log(e) / Math.LN2));\n }\n function D(e, t, n) {\n if (p(e)) return I(t) && I(n) ? e : function (e, t, n) {\n var r = t,\n i = n;\n I(t) || (r = R(t)), I(n) || (i = R(n));\n var o = new ImageData(new Uint8ClampedArray(e), t, n),\n a = document.createElement(\"canvas\");\n a.width = t, a.height = n, a.getContext(\"2d\").putImageData(o, 0, 0);\n var s = document.createElement(\"canvas\");\n s.width = r, s.height = i, s.getContext(\"2d\").drawImage(a, 0, 0, t, n, 0, 0, i, i), console.warn(\"Texture's size is not power of two, resize from (\".concat(t, \", \").concat(n, \") to (\").concat(r, \", \").concat(i, \")\"));\n var c = document.getElementById(\"_debug_resize_canvas\");\n return c || (c = document.createElement(\"canvas\"), c.id = \"_debug_resize_canvas\", document.body.appendChild(c)), c.width = r, c.height = i, c.getContext(\"2d\").drawImage(s, 0, 0), s;\n }(e, t, n);\n if (I(e.width) && I(e.height)) return e;\n n = e.height, I(t = e.width) || (t = R(t)), I(n) || (n = R(n));\n var r = document.createElement(\"canvas\");\n r.width = t, r.height = n, r.getContext(\"2d\").drawImage(e, 0, 0, t, n);\n var i = e.src,\n o = i.lastIndexOf(\"/\") + 1,\n a = i.substring(o);\n return console.warn(\"Texture(\".concat(a, \")'s size is not power of two, resize from (\").concat(e.width, \", \").concat(e.height, \") to (\").concat(t, \", \").concat(n, \")\")), r;\n }\n function H(e) {\n return e._gl instanceof WebGL2RenderingContext;\n }\n var F = exports.Util = Object.freeze({\n __proto__: null,\n clamp: y,\n defined: h,\n extend: v,\n extendWithoutNil: _,\n getBufferSize: T,\n getPosArrayType: b,\n getSupportedFormats: function getSupportedFormats(e) {\n return {\n etc: !!e.getExtension(\"WEBGL_compressed_texture_etc\"),\n etc1: !!e.getExtension(\"WEBGL_compressed_texture_etc1\"),\n s3tc: !!e.getExtension(\"WEBGL_compressed_texture_s3tc\"),\n pvrtc: !!e.getExtension(\"WEBGL_compressed_texture_pvrtc\"),\n astc: !!e.getExtension(\"WEBGL_compressed_texture_astc\"),\n bc7: !!e.getExtension(\"EXT_texture_compression_bptc\") };\n\n },\n getTexMemorySize: M,\n getTextureByteWidth: O,\n getTextureChannels: C,\n hasOwn: S,\n hashCode: w,\n interpolate: x,\n isArray: p,\n isFunction: m,\n isInStride: E,\n isInterleaved: P,\n isNil: u,\n isNumber: g,\n isPowerOfTwo: I,\n isString: d,\n isSupportVAO: A,\n isTextureDestroyed: function isTextureDestroyed(e) {\n return !e._texture || !e._texture.texture;\n },\n lerp: function lerp(e, t, n, r) {\n for (var _i3 = 0; _i3 < e.length; _i3++) e[_i3] = t[_i3] + r * (n[_i3] - t[_i3]);\n return e;\n },\n log2: function log2(e) {\n return Math.log2(e);\n },\n normalize: function normalize(e, t) {\n var n = 0;\n for (var _e2 = 0, _r3 = t.length; _e2 < _r3; _e2++) n += t[_e2];\n for (var _r4 = 0, _i4 = t.length; _r4 < _i4; _r4++) e[_r4] = t[_r4] / n;\n return e;\n },\n resizeToPowerOfTwo: D,\n set: function set(e, t) {\n for (var _n3 = 0; _n3 < e.length; _n3++) e[_n3] = t[_n3];\n return e;\n },\n supportNPOT: H });\n\n function N(e) {\n return function (_e3) {\n function _class() {\n _classCallCheck(this, _class);\n return _callSuper(this, _class, arguments);\n }\n _inherits(_class, _e3);\n return _createClass(_class, [{\n key: \"on\",\n value: function on(e, t) {\n return this._events || (this._events = {\n type: [t] }),\n this._events[e] = this._events[e] || [], this._events[e].push(t), this;\n } },\n {\n key: \"once\",\n value: function once(e, t) {\n return this.on(e, this._wrapOnce(e, t));\n } },\n {\n key: \"off\",\n value: function off(e, t) {\n return this._events && this._events[e] ? (this._events[e].splice(this._events[e].indexOf(t), 1), this) : this;\n } },\n {\n key: \"fire\",\n value: function fire(e) {\n var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n if (!this._events || !this._events[e]) return this;\n t.target || (t.target = this);\n var n = this._events[e].slice(0);\n var _iterator = _createForOfIteratorHelper(n),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var _e4 = _step.value;\n _e4(t);\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n return this;\n } },\n {\n key: \"_wrapOnce\",\n value: function _wrapOnce(e, t) {\n var n = this;\n var r = !1;\n return function i(o) {\n r || (r = !0, t(o), n.off(e, i));\n };\n } }]);\n\n }(e);\n }\n var L = \"__reshader_disposed\";\n var k = exports.Constants = Object.freeze({\n __proto__: null,\n KEY_DISPOSED: L,\n WEBGL_EXTENSIONS: [\"ANGLE_instanced_arrays\", \"OES_element_index_uint\", \"OES_standard_derivatives\"],\n WEBGL_OPTIONAL_EXTENSIONS: [\"OES_vertex_array_object\", \"OES_texture_half_float\", \"OES_texture_half_float_linear\", \"OES_texture_float\", \"OES_texture_float_linear\", \"WEBGL_depth_texture\", \"EXT_shader_texture_lod\", \"EXT_texture_filter_anisotropic\"] });\n\n var B = \"_reshader_refCount\";\n var z = _createClass(function z() {\n _classCallCheck(this, z);\n });\n var G = exports.AbstractTexture = function (_N) {\n function G(e, t) {\n var _this;\n _classCallCheck(this, G);\n if (_this = _callSuper(this, G), m(e)) {\n _this._texture = e, e = _this.config = {};\n for (var _t3 in _this._texture) S(_this._texture, _t3) && (m(_this._texture[_t3]) || (e[_t3] = _this._texture[_t3]));\n } else if (_this.config = e || {}, _this.resLoader = t, (e.url || e.promise) && !e.data) {\n _this._loading = !0;\n var _n4 = _assertThisInitialized(_this);\n var _r5;\n if (e.promise) _r5 = e.promise;else {\n var _n5;\n _n5 = e.arrayBuffer ? t.getArrayBuffer : t.get, _r5 = _n5.call(t, e.url);\n }\n e.data = t.getDefaultTexture(e.url), _this.promise = _r5, _r5.then(function (e) {\n return delete _this.promise, _n4._loading = !1, _n4.config ? (_n4.onLoad(e), Array.isArray(e) || (e = [e]), _n4.fire(\"complete\", {\n target: _assertThisInitialized(_this),\n resources: e }),\n e) : e;\n }).catch(function (e) {\n console.error(\"error when loading texture image.\", e), _n4.fire(\"error\", {\n target: _assertThisInitialized(_this),\n error: e });\n\n });\n }\n return _this;\n }\n _inherits(G, _N);\n return _createClass(G, [{\n key: \"onLoad\",\n value: function onLoad(e) {} },\n {\n key: \"isReady\",\n value: function isReady() {\n return !this._loading;\n } },\n {\n key: \"set\",\n value: function set(e, t) {\n return this.config[e] = t, this.dirty = !0, this;\n } },\n {\n key: \"get\",\n value: function get(e) {\n return this.config[e];\n } },\n {\n key: \"createREGLTexture\",\n value: function createREGLTexture(e) {\n return null;\n } },\n {\n key: \"getREGLTexture\",\n value: function getREGLTexture(e) {\n return this._texture || (this._texture = this.createREGLTexture(e), this.config.persistent || (this.config.data && (this.config.data instanceof ImageBitmap || (this.config.data = [])), this.config.image && (this.config.image.array = []), this.config.mipmap && delete this.config.mipmap)), this.dirty && this._updateREGL(), this._texture;\n } },\n {\n key: \"getMemorySize\",\n value: function getMemorySize() {\n if (!this.config) return 0;\n var _this$config = this.config,\n e = _this$config.width,\n t = _this$config.height,\n n = _this$config.type,\n r = _this$config.format;\n return e * t * O(n || \"uint8\") * C(r || \"rgba\");\n } },\n {\n key: \"_updateREGL\",\n value: function _updateREGL() {\n this._texture && !this._texture[L] && this._texture(this.config), this.dirty = !1;\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n this.config && this.config.url && (URL.revokeObjectURL(this.config.url), this.resLoader.disposeRes(this.config.url)), this.config && this.config.data instanceof ImageBitmap && (this.config.data.close(), this.config.data = []), this._texture && !this._texture[L] && (this._texture[B] && this._texture[B]--, this._texture[B] || (this._texture.destroy(), this._texture[L] = !0, delete this._texture)), delete this.resLoader, delete this._regl;\n var e = this.config && this.config.url;\n delete this.config, e && this.fire(\"disposed\", {\n target: this,\n url: e });\n\n } },\n {\n key: \"_needPowerOf2\",\n value: function _needPowerOf2(e) {\n if (H(e)) return !1;\n var t = this.config;\n return t.wrap && \"clamp\" !== t.wrap || t.wrapS && \"clamp\" !== t.wrapS || t.wrapT && \"clamp\" !== t.wrapT || t.min && \"nearest\" !== t.min && \"linear\" !== t.min;\n } }]);\n\n }(N(z));\n var V = _glMatrix.mat4.identity([]),\n U = _glMatrix.mat4.identity([]);\n var j = exports.BoundingBox = function () {\n function j(e, t) {\n _classCallCheck(this, j);\n this.min = e || [1 / 0, 1 / 0, 1 / 0], this.max = t || [-1 / 0, -1 / 0, -1 / 0], this.updateVertex();\n }\n return _createClass(j, [{\n key: \"combine\",\n value: function combine(e) {\n if (!e) return this;\n var t, n;\n return Array.isArray(e) ? (t = e[0], n = e[1]) : (t = e.min, n = e.max), t[0] < this.min[0] && (this.min[0] = t[0], this._dirty = !0), t[1] < this.min[1] && (this.min[1] = t[1], this._dirty = !0), t[2] < this.min[2] && (this.min[2] = t[2], this._dirty = !0), n[0] > this.max[0] && (this.max[0] = n[0], this._dirty = !0), n[1] > this.max[1] && (this.max[1] = n[1], this._dirty = !0), n[2] > this.max[2] && (this.max[2] = n[2], this._dirty = !0), this;\n } },\n {\n key: \"dirty\",\n value: function dirty() {\n return this._dirty = !0, this;\n } },\n {\n key: \"getCenter\",\n value: function getCenter() {\n return this.center || (this.center = [0, 0, 0], this._dirty = !0), this._dirty && (_glMatrix.vec3.add(this.center, this.min, this.max), _glMatrix.vec3.scale(this.center, this.center, .5)), this._dirty = !1, this.center;\n } },\n {\n key: \"containPoint\",\n value: function containPoint(e) {\n var t = this.min,\n n = this.max;\n return t[0] <= e[0] && t[1] <= e[1] && t[2] <= e[2] && n[0] >= e[0] && n[1] >= e[1] && n[2] >= e[2];\n } },\n {\n key: \"isFinite\",\n value: function (_isFinite) {\n function isFinite() {\n return _isFinite.apply(this, arguments);\n }\n isFinite.toString = function () {\n return _isFinite.toString();\n };\n return isFinite;\n }(function () {\n var e = this.min,\n t = this.max;\n return isFinite(e[0]) && isFinite(e[1]) && isFinite(e[2]) && isFinite(t[0]) && isFinite(t[1]) && isFinite(t[2]);\n }) },\n {\n key: \"updateVertex\",\n value: function updateVertex() {\n if (!this.vertex) {\n this.vertex = [];\n for (var _e5 = 0; _e5 < 8; _e5++) this.vertex.push([0, 0, 0]);\n }\n return this.vertex[0][0] = this.min[0], this.vertex[0][1] = this.min[1], this.vertex[0][2] = this.min[2], this.vertex[1][0] = this.min[0], this.vertex[1][1] = this.min[1], this.vertex[1][2] = this.max[2], this.vertex[2][0] = this.min[0], this.vertex[2][1] = this.max[1], this.vertex[2][2] = this.max[2], this.vertex[3][0] = this.min[0], this.vertex[3][1] = this.max[1], this.vertex[3][2] = this.min[2], this.vertex[4][0] = this.max[0], this.vertex[4][1] = this.min[1], this.vertex[4][2] = this.min[2], this.vertex[5][0] = this.max[0], this.vertex[5][1] = this.min[1], this.vertex[5][2] = this.max[2], this.vertex[6][0] = this.max[0], this.vertex[6][1] = this.max[1], this.vertex[6][2] = this.max[2], this.vertex[7][0] = this.max[0], this.vertex[7][1] = this.max[1], this.vertex[7][2] = this.min[2], this.vertex;\n } },\n {\n key: \"copy\",\n value: function copy(e) {\n return e ? j.copy(e, this) : new j(this.min.slice(), this.max.slice());\n } },\n {\n key: \"equals\",\n value: function equals(e) {\n if (!_glMatrix.vec3.equals(this.min, e.min) || !_glMatrix.vec3.equals(this.max, e.max)) return !1;\n var n = e.vertex;\n for (var _e6 = 0; _e6 < this.vertex.length; _e6++) if (!_glMatrix.vec3.equals(n[_e6], this.vertex[_e6])) return !1;\n return !0;\n } },\n {\n key: \"transform\",\n value: function transform(n, r) {\n if (n = n || U, (r = r || U)[1] || r[2] || r[4] || r[6] || r[8] || r[9]) {\n var _i5 = this.vertex,\n _o = _glMatrix.mat4.multiply(V, r, n);\n for (var _e7 = 0; _e7 < _i5.length; _e7++) _glMatrix.vec3.transformMat4(this.vertex[_e7], this.vertex[_e7], _o);\n var _a = this.vertex.map(function (e) {\n return e[0];\n }),\n _s = this.vertex.map(function (e) {\n return e[1];\n }),\n _c = this.vertex.map(function (e) {\n return e[2];\n }),\n _l = Math.min.apply(Math, _toConsumableArray(_a)),\n _f = Math.max.apply(Math, _toConsumableArray(_a)),\n _d = Math.min.apply(Math, _toConsumableArray(_s)),\n _u = Math.max.apply(Math, _toConsumableArray(_s)),\n _h = Math.min.apply(Math, _toConsumableArray(_c)),\n _m = Math.max.apply(Math, _toConsumableArray(_c));\n _glMatrix.vec3.set(this.min, _l, _d, _h), _glMatrix.vec3.set(this.max, _f, _u, _m);\n } else {\n var _i6 = _glMatrix.mat4.multiply(V, r, n);\n _glMatrix.vec3.transformMat4(this.min, this.min, _i6), _glMatrix.vec3.transformMat4(this.max, this.max, _i6);\n }\n return this;\n } }],\n [{\n key: \"copy\",\n value: function copy(e, n) {\n _glMatrix.vec3.copy(e.min, n.min), _glMatrix.vec3.copy(e.max, n.max);\n for (var _r6 = 0; _r6 < n.vertex.length; _r6++) _glMatrix.vec3.copy(e.vertex[_r6], n.vertex[_r6]);\n return e;\n } }]);\n\n }();\n var X = [],\n W = {\n 5120: \"int8\",\n 5122: \"int16\",\n 5124: \"int32\",\n 5121: \"uint8\",\n 5123: \"uint16\",\n 5125: \"uint32\",\n 5126: \"float\" },\n\n q = {\n 5120: 1,\n 5122: 2,\n 5124: 4,\n 5121: 1,\n 5123: 2,\n 5125: 4,\n 5126: 4 },\n\n K = {\n positionSize: 3,\n primitive: \"triangles\",\n positionAttribute: \"aPosition\",\n normalAttribute: \"aNormal\",\n uv0Attribute: \"aTexCoord\",\n uv1Attribute: \"aTexCoord1\",\n color0Attribute: \"aColor0\",\n tangentAttribute: \"aTangent\",\n pickingIdAttribute: \"aPickingId\",\n textureCoordMatrixAttribute: \"aTextureCoordMatrix\" };\n\n var J = 1;\n var Y = \"_reshader_refCount\";\n var Z = exports.Geometry = function () {\n function Z(e, t, n, r) {\n _classCallCheck(this, Z);\n this._version = 0, this.data = e, this.elements = t, this.desc = v({}, K, r);\n var i = this._getPosAttritute();\n this.data[this.desc.positionAttribute] = i, n || (this.elements ? n = $(this.elements) : i && i.length ? n = i.length / this.desc.positionSize : i && i.interleavedArray ? n = i.interleavedArray.length / this.desc.positionSize : i && i.array && (n = i.array.length / this.desc.positionSize)), this.count = n, this.elements || (this.elements = n), this.properties = {}, this._buffers = {}, this._vao = {}, this.getVertexCount(), this._prepareData(!0), this.updateBoundingBox();\n }\n return _createClass(Z, [{\n key: \"version\",\n get: function get() {\n return this._version;\n },\n set: function set(e) {\n throw new Error(\"Geometry.version is read only.\");\n } },\n {\n key: \"_getPosAttritute\",\n value: function _getPosAttritute() {\n return this.data[this.desc.positionAttribute];\n } },\n {\n key: \"_prepareData\",\n value: function _prepareData(e) {\n if (!this.data) return;\n var t = this._buffers || {};\n for (var _n6 in this.data) {\n var _r7 = this.data[_n6];\n if (_r7) if (_r7.buffer && _r7.buffer.destroy) {\n var _t4 = _r7.buffer;\n _t4[Y] || (_t4[Y] = 0), e && _t4[Y]++;\n } else if (_r7 && _r7.array) if (E(_r7)) {\n var _e8 = _r7.array.buffer.__id;\n _e8 || (_e8 = _r7.array.buffer.__id = J++), this.data[_n6] = {\n buffer: _e8,\n offset: _r7.byteOffset,\n stride: _r7.byteStride,\n type: W[_r7.componentType],\n size: _r7.itemSize,\n count: _r7.count,\n componentType: _r7.componentType },\n t[_e8] || (t[_e8] = {\n data: _r7.array.buffer });\n\n } else this.data[_n6] = _r7.array;\n }\n this._buffers = t;\n var n = this.elements;\n n && n.array && (this.elements = n.array);\n } },\n {\n key: \"getAttrData\",\n value: function getAttrData(e) {\n var t = e.key,\n n = !this._reglData || !this._reglData[t];\n if (this._reglData || (this._reglData = {}), n) {\n var _e9 = this._reglData[t] = {},\n _n7 = this.data,\n _this$desc = this.desc,\n _r8 = _this$desc.positionAttribute,\n _i7 = _this$desc.normalAttribute,\n _o2 = _this$desc.uv0Attribute,\n _a2 = _this$desc.uv1Attribute,\n _s2 = _this$desc.tangentAttribute,\n _c2 = _this$desc.color0Attribute,\n _l2 = _this$desc.pickingIdAttribute,\n _f2 = _this$desc.textureCoordMatrixAttribute;\n v(_e9, this.data), _e9.aPosition = _n7[_r8], _n7[_i7] && (_e9.aNormal = _n7[_i7]), _n7[_o2] && (_e9.aTexCoord = _n7[_o2]), _n7[_a2] && (_e9.aTexCoord1 = _n7[_a2]), _n7[_s2] && (_e9.aTangent = _n7[_s2]), _n7[_c2] && (_e9.aColor0 = _n7[_c2]), _n7[_l2] && (_e9.aPickingId = _n7[_l2]), _n7[_f2] && (_e9.aTextureCoordMatrix = _n7[_f2]);\n }\n return this._reglData[t];\n } },\n {\n key: \"getREGLData\",\n value: function getREGLData(e, t, n) {\n this.getAttrData(t);\n var r = !this._reglData || !this._reglData[t.key];\n if (A(e) && !n) {\n var _n8 = t && t.key || \"default\";\n if (!this._vao[_n8] || r || this._vao[_n8].dirty) {\n var _r9 = this._reglData[t.key],\n _i8 = this._vertexCount,\n _o3 = [];\n for (var _e10 = 0; _e10 < t.length; _e10++) {\n var _n9 = t[_e10].name,\n _a3 = _r9[_n9] && _r9[_n9].buffer;\n if (_a3 && _a3.destroy) _o3.push(void 0 !== _r9[_n9].stride ? _r9[_n9] : _a3);else {\n var _e11 = _r9[_n9];\n if (!_e11) {\n _o3.push(this.desc.fillEmptyDataInMissingAttribute ? new Uint8Array(4 * _i8) : X);\n continue;\n }\n var _t5 = (_e11.data && p(_e11.data) ? _e11.data.length : _e11.length) / _i8;\n _e11.data ? (_e11.dimension = _t5, _o3.push(_e11)) : _o3.push({\n data: _e11,\n dimension: _t5 });\n\n }\n }\n var _a4 = {\n attributes: _o3,\n primitive: this.getPrimitive() };\n\n if (this.elements && !g(this.elements)) if (this.elements.destroy) _a4.elements = this.elements;else {\n _a4.elements = {\n primitive: this.getPrimitive(),\n data: this.elements };\n\n var _e12 = this.getElementsType(this.elements);\n _e12 && (_a4.elements.type = _e12);\n }\n this._vao[_n8] ? this._vao[_n8].vao(_a4) : this._vao[_n8] = {\n vao: e.vao(_a4) };\n\n }\n return delete this._vao[_n8].dirty, this._vao[_n8];\n }\n return this._reglData[t.key];\n } },\n {\n key: \"_isAttrChanged\",\n value: function _isAttrChanged(e) {\n if (e === this._activeAttributes) return !1;\n if (e.length !== this._activeAttributes.length) return !0;\n for (var _t6 = 0; _t6 < e.length; _t6++) if (e[_t6] !== this._activeAttributes[_t6]) return !0;\n return !1;\n } },\n {\n key: \"generateBuffers\",\n value: function generateBuffers(e) {\n var t = this._buffers;\n for (var _n10 in t) t[_n10].buffer || (t[_n10].buffer = e.buffer(t[_n10].data)), delete t[_n10].data;\n var n = this.desc.positionAttribute,\n r = this.desc.altitudeAttribute,\n i = this.data,\n o = this._vertexCount,\n a = {};\n for (var _s3 in i) if (i[_s3]) {\n if (void 0 === i[_s3].buffer || i[_s3].buffer instanceof ArrayBuffer) {\n var _t7 = i[_s3].data ? i[_s3] : {\n data: i[_s3] };\n\n _t7.dimension = (i[_s3].data ? i[_s3].data : i[_s3]).length / o;\n var _c3 = e.buffer(_t7);\n _c3[Y] = 1, a[_s3] = {\n buffer: _c3 },\n _s3 !== n && _s3 !== r || (a[_s3].array = i[_s3]);\n } else i[_s3].buffer.destroy ? a[_s3] = i[_s3] : t[i[_s3].buffer] && (a[_s3] = v({}, i[_s3]), a[_s3].buffer = t[i[_s3].buffer].buffer);\n (this.desc.static || _s3 !== n) && delete i[_s3].array;\n }\n if (this.data = a, delete this._reglData, this.elements && !g(this.elements)) {\n var _t8 = {\n primitive: this.getPrimitive(),\n data: this.elements },\n\n _n11 = this.getElementsType(this.elements);\n if (_n11 && (_t8.type = _n11), !this.desc.static && !this.elements.destroy) {\n var _e13 = this.elements;\n this.indices = new Uint16Array(_e13.length);\n for (var _t9 = 0; _t9 < _e13.length; _t9++) this.indices[_t9] = _e13[_t9];\n }\n this.elements = this.elements.destroy ? this.elements : e.elements(_t8);\n var _r10 = this.elements;\n _r10[Y] || (_r10[Y] = 0), _r10[Y]++;\n }\n } },\n {\n key: \"getVertexCount\",\n value: function getVertexCount() {\n var _this$desc2 = this.desc,\n e = _this$desc2.positionAttribute,\n t = _this$desc2.positionSize,\n n = _this$desc2.color0Attribute;\n var r = this.data[e];\n r.data && (r = r.data), r.array && (r = r.array), p(r) ? this._vertexCount = Math.ceil(r.length / t) : r && void 0 !== r.count && (this._vertexCount = r.count);\n var i = n;\n if (this.data[i]) {\n var _e14 = this.data[i].data || this.data[i].array || this.data[i];\n Array.isArray(_e14) ? this._color0Size = _e14.length / this._vertexCount : _e14 && _e14.count ? this._color0Size = _e14.count / this._vertexCount : this.data[i].buffer && this.data[i].buffer.destroy && (this._color0Size = this.data[i].buffer._buffer.dimension);\n }\n return this._vertexCount;\n } },\n {\n key: \"getColor0Size\",\n value: function getColor0Size() {\n return this._color0Size || 0;\n } },\n {\n key: \"addBuffer\",\n value: function addBuffer(e, t) {\n return this._buffers[e] = {\n data: t },\n delete this._reglData, this._deleteVAO(), this;\n } },\n {\n key: \"updateBuffer\",\n value: function updateBuffer(e, t) {\n if (!this._buffers[e]) throw new Error(\"invalid buffer \".concat(e, \" in geometry\"));\n return this._buffers[e].buffer ? this._buffers[e].buffer.subdata(t) : this._buffers[e].data = t, delete this._reglData, this._deleteVAO(), this;\n } },\n {\n key: \"deleteData\",\n value: function deleteData(e) {\n var t = this.data[e];\n return t ? (this._incrVersion(), t.buffer && t.buffer.destroy && t.buffer.destroy(), delete this.data[e], delete this._reglData, this._markVAODirty(!1), this) : this;\n } },\n {\n key: \"updateData\",\n value: function updateData(e, t) {\n var n = this.data[e];\n if (!n) return this;\n var r;\n return this._incrVersion(), this.data[e] = t, n.buffer && n.buffer.destroy && (r = n), e === this.desc.positionAttribute && this.updateBoundingBox(), this.getVertexCount(), r && (r.buffer(t), this.data[e] = r), this._prepareData(!1), this.desc.positionAttribute === e && (this._posDirty = !0), delete this._reglData, this;\n } },\n {\n key: \"updateSubData\",\n value: function updateSubData(e, t, n) {\n var r = this.data[e];\n if (!r) return this;\n var i;\n if (this._incrVersion(), r.buffer && r.buffer.destroy && (i = r), e === this.desc.positionAttribute && this._updateSubBoundingBox(t), i) {\n var _e15 = q[i.buffer._buffer.dtype];\n if (t.BYTES_PER_ELEMENT !== _e15) {\n var _n12 = function (e, t) {\n if (e instanceof Uint8Array || e instanceof Uint16Array || e instanceof Uint32Array || e instanceof Uint8ClampedArray) return 1 === t ? Uint8Array : 2 === t ? Uint16Array : Uint32Array;\n if (e instanceof Int8Array || e instanceof Int16Array || e instanceof Int32Array) return 1 === t ? Int8Array : 2 === t ? Int16Array : Int32Array;\n if (e instanceof Float32Array || e instanceof Float64Array) return 4 === t ? Float32Array : Float64Array;\n return null;\n }(t, _e15);\n t = new _n12(t);\n }\n i.buffer.subdata(t, n * _e15);\n } else {\n var _r11 = this.data[e].data ? this.data[e].data : this.data[e];\n for (var _e16 = 0; _e16 < t.length; _e16++) _r11[n + _e16] = t[_e16];\n }\n return this._prepareData(!1), this.desc.positionAttribute === e && (this._posDirty = !0), delete this._reglData, this;\n } },\n {\n key: \"getPrimitive\",\n value: function getPrimitive() {\n return this.desc.primitive;\n } },\n {\n key: \"getElements\",\n value: function getElements() {\n return this.elements;\n } },\n {\n key: \"setElements\",\n value: function setElements(e, t) {\n if (!e) throw new Error(\"elements data is invalid\");\n this._incrVersion();\n var n = this.elements;\n return this.count = void 0 === t ? $(e) : t, this.elements = e && e.destroy ? e : n.destroy ? n(e) : e, this._markVAODirty(!0), this;\n } },\n {\n key: \"deleteElements\",\n value: function deleteElements() {\n return this.elements && 0 !== this.elements.length ? (this._incrVersion(), this.elements && this.elements.destroy && !this.elements[L] && (this.elements.destroy(), this.elements[L] = 1), this.elements = [], this._markVAODirty(!0), this) : this;\n } },\n {\n key: \"_markVAODirty\",\n value: function _markVAODirty(e) {\n if (this._vao) {\n for (var _t10 in this._vao) e ? this._vao[_t10].vao.destroy() : this._vao[_t10].dirty = !0;\n e && (this._vao = {});\n }\n } },\n {\n key: \"setDrawCount\",\n value: function setDrawCount(e) {\n return this._incrVersion(), this.count1 = e, this;\n } },\n {\n key: \"getDrawCount\",\n value: function getDrawCount() {\n return this.count1 >= 0 ? this.count1 : this.count;\n } },\n {\n key: \"setDrawOffset\",\n value: function setDrawOffset(e) {\n return this._incrVersion(), this.offset = e, this;\n } },\n {\n key: \"getDrawOffset\",\n value: function getDrawOffset() {\n return this.offset || 0;\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n if (this._deleteVAO(), this._forEachBuffer(function (e) {\n if (!e[L]) {\n var _t11 = e[Y];\n _t11 && _t11--, _t11 <= 0 ? (e[L] = !0, e.destroy()) : e[Y] = _t11;\n }\n }), this.properties) {\n var _e17 = this.properties.oldElementsBeforeHighlight;\n _e17 && !_e17[L] && _e17.destroy && (_e17.destroy(), _e17[L] = !0), delete this.properties.oldElementsBeforeHighlight, delete this.properties.hasInvisible;\n }\n this.data = {}, this._buffers = {}, delete this._reglData, this.count = 0, this.elements = [], delete this._tempPosArray, this._disposed = !0;\n } },\n {\n key: \"isDisposed\",\n value: function isDisposed() {\n return !!this._disposed;\n } },\n {\n key: \"updateBoundingBox\",\n value: function updateBoundingBox() {\n var e = this.boundingBox;\n e || (e = this.boundingBox = new j());\n var n,\n r,\n i = this.data[this.desc.positionAttribute];\n if (p(i) || (i.data ? i = i.data : P(i) ? i = this._getAttributeData(this.desc.positionAttribute) : i.array && (n = i.min, r = i.max, i = i.array)), i && i.length) {\n var _o4 = e.min,\n _a5 = e.max;\n if (n && r) _glMatrix.vec3.set.apply(t, [_o4].concat(_toConsumableArray(n))), _glMatrix.vec3.set.apply(t, [_a5].concat(_toConsumableArray(r)));else {\n _glMatrix.vec3.set(_o4, i[0], i[1], i[2]), _glMatrix.vec3.set(_a5, i[0], i[1], i[2]);\n for (var _e18 = 3; _e18 < i.length;) {\n var _t12 = i[_e18++],\n _n13 = i[_e18++],\n _r12 = i[_e18++];\n _t12 < _o4[0] && (_o4[0] = _t12), _n13 < _o4[1] && (_o4[1] = _n13), _r12 < _o4[2] && (_o4[2] = _r12), _t12 > _a5[0] && (_a5[0] = _t12), _n13 > _a5[1] && (_a5[1] = _n13), _r12 > _a5[2] && (_a5[2] = _r12);\n }\n }\n e.updateVertex(), e.dirty();\n }\n } },\n {\n key: \"_updateSubBoundingBox\",\n value: function _updateSubBoundingBox(e) {\n var t = this.boundingBox,\n n = t.min,\n r = t.max,\n i = this.desc.positionSize;\n for (var _t13 = 0; _t13 < e.length;) {\n var _o5 = e[_t13++],\n _a6 = e[_t13++];\n var _s4 = 0;\n 3 === i && (_s4 = e[_t13++]), _o5 < n[0] && (n[0] = _o5), _a6 < n[1] && (n[1] = _a6), _s4 < n[2] && (n[2] = _s4), _o5 > r[0] && (r[0] = _o5), _a6 > r[1] && (r[1] = _a6), _s4 > r[2] && (r[2] = _s4);\n }\n t.updateVertex(), t.dirty();\n } },\n {\n key: \"_getAttributeData\",\n value: function _getAttributeData(e) {\n var t = f(),\n n = this.data[e] && this.data[e].array ? this.data[e].array : this.data[e],\n r = n.buffer;\n if (P(n)) {\n var _i9 = this._buffers[r] ? this._buffers[r].data : n.array,\n _o6 = n.count,\n _a7 = n.size,\n _s5 = n.stride,\n _c4 = n.offset,\n _l3 = n.componentType,\n _f3 = t.GLTFLoader.getTypedArrayCtor(_l3);\n if ((0 === _s5 || _s5 === _a7 * _f3.BYTES_PER_ELEMENT) && _c4 % _f3.BYTES_PER_ELEMENT == 0) return new _f3(_i9, _c4, _o6 * _a7);\n if (e === this.desc.positionAttribute) return !this._tempPosArray || this._tempPosArray && this._tempPosArray.length < _a7 * _o6 ? (this._tempPosArray = new _f3(_a7 * _o6), t.GLTFLoader.readInterleavedArray(this._tempPosArray, _i9, _o6, _a7, _s5, _c4, _l3)) : this._posDirty ? (this._posDirty = !1, t.GLTFLoader.readInterleavedArray(this._tempPosArray, _i9, _o6, _a7, _s5, _c4, _l3)) : this._tempPosArray;\n {\n var _e19 = new _f3(_a7 * _o6);\n return t.GLTFLoader.readInterleavedArray(_e19, _i9, _o6, _a7, _s5, _c4, _l3);\n }\n }\n return n;\n } },\n {\n key: \"createTangent\",\n value: function createTangent() {\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : \"aTangent\";\n this._incrVersion();\n var _this$desc3 = this.desc,\n r = _this$desc3.normalAttribute,\n i = _this$desc3.positionAttribute,\n o = _this$desc3.uv0Attribute,\n c = this._getAttributeData(r),\n l = this._getAttributeData(i),\n f = (0, _tbnPacker.buildTangents)(l, c, this.data[o], this.elements),\n d = this.data[e] = new Float32Array(f.length),\n u = [0, 0, 0, 0],\n h = [0, 0, 0],\n m = [0, 0, 0, 0];\n for (var _e20 = 0; _e20 < f.length; _e20 += 4) {\n var _r13 = _e20 / 4 * 3;\n _glMatrix.vec3.set(h, c[_r13], c[_r13 + 1], c[_r13 + 2]), _glMatrix.vec4.set(u, f[_e20], f[_e20 + 1], f[_e20 + 2], f[_e20 + 3]), (0, _tbnPacker.packTangentFrame)(m, h, u), _glMatrix.vec4.copy(d.subarray(_e20, _e20 + 4), m);\n }\n delete this._reglData;\n } },\n {\n key: \"createNormal\",\n value: function createNormal() {\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : \"aNormal\";\n this._incrVersion();\n var t = this._getAttributeData(this.desc.positionAttribute);\n this.data[e] = (0, _tbnPacker.buildNormals)(t.array || t, this.elements), delete this._reglData;\n } },\n {\n key: \"createBarycentric\",\n value: function createBarycentric() {\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : \"aBarycentric\";\n if (\"triangles\" !== this.desc.primitive) throw new Error(\"Primitive must be triangles to create bary centric data\");\n this._incrVersion();\n var t = new Uint8Array(3 * this._vertexCount);\n for (var _e21 = 0, _n14 = this.elements.length; _e21 < _n14;) for (var _n15 = 0; _n15 < 3; _n15++) {\n t[3 * this.elements[_e21++] + _n15] = 1;\n }\n this.data[e] = t, delete this._reglData;\n } },\n {\n key: \"buildUniqueVertex\",\n value: function buildUniqueVertex() {\n this._incrVersion();\n var e = this.data,\n t = this.elements;\n if (!p(t)) throw new Error(\"elements must be array to build unique vertex.\");\n var n = Object.keys(e),\n r = {};\n var i = e[this.desc.positionAttribute];\n if (i = i.length ? i : i.array, !p(i)) throw new Error(this.desc.positionAttribute + \" must be array to build unique vertex.\");\n var o = this._vertexCount,\n a = t.length;\n for (var _t14 = 0; _t14 < n.length; _t14++) {\n var _i10 = n[_t14],\n _s6 = p(e[_i10]) ? e[_i10] : e[_i10].array,\n _c5 = _s6.length / o;\n if (!p(_s6)) throw new Error(_i10 + \" must be array to build unique vertex.\");\n r[_i10] = _s6, e[_i10] = new _s6.constructor(a * _c5);\n }\n var s = 0;\n for (var _i11 = 0; _i11 < a; _i11++) {\n var _a8 = t[_i11];\n for (var _t15 = 0; _t15 < n.length; _t15++) {\n var _i12 = n[_t15],\n _c6 = e[_i12],\n _l4 = r[_i12].length / o;\n for (var _e22 = 0; _e22 < _l4; _e22++) _c6[s * _l4 + _e22] = r[_i12][_a8 * _l4 + _e22];\n }\n t[_i11] = s++;\n }\n i = this.data[this.desc.positionAttribute], this._vertexCount = Math.ceil(i.length / this.desc.positionSize), delete this._reglData;\n } },\n {\n key: \"getMemorySize\",\n value: function getMemorySize() {\n var e = 0;\n for (var _t16 in this.data) S(this.data, _t16) && (e += T(this.data[_t16]));\n if (this.elements) {\n var _t17 = this.elements;\n _t17.destroy ? e += _t17._elements.buffer.byteLength : _t17.BYTES_PER_ELEMENT ? e += _t17.length * _t17.BYTES_PER_ELEMENT : _t17.length && (e += 4 * _t17.length);\n }\n return e;\n } },\n {\n key: \"_deleteVAO\",\n value: function _deleteVAO() {\n for (var _e23 in this._vao) this._vao[_e23].vao.destroy();\n this._vao = {};\n } },\n {\n key: \"_forEachBuffer\",\n value: function _forEachBuffer(e) {\n this.elements && this.elements.destroy && e(this.elements);\n for (var _t18 in this.data) S(this.data, _t18) && this.data[_t18] && this.data[_t18].buffer && this.data[_t18].buffer.destroy && e(this.data[_t18].buffer);\n for (var _t19 in this._buffers) S(this._buffers, _t19) && this._buffers[_t19] && this._buffers[_t19].buffer && this._buffers[_t19].buffer.destroy && e(this._buffers[_t19].buffer);\n } },\n {\n key: \"getElementsType\",\n value: function getElementsType(e) {\n return e instanceof Uint8Array ? \"uint8\" : e instanceof Uint16Array ? \"uint16\" : e instanceof Uint32Array ? \"uint32\" : void 0;\n } },\n {\n key: \"_incrVersion\",\n value: function _incrVersion() {\n this._version++;\n } }]);\n\n }();\n function $(e) {\n if (g(e)) return e;\n if (void 0 !== e.count) return e.count;\n if (e.destroy) return e._elements.vertCount;\n if (void 0 !== e.length) return e.length;\n if (e.data) return e.data.length;\n throw new Error(\"invalid elements length\");\n }\n var Q = [\"points\", \"lines\", \"line strip\", \"line loop\", \"triangles\", \"triangle strip\", \"triangle fan\"];\n function ee(e) {\n return Q[e];\n }\n var te = {\n 5121: \"uint8\",\n 5123: \"uint16\",\n 5125: \"uint32\",\n 5126: \"float\",\n 36193: \"half float\" };\n\n function ne(e) {\n return te[e];\n }\n var re = {\n 6406: \"alpha\",\n 6407: \"rgb\",\n 6408: \"rgba\",\n 6409: \"luminance\",\n 6410: \"luminance alpha\",\n 33776: \"rgb s3tc dxt1\",\n 33777: \"rgba s3tc dxt1\",\n 33778: \"rgba s3tc dxt3\",\n 33779: \"rgba s3tc dxt5\",\n 35840: \"rgb pvrtc 4bppv1\",\n 35841: \"rgb pvrtc 2bppv1\",\n 35842: \"rgba pvrtc 4bppv1\",\n 35843: \"rgba pvrtc 2bppv1\",\n 35986: \"rgb atc\",\n 35987: \"rgba atc explicit alpha\",\n 34798: \"rgba atc interpolated alpha\",\n 36196: \"rgb etc1\" };\n\n function ie(e) {\n return re[e];\n }\n var oe = {\n 9729: \"linear\",\n 9728: \"nearest\" };\n\n function ae(e) {\n return oe[e];\n }\n var se = {\n 9729: \"linear\",\n 9728: \"nearest\",\n 9984: \"nearest mipmap nearest\",\n 9985: \"linear mipmap nearest\",\n 9986: \"nearest mipmap linear\",\n 9987: \"linear mipmap linear\" };\n\n function ce(e) {\n return se[e];\n }\n var le = {\n 10497: \"repeat\",\n 33071: \"clamp\",\n 33648: \"mirror\" };\n\n function fe(e) {\n return le[e];\n }\n var de = \"__reshader_webgl_buffer\",\n ue = \"__reshader_webgl_tex\";\n function he(e, t, n) {\n var r;\n if (p(t) ? t.buffer && void 0 !== t.byteOffset && (r = t) : t.array && t.array.buffer && void 0 !== t.array.byteOffset && (r = t.array), !r) return null;\n var i = r.buffer,\n o = r.byteOffset;\n i[de] || (i[de] = {});\n var a = i[de][o];\n if (!a) {\n var _t20 = {};\n n && v(_t20, n), _t20.data = r, a = e.buffer(_t20), i[de][o] = a;\n }\n return a;\n }\n function me(e, t) {\n var n = t.data;\n if (!n || !n.buffer) return e.texture(t);\n var r = n.buffer,\n i = n.byteOffset;\n r[ue] || (r[ue] = {});\n var o = r[ue][i];\n return o || (o = e.texture(t), r[ue][i] = o), o;\n }\n var ve = exports.REGLHelper = Object.freeze({\n __proto__: null,\n getMaterialFormat: ie,\n getMaterialType: ne,\n getPrimitive: ee,\n getTextureMagFilter: ae,\n getTextureMinFilter: ce,\n getTextureWrap: fe,\n getUniqueREGLBuffer: he,\n getUniqueTexture: me });\n\n var _e = [0, 0, 0],\n ge = [0, 0, 0],\n xe = [0, 0, 0],\n pe = [],\n be = [],\n ye = [],\n Ae = [\"a\", \"b\", \"c\"];\n var Se = exports.EdgeGeometry = function (_Z) {\n function Se(e, t, n, r) {\n _classCallCheck(this, Se);\n return _callSuper(this, Se, [e, t, n, {\n primitive: ee(1),\n positionAttribute: r.positionAttribute }]);\n\n }\n _inherits(Se, _Z);\n return _createClass(Se, [{\n key: \"_getPosAttritute\",\n value: function _getPosAttritute() {\n var e = this.data[this.desc.positionAttribute];\n if (!e.length) return [];\n var t = Math.pow(10, 4),\n n = Math.cos(Math.PI / 180 * .8),\n r = this.elements,\n i = e.length ? e : e.array,\n o = r.length ? r ? r.length : i.length / 3 : r,\n a = [0, 0, 0],\n s = new Array(3),\n c = {},\n l = [],\n f = new Te();\n for (var _e24 = 0; _e24 < o; _e24 += 3) {\n r.length ? (a[0] = r[_e24], a[1] = r[_e24 + 1], a[2] = r[_e24 + 2]) : (a[0] = _e24, a[1] = _e24 + 1, a[2] = _e24 + 2), f.a = Me(pe, i, a[0]), f.b = Me(be, i, a[1]), f.c = Me(ye, i, a[2]);\n var _o7 = f.getNormal(),\n _d2 = f.a,\n _u2 = f.b,\n _h2 = f.c;\n if (s[0] = \"\".concat(Math.round(_d2[0] * t), \",\").concat(Math.round(_d2[1] * t), \",\").concat(Math.round(_d2[2] * t)), s[1] = \"\".concat(Math.round(_u2[0] * t), \",\").concat(Math.round(_u2[1] * t), \",\").concat(Math.round(_u2[2] * t)), s[2] = \"\".concat(Math.round(_h2[0] * t), \",\").concat(Math.round(_h2[1] * t), \",\").concat(Math.round(_h2[2] * t)), s[0] !== s[1] && s[1] !== s[2] && s[2] !== s[0]) for (var _e25 = 0; _e25 < 3; _e25++) this._calEdgeData(_e25, a, f, c, s, n, _o7, l);\n }\n for (var _e26 in c) if (c[_e26]) {\n var _c$_e = c[_e26],\n _t21 = _c$_e.index0,\n _n16 = _c$_e.index1;\n l.push(i[3 * _t21], i[3 * _t21 + 1], i[3 * _t21 + 2]), l.push(i[3 * _n16], i[3 * _n16 + 1], i[3 * _n16 + 2]);\n }\n return this.elements = this._createElements(l), l;\n } },\n {\n key: \"_calEdgeData\",\n value: function _calEdgeData(e, n, r, i, o, a, s, c) {\n var l = (e + 1) % 3,\n f = o[e],\n d = o[l],\n u = r[Ae[e]],\n h = r[Ae[l]],\n m = \"\".concat(f, \"_\").concat(d),\n v = \"\".concat(d, \"_\").concat(f);\n if (v in i && i[v]) {\n _glMatrix.vec3.dot(s, i[v].normal) <= a && (c.push(u[0], u[1], u[2]), c.push(h[0], h[1], h[2])), i[v] = null;\n } else m in i || (i[m] = {\n index0: n[e],\n index1: n[l],\n normal: _glMatrix.vec3.copy([0, 0, 0], s) });\n\n } },\n {\n key: \"_createElements\",\n value: function _createElements(e) {\n var t = [],\n n = e.length / 3;\n for (var _e27 = 0; _e27 < n; _e27++) t.push(_e27);\n return t;\n } }]);\n\n }(Z);\n var Te = function () {\n function Te() {\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [0, 0, 0];\n var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];\n var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [0, 0, 0];\n _classCallCheck(this, Te);\n this.a = e, this.b = t, this.c = n;\n }\n return _createClass(Te, [{\n key: \"getNormal\",\n value: function getNormal() {\n var e = _glMatrix.vec3.sub(_e, this.a, this.b),\n n = _glMatrix.vec3.sub(ge, this.a, this.c);\n _glMatrix.vec3.cross(xe, e, n);\n var r = _glMatrix.vec3.length(xe);\n return _glMatrix.vec3.set(xe, xe[0] / r, xe[1] / r, xe[2] / r);\n } }]);\n\n }();\n function Me(e, n, r) {\n return _glMatrix.vec3.set(e, n[3 * r], n[3 * r + 1], n[3 * r + 2]);\n }\n var Oe = _createClass(function Oe() {\n _classCallCheck(this, Oe);\n });\n var Ce = exports.Material = function (_N2) {\n function Ce() {\n var _this2;\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var t = arguments.length > 1 ? arguments[1] : undefined;\n _classCallCheck(this, Ce);\n _this2 = _callSuper(this, Ce), _this2._version = 0, _this2._propVerion = 0, _this2.uniforms = _({}, t || {}, e);\n for (var _t22 in e) {\n var _n17 = Object.getOwnPropertyDescriptor(e, _t22).get;\n _n17 && Object.defineProperty(_this2.uniforms, _t22, {\n get: _n17 });\n\n }\n _this2.unlit = !1, _this2._reglUniforms = {}, _this2.refCount = 0, _this2._bindedOnTextureComplete = function () {\n var _this2$_onTextureComp;\n for (var _len2 = arguments.length, e = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n e[_key2] = arguments[_key2];\n }\n return (_this2$_onTextureComp = _this2._onTextureComplete).call.apply(_this2$_onTextureComp, [_this2].concat(e));\n }, _this2._genUniformKeys(), _this2._checkTextures();\n return _this2;\n }\n _inherits(Ce, _N2);\n return _createClass(Ce, [{\n key: \"version\",\n get: function get() {\n return this._version;\n },\n set: function set(e) {\n throw new Error(\"Material.version is read only.\");\n } },\n {\n key: \"propVersion\",\n get: function get() {\n return this._propVerion;\n } },\n {\n key: \"doubleSided\",\n get: function get() {\n return !!this.uniforms.doubleSided;\n },\n set: function set(e) {\n this.uniforms.doubleSided = e;\n } },\n {\n key: \"isReady\",\n value: function isReady() {\n return this._loadingCount <= 0;\n } },\n {\n key: \"set\",\n value: function set(e, t) {\n var n = u(this.uniforms[e]) && !u(t) || !u(this.uniforms[e]) && u(t);\n if (this.uniforms[e] && this.isTexture(e) && this.uniforms[e].dispose(), u(t)) u(this.uniforms[e]) || delete this.uniforms[e];else if (this.uniforms[e] = t, this._reglUniforms) {\n var _n18 = Object.getOwnPropertyDescriptor(this._reglUniforms, e);\n _n18 && !_n18.get && (this._propVerion++, this._reglUniforms[e] = t);\n }\n return this.isTexture(e) && this._checkTextures(), n && (this._genUniformKeys(), this._incrVersion()), this;\n } },\n {\n key: \"setFunctionUniform\",\n value: function setFunctionUniform(e, t) {\n return this._genUniformKeys(), this._incrVersion(), Object.defineProperty(this.uniforms, e, {\n enumerable: !0,\n get: t }),\n this;\n } },\n {\n key: \"hasFunctionUniform\",\n value: function hasFunctionUniform(e) {\n return !!this.uniforms && Object.prototype.hasOwnProperty.call(this.uniforms, e);\n } },\n {\n key: \"get\",\n value: function get(e) {\n return this.uniforms[e];\n } },\n {\n key: \"isDirty\",\n value: function isDirty() {\n return this._uniformVer !== this.version;\n } },\n {\n key: \"appendDefines\",\n value: function appendDefines(e, t) {\n var n = this.uniforms;\n return n ? (n.jointTexture && (e.HAS_SKIN = 1), n.morphWeights1 && (e.HAS_MORPH = 1), (n.khr_offset || n.khr_rotation || n.khr_scale) && (e.HAS_KHR_TEXTURE_TRANSFORM = 1), e) : e;\n } },\n {\n key: \"hasSkinAnimation\",\n value: function hasSkinAnimation() {\n return !!(this.uniforms && this.uniforms.jointTexture && this.uniforms.skinAnimation);\n } },\n {\n key: \"getUniforms\",\n value: function getUniforms(e) {\n var _this3 = this;\n if (this._reglUniforms && !this.isDirty()) return this._reglUniforms;\n var t = this.uniforms,\n n = {};\n var _loop = function _loop(_r14) {\n if (_this3.isTexture(_r14)) Object.defineProperty(n, _r14, {\n enumerable: !0,\n configurable: !0,\n get: function get() {\n return t[_r14].getREGLTexture(e);\n } });else\n {\n Object.getOwnPropertyDescriptor(t, _r14).get ? Object.defineProperty(n, _r14, {\n enumerable: !0,\n configurable: !0,\n get: function get() {\n return t[_r14];\n } }) :\n n[_r14] = t[_r14];\n }\n };\n for (var _r14 in t) {\n _loop(_r14);\n }\n return this._reglUniforms = n, this._uniformVer = this.version, n;\n } },\n {\n key: \"isTexture\",\n value: function isTexture(e) {\n return this.uniforms[e] instanceof G;\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n for (var _e28 in this.uniforms) {\n var _t23 = this.uniforms[_e28];\n _t23 && (_t23.dispose ? _t23.dispose() : _t23.destroy && !_t23[L] && (_t23.destroy(), _t23[L] = !0));\n }\n delete this.uniforms, delete this._reglUniforms, delete this._bindedOnTextureComplete, this._disposed = !0;\n } },\n {\n key: \"isDisposed\",\n value: function isDisposed() {\n return !!this._disposed;\n } },\n {\n key: \"_checkTextures\",\n value: function _checkTextures() {\n this._loadingCount = 0;\n for (var _e29 in this.uniforms) if (this.isTexture(_e29)) {\n var _t24 = this.uniforms[_e29];\n _t24.isReady() || (this._loadingCount++, _t24.on(\"complete\", this._bindedOnTextureComplete));\n }\n } },\n {\n key: \"_onTextureComplete\",\n value: function _onTextureComplete() {\n this._loadingCount--, this._incrVersion(), this._loadingCount <= 0 && (this._disposed || this.fire(\"complete\"));\n } },\n {\n key: \"getUniformKeys\",\n value: function getUniformKeys() {\n return this._uniformKeys;\n } },\n {\n key: \"_genUniformKeys\",\n value: function _genUniformKeys() {\n var e = [];\n for (var _t25 in this.uniforms) S(this.uniforms, _t25) && !u(this.uniforms[_t25]) && e.push(_t25);\n this._uniformKeys = e.join();\n } },\n {\n key: \"_incrVersion\",\n value: function _incrVersion() {\n this._version++;\n } },\n {\n key: \"getMemorySize\",\n value: function getMemorySize() {\n var e = this.uniforms;\n var t = 0;\n for (var _n19 in e) this.isTexture(_n19) ? t += e[_n19].getMemorySize() : this.uniforms[_n19] && this.uniforms[_n19].destroy && (t += M(this.uniforms[_n19]));\n return t;\n } }]);\n\n }(N(Oe));\n var Ee = {\n time: 0,\n seeThrough: !0,\n thickness: .03,\n fill: [1, .5137254902, .98, 1],\n stroke: [.7019607843, .9333333333, .2274509804, 1],\n dashEnabled: !1,\n dashAnimate: !1,\n dashRepeats: 1,\n dashLength: .8,\n dashOverlap: !0,\n insideAltColor: !1,\n squeeze: !1,\n squeezeMin: .5,\n squeezeMax: 1,\n dualStroke: !1,\n secondThickness: .05,\n opacity: 1,\n noiseEnable: !1 };\n\n var Pe = exports.WireFrameMaterial = function (_Ce) {\n function Pe(e) {\n _classCallCheck(this, Pe);\n return _callSuper(this, Pe, [e, Ee]);\n }\n _inherits(Pe, _Ce);\n return _createClass(Pe);\n }(Ce);\n var we = {\n baseColorFactor: [1, 1, 1, 1],\n materialShininess: 32,\n environmentExposure: 1,\n specularStrength: 32,\n opacity: 1,\n extrusionOpacity: 0,\n extrusionOpacityRange: [0, 1.8],\n baseColorTexture: null,\n normalTexture: null,\n emissiveTexture: null,\n occlusionTexture: null,\n uvScale: [1, 1],\n uvOffset: [0, 0],\n alphaTest: 0 };\n\n var Ie = exports.PhongMaterial = function (_Ce2) {\n function Ie(e) {\n _classCallCheck(this, Ie);\n return _callSuper(this, Ie, [e, we]);\n }\n _inherits(Ie, _Ce2);\n return _createClass(Ie, [{\n key: \"appendDefines\",\n value: function appendDefines(e, t) {\n _superPropGet(Ie, \"appendDefines\", this, 3)([e, t]);\n var n = this.uniforms;\n n.extrusionOpacity && (e.HAS_EXTRUSION_OPACITY = 1), t.data[t.desc.colorAttribute] && (e.HAS_COLOR = 1);\n return t.data[t.desc.color0Attribute] && (e.HAS_COLOR0 = 1, e.COLOR0_SIZE = t.getColor0Size()), t.data.aVertexColorType && (e.HAS_VERTEX_COLOR = 1), t.data[t.desc.tangentAttribute] ? e.HAS_TANGENT = 1 : t.data[t.desc.normalAttribute] && (e.HAS_NORMAL = 1), t.data[t.desc.uv0Attribute] ? (n.baseColorTexture && (e.HAS_BASECOLOR_MAP = 1), n.occlusionTexture && t.data[t.desc.uv1Attribute] && (e.HAS_AO_MAP = 1), n.emissiveTexture && (e.HAS_EMISSIVE_MAP = 1), n.normalTexture && (e.HAS_NORMAL_MAP = 1), (e.HAS_BASECOLOR_MAP || e.HAS_AO_MAP || e.HAS_EMISSIVE_MAP || e.HAS_NORMAL_MAP) && (e.HAS_MAP = 1), e) : e;\n } }],\n [{\n key: \"convertFrom\",\n value: function convertFrom(e) {\n var t = {};\n for (var _n20 in we) t[_n20] = e.get(_n20);\n return new Ie(t);\n } }]);\n\n }(Ce);\n var Re = {\n baseColorFactor: [1, 1, 1, 1],\n uvScale: [1, 1],\n uvOffset: [0, 0],\n opacity: 1,\n envMapExposure: 128,\n emissiveFactor: [.1, .1, .1],\n specularFactor: [0, 0, 0],\n envRotationSin: 0,\n envRotationCos: 1,\n reflectivity: .01,\n themingColor: [0, 0, 0, 0],\n exposureBias: .6 };\n\n var De = exports.StandardLiteMaterial = function (_Ce3) {\n function De(e) {\n _classCallCheck(this, De);\n return _callSuper(this, De, [e, Re]);\n }\n _inherits(De, _Ce3);\n return _createClass(De, [{\n key: \"appendDefines\",\n value: function appendDefines(e, t) {\n _superPropGet(De, \"appendDefines\", this, 3)([e, t]);\n var n = this.uniforms;\n n.extrusionOpacity && (e.HAS_EXTRUSION_OPACITY = 1), t.data[t.desc.colorAttribute] && (e.HAS_COLOR = 1);\n return t.data[t.desc.color0Attribute] && (e.HAS_COLOR0 = 1, e.COLOR0_SIZE = t.getColor0Size()), t.data[t.desc.uv0Attribute] ? (n.baseColorTexture && (e.HAS_BASECOLOR_MAP = 1), n.occlusionTexture && t.data[t.desc.uv1Attribute] && (e.HAS_AO_MAP = 1), n.emissiveTexture && (e.HAS_EMISSIVE_MAP = 1), n.normalTexture && (e.HAS_NORMAL_MAP = 1), (e.HAS_BASECOLOR_MAP || e.HAS_AO_MAP || e.HAS_EMISSIVE_MAP || e.HAS_NORMAL_MAP) && (e.HAS_MAP = 1), e.ALPHATEST = .01, e.GAMMA_INPUT = 1, e.GAMMA_FACTOR = 1, e.TONEMAP_OUTPUT = 1, e.ENVMAP_MODE_REFLECTION = 1, e.ENV_RGBM = 1, e.IRR_RGBM = 1, e) : e;\n } }]);\n\n }(Ce);\n var He = {\n diffuseFactor: [1, 1, 1, 1],\n specularFactor: [1, 1, 1],\n glossinessFactor: 1,\n diffuseTexture: null,\n specularGlossinessTexture: null,\n normalTexture: null,\n emissiveTexture: null,\n occlusionTexture: null };\n\n function Fe(e) {\n return function (_e30) {\n function _class2() {\n var _this4;\n _classCallCheck(this, _class2);\n for (var _len3 = arguments.length, e = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n e[_key3] = arguments[_key3];\n }\n var t = e[0];\n t = v({}, He, t || {}), _this4 = _callSuper(this, _class2, [t, e]);\n return _this4;\n }\n _inherits(_class2, _e30);\n return _createClass(_class2, [{\n key: \"appendDefines\",\n value: function appendDefines(e, t) {\n if (_superPropGet(_class2, \"appendDefines\", this, 3)([e, t]), e.SHADING_MODEL_SPECULAR_GLOSSINESS = 1, !t.data[t.desc.uv0Attribute]) return e;\n var n = this.uniforms;\n return n.diffuseTexture && (e.HAS_DIFFUSE_MAP = 1), n.specularGlossinessTexture && (e.HAS_SPECULARGLOSSINESS_MAP = 1), (e.HAS_SPECULARGLOSSINESS_MAP || e.HAS_DIFFUSE_MAP) && (e.HAS_MAP = 1), e;\n } }]);\n\n }(e);\n }\n var Ne = exports.PhongSpecularGlossinessMaterial = function (_Fe) {\n function Ne() {\n _classCallCheck(this, Ne);\n return _callSuper(this, Ne, arguments);\n }\n _inherits(Ne, _Fe);\n return _createClass(Ne);\n }(Fe(Ie));\n var Le = new Array(16);\n var ke = 0;\n var Be = exports.Mesh = function () {\n function Be(t, n) {\n var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n _classCallCheck(this, Be);\n this._version = 0, this._geometry = t, this._material = n, this.transparent = !!r.transparent, this.bloom = !!r.bloom, this.ssr = !!r.ssr, this._castShadow = u(r.castShadow) || r.castShadow, this.needUpdateShadow = !1, this.picking = !!r.picking, this.disableVAO = !!r.disableVAO, this.uniforms = {}, this._localTransform = _glMatrix.mat4.identity(new Array(16)), this._positionMatrix = _glMatrix.mat4.identity(new Array(16)), this.properties = {}, this._dirtyUniforms = !0, this._dirtyGeometry = !0, Object.defineProperty(this, \"uuid\", {\n value: ke++ }),\n ke > Number.MAX_VALUE - 10 && (ke = 0);\n }\n return _createClass(Be, [{\n key: \"material\",\n get: function get() {\n return this._material;\n },\n set: function set(e) {\n this._material !== e && this.setMaterial(e);\n } },\n {\n key: \"version\",\n get: function get() {\n return this._version;\n },\n set: function set(e) {\n throw new Error(\"Mesh.version is read only.\");\n } },\n {\n key: \"geometry\",\n get: function get() {\n return this._geometry;\n },\n set: function set(e) {\n this._geometry !== e && (this._incrVersion(), this._dirtyGeometry = !0), this._geometry = e;\n } },\n {\n key: \"localTransform\",\n get: function get() {\n return m(this._localTransform) ? this._localTransform() : this._localTransform;\n },\n set: function set(t) {\n this._prevTMat || (this._prevTMat = new Array(16)), Array.isArray(t) && !_glMatrix.mat4.exactEquals(this._prevTMat, t) && (this._incrVersion(), this._prevTMat = _glMatrix.mat4.copy(this._prevTMat, t)), this._localTransform = t;\n } },\n {\n key: \"positionMatrix\",\n get: function get() {\n return m(this._positionMatrix) ? this._positionMatrix() : this._positionMatrix;\n },\n set: function set(t) {\n this._prevPMat || (this._prevPMat = new Array(16)), Array.isArray(t) && !_glMatrix.mat4.exactEquals(this._prevPMat, t) && (this._incrVersion(), this._prevPMat = _glMatrix.mat4.copy(this._prevPMat, t)), this._positionMatrix = t;\n } },\n {\n key: \"config\",\n get: function get() {\n return this._options || (this._options = {}), this._options.transparent = this.transparent, this._options.castShadow = this.castShadow, this._options.bloom = this.bloom, this._options.ssr = this.ssr, this._options.picking = this.picking, this._options;\n } },\n {\n key: \"defines\",\n get: function get() {\n return this._getDefines();\n },\n set: function set(e) {\n this.setDefines(e);\n } },\n {\n key: \"castShadow\",\n get: function get() {\n return this._castShadow && (!this.material || !this.material.unlit);\n },\n set: function set(e) {\n this._castShadow = e;\n } },\n {\n key: \"setMaterial\",\n value: function setMaterial(e) {\n return this._material = e, this._dirtyUniforms = !0, delete this._materialVer, this.dirtyDefines = !0, this;\n } },\n {\n key: \"setParent\",\n value: function setParent(e) {\n return this.parent = e, this;\n } },\n {\n key: \"setLocalTransform\",\n value: function setLocalTransform(e) {\n return this.localTransform = e, this;\n } },\n {\n key: \"setPositionMatrix\",\n value: function setPositionMatrix(e) {\n this.positionMatrix = e;\n } },\n {\n key: \"setUniform\",\n value: function setUniform(e, t) {\n return this._updateUniformState(e), this.uniforms[e] = t, this;\n } },\n {\n key: \"setFunctionUniform\",\n value: function setFunctionUniform(e, t) {\n return this._updateUniformState(e), Object.defineProperty(this.uniforms, e, {\n enumerable: !0,\n get: t }),\n this;\n } },\n {\n key: \"hasFunctionUniform\",\n value: function hasFunctionUniform(e) {\n return !!this.uniforms && Object.prototype.hasOwnProperty.call(this.uniforms, e);\n } },\n {\n key: \"_updateUniformState\",\n value: function _updateUniformState(e) {\n void 0 === this.uniforms[e] ? this._dirtyUniforms = !0 : (this._dirtyProps = this._dirtyProps || [], this._dirtyProps.push(e));\n } },\n {\n key: \"getUniform\",\n value: function getUniform(e) {\n return this.uniforms[e];\n } },\n {\n key: \"getDefines\",\n value: function getDefines() {\n var e = {};\n return v(e, this._getDefines()), this._material && this._geometry && this._material.appendDefines(e, this._geometry), e;\n } },\n {\n key: \"_getDefines\",\n value: function _getDefines() {\n this._defines || (this._defines = {});\n var e = this._geometry,\n t = e.data[e.desc.positionAttribute],\n n = e.data[e.desc.uv0Attribute],\n r = e.data[e.desc.normalAttribute];\n return t && t.quantization && (this._defines.HAS_DRACO_POSITION = 1), n && n.quantization && (this._defines.HAS_DRACO_TEXCOORD = 1), r && r.quantization && (this._defines.HAS_DRACO_NORMAL = 1), this._defines;\n } },\n {\n key: \"setDefines\",\n value: function setDefines(e) {\n var t = this._bakDefines;\n return this._defines = e, this.dirtyDefines = this.dirtyDefines || !!t != !!e || !function (e, t) {\n if (!e && !t) return !0;\n var n = Object.getOwnPropertyNames(e),\n r = Object.getOwnPropertyNames(t);\n if (n.length !== r.length) return !1;\n for (var _r15 = 0; _r15 < n.length; _r15++) if (e[n[_r15]] !== t[n[_r15]]) return !1;\n return !0;\n }(t, e), this.dirtyDefines && (this._bakDefines = v({}, e)), this;\n } },\n {\n key: \"hasSkinAnimation\",\n value: function hasSkinAnimation() {\n return this._material && this._material.hasSkinAnimation();\n } },\n {\n key: \"_getDefinesKey\",\n value: function _getDefinesKey() {\n return this.dirtyDefines = !1, this._createDefinesKey(this.getDefines());\n } },\n {\n key: \"getCommandKey\",\n value: function getCommandKey(e) {\n if (!this._commandKey || this.dirtyDefines || this._material && this._materialKeys !== this._material.getUniformKeys()) {\n var _e31 = this._getDefinesKey();\n _e31 += \"_\" + (g(this.getElements()) ? \"count\" : \"elements\"), _e31 += \"_\" + +!!this.disableVAO, this._material && (_e31 += \"_\" + +!!this._material.doubleSided), this._commandKey = _e31, this._material && (this._materialKeys = this._material.getUniformKeys());\n }\n return this._commandKey;\n } },\n {\n key: \"getUniforms\",\n value: function getUniforms(e) {\n var _this5 = this;\n if (this._dirtyUniforms || this._dirtyGeometry || this._material && this._materialVer !== this._material.version) {\n this._uniformDescriptors = new Set(), this._realUniforms = {}, this._prepareUniformsForDraco();\n var _t26 = this.uniforms;\n var _loop2 = function _loop2(_e32) {\n if (S(_this5.uniforms, _e32)) {\n Object.getOwnPropertyDescriptor(_t26, _e32).get ? (_this5._uniformDescriptors.add(_e32), Object.defineProperty(_this5._realUniforms, _e32, {\n enumerable: !0,\n configurable: !0,\n get: function get() {\n return _t26[_e32];\n } })) :\n _this5._realUniforms[_e32] = _t26[_e32];\n }\n };\n for (var _e32 in this.uniforms) {\n _loop2(_e32);\n }\n if (this._material) {\n var _t27 = this._material.getUniforms(e);\n var _loop3 = function _loop3(_e33) {\n if (S(_t27, _e33) && !S(_this5._realUniforms, _e33)) {\n Object.getOwnPropertyDescriptor(_t27, _e33).get ? (_this5._uniformDescriptors.add(_e33), Object.defineProperty(_this5._realUniforms, _e33, {\n enumerable: !0,\n configurable: !0,\n get: function get() {\n return _t27[_e33];\n } })) :\n void 0 === _this5._realUniforms[_e33] && (_this5._realUniforms[_e33] = _t27[_e33]);\n }\n };\n for (var _e33 in _t27) {\n _loop3(_e33);\n }\n }\n this._dirtyUniforms = !1, this._dirtyGeometry = !1, this._materialVer = this._material && this._material.version, this._materialPropVer = this._material && this._material.propVersion, this._dirtyProps = null;\n } else if (this._dirtyProps || this._material && this._material.propVersion !== this._materialPropVer) {\n if (this._dirtyProps) {\n var _iterator2 = _createForOfIteratorHelper(this._dirtyProps),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var _e34 = _step2.value;\n this._realUniforms[_e34] = this.uniforms[_e34];\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n }\n if (this._material && this._material.propVersion !== this._materialPropVer) {\n var _t28 = this._material.getUniforms(e);\n for (var _e35 in _t28) if (S(_t28, _e35) && !this._uniformDescriptors.has(_e35)) {\n Object.getOwnPropertyDescriptor(_t28, _e35).get || this._realUniforms[_e35] === _t28[_e35] || (this._realUniforms[_e35] = _t28[_e35]);\n }\n this._materialPropVer = this._material.propVersion;\n }\n this._dirtyProps = null;\n }\n return this._realUniforms.modelMatrix = this.localTransform, this._realUniforms.positionMatrix = this.positionMatrix, this._realUniforms;\n } },\n {\n key: \"_prepareUniformsForDraco\",\n value: function _prepareUniformsForDraco() {\n var e = this._geometry,\n t = e.data[e.desc.positionAttribute],\n n = e.data[e.desc.uv0Attribute],\n r = e.data[e.desc.normalAttribute];\n if (t && t.quantization) {\n var _e36 = t.quantization,\n _n21 = _e36.range / (1 << _e36.quantizationBits);\n this._realUniforms.minValues_pos = _e36.minValues, this._realUniforms.gltf_u_dec_position_normConstant = _n21;\n }\n if (n && n.quantization) {\n var _e37 = n.quantization;\n this._realUniforms.minValues_tex = _e37.minValues;\n this._realUniforms.gltf_u_dec_texcoord_0_normConstant = _e37.range / (1 << _e37.quantizationBits);\n }\n if (r && r.quantization) {\n this._realUniforms.gltf_u_dec_normal_rangeConstant = (1 << r.quantization.quantizationBits) - 1;\n }\n } },\n {\n key: \"getMaterial\",\n value: function getMaterial() {\n return this._material;\n } },\n {\n key: \"getElements\",\n value: function getElements() {\n return this._geometry.getElements();\n } },\n {\n key: \"_getREGLAttrData\",\n value: function _getREGLAttrData(e, t) {\n return this._geometry.getREGLData(e, t, this.disableVAO);\n } },\n {\n key: \"getREGLProps\",\n value: function getREGLProps(e, t) {\n var n = this.getUniforms(e);\n return v(n, this._getREGLAttrData(e, t)), A(e) && !this.disableVAO || (n.elements = this._geometry.getElements()), n.meshProperties = this.properties, n.geometryProperties = this._geometry.properties, n.meshConfig = this.config, n.count = this._geometry.getDrawCount(), n.offset = this._geometry.getDrawOffset(), n.primitive = this._geometry.getPrimitive(), n;\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n return delete this._geometry, delete this._material, this.uniforms = null, this;\n } },\n {\n key: \"isValid\",\n value: function isValid() {\n return this._geometry && !this._geometry.isDisposed() && (!this._material || !this._material.isDisposed());\n } },\n {\n key: \"getBoundingBox\",\n value: function getBoundingBox() {\n return this._geometry ? (this._bbox || this.updateBoundingBox(), _glMatrix.mat4.multiply(Le, this.localTransform, this.positionMatrix), _glMatrix.mat4.exactEquals(Le, this._currentTransform) && this._geometry.boundingBox.equals(this._geoBox) || this.updateBoundingBox(), this._bboxArr) : null;\n } },\n {\n key: \"updateBoundingBox\",\n value: function updateBoundingBox() {\n var n = this._geometry.boundingBox;\n this._bbox || (this._bbox = new j()), this._bboxArr || (this._bboxArr = [[0, 0, 0], [0, 0, 0]]), this._geoBox || (this._geoBox = new j()), j.copy(this._bbox, n), this._bbox.updateVertex(), \"InstancedMesh\" === this.constructor.name ? (this._bbox.transform(this.localTransform, this.positionMatrix), this._currentTransform = _glMatrix.mat4.multiply(this._currentTransform || new Array(16), this.positionMatrix, this.localTransform)) : (this._bbox.transform(this.positionMatrix, this.localTransform), this._currentTransform = _glMatrix.mat4.multiply(this._currentTransform || new Array(16), this.localTransform, this.positionMatrix)), j.copy(this._geoBox, n), _glMatrix.vec3.copy(this._bboxArr[0], this._bbox.min), _glMatrix.vec3.copy(this._bboxArr[1], this._bbox.max);\n } },\n {\n key: \"_createDefinesKey\",\n value: function _createDefinesKey(e) {\n var t = [];\n for (var _n22 in e) t.push(_n22, e[_n22]);\n return t.join(\",\");\n } },\n {\n key: \"_incrVersion\",\n value: function _incrVersion() {\n this._version++;\n } },\n {\n key: \"getMemorySize\",\n value: function getMemorySize() {\n return (this.geometry && this.geometry.getMemorySize() || 0) + (this.material && this.material.getMemorySize() || 0);\n } },\n {\n key: \"getWorldTransform\",\n value: function getWorldTransform() {\n var t = this.parent;\n return t ? _glMatrix.mat4.multiply(new Array(16), t.getWorldTransform(), this.localTransform) : this.localTransform;\n } }]);\n\n }();\n var ze = exports.InstancedMesh = function (_Be) {\n function ze(e, t, n, r) {\n var _this6;\n var i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};\n _classCallCheck(this, ze);\n _this6 = _callSuper(this, ze, [n, r, i]), _this6._instanceCount = t, _this6.instancedData = e || {}, _this6._checkInstancedProp(), _this6._vao = {};\n return _this6;\n }\n _inherits(ze, _Be);\n return _createClass(ze, [{\n key: \"instanceCount\",\n get: function get() {\n return this._instanceCount;\n },\n set: function set(e) {\n this._incrVersion(), this._instanceCount = e;\n } },\n {\n key: \"getMemorySize\",\n value: function getMemorySize() {\n return _superPropGet(ze, \"getMemorySize\", this, 3)([]) + this._getInstanceMemorySize();\n } },\n {\n key: \"_getInstanceMemorySize\",\n value: function _getInstanceMemorySize() {\n var e = 0;\n for (var _t29 in this.instancedData) S(this.instancedData, _t29) && (e += T(this.instancedData[_t29]));\n return e;\n } },\n {\n key: \"_checkInstancedProp\",\n value: function _checkInstancedProp() {\n for (var _e38 in this.instancedData) if (this.geometry.data[_e38]) throw new Error(\"Duplicate attribute \".concat(_e38, \" defined in geometry and instanced data\"));\n } },\n {\n key: \"_getREGLAttrData\",\n value: function _getREGLAttrData(e, t) {\n var n = this.geometry.getAttrData(t);\n if (A(e)) {\n var _r16 = t.key;\n if (!this._vao[_r16] || this._vao[_r16].dirty) {\n var _i13 = t.map(function (e) {\n return e.name;\n }),\n _o8 = [];\n for (var _e39 = 0; _e39 < _i13.length; _e39++) {\n var _t30 = n[_i13[_e39]];\n _o8.push(_t30 && _t30.buffer || this.instancedData[_i13[_e39]]);\n }\n var _a9 = {\n attributes: _o8,\n primitive: this.geometry.getPrimitive() };\n\n this._vao[_r16] ? this._vao[_r16].vao(_a9) : this._vao[_r16] = {\n vao: e.vao(_a9) },\n delete this._vao[_r16].dirty;\n }\n return this._vao[_r16];\n }\n return n;\n } },\n {\n key: \"getDefines\",\n value: function getDefines() {\n var e = _superPropGet(ze, \"getDefines\", this, 3)([]);\n return e.HAS_INSTANCE = 1, e;\n } },\n {\n key: \"getCommandKey\",\n value: function getCommandKey(e) {\n return \"i_\" + _superPropGet(ze, \"getCommandKey\", this, 3)([e]);\n } },\n {\n key: \"updateInstancedData\",\n value: function updateInstancedData(e, t) {\n var n = this.instancedData[e];\n if (this._incrVersion(), this.instancedData[e] = t, n && n.buffer && n.buffer.destroy && n.buffer.destroy(), this._vao) for (var _e40 in this._vao) this._vao[_e40].dirty = !0;\n return this;\n } },\n {\n key: \"generateInstancedBuffers\",\n value: function generateInstancedBuffers(e) {\n var t = this.instancedData,\n n = {};\n for (var _r17 in t) {\n if (!t[_r17]) continue;\n var _i14 = t[_r17];\n void 0 !== _i14.buffer && _i14.buffer.destroy ? (n[_r17] = _i14, n[_r17].divisor && (n[_r17].divisor = 1)) : n[_r17] = t[_r17].destroy ? {\n buffer: t[_r17],\n divisor: 1 } :\n {\n buffer: e.buffer({\n data: t[_r17],\n dimension: t[_r17].length / this._instanceCount }),\n\n divisor: 1 };\n\n }\n return this.instancedData = n, this;\n } },\n {\n key: \"getREGLProps\",\n value: function getREGLProps(e, t) {\n var n = _superPropGet(ze, \"getREGLProps\", this, 3)([e, t]);\n return A(e) || v(n, this.instancedData), n.elements = this.geometry.getElements(), n.instances = this._instanceCount, n;\n } },\n {\n key: \"disposeInstancedData\",\n value: function disposeInstancedData() {\n var e = this.instancedData;\n if (e) for (var _t31 in e) {\n if (!e[_t31]) continue;\n var _n23 = e[_t31].destroy ? e[_t31] : e[_t31].buffer;\n _n23.destroy && !_n23[L] && (_n23[L] = 1, _n23.destroy());\n }\n this.instancedData = {};\n for (var _e41 in this._vao) this._vao[_e41].vao.destroy();\n this._vao = {};\n } }]);\n\n }(Be);\n var Ge = {};\n var Ve = exports.Renderer = function () {\n function Ve(e) {\n _classCallCheck(this, Ve);\n this.regl = e;\n }\n return _createClass(Ve, [{\n key: \"render\",\n value: function render(e, t, n, r) {\n e.setUniforms(t || Ge), e.setFramebuffer(r);\n var i = 0;\n if (n) {\n var _n$getSortedMeshes = n.getSortedMeshes(),\n _t32 = _n$getSortedMeshes.opaques,\n _r18 = _n$getSortedMeshes.transparents;\n i += e.draw(this.regl, _t32), i += e.draw(this.regl, _r18);\n } else i += e.draw(this.regl);\n return i;\n } },\n {\n key: \"clear\",\n value: function clear(e) {\n this.regl.clear(e);\n } }]);\n\n }();\n var Ue = {\n getArrayBuffer: function getArrayBuffer(e, t) {\n return Ue.get(e, {\n responseType: \"arraybuffer\" },\n t);\n },\n get: function get(e, t, n) {\n var r = Ue._getClient(n);\n if (r.open(\"GET\", e, !0), t) {\n for (var _e42 in t.headers) r.setRequestHeader(_e42, t.headers[_e42]);\n r.withCredentials = \"include\" === t.credentials, t.responseType && (r.responseType = t.responseType);\n }\n return r.send(null), r;\n },\n _wrapCallback: function _wrapCallback(e, t) {\n return function () {\n if (4 === e.readyState) if (200 === e.status) {\n if (\"arraybuffer\" === e.responseType) {\n 0 === e.response.byteLength ? t(new Error(\"http status 200 returned without content.\")) : t(null, {\n data: e.response,\n cacheControl: e.getResponseHeader(\"Cache-Control\"),\n expires: e.getResponseHeader(\"Expires\"),\n contentType: e.getResponseHeader(\"Content-Type\") });\n\n } else t(null, e.responseText);\n } else t(new Error(e.statusText + \",\" + e.status));\n };\n },\n _getClient: function _getClient(e) {\n var t;\n try {\n t = new XMLHttpRequest();\n } catch (e) {\n try {\n t = new ActiveXObject(\"Msxml2.XMLHTTP\");\n } catch (e) {\n try {\n t = new ActiveXObject(\"Microsoft.XMLHTTP\");\n } catch (e) {}\n }\n }\n return t.onreadystatechange = Ue._wrapCallback(t, e), t;\n } };\n\n var je = function () {\n function je(e, t) {\n _classCallCheck(this, je);\n this.defaultTexture = e, this.defaultCubeTexture = new Array(6), this.urlModifier = t, this.resources = {};\n }\n return _createClass(je, [{\n key: \"setURLModifier\",\n value: function setURLModifier(e) {\n this.urlModifier = e;\n } },\n {\n key: \"get\",\n value: function get(e) {\n return Array.isArray(e) ? this._loadImages(e) : this._loadImage(e);\n } },\n {\n key: \"getArrayBuffer\",\n value: function getArrayBuffer(e) {\n var _this7 = this;\n if (Array.isArray(e)) {\n var _t33 = e.map(function (e) {\n return _this7.getArrayBuffer(e);\n });\n return Promise.all(_t33);\n }\n return new Promise(function (t, n) {\n var r = e;\n _this7.urlModifier && (r = _this7.urlModifier(e)), Ue.getArrayBuffer(r, function (r, i) {\n r ? n(r) : t({\n url: e,\n data: i });\n\n });\n });\n } },\n {\n key: \"disposeRes\",\n value: function disposeRes(e) {\n var _this8 = this;\n return Array.isArray(e) ? e.forEach(function (e) {\n return _this8._disposeOne(e);\n }) : this._disposeOne(e), this;\n } },\n {\n key: \"isLoading\",\n value: function isLoading() {\n return this._count && this._count > 0;\n } },\n {\n key: \"getDefaultTexture\",\n value: function getDefaultTexture(e) {\n return Array.isArray(e) ? this._getBlankTextures(e.length) : this.defaultTexture;\n } },\n {\n key: \"_disposeOne\",\n value: function _disposeOne(e) {\n var t = this.resources;\n t[e] && (t[e].count--, t[e].count <= 0 && delete t[e]);\n } },\n {\n key: \"_loadImage\",\n value: function _loadImage(e) {\n var _this9 = this;\n var t = this.resources;\n if (t[e]) return Promise.resolve({\n url: e,\n data: t[e].image });\n\n return new Promise(function (n, r) {\n var i = new Image();\n i.crossOrigin = \"anonymous\", i.onload = function () {\n t[e] = {\n image: i,\n count: 1 },\n n({\n url: e,\n data: i });\n\n }, i.onerror = function (e) {\n r(e);\n }, i.onabort = function () {\n r(\"image(\".concat(e, \") loading aborted.\"));\n }, i.src = _this9.urlModifier ? _this9.urlModifier(e) : e;\n });\n } },\n {\n key: \"_loadImages\",\n value: function _loadImages(e) {\n var _this10 = this;\n var t = e.map(function (e) {\n return _this10._loadImage(e);\n });\n return Promise.all(t);\n } },\n {\n key: \"_getBlankTextures\",\n value: function _getBlankTextures(e) {\n var t = new Array(e);\n for (var _e43 = 0; _e43 < 6; _e43++) t.push(this.defaultTexture);\n return t;\n } }]);\n\n }();\n var Xe = exports.ResourceLoader = function (_N3) {\n function Xe() {\n _classCallCheck(this, Xe);\n return _callSuper(this, Xe, arguments);\n }\n _inherits(Xe, _N3);\n return _createClass(Xe);\n }(N(je));\n var We = [0, 0, 0],\n qe = [0, 0, 0];\n var Ke,\n Je = 0;\n function Ye(e, n) {\n return _glMatrix.vec3.transformMat4(We, e.geometry.boundingBox.getCenter(), e.localTransform), _glMatrix.vec3.transformMat4(qe, n.geometry.boundingBox.getCenter(), n.localTransform), _glMatrix.vec3.dist(qe, Ke) - _glMatrix.vec3.dist(We, Ke);\n }\n var Ze = exports.Scene = function () {\n function Ze(e) {\n _classCallCheck(this, Ze);\n this._id = Je++, this.sortedMeshes = {}, this.setMeshes(e), this.dirty();\n }\n return _createClass(Ze, [{\n key: \"setMeshes\",\n value: function setMeshes(e) {\n if (this.clear(), !e || Array.isArray(e) && !e.length || e === this.meshes) return this;\n e = Array.isArray(e) ? e : [e], this.meshes = [];\n for (var _t34 = 0; _t34 < e.length; _t34++) {\n var _n24 = e[_t34];\n _n24 && (_n24._scenes = _n24._scenes || {}, _n24._scenes[this._id] = 1, this.meshes.push(_n24));\n }\n return this.dirty(), this;\n } },\n {\n key: \"addMesh\",\n value: function addMesh(e) {\n var _this11 = this;\n if (!e || Array.isArray(e) && !e.length) return this;\n if (Array.isArray(e)) e.forEach(function (e) {\n var t = e._scenes = e._scenes || {};\n t[_this11._id] || (t[_this11._id] = 1, _this11.meshes.push(e), _this11.dirty());\n });else {\n var _t35 = e._scenes = e._scenes || {};\n _t35[this._id] || (_t35[this._id] = 1, this.meshes.push(e), this.dirty());\n }\n return this;\n } },\n {\n key: \"removeMesh\",\n value: function removeMesh(e) {\n if (!e || Array.isArray(e) && !e.length) return this;\n if (Array.isArray(e)) {\n var _t36 = !1;\n for (var _n25 = 0; _n25 < e.length; _n25++) {\n var _r19 = e[_n25]._scenes;\n _r19 && _r19[this._id] && (_t36 = !0, this.dirty(), delete _r19[this._id]);\n }\n _t36 && (this.meshes = this.meshes.filter(function (t) {\n return e.indexOf(t) < 0;\n }));\n } else {\n var _t37 = e._scenes;\n if (!_t37 || !_t37[this._id]) return this;\n var _n26 = this.meshes.indexOf(e);\n _n26 >= 0 && this.meshes.splice(_n26, 1), delete _t37[this._id], this.dirty();\n }\n return this;\n } },\n {\n key: \"getMeshes\",\n value: function getMeshes() {\n return this.meshes || [];\n } },\n {\n key: \"clear\",\n value: function clear() {\n if (this.meshes) for (var _e44 = 0; _e44 < this.meshes.length; _e44++) delete this.meshes[_e44]._scenes[this._id];\n return this.meshes = [], this.sortedMeshes.opaques = [], this.sortedMeshes.transparents = [], this;\n } },\n {\n key: \"dirty\",\n value: function dirty() {\n return this._dirty = !0, this;\n } },\n {\n key: \"sortMeshes\",\n value: function sortMeshes(e) {\n var t = this.meshes;\n this.sortFunction && t.sort(this.sortFunction);\n var n = this.sortedMeshes.transparents;\n if (this._dirty) {\n var _e45 = this.sortedMeshes.opaques = [];\n n = this.sortedMeshes.transparents = [];\n for (var _r20 = 0, _i15 = t.length; _r20 < _i15; _r20++) t[_r20].transparent ? n.push(t[_r20]) : _e45.push(t[_r20]);\n }\n e && n.length > 1 && (Ke = e, n.sort(Ye)), this._dirty = !1;\n } },\n {\n key: \"getSortedMeshes\",\n value: function getSortedMeshes() {\n return this._dirty && this.sortMeshes(), this.sortedMeshes || {};\n } }]);\n\n }();\n var $e = String.fromCharCode,\n Qe = 8,\n et = 32767;\n function tt(e, t, n, r) {\n if (e[3] > 0) {\n var _i16 = Math.pow(2, e[3] - 128 - 8 + r);\n t[n + 0] = e[0] * _i16, t[n + 1] = e[1] * _i16, t[n + 2] = e[2] * _i16;\n } else t[n + 0] = 0, t[n + 1] = 0, t[n + 2] = 0;\n return t[n + 3] = 1, t;\n }\n function nt(e, t, n, r) {\n var i = 0,\n o = 0,\n a = r;\n for (; a > 0;) if (e[o][0] = t[n++], e[o][1] = t[n++], e[o][2] = t[n++], e[o][3] = t[n++], 1 === e[o][0] && 1 === e[o][1] && 1 === e[o][2]) {\n for (var _t38 = e[o][3] << i >>> 0; _t38 > 0; _t38--) (c = e[o])[0] = (s = e[o - 1])[0], c[1] = s[1], c[2] = s[2], c[3] = s[3], o++, a--;\n i += 8;\n } else o++, a--, i = 0;\n var s, c;\n return n;\n }\n function rt(e, t, n, r) {\n if (r < Qe | r > et) return nt(e, t, n, r);\n var i = t[n++];\n if (2 !== i) return nt(e, t, n - 1, r);\n if (e[0][1] = t[n++], e[0][2] = t[n++], i = t[n++], (e[0][2] << 8 >>> 0 | i) >>> 0 !== r) return null;\n for (var _i17 = 0; _i17 < 4; _i17++) for (var _o9 = 0; _o9 < r;) {\n var _r21 = t[n++];\n if (_r21 > 128) {\n _r21 = (127 & _r21) >>> 0;\n var _a10 = t[n++];\n for (; _r21--;) e[_o9++][_i17] = _a10;\n } else for (; _r21--;) e[_o9++][_i17] = t[n++];\n }\n return n;\n }\n function it(e) {\n var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var n = new Uint8Array(e),\n r = n.length;\n if (\"#?\" !== function (e, t, n) {\n var r = \"\";\n for (var _i18 = t; _i18 < n; _i18++) r += $e(e[_i18]);\n return r;\n }(n, 0, 2)) return null;\n for (var i = 2; i < r && (\"\\n\" !== $e(n[i]) || \"\\n\" !== $e(n[i + 1])); i++);\n if (i >= r) return null;\n i += 2;\n var o = \"\";\n for (; i < r; i++) {\n var _e46 = $e(n[i]);\n if (\"\\n\" === _e46) break;\n o += _e46;\n }\n var a = o.split(\" \"),\n s = parseInt(a[1]),\n c = parseInt(a[3]);\n if (!c || !s) return null;\n var l = i + 1;\n var f = [];\n for (var _e47 = 0; _e47 < c; _e47++) {\n f[_e47] = [];\n for (var _t39 = 0; _t39 < 4; _t39++) f[_e47][_t39] = 0;\n }\n var d = new Float32Array(c * s * 4);\n var u = 0;\n for (var _e48 = 0; _e48 < s; _e48++) {\n if (l = rt(f, n, l, c), !l) return null;\n for (var _e49 = 0; _e49 < c; _e49++) tt(f[_e49], d, u, t), u += 4;\n }\n return {\n width: c,\n height: s,\n pixels: d };\n\n }\n var ot = at();\n function at() {\n var e = new ArrayBuffer(4),\n t = new Float32Array(e),\n n = new Uint32Array(e),\n r = new Uint32Array(512),\n i = new Uint32Array(512);\n for (var _e50 = 0; _e50 < 256; ++_e50) {\n var _t40 = _e50 - 127;\n _t40 < -27 ? (r[_e50] = 0, r[256 | _e50] = 32768, i[_e50] = 24, i[256 | _e50] = 24) : _t40 < -14 ? (r[_e50] = 1024 >> -_t40 - 14, r[256 | _e50] = 1024 >> -_t40 - 14 | 32768, i[_e50] = -_t40 - 1, i[256 | _e50] = -_t40 - 1) : _t40 <= 15 ? (r[_e50] = _t40 + 15 << 10, r[256 | _e50] = _t40 + 15 << 10 | 32768, i[_e50] = 13, i[256 | _e50] = 13) : _t40 < 128 ? (r[_e50] = 31744, r[256 | _e50] = 64512, i[_e50] = 24, i[256 | _e50] = 24) : (r[_e50] = 31744, r[256 | _e50] = 64512, i[_e50] = 13, i[256 | _e50] = 13);\n }\n var o = new Uint32Array(2048),\n a = new Uint32Array(64),\n s = new Uint32Array(64);\n for (var _e51 = 1; _e51 < 1024; ++_e51) {\n var _t41 = _e51 << 13,\n _n27 = 0;\n for (; !(8388608 & _t41);) _t41 <<= 1, _n27 -= 8388608;\n _t41 &= -8388609, _n27 += 947912704, o[_e51] = _t41 | _n27;\n }\n for (var _e52 = 1024; _e52 < 2048; ++_e52) o[_e52] = 939524096 + (_e52 - 1024 << 13);\n for (var _e53 = 1; _e53 < 31; ++_e53) a[_e53] = _e53 << 23;\n a[31] = 1199570944, a[32] = 2147483648;\n for (var _e54 = 33; _e54 < 63; ++_e54) a[_e54] = 2147483648 + (_e54 - 32 << 23);\n a[63] = 3347054592;\n for (var _e55 = 1; _e55 < 64; ++_e55) 32 !== _e55 && (s[_e55] = 1024);\n return {\n floatView: t,\n uint32View: n,\n baseTable: r,\n shiftTable: i,\n mantissaTable: o,\n exponentTable: a,\n offsetTable: s };\n\n }\n var st = {\n toHalfFloat: function toHalfFloat(e) {\n Math.abs(e) > 65504 && console.warn(\"THREE.DataUtils.toHalfFloat(): Value out of range.\"), e = y(e, -65504, 65504), ot.floatView[0] = e;\n var t = ot.uint32View[0],\n n = t >> 23 & 511;\n return ot.baseTable[n] + ((8388607 & t) >> ot.shiftTable[n]);\n },\n fromHalfFloat: function fromHalfFloat(e) {\n var t = e >> 10;\n return ot.uint32View[0] = ot.mantissaTable[ot.offsetTable[t] + (1023 & e)] + ot.exponentTable[t], ot.floatView[0];\n } };\n\n var ct = exports.Texture2D = function (_G) {\n function ct() {\n _classCallCheck(this, ct);\n return _callSuper(this, ct, arguments);\n }\n _inherits(ct, _G);\n return _createClass(ct, [{\n key: \"onLoad\",\n value: function onLoad(_ref) {\n var e = _ref.data;\n var t = this.config;\n if (t) {\n if (t.hdr) {\n if (!(e = it(e.data, 0))) throw new Error(\"Invalid hdr data\" + (t.url ? \":\" + t.url : \"\"));\n {\n var _n28 = new Uint16Array(e.pixels.length);\n for (var _t42 = 0; _t42 < e.pixels.length; _t42++) _n28[_t42] = Math.min(st.toHalfFloat(e.pixels[_t42]), 65504);\n t.data = _n28, t.type = \"float16\", t.colorSpace = \"browser\", t.min = \"linear\", t.mag = \"linear\";\n }\n } else t.data = e;\n t.width = t.width || e.width, t.height = t.height || e.height, this._regl && this._checkNPOT(this._regl), this._updateREGL();\n }\n } },\n {\n key: \"createREGLTexture\",\n value: function createREGLTexture(e) {\n if (this._regl = e, this._checkNPOT(e), p(this.config.data) || p(this.config.mipmap)) {\n var _t43 = me(e, this.config);\n return _t43[B] || (_t43[B] = 0), _t43[B]++, _t43;\n }\n return e.texture(this.config);\n } },\n {\n key: \"_checkNPOT\",\n value: function _checkNPOT(e) {\n var t = this.config;\n t.data && this._needPowerOf2(e) && (t.data instanceof Image ? (t.data = D(t.data), t.width = t.data.width, t.height = t.data.height) : t.hdr || !p(t.data) || I(t.width) && I(t.height) || (t.data = D(t.data, t.width, t.height), t.width = t.data.width, t.height = t.data.height));\n } }]);\n\n }(G);\n var lt = exports.Plane = function (_Z2) {\n function lt(e) {\n _classCallCheck(this, lt);\n return _callSuper(this, lt, [{\n aPosition: new (b(e = e || 0))([-1, -1, e, 1, -1, e, -1, 1, e, 1, 1, e]),\n aNormal: new Int8Array([0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1]) },\n new Uint16Array([0, 1, 3, 3, 2, 0])]);\n }\n _inherits(lt, _Z2);\n return _createClass(lt);\n }(Z);\n var ft = {\n vsm_shadow_vert: \"\\nuniform mat4 shadow_lightProjViewModelMatrix;\\nvarying vec4 shadow_vLightSpacePos;\\nvoid shadow_computeShadowPars(vec4 position) {\\n shadow_vLightSpacePos = shadow_lightProjViewModelMatrix * position;\\n}\",\n vsm_shadow_frag: \"\\nuniform sampler2D shadow_shadowMap;\\nuniform float shadow_opacity;\\nuniform vec3 shadow_color;\\n#if defined(USE_ESM)\\n uniform float esm_shadow_threshold;\\n#endif\\nvarying vec4 shadow_vLightSpacePos;\\n#ifdef PACK_FLOAT\\n #include \\n#endif\\n#if defined(USE_ESM)\\nfloat esm(vec3 projCoords, vec4 shadowTexel) {\\n float compare = projCoords.z;\\n float c = 120.0;\\n #ifdef PACK_FLOAT\\n float depth = common_decodeDepth(shadowTexel);\\n if (depth >= 1.0 - 1E-6 || compare <= depth) {\\n return 1.0;\\n }\\n #else\\n float depth = shadowTexel.r;\\n #endif\\n depth = exp(-c * min(compare - depth, 0.05));\\n return clamp(depth, esm_shadow_threshold, 1.0);\\n}\\n#endif\\n#if defined(USE_VSM)\\nfloat vsm_shadow_chebyshevUpperBound(vec3 projCoords, vec4 shadowTexel){\\n vec2 moments = shadowTexel.rg;\\n float distance = projCoords.z;\\n if (distance >= 1.0 || distance <= moments.x)\\n return 1.0 ;\\n float variance = moments.y - (moments.x * moments.x);\\n variance = max(variance, 0.00002);\\n float d = distance - moments.x;\\n float p_max = variance / (variance + d * d);\\n return p_max;\\n}\\n#endif\\nfloat shadow_computeShadow_coeff(sampler2D shadowMap, vec3 projCoords) {\\n vec2 uv = projCoords.xy;\\n vec4 shadowTexel = texture2D(shadowMap, uv);\\n #if defined(USE_ESM)\\n float esm_coeff = esm(projCoords, shadowTexel);\\n float coeff = esm_coeff * esm_coeff;\\n #endif\\n #if defined(USE_VSM)\\n float vsm_coeff = vsm_shadow_chebyshevUpperBound(projCoords, shadowTexel);\\n float coeff = vsm_coeff;\\n #endif\\n return 1.0 - (1.0 - coeff) * shadow_opacity;\\n}\\nfloat shadow_computeShadow() {\\n vec3 projCoords = shadow_vLightSpacePos.xyz / shadow_vLightSpacePos.w;\\n projCoords = projCoords * 0.5 + 0.5;\\n if(projCoords.z >= 1.0 || projCoords.x < 0.0 || projCoords.x > 1.0 || projCoords.y < 0.0 || projCoords.y > 1.0) return 1.0;\\n return shadow_computeShadow_coeff(shadow_shadowMap, projCoords);\\n}\\nvec3 shadow_blend(vec3 color, float coeff) {\\n color = color * coeff + shadow_color * shadow_opacity * (1.0 - coeff);\\n return color;\\n}\",\n fbo_picking_vert: \"\\n#ifdef ENABLE_PICKING\\n#if HAS_PICKING_ID == 1\\nattribute float aPickingId;\\n#elif HAS_PICKING_ID == 2\\nuniform float uPickingId;\\n#endif\\nvarying float vPickingId;\\nvarying float vFbo_picking_viewZ;\\nvarying float vFbo_picking_visible;\\n#endif\\nvarying float vFbo_picking_fragDepth;\\nvoid fbo_picking_setData(float viewPosZ, bool visible) {\\n #ifdef ENABLE_PICKING\\n #if HAS_PICKING_ID == 1\\n vPickingId = aPickingId;\\n #elif HAS_PICKING_ID == 2\\n vPickingId = uPickingId;\\n #endif\\n vFbo_picking_viewZ = viewPosZ;\\n #endif\\n vFbo_picking_visible = visible ? 1.0 : 0.0;\\n vFbo_picking_fragDepth = viewPosZ + 1.0;\\n}\",\n common_pack_float: \"const float COMMON_FLOAT_MAX = 1.70141184e38;\\nconst float COMMON_FLOAT_MIN = 1.17549435e-38;\\nfloat common_packFloat(vec4 val){\\n vec4 scl = floor(255.0 * val + 0.5);\\n float sgn = (scl.a < 128.0) ? 1.0 : -1.0;\\n float exn = mod(scl.a * 2.0, 256.0) + floor(scl.b / 128.0) - 127.0;\\n float man = 1.0 +\\n (scl.r / 8388608.0) +\\n (scl.g / 32768.0) +\\n mod(scl.b, 128.0) / 128.0;\\n return sgn * man * pow(2.0, exn);\\n}\\nvec4 common_unpackFloat(highp float v) {\\n highp float av = abs(v);\\n if(av < COMMON_FLOAT_MIN) {\\n return vec4(0.0, 0.0, 0.0, 0.0);\\n } else if(v > COMMON_FLOAT_MAX) {\\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\\n } else if(v < -COMMON_FLOAT_MAX) {\\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\\n }\\n highp vec4 c = vec4(0,0,0,0);\\n highp float e = floor(log2(av));\\n highp float m = av * pow(2.0, -e) - 1.0;\\n c[1] = floor(128.0 * m);\\n m -= c[1] / 128.0;\\n c[2] = floor(32768.0 * m);\\n m -= c[2] / 32768.0;\\n c[3] = floor(8388608.0 * m);\\n highp float ebias = e + 127.0;\\n c[0] = floor(ebias / 2.0);\\n ebias -= c[0] * 2.0;\\n c[1] += floor(ebias) * 128.0;\\n c[0] += 128.0 * step(0.0, -v);\\n return c / 255.0;\\n}\\nvec4 common_encodeDepth(const in float depth) {\\n float alpha = 1.0;\\n vec4 pack = vec4(0.0);\\n pack.a = alpha;\\n const vec3 code = vec3(1.0, 255.0, 65025.0);\\n pack.rgb = vec3(code * depth);\\n pack.gb = fract(pack.gb);\\n pack.rg -= pack.gb * (1.0 / 256.0);\\n pack.b -= mod(pack.b, 4.0 / 255.0);\\n return pack;\\n}\\nfloat common_decodeDepth(const in vec4 pack) {\\n return pack.r + pack.g / 255.0;\\n}\",\n invert_matrix: \"mat4 invert_matrix(mat4 matrix) {\\n #if __VERSION__ == 300\\n return inverse(matrix);\\n #else\\n vec4 vector1 = matrix[0], vector2 = matrix[1], vector3 = matrix[2], vector4 = matrix[3];\\n float a00 = vector1.x, a01 = vector1.y, a02 = vector1.z, a03 = vector1.w;\\n float a10 = vector2.x, a11 = vector2.y, a12 = vector2.z, a13 = vector2.w;\\n float a20 = vector3.x, a21 = vector3.y, a22 = vector3.z, a23 = vector3.w;\\n float a30 = vector4.x, a31 = vector4.y, a32 = vector4.z, a33 = vector4.w;\\n float b00 = a00 * a11 - a01 * a10;\\n float b01 = a00 * a12 - a02 * a10;\\n float b02 = a00 * a13 - a03 * a10;\\n float b03 = a01 * a12 - a02 * a11;\\n float b04 = a01 * a13 - a03 * a11;\\n float b05 = a02 * a13 - a03 * a12;\\n float b06 = a20 * a31 - a21 * a30;\\n float b07 = a20 * a32 - a22 * a30;\\n float b08 = a20 * a33 - a23 * a30;\\n float b09 = a21 * a32 - a22 * a31;\\n float b10 = a21 * a33 - a23 * a31;\\n float b11 = a22 * a33 - a23 * a32;\\n float det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\\n det = 1.0 / det;\\n mat4 m = mat4(\\n (a11 * b11 - a12 * b10 + a13 * b09) * det,\\n (a02 * b10 - a01 * b11 - a03 * b09) * det,\\n (a31 * b05 - a32 * b04 + a33 * b03) * det,\\n (a22 * b04 - a21 * b05 - a23 * b03) * det,\\n (a12 * b08 - a10 * b11 - a13 * b07) * det,\\n (a00 * b11 - a02 * b08 + a03 * b07) * det,\\n (a32 * b02 - a30 * b05 - a33 * b01) * det,\\n (a20 * b05 - a22 * b02 + a23 * b01) * det,\\n (a10 * b10 - a11 * b08 + a13 * b06) * det,\\n (a01 * b08 - a00 * b10 - a03 * b06) * det,\\n (a30 * b04 - a31 * b02 + a33 * b00) * det,\\n (a21 * b02 - a20 * b04 - a23 * b00) * det,\\n (a11 * b07 - a10 * b09 - a12 * b06) * det,\\n (a00 * b09 - a01 * b07 + a02 * b06) * det,\\n (a31 * b01 - a30 * b03 - a32 * b00) * det,\\n (a20 * b03 - a21 * b01 + a22 * b00) * det\\n );\\n return m;\\n #endif\\n}\\nmat4 transpose_matrix(mat4 matrix) {\\n #if __VERSION__ == 300\\n return transpose(matrix);\\n #else\\n vec4 vector1 = matrix[0], vector2 = matrix[1], vector3 = matrix[2], vector4 = matrix[3];\\n float a01 = vector1.y, a02 = vector1.z, a03 = vector1.w;\\n float a12 = vector2.z, a13 = vector2.w;\\n float a23 = vector3.w;\\n mat4 m = mat4(\\n vector1.x,\\n vector2.x,\\n vector3.x,\\n vector4.x,\\n a01,\\n vector2.y,\\n vector3.y,\\n vector4.y,\\n a02,\\n a12,\\n vector3.z,\\n vector4.z,\\n a03,\\n a13,\\n a23,\\n vector4.w\\n );\\n return m;\\n #endif\\n}\",\n get_output: \"#include \\n#include \\n#ifdef HAS_INSTANCE\\n #include \\n #ifdef HAS_INSTANCE_COLOR\\n varying vec4 vInstanceColor;\\n #endif\\n#endif\\n#ifdef HAS_SKIN\\n uniform int skinAnimation;\\n #include \\n#endif\\n#include \\n#ifdef HAS_MORPH\\n attribute vec3 POSITION0;\\n attribute vec3 POSITION1;\\n attribute vec3 POSITION2;\\n attribute vec3 POSITION3;\\n attribute vec3 POSITION4;\\n attribute vec3 POSITION5;\\n attribute vec3 POSITION6;\\n attribute vec3 POSITION7;\\n #ifdef HAS_MORPHNORMALS\\n attribute vec3 NORMAL0;\\n attribute vec3 NORMAL1;\\n attribute vec3 NORMAL2;\\n attribute vec3 NORMAL3;\\n #endif\\n uniform vec4 morphWeights1;\\n uniform vec4 morphWeights2;\\n#endif\\n#ifdef HAS_TERRAIN_ALTITUDE\\nattribute float aTerrainAltitude;\\n#endif\\nmat4 getPositionMatrix() {\\n mat4 worldMatrix;\\n #ifdef HAS_INSTANCE\\n #ifdef HAS_INSTANCE_COLOR\\n vInstanceColor = instance_getInstanceColor();\\n #endif\\n mat4 attributeMatrix = instance_getAttributeMatrix();\\n #ifdef HAS_SKIN\\n if (skinAnimation == 1) {\\n worldMatrix = attributeMatrix * positionMatrix * skin_getSkinMatrix();\\n } else {\\n worldMatrix = attributeMatrix * positionMatrix;\\n }\\n #else\\n worldMatrix = attributeMatrix * positionMatrix;\\n #endif\\n #else\\n #ifdef HAS_SKIN\\n if (skinAnimation == 1) {\\n worldMatrix = skin_getSkinMatrix() * positionMatrix;\\n } else {\\n worldMatrix = positionMatrix;\\n }\\n #else\\n worldMatrix = positionMatrix;\\n #endif\\n #endif\\n return worldMatrix;\\n}\\n#ifdef HAS_MIN_ALTITUDE\\nuniform float minAltitude;\\n#endif\\nvec4 getPosition(vec3 aPosition) {\\n vec3 position = decode_getPosition(aPosition);\\n #ifdef HAS_MORPH\\n vec4 POSITION = vec4(position + morphWeights1[0] * POSITION0 + morphWeights1[1] * POSITION1 + morphWeights1[2] * POSITION2 + morphWeights1[3] * POSITION3\\n + morphWeights2[0] * POSITION4 + morphWeights2[1] * POSITION5 + morphWeights2[2] * POSITION6 + morphWeights2[3] * POSITION7\\n , 1.0);\\n #else\\n vec4 POSITION = vec4(position, 1.0);\\n #endif\\n #ifdef HAS_TERRAIN_ALTITUDE\\n POSITION.z += aTerrainAltitude * 100.0;\\n #endif\\n #ifdef HAS_MIN_ALTITUDE\\n POSITION.z += minAltitude * 100.0;\\n #endif\\n return POSITION;\\n}\\nvec3 appendMorphNormal(vec3 NORMAL) {\\n #ifdef HAS_MORPHNORMALS\\n vec3 normal = NORMAL + morphWeights1[0] * NORMAL0 + morphWeights1[1] * NORMAL1 + morphWeights1[2] * NORMAL2 + morphWeights1[3] * NORMAL3;\\n #else\\n vec3 normal = NORMAL;\\n #endif\\n return normal;\\n}\",\n instance_vert: \"attribute vec4 instance_vectorA;\\nattribute vec4 instance_vectorB;\\nattribute vec4 instance_vectorC;\\n#ifdef HAS_INSTANCE_TERRAIN_ALTITUDE\\nattribute float aTerrainAltitude;\\nuniform float terrainAltitudeScale;\\n#endif\\nmat4 instance_getAttributeMatrix() {\\n mat4 mat = mat4(\\n instance_vectorA.x, instance_vectorB.x, instance_vectorC.x, 0.0,\\n instance_vectorA.y, instance_vectorB.y, instance_vectorC.y, 0.0,\\n instance_vectorA.z, instance_vectorB.z, instance_vectorC.z, 0.0,\\n instance_vectorA.w, instance_vectorB.w, instance_vectorC.w, 1.0\\n );\\n #ifdef HAS_INSTANCE_TERRAIN_ALTITUDE\\n mat4 terrainMat = mat4(\\n 1., 0., 0., 0.,\\n 0., 1., 0., 0.,\\n 0., 0., 1., 0.,\\n 0., 0., aTerrainAltitude * terrainAltitudeScale, 1.\\n );\\n mat = terrainMat * mat;\\n #endif\\n return mat;\\n}\\n#ifdef HAS_INSTANCE_HIGHLIGHT\\n attribute vec4 highlight_color;\\n#endif\\n#ifdef HAS_INSTANCE_COLOR\\n \\n attribute vec4 instance_color;\\n vec4 instance_getInstanceColor() {\\n vec4 color = instance_color;\\n #ifdef HAS_INSTANCE_HIGHLIGHT\\n color = instance_color * highlight_color;\\n #endif\\n return color;\\n }\\n#endif\",\n skin_vert: \"attribute vec4 WEIGHTS_0;\\nattribute vec4 JOINTS_0;\\nuniform sampler2D jointTexture;\\nuniform vec2 jointTextureSize;\\nuniform float numJoints;\\n#define ROW0_U ((0.5 + 0.0) / 4.)\\n#define ROW1_U ((0.5 + 1.0) / 4.)\\n#define ROW2_U ((0.5 + 2.0) / 4.)\\n#define ROW3_U ((0.5 + 3.0) / 4.)\\nmat4 skin_getBoneMatrix(float jointNdx) {\\n float v = (jointNdx + 0.5) / numJoints;\\n return mat4(\\n texture2D(jointTexture, vec2(ROW0_U, v)),\\n texture2D(jointTexture, vec2(ROW1_U, v)),\\n texture2D(jointTexture, vec2(ROW2_U, v)),\\n texture2D(jointTexture, vec2(ROW3_U, v)));\\n}\\nmat4 skin_getSkinMatrix() {\\n mat4 skinMatrix = skin_getBoneMatrix(JOINTS_0[0]) * WEIGHTS_0[0] +\\n skin_getBoneMatrix(JOINTS_0[1]) * WEIGHTS_0[1] +\\n skin_getBoneMatrix(JOINTS_0[2]) * WEIGHTS_0[2] +\\n skin_getBoneMatrix(JOINTS_0[3]) * WEIGHTS_0[3];\\n return skinMatrix;\\n}\",\n heatmap_render_vert: \"#ifdef HAS_HEATMAP\\nvarying vec2 heatmap_vTexCoord;\\nvoid heatmap_compute(mat4 matrix, vec3 position) {\\n vec4 pos = matrix * vec4(position.xy, 0., 1.);\\n heatmap_vTexCoord = (1. + pos.xy / pos.w) / 2.;\\n}\\n#endif\",\n heatmap_render_frag: \"#ifdef HAS_HEATMAP\\nuniform sampler2D heatmap_inputTexture;\\nuniform sampler2D heatmap_colorRamp;\\nuniform float heatmap_heatmapOpacity;\\nvarying vec2 heatmap_vTexCoord;\\nvec4 heatmap_getColor(vec4 color) {\\n float t = texture2D(heatmap_inputTexture, heatmap_vTexCoord).r;\\n vec4 heatmapColor = texture2D(heatmap_colorRamp, vec2(t, 0.5)) * heatmap_heatmapOpacity;\\n return color * (1.0 - heatmapColor.a) + heatmapColor * heatmapColor.a;\\n}\\n#endif\",\n line_extrusion_vert: \"#ifdef IS_LINE_EXTRUSION\\n #define ALTITUDE_SCALE 32767.0;\\n #define EXTRUDE_SCALE 63.0;\\n attribute vec2 aExtrude;\\n #ifdef HAS_LINE_WIDTH\\n attribute float aLineWidth;\\n #else\\n uniform float lineWidth;\\n #endif\\n #ifdef HAS_LINE_HEIGHT\\n attribute float aLineHeight;\\n #else\\n uniform float lineHeight;\\n #endif\\n uniform float linePixelScale;\\n vec3 getLineExtrudePosition(vec3 position) {\\n #ifdef HAS_LINE_WIDTH\\n float lineWidth = aLineWidth / 2.0;\\n #endif\\n #ifdef HAS_LINE_HEIGHT\\n float lineHeight = aLineHeight / 10.0;\\n #endif\\n float halfwidth = lineWidth / 2.0;\\n float outset = halfwidth;\\n vec2 dist = outset * aExtrude / EXTRUDE_SCALE;\\n position.z *= lineHeight / ALTITUDE_SCALE;\\n return position + vec3(dist, 0.0) * linePixelScale;\\n }\\n#endif\",\n gl2_vert: \"#if __VERSION__ == 300\\n #define texture2D texture\\n #define varying out\\n #define attribute in\\n#endif\",\n gl2_frag: \"#if __VERSION__ == 300\\n #define varying in\\n #define gl_FragDepthEXT gl_FragDepth\\n #define texture2D texture\\n #define textureCube texture\\n #define texture2DProj textureProj\\n #define texture2DLodEXT textureLod\\n #define texture2DProjLodEXT textureProjLod\\n #define textureCubeLodEXT textureLod\\n #define texture2DGradEXT textureGrad\\n #define texture2DProjGradEXT textureProjGrad\\n #define textureCubeGradEXT textureGrad\\n #define texture2D texture\\n out vec4 glFragColor;\\n#else\\n vec4 glFragColor;\\n#endif\",\n hsv_frag: \"\\nconst mediump vec4 HSV_K0 = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\\nconst mediump vec4 HSV_K1 = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\\nconst mediump float HSV_E = 1.0e-10;\\nvec3 hsv_rgb2hsv(vec3 c) {\\n vec4 K = HSV_K0;\\n vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\\n vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\\n float d = q.x - min(q.w, q.y);\\n float e = HSV_E;\\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\\n}\\nvec3 hsv_hsv2rgb(vec3 c) {\\n vec4 K = HSV_K1;\\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\\n}\\nvec4 hsv_apply(vec4 c, vec3 hsvOffset) {\\n vec3 hsv = hsv_rgb2hsv(c.rgb);\\n hsv += hsv * hsvOffset;\\n hsv = clamp(hsv, 0.0, 1.0);\\n return vec4(hsv_hsv2rgb(hsv), c.a);\\n}\\nvec3 hsv_apply(vec3 c, vec3 hsvOffset) {\\n vec3 hsv = hsv_rgb2hsv(c.rgb);\\n hsv += hsv * hsvOffset;\\n hsv = clamp(hsv, 0.0, 1.0);\\n return hsv_hsv2rgb(hsv);\\n}\\nmat4 contrastMatrix(float contrast)\\n{\\n float t = (1.0 - contrast) / 2.0;\\n return mat4(\\n contrast, 0., 0., 0.,\\n 0., contrast, 0., 0.,\\n 0., 0., contrast, 0.,\\n t, t, t, 1\\n );\\n}\",\n snow_frag: \"#ifdef HAS_SNOW\\n float lerp(float a, float b, float w) {\\n return a + w * (b - a);\\n }\\n vec3 snow(vec4 sceneColor, vec3 normalColor, float height) {\\n float snowIntense = normalColor.b;\\n vec3 fixedC = vec3(1.0, 1.0, 1.0);\\n if (height < 1.0) {\\n float r = lerp(0.5, fixedC.x, snowIntense);\\n float g = lerp(0.5, fixedC.y, snowIntense);\\n float b = lerp(0.5, fixedC.z, snowIntense);\\n return vec3(r, g, b);\\n } else {\\n float r = lerp(sceneColor.r, fixedC.x, snowIntense);\\n float g = lerp(sceneColor.g, fixedC.y, snowIntense);\\n float b = lerp(sceneColor.b, fixedC.z, snowIntense);\\n return vec3(r, g, b);\\n }\\n }\\n#endif\",\n draco_decode_vert: \"#if defined(HAS_TANGENT)\\n attribute vec4 aTangent;\\n#elif defined(HAS_NORMAL)\\n #ifdef HAS_DRACO_NORMAL\\n attribute vec2 aNormal;\\n uniform float gltf_u_dec_normal_rangeConstant;\\n #else\\n attribute vec3 aNormal;\\n #endif\\n#endif\\n#ifdef HAS_DRACO_POSITION\\n uniform float gltf_u_dec_position_normConstant;\\n uniform vec3 minValues_pos;\\n vec3 decodeDracoPosition(vec3 aPosition) {\\n return minValues_pos + aPosition * gltf_u_dec_position_normConstant;\\n }\\n#endif\\n#ifdef HAS_DRACO_TEXCOORD\\n uniform vec2 minValues_tex;\\n uniform float gltf_u_dec_texcoord_0_normConstant;\\n vec2 decodeDracoTexcoord(vec2 aTexCoord) {\\n return minValues_tex + aTexCoord * gltf_u_dec_texcoord_0_normConstant;\\n }\\n#endif\\n#ifdef HAS_WEB3D_quantized_attributes_TEXCOORD\\n uniform mat3 decodeMatrix;\\n#endif\\n#ifdef HAS_DRACO_NORMAL\\n float czm_signNotZero(float value) {\\n return value >= 0.0 ? 1.0 : -1.0;\\n }\\n vec2 czm_signNotZero(vec2 value) {\\n return vec2(czm_signNotZero(value.x), czm_signNotZero(value.y));\\n }\\n vec3 decodeDracoNormal(vec2 encoded, float range)\\n {\\n if (encoded.x == 0.0 && encoded.y == 0.0) {\\n return vec3(0.0, 0.0, 0.0);\\n }\\n encoded = encoded / range * 2.0 - 1.0;\\n vec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));\\n if (v.z < 0.0) {\\n v.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy);\\n }\\n return normalize(v);\\n }\\n vec3 decode_getNormal(vec2 aNormal) {\\n return decodeDracoNormal(aNormal, gltf_u_dec_normal_rangeConstant).zxy;\\n }\\n#endif\\n#ifdef HAS_COMPRESSED_INT16\\n #ifdef HAS_COMPRESSED_INT16_POSITION\\n uniform vec2 compressedPositionRange;\\n #endif\\n #ifdef HAS_COMPRESSED_INT16_TEXCOORD_0\\n uniform vec2 compressedTexcoordRange_0;\\n #endif\\n #ifdef HAS_COMPRESSED_INT16_TEXCOORD_1\\n uniform vec2 compressedTexcoordRange_1;\\n #endif\\n #ifdef HAS_COMPRESSED_INT16_NORMAL\\n uniform vec2 compressedNormalRange;\\n #endif\\n #ifdef HAS_COMPRESSED_INT16_RATIO\\n uniform float compressed_ratio;\\n #endif\\n float int16ToFloat32(float value, vec2 range) {\\n float v = (value >= 32768.0) ? -(65536.0 - value) / 32768.0 : value / 32767.0;\\n return (v + 1.0) * (range.y - range.x) / 2.0 + range.x;\\n }\\n#endif\\nvec3 decode_getPosition(vec3 aPosition) {\\n vec3 position = aPosition;\\n #if defined(HAS_COMPRESSED_INT16) && defined(HAS_COMPRESSED_INT16_POSITION)\\n float x = int16ToFloat32(aPosition.x, compressedPositionRange);\\n float y = int16ToFloat32(aPosition.y, compressedPositionRange);\\n float z = int16ToFloat32(aPosition.z, compressedPositionRange);\\n #ifdef HAS_COMPRESSED_INT16_RATIO\\n position = vec3(x / compressed_ratio, y / compressed_ratio, z);\\n #else\\n position = vec3(x, y, z);\\n #endif\\n #endif\\n #ifdef HAS_DRACO_POSITION\\n return decodeDracoPosition(position);\\n #else\\n return position;\\n #endif\\n}\\nvec2 decode_getTexcoord(vec2 aTexCoord) {\\n vec2 texcoord = aTexCoord;\\n #if defined(HAS_COMPRESSED_INT16) && (defined(HAS_COMPRESSED_INT16_TEXCOORD_0) || defined(HAS_COMPRESSED_INT16_TEXCOORD_1))\\n float x = int16ToFloat32(aTexCoord.x, compressedTexcoordRange_0);\\n float y = int16ToFloat32(aTexCoord.y, compressedTexcoordRange_0);\\n texcoord = vec2(x, y);\\n #endif\\n #ifdef HAS_DRACO_TEXCOORD\\n return decodeDracoTexcoord(texcoord);\\n #elif defined(HAS_WEB3D_quantized_attributes_TEXCOORD)\\n vec3 web3dTexcoord = decodeMatrix * vec3(texcoord, 1.0);\\n return vec2(web3dTexcoord.x, web3dTexcoord.y);\\n #else\\n return texcoord;\\n #endif\\n}\\nvec3 decode_getNormal(vec3 aNormal) {\\n #ifdef HAS_COMPRESSED_INT16_NORMAL\\n aNormal.x = int16ToFloat32(aNormal.x, compressedNormalRange);\\n aNormal.y = int16ToFloat32(aNormal.y, compressedNormalRange);\\n aNormal.z = int16ToFloat32(aNormal.z, compressedNormalRange);\\n #endif\\n return aNormal;\\n}\",\n highlight_vert: \"#if defined(HAS_HIGHLIGHT_COLOR)\\n attribute vec4 aHighlightColor;\\n varying vec4 vHighlightColor;\\n#endif\\n#if defined(HAS_HIGHLIGHT_OPACITY)\\n attribute float aHighlightOpacity;\\n varying float vHighlightOpacity;\\n#endif\\nvoid highlight_setVarying() {\\n #if defined(HAS_HIGHLIGHT_COLOR)\\n vHighlightColor = aHighlightColor / 255.0;\\n #endif\\n #if defined(HAS_HIGHLIGHT_OPACITY)\\n vHighlightOpacity = aHighlightOpacity / 255.0;\\n #endif\\n}\",\n highlight_frag: \"#if defined(HAS_HIGHLIGHT_COLOR)\\n\\tvarying vec4 vHighlightColor;\\n#endif\\n#if defined(HAS_HIGHLIGHT_OPACITY)\\n varying float vHighlightOpacity;\\n#endif\\nvec4 highlight_blendColor(vec4 color) {\\n\\tvec4 outColor;\\n\\t#if defined(HAS_HIGHLIGHT_COLOR)\\n\\t\\tcolor.rgb = color.rgb * (1.0 - vHighlightColor.a) + vHighlightColor.rgb * vHighlightColor.a;\\n\\t\\t#ifndef HAS_HIGHLIGHT_COLOR_POINT\\n \\tcolor.a = color.a * (1.0 - vHighlightColor.a) + vHighlightColor.a;\\n #endif\\n outColor = color;\\n\\t#else\\n\\t\\toutColor = color;\\n\\t#endif\\n\\t#if defined(HAS_HIGHLIGHT_OPACITY)\\n\\t\\toutColor *= vHighlightOpacity;\\n\\t#endif\\n\\treturn outColor;\\n}\",\n mask_vert: \"#ifdef HAS_MASK_EXTENT\\n uniform vec4 mask_extent;\\n uniform sampler2D mask_colorExtent;\\n uniform sampler2D mask_modeExtent;\\n uniform float mask_maskMode;\\n uniform float mask_hasFlatOut;\\n uniform mat4 viewMatrix;\\n uniform float mask_heightRatio;\\n uniform float mask_heightOffset;\\n varying vec4 vWorldPosition;\\n varying vec2 vUVInExtent;\\n varying float vHeightRatio;\\n varying float vHeightOffset;\\n const float CLIPINSIDE_MODE = 0.2;\\n const float FLATINSIDE_MODE = 0.3;\\n const float FLATOUTSIDE_MODE = 0.4;\\n const float ELEVATE_MODE = 0.7;\\n float random (vec2 st) {\\n return fract(sin(dot(st.xy,vec2(12.9898,78.233)))*43758.5453123) * 0.1;\\n }\\n bool isInExtent(vec4 color) {\\n return length(color.rgb) > 0.0;\\n }\\n float getFlatHeight(float maskMode, float flatHeight, float height) {\\n if (maskMode <= ELEVATE_MODE && maskMode > 0.6) {\\n return flatHeight + height;\\n } else {\\n return flatHeight;\\n }\\n }\\n vec4 getNoErrorPosition(vec4 position, vec4 wPosition) {\\n vec4 realPos = modelViewMatrix * position; vec4 pos = viewMatrix * wPosition; vec4 tempPos = viewMatrix * modelMatrix * position; float deltaX = realPos.x - tempPos.x;\\n float deltaY = realPos.y - tempPos.y;\\n float deltaZ = realPos.z - tempPos.z;\\n pos.x = pos.x + deltaX;\\n pos.y = pos.y + deltaY;\\n pos.z = pos.z + deltaZ;\\n return pos;\\n }\\n vec4 getMaskPosition(vec4 position, mat4 modelMatrix) {\\n vWorldPosition = modelMatrix * position;\\n float w = mask_extent.z - mask_extent.x;\\n float h = mask_extent.y - mask_extent.w;\\n vec2 uvInExtent = vec2((vWorldPosition.x - mask_extent.x) / abs(w), 1.0 - (vWorldPosition.y - mask_extent.w) / h);\\n vec4 extentColor = texture2D(mask_colorExtent, uvInExtent);\\n vec3 maskOptionColor = texture2D(mask_modeExtent, uvInExtent).rgb;\\n float maskMode = maskOptionColor.r;\\n float flatHeight = maskOptionColor.g / mask_heightRatio + mask_heightOffset;\\n float height = getFlatHeight(maskMode, flatHeight, vWorldPosition.z);\\n vec4 wPosition = vec4(vWorldPosition.x, vWorldPosition.y, height, vWorldPosition.w);\\n vUVInExtent = uvInExtent;\\n vHeightRatio = mask_heightRatio;\\n vHeightOffset = mask_heightOffset;\\n if (maskMode <= FLATOUTSIDE_MODE && maskMode > FLATINSIDE_MODE) {\\n return modelViewMatrix * position;;\\n } else if (mask_hasFlatOut == 1.0) {\\n return getNoErrorPosition(position, wPosition);\\n }\\n if (isInExtent(extentColor) == true && maskMode <= FLATINSIDE_MODE && maskMode > CLIPINSIDE_MODE) {\\n return getNoErrorPosition(position, wPosition);\\n } if (isInExtent(extentColor) == true && maskMode <= ELEVATE_MODE && maskMode > 0.6) {\\n return getNoErrorPosition(position, wPosition);\\n } else {\\n return modelViewMatrix * position;\\n }\\n }\\n#endif\",\n mask_frag: \"#ifdef HAS_MASK_EXTENT\\n uniform sampler2D mask_colorExtent;\\n uniform sampler2D mask_modeExtent;\\n uniform float mask_hasClipOut;\\n varying float vHeightRatio;\\n varying float vHeightOffset;\\n varying vec2 vUVInExtent;\\n varying vec4 vWorldPosition;\\n const float CLIPINSIDE_MODE = 0.1;\\n const float CLIPOUTSIDE_MODE = 0.2;\\n const float FLATINSIDE_MODE = 0.3;\\n const float FLATOUTSIDE_MODE = 0.4;\\n const float COLOR_MODE = 0.5;\\n const float VIDEO_MODE = 0.6;\\n bool isInExtent(vec4 color) {\\n return length(color.rgb) > 0.0;\\n }\\n vec4 setMask(vec4 glFragColor) {\\n vec4 extentColor = texture2D(mask_colorExtent, vUVInExtent);\\n vec4 modeColor = texture2D(mask_modeExtent, vUVInExtent);\\n float maskMode = modeColor.r;\\n float minHeight = modeColor.b / vHeightRatio + vHeightOffset;\\n float maxHeight = modeColor.a / vHeightRatio + vHeightOffset;\\n if (maskMode > CLIPINSIDE_MODE && maskMode <= CLIPOUTSIDE_MODE) {\\n if (minHeight == 0.0 && maxHeight == 0.0) {\\n return glFragColor;\\n } else if (vWorldPosition.z >= minHeight && vWorldPosition.z <= maxHeight) {\\n return glFragColor;\\n } else {\\n discard;\\n }\\n } else if (mask_hasClipOut == 1.0) {\\n discard;\\n }\\n if (isInExtent(extentColor) == true && maskMode <= CLIPINSIDE_MODE && maskMode > 0.0) {\\n if (minHeight == 0.0 && maxHeight == 0.0) {\\n discard;\\n } else if (vWorldPosition.z >= minHeight && vWorldPosition.z <= maxHeight) {\\n discard;\\n } else {\\n return glFragColor;\\n }\\n } else if (isInExtent(extentColor) == true && maskMode <= VIDEO_MODE && maskMode > FLATOUTSIDE_MODE) {\\n if (minHeight == 0.0 && maxHeight == 0.0) {\\n glFragColor = vec4(mix(extentColor.rgb, glFragColor.rgb, 1.0 - extentColor.a), glFragColor.a);\\n } else if (vWorldPosition.z >= minHeight && vWorldPosition.z <= maxHeight) {\\n glFragColor = vec4(mix(extentColor.rgb, glFragColor.rgb, 1.0 - extentColor.a), glFragColor.a);\\n }\\n }\\n return glFragColor;\\n }\\n#endif\",\n computeTexcoord_frag: \"#ifdef HAS_KHR_TEXTURE_TRANSFORM\\n uniform vec2 khr_offset;\\n uniform float khr_rotation;\\n uniform vec2 khr_scale;\\n vec2 khr_tex_transformTexCoord(vec2 texCoords, vec2 offset, float rotation, vec2 scale) {\\n rotation = -rotation;\\n mat3 transform = mat3(\\n cos(rotation) * scale.x, sin(rotation) * scale.x, 0.0, -sin(rotation) * scale.y, cos(rotation) * scale.y, 0.0, offset.x, offset.y, 1.0);\\n vec2 transformedTexCoords = (transform * vec3(fract(texCoords), 1.0)).xy;\\n return transformedTexCoords;\\n }\\n#endif\\nvarying highp vec2 vTexCoord;\\n#ifdef HAS_I3S_UVREGION\\n varying vec4 vUvRegion;\\n#endif\\nvec2 computeTexCoord(vec2 texCoord) {\\n #ifdef HAS_I3S_UVREGION\\n vec2 atlasScale = vUvRegion.zw - vUvRegion.xy;\\n vec2 uvAtlas = fract(texCoord) * atlasScale + vUvRegion.xy;\\n return uvAtlas;\\n #elif defined(HAS_KHR_TEXTURE_TRANSFORM)\\n return khr_tex_transformTexCoord(texCoord, khr_offset, khr_rotation, khr_scale);\\n #else\\n return texCoord;\\n #endif\\n}\",\n terrain_normal_frag: \"#ifdef HAS_TERRAIN_NORMAL\\n uniform sampler2D terrainHeightTexture;\\n uniform vec2 terrainHeightMapResolution;\\n uniform vec2 terrainResolution;\\n uniform float terrainHeightScale;\\n uniform float terrainTileResolution;\\n uniform vec4 terrainUnpackFactors;\\n float getHeight(vec2 uv) {\\n vec4 color = texture2D(terrainHeightTexture, uv) * 255.0;\\n color.a = -1.0;\\n return dot(color, terrainUnpackFactors) / 4.0;\\n }\\n vec3 convertTerrainHeightToNormalMap(vec2 uv) {\\n uv.y = 1.0 - uv.y;\\n vec2 epsilon = 1.0 / terrainHeightMapResolution;\\n float a = getHeight(uv + vec2(-epsilon.x, -epsilon.y));\\n float b = getHeight(uv + vec2(0, -epsilon.y));\\n float c = getHeight(uv + vec2(epsilon.x, -epsilon.y));\\n float d = getHeight(uv + vec2(-epsilon.x, 0));\\n float e = getHeight(uv + vec2(epsilon.x, 0));\\n float f = getHeight(uv + vec2(-epsilon.x, epsilon.y));\\n float g = getHeight(uv + vec2(0, epsilon.y));\\n float h = getHeight(uv + vec2(epsilon.x, epsilon.y));\\n vec2 dxy = vec2(\\n (c + e + e + h) - (a + d + d + f),\\n (f + g + g + h) - (a + b + b + c)\\n );\\n return normalize(vec3(dxy / epsilon, terrainResolution ));\\n }\\n#endif\",\n vertex_color_vert: \"#ifdef HAS_VERTEX_COLOR\\nattribute float aVertexColorType;\\nuniform vec4 vertexColorsOfType[VERTEX_TYPES_COUNT];\\nvarying vec4 vertexColor_color;\\nvoid vertexColor_update() {\\n vertexColor_color = vertexColorsOfType[int(aVertexColorType)];\\n}\\n#endif\\n//用于识别顶点颜色类型: topPolygonFill 还是 bottomPolygonFill\",\n vertex_color_frag: \"#ifdef HAS_VERTEX_COLOR\\nvarying vec4 vertexColor_color;\\nvec4 vertexColor_get() {\\n\\treturn vertexColor_color;\\n}\\n#endif\",\n excavate_vert: \"#ifdef HAS_EXCAVATE_ANALYSIS\\n uniform vec4 excavateExtent;\\n varying vec2 vCoordinateTexcoord;\\n varying float vHeight;\\n float getWorldHeight() {\\n vec4 wPosition = modelMatrix * getPosition(aPosition);\\n return wPosition.z;\\n }\\n vec2 getCoordinateTexcoord() {\\n mat4 localPositionMatrix = getPositionMatrix();\\n vec4 wPosition = modelMatrix * localPositionMatrix * getPosition(aPosition);\\n float x = (wPosition.x - excavateExtent.x) / (excavateExtent.z - excavateExtent.x);\\n float y = (wPosition.y - excavateExtent.y) / (excavateExtent.w - excavateExtent.y);\\n return vec2(x, y);\\n }\\n#endif\",\n excavate_frag: \"#ifdef HAS_EXCAVATE_ANALYSIS\\n uniform sampler2D heightmap;\\n uniform float excavateHeight;\\n varying vec2 vCoordinateTexcoord;\\n varying float vHeight;\\n const vec2 range = vec2(-100.0, 1000.0);\\n float decodeHeight(const in vec4 pack) {\\n return pack.r + pack.g / 255.0;\\n }\\n vec4 excavateColor(vec4 fragColor) {\\n float samplerHeight = decodeHeight(texture2D(heightmap, vCoordinateTexcoord));\\n float realHeight = samplerHeight * (range.y - range.x) + range.x;\\n if(realHeight < range.x || realHeight > range.y) {\\n realHeight = 0.0;\\n }\\n if(vHeight > realHeight) {\\n discard;\\n }\\n return fragColor;\\n }\\n#endif\",\n srgb_frag: \"vec3 linearTosRGB(const in vec3 color) {\\n return vec3( color.r < 0.0031308 ? color.r * 12.92 : 1.055 * pow(color.r, 1.0/2.4) - 0.055, color.g < 0.0031308 ? color.g * 12.92 : 1.055 * pow(color.g, 1.0/2.4) - 0.055, color.b < 0.0031308 ? color.b * 12.92 : 1.055 * pow(color.b, 1.0/2.4) - 0.055);\\n}\\nvec3 sRGBToLinear(const in vec3 color) {\\n return vec3( color.r < 0.04045 ? color.r * (1.0 / 12.92) : pow((color.r + 0.055) * (1.0 / 1.055), 2.4), color.g < 0.04045 ? color.g * (1.0 / 12.92) : pow((color.g + 0.055) * (1.0 / 1.055), 2.4), color.b < 0.04045 ? color.b * (1.0 / 12.92) : pow((color.b + 0.055) * (1.0 / 1.055), 2.4));\\n}\" };\n\n var dt = exports.ShaderLib = {\n register: function register(e, t) {\n if (ft[e]) throw new Error(\"Key of \".concat(e, \" is already registered in ShaderLib.\"));\n ft[e] = t;\n },\n compile: function compile(e) {\n return ht(e);\n } };\n\n var ut = /^[ \\t]*#include +<([\\w\\d.]+)>/gm;\n function ht(e) {\n return e.replace(ut, mt);\n }\n function mt(e, t) {\n var n = ft[t];\n if (!n) throw new Error(\"Can not resolve #include <\" + t + \">\");\n return ht(n);\n }\n var vt = \"function\",\n _t = \"array\";\n var gt = 0;\n var xt = {};\n var pt = exports.Shader = function () {\n function pt(_ref2) {\n var e = _ref2.vert,\n t = _ref2.frag,\n n = _ref2.uniforms,\n r = _ref2.defines,\n i = _ref2.extraCommandProps;\n _classCallCheck(this, pt);\n this.vert = e, this.frag = t;\n var o = gt++;\n Object.defineProperty(this, \"uid\", {\n enumerable: !0,\n configurable: !1,\n get: function get() {\n return o;\n } }),\n this.shaderDefines = r && v({}, r) || {}, n = this.uniforms = (n || []).slice(), this.contextDesc = {};\n for (var _e56 = 0, _t44 = n.length; _e56 < _t44; _e56++) {\n var _t45 = n[_e56];\n if (d(_t45)) {\n if (_t45.indexOf(\"[\") > 0) {\n var _bt = bt(_t45),\n _e57 = _bt.name,\n _n29 = _bt.len;\n this.contextDesc[_e57] = {\n name: _e57,\n type: \"array\",\n length: _n29 };\n\n } else this.contextDesc[_t45] = null;\n } else if (_t45.name.indexOf(\"[\") > 0) {\n var _bt2 = bt(_t45.name),\n _e58 = _bt2.name,\n _n30 = _bt2.len;\n this.contextDesc[_e58] = {\n name: _e58,\n type: \"array\",\n length: _n30,\n fn: _t45.fn };\n\n } else this.contextDesc[_t45.name] = _t45;\n }\n this.extraCommandProps = i && v({}, i) || {}, this.commands = {}, this._compileSource();\n }\n return _createClass(pt, [{\n key: \"shaderDefines\",\n get: function get() {\n return this._shaderDefines || {};\n },\n set: function set(e) {\n this._shaderDefines = e, this.dkey = Object.keys(this._shaderDefines).join();\n } },\n {\n key: \"setDefines\",\n value: function setDefines(e) {\n this.shaderDefines = e;\n } },\n {\n key: \"setFramebuffer\",\n value: function setFramebuffer(e) {\n return this.context.framebuffer = e, this;\n } },\n {\n key: \"appendDescUniforms\",\n value: function appendDescUniforms(e, t) {\n var n = t,\n r = this.contextDesc;\n var _loop4 = function _loop4(_i19) {\n if (r[_i19]) if (\"array\" === r[_i19].type) {\n var _o10 = _i19,\n _a11 = r[_i19].length;\n var _s7 = t[_i19];\n if (r[_i19].fn && (_s7 = r[_i19].fn(null, t)), !_s7) return 1;\n if (_s7.length !== _a11) throw new Error(\"\".concat(_o10, \" uniform's length is not \").concat(_a11));\n n[_o10] = n[_o10] || {};\n for (var _t46 = 0; _t46 < _a11; _t46++) n[_o10][\"\".concat(_t46)] = _s7[_t46].getREGLTexture ? _s7[_t46].getREGLTexture(e) : _s7[_t46];\n } else \"function\" === r[_i19].type && (Object.getOwnPropertyDescriptor(n, _i19) || Object.defineProperty(n, _i19, {\n configurable: !1,\n enumerable: !0,\n get: function get() {\n return r[_i19].fn(null, t);\n } }));\n\n };\n for (var _i19 in r) {\n if (_loop4(_i19)) continue;\n }\n return n;\n } },\n {\n key: \"setUniforms\",\n value: function setUniforms(e) {\n if (e.modelMatrix || e.positionMatrix) throw new Error(\"modelMatrix or positionMatrix is reserved uniform name for Mesh, please change to another name\");\n return this.contextKeys = e ? Object.keys(e).join() : null, this.context = e, this;\n } },\n {\n key: \"getVersion\",\n value: function getVersion(e, t) {\n if (\"#version\" === t.substring(0, 8)) return \"\";\n return 0 === e.limits.version.indexOf(\"WebGL 2.0\") && 300 === this.version ? \"#version 300 es\\n\" : \"#version 100\\n\";\n } },\n {\n key: \"getActiveVars\",\n value: function getActiveVars(e, t, n, r) {\n var i = r;\n if (xt[i]) return xt[i];\n var o = e._gl,\n a = o.createProgram(),\n s = o.createShader(35633);\n o.shaderSource(s, t), o.compileShader(s);\n var c = o.createShader(35632);\n o.shaderSource(c, n), o.compileShader(c), o.attachShader(a, c), o.attachShader(a, s), o.linkProgram(a);\n var l = o.getProgramParameter(a, 35721),\n f = [];\n for (var _e59 = 0; _e59 < l; ++_e59) {\n var _t47 = o.getActiveAttrib(a, _e59);\n _t47 && f.push({\n name: _t47.name,\n type: _t47.type });\n\n }\n var d = o.getProgramParameter(a, 35718),\n u = [];\n for (var _e60 = 0; _e60 < d; ++_e60) {\n var _t48 = o.getActiveUniform(a, _e60);\n var _n31 = _t48.name;\n _t48.name.indexOf(\"[\") > 0 && (_n31 = _n31.replace(\"[0]\", \"\")), u.push(_n31);\n }\n return o.deleteProgram(a), o.deleteShader(s), o.deleteShader(c), xt[i] = {\n activeUniforms: u,\n activeAttributes: f },\n xt[i];\n } },\n {\n key: \"createREGLCommand\",\n value: function createREGLCommand(e, t, n, r, i) {\n var o = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};\n var a = A(e) && !i,\n s = v({}, this.shaderDefines || {}, t || {}),\n c = this._insertDefines(this.vert, s),\n l = this.getVersion(e, c) + c,\n f = this._insertDefines(this.frag, s),\n d = this.getVersion(e, f) + f,\n u = w(l) + \"_\" + w(d),\n _this$getActiveVars = this.getActiveVars(e, l, d, u),\n h = _this$getActiveVars.activeAttributes,\n m = _this$getActiveVars.activeUniforms,\n _ = {};\n h.forEach(function (t, n) {\n var r = t.name;\n _[r] = a ? n : e.prop(r);\n });\n var x = {};\n m.forEach(function (t) {\n x[t] = e.prop(t);\n });\n var p = this.contextDesc;\n for (var _t49 in p) if (p[_t49] && p[_t49].type === vt) x[_t49] = p[_t49].fn;else if (p[_t49] && p[_t49].type === _t) {\n var _n32 = p[_t49].name,\n _r22 = p[_t49].length;\n for (var _t50 = 0; _t50 < _r22; _t50++) {\n var _r23 = \"\".concat(_n32, \"[\").concat(_t50, \"]\");\n x[_r23] = e.prop(_r23);\n }\n } else x[_t49] = e.prop(_t49);\n var b = {\n vert: l,\n frag: d,\n uniforms: x,\n attributes: _ };\n\n a && (b.vao = e.prop(\"vao\")), a && !r || !n || g(n) || (b.elements = e.prop(\"elements\")), b.count = e.prop(\"count\"), b.offset = e.prop(\"offset\"), b.primitive = e.prop(\"primitive\"), b.framebuffer = e.prop(\"framebuffer\"), r && (b.instances = e.prop(\"instances\")), v(b, this.extraCommandProps, o);\n var y = e(b);\n return h.key = h.map(function (e) {\n return e.name;\n }).join(), y.activeAttributes = h, y;\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n for (var _e61 in this.commands) {\n var _t51 = this.commands[_e61];\n _t51 && _t51.destroy && !_t51[L] && (_t51[L] = !0, _t51.destroy());\n }\n this.commands = {}, delete this.vert, delete this.frag;\n } },\n {\n key: \"_insertDefines\",\n value: function _insertDefines(e, t) {\n var n = [];\n for (var _e62 in t) S(t, _e62) && !m(t[_e62]) && n.push(\"#define \".concat(_e62, \" \").concat(t[_e62], \"\\n\"));\n return n.join(\"\") + e;\n } },\n {\n key: \"_compileSource\",\n value: function _compileSource() {\n this.vert = dt.compile(this.vert), this.frag = dt.compile(this.frag);\n } }]);\n\n }();\n function bt(e) {\n var t = e.indexOf(\"[\"),\n n = e.indexOf(\"]\");\n return {\n name: e.substring(0, t),\n len: +e.substring(t + 1, n) };\n\n }\n var yt = exports.MeshShader = function (_pt) {\n function yt() {\n _classCallCheck(this, yt);\n return _callSuper(this, yt, arguments);\n }\n _inherits(yt, _pt);\n return _createClass(yt, [{\n key: \"draw\",\n value: function draw(e, t) {\n if (!t || !t.length) return 0;\n var n = [];\n var r,\n i = 0;\n for (var _o11 = 0, _a12 = t.length; _o11 < _a12; _o11++) {\n if (!t[_o11].isValid()) {\n _o11 === _a12 - 1 && r && n.length && r(n);\n continue;\n }\n if (!t[_o11].geometry.getDrawCount() || !this._runFilter(t[_o11])) {\n _o11 === _a12 - 1 && r && n.length && r(n);\n continue;\n }\n var _s8 = this.getMeshCommand(e, t[_o11]);\n n.length && r !== _s8 && (r(n), n.length = 0);\n var _c7 = t[_o11].getREGLProps(e, _s8.activeAttributes);\n this._ensureContextDefines(_c7), _c7.shaderContext = this.context, this.appendDescUniforms(e, _c7), n.push(_c7), i++, _o11 < _a12 - 1 ? r = _s8 : _o11 === _a12 - 1 && _s8(n);\n }\n return i;\n } },\n {\n key: \"_ensureContextDefines\",\n value: function _ensureContextDefines(e) {\n if (this.context && (e.contextKeys || (e.contextKeys = {}), e.contextKeys[this.uid] !== this.contextKeys)) {\n var _loop5 = function _loop5(_t52) {\n \"framebuffer\" === _t52 || Object.getOwnPropertyDescriptor(e, _t52) || Object.defineProperty(e, _t52, {\n configurable: !1,\n enumerable: !0,\n get: function get() {\n return this.shaderContext[_t52];\n } });\n\n };\n for (var _t52 in this.context) {\n _loop5(_t52);\n }\n Object.getOwnPropertyDescriptor(e, \"framebuffer\") || Object.defineProperty(e, \"framebuffer\", {\n configurable: !1,\n enumerable: !0,\n get: function get() {\n return this.targetFramebuffer || this.shaderContext && this.shaderContext.framebuffer;\n } }),\n e.contextKeys[this.uid] = this.contextKeys;\n }\n } },\n {\n key: \"_runFilter\",\n value: function _runFilter(e) {\n var t = this.filter;\n if (!t) return !0;\n if (Array.isArray(t)) {\n for (var _n33 = 0; _n33 < t.length; _n33++) if (!t[_n33](e)) return !1;\n return !0;\n }\n return t(e);\n } },\n {\n key: \"getMeshCommand\",\n value: function getMeshCommand(e, t) {\n this._cmdKeys || (this._cmdKeys = {});\n var n = this.dkey || \"default\";\n var r = this._cmdKeys[n];\n r || (r = this._cmdKeys[n] = {});\n var i = t.getCommandKey(e);\n r[i] || (r[i] = n + \"_\" + t.getCommandKey(e));\n var o = r[i];\n var a = this.commands[o];\n if (!a) {\n var _n34 = t.getDefines(),\n _r24 = t.getMaterial(),\n _i20 = {};\n if (_r24) {\n _r24.doubleSided && this.extraCommandProps && (_i20.cull = {\n enable: !1 });\n\n }\n a = this.commands[o] = this.createREGLCommand(e, _n34, t.getElements(), t instanceof ze, t.disableVAO, _i20);\n }\n return a;\n } }]);\n\n }(pt);\n var At = exports.WireframeShader = function (_yt) {\n function At() {\n var _this12;\n var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, At);\n var n = t.extraCommandProps || {};\n var r = [];\n n = v({}, n, {\n blend: {\n enable: !0,\n func: {\n src: \"src alpha\",\n dst: \"one minus src alpha\" },\n\n equation: \"add\" },\n\n sample: {\n alpha: !0 } }),\n\n _this12 = _callSuper(this, At, [{\n vert: \"#include \\nattribute vec3 aPosition;\\nattribute vec3 aBarycentric;\\nvarying vec3 vBarycentric;\\nuniform mat4 modelMatrix;\\nuniform mat4 modelViewMatrix;\\nuniform mat4 projMatrix;\\nuniform mat4 positionMatrix;\\nvarying vec3 vPosition;\\n#include \\nvoid main() {\\n mat4 c = getPositionMatrix();\\n vec4 d = getPosition(aPosition);\\n#ifdef HAS_MASK_EXTENT\\ngl_Position = projMatrix * getMaskPosition(c * d, modelMatrix);\\n#else\\ngl_Position = projMatrix * modelViewMatrix * c * d;\\n#endif\\nvBarycentric = aBarycentric;\\n vPosition = aPosition;\\n}\",\n frag: \"#if __VERSION__ == 100\\n#ifdef GL_OES_standard_derivatives\\n#extension GL_OES_standard_derivatives : enable\\n#endif\\n#endif\\nprecision mediump float;\\n#include \\nvarying vec3 vBarycentric;\\nuniform float time;\\nuniform float thickness;\\nuniform float secondThickness;\\nuniform float dashRepeats;\\nuniform float dashLength;\\nuniform bool dashOverlap;\\nuniform bool dashEnabled;\\nuniform bool dashAnimate;\\nuniform bool seeThrough;\\nuniform bool insideAltColor;\\nuniform bool dualStroke;\\nuniform bool squeeze;\\nuniform float squeezeMin;\\nuniform float squeezeMax;\\nuniform vec4 stroke;\\nuniform vec4 fill;\\nuniform float opacity;\\nuniform bool noiseEnable;\\nvarying vec3 vPosition;\\n#ifdef HAS_INSTANCE\\nvarying vec4 vInstanceColor;\\n#endif\\n#include \\n#define F4 0.309016994374947451\\n#define halfDist 0.5\\nvec4 c(vec4 x) {\\n return x - floor(x * (1. / 289.)) * 289.;\\n}\\nfloat c(float x) {\\n return x - floor(x * (1. / 289.)) * 289.;\\n}\\nvec4 d(vec4 x) {\\n return c((x * 34. + 1.) * x);\\n}\\nfloat d(float x) {\\n return c((x * 34. + 1.) * x);\\n}\\nvec4 e(vec4 r) {\\n return 1.79284291400159 - .85373472095314 * r;\\n}\\nfloat e(float r) {\\n return 1.79284291400159 - .85373472095314 * r;\\n}\\nvec4 f(float h, vec4 i) {\\n const vec4 k = vec4(1., 1., 1., -1.);\\n vec4 p, s;\\n p.xyz = floor(fract(vec3(h) * i.xyz) * 7.) * i.z - 1.;\\n p.w = 1.5 - dot(abs(p.xyz), k.xyz);\\n s = vec4(lessThan(p, vec4(.0)));\\n p.xyz = p.xyz + (s.xyz * 2. - 1.) * s.www;\\n return p;\\n}\\nfloat l(vec4 m) {\\n const vec4 n = vec4(.138196601125011, .276393202250021, .414589803375032, -.447213595499958);\\n vec4 o = floor(m + dot(m, vec4(F4)));\\n vec4 u = m - o + dot(o, n.xxxx);\\n vec4 A;\\n vec3 B = step(u.yzw, u.xxx);\\n vec3 D = step(u.zww, u.yyz);\\n A.x = B.x + B.y + B.z;\\n A.yzw = 1. - B;\\n A.y += D.x + D.y;\\n A.zw += 1. - D.xy;\\n A.z += D.z;\\n A.w += 1. - D.z;\\n vec4 E = clamp(A, .0, 1.);\\n vec4 F = clamp(A - 1., .0, 1.);\\n vec4 G = clamp(A - 2., .0, 1.);\\n vec4 H = u - G + n.xxxx;\\n vec4 I = u - F + n.yyyy;\\n vec4 J = u - E + n.zzzz;\\n vec4 K = u + n.wwww;\\n o = c(o);\\n float L = d(d(d(d(o.w) + o.z) + o.y) + o.x);\\n vec4 M = d(d(d(d(o.w + vec4(G.w, F.w, E.w, 1.)) + o.z + vec4(G.z, F.z, E.z, 1.)) + o.y + vec4(G.y, F.y, E.y, 1.)) + o.x + vec4(G.x, F.x, E.x, 1.));\\n vec4 i = vec4(1. / 294., 1. / 49., 1. / 7., .0);\\n vec4 N = f(L, i);\\n vec4 O = f(M.x, i);\\n vec4 P = f(M.y, i);\\n vec4 Q = f(M.z, i);\\n vec4 R = f(M.w, i);\\n vec4 S = e(vec4(dot(N, N), dot(O, O), dot(P, P), dot(Q, Q)));\\n N *= S.x;\\n O *= S.y;\\n P *= S.z;\\n Q *= S.w;\\n R *= e(dot(R, R));\\n vec3 T = max(.6 - vec3(dot(u, u), dot(H, H), dot(I, I)), .0);\\n vec2 U = max(.6 - vec2(dot(J, J), dot(K, K)), .0);\\n T = T * T;\\n U = U * U;\\n return 49. * (dot(T * T, vec3(dot(N, u), dot(O, H), dot(P, I))) + dot(U * U, vec2(dot(Q, J), dot(R, K))));\\n}\\nconst float V = 3.14159265359;\\nfloat W(float X, float Y) {\\n float Z = fwidth(Y) * halfDist;\\n return smoothstep(X - Z, X + Z, Y);\\n}\\nvec4 ba(vec3 bb) {\\n float bc = min(min(bb.x, bb.y), bb.z);\\n float bd = .0;\\n if(noiseEnable)\\n bd += l(vec4(vPosition.xyz * 80.0, time * halfDist)) * .12;\\n bc += bd;\\n float be = max(bb.x, bb.y);\\n if(bb.y < bb.x && bb.y < bb.z) {\\n be = 1. - be;\\n }\\n float bf = thickness;\\n if(squeeze) {\\n bf *= mix(squeezeMin, squeezeMax, (1. - sin(be * V)));\\n }\\n if(dashEnabled) {\\n float bg = 1. / dashRepeats * dashLength / 2.;\\n if(!dashOverlap) {\\n bg += 1. / dashRepeats / 2.;\\n }\\n if(dashAnimate) {\\n bg += time * .22;\\n }\\n float bh = fract((be + bg) * dashRepeats);\\n bf *= 1. - W(dashLength, bh);\\n }\\n float bi = 1. - W(bf, bc);\\n#ifdef HAS_INSTANCE\\nvec4 bj = vInstanceColor;\\n#else\\nvec4 bj = stroke;\\n#endif\\nvec4 bk = vec4(.0);\\n if(seeThrough) {\\n bk = vec4(bj.xyz, bi);\\n if(insideAltColor && !gl_FrontFacing) {\\n bk.rgb = fill.xyz;\\n }\\n } else {\\n vec3 bl = mix(fill.xyz, bj.xyz, bi);\\n bk.a = fill.a;\\n if(dualStroke) {\\n float bm = 1. - W(secondThickness, bc);\\n vec3 bn = mix(fill.xyz, stroke.xyz, abs(bm - bi));\\n bk.rgb = bn;\\n } else {\\n bk.rgb = bl;\\n }\\n }\\n return bk;\\n}\\nvoid main() {\\n glFragColor = ba(vBarycentric);\\n glFragColor *= halfDist + opacity;\\n#ifdef HAS_MASK_EXTENT\\nglFragColor = setMask(glFragColor);\\n#endif\\n#if __VERSION__ == 100\\ngl_FragColor = glFragColor;\\n#endif\\n}\",\n uniforms: [{\n name: \"modelViewMatrix\",\n type: \"function\",\n fn: function fn(t, n) {\n return _glMatrix.mat4.multiply(r, n.viewMatrix, n.modelMatrix);\n } }],\n\n extraCommandProps: n }]),\n _this12.version = 300;\n return _this12;\n }\n _inherits(At, _yt);\n return _createClass(At);\n }(yt);\n var St = exports.PhongShader = function (_yt2) {\n function St() {\n var _this13;\n var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, St);\n var n = [],\n i = [],\n o = t.uniforms,\n a = [{\n name: \"modelNormalMatrix\",\n type: \"function\",\n fn: function fn(e, t) {\n return _glMatrix.mat3.fromMat4(n, t.modelMatrix);\n } },\n {\n name: \"modelViewMatrix\",\n type: \"function\",\n fn: function fn(t, n) {\n return _glMatrix.mat4.multiply(i, n.viewMatrix, n.modelMatrix);\n } }];\n\n o && a.push.apply(a, _toConsumableArray(o)), _this13 = _callSuper(this, St, [{\n vert: t.vert || \"#include \\nattribute vec3 aPosition;\\n#include \\n#ifdef HAS_MAP\\nuniform vec2 uvScale;\\nuniform vec2 uvOffset;\\nattribute vec2 aTexCoord;\\nvarying vec2 vTexCoord;\\n#ifdef HAS_I3S_UVREGION\\nattribute vec4 uvRegion;\\nvarying vec4 vUvRegion;\\n#endif\\n#if defined(HAS_AO_MAP)\\nattribute vec2 aTexCoord1;\\nvarying vec2 vTexCoord1;\\n#endif\\n#endif\\n#if defined(HAS_COLOR)\\nattribute vec4 aColor;\\nvarying vec4 vColor;\\n#elif defined(HAS_COLOR0)\\n#if COLOR0_SIZE == 3\\nattribute vec3 aColor0;\\n#else\\nattribute vec4 aColor0;\\n#endif\\nvarying vec4 vColor;\\n#endif\\nvarying vec3 vFragPos;\\nvarying vec3 vNormal;\\nuniform mat4 projMatrix;\\nuniform mat3 modelNormalMatrix;\\nuniform mat4 modelViewMatrix;\\nuniform mat4 modelMatrix;\\nuniform mat4 positionMatrix;\\nuniform vec2 halton;\\nuniform vec2 outSize;\\nuniform mat4 projViewMatrix;\\n#include \\n#include \\n#include \\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\\n#include \\n#endif\\n#ifdef HAS_EXTRUSION_OPACITY\\nattribute float aExtrusionOpacity;\\nvarying float vExtrusionOpacity;\\n#endif\\n#if defined(HAS_TANGENT)\\nvarying vec4 vTangent;\\n#endif\\nvoid c(const highp vec4 q, out highp vec3 d) {\\n d = vec3(.0, .0, 1.) + vec3(2., -2., -2.) * q.x * q.zwx + vec3(2., 2., -2.) * q.y * q.wzy;\\n}\\nvoid c(const highp vec4 q, out highp vec3 d, out highp vec3 t) {\\n c(q, d);\\n t = vec3(1., .0, .0) + vec3(-2., 2., -2.) * q.y * q.yxw + vec3(-2., 2., 2.) * q.z * q.zwx;\\n}\\n#include \\nvoid main() {\\n \\n#ifdef IS_LINE_EXTRUSION\\nvec4 e = getPosition(getLineExtrudePosition(aPosition));\\n#else\\nvec4 e = getPosition(aPosition);\\n#endif\\nmat4 f = getPositionMatrix();\\n vFragPos = vec3(modelMatrix * f * e);\\n#if defined(HAS_NORMAL) || defined(HAS_TANGENT)\\nmat3 h = modelNormalMatrix * mat3(f);\\n vec3 i;\\n#if defined(HAS_TANGENT)\\nvec3 t;\\n c(aTangent, i, t);\\n vTangent = vec4(h * t, aTangent.w);\\n#else\\ni = decode_getNormal(aNormal);\\n#endif\\nvec3 j = appendMorphNormal(i);\\n vNormal = normalize(h * j);\\n#else\\nvNormal = vec3(.0);\\n#endif\\nmat4 k = projMatrix;\\n k[2].xy += halton.xy / outSize.xy;\\n#ifdef HAS_MASK_EXTENT\\ngl_Position = k * getMaskPosition(f * e, modelMatrix);\\n#else\\ngl_Position = k * modelViewMatrix * f * e;\\n#endif\\n#ifdef HAS_MAP\\nvec2 l = decode_getTexcoord(aTexCoord);\\n vTexCoord = l * uvScale + uvOffset;\\n#endif\\n#ifdef HAS_AO_MAP\\nvec2 m = decode_getTexcoord(aTexCoord1);\\n vTexCoord1 = m * uvScale + uvOffset;\\n#endif\\n#ifdef HAS_EXTRUSION_OPACITY\\nvExtrusionOpacity = aExtrusionOpacity;\\n#endif\\n#if defined(HAS_COLOR)\\nvColor = aColor / 255.;\\n#elif defined(HAS_COLOR0)\\n#if COLOR0_SIZE == 3\\nvColor = vec4(aColor0 / 255., 1.);\\n#else\\nvColor = aColor0 / 255.;\\n#endif\\n#endif\\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\\nshadow_computeShadowPars(f * e);\\n#endif\\n#ifdef HAS_HEATMAP\\nheatmap_compute(projMatrix * modelViewMatrix * f, e);\\n#endif\\n#ifdef HAS_I3S_UVREGION\\nvUvRegion = uvRegion / 65535.;\\n#endif\\nhighlight_setVarying();\\n#ifdef HAS_VERTEX_COLOR\\nvertexColor_update();\\n#endif\\n}\",\n frag: t.frag || \"precision mediump float;\\n#include \\nuniform vec4 baseColorFactor;\\nuniform float materialShininess;\\nuniform float environmentExposure;\\nuniform float specularStrength;\\nuniform vec3 light0_viewDirection;\\nuniform vec3 ambientColor;\\nuniform vec4 light0_diffuse;\\nuniform vec3 lightSpecular;\\nuniform vec3 cameraPosition;\\nuniform float alphaTest;\\n#ifdef HAS_TOON\\nuniform float toons;\\nuniform float specularToons;\\n#endif\\n#ifdef HAS_TANGENT\\nvarying vec4 vTangent;\\n#endif\\n#ifdef HAS_MAP\\n#include \\n#endif\\nvarying vec3 vNormal;\\nvarying vec3 vFragPos;\\n#ifdef HAS_INSTANCE_COLOR\\nvarying vec4 vInstanceColor;\\n#endif\\n#ifdef HAS_BASECOLOR_MAP\\nuniform sampler2D baseColorTexture;\\n#endif\\n#ifdef HAS_EXTRUSION_OPACITY\\nuniform vec2 extrusionOpacityRange;\\nvarying float vExtrusionOpacity;\\n#endif\\n#if defined(HAS_COLOR) || defined(HAS_COLOR0)\\nvarying vec4 vColor;\\n#elif defined(IS_LINE_EXTRUSION)\\nuniform vec4 lineColor;\\n#else\\nuniform vec4 polygonFill;\\n#endif\\n#ifdef HAS_LAYER_OPACITY\\nuniform float layerOpacity;\\n#endif\\n#ifdef IS_LINE_EXTRUSION\\nuniform float lineOpacity;\\n#else\\nuniform float polygonOpacity;\\n#endif\\n#ifdef HAS_AO_MAP\\nuniform sampler2D occlusionTexture;\\nvarying vec2 vTexCoord1;\\n#endif\\n#ifdef HAS_NORMAL_MAP\\nuniform sampler2D normalTexture;\\n#endif\\n#ifdef HAS_EMISSIVE_MAP\\nuniform sampler2D emissiveTexture;\\n#endif\\n#ifdef SHADING_MODEL_SPECULAR_GLOSSINESS\\nuniform vec4 diffuseFactor;\\nuniform vec3 specularFactor;\\n#ifdef HAS_DIFFUSE_MAP\\nuniform sampler2D diffuseTexture;\\n#endif\\n#ifdef HAS_SPECULARGLOSSINESS_MAP\\nuniform sampler2D specularGlossinessTexture;\\n#endif\\n#endif\\n#include \\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\\n#include \\n#endif\\n#include \\n#include \\n#include \\nvec3 c() {\\n \\n#if defined(HAS_NORMAL_MAP)\\nvec3 d = normalize(vNormal);\\n vec3 e = texture2D(normalTexture, computeTexCoord(vTexCoord)).xyz * 2. - 1.;\\n#if defined(HAS_TANGENT)\\nvec3 t = normalize(vTangent.xyz);\\n vec3 b = normalize(cross(d, t) * sign(vTangent.w));\\n mat3 f = mat3(t, b, d);\\n return normalize(f * e);\\n#else\\nreturn normalize(e);\\n#endif\\n#else\\nreturn normalize(vNormal);\\n#endif\\n}\\nvec4 h() {\\n \\n#if defined(HAS_BASECOLOR_MAP)\\nreturn texture2D(baseColorTexture, computeTexCoord(vTexCoord));\\n#elif defined(HAS_DIFFUSE_MAP)\\nreturn texture2D(diffuseTexture, computeTexCoord(vTexCoord));\\n#elif defined(SHADING_MODEL_SPECULAR_GLOSSINESS)\\nreturn diffuseFactor;\\n#else\\nreturn baseColorFactor;\\n#endif\\n}\\nvec3 i() {\\n \\n#if defined(HAS_SPECULARGLOSSINESS_MAP)\\nreturn texture2D(specularGlossinessTexture, computeTexCoord(vTexCoord)).rgb;\\n#elif defined(SHADING_MODEL_SPECULAR_GLOSSINESS)\\nreturn specularFactor;\\n#else\\nreturn vec3(1.);\\n#endif\\n}\\nvoid main() {\\n vec4 j = h();\\n vec3 k = environmentExposure * ambientColor * j.rgb;\\n#ifdef HAS_INSTANCE_COLOR\\nk *= vInstanceColor.rgb;\\n#endif\\nvec3 l = c();\\n vec3 m = normalize(-light0_viewDirection);\\n float o = max(dot(l, m), .0);\\n#ifdef HAS_TOON\\nfloat u = floor(o * toons);\\n o = u / toons;\\n#endif\\nvec3 v = light0_diffuse.rgb * o * j.rgb;\\n#if defined(HAS_COLOR) || defined(HAS_COLOR0)\\nvec3 A = vColor.rgb;\\n#elif defined(IS_LINE_EXTRUSION)\\nvec3 A = lineColor.rgb;\\n#else\\nvec3 A = polygonFill.rgb;\\n#endif\\n#ifdef HAS_INSTANCE_COLOR\\nA *= vInstanceColor.rgb;\\n#endif\\nk *= A.rgb;\\n v *= A.rgb;\\n vec3 B = normalize(cameraPosition - vFragPos);\\n vec3 C = normalize(m + B);\\n float D = pow(max(dot(l, C), .0), materialShininess);\\n#ifdef HAS_TOON\\nfloat E = floor(D * specularToons);\\n D = E / specularToons;\\n#endif\\nvec3 F = specularStrength * lightSpecular * D * i();\\n#ifdef HAS_OCCLUSION_MAP\\nfloat G = texture2D(occlusionTexture, computeTexCoord(vTexCoord1)).r;\\n k *= G;\\n#endif\\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\\nfloat H = shadow_computeShadow();\\n v = shadow_blend(v, H).rgb;\\n F = shadow_blend(F, H).rgb;\\n k = shadow_blend(k, H).rgb;\\n#endif\\nvec3 I = k + v + F;\\n#ifdef HAS_EMISSIVE_MAP\\nvec3 J = texture2D(emissiveTexture, computeTexCoord(vTexCoord)).rgb;\\n I += J;\\n#endif\\n#ifdef IS_LINE_EXTRUSION\\nglFragColor = vec4(I, lineOpacity * j.a);\\n#else\\nglFragColor = vec4(I, polygonOpacity * j.a);\\n#endif\\n#if defined(HAS_COLOR) || defined(HAS_COLOR0)\\nfloat K = vColor.a;\\n#elif defined(IS_LINE_EXTRUSION)\\nfloat K = lineColor.a;\\n#else\\nfloat K = polygonFill.a;\\n#endif\\nglFragColor *= K;\\n#ifdef HAS_EXTRUSION_OPACITY\\nfloat L = extrusionOpacityRange.x;\\n float M = extrusionOpacityRange.y;\\n float N = L + vExtrusionOpacity * (M - L);\\n N = clamp(N, .0, 1.);\\n glFragColor *= N;\\n#endif\\nif(glFragColor.a < alphaTest) {\\n discard;\\n }\\n#ifdef HAS_VERTEX_COLOR\\nglFragColor *= vertexColor_get();\\n#endif\\n#ifdef HAS_HEATMAP\\nglFragColor = heatmap_getColor(glFragColor);\\n#endif\\nglFragColor = highlight_blendColor(glFragColor);\\n#ifdef HAS_LAYER_OPACITY\\nglFragColor *= layerOpacity;\\n#endif\\n#ifdef HAS_MASK_EXTENT\\nglFragColor = setMask(glFragColor);\\n#endif\\n#if __VERSION__ == 100\\ngl_FragColor = glFragColor;\\n#endif\\n}\",\n uniforms: a,\n defines: t.defines || {},\n extraCommandProps: t.extraCommandProps || {} }]),\n _this13.version = 300;\n return _this13;\n }\n _inherits(St, _yt2);\n return _createClass(St, [{\n key: \"getGeometryDefines\",\n value: function getGeometryDefines(e) {\n var t = {};\n return e.data[e.desc.tangentAttribute] ? t.HAS_TANGENT = 1 : e.data[e.desc.normalAttribute] && (t.HAS_NORMAL = 1), t;\n } }]);\n\n }(yt);\n var Tt = exports.PointLineShader = function (_yt3) {\n function Tt() {\n var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, Tt);\n var n = [];\n return _callSuper(this, Tt, [{\n vert: \"attribute vec3 aPosition;\\n#ifdef HAS_COLOR0\\nattribute vec4 aColor0;\\nvarying vec4 vColor;\\n#endif\\nuniform mat4 modelMatrix;\\nuniform mat4 projMatrix;\\nuniform mat4 positionMatrix;\\nuniform mat4 projViewModelMatrix;\\nuniform float pointSize;\\n#if defined(HAS_MAP)\\nattribute vec2 aTexCoord;\\nvarying vec2 vTexCoord;\\n#endif\\n#include \\n#include \\n#ifdef HAS_FLOODANALYSE\\nvarying float vHeight;\\n#endif\\nvoid main() {\\n vec4 c = getPosition(aPosition);\\n mat4 d = getPositionMatrix();\\n gl_PointSize = pointSize;\\n#ifdef HAS_MASK_EXTENT\\ngl_Position = projMatrix * getMaskPosition(d * c, modelMatrix);\\n#else\\ngl_Position = projViewModelMatrix * d * c;\\n#endif\\n#ifdef HAS_COLOR0\\nvColor = aColor0 / 255.;\\n#endif\\n#ifdef HAS_MAP\\nvTexCoord = aTexCoord;\\n#endif\\n#ifdef HAS_HEATMAP\\nheatmap_compute(projMatrix * modelViewMatrix * d, c);\\n#endif\\n}\",\n frag: \"precision mediump float;\\n#include \\n#if defined(HAS_COLOR0)\\nvarying vec4 vColor;\\n#endif\\n#include \\nuniform vec4 baseColorFactor;\\n#if defined(HAS_MAP)\\n#if defined(HAS_ALBEDO_MAP)\\nuniform sampler2D baseColorTexture;\\n#endif\\n#if defined(HAS_DIFFUSE_MAP)\\nuniform sampler2D diffuseTexture;\\n#endif\\nvarying vec2 vTexCoord;\\n#endif\\n#include \\nvoid main() {\\n \\n#ifdef HAS_COLOR0\\nglFragColor = vColor * baseColorFactor;\\n#else\\nglFragColor = vec4(1.) * baseColorFactor;\\n#endif\\n#ifdef HAS_MAP\\n#ifdef HAS_ALBEDO_MAP\\nglFragColor *= texture2D(baseColorTexture, vTexCoord);\\n#endif\\n#ifdef HAS_DIFFUSE_MAP\\nglFragColor *= texture2D(diffuseTexture, vTexCoord);\\n#endif\\n#endif\\n#ifdef HAS_HEATMAP\\nglFragColor = heatmap_getColor(glFragColor);\\n#endif\\n#ifdef HAS_MASK_EXTENT\\nglFragColor = setMask(glFragColor);\\n#endif\\n#if __VERSION__ == 100\\ngl_FragColor = glFragColor;\\n#endif\\n}\",\n uniforms: [{\n name: \"projViewModelMatrix\",\n type: \"function\",\n fn: function fn(t, r) {\n return _glMatrix.mat4.multiply(n, r.projViewMatrix, r.modelMatrix);\n } }],\n\n defines: t.defines || {},\n extraCommandProps: t.extraCommandProps || {} }]);\n\n }\n _inherits(Tt, _yt3);\n return _createClass(Tt);\n }(yt);\n var Mt = \"#if __VERSION__ == 300\\n#define attribute in\\n#define varying out\\n#endif\\nattribute vec2 aPosition;\\nattribute vec2 aTexCoord;\\nvarying vec2 vTexCoord;\\nvoid main() {\\n gl_Position = vec4(aPosition, 0., 1.);\\n vTexCoord = aTexCoord;\\n}\";\n var Ot = new Int8Array([-1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1]),\n Ct = new Uint8Array([0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0]);\n var Et = exports.QuadShader = function (_yt4) {\n function Et(e) {\n var _this14;\n _classCallCheck(this, Et);\n e.vert = e.vert || Mt, e.extraCommandProps = e.extraCommandProps || {}, e.extraCommandProps.depth || (e.extraCommandProps.depth = {\n enable: !1,\n mask: !1 }),\n e.extraCommandProps.stencil || (e.extraCommandProps.stencil = {\n enable: !1 }),\n _this14 = _callSuper(this, Et, [e]);\n return _this14;\n }\n _inherits(Et, _yt4);\n return _createClass(Et, [{\n key: \"draw\",\n value: function draw(e) {\n return this._quadMesh || this._createQuadMesh(e), _superPropGet(Et, \"draw\", this, 3)([e, this._quadMesh]);\n } },\n {\n key: \"getMeshCommand\",\n value: function getMeshCommand(e) {\n var t = this.dkey || \"\";\n return this.commands[t + \"_quad\"] || (this.commands[t + \"_quad\"] = this.createREGLCommand(e, null, this._quadMesh[0].getElements())), this.commands[t + \"_quad\"];\n } },\n {\n key: \"_createQuadMesh\",\n value: function _createQuadMesh(e) {\n var t = new Z({\n aPosition: Ot,\n aTexCoord: Ct },\n null, Ot.length / 2, {\n positionSize: 2,\n primitive: \"triangles\" });\n\n t.generateBuffers(e), this._quadMesh = [new Be(t)];\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n if (this._quadMesh) {\n var _e63 = this._quadMesh[0];\n _e63.geometry.dispose(), _e63.dispose();\n }\n return delete this._quadMesh, _superPropGet(Et, \"dispose\", this, 3)([]);\n } }]);\n\n }(yt);\n var Pt = exports.FxaaShader = function (_Et) {\n function Pt() {\n _classCallCheck(this, Pt);\n return _callSuper(this, Pt, [{\n vert: Mt,\n frag: \"#define SHADER_NAME FXAA\\nprecision mediump float;\\nvarying vec2 vTexCoord;\\nuniform float enableFXAA;\\nuniform float enableToneMapping;\\nuniform float enableSharpen;\\nuniform vec2 resolution;\\nuniform sampler2D textureSource;\\n#ifdef HAS_NOAA_TEX\\nuniform sampler2D noAaTextureSource;\\n#endif\\n#ifdef HAS_POINT_TEX\\nuniform sampler2D pointTextureSource;\\n#endif\\n#ifdef HAS_TAA_TEX\\nuniform sampler2D taaTextureSource;\\n#ifdef HAS_FXAA_TEX\\nuniform sampler2D fxaaTextureSource;\\n#endif\\n#endif\\nuniform float pixelRatio;\\nuniform float sharpFactor;\\n#ifdef HAS_OUTLINE_TEX\\nuniform sampler2D textureOutline;\\nuniform float enableOutline;\\nuniform float highlightFactor;\\nuniform float outlineFactor;\\nuniform float outlineWidth;\\nuniform vec3 outlineColor;\\n#endif\\nvec2 c;\\nvec4 d(vec2 e) {\\n \\n#ifdef HAS_TAA_TEX\\nvec4 f = texture2D(textureSource, e);\\n vec4 taa = texture2D(taaTextureSource, e);\\n#ifdef HAS_FXAA_TEX\\nvec4 h = texture2D(fxaaTextureSource, e);\\n#else\\nvec4 h = vec4(.0);\\n#endif\\nvec4 i = taa + f * (1. - taa.a);\\n return h + i * (1. - h.a);\\n#else\\nreturn texture2D(textureSource, e);\\n#endif\\n}\\nvec3 j(const in vec3 k, const float l) {\\n vec2 m = pixelRatio / resolution.xy;\\n float n = .0;\\n vec4 o = texture2D(textureSource, c + m * vec2(-1., -1.));\\n o.rgb = mix(vec3(.0), o.rgb, sign(o.a));\\n n += mix(.0, 1., sign(o.a));\\n vec4 u = texture2D(textureSource, c + m * vec2(1.));\\n u.rgb = mix(vec3(.0), u.rgb, sign(u.a));\\n n += mix(.0, 1., sign(u.a));\\n vec4 v = texture2D(textureSource, c + m * vec2(1., -1.));\\n v.rgb = mix(vec3(.0), v.rgb, sign(v.a));\\n n += mix(.0, 1., sign(v.a));\\n vec4 A = texture2D(textureSource, c + m * vec2(-1., 1.));\\n A.rgb = mix(vec3(.0), A.rgb, sign(A.a));\\n n += mix(.0, 1., sign(A.a));\\n return k + l * (n * k - o.rgb - v.rgb - A.rgb - u.rgb);\\n}\\nvec4 B(const in vec4 k) {\\n return vec4(j(k.rgb, sharpFactor), k.a);\\n}\\nvec3 C(const vec3 x) {\\n const float a = 2.51;\\n const float b = .03;\\n const float D = 2.43;\\n const float E = .59;\\n const float F = .14;\\n return (x * (a * x + b)) / (x * (D * x + E) + F);\\n}\\nvec3 G(vec3 k) {\\n k = k / (k + vec3(1.));\\n return k = pow(k, vec3(1. / 2.2));\\n}\\n#ifdef HAS_OUTLINE_TEX\\nvec4 H() {\\n float I = 2.;\\n float J = 1.;\\n float K = pixelRatio / resolution[0] * outlineWidth;\\n float L = pixelRatio / resolution[1] * outlineWidth;\\n vec4 M = (texture2D(textureOutline, c + vec2(K, L)));\\n vec4 N = (texture2D(textureOutline, c + vec2(K, .0)));\\n vec4 O = (texture2D(textureOutline, c + vec2(K, -L)));\\n vec4 P = (texture2D(textureOutline, c + vec2(.0, -L)));\\n vec4 Q = (texture2D(textureOutline, c + vec2(-K, -L)));\\n vec4 R = (texture2D(textureOutline, c + vec2(-K, .0)));\\n vec4 S = (texture2D(textureOutline, c + vec2(-K, L)));\\n vec4 T = (texture2D(textureOutline, c + vec2(.0, L)));\\n vec4 U = -I * R + I * N + -J * S + J * M + -J * Q + J * O;\\n vec4 V = -I * P + I * T + -J * Q + J * S + -J * O + J * M;\\n float W = sqrt(dot(V, V) + dot(U, U));\\n bool X = W < 1. / 65025.;\\n vec3 Y = (texture2D(textureOutline, c)).r * outlineColor;\\n if(Y == vec3(.0) || (highlightFactor == .0 && X)) {\\n return vec4(.0);\\n }\\n float Z = X ? highlightFactor : min(1., sqrt(W) * outlineFactor);\\n return Z * vec4(Y, 1.);\\n}\\nvec4 ba(const in vec4 k) {\\n vec4 H = H();\\n return H + vec4(k) * (1. - H.a);\\n}\\n#endif\\nvoid main() {\\n c = vTexCoord;\\n vec4 k;\\n if(enableFXAA == 1.) {\\n \\n } else {\\n k = d(vTexCoord);\\n }\\n if(enableSharpen == 1.) {\\n k = B(k);\\n }\\n#if defined(HAS_NOAA_TEX) || defined(HAS_POINT_TEX)\\nvec4 bb = vec4(.0);\\n vec4 bc = vec4(.0);\\n#ifdef HAS_POINT_TEX\\nbb = texture2D(pointTextureSource, vTexCoord);\\n#endif\\n#ifdef HAS_NOAA_TEX\\nbc = texture2D(noAaTextureSource, vTexCoord);\\n#endif\\nvec4 bd = bb + bc * (1. - bb.a);\\n k = bd + k * (1. - bd.a);\\n#endif\\nif(enableToneMapping == 1.) {\\n k.rgb = G(k.rgb);\\n }\\n#ifdef HAS_OUTLINE_TEX\\nk = ba(k);\\n#endif\\ngl_FragColor = k;\\n}\",\n extraCommandProps: {\n viewport: {\n x: 0,\n y: 0,\n width: function width(e, t) {\n return t.resolution[0];\n },\n height: function height(e, t) {\n return t.resolution[1];\n } } } }]);\n\n\n\n }\n _inherits(Pt, _Et);\n return _createClass(Pt, [{\n key: \"getMeshCommand\",\n value: function getMeshCommand(e, t) {\n var n = this.dkey || \"\";\n return this.commands[n + \"_fxaa\"] || (this.commands[n + \"_fxaa\"] = this.createREGLCommand(e, null, t.getElements())), this.commands[n + \"_fxaa\"];\n } }]);\n\n }(Et);\n var wt = exports.BoxBlurShader = function (_Et2) {\n function wt(_ref3) {\n var _this15;\n var e = _ref3.blurOffset;\n _classCallCheck(this, wt);\n _this15 = _callSuper(this, wt, [{\n vert: Mt,\n frag: \"precision highp float;\\nvarying vec2 vTexCoord;\\nuniform sampler2D textureSource;\\nuniform vec2 resolution;\\nuniform float ignoreTransparent;\\nvoid main() {\\n vec4 c = vec4(.0);\\n float d = .0;\\n for(int x = -BOXBLUR_OFFSET; x <= BOXBLUR_OFFSET; ++x)\\n for(int y = -BOXBLUR_OFFSET; y <= BOXBLUR_OFFSET; ++y) {\\n vec2 e = vTexCoord.st + vec2(float(x) / resolution.x, float(y) / resolution.y);\\n e = clamp(e, .0, 1.);\\n vec4 f = texture2D(textureSource, e);\\n float h;\\n if(ignoreTransparent == 1.) {\\n h = sign(f.a);\\n } else {\\n h = 1.;\\n }\\n d += h;\\n c += h * f;\\n }\\n gl_FragColor = c / max(d, 1.) * clamp(sign(d - 1.), .0, 1.);\\n}\",\n defines: {\n BOXBLUR_OFFSET: e || 2 },\n\n extraCommandProps: {\n viewport: {\n x: 0,\n y: 0,\n width: function width(e, t) {\n return t.resolution[0];\n },\n height: function height(e, t) {\n return t.resolution[1];\n } } } }]),\n\n\n _this15._blurOffset = e || 2;\n return _this15;\n }\n _inherits(wt, _Et2);\n return _createClass(wt, [{\n key: \"getMeshCommand\",\n value: function getMeshCommand(e, t) {\n var n = \"box_blur_\" + this._blurOffset;\n return this.commands[n] || (this.commands[n] = this.createREGLCommand(e, null, t.getElements())), this.commands[n];\n } }]);\n\n }(Et);\n var It = exports.PostProcessShader = function (_Et3) {\n function It() {\n _classCallCheck(this, It);\n return _callSuper(this, It, [{\n vert: Mt,\n frag: \"precision mediump float;\\nvarying vec2 vTexCoord;\\nuniform vec2 resolution;\\nuniform sampler2D textureSource;\\nuniform float enableVignette;\\nuniform float enableGrain;\\nuniform float enableLut;\\nuniform float timeGrain;\\nuniform float grainFactor;\\nuniform vec2 lensRadius;\\nuniform float frameMod;\\nuniform sampler2D lookupTable;\\n#include \\nfloat c(const in vec2 d) {\\n vec3 e = fract(vec3(d.xyx) * .1031);\\n e += dot(e, e.yzx + 19.19);\\n return fract((e.x + e.y) * e.z);\\n}\\nfloat f() {\\n float h = c(gl_FragCoord.xy + 1000.0 * fract(timeGrain));\\n float i = h * 2. - 1.;\\n h = i * inversesqrt(abs(i));\\n h = max(-1., h);\\n h = h - sign(i) + .5;\\n return (h + .5) * .5;\\n}\\nvec4 j(const in vec4 k) {\\n float l = f();\\n return vec4(mix(k.rgb, k.rgb * (k.rgb + (1. - k.rgb) * 2. * l), grainFactor), k.a);\\n}\\nfloat m(const in vec2 d, const in float n) {\\n vec3 o = vec3(.06711056, .00583715, 52.9829189);\\n return fract(o.z * fract(dot(d.xy + n * vec2(47., 17.) * .695, o.xy)));\\n}\\nfloat u() {\\n vec2 v = lensRadius;\\n v.y = min(v.y, v.x - 1e-4);\\n float A = m(gl_FragCoord.xy, frameMod);\\n A = (v.x - v.y) * (v.x + v.y) * .07 * (A - .5);\\n return smoothstep(v.x, v.y, A + distance(vTexCoord, vec2(.5)));\\n}\\nvec4 B(const in vec4 k) {\\n float l = u();\\n return vec4(linearTosRGB(sRGBToLinear(k.rgb) * l), clamp(k.a + (1. - l), .0, 1.));\\n}\\nvec4 C(in vec4 D, in sampler2D E) {\\n mediump float F = D.b * 63.;\\n mediump vec2 G;\\n G.y = floor(floor(F) / 8.);\\n G.x = floor(F) - G.y * 8.;\\n mediump vec2 H;\\n H.y = floor(ceil(F) / 8.);\\n H.x = ceil(F) - H.y * 8.;\\n highp vec2 I;\\n I.x = G.x * .125 + .5 / 512. + (.125 - 1. / 512.) * D.r;\\n I.y = G.y * .125 + .5 / 512. + (.125 - 1. / 512.) * D.g;\\n#ifdef LUT_FLIP_Y\\nI.y = 1. - I.y;\\n#endif\\nhighp vec2 J;\\n J.x = H.x * .125 + .5 / 512. + (.125 - 1. / 512.) * D.r;\\n J.y = H.y * .125 + .5 / 512. + (.125 - 1. / 512.) * D.g;\\n#ifdef LUT_FLIP_Y\\nJ.y = 1. - J.y;\\n#endif\\nlowp vec4 K = texture2D(E, I);\\n lowp vec4 L = texture2D(E, J);\\n lowp vec4 M = mix(K, L, fract(F));\\n return M;\\n}\\nvoid main() {\\n vec4 k = texture2D(textureSource, vTexCoord);\\n if(enableLut == 1.) {\\n k = C(k, lookupTable);\\n }\\n if(enableVignette == 1.) {\\n k = B(k);\\n }\\n if(enableGrain == 1.) {\\n k = j(k);\\n }\\n gl_FragColor = k;\\n}\",\n extraCommandProps: {\n viewport: {\n x: 0,\n y: 0,\n width: function width(e, t) {\n return t.resolution[0];\n },\n height: function height(e, t) {\n return t.resolution[1];\n } } } }]);\n\n\n\n }\n _inherits(It, _Et3);\n return _createClass(It, [{\n key: \"getMeshCommand\",\n value: function getMeshCommand(e, t) {\n return this.commands.postprocess || (this.commands.postprocess = this.createREGLCommand(e, null, t.getElements())), this.commands.postprocess;\n } }]);\n\n }(Et);\n var Rt = [[.263385, -.0252475], [-.38545, .054485], [-.139795, -.5379925], [-.2793775, .6875475], [.7139025, .4710925], [.90044, -.16422], [.4481775, -.82799], [-.9253375, -.2910625], [.3468025, 1.02292], [-1.13742, .33522], [-.7676225, -.9123175], [-.2005775, -1.1774125], [-.926525, .96876], [1.12909, -.7500325], [.9603, 1.14625]],\n Dt = Rt.length,\n Ht = [0, 0];\n for (var _e64 = 0; _e64 < Rt.length; _e64++) Ht[0] += Rt[_e64][0], Ht[1] += Rt[_e64][1];\n Ht[0] /= Dt, Ht[1] /= Dt;\n var Ft = exports.Jitter = function () {\n function Ft(e) {\n _classCallCheck(this, Ft);\n this._frameNum = 0, this._ratio = e || .05, this._avg = [Ht[0] * this._ratio, Ht[1] * this._ratio];\n }\n return _createClass(Ft, [{\n key: \"getRatio\",\n value: function getRatio() {\n return this._ratio;\n } },\n {\n key: \"setRatio\",\n value: function setRatio(e) {\n this._ratio !== e && (this._ratio = e, this.reset()), this._avg = [Ht[0] * this._ratio, Ht[1] * this._ratio];\n } },\n {\n key: \"getAverage\",\n value: function getAverage() {\n return this._avg;\n } },\n {\n key: \"reset\",\n value: function reset() {\n this._frameNum = 0;\n } },\n {\n key: \"getJitter\",\n value: function getJitter(e) {\n var t = this._frameNum % Dt,\n n = this._ratio;\n return _glMatrix.vec2.set(e, Rt[t][0] * n, Rt[t][1] * n), e;\n } },\n {\n key: \"frame\",\n value: function frame() {\n this._frameNum++, this._frameNum % Dt == 0 && (this._frameNum = 0);\n } },\n {\n key: \"getSampleCount\",\n value: function getSampleCount() {\n return Dt;\n } }]);\n\n }();\n var Nt = function () {\n function Nt(e, t) {\n var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;\n _classCallCheck(this, Nt);\n this._regl = e, this._renderer = new Ve(e), this._inputRGBM = t, this._level = n;\n }\n return _createClass(Nt, [{\n key: \"render\",\n value: function render(e, t) {\n this._initShaders(), this._createTextures(e), this._blur(e, t || 0);\n var n = {\n blurTex0: this._blur01Tex,\n blurTex1: this._blur11Tex,\n blurTex2: this._blur21Tex,\n blurTex3: this._blur31Tex,\n blurTex4: this._blur41Tex };\n\n return this._level > 5 && (n.blurTex5 = this._blur51Tex, n.blurTex6 = this._blur61Tex), n;\n } },\n {\n key: \"_blur\",\n value: function _blur(e, t) {\n var n = this._blurUniforms;\n n || (n = this._blurUniforms = {\n rgbmRange: 7,\n blurDir: [0, 0],\n outSize: [0, 0],\n pixelRatio: [1, 1],\n outputSize: [0, 0] }),\n _glMatrix.vec2.set(n.outSize, e.width, e.height), this._blurOnce(this._blur0Shader, e, this._blur00FBO, this._blur01FBO, .5, t), this._blurOnce(this._blur1Shader, this._blur01FBO.color[0], this._blur10FBO, this._blur11FBO, .5), this._blurOnce(this._blur2Shader, this._blur11FBO.color[0], this._blur20FBO, this._blur21FBO, .5), this._blurOnce(this._blur3Shader, this._blur21FBO.color[0], this._blur30FBO, this._blur31FBO, .5), this._blurOnce(this._blur4Shader, this._blur31FBO.color[0], this._blur40FBO, this._blur41FBO, .5), this._level > 5 && (this._blurOnce(this._blur5Shader, this._blur41FBO.color[0], this._blur50FBO, this._blur51FBO, .5), this._blurOnce(this._blur6Shader, this._blur51FBO.color[0], this._blur60FBO, this._blur51FBO, .5));\n } },\n {\n key: \"_blurOnce\",\n value: function _blurOnce(e, t, n, r, o, a) {\n var s = Math.ceil(o * t.width),\n c = Math.ceil(o * t.height);\n n.width === s && n.height === c || n.resize(s, c), r.width === s && r.height === c || r.resize(s, c);\n var l = this._blurUniforms;\n l.luminThreshold = a, l.TextureBlurInput = t, l.inputRGBM = +this._inputRGBM, _glMatrix.vec2.set(l.blurDir, 0, 1), _glMatrix.vec2.set(l.outputSize, n.width, n.height), this._renderer.render(e, l, null, n), l.luminThreshold = 0, l.inputRGBM = 1, _glMatrix.vec2.set(l.blurDir, 1, 0), l.TextureBlurInput = n.color[0], this._renderer.render(e, l, null, r);\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n this._blur0Shader && (this._blur0Shader.dispose(), delete this._blur0Shader, this._blur1Shader.dispose(), this._blur2Shader.dispose(), this._blur3Shader.dispose(), this._blur4Shader.dispose(), this._blur5Shader && (this._blur5Shader.dispose(), this._blur6Shader.dispose(), delete this._blur5Shader)), this._blur00Tex && (delete this._blur00Tex, this._blur00FBO.destroy(), this._blur01FBO.destroy(), this._blur10FBO.destroy(), this._blur11FBO.destroy(), this._blur20FBO.destroy(), this._blur21FBO.destroy(), this._blur30FBO.destroy(), this._blur31FBO.destroy(), this._blur40FBO.destroy(), this._blur41FBO.destroy(), this._blur50FBO && (this._blur50FBO.destroy(), this._blur51FBO.destroy(), this._blur60FBO.destroy(), this._blur61FBO.destroy()));\n } },\n {\n key: \"_createTextures\",\n value: function _createTextures(e) {\n if (this._blur00Tex) return;\n var t = e.width,\n n = e.height;\n this._blur00Tex = this._createColorTex(e, t, n), this._blur00FBO = this._createBlurFBO(this._blur00Tex), this._blur01Tex = this._createColorTex(e), this._blur01FBO = this._createBlurFBO(this._blur01Tex), t = Math.ceil(t / 2), n = Math.ceil(n / 2), this._blur10Tex = this._createColorTex(e, t, n), this._blur10FBO = this._createBlurFBO(this._blur10Tex), this._blur11Tex = this._createColorTex(e, t, n), this._blur11FBO = this._createBlurFBO(this._blur11Tex), t = Math.ceil(t / 2), n = Math.ceil(n / 2), this._blur20Tex = this._createColorTex(e, t, n), this._blur20FBO = this._createBlurFBO(this._blur20Tex), this._blur21Tex = this._createColorTex(e, t, n), this._blur21FBO = this._createBlurFBO(this._blur21Tex), t = Math.ceil(t / 2), n = Math.ceil(n / 2), this._blur30Tex = this._createColorTex(e, t, n), this._blur30FBO = this._createBlurFBO(this._blur30Tex), this._blur31Tex = this._createColorTex(e, t, n), this._blur31FBO = this._createBlurFBO(this._blur31Tex), t = Math.ceil(t / 2), n = Math.ceil(n / 2), this._blur40Tex = this._createColorTex(e, t, n), this._blur40FBO = this._createBlurFBO(this._blur40Tex), this._blur41Tex = this._createColorTex(e, t, n), this._blur41FBO = this._createBlurFBO(this._blur41Tex), this._level > 5 && (t = Math.ceil(t / 2), n = Math.ceil(n / 2), this._blur50Tex = this._createColorTex(e, t, n), this._blur50FBO = this._createBlurFBO(this._blur50Tex), this._blur51Tex = this._createColorTex(e, t, n), this._blur51FBO = this._createBlurFBO(this._blur51Tex), t = Math.ceil(t / 2), n = Math.ceil(n / 2), this._blur60Tex = this._createColorTex(e, t, n), this._blur60FBO = this._createBlurFBO(this._blur60Tex), this._blur61Tex = this._createColorTex(e, t, n), this._blur61FBO = this._createBlurFBO(this._blur61Tex));\n } },\n {\n key: \"_createColorTex\",\n value: function _createColorTex(e, t, n) {\n return this._regl.texture({\n min: \"linear\",\n mag: \"linear\",\n type: \"uint8\",\n width: t || e.width,\n height: n || e.height });\n\n } },\n {\n key: \"_createBlurFBO\",\n value: function _createBlurFBO(e) {\n return this._regl.framebuffer({\n width: e.width,\n height: e.height,\n colors: [e],\n depth: !1,\n stencil: !1 });\n\n } },\n {\n key: \"_initShaders\",\n value: function _initShaders() {\n if (!this._blur0Shader) {\n var _e65 = {\n vert: Mt,\n extraCommandProps: {\n viewport: {\n x: 0,\n y: 0,\n width: function width(e, t) {\n return t.outputSize[0];\n },\n height: function height(e, t) {\n return t.outputSize[1];\n } } },\n\n\n frag: \"#version 100\\nprecision highp float;\\nuniform float rgbmRange;\\nuniform sampler2D TextureBlurInput;\\nuniform sampler2D TextureInput;\\nuniform vec2 blurDir;\\nuniform vec2 pixelRatio;\\nuniform vec2 outputSize;\\nuniform float inputRGBM;\\nuniform float luminThreshold;\\n#define SHADER_NAME GAUSSIAN_BLUR0\\nconst vec3 c = vec3(.2126, .7152, .0722);\\nfloat d(const in vec3 e) {\\n return dot(e, c);\\n}\\nvec4 f(vec4 e) {\\n float h = max(sign(d(e.rgb) - luminThreshold), .0);\\n return e * h;\\n}\\nvec2 i;\\nvec4 j(const in vec3 e, const in float k) {\\n vec4 l;\\n vec3 m = e / k;\\n l.a = clamp(max(max(m.r, m.g), max(m.b, 1e-6)), .0, 1.);\\n l.a = ceil(l.a * 255.) / 255.;\\n l.rgb = m / l.a;\\n return l;\\n}\\nvec3 n(const in vec4 e, const in float k) {\\n if(inputRGBM == .0)\\n return e.rgb;\\n return k * e.rgb * e.a;\\n}\\nvec4 o() {\\n vec3 u = .375 * (f(vec4(n(texture2D(TextureBlurInput, i.xy), rgbmRange), 1.))).rgb;\\n vec2 v;\\n vec2 A = pixelRatio.xy * blurDir.xy / outputSize.xy;\\n v = A * 1.2;\\n u += .3125 * (f(vec4(n(texture2D(TextureBlurInput, i.xy + v.xy), rgbmRange), 1.))).rgb;\\n u += .3125 * (f(vec4(n(texture2D(TextureBlurInput, i.xy - v.xy), rgbmRange), 1.))).rgb;\\n return vec4(u, 1.);\\n}\\nvoid main(void) {\\n i = gl_FragCoord.xy / outputSize.xy;\\n vec4 e = o();\\n e = j(e.rgb, rgbmRange);\\n gl_FragColor = e;\\n}\" };\n\n this._blur0Shader = new Et(_e65), _e65.frag = \"#version 100\\nprecision highp float;\\nuniform float rgbmRange;\\nuniform sampler2D TextureBlurInput;\\nuniform sampler2D TextureInput;\\nuniform vec2 blurDir;\\nuniform vec2 pixelRatio;\\nuniform vec2 outputSize;\\n#define SHADER_NAME GAUSSIAN_BLUR1\\nvec2 c;\\nvec4 d(const in vec3 e, const in float f) {\\n if(f <= .0)\\n return vec4(e, 1.);\\n vec4 h;\\n vec3 i = e / f;\\n h.a = clamp(max(max(i.r, i.g), max(i.b, 1e-6)), .0, 1.);\\n h.a = ceil(h.a * 255.) / 255.;\\n h.rgb = i / h.a;\\n return h;\\n}\\nvec3 j(const in vec4 e, const in float f) {\\n if(f <= .0)\\n return e.rgb;\\n return f * e.rgb * e.a;\\n}\\nvec4 k() {\\n vec3 l = .3125 * (vec4(j(texture2D(TextureBlurInput, c.xy), rgbmRange), 1.)).rgb;\\n vec2 m;\\n vec2 n = pixelRatio.xy * blurDir.xy / outputSize.xy;\\n m = n * 1.2857142857142858;\\n l += .328125 * (vec4(j(texture2D(TextureBlurInput, c.xy + m.xy), rgbmRange), 1.)).rgb;\\n l += .328125 * (vec4(j(texture2D(TextureBlurInput, c.xy - m.xy), rgbmRange), 1.)).rgb;\\n return vec4(l, 1.);\\n}\\nvoid main(void) {\\n c = gl_FragCoord.xy / outputSize.xy;\\n vec4 e = k();\\n e = d(e.rgb, rgbmRange);\\n gl_FragColor = e;\\n}\", this._blur1Shader = new Et(_e65), _e65.frag = \"#version 100\\nprecision highp float;\\nuniform float rgbmRange;\\nuniform sampler2D TextureBlurInput;\\nuniform sampler2D TextureInput;\\nuniform vec2 blurDir;\\nuniform vec2 pixelRatio;\\nuniform vec2 outputSize;\\n#define SHADER_NAME GAUSSIAN_BLUR2\\nvec2 c;\\nvec4 d(const in vec3 e, const in float f) {\\n if(f <= .0)\\n return vec4(e, 1.);\\n vec4 h;\\n vec3 i = e / f;\\n h.a = clamp(max(max(i.r, i.g), max(i.b, 1e-6)), .0, 1.);\\n h.a = ceil(h.a * 255.) / 255.;\\n h.rgb = i / h.a;\\n return h;\\n}\\nvec3 j(const in vec4 e, const in float f) {\\n if(f <= .0)\\n return e.rgb;\\n return f * e.rgb * e.a;\\n}\\nvec4 k() {\\n vec3 l = .2734375 * (vec4(j(texture2D(TextureBlurInput, c.xy), rgbmRange), 1.)).rgb;\\n vec2 m;\\n vec2 n = pixelRatio.xy * blurDir.xy / outputSize.xy;\\n m = n * 1.3333333333333333;\\n l += .328125 * (vec4(j(texture2D(TextureBlurInput, c.xy + m.xy), rgbmRange), 1.)).rgb;\\n l += .328125 * (vec4(j(texture2D(TextureBlurInput, c.xy - m.xy), rgbmRange), 1.)).rgb;\\n m = n * 3.111111111111111;\\n l += .03515625 * (vec4(j(texture2D(TextureBlurInput, c.xy + m.xy), rgbmRange), 1.)).rgb;\\n l += .03515625 * (vec4(j(texture2D(TextureBlurInput, c.xy - m.xy), rgbmRange), 1.)).rgb;\\n return vec4(l, 1.);\\n}\\nvoid main(void) {\\n c = gl_FragCoord.xy / outputSize.xy;\\n vec4 e = k();\\n e = d(e.rgb, rgbmRange);\\n gl_FragColor = e;\\n}\", this._blur2Shader = new Et(_e65), _e65.frag = \"#version 100\\nprecision highp float;\\nuniform float rgbmRange;\\nuniform sampler2D TextureBlurInput;\\nuniform sampler2D TextureInput;\\nuniform vec2 blurDir;\\nuniform vec2 pixelRatio;\\nuniform vec2 outputSize;\\n#define SHADER_NAME GAUSSIAN_BLUR3\\nvec2 c;\\nvec4 d(const in vec3 e, const in float f) {\\n if(f <= .0)\\n return vec4(e, 1.);\\n vec4 h;\\n vec3 i = e / f;\\n h.a = clamp(max(max(i.r, i.g), max(i.b, 1e-6)), .0, 1.);\\n h.a = ceil(h.a * 255.) / 255.;\\n h.rgb = i / h.a;\\n return h;\\n}\\nvec3 j(const in vec4 e, const in float f) {\\n if(f <= .0)\\n return e.rgb;\\n return f * e.rgb * e.a;\\n}\\nvec4 k() {\\n vec3 l = .24609375 * (vec4(j(texture2D(TextureBlurInput, c.xy), rgbmRange), 1.)).rgb;\\n vec2 m;\\n vec2 n = pixelRatio.xy * blurDir.xy / outputSize.xy;\\n m = n * 1.3636363636363635;\\n l += .322265625 * (vec4(j(texture2D(TextureBlurInput, c.xy + m.xy), rgbmRange), 1.)).rgb;\\n l += .322265625 * (vec4(j(texture2D(TextureBlurInput, c.xy - m.xy), rgbmRange), 1.)).rgb;\\n m = n * 3.1818181818181817;\\n l += .0537109375 * (vec4(j(texture2D(TextureBlurInput, c.xy + m.xy), rgbmRange), 1.)).rgb;\\n l += .0537109375 * (vec4(j(texture2D(TextureBlurInput, c.xy - m.xy), rgbmRange), 1.)).rgb;\\n return vec4(l, 1.);\\n}\\nvoid main(void) {\\n c = gl_FragCoord.xy / outputSize.xy;\\n vec4 e = k();\\n e = d(e.rgb, rgbmRange);\\n gl_FragColor = e;\\n}\", this._blur3Shader = new Et(_e65), _e65.frag = \"#version 100\\nprecision highp float;\\nuniform float rgbmRange;\\nuniform sampler2D TextureBlurInput;\\nuniform sampler2D TextureInput;\\nuniform vec2 blurDir;\\nuniform vec2 pixelRatio;\\nuniform vec2 outputSize;\\n#define SHADER_NAME GAUSSIAN_BLUR4\\nvec2 c;\\nvec4 d(const in vec3 e, const in float f) {\\n if(f <= .0)\\n return vec4(e, 1.);\\n vec4 h;\\n vec3 i = e / f;\\n h.a = clamp(max(max(i.r, i.g), max(i.b, 1e-6)), .0, 1.);\\n h.a = ceil(h.a * 255.) / 255.;\\n h.rgb = i / h.a;\\n return h;\\n}\\nvec3 j(const in vec4 e, const in float f) {\\n if(f <= .0)\\n return e.rgb;\\n return f * e.rgb * e.a;\\n}\\nvec4 k() {\\n vec3 l = .2255859375 * (vec4(j(texture2D(TextureBlurInput, c.xy), rgbmRange), 1.)).rgb;\\n vec2 m;\\n vec2 n = pixelRatio.xy * blurDir.xy / outputSize.xy;\\n m = n * 1.3846153846153846;\\n l += .314208984375 * (vec4(j(texture2D(TextureBlurInput, c.xy + m.xy), rgbmRange), 1.)).rgb;\\n l += .314208984375 * (vec4(j(texture2D(TextureBlurInput, c.xy - m.xy), rgbmRange), 1.)).rgb;\\n m = n * 3.230769230769231;\\n l += .06982421875 * (vec4(j(texture2D(TextureBlurInput, c.xy + m.xy), rgbmRange), 1.)).rgb;\\n l += .06982421875 * (vec4(j(texture2D(TextureBlurInput, c.xy - m.xy), rgbmRange), 1.)).rgb;\\n m = n * 5.076923076923077;\\n l += .003173828125 * (vec4(j(texture2D(TextureBlurInput, c.xy + m.xy), rgbmRange), 1.)).rgb;\\n l += .003173828125 * (vec4(j(texture2D(TextureBlurInput, c.xy - m.xy), rgbmRange), 1.)).rgb;\\n return vec4(l, 1.);\\n}\\nvoid main(void) {\\n c = gl_FragCoord.xy / outputSize.xy;\\n vec4 e = k();\\n e = d(e.rgb, rgbmRange);\\n gl_FragColor = e;\\n}\", this._blur4Shader = new Et(_e65), this._level > 5 && (_e65.frag = \"precision highp float;\\nuniform float rgbmRange;\\nuniform sampler2D TextureBlurInput;\\nuniform sampler2D TextureInput;\\nuniform vec2 blurDir;\\nuniform vec2 outSize;\\nuniform vec2 pixelRatio;\\nuniform vec2 outputSize;\\n#define SHADER_NAME GAUSSIAN_BLUR5\\nvec2 c;\\nvec4 d(const in vec3 e, const in float f) {\\n if(f <= .0)\\n return vec4(e, 1.);\\n vec4 h;\\n vec3 i = e / f;\\n h.a = clamp(max(max(i.r, i.g), max(i.b, 1e-6)), .0, 1.);\\n h.a = ceil(h.a * 255.) / 255.;\\n h.rgb = i / h.a;\\n return h;\\n}\\nvec3 j(const in vec4 e, const in float f) {\\n if(f <= .0)\\n return e.rgb;\\n return f * e.rgb * e.a;\\n}\\nvec4 k() {\\n vec3 l = .20947265625 * (vec4(j(texture2D(TextureBlurInput, c.xy), rgbmRange), 1.)).rgb;\\n vec2 m;\\n vec2 n = pixelRatio.xy * blurDir.xy / outputSize.xy;\\n n *= outSize.y * .00075;\\n m = n * 1.4;\\n l += .30548095703125 * (vec4(j(texture2D(TextureBlurInput, c.xy + m.xy), rgbmRange), 1.)).rgb;\\n l += .30548095703125 * (vec4(j(texture2D(TextureBlurInput, c.xy - m.xy), rgbmRange), 1.)).rgb;\\n m = n * 3.2666666666666666;\\n l += .08331298828125 * (vec4(j(texture2D(TextureBlurInput, c.xy + m.xy), rgbmRange), 1.)).rgb;\\n l += .08331298828125 * (vec4(j(texture2D(TextureBlurInput, c.xy - m.xy), rgbmRange), 1.)).rgb;\\n m = n * 5.133333333333334;\\n l += .00640869140625 * (vec4(j(texture2D(TextureBlurInput, c.xy + m.xy), rgbmRange), 1.)).rgb;\\n l += .00640869140625 * (vec4(j(texture2D(TextureBlurInput, c.xy - m.xy), rgbmRange), 1.)).rgb;\\n return vec4(l, 1.);\\n}\\nvoid main(void) {\\n c = gl_FragCoord.xy / outputSize.xy;\\n vec4 e = k();\\n e = d(e.rgb, rgbmRange);\\n gl_FragColor = e;\\n}\", this._blur5Shader = new Et(_e65), _e65.frag = \"#version 100\\nprecision highp float;\\nuniform float rgbmRange;\\nuniform sampler2D TextureBlurInput;\\nuniform sampler2D TextureInput;\\nuniform vec2 blurDir;\\nuniform vec2 outSize;\\nuniform vec2 pixelRatio;\\nuniform vec2 outputSize;\\n#define SHADER_NAME GAUSSIAN_BLUR6\\nvec2 c;\\nvec4 d(const in vec3 e, const in float f) {\\n if(f <= .0)\\n return vec4(e, 1.);\\n vec4 h;\\n vec3 i = e / f;\\n h.a = clamp(max(max(i.r, i.g), max(i.b, 1e-6)), .0, 1.);\\n h.a = ceil(h.a * 255.) / 255.;\\n h.rgb = i / h.a;\\n return h;\\n}\\nvec3 j(const in vec4 e, const in float f) {\\n if(f <= .0)\\n return e.rgb;\\n return f * e.rgb * e.a;\\n}\\nvec4 k() {\\n vec3 l = .196380615234375 * (vec4(j(texture2D(TextureBlurInput, c.xy), rgbmRange), 1.)).rgb;\\n vec2 m;\\n vec2 n = pixelRatio.xy * blurDir.xy / outputSize.xy;\\n n *= outSize.y * .00075;\\n m = n * 1.411764705882353;\\n l += .2967529296875 * (vec4(j(texture2D(TextureBlurInput, c.xy + m.xy), rgbmRange), 1.)).rgb;\\n l += .2967529296875 * (vec4(j(texture2D(TextureBlurInput, c.xy - m.xy), rgbmRange), 1.)).rgb;\\n m = n * 3.2941176470588234;\\n l += .09442138671875 * (vec4(j(texture2D(TextureBlurInput, c.xy + m.xy), rgbmRange), 1.)).rgb;\\n l += .09442138671875 * (vec4(j(texture2D(TextureBlurInput, c.xy - m.xy), rgbmRange), 1.)).rgb;\\n m = n * 5.176470588235294;\\n l += .0103759765625 * (vec4(j(texture2D(TextureBlurInput, c.xy + m.xy), rgbmRange), 1.)).rgb;\\n l += .0103759765625 * (vec4(j(texture2D(TextureBlurInput, c.xy - m.xy), rgbmRange), 1.)).rgb;\\n return vec4(l, 1.);\\n}\\nvoid main(void) {\\n c = gl_FragCoord.xy / outputSize.xy;\\n vec4 e = k();\\n e = d(e.rgb, rgbmRange);\\n gl_FragColor = e;\\n}\", this._blur6Shader = new Et(_e65));\n }\n } }]);\n\n }();\n var Lt = exports.BloomPass = function () {\n function Lt(e) {\n _classCallCheck(this, Lt);\n this._regl = e, this._renderer = new Ve(e);\n }\n return _createClass(Lt, [{\n key: \"render\",\n value: function render(e, t, n, r, i, o, a, s, c) {\n this._initShaders(), this._createTextures(e);\n var l = this._blurPass.render(t, n);\n return this._combine(e, l, t, r, i, o, a, s, c);\n } },\n {\n key: \"_combine\",\n value: function _combine(e, t, n, r, o, a, s, c, l) {\n l || this._combineTex.width === e.width && this._combineTex.height === e.height || this._combineFBO.resize(e.width, e.height);\n var f = this._combineUniforms;\n var d = t.blurTex0,\n u = t.blurTex1,\n h = t.blurTex2,\n m = t.blurTex3,\n v = t.blurTex4;\n f || (f = this._combineUniforms = {\n bloomFactor: 0,\n bloomRadius: 0,\n rgbmRange: 7,\n TextureBloomBlur1: d,\n TextureBloomBlur2: u,\n TextureBloomBlur3: h,\n TextureBloomBlur4: m,\n TextureBloomBlur5: v,\n TextureInput: null,\n TextureSource: null,\n outputSize: [0, 0] }),\n f.noAaTextureSource = a, f.pointTextureSource = s, f.enableAA = c, f.bloomFactor = r, f.bloomRadius = o, f.TextureInput = n, f.TextureSource = e, _glMatrix.vec2.set(f.outputSize, e.width, e.height);\n var _ = {};\n return a ? _.HAS_NOAA_TEX = 1 : delete _.HAS_NOAA_TEX, s ? _.HAS_POINT_TEX = 1 : delete _.HAS_POINT_TEX, this._combineShader.setDefines(_), this._renderer.render(this._combineShader, f, null, l ? null : this._combineFBO), l ? null : this._combineTex;\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n this._combineFBO && (this._combineFBO.destroy(), delete this._combineFBO), this._blurPass && (this._blurPass.dispose(), delete this._blurPass), delete this._uniforms;\n } },\n {\n key: \"_createTextures\",\n value: function _createTextures(e) {\n if (this._combineTex) return;\n this._combineTex = this._createColorTex(e, e.width, e.height, \"uint8\"), this._combineFBO = this._createBlurFBO(this._combineTex);\n } },\n {\n key: \"_createColorTex\",\n value: function _createColorTex(e, t, n, r) {\n return this._renderer.regl.texture({\n min: \"linear\",\n mag: \"linear\",\n type: r,\n width: t || e.width,\n height: n || e.height });\n\n } },\n {\n key: \"_createBlurFBO\",\n value: function _createBlurFBO(e) {\n return this._renderer.regl.framebuffer({\n width: e.width,\n height: e.height,\n colors: [e],\n depth: !1,\n stencil: !1 });\n\n } },\n {\n key: \"_initShaders\",\n value: function _initShaders() {\n if (!this._combineShader) {\n var _e66 = {\n x: 0,\n y: 0,\n width: function width(e, t) {\n return t.outputSize[0];\n },\n height: function height(e, t) {\n return t.outputSize[1];\n } };\n\n this._blurPass = new Nt(this._regl, !1), this._combineShader = new Et({\n vert: Mt,\n frag: \"precision highp float;\\nuniform float bloomFactor;\\nuniform float bloomRadius;\\nuniform float rgbmRange;\\nuniform sampler2D TextureBloomBlur1;\\nuniform sampler2D TextureBloomBlur2;\\nuniform sampler2D TextureBloomBlur3;\\nuniform sampler2D TextureBloomBlur4;\\nuniform sampler2D TextureBloomBlur5;\\nuniform sampler2D TextureInput;\\nuniform sampler2D TextureSource;\\n#ifdef HAS_NOAA_TEX\\nuniform sampler2D noAaTextureSource;\\n#endif\\n#ifdef HAS_POINT_TEX\\nuniform sampler2D pointTextureSource;\\n#endif\\nuniform float enableAA;\\nuniform vec2 outputSize;\\n#define SHADER_NAME bloomCombine\\nvec2 c;\\n#include \\nvec3 d(const in vec4 e, const in float f) {\\n if(f <= .0)\\n return e.rgb;\\n return f * e.rgb * e.a;\\n}\\nfloat h(const float i, const float j) {\\n return mix(i, j * 2. - i, bloomRadius);\\n}\\nvec4 k() {\\n vec3 l = vec3(.0);\\n const float m = .6;\\n const float n = 1.1;\\n const float o = .9;\\n const float u = .6;\\n const float v = .3;\\n const float A = .1;\\n l += (vec4(d(texture2D(TextureBloomBlur1, c), rgbmRange), 1.)).rgb * h(n, m);\\n l += (vec4(d(texture2D(TextureBloomBlur2, c), rgbmRange), 1.)).rgb * h(o, m);\\n l += (vec4(d(texture2D(TextureBloomBlur3, c), rgbmRange), 1.)).rgb * h(u, m);\\n l += (vec4(d(texture2D(TextureBloomBlur4, c), rgbmRange), 1.)).rgb * h(v, m);\\n l += (vec4(d(texture2D(TextureBloomBlur5, c), rgbmRange), 1.)).rgb * h(A, m);\\n vec4 B;\\n if(enableAA == 1.) {\\n \\n } else {\\n B = texture2D(TextureInput, c);\\n }\\n B.rgb = mix(vec3(.0), B.rgb, sign(B.a));\\n vec4 C = texture2D(TextureSource, c);\\n#ifdef HAS_NOAA_TEX\\nvec4 D = texture2D(noAaTextureSource, c);\\n C = D + C * (1. - D.a);\\n#endif\\nvec4 E = vec4(.0);\\n#ifdef HAS_POINT_TEX\\nE = texture2D(pointTextureSource, c);\\n#endif\\nfloat F = sqrt((l.r + l.g + l.b) / 3.);\\n vec4 G = vec4(linearTosRGB(l * bloomFactor), F);\\n return E + (B + C * (1. - B.a)) * (1. - E.a) + G;\\n}\\nvoid main(void) {\\n c = gl_FragCoord.xy / outputSize.xy;\\n vec4 e = k();\\n gl_FragColor = e;\\n}\",\n extraCommandProps: {\n viewport: _e66 } });\n\n\n }\n } }]);\n\n }();\n var kt = function (_Et4) {\n function kt() {\n var _this16;\n _classCallCheck(this, kt);\n var e = [];\n _this16 = _callSuper(this, kt, [{\n vert: Mt,\n frag: \"precision highp float;\\n#include \\n#define SHADER_NAME COPY_DEPTH\\nuniform sampler2D TextureDepth;\\nuniform vec2 textureSize;\\n#include \\nvoid main(void) {\\n vec2 c = gl_FragCoord.xy / textureSize.xy;\\n float d = texture2D(TextureDepth, c).r;\\n glFragColor = common_encodeDepth(d);\\n#if __VERSION__ == 100\\ngl_FragColor = glFragColor;\\n#endif\\n}\",\n uniforms: [{\n name: \"textureSize\",\n type: \"function\",\n fn: function fn(t, n) {\n return e[0] = n.TextureDepth.width, e[1] = n.TextureDepth.height, e;\n } }],\n\n extraCommandProps: {\n viewport: {\n x: 0,\n y: 0,\n width: function width(e, t) {\n return t.TextureDepth.width;\n },\n height: function height(e, t) {\n return t.TextureDepth.height;\n } } } }]),\n\n\n _this16.version = 300;\n return _this16;\n }\n _inherits(kt, _Et4);\n return _createClass(kt, [{\n key: \"getMeshCommand\",\n value: function getMeshCommand(e, t) {\n return this.commands.copy_depth || (this.commands.copy_depth = this.createREGLCommand(e, null, t.getElements())), this.commands.copy_depth;\n } }]);\n\n }(Et);\n var Bt = exports.SsrPass = function () {\n function Bt(e) {\n _classCallCheck(this, Bt);\n this._regl = e, this._renderer = new Ve(e), this._inputRGBM = 0;\n }\n return _createClass(Bt, [{\n key: \"setup\",\n value: function setup(e) {\n this._initShaders(), this._createTextures(e);\n } },\n {\n key: \"getSSRUniforms\",\n value: function getSSRUniforms(e, t, n) {\n if (!this._depthCopy) return null;\n var r = this._depthCopy;\n return {\n TextureDepth: r,\n TextureReflected: this.getMipmapTexture(),\n ssrFactor: t || 1,\n ssrQuality: n || 2,\n outSize: [r.width, r.height],\n fov: e.getFov() * Math.PI / 180,\n prevProjViewMatrix: this._projViewMatrix || e.projViewMatrix,\n cameraWorldMatrix: e.cameraWorldMatrix };\n\n } },\n {\n key: \"genMipMap\",\n value: function genMipMap(t, n, r) {\n return this.setup(t), this._mipmap(t), this.copyDepthTex(n), this._projViewMatrix || (this._projViewMatrix = []), _glMatrix.mat4.copy(this._projViewMatrix, r), delete this._depthCopied, this._outputTex;\n } },\n {\n key: \"getPrevProjViewMatrix\",\n value: function getPrevProjViewMatrix() {\n return this._projViewMatrix;\n } },\n {\n key: \"copyDepthTex\",\n value: function copyDepthTex(e) {\n if (this._depthCopied) return null;\n if (this.setup(e), this._depthCopy) e.width === this._depthCopy.width && e.height === this._depthCopy.height || this._depthCopyFBO.resize(e.width, e.height);else {\n this._depthCopy = this._regl.texture({\n min: \"nearest\",\n mag: \"nearest\",\n mipmap: !1,\n type: \"uint8\",\n width: e.width,\n height: e.height });\n\n this._depthCopyFBO = this._regl.framebuffer({\n width: e.width,\n height: e.height,\n colors: [this._depthCopy],\n colorFormat: \"rgba\" });\n\n }\n return this._renderer.render(this._copyDepthShader, {\n TextureDepth: e },\n null, this._depthCopyFBO), this._depthCopied = !0, this._depthCopy;\n } },\n {\n key: \"_mipmap\",\n value: function _mipmap(e) {\n var t = this._targetFBO,\n n = Math.ceil(.5 * e.width),\n r = Math.ceil(.5 * e.height);\n t.width === n && t.height === r || t.resize(n, r);\n var o = this._blurUniforms;\n o || (o = this._blurUniforms = {\n rgbmRange: 7,\n outputSize: [0, 0] }),\n o.TextureInput = e, o.inputRGBM = +this._inputRGBM, _glMatrix.vec2.set(o.outputSize, t.width, t.height), this._renderer.render(this._ssrQuadShader, o, null, t);\n } },\n {\n key: \"getMipmapTexture\",\n value: function getMipmapTexture() {\n return this._outputTex || (this._outputTex = this._renderer.regl.texture({\n type: \"uint8\",\n width: 2,\n height: 2 })),\n this._outputTex;\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n this._copyDepthShader && (this._ssrQuadShader.dispose(), this._copyDepthShader.dispose(), this._targetFBO.destroy(), delete this._copyDepthShader), this._depthCopy && (this._depthCopyFBO.destroy(), delete this._depthCopy, delete this._depthCopyFBO);\n } },\n {\n key: \"_initShaders\",\n value: function _initShaders() {\n if (!this._copyDepthShader) {\n this._copyDepthShader = new kt();\n this._ssrQuadShader = new Et({\n vert: Mt,\n frag: \"#version 100\\nprecision mediump float;\\nuniform sampler2D TextureInput;\\nuniform vec2 outputSize;\\n#define SHADER_NAME QUAD\\nvec2 c;\\nvoid main(void) {\\n c = gl_FragCoord.xy / outputSize.xy;\\n vec4 d = texture2D(TextureInput, c.xy);\\n gl_FragColor = d;\\n}\",\n extraCommandProps: {\n viewport: {\n x: 0,\n y: 0,\n width: function width(e, t) {\n return t.outputSize[0];\n },\n height: function height(e, t) {\n return t.outputSize[1];\n } } } });\n\n\n\n }\n } },\n {\n key: \"_createTextures\",\n value: function _createTextures(e) {\n if (!this._targetFBO) {\n var _t53 = this._regl;\n this._outputTex && this._outputTex.destroy(), this._outputTex = _t53.texture({\n min: \"linear\",\n mag: \"linear\",\n type: \"uint8\",\n width: e.width,\n height: e.height }),\n this._targetFBO = _t53.framebuffer({\n width: e.width,\n height: e.height,\n colors: [this._outputTex],\n depth: !1,\n stencil: !1 });\n\n }\n } }],\n [{\n key: \"getUniformDeclares\",\n value: function getUniformDeclares() {\n var t = [[0, 0, 0, 0], [0, 0, 0, 0]],\n r = new Array(16);\n return [{\n name: \"invProjMatrix\",\n type: \"function\",\n fn: function fn(t, n) {\n return _glMatrix.mat4.invert(r, n.projMatrix);\n } },\n {\n name: \"outputFovInfo\",\n type: \"array\",\n length: 2,\n fn: function fn(e, r) {\n var i = Math.tan(.5 * r.fov),\n o = r.outSize[0] / r.outSize[1] * i;\n return _glMatrix.vec4.set(t[0], o, i, o, -i), _glMatrix.vec4.set(t[1], -o, i, -o, -i), t;\n } },\n {\n name: \"reprojViewProjMatrix\",\n type: \"function\",\n fn: function fn(t, n) {\n return _glMatrix.mat4.multiply([], n.prevProjViewMatrix, n.cameraWorldMatrix);\n } }];\n\n } },\n {\n key: \"getDefines\",\n value: function getDefines() {\n return {\n HAS_SSR: 1 };\n\n } }]);\n\n }();\n var zt = exports.HeatmapShader = function (_yt5) {\n function zt(t) {\n _classCallCheck(this, zt);\n var n = [];\n return _callSuper(this, zt, [{\n vert: \"#define SHADER_NAME HEATMAP\\nuniform mat4 projViewModelMatrix;\\nuniform float extrudeScale;\\nuniform float heatmapIntensity;\\nattribute vec3 aPosition;\\nvarying vec2 vExtrude;\\n#ifdef HAS_HEAT_WEIGHT\\nattribute highp float aWeight;\\nvarying highp float weight;\\n#else\\nuniform highp float heatmapWeight;\\n#endif\\nuniform mediump float heatmapRadius;\\nconst highp float c = 1. / 255. / 16.;\\n#define GAUSS_COEF 0.3989422804014327\\nvoid main(void) {\\n \\n#ifdef HAS_HEAT_WEIGHT\\nhighp float d = aWeight / 255.;\\n weight = d;\\n#else\\nhighp float d = heatmapWeight;\\n#endif\\nmediump float e = heatmapRadius;\\n vec2 f = vec2(mod(aPosition.xy, 2.) * 2. - 1.);\\n float h = sqrt(-2. * log(c / d / heatmapIntensity / GAUSS_COEF)) / 3.;\\n vExtrude = h * f;\\n vec2 i = vExtrude * e * extrudeScale;\\n vec4 j = vec4(floor(aPosition.xy * .5) + i, aPosition.z, 1);\\n gl_Position = projViewModelMatrix * j;\\n}\",\n frag: \"#define SHADER_NAME HEATMAP\\nprecision mediump float;\\nuniform highp float heatmapIntensity;\\nvarying vec2 vExtrude;\\n#ifdef HAS_HEAT_WEIGHT\\nvarying highp float weight;\\n#else\\nuniform highp float heatmapWeight;\\n#endif\\n#define GAUSS_COEF 0.3989422804014327\\nvoid main() {\\n \\n#ifdef HAS_HEAT_WEIGHT\\nhighp float c = weight;\\n#else\\nhighp float c = heatmapWeight;\\n#endif\\nfloat d = -.5 * 3. * 3. * dot(vExtrude, vExtrude);\\n float e = c * heatmapIntensity * GAUSS_COEF * exp(d);\\n gl_FragColor = vec4(e, 1., 1., 1.);\\n}\",\n uniforms: [{\n name: \"extrudeScale\",\n type: \"function\",\n fn: function fn(e, t) {\n return t.resolution / t.dataResolution * t.tileRatio;\n } },\n {\n name: \"projViewModelMatrix\",\n type: \"function\",\n fn: function fn(t, r) {\n return _glMatrix.mat4.multiply(n, r.projViewMatrix, r.modelMatrix);\n } }],\n\n extraCommandProps: v({}, t && t.extraCommandProps || {}, {\n blend: {\n enable: !0,\n func: {\n src: \"one\",\n dst: \"one\" },\n\n equation: \"add\" } }) }]);\n\n\n\n }\n _inherits(zt, _yt5);\n return _createClass(zt);\n }(yt);\n var Gt = [-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, -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],\n Vt = \"#define SHADER_NAME SKYBOX\\n#if __VERSION__ == 100\\n#ifdef GL_EXT_shader_texture_lod\\n#extension GL_EXT_shader_texture_lod : enable\\n#define textureCubeLod(tex, uv, lod) textureCubeLodEXT(tex, uv, lod)\\n#else\\n#define textureCubeLod(tex, uv, lod) textureCube(tex, uv, lod)\\n#endif\\n#else\\n#define textureCubeLod(tex, uv, lod) textureLod(tex, uv, lod)\\n#endif\\nprecision highp float;\\n#define saturate(x) clamp(x, 0.0, 1.0)\\n#include \\n#include \\nuniform vec3 hsv;\\nvarying vec3 vWorldPos;\\n#ifdef USE_AMBIENT\\nuniform vec3 diffuseSPH[9];\\n#else\\nuniform samplerCube cubeMap;\\nuniform float bias;\\nuniform float size;\\n#endif\\nuniform float environmentExposure;\\nuniform float backgroundIntensity;\\nvec4 c(const in samplerCube d, const in vec3 e, const in float f, const in float h) {\\n vec3 i = e;\\n return textureCubeLod(d, i, h);\\n}\\nvec3 j(const in vec3 k, const in vec3 l[9]) {\\n float x = k.x;\\n float y = k.y;\\n float z = k.z;\\n vec3 m = (l[0] + l[1] * x + l[2] * y + l[3] * z + l[4] * z * x + l[5] * y * z + l[6] * y * x + l[7] * (3. * z * z - 1.) + l[8] * (x * x - y * y));\\n return max(m, vec3(.0));\\n}\\nfloat n(const in vec2 o) {\\n vec3 u = fract(vec3(o.xyx) * .1031);\\n u += dot(u, u.yzx + 19.19);\\n return fract((u.x + u.y) * u.z);\\n}\\n#if defined(TONE_MAPPING)\\nconst float v = 1.;\\nvec3 A(vec3 B) {\\n vec3 a = B * (B + .0245786) - .000090537;\\n vec3 b = B * (.983729 * B + .4329510) + .238081;\\n return a / b;\\n}\\nvec3 C(vec3 D) {\\n const mat3 E = mat3(vec3(.59719, .07600, .02840), vec3(.35458, .90834, .13383), vec3(.04823, .01566, .83777));\\n const mat3 F = mat3(vec3(1.60475, -.10208, -.00327), vec3(-.53108, 1.10813, -.07276), vec3(-.07367, -.00605, 1.07602));\\n D *= v / .6;\\n D = E * D;\\n D = A(D);\\n D = F * D;\\n return saturate(D);\\n}\\nvec3 G(vec3 D) {\\n return C(D);\\n}\\nvec4 H(in vec4 I) {\\n return vec4(mix(pow(I.rgb, vec3(.41666)) * 1.055 - vec3(.055), I.rgb * 12.92, vec3(lessThanEqual(I.rgb, vec3(.0031308)))), I.a);\\n}\\nvec4 J(vec4 I) {\\n return (H(I));\\n}\\n#endif\\nvoid main() {\\n vec4 K;\\n#ifdef USE_AMBIENT\\nvec3 k = normalize(vWorldPos + mix(-.5 / 255., .5 / 255., n(gl_FragCoord.xy)) * 2.);\\n K = vec4(j(k, diffuseSPH), 1.);\\n#else\\nK = c(cubeMap, vWorldPos, size, bias);\\n#endif\\nK.rgb *= environmentExposure;\\n K.rgb *= backgroundIntensity;\\n glFragColor = K;\\n if(length(hsv) > .0) {\\n glFragColor.rgb = hsv_apply(clamp(glFragColor.rgb, .0, 1.), hsv);\\n }\\n#if defined(TONE_MAPPING)\\nglFragColor.rgb = G(glFragColor.rgb);\\n glFragColor = J(glFragColor);\\n#endif\\n#if __VERSION__ == 100\\ngl_FragColor = glFragColor;\\n#endif\\n}\";\n var Ut = exports.SkyboxShader = function (_yt6) {\n function Ut() {\n var _this17;\n _classCallCheck(this, Ut);\n _this17 = _callSuper(this, Ut, [{\n vert: \"#include \\nattribute vec3 aPosition;\\nuniform mat4 projMatrix;\\nuniform mat4 viewMatrix;\\nuniform mat3 transformMatrix;\\nvarying vec3 vWorldPos;\\nvoid main() {\\n vWorldPos = aPosition;\\n mat4 c = mat4(mat3(viewMatrix) * transformMatrix);\\n vec4 d = projMatrix * c * vec4(vWorldPos, 1.);\\n gl_Position = d.xyww;\\n}\",\n frag: Vt,\n extraCommandProps: {\n depth: {\n enable: !0,\n range: [1, 1],\n func: \"lequal\" },\n\n viewport: {\n x: 0,\n y: 0,\n width: function width(e, t) {\n return t.resolution[0];\n },\n height: function height(e, t) {\n return t.resolution[1];\n } } } }]),\n\n\n _this17.version = 300;\n return _this17;\n }\n _inherits(Ut, _yt6);\n return _createClass(Ut, [{\n key: \"setMode\",\n value: function setMode(e, t) {\n var n = {};\n return e && (n.TONE_MAPPING = 1), 0 === t && (n.USE_AMBIENT = 1), this._skyboxMesh ? this._skyboxMesh[0].setDefines(n) : this._meshDefines = n, this;\n } },\n {\n key: \"draw\",\n value: function draw(e) {\n return this._skyboxMesh || this._createSkyboxMesh(e), _superPropGet(Ut, \"draw\", this, 3)([e, this._skyboxMesh]);\n } },\n {\n key: \"_createSkyboxMesh\",\n value: function _createSkyboxMesh(e) {\n var t = new Z({\n aPosition: new Int8Array(Gt) },\n null, Gt.length / 3);\n t.generateBuffers(e), this._skyboxMesh = [new Be(t)], this._meshDefines && (this._skyboxMesh[0].setDefines(this._meshDefines), delete this._meshDefines);\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n if (this._skyboxMesh) {\n var _e67 = this._skyboxMesh[0];\n _e67.geometry.dispose(), _e67.dispose();\n }\n return delete this._skyboxMesh, _superPropGet(Ut, \"dispose\", this, 3)([]);\n } }]);\n\n }(yt);\n var jt = exports.HeatmapDisplayShader = function (_yt7) {\n function jt(t, n) {\n _classCallCheck(this, jt);\n var r = {\n blend: {\n enable: !0,\n func: {\n src: \"one\",\n dst: \"one minus src alpha\" },\n\n equation: \"add\" },\n\n viewport: t };\n\n n && n.extraCommandProps && v(r, n.extraCommandProps);\n var i = [];\n return _callSuper(this, jt, [{\n vert: \"#define SHADER_NAME HEATMAP_DISPLAY\\nuniform mat4 projViewModelMatrix;\\nattribute vec3 aPosition;\\nvoid main() {\\n gl_Position = projViewModelMatrix * vec4(aPosition, 1.);\\n}\",\n frag: \"#define SHADER_NAME HEATMAP_DISPLAY\\nprecision mediump float;\\nuniform sampler2D inputTexture;\\nuniform sampler2D colorRamp;\\nuniform vec2 textureOutputSize;\\nuniform float heatmapOpacity;\\nvoid main() {\\n vec2 c = gl_FragCoord.xy / textureOutputSize.xy;\\n float t = texture2D(inputTexture, c).r;\\n vec4 d = texture2D(colorRamp, vec2(t, .5));\\n gl_FragColor = d * heatmapOpacity;\\n}\",\n uniforms: [{\n name: \"projViewModelMatrix\",\n type: \"function\",\n fn: function fn(t, n) {\n return _glMatrix.mat4.multiply(i, n.projViewMatrix, n.modelMatrix);\n } }],\n\n extraCommandProps: r }]);\n\n }\n _inherits(jt, _yt7);\n return _createClass(jt);\n }(yt);\n var Xt = exports.WaterShader = function (_yt8) {\n function Xt() {\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, Xt);\n return _callSuper(this, Xt, [{\n vert: \"precision highp float;\\nprecision highp sampler2D;\\nconst float c = 3.141592653589793;\\nuniform mat4 projMatrix;\\nuniform mat4 viewMatrix;\\nuniform mat4 modelMatrix;\\nattribute vec3 aPosition;\\nattribute vec2 aTexCoord;\\nattribute vec3 aNormal;\\nvarying vec2 vuv;\\nvarying vec3 vpos;\\nvarying vec3 vnormal;\\nvarying mat3 vtbnMatrix;\\nvec4 d(mat4 e, mat4 f, vec3 h) {\\n return e * modelMatrix * f * vec4(h, 1.);\\n}\\nvec3 i(in vec3 h, in vec3 j) {\\n return normalize(h + j);\\n}\\nmat3 k(in vec3 l) {\\n vec3 t = normalize(cross(vec3(.0, .0, 1.), l));\\n vec3 b = normalize(cross(l, t));\\n return mat3(t, b, l);\\n}\\nvoid m() {\\n \\n}\\nvoid main(void) {\\n vuv = aTexCoord;\\n vpos = (modelMatrix * vec4(aPosition, 1.)).xyz;\\n vnormal = aNormal;\\n vtbnMatrix = k(vnormal);\\n gl_Position = d(projMatrix, viewMatrix, vpos);\\n m();\\n}\",\n frag: \"precision highp float;\\nprecision highp sampler2D;\\nuniform sampler2D texWaveNormal;\\nuniform sampler2D texWavePerturbation;\\nuniform vec3 octaveTextureRepeat;\\nuniform vec4 waveParams;\\nuniform vec2 waveDirection;\\nuniform vec4 waterColor;\\nuniform vec3 lightingDirection;\\nuniform vec3 lightingIntensity;\\nuniform vec3 camPos;\\nuniform float timeElapsed;\\nvarying vec2 vuv;\\nvarying vec3 vpos;\\nvarying vec3 vnormal;\\nvarying mat3 vtbnMatrix;\\nconst vec2 c = vec2(6. / 25., 5. / 24.);\\nvec2 d(sampler2D e, vec2 f) {\\n return 2. * texture2D(e, f).rg - 1.;\\n}\\nfloat h(vec2 f) {\\n return texture2D(texWavePerturbation, f).b;\\n}\\nvec3 i(sampler2D e, vec2 f) {\\n return 2. * texture2D(e, f).rgb - 1.;\\n}\\nfloat j(vec2 f, float k) {\\n return fract(k);\\n}\\nfloat l(vec2 f, float k) {\\n float m = j(f, k);\\n return 1. - abs(1. - 2. * m);\\n}\\nvec3 n(sampler2D o, vec2 f, float k, float u) {\\n float v = waveParams[2];\\n float A = waveParams[3];\\n vec2 B = d(o, f) * v;\\n float m = j(f, k + u);\\n float C = l(f, k + u);\\n vec2 D = f;\\n D -= B * (m + A);\\n D += u;\\n D += (k - m) * c;\\n return vec3(D, C);\\n}\\nconst float E = .3737;\\nconst float F = 7.77;\\nvec3 G(sampler2D H, sampler2D I, vec2 f, vec2 J, float k) {\\n float K = waveParams[0];\\n vec2 L = k * -J;\\n float M = h(f * E) * F;\\n vec3 N = n(I, f + L, k + M, .0);\\n vec3 O = n(I, f + L, k + M, .5);\\n vec3 P = i(H, N.xy) * N.z;\\n vec3 Q = i(H, O.xy) * O.z;\\n vec3 R = normalize(P + Q);\\n R.xy *= K;\\n R.z = sqrt(1. - dot(R.xy, R.xy));\\n return R;\\n}\\nvec3 S(vec2 f, float k) {\\n float T = waveParams[1];\\n return G(texWaveNormal, texWavePerturbation, f * T, waveDirection, k);\\n}\\nconst float U = 3.141592653589793;\\nconst float V = 1. / U;\\nconst float W = .3183098861837907;\\nconst float X = 1.570796326794897;\\nstruct PBRShadingWater {\\n float NdotL;\\n float NdotV;\\n float NdotH;\\n float VdotH;\\n float LdotH;\\n float VdotN;\\n};\\nfloat Y = 2.2;\\nvec3 Z(float ba, vec3 bb, float bc) {\\n return bb + (bc - bb) * pow(1. - ba, 5.);\\n}\\nfloat bd(float be, float bf) {\\n float bg = bf * bf;\\n float bh = be * be;\\n float bi = pow((bh * (bg - 1.) + 1.), Y) * U;\\n return bg / bi;\\n}\\nfloat bj(float bk) {\\n return .25 / (bk * bk);\\n}\\nvec3 bl(in PBRShadingWater bm, float bf, vec3 bn, float bo) {\\n vec3 bp = Z(bm.VdotH, bn, bo);\\n float bq = bd(bm.NdotH, bf);\\n float br = bj(bm.LdotH);\\n return (bq * br) * bp;\\n}\\nvec3 bs(const vec3 x) {\\n return (x * (2.51 * x + .03)) / (x * (2.43 * x + .59) + .14);\\n}\\nconst float bt = 2.2;\\nconst float bu = .4545454545;\\nvec4 bv(vec4 bw) {\\n return vec4(pow(bw.rgb, vec3(bu)), bw.w);\\n}\\nvec3 bx(vec3 bw) {\\n return pow(bw, vec3(bt));\\n}\\nconst vec3 by = vec3(.02, 1., 5.);\\nconst vec2 bz = vec2(.02, .1);\\nconst float bf = .06;\\nconst vec3 bA = vec3(0, .6, .9);\\nconst vec3 bB = vec3(.72, .92, 1.);\\nPBRShadingWater bC;\\nvec3 bD(in float bE, in vec3 bF, in vec3 bG) {\\n float bH = pow((1. - bE), by[2]);\\n return mix(bG, bF, bH);\\n}\\nvec3 bI(in vec3 bJ, in vec3 bK, in vec3 bL, vec3 bw, in vec3 bM, in vec3 bN, in float bO) {\\n vec3 bP = bx(bw);\\n vec3 bQ = normalize(bL + bK);\\n bC.NdotL = clamp(dot(bJ, bL), .0, 1.);\\n bC.NdotV = clamp(dot(bJ, bK), .001, 1.);\\n bC.VdotN = clamp(dot(bK, bJ), .001, 1.);\\n bC.NdotH = clamp(dot(bJ, bQ), .0, 1.);\\n bC.VdotH = clamp(dot(bK, bQ), .0, 1.);\\n bC.LdotH = clamp(dot(bL, bQ), .0, 1.);\\n float bR = max(dot(bN, bK), .0);\\n vec3 bS = bx(bB);\\n vec3 bT = bx(bA);\\n vec3 bB = bD(bR, bS, bT);\\n float bU = max(dot(bN, bL), .0);\\n bB *= .1 + bU * .9;\\n float bV = clamp(bO, .8, 1.);\\n vec3 bW = Z(bC.VdotN, vec3(by[0]), by[1]) * bB * bV;\\n vec3 bX = bP * mix(bB, bU * bM * V, 2. / 3.) * bV;\\n vec3 bY = vec3(.0);\\n if(bR > .0 && bU > .0) {\\n vec3 bZ = bl(bC, bf, vec3(bz[0]), bz[1]);\\n vec3 ca = bM * V * bO;\\n bY = bC.NdotL * ca * bZ;\\n }\\n return bs(bW + bX + bY);\\n}\\nvoid main() {\\n vec3 bN = vnormal;\\n vec3 cb = S(vuv, timeElapsed);\\n vec3 bJ = normalize(vtbnMatrix * cb);\\n vec3 bK = -normalize(vpos - camPos);\\n vec3 bL = normalize(-lightingDirection);\\n float bO = 1.;\\n vec4 cc = vec4(bI(bJ, bK, bL, waterColor.rgb, lightingIntensity, bN, bO), waterColor.w);\\n gl_FragColor = bv(cc);\\n}\",\n defines: e.defines || {},\n extraCommandProps: e.extraCommandProps || {} }]);\n\n }\n _inherits(Xt, _yt8);\n return _createClass(Xt);\n }(yt);\n var Wt = exports.CopyShader = function (_Et5) {\n function Wt() {\n _classCallCheck(this, Wt);\n return _callSuper(this, Wt, [{\n vert: Mt,\n frag: \"precision highp float;\\nuniform sampler2D texture;\\nuniform vec2 size;\\nuniform float enableSharpen;\\nuniform float sharpFactor;\\nuniform float pixelRatio;\\nvec2 c;\\nvec3 d(const in vec3 e, const float f) {\\n vec2 h = pixelRatio / size.xy;\\n float i = .0;\\n vec4 j = texture2D(texture, c + h * vec2(-1., -1.));\\n j.rgb = mix(vec3(.0), j.rgb, sign(j.a));\\n i += mix(.0, 1., sign(j.a));\\n vec4 k = texture2D(texture, c + h * vec2(1.));\\n k.rgb = mix(vec3(.0), k.rgb, sign(k.a));\\n i += mix(.0, 1., sign(k.a));\\n vec4 l = texture2D(texture, c + h * vec2(1., -1.));\\n l.rgb = mix(vec3(.0), l.rgb, sign(l.a));\\n i += mix(.0, 1., sign(l.a));\\n vec4 m = texture2D(texture, c + h * vec2(-1., 1.));\\n m.rgb = mix(vec3(.0), m.rgb, sign(m.a));\\n i += mix(.0, 1., sign(m.a));\\n return e + f * (i * e - j.rgb - l.rgb - m.rgb - k.rgb);\\n}\\nvoid main() {\\n c = gl_FragCoord.xy / size;\\n vec4 e = texture2D(texture, c);\\n if(enableSharpen == 1.) {\\n e.rgb = d(e.rgb, sharpFactor);\\n }\\n gl_FragColor = e;\\n}\",\n extraCommandProps: {\n viewport: {\n x: 0,\n y: 0,\n width: function width(e, t) {\n return t.size[0];\n },\n height: function height(e, t) {\n return t.size[1];\n } } } }]);\n\n\n\n }\n _inherits(Wt, _Et5);\n return _createClass(Wt, [{\n key: \"getMeshCommand\",\n value: function getMeshCommand(e, t) {\n return this.commands.copy || (this.commands.copy = this.createREGLCommand(e, null, t.getElements())), this.commands.copy;\n } }]);\n\n }(Et);\n var qt = exports.EdgeShader = function (_yt9) {\n function qt() {\n var _this18;\n var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, qt);\n var n = [],\n r = t.uniforms,\n i = [{\n name: \"modelViewMatrix\",\n type: \"function\",\n fn: function fn(t, r) {\n return _glMatrix.mat4.multiply(n, r.viewMatrix, r.modelMatrix);\n } }];\n\n r && i.push.apply(i, _toConsumableArray(r)), _this18 = _callSuper(this, qt, [{\n vert: \"attribute vec3 aPosition;\\nuniform mat4 projMatrix;\\nuniform mat4 modelMatrix;\\nuniform mat4 positionMatrix;\\nuniform mat4 modelViewMatrix;\\n#include \\nvoid main() {\\n vec4 c = getPosition(aPosition);\\n mat4 d = getPositionMatrix();\\n gl_Position = projMatrix * modelViewMatrix * d * c;\\n}\",\n frag: \"precision mediump float;\\nuniform vec4 lineColor;\\nuniform float lineOpacity;\\nvoid main() {\\n gl_FragColor = lineColor;\\n gl_FragColor.a *= lineOpacity;\\n}\",\n uniforms: i,\n defines: t.defines || {},\n extraCommandProps: t.extraCommandProps || {} }]);\n\n return _this18;\n }\n _inherits(qt, _yt9);\n return _createClass(qt);\n }(yt);\n var Kt = [],\n Jt = [];\n var Yt = exports.StandardLiteShader = function (_yt10) {\n function Yt() {\n var _this19;\n var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, Yt);\n var n = [],\n i = t.uniforms,\n o = [{\n name: \"viewMatrixInverse\",\n type: \"function\",\n fn: function fn(t, n) {\n return _glMatrix.mat4.invert(Kt, n.viewMatrix);\n } },\n {\n name: \"modelViewMatrix\",\n type: \"function\",\n fn: function fn(t, r) {\n return _glMatrix.mat4.multiply(n, r.viewMatrix, r.modelMatrix);\n } },\n {\n name: \"environmentTransform\",\n type: \"function\",\n fn: function fn(e, t) {\n return _glMatrix.mat3.fromRotation(Jt, Math.PI * (t.environmentOrientation || 0) / 180);\n } }];\n\n i && o.push.apply(o, _toConsumableArray(i)), _this19 = _callSuper(this, Yt, [{\n vert: \"precision mediump float;\\n#include \\nattribute vec3 aPosition;\\n#include \\n#ifdef HAS_MAP\\nuniform vec2 uvScale;\\nuniform vec2 uvOffset;\\nattribute vec2 aTexCoord;\\nvarying vec2 vTexCoord;\\n#ifdef HAS_I3S_UVREGION\\nattribute vec4 uvRegion;\\nvarying vec4 vUvRegion;\\n#endif\\n#endif\\n#if defined(HAS_COLOR)\\nattribute vec4 aColor;\\n#elif defined(HAS_COLOR0)\\n#if COLOR0_SIZE == 3\\nattribute vec3 aColor0;\\n#else\\nattribute vec4 aColor0;\\n#endif\\nvarying vec4 vColor;\\n#endif\\nuniform mat4 projMatrix;\\nuniform mat3 modelNormalMatrix;\\nuniform mat4 modelViewMatrix;\\nuniform mat4 modelMatrix;\\nuniform mat4 positionMatrix;\\nuniform vec2 halton;\\nuniform vec2 outSize;\\nuniform mat4 projViewMatrix;\\n#include \\n#include \\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\\n#include \\n#endif\\nvarying vec3 vViewPosition;\\nvoid main() {\\n \\n#ifdef IS_LINE_EXTRUSION\\nvec4 c = getPosition(getLineExtrudePosition(aPosition));\\n#else\\nvec4 c = getPosition(aPosition);\\n#endif\\nmat4 d = getPositionMatrix();\\n mat4 e = projMatrix;\\n e[2].xy += halton.xy / outSize.xy;\\n#ifdef HAS_MASK_EXTENT\\ngl_Position = e * getMaskPosition(d * c, modelMatrix);\\n#else\\ngl_Position = e * modelViewMatrix * d * c;\\n#endif\\nvec4 f = modelViewMatrix * d * c;\\n vViewPosition = -f.xyz;\\n#ifdef HAS_MAP\\nvec2 h = decode_getTexcoord(aTexCoord);\\n vTexCoord = h * uvScale + uvOffset;\\n#endif\\n#if defined(HAS_COLOR)\\nvColor = aColor / 255.;\\n#elif defined(HAS_COLOR0)\\n#if COLOR0_SIZE == 3\\nvColor = vec4(aColor0 / 255., 1.);\\n#else\\nvColor = aColor0 / 255.;\\n#endif\\n#endif\\n}\",\n frag: \"#if __VERSION__ == 100\\n#if defined(GL_EXT_shader_texture_lod)\\n#extension GL_EXT_shader_texture_lod : enable\\n#define textureCubeLod(tex, uv, lod) textureCubeLodEXT(tex, uv, lod)\\n#else\\n#define textureCubeLod(tex, uv, lod) textureCube(tex, uv, lod)\\n#endif\\n#if defined(GL_OES_standard_derivatives)\\n#extension GL_OES_standard_derivatives : enable\\n#endif\\n#else\\n#define textureCubeLod(tex, uv, lod) textureLod(tex, uv, lod)\\n#endif\\n#define saturate(x) clamp(x, 0.0, 1.0)\\nprecision mediump float;\\n#include \\n#include \\nuniform vec3 hsv;\\n#define GET_BASEMAP(UV) (texture2D(baseColorTexture, (UV)))\\nuniform mat4 viewMatrix;\\nuniform mat4 projMatrix;\\nuniform vec3 cameraPosition;\\n#if defined(HAS_IBL_LIGHTING)\\nuniform mat4 viewMatrixInverse;\\n#endif\\nuniform vec4 baseColorFactor;\\nuniform vec3 emissiveFactor;\\nuniform vec3 specularFactor;\\nuniform float opacity;\\nuniform float envRotationSin;\\nuniform float envRotationCos;\\nuniform float rgbmRange;\\n#if defined(HAS_MAP)\\n#include \\n#endif\\n#ifdef HAS_BASECOLOR_MAP\\nuniform sampler2D baseColorTexture;\\n#endif\\n#ifdef HAS_NORMAL_MAP\\nuniform sampler2D normalTexture;\\nvec3 c(vec3 d, vec3 e) {\\n vec3 f = dFdx(d.xyz);\\n vec3 h = dFdy(d.xyz);\\n vec3 i = normalize(f - h);\\n vec3 j = normalize(-f + h);\\n vec3 k = normalize(e);\\n vec3 l = texture2D(normalTexture, computeTexCoord(vTexCoord)).rgb * 2. - 1.;\\n mat3 m = mat3(i, j, k);\\n return normalize(m * l);\\n}\\n#endif\\n#ifdef HAS_EMISSIVE_MAP\\nuniform sampler2D emissiveTexture;\\n#endif\\n#ifdef SHADING_MODEL_SPECULAR_GLOSSINESS\\nuniform vec4 diffuseFactor;\\n#ifdef HAS_DIFFUSE_MAP\\nuniform sampler2D diffuseTexture;\\n#endif\\n#ifdef HAS_SPECULARGLOSSINESS_MAP\\nuniform sampler2D specularGlossinessTexture;\\n#endif\\n#endif\\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\\n#include \\n#endif\\n#if defined(HAS_COLOR) || defined(HAS_COLOR0)\\nvarying vec4 vColor;\\n#endif\\n#ifdef GAMMA_INPUT\\nvec3 n(vec3 o) {\\n return o * o;\\n}\\nfloat n(float o) {\\n return o * o;\\n}\\n#else\\nvec3 n(vec3 o) {\\n return o;\\n}\\nfloat n(float o) {\\n return o;\\n}\\n#endif\\nvec3 u() {\\n \\n#ifdef SHADING_MODEL_SPECULAR_GLOSSINESS\\n#ifdef HAS_SPECULARGLOSSINESS_MAP\\nreturn texture2D(specularGlossinessTexture, computeTexCoord(vTexCoord)).rgb;\\n#else\\nreturn specularFactor;\\n#endif\\n#else\\nreturn specularFactor;\\n#endif\\n}\\nvec3 v() {\\n \\n#ifdef HAS_EMISSIVE_MAP\\nreturn texture2D(emissiveTexture, computeTexCoord(vTexCoord)).rgb;\\n#else\\nreturn emissiveFactor;\\n#endif\\n}\\n#if defined(TONEMAP_OUTPUT)\\n#if TONEMAP_OUTPUT > 0\\nuniform float exposureBias;\\nfloat A(vec3 rgb) {\\n return dot(rgb, vec3(.299, .587, .114));\\n}\\nfloat B(vec3 rgb) {\\n return dot(rgb, vec3(.212671, .715160, .072169));\\n}\\nvec3 C(vec3 xyz) {\\n vec3 D = vec3(3.240479, -1.53715, -.498535);\\n vec3 E = vec3(-.969256, 1.875992, .041556);\\n vec3 F = vec3(.055648, -.204043, 1.057311);\\n vec3 rgb;\\n rgb.b = dot(xyz, F);\\n rgb.g = dot(xyz, E);\\n rgb.r = dot(xyz, D);\\n return rgb;\\n}\\nvec3 H(vec3 rgb) {\\n vec3 I = vec3(.412453, .35758, .180423);\\n vec3 J = vec3(.212671, .71516, .0721688);\\n vec3 K = vec3(.0193338, .119194, .950227);\\n vec3 xyz;\\n xyz.x = dot(rgb, I);\\n xyz.y = dot(rgb, J);\\n xyz.z = dot(rgb, K);\\n return xyz;\\n}\\nvec3 L(vec3 xyz) {\\n float M = xyz.x + xyz.y + xyz.z;\\n M = 1. / M;\\n vec3 O;\\n O.z = xyz.y;\\n O.x = xyz.x * M;\\n O.y = xyz.y * M;\\n return O;\\n}\\nvec3 P(vec3 O) {\\n float x = O.x;\\n float y = O.y;\\n float J = O.z;\\n vec3 xyz;\\n xyz.y = J;\\n xyz.x = x * (J / y);\\n xyz.z = (1. - x - y) * (J / y);\\n return xyz;\\n}\\nfloat Q(float x) {\\n float U = pow(x, 1.60525727);\\n float V = ((1.05542877 * 4.68037409) * U) / (4.68037409 * U + 1.);\\n return clamp(V, .0, 1.);\\n}\\nconst float W = 1. / .18;\\nfloat ba(float x) {\\n x *= W;\\n const float bb = .2;\\n const float F = .34;\\n const float bc = .002;\\n const float bd = 1.68;\\n const float be = .0005;\\n const float bf = .252;\\n const float bg = 1. / .833837;\\n return ((x * (bb * x + bc * F) + bd * be) / (x * (bb * x + F) + bd * bf) - be / bf) * bg;\\n}\\nvec3 bh(vec3 x) {\\n x *= W;\\n const float bb = .27;\\n const float F = .29;\\n const float bc = .052;\\n const float bd = .2;\\n const float bf = .18;\\n const float bg = 1. / .897105;\\n return ((x * (bb * x + bc * F)) / (x * (bb * x + F) + bd * bf)) * bg;\\n}\\nvec3 bi(vec3 x) {\\n vec3 bj = x.rgb;\\n bj = min(bj, vec3(3.));\\n float bk = B(bj);\\n if(bk > .0) {\\n float bl = Q(bk);\\n bj = bj * (bl / bk);\\n bj = clamp(bj, vec3(.0), vec3(1.));\\n }\\n float bm = 1. / 2.2;\\n bj = pow(bj, vec3(bm));\\n return bj;\\n}\\n#endif\\n#endif\\n#if defined(IRR_RGBM) || defined(ENV_RGBM) || defined(ENV_GAMMA) || defined(IRR_GAMMA)\\nuniform float envMapExposure;\\n#endif\\nuniform vec4 themingColor;\\nuniform mat3 environmentTransform;\\nvec3 bn(vec3 bo, vec3 bp) {\\n \\n#if defined(HAS_SHADOWMAP)\\nfloat bq = dot(shadowLightDir, bp);\\n float br = (bq + 1.) / 2.;\\n br = min(1., br * 1.5);\\n float bs = 1.;\\n vec3 bt = bo * min(bs, br);\\n return bt;\\n#else\\nreturn bo;\\n#endif\\n}\\n#ifdef HAS_IBL_LIGHTING\\nuniform float reflectivity;\\nuniform vec3 hdrHSV;\\nuniform samplerCube prefilterMap;\\nuniform vec3 diffuseSPH[9];\\nuniform vec2 prefilterMiplevel;\\nuniform vec2 prefilterSize;\\n#else\\nuniform vec3 ambientColor;\\n#endif\\n#if defined(HAS_IBL_LIGHTING)\\nvec3 bu(const in vec3 bv) {\\n vec3 bw = environmentTransform * bv;\\n float x = bw.x;\\n float y = bw.y;\\n float z = bw.z;\\n vec3 bt = (diffuseSPH[0] + diffuseSPH[1] * x + diffuseSPH[2] * y + diffuseSPH[3] * z + diffuseSPH[4] * z * x + diffuseSPH[5] * y * z + diffuseSPH[6] * y * x + diffuseSPH[7] * (3. * z * z - 1.) + diffuseSPH[8] * (x * x - y * y));\\n if(length(hdrHSV) > .0) {\\n bt = hsv_apply(bt, hdrHSV);\\n }\\n return max(bt, vec3(.0));\\n}\\nvec3 bx(const in vec4 by, const in float bz) {\\n if(bz <= .0)\\n return by.rgb;\\n return bz * by.rgb * by.a;\\n}\\nfloat bA(const in float bB) {\\n return bB;\\n}\\nvec3 bC(const in float bD, const in vec3 D) {\\n vec3 bE = D;\\n float bF = prefilterMiplevel.x;\\n float bG = min(bF, bA(bD) * prefilterMiplevel.y);\\n vec3 bH = bx(textureCubeLod(prefilterMap, bE, bG), rgbmRange);\\n if(length(hdrHSV) > .0) {\\n return hsv_apply(bH, hdrHSV);\\n } else {\\n return bH;\\n }\\n}\\nvec3 bI(const in vec3 k, const in vec3 D, const in float bJ) {\\n float bK = 1. - bJ;\\n float bL = bK * (sqrt(bK) + bJ);\\n return mix(k, D, bL);\\n}\\nvec3 bM(const in vec3 bv, const in vec3 bN, const in float bO, const in vec3 bP) {\\n vec3 D = reflect(-bN, bv);\\n D = bI(bv, D, bO);\\n vec3 bQ = bC(bO, environmentTransform * D);\\n float bR = clamp(1. + dot(D, bP), .0, 1.);\\n bQ *= bR * bR;\\n return bQ;\\n}\\n#else\\nvec3 bM(const in vec3 bv, const in vec3 bN, const in float bO, const in vec3 bP) {\\n return ambientColor;\\n}\\n#endif\\nvarying highp vec3 vViewPosition;\\nvec3 bS(vec3 bT, float bU) {\\n float bV = max(1. - bU, .0);\\n return bT + (1. - bT) * pow(bV, 5.);\\n}\\nfloat bW(float bT, float bU) {\\n float bV = max(1. - bU, .0);\\n return bT + (1. - bT) * pow(bV, 5.);\\n}\\n#include \\nvoid main() {\\n glFragColor = vec4(vec3(1.), opacity);\\n#ifdef HAS_BASECOLOR_MAP\\nvec4 bX = GET_BASEMAP(computeTexCoord(vTexCoord));\\n#ifdef GAMMA_INPUT\\nbX.xyz *= bX.xyz;\\n#endif\\nglFragColor = glFragColor * bX;\\n#endif\\n#ifdef ALPHATEST\\nif(glFragColor.a < ALPHATEST)\\n discard;\\n \\n#endif\\nfloat bY = 1.;\\n vec3 bZ = dFdx(vViewPosition);\\n vec3 ca = dFdy(vViewPosition);\\n vec3 bv = normalize(cross(bZ, ca));\\n vec3 cb;\\n if(projMatrix[3][3] == .0) {\\n cb = normalize(vViewPosition);\\n } else {\\n cb = vec3(.0, .0, 1.);\\n }\\n bv = faceforward(bv, -cb, bv);\\n vec3 cc = bv;\\n#ifdef HAS_NORMAL_MAP\\nbv = c(-vViewPosition, bv);\\n#endif\\nvec3 cd = vec3(.0);\\n vec3 ce = vec3(.0);\\n#ifdef HAS_IBL_LIGHTING\\nvec3 bp = mat3(viewMatrixInverse) * bv;\\n vec3 cf = glFragColor.rgb * bu(bp) * .5;\\n cf = bn(cf, bp);\\n cd += n(baseColorFactor.rgb) * cf;\\n#endif\\nvec3 cg = v();\\n#ifdef METAL\\nglFragColor.xyz = glFragColor.xyz * (n(cg) + cd + n(baseColorFactor.rgb) + ce);\\n#else\\nglFragColor.xyz = glFragColor.xyz * (n(cg) + cd + n(baseColorFactor.rgb)) + ce;\\n#endif\\nvec3 ch;\\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\\nfloat ci = shadow_computeShadow();\\n ch = shadow_blend(ch, ci).rgb;\\n#endif\\n#ifdef HAS_COLOR\\nglFragColor = glFragColor * vColor;\\n#endif\\nglFragColor.rgb += ch;\\n glFragColor.rgb = linearTosRGB(glFragColor.rgb);\\n#if defined(HAS_IBL_LIGHTING)\\nvec3 cj;\\n#if defined(HAS_NORMAL_MAP)\\n#ifdef ENVMAP_MODE_REFLECTION\\ncj = reflect(-cb, bv);\\n#else\\ncj = refract(-cb, bv, 1.);\\n#endif\\n#else\\ncj = reflect(-cb, bv);\\n#endif\\ncj = mat3(viewMatrixInverse) * cj;\\n float ck = 1.;\\n vec3 cl;\\n#ifdef HAS_IBL_LIGHTING\\ncl = vec3(.0);\\n#elif\\ncl = ambientColor;\\n#endif\\ncl *= ck;\\n float bV = dot(cb, bv);\\n if(bV < -1e-2 || reflectivity == .0)\\n bV = 1.;\\n else\\n bV = max(1e-6, bV);\\n vec3 cm;\\n vec3 cn = u();\\n#ifdef METAL\\ncm = n(cn);\\n#else\\ncm = bS(n(cn), bV) * (1. - envRotationSin);\\n glFragColor.a = mix(glFragColor.a, bW(glFragColor.a, bV), reflectivity) * envRotationCos;\\n float co = pow(1. - bV * .5, 5.);\\n float cp = (28. / 23.) * (1. - co) * (1. - co);\\n glFragColor.rgb *= cp * (1. - n(cn));\\n#endif\\nglFragColor.rgb += cl.rgb * bY * cm.rgb;\\n#endif\\n#if defined(TONEMAP_OUTPUT)\\n#if TONEMAP_OUTPUT == 1\\nglFragColor.rgb = bi(exposureBias * glFragColor.rgb);\\n#elif TONEMAP_OUTPUT == 2\\nglFragColor.rgb = bh(exposureBias * glFragColor.rgb);\\n#endif\\n#endif\\nglFragColor.rgb = mix(glFragColor.rgb, themingColor.rgb, themingColor.a);\\n#if __VERSION__ == 100\\ngl_FragColor = glFragColor;\\n#endif\\n}\",\n uniforms: o,\n defines: t.defines || {},\n extraCommandProps: t.extraCommandProps || {} }]),\n _this19.version = 300;\n return _this19;\n }\n _inherits(Yt, _yt10);\n return _createClass(Yt);\n }(yt);\n var Zt = exports.ScanEffectShader = function (_Et6) {\n function Zt() {\n _classCallCheck(this, Zt);\n return _callSuper(this, Zt, [{\n vert: Mt,\n frag: \"#if __VERSION__ == 100\\n#ifdef GL_OES_standard_derivatives\\n#extension GL_OES_standard_derivatives : enable\\n#endif\\n#endif\\nprecision mediump float;\\n#include \\nvarying vec2 vTexCoord;\\nuniform sampler2D sceneMap;\\nuniform sampler2D scanEffectMap;\\nvoid main() {\\n vec4 c = texture2D(sceneMap, vTexCoord);\\n vec4 d = texture2D(scanEffectMap, vTexCoord);\\n glFragColor = c + d;\\n#if __VERSION__ == 100\\ngl_FragColor = glFragColor;\\n#endif\\n}\",\n extraCommandProps: {\n viewport: {\n x: 0,\n y: 0,\n width: function width(e, t) {\n return t.resolution[0];\n },\n height: function height(e, t) {\n return t.resolution[1];\n } } } }]);\n\n\n\n }\n _inherits(Zt, _Et6);\n return _createClass(Zt);\n }(Et);\n var $t = [];\n var Qt = exports.FogPass = function () {\n function Qt(e, t, n) {\n _classCallCheck(this, Qt);\n this._regl = e, this._layer = n, this._viewport = t, this._init();\n }\n return _createClass(Qt, [{\n key: \"_init\",\n value: function _init() {\n this._shader = new yt({\n vert: \"attribute vec3 aPosition;\\nuniform mat4 projMatrix;\\nuniform mat4 modelMatrix;\\nuniform mat4 modelViewMatrix;\\nuniform mat4 positionMatrix;\\nvarying vec4 vWorldPosition;\\n#include \\nvoid main() {\\n vec4 c = getPosition(aPosition);\\n mat4 d = getPositionMatrix();\\n vec4 e = modelMatrix * d * c;\\n gl_Position = projMatrix * modelViewMatrix * d * c;\\n vWorldPosition = e;\\n}\",\n frag: \"precision mediump float;\\nvarying vec4 vWorldPosition;\\nuniform vec2 fogDist;\\nuniform vec3 cameraPosition;\\nuniform float rainDepth;\\nvoid main() {\\n vec3 c = vec3(vWorldPosition[0] - cameraPosition[0], vWorldPosition[1] - cameraPosition[1], vWorldPosition[2] - cameraPosition[2]);\\n float d = length(c);\\n float e = clamp(1. - (d - fogDist.x) / (fogDist.y - fogDist.x), .0, 1.);\\n if(vWorldPosition[2] < rainDepth) {\\n gl_FragColor = vec4(e, .0, .0, 1.);\\n } else {\\n gl_FragColor = vec4(e, 1., .0, 1.);\\n }\\n}\",\n uniforms: [{\n name: \"modelViewMatrix\",\n type: \"function\",\n fn: function fn(t, n) {\n return _glMatrix.mat4.multiply($t, n.viewMatrix, n.modelMatrix);\n } }],\n\n extraCommandProps: {\n viewport: this._viewport } });\n\n\n var t = this._layer.getRenderer().createFBOInfo();\n this._fbo = this._regl.framebuffer(t), this._scene = new Ze(), this.renderer = new Ve(this._regl);\n } },\n {\n key: \"render\",\n value: function render(e, t) {\n this._resize(), this.renderer.clear({\n color: [0, 0, 0, 1],\n depth: 1,\n framebuffer: this._fbo }),\n this._scene.setMeshes(e);\n return this.renderer.render(this._shader, {\n projMatrix: t.projMatrix,\n viewMatrix: t.viewMatrix,\n cameraPosition: t.cameraPosition,\n fogDist: t.fogDist,\n rainDepth: t.rainDepth },\n this._scene, this._fbo), this._fbo;\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n this._fbo && this._fbo.destroy(), this._shader && this._shader.dispose();\n } },\n {\n key: \"_resize\",\n value: function _resize() {\n var e = m(this._viewport.width.data) ? this._viewport.width.data() : this._viewport.width,\n t = m(this._viewport.height.data) ? this._viewport.height.data() : this._viewport.height;\n !this._fbo || this._fbo.width === e && this._fbo.height === t || this._fbo.resize(e, t);\n } }]);\n\n }();\n var en = exports.FogShader = function (_Et7) {\n function en() {\n _classCallCheck(this, en);\n return _callSuper(this, en, [{\n vert: Mt,\n frag: \"#if __VERSION__ == 100\\n#ifdef GL_OES_standard_derivatives\\n#extension GL_OES_standard_derivatives : enable\\n#endif\\n#endif\\nprecision mediump float;\\n#include \\nvarying vec2 vTexCoord;\\n#ifdef HAS_RAIN\\nuniform sampler2D ripplesMap;\\n#endif\\n#ifdef HAS_SNOW\\nuniform sampler2D normalMap;\\n#endif\\n#ifdef HAS_FOG\\nuniform vec3 fogColor;\\n#endif\\nuniform sampler2D sceneMap;\\nuniform sampler2D mixFactorMap;\\nuniform float time;\\nuniform vec2 resolution;\\nuniform float snowIntensity;\\nfloat c(float a, float b, float w) {\\n return a + w * (b - a);\\n}\\n#define HASHSCALE1 .1031\\n#define HASHSCALE3 vec3(.1031, .1030, .0973)\\n#define HASHSCALE4 vec3(.1031, .1030, .0973, .1099)\\nfloat d = .5;\\nfloat e = .2;\\nfloat f = .5;\\nfloat h = 20.;\\nfloat i(float p) {\\n vec3 j = fract(vec3(p) * HASHSCALE1);\\n j += dot(j, j.yzx + 19.19);\\n return fract((j.x + j.y) * j.z);\\n}\\nvec2 k(vec2 p) {\\n vec3 j = fract(vec3(p.xyx) * HASHSCALE3);\\n j += dot(j, j.yzx + 19.19);\\n return fract((j.xx + j.yz) * j.zy);\\n}\\nvec2 l(vec2 m) {\\n float x = fract(sin(dot(m.xy, vec2(122.9898, 783.233))) * 43758.5453);\\n float y = fract(sin(dot(m.xy, vec2(457.6537, 537.2793))) * 37573.5913);\\n return vec2(x, y);\\n}\\nvec3 n(vec2 o, float u) {\\n vec3 v = vec3(.0);\\n o = o * (2. + u);\\n float A = e * snowIntensity;\\n float B = o.y * (((i(u) * 2. - 1.) * .5 + 1.) * A);\\n float C = (f * time);\\n o += vec2(B, C);\\n vec2 D = k(floor(o) + 31.1759 * u);\\n o = fract(o);\\n o -= (D * 2. - 1.) * .35;\\n o -= .5;\\n float r = length(o);\\n float E = .05 * (1. + .3 * sin(time * d));\\n float F = smoothstep(E, -E, r);\\n vec3 G = vec3(F) * D.x;\\n return G;\\n}\\nvec3 H() {\\n vec3 v = vec3(0);\\n vec2 o = gl_FragCoord.xy / resolution.xy;\\n o *= vec2(resolution.x / resolution.y, 1.);\\n float I = h * snowIntensity;\\n for(float J = 0.; J < I; J++) {\\n v += n(o, J);\\n }\\n return v;\\n}\\nvec3 K(vec4 L, vec4 M, float N) {\\n float O = M.b;\\n vec3 P = vec3(1.);\\n if(N < 1.) {\\n float r = c(.5, P.x, O);\\n float g = c(.5, P.y, O);\\n float b = c(.5, P.z, O);\\n return vec3(r, g, b);\\n } else {\\n float r = c(L.r, P.x, O);\\n float g = c(L.g, P.y, O);\\n float b = c(L.b, P.z, O);\\n return vec3(r, g, b);\\n }\\n}\\nvoid main() {\\n vec4 L = texture2D(sceneMap, vTexCoord);\\n glFragColor = L;\\n vec4 Q = texture2D(mixFactorMap, vTexCoord);\\n#ifdef HAS_RAIN\\nvec4 R = texture2D(ripplesMap, vTexCoord);\\n if(Q.g < 1.) {\\n L = mix(L, R, .4);\\n }\\n glFragColor = L;\\n#endif\\n#ifdef HAS_SNOW\\nvec3 S = H();\\n glFragColor = vec4(L.rgb + S, L.a);\\n#endif\\n#ifdef HAS_FOG\\nfloat T = Q.r;\\n vec3 U = mix(fogColor, glFragColor.rgb, T);\\n glFragColor = vec4(U, L.a);\\n#endif\\n#if __VERSION__ == 100\\ngl_FragColor = glFragColor;\\n#endif\\n}\",\n extraCommandProps: {\n viewport: {\n x: 0,\n y: 0,\n width: function width(e, t) {\n return t.resolution[0];\n },\n height: function height(e, t) {\n return t.resolution[1];\n } } } }]);\n\n\n\n }\n _inherits(en, _Et7);\n return _createClass(en);\n }(Et);\n var tn = [],\n nn = [.03, .03, .03],\n rn = [],\n on = [],\n an = [],\n sn = _glMatrix.mat4.fromRotationTranslation([], _glMatrix.quat.fromEuler([], 90, 0, 0), [0, 0, 0]);\n var cn = exports.RainRipplesPass = function () {\n function cn(e, t) {\n _classCallCheck(this, cn);\n this._regl = e, this._viewport = t, this._init();\n }\n return _createClass(cn, [{\n key: \"_init\",\n value: function _init() {\n this._shader = new yt({\n vert: \"#include \\nattribute vec3 aPosition;\\nattribute vec3 aNormal;\\nattribute vec2 aTexCoord;\\nuniform mat4 projMatrix;\\nuniform mat4 modelMatrix;\\nuniform mat4 modelViewMatrix;\\nuniform mat4 positionMatrix;\\nvarying vec2 vTexCoord;\\n#include \\nvoid main() {\\n vec4 c = getPosition(aPosition);\\n mat4 d = getPositionMatrix();\\n gl_Position = projMatrix * modelViewMatrix * d * c;\\n vTexCoord = aTexCoord;\\n}\",\n frag: \"#if __VERSION__ == 100\\n#ifdef GL_OES_standard_derivatives\\n#extension GL_OES_standard_derivatives : enable\\n#endif\\n#endif\\nprecision mediump float;\\n#include \\nvarying vec2 vTexCoord;\\nuniform float rippleRadius;\\nuniform float density;\\nuniform float time;\\nvec3 c(vec2 p) {\\n vec3 q = vec3(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)), dot(p, vec2(419.2, 371.9)));\\n return fract(sin(q) * 43758.5453);\\n}\\nfloat d(in vec2 x) {\\n vec2 e = x * density / 4000.0;\\n vec2 p = floor(e);\\n vec2 f = fract(e);\\n float h = .0;\\n for(int i = -4; i <= 4; i++)\\n for(int k = -4; k <= 4; k++) {\\n vec2 g = vec2(float(k), float(i));\\n vec3 l = c(p + g);\\n vec2 r = g - f + l.xy;\\n float m = sqrt(dot(r, r));\\n float n = max(mix(smoothstep(.99, .999, max(cos(m - time * 2. + (l.x + l.y) * 5.), 0.)), 0., m), 0.);\\n h += n;\\n }\\n return h;\\n}\\nvoid main() {\\n vec2 u = vTexCoord;\\n float A = 24. / (rippleRadius * .01);\\n float f = d(A * u) * smoothstep(.0, .4, sin(u.x * 3.151592) * sin(u.y * 3.141592));\\n vec3 B = vec3(-dFdx(f), -dFdy(f), -dFdy(f));\\n glFragColor = vec4(B, 1.);\\n#if __VERSION__ == 100\\ngl_FragColor = glFragColor;\\n#endif\\n}\",\n uniforms: [{\n name: \"modelViewMatrix\",\n type: \"function\",\n fn: function fn(t, n) {\n return _glMatrix.mat4.multiply(tn, n.viewMatrix, n.modelMatrix);\n } }],\n\n extraCommandProps: {\n viewport: this._viewport } }),\n\n this._shader.version = 300, this._fbo = this._regl.framebuffer({\n color: this._regl.texture({\n width: this._viewport.width(),\n height: this._viewport.height(),\n wrap: \"clamp\",\n mag: \"linear\",\n min: \"linear\" }),\n\n depth: !0 }),\n this._scene = new Ze(), this.renderer = new Ve(this._regl);\n } },\n {\n key: \"_transformRipples\",\n value: function _transformRipples(n) {\n var r = n.coordinateToPointAtRes(n.getCenter(), n.getGLRes()),\n i = n.getGLScale() / n.getGLScale(this._fixZoom),\n a = _glMatrix.vec3.set(on, i, i, i),\n s = _glMatrix.vec3.multiply(a, nn, a),\n c = _glMatrix.mat4.identity(an);\n _glMatrix.mat4.fromRotationTranslationScale(c, _glMatrix.quat.fromEuler(rn, 0, 0, 0), [r.x, r.y, 0], s), _glMatrix.mat4.multiply(c, c, sn), this._mesh.setLocalTransform(c);\n } },\n {\n key: \"_createRipplesMask\",\n value: function _createRipplesMask(e) {\n this._fixZoom = e.getZoom();\n var t = 800 * Math.pow(2, 16.685648411389433 - this._fixZoom),\n n = {};\n n.POSITION = [-t, 0, -t, t, 0, -t, -t, 0, t, t, 0, t], n.NORMAL = [0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], n.TEXCOORD_0 = [0, 0, 1, 0, 0, 1, 1, 1];\n var r = new Z(n, [3, 1, 0, 0, 2, 3], 0, {\n positionAttribute: \"POSITION\",\n normalAttribute: \"NORMAL\",\n uv0Attribute: \"TEXCOORD_0\" });\n\n r.generateBuffers(this._regl);\n var i = new Ce();\n return new Be(r, i);\n } },\n {\n key: \"render\",\n value: function render(e, t) {\n this._resize(), this.renderer.clear({\n color: [0, 0, 0, 1],\n depth: 1,\n framebuffer: this._fbo }),\n this._mesh = this._mesh || this._createRipplesMask(e), this._scene.setMeshes(this._mesh), this._transformRipples(e);\n return this.renderer.render(this._shader, {\n projMatrix: t.projMatrix,\n viewMatrix: t.viewMatrix,\n time: t.time,\n rippleRadius: t.rippleRadius,\n density: t.density },\n this._scene, this._fbo), this._fbo;\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n this._fbo && this._fbo.destroy(), this._shader && this._shader.dispose();\n } },\n {\n key: \"_resize\",\n value: function _resize() {\n var e = m(this._viewport.width.data) ? this._viewport.width.data() : this._viewport.width,\n t = m(this._viewport.height.data) ? this._viewport.height.data() : this._viewport.height;\n !this._fbo || this._fbo.width === e && this._fbo.height === t || this._fbo.resize(e, t);\n } }]);\n\n }();\n var ln = \"attribute vec3 aPosition;\\nuniform mat4 positionMatrix;\\nuniform mat4 projViewModelMatrix;\\n#ifdef HAS_TEXTURE\\nattribute vec2 aTexCoord;\\nvarying vec2 uv;\\nvarying vec4 vPos;\\n#endif\\n#include \\nvoid main() {\\n mat4 c = getPositionMatrix();\\n vec4 d = c * getPosition(aPosition);\\n gl_Position = projViewModelMatrix * d;\\n#ifdef HAS_TEXTURE\\nuv = aTexCoord;\\n vPos = getPosition(aPosition);\\n#endif\\n}\";\n var fn = [0, 0, 0, 1];\n var dn = exports.ExtentPass = function () {\n function dn(e, t) {\n _classCallCheck(this, dn);\n this.regl = e, this._viewport = t, this.renderer = new Ve(e), this._init();\n }\n return _createClass(dn, [{\n key: \"_init\",\n value: function _init() {\n this._maskColorFbo = this.renderer.regl.framebuffer({\n color: this.renderer.regl.texture({\n width: 1,\n height: 1,\n wrap: \"clamp\",\n mag: \"linear\",\n min: \"linear\" }),\n\n depth: !0 }),\n this._maskModeFbo = this.renderer.regl.framebuffer({\n color: this.renderer.regl.texture({\n width: 1,\n height: 1,\n wrap: \"clamp\",\n mag: \"nearest\",\n min: \"nearest\" }),\n\n depth: !0 });\n\n var t = [{\n name: \"projViewModelMatrix\",\n type: \"function\",\n fn: function fn(t, n) {\n return _glMatrix.mat4.multiply([], n.projViewMatrix, n.modelMatrix);\n } }];\n\n this._maskColorShader = new yt({\n vert: ln,\n frag: \"#ifdef GL_ES\\nprecision highp float;\\n#endif\\nuniform vec4 maskColor;\\n#ifdef HAS_TEXTURE\\nuniform sampler2D maskTexture;\\nvarying vec2 uv;\\nuniform vec3 mask_position0;\\nuniform vec3 mask_position1;\\nuniform vec3 mask_position2;\\nuniform vec3 mask_position3;\\nvarying vec4 vPos;\\nvec2 c(vec2 d, vec2 a, vec2 b, vec2 e, vec2 f) {\\n vec2 h = vec2(.5);\\n for(int i = 0; i < 10; i++) {\\n float j = h.x;\\n float k = h.y;\\n vec2 l = (1. - j) * (1. - k) * a + j * (1. - k) * b + j * k * e + (1. - j) * k * f;\\n vec2 m = d - l;\\n if(length(m) < .001)\\n break;\\n vec2 n = -(1. - k) * a + (1. - k) * b + k * e - k * f;\\n vec2 o = -(1. - j) * a - j * b + j * e + (1. - j) * f;\\n float A = n.x * o.y - n.y * o.x;\\n if(abs(A) > .0001) {\\n vec2 B = vec2((m.x * o.y - m.y * o.x) / A, (m.y * n.x - m.x * n.y) / A);\\n h += B;\\n }\\n h = clamp(h, .0, 1.);\\n }\\n return h;\\n}\\n#endif\\nvoid main() {\\n \\n#ifdef HAS_TEXTURE\\nvec2 d = vPos.xy;\\n vec2 C = c(d, mask_position0.xy, mask_position1.xy, mask_position2.xy, mask_position3.xy);\\n gl_FragColor = texture2D(maskTexture, C);\\n gl_FragColor.a *= maskColor.a;\\n#else\\nif(maskColor.a == .0) {\\n discard;\\n }\\n gl_FragColor = maskColor;\\n#endif\\n}\",\n uniforms: t,\n extraCommandProps: {\n viewport: this._viewport } }),\n\n this._maskModeShader = new yt({\n vert: ln,\n frag: \"#ifdef GL_ES\\nprecision highp float;\\n#endif\\nuniform float maskMode;\\n#ifdef HAS_MASK_FLAT\\nuniform float flatHeight;\\n#endif\\n#ifdef HAS_MASK_COLOR\\nuniform vec2 heightRange;\\n#endif\\nvoid main() {\\n \\n#if defined(HAS_MASK_FLAT)\\ngl_FragColor = vec4(maskMode, flatHeight, .0, 1.);\\n#elif defined(HAS_MASK_COLOR)\\ngl_FragColor = vec4(maskMode, .0, heightRange.x, heightRange.y);\\n#else\\ngl_FragColor = vec4(maskMode, .0, .0, .0);\\n#endif\\n}\",\n uniforms: t,\n extraCommandProps: {\n viewport: this._viewport } }),\n\n this._scene = new Ze();\n } },\n {\n key: \"render\",\n value: function render(e, t) {\n this._resize(), this.renderer.clear({\n color: fn,\n depth: 1,\n framebuffer: this._maskColorFbo }),\n this.renderer.clear({\n color: fn,\n depth: 1,\n framebuffer: this._maskModeFbo }),\n this._scene.setMeshes(e);\n var n = {\n projViewMatrix: t };\n\n return this.renderer.render(this._maskColorShader, n, this._scene, this._maskColorFbo), this.renderer.render(this._maskModeShader, n, this._scene, this._maskModeFbo), {\n colorExtent: this._maskColorFbo,\n modeExtent: this._maskModeFbo };\n\n } },\n {\n key: \"_resize\",\n value: function _resize() {\n var e = m(this._viewport.width) ? this._viewport.width() : this._viewport.width.data(),\n t = m(this._viewport.height) ? this._viewport.height() : this._viewport.height.data();\n !this._maskColorFbo || this._maskColorFbo.width === e && this._maskColorFbo.height === t || (this._maskColorFbo.resize(e, t), this._maskModeFbo.resize(e, t));\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n this._maskColorFbo && (this._maskColorFbo.destroy(), delete this._maskColorFbo), this._maskModeFbo && (this._maskModeFbo.destroy(), delete this._maskModeFbo), this._maskColorShader && (this._maskColorShader.dispose(), delete this._maskColorShader), this._maskModeShader && (this._maskModeShader.dispose(), delete this._maskModeShader);\n } }]);\n\n }();\n var un = \"\\n#ifdef GL_ES\\n precision highp float;\\n#endif\\nuniform mat3 ring;\\n\\nuniform float effectTime;\\nvarying vec4 vWorldPosition;\\n\\nvec3 hsb2rgb(in vec3 c) {\\n vec3 rgb = clamp(abs(mod(c.x * 6.0 + vec3(0.0,4.0,2.0), 6.0)-3.0)-1.0, 0.0, 1.0 );\\n rgb = rgb*rgb*(3.0-2.0*rgb);\\n return c.z * mix( vec3(1.0), rgb, c.y);\\n}\\n\\nvec4 glowring(vec4 worldPos, vec2 center, float radius, float speed, vec3 effectColor, float direction, float height) {\\n vec2 dir = vec2(worldPos.xy) - center;\\n float len = length(dir);\\n if (len > radius) {\\n return vec4(0.0);\\n } else {\\n vec2 uv = vec2(0.0);\\n if (direction == 0.0) {\\n vec2 lefttop = vec2(center.x - radius, center.y + radius);\\n vec2 rightbottom = vec2(center.x + radius, center.y - radius);\\n uv = vec2(abs(worldPos.x - lefttop.x) / (2.0 * radius), abs(worldPos.y - rightbottom.y) / (2.0 * radius));\\n uv.x -= 0.5;\\n uv.y -= 0.5;\\n } else {\\n if (worldPos.z < 0.1) {\\n return vec4(0.0);\\n }\\n uv = vec2(0.0, worldPos.z / height);\\n }\\n float itime = (effectTime / 2.0) * speed;\\n float r = length(uv) * 3.0;\\n vec3 color = hsb2rgb(effectColor);\\n\\n float a = pow(r, 2.0);\\n float b = sin(r * 0.8 - 1.6);\\n float c = sin(r - 0.010);\\n float s = sin(a - itime * 3.0 + b) * c;\\n float t = abs(1.0 / (s * 10.8)) - 0.01;\\n color *= t;\\n vec4 newColor = vec4(color, t);\\n return newColor;\\n }\\n}\\n\\nvoid main() {\\n vec4 color = vec4(0.0);\\n gl_FragColor = color;\\n}\\n\",\n hn = [];\n var mn = exports.ScanEffectPass = function () {\n function mn(e, t, n) {\n _classCallCheck(this, mn);\n this._regl = e, this._layer = n, this._viewport = t, this._init(), this._effectsLength = 0;\n }\n return _createClass(mn, [{\n key: \"_init\",\n value: function _init() {\n var e = this._layer.getRenderer().createFBOInfo();\n this._fbo = this._regl.framebuffer(e), this._scene = new Ze(), this.renderer = new Ve(this._regl);\n } },\n {\n key: \"render\",\n value: function render(t, n) {\n this._resize(), this.renderer.clear({\n color: [0, 0, 0, 1],\n depth: 1,\n framebuffer: this._fbo }),\n this._scene.setMeshes(t);\n var r = n.effectInfos;\n if (!this._shader || r.length !== this._effectsLength) {\n this._shader && this._shader.dispose();\n var _t54 = this._createFragSource(r);\n this._shader = new yt({\n vert: \"#include \\n#define SHADER_NAME SCANEFFECT\\nprecision highp float;\\nattribute vec3 aPosition;\\nuniform mat4 projMatrix;\\nuniform mat4 modelMatrix;\\nuniform mat4 modelViewMatrix;\\nuniform mat4 positionMatrix;\\n#include \\n#include \\nvarying vec4 vWorldPosition;\\nvoid main()\\n{\\n mat4 localPositionMatrix = getPositionMatrix();\\n #ifdef IS_LINE_EXTRUSION\\n vec3 linePosition = getLineExtrudePosition(aPosition);\\n //linePixelScale = tileRatio * resolution / tileResolution\\n vec4 localVertex = getPosition(linePosition);\\n #else\\n vec4 localVertex = getPosition(aPosition);\\n #endif\\n vec4 worldPosition = modelMatrix * localPositionMatrix * localVertex;\\n vWorldPosition = worldPosition;\\n gl_Position = projMatrix * modelViewMatrix * localPositionMatrix * localVertex;\\n}\\n\",\n frag: _t54,\n uniforms: [{\n name: \"modelViewMatrix\",\n type: \"function\",\n fn: function fn(t, n) {\n return _glMatrix.mat4.multiply(hn, n.viewMatrix, n.modelMatrix);\n } }],\n\n extraCommandProps: {\n viewport: this._viewport } }),\n\n this._effectsLength = r.length;\n }\n var i = {\n projMatrix: n.projMatrix,\n viewMatrix: n.viewMatrix,\n effectTime: n.effectTime,\n minAltitude: 0 };\n\n return this._updateUniforms(i, r), this.renderer.render(this._shader, i, this._scene, this._fbo), this._fbo;\n } },\n {\n key: \"_createFragSource\",\n value: function _createFragSource(e) {\n var t = \"\";\n for (var _n35 = 0; _n35 < e.length; _n35++) t += \"uniform mat3 ring\".concat(_n35, \";\\n\");\n t = un.replace(\"uniform mat3 ring;\", t);\n var n = \"\";\n for (var _t55 = 0; _t55 < e.length; _t55++) n += \"\\n vec2 center\".concat(_t55, \" = vec2(ring\").concat(_t55, \"[0][0], ring\").concat(_t55, \"[0][1]);\\n float radius\").concat(_t55, \" = ring\").concat(_t55, \"[0][2];\\n float speed\").concat(_t55, \" = ring\").concat(_t55, \"[1][0];\\n vec3 color\").concat(_t55, \" = vec3(ring\").concat(_t55, \"[1][1], ring\").concat(_t55, \"[1][2], ring\").concat(_t55, \"[2][0]);\\n float direction\").concat(_t55, \" = ring\").concat(_t55, \"[2][1];\\n float height\").concat(_t55, \" = ring\").concat(_t55, \"[2][2];\\n vec4 ringColor\").concat(_t55, \" = glowring(vWorldPosition, center\").concat(_t55, \", radius\").concat(_t55, \", speed\").concat(_t55, \", color\").concat(_t55, \", direction\").concat(_t55, \", height\").concat(_t55, \");\\n color += ringColor\").concat(_t55, \";\\n \");\n return n += \"gl_FragColor = color;\", t = t.replace(\"gl_FragColor = color;\", n), t;\n } },\n {\n key: \"_updateUniforms\",\n value: function _updateUniforms(e, t) {\n for (var _n36 = 0; _n36 < t.length; _n36++) e[\"ring\".concat(_n36)] = t[_n36];\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n this._fbo && this._fbo.destroy(), this._shader && this._shader.dispose();\n } },\n {\n key: \"_resize\",\n value: function _resize() {\n var e = m(this._viewport.width.data) ? this._viewport.width.data() : this._viewport.width,\n t = m(this._viewport.height.data) ? this._viewport.height.data() : this._viewport.height;\n !this._fbo || this._fbo.width === e && this._fbo.height === t || this._fbo.resize(e, t);\n } }]);\n\n }();\n var vn = [],\n _n = {\n width: 4,\n type: \"float\" };\n\n var gn = function () {\n function gn(e, t, n) {\n _classCallCheck(this, gn);\n this._regl = e, this.joints = t, this.inverseBindMatrices = [], this.jointMatrices = [], this.jointData = new Float32Array(16 * t.length);\n for (var _e68 = 0; _e68 < t.length; ++_e68) this.inverseBindMatrices.push(new Float32Array(n.buffer, n.byteOffset + 16 * Float32Array.BYTES_PER_ELEMENT * _e68, 16)), this.jointMatrices.push(new Float32Array(this.jointData.buffer, 16 * Float32Array.BYTES_PER_ELEMENT * _e68, 16));\n this.jointTextureSize = [4, 6];\n }\n return _createClass(gn, [{\n key: \"update\",\n value: function update(t, n, r) {\n _glMatrix.mat4.invert(vn, t);\n for (var _t56 = 0; _t56 < this.joints.length; ++_t56) {\n var _r25 = this.jointMatrices[_t56];\n _glMatrix.mat4.multiply(_r25, vn, n[this.joints[_t56].nodeIndex]), _glMatrix.mat4.multiply(_r25, _r25, this.inverseBindMatrices[_t56]);\n }\n _n.height = this.joints.length, _n.data = this.jointData;\n var i = _n;\n return r ? r(i) : r = this._regl.texture(i), r;\n } }]);\n\n }();\n var xn = [0, 0, 0],\n pn = [0, 0, 0, 1],\n bn = [1, 1, 1],\n yn = [];\n var An = function () {\n function An() {\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [0, 0, 0];\n var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0, 1];\n var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [1, 1, 1];\n _classCallCheck(this, An);\n this.translation = e, this.rotation = t, this.scale = n;\n }\n return _createClass(An, [{\n key: \"getMatrix\",\n value: function getMatrix() {\n return _glMatrix.mat4.fromRotationTranslationScale(yn, this.rotation, this.translation, this.scale);\n } },\n {\n key: \"decompose\",\n value: function decompose(t) {\n _glMatrix.mat4.getTranslation(this.translation, t), _glMatrix.mat4.getRotation(this.rotation, t), _glMatrix.mat4.getScaling(this.scale, t);\n } },\n {\n key: \"update\",\n value: function update(e) {\n e && (e.translation && !_glMatrix.vec3.equals(e.translation, xn) && _glMatrix.vec3.copy(this.translation, e.translation), e.rotation && !_glMatrix.quat.equals(e.rotation, pn) && _glMatrix.quat.copy(this.rotation, e.rotation), e.scale && !_glMatrix.vec3.equals(e.scale, bn) && _glMatrix.vec3.copy(this.scale, e.scale));\n } }]);\n\n }();\n var Sn = function () {\n function Sn(e) {\n _classCallCheck(this, Sn);\n this._init(e);\n }\n return _createClass(Sn, [{\n key: \"_init\",\n value: function _init(e) {\n this.bbox = e.bbox, this.geometry = e.geometry, this.nodeMatrix = e.nodeMatrix, this.materialInfo = e.materialInfo, this.extraInfo = e.extraInfo, this.animationMatrix = e.animationMatrix, this.morphWeights = e.morphWeights, this.skin = e.skin, this.nodeIndex = e.nodeIndex;\n } },\n {\n key: \"copyEdgeGeometry\",\n value: function copyEdgeGeometry() {\n this.copyGeometry || (this.copyGeometry = this._copyEdgeGeometry(this.geometry));\n } },\n {\n key: \"createCopyBarycentric\",\n value: function createCopyBarycentric() {\n this.copyGeometry && !this.copyGeometry.data.aBarycentric && (this.copyGeometry.buildUniqueVertex(), this.copyGeometry.createBarycentric(\"aBarycentric\"));\n } },\n {\n key: \"_copyEdgeGeometry\",\n value: function _copyEdgeGeometry(e) {\n var t = e.data,\n n = e.indices || e.elements,\n r = {};\n for (var _n37 in t) if (_n37 === e.desc.positionAttribute) if (p(t[_n37])) r[_n37] = t[_n37].slice();else if (t[_n37].buffer && t[_n37].buffer.destroy) r[_n37] = {\n buffer: t[_n37].buffer },\n p(t[_n37].array) && (r[_n37].array = t[_n37].array.slice());else {\n var _t57 = e._getAttributeData(_n37);\n r[_n37] = _n37 !== e.desc.positionAttribute ? _t57 : _t57.slice();\n }\n var i = void 0 !== n.length ? n.slice() : n,\n o = JSON.parse(JSON.stringify(e.desc)),\n a = new Se(r, i, 0, o);\n return a.properties = e.properties, a;\n } }]);\n\n }();\n var Tn = 0;\n var Mn = [],\n On = [];\n var Cn = function () {\n function Cn(e, t) {\n _classCallCheck(this, Cn);\n this.gltf = e, this.regl = t, this.geometries = [], t && (this._emptyTexture = t.texture({\n width: 2,\n height: 2 }));\n\n }\n return _createClass(Cn, [{\n key: \"getMeshesInfo\",\n value: function getMeshesInfo() {\n var _this20 = this;\n if (!this.gltf) return null;\n if (this.geometries.length) return this.geometries;\n this._createTextures(this.gltf.textures), this._createSkins(this.gltf.skins);\n return this.gltf.scenes[0].nodes.forEach(function (e) {\n _this20._parserNode(e, _this20.geometries);\n }), this._checkBaseColorFactor(), this.geometries;\n } },\n {\n key: \"getGLTFBBox\",\n value: function getGLTFBBox() {\n if (!this.gltf) return null;\n var e = this.geometries;\n if (!e || !e.length) return null;\n var t = [1 / 0, 1 / 0, 1 / 0],\n n = [-1 / 0, -1 / 0, -1 / 0];\n for (var _r26 = 0; _r26 < e.length; _r26++) {\n var _i21 = e[_r26].bbox,\n _o12 = _i21.min,\n _a13 = _i21.max;\n _o12[0] < t[0] && (t[0] = _o12[0]), _o12[1] < t[1] && (t[1] = _o12[1]), _o12[2] < t[2] && (t[2] = _o12[2]), _a13[0] > n[0] && (n[0] = _a13[0]), _a13[1] > n[1] && (n[1] = _a13[1]), _a13[2] > n[2] && (n[2] = _a13[2]);\n }\n return {\n min: t,\n max: n };\n\n } },\n {\n key: \"_createSkins\",\n value: function _createSkins(e) {\n var _this21 = this;\n if (e) {\n this._skinMap = {};\n for (var _t58 = 0; _t58 < e.length; _t58++) {\n var _n38 = e[_t58];\n _n38.joints = _n38.joints.map(function (e) {\n return _this21.gltf.nodes[e];\n }), this._skinMap[_t58] = new gn(this.regl, _n38.joints, _n38.inverseBindMatrices.array), delete _n38.inverseBindMatrices;\n }\n }\n } },\n {\n key: \"_createTextures\",\n value: function _createTextures(e) {\n if (e) {\n this._textureMap = {};\n for (var _t59 = 0; _t59 < e.length; _t59++) {\n var _n39 = e[_t59];\n this._textureMap[_t59] || (this._textureMap[_t59] = this._toTexture(_n39), delete _n39.image);\n }\n }\n } },\n {\n key: \"_checkBaseColorFactor\",\n value: function _checkBaseColorFactor() {\n if (!this._checkBaseColorFactorAlpha()) for (var _e69 = 0; _e69 < this.geometries.length; _e69++) {\n var _t60 = this.geometries[_e69].materialInfo.baseColorFactor;\n _t60 && 0 === _t60[3] && (_t60[3] = 1);\n }\n } },\n {\n key: \"_checkBaseColorFactorAlpha\",\n value: function _checkBaseColorFactorAlpha() {\n for (var _e70 = 0; _e70 < this.geometries.length; _e70++) {\n var _t61 = this.geometries[_e70].materialInfo.baseColorFactor;\n if (_t61 && _t61[3] > 0) return !0;\n }\n return !1;\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n this._emptyTexture && this._emptyTexture.destroy();\n var e = this.getMeshesInfo();\n if (e) {\n e.forEach(function (e) {\n e.geometry.dispose();\n for (var _t62 in e.materialInfo) {\n var _n40 = e.materialInfo[_t62];\n _n40 && _n40.destroy && !_n40[L] && _n40.destroy();\n }\n });\n for (var _e71 in this._textureMap) {\n var _t63 = this._textureMap[_e71];\n _t63 && _t63.destroy && !_t63[L] && _t63.destroy();\n }\n delete this.gltf;\n }\n } },\n {\n key: \"updateAnimation\",\n value: function updateAnimation(e, t, n, r, i, o, a, s) {\n var _this22 = this;\n var c = this.gltf;\n if (!c) return;\n var l = f();\n if (Tn = c.animations ? l.GLTFLoader.getAnimationTimeSpan(c, r) : null, !Tn) return;\n e -= i;\n var d = 0;\n d = t || !t && this._isFirstLoop(e, n, r, i) ? e * n * .001 % (Tn.max - Tn.min) + Tn.min : e * n * .001 + Tn.min, c.scenes[0].nodes.forEach(function (e) {\n _this22._updateNodeMatrix(r, d, e, null, o, s);\n });\n for (var _e72 in this.gltf.nodes) {\n var _t64 = this.gltf.nodes[_e72],\n _n41 = o[_t64.nodeIndex];\n if (_t64.skin && _n41) {\n var _e73 = _t64.skin.update(_n41, o, a[_t64.nodeIndex] && a[_t64.nodeIndex].jointTexture);\n a[_t64.nodeIndex] || (a[_t64.nodeIndex] = {\n jointTextureSize: _t64.skin.jointTextureSize,\n numJoints: _t64.skin.joints.length }),\n a[_t64.nodeIndex].jointTexture = _e73;\n }\n }\n } },\n {\n key: \"_isFirstLoop\",\n value: function _isFirstLoop(e, t, n, r) {\n var i = this.gltf;\n if (!r || !i) return !0;\n var o = f();\n return Tn = i.animations ? o.GLTFLoader.getAnimationTimeSpan(i, n) : null, e * t * .001 / (Tn.max - Tn.min) < 1;\n } },\n {\n key: \"hasSkinAnimation\",\n value: function hasSkinAnimation() {\n return !!this._isAnimation;\n } },\n {\n key: \"_updateNodeMatrix\",\n value: function _updateNodeMatrix(t, n, r, i, o, a) {\n var _this23 = this;\n r.trs && (a ? a.indexOf(Number(r.nodeIndex)) > -1 && this._updateNodeTRS(r, n, t) : this._updateNodeTRS(r, n, t)), o[r.nodeIndex] = i ? _glMatrix.mat4.multiply(o[r.nodeIndex] || [], i, r.matrix || r.trs.getMatrix()) : _glMatrix.mat4.copy(o[r.nodeIndex] || [], r.matrix || r.trs.getMatrix()), r.children && r.children.forEach(function (e) {\n _this23._updateNodeMatrix(t, n, e, o[r.nodeIndex], o, a);\n });\n } },\n {\n key: \"_updateNodeTRS\",\n value: function _updateNodeTRS(e, t, n) {\n var r = f().GLTFLoader.getAnimationClip(this.gltf, Number(e.nodeIndex), t, n);\n r.weights && this._updateMorph(e, r.weights), e.trs.update(r);\n } },\n {\n key: \"_updateMorph\",\n value: function _updateMorph(e, t) {\n var n = t.length;\n if (!e.influencesList) {\n e.influencesList = [];\n for (var _t65 = 0; _t65 < n; _t65++) e.influencesList[_t65] = [_t65, 0];\n }\n var r = e.influencesList;\n for (var _e74 = 0; _e74 < r.length; _e74++) {\n var _n42 = r[_e74];\n _n42[0] = _e74, _n42[1] = t[_e74];\n }\n r.sort(Pn);\n var i = [];\n for (var _e75 = 0; _e75 < 8; _e75++) i[_e75] = [_e75, 0];\n for (var _e76 = 0; _e76 < 8; _e76++) _e76 < n && r[_e76][1] ? (i[_e76][0] = r[_e76][0], i[_e76][1] = r[_e76][1]) : (i[_e76][0] = Number.MAX_SAFE_INTEGER, i[_e76][1] = 0);\n i.sort(En);\n e.geometries.forEach(function (e) {\n var t = e.properties.morphTargets;\n for (var _n43 = 0; _n43 < 8; _n43++) {\n var _r27 = i[_n43],\n _o13 = _r27[0],\n _a14 = _r27[1];\n _o13 !== Number.MAX_SAFE_INTEGER && _a14 ? (e.updateData(\"POSITION\" + _n43, t[\"POSITION_\" + _o13].array), e.properties.morphWeights[_n43] = _a14) : e.properties.morphWeights[_n43] = 0;\n }\n });\n } },\n {\n key: \"_parserNode\",\n value: function _parserNode(t, n, r) {\n var _this24 = this;\n if (t.isParsed) return;\n t.nodeMatrix = t.nodeMatrix || _glMatrix.mat4.identity([]), t.localMatrix = t.localMatrix || _glMatrix.mat4.identity([]), t.matrix ? (t.trs = new An(), t.trs.decompose(t.matrix)) : t.trs = new An(t.translation, t.rotation, t.scale), t.localMatrix = t.trs.getMatrix(), r ? _glMatrix.mat4.multiply(t.nodeMatrix, r, t.matrix || t.localMatrix) : _glMatrix.mat4.copy(t.nodeMatrix, t.matrix || t.localMatrix);\n var i = t.nodeMatrix;\n if (t.children) for (var _e77 = 0; _e77 < t.children.length; _e77++) {\n this._parserNode(t.children[_e77], n, i);\n }\n if (h(t.skin)) {\n this._isAnimation = !0;\n var _e78 = t.skin;\n t.trs = new An(), t.skin = this._skinMap[_e78];\n }\n if (h(t.mesh)) {\n t.mesh = this.gltf.meshes[t.mesh], t.mesh.node = t, t.geometries = t.geometries || [], t.mesh.primitives.forEach(function (r) {\n var o = _this24._createMaterialInfo(r.material),\n a = function (e, t, n) {\n var r = e.attributes,\n i = r.COLOR_0;\n if (i && i.array instanceof Float32Array) {\n var _e79 = new Uint8Array(i.array.length);\n for (var _t66 = 0; _t66 < _e79.length; _t66++) _e79[_t66] = Math.round(255 * i.array[_t66]);\n i.array = _e79;\n } else if (i && (i.array instanceof Uint16Array || i.array instanceof Int16Array || i.array instanceof Uint32Array || i.array instanceof Int32Array)) {\n var _e80 = new Uint8Array(i.array);\n i.array = _e80;\n }\n n && r.TEXCOORD_0 && !r.TEXCOORD_0 && (r.TEXCOORD_1 = r.TEXCOORD_0);\n var o = {};\n for (var _e81 in r) o[_e81] = v({}, r[_e81]), t && (o[_e81].buffer = he(t, r[_e81], {\n dimension: r[_e81].itemSize }));\n\n if (e.morphTargets) {\n var _e82 = P(o.POSITION) ? o.POSITION.itemSize * o.POSITION.count : o.POSITION.array.length;\n for (var _t67 = 0; _t67 < 8; _t67++) o[\"POSITION\".concat(_t67)] || (o[\"POSITION\".concat(_t67)] = new Float32Array(_e82).fill(0));\n for (var _e83 = 0; _e83 < 4; _e83++) {\n o[\"NORMAL\".concat(_e83)] || (o[\"NORMAL\".concat(_e83)] = new Float32Array(o.NORMAL.array ? o.NORMAL.array.length : o.NORMAL.length).fill(0));\n }\n }\n var a = e.indices;\n a && void 0 === a.bufferView && a.array && (a = a.array);\n var s = new Z(o, a, 0, {\n primitive: g(e.mode) ? ee(e.mode) : e.mode,\n positionAttribute: \"POSITION\",\n normalAttribute: \"NORMAL\",\n uv0Attribute: \"TEXCOORD_0\",\n uv1Attribute: \"TEXCOORD_1\",\n color0Attribute: \"COLOR_0\" });\n\n e.morphTargets && (s.properties.morphWeights = []);\n e.mode > 3 && !s.data.NORMAL && s.createNormal(\"NORMAL\");\n return s;\n }(r, _this24.regl, o.occlusionTexture);\n a.properties.morphTargets = r.morphTargets, t.geometries.push(a);\n var s = a.boundingBox.copy();\n s = s.transform(_glMatrix.mat4.identity(Mn), i);\n var c = {\n geometry: a,\n bbox: s,\n nodeMatrix: i,\n materialInfo: o,\n extraInfo: _this24._createExtralInfo(r.material),\n animationMatrix: t.trs.getMatrix(),\n morphWeights: t.weights,\n nodeIndex: t.nodeIndex };\n\n t.skin && (c.skin = {\n jointTextureSize: [4, 6],\n numJoints: t.skin.joints.length,\n jointTexture: t.skin.jointTexture });\n\n var l = new Sn(c);\n n.push(l);\n });\n }\n t.isParsed = !0;\n } },\n {\n key: \"_createMaterialInfo\",\n value: function _createMaterialInfo(e) {\n var t = {};\n if (this.gltf.materials && this.gltf.materials[e]) {\n var _n44 = this.gltf.materials[e],\n _r28 = _n44.pbrMetallicRoughness;\n if (_r28) {\n var _e84 = _r28.metallicRoughnessTexture,\n _n45 = _r28.baseColorTexture;\n _n45 && (t.baseColorTexture = this._getTexture(_n45), _n45.KHR_texture_transform && (t.khr_offset = _n45.KHR_texture_transform.offset || [0, 0], t.khr_rotation = _n45.KHR_texture_transform.rotation || 0, t.khr_scale = _n45.KHR_texture_transform.scale || [1, 1])), _r28.baseColorFactor && (t.baseColorFactor = _r28.baseColorFactor), _e84 ? t.metallicRoughnessTexture = this._getTexture(_e84) : (t.metallicFactor = h(_r28.metallicFactor) ? _r28.metallicFactor : 1, t.roughnessFactor = h(_r28.roughnessFactor) ? _r28.roughnessFactor : 1);\n }\n var _i22 = _n44.extensions;\n if (_i22 && _i22.KHR_materials_pbrSpecularGlossiness) {\n var _e85 = _i22.KHR_materials_pbrSpecularGlossiness;\n t.name = \"pbrSpecularGlossiness\";\n for (var _n46 in _e85) t[_n46] = h(_e85[_n46].index) ? this._getTexture(_e85[_n46]) : _e85[_n46];\n }\n _n44.normalTexture && (t.normalTexture = this._getTexture(_n44.normalTexture)), _n44.occlusionTexture && (t.occlusionTexture = this._getTexture(_n44.occlusionTexture)), _n44.emissiveTexture && (t.emissiveTexture = this._getTexture(_n44.emissiveTexture)), _n44.emissiveFactor && (t.emissiveFactor = _n44.emissiveFactor), t.alphaCutoff = _n44.alphaCutoff || .5, t.doubleSided = _n44.doubleSided, t.alphaMode = _n44.alphaMode || \"OPAQUE\";\n }\n return t;\n } },\n {\n key: \"_createExtralInfo\",\n value: function _createExtralInfo(e) {\n var t = {};\n if (this.gltf.materials && this.gltf.materials[e]) {\n var _n47 = this.gltf.materials[e];\n t.doubleSided = _n47.doubleSided, t.alphaMode = _n47.alphaMode || \"OPAQUE\";\n }\n return t;\n } },\n {\n key: \"_getTexture\",\n value: function _getTexture(e) {\n var t = e.extensions,\n n = e.index;\n if (!h(n)) return null;\n t && t.KHR_texture_transform && (e.KHR_texture_transform = t.KHR_texture_transform);\n var r = this._textureMap[n];\n return r.texInfo = e, r;\n } },\n {\n key: \"_toTexture\",\n value: function _toTexture(e) {\n if (!e) return this._emptyTexture;\n var t = e.sampler || {};\n return new ct({\n width: e.image.width,\n height: e.image.height,\n data: e.image.array,\n mag: ae(t.magFilter) || \"linear\",\n min: ce(t.minFilter) || \"linear mipmap linear\",\n wrapS: fe(t.wrapS) || \"repeat\",\n wrapT: fe(t.wrapT) || \"repeat\" });\n\n } },\n {\n key: \"arrangeAlongLine\",\n value: function arrangeAlongLine(e, t, n, r, i, o) {\n var a = [],\n s = this._getRotationZ(e, t),\n c = (e.z || 0) - (t.z || 0),\n l = this._getRotationXY(n, c);\n var f = this._calBoxWidth(r, o);\n f /= i;\n var d = Math.sqrt(n * n + c * c),\n u = Math.floor(d / f);\n var h = o.direction || 0;\n if (1 === h ? h = 2 : 2 === h && (h = 1), u >= 1) {\n for (var _n48 = 1; _n48 <= u; _n48++) {\n var _r29 = f * (_n48 - .5) / d,\n _i23 = {\n coordinates: wn(e, t, _r29),\n t: _r29,\n scale: [1, 1, 1],\n rotation: [0, 0, s],\n rotationZ: s,\n rotationXY: l };\n\n a.push(_i23);\n }\n if (o.scaleVertex) {\n var _n49 = (f * u + (d - f * u) / 2) / d,\n _r30 = [1, 1, 1];\n _r30[h] = (d - f * u) / f;\n var _i24 = {\n coordinates: wn(e, t, _n49),\n t: _n49,\n scale: _r30,\n rotation: [0, 0, s],\n rotationZ: s,\n rotationXY: l };\n\n a.push(_i24);\n }\n } else if (o.scaleVertex) {\n var _n50 = [1, 1, 1];\n _n50[h] = d / f;\n var _r31 = {\n coordinates: wn(e, t, .5),\n t: .5,\n scale: _n50,\n rotation: [0, 0, s],\n rotationZ: s,\n rotationXY: l };\n\n a.push(_r31);\n }\n return a;\n } },\n {\n key: \"calModelHeightScale\",\n value: function calModelHeightScale(e, n) {\n var r = this.getGLTFBBox(),\n i = n / Math.abs(r.max[1] - r.min[1]);\n return _glMatrix.vec3.set(e, i, i, i);\n } },\n {\n key: \"_calBoxWidth\",\n value: function _calBoxWidth(e, n) {\n var r = this.getGLTFBBox(),\n i = n.direction || 0,\n o = _glMatrix.vec3.sub(On, r.max, r.min);\n _glMatrix.vec3.multiply(o, o, e);\n return o[i] + n.gapLength;\n } },\n {\n key: \"_getRotationZ\",\n value: function _getRotationZ(e, t) {\n return Math.atan2(e.y - t.y, e.x - t.x) / Math.PI * 180;\n } },\n {\n key: \"_getRotationXY\",\n value: function _getRotationXY(e, t) {\n return 180 * Math.atan(t / e) / Math.PI;\n } }]);\n\n }();\n function En(e, t) {\n return e[0] - t[0];\n }\n function Pn(e, t) {\n return Math.abs(t[1]) - Math.abs(e[1]);\n }\n function wn(e, t, n) {\n var r = In(e.x, t.x, n),\n i = In(e.y, t.y, n),\n o = In(e.z || 0, t.z || 0, n);\n return new e.constructor(r, i, o);\n }\n function In(e, t, n) {\n return e + n * (t - e);\n }\n function Rn(e, t) {\n var _f4 = f(),\n n = _f4.Ajax,\n r = t.fetchOptions,\n i = t.gltfLoaderOptions,\n o = t.urlModifier,\n a = i || {};\n a.urlModifier = o;\n var s = e.lastIndexOf(\"/\"),\n c = e.slice(0, s),\n l = e.slice(e.lastIndexOf(\".\")).toLowerCase();\n return \".gltf\" === l ? n.getJSON(e, r, o).then(function (e) {\n return Hn(c, e, a);\n }) : \".glb\" === l ? n.getArrayBuffer(e, r, o).then(function (e) {\n return Hn(c, {\n buffer: e.data,\n byteOffset: 0 },\n a);\n }) : null;\n }\n function Dn(e, t) {\n return new Cn(e, t);\n }\n function Hn(e, t, n) {\n var _f5 = f(),\n r = _f5.GLTFLoader;\n return new r(e, t, n).load();\n }\n var Fn = exports.GLTFHelper = Object.freeze({\n __proto__: null,\n exportGLTFPack: Dn,\n load: Rn,\n loadGLTF: Hn });\n\n var Nn = [-1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, 1],\n Ln = [0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],\n kn = [3, 1, 0, 0, 2, 3],\n Bn = [0, 0, 1, 0, 0, 1, 1, 1],\n zn = {\n vertices: [-.8111000061035156, 2.0102999210357666, -.8111000061035156, 0, .010300000198185444, -0, -.8111000061035156, 2.0102999210357666, .8111000061035156, -.8111000061035156, 2.0102999210357666, .8111000061035156, 0, .010300000198185444, -0, .8111000061035156, 2.0102999210357666, .8111000061035156, .8111000061035156, 2.0102999210357666, .8111000061035156, 0, .010300000198185444, -0, .8111000061035156, 2.0102999210357666, -.8111000061035156, .8111000061035156, 2.0102999210357666, -.8111000061035156, 0, .010300000198185444, -0, -.8111000061035156, 2.0102999210357666, -.8111000061035156, .8111000061035156, 2.0102999210357666, -.8111000061035156, -.8111000061035156, 2.0102999210357666, -.8111000061035156, 0, 2.9419000148773193, -0, .8111000061035156, 2.0102999210357666, .8111000061035156, .8111000061035156, 2.0102999210357666, -.8111000061035156, 0, 2.9419000148773193, -0, -.8111000061035156, 2.0102999210357666, -.8111000061035156, -.8111000061035156, 2.0102999210357666, .8111000061035156, 0, 2.9419000148773193, -0, -.8111000061035156, 2.0102999210357666, .8111000061035156, .8111000061035156, 2.0102999210357666, .8111000061035156, 0, 2.9419000148773193, -0],\n normals: [-.9267006516456604, -.3758002817630768, -0, -.9267006516456604, -.3758002817630768, -0, -.9267006516456604, -.3758002817630768, -0, 0, -.3758002817630768, .9267006516456604, 0, -.3758002817630768, .9267006516456604, 0, -.3758002817630768, .9267006516456604, .9267006516456604, -.3758002817630768, -0, .9267006516456604, -.3758002817630768, -0, .9267006516456604, -.3758002817630768, -0, 0, -.3758002817630768, -.9267006516456604, 0, -.3758002817630768, -.9267006516456604, 0, -.3758002817630768, -.9267006516456604, 0, .656676173210144, -.7541726231575012, 0, .656676173210144, -.7541726231575012, 0, .656676173210144, -.7541726231575012, .7541726231575012, .656676173210144, -0, .7541726231575012, .656676173210144, -0, .7541726231575012, .656676173210144, -0, -.7541726231575012, .656676173210144, -0, -.7541726231575012, .656676173210144, -0, -.7541726231575012, .656676173210144, -0, 0, .656676173210144, .7541726231575012, 0, .656676173210144, .7541726231575012, 0, .656676173210144, .7541726231575012],\n indices: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23] },\n\n Gn = [\"cube\", \"plane\", \"pyramid\"],\n Vn = {\n cube: {\n meshes: [{\n primitives: [{\n attributes: {\n POSITION: {\n array: new Int8Array([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]) },\n\n NORMAL: {\n array: new Int8Array([0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 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, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1]) },\n\n TEXCOORD_0: {\n array: new Int8Array([0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1]) } },\n\n\n indices: new Uint16Array([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]),\n mode: 4 }] }],\n\n\n scenes: [{\n nodes: [{\n mesh: 0,\n scale: [60, 60, 60] }] }] },\n\n\n\n \"plane-cube\": {\n meshes: [{\n primitives: [{\n attributes: {\n POSITION: {\n array: new Int8Array(Nn) },\n\n TEXCOORD_0: {\n array: new Int8Array(Bn) } },\n\n\n indices: new Uint16Array(kn),\n mode: 4 }] }],\n\n\n scenes: [{\n nodes: [{\n mesh: 0,\n scale: [60, 60, 60],\n translation: [0, -60, 0] },\n {\n mesh: 0,\n scale: [60, 60, 60],\n translation: [0, 60, 0] },\n {\n mesh: 0,\n scale: [60, 60, 60],\n translation: [60, 0, 0],\n rotation: [0, 0, .7071067811865475, .7071067811865476] },\n {\n mesh: 0,\n scale: [60, 60, 60],\n translation: [-60, 0, 0],\n rotation: [0, 0, .7071067811865475, .7071067811865476] },\n {\n mesh: 0,\n scale: [60, 60, 60],\n translation: [0, 0, 60],\n rotation: [.7071067811865475, 0, 0, .7071067811865476] },\n {\n mesh: 0,\n scale: [60, 60, 60],\n translation: [0, 0, -60],\n rotation: [.7071067811865475, 0, 0, .7071067811865476] }] }] },\n\n\n\n plane: {\n meshes: [{\n primitives: [{\n attributes: {\n POSITION: {\n array: new Int8Array(Nn) },\n\n NORMAL: {\n array: new Int8Array(Ln) },\n\n TEXCOORD_0: {\n array: new Int8Array(Bn) } },\n\n\n indices: new Uint16Array(kn),\n mode: 4 }] }],\n\n\n scenes: [{\n nodes: [{\n mesh: 0,\n scale: [60, 60, 60] }] }] },\n\n\n\n pyramid: {\n meshes: [{\n primitives: [{\n attributes: {\n POSITION: {\n array: new Float32Array(zn.vertices) },\n\n NORMAL: {\n array: new Float32Array(zn.normals) },\n\n TEXCOORD_0: {\n array: new Float32Array(zn.uv) } },\n\n\n indices: new Uint16Array(zn.indices),\n mode: 4 }] }],\n\n\n scenes: [{\n nodes: [{\n mesh: 0,\n scale: [60, 60, 60] }] }] } };\n\n\n\n\n var Un = exports.GLTFManager = function () {\n function Un(e, t) {\n _classCallCheck(this, Un);\n this.regl = e, this.resourceMap = {}, this.options = t || {};\n }\n return _createClass(Un, [{\n key: \"getGLTF\",\n value: function getGLTF(e) {\n return this.resourceMap[e];\n } },\n {\n key: \"loginGLTF\",\n value: function loginGLTF(e, t) {\n var _this25 = this;\n if (this.resourceMap[e]) this.resourceMap[e].refCount += 1;else {\n if (Vn[e]) {\n var _t68 = function (e) {\n var t = null;\n return Vn[e] && (t = {\n meshes: Vn[e].meshes },\n t.scenes = JSON.parse(JSON.stringify(Vn[e].scenes))), t;\n }(e);\n this.resourceMap[e] = this._exportGLTFResource(_t68, e, !1);\n } else this.resourceMap[e] = t ? t(e).then(function (t) {\n return _this25.resourceMap[e] = _this25._exportGLTFResource(t, e), _this25.resourceMap[e];\n }) : this._loadGLTFModel(e);\n this.resourceMap[e].refCount = 1;\n }\n } },\n {\n key: \"logoutGLTF\",\n value: function logoutGLTF(e) {\n if (this.resourceMap[e] && (this.resourceMap[e].refCount -= 1, this.resourceMap[e].refCount < 1)) {\n var _t69 = this.resourceMap[e].resources;\n if (_t69) for (var _e86 = 0; _e86 < _t69.length; _e86++) _t69[_e86].geometry.dispose(), _t69[_e86].copyGeometry && _t69[_e86].copyGeometry.dispose(), _t69[_e86].material && _t69[_e86].material.dispose();\n this.resourceMap[e].gltfPack && this.resourceMap[e].gltfPack.dispose(), delete this.resourceMap[e];\n }\n } },\n {\n key: \"isSimpleModel\",\n value: function isSimpleModel(e) {\n return Vn[e];\n } },\n {\n key: \"addSimpleModel\",\n value: function addSimpleModel(e, t) {\n !function (e, t) {\n \"string\" == typeof e && Gn.indexOf(e) < 0 && (Vn[e] = t);\n }(e, t);\n } },\n {\n key: \"removeSimpleModel\",\n value: function removeSimpleModel(e) {\n delete Vn[e];\n } },\n {\n key: \"_exportGLTFResource\",\n value: function _exportGLTFResource(e, t) {\n var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;\n if (!e) return null;\n var r = Dn(e, n ? this.regl : null),\n i = r.getMeshesInfo();\n return {\n bbox: r.getGLTFBBox(),\n gltfPack: r,\n resources: i,\n json: e.json,\n refCount: this.resourceMap[t] ? this.resourceMap[t].refCount : 0 };\n\n } },\n {\n key: \"fetchGLTF\",\n value: function fetchGLTF(e) {\n return Rn(e, this.options).then(function (e) {\n return e;\n });\n } },\n {\n key: \"_loadGLTFModel\",\n value: function _loadGLTFModel(e) {\n var _this26 = this;\n return this.fetchGLTF(e).then(function (t) {\n return _this26.resourceMap[e] = _this26._exportGLTFResource(t, e), _this26.resourceMap[e];\n });\n } }]);\n\n }();\n var jn = function () {\n var t = [0, 0, 0],\n n = 90 * Math.PI / 180,\n r = [0, 0, 0, 0],\n i = new Array(16);\n return function (o, a, s, c, l, f) {\n var d = [_glMatrix.mat4.lookAt([], t, [1, 0, 0], f && f[0] || [0, -1, 0]), _glMatrix.mat4.lookAt([], t, [-1, 0, 0], f && f[1] || [0, -1, 0]), _glMatrix.mat4.lookAt([], t, [0, 1, 0], f && f[2] || [0, 0, 1]), _glMatrix.mat4.lookAt([], t, [0, -1, 0], f && f[3] || [0, 0, -1]), _glMatrix.mat4.lookAt([], t, [0, 0, 1], f && f[4] || [0, -1, 0]), _glMatrix.mat4.lookAt([], t, [0, 0, -1], f && f[5] || [0, -1, 0])],\n u = {\n context: {\n viewMatrix: function viewMatrix(e, t, n) {\n return d[n];\n },\n projMatrix: _glMatrix.mat4.perspective(i, n, 1, .5, 1.1) } };\n\n\n a && (u.framebuffer = a.faces ? function (e, t, n) {\n return a.faces[n];\n } : a);\n return o(u)(6, function (e, t, n) {\n var i = {\n color: r,\n depth: 1 };\n\n a && (i.framebuffer = a.faces ? a.faces[n] : a), o.clear(i), s(c), l && l();\n }), a;\n };\n }();\n var Xn = {\n vertices: [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],\n textures: [1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0],\n indices: [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] },\n\n Wn = \"#define SHADER_NAME CUBE_MAP\\nattribute vec3 aPosition;\\nvarying vec3 vWorldPos;\\nuniform mat4 projMatrix;\\nuniform mat4 viewMatrix;\\nvoid main() {\\n vWorldPos = aPosition;\\n gl_Position = projMatrix * viewMatrix * vec4(vWorldPos, 1.);\\n}\",\n qn = \"#define SHADER_NAME CUBEMAP\\nprecision highp float;\\nuniform samplerCube cubeMap;\\nuniform float exposure;\\nvarying vec3 vWorldPos;\\n#ifdef ENCODE_RGBM\\nvec4 c(const in vec3 d, const in float e) {\\n if(e <= .0)\\n return vec4(d, 1.);\\n vec4 f;\\n vec3 h = d / e;\\n f.a = clamp(max(max(h.r, h.g), max(h.b, 1e-6)), .0, 1.);\\n f.a = ceil(f.a * 255.) / 255.;\\n f.rgb = h / f.a;\\n return f;\\n}\\n#endif\\nvoid main() {\\n vec4 i = textureCube(cubeMap, vWorldPos);\\n i.rgb *= exposure;\\n#ifdef ENCODE_RGBM\\ni = c(i.rgb, 7.);\\n#endif\\n#if __VERSION__ == 100\\ngl_FragColor = i;\\n#endif\\n}\",\n Kn = \"precision highp float;\\n#define PI 3.1415926\\nvarying vec3 vWorldPos;\\nuniform sampler2D equirectangularMap;\\nconst vec2 c = vec2(.1591, .3183);\\nvec2 d(vec3 e) {\\n vec2 f = vec2(atan(e.y, e.x), asin(e.z));\\n f *= c;\\n f += .5;\\n return f;\\n}\\nvoid main() {\\n vec2 f = d(normalize(vWorldPos));\\n vec4 h = texture2D(equirectangularMap, f);\\n gl_FragColor = vec4(h.rgb, 1.);\\n}\",\n Jn = \"#define SHADER_NAME PBR_prefilter\\nprecision highp float;\\nvarying vec3 vWorldPos;\\nuniform samplerCube environmentMap;\\nuniform sampler2D distributionMap;\\nuniform float roughness;\\nuniform float resolution;\\nconst float c = 3.14159265359;\\nfloat d(vec3 e, vec3 f, float h) {\\n float a = h * h;\\n float i = a * a;\\n float j = max(dot(e, f), .0);\\n float k = j * j;\\n float l = i;\\n float m = (k * (i - 1.) + 1.);\\n m = c * m * m;\\n return l / m;\\n}\\nvec3 n(float o, vec3 e, float h) {\\n vec4 u = texture2D(distributionMap, vec2(h, o));\\n vec3 f = u.xyz;\\n float v = sign(u.w - .5);\\n float A = sign(u.w - 200.0 / 255. * clamp(v, .0, 1.) - .15);\\n f.x *= v;\\n f.y *= A;\\n vec3 B = abs(e.z) < .999 ? vec3(.0, .0, 1.) : vec3(1., .0, .0);\\n vec3 C = normalize(cross(B, e));\\n vec3 D = cross(e, C);\\n vec3 E = C * f.x + D * f.y + e * f.z;\\n return normalize(E);\\n}\\nvoid main() {\\n vec3 e = normalize(vWorldPos);\\n vec3 F = e;\\n vec3 G = F;\\n const int I = 1024;\\n vec3 J = vec3(.0);\\n float K = .0;\\n for(int L = 0; L < I; ++L) {\\n vec3 f = n(float(L) / float(I), e, roughness);\\n vec3 M = normalize(2. * dot(G, f) * f - G);\\n float O = max(dot(e, M), .0);\\n if(O > .0) {\\n J += textureCube(environmentMap, M).rgb * O;\\n K += O;\\n }\\n }\\n J = J / K;\\n gl_FragColor = vec4(J, 1.);\\n}\",\n Yn = \"precision highp float;\\nvarying vec2 vTexCoords;\\nuniform sampler2D distributionMap;\\nconst float c = 3.14159265359;\\nvec4 d(float a, float b) {\\n a *= 65535.;\\n b *= 65535.;\\n vec4 rgba;\\n rgba[0] = mod(a, 255.);\\n rgba[1] = (a - rgba[0]) / 65280.0;\\n rgba[2] = mod(b, 255.);\\n rgba[3] = (b - rgba[2]) / 65280.0;\\n return rgba;\\n}\\nvec3 e(float f, vec3 h, float i) {\\n vec4 j = texture2D(distributionMap, vec2(i, f));\\n vec3 k = j.xyz;\\n float l = sign(j.w - .5);\\n float m = sign(j.w - clamp(l, .0, 1.) * 200.0 / 255. - .15);\\n k.x *= l;\\n k.y *= m;\\n vec3 n = abs(h.z) < .999 ? vec3(.0, .0, 1.) : vec3(1., .0, .0);\\n vec3 o = normalize(cross(n, h));\\n vec3 u = cross(h, o);\\n vec3 v = o * k.x + u * k.y + h * k.z;\\n return normalize(v);\\n}\\nfloat A(float B, float i) {\\n float a = i;\\n float C = (a * a) / 2.;\\n float D = B;\\n float E = B * (1. - C) + C;\\n return D / E;\\n}\\nfloat F(float B, float G, float i) {\\n float I = A(B, i);\\n float J = A(G, i);\\n return J * I;\\n}\\nvec2 K(float B, float i) {\\n vec3 L;\\n L.x = sqrt(1. - B * B);\\n L.y = .0;\\n L.z = B;\\n float M = .0;\\n float O = .0;\\n vec3 h = vec3(.0, .0, 1.);\\n const int P = 1024;\\n for(int Q = 0; Q < P; ++Q) {\\n vec3 k = e(float(Q) / float(P), h, i);\\n vec3 R = normalize(2. * dot(L, k) * k - L);\\n float G = max(R.z, .0);\\n float S = max(k.z, .0);\\n float T = max(dot(L, k), .0);\\n float B = max(dot(h, L), .0);\\n if(G > .0) {\\n float U = F(B, G, i);\\n float W = (U * T) / (S * B);\\n float X = pow(1. - T, 5.);\\n M += (1. - X) * W;\\n O += X * W;\\n }\\n }\\n M /= float(P);\\n O /= float(P);\\n return vec2(M, O);\\n}\\nvoid main() {\\n vec2 Y = K(vTexCoords.x, vTexCoords.y);\\n gl_FragColor = d(Y.x, Y.y);\\n}\",\n Zn = \"attribute vec3 aPosition;\\nattribute vec2 aTexCoord;\\nvarying vec2 vTexCoords;\\nvoid main() {\\n vTexCoords = aTexCoord;\\n gl_Position = vec4(aPosition, 1.);\\n}\";\n function $n(e, t) {\n var n = e[0],\n r = e[1],\n i = e[2];\n return 0 === t ? 1 : 1 === t ? n : 2 === t ? r : 3 === t ? i : 4 === t ? n * i : 5 === t ? r * i : 6 === t ? n * r : 7 === t ? 3 * i * i - 1 : n * n - r * r;\n }\n var Qn = {\n px: [2, 1, 0, -1, -1, 1],\n nx: [2, 1, 0, 1, -1, -1],\n py: [0, 2, 1, 1, -1, -1],\n ny: [0, 2, 1, 1, 1, 1],\n pz: [0, 1, 2, -1, -1, -1],\n nz: [0, 1, 2, 1, -1, 1] },\n\n er = [\"px\", \"nx\", \"py\", \"ny\", \"pz\", \"nz\"];\n var tr = dt.compile(Vt);\n function nr(e, t, n, r) {\n var i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;\n var o = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : !1;\n var a = e({\n frag: (o ? \"#define ENCODE_RGBM\\n\" : \"\") + qn,\n vert: Wn,\n attributes: {\n aPosition: Xn.vertices },\n\n uniforms: {\n projMatrix: e.context(\"projMatrix\"),\n viewMatrix: e.context(\"viewMatrix\"),\n cubeMap: t,\n exposure: i },\n\n elements: Xn.indices }),\n\n s = [],\n c = e.texture({\n radius: n,\n min: \"linear\",\n mag: \"linear\",\n type: r ? \"float\" : \"uint8\",\n format: \"rgba\" }),\n\n l = e.framebuffer({\n radius: n,\n color: c });\n\n return jn(e, l, a, {\n size: n },\n function () {\n var t = e.read();\n if (r) {\n var _e87 = new Uint16Array(t.length);\n for (var _n51 = 0; _n51 < t.length; _n51++) _e87[_n51] = Math.min(st.toHalfFloat(t[_n51]), 65504);\n s.push(_e87);\n } else s.push(t);\n }), a.destroy(), l.destroy(), s;\n }\n var rr = new Int8Array([-1, 1, 0, -1, -1, 0, 1, 1, 0, 1, -1, 0]),\n ir = new Int8Array([0, 1, 0, 0, 1, 1, 1, 0]);\n function or(e, t, n, r) {\n t = t || 256;\n var i = ar(n = n || 1024, r = r || 256),\n o = e.texture({\n data: i,\n width: r,\n height: n,\n min: \"nearest\",\n mag: \"nearest\" }),\n\n a = e.buffer(rr),\n s = e.buffer(ir),\n c = e.framebuffer({\n radius: t,\n colorType: \"uint8\",\n colorFormat: \"rgba\",\n min: \"linear\",\n mag: \"linear\" }),\n\n l = e({\n frag: Yn,\n vert: Zn,\n attributes: {\n aPosition: {\n buffer: a },\n\n aTexCoord: {\n buffer: s } },\n\n\n uniforms: {\n distributionMap: o },\n\n framebuffer: c,\n viewport: {\n x: 0,\n y: 0,\n width: t,\n height: t },\n\n count: rr.length / 3,\n primitive: \"triangle strip\" });\n\n return l(), l.destroy(), a.destroy(), s.destroy(), o.destroy(), c;\n }\n function ar(e, t) {\n var n = new Float32Array(e * t * 4);\n for (var _r32 = 0; _r32 < e; _r32++) {\n var _sr = sr(_r32, e),\n _i25 = _sr.x,\n _o14 = _sr.y;\n for (var _e88 = 0; _e88 < t; _e88++) {\n var _a15 = _e88 / t,\n _s9 = _a15 * _a15,\n _c8 = 2 * Math.PI * _i25,\n _l5 = Math.sqrt((1 - _o14) / (1 + (_s9 * _s9 - 1) * _o14)),\n _f6 = Math.sqrt(1 - _l5 * _l5),\n _d3 = 4 * (_r32 * t + _e88),\n _u3 = _f6 * Math.cos(_c8),\n _h3 = _f6 * Math.sin(_c8);\n n[_d3] = Math.abs(255 * _u3), n[_d3 + 1] = Math.abs(255 * _h3), n[_d3 + 2] = 255 * _l5, n[_d3 + 3] = (_u3 > 0 ? 200 : 0) + (_h3 > 0 ? 55 : 0);\n }\n }\n return n;\n }\n function sr(e, t) {\n var n = (e << 16 | e >>> 16) >>> 0;\n return n = ((1431655765 & n) << 1 | (2863311530 & n) >>> 1) >>> 0, n = ((858993459 & n) << 2 | (3435973836 & n) >>> 2) >>> 0, n = ((252645135 & n) << 4 | (4042322160 & n) >>> 4) >>> 0, n = (((16711935 & n) << 8 | (4278255360 & n) >>> 8) >>> 0) / 4294967296, {\n x: e / t,\n y: n };\n\n }\n function cr(e) {\n return e._gl instanceof WebGL2RenderingContext || e.hasExtension(\"OES_texture_half_float\");\n }\n var lr = Object.freeze({\n __proto__: null,\n createIBLMaps: function createIBLMaps(e) {\n var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var r = n.envTexture,\n i = n.envCubeSize || 512,\n o = n.sampleSize || 1024,\n a = n.roughnessLevels || 256,\n s = n.prefilterCubeSize || 256;\n var c,\n l = !1;\n if (Array.isArray(r)) {\n var _t70 = e.cube({\n flipY: !0,\n faces: r });\n\n c = function (e, t, n) {\n var r = e({\n frag: tr,\n vert: Wn,\n attributes: {\n aPosition: Xn.vertices },\n\n uniforms: {\n hsv: [0, 0, 0],\n projMatrix: e.context(\"projMatrix\"),\n viewMatrix: e.context(\"viewMatrix\"),\n cubeMap: t,\n bias: 0,\n size: t.width,\n environmentExposure: 1,\n backgroundIntensity: 1 },\n\n elements: Xn.indices }),\n\n i = e.cube({\n width: n,\n height: n,\n min: \"linear\",\n mag: \"linear\",\n format: \"rgba\" }),\n\n o = e.framebufferCube({\n radius: n,\n color: i });\n\n return jn(e, o, r, {\n size: n },\n null, [[0, 0, -1], [0, 0, -1], [0, 0, 1], [0, 0, 1], [0, -1, 0], [0, -1, 0]]), r.destroy(), o;\n }(e, _t70, i), _t70.destroy();\n } else c = function (e, t, n) {\n if (!cr(e)) throw new Error(\"HDR is not supported for lack of support for float 16 texture\");\n n = n || 512;\n var r = e({\n frag: Kn,\n vert: Wn,\n attributes: {\n aPosition: Xn.vertices },\n\n uniforms: {\n projMatrix: e.context(\"projMatrix\"),\n viewMatrix: e.context(\"viewMatrix\"),\n equirectangularMap: t },\n\n elements: Xn.indices }),\n\n i = e.cube({\n width: n,\n height: n,\n min: \"linear mipmap linear\",\n mag: \"linear\",\n type: \"float16\",\n format: \"rgba\" }),\n\n o = e.framebufferCube({\n radius: n,\n color: i });\n\n return jn(e, o, r), r.destroy(), o;\n }(e, r, i), l = !0;\n var _ref4 = function (e, t, n, r, i, o) {\n var a = function (e, t, n, r, i, o) {\n r = r || 1024, i = i || 256;\n var a = ar(r, i),\n s = e.texture({\n data: a,\n width: i,\n height: r,\n min: \"nearest\",\n mag: \"nearest\" }),\n\n c = e({\n frag: Jn,\n vert: Wn,\n attributes: {\n aPosition: Xn.vertices },\n\n uniforms: {\n projMatrix: e.context(\"projMatrix\"),\n viewMatrix: e.context(\"viewMatrix\"),\n environmentMap: t,\n distributionMap: s,\n roughness: e.prop(\"roughness\"),\n resolution: n },\n\n elements: Xn.indices,\n viewport: {\n x: 0,\n y: 0,\n width: e.prop(\"size\"),\n height: e.prop(\"size\") } });\n\n\n var l = n;\n var f = e.texture({\n radius: n,\n min: \"linear\",\n mag: \"linear\",\n type: o ? \"float\" : \"uint8\" }),\n\n d = e.framebuffer({\n radius: n,\n color: f }),\n\n u = Math.log(l) / Math.log(2),\n h = [];\n var _loop6 = function _loop6() {\n var n = 0;\n jn(e, d, c, {\n roughness: _t71 / (u - 1),\n size: l },\n function () {\n var t = e.read({\n framebuffer: d });\n\n var r = t;\n if (o) {\n r = new Uint16Array(t.length);\n for (var _e89 = 0; _e89 < t.length; _e89++) r[_e89] = Math.min(st.toHalfFloat(t[_e89]), 65504);\n }\n h[n] || (h[n] = {\n mipmap: [] }),\n h[n].mipmap.push(r), n++;\n }), l /= 2, d.resize(l);\n };\n for (var _t71 = 0; _t71 <= u; _t71++) {\n _loop6();\n }\n return s.destroy(), d.destroy(), c.destroy(), h;\n }(e, t, n, r, i, o),\n s = e.cube({\n radius: n,\n min: \"linear\",\n mag: \"linear\",\n type: o ? \"float16\" : \"uint8\",\n faces: a,\n format: \"rgba\" });\n\n return {\n prefilterMap: s,\n prefilterMipmap: a };\n\n }(e, c, s, o, a, l),\n f = _ref4.prefilterMap,\n d = _ref4.prefilterMipmap;\n var u;\n if (!n.ignoreSH) {\n var _r33 = s;\n u = function (e, n, r) {\n var i = new Array(9),\n o = [],\n a = [],\n s = [];\n for (var _c9 = 0; _c9 < 9; _c9++) {\n var _l6 = [0, 0, 0];\n for (var _i26 = 0; _i26 < er.length; _i26++) {\n var _f7 = e[_i26],\n _d4 = [0, 0, 0];\n var _u4 = 0,\n _h4 = 0;\n var _m2 = Qn[er[_i26]];\n for (var _e90 = 0; _e90 < r; _e90++) for (var _i27 = 0; _i27 < n; _i27++) {\n o[0] = _i27 / (n - 1) * 2 - 1, o[1] = _e90 / (r - 1) * 2 - 1, o[2] = -1, _glMatrix.vec3.normalize(o, o), s[0] = o[_m2[0]] * _m2[3], s[1] = o[_m2[1]] * _m2[4], s[2] = o[_m2[2]] * _m2[5], a[0] = _f7[_h4++] / 255, a[1] = _f7[_h4++] / 255, a[2] = _f7[_h4++] / 255;\n var _l7 = _f7[_h4++] / 255 * 7;\n a[0] *= _l7, a[1] *= _l7, a[2] *= _l7, _glMatrix.vec3.scaleAndAdd(_d4, _d4, a, $n(s, _c9) * -o[2]), _u4 += -o[2];\n }\n _glMatrix.vec3.scaleAndAdd(_l6, _l6, _d4, 1 / _u4);\n }\n i[_c9] = _glMatrix.vec3.scale(_l6, _l6, 1 / 6);\n }\n return i;\n }(nr(e, f, _r33, !1, n.environmentExposure, !0), _r33, _r33);\n var _i28 = [];\n for (var _e91 = 0; _e91 < u.length; _e91++) _i28.push.apply(_i28, _toConsumableArray(u[_e91]));\n u = _i28;\n }\n var h = {\n envMap: c,\n isHDR: l,\n prefilterMap: f };\n\n return u && (h.sh = u), \"array\" === n.format && (h.envMap = {\n width: c.width,\n height: c.height,\n faces: nr(e, c, i, l) },\n h.prefilterMap = {\n width: f.width,\n height: f.height,\n faces: d },\n c.destroy(), f.destroy()), h;\n },\n generateDFGLUT: or,\n supportFloat16: cr });\n\n var fr = {\n uvScale: [1, 1],\n uvOffset: [0, 0],\n uvRotation: 0,\n textureOrigin: null,\n textureWidth: null,\n baseColorFactor: [1, 1, 1, 1],\n emissiveFactor: [0, 0, 0],\n baseColorIntensity: 1,\n emitColorFactor: 1,\n occlusionFactor: 1,\n roughnessFactor: .4,\n metallicFactor: 0,\n normalMapFactor: 1,\n specularF0: .5,\n emitMultiplicative: 1,\n normalMapFlipY: 0,\n outputSRGB: 1,\n baseColorTexture: null,\n normalTexture: null,\n occlusionTexture: null,\n metallicRoughnessTexture: null,\n emissiveTexture: null,\n uvOrigin: [0, 0],\n noiseTexture: null,\n specularAAVariance: 20,\n specularAAThreshold: 20,\n hsv: [0, 0, 0],\n contrast: 1,\n bumpTexture: null,\n bumpScale: .05,\n bumpMinLayers: 5,\n bumpMaxLayers: 20,\n alphaTest: 0 };\n\n var dr = function (_Ce4) {\n function dr(e) {\n var _this27;\n _classCallCheck(this, dr);\n var t = v({}, fr);\n (e.metallicRoughnessTexture || e.metallicRoughnessTexture) && (t.roughnessFactor = 1, t.metallicFactor = 1), _this27 = _callSuper(this, dr, [e, t]);\n return _this27;\n }\n _inherits(dr, _Ce4);\n return _createClass(dr, [{\n key: \"appendDefines\",\n value: function appendDefines(e, t) {\n _superPropGet(dr, \"appendDefines\", this, 3)([e, t]);\n var n = this.uniforms;\n n.GAMMA_CORRECT_INPUT && (e.GAMMA_CORRECT_INPUT = 1), t.data[t.desc.colorAttribute] && (e.HAS_COLOR = 1);\n if (t.data[t.desc.color0Attribute] && (e.HAS_COLOR0 = 1, e.COLOR0_SIZE = t.getColor0Size()), t.data[t.desc.tangentAttribute] ? e.HAS_TANGENT = 1 : t.data[t.desc.normalAttribute] && (e.HAS_NORMAL = 1), t.data.aVertexColorType && (e.HAS_VERTEX_COLOR = 1), !t.data[t.desc.uv0Attribute]) return e;\n n.baseColorTexture && (e.HAS_ALBEDO_MAP = 1), n.metallicRoughnessTexture && (e.HAS_METALLICROUGHNESS_MAP = 1), n.occlusionTexture && t.data[t.desc.uv1Attribute] && (e.HAS_AO_MAP = 1), n.emissiveTexture && (e.HAS_EMISSIVE_MAP = 1), n.normalTexture && (e.HAS_NORMAL_MAP = 1), n.bumpTexture && (e.HAS_BUMP_MAP = 1), n.skinTexture && (e.HAS_SKIN_MAP = 1), (e.HAS_ALBEDO_MAP || e.HAS_METALLICROUGHNESS_MAP || e.HAS_AO_MAP || e.HAS_EMISSIVE_MAP || e.HAS_NORMAL_MAP || e.HAS_BUMP_MAP || e.HAS_SKIN_MAP) && (e.HAS_MAP = 1), n.noiseTexture && (e.HAS_RANDOM_TEX = 1), t.data[t.desc.tangentAttribute] ? e.HAS_TANGENT = 1 : t.data[t.desc.normalAttribute] && (e.HAS_NORMAL = 1);\n var r = n.alphaMode && n.alphaMode.toUpperCase();\n return \"MASK\" === r ? e.ALPHA_MODE = 1 : \"OPAQUE\" === r && (e.ALPHA_MODE = 2), e;\n } }]);\n\n }(Ce);\n var ur = function (_Fe2) {\n function ur() {\n _classCallCheck(this, ur);\n return _callSuper(this, ur, arguments);\n }\n _inherits(ur, _Fe2);\n return _createClass(ur);\n }(Fe(dr));\n function hr(e, t, n) {\n if (n.ambientUpdate) {\n var _r34 = e.iblTexes,\n _i29 = n.target;\n _r34 ? (_r(_r34), e.iblTexes = vr(t, _i29)) : e.iblTexes = vr(t, _i29), _i29.getRenderer().setToRedraw();\n }\n }\n var mr = [0, 0];\n function vr(e, t) {\n var n = t.getLightManager(),\n r = n && n.getAmbientResource();\n if (!r) return null;\n var i = r.isHDR;\n return {\n prefilterMap: e.cube({\n width: r.prefilterMap.width,\n height: r.prefilterMap.height,\n faces: r.prefilterMap.faces,\n min: \"linear\",\n mag: \"linear\",\n format: \"rgba\",\n type: i ? \"float16\" : \"uint8\" }),\n\n envMap: e.cube({\n width: r.envMap.width,\n height: r.envMap.height,\n faces: r.envMap.faces,\n min: \"linear\",\n mag: \"linear\",\n format: \"rgba\",\n type: i ? \"float16\" : \"uint8\" }),\n\n sh: r.sh };\n\n }\n function _r(e) {\n for (var _t72 in e) e[_t72] && e[_t72].destroy && e[_t72].destroy(), delete e[_t72];\n }\n var gr = Object.freeze({\n __proto__: null,\n createIBLTextures: vr,\n disposeIBLTextures: _r,\n getIBLResOnCanvas: function getIBLResOnCanvas(e) {\n var t = e.dfgLUT,\n n = e.iblTexes;\n return {\n dfgLUT: t,\n iblTexes: n };\n\n },\n getPBRUniforms: function getPBRUniforms(e, t, n, r, i) {\n var o = e.viewMatrix,\n a = e.projMatrix,\n s = e.cameraPosition,\n c = e.getRenderer().canvas,\n l = function (e, t) {\n var n = e.getLightManager(),\n r = n && n.getAmbientResource(),\n i = n && n.getAmbientLight() || {},\n o = n && n.getDirectionalLight() || {};\n var a;\n if (r) {\n var _e92 = t.prefilterMap.width,\n _n52 = Math.log(_e92) / Math.log(2);\n a = {\n prefilterMap: t.prefilterMap,\n diffuseSPH: t.sh,\n prefilterMiplevel: [_n52, _n52],\n prefilterSize: [_e92, _e92],\n hdrHSV: i.hsv || [0, 0, 0] };\n\n } else a = {\n ambientColor: i.color || [.2, .2, .2] };\n\n return a.environmentExposure = g(i.exposure) ? i.exposure : 1, a.environmentOrientation = i.orientation || 0, a.light0_diffuse = [].concat(_toConsumableArray(o.color || [1, 1, 1]), [1]), a.light0_viewDirection = o.direction || [1, 1, -1], a;\n }(e, t),\n f = v({\n viewMatrix: o,\n projMatrix: a,\n projViewMatrix: e.projViewMatrix,\n cameraPosition: s,\n outSize: [c.width, c.height],\n cameraNearFar: [e.cameraNear, e.cameraFar] },\n l);\n return f.brdfLUT = n, r && r.renderUniforms && v(f, r.renderUniforms), f.halton = i || mr, f;\n },\n isSupported: function isSupported(e) {\n return e.hasExtension(\"EXT_shader_texture_lod\");\n },\n loginIBLResOnCanvas: function loginIBLResOnCanvas(e, t, n) {\n var _this28 = this;\n if (!e.dfgLUT && (e.dfgLUT = or(t), e.dfgLUT.mtkRefCount = 0, n)) {\n var _r35 = function _r35() {\n for (var _len4 = arguments.length, n = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n n[_key4] = arguments[_key4];\n }\n return hr.call.apply(hr, [_this28, e, t].concat(n));\n };\n n.on(\"updatelights\", _r35), e._iblResListener = _r35;\n }\n e.dfgLUT.mtkRefCount++;\n var r = n.getLightManager();\n return r && r.getAmbientResource() ? (e.iblTexes || (e.iblTexes = vr(t, n)), {\n dfgLUT: e.dfgLUT,\n iblTexes: e.iblTexes }) :\n {\n dfgLUT: e.dfgLUT,\n iblTexes: null };\n\n },\n logoutIBLResOnCanvas: function logoutIBLResOnCanvas(e, t) {\n var n = !1;\n if (e.dfgLUT && (e.dfgLUT.mtkRefCount--, e.dfgLUT.mtkRefCount <= 0)) {\n if (n = !0, t) {\n t.off(\"updatelights\", e._iblResListener);\n }\n e.dfgLUT.destroy(), delete e.dfgLUT;\n }\n e.iblTexes && n && (_r(e.iblTexes), delete e.iblTexes);\n } });\n\n var xr = exports.ShadowMapShader = function (_yt11) {\n function xr(t) {\n _classCallCheck(this, xr);\n return _callSuper(this, xr, [{\n vert: \"attribute vec3 aPosition;\\nuniform mat4 lightProjViewModelMatrix;\\nuniform mat4 positionMatrix;\\nuniform mat4 modelViewMatrix;\\nuniform mat4 modelMatrix;\\n#include \\n#include \\nvarying vec4 vPosition;\\nvoid main() {\\n mat4 c = getPositionMatrix();\\n#ifdef IS_LINE_EXTRUSION\\nvec3 d = getLineExtrudePosition(aPosition);\\n vec4 e = getPosition(d);\\n#else\\nvec4 e = getPosition(aPosition);\\n#endif\\ngl_Position = lightProjViewModelMatrix * c * e;\\n vPosition = gl_Position;\\n}\",\n frag: \"#define SHADER_NAME vsm_mapping\\n#ifdef USE_VSM\\n#extension GL_OES_standard_derivatives : enable\\n#endif\\nprecision highp float;\\nvarying vec4 vPosition;\\n#ifdef PACK_FLOAT\\n#include \\n#endif\\nvoid main() {\\n \\n#if defined(USE_VSM)\\nfloat c = vPosition.z / vPosition.w;\\n c = c * .5 + .5;\\n float d = c;\\n float e = c * c;\\n float f = dFdx(c);\\n float h = dFdy(c);\\n e += .25 * (f * f + h * h);\\n gl_FragColor = vec4(d, e, c, .0);\\n#endif\\n#if defined(USE_ESM)\\n#ifdef PACK_FLOAT\\ngl_FragColor = common_encodeDepth(gl_FragCoord.z);\\n#else\\ngl_FragColor = vec4(gl_FragCoord.z, .0, .0, 1.);\\n#endif\\n#endif\\n}\",\n uniforms: [{\n name: \"lightProjViewModelMatrix\",\n type: \"function\",\n fn: function fn(t, n) {\n return _glMatrix.mat4.multiply([], n.lightProjViewMatrix, n.modelMatrix);\n } }],\n\n extraCommandProps: {},\n defines: t }]);\n\n }\n _inherits(xr, _yt11);\n return _createClass(xr, [{\n key: \"filter\",\n value: function filter(e) {\n return e.castShadow;\n } }]);\n\n }(yt);\n var pr = function (_Et8) {\n function pr(_ref5) {\n var _this29;\n var e = _ref5.blurOffset;\n _classCallCheck(this, pr);\n _this29 = _callSuper(this, pr, [{\n vert: Mt,\n frag: \"precision highp float;\\nvarying vec2 vTexCoord;\\nuniform sampler2D textureSource;\\nuniform vec2 resolution;\\n#include \\nvoid main() {\\n float c = .0;\\n float d = .0;\\n for(int x = -BOXBLUR_OFFSET; x <= BOXBLUR_OFFSET; ++x)\\n for(int y = -BOXBLUR_OFFSET; y <= BOXBLUR_OFFSET; ++y) {\\n vec2 e = vTexCoord.st + vec2(float(x) / resolution.x, float(y) / resolution.y);\\n e = clamp(e, .0, 1.);\\n float f = common_decodeDepth(texture2D(textureSource, e));\\n float s = max(.0, sign(1. - f));\\n d += sign(f) * s;\\n c += f;\\n }\\n float h = c / max(1., d);\\n gl_FragColor = common_encodeDepth(h);\\n}\",\n defines: {\n BOXBLUR_OFFSET: e || 2 } }]),\n\n _this29._blurOffset = e || 2;\n return _this29;\n }\n _inherits(pr, _Et8);\n return _createClass(pr, [{\n key: \"getMeshCommand\",\n value: function getMeshCommand(e, t) {\n var n = \"box_shadow_blur_\" + this._blurOffset;\n return this.commands[n] || (this.commands[n] = this.createREGLCommand(e, null, t.getElements())), this.commands[n];\n } }]);\n\n }(Et);\n var br = null,\n yr = null;\n var Ar = exports.ShadowPass = function () {\n function Ar(e, _ref6) {\n var t = _ref6.width,\n n = _ref6.height,\n r = _ref6.blurOffset,\n i = _ref6.defines;\n _classCallCheck(this, Ar);\n this.renderer = e, this.width = t || 512, this.height = n || 512, this.blurOffset = u(r) ? 2 : r, this._init(i);\n }\n return _createClass(Ar, [{\n key: \"render\",\n value: function render(e, _ref7) {\n var t = _ref7.cameraProjViewMatrix,\n n = _ref7.lightDir,\n r = _ref7.farPlane,\n i = _ref7.cameraLookAt;\n return {\n lightProjViewMatrix: this._renderShadow(e, t, n, r, i),\n shadowMap: this.blurTex || this.depthTex,\n depthFBO: this.depthFBO,\n blurFBO: this.blurFBO };\n\n } },\n {\n key: \"resize\",\n value: function resize(e, t) {\n return this.depthTex && (this.depthTex.resize(e, t), this.depthFBO.resize(e, t)), this.width = e, this.blurFBO && (this.blurTex.resize(e, t), this.blurFBO.resize(e, t)), this.height = t, this;\n } },\n {\n key: \"_renderShadow\",\n value: function _renderShadow(e, t, n, r, i) {\n var o = this.renderer,\n a = br(t);\n if (r) for (var _e93 = 4; _e93 < 8; _e93++) a[_e93] = r[_e93 - 4];\n var s = yr(i, a, n);\n return o.clear({\n color: [1, 0, 0, 1],\n depth: 1,\n framebuffer: this.depthFBO }),\n o.render(this.shadowMapShader, {\n lightProjViewMatrix: s },\n e, this.depthFBO), this.blurFBO && (this.boxBlurShader || (this.boxBlurShader = new pr({\n blurOffset: this.blurOffset })),\n o.clear({\n color: [1, 0, 0, 1],\n depth: 1,\n framebuffer: this.blurFBO }),\n o.render(this.boxBlurShader, {\n resolution: [this.depthTex.width, this.depthTex.height],\n textureSource: this.depthTex },\n null, this.blurFBO)), s;\n } },\n {\n key: \"_init\",\n value: function _init(e) {\n var t = this.renderer.regl,\n n = \"uint8\",\n r = this.width,\n i = this.height;\n this.depthTex = t.texture({\n width: r,\n height: i,\n format: \"rgb\",\n type: n,\n min: \"nearest\",\n mag: \"nearest\" }),\n this.shadowMapShader = new xr(e), this.shadowMapShader.filter = function (e) {\n return e.castShadow;\n }, this.depthFBO = t.framebuffer({\n color: this.depthTex }),\n this.blurOffset <= 0 || (this.blurTex = t.texture({\n width: r,\n height: i,\n format: \"rgb\",\n type: n,\n min: \"linear\",\n mag: \"linear\" }),\n this.blurFBO = t.framebuffer({\n color: this.blurTex }));\n\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n this.depthTex && (this.depthTex.destroy(), this.depthFBO.destroy(), delete this.depthTex, delete this.depthFBO), this.blurTex && (this.blurTex.destroy(), this.blurFBO.destroy(), delete this.blurTex, delete this.blurFBO), this.shadowMapShader && (this.shadowMapShader.dispose(), delete this.shadowMapShader), this.boxBlurShader && (this.boxBlurShader.dispose(), delete this.boxBlurShader);\n } }]);\n\n }();\n br = function () {\n var t = [[-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]],\n r = new Array(16);\n return function (i) {\n _glMatrix.mat4.invert(r, i);\n var o = [];\n for (var _e94 = 0; _e94 < t.length; _e94++) {\n var _i30 = _glMatrix.vec4.transformMat4([], t[_e94], r);\n _glMatrix.vec4.scale(_i30, _i30, 1 / _i30[3]), o.push(_i30);\n }\n return o;\n };\n }(), yr = function () {\n var r = new Array(4);\n var i = new Array(3),\n o = [0, 0, 0, 0],\n a = [0, 1, 0],\n s = new Array(3);\n var c = new Array(16),\n l = new Array(16);\n var f = new Array(16),\n d = [1, 1, 1],\n u = [0, 0, 0];\n return function (h, m, v) {\n _glMatrix.vec4.set.apply(n, [o].concat(_toConsumableArray(h), [1])), _glMatrix.vec3.scale(i, v, -1), c = _glMatrix.mat4.lookAt(c, _glMatrix.vec3.add(s, o, _glMatrix.vec3.normalize(s, i)), o, a), _glMatrix.vec4.transformMat4(r, m[0], c);\n var _ = r[2],\n g = r[2],\n x = r[0],\n p = r[0],\n b = r[1],\n y = r[1];\n for (var _e95 = 1; _e95 < 8; _e95++) r = _glMatrix.vec4.transformMat4(r, m[_e95], c), r[2] > g && (g = r[2]), r[2] < _ && (_ = r[2]), r[0] > p && (p = r[0]), r[0] < x && (x = r[0]), r[1] > y && (y = r[1]), r[1] < b && (b = r[1]);\n l = _glMatrix.mat4.ortho(l, -1, 1, -1, 1, -g, -_);\n var A = d[0] = 2 / (p - x),\n S = d[1] = -2 / (y - b);\n u[0] = -.5 * (x + p) * A, u[1] = -.5 * (b + y) * S, _glMatrix.mat4.identity(f), _glMatrix.mat4.translate(f, f, u), _glMatrix.mat4.scale(f, f, d);\n var T = _glMatrix.mat4.multiply(l, f, l);\n return _glMatrix.mat4.multiply(new Array(16), T, c);\n };\n }();\n var Sr = exports.ShadowDisplayShader = function (_yt12) {\n function Sr(t) {\n _classCallCheck(this, Sr);\n return _callSuper(this, Sr, [{\n vert: \"#define SHADER_NAME SHADOW_DISPLAY\\nattribute vec3 aPosition;\\nuniform mat4 projMatrix;\\nuniform mat4 modelViewMatrix;\\nuniform vec2 halton;\\nuniform vec2 globalTexSize;\\nvarying vec4 vPosition;\\n#include \\nvoid main() {\\n vec4 c = vec4(aPosition, 1.);\\n vec4 d = modelViewMatrix * c;\\n mat4 e = projMatrix;\\n e[2].xy += halton.xy / globalTexSize.xy;\\n gl_Position = e * d;\\n vPosition = gl_Position;\\n shadow_computeShadowPars(c);\\n}\",\n frag: \"#define SHADER_NAME SHADOW_DISPLAY\\nprecision mediump float;\\nuniform vec3 color;\\n#include \\nvoid main() {\\n float c = shadow_computeShadow();\\n float d = 1. - c;\\n gl_FragColor = vec4(color * d, d);\\n}\",\n uniforms: [{\n name: \"modelViewMatrix\",\n type: \"function\",\n fn: function fn(t, n) {\n var r = [];\n return _glMatrix.mat4.multiply(r, n.viewMatrix, n.modelMatrix), r;\n } }],\n\n defines: t || {\n USE_ESM: 1 },\n\n extraCommandProps: {\n depth: {\n enable: !0,\n mask: !1 },\n\n viewport: {\n x: 0,\n y: 0,\n width: function width(e, t) {\n return t.globalTexSize[0];\n },\n height: function height(e, t) {\n return t.globalTexSize[1];\n } } } }]);\n\n\n\n }\n _inherits(Sr, _yt12);\n return _createClass(Sr, [{\n key: \"getMeshCommand\",\n value: function getMeshCommand(e, t) {\n return this.commands.shadow_display || (this.commands.shadow_display = this.createREGLCommand(e, null, t.getElements())), this.commands.shadow_display;\n } }]);\n\n }(yt);\n function Tr(e) {\n return 256 * e[2] * 256 + 256 * e[1] + e[0];\n }\n var Mr = new Uint8Array(4),\n Or = new Float32Array(Mr.buffer);\n var Cr, Er;\n var Pr = [1, 1],\n wr = \"\\n vec3 unpack(highp float f) {\\n highp vec3 color;\\n color.b = floor(f / 65536.0);\\n color.g = floor((f - color.b * 65536.0) / 256.0);\\n color.r = f - floor(color.b * 65536.0) - floor(color.g * 256.0);\\n // now we have a vec3 with the 3 components in range [0..255]. Let's normalize it!\\n return color / 255.0;\\n }\\n\",\n Ir = \"\\n precision highp float;\\n\\n varying float vPickingId;\\n varying float vFbo_picking_visible;\\n\\n uniform float fbo_picking_meshId;\\n\\n \".concat(wr, \"\\n\\n void main() {\\n if (vFbo_picking_visible == 0.0) {\\n discard;\\n return;\\n }\\n gl_FragColor = vec4(unpack(vPickingId), fbo_picking_meshId / 255.0);\\n }\\n\"),\n Rr = \"\\n precision highp float;\\n\\n uniform int fbo_picking_meshId;\\n varying float vFbo_picking_visible;\\n\\n \".concat(wr, \"\\n\\n void main() {\\n if (vFbo_picking_visible == 0.0) {\\n discard;\\n return;\\n }\\n gl_FragColor = vec4(unpack(float(fbo_picking_meshId)), 1.0);\\n // gl_FragColor = vec4(unpack(float(35)), 1.0);\\n }\\n\"),\n Dr = \"\\n precision highp float;\\n\\n varying float vPickingId;\\n varying float vFbo_picking_visible;\\n\\n \".concat(wr, \"\\n\\n void main() {\\n if (vFbo_picking_visible == 0.0) {\\n discard;\\n return;\\n }\\n gl_FragColor = vec4(unpack(vPickingId), 1.0);\\n }\\n\");\n var Hr = exports.FBORayPicking = function () {\n function Hr(e, _ref8, a, s) {\n var t = _ref8.vert,\n n = _ref8.uniforms,\n r = _ref8.defines,\n i = _ref8.extraCommandProps,\n o = _ref8.enableStencil;\n _classCallCheck(this, Hr);\n this._renderer = e, this._fbo = a, this._map = s, this._clearFbo(a), this._vert = t, this._uniforms = n, this._defines = r, this._extraCommandProps = v({}, i), delete this._extraCommandProps.blend, o ? this._extraCommandProps.stencil = {\n enable: o,\n mask: 255,\n func: {\n cmp: \"<\",\n ref: 1,\n mask: 255 },\n\n op: {\n fail: \"keep\",\n zfail: \"keep\",\n zpass: \"replace\" } } :\n\n delete this._extraCommandProps.stencil, this._currentMeshes = [], this._init();\n }\n return _createClass(Hr, [{\n key: \"_init\",\n value: function _init() {\n var e = [];\n this._uniforms && e.push.apply(e, _toConsumableArray(this._uniforms));\n var t = {\n ENABLE_PICKING: 1,\n HAS_PICKING_ID: 1 };\n\n if (this._defines) for (var _e96 in this._defines) t[_e96] = this._defines[_e96];\n var n = this._vert,\n r = this._extraCommandProps;\n this._shader0 = new yt({\n vert: n,\n frag: Ir,\n uniforms: e,\n defines: t,\n extraCommandProps: r }),\n this._shader2 = new yt({\n vert: n,\n frag: Dr,\n uniforms: e,\n defines: t,\n extraCommandProps: r });\n\n var i = {\n ENABLE_PICKING: 1,\n HAS_PICKING_ID: 1 };\n\n if (this._defines) for (var _e97 in this._defines) i[_e97] = this._defines[_e97];\n this._shader1 = new yt({\n vert: n,\n frag: Rr,\n uniforms: e,\n defines: i,\n extraCommandProps: r }),\n this._depthShader = new yt({\n vert: n,\n frag: \"\\n #ifdef GL_ES\\n precision highp float;\\n #endif\\n #if __VERSION__ == 100 && defined(GL_EXT_frag_depth)\\n #extension GL_EXT_frag_depth : enable\\n #endif\\n #include \\n #include \\n varying float vFbo_picking_viewZ;\\n uniform float logDepthBufFC;\\n varying float vFbo_picking_fragDepth;\\n\\n const float PackUpscale = 256. / 255.;\\n const float UnpackDownscale = 255. / 256.;\\n const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\\n const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\\n const float ShiftRight8 = 1. / 256.;\\n vec4 packDepthToRGBA(const in float v ) {\\n vec4 r = vec4(fract(v * PackFactors), v);\\n r.yzw -= r.xyz * ShiftRight8;\\n return r * PackUpscale;\\n }\\n\\n void main() {\\n float fragDepth = vFbo_picking_fragDepth > 1.0 ? vFbo_picking_fragDepth : vFbo_picking_viewZ + 1.0;\\n #if __VERSION__ == 300 || __VERSION__ == 100 && defined(GL_EXT_frag_depth)\\n gl_FragDepthEXT = log2(fragDepth) * logDepthBufFC * 0.5;\\n #endif\\n vec4 depthColor = packDepthToRGBA(fragDepth - 1.0);\\n glFragColor = common_unpackFloat(dot(depthColor, UnpackFactors));\\n #if __VERSION__ == 100\\n gl_FragColor = glFragColor;\\n #endif\\n }\\n\",\n uniforms: e,\n defines: i,\n extraCommandProps: r }),\n this._scene = new Ze(), this._scene1 = new Ze();\n } },\n {\n key: \"filter\",\n value: function filter() {\n return !0;\n } },\n {\n key: \"render\",\n value: function render(e, t) {\n var _this30 = this;\n var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;\n if (!e || !e.length) return this;\n var r = this._fbo;\n n && this.clear(), e = e.filter(function (e) {\n return e && e.isValid && e.isValid();\n }), this._scene.setMeshes(e);\n var i = this._getShader(e, n);\n i.filter = this.filter, this._currentShader && i !== this._currentShader && this.clear(), this._currentShader = i, e.forEach(function (e, t) {\n e.setUniform(\"fbo_picking_meshId\", t + _this30._currentMeshes.length);\n });\n for (var _t73 = 0; _t73 < e.length; _t73++) this._currentMeshes.push(e[_t73]);\n return this._renderer.render(i, t, this._scene, r), this;\n } },\n {\n key: \"pickAll\",\n value: function pickAll(e, t, n, r, i) {\n n = Nr(n);\n var _this$_pick = this._pick(e, t, n, r, i),\n o = _this$_pick.meshIds,\n a = _this$_pick.pickingIds,\n s = _this$_pick.coords,\n c = _this$_pick.points,\n l = [];\n if (a && o) {\n var _e98 = {};\n for (var _t74 = 0; _t74 < o.length; _t74++) {\n var _n53 = \"\".concat(a[_t74], \"_\").concat(o[_t74]);\n null == o[_t74] || null == a[_t74] || _e98[_n53] || (_e98[_n53] = !0, l.push({\n meshId: o[_t74],\n pickingId: a[_t74],\n point: c[_t74] || null,\n coordinate: s[_t74] || null }));\n\n }\n }\n return l;\n } },\n {\n key: \"pick\",\n value: function pick(e, t, n, r) {\n var i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};\n n = Nr(n);\n var _this$_pick2 = this._pick(e, t, n, r, i),\n o = _this$_pick2.meshIds,\n a = _this$_pick2.pickingIds,\n s = _this$_pick2.width,\n c = _this$_pick2.coords,\n l = _this$_pick2.points;\n if (a && o) {\n var _e99 = [];\n for (var _t75 = 0; _t75 <= n[0]; _t75++) _e99.push(_t75), _t75 > 0 && _e99.push(-_t75);\n for (var _t76 = 0; _t76 < _e99.length; _t76++) for (var _r36 = 0; _r36 < _e99.length; _r36++) {\n var _i31 = (_e99[_r36] + n[1]) * s + (_e99[_t76] + n[0]);\n if (null != o[_i31]) return {\n meshId: o[_i31],\n pickingId: a[_i31],\n point: l[_i31] || null,\n coordinate: c[_i31] || null };\n\n }\n }\n return {\n pickingId: null,\n meshId: null,\n point: null };\n\n } },\n {\n key: \"_pick\",\n value: function _pick(e, t, n, r) {\n var i = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};\n var o = this._currentShader,\n a = this._currentMeshes;\n if (!o || !a || !a.length) return {\n pickingId: null,\n meshId: null,\n point: null };\n\n e = Math.round(e), t = Math.round(t);\n var s = this._fbo;\n if (e <= 2 || e >= s.width - 2 || t <= 2 || t >= s.height - 2) return {\n pickingId: null,\n meshId: null,\n point: null };\n\n var _this$_getParams = this._getParams(e, t, n, s),\n c = _this$_getParams.px,\n l = _this$_getParams.py,\n f = _this$_getParams.width,\n d = _this$_getParams.height,\n u = new Uint8Array(4 * f * d),\n h = this._renderer.regl.read({\n data: u,\n x: c,\n y: l,\n framebuffer: s,\n width: f,\n height: d }),\n\n m = [];\n var v = [];\n for (var _e100 = 0; _e100 < h.length; _e100 += 4) {\n var _this$_packData = this._packData(h.subarray(_e100, _e100 + 4), o),\n _t77 = _this$_packData.pickingId,\n _n54 = _this$_packData.meshId;\n m.push(_n54), v.push(_t77);\n }\n var _ = {},\n g = m.filter(function (e) {\n return null != e && !_[e] && (_[e] = 1, !0);\n }).map(function (e) {\n return a[e];\n });\n var x;\n for (var _e101 = 0; _e101 < g.length; _e101++) if (g[_e101] && g[_e101].geometry) {\n x = g[_e101];\n break;\n }\n if (!x) return {\n pickingId: null,\n meshId: null,\n point: null };\n\n var p = x.geometry.desc.pickingIdAttribute;\n m.length && o === this._shader1 && (void 0 !== x.getUniform(\"uPickingId\") || x.geometry.data[p]) && (v = this._getPickingId(c, l, f, d, u, g, r));\n var b = [],\n y = [];\n if (m.length && i.returnPoint) {\n var _n55 = i.viewMatrix,\n _o15 = i.projMatrix,\n _a16 = this._pickDepth(c, l, f, d, u, g, r);\n for (var _r37 = 0; _r37 < _a16.length; _r37++) if (_a16[_r37] && null != m[_r37]) {\n var _i32 = this._getWorldPos(e, t, _a16[_r37], _n55, _o15),\n _s10 = this._convertPickPoint(_i32);\n b.push(_i32), y.push(_s10);\n } else b.push(null), y.push(null);\n }\n return {\n meshIds: m,\n pickingIds: v,\n coords: y,\n points: b,\n width: f,\n height: d };\n\n } },\n {\n key: \"_convertPickPoint\",\n value: function _convertPickPoint(e) {\n var t = this._map;\n if (!t) return null;\n var n = t.getGLRes();\n if (!Cr) {\n var _e102 = t.getCenter();\n Er = new _e102.constructor(0, 0, 0);\n var _n56 = t.coordToPoint(_e102);\n Cr = new _n56.constructor(0, 0);\n }\n Cr.set(e[0], e[1]);\n var r = t.pointAtResToCoord(Cr, n, Er),\n i = t.pointAtResToAltitude(e[2], n);\n return [r.x, r.y, i];\n } },\n {\n key: \"clear\",\n value: function clear() {\n return this._fbo && this._clearFbo(this._fbo), this._currentMeshes = [], delete this._currentShader, this;\n } },\n {\n key: \"getMeshAt\",\n value: function getMeshAt(e) {\n return this._currentMeshes ? this._currentMeshes[e] : null;\n } },\n {\n key: \"getRenderedMeshes\",\n value: function getRenderedMeshes() {\n return this._currentMeshes;\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n this.clear(), this._shader0 && this._shader0.dispose(), this._shader1 && this._shader1.dispose(), this._shader2 && this._shader2.dispose(), this._scene && this._scene.clear(), this._scene1 && this._scene1.clear();\n } },\n {\n key: \"_getWorldPos\",\n value: function _getWorldPos(t, n, r, i, o) {\n var a = this._fbo,\n s = [],\n c = a.width / 2 || 1,\n l = a.height / 2 || 1,\n f = [(t - c) / c, (l - n) / l, 0, 1],\n d = [(t - c) / c, (l - n) / l, 1, 1],\n u = _glMatrix.mat4.invert(s, o),\n h = [],\n m = [];\n Fr(h, f, u), Fr(m, d, u);\n var v = -h[2],\n _ = (r - v) / (-m[2] - v),\n g = _glMatrix.mat4.multiply(s, o, i),\n p = _glMatrix.mat4.invert(s, g),\n b = Fr(f, f, p),\n y = Fr(d, d, p);\n return [x(b[0], y[0], _), x(b[1], y[1], _), x(b[2], y[2], _)];\n } },\n {\n key: \"_getPickingId\",\n value: function _getPickingId(e, t, n, r, i, o, a) {\n var s = this._renderer.regl,\n c = this._getFBO1();\n this._clearFbo(c), this._scene1.setMeshes(o), this._renderer.render(this._shader2, a, this._scene1, c);\n var l = s.read({\n data: i,\n x: e,\n y: t,\n framebuffer: c,\n width: n,\n height: r }),\n\n f = [];\n for (var _e103 = 0; _e103 < l.length; _e103 += 4) f.push(Tr(l.subarray(_e103, _e103 + 4)));\n return f;\n } },\n {\n key: \"_pickDepth\",\n value: function _pickDepth(e, t, n, r, i, o, a) {\n var s = this._renderer.regl,\n c = this._getFBO1();\n this._scene1.setMeshes(o), this._clearFbo(c), a.logDepthBufFC = 2 / (Math.log(this._map.cameraFar + 1) / Math.LN2), this._renderer.render(this._depthShader, a, this._scene1, c);\n var l = s.read({\n data: i,\n x: e,\n y: t,\n framebuffer: c,\n width: n,\n height: r }),\n\n f = [];\n for (var _e104 = 0; _e104 < l.length; _e104 += 4) f.push((d = l.subarray(_e104, _e104 + 4), Mr[0] = d[3], Mr[1] = d[2], Mr[2] = d[1], Mr[3] = d[0], Or[0]));\n var d;\n return f;\n } },\n {\n key: \"_packData\",\n value: function _packData(e, t) {\n if (255 === e[0] && 255 === e[1] && 255 === e[2] && 255 === e[3]) return {\n meshId: null,\n pickingId: null };\n\n var n = null,\n r = null;\n return t === this._shader1 ? r = Tr(e) : t === this._shader0 ? (r = e[3], n = Tr(e)) : (r = null, n = Tr(e)), {\n meshId: r,\n pickingId: n };\n\n } },\n {\n key: \"_clearFbo\",\n value: function _clearFbo(e) {\n this._renderer.regl.clear({\n color: [1, 1, 1, 1],\n depth: 1,\n stencil: 255,\n framebuffer: e });\n\n } },\n {\n key: \"_getShader\",\n value: function _getShader(e, t) {\n return t && e.length < 256 ? this._shader0 : this._shader1;\n } },\n {\n key: \"_getFBO1\",\n value: function _getFBO1() {\n var e = this._renderer.regl,\n t = this._fbo;\n return this._fbo1 ? this._fbo1.width === t.width && this._fbo1.height === t.height || this._fbo1.resize(t.width, t.height) : this._fbo1 = e.framebuffer(t.width, t.height), this._fbo1;\n } },\n {\n key: \"_getParams\",\n value: function _getParams(e, t, n, r) {\n var i = n[0],\n o = n[1];\n t = r.height - t;\n var a = 2 * i + 1,\n s = 2 * o + 1;\n var c = (e -= i) + a,\n l = (t -= o) + s;\n return c > r.width && (a -= c - r.width), l > r.height && (s -= l - r.height), {\n px: e = e < 0 ? 0 : e,\n py: t = t < 0 ? 0 : t,\n width: a,\n height: s };\n\n } },\n {\n key: \"getPickingVert\",\n value: function getPickingVert() {\n return this._vert;\n } },\n {\n key: \"getUniformDeclares\",\n value: function getUniformDeclares() {\n return this._uniforms;\n } }]);\n\n }();\n function Fr(e, t, n) {\n var r = t[0],\n i = t[1],\n o = t[2],\n a = 1 / (n[3] * r + n[7] * i + n[11] * o + n[15]);\n return e[0] = (n[0] * r + n[4] * i + n[8] * o + n[12]) * a, e[1] = (n[1] * r + n[5] * i + n[9] * o + n[13]) * a, e[2] = (n[2] * r + n[6] * i + n[10] * o + n[14]) * a, e;\n }\n function Nr(e) {\n return g(e) && (Pr[0] = Pr[1] = e, e = Pr), e;\n }\n var Lr = function Lr(e) {\n return e && e.geometry && void 0 === e.geometry.properties.shaderHash;\n },\n kr = [],\n Br = [],\n zr = [{\n name: \"modelViewMatrix\",\n type: \"function\",\n fn: function fn(t, n) {\n return _glMatrix.mat4.multiply(kr, n.viewMatrix, n.modelMatrix);\n } },\n {\n name: \"modelViewProjMatrix\",\n type: \"function\",\n fn: function fn(t, n) {\n var r = _glMatrix.mat4.multiply(kr, n.viewMatrix, n.modelMatrix);\n return _glMatrix.mat4.multiply(kr, n.projMatrix, r);\n } },\n {\n name: \"modelMatrixInverse\",\n type: \"function\",\n fn: function fn(t, n) {\n return _glMatrix.mat4.invert(kr, n.modelMatrix);\n } },\n {\n name: \"projMatrixInverse\",\n type: \"function\",\n fn: function fn(t, n) {\n return _glMatrix.mat4.invert(kr, n.projMatrix);\n } },\n {\n name: \"modelViewMatrixInverse\",\n type: \"function\",\n fn: function fn(t, n) {\n return _glMatrix.mat4.multiply(kr, n.viewMatrix, n.modelMatrix), _glMatrix.mat4.invert(kr, kr);\n } },\n {\n name: \"modelViewProjMatrixInverse\",\n type: \"function\",\n fn: function fn(t, n) {\n var r = _glMatrix.mat4.multiply(kr, n.viewMatrix, n.modelMatrix);\n return _glMatrix.mat4.multiply(kr, n.projMatrix, r), _glMatrix.mat4.invert(kr, kr);\n } },\n {\n name: \"modelInverseTransposeMatrix\",\n type: \"function\",\n fn: function fn(e, t) {\n var n = _glMatrix.mat3.fromMat4(Br, t.modelMatrix),\n i = _glMatrix.mat3.transpose(n, n);\n return _glMatrix.mat3.invert(i, i);\n } },\n {\n name: \"modelViewInverseTransposeMatrix\",\n type: \"function\",\n fn: function fn(t, n) {\n var i = _glMatrix.mat4.multiply(kr, n.viewMatrix, n.modelMatrix),\n o = _glMatrix.mat3.fromMat4(Br, i),\n a = _glMatrix.mat3.transpose(o, o);\n return _glMatrix.mat3.invert(a, a);\n } }],\n\n Gr = {\n LOCAL: \"positionMatrix\",\n MODEL: \"modelMatrix\",\n VIEW: \"viewMatrix\",\n PROJECTION: \"projMatrix\",\n MODELVIEW: \"modelViewMatrix\",\n MODELVIEWPROJECTION: \"modelViewProjMatrix\",\n MODELINVERSE: \"modelMatrixInverse\",\n VIEWINVERSE: \"viewMatrixInverse\",\n PROJECTIONINVERSE: \"projMatrixInverse\",\n MODELVIEWINVERSE: \"modelViewMatrixInverse\",\n MODELVIEWPROJECTIONINVERSE: \"modelViewProjMatrixInverse\",\n MODELINVERSETRANSPOSE: \"modelInverseTransposeMatrix\",\n MODELVIEWINVERSETRANSPOSE: \"modelViewInverseTransposeMatrix\",\n VIEWPORT: \"viewport\",\n JOINTMATRIX: \"jointMatrix\",\n ALPHACUTOFF: \"alphaCutoff\" };\n\n var Vr = exports.KHRTechniquesWebglManager = function () {\n function Vr(e, t, n) {\n _classCallCheck(this, Vr);\n this._regl = e, this._khrShaders = {}, this._commandProps = t, this._resLoader = n;\n }\n return _createClass(Vr, [{\n key: \"getExcludeFilter\",\n value: function getExcludeFilter() {\n return Lr;\n } },\n {\n key: \"forEachShader\",\n value: function forEachShader(e) {\n for (var _t78 in this._khrShaders) {\n var _n57 = this._khrShaders[_t78];\n e(_n57.shader, _n57.filter, _n57.uniformSemantics);\n }\n } },\n {\n key: \"createMesh\",\n value: function createMesh(e, t, n, r) {\n var i = t.extensions.KHR_techniques_webgl,\n o = t.materials[e.material].extensions.KHR_techniques_webgl,\n a = o.technique,\n s = o.values,\n c = i.techniques[a],\n l = i.programs[c.program],\n f = i.shaders[l.vertexShader],\n d = i.shaders[l.fragmentShader];\n d.content = function (e) {\n if (e && e.indexOf(\"precision\") < 0) return \"precision mediump float;\\n\" + e;\n return e;\n }(d.content);\n var u = w(f.content) + \"-\" + w(d.content);\n this._khrShaders[u] || (this._khrShaders[u] = this._createTechniqueShader(u, i, a, this._commandProps, r));\n var h = this._khrShaders[u].attributeSemantics,\n m = this._createGeometry(e, h, n, u),\n _ = v({}, s);\n for (var _e105 in s) if (c.uniforms[_e105] && 35678 === c.uniforms[_e105].type) {\n _[_e105] = this._getTexture(t.textures[s[_e105].index]);\n }\n return {\n geometry: m,\n material: new Ce(_) };\n\n } },\n {\n key: \"_createGeometry\",\n value: function _createGeometry(e, t, n, r) {\n var i = e.attributes,\n o = \"COLOR_0\";\n if (i[o]) {\n var _e106 = i[o].array || i[o];\n if (_e106 instanceof Float32Array) {\n var _t79 = new Uint8Array(_e106.length);\n for (var _n58 = 0; _n58 < _t79.length; _n58++) _t79[_n58] = Math.round(255 * _e106[_n58]);\n i[o].array ? (i[o].array = _t79, i[o].componentType = 5121) : i[o] = _t79;\n }\n }\n var a = {};\n for (var _e107 in i) {\n var _n59 = he(this._regl, i[_e107], {\n dimension: i[_e107].itemSize }),\n\n _r38 = t[_e107] || _e107;\n a[_r38] = {\n buffer: _n59 },\n i[_e107].quantization && (a[_r38].quantization = i[_e107].quantization), _r38 === t.POSITION && (a[_r38].array = i[_e107].array);\n }\n var s = new Z(a, e.indices.array ? e.indices.array : e.indices, 0, {\n positionAttribute: t.POSITION,\n normalAttribute: t.NORMAL,\n uv0Attribute: t.TEXCOORD_0,\n uv1Attribute: t.TEXCOORD_1,\n color0Attribute: t.COLOR_0,\n tangentAttribute: t.TANGENT,\n textureCoordMatrixAttribute: t.TextureCoordMatrix,\n primitive: void 0 === e.mode ? \"triangles\" : ee(e.mode) });\n\n s.generateBuffers(this._regl, {\n excludeElementsInVAO: n }),\n s.properties.shaderHash = r;\n var c = s.data[s.desc.positionAttribute];\n return c && c.array && delete c.array, s;\n } },\n {\n key: \"_getTexture\",\n value: function _getTexture(e) {\n var t = {\n type: e.type ? ne(e.type) : \"uint8\",\n format: e.format ? ie(e.format) : \"rgba\",\n flipY: !!e.flipY },\n\n n = e.image;\n n.array ? t.data = n.array : n.mipmap && (t.mipmap = n.mipmap), t.width = n.width, t.height = n.height;\n var r = e.sampler || e.texture.sampler;\n return r && (r.magFilter && (t.mag = ae(r.magFilter)), r.minFilter && (t.min = ce(r.minFilter)), r.wrapS && (t.wrapS = fe(r.wrapS)), r.wrapT && (t.wrapT = fe(r.wrapT))), new ct(t, this._resLoader);\n } },\n {\n key: \"_createTechniqueShader\",\n value: function _createTechniqueShader(e, t, n, r, i) {\n var o = t.techniques,\n a = t.programs,\n s = t.shaders,\n c = o[n],\n l = a[c.program],\n f = s[l.vertexShader].content,\n d = s[l.fragmentShader].content,\n u = {};\n for (var _e108 in c.uniforms) {\n var _t80 = c.uniforms[_e108];\n _t80.semantic && (u[_t80.semantic] = _e108);\n }\n var h = zr.slice();\n var _loop7 = function _loop7(_e109) {\n h.push({\n name: u[_e109],\n type: \"function\",\n fn: function fn(t, n) {\n return n[Gr[_e109]];\n } });\n\n };\n for (var _e109 in u) {\n _loop7(_e109);\n }\n var m = new yt({\n vert: f,\n frag: d,\n uniforms: h,\n extraCommandProps: r });\n\n i && (m.version = 300);\n var v = {};\n for (var _e110 in c.attributes) {\n v[c.attributes[_e110].semantic] = _e110;\n }\n return {\n shader: m,\n filter: function filter(t) {\n return t && t.geometry && t.geometry.properties.shaderHash === e;\n },\n uniformSemantics: u,\n attributeSemantics: v };\n\n } },\n {\n key: \"dispose\",\n value: function dispose() {\n for (var _e111 in this._khrShaders) {\n var _t81 = this._khrShaders[_e111].shader;\n _t81.dispose();\n }\n this._khrShaders = {};\n } }]);\n\n }();\n function Ur(e, t, n, r, i) {\n var o;\n if (i === function (e, t, n, r) {\n var i = 0;\n for (var _o16 = t, _a17 = n - r; _o16 < n; _o16 += r) i += (e[_a17] - e[_o16]) * (e[_o16 + 1] + e[_a17 + 1]), _a17 = _o16;\n return i;\n }(e, t, n, r) > 0) for (var _i33 = t; _i33 < n; _i33 += r) o = di(_i33 / r | 0, e[_i33], e[_i33 + 1], o);else for (var _i34 = n - r; _i34 >= t; _i34 -= r) o = di(_i34 / r | 0, e[_i34], e[_i34 + 1], o);\n return o && oi(o, o.next) && (ui(o), o = o.next), o;\n }\n function jr(e, t) {\n if (!e) return e;\n t || (t = e);\n var n,\n r = e;\n do {\n if (n = !1, r.steiner || !oi(r, r.next) && 0 !== ii(r.prev, r, r.next)) r = r.next;else {\n if (ui(r), r = t = r.prev, r === r.next) break;\n n = !0;\n }\n } while (n || r !== t);\n return t;\n }\n function Xr(e, t, n, r, i, o, a) {\n if (!e) return;\n !a && o && function (e, t, n, r) {\n var i = e;\n do {\n 0 === i.z && (i.z = Qr(i.x, i.y, t, n, r)), i.prevZ = i.prev, i.nextZ = i.next, i = i.next;\n } while (i !== e);\n i.prevZ.nextZ = null, i.prevZ = null, function (e) {\n var t,\n n = 1;\n do {\n var _r39 = void 0,\n _i35 = e;\n e = null;\n var _o17 = null;\n for (t = 0; _i35;) {\n t++;\n var _a18 = _i35,\n _s11 = 0;\n for (var _e112 = 0; _e112 < n && (_s11++, _a18 = _a18.nextZ, _a18); _e112++);\n var _c10 = n;\n for (; _s11 > 0 || _c10 > 0 && _a18;) 0 !== _s11 && (0 === _c10 || !_a18 || _i35.z <= _a18.z) ? (_r39 = _i35, _i35 = _i35.nextZ, _s11--) : (_r39 = _a18, _a18 = _a18.nextZ, _c10--), _o17 ? _o17.nextZ = _r39 : e = _r39, _r39.prevZ = _o17, _o17 = _r39;\n _i35 = _a18;\n }\n _o17.nextZ = null, n *= 2;\n } while (t > 1);\n }(i);\n }(e, r, i, o);\n var s = e;\n for (; e.prev !== e.next;) {\n var _c11 = e.prev,\n _l8 = e.next;\n if (o ? qr(e, r, i, o) : Wr(e)) t.push(_c11.i, e.i, _l8.i), ui(e), e = _l8.next, s = _l8.next;else if ((e = _l8) === s) {\n a ? 1 === a ? Xr(e = Kr(jr(e), t), t, n, r, i, o, 2) : 2 === a && Jr(e, t, n, r, i, o) : Xr(jr(e), t, n, r, i, o, 1);\n break;\n }\n }\n }\n function Wr(e) {\n var t = e.prev,\n n = e,\n r = e.next;\n if (ii(t, n, r) >= 0) return !1;\n var i = t.x,\n o = n.x,\n a = r.x,\n s = t.y,\n c = n.y,\n l = r.y,\n f = Math.min(i, o, a),\n d = Math.min(s, c, l),\n u = Math.max(i, o, a),\n h = Math.max(s, c, l);\n var m = r.next;\n for (; m !== t;) {\n if (m.x >= f && m.x <= u && m.y >= d && m.y <= h && ni(i, s, o, c, a, l, m.x, m.y) && ii(m.prev, m, m.next) >= 0) return !1;\n m = m.next;\n }\n return !0;\n }\n function qr(e, t, n, r) {\n var i = e.prev,\n o = e,\n a = e.next;\n if (ii(i, o, a) >= 0) return !1;\n var s = i.x,\n c = o.x,\n l = a.x,\n f = i.y,\n d = o.y,\n u = a.y,\n h = Math.min(s, c, l),\n m = Math.min(f, d, u),\n v = Math.max(s, c, l),\n _ = Math.max(f, d, u),\n g = Qr(h, m, t, n, r),\n x = Qr(v, _, t, n, r);\n var p = e.prevZ,\n b = e.nextZ;\n for (; p && p.z >= g && b && b.z <= x;) {\n if (p.x >= h && p.x <= v && p.y >= m && p.y <= _ && p !== i && p !== a && ni(s, f, c, d, l, u, p.x, p.y) && ii(p.prev, p, p.next) >= 0) return !1;\n if (p = p.prevZ, b.x >= h && b.x <= v && b.y >= m && b.y <= _ && b !== i && b !== a && ni(s, f, c, d, l, u, b.x, b.y) && ii(b.prev, b, b.next) >= 0) return !1;\n b = b.nextZ;\n }\n for (; p && p.z >= g;) {\n if (p.x >= h && p.x <= v && p.y >= m && p.y <= _ && p !== i && p !== a && ni(s, f, c, d, l, u, p.x, p.y) && ii(p.prev, p, p.next) >= 0) return !1;\n p = p.prevZ;\n }\n for (; b && b.z <= x;) {\n if (b.x >= h && b.x <= v && b.y >= m && b.y <= _ && b !== i && b !== a && ni(s, f, c, d, l, u, b.x, b.y) && ii(b.prev, b, b.next) >= 0) return !1;\n b = b.nextZ;\n }\n return !0;\n }\n function Kr(e, t) {\n var n = e;\n do {\n var _r40 = n.prev,\n _i36 = n.next.next;\n !oi(_r40, _i36) && ai(_r40, n, n.next, _i36) && li(_r40, _i36) && li(_i36, _r40) && (t.push(_r40.i, n.i, _i36.i), ui(n), ui(n.next), n = e = _i36), n = n.next;\n } while (n !== e);\n return jr(n);\n }\n function Jr(e, t, n, r, i, o) {\n var a = e;\n do {\n var _e113 = a.next.next;\n for (; _e113 !== a.prev;) {\n if (a.i !== _e113.i && ri(a, _e113)) {\n var _s12 = fi(a, _e113);\n return a = jr(a, a.next), _s12 = jr(_s12, _s12.next), Xr(a, t, n, r, i, o, 0), void Xr(_s12, t, n, r, i, o, 0);\n }\n _e113 = _e113.next;\n }\n a = a.next;\n } while (a !== e);\n }\n function Yr(e, t) {\n var n = e.x - t.x;\n if (0 === n && (n = e.y - t.y, 0 === n)) {\n n = (e.next.y - e.y) / (e.next.x - e.x) - (t.next.y - t.y) / (t.next.x - t.x);\n }\n return n;\n }\n function Zr(e, t) {\n var n = function (e, t) {\n var n = t;\n var r = e.x,\n i = e.y;\n var o,\n a = -1 / 0;\n if (oi(e, n)) return n;\n do {\n if (oi(e, n.next)) return n.next;\n if (i <= n.y && i >= n.next.y && n.next.y !== n.y) {\n var _e114 = n.x + (i - n.y) * (n.next.x - n.x) / (n.next.y - n.y);\n if (_e114 <= r && _e114 > a && (a = _e114, o = n.x < n.next.x ? n : n.next, _e114 === r)) return o;\n }\n n = n.next;\n } while (n !== t);\n if (!o) return null;\n var s = o,\n c = o.x,\n l = o.y;\n var f = 1 / 0;\n n = o;\n do {\n if (r >= n.x && n.x >= c && r !== n.x && ti(i < l ? r : a, i, c, l, i < l ? a : r, i, n.x, n.y)) {\n var _t82 = Math.abs(i - n.y) / (r - n.x);\n li(n, e) && (_t82 < f || _t82 === f && (n.x > o.x || n.x === o.x && $r(o, n))) && (o = n, f = _t82);\n }\n n = n.next;\n } while (n !== s);\n return o;\n }(e, t);\n if (!n) return t;\n var r = fi(n, e);\n return jr(r, r.next), jr(n, n.next);\n }\n function $r(e, t) {\n return ii(e.prev, e, t.prev) < 0 && ii(t.next, e, e.next) < 0;\n }\n function Qr(e, t, n, r, i) {\n return (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e = (e - n) * i | 0) | e << 8)) | e << 4)) | e << 2)) | e << 1)) | (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t = (t - r) * i | 0) | t << 8)) | t << 4)) | t << 2)) | t << 1)) << 1;\n }\n function ei(e) {\n var t = e,\n n = e;\n do {\n (t.x < n.x || t.x === n.x && t.y < n.y) && (n = t), t = t.next;\n } while (t !== e);\n return n;\n }\n function ti(e, t, n, r, i, o, a, s) {\n return (i - a) * (t - s) >= (e - a) * (o - s) && (e - a) * (r - s) >= (n - a) * (t - s) && (n - a) * (o - s) >= (i - a) * (r - s);\n }\n function ni(e, t, n, r, i, o, a, s) {\n return !(e === a && t === s) && ti(e, t, n, r, i, o, a, s);\n }\n function ri(e, t) {\n return e.next.i !== t.i && e.prev.i !== t.i && !function (e, t) {\n var n = e;\n do {\n if (n.i !== e.i && n.next.i !== e.i && n.i !== t.i && n.next.i !== t.i && ai(n, n.next, e, t)) return !0;\n n = n.next;\n } while (n !== e);\n return !1;\n }(e, t) && (li(e, t) && li(t, e) && function (e, t) {\n var n = e,\n r = !1;\n var i = (e.x + t.x) / 2,\n o = (e.y + t.y) / 2;\n do {\n n.y > o != n.next.y > o && n.next.y !== n.y && i < (n.next.x - n.x) * (o - n.y) / (n.next.y - n.y) + n.x && (r = !r), n = n.next;\n } while (n !== e);\n return r;\n }(e, t) && (ii(e.prev, e, t.prev) || ii(e, t.prev, t)) || oi(e, t) && ii(e.prev, e, e.next) > 0 && ii(t.prev, t, t.next) > 0);\n }\n function ii(e, t, n) {\n return (t.y - e.y) * (n.x - t.x) - (t.x - e.x) * (n.y - t.y);\n }\n function oi(e, t) {\n return e.x === t.x && e.y === t.y;\n }\n function ai(e, t, n, r) {\n var i = ci(ii(e, t, n)),\n o = ci(ii(e, t, r)),\n a = ci(ii(n, r, e)),\n s = ci(ii(n, r, t));\n return i !== o && a !== s || !(0 !== i || !si(e, n, t)) || !(0 !== o || !si(e, r, t)) || !(0 !== a || !si(n, e, r)) || !(0 !== s || !si(n, t, r));\n }\n function si(e, t, n) {\n return t.x <= Math.max(e.x, n.x) && t.x >= Math.min(e.x, n.x) && t.y <= Math.max(e.y, n.y) && t.y >= Math.min(e.y, n.y);\n }\n function ci(e) {\n return e > 0 ? 1 : e < 0 ? -1 : 0;\n }\n function li(e, t) {\n return ii(e.prev, e, e.next) < 0 ? ii(e, t, e.next) >= 0 && ii(e, e.prev, t) >= 0 : ii(e, t, e.prev) < 0 || ii(e, e.next, t) < 0;\n }\n function fi(e, t) {\n var n = hi(e.i, e.x, e.y),\n r = hi(t.i, t.x, t.y),\n i = e.next,\n o = t.prev;\n return e.next = t, t.prev = e, n.next = i, i.prev = n, r.next = n, n.prev = r, o.next = r, r.prev = o, r;\n }\n function di(e, t, n, r) {\n var i = hi(e, t, n);\n return r ? (i.next = r.next, i.prev = r, r.next.prev = i, r.next = i) : (i.prev = i, i.next = i), i;\n }\n function ui(e) {\n e.next.prev = e.prev, e.prev.next = e.next, e.prevZ && (e.prevZ.nextZ = e.nextZ), e.nextZ && (e.nextZ.prevZ = e.prevZ);\n }\n function hi(e, t, n) {\n return {\n i: e,\n x: t,\n y: n,\n prev: null,\n next: null,\n z: 0,\n prevZ: null,\n nextZ: null,\n steiner: !1 };\n\n }\n var mi = exports.HDR = {\n parseHDR: it },\n\n vi = exports.pbr = {\n PBRHelper: lr,\n StandardMaterial: dr,\n StandardSpecularGlossinessMaterial: ur,\n StandardShader: function (_yt13) {\n function StandardShader() {\n var _this31;\n var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, StandardShader);\n var n = t.extraCommandProps || {};\n var i = t.uniforms;\n n = v({}, n);\n var o = t.defines || {},\n a = [],\n s = [],\n c = [],\n l = [],\n f = [],\n d = [{\n name: \"modelNormalMatrix\",\n type: \"function\",\n fn: function fn(e, t) {\n return _glMatrix.mat3.fromMat4(a, t.modelMatrix);\n } },\n {\n name: \"modelViewNormalMatrix\",\n type: \"function\",\n fn: function fn(t, n) {\n var i = _glMatrix.mat4.multiply(s, n.viewMatrix, n.modelMatrix),\n o = _glMatrix.mat4.invert(i, i),\n a = _glMatrix.mat4.transpose(o, o);\n return _glMatrix.mat3.fromMat4(c, a);\n } },\n {\n name: \"modelViewMatrix\",\n type: \"function\",\n fn: function fn(t, n) {\n return _glMatrix.mat4.multiply(l, n.viewMatrix, n.modelMatrix);\n } },\n {\n name: \"environmentTransform\",\n type: \"function\",\n fn: function fn(e, t) {\n return _glMatrix.mat3.fromRotation(f, Math.PI * (t.environmentOrientation || 0) / 180);\n } }];\n\n i && d.push.apply(d, _toConsumableArray(i));\n _this31 = _callSuper(this, StandardShader, [{\n vert: t.vert || \"#include \\n#define SHADER_NAME PBR\\nprecision highp float;\\nattribute vec3 aPosition;\\n#if defined(HAS_MAP)\\nattribute vec2 aTexCoord;\\nuniform vec2 uvOrigin;\\nuniform vec2 uvScale;\\nuniform vec2 uvOffset;\\nuniform float uvRotation;\\n#ifdef HAS_I3S_UVREGION\\nattribute vec4 uvRegion;\\nvarying vec4 vUvRegion;\\n#endif\\n#if defined(HAS_AO_MAP)\\nattribute vec2 aTexCoord1;\\nvarying vec2 vTexCoord1;\\n#endif\\n#endif\\nvec3 c;\\nvec3 d;\\nvec4 e;\\nuniform mat4 modelMatrix;\\nuniform mat4 modelViewMatrix;\\nuniform mat4 positionMatrix;\\nuniform mat4 projMatrix;\\nuniform mediump vec3 cameraPosition;\\nuniform mat3 modelNormalMatrix;\\n#ifdef HAS_SSR\\nuniform mat3 modelViewNormalMatrix;\\nvarying vec3 vViewNormal;\\n#ifdef HAS_TANGENT\\nvarying vec4 vViewTangent;\\n#endif\\n#endif\\nvarying vec3 vModelNormal;\\nvarying vec4 vViewVertex;\\n#if defined(HAS_TANGENT)\\nvarying vec4 vModelTangent;\\nvarying vec3 vModelBiTangent;\\n#endif\\nvarying vec3 vModelVertex;\\n#if defined(HAS_MAP)\\nvarying vec2 vTexCoord;\\n#endif\\n#if defined(HAS_COLOR)\\nattribute vec4 aColor;\\nvarying vec4 vColor;\\n#endif\\n#ifdef HAS_OPACITY\\nattribute float aOpacity;\\n#endif\\nvarying float vOpacity;\\n#include \\n#if defined(HAS_COLOR0)\\n#if COLOR0_SIZE == 3\\nattribute vec3 aColor0;\\nvarying vec3 vColor0;\\n#else\\nattribute vec4 aColor0;\\nvarying vec4 vColor0;\\n#endif\\n#endif\\n#include \\n#include \\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\\n#include \\n#endif\\n#include \\n#include \\n#if defined(HAS_BUMP_MAP) && defined(HAS_TANGENT)\\nvarying vec3 vTangentViewPos;\\nvarying vec3 vTangentFragPos;\\n#if __VERSION__ == 100\\nmat3 f(in mat3 h) {\\n vec3 i = h[0];\\n vec3 j = h[1];\\n vec3 k = h[2];\\n return mat3(vec3(i.x, j.x, k.x), vec3(i.y, j.y, k.y), vec3(i.z, j.z, k.z));\\n}\\n#else\\nmat3 f(in mat3 h) {\\n return transpose(h);\\n}\\n#endif\\n#endif\\nvoid l(const highp vec4 q, out highp vec3 m) {\\n m = vec3(.0, .0, 1.) + vec3(2., -2., -2.) * q.x * q.zwx + vec3(2., 2., -2.) * q.y * q.wzy;\\n}\\nvoid l(const highp vec4 q, out highp vec3 m, out highp vec3 t) {\\n l(q, m);\\n t = vec3(1., .0, .0) + vec3(-2., 2., -2.) * q.y * q.yxw + vec3(-2., 2., 2.) * q.z * q.zwx;\\n}\\nconst float o = .5;\\nvec2 u(vec2 v, float A) {\\n return vec2(cos(A) * (v.x - o) + sin(A) * (v.y - o) + o, cos(A) * (v.y - o) - sin(A) * (v.x - o) + o);\\n}\\n#if defined(HAS_MAP)\\nvec2 B(vec2 v) {\\n vec2 C = decode_getTexcoord(v);\\n#ifdef HAS_RANDOM_TEX\\nvec2 D = uvOrigin;\\n vec2 E = C * uvScale + uvOffset;\\n return mod(D, 1.) + E;\\n#else\\nvec2 D = uvOrigin;\\n vec2 E = C * uvScale;\\n if(uvRotation != .0) {\\n D = u(D, uvRotation);\\n E = u(E, uvRotation);\\n }\\n return mod(D, 1.) + E + uvOffset;\\n#endif\\n}\\n#endif\\n#ifdef PICKING_MODE\\n#include \\n#endif\\n#include \\nvoid main() {\\n mat4 F = getPositionMatrix();\\n#ifdef IS_LINE_EXTRUSION\\nvec3 G = getLineExtrudePosition(aPosition);\\n vec4 H = getPosition(G);\\n#else\\nvec4 H = getPosition(aPosition);\\n#endif\\nvModelVertex = (modelMatrix * H).xyz;\\n vec4 I = F * H;\\n vec4 J = modelViewMatrix * I;\\n vViewVertex = J;\\n#ifdef HAS_MASK_EXTENT\\ngl_Position = projMatrix * getMaskPosition(I, modelMatrix);\\n#else\\ngl_Position = projMatrix * J;\\n#endif\\n#ifdef PICKING_MODE\\nfloat K = 1.;\\n#if defined(HAS_COLOR)\\nK *= aColor.a;\\n#endif\\n#if defined(HAS_COLOR0) && COLOR0_SIZE == 4\\nK *= aColor0.a;\\n#endif\\nfbo_picking_setData(gl_Position.w, K != .0);\\n#else\\n#if defined(HAS_MAP)\\nvTexCoord = B(aTexCoord);\\n#ifdef HAS_AO_MAP\\nvTexCoord1 = B(aTexCoord1);\\n#endif\\n#ifdef HAS_I3S_UVREGION\\nvUvRegion = uvRegion / 65535.;\\n#endif\\n#endif\\n#if defined(HAS_TANGENT) || defined(HAS_NORMAL)\\nmat3 L = mat3(F);\\n mat3 M = modelNormalMatrix * L;\\n#if defined(HAS_TANGENT)\\nvec3 t;\\n l(aTangent, d, t);\\n vModelTangent = vec4(M * t, aTangent.w);\\n#else\\nd = decode_getNormal(aNormal);\\n#endif\\nvec3 N = d;\\n vModelNormal = M * N;\\n#else\\nd = vec3(.0);\\n vModelNormal = vec3(.0);\\n#endif\\n#if defined(HAS_TANGENT)\\nvModelBiTangent = cross(vModelNormal, vModelTangent.xyz) * sign(aTangent.w);\\n#endif\\n#ifdef HAS_SSR\\nmat3 O = modelViewNormalMatrix * L;\\n vViewNormal = O * d;\\n#if defined(HAS_TANGENT)\\nvec4 P = vec4(t, aTangent.w);\\n vViewTangent = vec4(O * P.xyz, P.w);\\n#endif\\n#endif\\n#if defined(HAS_COLOR)\\nvColor = aColor / 255.;\\n#endif\\n#ifdef HAS_OPACITY\\nvOpacity = aOpacity / 255.;\\n#else\\nvOpacity = 1.;\\n#endif\\nhighlight_setVarying();\\n#if defined(HAS_COLOR0)\\nvColor0 = aColor0 / 255.;\\n#endif\\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\\nshadow_computeShadowPars(I);\\n#endif\\n#ifdef HAS_HEATMAP\\nheatmap_compute(projMatrix * modelViewMatrix * F, H);\\n#endif\\n#if defined(HAS_BUMP_MAP) && defined(HAS_TANGENT)\\nmat3 Q = f(mat3(vModelTangent.xyz, vModelBiTangent, vModelNormal));\\n vTangentViewPos = Q * cameraPosition;\\n vTangentFragPos = Q * vModelVertex;\\n#endif\\n#ifdef HAS_VERTEX_COLOR\\nvertexColor_update();\\n#endif\\n#ifdef HAS_EXCAVATE_ANALYSIS\\nvCoordinateTexcoord = getCoordinateTexcoord();\\n vHeight = getWorldHeight();\\n#endif\\n#endif\\n}\",\n frag: t.frag || \"#define PI 3.141593\\n#define RECIPROCAL_PI 1.0\\n#if __VERSION__ == 100\\n#if defined(GL_EXT_shader_texture_lod)\\n#extension GL_EXT_shader_texture_lod : enable\\n#define textureCubeLod(tex, uv, lod) textureCubeLodEXT(tex, uv, lod)\\n#else\\n#define textureCubeLod(tex, uv, lod) textureCube(tex, uv, lod)\\n#endif\\n#if defined(GL_OES_standard_derivatives)\\n#extension GL_OES_standard_derivatives : enable\\n#endif\\n#else\\n#define textureCubeLod(tex, uv, lod) textureLod(tex, uv, lod)\\n#endif\\n#define saturate(x) clamp(x, 0.0, 1.0)\\nprecision mediump float;\\n#include \\n#include \\n#include \\nuniform vec3 hsv;\\nuniform float contrast;\\nstruct MaterialUniforms {\\n vec2 roughnessMetalness;\\n vec3 albedo;\\n float alpha;\\n vec3 normal;\\n vec3 emit;\\n float ao;\\n vec3 specularColor;\\n float glossiness;\\n vec4 skinColor;\\n} c;\\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\\n#include \\n#endif\\nuniform vec3 cameraPosition;\\nuniform float alphaTest;\\n#if defined(SHADING_MODEL_SPECULAR_GLOSSINESS)\\nuniform vec4 diffuseFactor;\\nuniform vec3 specularFactor;\\nuniform float glossinessFactor;\\n#if defined(HAS_DIFFUSE_MAP)\\nuniform sampler2D diffuseTexture;\\n#endif\\n#if defined(HAS_SPECULARGLOSSINESS_MAP)\\nuniform sampler2D specularGlossinessTexture;\\n#endif\\n#endif\\nuniform vec3 emissiveFactor;\\nuniform vec4 baseColorFactor;\\nuniform float baseColorIntensity;\\nuniform float emitColorFactor;\\nuniform float occlusionFactor;\\nuniform float environmentExposure;\\nuniform float roughnessFactor;\\nuniform float metallicFactor;\\nuniform float normalMapFactor;\\nuniform float specularF0;\\nuniform int emitMultiplicative;\\nuniform int normalMapFlipY;\\nuniform int outputSRGB;\\nuniform mat3 environmentTransform;\\n#if defined(HAS_ALBEDO_MAP)\\nuniform sampler2D baseColorTexture;\\n#endif\\n#if defined(HAS_METALLICROUGHNESS_MAP)\\nuniform sampler2D metallicRoughnessTexture;\\n#endif\\n#if defined(HAS_EMISSIVE_MAP)\\nuniform sampler2D emissiveTexture;\\n#endif\\n#if defined(HAS_AO_MAP)\\nuniform sampler2D occlusionTexture;\\nvarying vec2 vTexCoord1;\\n#endif\\n#if defined(HAS_NORMAL_MAP) && defined(HAS_TANGENT)\\nuniform sampler2D normalTexture;\\n#endif\\n#if defined(HAS_SKIN_MAP)\\nuniform sampler2D skinTexture;\\n#endif\\n#if defined(ALPHA_MODE) && ALPHA_MODE == 1\\nuniform float alphaCutoff;\\n#endif\\n#ifdef HAS_RANDOM_TEX\\nuniform highp vec2 uvOrigin;\\nuniform sampler2D noiseTexture;\\n#endif\\nuniform sampler2D brdfLUT;\\n#if defined(HAS_IBL_LIGHTING)\\nuniform vec3 hdrHSV;\\nuniform samplerCube prefilterMap;\\nuniform vec3 diffuseSPH[9];\\nuniform vec2 prefilterMiplevel;\\nuniform vec2 prefilterSize;\\n#else\\nuniform vec3 ambientColor;\\n#endif\\nuniform vec2 cameraNearFar;\\nuniform vec3 light0_viewDirection;\\nuniform vec4 light0_diffuse;\\n#ifdef HAS_SSR\\nvarying vec3 vViewNormal;\\n#if defined(HAS_TANGENT)\\nvarying vec4 vViewTangent;\\n#endif\\n#endif\\nvarying vec3 vModelVertex;\\nvarying vec4 vViewVertex;\\n#if defined(HAS_MAP)\\n#include \\n#endif\\nvarying vec3 vModelNormal;\\n#if defined(HAS_TANGENT)\\nvarying vec4 vModelTangent;\\nvarying vec3 vModelBiTangent;\\n#endif\\n#if defined(HAS_COLOR0)\\n#if COLOR0_SIZE == 3\\nvarying vec3 vColor0;\\n#else\\nvarying vec4 vColor0;\\n#endif\\n#endif\\n#if defined(HAS_COLOR)\\nvarying vec4 vColor;\\n#elif defined(IS_LINE_EXTRUSION)\\nuniform vec4 lineColor;\\n#else\\nuniform vec4 polygonFill;\\n#endif\\n#ifdef HAS_LAYER_OPACITY\\nuniform float layerOpacity;\\n#endif\\nvarying float vOpacity;\\n#ifdef HAS_INSTANCE_COLOR\\nvarying vec4 vInstanceColor;\\n#endif\\n#ifdef IS_LINE_EXTRUSION\\nuniform float lineOpacity;\\n#else\\nuniform float polygonOpacity;\\n#endif\\n#ifdef HAS_PATTERN\\nuniform sampler2D linePatternFile;\\nuniform vec2 atlasSize;\\nuniform float flipY;\\nuniform float currentTime;\\nuniform float animSpeedScale;\\n#ifdef HAS_PATTERN_ANIM\\nvarying float vLinePatternAnimSpeed;\\n#else\\nuniform float linePatternAnimSpeed;\\n#endif\\n#ifdef HAS_PATTERN_GAP\\nvarying float vLinePatternGap;\\n#else\\nuniform float linePatternGap;\\n#endif\\nuniform vec4 linePatternGapColor;\\nuniform vec2 uvScale;\\nvarying float vPatternHeight;\\nvarying float vLinesofar;\\nvarying vec4 vTexInfo;\\nvarying float vNormalY;\\nvec2 d(vec2 e) {\\n vec2 f = mod(e, 1.);\\n vec2 h = vTexInfo.xy;\\n vec2 i = vTexInfo.zw;\\n return (h + f * i) / atlasSize;\\n}\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#ifdef HAS_RANDOM_TEX\\nconst float j = .5;\\nvec2 k(vec2 f, float l) {\\n return vec2(cos(l) * (f.x - j) + sin(l) * (f.y - j) + j, cos(l) * (f.y - j) - sin(l) * (f.x - j) + j);\\n}\\nfloat m(vec3 n) {\\n return n.x + n.y + n.z;\\n}\\n#endif\\nvec4 o(sampler2D u, in vec2 f) {\\n \\n#ifdef HAS_RANDOM_TEX\\nhighp vec2 A = uvOrigin;\\n highp vec2 B = f + A - mod(A, 1.);\\n float C = texture2D(noiseTexture, .005 * B).x;\\n vec2 D = dFdx(B);\\n vec2 E = dFdx(B);\\n float F = C * 8.;\\n float G = fract(F);\\n#if 1\\nfloat H = floor(F);\\n float I = H + 1.;\\n#else\\nfloat H = floor(F + .5);\\n float I = floor(F);\\n G = min(G, 1. - G) * 2.;\\n#endif\\nvec2 J = sin(vec2(3., 7.) * H);\\n vec2 K = sin(vec2(3., 7.) * I);\\n float L = .5;\\n vec4 M = texture2DGradEXT(u, f + L * J, D, E);\\n vec4 N = texture2DGradEXT(u, f + L * K, D, E);\\n return mix(M, N, smoothstep(.2, .8, G - .1 * m(M.xyz - N.xyz)));\\n#else\\nreturn texture2D(u, f);\\n#endif\\n}\\n#if defined(HAS_BUMP_MAP) && defined(HAS_TANGENT)\\nuniform sampler2D bumpTexture;\\nuniform float bumpScale;\\nuniform float bumpMaxLayers;\\nuniform float bumpMinLayers;\\nvec2 O(vec2 f, vec3 P) {\\n float Q = mix(bumpMaxLayers, bumpMinLayers, abs(dot(vec3(.0, .0, 1.), P)));\\n float R = 1. / Q;\\n float S = .0;\\n vec2 T = P.xy * bumpScale / (P.z * Q);\\n vec2 U = f;\\n float V = o(bumpTexture, U).r;\\n for(int W = 0; W < 30; W++) {\\n S += R;\\n U -= T;\\n V = o(bumpTexture, U).r;\\n if(V < S) {\\n break;\\n }\\n }\\n vec2 X = U + T;\\n float Y = V - S;\\n float Z = o(bumpTexture, X).r - S + R;\\n return mix(U, X, Y / (Y - Z));\\n}\\nvarying vec3 vTangentViewPos;\\nvarying vec3 vTangentFragPos;\\n#endif\\n#define SHADER_NAME PBR\\nvec3 ba() {\\n return c.albedo;\\n}\\nfloat bb() {\\n return c.alpha;\\n}\\nfloat bc() {\\n return c.roughnessMetalness.y;\\n}\\nfloat bd() {\\n \\n#if defined(SHADING_MODEL_SPECULAR_GLOSSINESS)\\nreturn 1. - c.glossiness;\\n#else\\nreturn c.roughnessMetalness.x;\\n#endif\\n}\\nvec3 be() {\\n return c.emit;\\n}\\nvec4 bf() {\\n return c.skinColor;\\n}\\nvec3 bg() {\\n return c.normal;\\n}\\nfloat bh() {\\n return c.ao;\\n}\\nfloat bi(const in vec4 bj) {\\n return bj.r + bj.g / 255.;\\n}\\nvec3 bk(const in float bl, in vec3 bm, const in vec3 t, const in vec3 b, in vec3 bn) {\\n bm.xy = bl * bm.xy;\\n mat3 bo = mat3(t, b, bn);\\n return normalize(bo * bm);\\n}\\nfloat bp(const float bq, const vec3 bm, const vec3 br) {\\n float bs = clamp(dot(bm, br), 0., 1.);\\n float a = bq * bq;\\n float bt = a * a;\\n float bu = (bs * bt - bs) * bs + 1.;\\n return bt / (PI * bu * bu);\\n}\\nvec3 bv(const vec3 bw, const float bx, const in vec3 by, const in vec3 br) {\\n float bz = clamp(dot(by, br), 0., 1.);\\n bz = pow(1. - bz, 5.);\\n return bx * bz + (1. - bz) * bw;\\n}\\nfloat bA(const in vec3 bm, const in vec3 bB, const in float bq, const float bC) {\\n float bD = clamp(dot(bm, bB), 0., 1.);\\n float a = bq * bq;\\n float bE = bD * (bC * (1. - a) + a);\\n float bF = bC * (bD * (1. - a) + a);\\n return .5 / (bF + bE);\\n}\\nvec3 bG(const float bq, const vec3 bm, const vec3 bB, const vec3 by, const vec3 bH, const float bC, const float bx) {\\n vec3 br = normalize(bB + by);\\n float bI = bp(bq, bm, br);\\n float bJ = bA(bm, bB, bq, bC);\\n vec3 bK = bv(bH, bx, by, br);\\n return (bI * bJ * PI) * bK;\\n}\\nvec3 bL(const in vec3 bM) {\\n return RECIPROCAL_PI * bM;\\n}\\nvoid bN(const in vec3 bm, const in vec3 bB, const in float bC, const in float bq, const in vec3 bO, const in vec3 bH, const in vec3 bP, const in vec3 by, const in float bx, out vec3 bQ, out vec3 bR) {\\n if(bC <= .0) {\\n bR = bQ = vec3(.0);\\n return;\\n }\\n vec3 a = bC * bP;\\n vec3 bS = bG(bq, bm, bB, by, bH, bC, bx);\\n bR = a * bS;\\n bQ = a * bL(bO);\\n}\\n#if defined(HAS_IBL_LIGHTING)\\nvec3 bT(const in vec3 bm) {\\n vec3 bn = environmentTransform * bm;\\n float x = bn.x;\\n float y = bn.y;\\n float z = bn.z;\\n vec3 bU = (diffuseSPH[0] + diffuseSPH[1] * x + diffuseSPH[2] * y + diffuseSPH[3] * z + diffuseSPH[4] * z * x + diffuseSPH[5] * y * z + diffuseSPH[6] * y * x + diffuseSPH[7] * (3. * z * z - 1.) + diffuseSPH[8] * (x * x - y * y));\\n if(length(hdrHSV) > .0) {\\n bU = hsv_apply(bU, hdrHSV);\\n }\\n return max(bU, vec3(.0));\\n}\\nvec3 bV(const in float bq, const in vec3 bW) {\\n vec3 bX = bW;\\n float bY = prefilterMiplevel.x;\\n float bZ = min(bY, bq * prefilterMiplevel.y);\\n vec3 ca = textureCubeLod(prefilterMap, bX, bZ).rgb;\\n if(length(hdrHSV) > .0) {\\n return hsv_apply(ca, hdrHSV);\\n } else {\\n return ca;\\n }\\n}\\nvec3 cb(const in vec3 cc, const in vec3 bB, const in float bq, const in vec3 cd, const in vec3 bO) {\\n float ce = 1. - bq;\\n vec3 bW = mix(cc, reflect(-bB, cc), ce * (sqrt(ce) + bq));\\n float bl = clamp(1. + dot(bW, cd), .0, 1.);\\n vec3 cf = bV(bq, environmentTransform * bW) * bl * bl;\\n return cf;\\n}\\n#else\\nvec3 cb(const in vec3 bm, const in vec3 cg, const in float bq, const in vec3 cd, const in vec3 bO) {\\n return ambientColor * bL(bO);\\n}\\n#endif\\nvec3 ch(const in vec3 ci, const in float bq, const in float bD, const in float bx) {\\n vec4 rgba = texture2D(brdfLUT, vec2(bD, bq)) * vec4(255., 65280.0, 255., 65280.0);\\n float b = (rgba[3] + rgba[2]);\\n float a = (rgba[1] + rgba[0]);\\n return (ci * a + b * bx) / 65535.;\\n}\\nvec3 cj(const in vec3 bm, const in vec3 cg, const in float bD, const in float bq, const in vec3 bH, const in vec3 cd, const in float bx, const in vec3 bO) {\\n return cb(bm, cg, bq, cd, bO) * ch(bH, bq, bD, bx);\\n}\\nfloat ck(const in float cl, const in float bD) {\\n float bu = bD + cl;\\n return clamp(bu * bu - 1. + cl, .0, 1.);\\n}\\nvoid cm() {\\n \\n#ifdef HAS_MAP\\nvec2 f = computeTexCoord(vTexCoord);\\n#endif\\n#ifdef HAS_UV_FLIP\\nf.y = 1. - f.y;\\n#endif\\n#if defined(HAS_BUMP_MAP) && defined(HAS_TANGENT)\\nf = O(f, normalize(vTangentViewPos - vTangentFragPos));\\n#endif\\nc.albedo = baseColorIntensity * baseColorFactor.rgb;\\n c.alpha = baseColorFactor.a * vOpacity;\\n#if defined(HAS_PATTERN)\\nfloat cn = vLinesofar;\\n vec2 i = vTexInfo.zw;\\n#ifdef HAS_PATTERN_GAP\\nfloat co = vLinePatternGap;\\n#else\\nfloat co = linePatternGap;\\n#endif\\n#ifdef HAS_PATTERN_ANIM\\nfloat cp = vLinePatternAnimSpeed;\\n#else\\nfloat cp = linePatternAnimSpeed;\\n#endif\\nfloat cq = ceil(i.x * vPatternHeight / i.y);\\n float cr = cq * (1. + co);\\n cp /= animSpeedScale;\\n cn += mod(currentTime * -cp * .2, cr);\\n float cs = mod(cn / cr, 1.);\\n float ct = mod(flipY * vNormalY, 1.);\\n vec2 f = d(vec2(cs * (1. + co) * uvScale[0], ct * uvScale[1]));\\n vec4 cu = texture2D(linePatternFile, f);\\n float cv = clamp(sign(1. / (1. + co) - cs) + .000001, .0, 1.);\\n cu = mix(linePatternGapColor, cu, cv);\\n#ifdef IS_SQUARE_TUBE\\nfloat n = clamp(sign(abs(vNormalY) - .999999), .0, 1.);\\n cu = mix(cu, vec4(1.), n);\\n#endif\\nc.albedo *= cu.rgb;\\n c.alpha *= cu.a;\\n#endif\\n#if defined(HAS_ALBEDO_MAP)\\nvec4 cw = o(baseColorTexture, f);\\n c.albedo *= sRGBToLinear(cw.rgb);\\n c.alpha *= cw.a;\\n#endif\\n#if defined(HAS_SKIN_MAP)\\nvec4 cx = o(skinTexture, f);\\n c.skinColor = cx;\\n#endif\\n#if defined(HAS_COLOR0)\\nc.albedo *= vColor0.rgb;\\n#if COLOR0_SIZE == 4\\nc.alpha *= vColor0.a;\\n#endif\\n#endif\\n#if defined(HAS_COLOR)\\nc.albedo *= vColor.rgb;\\n c.alpha *= vColor.a;\\n#elif defined(IS_LINE_EXTRUSION)\\nc.albedo *= lineColor.rgb;\\n c.alpha *= lineColor.a;\\n#else\\nc.albedo *= polygonFill.rgb;\\n c.alpha *= polygonFill.a;\\n#endif\\n#if defined(HAS_INSTANCE_COLOR)\\nc.albedo *= vInstanceColor.rgb;\\n c.alpha *= vInstanceColor.a;\\n#endif\\n#if defined(HAS_METALLICROUGHNESS_MAP)\\nc.roughnessMetalness = o(metallicRoughnessTexture, f).gb * vec2(roughnessFactor, metallicFactor);\\n#else\\nc.roughnessMetalness = vec2(roughnessFactor, metallicFactor);\\n#endif\\nc.emit = emissiveFactor;\\n#if defined(HAS_EMISSIVE_MAP)\\nif(emitMultiplicative == 1) {\\n c.emit *= sRGBToLinear(o(emissiveTexture, f).rgb);\\n } else {\\n c.emit += sRGBToLinear(o(emissiveTexture, f).rgb);\\n }\\n#endif\\nc.emit *= emitColorFactor;\\n#if defined(HAS_AO_MAP)\\nvec2 cy = computeTexCoord(vTexCoord1);\\n c.ao = o(occlusionTexture, cy).r;\\n#else\\nc.ao = 1.;\\n#endif\\nc.ao *= occlusionFactor;\\n#if defined(HAS_NORMAL_MAP) && defined(HAS_TANGENT)\\nvec3 cz = o(normalTexture, f).xyz * 2. - 1.;\\n cz.y = normalMapFlipY == 1 ? -cz.y : cz.y;\\n c.normal = cz;\\n#else\\nc.normal = normalize(vModelNormal);\\n#endif\\n#if defined(HAS_TERRAIN_NORMAL) && defined(HAS_TANGENT)\\nvec3 cz = convertTerrainHeightToNormalMap(f);\\n cz.y = normalMapFlipY == 1 ? -cz.y : cz.y;\\n c.normal = cz;\\n#endif\\n#if defined(SHADING_MODEL_SPECULAR_GLOSSINESS)\\nc.albedo *= diffuseFactor.rgb;\\n c.alpha *= diffuseFactor.a;\\n#if defined(HAS_DIFFUSE_MAP)\\nvec4 cA = o(diffuseTexture, f);\\n c.albedo *= sRGBToLinear(cA.rgb);\\n c.alpha *= cA.a;\\n#endif\\nc.specularColor = specularFactor;\\n c.glossiness = glossinessFactor;\\n#if defined(HAS_SPECULARGLOSSINESS_MAP)\\nvec4 cB = o(specularGlossinessTexture, f);\\n c.specularColor *= sRGBToLinear(cB.rgb);\\n c.glossiness *= cB.a;\\n#endif\\n#endif\\n}\\nvec3 cC(const vec3 x) {\\n const float a = 2.51;\\n const float b = .03;\\n const float cD = 2.43;\\n const float bu = .59;\\n const float cE = .14;\\n return (x * (a * x + b)) / (x * (cD * x + bu) + cE);\\n}\\nvec3 cF(vec3 cG) {\\n cG = cC(cG);\\n return cG = pow(cG, vec3(1. / 2.2));\\n}\\nuniform float specularAAVariance;\\nuniform float specularAAThreshold;\\nfloat cH(float bq, const vec3 cI) {\\n \\n#if defined(GL_OES_standard_derivatives) || __VERSION__ == 300\\nvec3 cJ = dFdx(cI);\\n vec3 cK = dFdy(cI);\\n float cL = specularAAVariance * (dot(cJ, cJ) + dot(cK, cK));\\n float cM = min(2. * cL, specularAAThreshold);\\n float cN = saturate(bq * bq + cM);\\n return sqrt(cN);\\n#else\\nreturn bq;\\n#endif\\n}\\n#ifdef HAS_SSR\\nuniform sampler2D TextureDepth;\\nuniform highp vec2 outSize;\\nuniform float ssrFactor;\\nuniform float ssrQuality;\\nuniform sampler2D TextureReflected;\\nuniform highp mat4 projMatrix;\\nuniform mat4 invProjMatrix;\\nuniform vec4 outputFovInfo[2];\\nuniform mat4 reprojViewProjMatrix;\\nvec3 cO(const in mat4 cP, const in vec3 cQ) {\\n vec4 cR = cP * vec4(cQ, 1.);\\n return vec3(.5 + .5 * cR.xy / cR.w, cR.w);\\n}\\nvec3 cS(const in float cT, const in vec2 f) {\\n return texture2D(TextureReflected, f).rgb;\\n}\\nfloat cU(float cV) {\\n highp mat4 cP = projMatrix;\\n highp float z = cV * 2. - 1.;\\n return -cP[3].z / (z + cP[2].z);\\n}\\nfloat cW(const vec2 f) {\\n float cV = bi(texture2D(TextureDepth, f));\\n return cV;\\n}\\nfloat cX(const in vec2 cY, const in float cZ) {\\n vec3 da = vec3(.06711056, .00583715, 52.9829189);\\n return fract(da.z * fract(dot(cY.xy + cZ * vec2(47., 17.) * .695, da.xy))) * .5;\\n}\\nvec3 db(const in float cZ, const in vec3 dc, const in vec3 dd, const in vec3 de, const in vec3 cg, const in float df) {\\n vec2 dg;\\n dg.x = cX(gl_FragCoord.yx, cZ);\\n dg.y = fract(dg.x * 52.9829189);\\n dg.y = mix(dg.y, 1., .7);\\n float dh = 2. * 3.14159 * dg.x;\\n float di = pow(max(dg.y, .000001), df / (2. - df));\\n float dj = sqrt(1. - di * di);\\n vec3 dk = vec3(dj * cos(dh), dj * sin(dh), di);\\n dk = dk.x * dc + dk.y * dd + dk.z * de;\\n return normalize((2. * dot(cg, dk)) * dk - cg);\\n}\\nfloat dl(const in float cZ) {\\n return (cX(gl_FragCoord.xy, cZ) - .5);\\n}\\nvec3 dm(const in vec3 dn, const in float dp, const in vec3 dq) {\\n vec3 dr = cO(projMatrix, vViewVertex.xyz + dq * dp);\\n dr.z = 1. / dr.z;\\n dr -= dn;\\n float ds = min(1., .99 * (1. - dn.x) / max(1e-5, dr.x));\\n float dt = min(1., .99 * (1. - dn.y) / max(1e-5, dr.y));\\n float dw = min(1., .99 * dn.x / max(1e-5, -dr.x));\\n float dx = min(1., .99 * dn.y / max(1e-5, -dr.y));\\n return dr * min(ds, dt) * min(dw, dx);\\n}\\nfloat dy(const in vec3 dn, const in vec3 dr, inout float dz, inout float dA) {\\n float dB = (dA + dz) * .5;\\n vec3 dC = dn + dr * dB;\\n float z = cW(dC.xy);\\n float cV = cU(z);\\n float dD = -1. / dC.z;\\n dz = cV > dD ? dz : dB;\\n dA = cV > dD ? dB : dA;\\n return dB;\\n}\\nvec4 dE(const in vec3 dn, const in float dp, in float dF, const in vec3 dq, const in float bq, const in float cZ) {\\n int dG = 20;\\n float dH = 1. / float(dG);\\n dF *= dH;\\n vec3 dr = dm(dn, dp, dq);\\n float dI = dH;\\n vec3 dJ = vec3(.0, dI, 1.);\\n vec3 dC;\\n float z, cV, dD, dK, dL, dM;\\n bool dN;\\n float dO = 1.;\\n float dB;\\n for(int W = 0; W < dG; W++) {\\n dC = dn + dr * dJ.y;\\n z = cW(dC.xy);\\n cV = cU(z);\\n dD = -1. / dC.z;\\n float dP = clamp(sign(.999 - z), .0, 1.);\\n dK = dP * (dD - cV);\\n dK *= clamp(sign(abs(dK) - dp * dH * dH), .0, 1.);\\n dN = abs(dK + dF) < dF;\\n dL = clamp(dJ.x / (dJ.x - dK), .0, 1.);\\n dM = dN ? dJ.y + dL * dH - dH : 1.;\\n dJ.z = min(dJ.z, dM);\\n dJ.x = dK;\\n if(dN) {\\n float dz = dJ.y - dH;\\n float dA = dJ.y;\\n dB = dy(dn, dr, dz, dA);\\n dB = dy(dn, dr, dz, dA);\\n dB = dy(dn, dr, dz, dA);\\n dO = dB;\\n break;\\n }\\n dJ.y += dH;\\n }\\n return vec4(dn + dr * dO, 1. - dO);\\n}\\nvec4 dQ(in vec4 dR, const in float dS, const in vec3 dT, const in vec3 dU, const in float bq) {\\n vec4 dV = mix(outputFovInfo[0], outputFovInfo[1], dR.x);\\n dR.xyz = vec3(mix(dV.xy, dV.zw, dR.y), 1.) * -1. / dR.z;\\n dR.xyz = (reprojViewProjMatrix * vec4(dR.xyz, 1.)).xyw;\\n dR.xy /= dR.z;\\n float dW = clamp(6. - 6. * max(abs(dR.x), abs(dR.y)), .0, 1.);\\n dR.xy = .5 + .5 * dR.xy;\\n vec3 dX = dU * cS(bq * (1. - dR.w), dR.xy);\\n return vec4(mix(dT, dX, dS * dW), 1.);\\n}\\nvec3 ssr(const in vec3 dT, const in vec3 dU, const in float bq, const in vec3 bm, const in vec3 cg) {\\n float dY = .0;\\n vec4 bU = vec4(.0);\\n float df = bq * bq;\\n df = df * df;\\n vec3 dZ = abs(bm.z) < .999 ? vec3(.0, .0, 1.) : vec3(1., .0, .0);\\n vec3 dc = normalize(cross(dZ, bm));\\n vec3 dd = cross(bm, dc);\\n float dS = ssrFactor * clamp(-4. * dot(cg, bm) + 3.8, .0, 1.);\\n dS *= clamp(4.7 - bq * 5., .0, 1.);\\n vec3 dn = cO(projMatrix, vViewVertex.xyz);\\n dn.z = 1. / dn.z;\\n vec3 dq = db(dY, dc, dd, bm, cg, df);\\n float dp = mix(cameraNearFar.y + vViewVertex.z, -vViewVertex.z - cameraNearFar.x, dq.z * .5 + .5);\\n float dF = .5 * dp;\\n vec4 dR;\\n if(dot(dq, bm) > .001 && dS > .0) {\\n dR = dE(dn, dp, dF, dq, bq, dY);\\n if(dR.w > .0)\\n bU += dQ(dR, dS, dT, dU, bq);\\n \\n }\\n return bU.w > .0 ? bU.rgb / bU.w : dT;\\n}\\n#endif\\n#include \\nvec4 ea(in vec4 eb) {\\n return vec4(mix(pow(eb.rgb, vec3(.41666)) * 1.055 - vec3(.055), eb.rgb * 12.92, vec3(lessThanEqual(eb.rgb, vec3(.0031308)))), eb.a);\\n}\\nvec4 ec(vec4 eb) {\\n return (ea(eb));\\n}\\nvoid main() {\\n cm();\\n vec3 cg = normalize(cameraPosition - vModelVertex.xyz);\\n#if defined(HAS_DOUBLE_SIDE)\\nvec3 cd = gl_FrontFacing ? normalize(vModelNormal) : -normalize(vModelNormal);\\n#else\\nvec3 cd = normalize(vModelNormal);\\n#endif\\n#if defined(HAS_TANGENT)\\nvec4 ed;\\n ed = vModelTangent;\\n#if defined(HAS_DOUBLE_SIDE)\\ned.xyz = gl_FrontFacing ? normalize(ed.xyz) : -normalize(ed.xyz);\\n#else\\ned.xyz = normalize(ed.xyz);\\n#endif\\nvec3 ee = normalize(vModelBiTangent);\\n#endif\\nfloat bw = .08 * specularF0;\\n float ef = bc();\\n vec3 bO = ba();\\n#if defined(SHADING_MODEL_SPECULAR_GLOSSINESS)\\nvec3 eg = c.specularColor;\\n#else\\nvec3 eg = mix(vec3(bw), bO, ef);\\n#endif\\nbO *= 1. - ef;\\n float eh = clamp(50.0 * eg.g, .0, 1.);\\n float ei = bd();\\n if(specularAAVariance > .0) {\\n ei = cH(ei, cd);\\n }\\n vec3 ej = be();\\n vec3 ek = bg();\\n vec3 el = vec3(ek);\\n#if defined(HAS_TANGENT) && (defined(HAS_NORMAL_MAP) || defined(HAS_TERRAIN_NORMAL))\\nel = bk(normalMapFactor, el, ed.xyz, ee, cd);\\n#endif\\nvec3 cA = vec3(.0);\\n vec3 bH = vec3(.0);\\n#if defined(HAS_IBL_LIGHTING)\\ncA = bO * bT(el) * .5;\\n#else\\ncA = bO * ambientColor;\\n#endif\\nfloat bD = dot(el, cg);\\n bH = cj(el, cg, bD, ei, eg, cd, eh, bO);\\n float em;\\n float en = 1.;\\n float eo = bh();\\n cA *= environmentExposure * eo;\\n#ifdef HAS_IBL_LIGHTING\\nen = ck(eo, bD);\\n#endif\\n#ifdef HAS_SSR\\nvec3 ep = normalize(gl_FrontFacing ? vViewNormal : -vViewNormal);\\n vec3 eq = ep;\\n#if defined(HAS_TANGENT) && (defined(HAS_NORMAL_MAP) || defined(HAS_TERRAIN_NORMAL))\\nvec4 er;\\n er = vViewTangent;\\n er = gl_FrontFacing ? er : -er;\\n er.xyz = normalize(er.xyz);\\n vec3 es = normalize(cross(ep, er.xyz)) * er.w;\\n eq = bk(normalMapFactor, ek, er.xyz, es, ep);\\n#endif\\nbH = ssr(bH, eg * en, ei, eq, -normalize(vViewVertex.xyz));\\n#endif\\nbH *= environmentExposure * en;\\n vec3 et, eu;\\n vec3 ev = vModelNormal;\\n vec3 ew = -light0_viewDirection;\\n float ex = saturate(dot(ew, el));\\n bN(el, cg, ex, max(.045, ei), bO, eg, light0_diffuse.rgb, ew, eh, eu, et);\\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\\nfloat ey = shadow_computeShadow();\\n eu = shadow_blend(eu, ey).rgb;\\n et = shadow_blend(et, ey).rgb;\\n#endif\\ncA += eu;\\n bH += et;\\n cA += ej;\\n vec3 ez = bH + cA;\\n if(outputSRGB == 1)\\n ez = linearTosRGB(ez);\\n \\n#ifdef HAS_SKIN_MAP\\nvec4 eA = bf();\\n ez.rgb = ez.rgb * (1. - eA.a) + eA.rgb * eA.a;\\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\\nez.rgb = shadow_blend(ez.rgb, ey).rgb;\\n#endif\\n#endif\\nfloat eB = bb();\\n if(eB < alphaTest) {\\n discard;\\n }\\n#if defined(ALPHA_MODE)\\n#if ALPHA_MODE == 1\\nif(eB < alphaCutoff) {\\n discard;\\n } else {\\n eB = 1.;\\n }\\n#else\\neB = 1.;\\n#endif\\n#endif\\n#if defined(IS_LINE_EXTRUSION)\\neB *= lineOpacity;\\n#else\\neB *= polygonOpacity;\\n#endif\\nglFragColor = vec4(ez * eB, eB);\\n#ifdef HAS_VERTEX_COLOR\\nglFragColor *= vertexColor_get();\\n#endif\\n#ifdef HAS_EXCAVATE_ANALYSIS\\nglFragColor = excavateColor(glFragColor);\\n#endif\\n#ifdef HAS_HEATMAP\\nglFragColor = heatmap_getColor(glFragColor);\\n#endif\\n#ifdef HAS_SNOW\\nglFragColor.rgb = snow(glFragColor, bg(), 1.);\\n#endif\\nif(contrast != 1.) {\\n glFragColor = contrastMatrix(contrast) * glFragColor;\\n }\\n if(length(hsv) > .0) {\\n glFragColor = hsv_apply(glFragColor, hsv);\\n }\\n#ifdef OUTPUT_NORMAL\\nglFragColor = vec4(cd, 1.);\\n#endif\\nglFragColor = highlight_blendColor(glFragColor);\\n#ifdef HAS_LAYER_OPACITY\\nglFragColor *= layerOpacity;\\n#endif\\n#ifdef HAS_MASK_EXTENT\\nglFragColor = setMask(glFragColor);\\n#endif\\n#if __VERSION__ == 100\\ngl_FragColor = glFragColor;\\n#endif\\n}\",\n uniforms: d,\n extraCommandProps: n,\n defines: o }]),\n _this31.version = 300;\n return _this31;\n }\n _inherits(StandardShader, _yt13);\n return _createClass(StandardShader, [{\n key: \"getGeometryDefines\",\n value: function getGeometryDefines(e) {\n var t = {};\n return e.data[e.desc.tangentAttribute] ? t.HAS_TANGENT = 1 : e.data[e.desc.normalAttribute] && (t.HAS_NORMAL = 1), e.data[e.desc.colorAttribute] && (t.HAS_COLOR = 1), e.data[e.desc.color0Attribute] && (t.HAS_COLOR0 = 1, t.COLOR0_SIZE = e.getColor0Size()), t;\n } }]);\n\n }(yt),\n StandardDepthShader: function (_yt14) {\n function StandardDepthShader() {\n var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, StandardDepthShader);\n var n = [];\n return _callSuper(this, StandardDepthShader, [{\n vert: \"#define SHADER_NAME depth_vert\\nprecision highp float;\\nattribute vec3 aPosition;\\n#include \\nuniform mat4 modelViewMatrix;\\nuniform mat4 positionMatrix;\\nuniform mat4 projMatrix;\\nuniform vec2 outSize;\\nuniform vec2 halton;\\n#include \\nvoid main() {\\n mat4 c = getPositionMatrix();\\n#ifdef IS_LINE_EXTRUSION\\nvec4 d = getPosition(getLineExtrudePosition(aPosition));\\n#else\\nvec4 d = getPosition(aPosition);\\n#endif\\nvec4 e = modelViewMatrix * c * d;\\n mat4 f = projMatrix;\\n f[2].xy += halton.xy / outSize.xy;\\n gl_Position = f * e;\\n}\",\n frag: \"#define SHADER_NAME depth_frag\\nprecision highp float;\\nvoid main() {\\n gl_FragColor = vec4(1., .0, .0, 1.);\\n}\",\n uniforms: [{\n name: \"modelViewMatrix\",\n type: \"function\",\n fn: function fn(t, r) {\n return _glMatrix.mat4.multiply(n, r.viewMatrix, r.modelMatrix);\n } }],\n\n extraCommandProps: t.extraCommandProps,\n defines: t.defines }]);\n\n }\n _inherits(StandardDepthShader, _yt14);\n return _createClass(StandardDepthShader);\n }(yt),\n PBRUtils: gr },\n\n _i = exports.earcut = function _i(e, t) {\n var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;\n var r = t && t.length,\n i = r ? t[0] * n : e.length;\n var o = Ur(e, 0, i, n, !0);\n var a = [];\n if (!o || o.next === o.prev) return a;\n var s, c, l;\n if (r && (o = function (e, t, n, r) {\n var i = [];\n for (var _n60 = 0, _o18 = t.length; _n60 < _o18; _n60++) {\n var _a19 = Ur(e, t[_n60] * r, _n60 < _o18 - 1 ? t[_n60 + 1] * r : e.length, r, !1);\n _a19 === _a19.next && (_a19.steiner = !0), i.push(ei(_a19));\n }\n i.sort(Yr);\n for (var _e115 = 0; _e115 < i.length; _e115++) n = Zr(i[_e115], n);\n return n;\n }(e, t, o, n)), e.length > 80 * n) {\n s = 1 / 0, c = 1 / 0;\n var _t83 = -1 / 0,\n _r41 = -1 / 0;\n for (var _o19 = n; _o19 < i; _o19 += n) {\n var _n61 = e[_o19],\n _i37 = e[_o19 + 1];\n _n61 < s && (s = _n61), _i37 < c && (c = _i37), _n61 > _t83 && (_t83 = _n61), _i37 > _r41 && (_r41 = _i37);\n }\n l = Math.max(_t83 - s, _r41 - c), l = 0 !== l ? 32767 / l : 0;\n }\n return Xr(o, a, n, s, c, l, 0), a;\n };\n _i.flatten = function (e) {\n var t = [],\n n = [],\n r = e[0][0].length;\n var i = 0,\n o = 0;\n var _iterator3 = _createForOfIteratorHelper(e),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var _a20 = _step3.value;\n var _iterator4 = _createForOfIteratorHelper(_a20),\n _step4;\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n var _e116 = _step4.value;\n for (var _n62 = 0; _n62 < r; _n62++) t.push(_e116[_n62]);\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n o && (i += o, n.push(i)), o = _a20.length;\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n return {\n vertices: t,\n holes: n,\n dimensions: r };\n\n };return module.exports;});", "requires": [], "buildLevel": 0, "fileName": "/dist/reshadergl.es.js" } }