hilo3d 1.16.1 → 1.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +2 -2
- package/README_ZH.md +2 -2
- package/build/Hilo3d.js +2 -2
- package/build/Hilo3d.single.js +2 -2
- package/build/math.single.js +2 -2
- package/package.json +1 -1
package/build/Hilo3d.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Hilo3d 1.16.
|
|
2
|
+
* Hilo3d 1.16.2
|
|
3
3
|
* Copyright (c) 2017-present Alibaba Group Holding Ltd.
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
@@ -36,4 +36,4 @@ THE SOFTWARE.
|
|
|
36
36
|
object-assign
|
|
37
37
|
(c) Sindre Sorhus
|
|
38
38
|
@license MIT
|
|
39
|
-
*/var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;function s(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,o,u=s(t),c=1;c<arguments.length;c++){for(var h in n=Object(arguments[c]))i.call(n,h)&&(u[h]=n[h]);if(r){o=r(n);for(var f=0;f<o.length;f++)a.call(n,o[f])&&(u[o[f]]=n[o[f]])}}return u}},function(t,e,n){"use strict";var r,i,a,s;Object.keys||(Object.keys=(r=Object.prototype.hasOwnProperty,i=!{toString:null}.propertyIsEnumerable("toString"),s=(a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(t){if("object"!=typeof t&&("function"!=typeof t||null===t))throw new TypeError("Object.keys called on non-object");var e,n,o=[];for(e in t)r.call(t,e)&&o.push(e);if(i)for(n=0;n<s;n++)r.call(t,a[n])&&o.push(a[n]);return o}))},function(t,e,n){"use strict";t.exports=function(t){return Object.keys(t).map((function(e){return t[e]}))}},function(t,e,n){"use strict";t.exports="function"==typeof Promise?Promise:n(101)},function(t,e){t.exports=function(t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));var e=0,n=t.length;function r(){var r="";do{var i=t[e];if(10==i){++e;break}r+=String.fromCharCode(i)}while(++e<n);return r}for(var i=0,a=0,s=1,o=!1,u=0;u<20;u++){var c,h=r();if(c=h.match("#\\?RADIANCE"));else if(c=h.match("FORMAT=32-bit_rle_rgbe"))o=!0;else if(c=h.match("EXPOSURE=\\s*([0-9]*[.][0-9]*)"))s=Number(c[1]);else if(c=h.match("#.*"));else if(c=h.match("-Y ([0-9]+) \\+X ([0-9]+)")){a=Number(c[1]),i=Number(c[2]);break}}if(!o)throw new Error("File is not run length encoded!");var f=new Uint8Array(i*a*4);!function(t,e,n,r,i,a){var s,o,u,c=new Array(4),h=null,f=new Array(2),l=t.length;function d(e){var n=0;do{e[n++]=t[r]}while(++r<l&&n<e.length);return n}function m(e,n,i){var a=0;do{e[n+a++]=t[r]}while(++r<l&&a<i);return a}function _(t,e,n,r){var i=4*r,a=m(e,n,i);if(a<i)throw new Error("Error reading raw pixels: got "+a+" bytes, expected "+i)}for(;a>0;){if(d(c)<c.length)throw new Error("Error reading bytes: expected "+c.length);if(2!=c[0]||2!=c[1]||0!=(128&c[2]))return e[n++]=c[0],e[n++]=c[1],e[n++]=c[2],e[n++]=c[3],void _(0,e,n,i*a-1);if(((255&c[2])<<8|255&c[3])!=i)throw new Error("Wrong scanline width "+((255&c[2])<<8|255&c[3])+", expected "+i);null==h&&(h=new Array(4*i)),s=0;for(var p=0;p<4;p++)for(o=(p+1)*i;s<o;){if(d(f)<f.length)throw new Error("Error reading 2-byte buffer");if((255&f[0])>128){if(0==(u=(255&f[0])-128)||u>o-s)throw new Error("Bad scanline data");for(;u-- >0;)h[s++]=f[1]}else{if(0==(u=255&f[0])||u>o-s)throw new Error("Bad scanline data");if(h[s++]=f[1],--u>0){if(m(h,s,u)<u)throw new Error("Error reading non-run data");s+=u}}}for(p=0;p<i;p++)e[n+0]=h[p],e[n+1]=h[p+i],e[n+2]=h[p+2*i],e[n+3]=h[p+3*i],n+=4;a--}}(t,f,0,e,i,a);for(var l=new Float32Array(i*a*4),d=0;d<f.length;d+=4){var m=f[d+0]/255,_=f[d+1]/255,p=f[d+2]/255,g=f[d+3],v=Math.pow(2,g-128);m*=v,_*=v,p*=v;var E=d;l[E+0]=m,l[E+1]=_,l[E+2]=p,l[E+3]=1}return{shape:[i,a],exposure:s,gamma:1,data:l}}},function(t,e,n){"use strict";n.r(e);var r=n(95),i=n.n(r),a=n(96),s=n.n(a),o=n(97),u=n.n(o),c=n(98),h=n.n(c);Object.assign||(Object.assign=i.a),Object.keys||(Object.keys=s.a),Object.values||(Object.values=u.a),"undefined"==typeof Promise&&(window.Promise=h.a),[Int8Array,Uint8Array,Int16Array,Uint16Array,Uint32Array,Float32Array].forEach((function(t){t.prototype.slice||Object.defineProperty(t.prototype,"slice",{value:function(e,n){return new t(Array.prototype.slice.call(this,e,n))}})}))},function(t,e,n){"use strict";(function(e,n){var r,i=function(){},a=void 0!==e&&void 0!==e.process&&"function"==typeof e.process.emit,s=void 0===n?setTimeout:n,o=[];function u(){for(var t=0;t<o.length;t++)o[t][0](o[t][1]);o=[],r=!1}function c(t,e){o.push([t,e]),r||(r=!0,s(u,0))}function h(t){var e=t.owner,n=e._state,r=e._data,i=t[n],a=t.then;if("function"==typeof i){n="fulfilled";try{r=i(r)}catch(t){m(a,t)}}f(a,r)||("fulfilled"===n&&l(a,r),"rejected"===n&&m(a,r))}function f(t,e){var n;try{if(t===e)throw new TypeError("A promises callback cannot return that same promise.");if(e&&("function"==typeof e||"object"==typeof e)){var r=e.then;if("function"==typeof r)return r.call(e,(function(r){n||(n=!0,e===r?d(t,r):l(t,r))}),(function(e){n||(n=!0,m(t,e))})),!0}}catch(e){return n||m(t,e),!0}return!1}function l(t,e){t!==e&&f(t,e)||d(t,e)}function d(t,e){"pending"===t._state&&(t._state="settled",t._data=e,c(p,t))}function m(t,e){"pending"===t._state&&(t._state="settled",t._data=e,c(g,t))}function _(t){t._then=t._then.forEach(h)}function p(t){t._state="fulfilled",_(t)}function g(t){t._state="rejected",_(t),!t._handled&&a&&e.process.emit("unhandledRejection",t._data,t)}function v(t){e.process.emit("rejectionHandled",t)}function E(t){if("function"!=typeof t)throw new TypeError("Promise resolver "+t+" is not a function");if(this instanceof E==!1)throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._then=[],function(t,e){function n(t){m(e,t)}try{t((function(t){l(e,t)}),n)}catch(t){n(t)}}(t,this)}E.prototype={constructor:E,_state:"pending",_then:null,_data:void 0,_handled:!1,then:function(t,e){var n={owner:this,then:new this.constructor(i),fulfilled:t,rejected:e};return!e&&!t||this._handled||(this._handled=!0,"rejected"===this._state&&a&&c(v,this)),"fulfilled"===this._state||"rejected"===this._state?c(h,n):this._then.push(n),n.then},catch:function(t){return this.then(null,t)}},E.all=function(t){if(!Array.isArray(t))throw new TypeError("You must pass an array to Promise.all().");return new E((function(e,n){var r=[],i=0;function a(t){return i++,function(n){r[t]=n,--i||e(r)}}for(var s,o=0;o<t.length;o++)(s=t[o])&&"function"==typeof s.then?s.then(a(o),n):r[o]=s;i||e(r)}))},E.race=function(t){if(!Array.isArray(t))throw new TypeError("You must pass an array to Promise.race().");return new E((function(e,n){for(var r,i=0;i<t.length;i++)(r=t[i])&&"function"==typeof r.then?r.then(e,n):e(r)}))},E.resolve=function(t){return t&&"object"==typeof t&&t.constructor===E?t:new E((function(e){e(t)}))},E.reject=function(t){return new E((function(e,n){n(t)}))},t.exports=E}).call(this,n(35),n(102).setImmediate)},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function a(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new a(i.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new a(i.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(103),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(35))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,a,s,o,u=1,c={},h=!1,f=t.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){m(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((a=new MessageChannel).port1.onmessage=function(t){m(t.data)},r=function(t){a.port2.postMessage(t)}):f&&"onreadystatechange"in f.createElement("script")?(i=f.documentElement,r=function(t){var e=f.createElement("script");e.onreadystatechange=function(){m(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(m,0,t)}:(s="setImmediate$"+Math.random()+"$",o=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&m(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",o,!1):t.attachEvent("onmessage",o),r=function(e){t.postMessage(s+e,"*")}),l.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var i={callback:t,args:e};return c[u]=i,r(u),u++},l.clearImmediate=d}function d(t){delete c[t]}function m(t){if(h)setTimeout(m,0,t);else{var e=c[t];if(e){h=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(void 0,n)}}(e)}finally{d(t),h=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(35),n(104))},function(t,e){var n,r,i=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(t){if(n===setTimeout)return setTimeout(t,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(t){n=a}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,c=[],h=!1,f=-1;function l(){h&&u&&(h=!1,u.length?c=u.concat(c):f=-1,c.length&&d())}function d(){if(!h){var t=o(l);h=!0;for(var e=c.length;e;){for(u=c,c=[];++f<e;)u&&u[f].run();f=-1,e=c.length}u=null,h=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function m(t,e){this.fun=t,this.array=e}function _(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new m(t,e)),1!==c.length||h||o(d)},m.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=_,i.addListener=_,i.once=_,i.off=_,i.removeListener=_,i.removeAllListeners=_,i.emit=_,i.prependListener=_,i.prependOnceListener=_,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){t.exports="#define GLSLIFY 1\n// modified from https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl#L26\n\n"+n(57)+"\n\nvec2 LTC_Uv(const in vec3 N, const in vec3 V, const in float roughness) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = (LUT_SIZE - 1.0) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = clamp(dot(N, V), 0.0, 1.0);\n vec2 uv = vec2(roughness, sqrt(1.0 - dotNV));\n uv = (uv * LUT_SCALE) + LUT_BIAS;\n return uv;\n}\n\nfloat LTC_ClippedSphereFormFactor(const in vec3 f) {\n float l = length(f);\n return max(((l * l) + f.z) / (l + 1.0), 0.0);\n}\n\nvec3 LTC_EdgeVectorFormFactor(const in vec3 v1, const in vec3 v2) {\n float x = dot(v1, v2);\n float y = abs(x);\n float a = 0.8543985 + ((0.4965155 + (0.0145206 * y)) * y);\n float b = 3.4175940 + ((4.1616724 + y) * y);\n float v = a / b;\n float theta_sintheta = x > 0.0 ? v : (0.5 * inversesqrt(max(1.0 - (x * x), 1e-7))) - v;\n return cross(v1, v2) * theta_sintheta;\n}\n\nvec3 LTC_Evaluate(const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[4]) {\n vec3 v1 = rectCoords[1] - rectCoords[0];\n vec3 v2 = rectCoords[3] - rectCoords[0];\n vec3 lightNormal = cross(v1, v2);\n if (dot(lightNormal, P - rectCoords[0]) < 0.0)\n return vec3(0.0);\n vec3 T1, T2;\n T1 = normalize(V - (N * dot(V, N)));\n T2 = -cross(N, T1);\n mat3 mat = mInv * transpose(mat3(T1, T2, N));\n vec3 coords[4];\n coords[0] = mat * (rectCoords[0] - P);\n coords[1] = mat * (rectCoords[1] - P);\n coords[2] = mat * (rectCoords[2] - P);\n coords[3] = mat * (rectCoords[3] - P);\n coords[0] = normalize(coords[0]);\n coords[1] = normalize(coords[1]);\n coords[2] = normalize(coords[2]);\n coords[3] = normalize(coords[3]);\n vec3 vectorFormFactor = vec3(0.0);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[0], coords[1]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[1], coords[2]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[2], coords[3]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[3], coords[0]);\n float result = LTC_ClippedSphereFormFactor(vectorFormFactor);\n return vec3(result);\n}\n\nvec3 getAreaLight(const in vec3 diffuseColor, const in vec3 specularColor, const in float roughness, const in vec3 normal, const in vec3 viewDir, const in vec3 position, const in vec3 lightPos, const in vec3 lightColor, const in vec3 halfWidth, const in vec3 halfHeight, const in sampler2D areaLightsLtcTexture1, const in sampler2D areaLightsLtcTexture2){\n vec3 rectCoords[4];\n rectCoords[0] = (lightPos - halfWidth) - halfHeight;\n rectCoords[1] = (lightPos + halfWidth) - halfHeight;\n rectCoords[2] = (lightPos + halfWidth) + halfHeight;\n rectCoords[3] = (lightPos - halfWidth) + halfHeight;\n \n vec2 uv = LTC_Uv(normal, viewDir, roughness);\n vec4 t1 = texture2D(areaLightsLtcTexture1, uv);\n vec4 t2 = texture2D(areaLightsLtcTexture2, uv);\n\n mat3 mInv = mat3(vec3(t1.x, 0, t1.y), vec3(0, 1, 0), vec3(t1.z, 0, t1.w));\n vec3 fresnel = (specularColor * t2.x) + ((vec3(1.0) - specularColor) * t2.y);\n \n vec3 color = vec3(0.0, 0.0, 0.0);\n color += ((lightColor * fresnel) * LTC_Evaluate(normal, viewDir, position, mInv, rectCoords));\n color += ((lightColor * diffuseColor) * LTC_Evaluate(normal, viewDir, position, mat3(1.0), rectCoords));\n return color;\n}\n\n"},function(t,e,n){"use strict";n.r(e),n.d(e,"util",(function(){return i})),n.d(e,"GLTFExtensions",(function(){return r})),n.d(e,"Class",(function(){return a.a})),n.d(e,"EventMixin",(function(){return s.a})),n.d(e,"Fog",(function(){return hr})),n.d(e,"Mesh",(function(){return _r})),n.d(e,"Node",(function(){return g})),n.d(e,"SkinedMesh",(function(){return Er})),n.d(e,"Skeleton",(function(){return Mr})),n.d(e,"Stage",(function(){return Wr})),n.d(e,"Tween",(function(){return mi})),n.d(e,"version",(function(){return Ar})),n.d(e,"BoxGeometry",(function(){return pi})),n.d(e,"Geometry",(function(){return Z})),n.d(e,"GeometryData",(function(){return b})),n.d(e,"MorphGeometry",(function(){return Zn})),n.d(e,"PlaneGeometry",(function(){return Mi})),n.d(e,"SphereGeometry",(function(){return Li})),n.d(e,"Camera",(function(){return O})),n.d(e,"PerspectiveCamera",(function(){return Q})),n.d(e,"OrthographicCamera",(function(){return fn})),n.d(e,"Buffer",(function(){return Nt})),n.d(e,"capabilities",(function(){return et})),n.d(e,"extensions",(function(){return tt})),n.d(e,"Framebuffer",(function(){return ce})),n.d(e,"glType",(function(){return Tt})),n.d(e,"logGLResource",(function(){return Oi})),n.d(e,"Program",(function(){return Lt})),n.d(e,"RenderInfo",(function(){return Lr})),n.d(e,"RenderList",(function(){return Rr})),n.d(e,"VertexArrayObject",(function(){return Ft})),n.d(e,"WebGLRenderer",(function(){return jr})),n.d(e,"WebGLResourceManager",(function(){return Nr})),n.d(e,"WebGLState",(function(){return yr})),n.d(e,"BasicLoader",(function(){return xi})),n.d(e,"CubeTextureLoader",(function(){return wi})),n.d(e,"GLTFLoader",(function(){return pa})),n.d(e,"GLTFParser",(function(){return ma})),n.d(e,"AliAMCExtension",(function(){return $n})),n.d(e,"HDRLoader",(function(){return Ia})),n.d(e,"KTXLoader",(function(){return Ra})),n.d(e,"LoadCache",(function(){return Ri})),n.d(e,"LoadQueue",(function(){return ya})),n.d(e,"ShaderMaterialLoader",(function(){return xa})),n.d(e,"TextureLoader",(function(){return ba})),n.d(e,"Loader",(function(){return bi})),n.d(e,"Texture",(function(){return Qt})),n.d(e,"LazyTexture",(function(){return Gi})),n.d(e,"CubeTexture",(function(){return pe})),n.d(e,"DataTexture",(function(){return Le})),n.d(e,"Shader",(function(){return dt})),n.d(e,"BasicMaterial",(function(){return en})),n.d(e,"GeometryMaterial",(function(){return cn})),n.d(e,"Material",(function(){return $e})),n.d(e,"PBRMaterial",(function(){return Di})),n.d(e,"semantic",(function(){return Ge})),n.d(e,"ShaderMaterial",(function(){return zn})),n.d(e,"AxisHelper",(function(){return Da})),n.d(e,"AxisNetHelper",(function(){return Ga})),n.d(e,"CameraHelper",(function(){return ja})),n.d(e,"AmbientLight",(function(){return za})),n.d(e,"AreaLight",(function(){return Ya})),n.d(e,"DirectionalLight",(function(){return Gn})),n.d(e,"CubeLightShadow",(function(){return Pn})),n.d(e,"Light",(function(){return M})),n.d(e,"LightManager",(function(){return Pr})),n.d(e,"LightShadow",(function(){return vn})),n.d(e,"PointLight",(function(){return Hn})),n.d(e,"SpotLight",(function(){return jn})),n.d(e,"Animation",(function(){return ea})),n.d(e,"AnimationStates",(function(){return $i})),n.d(e,"MeshPicker",(function(){return Qa})),n.d(e,"Ticker",(function(){return Ja})),n.d(e,"log",(function(){return m.a})),n.d(e,"Cache",(function(){return J})),n.d(e,"browser",(function(){return kr})),n.d(e,"WebGLSupport",(function(){return $a})),n.d(e,"constants",(function(){return P.a})),n.d(e,"Color",(function(){return ts.Color})),n.d(e,"Euler",(function(){return ts.Euler})),n.d(e,"EulerNotifier",(function(){return ts.EulerNotifier})),n.d(e,"Frustum",(function(){return ts.Frustum})),n.d(e,"math",(function(){return ts.math})),n.d(e,"Matrix3",(function(){return ts.Matrix3})),n.d(e,"Matrix4",(function(){return ts.Matrix4})),n.d(e,"Matrix4Notifier",(function(){return ts.Matrix4Notifier})),n.d(e,"Plane",(function(){return ts.Plane})),n.d(e,"Quaternion",(function(){return ts.Quaternion})),n.d(e,"Ray",(function(){return ts.Ray})),n.d(e,"Sphere",(function(){return ts.Sphere})),n.d(e,"SphericalHarmonics3",(function(){return ts.SphericalHarmonics3})),n.d(e,"Vector2",(function(){return ts.Vector2})),n.d(e,"Vector3",(function(){return ts.Vector3})),n.d(e,"Vector3Notifier",(function(){return ts.Vector3Notifier})),n.d(e,"Vector4",(function(){return ts.Vector4}));var r={};n.r(r),n.d(r,"ALI_amc_mesh_compression",(function(){return $n})),n.d(r,"WEB3D_quantized_attributes",(function(){return er})),n.d(r,"HILO_animation_clips",(function(){return nr})),n.d(r,"ALI_animation_clips",(function(){return rr})),n.d(r,"ALI_bounding_box",(function(){return ir})),n.d(r,"KHR_materials_pbrSpecularGlossiness",(function(){return ar})),n.d(r,"KHR_materials_clearcoat",(function(){return sr})),n.d(r,"KHR_lights_punctual",(function(){return or})),n.d(r,"KHR_techniques_webgl",(function(){return ur}));var i=n(4),a=n(1),s=n(9),o=n(7),u=n(21),c=n(5),h=n(17),f=n(22),l=n(10),d=n(6),m=n(3),_=new c.a(0,1,0),p=new o.a,g=a.a.create({Statics:{TRAVERSE_STOP_NONE:!1,TRAVERSE_STOP_CHILDREN:1,TRAVERSE_STOP_ALL:!0},Mixes:s.a,isNode:!0,className:"Node",name:"",anim:null,animationId:"",jointName:"",autoUpdateWorldMatrix:!0,autoUpdateChildWorldMatrix:!0,parent:null,_quatDirty:!1,_matrixDirty:!1,needCallChildUpdate:!0,visible:!0,pointerEnabled:!0,pointerChildren:!0,useHandCursor:!1,userData:null,onUpdate:null,__forceUseParentWorldMatrix:!1,constructor:function(t){var e=this;this.id=d.a.generateUUID(this.className),this.up=_.clone(),this.children=[],this.worldMatrix=new o.a,this._matrix=new u.a,this._position=new h.a(0,0,0),this._scale=new h.a(1,1,1),this._pivot=new h.a(0,0,0),this._rotation=new f.a,this._quaternion=new l.a,this._matrix.on("update",(function(){e._onMatrixUpdate()})),this._position.on("update",(function(){e._onPositionUpdate()})),this._scale.on("update",(function(){e._onScaleUpdate()})),this._pivot.on("update",(function(){e._onPivotUpdate()})),this._rotation.on("update",(function(){e._onRotationUpdate()})),this._quaternion.on("update",(function(){e._onQuaternionUpdate()})),Object.assign(this,t)},clone:function(t){var e=new this.constructor;return e.name=this.name,e.jointName=this.jointName,e.animationId=this.animationId,e.setPosition(this.x,this.y,this.z),e.setScale(this.scaleX,this.scaleY,this.scaleZ),e.setRotation(this.rotationX,this.rotationY,this.rotationZ),this.children.forEach((function(t){e.addChild(t.clone(!0))})),t||(this.anim&&(e.anim=this.anim.clone(e)),e.resetSkinedMeshRootNode()),e},setAnim:function(t){return this.anim=t,t.rootNode=this,this},resetSkinedMeshRootNode:function(){var t=this;this.traverse((function(e){e.isSkinedMesh&&e.skeleton&&(e.skeleton.rootNode=t)}),!0)},getChildrenNameMap:function(){var t={};return this.traverse((function(e){t[e.name]=e;var n=e._originName;void 0===n||t[n]||(t[n]=e)}),!0),t},addChild:function(t){return t.parent&&t.removeFromParent(),t.parent=this,this.children.push(t),this},removeChild:function(t){var e=this.children.indexOf(t);return e>-1&&(this.children.splice(e,1),t.parent=null),this},addTo:function(t){return t.addChild(this),this},removeFromParent:function(){return this.parent&&this.parent.removeChild(this),this},updateMatrix:function(){return this._matrixDirty&&(this._matrixDirty=!1,this.matrixVersion++,this._matrix.fromRotationTranslationScaleOrigin(this.quaternion,this._position,this._scale,this._pivot,!0)),this},updateQuaternion:function(){return this._quatDirty&&(this._quatDirty=!1,this._quaternion.fromEuler(this._rotation,!0)),this},updateTransform:function(){return this._matrix.decompose(this._quaternion,this._position,this._scale,this._pivot),this._onQuaternionUpdate(),this._matrixDirty=!1,this},updateMatrixWorld:function(t){return this.traverse((function(e){return(e.autoUpdateWorldMatrix||t)&&(e.parent?e.__forceUseParentWorldMatrix?e.worldMatrix.copy(e.parent.worldMatrix):e.worldMatrix.multiply(e.parent.worldMatrix,e.matrix):e.worldMatrix.copy(e.matrix)),!e.autoUpdateChildWorldMatrix&&!t&&1})),this},getConcatenatedMatrix:function(t){for(var e=new o.a,n=this;n&&n!==t;n=n.parent)e.multiply(n.matrix,e);return e},_traverse:function(t,e){if(!e){var n=t(this);if(n)return n}for(var r=this.children,i=0,a=r.length;i<a;i++){var s=r[i]._traverse(t,!1);if(!0===s)return s}return!1},traverse:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._traverse(t,e),this},traverseBFS:function(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(n=r?this.children:[this];n.length;){e=n,n=[];for(var i=0,a=e.length;i<a;i++){var s=e[i],o=t(s);if(o){if(!0===o)return this}else n=n.concat(s.children)}}return this},getChildByFnBFS:function(t){var e=null;return this.traverseBFS((function(n){return!!t(n)&&(e=n,!0)}),!0),e},getChildByNamePath:function(t){for(var e=this,n=function(n,r){var i=t[n],a=e.getChildByFnBFS((function(t){return t.name===i}));if(!a)return{v:null};e=a},r=0,i=t.length;r<i;r++){var a=n(r);if("object"==typeof a)return a.v}return e},traverseUpdate:function(t){return this.traverse((function(e){return e.onUpdate&&e.onUpdate(t),!e.needCallChildUpdate&&1})),this},getChildByFn:function(t){var e=null;return this.traverse((function(n){return!!t(n)&&(e=n,!0)}),!0),e},getChildrenByFn:function(t){var e=[];return this.traverse((function(n){t(n)&&e.push(n)}),!0),e},getChildByName:function(t){return this.getChildByFn((function(e){return e.name===t}))},getChildrenByName:function(t){return this.getChildrenByFn((function(e){return e.name===t}))},getChildById:function(t){return this.getChildByFn((function(e){return e.id===t}))},getChildrenByClassName:function(t){return this.getChildrenByFn((function(e){return e.className===t}))},getChildrenByBaseClassName:function(t){return this.getChildrenByFn((function(e){return e["is"+t]}))},setScale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;return this._scale.set(t,e,n),this},setPosition:function(t,e,n){return this._position.set(t,e,n),this},setRotation:function(t,e,n){return this._rotation.setDegree(t,e,n),this},setPivot:function(t,e,n){return this._pivot.set(t,e,n),this},lookAt:function(t){return this.isCamera?p.targetTo(this,t,this.up):p.targetTo(t,this,this.up),this._quaternion.fromMat4(p),this},raycast:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!this.visible)return null;var i=[];return this.traverse((function(n){if(r&&!n.pointerEnabled)return 1;if(n.isMesh){var a=n.raycast(t,!1);a&&(i=i.concat(a.map((function(t){return{mesh:n,point:t}}))))}return!(!r||e.pointerChildren)&&1})),i.length?(n&&t.sortPoints(i,"point"),i):null},matrix:{get:function(){return this.updateMatrix(),this._matrix},set:function(t){m.a.warnOnce("Node.matrix.set","node.matrix is readOnly.Use node.matrix.copy instead."),this._matrix.copy(t)}},position:{get:function(){return this._position},set:function(t){m.a.warnOnce("Node.position.set","node.position is readOnly.Use node.position.copy instead."),this._position.copy(t)}},x:{get:function(){return this._position.elements[0]},set:function(t){this._position.elements[0]=t,this._matrixDirty=!0}},y:{get:function(){return this._position.elements[1]},set:function(t){this._position.elements[1]=t,this._matrixDirty=!0}},z:{get:function(){return this._position.elements[2]},set:function(t){this._position.elements[2]=t,this._matrixDirty=!0}},scale:{get:function(){return this._scale},set:function(t){m.a.warnOnce("Node.scale.set","node.scale is readOnly.Use node.scale.copy instead."),this._scale.copy(t)}},scaleX:{get:function(){return this._scale.elements[0]},set:function(t){this._scale.elements[0]=t,this._matrixDirty=!0}},scaleY:{get:function(){return this._scale.elements[1]},set:function(t){this._scale.elements[1]=t,this._matrixDirty=!0}},scaleZ:{get:function(){return this._scale.elements[2]},set:function(t){this._scale.elements[2]=t,this._matrixDirty=!0}},pivot:{get:function(){return this._pivot},set:function(t){m.a.warnOnce("Node.pivot.set","node.pivot is readOnly.Use node.pivot.copy instead."),this._pivot.copy(t)}},pivotX:{get:function(){return this._pivot.elements[0]},set:function(t){this._pivot.elements[0]=t,this._matrixDirty=!0}},pivotY:{get:function(){return this._pivot.elements[1]},set:function(t){this._pivot.elements[1]=t,this._matrixDirty=!0}},pivotZ:{get:function(){return this._pivot.elements[2]},set:function(t){this._pivot.elements[2]=t,this._matrixDirty=!0}},rotation:{get:function(){return this._rotation},set:function(t){m.a.warnOnce("Node.rotation.set","node.rotation is readOnly.Use node.rotation.copy instead."),this._rotation.copy(t)}},rotationX:{get:function(){return this._rotation.degX},set:function(t){this._rotation.degX=t}},rotationY:{get:function(){return this._rotation.degY},set:function(t){this._rotation.degY=t}},rotationZ:{get:function(){return this._rotation.degZ},set:function(t){this._rotation.degZ=t}},quaternion:{get:function(){return this.updateQuaternion(),this._quaternion},set:function(t){m.a.warnOnce("Node.quaternion.set","node.quaternion is readOnly.Use node.quaternion.copy instead."),this._quaternion.copy(t)}},matrixVersion:0,getBounds:function(t,e,n){return e?e.multiply(this.matrix):e=this.getConcatenatedMatrix(t),this.children.forEach((function(t){n=t.getBounds(null,e.clone(),n)})),this.isMesh&&(n=this.geometry.getBounds(e,n)),n},_fireMouseEvent:function(t){if(t.eventCurrentTarget=this,this.fire(t),"mousemove"===t.type){if(!this.__mouseOver){this.__mouseOver=!0;var e=Object.assign({},t);e.type="mouseover",this.fire(e)}}else"mouseout"===t.type&&(this.__mouseOver=!1);var n=this.parent;t._stopped||t._stopPropagationed||!n||n._fireMouseEvent(t)},destroy:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getChildrenByBaseClassName("Node");return this.off(),n.forEach((function(n){n.isMesh?n.destroy(t,e):(n.off(),n.removeFromParent())})),this.removeFromParent(),this},_onMatrixUpdate:function(){this.matrixVersion++,this.updateTransform()},_onPositionUpdate:function(){this._matrixDirty=!0},_onScaleUpdate:function(){this._matrixDirty=!0},_onPivotUpdate:function(){this._matrixDirty=!0},_onRotationUpdate:function(){this._quatDirty=!0,this._matrixDirty=!0},_onQuaternionUpdate:function(){this._rotation.fromQuat(this._quaternion),this._quatDirty=!1}}),v=n(8),E=new v.a,T=a.a.create({Extends:g,isLight:!0,className:"Light",amount:1,enabled:!0,constantAttenuation:1,linearAttenuation:0,quadraticAttenuation:0,_range:0,range:{get:function(){return this._range},set:function(t){this.constantAttenuation=1,t<=0?(this.linearAttenuation=0,this.quadraticAttenuation=0):(this.linearAttenuation=4.5/t,this.quadraticAttenuation=75/(t*t)),this._range=t}},shadow:null,isDirty:!1,constructor:function(t){this.color=new v.a(1,1,1),T.superclass.constructor.call(this,t)},toInfoArray:function(t,e){return t[e+0]=this.constantAttenuation,t[e+1]=this.linearAttenuation,t[e+2]=this.quadraticAttenuation,this},getRealColor:function(){return E.copy(this.color).scale(this.amount)},createShadowMap:function(t,e){}}),M=T,A=n(23),L=new o.a,I=a.a.create({Extends:g,isCamera:!0,className:"Camera",_needUpdateProjectionMatrix:!0,_isGeometryDirty:!1,constructor:function(t){this.viewMatrix=new o.a,this.projectionMatrix=new o.a,this.viewProjectionMatrix=new o.a,this._frustum=new A.a,I.superclass.constructor.call(this,t)},updateViewMatrix:function(){return this.updateMatrixWorld(!0),this.viewMatrix.invert(this.worldMatrix),this},updateProjectionMatrix:function(){},getGeometry:function(t){},updateViewProjectionMatrix:function(){return this._needUpdateProjectionMatrix&&(this.updateProjectionMatrix(),this._needUpdateProjectionMatrix=!1),this.updateViewMatrix(),this.viewProjectionMatrix.multiply(this.projectionMatrix,this.viewMatrix),this.updateFrustum(this.viewProjectionMatrix),this},getModelViewMatrix:function(t,e){return(e=e||new o.a).multiply(this.viewMatrix,t.worldMatrix),e},getModelProjectionMatrix:function(t,e){return(e=e||new o.a).multiply(this.viewProjectionMatrix,t.worldMatrix),e},projectVector:function(t,e,n){var r=t.clone();return r.transformMat4(this.viewProjectionMatrix),e&&n&&(r.x=(r.x+1)/2*e,r.y=n-(r.y+1)/2*n),r},unprojectVector:function(t,e,n){var r=t.clone();return e&&n&&(r.x=r.x/e*2-1,r.y=1-r.y/n*2),L.invert(this.viewProjectionMatrix),r.transformMat4(L),r},isPointVisible:function(t){return!!this._frustum.intersectsSphere({center:t,radius:0})},isMeshVisible:function(t){var e=t.geometry;if(e){var n=e.getSphereBounds(t.worldMatrix);if(this._frustum.intersectsSphere(n))return!0}return!1},updateFrustum:function(t){return this._frustum.fromMatrix(t),this}}),O=I,S=n(14),R=n(12),y=n(11),N=n(20),x={2:new S.a,3:new c.a,4:new R.a,16:new o.a},C=a.a.create({className:"GeometryData",isGeometryData:!0,size:void 0,normalized:!1,type:void 0,_isSubDirty:!1,_isAllDirty:!1,isDirty:{get:function(){return this._isSubDirty||this._isAllDirty},set:function(t){this._isAllDirty=t,!1===t&&this.clearSubData()}},bufferViewId:void 0,glBuffer:null,constructor:function(t,e,n){this.id=d.a.generateUUID(this.className),this.data=t,this.size=e,Object.assign(this,n),this.bufferViewId||(this.bufferViewId=this.id),this.size||m.a.warn("GeometryData.constructor: geometryData must set size!",this)},_stride:0,stride:{get:function(){return this._stride},set:function(t){this._stride=t,this.strideSize=0===t?0:t/this.data.BYTES_PER_ELEMENT}},strideSize:0,_offset:0,offset:{get:function(){return this._offset},set:function(t){this._offset=t,this.offsetSize=t/this.data.BYTES_PER_ELEMENT}},offsetSize:0,data:{set:function(t){t&&(this._data=t,this.type=Object(i.getTypedArrayGLType)(t),this.stride=this._stride,this.offset=this._offset,this._isAllDirty=!0)},get:function(){return this._data}},length:{get:function(){return this._data.length}},realLength:{get:function(){return 0===this.strideSize?this._data.length:this._data.length/this.strideSize*this.size}},getByteLength:function(){return this._data.BYTES_PER_ELEMENT*this.realLength},count:{get:function(){return 0===this.strideSize?this._data.length/this.size:this._data.length/this.strideSize}},setSubData:function(t,e){this._isSubDirty=!0,this.data.set(e,t),this.subDataList||(this.subDataList=[]);var n=e.BYTES_PER_ELEMENT*t;this.subDataList.push({byteOffset:n,data:e})},clearSubData:function(){this.subDataList&&(this.subDataList.length=0),this._isSubDirty=!1},clone:function(){var t=new C(null,1);return t.copy(this),t},copy:function(t){var e=t.data;this.data=new e.constructor(e),this.size=t.size,this.stride=t.stride,this.normalized=t.normalized,this.type=t.type,this.offset=t.offset},getOffset:function(t){var e=this.strideSize;return 0===e?t*this.size:t*e+this.offsetSize},get:function(t){var e=this.getOffset(t);return this.getByOffset(e)},getCopy:function(t){return this.get(t).clone()},set:function(t,e){var n=this.getOffset(t);return this.setByOffset(n,e),n},getByOffset:function(t){var e=this.size;return e>1?x[e].fromArray(this._data,t):this._data[t]},setByOffset:function(t,e){var n=this.size,r=this._data;n>1?e.toArray(r,t):r[t]=e,this._isAllDirty=!0},traverse:function(t){for(var e=this.count,n=0;n<e;n++){var r=this.getOffset(n);if(t(this.getByOffset(r),n,r))return!0}return!1},traverseByComponent:function(t){for(var e=this.count,n=this.size,r=this._data,i=0;i<e;i++)for(var a=this.getOffset(i),s=i*n,o=0;o<n;o++){var u=a+o;if(t(r[u],s+o,u))return!0}return!1},merge:function(t,e){if(t.type!==this.type||t.size!==this.size)return m.a.warn("geometryData type or size not same, cannot merge!",this,t),this;var n=Object(i.getTypedArrayClass)(this.type),r=this.realLength,a=t.realLength,s=new n(r+a);return this.traverseByComponent((function(t,e){s[e]=t})),t.traverseByComponent((function(t,n){e&&(t=e(t,n)),s[r+n]=t})),this.stride=0,this.offset=0,this.data=s,this}}),b=C,P=n(2),w=P.a.TRIANGLES,H=P.a.LINES,D=P.a.FRONT,F=P.a.BACK,U=P.a.FRONT_AND_BACK,G=new c.a,B=new c.a,V=new c.a,X=new R.a,j=new S.a,k=new S.a,z=new S.a,W=new y.a,Y=new o.a,q=new l.a,Z=a.a.create({isGeometry:!0,className:"Geometry",vertices:null,uvs:null,uvs1:null,colors:null,indices:null,skinIndices:null,skinWeights:null,mode:w,isStatic:!0,isDirty:!0,useAABBRaycast:!1,userData:null,constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t),this.currentVerticesCount=0,this.currentIndicesCount=0},_needUpdateNormals:!1,normals:{get:function(){return!this._needUpdateNormals&&this._normals||this.calculateNormals(),this._normals},set:function(t){this._normals=t,this._needUpdateNormals=!1}},calculateNormals:function(){var t=this.vertices;if(t){this._normals||(this._normals=new b(new Float32Array(t.realLength),3));var e,n=this._normals;if(this.indices)e=this.indices.data;else{var r=t.length/3;e=new Array(r);for(var i=0;i<r;i++)e[i]=i}for(var a=0,s=new Uint8Array(t.count),o=0;o<e.length;o+=3){a=e[o],G.copy(t.get(a)),a=e[o+1],B.copy(t.get(a)),a=e[o+2],V.copy(t.get(a)),B.sub(G),V.sub(G),B.cross(V);for(var u=0;u<3;u++){if(s[a=e[o+u]]){var c=n.get(a);c.scale(s[a]),c.add(B),c.scale(1/(s[a]+1)),n.set(a,c)}else n.set(a,B);s[a]++}}this.isDirty=!0,this._needUpdateNormals=!1}else m.a.warnOnce("geometry.calculateNormals","geometry.calculateNormals error:no vertices data.")},tangents:{get:function(){return this._tangents||this.calculateTangents(this.uvs,"_tangents"),this._tangents},set:function(t){this._tangents=t}},tangents1:{get:function(){return this._tangents1||this.calculateTangents(this.uvs1,"_tangents1"),this._tangents1},set:function(t){this._tangents1=t}},calculateTangents:function(t,e){var n=this.vertices;if(n){this[e]||(this[e]=new b(new Float32Array(4*n.count),4));var r,i=this[e];if(this.indices)r=this.indices.data;else{var a=n.length/3;r=new Array(a);for(var s=0;s<a;s++)r[s]=s}for(var o=0,u=0;u<r.length;u+=3){o=r[u],G.copy(n.get(o)),j.copy(t.get(o)),o=r[u+1],B.copy(n.get(o)),k.copy(t.get(o)),o=r[u+2],V.copy(n.get(o)),z.copy(t.get(o)),B.sub(G),V.sub(G),k.sub(j),z.sub(j);var c=1/(k.x*z.y-z.x*k.y);Number.isFinite(c)?(G.x=c*(z.y*B.x-k.y*V.x),G.y=c*(z.y*B.y-k.y*V.y),G.z=c*(z.y*B.z-k.y*V.z)):(G.x=0,G.y=0,G.z=1),X.set(G.x,G.y,G.z,1),i.set(r[u],X),i.set(r[u+1],X),i.set(r[u+2],X)}this.isDirty=!0}else m.a.warnOnce("geometry.calculateTangents","geometry.calculateTangents error:no vertices data.")},convertToLinesMode:function(){if(this.mode===w)if(this.indices){for(var t=new Uint16Array(2*this.indices.length),e=this.indices.data,n=0;n<e.length;n+=3)t[2*n]=e[n],t[2*n+1]=e[n+1],t[2*n+2]=e[n+1],t[2*n+3]=e[n+2],t[2*n+4]=e[n+2],t[2*n+5]=e[n];this.indices.data=t,this.mode=H}else m.a.warn("Has no indices!");else m.a.warn("Only support convert triangles to lines mode!")},translate:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.transformMat4(Y.fromTranslation(G.set(t,e,n))),this},scale:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return this.transformMat4(Y.fromScaling(G.set(t,e,n))),this},rotate:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.transformMat4(Y.fromQuat(q.fromEuler({x:t*d.a.DEG2RAD,y:e*d.a.DEG2RAD,z:n*d.a.DEG2RAD}))),this},transformMat4:function(t){var e=this.vertices;if(e&&e.traverse((function(n,r,i){e.setByOffset(i,n.transformMat4(t))})),W.normalFromMat4(t),this._normals){var n=this.normals;n.traverse((function(t,e,r){n.setByOffset(r,t.transformMat3(W).normalize())}))}if(this._tangents){var r=this.tangents;r.traverse((function(t,e,n){r.setByOffset(n,t.transformMat3(W).normalize())}))}return this.isDirty=!0,this},merge:function(t,e){var n=t.vertices;if(n&&this.vertices){var r=this.vertices.count;e&&(n=t.vertices.clone()).traverse((function(t,r,i){n.setByOffset(i,t.transformMat4(e))})),this.vertices.merge(n),this.indices&&t.indices?this.indices.merge(t.indices,(function(t){return t+r})):this.indices=null}return this.uvs&&t.uvs?this.uvs.merge(t.uvs):this.uvs=null,this.uvs1&&t.uvs1?this.uvs1.merge(t.uvs1):this.uvs1=null,this.colors&&t.colors?this.colors.merge(t.colors):this.colors=null,this._normals&&(this._normals=null),this._tangents&&(this._tangents=null),this._tangents1&&(this._tangents1=null),this.isDirty=!0,this},ensureData:function(t,e,n,r){var i=this[t];if(!i||n>i.length){var a=new r(n);i?(a.set(i.data),i.data=a):this[t]=new b(a,e)}},addPoints:function(){var t=this,e=[].slice.call(arguments),n=3*(this.currentVerticesCount+e.length);this.ensureData("vertices",3,n,Float32Array);var r=this.vertices.data;return e.forEach((function(e){var n=3*t.currentVerticesCount++;r[n]=e[0],r[n+1]=e[1],r[n+2]=e[2]})),this.currentVerticesCount-e.length},addIndices:function(){var t=this,e=[].slice.call(arguments),n=this.currentIndicesCount+e.length;this.ensureData("indices",1,n,Uint16Array);var r=this.indices.data;e.forEach((function(e){r[t.currentIndicesCount++]=e})),this._needUpdateNormals=!0},addLine:function(t,e){var n=this.addPoints(t,e);this.addIndices(n,n+1)},addFace:function(t,e,n){var r=this.addPoints(t,e,n);this.addIndices(r,r+1,r+2)},addRect:function(t,e,n,r){var i=this.addPoints(t,e,n,r);this.addIndices(i,i+1,i+2,i,i+2,i+3)},setVertexUV:function(t,e){this.ensureData("uvs",2,this.vertices.length/3*2,Float32Array);for(var n=this.uvs.data,r=0;r<e.length;r++)n[t+2*r]=e[r][0],n[t+2*r+1]=e[r][1]},setFaceUV:function(t,e,n,r){this.setVertexUV(t,[e,n,r])},setRectUV:function(t,e,n,r,i){this.setVertexUV(t,[e,n,r,i])},getBounds:function(t,e){e||(e={xMin:1/0,xMax:-1/0,yMin:1/0,yMax:-1/0,zMin:1/0,zMax:-1/0});var n=this.vertices;return n?(n.traverse((function(n){t&&n.transformMat4(t),e.xMax=Math.max(e.xMax,n.x),e.yMax=Math.max(e.yMax,n.y),e.zMax=Math.max(e.zMax,n.z),e.xMin=Math.min(e.xMin,n.x),e.yMin=Math.min(e.yMin,n.y),e.zMin=Math.min(e.zMin,n.z)})),e.width=e.xMax-e.xMin,e.height=e.yMax-e.yMin,e.depth=e.zMax-e.zMin,e.x=(e.xMin+e.xMax)/2,e.y=(e.yMin+e.yMax)/2,e.z=(e.zMin+e.zMax)/2,e):(m.a.warnOnce("geometry.getBounds","geometry has no vertices data, geometry.getBounds will return Infinity bounds."),e)},getLocalBounds:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._localBounds&&!t||(this._localBounds=this.getBounds()),this._localBounds},getSphereBounds:function(t){this._sphereBounds||(this._sphereBounds=new N.a);var e=this._sphereBounds;return e.copy(this.getLocalSphereBounds()),t&&e.transformMat4(t),e},getLocalSphereBounds:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._localSphereBounds||t){var e=this.getLocalBounds(t),n=new N.a({center:new c.a(e.x,e.y,e.z)}),r=this.vertices;r?n.fromGeometryData(r):(m.a.warnOnce("geometry.getLocalSphereBounds","geometry has no vertices data, geometry.getLocalSphereBounds will return Infinity bounds."),n.radius=1/0),this._localSphereBounds=n}return this._localSphereBounds},convertToNoIndices:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(this.mode===w)if(this.indices){for(var e=this.indices.data,n=e.length,r=new Float32Array(n*t),a=this.uvs?new Float32Array(2*n):null,s=new Float32Array(3*n),o=this.colors?new Float32Array(this.colors.size*n):null,u=this.skinIndices?new Float32Array(4*n):null,c=this.skinWeights?new Float32Array(4*n):null,h=0;h<n;h++){var f=e[h];Object(i.copyArrayData)(r,this.vertices,h*t,3*f,3),4===t&&(r[4*h+3]=1),Object(i.copyArrayData)(a,this.uvs,2*h,2*f,2),Object(i.copyArrayData)(s,this.normals,3*h,3*f,3),Object(i.copyArrayData)(u,this.skinIndices,4*h,4*f,4),Object(i.copyArrayData)(c,this.skinWeights,4*h,4*f,4),this.colors&&Object(i.copyArrayData)(o,this.colors,h*this.colors.size,f*this.colors.size,this.colors.size)}delete this.indices,this.vertices.data=r,this.uvs&&(this.uvs.data=a),this.normals&&(this.normals.data=s),this.colors&&(this.colors.data=o),this.skinIndices&&(this.skinIndices.data=u),this.skinWeights&&(this.skinWeights.data=c)}else m.a.warn("Has no indices!");else m.a.warn("Only support convert triangles to lines mode!")},clone:function(){var t=new this.constructor({mode:this.mode});return this.vertices&&(t.vertices=this.vertices.clone()),this.uvs&&(t.uvs=this.uvs.clone()),this.uvs1&&(t.uvs1=this.uvs1.clone()),this.colors&&(t.colors=this.colors.clone()),this.indices&&(t.indices=this.indices.clone()),this.skinWeights&&(t.skinWeights=this.skinWeights.clone()),this.skinIndices&&(t.skinIndices=this.skinIndices.clone()),this._normals&&(t._normals=this._normals.clone()),this._tangents&&(t._tangents=this._tangents.clone()),this._tangents1&&(t._tangents1=this._tangents1.clone()),this.positionDecodeMat&&(t.positionDecodeMat=this.positionDecodeMat),this.uvDecodeMat&&(t.uvDecodeMat=this.uvDecodeMat),this.uv1DecodeMat&&(t.uv1DecodeMat=this.uv1DecodeMat),this.normalDecodeMat&&(t.normalDecodeMat=this.normalDecodeMat),t},_aabbRaycast:function(t){var e=this.getLocalBounds(),n=t.intersectsBox([[e.xMin,e.yMin,e.zMin],[e.xMax,e.yMax,e.zMax]]);return n?[n]:null},_raycast:function(t,e){var n=this.vertices;if(!n)return null;var r,i=this.indices,a=[],s=[];r=i?i.realLength:n.realLength/3;for(var o=0;o<r;o+=3){var u=i?i.get(o):o;G.copy(n.get(u)),u=i?i.get(o+1):o+1,B.copy(n.get(u)),u=i?i.get(o+2):o+2,V.copy(n.get(u));var c=void 0;e===D?(a[0]=G.elements,a[1]=B.elements,a[2]=V.elements,c=t.intersectsTriangle(a)):e===F?(a[1]=G.elements,a[0]=B.elements,a[2]=V.elements,c=t.intersectsTriangle(a)):e===U&&(a[0]=G.elements,a[1]=B.elements,a[2]=V.elements,(c=t.intersectsTriangle(a))||(a[1]=G.elements,a[0]=B.elements,a[2]=V.elements,c=t.intersectsTriangle(a))),c&&s.push(c)}return s.length?s:null},raycast:function(t,e){var n,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return(n=this.useAABBRaycast?this._aabbRaycast(t):this._raycast(t,e))&&r&&t.sortPoints(n),n},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.positionDecodeMat&&(t.QUANTIZED=1,t.POSITION_QUANTIZED=1),this.normalDecodeMat&&(t.QUANTIZED=1,t.NORMAL_QUANTIZED=1),this.uvDecodeMat&&(t.QUANTIZED=1,t.UV_QUANTIZED=1),this.uv1DecodeMat&&(t.QUANTIZED=1,t.UV1_QUANTIZED=1),this.colors&&(t.HAS_COLOR=1,t.COLOR_SIZE=this.colors.size),t},getShaderKey:function(){return void 0===this._shaderKey&&(this._shaderKey="geometry",this.isMorphGeometry?this._shaderKey+="_id_".concat(this.id):(this.colors&&(this._shaderKey+="_colors"),this.positionDecodeMat&&(this._shaderKey+="positionDecodeMat"))),this._shaderKey},getSize:function(){var t=0;for(var e in this)Object(i.hasOwnProperty)(this,e)&&this[e]&&this[e].isGeometryData&&(t+=this[e].getByteLength());return t},destroy:function(){m.a.warn("Geometry.destroy has been deprecated, use mesh.destroy(renderer) instead.")}}),K=a.a.create({Extends:O,isPerspectiveCamera:!0,className:"PerspectiveCamera",_near:.1,near:{get:function(){return this._near},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._near=t}},_far:null,far:{get:function(){return this._far},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._far=t}},_fov:50,fov:{get:function(){return this._fov},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._fov=t}},_aspect:1,aspect:{get:function(){return this._aspect},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._aspect=t}},constructor:function(t){K.superclass.constructor.call(this,t),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.projectionMatrix.elements,e=this.near,n=this.far,r=this.aspect,i=this.fov,a=1/Math.tan(.5*d.a.degToRad(i));if(t[0]=a/r,t[5]=a,t[11]=-1,t[15]=0,n){var s=1/(e-n);t[10]=(e+n)*s,t[14]=2*n*e*s}else t[10]=-1,t[14]=-2*e},getGeometry:function(t){if(t||!this._geometry||this._isGeometryDirty){this._isGeometryDirty=!1;var e=new Z,n=Math.tan(this.fov/2*Math.PI/180),r=this.near,i=this.far,a=r*n,s=i*n,o=this.aspect*a,u=this.aspect*s,c=[-o,-a,-r],h=[o,-a,-r],f=[o,a,-r],l=[-o,a,-r],d=[-u,-s,-i],m=[u,-s,-i],_=[u,s,-i],p=[-u,s,-i];e.addRect(d,m,_,p),e.addRect(m,h,f,_),e.addRect(h,c,l,f),e.addRect(c,d,p,l),e.addRect(p,_,f,l),e.addRect(c,h,m,d),this._geometry=e}return this._geometry}}),Q=K,J=a.a.create({constructor:function(){this._cache={}},get:function(t){return this._cache[t]},getObject:function(t){return this._cache[t.__cacheId]},add:function(t,e){"object"==typeof e&&(e.__cacheId=t),this._cache[t]=e},remove:function(t){delete this._cache[t]},removeObject:function(t){delete this._cache[t.__cacheId]},removeAll:function(){this._cache={}},each:function(t){var e=this._cache;for(var n in e)t(e[n],n)}}),$={instanced:void 0,vao:void 0,texFloat:void 0,loseContext:void 0,textureFilterAnisotropic:void 0,_usedExtensions:{},_disabledExtensions:{},init:function(t){this.reset(t)},reset:function(t){this.gl=t;var e=this._usedExtensions;for(var n in e){var r=e[n];this[r]=void 0,this.get(n,r)}},use:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;this.gl?this.get(t,e):this._usedExtensions[t]=e},get:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(this._disabledExtensions[t])return null;var n=this[e];return void 0===n&&(n=this._getExtension(t),this[e]=n),n},disable:function(t){this._disabledExtensions[t]=!0},enable:function(t){this._disabledExtensions[t]=!1},_getExtension:function(t){var e=this.gl;return e&&e.getExtension&&(e.getExtension(t)||e.getExtension("WEBKIT_"+t)||e.getExtension("MOZ_"+t))||null}};$.use("ANGLE_instanced_arrays","instanced"),$.use("OES_vertex_array_object","vao"),$.use("OES_texture_float","texFloat"),$.use("WEBGL_lose_context","loseContext"),$.use("OES_element_index_uint","uintIndices"),$.use("EXT_shader_texture_lod","shaderTextureLod"),$.use("EXT_texture_filter_anisotropic","textureFilterAnisotropic");var tt=$,et={MAX_TEXTURE_INDEX:null,MAX_PRECISION:null,MAX_VERTEX_PRECISION:null,MAX_FRAGMENT_PRECISION:null,VERTEX_TEXTURE_FLOAT:null,FRAGMENT_TEXTURE_FLOAT:null,MAX_TEXTURE_MAX_ANISOTROPY:1,MAX_RENDERBUFFER_SIZE:void 0,MAX_COMBINED_TEXTURE_IMAGE_UNITS:void 0,MAX_CUBE_MAP_TEXTURE_SIZE:void 0,MAX_FRAGMENT_UNIFORM_VECTORS:void 0,MAX_TEXTURE_IMAGE_UNITS:void 0,MAX_TEXTURE_SIZE:void 0,MAX_VARYING_VECTORS:void 0,MAX_VERTEX_ATTRIBS:void 0,MAX_VERTEX_TEXTURE_IMAGE_UNITS:void 0,MAX_VERTEX_UNIFORM_VECTORS:void 0,init:function(t){var e=this;this.gl=t;["MAX_RENDERBUFFER_SIZE","MAX_COMBINED_TEXTURE_IMAGE_UNITS","MAX_CUBE_MAP_TEXTURE_SIZE","MAX_FRAGMENT_UNIFORM_VECTORS","MAX_TEXTURE_IMAGE_UNITS","MAX_TEXTURE_SIZE","MAX_VARYING_VECTORS","MAX_VERTEX_ATTRIBS","MAX_VERTEX_TEXTURE_IMAGE_UNITS","MAX_VERTEX_UNIFORM_VECTORS"].forEach((function(t){e.get(t)})),this.MAX_TEXTURE_INDEX=this.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,this.MAX_VERTEX_PRECISION=this._getMaxSupportPrecision(t.VERTEX_SHADER),this.MAX_FRAGMENT_PRECISION=this._getMaxSupportPrecision(t.FRAGMENT_SHADER),this.MAX_PRECISION=this.getMaxPrecision(this.MAX_FRAGMENT_PRECISION,this.MAX_VERTEX_PRECISION),this.VERTEX_TEXTURE_FLOAT=!!tt.texFloat&&this.MAX_VERTEX_TEXTURE_IMAGE_UNITS>0,this.FRAGMENT_TEXTURE_FLOAT=!!tt.texFloat,this.EXT_FRAG_DEPTH=tt.get("EXT_frag_depth"),this.SHADER_TEXTURE_LOD=!!tt.shaderTextureLod,tt.textureFilterAnisotropic&&(this.MAX_TEXTURE_MAX_ANISOTROPY=t.getParameter(tt.textureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))},get:function(t){var e=this.gl,n=this[t];return void 0===n&&(n=this[t]=e.getParameter(e[t])),n},_getMaxSupportPrecision:function(t){var e=this.gl,n="lowp";if(e.getShaderPrecisionFormat)for(var r=[{name:"highp",type:e.HIGH_FLOAT},{name:"mediump",type:e.MEDIUM_FLOAT}],i=0;i<r.length;i++){var a=r[i];if((e.getShaderPrecisionFormat(t,a.type)||{}).precision>0){n=a.name;break}}else n="mediump";return n},getMaxPrecision:function(t,e){return"highp"===t||"mediump"===t&&"lowp"===e?e:t}},nt=n(50),rt=n.n(nt),it=n(51),at=n.n(it),st=n(52),ot=n.n(st),ut=n(53),ct=n.n(ut),ht=new J,ft=new J,lt=a.a.create({isShader:!0,className:"Shader",vs:"",fs:"",Statics:{commonOptions:{},shaders:{"chunk/baseDefine.glsl":n(18),"chunk/color.frag":n(36),"chunk/color.vert":n(74),"chunk/color_main.vert":n(76),"chunk/diffuse.frag":n(56),"chunk/diffuse_main.frag":n(65),"chunk/extensions.frag":n(24),"chunk/extensions.vert":n(48),"chunk/fog.frag":n(43),"chunk/fog_main.frag":n(67),"chunk/frag_color.frag":n(47),"chunk/joint.vert":n(69),"chunk/joint_main.vert":n(79),"chunk/light.frag":n(40),"chunk/lightFog.frag":n(39),"chunk/lightFog.vert":n(72),"chunk/lightFog_main.frag":n(45),"chunk/lightFog_main.vert":n(82),"chunk/logDepth.frag":n(28),"chunk/logDepth_main.frag":n(29),"chunk/logDepth.vert":n(75),"chunk/logDepth_main.vert":n(83),"chunk/morph.vert":n(73),"chunk/morph_main.vert":n(78),"chunk/normal.frag":n(38),"chunk/normal.vert":n(71),"chunk/normal_main.frag":n(44),"chunk/normal_main.vert":n(81),"chunk/pbr.frag":n(85),"chunk/pbr_main.frag":n(87),"chunk/phong.frag":n(63),"chunk/phong_main.frag":n(66),"chunk/precision.frag":n(25),"chunk/precision.vert":n(49),"chunk/transparency.frag":n(42),"chunk/transparency_main.frag":n(46),"chunk/unQuantize.vert":n(68),"chunk/unQuantize_main.vert":n(77),"chunk/uv.frag":n(37),"chunk/uv.vert":n(70),"chunk/uv_main.vert":n(80),"method/encoding.glsl":n(86),"method/getDiffuse.glsl":n(58),"method/getLightAttenuation.glsl":n(60),"method/getShadow.glsl":n(62),"method/getSpecular.glsl":n(59),"method/packFloat.glsl":n(84),"method/textureEnvMap.glsl":n(41),"method/transpose.glsl":n(57),"method/unpackFloat.glsl":n(61),"basic.frag":n(50),"basic.vert":n(51),"geometry.frag":n(52),"pbr.frag":n(53),"screen.frag":n(54),"screen.vert":n(55)},init:function(t){this.renderer=t,this.commonHeader=this._getCommonHeader(this.renderer)},cache:{get:function(){return ht}},headerCache:{get:function(){return ft}},reset:function(t){ht.removeAll()},getHeaderKey:function(t,e,n,r,i){var a="header_"+e.id+"_"+n.lightInfo.uid;return t.isSkinedMesh&&(a+="_joint"+t.skeleton.jointCount),r&&(a+="_fog_"+r.mode),a+="_"+t.geometry.getShaderKey(),i&&(a+="_fogDepth"),a},getHeader:function(t,e,n,r,i){var a=this.getHeaderKey(t,e,n,r),s=ft.get(a);if(!s||e.isDirty){var o={};Object.assign(o,this.commonOptions);var u=e.lightType;u&&"NONE"!==u&&n.getRenderOption(o),e.getRenderOption(o),t.getRenderOption(o),r&&(o.HAS_FOG=1,r.getRenderOption(o)),i&&(o.USE_LOG_DEPTH=1,et.EXT_FRAG_DEPTH&&(o.USE_EXT_FRAG_DEPTH=1)),o.HAS_NORMAL&&o.NORMAL_MAP&&(o.HAS_TANGENT=1),o.RECEIVE_SHADOWS||(delete o.DIRECTIONAL_LIGHTS_SMC,delete o.SPOT_LIGHTS_SMC,delete o.POINT_LIGHTS_SMC),s="#define SHADER_NAME ".concat(e.shaderName||e.className,"\n"),s+=Object.keys(o).map((function(t){return t.indexOf("HILO_CUSTUM_OPTION_")>-1?"#define ".concat(t.replace("HILO_CUSTUM_OPTION_","")," ").concat(o[t]):"#define HILO_".concat(t," ").concat(o[t])})).join("\n")+"\n",ft.add(a,s)}return s},_getCommonHeader:function(t){var e=et.getMaxPrecision(et.MAX_VERTEX_PRECISION,t.vertexPrecision),n=et.getMaxPrecision(et.MAX_FRAGMENT_PRECISION,t.fragmentPrecision),r=et.getMaxPrecision(e,n);return"\n#define HILO_MAX_PRECISION ".concat(r,"\n#define HILO_MAX_VERTEX_PRECISION ").concat(e,"\n#define HILO_MAX_FRAGMENT_PRECISION ").concat(n,"\n")},getShader:function(t,e,n,r,i,a){var s=this.getHeader(t,e,r,i,a);return e.isBasicMaterial||e.isPBRMaterial?this.getBasicShader(e,n,s):e.isShaderMaterial?this.getCustomShader(e.vs,e.fs,s,e.shaderCacheId||e.id,e.useHeaderCache):null},getBasicShader:function(t,e,n){var r="";e&&(r=(r=t.getInstancedUniforms().map((function(t){return t.name}))).join("|"));var i=t.className+":"+r;t.onBeforeCompile&&(i+=":"+(t.shaderCacheId||t.id));var a=ht.get(i);if(!a){var s="",o=at.a;if(t.isBasicMaterial?t.isGeometryMaterial?s+=ot.a:s+=rt.a:t.isPBRMaterial&&(s+=ct.a),t.onBeforeCompile){var u=t.onBeforeCompile(o,s);s=u.fs,o=u.vs}if(r){var c=new RegExp("^\\s*uniform\\s+(\\w+)\\s+(".concat(r,");"),"gm");o=o.replace(c,"attribute $1 $2;")}a=this.getCustomShader(o,s,n,i,!0)}if(a){var h=this._getNumId(a);null!==h&&(t._shaderNumId=h)}return a},_getNumId:function(t){var e=t.id.match(/_(\d+)/);return e&&e[1]?parseInt(e[1],10):null},getCustomShader:function(t,e,n,r,i){var a,s=this.commonHeader;return r&&(i&&(r+=":"+n),a=ht.get(r)),a||(a=new lt({vs:s+n+t,fs:s+n+e}),r&&ht.add(r,a)),a}},alwaysUse:!1,constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},destroyIfNoRef:function(t){return t.resourceManager.destroyIfNoRef(this),this},destroy:function(){return this._isDestroyed||(ht.removeObject(this),this._isDestroyed=!0),this}}),dt=lt,mt=n(55),_t=n.n(mt),pt=n(54),gt=n.n(pt),vt=[{name:"FLOAT",byteSize:4,uniformFuncName:"uniform1f",type:"Scalar",size:1},{name:"FLOAT_VEC2",byteSize:8,uniformFuncName:"uniform2f",type:"Vector",size:2},{name:"FLOAT_VEC3",byteSize:12,uniformFuncName:"uniform3f",type:"Vector",size:3},{name:"FLOAT_VEC4",byteSize:16,uniformFuncName:"uniform4f",type:"Vector",size:4},{name:"FLOAT_MAT2",byteSize:16,uniformFuncName:"uniformMatrix2fv",type:"Matrix",size:4},{name:"FLOAT_MAT3",byteSize:36,uniformFuncName:"uniformMatrix3fv",type:"Matrix",size:9},{name:"FLOAT_MAT4",byteSize:64,uniformFuncName:"uniformMatrix4fv",type:"Matrix",size:16},{name:"INT",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"INT_VEC2",byteSize:8,uniformFuncName:"uniform2i",type:"Vector",size:2},{name:"INT_VEC3",byteSize:12,uniformFuncName:"uniform3i",type:"Vector",size:3},{name:"INT_VEC4",byteSize:16,uniformFuncName:"uniform4i",type:"Vector",size:4},{name:"BOOL",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"BOOL_VEC2",byteSize:8,uniformFuncName:"uniform2i",type:"Vector",size:2},{name:"BOOL_VEC3",byteSize:12,uniformFuncName:"uniform3i",type:"Vector",size:3},{name:"BOOL_VEC4",byteSize:16,uniformFuncName:"uniform4i",type:"Vector",size:4},{name:"SAMPLER_2D",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"SAMPLER_CUBE",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1}],Et={},Tt={dict:Et,init:function(t){vt.forEach((function(e){var n,r,i=e.name,a=e.uniformFuncName,s=a+"v";"Matrix"===e.type?n=r=function(e,n){void 0!==n&&t[a](e,!1,n)}:(n=function(e,n){void 0!==n&&t[a](e,n)},r=function(e,n){t[s](e,n)}),Et[t[i]]=Object.assign(e,{glValue:t[i],uniform:n,uniformArray:r})}))},get:function(t){return Et[t]}},Mt=new J,At=a.a.create({Statics:{cache:{get:function(){return Mt}},reset:function(t){Mt.each((function(t){t.destroy()}))},getProgram:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.id,i=Mt.get(r);return i||(i=new At({state:e,vertexShader:t.vs,fragShader:t.fs,ignoreError:n}),Mt.add(r,i)),i},getBlankProgram:function(t){var e=dt.getCustomShader("void main(){}","precision HILO_MAX_FRAGMENT_PRECISION float;void main(){gl_FragColor = vec4(0.0);}","","__hiloBlankShader");return this.getProgram(e,t,!0)}},className:"Program",isProgram:!0,fragShader:"",vertexShader:"",attributes:null,uniforms:null,program:null,gl:null,state:null,alwaysUse:!1,constructor:function(t){return this.id=d.a.generateUUID(this.className),Object.assign(this,t),this._dict={},this.attributes={},this.uniforms={},this.gl=this.state.gl,this.program=this.createProgram(),this.program?(this.initAttributes(),this.initUniforms(),this):this.ignoreError?this:At.getBlankProgram(t.state)},createProgram:function(){var t=this.gl,e=t.createProgram(),n=this.createShader(t.VERTEX_SHADER,this.vertexShader),r=this.createShader(t.FRAGMENT_SHADER,this.fragShader);if(n&&r){if(t.attachShader(e,n),t.attachShader(e,r),t.linkProgram(e),t.deleteShader(n),t.deleteShader(r),!t.getProgramParameter(e,t.LINK_STATUS)){var i=t.getProgramInfoLog(e);return m.a.error("compileProgramError: "+i,this),t.deleteProgram(e),null}return e}return null},useProgram:function(){this.state.useProgram(this.program)},createShader:function(t,e){var n=this.gl,r=n.createShader(t);if(n.shaderSource(r,e),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS)){var i=n.getShaderInfoLog(r);return m.a.error("compileShaderError: "+i,e.split("\n").map((function(t,e){return"".concat(e+1," ").concat(t)})).join("\n")),null}return r},initAttributes:function(){for(var t=this,e=this.gl,n=this.program,r=e.getProgramParameter(n,e.ACTIVE_ATTRIBUTES),i=tt.instanced,a=function(r){var a=e.getActiveAttrib(n,r),s=a.name,o=a.type,u=a.size,c=e.getAttribLocation(n,s),h=Tt.get(o),f=function(t){var n=t.type,r=void 0===n?e.FLOAT:n,i=t.normalized,a=void 0!==i&&i,s=t.stride,o=void 0===s?0:s,u=t.offset,f=void 0===u?0:u,l=t.size,d=void 0===l?h.size:l;e.vertexAttribPointer(c,d,r,a,o,f)},l=function(){e.enableVertexAttribArray(c)},d=function(){},m=function(t,e){t[c]=e};if(i&&(d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;i.vertexAttribDivisorANGLE(c,t)}),"Matrix"===h.type){var _=h.byteSize,p=h.size,g=Math.sqrt(p),v=4*g,E=function(t){for(var e=0;e<g;e++)t(c+e,e)};f=function(t){var n,r=t.type,i=void 0===r?e.FLOAT:r,a=t.normalized,s=void 0!==a&&a,o=t.stride,u=void 0===o?0:o,c=t.offset,h=void 0===c?0:c;n=0===u?_:u,E((function(t,r){e.vertexAttribPointer(t,g,i,s,n,h+v*r)}))},l=function(){E((function(t){e.enableVertexAttribArray(t)}))},m=function(t,e){E((function(n){t[n]=e}))},i&&(d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;E((function(e){i.vertexAttribDivisorANGLE(e,t)}))})}t.attributes[s]={name:s,location:c,type:o,size:u,glTypeInfo:h,pointer:f,enable:l,divisor:d,addTo:m}},s=0;s<r;s++)a(s)},initUniforms:function(){for(var t=this,e=this.gl,n=this.program,r=e.getProgramParameter(n,e.ACTIVE_UNIFORMS),i=0,a=function(r){var a=e.getActiveUniform(n,r),s=a.name,o=a.size,u=a.type;s=s.replace(/\[0\]$/,"");var c=e.getUniformLocation(n,s),h=Tt.get(u),f=h.uniformArray,l=h.uniform;t.uniforms[s]={name:s,location:c,type:u,size:o,glTypeInfo:h},u!==e.SAMPLER_2D&&u!==e.SAMPLER_CUBE||(t.uniforms[s].textureIndex=i,i+=o),Object.defineProperty(t,s,{set:h.size>1||o>1?function(t){f(c,t)}:function(e){t._dict[s]!==e&&(t._dict[s]=e,l(c,e))}})},s=0;s<r;s++)a(s)},destroyIfNoRef:function(t){return t.resourceManager.destroyIfNoRef(this),this},destroy:function(){return this._isDestroyed||(this.gl.deleteProgram(this.program),this.uniforms=null,this.attributes=null,this.program=null,this.gl=null,this.state=null,this._dict=null,Mt.removeObject(this),this._isDestroyed=!0),this}}),Lt=At,It=P.a.ARRAY_BUFFER,Ot=P.a.ELEMENT_ARRAY_BUFFER,St=P.a.STATIC_DRAW,Rt=new J,yt=a.a.create({Statics:{cache:{get:function(){return Rt}},reset:function(t){Rt.each((function(t){t.destroy()}))},createVertexBuffer:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:St;return this.createBuffer(t,It,e,n)},createBuffer:function(t,e,n,r){var i=n.bufferViewId,a=Rt.get(i);return a||(n.isDirty=!1,a=new yt(t,e,n.data,r),Rt.add(i,a),a)},createIndexBuffer:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:St;return this.createBuffer(t,Ot,e,n)}},className:"Buffer",isBuffer:!0,constructor:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:It,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:St;this.id=d.a.generateUUID(this.className),this.gl=t,this.target=e,this.usage=r,this.buffer=t.createBuffer(),n&&this.bufferData(n)},bind:function(){return this.gl.bindBuffer(this.target,this.buffer),this},bufferData:function(t){var e=this.gl,n=this.target,r=this.usage;return this.bind(),e.bufferData(n,t,r),this.data=t,this},bufferSubData:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.gl,i=this.target;return n||this.bind(),r.bufferSubData(i,t,e),this},uploadGeometryData:function(t){var e=this,n=t.subDataList;return!this.data||this.data.byteLength<t.data.byteLength||!0===t._isAllDirty?this.bufferData(t.data):n&&n.length?(this.bind(),n.forEach((function(t){e.bufferSubData(t.byteOffset,t.data,!0)}))):this.bufferData(t.data),t.isDirty=!1,this},destroyIfNoRef:function(t){return t.resourceManager.destroyIfNoRef(this),this},destroy:function(){return this._isDestroyed||(this.gl.deleteBuffer(this.buffer),this.data=null,Rt.removeObject(this),this._isDestroyed=!0),this}}),Nt=yt,xt=new ArrayBuffer(1),Ct={getTypedArray:function(t,e){return this._updateBuffer(e*t.BYTES_PER_ELEMENT),new t(xt,0,e)},fillArrayData:function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=0,i=e.length;r<i;r++)t[n+r]=e[r]},_updateBuffer:function(t){xt.byteLength<t&&(xt=new ArrayBuffer(2*t))}},bt=P.a.TRIANGLES,Pt=[],wt=null,Ht=new J,Dt=a.a.create({Statics:{cache:{get:function(){return Ht}},getVao:function(t,e,n){var r=Ht.get(e);return r?n.mode&&n.mode!==r.mode&&(r.mode=n.mode):(r=new Dt(t,e,n),Ht.add(e,r)),r},reset:function(t){wt=null,Pt=[],this.bindSystemVao(),Ht.each((function(e){e.destroy(t)}))},bindSystemVao:function(){tt.vao&&tt.vao.bindVertexArrayOES(null),wt=null}},className:"VertexArrayObject",isVertexArrayObject:!0,vertexCount:null,useVao:!1,useInstanced:!1,mode:bt,isDirty:!0,constructor:function(t,e,n){this.gl=t,this.id=e,this.vaoExtension=tt.vao,this.instancedExtension=tt.instanced,Object.assign(this,n),this.vaoExtension||(this.useVao=!1),this.instancedExtension||(this.useInstanced=!1),this.useVao&&(this.vao=this.vaoExtension.createVertexArrayOES()),this.attributes=[],this.activeStates=[],this.indexBuffer=null},bind:function(){wt!==this&&(this.useVao?this.vaoExtension.bindVertexArrayOES(this.vao):this.bindSystemVao(),wt=this)},bindSystemVao:function(){var t=this.gl;wt&&wt.useVao&&wt.unbind();var e,n=this.activeStates;this.attributes.forEach((function(t){var n=t.buffer,r=t.attribute,i=t.geometryData;e!==n&&(e=n,n.bind()),r.enable(),r.pointer(i),t.useInstanced?r.divisor(1):r.divisor(0)})),Pt.forEach((function(e,r){var i=n[r];e&&!i&&(e.attribute.divisor(0),t.disableVertexAttribArray(r))})),this.indexBuffer&&this.indexBuffer.bind(),Pt=n},unbind:function(){this.useVao&&this.vaoExtension.bindVertexArrayOES(null),wt=null},draw:function(){this.bind();var t=this.gl,e=this.mode;this.indexBuffer?t.drawElements(e,this.vertexCount,this.indexType,0):t.drawArrays(e,0,this.getVertexCount())},getVertexCount:function(){if(null===this.vertexCount){var t=this.attributes[0];this.vertexCount=t?t.geometryData.count:0}return this.vertexCount},drawInstance:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.bind();var e=this.gl,n=this.mode;this.useInstanced&&(this.indexBuffer?this.instancedExtension.drawElementsInstancedANGLE(n,this.vertexCount,e.UNSIGNED_SHORT,0,t):this.instancedExtension.drawArraysInstancedANGLE(n,0,this.getVertexCount(),t))},addIndexBuffer:function(t,e){this.bind();var n=this.gl,r=this.indexBuffer;return this.indexType=t.type,r?t.isDirty&&(r.uploadGeometryData(t),this.vertexCount=t.length):((r=Nt.createIndexBuffer(n,t,e)).bind(),this.indexBuffer=r,this.vertexCount=t.length),r},addAttribute:function(t,e,n,r){this.bind();var i=this.gl,a=e.name,s=this[a];if(!s){var o=Nt.createVertexBuffer(i,t,n);o.bind(),e.enable(),e.pointer(t),s={attribute:e,buffer:o,geometryData:t},this.attributes.push(s),this[a]=s,e.addTo(this.activeStates,s),r&&r(s)}if(t.isDirty){var u=s.buffer;u.bind(),e.enable(),e.pointer(t),u.uploadGeometryData(t)}return s},addInstancedAttribute:function(t,e,n){this.bind();var r=this.gl,i=t.name,a=t.glTypeInfo,s=Ct.getTypedArray(Float32Array,e.length*a.size);e.forEach((function(t,e){void 0!==n(t)?Ct.fillArrayData(s,n(t),e*a.size):m.a.warn("no attributeData:"+i+"-"+t.name)}));var o,u=this[i];return u?(o=u.geometryData).data=s:o=new b(s,1),this.addAttribute(o,t,r.DYNAMIC_DRAW,(function(e){t.divisor(1),e.useInstanced=!0}))},getResources:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.attributes&&this.attributes.forEach((function(e){t.push(e.buffer)})),this.indexBuffer&&t.push(this.indexBuffer),t},destroyIfNoRef:function(t){return t.resourceManager.destroyIfNoRef(this),this},destroy:function(){var t=this;return this._isDestroyed||(this.instancedExtension=null,this.useVao&&(this.vaoExtension.deleteVertexArrayOES(this.vao),this.vao=null,this.vaoExtension=null),this.gl=null,this.indexBuffer=null,this.attributes.forEach((function(e){var n=e.attribute||{};t[n.name]=null})),this.attributes=null,this.activeStates=null,Ht.removeObject(this),this._isDestroyed=!0),this}}),Ft=Dt,Ut=P.a.TEXTURE_2D,Gt=P.a.RGBA,Bt=P.a.LINEAR,Vt=P.a.NEAREST,Xt=P.a.REPEAT,jt=P.a.CLAMP_TO_EDGE,kt=P.a.UNSIGNED_BYTE,zt=P.a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Wt=P.a.UNPACK_FLIP_Y_WEBGL,Yt=P.a.UNPACK_COLORSPACE_CONVERSION_WEBGL,qt=P.a.BROWSER_DEFAULT_WEBGL,Zt=P.a.NONE,Kt=new J,Qt=a.a.create({Statics:{cache:{get:function(){return Kt}},reset:function(t){Kt.each((function(e,n){t.deleteTexture(e),Kt.remove(n)}))}},isTexture:!0,className:"Texture",isImageCanRelease:!1,_isImageReleased:!1,_image:null,image:{get:function(){return this._isImageReleased&&m.a.errorOnce("Read Texture.image(".concat(this.id,")"),"Read Texture.image after image released!"),this._image},set:function(t){this._image=t,this._isImageReleased=!1}},_releaseImage:function(){this._canvasImage=null,this._canvasCtx=null,this._originImage=null,this._image=null,this.mipmaps=null,this._isImageReleased=!0},mipmaps:null,target:Ut,internalFormat:Gt,format:Gt,type:kt,width:0,height:0,border:0,magFilter:Bt,minFilter:Bt,wrapS:Xt,wrapT:Xt,name:"",premultiplyAlpha:!1,flipY:!1,colorSpaceConversion:!0,compressed:!1,needUpdate:!0,needDestroy:!1,autoUpdate:!1,uv:0,anisotropic:1,origWidth:{get:function(){return this._originImage?this._originImage.width||this.width:this.image&&this.image.width||this.width}},origHeight:{get:function(){return this.originImage?this._originImage.height||this.height:this.image&&this.image.height||this.height}},useMipmap:{get:function(){return this.minFilter!==Bt&&this.minFilter!==Vt},set:function(){m.a.warn("texture.useMipmap is readOnly!")}},useRepeat:{get:function(){return this.wrapS!==jt||this.wrapT!==jt},set:function(){m.a.warn("texture.useRepeat is readOnly!")}},mipmapCount:{get:function(){return Math.floor(Math.log2(Math.max(this.width,this.height))+1)},set:function(){m.a.warn("texture.mipmapCount is readOnly!")}},constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},isImgPowerOfTwo:function(t){return d.a.isPowerOfTwo(t.width)&&d.a.isPowerOfTwo(t.height)},getSupportSize:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.width,r=t.height;e&&!this.isImgPowerOfTwo(t)&&(n=d.a.nextPowerOfTwo(n),r=d.a.nextPowerOfTwo(r));var i=et.MAX_TEXTURE_SIZE;return i&&(n>i&&(n=i),r>i&&(r=i)),{width:n,height:r}},resizeImgToPowerOfTwo:function(t){var e=this.getSupportSize(t,!0);return this.resizeImg(t,e.width,e.height)},resizeImg:function(t,e,n){if(t.width===e&&t.height===n)return t;var r=this._canvasImage;return r?(r.width=e,r.height=n,this._canvasCtx=r.getContext("2d")):((r=document.createElement("canvas")).width=e,r.height=n,this._canvasImage=r,this._canvasCtx=r.getContext("2d")),this._canvasCtx.drawImage(t,0,0,t.width,t.height,0,0,e,n),m.a.warnOnce("Texture.resizeImg(".concat(this.id,")"),"image size(".concat(t.width,"x").concat(t.height,") is not support. Resized to ").concat(r.width,"x").concat(r.height),t.src),this._originImage=t,r},_glUploadTexture:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.width,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:this.height,s=t.gl;return this.compressed?s.compressedTexImage2D(e,r,this.internalFormat,i,a,this.border,n):n&&void 0!==n.width?s.texImage2D(e,r,this.internalFormat,this.format,this.type,n):s.texImage2D(e,r,this.internalFormat,i,a,this.border,this.format,this.type,n),this},_uploadTexture:function(t){var e=this;return this.useMipmap&&this.mipmaps?this.mipmaps.forEach((function(n,r){e._glUploadTexture(t,e.target,n.data,r,n.width,n.height)})):this._glUploadTexture(t,this.target,this.image,0),this},_updatePixelStorei:function(){var t=this.state;t.pixelStorei(zt,this.premultiplyAlpha),t.pixelStorei(Wt,!!this.flipY),t.pixelStorei(Yt,this.colorSpaceConversion?qt:Zt)},updateTexture:function(t,e){var n=t.gl;if(this.needUpdate||this.autoUpdate){this._originImage&&this.image===this._canvasImage&&(this.image=this._originImage);var r=this.useMipmap,i=this.useRepeat;if(this.image&&!this.image.length){var a=i||r,s=this.getSupportSize(this.image,a);this.image=this.resizeImg(this.image,s.width,s.height),this.width=this.image.width,this.height=this.image.height}t.activeTexture(n.TEXTURE0+et.MAX_TEXTURE_INDEX),t.bindTexture(this.target,e),this._updatePixelStorei(),this._uploadTexture(t),r&&(this.compressed?this.mipmaps||(m.a.warn("Compressed texture has no mipmips, changed the minFilter from ".concat(this.minFilter," to Linear!"),this),this.minFilter=Bt):n.generateMipmap(this.target)),n.texParameterf(this.target,n.TEXTURE_MAG_FILTER,this.magFilter),n.texParameterf(this.target,n.TEXTURE_MIN_FILTER,this.minFilter),n.texParameterf(this.target,n.TEXTURE_WRAP_S,this.wrapS),n.texParameterf(this.target,n.TEXTURE_WRAP_T,this.wrapT);var o=tt.textureFilterAnisotropic;o&&this.anisotropic>1&&n.texParameterf(this.target,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(this.anisotropic,et.MAX_TEXTURE_MAX_ANISOTROPY)),this.needUpdate=!1}return this._needUpdateSubTexture&&(this._uploadSubTextures(t,e),this._needUpdateSubTexture=!1),this},_uploadSubTextures:function(t,e){var n=this;if(this._subTextureList&&this._subTextureList.length>0){var r=t.gl;t.activeTexture(r.TEXTURE0+et.MAX_TEXTURE_INDEX),t.bindTexture(this.target,e),this._updatePixelStorei(),this._subTextureList.forEach((function(t){var e=t[0],i=t[1],a=t[2];r.texSubImage2D(n.target,0,e,i,n.format,n.type,a)})),this._subTextureList.length=0}},_needUpdateSubTexture:!1,_subTextureList:null,updateSubTexture:function(t,e,n){this._subTextureList||(this._subTextureList=[]),this._subTextureList.push([t,e,n]),this._needUpdateSubTexture=!0},getGLTexture:function(t){this.state=t;var e=this.gl=t.gl,n=this.id;this.needDestroy&&(this.destroy(),this.needDestroy=!1);var r=Kt.get(n);return r||(r=e.createTexture(),Kt.add(n,r),this.needUpdate=!0),this.updateTexture(t,r),this.isImageCanRelease&&this._releaseImage(),r},setGLTexture:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e&&this.destroy(),Kt.add(this.id,t),this},destroy:function(){var t=this.id,e=Kt.get(t);return e&&this.gl&&(this.gl.deleteTexture(e),Kt.remove(t)),this},clone:function(){var t=Object.assign({},this);return delete t.id,new this.constructor(t)}}),Jt=P.a.TEXTURE_2D,$t=P.a.RGBA,te=P.a.UNSIGNED_BYTE,ee=P.a.COLOR_ATTACHMENT0,ne=P.a.DEPTH_STENCIL,re=P.a.DEPTH_TEST,ie=P.a.CULL_FACE,ae=P.a.TRIANGLE_STRIP,se=P.a.NEAREST,oe=P.a.CLAMP_TO_EDGE,ue=new J,ce=a.a.create({Statics:{cache:{get:function(){return ue}},reset:function(t){ue.each((function(t){t.reset()}))},destroy:function(t){ue.each((function(t){t.destroy()}))}},className:"Framebuffer",isFramebuffer:!0,bufferInternalFormat:ne,target:Jt,format:$t,internalFormat:$t,type:te,minFilter:se,magFilter:se,wrapS:oe,wrapT:oe,data:null,attachment:ee,needRenderbuffer:!0,useVao:!0,renderer:null,texture:null,renderbuffer:null,framebuffer:null,_isInit:!1,constructor:function(t,e){this.id=d.a.generateUUID(this.className),this.renderer=t,Object.assign(this,e),this.width||(this.width=t.width),this.height||(this.height=t.height),ue.add(this.id,this)},init:function(){if(!this._isInit&&this.renderer.isInit){this._isInit=!0;var t=this.renderer;this.gl=t.gl,this.state=t.state,this.reset()}},reset:function(){this.destroyResource();var t=this.gl;this.framebuffer=t.createFramebuffer(),this.bind(),this.needRenderbuffer&&(this.renderbuffer=this.createRenderbuffer()),this.texture=this.createTexture(),this.isComplete()||m.a.warn("Framebuffer is not complete => "+t.checkFramebufferStatus(t.FRAMEBUFFER)),this.unbind()},isComplete:function(){var t=this.gl;return!(!t||t.checkFramebufferStatus(t.FRAMEBUFFER)!==t.FRAMEBUFFER_COMPLETE)},bind:function(){this.init(),this._isInit&&this.state.bindFramebuffer(this.gl.FRAMEBUFFER,this.framebuffer)},unbind:function(){if(this.init(),this._isInit){var t=this.state;t.bindFramebuffer(this.gl.FRAMEBUFFER,t.preFramebuffer)}},clear:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new v.a(0,0,0,0);if(this._isInit){var e=this.gl;e.clearColor(t.r,t.g,t.b,t.a),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}},render:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4?arguments[4]:void 0;if(this._isInit){var a=this.gl,s=this.state;s.disable(re),s.disable(ie),i&&this.clear(i);var o=dt.getCustomShader(_t.a,gt.a,"","FramebufferTextureShader"),u=Lt.getProgram(o,s);u.useProgram();var c="".concat(t,"_").concat(e,"_").concat(n,"_").concat(r,"_").concat(u.id),h=Ft.getVao(a,c,{useVao:this.useVao,useInstanced:!1,mode:ae});if(h.isDirty){h.isDirty=!1;var f=[t=2*t-1,e=1-2*e,t+(n*=2),e,t,e-(r*=2),t+n,e-r];h.addAttribute(new b(new Float32Array(f),2),u.attributes.a_position),h.addAttribute(new b(new Float32Array([0,1,1,1,0,0,1,0]),2),u.attributes.a_texcoord0)}s.activeTexture(a.TEXTURE0),s.bindTexture(a.TEXTURE_2D,this.texture.getGLTexture(s)),h.draw()}},createRenderbuffer:function(){var t=this.gl,e=this.width,n=this.height,r=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,r),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e,n),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,r),r},createTexture:function(){var t=this.state,e=t.gl,n=new Qt({minFilter:this.minFilter,magFilter:this.magFilter,internalFormat:this.internalFormat,format:this.format,type:this.type,width:this.width,height:this.height,image:this.data,wrapS:this.wrapS,wrapT:this.wrapT}),r=n.getGLTexture(t);return e.framebufferTexture2D(e.FRAMEBUFFER,this.attachment,this.target,r,0),n},resize:function(t,e,n){(n||this.width!==t||this.height!==e)&&(this.width=t,this.height=e,this._isInit&&this.reset())},readPixels:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=Object(i.getTypedArrayClass)(this.type),s=new a(n*r*4);if(this._isInit){var o=this.gl;e=this.height-e-r,this.bind(),o.readPixels(t,e,n,r,this.format,this.type,s),this.unbind()}return s},destroy:function(){return this._isDestroyed||(this.destroyResource(),this.gl=null,ue.removeObject(this),this._isDestroyed=!0),this},destroyResource:function(){var t=this.gl;t&&(this.framebuffer&&(t.deleteFramebuffer(this.framebuffer),this.framebuffer=null),this.renderbuffer&&(t.deleteRenderbuffer(this.renderbuffer),this.renderbuffer=null),this.texture&&(this.texture.destroy(),this.texture=null))}}),he=P.a.TEXTURE_CUBE_MAP,fe=P.a.RGB,le=P.a.LINEAR,de=P.a.CLAMP_TO_EDGE,me=P.a.TEXTURE_CUBE_MAP_POSITIVE_X,_e=a.a.create({Extends:Qt,isCubeTexture:!0,className:"CubeTexture",target:he,internalFormat:fe,format:fe,magFilter:le,minFilter:le,wrapS:de,wrapT:de,constructor:function(t){_e.superclass.constructor.call(this,t),this.image=this.image||[]},_uploadTexture:function(t){var e=this,n=this.image;Array.isArray(n)&&6===n.length?(n[0]&&n[0].width&&(this.width=n[0].width,this.height=n[0].height),n.forEach((function(n,r){e._glUploadTexture(t,me+r,n,0)}))):m.a.error("CubeTexture image must be an Array of length 6",n)},right:{get:function(){return this.image[0]},set:function(t){this.image[0]=t}},left:{get:function(){return this.image[1]},set:function(t){this.image[1]=t}},top:{get:function(){return this.image[2]},set:function(t){this.image[2]=t}},bottom:{get:function(){return this.image[3]},set:function(t){this.image[3]=t}},front:{get:function(){return this.image[4]},set:function(t){this.image[4]=t}},back:{get:function(){return this.image[5]},set:function(t){this.image[5]=t}}}),pe=_e,ge=P.a.TEXTURE_2D,ve=P.a.RGBA,Ee=P.a.NEAREST,Te=P.a.CLAMP_TO_EDGE,Me=P.a.FLOAT,Ae=a.a.create({Extends:Qt,isDataTexture:!0,className:"DataTexture",target:ge,internalFormat:ve,format:ve,type:Me,magFilter:Ee,minFilter:Ee,wrapS:Te,wrapT:Te,dataLength:0,resetSize:function(t){if(t!==this.dataLength){this.dataLength=t;var e=d.a.nextPowerOfTwo(t/4),n=Math.max(Math.log2(e),4),r=Math.floor(n/2),a=n-r;this.width=Math.pow(2,r),this.height=Math.pow(2,a),this.DataClass=Object(i.getTypedArrayClass)(this.type)}},data:{get:function(){return this.image},set:function(t){if(this.image!==t){this.resetSize(t.length);var e=this.width*this.height*4;e===t.length&&t instanceof this.DataClass?this.image=t:(this.image&&this.image.length===e||(this.image=new this.DataClass(e)),this.image.set(t,0)),this.needUpdate=!0}}},constructor:function(t){Ae.superclass.constructor.call(this,t)}}),Le=Ae;function Ie(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Oe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Oe(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Oe(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var Se,Re,ye,Ne,xe,Ce,be,Pe=new c.a,we=new y.a,He=new o.a,De=new Float32Array([.5,.5,.5,1]),Fe=new Float32Array([0,0]),Ue={state:null,camera:null,lightManager:null,fog:null,gl:null,renderer:null,blankInfo:{get:function(){}},init:function(t,e,n,r,i){Ce=this._renderer=t,Ne=this.state=e,Se=this.camera=n,ye=this.lightManager=r,xe=this.fog=i,Re=this.gl=Ne.gl},setCamera:function(t){Se=this.camera=t},handlerColorOrTexture:function(t,e){return t&&t.isTexture?this.handlerTexture(t,e):(t&&t.isColor?t.toArray(De):De[0]=De[1]=De[2]=.5,De)},handlerTexture:function(t,e){if(t&&t.isTexture)return this.handlerGLTexture(t.target,t.getGLTexture(Ne),e)},handlerGLTexture:function(t,e,n){if(e)return Ne.activeTexture(Re.TEXTURE0+n),Ne.bindTexture(t,e),n},handlerUV:function(t){return t&&t.isTexture&&t.uv||0},POSITION:{get:function(t,e,n){return t.geometry.vertices}},NORMAL:{get:function(t,e,n){return t.geometry.normals}},TANGENT:{get:function(t,e,n){var r=e.normalMap||e.clearcoatNormalMap;return r&&r.isTexture&&1===Number(r.uv)?t.geometry.tangents1:t.geometry.tangents}},TEXCOORD_0:{get:function(t,e,n){if(t.geometry.uvs)return t.geometry.uvs}},TEXCOORD_1:{get:function(t,e,n){if(t.geometry.uvs1)return t.geometry.uvs1}},UVMATRIX_0:{get:function(t,e,n){if(e.uvMatrix)return e.uvMatrix.elements}},UVMATRIX_1:{get:function(t,e,n){if(e.uvMatrix1)return e.uvMatrix1.elements}},CAMERAFAR:{get:function(t,e,n){if(Se.isPerspectiveCamera)return Se.far}},CAMERANEAR:{get:function(t,e,n){if(Se.isPerspectiveCamera)return Se.near}},CAMERATYPE:{get:function(t,e,n){return Se.isPerspectiveCamera?1:0}},CAMERAPOSITION:{get:function(t,e,n){return Se.worldMatrix.getTranslation(Pe).elements}},COLOR_0:{get:function(t,e,n){if(t.geometry.colors)return t.geometry.colors}},SKININDICES:{get:function(t,e,n){return t.geometry.skinIndices}},JOINT:{get:function(t,e,n){return t.geometry.skinIndices}},WEIGHT:{get:function(t,e,n){return t.geometry.skinWeights}},SKINWEIGHTS:{get:function(t,e,n){return t.geometry.skinWeights}},RENDERERSIZE:{get:function(t,e,n){return Fe[0]=Ce.width,Fe[1]=Ce.height,Fe}},LOCAL:{get:function(t,e,n){return t.matrix.elements},isDependMesh:!0},MODEL:{get:function(t,e,n){return t.worldMatrix.elements},isDependMesh:!0},VIEW:{get:function(t,e,n){return Se.viewMatrix.elements}},PROJECTION:{get:function(t,e,n){return Se.projectionMatrix.elements}},VIEWPROJECTION:{get:function(t,e,n){return Se.viewProjectionMatrix.elements}},MODELVIEW:{get:function(t,e,n){return Se.getModelViewMatrix(t,He).elements},isDependMesh:!0},MODELVIEWPROJECTION:{get:function(t,e,n){return Se.getModelProjectionMatrix(t,He).elements},isDependMesh:!0},MODELINVERSE:{get:function(t,e,n){return He.invert(t.worldMatrix).elements},isDependMesh:!0},VIEWINVERSE:{get:function(t,e,n){return Se.worldMatrix.elements}},VIEWINVERSEINVERSETRANSPOSE:{get:function(t,e,n){return we.normalFromMat4(Se.worldMatrix).elements}},PROJECTIONINVERSE:{get:function(t,e,n){return He.invert(Se.projectionMatrix).elements}},MODELVIEWINVERSE:{get:function(t,e,n){return He.invert(Se.getModelViewMatrix(t,He)).elements},isDependMesh:!0},MODELVIEWPROJECTIONINVERSE:{get:function(t,e,n){return He.invert(Se.getModelProjectionMatrix(t,He)).elements},isDependMesh:!0},MODELINVERSETRANSPOSE:{get:function(t,e,n){return we.normalFromMat4(t.worldMatrix).elements},isDependMesh:!0},MODELVIEWINVERSETRANSPOSE:{get:function(t,e,n){return we.normalFromMat4(Se.getModelViewMatrix(t,He)).elements},isDependMesh:!0},VIEWPORT:void 0,JOINTMATRIX:{get:function(t,e,n){if(t.isSkinedMesh)return t.getJointMat();m.a.warnOnce("semantic.JOINTMATRIX(".concat(t.id,")"),"Current mesh is not SkinedMesh!",t.id)},isDependMesh:!0,notSupportInstanced:!0},JOINTMATRIXTEXTURE:{get:function(t,e,n){if(t.isSkinedMesh)return t.updateJointMatTexture(),Ue.handlerTexture(t.jointMatTexture,n.textureIndex);m.a.warnOnce("semantic.JOINTMATRIXTEXTURE(".concat(t.id,")"),"Current mesh is not SkinedMesh!",t.id)},isDependMesh:!0,notSupportInstanced:!0},JOINTMATRIXTEXTURESIZE:{get:function(t,e,n){if(t.isSkinedMesh)return t.initJointMatTexture(),[t.jointMatTexture.width,t.jointMatTexture.height];m.a.warnOnce("semantic.JOINTMATRIXTEXTURESIZE(".concat(t.id,")"),"Current mesh is not SkinedMesh!",t.id)},isDependMesh:!0,notSupportInstanced:!0},NORMALMAPSCALE:{get:function(t,e,n){return e.normalMapScale}},OCCLUSIONSTRENGTH:{get:function(t,e,n){return e.occlusionStrength}},SHININESS:{get:function(t,e,n){return e.shininess}},SPECULARENVMATRIX:{get:function(t,e,n){return e.specularEnvMatrix&&e.specularEnvMap?e.specularEnvMatrix.elements:(He.identity(),He.elements)}},REFLECTIVITY:{get:function(t,e,n){return e.reflectivity}},REFRACTRATIO:{get:function(t,e,n){return e.refractRatio}},REFRACTIVITY:{get:function(t,e,n){return e.refractivity}},LOGDEPTH:{get:function(t,e,n){return 2/(Math.log(Se.far+1)/Math.LN2)}},AMBIENTLIGHTSCOLOR:{get:function(t,e,n){return ye.ambientInfo}},DIRECTIONALLIGHTSCOLOR:{get:function(t,e,n){return ye.directionalInfo.colors}},DIRECTIONALLIGHTSINFO:{get:function(t,e,n){return ye.directionalInfo.infos}},DIRECTIONALLIGHTSSHADOWMAP:{get:function(t,e,n){return ye.directionalInfo.shadowMap.map((function(t,e){return Ue.handlerTexture(t,n.textureIndex+e)}))}},DIRECTIONALLIGHTSSHADOWMAPSIZE:{get:function(t,e,n){return ye.directionalInfo.shadowMapSize}},DIRECTIONALLIGHTSSHADOWBIAS:{get:function(t,e,n){return ye.directionalInfo.shadowBias}},DIRECTIONALLIGHTSPACEMATRIX:{get:function(t,e,n){return ye.directionalInfo.lightSpaceMatrix}},POINTLIGHTSPOS:{get:function(t,e,n){return ye.pointInfo.poses}},POINTLIGHTSCOLOR:{get:function(t,e,n){return ye.pointInfo.colors}},POINTLIGHTSINFO:{get:function(t,e,n){return ye.pointInfo.infos}},POINTLIGHTSRANGE:{get:function(t,e,n){return ye.pointInfo.ranges}},POINTLIGHTSSHADOWMAP:{get:function(t,e,n){return ye.pointInfo.shadowMap.map((function(t,e){return Ue.handlerTexture(t,n.textureIndex+e)}))}},POINTLIGHTSSHADOWBIAS:{get:function(t,e,n){return ye.pointInfo.shadowBias}},POINTLIGHTSPACEMATRIX:{get:function(t,e,n){return ye.pointInfo.lightSpaceMatrix}},POINTLIGHTCAMERA:{get:function(t,e,n){return ye.pointInfo.cameras}},SPOTLIGHTSPOS:{get:function(t,e,n){return ye.spotInfo.poses}},SPOTLIGHTSDIR:{get:function(t,e,n){return ye.spotInfo.dirs}},SPOTLIGHTSCOLOR:{get:function(t,e,n){return ye.spotInfo.colors}},SPOTLIGHTSCUTOFFS:{get:function(t,e,n){return ye.spotInfo.cutoffs}},SPOTLIGHTSINFO:{get:function(t,e,n){return ye.spotInfo.infos}},SPOTLIGHTSRANGE:{get:function(t,e,n){return ye.spotInfo.ranges}},SPOTLIGHTSSHADOWMAP:{get:function(t,e,n){return ye.spotInfo.shadowMap.map((function(t,e){return Ue.handlerTexture(t,n.textureIndex+e)}))}},SPOTLIGHTSSHADOWMAPSIZE:{get:function(t,e,n){return ye.spotInfo.shadowMapSize}},SPOTLIGHTSSHADOWBIAS:{get:function(t,e,n){return ye.spotInfo.shadowBias}},SPOTLIGHTSPACEMATRIX:{get:function(t,e,n){return ye.spotInfo.lightSpaceMatrix}},AREALIGHTSCOLOR:{get:function(t,e,n){return ye.areaInfo.colors}},AREALIGHTSPOS:{get:function(t,e,n){return ye.areaInfo.poses}},AREALIGHTSWIDTH:{get:function(t,e,n){return ye.areaInfo.width}},AREALIGHTSHEIGHT:{get:function(t,e,n){return ye.areaInfo.height}},AREALIGHTSLTCTEXTURE1:{get:function(t,e,n){return Ue.handlerTexture(ye.areaInfo.ltcTexture1,n.textureIndex)}},AREALIGHTSLTCTEXTURE2:{get:function(t,e,n){return Ue.handlerTexture(ye.areaInfo.ltcTexture2,n.textureIndex)}},FOGCOLOR:{get:function(t,e,n){if(xe)return xe.color.elements}},FOGINFO:{get:function(t,e,n){if(xe)return xe.getInfo()}},POSITIONDECODEMAT:{get:function(t,e,n){return t.geometry.positionDecodeMat},isDependMesh:!0},NORMALDECODEMAT:{get:function(t,e,n){return t.geometry.normalDecodeMat},isDependMesh:!0},UVDECODEMAT:{get:function(t,e,n){return t.geometry.uvDecodeMat},isDependMesh:!0},UV1DECODEMAT:{get:function(t,e,n){return t.geometry.uv1DecodeMat},isDependMesh:!0},BASECOLOR:{get:function(t,e,n){return e.baseColor.elements}},EMISSIONFACTOR:{get:function(t,e,n){return e.emissionFactor.elements}},METALLIC:{get:function(t,e,n){return e.metallic}},ROUGHNESS:{get:function(t,e,n){return e.roughness}},DIFFUSEENVMAP:{get:function(t,e,n){return Ue.handlerTexture(e.diffuseEnvMap,n.textureIndex)}},DIFFUSEENVINTENSITY:{get:function(t,e,n){return e.diffuseEnvIntensity}},DIFFUSEENVSPHEREHARMONICS3:{get:function(t,e,n){var r=e.diffuseEnvSphereHarmonics3;if(r)return r.toArray()}},BRDFLUT:{get:function(t,e,n){return Ue.handlerTexture(e.brdfLUT,n.textureIndex)}},SPECULARENVMAP:{get:function(t,e,n){return Ue.handlerTexture(e.specularEnvMap,n.textureIndex)}},SPECULARENVINTENSITY:{get:function(t,e,n){return e.specularEnvIntensity}},SPECULARENVMAPMIPCOUNT:{get:function(t,e,n){var r=e.specularEnvMap;return r?r.mipmapCount:1}},GLOSSINESS:{get:function(t,e,n){return e.glossiness}},ALPHACUTOFF:{get:function(t,e,n){return e.alphaCutoff}},EXPOSURE:{get:function(t,e,n){return e.exposure}},GAMMAFACTOR:{get:function(t,e,n){return e.gammaFactor}},MORPHWEIGHTS:{isDependMesh:!0,notSupportInstanced:!0,get:function(t,e,n){var r=t.geometry;if(r.isMorphGeometry&&r.weights)return r.weights}},CLEARCOATFACTOR:{isDependMesh:!1,notSupportInstanced:!1,get:function(t,e,n){return e.clearcoatFactor}},CLEARCOATROUGHNESSFACTOR:{isDependMesh:!1,notSupportInstanced:!1,get:function(t,e,n){return e.clearcoatRoughnessFactor}}};Ue._TIME=(be=(new Date).getTime(),{isDependMesh:!1,notSupportInstanced:!1,get:function(t,e,n){return.001*((new Date).getTime()-be)}}),[["POSITION","vertices"],["NORMAL","normals"],["TANGENT","tangents"]].forEach((function(t){for(var e=0;e<8;e++)Ue["MORPH"+t[0]+e]={get:function(t,e){return function(n,r,i){var a=n.geometry;if(a.isMorphGeometry&&a.targets&&a.targets[t]){var s=a._originalMorphIndices?a._originalMorphIndices[e]:e,o=a.targets[t][s],u="_target_".concat(t,"_").concat(e);return a[u]!==s&&o&&(o.isDirty=!0,a[u]=s),o}}}(t[1],e)}})),[["DIFFUSE","diffuse"],["SPECULAR","specular"],["EMISSION","emission"],["AMBIENT","ambient"]].forEach((function(t){var e=Ie(t,2),n=e[0],r=e[1];Ue[n]={get:function(t,e,n){return Ue.handlerColorOrTexture(e[r],n.textureIndex)}},Ue["".concat(n,"UV")]={get:function(t,e,n){return Ue.handlerUV(e[r])}}})),[["NORMALMAP","normalMap"],["PARALLAXMAP","parallaxMap"],["BASECOLORMAP","baseColorMap"],["METALLICMAP","metallicMap"],["ROUGHNESSMAP","roughnessMap"],["METALLICROUGHNESSMAP","metallicRoughnessMap"],["OCCLUSIONMAP","occlusionMap"],["SPECULARGLOSSINESSMAP","specularGlossinessMap"],["LIGHTMAP","lightMap"],["CLEARCOATMAP","clearcoatMap"],["CLEARCOATROUGHNESSMAP","clearcoatRoughnessMap"],["CLEARCOATNORMALMAP","clearcoatNormalMap"]].forEach((function(t){var e=Ie(t,2),n=e[0],r=e[1];Ue[n]={get:function(t,e,n){return Ue.handlerTexture(e[r],n.textureIndex)}},Ue["".concat(n,"UV")]={get:function(t,e,n){return Ue.handlerUV(e[r])}}})),[["TRANSPARENCY","transparency"]].forEach((function(t){var e=Ie(t,2),n=e[0],r=e[1];Ue[n]={get:function(t,e,n){var i=e[r];return i&&i.isTexture?Ue.handlerTexture(i,n.textureIndex):null!=i?i:1}},Ue["".concat(n,"UV")]={get:function(t,e,n){return Ue.handlerUV(e[r])}}}));var Ge=Ue,Be=P.a.LEQUAL,Ve=P.a.BACK,Xe=P.a.FRONT,je=P.a.FRONT_AND_BACK,ke=P.a.ZERO,ze=P.a.FUNC_ADD,We=P.a.ONE,Ye=P.a.SRC_ALPHA,qe=P.a.ONE_MINUS_SRC_ALPHA,Ze=P.a.CCW,Ke=P.a.ALWAYS,Qe=P.a.KEEP,Je={isBlankInfo:!0,get:function(){}},$e=a.a.create({isMaterial:!0,className:"Material",name:null,shaderCacheId:null,shaderName:null,lightType:"NONE",wireframe:!1,frontFace:Ze,depthTest:!0,sampleAlphaToCoverage:!1,depthMask:!0,depthRange:[0,1],depthFunc:Be,_cullFace:!0,normalMap:null,parallaxMap:null,normalMapScale:1,ignoreTranparent:!1,gammaCorrection:!1,usePhysicsLight:!1,isDiffuesEnvAndAmbientLightWorkTogether:!1,userData:null,renderOrder:0,_premultiplyAlpha:!0,premultiplyAlpha:{get:function(){return this._premultiplyAlpha},set:function(t){this._premultiplyAlpha=t,this.transparent&&this.setDefaultTransparentBlend()}},gammaOutput:{get:function(){return m.a.warnOnce("Matrial.gammaOutput","material.gammaOutput has deprecated. Use material.gammaCorrection instead."),this.gammaCorrection},set:function(t){m.a.warnOnce("Matrial.gammaOutput","material.gammaOutput has deprecated. Use material.gammaCorrection instead."),this.gammaCorrection=t}},gammaFactor:2.2,castShadows:!0,receiveShadows:!0,uvMatrix:null,uvMatrix1:null,cullFace:{get:function(){return this._cullFace},set:function(t){this._cullFace=t,t?this.cullFaceType=this._cullFaceType:this._side=je}},_cullFaceType:Ve,cullFaceType:{get:function(){return this._cullFaceType},set:function(t){this._cullFaceType=t,this._cullFace&&(t===Ve?this._side=Xe:t===Xe&&(this._side=Ve))}},_side:Xe,side:{get:function(){return this._side},set:function(t){this._side!==t&&(this._side=t,t===je?this._cullFace=!1:(this._cullFace=!0,t===Xe?this._cullFaceType=Ve:t===Ve&&(this._cullFaceType=Xe)))}},blend:!1,blendEquation:ze,blendEquationAlpha:ze,blendSrc:We,blendDst:ke,blendSrcAlpha:We,blendDstAlpha:ke,stencilTest:!1,stencilMask:255,stencilFunc:Ke,stencilFuncRef:1,stencilFuncMask:255,stencilOpFail:Qe,stencilOpZFail:Qe,stencilOpZPass:Qe,isDirty:!1,transparency:1,_transparent:!1,transparent:{get:function(){return this._transparent},set:function(t){this._transparent!==t&&(this._transparent=t,t?this.setDefaultTransparentBlend():(this.blend=!1,this.depthMask=!0))}},setDefaultTransparentBlend:function(){this.blend=!0,this.depthMask=!1,this.premultiplyAlpha?(this.blendSrc=We,this.blendDst=qe,this.blendSrcAlpha=We,this.blendDstAlpha=qe):(this.blendSrc=Ye,this.blendDst=qe,this.blendSrcAlpha=Ye,this.blendDstAlpha=qe)},alphaCutoff:0,useHDR:!1,exposure:1,needBasicUnifroms:!0,needBasicAttributes:!0,constructor:function(t){this.id=d.a.generateUUID(this.className),this.uniforms={},this.attributes={},Object.assign(this,t),this.needBasicAttributes&&this.addBasicAttributes(),this.needBasicUnifroms&&this.addBasicUniforms()},addBasicAttributes:function(){var t=this.attributes;this._copyProps(t,{a_position:"POSITION",a_normal:"NORMAL",a_tangent:"TANGENT",a_texcoord0:"TEXCOORD_0",a_texcoord1:"TEXCOORD_1",a_color:"COLOR_0",a_skinIndices:"SKININDICES",a_skinWeights:"SKINWEIGHTS"}),["POSITION","NORMAL","TANGENT"].forEach((function(e){for(var n=e.slice(0,1)+e.slice(1).toLowerCase(),r=0;r<8;r++){var i="a_morph"+n+r;void 0===t[i]&&(t[i]="MORPH"+e+r)}}))},addBasicUniforms:function(){this._copyProps(this.uniforms,{u_modelMatrix:"MODEL",u_viewMatrix:"VIEW",u_projectionMatrix:"PROJECTION",u_modelViewMatrix:"MODELVIEW",u_modelViewProjectionMatrix:"MODELVIEWPROJECTION",u_viewInverseNormalMatrix:"VIEWINVERSEINVERSETRANSPOSE",u_normalMatrix:"MODELVIEWINVERSETRANSPOSE",u_normalWorldMatrix:"MODELINVERSETRANSPOSE",u_cameraPosition:"CAMERAPOSITION",u_rendererSize:"RENDERERSIZE",u_logDepth:"LOGDEPTH",u_ambientLightsColor:"AMBIENTLIGHTSCOLOR",u_directionalLightsColor:"DIRECTIONALLIGHTSCOLOR",u_directionalLightsInfo:"DIRECTIONALLIGHTSINFO",u_directionalLightsShadowMap:"DIRECTIONALLIGHTSSHADOWMAP",u_directionalLightsShadowMapSize:"DIRECTIONALLIGHTSSHADOWMAPSIZE",u_directionalLightsShadowBias:"DIRECTIONALLIGHTSSHADOWBIAS",u_directionalLightSpaceMatrix:"DIRECTIONALLIGHTSPACEMATRIX",u_pointLightsPos:"POINTLIGHTSPOS",u_pointLightsColor:"POINTLIGHTSCOLOR",u_pointLightsInfo:"POINTLIGHTSINFO",u_pointLightsRange:"POINTLIGHTSRANGE",u_pointLightsShadowBias:"POINTLIGHTSSHADOWBIAS",u_pointLightsShadowMap:"POINTLIGHTSSHADOWMAP",u_pointLightSpaceMatrix:"POINTLIGHTSPACEMATRIX",u_pointLightCamera:"POINTLIGHTCAMERA",u_spotLightsPos:"SPOTLIGHTSPOS",u_spotLightsDir:"SPOTLIGHTSDIR",u_spotLightsColor:"SPOTLIGHTSCOLOR",u_spotLightsCutoffs:"SPOTLIGHTSCUTOFFS",u_spotLightsInfo:"SPOTLIGHTSINFO",u_spotLightsRange:"SPOTLIGHTSRANGE",u_spotLightsShadowMap:"SPOTLIGHTSSHADOWMAP",u_spotLightsShadowMapSize:"SPOTLIGHTSSHADOWMAPSIZE",u_spotLightsShadowBias:"SPOTLIGHTSSHADOWBIAS",u_spotLightSpaceMatrix:"SPOTLIGHTSPACEMATRIX",u_areaLightsPos:"AREALIGHTSPOS",u_areaLightsColor:"AREALIGHTSCOLOR",u_areaLightsWidth:"AREALIGHTSWIDTH",u_areaLightsHeight:"AREALIGHTSHEIGHT",u_areaLightsLtcTexture1:"AREALIGHTSLTCTEXTURE1",u_areaLightsLtcTexture2:"AREALIGHTSLTCTEXTURE2",u_jointMat:"JOINTMATRIX",u_jointMatTexture:"JOINTMATRIXTEXTURE",u_jointMatTextureSize:"JOINTMATRIXTEXTURESIZE",u_positionDecodeMat:"POSITIONDECODEMAT",u_normalDecodeMat:"NORMALDECODEMAT",u_uvDecodeMat:"UVDECODEMAT",u_uv1DecodeMat:"UV1DECODEMAT",u_morphWeights:"MORPHWEIGHTS",u_normalMapScale:"NORMALMAPSCALE",u_emission:"EMISSION",u_transparency:"TRANSPARENCY",u_uvMatrix:"UVMATRIX_0",u_uvMatrix1:"UVMATRIX_1",u_fogColor:"FOGCOLOR",u_fogInfo:"FOGINFO",u_alphaCutoff:"ALPHACUTOFF",u_exposure:"EXPOSURE",u_gammaFactor:"GAMMAFACTOR"}),this.addTextureUniforms({u_normalMap:"NORMALMAP",u_parallaxMap:"PARALLAXMAP",u_emission:"EMISSION",u_transparency:"TRANSPARENCY"})},addTextureUniforms:function(t){var e={};for(var n in t){var r=t[n];e[n]=r,e["".concat(n,".texture")]=r,e["".concat(n,".uv")]="".concat(r,"UV")}this._copyProps(this.uniforms,e)},getRenderOption:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.lightType;e["LIGHT_TYPE_".concat(n)]=1,e.SIDE=this.side,"NONE"!==n&&(e.HAS_LIGHT=1),this.premultiplyAlpha&&(e.PREMULTIPLY_ALPHA=1);var r=this._textureOption.reset(e);return e.HAS_LIGHT&&(e.HAS_NORMAL=1,r.add(this.normalMap,"NORMAL_MAP",(function(){1!==t.normalMapScale&&(e.NORMAL_MAP_SCALE=1)}))),r.add(this.parallaxMap,"PARALLAX_MAP"),r.add(this.emission,"EMISSION_MAP"),r.add(this.transparency,"TRANSPARENCY_MAP"),this.ignoreTranparent&&(e.IGNORE_TRANSPARENT=1),this.alphaCutoff>0&&(e.ALPHA_CUTOFF=1),this.useHDR&&(e.USE_HDR=1),this.gammaCorrection&&(e.GAMMA_CORRECTION=1),this.receiveShadows&&(e.RECEIVE_SHADOWS=1),this.castShadows&&(e.CAST_SHADOWS=1),this.uvMatrix&&(e.UV_MATRIX=1),this.uvMatrix1&&(e.UV_MATRIX1=1),this.usePhysicsLight&&(e.USE_PHYSICS_LIGHT=1),this.isDiffuesEnvAndAmbientLightWorkTogether&&(e.IS_DIFFUESENV_AND_AMBIENTLIGHT_WORK_TOGETHER=1),r.update(),e},_textureOption:{uvTypes:null,option:null,reset:function(t){return this.option=t,this.uvTypes={},this},add:function(t,e,n){if(t&&t.isTexture){var r=this.uvTypes,i=this.option,a=t.uv||0;r[a]=1,i[e]=a,t.isCubeTexture&&(i["".concat(e,"_CUBE")]=1),n&&n(t)}return this},update:function(){var t=[0,1],e=this.uvTypes,n=this.option;for(var r in e)-1!==t.indexOf(Number(r))?n["HAS_TEXCOORD".concat(r)]=1:(m.a.warnOnce("Material._textureOption.update(".concat(r,")"),"uv_".concat(r," not support!")),n.HAS_TEXCOORD0=1);return this}},getInstancedUniforms:function(){var t=this._instancedUniforms;if(!this._instancedUniforms){var e=this.uniforms;for(var n in t=this._instancedUniforms=[],e){var r=this.getUniformInfo(n);r.isDependMesh&&!r.notSupportInstanced&&t.push({name:n,info:r})}}return t},getUniformData:function(t,e,n){return this.getUniformInfo(t).get(e,this,n)},getAttributeData:function(t,e,n){return this.getAttributeInfo(t).get(e,this,n)},getUniformInfo:function(t){return this.getInfo("uniforms",t)},getAttributeInfo:function(t){return this.getInfo("attributes",t)},getInfo:function(t,e){var n=this[t][e];return"string"==typeof n&&(n=Ge[n]),n&&n.get||(m.a.warnOnce("material.getInfo-"+e,"Material.getInfo: no this semantic:"+e),n=Je),n},clone:function(){var t=new this.constructor;for(var e in this)"id"!==e&&(t[e]=this[e]);return t},destroyTextures:function(){this.getTextures().forEach((function(t){t.destroy()}))},getTextures:function(){var t=[];for(var e in this){var n=this[e];n&&n.isTexture&&t.push(n)}return t},_copyProps:function(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n])}}),tn=a.a.create({Extends:$e,isBasicMaterial:!0,className:"BasicMaterial",lightType:"BLINN-PHONG",diffuse:null,ambient:null,specular:null,emission:null,specularEnvMap:null,specularEnvMatrix:null,reflectivity:0,refractRatio:0,refractivity:0,shininess:32,usedUniformVectors:11,constructor:function(t){this.diffuse=new v.a(.5,.5,.5),this.specular=new v.a(1,1,1),this.emission=new v.a(0,0,0),tn.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_diffuse:"DIFFUSE",u_specular:"SPECULAR",u_ambient:"AMBIENT",u_shininess:"SHININESS",u_reflectivity:"REFLECTIVITY",u_refractRatio:"REFRACTRATIO",u_refractivity:"REFRACTIVITY",u_specularEnvMap:"SPECULARENVMAP",u_specularEnvMatrix:"SPECULARENVMATRIX"}),this.addTextureUniforms({u_diffuse:"DIFFUSE",u_specular:"SPECULAR",u_ambient:"AMBIENT"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};tn.superclass.getRenderOption.call(this,t);var e=this._textureOption.reset(t),n=this.lightType;"PHONG"!==n&&"BLINN-PHONG"!==n||(t.HAS_SPECULAR=1);var r=this.diffuse;return r&&r.isTexture&&(r.isCubeTexture?t.DIFFUSE_CUBE_MAP=1:e.add(this.diffuse,"DIFFUSE_MAP")),t.HAS_LIGHT&&(e.add(this.specular,"SPECULAR_MAP"),e.add(this.ambient,"AMBIENT_MAP"),e.add(this.specularEnvMap,"SPECULAR_ENV_MAP")),e.update(),t}}),en=tn,nn=P.a.POSITION,rn=P.a.NORMAL,an=P.a.DEPTH,sn=P.a.DISTANCE,on=P.a.NONE,un=a.a.create({Extends:en,isGeometryMaterial:!0,className:"GeometryMaterial",vertexType:nn,lightType:on,writeOriginData:!1,constructor:function(t){un.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_cameraFar:"CAMERAFAR",u_cameraNear:"CAMERANEAR",u_cameraType:"CAMERATYPE"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};switch(un.superclass.getRenderOption.call(this,t),t["VERTEX_TYPE_".concat(this.vertexType)]=1,this.vertexType){case nn:t.HAS_FRAG_POS=1;break;case rn:t.HAS_NORMAL=1;break;case an:break;case sn:t.HAS_FRAG_POS=1}return this.writeOriginData&&(t.WRITE_ORIGIN_DATA=1),t}}),cn=un,hn=a.a.create({Extends:O,isOrthographicCamera:!0,className:"OrthographicCamera",_left:-1,left:{get:function(){return this._left},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._left=t}},_right:1,right:{get:function(){return this._right},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._right=t}},_bottom:-1,bottom:{get:function(){return this._bottom},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._bottom=t}},_top:1,top:{get:function(){return this._top},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._top=t}},_near:.1,near:{get:function(){return this._near},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._near=t}},_far:1,far:{get:function(){return this._far},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._far=t}},constructor:function(t){hn.superclass.constructor.call(this,t),this.updateProjectionMatrix()},updateProjectionMatrix:function(){this.projectionMatrix.ortho(this.left,this.right,this.bottom,this.top,this.near,this.far)},getGeometry:function(t){if(t||!this._geometry||this._isGeometryDirty){this._isGeometryDirty=!1;var e=new Z,n=[this.left,this.bottom,-this.near],r=[this.right,this.bottom,-this.near],i=[this.right,this.top,-this.near],a=[this.left,this.top,-this.near],s=[this.left,this.bottom,-this.far],o=[this.right,this.bottom,-this.far],u=[this.right,this.top,-this.far],c=[this.left,this.top,-this.far];e.addRect(s,o,u,c),e.addRect(o,r,i,u),e.addRect(r,n,a,i),e.addRect(n,s,c,a),e.addRect(c,u,i,a),e.addRect(n,r,o,s),this._geometry=e}return this._geometry}}),fn=hn,ln=P.a.DEPTH,dn=P.a.BACK,mn=null,_n=new v.a(1,1,1),pn=new o.a,gn=function(t){return t.material.castShadows},vn=a.a.create({isLightShadow:!0,className:"LightShadow",light:null,renderer:null,framebuffer:null,camera:null,width:1024,height:1024,maxBias:.05,minBias:.005,cameraInfo:null,debug:!1,constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},createFramebuffer:function(){this.framebuffer||(this.framebuffer=new ce(this.renderer,{width:this.width,height:this.height}),this.debug&&this.showShadowMap())},updateLightCamera:function(t){this.light.isDirectionalLight?this.updateDirectionalLightCamera(t):this.light.isSpotLight&&this.updateSpotLightCamera(t)},updateDirectionalLightCamera:function(t){var e=this.light;if(this.camera.lookAt(e.direction),this.cameraInfo)this.updateCustumCamera(this.cameraInfo);else{var n=t.getGeometry();if(n){this.camera.updateViewMatrix(),pn.multiply(this.camera.viewMatrix,t.worldMatrix);var r=n.getBounds(pn);this.camera.near=-r.zMax,this.camera.far=-r.zMin,this.camera.left=r.xMin,this.camera.right=r.xMax,this.camera.bottom=r.yMin,this.camera.top=r.yMax}}this.camera.updateViewMatrix()},updateCustumCamera:function(t){for(var e in t)this.camera[e]=t[e]},updateSpotLightCamera:function(t){var e=this.light;this.camera.lookAt(e.direction),this.cameraInfo?this.updateCustumCamera(this.cameraInfo):(this.camera.fov=2*e.outerCutoff,this.camera.near=.01,this.camera.far=t.far,this.camera.aspect=1),this.camera.updateViewMatrix()},createCamera:function(t){this.camera||(this.light.isDirectionalLight?this.camera=new fn:this.light.isSpotLight&&(this.camera=new Q),this.camera.addTo(this.light)),(this.light.isDirty||this._cameraMatrixVersion!==t.matrixVersion)&&(this.updateLightCamera(t),this._cameraMatrixVersion=t.matrixVersion,this.light.isDirty=!1)},createShadowMap:function(t){this.createFramebuffer(),this.createCamera(t);var e=this.renderer,n=this.framebuffer,r=this.camera;mn||(mn=new cn({vertexType:ln,side:dn,writeOriginData:!0})),n.bind(),e.state.viewport(0,0,this.width,this.height),e.clear(_n),r.updateViewProjectionMatrix(),Ge.setCamera(r),e.forceMaterial=mn,this.renderShadowScene(e),delete e.forceMaterial,n.unbind(),Ge.setCamera(t),e.viewport()},renderShadowScene:function(t){t.renderList.traverse((function(e){gn(e)&&t.renderMesh(e)}),(function(e){t.renderInstancedMeshes(e.filter((function(t){return gn(t)})))}))},showShadowMap:function(){var t=this;this.renderer.on("afterRender",(function(){t.framebuffer.render(0,.7,.3,.3)}))}}),En=P.a.DISTANCE,Tn=P.a.BACK,Mn=P.a.TEXTURE_CUBE_MAP,An=P.a.TEXTURE0,Ln=P.a.TEXTURE_CUBE_MAP_POSITIVE_X,In=P.a.NEAREST,On=P.a.FRAMEBUFFER,Sn=P.a.FRAMEBUFFER_COMPLETE,Rn=null,yn=new v.a(0,0,0,0),Nn=new c.a,xn=[[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,-1,0,0,-1,0,0,0,1,0,0,-1,0,-1,0,0,-1,0]],Cn=function(t,e){if(t.material.castShadows){if(!t.frustumTest)return!0;if(e.isMeshVisible(t))return!0}return!1},bn=a.a.create({isLightShadow:!0,className:"CubeLightShadow",Extends:vn,light:null,renderer:null,framebuffer:null,camera:null,width:1024,height:1024,maxBias:.05,minBias:.005,debug:!1,constructor:function(t){bn.superclass.constructor.call(this,t)},createFramebuffer:function(){if(!this.framebuffer){this.framebuffer=new ce(this.renderer,{target:Mn,width:1024,height:1024,createTexture:function(){var t=this.state.gl,e=new pe({image:[null,null,null,null,null,null],type:this.type,format:this.format,internalFormat:this.internalFormat,magFilter:In,minFilter:In,width:1024,height:1024});return t.checkFramebufferStatus(On)!==Sn&&m.a.warn("Framebuffer is not complete",t.checkFramebufferStatus(On)),e},bindTexture:function(t){t=t||0;var e=this.state,n=e.gl,r=this.texture.getGLTexture(e);e.activeTexture(An+et.MAX_TEXTURE_INDEX),e.bindTexture(this.target,r),n.framebufferTexture2D(On,this.attachment,Ln+t,r,0)}})}},updateLightCamera:function(t){this.camera.fov=90,this.camera.near=t.near,this.camera.far=t.far,this.camera.aspect=1,this.camera.updateViewMatrix()},createCamera:function(t){this.camera||(this.camera=new Q,this.updateLightCamera(t))},createShadowMap:function(t){this.createFramebuffer(),this.createCamera(t);var e=this.renderer,n=this.framebuffer,r=this.camera;Rn||(Rn=new cn({vertexType:En,side:Tn,writeOriginData:!1})),n.bind(),e.state.viewport(0,0,n.width,n.height),this.light.worldMatrix.getTranslation(r.position);for(var i=0;i<6;i++)n.bindTexture(i),Nn.fromArray(xn[0],3*i).add(r.position),r.up.fromArray(xn[1],3*i),r.lookAt(Nn),r.updateViewProjectionMatrix(),e.clear(yn),Ge.setCamera(r),e.forceMaterial=Rn,this.renderShadowScene(e);r.matrix.identity(),r.updateViewProjectionMatrix(),delete e.forceMaterial,n.unbind(),Ge.setCamera(t),e.viewport()},renderShadowScene:function(t){var e=t.renderList,n=this.camera;e.traverse((function(e){Cn(e,n)&&t.renderMesh(e)}),(function(e){var r=e.filter((function(t){return Cn(t,n)}));t.renderInstancedMeshes(r)}))}}),Pn=bn,wn=a.a.create({Extends:M,isPointLight:!0,className:"PointLight",constructor:function(t){wn.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new Pn({light:this,renderer:t}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))}}),Hn=wn,Dn=new o.a,Fn=new c.a,Un=a.a.create({Extends:M,isDirectionalLight:!0,className:"DirectionalLight",constructor:function(t){this.direction=new c.a(0,0,1),Un.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new vn({light:this,renderer:t,width:this.shadow.width||t.width,height:this.shadow.height||t.height,debug:this.shadow.debug,cameraInfo:this.shadow.cameraInfo}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))},getWorldDirection:function(){return Fn.copy(this.direction).transformDirection(this.worldMatrix).normalize(),Fn},getViewDirection:function(t){var e=t.getModelViewMatrix(this,Dn);return Fn.copy(this.direction).transformDirection(e).normalize(),Fn}}),Gn=Un,Bn=new o.a,Vn=new c.a,Xn=a.a.create({Extends:M,isSpotLight:!0,className:"SpotLight",_cutoffCos:.9763,_cutoff:12.5,cutoff:{get:function(){return this._cutoff},set:function(t){this._cutoff=t,this._cutoffCos=Math.cos(d.a.degToRad(t))}},_outerCutoffCos:.9537,_outerCutoff:17.5,outerCutoff:{get:function(){return this._outerCutoff},set:function(t){this._outerCutoff=t,this._outerCutoffCos=Math.cos(d.a.degToRad(t))}},constructor:function(t){this.direction=new c.a(0,0,1),Xn.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new vn({light:this,renderer:t,width:this.shadow.width||t.width,height:this.shadow.height||t.height,debug:this.shadow.debug,cameraInfo:this.shadow.cameraInfo}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))},getWorldDirection:function(){return Vn.copy(this.direction).transformDirection(this.worldMatrix).normalize(),Vn},getViewDirection:function(t){var e=t.getModelViewMatrix(this,Bn);return Vn.copy(this.direction).transformDirection(e).normalize(),Vn}}),jn=Xn,kn=a.a.create({Extends:$e,isShaderMaterial:!0,className:"ShaderMaterial",vs:"",fs:"",useHeaderCache:!1,constructor:function(t){kn.superclass.constructor.call(this,t)},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(kn.superclass.getRenderOption.call(this,t),this.getCustomRenderOption){var e=this.getCustomRenderOption({});for(var n in e)t["HILO_CUSTUM_OPTION_".concat(n)]=e[n]}return t},getCustomRenderOption:null}),zn=kn,Wn=n(15),Yn=n.n(Wn),qn=a.a.create({Extends:Z,isMorphGeometry:!0,className:"MorphGeometry",isStatic:!1,weights:[],targets:null,constructor:function(t){qn.superclass.constructor.call(this,t),this.weights=this.weights||[]},update:function(t,e){this.weights=t,this._originalMorphIndices=e},clone:function(){return Z.prototype.clone.call(this,{targets:this.targets,weights:this.weights})},getRenderOption:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return qn.superclass.getRenderOption.call(this,e),this.targets&&(this._maxMorphTargetCount||(this._maxMorphTargetCount=Math.floor(8/Object.keys(this.targets).length)),Object(i.each)(this.targets,(function(n,r){e.MORPH_TARGET_COUNT=Math.min(n.length,t._maxMorphTargetCount),"vertices"===r?e.MORPH_HAS_POSITION=1:"normals"===r?e.MORPH_HAS_NORMAL=1:"tangents"===r&&(e.MORPH_HAS_TANGENT=1)}))),e}}),Zn=qn,Kn={POSITION:{name:"vertices",decodeMatName:"positionDecodeMat"},TEXCOORD_0:{name:"uvs",decodeMatName:"uvDecodeMat"},TEXCOORD_1:{name:"uvs1",decodeMatName:"uv1DecodeMat"},NORMAL:{name:"normals",decodeMatName:"normalDecodeMat"},JOINT:{name:"skinIndices"},JOINTS_0:{name:"skinIndices"},WEIGHT:{name:"skinWeights"},WEIGHTS_0:{name:"skinWeights"},TANGENT:{name:"tangents"},COLOR_0:{name:"colors"}},Qn={Geometry:Z,GeometryData:b};var Jn={_decodeTotalTime:0,wasmURL:"",workerURL:"",useWASM:!0,useWebWorker:!0,useAuto:!0,init:function(){return Jn.useAuto?Yn.a.initWASM(Jn.wasmURL,Jn.memPages):Jn.useWebWorker?Yn.a.initWorker(Jn.workerURL):Jn.useWASM?Yn.a.initWASM(Jn.wasmURL,Jn.memPages):Promise.resolve()},parse:function(t,e,n,r){var i=Date.now(),a=e.bufferViews[t.bufferView],s=Jn.wasmURL,o=Jn.workerURL,u=Jn.useAuto,c=Jn.useWASM,h=Jn.useWebWorker,f=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);function l(e){Jn._decodeTotalTime+=Date.now()-i;var n=e.toHilo3dGeometry(Qn,r.primitive._geometry);return t.targets&&(n=function(t,e,n){if(!n.isMorphGeometry){var r=new Zn;for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&"id"!==i&&(r[i]=n[i]);r.targets={},n=r}for(var a=n.targets,s=0;s<t.targets.length;s++){var o=t.targets[s];for(var u in o)if(u in Kn){var c=o[u],h=Kn[u].name;a[h]||(a[h]=[]);var f=e.attrs[c];a[h].push(new b(f.data,f.itemCount))}}return t.weights?n.weights=t.weights:n.weights=new Float32Array(t.targets.length),n}(t,e,n)),n}return u?Yn.a.decompress(f,s,o).then(l):h?Yn.a.decompressWithWorker(f,c,s,o).then(l):l(c?Yn.a.decompressWithWASM(f,s):Yn.a.decompressWithJS(f))},freeMemory:function(){Yn.a.destory()}},$n=Jn,tr=P.a.SAMPLER_2D,er={unQuantizeData:function(t,e){if(!e)return t;var n=Math.sqrt(e.length),r=n-1,i=new Float32Array(t.length),a=[];return t.traverse((function(t,s){t.toArray?t.toArray(a):a[0]=t;for(var o=s*r,u=0;u<n;u++){i[o+u]=0;for(var c=0;c<n;c++){var h=c===r?1:a[c];i[o+u]+=e[c*n+u]*h}}})),t.data=i,t.stride=0,t.offset=0,t},parse:function(t,e,n,r){var i=t.decodeMatrix;return r.isDecode?n=er.unQuantizeData(n,i):n.decodeMat=i,n}},nr={parseOnEnd:function(t,e,n){if(!n.anim||e.isMultiAnim)return n;for(var r in t){var i=t[r];n.anim.addClip(r,i[0],i[1])}return n}},rr=nr,ir={parse:function(t,e,n){return t.center=t.max.map((function(e,n){return(e+t.min[n])/2})),t.width=t.max[0]-t.min[0],t.height=t.max[1]-t.min[1],t.depth=t.max[2]-t.min[2],t.size=Math.sqrt(Math.pow(t.width,2)+Math.pow(t.height,2)+Math.pow(t.depth,2)),n.bounds=t,n}},ar={getUsedTextureNameMap:function(t,e){t.diffuseTexture&&(e[t.diffuseTexture.index]=!0),t.specularGlossinessTexture&&(e[t.specularGlossinessTexture.index]=!0)},parse:function(t,e,n){return t.diffuseFactor&&n.baseColor.fromArray(t.diffuseFactor),t.diffuseTexture&&(n.baseColorMap=e.getTexture(t.diffuseTexture)),t.specularFactor&&(n.specular.fromArray(t.specularFactor),n.specular.a=1),"glossinessFactor"in t&&(n.glossiness=t.glossinessFactor),t.specularGlossinessTexture&&(n.specularGlossinessMap=e.getTexture(t.specularGlossinessTexture)),n.isSpecularGlossiness=!0,n}},sr={getUsedTextureNameMap:function(t,e){t.clearcoatTexture&&(e[t.clearcoatTexture.index]=!0),t.clearcoatRoughnessTexture&&(e[t.clearcoatRoughnessTexture.index]=!0),t.clearcoatNormalTexture&&(e[t.clearcoatNormalTexture.index]=!0)},parse:function(t,e,n){return t.clearcoatFactor&&(n.clearcoatFactor=t.clearcoatFactor),t.clearcoatTexture&&(n.clearcoatMap=e.getTexture(t.clearcoatTexture)),t.clearcoatRoughnessFactor&&(n.clearcoatRoughnessFactor=t.clearcoatRoughnessFactor),t.clearcoatRoughnessTexture&&(n.clearcoatRoughnessMap=e.getTexture(t.clearcoatRoughnessTexture)),t.clearcoatNormalTexture&&(n.clearcoatNormalMap=e.getTexture(t.clearcoatNormalTexture)),n}},or={parse:function(t,e,n){if(!e.isUseExtension(e.json,"KHR_lights_punctual")||!e.json.extensions.KHR_lights_punctual.lights)return n;var r,i=e.json.extensions.KHR_lights_punctual.lights[t.light];if(!i)return n;var a=new v.a(1,1,1,1);i.color&&(a.r=i.color[0],a.g=i.color[1],a.b=i.color[2]);var s=void 0!==i.intensity?i.intensity:1,o=i.name||"",u=i.spot||{},c=void 0!==u.innerConeAngle?d.a.radToDeg(u.innerConeAngle):0,h=void 0!==u.outerConeAngle?d.a.radToDeg(u.outerConeAngle):45,f=i.range||0;switch(i.type){case"directional":(r=new Gn({color:a,amount:s,name:o,range:f})).direction.set(0,0,-1);break;case"point":r=new Hn({color:a,amount:s,name:o,range:f});break;case"spot":(r=new jn({color:a,amount:s,name:o,range:f,cutoff:c,outerCutoff:h})).direction.set(0,0,-1);break;default:return n}return r&&(n.addChild(r),e.lights.push(r)),n}},ur={init:function(t,e){var n=[],r=(e.json.extensions||{}).KHR_techniques_webgl||{},a=r.programs||[],s=r.shaders||[],o=r.techniques||[];return e.shaders={},s.forEach((function(r,a){var s=i.getRelativePath(e.src,r.uri);e.preHandlerShaderURI&&(s=e.preHandlerShaderURI(s,a,r)),n.push(t.loadRes(s).then((function(t){e.shaders[a]=t})))})),e.programs={},a.forEach((function(t,n){e.programs[n]=Object.assign({},t)})),e.techniques={},o.forEach((function(t,n){var r=(e.techniques[n]=Object.assign({},t)).textureInfos={},i=t.uniforms||{};for(var a in i){var s=i[a];s.type===tr&&(r[a]=s.value||{})}})),Promise.all(n)},getUsedTextureNameMap:function(t,e,n){var r=n.techniques[t.technique],i=t.values||{};if(r){var a=r.textureInfos;for(var s in a){var o=void 0;i[s]&&void 0!==i[s].index?o=i[s].index:void 0!==a[s].index&&(o=a[s].index),void 0!==o&&(e[o]=!0)}}},parse:function(t,e,n){var r=e.textures||[],i=e.techniques[t.technique];if(!i)return n;var a=e.programs[i.program];if(!a)return n;var s=e.shaders[a.fragmentShader],o=e.shaders[a.vertexShader],u=i.uniforms||{},c=i.attributes||{},h=t.values||{},f={},l={},d=function(t){var n=u[t]||{},i=h[t];void 0===i&&(i=n.value);var a=void 0;if(void 0!==i)if(n.type===tr){var s=i.index||0;a={get:function(t,e,n){return Ge.handlerTexture(r[s],n.textureIndex)}}}else a={get:function(){return i}};else if(n.semantic&&Ge[n.semantic]){var o,c=Ge[n.semantic],f=n.node;a=void 0!==f?{get:function(t,n,r){return void 0===o&&(o=e.node.getChildByFn((function(t){return t.animationId===f}))||t),c.get(o,n,r)}}:n.semantic}l[t]=a};for(var m in u)d(m);for(var _ in c){var p=c[_]||{};p.semantic&&(f[_]=p.semantic)}var g=new zn({needBasicUnifroms:!1,needBasicAttributes:!1,useHeaderCache:!0,vs:o,fs:s,attributes:f,uniforms:l});return void 0!==t.premultiplyAlpha&&(g.premultiplyAlpha=t.premultiplyAlpha),t.defines&&(g.getCustomRenderOption=function(){return t.defines}),void 0!==a.name&&(g.shaderName=a.name,g.shaderCacheId="KHR_techniques_webgl_".concat(a.name)),g}},cr=new Float32Array(2),hr=a.a.create({isFog:!0,className:"Fog",mode:"LINEAR",start:5,end:10,density:.1,constructor:function(t){this.id=d.a.generateUUID(this.className),this.color=new v.a(1,1,1,1),Object.assign(this,t)},getInfo:function(){return"LINEAR"===this.mode?(cr[0]=this.start,cr[1]=this.end,cr):this.density},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t["FOG_".concat(this.mode)]=1,t}}),fr=n(16),lr=new fr.a,dr=new o.a,mr=a.a.create({Extends:g,isMesh:!0,className:"Mesh",geometry:null,material:null,useInstanced:!1,frustumTest:!0,constructor:function(t){mr.superclass.constructor.call(this,t)},clone:function(t){var e=g.prototype.clone.call(this,t);return Object.assign(e,{geometry:this.geometry,material:this.material}),e},raycast:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.visible)return null;var n=this.geometry,r=this.material,i=this.worldMatrix;if(n&&r){dr.invert(i),lr.copy(t),lr.transformMat4(dr);var a=n.raycast(lr,r.side,e);if(a)return a.forEach((function(t){t.transformMat4(i)})),a}return null},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.geometry.getRenderOption(t),t},isDestroyed:{get:function(){return this._isDestroyed}},destroy:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this._isDestroyed)return this;this.removeFromParent();var n=t.resourceManager;return n.destroyMesh(this),this.material&&e&&this.material.destroyTextures(),this.off(),this.geometry=null,this.material=null,this._isDestroyed=!0,this}}),_r=mr,pr=new o.a,gr=new o.a,vr=a.a.create({Extends:_r,isSkinedMesh:!0,className:"SkinedMesh",useInstanced:!1,jointMatTexture:null,frustumTest:!1,skeleton:null,constructor:function(t){vr.superclass.constructor.call(this,t)},getJointMat:function(){var t=this;if(this.skeleton&&!(this.skeleton.jointCount<=0)){var e=this.skeleton.jointNodeList,n=this.skeleton.inverseBindMatrices,r=16*this.skeleton.jointCount;return this.jointMat&&this.jointMat.length===r||(this.jointMat=new Float32Array(r)),this.clonedFrom?gr.invert(this.clonedFrom.worldMatrix):gr.invert(this.worldMatrix),e.forEach((function(e,r){pr.copy(gr),pr.multiply(e.worldMatrix),pr.multiply(n[r]),pr.toArray(t.jointMat,16*r)})),this.jointMat}},resetJointNamesByNodeName:function(t){this.skeleton.resetJointNamesByNodeName(t)},resetSkinIndices:function(t){var e=this.skeleton;if(e){var n=this.geometry,r=n.skinIndices;if(r){this.material.isDirty=!0,n.isDirty=!0,r.isDirty=!0;var i=new R.a;r.traverse((function(n,a,s){n.elements.forEach((function(n,r){var a=e.jointNames[n],s=t.jointNames.indexOf(a);s>=0?i.elements[r]=s:m.a.warnOnce("SkinedMesh.resetSkinIndices","SkinedMesh.resetSkinIndices: no jointName found!",a)})),r.setByOffset(s,i)}))}}},initJointMatTexture:function(){if(!this.jointMatTexture){var t=this.getJointMat();this.jointMatTexture=new Le({data:t})}return this.jointMatTexture},updateJointMatTexture:function(){if(this.jointMatTexture){var t=this.getJointMat();this.jointMatTexture.data.set(t,0),this.jointMatTexture.needUpdate=!0}else this.initJointMatTexture()},clone:function(t){var e=_r.prototype.clone.call(this,t);return Object.assign(e,{useInstanced:this.useInstanced,skeleton:this.skeleton.clone()}),e.clonedFrom=this,e},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};vr.superclass.getRenderOption.call(this,t);var e=this.skeleton.jointCount;if(e&&(t.JOINT_COUNT=e,et.VERTEX_TEXTURE_FLOAT)){var n=(et.MAX_VERTEX_UNIFORM_VECTORS-22)/4;e>n&&(t.JOINT_MAT_MAP=1)}return t}}),Er=vr,Tr=a.a.create({isSkeleton:!0,className:"Skeleton",userData:null,constructor:function(t){this.id=d.a.generateUUID(this.className),this.jointNodeList=[],this.jointNames=[],this.inverseBindMatrices=[],Object.assign(this,t)},jointCount:{get:function(){return this.jointNodeList.length}},_rootNode:null,rootNode:{get:function(){return this._rootNode},set:function(t){this._rootNode=t,t&&this._initJointNodeList()}},_initJointNodeList:function(){var t={};this.rootNode.traverse((function(e){t[e.jointName]=e})),this.jointNodeList=this.jointNames.map((function(e){return t[e]}))},resetJointNamesByNodeName:function(t){var e=this.jointNames;this.jointNodeList.forEach((function(n,r){var i=t.rootNode.getChildByName(n.name);i&&(e[r]=i.jointName)}))},clone:function(t){var e=new Tr;return e.copy(this,t),e},copy:function(t,e){return this.inverseBindMatrices=t.inverseBindMatrices,this.jointNames=t.jointNames.slice(),void 0===e&&(e=t.rootNode),this.rootNode=e,this}}),Mr=Tr,Ar="1.16.1",Lr=a.a.create({className:"RenderInfo",isRenderInfo:!0,constructor:function(){this.reset()},addFaceCount:function(t){this._currentFaceCount+=t},addDrawCount:function(t){this._currentDrawCount+=t},reset:function(){this.faceCount=Math.floor(this._currentFaceCount),this.drawCount=Math.floor(this._currentDrawCount),this._currentFaceCount=0,this._currentDrawCount=0}}),Ir=new c.a,Or=function(t,e){var n=t.material.renderOrder,r=e.material.renderOrder;if(n!==r)return n-r;var i=t.material._shaderNumId||0,a=e.material._shaderNumId||0;return i!==a?i-a:t._sortRenderZ-e._sortRenderZ},Sr=function(t,e){var n=t.material.renderOrder,r=e.material.renderOrder;return n!==r?n-r:e._sortRenderZ-t._sortRenderZ},Rr=a.a.create({className:"RenderList",isRenderList:!0,useInstanced:!1,constructor:function(){this.opaqueList=[],this.transparentList=[],this.instancedDict={}},reset:function(){this.opaqueList.length=0,this.transparentList.length=0,this.instancedDict={}},traverse:function(t,e){this.opaqueList.forEach((function(e){t(e)}));var n=this.instancedDict;for(var r in n){var i=n[r];i.length>2&&e?e(i):i.forEach((function(e){t(e)}))}this.transparentList.forEach((function(e){t(e)}))},sort:function(){this.transparentList.sort(Sr),this.opaqueList.sort(Or)},addMesh:function(t,e){var n=t.material,r=t.geometry;if(n&&r){if(t.frustumTest&&!e.isMeshVisible(t))return;if(this.useInstanced&&t.useInstanced){var i=this.instancedDict,a=n.id+"_"+r.id,s=i[a];i[a]||(s=i[a]=[]),s.push(t)}else t.worldMatrix.getTranslation(Ir),Ir.transformMat4(e.viewProjectionMatrix),t._sortRenderZ=Ir.z,n.transparent?this.transparentList.push(t):this.opaqueList.push(t)}else m.a.warnOnce("RenderList.addMesh(".concat(t.id,")"),"Mesh must have material and geometry",t)}}),yr=a.a.create({className:"WebGLState",isWebGLState:!0,systemFramebuffer:null,constructor:function(t){this.gl=t,this.reset()},reset:function(){this._dict={},this.activeTextureIndex=null,this.textureUnitDict={},this.currentFramebuffer=null,this.preFramebuffer=null,this._pixelStorei={}},enable:function(t){!0!==this._dict[t]&&(this._dict[t]=!0,this.gl.enable(t))},disable:function(t){!1!==this._dict[t]&&(this._dict[t]=!1,this.gl.disable(t))},bindFramebuffer:function(t,e){this.currentFramebuffer!==e&&(this.preFramebuffer=this.currentFramebuffer,this.currentFramebuffer=e,this.gl.bindFramebuffer(t,e))},bindSystemFramebuffer:function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,this.systemFramebuffer)},useProgram:function(t){this.set1("useProgram",t)},depthFunc:function(t){this.set1("depthFunc",t)},depthMask:function(t){this.set1("depthMask",t)},clear:function(t){this.gl.clear(t)},depthRange:function(t,e){this.set2("depthRange",t,e)},stencilFunc:function(t,e,n){this.set3("stencilFunc",t,e,n)},stencilMask:function(t){this.set1("stencilMask",t)},stencilOp:function(t,e,n){this.set3("stencilOp",t,e,n)},colorMask:function(t,e,n,r){this.set4("colorMask",t,e,n,r)},cullFace:function(t){this.set1("cullFace",t)},frontFace:function(t){this.set1("frontFace",t)},blendFuncSeparate:function(t,e,n,r){this.set4("blendFuncSeparate",t,e,n,r)},blendEquationSeparate:function(t,e){this.set2("blendEquationSeparate",t,e)},pixelStorei:function(t,e){this._pixelStorei[t]!==e&&(this._pixelStorei[t]=e,this.gl.pixelStorei(t,e))},viewport:function(t,e,n,r){this.set4("viewport",t,e,n,r)},activeTexture:function(t){this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},bindTexture:function(t,e){var n=this.getActiveTextureUnit();n[t]!==e&&(n[t]=e,this.gl.bindTexture(t,e))},getActiveTextureUnit:function(){var t=this.textureUnitDict[this.activeTextureIndex];return t||(t=this.textureUnitDict[this.activeTextureIndex]={}),t},set1:function(t,e){this._dict[t]!==e&&(this._dict[t]=e,this.gl[t](e))},set2:function(t,e,n){var r=this._dict[t];r||(r=this._dict[t]=[]),r[0]===e&&r[1]===n||(r[0]=e,r[1]=n,this.gl[t](e,n))},set3:function(t,e,n,r){var i=this._dict[t];i||(i=this._dict[t]=[]),i[0]===e&&i[1]===n&&i[2]===r||(i[0]=e,i[1]=n,i[2]=r,this.gl[t](e,n,r))},set4:function(t,e,n,r,i){var a=this._dict[t];a||(a=this._dict[t]=[]),a[0]===e&&a[1]===n&&a[2]===r&&a[3]===i||(a[0]=e,a[1]=n,a[2]=r,a[3]=i,this.gl[t](e,n,r,i))},get:function(t){return this._dict[t]}}),Nr=a.a.create({Mixes:s.a,className:"WebGLResourceManager",isWebGLResourceManager:!0,hasNeedDestroyResource:!1,constructor:function(t){this._needDestroyResources=[],Object.assign(this,t)},destroyMesh:function(t){var e=this;this.getMeshResources(t).forEach((function(t){e.destroyIfNoRef(t)})),t._vao=t._program=t._shader=null},getMeshResources:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t._shader&&e.push(t._shader),t._vao&&(e.push(t._vao),t._vao.getResources(e)),t._program&&e.push(t._program),e},destroyIfNoRef:function(t){var e=this._needDestroyResources;return t&&e.indexOf(t)<0&&e.push(t),this},getUsedResources:function(t){var e=this,n=[];return t&&t.traverse((function(t){t.isMesh&&!t.isDestroyed&&e.getMeshResources(t,n)})),n},destroyUnsuedResource:function(t){var e=this,n=this._needDestroyResources;if(0===n.length)return this;var r=this.getUsedResources(t);return n.forEach((function(t){r.indexOf(t)<0&&t&&t.destroy&&!t.alwaysUse&&(e.fire("destroyResource",t.id),t.destroy())})),this.reset(),this},reset:function(){return this._needDestroyResources.length=0,this}}),xr=new o.a,Cr=new c.a,br=new Float32Array([0,0,0]),Pr=a.a.create({isLightManager:!0,className:"LightManager",constructor:function(t){this.ambientLights=[],this.directionalLights=[],this.pointLights=[],this.spotLights=[],this.areaLights=[],this.lightInfo={AMBIENT_LIGHTS:0,POINT_LIGHTS:0,DIRECTIONAL_LIGHTS:0,SPOT_LIGHTS:0,AREA_LIGHTS:0,uid:0},Object.assign(this,t)},getRenderOption:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object(i.each)(this.lightInfo,(function(n,r){if("uid"!==r&&n){e[r]=n;var i=t.getShadowMapCount(r);i&&(e[r+"_SMC"]=i)}})),e},addLight:function(t){var e=null;return t.enabled?(t.isAmbientLight?e=this.ambientLights:t.isDirectionalLight?e=this.directionalLights:t.isPointLight?e=this.pointLights:t.isSpotLight?e=this.spotLights:t.isAreaLight?e=this.areaLights:m.a.warnOnce("LightManager.addLight(".concat(t.id,")"),"Not support this light:",t),e&&(t.shadow?e.unshift(t):e.push(t)),this):this},getDirectionalInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[];this.directionalLights.forEach((function(o,u){var c=3*u;o.getRealColor().toRGBArray(e,c),o.getViewDirection(t).toArray(n,c),o.shadow&&o.lightShadow&&(r.push(o.lightShadow.framebuffer.texture),i.push(o.lightShadow.width),i.push(o.lightShadow.height),s.push(o.lightShadow.minBias,o.lightShadow.maxBias),xr.copy(t.worldMatrix),xr.premultiply(o.lightShadow.camera.viewProjectionMatrix),xr.toArray(a,16*u))}));var o={colors:new Float32Array(e),infos:new Float32Array(n)};return r.length&&(o.shadowMap=r,o.shadowMapSize=new Float32Array(i),o.shadowBias=new Float32Array(s),o.lightSpaceMatrix=new Float32Array(a)),o},getSpotInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[],o=[],u=[],c=[],h=[];this.spotLights.forEach((function(f,l){var d=3*l;f.getRealColor().toRGBArray(e,d),f.toInfoArray(n,d),f.getViewDirection(t).toArray(i,d),h.push(f.range),a.push(f._cutoffCos,f._outerCutoffCos),t.getModelViewMatrix(f,xr),xr.getTranslation(Cr),Cr.toArray(r,d),f.shadow&&f.lightShadow&&(s.push(f.lightShadow.framebuffer.texture),o.push(f.lightShadow.width),o.push(f.lightShadow.height),c.push(f.lightShadow.minBias,f.lightShadow.maxBias),xr.multiply(f.lightShadow.camera.viewProjectionMatrix,t.worldMatrix),xr.toArray(u,16*l))}));var f={colors:new Float32Array(e),infos:new Float32Array(n),poses:new Float32Array(r),dirs:new Float32Array(i),cutoffs:new Float32Array(a),ranges:new Float32Array(h)};return s.length&&(f.shadowMap=s,f.shadowMapSize=new Float32Array(o),f.shadowBias=new Float32Array(c),f.lightSpaceMatrix=new Float32Array(u)),f},getPointInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[],o=[],u=[];this.pointLights.forEach((function(c,h){var f=3*h;c.getRealColor().toRGBArray(e,f),c.toInfoArray(n,f),u.push(c.range),t.getModelViewMatrix(c,xr),xr.getTranslation(Cr),Cr.toArray(r,f),c.shadow&&c.lightShadow&&(i.push(c.lightShadow.framebuffer.texture),s.push(c.lightShadow.minBias,c.lightShadow.maxBias),t.worldMatrix.toArray(a,16*h),o[2*h]=c.lightShadow.camera.near,o[2*h+1]=c.lightShadow.camera.far)}));var c={colors:new Float32Array(e),infos:new Float32Array(n),poses:new Float32Array(r),ranges:new Float32Array(u)};return i.length&&(c.shadowMap=i,c.shadowBias=new Float32Array(s),c.lightSpaceMatrix=new Float32Array(a),c.cameras=new Float32Array(o)),c},getAreaInfo:function(t){var e,n,r=[],i=[],a=[],s=[];return this.areaLights.forEach((function(o,u){var c=3*u;o.getRealColor().toRGBArray(r,c),t.getModelViewMatrix(o,xr),xr.getTranslation(Cr),Cr.toArray(i,c);var h=xr.getRotation();xr.fromQuat(h),Cr.set(.5*o.width,0,0),Cr.transformMat4(xr),Cr.toArray(a,c),Cr.set(0,.5*o.height,0),Cr.transformMat4(xr),Cr.toArray(s,c),e=o.ltcTexture1,n=o.ltcTexture2})),{colors:new Float32Array(r),poses:new Float32Array(i),width:new Float32Array(a),height:new Float32Array(s),ltcTexture1:e,ltcTexture2:n}},getAmbientInfo:function(){return br[0]=br[1]=br[2]=0,this.ambientLights.forEach((function(t){var e=t.getRealColor();br[0]+=e.r,br[1]+=e.g,br[2]+=e.b})),br[0]=Math.min(1,br[0]),br[1]=Math.min(1,br[1]),br[2]=Math.min(1,br[2]),br},updateInfo:function(t){var e=this.lightInfo,n=this.ambientLights,r=this.directionalLights,i=this.pointLights,a=this.spotLights,s=this.areaLights;e.AMBIENT_LIGHTS=n.length,e.POINT_LIGHTS=i.length,e.DIRECTIONAL_LIGHTS=r.length,e.SPOT_LIGHTS=a.length,e.AREA_LIGHTS=s.length;var o=function(t){return!!t.shadow};e.SHADOW_POINT_LIGHTS=i.filter(o).length,e.SHADOW_SPOT_LIGHTS=a.filter(o).length,e.SHADOW_DIRECTIONAL_LIGHTS=r.filter(o).length,e.uid=[e.AMBIENT_LIGHTS,e.POINT_LIGHTS,e.SHADOW_POINT_LIGHTS,e.DIRECTIONAL_LIGHTS,e.SHADOW_DIRECTIONAL_LIGHTS,e.SPOT_LIGHTS,e.SHADOW_SPOT_LIGHTS,e.AREA_LIGHTS].join("_"),this.directionalInfo=this.getDirectionalInfo(t),this.pointInfo=this.getPointInfo(t),this.spotInfo=this.getSpotInfo(t),this.areaInfo=this.getAreaInfo(t),this.ambientInfo=this.getAmbientInfo()},getInfo:function(){return this.lightInfo},reset:function(){this.ambientLights.length=0,this.directionalLights.length=0,this.pointLights.length=0,this.spotLights.length=0,this.areaLights.length=0},getShadowMapCount:function(t){var e=[];"POINT_LIGHTS"===t?e=this.pointLights:"DIRECTIONAL_LIGHTS"===t?e=this.directionalLights:("SPOT_LIGHTS"===t||"AREA_LIGHTS"===t)&&(e=this.spotLights);var n=0;return e.forEach((function(t){n+=t.shadow?1:0})),n},createShadowMap:function(t,e){this.directionalLights.forEach((function(n){n.createShadowMap(t,e)})),this.spotLights.forEach((function(n){n.createShadowMap(t,e)})),this.pointLights.forEach((function(n){n.createShadowMap(t,e)})),this.areaLights.forEach((function(n){n.createShadowMap(t,e)}))}}),wr=P.a.DEPTH_TEST,Hr=P.a.STENCIL_TEST,Dr=P.a.SAMPLE_ALPHA_TO_COVERAGE,Fr=P.a.CULL_FACE,Ur=P.a.FRONT_AND_BACK,Gr=P.a.BLEND,Br=P.a.LINES,Vr=P.a.STATIC_DRAW,Xr=P.a.DYNAMIC_DRAW,jr=a.a.create({Mixes:s.a,className:"WebGLRenderer",isWebGLRenderer:!0,gl:null,width:0,height:0,pixelRatio:1,domElement:null,useInstanced:!1,useVao:!0,alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,failIfMajorPerformanceCaveat:!1,gameMode:!1,useFramebuffer:!1,framebufferOption:{},useLogDepth:!1,vertexPrecision:"highp",fragmentPrecision:"highp",fog:null,offsetX:0,offsetY:0,isInitFailed:!1,_isInit:!1,_isContextLost:!1,constructor:function(t){this.clearColor=new v.a(1,1,1),Object.assign(this,t),this.renderInfo=new Lr,this.renderList=new Rr,this.lightManager=new Pr,this.resourceManager=new Nr},resize:function(t,e,n){if(n||this.width!==t||this.height!==e){var r=this.domElement;this.width=t,this.height=e,r.width=t,r.height=e,this.framebuffer&&this.framebuffer.resize(this.width,this.height,n),this.viewport()}},setOffset:function(t,e){this.offsetX===t&&this.offsetY===e||(this.offsetX=t,this.offsetY=e,this.viewport())},viewport:function(t,e,n,r){var i=this.state,a=this.gl;i&&(void 0===t?t=this.offsetX:this.offsetX=t,void 0===e?e=this.offsetY:this.offsetY=e,void 0===n&&(n=a.drawingBufferWidth),void 0===r&&(r=a.drawingBufferHeight),i.viewport(t,e,n,r))},isInit:{get:function(){return this._isInit&&!this.isInitFailed}},onInit:function(t){var e=this;this._isInit?t(this):this.on("init",(function(){t(e)}),!0)},initContext:function(){if(!this._isInit){this._isInit=!0;try{this._initContext(),this.fire("init")}catch(t){this.isInitFailed=!0,this.fire("initFailed",t)}}},_initContext:function(){var t=this,e={alpha:this.alpha,depth:this.depth,stencil:this.stencil,antialias:this.antialias,premultipliedAlpha:this.premultipliedAlpha,failIfMajorPerformanceCaveat:this.failIfMajorPerformanceCaveat};!0===this.preserveDrawingBuffer&&(e.preserveDrawingBuffer=!0),!0===this.gameMode&&(e.gameMode=!0);var n=this.gl=this.domElement.getContext("webgl",e);n.viewport(0,0,this.width,this.height),Tt.init(n),tt.init(n),et.init(n),dt.init(this),this.state=new yr(n),tt.instanced||(this.useInstanced=!1),this.renderList.useInstanced=this.useInstanced,tt.vao||(this.useVao=!1),this.useFramebuffer&&(this.framebuffer=new ce(this,Object.assign({useVao:this.useVao,width:this.width,height:this.height},this.framebufferOption))),this.domElement.addEventListener("webglcontextlost",(function(e){t._onContextLost(e)}),!1),this.domElement.addEventListener("webglcontextrestored",(function(e){t._onContextRestore(e)}),!1)},_onContextLost:function(t){var e=this.gl;this._isContextLost=!0,t.preventDefault(),Lt.reset(e),dt.reset(e),Qt.reset(e),Nt.reset(e),Ft.reset(e),this.state.reset(e),this._lastMaterial=null,this._lastProgram=null,this.fire("webglContextLost")},_onContextRestore:function(t){var e=this.gl;this._isContextLost=!1,tt.reset(e),ce.reset(e),this.fire("webglContextRestored")},setupDepthTest:function(t){var e=this.state;t.depthTest?(e.enable(wr),e.depthFunc(t.depthFunc),e.depthMask(t.depthMask),e.depthRange(t.depthRange[0],t.depthRange[1])):e.disable(wr)},setupSampleAlphaToCoverage:function(t){var e=this.state;t.sampleAlphaToCoverage?e.enable(Dr):e.disable(Dr)},setupCullFace:function(t){var e=this.state;t.cullFace&&t.cullFaceType!==Ur?(e.enable(Fr),e.cullFace(t.cullFaceType),e.frontFace(t.frontFace)):e.disable(Fr)},setupBlend:function(t){var e=this.state;t.blend?(e.enable(Gr),e.blendFuncSeparate(t.blendSrc,t.blendDst,t.blendSrcAlpha,t.blendDstAlpha),e.blendEquationSeparate(t.blendEquation,t.blendEquationAlpha)):e.disable(Gr)},setupStencil:function(t){if(this.stencil){var e=this.state;t.stencilTest?(e.enable(Hr),e.stencilMask(t.stencilMask),e.stencilFunc(t.stencilFunc,t.stencilFuncRef,t.stencilFuncMask),e.stencilOp(t.stencilOpFail,t.stencilOpZFail,t.stencilOpZPass)):e.disable(Hr)}},setupUniforms:function(t,e,n,r){var i=this.forceMaterial||e.material;for(var a in t.uniforms){var s=i.getUniformInfo(a),o=t.uniforms[a];if(!s.isBlankInfo&&(r||s.isDependMesh&&!n)){var u=s.get(e,i,o);null!=u&&(t[a]=u)}}},setupVao:function(t,e,n){var r=n.geometry,i=r.isStatic;if(t.isDirty||!i||r.isDirty){t.isDirty=!1;var a=this.forceMaterial||n.material,s=a.attributes,o=i?Vr:Xr;for(var u in s){var c=e.attributes[u];if(c){var h=a.getAttributeData(u,n,c);null!=h&&t.addAttribute(h,c,o)}}r.indices&&t.addIndexBuffer(r.indices,o),r.isDirty=!1}r.vertexCount&&(t.vertexCount=r.vertexCount)},setupMaterial:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=this.forceMaterial||e.material;(i.isDirty||this._lastMaterial!==i)&&(this.setupDepthTest(i),this.setupSampleAlphaToCoverage(i),this.setupCullFace(i),this.setupBlend(i),this.setupStencil(i),r=!0),this.setupUniforms(t,e,n,r),i.isDirty=!1,this._lastMaterial=i},setupMesh:function(t,e){var n=this.gl,r=this.state,i=this.lightManager,a=t.geometry,s=this.forceMaterial||t.material,o=dt.getShader(t,s,e,i,this.fog,this.useLogDepth),u=Lt.getProgram(o,r);u.useProgram(),this.setupMaterial(u,t,e,this._lastProgram!==u),this._lastProgram=u,t.material.wireframe&&a.mode!==Br&&a.convertToLinesMode();var c=a.id+u.id,h=Ft.getVao(n,c,{useInstanced:e,useVao:this.useVao,mode:a.mode});return this.setupVao(h,u,t),t._vao=h,t._shader=o,t._program=u,{vao:h,program:u,geometry:a}},addRenderInfo:function(t,e){var n=this.renderInfo;n.addFaceCount(t),n.addDrawCount(e)},render:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.initContext(),!this.isInitFailed&&!this._isContextLost){var r=this.renderList,i=this.renderInfo,a=this.lightManager,s=this.resourceManager,o=this.state;this.fog=t.fog,a.reset(),i.reset(),r.reset(),Ge.init(this,o,e,a,this.fog),t.updateMatrixWorld(),e.updateViewProjectionMatrix(),t.traverse((function(t){return t.visible?(t.isMesh?r.addMesh(t,e):t.isLight&&a.addLight(t),g.TRAVERSE_STOP_NONE):g.TRAVERSE_STOP_CHILDREN})),r.sort(),a.createShadowMap(this,e),a.updateInfo(e),n&&this.fire("beforeRender"),this.useFramebuffer&&this.framebuffer.bind(),this.clear(),n&&this.fire("beforeRenderScene"),this.renderScene(),this.useFramebuffer&&this.renderToScreen(this.framebuffer),n&&this.fire("afterRender"),s.destroyUnsuedResource(t)}},renderScene:function(){var t=this;this.renderList.traverse((function(e){t.renderMesh(e)}),(function(e){t.renderInstancedMeshes(e)})),this._gameModeSumbit()},_gameModeSumbit:function(){var t=this.gl;this.gameMode&&t&&t.submit&&t.submit()},clear:function(t){var e=this.gl,n=this.state;t=t||this.clearColor,this._lastMaterial=null,this._lastProgram=null,e.clearColor(t.r,t.g,t.b,t.a),n.depthMask(!0);var r=e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT;this.stencil&&(n.stencilMask(!0),r|=e.STENCIL_BUFFER_BIT),e.clear(r)},clearDepth:function(){var t=this.gl;this.state.depthMask(!0),t.clear(t.DEPTH_BUFFER_BIT)},clearStencil:function(){var t=this.gl;this.state.stencilMask(!0),t.clear(t.STENCIL_BUFFER_BIT)},renderToScreen:function(t){this.state.bindSystemFramebuffer(),t.render(0,0,1,1,this.clearColor)},renderMesh:function(t){var e=this.setupMesh(t,!1).vao;e.draw(),this.addRenderInfo(e.vertexCount/3,1)},renderInstancedMeshes:function(t){var e=t[0];if(e){var n=this.forceMaterial||e.material,r=this.setupMesh(e,!0),i=r.vao,a=r.program;n.getInstancedUniforms().forEach((function(e){var n=e.name,r=e.info,s=a.attributes[n];s&&i.addInstancedAttribute(s,t,(function(t){return r.get(t)}))})),i.drawInstance(t.length),this.addRenderInfo(i.vertexCount/3*t.length,1)}},renderMultipleMeshes:function(t){var e=this;t.forEach((function(t){e.renderMesh(t)}))},releaseGLResource:function(){var t=this.gl;t&&(Lt.reset(t),dt.reset(t),Nt.reset(t),Ft.reset(t),this.state.reset(t),Qt.reset(t),ce.destroy(t))}}),kr=function(){var t,e=navigator.userAgent,n=document,r=window,i=n.documentElement,a={iphone:/iphone/i.test(e),ipad:/ipad/i.test(e),ipod:/ipod/i.test(e),ios:/iphone|ipad|ipod/i.test(e),android:/android/i.test(e),webkit:/webkit/i.test(e),chrome:/chrome/i.test(e),safari:/safari/i.test(e),firefox:/firefox/i.test(e),ie:/msie/i.test(e),opera:/opera/i.test(e),supportTouch:"ontouchstart"in r,supportCanvas:!!n.createElement("canvas").getContext,supportStorage:void 0,supportOrientation:"orientation"in r||"orientation"in r.screen,supportDeviceMotion:"ondevicemotion"in r};try{localStorage.setItem("hilo","hilo"),localStorage.removeItem("hilo"),a.supportStorage=!0}catch(t){a.supportStorage=!1,m.a.warn("LocalStorage disabled")}t=a.webkit||a.firefox?"webkit":a.opera?"o":a.ie?"ms":"",a.jsVendor=t;var s=a.cssVendor="-"+t+"-",o=n.createElement("div"),u=o.style,c=void 0!==u[t+"Transform"],h=void 0!==u[t+"Perspective"];h&&(o.id="test3d",(u=n.createElement("style")).textContent="@media ("+s+"transform-3d){#test3d{height:3px}}",n.head.appendChild(u),i.appendChild(o),h=3===o.offsetHeight,n.head.removeChild(u),i.removeChild(o)),a.supportTransform=c,a.supportTransform3D=h;var f=a.supportTouch,l=f?"touchstart":"mousedown",d=f?"touchmove":"mousemove",_=f?"touchend":"mouseup";return a.POINTER_START=l,a.POINTER_MOVE=d,a.POINTER_END=_,a}(),zr=a.a.create({Extends:g,isStage:!0,className:"Stage",renderer:null,camera:null,pixelRatio:null,offsetX:0,offsetY:0,width:0,height:0,canvas:null,constructor:function(t){if(t.width||(t.width=window.innerWidth),t.height||(t.height=window.innerHeight),!t.pixelRatio){var e=window.devicePixelRatio||1;e=Math.min(e,1024/Math.max(t.width,t.height),2),e=Math.max(e,1),t.pixelRatio=e}zr.superclass.constructor.call(this,t),this.initRenderer(t),m.a.log("Hilo3d version: ".concat(Ar))},initRenderer:function(t){var e=this.canvas=this.createCanvas(t);this.renderer=new jr(Object.assign(t,{domElement:e})),this.resize(this.width,this.height,this.pixelRatio,!0)},createCanvas:function(t){var e;return e=t.canvas?t.canvas:document.createElement("canvas"),t.container&&t.container.appendChild(e),e},resize:function(t,e,n,r){if(void 0===n&&(n=this.pixelRatio),r||this.width!==t||this.height!==e||this.pixelRatio!==n){this.width=t,this.height=e,this.pixelRatio=n,this.rendererWidth=t*n,this.rendererHeight=e*n;var i=this.canvas;this.renderer.resize(this.rendererWidth,this.rendererHeight,r),i.style.width=this.width+"px",i.style.height=this.height+"px",this.updateDomViewport()}return this},setOffset:function(t,e){if(this.offsetX!==t||this.offsetY!==e){this.offsetX=t,this.offsetY=e;var n=this.pixelRatio;this.renderer.setOffset(t*n,e*n)}return this},viewport:function(t,e,n,r){return this.resize(n,r,this.pixelRatio,!0),this.setOffset(t,e),this},tick:function(t){return this.traverseUpdate(t),this.camera&&this.renderer.render(this,this.camera,!0),this},enableDOMEvent:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.canvas,i=this._domListener||(this._domListener=function(t){e._onDOMEvent(t)});return(t="string"==typeof t?[t]:t).forEach((function(t){n?r.addEventListener(t,i,!1):r.removeEventListener(t,i)})),this},_onDOMEvent:function(t){var e=this.canvas,n=this._eventTarget,r=t.type,i=0===r.indexOf("touch"),a=t;if(i){var s=t.touches,o=t.changedTouches;s&&s.length?a=s[0]:o&&o.length&&(a=o[0])}var u=this.domViewport||this.updateDomViewport(),c=(a.pageX||a.clientX)-u.left,h=(a.pageY||a.clientY)-u.top;t.stageX=c,t.stageY=h,t.stopPropagation=function(){this._stopPropagationed=!0};var f=this.getMeshResultAtPoint(c,h,!0),l=f.mesh;t.hitPoint=f.point;var d="mouseout"===r;if(n&&(n!==l&&(!n.contains||!n.contains(l))||d)){var m=!1;if("touchmove"===r?m="touchout":"mousemove"!==r&&!d&&l||(m="mouseout"),m){var _=Object.assign({},t);_.type=m,_.eventTarget=n,n._fireMouseEvent(_)}t.lastEventTarget=n,this._eventTarget=null}if(l&&l.pointerEnabled&&"mouseout"!==r&&(t.eventTarget=this._eventTarget=l,l._fireMouseEvent(t)),!i){var p=l&&l.pointerEnabled&&l.useHandCursor?"pointer":"";e.style.cursor=p}kr.android&&"touchmove"===r&&t.preventDefault()},updateDomViewport:function(){var t=this.canvas,e=null;return t.parentNode&&(e=this.domViewport=Object(i.getElementRect)(t)),e},getMeshResultAtPoint:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.camera,i=this._ray;i||(i=this._ray=new fr.a),i.fromCamera(r,t,e,this.width,this.height);var a=this.raycast(i,!0,n);if(a)return a[0];this._stageResultAtPoint||(this._stageResultAtPoint={mesh:this,point:new c.a});var s=this._stageResultAtPoint.point;return s.copy(r.unprojectVector(s.set(t,e,0),this.width,this.height)),this._stageResultAtPoint},releaseGLResource:function(){return this.renderer.releaseGLResource(),this},destroy:function(){return zr.superclass.destroy.call(this,this.renderer),this.releaseGLResource(),this.traverse((function(t){t.off(),t.parent=null})),this.children.length=0,this.renderer.off(),this}}),Wr=zr;function Yr(){return+new Date}var qr=a.a.create({constructor:function(t,e,n,r){var i=this;for(var a in i.target=t,i._startTime=0,i._seekTime=0,i._pausedTime=0,i._pausedStartTime=0,i._reverseFlag=1,i._repeatCount=0,3===arguments.length&&(r=n,n=e,e=null),r)i[a]=r[a];i._fromProps=e,i._toProps=n,!r.duration&&r.time&&(i.duration=r.time||0,i.time=0)},target:null,duration:1e3,delay:0,paused:!1,loop:!1,reverse:!1,repeat:0,repeatDelay:0,ease:null,time:0,isStart:!1,isComplete:!1,onStart:null,onUpdate:null,onComplete:null,setProps:function(t,e){var n=this.target,r=t||e,i=this._fromProps={},a=this._toProps={};for(var s in t=t||n,e=e||n,r)a[s]=e[s]||0,n[s]=i[s]=t[s]||0;return this},start:function(){var t=this;return t._startTime=Yr()+t.delay,t._seekTime=0,t._pausedTime=0,t._reverseFlag=1,t._repeatCount=0,t.paused=!1,t.isStart=!1,t.isComplete=!1,qr.add(t),t},stop:function(){return qr.remove(this),this},pause:function(){return this.paused=!0,this._pausedStartTime=Yr(),this},resume:function(){var t=this;return t.paused=!1,t._pausedStartTime&&(t._pausedTime+=Yr()-t._pausedStartTime),t._pausedStartTime=0,t},seek:function(t,e){var n=this,r=Yr();return n._startTime=r,n._seekTime=t,n._pausedTime=0,void 0!==e&&(n.paused=e),n._update(r,!0),qr.add(n),n},link:function(t){var e,n,r=t.delay,i=this._startTime;return"string"==typeof r&&(e=0===r.indexOf("+"),n=0===r.indexOf("-"),r=e||n?Number(r.substr(1))*(e?1:-1):Number(r)),t.delay=r,t._startTime=e||n?i+this.duration+r:i+r,this._next=t,qr.remove(t),t},_render:function(t){var e=this.target,n=this._fromProps;for(var r in n)e[r]=n[r]+(this._toProps[r]-n[r])*t},_update:function(t,e){var n=this;if(n.paused&&!e)return!1;if(n.isComplete)return!0;var r=t-n._startTime-n._pausedTime+n._seekTime;if(r<0)return!1;var i,a=r/n.duration;a<=0?a=0:a>=1&&(a=1);var s=n.ease?n.ease(a):a;n.reverse&&n.isStart&&(n._reverseFlag<0&&(a=1-a,s=1-s),a<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0===n.repeat&&!n.loop?n.isComplete=!0:(n._startTime=Yr(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=r,n._render(s),(i=n.onUpdate)&&i.call(n,s,n),a>=1&&(n.reverse?(n._startTime=Yr(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++<n.repeat?(n._startTime=Yr()+n.repeatDelay,n._pausedTime=0):n.isComplete=!0);var o=n._next;if(o&&o.time<=0){var u=o._startTime;u>0&&u<=t?(o._render(a),o.time=r,qr.add(o)):n.isComplete&&(u<0||u>t)&&o.start()}return!!n.isComplete&&((i=n.onComplete)&&i.call(n,n),!0)},Statics:{_tweens:[],tick:function(){var t,e,n=qr._tweens,r=n.length;for(e=0;e<r;e++)(t=n[e])&&t._update(Yr())&&(n.splice(e,1),e--);return qr},add:function(t){var e=qr._tweens;return-1===e.indexOf(t)&&e.push(t),qr},remove:function(t){var e,n;if(t instanceof Array){for(e=0,n=t.length;e<n;e++)qr.remove(t[e]);return qr}var r=qr._tweens;if(t instanceof qr)(e=r.indexOf(t))>-1&&r.splice(e,1);else for(e=0;e<r.length;e++)r[e].target===t&&(r.splice(e,1),e--);return qr},removeAll:function(){return qr._tweens.length=0,qr},fromTo:function(t,e,n,r){r=r||{};var i,a,s=t instanceof Array;t=s?t:[t];var o=r.stagger,u=[];for(a=0;a<t.length;a++)i=new qr(t[a],e,n,r),o&&(i.delay=(r.delay||0)+(a*o||0)),i.start(),u.push(i);return s?u:i},to:function(t,e,n){return qr.fromTo(t,null,e,n)},from:function(t,e,n){return qr.fromTo(t,e,null,n)}}});function Zr(t,e,n,r,i){return t=t||{},e&&(t.EaseIn=e),n&&(t.EaseOut=n),r&&(t.EaseInOut=r),i&&(t.EaseNone=i),t}var Kr=Zr(null,null,null,null,(function(t){return t})),Qr=Zr(null,(function(t){return t*t}),(function(t){return-t*(t-2)}),(function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)})),Jr=Zr(null,(function(t){return t*t*t}),(function(t){return--t*t*t+1}),(function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)})),$r=Zr(null,(function(t){return t*t*t*t}),(function(t){return-(--t*t*t*t-1)}),(function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)})),ti=Zr(null,(function(t){return t*t*t*t*t}),(function(t){return(t-=1)*t*t*t*t+1}),(function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)})),ei=Math,ni=ei.PI,ri=.5*ni,ii=ei.sin,ai=ei.cos,si=ei.pow,oi=ei.sqrt,ui=Zr(null,(function(t){return 1-ai(t*ri)}),(function(t){return ii(t*ri)}),(function(t){return-.5*(ai(ni*t)-1)})),ci=Zr(null,(function(t){return 0===t?0:si(2,10*(t-1))}),(function(t){return 1===t?1:1-si(2,-10*t)}),(function(t){return 0===t||1===t?t:(t*=2)<1?.5*si(2,10*(t-1)):.5*(2-si(2,-10*(t-1)))})),hi=Zr(null,(function(t){return-(oi(1-t*t)-1)}),(function(t){return oi(1- --t*t)}),(function(t){return(t/=.5)<1?-.5*(oi(1-t*t)-1):.5*(oi(1-(t-=2)*t)+1)})),fi=Zr({a:1,p:.4,s:.1,config:function(t,e){fi.a=t,fi.p=e,fi.s=e/(2*ni)*Math.asin(1/t)||0}},(function(t){return-fi.a*si(2,10*(t-=1))*ii((t-fi.s)*(2*ni)/fi.p)}),(function(t){return fi.a*si(2,-10*t)*ii((t-fi.s)*(2*ni)/fi.p)+1}),(function(t){return(t*=2)<1?fi.a*si(2,10*(t-=1))*ii((t-fi.s)*(2*ni)/fi.p)*-.5:fi.a*si(2,-10*(t-=1))*ii((t-fi.s)*(2*ni)/fi.p)*.5+1})),li=Zr({o:1.70158,s:2.59491,config:function(t){li.o=t,li.s=1.525*t}},(function(t){return t*t*((li.o+1)*t-li.o)}),(function(t){return(t-=1)*t*((li.o+1)*t+li.o)+1}),(function(t){return(t*=2)<1?t*t*((li.s+1)*t-li.s)*.5:.5*((t-=2)*t*((li.s+1)*t+li.s)+2)})),di=Zr(null,(function(t){return 1-di.EaseOut(1-t)}),(function(t){return(t/=1)<.36364?7.5625*t*t:t<.72727?7.5625*(t-=.54545)*t+.75:t<.90909?7.5625*(t-=.81818)*t+.9375:7.5625*(t-=.95455)*t+.984375}),(function(t){return t<.5?.5*di.EaseIn(2*t):.5*di.EaseOut(2*t-1)+.5}));qr.Ease={Linear:Kr,Quad:Qr,Cubic:Jr,Quart:$r,Quint:ti,Sine:ui,Expo:ci,Circ:hi,Elastic:fi,Back:li,Bounce:di};var mi=qr,_i=a.a.create({Extends:Z,isBoxGeometry:!0,className:"BoxGeometry",width:1,height:1,depth:1,widthSegments:1,heightSegments:1,depthSegments:1,constructor:function(t){_i.superclass.constructor.call(this,t),this.isSegments()?this.buildWithSegments():this.build()},buildWithSegments:function(){var t=this.width,e=this.height,n=this.depth,r=this.widthSegments,i=this.heightSegments,a=this.depthSegments,s=i*a*6,o=r*a*6,u=r*i*6,c=2*((i+1)*(a+1)+(r+1)*(a+1)+(r+1)*(i+1)),h=new Float32Array(3*c),f=new Float32Array(3*c),l=new Float32Array(2*c),d=new Uint16Array(2*(s+o+u));this.vertices=new b(h,3),this.normals=new b(f,3),this.uvs=new b(l,2),this.indices=new b(d,1);var m=[0,0];this.buildPlane(m,2,1,0,-1,1,n,e,t/2,a,i),this.buildPlane(m,2,1,0,1,1,n,e,-t/2,a,i),this.buildPlane(m,0,2,1,1,-1,t,n,e/2,r,a),this.buildPlane(m,0,2,1,1,1,t,n,-e/2,r,a),this.buildPlane(m,0,1,2,1,1,t,e,n/2,r,i),this.buildPlane(m,0,1,2,-1,1,t,e,-n/2,r,i)},buildPlane:function(t,e,n,r,i,a,s,o,u,c,h){for(var f=s/c,l=o/h,d=s/2,m=o/2,_=t[0],p=t[1],g=this.vertices.data,v=this.normals.data,E=this.uvs.data,T=this.indices.data,M=0;M<=h;M++)for(var A=(M*l-m)*a,L=0;L<=c;L++){if(g[3*_+e]=(L*f-d)*i,g[3*_+n]=A,g[3*_+r]=u,v[3*_+e]=0,v[3*_+n]=0,v[3*_+r]=u<0?-1:1,E[2*_]=L/c,E[2*_+1]=1-M/h,L<c&&M<h){var I=t[0]+(M+1)*(c+1)+L;T[p++]=I,T[p++]=_,T[p++]=I+1,T[p++]=I+1,T[p++]=_,T[p++]=_+1}_++}t[0]=_,t[1]=p},build:function(){var t=new Float32Array(72),e=new Uint16Array(36);this.vertices=new b(t,3),this.indices=new b(e,1);var n=this.width/2,r=this.height/2,i=this.depth/2,a=[-n,-r,-i],s=[n,-r,-i],o=[n,r,-i],u=[-n,r,-i],c=[-n,-r,i],h=[n,-r,i],f=[n,r,i],l=[-n,r,i];this.addRect(h,s,o,f),this.addRect(a,c,l,u),this.addRect(l,f,o,u),this.addRect(a,s,h,c),this.addRect(c,h,f,l),this.addRect(s,a,u,o)},isSegments:function(){return this.widthSegments>1||this.heightSegments>1||this.depthSegments>1},setFrontUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setFrontUV!"):this.setVertexUV(32,t)},setRightUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setRightUV!"):this.setVertexUV(0,t)},setBackUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setBackUV!"):this.setVertexUV(40,t)},setLeftUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setLeftUV!"):this.setVertexUV(8,t)},setTopUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setTopUV!"):this.setVertexUV(16,t)},setBottomUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setBottomUV!"):this.setVertexUV(24,t)},setAllRectUV:function(t){if(this.isSegments())return m.a.warn("segmented BoxGeometry dont support setAllRectUV!"),null;for(var e=0;e<6;e++)this.setVertexUV(8*e,t);return this},_raycast:function(t,e){return _i.superclass._raycast.call(this,t,e)}}),pi=_i,gi=P.a.FRONT,vi=P.a.BACK,Ei=[0,0,1],Ti=a.a.create({Extends:Z,isPlaneGeometry:!0,className:"PlaneGeometry",width:1,height:1,widthSegments:1,heightSegments:1,constructor:function(t){Ti.superclass.constructor.call(this,t),this.build()},build:function(){for(var t=this.widthSegments,e=this.heightSegments,n=(t+1)*(e+1),r=this.width/t,i=this.height/e,a=new Float32Array(3*n),s=new Float32Array(3*n),o=new Float32Array(2*n),u=new Uint16Array(t*e*6),c=0,h=0;h<=e;h++)for(var f=0;f<=t;f++){var l=h*(t+1)+f;if(a[3*l]=f*r-this.width/2,a[3*l+1]=this.height/2-h*i,s[3*l]=0,s[3*l+1]=0,s[3*l+2]=1,o[2*l]=f/t,o[2*l+1]=1-h/e,h<e&&f<t){var d=(h+1)*(t+1)+f;u[c++]=l,u[c++]=d,u[c++]=d+1,u[c++]=l,u[c++]=d+1,u[c++]=l+1}}this.vertices=new b(a,3),this.indices=new b(u,1),this.normals=new b(s,3),this.uvs=new b(o,2)},_raycast:function(t,e){var n=t.origin.z,r=t.direction.z;if(e===gi&&(r>0||n<0))return null;if(e===vi&&(r<0||n>0))return null;var i=t.intersectsPlane(Ei,0);if(i){var a=i.x,s=i.y,o=.5*this.width,u=.5*this.height;if(a>=-o&&a<=o&&s>=-u&&s<=u)return[i]}return null}}),Mi=Ti,Ai=a.a.create({Extends:Z,isSphereGeometry:!0,className:"SphereGeometry",radius:1,heightSegments:16,widthSegments:32,constructor:function(t){Ai.superclass.constructor.call(this,t),this.build()},build:function(){for(var t=this.radius,e=this.heightSegments,n=this.widthSegments,r=(n+1)*(e+1),i=n*e,a=new Float32Array(3*r),s=new Float32Array(4*r),o=new Float32Array(2*r),u=new Uint16Array(6*i),c=0,h=0,f=0,l=0,d=0,m=2*Math.PI,_=Math.PI,p=0;p<=e;p++)for(var g=p/e,v=_*g,E=Math.cos(v)*t,T=Math.sin(v)*t,M=0;M<=n;M++){var A=M/n,L=m*A,I=Math.cos(L),O=Math.sin(L),S=I*T,R=O*T,y=O,N=-I;if(s[f++]=y,s[f++]=0,s[f++]=N,s[f++]=1,a[h++]=S,a[h++]=E,a[h++]=R,o[l++]=A,o[l++]=g,p>0&&M>0){var x=d,C=x-1,P=C-n-1,w=x-n-1;u[c++]=P,u[c++]=w,u[c++]=x,u[c++]=P,u[c++]=x,u[c++]=C}d++}this.vertices=new b(a,3),this.indices=new b(u,1),this.uvs=new b(o,2),this.tangents=new b(s,4),this.normals=new b(new Float32Array(a),3)},_raycast:function(t,e){return Ai.superclass._raycast.call(this,t,e)}}),Li=Ai,Ii=[dt,Lt,Nt,Ft,Qt,ce],Oi=function(){var t="";return Ii.forEach((function(e){t+="".concat(e.prototype.className,":").concat(Object.keys(e.cache._cache).length," ")})),m.a.log(t),t},Si=a.a.create({Mixes:s.a,isLoadCache:!0,className:"LoadCache",Statics:{PENDING:1,LOADED:2,FAILED:3},enabled:!0,constructor:function(){this._files={}},update:function(t,e,n){if(this.enabled){var r={key:t,state:e,data:n};this._files[t]=r,this.fire("update",r),this.fire("update:".concat(r.key),r)}},get:function(t){return this.enabled?this._files[t]:null},getLoaded:function(t){var e=this.get(t);return e&&e.state===Si.LOADED?e.data:null},remove:function(t){delete this._files[t]},clear:function(){this._files={}},wait:function(t){var e=this;return t?t.state===Si.LOADED?Promise.resolve(t.data):t.state===Si.FAILED?Promise.reject():new Promise((function(n,r){e.on("update:".concat(t.key),(function(t){var e=t.detail;e.state===Si.LOADED?n(e.data):e.state===Si.FAILED&&r(e.data)}),!0)})):Promise.reject()}}),Ri=Si,yi=new Ri,Ni=a.a.create({Mixes:s.a,isBasicLoader:!0,className:"BasicLoader",Statics:{_cache:yi,enalbeCache:function(){yi.enabled=!0},disableCache:function(){yi.enabled=!1},deleteCache:function(t){yi.remove(t)},clearCache:function(){yi.clear()},cache:{get:function(){return yi},set:function(){m.a.warn("BasicLoader.cache is readonly!")}},TYPE_IMAGE:"img",TYPE_JSON:"json",TYPE_BUFFER:"buffer",TYPE_TEXT:"text"},load:function(t){var e=t.src,n=t.type;if(!n){var r=Object(i.getExtension)(e);/^(?:png|jpe?g|gif|webp|bmp)$/i.test(r)&&(n="img"),n||(n=t.defaultType)}return n===Ni.TYPE_IMAGE?this.loadImg(e,t.crossOrigin):this.loadRes(e,n)},isCrossOrigin:function(t){var e=window.location,n=document.createElement("a");return n.href=t,n.hostname!==e.hostname||n.port!==e.port||n.protocol!==e.protocol},isBase64:function(t){return/^data:(.+?);base64,/.test(t)},Uint8ArrayFrom:function(t,e){if(Uint8Array.from)return Uint8Array.from(t,e);for(var n=t.length,r=new Uint8Array(n),i=0;i<n;i++)r[i]=e(t[i]);return r},loadImg:function(t,e){var n=this,r=yi.get(t);return r?yi.wait(r):new Promise((function(r,i){var a=new Image;yi.update(t,Ri.PENDING),a.onload=function(){a.onerror=null,a.onabort=null,a.onload=null,yi.update(t,Ri.LOADED,a),r(a)},a.onerror=function(){a.onerror=null,a.onabort=null,a.onload=null;var e=new Error("Image load failed for ".concat(t.slice(0,100)));yi.update(t,Ri.FAILED,e),i(e)},a.onabort=a.onerror,(e||n.isCrossOrigin(t))&&(n.isBase64(t)||(a.crossOrigin="anonymous")),a.src=t}))},loadRes:function(t,e){var n=this;if(this.isBase64(t)){var r=RegExp.$1,i=t.slice(13+r.length),a=atob(i);return e===Ni.TYPE_JSON?a=JSON.parse(a):e===Ni.TYPE_BUFFER&&(a=this.Uint8ArrayFrom(a,(function(t){return t.charCodeAt(0)})).buffer),Promise.resolve(a)}var s=yi.get(t);return s?yi.wait(s):(yi.update(t,Ri.PENDING),this.fire("beforeload"),this.request({url:t,type:e}).then((function(e){return n.fire("loaded"),yi.update(t,Ri.LOADED,e),e}),(function(e){throw n.fire("failed",e),yi.update(t,Ri.FAILED),new Error("Resource load failed for ".concat(t,", ").concat(e))})))},request:function(t){var e=this;return new Promise((function(n,r){var a=new XMLHttpRequest;a.onload=function(){if(a.status<200||a.status>=300)r(new TypeError("Network request failed for ".concat(a.status)));else{var e="response"in a?a.response:a.responseText;if(t.type===Ni.TYPE_JSON)try{e=JSON.parse(e)}catch(t){return void r(new TypeError("JSON.parse error"+t))}n(e)}},a.onprogress=function(n){e.fire("progress",{url:t.url,loaded:n.loaded,total:n.total})},a.onerror=function(){r(new TypeError("Network request failed"))},a.ontimeout=function(){r(new TypeError("Network request timed out"))},a.open(t.method||"GET",t.url,!0),"include"===t.credentials&&(a.withCredentials=!0),t.type===Ni.TYPE_BUFFER&&(a.responseType="arraybuffer"),Object(i.each)(t.headers,(function(t,e){a.setRequestHeader(e,t)})),a.send(t.body||null)}))}}),xi=Ni,Ci=a.a.create({isLoader:!0,className:"Loader",maxConnections:2,Statics:{_loaderClassMap:{},_loaders:{},addLoader:function(t,e){Ci._loaderClassMap[t]=e},getLoader:function(t){if(!Ci._loaders[t]){var e=Ci._loaderClassMap[t]?Ci._loaderClassMap[t]:xi;Ci._loaders[t]=new e}return Ci._loaders[t]}},preHandlerUrl:null,load:function(t){var e=this;if(t instanceof Array)return Promise.all(t.map((function(t){return e.load(t)})));var n=t.type||Object(i.getExtension)(t.src),r=Ci.getLoader(n),a=t;return this.preHandlerUrl&&((a=Object.assign({},t)).src=this.preHandlerUrl(t.src)),r.load(a)}}),bi=Ci,Pi=a.a.create({Extends:xi,isCubeTextureLoader:!0,className:"CubeTextureLoader",constructor:function(){Pi.superclass.constructor.call(this)},load:function(t){var e,n=this;return e=t.images&&Array.isArray(t.images)?t.images:[t.right,t.left,t.top,t.bottom,t.front,t.back],Promise.all(e.map((function(e){return n.loadImg(e,t.crossOrigin)}))).then((function(e){var n=Object.assign({},t);return delete n.images,delete n.type,delete n.right,delete n.left,delete n.top,delete n.bottom,delete n.front,delete n.back,n.image=e,new pe(n)})).catch((function(t){throw m.a.error("load CubeTexture failed",t.message,t.stack),t}))}});bi.addLoader("CubeTexture",Pi);var wi=Pi,Hi=a.a.create({Extends:$e,isPBRMaterial:!0,className:"PBRMaterial",lightType:"PBR",gammaCorrection:!0,usePhysicsLight:!0,baseColor:null,baseColorMap:null,metallic:1,metallicMap:null,roughness:1,roughnessMap:null,metallicRoughnessMap:null,occlusionMap:null,occlusionStrength:1,isOcclusionInMetallicRoughnessMap:!1,diffuseEnvMap:null,diffuseEnvSphereHarmonics3:null,diffuseEnvIntensity:1,brdfLUT:null,specularEnvIntensity:1,specularEnvMap:null,isSpecularEnvMapIncludeMipmaps:!1,emission:null,emissionFactor:null,isSpecularGlossiness:!1,specular:null,glossiness:1,specularGlossinessMap:null,clearcoatFactor:0,clearcoatMap:null,clearcoatRoughnessFactor:0,clearcoatRoughnessMap:null,clearcoatNormalMap:null,usedUniformVectors:11,constructor:function(t){this.baseColor=new v.a(1,1,1),this.specular=new v.a(1,1,1),this.emissionFactor=new v.a(0,0,0),Hi.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_baseColor:"BASECOLOR",u_metallic:"METALLIC",u_roughness:"ROUGHNESS",u_specular:"SPECULAR",u_emissionFactor:"EMISSIONFACTOR",u_glossiness:"GLOSSINESS",u_brdfLUT:"BRDFLUT",u_diffuseEnvMap:"DIFFUSEENVMAP",u_diffuseEnvIntensity:"DIFFUSEENVINTENSITY",u_occlusionStrength:"OCCLUSIONSTRENGTH",u_specularEnvMap:"SPECULARENVMAP",u_specularEnvIntensity:"SPECULARENVINTENSITY",u_specularEnvMapMipCount:"SPECULARENVMAPMIPCOUNT",u_diffuseEnvSphereHarmonics3:"DIFFUSEENVSPHEREHARMONICS3",u_clearcoatFactor:"CLEARCOATFACTOR",u_clearcoatRoughnessFactor:"CLEARCOATROUGHNESSFACTOR"}),this.addTextureUniforms({u_baseColorMap:"BASECOLORMAP",u_metallicMap:"METALLICMAP",u_roughnessMap:"ROUGHNESSMAP",u_metallicRoughnessMap:"METALLICROUGHNESSMAP",u_occlusionMap:"OCCLUSIONMAP",u_specularGlossinessMap:"SPECULARGLOSSINESSMAP",u_lightMap:"LIGHTMAP",u_clearcoatMap:"CLEARCOATMAP",u_clearcoatRoughnessMap:"CLEARCOATROUGHNESSMAP",u_clearcoatNormalMap:"CLEARCOATNORMALMAP"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Hi.superclass.getRenderOption.call(this,t);var e=this._textureOption.reset(t);return e.add(this.baseColorMap,"BASE_COLOR_MAP"),e.add(this.metallicMap,"METALLIC_MAP"),e.add(this.roughnessMap,"ROUGHNESS_MAP"),e.add(this.metallicRoughnessMap,"METALLIC_ROUGHNESS_MAP"),e.add(this.diffuseEnvMap,"DIFFUSE_ENV_MAP"),e.add(this.occlusionMap,"OCCLUSION_MAP"),e.add(this.lightMap,"LIGHT_MAP"),this.brdfLUT&&(e.add(this.specularEnvMap,"SPECULAR_ENV_MAP"),et.SHADER_TEXTURE_LOD&&this.specularEnvMap&&(t.USE_SHADER_TEXTURE_LOD=1)),this.isSpecularGlossiness&&(t.PBR_SPECULAR_GLOSSINESS=1,e.add(this.specularGlossinessMap,"SPECULAR_GLOSSINESS_MAP")),this.isOcclusionInMetallicRoughnessMap&&(t.IS_OCCLUSION_MAP_IN_METALLIC_ROUGHNESS_MAP=1),1!==this.occlusionStrength&&(t.OCCLUSION_STRENGTH=1),this.diffuseEnvSphereHarmonics3&&(t.HAS_NORMAL=1,t.DIFFUSE_ENV_SPHERE_HARMONICS3=1),(this.specularEnvMap||this.diffuseEnvSphereHarmonics3||this.specularEnvMap)&&(t.NEED_WORLD_NORMAL=1),this.specularEnvMap&&this.isSpecularEnvMapIncludeMipmaps&&(t.IS_SPECULAR_ENV_MAP_INCLUDE_MIPMAPS=1),this.clearcoatFactor>0&&(t.HAS_CLEARCOAT=1,t.HAS_NORMAL=1,this.clearcoatMap&&e.add(this.clearcoatMap,"CLEARCOAT_MAP"),this.clearcoatNormalMap&&e.add(this.clearcoatNormalMap,"CLEARCOAT_NORMAL_MAP"),this.clearcoatRoughnessMap&&e.add(this.clearcoatRoughnessMap,"CLEARCOAT_ROUGHNESS_MAP")),e.update(),t}}),Di=Hi,Fi=new Image;Fi.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";var Ui=a.a.create({Extends:Qt,Mixes:s.a,isLazyTexture:!0,className:"LazyTexture",_src:"",crossOrigin:!1,autoLoad:!0,resType:"",src:{get:function(){return this._src},set:function(t){this._src!==t&&(this._src=t,this.autoLoad&&this.load())}},constructor:function(t){t&&("crossOrigin"in t&&(this.crossOrigin=t.crossOrigin),"autoLoad"in t&&(this.autoLoad=t.autoLoad)),Ui.superclass.constructor.call(this,t),this.image=this.placeHolder||Fi},load:function(t){var e=this;return Ui.loader=Ui.loader||new bi,Ui.loader.load({src:this.src,crossOrigin:this.crossOrigin,type:this.resType,defaultType:"img"}).then((function(t){t.isTexture?(Object.assign(e,t),e.needUpdate=!0,e.needDestroy=!0,e.fire("load")):(e.image=t,e.needUpdate=!0,e.fire("load"))}),(function(n){if(e.fire("error"),t)throw new Error("LazyTexture Failed ".concat(n));m.a.warn("LazyTexture Failed ".concat(n))}))},_releaseImage:function(){this._src&&"string"!=typeof this._src&&(this._src=""),Ui.superclass._releaseImage.call(this)}}),Gi=Ui,Bi=n(13);function Vi(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Xi(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xi(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var ji=new l.a,ki=new l.a,zi=new l.a,Wi=new l.a,Yi=new l.a,qi=new l.a,Zi=new Bi.a,Ki=[];function Qi(t,e){return t-e}var Ji=a.a.create({Statics:{interpolation:{LINEAR:function(t,e,n){if(void 0===e)return t;if(t.slerp)return t.slerp(e,n);if(t.lerp)return t.lerp(e,n);if(Object(i.isArrayLike)(t)){Ki.length=0;for(var r=t.length-1;r>=0;r--)Ki[r]=t[r]+n*(e[r]-t[r]);return Ki}return t+n*(e-t)},STEP:function(t,e,n){return t},CUBICSPLINE:function(t,e,n,r){var a=t.length/3;if(void 0===e)return 1===a?t[1]:t.slice(a,-a);var s=t[1],o=t[2],u=e[1],c=e[0];return a>1&&(s=t.slice(a,-a),o=t.slice(-a),u=e.slice(a,-a),c=e.slice(0,a)),s.hermite?s.hermite(s,o.scale(r),u,c.scale(r),n):s.isQuaternion?(s.fromArray(this._cubicSpline(s.elements,o.elements,u.elements,c.elements,r,n),0,!0),s.normalize(!0)):(Object(i.isArrayLike)(s)||(s=[s],o=[o],u=[u],c=[c]),s=this._cubicSpline(s,o,u,c,r,n)),s},_cubicSpline:function(t,e,n,r,i,a){var s=a*a,o=s*a,u=2*o-3*s+1,c=o-2*s+a,h=-2*o+3*s,f=o-s;Ki.length=0;for(var l=t.length-1;l>=0;l--)Ki[l]=t[l]*u+c*e[l]*i+n[l]*h+f*r[l]*i;return Ki}},StateType:{TRANSLATE:"Translation",POSITION:"Translation",TRANSLATION:"Translation",SCALE:"Scale",ROTATE:"Rotation",ROTATION:"Rotation",QUATERNION:"Quaternion",WEIGHTS:"Weights"},getType:function(t){return t=String(t).toUpperCase(),Ji.StateType[t]||Ji._extraStateHandlers.type[t]},_extraStateHandlers:{type:{},handler:{}},registerStateHandler:function(t,e){Ji._extraStateHandlers.type[String(t).toUpperCase()]=t,Ji._extraStateHandlers.handler[t]=e}},isAnimationStates:!0,className:"AnimationStates",nodeName:"",type:"",interpolationType:"LINEAR",constructor:function(t){this.id=d.a.generateUUID(this.className),this.keyTime=[],this.states=[],Object.assign(this,t)},findIndexByTime:function(t){return Object(i.getIndexFromSortedArray)(this.keyTime,t,Qi)},getStateByIndex:function(t){var e=this.states.length/this.keyTime.length;return 1===e?this.states[t]:this.states.slice(t*e,t*e+e)},getState:function(t){var e=Vi(this.findIndexByTime(t),2),n=e[0],r=e[1];if(n<0||r>=this.keyTime.length)return null;var a=this.keyTime[n],s=this.keyTime[r],o=this.getStateByIndex(n);if("STEP"===this.interpolationType)return o;if(n===r){var u=this.interpolation(o);return this.type===Ji.StateType.ROTATION&&(u=ji.fromEuler(Zi.fromArray(u))),u.elements||u}var c=this.getStateByIndex(r),h=s-a,f=(t-a)/h;this.type===Ji.StateType.ROTATION?Object(i.isArrayLike)(o[0])?(o[0]=ji.fromEuler(Zi.fromArray(o[0])),o[1]=ki.fromEuler(Zi.fromArray(o[1])),o[2]=zi.fromEuler(Zi.fromArray(o[2])),c[0]=Wi.fromEuler(Zi.fromArray(c[0])),c[1]=Yi.fromEuler(Zi.fromArray(c[1])),c[2]=qi.fromEuler(Zi.fromArray(c[2]))):(o=ji.fromEuler(Zi.fromArray(o)),c=ki.fromEuler(Zi.fromArray(c))):this.type===Ji.StateType.QUATERNION&&(Object(i.isArrayLike)(o[0])?(o[0]=ji.fromArray(o[0]),o[1]=ki.fromArray(o[1]),o[2]=zi.fromArray(o[2]),c[0]=Wi.fromArray(c[0]),c[1]=Yi.fromArray(c[1]),c[2]=qi.fromArray(c[2])):(o=ji.fromArray(o),c=ki.fromArray(c)));var l=this.interpolation(o,c,f,h);return l.elements||l},interpolation:function(t,e,n,r){return Ji.interpolation[this.interpolationType](t,e,n,r)},updateNodeTranslation:function(t,e){t.x=e[0],t.y=e[1],t.z=e[2]},updateNodeScale:function(t,e){t.scaleX=e[0],t.scaleY=e[1],t.scaleZ=e[2]},updateNodeQuaternion:function(t,e){t.quaternion.fromArray(e)},updateNodeWeights:function(t,e){var n=this._originalWeightIndices=this._originalWeightIndices||[],r=e.length;e=e.slice();for(var i=0;i<r;i++)n[i]=i;for(var a=0;a<r;a++)for(var s=a+1;s<r;s++)if(e[s]>e[a]){var o=e[a];e[a]=e[s],e[s]=o,o=n[a],n[a]=n[s],n[s]=o}t.traverse((function(t){t.isMesh&&t.geometry&&t.geometry.isMorphGeometry&&t.geometry.update(e,n)}))},updateNodeState:function(t,e){if(e){var n=this.type;n===Ji.StateType.ROTATION&&(n=Ji.StateType.QUATERNION);var r=this.getState(t);if(r){var i="updateNode"+n;this[i]?this[i](e,r):Ji._extraStateHandlers.handler[n]?Ji._extraStateHandlers.handler[n].call(this,e,r):m.a.warnOnce(i,"updateNodeState failed unknow type(%s)",n)}}},clone:function(){return new this.constructor({keyTime:this.keyTime,states:this.states,type:this.type,nodeName:this.nodeName})}}),$i=Ji,ta=a.a.create({Statics:{_anims:[],tick:function(t){this._anims.forEach((function(e){return e.tick(t)}))}},Mixes:s.a,isAnimation:!0,className:"Animation",paused:!1,currentLoopCount:0,loop:1/0,currentTime:0,timeScale:1,startTime:0,endTime:0,clipStartTime:0,clipEndTime:0,nodeNameMap:null,_rootNode:null,rootNode:{get:function(){return this._rootNode},set:function(t){this._rootNode=t,this._initNodeNameMap()}},_animStatesList:null,animStatesList:{get:function(){return this._animStatesList},set:function(t){this._animStatesList=t,this._initClipTime()}},validAnimationIds:null,constructor:function(t){this.id=d.a.generateUUID(this.className),this.clips={},this._animStatesList=[],Object.assign(this,t)},addClip:function(t,e,n,r){this.clips[t]={start:e,end:n,animStatesList:r}},removeClip:function(t){this.clips[t]=null},getAnimStatesListTimeInfo:function(t){var e=0,n=1/0;return t.forEach((function(t){e=Math.max(t.keyTime[t.keyTime.length-1],e),n=Math.min(t.keyTime[0],n)})),{startTime:n,endTime:e}},_initClipTime:function(){var t=this.getAnimStatesListTimeInfo(this.animStatesList);this.clipStartTime=t.startTime,this.clipEndTime=t.endTime},_initNodeNameMap:function(){if(this._rootNode){var t=this.nodeNameMap={};this._rootNode.traverse((function(e){t[e.animationId]=e;var n=e.name;void 0===n||t[n]||(t[n]=e)}),!1)}},tick:function(t){this.paused||(this.currentTime+=t/1e3*this.timeScale,this.currentTime>=this.endTime?(this.currentLoopCount++,this.currentTime=this.endTime,this.updateAnimStates(),this.fire("loopEnd"),!this.loop||this.currentLoopCount>=this.loop?(this.stop(),this.fire("end")):this.currentTime=this.startTime):this.updateAnimStates())},updateAnimStates:function(){var t=this;return this.animStatesList.forEach((function(e){e.updateNodeState(t.currentTime,t.nodeNameMap[e.nodeName])})),this},play:function(t,e){var n;if("string"==typeof t){var r=this.clips[t];r?(n=r.start,e=r.end,r.animStatesList&&(this.animStatesList=r.animStatesList,this._initClipTime())):m.a.warn("no this animation clip name:"+t)}else n=t;void 0===n&&(n=this.clipStartTime),void 0===e&&(e=this.clipEndTime),this.endTime=Math.min(e,this.clipEndTime),this.startTime=Math.min(n,this.endTime),this.currentTime=this.startTime,this.currentLoopCount=0,this.stop(),this.paused=!1,ta._anims.push(this)},stop:function(){this.paused=!0;var t=ta._anims,e=t.indexOf(this);-1!==e&&t.splice(e,1)},pause:function(){this.paused=!0},resume:function(){this.paused=!1},clone:function(t){var e=new this.constructor({rootNode:t,animStatesList:this.animStatesList,timeScale:this.timeScale,loop:this.loop,paused:this.paused,currentTime:this.currentTime,startTime:this.startTime,endTime:this.endTime,clips:this.clips});return this.paused||e.play(),e}}),ea=ta;function na(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return ra(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ra(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ra(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var ia=P.a.BLEND,aa=P.a.DEPTH_TEST,sa=P.a.CULL_FACE,oa=P.a.FRONT,ua=P.a.BACK,ca=P.a.FRONT_AND_BACK,ha={5120:[1,Int8Array],5121:[1,Uint8Array],5122:[2,Int16Array],5123:[2,Uint16Array],5125:[4,Uint32Array],5126:[4,Float32Array]},fa={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},la={POSITION:{name:"vertices",decodeMatName:"positionDecodeMat"},TEXCOORD_0:{name:"uvs",decodeMatName:"uvDecodeMat"},TEXCOORD_1:{name:"uvs1",decodeMatName:"uv1DecodeMat"},NORMAL:{name:"normals",decodeMatName:"normalDecodeMat"},JOINT:{name:"skinIndices"},JOINTS_0:{name:"skinIndices"},WEIGHT:{name:"skinWeights"},WEIGHTS_0:{name:"skinWeights"},TANGENT:{name:"tangents"},COLOR_0:{name:"colors"}},da=a.a.create({isGLTFParser:!0,className:"GLTFParser",Statics:{MAGIC:"glTF",extensionHandlers:r,registerExtensionHandler:function(t,e){this.extensionHandlers[t]=e},unregisterExtensionHandler:function(t){this.extensionHandlers[t]&&delete this.extensionHandlers[t]}},isMultiAnim:!0,isProgressive:!1,isUnQuantizeInShader:!0,isLoadAllTextures:!1,preHandlerImageURI:null,preHandlerBufferURI:null,customMaterialCreator:null,ignoreTextureError:!1,forceCreateNewBuffer:!1,src:"",constructor:function(t,e){Object.assign(this,e),this.content=t},parse:function(t){var e=this;if(this.content instanceof ArrayBuffer){var n=this.content;if(i.convertUint8ArrayToString(new Uint8Array(n,0,4))===da.MAGIC)this.parseBinary(n);else{var r=i.convertUint8ArrayToString(new Uint8Array(n),!0);this.json=JSON.parse(r)}}else this.json=JSON.parse(this.content);return this.glTFVersion=parseFloat(this.json.asset.version),this.glTFVersion>=2&&(this.isGLTF2=!0),this.parseExtensionUsed(),this.loadResources(t).then((function(){return e.parseExtensions(e.json.extensions,null,{isGlobal:!0,methodName:"parseOnLoad"}),Promise.resolve()})).then((function(){return e.parseGeometries()})).then((function(){return e.parseScene()}))},parseExtensionUsed:function(){var t=this;this.extensionsUsed={},i.each(this.json.extensionsUsed,(function(e){t.extensionsUsed[e]=!0})),this.extensionsUsed.WEB3D_quantized_attributes||(this.isUnQuantizeInShader=!1)},getExtensionHandler:function(t){return this.extensionHandlers&&this.extensionHandlers[t]||da.extensionHandlers[t]},parseExtension:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=t[e],a=this.getExtensionHandler(e);return a&&a.parse?a.parse(i,this,n,r):n},parseExtensions:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return i.each(t,(function(t,i){if(!r.ignoreExtensions||!r.ignoreExtensions[i]){var a=n.getExtensionHandler(i),s=r.methodName||"parse";a&&a[s]&&(e=a[s](t,n,e,r))}})),e},isUseExtension:function(t,e){return!!(t&&t.extensions&&t.extensions[e])},parseBinary:function(t){this.isBinary=!0;var e,n=new DataView(t),r=n.getUint32(4,!0),a=n.getUint32(8,!0),s=12;if(r<2){var o=n.getUint32(s,!0);e=new Uint8Array(t,20,o),e=i.convertUint8ArrayToString(e,!0),this.json=JSON.parse(e),this.binaryBody=t.slice(20+o)}else{if(2!==r)throw new Error("Dont support glTF version ".concat(r));for(;s<a;){var u=n.getUint32(s,!0),c=n.getUint32(s+4,!0);1313821514===c?(e=new Uint8Array(t,s+8,u),e=i.convertUint8ArrayToString(e,!0),this.json=JSON.parse(e)):5130562===c&&(this.binaryBody=t.slice(s+8,s+8+u)),s+=8+u}}},loadResources:function(t){var e=this,n=[];for(var r in this.extensionsUsed){var i=this.getExtensionHandler(r);i&&i.init&&n.push(i.init(t,this))}return this.isBinary?n.push(this.loadBuffers(t).then((function(){return e.loadTextures(t)}))):(n.push(this.loadBuffers(t)),n.push(this.loadTextures(t))),Promise.all(n)},getBufferUri:function(t){var e=i.getRelativePath(this.src,this.json.buffers[t].uri);return this.preHandlerBufferURI&&(e=this.preHandlerBufferURI(e,this.json.buffers[t])),e},loadBuffers:function(t){var e=this;return this.buffers={},this.isBinary?(this.isGLTF2?this.buffers[0]=this.binaryBody:this.buffers.binary_glTF=this.binaryBody,this.parseBufferViews(),Promise.resolve()):Promise.all(Object.keys(this.json.buffers||[]).map((function(n){var r=e.getBufferUri(n);return t.loadRes(r,xi.TYPE_BUFFER).then((function(t){e.buffers[n]=t}))}))).then((function(){e.parseBufferViews()}))},getImageUri:function(t){var e=this.json.images[t],n=e.uri;if(this.isUseExtension(e,"KHR_binary_glTF")){var r=e.extensions.KHR_binary_glTF,a=this.bufferViews[r.bufferView],s=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);n=i.getBlobUrl(r.mimeType,s)}else if(n)n=i.getRelativePath(this.src,n);else if("bufferView"in e){var o=this.bufferViews[e.bufferView],u=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);n="image/ktx"===e.mimeType?u:i.getBlobUrl(e.mimeType,u)}return this.preHandlerImageURI&&(n=this.preHandlerImageURI(n,e)),n},getImageType:function(t){var e=this.json.images[t],n="";return e&&/^image\/(.*)$/.test(e.mimeType)&&(n=RegExp.$1),["ktx"].indexOf(n)<0&&(n=""),n},getUsedTextureNameMap:function(){var t=this,e={};return i.each(this.json.materials,(function(n){var r=n,a=!1;if(t.isUseExtension(n,"KHR_materials_common")&&(a=!0,r=n.extensions.KHR_materials_common.values),t.isGLTF2&&!a){if(r.normalTexture&&(e[r.normalTexture.index]=!0),r.occlusionTexture&&(e[r.occlusionTexture.index]=!0),r.emissiveTexture&&(e[r.emissiveTexture.index]=!0),r.transparencyTexture&&(e[r.transparencyTexture.index]=!0),r.extensions&&i.each(r.extensions,(function(n,r){var i=t.getExtensionHandler(r);i&&i.getUsedTextureNameMap&&i.getUsedTextureNameMap(n,e,t)})),!t.isUseExtension(r,"KHR_materials_pbrSpecularGlossiness")&&r.pbrMetallicRoughness){var s=r.pbrMetallicRoughness;s.baseColorTexture&&(e[s.baseColorTexture.index]=!0),s.metallicRoughnessTexture&&(e[s.metallicRoughnessTexture.index]=!0)}}else a||(r=n.values),["diffuse","specular","emission","ambient","transparency","normalMap"].forEach((function(n){var a=r[n];a instanceof Object&&"index"in a&&(a=a.index),i.isStrOrNumber(a)&&t.json.textures[a]&&(e[a]=!0)}))})),e},loadTextures:function(){var t=this;if(this.textures={},!this.json.textures)return Promise.resolve();var e=Object.keys(this.json.textures);if(!this.isLoadAllTextures){var n=this.getUsedTextureNameMap();e=e.filter((function(t){return n[t]}))}return Promise.all(e.map((function(e){var n=t.json.textures[e],r=t.getImageUri(n.source),a=new Gi(n);if(a.uv=void 0,a.autoLoad=t.isProgressive,a.crossOrigin=!0,a.resType=t.getImageType(n.source),a.src=r,a.name=n.name||e,a.colorSpaceConversion=!1,i.isBlobUrl(r)){var s=function t(){i.revokeBlobUrl(r),a.off("load",t),a.off("error",t)};a.on("load",s,!0),a.on("error",s,!0)}return t.json.samplers&&Object.assign(a,t.json.samplers[n.sampler]),n.extensions&&(a=t.parseExtensions(n.extensions,a)),t.textures[e]=a,t.isProgressive?Promise.resolve():a.load(!t.ignoreTextureError)})))},parseBufferViews:function(){var t=this;this.bufferViews={},i.each(this.json.bufferViews,(function(e,n){var r=t.buffers[e.buffer],i=e.byteOffset||0,a=e.byteLength;t.bufferViews[n]={id:d.a.generateUUID("bufferView"),byteOffset:i,byteLength:a,buffer:r,byteStride:e.byteStride}})),this.isBinary||delete this.buffers},getTexture:function(t){var e=this.textures[t.index];if(!e)return null;var n=t.texCoord||0,r=t.index+"_"+n;return this.textures[r]?e=this.textures[r]:"number"==typeof e.uv&&e.uv!==n&&(e=e.clone(),this.textures[r]=e),e.uv=n,e.__gltfTextureInfo=t,e},getColorOrTexture:function(t){return Array.isArray(t)?new v.a(t[0],t[1],t[2]):(t instanceof Object&&"index"in t&&(t=t.index),this.textures[t])},parseMaterialCommonProps:function(t,e){switch(e.alphaMode){case"BLEND":t.transparent=!0;break;case"MASK":t.alphaCutoff="alphaCutoff"in e?e.alphaCutoff:.5;break;case"OPAQUE":default:t.ignoreTranparent=!0}e.doubleSided?t.side=ca:t.side=oa,e.transparencyTexture&&(t.transparency=this.getTexture(e.transparencyTexture))},createPBRMaterial:function(t){var e=new Di,n=t,r=!this.isUseExtension(n,"KHR_materials_unlit");if(r){var i=n.normalTexture;i&&(e.normalMap=this.getTexture(i),void 0!==i.scale?e.normalMapScale=i.scale:e.normalMapScale=1);var a=n.occlusionTexture;a&&(e.occlusionMap=this.getTexture(a),void 0!==a.strength?e.occlusionStrength=a.strength:e.occlusionStrength=1);var s=n.emissiveTexture;s&&(e.emission=this.getTexture(s));var o=n.emissiveFactor;o&&(e.emissionFactor.fromArray(o),e.emissionFactor.a=1)}else e.lightType="NONE";if(this.isUseExtension(n,"KHR_materials_pbrSpecularGlossiness"))this.parseExtension(n.extensions,"KHR_materials_pbrSpecularGlossiness",e);else if(n.pbrMetallicRoughness){var u=n.pbrMetallicRoughness;u.baseColorFactor&&e.baseColor.fromArray(u.baseColorFactor),u.baseColorTexture&&(e.baseColorMap=this.getTexture(u.baseColorTexture)),r&&(u.metallicRoughnessTexture&&(e.metallicRoughnessMap=this.getTexture(u.metallicRoughnessTexture),e.occlusionMap===e.metallicRoughnessMap&&(e.occlusionMap=null,e.isOcclusionInMetallicRoughnessMap=!0)),"roughnessFactor"in u&&(e.roughness=u.roughnessFactor),"metallicFactor"in u&&(e.metallic=u.metallicFactor))}return e.baseColorMap&&this._parseTextureTransform(e,e.baseColorMap),e},_parseTextureTransform:function(t,e){var n=e.__gltfTextureInfo;if(this.isUseExtension(n,"KHR_texture_transform")){var r=n.extensions.KHR_texture_transform;if(void 0!==r.texCoord&&(e.uv=r.texCoord),r.offset||r.rotation||r.scale){var i=r.offset||[0,0],a=r.rotation||0,s=r.scale||[1,1],o=(new y.a).fromRotationTranslationScale(a,i[0],i[1],s[0],s[1]);0===e.uv?t.uvMatrix=o:1===e.uv&&(t.uvMatrix1=o)}}},createKMCMaterial:function(t,e){var n,r=new en;return e?(n=e.values,r.lightType=e.technique):n=t.values,r.diffuse=this.getColorOrTexture(n.diffuse)||r.diffuse,r.specular=this.getColorOrTexture(n.specular)||r.specular,r.emission=this.getColorOrTexture(n.emission)||r.emission,r.ambient=this.getColorOrTexture(n.ambient)||r.ambient,n.normalMap&&(r.normalMap=this.getColorOrTexture(n.normalMap)),"number"==typeof n.transparency?(r.transparency=n.transparency,r.transparency<1&&(r.transparent=!0)):"string"==typeof n.transparency&&(r.transparency=this.getColorOrTexture(n.transparency),r.transparent=!0),!0===n.transparent&&(r.transparent=!0),"shininess"in n&&(r.shininess=n.shininess),this._parseTextureTransform(r,r.diffuse),r},parseMaterials:function(){var t=this;this.materials={},i.each(this.json.materials,(function(e,n){if(t.customMaterialCreator){var r=t.customMaterialCreator(n,e,t.json,t);if(r)return void(t.materials[n]=r)}var i,a=null;t.isUseExtension(e,"KHR_materials_common")&&(a=e.extensions.KHR_materials_common),t.isGLTF2&&!a?(i=t.isUseExtension(e,"KHR_techniques_webgl")?t.parseExtension(e.extensions,"KHR_techniques_webgl"):t.createPBRMaterial(e),t.parseMaterialCommonProps(i,e)):i=t.createKMCMaterial(e,a),(i=t.parseExtensions(e.extensions,i,{ignoreExtensions:{KHR_techniques_webgl:1,KHR_materials_common:1,KHR_materials_pbrSpecularGlossiness:1},isMaterial:!0})).name=e.name||n,t.materials[n]=i,t.parseTechnique(e,i)}))},sparseAccessorHandler:function(t,e){if(!e)return t;var n=e.count,r=t.data.constructor,a=new r(t.realLength);a.set(t.data),t.data=a;for(var s=this.bufferViews[e.values.bufferView],o=new r(s.buffer,s.byteOffset+(e.values.byteOffset||0),n*t.size),u=new(r=ha[e.indices.componentType][1])((s=this.bufferViews[e.indices.bufferView]).buffer,s.byteOffset+(e.indices.byteOffset||0),n),c=0;c<n;c++)i.copyArrayData(a,o,u[c]*t.size,c*t.size,t.size);return t},getAccessorData:function(t,e){var n=this.json.accessors[t];if(n.data)return n.data;var r,i=na(ha[n.componentType],2)[1],a=fa[n.type],s=this.bufferViews[n.bufferView],o=n.count*a;if(s)if(s.byteStride&&s.byteStride>a*i.BYTES_PER_ELEMENT)s.array=new i(s.buffer,s.byteOffset,s.byteLength/i.BYTES_PER_ELEMENT),r=new b(s.array,a,{offset:n.byteOffset||0,stride:s.byteStride,bufferViewId:s.id});else{var u,c=(n.byteOffset||0)+s.byteOffset;if(c%i.BYTES_PER_ELEMENT||this.forceCreateNewBuffer)u=new i(s.buffer.slice(c,c+o*i.BYTES_PER_ELEMENT));else u=new i(s.buffer,c,o);r=new b(u,a)}return n.sparse&&(r||(r=new b(new i(o),a)),r=this.sparseAccessorHandler(r,n.sparse)),r=this.parseExtensions(n.extensions,r,{isDecode:e,isAccessor:!0}),n.data=r,n.normalized&&(r.normalized=!0),r},getArrayByAccessor:function(t,e){var n=this.json.accessors[t];if(n.array)return n.array;var r=this.getAccessorData(t,e);if(!r.stride&&!r.offset&&1===r.size)return r.data;var i=[];return r.traverse((function(t){i.push(t.toArray?t.toArray():t)})),n.array=i,i},parseTechnique:function(t,e){var n=null;this.json.techniques&&(n=this.json.techniques[t.technique]),n&&n.states&&(n.states.enable.forEach((function(t){switch(t){case ia:e.blend=!0;break;case aa:e.depthTest=!0;break;case sa:e.cullFace=!0}})),i.each(n.states.functions,(function(t,n){switch(n){case"blendEquationSeparate":e.blendEquation=t[0],e.blendEquationAlpha=t[1];break;case"blendFuncSeparate":e.blendSrc=t[0],e.blendDst=t[1],e.blendSrcAlpha=t[2],e.blendDstAlpha=t[3];break;case"depthMask":e.depthMask=t[0];break;case"cullFace":e.cullFaceType=t[0];break;default:e[n]=t}})),e.cullFace?e.side=e.cullFaceType===oa?ua:oa:e.side=ca)},createMorphGeometry:function(t,e){var n=this,r=new Zn,a=r.targets={};return i.each(t.targets,(function(t){i.each(t,(function(t,e){var r=la[e].name;a[r]||(a[r]=[]);var i=n.getAccessorData(t,!0);a[r].push(i)}))})),r.weights=e||new Float32Array(t.targets.length),r},handlerGeometry:function(t,e){var n=void 0===e.mode?4:e.mode;if(e.extensions){var r=this.parseExtensions(e.extensions,null,{primitive:e,isPrimitive:!0});if(r)return r.mode=n,r}t||(t=new Z({mode:n})),"indices"in e&&(t.indices=this.getAccessorData(e.indices));var i=e.attributes;for(var a in i){var s=la[a];if(s){var o=!(this.isUnQuantizeInShader&&s.decodeMatName);t[s.name]=this.getAccessorData(i[a],o),o||(t[s.decodeMatName]=t[s.name].decodeMat,delete t[s.name].decodeMat)}else m.a.warn("Unknow attribute named ".concat(a,"!"))}return t},handlerSkinedMesh:function(t,e){e&&(t.skeleton=e,this.useInstanced&&(t.useInstanced=!0))},fixProgressiveGeometry:function(t,e){t._geometry=e,this.isProgressive&&t._meshes&&t._meshes.forEach((function(t){t.visible=!0,t.geometry=e}))},parseGeometries:function(){var t=this,e=i.serialRun(this.json.meshes,(function(e){return i.serialRun(e.primitives,(function(n){var r;n.targets&&n.targets.length&&(r=t.createMorphGeometry(n,e.weights)),n._geometry=r;var i=t.handlerGeometry(r,n);return i&&i.then?i.then((function(e){t.fixProgressiveGeometry(n,e)}),(function(t){m.a.error("geometry parse error",t)})):(t.fixProgressiveGeometry(n,i),i)}))}));return this.isProgressive?null:e},parseMesh:function(t,e,n){var r=this,i=this.json.meshes[t];i.primitives.forEach((function(a){var s,o=r.skins&&r.skins[n.skin];if(a.meshNode)s=a.meshNode.clone();else{var u=r.materials[a.material]||new en;s=new(o?Er:_r)({geometry:a._geometry,material:u,name:"mesh-"+(i.name||t)}),a.meshNode=s}r.handlerSkinedMesh(s,o),r.isProgressive&&!s.geometry&&(s.visible=!1,a._meshes=a._meshes||[],a._meshes.push(s)),e.addChild(s),r.meshes.push(s)}))},parseCameras:function(){var t=this;this.cameras={};var e=window.innerWidth/window.innerHeight;i.each(this.json.cameras,(function(n,r){var i;"perspective"===n.type&&n.perspective?((i=new Q).fov=d.a.radToDeg(n.perspective.yfov),i.near=n.perspective.znear,i.far=n.perspective.zfar,n.aspectRatio?i.aspect=n.aspectRatio:i.aspect=e):"orthographic"===n.type&&n.orthographic&&((i=new fn).near=n.orthographic.znear,i.far=n.orthographic.zfar,i.right=n.orthographic.xmag,i.left=-1*i.right,i.top=n.orthographic.ymag,i.bottom=-1*i.top),(i=t.parseExtensions(n.extensions,i,{isCamera:!0}))&&(i.name=n.name||r,t.cameras[r]=i)}))},handlerNodeTransform:function(t,e){e.matrix?t.matrix.fromArray(e.matrix):(e.rotation&&t.quaternion.fromArray(e.rotation),e.scale&&t.setScale(e.scale[0],e.scale[1],e.scale[2]),e.translation&&(t.x=e.translation[0],t.y=e.translation[1],t.z=e.translation[2]))},parseNode:function(t,e){var n,r=this,i=this.json.nodes[t];i||m.a.warn("GLTFParser.parseNode: nodes[".concat(t,"] has nothing.")),n=new g({name:i.name,animationId:t}),n=this.parseExtensions(i.extensions,n,{isNode:!0}),"camera"in i&&this.cameras[i.camera]&&n.addChild(this.cameras[i.camera]),this.handlerNodeTransform(n,i),i.jointName?(n.jointName=i.jointName,this.jointMap[n.jointName]=n):this.isGLTF2&&(n.jointName=t,this.jointMap[t]=n),i.meshes?i.meshes.forEach((function(t){return r.parseMesh(t,n,i)})):"mesh"in i&&this.parseMesh(i.mesh,n,i),i.children&&i.children.forEach((function(t){return r.parseNode(t,n)})),e.addChild(n)},parseAnimations:function(){var t=this;if(!this.json.animations)return null;var e=this.isMultiAnim,n={},r=[],a={};return i.each(this.json.animations,(function(i){i.channels.forEach((function(e){var n=e.target.path,s=e.target.id;t.isGLTF2&&(s=e.target.node);var o=i.samplers[e.sampler],u=t.isGLTF2?o.input:i.parameters[o.input],c=t.isGLTF2?o.output:i.parameters[n],h=t.getArrayByAccessor(u,!0),f=t.getArrayByAccessor(c,!0);"rotation"===n&&(n="quaternion");var l=new $i({interpolationType:o.interpolation||"LINEAR",nodeName:s,keyTime:h,states:f,type:$i.getType(n)});r.push(l),a[s]=!0})),e&&r.length&&(n[i.name]={animStatesList:r},r=[])})),e&&Object.keys(n).length>0&&(r=Object.values(n)[0].animStatesList),r.length?new ea({rootNode:this.node,animStatesList:r,validAnimationIds:a,clips:n}):null},parseScene:function(){var t=this;this.parseMaterials(),this.jointMap={},this.meshes=[],this.lights=[],this.node=new g({needCallChildUpdate:!1}),this.parseCameras();var e=this.json.scenes[this.getDefaultSceneName()];if(!e)return m.a.warn("GLTFParser:no scene!"),{node:this.node,meshes:[],cameras:[],lights:[],textures:[],materials:[]};var n=e.nodes;this.parseSkins(),n.forEach((function(e){return t.parseNode(e,t.node)})),this.resetSkinInfo(this.node);var r={node:this.node,scene:this.node,meshes:this.meshes,json:this.json,cameras:Object.values(this.cameras),lights:this.lights,textures:Object.values(this.textures),materials:Object.values(this.materials)},i=this.parseAnimations();return i&&(this.node.setAnim(i),i.play(),r.anim=i),this.parseExtensions(e.extensions,null,{isScene:!0}),this.parseExtensions(this.json.extensions,r,{isGlobal:!0,methodName:"parseOnEnd"}),r},getDefaultSceneName:function(){return void 0!==this.defaultScene?this.defaultScene:this.json.scenes?Object.keys(this.json.scenes)[0]:null},parseSkins:function(){var t=this;this.skins=[];var e=this.json.skins;e&&e.length&&(this.skins=e.map((function(e){for(var n=new Mr,r=e.joints.length,i=t.getArrayByAccessor(e.inverseBindMatrices,!0),a=0;a<r;a++){var s=(new o.a).fromArray(i[a]);n.inverseBindMatrices.push(s)}return n.jointNames=e.joints,n})))},resetSkinInfo:function(t){var e={};t.traverse((function(t){var n="".concat(t.id,"_").concat(t.name);e[t.jointName]=n,t.jointName=n})),this.skins.forEach((function(t){t.jointNames=t.jointNames.map((function(t){return e[t]}))})),t.resetSkinedMeshRootNode()}}),ma=da,_a=a.a.create({Extends:xi,isGLTFLoader:!0,className:"GLTFLoader",constructor:function(){_a.superclass.constructor.call(this)},load:function(t){var e=this;return this.loadRes(t.src,"buffer").then((function(n){return new ma(n,t).parse(e)})).catch((function(t){throw m.a.error("load gltf failed",t.message,t.stack),t}))}});bi.addLoader("gltf",_a),bi.addLoader("glb",_a);var pa=_a,ga=n(99),va=n.n(ga),Ea=P.a.RGBA,Ta=P.a.NEAREST,Ma=P.a.CLAMP_TO_EDGE,Aa=P.a.FLOAT,La=a.a.create({Extends:xi,isHDRLoader:!0,className:"HDRLoader",constructor:function(){La.superclass.constructor.call(this)},load:function(t){return this.loadRes(t.src,"buffer").then((function(e){try{var n=va()(e),r=n.shape,i=n.data,a=new Qt({width:r[0],height:r[1],flipY:t.flipY||!1,image:i,type:Aa,magFilter:Ta,minFilter:Ta,wrapS:Ma,wrapT:Ma,internalFormat:Ea,format:Ea});return Object.assign(a,t),a}catch(t){m.a.error("HDRLoader:parse error => ",t)}return null}))}});bi.addLoader("hdr",La);var Ia=La,Oa=a.a.create({Statics:{HEADER_LEN:64,COMPRESSED_2D:0,COMPRESSED_3D:1,TEX_2D:2,TEX_3D:3},isKhronosTextureContainer:!0,className:"KhronosTextureContainer",constructor:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.arrayBuffer=t,this.baseOffset=n;var r=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171===r[0]&&75===r[1]&&84===r[2]&&88===r[3]&&32===r[4]&&49===r[5]&&49===r[6]&&187===r[7]&&13===r[8]&&10===r[9]&&26===r[10]&&10===r[11]){var i=Uint32Array.BYTES_PER_ELEMENT,a=new DataView(this.arrayBuffer,this.baseOffset+12,13*i),s=a.getUint32(0,!0),o=67305985===s;this.glType=a.getUint32(1*i,o),this.glTypeSize=a.getUint32(2*i,o),this.glFormat=a.getUint32(3*i,o),this.glInternalFormat=a.getUint32(4*i,o),this.glBaseInternalFormat=a.getUint32(5*i,o),this.pixelWidth=a.getUint32(6*i,o),this.pixelHeight=a.getUint32(7*i,o),this.pixelDepth=a.getUint32(8*i,o),this.numberOfArrayElements=a.getUint32(9*i,o),this.numberOfFaces=a.getUint32(10*i,o),this.numberOfMipmapLevels=a.getUint32(11*i,o),this.bytesOfKeyValueData=a.getUint32(12*i,o),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===e?0===this.glType?this.loadType=Oa.COMPRESSED_2D:this.loadType=Oa.TEX_2D:m.a.warn("number of faces expected"+e+", but found "+this.numberOfFaces):m.a.warn("texture arrays not currently supported"):m.a.warn("only 2D textures currently supported")}else m.a.error("texture missing KTX identifier")},mipmaps:function(t){for(var e=[],n=Oa.HEADER_LEN+this.bytesOfKeyValueData,r=this.pixelWidth,i=this.pixelHeight,a=t?this.numberOfMipmapLevels:1,s=0;s<a;s++){for(var o=new Int32Array(this.arrayBuffer,this.baseOffset+n,1)[0],u=0;u<this.numberOfFaces;u++){var c=new Uint8Array(this.arrayBuffer,this.baseOffset+n+4,o);e.push({data:c,width:r,height:i}),n+=o+4,n+=3-(o+3)%4}r=Math.max(1,.5*r),i=Math.max(1,.5*i)}return e}}),Sa=a.a.create({Extends:xi,Statics:{astc:"WEBGL_compressed_texture_astc",etc:"WEBGL_compressed_texture_etc",etc1:"WEBGL_compressed_texture_etc1",pvrtc:"WEBGL_compressed_texture_pvrtc",s3tc:"WEBGL_compressed_texture_s3tc"},isKTXLoader:!0,className:"KTXLoader",constructor:function(){tt.use(Sa.astc),tt.use(Sa.atc),tt.use(Sa.etc),tt.use(Sa.etc1),tt.use(Sa.pvrtc),tt.use(Sa.s3tc),tt.use(Sa.s3tc_srgb),Sa.superclass.constructor.call(this)},load:function(t){var e=this;return t.src instanceof ArrayBuffer?Promise.resolve(this.createTexture(t,t.src)):ArrayBuffer.isView(t.src)?Promise.resolve(this.createTexture(t,t.src.buffer,t.src.byteOffset)):this.loadRes(t.src,"buffer").then((function(n){return e.createTexture(t,n)}))},createTexture:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=new Oa(e,1,n),i={compressed:0===r.glType,type:r.glType,width:r.pixelWidth,height:r.pixelHeight,internalFormat:r.glInternalFormat,format:r.glFormat,isCubemap:6===r.numberOfFaces};return r.numberOfMipmapLevels>=Math.floor(Math.log2(Math.max(i.width,i.height))+1)?(i.mipmaps=r.mipmaps(!0),i.image=i.mipmaps[0].data):(i.mipmaps=null,i.image=r.mipmaps(!1)[0].data),new Qt(i)}});bi.addLoader("ktx",Sa);var Ra=Sa,ya=a.a.create({Mixes:s.a,isLoadQueue:!0,className:"LoadQueue",Statics:{addLoader:function(t,e){m.a.warn("LoadQueue.addLoader is duplicated, please use Loader.addLoader"),bi.addLoader(t,e)}},constructor:function(t){this._source=[],this.add(t)},maxConnections:2,_source:null,_loaded:0,_connections:0,_currentIndex:-1,add:function(t){return t&&(t=Array.isArray(t)?t:[t],this._source=this._source.concat(t)),this},get:function(t){if(!t)return null;for(var e=this._source,n=0;n<e.length;n++){var r=e[n];if(r.id===t||r.src===t)return r}return null},getContent:function(t){var e=this.get(t);return e&&e.content},start:function(){return this._loader||(this._loader=new bi),this._loadNext(),this},_loadNext:function(){var t=this,e=this._source,n=e.length;if(this._loaded>=n)this.fire("complete");else if(this._currentIndex<n-1&&this._connections<this.maxConnections){var r=++this._currentIndex,i=e[r];this._connections++,this._loader.load(i).then((function(e){t._onItemLoad(r,e)}),(function(e){t._onItemError(r,e)}))}},_onItemLoad:function(t,e){var n=this._source[t];n.loaded=!0,n.content=e,this._connections--,this._loaded++,this.fire("load",n),this._loadNext()},_onItemError:function(t,e){var n=this._source[t];n.error=e,this._connections--,this._loaded++,this.fire("error",n),this._loadNext()},getSize:function(t){for(var e=0,n=this._source,r=0;r<n.length;r++){var i=n[r];e+=(t?i.loaded&&i.size:i.size)||0}return e},getLoaded:function(){return this._loaded},getTotal:function(){return this._source.length},getAllContent:function(){return this._source.map((function(t){return t.content}))}}),Na=a.a.create({Extends:xi,isShaderMaterialLoader:!0,className:"ShaderMaterialLoader",constructor:function(){Na.superclass.constructor.call(this)},load:function(t){var e=[this.loadRes(t.fs),this.loadRes(t.vs)],n=Object.assign({},t);return Promise.all(e).then((function(t){return n.fs=t[0],n.vs=t[1],new zn(n)}),(function(t){m.a.warn("ShaderMaterial Loader Failed for ".concat(t))}))}}),xa=Na,Ca=a.a.create({Extends:xi,isTextureLoader:!0,className:"TextureLoader",constructor:function(){Ca.superclass.constructor.call(this)},load:function(t){return this.loadImg(t.src,t.crossOrigin).then((function(e){var n=Object.assign({},t);return n.image=e,delete n.type,new Qt(n)})).catch((function(t){throw m.a.error("load Texture failed",t.message,t.stack),t}))}});bi.addLoader("Texture",Ca);var ba=Ca,Pa=P.a.LINES,wa={x:[0,0,0,1,0,0],y:[0,0,0,0,1,0],z:[0,0,0,0,0,1]},Ha=a.a.create({Extends:g,isAxisHelper:!0,className:"AxisHelper",size:1,constructor:function(t){Ha.superclass.constructor.call(this,t),this.init()},addAxis:function(t){var e=new _r({name:"AxisHelper_"+t,geometry:new Z({mode:Pa,vertices:new b(new Float32Array(wa[t]),3),indices:new b(new Uint16Array([0,1]),1)}),material:new en({diffuse:new v.a(wa[t][3],wa[t][4],wa[t][5]),lightType:"NONE"})});this.addChild(e)},init:function(){this.setScale(this.size),this.addAxis("x"),this.addAxis("y"),this.addAxis("z")}}),Da=Ha,Fa=P.a.LINES,Ua=a.a.create({Extends:_r,isAxisNetHelper:!0,className:"AxisNetHelper",size:5,constructor:function(t){Ua.superclass.constructor.call(this,t),this.color=this.color||new v.a(.5,.5,.5);for(var e=new Z({mode:Fa}),n=this.size,r=2*n+1,i=0;i<r;i++){var a=i/n-1;e.addLine([a,0,-1],[a,0,1]),e.addLine([-1,0,a],[1,0,a])}this.geometry=e,this.material=new en({diffuse:this.color,lightType:"NONE"})}}),Ga=Ua,Ba=P.a.LINES,Va=new c.a,Xa=a.a.create({Extends:_r,isCameraHelper:!0,className:"CameraHelper",camera:null,color:null,constructor:function(t){Xa.superclass.constructor.call(this,t),this.color||(this.color=new v.a(.3,.9,.6)),this.material=new en({lightType:"NONE",diffuse:this.color||new v.a(.5,.5,.5,1)}),this.geometry=new Z({mode:Ba,isStatic:!1,vertices:new b(new Float32Array(27),3),indices:new b(new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7,8,4,8,5,8,6,8,7]),1)})},onUpdate:function(){this.camera&&(this.camera.updateViewProjectionMatrix(),this._buildGeometry())},_buildGeometry:function(){var t=this.camera,e=this.geometry;e.vertices.set(0,t.unprojectVector(Va.set(-1,-1,1))),e.vertices.set(1,t.unprojectVector(Va.set(-1,1,1))),e.vertices.set(2,t.unprojectVector(Va.set(1,1,1))),e.vertices.set(3,t.unprojectVector(Va.set(1,-1,1))),e.vertices.set(4,t.unprojectVector(Va.set(-1,-1,-1))),e.vertices.set(5,t.unprojectVector(Va.set(-1,1,-1))),e.vertices.set(6,t.unprojectVector(Va.set(1,1,-1))),e.vertices.set(7,t.unprojectVector(Va.set(1,-1,-1))),e.vertices.set(8,t.worldMatrix.getTranslation(Va))}}),ja=Xa,ka=a.a.create({Extends:M,isAmbientLight:!0,className:"AmbientLight",autoUpdateWorldMatrix:!1,constructor:function(t){ka.superclass.constructor.call(this,t)}}),za=ka,Wa=a.a.create({Statics:{ltcTexture1:null,ltcTexture2:null,ltcTextureReady:!1,ltcTextureUrl:"//g.alicdn.com/tmapp/static/4.0.63/ltcTexture.js",loadLtcTexture:function(){var t=this;this.ltcTextureReady||void 0===this._loader&&(this._loader=new bi,this._loader.load({type:"json",src:this.ltcTextureUrl}).then((function(e){t._loader=null,t.ltcTexture1=new Le({data:e.ltcTexture1}),t.ltcTexture2=new Le({data:e.ltcTexture2}),t.ltcTextureReady=!0})))}},Extends:M,isAreaLight:!0,className:"AreaLight",width:10,height:10,_enabled:!0,enabled:{get:function(){return this._enabled&&Wa.ltcTextureReady},set:function(t){this._enabled=t}},constructor:function(t){Wa.superclass.constructor.call(this,t),Wa.loadLtcTexture()},ltcTexture1:{get:function(){return Wa.ltcTexture1},set:function(t){Wa.ltcTexture1=t}},ltcTexture2:{get:function(){return Wa.ltcTexture2},set:function(t){Wa.ltcTexture2=t}}}),Ya=Wa,qa=new en({lightType:"NONE"}),Za=new v.a(1,1,1),Ka=new v.a,Qa=a.a.create({isMeshPicker:!0,className:"MeshPicker",debug:!1,renderer:null,colorMeshMap:null,constructor:function(t){Object.assign(this,t),this.colorMeshMap={},this.init()},createFramebuffer:function(){if(!this.framebuffer){var t=this.renderer;this.framebuffer=new ce(t,{useVao:t.useVao,width:t.width,height:t.height})}},renderDebug:function(){this.framebuffer.render(0,.7,.3,.3)},createMeshNumberId:function(t){"numberId"in t||(t.numberId=10*Number(t.id.replace(/^.*_(\d+)$/,"$1")),t.color=Object(i.padLeft)(t.numberId.toString(16),6),this.colorMeshMap[t.color]=t)},renderColoredMeshes:function(){var t=this,e=this.renderer,n=this.framebuffer;n.bind(),e.clear(Za);var r=e.forceMaterial;e.forceMaterial=qa,e.renderList.traverse((function(n){t.createMeshNumberId(n),qa.diffuse.fromHEX(n.color),qa.isDirty=!0,e.renderMesh(n)})),e.forceMaterial=r,n.unbind()},getSelection:function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=this.renderer.pixelRatio,a=[],s=this.framebuffer.readPixels(t*i,e*i,n*i,r*i),o=0;o<s.length;o+=4){var u=Ka.fromUintArray(s,o).toHEX();this.colorMeshMap[u]&&a.push(this.colorMeshMap[u])}return a},init:function(){var t=this;this.createFramebuffer(),this.renderer.on("afterRender",(function(){t.renderColoredMeshes(),t.debug&&t.renderDebug()}))}}),Ja=a.a.create({constructor:function(t){this.targetFPS=t||60,this._tickers=[]},_paused:!1,_targetFPS:0,_interval:0,_intervalId:null,_tickers:null,_lastTime:0,_tickCount:0,_tickTime:0,_measuredFPS:0,targetFPS:{set:function(t){this._targetFPS=t,this._interval=1e3/this._targetFPS,this._intervalId&&(this._cancelRunLoop(),this._startRunLoop())},get:function(){return this._targetFPS}},start:function(){this._paused=!1,this._startRunLoop()},stop:function(){this._paused=!0,this._cancelRunLoop(),this._lastTime=0},pause:function(){this._paused=!0},resume:function(){this._paused=!1},_startRunLoop:function(){if(!this._intervalId){this._lastTime=+new Date;var t,e=this,n=this._interval,r=window.requestAnimationFrame;r&&n<17?(this._useRAF=!0,t=function(){e._intervalId=r(t),e._tick()}):(this._useRAF=!1,t=function(){e._intervalId=setTimeout(t,n),e._tick()}),t()}},_cancelRunLoop:function(){this._useRAF?(0,window.cancelAnimationFrame)(this._intervalId):clearTimeout(this._intervalId);this._intervalId=null},_tick:function(){if(!this._paused){var t=+new Date,e=t-this._lastTime,n=this._tickers;++this._tickCount>=this._targetFPS?(this._measuredFPS=1e3/(this._tickTime/this._tickCount)+.5>>0,this._tickCount=0,this._tickTime=0):this._tickTime+=t-this._lastTime,this._lastTime=t;for(var r=n.slice(0),i=0,a=r.length;i<a;i++)r[i].tick(e)}},getMeasuredFPS:function(){return Math.min(this._measuredFPS,this._targetFPS)},addTick:function(t){if(!t||"function"!=typeof t.tick)throw new Error("Ticker: The tick object must implement the tick method.");this._tickers.push(t)},removeTick:function(t){var e=this._tickers,n=e.indexOf(t);n>=0&&e.splice(n,1)},nextTick:function(t){var e=this,n={tick:function(r){e.removeTick(n),t(r)}};return e.addTick(n),n},timeout:function(t,e){var n=this,r=(new Date).getTime()+e,i={tick:function(){(new Date).getTime()-r>=0&&(n.removeTick(i),t())}};return n.addTick(i),i},interval:function(t,e){var n=(new Date).getTime()+e,r={tick:function(){var r=(new Date).getTime(),i=r-n;i>=0&&(i<e&&(r-=i),n=r+e,t())}};return this.addTick(r),r}}),$a={get:function(){if(void 0===this._isWebGLSupport)try{var t=document.createElement("canvas"),e=t.getContext("webgl");e.clearColor(0,1,0,1),e.clear(e.COLOR_BUFFER_BIT);var n=new Uint8Array(4);e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,n),0===n[0]&&255===n[1]&&0===n[2]&&255===n[3]?this._isWebGLSupport=!0:this._isWebGLSupport=!1,t=null,e=null,n=null}catch(t){this._isWebGLSupport=!1}return this._isWebGLSupport}},ts=n(27)},,,function(t,e,n){n(100),t.exports=n(106)}]),"undefined"!=typeof window&&window.Hilo3d&&"object"==typeof exports&&"object"==typeof module&&(module.exports=window.Hilo3d);
|
|
39
|
+
*/var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;function s(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,o,u=s(t),c=1;c<arguments.length;c++){for(var h in n=Object(arguments[c]))i.call(n,h)&&(u[h]=n[h]);if(r){o=r(n);for(var f=0;f<o.length;f++)a.call(n,o[f])&&(u[o[f]]=n[o[f]])}}return u}},function(t,e,n){"use strict";var r,i,a,s;Object.keys||(Object.keys=(r=Object.prototype.hasOwnProperty,i=!{toString:null}.propertyIsEnumerable("toString"),s=(a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(t){if("object"!=typeof t&&("function"!=typeof t||null===t))throw new TypeError("Object.keys called on non-object");var e,n,o=[];for(e in t)r.call(t,e)&&o.push(e);if(i)for(n=0;n<s;n++)r.call(t,a[n])&&o.push(a[n]);return o}))},function(t,e,n){"use strict";t.exports=function(t){return Object.keys(t).map((function(e){return t[e]}))}},function(t,e,n){"use strict";t.exports="function"==typeof Promise?Promise:n(101)},function(t,e){t.exports=function(t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));var e=0,n=t.length;function r(){var r="";do{var i=t[e];if(10==i){++e;break}r+=String.fromCharCode(i)}while(++e<n);return r}for(var i=0,a=0,s=1,o=!1,u=0;u<20;u++){var c,h=r();if(c=h.match("#\\?RADIANCE"));else if(c=h.match("FORMAT=32-bit_rle_rgbe"))o=!0;else if(c=h.match("EXPOSURE=\\s*([0-9]*[.][0-9]*)"))s=Number(c[1]);else if(c=h.match("#.*"));else if(c=h.match("-Y ([0-9]+) \\+X ([0-9]+)")){a=Number(c[1]),i=Number(c[2]);break}}if(!o)throw new Error("File is not run length encoded!");var f=new Uint8Array(i*a*4);!function(t,e,n,r,i,a){var s,o,u,c=new Array(4),h=null,f=new Array(2),l=t.length;function d(e){var n=0;do{e[n++]=t[r]}while(++r<l&&n<e.length);return n}function m(e,n,i){var a=0;do{e[n+a++]=t[r]}while(++r<l&&a<i);return a}function _(t,e,n,r){var i=4*r,a=m(e,n,i);if(a<i)throw new Error("Error reading raw pixels: got "+a+" bytes, expected "+i)}for(;a>0;){if(d(c)<c.length)throw new Error("Error reading bytes: expected "+c.length);if(2!=c[0]||2!=c[1]||0!=(128&c[2]))return e[n++]=c[0],e[n++]=c[1],e[n++]=c[2],e[n++]=c[3],void _(0,e,n,i*a-1);if(((255&c[2])<<8|255&c[3])!=i)throw new Error("Wrong scanline width "+((255&c[2])<<8|255&c[3])+", expected "+i);null==h&&(h=new Array(4*i)),s=0;for(var p=0;p<4;p++)for(o=(p+1)*i;s<o;){if(d(f)<f.length)throw new Error("Error reading 2-byte buffer");if((255&f[0])>128){if(0==(u=(255&f[0])-128)||u>o-s)throw new Error("Bad scanline data");for(;u-- >0;)h[s++]=f[1]}else{if(0==(u=255&f[0])||u>o-s)throw new Error("Bad scanline data");if(h[s++]=f[1],--u>0){if(m(h,s,u)<u)throw new Error("Error reading non-run data");s+=u}}}for(p=0;p<i;p++)e[n+0]=h[p],e[n+1]=h[p+i],e[n+2]=h[p+2*i],e[n+3]=h[p+3*i],n+=4;a--}}(t,f,0,e,i,a);for(var l=new Float32Array(i*a*4),d=0;d<f.length;d+=4){var m=f[d+0]/255,_=f[d+1]/255,p=f[d+2]/255,g=f[d+3],v=Math.pow(2,g-128);m*=v,_*=v,p*=v;var E=d;l[E+0]=m,l[E+1]=_,l[E+2]=p,l[E+3]=1}return{shape:[i,a],exposure:s,gamma:1,data:l}}},function(t,e,n){"use strict";n.r(e);var r=n(95),i=n.n(r),a=n(96),s=n.n(a),o=n(97),u=n.n(o),c=n(98),h=n.n(c);Object.assign||(Object.assign=i.a),Object.keys||(Object.keys=s.a),Object.values||(Object.values=u.a),"undefined"==typeof Promise&&(window.Promise=h.a),[Int8Array,Uint8Array,Int16Array,Uint16Array,Uint32Array,Float32Array].forEach((function(t){t.prototype.slice||Object.defineProperty(t.prototype,"slice",{value:function(e,n){return new t(Array.prototype.slice.call(this,e,n))}})}))},function(t,e,n){"use strict";(function(e,n){var r,i=function(){},a=void 0!==e&&void 0!==e.process&&"function"==typeof e.process.emit,s=void 0===n?setTimeout:n,o=[];function u(){for(var t=0;t<o.length;t++)o[t][0](o[t][1]);o=[],r=!1}function c(t,e){o.push([t,e]),r||(r=!0,s(u,0))}function h(t){var e=t.owner,n=e._state,r=e._data,i=t[n],a=t.then;if("function"==typeof i){n="fulfilled";try{r=i(r)}catch(t){m(a,t)}}f(a,r)||("fulfilled"===n&&l(a,r),"rejected"===n&&m(a,r))}function f(t,e){var n;try{if(t===e)throw new TypeError("A promises callback cannot return that same promise.");if(e&&("function"==typeof e||"object"==typeof e)){var r=e.then;if("function"==typeof r)return r.call(e,(function(r){n||(n=!0,e===r?d(t,r):l(t,r))}),(function(e){n||(n=!0,m(t,e))})),!0}}catch(e){return n||m(t,e),!0}return!1}function l(t,e){t!==e&&f(t,e)||d(t,e)}function d(t,e){"pending"===t._state&&(t._state="settled",t._data=e,c(p,t))}function m(t,e){"pending"===t._state&&(t._state="settled",t._data=e,c(g,t))}function _(t){t._then=t._then.forEach(h)}function p(t){t._state="fulfilled",_(t)}function g(t){t._state="rejected",_(t),!t._handled&&a&&e.process.emit("unhandledRejection",t._data,t)}function v(t){e.process.emit("rejectionHandled",t)}function E(t){if("function"!=typeof t)throw new TypeError("Promise resolver "+t+" is not a function");if(this instanceof E==!1)throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._then=[],function(t,e){function n(t){m(e,t)}try{t((function(t){l(e,t)}),n)}catch(t){n(t)}}(t,this)}E.prototype={constructor:E,_state:"pending",_then:null,_data:void 0,_handled:!1,then:function(t,e){var n={owner:this,then:new this.constructor(i),fulfilled:t,rejected:e};return!e&&!t||this._handled||(this._handled=!0,"rejected"===this._state&&a&&c(v,this)),"fulfilled"===this._state||"rejected"===this._state?c(h,n):this._then.push(n),n.then},catch:function(t){return this.then(null,t)}},E.all=function(t){if(!Array.isArray(t))throw new TypeError("You must pass an array to Promise.all().");return new E((function(e,n){var r=[],i=0;function a(t){return i++,function(n){r[t]=n,--i||e(r)}}for(var s,o=0;o<t.length;o++)(s=t[o])&&"function"==typeof s.then?s.then(a(o),n):r[o]=s;i||e(r)}))},E.race=function(t){if(!Array.isArray(t))throw new TypeError("You must pass an array to Promise.race().");return new E((function(e,n){for(var r,i=0;i<t.length;i++)(r=t[i])&&"function"==typeof r.then?r.then(e,n):e(r)}))},E.resolve=function(t){return t&&"object"==typeof t&&t.constructor===E?t:new E((function(e){e(t)}))},E.reject=function(t){return new E((function(e,n){n(t)}))},t.exports=E}).call(this,n(35),n(102).setImmediate)},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function a(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new a(i.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new a(i.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(103),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(35))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,a,s,o,u=1,c={},h=!1,f=t.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){m(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((a=new MessageChannel).port1.onmessage=function(t){m(t.data)},r=function(t){a.port2.postMessage(t)}):f&&"onreadystatechange"in f.createElement("script")?(i=f.documentElement,r=function(t){var e=f.createElement("script");e.onreadystatechange=function(){m(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(m,0,t)}:(s="setImmediate$"+Math.random()+"$",o=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&m(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",o,!1):t.attachEvent("onmessage",o),r=function(e){t.postMessage(s+e,"*")}),l.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var i={callback:t,args:e};return c[u]=i,r(u),u++},l.clearImmediate=d}function d(t){delete c[t]}function m(t){if(h)setTimeout(m,0,t);else{var e=c[t];if(e){h=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(void 0,n)}}(e)}finally{d(t),h=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(35),n(104))},function(t,e){var n,r,i=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(t){if(n===setTimeout)return setTimeout(t,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(t){n=a}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,c=[],h=!1,f=-1;function l(){h&&u&&(h=!1,u.length?c=u.concat(c):f=-1,c.length&&d())}function d(){if(!h){var t=o(l);h=!0;for(var e=c.length;e;){for(u=c,c=[];++f<e;)u&&u[f].run();f=-1,e=c.length}u=null,h=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function m(t,e){this.fun=t,this.array=e}function _(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new m(t,e)),1!==c.length||h||o(d)},m.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=_,i.addListener=_,i.once=_,i.off=_,i.removeListener=_,i.removeAllListeners=_,i.emit=_,i.prependListener=_,i.prependOnceListener=_,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){t.exports="#define GLSLIFY 1\n// modified from https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl#L26\n\n"+n(57)+"\n\nvec2 LTC_Uv(const in vec3 N, const in vec3 V, const in float roughness) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = (LUT_SIZE - 1.0) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = clamp(dot(N, V), 0.0, 1.0);\n vec2 uv = vec2(roughness, sqrt(1.0 - dotNV));\n uv = (uv * LUT_SCALE) + LUT_BIAS;\n return uv;\n}\n\nfloat LTC_ClippedSphereFormFactor(const in vec3 f) {\n float l = length(f);\n return max(((l * l) + f.z) / (l + 1.0), 0.0);\n}\n\nvec3 LTC_EdgeVectorFormFactor(const in vec3 v1, const in vec3 v2) {\n float x = dot(v1, v2);\n float y = abs(x);\n float a = 0.8543985 + ((0.4965155 + (0.0145206 * y)) * y);\n float b = 3.4175940 + ((4.1616724 + y) * y);\n float v = a / b;\n float theta_sintheta = x > 0.0 ? v : (0.5 * inversesqrt(max(1.0 - (x * x), 1e-7))) - v;\n return cross(v1, v2) * theta_sintheta;\n}\n\nvec3 LTC_Evaluate(const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[4]) {\n vec3 v1 = rectCoords[1] - rectCoords[0];\n vec3 v2 = rectCoords[3] - rectCoords[0];\n vec3 lightNormal = cross(v1, v2);\n if (dot(lightNormal, P - rectCoords[0]) < 0.0)\n return vec3(0.0);\n vec3 T1, T2;\n T1 = normalize(V - (N * dot(V, N)));\n T2 = -cross(N, T1);\n mat3 mat = mInv * transpose(mat3(T1, T2, N));\n vec3 coords[4];\n coords[0] = mat * (rectCoords[0] - P);\n coords[1] = mat * (rectCoords[1] - P);\n coords[2] = mat * (rectCoords[2] - P);\n coords[3] = mat * (rectCoords[3] - P);\n coords[0] = normalize(coords[0]);\n coords[1] = normalize(coords[1]);\n coords[2] = normalize(coords[2]);\n coords[3] = normalize(coords[3]);\n vec3 vectorFormFactor = vec3(0.0);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[0], coords[1]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[1], coords[2]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[2], coords[3]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[3], coords[0]);\n float result = LTC_ClippedSphereFormFactor(vectorFormFactor);\n return vec3(result);\n}\n\nvec3 getAreaLight(const in vec3 diffuseColor, const in vec3 specularColor, const in float roughness, const in vec3 normal, const in vec3 viewDir, const in vec3 position, const in vec3 lightPos, const in vec3 lightColor, const in vec3 halfWidth, const in vec3 halfHeight, const in sampler2D areaLightsLtcTexture1, const in sampler2D areaLightsLtcTexture2){\n vec3 rectCoords[4];\n rectCoords[0] = (lightPos - halfWidth) - halfHeight;\n rectCoords[1] = (lightPos + halfWidth) - halfHeight;\n rectCoords[2] = (lightPos + halfWidth) + halfHeight;\n rectCoords[3] = (lightPos - halfWidth) + halfHeight;\n \n vec2 uv = LTC_Uv(normal, viewDir, roughness);\n vec4 t1 = texture2D(areaLightsLtcTexture1, uv);\n vec4 t2 = texture2D(areaLightsLtcTexture2, uv);\n\n mat3 mInv = mat3(vec3(t1.x, 0, t1.y), vec3(0, 1, 0), vec3(t1.z, 0, t1.w));\n vec3 fresnel = (specularColor * t2.x) + ((vec3(1.0) - specularColor) * t2.y);\n \n vec3 color = vec3(0.0, 0.0, 0.0);\n color += ((lightColor * fresnel) * LTC_Evaluate(normal, viewDir, position, mInv, rectCoords));\n color += ((lightColor * diffuseColor) * LTC_Evaluate(normal, viewDir, position, mat3(1.0), rectCoords));\n return color;\n}\n\n"},function(t,e,n){"use strict";n.r(e),n.d(e,"util",(function(){return i})),n.d(e,"GLTFExtensions",(function(){return r})),n.d(e,"Class",(function(){return a.a})),n.d(e,"EventMixin",(function(){return s.a})),n.d(e,"Fog",(function(){return hr})),n.d(e,"Mesh",(function(){return _r})),n.d(e,"Node",(function(){return g})),n.d(e,"SkinedMesh",(function(){return Er})),n.d(e,"Skeleton",(function(){return Mr})),n.d(e,"Stage",(function(){return Wr})),n.d(e,"Tween",(function(){return mi})),n.d(e,"version",(function(){return Ar})),n.d(e,"BoxGeometry",(function(){return pi})),n.d(e,"Geometry",(function(){return Z})),n.d(e,"GeometryData",(function(){return b})),n.d(e,"MorphGeometry",(function(){return Zn})),n.d(e,"PlaneGeometry",(function(){return Mi})),n.d(e,"SphereGeometry",(function(){return Li})),n.d(e,"Camera",(function(){return O})),n.d(e,"PerspectiveCamera",(function(){return Q})),n.d(e,"OrthographicCamera",(function(){return fn})),n.d(e,"Buffer",(function(){return Nt})),n.d(e,"capabilities",(function(){return et})),n.d(e,"extensions",(function(){return tt})),n.d(e,"Framebuffer",(function(){return ce})),n.d(e,"glType",(function(){return Tt})),n.d(e,"logGLResource",(function(){return Oi})),n.d(e,"Program",(function(){return Lt})),n.d(e,"RenderInfo",(function(){return Lr})),n.d(e,"RenderList",(function(){return Rr})),n.d(e,"VertexArrayObject",(function(){return Ft})),n.d(e,"WebGLRenderer",(function(){return jr})),n.d(e,"WebGLResourceManager",(function(){return Nr})),n.d(e,"WebGLState",(function(){return yr})),n.d(e,"BasicLoader",(function(){return xi})),n.d(e,"CubeTextureLoader",(function(){return wi})),n.d(e,"GLTFLoader",(function(){return pa})),n.d(e,"GLTFParser",(function(){return ma})),n.d(e,"AliAMCExtension",(function(){return $n})),n.d(e,"HDRLoader",(function(){return Ia})),n.d(e,"KTXLoader",(function(){return Ra})),n.d(e,"LoadCache",(function(){return Ri})),n.d(e,"LoadQueue",(function(){return ya})),n.d(e,"ShaderMaterialLoader",(function(){return xa})),n.d(e,"TextureLoader",(function(){return ba})),n.d(e,"Loader",(function(){return bi})),n.d(e,"Texture",(function(){return Qt})),n.d(e,"LazyTexture",(function(){return Gi})),n.d(e,"CubeTexture",(function(){return pe})),n.d(e,"DataTexture",(function(){return Le})),n.d(e,"Shader",(function(){return dt})),n.d(e,"BasicMaterial",(function(){return en})),n.d(e,"GeometryMaterial",(function(){return cn})),n.d(e,"Material",(function(){return $e})),n.d(e,"PBRMaterial",(function(){return Di})),n.d(e,"semantic",(function(){return Ge})),n.d(e,"ShaderMaterial",(function(){return zn})),n.d(e,"AxisHelper",(function(){return Da})),n.d(e,"AxisNetHelper",(function(){return Ga})),n.d(e,"CameraHelper",(function(){return ja})),n.d(e,"AmbientLight",(function(){return za})),n.d(e,"AreaLight",(function(){return Ya})),n.d(e,"DirectionalLight",(function(){return Gn})),n.d(e,"CubeLightShadow",(function(){return Pn})),n.d(e,"Light",(function(){return M})),n.d(e,"LightManager",(function(){return Pr})),n.d(e,"LightShadow",(function(){return vn})),n.d(e,"PointLight",(function(){return Hn})),n.d(e,"SpotLight",(function(){return jn})),n.d(e,"Animation",(function(){return ea})),n.d(e,"AnimationStates",(function(){return $i})),n.d(e,"MeshPicker",(function(){return Qa})),n.d(e,"Ticker",(function(){return Ja})),n.d(e,"log",(function(){return m.a})),n.d(e,"Cache",(function(){return J})),n.d(e,"browser",(function(){return kr})),n.d(e,"WebGLSupport",(function(){return $a})),n.d(e,"constants",(function(){return P.a})),n.d(e,"Color",(function(){return ts.Color})),n.d(e,"Euler",(function(){return ts.Euler})),n.d(e,"EulerNotifier",(function(){return ts.EulerNotifier})),n.d(e,"Frustum",(function(){return ts.Frustum})),n.d(e,"math",(function(){return ts.math})),n.d(e,"Matrix3",(function(){return ts.Matrix3})),n.d(e,"Matrix4",(function(){return ts.Matrix4})),n.d(e,"Matrix4Notifier",(function(){return ts.Matrix4Notifier})),n.d(e,"Plane",(function(){return ts.Plane})),n.d(e,"Quaternion",(function(){return ts.Quaternion})),n.d(e,"Ray",(function(){return ts.Ray})),n.d(e,"Sphere",(function(){return ts.Sphere})),n.d(e,"SphericalHarmonics3",(function(){return ts.SphericalHarmonics3})),n.d(e,"Vector2",(function(){return ts.Vector2})),n.d(e,"Vector3",(function(){return ts.Vector3})),n.d(e,"Vector3Notifier",(function(){return ts.Vector3Notifier})),n.d(e,"Vector4",(function(){return ts.Vector4}));var r={};n.r(r),n.d(r,"ALI_amc_mesh_compression",(function(){return $n})),n.d(r,"WEB3D_quantized_attributes",(function(){return er})),n.d(r,"HILO_animation_clips",(function(){return nr})),n.d(r,"ALI_animation_clips",(function(){return rr})),n.d(r,"ALI_bounding_box",(function(){return ir})),n.d(r,"KHR_materials_pbrSpecularGlossiness",(function(){return ar})),n.d(r,"KHR_materials_clearcoat",(function(){return sr})),n.d(r,"KHR_lights_punctual",(function(){return or})),n.d(r,"KHR_techniques_webgl",(function(){return ur}));var i=n(4),a=n(1),s=n(9),o=n(7),u=n(21),c=n(5),h=n(17),f=n(22),l=n(10),d=n(6),m=n(3),_=new c.a(0,1,0),p=new o.a,g=a.a.create({Statics:{TRAVERSE_STOP_NONE:!1,TRAVERSE_STOP_CHILDREN:1,TRAVERSE_STOP_ALL:!0},Mixes:s.a,isNode:!0,className:"Node",name:"",anim:null,animationId:"",jointName:"",autoUpdateWorldMatrix:!0,autoUpdateChildWorldMatrix:!0,parent:null,_quatDirty:!1,_matrixDirty:!1,needCallChildUpdate:!0,visible:!0,pointerEnabled:!0,pointerChildren:!0,useHandCursor:!1,userData:null,onUpdate:null,__forceUseParentWorldMatrix:!1,constructor:function(t){var e=this;this.id=d.a.generateUUID(this.className),this.up=_.clone(),this.children=[],this.worldMatrix=new o.a,this._matrix=new u.a,this._position=new h.a(0,0,0),this._scale=new h.a(1,1,1),this._pivot=new h.a(0,0,0),this._rotation=new f.a,this._quaternion=new l.a,this._matrix.on("update",(function(){e._onMatrixUpdate()})),this._position.on("update",(function(){e._onPositionUpdate()})),this._scale.on("update",(function(){e._onScaleUpdate()})),this._pivot.on("update",(function(){e._onPivotUpdate()})),this._rotation.on("update",(function(){e._onRotationUpdate()})),this._quaternion.on("update",(function(){e._onQuaternionUpdate()})),Object.assign(this,t)},clone:function(t){var e=new this.constructor;return e.name=this.name,e.jointName=this.jointName,e.animationId=this.animationId,e.setPosition(this.x,this.y,this.z),e.setScale(this.scaleX,this.scaleY,this.scaleZ),e.setRotation(this.rotationX,this.rotationY,this.rotationZ),this.children.forEach((function(t){e.addChild(t.clone(!0))})),t||(this.anim&&(e.anim=this.anim.clone(e)),e.resetSkinedMeshRootNode()),e},setAnim:function(t){return this.anim=t,t.rootNode=this,this},resetSkinedMeshRootNode:function(){var t=this;this.traverse((function(e){e.isSkinedMesh&&e.skeleton&&(e.skeleton.rootNode=t)}),!0)},getChildrenNameMap:function(){var t={};return this.traverse((function(e){t[e.name]=e;var n=e._originName;void 0===n||t[n]||(t[n]=e)}),!0),t},addChild:function(t){return t.parent&&t.removeFromParent(),t.parent=this,this.children.push(t),this},removeChild:function(t){var e=this.children.indexOf(t);return e>-1&&(this.children.splice(e,1),t.parent=null),this},addTo:function(t){return t.addChild(this),this},removeFromParent:function(){return this.parent&&this.parent.removeChild(this),this},updateMatrix:function(){return this._matrixDirty&&(this._matrixDirty=!1,this.matrixVersion++,this._matrix.fromRotationTranslationScaleOrigin(this.quaternion,this._position,this._scale,this._pivot,!0)),this},updateQuaternion:function(){return this._quatDirty&&(this._quatDirty=!1,this._quaternion.fromEuler(this._rotation,!0)),this},updateTransform:function(){return this._matrix.decompose(this._quaternion,this._position,this._scale,this._pivot),this._onQuaternionUpdate(),this._matrixDirty=!1,this},updateMatrixWorld:function(t){return this.traverse((function(e){return(e.autoUpdateWorldMatrix||t)&&(e.parent?e.__forceUseParentWorldMatrix?e.worldMatrix.copy(e.parent.worldMatrix):e.worldMatrix.multiply(e.parent.worldMatrix,e.matrix):e.worldMatrix.copy(e.matrix)),!e.autoUpdateChildWorldMatrix&&!t&&1})),this},getConcatenatedMatrix:function(t){for(var e=new o.a,n=this;n&&n!==t;n=n.parent)e.multiply(n.matrix,e);return e},_traverse:function(t,e){if(!e){var n=t(this);if(n)return n}for(var r=this.children,i=0,a=r.length;i<a;i++){var s=r[i]._traverse(t,!1);if(!0===s)return s}return!1},traverse:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._traverse(t,e),this},traverseBFS:function(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(n=r?this.children:[this];n.length;){e=n,n=[];for(var i=0,a=e.length;i<a;i++){var s=e[i],o=t(s);if(o){if(!0===o)return this}else n=n.concat(s.children)}}return this},getChildByFnBFS:function(t){var e=null;return this.traverseBFS((function(n){return!!t(n)&&(e=n,!0)}),!0),e},getChildByNamePath:function(t){for(var e=this,n=function(n,r){var i=t[n],a=e.getChildByFnBFS((function(t){return t.name===i}));if(!a)return{v:null};e=a},r=0,i=t.length;r<i;r++){var a=n(r);if("object"==typeof a)return a.v}return e},traverseUpdate:function(t){return this.traverse((function(e){return e.onUpdate&&e.onUpdate(t),!e.needCallChildUpdate&&1})),this},getChildByFn:function(t){var e=null;return this.traverse((function(n){return!!t(n)&&(e=n,!0)}),!0),e},getChildrenByFn:function(t){var e=[];return this.traverse((function(n){t(n)&&e.push(n)}),!0),e},getChildByName:function(t){return this.getChildByFn((function(e){return e.name===t}))},getChildrenByName:function(t){return this.getChildrenByFn((function(e){return e.name===t}))},getChildById:function(t){return this.getChildByFn((function(e){return e.id===t}))},getChildrenByClassName:function(t){return this.getChildrenByFn((function(e){return e.className===t}))},getChildrenByBaseClassName:function(t){return this.getChildrenByFn((function(e){return e["is"+t]}))},setScale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;return this._scale.set(t,e,n),this},setPosition:function(t,e,n){return this._position.set(t,e,n),this},setRotation:function(t,e,n){return this._rotation.setDegree(t,e,n),this},setPivot:function(t,e,n){return this._pivot.set(t,e,n),this},lookAt:function(t){return this.isCamera?p.targetTo(this,t,this.up):p.targetTo(t,this,this.up),this._quaternion.fromMat4(p),this},raycast:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!this.visible)return null;var i=[];return this.traverse((function(n){if(r&&!n.pointerEnabled)return 1;if(n.isMesh){var a=n.raycast(t,!1);a&&(i=i.concat(a.map((function(t){return{mesh:n,point:t}}))))}return!(!r||e.pointerChildren)&&1})),i.length?(n&&t.sortPoints(i,"point"),i):null},matrix:{get:function(){return this.updateMatrix(),this._matrix},set:function(t){m.a.warnOnce("Node.matrix.set","node.matrix is readOnly.Use node.matrix.copy instead."),this._matrix.copy(t)}},position:{get:function(){return this._position},set:function(t){m.a.warnOnce("Node.position.set","node.position is readOnly.Use node.position.copy instead."),this._position.copy(t)}},x:{get:function(){return this._position.elements[0]},set:function(t){this._position.elements[0]=t,this._matrixDirty=!0}},y:{get:function(){return this._position.elements[1]},set:function(t){this._position.elements[1]=t,this._matrixDirty=!0}},z:{get:function(){return this._position.elements[2]},set:function(t){this._position.elements[2]=t,this._matrixDirty=!0}},scale:{get:function(){return this._scale},set:function(t){m.a.warnOnce("Node.scale.set","node.scale is readOnly.Use node.scale.copy instead."),this._scale.copy(t)}},scaleX:{get:function(){return this._scale.elements[0]},set:function(t){this._scale.elements[0]=t,this._matrixDirty=!0}},scaleY:{get:function(){return this._scale.elements[1]},set:function(t){this._scale.elements[1]=t,this._matrixDirty=!0}},scaleZ:{get:function(){return this._scale.elements[2]},set:function(t){this._scale.elements[2]=t,this._matrixDirty=!0}},pivot:{get:function(){return this._pivot},set:function(t){m.a.warnOnce("Node.pivot.set","node.pivot is readOnly.Use node.pivot.copy instead."),this._pivot.copy(t)}},pivotX:{get:function(){return this._pivot.elements[0]},set:function(t){this._pivot.elements[0]=t,this._matrixDirty=!0}},pivotY:{get:function(){return this._pivot.elements[1]},set:function(t){this._pivot.elements[1]=t,this._matrixDirty=!0}},pivotZ:{get:function(){return this._pivot.elements[2]},set:function(t){this._pivot.elements[2]=t,this._matrixDirty=!0}},rotation:{get:function(){return this._rotation},set:function(t){m.a.warnOnce("Node.rotation.set","node.rotation is readOnly.Use node.rotation.copy instead."),this._rotation.copy(t)}},rotationX:{get:function(){return this._rotation.degX},set:function(t){this._rotation.degX=t}},rotationY:{get:function(){return this._rotation.degY},set:function(t){this._rotation.degY=t}},rotationZ:{get:function(){return this._rotation.degZ},set:function(t){this._rotation.degZ=t}},quaternion:{get:function(){return this.updateQuaternion(),this._quaternion},set:function(t){m.a.warnOnce("Node.quaternion.set","node.quaternion is readOnly.Use node.quaternion.copy instead."),this._quaternion.copy(t)}},matrixVersion:0,getBounds:function(t,e,n){return e?e.multiply(this.matrix):e=this.getConcatenatedMatrix(t),this.children.forEach((function(t){n=t.getBounds(null,e.clone(),n)})),this.isMesh&&(n=this.geometry.getBounds(e,n)),n},_fireMouseEvent:function(t){if(t.eventCurrentTarget=this,this.fire(t),"mousemove"===t.type){if(!this.__mouseOver){this.__mouseOver=!0;var e=Object.assign({},t);e.type="mouseover",this.fire(e)}}else"mouseout"===t.type&&(this.__mouseOver=!1);var n=this.parent;t._stopped||t._stopPropagationed||!n||n._fireMouseEvent(t)},destroy:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getChildrenByBaseClassName("Node");return this.off(),n.forEach((function(n){n.isMesh?n.destroy(t,e):(n.off(),n.removeFromParent())})),this.removeFromParent(),this},_onMatrixUpdate:function(){this.matrixVersion++,this.updateTransform()},_onPositionUpdate:function(){this._matrixDirty=!0},_onScaleUpdate:function(){this._matrixDirty=!0},_onPivotUpdate:function(){this._matrixDirty=!0},_onRotationUpdate:function(){this._quatDirty=!0,this._matrixDirty=!0},_onQuaternionUpdate:function(){this._rotation.fromQuat(this._quaternion),this._quatDirty=!1}}),v=n(8),E=new v.a,T=a.a.create({Extends:g,isLight:!0,className:"Light",amount:1,enabled:!0,constantAttenuation:1,linearAttenuation:0,quadraticAttenuation:0,_range:0,range:{get:function(){return this._range},set:function(t){this.constantAttenuation=1,t<=0?(this.linearAttenuation=0,this.quadraticAttenuation=0):(this.linearAttenuation=4.5/t,this.quadraticAttenuation=75/(t*t)),this._range=t}},shadow:null,isDirty:!1,constructor:function(t){this.color=new v.a(1,1,1),T.superclass.constructor.call(this,t)},toInfoArray:function(t,e){return t[e+0]=this.constantAttenuation,t[e+1]=this.linearAttenuation,t[e+2]=this.quadraticAttenuation,this},getRealColor:function(){return E.copy(this.color).scale(this.amount)},createShadowMap:function(t,e){}}),M=T,A=n(23),L=new o.a,I=a.a.create({Extends:g,isCamera:!0,className:"Camera",_needUpdateProjectionMatrix:!0,_isGeometryDirty:!1,constructor:function(t){this.viewMatrix=new o.a,this.projectionMatrix=new o.a,this.viewProjectionMatrix=new o.a,this._frustum=new A.a,I.superclass.constructor.call(this,t)},updateViewMatrix:function(){return this.updateMatrixWorld(!0),this.viewMatrix.invert(this.worldMatrix),this},updateProjectionMatrix:function(){},getGeometry:function(t){},updateViewProjectionMatrix:function(){return this._needUpdateProjectionMatrix&&(this.updateProjectionMatrix(),this._needUpdateProjectionMatrix=!1),this.updateViewMatrix(),this.viewProjectionMatrix.multiply(this.projectionMatrix,this.viewMatrix),this.updateFrustum(this.viewProjectionMatrix),this},getModelViewMatrix:function(t,e){return(e=e||new o.a).multiply(this.viewMatrix,t.worldMatrix),e},getModelProjectionMatrix:function(t,e){return(e=e||new o.a).multiply(this.viewProjectionMatrix,t.worldMatrix),e},projectVector:function(t,e,n){var r=t.clone();return r.transformMat4(this.viewProjectionMatrix),e&&n&&(r.x=(r.x+1)/2*e,r.y=n-(r.y+1)/2*n),r},unprojectVector:function(t,e,n){var r=t.clone();return e&&n&&(r.x=r.x/e*2-1,r.y=1-r.y/n*2),L.invert(this.viewProjectionMatrix),r.transformMat4(L),r},isPointVisible:function(t){return!!this._frustum.intersectsSphere({center:t,radius:0})},isMeshVisible:function(t){var e=t.geometry;if(e){var n=e.getSphereBounds(t.worldMatrix);if(this._frustum.intersectsSphere(n))return!0}return!1},updateFrustum:function(t){return this._frustum.fromMatrix(t),this}}),O=I,S=n(14),R=n(12),y=n(11),N=n(20),x={2:new S.a,3:new c.a,4:new R.a,16:new o.a},C=a.a.create({className:"GeometryData",isGeometryData:!0,size:void 0,normalized:!1,type:void 0,_isSubDirty:!1,_isAllDirty:!1,isDirty:{get:function(){return this._isSubDirty||this._isAllDirty},set:function(t){this._isAllDirty=t,!1===t&&this.clearSubData()}},bufferViewId:void 0,glBuffer:null,constructor:function(t,e,n){this.id=d.a.generateUUID(this.className),this.data=t,this.size=e,Object.assign(this,n),this.bufferViewId||(this.bufferViewId=this.id),this.size||m.a.warn("GeometryData.constructor: geometryData must set size!",this)},_stride:0,stride:{get:function(){return this._stride},set:function(t){this._stride=t,this.strideSize=0===t?0:t/this.data.BYTES_PER_ELEMENT}},strideSize:0,_offset:0,offset:{get:function(){return this._offset},set:function(t){this._offset=t,this.offsetSize=t/this.data.BYTES_PER_ELEMENT}},offsetSize:0,data:{set:function(t){t&&(this._data=t,this.type=Object(i.getTypedArrayGLType)(t),this.stride=this._stride,this.offset=this._offset,this._isAllDirty=!0)},get:function(){return this._data}},length:{get:function(){return this._data.length}},realLength:{get:function(){return 0===this.strideSize?this._data.length:this._data.length/this.strideSize*this.size}},getByteLength:function(){return this._data.BYTES_PER_ELEMENT*this.realLength},count:{get:function(){return 0===this.strideSize?this._data.length/this.size:this._data.length/this.strideSize}},setSubData:function(t,e){this._isSubDirty=!0,this.data.set(e,t),this.subDataList||(this.subDataList=[]);var n=e.BYTES_PER_ELEMENT*t;this.subDataList.push({byteOffset:n,data:e})},clearSubData:function(){this.subDataList&&(this.subDataList.length=0),this._isSubDirty=!1},clone:function(){var t=new C(null,1);return t.copy(this),t},copy:function(t){var e=t.data;this.data=new e.constructor(e),this.size=t.size,this.stride=t.stride,this.normalized=t.normalized,this.type=t.type,this.offset=t.offset},getOffset:function(t){var e=this.strideSize;return 0===e?t*this.size:t*e+this.offsetSize},get:function(t){var e=this.getOffset(t);return this.getByOffset(e)},getCopy:function(t){return this.get(t).clone()},set:function(t,e){var n=this.getOffset(t);return this.setByOffset(n,e),n},getByOffset:function(t){var e=this.size;return e>1?x[e].fromArray(this._data,t):this._data[t]},setByOffset:function(t,e){var n=this.size,r=this._data;n>1?e.toArray(r,t):r[t]=e,this._isAllDirty=!0},traverse:function(t){for(var e=this.count,n=0;n<e;n++){var r=this.getOffset(n);if(t(this.getByOffset(r),n,r))return!0}return!1},traverseByComponent:function(t){for(var e=this.count,n=this.size,r=this._data,i=0;i<e;i++)for(var a=this.getOffset(i),s=i*n,o=0;o<n;o++){var u=a+o;if(t(r[u],s+o,u))return!0}return!1},merge:function(t,e){if(t.type!==this.type||t.size!==this.size)return m.a.warn("geometryData type or size not same, cannot merge!",this,t),this;var n=Object(i.getTypedArrayClass)(this.type),r=this.realLength,a=t.realLength,s=new n(r+a);return this.traverseByComponent((function(t,e){s[e]=t})),t.traverseByComponent((function(t,n){e&&(t=e(t,n)),s[r+n]=t})),this.stride=0,this.offset=0,this.data=s,this}}),b=C,P=n(2),w=P.a.TRIANGLES,H=P.a.LINES,D=P.a.FRONT,F=P.a.BACK,U=P.a.FRONT_AND_BACK,G=new c.a,B=new c.a,V=new c.a,X=new R.a,j=new S.a,k=new S.a,z=new S.a,W=new y.a,Y=new o.a,q=new l.a,Z=a.a.create({isGeometry:!0,className:"Geometry",vertices:null,uvs:null,uvs1:null,colors:null,indices:null,skinIndices:null,skinWeights:null,mode:w,isStatic:!0,isDirty:!0,useAABBRaycast:!1,userData:null,constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t),this.currentVerticesCount=0,this.currentIndicesCount=0},_needUpdateNormals:!1,normals:{get:function(){return!this._needUpdateNormals&&this._normals||this.calculateNormals(),this._normals},set:function(t){this._normals=t,this._needUpdateNormals=!1}},calculateNormals:function(){var t=this.vertices;if(t){this._normals||(this._normals=new b(new Float32Array(t.realLength),3));var e,n=this._normals;if(this.indices)e=this.indices.data;else{var r=t.length/3;e=new Array(r);for(var i=0;i<r;i++)e[i]=i}for(var a=0,s=new Uint8Array(t.count),o=0;o<e.length;o+=3){a=e[o],G.copy(t.get(a)),a=e[o+1],B.copy(t.get(a)),a=e[o+2],V.copy(t.get(a)),B.sub(G),V.sub(G),B.cross(V);for(var u=0;u<3;u++){if(s[a=e[o+u]]){var c=n.get(a);c.scale(s[a]),c.add(B),c.scale(1/(s[a]+1)),n.set(a,c)}else n.set(a,B);s[a]++}}this.isDirty=!0,this._needUpdateNormals=!1}else m.a.warnOnce("geometry.calculateNormals","geometry.calculateNormals error:no vertices data.")},tangents:{get:function(){return this._tangents||this.calculateTangents(this.uvs,"_tangents"),this._tangents},set:function(t){this._tangents=t}},tangents1:{get:function(){return this._tangents1||this.calculateTangents(this.uvs1,"_tangents1"),this._tangents1},set:function(t){this._tangents1=t}},calculateTangents:function(t,e){var n=this.vertices;if(n){this[e]||(this[e]=new b(new Float32Array(4*n.count),4));var r,i=this[e];if(this.indices)r=this.indices.data;else{var a=n.length/3;r=new Array(a);for(var s=0;s<a;s++)r[s]=s}for(var o=0,u=0;u<r.length;u+=3){o=r[u],G.copy(n.get(o)),j.copy(t.get(o)),o=r[u+1],B.copy(n.get(o)),k.copy(t.get(o)),o=r[u+2],V.copy(n.get(o)),z.copy(t.get(o)),B.sub(G),V.sub(G),k.sub(j),z.sub(j);var c=1/(k.x*z.y-z.x*k.y);Number.isFinite(c)?(G.x=c*(z.y*B.x-k.y*V.x),G.y=c*(z.y*B.y-k.y*V.y),G.z=c*(z.y*B.z-k.y*V.z)):(G.x=0,G.y=0,G.z=1),X.set(G.x,G.y,G.z,1),i.set(r[u],X),i.set(r[u+1],X),i.set(r[u+2],X)}this.isDirty=!0}else m.a.warnOnce("geometry.calculateTangents","geometry.calculateTangents error:no vertices data.")},convertToLinesMode:function(){if(this.mode===w)if(this.indices){for(var t=new Uint16Array(2*this.indices.length),e=this.indices.data,n=0;n<e.length;n+=3)t[2*n]=e[n],t[2*n+1]=e[n+1],t[2*n+2]=e[n+1],t[2*n+3]=e[n+2],t[2*n+4]=e[n+2],t[2*n+5]=e[n];this.indices.data=t,this.mode=H}else m.a.warn("Has no indices!");else m.a.warn("Only support convert triangles to lines mode!")},translate:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.transformMat4(Y.fromTranslation(G.set(t,e,n))),this},scale:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return this.transformMat4(Y.fromScaling(G.set(t,e,n))),this},rotate:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.transformMat4(Y.fromQuat(q.fromEuler({x:t*d.a.DEG2RAD,y:e*d.a.DEG2RAD,z:n*d.a.DEG2RAD}))),this},transformMat4:function(t){var e=this.vertices;if(e&&e.traverse((function(n,r,i){e.setByOffset(i,n.transformMat4(t))})),W.normalFromMat4(t),this._normals){var n=this.normals;n.traverse((function(t,e,r){n.setByOffset(r,t.transformMat3(W).normalize())}))}if(this._tangents){var r=this.tangents;r.traverse((function(t,e,n){r.setByOffset(n,t.transformMat3(W).normalize())}))}return this.isDirty=!0,this},merge:function(t,e){var n=t.vertices;if(n&&this.vertices){var r=this.vertices.count;e&&(n=t.vertices.clone()).traverse((function(t,r,i){n.setByOffset(i,t.transformMat4(e))})),this.vertices.merge(n),this.indices&&t.indices?this.indices.merge(t.indices,(function(t){return t+r})):this.indices=null}return this.uvs&&t.uvs?this.uvs.merge(t.uvs):this.uvs=null,this.uvs1&&t.uvs1?this.uvs1.merge(t.uvs1):this.uvs1=null,this.colors&&t.colors?this.colors.merge(t.colors):this.colors=null,this._normals&&(this._normals=null),this._tangents&&(this._tangents=null),this._tangents1&&(this._tangents1=null),this.isDirty=!0,this},ensureData:function(t,e,n,r){var i=this[t];if(!i||n>i.length){var a=new r(n);i?(a.set(i.data),i.data=a):this[t]=new b(a,e)}},addPoints:function(){var t=this,e=[].slice.call(arguments),n=3*(this.currentVerticesCount+e.length);this.ensureData("vertices",3,n,Float32Array);var r=this.vertices.data;return e.forEach((function(e){var n=3*t.currentVerticesCount++;r[n]=e[0],r[n+1]=e[1],r[n+2]=e[2]})),this.currentVerticesCount-e.length},addIndices:function(){var t=this,e=[].slice.call(arguments),n=this.currentIndicesCount+e.length;this.ensureData("indices",1,n,Uint16Array);var r=this.indices.data;e.forEach((function(e){r[t.currentIndicesCount++]=e})),this._needUpdateNormals=!0},addLine:function(t,e){var n=this.addPoints(t,e);this.addIndices(n,n+1)},addFace:function(t,e,n){var r=this.addPoints(t,e,n);this.addIndices(r,r+1,r+2)},addRect:function(t,e,n,r){var i=this.addPoints(t,e,n,r);this.addIndices(i,i+1,i+2,i,i+2,i+3)},setVertexUV:function(t,e){this.ensureData("uvs",2,this.vertices.length/3*2,Float32Array);for(var n=this.uvs.data,r=0;r<e.length;r++)n[t+2*r]=e[r][0],n[t+2*r+1]=e[r][1]},setFaceUV:function(t,e,n,r){this.setVertexUV(t,[e,n,r])},setRectUV:function(t,e,n,r,i){this.setVertexUV(t,[e,n,r,i])},getBounds:function(t,e){e||(e={xMin:1/0,xMax:-1/0,yMin:1/0,yMax:-1/0,zMin:1/0,zMax:-1/0});var n=this.vertices;return n?(n.traverse((function(n){t&&n.transformMat4(t),e.xMax=Math.max(e.xMax,n.x),e.yMax=Math.max(e.yMax,n.y),e.zMax=Math.max(e.zMax,n.z),e.xMin=Math.min(e.xMin,n.x),e.yMin=Math.min(e.yMin,n.y),e.zMin=Math.min(e.zMin,n.z)})),e.width=e.xMax-e.xMin,e.height=e.yMax-e.yMin,e.depth=e.zMax-e.zMin,e.x=(e.xMin+e.xMax)/2,e.y=(e.yMin+e.yMax)/2,e.z=(e.zMin+e.zMax)/2,e):(m.a.warnOnce("geometry.getBounds","geometry has no vertices data, geometry.getBounds will return Infinity bounds."),e)},getLocalBounds:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._localBounds&&!t||(this._localBounds=this.getBounds()),this._localBounds},getSphereBounds:function(t){this._sphereBounds||(this._sphereBounds=new N.a);var e=this._sphereBounds;return e.copy(this.getLocalSphereBounds()),t&&e.transformMat4(t),e},getLocalSphereBounds:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._localSphereBounds||t){var e=this.getLocalBounds(t),n=new N.a({center:new c.a(e.x,e.y,e.z)}),r=this.vertices;r?n.fromGeometryData(r):(m.a.warnOnce("geometry.getLocalSphereBounds","geometry has no vertices data, geometry.getLocalSphereBounds will return Infinity bounds."),n.radius=1/0),this._localSphereBounds=n}return this._localSphereBounds},convertToNoIndices:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(this.mode===w)if(this.indices){for(var e=this.indices.data,n=e.length,r=new Float32Array(n*t),a=this.uvs?new Float32Array(2*n):null,s=new Float32Array(3*n),o=this.colors?new Float32Array(this.colors.size*n):null,u=this.skinIndices?new Float32Array(4*n):null,c=this.skinWeights?new Float32Array(4*n):null,h=0;h<n;h++){var f=e[h];Object(i.copyArrayData)(r,this.vertices,h*t,3*f,3),4===t&&(r[4*h+3]=1),Object(i.copyArrayData)(a,this.uvs,2*h,2*f,2),Object(i.copyArrayData)(s,this.normals,3*h,3*f,3),Object(i.copyArrayData)(u,this.skinIndices,4*h,4*f,4),Object(i.copyArrayData)(c,this.skinWeights,4*h,4*f,4),this.colors&&Object(i.copyArrayData)(o,this.colors,h*this.colors.size,f*this.colors.size,this.colors.size)}delete this.indices,this.vertices.data=r,this.uvs&&(this.uvs.data=a),this.normals&&(this.normals.data=s),this.colors&&(this.colors.data=o),this.skinIndices&&(this.skinIndices.data=u),this.skinWeights&&(this.skinWeights.data=c)}else m.a.warn("Has no indices!");else m.a.warn("Only support convert triangles to lines mode!")},clone:function(){var t=new this.constructor({mode:this.mode});return this.vertices&&(t.vertices=this.vertices.clone()),this.uvs&&(t.uvs=this.uvs.clone()),this.uvs1&&(t.uvs1=this.uvs1.clone()),this.colors&&(t.colors=this.colors.clone()),this.indices&&(t.indices=this.indices.clone()),this.skinWeights&&(t.skinWeights=this.skinWeights.clone()),this.skinIndices&&(t.skinIndices=this.skinIndices.clone()),this._normals&&(t._normals=this._normals.clone()),this._tangents&&(t._tangents=this._tangents.clone()),this._tangents1&&(t._tangents1=this._tangents1.clone()),this.positionDecodeMat&&(t.positionDecodeMat=this.positionDecodeMat),this.uvDecodeMat&&(t.uvDecodeMat=this.uvDecodeMat),this.uv1DecodeMat&&(t.uv1DecodeMat=this.uv1DecodeMat),this.normalDecodeMat&&(t.normalDecodeMat=this.normalDecodeMat),t},_aabbRaycast:function(t){var e=this.getLocalBounds(),n=t.intersectsBox([[e.xMin,e.yMin,e.zMin],[e.xMax,e.yMax,e.zMax]]);return n?[n]:null},_raycast:function(t,e){var n=this.vertices;if(!n)return null;var r,i=this.indices,a=[],s=[];r=i?i.realLength:n.realLength/3;for(var o=0;o<r;o+=3){var u=i?i.get(o):o;G.copy(n.get(u)),u=i?i.get(o+1):o+1,B.copy(n.get(u)),u=i?i.get(o+2):o+2,V.copy(n.get(u));var c=void 0;e===D?(a[0]=G.elements,a[1]=B.elements,a[2]=V.elements,c=t.intersectsTriangle(a)):e===F?(a[1]=G.elements,a[0]=B.elements,a[2]=V.elements,c=t.intersectsTriangle(a)):e===U&&(a[0]=G.elements,a[1]=B.elements,a[2]=V.elements,(c=t.intersectsTriangle(a))||(a[1]=G.elements,a[0]=B.elements,a[2]=V.elements,c=t.intersectsTriangle(a))),c&&s.push(c)}return s.length?s:null},raycast:function(t,e){var n,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return(n=this.useAABBRaycast?this._aabbRaycast(t):this._raycast(t,e))&&r&&t.sortPoints(n),n},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.positionDecodeMat&&(t.QUANTIZED=1,t.POSITION_QUANTIZED=1),this.normalDecodeMat&&(t.QUANTIZED=1,t.NORMAL_QUANTIZED=1),this.uvDecodeMat&&(t.QUANTIZED=1,t.UV_QUANTIZED=1),this.uv1DecodeMat&&(t.QUANTIZED=1,t.UV1_QUANTIZED=1),this.colors&&(t.HAS_COLOR=1,t.COLOR_SIZE=this.colors.size),t},getShaderKey:function(){return void 0===this._shaderKey&&(this._shaderKey="geometry",this.isMorphGeometry?this._shaderKey+="_id_".concat(this.id):(this.colors&&(this._shaderKey+="_colors"),this.positionDecodeMat&&(this._shaderKey+="positionDecodeMat"))),this._shaderKey},getSize:function(){var t=0;for(var e in this)Object(i.hasOwnProperty)(this,e)&&this[e]&&this[e].isGeometryData&&(t+=this[e].getByteLength());return t},destroy:function(){m.a.warn("Geometry.destroy has been deprecated, use mesh.destroy(renderer) instead.")}}),K=a.a.create({Extends:O,isPerspectiveCamera:!0,className:"PerspectiveCamera",_near:.1,near:{get:function(){return this._near},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._near=t}},_far:null,far:{get:function(){return this._far},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._far=t}},_fov:50,fov:{get:function(){return this._fov},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._fov=t}},_aspect:1,aspect:{get:function(){return this._aspect},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._aspect=t}},constructor:function(t){K.superclass.constructor.call(this,t),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.projectionMatrix.elements,e=this.near,n=this.far,r=this.aspect,i=this.fov,a=1/Math.tan(.5*d.a.degToRad(i));if(t[0]=a/r,t[5]=a,t[11]=-1,t[15]=0,n){var s=1/(e-n);t[10]=(e+n)*s,t[14]=2*n*e*s}else t[10]=-1,t[14]=-2*e},getGeometry:function(t){if(t||!this._geometry||this._isGeometryDirty){this._isGeometryDirty=!1;var e=new Z,n=Math.tan(this.fov/2*Math.PI/180),r=this.near,i=this.far,a=r*n,s=i*n,o=this.aspect*a,u=this.aspect*s,c=[-o,-a,-r],h=[o,-a,-r],f=[o,a,-r],l=[-o,a,-r],d=[-u,-s,-i],m=[u,-s,-i],_=[u,s,-i],p=[-u,s,-i];e.addRect(d,m,_,p),e.addRect(m,h,f,_),e.addRect(h,c,l,f),e.addRect(c,d,p,l),e.addRect(p,_,f,l),e.addRect(c,h,m,d),this._geometry=e}return this._geometry}}),Q=K,J=a.a.create({constructor:function(){this._cache={}},get:function(t){return this._cache[t]},getObject:function(t){return this._cache[t.__cacheId]},add:function(t,e){"object"==typeof e&&(e.__cacheId=t),this._cache[t]=e},remove:function(t){delete this._cache[t]},removeObject:function(t){delete this._cache[t.__cacheId]},removeAll:function(){this._cache={}},each:function(t){var e=this._cache;for(var n in e)t(e[n],n)}}),$={instanced:void 0,vao:void 0,texFloat:void 0,loseContext:void 0,textureFilterAnisotropic:void 0,_usedExtensions:{},_disabledExtensions:{},init:function(t){this.reset(t)},reset:function(t){this.gl=t;var e=this._usedExtensions;for(var n in e){var r=e[n];this[r]=void 0,this.get(n,r)}},use:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;this.gl?this.get(t,e):this._usedExtensions[t]=e},get:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(this._disabledExtensions[t])return null;var n=this[e];return void 0===n&&(n=this._getExtension(t),this[e]=n),n},disable:function(t){this._disabledExtensions[t]=!0},enable:function(t){this._disabledExtensions[t]=!1},_getExtension:function(t){var e=this.gl;return e&&e.getExtension&&(e.getExtension(t)||e.getExtension("WEBKIT_"+t)||e.getExtension("MOZ_"+t))||null}};$.use("ANGLE_instanced_arrays","instanced"),$.use("OES_vertex_array_object","vao"),$.use("OES_texture_float","texFloat"),$.use("WEBGL_lose_context","loseContext"),$.use("OES_element_index_uint","uintIndices"),$.use("EXT_shader_texture_lod","shaderTextureLod"),$.use("EXT_texture_filter_anisotropic","textureFilterAnisotropic");var tt=$,et={MAX_TEXTURE_INDEX:null,MAX_PRECISION:null,MAX_VERTEX_PRECISION:null,MAX_FRAGMENT_PRECISION:null,VERTEX_TEXTURE_FLOAT:null,FRAGMENT_TEXTURE_FLOAT:null,MAX_TEXTURE_MAX_ANISOTROPY:1,MAX_RENDERBUFFER_SIZE:void 0,MAX_COMBINED_TEXTURE_IMAGE_UNITS:void 0,MAX_CUBE_MAP_TEXTURE_SIZE:void 0,MAX_FRAGMENT_UNIFORM_VECTORS:void 0,MAX_TEXTURE_IMAGE_UNITS:void 0,MAX_TEXTURE_SIZE:void 0,MAX_VARYING_VECTORS:void 0,MAX_VERTEX_ATTRIBS:void 0,MAX_VERTEX_TEXTURE_IMAGE_UNITS:void 0,MAX_VERTEX_UNIFORM_VECTORS:void 0,init:function(t){var e=this;this.gl=t;["MAX_RENDERBUFFER_SIZE","MAX_COMBINED_TEXTURE_IMAGE_UNITS","MAX_CUBE_MAP_TEXTURE_SIZE","MAX_FRAGMENT_UNIFORM_VECTORS","MAX_TEXTURE_IMAGE_UNITS","MAX_TEXTURE_SIZE","MAX_VARYING_VECTORS","MAX_VERTEX_ATTRIBS","MAX_VERTEX_TEXTURE_IMAGE_UNITS","MAX_VERTEX_UNIFORM_VECTORS"].forEach((function(t){e.get(t)})),this.MAX_TEXTURE_INDEX=this.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,this.MAX_VERTEX_PRECISION=this._getMaxSupportPrecision(t.VERTEX_SHADER),this.MAX_FRAGMENT_PRECISION=this._getMaxSupportPrecision(t.FRAGMENT_SHADER),this.MAX_PRECISION=this.getMaxPrecision(this.MAX_FRAGMENT_PRECISION,this.MAX_VERTEX_PRECISION),this.VERTEX_TEXTURE_FLOAT=!!tt.texFloat&&this.MAX_VERTEX_TEXTURE_IMAGE_UNITS>0,this.FRAGMENT_TEXTURE_FLOAT=!!tt.texFloat,this.EXT_FRAG_DEPTH=tt.get("EXT_frag_depth"),this.SHADER_TEXTURE_LOD=!!tt.shaderTextureLod,tt.textureFilterAnisotropic&&(this.MAX_TEXTURE_MAX_ANISOTROPY=t.getParameter(tt.textureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))},get:function(t){var e=this.gl,n=this[t];return void 0===n&&(n=this[t]=e.getParameter(e[t])),n},_getMaxSupportPrecision:function(t){var e=this.gl,n="lowp";if(e.getShaderPrecisionFormat)for(var r=[{name:"highp",type:e.HIGH_FLOAT},{name:"mediump",type:e.MEDIUM_FLOAT}],i=0;i<r.length;i++){var a=r[i];if((e.getShaderPrecisionFormat(t,a.type)||{}).precision>0){n=a.name;break}}else n="mediump";return n},getMaxPrecision:function(t,e){return"highp"===t||"mediump"===t&&"lowp"===e?e:t}},nt=n(50),rt=n.n(nt),it=n(51),at=n.n(it),st=n(52),ot=n.n(st),ut=n(53),ct=n.n(ut),ht=new J,ft=new J,lt=a.a.create({isShader:!0,className:"Shader",vs:"",fs:"",Statics:{commonOptions:{},shaders:{"chunk/baseDefine.glsl":n(18),"chunk/color.frag":n(36),"chunk/color.vert":n(74),"chunk/color_main.vert":n(76),"chunk/diffuse.frag":n(56),"chunk/diffuse_main.frag":n(65),"chunk/extensions.frag":n(24),"chunk/extensions.vert":n(48),"chunk/fog.frag":n(43),"chunk/fog_main.frag":n(67),"chunk/frag_color.frag":n(47),"chunk/joint.vert":n(69),"chunk/joint_main.vert":n(79),"chunk/light.frag":n(40),"chunk/lightFog.frag":n(39),"chunk/lightFog.vert":n(72),"chunk/lightFog_main.frag":n(45),"chunk/lightFog_main.vert":n(82),"chunk/logDepth.frag":n(28),"chunk/logDepth_main.frag":n(29),"chunk/logDepth.vert":n(75),"chunk/logDepth_main.vert":n(83),"chunk/morph.vert":n(73),"chunk/morph_main.vert":n(78),"chunk/normal.frag":n(38),"chunk/normal.vert":n(71),"chunk/normal_main.frag":n(44),"chunk/normal_main.vert":n(81),"chunk/pbr.frag":n(85),"chunk/pbr_main.frag":n(87),"chunk/phong.frag":n(63),"chunk/phong_main.frag":n(66),"chunk/precision.frag":n(25),"chunk/precision.vert":n(49),"chunk/transparency.frag":n(42),"chunk/transparency_main.frag":n(46),"chunk/unQuantize.vert":n(68),"chunk/unQuantize_main.vert":n(77),"chunk/uv.frag":n(37),"chunk/uv.vert":n(70),"chunk/uv_main.vert":n(80),"method/encoding.glsl":n(86),"method/getDiffuse.glsl":n(58),"method/getLightAttenuation.glsl":n(60),"method/getShadow.glsl":n(62),"method/getSpecular.glsl":n(59),"method/packFloat.glsl":n(84),"method/textureEnvMap.glsl":n(41),"method/transpose.glsl":n(57),"method/unpackFloat.glsl":n(61),"basic.frag":n(50),"basic.vert":n(51),"geometry.frag":n(52),"pbr.frag":n(53),"screen.frag":n(54),"screen.vert":n(55)},init:function(t){this.renderer=t,this.commonHeader=this._getCommonHeader(this.renderer)},cache:{get:function(){return ht}},headerCache:{get:function(){return ft}},reset:function(t){ht.removeAll()},getHeaderKey:function(t,e,n,r,i){var a="header_"+e.id+"_"+n.lightInfo.uid;return t.isSkinedMesh&&(a+="_joint"+t.skeleton.jointCount),r&&(a+="_fog_"+r.mode),a+="_"+t.geometry.getShaderKey(),i&&(a+="_fogDepth"),a},getHeader:function(t,e,n,r,i){var a=this.getHeaderKey(t,e,n,r),s=ft.get(a);if(!s||e.isDirty){var o={};Object.assign(o,this.commonOptions);var u=e.lightType;u&&"NONE"!==u&&n.getRenderOption(o),e.getRenderOption(o),t.getRenderOption(o),r&&(o.HAS_FOG=1,r.getRenderOption(o)),i&&(o.USE_LOG_DEPTH=1,et.EXT_FRAG_DEPTH&&(o.USE_EXT_FRAG_DEPTH=1)),o.HAS_NORMAL&&o.NORMAL_MAP&&(o.HAS_TANGENT=1),o.RECEIVE_SHADOWS||(delete o.DIRECTIONAL_LIGHTS_SMC,delete o.SPOT_LIGHTS_SMC,delete o.POINT_LIGHTS_SMC),s="#define SHADER_NAME ".concat(e.shaderName||e.className,"\n"),s+=Object.keys(o).map((function(t){return t.indexOf("HILO_CUSTUM_OPTION_")>-1?"#define ".concat(t.replace("HILO_CUSTUM_OPTION_","")," ").concat(o[t]):"#define HILO_".concat(t," ").concat(o[t])})).join("\n")+"\n",ft.add(a,s)}return s},_getCommonHeader:function(t){var e=et.getMaxPrecision(et.MAX_VERTEX_PRECISION,t.vertexPrecision),n=et.getMaxPrecision(et.MAX_FRAGMENT_PRECISION,t.fragmentPrecision),r=et.getMaxPrecision(e,n);return"\n#define HILO_MAX_PRECISION ".concat(r,"\n#define HILO_MAX_VERTEX_PRECISION ").concat(e,"\n#define HILO_MAX_FRAGMENT_PRECISION ").concat(n,"\n")},getShader:function(t,e,n,r,i,a){var s=this.getHeader(t,e,r,i,a);return e.isBasicMaterial||e.isPBRMaterial?this.getBasicShader(e,n,s):e.isShaderMaterial?this.getCustomShader(e.vs,e.fs,s,e.shaderCacheId||e.id,e.useHeaderCache):null},getBasicShader:function(t,e,n){var r="";e&&(r=(r=t.getInstancedUniforms().map((function(t){return t.name}))).join("|"));var i=t.className+":"+r;t.onBeforeCompile&&(i+=":"+(t.shaderCacheId||t.id));var a=ht.get(i);if(!a){var s="",o=at.a;if(t.isBasicMaterial?t.isGeometryMaterial?s+=ot.a:s+=rt.a:t.isPBRMaterial&&(s+=ct.a),t.onBeforeCompile){var u=t.onBeforeCompile(o,s);s=u.fs,o=u.vs}if(r){var c=new RegExp("^\\s*uniform\\s+(\\w+)\\s+(".concat(r,");"),"gm");o=o.replace(c,"attribute $1 $2;")}a=this.getCustomShader(o,s,n,i,!0)}if(a){var h=this._getNumId(a);null!==h&&(t._shaderNumId=h)}return a},_getNumId:function(t){var e=t.id.match(/_(\d+)/);return e&&e[1]?parseInt(e[1],10):null},getCustomShader:function(t,e,n,r,i){var a,s=this.commonHeader;return r&&(i&&(r+=":"+n),a=ht.get(r)),a||(a=new lt({vs:s+n+t,fs:s+n+e}),r&&ht.add(r,a)),a}},alwaysUse:!1,constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},destroyIfNoRef:function(t){return t.resourceManager.destroyIfNoRef(this),this},destroy:function(){return this._isDestroyed||(ht.removeObject(this),this._isDestroyed=!0),this}}),dt=lt,mt=n(55),_t=n.n(mt),pt=n(54),gt=n.n(pt),vt=[{name:"FLOAT",byteSize:4,uniformFuncName:"uniform1f",type:"Scalar",size:1},{name:"FLOAT_VEC2",byteSize:8,uniformFuncName:"uniform2f",type:"Vector",size:2},{name:"FLOAT_VEC3",byteSize:12,uniformFuncName:"uniform3f",type:"Vector",size:3},{name:"FLOAT_VEC4",byteSize:16,uniformFuncName:"uniform4f",type:"Vector",size:4},{name:"FLOAT_MAT2",byteSize:16,uniformFuncName:"uniformMatrix2fv",type:"Matrix",size:4},{name:"FLOAT_MAT3",byteSize:36,uniformFuncName:"uniformMatrix3fv",type:"Matrix",size:9},{name:"FLOAT_MAT4",byteSize:64,uniformFuncName:"uniformMatrix4fv",type:"Matrix",size:16},{name:"INT",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"INT_VEC2",byteSize:8,uniformFuncName:"uniform2i",type:"Vector",size:2},{name:"INT_VEC3",byteSize:12,uniformFuncName:"uniform3i",type:"Vector",size:3},{name:"INT_VEC4",byteSize:16,uniformFuncName:"uniform4i",type:"Vector",size:4},{name:"BOOL",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"BOOL_VEC2",byteSize:8,uniformFuncName:"uniform2i",type:"Vector",size:2},{name:"BOOL_VEC3",byteSize:12,uniformFuncName:"uniform3i",type:"Vector",size:3},{name:"BOOL_VEC4",byteSize:16,uniformFuncName:"uniform4i",type:"Vector",size:4},{name:"SAMPLER_2D",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"SAMPLER_CUBE",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1}],Et={},Tt={dict:Et,init:function(t){vt.forEach((function(e){var n,r,i=e.name,a=e.uniformFuncName,s=a+"v";"Matrix"===e.type?n=r=function(e,n){void 0!==n&&t[a](e,!1,n)}:(n=function(e,n){void 0!==n&&t[a](e,n)},r=function(e,n){t[s](e,n)}),Et[t[i]]=Object.assign(e,{glValue:t[i],uniform:n,uniformArray:r})}))},get:function(t){return Et[t]}},Mt=new J,At=a.a.create({Statics:{cache:{get:function(){return Mt}},reset:function(t){Mt.each((function(t){t.destroy()}))},getProgram:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.id,i=Mt.get(r);return i||(i=new At({state:e,vertexShader:t.vs,fragShader:t.fs,ignoreError:n}),Mt.add(r,i)),i},getBlankProgram:function(t){var e=dt.getCustomShader("void main(){}","precision HILO_MAX_FRAGMENT_PRECISION float;void main(){gl_FragColor = vec4(0.0);}","","__hiloBlankShader");return this.getProgram(e,t,!0)}},className:"Program",isProgram:!0,fragShader:"",vertexShader:"",attributes:null,uniforms:null,program:null,gl:null,state:null,alwaysUse:!1,constructor:function(t){return this.id=d.a.generateUUID(this.className),Object.assign(this,t),this._dict={},this.attributes={},this.uniforms={},this.gl=this.state.gl,this.program=this.createProgram(),this.program?(this.initAttributes(),this.initUniforms(),this):this.ignoreError?this:At.getBlankProgram(t.state)},createProgram:function(){var t=this.gl,e=t.createProgram(),n=this.createShader(t.VERTEX_SHADER,this.vertexShader),r=this.createShader(t.FRAGMENT_SHADER,this.fragShader);if(n&&r){if(t.attachShader(e,n),t.attachShader(e,r),t.linkProgram(e),t.deleteShader(n),t.deleteShader(r),!t.getProgramParameter(e,t.LINK_STATUS)){var i=t.getProgramInfoLog(e);return m.a.error("compileProgramError: "+i,this),t.deleteProgram(e),null}return e}return null},useProgram:function(){this.state.useProgram(this.program)},createShader:function(t,e){var n=this.gl,r=n.createShader(t);if(n.shaderSource(r,e),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS)){var i=n.getShaderInfoLog(r);return m.a.error("compileShaderError: "+i,e.split("\n").map((function(t,e){return"".concat(e+1," ").concat(t)})).join("\n")),null}return r},initAttributes:function(){for(var t=this,e=this.gl,n=this.program,r=e.getProgramParameter(n,e.ACTIVE_ATTRIBUTES),i=tt.instanced,a=function(r){var a=e.getActiveAttrib(n,r),s=a.name,o=a.type,u=a.size,c=e.getAttribLocation(n,s),h=Tt.get(o),f=function(t){var n=t.type,r=void 0===n?e.FLOAT:n,i=t.normalized,a=void 0!==i&&i,s=t.stride,o=void 0===s?0:s,u=t.offset,f=void 0===u?0:u,l=t.size,d=void 0===l?h.size:l;e.vertexAttribPointer(c,d,r,a,o,f)},l=function(){e.enableVertexAttribArray(c)},d=function(){},m=function(t,e){t[c]=e};if(i&&(d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;i.vertexAttribDivisorANGLE(c,t)}),"Matrix"===h.type){var _=h.byteSize,p=h.size,g=Math.sqrt(p),v=4*g,E=function(t){for(var e=0;e<g;e++)t(c+e,e)};f=function(t){var n,r=t.type,i=void 0===r?e.FLOAT:r,a=t.normalized,s=void 0!==a&&a,o=t.stride,u=void 0===o?0:o,c=t.offset,h=void 0===c?0:c;n=0===u?_:u,E((function(t,r){e.vertexAttribPointer(t,g,i,s,n,h+v*r)}))},l=function(){E((function(t){e.enableVertexAttribArray(t)}))},m=function(t,e){E((function(n){t[n]=e}))},i&&(d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;E((function(e){i.vertexAttribDivisorANGLE(e,t)}))})}t.attributes[s]={name:s,location:c,type:o,size:u,glTypeInfo:h,pointer:f,enable:l,divisor:d,addTo:m}},s=0;s<r;s++)a(s)},initUniforms:function(){for(var t=this,e=this.gl,n=this.program,r=e.getProgramParameter(n,e.ACTIVE_UNIFORMS),i=0,a=function(r){var a=e.getActiveUniform(n,r),s=a.name,o=a.size,u=a.type;s=s.replace(/\[0\]$/,"");var c=e.getUniformLocation(n,s),h=Tt.get(u),f=h.uniformArray,l=h.uniform;t.uniforms[s]={name:s,location:c,type:u,size:o,glTypeInfo:h},u!==e.SAMPLER_2D&&u!==e.SAMPLER_CUBE||(t.uniforms[s].textureIndex=i,i+=o),Object.defineProperty(t,s,{set:h.size>1||o>1?function(t){f(c,t)}:function(e){t._dict[s]!==e&&(t._dict[s]=e,l(c,e))}})},s=0;s<r;s++)a(s)},destroyIfNoRef:function(t){return t.resourceManager.destroyIfNoRef(this),this},destroy:function(){return this._isDestroyed||(this.gl.deleteProgram(this.program),this.uniforms=null,this.attributes=null,this.program=null,this.gl=null,this.state=null,this._dict=null,Mt.removeObject(this),this._isDestroyed=!0),this}}),Lt=At,It=P.a.ARRAY_BUFFER,Ot=P.a.ELEMENT_ARRAY_BUFFER,St=P.a.STATIC_DRAW,Rt=new J,yt=a.a.create({Statics:{cache:{get:function(){return Rt}},reset:function(t){Rt.each((function(t){t.destroy()}))},createVertexBuffer:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:St;return this.createBuffer(t,It,e,n)},createBuffer:function(t,e,n,r){var i=n.bufferViewId,a=Rt.get(i);return a||(n.isDirty=!1,a=new yt(t,e,n.data,r),Rt.add(i,a),a)},createIndexBuffer:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:St;return this.createBuffer(t,Ot,e,n)}},className:"Buffer",isBuffer:!0,constructor:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:It,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:St;this.id=d.a.generateUUID(this.className),this.gl=t,this.target=e,this.usage=r,this.buffer=t.createBuffer(),n&&this.bufferData(n)},bind:function(){return this.gl.bindBuffer(this.target,this.buffer),this},bufferData:function(t){var e=this.gl,n=this.target,r=this.usage;return this.bind(),e.bufferData(n,t,r),this.data=t,this},bufferSubData:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.gl,i=this.target;return n||this.bind(),r.bufferSubData(i,t,e),this},uploadGeometryData:function(t){var e=this,n=t.subDataList;return!this.data||this.data.byteLength<t.data.byteLength||!0===t._isAllDirty?this.bufferData(t.data):n&&n.length?(this.bind(),n.forEach((function(t){e.bufferSubData(t.byteOffset,t.data,!0)}))):this.bufferData(t.data),t.isDirty=!1,this},destroyIfNoRef:function(t){return t.resourceManager.destroyIfNoRef(this),this},destroy:function(){return this._isDestroyed||(this.gl.deleteBuffer(this.buffer),this.data=null,Rt.removeObject(this),this._isDestroyed=!0),this}}),Nt=yt,xt=new ArrayBuffer(1),Ct={getTypedArray:function(t,e){return this._updateBuffer(e*t.BYTES_PER_ELEMENT),new t(xt,0,e)},fillArrayData:function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=0,i=e.length;r<i;r++)t[n+r]=e[r]},_updateBuffer:function(t){xt.byteLength<t&&(xt=new ArrayBuffer(2*t))}},bt=P.a.TRIANGLES,Pt=[],wt=null,Ht=new J,Dt=a.a.create({Statics:{cache:{get:function(){return Ht}},getVao:function(t,e,n){var r=Ht.get(e);return r?n.mode&&n.mode!==r.mode&&(r.mode=n.mode):(r=new Dt(t,e,n),Ht.add(e,r)),r},reset:function(t){wt=null,Pt=[],this.bindSystemVao(),Ht.each((function(e){e.destroy(t)}))},bindSystemVao:function(){tt.vao&&tt.vao.bindVertexArrayOES(null),wt=null}},className:"VertexArrayObject",isVertexArrayObject:!0,vertexCount:null,useVao:!1,useInstanced:!1,mode:bt,isDirty:!0,constructor:function(t,e,n){this.gl=t,this.id=e,this.vaoExtension=tt.vao,this.instancedExtension=tt.instanced,Object.assign(this,n),this.vaoExtension||(this.useVao=!1),this.instancedExtension||(this.useInstanced=!1),this.useVao&&(this.vao=this.vaoExtension.createVertexArrayOES()),this.attributes=[],this.activeStates=[],this.indexBuffer=null},bind:function(){wt!==this&&(this.useVao?this.vaoExtension.bindVertexArrayOES(this.vao):this.bindSystemVao(),wt=this)},bindSystemVao:function(){var t=this.gl;wt&&wt.useVao&&wt.unbind();var e,n=this.activeStates;this.attributes.forEach((function(t){var n=t.buffer,r=t.attribute,i=t.geometryData;e!==n&&(e=n,n.bind()),r.enable(),r.pointer(i),t.useInstanced?r.divisor(1):r.divisor(0)})),Pt.forEach((function(e,r){var i=n[r];e&&!i&&(e.attribute.divisor(0),t.disableVertexAttribArray(r))})),this.indexBuffer&&this.indexBuffer.bind(),Pt=n},unbind:function(){this.useVao&&this.vaoExtension.bindVertexArrayOES(null),wt=null},draw:function(){this.bind();var t=this.gl,e=this.mode;this.indexBuffer?t.drawElements(e,this.vertexCount,this.indexType,0):t.drawArrays(e,0,this.getVertexCount())},getVertexCount:function(){if(null===this.vertexCount){var t=this.attributes[0];this.vertexCount=t?t.geometryData.count:0}return this.vertexCount},drawInstance:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.bind();var e=this.gl,n=this.mode;this.useInstanced&&(this.indexBuffer?this.instancedExtension.drawElementsInstancedANGLE(n,this.vertexCount,e.UNSIGNED_SHORT,0,t):this.instancedExtension.drawArraysInstancedANGLE(n,0,this.getVertexCount(),t))},addIndexBuffer:function(t,e){this.bind();var n=this.gl,r=this.indexBuffer;return this.indexType=t.type,r?t.isDirty&&(r.uploadGeometryData(t),this.vertexCount=t.length):((r=Nt.createIndexBuffer(n,t,e)).bind(),this.indexBuffer=r,this.vertexCount=t.length),r},addAttribute:function(t,e,n,r){this.bind();var i=this.gl,a=e.name,s=this[a];if(!s){var o=Nt.createVertexBuffer(i,t,n);o.bind(),e.enable(),e.pointer(t),s={attribute:e,buffer:o,geometryData:t},this.attributes.push(s),this[a]=s,e.addTo(this.activeStates,s),r&&r(s)}if(t.isDirty){var u=s.buffer;u.bind(),e.enable(),e.pointer(t),u.uploadGeometryData(t)}return s},addInstancedAttribute:function(t,e,n){this.bind();var r=this.gl,i=t.name,a=t.glTypeInfo,s=Ct.getTypedArray(Float32Array,e.length*a.size);e.forEach((function(t,e){void 0!==n(t)?Ct.fillArrayData(s,n(t),e*a.size):m.a.warn("no attributeData:"+i+"-"+t.name)}));var o,u=this[i];return u?(o=u.geometryData).data=s:o=new b(s,1),this.addAttribute(o,t,r.DYNAMIC_DRAW,(function(e){t.divisor(1),e.useInstanced=!0}))},getResources:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.attributes&&this.attributes.forEach((function(e){t.push(e.buffer)})),this.indexBuffer&&t.push(this.indexBuffer),t},destroyIfNoRef:function(t){return t.resourceManager.destroyIfNoRef(this),this},destroy:function(){var t=this;return this._isDestroyed||(this.instancedExtension=null,this.useVao&&(this.vaoExtension.deleteVertexArrayOES(this.vao),this.vao=null,this.vaoExtension=null),this.gl=null,this.indexBuffer=null,this.attributes.forEach((function(e){var n=e.attribute||{};t[n.name]=null})),this.attributes=null,this.activeStates=null,Ht.removeObject(this),this._isDestroyed=!0),this}}),Ft=Dt,Ut=P.a.TEXTURE_2D,Gt=P.a.RGBA,Bt=P.a.LINEAR,Vt=P.a.NEAREST,Xt=P.a.REPEAT,jt=P.a.CLAMP_TO_EDGE,kt=P.a.UNSIGNED_BYTE,zt=P.a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Wt=P.a.UNPACK_FLIP_Y_WEBGL,Yt=P.a.UNPACK_COLORSPACE_CONVERSION_WEBGL,qt=P.a.BROWSER_DEFAULT_WEBGL,Zt=P.a.NONE,Kt=new J,Qt=a.a.create({Statics:{cache:{get:function(){return Kt}},reset:function(t){Kt.each((function(e,n){t.deleteTexture(e),Kt.remove(n)}))}},isTexture:!0,className:"Texture",isImageCanRelease:!1,_isImageReleased:!1,_image:null,image:{get:function(){return this._isImageReleased&&m.a.errorOnce("Read Texture.image(".concat(this.id,")"),"Read Texture.image after image released!"),this._image},set:function(t){this._image=t,this._isImageReleased=!1}},_releaseImage:function(){this._canvasImage=null,this._canvasCtx=null,this._originImage=null,this._image=null,this.mipmaps=null,this._isImageReleased=!0},mipmaps:null,target:Ut,internalFormat:Gt,format:Gt,type:kt,width:0,height:0,border:0,magFilter:Bt,minFilter:Bt,wrapS:Xt,wrapT:Xt,name:"",premultiplyAlpha:!1,flipY:!1,colorSpaceConversion:!0,compressed:!1,needUpdate:!0,needDestroy:!1,autoUpdate:!1,uv:0,anisotropic:1,origWidth:{get:function(){return this._originImage?this._originImage.width||this.width:this.image&&this.image.width||this.width}},origHeight:{get:function(){return this.originImage?this._originImage.height||this.height:this.image&&this.image.height||this.height}},useMipmap:{get:function(){return this.minFilter!==Bt&&this.minFilter!==Vt},set:function(){m.a.warn("texture.useMipmap is readOnly!")}},useRepeat:{get:function(){return this.wrapS!==jt||this.wrapT!==jt},set:function(){m.a.warn("texture.useRepeat is readOnly!")}},mipmapCount:{get:function(){return Math.floor(Math.log2(Math.max(this.width,this.height))+1)},set:function(){m.a.warn("texture.mipmapCount is readOnly!")}},constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},isImgPowerOfTwo:function(t){return d.a.isPowerOfTwo(t.width)&&d.a.isPowerOfTwo(t.height)},getSupportSize:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.width,r=t.height;e&&!this.isImgPowerOfTwo(t)&&(n=d.a.nextPowerOfTwo(n),r=d.a.nextPowerOfTwo(r));var i=et.MAX_TEXTURE_SIZE;return i&&(n>i&&(n=i),r>i&&(r=i)),{width:n,height:r}},resizeImgToPowerOfTwo:function(t){var e=this.getSupportSize(t,!0);return this.resizeImg(t,e.width,e.height)},resizeImg:function(t,e,n){if(t.width===e&&t.height===n)return t;var r=this._canvasImage;return r?(r.width=e,r.height=n,this._canvasCtx=r.getContext("2d")):((r=document.createElement("canvas")).width=e,r.height=n,this._canvasImage=r,this._canvasCtx=r.getContext("2d")),this._canvasCtx.drawImage(t,0,0,t.width,t.height,0,0,e,n),m.a.warnOnce("Texture.resizeImg(".concat(this.id,")"),"image size(".concat(t.width,"x").concat(t.height,") is not support. Resized to ").concat(r.width,"x").concat(r.height),t.src),this._originImage=t,r},_glUploadTexture:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.width,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:this.height,s=t.gl;return this.compressed?s.compressedTexImage2D(e,r,this.internalFormat,i,a,this.border,n):n&&void 0!==n.width?s.texImage2D(e,r,this.internalFormat,this.format,this.type,n):s.texImage2D(e,r,this.internalFormat,i,a,this.border,this.format,this.type,n),this},_uploadTexture:function(t){var e=this;return this.useMipmap&&this.mipmaps?this.mipmaps.forEach((function(n,r){e._glUploadTexture(t,e.target,n.data,r,n.width,n.height)})):this._glUploadTexture(t,this.target,this.image,0),this},_updatePixelStorei:function(){var t=this.state;t.pixelStorei(zt,this.premultiplyAlpha),t.pixelStorei(Wt,!!this.flipY),t.pixelStorei(Yt,this.colorSpaceConversion?qt:Zt)},updateTexture:function(t,e){var n=t.gl;if(this.needUpdate||this.autoUpdate){this._originImage&&this.image===this._canvasImage&&(this.image=this._originImage);var r=this.useMipmap,i=this.useRepeat;if(this.image&&!this.image.length){var a=i||r,s=this.getSupportSize(this.image,a);this.image=this.resizeImg(this.image,s.width,s.height),this.width=this.image.width,this.height=this.image.height}t.activeTexture(n.TEXTURE0+et.MAX_TEXTURE_INDEX),t.bindTexture(this.target,e),this._updatePixelStorei(),this._uploadTexture(t),r&&(this.compressed?this.mipmaps||(m.a.warn("Compressed texture has no mipmips, changed the minFilter from ".concat(this.minFilter," to Linear!"),this),this.minFilter=Bt):n.generateMipmap(this.target)),n.texParameterf(this.target,n.TEXTURE_MAG_FILTER,this.magFilter),n.texParameterf(this.target,n.TEXTURE_MIN_FILTER,this.minFilter),n.texParameterf(this.target,n.TEXTURE_WRAP_S,this.wrapS),n.texParameterf(this.target,n.TEXTURE_WRAP_T,this.wrapT);var o=tt.textureFilterAnisotropic;o&&this.anisotropic>1&&n.texParameterf(this.target,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(this.anisotropic,et.MAX_TEXTURE_MAX_ANISOTROPY)),this.needUpdate=!1}return this._needUpdateSubTexture&&(this._uploadSubTextures(t,e),this._needUpdateSubTexture=!1),this},_uploadSubTextures:function(t,e){var n=this;if(this._subTextureList&&this._subTextureList.length>0){var r=t.gl;t.activeTexture(r.TEXTURE0+et.MAX_TEXTURE_INDEX),t.bindTexture(this.target,e),this._updatePixelStorei(),this._subTextureList.forEach((function(t){var e=t[0],i=t[1],a=t[2];r.texSubImage2D(n.target,0,e,i,n.format,n.type,a)})),this._subTextureList.length=0}},_needUpdateSubTexture:!1,_subTextureList:null,updateSubTexture:function(t,e,n){this._subTextureList||(this._subTextureList=[]),this._subTextureList.push([t,e,n]),this._needUpdateSubTexture=!0},getGLTexture:function(t){this.state=t;var e=this.gl=t.gl,n=this.id;this.needDestroy&&(this.destroy(),this.needDestroy=!1);var r=Kt.get(n);return r||(r=e.createTexture(),Kt.add(n,r),this.needUpdate=!0),this.updateTexture(t,r),this.isImageCanRelease&&this._releaseImage(),r},setGLTexture:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e&&this.destroy(),Kt.add(this.id,t),this},destroy:function(){var t=this.id,e=Kt.get(t);return e&&this.gl&&(this.gl.deleteTexture(e),Kt.remove(t)),this},clone:function(){var t=Object.assign({},this);return delete t.id,new this.constructor(t)}}),Jt=P.a.TEXTURE_2D,$t=P.a.RGBA,te=P.a.UNSIGNED_BYTE,ee=P.a.COLOR_ATTACHMENT0,ne=P.a.DEPTH_STENCIL,re=P.a.DEPTH_TEST,ie=P.a.CULL_FACE,ae=P.a.TRIANGLE_STRIP,se=P.a.NEAREST,oe=P.a.CLAMP_TO_EDGE,ue=new J,ce=a.a.create({Statics:{cache:{get:function(){return ue}},reset:function(t){ue.each((function(t){t.reset()}))},destroy:function(t){ue.each((function(t){t.destroy()}))}},className:"Framebuffer",isFramebuffer:!0,bufferInternalFormat:ne,target:Jt,format:$t,internalFormat:$t,type:te,minFilter:se,magFilter:se,wrapS:oe,wrapT:oe,data:null,attachment:ee,needRenderbuffer:!0,useVao:!0,renderer:null,texture:null,renderbuffer:null,framebuffer:null,_isInit:!1,constructor:function(t,e){this.id=d.a.generateUUID(this.className),this.renderer=t,Object.assign(this,e),this.width||(this.width=t.width),this.height||(this.height=t.height),ue.add(this.id,this)},init:function(){if(!this._isInit&&this.renderer.isInit){this._isInit=!0;var t=this.renderer;this.gl=t.gl,this.state=t.state,this.reset()}},reset:function(){this.destroyResource();var t=this.gl;this.framebuffer=t.createFramebuffer(),this.bind(),this.needRenderbuffer&&(this.renderbuffer=this.createRenderbuffer()),this.texture=this.createTexture(),this.isComplete()||m.a.warn("Framebuffer is not complete => "+t.checkFramebufferStatus(t.FRAMEBUFFER)),this.unbind()},isComplete:function(){var t=this.gl;return!(!t||t.checkFramebufferStatus(t.FRAMEBUFFER)!==t.FRAMEBUFFER_COMPLETE)},bind:function(){this.init(),this._isInit&&this.state.bindFramebuffer(this.gl.FRAMEBUFFER,this.framebuffer)},unbind:function(){if(this.init(),this._isInit){var t=this.state;t.bindFramebuffer(this.gl.FRAMEBUFFER,t.preFramebuffer)}},clear:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new v.a(0,0,0,0);if(this._isInit){var e=this.gl;e.clearColor(t.r,t.g,t.b,t.a),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}},render:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4?arguments[4]:void 0;if(this._isInit){var a=this.gl,s=this.state;s.disable(re),s.disable(ie),i&&this.clear(i);var o=dt.getCustomShader(_t.a,gt.a,"","FramebufferTextureShader"),u=Lt.getProgram(o,s);u.useProgram();var c="".concat(t,"_").concat(e,"_").concat(n,"_").concat(r,"_").concat(u.id),h=Ft.getVao(a,c,{useVao:this.useVao,useInstanced:!1,mode:ae});if(h.isDirty){h.isDirty=!1;var f=[t=2*t-1,e=1-2*e,t+(n*=2),e,t,e-(r*=2),t+n,e-r];h.addAttribute(new b(new Float32Array(f),2),u.attributes.a_position),h.addAttribute(new b(new Float32Array([0,1,1,1,0,0,1,0]),2),u.attributes.a_texcoord0)}s.activeTexture(a.TEXTURE0),s.bindTexture(a.TEXTURE_2D,this.texture.getGLTexture(s)),h.draw()}},createRenderbuffer:function(){var t=this.gl,e=this.width,n=this.height,r=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,r),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e,n),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,r),r},createTexture:function(){var t=this.state,e=t.gl,n=new Qt({minFilter:this.minFilter,magFilter:this.magFilter,internalFormat:this.internalFormat,format:this.format,type:this.type,width:this.width,height:this.height,image:this.data,wrapS:this.wrapS,wrapT:this.wrapT}),r=n.getGLTexture(t);return e.framebufferTexture2D(e.FRAMEBUFFER,this.attachment,this.target,r,0),n},resize:function(t,e,n){(n||this.width!==t||this.height!==e)&&(this.width=t,this.height=e,this._isInit&&this.reset())},readPixels:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=Object(i.getTypedArrayClass)(this.type),s=new a(n*r*4);if(this._isInit){var o=this.gl;e=this.height-e-r,this.bind(),o.readPixels(t,e,n,r,this.format,this.type,s),this.unbind()}return s},destroy:function(){return this._isDestroyed||(this.destroyResource(),this.gl=null,ue.removeObject(this),this._isDestroyed=!0),this},destroyResource:function(){var t=this.gl;t&&(this.framebuffer&&(t.deleteFramebuffer(this.framebuffer),this.framebuffer=null),this.renderbuffer&&(t.deleteRenderbuffer(this.renderbuffer),this.renderbuffer=null),this.texture&&(this.texture.destroy(),this.texture=null))}}),he=P.a.TEXTURE_CUBE_MAP,fe=P.a.RGB,le=P.a.LINEAR,de=P.a.CLAMP_TO_EDGE,me=P.a.TEXTURE_CUBE_MAP_POSITIVE_X,_e=a.a.create({Extends:Qt,isCubeTexture:!0,className:"CubeTexture",target:he,internalFormat:fe,format:fe,magFilter:le,minFilter:le,wrapS:de,wrapT:de,constructor:function(t){_e.superclass.constructor.call(this,t),this.image=this.image||[]},_uploadTexture:function(t){var e=this,n=this.image;Array.isArray(n)&&6===n.length?(n[0]&&n[0].width&&(this.width=n[0].width,this.height=n[0].height),n.forEach((function(n,r){e._glUploadTexture(t,me+r,n,0)}))):m.a.error("CubeTexture image must be an Array of length 6",n)},right:{get:function(){return this.image[0]},set:function(t){this.image[0]=t}},left:{get:function(){return this.image[1]},set:function(t){this.image[1]=t}},top:{get:function(){return this.image[2]},set:function(t){this.image[2]=t}},bottom:{get:function(){return this.image[3]},set:function(t){this.image[3]=t}},front:{get:function(){return this.image[4]},set:function(t){this.image[4]=t}},back:{get:function(){return this.image[5]},set:function(t){this.image[5]=t}}}),pe=_e,ge=P.a.TEXTURE_2D,ve=P.a.RGBA,Ee=P.a.NEAREST,Te=P.a.CLAMP_TO_EDGE,Me=P.a.FLOAT,Ae=a.a.create({Extends:Qt,isDataTexture:!0,className:"DataTexture",target:ge,internalFormat:ve,format:ve,type:Me,magFilter:Ee,minFilter:Ee,wrapS:Te,wrapT:Te,dataLength:0,resetSize:function(t){if(t!==this.dataLength){this.dataLength=t;var e=d.a.nextPowerOfTwo(t/4),n=Math.max(Math.log2(e),4),r=Math.floor(n/2),a=n-r;this.width=Math.pow(2,r),this.height=Math.pow(2,a),this.DataClass=Object(i.getTypedArrayClass)(this.type)}},data:{get:function(){return this.image},set:function(t){if(this.image!==t){this.resetSize(t.length);var e=this.width*this.height*4;e===t.length&&t instanceof this.DataClass?this.image=t:(this.image&&this.image.length===e||(this.image=new this.DataClass(e)),this.image.set(t,0)),this.needUpdate=!0}}},constructor:function(t){Ae.superclass.constructor.call(this,t)}}),Le=Ae;function Ie(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Oe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Oe(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Oe(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var Se,Re,ye,Ne,xe,Ce,be,Pe=new c.a,we=new y.a,He=new o.a,De=new Float32Array([.5,.5,.5,1]),Fe=new Float32Array([0,0]),Ue={state:null,camera:null,lightManager:null,fog:null,gl:null,renderer:null,blankInfo:{get:function(){}},init:function(t,e,n,r,i){Ce=this._renderer=t,Ne=this.state=e,Se=this.camera=n,ye=this.lightManager=r,xe=this.fog=i,Re=this.gl=Ne.gl},setCamera:function(t){Se=this.camera=t},handlerColorOrTexture:function(t,e){return t&&t.isTexture?this.handlerTexture(t,e):(t&&t.isColor?t.toArray(De):De[0]=De[1]=De[2]=.5,De)},handlerTexture:function(t,e){if(t&&t.isTexture)return this.handlerGLTexture(t.target,t.getGLTexture(Ne),e)},handlerGLTexture:function(t,e,n){if(e)return Ne.activeTexture(Re.TEXTURE0+n),Ne.bindTexture(t,e),n},handlerUV:function(t){return t&&t.isTexture&&t.uv||0},POSITION:{get:function(t,e,n){return t.geometry.vertices}},NORMAL:{get:function(t,e,n){return t.geometry.normals}},TANGENT:{get:function(t,e,n){var r=e.normalMap||e.clearcoatNormalMap;return r&&r.isTexture&&1===Number(r.uv)?t.geometry.tangents1:t.geometry.tangents}},TEXCOORD_0:{get:function(t,e,n){if(t.geometry.uvs)return t.geometry.uvs}},TEXCOORD_1:{get:function(t,e,n){if(t.geometry.uvs1)return t.geometry.uvs1}},UVMATRIX_0:{get:function(t,e,n){if(e.uvMatrix)return e.uvMatrix.elements}},UVMATRIX_1:{get:function(t,e,n){if(e.uvMatrix1)return e.uvMatrix1.elements}},CAMERAFAR:{get:function(t,e,n){if(Se.isPerspectiveCamera)return Se.far}},CAMERANEAR:{get:function(t,e,n){if(Se.isPerspectiveCamera)return Se.near}},CAMERATYPE:{get:function(t,e,n){return Se.isPerspectiveCamera?1:0}},CAMERAPOSITION:{get:function(t,e,n){return Se.worldMatrix.getTranslation(Pe).elements}},COLOR_0:{get:function(t,e,n){if(t.geometry.colors)return t.geometry.colors}},SKININDICES:{get:function(t,e,n){return t.geometry.skinIndices}},JOINT:{get:function(t,e,n){return t.geometry.skinIndices}},WEIGHT:{get:function(t,e,n){return t.geometry.skinWeights}},SKINWEIGHTS:{get:function(t,e,n){return t.geometry.skinWeights}},RENDERERSIZE:{get:function(t,e,n){return Fe[0]=Ce.width,Fe[1]=Ce.height,Fe}},LOCAL:{get:function(t,e,n){return t.matrix.elements},isDependMesh:!0},MODEL:{get:function(t,e,n){return t.worldMatrix.elements},isDependMesh:!0},VIEW:{get:function(t,e,n){return Se.viewMatrix.elements}},PROJECTION:{get:function(t,e,n){return Se.projectionMatrix.elements}},VIEWPROJECTION:{get:function(t,e,n){return Se.viewProjectionMatrix.elements}},MODELVIEW:{get:function(t,e,n){return Se.getModelViewMatrix(t,He).elements},isDependMesh:!0},MODELVIEWPROJECTION:{get:function(t,e,n){return Se.getModelProjectionMatrix(t,He).elements},isDependMesh:!0},MODELINVERSE:{get:function(t,e,n){return He.invert(t.worldMatrix).elements},isDependMesh:!0},VIEWINVERSE:{get:function(t,e,n){return Se.worldMatrix.elements}},VIEWINVERSEINVERSETRANSPOSE:{get:function(t,e,n){return we.normalFromMat4(Se.worldMatrix).elements}},PROJECTIONINVERSE:{get:function(t,e,n){return He.invert(Se.projectionMatrix).elements}},MODELVIEWINVERSE:{get:function(t,e,n){return He.invert(Se.getModelViewMatrix(t,He)).elements},isDependMesh:!0},MODELVIEWPROJECTIONINVERSE:{get:function(t,e,n){return He.invert(Se.getModelProjectionMatrix(t,He)).elements},isDependMesh:!0},MODELINVERSETRANSPOSE:{get:function(t,e,n){return we.normalFromMat4(t.worldMatrix).elements},isDependMesh:!0},MODELVIEWINVERSETRANSPOSE:{get:function(t,e,n){return we.normalFromMat4(Se.getModelViewMatrix(t,He)).elements},isDependMesh:!0},VIEWPORT:void 0,JOINTMATRIX:{get:function(t,e,n){if(t.isSkinedMesh)return t.getJointMat();m.a.warnOnce("semantic.JOINTMATRIX(".concat(t.id,")"),"Current mesh is not SkinedMesh!",t.id)},isDependMesh:!0,notSupportInstanced:!0},JOINTMATRIXTEXTURE:{get:function(t,e,n){if(t.isSkinedMesh)return t.updateJointMatTexture(),Ue.handlerTexture(t.jointMatTexture,n.textureIndex);m.a.warnOnce("semantic.JOINTMATRIXTEXTURE(".concat(t.id,")"),"Current mesh is not SkinedMesh!",t.id)},isDependMesh:!0,notSupportInstanced:!0},JOINTMATRIXTEXTURESIZE:{get:function(t,e,n){if(t.isSkinedMesh)return t.initJointMatTexture(),[t.jointMatTexture.width,t.jointMatTexture.height];m.a.warnOnce("semantic.JOINTMATRIXTEXTURESIZE(".concat(t.id,")"),"Current mesh is not SkinedMesh!",t.id)},isDependMesh:!0,notSupportInstanced:!0},NORMALMAPSCALE:{get:function(t,e,n){return e.normalMapScale}},OCCLUSIONSTRENGTH:{get:function(t,e,n){return e.occlusionStrength}},SHININESS:{get:function(t,e,n){return e.shininess}},SPECULARENVMATRIX:{get:function(t,e,n){return e.specularEnvMatrix&&e.specularEnvMap?e.specularEnvMatrix.elements:(He.identity(),He.elements)}},REFLECTIVITY:{get:function(t,e,n){return e.reflectivity}},REFRACTRATIO:{get:function(t,e,n){return e.refractRatio}},REFRACTIVITY:{get:function(t,e,n){return e.refractivity}},LOGDEPTH:{get:function(t,e,n){return 2/(Math.log(Se.far+1)/Math.LN2)}},AMBIENTLIGHTSCOLOR:{get:function(t,e,n){return ye.ambientInfo}},DIRECTIONALLIGHTSCOLOR:{get:function(t,e,n){return ye.directionalInfo.colors}},DIRECTIONALLIGHTSINFO:{get:function(t,e,n){return ye.directionalInfo.infos}},DIRECTIONALLIGHTSSHADOWMAP:{get:function(t,e,n){return ye.directionalInfo.shadowMap.map((function(t,e){return Ue.handlerTexture(t,n.textureIndex+e)}))}},DIRECTIONALLIGHTSSHADOWMAPSIZE:{get:function(t,e,n){return ye.directionalInfo.shadowMapSize}},DIRECTIONALLIGHTSSHADOWBIAS:{get:function(t,e,n){return ye.directionalInfo.shadowBias}},DIRECTIONALLIGHTSPACEMATRIX:{get:function(t,e,n){return ye.directionalInfo.lightSpaceMatrix}},POINTLIGHTSPOS:{get:function(t,e,n){return ye.pointInfo.poses}},POINTLIGHTSCOLOR:{get:function(t,e,n){return ye.pointInfo.colors}},POINTLIGHTSINFO:{get:function(t,e,n){return ye.pointInfo.infos}},POINTLIGHTSRANGE:{get:function(t,e,n){return ye.pointInfo.ranges}},POINTLIGHTSSHADOWMAP:{get:function(t,e,n){return ye.pointInfo.shadowMap.map((function(t,e){return Ue.handlerTexture(t,n.textureIndex+e)}))}},POINTLIGHTSSHADOWBIAS:{get:function(t,e,n){return ye.pointInfo.shadowBias}},POINTLIGHTSPACEMATRIX:{get:function(t,e,n){return ye.pointInfo.lightSpaceMatrix}},POINTLIGHTCAMERA:{get:function(t,e,n){return ye.pointInfo.cameras}},SPOTLIGHTSPOS:{get:function(t,e,n){return ye.spotInfo.poses}},SPOTLIGHTSDIR:{get:function(t,e,n){return ye.spotInfo.dirs}},SPOTLIGHTSCOLOR:{get:function(t,e,n){return ye.spotInfo.colors}},SPOTLIGHTSCUTOFFS:{get:function(t,e,n){return ye.spotInfo.cutoffs}},SPOTLIGHTSINFO:{get:function(t,e,n){return ye.spotInfo.infos}},SPOTLIGHTSRANGE:{get:function(t,e,n){return ye.spotInfo.ranges}},SPOTLIGHTSSHADOWMAP:{get:function(t,e,n){return ye.spotInfo.shadowMap.map((function(t,e){return Ue.handlerTexture(t,n.textureIndex+e)}))}},SPOTLIGHTSSHADOWMAPSIZE:{get:function(t,e,n){return ye.spotInfo.shadowMapSize}},SPOTLIGHTSSHADOWBIAS:{get:function(t,e,n){return ye.spotInfo.shadowBias}},SPOTLIGHTSPACEMATRIX:{get:function(t,e,n){return ye.spotInfo.lightSpaceMatrix}},AREALIGHTSCOLOR:{get:function(t,e,n){return ye.areaInfo.colors}},AREALIGHTSPOS:{get:function(t,e,n){return ye.areaInfo.poses}},AREALIGHTSWIDTH:{get:function(t,e,n){return ye.areaInfo.width}},AREALIGHTSHEIGHT:{get:function(t,e,n){return ye.areaInfo.height}},AREALIGHTSLTCTEXTURE1:{get:function(t,e,n){return Ue.handlerTexture(ye.areaInfo.ltcTexture1,n.textureIndex)}},AREALIGHTSLTCTEXTURE2:{get:function(t,e,n){return Ue.handlerTexture(ye.areaInfo.ltcTexture2,n.textureIndex)}},FOGCOLOR:{get:function(t,e,n){if(xe)return xe.color.elements}},FOGINFO:{get:function(t,e,n){if(xe)return xe.getInfo()}},POSITIONDECODEMAT:{get:function(t,e,n){return t.geometry.positionDecodeMat},isDependMesh:!0},NORMALDECODEMAT:{get:function(t,e,n){return t.geometry.normalDecodeMat},isDependMesh:!0},UVDECODEMAT:{get:function(t,e,n){return t.geometry.uvDecodeMat},isDependMesh:!0},UV1DECODEMAT:{get:function(t,e,n){return t.geometry.uv1DecodeMat},isDependMesh:!0},BASECOLOR:{get:function(t,e,n){return e.baseColor.elements}},EMISSIONFACTOR:{get:function(t,e,n){return e.emissionFactor.elements}},METALLIC:{get:function(t,e,n){return e.metallic}},ROUGHNESS:{get:function(t,e,n){return e.roughness}},DIFFUSEENVMAP:{get:function(t,e,n){return Ue.handlerTexture(e.diffuseEnvMap,n.textureIndex)}},DIFFUSEENVINTENSITY:{get:function(t,e,n){return e.diffuseEnvIntensity}},DIFFUSEENVSPHEREHARMONICS3:{get:function(t,e,n){var r=e.diffuseEnvSphereHarmonics3;if(r)return r.toArray()}},BRDFLUT:{get:function(t,e,n){return Ue.handlerTexture(e.brdfLUT,n.textureIndex)}},SPECULARENVMAP:{get:function(t,e,n){return Ue.handlerTexture(e.specularEnvMap,n.textureIndex)}},SPECULARENVINTENSITY:{get:function(t,e,n){return e.specularEnvIntensity}},SPECULARENVMAPMIPCOUNT:{get:function(t,e,n){var r=e.specularEnvMap;return r?r.mipmapCount:1}},GLOSSINESS:{get:function(t,e,n){return e.glossiness}},ALPHACUTOFF:{get:function(t,e,n){return e.alphaCutoff}},EXPOSURE:{get:function(t,e,n){return e.exposure}},GAMMAFACTOR:{get:function(t,e,n){return e.gammaFactor}},MORPHWEIGHTS:{isDependMesh:!0,notSupportInstanced:!0,get:function(t,e,n){var r=t.geometry;if(r.isMorphGeometry&&r.weights)return r.weights}},CLEARCOATFACTOR:{isDependMesh:!1,notSupportInstanced:!1,get:function(t,e,n){return e.clearcoatFactor}},CLEARCOATROUGHNESSFACTOR:{isDependMesh:!1,notSupportInstanced:!1,get:function(t,e,n){return e.clearcoatRoughnessFactor}}};Ue._TIME=(be=(new Date).getTime(),{isDependMesh:!1,notSupportInstanced:!1,get:function(t,e,n){return.001*((new Date).getTime()-be)}}),[["POSITION","vertices"],["NORMAL","normals"],["TANGENT","tangents"]].forEach((function(t){for(var e=0;e<8;e++)Ue["MORPH"+t[0]+e]={get:function(t,e){return function(n,r,i){var a=n.geometry;if(a.isMorphGeometry&&a.targets&&a.targets[t]){var s=a._originalMorphIndices?a._originalMorphIndices[e]:e,o=a.targets[t][s],u="_target_".concat(t,"_").concat(e);return a[u]!==s&&o&&(o.isDirty=!0,a[u]=s),o}}}(t[1],e)}})),[["DIFFUSE","diffuse"],["SPECULAR","specular"],["EMISSION","emission"],["AMBIENT","ambient"]].forEach((function(t){var e=Ie(t,2),n=e[0],r=e[1];Ue[n]={get:function(t,e,n){return Ue.handlerColorOrTexture(e[r],n.textureIndex)}},Ue["".concat(n,"UV")]={get:function(t,e,n){return Ue.handlerUV(e[r])}}})),[["NORMALMAP","normalMap"],["PARALLAXMAP","parallaxMap"],["BASECOLORMAP","baseColorMap"],["METALLICMAP","metallicMap"],["ROUGHNESSMAP","roughnessMap"],["METALLICROUGHNESSMAP","metallicRoughnessMap"],["OCCLUSIONMAP","occlusionMap"],["SPECULARGLOSSINESSMAP","specularGlossinessMap"],["LIGHTMAP","lightMap"],["CLEARCOATMAP","clearcoatMap"],["CLEARCOATROUGHNESSMAP","clearcoatRoughnessMap"],["CLEARCOATNORMALMAP","clearcoatNormalMap"]].forEach((function(t){var e=Ie(t,2),n=e[0],r=e[1];Ue[n]={get:function(t,e,n){return Ue.handlerTexture(e[r],n.textureIndex)}},Ue["".concat(n,"UV")]={get:function(t,e,n){return Ue.handlerUV(e[r])}}})),[["TRANSPARENCY","transparency"]].forEach((function(t){var e=Ie(t,2),n=e[0],r=e[1];Ue[n]={get:function(t,e,n){var i=e[r];return i&&i.isTexture?Ue.handlerTexture(i,n.textureIndex):null!=i?i:1}},Ue["".concat(n,"UV")]={get:function(t,e,n){return Ue.handlerUV(e[r])}}}));var Ge=Ue,Be=P.a.LEQUAL,Ve=P.a.BACK,Xe=P.a.FRONT,je=P.a.FRONT_AND_BACK,ke=P.a.ZERO,ze=P.a.FUNC_ADD,We=P.a.ONE,Ye=P.a.SRC_ALPHA,qe=P.a.ONE_MINUS_SRC_ALPHA,Ze=P.a.CCW,Ke=P.a.ALWAYS,Qe=P.a.KEEP,Je={isBlankInfo:!0,get:function(){}},$e=a.a.create({isMaterial:!0,className:"Material",name:null,shaderCacheId:null,shaderName:null,lightType:"NONE",wireframe:!1,frontFace:Ze,depthTest:!0,sampleAlphaToCoverage:!1,depthMask:!0,depthRange:[0,1],depthFunc:Be,_cullFace:!0,normalMap:null,parallaxMap:null,normalMapScale:1,ignoreTranparent:!1,gammaCorrection:!1,usePhysicsLight:!1,isDiffuesEnvAndAmbientLightWorkTogether:!1,userData:null,renderOrder:0,_premultiplyAlpha:!0,premultiplyAlpha:{get:function(){return this._premultiplyAlpha},set:function(t){this._premultiplyAlpha=t,this.transparent&&this.setDefaultTransparentBlend()}},gammaOutput:{get:function(){return m.a.warnOnce("Matrial.gammaOutput","material.gammaOutput has deprecated. Use material.gammaCorrection instead."),this.gammaCorrection},set:function(t){m.a.warnOnce("Matrial.gammaOutput","material.gammaOutput has deprecated. Use material.gammaCorrection instead."),this.gammaCorrection=t}},gammaFactor:2.2,castShadows:!0,receiveShadows:!0,uvMatrix:null,uvMatrix1:null,cullFace:{get:function(){return this._cullFace},set:function(t){this._cullFace=t,t?this.cullFaceType=this._cullFaceType:this._side=je}},_cullFaceType:Ve,cullFaceType:{get:function(){return this._cullFaceType},set:function(t){this._cullFaceType=t,this._cullFace&&(t===Ve?this._side=Xe:t===Xe&&(this._side=Ve))}},_side:Xe,side:{get:function(){return this._side},set:function(t){this._side!==t&&(this._side=t,t===je?this._cullFace=!1:(this._cullFace=!0,t===Xe?this._cullFaceType=Ve:t===Ve&&(this._cullFaceType=Xe)))}},blend:!1,blendEquation:ze,blendEquationAlpha:ze,blendSrc:We,blendDst:ke,blendSrcAlpha:We,blendDstAlpha:ke,stencilTest:!1,stencilMask:255,stencilFunc:Ke,stencilFuncRef:1,stencilFuncMask:255,stencilOpFail:Qe,stencilOpZFail:Qe,stencilOpZPass:Qe,isDirty:!1,transparency:1,_transparent:!1,transparent:{get:function(){return this._transparent},set:function(t){this._transparent!==t&&(this._transparent=t,t?this.setDefaultTransparentBlend():(this.blend=!1,this.depthMask=!0))}},setDefaultTransparentBlend:function(){this.blend=!0,this.depthMask=!1,this.premultiplyAlpha?(this.blendSrc=We,this.blendDst=qe,this.blendSrcAlpha=We,this.blendDstAlpha=qe):(this.blendSrc=Ye,this.blendDst=qe,this.blendSrcAlpha=Ye,this.blendDstAlpha=qe)},alphaCutoff:0,useHDR:!1,exposure:1,needBasicUnifroms:!0,needBasicAttributes:!0,constructor:function(t){this.id=d.a.generateUUID(this.className),this.uniforms={},this.attributes={},Object.assign(this,t),this.needBasicAttributes&&this.addBasicAttributes(),this.needBasicUnifroms&&this.addBasicUniforms()},addBasicAttributes:function(){var t=this.attributes;this._copyProps(t,{a_position:"POSITION",a_normal:"NORMAL",a_tangent:"TANGENT",a_texcoord0:"TEXCOORD_0",a_texcoord1:"TEXCOORD_1",a_color:"COLOR_0",a_skinIndices:"SKININDICES",a_skinWeights:"SKINWEIGHTS"}),["POSITION","NORMAL","TANGENT"].forEach((function(e){for(var n=e.slice(0,1)+e.slice(1).toLowerCase(),r=0;r<8;r++){var i="a_morph"+n+r;void 0===t[i]&&(t[i]="MORPH"+e+r)}}))},addBasicUniforms:function(){this._copyProps(this.uniforms,{u_modelMatrix:"MODEL",u_viewMatrix:"VIEW",u_projectionMatrix:"PROJECTION",u_modelViewMatrix:"MODELVIEW",u_modelViewProjectionMatrix:"MODELVIEWPROJECTION",u_viewInverseNormalMatrix:"VIEWINVERSEINVERSETRANSPOSE",u_normalMatrix:"MODELVIEWINVERSETRANSPOSE",u_normalWorldMatrix:"MODELINVERSETRANSPOSE",u_cameraPosition:"CAMERAPOSITION",u_rendererSize:"RENDERERSIZE",u_logDepth:"LOGDEPTH",u_ambientLightsColor:"AMBIENTLIGHTSCOLOR",u_directionalLightsColor:"DIRECTIONALLIGHTSCOLOR",u_directionalLightsInfo:"DIRECTIONALLIGHTSINFO",u_directionalLightsShadowMap:"DIRECTIONALLIGHTSSHADOWMAP",u_directionalLightsShadowMapSize:"DIRECTIONALLIGHTSSHADOWMAPSIZE",u_directionalLightsShadowBias:"DIRECTIONALLIGHTSSHADOWBIAS",u_directionalLightSpaceMatrix:"DIRECTIONALLIGHTSPACEMATRIX",u_pointLightsPos:"POINTLIGHTSPOS",u_pointLightsColor:"POINTLIGHTSCOLOR",u_pointLightsInfo:"POINTLIGHTSINFO",u_pointLightsRange:"POINTLIGHTSRANGE",u_pointLightsShadowBias:"POINTLIGHTSSHADOWBIAS",u_pointLightsShadowMap:"POINTLIGHTSSHADOWMAP",u_pointLightSpaceMatrix:"POINTLIGHTSPACEMATRIX",u_pointLightCamera:"POINTLIGHTCAMERA",u_spotLightsPos:"SPOTLIGHTSPOS",u_spotLightsDir:"SPOTLIGHTSDIR",u_spotLightsColor:"SPOTLIGHTSCOLOR",u_spotLightsCutoffs:"SPOTLIGHTSCUTOFFS",u_spotLightsInfo:"SPOTLIGHTSINFO",u_spotLightsRange:"SPOTLIGHTSRANGE",u_spotLightsShadowMap:"SPOTLIGHTSSHADOWMAP",u_spotLightsShadowMapSize:"SPOTLIGHTSSHADOWMAPSIZE",u_spotLightsShadowBias:"SPOTLIGHTSSHADOWBIAS",u_spotLightSpaceMatrix:"SPOTLIGHTSPACEMATRIX",u_areaLightsPos:"AREALIGHTSPOS",u_areaLightsColor:"AREALIGHTSCOLOR",u_areaLightsWidth:"AREALIGHTSWIDTH",u_areaLightsHeight:"AREALIGHTSHEIGHT",u_areaLightsLtcTexture1:"AREALIGHTSLTCTEXTURE1",u_areaLightsLtcTexture2:"AREALIGHTSLTCTEXTURE2",u_jointMat:"JOINTMATRIX",u_jointMatTexture:"JOINTMATRIXTEXTURE",u_jointMatTextureSize:"JOINTMATRIXTEXTURESIZE",u_positionDecodeMat:"POSITIONDECODEMAT",u_normalDecodeMat:"NORMALDECODEMAT",u_uvDecodeMat:"UVDECODEMAT",u_uv1DecodeMat:"UV1DECODEMAT",u_morphWeights:"MORPHWEIGHTS",u_normalMapScale:"NORMALMAPSCALE",u_emission:"EMISSION",u_transparency:"TRANSPARENCY",u_uvMatrix:"UVMATRIX_0",u_uvMatrix1:"UVMATRIX_1",u_fogColor:"FOGCOLOR",u_fogInfo:"FOGINFO",u_alphaCutoff:"ALPHACUTOFF",u_exposure:"EXPOSURE",u_gammaFactor:"GAMMAFACTOR"}),this.addTextureUniforms({u_normalMap:"NORMALMAP",u_parallaxMap:"PARALLAXMAP",u_emission:"EMISSION",u_transparency:"TRANSPARENCY"})},addTextureUniforms:function(t){var e={};for(var n in t){var r=t[n];e[n]=r,e["".concat(n,".texture")]=r,e["".concat(n,".uv")]="".concat(r,"UV")}this._copyProps(this.uniforms,e)},getRenderOption:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.lightType;e["LIGHT_TYPE_".concat(n)]=1,e.SIDE=this.side,"NONE"!==n&&(e.HAS_LIGHT=1),this.premultiplyAlpha&&(e.PREMULTIPLY_ALPHA=1);var r=this._textureOption.reset(e);return e.HAS_LIGHT&&(e.HAS_NORMAL=1,r.add(this.normalMap,"NORMAL_MAP",(function(){1!==t.normalMapScale&&(e.NORMAL_MAP_SCALE=1)}))),r.add(this.parallaxMap,"PARALLAX_MAP"),r.add(this.emission,"EMISSION_MAP"),r.add(this.transparency,"TRANSPARENCY_MAP"),this.ignoreTranparent&&(e.IGNORE_TRANSPARENT=1),this.alphaCutoff>0&&(e.ALPHA_CUTOFF=1),this.useHDR&&(e.USE_HDR=1),this.gammaCorrection&&(e.GAMMA_CORRECTION=1),this.receiveShadows&&(e.RECEIVE_SHADOWS=1),this.castShadows&&(e.CAST_SHADOWS=1),this.uvMatrix&&(e.UV_MATRIX=1),this.uvMatrix1&&(e.UV_MATRIX1=1),this.usePhysicsLight&&(e.USE_PHYSICS_LIGHT=1),this.isDiffuesEnvAndAmbientLightWorkTogether&&(e.IS_DIFFUESENV_AND_AMBIENTLIGHT_WORK_TOGETHER=1),r.update(),e},_textureOption:{uvTypes:null,option:null,reset:function(t){return this.option=t,this.uvTypes={},this},add:function(t,e,n){if(t&&t.isTexture){var r=this.uvTypes,i=this.option,a=t.uv||0;r[a]=1,i[e]=a,t.isCubeTexture&&(i["".concat(e,"_CUBE")]=1),n&&n(t)}return this},update:function(){var t=[0,1],e=this.uvTypes,n=this.option;for(var r in e)-1!==t.indexOf(Number(r))?n["HAS_TEXCOORD".concat(r)]=1:(m.a.warnOnce("Material._textureOption.update(".concat(r,")"),"uv_".concat(r," not support!")),n.HAS_TEXCOORD0=1);return this}},getInstancedUniforms:function(){var t=this._instancedUniforms;if(!this._instancedUniforms){var e=this.uniforms;for(var n in t=this._instancedUniforms=[],e){var r=this.getUniformInfo(n);r.isDependMesh&&!r.notSupportInstanced&&t.push({name:n,info:r})}}return t},getUniformData:function(t,e,n){return this.getUniformInfo(t).get(e,this,n)},getAttributeData:function(t,e,n){return this.getAttributeInfo(t).get(e,this,n)},getUniformInfo:function(t){return this.getInfo("uniforms",t)},getAttributeInfo:function(t){return this.getInfo("attributes",t)},getInfo:function(t,e){var n=this[t][e];return"string"==typeof n&&(n=Ge[n]),n&&n.get||(m.a.warnOnce("material.getInfo-"+e,"Material.getInfo: no this semantic:"+e),n=Je),n},clone:function(){var t=new this.constructor;for(var e in this)"id"!==e&&(t[e]=this[e]);return t},destroyTextures:function(){this.getTextures().forEach((function(t){t.destroy()}))},getTextures:function(){var t=[];for(var e in this){var n=this[e];n&&n.isTexture&&t.push(n)}return t},_copyProps:function(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n])}}),tn=a.a.create({Extends:$e,isBasicMaterial:!0,className:"BasicMaterial",lightType:"BLINN-PHONG",diffuse:null,ambient:null,specular:null,emission:null,specularEnvMap:null,specularEnvMatrix:null,reflectivity:0,refractRatio:0,refractivity:0,shininess:32,usedUniformVectors:11,constructor:function(t){this.diffuse=new v.a(.5,.5,.5),this.specular=new v.a(1,1,1),this.emission=new v.a(0,0,0),tn.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_diffuse:"DIFFUSE",u_specular:"SPECULAR",u_ambient:"AMBIENT",u_shininess:"SHININESS",u_reflectivity:"REFLECTIVITY",u_refractRatio:"REFRACTRATIO",u_refractivity:"REFRACTIVITY",u_specularEnvMap:"SPECULARENVMAP",u_specularEnvMatrix:"SPECULARENVMATRIX"}),this.addTextureUniforms({u_diffuse:"DIFFUSE",u_specular:"SPECULAR",u_ambient:"AMBIENT"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};tn.superclass.getRenderOption.call(this,t);var e=this._textureOption.reset(t),n=this.lightType;"PHONG"!==n&&"BLINN-PHONG"!==n||(t.HAS_SPECULAR=1);var r=this.diffuse;return r&&r.isTexture&&(r.isCubeTexture?t.DIFFUSE_CUBE_MAP=1:e.add(this.diffuse,"DIFFUSE_MAP")),t.HAS_LIGHT&&(e.add(this.specular,"SPECULAR_MAP"),e.add(this.ambient,"AMBIENT_MAP"),e.add(this.specularEnvMap,"SPECULAR_ENV_MAP")),e.update(),t}}),en=tn,nn=P.a.POSITION,rn=P.a.NORMAL,an=P.a.DEPTH,sn=P.a.DISTANCE,on=P.a.NONE,un=a.a.create({Extends:en,isGeometryMaterial:!0,className:"GeometryMaterial",vertexType:nn,lightType:on,writeOriginData:!1,constructor:function(t){un.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_cameraFar:"CAMERAFAR",u_cameraNear:"CAMERANEAR",u_cameraType:"CAMERATYPE"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};switch(un.superclass.getRenderOption.call(this,t),t["VERTEX_TYPE_".concat(this.vertexType)]=1,this.vertexType){case nn:t.HAS_FRAG_POS=1;break;case rn:t.HAS_NORMAL=1;break;case an:break;case sn:t.HAS_FRAG_POS=1}return this.writeOriginData&&(t.WRITE_ORIGIN_DATA=1),t}}),cn=un,hn=a.a.create({Extends:O,isOrthographicCamera:!0,className:"OrthographicCamera",_left:-1,left:{get:function(){return this._left},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._left=t}},_right:1,right:{get:function(){return this._right},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._right=t}},_bottom:-1,bottom:{get:function(){return this._bottom},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._bottom=t}},_top:1,top:{get:function(){return this._top},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._top=t}},_near:.1,near:{get:function(){return this._near},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._near=t}},_far:1,far:{get:function(){return this._far},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._far=t}},constructor:function(t){hn.superclass.constructor.call(this,t),this.updateProjectionMatrix()},updateProjectionMatrix:function(){this.projectionMatrix.ortho(this.left,this.right,this.bottom,this.top,this.near,this.far)},getGeometry:function(t){if(t||!this._geometry||this._isGeometryDirty){this._isGeometryDirty=!1;var e=new Z,n=[this.left,this.bottom,-this.near],r=[this.right,this.bottom,-this.near],i=[this.right,this.top,-this.near],a=[this.left,this.top,-this.near],s=[this.left,this.bottom,-this.far],o=[this.right,this.bottom,-this.far],u=[this.right,this.top,-this.far],c=[this.left,this.top,-this.far];e.addRect(s,o,u,c),e.addRect(o,r,i,u),e.addRect(r,n,a,i),e.addRect(n,s,c,a),e.addRect(c,u,i,a),e.addRect(n,r,o,s),this._geometry=e}return this._geometry}}),fn=hn,ln=P.a.DEPTH,dn=P.a.BACK,mn=null,_n=new v.a(1,1,1),pn=new o.a,gn=function(t){return t.material.castShadows},vn=a.a.create({isLightShadow:!0,className:"LightShadow",light:null,renderer:null,framebuffer:null,camera:null,width:1024,height:1024,maxBias:.05,minBias:.005,cameraInfo:null,debug:!1,constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},createFramebuffer:function(){this.framebuffer||(this.framebuffer=new ce(this.renderer,{width:this.width,height:this.height}),this.debug&&this.showShadowMap())},updateLightCamera:function(t){this.light.isDirectionalLight?this.updateDirectionalLightCamera(t):this.light.isSpotLight&&this.updateSpotLightCamera(t)},updateDirectionalLightCamera:function(t){var e=this.light;if(this.camera.lookAt(e.direction),this.cameraInfo)this.updateCustumCamera(this.cameraInfo);else{var n=t.getGeometry();if(n){this.camera.updateViewMatrix(),pn.multiply(this.camera.viewMatrix,t.worldMatrix);var r=n.getBounds(pn);this.camera.near=-r.zMax,this.camera.far=-r.zMin,this.camera.left=r.xMin,this.camera.right=r.xMax,this.camera.bottom=r.yMin,this.camera.top=r.yMax}}this.camera.updateViewMatrix()},updateCustumCamera:function(t){for(var e in t)this.camera[e]=t[e]},updateSpotLightCamera:function(t){var e=this.light;this.camera.lookAt(e.direction),this.cameraInfo?this.updateCustumCamera(this.cameraInfo):(this.camera.fov=2*e.outerCutoff,this.camera.near=.01,this.camera.far=t.far,this.camera.aspect=1),this.camera.updateViewMatrix()},createCamera:function(t){this.camera||(this.light.isDirectionalLight?this.camera=new fn:this.light.isSpotLight&&(this.camera=new Q),this.camera.addTo(this.light)),(this.light.isDirty||this._cameraMatrixVersion!==t.matrixVersion)&&(this.updateLightCamera(t),this._cameraMatrixVersion=t.matrixVersion,this.light.isDirty=!1)},createShadowMap:function(t){this.createFramebuffer(),this.createCamera(t);var e=this.renderer,n=this.framebuffer,r=this.camera;mn||(mn=new cn({vertexType:ln,side:dn,writeOriginData:!0})),n.bind(),e.state.viewport(0,0,this.width,this.height),e.clear(_n),r.updateViewProjectionMatrix(),Ge.setCamera(r),e.forceMaterial=mn,this.renderShadowScene(e),delete e.forceMaterial,n.unbind(),Ge.setCamera(t),e.viewport()},renderShadowScene:function(t){t.renderList.traverse((function(e){gn(e)&&t.renderMesh(e)}),(function(e){t.renderInstancedMeshes(e.filter((function(t){return gn(t)})))}))},showShadowMap:function(){var t=this;this.renderer.on("afterRender",(function(){t.framebuffer.render(0,.7,.3,.3)}))}}),En=P.a.DISTANCE,Tn=P.a.BACK,Mn=P.a.TEXTURE_CUBE_MAP,An=P.a.TEXTURE0,Ln=P.a.TEXTURE_CUBE_MAP_POSITIVE_X,In=P.a.NEAREST,On=P.a.FRAMEBUFFER,Sn=P.a.FRAMEBUFFER_COMPLETE,Rn=null,yn=new v.a(0,0,0,0),Nn=new c.a,xn=[[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,-1,0,0,-1,0,0,0,1,0,0,-1,0,-1,0,0,-1,0]],Cn=function(t,e){if(t.material.castShadows){if(!t.frustumTest)return!0;if(e.isMeshVisible(t))return!0}return!1},bn=a.a.create({isLightShadow:!0,className:"CubeLightShadow",Extends:vn,light:null,renderer:null,framebuffer:null,camera:null,width:1024,height:1024,maxBias:.05,minBias:.005,debug:!1,constructor:function(t){bn.superclass.constructor.call(this,t)},createFramebuffer:function(){if(!this.framebuffer){this.framebuffer=new ce(this.renderer,{target:Mn,width:1024,height:1024,createTexture:function(){var t=this.state.gl,e=new pe({image:[null,null,null,null,null,null],type:this.type,format:this.format,internalFormat:this.internalFormat,magFilter:In,minFilter:In,width:1024,height:1024});return t.checkFramebufferStatus(On)!==Sn&&m.a.warn("Framebuffer is not complete",t.checkFramebufferStatus(On)),e},bindTexture:function(t){t=t||0;var e=this.state,n=e.gl,r=this.texture.getGLTexture(e);e.activeTexture(An+et.MAX_TEXTURE_INDEX),e.bindTexture(this.target,r),n.framebufferTexture2D(On,this.attachment,Ln+t,r,0)}})}},updateLightCamera:function(t){this.camera.fov=90,this.camera.near=t.near,this.camera.far=t.far,this.camera.aspect=1,this.camera.updateViewMatrix()},createCamera:function(t){this.camera||(this.camera=new Q,this.updateLightCamera(t))},createShadowMap:function(t){this.createFramebuffer(),this.createCamera(t);var e=this.renderer,n=this.framebuffer,r=this.camera;Rn||(Rn=new cn({vertexType:En,side:Tn,writeOriginData:!1})),n.bind(),e.state.viewport(0,0,n.width,n.height),this.light.worldMatrix.getTranslation(r.position);for(var i=0;i<6;i++)n.bindTexture(i),Nn.fromArray(xn[0],3*i).add(r.position),r.up.fromArray(xn[1],3*i),r.lookAt(Nn),r.updateViewProjectionMatrix(),e.clear(yn),Ge.setCamera(r),e.forceMaterial=Rn,this.renderShadowScene(e);r.matrix.identity(),r.updateViewProjectionMatrix(),delete e.forceMaterial,n.unbind(),Ge.setCamera(t),e.viewport()},renderShadowScene:function(t){var e=t.renderList,n=this.camera;e.traverse((function(e){Cn(e,n)&&t.renderMesh(e)}),(function(e){var r=e.filter((function(t){return Cn(t,n)}));t.renderInstancedMeshes(r)}))}}),Pn=bn,wn=a.a.create({Extends:M,isPointLight:!0,className:"PointLight",constructor:function(t){wn.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new Pn({light:this,renderer:t}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))}}),Hn=wn,Dn=new o.a,Fn=new c.a,Un=a.a.create({Extends:M,isDirectionalLight:!0,className:"DirectionalLight",constructor:function(t){this.direction=new c.a(0,0,1),Un.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new vn({light:this,renderer:t,width:this.shadow.width||t.width,height:this.shadow.height||t.height,debug:this.shadow.debug,cameraInfo:this.shadow.cameraInfo}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))},getWorldDirection:function(){return Fn.copy(this.direction).transformDirection(this.worldMatrix).normalize(),Fn},getViewDirection:function(t){var e=t.getModelViewMatrix(this,Dn);return Fn.copy(this.direction).transformDirection(e).normalize(),Fn}}),Gn=Un,Bn=new o.a,Vn=new c.a,Xn=a.a.create({Extends:M,isSpotLight:!0,className:"SpotLight",_cutoffCos:.9763,_cutoff:12.5,cutoff:{get:function(){return this._cutoff},set:function(t){this._cutoff=t,this._cutoffCos=Math.cos(d.a.degToRad(t))}},_outerCutoffCos:.9537,_outerCutoff:17.5,outerCutoff:{get:function(){return this._outerCutoff},set:function(t){this._outerCutoff=t,this._outerCutoffCos=Math.cos(d.a.degToRad(t))}},constructor:function(t){this.direction=new c.a(0,0,1),Xn.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new vn({light:this,renderer:t,width:this.shadow.width||t.width,height:this.shadow.height||t.height,debug:this.shadow.debug,cameraInfo:this.shadow.cameraInfo}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))},getWorldDirection:function(){return Vn.copy(this.direction).transformDirection(this.worldMatrix).normalize(),Vn},getViewDirection:function(t){var e=t.getModelViewMatrix(this,Bn);return Vn.copy(this.direction).transformDirection(e).normalize(),Vn}}),jn=Xn,kn=a.a.create({Extends:$e,isShaderMaterial:!0,className:"ShaderMaterial",vs:"",fs:"",useHeaderCache:!1,constructor:function(t){kn.superclass.constructor.call(this,t)},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(kn.superclass.getRenderOption.call(this,t),this.getCustomRenderOption){var e=this.getCustomRenderOption({});for(var n in e)t["HILO_CUSTUM_OPTION_".concat(n)]=e[n]}return t},getCustomRenderOption:null}),zn=kn,Wn=n(15),Yn=n.n(Wn),qn=a.a.create({Extends:Z,isMorphGeometry:!0,className:"MorphGeometry",isStatic:!1,weights:[],targets:null,constructor:function(t){qn.superclass.constructor.call(this,t),this.weights=this.weights||[]},update:function(t,e){this.weights=t,this._originalMorphIndices=e},clone:function(){return Z.prototype.clone.call(this,{targets:this.targets,weights:this.weights})},getRenderOption:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return qn.superclass.getRenderOption.call(this,e),this.targets&&(this._maxMorphTargetCount||(this._maxMorphTargetCount=Math.floor(8/Object.keys(this.targets).length)),Object(i.each)(this.targets,(function(n,r){e.MORPH_TARGET_COUNT=Math.min(n.length,t._maxMorphTargetCount),"vertices"===r?e.MORPH_HAS_POSITION=1:"normals"===r?e.MORPH_HAS_NORMAL=1:"tangents"===r&&(e.MORPH_HAS_TANGENT=1)}))),e}}),Zn=qn,Kn={POSITION:{name:"vertices",decodeMatName:"positionDecodeMat"},TEXCOORD_0:{name:"uvs",decodeMatName:"uvDecodeMat"},TEXCOORD_1:{name:"uvs1",decodeMatName:"uv1DecodeMat"},NORMAL:{name:"normals",decodeMatName:"normalDecodeMat"},JOINT:{name:"skinIndices"},JOINTS_0:{name:"skinIndices"},WEIGHT:{name:"skinWeights"},WEIGHTS_0:{name:"skinWeights"},TANGENT:{name:"tangents"},COLOR_0:{name:"colors"}},Qn={Geometry:Z,GeometryData:b};var Jn={_decodeTotalTime:0,wasmURL:"",workerURL:"",useWASM:!0,useWebWorker:!0,useAuto:!0,init:function(){return Jn.useAuto?Yn.a.initWASM(Jn.wasmURL,Jn.memPages):Jn.useWebWorker?Yn.a.initWorker(Jn.workerURL):Jn.useWASM?Yn.a.initWASM(Jn.wasmURL,Jn.memPages):Promise.resolve()},parse:function(t,e,n,r){var i=Date.now(),a=e.bufferViews[t.bufferView],s=Jn.wasmURL,o=Jn.workerURL,u=Jn.useAuto,c=Jn.useWASM,h=Jn.useWebWorker,f=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);function l(e){Jn._decodeTotalTime+=Date.now()-i;var n=e.toHilo3dGeometry(Qn,r.primitive._geometry);return t.targets&&(n=function(t,e,n){if(!n.isMorphGeometry){var r=new Zn;for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&"id"!==i&&(r[i]=n[i]);r.targets={},n=r}for(var a=n.targets,s=0;s<t.targets.length;s++){var o=t.targets[s];for(var u in o)if(u in Kn){var c=o[u],h=Kn[u].name;a[h]||(a[h]=[]);var f=e.attrs[c];a[h].push(new b(f.data,f.itemCount))}}return t.weights?n.weights=t.weights:n.weights=new Float32Array(t.targets.length),n}(t,e,n)),n}return u?Yn.a.decompress(f,s,o).then(l):h?Yn.a.decompressWithWorker(f,c,s,o).then(l):l(c?Yn.a.decompressWithWASM(f,s):Yn.a.decompressWithJS(f))},freeMemory:function(){Yn.a.destory()}},$n=Jn,tr=P.a.SAMPLER_2D,er={unQuantizeData:function(t,e){if(!e)return t;var n=Math.sqrt(e.length),r=n-1,i=new Float32Array(t.length),a=[];return t.traverse((function(t,s){t.toArray?t.toArray(a):a[0]=t;for(var o=s*r,u=0;u<n;u++){i[o+u]=0;for(var c=0;c<n;c++){var h=c===r?1:a[c];i[o+u]+=e[c*n+u]*h}}})),t.data=i,t.stride=0,t.offset=0,t},parse:function(t,e,n,r){var i=t.decodeMatrix;return r.isDecode?n=er.unQuantizeData(n,i):n.decodeMat=i,n}},nr={parseOnEnd:function(t,e,n){if(!n.anim||e.isMultiAnim)return n;for(var r in t){var i=t[r];n.anim.addClip(r,i[0],i[1])}return n}},rr=nr,ir={parse:function(t,e,n){return t.center=t.max.map((function(e,n){return(e+t.min[n])/2})),t.width=t.max[0]-t.min[0],t.height=t.max[1]-t.min[1],t.depth=t.max[2]-t.min[2],t.size=Math.sqrt(Math.pow(t.width,2)+Math.pow(t.height,2)+Math.pow(t.depth,2)),n.bounds=t,n}},ar={getUsedTextureNameMap:function(t,e){t.diffuseTexture&&(e[t.diffuseTexture.index]=!0),t.specularGlossinessTexture&&(e[t.specularGlossinessTexture.index]=!0)},parse:function(t,e,n){return t.diffuseFactor&&n.baseColor.fromArray(t.diffuseFactor),t.diffuseTexture&&(n.baseColorMap=e.getTexture(t.diffuseTexture)),t.specularFactor&&(n.specular.fromArray(t.specularFactor),n.specular.a=1),"glossinessFactor"in t&&(n.glossiness=t.glossinessFactor),t.specularGlossinessTexture&&(n.specularGlossinessMap=e.getTexture(t.specularGlossinessTexture)),n.isSpecularGlossiness=!0,n}},sr={getUsedTextureNameMap:function(t,e){t.clearcoatTexture&&(e[t.clearcoatTexture.index]=!0),t.clearcoatRoughnessTexture&&(e[t.clearcoatRoughnessTexture.index]=!0),t.clearcoatNormalTexture&&(e[t.clearcoatNormalTexture.index]=!0)},parse:function(t,e,n){return t.clearcoatFactor&&(n.clearcoatFactor=t.clearcoatFactor),t.clearcoatTexture&&(n.clearcoatMap=e.getTexture(t.clearcoatTexture)),t.clearcoatRoughnessFactor&&(n.clearcoatRoughnessFactor=t.clearcoatRoughnessFactor),t.clearcoatRoughnessTexture&&(n.clearcoatRoughnessMap=e.getTexture(t.clearcoatRoughnessTexture)),t.clearcoatNormalTexture&&(n.clearcoatNormalMap=e.getTexture(t.clearcoatNormalTexture)),n}},or={parse:function(t,e,n){if(!e.isUseExtension(e.json,"KHR_lights_punctual")||!e.json.extensions.KHR_lights_punctual.lights)return n;var r,i=e.json.extensions.KHR_lights_punctual.lights[t.light];if(!i)return n;var a=new v.a(1,1,1,1);i.color&&(a.r=i.color[0],a.g=i.color[1],a.b=i.color[2]);var s=void 0!==i.intensity?i.intensity:1,o=i.name||"",u=i.spot||{},c=void 0!==u.innerConeAngle?d.a.radToDeg(u.innerConeAngle):0,h=void 0!==u.outerConeAngle?d.a.radToDeg(u.outerConeAngle):45,f=i.range||0;switch(i.type){case"directional":(r=new Gn({color:a,amount:s,name:o,range:f})).direction.set(0,0,-1);break;case"point":r=new Hn({color:a,amount:s,name:o,range:f});break;case"spot":(r=new jn({color:a,amount:s,name:o,range:f,cutoff:c,outerCutoff:h})).direction.set(0,0,-1);break;default:return n}return r&&(n.addChild(r),e.lights.push(r)),n}},ur={init:function(t,e){var n=[],r=(e.json.extensions||{}).KHR_techniques_webgl||{},a=r.programs||[],s=r.shaders||[],o=r.techniques||[];return e.shaders={},s.forEach((function(r,a){var s=i.getRelativePath(e.src,r.uri);e.preHandlerShaderURI&&(s=e.preHandlerShaderURI(s,a,r)),n.push(t.loadRes(s).then((function(t){e.shaders[a]=t})))})),e.programs={},a.forEach((function(t,n){e.programs[n]=Object.assign({},t)})),e.techniques={},o.forEach((function(t,n){var r=(e.techniques[n]=Object.assign({},t)).textureInfos={},i=t.uniforms||{};for(var a in i){var s=i[a];s.type===tr&&(r[a]=s.value||{})}})),Promise.all(n)},getUsedTextureNameMap:function(t,e,n){var r=n.techniques[t.technique],i=t.values||{};if(r){var a=r.textureInfos;for(var s in a){var o=void 0;i[s]&&void 0!==i[s].index?o=i[s].index:void 0!==a[s].index&&(o=a[s].index),void 0!==o&&(e[o]=!0)}}},parse:function(t,e,n){var r=e.textures||[],i=e.techniques[t.technique];if(!i)return n;var a=e.programs[i.program];if(!a)return n;var s=e.shaders[a.fragmentShader],o=e.shaders[a.vertexShader],u=i.uniforms||{},c=i.attributes||{},h=t.values||{},f={},l={},d=function(t){var n=u[t]||{},i=h[t];void 0===i&&(i=n.value);var a=void 0;if(void 0!==i)if(n.type===tr){var s=i.index||0;a={get:function(t,e,n){return Ge.handlerTexture(r[s],n.textureIndex)}}}else a={get:function(){return i}};else if(n.semantic&&Ge[n.semantic]){var o,c=Ge[n.semantic],f=n.node;a=void 0!==f?{get:function(t,n,r){return void 0===o&&(o=e.node.getChildByFn((function(t){return t.animationId===f}))||t),c.get(o,n,r)}}:n.semantic}l[t]=a};for(var m in u)d(m);for(var _ in c){var p=c[_]||{};p.semantic&&(f[_]=p.semantic)}var g=new zn({needBasicUnifroms:!1,needBasicAttributes:!1,useHeaderCache:!0,premultiplyAlpha:!1,vs:o,fs:s,attributes:f,uniforms:l});return void 0!==t.premultiplyAlpha&&(g.premultiplyAlpha=t.premultiplyAlpha),t.defines&&(g.getCustomRenderOption=function(){return t.defines}),void 0!==a.name&&(g.shaderName=a.name,g.shaderCacheId="KHR_techniques_webgl_".concat(a.name)),g}},cr=new Float32Array(2),hr=a.a.create({isFog:!0,className:"Fog",mode:"LINEAR",start:5,end:10,density:.1,constructor:function(t){this.id=d.a.generateUUID(this.className),this.color=new v.a(1,1,1,1),Object.assign(this,t)},getInfo:function(){return"LINEAR"===this.mode?(cr[0]=this.start,cr[1]=this.end,cr):this.density},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t["FOG_".concat(this.mode)]=1,t}}),fr=n(16),lr=new fr.a,dr=new o.a,mr=a.a.create({Extends:g,isMesh:!0,className:"Mesh",geometry:null,material:null,useInstanced:!1,frustumTest:!0,constructor:function(t){mr.superclass.constructor.call(this,t)},clone:function(t){var e=g.prototype.clone.call(this,t);return Object.assign(e,{geometry:this.geometry,material:this.material}),e},raycast:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.visible)return null;var n=this.geometry,r=this.material,i=this.worldMatrix;if(n&&r){dr.invert(i),lr.copy(t),lr.transformMat4(dr);var a=n.raycast(lr,r.side,e);if(a)return a.forEach((function(t){t.transformMat4(i)})),a}return null},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.geometry.getRenderOption(t),t},isDestroyed:{get:function(){return this._isDestroyed}},destroy:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this._isDestroyed)return this;this.removeFromParent();var n=t.resourceManager;return n.destroyMesh(this),this.material&&e&&this.material.destroyTextures(),this.off(),this.geometry=null,this.material=null,this._isDestroyed=!0,this}}),_r=mr,pr=new o.a,gr=new o.a,vr=a.a.create({Extends:_r,isSkinedMesh:!0,className:"SkinedMesh",useInstanced:!1,jointMatTexture:null,frustumTest:!1,skeleton:null,constructor:function(t){vr.superclass.constructor.call(this,t)},getJointMat:function(){var t=this;if(this.skeleton&&!(this.skeleton.jointCount<=0)){var e=this.skeleton.jointNodeList,n=this.skeleton.inverseBindMatrices,r=16*this.skeleton.jointCount;return this.jointMat&&this.jointMat.length===r||(this.jointMat=new Float32Array(r)),this.clonedFrom?gr.invert(this.clonedFrom.worldMatrix):gr.invert(this.worldMatrix),e.forEach((function(e,r){pr.copy(gr),pr.multiply(e.worldMatrix),pr.multiply(n[r]),pr.toArray(t.jointMat,16*r)})),this.jointMat}},resetJointNamesByNodeName:function(t){this.skeleton.resetJointNamesByNodeName(t)},resetSkinIndices:function(t){var e=this.skeleton;if(e){var n=this.geometry,r=n.skinIndices;if(r){this.material.isDirty=!0,n.isDirty=!0,r.isDirty=!0;var i=new R.a;r.traverse((function(n,a,s){n.elements.forEach((function(n,r){var a=e.jointNames[n],s=t.jointNames.indexOf(a);s>=0?i.elements[r]=s:m.a.warnOnce("SkinedMesh.resetSkinIndices","SkinedMesh.resetSkinIndices: no jointName found!",a)})),r.setByOffset(s,i)}))}}},initJointMatTexture:function(){if(!this.jointMatTexture){var t=this.getJointMat();this.jointMatTexture=new Le({data:t})}return this.jointMatTexture},updateJointMatTexture:function(){if(this.jointMatTexture){var t=this.getJointMat();this.jointMatTexture.data.set(t,0),this.jointMatTexture.needUpdate=!0}else this.initJointMatTexture()},clone:function(t){var e=_r.prototype.clone.call(this,t);return Object.assign(e,{useInstanced:this.useInstanced,skeleton:this.skeleton.clone()}),e.clonedFrom=this,e},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};vr.superclass.getRenderOption.call(this,t);var e=this.skeleton.jointCount;if(e&&(t.JOINT_COUNT=e,et.VERTEX_TEXTURE_FLOAT)){var n=(et.MAX_VERTEX_UNIFORM_VECTORS-22)/4;e>n&&(t.JOINT_MAT_MAP=1)}return t}}),Er=vr,Tr=a.a.create({isSkeleton:!0,className:"Skeleton",userData:null,constructor:function(t){this.id=d.a.generateUUID(this.className),this.jointNodeList=[],this.jointNames=[],this.inverseBindMatrices=[],Object.assign(this,t)},jointCount:{get:function(){return this.jointNodeList.length}},_rootNode:null,rootNode:{get:function(){return this._rootNode},set:function(t){this._rootNode=t,t&&this._initJointNodeList()}},_initJointNodeList:function(){var t={};this.rootNode.traverse((function(e){t[e.jointName]=e})),this.jointNodeList=this.jointNames.map((function(e){return t[e]}))},resetJointNamesByNodeName:function(t){var e=this.jointNames;this.jointNodeList.forEach((function(n,r){var i=t.rootNode.getChildByName(n.name);i&&(e[r]=i.jointName)}))},clone:function(t){var e=new Tr;return e.copy(this,t),e},copy:function(t,e){return this.inverseBindMatrices=t.inverseBindMatrices,this.jointNames=t.jointNames.slice(),void 0===e&&(e=t.rootNode),this.rootNode=e,this}}),Mr=Tr,Ar="1.16.2",Lr=a.a.create({className:"RenderInfo",isRenderInfo:!0,constructor:function(){this.reset()},addFaceCount:function(t){this._currentFaceCount+=t},addDrawCount:function(t){this._currentDrawCount+=t},reset:function(){this.faceCount=Math.floor(this._currentFaceCount),this.drawCount=Math.floor(this._currentDrawCount),this._currentFaceCount=0,this._currentDrawCount=0}}),Ir=new c.a,Or=function(t,e){var n=t.material.renderOrder,r=e.material.renderOrder;if(n!==r)return n-r;var i=t.material._shaderNumId||0,a=e.material._shaderNumId||0;return i!==a?i-a:t._sortRenderZ-e._sortRenderZ},Sr=function(t,e){var n=t.material.renderOrder,r=e.material.renderOrder;return n!==r?n-r:e._sortRenderZ-t._sortRenderZ},Rr=a.a.create({className:"RenderList",isRenderList:!0,useInstanced:!1,constructor:function(){this.opaqueList=[],this.transparentList=[],this.instancedDict={}},reset:function(){this.opaqueList.length=0,this.transparentList.length=0,this.instancedDict={}},traverse:function(t,e){this.opaqueList.forEach((function(e){t(e)}));var n=this.instancedDict;for(var r in n){var i=n[r];i.length>2&&e?e(i):i.forEach((function(e){t(e)}))}this.transparentList.forEach((function(e){t(e)}))},sort:function(){this.transparentList.sort(Sr),this.opaqueList.sort(Or)},addMesh:function(t,e){var n=t.material,r=t.geometry;if(n&&r){if(t.frustumTest&&!e.isMeshVisible(t))return;if(this.useInstanced&&t.useInstanced){var i=this.instancedDict,a=n.id+"_"+r.id,s=i[a];i[a]||(s=i[a]=[]),s.push(t)}else t.worldMatrix.getTranslation(Ir),Ir.transformMat4(e.viewProjectionMatrix),t._sortRenderZ=Ir.z,n.transparent?this.transparentList.push(t):this.opaqueList.push(t)}else m.a.warnOnce("RenderList.addMesh(".concat(t.id,")"),"Mesh must have material and geometry",t)}}),yr=a.a.create({className:"WebGLState",isWebGLState:!0,systemFramebuffer:null,constructor:function(t){this.gl=t,this.reset()},reset:function(){this._dict={},this.activeTextureIndex=null,this.textureUnitDict={},this.currentFramebuffer=null,this.preFramebuffer=null,this._pixelStorei={}},enable:function(t){!0!==this._dict[t]&&(this._dict[t]=!0,this.gl.enable(t))},disable:function(t){!1!==this._dict[t]&&(this._dict[t]=!1,this.gl.disable(t))},bindFramebuffer:function(t,e){this.currentFramebuffer!==e&&(this.preFramebuffer=this.currentFramebuffer,this.currentFramebuffer=e,this.gl.bindFramebuffer(t,e))},bindSystemFramebuffer:function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,this.systemFramebuffer)},useProgram:function(t){this.set1("useProgram",t)},depthFunc:function(t){this.set1("depthFunc",t)},depthMask:function(t){this.set1("depthMask",t)},clear:function(t){this.gl.clear(t)},depthRange:function(t,e){this.set2("depthRange",t,e)},stencilFunc:function(t,e,n){this.set3("stencilFunc",t,e,n)},stencilMask:function(t){this.set1("stencilMask",t)},stencilOp:function(t,e,n){this.set3("stencilOp",t,e,n)},colorMask:function(t,e,n,r){this.set4("colorMask",t,e,n,r)},cullFace:function(t){this.set1("cullFace",t)},frontFace:function(t){this.set1("frontFace",t)},blendFuncSeparate:function(t,e,n,r){this.set4("blendFuncSeparate",t,e,n,r)},blendEquationSeparate:function(t,e){this.set2("blendEquationSeparate",t,e)},pixelStorei:function(t,e){this._pixelStorei[t]!==e&&(this._pixelStorei[t]=e,this.gl.pixelStorei(t,e))},viewport:function(t,e,n,r){this.set4("viewport",t,e,n,r)},activeTexture:function(t){this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},bindTexture:function(t,e){var n=this.getActiveTextureUnit();n[t]!==e&&(n[t]=e,this.gl.bindTexture(t,e))},getActiveTextureUnit:function(){var t=this.textureUnitDict[this.activeTextureIndex];return t||(t=this.textureUnitDict[this.activeTextureIndex]={}),t},set1:function(t,e){this._dict[t]!==e&&(this._dict[t]=e,this.gl[t](e))},set2:function(t,e,n){var r=this._dict[t];r||(r=this._dict[t]=[]),r[0]===e&&r[1]===n||(r[0]=e,r[1]=n,this.gl[t](e,n))},set3:function(t,e,n,r){var i=this._dict[t];i||(i=this._dict[t]=[]),i[0]===e&&i[1]===n&&i[2]===r||(i[0]=e,i[1]=n,i[2]=r,this.gl[t](e,n,r))},set4:function(t,e,n,r,i){var a=this._dict[t];a||(a=this._dict[t]=[]),a[0]===e&&a[1]===n&&a[2]===r&&a[3]===i||(a[0]=e,a[1]=n,a[2]=r,a[3]=i,this.gl[t](e,n,r,i))},get:function(t){return this._dict[t]}}),Nr=a.a.create({Mixes:s.a,className:"WebGLResourceManager",isWebGLResourceManager:!0,hasNeedDestroyResource:!1,constructor:function(t){this._needDestroyResources=[],Object.assign(this,t)},destroyMesh:function(t){var e=this;this.getMeshResources(t).forEach((function(t){e.destroyIfNoRef(t)})),t._vao=t._program=t._shader=null},getMeshResources:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t._shader&&e.push(t._shader),t._vao&&(e.push(t._vao),t._vao.getResources(e)),t._program&&e.push(t._program),e},destroyIfNoRef:function(t){var e=this._needDestroyResources;return t&&e.indexOf(t)<0&&e.push(t),this},getUsedResources:function(t){var e=this,n=[];return t&&t.traverse((function(t){t.isMesh&&!t.isDestroyed&&e.getMeshResources(t,n)})),n},destroyUnsuedResource:function(t){var e=this,n=this._needDestroyResources;if(0===n.length)return this;var r=this.getUsedResources(t);return n.forEach((function(t){r.indexOf(t)<0&&t&&t.destroy&&!t.alwaysUse&&(e.fire("destroyResource",t.id),t.destroy())})),this.reset(),this},reset:function(){return this._needDestroyResources.length=0,this}}),xr=new o.a,Cr=new c.a,br=new Float32Array([0,0,0]),Pr=a.a.create({isLightManager:!0,className:"LightManager",constructor:function(t){this.ambientLights=[],this.directionalLights=[],this.pointLights=[],this.spotLights=[],this.areaLights=[],this.lightInfo={AMBIENT_LIGHTS:0,POINT_LIGHTS:0,DIRECTIONAL_LIGHTS:0,SPOT_LIGHTS:0,AREA_LIGHTS:0,uid:0},Object.assign(this,t)},getRenderOption:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object(i.each)(this.lightInfo,(function(n,r){if("uid"!==r&&n){e[r]=n;var i=t.getShadowMapCount(r);i&&(e[r+"_SMC"]=i)}})),e},addLight:function(t){var e=null;return t.enabled?(t.isAmbientLight?e=this.ambientLights:t.isDirectionalLight?e=this.directionalLights:t.isPointLight?e=this.pointLights:t.isSpotLight?e=this.spotLights:t.isAreaLight?e=this.areaLights:m.a.warnOnce("LightManager.addLight(".concat(t.id,")"),"Not support this light:",t),e&&(t.shadow?e.unshift(t):e.push(t)),this):this},getDirectionalInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[];this.directionalLights.forEach((function(o,u){var c=3*u;o.getRealColor().toRGBArray(e,c),o.getViewDirection(t).toArray(n,c),o.shadow&&o.lightShadow&&(r.push(o.lightShadow.framebuffer.texture),i.push(o.lightShadow.width),i.push(o.lightShadow.height),s.push(o.lightShadow.minBias,o.lightShadow.maxBias),xr.copy(t.worldMatrix),xr.premultiply(o.lightShadow.camera.viewProjectionMatrix),xr.toArray(a,16*u))}));var o={colors:new Float32Array(e),infos:new Float32Array(n)};return r.length&&(o.shadowMap=r,o.shadowMapSize=new Float32Array(i),o.shadowBias=new Float32Array(s),o.lightSpaceMatrix=new Float32Array(a)),o},getSpotInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[],o=[],u=[],c=[],h=[];this.spotLights.forEach((function(f,l){var d=3*l;f.getRealColor().toRGBArray(e,d),f.toInfoArray(n,d),f.getViewDirection(t).toArray(i,d),h.push(f.range),a.push(f._cutoffCos,f._outerCutoffCos),t.getModelViewMatrix(f,xr),xr.getTranslation(Cr),Cr.toArray(r,d),f.shadow&&f.lightShadow&&(s.push(f.lightShadow.framebuffer.texture),o.push(f.lightShadow.width),o.push(f.lightShadow.height),c.push(f.lightShadow.minBias,f.lightShadow.maxBias),xr.multiply(f.lightShadow.camera.viewProjectionMatrix,t.worldMatrix),xr.toArray(u,16*l))}));var f={colors:new Float32Array(e),infos:new Float32Array(n),poses:new Float32Array(r),dirs:new Float32Array(i),cutoffs:new Float32Array(a),ranges:new Float32Array(h)};return s.length&&(f.shadowMap=s,f.shadowMapSize=new Float32Array(o),f.shadowBias=new Float32Array(c),f.lightSpaceMatrix=new Float32Array(u)),f},getPointInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[],o=[],u=[];this.pointLights.forEach((function(c,h){var f=3*h;c.getRealColor().toRGBArray(e,f),c.toInfoArray(n,f),u.push(c.range),t.getModelViewMatrix(c,xr),xr.getTranslation(Cr),Cr.toArray(r,f),c.shadow&&c.lightShadow&&(i.push(c.lightShadow.framebuffer.texture),s.push(c.lightShadow.minBias,c.lightShadow.maxBias),t.worldMatrix.toArray(a,16*h),o[2*h]=c.lightShadow.camera.near,o[2*h+1]=c.lightShadow.camera.far)}));var c={colors:new Float32Array(e),infos:new Float32Array(n),poses:new Float32Array(r),ranges:new Float32Array(u)};return i.length&&(c.shadowMap=i,c.shadowBias=new Float32Array(s),c.lightSpaceMatrix=new Float32Array(a),c.cameras=new Float32Array(o)),c},getAreaInfo:function(t){var e,n,r=[],i=[],a=[],s=[];return this.areaLights.forEach((function(o,u){var c=3*u;o.getRealColor().toRGBArray(r,c),t.getModelViewMatrix(o,xr),xr.getTranslation(Cr),Cr.toArray(i,c);var h=xr.getRotation();xr.fromQuat(h),Cr.set(.5*o.width,0,0),Cr.transformMat4(xr),Cr.toArray(a,c),Cr.set(0,.5*o.height,0),Cr.transformMat4(xr),Cr.toArray(s,c),e=o.ltcTexture1,n=o.ltcTexture2})),{colors:new Float32Array(r),poses:new Float32Array(i),width:new Float32Array(a),height:new Float32Array(s),ltcTexture1:e,ltcTexture2:n}},getAmbientInfo:function(){return br[0]=br[1]=br[2]=0,this.ambientLights.forEach((function(t){var e=t.getRealColor();br[0]+=e.r,br[1]+=e.g,br[2]+=e.b})),br[0]=Math.min(1,br[0]),br[1]=Math.min(1,br[1]),br[2]=Math.min(1,br[2]),br},updateInfo:function(t){var e=this.lightInfo,n=this.ambientLights,r=this.directionalLights,i=this.pointLights,a=this.spotLights,s=this.areaLights;e.AMBIENT_LIGHTS=n.length,e.POINT_LIGHTS=i.length,e.DIRECTIONAL_LIGHTS=r.length,e.SPOT_LIGHTS=a.length,e.AREA_LIGHTS=s.length;var o=function(t){return!!t.shadow};e.SHADOW_POINT_LIGHTS=i.filter(o).length,e.SHADOW_SPOT_LIGHTS=a.filter(o).length,e.SHADOW_DIRECTIONAL_LIGHTS=r.filter(o).length,e.uid=[e.AMBIENT_LIGHTS,e.POINT_LIGHTS,e.SHADOW_POINT_LIGHTS,e.DIRECTIONAL_LIGHTS,e.SHADOW_DIRECTIONAL_LIGHTS,e.SPOT_LIGHTS,e.SHADOW_SPOT_LIGHTS,e.AREA_LIGHTS].join("_"),this.directionalInfo=this.getDirectionalInfo(t),this.pointInfo=this.getPointInfo(t),this.spotInfo=this.getSpotInfo(t),this.areaInfo=this.getAreaInfo(t),this.ambientInfo=this.getAmbientInfo()},getInfo:function(){return this.lightInfo},reset:function(){this.ambientLights.length=0,this.directionalLights.length=0,this.pointLights.length=0,this.spotLights.length=0,this.areaLights.length=0},getShadowMapCount:function(t){var e=[];"POINT_LIGHTS"===t?e=this.pointLights:"DIRECTIONAL_LIGHTS"===t?e=this.directionalLights:("SPOT_LIGHTS"===t||"AREA_LIGHTS"===t)&&(e=this.spotLights);var n=0;return e.forEach((function(t){n+=t.shadow?1:0})),n},createShadowMap:function(t,e){this.directionalLights.forEach((function(n){n.createShadowMap(t,e)})),this.spotLights.forEach((function(n){n.createShadowMap(t,e)})),this.pointLights.forEach((function(n){n.createShadowMap(t,e)})),this.areaLights.forEach((function(n){n.createShadowMap(t,e)}))}}),wr=P.a.DEPTH_TEST,Hr=P.a.STENCIL_TEST,Dr=P.a.SAMPLE_ALPHA_TO_COVERAGE,Fr=P.a.CULL_FACE,Ur=P.a.FRONT_AND_BACK,Gr=P.a.BLEND,Br=P.a.LINES,Vr=P.a.STATIC_DRAW,Xr=P.a.DYNAMIC_DRAW,jr=a.a.create({Mixes:s.a,className:"WebGLRenderer",isWebGLRenderer:!0,gl:null,width:0,height:0,pixelRatio:1,domElement:null,useInstanced:!1,useVao:!0,alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,failIfMajorPerformanceCaveat:!1,gameMode:!1,useFramebuffer:!1,framebufferOption:{},useLogDepth:!1,vertexPrecision:"highp",fragmentPrecision:"highp",fog:null,offsetX:0,offsetY:0,isInitFailed:!1,_isInit:!1,_isContextLost:!1,constructor:function(t){this.clearColor=new v.a(1,1,1),Object.assign(this,t),this.renderInfo=new Lr,this.renderList=new Rr,this.lightManager=new Pr,this.resourceManager=new Nr},resize:function(t,e,n){if(n||this.width!==t||this.height!==e){var r=this.domElement;this.width=t,this.height=e,r.width=t,r.height=e,this.framebuffer&&this.framebuffer.resize(this.width,this.height,n),this.viewport()}},setOffset:function(t,e){this.offsetX===t&&this.offsetY===e||(this.offsetX=t,this.offsetY=e,this.viewport())},viewport:function(t,e,n,r){var i=this.state,a=this.gl;i&&(void 0===t?t=this.offsetX:this.offsetX=t,void 0===e?e=this.offsetY:this.offsetY=e,void 0===n&&(n=a.drawingBufferWidth),void 0===r&&(r=a.drawingBufferHeight),i.viewport(t,e,n,r))},isInit:{get:function(){return this._isInit&&!this.isInitFailed}},onInit:function(t){var e=this;this._isInit?t(this):this.on("init",(function(){t(e)}),!0)},initContext:function(){if(!this._isInit){this._isInit=!0;try{this._initContext(),this.fire("init")}catch(t){this.isInitFailed=!0,this.fire("initFailed",t)}}},_initContext:function(){var t=this,e={alpha:this.alpha,depth:this.depth,stencil:this.stencil,antialias:this.antialias,premultipliedAlpha:this.premultipliedAlpha,failIfMajorPerformanceCaveat:this.failIfMajorPerformanceCaveat};!0===this.preserveDrawingBuffer&&(e.preserveDrawingBuffer=!0),!0===this.gameMode&&(e.gameMode=!0);var n=this.gl=this.domElement.getContext("webgl",e);n.viewport(0,0,this.width,this.height),Tt.init(n),tt.init(n),et.init(n),dt.init(this),this.state=new yr(n),tt.instanced||(this.useInstanced=!1),this.renderList.useInstanced=this.useInstanced,tt.vao||(this.useVao=!1),this.useFramebuffer&&(this.framebuffer=new ce(this,Object.assign({useVao:this.useVao,width:this.width,height:this.height},this.framebufferOption))),this.domElement.addEventListener("webglcontextlost",(function(e){t._onContextLost(e)}),!1),this.domElement.addEventListener("webglcontextrestored",(function(e){t._onContextRestore(e)}),!1)},_onContextLost:function(t){var e=this.gl;this._isContextLost=!0,t.preventDefault(),Lt.reset(e),dt.reset(e),Qt.reset(e),Nt.reset(e),Ft.reset(e),this.state.reset(e),this._lastMaterial=null,this._lastProgram=null,this.fire("webglContextLost")},_onContextRestore:function(t){var e=this.gl;this._isContextLost=!1,tt.reset(e),ce.reset(e),this.fire("webglContextRestored")},setupDepthTest:function(t){var e=this.state;t.depthTest?(e.enable(wr),e.depthFunc(t.depthFunc),e.depthMask(t.depthMask),e.depthRange(t.depthRange[0],t.depthRange[1])):e.disable(wr)},setupSampleAlphaToCoverage:function(t){var e=this.state;t.sampleAlphaToCoverage?e.enable(Dr):e.disable(Dr)},setupCullFace:function(t){var e=this.state;t.cullFace&&t.cullFaceType!==Ur?(e.enable(Fr),e.cullFace(t.cullFaceType),e.frontFace(t.frontFace)):e.disable(Fr)},setupBlend:function(t){var e=this.state;t.blend?(e.enable(Gr),e.blendFuncSeparate(t.blendSrc,t.blendDst,t.blendSrcAlpha,t.blendDstAlpha),e.blendEquationSeparate(t.blendEquation,t.blendEquationAlpha)):e.disable(Gr)},setupStencil:function(t){if(this.stencil){var e=this.state;t.stencilTest?(e.enable(Hr),e.stencilMask(t.stencilMask),e.stencilFunc(t.stencilFunc,t.stencilFuncRef,t.stencilFuncMask),e.stencilOp(t.stencilOpFail,t.stencilOpZFail,t.stencilOpZPass)):e.disable(Hr)}},setupUniforms:function(t,e,n,r){var i=this.forceMaterial||e.material;for(var a in t.uniforms){var s=i.getUniformInfo(a),o=t.uniforms[a];if(!s.isBlankInfo&&(r||s.isDependMesh&&!n)){var u=s.get(e,i,o);null!=u&&(t[a]=u)}}},setupVao:function(t,e,n){var r=n.geometry,i=r.isStatic;if(t.isDirty||!i||r.isDirty){t.isDirty=!1;var a=this.forceMaterial||n.material,s=a.attributes,o=i?Vr:Xr;for(var u in s){var c=e.attributes[u];if(c){var h=a.getAttributeData(u,n,c);null!=h&&t.addAttribute(h,c,o)}}r.indices&&t.addIndexBuffer(r.indices,o),r.isDirty=!1}r.vertexCount&&(t.vertexCount=r.vertexCount)},setupMaterial:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=this.forceMaterial||e.material;(i.isDirty||this._lastMaterial!==i)&&(this.setupDepthTest(i),this.setupSampleAlphaToCoverage(i),this.setupCullFace(i),this.setupBlend(i),this.setupStencil(i),r=!0),this.setupUniforms(t,e,n,r),i.isDirty=!1,this._lastMaterial=i},setupMesh:function(t,e){var n=this.gl,r=this.state,i=this.lightManager,a=t.geometry,s=this.forceMaterial||t.material,o=dt.getShader(t,s,e,i,this.fog,this.useLogDepth),u=Lt.getProgram(o,r);u.useProgram(),this.setupMaterial(u,t,e,this._lastProgram!==u),this._lastProgram=u,t.material.wireframe&&a.mode!==Br&&a.convertToLinesMode();var c=a.id+u.id,h=Ft.getVao(n,c,{useInstanced:e,useVao:this.useVao,mode:a.mode});return this.setupVao(h,u,t),t._vao=h,t._shader=o,t._program=u,{vao:h,program:u,geometry:a}},addRenderInfo:function(t,e){var n=this.renderInfo;n.addFaceCount(t),n.addDrawCount(e)},render:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.initContext(),!this.isInitFailed&&!this._isContextLost){var r=this.renderList,i=this.renderInfo,a=this.lightManager,s=this.resourceManager,o=this.state;this.fog=t.fog,a.reset(),i.reset(),r.reset(),Ge.init(this,o,e,a,this.fog),t.updateMatrixWorld(),e.updateViewProjectionMatrix(),t.traverse((function(t){return t.visible?(t.isMesh?r.addMesh(t,e):t.isLight&&a.addLight(t),g.TRAVERSE_STOP_NONE):g.TRAVERSE_STOP_CHILDREN})),r.sort(),a.createShadowMap(this,e),a.updateInfo(e),n&&this.fire("beforeRender"),this.useFramebuffer&&this.framebuffer.bind(),this.clear(),n&&this.fire("beforeRenderScene"),this.renderScene(),this.useFramebuffer&&this.renderToScreen(this.framebuffer),n&&this.fire("afterRender"),s.destroyUnsuedResource(t)}},renderScene:function(){var t=this;this.renderList.traverse((function(e){t.renderMesh(e)}),(function(e){t.renderInstancedMeshes(e)})),this._gameModeSumbit()},_gameModeSumbit:function(){var t=this.gl;this.gameMode&&t&&t.submit&&t.submit()},clear:function(t){var e=this.gl,n=this.state;t=t||this.clearColor,this._lastMaterial=null,this._lastProgram=null,e.clearColor(t.r,t.g,t.b,t.a),n.depthMask(!0);var r=e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT;this.stencil&&(n.stencilMask(!0),r|=e.STENCIL_BUFFER_BIT),e.clear(r)},clearDepth:function(){var t=this.gl;this.state.depthMask(!0),t.clear(t.DEPTH_BUFFER_BIT)},clearStencil:function(){var t=this.gl;this.state.stencilMask(!0),t.clear(t.STENCIL_BUFFER_BIT)},renderToScreen:function(t){this.state.bindSystemFramebuffer(),t.render(0,0,1,1,this.clearColor)},renderMesh:function(t){var e=this.setupMesh(t,!1).vao;e.draw(),this.addRenderInfo(e.vertexCount/3,1)},renderInstancedMeshes:function(t){var e=t[0];if(e){var n=this.forceMaterial||e.material,r=this.setupMesh(e,!0),i=r.vao,a=r.program;n.getInstancedUniforms().forEach((function(e){var n=e.name,r=e.info,s=a.attributes[n];s&&i.addInstancedAttribute(s,t,(function(t){return r.get(t)}))})),i.drawInstance(t.length),this.addRenderInfo(i.vertexCount/3*t.length,1)}},renderMultipleMeshes:function(t){var e=this;t.forEach((function(t){e.renderMesh(t)}))},releaseGLResource:function(){var t=this.gl;t&&(Lt.reset(t),dt.reset(t),Nt.reset(t),Ft.reset(t),this.state.reset(t),Qt.reset(t),ce.destroy(t))}}),kr=function(){var t,e=navigator.userAgent,n=document,r=window,i=n.documentElement,a={iphone:/iphone/i.test(e),ipad:/ipad/i.test(e),ipod:/ipod/i.test(e),ios:/iphone|ipad|ipod/i.test(e),android:/android/i.test(e),webkit:/webkit/i.test(e),chrome:/chrome/i.test(e),safari:/safari/i.test(e),firefox:/firefox/i.test(e),ie:/msie/i.test(e),opera:/opera/i.test(e),supportTouch:"ontouchstart"in r,supportCanvas:!!n.createElement("canvas").getContext,supportStorage:void 0,supportOrientation:"orientation"in r||"orientation"in r.screen,supportDeviceMotion:"ondevicemotion"in r};try{localStorage.setItem("hilo","hilo"),localStorage.removeItem("hilo"),a.supportStorage=!0}catch(t){a.supportStorage=!1,m.a.warn("LocalStorage disabled")}t=a.webkit||a.firefox?"webkit":a.opera?"o":a.ie?"ms":"",a.jsVendor=t;var s=a.cssVendor="-"+t+"-",o=n.createElement("div"),u=o.style,c=void 0!==u[t+"Transform"],h=void 0!==u[t+"Perspective"];h&&(o.id="test3d",(u=n.createElement("style")).textContent="@media ("+s+"transform-3d){#test3d{height:3px}}",n.head.appendChild(u),i.appendChild(o),h=3===o.offsetHeight,n.head.removeChild(u),i.removeChild(o)),a.supportTransform=c,a.supportTransform3D=h;var f=a.supportTouch,l=f?"touchstart":"mousedown",d=f?"touchmove":"mousemove",_=f?"touchend":"mouseup";return a.POINTER_START=l,a.POINTER_MOVE=d,a.POINTER_END=_,a}(),zr=a.a.create({Extends:g,isStage:!0,className:"Stage",renderer:null,camera:null,pixelRatio:null,offsetX:0,offsetY:0,width:0,height:0,canvas:null,constructor:function(t){if(t.width||(t.width=window.innerWidth),t.height||(t.height=window.innerHeight),!t.pixelRatio){var e=window.devicePixelRatio||1;e=Math.min(e,1024/Math.max(t.width,t.height),2),e=Math.max(e,1),t.pixelRatio=e}zr.superclass.constructor.call(this,t),this.initRenderer(t),m.a.log("Hilo3d version: ".concat(Ar))},initRenderer:function(t){var e=this.canvas=this.createCanvas(t);this.renderer=new jr(Object.assign(t,{domElement:e})),this.resize(this.width,this.height,this.pixelRatio,!0)},createCanvas:function(t){var e;return e=t.canvas?t.canvas:document.createElement("canvas"),t.container&&t.container.appendChild(e),e},resize:function(t,e,n,r){if(void 0===n&&(n=this.pixelRatio),r||this.width!==t||this.height!==e||this.pixelRatio!==n){this.width=t,this.height=e,this.pixelRatio=n,this.rendererWidth=t*n,this.rendererHeight=e*n;var i=this.canvas;this.renderer.resize(this.rendererWidth,this.rendererHeight,r),i.style.width=this.width+"px",i.style.height=this.height+"px",this.updateDomViewport()}return this},setOffset:function(t,e){if(this.offsetX!==t||this.offsetY!==e){this.offsetX=t,this.offsetY=e;var n=this.pixelRatio;this.renderer.setOffset(t*n,e*n)}return this},viewport:function(t,e,n,r){return this.resize(n,r,this.pixelRatio,!0),this.setOffset(t,e),this},tick:function(t){return this.traverseUpdate(t),this.camera&&this.renderer.render(this,this.camera,!0),this},enableDOMEvent:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.canvas,i=this._domListener||(this._domListener=function(t){e._onDOMEvent(t)});return(t="string"==typeof t?[t]:t).forEach((function(t){n?r.addEventListener(t,i,!1):r.removeEventListener(t,i)})),this},_onDOMEvent:function(t){var e=this.canvas,n=this._eventTarget,r=t.type,i=0===r.indexOf("touch"),a=t;if(i){var s=t.touches,o=t.changedTouches;s&&s.length?a=s[0]:o&&o.length&&(a=o[0])}var u=this.domViewport||this.updateDomViewport(),c=(a.pageX||a.clientX)-u.left,h=(a.pageY||a.clientY)-u.top;t.stageX=c,t.stageY=h,t.stopPropagation=function(){this._stopPropagationed=!0};var f=this.getMeshResultAtPoint(c,h,!0),l=f.mesh;t.hitPoint=f.point;var d="mouseout"===r;if(n&&(n!==l&&(!n.contains||!n.contains(l))||d)){var m=!1;if("touchmove"===r?m="touchout":"mousemove"!==r&&!d&&l||(m="mouseout"),m){var _=Object.assign({},t);_.type=m,_.eventTarget=n,n._fireMouseEvent(_)}t.lastEventTarget=n,this._eventTarget=null}if(l&&l.pointerEnabled&&"mouseout"!==r&&(t.eventTarget=this._eventTarget=l,l._fireMouseEvent(t)),!i){var p=l&&l.pointerEnabled&&l.useHandCursor?"pointer":"";e.style.cursor=p}kr.android&&"touchmove"===r&&t.preventDefault()},updateDomViewport:function(){var t=this.canvas,e=null;return t.parentNode&&(e=this.domViewport=Object(i.getElementRect)(t)),e},getMeshResultAtPoint:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.camera,i=this._ray;i||(i=this._ray=new fr.a),i.fromCamera(r,t,e,this.width,this.height);var a=this.raycast(i,!0,n);if(a)return a[0];this._stageResultAtPoint||(this._stageResultAtPoint={mesh:this,point:new c.a});var s=this._stageResultAtPoint.point;return s.copy(r.unprojectVector(s.set(t,e,0),this.width,this.height)),this._stageResultAtPoint},releaseGLResource:function(){return this.renderer.releaseGLResource(),this},destroy:function(){return zr.superclass.destroy.call(this,this.renderer),this.releaseGLResource(),this.traverse((function(t){t.off(),t.parent=null})),this.children.length=0,this.renderer.off(),this}}),Wr=zr;function Yr(){return+new Date}var qr=a.a.create({constructor:function(t,e,n,r){var i=this;for(var a in i.target=t,i._startTime=0,i._seekTime=0,i._pausedTime=0,i._pausedStartTime=0,i._reverseFlag=1,i._repeatCount=0,3===arguments.length&&(r=n,n=e,e=null),r)i[a]=r[a];i._fromProps=e,i._toProps=n,!r.duration&&r.time&&(i.duration=r.time||0,i.time=0)},target:null,duration:1e3,delay:0,paused:!1,loop:!1,reverse:!1,repeat:0,repeatDelay:0,ease:null,time:0,isStart:!1,isComplete:!1,onStart:null,onUpdate:null,onComplete:null,setProps:function(t,e){var n=this.target,r=t||e,i=this._fromProps={},a=this._toProps={};for(var s in t=t||n,e=e||n,r)a[s]=e[s]||0,n[s]=i[s]=t[s]||0;return this},start:function(){var t=this;return t._startTime=Yr()+t.delay,t._seekTime=0,t._pausedTime=0,t._reverseFlag=1,t._repeatCount=0,t.paused=!1,t.isStart=!1,t.isComplete=!1,qr.add(t),t},stop:function(){return qr.remove(this),this},pause:function(){return this.paused=!0,this._pausedStartTime=Yr(),this},resume:function(){var t=this;return t.paused=!1,t._pausedStartTime&&(t._pausedTime+=Yr()-t._pausedStartTime),t._pausedStartTime=0,t},seek:function(t,e){var n=this,r=Yr();return n._startTime=r,n._seekTime=t,n._pausedTime=0,void 0!==e&&(n.paused=e),n._update(r,!0),qr.add(n),n},link:function(t){var e,n,r=t.delay,i=this._startTime;return"string"==typeof r&&(e=0===r.indexOf("+"),n=0===r.indexOf("-"),r=e||n?Number(r.substr(1))*(e?1:-1):Number(r)),t.delay=r,t._startTime=e||n?i+this.duration+r:i+r,this._next=t,qr.remove(t),t},_render:function(t){var e=this.target,n=this._fromProps;for(var r in n)e[r]=n[r]+(this._toProps[r]-n[r])*t},_update:function(t,e){var n=this;if(n.paused&&!e)return!1;if(n.isComplete)return!0;var r=t-n._startTime-n._pausedTime+n._seekTime;if(r<0)return!1;var i,a=r/n.duration;a<=0?a=0:a>=1&&(a=1);var s=n.ease?n.ease(a):a;n.reverse&&n.isStart&&(n._reverseFlag<0&&(a=1-a,s=1-s),a<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0===n.repeat&&!n.loop?n.isComplete=!0:(n._startTime=Yr(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=r,n._render(s),(i=n.onUpdate)&&i.call(n,s,n),a>=1&&(n.reverse?(n._startTime=Yr(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++<n.repeat?(n._startTime=Yr()+n.repeatDelay,n._pausedTime=0):n.isComplete=!0);var o=n._next;if(o&&o.time<=0){var u=o._startTime;u>0&&u<=t?(o._render(a),o.time=r,qr.add(o)):n.isComplete&&(u<0||u>t)&&o.start()}return!!n.isComplete&&((i=n.onComplete)&&i.call(n,n),!0)},Statics:{_tweens:[],tick:function(){var t,e,n=qr._tweens,r=n.length;for(e=0;e<r;e++)(t=n[e])&&t._update(Yr())&&(n.splice(e,1),e--);return qr},add:function(t){var e=qr._tweens;return-1===e.indexOf(t)&&e.push(t),qr},remove:function(t){var e,n;if(t instanceof Array){for(e=0,n=t.length;e<n;e++)qr.remove(t[e]);return qr}var r=qr._tweens;if(t instanceof qr)(e=r.indexOf(t))>-1&&r.splice(e,1);else for(e=0;e<r.length;e++)r[e].target===t&&(r.splice(e,1),e--);return qr},removeAll:function(){return qr._tweens.length=0,qr},fromTo:function(t,e,n,r){r=r||{};var i,a,s=t instanceof Array;t=s?t:[t];var o=r.stagger,u=[];for(a=0;a<t.length;a++)i=new qr(t[a],e,n,r),o&&(i.delay=(r.delay||0)+(a*o||0)),i.start(),u.push(i);return s?u:i},to:function(t,e,n){return qr.fromTo(t,null,e,n)},from:function(t,e,n){return qr.fromTo(t,e,null,n)}}});function Zr(t,e,n,r,i){return t=t||{},e&&(t.EaseIn=e),n&&(t.EaseOut=n),r&&(t.EaseInOut=r),i&&(t.EaseNone=i),t}var Kr=Zr(null,null,null,null,(function(t){return t})),Qr=Zr(null,(function(t){return t*t}),(function(t){return-t*(t-2)}),(function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)})),Jr=Zr(null,(function(t){return t*t*t}),(function(t){return--t*t*t+1}),(function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)})),$r=Zr(null,(function(t){return t*t*t*t}),(function(t){return-(--t*t*t*t-1)}),(function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)})),ti=Zr(null,(function(t){return t*t*t*t*t}),(function(t){return(t-=1)*t*t*t*t+1}),(function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)})),ei=Math,ni=ei.PI,ri=.5*ni,ii=ei.sin,ai=ei.cos,si=ei.pow,oi=ei.sqrt,ui=Zr(null,(function(t){return 1-ai(t*ri)}),(function(t){return ii(t*ri)}),(function(t){return-.5*(ai(ni*t)-1)})),ci=Zr(null,(function(t){return 0===t?0:si(2,10*(t-1))}),(function(t){return 1===t?1:1-si(2,-10*t)}),(function(t){return 0===t||1===t?t:(t*=2)<1?.5*si(2,10*(t-1)):.5*(2-si(2,-10*(t-1)))})),hi=Zr(null,(function(t){return-(oi(1-t*t)-1)}),(function(t){return oi(1- --t*t)}),(function(t){return(t/=.5)<1?-.5*(oi(1-t*t)-1):.5*(oi(1-(t-=2)*t)+1)})),fi=Zr({a:1,p:.4,s:.1,config:function(t,e){fi.a=t,fi.p=e,fi.s=e/(2*ni)*Math.asin(1/t)||0}},(function(t){return-fi.a*si(2,10*(t-=1))*ii((t-fi.s)*(2*ni)/fi.p)}),(function(t){return fi.a*si(2,-10*t)*ii((t-fi.s)*(2*ni)/fi.p)+1}),(function(t){return(t*=2)<1?fi.a*si(2,10*(t-=1))*ii((t-fi.s)*(2*ni)/fi.p)*-.5:fi.a*si(2,-10*(t-=1))*ii((t-fi.s)*(2*ni)/fi.p)*.5+1})),li=Zr({o:1.70158,s:2.59491,config:function(t){li.o=t,li.s=1.525*t}},(function(t){return t*t*((li.o+1)*t-li.o)}),(function(t){return(t-=1)*t*((li.o+1)*t+li.o)+1}),(function(t){return(t*=2)<1?t*t*((li.s+1)*t-li.s)*.5:.5*((t-=2)*t*((li.s+1)*t+li.s)+2)})),di=Zr(null,(function(t){return 1-di.EaseOut(1-t)}),(function(t){return(t/=1)<.36364?7.5625*t*t:t<.72727?7.5625*(t-=.54545)*t+.75:t<.90909?7.5625*(t-=.81818)*t+.9375:7.5625*(t-=.95455)*t+.984375}),(function(t){return t<.5?.5*di.EaseIn(2*t):.5*di.EaseOut(2*t-1)+.5}));qr.Ease={Linear:Kr,Quad:Qr,Cubic:Jr,Quart:$r,Quint:ti,Sine:ui,Expo:ci,Circ:hi,Elastic:fi,Back:li,Bounce:di};var mi=qr,_i=a.a.create({Extends:Z,isBoxGeometry:!0,className:"BoxGeometry",width:1,height:1,depth:1,widthSegments:1,heightSegments:1,depthSegments:1,constructor:function(t){_i.superclass.constructor.call(this,t),this.isSegments()?this.buildWithSegments():this.build()},buildWithSegments:function(){var t=this.width,e=this.height,n=this.depth,r=this.widthSegments,i=this.heightSegments,a=this.depthSegments,s=i*a*6,o=r*a*6,u=r*i*6,c=2*((i+1)*(a+1)+(r+1)*(a+1)+(r+1)*(i+1)),h=new Float32Array(3*c),f=new Float32Array(3*c),l=new Float32Array(2*c),d=new Uint16Array(2*(s+o+u));this.vertices=new b(h,3),this.normals=new b(f,3),this.uvs=new b(l,2),this.indices=new b(d,1);var m=[0,0];this.buildPlane(m,2,1,0,-1,1,n,e,t/2,a,i),this.buildPlane(m,2,1,0,1,1,n,e,-t/2,a,i),this.buildPlane(m,0,2,1,1,-1,t,n,e/2,r,a),this.buildPlane(m,0,2,1,1,1,t,n,-e/2,r,a),this.buildPlane(m,0,1,2,1,1,t,e,n/2,r,i),this.buildPlane(m,0,1,2,-1,1,t,e,-n/2,r,i)},buildPlane:function(t,e,n,r,i,a,s,o,u,c,h){for(var f=s/c,l=o/h,d=s/2,m=o/2,_=t[0],p=t[1],g=this.vertices.data,v=this.normals.data,E=this.uvs.data,T=this.indices.data,M=0;M<=h;M++)for(var A=(M*l-m)*a,L=0;L<=c;L++){if(g[3*_+e]=(L*f-d)*i,g[3*_+n]=A,g[3*_+r]=u,v[3*_+e]=0,v[3*_+n]=0,v[3*_+r]=u<0?-1:1,E[2*_]=L/c,E[2*_+1]=1-M/h,L<c&&M<h){var I=t[0]+(M+1)*(c+1)+L;T[p++]=I,T[p++]=_,T[p++]=I+1,T[p++]=I+1,T[p++]=_,T[p++]=_+1}_++}t[0]=_,t[1]=p},build:function(){var t=new Float32Array(72),e=new Uint16Array(36);this.vertices=new b(t,3),this.indices=new b(e,1);var n=this.width/2,r=this.height/2,i=this.depth/2,a=[-n,-r,-i],s=[n,-r,-i],o=[n,r,-i],u=[-n,r,-i],c=[-n,-r,i],h=[n,-r,i],f=[n,r,i],l=[-n,r,i];this.addRect(h,s,o,f),this.addRect(a,c,l,u),this.addRect(l,f,o,u),this.addRect(a,s,h,c),this.addRect(c,h,f,l),this.addRect(s,a,u,o)},isSegments:function(){return this.widthSegments>1||this.heightSegments>1||this.depthSegments>1},setFrontUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setFrontUV!"):this.setVertexUV(32,t)},setRightUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setRightUV!"):this.setVertexUV(0,t)},setBackUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setBackUV!"):this.setVertexUV(40,t)},setLeftUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setLeftUV!"):this.setVertexUV(8,t)},setTopUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setTopUV!"):this.setVertexUV(16,t)},setBottomUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setBottomUV!"):this.setVertexUV(24,t)},setAllRectUV:function(t){if(this.isSegments())return m.a.warn("segmented BoxGeometry dont support setAllRectUV!"),null;for(var e=0;e<6;e++)this.setVertexUV(8*e,t);return this},_raycast:function(t,e){return _i.superclass._raycast.call(this,t,e)}}),pi=_i,gi=P.a.FRONT,vi=P.a.BACK,Ei=[0,0,1],Ti=a.a.create({Extends:Z,isPlaneGeometry:!0,className:"PlaneGeometry",width:1,height:1,widthSegments:1,heightSegments:1,constructor:function(t){Ti.superclass.constructor.call(this,t),this.build()},build:function(){for(var t=this.widthSegments,e=this.heightSegments,n=(t+1)*(e+1),r=this.width/t,i=this.height/e,a=new Float32Array(3*n),s=new Float32Array(3*n),o=new Float32Array(2*n),u=new Uint16Array(t*e*6),c=0,h=0;h<=e;h++)for(var f=0;f<=t;f++){var l=h*(t+1)+f;if(a[3*l]=f*r-this.width/2,a[3*l+1]=this.height/2-h*i,s[3*l]=0,s[3*l+1]=0,s[3*l+2]=1,o[2*l]=f/t,o[2*l+1]=1-h/e,h<e&&f<t){var d=(h+1)*(t+1)+f;u[c++]=l,u[c++]=d,u[c++]=d+1,u[c++]=l,u[c++]=d+1,u[c++]=l+1}}this.vertices=new b(a,3),this.indices=new b(u,1),this.normals=new b(s,3),this.uvs=new b(o,2)},_raycast:function(t,e){var n=t.origin.z,r=t.direction.z;if(e===gi&&(r>0||n<0))return null;if(e===vi&&(r<0||n>0))return null;var i=t.intersectsPlane(Ei,0);if(i){var a=i.x,s=i.y,o=.5*this.width,u=.5*this.height;if(a>=-o&&a<=o&&s>=-u&&s<=u)return[i]}return null}}),Mi=Ti,Ai=a.a.create({Extends:Z,isSphereGeometry:!0,className:"SphereGeometry",radius:1,heightSegments:16,widthSegments:32,constructor:function(t){Ai.superclass.constructor.call(this,t),this.build()},build:function(){for(var t=this.radius,e=this.heightSegments,n=this.widthSegments,r=(n+1)*(e+1),i=n*e,a=new Float32Array(3*r),s=new Float32Array(4*r),o=new Float32Array(2*r),u=new Uint16Array(6*i),c=0,h=0,f=0,l=0,d=0,m=2*Math.PI,_=Math.PI,p=0;p<=e;p++)for(var g=p/e,v=_*g,E=Math.cos(v)*t,T=Math.sin(v)*t,M=0;M<=n;M++){var A=M/n,L=m*A,I=Math.cos(L),O=Math.sin(L),S=I*T,R=O*T,y=O,N=-I;if(s[f++]=y,s[f++]=0,s[f++]=N,s[f++]=1,a[h++]=S,a[h++]=E,a[h++]=R,o[l++]=A,o[l++]=g,p>0&&M>0){var x=d,C=x-1,P=C-n-1,w=x-n-1;u[c++]=P,u[c++]=w,u[c++]=x,u[c++]=P,u[c++]=x,u[c++]=C}d++}this.vertices=new b(a,3),this.indices=new b(u,1),this.uvs=new b(o,2),this.tangents=new b(s,4),this.normals=new b(new Float32Array(a),3)},_raycast:function(t,e){return Ai.superclass._raycast.call(this,t,e)}}),Li=Ai,Ii=[dt,Lt,Nt,Ft,Qt,ce],Oi=function(){var t="";return Ii.forEach((function(e){t+="".concat(e.prototype.className,":").concat(Object.keys(e.cache._cache).length," ")})),m.a.log(t),t},Si=a.a.create({Mixes:s.a,isLoadCache:!0,className:"LoadCache",Statics:{PENDING:1,LOADED:2,FAILED:3},enabled:!0,constructor:function(){this._files={}},update:function(t,e,n){if(this.enabled){var r={key:t,state:e,data:n};this._files[t]=r,this.fire("update",r),this.fire("update:".concat(r.key),r)}},get:function(t){return this.enabled?this._files[t]:null},getLoaded:function(t){var e=this.get(t);return e&&e.state===Si.LOADED?e.data:null},remove:function(t){delete this._files[t]},clear:function(){this._files={}},wait:function(t){var e=this;return t?t.state===Si.LOADED?Promise.resolve(t.data):t.state===Si.FAILED?Promise.reject():new Promise((function(n,r){e.on("update:".concat(t.key),(function(t){var e=t.detail;e.state===Si.LOADED?n(e.data):e.state===Si.FAILED&&r(e.data)}),!0)})):Promise.reject()}}),Ri=Si,yi=new Ri,Ni=a.a.create({Mixes:s.a,isBasicLoader:!0,className:"BasicLoader",Statics:{_cache:yi,enalbeCache:function(){yi.enabled=!0},disableCache:function(){yi.enabled=!1},deleteCache:function(t){yi.remove(t)},clearCache:function(){yi.clear()},cache:{get:function(){return yi},set:function(){m.a.warn("BasicLoader.cache is readonly!")}},TYPE_IMAGE:"img",TYPE_JSON:"json",TYPE_BUFFER:"buffer",TYPE_TEXT:"text"},load:function(t){var e=t.src,n=t.type;if(!n){var r=Object(i.getExtension)(e);/^(?:png|jpe?g|gif|webp|bmp)$/i.test(r)&&(n="img"),n||(n=t.defaultType)}return n===Ni.TYPE_IMAGE?this.loadImg(e,t.crossOrigin):this.loadRes(e,n)},isCrossOrigin:function(t){var e=window.location,n=document.createElement("a");return n.href=t,n.hostname!==e.hostname||n.port!==e.port||n.protocol!==e.protocol},isBase64:function(t){return/^data:(.+?);base64,/.test(t)},Uint8ArrayFrom:function(t,e){if(Uint8Array.from)return Uint8Array.from(t,e);for(var n=t.length,r=new Uint8Array(n),i=0;i<n;i++)r[i]=e(t[i]);return r},loadImg:function(t,e){var n=this,r=yi.get(t);return r?yi.wait(r):new Promise((function(r,i){var a=new Image;yi.update(t,Ri.PENDING),a.onload=function(){a.onerror=null,a.onabort=null,a.onload=null,yi.update(t,Ri.LOADED,a),r(a)},a.onerror=function(){a.onerror=null,a.onabort=null,a.onload=null;var e=new Error("Image load failed for ".concat(t.slice(0,100)));yi.update(t,Ri.FAILED,e),i(e)},a.onabort=a.onerror,(e||n.isCrossOrigin(t))&&(n.isBase64(t)||(a.crossOrigin="anonymous")),a.src=t}))},loadRes:function(t,e){var n=this;if(this.isBase64(t)){var r=RegExp.$1,i=t.slice(13+r.length),a=atob(i);return e===Ni.TYPE_JSON?a=JSON.parse(a):e===Ni.TYPE_BUFFER&&(a=this.Uint8ArrayFrom(a,(function(t){return t.charCodeAt(0)})).buffer),Promise.resolve(a)}var s=yi.get(t);return s?yi.wait(s):(yi.update(t,Ri.PENDING),this.fire("beforeload"),this.request({url:t,type:e}).then((function(e){return n.fire("loaded"),yi.update(t,Ri.LOADED,e),e}),(function(e){throw n.fire("failed",e),yi.update(t,Ri.FAILED),new Error("Resource load failed for ".concat(t,", ").concat(e))})))},request:function(t){var e=this;return new Promise((function(n,r){var a=new XMLHttpRequest;a.onload=function(){if(a.status<200||a.status>=300)r(new TypeError("Network request failed for ".concat(a.status)));else{var e="response"in a?a.response:a.responseText;if(t.type===Ni.TYPE_JSON)try{e=JSON.parse(e)}catch(t){return void r(new TypeError("JSON.parse error"+t))}n(e)}},a.onprogress=function(n){e.fire("progress",{url:t.url,loaded:n.loaded,total:n.total})},a.onerror=function(){r(new TypeError("Network request failed"))},a.ontimeout=function(){r(new TypeError("Network request timed out"))},a.open(t.method||"GET",t.url,!0),"include"===t.credentials&&(a.withCredentials=!0),t.type===Ni.TYPE_BUFFER&&(a.responseType="arraybuffer"),Object(i.each)(t.headers,(function(t,e){a.setRequestHeader(e,t)})),a.send(t.body||null)}))}}),xi=Ni,Ci=a.a.create({isLoader:!0,className:"Loader",maxConnections:2,Statics:{_loaderClassMap:{},_loaders:{},addLoader:function(t,e){Ci._loaderClassMap[t]=e},getLoader:function(t){if(!Ci._loaders[t]){var e=Ci._loaderClassMap[t]?Ci._loaderClassMap[t]:xi;Ci._loaders[t]=new e}return Ci._loaders[t]}},preHandlerUrl:null,load:function(t){var e=this;if(t instanceof Array)return Promise.all(t.map((function(t){return e.load(t)})));var n=t.type||Object(i.getExtension)(t.src),r=Ci.getLoader(n),a=t;return this.preHandlerUrl&&((a=Object.assign({},t)).src=this.preHandlerUrl(t.src)),r.load(a)}}),bi=Ci,Pi=a.a.create({Extends:xi,isCubeTextureLoader:!0,className:"CubeTextureLoader",constructor:function(){Pi.superclass.constructor.call(this)},load:function(t){var e,n=this;return e=t.images&&Array.isArray(t.images)?t.images:[t.right,t.left,t.top,t.bottom,t.front,t.back],Promise.all(e.map((function(e){return n.loadImg(e,t.crossOrigin)}))).then((function(e){var n=Object.assign({},t);return delete n.images,delete n.type,delete n.right,delete n.left,delete n.top,delete n.bottom,delete n.front,delete n.back,n.image=e,new pe(n)})).catch((function(t){throw m.a.error("load CubeTexture failed",t.message,t.stack),t}))}});bi.addLoader("CubeTexture",Pi);var wi=Pi,Hi=a.a.create({Extends:$e,isPBRMaterial:!0,className:"PBRMaterial",lightType:"PBR",gammaCorrection:!0,usePhysicsLight:!0,baseColor:null,baseColorMap:null,metallic:1,metallicMap:null,roughness:1,roughnessMap:null,metallicRoughnessMap:null,occlusionMap:null,occlusionStrength:1,isOcclusionInMetallicRoughnessMap:!1,diffuseEnvMap:null,diffuseEnvSphereHarmonics3:null,diffuseEnvIntensity:1,brdfLUT:null,specularEnvIntensity:1,specularEnvMap:null,isSpecularEnvMapIncludeMipmaps:!1,emission:null,emissionFactor:null,isSpecularGlossiness:!1,specular:null,glossiness:1,specularGlossinessMap:null,clearcoatFactor:0,clearcoatMap:null,clearcoatRoughnessFactor:0,clearcoatRoughnessMap:null,clearcoatNormalMap:null,usedUniformVectors:11,constructor:function(t){this.baseColor=new v.a(1,1,1),this.specular=new v.a(1,1,1),this.emissionFactor=new v.a(0,0,0),Hi.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_baseColor:"BASECOLOR",u_metallic:"METALLIC",u_roughness:"ROUGHNESS",u_specular:"SPECULAR",u_emissionFactor:"EMISSIONFACTOR",u_glossiness:"GLOSSINESS",u_brdfLUT:"BRDFLUT",u_diffuseEnvMap:"DIFFUSEENVMAP",u_diffuseEnvIntensity:"DIFFUSEENVINTENSITY",u_occlusionStrength:"OCCLUSIONSTRENGTH",u_specularEnvMap:"SPECULARENVMAP",u_specularEnvIntensity:"SPECULARENVINTENSITY",u_specularEnvMapMipCount:"SPECULARENVMAPMIPCOUNT",u_diffuseEnvSphereHarmonics3:"DIFFUSEENVSPHEREHARMONICS3",u_clearcoatFactor:"CLEARCOATFACTOR",u_clearcoatRoughnessFactor:"CLEARCOATROUGHNESSFACTOR"}),this.addTextureUniforms({u_baseColorMap:"BASECOLORMAP",u_metallicMap:"METALLICMAP",u_roughnessMap:"ROUGHNESSMAP",u_metallicRoughnessMap:"METALLICROUGHNESSMAP",u_occlusionMap:"OCCLUSIONMAP",u_specularGlossinessMap:"SPECULARGLOSSINESSMAP",u_lightMap:"LIGHTMAP",u_clearcoatMap:"CLEARCOATMAP",u_clearcoatRoughnessMap:"CLEARCOATROUGHNESSMAP",u_clearcoatNormalMap:"CLEARCOATNORMALMAP"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Hi.superclass.getRenderOption.call(this,t);var e=this._textureOption.reset(t);return e.add(this.baseColorMap,"BASE_COLOR_MAP"),e.add(this.metallicMap,"METALLIC_MAP"),e.add(this.roughnessMap,"ROUGHNESS_MAP"),e.add(this.metallicRoughnessMap,"METALLIC_ROUGHNESS_MAP"),e.add(this.diffuseEnvMap,"DIFFUSE_ENV_MAP"),e.add(this.occlusionMap,"OCCLUSION_MAP"),e.add(this.lightMap,"LIGHT_MAP"),this.brdfLUT&&(e.add(this.specularEnvMap,"SPECULAR_ENV_MAP"),et.SHADER_TEXTURE_LOD&&this.specularEnvMap&&(t.USE_SHADER_TEXTURE_LOD=1)),this.isSpecularGlossiness&&(t.PBR_SPECULAR_GLOSSINESS=1,e.add(this.specularGlossinessMap,"SPECULAR_GLOSSINESS_MAP")),this.isOcclusionInMetallicRoughnessMap&&(t.IS_OCCLUSION_MAP_IN_METALLIC_ROUGHNESS_MAP=1),1!==this.occlusionStrength&&(t.OCCLUSION_STRENGTH=1),this.diffuseEnvSphereHarmonics3&&(t.HAS_NORMAL=1,t.DIFFUSE_ENV_SPHERE_HARMONICS3=1),(this.specularEnvMap||this.diffuseEnvSphereHarmonics3||this.specularEnvMap)&&(t.NEED_WORLD_NORMAL=1),this.specularEnvMap&&this.isSpecularEnvMapIncludeMipmaps&&(t.IS_SPECULAR_ENV_MAP_INCLUDE_MIPMAPS=1),this.clearcoatFactor>0&&(t.HAS_CLEARCOAT=1,t.HAS_NORMAL=1,this.clearcoatMap&&e.add(this.clearcoatMap,"CLEARCOAT_MAP"),this.clearcoatNormalMap&&e.add(this.clearcoatNormalMap,"CLEARCOAT_NORMAL_MAP"),this.clearcoatRoughnessMap&&e.add(this.clearcoatRoughnessMap,"CLEARCOAT_ROUGHNESS_MAP")),e.update(),t}}),Di=Hi,Fi=new Image;Fi.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";var Ui=a.a.create({Extends:Qt,Mixes:s.a,isLazyTexture:!0,className:"LazyTexture",_src:"",crossOrigin:!1,autoLoad:!0,resType:"",src:{get:function(){return this._src},set:function(t){this._src!==t&&(this._src=t,this.autoLoad&&this.load())}},constructor:function(t){t&&("crossOrigin"in t&&(this.crossOrigin=t.crossOrigin),"autoLoad"in t&&(this.autoLoad=t.autoLoad)),Ui.superclass.constructor.call(this,t),this.image=this.placeHolder||Fi},load:function(t){var e=this;return Ui.loader=Ui.loader||new bi,Ui.loader.load({src:this.src,crossOrigin:this.crossOrigin,type:this.resType,defaultType:"img"}).then((function(t){t.isTexture?(Object.assign(e,t),e.needUpdate=!0,e.needDestroy=!0,e.fire("load")):(e.image=t,e.needUpdate=!0,e.fire("load"))}),(function(n){if(e.fire("error"),t)throw new Error("LazyTexture Failed ".concat(n));m.a.warn("LazyTexture Failed ".concat(n))}))},_releaseImage:function(){this._src&&"string"!=typeof this._src&&(this._src=""),Ui.superclass._releaseImage.call(this)}}),Gi=Ui,Bi=n(13);function Vi(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Xi(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xi(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var ji=new l.a,ki=new l.a,zi=new l.a,Wi=new l.a,Yi=new l.a,qi=new l.a,Zi=new Bi.a,Ki=[];function Qi(t,e){return t-e}var Ji=a.a.create({Statics:{interpolation:{LINEAR:function(t,e,n){if(void 0===e)return t;if(t.slerp)return t.slerp(e,n);if(t.lerp)return t.lerp(e,n);if(Object(i.isArrayLike)(t)){Ki.length=0;for(var r=t.length-1;r>=0;r--)Ki[r]=t[r]+n*(e[r]-t[r]);return Ki}return t+n*(e-t)},STEP:function(t,e,n){return t},CUBICSPLINE:function(t,e,n,r){var a=t.length/3;if(void 0===e)return 1===a?t[1]:t.slice(a,-a);var s=t[1],o=t[2],u=e[1],c=e[0];return a>1&&(s=t.slice(a,-a),o=t.slice(-a),u=e.slice(a,-a),c=e.slice(0,a)),s.hermite?s.hermite(s,o.scale(r),u,c.scale(r),n):s.isQuaternion?(s.fromArray(this._cubicSpline(s.elements,o.elements,u.elements,c.elements,r,n),0,!0),s.normalize(!0)):(Object(i.isArrayLike)(s)||(s=[s],o=[o],u=[u],c=[c]),s=this._cubicSpline(s,o,u,c,r,n)),s},_cubicSpline:function(t,e,n,r,i,a){var s=a*a,o=s*a,u=2*o-3*s+1,c=o-2*s+a,h=-2*o+3*s,f=o-s;Ki.length=0;for(var l=t.length-1;l>=0;l--)Ki[l]=t[l]*u+c*e[l]*i+n[l]*h+f*r[l]*i;return Ki}},StateType:{TRANSLATE:"Translation",POSITION:"Translation",TRANSLATION:"Translation",SCALE:"Scale",ROTATE:"Rotation",ROTATION:"Rotation",QUATERNION:"Quaternion",WEIGHTS:"Weights"},getType:function(t){return t=String(t).toUpperCase(),Ji.StateType[t]||Ji._extraStateHandlers.type[t]},_extraStateHandlers:{type:{},handler:{}},registerStateHandler:function(t,e){Ji._extraStateHandlers.type[String(t).toUpperCase()]=t,Ji._extraStateHandlers.handler[t]=e}},isAnimationStates:!0,className:"AnimationStates",nodeName:"",type:"",interpolationType:"LINEAR",constructor:function(t){this.id=d.a.generateUUID(this.className),this.keyTime=[],this.states=[],Object.assign(this,t)},findIndexByTime:function(t){return Object(i.getIndexFromSortedArray)(this.keyTime,t,Qi)},getStateByIndex:function(t){var e=this.states.length/this.keyTime.length;return 1===e?this.states[t]:this.states.slice(t*e,t*e+e)},getState:function(t){var e=Vi(this.findIndexByTime(t),2),n=e[0],r=e[1];if(n<0||r>=this.keyTime.length)return null;var a=this.keyTime[n],s=this.keyTime[r],o=this.getStateByIndex(n);if("STEP"===this.interpolationType)return o;if(n===r){var u=this.interpolation(o);return this.type===Ji.StateType.ROTATION&&(u=ji.fromEuler(Zi.fromArray(u))),u.elements||u}var c=this.getStateByIndex(r),h=s-a,f=(t-a)/h;this.type===Ji.StateType.ROTATION?Object(i.isArrayLike)(o[0])?(o[0]=ji.fromEuler(Zi.fromArray(o[0])),o[1]=ki.fromEuler(Zi.fromArray(o[1])),o[2]=zi.fromEuler(Zi.fromArray(o[2])),c[0]=Wi.fromEuler(Zi.fromArray(c[0])),c[1]=Yi.fromEuler(Zi.fromArray(c[1])),c[2]=qi.fromEuler(Zi.fromArray(c[2]))):(o=ji.fromEuler(Zi.fromArray(o)),c=ki.fromEuler(Zi.fromArray(c))):this.type===Ji.StateType.QUATERNION&&(Object(i.isArrayLike)(o[0])?(o[0]=ji.fromArray(o[0]),o[1]=ki.fromArray(o[1]),o[2]=zi.fromArray(o[2]),c[0]=Wi.fromArray(c[0]),c[1]=Yi.fromArray(c[1]),c[2]=qi.fromArray(c[2])):(o=ji.fromArray(o),c=ki.fromArray(c)));var l=this.interpolation(o,c,f,h);return l.elements||l},interpolation:function(t,e,n,r){return Ji.interpolation[this.interpolationType](t,e,n,r)},updateNodeTranslation:function(t,e){t.x=e[0],t.y=e[1],t.z=e[2]},updateNodeScale:function(t,e){t.scaleX=e[0],t.scaleY=e[1],t.scaleZ=e[2]},updateNodeQuaternion:function(t,e){t.quaternion.fromArray(e)},updateNodeWeights:function(t,e){var n=this._originalWeightIndices=this._originalWeightIndices||[],r=e.length;e=e.slice();for(var i=0;i<r;i++)n[i]=i;for(var a=0;a<r;a++)for(var s=a+1;s<r;s++)if(e[s]>e[a]){var o=e[a];e[a]=e[s],e[s]=o,o=n[a],n[a]=n[s],n[s]=o}t.traverse((function(t){t.isMesh&&t.geometry&&t.geometry.isMorphGeometry&&t.geometry.update(e,n)}))},updateNodeState:function(t,e){if(e){var n=this.type;n===Ji.StateType.ROTATION&&(n=Ji.StateType.QUATERNION);var r=this.getState(t);if(r){var i="updateNode"+n;this[i]?this[i](e,r):Ji._extraStateHandlers.handler[n]?Ji._extraStateHandlers.handler[n].call(this,e,r):m.a.warnOnce(i,"updateNodeState failed unknow type(%s)",n)}}},clone:function(){return new this.constructor({keyTime:this.keyTime,states:this.states,type:this.type,nodeName:this.nodeName})}}),$i=Ji,ta=a.a.create({Statics:{_anims:[],tick:function(t){this._anims.forEach((function(e){return e.tick(t)}))}},Mixes:s.a,isAnimation:!0,className:"Animation",paused:!1,currentLoopCount:0,loop:1/0,currentTime:0,timeScale:1,startTime:0,endTime:0,clipStartTime:0,clipEndTime:0,nodeNameMap:null,_rootNode:null,rootNode:{get:function(){return this._rootNode},set:function(t){this._rootNode=t,this._initNodeNameMap()}},_animStatesList:null,animStatesList:{get:function(){return this._animStatesList},set:function(t){this._animStatesList=t,this._initClipTime()}},validAnimationIds:null,constructor:function(t){this.id=d.a.generateUUID(this.className),this.clips={},this._animStatesList=[],Object.assign(this,t)},addClip:function(t,e,n,r){this.clips[t]={start:e,end:n,animStatesList:r}},removeClip:function(t){this.clips[t]=null},getAnimStatesListTimeInfo:function(t){var e=0,n=1/0;return t.forEach((function(t){e=Math.max(t.keyTime[t.keyTime.length-1],e),n=Math.min(t.keyTime[0],n)})),{startTime:n,endTime:e}},_initClipTime:function(){var t=this.getAnimStatesListTimeInfo(this.animStatesList);this.clipStartTime=t.startTime,this.clipEndTime=t.endTime},_initNodeNameMap:function(){if(this._rootNode){var t=this.nodeNameMap={};this._rootNode.traverse((function(e){t[e.animationId]=e;var n=e.name;void 0===n||t[n]||(t[n]=e)}),!1)}},tick:function(t){this.paused||(this.currentTime+=t/1e3*this.timeScale,this.currentTime>=this.endTime?(this.currentLoopCount++,this.currentTime=this.endTime,this.updateAnimStates(),this.fire("loopEnd"),!this.loop||this.currentLoopCount>=this.loop?(this.stop(),this.fire("end")):this.currentTime=this.startTime):this.updateAnimStates())},updateAnimStates:function(){var t=this;return this.animStatesList.forEach((function(e){e.updateNodeState(t.currentTime,t.nodeNameMap[e.nodeName])})),this},play:function(t,e){var n;if("string"==typeof t){var r=this.clips[t];r?(n=r.start,e=r.end,r.animStatesList&&(this.animStatesList=r.animStatesList,this._initClipTime())):m.a.warn("no this animation clip name:"+t)}else n=t;void 0===n&&(n=this.clipStartTime),void 0===e&&(e=this.clipEndTime),this.endTime=Math.min(e,this.clipEndTime),this.startTime=Math.min(n,this.endTime),this.currentTime=this.startTime,this.currentLoopCount=0,this.stop(),this.paused=!1,ta._anims.push(this)},stop:function(){this.paused=!0;var t=ta._anims,e=t.indexOf(this);-1!==e&&t.splice(e,1)},pause:function(){this.paused=!0},resume:function(){this.paused=!1},clone:function(t){var e=new this.constructor({rootNode:t,animStatesList:this.animStatesList,timeScale:this.timeScale,loop:this.loop,paused:this.paused,currentTime:this.currentTime,startTime:this.startTime,endTime:this.endTime,clips:this.clips});return this.paused||e.play(),e}}),ea=ta;function na(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return ra(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ra(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ra(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var ia=P.a.BLEND,aa=P.a.DEPTH_TEST,sa=P.a.CULL_FACE,oa=P.a.FRONT,ua=P.a.BACK,ca=P.a.FRONT_AND_BACK,ha={5120:[1,Int8Array],5121:[1,Uint8Array],5122:[2,Int16Array],5123:[2,Uint16Array],5125:[4,Uint32Array],5126:[4,Float32Array]},fa={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},la={POSITION:{name:"vertices",decodeMatName:"positionDecodeMat"},TEXCOORD_0:{name:"uvs",decodeMatName:"uvDecodeMat"},TEXCOORD_1:{name:"uvs1",decodeMatName:"uv1DecodeMat"},NORMAL:{name:"normals",decodeMatName:"normalDecodeMat"},JOINT:{name:"skinIndices"},JOINTS_0:{name:"skinIndices"},WEIGHT:{name:"skinWeights"},WEIGHTS_0:{name:"skinWeights"},TANGENT:{name:"tangents"},COLOR_0:{name:"colors"}},da=a.a.create({isGLTFParser:!0,className:"GLTFParser",Statics:{MAGIC:"glTF",extensionHandlers:r,registerExtensionHandler:function(t,e){this.extensionHandlers[t]=e},unregisterExtensionHandler:function(t){this.extensionHandlers[t]&&delete this.extensionHandlers[t]}},isMultiAnim:!0,isProgressive:!1,isUnQuantizeInShader:!0,isLoadAllTextures:!1,preHandlerImageURI:null,preHandlerBufferURI:null,customMaterialCreator:null,ignoreTextureError:!1,forceCreateNewBuffer:!1,src:"",constructor:function(t,e){Object.assign(this,e),this.content=t},parse:function(t){var e=this;if(this.content instanceof ArrayBuffer){var n=this.content;if(i.convertUint8ArrayToString(new Uint8Array(n,0,4))===da.MAGIC)this.parseBinary(n);else{var r=i.convertUint8ArrayToString(new Uint8Array(n),!0);this.json=JSON.parse(r)}}else this.json=JSON.parse(this.content);return this.glTFVersion=parseFloat(this.json.asset.version),this.glTFVersion>=2&&(this.isGLTF2=!0),this.parseExtensionUsed(),this.loadResources(t).then((function(){return e.parseExtensions(e.json.extensions,null,{isGlobal:!0,methodName:"parseOnLoad"}),Promise.resolve()})).then((function(){return e.parseGeometries()})).then((function(){return e.parseScene()}))},parseExtensionUsed:function(){var t=this;this.extensionsUsed={},i.each(this.json.extensionsUsed,(function(e){t.extensionsUsed[e]=!0})),this.extensionsUsed.WEB3D_quantized_attributes||(this.isUnQuantizeInShader=!1)},getExtensionHandler:function(t){return this.extensionHandlers&&this.extensionHandlers[t]||da.extensionHandlers[t]},parseExtension:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=t[e],a=this.getExtensionHandler(e);return a&&a.parse?a.parse(i,this,n,r):n},parseExtensions:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return i.each(t,(function(t,i){if(!r.ignoreExtensions||!r.ignoreExtensions[i]){var a=n.getExtensionHandler(i),s=r.methodName||"parse";a&&a[s]&&(e=a[s](t,n,e,r))}})),e},isUseExtension:function(t,e){return!!(t&&t.extensions&&t.extensions[e])},parseBinary:function(t){this.isBinary=!0;var e,n=new DataView(t),r=n.getUint32(4,!0),a=n.getUint32(8,!0),s=12;if(r<2){var o=n.getUint32(s,!0);e=new Uint8Array(t,20,o),e=i.convertUint8ArrayToString(e,!0),this.json=JSON.parse(e),this.binaryBody=t.slice(20+o)}else{if(2!==r)throw new Error("Dont support glTF version ".concat(r));for(;s<a;){var u=n.getUint32(s,!0),c=n.getUint32(s+4,!0);1313821514===c?(e=new Uint8Array(t,s+8,u),e=i.convertUint8ArrayToString(e,!0),this.json=JSON.parse(e)):5130562===c&&(this.binaryBody=t.slice(s+8,s+8+u)),s+=8+u}}},loadResources:function(t){var e=this,n=[];for(var r in this.extensionsUsed){var i=this.getExtensionHandler(r);i&&i.init&&n.push(i.init(t,this))}return this.isBinary?n.push(this.loadBuffers(t).then((function(){return e.loadTextures(t)}))):(n.push(this.loadBuffers(t)),n.push(this.loadTextures(t))),Promise.all(n)},getBufferUri:function(t){var e=i.getRelativePath(this.src,this.json.buffers[t].uri);return this.preHandlerBufferURI&&(e=this.preHandlerBufferURI(e,this.json.buffers[t])),e},loadBuffers:function(t){var e=this;return this.buffers={},this.isBinary?(this.isGLTF2?this.buffers[0]=this.binaryBody:this.buffers.binary_glTF=this.binaryBody,this.parseBufferViews(),Promise.resolve()):Promise.all(Object.keys(this.json.buffers||[]).map((function(n){var r=e.getBufferUri(n);return t.loadRes(r,xi.TYPE_BUFFER).then((function(t){e.buffers[n]=t}))}))).then((function(){e.parseBufferViews()}))},getImageUri:function(t){var e=this.json.images[t],n=e.uri;if(this.isUseExtension(e,"KHR_binary_glTF")){var r=e.extensions.KHR_binary_glTF,a=this.bufferViews[r.bufferView],s=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);n=i.getBlobUrl(r.mimeType,s)}else if(n)n=i.getRelativePath(this.src,n);else if("bufferView"in e){var o=this.bufferViews[e.bufferView],u=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);n="image/ktx"===e.mimeType?u:i.getBlobUrl(e.mimeType,u)}return this.preHandlerImageURI&&(n=this.preHandlerImageURI(n,e)),n},getImageType:function(t){var e=this.json.images[t],n="";return e&&/^image\/(.*)$/.test(e.mimeType)&&(n=RegExp.$1),["ktx"].indexOf(n)<0&&(n=""),n},getUsedTextureNameMap:function(){var t=this,e={};return i.each(this.json.materials,(function(n){var r=n,a=!1;if(t.isUseExtension(n,"KHR_materials_common")&&(a=!0,r=n.extensions.KHR_materials_common.values),t.isGLTF2&&!a){if(r.normalTexture&&(e[r.normalTexture.index]=!0),r.occlusionTexture&&(e[r.occlusionTexture.index]=!0),r.emissiveTexture&&(e[r.emissiveTexture.index]=!0),r.transparencyTexture&&(e[r.transparencyTexture.index]=!0),r.extensions&&i.each(r.extensions,(function(n,r){var i=t.getExtensionHandler(r);i&&i.getUsedTextureNameMap&&i.getUsedTextureNameMap(n,e,t)})),!t.isUseExtension(r,"KHR_materials_pbrSpecularGlossiness")&&r.pbrMetallicRoughness){var s=r.pbrMetallicRoughness;s.baseColorTexture&&(e[s.baseColorTexture.index]=!0),s.metallicRoughnessTexture&&(e[s.metallicRoughnessTexture.index]=!0)}}else a||(r=n.values),["diffuse","specular","emission","ambient","transparency","normalMap"].forEach((function(n){var a=r[n];a instanceof Object&&"index"in a&&(a=a.index),i.isStrOrNumber(a)&&t.json.textures[a]&&(e[a]=!0)}))})),e},loadTextures:function(){var t=this;if(this.textures={},!this.json.textures)return Promise.resolve();var e=Object.keys(this.json.textures);if(!this.isLoadAllTextures){var n=this.getUsedTextureNameMap();e=e.filter((function(t){return n[t]}))}return Promise.all(e.map((function(e){var n=t.json.textures[e],r=t.getImageUri(n.source),a=new Gi(n);if(a.uv=void 0,a.autoLoad=t.isProgressive,a.crossOrigin=!0,a.resType=t.getImageType(n.source),a.src=r,a.name=n.name||e,a.colorSpaceConversion=!1,i.isBlobUrl(r)){var s=function t(){i.revokeBlobUrl(r),a.off("load",t),a.off("error",t)};a.on("load",s,!0),a.on("error",s,!0)}return t.json.samplers&&Object.assign(a,t.json.samplers[n.sampler]),n.extensions&&(a=t.parseExtensions(n.extensions,a)),t.textures[e]=a,t.isProgressive?Promise.resolve():a.load(!t.ignoreTextureError)})))},parseBufferViews:function(){var t=this;this.bufferViews={},i.each(this.json.bufferViews,(function(e,n){var r=t.buffers[e.buffer],i=e.byteOffset||0,a=e.byteLength;t.bufferViews[n]={id:d.a.generateUUID("bufferView"),byteOffset:i,byteLength:a,buffer:r,byteStride:e.byteStride}})),this.isBinary||delete this.buffers},getTexture:function(t){var e=this.textures[t.index];if(!e)return null;var n=t.texCoord||0,r=t.index+"_"+n;return this.textures[r]?e=this.textures[r]:"number"==typeof e.uv&&e.uv!==n&&(e=e.clone(),this.textures[r]=e),e.uv=n,e.__gltfTextureInfo=t,e},getColorOrTexture:function(t){return Array.isArray(t)?new v.a(t[0],t[1],t[2]):(t instanceof Object&&"index"in t&&(t=t.index),this.textures[t])},parseMaterialCommonProps:function(t,e){switch(e.alphaMode){case"BLEND":t.transparent=!0;break;case"MASK":t.alphaCutoff="alphaCutoff"in e?e.alphaCutoff:.5;break;case"OPAQUE":default:t.ignoreTranparent=!0}e.doubleSided?t.side=ca:t.side=oa,e.transparencyTexture&&(t.transparency=this.getTexture(e.transparencyTexture))},createPBRMaterial:function(t){var e=new Di,n=t,r=!this.isUseExtension(n,"KHR_materials_unlit");if(r){var i=n.normalTexture;i&&(e.normalMap=this.getTexture(i),void 0!==i.scale?e.normalMapScale=i.scale:e.normalMapScale=1);var a=n.occlusionTexture;a&&(e.occlusionMap=this.getTexture(a),void 0!==a.strength?e.occlusionStrength=a.strength:e.occlusionStrength=1);var s=n.emissiveTexture;s&&(e.emission=this.getTexture(s));var o=n.emissiveFactor;o&&(e.emissionFactor.fromArray(o),e.emissionFactor.a=1)}else e.lightType="NONE";if(this.isUseExtension(n,"KHR_materials_pbrSpecularGlossiness"))this.parseExtension(n.extensions,"KHR_materials_pbrSpecularGlossiness",e);else if(n.pbrMetallicRoughness){var u=n.pbrMetallicRoughness;u.baseColorFactor&&e.baseColor.fromArray(u.baseColorFactor),u.baseColorTexture&&(e.baseColorMap=this.getTexture(u.baseColorTexture)),r&&(u.metallicRoughnessTexture&&(e.metallicRoughnessMap=this.getTexture(u.metallicRoughnessTexture),e.occlusionMap===e.metallicRoughnessMap&&(e.occlusionMap=null,e.isOcclusionInMetallicRoughnessMap=!0)),"roughnessFactor"in u&&(e.roughness=u.roughnessFactor),"metallicFactor"in u&&(e.metallic=u.metallicFactor))}return e.baseColorMap&&this._parseTextureTransform(e,e.baseColorMap),e},_parseTextureTransform:function(t,e){var n=e.__gltfTextureInfo;if(this.isUseExtension(n,"KHR_texture_transform")){var r=n.extensions.KHR_texture_transform;if(void 0!==r.texCoord&&(e.uv=r.texCoord),r.offset||r.rotation||r.scale){var i=r.offset||[0,0],a=r.rotation||0,s=r.scale||[1,1],o=(new y.a).fromRotationTranslationScale(a,i[0],i[1],s[0],s[1]);0===e.uv?t.uvMatrix=o:1===e.uv&&(t.uvMatrix1=o)}}},createKMCMaterial:function(t,e){var n,r=new en;return e?(n=e.values,r.lightType=e.technique):n=t.values,r.diffuse=this.getColorOrTexture(n.diffuse)||r.diffuse,r.specular=this.getColorOrTexture(n.specular)||r.specular,r.emission=this.getColorOrTexture(n.emission)||r.emission,r.ambient=this.getColorOrTexture(n.ambient)||r.ambient,n.normalMap&&(r.normalMap=this.getColorOrTexture(n.normalMap)),"number"==typeof n.transparency?(r.transparency=n.transparency,r.transparency<1&&(r.transparent=!0)):"string"==typeof n.transparency&&(r.transparency=this.getColorOrTexture(n.transparency),r.transparent=!0),!0===n.transparent&&(r.transparent=!0),"shininess"in n&&(r.shininess=n.shininess),this._parseTextureTransform(r,r.diffuse),r},parseMaterials:function(){var t=this;this.materials={},i.each(this.json.materials,(function(e,n){if(t.customMaterialCreator){var r=t.customMaterialCreator(n,e,t.json,t);if(r)return void(t.materials[n]=r)}var i,a=null;t.isUseExtension(e,"KHR_materials_common")&&(a=e.extensions.KHR_materials_common),t.isGLTF2&&!a?(i=t.isUseExtension(e,"KHR_techniques_webgl")?t.parseExtension(e.extensions,"KHR_techniques_webgl"):t.createPBRMaterial(e),t.parseMaterialCommonProps(i,e)):i=t.createKMCMaterial(e,a),(i=t.parseExtensions(e.extensions,i,{ignoreExtensions:{KHR_techniques_webgl:1,KHR_materials_common:1,KHR_materials_pbrSpecularGlossiness:1},isMaterial:!0})).name=e.name||n,t.materials[n]=i,t.parseTechnique(e,i)}))},sparseAccessorHandler:function(t,e){if(!e)return t;var n=e.count,r=t.data.constructor,a=new r(t.realLength);a.set(t.data),t.data=a;for(var s=this.bufferViews[e.values.bufferView],o=new r(s.buffer,s.byteOffset+(e.values.byteOffset||0),n*t.size),u=new(r=ha[e.indices.componentType][1])((s=this.bufferViews[e.indices.bufferView]).buffer,s.byteOffset+(e.indices.byteOffset||0),n),c=0;c<n;c++)i.copyArrayData(a,o,u[c]*t.size,c*t.size,t.size);return t},getAccessorData:function(t,e){var n=this.json.accessors[t];if(n.data)return n.data;var r,i=na(ha[n.componentType],2)[1],a=fa[n.type],s=this.bufferViews[n.bufferView],o=n.count*a;if(s)if(s.byteStride&&s.byteStride>a*i.BYTES_PER_ELEMENT)s.array=new i(s.buffer,s.byteOffset,s.byteLength/i.BYTES_PER_ELEMENT),r=new b(s.array,a,{offset:n.byteOffset||0,stride:s.byteStride,bufferViewId:s.id});else{var u,c=(n.byteOffset||0)+s.byteOffset;if(c%i.BYTES_PER_ELEMENT||this.forceCreateNewBuffer)u=new i(s.buffer.slice(c,c+o*i.BYTES_PER_ELEMENT));else u=new i(s.buffer,c,o);r=new b(u,a)}return n.sparse&&(r||(r=new b(new i(o),a)),r=this.sparseAccessorHandler(r,n.sparse)),r=this.parseExtensions(n.extensions,r,{isDecode:e,isAccessor:!0}),n.data=r,n.normalized&&(r.normalized=!0),r},getArrayByAccessor:function(t,e){var n=this.json.accessors[t];if(n.array)return n.array;var r=this.getAccessorData(t,e);if(!r.stride&&!r.offset&&1===r.size)return r.data;var i=[];return r.traverse((function(t){i.push(t.toArray?t.toArray():t)})),n.array=i,i},parseTechnique:function(t,e){var n=null;this.json.techniques&&(n=this.json.techniques[t.technique]),n&&n.states&&(n.states.enable.forEach((function(t){switch(t){case ia:e.blend=!0;break;case aa:e.depthTest=!0;break;case sa:e.cullFace=!0}})),i.each(n.states.functions,(function(t,n){switch(n){case"blendEquationSeparate":e.blendEquation=t[0],e.blendEquationAlpha=t[1];break;case"blendFuncSeparate":e.blendSrc=t[0],e.blendDst=t[1],e.blendSrcAlpha=t[2],e.blendDstAlpha=t[3];break;case"depthMask":e.depthMask=t[0];break;case"cullFace":e.cullFaceType=t[0];break;default:e[n]=t}})),e.cullFace?e.side=e.cullFaceType===oa?ua:oa:e.side=ca)},createMorphGeometry:function(t,e){var n=this,r=new Zn,a=r.targets={};return i.each(t.targets,(function(t){i.each(t,(function(t,e){var r=la[e].name;a[r]||(a[r]=[]);var i=n.getAccessorData(t,!0);a[r].push(i)}))})),r.weights=e||new Float32Array(t.targets.length),r},handlerGeometry:function(t,e){var n=void 0===e.mode?4:e.mode;if(e.extensions){var r=this.parseExtensions(e.extensions,null,{primitive:e,isPrimitive:!0});if(r)return r.mode=n,r}t||(t=new Z({mode:n})),"indices"in e&&(t.indices=this.getAccessorData(e.indices));var i=e.attributes;for(var a in i){var s=la[a];if(s){var o=!(this.isUnQuantizeInShader&&s.decodeMatName);t[s.name]=this.getAccessorData(i[a],o),o||(t[s.decodeMatName]=t[s.name].decodeMat,delete t[s.name].decodeMat)}else m.a.warn("Unknow attribute named ".concat(a,"!"))}return t},handlerSkinedMesh:function(t,e){e&&(t.skeleton=e,this.useInstanced&&(t.useInstanced=!0))},fixProgressiveGeometry:function(t,e){t._geometry=e,this.isProgressive&&t._meshes&&t._meshes.forEach((function(t){t.visible=!0,t.geometry=e}))},parseGeometries:function(){var t=this,e=i.serialRun(this.json.meshes,(function(e){return i.serialRun(e.primitives,(function(n){var r;n.targets&&n.targets.length&&(r=t.createMorphGeometry(n,e.weights)),n._geometry=r;var i=t.handlerGeometry(r,n);return i&&i.then?i.then((function(e){t.fixProgressiveGeometry(n,e)}),(function(t){m.a.error("geometry parse error",t)})):(t.fixProgressiveGeometry(n,i),i)}))}));return this.isProgressive?null:e},parseMesh:function(t,e,n){var r=this,i=this.json.meshes[t];i.primitives.forEach((function(a){var s,o=r.skins&&r.skins[n.skin];if(a.meshNode)s=a.meshNode.clone();else{var u=r.materials[a.material]||new en;s=new(o?Er:_r)({geometry:a._geometry,material:u,name:"mesh-"+(i.name||t)}),a.meshNode=s}r.handlerSkinedMesh(s,o),r.isProgressive&&!s.geometry&&(s.visible=!1,a._meshes=a._meshes||[],a._meshes.push(s)),e.addChild(s),r.meshes.push(s)}))},parseCameras:function(){var t=this;this.cameras={};var e=window.innerWidth/window.innerHeight;i.each(this.json.cameras,(function(n,r){var i;"perspective"===n.type&&n.perspective?((i=new Q).fov=d.a.radToDeg(n.perspective.yfov),i.near=n.perspective.znear,i.far=n.perspective.zfar,n.aspectRatio?i.aspect=n.aspectRatio:i.aspect=e):"orthographic"===n.type&&n.orthographic&&((i=new fn).near=n.orthographic.znear,i.far=n.orthographic.zfar,i.right=n.orthographic.xmag,i.left=-1*i.right,i.top=n.orthographic.ymag,i.bottom=-1*i.top),(i=t.parseExtensions(n.extensions,i,{isCamera:!0}))&&(i.name=n.name||r,t.cameras[r]=i)}))},handlerNodeTransform:function(t,e){e.matrix?t.matrix.fromArray(e.matrix):(e.rotation&&t.quaternion.fromArray(e.rotation),e.scale&&t.setScale(e.scale[0],e.scale[1],e.scale[2]),e.translation&&(t.x=e.translation[0],t.y=e.translation[1],t.z=e.translation[2]))},parseNode:function(t,e){var n,r=this,i=this.json.nodes[t];i||m.a.warn("GLTFParser.parseNode: nodes[".concat(t,"] has nothing.")),n=new g({name:i.name,animationId:t}),n=this.parseExtensions(i.extensions,n,{isNode:!0}),"camera"in i&&this.cameras[i.camera]&&n.addChild(this.cameras[i.camera]),this.handlerNodeTransform(n,i),i.jointName?(n.jointName=i.jointName,this.jointMap[n.jointName]=n):this.isGLTF2&&(n.jointName=t,this.jointMap[t]=n),i.meshes?i.meshes.forEach((function(t){return r.parseMesh(t,n,i)})):"mesh"in i&&this.parseMesh(i.mesh,n,i),i.children&&i.children.forEach((function(t){return r.parseNode(t,n)})),e.addChild(n)},parseAnimations:function(){var t=this;if(!this.json.animations)return null;var e=this.isMultiAnim,n={},r=[],a={};return i.each(this.json.animations,(function(i){i.channels.forEach((function(e){var n=e.target.path,s=e.target.id;t.isGLTF2&&(s=e.target.node);var o=i.samplers[e.sampler],u=t.isGLTF2?o.input:i.parameters[o.input],c=t.isGLTF2?o.output:i.parameters[n],h=t.getArrayByAccessor(u,!0),f=t.getArrayByAccessor(c,!0);"rotation"===n&&(n="quaternion");var l=new $i({interpolationType:o.interpolation||"LINEAR",nodeName:s,keyTime:h,states:f,type:$i.getType(n)});r.push(l),a[s]=!0})),e&&r.length&&(n[i.name]={animStatesList:r},r=[])})),e&&Object.keys(n).length>0&&(r=Object.values(n)[0].animStatesList),r.length?new ea({rootNode:this.node,animStatesList:r,validAnimationIds:a,clips:n}):null},parseScene:function(){var t=this;this.parseMaterials(),this.jointMap={},this.meshes=[],this.lights=[],this.node=new g({needCallChildUpdate:!1}),this.parseCameras();var e=this.json.scenes[this.getDefaultSceneName()];if(!e)return m.a.warn("GLTFParser:no scene!"),{node:this.node,meshes:[],cameras:[],lights:[],textures:[],materials:[]};var n=e.nodes;this.parseSkins(),n.forEach((function(e){return t.parseNode(e,t.node)})),this.resetSkinInfo(this.node);var r={node:this.node,scene:this.node,meshes:this.meshes,json:this.json,cameras:Object.values(this.cameras),lights:this.lights,textures:Object.values(this.textures),materials:Object.values(this.materials)},i=this.parseAnimations();return i&&(this.node.setAnim(i),i.play(),r.anim=i),this.parseExtensions(e.extensions,null,{isScene:!0}),this.parseExtensions(this.json.extensions,r,{isGlobal:!0,methodName:"parseOnEnd"}),r},getDefaultSceneName:function(){return void 0!==this.defaultScene?this.defaultScene:this.json.scenes?Object.keys(this.json.scenes)[0]:null},parseSkins:function(){var t=this;this.skins=[];var e=this.json.skins;e&&e.length&&(this.skins=e.map((function(e){for(var n=new Mr,r=e.joints.length,i=t.getArrayByAccessor(e.inverseBindMatrices,!0),a=0;a<r;a++){var s=(new o.a).fromArray(i[a]);n.inverseBindMatrices.push(s)}return n.jointNames=e.joints,n})))},resetSkinInfo:function(t){var e={};t.traverse((function(t){var n="".concat(t.id,"_").concat(t.name);e[t.jointName]=n,t.jointName=n})),this.skins.forEach((function(t){t.jointNames=t.jointNames.map((function(t){return e[t]}))})),t.resetSkinedMeshRootNode()}}),ma=da,_a=a.a.create({Extends:xi,isGLTFLoader:!0,className:"GLTFLoader",constructor:function(){_a.superclass.constructor.call(this)},load:function(t){var e=this;return this.loadRes(t.src,"buffer").then((function(n){return new ma(n,t).parse(e)})).catch((function(t){throw m.a.error("load gltf failed",t.message,t.stack),t}))}});bi.addLoader("gltf",_a),bi.addLoader("glb",_a);var pa=_a,ga=n(99),va=n.n(ga),Ea=P.a.RGBA,Ta=P.a.NEAREST,Ma=P.a.CLAMP_TO_EDGE,Aa=P.a.FLOAT,La=a.a.create({Extends:xi,isHDRLoader:!0,className:"HDRLoader",constructor:function(){La.superclass.constructor.call(this)},load:function(t){return this.loadRes(t.src,"buffer").then((function(e){try{var n=va()(e),r=n.shape,i=n.data,a=new Qt({width:r[0],height:r[1],flipY:t.flipY||!1,image:i,type:Aa,magFilter:Ta,minFilter:Ta,wrapS:Ma,wrapT:Ma,internalFormat:Ea,format:Ea});return Object.assign(a,t),a}catch(t){m.a.error("HDRLoader:parse error => ",t)}return null}))}});bi.addLoader("hdr",La);var Ia=La,Oa=a.a.create({Statics:{HEADER_LEN:64,COMPRESSED_2D:0,COMPRESSED_3D:1,TEX_2D:2,TEX_3D:3},isKhronosTextureContainer:!0,className:"KhronosTextureContainer",constructor:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.arrayBuffer=t,this.baseOffset=n;var r=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171===r[0]&&75===r[1]&&84===r[2]&&88===r[3]&&32===r[4]&&49===r[5]&&49===r[6]&&187===r[7]&&13===r[8]&&10===r[9]&&26===r[10]&&10===r[11]){var i=Uint32Array.BYTES_PER_ELEMENT,a=new DataView(this.arrayBuffer,this.baseOffset+12,13*i),s=a.getUint32(0,!0),o=67305985===s;this.glType=a.getUint32(1*i,o),this.glTypeSize=a.getUint32(2*i,o),this.glFormat=a.getUint32(3*i,o),this.glInternalFormat=a.getUint32(4*i,o),this.glBaseInternalFormat=a.getUint32(5*i,o),this.pixelWidth=a.getUint32(6*i,o),this.pixelHeight=a.getUint32(7*i,o),this.pixelDepth=a.getUint32(8*i,o),this.numberOfArrayElements=a.getUint32(9*i,o),this.numberOfFaces=a.getUint32(10*i,o),this.numberOfMipmapLevels=a.getUint32(11*i,o),this.bytesOfKeyValueData=a.getUint32(12*i,o),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===e?0===this.glType?this.loadType=Oa.COMPRESSED_2D:this.loadType=Oa.TEX_2D:m.a.warn("number of faces expected"+e+", but found "+this.numberOfFaces):m.a.warn("texture arrays not currently supported"):m.a.warn("only 2D textures currently supported")}else m.a.error("texture missing KTX identifier")},mipmaps:function(t){for(var e=[],n=Oa.HEADER_LEN+this.bytesOfKeyValueData,r=this.pixelWidth,i=this.pixelHeight,a=t?this.numberOfMipmapLevels:1,s=0;s<a;s++){for(var o=new Int32Array(this.arrayBuffer,this.baseOffset+n,1)[0],u=0;u<this.numberOfFaces;u++){var c=new Uint8Array(this.arrayBuffer,this.baseOffset+n+4,o);e.push({data:c,width:r,height:i}),n+=o+4,n+=3-(o+3)%4}r=Math.max(1,.5*r),i=Math.max(1,.5*i)}return e}}),Sa=a.a.create({Extends:xi,Statics:{astc:"WEBGL_compressed_texture_astc",etc:"WEBGL_compressed_texture_etc",etc1:"WEBGL_compressed_texture_etc1",pvrtc:"WEBGL_compressed_texture_pvrtc",s3tc:"WEBGL_compressed_texture_s3tc"},isKTXLoader:!0,className:"KTXLoader",constructor:function(){tt.use(Sa.astc),tt.use(Sa.atc),tt.use(Sa.etc),tt.use(Sa.etc1),tt.use(Sa.pvrtc),tt.use(Sa.s3tc),tt.use(Sa.s3tc_srgb),Sa.superclass.constructor.call(this)},load:function(t){var e=this;return t.src instanceof ArrayBuffer?Promise.resolve(this.createTexture(t,t.src)):ArrayBuffer.isView(t.src)?Promise.resolve(this.createTexture(t,t.src.buffer,t.src.byteOffset)):this.loadRes(t.src,"buffer").then((function(n){return e.createTexture(t,n)}))},createTexture:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=new Oa(e,1,n),i={compressed:0===r.glType,type:r.glType,width:r.pixelWidth,height:r.pixelHeight,internalFormat:r.glInternalFormat,format:r.glFormat,isCubemap:6===r.numberOfFaces};return r.numberOfMipmapLevels>=Math.floor(Math.log2(Math.max(i.width,i.height))+1)?(i.mipmaps=r.mipmaps(!0),i.image=i.mipmaps[0].data):(i.mipmaps=null,i.image=r.mipmaps(!1)[0].data),new Qt(i)}});bi.addLoader("ktx",Sa);var Ra=Sa,ya=a.a.create({Mixes:s.a,isLoadQueue:!0,className:"LoadQueue",Statics:{addLoader:function(t,e){m.a.warn("LoadQueue.addLoader is duplicated, please use Loader.addLoader"),bi.addLoader(t,e)}},constructor:function(t){this._source=[],this.add(t)},maxConnections:2,_source:null,_loaded:0,_connections:0,_currentIndex:-1,add:function(t){return t&&(t=Array.isArray(t)?t:[t],this._source=this._source.concat(t)),this},get:function(t){if(!t)return null;for(var e=this._source,n=0;n<e.length;n++){var r=e[n];if(r.id===t||r.src===t)return r}return null},getContent:function(t){var e=this.get(t);return e&&e.content},start:function(){return this._loader||(this._loader=new bi),this._loadNext(),this},_loadNext:function(){var t=this,e=this._source,n=e.length;if(this._loaded>=n)this.fire("complete");else if(this._currentIndex<n-1&&this._connections<this.maxConnections){var r=++this._currentIndex,i=e[r];this._connections++,this._loader.load(i).then((function(e){t._onItemLoad(r,e)}),(function(e){t._onItemError(r,e)}))}},_onItemLoad:function(t,e){var n=this._source[t];n.loaded=!0,n.content=e,this._connections--,this._loaded++,this.fire("load",n),this._loadNext()},_onItemError:function(t,e){var n=this._source[t];n.error=e,this._connections--,this._loaded++,this.fire("error",n),this._loadNext()},getSize:function(t){for(var e=0,n=this._source,r=0;r<n.length;r++){var i=n[r];e+=(t?i.loaded&&i.size:i.size)||0}return e},getLoaded:function(){return this._loaded},getTotal:function(){return this._source.length},getAllContent:function(){return this._source.map((function(t){return t.content}))}}),Na=a.a.create({Extends:xi,isShaderMaterialLoader:!0,className:"ShaderMaterialLoader",constructor:function(){Na.superclass.constructor.call(this)},load:function(t){var e=[this.loadRes(t.fs),this.loadRes(t.vs)],n=Object.assign({},t);return Promise.all(e).then((function(t){return n.fs=t[0],n.vs=t[1],new zn(n)}),(function(t){m.a.warn("ShaderMaterial Loader Failed for ".concat(t))}))}}),xa=Na,Ca=a.a.create({Extends:xi,isTextureLoader:!0,className:"TextureLoader",constructor:function(){Ca.superclass.constructor.call(this)},load:function(t){return this.loadImg(t.src,t.crossOrigin).then((function(e){var n=Object.assign({},t);return n.image=e,delete n.type,new Qt(n)})).catch((function(t){throw m.a.error("load Texture failed",t.message,t.stack),t}))}});bi.addLoader("Texture",Ca);var ba=Ca,Pa=P.a.LINES,wa={x:[0,0,0,1,0,0],y:[0,0,0,0,1,0],z:[0,0,0,0,0,1]},Ha=a.a.create({Extends:g,isAxisHelper:!0,className:"AxisHelper",size:1,constructor:function(t){Ha.superclass.constructor.call(this,t),this.init()},addAxis:function(t){var e=new _r({name:"AxisHelper_"+t,geometry:new Z({mode:Pa,vertices:new b(new Float32Array(wa[t]),3),indices:new b(new Uint16Array([0,1]),1)}),material:new en({diffuse:new v.a(wa[t][3],wa[t][4],wa[t][5]),lightType:"NONE"})});this.addChild(e)},init:function(){this.setScale(this.size),this.addAxis("x"),this.addAxis("y"),this.addAxis("z")}}),Da=Ha,Fa=P.a.LINES,Ua=a.a.create({Extends:_r,isAxisNetHelper:!0,className:"AxisNetHelper",size:5,constructor:function(t){Ua.superclass.constructor.call(this,t),this.color=this.color||new v.a(.5,.5,.5);for(var e=new Z({mode:Fa}),n=this.size,r=2*n+1,i=0;i<r;i++){var a=i/n-1;e.addLine([a,0,-1],[a,0,1]),e.addLine([-1,0,a],[1,0,a])}this.geometry=e,this.material=new en({diffuse:this.color,lightType:"NONE"})}}),Ga=Ua,Ba=P.a.LINES,Va=new c.a,Xa=a.a.create({Extends:_r,isCameraHelper:!0,className:"CameraHelper",camera:null,color:null,constructor:function(t){Xa.superclass.constructor.call(this,t),this.color||(this.color=new v.a(.3,.9,.6)),this.material=new en({lightType:"NONE",diffuse:this.color||new v.a(.5,.5,.5,1)}),this.geometry=new Z({mode:Ba,isStatic:!1,vertices:new b(new Float32Array(27),3),indices:new b(new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7,8,4,8,5,8,6,8,7]),1)})},onUpdate:function(){this.camera&&(this.camera.updateViewProjectionMatrix(),this._buildGeometry())},_buildGeometry:function(){var t=this.camera,e=this.geometry;e.vertices.set(0,t.unprojectVector(Va.set(-1,-1,1))),e.vertices.set(1,t.unprojectVector(Va.set(-1,1,1))),e.vertices.set(2,t.unprojectVector(Va.set(1,1,1))),e.vertices.set(3,t.unprojectVector(Va.set(1,-1,1))),e.vertices.set(4,t.unprojectVector(Va.set(-1,-1,-1))),e.vertices.set(5,t.unprojectVector(Va.set(-1,1,-1))),e.vertices.set(6,t.unprojectVector(Va.set(1,1,-1))),e.vertices.set(7,t.unprojectVector(Va.set(1,-1,-1))),e.vertices.set(8,t.worldMatrix.getTranslation(Va))}}),ja=Xa,ka=a.a.create({Extends:M,isAmbientLight:!0,className:"AmbientLight",autoUpdateWorldMatrix:!1,constructor:function(t){ka.superclass.constructor.call(this,t)}}),za=ka,Wa=a.a.create({Statics:{ltcTexture1:null,ltcTexture2:null,ltcTextureReady:!1,ltcTextureUrl:"//g.alicdn.com/tmapp/static/4.0.63/ltcTexture.js",loadLtcTexture:function(){var t=this;this.ltcTextureReady||void 0===this._loader&&(this._loader=new bi,this._loader.load({type:"json",src:this.ltcTextureUrl}).then((function(e){t._loader=null,t.ltcTexture1=new Le({data:e.ltcTexture1}),t.ltcTexture2=new Le({data:e.ltcTexture2}),t.ltcTextureReady=!0})))}},Extends:M,isAreaLight:!0,className:"AreaLight",width:10,height:10,_enabled:!0,enabled:{get:function(){return this._enabled&&Wa.ltcTextureReady},set:function(t){this._enabled=t}},constructor:function(t){Wa.superclass.constructor.call(this,t),Wa.loadLtcTexture()},ltcTexture1:{get:function(){return Wa.ltcTexture1},set:function(t){Wa.ltcTexture1=t}},ltcTexture2:{get:function(){return Wa.ltcTexture2},set:function(t){Wa.ltcTexture2=t}}}),Ya=Wa,qa=new en({lightType:"NONE"}),Za=new v.a(1,1,1),Ka=new v.a,Qa=a.a.create({isMeshPicker:!0,className:"MeshPicker",debug:!1,renderer:null,colorMeshMap:null,constructor:function(t){Object.assign(this,t),this.colorMeshMap={},this.init()},createFramebuffer:function(){if(!this.framebuffer){var t=this.renderer;this.framebuffer=new ce(t,{useVao:t.useVao,width:t.width,height:t.height})}},renderDebug:function(){this.framebuffer.render(0,.7,.3,.3)},createMeshNumberId:function(t){"numberId"in t||(t.numberId=10*Number(t.id.replace(/^.*_(\d+)$/,"$1")),t.color=Object(i.padLeft)(t.numberId.toString(16),6),this.colorMeshMap[t.color]=t)},renderColoredMeshes:function(){var t=this,e=this.renderer,n=this.framebuffer;n.bind(),e.clear(Za);var r=e.forceMaterial;e.forceMaterial=qa,e.renderList.traverse((function(n){t.createMeshNumberId(n),qa.diffuse.fromHEX(n.color),qa.isDirty=!0,e.renderMesh(n)})),e.forceMaterial=r,n.unbind()},getSelection:function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=this.renderer.pixelRatio,a=[],s=this.framebuffer.readPixels(t*i,e*i,n*i,r*i),o=0;o<s.length;o+=4){var u=Ka.fromUintArray(s,o).toHEX();this.colorMeshMap[u]&&a.push(this.colorMeshMap[u])}return a},init:function(){var t=this;this.createFramebuffer(),this.renderer.on("afterRender",(function(){t.renderColoredMeshes(),t.debug&&t.renderDebug()}))}}),Ja=a.a.create({constructor:function(t){this.targetFPS=t||60,this._tickers=[]},_paused:!1,_targetFPS:0,_interval:0,_intervalId:null,_tickers:null,_lastTime:0,_tickCount:0,_tickTime:0,_measuredFPS:0,targetFPS:{set:function(t){this._targetFPS=t,this._interval=1e3/this._targetFPS,this._intervalId&&(this._cancelRunLoop(),this._startRunLoop())},get:function(){return this._targetFPS}},start:function(){this._paused=!1,this._startRunLoop()},stop:function(){this._paused=!0,this._cancelRunLoop(),this._lastTime=0},pause:function(){this._paused=!0},resume:function(){this._paused=!1},_startRunLoop:function(){if(!this._intervalId){this._lastTime=+new Date;var t,e=this,n=this._interval,r=window.requestAnimationFrame;r&&n<17?(this._useRAF=!0,t=function(){e._intervalId=r(t),e._tick()}):(this._useRAF=!1,t=function(){e._intervalId=setTimeout(t,n),e._tick()}),t()}},_cancelRunLoop:function(){this._useRAF?(0,window.cancelAnimationFrame)(this._intervalId):clearTimeout(this._intervalId);this._intervalId=null},_tick:function(){if(!this._paused){var t=+new Date,e=t-this._lastTime,n=this._tickers;++this._tickCount>=this._targetFPS?(this._measuredFPS=1e3/(this._tickTime/this._tickCount)+.5>>0,this._tickCount=0,this._tickTime=0):this._tickTime+=t-this._lastTime,this._lastTime=t;for(var r=n.slice(0),i=0,a=r.length;i<a;i++)r[i].tick(e)}},getMeasuredFPS:function(){return Math.min(this._measuredFPS,this._targetFPS)},addTick:function(t){if(!t||"function"!=typeof t.tick)throw new Error("Ticker: The tick object must implement the tick method.");this._tickers.push(t)},removeTick:function(t){var e=this._tickers,n=e.indexOf(t);n>=0&&e.splice(n,1)},nextTick:function(t){var e=this,n={tick:function(r){e.removeTick(n),t(r)}};return e.addTick(n),n},timeout:function(t,e){var n=this,r=(new Date).getTime()+e,i={tick:function(){(new Date).getTime()-r>=0&&(n.removeTick(i),t())}};return n.addTick(i),i},interval:function(t,e){var n=(new Date).getTime()+e,r={tick:function(){var r=(new Date).getTime(),i=r-n;i>=0&&(i<e&&(r-=i),n=r+e,t())}};return this.addTick(r),r}}),$a={get:function(){if(void 0===this._isWebGLSupport)try{var t=document.createElement("canvas"),e=t.getContext("webgl");e.clearColor(0,1,0,1),e.clear(e.COLOR_BUFFER_BIT);var n=new Uint8Array(4);e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,n),0===n[0]&&255===n[1]&&0===n[2]&&255===n[3]?this._isWebGLSupport=!0:this._isWebGLSupport=!1,t=null,e=null,n=null}catch(t){this._isWebGLSupport=!1}return this._isWebGLSupport}},ts=n(27)},,,function(t,e,n){n(100),t.exports=n(106)}]),"undefined"!=typeof window&&window.Hilo3d&&"object"==typeof exports&&"object"==typeof module&&(module.exports=window.Hilo3d);
|