text: !function e(t,r,i){function n(a,s){if(!r[a]){if(!t[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var h=new Error("Cannot find module '"+a+"'");throw h.code="MODULE_NOT_FOUND",h}var l=r[a]={exports:{}};t[a][0].call(l.exports,function(e){var r=t[a][1][e];return n(r?r:e)},l,l.exports,e,t,r,i)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a<i.length;a++)n(i[a]);return n}({1:[function(e,t,r){(function(t){function r(){y++%2===0?h.render(l,u):(g.uniforms.resolution.value.set(a,s),v.render())}t.THREE=e("three");var i=e("three-effectcomposer")(THREE),n=e("./"),o=window.devicePixelRatio,a=512,s=512,c=document.createElement("canvas");c.width=a*o,c.height=s*o,c.style.width=a+"px",c.style.height=s+"px",document.body.appendChild(c);var h=new THREE.WebGLRenderer({antialias:!1,canvas:c});h.setClearColor(0,1);var l=new THREE.Scene,u=new THREE.PerspectiveCamera(50,a/s,.01,1e3);u.position.copy(new THREE.Vector3(3,2,-2)),u.lookAt(new THREE.Vector3);var p=new THREE.BoxGeometry(1,1,1),d=new THREE.MeshBasicMaterial({color:16777215}),f=new THREE.Mesh(p,d);l.add(f);var m=new THREE.WebGLRenderTarget(a*o,s*o);m.format=THREE.RGBFormat,m.minFilter=THREE.LinearFilter,m.generateMipmaps=!1;var v=new i(h,m);v.addPass(new i.RenderPass(l,u));var g=new i.ShaderPass(n());g.renderToScreen=!0,v.addPass(g);var y=0;r(),setInterval(r,1e3)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./":2,three:9,"three-effectcomposer":3}],2:[function(e,t,r){(function(e){function r(t){if("undefined"==typeof e.THREE)throw new TypeError("You must have THREE in global scope for this module.");return t=t||{},{uniforms:{tDiffuse:{type:"t",value:new THREE.Texture},resolution:{type:"v2",value:t.resolution||new THREE.Vector2}},vertexShader:"#define GLSLIFY 1\nvarying vec2 vUv;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nuniform vec2 resolution;\n\nvoid main() {\n  vUv = uv;\n  vec2 fragCoord = uv * resolution;\n  vec2 inverseVP = 1.0 / resolution.xy;\n  v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n  v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n  v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n  v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n  v_rgbM = vec2(fragCoord * inverseVP);\n\n  gl_Position = projectionMatrix *\n              modelViewMatrix *\n              vec4(position,1.0);\n}\n",fragmentShader:'#define GLSLIFY 1\nvarying vec2 vUv;\n\n//texcoords computed in vertex step\n//to avoid dependent texture reads\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\n//make sure to have a resolution uniform set to the screen size\nuniform vec2 resolution;\nuniform sampler2D tDiffuse;\n\n/**\nBasic FXAA implementation based on the code on geeks3d.com with the\nmodification that the texture2DLod stuff was removed since it\'s\nunsupported by WebGL.\n\n--\n\nFrom:\nhttps://github.com/mitsuhiko/webgl-meincraft\n\nCopyright (c) 2011 by Armin Ronacher.\n\nSome rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n\n    * Redistributions in binary form must reproduce the above\n      copyright notice, this list of conditions and the following\n      disclaimer in the documentation and/or other materials provided\n      with the distribution.\n\n    * The names of the contributors may not be used to endorse or\n      promote products derived from this software without specific\n      prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n#ifndef FXAA_REDUCE_MIN\n    #define FXAA_REDUCE_MIN   (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n    #define FXAA_REDUCE_MUL   (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n    #define FXAA_SPAN_MAX     8.0\n#endif\n\n//optimized version for mobile, where dependent \n//texture reads can be a bottleneck\nvec4 fxaa_1540259130(sampler2D tex, vec2 fragCoord, vec2 resolution,\n            vec2 v_rgbNW, vec2 v_rgbNE, \n            vec2 v_rgbSW, vec2 v_rgbSE, \n            vec2 v_rgbM) {\n    vec4 color;\n    mediump vec2 inverseVP = vec2(1.0 / resolution.x, 1.0 / resolution.y);\n    vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n    vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n    vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n    vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n    vec4 texColor = texture2D(tex, v_rgbM);\n    vec3 rgbM  = texColor.xyz;\n    vec3 luma = vec3(0.299, 0.587, 0.114);\n    float lumaNW = dot(rgbNW, luma);\n    float lumaNE = dot(rgbNE, luma);\n    float lumaSW = dot(rgbSW, luma);\n    float lumaSE = dot(rgbSE, luma);\n    float lumaM  = dot(rgbM,  luma);\n    float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n    float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n    \n    mediump vec2 dir;\n    dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n    dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n    \n    float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n                          (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n    \n    float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n    dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n              max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n              dir * rcpDirMin)) * inverseVP;\n    \n    vec3 rgbA = 0.5 * (\n        texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n        texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n    vec3 rgbB = rgbA * 0.5 + 0.25 * (\n        texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n        texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n    float lumaB = dot(rgbB, luma);\n    if ((lumaB < lumaMin) || (lumaB > lumaMax))\n        color = vec4(rgbA, texColor.a);\n    else\n        color = vec4(rgbB, texColor.a);\n    return color;\n}\n\nvoid main() {\n  vec2 fragCoord = vUv * resolution;   \n  gl_FragColor = fxaa_1540259130(tDiffuse, fragCoord, resolution, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n'}}t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(e,t,r){t.exports=function(t){function r(e,r){if(this.renderer=e,void 0===r){var o=window.innerWidth||1,a=window.innerHeight||1,s={minFilter:t.LinearFilter,magFilter:t.LinearFilter,format:t.RGBFormat,stencilBuffer:!1};r=new t.WebGLRenderTarget(o,a,s)}this.renderTarget1=r,this.renderTarget2=r.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.passes=[],this.copyPass=new n(i)}var i=r.CopyShader=e("three-copyshader"),n=(r.RenderPass=e("./lib/renderpass")(t),r.ShaderPass=e("./lib/shaderpass")(t,r)),o=r.MaskPass=e("./lib/maskpass")(t),a=r.ClearMaskPass=e("./lib/clearmaskpass")(t);return r.prototype={swapBuffers:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e},addPass:function(e){this.passes.push(e)},insertPass:function(e,t){this.passes.splice(t,0,e)},render:function(e){this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2;var t,r,i=!1,n=this.passes.length;for(r=0;n>r;r++)if(t=this.passes[r],t.enabled){if(t.render(this.renderer,this.writeBuffer,this.readBuffer,e,i),t.needsSwap){if(i){var s=this.renderer.context;s.stencilFunc(s.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),s.stencilFunc(s.EQUAL,1,4294967295)}this.swapBuffers()}t instanceof o?i=!0:t instanceof a&&(i=!1)}},reset:function(e){void 0===e&&(e=this.renderTarget1.clone(),e.width=window.innerWidth,e.height=window.innerHeight),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2},setSize:function(e,t){var r=this.renderTarget1.clone();r.width=e,r.height=t,this.reset(r)}},r.camera=new t.OrthographicCamera(-1,1,1,-1,0,1),r.quad=new t.Mesh(new t.PlaneGeometry(2,2),null),r.scene=new t.Scene,r.scene.add(r.quad),r}},{"./lib/clearmaskpass":4,"./lib/maskpass":5,"./lib/renderpass":6,"./lib/shaderpass":7,"three-copyshader":8}],4:[function(e,t,r){t.exports=function(e){function t(){return this instanceof t?void(this.enabled=!0):new t(scene,camera)}return t.prototype={render:function(e,t,r,i){var n=e.context;n.disable(n.STENCIL_TEST)}},t}},{}],5:[function(e,t,r){t.exports=function(e){function t(e,r){return this instanceof t?(this.scene=e,this.camera=r,this.enabled=!0,this.clear=!0,this.needsSwap=!1,void(this.inverse=!1)):new t(e,r)}return t.prototype={render:function(e,t,r,i){var n=e.context;n.colorMask(!1,!1,!1,!1),n.depthMask(!1);var o,a;this.inverse?(o=0,a=1):(o=1,a=0),n.enable(n.STENCIL_TEST),n.stencilOp(n.REPLACE,n.REPLACE,n.REPLACE),n.stencilFunc(n.ALWAYS,o,4294967295),n.clearStencil(a),e.render(this.scene,this.camera,r,this.clear),e.render(this.scene,this.camera,t,this.clear),n.colorMask(!0,!0,!0,!0),n.depthMask(!0),n.stencilFunc(n.EQUAL,1,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP)}},t}},{}],6:[function(e,t,r){t.exports=function(e){function t(r,i,n,o,a){return this instanceof t?(this.scene=r,this.camera=i,this.overrideMaterial=n,this.clearColor=o,this.clearAlpha=void 0!==a?a:1,this.oldClearColor=new e.Color,this.oldClearAlpha=1,this.enabled=!0,this.clear=!0,void(this.needsSwap=!1)):new t(r,i,n,o,a)}return t.prototype={render:function(e,t,r,i){this.scene.overrideMaterial=this.overrideMaterial,this.clearColor&&(this.oldClearColor.copy(e.getClearColor()),this.oldClearAlpha=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),e.render(this.scene,this.camera,r,this.clear),this.clearColor&&e.setClearColor(this.oldClearColor,this.oldClearAlpha),this.scene.overrideMaterial=null}},t}},{}],7:[function(e,t,r){t.exports=function(e,t){function r(t,i){return this instanceof r?(this.textureID=void 0!==i?i:"tDiffuse",this.uniforms=e.UniformsUtils.clone(t.uniforms),this.material=new e.ShaderMaterial({uniforms:this.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader}),this.renderToScreen=!1,this.enabled=!0,this.needsSwap=!0,void(this.clear=!1)):new r(t,i)}return r.prototype={render:function(e,r,i,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=i),t.quad.material=this.material,this.renderToScreen?e.render(t.scene,t.camera):e.render(t.scene,t.camera,r,this.clear)}},r}},{}],8:[function(e,t,r){t.exports={uniforms:{tDiffuse:{type:"t",value:null},opacity:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")}},{}],9:[function(e,t,r){var i={REVISION:"75"};"function"==typeof define&&define.amd?define("three",i):"undefined"!=typeof r&&"undefined"!=typeof t&&(t.exports=i),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(e){return 0>e?-1:e>0?1:+e}),void 0===Function.prototype.name&&void 0!==Object.defineProperty&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&Object.defineProperty(Object,"assign",{writable:!0,configurable:!0,value:function(e){"use strict";if(void 0===e||null===e)throw new TypeError("Cannot convert first argument to object");for(var t=Object(e),r=1,i=arguments.length;r!==i;++r){var n=arguments[r];if(void 0!==n&&null!==n){n=Object(n);for(var o=Object.keys(n),a=0,s=o.length;a!==s;++a){var c=o[a],h=Object.getOwnPropertyDescriptor(n,c);void 0!==h&&h.enumerable&&(t[c]=n[c])}}}return t}}),i.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},i.CullFaceNone=0,i.CullFaceBack=1,i.CullFaceFront=2,i.CullFaceFrontBack=3,i.FrontFaceDirectionCW=0,i.FrontFaceDirectionCCW=1,i.BasicShadowMap=0,i.PCFShadowMap=1,i.PCFSoftShadowMap=2,i.FrontSide=0,i.BackSide=1,i.DoubleSide=2,i.FlatShading=1,i.SmoothShading=2,i.NoColors=0,i.FaceColors=1,i.VertexColors=2,i.NoBlending=0,i.NormalBlending=1,i.AdditiveBlending=2,i.SubtractiveBlending=3,i.MultiplyBlending=4,i.CustomBlending=5,i.AddEquation=100,i.SubtractEquation=101,i.ReverseSubtractEquation=102,i.MinEquation=103,i.MaxEquation=104,i.ZeroFactor=200,i.OneFactor=201,i.SrcColorFactor=202,i.OneMinusSrcColorFactor=203,i.SrcAlphaFactor=204,i.OneMinusSrcAlphaFactor=205,i.DstAlphaFactor=206,i.OneMinusDstAlphaFactor=207,i.DstColorFactor=208,i.OneMinusDstColorFactor=209,i.SrcAlphaSaturateFactor=210,i.NeverDepth=0,i.AlwaysDepth=1,i.LessDepth=2,i.LessEqualDepth=3,i.EqualDepth=4,i.GreaterEqualDepth=5,i.GreaterDepth=6,i.NotEqualDepth=7,i.MultiplyOperation=0,i.MixOperation=1,i.AddOperation=2,i.NoToneMapping=0,i.LinearToneMapping=1,i.ReinhardToneMapping=2,i.Uncharted2ToneMapping=3,i.CineonToneMapping=4,i.UVMapping=300,i.CubeReflectionMapping=301,i.CubeRefractionMapping=302,i.EquirectangularReflectionMapping=303,i.EquirectangularRefractionMapping=304,i.SphericalReflectionMapping=305,i.CubeUVReflectionMapping=306,i.CubeUVRefractionMapping=307,i.RepeatWrapping=1e3,i.ClampToEdgeWrapping=1001,i.MirroredRepeatWrapping=1002,i.NearestFilter=1003,i.NearestMipMapNearestFilter=1004,i.NearestMipMapLinearFilter=1005,i.LinearFilter=1006,i.LinearMipMapNearestFilter=1007,i.LinearMipMapLinearFilter=1008,i.UnsignedByteType=1009,i.ByteType=1010,i.ShortType=1011,i.UnsignedShortType=1012,i.IntType=1013,i.UnsignedIntType=1014,i.FloatType=1015,i.HalfFloatType=1025,i.UnsignedShort4444Type=1016,i.UnsignedShort5551Type=1017,i.UnsignedShort565Type=1018,i.AlphaFormat=1019,i.RGBFormat=1020,i.RGBAFormat=1021,i.LuminanceFormat=1022,i.LuminanceAlphaFormat=1023,i.RGBEFormat=i.RGBAFormat,i.RGB_S3TC_DXT1_Format=2001,i.RGBA_S3TC_DXT1_Format=2002,i.RGBA_S3TC_DXT3_Format=2003,i.RGBA_S3TC_DXT5_Format=2004,i.RGB_PVRTC_4BPPV1_Format=2100,i.RGB_PVRTC_2BPPV1_Format=2101,i.RGBA_PVRTC_4BPPV1_Format=2102,i.RGBA_PVRTC_2BPPV1_Format=2103,i.RGB_ETC1_Format=2151,i.LoopOnce=2200,i.LoopRepeat=2201,i.LoopPingPong=2202,i.InterpolateDiscrete=2300,i.InterpolateLinear=2301,i.InterpolateSmooth=2302,i.ZeroCurvatureEnding=2400,i.ZeroSlopeEnding=2401,i.WrapAroundEnding=2402,i.TrianglesDrawMode=0,i.TriangleStripDrawMode=1,i.TriangleFanDrawMode=2,i.LinearEncoding=3e3,i.sRGBEncoding=3001,i.GammaEncoding=3007,i.RGBEEncoding=3002,i.LogLuvEncoding=3003,i.RGBM7Encoding=3004,i.RGBM16Encoding=3005,i.RGBDEncoding=3006,i.Color=function(e){return 3===arguments.length?this.fromArray(arguments):this.set(e)},i.Color.prototype={constructor:i.Color,r:1,g:1,b:1,set:function(e){return e instanceof i.Color?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){this.r=e,this.g=e,this.b=e},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,r){return this.r=e,this.g=t,this.b=r,this},setHSL:function(){function e(e,t,r){return 0>r&&(r+=1),r>1&&(r-=1),1/6>r?e+6*(t-e)*r:.5>r?t:2/3>r?e+6*(t-e)*(2/3-r):e}return function(t,r,n){if(t=i.Math.euclideanModulo(t,1),r=i.Math.clamp(r,0,1),n=i.Math.clamp(n,0,1),0===r)this.r=this.g=this.b=n;else{var o=.5>=n?n*(1+r):n+r-n*r,a=2*n-o;this.r=e(a,o,t+1/3),this.g=e(a,o,t),this.b=e(a,o,t-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var n,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,t(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,t(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var s=parseFloat(n[1])/360,c=parseInt(n[2],10)/100,h=parseInt(n[3],10)/100;return t(n[5]),this.setHSL(s,c,h)}}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l=r[1],u=l.length;if(3===u)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}if(e&&e.length>0){var l=i.ColorKeywords[e];void 0!==l?this.setHex(l):console.warn("THREE.Color: Unknown color "+e)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var r=t>0?1/t:1;return this.r=Math.pow(e.r,r),this.g=Math.pow(e.g,r),this.b=Math.pow(e.b,r),this},convertGammaToLinear:function(){var e=this.r,t=this.g,r=this.b;return this.r=e*e,this.g=t*t,this.b=r*r,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t,r,i=e||{h:0,s:0,l:0},n=this.r,o=this.g,a=this.b,s=Math.max(n,o,a),c=Math.min(n,o,a),h=(c+s)/2;if(c===s)t=0,r=0;else{var l=s-c;switch(r=.5>=h?l/(s+c):l/(2-s-c),s){case n:t=(o-a)/l+(a>o?6:0);break;case o:t=(a-n)/l+2;break;case a:t=(n-o)/l+4}t/=6}return i.h=t,i.s=r,i.l=h,i},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,r){var i=this.getHSL();return i.h+=e,i.s+=t,i.l+=r,this.setHSL(i.h,i.s,i.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},i.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},i.Quaternion=function(e,t,r,i){this._x=e||0,this._y=t||0,this._z=r||0,this._w=void 0!==i?i:1},i.Quaternion.prototype={constructor:i.Quaternion,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(e instanceof i.Euler==!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var r=Math.cos(e._x/2),n=Math.cos(e._y/2),o=Math.cos(e._z/2),a=Math.sin(e._x/2),s=Math.sin(e._y/2),c=Math.sin(e._z/2),h=e.order;return"XYZ"===h?(this._x=a*n*o+r*s*c,this._y=r*s*o-a*n*c,this._z=r*n*c+a*s*o,this._w=r*n*o-a*s*c):"YXZ"===h?(this._x=a*n*o+r*s*c,this._y=r*s*o-a*n*c,this._z=r*n*c-a*s*o,this._w=r*n*o+a*s*c):"ZXY"===h?(this._x=a*n*o-r*s*c,this._y=r*s*o+a*n*c,this._z=r*n*c+a*s*o,this._w=r*n*o-a*s*c):"ZYX"===h?(this._x=a*n*o-r*s*c,this._y=r*s*o+a*n*c,this._z=r*n*c-a*s*o,this._w=r*n*o+a*s*c):"YZX"===h?(this._x=a*n*o+r*s*c,this._y=r*s*o+a*n*c,this._z=r*n*c-a*s*o,this._w=r*n*o-a*s*c):"XZY"===h&&(this._x=a*n*o-r*s*c,this._y=r*s*o-a*n*c,this._z=r*n*c+a*s*o,this._w=r*n*o+a*s*c),t!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,r=e.elements,i=r[0],n=r[4],o=r[8],a=r[1],s=r[5],c=r[9],h=r[2],l=r[6],u=r[10],p=i+s+u;return p>0?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(l-c)*t,this._y=(o-h)*t,this._z=(a-n)*t):i>s&&i>u?(t=2*Math.sqrt(1+i-s-u),this._w=(l-c)/t,this._x=.25*t,this._y=(n+a)/t,this._z=(o+h)/t):s>u?(t=2*Math.sqrt(1+s-i-u),this._w=(o-h)/t,this._x=(n+a)/t,this._y=.25*t,this._z=(c+l)/t):(t=2*Math.sqrt(1+u-i-s),this._w=(a-n)/t,this._x=(o+h)/t,this._y=(c+l)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t,r=1e-6;return function(n,o){return void 0===e&&(e=new i.Vector3),t=n.dot(o)+1,r>t?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,o),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize(),this}}(),inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},multiplyQuaternions:function(e,t){var r=e._x,i=e._y,n=e._z,o=e._w,a=t._x,s=t._y,c=t._z,h=t._w;return this._x=r*h+o*a+i*c-n*s,this._y=i*h+o*s+n*a-r*c,this._z=n*h+o*c+r*s-i*a,this._w=o*h-r*a-i*s-n*c,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,i=this._y,n=this._z,o=this._w,a=o*e._w+r*e._x+i*e._y+n*e._z;if(0>a?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=n,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(r+this._x),this._y=.5*(i+this._y),this._z=.5*(n+this._z),this;var c=Math.atan2(s,a),h=Math.sin((1-t)*c)/s,l=Math.sin(t*c)/s;return this._w=o*h+this._w*l,this._x=r*h+this._x*l,this._y=i*h+this._y*l,this._z=n*h+this._z*l,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},Object.assign(i.Quaternion,{slerp:function(e,t,r,i){return r.copy(e).slerp(t,i)},slerpFlat:function(e,t,r,i,n,o,a){var s=r[i+0],c=r[i+1],h=r[i+2],l=r[i+3],u=n[o+0],p=n[o+1],d=n[o+2],f=n[o+3];if(l!==f||s!==u||c!==p||h!==d){var m=1-a,v=s*u+c*p+h*d+l*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,a=Math.sin(a*b)/x}var _=a*g;if(s=s*m+u*_,c=c*m+p*_,h=h*m+d*_,l=l*m+f*_,m===1-a){var M=1/Math.sqrt(s*s+c*c+h*h+l*l);s*=M,c*=M,h*=M,l*=M}}e[t]=s,e[t+1]=c,e[t+2]=h,e[t+3]=l}}),i.Vector2=function(e,t){this.x=e||0,this.y=t||0},i.Vector2.prototype={constructor:i.Vector2,get width(){return this.x},set width(e){this.x=e},get height(){return this.y},set height(e){this.y=e},set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e):(this.x=0,this.y=0),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(){var e,t;return function(r,n){return void 0===e&&(e=new i.Vector2,t=new i.Vector2),e.set(r,r),t.set(n,n),this.clamp(e,t)}}(),clampLength:function(e,t){var r=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,r))/r),this},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var e=Math.atan2(this.y,this.x);return 0>e&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this},rotateAround:function(e,t){var r=Math.cos(t),i=Math.sin(t),n=this.x-e.x,o=this.y-e.y;return this.x=n*r-o*i+e.x,this.y=n*i+o*r+e.y,this}},i.Vector3=function(e,t,r){this.x=e||0,this.y=t||0,this.z=r||0},i.Vector3.prototype={constructor:i.Vector3,set:function(e,t,r){return this.x=e,this.y=t,this.z=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,
  this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e;return function(t){return t instanceof i.Euler==!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new i.Quaternion),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var e;return function(t,r){return void 0===e&&(e=new i.Quaternion),this.applyQuaternion(e.setFromAxisAngle(t,r)),this}}(),applyMatrix3:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6]*i,this.y=n[1]*t+n[4]*r+n[7]*i,this.z=n[2]*t+n[5]*r+n[8]*i,this},applyMatrix4:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i+n[12],this.y=n[1]*t+n[5]*r+n[9]*i+n[13],this.z=n[2]*t+n[6]*r+n[10]*i+n[14],this},applyProjection:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements,o=1/(n[3]*t+n[7]*r+n[11]*i+n[15]);return this.x=(n[0]*t+n[4]*r+n[8]*i+n[12])*o,this.y=(n[1]*t+n[5]*r+n[9]*i+n[13])*o,this.z=(n[2]*t+n[6]*r+n[10]*i+n[14])*o,this},applyQuaternion:function(e){var t=this.x,r=this.y,i=this.z,n=e.x,o=e.y,a=e.z,s=e.w,c=s*t+o*i-a*r,h=s*r+a*t-n*i,l=s*i+n*r-o*t,u=-n*t-o*r-a*i;return this.x=c*s+u*-n+h*-a-l*-o,this.y=h*s+u*-o+l*-n-c*-a,this.z=l*s+u*-a+c*-o-h*-n,this},project:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyProjection(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i,this.y=n[1]*t+n[5]*r+n[9]*i,this.z=n[2]*t+n[6]*r+n[10]*i,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e,t;return function(r,n){return void 0===e&&(e=new i.Vector3,t=new i.Vector3),e.set(r,r,r),t.set(n,n,n),this.clamp(e,t)}}(),clampLength:function(e,t){var r=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,r))/r),this},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var r=this.x,i=this.y,n=this.z;return this.x=i*e.z-n*e.y,this.y=n*e.x-r*e.z,this.z=r*e.y-i*e.x,this},crossVectors:function(e,t){var r=e.x,i=e.y,n=e.z,o=t.x,a=t.y,s=t.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*o,this},projectOnVector:function(){var e,t;return function(r){return void 0===e&&(e=new i.Vector3),e.copy(r).normalize(),t=this.dot(e),this.copy(e).multiplyScalar(t)}}(),projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new i.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new i.Vector3),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(i.Math.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromMatrixPosition:function(e){return this.setFromMatrixColumn(e,3)},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this},setFromMatrixColumn:function(e,t){return"number"==typeof e&&(console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index )."),e=arguments[1],t=arguments[0]),this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this}},i.Vector4=function(e,t,r,i){this.x=e||0,this.y=t||0,this.z=r||0,this.w=void 0!==i?i:1},i.Vector4.prototype={constructor:i.Vector4,set:function(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this.w*=e):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(e){var t=this.x,r=this.y,i=this.z,n=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*i+o[12]*n,this.y=o[1]*t+o[5]*r+o[9]*i+o[13]*n,this.z=o[2]*t+o[6]*r+o[10]*i+o[14]*n,this.w=o[3]*t+o[7]*r+o[11]*i+o[15]*n,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return 1e-4>t?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,r,i,n,o=.01,a=.1,s=e.elements,c=s[0],h=s[4],l=s[8],u=s[1],p=s[5],d=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(h-u)<o&&Math.abs(l-f)<o&&Math.abs(d-m)<o){if(Math.abs(h+u)<a&&Math.abs(l+f)<a&&Math.abs(d+m)<a&&Math.abs(c+p+v-3)<a)return this.set(1,0,0,0),this;t=Math.PI;var g=(c+1)/2,y=(p+1)/2,x=(v+1)/2,b=(h+u)/4,_=(l+f)/4,M=(d+m)/4;return g>y&&g>x?o>g?(r=0,i=.707106781,n=.707106781):(r=Math.sqrt(g),i=b/r,n=_/r):y>x?o>y?(r=.707106781,i=0,n=.707106781):(i=Math.sqrt(y),r=b/i,n=M/i):o>x?(r=.707106781,i=.707106781,n=0):(n=Math.sqrt(x),r=_/n,i=M/n),this.set(r,i,n,t),this}var w=Math.sqrt((m-d)*(m-d)+(l-f)*(l-f)+(u-h)*(u-h));return Math.abs(w)<.001&&(w=1),this.x=(m-d)/w,this.y=(l-f)/w,this.z=(u-h)/w,this.w=Math.acos((c+p+v-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(){var e,t;return function(r,n){return void 0===e&&(e=new i.Vector4,t=new i.Vector4),e.set(r,r,r,r),t.set(n,n,n,n),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this}},i.Euler=function(e,t,r,n){this._x=e||0,this._y=t||0,this._z=r||0,this._order=n||i.Euler.DefaultOrder},i.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],i.Euler.DefaultOrder="XYZ",i.Euler.prototype={constructor:i.Euler,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,r){var n=i.Math.clamp,o=e.elements,a=o[0],s=o[4],c=o[8],h=o[1],l=o[5],u=o[9],p=o[2],d=o[6],f=o[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(n(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(d,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-n(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(c,f),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-p,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(n(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-p,f),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===t?(this._y=Math.asin(-n(p,-1,1)),Math.abs(p)<.99999?(this._x=Math.atan2(d,f),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-s,l))):"YZX"===t?(this._z=Math.asin(n(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-p,a)):(this._x=0,this._y=Math.atan2(c,f))):"XZY"===t?(this._z=Math.asin(-n(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(d,l),this._y=Math.atan2(c,a)):(this._x=Math.atan2(-u,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,r!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,r,n){return void 0===e&&(e=new i.Matrix4),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,r,n),this}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new i.Quaternion;return function(t){e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new i.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},i.Line3=function(e,t){this.start=void 0!==e?e:new i.Vector3,this.end=void 0!==t?t:new i.Vector3},i.Line3.prototype={constructor:i.Line3,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},center:function(e){var t=e||new i.Vector3;return t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){var t=e||new i.Vector3;return t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var r=t||new i.Vector3;return this.delta(r).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new i.Vector3,t=new i.Vector3;return function(r,n){e.subVectors(r,this.start),t.subVectors(this.end,this.start);var o=t.dot(t),a=t.dot(e),s=a/o;return n&&(s=i.Math.clamp(s,0,1)),s}}(),closestPointToPoint:function(e,t,r){var n=this.closestPointToPointParameter(e,t),o=r||new i.Vector3;return this.delta(o).multiplyScalar(n).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},i.Box2=function(e,t){this.min=void 0!==e?e:new i.Vector2(+(1/0),+(1/0)),this.max=void 0!==t?t:new i.Vector2(-(1/0),-(1/0))},i.Box2.prototype={constructor:i.Box2,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;r>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new i.Vector2;return function(t,r){var i=e.copy(r).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=+(1/0),this.max.x=this.max.y=-(1/0),this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(e){var t=e||new i.Vector2;return t.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){var t=e||new i.Vector2;return t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y?!0:!1},getParameter:function(e,t){var r=t||new i.Vector2;return r.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y?!1:!0},clampPoint:function(e,t){var r=t||new i.Vector2;return r.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new i.Vector2;return function(t){var r=e.copy(t).clamp(this.min,this.max);return r.sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},i.Box3=function(e,t){this.min=void 0!==e?e:new i.Vector3(+(1/0),+(1/0),+(1/0)),this.max=void 0!==t?t:new i.Vector3(-(1/0),-(1/0),-(1/0))},i.Box3.prototype={constructor:i.Box3,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){this.makeEmpty();for(var t=+(1/0),r=+(1/0),i=+(1/0),n=-(1/0),o=-(1/0),a=-(1/0),s=0,c=e.length;c>s;s+=3){var h=e[s],l=e[s+1],u=e[s+2];t>h&&(t=h),r>l&&(r=l),i>u&&(i=u),h>n&&(n=h),l>o&&(o=l),u>a&&(a=u)}this.min.set(t,r,i),this.max.set(n,o,a)},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;r>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new i.Vector3;return function(t,r){var i=e.copy(r).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}}(),setFromObject:function(){var e;return function(t){void 0===e&&(e=new i.Box3);var r=this;return this.makeEmpty(),t.updateMatrixWorld(!0),t.traverse(function(t){var i=t.geometry;void 0!==i&&(null===i.boundingBox&&i.computeBoundingBox(),i.boundingBox.isEmpty()===!1&&(e.copy(i.boundingBox),e.applyMatrix4(t.matrixWorld),r.union(e)))}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=+(1/0),this.max.x=this.max.y=this.max.z=-(1/0),this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(e){var t=e||new i.Vector3;return t.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){var t=e||new i.Vector3;return t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z?!0:!1},getParameter:function(e,t){var r=t||new i.Vector3;return r.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z?!1:!0},intersectsSphere:function(){var e;return function(t){return void 0===e&&(e=new i.Vector3),this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(e){var t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=e.constant&&r>=e.constant},clampPoint:function(e,t){var r=t||new i.Vector3;return r.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new i.Vector3;return function(t){var r=e.copy(t).clamp(this.min,this.max);return r.sub(t).length()}}(),getBoundingSphere:function(){var e=new i.Vector3;return function(t){var r=t||new i.Sphere;return r.center=this.center(),r.radius=.5*this.size(e).length(),r}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3];return function(t){return e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.makeEmpty(),this.setFromPoints(e),this}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},i.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},i.Matrix3.prototype={constructor:i.Matrix3,set:function(e,t,r,i,n,o,a,s,c){var h=this.elements;return h[0]=e,h[1]=i,h[2]=a,h[3]=t,h[4]=n,h[5]=s,h[6]=r,h[7]=o,h[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToVector3Array:function(){var e;return function(t,r,n){void 0===e&&(e=new i.Vector3),void 0===r&&(r=0),void 0===n&&(n=t.length);for(var o=0,a=r;n>o;o+=3,a+=3)e.fromArray(t,a),e.applyMatrix3(this),e.toArray(t,a);return t}}(),applyToBuffer:function(){var e;return function(t,r,n){void 0===e&&(e=new i.Vector3),void 0===r&&(r=0),void 0===n&&(n=t.length/t.itemSize);for(var o=0,a=r;n>o;o++,a++)e.x=t.getX(a),e.y=t.getY(a),e.z=t.getZ(a),e.applyMatrix3(this),t.setXYZ(e.x,e.y,e.z);return t}}(),multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],a=e[5],s=e[6],c=e[7],h=e[8];return t*o*h-t*a*c-r*n*h+r*a*s+i*n*c-i*o*s},getInverse:function(e,t){e instanceof i.Matrix4&&console.warn("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var r=e.elements,n=this.elements,o=r[0],a=r[1],s=r[2],c=r[3],h=r[4],l=r[5],u=r[6],p=r[7],d=r[8],f=d*h-l*p,m=l*u-d*c,v=p*c-h*u,g=o*f+a*m+s*v;if(0===g){var y="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(y);return console.warn(y),this.identity()}return n[0]=f,n[1]=s*p-d*a,n[2]=l*a-s*h,n[3]=m,n[4]=d*o-s*u,n[5]=s*c-l*o,n[6]=v,n[7]=a*u-p*o,n[8]=h*o-a*c,this.multiplyScalar(1/g)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},flattenToArrayOffset:function(e,t){var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]}},i.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},i.Matrix4.prototype={constructor:i.Matrix4,set:function(e,t,r,i,n,o,a,s,c,h,l,u,p,d,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=r,v[12]=i,v[1]=n,v[5]=o,v[9]=a,v[13]=s,v[2]=c,v[6]=h,v[10]=l,v[14]=u,v[3]=p,v[7]=d,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new i.Matrix4).fromArray(this.elements)},copy:function(e){return this.elements.set(e.elements),this},copyPosition:function(e){var t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this},extractBasis:function(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this},extractRotation:function(){var e;return function(t){void 0===e&&(e=new i.Vector3);var r=this.elements,n=t.elements,o=1/e.setFromMatrixColumn(t,0).length(),a=1/e.setFromMatrixColumn(t,1).length(),s=1/e.setFromMatrixColumn(t,2).length();return r[0]=n[0]*o,r[1]=n[1]*o,r[2]=n[2]*o,r[4]=n[4]*a,r[5]=n[5]*a,r[6]=n[6]*a,r[8]=n[8]*s,r[9]=n[9]*s,r[10]=n[10]*s,this}}(),makeRotationFromEuler:function(e){e instanceof i.Euler==!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,r=e.x,n=e.y,o=e.z,a=Math.cos(r),s=Math.sin(r),c=Math.cos(n),h=Math.sin(n),l=Math.cos(o),u=Math.sin(o);if("XYZ"===e.order){var p=a*l,d=a*u,f=s*l,m=s*u;t[0]=c*l,t[4]=-c*u,t[8]=h,t[1]=d+f*h,t[5]=p-m*h,t[9]=-s*c,t[2]=m-p*h,t[6]=f+d*h,t[10]=a*c}else if("YXZ"===e.order){var v=c*l,g=c*u,y=h*l,x=h*u;t[0]=v+x*s,t[4]=y*s-g,t[8]=a*h,t[1]=a*u,t[5]=a*l,t[9]=-s,t[2]=g*s-y,t[6]=x+v*s,t[10]=a*c}else if("ZXY"===e.order){var v=c*l,g=c*u,y=h*l,x=h*u;t[0]=v-x*s,t[4]=-a*u,t[8]=y+g*s,t[1]=g+y*s,t[5]=a*l,t[9]=x-v*s,t[2]=-a*h,t[6]=s,t[10]=a*c}else if("ZYX"===e.order){var p=a*l,d=a*u,f=s*l,m=s*u;t[0]=c*l,t[4]=f*h-d,t[8]=p*h+m,t[1]=c*u,t[5]=m*h+p,t[9]=d*h-f,t[2]=-h,t[6]=s*c,t[10]=a*c}else if("YZX"===e.order){var b=a*c,_=a*h,M=s*c,w=s*h;t[0]=c*l,t[4]=w-b*u,t[8]=M*u+_,t[1]=u,t[5]=a*l,t[9]=-s*l,t[2]=-h*l,t[6]=_*u+M,t[10]=b-w*u}else if("XZY"===e.order){var b=a*c,_=a*h,M=s*c,w=s*h;t[0]=c*l,t[4]=-u,t[8]=h*l,t[1]=b*u+w,t[5]=a*l,t[9]=_*u-M,t[2]=M*u-_,t[6]=s*l,t[10]=w*u+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,r=e.x,i=e.y,n=e.z,o=e.w,a=r+r,s=i+i,c=n+n,h=r*a,l=r*s,u=r*c,p=i*s,d=i*c,f=n*c,m=o*a,v=o*s,g=o*c;return t[0]=1-(p+f),t[4]=l-g,t[8]=u+v,t[1]=l+g,t[5]=1-(h+f),t[9]=d-m,t[2]=u-v,t[6]=d+m,t[10]=1-(h+p),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e,t,r;return function(n,o,a){void 0===e&&(e=new i.Vector3),void 0===t&&(t=new i.Vector3),void 0===r&&(r=new i.Vector3);var s=this.elements;return r.subVectors(n,o).normalize(),0===r.lengthSq()&&(r.z=1),e.crossVectors(a,r).normalize(),0===e.lengthSq()&&(r.x+=1e-4,e.crossVectors(a,r).normalize()),t.crossVectors(r,e),s[0]=e.x,s[4]=t.x,s[8]=r.x,s[1]=e.y,s[5]=t.y,s[9]=r.y,s[2]=e.z,s[6]=t.z,s[10]=r.z,this}}(),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},multiplyMatrices:function(e,t){var r=e.elements,i=t.elements,n=this.elements,o=r[0],a=r[4],s=r[8],c=r[12],h=r[1],l=r[5],u=r[9],p=r[13],d=r[2],f=r[6],m=r[10],v=r[14],g=r[3],y=r[7],x=r[11],b=r[15],_=i[0],M=i[4],w=i[8],S=i[12],E=i[1],T=i[5],A=i[9],L=i[13],C=i[2],R=i[6],P=i[10],I=i[14],B=i[3],D=i[7],U=i[11],F=i[15];return n[0]=o*_+a*E+s*C+c*B,n[4]=o*M+a*T+s*R+c*D,n[8]=o*w+a*A+s*P+c*U,n[12]=o*S+a*L+s*I+c*F,n[1]=h*_+l*E+u*C+p*B,n[5]=h*M+l*T+u*R+p*D,n[9]=h*w+l*A+u*P+p*U,n[13]=h*S+l*L+u*I+p*F,n[2]=d*_+f*E+m*C+v*B,n[6]=d*M+f*T+m*R+v*D,n[10]=d*w+f*A+m*P+v*U,n[14]=d*S+f*L+m*I+v*F,n[3]=g*_+y*E+x*C+b*B,n[7]=g*M+y*T+x*R+b*D,n[11]=g*w+y*A+x*P+b*U,n[15]=g*S+y*L+x*I+b*F,this},multiplyToArray:function(e,t,r){var i=this.elements;return this.multiplyMatrices(e,t),r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToVector3Array:function(){var e;return function(t,r,n){void 0===e&&(e=new i.Vector3),void 0===r&&(r=0),void 0===n&&(n=t.length);for(var o=0,a=r;n>o;o+=3,a+=3)e.fromArray(t,a),e.applyMatrix4(this),e.toArray(t,a);return t}}(),applyToBuffer:function(){var e;return function(t,r,n){void 0===e&&(e=new i.Vector3),void 0===r&&(r=0),void 0===n&&(n=t.length/t.itemSize);for(var o=0,a=r;n>o;o++,a++)e.x=t.getX(a),
  e.y=t.getY(a),e.z=t.getZ(a),e.applyMatrix4(this),t.setXYZ(e.x,e.y,e.z);return t}}(),determinant:function(){var e=this.elements,t=e[0],r=e[4],i=e[8],n=e[12],o=e[1],a=e[5],s=e[9],c=e[13],h=e[2],l=e[6],u=e[10],p=e[14],d=e[3],f=e[7],m=e[11],v=e[15];return d*(+n*s*l-i*c*l-n*a*u+r*c*u+i*a*p-r*s*p)+f*(+t*s*p-t*c*u+n*o*u-i*o*p+i*c*h-n*s*h)+m*(+t*c*l-t*a*p-n*o*l+r*o*p+n*a*h-r*c*h)+v*(-i*a*h-t*s*l+t*a*u+i*o*l-r*o*u+r*s*h)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},flattenToArrayOffset:function(e,t){var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e},getPosition:function(){var e;return function(){return void 0===e&&(e=new i.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),e.setFromMatrixColumn(this,3)}}(),setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var r=this.elements,i=e.elements,n=i[0],o=i[1],a=i[2],s=i[3],c=i[4],h=i[5],l=i[6],u=i[7],p=i[8],d=i[9],f=i[10],m=i[11],v=i[12],g=i[13],y=i[14],x=i[15],b=d*y*u-g*f*u+g*l*m-h*y*m-d*l*x+h*f*x,_=v*f*u-p*y*u-v*l*m+c*y*m+p*l*x-c*f*x,M=p*g*u-v*d*u+v*h*m-c*g*m-p*h*x+c*d*x,w=v*d*l-p*g*l-v*h*f+c*g*f+p*h*y-c*d*y,S=n*b+o*_+a*M+s*w;if(0===S){var E="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(E);return console.warn(E),this.identity()}return r[0]=b,r[1]=g*f*s-d*y*s-g*a*m+o*y*m+d*a*x-o*f*x,r[2]=h*y*s-g*l*s+g*a*u-o*y*u-h*a*x+o*l*x,r[3]=d*l*s-h*f*s-d*a*u+o*f*u+h*a*m-o*l*m,r[4]=_,r[5]=p*y*s-v*f*s+v*a*m-n*y*m-p*a*x+n*f*x,r[6]=v*l*s-c*y*s-v*a*u+n*y*u+c*a*x-n*l*x,r[7]=c*f*s-p*l*s+p*a*u-n*f*u-c*a*m+n*l*m,r[8]=M,r[9]=v*d*s-p*g*s-v*o*m+n*g*m+p*o*x-n*d*x,r[10]=c*g*s-v*h*s+v*o*u-n*g*u-c*o*x+n*h*x,r[11]=p*h*s-c*d*s-p*o*u+n*d*u+c*o*m-n*h*m,r[12]=w,r[13]=p*g*a-v*d*a+v*o*f-n*g*f-p*o*y+n*d*y,r[14]=v*h*a-c*g*a-v*o*l+n*g*l+c*o*y-n*h*y,r[15]=c*d*a-p*h*a+p*o*l-n*d*l-c*o*f+n*h*f,this.multiplyScalar(1/S)},scale:function(e){var t=this.elements,r=e.x,i=e.y,n=e.z;return t[0]*=r,t[4]*=i,t[8]*=n,t[1]*=r,t[5]*=i,t[9]*=n,t[2]*=r,t[6]*=i,t[10]*=n,t[3]*=r,t[7]*=i,t[11]*=n,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))},makeTranslation:function(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var r=Math.cos(t),i=Math.sin(t),n=1-r,o=e.x,a=e.y,s=e.z,c=n*o,h=n*a;return this.set(c*o+r,c*a-i*s,c*s+i*a,0,c*a+i*s,h*a+r,h*s-i*o,0,c*s-i*a,h*s+i*o,n*s*s+r,0,0,0,0,1),this},makeScale:function(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this},compose:function(e,t,r){return this.makeRotationFromQuaternion(t),this.scale(r),this.setPosition(e),this},decompose:function(){var e,t;return function(r,n,o){void 0===e&&(e=new i.Vector3),void 0===t&&(t=new i.Matrix4);var a=this.elements,s=e.set(a[0],a[1],a[2]).length(),c=e.set(a[4],a[5],a[6]).length(),h=e.set(a[8],a[9],a[10]).length(),l=this.determinant();0>l&&(s=-s),r.x=a[12],r.y=a[13],r.z=a[14],t.elements.set(this.elements);var u=1/s,p=1/c,d=1/h;return t.elements[0]*=u,t.elements[1]*=u,t.elements[2]*=u,t.elements[4]*=p,t.elements[5]*=p,t.elements[6]*=p,t.elements[8]*=d,t.elements[9]*=d,t.elements[10]*=d,n.setFromRotationMatrix(t),o.x=s,o.y=c,o.z=h,this}}(),makeFrustum:function(e,t,r,i,n,o){var a=this.elements,s=2*n/(t-e),c=2*n/(i-r),h=(t+e)/(t-e),l=(i+r)/(i-r),u=-(o+n)/(o-n),p=-2*o*n/(o-n);return a[0]=s,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=c,a[9]=l,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(e,t,r,n){var o=r*Math.tan(i.Math.degToRad(.5*e)),a=-o,s=a*t,c=o*t;return this.makeFrustum(s,c,a,o,r,n)},makeOrthographic:function(e,t,r,i,n,o){var a=this.elements,s=1/(t-e),c=1/(r-i),h=1/(o-n),l=(t+e)*s,u=(r+i)*c,p=(o+n)*h;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-l,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2*h,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(e){for(var t=this.elements,r=e.elements,i=0;16>i;i++)if(t[i]!==r[i])return!1;return!0},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]}},i.Ray=function(e,t){this.origin=void 0!==e?e:new i.Vector3,this.direction=void 0!==t?t:new i.Vector3},i.Ray.prototype={constructor:i.Ray,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){var r=t||new i.Vector3;return r.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){this.direction.copy(e).sub(this.origin).normalize()},recast:function(){var e=new i.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var r=t||new i.Vector3;r.subVectors(e,this.origin);var n=r.dot(this.direction);return 0>n?r.copy(this.origin):r.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new i.Vector3;return function(t){var r=e.subVectors(t,this.origin).dot(this.direction);return 0>r?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(r).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new i.Vector3,t=new i.Vector3,r=new i.Vector3;return function(i,n,o,a){e.copy(i).add(n).multiplyScalar(.5),t.copy(n).sub(i).normalize(),r.copy(this.origin).sub(e);var s,c,h,l,u=.5*i.distanceTo(n),p=-this.direction.dot(t),d=r.dot(this.direction),f=-r.dot(t),m=r.lengthSq(),v=Math.abs(1-p*p);if(v>0)if(s=p*f-d,c=p*d-f,l=u*v,s>=0)if(c>=-l)if(l>=c){var g=1/v;s*=g,c*=g,h=s*(s+p*c+2*d)+c*(p*s+c+2*f)+m}else c=u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;else c=-u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;else-l>=c?(s=Math.max(0,-(-p*u+d)),c=s>0?-u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m):l>=c?(s=0,c=Math.min(Math.max(-u,-f),u),h=c*(c+2*f)+m):(s=Math.max(0,-(p*u+d)),c=s>0?u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m);else c=p>0?-u:u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(t).multiplyScalar(c).add(e),h}}(),intersectSphere:function(){var e=new i.Vector3;return function(t,r){e.subVectors(t.center,this.origin);var i=e.dot(this.direction),n=e.dot(e)-i*i,o=t.radius*t.radius;if(n>o)return null;var a=Math.sqrt(o-n),s=i-a,c=i+a;return 0>s&&0>c?null:0>s?this.at(c,r):this.at(s,r)}}(),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null},intersectPlane:function(e,t){var r=this.distanceToPlane(e);return null===r?null:this.at(r,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);if(0===t)return!0;var r=e.normal.dot(this.direction);return 0>r*t?!0:!1},intersectBox:function(e,t){var r,i,n,o,a,s,c=1/this.direction.x,h=1/this.direction.y,l=1/this.direction.z,u=this.origin;return c>=0?(r=(e.min.x-u.x)*c,i=(e.max.x-u.x)*c):(r=(e.max.x-u.x)*c,i=(e.min.x-u.x)*c),h>=0?(n=(e.min.y-u.y)*h,o=(e.max.y-u.y)*h):(n=(e.max.y-u.y)*h,o=(e.min.y-u.y)*h),r>o||n>i?null:((n>r||r!==r)&&(r=n),(i>o||i!==i)&&(i=o),l>=0?(a=(e.min.z-u.z)*l,s=(e.max.z-u.z)*l):(a=(e.max.z-u.z)*l,s=(e.min.z-u.z)*l),r>s||a>i?null:((a>r||r!==r)&&(r=a),(i>s||i!==i)&&(i=s),0>i?null:this.at(r>=0?r:i,t)))},intersectsBox:function(){var e=new i.Vector3;return function(t){return null!==this.intersectBox(t,e)}}(),intersectTriangle:function(){var e=new i.Vector3,t=new i.Vector3,r=new i.Vector3,n=new i.Vector3;return function(i,o,a,s,c){t.subVectors(o,i),r.subVectors(a,i),n.crossVectors(t,r);var h,l=this.direction.dot(n);if(l>0){if(s)return null;h=1}else{if(!(0>l))return null;h=-1,l=-l}e.subVectors(this.origin,i);var u=h*this.direction.dot(r.crossVectors(e,r));if(0>u)return null;var p=h*this.direction.dot(t.cross(e));if(0>p)return null;if(u+p>l)return null;var d=-h*e.dot(n);return 0>d?null:this.at(d/l,c)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},i.Sphere=function(e,t){this.center=void 0!==e?e:new i.Vector3,this.radius=void 0!==t?t:0},i.Sphere.prototype={constructor:i.Sphere,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new i.Box3;return function(t,r){var i=this.center;void 0!==r?i.copy(r):e.setFromPoints(t).center(i);for(var n=0,o=0,a=t.length;a>o;o++)n=Math.max(n,i.distanceToSquared(t[o]));return this.radius=Math.sqrt(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(this.center.dot(e.normal)-e.constant)<=this.radius},clampPoint:function(e,t){var r=this.center.distanceToSquared(e),n=t||new i.Vector3;return n.copy(e),r>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(e){var t=e||new i.Box3;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},i.Frustum=function(e,t,r,n,o,a){this.planes=[void 0!==e?e:new i.Plane,void 0!==t?t:new i.Plane,void 0!==r?r:new i.Plane,void 0!==n?n:new i.Plane,void 0!==o?o:new i.Plane,void 0!==a?a:new i.Plane]},i.Frustum.prototype={constructor:i.Frustum,set:function(e,t,r,i,n,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(i),a[4].copy(n),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,r=0;6>r;r++)t[r].copy(e.planes[r]);return this},setFromMatrix:function(e){var t=this.planes,r=e.elements,i=r[0],n=r[1],o=r[2],a=r[3],s=r[4],c=r[5],h=r[6],l=r[7],u=r[8],p=r[9],d=r[10],f=r[11],m=r[12],v=r[13],g=r[14],y=r[15];return t[0].setComponents(a-i,l-s,f-u,y-m).normalize(),t[1].setComponents(a+i,l+s,f+u,y+m).normalize(),t[2].setComponents(a+n,l+c,f+p,y+v).normalize(),t[3].setComponents(a-n,l-c,f-p,y-v).normalize(),t[4].setComponents(a-o,l-h,f-d,y-g).normalize(),t[5].setComponents(a+o,l+h,f+d,y+g).normalize(),this},intersectsObject:function(){var e=new i.Sphere;return function(t){var r=t.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),e.copy(r.boundingSphere),e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,r=e.center,i=-e.radius,n=0;6>n;n++){var o=t[n].distanceToPoint(r);if(i>o)return!1}return!0},intersectsBox:function(){var e=new i.Vector3,t=new i.Vector3;return function(r){for(var i=this.planes,n=0;6>n;n++){var o=i[n];e.x=o.normal.x>0?r.min.x:r.max.x,t.x=o.normal.x>0?r.max.x:r.min.x,e.y=o.normal.y>0?r.min.y:r.max.y,t.y=o.normal.y>0?r.max.y:r.min.y,e.z=o.normal.z>0?r.min.z:r.max.z,t.z=o.normal.z>0?r.max.z:r.min.z;var a=o.distanceToPoint(e),s=o.distanceToPoint(t);if(0>a&&0>s)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,r=0;6>r;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}},i.Plane=function(e,t){this.normal=void 0!==e?e:new i.Vector3(1,0,0),this.constant=void 0!==t?t:0},i.Plane.prototype={constructor:i.Plane,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new i.Vector3,t=new i.Vector3;return function(r,i,n){var o=e.subVectors(n,i).cross(t.subVectors(r,i)).normalize();return this.setFromNormalAndCoplanarPoint(o,r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var r=this.distanceToPoint(e),n=t||new i.Vector3;return n.copy(this.normal).multiplyScalar(r)},intersectLine:function(){var e=new i.Vector3;return function(t,r){var n=r||new i.Vector3,o=t.delta(e),a=this.normal.dot(o);if(0!==a){var s=-(t.start.dot(this.normal)+this.constant)/a;if(!(0>s||s>1))return n.copy(o).multiplyScalar(s).add(t.start)}else if(0===this.distanceToPoint(t.start))return n.copy(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return 0>t&&r>0||0>r&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){var t=e||new i.Vector3;return t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new i.Vector3,t=new i.Vector3,r=new i.Matrix3;return function(i,n){var o=n||r.getNormalMatrix(i),a=e.copy(this.normal).applyMatrix3(o),s=this.coplanarPoint(t);return s.applyMatrix4(i),this.setFromNormalAndCoplanarPoint(a,s),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},i.Spherical=function(e,t,r){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==r?r:0,this},i.Spherical.prototype={constructor:i.Spherical,set:function(e,t,r){this.radius=e,this.phi=t,this.theta=r},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius.copy(e.radius),this.phi.copy(e.phi),this.theta.copy(e.theta),this},makeSafe:function(){var e=1e-6;this.phi=Math.max(e,Math.min(Math.PI-e,this.phi))},setFromVector3:function(e){return this.radius=e.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e.x,e.z),this.phi=Math.acos(i.Math.clamp(e.y/this.radius,-1,1))),this}},i.Math={generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=new Array(36),i=0;return function(){for(var n=0;36>n;n++)8===n||13===n||18===n||23===n?r[n]="-":14===n?r[n]="4":(2>=i&&(i=33554432+16777216*Math.random()|0),e=15&i,i>>=4,r[n]=t[19===n?3&e|8:e]);return r.join("")}}(),clamp:function(e,t,r){return Math.max(t,Math.min(r,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,r,i,n){return i+(e-t)*(n-i)/(r-t)},smoothstep:function(e,t,r){return t>=e?0:e>=r?1:(e=(e-t)/(r-t),e*e*(3-2*e))},smootherstep:function(e,t,r){return t>=e?0:e>=r?1:(e=(e-t)/(r-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(){var e=Math.PI/180;return function(t){return t*e}}(),radToDeg:function(){var e=180/Math.PI;return function(t){return t*e}}(),isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}},i.Spline=function(e){function t(e,t,r,i,n,o,a){var s=.5*(r-e),c=.5*(i-t);return(2*(t-r)+s+c)*a+(-3*(t-r)-2*s-c)*o+s*n+t}this.points=e;var r,n,o,a,s,c,h,l,u,p=[],d={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;t<e.length;t++)this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}},this.getPoint=function(e){return r=(this.points.length-1)*e,n=Math.floor(r),o=r-n,p[0]=0===n?n:n-1,p[1]=n,p[2]=n>this.points.length-2?this.points.length-1:n+1,p[3]=n>this.points.length-3?this.points.length-1:n+2,c=this.points[p[0]],h=this.points[p[1]],l=this.points[p[2]],u=this.points[p[3]],a=o*o,s=o*a,d.x=t(c.x,h.x,l.x,u.x,o,a,s),d.y=t(c.y,h.y,l.y,u.y,o,a,s),d.z=t(c.z,h.z,l.z,u.z,o,a,s),d},this.getControlPointsArray=function(){var e,t,r=this.points.length,i=[];for(e=0;r>e;e++)t=this.points[e],i[e]=[t.x,t.y,t.z];return i},this.getLength=function(e){var t,r,n,o,a=0,s=0,c=0,h=new i.Vector3,l=new i.Vector3,u=[],p=0;for(u[0]=0,e||(e=100),n=this.points.length*e,h.copy(this.points[0]),t=1;n>t;t++)r=t/n,o=this.getPoint(r),l.copy(o),p+=l.distanceTo(h),h.copy(o),a=(this.points.length-1)*r,s=Math.floor(a),s!==c&&(u[s]=p,c=s);return u[u.length]=p,{chunks:u,total:p}},this.reparametrizeByArcLength=function(e){var t,r,n,o,a,s,c,h,l=[],u=new i.Vector3,p=this.getLength();for(l.push(u.copy(this.points[0]).clone()),t=1;t<this.points.length;t++){for(s=p.chunks[t]-p.chunks[t-1],c=Math.ceil(e*s/p.total),o=(t-1)/(this.points.length-1),a=t/(this.points.length-1),r=1;c-1>r;r++)n=o+r*(1/c)*(a-o),h=this.getPoint(n),l.push(u.copy(h).clone());l.push(u.copy(this.points[t]).clone())}this.points=l}},i.Triangle=function(e,t,r){this.a=void 0!==e?e:new i.Vector3,this.b=void 0!==t?t:new i.Vector3,this.c=void 0!==r?r:new i.Vector3},i.Triangle.normal=function(){var e=new i.Vector3;return function(t,r,n,o){var a=o||new i.Vector3;a.subVectors(n,r),e.subVectors(t,r),a.cross(e);var s=a.lengthSq();return s>0?a.multiplyScalar(1/Math.sqrt(s)):a.set(0,0,0)}}(),i.Triangle.barycoordFromPoint=function(){var e=new i.Vector3,t=new i.Vector3,r=new i.Vector3;return function(n,o,a,s,c){e.subVectors(s,o),t.subVectors(a,o),r.subVectors(n,o);var h=e.dot(e),l=e.dot(t),u=e.dot(r),p=t.dot(t),d=t.dot(r),f=h*p-l*l,m=c||new i.Vector3;if(0===f)return m.set(-2,-1,-1);var v=1/f,g=(p*u-l*d)*v,y=(h*d-l*u)*v;return m.set(1-g-y,y,g)}}(),i.Triangle.containsPoint=function(){var e=new i.Vector3;return function(t,r,n,o){var a=i.Triangle.barycoordFromPoint(t,r,n,o,e);return a.x>=0&&a.y>=0&&a.x+a.y<=1}}(),i.Triangle.prototype={constructor:i.Triangle,set:function(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this},setFromPointsAndIndices:function(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new i.Vector3,t=new i.Vector3;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){var t=e||new i.Vector3;return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return i.Triangle.normal(this.a,this.b,this.c,e)},plane:function(e){var t=e||new i.Plane;return t.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return i.Triangle.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return i.Triangle.containsPoint(e,this.a,this.b,this.c)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},i.Interpolant=function(e,t,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(r),this.sampleValues=t,this.valueSize=r},i.Interpolant.prototype={constructor:i.Interpolant,evaluate:function(e){var t=this.parameterPositions,r=this._cachedIndex,i=t[r],n=t[r-1];e:{t:{var o;r:{i:if(!(i>e)){for(var a=r+2;;){if(void 0===i){if(n>e)break i;return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,e,n)}if(r===a)break;if(n=i,i=t[++r],i>e)break t}o=t.length;break r}{if(e>=n)break e;var s=t[1];s>e&&(r=2,n=s);for(var a=r-2;;){if(void 0===n)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(r===a)break;if(i=n,n=t[--r-1],e>=n)break t}o=r,r=0}}for(;o>r;){var c=r+o>>>1;e<t[c]?o=c:r=c+1}if(i=t[r],n=t[r-1],void 0===n)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(void 0===i)return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,n,e)}this._cachedIndex=r,this.intervalChanged_(r,n,i)}return this.interpolate_(r,n,e,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,n=e*i,o=0;o!==i;++o)t[o]=r[n+o];return t},interpolate_:function(e,t,r,i){throw new Error("call to abstract method")},intervalChanged_:function(e,t,r){}},Object.assign(i.Interpolant.prototype,{beforeStart_:i.Interpolant.prototype.copySampleValue_,afterEnd_:i.Interpolant.prototype.copySampleValue_}),i.CubicInterpolant=function(e,t,r,n){i.Interpolant.call(this,e,t,r,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0},i.CubicInterpolant.prototype=Object.assign(Object.create(i.Interpolant.prototype),{constructor:i.CubicInterpolant,DefaultSettings_:{endingStart:i.ZeroCurvatureEnding,endingEnd:i.ZeroCurvatureEnding},intervalChanged_:function(e,t,r){var n=this.parameterPositions,o=e-2,a=e+1,s=n[o],c=n[a];if(void 0===s)switch(this.getSettings_().endingStart){case i.ZeroSlopeEnding:o=e,s=2*t-r;break;case i.WrapAroundEnding:o=n.length-2,s=t+n[o]-n[o+1];break;default:o=e,s=r}if(void 0===c)switch(this.getSettings_().endingEnd){case i.ZeroSlopeEnding:a=e,c=2*r-t;break;case i.WrapAroundEnding:a=1,c=r+n[1]-n[0];break;default:a=e-1,c=t}var h=.5*(r-t),l=this.valueSize;this._weightPrev=h/(t-s),this._weightNext=h/(c-r),this._offsetPrev=o*l,this._offsetNext=a*l},interpolate_:function(e,t,r,i){for(var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,c=s-a,h=this._offsetPrev,l=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(r-t)/(i-t),f=d*d,m=f*d,v=-u*m+2*u*f-u*d,g=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,x=p*m-p*f,b=0;b!==a;++b)n[b]=v*o[h+b]+g*o[c+b]+y*o[s+b]+x*o[l+b];return n}}),i.DiscreteInterpolant=function(e,t,r,n){i.Interpolant.call(this,e,t,r,n)},i.DiscreteInterpolant.prototype=Object.assign(Object.create(i.Interpolant.prototype),{constructor:i.DiscreteInterpolant,interpolate_:function(e,t,r,i){return this.copySampleValue_(e-1)}}),i.LinearInterpolant=function(e,t,r,n){i.Interpolant.call(this,e,t,r,n)},i.LinearInterpolant.prototype=Object.assign(Object.create(i.Interpolant.prototype),{constructor:i.LinearInterpolant,interpolate_:function(e,t,r,i){for(var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,c=s-a,h=(r-t)/(i-t),l=1-h,u=0;u!==a;++u)n[u]=o[c+u]*l+o[s+u]*h;return n}}),i.QuaternionLinearInterpolant=function(e,t,r,n){i.Interpolant.call(this,e,t,r,n)},i.QuaternionLinearInterpolant.prototype=Object.assign(Object.create(i.Interpolant.prototype),{constructor:i.QuaternionLinearInterpolant,interpolate_:function(e,t,r,n){for(var o=this.resultBuffer,a=this.sampleValues,s=this.valueSize,c=e*s,h=(r-t)/(n-t),l=c+s;c!==l;c+=4)i.Quaternion.slerpFlat(o,0,a,c-s,a,c,h);return o}}),i.Clock=function(e){this.autoStart=void 0!==e?e:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},i.Clock.prototype={constructor:i.Clock,start:function(){this.startTime=performance.now(),this.oldTime=this.startTime,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running&&this.start(),this.running){var t=performance.now();e=.001*(t-this.oldTime),this.oldTime=t,this.elapsedTime+=e}return e}},i.EventDispatcher=function(){},i.EventDispatcher.prototype={constructor:i.EventDispatcher,apply:function(e){e.addEventListener=i.EventDispatcher.prototype.addEventListener,e.hasEventListener=i.EventDispatcher.prototype.hasEventListener,e.removeEventListener=i.EventDispatcher.prototype.removeEventListener,e.dispatchEvent=i.EventDispatcher.prototype.dispatchEvent},addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)?!0:!1},removeEventListener:function(e,t){if(void 0!==this._listeners){var r=this._listeners,i=r[e];if(void 0!==i){var n=i.indexOf(t);-1!==n&&i.splice(n,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners,r=t[e.type];if(void 0!==r){e.target=this;for(var i=[],n=r.length,o=0;n>o;o++)i[o]=r[o];for(var o=0;n>o;o++)i[o].call(this,e)}}}},i.Layers=function(){this.mask=1},i.Layers.prototype={constructor:i.Layers,set:function(e){this.mask=1<<e},enable:function(e){this.mask|=1<<e},toggle:function(e){this.mask^=1<<e},disable:function(e){this.mask&=~(1<<e)},test:function(e){return 0!==(this.mask&e.mask)}},function(e){function t(e,t){return e.distance-t.distance}function r(e,t,i,n){if(e.visible!==!1&&(e.raycast(t,i),n===!0))for(var o=e.children,a=0,s=o.length;s>a;a++)r(o[a],t,i,!0)}e.Raycaster=function(t,r,i,n){this.ray=new e.Ray(t,r),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})},e.Raycaster.prototype={constructor:e.Raycaster,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(t,r){r instanceof e.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(r.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(r).sub(this.ray.origin).normalize()):r instanceof e.OrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(r),this.ray.direction.set(0,0,-1).transformDirection(r.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,i){var n=[];return r(e,this,n,i),n.sort(t),n},intersectObjects:function(e,i){var n=[];if(Array.isArray(e)===!1)return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var o=0,a=e.length;a>o;o++)r(e[o],this,n,i);return n.sort(t),n}}}(i),i.Object3D=function(){function e(){o.setFromEuler(n,!1)}function t(){n.setFromQuaternion(o,void 0,!1)}Object.defineProperty(this,"id",{value:i.Object3DIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.Object3D.DefaultUp.clone();var r=new i.Vector3,n=new i.Euler,o=new i.Quaternion,a=new i.Vector3(1,1,1);n.onChange(e),o.onChange(t),Object.defineProperties(this,{position:{enumerable:!0,value:r},rotation:{enumerable:!0,value:n},quaternion:{enumerable:!0,value:o},scale:{enumerable:!0,value:a},modelViewMatrix:{value:new i.Matrix4},normalMatrix:{value:new i.Matrix3}}),this.rotationAutoUpdate=!0,this.matrix=new i.Matrix4,this.matrixWorld=new i.Matrix4,this.matrixAutoUpdate=i.Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new i.Layers,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},i.Object3D.DefaultUp=new i.Vector3(0,1,0),i.Object3D.DefaultMatrixAutoUpdate=!0,i.Object3D.prototype={constructor:i.Object3D,applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(){var e=new i.Quaternion;return function(t,r){return e.setFromAxisAngle(t,r),this.quaternion.multiply(e),this}}(),rotateX:function(){var e=new i.Vector3(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new i.Vector3(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new i.Vector3(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new i.Vector3;return function(t,r){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(r)),this}}(),translateX:function(){var e=new i.Vector3(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new i.Vector3(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new i.Vector3(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var e=new i.Matrix4;return function(t){return t.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new i.Matrix4;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e instanceof i.Object3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1)for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);var r=this.children.indexOf(e);-1!==r&&(e.parent=null,e.dispatchEvent({type:"removed"}),this.children.splice(r,1))},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var r=0,i=this.children.length;i>r;r++){var n=this.children[r],o=n.getObjectByProperty(e,t);if(void 0!==o)return o}},getWorldPosition:function(e){var t=e||new i.Vector3;return this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var e=new i.Vector3,t=new i.Vector3;return function(r){var n=r||new i.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,n,t),n}}(),getWorldRotation:function(){var e=new i.Quaternion;return function(t){var r=t||new i.Euler;return this.getWorldQuaternion(e),r.setFromQuaternion(e,this.rotation.order,!1)}}(),getWorldScale:function(){var e=new i.Vector3,t=new i.Quaternion;return function(r){var n=r||new i.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,n),n}}(),getWorldDirection:function(){var e=new i.Quaternion;return function(t){var r=t||new i.Vector3;return this.getWorldQuaternion(e),
  r.set(0,0,1).applyQuaternion(e)}}(),raycast:function(){},traverse:function(e){e(this);for(var t=this.children,r=0,i=t.length;i>r;r++)t[r].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=this.children,r=0,i=t.length;i>r;r++)t[r].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate===!0&&this.updateMatrix(),(this.matrixWorldNeedsUpdate===!0||e===!0)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=0,r=this.children.length;r>t;t++)this.children[t].updateMatrixWorld(e)},toJSON:function(e){function t(e){var t=[];for(var r in e){var i=e[r];delete i.metadata,t.push(i)}return t}var r=void 0===e,i={};r&&(e={geometries:{},materials:{},textures:{},images:{}},i.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var n={};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),this.castShadow===!0&&(n.castShadow=!0),this.receiveShadow===!0&&(n.receiveShadow=!0),this.visible===!1&&(n.visible=!1),n.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===e.geometries[this.geometry.uuid]&&(e.geometries[this.geometry.uuid]=this.geometry.toJSON(e)),n.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===e.materials[this.material.uuid]&&(e.materials[this.material.uuid]=this.material.toJSON(e)),n.material=this.material.uuid),this.children.length>0){n.children=[];for(var o=0;o<this.children.length;o++)n.children.push(this.children[o].toJSON(e).object)}if(r){var a=t(e.geometries),s=t(e.materials),c=t(e.textures),h=t(e.images);a.length>0&&(i.geometries=a),s.length>0&&(i.materials=s),c.length>0&&(i.textures=c),h.length>0&&(i.images=h)}return i.object=n,i},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.rotationAutoUpdate=e.rotationAutoUpdate,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(var r=0;r<e.children.length;r++){var i=e.children[r];this.add(i.clone())}return this}},i.EventDispatcher.prototype.apply(i.Object3D.prototype),i.Object3DIdCount=0,i.Face3=function(e,t,r,n,o,a){this.a=e,this.b=t,this.c=r,this.normal=n instanceof i.Vector3?n:new i.Vector3,this.vertexNormals=Array.isArray(n)?n:[],this.color=o instanceof i.Color?o:new i.Color,this.vertexColors=Array.isArray(o)?o:[],this.materialIndex=void 0!==a?a:0},i.Face3.prototype={constructor:i.Face3,clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,r=e.vertexNormals.length;r>t;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var t=0,r=e.vertexColors.length;r>t;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},i.BufferAttribute=function(e,t){this.uuid=i.Math.generateUUID(),this.array=e,this.itemSize=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},i.BufferAttribute.prototype={constructor:i.BufferAttribute,get count(){return this.array.length/this.itemSize},set needsUpdate(e){e===!0&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.dynamic=e.dynamic,this},copyAt:function(e,t,r){e*=this.itemSize,r*=t.itemSize;for(var i=0,n=this.itemSize;n>i;i++)this.array[e+i]=t.array[r+i];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,r=0,n=0,o=e.length;o>n;n++){var a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),a=new i.Color),t[r++]=a.r,t[r++]=a.g,t[r++]=a.b}return this},copyIndicesArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;n>i;i++){var o=e[i];t[r++]=o.a,t[r++]=o.b,t[r++]=o.c}return this},copyVector2sArray:function(e){for(var t=this.array,r=0,n=0,o=e.length;o>n;n++){var a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),a=new i.Vector2),t[r++]=a.x,t[r++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,r=0,n=0,o=e.length;o>n;n++){var a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),a=new i.Vector3),t[r++]=a.x,t[r++]=a.y,t[r++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,r=0,n=0,o=e.length;o>n;n++){var a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),a=new i.Vector4),t[r++]=a.x,t[r++]=a.y,t[r++]=a.z,t[r++]=a.w}return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this},setXYZ:function(e,t,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this},setXYZW:function(e,t,r,i,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=n,this},clone:function(){return(new this.constructor).copy(this)}},i.Int8Attribute=function(e,t){return new i.BufferAttribute(new Int8Array(e),t)},i.Uint8Attribute=function(e,t){return new i.BufferAttribute(new Uint8Array(e),t)},i.Uint8ClampedAttribute=function(e,t){return new i.BufferAttribute(new Uint8ClampedArray(e),t)},i.Int16Attribute=function(e,t){return new i.BufferAttribute(new Int16Array(e),t)},i.Uint16Attribute=function(e,t){return new i.BufferAttribute(new Uint16Array(e),t)},i.Int32Attribute=function(e,t){return new i.BufferAttribute(new Int32Array(e),t)},i.Uint32Attribute=function(e,t){return new i.BufferAttribute(new Uint32Array(e),t)},i.Float32Attribute=function(e,t){return new i.BufferAttribute(new Float32Array(e),t)},i.Float64Attribute=function(e,t){return new i.BufferAttribute(new Float64Array(e),t)},i.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new i.BufferAttribute(e,t).setDynamic(!0)},i.InstancedBufferAttribute=function(e,t,r){i.BufferAttribute.call(this,e,t),this.meshPerAttribute=r||1},i.InstancedBufferAttribute.prototype=Object.create(i.BufferAttribute.prototype),i.InstancedBufferAttribute.prototype.constructor=i.InstancedBufferAttribute,i.InstancedBufferAttribute.prototype.copy=function(e){return i.BufferAttribute.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},i.InterleavedBuffer=function(e,t){this.uuid=i.Math.generateUUID(),this.array=e,this.stride=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},i.InterleavedBuffer.prototype={constructor:i.InterleavedBuffer,get length(){return this.array.length},get count(){return this.array.length/this.stride},set needsUpdate(e){e===!0&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,r){e*=this.stride,r*=t.stride;for(var i=0,n=this.stride;n>i;i++)this.array[e+i]=t.array[r+i];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)}},i.InstancedInterleavedBuffer=function(e,t,r){i.InterleavedBuffer.call(this,e,t),this.meshPerAttribute=r||1},i.InstancedInterleavedBuffer.prototype=Object.create(i.InterleavedBuffer.prototype),i.InstancedInterleavedBuffer.prototype.constructor=i.InstancedInterleavedBuffer,i.InstancedInterleavedBuffer.prototype.copy=function(e){return i.InterleavedBuffer.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},i.InterleavedBufferAttribute=function(e,t,r){this.uuid=i.Math.generateUUID(),this.data=e,this.itemSize=t,this.offset=r},i.InterleavedBufferAttribute.prototype={constructor:i.InterleavedBufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.data.count},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this},setXYZ:function(e,t,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this},setXYZW:function(e,t,r,i,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this.data.array[e+3]=n,this}},i.Geometry=function(){Object.defineProperty(this,"id",{value:i.GeometryIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.elementsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1},i.Geometry.prototype={constructor:i.Geometry,applyMatrix:function(e){for(var t=(new i.Matrix3).getNormalMatrix(e),r=0,n=this.vertices.length;n>r;r++){var o=this.vertices[r];o.applyMatrix4(e)}for(var r=0,n=this.faces.length;n>r;r++){var a=this.faces[r];a.normal.applyMatrix3(t).normalize();for(var s=0,c=a.vertexNormals.length;c>s;s++)a.vertexNormals[s].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,r,n){return void 0===e&&(e=new i.Matrix4),e.makeTranslation(t,r,n),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,r,n){return void 0===e&&(e=new i.Matrix4),e.makeScale(t,r,n),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new i.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),fromBufferGeometry:function(e){function t(e,t,n,o){var a=void 0!==s?[u[e].clone(),u[t].clone(),u[n].clone()]:[],f=void 0!==c?[r.colors[e].clone(),r.colors[t].clone(),r.colors[n].clone()]:[],m=new i.Face3(e,t,n,a,f,o);r.faces.push(m),void 0!==h&&r.faceVertexUvs[0].push([p[e].clone(),p[t].clone(),p[n].clone()]),void 0!==l&&r.faceVertexUvs[1].push([d[e].clone(),d[t].clone(),d[n].clone()])}var r=this,n=null!==e.index?e.index.array:void 0,o=e.attributes,a=o.position.array,s=void 0!==o.normal?o.normal.array:void 0,c=void 0!==o.color?o.color.array:void 0,h=void 0!==o.uv?o.uv.array:void 0,l=void 0!==o.uv2?o.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var u=[],p=[],d=[],f=0,m=0;f<a.length;f+=3,m+=2)r.vertices.push(new i.Vector3(a[f],a[f+1],a[f+2])),void 0!==s&&u.push(new i.Vector3(s[f],s[f+1],s[f+2])),void 0!==c&&r.colors.push(new i.Color(c[f],c[f+1],c[f+2])),void 0!==h&&p.push(new i.Vector2(h[m],h[m+1])),void 0!==l&&d.push(new i.Vector2(l[m],l[m+1]));if(void 0!==n){var v=e.groups;if(v.length>0)for(var f=0;f<v.length;f++)for(var g=v[f],y=g.start,x=g.count,m=y,b=y+x;b>m;m+=3)t(n[m],n[m+1],n[m+2],g.materialIndex);else for(var f=0;f<n.length;f+=3)t(n[f],n[f+1],n[f+2])}else for(var f=0;f<a.length/3;f+=3)t(f,f+1,f+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.translate(e.x,e.y,e.z),e},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,r=0===t?1:1/t,n=new i.Matrix4;return n.set(r,0,0,-r*e.x,0,r,0,-r*e.y,0,0,r,-r*e.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var e=new i.Vector3,t=new i.Vector3,r=0,n=this.faces.length;n>r;r++){var o=this.faces[r],a=this.vertices[o.a],s=this.vertices[o.b],c=this.vertices[o.c];e.subVectors(c,s),t.subVectors(a,s),e.cross(t),e.normalize(),o.normal.copy(e)}},computeVertexNormals:function(e){void 0===e&&(e=!0);var t,r,n,o,a,s;for(s=new Array(this.vertices.length),t=0,r=this.vertices.length;r>t;t++)s[t]=new i.Vector3;if(e){var c,h,l,u=new i.Vector3,p=new i.Vector3;for(n=0,o=this.faces.length;o>n;n++)a=this.faces[n],c=this.vertices[a.a],h=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,h),p.subVectors(c,h),u.cross(p),s[a.a].add(u),s[a.b].add(u),s[a.c].add(u)}else for(n=0,o=this.faces.length;o>n;n++)a=this.faces[n],s[a.a].add(a.normal),s[a.b].add(a.normal),s[a.c].add(a.normal);for(t=0,r=this.vertices.length;r>t;t++)s[t].normalize();for(n=0,o=this.faces.length;o>n;n++){a=this.faces[n];var d=a.vertexNormals;3===d.length?(d[0].copy(s[a.a]),d[1].copy(s[a.b]),d[2].copy(s[a.c])):(d[0]=s[a.a].clone(),d[1]=s[a.b].clone(),d[2]=s[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,r,n,o;for(r=0,n=this.faces.length;n>r;r++)for(o=this.faces[r],o.__originalFaceNormal?o.__originalFaceNormal.copy(o.normal):o.__originalFaceNormal=o.normal.clone(),o.__originalVertexNormals||(o.__originalVertexNormals=[]),e=0,t=o.vertexNormals.length;t>e;e++)o.__originalVertexNormals[e]?o.__originalVertexNormals[e].copy(o.vertexNormals[e]):o.__originalVertexNormals[e]=o.vertexNormals[e].clone();var a=new i.Geometry;for(a.faces=this.faces,e=0,t=this.morphTargets.length;t>e;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var s,c,h=this.morphNormals[e].faceNormals,l=this.morphNormals[e].vertexNormals;for(r=0,n=this.faces.length;n>r;r++)s=new i.Vector3,c={a:new i.Vector3,b:new i.Vector3,c:new i.Vector3},h.push(s),l.push(c)}var u=this.morphNormals[e];a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals();var s,c;for(r=0,n=this.faces.length;n>r;r++)o=this.faces[r],s=u.faceNormals[r],c=u.vertexNormals[r],s.copy(o.normal),c.a.copy(o.vertexNormals[0]),c.b.copy(o.vertexNormals[1]),c.c.copy(o.vertexNormals[2])}for(r=0,n=this.faces.length;n>r;r++)o=this.faces[r],o.normal=o.__originalFaceNormal,o.vertexNormals=o.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var e=0,t=this.vertices,r=0,i=t.length;i>r;r++)r>0&&(e+=t[r].distanceTo(t[r-1])),this.lineDistances[r]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new i.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new i.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,r){if(e instanceof i.Geometry==!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);var n,o=this.vertices.length,a=this.vertices,s=e.vertices,c=this.faces,h=e.faces,l=this.faceVertexUvs[0],u=e.faceVertexUvs[0];void 0===r&&(r=0),void 0!==t&&(n=(new i.Matrix3).getNormalMatrix(t));for(var p=0,d=s.length;d>p;p++){var f=s[p],m=f.clone();void 0!==t&&m.applyMatrix4(t),a.push(m)}for(p=0,d=h.length;d>p;p++){var v,g,y,x=h[p],b=x.vertexNormals,_=x.vertexColors;v=new i.Face3(x.a+o,x.b+o,x.c+o),v.normal.copy(x.normal),void 0!==n&&v.normal.applyMatrix3(n).normalize();for(var M=0,w=b.length;w>M;M++)g=b[M].clone(),void 0!==n&&g.applyMatrix3(n).normalize(),v.vertexNormals.push(g);v.color.copy(x.color);for(var M=0,w=_.length;w>M;M++)y=_[M],v.vertexColors.push(y.clone());v.materialIndex=x.materialIndex+r,c.push(v)}for(p=0,d=u.length;d>p;p++){var S=u[p],E=[];if(void 0!==S){for(var M=0,w=S.length;w>M;M++)E.push(S[M].clone());l.push(E)}}},mergeMesh:function(e){return e instanceof i.Mesh==!1?void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e):(e.matrixAutoUpdate&&e.updateMatrix(),void this.merge(e.geometry,e.matrix))},mergeVertices:function(){var e,t,r,i,n,o,a,s,c={},h=[],l=[],u=4,p=Math.pow(10,u);for(r=0,i=this.vertices.length;i>r;r++)e=this.vertices[r],t=Math.round(e.x*p)+"_"+Math.round(e.y*p)+"_"+Math.round(e.z*p),void 0===c[t]?(c[t]=r,h.push(this.vertices[r]),l[r]=h.length-1):l[r]=l[c[t]];var d=[];for(r=0,i=this.faces.length;i>r;r++){n=this.faces[r],n.a=l[n.a],n.b=l[n.b],n.c=l[n.c],o=[n.a,n.b,n.c];for(var f=-1,m=0;3>m;m++)if(o[m]===o[(m+1)%3]){f=m,d.push(r);break}}for(r=d.length-1;r>=0;r--){var v=d[r];for(this.faces.splice(v,1),a=0,s=this.faceVertexUvs.length;s>a;a++)this.faceVertexUvs[a].splice(v,1)}var g=this.vertices.length-h.length;return this.vertices=h,g},sortFacesByMaterialIndex:function(){function e(e,t){return e.materialIndex-t.materialIndex}for(var t=this.faces,r=t.length,i=0;r>i;i++)t[i]._id=i;t.sort(e);var n,o,a=this.faceVertexUvs[0],s=this.faceVertexUvs[1];a&&a.length===r&&(n=[]),s&&s.length===r&&(o=[]);for(var i=0;r>i;i++){var c=t[i]._id;n&&n.push(a[c]),o&&o.push(s[c])}n&&(this.faceVertexUvs[0]=n),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){function e(e,t,r){return r?e|1<<t:e&~(1<<t)}function t(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==p[t]?p[t]:(p[t]=u.length/3,u.push(e.x,e.y,e.z),p[t])}function r(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==f[t]?f[t]:(f[t]=d.length,d.push(e.getHex()),f[t])}function i(e){var t=e.x.toString()+e.y.toString();return void 0!==v[t]?v[t]:(v[t]=m.length/2,m.push(e.x,e.y),v[t])}var n={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),void 0!==this.parameters){var o=this.parameters;for(var a in o)void 0!==o[a]&&(n[a]=o[a]);return n}for(var s=[],c=0;c<this.vertices.length;c++){var h=this.vertices[c];s.push(h.x,h.y,h.z)}for(var l=[],u=[],p={},d=[],f={},m=[],v={},c=0;c<this.faces.length;c++){var g=this.faces[c],y=!0,x=!1,b=void 0!==this.faceVertexUvs[0][c],_=g.normal.length()>0,M=g.vertexNormals.length>0,w=1!==g.color.r||1!==g.color.g||1!==g.color.b,S=g.vertexColors.length>0,E=0;if(E=e(E,0,0),E=e(E,1,y),E=e(E,2,x),E=e(E,3,b),E=e(E,4,_),E=e(E,5,M),E=e(E,6,w),E=e(E,7,S),l.push(E),l.push(g.a,g.b,g.c),l.push(g.materialIndex),b){var T=this.faceVertexUvs[0][c];l.push(i(T[0]),i(T[1]),i(T[2]))}if(_&&l.push(t(g.normal)),M){var A=g.vertexNormals;l.push(t(A[0]),t(A[1]),t(A[2]))}if(w&&l.push(r(g.color)),S){var L=g.vertexColors;l.push(r(L[0]),r(L[1]),r(L[2]))}}return n.data={},n.data.vertices=s,n.data.normals=u,d.length>0&&(n.data.colors=d),m.length>0&&(n.data.uvs=[m]),n.data.faces=l,n},clone:function(){return(new i.Geometry).copy(this)},copy:function(e){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var t=e.vertices,r=0,i=t.length;i>r;r++)this.vertices.push(t[r].clone());for(var n=e.faces,r=0,i=n.length;i>r;r++)this.faces.push(n[r].clone());for(var r=0,i=e.faceVertexUvs.length;i>r;r++){var o=e.faceVertexUvs[r];void 0===this.faceVertexUvs[r]&&(this.faceVertexUvs[r]=[]);for(var a=0,s=o.length;s>a;a++){for(var c=o[a],h=[],l=0,u=c.length;u>l;l++){var p=c[l];h.push(p.clone())}this.faceVertexUvs[r].push(h)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.Geometry.prototype),i.GeometryIdCount=0,i.DirectGeometry=function(){Object.defineProperty(this,"id",{value:i.GeometryIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="DirectGeometry",this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1},i.DirectGeometry.prototype={constructor:i.DirectGeometry,computeBoundingBox:i.Geometry.prototype.computeBoundingBox,computeBoundingSphere:i.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(e){for(var t,r,i=[],n=e.faces,o=0;o<n.length;o++){var a=n[o];a.materialIndex!==r&&(r=a.materialIndex,void 0!==t&&(t.count=3*o-t.start,i.push(t)),t={start:3*o,materialIndex:r})}void 0!==t&&(t.count=3*o-t.start,i.push(t)),this.groups=i},fromGeometry:function(e){var t,r=e.faces,n=e.vertices,o=e.faceVertexUvs,a=o[0]&&o[0].length>0,s=o[1]&&o[1].length>0,c=e.morphTargets,h=c.length;if(h>0){t=[];for(var l=0;h>l;l++)t[l]=[];this.morphTargets.position=t}var u,p=e.morphNormals,d=p.length;if(d>0){u=[];for(var l=0;d>l;l++)u[l]=[];this.morphTargets.normal=u}for(var f=e.skinIndices,m=e.skinWeights,v=f.length===n.length,g=m.length===n.length,l=0;l<r.length;l++){var y=r[l];this.vertices.push(n[y.a],n[y.b],n[y.c]);var x=y.vertexNormals;if(3===x.length)this.normals.push(x[0],x[1],x[2]);else{var b=y.normal;this.normals.push(b,b,b)}var _=y.vertexColors;if(3===_.length)this.colors.push(_[0],_[1],_[2]);else{var M=y.color;this.colors.push(M,M,M)}if(a===!0){var w=o[0][l];void 0!==w?this.uvs.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new i.Vector2,new i.Vector2,new i.Vector2))}if(s===!0){var w=o[1][l];void 0!==w?this.uvs2.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new i.Vector2,new i.Vector2,new i.Vector2))}for(var S=0;h>S;S++){var E=c[S].vertices;t[S].push(E[y.a],E[y.b],E[y.c])}for(var S=0;d>S;S++){var T=p[S].vertexNormals[l];u[S].push(T.a,T.b,T.c)}v&&this.skinIndices.push(f[y.a],f[y.b],f[y.c]),g&&this.skinWeights.push(m[y.a],m[y.b],m[y.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.DirectGeometry.prototype),i.BufferGeometry=function(){Object.defineProperty(this,"id",{value:i.GeometryIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}},i.BufferGeometry.prototype={constructor:i.BufferGeometry,getIndex:function(){return this.index},setIndex:function(e){this.index=e},addAttribute:function(e,t){return t instanceof i.BufferAttribute==!1&&t instanceof i.InterleavedBufferAttribute==!1?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new i.BufferAttribute(arguments[1],arguments[2]))):"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):(this.attributes[e]=t,this)},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,r){this.groups.push({start:e,count:t,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToVector3Array(t.array),t.needsUpdate=!0);var r=this.attributes.normal;if(void 0!==r){var n=(new i.Matrix3).getNormalMatrix(e);n.applyToVector3Array(r.array),r.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,r,n){return void 0===e&&(e=new i.Matrix4),e.makeTranslation(t,r,n),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,r,n){return void 0===e&&(e=new i.Matrix4),e.makeScale(t,r,n),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new i.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e instanceof i.Points||e instanceof i.Line){var r=new i.Float32Attribute(3*t.vertices.length,3),n=new i.Float32Attribute(3*t.colors.length,3);if(this.addAttribute("position",r.copyVector3sArray(t.vertices)),this.addAttribute("color",n.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var o=new i.Float32Attribute(t.lineDistances.length,1);this.addAttribute("lineDistance",o.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e instanceof i.Mesh&&t instanceof i.Geometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t=e.geometry;if(e instanceof i.Mesh){var r=t.__directGeometry;if(void 0===r)return this.fromGeometry(t);r.verticesNeedUpdate=t.verticesNeedUpdate,r.normalsNeedUpdate=t.normalsNeedUpdate,r.colorsNeedUpdate=t.colorsNeedUpdate,r.uvsNeedUpdate=t.uvsNeedUpdate,r.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=r}if(t.verticesNeedUpdate===!0){var n=this.attributes.position;void 0!==n&&(n.copyVector3sArray(t.vertices),n.needsUpdate=!0),t.verticesNeedUpdate=!1}if(t.normalsNeedUpdate===!0){var n=this.attributes.normal;void 0!==n&&(n.copyVector3sArray(t.normals),n.needsUpdate=!0),t.normalsNeedUpdate=!1}if(t.colorsNeedUpdate===!0){var n=this.attributes.color;void 0!==n&&(n.copyColorsArray(t.colors),n.needsUpdate=!0),t.colorsNeedUpdate=!1}if(t.uvsNeedUpdate){var n=this.attributes.uv;void 0!==n&&(n.copyVector2sArray(t.uvs),n.needsUpdate=!0),t.uvsNeedUpdate=!1}if(t.lineDistancesNeedUpdate){var n=this.attributes.lineDistance;void 0!==n&&(n.copyArray(t.lineDistances),n.needsUpdate=!0),t.lineDistancesNeedUpdate=!1}return t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new i.DirectGeometry).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new i.BufferAttribute(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var r=new Float32Array(3*e.normals.length);this.addAttribute("normal",new i.BufferAttribute(r,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var n=new Float32Array(3*e.colors.length);this.addAttribute("color",new i.BufferAttribute(n,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var o=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new i.BufferAttribute(o,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new i.BufferAttribute(a,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var s=e.vertices.length>65535?Uint32Array:Uint16Array,c=new s(3*e.indices.length);this.setIndex(new i.BufferAttribute(c,1).copyIndicesArray(e.indices))}this.groups=e.groups;for(var h in e.morphTargets){for(var l=[],u=e.morphTargets[h],p=0,d=u.length;d>p;p++){var f=u[p],m=new i.Float32Attribute(3*f.length,3);l.push(m.copyVector3sArray(f))}this.morphAttributes[h]=l}if(e.skinIndices.length>0){var v=new i.Float32Attribute(4*e.skinIndices.length,4);this.addAttribute("skinIndex",v.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var g=new i.Float32Attribute(4*e.skinWeights.length,4);this.addAttribute("skinWeight",g.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){new i.Vector3;return function(){null===this.boundingBox&&(this.boundingBox=new i.Box3);var e=this.attributes.position.array;e&&this.boundingBox.setFromArray(e),(void 0===e||0===e.length)&&(this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}}(),computeBoundingSphere:function(){var e=new i.Box3,t=new i.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new i.Sphere);var r=this.attributes.position.array;if(r){var n=this.boundingSphere.center;e.setFromArray(r),e.center(n);for(var o=0,a=0,s=r.length;s>a;a+=3)t.fromArray(r,a),o=Math.max(o,n.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes,r=this.groups;if(t.position){var n=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new i.BufferAttribute(new Float32Array(n.length),3));else for(var o=t.normal.array,a=0,s=o.length;s>a;a++)o[a]=0;var c,h,l,u=t.normal.array,p=new i.Vector3,d=new i.Vector3,f=new i.Vector3,m=new i.Vector3,v=new i.Vector3;if(e){var g=e.array;0===r.length&&this.addGroup(0,g.length);
  for(var y=0,x=r.length;x>y;++y)for(var b=r[y],_=b.start,M=b.count,a=_,s=_+M;s>a;a+=3)c=3*g[a+0],h=3*g[a+1],l=3*g[a+2],p.fromArray(n,c),d.fromArray(n,h),f.fromArray(n,l),m.subVectors(f,d),v.subVectors(p,d),m.cross(v),u[c]+=m.x,u[c+1]+=m.y,u[c+2]+=m.z,u[h]+=m.x,u[h+1]+=m.y,u[h+2]+=m.z,u[l]+=m.x,u[l+1]+=m.y,u[l+2]+=m.z}else for(var a=0,s=n.length;s>a;a+=9)p.fromArray(n,a),d.fromArray(n,a+3),f.fromArray(n,a+6),m.subVectors(f,d),v.subVectors(p,d),m.cross(v),u[a]=m.x,u[a+1]=m.y,u[a+2]=m.z,u[a+3]=m.x,u[a+4]=m.y,u[a+5]=m.z,u[a+6]=m.x,u[a+7]=m.y,u[a+8]=m.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e instanceof i.BufferGeometry==!1)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);void 0===t&&(t=0);var r=this.attributes;for(var n in r)if(void 0!==e.attributes[n])for(var o=r[n],a=o.array,s=e.attributes[n],c=s.array,h=s.itemSize,l=0,u=h*t;l<c.length;l++,u++)a[u]=c[l];return this},normalizeNormals:function(){for(var e,t,r,i,n=this.attributes.normal.array,o=0,a=n.length;a>o;o+=3)e=n[o],t=n[o+1],r=n[o+2],i=1/Math.sqrt(e*e+t*t+r*r),n[o]*=i,n[o+1]*=i,n[o+2]*=i},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e=new i.BufferGeometry,t=this.index.array,r=this.attributes;for(var n in r){for(var o=r[n],a=o.array,s=o.itemSize,c=new a.constructor(t.length*s),h=0,l=0,u=0,p=t.length;p>u;u++){h=t[u]*s;for(var d=0;s>d;d++)c[l++]=a[h++]}e.addAttribute(n,new i.BufferAttribute(c,s))}return e},toJSON:function(){var e={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var r in t)void 0!==t[r]&&(e[r]=t[r]);return e}e.data={attributes:{}};var i=this.index;if(null!==i){var n=Array.prototype.slice.call(i.array);e.data.index={type:i.array.constructor.name,array:n}}var o=this.attributes;for(var r in o){var a=o[r],n=Array.prototype.slice.call(a.array);e.data.attributes[r]={itemSize:a.itemSize,type:a.array.constructor.name,array:n}}var s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(e.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),e},clone:function(){return(new i.BufferGeometry).copy(this)},copy:function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var r=e.attributes;for(var i in r){var n=r[i];this.addAttribute(i,n.clone())}for(var o=e.groups,a=0,s=o.length;s>a;a++){var c=o[a];this.addGroup(c.start,c.count)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.BufferGeometry.prototype),i.BufferGeometry.MaxIndex=65535,i.InstancedBufferGeometry=function(){i.BufferGeometry.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0},i.InstancedBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.InstancedBufferGeometry.prototype.constructor=i.InstancedBufferGeometry,i.InstancedBufferGeometry.prototype.addGroup=function(e,t,r){this.groups.push({start:e,count:t,instances:r})},i.InstancedBufferGeometry.prototype.copy=function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var r=e.attributes;for(var i in r){var n=r[i];this.addAttribute(i,n.clone())}for(var o=e.groups,a=0,s=o.length;s>a;a++){var c=o[a];this.addGroup(c.start,c.count,c.instances)}return this},i.EventDispatcher.prototype.apply(i.InstancedBufferGeometry.prototype),i.Uniform=function(e,t){this.type=e,this.value=t,this.dynamic=!1},i.Uniform.prototype={constructor:i.Uniform,onUpdate:function(e){return this.dynamic=!0,this.onUpdateCallback=e,this}},i.AnimationClip=function(e,t,r){this.name=e||i.Math.generateUUID(),this.tracks=r,this.duration=void 0!==t?t:-1,this.duration<0&&this.resetDuration(),this.trim(),this.optimize()},i.AnimationClip.prototype={constructor:i.AnimationClip,resetDuration:function(){for(var e=this.tracks,t=0,r=0,i=e.length;r!==i;++r){var n=this.tracks[r];t=Math.max(t,n.times[n.times.length-1])}this.duration=t},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},Object.assign(i.AnimationClip,{parse:function(e){for(var t=[],r=e.tracks,n=1/(e.fps||1),o=0,a=r.length;o!==a;++o)t.push(i.KeyframeTrack.parse(r[o]).scale(n));return new i.AnimationClip(e.name,e.duration,t)},toJSON:function(e){for(var t=[],r=e.tracks,n={name:e.name,duration:e.duration,tracks:t},o=0,a=r.length;o!==a;++o)t.push(i.KeyframeTrack.toJSON(r[o]));return n},CreateFromMorphTargetSequence:function(e,t,r){for(var n=t.length,o=[],a=0;n>a;a++){var s=[],c=[];s.push((a+n-1)%n,a,(a+1)%n),c.push(0,1,0);var h=i.AnimationUtils.getKeyframeOrder(s);s=i.AnimationUtils.sortedArray(s,1,h),c=i.AnimationUtils.sortedArray(c,1,h),0===s[0]&&(s.push(n),c.push(c[0])),o.push(new i.NumberKeyframeTrack(".morphTargetInfluences["+t[a].name+"]",s,c).scale(1/r))}return new i.AnimationClip(e,-1,o)},findByName:function(e,t){for(var r=0;r<e.length;r++)if(e[r].name===t)return e[r];return null},CreateClipsFromMorphTargetSequences:function(e,t){for(var r={},n=/^([\w-]*?)([\d]+)$/,o=0,a=e.length;a>o;o++){var s=e[o],c=s.name.match(n);if(c&&c.length>1){var h=c[1],l=r[h];l||(r[h]=l=[]),l.push(s)}}var u=[];for(var h in r)u.push(i.AnimationClip.CreateFromMorphTargetSequence(h,r[h],t));return u},parseAnimation:function(e,t,r){if(!e)return console.error("  no animation in JSONLoader data"),null;for(var n=function(e,t,r,n,o){if(0!==r.length){var a=[],s=[];i.AnimationUtils.flattenJSON(r,a,s,n),0!==a.length&&o.push(new e(t,a,s))}},o=[],a=e.name||"default",s=e.length||-1,c=e.fps||30,h=e.hierarchy||[],l=0;l<h.length;l++){var u=h[l].keys;if(u&&0!=u.length)if(u[0].morphTargets){for(var p={},d=0;d<u.length;d++)if(u[d].morphTargets)for(var f=0;f<u[d].morphTargets.length;f++)p[u[d].morphTargets[f]]=-1;for(var m in p){for(var v=[],g=[],f=0;f!==u[d].morphTargets.length;++f){var y=u[d];v.push(y.time),g.push(y.morphTarget===m?1:0)}o.push(new i.NumberKeyframeTrack(".morphTargetInfluence["+m+"]",v,g))}s=p.length*(c||1)}else{var x=".bones["+t[l].name+"]";n(i.VectorKeyframeTrack,x+".position",u,"pos",o),n(i.QuaternionKeyframeTrack,x+".quaternion",u,"rot",o),n(i.VectorKeyframeTrack,x+".scale",u,"scl",o)}}if(0===o.length)return null;var b=new i.AnimationClip(a,s,o);return b}}),i.AnimationMixer=function(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1},i.AnimationMixer.prototype={constructor:i.AnimationMixer,clipAction:function(e,t){var r,n=t||this._root,o=n.uuid,a="string"==typeof e?e:e.name,s=e!==a?e:null,c=this._actionsByClip[a];if(void 0!==c){var h=c.actionByRoot[o];if(void 0!==h)return h;if(r=c.knownActions[0],s=r._clip,e!==a&&e!==s)throw new Error("Different clips with the same name detected!")}if(null===s)return null;var l=new i.AnimationMixer._Action(this,s,t);return this._bindAction(l,r),this._addInactiveAction(l,a,o),l},existingAction:function(e,t){var r=t||this._root,i=r.uuid,n="string"==typeof e?e:e.name,o=this._actionsByClip[n];return void 0!==o?o.actionByRoot[i]||null:null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,r=this._bindings,i=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var n=0;n!==t;++n)e[n].reset();for(var n=0;n!==i;++n)r[n].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,r=this._nActiveActions,i=this.time+=e,n=Math.sign(e),o=this._accuIndex^=1,a=0;a!==r;++a){var s=t[a];s.enabled&&s._update(i,e,n,o)}for(var c=this._bindings,h=this._nActiveBindings,a=0;a!==h;++a)c[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,r=e.name,i=this._actionsByClip,n=i[r];if(void 0!==n){for(var o=n.knownActions,a=0,s=o.length;a!==s;++a){var c=o[a];this._deactivateAction(c);var h=c._cacheIndex,l=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,l._cacheIndex=h,t[h]=l,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[r]}},uncacheRoot:function(e){var t=e.uuid,r=this._actionsByClip;for(var i in r){var n=r[i].actionByRoot,o=n[t];void 0!==o&&(this._deactivateAction(o),this._removeInactiveAction(o))}var a=this._bindingsByRootAndName,s=a[t];if(void 0!==s)for(var c in s){var h=s[c];h.restoreOriginalState(),this._removeInactiveBinding(h)}},uncacheAction:function(e,t){var r=this.existingAction(e,t);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}},i.EventDispatcher.prototype.apply(i.AnimationMixer.prototype),i.AnimationMixer._Action=function(e,t,r){this._mixer=e,this._clip=t,this._localRoot=r||null;for(var n=t.tracks,o=n.length,a=new Array(o),s={endingStart:i.ZeroCurvatureEnding,endingEnd:i.ZeroCurvatureEnding},c=0;c!==o;++c){var h=n[c].createInterpolant(null);a[c]=h,h.settings=s}this._interpolantSettings=s,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=i.LoopRepeat,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0},i.AnimationMixer._Action.prototype={constructor:i.AnimationMixer._Action,play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){this._startTime;return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,r){this._mixer;if(e.fadeOut(t),this.fadeIn(t),r){var i=this._clip.duration,n=e._clip.duration,o=n/i,a=i/n;e.warp(1,o,t),this.warp(a,1,t)}return this},crossFadeTo:function(e,t,r){return e.crossFadeFrom(this,t,r)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._currentTimeScale,0,e)},warp:function(e,t,r){var i=this._mixer,n=i.time,o=this._timeScaleInterpolant,a=this.timeScale;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,c=o.sampleValues;return s[0]=n,s[1]=n+r,c[0]=e/a,c[1]=t/a,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,r,i){var n=this._startTime;if(null!==n){var o=(e-n)*r;if(0>o||0===r)return;this._startTime=null,t=r*o}t*=this._updateTimeScale(e);var a=this._updateTime(t),s=this._updateWeight(e);if(s>0)for(var c=this._interpolants,h=this._propertyBindings,l=0,u=c.length;l!==u;++l)c[l].evaluate(a),h[l].accumulate(i,s)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var r=this._weightInterpolant;if(null!==r){var i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var r=this._timeScaleInterpolant;if(null!==r){var i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopWarping(),0===t?this.pause=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var r=this._clip.duration,n=this.loop,o=this._loopCount,a=!1;switch(n){case i.LoopOnce:if(-1===o&&(this.loopCount=0,this._setEndings(!0,!0,!1)),t>=r)t=r;else{if(!(0>t))break;t=0}this.clampWhenFinished?this.pause=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>e?-1:1});break;case i.LoopPingPong:a=!0;case i.LoopRepeat:if(-1===o&&(e>0?(o=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),t>=r||0>t){var s=Math.floor(t/r);t-=r*s,o+=Math.abs(s);var c=this.repetitions-o;if(0>c){this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?r:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});break}if(0===c){var h=0>e;this._setEndings(h,!h,a)}else this._setEndings(!1,!1,a);this._loopCount=o,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:s})}if(n===i.LoopPingPong&&1===(1&o))return this.time=t,r-t}return this.time=t,t},_setEndings:function(e,t,r){var n=this._interpolantSettings;r?(n.endingStart=i.ZeroSlopeEnding,n.endingEnd=i.ZeroSlopeEnding):(e?n.endingStart=this.zeroSlopeAtStart?i.ZeroSlopeEnding:i.ZeroCurvatureEnding:n.endingStart=i.WrapAroundEnding,t?n.endingEnd=this.zeroSlopeAtEnd?i.ZeroSlopeEnding:i.ZeroCurvatureEnding:n.endingEnd=i.WrapAroundEnding)},_scheduleFading:function(e,t,r){var i=this._mixer,n=i.time,o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=n,s[0]=t,a[1]=n+e,s[1]=r,this}},Object.assign(i.AnimationMixer.prototype,{_bindAction:function(e,t){var r=e._localRoot||this._root,n=e._clip.tracks,o=n.length,a=e._propertyBindings,s=e._interpolants,c=r.uuid,h=this._bindingsByRootAndName,l=h[c];void 0===l&&(l={},h[c]=l);for(var u=0;u!==o;++u){var p=n[u],d=p.name,f=l[d];if(void 0!==f)a[u]=f;else{if(f=a[u],void 0!==f){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,c,d));continue}var m=t&&t._propertyBindings[u].binding.parsedPath;f=new i.PropertyMixer(i.PropertyBinding.create(r,d,m),p.ValueTypeName,p.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,c,d),a[u]=f}s[u].resultBuffer=f.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,r=e._clip.name,i=this._actionsByClip[r];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,r,t)}for(var n=e._propertyBindings,o=0,a=n.length;o!==a;++o){var s=n[o];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,r=0,i=t.length;r!==i;++r){var n=t[r];0===--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,r){var i=this._actions,n=this._actionsByClip,o=n[t];if(void 0===o)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,n[t]=o;else{var a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.actionByRoot[r]=e},_removeInactiveAction:function(e){var t=this._actions,r=t[t.length-1],i=e._cacheIndex;r._cacheIndex=i,t[i]=r,t.pop(),e._cacheIndex=null;var n=e._clip.name,o=this._actionsByClip,a=o[n],s=a.knownActions,c=s[s.length-1],h=e._byClipCacheIndex;c._byClipCacheIndex=h,s[h]=c,s.pop(),e._byClipCacheIndex=null;var l=a.actionByRoot,u=(t._localRoot||this._root).uuid;delete l[u],0===s.length&&delete o[n],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,r=0,i=t.length;r!==i;++r){var n=t[r];0===--n.referenceCount&&this._removeInactiveBinding(n)}},_lendAction:function(e){var t=this._actions,r=e._cacheIndex,i=this._nActiveActions++,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n},_takeBackAction:function(e){var t=this._actions,r=e._cacheIndex,i=--this._nActiveActions,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n},_addInactiveBinding:function(e,t,r){var i=this._bindingsByRootAndName,n=i[t],o=this._bindings;void 0===n&&(n={},i[t]=n),n[r]=e,e._cacheIndex=o.length,o.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,r=e.binding,i=r.rootNode.uuid,n=r.path,o=this._bindingsByRootAndName,a=o[i],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete a[n];e:{for(var h in a)break e;delete o[i]}},_lendBinding:function(e){var t=this._bindings,r=e._cacheIndex,i=this._nActiveBindings++,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n},_takeBackBinding:function(e){var t=this._bindings,r=e._cacheIndex,i=--this._nActiveBindings,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return void 0===r&&(r=new i.LinearInterpolant(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=t,e[t]=r),r},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,r=e.__cacheIndex,i=--this._nActiveControlInterpolants,n=t[i];e.__cacheIndex=i,t[i]=e,n.__cacheIndex=r,t[r]=n},_controlInterpolantsResultBuffer:new Float32Array(1)}),i.AnimationObjectGroup=function(e){this.uuid=i.Math.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var r=0,n=arguments.length;r!==n;++r)t[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var o=this;this.stats={objects:{get total(){return o._objects.length},get inUse(){return this.total-o.nCachedObjects_}},get bindingsPerObject(){return o._bindings.length}}},i.AnimationObjectGroup.prototype={constructor:i.AnimationObjectGroup,add:function(e){for(var t=this._objects,r=t.length,n=this.nCachedObjects_,o=this._indicesByUUID,a=this._paths,s=this._parsedPaths,c=this._bindings,h=c.length,l=0,u=arguments.length;l!==u;++l){var p=arguments[l],d=p.uuid,f=o[d];if(void 0===f){f=r++,o[d]=f,t.push(p);for(var m=0,v=h;m!==v;++m)c[m].push(new i.PropertyBinding(p,a[m],s[m]))}else if(n>f){var g=t[f],y=--n,x=t[y];o[x.uuid]=f,t[f]=x,o[d]=y,t[y]=p;for(var m=0,v=h;m!==v;++m){var b=c[m],_=b[y],M=b[f];b[f]=_,void 0===M&&(M=new i.PropertyBinding(p,a[m],s[m])),b[y]=M}}else t[f]!==g&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=n},remove:function(e){for(var t=this._objects,r=(t.length,this.nCachedObjects_),i=this._indicesByUUID,n=this._bindings,o=n.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],h=c.uuid,l=i[h];if(void 0!==l&&l>=r){var u=r++,p=t[u];i[p.uuid]=l,t[l]=p,i[h]=u,t[u]=c;for(var d=0,f=o;d!==f;++d){var m=n[d],v=m[u],g=m[l];m[l]=v,m[u]=g}}}this.nCachedObjects_=r},uncache:function(e){for(var t=this._objects,r=t.length,i=this.nCachedObjects_,n=this._indicesByUUID,o=this._bindings,a=o.length,s=0,c=arguments.length;s!==c;++s){var h=arguments[s],l=h.uuid,u=n[l];if(void 0!==u)if(delete n[l],i>u){var p=--i,d=t[p],f=--r,m=t[f];n[d.uuid]=u,t[u]=d,n[m.uuid]=p,t[p]=m,t.pop();for(var v=0,g=a;v!==g;++v){var y=o[v],x=y[p],b=y[f];y[u]=x,y[p]=b,y.pop()}}else{var f=--r,m=t[f];n[m.uuid]=u,t[u]=m,t.pop();for(var v=0,g=a;v!==g;++v){var y=o[v];y[u]=y[f],y.pop()}}}this.nCachedObjects_=i},subscribe_:function(e,t){var r=this._bindingsIndicesByPath,n=r[e],o=this._bindings;if(void 0!==n)return o[n];var a=this._paths,s=this._parsedPaths,c=this._objects,h=c.length,l=this.nCachedObjects_,u=new Array(h);n=o.length,r[e]=n,a.push(e),s.push(t),o.push(u);for(var p=l,d=c.length;p!==d;++p){var f=c[p];u[p]=new i.PropertyBinding(f,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,r=t[e];if(void 0!==r){var i=this._paths,n=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a],c=e[a];t[c]=r,o[r]=s,o.pop(),n[r]=n[a],n.pop(),i[r]=i[a],i.pop()}}},i.AnimationUtils={arraySlice:function(e,t,r){return i.AnimationUtils.isTypedArray(e)?new e.constructor(e.subarray(t,r)):e.slice(t,r)},convertArray:function(e,t,r){return!e||!r&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){function t(t,r){return e[t]-e[r]}for(var r=e.length,i=new Array(r),n=0;n!==r;++n)i[n]=n;return i.sort(t),i},sortedArray:function(e,t,r){for(var i=e.length,n=new e.constructor(i),o=0,a=0;a!==i;++o)for(var s=r[o]*t,c=0;c!==t;++c)n[a++]=e[s+c];return n},flattenJSON:function(e,t,r,i){for(var n=1,o=e[0];void 0!==o&&void 0===o[i];)o=e[n++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a)){do a=o[i],void 0!==a&&(t.push(o.time),r.push.apply(r,a)),o=e[n++];while(void 0!==o)}else if(void 0!==a.toArray){do a=o[i],void 0!==a&&(t.push(o.time),a.toArray(r,r.length)),o=e[n++];while(void 0!==o)}else do a=o[i],void 0!==a&&(t.push(o.time),r.push(a)),o=e[n++];while(void 0!==o)}}},i.KeyframeTrack=function(e,t,r,n){if(void 0===e)throw new Error("track name is undefined");if(void 0===t||0===t.length)throw new Error("no keyframes in track named "+e);this.name=e,this.times=i.AnimationUtils.convertArray(t,this.TimeBufferType),this.values=i.AnimationUtils.convertArray(r,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation),this.validate(),this.optimize()},i.KeyframeTrack.prototype={constructor:i.KeyframeTrack,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:i.InterpolateLinear,InterpolantFactoryMethodDiscrete:function(e){return new i.DiscreteInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new i.LinearInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new i.CubicInterpolant(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t=void 0;switch(e){case i.InterpolateDiscrete:t=this.InterpolantFactoryMethodDiscrete;break;case i.InterpolateLinear:t=this.InterpolantFactoryMethodLinear;break;case i.InterpolateSmooth:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(r);this.setInterpolation(this.DefaultInterpolation)}return void console.warn(r)}this.createInterpolant=t},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return i.InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return i.InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return i.InterpolateSmooth}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,r=0,i=t.length;r!==i;++r)t[r]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,r=0,i=t.length;r!==i;++r)t[r]*=e;return this},trim:function(e,t){for(var r=this.times,n=r.length,o=0,a=n-1;o!==n&&r[o]<e;)++o;for(;-1!==a&&r[a]>t;)--a;if(++a,0!==o||a!==n){o>=a&&(a=Math.max(a,1),o=a-1);var s=this.getValueSize();this.times=i.AnimationUtils.arraySlice(r,o,a),this.values=i.AnimationUtils.arraySlice(this.values,o*s,a*s)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("invalid value size in track",this),e=!1);var r=this.times,n=this.values,o=r.length;0===o&&(console.error("track is empty",this),e=!1);for(var a=null,s=0;s!==o;s++){var c=r[s];if("number"==typeof c&&isNaN(c)){console.error("time is not a valid number",this,s,c),e=!1;break}if(null!==a&&a>c){console.error("out of order keys",this,s,c,a),e=!1;break}a=c}if(void 0!==n&&i.AnimationUtils.isTypedArray(n))for(var s=0,h=n.length;s!==h;++s){var l=n[s];if(isNaN(l)){console.error("value is not a valid number",this,s,l),e=!1;break}}return e},optimize:function(){for(var e=this.times,t=this.values,r=this.getValueSize(),n=1,o=1,a=e.length-1;a>=o;++o){var s=!1,c=e[o],h=e[o+1];if(c!==h&&(1!==o||c!==c[0]))for(var l=o*r,u=l-r,p=l+r,d=0;d!==r;++d){var f=t[l+d];if(f!==t[u+d]||f!==t[p+d]){s=!0;break}}if(s){if(o!==n){e[n]=e[o];for(var m=o*r,v=n*r,d=0;d!==r;++d)t[v+d]=t[m+d]}++n}}return n!==e.length&&(this.times=i.AnimationUtils.arraySlice(e,0,n),this.values=i.AnimationUtils.arraySlice(t,0,n*r)),this}},Object.assign(i.KeyframeTrack,{parse:function(e){if(void 0===e.type)throw new Error("track type undefined, can not parse");var t=i.KeyframeTrack._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){console.warn("legacy JSON format detected, converting");var r=[],n=[];i.AnimationUtils.flattenJSON(e.keys,r,n,"value"),e.times=r,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t,r=e.constructor;if(void 0!==r.toJSON)t=r.toJSON(e);else{t={name:e.name,times:i.AnimationUtils.convertArray(e.times,Array),values:i.AnimationUtils.convertArray(e.values,Array)};var n=e.getInterpolation();n!==e.DefaultInterpolation&&(t.interpolation=n)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return i.NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return i.VectorKeyframeTrack;case"color":return i.ColorKeyframeTrack;case"quaternion":return i.QuaternionKeyframeTrack;case"bool":case"boolean":return i.BooleanKeyframeTrack;case"string":return i.StringKeyframeTrack}throw new Error("Unsupported typeName: "+e)}}),i.PropertyBinding=function(e,t,r){this.path=t,this.parsedPath=r||i.PropertyBinding.parseTrackName(t),this.node=i.PropertyBinding.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e},i.PropertyBinding.prototype={constructor:i.PropertyBinding,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,r=t.objectName,n=t.propertyName,o=t.propertyIndex;if(e||(e=i.PropertyBinding.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.error("  trying to update node for track: "+this.path+" but it wasn't found.");if(r){var a=t.objectIndex;switch(r){case"materials":if(!e.material)return void console.error("  can not bind to material as node does not have a material",this);if(!e.material.materials)return void console.error("  can not bind to material.materials as node.material does not have a materials array",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("  can not bind to bones as node does not have a skeleton",this);e=e.skeleton.bones;for(var s=0;s<e.length;s++)if(e[s].name===a){a=s;break}break;default:if(void 0===e[r])return void console.error("  can not bind to objectName of node, undefined",this);e=e[r]}if(void 0!==a){if(void 0===e[a])return void console.error("  trying to bind to objectIndex of objectName, but is undefined:",this,e);e=e[a]}}var c=e[n];if(!c){var h=t.nodeName;return void console.error("  trying to update property for track: "+h+"."+n+" but it wasn't found.",e)}var l=this.Versioning.None;void 0!==e.needsUpdate?(l=this.Versioning.NeedsUpdate,this.targetObject=e):void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=e);var u=this.BindingType.Direct;if(void 0!==o){if("morphTargetInfluences"===n){if(!e.geometry)return void console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!e.geometry.morphTargets)return void console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(var s=0;s<this.node.geometry.morphTargets.length;s++)if(e.geometry.morphTargets[s].name===o){o=s;break}}u=this.BindingType.ArrayElement,this.resolvedProperty=c,this.propertyIndex=o}else void 0!==c.fromArray&&void 0!==c.toArray?(u=this.BindingType.HasFromToArray,this.resolvedProperty=c):void 0!==c.length?(u=this.BindingType.EntireArray,this.resolvedProperty=c):this.propertyName=n;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Object.assign(i.PropertyBinding.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:i.PropertyBinding.prototype.getValue,_setValue_unbound:i.PropertyBinding.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)e[t++]=r[i]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.node[this.propertyName]=e[t]},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++]},function(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),i.PropertyBinding.Composite=function(e,t,r){var n=r||i.PropertyBinding.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)},i.PropertyBinding.Composite.prototype={constructor:i.PropertyBinding.Composite,getValue:function(e,t){this.bind();var r=this._targetGroup.nCachedObjects_,i=this._bindings[r];void 0!==i&&i.getValue(e,t)},setValue:function(e,t){for(var r=this._bindings,i=this._targetGroup.nCachedObjects_,n=r.length;i!==n;++i)r[i].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind();
  }},i.PropertyBinding.create=function(e,t,r){return e instanceof i.AnimationObjectGroup?new i.PropertyBinding.Composite(e,t,r):new i.PropertyBinding(e,t,r)},i.PropertyBinding.parseTrackName=function(e){var t=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_.:\- ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,r=t.exec(e);if(!r)throw new Error("cannot parse trackName at all: "+e);r.index===t.lastIndex&&t.lastIndex++;var i={nodeName:r[3],objectName:r[5],objectIndex:r[7],propertyName:r[9],propertyIndex:r[11]};if(null===i.propertyName||0===i.propertyName.length)throw new Error("can not parse propertyName from trackName: "+e);return i},i.PropertyBinding.findNode=function(e,t){if(!t||""===t||"root"===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var r=function(e){for(var r=0;r<e.bones.length;r++){var i=e.bones[r];if(i.name===t)return i}return null},i=r(e.skeleton);if(i)return i}if(e.children){var n=function(e){for(var r=0;r<e.length;r++){var i=e[r];if(i.name===t||i.uuid===t)return i;var o=n(i.children);if(o)return o}return null},o=n(e.children);if(o)return o}return null},i.PropertyMixer=function(e,t,r){this.binding=e,this.valueSize=r;var i,n=Float64Array;switch(t){case"quaternion":i=this._slerp;break;case"string":case"bool":n=Array,i=this._select;break;default:i=this._lerp}this.buffer=new n(4*r),this._mixBufferRegion=i,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0},i.PropertyMixer.prototype={constructor:i.PropertyMixer,accumulate:function(e,t){var r=this.buffer,i=this.valueSize,n=e*i+i,o=this.cumulativeWeight;if(0===o){for(var a=0;a!==i;++a)r[n+a]=r[a];o=t}else{o+=t;var s=t/o;this._mixBufferRegion(r,n,0,s,i)}this.cumulativeWeight=o},apply:function(e){var t=this.valueSize,r=this.buffer,i=e*t+t,n=this.cumulativeWeight,o=this.binding;if(this.cumulativeWeight=0,1>n){var a=3*t;this._mixBufferRegion(r,i,a,1-n,t)}for(var s=t,c=t+t;s!==c;++s)if(r[s]!==r[s+t]){o.setValue(r,i);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,r=this.valueSize,i=3*r;e.getValue(t,i);for(var n=r,o=i;n!==o;++n)t[n]=t[i+n%r];this.cumulativeWeight=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_select:function(e,t,r,i,n){if(i>=.5)for(var o=0;o!==n;++o)e[t+o]=e[r+o]},_slerp:function(e,t,r,n,o){i.Quaternion.slerpFlat(e,t,e,t,e,r,n)},_lerp:function(e,t,r,i,n){for(var o=1-i,a=0;a!==n;++a){var s=t+a;e[s]=e[s]*o+e[r+a]*i}}},i.BooleanKeyframeTrack=function(e,t,r){i.KeyframeTrack.call(this,e,t,r)},i.BooleanKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.BooleanKeyframeTrack,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:i.IntepolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),i.NumberKeyframeTrack=function(e,t,r,n){i.KeyframeTrack.call(this,e,t,r,n)},i.NumberKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.NumberKeyframeTrack,ValueTypeName:"number"}),i.QuaternionKeyframeTrack=function(e,t,r,n){i.KeyframeTrack.call(this,e,t,r,n)},i.QuaternionKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.QuaternionKeyframeTrack,ValueTypeName:"quaternion",DefaultInterpolation:i.InterpolateLinear,InterpolantFactoryMethodLinear:function(e){return new i.QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),i.StringKeyframeTrack=function(e,t,r,n){i.KeyframeTrack.call(this,e,t,r,n)},i.StringKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.StringKeyframeTrack,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:i.IntepolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),i.VectorKeyframeTrack=function(e,t,r,n){i.KeyframeTrack.call(this,e,t,r,n)},i.VectorKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.VectorKeyframeTrack,ValueTypeName:"vector"}),i.Audio=function(e){i.Object3D.call(this),this.type="Audio",this.context=e.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filter=null},i.Audio.prototype=Object.create(i.Object3D.prototype),i.Audio.prototype.constructor=i.Audio,i.Audio.prototype.getOutput=function(){return this.gain},i.Audio.prototype.load=function(e){var t=new i.AudioBuffer(this.context);return t.load(e),this.setBuffer(t),this},i.Audio.prototype.setNodeSource=function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},i.Audio.prototype.setBuffer=function(e){var t=this;return e.onReady(function(e){t.source.buffer=e,t.sourceType="buffer",t.autoplay&&t.play()}),this},i.Audio.prototype.play=function(){if(this.isPlaying===!0)return void console.warn("THREE.Audio: Audio is already playing.");if(this.hasPlaybackControl===!1)return void console.warn("THREE.Audio: this Audio has no playback control.");var e=this.context.createBufferSource();e.buffer=this.source.buffer,e.loop=this.source.loop,e.onended=this.source.onended,e.start(0,this.startTime),e.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=e,this.connect()},i.Audio.prototype.pause=function(){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),void(this.startTime=this.context.currentTime))},i.Audio.prototype.stop=function(){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),void(this.startTime=0))},i.Audio.prototype.connect=function(){null!==this.filter?(this.source.connect(this.filter),this.filter.connect(this.getOutput())):this.source.connect(this.getOutput())},i.Audio.prototype.disconnect=function(){null!==this.filter?(this.source.disconnect(this.filter),this.filter.disconnect(this.getOutput())):this.source.disconnect(this.getOutput())},i.Audio.prototype.getFilter=function(){return this.filter},i.Audio.prototype.setFilter=function(e){void 0===e&&(e=null),this.isPlaying===!0?(this.disconnect(),this.filter=e,this.connect()):this.filter=e},i.Audio.prototype.setPlaybackRate=function(e){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=e,void(this.isPlaying===!0&&(this.source.playbackRate.value=this.playbackRate)))},i.Audio.prototype.getPlaybackRate=function(){return this.playbackRate},i.Audio.prototype.onEnded=function(){this.isPlaying=!1},i.Audio.prototype.setLoop=function(e){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):void(this.source.loop=e)},i.Audio.prototype.getLoop=function(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop},i.Audio.prototype.setVolume=function(e){this.gain.gain.value=e},i.Audio.prototype.getVolume=function(){return this.gain.gain.value},i.AudioAnalyser=function(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)},i.AudioAnalyser.prototype={constructor:i.AudioAnalyser,getData:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},i.AudioBuffer=function(e){this.context=e,this.ready=!1,this.readyCallbacks=[]},i.AudioBuffer.prototype.load=function(e){var t=this,r=new XMLHttpRequest;return r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(e){t.context.decodeAudioData(this.response,function(e){t.buffer=e,t.ready=!0;for(var r=0;r<t.readyCallbacks.length;r++)t.readyCallbacks[r](t.buffer);t.readyCallbacks=[]})},r.send(),this},i.AudioBuffer.prototype.onReady=function(e){this.ready?e(this.buffer):this.readyCallbacks.push(e)},i.PositionalAudio=function(e){i.Audio.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)},i.PositionalAudio.prototype=Object.create(i.Audio.prototype),i.PositionalAudio.prototype.constructor=i.PositionalAudio,i.PositionalAudio.prototype.getOutput=function(){return this.panner},i.PositionalAudio.prototype.setRefDistance=function(e){this.panner.refDistance=e},i.PositionalAudio.prototype.getRefDistance=function(){return this.panner.refDistance},i.PositionalAudio.prototype.setRolloffFactor=function(e){this.panner.rolloffFactor=e},i.PositionalAudio.prototype.getRolloffFactor=function(){return this.panner.rolloffFactor},i.PositionalAudio.prototype.setDistanceModel=function(e){this.panner.distanceModel=e},i.PositionalAudio.prototype.getDistanceModel=function(){return this.panner.distanceModel},i.PositionalAudio.prototype.setMaxDistance=function(e){this.panner.maxDistance=e},i.PositionalAudio.prototype.getMaxDistance=function(){return this.panner.maxDistance},i.PositionalAudio.prototype.updateMatrixWorld=function(){var e=new i.Vector3;return function(t){i.Object3D.prototype.updateMatrixWorld.call(this,t),e.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(e.x,e.y,e.z)}}(),i.AudioListener=function(){i.Object3D.call(this),this.type="AudioListener",this.context=new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null},i.AudioListener.prototype=Object.create(i.Object3D.prototype),i.AudioListener.prototype.constructor=i.AudioListener,i.AudioListener.prototype.getInput=function(){return this.gain},i.AudioListener.prototype.removeFilter=function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},i.AudioListener.prototype.setFilter=function(e){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},i.AudioListener.prototype.getFilter=function(){return this.filter},i.AudioListener.prototype.setMasterVolume=function(e){this.gain.gain.value=e},i.AudioListener.prototype.getMasterVolume=function(){return this.gain.gain.value},i.AudioListener.prototype.updateMatrixWorld=function(){var e=new i.Vector3,t=new i.Quaternion,r=new i.Vector3,n=new i.Vector3;return function(o){i.Object3D.prototype.updateMatrixWorld.call(this,o);var a=this.context.listener,s=this.up;this.matrixWorld.decompose(e,t,r),n.set(0,0,-1).applyQuaternion(t),a.setPosition(e.x,e.y,e.z),a.setOrientation(n.x,n.y,n.z,s.x,s.y,s.z)}}(),i.Camera=function(){i.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new i.Matrix4,this.projectionMatrix=new i.Matrix4},i.Camera.prototype=Object.create(i.Object3D.prototype),i.Camera.prototype.constructor=i.Camera,i.Camera.prototype.getWorldDirection=function(){var e=new i.Quaternion;return function(t){var r=t||new i.Vector3;return this.getWorldQuaternion(e),r.set(0,0,-1).applyQuaternion(e)}}(),i.Camera.prototype.lookAt=function(){var e=new i.Matrix4;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),i.Camera.prototype.clone=function(){return(new this.constructor).copy(this)},i.Camera.prototype.copy=function(e){return i.Object3D.prototype.copy.call(this,e),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this},i.CubeCamera=function(e,t,r){i.Object3D.call(this),this.type="CubeCamera";var n=90,o=1,a=new i.PerspectiveCamera(n,o,e,t);a.up.set(0,-1,0),a.lookAt(new i.Vector3(1,0,0)),this.add(a);var s=new i.PerspectiveCamera(n,o,e,t);s.up.set(0,-1,0),s.lookAt(new i.Vector3(-1,0,0)),this.add(s);var c=new i.PerspectiveCamera(n,o,e,t);c.up.set(0,0,1),c.lookAt(new i.Vector3(0,1,0)),this.add(c);var h=new i.PerspectiveCamera(n,o,e,t);h.up.set(0,0,-1),h.lookAt(new i.Vector3(0,-1,0)),this.add(h);var l=new i.PerspectiveCamera(n,o,e,t);l.up.set(0,-1,0),l.lookAt(new i.Vector3(0,0,1)),this.add(l);var u=new i.PerspectiveCamera(n,o,e,t);u.up.set(0,-1,0),u.lookAt(new i.Vector3(0,0,-1)),this.add(u);var p={format:i.RGBFormat,magFilter:i.LinearFilter,minFilter:i.LinearFilter};this.renderTarget=new i.WebGLRenderTargetCube(r,r,p),this.updateCubeMap=function(e,t){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,i=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,e.render(t,a,r),r.activeCubeFace=1,e.render(t,s,r),r.activeCubeFace=2,e.render(t,c,r),r.activeCubeFace=3,e.render(t,h,r),r.activeCubeFace=4,e.render(t,l,r),r.texture.generateMipmaps=i,r.activeCubeFace=5,e.render(t,u,r),e.setRenderTarget(null)}},i.CubeCamera.prototype=Object.create(i.Object3D.prototype),i.CubeCamera.prototype.constructor=i.CubeCamera,i.OrthographicCamera=function(e,t,r,n,o,a){i.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=e,this.right=t,this.top=r,this.bottom=n,this.near=void 0!==o?o:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()},i.OrthographicCamera.prototype=Object.create(i.Camera.prototype),i.OrthographicCamera.prototype.constructor=i.OrthographicCamera,i.OrthographicCamera.prototype.updateProjectionMatrix=function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(r-e,r+e,i+t,i-t,this.near,this.far)},i.OrthographicCamera.prototype.copy=function(e){return i.Camera.prototype.copy.call(this,e),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this},i.OrthographicCamera.prototype.toJSON=function(e){var t=i.Object3D.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,t},i.PerspectiveCamera=function(e,t,r,n){i.Camera.call(this),this.type="PerspectiveCamera",this.focalLength=10,this.zoom=1,this.fov=void 0!==e?e:50,this.aspect=void 0!==t?t:1,this.near=void 0!==r?r:.1,this.far=void 0!==n?n:2e3,this.updateProjectionMatrix()},i.PerspectiveCamera.prototype=Object.create(i.Camera.prototype),i.PerspectiveCamera.prototype.constructor=i.PerspectiveCamera,i.PerspectiveCamera.prototype.setLens=function(e,t){void 0===t&&(t=24),this.fov=2*i.Math.radToDeg(Math.atan(t/(2*e))),this.updateProjectionMatrix()},i.PerspectiveCamera.prototype.setViewOffset=function(e,t,r,i,n,o){this.fullWidth=e,this.fullHeight=t,this.x=r,this.y=i,this.width=n,this.height=o,this.updateProjectionMatrix()},i.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var e=i.Math.radToDeg(2*Math.atan(Math.tan(.5*i.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var t=this.fullWidth/this.fullHeight,r=Math.tan(i.Math.degToRad(.5*e))*this.near,n=-r,o=t*n,a=t*r,s=Math.abs(a-o),c=Math.abs(r-n);this.projectionMatrix.makeFrustum(o+this.x*s/this.fullWidth,o+(this.x+this.width)*s/this.fullWidth,r-(this.y+this.height)*c/this.fullHeight,r-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(e,this.aspect,this.near,this.far)},i.PerspectiveCamera.prototype.copy=function(e){return i.Camera.prototype.copy.call(this,e),this.focalLength=e.focalLength,this.zoom=e.zoom,this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this},i.PerspectiveCamera.prototype.toJSON=function(e){var t=i.Object3D.prototype.toJSON.call(this,e);return t.object.focalLength=this.focalLength,t.object.zoom=this.zoom,t.object.fov=this.fov,t.object.aspect=this.aspect,t.object.near=this.near,t.object.far=this.far,t},i.StereoCamera=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new i.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new i.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1},i.StereoCamera.prototype={constructor:i.StereoCamera,update:function(){var e,t,r,n,o,a=new i.Matrix4,s=new i.Matrix4;return function(c){var h=e!==c.focalLength||t!==c.fov||r!==c.aspect*this.aspect||n!==c.near||o!==c.far;if(h){e=c.focalLength,t=c.fov,r=c.aspect*this.aspect,n=c.near,o=c.far;var l,u,p=c.projectionMatrix.clone(),d=.032,f=d*n/e,m=n*Math.tan(i.Math.degToRad(.5*t));s.elements[12]=-d,a.elements[12]=d,l=-m*r+f,u=m*r+f,p.elements[0]=2*n/(u-l),p.elements[8]=(u+l)/(u-l),this.cameraL.projectionMatrix.copy(p),l=-m*r-f,u=m*r-f,p.elements[0]=2*n/(u-l),p.elements[8]=(u+l)/(u-l),this.cameraR.projectionMatrix.copy(p)}this.cameraL.matrixWorld.copy(c.matrixWorld).multiply(s),this.cameraR.matrixWorld.copy(c.matrixWorld).multiply(a)}}()},i.Light=function(e,t){i.Object3D.call(this),this.type="Light",this.color=new i.Color(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0},i.Light.prototype=Object.create(i.Object3D.prototype),i.Light.prototype.constructor=i.Light,i.Light.prototype.copy=function(e){return i.Object3D.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},i.Light.prototype.toJSON=function(e){var t=i.Object3D.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),t},i.LightShadow=function(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new i.Vector2(512,512),this.map=null,this.matrix=new i.Matrix4},i.LightShadow.prototype={constructor:i.LightShadow,copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)}},i.AmbientLight=function(e,t){i.Light.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0},i.AmbientLight.prototype=Object.create(i.Light.prototype),i.AmbientLight.prototype.constructor=i.AmbientLight,i.DirectionalLight=function(e,t){i.Light.call(this,e,t),this.type="DirectionalLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new i.Object3D,this.shadow=new i.LightShadow(new i.OrthographicCamera(-5,5,5,-5,.5,500))},i.DirectionalLight.prototype=Object.create(i.Light.prototype),i.DirectionalLight.prototype.constructor=i.DirectionalLight,i.DirectionalLight.prototype.copy=function(e){return i.Light.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},i.HemisphereLight=function(e,t,r){i.Light.call(this,e,r),this.type="HemisphereLight",this.castShadow=void 0,this.position.set(0,1,0),this.updateMatrix(),this.groundColor=new i.Color(t)},i.HemisphereLight.prototype=Object.create(i.Light.prototype),i.HemisphereLight.prototype.constructor=i.HemisphereLight,i.HemisphereLight.prototype.copy=function(e){return i.Light.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this},i.PointLight=function(e,t,r,n){i.Light.call(this,e,t),this.type="PointLight",this.distance=void 0!==r?r:0,this.decay=void 0!==n?n:1,this.shadow=new i.LightShadow(new i.PerspectiveCamera(90,1,.5,500))},i.PointLight.prototype=Object.create(i.Light.prototype),i.PointLight.prototype.constructor=i.PointLight,Object.defineProperty(i.PointLight.prototype,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),i.PointLight.prototype.copy=function(e){return i.Light.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this},i.SpotLight=function(e,t,r,n,o,a){i.Light.call(this,e,t),this.type="SpotLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new i.Object3D,this.distance=void 0!==r?r:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==o?o:0,this.decay=void 0!==a?a:1,this.shadow=new i.LightShadow(new i.PerspectiveCamera(50,1,.5,500))},i.SpotLight.prototype=Object.create(i.Light.prototype),i.SpotLight.prototype.constructor=i.SpotLight,Object.defineProperty(i.SpotLight.prototype,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),i.SpotLight.prototype.copy=function(e){return i.Light.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},i.Cache={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(this.files[e]=t)},get:function(e){return this.enabled!==!1?this.files[e]:void 0},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},i.Loader=function(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},i.Loader.prototype={constructor:i.Loader,crossOrigin:void 0,extractUrlBase:function(e){var t=e.split("/");return 1===t.length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(e,t,r){for(var i=[],n=0;n<e.length;++n)i[n]=this.createMaterial(e[n],t,r);return i},createMaterial:function(){var e,t,r;return function(n,o,a){function s(e,r,n,s,h){var l,u=o+e,p=i.Loader.Handlers.get(u);null!==p?l=p.load(u):(t.setCrossOrigin(a),l=t.load(u)),void 0!==r&&(l.repeat.fromArray(r),1!==r[0]&&(l.wrapS=i.RepeatWrapping),1!==r[1]&&(l.wrapT=i.RepeatWrapping)),void 0!==n&&l.offset.fromArray(n),void 0!==s&&("repeat"===s[0]&&(l.wrapS=i.RepeatWrapping),"mirror"===s[0]&&(l.wrapS=i.MirroredRepeatWrapping),"repeat"===s[1]&&(l.wrapT=i.RepeatWrapping),"mirror"===s[1]&&(l.wrapT=i.MirroredRepeatWrapping)),void 0!==h&&(l.anisotropy=h);var d=i.Math.generateUUID();return c[d]=l,d}void 0===e&&(e=new i.Color),void 0===t&&(t=new i.TextureLoader),void 0===r&&(r=new i.MaterialLoader);var c={},h={uuid:i.Math.generateUUID(),type:"MeshLambertMaterial"};for(var l in n){var u=n[l];switch(l){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":h.name=u;break;case"blending":h.blending=i[u];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",l,"is no longer supported.");break;case"colorDiffuse":h.color=e.fromArray(u).getHex();break;case"colorSpecular":h.specular=e.fromArray(u).getHex();break;case"colorEmissive":h.emissive=e.fromArray(u).getHex();break;case"specularCoef":h.shininess=u;break;case"shading":"basic"===u.toLowerCase()&&(h.type="MeshBasicMaterial"),"phong"===u.toLowerCase()&&(h.type="MeshPhongMaterial");break;case"mapDiffuse":h.map=s(u,n.mapDiffuseRepeat,n.mapDiffuseOffset,n.mapDiffuseWrap,n.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapLight":h.lightMap=s(u,n.mapLightRepeat,n.mapLightOffset,n.mapLightWrap,n.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":h.aoMap=s(u,n.mapAORepeat,n.mapAOOffset,n.mapAOWrap,n.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":h.bumpMap=s(u,n.mapBumpRepeat,n.mapBumpOffset,n.mapBumpWrap,n.mapBumpAnisotropy);break;case"mapBumpScale":h.bumpScale=u;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":h.normalMap=s(u,n.mapNormalRepeat,n.mapNormalOffset,n.mapNormalWrap,n.mapNormalAnisotropy);break;case"mapNormalFactor":h.normalScale=[u,u];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":h.specularMap=s(u,n.mapSpecularRepeat,n.mapSpecularOffset,n.mapSpecularWrap,n.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapAlpha":h.alphaMap=s(u,n.mapAlphaRepeat,n.mapAlphaOffset,n.mapAlphaWrap,n.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":h.side=i.BackSide;break;case"doubleSided":h.side=i.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),h.opacity=u;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":h[l]=u;break;case"vertexColors":u===!0&&(h.vertexColors=i.VertexColors),"face"===u&&(h.vertexColors=i.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",l,u)}}return"MeshBasicMaterial"===h.type&&delete h.emissive,"MeshPhongMaterial"!==h.type&&delete h.specular,h.opacity<1&&(h.transparent=!0),r.setTextures(c),r.parse(h)}}()},i.Loader.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,r=0,i=t.length;i>r;r+=2){var n=t[r],o=t[r+1];if(n.test(e))return o}return null}},i.XHRLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.XHRLoader.prototype={constructor:i.XHRLoader,load:function(e,t,r,n){void 0!==this.path&&(e=this.path+e);var o=this,a=i.Cache.get(e);if(void 0!==a)return t&&setTimeout(function(){t(a)},0),a;var s=new XMLHttpRequest;return s.overrideMimeType("text/plain"),s.open("GET",e,!0),s.addEventListener("load",function(r){var a=r.target.response;i.Cache.add(e,a),200===this.status?(t&&t(a),o.manager.itemEnd(e)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),t&&t(a),o.manager.itemEnd(e)):(n&&n(r),o.manager.itemError(e))},!1),void 0!==r&&s.addEventListener("progress",function(e){r(e)},!1),s.addEventListener("error",function(t){n&&n(t),o.manager.itemError(e)},!1),void 0!==this.responseType&&(s.responseType=this.responseType),void 0!==this.withCredentials&&(s.withCredentials=this.withCredentials),s.send(null),o.manager.itemStart(e),s},setPath:function(e){this.path=e},setResponseType:function(e){this.responseType=e},setWithCredentials:function(e){this.withCredentials=e}},i.FontLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.FontLoader.prototype={constructor:i.FontLoader,load:function(e,t,r,n){var o=new i.XHRLoader(this.manager);o.load(e,function(e){t(new i.Font(JSON.parse(e.substring(65,e.length-2))))},r,n)}},i.ImageLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.ImageLoader.prototype={constructor:i.ImageLoader,load:function(e,t,r,n){void 0!==this.path&&(e=this.path+e);var o=this,a=i.Cache.get(e);if(void 0!==a)return o.manager.itemStart(e),t?setTimeout(function(){t(a),o.manager.itemEnd(e)},0):o.manager.itemEnd(e),a;var s=document.createElement("img");return s.addEventListener("load",function(r){i.Cache.add(e,this),t&&t(this),o.manager.itemEnd(e)},!1),void 0!==r&&s.addEventListener("progress",function(e){r(e)},!1),s.addEventListener("error",function(t){n&&n(t),o.manager.itemError(e)},!1),void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),o.manager.itemStart(e),s.src=e,s},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},i.JSONLoader=function(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:i.DefaultLoadingManager,this.withCredentials=!1},i.JSONLoader.prototype={constructor:i.JSONLoader,get statusDomElement(){return void 0===this._statusDomElement&&(this._statusDomElement=document.createElement("div")),console.warn("THREE.JSONLoader: .statusDomElement has been removed."),this._statusDomElement},load:function(e,t,r,n){var o=this,a=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:i.Loader.prototype.extractUrlBase(e),s=new i.XHRLoader(this.manager);s.setWithCredentials(this.withCredentials),s.load(e,function(r){var i=JSON.parse(r),n=i.metadata;if(void 0!==n){var s=n.type;if(void 0!==s){if("object"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.");if("scene"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.SceneLoader instead.")}}var c=o.parse(i,a);t(c.geometry,c.materials)},r,n)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){function r(t){function r(e,t){return e&1<<t}var n,o,a,c,h,l,u,p,d,f,m,v,g,y,x,b,_,M,w,S,E,T,A,L,C,R,P,I=e.faces,B=e.vertices,D=e.normals,U=e.colors,F=0;if(void 0!==e.uvs){for(n=0;n<e.uvs.length;n++)e.uvs[n].length&&F++;for(n=0;F>n;n++)s.faceVertexUvs[n]=[]}for(c=0,h=B.length;h>c;)M=new i.Vector3,M.x=B[c++]*t,M.y=B[c++]*t,M.z=B[c++]*t,s.vertices.push(M);for(c=0,h=I.length;h>c;)if(f=I[c++],m=r(f,0),v=r(f,1),g=r(f,3),y=r(f,4),x=r(f,5),b=r(f,6),_=r(f,7),m){if(S=new i.Face3,S.a=I[c],S.b=I[c+1],S.c=I[c+3],E=new i.Face3,E.a=I[c+1],E.b=I[c+2],E.c=I[c+3],c+=4,v&&(d=I[c++],S.materialIndex=d,E.materialIndex=d),a=s.faces.length,g)for(n=0;F>n;n++)for(L=e.uvs[n],s.faceVertexUvs[n][a]=[],s.faceVertexUvs[n][a+1]=[],o=0;4>o;o++)p=I[c++],R=L[2*p],P=L[2*p+1],C=new i.Vector2(R,P),2!==o&&s.faceVertexUvs[n][a].push(C),0!==o&&s.faceVertexUvs[n][a+1].push(C);if(y&&(u=3*I[c++],S.normal.set(D[u++],D[u++],D[u]),E.normal.copy(S.normal)),x)for(n=0;4>n;n++)u=3*I[c++],A=new i.Vector3(D[u++],D[u++],D[u]),2!==n&&S.vertexNormals.push(A),0!==n&&E.vertexNormals.push(A);if(b&&(l=I[c++],T=U[l],S.color.setHex(T),E.color.setHex(T)),_)for(n=0;4>n;n++)l=I[c++],T=U[l],2!==n&&S.vertexColors.push(new i.Color(T)),0!==n&&E.vertexColors.push(new i.Color(T));s.faces.push(S),s.faces.push(E)}else{if(w=new i.Face3,w.a=I[c++],w.b=I[c++],w.c=I[c++],v&&(d=I[c++],w.materialIndex=d),a=s.faces.length,g)for(n=0;F>n;n++)for(L=e.uvs[n],s.faceVertexUvs[n][a]=[],o=0;3>o;o++)p=I[c++],R=L[2*p],P=L[2*p+1],C=new i.Vector2(R,P),s.faceVertexUvs[n][a].push(C);if(y&&(u=3*I[c++],w.normal.set(D[u++],D[u++],D[u])),x)for(n=0;3>n;n++)u=3*I[c++],A=new i.Vector3(D[u++],D[u++],D[u]),w.vertexNormals.push(A);if(b&&(l=I[c++],w.color.setHex(U[l])),_)for(n=0;3>n;n++)l=I[c++],w.vertexColors.push(new i.Color(U[l]));s.faces.push(w)}}function n(){var t=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var r=0,n=e.skinWeights.length;n>r;r+=t){var o=e.skinWeights[r],a=t>1?e.skinWeights[r+1]:0,c=t>2?e.skinWeights[r+2]:0,h=t>3?e.skinWeights[r+3]:0;s.skinWeights.push(new i.Vector4(o,a,c,h))}if(e.skinIndices)for(var r=0,n=e.skinIndices.length;n>r;r+=t){var l=e.skinIndices[r],u=t>1?e.skinIndices[r+1]:0,p=t>2?e.skinIndices[r+2]:0,d=t>3?e.skinIndices[r+3]:0;s.skinIndices.push(new i.Vector4(l,u,p,d))}s.bones=e.bones,s.bones&&s.bones.length>0&&(s.skinWeights.length!==s.skinIndices.length||s.skinIndices.length!==s.vertices.length)&&console.warn("When skinning, number of vertices ("+s.vertices.length+"), skinIndices ("+s.skinIndices.length+"), and skinWeights ("+s.skinWeights.length+") should match.")}function o(t){if(void 0!==e.morphTargets)for(var r=0,n=e.morphTargets.length;n>r;r++){s.morphTargets[r]={},s.morphTargets[r].name=e.morphTargets[r].name,s.morphTargets[r].vertices=[];for(var o=s.morphTargets[r].vertices,a=e.morphTargets[r].vertices,c=0,h=a.length;h>c;c+=3){var l=new i.Vector3;l.x=a[c]*t,l.y=a[c+1]*t,l.z=a[c+2]*t,o.push(l)}}if(void 0!==e.morphColors&&e.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var u=s.faces,p=e.morphColors[0].colors,r=0,n=u.length;n>r;r++)u[r].color.fromArray(p,3*r)}}function a(){var t=[],r=[];void 0!==e.animation&&r.push(e.animation),void 0!==e.animations&&(e.animations.length?r=r.concat(e.animations):r.push(e.animations));for(var n=0;n<r.length;n++){var o=i.AnimationClip.parseAnimation(r[n],s.bones);o&&t.push(o)}if(s.morphTargets){var a=i.AnimationClip.CreateClipsFromMorphTargetSequences(s.morphTargets,10);t=t.concat(a)}t.length>0&&(s.animations=t)}var s=new i.Geometry,c=void 0!==e.scale?1/e.scale:1;
  if(r(c),n(),o(c),a(),s.computeFaceNormals(),s.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:s};var h=i.Loader.prototype.initMaterials(e.materials,t,this.crossOrigin);return{geometry:s,materials:h}}},i.LoadingManager=function(e,t,r){var i=this,n=!1,o=0,a=0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){a++,n===!1&&void 0!==i.onStart&&i.onStart(e,o,a),n=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,a),o===a&&(n=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)}},i.DefaultLoadingManager=new i.LoadingManager,i.BufferGeometryLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.BufferGeometryLoader.prototype={constructor:i.BufferGeometryLoader,load:function(e,t,r,n){var o=this,a=new i.XHRLoader(o.manager);a.load(e,function(e){t(o.parse(JSON.parse(e)))},r,n)},parse:function(e){var t=new i.BufferGeometry,r=e.data.index,n={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};if(void 0!==r){var o=new n[r.type](r.array);t.setIndex(new i.BufferAttribute(o,1))}var a=e.data.attributes;for(var s in a){var c=a[s],o=new n[c.type](c.array);t.addAttribute(s,new i.BufferAttribute(o,c.itemSize))}var h=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==h)for(var l=0,u=h.length;l!==u;++l){var p=h[l];t.addGroup(p.start,p.count,p.materialIndex)}var d=e.data.boundingSphere;if(void 0!==d){var f=new i.Vector3;void 0!==d.center&&f.fromArray(d.center),t.boundingSphere=new i.Sphere(f,d.radius)}return t}},i.MaterialLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager,this.textures={}},i.MaterialLoader.prototype={constructor:i.MaterialLoader,load:function(e,t,r,n){var o=this,a=new i.XHRLoader(o.manager);a.load(e,function(e){t(o.parse(JSON.parse(e)))},r,n)},setTextures:function(e){this.textures=e},getTexture:function(e){var t=this.textures;return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]},parse:function(e){var t=new i[e.type];if(void 0!==e.uuid&&(t.uuid=e.uuid),void 0!==e.name&&(t.name=e.name),void 0!==e.color&&t.color.setHex(e.color),void 0!==e.roughness&&(t.roughness=e.roughness),void 0!==e.metalness&&(t.metalness=e.metalness),void 0!==e.emissive&&t.emissive.setHex(e.emissive),void 0!==e.specular&&t.specular.setHex(e.specular),void 0!==e.shininess&&(t.shininess=e.shininess),void 0!==e.uniforms&&(t.uniforms=e.uniforms),void 0!==e.vertexShader&&(t.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(t.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(t.vertexColors=e.vertexColors),void 0!==e.shading&&(t.shading=e.shading),void 0!==e.blending&&(t.blending=e.blending),void 0!==e.side&&(t.side=e.side),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e.transparent&&(t.transparent=e.transparent),void 0!==e.alphaTest&&(t.alphaTest=e.alphaTest),void 0!==e.depthTest&&(t.depthTest=e.depthTest),void 0!==e.depthWrite&&(t.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(t.colorWrite=e.colorWrite),void 0!==e.wireframe&&(t.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(t.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.size&&(t.size=e.size),void 0!==e.sizeAttenuation&&(t.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(t.map=this.getTexture(e.map)),void 0!==e.alphaMap&&(t.alphaMap=this.getTexture(e.alphaMap),t.transparent=!0),void 0!==e.bumpMap&&(t.bumpMap=this.getTexture(e.bumpMap)),void 0!==e.bumpScale&&(t.bumpScale=e.bumpScale),void 0!==e.normalMap&&(t.normalMap=this.getTexture(e.normalMap)),void 0!==e.normalScale){var r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),t.normalScale=(new i.Vector2).fromArray(r)}if(void 0!==e.displacementMap&&(t.displacementMap=this.getTexture(e.displacementMap)),void 0!==e.displacementScale&&(t.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(t.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(t.roughnessMap=this.getTexture(e.roughnessMap)),void 0!==e.metalnessMap&&(t.metalnessMap=this.getTexture(e.metalnessMap)),void 0!==e.emissiveMap&&(t.emissiveMap=this.getTexture(e.emissiveMap)),void 0!==e.emissiveIntensity&&(t.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(t.specularMap=this.getTexture(e.specularMap)),void 0!==e.envMap&&(t.envMap=this.getTexture(e.envMap),t.combine=i.MultiplyOperation),e.reflectivity&&(t.reflectivity=e.reflectivity),void 0!==e.lightMap&&(t.lightMap=this.getTexture(e.lightMap)),void 0!==e.lightMapIntensity&&(t.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(t.aoMap=this.getTexture(e.aoMap)),void 0!==e.aoMapIntensity&&(t.aoMapIntensity=e.aoMapIntensity),void 0!==e.materials)for(var n=0,o=e.materials.length;o>n;n++)t.materials.push(this.parse(e.materials[n]));return t}},i.ObjectLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager,this.texturePath=""},i.ObjectLoader.prototype={constructor:i.ObjectLoader,load:function(e,t,r,n){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var o=this,a=new i.XHRLoader(o.manager);a.load(e,function(e){o.parse(JSON.parse(e),t)},r,n)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var r=this.parseGeometries(e.geometries),i=this.parseImages(e.images,function(){void 0!==t&&t(a)}),n=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,n),a=this.parseObject(e.object,r,o);return e.animations&&(a.animations=this.parseAnimations(e.animations)),(void 0===e.images||0===e.images.length)&&void 0!==t&&t(a),a},parseGeometries:function(e){var t={};if(void 0!==e)for(var r=new i.JSONLoader,n=new i.BufferGeometryLoader,o=0,a=e.length;a>o;o++){var s,c=e[o];switch(c.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new i[c.type](c.width,c.height,c.widthSegments,c.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":s=new i[c.type](c.width,c.height,c.depth,c.widthSegments,c.heightSegments,c.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new i[c.type](c.radius,c.segments,c.thetaStart,c.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new i[c.type](c.radiusTop,c.radiusBottom,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new i[c.type](c.radius,c.widthSegments,c.heightSegments,c.phiStart,c.phiLength,c.thetaStart,c.thetaLength);break;case"DodecahedronGeometry":s=new i.DodecahedronGeometry(c.radius,c.detail);break;case"IcosahedronGeometry":s=new i.IcosahedronGeometry(c.radius,c.detail);break;case"OctahedronGeometry":s=new i.OctahedronGeometry(c.radius,c.detail);break;case"TetrahedronGeometry":s=new i.TetrahedronGeometry(c.radius,c.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new i[c.type](c.innerRadius,c.outerRadius,c.thetaSegments,c.phiSegments,c.thetaStart,c.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new i[c.type](c.radius,c.tube,c.radialSegments,c.tubularSegments,c.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new i[c.type](c.radius,c.tube,c.tubularSegments,c.radialSegments,c.p,c.q);break;case"LatheGeometry":s=new i.LatheGeometry(c.points,c.segments,c.phiStart,c.phiLength);break;case"BufferGeometry":s=n.parse(c);break;case"Geometry":s=r.parse(c.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+c.type+'"');continue}s.uuid=c.uuid,void 0!==c.name&&(s.name=c.name),t[c.uuid]=s}return t},parseMaterials:function(e,t){var r={};if(void 0!==e){var n=new i.MaterialLoader;n.setTextures(t);for(var o=0,a=e.length;a>o;o++){var s=n.parse(e[o]);r[s.uuid]=s}}return r},parseAnimations:function(e){for(var t=[],r=0;r<e.length;r++){var n=i.AnimationClip.parse(e[r]);t.push(n)}return t},parseImages:function(e,t){function r(e){return n.manager.itemStart(e),s.load(e,function(){n.manager.itemEnd(e)})}var n=this,o={};if(void 0!==e&&e.length>0){var a=new i.LoadingManager(t),s=new i.ImageLoader(a);s.setCrossOrigin(this.crossOrigin);for(var c=0,h=e.length;h>c;c++){var l=e[c],u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:n.texturePath+l.url;o[l.uuid]=r(u)}}return o},parseTextures:function(e,t){function r(e){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),i[e])}var n={};if(void 0!==e)for(var o=0,a=e.length;a>o;o++){var s=e[o];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);var c=new i.Texture(t[s.image]);c.needsUpdate=!0,c.uuid=s.uuid,void 0!==s.name&&(c.name=s.name),void 0!==s.mapping&&(c.mapping=r(s.mapping)),void 0!==s.offset&&(c.offset=new i.Vector2(s.offset[0],s.offset[1])),void 0!==s.repeat&&(c.repeat=new i.Vector2(s.repeat[0],s.repeat[1])),void 0!==s.minFilter&&(c.minFilter=r(s.minFilter)),void 0!==s.magFilter&&(c.magFilter=r(s.magFilter)),void 0!==s.anisotropy&&(c.anisotropy=s.anisotropy),Array.isArray(s.wrap)&&(c.wrapS=r(s.wrap[0]),c.wrapT=r(s.wrap[1])),n[s.uuid]=c}return n},parseObject:function(){var e=new i.Matrix4;return function(t,r,n){function o(e){return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),r[e]}function a(e){return void 0!==e?(void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]):void 0}var s;switch(t.type){case"Scene":s=new i.Scene;break;case"PerspectiveCamera":s=new i.PerspectiveCamera(t.fov,t.aspect,t.near,t.far);break;case"OrthographicCamera":s=new i.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":s=new i.AmbientLight(t.color,t.intensity);break;case"DirectionalLight":s=new i.DirectionalLight(t.color,t.intensity);break;case"PointLight":s=new i.PointLight(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":s=new i.SpotLight(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":s=new i.HemisphereLight(t.color,t.groundColor,t.intensity);break;case"Mesh":var c=o(t.geometry),h=a(t.material);s=c.bones&&c.bones.length>0?new i.SkinnedMesh(c,h):new i.Mesh(c,h);break;case"LOD":s=new i.LOD;break;case"Line":s=new i.Line(o(t.geometry),a(t.material),t.mode);break;case"PointCloud":case"Points":s=new i.Points(o(t.geometry),a(t.material));break;case"Sprite":s=new i.Sprite(a(t.material));break;case"Group":s=new i.Group;break;default:s=new i.Object3D}if(s.uuid=t.uuid,void 0!==t.name&&(s.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(s.position,s.quaternion,s.scale)):(void 0!==t.position&&s.position.fromArray(t.position),void 0!==t.rotation&&s.rotation.fromArray(t.rotation),void 0!==t.scale&&s.scale.fromArray(t.scale)),void 0!==t.castShadow&&(s.castShadow=t.castShadow),void 0!==t.receiveShadow&&(s.receiveShadow=t.receiveShadow),void 0!==t.visible&&(s.visible=t.visible),void 0!==t.userData&&(s.userData=t.userData),void 0!==t.children)for(var l in t.children)s.add(this.parseObject(t.children[l],r,n));if("LOD"===t.type)for(var u=t.levels,p=0;p<u.length;p++){var d=u[p],l=s.getObjectByProperty("uuid",d.object);void 0!==l&&s.addLevel(l,d.distance)}return s}}()},i.TextureLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.TextureLoader.prototype={constructor:i.TextureLoader,load:function(e,t,r,n){var o=new i.Texture,a=new i.ImageLoader(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){o.image=e,o.needsUpdate=!0,void 0!==t&&t(o)},r,n),o},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},i.CubeTextureLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.CubeTextureLoader.prototype={constructor:i.CubeTextureLoader,load:function(e,t,r,n){function o(r){s.load(e[r],function(e){a.images[r]=e,c++,6===c&&(a.needsUpdate=!0,t&&t(a))},void 0,n)}var a=new i.CubeTexture,s=new i.ImageLoader(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);for(var c=0,h=0;h<e.length;++h)o(h);return a},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},i.DataTextureLoader=i.BinaryTextureLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager,this._parser=null},i.BinaryTextureLoader.prototype={constructor:i.BinaryTextureLoader,load:function(e,t,r,n){var o=this,a=new i.DataTexture,s=new i.XHRLoader(this.manager);return s.setResponseType("arraybuffer"),s.load(e,function(e){var r=o._parser(e);r&&(void 0!==r.image?a.image=r.image:void 0!==r.data&&(a.image.width=r.width,a.image.height=r.height,a.image.data=r.data),a.wrapS=void 0!==r.wrapS?r.wrapS:i.ClampToEdgeWrapping,a.wrapT=void 0!==r.wrapT?r.wrapT:i.ClampToEdgeWrapping,a.magFilter=void 0!==r.magFilter?r.magFilter:i.LinearFilter,a.minFilter=void 0!==r.minFilter?r.minFilter:i.LinearMipMapLinearFilter,a.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,void 0!==r.format&&(a.format=r.format),void 0!==r.type&&(a.type=r.type),void 0!==r.mipmaps&&(a.mipmaps=r.mipmaps),1===r.mipmapCount&&(a.minFilter=i.LinearFilter),a.needsUpdate=!0,t&&t(a,r))},r,n),a}},i.CompressedTextureLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager,this._parser=null},i.CompressedTextureLoader.prototype={constructor:i.CompressedTextureLoader,load:function(e,t,r,n){function o(o){h.load(e[o],function(e){var r=a._parser(e,!0);s[o]={width:r.width,height:r.height,format:r.format,mipmaps:r.mipmaps},l+=1,6===l&&(1===r.mipmapCount&&(c.minFilter=i.LinearFilter),c.format=r.format,c.needsUpdate=!0,t&&t(c))},r,n)}var a=this,s=[],c=new i.CompressedTexture;c.image=s;var h=new i.XHRLoader(this.manager);if(h.setPath(this.path),h.setResponseType("arraybuffer"),Array.isArray(e))for(var l=0,u=0,p=e.length;p>u;++u)o(u);else h.load(e,function(e){var r=a._parser(e,!0);if(r.isCubemap)for(var n=r.mipmaps.length/r.mipmapCount,o=0;n>o;o++){s[o]={mipmaps:[]};for(var h=0;h<r.mipmapCount;h++)s[o].mipmaps.push(r.mipmaps[o*r.mipmapCount+h]),s[o].format=r.format,s[o].width=r.width,s[o].height=r.height}else c.image.width=r.width,c.image.height=r.height,c.mipmaps=r.mipmaps;1===r.mipmapCount&&(c.minFilter=i.LinearFilter),c.format=r.format,c.needsUpdate=!0,t&&t(c)},r,n);return c},setPath:function(e){this.path=e}},i.Material=function(){Object.defineProperty(this,"id",{value:i.MaterialIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="Material",this.side=i.FrontSide,this.opacity=1,this.transparent=!1,this.blending=i.NormalBlending,this.blendSrc=i.SrcAlphaFactor,this.blendDst=i.OneMinusSrcAlphaFactor,this.blendEquation=i.AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=i.LessEqualDepth,this.depthTest=!0,this.depthWrite=!0,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0},i.Material.prototype={constructor:i.Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){e===!0&&this.update(),this._needsUpdate=e},setValues:function(e){if(void 0!==e)for(var t in e){var r=e[t];if(void 0!==r){var n=this[t];void 0!==n?n instanceof i.Color?n.set(r):n instanceof i.Vector3&&r instanceof i.Vector3?n.copy(r):"overdraw"===t?this[t]=Number(r):this[t]=r:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){function t(e){var t=[];for(var r in e){var i=e[r];delete i.metadata,t.push(i)}return t}var r=void 0===e;r&&(e={textures:{},images:{}});var n={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color instanceof i.Color&&(n.color=this.color.getHex()),.5!==this.roughness&&(n.roughness=this.roughness),.5!==this.metalness&&(n.metalness=this.metalness),this.emissive instanceof i.Color&&(n.emissive=this.emissive.getHex()),this.specular instanceof i.Color&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),this.map instanceof i.Texture&&(n.map=this.map.toJSON(e).uuid),this.alphaMap instanceof i.Texture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap instanceof i.Texture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.bumpMap instanceof i.Texture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap instanceof i.Texture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap instanceof i.Texture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap instanceof i.Texture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap instanceof i.Texture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap instanceof i.Texture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap instanceof i.Texture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap instanceof i.Texture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),void 0!==this.vertexColors&&this.vertexColors!==i.NoColors&&(n.vertexColors=this.vertexColors),void 0!==this.shading&&this.shading!==i.SmoothShading&&(n.shading=this.shading),void 0!==this.blending&&this.blending!==i.NormalBlending&&(n.blending=this.blending),void 0!==this.side&&this.side!==i.FrontSide&&(n.side=this.side),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),r){var o=t(e.textures),a=t(e.images);o.length>0&&(n.textures=o),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.side=e.side,this.opacity=e.opacity,this.transparent=e.transparent,this.blending=e.blending,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.Material.prototype),i.MaterialIdCount=0,i.LineBasicMaterial=function(e){i.Material.call(this),this.type="LineBasicMaterial",this.color=new i.Color(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.blending=i.NormalBlending,this.vertexColors=i.NoColors,this.fog=!0,this.setValues(e)},i.LineBasicMaterial.prototype=Object.create(i.Material.prototype),i.LineBasicMaterial.prototype.constructor=i.LineBasicMaterial,i.LineBasicMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.vertexColors=e.vertexColors,this.fog=e.fog,this},i.LineDashedMaterial=function(e){i.Material.call(this),this.type="LineDashedMaterial",this.color=new i.Color(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.blending=i.NormalBlending,this.vertexColors=i.NoColors,this.fog=!0,this.setValues(e)},i.LineDashedMaterial.prototype=Object.create(i.Material.prototype),i.LineDashedMaterial.prototype.constructor=i.LineDashedMaterial,i.LineDashedMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this.vertexColors=e.vertexColors,this.fog=e.fog,this},i.MeshBasicMaterial=function(e){i.Material.call(this),this.type="MeshBasicMaterial",this.color=new i.Color(16777215),this.map=null,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=i.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=i.SmoothShading,this.blending=i.NormalBlending,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=i.NoColors,this.skinning=!1,this.morphTargets=!1,this.setValues(e)},i.MeshBasicMaterial.prototype=Object.create(i.Material.prototype),i.MeshBasicMaterial.prototype.constructor=i.MeshBasicMaterial,i.MeshBasicMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},i.MeshLambertMaterial=function(e){i.Material.call(this),this.type="MeshLambertMaterial",this.color=new i.Color(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new i.Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=i.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.blending=i.NormalBlending,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=i.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},i.MeshLambertMaterial.prototype=Object.create(i.Material.prototype),i.MeshLambertMaterial.prototype.constructor=i.MeshLambertMaterial,i.MeshLambertMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},i.MeshPhongMaterial=function(e){i.Material.call(this),this.type="MeshPhongMaterial",this.color=new i.Color(16777215),this.specular=new i.Color(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new i.Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=i.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=i.SmoothShading,this.blending=i.NormalBlending,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=i.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},i.MeshPhongMaterial.prototype=Object.create(i.Material.prototype),i.MeshPhongMaterial.prototype.constructor=i.MeshPhongMaterial,i.MeshPhongMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},i.MeshStandardMaterial=function(e){i.Material.call(this),this.type="MeshStandardMaterial",this.color=new i.Color(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new i.Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.fog=!0,this.shading=i.SmoothShading,this.blending=i.NormalBlending,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=i.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},i.MeshStandardMaterial.prototype=Object.create(i.Material.prototype),i.MeshStandardMaterial.prototype.constructor=i.MeshStandardMaterial,i.MeshStandardMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},i.MeshDepthMaterial=function(e){i.Material.call(this),this.type="MeshDepthMaterial",this.morphTargets=!1,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)},i.MeshDepthMaterial.prototype=Object.create(i.Material.prototype),i.MeshDepthMaterial.prototype.constructor=i.MeshDepthMaterial,i.MeshDepthMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},i.MeshNormalMaterial=function(e){i.Material.call(this,e),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(e)},i.MeshNormalMaterial.prototype=Object.create(i.Material.prototype),i.MeshNormalMaterial.prototype.constructor=i.MeshNormalMaterial,i.MeshNormalMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},i.MultiMaterial=function(e){this.uuid=i.Math.generateUUID(),this.type="MultiMaterial",this.materials=e instanceof Array?e:[],this.visible=!0},i.MultiMaterial.prototype={constructor:i.MultiMaterial,toJSON:function(e){for(var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},r=this.materials,i=0,n=r.length;n>i;i++){var o=r[i].toJSON(e);delete o.metadata,t.materials.push(o)}return t.visible=this.visible,t},clone:function(){for(var e=new this.constructor,t=0;t<this.materials.length;t++)e.materials.push(this.materials[t].clone());return e.visible=this.visible,e}},i.PointsMaterial=function(e){i.Material.call(this),this.type="PointsMaterial",this.color=new i.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.blending=i.NormalBlending,this.vertexColors=i.NoColors,this.fog=!0,this.setValues(e)},i.PointsMaterial.prototype=Object.create(i.Material.prototype),i.PointsMaterial.prototype.constructor=i.PointsMaterial,i.PointsMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.vertexColors=e.vertexColors,this.fog=e.fog,this},i.ShaderMaterial=function(e){i.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.shading=i.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.vertexColors=i.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))},i.ShaderMaterial.prototype=Object.create(i.Material.prototype),i.ShaderMaterial.prototype.constructor=i.ShaderMaterial,i.ShaderMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=i.UniformsUtils.clone(e.uniforms),this.defines=e.defines,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},i.ShaderMaterial.prototype.toJSON=function(e){var t=i.Material.prototype.toJSON.call(this,e);return t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},i.RawShaderMaterial=function(e){i.ShaderMaterial.call(this,e),this.type="RawShaderMaterial"},i.RawShaderMaterial.prototype=Object.create(i.ShaderMaterial.prototype),
  i.RawShaderMaterial.prototype.constructor=i.RawShaderMaterial,i.SpriteMaterial=function(e){i.Material.call(this),this.type="SpriteMaterial",this.color=new i.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.setValues(e)},i.SpriteMaterial.prototype=Object.create(i.Material.prototype),i.SpriteMaterial.prototype.constructor=i.SpriteMaterial,i.SpriteMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this.fog=e.fog,this},i.Texture=function(e,t,r,n,o,a,s,c,h){Object.defineProperty(this,"id",{value:i.TextureIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.sourceFile="",this.image=void 0!==e?e:i.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:i.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:i.ClampToEdgeWrapping,this.wrapT=void 0!==n?n:i.ClampToEdgeWrapping,this.magFilter=void 0!==o?o:i.LinearFilter,this.minFilter=void 0!==a?a:i.LinearMipMapLinearFilter,this.anisotropy=void 0!==h?h:1,this.format=void 0!==s?s:i.RGBAFormat,this.type=void 0!==c?c:i.UnsignedByteType,this.offset=new i.Vector2(0,0),this.repeat=new i.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=i.LinearEncoding,this.version=0,this.onUpdate=null},i.Texture.DEFAULT_IMAGE=void 0,i.Texture.DEFAULT_MAPPING=i.UVMapping,i.Texture.prototype={constructor:i.Texture,set needsUpdate(e){e===!0&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){function t(e){var t;return void 0!==e.toDataURL?t=e:(t=document.createElement("canvas"),t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0,e.width,e.height)),t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var r={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=i.Math.generateUUID()),void 0===e.images[n.uuid]&&(e.images[n.uuid]={uuid:n.uuid,url:t(n)}),r.image=n.uuid}return e.textures[this.uuid]=r,r},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping===i.UVMapping){if(e.multiply(this.repeat),e.add(this.offset),e.x<0||e.x>1)switch(this.wrapS){case i.RepeatWrapping:e.x=e.x-Math.floor(e.x);break;case i.ClampToEdgeWrapping:e.x=e.x<0?0:1;break;case i.MirroredRepeatWrapping:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case i.RepeatWrapping:e.y=e.y-Math.floor(e.y);break;case i.ClampToEdgeWrapping:e.y=e.y<0?0:1;break;case i.MirroredRepeatWrapping:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},i.EventDispatcher.prototype.apply(i.Texture.prototype),i.TextureIdCount=0,i.CanvasTexture=function(e,t,r,n,o,a,s,c,h){i.Texture.call(this,e,t,r,n,o,a,s,c,h),this.needsUpdate=!0},i.CanvasTexture.prototype=Object.create(i.Texture.prototype),i.CanvasTexture.prototype.constructor=i.CanvasTexture,i.CubeTexture=function(e,t,r,n,o,a,s,c,h){e=void 0!==e?e:[],t=void 0!==t?t:i.CubeReflectionMapping,i.Texture.call(this,e,t,r,n,o,a,s,c,h),this.flipY=!1},i.CubeTexture.prototype=Object.create(i.Texture.prototype),i.CubeTexture.prototype.constructor=i.CubeTexture,Object.defineProperty(i.CubeTexture.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),i.CompressedTexture=function(e,t,r,n,o,a,s,c,h,l,u){i.Texture.call(this,null,a,s,c,h,l,n,o,u),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1},i.CompressedTexture.prototype=Object.create(i.Texture.prototype),i.CompressedTexture.prototype.constructor=i.CompressedTexture,i.DataTexture=function(e,t,r,n,o,a,s,c,h,l,u){i.Texture.call(this,null,a,s,c,h,l,n,o,u),this.image={data:e,width:t,height:r},this.magFilter=void 0!==h?h:i.NearestFilter,this.minFilter=void 0!==l?l:i.NearestFilter,this.flipY=!1,this.generateMipmaps=!1},i.DataTexture.prototype=Object.create(i.Texture.prototype),i.DataTexture.prototype.constructor=i.DataTexture,i.VideoTexture=function(e,t,r,n,o,a,s,c,h){function l(){requestAnimationFrame(l),e.readyState===e.HAVE_ENOUGH_DATA&&(u.needsUpdate=!0)}i.Texture.call(this,e,t,r,n,o,a,s,c,h),this.generateMipmaps=!1;var u=this;l()},i.VideoTexture.prototype=Object.create(i.Texture.prototype),i.VideoTexture.prototype.constructor=i.VideoTexture,i.Group=function(){i.Object3D.call(this),this.type="Group"},i.Group.prototype=Object.create(i.Object3D.prototype),i.Group.prototype.constructor=i.Group,i.Points=function(e,t){i.Object3D.call(this),this.type="Points",this.geometry=void 0!==e?e:new i.Geometry,this.material=void 0!==t?t:new i.PointsMaterial({color:16777215*Math.random()})},i.Points.prototype=Object.create(i.Object3D.prototype),i.Points.prototype.constructor=i.Points,i.Points.prototype.raycast=function(){var e=new i.Matrix4,t=new i.Ray,r=new i.Sphere;return function(n,o){function a(e,r){var i=t.distanceSqToPoint(e);if(p>i){var a=t.closestPointToPoint(e);a.applyMatrix4(h);var c=n.ray.origin.distanceTo(a);if(c<n.near||c>n.far)return;o.push({distance:c,distanceToRay:Math.sqrt(i),point:a.clone(),index:r,face:null,object:s})}}var s=this,c=this.geometry,h=this.matrixWorld,l=n.params.Points.threshold;if(null===c.boundingSphere&&c.computeBoundingSphere(),r.copy(c.boundingSphere),r.applyMatrix4(h),n.ray.intersectsSphere(r)!==!1){e.getInverse(h),t.copy(n.ray).applyMatrix4(e);var u=l/((this.scale.x+this.scale.y+this.scale.z)/3),p=u*u,d=new i.Vector3;if(c instanceof i.BufferGeometry){var f=c.index,m=c.attributes,v=m.position.array;if(null!==f)for(var g=f.array,y=0,x=g.length;x>y;y++){var b=g[y];d.fromArray(v,3*b),a(d,b)}else for(var y=0,_=v.length/3;_>y;y++)d.fromArray(v,3*y),a(d,y)}else for(var M=c.vertices,y=0,_=M.length;_>y;y++)a(M[y],y)}}}(),i.Points.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},i.Line=function(e,t,r){return 1===r?(console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new i.LineSegments(e,t)):(i.Object3D.call(this),this.type="Line",this.geometry=void 0!==e?e:new i.Geometry,void(this.material=void 0!==t?t:new i.LineBasicMaterial({color:16777215*Math.random()})))},i.Line.prototype=Object.create(i.Object3D.prototype),i.Line.prototype.constructor=i.Line,i.Line.prototype.raycast=function(){var e=new i.Matrix4,t=new i.Ray,r=new i.Sphere;return function(n,o){var a=n.linePrecision,s=a*a,c=this.geometry,h=this.matrixWorld;if(null===c.boundingSphere&&c.computeBoundingSphere(),r.copy(c.boundingSphere),r.applyMatrix4(h),n.ray.intersectsSphere(r)!==!1){e.getInverse(h),t.copy(n.ray).applyMatrix4(e);var l=new i.Vector3,u=new i.Vector3,p=new i.Vector3,d=new i.Vector3,f=this instanceof i.LineSegments?2:1;if(c instanceof i.BufferGeometry){var m=c.index,v=c.attributes,g=v.position.array;if(null!==m)for(var y=m.array,x=0,b=y.length-1;b>x;x+=f){var _=y[x],M=y[x+1];l.fromArray(g,3*_),u.fromArray(g,3*M);var w=t.distanceSqToSegment(l,u,d,p);if(!(w>s)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);S<n.near||S>n.far||o.push({distance:S,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else for(var x=0,b=g.length/3-1;b>x;x+=f){l.fromArray(g,3*x),u.fromArray(g,3*x+3);var w=t.distanceSqToSegment(l,u,d,p);if(!(w>s)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);S<n.near||S>n.far||o.push({distance:S,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}else if(c instanceof i.Geometry)for(var E=c.vertices,T=E.length,x=0;T-1>x;x+=f){var w=t.distanceSqToSegment(E[x],E[x+1],d,p);if(!(w>s)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);S<n.near||S>n.far||o.push({distance:S,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}}}(),i.Line.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},i.LineStrip=0,i.LinePieces=1,i.LineSegments=function(e,t){i.Line.call(this,e,t),this.type="LineSegments"},i.LineSegments.prototype=Object.create(i.Line.prototype),i.LineSegments.prototype.constructor=i.LineSegments,i.Mesh=function(e,t){i.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new i.Geometry,this.material=void 0!==t?t:new i.MeshBasicMaterial({color:16777215*Math.random()}),this.drawMode=i.TrianglesDrawMode,this.updateMorphTargets()},i.Mesh.prototype=Object.create(i.Object3D.prototype),i.Mesh.prototype.constructor=i.Mesh,i.Mesh.prototype.setDrawMode=function(e){this.drawMode=e},i.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,t=this.geometry.morphTargets.length;t>e;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}},i.Mesh.prototype.getMorphTargetIndexByName=function(e){return void 0!==this.morphTargetDictionary[e]?this.morphTargetDictionary[e]:(console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+e+" does not exist. Returning 0."),0)},i.Mesh.prototype.raycast=function(){function e(e,t,r,n,o,a,s){return i.Triangle.barycoordFromPoint(e,t,r,n,v),o.multiplyScalar(v.x),a.multiplyScalar(v.y),s.multiplyScalar(v.z),o.add(a).add(s),o.clone()}function t(e,t,r,n,o,a,s){var c,h=e.material;if(c=h.side===i.BackSide?r.intersectTriangle(a,o,n,!0,s):r.intersectTriangle(n,o,a,h.side!==i.DoubleSide,s),null===c)return null;y.copy(s),y.applyMatrix4(e.matrixWorld);var l=t.ray.origin.distanceTo(y);return l<t.near||l>t.far?null:{distance:l,point:y.clone(),object:e}}function r(r,n,o,a,l,u,p,v){s.fromArray(a,3*u),c.fromArray(a,3*p),h.fromArray(a,3*v);var y=t(r,n,o,s,c,h,g);return y&&(l&&(d.fromArray(l,2*u),f.fromArray(l,2*p),m.fromArray(l,2*v),y.uv=e(g,s,c,h,d,f,m)),y.face=new i.Face3(u,p,v,i.Triangle.normal(s,c,h)),y.faceIndex=u),y}var n=new i.Matrix4,o=new i.Ray,a=new i.Sphere,s=new i.Vector3,c=new i.Vector3,h=new i.Vector3,l=new i.Vector3,u=new i.Vector3,p=new i.Vector3,d=new i.Vector2,f=new i.Vector2,m=new i.Vector2,v=new i.Vector3,g=new i.Vector3,y=new i.Vector3;return function(v,y){var x=this.geometry,b=this.material,_=this.matrixWorld;if(void 0!==b&&(null===x.boundingSphere&&x.computeBoundingSphere(),a.copy(x.boundingSphere),a.applyMatrix4(_),v.ray.intersectsSphere(a)!==!1&&(n.getInverse(_),o.copy(v.ray).applyMatrix4(n),null===x.boundingBox||o.intersectsBox(x.boundingBox)!==!1))){var M,w;if(x instanceof i.BufferGeometry){var S,E,T,A=x.index,L=x.attributes,C=L.position.array;if(void 0!==L.uv&&(M=L.uv.array),null!==A)for(var R=A.array,P=0,I=R.length;I>P;P+=3)S=R[P],E=R[P+1],T=R[P+2],w=r(this,v,o,C,M,S,E,T),w&&(w.faceIndex=Math.floor(P/3),y.push(w));else for(var P=0,I=C.length;I>P;P+=9)S=P/3,E=S+1,T=S+2,w=r(this,v,o,C,M,S,E,T),w&&(w.index=S,y.push(w))}else if(x instanceof i.Geometry){var B,D,U,F=b instanceof i.MultiMaterial,N=F===!0?b.materials:null,O=x.vertices,V=x.faces,G=x.faceVertexUvs[0];G.length>0&&(M=G);for(var z=0,k=V.length;k>z;z++){var H=V[z],j=F===!0?N[H.materialIndex]:b;if(void 0!==j){if(B=O[H.a],D=O[H.b],U=O[H.c],j.morphTargets===!0){var W=x.morphTargets,X=this.morphTargetInfluences;s.set(0,0,0),c.set(0,0,0),h.set(0,0,0);for(var q=0,Y=W.length;Y>q;q++){var Z=X[q];if(0!==Z){var Q=W[q].vertices;s.addScaledVector(l.subVectors(Q[H.a],B),Z),c.addScaledVector(u.subVectors(Q[H.b],D),Z),h.addScaledVector(p.subVectors(Q[H.c],U),Z)}}s.add(B),c.add(D),h.add(U),B=s,D=c,U=h}if(w=t(this,v,o,B,D,U,g)){if(M){var K=M[z];d.copy(K[0]),f.copy(K[1]),m.copy(K[2]),w.uv=e(g,B,D,U,d,f,m)}w.face=H,w.faceIndex=z,y.push(w)}}}}}}}(),i.Mesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},i.Bone=function(e){i.Object3D.call(this),this.type="Bone",this.skin=e},i.Bone.prototype=Object.create(i.Object3D.prototype),i.Bone.prototype.constructor=i.Bone,i.Bone.prototype.copy=function(e){return i.Object3D.prototype.copy.call(this,e),this.skin=e.skin,this},i.Skeleton=function(e,t,r){if(this.useVertexTexture=void 0!==r?r:!0,this.identityMatrix=new i.Matrix4,e=e||[],this.bones=e.slice(0),this.useVertexTexture){var n=Math.sqrt(4*this.bones.length);n=i.Math.nextPowerOfTwo(Math.ceil(n)),n=Math.max(n,4),this.boneTextureWidth=n,this.boneTextureHeight=n,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new i.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,i.RGBAFormat,i.FloatType)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var o=0,a=this.bones.length;a>o;o++)this.boneInverses.push(new i.Matrix4)}},i.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var e=0,t=this.bones.length;t>e;e++){var r=new i.Matrix4;this.bones[e]&&r.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(r)}},i.Skeleton.prototype.pose=function(){for(var e,t=0,r=this.bones.length;r>t;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(var t=0,r=this.bones.length;r>t;t++)e=this.bones[t],e&&(e.parent?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},i.Skeleton.prototype.update=function(){var e=new i.Matrix4;return function(){for(var t=0,r=this.bones.length;r>t;t++){var i=this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix;e.multiplyMatrices(i,this.boneInverses[t]),e.flattenToArrayOffset(this.boneMatrices,16*t)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),i.Skeleton.prototype.clone=function(){return new i.Skeleton(this.bones,this.boneInverses,this.useVertexTexture)},i.SkinnedMesh=function(e,t,r){i.Mesh.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new i.Matrix4,this.bindMatrixInverse=new i.Matrix4;var n=[];if(this.geometry&&void 0!==this.geometry.bones){for(var o,a,s=0,c=this.geometry.bones.length;c>s;++s)a=this.geometry.bones[s],o=new i.Bone(this),n.push(o),o.name=a.name,o.position.fromArray(a.pos),o.quaternion.fromArray(a.rotq),void 0!==a.scl&&o.scale.fromArray(a.scl);for(var s=0,c=this.geometry.bones.length;c>s;++s)a=this.geometry.bones[s],-1!==a.parent&&null!==a.parent?n[a.parent].add(n[s]):this.add(n[s])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new i.Skeleton(n,void 0,r),this.matrixWorld)},i.SkinnedMesh.prototype=Object.create(i.Mesh.prototype),i.SkinnedMesh.prototype.constructor=i.SkinnedMesh,i.SkinnedMesh.prototype.bind=function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},i.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},i.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof i.Geometry)for(var e=0;e<this.geometry.skinWeights.length;e++){var t=this.geometry.skinWeights[e],r=1/t.lengthManhattan();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0)}else if(this.geometry instanceof i.BufferGeometry)for(var n=new i.Vector4,o=this.geometry.attributes.skinWeight,e=0;e<o.count;e++){n.x=o.getX(e),n.y=o.getY(e),n.z=o.getZ(e),n.w=o.getW(e);var r=1/n.lengthManhattan();r!==1/0?n.multiplyScalar(r):n.set(1,0,0,0),o.setXYZW(e,n.x,n.y,n.z,n.w)}},i.SkinnedMesh.prototype.updateMatrixWorld=function(e){i.Mesh.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unrecognized bindMode: "+this.bindMode)},i.SkinnedMesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material,this.useVertexTexture).copy(this)},i.LOD=function(){i.Object3D.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}})},i.LOD.prototype=Object.create(i.Object3D.prototype),i.LOD.prototype.constructor=i.LOD,i.LOD.prototype.addLevel=function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var r=this.levels,i=0;i<r.length&&!(t<r[i].distance);i++);r.splice(i,0,{distance:t,object:e}),this.add(e)},i.LOD.prototype.getObjectForDistance=function(e){for(var t=this.levels,r=1,i=t.length;i>r&&!(e<t[r].distance);r++);return t[r-1].object},i.LOD.prototype.raycast=function(){var e=new i.Vector3;return function(t,r){e.setFromMatrixPosition(this.matrixWorld);var i=t.ray.origin.distanceTo(e);this.getObjectForDistance(i).raycast(t,r)}}(),i.LOD.prototype.update=function(){var e=new i.Vector3,t=new i.Vector3;return function(r){var i=this.levels;if(i.length>1){e.setFromMatrixPosition(r.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var n=e.distanceTo(t);i[0].object.visible=!0;for(var o=1,a=i.length;a>o&&n>=i[o].distance;o++)i[o-1].object.visible=!1,i[o].object.visible=!0;for(;a>o;o++)i[o].object.visible=!1}}}(),i.LOD.prototype.copy=function(e){i.Object3D.prototype.copy.call(this,e,!1);for(var t=e.levels,r=0,n=t.length;n>r;r++){var o=t[r];this.addLevel(o.object.clone(),o.distance)}return this},i.LOD.prototype.toJSON=function(e){var t=i.Object3D.prototype.toJSON.call(this,e);t.object.levels=[];for(var r=this.levels,n=0,o=r.length;o>n;n++){var a=r[n];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t},i.Sprite=function(){var e=new Uint16Array([0,1,2,0,2,3]),t=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),r=new Float32Array([0,0,1,0,1,1,0,1]),n=new i.BufferGeometry;return n.setIndex(new i.BufferAttribute(e,1)),n.addAttribute("position",new i.BufferAttribute(t,3)),n.addAttribute("uv",new i.BufferAttribute(r,2)),function(e){i.Object3D.call(this),this.type="Sprite",this.geometry=n,this.material=void 0!==e?e:new i.SpriteMaterial}}(),i.Sprite.prototype=Object.create(i.Object3D.prototype),i.Sprite.prototype.constructor=i.Sprite,i.Sprite.prototype.raycast=function(){var e=new i.Vector3;return function(t,r){e.setFromMatrixPosition(this.matrixWorld);var i=t.ray.distanceSqToPoint(e),n=this.scale.x*this.scale.y;i>n||r.push({distance:Math.sqrt(i),point:this.position,face:null,object:this})}}(),i.Sprite.prototype.clone=function(){return new this.constructor(this.material).copy(this)},i.Particle=i.Sprite,i.LensFlare=function(e,t,r,n,o){i.Object3D.call(this),this.lensFlares=[],this.positionScreen=new i.Vector3,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,r,n,o)},i.LensFlare.prototype=Object.create(i.Object3D.prototype),i.LensFlare.prototype.constructor=i.LensFlare,i.LensFlare.prototype.add=function(e,t,r,n,o,a){void 0===t&&(t=-1),void 0===r&&(r=0),void 0===a&&(a=1),void 0===o&&(o=new i.Color(16777215)),void 0===n&&(n=i.NormalBlending),r=Math.min(r,Math.max(0,r)),this.lensFlares.push({texture:e,size:t,distance:r,x:0,y:0,z:0,scale:1,rotation:0,opacity:a,color:o,blending:n})},i.LensFlare.prototype.updateLensFlares=function(){var e,t,r=this.lensFlares.length,i=2*-this.positionScreen.x,n=2*-this.positionScreen.y;for(e=0;r>e;e++)t=this.lensFlares[e],t.x=this.positionScreen.x+i*t.distance,t.y=this.positionScreen.y+n*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)},i.LensFlare.prototype.copy=function(e){i.Object3D.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,r=e.lensFlares.length;r>t;t++)this.lensFlares.push(e.lensFlares[t]);return this},i.Scene=function(){i.Object3D.call(this),this.type="Scene",this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0},i.Scene.prototype=Object.create(i.Object3D.prototype),i.Scene.prototype.constructor=i.Scene,i.Scene.prototype.copy=function(e,t){return i.Object3D.prototype.copy.call(this,e,t),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},i.Fog=function(e,t,r){this.name="",this.color=new i.Color(e),this.near=void 0!==t?t:1,this.far=void 0!==r?r:1e3},i.Fog.prototype.clone=function(){return new i.Fog(this.color.getHex(),this.near,this.far)},i.FogExp2=function(e,t){this.name="",this.color=new i.Color(e),this.density=void 0!==t?t:25e-5},i.FogExp2.prototype.clone=function(){return new i.FogExp2(this.color.getHex(),this.density)},i.ShaderChunk={},i.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n	diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",i.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n	uniform sampler2D alphaMap;\n#endif\n",i.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n	if ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",i.ShaderChunk.aomap_fragment="#ifdef USE_AOMAP\n	float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n	reflectedLight.indirectDiffuse *= ambientOcclusion;\n	#if defined( USE_ENVMAP ) && defined( STANDARD )\n		float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n	#endif\n#endif\n",i.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n	uniform sampler2D aoMap;\n	uniform float aoMapIntensity;\n#endif",i.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",i.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",i.ShaderChunk.bsdfs="bool testLightInRange( const in float lightDistance, const in float cutoffDistance ) {\n	return any( bvec2( cutoffDistance == 0.0, lightDistance < cutoffDistance ) );\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n		if( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n			float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n			float maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n			return distanceFalloff * maxDistanceCutoffFactor;\n#else\n			return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n		}\n		return 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n	return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n	float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n	return ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n	float a2 = pow2( alpha );\n	float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n	float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n	return 1.0 / ( gl * gv );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n	float a2 = pow2( alpha );\n	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n	return RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n	float alpha = pow2( roughness );\n	vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n	float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n	float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n	float dotNH = saturate( dot( geometry.normal, halfDir ) );\n	float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n	vec3 F = F_Schlick( specularColor, dotLH );\n	float G = G_GGX_Smith( alpha, dotNL, dotNV );\n	float D = D_GGX( alpha, dotNH );\n	return F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n	float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n	vec4 r = roughness * c0 + c1;\n	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n	vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n	return specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n	return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n	vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n	float dotNH = saturate( dot( geometry.normal, halfDir ) );\n	float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n	vec3 F = F_Schlick( specularColor, dotLH );\n	float G = G_BlinnPhong_Implicit( );\n	float D = D_BlinnPhong( shininess, dotNH );\n	return F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n	return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n	return sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",i.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n	uniform sampler2D bumpMap;\n	uniform float bumpScale;\n	vec2 dHdxy_fwd() {\n		vec2 dSTdx = dFdx( vUv );\n		vec2 dSTdy = dFdy( vUv );\n		float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n		float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n		float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n		return vec2( dBx, dBy );\n	}\n	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n		vec3 vSigmaX = dFdx( surf_pos );\n		vec3 vSigmaY = dFdy( surf_pos );\n		vec3 vN = surf_norm;\n		vec3 R1 = cross( vSigmaY, vN );\n		vec3 R2 = cross( vN, vSigmaX );\n		float fDet = dot( vSigmaX, R1 );\n		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n		return normalize( abs( fDet ) * surf_norm - vGrad );\n	}\n#endif\n",i.ShaderChunk.color_fragment="#ifdef USE_COLOR\n	diffuseColor.rgb *= vColor;\n#endif",i.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n	varying vec3 vColor;\n#endif\n",i.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n	varying vec3 vColor;\n#endif",i.ShaderChunk.color_vertex="#ifdef USE_COLOR\n	vColor.xyz = color.xyz;\n#endif",i.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nstruct IncidentLight {\n	vec3 color;\n	vec3 direction;\n	bool visible;\n};\nstruct ReflectedLight {\n	vec3 directDiffuse;\n	vec3 directSpecular;\n	vec3 indirectDiffuse;\n	vec3 indirectSpecular;\n};\nstruct GeometricContext {\n	vec3 position;\n	vec3 normal;\n	vec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n	float distance = dot( planeNormal, point - pointOnPlane );\n	return - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n	return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n	return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\n",i.ShaderChunk.cube_uv_reflection_fragment="#ifdef ENVMAP_TYPE_CUBE_UV\nconst float cubeUV_textureSize = 1024.0;\nint getFaceFromDirection(vec3 direction) {\n    vec3 absDirection = abs(direction);\n    int face = -1;\n    if( absDirection.x > absDirection.z ) {\n        if(absDirection.x > absDirection.y )\n            face = direction.x > 0.0 ? 0 : 3;\n        else\n            face = direction.y > 0.0 ? 1 : 4;\n    }\n    else {\n        if(absDirection.z > absDirection.y )\n            face = direction.z > 0.0 ? 2 : 5;\n        else\n            face = direction.y > 0.0 ? 1 : 4;\n    }\n    return face;\n}\nconst float cubeUV_maxLods1 = log2(cubeUV_textureSize*0.25) - 1.0;\nconst float cubeUV_rangeClamp = exp2((6.0 - 1.0) * 2.0);\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n    float scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n    float dxRoughness = dFdx(roughness);\n    float dyRoughness = dFdy(roughness);\n    vec3 dx = dFdx( vec * scale * dxRoughness );\n    vec3 dy = dFdy( vec * scale * dyRoughness );\n    float d = max( dot( dx, dx ), dot( dy, dy ) );\n    d = clamp(d, 1.0, cubeUV_rangeClamp);\n    float mipLevel = 0.5 * log2(d);\n    return vec2(floor(mipLevel), fract(mipLevel));\n}\nconst float cubeUV_maxLods2 = log2(cubeUV_textureSize*0.25) - 2.0;\nconst float cubeUV_rcpTextureSize = 1.0 / cubeUV_textureSize;\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n    mipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n    float a = 16.0 * cubeUV_rcpTextureSize;\n    vec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n    vec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n    float powScale = exp2_packed.x * exp2_packed.y;\n    float scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n    float mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n    bool bRes = mipLevel == 0.0;\n    scale =  bRes && (scale < a) ? a : scale;\n    vec3 r;\n    vec2 offset;\n    int face = getFaceFromDirection(direction);\n    float rcpPowScale = 1.0 / powScale;\n    if( face == 0) {\n        r = vec3(direction.x, -direction.z, direction.y);\n        offset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n        offset.y = bRes && (offset.y < 2.0*a) ?  a : offset.y;\n    }\n    else if( face == 1) {\n        r = vec3(direction.y, direction.x, direction.z);\n        offset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n        offset.y = bRes && (offset.y < 2.0*a) ?  a : offset.y;\n    }\n    else if( face == 2) {\n        r = vec3(direction.z, direction.x, direction.y);\n        offset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n        offset.y = bRes && (offset.y < 2.0*a) ?  a : offset.y;\n    }\n    else if( face == 3) {\n        r = vec3(direction.x, direction.z, direction.y);\n        offset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n        offset.y = bRes && (offset.y < 2.0*a) ?  0.0 : offset.y;\n    }\n    else if( face == 4) {\n        r = vec3(direction.y, direction.x, -direction.z);\n        offset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n        offset.y = bRes && (offset.y < 2.0*a) ?  0.0 : offset.y;\n    }\n    else {\n        r = vec3(direction.z, -direction.x, direction.y);\n        offset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n        offset.y = bRes && (offset.y < 2.0*a) ?  0.0 : offset.y;\n    }\n    r = normalize(r);\n    float texelOffset = 0.5 * cubeUV_rcpTextureSize;\n    vec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n    vec2 base = offset + vec2( texelOffset );\n    return base + s * ( scale - 2.0 * texelOffset );\n}\nconst float cubeUV_maxLods3 = log2(cubeUV_textureSize*0.25) - 3.0;\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n    float roughnessVal = roughness* cubeUV_maxLods3;\n    float r1 = floor(roughnessVal);\n    float r2 = r1 + 1.0;\n    float t = fract(roughnessVal);\n    vec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n    float s = mipInfo.y;\n    float level0 = mipInfo.x;\n    float level1 = level0 + 1.0;\n    level1 = level1 > 5.0 ? 5.0 : level1;\n    level0 += min( floor( s + 0.5 ), 5.0 );\n    vec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n    vec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n    vec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n    vec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n    vec4 result = mix(color10, color20, t);\n    return vec4(result.rgb, 1.0);\n}\n#endif\n",
  i.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n	objectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",i.ShaderChunk.displacementmap_vertex="#ifdef USE_DISPLACEMENTMAP\n	transformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",i.ShaderChunk.displacementmap_pars_vertex="#ifdef USE_DISPLACEMENTMAP\n	uniform sampler2D displacementMap;\n	uniform float displacementScale;\n	uniform float displacementBias;\n#endif\n",i.ShaderChunk.emissivemap_fragment="#ifdef USE_EMISSIVEMAP\n	vec4 emissiveColor = texture2D( emissiveMap, vUv );\n	emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n	totalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",i.ShaderChunk.emissivemap_pars_fragment="#ifdef USE_EMISSIVEMAP\n	uniform sampler2D emissiveMap;\n#endif\n",i.ShaderChunk.encodings_pars_fragment="\nvec4 LinearToLinear( in vec4 value ) {\n  return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n  return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n  return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n  return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n  return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n  return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n  float maxComponent = max( max( value.r, value.g ), value.b );\n  float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n  return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n  return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n  float maxRGB = max( value.x, max( value.g, value.b ) );\n  float M      = clamp( maxRGB / maxRange, 0.0, 1.0 );\n  M            = ceil( M * 255.0 ) / 255.0;\n  return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n    return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n    float maxRGB = max( value.x, max( value.g, value.b ) );\n    float D      = max( maxRange / maxRGB, 1.0 );\n    D            = min( floor( D ) / 255.0, 1.0 );\n    return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value )  {\n  vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n  Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n  vec4 vResult;\n  vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n  float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n  vResult.w = fract(Le);\n  vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n  return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n  float Le = value.z * 255.0 + value.w;\n  vec3 Xp_Y_XYZp;\n  Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n  Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n  Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n  vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n  return vec4( max(vRGB, 0.0), 1.0 );\n}\n",i.ShaderChunk.encodings_fragment="  gl_FragColor = linearToOutputTexel( gl_FragColor );\n",i.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n		vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n		#ifdef ENVMAP_MODE_REFLECTION\n			vec3 reflectVec = reflect( cameraToVertex, worldNormal );\n		#else\n			vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n		#endif\n	#else\n		vec3 reflectVec = vReflect;\n	#endif\n	#ifdef DOUBLE_SIDED\n		float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n	#else\n		float flipNormal = 1.0;\n	#endif\n	#ifdef ENVMAP_TYPE_CUBE\n		vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n	#elif defined( ENVMAP_TYPE_EQUIREC )\n		vec2 sampleUV;\n		sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n		sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n		vec4 envColor = texture2D( envMap, sampleUV );\n	#elif defined( ENVMAP_TYPE_SPHERE )\n		vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n		vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n	#endif\n	envColor = envMapTexelToLinear( envColor );\n	#ifdef ENVMAP_BLENDING_MULTIPLY\n		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n	#elif defined( ENVMAP_BLENDING_MIX )\n		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n	#elif defined( ENVMAP_BLENDING_ADD )\n		outgoingLight += envColor.xyz * specularStrength * reflectivity;\n	#endif\n#endif\n",i.ShaderChunk.envmap_pars_fragment="#if defined( USE_ENVMAP ) || defined( STANDARD )\n	uniform float reflectivity;\n	uniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n	#ifdef ENVMAP_TYPE_CUBE\n		uniform samplerCube envMap;\n	#else\n		uniform sampler2D envMap;\n	#endif\n	uniform float flipEnvMap;\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( STANDARD )\n		uniform float refractionRatio;\n	#else\n		varying vec3 vReflect;\n	#endif\n#endif\n",i.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n	varying vec3 vReflect;\n	uniform float refractionRatio;\n#endif\n",i.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n	vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n	vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n	#ifdef ENVMAP_MODE_REFLECTION\n		vReflect = reflect( cameraToVertex, worldNormal );\n	#else\n		vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n	#endif\n#endif\n",i.ShaderChunk.fog_fragment="#ifdef USE_FOG\n	#ifdef USE_LOGDEPTHBUF_EXT\n		float depth = gl_FragDepthEXT / gl_FragCoord.w;\n	#else\n		float depth = gl_FragCoord.z / gl_FragCoord.w;\n	#endif\n	#ifdef FOG_EXP2\n		float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n	#else\n		float fogFactor = smoothstep( fogNear, fogFar, depth );\n	#endif\n	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",i.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n	uniform vec3 fogColor;\n	#ifdef FOG_EXP2\n		uniform float fogDensity;\n	#else\n		uniform float fogNear;\n		uniform float fogFar;\n	#endif\n#endif",i.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n	reflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",i.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n	uniform sampler2D lightMap;\n	uniform float lightMapIntensity;\n#endif",i.ShaderChunk.lights_lambert_vertex="vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n	vLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n		directLight = getPointDirectLightIrradiance( pointLights[ i ], geometry );\n		dotNL = dot( geometry.normal, directLight.direction );\n		directLightColor_Diffuse = PI * directLight.color;\n		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n		#ifdef DOUBLE_SIDED\n			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n		#endif\n	}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n		directLight = getSpotDirectLightIrradiance( spotLights[ i ], geometry );\n		dotNL = dot( geometry.normal, directLight.direction );\n		directLightColor_Diffuse = PI * directLight.color;\n		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n		#ifdef DOUBLE_SIDED\n			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n		#endif\n	}\n#endif\n#if NUM_DIR_LIGHTS > 0\n	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n		directLight = getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry );\n		dotNL = dot( geometry.normal, directLight.direction );\n		directLightColor_Diffuse = PI * directLight.color;\n		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n		#ifdef DOUBLE_SIDED\n			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n		#endif\n	}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n	for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n		vLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n		#ifdef DOUBLE_SIDED\n			vLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n		#endif\n	}\n#endif\n",i.ShaderChunk.lights_pars="uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n	vec3 irradiance = ambientLightColor;\n	#ifndef PHYSICALLY_CORRECT_LIGHTS\n		irradiance *= PI;\n	#endif\n	return irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n	struct DirectionalLight {\n		vec3 direction;\n		vec3 color;\n		int shadow;\n		float shadowBias;\n		float shadowRadius;\n		vec2 shadowMapSize;\n	};\n	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n	IncidentLight getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry ) {\n		IncidentLight directLight;\n		directLight.color = directionalLight.color;\n		directLight.direction = directionalLight.direction;\n		directLight.visible = true;\n		return directLight;\n	}\n#endif\n#if NUM_POINT_LIGHTS > 0\n	struct PointLight {\n		vec3 position;\n		vec3 color;\n		float distance;\n		float decay;\n		int shadow;\n		float shadowBias;\n		float shadowRadius;\n		vec2 shadowMapSize;\n	};\n	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n	IncidentLight getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry ) {\n		IncidentLight directLight;\n		vec3 lVector = pointLight.position - geometry.position;\n		directLight.direction = normalize( lVector );\n		float lightDistance = length( lVector );\n		if ( testLightInRange( lightDistance, pointLight.distance ) ) {\n			directLight.color = pointLight.color;\n			directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n			directLight.visible = true;\n		} else {\n			directLight.color = vec3( 0.0 );\n			directLight.visible = false;\n		}\n		return directLight;\n	}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n	struct SpotLight {\n		vec3 position;\n		vec3 direction;\n		vec3 color;\n		float distance;\n		float decay;\n		float coneCos;\n		float penumbraCos;\n		int shadow;\n		float shadowBias;\n		float shadowRadius;\n		vec2 shadowMapSize;\n	};\n	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n	IncidentLight getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry ) {\n		IncidentLight directLight;\n		vec3 lVector = spotLight.position - geometry.position;\n		directLight.direction = normalize( lVector );\n		float lightDistance = length( lVector );\n		float angleCos = dot( directLight.direction, spotLight.direction );\n		if ( all( bvec2( angleCos > spotLight.coneCos, testLightInRange( lightDistance, spotLight.distance ) ) ) ) {\n			float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n			directLight.color = spotLight.color;\n			directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n			directLight.visible = true;\n		} else {\n			directLight.color = vec3( 0.0 );\n			directLight.visible = false;\n		}\n		return directLight;\n	}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n	struct HemisphereLight {\n		vec3 direction;\n		vec3 skyColor;\n		vec3 groundColor;\n	};\n	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n		float dotNL = dot( geometry.normal, hemiLight.direction );\n		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n		#ifndef PHYSICALLY_CORRECT_LIGHTS\n			irradiance *= PI;\n		#endif\n		return irradiance;\n	}\n#endif\n#if defined( USE_ENVMAP ) && defined( STANDARD )\n	vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n		#ifdef DOUBLE_SIDED\n			float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n		#else\n			float flipNormal = 1.0;\n		#endif\n		vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n		#ifdef ENVMAP_TYPE_CUBE\n			vec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n			#ifdef TEXTURE_LOD_EXT\n				vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n			#else\n				vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n			#endif\n		#elif defined( ENVMAP_TYPE_CUBE_UV )\n			vec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n			vec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n		#else\n			vec4 envMapColor = vec4( 0.0 );\n		#endif\n		envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n		return PI * envMapColor.rgb * envMapIntensity;\n	}\n	float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n		float maxMIPLevelScalar = float( maxMIPLevel );\n		float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n		return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n	}\n	vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n		#ifdef ENVMAP_MODE_REFLECTION\n			vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n		#else\n			vec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n		#endif\n		#ifdef DOUBLE_SIDED\n			float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n		#else\n			float flipNormal = 1.0;\n		#endif\n		reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n		float specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n		#ifdef ENVMAP_TYPE_CUBE\n			vec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n			#ifdef TEXTURE_LOD_EXT\n				vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n			#else\n				vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n			#endif\n		#elif defined( ENVMAP_TYPE_CUBE_UV )\n			vec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n			vec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n		#elif defined( ENVMAP_TYPE_EQUIREC )\n			vec2 sampleUV;\n			sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n			sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n			#ifdef TEXTURE_LOD_EXT\n				vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n			#else\n				vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n			#endif\n		#elif defined( ENVMAP_TYPE_SPHERE )\n			vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n			#ifdef TEXTURE_LOD_EXT\n				vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n			#else\n				vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n			#endif\n		#endif\n		envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n		return envMapColor.rgb * envMapIntensity;\n	}\n#endif\n",i.ShaderChunk.lights_phong_fragment="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",i.ShaderChunk.lights_phong_pars_fragment="#ifdef USE_ENVMAP\n	varying vec3 vWorldPosition;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n	vec3	diffuseColor;\n	vec3	specularColor;\n	float	specularShininess;\n	float	specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n	vec3 irradiance = dotNL * directLight.color;\n	#ifndef PHYSICALLY_CORRECT_LIGHTS\n		irradiance *= PI;\n	#endif\n	reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n	reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n	reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct				RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )	(0)\n",i.ShaderChunk.lights_phong_pars_vertex="#ifdef USE_ENVMAP\n	varying vec3 vWorldPosition;\n#endif\n",i.ShaderChunk.lights_phong_vertex="#ifdef USE_ENVMAP\n	vWorldPosition = worldPosition.xyz;\n#endif\n",i.ShaderChunk.lights_standard_fragment="StandardMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\nmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n",i.ShaderChunk.lights_standard_pars_fragment="struct StandardMaterial {\n	vec3	diffuseColor;\n	float	specularRoughness;\n	vec3	specularColor;\n};\nvoid RE_Direct_Standard( const in IncidentLight directLight, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n	vec3 irradiance = dotNL * directLight.color;\n	#ifndef PHYSICALLY_CORRECT_LIGHTS\n		irradiance *= PI;\n	#endif\n	reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n	reflectedLight.directSpecular += irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n}\nvoid RE_IndirectDiffuse_Standard( const in vec3 irradiance, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n	reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Standard( const in vec3 radiance, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n	reflectedLight.indirectSpecular += radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n}\n#define RE_Direct				RE_Direct_Standard\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_Standard\n#define RE_IndirectSpecular		RE_IndirectSpecular_Standard\n#define Material_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.specularRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",i.ShaderChunk.lights_template="\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n	PointLight pointLight;\n	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n		pointLight = pointLights[ i ];\n		directLight = getPointDirectLightIrradiance( pointLight, geometry );\n		#ifdef USE_SHADOWMAP\n		directLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometry, material, reflectedLight );\n	}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n	SpotLight spotLight;\n	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n		spotLight = spotLights[ i ];\n		directLight = getSpotDirectLightIrradiance( spotLight, geometry );\n		#ifdef USE_SHADOWMAP\n		directLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometry, material, reflectedLight );\n	}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n	DirectionalLight directionalLight;\n	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n		directionalLight = directionalLights[ i ];\n		directLight = getDirectionalDirectLightIrradiance( directionalLight, geometry );\n		#ifdef USE_SHADOWMAP\n		directLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometry, material, reflectedLight );\n	}\n#endif\n#if defined( RE_IndirectDiffuse )\n	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n	#ifdef USE_LIGHTMAP\n		vec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n		#ifndef PHYSICALLY_CORRECT_LIGHTS\n			lightMapIrradiance *= PI;\n		#endif\n		irradiance += lightMapIrradiance;\n	#endif\n	#if ( NUM_HEMI_LIGHTS > 0 )\n		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n		}\n	#endif\n	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n	 	irradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n	#endif\n	RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n	vec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n	RE_IndirectSpecular( radiance, geometry, material, reflectedLight );\n#endif\n",i.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n	gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",i.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n	uniform float logDepthBufFC;\n	#ifdef USE_LOGDEPTHBUF_EXT\n		varying float vFragDepth;\n	#endif\n#endif\n",i.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n	#ifdef USE_LOGDEPTHBUF_EXT\n		varying float vFragDepth;\n	#endif\n	uniform float logDepthBufFC;\n#endif",i.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n	gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n	#ifdef USE_LOGDEPTHBUF_EXT\n		vFragDepth = 1.0 + gl_Position.w;\n	#else\n		gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n	#endif\n#endif\n",i.ShaderChunk.map_fragment="#ifdef USE_MAP\n	vec4 texelColor = texture2D( map, vUv );\n	texelColor = mapTexelToLinear( texelColor );\n	diffuseColor *= texelColor;\n#endif\n",i.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n	uniform sampler2D map;\n#endif\n",i.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n	vec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n	diffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",i.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n	uniform vec4 offsetRepeat;\n	uniform sampler2D map;\n#endif\n",i.ShaderChunk.metalnessmap_fragment="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n	vec4 texelMetalness = texture2D( metalnessMap, vUv );\n	metalnessFactor *= texelMetalness.r;\n#endif\n",i.ShaderChunk.metalnessmap_pars_fragment="#ifdef USE_METALNESSMAP\n	uniform sampler2D metalnessMap;\n#endif",i.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n	objectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n	objectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n	objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n	objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",i.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n	#ifndef USE_MORPHNORMALS\n	uniform float morphTargetInfluences[ 8 ];\n	#else\n	uniform float morphTargetInfluences[ 4 ];\n	#endif\n#endif",i.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n	transformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n	transformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n	transformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n	transformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n	#ifndef USE_MORPHNORMALS\n	transformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n	transformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n	transformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n	transformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n	#endif\n#endif\n",i.ShaderChunk.normal_fragment="#ifdef FLAT_SHADED\n	vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n	vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n	vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n	vec3 normal = normalize( vNormal );\n	#ifdef DOUBLE_SIDED\n		normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n	#endif\n#endif\n#ifdef USE_NORMALMAP\n	normal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n	normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",i.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n	uniform sampler2D normalMap;\n	uniform vec2 normalScale;\n	vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n		vec3 q0 = dFdx( eye_pos.xyz );\n		vec3 q1 = dFdy( eye_pos.xyz );\n		vec2 st0 = dFdx( vUv.st );\n		vec2 st1 = dFdy( vUv.st );\n		vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n		vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n		vec3 N = normalize( surf_norm );\n		vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n		mapN.xy = normalScale * mapN.xy;\n		mat3 tsn = mat3( S, T, N );\n		return normalize( tsn * mapN );\n	}\n#endif\n",i.ShaderChunk.premultiplied_alpha_fragment="#ifdef PREMULTIPLIED_ALPHA\n	gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",i.ShaderChunk.project_vertex="#ifdef USE_SKINNING\n	vec4 mvPosition = modelViewMatrix * skinned;\n#else\n	vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",i.ShaderChunk.roughnessmap_fragment="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n	vec4 texelRoughness = texture2D( roughnessMap, vUv );\n	roughnessFactor *= texelRoughness.r;\n#endif\n",i.ShaderChunk.roughnessmap_pars_fragment="#ifdef USE_ROUGHNESSMAP\n	uniform sampler2D roughnessMap;\n#endif",i.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHTS > 0\n		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n	#endif\n	#if NUM_SPOT_LIGHTS > 0\n		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n		varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n	#endif\n	#if NUM_POINT_LIGHTS > 0\n		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n	#endif\n	float unpackDepth( const in vec4 rgba_depth ) {\n		const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n		return dot( rgba_depth, bit_shift );\n	}\n	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n		return step( compare, unpackDepth( texture2D( depths, uv ) ) );\n	}\n	float texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n		const vec2 offset = vec2( 0.0, 1.0 );\n		vec2 texelSize = vec2( 1.0 ) / size;\n		vec2 centroidUV = floor( uv * size + 0.5 ) / size;\n		float lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n		float lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n		float rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n		float rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n		vec2 f = fract( uv * size + 0.5 );\n		float a = mix( lb, lt, f.y );\n		float b = mix( rb, rt, f.y );\n		float c = mix( a, b, f.x );\n		return c;\n	}\n	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n		shadowCoord.xyz /= shadowCoord.w;\n		shadowCoord.z += shadowBias;\n		bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n		bool inFrustum = all( inFrustumVec );\n		bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n		bool frustumTest = all( frustumTestVec );\n		if ( frustumTest ) {\n		#if defined( SHADOWMAP_TYPE_PCF )\n			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n			float dx0 = - texelSize.x * shadowRadius;\n			float dy0 = - texelSize.y * shadowRadius;\n			float dx1 = + texelSize.x * shadowRadius;\n			float dy1 = + texelSize.y * shadowRadius;\n			return (\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n			) * ( 1.0 / 9.0 );\n		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n			float dx0 = - texelSize.x * shadowRadius;\n			float dy0 = - texelSize.y * shadowRadius;\n			float dx1 = + texelSize.x * shadowRadius;\n			float dy1 = + texelSize.y * shadowRadius;\n			return (\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n			) * ( 1.0 / 9.0 );\n		#else\n			return texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n		#endif\n		}\n		return 1.0;\n	}\n	vec2 cubeToUV( vec3 v, float texelSizeY ) {\n		vec3 absV = abs( v );\n		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n		absV *= scaleToCube;\n		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n		vec2 planar = v.xy;\n		float almostATexel = 1.5 * texelSizeY;\n		float almostOne = 1.0 - almostATexel;\n		if ( absV.z >= almostOne ) {\n			if ( v.z > 0.0 )\n				planar.x = 4.0 - v.x;\n		} else if ( absV.x >= almostOne ) {\n			float signX = sign( v.x );\n			planar.x = v.z * signX + 2.0 * signX;\n		} else if ( absV.y >= almostOne ) {\n			float signY = sign( v.y );\n			planar.x = v.x + 2.0 * signY + 2.0;\n			planar.y = v.z * signY - 2.0;\n		}\n		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n	}\n	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n		vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n		vec3 lightToPosition = shadowCoord.xyz;\n		vec3 bd3D = normalize( lightToPosition );\n		float dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n		#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n			vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n			return (\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n			) * ( 1.0 / 9.0 );\n		#else\n			return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n		#endif\n	}\n#endif\n",
  i.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHTS > 0\n		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n	#endif\n	#if NUM_SPOT_LIGHTS > 0\n		uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n		varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n	#endif\n	#if NUM_POINT_LIGHTS > 0\n		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n	#endif\n#endif\n",i.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHTS > 0\n	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n		vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n	}\n	#endif\n	#if NUM_SPOT_LIGHTS > 0\n	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n		vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n	}\n	#endif\n	#if NUM_POINT_LIGHTS > 0\n	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n		vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n	}\n	#endif\n#endif\n",i.ShaderChunk.shadowmask_pars_fragment="float getShadowMask() {\n	float shadow = 1.0;\n	#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHTS > 0\n	DirectionalLight directionalLight;\n	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n		directionalLight = directionalLights[ i ];\n		shadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n	}\n	#endif\n	#if NUM_SPOT_LIGHTS > 0\n	SpotLight spotLight;\n	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n		spotLight = spotLights[ i ];\n		shadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n	}\n	#endif\n	#if NUM_POINT_LIGHTS > 0\n	PointLight pointLight;\n	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n		pointLight = pointLights[ i ];\n		shadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n	}\n	#endif\n	#endif\n	return shadow;\n}\n",i.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n	mat4 boneMatX = getBoneMatrix( skinIndex.x );\n	mat4 boneMatY = getBoneMatrix( skinIndex.y );\n	mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n	mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",i.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n	uniform mat4 bindMatrix;\n	uniform mat4 bindMatrixInverse;\n	#ifdef BONE_TEXTURE\n		uniform sampler2D boneTexture;\n		uniform int boneTextureWidth;\n		uniform int boneTextureHeight;\n		mat4 getBoneMatrix( const in float i ) {\n			float j = i * 4.0;\n			float x = mod( j, float( boneTextureWidth ) );\n			float y = floor( j / float( boneTextureWidth ) );\n			float dx = 1.0 / float( boneTextureWidth );\n			float dy = 1.0 / float( boneTextureHeight );\n			y = dy * ( y + 0.5 );\n			vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n			vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n			vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n			vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n			mat4 bone = mat4( v1, v2, v3, v4 );\n			return bone;\n		}\n	#else\n		uniform mat4 boneGlobalMatrices[ MAX_BONES ];\n		mat4 getBoneMatrix( const in float i ) {\n			mat4 bone = boneGlobalMatrices[ int(i) ];\n			return bone;\n		}\n	#endif\n#endif\n",i.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n	vec4 skinned = vec4( 0.0 );\n	skinned += boneMatX * skinVertex * skinWeight.x;\n	skinned += boneMatY * skinVertex * skinWeight.y;\n	skinned += boneMatZ * skinVertex * skinWeight.z;\n	skinned += boneMatW * skinVertex * skinWeight.w;\n	skinned  = bindMatrixInverse * skinned;\n#endif\n",i.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n	mat4 skinMatrix = mat4( 0.0 );\n	skinMatrix += skinWeight.x * boneMatX;\n	skinMatrix += skinWeight.y * boneMatY;\n	skinMatrix += skinWeight.z * boneMatZ;\n	skinMatrix += skinWeight.w * boneMatW;\n	skinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;\n	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",i.ShaderChunk.specularmap_fragment="float specularStrength;\n#ifdef USE_SPECULARMAP\n	vec4 texelSpecular = texture2D( specularMap, vUv );\n	specularStrength = texelSpecular.r;\n#else\n	specularStrength = 1.0;\n#endif",i.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n	uniform sampler2D specularMap;\n#endif",i.ShaderChunk.tonemapping_fragment="#if defined( TONE_MAPPING )\n  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",i.ShaderChunk.tonemapping_pars_fragment="#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n  return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n  color *= toneMappingExposure;\n  return saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n  color *= toneMappingExposure;\n  return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n  color *= toneMappingExposure;\n  color = max( vec3( 0.0 ), color - 0.004 );\n  return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",i.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n	varying vec2 vUv2;\n#endif",i.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n	attribute vec2 uv2;\n	varying vec2 vUv2;\n#endif",i.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n	vUv2 = uv2;\n#endif",i.ShaderChunk.uv_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n	varying vec2 vUv;\n#endif",i.ShaderChunk.uv_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n	varying vec2 vUv;\n	uniform vec4 offsetRepeat;\n#endif\n",i.ShaderChunk.uv_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n	vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",i.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( STANDARD ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n	#ifdef USE_SKINNING\n		vec4 worldPosition = modelMatrix * skinned;\n	#else\n		vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n	#endif\n#endif\n",i.UniformsUtils={merge:function(e){for(var t={},r=0;r<e.length;r++){var i=this.clone(e[r]);for(var n in i)t[n]=i[n]}return t},clone:function(e){var t={};for(var r in e){t[r]={};for(var n in e[r]){var o=e[r][n];o instanceof i.Color||o instanceof i.Vector2||o instanceof i.Vector3||o instanceof i.Vector4||o instanceof i.Matrix3||o instanceof i.Matrix4||o instanceof i.Texture?t[r][n]=o.clone():Array.isArray(o)?t[r][n]=o.slice():t[r][n]=o}}return t}},i.UniformsLib={common:{diffuse:{type:"c",value:new i.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new i.Vector4(0,0,1,1)},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98}},aomap:{aoMap:{type:"t",value:null},aoMapIntensity:{type:"f",value:1}},lightmap:{lightMap:{type:"t",value:null},lightMapIntensity:{type:"f",value:1}},emissivemap:{emissiveMap:{type:"t",value:null}},bumpmap:{bumpMap:{type:"t",value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new i.Vector2(1,1)}},displacementmap:{displacementMap:{type:"t",value:null},displacementScale:{type:"f",value:1},displacementBias:{type:"f",value:0}},roughnessmap:{roughnessMap:{type:"t",value:null}},metalnessmap:{metalnessMap:{type:"t",value:null}},fog:{fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new i.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLights:{type:"sa",value:[],properties:{direction:{type:"v3"},color:{type:"c"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},directionalShadowMap:{type:"tv",value:[]},directionalShadowMatrix:{type:"m4v",value:[]},spotLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},direction:{type:"v3"},distance:{type:"f"},coneCos:{type:"f"},penumbraCos:{type:"f"},decay:{type:"f"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},spotShadowMap:{type:"tv",value:[]},spotShadowMatrix:{type:"m4v",value:[]},pointLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},decay:{type:"f"},distance:{type:"f"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},pointShadowMap:{type:"tv",value:[]},pointShadowMatrix:{type:"m4v",value:[]},hemisphereLights:{type:"sa",value:[],properties:{direction:{type:"v3"},skyColor:{type:"c"},groundColor:{type:"c"}}}},points:{diffuse:{type:"c",value:new i.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new i.Vector4(0,0,1,1)}}},i.ShaderChunk.cube_frag="uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n	gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n	#include <logdepthbuf_fragment>\n}\n",i.ShaderChunk.cube_vert="varying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n	vWorldPosition = transformDirection( position, modelMatrix );\n	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n	#include <logdepthbuf_vertex>\n}\n",i.ShaderChunk.depth_frag="uniform float mNear;\nuniform float mFar;\nuniform float opacity;\n#include <common>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n	#include <logdepthbuf_fragment>\n	#ifdef USE_LOGDEPTHBUF_EXT\n		float depth = gl_FragDepthEXT / gl_FragCoord.w;\n	#else\n		float depth = gl_FragCoord.z / gl_FragCoord.w;\n	#endif\n	float color = 1.0 - smoothstep( mNear, mFar, depth );\n	gl_FragColor = vec4( vec3( color ), opacity );\n}\n",i.ShaderChunk.depth_vert="#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n}\n",i.ShaderChunk.depthRGBA_frag="#include <common>\n#include <logdepthbuf_pars_fragment>\nvec4 pack_depth( const in float depth ) {\n	const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n	const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n	vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n	res -= res.xxyz * bit_mask;\n	return res;\n}\nvoid main() {\n	#include <logdepthbuf_fragment>\n	#ifdef USE_LOGDEPTHBUF_EXT\n		gl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n	#else\n		gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n	#endif\n}\n",i.ShaderChunk.depthRGBA_vert="#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n	#include <skinbase_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n}\n",i.ShaderChunk.distanceRGBA_frag="uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\nvec4 pack1K ( float depth ) {\n	depth /= 1000.0;\n	const vec4 bitSh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n	const vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n	vec4 res = mod( depth * bitSh * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n	res -= res.xxyz * bitMsk;\n	return res;\n}\nfloat unpack1K ( vec4 color ) {\n	const vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n	return dot( color, bitSh ) * 1000.0;\n}\nvoid main () {\n	gl_FragColor = pack1K( length( vWorldPosition.xyz - lightPos.xyz ) );\n}\n",i.ShaderChunk.distanceRGBA_vert="varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\nvoid main() {\n	#include <skinbase_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <worldpos_vertex>\n	vWorldPosition = worldPosition;\n}\n",i.ShaderChunk.equirect_frag="uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n	vec3 direction = normalize( vWorldPosition );\n	vec2 sampleUV;\n	sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n	sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n	gl_FragColor = texture2D( tEquirect, sampleUV );\n	#include <logdepthbuf_fragment>\n}\n",i.ShaderChunk.equirect_vert="varying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n	vWorldPosition = transformDirection( position, modelMatrix );\n	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n	#include <logdepthbuf_vertex>\n}\n",i.ShaderChunk.linedashed_frag="uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n	if ( mod( vLineDistance, totalSize ) > dashSize ) {\n		discard;\n	}\n	vec3 outgoingLight = vec3( 0.0 );\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <logdepthbuf_fragment>\n	#include <color_fragment>\n	outgoingLight = diffuseColor.rgb;\n	gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n	#include <premultiplied_alpha_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n}\n",i.ShaderChunk.linedashed_vert="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n	#include <color_vertex>\n	vLineDistance = scale * lineDistance;\n	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n	gl_Position = projectionMatrix * mvPosition;\n	#include <logdepthbuf_vertex>\n}\n",i.ShaderChunk.meshbasic_frag="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <specularmap_fragment>\n	ReflectedLight reflectedLight;\n	reflectedLight.directDiffuse = vec3( 0.0 );\n	reflectedLight.directSpecular = vec3( 0.0 );\n	reflectedLight.indirectDiffuse = diffuseColor.rgb;\n	reflectedLight.indirectSpecular = vec3( 0.0 );\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.indirectDiffuse;\n	#include <envmap_fragment>\n	gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n	#include <premultiplied_alpha_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n}\n",i.ShaderChunk.meshbasic_vert="#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <uv2_vertex>\n	#include <color_vertex>\n	#include <skinbase_vertex>\n	#ifdef USE_ENVMAP\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#endif\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n}\n",i.ShaderChunk.meshlambert_frag="uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n	varying vec3 vLightBack;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <specularmap_fragment>\n	#include <emissivemap_fragment>\n	reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n	#include <lightmap_fragment>\n	reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n	#ifdef DOUBLE_SIDED\n		reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n	#else\n		reflectedLight.directDiffuse = vLightFront;\n	#endif\n	reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n	#include <envmap_fragment>\n	gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n	#include <premultiplied_alpha_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n}\n",i.ShaderChunk.meshlambert_vert="#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n	varying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <uv2_vertex>\n	#include <color_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <lights_lambert_vertex>\n	#include <shadowmap_vertex>\n}\n",i.ShaderChunk.meshphong_frag="#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <specularmap_fragment>\n	#include <normal_fragment>\n	#include <emissivemap_fragment>\n	#include <lights_phong_fragment>\n	#include <lights_template>\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n	#include <envmap_fragment>\n	gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n	#include <premultiplied_alpha_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n}\n",i.ShaderChunk.meshphong_vert="#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <lights_phong_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <uv2_vertex>\n	#include <color_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n	vNormal = normalize( transformedNormal );\n#endif\n	#include <begin_vertex>\n	#include <displacementmap_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <lights_phong_vertex>\n	#include <shadowmap_vertex>\n}\n",i.ShaderChunk.meshstandard_frag="#define STANDARD\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_standard_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <specularmap_fragment>\n	#include <roughnessmap_fragment>\n	#include <metalnessmap_fragment>\n	#include <normal_fragment>\n	#include <emissivemap_fragment>\n	#include <lights_standard_fragment>\n	#include <lights_template>\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n	gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n	#include <premultiplied_alpha_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n}\n",i.ShaderChunk.meshstandard_vert="#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <uv2_vertex>\n	#include <color_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n	vNormal = normalize( transformedNormal );\n#endif\n	#include <begin_vertex>\n	#include <displacementmap_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <shadowmap_vertex>\n}\n",i.ShaderChunk.normal_frag="uniform float opacity;\nvarying vec3 vNormal;\n#include <common>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n	gl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n	#include <logdepthbuf_fragment>\n}\n",i.ShaderChunk.normal_vert="varying vec3 vNormal;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n	vNormal = normalize( normalMatrix * normal );\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n}\n",i.ShaderChunk.points_frag="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n	vec3 outgoingLight = vec3( 0.0 );\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <logdepthbuf_fragment>\n	#include <map_particle_fragment>\n	#include <color_fragment>\n	#include <alphatest_fragment>\n	outgoingLight = diffuseColor.rgb;\n	gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n	#include <premultiplied_alpha_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n}\n",i.ShaderChunk.points_vert="uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n	#include <color_vertex>\n	#include <begin_vertex>\n	#include <project_vertex>\n	#ifdef USE_SIZEATTENUATION\n		gl_PointSize = size * ( scale / - mvPosition.z );\n	#else\n		gl_PointSize = size;\n	#endif\n	#include <logdepthbuf_vertex>\n	#include <worldpos_vertex>\n	#include <shadowmap_vertex>\n}\n",i.ShaderLib={basic:{uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.aomap,i.UniformsLib.fog]),vertexShader:i.ShaderChunk.meshbasic_vert,fragmentShader:i.ShaderChunk.meshbasic_frag},lambert:{uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.aomap,i.UniformsLib.lightmap,i.UniformsLib.emissivemap,i.UniformsLib.fog,i.UniformsLib.lights,{emissive:{type:"c",value:new i.Color(0)}}]),vertexShader:i.ShaderChunk.meshlambert_vert,fragmentShader:i.ShaderChunk.meshlambert_frag},phong:{uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.aomap,i.UniformsLib.lightmap,i.UniformsLib.emissivemap,i.UniformsLib.bumpmap,i.UniformsLib.normalmap,i.UniformsLib.displacementmap,i.UniformsLib.fog,i.UniformsLib.lights,{emissive:{type:"c",value:new i.Color(0)},specular:{type:"c",value:new i.Color(1118481)},shininess:{type:"f",value:30}}]),vertexShader:i.ShaderChunk.meshphong_vert,fragmentShader:i.ShaderChunk.meshphong_frag},standard:{uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.aomap,i.UniformsLib.lightmap,i.UniformsLib.emissivemap,i.UniformsLib.bumpmap,i.UniformsLib.normalmap,i.UniformsLib.displacementmap,i.UniformsLib.roughnessmap,i.UniformsLib.metalnessmap,i.UniformsLib.fog,i.UniformsLib.lights,{emissive:{type:"c",value:new i.Color(0)},roughness:{type:"f",value:.5},metalness:{type:"f",value:0},envMapIntensity:{type:"f",value:1}}]),vertexShader:i.ShaderChunk.meshstandard_vert,fragmentShader:i.ShaderChunk.meshstandard_frag},points:{uniforms:i.UniformsUtils.merge([i.UniformsLib.points,i.UniformsLib.fog]),vertexShader:i.ShaderChunk.points_vert,fragmentShader:i.ShaderChunk.points_frag},dashed:{uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:i.ShaderChunk.linedashed_vert,fragmentShader:i.ShaderChunk.linedashed_frag},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:i.ShaderChunk.depth_vert,fragmentShader:i.ShaderChunk.depth_frag},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:i.ShaderChunk.normal_vert,fragmentShader:i.ShaderChunk.normal_frag},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:i.ShaderChunk.cube_vert,fragmentShader:i.ShaderChunk.cube_frag},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:i.ShaderChunk.equirect_vert,fragmentShader:i.ShaderChunk.equirect_frag},depthRGBA:{uniforms:{},vertexShader:i.ShaderChunk.depthRGBA_vert,fragmentShader:i.ShaderChunk.depthRGBA_frag},distanceRGBA:{uniforms:{lightPos:{type:"v3",value:new i.Vector3(0,0,0)}},vertexShader:i.ShaderChunk.distanceRGBA_vert,fragmentShader:i.ShaderChunk.distanceRGBA_frag}},i.WebGLRenderer=function(e){function t(){return null===xe?Ie:1}function r(e,t,r,i){se===!0&&(e*=i,t*=i,r*=i),qe.clearColor(e,t,r,i)}function n(){qe.init(),qe.scissor(Se.copy(Be).multiplyScalar(Ie)),qe.viewport(Te.copy(Ue).multiplyScalar(Ie)),r(Le.r,Le.g,Le.b,Ce)}function o(){ye=null,we=null,Me="",_e=-1,qe.reset()}function a(e){e.preventDefault(),o(),n(),Ye.clear()}function s(e){var t=e.target;t.removeEventListener("dispose",s),l(t),Ge.textures--}function c(e){var t=e.target;t.removeEventListener("dispose",c),u(t),Ge.textures--}function h(e){var t=e.target;t.removeEventListener("dispose",h),p(t)}function l(e){var t=Ye.get(e);if(e.image&&t.__image__webglTextureCube)ke.deleteTexture(t.__image__webglTextureCube);else{if(void 0===t.__webglInit)return;ke.deleteTexture(t.__webglTexture)}Ye["delete"](e)}function u(e){var t=Ye.get(e),r=Ye.get(e.texture);if(e&&void 0!==r.__webglTexture){if(ke.deleteTexture(r.__webglTexture),e instanceof i.WebGLRenderTargetCube)for(var n=0;6>n;n++)ke.deleteFramebuffer(t.__webglFramebuffer[n]),ke.deleteRenderbuffer(t.__webglDepthbuffer[n]);else ke.deleteFramebuffer(t.__webglFramebuffer),
  ke.deleteRenderbuffer(t.__webglDepthbuffer);Ye["delete"](e.texture),Ye["delete"](e)}}function p(e){d(e),Ye["delete"](e)}function d(e){var t=Ye.get(e).program;e.program=void 0,void 0!==t&&Qe.releaseProgram(t)}function f(e,t,r,n){var o;if(r instanceof i.InstancedBufferGeometry&&(o=We.get("ANGLE_instanced_arrays"),null===o))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===n&&(n=0),qe.initAttributes();var a=r.attributes,s=t.getAttributes(),c=e.defaultAttributeValues;for(var h in s){var l=s[h];if(l>=0){var u=a[h];if(void 0!==u){var p=u.itemSize,d=Ze.getAttributeBuffer(u);if(u instanceof i.InterleavedBufferAttribute){var f=u.data,m=f.stride,v=u.offset;f instanceof i.InstancedInterleavedBuffer?(qe.enableAttributeAndDivisor(l,f.meshPerAttribute,o),void 0===r.maxInstancedCount&&(r.maxInstancedCount=f.meshPerAttribute*f.count)):qe.enableAttribute(l),ke.bindBuffer(ke.ARRAY_BUFFER,d),ke.vertexAttribPointer(l,p,ke.FLOAT,!1,m*f.array.BYTES_PER_ELEMENT,(n*m+v)*f.array.BYTES_PER_ELEMENT)}else u instanceof i.InstancedBufferAttribute?(qe.enableAttributeAndDivisor(l,u.meshPerAttribute,o),void 0===r.maxInstancedCount&&(r.maxInstancedCount=u.meshPerAttribute*u.count)):qe.enableAttribute(l),ke.bindBuffer(ke.ARRAY_BUFFER,d),ke.vertexAttribPointer(l,p,ke.FLOAT,!1,0,n*p*4)}else if(void 0!==c){var g=c[h];if(void 0!==g)switch(g.length){case 2:ke.vertexAttrib2fv(l,g);break;case 3:ke.vertexAttrib3fv(l,g);break;case 4:ke.vertexAttrib4fv(l,g);break;default:ke.vertexAttrib1fv(l,g)}}}}qe.disableUnusedAttributes()}function m(e,t){return Math.abs(t[0])-Math.abs(e[0])}function v(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function g(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function y(e,t,r,i,n){var o,a;r.transparent?(o=pe,a=++de):(o=le,a=++ue);var s=o[a];void 0!==s?(s.id=e.id,s.object=e,s.geometry=t,s.material=r,s.z=Oe.z,s.group=n):(s={id:e.id,object:e,geometry:t,material:r,z:Oe.z,group:n},o.push(s))}function x(e,t){if(e.visible!==!1){if(e.layers.test(t.layers))if(e instanceof i.Light)he.push(e);else if(e instanceof i.Sprite)(e.frustumCulled===!1||Fe.intersectsObject(e)===!0)&&me.push(e);else if(e instanceof i.LensFlare)ve.push(e);else if(e instanceof i.ImmediateRenderObject)ge.sortObjects===!0&&(Oe.setFromMatrixPosition(e.matrixWorld),Oe.applyProjection(Ne)),y(e,null,e.material,Oe.z,null);else if((e instanceof i.Mesh||e instanceof i.Line||e instanceof i.Points)&&(e instanceof i.SkinnedMesh&&e.skeleton.update(),e.frustumCulled===!1||Fe.intersectsObject(e)===!0)){var r=e.material;if(r.visible===!0){ge.sortObjects===!0&&(Oe.setFromMatrixPosition(e.matrixWorld),Oe.applyProjection(Ne));var n=Ze.update(e);if(r instanceof i.MultiMaterial)for(var o=n.groups,a=r.materials,s=0,c=o.length;c>s;s++){var h=o[s],l=a[h.materialIndex];l.visible===!0&&y(e,n,l,Oe.z,h)}else y(e,n,r,Oe.z,null)}}for(var u=e.children,s=0,c=u.length;c>s;s++)x(u[s],t)}}function b(e,t,r,n){for(var o=0,a=e.length;a>o;o++){var s=e[o],c=s.object,h=s.geometry,l=void 0===n?s.material:n,u=s.group;if(c.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,c.matrixWorld),c.normalMatrix.getNormalMatrix(c.modelViewMatrix),c instanceof i.ImmediateRenderObject){M(l);var p=S(t,r,l,c);Me="",c.render(function(e){ge.renderBufferImmediate(e,p,l)})}else ge.renderBufferDirect(t,r,h,l,c,u)}}function _(e,t,r){var n=Ye.get(e),o=Qe.getParameters(e,Ve,t,r),a=Qe.getProgramCode(e,o),s=n.program,c=!0;if(void 0===s)e.addEventListener("dispose",h);else if(s.code!==a)d(e);else{if(void 0!==o.shaderID)return;c=!1}if(c){if(o.shaderID){var l=i.ShaderLib[o.shaderID];n.__webglShader={name:e.type,uniforms:i.UniformsUtils.clone(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}}else n.__webglShader={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};e.__webglShader=n.__webglShader,s=Qe.acquireProgram(e,o,a),n.program=s,e.program=s}var u=s.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var p=0;p<ge.maxMorphTargets;p++)u["morphTarget"+p]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(var p=0;p<ge.maxMorphNormals;p++)u["morphNormal"+p]>=0&&e.numSupportedMorphNormals++}n.uniformsList=[];var f=n.__webglShader.uniforms,m=n.program.getUniforms();for(var v in f){var g=m[v];g&&n.uniformsList.push([n.__webglShader.uniforms[v],g])}(e instanceof i.MeshPhongMaterial||e instanceof i.MeshLambertMaterial||e instanceof i.MeshStandardMaterial||e.lights)&&(n.lightsHash=Ve.hash,f.ambientLightColor.value=Ve.ambient,f.directionalLights.value=Ve.directional,f.spotLights.value=Ve.spot,f.pointLights.value=Ve.point,f.hemisphereLights.value=Ve.hemi,f.directionalShadowMap.value=Ve.directionalShadowMap,f.directionalShadowMatrix.value=Ve.directionalShadowMatrix,f.spotShadowMap.value=Ve.spotShadowMap,f.spotShadowMatrix.value=Ve.spotShadowMatrix,f.pointShadowMap.value=Ve.pointShadowMap,f.pointShadowMatrix.value=Ve.pointShadowMatrix),n.hasDynamicUniforms=!1;for(var y=0,x=n.uniformsList.length;x>y;y++){var b=n.uniformsList[y][0];if(b.dynamic===!0){n.hasDynamicUniforms=!0;break}}}function M(e){w(e),e.transparent===!0?qe.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):qe.setBlending(i.NoBlending),qe.setDepthFunc(e.depthFunc),qe.setDepthTest(e.depthTest),qe.setDepthWrite(e.depthWrite),qe.setColorWrite(e.colorWrite),qe.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function w(e){e.side!==i.DoubleSide?qe.enable(ke.CULL_FACE):qe.disable(ke.CULL_FACE),qe.setFlipSided(e.side===i.BackSide)}function S(e,t,r,n){Ae=0;var o=Ye.get(r);void 0===o.program&&(r.needsUpdate=!0),void 0!==o.lightsHash&&o.lightsHash!==Ve.hash&&(r.needsUpdate=!0),r.needsUpdate&&(_(r,t,n),r.needsUpdate=!1);var a=!1,s=!1,c=!1,h=o.program,l=h.getUniforms(),u=o.__webglShader.uniforms;if(h.id!==ye&&(ke.useProgram(h.program),ye=h.id,a=!0,s=!0,c=!0),r.id!==_e&&(_e=r.id,s=!0),(a||e!==we)&&(ke.uniformMatrix4fv(l.projectionMatrix,!1,e.projectionMatrix.elements),Xe.logarithmicDepthBuffer&&ke.uniform1f(l.logDepthBufFC,2/(Math.log(e.far+1)/Math.LN2)),e!==we&&(we=e,s=!0,c=!0),(r instanceof i.ShaderMaterial||r instanceof i.MeshPhongMaterial||r instanceof i.MeshStandardMaterial||r.envMap)&&void 0!==l.cameraPosition&&(Oe.setFromMatrixPosition(e.matrixWorld),ke.uniform3f(l.cameraPosition,Oe.x,Oe.y,Oe.z)),(r instanceof i.MeshPhongMaterial||r instanceof i.MeshLambertMaterial||r instanceof i.MeshBasicMaterial||r instanceof i.MeshStandardMaterial||r instanceof i.ShaderMaterial||r.skinning)&&void 0!==l.viewMatrix&&ke.uniformMatrix4fv(l.viewMatrix,!1,e.matrixWorldInverse.elements),void 0!==l.toneMappingExposure&&ke.uniform1f(l.toneMappingExposure,ge.toneMappingExposure),void 0!==l.toneMappingWhitePoint&&ke.uniform1f(l.toneMappingWhitePoint,ge.toneMappingWhitePoint)),r.skinning)if(n.bindMatrix&&void 0!==l.bindMatrix&&ke.uniformMatrix4fv(l.bindMatrix,!1,n.bindMatrix.elements),n.bindMatrixInverse&&void 0!==l.bindMatrixInverse&&ke.uniformMatrix4fv(l.bindMatrixInverse,!1,n.bindMatrixInverse.elements),Xe.floatVertexTextures&&n.skeleton&&n.skeleton.useVertexTexture){if(void 0!==l.boneTexture){var p=F();ke.uniform1i(l.boneTexture,p),ge.setTexture(n.skeleton.boneTexture,p)}void 0!==l.boneTextureWidth&&ke.uniform1i(l.boneTextureWidth,n.skeleton.boneTextureWidth),void 0!==l.boneTextureHeight&&ke.uniform1i(l.boneTextureHeight,n.skeleton.boneTextureHeight)}else n.skeleton&&n.skeleton.boneMatrices&&void 0!==l.boneGlobalMatrices&&ke.uniformMatrix4fv(l.boneGlobalMatrices,!1,n.skeleton.boneMatrices);return s&&((r instanceof i.MeshPhongMaterial||r instanceof i.MeshLambertMaterial||r instanceof i.MeshStandardMaterial||r.lights)&&D(u,c),t&&r.fog&&R(u,t),(r instanceof i.MeshBasicMaterial||r instanceof i.MeshLambertMaterial||r instanceof i.MeshPhongMaterial||r instanceof i.MeshStandardMaterial)&&T(u,r),r instanceof i.LineBasicMaterial?A(u,r):r instanceof i.LineDashedMaterial?(A(u,r),L(u,r)):r instanceof i.PointsMaterial?C(u,r):r instanceof i.MeshLambertMaterial?P(u,r):r instanceof i.MeshPhongMaterial?I(u,r):r instanceof i.MeshStandardMaterial?B(u,r):r instanceof i.MeshDepthMaterial?(u.mNear.value=e.near,u.mFar.value=e.far,u.opacity.value=r.opacity):r instanceof i.MeshNormalMaterial&&(u.opacity.value=r.opacity),O(o.uniformsList)),U(l,n),void 0!==l.modelMatrix&&ke.uniformMatrix4fv(l.modelMatrix,!1,n.matrixWorld.elements),o.hasDynamicUniforms===!0&&E(o.uniformsList,n,e),h}function E(e,t,r){for(var i=[],n=0,o=e.length;o>n;n++){var a=e[n][0],s=a.onUpdateCallback;void 0!==s&&(s.bind(a)(t,r),i.push(e[n]))}O(i)}function T(e,t){e.opacity.value=t.opacity,e.diffuse.value=t.color,t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),e.map.value=t.map,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity);var r;if(t.map?r=t.map:t.specularMap?r=t.specularMap:t.displacementMap?r=t.displacementMap:t.normalMap?r=t.normalMap:t.bumpMap?r=t.bumpMap:t.roughnessMap?r=t.roughnessMap:t.metalnessMap?r=t.metalnessMap:t.alphaMap?r=t.alphaMap:t.emissiveMap&&(r=t.emissiveMap),void 0!==r){r instanceof i.WebGLRenderTarget&&(r=r.texture);var n=r.offset,o=r.repeat;e.offsetRepeat.value.set(n.x,n.y,o.x,o.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap instanceof i.WebGLRenderTargetCube?1:-1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}function A(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function L(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function C(e,t){if(e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size*Ie,e.scale.value=te.clientHeight/2,e.map.value=t.map,null!==t.map){var r=t.map.offset,i=t.map.repeat;e.offsetRepeat.value.set(r.x,r.y,i.x,i.y)}}function R(e,t){e.fogColor.value=t.color,t instanceof i.Fog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t instanceof i.FogExp2&&(e.fogDensity.value=t.density)}function P(e,t){t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}function I(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function B(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function D(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLights.needsUpdate=t,e.pointLights.needsUpdate=t,e.spotLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function U(e,t){ke.uniformMatrix4fv(e.modelViewMatrix,!1,t.modelViewMatrix.elements),e.normalMatrix&&ke.uniformMatrix3fv(e.normalMatrix,!1,t.normalMatrix.elements)}function F(){var e=Ae;return e>=Xe.maxTextures&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+Xe.maxTextures),Ae+=1,e}function N(e,t,r,n){var o,a;if("1i"===t)ke.uniform1i(r,n);else if("1f"===t)ke.uniform1f(r,n);else if("2f"===t)ke.uniform2f(r,n[0],n[1]);else if("3f"===t)ke.uniform3f(r,n[0],n[1],n[2]);else if("4f"===t)ke.uniform4f(r,n[0],n[1],n[2],n[3]);else if("1iv"===t)ke.uniform1iv(r,n);else if("3iv"===t)ke.uniform3iv(r,n);else if("1fv"===t)ke.uniform1fv(r,n);else if("2fv"===t)ke.uniform2fv(r,n);else if("3fv"===t)ke.uniform3fv(r,n);else if("4fv"===t)ke.uniform4fv(r,n);else if("Matrix2fv"===t)ke.uniformMatrix2fv(r,!1,n);else if("Matrix3fv"===t)ke.uniformMatrix3fv(r,!1,n);else if("Matrix4fv"===t)ke.uniformMatrix4fv(r,!1,n);else if("i"===t)ke.uniform1i(r,n);else if("f"===t)ke.uniform1f(r,n);else if("v2"===t)ke.uniform2f(r,n.x,n.y);else if("v3"===t)ke.uniform3f(r,n.x,n.y,n.z);else if("v4"===t)ke.uniform4f(r,n.x,n.y,n.z,n.w);else if("c"===t)ke.uniform3f(r,n.r,n.g,n.b);else if("s"===t){var s=e.properties;for(var c in s){var h=s[c],l=r[c],u=n[c];N(h,h.type,l,u)}}else if("sa"===t)for(var s=e.properties,p=0,d=n.length;d>p;p++)for(var c in s){var h=s[c],l=r[p][c],u=n[p][c];N(h,h.type,l,u)}else if("iv1"===t)ke.uniform1iv(r,n);else if("iv"===t)ke.uniform3iv(r,n);else if("fv1"===t)ke.uniform1fv(r,n);else if("fv"===t)ke.uniform3fv(r,n);else if("v2v"===t){void 0===e._array&&(e._array=new Float32Array(2*n.length));for(var p=0,f=0,m=n.length;m>p;p++,f+=2)e._array[f+0]=n[p].x,e._array[f+1]=n[p].y;ke.uniform2fv(r,e._array)}else if("v3v"===t){void 0===e._array&&(e._array=new Float32Array(3*n.length));for(var p=0,v=0,m=n.length;m>p;p++,v+=3)e._array[v+0]=n[p].x,e._array[v+1]=n[p].y,e._array[v+2]=n[p].z;ke.uniform3fv(r,e._array)}else if("v4v"===t){void 0===e._array&&(e._array=new Float32Array(4*n.length));for(var p=0,g=0,m=n.length;m>p;p++,g+=4)e._array[g+0]=n[p].x,e._array[g+1]=n[p].y,e._array[g+2]=n[p].z,e._array[g+3]=n[p].w;ke.uniform4fv(r,e._array)}else if("m2"===t)ke.uniformMatrix2fv(r,!1,n.elements);else if("m3"===t)ke.uniformMatrix3fv(r,!1,n.elements);else if("m3v"===t){void 0===e._array&&(e._array=new Float32Array(9*n.length));for(var p=0,m=n.length;m>p;p++)n[p].flattenToArrayOffset(e._array,9*p);ke.uniformMatrix3fv(r,!1,e._array)}else if("m4"===t)ke.uniformMatrix4fv(r,!1,n.elements);else if("m4v"===t){void 0===e._array&&(e._array=new Float32Array(16*n.length));for(var p=0,m=n.length;m>p;p++)n[p].flattenToArrayOffset(e._array,16*p);ke.uniformMatrix4fv(r,!1,e._array)}else if("t"===t){if(o=n,a=F(),ke.uniform1i(r,a),!o)return;o instanceof i.CubeTexture||Array.isArray(o.image)&&6===o.image.length?X(o,a):o instanceof i.WebGLRenderTargetCube?q(o.texture,a):o instanceof i.WebGLRenderTarget?ge.setTexture(o.texture,a):ge.setTexture(o,a)}else if("tv"===t){void 0===e._array&&(e._array=[]);for(var p=0,m=e.value.length;m>p;p++)e._array[p]=F();ke.uniform1iv(r,e._array);for(var p=0,m=e.value.length;m>p;p++)o=e.value[p],a=e._array[p],o&&(o instanceof i.CubeTexture||o.image instanceof Array&&6===o.image.length?X(o,a):o instanceof i.WebGLRenderTarget?ge.setTexture(o.texture,a):o instanceof i.WebGLRenderTargetCube?q(o.texture,a):ge.setTexture(o,a))}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+t)}function O(e){for(var t=0,r=e.length;r>t;t++){var i=e[t][0];if(i.needsUpdate!==!1){var n=i.type,o=e[t][1],a=i.value;N(i,n,o,a)}}}function V(e,t){var r,n,o,a,s,c,h=0,l=0,u=0,p=t.matrixWorldInverse,d=0,f=0,m=0,v=0,g=0;for(Ve.shadowsPointLight=0,r=0,n=e.length;n>r;r++)if(o=e[r],a=o.color,s=o.intensity,c=o.distance,o instanceof i.AmbientLight)h+=a.r*s,l+=a.g*s,u+=a.b*s;else if(o instanceof i.DirectionalLight){var y=Ke.get(o);y.color.copy(o.color).multiplyScalar(o.intensity),y.direction.setFromMatrixPosition(o.matrixWorld),Oe.setFromMatrixPosition(o.target.matrixWorld),y.direction.sub(Oe),y.direction.transformDirection(p),y.shadow=o.castShadow,o.castShadow&&(y.shadowBias=o.shadow.bias,y.shadowRadius=o.shadow.radius,y.shadowMapSize=o.shadow.mapSize,Ve.shadows[g++]=o),Ve.directionalShadowMap[d]=o.shadow.map,Ve.directionalShadowMatrix[d]=o.shadow.matrix,Ve.directional[d++]=y}else if(o instanceof i.SpotLight){var y=Ke.get(o);y.position.setFromMatrixPosition(o.matrixWorld),y.position.applyMatrix4(p),y.color.copy(a).multiplyScalar(s),y.distance=c,y.direction.setFromMatrixPosition(o.matrixWorld),Oe.setFromMatrixPosition(o.target.matrixWorld),y.direction.sub(Oe),y.direction.transformDirection(p),y.coneCos=Math.cos(o.angle),y.penumbraCos=Math.cos(o.angle*(1-o.penumbra)),y.decay=0===o.distance?0:o.decay,y.shadow=o.castShadow,o.castShadow&&(y.shadowBias=o.shadow.bias,y.shadowRadius=o.shadow.radius,y.shadowMapSize=o.shadow.mapSize,Ve.shadows[g++]=o),Ve.spotShadowMap[m]=o.shadow.map,Ve.spotShadowMatrix[m]=o.shadow.matrix,Ve.spot[m++]=y}else if(o instanceof i.PointLight){var y=Ke.get(o);y.position.setFromMatrixPosition(o.matrixWorld),y.position.applyMatrix4(p),y.color.copy(o.color).multiplyScalar(o.intensity),y.distance=o.distance,y.decay=0===o.distance?0:o.decay,y.shadow=o.castShadow,o.castShadow&&(y.shadowBias=o.shadow.bias,y.shadowRadius=o.shadow.radius,y.shadowMapSize=o.shadow.mapSize,Ve.shadows[g++]=o),Ve.pointShadowMap[f]=o.shadow.map,void 0===Ve.pointShadowMatrix[f]&&(Ve.pointShadowMatrix[f]=new i.Matrix4),Oe.setFromMatrixPosition(o.matrixWorld).negate(),Ve.pointShadowMatrix[f].identity().setPosition(Oe),Ve.point[f++]=y}else if(o instanceof i.HemisphereLight){var y=Ke.get(o);y.direction.setFromMatrixPosition(o.matrixWorld),y.direction.transformDirection(p),y.direction.normalize(),y.skyColor.copy(o.color).multiplyScalar(s),y.groundColor.copy(o.groundColor).multiplyScalar(s),Ve.hemi[v++]=y}Ve.ambient[0]=h,Ve.ambient[1]=l,Ve.ambient[2]=u,Ve.directional.length=d,Ve.spot.length=m,Ve.point.length=f,Ve.hemi.length=v,Ve.shadows.length=g,Ve.hash=d+","+f+","+m+","+v+","+g}function G(e,t,r){var n;if(r?(ke.texParameteri(e,ke.TEXTURE_WRAP_S,ee(t.wrapS)),ke.texParameteri(e,ke.TEXTURE_WRAP_T,ee(t.wrapT)),ke.texParameteri(e,ke.TEXTURE_MAG_FILTER,ee(t.magFilter)),ke.texParameteri(e,ke.TEXTURE_MIN_FILTER,ee(t.minFilter))):(ke.texParameteri(e,ke.TEXTURE_WRAP_S,ke.CLAMP_TO_EDGE),ke.texParameteri(e,ke.TEXTURE_WRAP_T,ke.CLAMP_TO_EDGE),(t.wrapS!==i.ClampToEdgeWrapping||t.wrapT!==i.ClampToEdgeWrapping)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",t),ke.texParameteri(e,ke.TEXTURE_MAG_FILTER,$(t.magFilter)),ke.texParameteri(e,ke.TEXTURE_MIN_FILTER,$(t.minFilter)),t.minFilter!==i.NearestFilter&&t.minFilter!==i.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",t)),n=We.get("EXT_texture_filter_anisotropic")){if(t.type===i.FloatType&&null===We.get("OES_texture_float_linear"))return;if(t.type===i.HalfFloatType&&null===We.get("OES_texture_half_float_linear"))return;(t.anisotropy>1||Ye.get(t).__currentAnisotropy)&&(ke.texParameterf(e,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,ge.getMaxAnisotropy())),Ye.get(t).__currentAnisotropy=t.anisotropy)}}function z(e,t,r){void 0===e.__webglInit&&(e.__webglInit=!0,t.addEventListener("dispose",s),e.__webglTexture=ke.createTexture(),Ge.textures++),qe.activeTexture(ke.TEXTURE0+r),qe.bindTexture(ke.TEXTURE_2D,e.__webglTexture),ke.pixelStorei(ke.UNPACK_FLIP_Y_WEBGL,t.flipY),ke.pixelStorei(ke.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),ke.pixelStorei(ke.UNPACK_ALIGNMENT,t.unpackAlignment);var n=k(t.image,Xe.maxTextureSize);j(t)&&H(n)===!1&&(n=W(n));var o=H(n),a=ee(t.format),c=ee(t.type);G(ke.TEXTURE_2D,t,o);var h,l=t.mipmaps;if(t instanceof i.DataTexture)if(l.length>0&&o){for(var u=0,p=l.length;p>u;u++)h=l[u],qe.texImage2D(ke.TEXTURE_2D,u,a,h.width,h.height,0,a,c,h.data);t.generateMipmaps=!1}else qe.texImage2D(ke.TEXTURE_2D,0,a,n.width,n.height,0,a,c,n.data);else if(t instanceof i.CompressedTexture)for(var u=0,p=l.length;p>u;u++)h=l[u],t.format!==i.RGBAFormat&&t.format!==i.RGBFormat?qe.getCompressedTextureFormats().indexOf(a)>-1?qe.compressedTexImage2D(ke.TEXTURE_2D,u,a,h.width,h.height,0,h.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):qe.texImage2D(ke.TEXTURE_2D,u,a,h.width,h.height,0,a,c,h.data);else if(l.length>0&&o){for(var u=0,p=l.length;p>u;u++)h=l[u],qe.texImage2D(ke.TEXTURE_2D,u,a,a,c,h);t.generateMipmaps=!1}else qe.texImage2D(ke.TEXTURE_2D,0,a,a,c,n);t.generateMipmaps&&o&&ke.generateMipmap(ke.TEXTURE_2D),e.__version=t.version,t.onUpdate&&t.onUpdate(t)}function k(e,t){if(e.width>t||e.height>t){var r=t/Math.max(e.width,e.height),i=document.createElement("canvas");i.width=Math.floor(e.width*r),i.height=Math.floor(e.height*r);var n=i.getContext("2d");return n.drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+i.width+"x"+i.height,e),i}return e}function H(e){return i.Math.isPowerOfTwo(e.width)&&i.Math.isPowerOfTwo(e.height)}function j(e){return e.wrapS!==i.ClampToEdgeWrapping||e.wrapT!==i.ClampToEdgeWrapping?!0:e.minFilter!==i.NearestFilter&&e.minFilter!==i.LinearFilter?!0:!1}function W(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement){var t=document.createElement("canvas");t.width=i.Math.nearestPowerOfTwo(e.width),t.height=i.Math.nearestPowerOfTwo(e.height);var r=t.getContext("2d");return r.drawImage(e,0,0,t.width,t.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+e.width+"x"+e.height+"). Resized to "+t.width+"x"+t.height,e),t}return e}function X(e,t){var r=Ye.get(e);if(6===e.image.length)if(e.version>0&&r.__version!==e.version){r.__image__webglTextureCube||(e.addEventListener("dispose",s),r.__image__webglTextureCube=ke.createTexture(),Ge.textures++),qe.activeTexture(ke.TEXTURE0+t),qe.bindTexture(ke.TEXTURE_CUBE_MAP,r.__image__webglTextureCube),ke.pixelStorei(ke.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var n=e instanceof i.CompressedTexture,o=e.image[0]instanceof i.DataTexture,a=[],c=0;6>c;c++)!ge.autoScaleCubemaps||n||o?a[c]=o?e.image[c].image:e.image[c]:a[c]=k(e.image[c],Xe.maxCubemapSize);var h=a[0],l=H(h),u=ee(e.format),p=ee(e.type);G(ke.TEXTURE_CUBE_MAP,e,l);for(var c=0;6>c;c++)if(n)for(var d,f=a[c].mipmaps,m=0,v=f.length;v>m;m++)d=f[m],e.format!==i.RGBAFormat&&e.format!==i.RGBFormat?qe.getCompressedTextureFormats().indexOf(u)>-1?qe.compressedTexImage2D(ke.TEXTURE_CUBE_MAP_POSITIVE_X+c,m,u,d.width,d.height,0,d.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):qe.texImage2D(ke.TEXTURE_CUBE_MAP_POSITIVE_X+c,m,u,d.width,d.height,0,u,p,d.data);else o?qe.texImage2D(ke.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,u,a[c].width,a[c].height,0,u,p,a[c].data):qe.texImage2D(ke.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,u,u,p,a[c]);e.generateMipmaps&&l&&ke.generateMipmap(ke.TEXTURE_CUBE_MAP),r.__version=e.version,e.onUpdate&&e.onUpdate(e)}else qe.activeTexture(ke.TEXTURE0+t),qe.bindTexture(ke.TEXTURE_CUBE_MAP,r.__image__webglTextureCube)}function q(e,t){qe.activeTexture(ke.TEXTURE0+t),qe.bindTexture(ke.TEXTURE_CUBE_MAP,Ye.get(e).__webglTexture)}function Y(e,t,r,i){var n=ee(t.texture.format),o=ee(t.texture.type);qe.texImage2D(i,0,n,t.width,t.height,0,n,o,null),ke.bindFramebuffer(ke.FRAMEBUFFER,e),ke.framebufferTexture2D(ke.FRAMEBUFFER,r,i,Ye.get(t.texture).__webglTexture,0),ke.bindFramebuffer(ke.FRAMEBUFFER,null)}function Z(e,t){ke.bindRenderbuffer(ke.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(ke.renderbufferStorage(ke.RENDERBUFFER,ke.DEPTH_COMPONENT16,t.width,t.height),ke.framebufferRenderbuffer(ke.FRAMEBUFFER,ke.DEPTH_ATTACHMENT,ke.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(ke.renderbufferStorage(ke.RENDERBUFFER,ke.DEPTH_STENCIL,t.width,t.height),ke.framebufferRenderbuffer(ke.FRAMEBUFFER,ke.DEPTH_STENCIL_ATTACHMENT,ke.RENDERBUFFER,e)):ke.renderbufferStorage(ke.RENDERBUFFER,ke.RGBA4,t.width,t.height),ke.bindRenderbuffer(ke.RENDERBUFFER,null)}function Q(e){var t=Ye.get(e),r=e instanceof i.WebGLRenderTargetCube;if(r){t.__webglDepthbuffer=[];for(var n=0;6>n;n++)ke.bindFramebuffer(ke.FRAMEBUFFER,t.__webglFramebuffer[n]),t.__webglDepthbuffer[n]=ke.createRenderbuffer(),Z(t.__webglDepthbuffer[n],e)}else ke.bindFramebuffer(ke.FRAMEBUFFER,t.__webglFramebuffer),t.__webglDepthbuffer=ke.createRenderbuffer(),Z(t.__webglDepthbuffer,e);ke.bindFramebuffer(ke.FRAMEBUFFER,null)}function K(e){var t=Ye.get(e),r=Ye.get(e.texture);e.addEventListener("dispose",c),r.__webglTexture=ke.createTexture(),Ge.textures++;var n=e instanceof i.WebGLRenderTargetCube,o=i.Math.isPowerOfTwo(e.width)&&i.Math.isPowerOfTwo(e.height);if(n){t.__webglFramebuffer=[];for(var a=0;6>a;a++)t.__webglFramebuffer[a]=ke.createFramebuffer()}else t.__webglFramebuffer=ke.createFramebuffer();if(n){qe.bindTexture(ke.TEXTURE_CUBE_MAP,r.__webglTexture),G(ke.TEXTURE_CUBE_MAP,e.texture,o);for(var a=0;6>a;a++)Y(t.__webglFramebuffer[a],e,ke.COLOR_ATTACHMENT0,ke.TEXTURE_CUBE_MAP_POSITIVE_X+a);e.texture.generateMipmaps&&o&&ke.generateMipmap(ke.TEXTURE_CUBE_MAP),qe.bindTexture(ke.TEXTURE_CUBE_MAP,null)}else qe.bindTexture(ke.TEXTURE_2D,r.__webglTexture),G(ke.TEXTURE_2D,e.texture,o),Y(t.__webglFramebuffer,e,ke.COLOR_ATTACHMENT0,ke.TEXTURE_2D),e.texture.generateMipmaps&&o&&ke.generateMipmap(ke.TEXTURE_2D),qe.bindTexture(ke.TEXTURE_2D,null);e.depthBuffer&&Q(e)}function J(e){var t=e instanceof i.WebGLRenderTargetCube?ke.TEXTURE_CUBE_MAP:ke.TEXTURE_2D,r=Ye.get(e.texture).__webglTexture;qe.bindTexture(t,r),ke.generateMipmap(t),qe.bindTexture(t,null)}function $(e){return e===i.NearestFilter||e===i.NearestMipMapNearestFilter||e===i.NearestMipMapLinearFilter?ke.NEAREST:ke.LINEAR}function ee(e){var t;if(e===i.RepeatWrapping)return ke.REPEAT;if(e===i.ClampToEdgeWrapping)return ke.CLAMP_TO_EDGE;if(e===i.MirroredRepeatWrapping)return ke.MIRRORED_REPEAT;if(e===i.NearestFilter)return ke.NEAREST;if(e===i.NearestMipMapNearestFilter)return ke.NEAREST_MIPMAP_NEAREST;if(e===i.NearestMipMapLinearFilter)return ke.NEAREST_MIPMAP_LINEAR;if(e===i.LinearFilter)return ke.LINEAR;if(e===i.LinearMipMapNearestFilter)return ke.LINEAR_MIPMAP_NEAREST;if(e===i.LinearMipMapLinearFilter)return ke.LINEAR_MIPMAP_LINEAR;if(e===i.UnsignedByteType)return ke.UNSIGNED_BYTE;if(e===i.UnsignedShort4444Type)return ke.UNSIGNED_SHORT_4_4_4_4;if(e===i.UnsignedShort5551Type)return ke.UNSIGNED_SHORT_5_5_5_1;if(e===i.UnsignedShort565Type)return ke.UNSIGNED_SHORT_5_6_5;if(e===i.ByteType)return ke.BYTE;if(e===i.ShortType)return ke.SHORT;if(e===i.UnsignedShortType)return ke.UNSIGNED_SHORT;if(e===i.IntType)return ke.INT;if(e===i.UnsignedIntType)return ke.UNSIGNED_INT;if(e===i.FloatType)return ke.FLOAT;if(t=We.get("OES_texture_half_float"),null!==t&&e===i.HalfFloatType)return t.HALF_FLOAT_OES;if(e===i.AlphaFormat)return ke.ALPHA;if(e===i.RGBFormat)return ke.RGB;if(e===i.RGBAFormat)return ke.RGBA;if(e===i.LuminanceFormat)return ke.LUMINANCE;if(e===i.LuminanceAlphaFormat)return ke.LUMINANCE_ALPHA;if(e===i.AddEquation)return ke.FUNC_ADD;if(e===i.SubtractEquation)return ke.FUNC_SUBTRACT;if(e===i.ReverseSubtractEquation)return ke.FUNC_REVERSE_SUBTRACT;if(e===i.ZeroFactor)return ke.ZERO;if(e===i.OneFactor)return ke.ONE;if(e===i.SrcColorFactor)return ke.SRC_COLOR;if(e===i.OneMinusSrcColorFactor)return ke.ONE_MINUS_SRC_COLOR;if(e===i.SrcAlphaFactor)return ke.SRC_ALPHA;if(e===i.OneMinusSrcAlphaFactor)return ke.ONE_MINUS_SRC_ALPHA;if(e===i.DstAlphaFactor)return ke.DST_ALPHA;if(e===i.OneMinusDstAlphaFactor)return ke.ONE_MINUS_DST_ALPHA;if(e===i.DstColorFactor)return ke.DST_COLOR;if(e===i.OneMinusDstColorFactor)return ke.ONE_MINUS_DST_COLOR;if(e===i.SrcAlphaSaturateFactor)return ke.SRC_ALPHA_SATURATE;if(t=We.get("WEBGL_compressed_texture_s3tc"),null!==t){if(e===i.RGB_S3TC_DXT1_Format)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===i.RGBA_S3TC_DXT1_Format)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===i.RGBA_S3TC_DXT3_Format)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===i.RGBA_S3TC_DXT5_Format)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t=We.get("WEBGL_compressed_texture_pvrtc"),null!==t){if(e===i.RGB_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===i.RGB_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===i.RGBA_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===i.RGBA_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t=We.get("WEBGL_compressed_texture_etc1"),null!==t&&e===i.RGB_ETC1_Format)return t.COMPRESSED_RGB_ETC1_WEBGL;if(t=We.get("EXT_blend_minmax"),null!==t){if(e===i.MinEquation)return t.MIN_EXT;if(e===i.MaxEquation)return t.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",i.REVISION),e=e||{};var te=void 0!==e.canvas?e.canvas:document.createElement("canvas"),re=void 0!==e.context?e.context:null,ie=void 0!==e.alpha?e.alpha:!1,ne=void 0!==e.depth?e.depth:!0,oe=void 0!==e.stencil?e.stencil:!0,ae=void 0!==e.antialias?e.antialias:!1,se=void 0!==e.premultipliedAlpha?e.premultipliedAlpha:!0,ce=void 0!==e.preserveDrawingBuffer?e.preserveDrawingBuffer:!1,he=[],le=[],ue=-1,pe=[],de=-1,fe=new Float32Array(8),me=[],ve=[];this.domElement=te,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=i.LinearToneMapping,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0;var ge=this,ye=null,xe=null,be=null,_e=-1,Me="",we=null,Se=new i.Vector4,Ee=null,Te=new i.Vector4,Ae=0,Le=new i.Color(0),Ce=0,Re=te.width,Pe=te.height,Ie=1,Be=new i.Vector4(0,0,Re,Pe),De=!1,Ue=new i.Vector4(0,0,Re,Pe),Fe=new i.Frustum,Ne=new i.Matrix4,Oe=new i.Vector3,Ve={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[],shadowsPointLight:0},Ge={geometries:0,textures:0},ze={calls:0,vertices:0,faces:0,points:0};this.info={render:ze,memory:Ge,programs:null};var ke;try{var He={alpha:ie,depth:ne,stencil:oe,antialias:ae,premultipliedAlpha:se,preserveDrawingBuffer:ce};if(ke=re||te.getContext("webgl",He)||te.getContext("experimental-webgl",He),null===ke)throw null!==te.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===ke.getShaderPrecisionFormat&&(ke.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),te.addEventListener("webglcontextlost",a,!1)}catch(je){console.error("THREE.WebGLRenderer: "+je)}var We=new i.WebGLExtensions(ke);We.get("OES_texture_float"),We.get("OES_texture_float_linear"),We.get("OES_texture_half_float"),We.get("OES_texture_half_float_linear"),We.get("OES_standard_derivatives"),We.get("ANGLE_instanced_arrays"),We.get("OES_element_index_uint")&&(i.BufferGeometry.MaxIndex=4294967296);var Xe=new i.WebGLCapabilities(ke,We,e),qe=new i.WebGLState(ke,We,ee),Ye=new i.WebGLProperties,Ze=new i.WebGLObjects(ke,Ye,this.info),Qe=new i.WebGLPrograms(this,Xe),Ke=new i.WebGLLights;this.info.programs=Qe.programs;var Je=new i.WebGLBufferRenderer(ke,We,ze),$e=new i.WebGLIndexedBufferRenderer(ke,We,ze);n(),this.context=ke,this.capabilities=Xe,this.extensions=We,this.properties=Ye,this.state=qe;var et=new i.WebGLShadowMap(this,Ve,Ze);this.shadowMap=et;var tt=new i.SpritePlugin(this,me),rt=new i.LensFlarePlugin(this,ve);this.getContext=function(){return ke},this.getContextAttributes=function(){return ke.getContextAttributes()},this.forceContextLoss=function(){We.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){var e;return function(){if(void 0!==e)return e;var t=We.get("EXT_texture_filter_anisotropic");return e=null!==t?ke.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}(),this.getPrecision=function(){
  return Xe.precision},this.getPixelRatio=function(){return Ie},this.setPixelRatio=function(e){void 0!==e&&(Ie=e,this.setSize(Ue.z,Ue.w,!1))},this.getSize=function(){return{width:Re,height:Pe}},this.setSize=function(e,t,r){Re=e,Pe=t,te.width=e*Ie,te.height=t*Ie,r!==!1&&(te.style.width=e+"px",te.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,r,i){qe.viewport(Ue.set(e,t,r,i))},this.setScissor=function(e,t,r,i){qe.scissor(Be.set(e,t,r,i))},this.setScissorTest=function(e){qe.setScissorTest(De=e)},this.getClearColor=function(){return Le},this.setClearColor=function(e,t){Le.set(e),Ce=void 0!==t?t:1,r(Le.r,Le.g,Le.b,Ce)},this.getClearAlpha=function(){return Ce},this.setClearAlpha=function(e){Ce=e,r(Le.r,Le.g,Le.b,Ce)},this.clear=function(e,t,r){var i=0;(void 0===e||e)&&(i|=ke.COLOR_BUFFER_BIT),(void 0===t||t)&&(i|=ke.DEPTH_BUFFER_BIT),(void 0===r||r)&&(i|=ke.STENCIL_BUFFER_BIT),ke.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(e,t,r,i){this.setRenderTarget(e),this.clear(t,r,i)},this.resetGLState=o,this.dispose=function(){te.removeEventListener("webglcontextlost",a,!1)},this.renderBufferImmediate=function(e,t,r){qe.initAttributes();var n=Ye.get(e);e.hasPositions&&!n.position&&(n.position=ke.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=ke.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=ke.createBuffer()),e.hasColors&&!n.color&&(n.color=ke.createBuffer());var o=t.getAttributes();if(e.hasPositions&&(ke.bindBuffer(ke.ARRAY_BUFFER,n.position),ke.bufferData(ke.ARRAY_BUFFER,e.positionArray,ke.DYNAMIC_DRAW),qe.enableAttribute(o.position),ke.vertexAttribPointer(o.position,3,ke.FLOAT,!1,0,0)),e.hasNormals){if(ke.bindBuffer(ke.ARRAY_BUFFER,n.normal),"MeshPhongMaterial"!==r.type&&"MeshStandardMaterial"!==r.type&&r.shading===i.FlatShading)for(var a=0,s=3*e.count;s>a;a+=9){var c=e.normalArray,h=(c[a+0]+c[a+3]+c[a+6])/3,l=(c[a+1]+c[a+4]+c[a+7])/3,u=(c[a+2]+c[a+5]+c[a+8])/3;c[a+0]=h,c[a+1]=l,c[a+2]=u,c[a+3]=h,c[a+4]=l,c[a+5]=u,c[a+6]=h,c[a+7]=l,c[a+8]=u}ke.bufferData(ke.ARRAY_BUFFER,e.normalArray,ke.DYNAMIC_DRAW),qe.enableAttribute(o.normal),ke.vertexAttribPointer(o.normal,3,ke.FLOAT,!1,0,0)}e.hasUvs&&r.map&&(ke.bindBuffer(ke.ARRAY_BUFFER,n.uv),ke.bufferData(ke.ARRAY_BUFFER,e.uvArray,ke.DYNAMIC_DRAW),qe.enableAttribute(o.uv),ke.vertexAttribPointer(o.uv,2,ke.FLOAT,!1,0,0)),e.hasColors&&r.vertexColors!==i.NoColors&&(ke.bindBuffer(ke.ARRAY_BUFFER,n.color),ke.bufferData(ke.ARRAY_BUFFER,e.colorArray,ke.DYNAMIC_DRAW),qe.enableAttribute(o.color),ke.vertexAttribPointer(o.color,3,ke.FLOAT,!1,0,0)),qe.disableUnusedAttributes(),ke.drawArrays(ke.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,r,n,o,a,s){M(o);var c=S(e,r,o,a),h=!1,l=n.id+"_"+c.id+"_"+o.wireframe;l!==Me&&(Me=l,h=!0);var u=a.morphTargetInfluences;if(void 0!==u){for(var p=[],d=0,v=u.length;v>d;d++){var g=u[d];p.push([g,d])}p.sort(m),p.length>8&&(p.length=8);for(var y=n.morphAttributes,d=0,v=p.length;v>d;d++){var g=p[d];if(fe[d]=g[0],0!==g[0]){var x=g[1];o.morphTargets===!0&&y.position&&n.addAttribute("morphTarget"+d,y.position[x]),o.morphNormals===!0&&y.normal&&n.addAttribute("morphNormal"+d,y.normal[x])}else o.morphTargets===!0&&n.removeAttribute("morphTarget"+d),o.morphNormals===!0&&n.removeAttribute("morphNormal"+d)}var b=c.getUniforms();null!==b.morphTargetInfluences&&ke.uniform1fv(b.morphTargetInfluences,fe),h=!0}var x=n.index,_=n.attributes.position;o.wireframe===!0&&(x=Ze.getWireframeAttribute(n));var w;null!==x?(w=$e,w.setIndex(x)):w=Je,h&&(f(o,c,n),null!==x&&ke.bindBuffer(ke.ELEMENT_ARRAY_BUFFER,Ze.getAttributeBuffer(x)));var E=0,T=1/0;null!==x?T=x.count:void 0!==_&&(T=_.count);var A=n.drawRange.start,L=n.drawRange.count,C=null!==s?s.start:0,R=null!==s?s.count:1/0,P=Math.max(E,A,C),I=Math.min(E+T,A+L,C+R)-1,B=Math.max(0,I-P+1);if(a instanceof i.Mesh)if(o.wireframe===!0)qe.setLineWidth(o.wireframeLinewidth*t()),w.setMode(ke.LINES);else switch(a.drawMode){case i.TrianglesDrawMode:w.setMode(ke.TRIANGLES);break;case i.TriangleStripDrawMode:w.setMode(ke.TRIANGLE_STRIP);break;case i.TriangleFanDrawMode:w.setMode(ke.TRIANGLE_FAN)}else if(a instanceof i.Line){var D=o.linewidth;void 0===D&&(D=1),qe.setLineWidth(D*t()),a instanceof i.LineSegments?w.setMode(ke.LINES):w.setMode(ke.LINE_STRIP)}else a instanceof i.Points&&w.setMode(ke.POINTS);n instanceof i.InstancedBufferGeometry?n.maxInstancedCount>0&&w.renderInstances(n,P,B):w.render(P,B)},this.render=function(e,t,r,n){if(t instanceof i.Camera==!1)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var o=e.fog;if(Me="",_e=-1,we=null,e.autoUpdate===!0&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),Ne.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),Fe.setFromMatrix(Ne),he.length=0,ue=-1,de=-1,me.length=0,ve.length=0,x(e,t),le.length=ue+1,pe.length=de+1,ge.sortObjects===!0&&(le.sort(v),pe.sort(g)),V(he,t),et.render(e,t),ze.calls=0,ze.vertices=0,ze.faces=0,ze.points=0,void 0===r&&(r=null),this.setRenderTarget(r),(this.autoClear||n)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),e.overrideMaterial){var a=e.overrideMaterial;b(le,t,o,a),b(pe,t,o,a)}else qe.setBlending(i.NoBlending),b(le,t,o),b(pe,t,o);if(tt.render(e,t),rt.render(e,t,Te),r){var s=r.texture;s.generateMipmaps&&H(r)&&s.minFilter!==i.NearestFilter&&s.minFilter!==i.LinearFilter&&J(r)}qe.setDepthTest(!0),qe.setDepthWrite(!0),qe.setColorWrite(!0)},this.setFaceCulling=function(e,t){e===i.CullFaceNone?qe.disable(ke.CULL_FACE):(t===i.FrontFaceDirectionCW?ke.frontFace(ke.CW):ke.frontFace(ke.CCW),e===i.CullFaceBack?ke.cullFace(ke.BACK):e===i.CullFaceFront?ke.cullFace(ke.FRONT):ke.cullFace(ke.FRONT_AND_BACK),qe.enable(ke.CULL_FACE))},this.setTexture=function(e,t){var r=Ye.get(e);if(e.version>0&&r.__version!==e.version){var i=e.image;return void 0===i?void console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e):i.complete===!1?void console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e):void z(r,e,t)}qe.activeTexture(ke.TEXTURE0+t),qe.bindTexture(ke.TEXTURE_2D,r.__webglTexture)},this.getCurrentRenderTarget=function(){return xe},this.setRenderTarget=function(e){xe=e,e&&void 0===Ye.get(e).__webglFramebuffer&&K(e);var t,r=e instanceof i.WebGLRenderTargetCube;if(e){var n=Ye.get(e);t=r?n.__webglFramebuffer[e.activeCubeFace]:n.__webglFramebuffer,Se.copy(e.scissor),Ee=e.scissorTest,Te.copy(e.viewport)}else t=null,Se.copy(Be).multiplyScalar(Ie),Ee=De,Te.copy(Ue).multiplyScalar(Ie);if(be!==t&&(ke.bindFramebuffer(ke.FRAMEBUFFER,t),be=t),qe.scissor(Se),qe.setScissorTest(Ee),qe.viewport(Te),r){var o=Ye.get(e.texture);ke.framebufferTexture2D(ke.FRAMEBUFFER,ke.COLOR_ATTACHMENT0,ke.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,o.__webglTexture,e.activeMipMapLevel)}},this.readRenderTargetPixels=function(e,t,r,n,o,a){if(e instanceof i.WebGLRenderTarget==!1)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var s=Ye.get(e).__webglFramebuffer;if(s){var c=!1;s!==be&&(ke.bindFramebuffer(ke.FRAMEBUFFER,s),c=!0);try{var h=e.texture;if(h.format!==i.RGBAFormat&&ee(h.format)!==ke.getParameter(ke.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h.type===i.UnsignedByteType||ee(h.type)===ke.getParameter(ke.IMPLEMENTATION_COLOR_READ_TYPE)||h.type===i.FloatType&&We.get("WEBGL_color_buffer_float")||h.type===i.HalfFloatType&&We.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");ke.checkFramebufferStatus(ke.FRAMEBUFFER)===ke.FRAMEBUFFER_COMPLETE?ke.readPixels(t,r,n,o,ee(h.format),ee(h.type),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{c&&ke.bindFramebuffer(ke.FRAMEBUFFER,be)}}}},i.WebGLRenderTarget=function(e,t,r){this.uuid=i.Math.generateUUID(),this.width=e,this.height=t,this.scissor=new i.Vector4(0,0,e,t),this.scissorTest=!1,this.viewport=new i.Vector4(0,0,e,t),r=r||{},void 0===r.minFilter&&(r.minFilter=i.LinearFilter),this.texture=new i.Texture(void 0,void 0,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy),this.depthBuffer=void 0!==r.depthBuffer?r.depthBuffer:!0,this.stencilBuffer=void 0!==r.stencilBuffer?r.stencilBuffer:!0},i.WebGLRenderTarget.prototype={constructor:i.WebGLRenderTarget,setSize:function(e,t){(this.width!==e||this.height!==t)&&(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.WebGLRenderTarget.prototype),i.WebGLRenderTargetCube=function(e,t,r){i.WebGLRenderTarget.call(this,e,t,r),this.activeCubeFace=0,this.activeMipMapLevel=0},i.WebGLRenderTargetCube.prototype=Object.create(i.WebGLRenderTarget.prototype),i.WebGLRenderTargetCube.prototype.constructor=i.WebGLRenderTargetCube,i.WebGLBufferRenderer=function(e,t,r){function n(e){s=e}function o(t,i){e.drawArrays(s,t,i),r.calls++,r.vertices+=i,s===e.TRIANGLES&&(r.faces+=i/3)}function a(n){var o=t.get("ANGLE_instanced_arrays");if(null===o)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var a=n.attributes.position,c=0;a instanceof i.InterleavedBufferAttribute?(c=a.data.count,o.drawArraysInstancedANGLE(s,0,c,n.maxInstancedCount)):(c=a.count,o.drawArraysInstancedANGLE(s,0,c,n.maxInstancedCount)),r.calls++,r.vertices+=c*n.maxInstancedCount,s===e.TRIANGLES&&(r.faces+=n.maxInstancedCount*c/3)}var s;this.setMode=n,this.render=o,this.renderInstances=a},i.WebGLIndexedBufferRenderer=function(e,t,r){function i(e){s=e}function n(r){r.array instanceof Uint32Array&&t.get("OES_element_index_uint")?(c=e.UNSIGNED_INT,h=4):(c=e.UNSIGNED_SHORT,h=2)}function o(t,i){e.drawElements(s,i,c,t*h),r.calls++,r.vertices+=i,s===e.TRIANGLES&&(r.faces+=i/3)}function a(i,n,o){var a=t.get("ANGLE_instanced_arrays");return null===a?void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(a.drawElementsInstancedANGLE(s,o,c,n*h,i.maxInstancedCount),r.calls++,r.vertices+=o*i.maxInstancedCount,void(s===e.TRIANGLES&&(r.faces+=i.maxInstancedCount*o/3)))}var s,c,h;this.setMode=i,this.setIndex=n,this.render=o,this.renderInstances=a},i.WebGLExtensions=function(e){var t={};this.get=function(r){if(void 0!==t[r])return t[r];var i;switch(r){case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=e.getExtension("WEBGL_compressed_texture_etc1");break;default:i=e.getExtension(r)}return null===i&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),t[r]=i,i}},i.WebGLCapabilities=function(e,t,r){function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}this.getMaxPrecision=i,this.precision=void 0!==r.precision?r.precision:"highp",this.logarithmicDepthBuffer=void 0!==r.logarithmicDepthBuffer?r.logarithmicDepthBuffer:!1,this.maxTextures=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),this.maxVertexTextures=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxCubemapSize=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),this.maxAttributes=e.getParameter(e.MAX_VERTEX_ATTRIBS),this.maxVertexUniforms=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),this.maxVaryings=e.getParameter(e.MAX_VARYING_VECTORS),this.maxFragmentUniforms=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),this.vertexTextures=this.maxVertexTextures>0,this.floatFragmentTextures=!!t.get("OES_texture_float"),this.floatVertexTextures=this.vertexTextures&&this.floatFragmentTextures;var n=i(this.precision);n!==this.precision&&(console.warn("THREE.WebGLRenderer:",this.precision,"not supported, using",n,"instead."),this.precision=n),this.logarithmicDepthBuffer&&(this.logarithmicDepthBuffer=!!t.get("EXT_frag_depth"))},i.WebGLGeometries=function(e,t,r){function n(e){var t=e.geometry;if(void 0!==l[t.id])return l[t.id];t.addEventListener("dispose",o);var n;return t instanceof i.BufferGeometry?n=t:t instanceof i.Geometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new i.BufferGeometry).setFromObject(e)),n=t._bufferGeometry),l[t.id]=n,r.memory.geometries++,n}function o(e){var i=e.target,n=l[i.id];null!==n.index&&s(n.index),c(n.attributes),i.removeEventListener("dispose",o),delete l[i.id];var a=t.get(i);a.wireframe&&s(a.wireframe),t["delete"](i);var h=t.get(n);h.wireframe&&s(h.wireframe),t["delete"](n),r.memory.geometries--}function a(e){return e instanceof i.InterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer}function s(t){var r=a(t);void 0!==r&&(e.deleteBuffer(r),h(t))}function c(e){for(var t in e)s(e[t])}function h(e){e instanceof i.InterleavedBufferAttribute?t["delete"](e.data):t["delete"](e)}var l={};this.get=n},i.WebGLLights=function(){var e={};this.get=function(t){if(void 0!==e[t.id])return e[t.id];var r;switch(t.type){case"DirectionalLight":r={direction:new i.Vector3,color:new i.Color,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i.Vector2};break;case"SpotLight":r={position:new i.Vector3,direction:new i.Vector3,color:new i.Color,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i.Vector2};break;case"PointLight":r={position:new i.Vector3,color:new i.Color,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i.Vector2};break;case"HemisphereLight":r={direction:new i.Vector3,skyColor:new i.Color,groundColor:new i.Color}}return e[t.id]=r,r}},i.WebGLObjects=function(e,t,r){function n(t){var r=u.get(t);t.geometry instanceof i.Geometry&&r.updateFromObject(t);var n=r.index,a=r.attributes;null!==n&&o(n,e.ELEMENT_ARRAY_BUFFER);for(var s in a)o(a[s],e.ARRAY_BUFFER);var c=r.morphAttributes;for(var s in c)for(var h=c[s],l=0,p=h.length;p>l;l++)o(h[l],e.ARRAY_BUFFER);return r}function o(e,r){var n=e instanceof i.InterleavedBufferAttribute?e.data:e,o=t.get(n);void 0===o.__webglBuffer?a(o,n,r):o.version!==n.version&&s(o,n,r)}function a(t,r,i){t.__webglBuffer=e.createBuffer(),e.bindBuffer(i,t.__webglBuffer);var n=r.dynamic?e.DYNAMIC_DRAW:e.STATIC_DRAW;e.bufferData(i,r.array,n),t.version=r.version}function s(t,r,i){e.bindBuffer(i,t.__webglBuffer),r.dynamic===!1||-1===r.updateRange.count?e.bufferSubData(i,0,r.array):0===r.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(e.bufferSubData(i,r.updateRange.offset*r.array.BYTES_PER_ELEMENT,r.array.subarray(r.updateRange.offset,r.updateRange.offset+r.updateRange.count)),r.updateRange.count=0),t.version=r.version}function c(e){return e instanceof i.InterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer}function h(r){var n=t.get(r);if(void 0!==n.wireframe)return n.wireframe;var a=[],s=r.index,c=r.attributes,h=c.position;if(null!==s)for(var u={},p=s.array,d=0,f=p.length;f>d;d+=3){var m=p[d+0],v=p[d+1],g=p[d+2];l(u,m,v)&&a.push(m,v),l(u,v,g)&&a.push(v,g),l(u,g,m)&&a.push(g,m)}else for(var p=c.position.array,d=0,f=p.length/3-1;f>d;d+=3){var m=d+0,v=d+1,g=d+2;a.push(m,v,v,g,g,m)}var y=h.count>65535?Uint32Array:Uint16Array,x=new i.BufferAttribute(new y(a),1);return o(x,e.ELEMENT_ARRAY_BUFFER),n.wireframe=x,x}function l(e,t,r){if(t>r){var i=t;t=r,r=i}var n=e[t];return void 0===n?(e[t]=[r],!0):-1===n.indexOf(r)?(n.push(r),!0):!1}var u=new i.WebGLGeometries(e,t,r);this.getAttributeBuffer=c,this.getWireframeAttribute=h,this.update=n},i.WebGLProgram=function(){function e(e){switch(e){case i.LinearEncoding:return["Linear","( value )"];case i.sRGBEncoding:return["sRGB","( value )"];case i.RGBEEncoding:return["RGBE","( value )"];case i.RGBM7Encoding:return["RGBM","( value, 7.0 )"];case i.RGBM16Encoding:return["RGBM","( value, 16.0 )"];case i.RGBDEncoding:return["RGBD","( value, 256.0 )"];case i.GammaEncoding:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+e)}}function t(t,r){var i=e(r);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function r(t,r){var i=e(r);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function n(e,t){var r;switch(t){case i.LinearToneMapping:r="Linear";break;case i.ReinhardToneMapping:r="Reinhard";break;case i.Uncharted2ToneMapping:r="Uncharted2";break;case i.CineonToneMapping:r="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+r+"ToneMapping( color ); }"}function o(e,t,r){e=e||{};var i=[e.derivatives||t.envMapCubeUV||t.bumpMap||t.normalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&r.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&r.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&r.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""];return i.filter(h).join("\n")}function a(e){var t=[];for(var r in e){var i=e[r];i!==!1&&t.push("#define "+r+" "+i)}return t.join("\n")}function s(e,t,r){for(var i={},n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),o=0;n>o;o++){var a=e.getActiveUniform(t,o),s=a.name,c=e.getUniformLocation(t,s),h=f.exec(s);if(h){var l=h[1],u=h[2],p=i[l];p||(p=i[l]={}),p[u]=c}else if(h=m.exec(s)){var d=h[1],g=h[2],y=h[3],x=i[d];x||(x=i[d]=[]);var b=x[g];b||(b=x[g]={}),b[y]=c}else if(h=v.exec(s)){var d=h[1];i[d]=c}else i[s]=c}return i}function c(e,t,r){for(var i={},n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),o=0;n>o;o++){var a=e.getActiveAttrib(t,o),s=a.name;i[s]=e.getAttribLocation(t,s)}return i}function h(e){return""!==e}function l(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights)}function u(e){function t(e,t){var r=i.ShaderChunk[t];if(void 0===r)throw new Error("Can not resolve #include <"+t+">");return u(r)}var r=/#include +<([\w\d.]+)>/g;return e.replace(r,t)}function p(e){function t(e,t,r,i){for(var n="",o=parseInt(t);o<parseInt(r);o++)n+=i.replace(/\[ i \]/g,"[ "+o+" ]");return n}var r=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;return e.replace(r,t)}var d=0,f=/^([\w\d_]+)\.([\w\d_]+)$/,m=/^([\w\d_]+)\[(\d+)\]\.([\w\d_]+)$/,v=/^([\w\d_]+)\[0\]$/;return function(e,f,m,v){var g=e.context,y=m.extensions,x=m.defines,b=m.__webglShader.vertexShader,_=m.__webglShader.fragmentShader,M="SHADOWMAP_TYPE_BASIC";v.shadowMapType===i.PCFShadowMap?M="SHADOWMAP_TYPE_PCF":v.shadowMapType===i.PCFSoftShadowMap&&(M="SHADOWMAP_TYPE_PCF_SOFT");var w="ENVMAP_TYPE_CUBE",S="ENVMAP_MODE_REFLECTION",E="ENVMAP_BLENDING_MULTIPLY";if(v.envMap){switch(m.envMap.mapping){case i.CubeReflectionMapping:case i.CubeRefractionMapping:w="ENVMAP_TYPE_CUBE";break;case i.CubeUVReflectionMapping:case i.CubeUVRefractionMapping:w="ENVMAP_TYPE_CUBE_UV";break;case i.EquirectangularReflectionMapping:case i.EquirectangularRefractionMapping:w="ENVMAP_TYPE_EQUIREC";break;case i.SphericalReflectionMapping:w="ENVMAP_TYPE_SPHERE"}switch(m.envMap.mapping){case i.CubeRefractionMapping:case i.EquirectangularRefractionMapping:S="ENVMAP_MODE_REFRACTION"}switch(m.combine){case i.MultiplyOperation:E="ENVMAP_BLENDING_MULTIPLY";break;case i.MixOperation:E="ENVMAP_BLENDING_MIX";break;case i.AddOperation:E="ENVMAP_BLENDING_ADD"}}var T,A,L=e.gammaFactor>0?e.gammaFactor:1,C=o(y,v,e.extensions),R=a(x),P=g.createProgram();m instanceof i.RawShaderMaterial?(T="",A=""):(T=["precision "+v.precision+" float;","precision "+v.precision+" int;","#define SHADER_NAME "+m.__webglShader.name,R,v.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+L,"#define MAX_BONES "+v.maxBones,v.map?"#define USE_MAP":"",v.envMap?"#define USE_ENVMAP":"",v.envMap?"#define "+S:"",v.lightMap?"#define USE_LIGHTMAP":"",v.aoMap?"#define USE_AOMAP":"",v.emissiveMap?"#define USE_EMISSIVEMAP":"",v.bumpMap?"#define USE_BUMPMAP":"",v.normalMap?"#define USE_NORMALMAP":"",v.displacementMap&&v.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",v.specularMap?"#define USE_SPECULARMAP":"",v.roughnessMap?"#define USE_ROUGHNESSMAP":"",v.metalnessMap?"#define USE_METALNESSMAP":"",v.alphaMap?"#define USE_ALPHAMAP":"",v.vertexColors?"#define USE_COLOR":"",v.flatShading?"#define FLAT_SHADED":"",v.skinning?"#define USE_SKINNING":"",v.useVertexTexture?"#define BONE_TEXTURE":"",v.morphTargets?"#define USE_MORPHTARGETS":"",v.morphNormals&&v.flatShading===!1?"#define USE_MORPHNORMALS":"",v.doubleSided?"#define DOUBLE_SIDED":"",v.flipSided?"#define FLIP_SIDED":"",v.shadowMapEnabled?"#define USE_SHADOWMAP":"",v.shadowMapEnabled?"#define "+M:"",v.pointLightShadows>0?"#define POINT_LIGHT_SHADOWS":"",v.sizeAttenuation?"#define USE_SIZEATTENUATION":"",v.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",v.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","	attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","	attribute vec3 morphTarget0;","	attribute vec3 morphTarget1;","	attribute vec3 morphTarget2;","	attribute vec3 morphTarget3;","	#ifdef USE_MORPHNORMALS","		attribute vec3 morphNormal0;","		attribute vec3 morphNormal1;","		attribute vec3 morphNormal2;","		attribute vec3 morphNormal3;","	#else","		attribute vec3 morphTarget4;","		attribute vec3 morphTarget5;","		attribute vec3 morphTarget6;","		attribute vec3 morphTarget7;","	#endif","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif","\n"].filter(h).join("\n"),A=[C,"precision "+v.precision+" float;","precision "+v.precision+" int;","#define SHADER_NAME "+m.__webglShader.name,R,v.alphaTest?"#define ALPHATEST "+v.alphaTest:"","#define GAMMA_FACTOR "+L,v.useFog&&v.fog?"#define USE_FOG":"",v.useFog&&v.fogExp?"#define FOG_EXP2":"",v.map?"#define USE_MAP":"",v.envMap?"#define USE_ENVMAP":"",v.envMap?"#define "+w:"",v.envMap?"#define "+S:"",v.envMap?"#define "+E:"",v.lightMap?"#define USE_LIGHTMAP":"",v.aoMap?"#define USE_AOMAP":"",v.emissiveMap?"#define USE_EMISSIVEMAP":"",v.bumpMap?"#define USE_BUMPMAP":"",v.normalMap?"#define USE_NORMALMAP":"",v.specularMap?"#define USE_SPECULARMAP":"",v.roughnessMap?"#define USE_ROUGHNESSMAP":"",v.metalnessMap?"#define USE_METALNESSMAP":"",v.alphaMap?"#define USE_ALPHAMAP":"",v.vertexColors?"#define USE_COLOR":"",v.flatShading?"#define FLAT_SHADED":"",v.doubleSided?"#define DOUBLE_SIDED":"",v.flipSided?"#define FLIP_SIDED":"",v.shadowMapEnabled?"#define USE_SHADOWMAP":"",v.shadowMapEnabled?"#define "+M:"",v.pointLightShadows>0?"#define POINT_LIGHT_SHADOWS":"",v.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",v.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",v.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",v.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",v.envMap&&e.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",v.toneMapping!==i.NoToneMapping?"#define TONE_MAPPING":"",v.toneMapping!==i.NoToneMapping?i.ShaderChunk.tonemapping_pars_fragment:"",v.toneMapping!==i.NoToneMapping?n("toneMapping",v.toneMapping):"",v.outputEncoding||v.mapEncoding||v.envMapEncoding||v.emissiveMapEncoding?i.ShaderChunk.encodings_pars_fragment:"",v.mapEncoding?t("mapTexelToLinear",v.mapEncoding):"",v.envMapEncoding?t("envMapTexelToLinear",v.envMapEncoding):"",v.emissiveMapEncoding?t("emissiveMapTexelToLinear",v.emissiveMapEncoding):"",v.outputEncoding?r("linearToOutputTexel",v.outputEncoding):"","\n"].filter(h).join("\n")),b=u(b,v),b=l(b,v),_=u(_,v),_=l(_,v),m instanceof i.ShaderMaterial==!1&&(b=p(b),_=p(_));var I=T+b,B=A+_,D=i.WebGLShader(g,g.VERTEX_SHADER,I),U=i.WebGLShader(g,g.FRAGMENT_SHADER,B);g.attachShader(P,D),g.attachShader(P,U),void 0!==m.index0AttributeName?g.bindAttribLocation(P,0,m.index0AttributeName):v.morphTargets===!0&&g.bindAttribLocation(P,0,"position"),g.linkProgram(P);var F=g.getProgramInfoLog(P),N=g.getShaderInfoLog(D),O=g.getShaderInfoLog(U),V=!0,G=!0;g.getProgramParameter(P,g.LINK_STATUS)===!1?(V=!1,console.error("THREE.WebGLProgram: shader error: ",g.getError(),"gl.VALIDATE_STATUS",g.getProgramParameter(P,g.VALIDATE_STATUS),"gl.getProgramInfoLog",F,N,O)):""!==F?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",F):(""===N||""===O)&&(G=!1),G&&(this.diagnostics={runnable:V,material:m,programLog:F,vertexShader:{log:N,prefix:T},fragmentShader:{log:O,prefix:A}}),g.deleteShader(D),g.deleteShader(U);var z;this.getUniforms=function(){return void 0===z&&(z=s(g,P)),z};var k;return this.getAttributes=function(){return void 0===k&&(k=c(g,P)),k},this.destroy=function(){g.deleteProgram(P),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=d++,this.code=f,this.usedTimes=1,this.program=P,this.vertexShader=D,this.fragmentShader=U,this}}(),i.WebGLPrograms=function(e,t){function r(e){if(t.floatVertexTextures&&e&&e.skeleton&&e.skeleton.useVertexTexture)return 1024;var r=t.maxVertexUniforms,n=Math.floor((r-20)/4),o=n;return void 0!==e&&e instanceof i.SkinnedMesh&&(o=Math.min(e.skeleton.bones.length,o),o<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+o+" (try OpenGL instead of ANGLE)")),o}function n(e,t){var r;return e?e instanceof i.Texture?r=e.encoding:e instanceof i.WebGLRenderTarget&&(r=e.texture.encoding):r=i.LinearEncoding,r===i.LinearEncoding&&t&&(r=i.GammaEncoding),r}var o=[],a={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshStandardMaterial:"standard",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},s=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","shadowMapEnabled","pointLightShadows","toneMapping","physicallyCorrectLights","shadowMapType","alphaTest","doubleSided","flipSided"];this.getParameters=function(o,s,c,h){var l=a[o.type],u=r(h),p=e.getPrecision();null!==o.precision&&(p=t.getMaxPrecision(o.precision),p!==o.precision&&console.warn("THREE.WebGLProgram.getParameters:",o.precision,"not supported, using",p,"instead."));var d={shaderID:l,precision:p,supportsVertexTextures:t.vertexTextures,outputEncoding:n(e.getCurrentRenderTarget(),e.gammaOutput),map:!!o.map,mapEncoding:n(o.map,e.gammaInput),envMap:!!o.envMap,envMapMode:o.envMap&&o.envMap.mapping,envMapEncoding:n(o.envMap,e.gammaInput),envMapCubeUV:!!o.envMap&&(o.envMap.mapping===i.CubeUVReflectionMapping||o.envMap.mapping===i.CubeUVRefractionMapping),lightMap:!!o.lightMap,aoMap:!!o.aoMap,emissiveMap:!!o.emissiveMap,emissiveMapEncoding:n(o.emissiveMap,e.gammaInput),bumpMap:!!o.bumpMap,normalMap:!!o.normalMap,displacementMap:!!o.displacementMap,roughnessMap:!!o.roughnessMap,metalnessMap:!!o.metalnessMap,specularMap:!!o.specularMap,alphaMap:!!o.alphaMap,combine:o.combine,vertexColors:o.vertexColors,fog:c,useFog:o.fog,fogExp:c instanceof i.FogExp2,flatShading:o.shading===i.FlatShading,sizeAttenuation:o.sizeAttenuation,logarithmicDepthBuffer:t.logarithmicDepthBuffer,skinning:o.skinning,maxBones:u,useVertexTexture:t.floatVertexTextures&&h&&h.skeleton&&h.skeleton.useVertexTexture,morphTargets:o.morphTargets,morphNormals:o.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numHemiLights:s.hemi.length,pointLightShadows:s.shadowsPointLight,shadowMapEnabled:e.shadowMap.enabled&&h.receiveShadow&&s.shadows.length>0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:o.premultipliedAlpha,alphaTest:o.alphaTest,doubleSided:o.side===i.DoubleSide,flipSided:o.side===i.BackSide};return d},this.getProgramCode=function(e,t){var r=[];if(t.shaderID?r.push(t.shaderID):(r.push(e.fragmentShader),r.push(e.vertexShader)),void 0!==e.defines)for(var i in e.defines)r.push(i),r.push(e.defines[i]);for(var n=0;n<s.length;n++){var o=s[n];r.push(o),r.push(t[o])}return r.join()},this.acquireProgram=function(t,r,n){for(var a,s=0,c=o.length;c>s;s++){var h=o[s];if(h.code===n){a=h,++a.usedTimes;break}}return void 0===a&&(a=new i.WebGLProgram(e,n,t,r),o.push(a)),a},this.releaseProgram=function(e){if(0===--e.usedTimes){var t=o.indexOf(e);o[t]=o[o.length-1],o.pop(),e.destroy()}},this.programs=o},i.WebGLProperties=function(){var e={};this.get=function(t){var r=t.uuid,i=e[r];return void 0===i&&(i={},e[r]=i),i},this["delete"]=function(t){delete e[t.uuid]},this.clear=function(){e={}}},i.WebGLShader=function(){function e(e){for(var t=e.split("\n"),r=0;r<t.length;r++)t[r]=r+1+": "+t[r];return t.join("\n")}return function(t,r,i){var n=t.createShader(r);return t.shaderSource(n,i),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS)===!1&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",r===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(n),e(i)),n}}(),i.WebGLShadowMap=function(e,t,r){function n(e,t,r,n){var o=e.geometry,a=null,s=g,c=e.customDepthMaterial;if(r&&(s=y,c=e.customDistanceMaterial),c)a=c;else{var h=void 0!==o.morphTargets&&o.morphTargets.length>0&&t.morphTargets,l=e instanceof i.SkinnedMesh&&t.skinning,u=0;
  h&&(u|=f),l&&(u|=m),a=s[u]}return a.visible=t.visible,a.wireframe=t.wireframe,a.wireframeLinewidth=t.wireframeLinewidth,r&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(n),a}function o(e,t,r){if(e.visible!==!1){if(e.layers.test(t.layers)&&(e instanceof i.Mesh||e instanceof i.Line||e instanceof i.Points)&&e.castShadow&&(e.frustumCulled===!1||c.intersectsObject(e)===!0)){var n=e.material;n.visible===!0&&(e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),d.push(e))}for(var a=e.children,s=0,h=a.length;h>s;s++)o(a[s],t,r)}}for(var a=e.context,s=e.state,c=new i.Frustum,h=new i.Matrix4,l=new i.Vector2,u=new i.Vector3,p=new i.Vector3,d=[],f=1,m=2,v=(f|m)+1,g=new Array(v),y=new Array(v),x=[new i.Vector3(1,0,0),new i.Vector3(-1,0,0),new i.Vector3(0,0,1),new i.Vector3(0,0,-1),new i.Vector3(0,1,0),new i.Vector3(0,-1,0)],b=[new i.Vector3(0,1,0),new i.Vector3(0,1,0),new i.Vector3(0,1,0),new i.Vector3(0,1,0),new i.Vector3(0,0,1),new i.Vector3(0,0,-1)],_=[new i.Vector4,new i.Vector4,new i.Vector4,new i.Vector4,new i.Vector4,new i.Vector4],M=i.ShaderLib.depthRGBA,w=i.UniformsUtils.clone(M.uniforms),S=i.ShaderLib.distanceRGBA,E=i.UniformsUtils.clone(S.uniforms),T=0;T!==v;++T){var A=0!==(T&f),L=0!==(T&m),C=new i.ShaderMaterial({uniforms:w,vertexShader:M.vertexShader,fragmentShader:M.fragmentShader,morphTargets:A,skinning:L});g[T]=C;var R=new i.ShaderMaterial({defines:{USE_SHADOWMAP:""},uniforms:E,vertexShader:S.vertexShader,fragmentShader:S.fragmentShader,morphTargets:A,skinning:L});y[T]=R}var P=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=i.PCFShadowMap,this.cullFace=i.CullFaceFront,this.render=function(f,m){var v,g,y=t.shadows;if(0!==y.length&&P.enabled!==!1&&(P.autoUpdate!==!1||P.needsUpdate!==!1)){s.clearColor(1,1,1,1),s.disable(a.BLEND),s.enable(a.CULL_FACE),a.frontFace(a.CCW),a.cullFace(P.cullFace===i.CullFaceFront?a.FRONT:a.BACK),s.setDepthTest(!0),s.setScissorTest(!1);for(var M=0,w=y.length;w>M;M++){var S=y[M],E=S.shadow,T=E.camera;if(l.copy(E.mapSize),S instanceof i.PointLight){v=6,g=!0;var A=l.x,L=l.y;_[0].set(2*A,L,A,L),_[1].set(0,L,A,L),_[2].set(3*A,L,A,L),_[3].set(A,L,A,L),_[4].set(3*A,0,A,L),_[5].set(A,0,A,L),l.x*=4,l.y*=2}else v=1,g=!1;if(null===E.map){var C={minFilter:i.NearestFilter,magFilter:i.NearestFilter,format:i.RGBAFormat};E.map=new i.WebGLRenderTarget(l.x,l.y,C),S instanceof i.SpotLight&&(T.aspect=l.x/l.y),T.updateProjectionMatrix()}var R=E.map,I=E.matrix;p.setFromMatrixPosition(S.matrixWorld),T.position.copy(p),e.setRenderTarget(R),e.clear();for(var B=0;v>B;B++){if(g){u.copy(T.position),u.add(x[B]),T.up.copy(b[B]),T.lookAt(u);var D=_[B];s.viewport(D)}else u.setFromMatrixPosition(S.target.matrixWorld),T.lookAt(u);T.updateMatrixWorld(),T.matrixWorldInverse.getInverse(T.matrixWorld),I.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),I.multiply(T.projectionMatrix),I.multiply(T.matrixWorldInverse),h.multiplyMatrices(T.projectionMatrix,T.matrixWorldInverse),c.setFromMatrix(h),d.length=0,o(f,m,T);for(var U=0,F=d.length;F>U;U++){var N=d[U],O=r.update(N),V=N.material;if(V instanceof i.MultiMaterial)for(var G=O.groups,z=V.materials,k=0,H=G.length;H>k;k++){var j=G[k],W=z[j.materialIndex];if(W.visible===!0){var X=n(N,W,g,p);e.renderBufferDirect(T,null,O,X,N,j)}}else{var X=n(N,V,g,p);e.renderBufferDirect(T,null,O,X,N,null)}}}}var q=e.getClearColor(),Y=e.getClearAlpha();e.setClearColor(q,Y),s.enable(a.BLEND),P.cullFace===i.CullFaceFront&&a.cullFace(a.BACK),P.needsUpdate=!1}}},i.WebGLState=function(e,t,r){var n=this,o=new i.Vector4,a=new Uint8Array(16),s=new Uint8Array(16),c=new Uint8Array(16),h={},l=null,u=null,p=null,d=null,f=null,m=null,v=null,g=null,y=!1,x=null,b=null,_=null,M=null,w=null,S=null,E=null,T=null,A=null,L=null,C=null,R=null,P=null,I=null,B=null,D=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),U=void 0,F={},N=new i.Vector4,O=null,V=null,G=new i.Vector4,z=new i.Vector4,k=e.createTexture();e.bindTexture(e.TEXTURE_2D,k),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.RGB,1,1,0,e.RGB,e.UNSIGNED_BYTE,new Uint8Array(3)),this.init=function(){this.clearColor(0,0,0,1),this.clearDepth(1),this.clearStencil(0),this.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.frontFace(e.CCW),e.cullFace(e.BACK),this.enable(e.CULL_FACE),this.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA)},this.initAttributes=function(){for(var e=0,t=a.length;t>e;e++)a[e]=0},this.enableAttribute=function(r){if(a[r]=1,0===s[r]&&(e.enableVertexAttribArray(r),s[r]=1),0!==c[r]){var i=t.get("ANGLE_instanced_arrays");i.vertexAttribDivisorANGLE(r,0),c[r]=0}},this.enableAttributeAndDivisor=function(t,r,i){a[t]=1,0===s[t]&&(e.enableVertexAttribArray(t),s[t]=1),c[t]!==r&&(i.vertexAttribDivisorANGLE(t,r),c[t]=r)},this.disableUnusedAttributes=function(){for(var t=0,r=s.length;r>t;t++)s[t]!==a[t]&&(e.disableVertexAttribArray(t),s[t]=0)},this.enable=function(t){h[t]!==!0&&(e.enable(t),h[t]=!0)},this.disable=function(t){h[t]!==!1&&(e.disable(t),h[t]=!1)},this.getCompressedTextureFormats=function(){if(null===l&&(l=[],t.get("WEBGL_compressed_texture_pvrtc")||t.get("WEBGL_compressed_texture_s3tc")||t.get("WEBGL_compressed_texture_etc1")))for(var r=e.getParameter(e.COMPRESSED_TEXTURE_FORMATS),i=0;i<r.length;i++)l.push(r[i]);return l},this.setBlending=function(t,n,o,a,s,c,h,l){t===i.NoBlending?this.disable(e.BLEND):this.enable(e.BLEND),(t!==u||l!==y)&&(t===i.AdditiveBlending?l?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE)):t===i.SubtractiveBlending?l?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ZERO,e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ONE_MINUS_SRC_ALPHA)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR)):t===i.MultiplyBlending?l?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ZERO,e.ZERO,e.SRC_COLOR,e.SRC_ALPHA)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.SRC_COLOR)):l?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)):(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)),u=t,y=l),t===i.CustomBlending?(s=s||n,c=c||o,h=h||a,(n!==p||s!==m)&&(e.blendEquationSeparate(r(n),r(s)),p=n,m=s),(o!==d||a!==f||c!==v||h!==g)&&(e.blendFuncSeparate(r(o),r(a),r(c),r(h)),d=o,f=a,v=c,g=h)):(p=null,d=null,f=null,m=null,v=null,g=null)},this.setDepthFunc=function(t){if(x!==t){if(t)switch(t){case i.NeverDepth:e.depthFunc(e.NEVER);break;case i.AlwaysDepth:e.depthFunc(e.ALWAYS);break;case i.LessDepth:e.depthFunc(e.LESS);break;case i.LessEqualDepth:e.depthFunc(e.LEQUAL);break;case i.EqualDepth:e.depthFunc(e.EQUAL);break;case i.GreaterEqualDepth:e.depthFunc(e.GEQUAL);break;case i.GreaterDepth:e.depthFunc(e.GREATER);break;case i.NotEqualDepth:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}else e.depthFunc(e.LEQUAL);x=t}},this.setDepthTest=function(t){t?this.enable(e.DEPTH_TEST):this.disable(e.DEPTH_TEST)},this.setDepthWrite=function(t){b!==t&&(e.depthMask(t),b=t)},this.setColorWrite=function(t){_!==t&&(e.colorMask(t,t,t,t),_=t)},this.setStencilFunc=function(t,r,i){(w!==t||S!==r||E!==i)&&(e.stencilFunc(t,r,i),w=t,S=r,E=i)},this.setStencilOp=function(t,r,i){(T!==t||A!==r||L!==i)&&(e.stencilOp(t,r,i),T=t,A=r,L=i)},this.setStencilTest=function(t){t?this.enable(e.STENCIL_TEST):this.disable(e.STENCIL_TEST)},this.setStencilWrite=function(t){M!==t&&(e.stencilMask(t),M=t)},this.setFlipSided=function(t){C!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),C=t)},this.setLineWidth=function(t){t!==R&&(e.lineWidth(t),R=t)},this.setPolygonOffset=function(t,r,i){t?this.enable(e.POLYGON_OFFSET_FILL):this.disable(e.POLYGON_OFFSET_FILL),!t||P===r&&I===i||(e.polygonOffset(r,i),P=r,I=i)},this.getScissorTest=function(){return B},this.setScissorTest=function(t){B=t,t?this.enable(e.SCISSOR_TEST):this.disable(e.SCISSOR_TEST)},this.activeTexture=function(t){void 0===t&&(t=e.TEXTURE0+D-1),U!==t&&(e.activeTexture(t),U=t)},this.bindTexture=function(t,r){void 0===U&&n.activeTexture();var i=F[U];void 0===i&&(i={type:void 0,texture:void 0},F[U]=i),(i.type!==t||i.texture!==r)&&(e.bindTexture(t,r||k),i.type=t,i.texture=r)},this.compressedTexImage2D=function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(t){console.error(t)}},this.texImage2D=function(){try{e.texImage2D.apply(e,arguments)}catch(t){console.error(t)}},this.clearColor=function(t,r,i,n){o.set(t,r,i,n),N.equals(o)===!1&&(e.clearColor(t,r,i,n),N.copy(o))},this.clearDepth=function(t){O!==t&&(e.clearDepth(t),O=t)},this.clearStencil=function(t){V!==t&&(e.clearStencil(t),V=t)},this.scissor=function(t){G.equals(t)===!1&&(e.scissor(t.x,t.y,t.z,t.w),G.copy(t))},this.viewport=function(t){z.equals(t)===!1&&(e.viewport(t.x,t.y,t.z,t.w),z.copy(t))},this.reset=function(){for(var t=0;t<s.length;t++)1===s[t]&&(e.disableVertexAttribArray(t),s[t]=0);h={},l=null,U=void 0,F={},u=null,_=null,b=null,M=null,C=null}},i.LensFlarePlugin=function(e,t){function r(){var e=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),t=new Uint16Array([0,1,2,0,2,3]);o=d.createBuffer(),a=d.createBuffer(),d.bindBuffer(d.ARRAY_BUFFER,o),d.bufferData(d.ARRAY_BUFFER,e,d.STATIC_DRAW),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,a),d.bufferData(d.ELEMENT_ARRAY_BUFFER,t,d.STATIC_DRAW),u=d.createTexture(),p=d.createTexture(),f.bindTexture(d.TEXTURE_2D,u),d.texImage2D(d.TEXTURE_2D,0,d.RGB,16,16,0,d.RGB,d.UNSIGNED_BYTE,null),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.NEAREST),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.NEAREST),f.bindTexture(d.TEXTURE_2D,p),d.texImage2D(d.TEXTURE_2D,0,d.RGBA,16,16,0,d.RGBA,d.UNSIGNED_BYTE,null),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.NEAREST),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.NEAREST),l=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;var r;r=l?{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility =        visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *=       visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")}:{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["precision mediump float;","uniform lowp int renderType;","uniform sampler2D map;","uniform sampler2D occlusionMap;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;","visibility = ( 1.0 - visibility / 4.0 );","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * visibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},s=n(r),c={vertex:d.getAttribLocation(s,"position"),uv:d.getAttribLocation(s,"uv")},h={renderType:d.getUniformLocation(s,"renderType"),map:d.getUniformLocation(s,"map"),occlusionMap:d.getUniformLocation(s,"occlusionMap"),opacity:d.getUniformLocation(s,"opacity"),color:d.getUniformLocation(s,"color"),scale:d.getUniformLocation(s,"scale"),rotation:d.getUniformLocation(s,"rotation"),screenPosition:d.getUniformLocation(s,"screenPosition")}}function n(t){var r=d.createProgram(),i=d.createShader(d.FRAGMENT_SHADER),n=d.createShader(d.VERTEX_SHADER),o="precision "+e.getPrecision()+" float;\n";return d.shaderSource(i,o+t.fragmentShader),d.shaderSource(n,o+t.vertexShader),d.compileShader(i),d.compileShader(n),d.attachShader(r,i),d.attachShader(r,n),d.linkProgram(r),r}var o,a,s,c,h,l,u,p,d=e.context,f=e.state;this.render=function(n,m,v){if(0!==t.length){var g=new i.Vector3,y=v.w/v.z,x=.5*v.z,b=.5*v.w,_=16/v.w,M=new i.Vector2(_*y,_),w=new i.Vector3(1,1,0),S=new i.Vector2(1,1);void 0===s&&r(),d.useProgram(s),f.initAttributes(),f.enableAttribute(c.vertex),f.enableAttribute(c.uv),f.disableUnusedAttributes(),d.uniform1i(h.occlusionMap,0),d.uniform1i(h.map,1),d.bindBuffer(d.ARRAY_BUFFER,o),d.vertexAttribPointer(c.vertex,2,d.FLOAT,!1,16,0),d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,a),f.disable(d.CULL_FACE),f.setDepthWrite(!1);for(var E=0,T=t.length;T>E;E++){_=16/v.w,M.set(_*y,_);var A=t[E];if(g.set(A.matrixWorld.elements[12],A.matrixWorld.elements[13],A.matrixWorld.elements[14]),g.applyMatrix4(m.matrixWorldInverse),g.applyProjection(m.projectionMatrix),w.copy(g),S.x=w.x*x+x,S.y=w.y*b+b,l||S.x>0&&S.x<v.z&&S.y>0&&S.y<v.w){f.activeTexture(d.TEXTURE0),f.bindTexture(d.TEXTURE_2D,null),f.activeTexture(d.TEXTURE1),f.bindTexture(d.TEXTURE_2D,u),d.copyTexImage2D(d.TEXTURE_2D,0,d.RGB,v.x+S.x-8,v.y+S.y-8,16,16,0),d.uniform1i(h.renderType,0),d.uniform2f(h.scale,M.x,M.y),d.uniform3f(h.screenPosition,w.x,w.y,w.z),f.disable(d.BLEND),f.enable(d.DEPTH_TEST),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0),f.activeTexture(d.TEXTURE0),f.bindTexture(d.TEXTURE_2D,p),d.copyTexImage2D(d.TEXTURE_2D,0,d.RGBA,v.x+S.x-8,v.y+S.y-8,16,16,0),d.uniform1i(h.renderType,1),f.disable(d.DEPTH_TEST),f.activeTexture(d.TEXTURE1),f.bindTexture(d.TEXTURE_2D,u),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0),A.positionScreen.copy(w),A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares(),d.uniform1i(h.renderType,2),f.enable(d.BLEND);for(var L=0,C=A.lensFlares.length;C>L;L++){var R=A.lensFlares[L];R.opacity>.001&&R.scale>.001&&(w.x=R.x,w.y=R.y,w.z=R.z,_=R.size*R.scale/v.w,M.x=_*y,M.y=_,d.uniform3f(h.screenPosition,w.x,w.y,w.z),d.uniform2f(h.scale,M.x,M.y),d.uniform1f(h.rotation,R.rotation),d.uniform1f(h.opacity,R.opacity),d.uniform3f(h.color,R.color.r,R.color.g,R.color.b),f.setBlending(R.blending,R.blendEquation,R.blendSrc,R.blendDst),e.setTexture(R.texture,1),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0))}}}f.enable(d.CULL_FACE),f.enable(d.DEPTH_TEST),f.setDepthWrite(!0),e.resetGLState()}}},i.SpritePlugin=function(e,t){function r(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),t=new Uint16Array([0,1,2,0,2,3]);a=p.createBuffer(),s=p.createBuffer(),p.bindBuffer(p.ARRAY_BUFFER,a),p.bufferData(p.ARRAY_BUFFER,e,p.STATIC_DRAW),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,s),p.bufferData(p.ELEMENT_ARRAY_BUFFER,t,p.STATIC_DRAW),c=n(),h={position:p.getAttribLocation(c,"position"),uv:p.getAttribLocation(c,"uv")},l={uvOffset:p.getUniformLocation(c,"uvOffset"),uvScale:p.getUniformLocation(c,"uvScale"),rotation:p.getUniformLocation(c,"rotation"),scale:p.getUniformLocation(c,"scale"),color:p.getUniformLocation(c,"color"),map:p.getUniformLocation(c,"map"),opacity:p.getUniformLocation(c,"opacity"),modelViewMatrix:p.getUniformLocation(c,"modelViewMatrix"),projectionMatrix:p.getUniformLocation(c,"projectionMatrix"),fogType:p.getUniformLocation(c,"fogType"),fogDensity:p.getUniformLocation(c,"fogDensity"),fogNear:p.getUniformLocation(c,"fogNear"),fogFar:p.getUniformLocation(c,"fogFar"),fogColor:p.getUniformLocation(c,"fogColor"),alphaTest:p.getUniformLocation(c,"alphaTest")};var r=document.createElement("canvas");r.width=8,r.height=8;var o=r.getContext("2d");o.fillStyle="white",o.fillRect(0,0,8,8),u=new i.Texture(r),u.needsUpdate=!0}function n(){var t=p.createProgram(),r=p.createShader(p.VERTEX_SHADER),i=p.createShader(p.FRAGMENT_SHADER);return p.shaderSource(r,["precision "+e.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),p.shaderSource(i,["precision "+e.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),p.compileShader(r),p.compileShader(i),p.attachShader(t,r),p.attachShader(t,i),p.linkProgram(t),t}function o(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}var a,s,c,h,l,u,p=e.context,d=e.state,f=new i.Vector3,m=new i.Quaternion,v=new i.Vector3;this.render=function(n,g){if(0!==t.length){void 0===c&&r(),p.useProgram(c),d.initAttributes(),d.enableAttribute(h.position),d.enableAttribute(h.uv),d.disableUnusedAttributes(),d.disable(p.CULL_FACE),d.enable(p.BLEND),p.bindBuffer(p.ARRAY_BUFFER,a),p.vertexAttribPointer(h.position,2,p.FLOAT,!1,16,0),p.vertexAttribPointer(h.uv,2,p.FLOAT,!1,16,8),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,s),p.uniformMatrix4fv(l.projectionMatrix,!1,g.projectionMatrix.elements),d.activeTexture(p.TEXTURE0),p.uniform1i(l.map,0);var y=0,x=0,b=n.fog;b?(p.uniform3f(l.fogColor,b.color.r,b.color.g,b.color.b),b instanceof i.Fog?(p.uniform1f(l.fogNear,b.near),p.uniform1f(l.fogFar,b.far),p.uniform1i(l.fogType,1),y=1,x=1):b instanceof i.FogExp2&&(p.uniform1f(l.fogDensity,b.density),p.uniform1i(l.fogType,2),y=2,x=2)):(p.uniform1i(l.fogType,0),y=0,x=0);for(var _=0,M=t.length;M>_;_++){var w=t[_];w.modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}t.sort(o);for(var S=[],_=0,M=t.length;M>_;_++){var w=t[_],E=w.material;p.uniform1f(l.alphaTest,E.alphaTest),p.uniformMatrix4fv(l.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(f,m,v),S[0]=v.x,S[1]=v.y;var T=0;n.fog&&E.fog&&(T=x),y!==T&&(p.uniform1i(l.fogType,T),y=T),null!==E.map?(p.uniform2f(l.uvOffset,E.map.offset.x,E.map.offset.y),p.uniform2f(l.uvScale,E.map.repeat.x,E.map.repeat.y)):(p.uniform2f(l.uvOffset,0,0),p.uniform2f(l.uvScale,1,1)),p.uniform1f(l.opacity,E.opacity),p.uniform3f(l.color,E.color.r,E.color.g,E.color.b),p.uniform1f(l.rotation,E.rotation),p.uniform2fv(l.scale,S),d.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),d.setDepthTest(E.depthTest),d.setDepthWrite(E.depthWrite),E.map&&E.map.image&&E.map.image.width?e.setTexture(E.map,0):e.setTexture(u,0),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0)}d.enable(p.CULL_FACE),e.resetGLState()}}},Object.defineProperties(i.Box2.prototype,{empty:{value:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}}}),Object.defineProperties(i.Box3.prototype,{empty:{value:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}},isIntersectionSphere:{value:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}}),Object.defineProperties(i.Matrix3.prototype,{multiplyVector3:{value:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)}},multiplyVector3Array:{value:function(e){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)}}}),Object.defineProperties(i.Matrix4.prototype,{extractPosition:{value:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)}},setRotationFromQuaternion:{value:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)}},multiplyVector3:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),e.applyProjection(this)}},multiplyVector4:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)}},multiplyVector3Array:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)}},rotateAxis:{value:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)}},crossVector:{value:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)}},translate:{value:function(e){console.error("THREE.Matrix4: .translate() has been removed.")}},rotateX:{value:function(e){console.error("THREE.Matrix4: .rotateX() has been removed.")}},rotateY:{value:function(e){console.error("THREE.Matrix4: .rotateY() has been removed.")}},rotateZ:{value:function(e){console.error("THREE.Matrix4: .rotateZ() has been removed.")}},rotateByAxis:{value:function(e,t){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}}}),Object.defineProperties(i.Plane.prototype,{isIntersectionLine:{value:function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)}}}),Object.defineProperties(i.Quaternion.prototype,{multiplyVector3:{value:function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)}}}),Object.defineProperties(i.Ray.prototype,{isIntersectionBox:{value:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}},isIntersectionPlane:{value:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)}},isIntersectionSphere:{value:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}}),Object.defineProperties(i.Vector3.prototype,{setEulerFromRotationMatrix:{value:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")}},setEulerFromQuaternion:{value:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")}},getPositionFromMatrix:{value:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)}},getScaleFromMatrix:{value:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)}},getColumnFromMatrix:{value:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)}}}),i.Face4=function(e,t,r,n,o,a,s){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new i.Face3(e,t,r,o,a,s)},i.Vertex=function(e,t,r){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new i.Vector3(e,t,r)},Object.defineProperties(i.Object3D.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},getChildByName:{value:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)}},renderDepth:{set:function(e){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")}},translate:{value:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(e){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(i,{PointCloud:{value:function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new i.Points(e,t)}},ParticleSystem:{value:function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new i.Points(e,t)}}}),Object.defineProperties(i.Light.prototype,{onlyShadow:{set:function(e){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(e){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(e){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(i.BufferAttribute.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length}}}),Object.defineProperties(i.BufferGeometry.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}},addIndex:{value:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)}},addDrawCall:{value:function(e,t,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)}},clearDrawCalls:{value:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()}},computeTangents:{value:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")}},computeOffsets:{value:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}}),Object.defineProperties(i.Material.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(e){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new i.Color}}}),Object.defineProperties(i,{PointCloudMaterial:{value:function(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new i.PointsMaterial(e)}},ParticleBasicMaterial:{value:function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new i.PointsMaterial(e)}},ParticleSystemMaterial:{value:function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new i.PointsMaterial(e)}}}),Object.defineProperties(i.MeshPhongMaterial.prototype,{
  metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(e){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(i.ShaderMaterial.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.defineProperties(i.WebGLRenderer.prototype,{supportsFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")}},supportsHalfFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")}},supportsStandardDerivatives:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")}},supportsCompressedTextureS3TC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")}},supportsCompressedTexturePVRTC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")}},supportsBlendMinMax:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")}},supportsVertexTextures:{value:function(){return this.capabilities.vertexTextures}},supportsInstancedArrays:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")}},enableScissorTest:{value:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)}},initMaterial:{value:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")}},addPrePlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")}},addPostPlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")}},updateShadowMap:{value:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}},shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=e}}}),Object.defineProperties(i.WebGLRenderTarget.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),i.GeometryUtils={merge:function(e,t,r){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var n;t instanceof i.Mesh&&(t.matrixAutoUpdate&&t.updateMatrix(),n=t.matrix,t=t.geometry),e.merge(t,n,r)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},i.ImageUtils={crossOrigin:void 0,loadTexture:function(e,t,r,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var o=new i.TextureLoader;o.setCrossOrigin(this.crossOrigin);var a=o.load(e,r,void 0,n);return t&&(a.mapping=t),a},loadTextureCube:function(e,t,r,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var o=new i.CubeTextureLoader;o.setCrossOrigin(this.crossOrigin);var a=o.load(e,r,void 0,n);return t&&(a.mapping=t),a},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}},i.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){console.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(e,t){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},i.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},i.MeshFaceMaterial=i.MultiMaterial,i.CurveUtils={tangentQuadraticBezier:function(e,t,r,i){return 2*(1-e)*(r-t)+2*e*(i-r)},tangentCubicBezier:function(e,t,r,i,n){return-3*t*(1-e)*(1-e)+3*r*(1-e)*(1-e)-6*e*r*(1-e)+6*e*i*(1-e)-3*e*e*i+3*e*e*n},tangentSpline:function(e,t,r,i,n){var o=6*e*e-6*e,a=3*e*e-4*e+1,s=-6*e*e+6*e,c=3*e*e-2*e;return o+a+s+c},interpolate:function(e,t,r,i,n){var o=.5*(r-e),a=.5*(i-t),s=n*n,c=n*s;return(2*t-2*r+o+a)*c+(-3*t+3*r-2*o-a)*s+o*n+t}},i.SceneUtils={createMultiMaterialObject:function(e,t){for(var r=new i.Group,n=0,o=t.length;o>n;n++)r.add(new i.Mesh(e,t[n]));return r},detach:function(e,t,r){e.applyMatrix(t.matrixWorld),t.remove(e),r.add(e)},attach:function(e,t,r){var n=new i.Matrix4;n.getInverse(r.matrixWorld),e.applyMatrix(n),t.remove(e),r.add(e)}},i.ShapeUtils={area:function(e){for(var t=e.length,r=0,i=t-1,n=0;t>n;i=n++)r+=e[i].x*e[n].y-e[n].x*e[i].y;return.5*r},triangulate:function(){function e(e,t,r,i,n,o){var a,s,c,h,l,u,p,d,f;if(s=e[o[t]].x,c=e[o[t]].y,h=e[o[r]].x,l=e[o[r]].y,u=e[o[i]].x,p=e[o[i]].y,Number.EPSILON>(h-s)*(p-c)-(l-c)*(u-s))return!1;var m,v,g,y,x,b,_,M,w,S,E,T,A,L,C;for(m=u-h,v=p-l,g=s-u,y=c-p,x=h-s,b=l-c,a=0;n>a;a++)if(d=e[o[a]].x,f=e[o[a]].y,!(d===s&&f===c||d===h&&f===l||d===u&&f===p)&&(_=d-s,M=f-c,w=d-h,S=f-l,E=d-u,T=f-p,C=m*S-v*w,A=x*M-b*_,L=g*T-y*E,C>=-Number.EPSILON&&L>=-Number.EPSILON&&A>=-Number.EPSILON))return!1;return!0}return function(t,r){var n=t.length;if(3>n)return null;var o,a,s,c=[],h=[],l=[];if(i.ShapeUtils.area(t)>0)for(a=0;n>a;a++)h[a]=a;else for(a=0;n>a;a++)h[a]=n-1-a;var u=n,p=2*u;for(a=u-1;u>2;){if(p--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),r?l:c;if(o=a,o>=u&&(o=0),a=o+1,a>=u&&(a=0),s=a+1,s>=u&&(s=0),e(t,o,a,s,u,h)){var d,f,m,v,g;for(d=h[o],f=h[a],m=h[s],c.push([t[d],t[f],t[m]]),l.push([h[o],h[a],h[s]]),v=a,g=a+1;u>g;v++,g++)h[v]=h[g];u--,p=2*u}}return r?l:c}}(),triangulateShape:function(e,t){function r(e,t,r){return e.x!==t.x?e.x<t.x?e.x<=r.x&&r.x<=t.x:t.x<=r.x&&r.x<=e.x:e.y<t.y?e.y<=r.y&&r.y<=t.y:t.y<=r.y&&r.y<=e.y}function n(e,t,i,n,o){var a=t.x-e.x,s=t.y-e.y,c=n.x-i.x,h=n.y-i.y,l=e.x-i.x,u=e.y-i.y,p=s*c-a*h,d=s*l-a*u;if(Math.abs(p)>Number.EPSILON){var f;if(p>0){if(0>d||d>p)return[];if(f=h*l-c*u,0>f||f>p)return[]}else{if(d>0||p>d)return[];if(f=h*l-c*u,f>0||p>f)return[]}if(0===f)return!o||0!==d&&d!==p?[e]:[];if(f===p)return!o||0!==d&&d!==p?[t]:[];if(0===d)return[i];if(d===p)return[n];var m=f/p;return[{x:e.x+m*a,y:e.y+m*s}]}if(0!==d||h*l!==c*u)return[];var v=0===a&&0===s,g=0===c&&0===h;if(v&&g)return e.x!==i.x||e.y!==i.y?[]:[e];if(v)return r(i,n,e)?[e]:[];if(g)return r(e,t,i)?[i]:[];var y,x,b,_,M,w,S,E;return 0!==a?(e.x<t.x?(y=e,b=e.x,x=t,_=t.x):(y=t,b=t.x,x=e,_=e.x),i.x<n.x?(M=i,S=i.x,w=n,E=n.x):(M=n,S=n.x,w=i,E=i.x)):(e.y<t.y?(y=e,b=e.y,x=t,_=t.y):(y=t,b=t.y,x=e,_=e.y),i.y<n.y?(M=i,S=i.y,w=n,E=n.y):(M=n,S=n.y,w=i,E=i.y)),S>=b?S>_?[]:_===S?o?[]:[M]:E>=_?[M,x]:[M,w]:b>E?[]:b===E?o?[]:[y]:E>=_?[y,x]:[y,w]}function o(e,t,r,i){var n=t.x-e.x,o=t.y-e.y,a=r.x-e.x,s=r.y-e.y,c=i.x-e.x,h=i.y-e.y,l=n*s-o*a,u=n*h-o*c;if(Math.abs(l)>Number.EPSILON){var p=c*s-h*a;return l>0?u>=0&&p>=0:u>=0||p>=0}return u>0}function a(e,t){function r(e,t){var r=y.length-1,i=e-1;0>i&&(i=r);var n=e+1;n>r&&(n=0);var a=o(y[e],y[i],y[n],s[t]);if(!a)return!1;var c=s.length-1,h=t-1;0>h&&(h=c);var l=t+1;return l>c&&(l=0),a=o(s[t],s[h],s[l],y[e]),a?!0:!1}function i(e,t){var r,i,o;for(r=0;r<y.length;r++)if(i=r+1,i%=y.length,o=n(e,t,y[r],y[i],!0),o.length>0)return!0;return!1}function a(e,r){var i,o,a,s,c;for(i=0;i<x.length;i++)for(o=t[x[i]],a=0;a<o.length;a++)if(s=a+1,s%=o.length,c=n(e,r,o[a],o[s],!0),c.length>0)return!0;return!1}for(var s,c,h,l,u,p,d,f,m,v,g,y=e.concat(),x=[],b=[],_=0,M=t.length;M>_;_++)x.push(_);for(var w=0,S=2*x.length;x.length>0;){if(S--,0>S){console.log("Infinite Loop! Holes left:"+x.length+", Probably Hole outside Shape!");break}for(h=w;h<y.length;h++){l=y[h],c=-1;for(var _=0;_<x.length;_++)if(p=x[_],d=l.x+":"+l.y+":"+p,void 0===b[d]){s=t[p];for(var E=0;E<s.length;E++)if(u=s[E],r(h,E)&&!i(l,u)&&!a(l,u)){c=E,x.splice(_,1),f=y.slice(0,h+1),m=y.slice(h),v=s.slice(c),g=s.slice(0,c+1),y=f.concat(v).concat(g).concat(m),w=h;break}if(c>=0)break;b[d]=!0}if(c>=0)break}}return y}for(var s,c,h,l,u,p,d={},f=e.concat(),m=0,v=t.length;v>m;m++)Array.prototype.push.apply(f,t[m]);for(s=0,c=f.length;c>s;s++)u=f[s].x+":"+f[s].y,void 0!==d[u]&&console.warn("THREE.Shape: Duplicate point",u),d[u]=s;var g=a(e,t),y=i.ShapeUtils.triangulate(g,!1);for(s=0,c=y.length;c>s;s++)for(l=y[s],h=0;3>h;h++)u=l[h].x+":"+l[h].y,p=d[u],void 0!==p&&(l[h]=p);return y.concat()},isClockWise:function(e){return i.ShapeUtils.area(e)<0},b2:function(){function e(e,t){var r=1-e;return r*r*t}function t(e,t){return 2*(1-e)*e*t}function r(e,t){return e*e*t}return function(i,n,o,a){return e(i,n)+t(i,o)+r(i,a)}}(),b3:function(){function e(e,t){var r=1-e;return r*r*r*t}function t(e,t){var r=1-e;return 3*r*r*e*t}function r(e,t){var r=1-e;return 3*r*e*e*t}function i(e,t){return e*e*e*t}return function(n,o,a,s,c){return e(n,o)+t(n,a)+r(n,s)+i(n,c)}}()},i.Curve=function(){},i.Curve.prototype={constructor:i.Curve,getPoint:function(e){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(e){var t=this.getUtoTmapping(e);return this.getPoint(t)},getPoints:function(e){e||(e=5);var t,r=[];for(t=0;e>=t;t++)r.push(this.getPoint(t/e));return r},getSpacedPoints:function(e){e||(e=5);var t,r=[];for(t=0;e>=t;t++)r.push(this.getPointAt(t/e));return r},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,r,i=[],n=this.getPoint(0),o=0;for(i.push(0),r=1;e>=r;r++)t=this.getPoint(r/e),o+=t.distanceTo(n),i.push(o),n=t;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var r,i=this.getLengths(),n=0,o=i.length;r=t?t:e*i[o-1];for(var a,s=0,c=o-1;c>=s;)if(n=Math.floor(s+(c-s)/2),a=i[n]-r,0>a)s=n+1;else{if(!(a>0)){c=n;break}c=n-1}if(n=c,i[n]===r){var h=n/(o-1);return h}var l=i[n],u=i[n+1],p=u-l,d=(r-l)/p,h=(n+d)/(o-1);return h},getTangent:function(e){var t=1e-4,r=e-t,i=e+t;0>r&&(r=0),i>1&&(i=1);var n=this.getPoint(r),o=this.getPoint(i),a=o.clone().sub(n);return a.normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)}},i.Curve.create=function(e,t){return e.prototype=Object.create(i.Curve.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},i.CurvePath=function(){this.curves=[],this.autoClose=!1},i.CurvePath.prototype=Object.create(i.Curve.prototype),i.CurvePath.prototype.constructor=i.CurvePath,i.CurvePath.prototype.add=function(e){this.curves.push(e)},i.CurvePath.prototype.closePath=function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new i.LineCurve(t,e))},i.CurvePath.prototype.getPoint=function(e){for(var t=e*this.getLength(),r=this.getCurveLengths(),i=0;i<r.length;){if(r[i]>=t){var n=r[i]-t,o=this.curves[i],a=1-n/o.getLength();return o.getPointAt(a)}i++}return null},i.CurvePath.prototype.getLength=function(){var e=this.getCurveLengths();return e[e.length-1]},i.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,r=0,i=this.curves.length;i>r;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e},i.CurvePath.prototype.createPointsGeometry=function(e){var t=this.getPoints(e);return this.createGeometry(t)},i.CurvePath.prototype.createSpacedPointsGeometry=function(e){var t=this.getSpacedPoints(e);return this.createGeometry(t)},i.CurvePath.prototype.createGeometry=function(e){for(var t=new i.Geometry,r=0,n=e.length;n>r;r++){var o=e[r];t.vertices.push(new i.Vector3(o.x,o.y,o.z||0))}return t},i.Font=function(e){this.data=e},i.Font.prototype={constructor:i.Font,generateShapes:function(e,t,r){function n(e){for(var r=String(e).split(""),i=t/a.resolution,n=0,s=[],c=0;c<r.length;c++){var h=o(r[c],i,n);n+=h.offset,s.push(h.path)}return s}function o(e,t,n){var o=a.glyphs[e]||a.glyphs["?"];if(o){var s,c,h,l,u,p,d,f,m,v,g,y=new i.Path,x=[],b=i.ShapeUtils.b2,_=i.ShapeUtils.b3;if(o.o)for(var M=o._cachedOutline||(o._cachedOutline=o.o.split(" ")),w=0,S=M.length;S>w;){var E=M[w++];switch(E){case"m":s=M[w++]*t+n,c=M[w++]*t,y.moveTo(s,c);break;case"l":s=M[w++]*t+n,c=M[w++]*t,y.lineTo(s,c);break;case"q":if(h=M[w++]*t+n,l=M[w++]*t,d=M[w++]*t+n,f=M[w++]*t,y.quadraticCurveTo(d,f,h,l),g=x[x.length-1]){u=g.x,p=g.y;for(var T=1;r>=T;T++){var A=T/r;b(A,u,d,h),b(A,p,f,l)}}break;case"b":if(h=M[w++]*t+n,l=M[w++]*t,d=M[w++]*t+n,f=M[w++]*t,m=M[w++]*t+n,v=M[w++]*t,y.bezierCurveTo(d,f,m,v,h,l),g=x[x.length-1]){u=g.x,p=g.y;for(var T=1;r>=T;T++){var A=T/r;_(A,u,d,m,h),_(A,p,f,v,l)}}}}return{offset:o.ha*t,path:y}}}void 0===t&&(t=100),void 0===r&&(r=4);for(var a=this.data,s=n(e),c=[],h=0,l=s.length;l>h;h++)Array.prototype.push.apply(c,s[h].toShapes());return c}},i.Path=function(e){i.CurvePath.call(this),this.actions=[],e&&this.fromPoints(e)},i.Path.prototype=Object.create(i.CurvePath.prototype),i.Path.prototype.constructor=i.Path,i.Path.prototype.fromPoints=function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,r=e.length;r>t;t++)this.lineTo(e[t].x,e[t].y)},i.Path.prototype.moveTo=function(e,t){this.actions.push({action:"moveTo",args:[e,t]})},i.Path.prototype.lineTo=function(e,t){var r=this.actions[this.actions.length-1].args,n=r[r.length-2],o=r[r.length-1],a=new i.LineCurve(new i.Vector2(n,o),new i.Vector2(e,t));this.curves.push(a),this.actions.push({action:"lineTo",args:[e,t]})},i.Path.prototype.quadraticCurveTo=function(e,t,r,n){var o=this.actions[this.actions.length-1].args,a=o[o.length-2],s=o[o.length-1],c=new i.QuadraticBezierCurve(new i.Vector2(a,s),new i.Vector2(e,t),new i.Vector2(r,n));this.curves.push(c),this.actions.push({action:"quadraticCurveTo",args:[e,t,r,n]})},i.Path.prototype.bezierCurveTo=function(e,t,r,n,o,a){var s=this.actions[this.actions.length-1].args,c=s[s.length-2],h=s[s.length-1],l=new i.CubicBezierCurve(new i.Vector2(c,h),new i.Vector2(e,t),new i.Vector2(r,n),new i.Vector2(o,a));this.curves.push(l),this.actions.push({action:"bezierCurveTo",args:[e,t,r,n,o,a]})},i.Path.prototype.splineThru=function(e){var t=Array.prototype.slice.call(arguments),r=this.actions[this.actions.length-1].args,n=r[r.length-2],o=r[r.length-1],a=[new i.Vector2(n,o)];Array.prototype.push.apply(a,e);var s=new i.SplineCurve(a);this.curves.push(s),this.actions.push({action:"splineThru",args:t})},i.Path.prototype.arc=function(e,t,r,i,n,o){var a=this.actions[this.actions.length-1].args,s=a[a.length-2],c=a[a.length-1];this.absarc(e+s,t+c,r,i,n,o)},i.Path.prototype.absarc=function(e,t,r,i,n,o){this.absellipse(e,t,r,r,i,n,o)},i.Path.prototype.ellipse=function(e,t,r,i,n,o,a,s){var c=this.actions[this.actions.length-1].args,h=c[c.length-2],l=c[c.length-1];this.absellipse(e+h,t+l,r,i,n,o,a,s)},i.Path.prototype.absellipse=function(e,t,r,n,o,a,s,c){var h=[e,t,r,n,o,a,s,c||0],l=new i.EllipseCurve(e,t,r,n,o,a,s,c);this.curves.push(l);var u=l.getPoint(1);h.push(u.x),h.push(u.y),this.actions.push({action:"ellipse",args:h})},i.Path.prototype.getSpacedPoints=function(e){e||(e=40);for(var t=[],r=0;e>r;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t},i.Path.prototype.getPoints=function(e){e=e||12;for(var t,r,n,o,a,s,c,h,l,u,p,d=i.ShapeUtils.b2,f=i.ShapeUtils.b3,m=[],v=0,g=this.actions.length;g>v;v++){var y=this.actions[v],x=y.action,b=y.args;switch(x){case"moveTo":m.push(new i.Vector2(b[0],b[1]));break;case"lineTo":m.push(new i.Vector2(b[0],b[1]));break;case"quadraticCurveTo":t=b[2],r=b[3],a=b[0],s=b[1],m.length>0?(l=m[m.length-1],c=l.x,h=l.y):(l=this.actions[v-1].args,c=l[l.length-2],h=l[l.length-1]);for(var _=1;e>=_;_++){var M=_/e;u=d(M,c,a,t),p=d(M,h,s,r),m.push(new i.Vector2(u,p))}break;case"bezierCurveTo":t=b[4],r=b[5],a=b[0],s=b[1],n=b[2],o=b[3],m.length>0?(l=m[m.length-1],c=l.x,h=l.y):(l=this.actions[v-1].args,c=l[l.length-2],h=l[l.length-1]);for(var _=1;e>=_;_++){var M=_/e;u=f(M,c,a,n,t),p=f(M,h,s,o,r),m.push(new i.Vector2(u,p))}break;case"splineThru":l=this.actions[v-1].args;var w=new i.Vector2(l[l.length-2],l[l.length-1]),S=[w],E=e*b[0].length;S=S.concat(b[0]);for(var T=new i.SplineCurve(S),_=1;E>=_;_++)m.push(T.getPointAt(_/E));break;case"arc":for(var A,L=b[0],C=b[1],R=b[2],P=b[3],I=b[4],B=!!b[5],D=I-P,U=2*e,_=1;U>=_;_++){var M=_/U;B||(M=1-M),A=P+M*D,u=L+R*Math.cos(A),p=C+R*Math.sin(A),m.push(new i.Vector2(u,p))}break;case"ellipse":var A,F,N,L=b[0],C=b[1],O=b[2],V=b[3],P=b[4],I=b[5],B=!!b[6],G=b[7],D=I-P,U=2*e;0!==G&&(F=Math.cos(G),N=Math.sin(G));for(var _=1;U>=_;_++){var M=_/U;if(B||(M=1-M),A=P+M*D,u=L+O*Math.cos(A),p=C+V*Math.sin(A),0!==G){var z=u,k=p;u=(z-L)*F-(k-C)*N+L,p=(z-L)*N+(k-C)*F+C}m.push(new i.Vector2(u,p))}}}var H=m[m.length-1];return Math.abs(H.x-m[0].x)<Number.EPSILON&&Math.abs(H.y-m[0].y)<Number.EPSILON&&m.splice(m.length-1,1),this.autoClose&&m.push(m[0]),m},i.Path.prototype.toShapes=function(e,t){function r(e){for(var t=[],r=new i.Path,n=0,o=e.length;o>n;n++){var a=e[n],s=a.args,c=a.action;"moveTo"===c&&0!==r.actions.length&&(t.push(r),r=new i.Path),r[c].apply(r,s)}return 0!==r.actions.length&&t.push(r),t}function n(e){for(var t=[],r=0,n=e.length;n>r;r++){var o=e[r],a=new i.Shape;a.actions=o.actions,a.curves=o.curves,t.push(a)}return t}function o(e,t){for(var r=t.length,i=!1,n=r-1,o=0;r>o;n=o++){var a=t[n],s=t[o],c=s.x-a.x,h=s.y-a.y;if(Math.abs(h)>Number.EPSILON){if(0>h&&(a=t[o],c=-c,s=t[n],h=-h),e.y<a.y||e.y>s.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var l=h*(e.x-a.x)-c*(e.y-a.y);if(0===l)return!0;if(0>l)continue;i=!i}}else{if(e.y!==a.y)continue;if(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x)return!0}}return i}var a=i.ShapeUtils.isClockWise,s=r(this.actions);if(0===s.length)return[];if(t===!0)return n(s);var c,h,l,u=[];if(1===s.length)return h=s[0],l=new i.Shape,l.actions=h.actions,l.curves=h.curves,u.push(l),u;var p=!a(s[0].getPoints());p=e?!p:p;var d,f=[],m=[],v=[],g=0;m[g]=void 0,v[g]=[];for(var y=0,x=s.length;x>y;y++)h=s[y],d=h.getPoints(),c=a(d),c=e?!c:c,c?(!p&&m[g]&&g++,m[g]={s:new i.Shape,p:d},m[g].s.actions=h.actions,m[g].s.curves=h.curves,p&&g++,v[g]=[]):v[g].push({h:h,p:d[0]});if(!m[0])return n(s);if(m.length>1){for(var b=!1,_=[],M=0,w=m.length;w>M;M++)f[M]=[];for(var M=0,w=m.length;w>M;M++)for(var S=v[M],E=0;E<S.length;E++){for(var T=S[E],A=!0,L=0;L<m.length;L++)o(T.p,m[L].p)&&(M!==L&&_.push({froms:M,tos:L,hole:E}),A?(A=!1,f[L].push(T)):b=!0);A&&f[M].push(T)}_.length>0&&(b||(v=f))}for(var C,y=0,R=m.length;R>y;y++){l=m[y].s,u.push(l),C=v[y];for(var P=0,I=C.length;I>P;P++)l.holes.push(C[P].h)}return u},i.Shape=function(){i.Path.apply(this,arguments),this.holes=[]},i.Shape.prototype=Object.create(i.Path.prototype),i.Shape.prototype.constructor=i.Shape,i.Shape.prototype.extrude=function(e){return new i.ExtrudeGeometry(this,e)},i.Shape.prototype.makeGeometry=function(e){return new i.ShapeGeometry(this,e)},i.Shape.prototype.getPointsHoles=function(e){for(var t=[],r=0,i=this.holes.length;i>r;r++)t[r]=this.holes[r].getPoints(e);return t},i.Shape.prototype.extractAllPoints=function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},i.Shape.prototype.extractPoints=function(e){return this.extractAllPoints(e)},i.LineCurve=function(e,t){this.v1=e,this.v2=t},i.LineCurve.prototype=Object.create(i.Curve.prototype),i.LineCurve.prototype.constructor=i.LineCurve,i.LineCurve.prototype.getPoint=function(e){var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},i.LineCurve.prototype.getPointAt=function(e){return this.getPoint(e)},i.LineCurve.prototype.getTangent=function(e){var t=this.v2.clone().sub(this.v1);return t.normalize()},i.QuadraticBezierCurve=function(e,t,r){this.v0=e,this.v1=t,this.v2=r},i.QuadraticBezierCurve.prototype=Object.create(i.Curve.prototype),i.QuadraticBezierCurve.prototype.constructor=i.QuadraticBezierCurve,i.QuadraticBezierCurve.prototype.getPoint=function(e){var t=i.ShapeUtils.b2;return new i.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y))},i.QuadraticBezierCurve.prototype.getTangent=function(e){var t=i.CurveUtils.tangentQuadraticBezier;return new i.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y)).normalize()},i.CubicBezierCurve=function(e,t,r,i){this.v0=e,this.v1=t,this.v2=r,this.v3=i},i.CubicBezierCurve.prototype=Object.create(i.Curve.prototype),i.CubicBezierCurve.prototype.constructor=i.CubicBezierCurve,i.CubicBezierCurve.prototype.getPoint=function(e){var t=i.ShapeUtils.b3;return new i.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},i.CubicBezierCurve.prototype.getTangent=function(e){var t=i.CurveUtils.tangentCubicBezier;return new i.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},i.SplineCurve=function(e){this.points=void 0==e?[]:e},i.SplineCurve.prototype=Object.create(i.Curve.prototype),i.SplineCurve.prototype.constructor=i.SplineCurve,i.SplineCurve.prototype.getPoint=function(e){var t=this.points,r=(t.length-1)*e,n=Math.floor(r),o=r-n,a=t[0===n?n:n-1],s=t[n],c=t[n>t.length-2?t.length-1:n+1],h=t[n>t.length-3?t.length-1:n+2],l=i.CurveUtils.interpolate;return new i.Vector2(l(a.x,s.x,c.x,h.x,o),l(a.y,s.y,c.y,h.y,o))},i.EllipseCurve=function(e,t,r,i,n,o,a,s){this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0},i.EllipseCurve.prototype=Object.create(i.Curve.prototype),i.EllipseCurve.prototype.constructor=i.EllipseCurve,i.EllipseCurve.prototype.getPoint=function(e){var t=this.aEndAngle-this.aStartAngle;0>t&&(t+=2*Math.PI),t>2*Math.PI&&(t-=2*Math.PI);var r;r=this.aClockwise===!0?this.aEndAngle+(1-e)*(2*Math.PI-t):this.aStartAngle+e*t;var n=this.aX+this.xRadius*Math.cos(r),o=this.aY+this.yRadius*Math.sin(r);if(0!==this.aRotation){var a=Math.cos(this.aRotation),s=Math.sin(this.aRotation),c=n,h=o;n=(c-this.aX)*a-(h-this.aY)*s+this.aX,o=(c-this.aX)*s+(h-this.aY)*a+this.aY}return new i.Vector2(n,o)},i.ArcCurve=function(e,t,r,n,o,a){i.EllipseCurve.call(this,e,t,r,r,n,o,a)},i.ArcCurve.prototype=Object.create(i.EllipseCurve.prototype),i.ArcCurve.prototype.constructor=i.ArcCurve,i.LineCurve3=i.Curve.create(function(e,t){this.v1=e,this.v2=t},function(e){var t=new i.Vector3;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t}),i.QuadraticBezierCurve3=i.Curve.create(function(e,t,r){this.v0=e,this.v1=t,this.v2=r},function(e){var t=i.ShapeUtils.b2;return new i.Vector3(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y),t(e,this.v0.z,this.v1.z,this.v2.z))}),i.CubicBezierCurve3=i.Curve.create(function(e,t,r,i){this.v0=e,this.v1=t,this.v2=r,this.v3=i},function(e){var t=i.ShapeUtils.b3;return new i.Vector3(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),t(e,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),i.SplineCurve3=i.Curve.create(function(e){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0==e?[]:e},function(e){var t=this.points,r=(t.length-1)*e,n=Math.floor(r),o=r-n,a=t[0==n?n:n-1],s=t[n],c=t[n>t.length-2?t.length-1:n+1],h=t[n>t.length-3?t.length-1:n+2],l=i.CurveUtils.interpolate;return new i.Vector3(l(a.x,s.x,c.x,h.x,o),l(a.y,s.y,c.y,h.y,o),l(a.z,s.z,c.z,h.z,o))}),i.CatmullRomCurve3=function(){function e(){}var t=new i.Vector3,r=new e,n=new e,o=new e;return e.prototype.init=function(e,t,r,i){this.c0=e,this.c1=r,this.c2=-3*e+3*t-2*r-i,this.c3=2*e-2*t+r+i},e.prototype.initNonuniformCatmullRom=function(e,t,r,i,n,o,a){var s=(t-e)/n-(r-e)/(n+o)+(r-t)/o,c=(r-t)/o-(i-t)/(o+a)+(i-r)/a;s*=o,c*=o,this.init(t,r,s,c)},e.prototype.initCatmullRom=function(e,t,r,i,n){this.init(t,r,n*(r-e),n*(i-t))},e.prototype.calc=function(e){var t=e*e,r=t*e;return this.c0+this.c1*e+this.c2*t+this.c3*r},i.Curve.create(function(e){this.points=e||[],this.closed=!1},function(e){var a,s,c,h,l=this.points;h=l.length,2>h&&console.log("duh, you need at least 2 points"),a=(h-(this.closed?0:1))*e,s=Math.floor(a),c=a-s,this.closed?s+=s>0?0:(Math.floor(Math.abs(s)/l.length)+1)*l.length:0===c&&s===h-1&&(s=h-2,c=1);var u,p,d,f;if(this.closed||s>0?u=l[(s-1)%h]:(t.subVectors(l[0],l[1]).add(l[0]),u=t),p=l[s%h],d=l[(s+1)%h],this.closed||h>s+2?f=l[(s+2)%h]:(t.subVectors(l[h-1],l[h-2]).add(l[h-1]),f=t),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var m="chordal"===this.type?.5:.25,v=Math.pow(u.distanceToSquared(p),m),g=Math.pow(p.distanceToSquared(d),m),y=Math.pow(d.distanceToSquared(f),m);1e-4>g&&(g=1),1e-4>v&&(v=g),1e-4>y&&(y=g),r.initNonuniformCatmullRom(u.x,p.x,d.x,f.x,v,g,y),n.initNonuniformCatmullRom(u.y,p.y,d.y,f.y,v,g,y),o.initNonuniformCatmullRom(u.z,p.z,d.z,f.z,v,g,y)}else if("catmullrom"===this.type){var x=void 0!==this.tension?this.tension:.5;r.initCatmullRom(u.x,p.x,d.x,f.x,x),n.initCatmullRom(u.y,p.y,d.y,f.y,x),o.initCatmullRom(u.z,p.z,d.z,f.z,x)}var b=new i.Vector3(r.calc(c),n.calc(c),o.calc(c));return b})}(),i.ClosedSplineCurve3=function(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."),i.CatmullRomCurve3.call(this,e),this.type="catmullrom",this.closed=!0},i.ClosedSplineCurve3.prototype=Object.create(i.CatmullRomCurve3.prototype),i.BoxGeometry=function(e,t,r,n,o,a){i.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:o,depthSegments:a},this.fromBufferGeometry(new i.BoxBufferGeometry(e,t,r,n,o,a)),this.mergeVertices()},i.BoxGeometry.prototype=Object.create(i.Geometry.prototype),i.BoxGeometry.prototype.constructor=i.BoxGeometry,i.CubeGeometry=i.BoxGeometry,i.BoxBufferGeometry=function(e,t,r,n,o,a){function s(e,t,r){var i=0;return i+=e*t*2,i+=e*r*2,i+=r*t*2,4*i}function c(e,t,r,n,o,a,s,c,l,u,_){for(var M=a/l,w=s/u,S=a/2,E=s/2,T=c/2,A=l+1,L=u+1,C=0,R=0,P=new i.Vector3,I=0;L>I;I++)for(var B=I*w-E,D=0;A>D;D++){var U=D*M-S;P[e]=U*n,P[t]=B*o,P[r]=T,d[v]=P.x,d[v+1]=P.y,d[v+2]=P.z,P[e]=0,P[t]=0,P[r]=c>0?1:-1,f[v]=P.x,f[v+1]=P.y,f[v+2]=P.z,m[g]=D/l,m[g+1]=1-I/u,v+=3,g+=2,C+=1}for(I=0;u>I;I++)for(D=0;l>D;D++){var F=x+D+A*I,N=x+D+A*(I+1),O=x+(D+1)+A*(I+1),V=x+(D+1)+A*I;p[y]=F,p[y+1]=N,p[y+2]=V,p[y+3]=N,p[y+4]=O,p[y+5]=V,y+=6,R+=6}h.addGroup(b,R,_),b+=R,x+=C}i.BufferGeometry.call(this),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:o,depthSegments:a};var h=this;n=Math.floor(n)||1,o=Math.floor(o)||1,a=Math.floor(a)||1;var l=s(n,o,a),u=l/4*6,p=new(u>65535?Uint32Array:Uint16Array)(u),d=new Float32Array(3*l),f=new Float32Array(3*l),m=new Float32Array(2*l),v=0,g=0,y=0,x=0,b=0;c("z","y","x",-1,-1,r,t,e,a,o,0),c("z","y","x",1,-1,r,t,-e,a,o,1),c("x","z","y",1,1,e,r,t,n,a,2),c("x","z","y",1,-1,e,r,-t,n,a,3),c("x","y","z",1,-1,e,t,r,n,o,4),c("x","y","z",-1,-1,e,t,-r,n,o,5),this.setIndex(new i.BufferAttribute(p,1)),this.addAttribute("position",new i.BufferAttribute(d,3)),this.addAttribute("normal",new i.BufferAttribute(f,3)),this.addAttribute("uv",new i.BufferAttribute(m,2))},i.BoxBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.BoxBufferGeometry.prototype.constructor=i.BoxBufferGeometry,i.CircleGeometry=function(e,t,r,n){i.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:n},this.fromBufferGeometry(new i.CircleBufferGeometry(e,t,r,n))},i.CircleGeometry.prototype=Object.create(i.Geometry.prototype),i.CircleGeometry.prototype.constructor=i.CircleGeometry,i.CircleBufferGeometry=function(e,t,r,n){i.BufferGeometry.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:n},e=e||50,t=void 0!==t?Math.max(3,t):8,r=void 0!==r?r:0,
  n=void 0!==n?n:2*Math.PI;var o=t+2,a=new Float32Array(3*o),s=new Float32Array(3*o),c=new Float32Array(2*o);s[2]=1,c[0]=.5,c[1]=.5;for(var h=0,l=3,u=2;t>=h;h++,l+=3,u+=2){var p=r+h/t*n;a[l]=e*Math.cos(p),a[l+1]=e*Math.sin(p),s[l+2]=1,c[u]=(a[l]/e+1)/2,c[u+1]=(a[l+1]/e+1)/2}for(var d=[],l=1;t>=l;l++)d.push(l,l+1,0);this.setIndex(new i.BufferAttribute(new Uint16Array(d),1)),this.addAttribute("position",new i.BufferAttribute(a,3)),this.addAttribute("normal",new i.BufferAttribute(s,3)),this.addAttribute("uv",new i.BufferAttribute(c,2)),this.boundingSphere=new i.Sphere(new i.Vector3,e)},i.CircleBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.CircleBufferGeometry.prototype.constructor=i.CircleBufferGeometry,i.CylinderBufferGeometry=function(e,t,r,n,o,a,s,c){function h(){var e=(n+1)*(o+1);return a===!1&&(e+=2*(n+1)+2*n),e}function l(){var e=n*o*2*3;return a===!1&&(e+=2*n*3),e}function u(){var a,h,l=new i.Vector3,u=new i.Vector3,p=(t-e)/r;for(h=0;o>=h;h++){var d=[],f=h/o,w=f*(t-e)+e;for(a=0;n>=a;a++){var S=a/n;u.x=w*Math.sin(S*c+s),u.y=-f*r+M,u.z=w*Math.cos(S*c+s),v.setXYZ(x,u.x,u.y,u.z),l.copy(u),(0===e&&0===h||0===t&&h===o)&&(l.x=Math.sin(S*c+s),l.z=Math.cos(S*c+s)),l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*p).normalize(),g.setXYZ(x,l.x,l.y,l.z),y.setXY(x,S,1-f),d.push(x),x++}_.push(d)}for(a=0;n>a;a++)for(h=0;o>h;h++){var E=_[h][a],T=_[h+1][a],A=_[h+1][a+1],L=_[h][a+1];m.setX(b,E),b++,m.setX(b,T),b++,m.setX(b,L),b++,m.setX(b,T),b++,m.setX(b,A),b++,m.setX(b,L),b++}}function p(r){var o,a,h,l=new i.Vector2,u=new i.Vector3,p=r===!0?e:t,d=r===!0?1:-1;for(a=x,o=1;n>=o;o++)v.setXYZ(x,0,M*d,0),g.setXYZ(x,0,d,0),r===!0?(l.x=o/n,l.y=0):(l.x=(o-1)/n,l.y=1),y.setXY(x,l.x,l.y),x++;for(h=x,o=0;n>=o;o++){var f=o/n;u.x=p*Math.sin(f*c+s),u.y=M*d,u.z=p*Math.cos(f*c+s),v.setXYZ(x,u.x,u.y,u.z),g.setXYZ(x,0,d,0),y.setXY(x,f,r===!0?1:0),x++}for(o=0;n>o;o++){var _=a+o,w=h+o;r===!0?(m.setX(b,w),b++,m.setX(b,w+1),b++,m.setX(b,_),b++):(m.setX(b,w+1),b++,m.setX(b,w),b++,m.setX(b,_),b++)}}i.BufferGeometry.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:o,openEnded:a,thetaStart:s,thetaLength:c},e=void 0!==e?e:20,t=void 0!==t?t:20,r=void 0!==r?r:100,n=Math.floor(n)||8,o=Math.floor(o)||1,a=void 0!==a?a:!1,s=void 0!==s?s:0,c=void 0!==c?c:2*Math.PI;var d=h(),f=l(),m=new i.BufferAttribute(new(f>65535?Uint32Array:Uint16Array)(f),1),v=new i.BufferAttribute(new Float32Array(3*d),3),g=new i.BufferAttribute(new Float32Array(3*d),3),y=new i.BufferAttribute(new Float32Array(2*d),2),x=0,b=0,_=[],M=r/2;u(),a===!1&&(e>0&&p(!0),t>0&&p(!1)),this.setIndex(m),this.addAttribute("position",v),this.addAttribute("normal",g),this.addAttribute("uv",y)},i.CylinderBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.CylinderBufferGeometry.prototype.constructor=i.CylinderBufferGeometry,i.CylinderGeometry=function(e,t,r,n,o,a,s,c){i.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:o,openEnded:a,thetaStart:s,thetaLength:c},this.fromBufferGeometry(new i.CylinderBufferGeometry(e,t,r,n,o,a,s,c)),this.mergeVertices()},i.CylinderGeometry.prototype=Object.create(i.Geometry.prototype),i.CylinderGeometry.prototype.constructor=i.CylinderGeometry,i.EdgesGeometry=function(e,t){function r(e,t){return e-t}i.BufferGeometry.call(this),t=void 0!==t?t:1;var n,o=Math.cos(i.Math.degToRad(t)),a=[0,0],s={},c=["a","b","c"];e instanceof i.BufferGeometry?(n=new i.Geometry,n.fromBufferGeometry(e)):n=e.clone(),n.mergeVertices(),n.computeFaceNormals();for(var h=n.vertices,l=n.faces,u=0,p=l.length;p>u;u++)for(var d=l[u],f=0;3>f;f++){a[0]=d[c[f]],a[1]=d[c[(f+1)%3]],a.sort(r);var m=a.toString();void 0===s[m]?s[m]={vert1:a[0],vert2:a[1],face1:u,face2:void 0}:s[m].face2=u}var v=[];for(var m in s){var g=s[m];if(void 0===g.face2||l[g.face1].normal.dot(l[g.face2].normal)<=o){var y=h[g.vert1];v.push(y.x),v.push(y.y),v.push(y.z),y=h[g.vert2],v.push(y.x),v.push(y.y),v.push(y.z)}}this.addAttribute("position",new i.BufferAttribute(new Float32Array(v),3))},i.EdgesGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.EdgesGeometry.prototype.constructor=i.EdgesGeometry,i.ExtrudeGeometry=function(e,t){return"undefined"==typeof e?void(e=[]):(i.Geometry.call(this),this.type="ExtrudeGeometry",e=Array.isArray(e)?e:[e],this.addShapeList(e,t),void this.computeFaceNormals())},i.ExtrudeGeometry.prototype=Object.create(i.Geometry.prototype),i.ExtrudeGeometry.prototype.constructor=i.ExtrudeGeometry,i.ExtrudeGeometry.prototype.addShapeList=function(e,t){for(var r=e.length,i=0;r>i;i++){var n=e[i];this.addShape(n,t)}},i.ExtrudeGeometry.prototype.addShape=function(e,t){function r(e,t,r){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(r).add(e)}function n(e,t,r){var n,o,a=1,s=e.x-t.x,c=e.y-t.y,h=r.x-e.x,l=r.y-e.y,u=s*s+c*c,p=s*l-c*h;if(Math.abs(p)>Number.EPSILON){var d=Math.sqrt(u),f=Math.sqrt(h*h+l*l),m=t.x-c/d,v=t.y+s/d,g=r.x-l/f,y=r.y+h/f,x=((g-m)*l-(y-v)*h)/(s*l-c*h);n=m+s*x-e.x,o=v+c*x-e.y;var b=n*n+o*o;if(2>=b)return new i.Vector2(n,o);a=Math.sqrt(b/2)}else{var _=!1;s>Number.EPSILON?h>Number.EPSILON&&(_=!0):s<-Number.EPSILON?h<-Number.EPSILON&&(_=!0):Math.sign(c)===Math.sign(l)&&(_=!0),_?(n=-c,o=s,a=Math.sqrt(u)):(n=s,o=c,a=Math.sqrt(u/2))}return new i.Vector2(n/a,o/a)}function o(){if(b){var e=0,t=H*e;for(X=0;j>X;X++)k=U[X],h(k[2]+t,k[1]+t,k[0]+t);for(e=M+2*x,t=H*e,X=0;j>X;X++)k=U[X],h(k[0]+t,k[1]+t,k[2]+t)}else{for(X=0;j>X;X++)k=U[X],h(k[2],k[1],k[0]);for(X=0;j>X;X++)k=U[X],h(k[0]+H*M,k[1]+H*M,k[2]+H*M)}}function a(){var e=0;for(s(F,e),e+=F.length,A=0,L=B.length;L>A;A++)T=B[A],s(T,e),e+=T.length}function s(e,t){var r,i;for(X=e.length;--X>=0;){r=X,i=X-1,0>i&&(i=e.length-1);var n=0,o=M+2*x;for(n=0;o>n;n++){var a=H*n,s=H*(n+1),c=t+r+a,h=t+i+a,u=t+i+s,p=t+r+s;l(c,h,u,p,e,n,o,r,i)}}}function c(e,t,r){C.vertices.push(new i.Vector3(e,t,r))}function h(e,t,r){e+=R,t+=R,r+=R,C.faces.push(new i.Face3(e,t,r,null,null,0));var n=E.generateTopUV(C,e,t,r);C.faceVertexUvs[0].push(n)}function l(e,t,r,n,o,a,s,c,h){e+=R,t+=R,r+=R,n+=R,C.faces.push(new i.Face3(e,t,n,null,null,1)),C.faces.push(new i.Face3(t,r,n,null,null,1));var l=E.generateSideWallUV(C,e,t,r,n);C.faceVertexUvs[0].push([l[0],l[1],l[3]]),C.faceVertexUvs[0].push([l[1],l[2],l[3]])}var u,p,d,f,m,v=void 0!==t.amount?t.amount:100,g=void 0!==t.bevelThickness?t.bevelThickness:6,y=void 0!==t.bevelSize?t.bevelSize:g-2,x=void 0!==t.bevelSegments?t.bevelSegments:3,b=void 0!==t.bevelEnabled?t.bevelEnabled:!0,_=void 0!==t.curveSegments?t.curveSegments:12,M=void 0!==t.steps?t.steps:1,w=t.extrudePath,S=!1,E=void 0!==t.UVGenerator?t.UVGenerator:i.ExtrudeGeometry.WorldUVGenerator;w&&(u=w.getSpacedPoints(M),S=!0,b=!1,p=void 0!==t.frames?t.frames:new i.TubeGeometry.FrenetFrames(w,M,!1),d=new i.Vector3,f=new i.Vector3,m=new i.Vector3),b||(x=0,g=0,y=0);var T,A,L,C=this,R=this.vertices.length,P=e.extractPoints(_),I=P.shape,B=P.holes,D=!i.ShapeUtils.isClockWise(I);if(D){for(I=I.reverse(),A=0,L=B.length;L>A;A++)T=B[A],i.ShapeUtils.isClockWise(T)&&(B[A]=T.reverse());D=!1}var U=i.ShapeUtils.triangulateShape(I,B),F=I;for(A=0,L=B.length;L>A;A++)T=B[A],I=I.concat(T);for(var N,O,V,G,z,k,H=I.length,j=U.length,W=[],X=0,q=F.length,Y=q-1,Z=X+1;q>X;X++,Y++,Z++)Y===q&&(Y=0),Z===q&&(Z=0),W[X]=n(F[X],F[Y],F[Z]);var Q,K=[],J=W.concat();for(A=0,L=B.length;L>A;A++){for(T=B[A],Q=[],X=0,q=T.length,Y=q-1,Z=X+1;q>X;X++,Y++,Z++)Y===q&&(Y=0),Z===q&&(Z=0),Q[X]=n(T[X],T[Y],T[Z]);K.push(Q),J=J.concat(Q)}for(N=0;x>N;N++){for(V=N/x,G=g*(1-V),O=y*Math.sin(V*Math.PI/2),X=0,q=F.length;q>X;X++)z=r(F[X],W[X],O),c(z.x,z.y,-G);for(A=0,L=B.length;L>A;A++)for(T=B[A],Q=K[A],X=0,q=T.length;q>X;X++)z=r(T[X],Q[X],O),c(z.x,z.y,-G)}for(O=y,X=0;H>X;X++)z=b?r(I[X],J[X],O):I[X],S?(f.copy(p.normals[0]).multiplyScalar(z.x),d.copy(p.binormals[0]).multiplyScalar(z.y),m.copy(u[0]).add(f).add(d),c(m.x,m.y,m.z)):c(z.x,z.y,0);var $;for($=1;M>=$;$++)for(X=0;H>X;X++)z=b?r(I[X],J[X],O):I[X],S?(f.copy(p.normals[$]).multiplyScalar(z.x),d.copy(p.binormals[$]).multiplyScalar(z.y),m.copy(u[$]).add(f).add(d),c(m.x,m.y,m.z)):c(z.x,z.y,v/M*$);for(N=x-1;N>=0;N--){for(V=N/x,G=g*(1-V),O=y*Math.sin(V*Math.PI/2),X=0,q=F.length;q>X;X++)z=r(F[X],W[X],O),c(z.x,z.y,v+G);for(A=0,L=B.length;L>A;A++)for(T=B[A],Q=K[A],X=0,q=T.length;q>X;X++)z=r(T[X],Q[X],O),S?c(z.x,z.y+u[M-1].y,u[M-1].x+G):c(z.x,z.y,v+G)}o(),a()},i.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(e,t,r,n){var o=e.vertices,a=o[t],s=o[r],c=o[n];return[new i.Vector2(a.x,a.y),new i.Vector2(s.x,s.y),new i.Vector2(c.x,c.y)]},generateSideWallUV:function(e,t,r,n,o){var a=e.vertices,s=a[t],c=a[r],h=a[n],l=a[o];return Math.abs(s.y-c.y)<.01?[new i.Vector2(s.x,1-s.z),new i.Vector2(c.x,1-c.z),new i.Vector2(h.x,1-h.z),new i.Vector2(l.x,1-l.z)]:[new i.Vector2(s.y,1-s.z),new i.Vector2(c.y,1-c.z),new i.Vector2(h.y,1-h.z),new i.Vector2(l.y,1-l.z)]}},i.ShapeGeometry=function(e,t){i.Geometry.call(this),this.type="ShapeGeometry",Array.isArray(e)===!1&&(e=[e]),this.addShapeList(e,t),this.computeFaceNormals()},i.ShapeGeometry.prototype=Object.create(i.Geometry.prototype),i.ShapeGeometry.prototype.constructor=i.ShapeGeometry,i.ShapeGeometry.prototype.addShapeList=function(e,t){for(var r=0,i=e.length;i>r;r++)this.addShape(e[r],t);return this},i.ShapeGeometry.prototype.addShape=function(e,t){void 0===t&&(t={});var r,n,o,a=void 0!==t.curveSegments?t.curveSegments:12,s=t.material,c=void 0===t.UVGenerator?i.ExtrudeGeometry.WorldUVGenerator:t.UVGenerator,h=this.vertices.length,l=e.extractPoints(a),u=l.shape,p=l.holes,d=!i.ShapeUtils.isClockWise(u);if(d){for(u=u.reverse(),r=0,n=p.length;n>r;r++)o=p[r],i.ShapeUtils.isClockWise(o)&&(p[r]=o.reverse());d=!1}var f=i.ShapeUtils.triangulateShape(u,p);for(r=0,n=p.length;n>r;r++)o=p[r],u=u.concat(o);var m,v,g=u.length,y=f.length;for(r=0;g>r;r++)m=u[r],this.vertices.push(new i.Vector3(m.x,m.y,0));for(r=0;y>r;r++){v=f[r];var x=v[0]+h,b=v[1]+h,_=v[2]+h;this.faces.push(new i.Face3(x,b,_,null,null,s)),this.faceVertexUvs[0].push(c.generateTopUV(this,x,b,_))}},i.LatheBufferGeometry=function(e,t,r,n){i.BufferGeometry.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},t=Math.floor(t)||12,r=r||0,n=n||2*Math.PI,n=i.Math.clamp(n,0,2*Math.PI);var o,a,s,c=(t+1)*e.length,h=t*e.length*2*3,l=new i.BufferAttribute(new(h>65535?Uint32Array:Uint16Array)(h),1),u=new i.BufferAttribute(new Float32Array(3*c),3),p=new i.BufferAttribute(new Float32Array(2*c),2),d=0,f=0,m=(1/(e.length-1),1/t),v=new i.Vector3,g=new i.Vector2;for(a=0;t>=a;a++){var y=r+a*m*n,x=Math.sin(y),b=Math.cos(y);for(s=0;s<=e.length-1;s++)v.x=e[s].x*x,v.y=e[s].y,v.z=e[s].x*b,u.setXYZ(d,v.x,v.y,v.z),g.x=a/t,g.y=s/(e.length-1),p.setXY(d,g.x,g.y),d++}for(a=0;t>a;a++)for(s=0;s<e.length-1;s++){o=s+a*e.length;var _=o,M=o+e.length,w=o+e.length+1,S=o+1;l.setX(f,_),f++,l.setX(f,M),f++,l.setX(f,S),f++,l.setX(f,M),f++,l.setX(f,w),f++,l.setX(f,S),f++}if(this.setIndex(l),this.addAttribute("position",u),this.addAttribute("uv",p),this.computeVertexNormals(),n===2*Math.PI){var E=this.attributes.normal.array,T=new i.Vector3,A=new i.Vector3,L=new i.Vector3;for(o=t*e.length*3,a=0,s=0;a<e.length;a++,s+=3)T.x=E[s+0],T.y=E[s+1],T.z=E[s+2],A.x=E[o+s+0],A.y=E[o+s+1],A.z=E[o+s+2],L.addVectors(T,A).normalize(),E[s+0]=E[o+s+0]=L.x,E[s+1]=E[o+s+1]=L.y,E[s+2]=E[o+s+2]=L.z}},i.LatheBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.LatheBufferGeometry.prototype.constructor=i.LatheBufferGeometry,i.LatheGeometry=function(e,t,r,n){i.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},this.fromBufferGeometry(new i.LatheBufferGeometry(e,t,r,n)),this.mergeVertices()},i.LatheGeometry.prototype=Object.create(i.Geometry.prototype),i.LatheGeometry.prototype.constructor=i.LatheGeometry,i.PlaneGeometry=function(e,t,r,n){i.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:n},this.fromBufferGeometry(new i.PlaneBufferGeometry(e,t,r,n))},i.PlaneGeometry.prototype=Object.create(i.Geometry.prototype),i.PlaneGeometry.prototype.constructor=i.PlaneGeometry,i.PlaneBufferGeometry=function(e,t,r,n){i.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:n};for(var o=e/2,a=t/2,s=Math.floor(r)||1,c=Math.floor(n)||1,h=s+1,l=c+1,u=e/s,p=t/c,d=new Float32Array(h*l*3),f=new Float32Array(h*l*3),m=new Float32Array(h*l*2),v=0,g=0,y=0;l>y;y++)for(var x=y*p-a,b=0;h>b;b++){var _=b*u-o;d[v]=_,d[v+1]=-x,f[v+2]=1,m[g]=b/s,m[g+1]=1-y/c,v+=3,g+=2}v=0;for(var M=new(d.length/3>65535?Uint32Array:Uint16Array)(s*c*6),y=0;c>y;y++)for(var b=0;s>b;b++){var w=b+h*y,S=b+h*(y+1),E=b+1+h*(y+1),T=b+1+h*y;M[v]=w,M[v+1]=S,M[v+2]=T,M[v+3]=S,M[v+4]=E,M[v+5]=T,v+=6}this.setIndex(new i.BufferAttribute(M,1)),this.addAttribute("position",new i.BufferAttribute(d,3)),this.addAttribute("normal",new i.BufferAttribute(f,3)),this.addAttribute("uv",new i.BufferAttribute(m,2))},i.PlaneBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.PlaneBufferGeometry.prototype.constructor=i.PlaneBufferGeometry,i.RingBufferGeometry=function(e,t,r,n,o,a){i.BufferGeometry.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:n,thetaStart:o,thetaLength:a},e=e||20,t=t||50,o=void 0!==o?o:0,a=void 0!==a?a:2*Math.PI,r=void 0!==r?Math.max(3,r):8,n=void 0!==n?Math.max(1,n):1;var s,c,h,l=(r+1)*(n+1),u=r*n*2*3,p=new i.BufferAttribute(new(u>65535?Uint32Array:Uint16Array)(u),1),d=new i.BufferAttribute(new Float32Array(3*l),3),f=new i.BufferAttribute(new Float32Array(3*l),3),m=new i.BufferAttribute(new Float32Array(2*l),2),v=0,g=0,y=e,x=(t-e)/n,b=new i.Vector3,_=new i.Vector2;for(c=0;n>=c;c++){for(h=0;r>=h;h++)s=o+h/r*a,b.x=y*Math.cos(s),b.y=y*Math.sin(s),d.setXYZ(v,b.x,b.y,b.z),f.setXYZ(v,0,0,1),_.x=(b.x/t+1)/2,_.y=(b.y/t+1)/2,m.setXY(v,_.x,_.y),v++;y+=x}for(c=0;n>c;c++){var M=c*(r+1);for(h=0;r>h;h++){s=h+M;var w=s,S=s+r+1,E=s+r+2,T=s+1;p.setX(g,w),g++,p.setX(g,S),g++,p.setX(g,E),g++,p.setX(g,w),g++,p.setX(g,E),g++,p.setX(g,T),g++}}this.setIndex(p),this.addAttribute("position",d),this.addAttribute("normal",f),this.addAttribute("uv",m)},i.RingBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.RingBufferGeometry.prototype.constructor=i.RingBufferGeometry,i.RingGeometry=function(e,t,r,n,o,a){i.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:n,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new i.RingBufferGeometry(e,t,r,n,o,a))},i.RingGeometry.prototype=Object.create(i.Geometry.prototype),i.RingGeometry.prototype.constructor=i.RingGeometry,i.SphereGeometry=function(e,t,r,n,o,a,s){i.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new i.SphereBufferGeometry(e,t,r,n,o,a,s))},i.SphereGeometry.prototype=Object.create(i.Geometry.prototype),i.SphereGeometry.prototype.constructor=i.SphereGeometry,i.SphereBufferGeometry=function(e,t,r,n,o,a,s){i.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:o,thetaStart:a,thetaLength:s},e=e||50,t=Math.max(3,Math.floor(t)||8),r=Math.max(2,Math.floor(r)||6),n=void 0!==n?n:0,o=void 0!==o?o:2*Math.PI,a=void 0!==a?a:0,s=void 0!==s?s:Math.PI;for(var c=a+s,h=(t+1)*(r+1),l=new i.BufferAttribute(new Float32Array(3*h),3),u=new i.BufferAttribute(new Float32Array(3*h),3),p=new i.BufferAttribute(new Float32Array(2*h),2),d=0,f=[],m=new i.Vector3,v=0;r>=v;v++){for(var g=[],y=v/r,x=0;t>=x;x++){var b=x/t,_=-e*Math.cos(n+b*o)*Math.sin(a+y*s),M=e*Math.cos(a+y*s),w=e*Math.sin(n+b*o)*Math.sin(a+y*s);m.set(_,M,w).normalize(),l.setXYZ(d,_,M,w),u.setXYZ(d,m.x,m.y,m.z),p.setXY(d,b,1-y),g.push(d),d++}f.push(g)}for(var S=[],v=0;r>v;v++)for(var x=0;t>x;x++){var E=f[v][x+1],T=f[v][x],A=f[v+1][x],L=f[v+1][x+1];(0!==v||a>0)&&S.push(E,T,L),(v!==r-1||c<Math.PI)&&S.push(T,A,L)}this.setIndex(new(l.count>65535?i.Uint32Attribute:i.Uint16Attribute)(S,1)),this.addAttribute("position",l),this.addAttribute("normal",u),this.addAttribute("uv",p),this.boundingSphere=new i.Sphere(new i.Vector3,e)},i.SphereBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.SphereBufferGeometry.prototype.constructor=i.SphereBufferGeometry,i.TextGeometry=function(e,t){t=t||{};var r=t.font;if(r instanceof i.Font==!1)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new i.Geometry;var n=r.generateShapes(e,t.size,t.curveSegments);t.amount=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),i.ExtrudeGeometry.call(this,n,t),this.type="TextGeometry"},i.TextGeometry.prototype=Object.create(i.ExtrudeGeometry.prototype),i.TextGeometry.prototype.constructor=i.TextGeometry,i.TorusBufferGeometry=function(e,t,r,n,o){i.BufferGeometry.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:n,arc:o},e=e||100,t=t||40,r=Math.floor(r)||8,n=Math.floor(n)||6,o=o||2*Math.PI;var a,s,c=(r+1)*(n+1),h=r*n*2*3,l=new(h>65535?Uint32Array:Uint16Array)(h),u=new Float32Array(3*c),p=new Float32Array(3*c),d=new Float32Array(2*c),f=0,m=0,v=0,g=new i.Vector3,y=new i.Vector3,x=new i.Vector3;for(a=0;r>=a;a++)for(s=0;n>=s;s++){var b=s/n*o,_=a/r*Math.PI*2;y.x=(e+t*Math.cos(_))*Math.cos(b),y.y=(e+t*Math.cos(_))*Math.sin(b),y.z=t*Math.sin(_),u[f]=y.x,u[f+1]=y.y,u[f+2]=y.z,g.x=e*Math.cos(b),g.y=e*Math.sin(b),x.subVectors(y,g).normalize(),p[f]=x.x,p[f+1]=x.y,p[f+2]=x.z,d[m]=s/n,d[m+1]=a/r,f+=3,m+=2}for(a=1;r>=a;a++)for(s=1;n>=s;s++){var M=(n+1)*a+s-1,w=(n+1)*(a-1)+s-1,S=(n+1)*(a-1)+s,E=(n+1)*a+s;l[v]=M,l[v+1]=w,l[v+2]=E,l[v+3]=w,l[v+4]=S,l[v+5]=E,v+=6}this.setIndex(new i.BufferAttribute(l,1)),this.addAttribute("position",new i.BufferAttribute(u,3)),this.addAttribute("normal",new i.BufferAttribute(p,3)),this.addAttribute("uv",new i.BufferAttribute(d,2))},i.TorusBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.TorusBufferGeometry.prototype.constructor=i.TorusBufferGeometry,i.TorusGeometry=function(e,t,r,n,o){i.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:n,arc:o},this.fromBufferGeometry(new i.TorusBufferGeometry(e,t,r,n,o))},i.TorusGeometry.prototype=Object.create(i.Geometry.prototype),i.TorusGeometry.prototype.constructor=i.TorusGeometry,i.TorusKnotBufferGeometry=function(e,t,r,n,o,a){function s(e,t,r,i,n){var o=Math.cos(e),a=Math.sin(e),s=r/t*e,c=Math.cos(s);n.x=i*(2+c)*.5*o,n.y=i*(2+c)*a*.5,n.z=i*Math.sin(s)*.5}i.BufferGeometry.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:n,p:o,q:a},e=e||100,t=t||40,r=Math.floor(r)||64,n=Math.floor(n)||8,o=o||2,a=a||3;var c,h,l=(n+1)*(r+1),u=n*r*2*3,p=new i.BufferAttribute(new(u>65535?Uint32Array:Uint16Array)(u),1),d=new i.BufferAttribute(new Float32Array(3*l),3),f=new i.BufferAttribute(new Float32Array(3*l),3),m=new i.BufferAttribute(new Float32Array(2*l),2),v=0,g=0,y=new i.Vector3,x=new i.Vector3,b=new i.Vector2,_=new i.Vector3,M=new i.Vector3,w=new i.Vector3,S=new i.Vector3,E=new i.Vector3;for(c=0;r>=c;++c){var T=c/r*o*Math.PI*2;for(s(T,o,a,e,_),s(T+.01,o,a,e,M),S.subVectors(M,_),E.addVectors(M,_),w.crossVectors(S,E),E.crossVectors(w,S),w.normalize(),E.normalize(),h=0;n>=h;++h){var A=h/n*Math.PI*2,L=-t*Math.cos(A),C=t*Math.sin(A);y.x=_.x+(L*E.x+C*w.x),y.y=_.y+(L*E.y+C*w.y),y.z=_.z+(L*E.z+C*w.z),d.setXYZ(v,y.x,y.y,y.z),x.subVectors(y,_).normalize(),f.setXYZ(v,x.x,x.y,x.z),b.x=c/r,b.y=h/n,m.setXY(v,b.x,b.y),v++}}for(h=1;r>=h;h++)for(c=1;n>=c;c++){var R=(n+1)*(h-1)+(c-1),P=(n+1)*h+(c-1),I=(n+1)*h+c,B=(n+1)*(h-1)+c;p.setX(g,R),g++,p.setX(g,P),g++,p.setX(g,B),g++,p.setX(g,P),g++,p.setX(g,I),g++,p.setX(g,B),g++}this.setIndex(p),this.addAttribute("position",d),this.addAttribute("normal",f),this.addAttribute("uv",m)},i.TorusKnotBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.TorusKnotBufferGeometry.prototype.constructor=i.TorusKnotBufferGeometry,i.TorusKnotGeometry=function(e,t,r,n,o,a,s){i.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:n,p:o,q:a},void 0!==s&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new i.TorusKnotBufferGeometry(e,t,r,n,o,a)),this.mergeVertices()},i.TorusKnotGeometry.prototype=Object.create(i.Geometry.prototype),i.TorusKnotGeometry.prototype.constructor=i.TorusKnotGeometry,i.TubeGeometry=function(e,t,r,n,o,a){function s(e,t,r){return R.vertices.push(new i.Vector3(e,t,r))-1}i.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:e,segments:t,radius:r,radialSegments:n,closed:o,taper:a},t=t||64,r=r||1,n=n||8,o=o||!1,a=a||i.TubeGeometry.NoTaper;var c,h,l,u,p,d,f,m,v,g,y,x,b,_,M,w,S,E,T,A,L,C=[],R=this,P=t+1,I=new i.Vector3,B=new i.TubeGeometry.FrenetFrames(e,t,o),D=B.tangents,U=B.normals,F=B.binormals;for(this.tangents=D,this.normals=U,this.binormals=F,g=0;P>g;g++)for(C[g]=[],u=g/(P-1),v=e.getPointAt(u),c=D[g],h=U[g],l=F[g],d=r*a(u),y=0;n>y;y++)p=y/n*2*Math.PI,f=-d*Math.cos(p),m=d*Math.sin(p),I.copy(v),I.x+=f*h.x+m*l.x,I.y+=f*h.y+m*l.y,I.z+=f*h.z+m*l.z,C[g][y]=s(I.x,I.y,I.z);for(g=0;t>g;g++)for(y=0;n>y;y++)x=o?(g+1)%t:g+1,b=(y+1)%n,_=C[g][y],M=C[x][y],w=C[x][b],S=C[g][b],E=new i.Vector2(g/t,y/n),T=new i.Vector2((g+1)/t,y/n),A=new i.Vector2((g+1)/t,(y+1)/n),L=new i.Vector2(g/t,(y+1)/n),this.faces.push(new i.Face3(_,M,S)),this.faceVertexUvs[0].push([E,T,L]),this.faces.push(new i.Face3(M,w,S)),this.faceVertexUvs[0].push([T.clone(),A,L.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},i.TubeGeometry.prototype=Object.create(i.Geometry.prototype),i.TubeGeometry.prototype.constructor=i.TubeGeometry,i.TubeGeometry.NoTaper=function(e){return 1},i.TubeGeometry.SinusoidalTaper=function(e){return Math.sin(Math.PI*e)},i.TubeGeometry.FrenetFrames=function(e,t,r){function n(){f[0]=new i.Vector3,m[0]=new i.Vector3,a=Number.MAX_VALUE,s=Math.abs(d[0].x),c=Math.abs(d[0].y),h=Math.abs(d[0].z),a>=s&&(a=s,p.set(1,0,0)),a>=c&&(a=c,p.set(0,1,0)),a>=h&&p.set(0,0,1),v.crossVectors(d[0],p).normalize(),f[0].crossVectors(d[0],v),m[0].crossVectors(d[0],f[0])}var o,a,s,c,h,l,u,p=new i.Vector3,d=[],f=[],m=[],v=new i.Vector3,g=new i.Matrix4,y=t+1;for(this.tangents=d,this.normals=f,this.binormals=m,l=0;y>l;l++)u=l/(y-1),d[l]=e.getTangentAt(u),d[l].normalize();for(n(),l=1;y>l;l++)f[l]=f[l-1].clone(),m[l]=m[l-1].clone(),v.crossVectors(d[l-1],d[l]),v.length()>Number.EPSILON&&(v.normalize(),o=Math.acos(i.Math.clamp(d[l-1].dot(d[l]),-1,1)),f[l].applyMatrix4(g.makeRotationAxis(v,o))),m[l].crossVectors(d[l],f[l]);if(r)for(o=Math.acos(i.Math.clamp(f[0].dot(f[y-1]),-1,1)),o/=y-1,d[0].dot(v.crossVectors(f[0],f[y-1]))>0&&(o=-o),l=1;y>l;l++)f[l].applyMatrix4(g.makeRotationAxis(d[l],o*l)),m[l].crossVectors(d[l],f[l])},i.PolyhedronGeometry=function(e,t,r,n){function o(e){var t=e.normalize().clone();t.index=u.vertices.push(t)-1;var r=c(e)/2/Math.PI+.5,n=h(e)/Math.PI+.5;return t.uv=new i.Vector2(r,1-n),t}function a(e,t,r,n){var o=new i.Face3(e.index,t.index,r.index,[e.clone(),t.clone(),r.clone()],void 0,n);u.faces.push(o),b.copy(e).add(t).add(r).divideScalar(3);var a=c(b);u.faceVertexUvs[0].push([l(e.uv,e,a),l(t.uv,t,a),l(r.uv,r,a)])}function s(e,t){for(var r=Math.pow(2,t),i=o(u.vertices[e.a]),n=o(u.vertices[e.b]),s=o(u.vertices[e.c]),c=[],h=e.materialIndex,l=0;r>=l;l++){c[l]=[];for(var p=o(i.clone().lerp(s,l/r)),d=o(n.clone().lerp(s,l/r)),f=r-l,m=0;f>=m;m++)0===m&&l===r?c[l][m]=p:c[l][m]=o(p.clone().lerp(d,m/f))}for(var l=0;r>l;l++)for(var m=0;2*(r-l)-1>m;m++){var v=Math.floor(m/2);m%2===0?a(c[l][v+1],c[l+1][v],c[l][v],h):a(c[l][v+1],c[l+1][v+1],c[l+1][v],h)}}function c(e){return Math.atan2(e.z,-e.x)}function h(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}function l(e,t,r){return 0>r&&1===e.x&&(e=new i.Vector2(e.x-1,e.y)),0===t.x&&0===t.z&&(e=new i.Vector2(r/2/Math.PI+.5,e.y)),e.clone()}i.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:n},r=r||1,n=n||0;for(var u=this,p=0,d=e.length;d>p;p+=3)o(new i.Vector3(e[p],e[p+1],e[p+2]));for(var f=this.vertices,m=[],p=0,v=0,d=t.length;d>p;p+=3,v++){var g=f[t[p]],y=f[t[p+1]],x=f[t[p+2]];m[v]=new i.Face3(g.index,y.index,x.index,[g.clone(),y.clone(),x.clone()],void 0,v)}for(var b=new i.Vector3,p=0,d=m.length;d>p;p++)s(m[p],n);for(var p=0,d=this.faceVertexUvs[0].length;d>p;p++){var _=this.faceVertexUvs[0][p],M=_[0].x,w=_[1].x,S=_[2].x,E=Math.max(M,w,S),T=Math.min(M,w,S);E>.9&&.1>T&&(.2>M&&(_[0].x+=1),.2>w&&(_[1].x+=1),.2>S&&(_[2].x+=1))}for(var p=0,d=this.vertices.length;d>p;p++)this.vertices[p].multiplyScalar(r);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new i.Sphere(new i.Vector3,r)},i.PolyhedronGeometry.prototype=Object.create(i.Geometry.prototype),i.PolyhedronGeometry.prototype.constructor=i.PolyhedronGeometry,i.DodecahedronGeometry=function(e,t){var r=(1+Math.sqrt(5))/2,n=1/r,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];i.PolyhedronGeometry.call(this,o,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}},i.DodecahedronGeometry.prototype=Object.create(i.PolyhedronGeometry.prototype),i.DodecahedronGeometry.prototype.constructor=i.DodecahedronGeometry,i.IcosahedronGeometry=function(e,t){var r=(1+Math.sqrt(5))/2,n=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],o=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];i.PolyhedronGeometry.call(this,n,o,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}},i.IcosahedronGeometry.prototype=Object.create(i.PolyhedronGeometry.prototype),i.IcosahedronGeometry.prototype.constructor=i.IcosahedronGeometry,i.OctahedronGeometry=function(e,t){var r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],n=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];i.PolyhedronGeometry.call(this,r,n,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}},i.OctahedronGeometry.prototype=Object.create(i.PolyhedronGeometry.prototype),i.OctahedronGeometry.prototype.constructor=i.OctahedronGeometry,i.TetrahedronGeometry=function(e,t){var r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],n=[2,1,0,0,3,2,1,3,0,2,3,1];i.PolyhedronGeometry.call(this,r,n,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}},i.TetrahedronGeometry.prototype=Object.create(i.PolyhedronGeometry.prototype),i.TetrahedronGeometry.prototype.constructor=i.TetrahedronGeometry,i.ParametricGeometry=function(e,t,r){i.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:r};var n,o,a,s,c,h=this.vertices,l=this.faces,u=this.faceVertexUvs[0],p=t+1;for(n=0;r>=n;n++)for(c=n/r,o=0;t>=o;o++)s=o/t,a=e(s,c),h.push(a);var d,f,m,v,g,y,x,b;for(n=0;r>n;n++)for(o=0;t>o;o++)d=n*p+o,f=n*p+o+1,m=(n+1)*p+o+1,v=(n+1)*p+o,g=new i.Vector2(o/t,n/r),y=new i.Vector2((o+1)/t,n/r),x=new i.Vector2((o+1)/t,(n+1)/r),b=new i.Vector2(o/t,(n+1)/r),l.push(new i.Face3(d,f,v)),u.push([g,y,b]),l.push(new i.Face3(f,m,v)),u.push([y.clone(),x,b.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},i.ParametricGeometry.prototype=Object.create(i.Geometry.prototype),i.ParametricGeometry.prototype.constructor=i.ParametricGeometry,i.WireframeGeometry=function(e){function t(e,t){return e-t}i.BufferGeometry.call(this);var r=[0,0],n={},o=["a","b","c"];if(e instanceof i.Geometry){for(var a=e.vertices,s=e.faces,c=0,h=new Uint32Array(6*s.length),l=0,u=s.length;u>l;l++)for(var p=s[l],d=0;3>d;d++){r[0]=p[o[d]],r[1]=p[o[(d+1)%3]],r.sort(t);var f=r.toString();void 0===n[f]&&(h[2*c]=r[0],h[2*c+1]=r[1],n[f]=!0,c++)}for(var m=new Float32Array(2*c*3),l=0,u=c;u>l;l++)for(var d=0;2>d;d++){var v=a[h[2*l+d]],g=6*l+3*d;m[g+0]=v.x,m[g+1]=v.y,m[g+2]=v.z}this.addAttribute("position",new i.BufferAttribute(m,3))}else if(e instanceof i.BufferGeometry)if(null!==e.index){var y=e.index.array,a=e.attributes.position,x=e.groups,c=0;0===x.length&&e.addGroup(0,y.length);for(var h=new Uint32Array(2*y.length),b=0,_=x.length;_>b;++b)for(var M=x[b],w=M.start,S=M.count,l=w,E=w+S;E>l;l+=3)for(var d=0;3>d;d++){r[0]=y[l+d],r[1]=y[l+(d+1)%3],r.sort(t);var f=r.toString();void 0===n[f]&&(h[2*c]=r[0],h[2*c+1]=r[1],n[f]=!0,c++)}for(var m=new Float32Array(2*c*3),l=0,u=c;u>l;l++)for(var d=0;2>d;d++){var g=6*l+3*d,T=h[2*l+d];m[g+0]=a.getX(T),m[g+1]=a.getY(T),m[g+2]=a.getZ(T)}this.addAttribute("position",new i.BufferAttribute(m,3))}else{for(var a=e.attributes.position.array,c=a.length/3,A=c/3,m=new Float32Array(2*c*3),l=0,u=A;u>l;l++)for(var d=0;3>d;d++){var g=18*l+6*d,L=9*l+3*d;m[g+0]=a[L],m[g+1]=a[L+1],m[g+2]=a[L+2];var T=9*l+3*((d+1)%3);m[g+3]=a[T],m[g+4]=a[T+1],m[g+5]=a[T+2]}this.addAttribute("position",new i.BufferAttribute(m,3))}},i.WireframeGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.WireframeGeometry.prototype.constructor=i.WireframeGeometry,i.AxisHelper=function(e){e=e||1;var t=new Float32Array([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e]),r=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]),n=new i.BufferGeometry;n.addAttribute("position",new i.BufferAttribute(t,3)),n.addAttribute("color",new i.BufferAttribute(r,3));var o=new i.LineBasicMaterial({vertexColors:i.VertexColors});i.LineSegments.call(this,n,o)},i.AxisHelper.prototype=Object.create(i.LineSegments.prototype),i.AxisHelper.prototype.constructor=i.AxisHelper,i.ArrowHelper=function(){var e=new i.Geometry;e.vertices.push(new i.Vector3(0,0,0),new i.Vector3(0,1,0));var t=new i.CylinderGeometry(0,.5,1,5,1);return t.translate(0,-.5,0),function(r,n,o,a,s,c){i.Object3D.call(this),void 0===a&&(a=16776960),void 0===o&&(o=1),void 0===s&&(s=.2*o),void 0===c&&(c=.2*s),this.position.copy(n),this.line=new i.Line(e,new i.LineBasicMaterial({color:a})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new i.Mesh(t,new i.MeshBasicMaterial({color:a})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(r),this.setLength(o,s,c)}}(),i.ArrowHelper.prototype=Object.create(i.Object3D.prototype),i.ArrowHelper.prototype.constructor=i.ArrowHelper,i.ArrowHelper.prototype.setDirection=function(){var e,t=new i.Vector3;return function(r){r.y>.99999?this.quaternion.set(0,0,0,1):r.y<-.99999?this.quaternion.set(1,0,0,0):(t.set(r.z,0,-r.x).normalize(),e=Math.acos(r.y),this.quaternion.setFromAxisAngle(t,e))}}(),i.ArrowHelper.prototype.setLength=function(e,t,r){void 0===t&&(t=.2*e),void 0===r&&(r=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()},i.ArrowHelper.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},i.BoxHelper=function(e){var t=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]),r=new Float32Array(24),n=new i.BufferGeometry;n.setIndex(new i.BufferAttribute(t,1)),n.addAttribute("position",new i.BufferAttribute(r,3)),i.LineSegments.call(this,n,new i.LineBasicMaterial({color:16776960})),void 0!==e&&this.update(e)},i.BoxHelper.prototype=Object.create(i.LineSegments.prototype),i.BoxHelper.prototype.constructor=i.BoxHelper,i.BoxHelper.prototype.update=function(){
  var e=new i.Box3;return function(t){if(e.setFromObject(t),!e.isEmpty()){var r=e.min,i=e.max,n=this.geometry.attributes.position,o=n.array;o[0]=i.x,o[1]=i.y,o[2]=i.z,o[3]=r.x,o[4]=i.y,o[5]=i.z,o[6]=r.x,o[7]=r.y,o[8]=i.z,o[9]=i.x,o[10]=r.y,o[11]=i.z,o[12]=i.x,o[13]=i.y,o[14]=r.z,o[15]=r.x,o[16]=i.y,o[17]=r.z,o[18]=r.x,o[19]=r.y,o[20]=r.z,o[21]=i.x,o[22]=r.y,o[23]=r.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),i.BoundingBoxHelper=function(e,t){var r=void 0!==t?t:8947848;this.object=e,this.box=new i.Box3,i.Mesh.call(this,new i.BoxGeometry(1,1,1),new i.MeshBasicMaterial({color:r,wireframe:!0}))},i.BoundingBoxHelper.prototype=Object.create(i.Mesh.prototype),i.BoundingBoxHelper.prototype.constructor=i.BoundingBoxHelper,i.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},i.CameraHelper=function(e){function t(e,t,i){r(e,i),r(t,i)}function r(e,t){n.vertices.push(new i.Vector3),n.colors.push(new i.Color(t)),void 0===a[e]&&(a[e]=[]),a[e].push(n.vertices.length-1)}var n=new i.Geometry,o=new i.LineBasicMaterial({color:16777215,vertexColors:i.FaceColors}),a={},s=16755200,c=16711680,h=43775,l=16777215,u=3355443;t("n1","n2",s),t("n2","n4",s),t("n4","n3",s),t("n3","n1",s),t("f1","f2",s),t("f2","f4",s),t("f4","f3",s),t("f3","f1",s),t("n1","f1",s),t("n2","f2",s),t("n3","f3",s),t("n4","f4",s),t("p","n1",c),t("p","n2",c),t("p","n3",c),t("p","n4",c),t("u1","u2",h),t("u2","u3",h),t("u3","u1",h),t("c","t",l),t("p","c",u),t("cn1","cn2",u),t("cn3","cn4",u),t("cf1","cf2",u),t("cf3","cf4",u),i.LineSegments.call(this,n,o),this.camera=e,this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()},i.CameraHelper.prototype=Object.create(i.LineSegments.prototype),i.CameraHelper.prototype.constructor=i.CameraHelper,i.CameraHelper.prototype.update=function(){function e(e,i,a,s){n.set(i,a,s).unproject(o);var c=r[e];if(void 0!==c)for(var h=0,l=c.length;l>h;h++)t.vertices[c[h]].copy(n)}var t,r,n=new i.Vector3,o=new i.Camera;return function(){t=this.geometry,r=this.pointMap;var i=1,n=1;o.projectionMatrix.copy(this.camera.projectionMatrix),e("c",0,0,-1),e("t",0,0,1),e("n1",-i,-n,-1),e("n2",i,-n,-1),e("n3",-i,n,-1),e("n4",i,n,-1),e("f1",-i,-n,1),e("f2",i,-n,1),e("f3",-i,n,1),e("f4",i,n,1),e("u1",.7*i,1.1*n,-1),e("u2",.7*-i,1.1*n,-1),e("u3",0,2*n,-1),e("cf1",-i,0,1),e("cf2",i,0,1),e("cf3",0,-n,1),e("cf4",0,n,1),e("cn1",-i,0,-1),e("cn2",i,0,-1),e("cn3",0,-n,-1),e("cn4",0,n,-1),t.verticesNeedUpdate=!0}}(),i.DirectionalLightHelper=function(e,t){i.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,t=t||1;var r=new i.Geometry;r.vertices.push(new i.Vector3(-t,t,0),new i.Vector3(t,t,0),new i.Vector3(t,-t,0),new i.Vector3(-t,-t,0),new i.Vector3(-t,t,0));var n=new i.LineBasicMaterial({fog:!1});n.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new i.Line(r,n),this.add(this.lightPlane),r=new i.Geometry,r.vertices.push(new i.Vector3,new i.Vector3),n=new i.LineBasicMaterial({fog:!1}),n.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new i.Line(r,n),this.add(this.targetLine),this.update()},i.DirectionalLightHelper.prototype=Object.create(i.Object3D.prototype),i.DirectionalLightHelper.prototype.constructor=i.DirectionalLightHelper,i.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},i.DirectionalLightHelper.prototype.update=function(){var e=new i.Vector3,t=new i.Vector3,r=new i.Vector3;return function(){e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),r.subVectors(t,e),this.lightPlane.lookAt(r),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(r),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),i.EdgesHelper=function(e,t,r){var n=void 0!==t?t:16777215;i.LineSegments.call(this,new i.EdgesGeometry(e.geometry,r),new i.LineBasicMaterial({color:n})),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},i.EdgesHelper.prototype=Object.create(i.LineSegments.prototype),i.EdgesHelper.prototype.constructor=i.EdgesHelper,i.FaceNormalsHelper=function(e,t,r,n){this.object=e,this.size=void 0!==t?t:1;var o=void 0!==r?r:16776960,a=void 0!==n?n:1,s=0,c=this.object.geometry;c instanceof i.Geometry?s=c.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var h=new i.BufferGeometry,l=new i.Float32Attribute(2*s*3,3);h.addAttribute("position",l),i.LineSegments.call(this,h,new i.LineBasicMaterial({color:o,linewidth:a})),this.matrixAutoUpdate=!1,this.update()},i.FaceNormalsHelper.prototype=Object.create(i.LineSegments.prototype),i.FaceNormalsHelper.prototype.constructor=i.FaceNormalsHelper,i.FaceNormalsHelper.prototype.update=function(){var e=new i.Vector3,t=new i.Vector3,r=new i.Matrix3;return function(){this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);for(var i=this.object.matrixWorld,n=this.geometry.attributes.position,o=this.object.geometry,a=o.vertices,s=o.faces,c=0,h=0,l=s.length;l>h;h++){var u=s[h],p=u.normal;e.copy(a[u.a]).add(a[u.b]).add(a[u.c]).divideScalar(3).applyMatrix4(i),t.copy(p).applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),n.setXYZ(c,e.x,e.y,e.z),c+=1,n.setXYZ(c,t.x,t.y,t.z),c+=1}return n.needsUpdate=!0,this}}(),i.GridHelper=function(e,t){var r=new i.Geometry,n=new i.LineBasicMaterial({vertexColors:i.VertexColors});this.color1=new i.Color(4473924),this.color2=new i.Color(8947848);for(var o=-e;e>=o;o+=t){r.vertices.push(new i.Vector3(-e,0,o),new i.Vector3(e,0,o),new i.Vector3(o,0,-e),new i.Vector3(o,0,e));var a=0===o?this.color1:this.color2;r.colors.push(a,a,a,a)}i.LineSegments.call(this,r,n)},i.GridHelper.prototype=Object.create(i.LineSegments.prototype),i.GridHelper.prototype.constructor=i.GridHelper,i.GridHelper.prototype.setColors=function(e,t){this.color1.set(e),this.color2.set(t),this.geometry.colorsNeedUpdate=!0},i.HemisphereLightHelper=function(e,t){i.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new i.Color,new i.Color];var r=new i.SphereGeometry(t,4,2);r.rotateX(-Math.PI/2);for(var n=0,o=8;o>n;n++)r.faces[n].color=this.colors[4>n?0:1];var a=new i.MeshBasicMaterial({vertexColors:i.FaceColors,wireframe:!0});this.lightSphere=new i.Mesh(r,a),this.add(this.lightSphere),this.update()},i.HemisphereLightHelper.prototype=Object.create(i.Object3D.prototype),i.HemisphereLightHelper.prototype.constructor=i.HemisphereLightHelper,i.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},i.HemisphereLightHelper.prototype.update=function(){var e=new i.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(e.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),i.PointLightHelper=function(e,t){this.light=e,this.light.updateMatrixWorld();var r=new i.SphereGeometry(t,4,2),n=new i.MeshBasicMaterial({wireframe:!0,fog:!1});n.color.copy(this.light.color).multiplyScalar(this.light.intensity),i.Mesh.call(this,r,n),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},i.PointLightHelper.prototype=Object.create(i.Mesh.prototype),i.PointLightHelper.prototype.constructor=i.PointLightHelper,i.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},i.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},i.SkeletonHelper=function(e){this.bones=this.getBoneList(e);for(var t=new i.Geometry,r=0;r<this.bones.length;r++){var n=this.bones[r];n.parent instanceof i.Bone&&(t.vertices.push(new i.Vector3),t.vertices.push(new i.Vector3),t.colors.push(new i.Color(0,0,1)),t.colors.push(new i.Color(0,1,0)))}t.dynamic=!0;var o=new i.LineBasicMaterial({vertexColors:i.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0});i.LineSegments.call(this,t,o),this.root=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.update()},i.SkeletonHelper.prototype=Object.create(i.LineSegments.prototype),i.SkeletonHelper.prototype.constructor=i.SkeletonHelper,i.SkeletonHelper.prototype.getBoneList=function(e){var t=[];e instanceof i.Bone&&t.push(e);for(var r=0;r<e.children.length;r++)t.push.apply(t,this.getBoneList(e.children[r]));return t},i.SkeletonHelper.prototype.update=function(){for(var e=this.geometry,t=(new i.Matrix4).getInverse(this.root.matrixWorld),r=new i.Matrix4,n=0,o=0;o<this.bones.length;o++){var a=this.bones[o];a.parent instanceof i.Bone&&(r.multiplyMatrices(t,a.matrixWorld),e.vertices[n].setFromMatrixPosition(r),r.multiplyMatrices(t,a.parent.matrixWorld),e.vertices[n+1].setFromMatrixPosition(r),n+=2)}e.verticesNeedUpdate=!0,e.computeBoundingSphere()},i.SpotLightHelper=function(e){i.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;var t=new i.CylinderGeometry(0,1,1,8,1,!0);t.translate(0,-.5,0),t.rotateX(-Math.PI/2);var r=new i.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new i.Mesh(t,r),this.add(this.cone),this.update()},i.SpotLightHelper.prototype=Object.create(i.Object3D.prototype),i.SpotLightHelper.prototype.constructor=i.SpotLightHelper,i.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},i.SpotLightHelper.prototype.update=function(){var e=new i.Vector3,t=new i.Vector3;return function(){var r=this.light.distance?this.light.distance:1e4,i=r*Math.tan(this.light.angle);this.cone.scale.set(i,i,r),e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(t.sub(e)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),i.VertexNormalsHelper=function(e,t,r,n){this.object=e,this.size=void 0!==t?t:1;var o=void 0!==r?r:16711680,a=void 0!==n?n:1,s=0,c=this.object.geometry;c instanceof i.Geometry?s=3*c.faces.length:c instanceof i.BufferGeometry&&(s=c.attributes.normal.count);var h=new i.BufferGeometry,l=new i.Float32Attribute(2*s*3,3);h.addAttribute("position",l),i.LineSegments.call(this,h,new i.LineBasicMaterial({color:o,linewidth:a})),this.matrixAutoUpdate=!1,this.update()},i.VertexNormalsHelper.prototype=Object.create(i.LineSegments.prototype),i.VertexNormalsHelper.prototype.constructor=i.VertexNormalsHelper,i.VertexNormalsHelper.prototype.update=function(){var e=new i.Vector3,t=new i.Vector3,r=new i.Matrix3;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);var o=this.object.matrixWorld,a=this.geometry.attributes.position,s=this.object.geometry;if(s instanceof i.Geometry)for(var c=s.vertices,h=s.faces,l=0,u=0,p=h.length;p>u;u++)for(var d=h[u],f=0,m=d.vertexNormals.length;m>f;f++){var v=c[d[n[f]]],g=d.vertexNormals[f];e.copy(v).applyMatrix4(o),t.copy(g).applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),a.setXYZ(l,e.x,e.y,e.z),l+=1,a.setXYZ(l,t.x,t.y,t.z),l+=1}else if(s instanceof i.BufferGeometry)for(var y=s.attributes.position,x=s.attributes.normal,l=0,f=0,m=y.count;m>f;f++)e.set(y.getX(f),y.getY(f),y.getZ(f)).applyMatrix4(o),t.set(x.getX(f),x.getY(f),x.getZ(f)),t.applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),a.setXYZ(l,e.x,e.y,e.z),l+=1,a.setXYZ(l,t.x,t.y,t.z),l+=1;return a.needsUpdate=!0,this}}(),i.WireframeHelper=function(e,t){var r=void 0!==t?t:16777215;i.LineSegments.call(this,new i.WireframeGeometry(e.geometry),new i.LineBasicMaterial({color:r})),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},i.WireframeHelper.prototype=Object.create(i.LineSegments.prototype),i.WireframeHelper.prototype.constructor=i.WireframeHelper,i.ImmediateRenderObject=function(e){i.Object3D.call(this),this.material=e,this.render=function(e){}},i.ImmediateRenderObject.prototype=Object.create(i.Object3D.prototype),i.ImmediateRenderObject.prototype.constructor=i.ImmediateRenderObject,i.MorphBlendMesh=function(e,t){i.Mesh.call(this,e,t),this.animationsMap={},this.animationsList=[];var r=this.geometry.morphTargets.length,n="__default",o=0,a=r-1,s=r/1;this.createAnimation(n,o,a,s),this.setAnimationWeight(n,1)},i.MorphBlendMesh.prototype=Object.create(i.Mesh.prototype),i.MorphBlendMesh.prototype.constructor=i.MorphBlendMesh,i.MorphBlendMesh.prototype.createAnimation=function(e,t,r,i){var n={start:t,end:r,length:r-t+1,fps:i,duration:(r-t)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[e]=n,this.animationsList.push(n)},i.MorphBlendMesh.prototype.autoCreateAnimations=function(e){for(var t,r=/([a-z]+)_?(\d+)/i,i={},n=this.geometry,o=0,a=n.morphTargets.length;a>o;o++){var s=n.morphTargets[o],c=s.name.match(r);if(c&&c.length>1){var h=c[1];i[h]||(i[h]={start:1/0,end:-(1/0)});var l=i[h];o<l.start&&(l.start=o),o>l.end&&(l.end=o),t||(t=h)}}for(var h in i){var l=i[h];this.createAnimation(h,l.start,l.end,e)}this.firstAnimation=t},i.MorphBlendMesh.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},i.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},i.MorphBlendMesh.prototype.setAnimationFPS=function(e,t){var r=this.animationsMap[e];r&&(r.fps=t,r.duration=(r.end-r.start)/r.fps)},i.MorphBlendMesh.prototype.setAnimationDuration=function(e,t){var r=this.animationsMap[e];r&&(r.duration=t,r.fps=(r.end-r.start)/r.duration)},i.MorphBlendMesh.prototype.setAnimationWeight=function(e,t){var r=this.animationsMap[e];r&&(r.weight=t)},i.MorphBlendMesh.prototype.setAnimationTime=function(e,t){var r=this.animationsMap[e];r&&(r.time=t)},i.MorphBlendMesh.prototype.getAnimationTime=function(e){var t=0,r=this.animationsMap[e];return r&&(t=r.time),t},i.MorphBlendMesh.prototype.getAnimationDuration=function(e){var t=-1,r=this.animationsMap[e];return r&&(t=r.duration),t},i.MorphBlendMesh.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},i.MorphBlendMesh.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},i.MorphBlendMesh.prototype.update=function(e){for(var t=0,r=this.animationsList.length;r>t;t++){var n=this.animationsList[t];if(n.active){var o=n.duration/n.length;n.time+=n.direction*e,n.mirroredLoop?(n.time>n.duration||n.time<0)&&(n.direction*=-1,n.time>n.duration&&(n.time=n.duration,n.directionBackwards=!0),n.time<0&&(n.time=0,n.directionBackwards=!1)):(n.time=n.time%n.duration,n.time<0&&(n.time+=n.duration));var a=n.start+i.Math.clamp(Math.floor(n.time/o),0,n.length-1),s=n.weight;a!==n.currentFrame&&(this.morphTargetInfluences[n.lastFrame]=0,this.morphTargetInfluences[n.currentFrame]=1*s,this.morphTargetInfluences[a]=0,n.lastFrame=n.currentFrame,n.currentFrame=a);var c=n.time%o/o;n.directionBackwards&&(c=1-c),n.currentFrame!==n.lastFrame?(this.morphTargetInfluences[n.currentFrame]=c*s,this.morphTargetInfluences[n.lastFrame]=(1-c)*s):this.morphTargetInfluences[n.currentFrame]=s}}},"undefined"!=typeof r?("undefined"!=typeof t&&t.exports&&(r=t.exports=i),r.THREE=i):this.THREE=i},{}]},{},[1]);
  