XWWitPark/witpark_jzzs/xw_jzzs_web/public/lib/three/three.min.js
2024-09-12 08:10:00 +08:00

2 lines
418 KiB
JavaScript

/* 2020-9-22 15:23:18 | 版权所有 军懋国兴 */
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var THREE={REVISION:"73"};"function"==typeof define&&define.amd?define("three",THREE):"undefined"!=typeof exports&&"undefined"!=typeof module&&(module.exports=THREE),void 0!==self.requestAnimationFrame&&void 0!==self.cancelAnimationFrame||function(){for(var n=0,t=["ms","moz","webkit","o"],e=0;e<t.length&&!self.requestAnimationFrame;++e)self.requestAnimationFrame=self[t[e]+"RequestAnimationFrame"],self.cancelAnimationFrame=self[t[e]+"CancelAnimationFrame"]||self[t[e]+"CancelRequestAnimationFrame"];void 0===self.requestAnimationFrame&&void 0!==self.setTimeout&&(self.requestAnimationFrame=function(t){var e=Date.now(),r=Math.max(0,16-(e-n)),i=self.setTimeout(function(){t(e+r)},r);return n=e+r,i}),void 0===self.cancelAnimationFrame&&void 0!==self.clearTimeout&&(self.cancelAnimationFrame=function(t){self.clearTimeout(t)})}(),void 0===self.performance&&(self.performance={}),void 0===self.performance.now&&function(){var t=Date.now();self.performance.now=function(){return Date.now()-t}}(),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:0<t?1:+t}),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]}}),THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},THREE.CullFaceNone=0,THREE.CullFaceBack=1,THREE.CullFaceFront=2,THREE.CullFaceFrontBack=3,THREE.FrontFaceDirectionCW=0,THREE.FrontFaceDirectionCCW=1,THREE.BasicShadowMap=0,THREE.PCFShadowMap=1,THREE.PCFSoftShadowMap=2,THREE.FrontSide=0,THREE.BackSide=1,THREE.DoubleSide=2,THREE.FlatShading=1,THREE.SmoothShading=2,THREE.NoColors=0,THREE.FaceColors=1,THREE.VertexColors=2,THREE.NoBlending=0,THREE.NormalBlending=1,THREE.AdditiveBlending=2,THREE.SubtractiveBlending=3,THREE.MultiplyBlending=4,THREE.CustomBlending=5,THREE.AddEquation=100,THREE.SubtractEquation=101,THREE.ReverseSubtractEquation=102,THREE.MinEquation=103,THREE.MaxEquation=104,THREE.ZeroFactor=200,THREE.OneFactor=201,THREE.SrcColorFactor=202,THREE.OneMinusSrcColorFactor=203,THREE.SrcAlphaFactor=204,THREE.OneMinusSrcAlphaFactor=205,THREE.DstAlphaFactor=206,THREE.OneMinusDstAlphaFactor=207,THREE.DstColorFactor=208,THREE.OneMinusDstColorFactor=209,THREE.SrcAlphaSaturateFactor=210,THREE.NeverDepth=0,THREE.AlwaysDepth=1,THREE.LessDepth=2,THREE.LessEqualDepth=3,THREE.EqualDepth=4,THREE.GreaterEqualDepth=5,THREE.GreaterDepth=6,THREE.NotEqualDepth=7,THREE.MultiplyOperation=0,THREE.MixOperation=1,THREE.AddOperation=2,THREE.UVMapping=300,THREE.CubeReflectionMapping=301,THREE.CubeRefractionMapping=302,THREE.EquirectangularReflectionMapping=303,THREE.EquirectangularRefractionMapping=304,THREE.SphericalReflectionMapping=305,THREE.RepeatWrapping=1e3,THREE.ClampToEdgeWrapping=1001,THREE.MirroredRepeatWrapping=1002,THREE.NearestFilter=1003,THREE.NearestMipMapNearestFilter=1004,THREE.NearestMipMapLinearFilter=1005,THREE.LinearFilter=1006,THREE.LinearMipMapNearestFilter=1007,THREE.LinearMipMapLinearFilter=1008,THREE.UnsignedByteType=1009,THREE.ByteType=1010,THREE.ShortType=1011,THREE.UnsignedShortType=1012,THREE.IntType=1013,THREE.UnsignedIntType=1014,THREE.FloatType=1015,THREE.HalfFloatType=1025,THREE.UnsignedShort4444Type=1016,THREE.UnsignedShort5551Type=1017,THREE.UnsignedShort565Type=1018,THREE.AlphaFormat=1019,THREE.RGBFormat=1020,THREE.RGBAFormat=1021,THREE.LuminanceFormat=1022,THREE.LuminanceAlphaFormat=1023,THREE.RGBEFormat=THREE.RGBAFormat,THREE.RGB_S3TC_DXT1_Format=2001,THREE.RGBA_S3TC_DXT1_Format=2002,THREE.RGBA_S3TC_DXT3_Format=2003,THREE.RGBA_S3TC_DXT5_Format=2004,THREE.RGB_PVRTC_4BPPV1_Format=2100,THREE.RGB_PVRTC_2BPPV1_Format=2101,THREE.RGBA_PVRTC_4BPPV1_Format=2102,THREE.RGBA_PVRTC_2BPPV1_Format=2103,THREE.LoopOnce=2200,THREE.LoopRepeat=2201,THREE.LoopPingPong=2202,THREE.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(t,e){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},THREE.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(){}},THREE.Color=function(t){return 3===arguments.length?this.fromArray(arguments):this.set(t)},THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(t){return t instanceof THREE.Color?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,r){return this.r=t,this.g=e,this.b=r,this},setHSL:function(){function i(t,e,r){return r<0&&(r+=1),1<r&&--r,r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+6*(e-t)*(2/3-r):t}return function(t,e,r){return t=THREE.Math.euclideanModulo(t,1),e=THREE.Math.clamp(e,0,1),r=THREE.Math.clamp(r,0,1),0===e?this.r=this.g=this.b=r:(r=2*r-(e=r<=.5?r*(1+e):r+e-r*e),this.r=i(r,e,t+1/3),this.g=i(r,e,t),this.b=i(r,e,t-1/3)),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 i=r[2];switch(r[1]){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,t(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,t(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i)){var i=parseFloat(r[1])/360,n=parseInt(r[2],10)/100,o=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(i,n,o)}}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(e)){if(3===(i=(r=r[1]).length))return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,this;if(6===i)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,this}return e&&0<e.length&&(void 0!==(r=THREE.ColorKeywords[e])?this.setHex(r):console.warn("THREE.Color: Unknown color "+e)),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var r=0<e?1/e:1;return this.r=Math.pow(t.r,r),this.g=Math.pow(t.g,r),this.b=Math.pow(t.b,r),this},convertGammaToLinear:function(){var t=this.r,e=this.g,r=this.b;return this.r=t*t,this.g=e*e,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(t){t=t||{h:0,s:0,l:0};var e,r=this.r,i=this.g,n=this.b,o=Math.max(r,i,n),a=((h=Math.min(r,i,n))+o)/2;if(h===o)h=e=0;else{var s=o-h,h=a<=.5?s/(o+h):s/(2-o-h);switch(o){case r:e=(i-n)/s+(i<n?6:0);break;case i:e=(n-r)/s+2;break;case n:e=(r-i)/s+4}e/=6}return t.h=e,t.s=h,t.l=a,t},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,r){var i=this.getHSL();return i.h+=t,i.s+=e,i.l+=r,this.setHSL(i.h,i.s,i.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}},THREE.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},THREE.Quaternion=function(t,e,r,i){this._x=t||0,this._y=e||0,this._z=r||0,this._w=void 0!==i?i:1},THREE.Quaternion.prototype={constructor:THREE.Quaternion,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get w(){return this._w},set w(t){this._w=t,this.onChangeCallback()},set:function(t,e,r,i){return this._x=t,this._y=e,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(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!1==t instanceof THREE.Euler)throw Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var r=Math.cos(t._x/2),i=Math.cos(t._y/2),n=Math.cos(t._z/2),o=Math.sin(t._x/2),a=Math.sin(t._y/2),s=Math.sin(t._z/2),h=t.order;return"XYZ"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n-o*a*s):"YXZ"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n+o*a*s):"ZXY"===h?(this._x=o*i*n-r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n-o*a*s):"ZYX"===h?(this._x=o*i*n-r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n+o*a*s):"YZX"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n-o*a*s):"XZY"===h&&(this._x=o*i*n-r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n+o*a*s),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var r=e/2,i=Math.sin(r);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e=t.elements,r=e[0];t=e[4];var i=e[8],n=e[1],o=e[5],a=e[9],s=e[2],h=e[6],c=r+o+(e=e[10]);return 0<c?(r=.5/Math.sqrt(c+1),this._w=.25/r,this._x=(h-a)*r,this._y=(i-s)*r,this._z=(n-t)*r):o<r&&e<r?(r=2*Math.sqrt(1+r-o-e),this._w=(h-a)/r,this._x=.25*r,this._y=(t+n)/r,this._z=(i+s)/r):e<o?(r=2*Math.sqrt(1+o-r-e),this._w=(i-s)/r,this._x=(t+n)/r,this._y=.25*r,this._z=(a+h)/r):(r=2*Math.sqrt(1+e-r-o),this._w=(n-t)/r,this._x=(i+s)/r,this._y=(a+h)/r,this._z=.25*r),this.onChangeCallback(),this},setFromUnitVectors:function(){var r,i;return function(t,e){return void 0===r&&(r=new THREE.Vector3),(i=t.dot(e)+1)<1e-6?(i=0,Math.abs(t.x)>Math.abs(t.z)?r.set(-t.y,t.x,0):r.set(0,-t.z,t.y)):r.crossVectors(t,e),this._x=r.x,this._y=r.y,this._z=r.z,this._w=i,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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._z=this._y=this._x=0,this._w=1):(t=1/t,this._x*=t,this._y*=t,this._z*=t,this._w*=t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},multiplyQuaternions:function(t,e){var r=t._x,i=t._y,n=t._z,o=t._w,a=e._x,s=e._y,h=e._z,c=e._w;return this._x=r*c+o*a+i*h-n*s,this._y=i*c+o*s+n*a-r*h,this._z=n*c+o*h+r*s-i*a,this._w=o*c-r*a-i*s-n*h,this.onChangeCallback(),this},multiplyVector3:function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var r=this._x,i=this._y,n=this._z,o=this._w,a=o*t._w+r*t._x+i*t._y+n*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),1<=a)return this._w=o,this._x=r,this._y=i,this._z=n,this;var s=Math.acos(a),h=Math.sqrt(1-a*a);return Math.abs(h)<.001?(this._w=.5*(o+this._w),this._x=.5*(r+this._x),this._y=.5*(i+this._y),this._z=.5*(n+this._z)):(a=Math.sin((1-e)*s)/h,s=Math.sin(e*s)/h,this._w=o*a+this._w*s,this._x=r*a+this._x*s,this._y=i*a+this._y*s,this._z=n*a+this._z*s,this.onChangeCallback()),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},THREE.Quaternion.slerp=function(t,e,r,i){return r.copy(t).slerp(e,i)},THREE.Vector2=function(t,e){this.x=t||0,this.y=e||0},THREE.Vector2.prototype={constructor:THREE.Vector2,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):this.y=this.x=0,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var r,i;return function(t,e){return void 0===r&&(r=new THREE.Vector2,i=new THREE.Vector2),r.set(t,t),i.set(e,e),this.clamp(r,i)}}(),clampLength:function(t,e){var r=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.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())},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x;return e*e+(t=this.y-t.y)*t},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t),this},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this},rotateAround:function(t,e){var r=Math.cos(e),i=Math.sin(e),n=this.x-t.x,o=this.y-t.y;return this.x=n*r-o*i+t.x,this.y=n*i+o*r+t.y,this}},THREE.Vector3=function(t,e,r){this.x=t||0,this.y=e||0,this.z=r||0},THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(t,e,r){return this.x=t,this.y=e,this.z=r,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):this.z=this.y=this.x=0,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var e;return function(t){return!1==t instanceof THREE.Euler&&console.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new THREE.Quaternion),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var r;return function(t,e){return void 0===r&&(r=new THREE.Quaternion),this.applyQuaternion(r.setFromAxisAngle(t,e)),this}}(),applyMatrix3:function(t){var e=this.x,r=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[3]*r+t[6]*i,this.y=t[1]*e+t[4]*r+t[7]*i,this.z=t[2]*e+t[5]*r+t[8]*i,this},applyMatrix4:function(t){var e=this.x,r=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*i+t[12],this.y=t[1]*e+t[5]*r+t[9]*i+t[13],this.z=t[2]*e+t[6]*r+t[10]*i+t[14],this},applyProjection:function(t){var e=this.x,r=this.y,i=this.z,n=1/((t=t.elements)[3]*e+t[7]*r+t[11]*i+t[15]);return this.x=(t[0]*e+t[4]*r+t[8]*i+t[12])*n,this.y=(t[1]*e+t[5]*r+t[9]*i+t[13])*n,this.z=(t[2]*e+t[6]*r+t[10]*i+t[14])*n,this},applyQuaternion:function(t){var e=this.x,r=this.y,i=this.z,n=t.x,o=t.y,a=t.z,s=(t=t.w)*e+o*i-a*r,h=t*r+a*e-n*i,c=t*i+n*r-o*e,e=-n*e-o*r-a*i;return this.x=s*t+e*-n+h*-a-c*-o,this.y=h*t+e*-o+c*-n-s*-a,this.z=c*t+e*-a+s*-o-h*-n,this},project:function(){var e;return function(t){return void 0===e&&(e=new THREE.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 THREE.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(t){var e=this.x,r=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*i,this.y=t[1]*e+t[5]*r+t[9]*i,this.z=t[2]*e+t[6]*r+t[10]*i,this.normalize(),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var r,i;return function(t,e){return void 0===r&&(r=new THREE.Vector3,i=new THREE.Vector3),r.set(t,t,t),i.set(e,e,e),this.clamp(r,i)}}(),clampLength:function(t,e){var r=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t),this},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var r=this.x,i=this.y,n=this.z;return this.x=i*t.z-n*t.y,this.y=n*t.x-r*t.z,this.z=r*t.y-i*t.x,this},crossVectors:function(t,e){var r=t.x,i=t.y,n=t.z,o=e.x,a=e.y,s=e.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,r;return function(t){return void 0===e&&(e=new THREE.Vector3),e.copy(t).normalize(),r=this.dot(e),this.copy(e).multiplyScalar(r)}}(),projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new THREE.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new THREE.Vector3),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(t){return t=this.dot(t)/(this.length()*t.length()),Math.acos(THREE.Math.clamp(t,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r+(t=this.z-t.z)*t},setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},setFromMatrixPosition:function(t){return this.x=t.elements[12],this.y=t.elements[13],this.z=t.elements[14],this},setFromMatrixScale:function(t){var e=this.set(t.elements[0],t.elements[1],t.elements[2]).length(),r=this.set(t.elements[4],t.elements[5],t.elements[6]).length();return t=this.set(t.elements[8],t.elements[9],t.elements[10]).length(),this.x=e,this.y=r,this.z=t,this},setFromMatrixColumn:function(t,e){var r=4*t,i=e.elements;return this.x=i[r],this.y=i[1+r],this.z=i[2+r],this},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}},THREE.Vector4=function(t,e,r,i){this.x=t||0,this.y=e||0,this.z=r||0,this.w=void 0!==i?i:1},THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):this.w=this.z=this.y=this.x=0,this},applyMatrix4:function(t){var e=this.x,r=this.y,i=this.z,n=this.w;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*i+t[12]*n,this.y=t[1]*e+t[5]*r+t[9]*i+t[13]*n,this.z=t[2]*e+t[6]*r+t[10]*i+t[14]*n,this.w=t[3]*e+t[7]*r+t[11]*i+t[15]*n,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.z=this.y=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e=(t=t.elements)[0],r=t[4],i=t[8],n=t[1],o=t[5],a=t[9],s=t[2],h=t[6],c=t[10];return Math.abs(r-n)<.01&&Math.abs(i-s)<.01&&Math.abs(a-h)<.01?Math.abs(r+n)<.1&&Math.abs(i+s)<.1&&Math.abs(a+h)<.1&&Math.abs(e+o+c-3)<.1?this.set(1,0,0,0):(t=Math.PI,c=(c+1)/2,r=(r+n)/4,i=(i+s)/4,a=(a+h)/4,(o=(o+1)/2)<(e=(e+1)/2)&&c<e?r=e<.01?(h=0,s=.707106781):(s=r/(h=Math.sqrt(e)),i/h):c<o?r=o<.01?(s=0,h=.707106781):(h=r/(s=Math.sqrt(o)),a/s):c<.01?(s=h=.707106781,r=0):(h=i/(r=Math.sqrt(c)),s=a/r),this.set(h,s,r,t)):(t=Math.sqrt((h-a)*(h-a)+(i-s)*(i-s)+(n-r)*(n-r)),Math.abs(t)<.001&&(t=1),this.x=(h-a)/t,this.y=(i-s)/t,this.z=(n-r)/t,this.w=Math.acos((e+o+c-1)/2)),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var r,i;return function(t,e){return void 0===r&&(r=new THREE.Vector4,i=new THREE.Vector4),r.set(t,t,t,t),i.set(e,e,e,e),this.clamp(r,i)}}(),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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t),this},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this.w=t.array[e+3],this}},THREE.Euler=function(t,e,r,i){this._x=t||0,this._y=e||0,this._z=r||0,this._order=i||THREE.Euler.DefaultOrder},THREE.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),THREE.Euler.DefaultOrder="XYZ",THREE.Euler.prototype={constructor:THREE.Euler,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get order(){return this._order},set order(t){this._order=t,this.onChangeCallback()},set:function(t,e,r,i){return this._x=t,this._y=e,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(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,r){var i=THREE.Math.clamp;t=(l=t.elements)[0];var n=l[4],o=l[8],a=l[1],s=l[5],h=l[9],c=l[2],u=l[6],l=l[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(i(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(-h,l),this._z=Math.atan2(-n,t)):(this._x=Math.atan2(u,s),this._z=0)):"YXZ"===e?(this._x=Math.asin(-i(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(o,l),this._z=Math.atan2(a,s)):(this._y=Math.atan2(-c,t),this._z=0)):"ZXY"===e?(this._x=Math.asin(i(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(-c,l),this._z=Math.atan2(-n,s)):(this._y=0,this._z=Math.atan2(a,t))):"ZYX"===e?(this._y=Math.asin(-i(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(u,l),this._z=Math.atan2(a,t)):(this._x=0,this._z=Math.atan2(-n,s))):"YZX"===e?(this._z=Math.asin(i(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(-h,s),this._y=Math.atan2(-c,t)):(this._x=0,this._y=Math.atan2(o,l))):"XZY"===e?(this._z=Math.asin(-i(n,-1,1)),Math.abs(n)<.99999?(this._x=Math.atan2(u,s),this._y=Math.atan2(o,t)):(this._x=Math.atan2(-h,l),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:function(){var i;return function(t,e,r){return void 0===i&&(i=new THREE.Matrix4),i.makeRotationFromQuaternion(t),this.setFromRotationMatrix(i,e,r),this}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var e=new THREE.Quaternion;return function(t){e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new THREE.Vector3(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},THREE.Line3=function(t,e){this.start=void 0!==t?t:new THREE.Vector3,this.end=void 0!==e?e:new THREE.Vector3},THREE.Line3.prototype={constructor:THREE.Line3,set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},center:function(t){return(t||new THREE.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new THREE.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var r=e||new THREE.Vector3;return this.delta(r).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var i=new THREE.Vector3,n=new THREE.Vector3;return function(t,e){i.subVectors(t,this.start),n.subVectors(this.end,this.start);var r=n.dot(n),r=n.dot(i)/r;return e&&(r=THREE.Math.clamp(r,0,1)),r}}(),closestPointToPoint:function(t,e,r){return t=this.closestPointToPointParameter(t,e),r=r||new THREE.Vector3,this.delta(r).multiplyScalar(t).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},THREE.Box2=function(t,e){this.min=void 0!==t?t:new THREE.Vector2(1/0,1/0),this.max=void 0!==e?e:new THREE.Vector2(-1/0,-1/0)},THREE.Box2.prototype={constructor:THREE.Box2,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var i=new THREE.Vector2;return function(t,e){var r=i.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(t){return(t||new THREE.Vector2).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){return(t||new THREE.Vector2).subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new THREE.Vector2).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return(e||new THREE.Vector2).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var e=new THREE.Vector2;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},THREE.Box3=function(t,e){this.min=void 0!==t?t:new THREE.Vector3(1/0,1/0,1/0),this.max=void 0!==e?e:new THREE.Vector3(-1/0,-1/0,-1/0)},THREE.Box3.prototype={constructor:THREE.Box3,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var i=new THREE.Vector3;return function(t,e){var r=i.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this}}(),setFromObject:function(){var o=new THREE.Vector3;return function(t){var n=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse(function(t){if(void 0!==(r=t.geometry))if(r instanceof THREE.Geometry)for(var e=r.vertices,r=0,i=e.length;r<i;r++)o.copy(e[r]),o.applyMatrix4(t.matrixWorld),n.expandByPoint(o);else if(r instanceof THREE.BufferGeometry&&void 0!==r.attributes.position)for(e=r.attributes.position.array,r=0,i=e.length;r<i;r+=3)o.set(e[r],e[r+1],e[r+2]),o.applyMatrix4(t.matrixWorld),n.expandByPoint(o)}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.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},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(t){return(t||new THREE.Vector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){return(t||new THREE.Vector3).subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new THREE.Vector3).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},clampPoint:function(t,e){return(e||new THREE.Vector3).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var e=new THREE.Vector3;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var e=new THREE.Vector3;return function(t){return(t=t||new THREE.Sphere).center=this.center(),t.radius=.5*this.size(e).length(),t}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var e=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.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(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},THREE.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(t,e,r,i,n,o,a,s,h){var c=this.elements;return c[0]=t,c[3]=e,c[6]=r,c[1]=i,c[4]=n,c[7]=o,c[2]=a,c[5]=s,c[8]=h,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(t){return t=t.elements,this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToVector3Array:function(){var n;return function(t,e,r){void 0===n&&(n=new THREE.Vector3),void 0===e&&(e=0),void 0===r&&(r=t.length);for(var i=0;i<r;i+=3,e+=3)n.fromArray(t,e),n.applyMatrix3(this),n.toArray(t,e);return t}}(),applyToBuffer:function(){var n;return function(t,e,r){void 0===n&&(n=new THREE.Vector3),void 0===e&&(e=0),void 0===r&&(r=t.length/t.itemSize);for(var i=0;i<r;i++,e++)n.x=t.getX(e),n.y=t.getY(e),n.z=t.getZ(e),n.applyMatrix3(this),t.setXYZ(n.x,n.y,n.z);return t}}(),multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],r=t[1],i=t[2],n=t[3],o=t[4],a=t[5],s=t[6],h=t[7];return e*o*(t=t[8])-e*a*h-r*n*t+r*a*s+i*n*h-i*o*s},getInverse:function(t,e){var r=t.elements,i=this.elements;if(i[0]=r[10]*r[5]-r[6]*r[9],i[1]=-r[10]*r[1]+r[2]*r[9],i[2]=r[6]*r[1]-r[2]*r[5],i[3]=-r[10]*r[4]+r[6]*r[8],i[4]=r[10]*r[0]-r[2]*r[8],i[5]=-r[6]*r[0]+r[2]*r[4],i[6]=r[9]*r[4]-r[5]*r[8],i[7]=-r[9]*r[0]+r[1]*r[8],i[8]=r[5]*r[0]-r[1]*r[4],0!=(r=r[0]*i[0]+r[1]*i[3]+r[2]*i[6]))return this.multiplyScalar(1/r),this;if(e)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");return console.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0"),this.identity(),this},transpose:function(){var t=this.elements,e=t[1];return 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(t,e){var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t},getNormalMatrix:function(t){return this.getInverse(t).transpose(),this},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},fromArray:function(t){return this.elements.set(t),this},toArray:function(){var t=this.elements;return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]}},THREE.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(t,e,r,i,n,o,a,s,h,c,u,l,E,p,d,f){var m=this.elements;return m[0]=t,m[4]=e,m[8]=r,m[12]=i,m[1]=n,m[5]=o,m[9]=a,m[13]=s,m[2]=h,m[6]=c,m[10]=u,m[14]=l,m[3]=E,m[7]=p,m[11]=d,m[15]=f,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 THREE.Matrix4).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},copyPosition:function(t){var e=this.elements;return t=t.elements,e[12]=t[12],e[13]=t[13],e[14]=t[14],this},extractBasis:function(t,e,r){var i=this.elements;return t.set(i[0],i[1],i[2]),e.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},makeBasis:function(t,e,r){return this.set(t.x,e.x,r.x,0,t.y,e.y,r.y,0,t.z,e.z,r.z,0,0,0,0,1),this},extractRotation:function(){var o;return function(t){void 0===o&&(o=new THREE.Vector3);var e=this.elements;t=t.elements;var r=1/o.set(t[0],t[1],t[2]).length(),i=1/o.set(t[4],t[5],t[6]).length(),n=1/o.set(t[8],t[9],t[10]).length();return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,this}}(),makeRotationFromEuler:function(t){!1==t instanceof THREE.Euler&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e,r,i,n=this.elements,o=t.x,a=t.y,s=t.z,h=Math.cos(o),o=Math.sin(o),c=Math.cos(a),a=Math.sin(a),u=Math.cos(s),s=Math.sin(s);return"XYZ"===t.order?(t=h*u,e=h*s,r=o*u,i=o*s,n[0]=c*u,n[4]=-c*s,n[8]=a,n[1]=e+r*a,n[5]=t-i*a,n[9]=-o*c,n[2]=i-t*a,n[6]=r+e*a,n[10]=h*c):"YXZ"===t.order?(t=c*u,e=c*s,r=a*u,i=a*s,n[0]=t+i*o,n[4]=r*o-e,n[8]=h*a,n[1]=h*s,n[5]=h*u,n[9]=-o,n[2]=e*o-r,n[6]=i+t*o,n[10]=h*c):"ZXY"===t.order?(t=c*u,e=c*s,r=a*u,i=a*s,n[0]=t-i*o,n[4]=-h*s,n[8]=r+e*o,n[1]=e+r*o,n[5]=h*u,n[9]=i-t*o,n[2]=-h*a,n[6]=o,n[10]=h*c):"ZYX"===t.order?(t=h*u,e=h*s,r=o*u,i=o*s,n[0]=c*u,n[4]=r*a-e,n[8]=t*a+i,n[1]=c*s,n[5]=i*a+t,n[9]=e*a-r,n[2]=-a,n[6]=o*c,n[10]=h*c):"YZX"===t.order?(t=h*c,e=h*a,r=o*c,i=o*a,n[0]=c*u,n[4]=i-t*s,n[8]=r*s+e,n[1]=s,n[5]=h*u,n[9]=-o*u,n[2]=-a*u,n[6]=e*s+r,n[10]=t-i*s):"XZY"===t.order&&(t=h*c,e=h*a,r=o*c,i=o*a,n[0]=c*u,n[4]=-s,n[8]=a*u,n[1]=t*s+i,n[5]=h*u,n[9]=e*s-r,n[2]=r*s-e,n[6]=o*u,n[10]=i*s+t),n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this},setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},makeRotationFromQuaternion:function(t){var e=this.elements,r=t.x,i=t.y,n=t.z,o=t.w,a=n+n;t=r*(c=r+r);var s=r*(u=i+i),r=r*a,h=i*u,i=i*a,n=n*a,c=o*c,u=o*u,o=o*a;return e[0]=1-(h+n),e[4]=s-o,e[8]=r+u,e[1]=s+o,e[5]=1-(t+n),e[9]=i-c,e[2]=r-u,e[6]=i+c,e[10]=1-(t+h),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var n,o,a;return function(t,e,r){void 0===n&&(n=new THREE.Vector3),void 0===o&&(o=new THREE.Vector3),void 0===a&&(a=new THREE.Vector3);var i=this.elements;return a.subVectors(t,e).normalize(),0===a.lengthSq()&&(a.z=1),n.crossVectors(r,a).normalize(),0===n.lengthSq()&&(a.x+=1e-4,n.crossVectors(r,a).normalize()),o.crossVectors(a,n),i[0]=n.x,i[4]=o.x,i[8]=a.x,i[1]=n.y,i[5]=o.y,i[9]=a.y,i[2]=n.z,i[6]=o.z,i[10]=a.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},multiplyMatrices:function(t,e){var r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[4],s=r[8],h=r[12],c=r[1],u=r[5],l=r[9],E=r[13],p=r[2],d=r[6],f=r[10],m=r[14],T=r[3],g=r[7],y=r[11],r=r[15],R=i[0],v=i[4],H=i[8],x=i[12],b=i[1],w=i[5],M=i[9],S=i[13],_=i[2],A=i[6],C=i[10],L=i[14],P=i[3],D=i[7],k=i[11],i=i[15];return n[0]=o*R+a*b+s*_+h*P,n[4]=o*v+a*w+s*A+h*D,n[8]=o*H+a*M+s*C+h*k,n[12]=o*x+a*S+s*L+h*i,n[1]=c*R+u*b+l*_+E*P,n[5]=c*v+u*w+l*A+E*D,n[9]=c*H+u*M+l*C+E*k,n[13]=c*x+u*S+l*L+E*i,n[2]=p*R+d*b+f*_+m*P,n[6]=p*v+d*w+f*A+m*D,n[10]=p*H+d*M+f*C+m*k,n[14]=p*x+d*S+f*L+m*i,n[3]=T*R+g*b+y*_+r*P,n[7]=T*v+g*w+y*A+r*D,n[11]=T*H+g*M+y*C+r*k,n[15]=T*x+g*S+y*L+r*i,this},multiplyToArray:function(t,e,r){var i=this.elements;return this.multiplyMatrices(t,e),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(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),t.applyProjection(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToVector3Array:function(){var n;return function(t,e,r){void 0===n&&(n=new THREE.Vector3),void 0===e&&(e=0),void 0===r&&(r=t.length);for(var i=0;i<r;i+=3,e+=3)n.fromArray(t,e),n.applyMatrix4(this),n.toArray(t,e);return t}}(),applyToBuffer:function(){var n;return function(t,e,r){void 0===n&&(n=new THREE.Vector3),void 0===e&&(e=0),void 0===r&&(r=t.length/t.itemSize);for(var i=0;i<r;i++,e++)n.x=t.getX(e),n.y=t.getY(e),n.z=t.getZ(e),n.applyMatrix4(this),t.setXYZ(n.x,n.y,n.z);return t}}(),rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},determinant:function(){var t=this.elements,e=t[0],r=t[4],i=t[8],n=t[12],o=t[1],a=t[5],s=t[9],h=t[13],c=t[2],u=t[6],l=t[10],E=t[14];return t[3]*(n*s*u-i*h*u-n*a*l+r*h*l+i*a*E-r*s*E)+t[7]*(e*s*E-e*h*l+n*o*l-i*o*E+i*h*c-n*s*c)+t[11]*(e*h*u-e*a*E-n*o*u+r*o*E+n*a*c-r*h*c)+t[15]*(-i*a*c-e*s*u+e*a*l+i*o*u-r*o*l+r*s*c)},transpose:function(){var t=this.elements,e=t[1];return 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(t,e){var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15],t},getPosition:function(){var e;return function(){void 0===e&&(e=new THREE.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var t=this.elements;return e.set(t[12],t[13],t[14])}}(),setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var r=this.elements,i=(g=t.elements)[0],n=g[4],o=g[8],a=g[12],s=g[1],h=g[5],c=g[9],u=g[13],l=g[2],E=g[6],p=g[10],d=g[14],f=g[3],m=g[7],T=g[11],g=g[15];if(r[0]=c*d*m-u*p*m+u*E*T-h*d*T-c*E*g+h*p*g,r[4]=a*p*m-o*d*m-a*E*T+n*d*T+o*E*g-n*p*g,r[8]=o*u*m-a*c*m+a*h*T-n*u*T-o*h*g+n*c*g,r[12]=a*c*E-o*u*E-a*h*p+n*u*p+o*h*d-n*c*d,r[1]=u*p*f-c*d*f-u*l*T+s*d*T+c*l*g-s*p*g,r[5]=o*d*f-a*p*f+a*l*T-i*d*T-o*l*g+i*p*g,r[9]=a*c*f-o*u*f-a*s*T+i*u*T+o*s*g-i*c*g,r[13]=o*u*l-a*c*l+a*s*p-i*u*p-o*s*d+i*c*d,r[2]=h*d*f-u*E*f+u*l*m-s*d*m-h*l*g+s*E*g,r[6]=a*E*f-n*d*f-a*l*m+i*d*m+n*l*g-i*E*g,r[10]=n*u*f-a*h*f+a*s*m-i*u*m-n*s*g+i*h*g,r[14]=a*h*l-n*u*l-a*s*E+i*u*E+n*s*d-i*h*d,r[3]=c*E*f-h*p*f-c*l*m+s*p*m+h*l*T-s*E*T,r[7]=n*p*f-o*E*f+o*l*m-i*p*m-n*l*T+i*E*T,r[11]=o*h*f-n*c*f-o*s*m+i*c*m+n*s*T-i*h*T,r[15]=n*c*l-o*h*l+o*s*E-i*c*E-n*s*p+i*h*p,0!=(r=i*r[0]+s*r[4]+l*r[8]+f*r[12]))return this.multiplyScalar(1/r),this;if(e)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"),this.identity(),this},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(t){var e=this.elements,r=t.x,i=t.y;return t=t.z,e[0]*=r,e[4]*=i,e[8]*=t,e[1]*=r,e[5]*=i,e[9]*=t,e[2]*=r,e[6]*=i,e[10]*=t,e[3]*=r,e[7]*=i,e[11]*=t,this},getMaxScaleOnAxis:function(){var t=this.elements;return Math.sqrt(Math.max(t[0]*t[0]+t[1]*t[1]+t[2]*t[2],t[4]*t[4]+t[5]*t[5]+t[6]*t[6],t[8]*t[8]+t[9]*t[9]+t[10]*t[10]))},makeTranslation:function(t,e,r){return this.set(1,0,0,t,0,1,0,e,0,0,1,r,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(1,0,0,0,0,e,-t,0,0,t,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(e,0,t,0,0,1,0,0,-t,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(e,-t,0,0,t,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var r=Math.cos(e),i=Math.sin(e),n=1-r,o=t.x,a=t.y,s=t.z,h=n*o,c=n*a;return this.set(h*o+r,h*a-i*s,h*s+i*a,0,h*a+i*s,c*a+r,c*s-i*o,0,h*s-i*a,c*s+i*o,n*s*s+r,0,0,0,0,1),this},makeScale:function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1),this},compose:function(t,e,r){return this.makeRotationFromQuaternion(e),this.scale(r),this.setPosition(t),this},decompose:function(){var h,c;return function(t,e,r){void 0===h&&(h=new THREE.Vector3),void 0===c&&(c=new THREE.Matrix4);var i=this.elements,n=h.set(i[0],i[1],i[2]).length(),o=h.set(i[4],i[5],i[6]).length(),a=h.set(i[8],i[9],i[10]).length();this.determinant()<0&&(n=-n),t.x=i[12],t.y=i[13],t.z=i[14],c.elements.set(this.elements),t=1/n;var i=1/o,s=1/a;return c.elements[0]*=t,c.elements[1]*=t,c.elements[2]*=t,c.elements[4]*=i,c.elements[5]*=i,c.elements[6]*=i,c.elements[8]*=s,c.elements[9]*=s,c.elements[10]*=s,e.setFromRotationMatrix(c),r.x=n,r.y=o,r.z=a,this}}(),makeFrustum:function(t,e,r,i,n,o){var a=this.elements;return a[0]=2*n/(e-t),a[4]=0,a[8]=(e+t)/(e-t),a[12]=0,a[1]=0,a[5]=2*n/(i-r),a[9]=(i+r)/(i-r),a[13]=0,a[2]=0,a[6]=0,a[10]=-(o+n)/(o-n),a[14]=-2*o*n/(o-n),a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(t,e,r,i){var n=-(t=r*Math.tan(THREE.Math.degToRad(.5*t)));return this.makeFrustum(n*e,t*e,n,t,r,i)},makeOrthographic:function(t,e,r,i,n,o){var a=this.elements,s=e-t,h=r-i,c=o-n;return a[0]=2/s,a[4]=0,a[8]=0,a[12]=-(e+t)/s,a[1]=0,a[5]=2/h,a[9]=0,a[13]=-(r+i)/h,a[2]=0,a[6]=0,a[10]=-2/c,a[14]=-(o+n)/c,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){var e=this.elements;t=t.elements;for(var r=0;r<16;r++)if(e[r]!==t[r])return!1;return!0},fromArray:function(t){return this.elements.set(t),this},toArray:function(){var t=this.elements;return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]}},THREE.Ray=function(t,e){this.origin=void 0!==t?t:new THREE.Vector3,this.direction=void 0!==e?e:new THREE.Vector3},THREE.Ray.prototype={constructor:THREE.Ray,set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new THREE.Vector3).copy(this.direction).multiplyScalar(t).add(this.origin)},recast:function(){var e=new THREE.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(t,e){var r=e||new THREE.Vector3;r.subVectors(t,this.origin);var i=r.dot(this.direction);return i<0?r.copy(this.origin):r.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var r=new THREE.Vector3;return function(t){var e=r.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(r.copy(this.direction).multiplyScalar(e).add(this.origin),r.distanceToSquared(t))}}(),distanceSqToSegment:function(){var l=new THREE.Vector3,E=new THREE.Vector3,p=new THREE.Vector3;return function(t,e,r,i){l.copy(t).add(e).multiplyScalar(.5),E.copy(e).sub(t).normalize(),p.copy(this.origin).sub(l);var n,o=.5*t.distanceTo(e),a=-this.direction.dot(E),s=p.dot(this.direction),h=-p.dot(E),c=p.lengthSq(),u=Math.abs(1-a*a),a=0<u?(e=a*s-h,n=o*u,0<=(t=a*h-s)?-n<=e?e<=n?(t*=o=1/u)*(t+a*(e*=o)+2*s)+e*(a*t+e+2*h)+c:(e=o,-(t=Math.max(0,-(a*e+s)))*t+e*(e+2*h)+c):(e=-o,-(t=Math.max(0,-(a*e+s)))*t+e*(e+2*h)+c):e<=-n?-(t=Math.max(0,-(-a*o+s)))*t+(e=0<t?-o:Math.min(Math.max(-o,-h),o))*(e+2*h)+c:e<=n?(t=0,(e=Math.min(Math.max(-o,-h),o))*(e+2*h)+c):-(t=Math.max(0,-(a*o+s)))*t+(e=0<t?o:Math.min(Math.max(-o,-h),o))*(e+2*h)+c):(e=0<a?-o:o,-(t=Math.max(0,-(a*e+s)))*t+e*(e+2*h)+c);return r&&r.copy(this.direction).multiplyScalar(t).add(this.origin),i&&i.copy(E).multiplyScalar(e).add(l),a}}(),isIntersectionSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},intersectSphere:function(){var o=new THREE.Vector3;return function(t,e){o.subVectors(t.center,this.origin);var r=o.dot(this.direction),i=o.dot(o)-r*r,n=t.radius*t.radius;return n<i?null:(i=r-(n=Math.sqrt(n-i)),r+=n,i<0&&r<0?null:i<0?this.at(r,e):this.at(i,e))}}(),isIntersectionPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},distanceToPlane:function(t){var e=t.normal.dot(this.direction);return 0===e?0===t.distanceToPoint(this.origin)?0:null:0<=(t=-(this.origin.dot(t.normal)+t.constant)/e)?t:null},intersectPlane:function(t,e){var r=this.distanceToPlane(t);return null===r?null:this.at(r,e)},isIntersectionBox:function(){var e=new THREE.Vector3;return function(t){return null!==this.intersectBox(t,e)}}(),intersectBox:function(t,e){var r,i,n=1/this.direction.x,o=1/this.direction.y,a=1/this.direction.z,s=this.origin;return 0<=n?(r=(t.min.x-s.x)*n,n*=t.max.x-s.x):(r=(t.max.x-s.x)*n,n*=t.min.x-s.x),0<=o?(i=(t.min.y-s.y)*o,o*=t.max.y-s.y):(i=(t.max.y-s.y)*o,o*=t.min.y-s.y),o<r||n<i?null:((r<i||r!=r)&&(r=i),(o<n||n!=n)&&(n=o),0<=a?(i=(t.min.z-s.z)*a,a*=t.max.z-s.z):(i=(t.max.z-s.z)*a,a*=t.min.z-s.z),a<r||n<i?null:((r<i||r!=r)&&(r=i),(a<n||n!=n)&&(n=a),n<0?null:this.at(0<=r?r:n,e)))},intersectTriangle:function(){var o=new THREE.Vector3,a=new THREE.Vector3,s=new THREE.Vector3,h=new THREE.Vector3;return function(t,e,r,i,n){if(a.subVectors(e,t),s.subVectors(r,t),h.crossVectors(a,s),0<(e=this.direction.dot(h))){if(i)return null;i=1}else{if(!(e<0))return null;i=-1,e=-e}return o.subVectors(this.origin,t),(t=i*this.direction.dot(s.crossVectors(o,s)))<0||(r=i*this.direction.dot(a.cross(o)))<0||e<t+r||(t=-i*o.dot(h))<0?null:this.at(t/e,n)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},THREE.Sphere=function(t,e){this.center=void 0!==t?t:new THREE.Vector3,this.radius=void 0!==e?e:0},THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var a=new THREE.Box3;return function(t,e){var r=this.center;void 0!==e?r.copy(e):a.setFromPoints(t).center(r);for(var i=0,n=0,o=t.length;n<o;n++)i=Math.max(i,r.distanceToSquared(t[n]));return this.radius=Math.sqrt(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},clampPoint:function(t,e){var r=this.center.distanceToSquared(t),i=e||new THREE.Vector3;return i.copy(t),r>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(t){return(t=t||new THREE.Box3).set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius*=t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},THREE.Frustum=function(t,e,r,i,n,o){this.planes=[void 0!==t?t:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==r?r:new THREE.Plane,void 0!==i?i:new THREE.Plane,void 0!==n?n:new THREE.Plane,void 0!==o?o:new THREE.Plane]},THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(t,e,r,i,n,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),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(t){for(var e=this.planes,r=0;r<6;r++)e[r].copy(t.planes[r]);return this},setFromMatrix:function(t){var e=this.planes;t=(m=t.elements)[0];var r=m[1],i=m[2],n=m[3],o=m[4],a=m[5],s=m[6],h=m[7],c=m[8],u=m[9],l=m[10],E=m[11],p=m[12],d=m[13],f=m[14],m=m[15];return e[0].setComponents(n-t,h-o,E-c,m-p).normalize(),e[1].setComponents(n+t,h+o,E+c,m+p).normalize(),e[2].setComponents(n+r,h+a,E+u,m+d).normalize(),e[3].setComponents(n-r,h-a,E-u,m-d).normalize(),e[4].setComponents(n-i,h-s,E-l,m-f).normalize(),e[5].setComponents(n+i,h+s,E+l,m+f).normalize(),this},intersectsObject:function(){var r=new THREE.Sphere;return function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),r.copy(e.boundingSphere),r.applyMatrix4(t.matrixWorld),this.intersectsSphere(r)}}(),intersectsSphere:function(t){var e=this.planes,r=t.center;t=-t.radius;for(var i=0;i<6;i++)if(e[i].distanceToPoint(r)<t)return!1;return!0},intersectsBox:function(){var o=new THREE.Vector3,a=new THREE.Vector3;return function(t){for(var e=this.planes,r=0;r<6;r++){var i=e[r];o.x=0<i.normal.x?t.min.x:t.max.x,a.x=0<i.normal.x?t.max.x:t.min.x,o.y=0<i.normal.y?t.min.y:t.max.y,a.y=0<i.normal.y?t.max.y:t.min.y,o.z=0<i.normal.z?t.min.z:t.max.z,a.z=0<i.normal.z?t.max.z:t.min.z;var n=i.distanceToPoint(o),i=i.distanceToPoint(a);if(n<0&&i<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,r=0;r<6;r++)if(e[r].distanceToPoint(t)<0)return!1;return!0}},THREE.Plane=function(t,e){this.normal=void 0!==t?t:new THREE.Vector3(1,0,0),this.constant=void 0!==e?e:0},THREE.Plane.prototype={constructor:THREE.Plane,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,r,i){return this.normal.set(t,e,r),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var i=new THREE.Vector3,n=new THREE.Vector3;return function(t,e,r){return e=i.subVectors(r,e).cross(n.subVectors(t,e)).normalize(),this.setFromNormalAndCoplanarPoint(e,t),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var r=this.distanceToPoint(t);return(e||new THREE.Vector3).copy(this.normal).multiplyScalar(r)},isIntersectionLine:function(t){var e=this.distanceToPoint(t.start);return t=this.distanceToPoint(t.end),e<0&&0<t||t<0&&0<e},intersectLine:function(){var o=new THREE.Vector3;return function(t,e){var r=e||new THREE.Vector3,i=t.delta(o),n=this.normal.dot(i);return 0!==n?(n=-(t.start.dot(this.normal)+this.constant)/n)<0||1<n?void 0:r.copy(i).multiplyScalar(n).add(t.start):0===this.distanceToPoint(t.start)?r.copy(t.start):void 0}}(),coplanarPoint:function(t){return(t||new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var n=new THREE.Vector3,o=new THREE.Vector3,a=new THREE.Matrix3;return function(t,e){var r=e||a.getNormalMatrix(t),r=n.copy(this.normal).applyMatrix3(r),i=this.coplanarPoint(o);return i.applyMatrix4(t),this.setFromNormalAndCoplanarPoint(r,i),this}}(),translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},THREE.Math={generateUUID:function(){var e,r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=Array(36),n=0;return function(){for(var t=0;t<36;t++)8===t||13===t||18===t||23===t?i[t]="-":14===t?i[t]="4":(n<=2&&(n=33554432+16777216*Math.random()|0),e=15&n,n>>=4,i[t]=r[19===t?3&e|8:e]);return i.join("")}}(),clamp:function(t,e,r){return Math.max(e,Math.min(r,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,r,i,n){return i+(t-e)*(n-i)/(r-e)},smoothstep:function(t,e,r){return t<=e?0:r<=t?1:(t=(t-e)/(r-e))*t*(3-2*t)},smootherstep:function(t,e,r){return t<=e?0:r<=t?1:(t=(t-e)/(r-e))*t*t*(t*(6*t-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.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(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}},THREE.Spline=function(t){function e(t,e,r,i,n,o,a){return(2*(e-r)+(t=.5*(r-t))+(i=.5*(i-e)))*a+(-3*(e-r)-2*t-i)*o+t*n+e}this.points=t;var r,i,n,o,a,s,h,c,u,l=[],E={x:0,y:0,z:0};this.initFromArray=function(t){this.points=[];for(var e=0;e<t.length;e++)this.points[e]={x:t[e][0],y:t[e][1],z:t[e][2]}},this.getPoint=function(t){return r=(this.points.length-1)*t,i=Math.floor(r),n=r-i,l[0]=0===i?i:i-1,l[1]=i,l[2]=i>this.points.length-2?this.points.length-1:i+1,l[3]=i>this.points.length-3?this.points.length-1:i+2,s=this.points[l[0]],h=this.points[l[1]],c=this.points[l[2]],u=this.points[l[3]],a=n*(o=n*n),E.x=e(s.x,h.x,c.x,u.x,n,o,a),E.y=e(s.y,h.y,c.y,u.y,n,o,a),E.z=e(s.z,h.z,c.z,u.z,n,o,a),E},this.getControlPointsArray=function(){for(var t,e=this.points.length,r=[],i=0;i<e;i++)t=this.points[i],r[i]=[t.x,t.y,t.z];return r},this.getLength=function(t){var e,r,i,n=e=0,o=new THREE.Vector3,a=new THREE.Vector3,s=[],h=0;for(s[0]=0,t=t||100,r=this.points.length*t,o.copy(this.points[0]),t=1;t<r;t++)e=t/r,i=this.getPoint(e),a.copy(i),h+=a.distanceTo(o),o.copy(i),e*=this.points.length-1,(e=Math.floor(e))!==n&&(s[e]=h,n=e);return s[s.length]=h,{chunks:s,total:h}},this.reparametrizeByArcLength=function(t){var e,r,i,n,o,a,s=[],h=new THREE.Vector3,c=this.getLength();for(s.push(h.copy(this.points[0]).clone()),e=1;e<this.points.length;e++){for(r=c.chunks[e]-c.chunks[e-1],a=Math.ceil(t*r/c.total),n=(e-1)/(this.points.length-1),o=e/(this.points.length-1),r=1;r<a-1;r++)i=n+1/a*r*(o-n),i=this.getPoint(i),s.push(h.copy(i).clone());s.push(h.copy(this.points[e]).clone())}this.points=s}},THREE.Triangle=function(t,e,r){this.a=void 0!==t?t:new THREE.Vector3,this.b=void 0!==e?e:new THREE.Vector3,this.c=void 0!==r?r:new THREE.Vector3},THREE.Triangle.normal=function(){var n=new THREE.Vector3;return function(t,e,r,i){return(i=i||new THREE.Vector3).subVectors(r,e),n.subVectors(t,e),i.cross(n),0<(t=i.lengthSq())?i.multiplyScalar(1/Math.sqrt(t)):i.set(0,0,0)}}(),THREE.Triangle.barycoordFromPoint=function(){var s=new THREE.Vector3,h=new THREE.Vector3,c=new THREE.Vector3;return function(t,e,r,i,n){s.subVectors(i,e),h.subVectors(r,e),c.subVectors(t,e),t=s.dot(s),e=s.dot(h),r=s.dot(c);var o=h.dot(h);i=h.dot(c);var a=t*o-e*e;return n=n||new THREE.Vector3,0==a?n.set(-2,-1,-1):(o=(o*r-e*i)*(a=1/a),t=(t*i-e*r)*a,n.set(1-o-t,t,o))}}(),THREE.Triangle.containsPoint=function(){var n=new THREE.Vector3;return function(t,e,r,i){return 0<=(t=THREE.Triangle.barycoordFromPoint(t,e,r,i,n)).x&&0<=t.y&&t.x+t.y<=1}}(),THREE.Triangle.prototype={constructor:THREE.Triangle,set:function(t,e,r){return this.a.copy(t),this.b.copy(e),this.c.copy(r),this},setFromPointsAndIndices:function(t,e,r,i){return this.a.copy(t[e]),this.b.copy(t[r]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new THREE.Vector3,e=new THREE.Vector3;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new THREE.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return THREE.Triangle.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new THREE.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return THREE.Triangle.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return THREE.Triangle.containsPoint(t,this.a,this.b,this.c)},equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},THREE.Channels=function(){this.mask=1},THREE.Channels.prototype={constructor:THREE.Channels,set:function(t){this.mask=1<<t},enable:function(t){this.mask|=1<<t},toggle:function(t){this.mask^=1<<t},disable:function(t){this.mask&=~(1<<t)}},THREE.Clock=function(t){this.autoStart=void 0===t||t,this.elapsedTime=this.oldTime=this.startTime=0,this.running=!1},THREE.Clock.prototype={constructor:THREE.Clock,start:function(){this.oldTime=this.startTime=self.performance.now(),this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t,e=0;return this.autoStart&&!this.running&&this.start(),this.running&&(e=.001*((t=self.performance.now())-this.oldTime),this.oldTime=t,this.elapsedTime+=e),e}},THREE.EventDispatcher=function(){},THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(t){t.addEventListener=THREE.EventDispatcher.prototype.addEventListener,t.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener,t.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener,t.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[t]&&(r[t]=[]),-1===r[t].indexOf(e)&&r[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[t]&&-1!==r[t].indexOf(e)},removeEventListener:function(t,e){var r,i;void 0!==this._listeners&&(void 0===(r=this._listeners[t])||-1!==(i=r.indexOf(e))&&r.splice(i,1))},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var r=[],i=e.length,n=0;n<i;n++)r[n]=e[n];for(n=0;n<i;n++)r[n].call(this,t)}}}},function(n){function o(t,e){return t.distance-e.distance}function a(t,e,r,i){if(!1!==t.visible&&(t.raycast(e,r),!0===i)){i=0;for(var n=(t=t.children).length;i<n;i++)a(t[i],e,r,!0)}}n.Raycaster=function(t,e,r,i){this.ray=new n.Ray(t,e),this.near=r||0,this.far=i||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}}})},n.Raycaster.prototype={constructor:n.Raycaster,linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e instanceof n.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize()):e instanceof n.OrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e){var r=[];return a(t,this,r,e),r.sort(o),r},intersectObjects:function(t,e){var r=[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),r;for(var i=0,n=t.length;i<n;i++)a(t[i],this,r,e);return r.sort(o),r}}}(THREE),THREE.Object3D=function(){Object.defineProperty(this,"id",{value:THREE.Object3DIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.channels=new THREE.Channels,this.children=[],this.up=THREE.Object3D.DefaultUp.clone();var t=new THREE.Vector3,e=new THREE.Euler,r=new THREE.Quaternion,i=new THREE.Vector3(1,1,1);e.onChange(function(){r.setFromEuler(e,!1)}),r.onChange(function(){e.setFromQuaternion(r,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:t},rotation:{enumerable:!0,value:e},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:i},modelViewMatrix:{value:new THREE.Matrix4},normalMatrix:{value:new THREE.Matrix3}}),this.rotationAutoUpdate=!0,this.matrix=new THREE.Matrix4,this.matrixWorld=new THREE.Matrix4,this.matrixAutoUpdate=THREE.Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.visible=!0,this.receiveShadow=this.castShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},THREE.Object3D.DefaultUp=new THREE.Vector3(0,1,0),THREE.Object3D.DefaultMatrixAutoUpdate=!0,THREE.Object3D.prototype={constructor:THREE.Object3D,get eulerOrder(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set eulerOrder(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t},get useQuaternion(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(t){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set renderDepth(t){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(){var r=new THREE.Quaternion;return function(t,e){return r.setFromAxisAngle(t,e),this.quaternion.multiply(r),this}}(),rotateX:function(){var e=new THREE.Vector3(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new THREE.Vector3(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new THREE.Vector3(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var r=new THREE.Vector3;return function(t,e){return r.copy(t).applyQuaternion(this.quaternion),this.position.add(r.multiplyScalar(e)),this}}(),translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},translateX:function(){var e=new THREE.Vector3(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new THREE.Vector3(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new THREE.Vector3(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var e=new THREE.Matrix4;return function(t){return t.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new THREE.Matrix4;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),add:function(t){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",t):t instanceof THREE.Object3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this},remove:function(t){if(1<arguments.length)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);-1!==(e=this.children.indexOf(t))&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(e,1))},getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var r=0,i=this.children.length;r<i;r++){var n=this.children[r].getObjectByProperty(t,e);if(void 0!==n)return n}},getWorldPosition:function(t){return t=t||new THREE.Vector3,this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var e=new THREE.Vector3,r=new THREE.Vector3;return function(t){return t=t||new THREE.Quaternion,this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,r),t}}(),getWorldRotation:function(){var e=new THREE.Quaternion;return function(t){return t=t||new THREE.Euler,this.getWorldQuaternion(e),t.setFromQuaternion(e,this.rotation.order,!1)}}(),getWorldScale:function(){var e=new THREE.Vector3,r=new THREE.Quaternion;return function(t){return t=t||new THREE.Vector3,this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,r,t),t}}(),getWorldDirection:function(){var e=new THREE.Quaternion;return function(t){return t=t||new THREE.Vector3,this.getWorldQuaternion(e),t.set(0,0,1).applyQuaternion(e)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,r=0,i=e.length;r<i;r++)e[r].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,r=0,i=e.length;r<i;r++)e[r].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){!0===this.matrixAutoUpdate&&this.updateMatrix(),!0!==this.matrixWorldNeedsUpdate&&!0!==t||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t=!(this.matrixWorldNeedsUpdate=!1));for(var e=0,r=this.children.length;e<r;e++)this.children[e].updateMatrixWorld(t)},toJSON:function(t){function e(t){var e,r=[];for(e in t){var i=t[e];delete i.metadata,r.push(i)}return r}var r=void 0===t,i={};r&&(t={geometries:{},materials:{},textures:{},images:{}},i.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var n,o={};if(o.uuid=this.uuid,o.type=this.type,""!==this.name&&(o.name=this.name),"{}"!==JSON.stringify(this.userData)&&(o.userData=this.userData),!0===this.castShadow&&(o.castShadow=!0),!0===this.receiveShadow&&(o.receiveShadow=!0),!1===this.visible&&(o.visible=!1),o.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===t.geometries[this.geometry.uuid]&&(t.geometries[this.geometry.uuid]=this.geometry.toJSON(t)),o.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===t.materials[this.material.uuid]&&(t.materials[this.material.uuid]=this.material.toJSON(t)),o.material=this.material.uuid),0<this.children.length){o.children=[];for(var a=0;a<this.children.length;a++)o.children.push(this.children[a].toJSON(t).object)}return r&&(r=e(t.geometries),a=e(t.materials),n=e(t.textures),t=e(t.images),0<r.length&&(i.geometries=r),0<a.length&&(i.materials=a),0<n.length&&(i.textures=n),0<t.length&&(i.images=t)),i.object=o,i},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.rotationAutoUpdate=t.rotationAutoUpdate,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var r=0;r<t.children.length;r++)this.add(t.children[r].clone());return this}},THREE.EventDispatcher.prototype.apply(THREE.Object3D.prototype),THREE.Object3DIdCount=0,THREE.Face3=function(t,e,r,i,n,o){this.a=t,this.b=e,this.c=r,this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3,this.vertexNormals=Array.isArray(i)?i:[],this.color=n instanceof THREE.Color?n:new THREE.Color,this.vertexColors=Array.isArray(n)?n:[],this.materialIndex=void 0!==o?o:0},THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,r=t.vertexNormals.length;e<r;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(e=0,r=t.vertexColors.length;e<r;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}},THREE.Face4=function(t,e,r,i,n,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new THREE.Face3(t,e,r,n,o,a)},THREE.BufferAttribute=function(t,e){this.uuid=THREE.Math.generateUUID(),this.array=t,this.itemSize=e,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},THREE.BufferAttribute.prototype={constructor:THREE.BufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.array.length/this.itemSize},set needsUpdate(t){!0===t&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){t*=this.itemSize,r*=e.itemSize;for(var i=0,n=this.itemSize;i<n;i++)this.array[t+i]=e.array[r+i];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new THREE.Color),e[r++]=o.r,e[r++]=o.g,e[r++]=o.b}return this},copyIndicesArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];e[r++]=o.a,e[r++]=o.b,e[r++]=o.c}return this},copyVector2sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),o=new THREE.Vector2),e[r++]=o.x,e[r++]=o.y}return this},copyVector3sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new THREE.Vector3),e[r++]=o.x,e[r++]=o.y,e[r++]=o.z}return this},copyVector4sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new THREE.Vector4),e[r++]=o.x,e[r++]=o.y,e[r++]=o.z,e[r++]=o.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this},setXYZ:function(t,e,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=i,this},setXYZW:function(t,e,r,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=i,this.array[t+3]=n,this},clone:function(){return(new this.constructor).copy(this)}},THREE.Int8Attribute=function(t,e){return new THREE.BufferAttribute(new Int8Array(t),e)},THREE.Uint8Attribute=function(t,e){return new THREE.BufferAttribute(new Uint8Array(t),e)},THREE.Uint8ClampedAttribute=function(t,e){return new THREE.BufferAttribute(new Uint8ClampedArray(t),e)},THREE.Int16Attribute=function(t,e){return new THREE.BufferAttribute(new Int16Array(t),e)},THREE.Uint16Attribute=function(t,e){return new THREE.BufferAttribute(new Uint16Array(t),e)},THREE.Int32Attribute=function(t,e){return new THREE.BufferAttribute(new Int32Array(t),e)},THREE.Uint32Attribute=function(t,e){return new THREE.BufferAttribute(new Uint32Array(t),e)},THREE.Float32Attribute=function(t,e){return new THREE.BufferAttribute(new Float32Array(t),e)},THREE.Float64Attribute=function(t,e){return new THREE.BufferAttribute(new Float64Array(t),e)},THREE.DynamicBufferAttribute=function(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new THREE.BufferAttribute(t,e).setDynamic(!0)},THREE.InstancedBufferAttribute=function(t,e,r){THREE.BufferAttribute.call(this,t,e),this.meshPerAttribute=r||1},THREE.InstancedBufferAttribute.prototype=Object.create(THREE.BufferAttribute.prototype),THREE.InstancedBufferAttribute.prototype.constructor=THREE.InstancedBufferAttribute,THREE.InstancedBufferAttribute.prototype.copy=function(t){return THREE.BufferAttribute.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},THREE.InterleavedBuffer=function(t,e){this.uuid=THREE.Math.generateUUID(),this.array=t,this.stride=e,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},THREE.InterleavedBuffer.prototype={constructor:THREE.InterleavedBuffer,get length(){return this.array.length},get count(){return this.array.length/this.stride},set needsUpdate(t){!0===t&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){this.array=new t.array.constructor(t.array),this.stride=t.stride,this.dynamic=t.dynamic},copyAt:function(t,e,r){t*=this.stride,r*=e.stride;for(var i=0,n=this.stride;i<n;i++)this.array[t+i]=e.array[r+i];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)}},THREE.InstancedInterleavedBuffer=function(t,e,r){THREE.InterleavedBuffer.call(this,t,e),this.meshPerAttribute=r||1},THREE.InstancedInterleavedBuffer.prototype=Object.create(THREE.InterleavedBuffer.prototype),THREE.InstancedInterleavedBuffer.prototype.constructor=THREE.InstancedInterleavedBuffer,THREE.InstancedInterleavedBuffer.prototype.copy=function(t){return THREE.InterleavedBuffer.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},THREE.InterleavedBufferAttribute=function(t,e,r){this.uuid=THREE.Math.generateUUID(),this.data=t,this.itemSize=e,this.offset=r},THREE.InterleavedBufferAttribute.prototype={constructor:THREE.InterleavedBufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.data.array.length/this.data.stride},setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this},setXYZ:function(t,e,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=i,this},setXYZW:function(t,e,r,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=i,this.data.array[t+3]=n,this}},THREE.Geometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++}),this.uuid=THREE.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.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1},THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(t){for(var e=(new THREE.Matrix3).getNormalMatrix(t),r=0,i=this.vertices.length;r<i;r++)this.vertices[r].applyMatrix4(t);for(r=0,i=this.faces.length;r<i;r++){(t=this.faces[r]).normal.applyMatrix3(e).normalize();for(var n=0,o=t.vertexNormals.length;n<o;n++)t.vertexNormals[n].applyMatrix3(e).normalize()}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.normalsNeedUpdate=this.verticesNeedUpdate=!0},rotateX:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var i;return function(t,e,r){return void 0===i&&(i=new THREE.Matrix4),i.makeTranslation(t,e,r),this.applyMatrix(i),this}}(),scale:function(){var i;return function(t,e,r){return void 0===i&&(i=new THREE.Matrix4),i.makeScale(t,e,r),this.applyMatrix(i),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new THREE.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,r){var i=void 0!==a?[u[t].clone(),u[e].clone(),u[r].clone()]:[],n=void 0!==s?[o.colors[t].clone(),o.colors[e].clone(),o.colors[r].clone()]:[],i=new THREE.Face3(t,e,r,i,n);o.faces.push(i),void 0!==h&&o.faceVertexUvs[0].push([l[t].clone(),l[e].clone(),l[r].clone()]),void 0!==c&&o.faceVertexUvs[1].push([E[t].clone(),E[e].clone(),E[r].clone()])}var o=this,r=null!==t.index?t.index.array:void 0,i=t.attributes,n=i.position.array,a=void 0!==i.normal?i.normal.array:void 0,s=void 0!==i.color?i.color.array:void 0,h=void 0!==i.uv?i.uv.array:void 0,c=void 0!==i.uv2?i.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var u=[],l=[],E=[],p=i=0;i<n.length;i+=3,p+=2)o.vertices.push(new THREE.Vector3(n[i],n[i+1],n[i+2])),void 0!==a&&u.push(new THREE.Vector3(a[i],a[i+1],a[i+2])),void 0!==s&&o.colors.push(new THREE.Color(s[i],s[i+1],s[i+2])),void 0!==h&&l.push(new THREE.Vector2(h[p],h[p+1])),void 0!==c&&E.push(new THREE.Vector2(c[p],c[p+1]));if(void 0!==r)if(0<(n=t.groups).length)for(i=0;i<n.length;i++)for(var d=(p=n[i]).start,f=p.count,p=d,d=d+f;p<d;p+=3)e(r[p],r[p+1],r[p+2]);else for(i=0;i<r.length;i+=3)e(r[i],r[i+1],r[i+2]);else for(i=0;i<n.length/3;i+=3)e(i,i+1,i+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=0===(e=this.boundingSphere.radius)?1:1/e,r=new THREE.Matrix4;return r.set(e,0,0,-e*t.x,0,e,0,-e*t.y,0,0,e,-e*t.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var t=new THREE.Vector3,e=new THREE.Vector3,r=0,i=this.faces.length;r<i;r++){var n=this.faces[r],o=this.vertices[n.a],a=this.vertices[n.b];t.subVectors(this.vertices[n.c],a),e.subVectors(o,a),t.cross(e),t.normalize(),n.normal.copy(t)}},computeVertexNormals:function(t){for(var e=Array(this.vertices.length),r=0,i=this.vertices.length;r<i;r++)e[r]=new THREE.Vector3;if(t){var n,o,a,s=new THREE.Vector3,h=new THREE.Vector3;for(t=0,r=this.faces.length;t<r;t++)i=this.faces[t],n=this.vertices[i.a],o=this.vertices[i.b],a=this.vertices[i.c],s.subVectors(a,o),h.subVectors(n,o),s.cross(h),e[i.a].add(s),e[i.b].add(s),e[i.c].add(s)}else for(t=0,r=this.faces.length;t<r;t++)e[(i=this.faces[t]).a].add(i.normal),e[i.b].add(i.normal),e[i.c].add(i.normal);for(r=0,i=this.vertices.length;r<i;r++)e[r].normalize();for(t=0,r=this.faces.length;t<r;t++)3===(n=(i=this.faces[t]).vertexNormals).length?(n[0].copy(e[i.a]),n[1].copy(e[i.b]),n[2].copy(e[i.c])):(n[0]=e[i.a].clone(),n[1]=e[i.b].clone(),n[2]=e[i.c].clone())},computeMorphNormals:function(){var t,e,r;for(s=0,h=this.faces.length;s<h;s++)for((r=this.faces[s]).__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),t=0,e=r.vertexNormals.length;t<e;t++)r.__originalVertexNormals[t]?r.__originalVertexNormals[t].copy(r.vertexNormals[t]):r.__originalVertexNormals[t]=r.vertexNormals[t].clone();var i=new THREE.Geometry;for(i.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[],r=this.morphNormals[t].faceNormals;for(var n,o,a=this.morphNormals[t].vertexNormals,s=0,h=this.faces.length;s<h;s++)n=new THREE.Vector3,o={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},r.push(n),a.push(o)}for(a=this.morphNormals[t],i.vertices=this.morphTargets[t].vertices,i.computeFaceNormals(),i.computeVertexNormals(),s=0,h=this.faces.length;s<h;s++)r=this.faces[s],n=a.faceNormals[s],o=a.vertexNormals[s],n.copy(r.normal),o.a.copy(r.vertexNormals[0]),o.b.copy(r.vertexNormals[1]),o.c.copy(r.vertexNormals[2])}for(s=0,h=this.faces.length;s<h;s++)(r=this.faces[s]).normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var t=0,e=this.vertices,r=0,i=e.length;r<i;r++)0<r&&(t+=e[r].distanceTo(e[r-1])),this.lineDistances[r]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,r){if(!1==t instanceof THREE.Geometry)console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);else{var i,n=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,h=t.faces,c=this.faceVertexUvs[0];t=t.faceVertexUvs[0],void 0===r&&(r=0),void 0!==e&&(i=(new THREE.Matrix3).getNormalMatrix(e));for(var u=0,l=a.length;u<l;u++){var E=a[u].clone();void 0!==e&&E.applyMatrix4(e),o.push(E)}for(u=0,l=h.length;u<l;u++){var p,d=(a=h[u]).vertexNormals,f=a.vertexColors;for((E=new THREE.Face3(a.a+n,a.b+n,a.c+n)).normal.copy(a.normal),void 0!==i&&E.normal.applyMatrix3(i).normalize(),e=0,o=d.length;e<o;e++)p=d[e].clone(),void 0!==i&&p.applyMatrix3(i).normalize(),E.vertexNormals.push(p);for(E.color.copy(a.color),e=0,o=f.length;e<o;e++)p=f[e],E.vertexColors.push(p.clone());E.materialIndex=a.materialIndex+r,s.push(E)}for(u=0,l=t.length;u<l;u++)if(i=[],void 0!==(r=t[u])){for(e=0,o=r.length;e<o;e++)i.push(r[e].clone());c.push(i)}}},mergeMesh:function(t){!1==t instanceof THREE.Mesh?console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t):(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix))},mergeVertices:function(){for(var t,e={},r=[],i=[],n=Math.pow(10,4),o=0,a=this.vertices.length;o<a;o++)t=this.vertices[o],void 0===e[t=Math.round(t.x*n)+"_"+Math.round(t.y*n)+"_"+Math.round(t.z*n)]?(e[t]=o,r.push(this.vertices[o]),i[o]=r.length-1):i[o]=i[e[t]];for(e=[],o=0,a=this.faces.length;o<a;o++)for((n=this.faces[o]).a=i[n.a],n.b=i[n.b],n.c=i[n.c],n=[n.a,n.b,n.c],t=0;t<3;t++)if(n[t]===n[(t+1)%3]){e.push(o);break}for(o=e.length-1;0<=o;o--)for(n=e[o],this.faces.splice(n,1),i=0,a=this.faceVertexUvs.length;i<a;i++)this.faceVertexUvs[i].splice(n,1);return o=this.vertices.length-r.length,this.vertices=r,o},sortFacesByMaterialIndex:function(){for(var t=this.faces,e=t.length,r=0;r<e;r++)t[r]._id=r;t.sort(function(t,e){return t.materialIndex-e.materialIndex});var i,n,o=this.faceVertexUvs[0],a=this.faceVertexUvs[1];for(o&&o.length===e&&(i=[]),a&&a.length===e&&(n=[]),r=0;r<e;r++){var s=t[r]._id;i&&i.push(o[s]),n&&n.push(a[s])}i&&(this.faceVertexUvs[0]=i),n&&(this.faceVertexUvs[1]=n)},toJSON:function(){function t(t,e,r){return r?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==h[e]||(h[e]=s.length/3,s.push(t.x,t.y,t.z)),h[e]}function r(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==u[e]||(u[e]=c.length,c.push(t.getHex())),u[e]}function i(t){var e=t.x.toString()+t.y.toString();return void 0!==E[e]||(E[e]=l.length/2,l.push(t.x,t.y)),E[e]}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(p in o)void 0!==o[p]&&(n[p]=o[p]);return n}for(o=[],p=0;p<this.vertices.length;p++){var a=this.vertices[p];o.push(a.x,a.y,a.z)}for(var a=[],s=[],h={},c=[],u={},l=[],E={},p=0;p<this.faces.length;p++){var d=this.faces[p],f=void 0!==this.faceVertexUvs[0][p],m=0<d.normal.length(),T=0<d.vertexNormals.length,g=1!==d.color.r||1!==d.color.g||1!==d.color.b,y=0<d.vertexColors.length,R=t(0,3,f),R=t(R,4,m),R=t(R,5,T),R=t(R,6,g),R=t(R,7,y);a.push(R),a.push(d.a,d.b,d.c),f&&(f=this.faceVertexUvs[0][p],a.push(i(f[0]),i(f[1]),i(f[2]))),m&&a.push(e(d.normal)),T&&(m=d.vertexNormals,a.push(e(m[0]),e(m[1]),e(m[2]))),g&&a.push(r(d.color)),y&&(d=d.vertexColors,a.push(r(d[0]),r(d[1]),r(d[2])))}return n.data={},n.data.vertices=o,n.data.normals=s,0<c.length&&(n.data.colors=c),0<l.length&&(n.data.uvs=[l]),n.data.faces=a,n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var e=t.vertices,r=0,i=e.length;r<i;r++)this.vertices.push(e[r].clone());for(r=0,i=(e=t.faces).length;r<i;r++)this.faces.push(e[r].clone());for(r=0,i=t.faceVertexUvs.length;r<i;r++){e=t.faceVertexUvs[r],void 0===this.faceVertexUvs[r]&&(this.faceVertexUvs[r]=[]);for(var n=0,o=e.length;n<o;n++){for(var a=e[n],s=[],h=0,c=a.length;h<c;h++)s.push(a[h].clone());this.faceVertexUvs[r].push(s)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype),THREE.GeometryIdCount=0,THREE.DirectGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++}),this.uuid=THREE.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.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1},THREE.DirectGeometry.prototype={constructor:THREE.DirectGeometry,computeBoundingBox:THREE.Geometry.prototype.computeBoundingBox,computeBoundingSphere:THREE.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(t){var e,r,i=[];t=t.faces;for(var n=0;n<t.length;n++){var o=t[n];o.materialIndex!==r&&(r=o.materialIndex,void 0!==e&&(e.count=3*n-e.start,i.push(e)),e={start:3*n,materialIndex:r})}void 0!==e&&(e.count=3*n-e.start,i.push(e)),this.groups=i},fromGeometry:function(t){var e=t.faces,r=t.vertices,i=t.faceVertexUvs,n=i[0]&&0<i[0].length,o=i[1]&&0<i[1].length,a=t.morphTargets,s=a.length;if(0<s){for(var h=[],c=0;c<s;c++)h[c]=[];this.morphTargets.position=h}var u=t.morphNormals,l=u.length;if(0<l){for(var E=[],c=0;c<l;c++)E[c]=[];this.morphTargets.normal=E}for(var p=t.skinIndices,d=t.skinWeights,f=p.length===r.length,m=d.length===r.length,c=0;c<e.length;c++){var T=e[c];this.vertices.push(r[T.a],r[T.b],r[T.c]);var g=T.vertexNormals;for(3===g.length?this.normals.push(g[0],g[1],g[2]):(g=T.normal,this.normals.push(g,g,g)),3===(g=T.vertexColors).length?this.colors.push(g[0],g[1],g[2]):(g=T.color,this.colors.push(g,g,g)),!0===n&&(void 0!==(g=i[0][c])?this.uvs.push(g[0],g[1],g[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",c),this.uvs.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2))),!0===o&&(void 0!==(g=i[1][c])?this.uvs2.push(g[0],g[1],g[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",c),this.uvs2.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2))),g=0;g<s;g++){var y=a[g].vertices;h[g].push(y[T.a],y[T.b],y[T.c])}for(g=0;g<l;g++)y=u[g].vertexNormals[c],E[g].push(y.a,y.b,y.c);f&&this.skinIndices.push(p[T.a],p[T.b],p[T.c]),m&&this.skinWeights.push(d[T.a],d[T.b],d[T.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.DirectGeometry.prototype),THREE.BufferGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingSphere=this.boundingBox=null,this.drawRange={start:0,count:1/0}},THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},getIndex:function(){return this.index},setIndex:function(t){this.index=t},addAttribute:function(t,e,r){!1==e instanceof THREE.BufferAttribute&&!1==e instanceof THREE.InterleavedBufferAttribute?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(t,new THREE.BufferAttribute(e,r))):"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e)):this.attributes[t]=e},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){delete this.attributes[t]},get drawcalls(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups},get offsets(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups},addDrawCall:function(t,e,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},addGroup:function(t,e,r){this.groups.push({start:t,count:e,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToVector3Array(e.array),e.needsUpdate=!0),void 0!==(e=this.attributes.normal)&&((new THREE.Matrix3).getNormalMatrix(t).applyToVector3Array(e.array),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()},rotateX:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var i;return function(t,e,r){return void 0===i&&(i=new THREE.Matrix4),i.makeTranslation(t,e,r),this.applyMatrix(i),this}}(),scale:function(){var i;return function(t,e,r){return void 0===i&&(i=new THREE.Matrix4),i.makeScale(t,e,r),this.applyMatrix(i),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new THREE.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e,r=t.geometry;return t instanceof THREE.Points||t instanceof THREE.Line?(t=new THREE.Float32Attribute(3*r.vertices.length,3),e=new THREE.Float32Attribute(3*r.colors.length,3),this.addAttribute("position",t.copyVector3sArray(r.vertices)),this.addAttribute("color",e.copyColorsArray(r.colors)),r.lineDistances&&r.lineDistances.length===r.vertices.length&&(t=new THREE.Float32Attribute(r.lineDistances.length,1),this.addAttribute("lineDistance",t.copyArray(r.lineDistances))),null!==r.boundingSphere&&(this.boundingSphere=r.boundingSphere.clone()),null!==r.boundingBox&&(this.boundingBox=r.boundingBox.clone())):t instanceof THREE.Mesh&&r instanceof THREE.Geometry&&this.fromGeometry(r),this},updateFromObject:function(t){var e=t.geometry;if(t instanceof THREE.Mesh){var r=e.__directGeometry;if(void 0===r)return this.fromGeometry(e);r.verticesNeedUpdate=e.verticesNeedUpdate,r.normalsNeedUpdate=e.normalsNeedUpdate,r.colorsNeedUpdate=e.colorsNeedUpdate,r.uvsNeedUpdate=e.uvsNeedUpdate,r.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=r}return!0===e.verticesNeedUpdate&&(void 0!==(r=this.attributes.position)&&(r.copyVector3sArray(e.vertices),r.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(void 0!==(r=this.attributes.normal)&&(r.copyVector3sArray(e.normals),r.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(void 0!==(r=this.attributes.color)&&(r.copyColorsArray(e.colors),r.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(void 0!==(r=this.attributes.uv)&&(r.copyVector2sArray(e.uvs),r.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(void 0!==(r=this.attributes.lineDistance)&&(r.copyArray(e.lineDistances),r.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new THREE.DirectGeometry).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e,r=new Float32Array(3*t.vertices.length);for(e in this.addAttribute("position",new THREE.BufferAttribute(r,3).copyVector3sArray(t.vertices)),0<t.normals.length&&(r=new Float32Array(3*t.normals.length),this.addAttribute("normal",new THREE.BufferAttribute(r,3).copyVector3sArray(t.normals))),0<t.colors.length&&(r=new Float32Array(3*t.colors.length),this.addAttribute("color",new THREE.BufferAttribute(r,3).copyColorsArray(t.colors))),0<t.uvs.length&&(r=new Float32Array(2*t.uvs.length),this.addAttribute("uv",new THREE.BufferAttribute(r,2).copyVector2sArray(t.uvs))),0<t.uvs2.length&&(r=new Float32Array(2*t.uvs2.length),this.addAttribute("uv2",new THREE.BufferAttribute(r,2).copyVector2sArray(t.uvs2))),0<t.indices.length&&(r=new(65535<t.vertices.length?Uint32Array:Uint16Array)(3*t.indices.length),this.setIndex(new THREE.BufferAttribute(r,1).copyIndicesArray(t.indices))),this.groups=t.groups,t.morphTargets){for(var r=[],i=t.morphTargets[e],n=0,o=i.length;n<o;n++){var a=i[n],s=new THREE.Float32Attribute(3*a.length,3);r.push(s.copyVector3sArray(a))}this.morphAttributes[e]=r}return 0<t.skinIndices.length&&(e=new THREE.Float32Attribute(4*t.skinIndices.length,4),this.addAttribute("skinIndex",e.copyVector4sArray(t.skinIndices))),0<t.skinWeights.length&&(e=new THREE.Float32Attribute(4*t.skinWeights.length,4),this.addAttribute("skinWeight",e.copyVector4sArray(t.skinWeights))),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){var n=new THREE.Vector3;return function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var t=this.attributes.position.array;if(t){var e=this.boundingBox;e.makeEmpty();for(var r=0,i=t.length;r<i;r+=3)n.fromArray(t,r),e.expandByPoint(n)}void 0!==t&&0!==t.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 o=new THREE.Box3,a=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var t=this.attributes.position.array;if(t){o.makeEmpty();for(var e=this.boundingSphere.center,r=0,i=t.length;r<i;r+=3)a.fromArray(t,r),o.expandByPoint(a);o.center(e);for(var n=0,r=0,i=t.length;r<i;r+=3)a.fromArray(t,r),n=Math.max(n,e.distanceToSquared(a));this.boundingSphere.radius=Math.sqrt(n),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 t=this.index,e=this.attributes,r=this.groups;if(e.position){var i=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(i.length),3));else for(var n=0,o=(c=e.normal.array).length;n<o;n++)c[n]=0;var a,s,h,c=e.normal.array,u=new THREE.Vector3,l=new THREE.Vector3,E=new THREE.Vector3,p=new THREE.Vector3,d=new THREE.Vector3;if(t){t=t.array,0===r.length&&this.addGroup(0,t.length);for(var f=0,m=r.length;f<m;++f)for(o=(n=r[f]).start,a=n.count,n=o,o+=a;n<o;n+=3)a=3*t[n+0],s=3*t[n+1],h=3*t[n+2],u.fromArray(i,a),l.fromArray(i,s),E.fromArray(i,h),p.subVectors(E,l),d.subVectors(u,l),p.cross(d),c[a]+=p.x,c[1+a]+=p.y,c[2+a]+=p.z,c[s]+=p.x,c[1+s]+=p.y,c[2+s]+=p.z,c[h]+=p.x,c[1+h]+=p.y,c[2+h]+=p.z}else for(n=0,o=i.length;n<o;n+=9)u.fromArray(i,n),l.fromArray(i,n+3),E.fromArray(i,n+6),p.subVectors(E,l),d.subVectors(u,l),p.cross(d),c[n]=p.x,c[n+1]=p.y,c[n+2]=p.z,c[n+3]=p.x,c[n+4]=p.y,c[n+5]=p.z,c[n+6]=p.x,c[n+7]=p.y,c[n+8]=p.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},merge:function(t,e){if(!1!=t instanceof THREE.BufferGeometry){void 0===e&&(e=0);var r,i=this.attributes;for(r in i)if(void 0!==t.attributes[r])for(var n=i[r].array,o=(s=t.attributes[r]).array,a=0,s=s.itemSize*e;a<o.length;a++,s++)n[s]=o[a];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:function(){for(var t,e,r,i=this.attributes.normal.array,n=0,o=i.length;n<o;n+=3)t=i[n],e=i[n+1],r=i[n+2],t=1/Math.sqrt(t*t+e*e+r*r),i[n]*=t,i[n+1]*=t,i[n+2]*=t},toJSON:function(){var t={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e,r=this.parameters;for(e in r)void 0!==r[e]&&(t[e]=r[e]);return t}t.data={attributes:{}};var i=this.index;for(e in null!==i&&(r=Array.prototype.slice.call(i.array),t.data.index={type:i.array.constructor.name,array:r}),i=this.attributes){var n=i[e],r=Array.prototype.slice.call(n.array);t.data.attributes[e]={itemSize:n.itemSize,type:n.array.constructor.name,array:r}}return 0<(e=this.groups).length&&(t.data.groups=JSON.parse(JSON.stringify(e))),null!==(e=this.boundingSphere)&&(t.data.boundingSphere={center:e.center.toArray(),radius:e.radius}),t},clone:function(){return(new this.constructor).copy(this)},copy:function(t){null!==(r=t.index)&&this.setIndex(r.clone());var e,r=t.attributes;for(e in r)this.addAttribute(e,r[e].clone());for(e=0,r=(t=t.groups).length;e<r;e++){var i=t[e];this.addGroup(i.start,i.count)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype),THREE.BufferGeometry.MaxIndex=65535,THREE.InstancedBufferGeometry=function(){THREE.BufferGeometry.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0},THREE.InstancedBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.InstancedBufferGeometry.prototype.constructor=THREE.InstancedBufferGeometry,THREE.InstancedBufferGeometry.prototype.addGroup=function(t,e,r){this.groups.push({start:t,count:e,instances:r})},THREE.InstancedBufferGeometry.prototype.copy=function(t){null!==(r=t.index)&&this.setIndex(r.clone());var e,r=t.attributes;for(e in r)this.addAttribute(e,r[e].clone());for(e=0,r=(t=t.groups).length;e<r;e++){var i=t[e];this.addGroup(i.start,i.count,i.instances)}return this},THREE.EventDispatcher.prototype.apply(THREE.InstancedBufferGeometry.prototype),THREE.AnimationAction=function(t,e,r,i,n){if(void 0===t)throw Error("clip is null");this.clip=t,this.localRoot=null,this.startTime=e||0,this.timeScale=r||1,this.weight=i||1,this.loop=n||THREE.LoopRepeat,this.loopCount=0,this.enabled=!0,this.actionTime=-this.startTime,this.clipTime=0,this.propertyBindings=[]},THREE.AnimationAction.prototype={constructor:THREE.AnimationAction,setLocalRoot:function(t){return this.localRoot=t,this},updateTime:function(t){var e=this.clipTime,r=this.loopCount,i=this.clip.duration;return this.actionTime+=t,this.loop===THREE.LoopOnce?(this.loopCount=0,this.clipTime=Math.min(Math.max(this.actionTime,0),i),this.clipTime!==e&&(this.clipTime===i?this.mixer.dispatchEvent({type:"finished",action:this,direction:1}):0===this.clipTime&&this.mixer.dispatchEvent({type:"finished",action:this,direction:-1}))):(this.loopCount=Math.floor(this.actionTime/i),t=this.actionTime-this.loopCount*i,t%=i,this.loop==THREE.LoopPingPong&&1===Math.abs(this.loopCount%2)&&(t=i-t),this.clipTime=t,this.loopCount!==r&&this.mixer.dispatchEvent({type:"loop",action:this,loopDelta:this.loopCount-this.loopCount})),this.clipTime},syncWith:function(t){return this.actionTime=t.actionTime,this.timeScale=t.timeScale,this},warpToDuration:function(t){return this.timeScale=this.clip.duration/t,this},init:function(t){return this.clipTime=t-this.startTime,this},update:function(t){return this.updateTime(t),this.clip.getAt(this.clipTime)},getTimeScaleAt:function(t){return this.timeScale.getAt?this.timeScale.getAt(t):this.timeScale},getWeightAt:function(t){return this.weight.getAt?this.weight.getAt(t):this.weight}},THREE.AnimationClip=function(t,e,r){if(this.name=t,this.tracks=r,this.duration=void 0!==e?e:-1,this.duration<0)for(t=0;t<this.tracks.length;t++)e=this.tracks[t],this.duration=Math.max(e.keys[e.keys.length-1].time);this.trim(),this.optimize(),this.results=[]},THREE.AnimationClip.prototype={constructor:THREE.AnimationClip,getAt:function(t){t=Math.max(0,Math.min(t,this.duration));for(var e=0;e<this.tracks.length;e++)this.results[e]=this.tracks[e].getAt(t);return this.results},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}},THREE.AnimationClip.CreateFromMorphTargetSequence=function(t,e,r){for(var i=e.length,n=[],o=0;o<i;o++){var a=[];a.push({time:(o+i-1)%i,value:0}),a.push({time:o,value:1}),a.push({time:(o+1)%i,value:0}),a.sort(THREE.KeyframeTrack.keyComparer),0===a[0].time&&a.push({time:i,value:a[0].value}),n.push(new THREE.NumberKeyframeTrack(".morphTargetInfluences["+e[o].name+"]",a).scale(1/r))}return new THREE.AnimationClip(t,-1,n)},THREE.AnimationClip.findByName=function(t,e){for(var r=0;r<t.length;r++)if(t[r].name===e)return t[r];return null},THREE.AnimationClip.CreateClipsFromMorphTargetSequences=function(t,e){for(var r={},i=/^([\w-]*?)([\d]+)$/,n=0,o=t.length;n<o;n++){var a,s=t[n],h=s.name.match(i);h&&1<h.length&&((h=r[a=h[1]])||(r[a]=h=[]),h.push(s))}for(a in i=[],r)i.push(THREE.AnimationClip.CreateFromMorphTargetSequence(a,r[a],e));return i},THREE.AnimationClip.parse=function(t){for(var e=[],r=0;r<t.tracks.length;r++)e.push(THREE.KeyframeTrack.parse(t.tracks[r]).scale(1/t.fps));return new THREE.AnimationClip(t.name,t.duration,e)},THREE.AnimationClip.parseAnimation=function(t,e,r){if(!t)return console.error(" no animation in JSONLoader data"),null;function i(t,e,r,i,n){for(var o=[],a=0;a<e.length;a++){var s=e[a];void 0!==s[r]&&o.push({time:s.time,value:n(s)})}return 0<o.length?new i(t,o):null}var n=[],o=t.name||"default",a=t.length||-1,s=t.fps||30;t=t.hierarchy||[];for(var h=0;h<t.length;h++){var c=t[h].keys;if(c&&0!=c.length)if(c[0].morphTargets){for(var u,a={},l=0;l<c.length;l++)if(c[l].morphTargets)for(var E=0;E<c[l].morphTargets.length;E++)a[c[l].morphTargets[E]]=-1;for(u in a){for(var p=[],E=0;E<c[l].morphTargets.length;E++){var d=c[l];p.push({time:d.time,value:d.morphTarget===u?1:0})}n.push(new THREE.NumberKeyframeTrack(r+".morphTargetInfluence["+u+"]",p))}a=a.length*(s||1)}else(E=i((l=r+".bones["+e[h].name+"]")+".position",c,"pos",THREE.VectorKeyframeTrack,function(t){return(new THREE.Vector3).fromArray(t.pos)}))&&n.push(E),(E=i(l+".quaternion",c,"rot",THREE.QuaternionKeyframeTrack,function(t){return t.rot.slerp?t.rot.clone():(new THREE.Quaternion).fromArray(t.rot)}))&&n.push(E),(c=i(l+".scale",c,"scl",THREE.VectorKeyframeTrack,function(t){return(new THREE.Vector3).fromArray(t.scl)}))&&n.push(c)}return 0===n.length?null:new THREE.AnimationClip(o,a,n)},THREE.AnimationMixer=function(t){this.root=t,this.time=0,this.timeScale=1,this.actions=[],this.propertyBindingMap={}},THREE.AnimationMixer.prototype={constructor:THREE.AnimationMixer,addAction:function(t){this.actions.push(t),t.init(this.time),t.mixer=this;for(var e=t.clip.tracks,r=t.localRoot||this.root,i=0;i<e.length;i++){var n=e[i],o=r.uuid+"-"+n.name,a=this.propertyBindingMap[o];void 0===a&&(a=new THREE.PropertyBinding(r,n.name),this.propertyBindingMap[o]=a),t.propertyBindings.push(a),a.referenceCount+=1}},removeAllActions:function(){for(var t,e=0;e<this.actions.length;e++)this.actions[e].mixer=null;for(t in this.propertyBindingMap)this.propertyBindingMap[t].unbind();return this.actions=[],this.propertyBindingMap={},this},removeAction:function(t){var e=this.actions.indexOf(t);-1!==e&&(this.actions.splice(e,1),t.mixer=null),e=t.localRoot||this.root,t=t.clip.tracks;for(var r=0;r<t.length;r++){var i=e.uuid+"-"+t[r].name,n=this.propertyBindingMap[i];--n.referenceCount,n.referenceCount<=0&&(n.unbind(),delete this.propertyBindingMap[i])}return this},findActionByName:function(t){for(var e=0;e<this.actions.length;e++)if(this.actions[e].name===t)return this.actions[e];return null},play:function(t){return t.startTime=this.time,this.addAction(t),this},fadeOut:function(t,e){var r=[];return r.push({time:this.time,value:1}),r.push({time:this.time+e,value:0}),t.weight=new THREE.NumberKeyframeTrack("weight",r),this},fadeIn:function(t,e){var r=[];return r.push({time:this.time,value:0}),r.push({time:this.time+e,value:1}),t.weight=new THREE.NumberKeyframeTrack("weight",r),this},warp:function(t,e,r,i){var n=[];return n.push({time:this.time,value:e}),n.push({time:this.time+i,value:r}),t.timeScale=new THREE.NumberKeyframeTrack("timeScale",n),this},crossFade:function(t,e,r,i){var n;return this.fadeOut(t,r),this.fadeIn(e,r),i&&(n=1/(i=t.clip.duration/e.clip.duration),this.warp(t,1,i,r),this.warp(e,n,1,r)),this},update:function(t){t*=this.timeScale,this.time+=t;for(var e,r=0;r<this.actions.length;r++){var i=this.actions[r],n=i.getWeightAt(this.time),o=i.getTimeScaleAt(this.time),o=i.update(t*o);if(!(i.weight<=0)&&i.enabled)for(var a=0;a<o.length;a++)i.propertyBindings[a].accumulate(o[a],n)}for(e in this.propertyBindingMap)this.propertyBindingMap[e].apply();return this}},THREE.EventDispatcher.prototype.apply(THREE.AnimationMixer.prototype),THREE.AnimationUtils={getEqualsFunc:function(t){return t.equals?function(t,e){return t.equals(e)}:function(t,e){return t===e}},clone:function(t){if("object"===_typeof(t)){if(t.clone)return t.clone();console.error("can not figure out how to copy exemplarValue",t)}return t},lerp:function(t,e,r,i){return THREE.AnimationUtils.getLerpFunc(t,i)(t,e,r)},lerp_object:function(t,e,r){return t.lerp(e,r)},slerp_object:function(t,e,r){return t.slerp(e,r)},lerp_number:function(t,e,r){return t*(1-r)+e*r},lerp_boolean:function(t,e,r){return r<.5?t:e},lerp_boolean_immediate:function(t){return t},lerp_string:function(t,e,r){return r<.5?t:e},lerp_string_immediate:function(t){return t},getLerpFunc:function(t,e){if(null==t)throw Error("examplarValue is null");switch(_typeof(t)){case"object":if(t.lerp)return THREE.AnimationUtils.lerp_object;if(t.slerp)return THREE.AnimationUtils.slerp_object;break;case"number":return THREE.AnimationUtils.lerp_number;case"boolean":return e?THREE.AnimationUtils.lerp_boolean:THREE.AnimationUtils.lerp_boolean_immediate;case"string":return e?THREE.AnimationUtils.lerp_string:THREE.AnimationUtils.lerp_string_immediate}}},THREE.KeyframeTrack=function(t,e){if(void 0===t)throw Error("track name is undefined");if(void 0===e||0===e.length)throw Error("no keys in track named "+t);this.name=t,this.keys=e,this.lastIndex=0,this.validate(),this.optimize()},THREE.KeyframeTrack.prototype={constructor:THREE.KeyframeTrack,getAt:function(t){for(;this.lastIndex<this.keys.length&&t>=this.keys[this.lastIndex].time;)this.lastIndex++;for(;0<this.lastIndex&&t<this.keys[this.lastIndex-1].time;)this.lastIndex--;if(this.lastIndex>=this.keys.length)return this.setResult(this.keys[this.keys.length-1].value),this.result;if(0===this.lastIndex)return this.setResult(this.keys[0].value),this.result;var e=this.keys[this.lastIndex-1];if(this.setResult(e.value),e.constantToNext)return this.result;var r=this.keys[this.lastIndex];return this.result=this.lerpValues(this.result,r.value,(t-e.time)/(r.time-e.time))},shift:function(t){if(0!==t)for(var e=0;e<this.keys.length;e++)this.keys[e].time+=t;return this},scale:function(t){if(1!==t)for(var e=0;e<this.keys.length;e++)this.keys[e].time*=t;return this},trim:function(t,e){for(var r=0,i=1;i<this.keys.length;i++)this.keys[i]<=t&&r++;for(var n=0,i=this.keys.length-2;0<i&&this.keys[i]>=e;i++)n++;return 0<r+n&&(this.keys=this.keys.splice(r,this.keys.length-n-r)),this},validate:function(){var t=null;if(0!==this.keys.length){for(var e=0;e<this.keys.length;e++){var r=this.keys[e];if(!r)return void console.error(" key is null in track",this,e);if("number"!=typeof r.time||isNaN(r.time))return void console.error(" key.time is not a valid number",this,e,r);if(void 0===r.value||null===r.value)return void console.error(" key.value is null in track",this,e,r);if(t&&t.time>r.time)return void console.error(" key.time is less than previous key time, out of order keys",this,e,r,t);t=r}return this}console.error(" track is empty, no keys",this)},optimize:function(){var t=[],e=this.keys[0];t.push(e),THREE.AnimationUtils.getEqualsFunc(e.value);for(var r=1;r<this.keys.length-1;r++){var i=this.keys[r],n=this.keys[r+1];e.time===i.time||this.compareValues(e.value,i.value)&&this.compareValues(i.value,n.value)||(e.constantToNext=this.compareValues(e.value,i.value),t.push(i),e=i)}return t.push(this.keys[this.keys.length-1]),this.keys=t,this}},THREE.KeyframeTrack.keyComparer=function(t,e){return t.time-e.time},THREE.KeyframeTrack.parse=function(t){if(void 0===t.type)throw Error("track type undefined, can not parse");return THREE.KeyframeTrack.GetTrackTypeForTypeName(t.type).parse(t)},THREE.KeyframeTrack.GetTrackTypeForTypeName=function(t){switch(t.toLowerCase()){case"vector":case"vector2":case"vector3":case"vector4":return THREE.VectorKeyframeTrack;case"quaternion":return THREE.QuaternionKeyframeTrack;case"integer":case"scalar":case"double":case"float":case"number":return THREE.NumberKeyframeTrack;case"bool":case"boolean":return THREE.BooleanKeyframeTrack;case"string":return THREE.StringKeyframeTrack}throw Error("Unsupported typeName: "+t)},THREE.PropertyBinding=function(t,e){this.rootNode=t,this.trackName=e,this.referenceCount=0,this.originalValue=null;var r=THREE.PropertyBinding.parseTrackName(e);this.directoryName=r.directoryName,this.nodeName=r.nodeName,this.objectName=r.objectName,this.objectIndex=r.objectIndex,this.propertyName=r.propertyName,this.propertyIndex=r.propertyIndex,this.node=THREE.PropertyBinding.findNode(t,this.nodeName)||t,this.cumulativeValue=null,this.cumulativeWeight=0},THREE.PropertyBinding.prototype={constructor:THREE.PropertyBinding,reset:function(){this.cumulativeValue=null,this.cumulativeWeight=0},accumulate:function(t,e){this.isBound||this.bind(),0===this.cumulativeWeight?0<e&&(null===this.cumulativeValue&&(this.cumulativeValue=THREE.AnimationUtils.clone(t)),this.cumulativeWeight=e):(this.cumulativeValue=this.lerpValue(this.cumulativeValue,t,e/(this.cumulativeWeight+e)),this.cumulativeWeight+=e)},unbind:function(){this.isBound&&(this.setValue(this.originalValue),this.triggerDirty=this.equalsValue=this.lerpValue=this.getValue=this.setValue=null,this.isBound=!1)},bind:function(){if(!this.isBound)if(e=this.node){if(this.objectName){if("materials"===this.objectName){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}else if("bones"===this.objectName){if(!e.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);for(var e=e.skeleton.bones,t=0;t<e.length;t++)if(e[t].name===this.objectIndex){this.objectIndex=t;break}}else{if(void 0===e[this.objectName])return void console.error(" can not bind to objectName of node, undefined",this);e=e[this.objectName]}if(void 0!==this.objectIndex){if(void 0===e[this.objectIndex])return void console.error(" trying to bind to objectIndex of objectName, but is undefined:",this,e);e=e[this.objectIndex]}}var r=e[this.propertyName];if(r){if(void 0!==this.propertyIndex){if("morphTargetInfluences"===this.propertyName)for(e.geometry||console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry",this),e.geometry.morphTargets||console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this),t=0;t<this.node.geometry.morphTargets.length;t++)if(e.geometry.morphTargets[t].name===this.propertyIndex){this.propertyIndex=t;break}this.setValue=function(t){return!this.equalsValue(r[this.propertyIndex],t)&&(r[this.propertyIndex]=t,!0)},this.getValue=function(){return r[this.propertyIndex]}}else r.copy?(this.setValue=function(t){return!this.equalsValue(r,t)&&(r.copy(t),!0)},this.getValue=function(){return r}):(this.setValue=function(t){return!this.equalsValue(e[this.propertyName],t)&&(e[this.propertyName]=t,!0)},this.getValue=function(){return e[this.propertyName]});void 0!==e.needsUpdate?this.triggerDirty=function(){this.node.needsUpdate=!0}:void 0!==e.matrixWorldNeedsUpdate&&(this.triggerDirty=function(){e.matrixWorldNeedsUpdate=!0}),this.originalValue=this.getValue(),this.equalsValue=THREE.AnimationUtils.getEqualsFunc(this.originalValue),this.lerpValue=THREE.AnimationUtils.getLerpFunc(this.originalValue,!0),this.isBound=!0}else console.error(" trying to update property for track: "+this.nodeName+"."+this.propertyName+" but it wasn't found.",e)}else console.error(" trying to update node for track: "+this.trackName+" but it wasn't found.")},apply:function(){var t;this.isBound||this.bind(),0<this.cumulativeWeight&&(this.cumulativeWeight<1&&(t=1-this.cumulativeWeight,this.cumulativeValue=this.lerpValue(this.cumulativeValue,this.originalValue,t/(this.cumulativeWeight+t))),this.setValue(this.cumulativeValue)&&this.triggerDirty&&this.triggerDirty(),this.cumulativeValue=null,this.cumulativeWeight=0)}},THREE.PropertyBinding.parseTrackName=function(t){var e=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_. ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,r=e.exec(t);if(!r)throw Error("cannot parse trackName at all: "+t);if(r.index===e.lastIndex&&e.lastIndex++,null===(e={directoryName:r[1],nodeName:r[3],objectName:r[5],objectIndex:r[7],propertyName:r[9],propertyIndex:r[11]}).propertyName||0===e.propertyName.length)throw Error("can not parse propertyName from trackName: "+t);return e},THREE.PropertyBinding.findNode=function(t,n){if(!n||""===n||"root"===n||"."===n||-1===n||n===t.name||n===t.uuid)return t;if(t.skeleton){var e=function(t){for(var e=0;e<t.bones.length;e++){var r=t.bones[e];if(r.name===n)return r}return null}(t.skeleton);if(e)return e}return t.children&&(e=function t(e){for(var r=0;r<e.length;r++){var i=e[r];if(i.name===n||i.uuid===n||(i=t(i.children)))return i}return null}(t.children))?e:null},THREE.VectorKeyframeTrack=function(t,e){THREE.KeyframeTrack.call(this,t,e),this.result=this.keys[0].value.clone()},THREE.VectorKeyframeTrack.prototype=Object.create(THREE.KeyframeTrack.prototype),THREE.VectorKeyframeTrack.prototype.constructor=THREE.VectorKeyframeTrack,THREE.VectorKeyframeTrack.prototype.setResult=function(t){this.result.copy(t)},THREE.VectorKeyframeTrack.prototype.lerpValues=function(t,e,r){return t.lerp(e,r)},THREE.VectorKeyframeTrack.prototype.compareValues=function(t,e){return t.equals(e)},THREE.VectorKeyframeTrack.prototype.clone=function(){for(var t=[],e=0;e<this.keys.length;e++){var r=this.keys[e];t.push({time:r.time,value:r.value.clone()})}return new THREE.VectorKeyframeTrack(this.name,t)},THREE.VectorKeyframeTrack.parse=function(t){for(var e=THREE["Vector"+t.keys[0].value.length],r=[],i=0;i<t.keys.length;i++){var n=t.keys[i];r.push({value:(new e).fromArray(n.value),time:n.time})}return new THREE.VectorKeyframeTrack(t.name,r)},THREE.QuaternionKeyframeTrack=function(t,e){THREE.KeyframeTrack.call(this,t,e),this.result=this.keys[0].value.clone()},THREE.QuaternionKeyframeTrack.prototype=Object.create(THREE.KeyframeTrack.prototype),THREE.QuaternionKeyframeTrack.prototype.constructor=THREE.QuaternionKeyframeTrack,THREE.QuaternionKeyframeTrack.prototype.setResult=function(t){this.result.copy(t)},THREE.QuaternionKeyframeTrack.prototype.lerpValues=function(t,e,r){return t.slerp(e,r)},THREE.QuaternionKeyframeTrack.prototype.compareValues=function(t,e){return t.equals(e)},THREE.QuaternionKeyframeTrack.prototype.multiply=function(t){for(var e=0;e<this.keys.length;e++)this.keys[e].value.multiply(t);return this},THREE.QuaternionKeyframeTrack.prototype.clone=function(){for(var t=[],e=0;e<this.keys.length;e++){var r=this.keys[e];t.push({time:r.time,value:r.value.clone()})}return new THREE.QuaternionKeyframeTrack(this.name,t)},THREE.QuaternionKeyframeTrack.parse=function(t){for(var e=[],r=0;r<t.keys.length;r++){var i=t.keys[r];e.push({value:(new THREE.Quaternion).fromArray(i.value),time:i.time})}return new THREE.QuaternionKeyframeTrack(t.name,e)},THREE.StringKeyframeTrack=function(t,e){THREE.KeyframeTrack.call(this,t,e),this.result=this.keys[0].value},THREE.StringKeyframeTrack.prototype=Object.create(THREE.KeyframeTrack.prototype),THREE.StringKeyframeTrack.prototype.constructor=THREE.StringKeyframeTrack,THREE.StringKeyframeTrack.prototype.setResult=function(t){this.result=t},THREE.StringKeyframeTrack.prototype.lerpValues=function(t,e,r){return r<1?t:e},THREE.StringKeyframeTrack.prototype.compareValues=function(t,e){return t===e},THREE.StringKeyframeTrack.prototype.clone=function(){for(var t=[],e=0;e<this.keys.length;e++){var r=this.keys[e];t.push({time:r.time,value:r.value})}return new THREE.StringKeyframeTrack(this.name,t)},THREE.StringKeyframeTrack.parse=function(t){return new THREE.StringKeyframeTrack(t.name,t.keys)},THREE.BooleanKeyframeTrack=function(t,e){THREE.KeyframeTrack.call(this,t,e),this.result=this.keys[0].value},THREE.BooleanKeyframeTrack.prototype=Object.create(THREE.KeyframeTrack.prototype),THREE.BooleanKeyframeTrack.prototype.constructor=THREE.BooleanKeyframeTrack,THREE.BooleanKeyframeTrack.prototype.setResult=function(t){this.result=t},THREE.BooleanKeyframeTrack.prototype.lerpValues=function(t,e,r){return r<1?t:e},THREE.BooleanKeyframeTrack.prototype.compareValues=function(t,e){return t===e},THREE.BooleanKeyframeTrack.prototype.clone=function(){for(var t=[],e=0;e<this.keys.length;e++){var r=this.keys[e];t.push({time:r.time,value:r.value})}return new THREE.BooleanKeyframeTrack(this.name,t)},THREE.BooleanKeyframeTrack.parse=function(t){return new THREE.BooleanKeyframeTrack(t.name,t.keys)},THREE.NumberKeyframeTrack=function(t,e){THREE.KeyframeTrack.call(this,t,e),this.result=this.keys[0].value},THREE.NumberKeyframeTrack.prototype=Object.create(THREE.KeyframeTrack.prototype),THREE.NumberKeyframeTrack.prototype.constructor=THREE.NumberKeyframeTrack,THREE.NumberKeyframeTrack.prototype.setResult=function(t){this.result=t},THREE.NumberKeyframeTrack.prototype.lerpValues=function(t,e,r){return t*(1-r)+e*r},THREE.NumberKeyframeTrack.prototype.compareValues=function(t,e){return t===e},THREE.NumberKeyframeTrack.prototype.clone=function(){for(var t=[],e=0;e<this.keys.length;e++){var r=this.keys[e];t.push({time:r.time,value:r.value})}return new THREE.NumberKeyframeTrack(this.name,t)},THREE.NumberKeyframeTrack.parse=function(t){return new THREE.NumberKeyframeTrack(t.name,t.keys)},THREE.Camera=function(){THREE.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new THREE.Matrix4,this.projectionMatrix=new THREE.Matrix4},THREE.Camera.prototype=Object.create(THREE.Object3D.prototype),THREE.Camera.prototype.constructor=THREE.Camera,THREE.Camera.prototype.getWorldDirection=function(){var e=new THREE.Quaternion;return function(t){return t=t||new THREE.Vector3,this.getWorldQuaternion(e),t.set(0,0,-1).applyQuaternion(e)}}(),THREE.Camera.prototype.lookAt=function(){var e=new THREE.Matrix4;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),THREE.Camera.prototype.clone=function(){return(new this.constructor).copy(this)},THREE.Camera.prototype.copy=function(t){return THREE.Object3D.prototype.copy.call(this,t),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},THREE.CubeCamera=function(t,e,r){THREE.Object3D.call(this),this.type="CubeCamera";var n=new THREE.PerspectiveCamera(90,1,t,e);n.up.set(0,-1,0),n.lookAt(new THREE.Vector3(1,0,0)),this.add(n);var o=new THREE.PerspectiveCamera(90,1,t,e);o.up.set(0,-1,0),o.lookAt(new THREE.Vector3(-1,0,0)),this.add(o);var a=new THREE.PerspectiveCamera(90,1,t,e);a.up.set(0,0,1),a.lookAt(new THREE.Vector3(0,1,0)),this.add(a);var s=new THREE.PerspectiveCamera(90,1,t,e);s.up.set(0,0,-1),s.lookAt(new THREE.Vector3(0,-1,0)),this.add(s);var h=new THREE.PerspectiveCamera(90,1,t,e);h.up.set(0,-1,0),h.lookAt(new THREE.Vector3(0,0,1)),this.add(h);var c=new THREE.PerspectiveCamera(90,1,t,e);c.up.set(0,-1,0),c.lookAt(new THREE.Vector3(0,0,-1)),this.add(c),this.renderTarget=new THREE.WebGLRenderTargetCube(r,r,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter}),this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,i=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,t.render(e,n,r),r.activeCubeFace=1,t.render(e,o,r),r.activeCubeFace=2,t.render(e,a,r),r.activeCubeFace=3,t.render(e,s,r),r.activeCubeFace=4,t.render(e,h,r),r.texture.generateMipmaps=i,r.activeCubeFace=5,t.render(e,c,r),t.setRenderTarget(null)}},THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype),THREE.CubeCamera.prototype.constructor=THREE.CubeCamera,THREE.OrthographicCamera=function(t,e,r,i,n,o){THREE.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=t,this.right=e,this.top=r,this.bottom=i,this.near=void 0!==n?n:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()},THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype),THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera,THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(r-t,r+t,i+e,i-e,this.near,this.far)},THREE.OrthographicCamera.prototype.copy=function(t){return THREE.Camera.prototype.copy.call(this,t),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this},THREE.OrthographicCamera.prototype.toJSON=function(t){return(t=THREE.Object3D.prototype.toJSON.call(this,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},THREE.PerspectiveCamera=function(t,e,r,i){THREE.Camera.call(this),this.type="PerspectiveCamera",this.zoom=1,this.fov=void 0!==t?t:50,this.aspect=void 0!==e?e:1,this.near=void 0!==r?r:.1,this.far=void 0!==i?i:2e3,this.updateProjectionMatrix()},THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype),THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera,THREE.PerspectiveCamera.prototype.setLens=function(t,e){void 0===e&&(e=24),this.fov=2*THREE.Math.radToDeg(Math.atan(e/(2*t))),this.updateProjectionMatrix()},THREE.PerspectiveCamera.prototype.setViewOffset=function(t,e,r,i,n,o){this.fullWidth=t,this.fullHeight=e,this.x=r,this.y=i,this.width=n,this.height=o,this.updateProjectionMatrix()},THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var t,e,r,i=THREE.Math.radToDeg(2*Math.atan(Math.tan(.5*THREE.Math.degToRad(this.fov))/this.zoom));this.fullWidth?(t=(e=this.fullWidth/this.fullHeight)*(r=-(i=Math.tan(THREE.Math.degToRad(.5*i))*this.near)),e=Math.abs(e*i-t),r=Math.abs(i-r),this.projectionMatrix.makeFrustum(t+this.x*e/this.fullWidth,t+(this.x+this.width)*e/this.fullWidth,i-(this.y+this.height)*r/this.fullHeight,i-this.y*r/this.fullHeight,this.near,this.far)):this.projectionMatrix.makePerspective(i,this.aspect,this.near,this.far)},THREE.PerspectiveCamera.prototype.copy=function(t){return THREE.Camera.prototype.copy.call(this,t),this.fov=t.fov,this.aspect=t.aspect,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this},THREE.PerspectiveCamera.prototype.toJSON=function(t){return(t=THREE.Object3D.prototype.toJSON.call(this,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},THREE.Light=function(t){THREE.Object3D.call(this),this.type="Light",this.color=new THREE.Color(t),this.receiveShadow=void 0},THREE.Light.prototype=Object.create(THREE.Object3D.prototype),THREE.Light.prototype.constructor=THREE.Light,Object.defineProperties(THREE.Light.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow ) instead.")}},shadowBias:{set:function(t){this.shadow.bias=t}},shadowDarkness:{set:function(t){this.shadow.darkness=t}},shadowMapWidth:{set:function(t){this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){this.shadow.mapSize.height=t}}}),THREE.Light.prototype.copy=function(t){return THREE.Object3D.prototype.copy.call(this,t),this.color.copy(t.color),this},THREE.Light.prototype.toJSON=function(t){return(t=THREE.Object3D.prototype.toJSON.call(this,t)).object.color=this.color.getHex(),void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.intensity&&(t.object.intensity=this.intensity),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.exponent&&(t.object.exponent=this.exponent),t},THREE.LightShadow=function(t){this.camera=t,this.bias=0,this.darkness=1,this.mapSize=new THREE.Vector2(512,512),this.matrix=this.map=null},THREE.LightShadow.prototype={constructor:THREE.LightShadow,copy:function(t){this.camera=t.camera.clone(),this.bias=t.bias,this.darkness=t.darkness,this.mapSize.copy(t.mapSize)},clone:function(){return(new this.constructor).copy(this)}},THREE.AmbientLight=function(t){THREE.Light.call(this,t),this.type="AmbientLight",this.castShadow=void 0},THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype),THREE.AmbientLight.prototype.constructor=THREE.AmbientLight,THREE.DirectionalLight=function(t,e){THREE.Light.call(this,t),this.type="DirectionalLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new THREE.Object3D,this.intensity=void 0!==e?e:1,this.shadow=new THREE.LightShadow(new THREE.OrthographicCamera(-500,500,500,-500,50,5e3))},THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype),THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight,THREE.DirectionalLight.prototype.copy=function(t){return THREE.Light.prototype.copy.call(this,t),this.intensity=t.intensity,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this},THREE.HemisphereLight=function(t,e,r){THREE.Light.call(this,t),this.type="HemisphereLight",this.castShadow=void 0,this.position.set(0,1,0),this.updateMatrix(),this.groundColor=new THREE.Color(e),this.intensity=void 0!==r?r:1},THREE.HemisphereLight.prototype=Object.create(THREE.Light.prototype),THREE.HemisphereLight.prototype.constructor=THREE.HemisphereLight,THREE.HemisphereLight.prototype.copy=function(t){return THREE.Light.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this.intensity=t.intensity,this},THREE.PointLight=function(t,e,r,i){THREE.Light.call(this,t),this.type="PointLight",this.intensity=void 0!==e?e:1,this.distance=void 0!==r?r:0,this.decay=void 0!==i?i:1,this.shadow=new THREE.LightShadow(new THREE.PerspectiveCamera(90,1,1,500))},THREE.PointLight.prototype=Object.create(THREE.Light.prototype),THREE.PointLight.prototype.constructor=THREE.PointLight,THREE.PointLight.prototype.copy=function(t){return THREE.Light.prototype.copy.call(this,t),this.intensity=t.intensity,this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this},THREE.SpotLight=function(t,e,r,i,n,o){THREE.Light.call(this,t),this.type="SpotLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new THREE.Object3D,this.intensity=void 0!==e?e:1,this.distance=void 0!==r?r:0,this.angle=void 0!==i?i:Math.PI/3,this.exponent=void 0!==n?n:10,this.decay=void 0!==o?o:1,this.shadow=new THREE.LightShadow(new THREE.PerspectiveCamera(50,1,50,5e3))},THREE.SpotLight.prototype=Object.create(THREE.Light.prototype),THREE.SpotLight.prototype.constructor=THREE.SpotLight,THREE.SpotLight.prototype.copy=function(t){return THREE.Light.prototype.copy.call(this,t),this.intensity=t.intensity,this.distance=t.distance,this.angle=t.angle,this.exponent=t.exponent,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this},THREE.Cache={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},THREE.Loader=function(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:void 0,extractUrlBase:function(t){return 1===(t=t.split("/")).length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(t,e,r){for(var i=[],n=0;n<t.length;++n)i[n]=this.createMaterial(t[n],e,r);return i},createMaterial:function(){var o,c,u;return function(t,a,s){function e(t,e,r,i,n){t=a+t;var o=THREE.Loader.Handlers.get(t);return t=null!==o?o.load(t):(c.setCrossOrigin(s),c.load(t)),void 0!==e&&(t.repeat.fromArray(e),1!==e[0]&&(t.wrapS=THREE.RepeatWrapping),1!==e[1]&&(t.wrapT=THREE.RepeatWrapping)),void 0!==r&&t.offset.fromArray(r),void 0!==i&&("repeat"===i[0]&&(t.wrapS=THREE.RepeatWrapping),"mirror"===i[0]&&(t.wrapS=THREE.MirroredRepeatWrapping),"repeat"===i[1]&&(t.wrapT=THREE.RepeatWrapping),"mirror"===i[1]&&(t.wrapT=THREE.MirroredRepeatWrapping)),void 0!==n&&(t.anisotropy=n),e=THREE.Math.generateUUID(),h[e]=t,e}void 0===o&&(o=new THREE.Color),void 0===c&&(c=new THREE.TextureLoader),void 0===u&&(u=new THREE.MaterialLoader);var r,h={},i={uuid:THREE.Math.generateUUID(),type:"MeshLambertMaterial"};for(r in t){var n=t[r];switch(r){case"DbgColor":i.color=n;break;case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":i.name=n;break;case"blending":i.blending=THREE[n];break;case"colorDiffuse":i.color=o.fromArray(n).getHex();break;case"colorSpecular":i.specular=o.fromArray(n).getHex();break;case"colorEmissive":i.emissive=o.fromArray(n).getHex();break;case"specularCoef":i.shininess=n;break;case"shading":"basic"===n.toLowerCase()&&(i.type="MeshBasicMaterial"),"phong"===n.toLowerCase()&&(i.type="MeshPhongMaterial");break;case"mapDiffuse":i.map=e(n,t.mapDiffuseRepeat,t.mapDiffuseOffset,t.mapDiffuseWrap,t.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapLight":i.lightMap=e(n,t.mapLightRepeat,t.mapLightOffset,t.mapLightWrap,t.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":i.aoMap=e(n,t.mapAORepeat,t.mapAOOffset,t.mapAOWrap,t.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":i.bumpMap=e(n,t.mapBumpRepeat,t.mapBumpOffset,t.mapBumpWrap,t.mapBumpAnisotropy);break;case"mapBumpScale":i.bumpScale=n;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":i.normalMap=e(n,t.mapNormalRepeat,t.mapNormalOffset,t.mapNormalWrap,t.mapNormalAnisotropy);break;case"mapNormalFactor":i.normalScale=[n,n];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":i.specularMap=e(n,t.mapSpecularRepeat,t.mapSpecularOffset,t.mapSpecularWrap,t.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapAlpha":i.alphaMap=e(n,t.mapAlphaRepeat,t.mapAlphaOffset,t.mapAlphaWrap,t.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":i.side=THREE.BackSide;break;case"doubleSided":i.side=THREE.DoubleSide;break;case"transparency":console.warn("THREE.Loader: transparency has been renamed to opacity"),i.opacity=n;break;case"opacity":case"transparent":case"depthTest":case"depthWrite":case"transparent":case"visible":case"wireframe":i[r]=n;break;case"vertexColors":!0===n&&(i.vertexColors=THREE.VertexColors),"face"===n&&(i.vertexColors=THREE.FaceColors);break;default:console.error("Loader.createMaterial: Unsupported",r,n)}}return"MeshPhongMaterial"!==i.type&&delete i.specular,i.opacity<1&&(i.transparent=!0),u.setTextures(h),u.parse(i)}}()},THREE.Loader.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,r=0,i=e.length;r<i;r+=2){var n=e[r+1];if(e[r].test(t))return n}return null}},THREE.XHRLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager},THREE.XHRLoader.prototype={constructor:THREE.XHRLoader,load:function(e,r,i,n){var o=this,t=THREE.Cache.get(e);if(void 0!==t)return r&&setTimeout(function(){r(t)},0),t;var a=new XMLHttpRequest;return a.open("GET",e,!0),a.addEventListener("load",function(t){t=t.target.response,THREE.Cache.add(e,t),r&&r(t),o.manager.itemEnd(e)},!1),void 0!==i&&a.addEventListener("progress",function(t){i(t)},!1),a.addEventListener("error",function(t){n&&n(t),o.manager.itemError(e)},!1),void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.send(null),o.manager.itemStart(e),a},setResponseType:function(t){this.responseType=t},setCrossOrigin:function(t){this.crossOrigin=t},setWithCredentials:function(t){this.withCredentials=t}},THREE.ImageLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager},THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(e,r,i,n){var o=this,t=THREE.Cache.get(e);if(void 0!==t)return o.manager.itemStart(e),r?setTimeout(function(){r(t),o.manager.itemEnd(e)},0):o.manager.itemEnd(e),t;var a=document.createElement("img");return a.addEventListener("load",function(t){THREE.Cache.add(e,this),r&&r(this),o.manager.itemEnd(e)},!1),void 0!==i&&a.addEventListener("progress",function(t){i(t)},!1),a.addEventListener("error",function(t){n&&n(t),o.manager.itemError(e)},!1),void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),o.manager.itemStart(e),a.src=e,a},setCrossOrigin:function(t){this.crossOrigin=t}},THREE.JSONLoader=function(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:THREE.DefaultLoadingManager,this.withCredentials=!1},THREE.JSONLoader.prototype={constructor:THREE.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(r,i,t){var n=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:THREE.Loader.prototype.extractUrlBase(r);(t=new THREE.XHRLoader(this.manager)).setCrossOrigin(this.crossOrigin),t.setWithCredentials(this.withCredentials),t.load(r,function(t){var e=(t=JSON.parse(t)).metadata;if(void 0!==e){if("object"===e.type)return void console.error("THREE.JSONLoader: "+r+" should be loaded with THREE.ObjectLoader instead.");if("scene"===e.type)return void console.error("THREE.JSONLoader: "+r+" should be loaded with THREE.SceneLoader instead.")}t=n.parse(t,o),i(t.geometry,t.materials)})},setCrossOrigin:function(t){this.crossOrigin=t},setTexturePath:function(t){this.texturePath=t},parse:function(g,t){var y=new THREE.Geometry,e=void 0!==g.scale?1/g.scale:1;return function(t){var e,r,i,n,o,a,s,h,c,u,l,E,p=g.faces,d=g.vertices,f=g.normals,m=g.colors,T=0;if(void 0!==g.uvs){for(e=0;e<g.uvs.length;e++)g.uvs[e].length&&T++;for(e=0;e<T;e++)y.faceVertexUvs[e]=[]}for(n=0,o=d.length;n<o;)(e=new THREE.Vector3).x=d[n++]*t,e.y=d[n++]*t,e.z=d[n++]*t,y.vertices.push(e);for(n=0,o=p.length;n<o;)if(h=1&(t=p[n++]),i=2&t,e=8&t,a=16&t,c=32&t,d=64&t,t&=128,h){if((h=new THREE.Face3).a=p[n],h.b=p[n+1],h.c=p[n+3],(u=new THREE.Face3).a=p[n+1],u.b=p[n+2],u.c=p[n+3],n+=4,i&&(i=p[n++],h.materialIndex=i,u.materialIndex=i),i=y.faces.length,e)for(e=0;e<T;e++)for(l=g.uvs[e],y.faceVertexUvs[e][i]=[],y.faceVertexUvs[e][i+1]=[],r=0;r<4;r++)E=l[2*(s=p[n++])],s=l[2*s+1],E=new THREE.Vector2(E,s),2!==r&&y.faceVertexUvs[e][i].push(E),0!==r&&y.faceVertexUvs[e][i+1].push(E);if(a&&(a=3*p[n++],h.normal.set(f[a++],f[a++],f[a]),u.normal.copy(h.normal)),c)for(e=0;e<4;e++)a=3*p[n++],c=new THREE.Vector3(f[a++],f[a++],f[a]),2!==e&&h.vertexNormals.push(c),0!==e&&u.vertexNormals.push(c);if(d&&(d=m[d=p[n++]],h.color.setHex(d),u.color.setHex(d)),t)for(e=0;e<4;e++)d=m[d=p[n++]],2!==e&&h.vertexColors.push(new THREE.Color(d)),0!==e&&u.vertexColors.push(new THREE.Color(d));y.faces.push(h),y.faces.push(u)}else{if((h=new THREE.Face3).a=p[n++],h.b=p[n++],h.c=p[n++],i&&(i=p[n++],h.materialIndex=i),i=y.faces.length,e)for(e=0;e<T;e++)for(l=g.uvs[e],y.faceVertexUvs[e][i]=[],r=0;r<3;r++)E=l[2*(s=p[n++])],s=l[2*s+1],E=new THREE.Vector2(E,s),y.faceVertexUvs[e][i].push(E);if(a&&(a=3*p[n++],h.normal.set(f[a++],f[a++],f[a])),c)for(e=0;e<3;e++)a=3*p[n++],c=new THREE.Vector3(f[a++],f[a++],f[a]),h.vertexNormals.push(c);if(d&&(d=p[n++],h.color.setHex(m[d])),t)for(e=0;e<3;e++)d=p[n++],h.vertexColors.push(new THREE.Color(m[d]));y.faces.push(h)}}(e),function(){var t=void 0!==g.influencesPerVertex?g.influencesPerVertex:2;if(g.skinWeights)for(var e=0,r=g.skinWeights.length;e<r;e+=t)y.skinWeights.push(new THREE.Vector4(g.skinWeights[e],1<t?g.skinWeights[e+1]:0,2<t?g.skinWeights[e+2]:0,3<t?g.skinWeights[e+3]:0));if(g.skinIndices)for(e=0,r=g.skinIndices.length;e<r;e+=t)y.skinIndices.push(new THREE.Vector4(g.skinIndices[e],1<t?g.skinIndices[e+1]:0,2<t?g.skinIndices[e+2]:0,3<t?g.skinIndices[e+3]:0));y.bones=g.bones,y.bones&&0<y.bones.length&&(y.skinWeights.length!==y.skinIndices.length||y.skinIndices.length!==y.vertices.length)&&console.warn("When skinning, number of vertices ("+y.vertices.length+"), skinIndices ("+y.skinIndices.length+"), and skinWeights ("+y.skinWeights.length+") should match.")}(),function(t){if(void 0!==g.morphTargets)for(var e=0,r=g.morphTargets.length;e<r;e++){y.morphTargets[e]={},y.morphTargets[e].name=g.morphTargets[e].name,y.morphTargets[e].vertices=[];for(var i=y.morphTargets[e].vertices,n=g.morphTargets[e].vertices,o=0,a=n.length;o<a;o+=3){var s=new THREE.Vector3;s.x=n[o]*t,s.y=n[o+1]*t,s.z=n[o+2]*t,i.push(s)}}if(void 0!==g.morphColors&&0<g.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),t=y.faces,i=g.morphColors[0].colors,e=0,r=t.length;e<r;e++)t[e].color.fromArray(i,3*e)}(e),function(){var t=[],e=[];void 0!==g.animation&&e.push(g.animation),void 0!==g.animations&&(g.animations.length?e=e.concat(g.animations):e.push(g.animations));for(var r=0;r<e.length;r++){var i=THREE.AnimationClip.parseAnimation(e[r],y.bones);i&&t.push(i)}y.morphTargets&&(e=THREE.AnimationClip.CreateClipsFromMorphTargetSequences(y.morphTargets,10),t=t.concat(e)),0<t.length&&(y.animations=t)}(),y.computeFaceNormals(),y.computeBoundingSphere(),void 0===g.materials||0===g.materials.length?{geometry:y}:(e=THREE.Loader.prototype.initMaterials(g.materials,t,this.crossOrigin),{geometry:y,materials:e})}},THREE.LoadingManager=function(t,e,r){var i=this,n=!1,o=0,a=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=r,this.itemStart=function(t){a++,!1===n&&void 0!==i.onStart&&i.onStart(t,o,a),n=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,a),o===a&&(n=!1,void 0!==i.onLoad)&&i.onLoad()},this.itemError=function(t){void 0!==i.onError&&i.onError(t)}},THREE.DefaultLoadingManager=new THREE.LoadingManager,THREE.BufferGeometryLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager},THREE.BufferGeometryLoader.prototype={constructor:THREE.BufferGeometryLoader,load:function(t,e,r,i){var n=this,o=new THREE.XHRLoader(n.manager);o.setCrossOrigin(this.crossOrigin),o.load(t,function(t){e(n.parse(JSON.parse(t)))},r,i)},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t){var e=new THREE.BufferGeometry;void 0!==(o=t.data.index)&&(o=new self[o.type](o.array),e.setIndex(new THREE.BufferAttribute(o,1)));var r,i=t.data.attributes;for(r in i){var n=i[r],o=new self[n.type](n.array);e.addAttribute(r,new THREE.BufferAttribute(o,n.itemSize))}if(void 0!==(r=t.data.groups||t.data.drawcalls||t.data.offsets))for(o=0,i=r.length;o!==i;++o)n=r[o],e.addGroup(n.start,n.count);return void 0!==(t=t.data.boundingSphere)&&(r=new THREE.Vector3,void 0!==t.center&&r.fromArray(t.center),e.boundingSphere=new THREE.Sphere(r,t.radius)),e}},THREE.MaterialLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager,this.textures={}},THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(t,e,r,i){var n=this,o=new THREE.XHRLoader(n.manager);o.setCrossOrigin(this.crossOrigin),o.load(t,function(t){e(n.parse(JSON.parse(t)))},r,i)},setCrossOrigin:function(t){this.crossOrigin=t},setTextures:function(t){this.textures=t},getTexture:function(t){var e=this.textures;return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]},parse:function(t){var e=new THREE[t.type];if(e.uuid=t.uuid,void 0!==t.name&&(e.name=t.name),void 0!==t.color&&e.color.setHex(t.color),void 0!==t.emissive&&e.emissive.setHex(t.emissive),void 0!==t.specular&&e.specular.setHex(t.specular),void 0!==t.shininess&&(e.shininess=t.shininess),void 0!==t.uniforms&&(e.uniforms=t.uniforms),void 0!==t.vertexShader&&(e.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(e.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(e.vertexColors=t.vertexColors),void 0!==t.shading&&(e.shading=t.shading),void 0!==t.blending&&(e.blending=t.blending),void 0!==t.side&&(e.side=t.side),void 0!==t.opacity&&(e.opacity=t.opacity),void 0!==t.transparent&&(e.transparent=t.transparent),void 0!==t.alphaTest&&(e.alphaTest=t.alphaTest),void 0!==t.depthTest&&(e.depthTest=t.depthTest),void 0!==t.depthWrite&&(e.depthWrite=t.depthWrite),void 0!==t.wireframe&&(e.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(e.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.size&&(e.size=t.size),void 0!==t.sizeAttenuation&&(e.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(e.map=this.getTexture(t.map)),void 0!==t.alphaMap&&(e.alphaMap=this.getTexture(t.alphaMap),e.transparent=!0),void 0!==t.bumpMap&&(e.bumpMap=this.getTexture(t.bumpMap)),void 0!==t.bumpScale&&(e.bumpScale=t.bumpScale),void 0!==t.normalMap&&(e.normalMap=this.getTexture(t.normalMap)),t.normalScale&&(e.normalScale=new THREE.Vector2(t.normalScale,t.normalScale)),void 0!==t.displacementMap&&(e.displacementMap=this.getTexture(t.displacementMap)),void 0!==t.displacementScale&&(e.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(e.displacementBias=t.displacementBias),void 0!==t.specularMap&&(e.specularMap=this.getTexture(t.specularMap)),void 0!==t.envMap&&(e.envMap=this.getTexture(t.envMap),e.combine=THREE.MultiplyOperation),t.reflectivity&&(e.reflectivity=t.reflectivity),void 0!==t.lightMap&&(e.lightMap=this.getTexture(t.lightMap)),void 0!==t.lightMapIntensity&&(e.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(e.aoMap=this.getTexture(t.aoMap)),void 0!==t.aoMapIntensity&&(e.aoMapIntensity=t.aoMapIntensity),void 0!==t.materials)for(var r=0,i=t.materials.length;r<i;r++)e.materials.push(this.parse(t.materials[r]));return e}},THREE.ObjectLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager,this.texturePath=""},THREE.ObjectLoader.prototype={constructor:THREE.ObjectLoader,load:function(t,e,r,i){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var n=this,o=new THREE.XHRLoader(n.manager);o.setCrossOrigin(this.crossOrigin),o.load(t,function(t){n.parse(JSON.parse(t),e)},r,i)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var r=this.parseGeometries(t.geometries),i=this.parseImages(t.images,function(){void 0!==e&&e(n)}),i=this.parseTextures(t.textures,i),i=this.parseMaterials(t.materials,i),n=this.parseObject(t.object,r,i);return t.animations&&(n.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0===e||e(n),n},parseGeometries:function(t){var e={};if(void 0!==t)for(var r=new THREE.JSONLoader,i=new THREE.BufferGeometryLoader,n=0,o=t.length;n<o;n++){var a,s=t[n];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new THREE[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"CubeGeometry":a=new THREE.BoxGeometry(s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleBufferGeometry":a=new THREE.CircleBufferGeometry(s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CircleGeometry":a=new THREE.CircleGeometry(s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":a=new THREE.CylinderGeometry(s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":a=new THREE.SphereGeometry(s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"SphereBufferGeometry":a=new THREE.SphereBufferGeometry(s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":a=new THREE.DodecahedronGeometry(s.radius,s.detail);break;case"IcosahedronGeometry":a=new THREE.IcosahedronGeometry(s.radius,s.detail);break;case"OctahedronGeometry":a=new THREE.OctahedronGeometry(s.radius,s.detail);break;case"TetrahedronGeometry":a=new THREE.TetrahedronGeometry(s.radius,s.detail);break;case"RingGeometry":a=new THREE.RingGeometry(s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":a=new THREE.TorusGeometry(s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":a=new THREE.TorusKnotGeometry(s.radius,s.tube,s.radialSegments,s.tubularSegments,s.p,s.q,s.heightScale);break;case"BufferGeometry":a=i.parse(s);break;case"Geometry":a=r.parse(s.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),e[s.uuid]=a}return e},parseMaterials:function(t,e){var r={};if(void 0!==t){var i=new THREE.MaterialLoader;i.setTextures(e);for(var n=0,o=t.length;n<o;n++){var a=i.parse(t[n]);r[a.uuid]=a}}return r},parseAnimations:function(t){for(var e=[],r=0;r<t.length;r++){var i=THREE.AnimationClip.parse(t[r]);e.push(i)}return e},parseImages:function(t,e){var r=this,i={};if(void 0!==t&&0<t.length){var n=new THREE.LoadingManager(e),o=new THREE.ImageLoader(n);o.setCrossOrigin(this.crossOrigin);for(var n=0,a=t.length;n<a;n++){var s=t[n],h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(s.url)?s.url:r.texturePath+s.url;i[s.uuid]=function(t){return r.manager.itemStart(t),o.load(t,function(){r.manager.itemEnd(t)})}(h)}}return i},parseTextures:function(t,e){function r(t){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),THREE[t])}var i={};if(void 0!==t)for(var n=0,o=t.length;n<o;n++){var a=t[n];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===e[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);var s=new THREE.Texture(e[a.image]);s.needsUpdate=!0,s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),void 0!==a.mapping&&(s.mapping=r(a.mapping)),void 0!==a.offset&&(s.offset=new THREE.Vector2(a.offset[0],a.offset[1])),void 0!==a.repeat&&(s.repeat=new THREE.Vector2(a.repeat[0],a.repeat[1])),void 0!==a.minFilter&&(s.minFilter=r(a.minFilter)),void 0!==a.magFilter&&(s.magFilter=r(a.magFilter)),void 0!==a.anisotropy&&(s.anisotropy=a.anisotropy),Array.isArray(a.wrap)&&(s.wrapS=r(a.wrap[0]),s.wrapT=r(a.wrap[1])),i[a.uuid]=s}return i},parseObject:function(){var c=new THREE.Matrix4;return function(t,e,r){function i(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function n(t){if(void 0!==t)return void 0===r[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),r[t]}var o;switch(t.type){case"Scene":o=new THREE.Scene;break;case"PerspectiveCamera":o=new THREE.PerspectiveCamera(t.fov,t.aspect,t.near,t.far);break;case"OrthographicCamera":o=new THREE.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":o=new THREE.AmbientLight(t.color);break;case"DirectionalLight":o=new THREE.DirectionalLight(t.color,t.intensity);break;case"PointLight":o=new THREE.PointLight(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":o=new THREE.SpotLight(t.color,t.intensity,t.distance,t.angle,t.exponent,t.decay);break;case"HemisphereLight":o=new THREE.HemisphereLight(t.color,t.groundColor,t.intensity);break;case"Mesh":o=new THREE.Mesh(i(t.geometry),n(t.material));break;case"LOD":o=new THREE.LOD;break;case"Line":o=new THREE.Line(i(t.geometry),n(t.material),t.mode);break;case"PointCloud":case"Points":o=new THREE.Points(i(t.geometry),n(t.material));break;case"Sprite":o=new THREE.Sprite(n(t.material));break;case"Group":o=new THREE.Group;break;default:o=new THREE.Object3D}if(o.uuid=t.uuid,void 0!==t.name&&(o.name=t.name),void 0!==t.matrix?(c.fromArray(t.matrix),c.decompose(o.position,o.quaternion,o.scale)):(void 0!==t.position&&o.position.fromArray(t.position),void 0!==t.rotation&&o.rotation.fromArray(t.rotation),void 0!==t.scale&&o.scale.fromArray(t.scale)),void 0!==t.castShadow&&(o.castShadow=t.castShadow),void 0!==t.receiveShadow&&(o.receiveShadow=t.receiveShadow),void 0!==t.visible&&(o.visible=t.visible),void 0!==t.userData&&(o.userData=t.userData),void 0!==t.children)for(var a in t.children)o.add(this.parseObject(t.children[a],e,r));if("LOD"===t.type){t=t.levels;for(var s=0;s<t.length;s++){var h=t[s];void 0!==(a=o.getObjectByProperty("uuid",h.object))&&o.addLevel(a,h.distance)}}return o}}()},THREE.TextureLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager},THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(t,e,r,i){var n=new THREE.Texture,o=new THREE.ImageLoader(this.manager);return o.setCrossOrigin(this.crossOrigin),o.load(t,function(t){n.image=t,n.needsUpdate=!0,void 0!==e&&e(n)},r,i),n},setCrossOrigin:function(t){this.crossOrigin=t}},THREE.CubeTextureLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager},THREE.CubeTextureLoader.prototype={constructor:THREE.CubeTextureLoader,load:function(t,r,e,i){var n=new THREE.CubeTexture([]),o=new THREE.ImageLoader;o.setCrossOrigin(this.crossOrigin);var a=0;for(e=0;e<t.length;++e)!function(e){o.load(t[e],function(t){n.images[e]=t,6===++a&&(n.needsUpdate=!0,r&&r(n))},void 0,i)}(e);return n},setCrossOrigin:function(t){this.crossOrigin=t}},THREE.DataTextureLoader=THREE.BinaryTextureLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager,this._parser=null},THREE.BinaryTextureLoader.prototype={constructor:THREE.BinaryTextureLoader,load:function(t,e,r,i){var n=this,o=new THREE.DataTexture,a=new THREE.XHRLoader(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setResponseType("arraybuffer"),a.load(t,function(t){(t=n._parser(t))&&(void 0!==t.image?o.image=t.image:void 0!==t.data&&(o.image.width=t.width,o.image.height=t.height,o.image.data=t.data),o.wrapS=void 0!==t.wrapS?t.wrapS:THREE.ClampToEdgeWrapping,o.wrapT=void 0!==t.wrapT?t.wrapT:THREE.ClampToEdgeWrapping,o.magFilter=void 0!==t.magFilter?t.magFilter:THREE.LinearFilter,o.minFilter=void 0!==t.minFilter?t.minFilter:THREE.LinearMipMapLinearFilter,o.anisotropy=void 0!==t.anisotropy?t.anisotropy:1,void 0!==t.format&&(o.format=t.format),void 0!==t.type&&(o.type=t.type),void 0!==t.mipmaps&&(o.mipmaps=t.mipmaps),1===t.mipmapCount&&(o.minFilter=THREE.LinearFilter),o.needsUpdate=!0,e&&e(o,t))},r,i),o},setCrossOrigin:function(t){this.crossOrigin=t}},THREE.CompressedTextureLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager,this._parser=null},THREE.CompressedTextureLoader.prototype={constructor:THREE.CompressedTextureLoader,load:function(t,n,r,i){var o=this,a=[],s=new THREE.CompressedTexture;s.image=a;var h=new THREE.XHRLoader(this.manager);if(h.setCrossOrigin(this.crossOrigin),h.setResponseType("arraybuffer"),Array.isArray(t))for(var c=0,e=0,u=t.length;e<u;++e)!function(e){h.load(t[e],function(t){t=o._parser(t,!0),a[e]={width:t.width,height:t.height,format:t.format,mipmaps:t.mipmaps},6===(c+=1)&&(1===t.mipmapCount&&(s.minFilter=THREE.LinearFilter),s.format=t.format,s.needsUpdate=!0,n&&n(s))},r,i)}(e);else h.load(t,function(t){if((t=o._parser(t,!0)).isCubemap)for(var e=t.mipmaps.length/t.mipmapCount,r=0;r<e;r++){a[r]={mipmaps:[]};for(var i=0;i<t.mipmapCount;i++)a[r].mipmaps.push(t.mipmaps[r*t.mipmapCount+i]),a[r].format=t.format,a[r].width=t.width,a[r].height=t.height}else s.image.width=t.width,s.image.height=t.height,s.mipmaps=t.mipmaps;1===t.mipmapCount&&(s.minFilter=THREE.LinearFilter),s.format=t.format,s.needsUpdate=!0,n&&n(s)},r,i);return s},setCrossOrigin:function(t){this.crossOrigin=t}},THREE.Material=function(){Object.defineProperty(this,"id",{value:THREE.MaterialIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="Material",this.side=THREE.FrontSide,this.opacity=1,this.transparent=!1,this.blending=THREE.NormalBlending,this.blendSrc=THREE.SrcAlphaFactor,this.blendDst=THREE.OneMinusSrcAlphaFactor,this.blendEquation=THREE.AddEquation,this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null,this.depthFunc=THREE.LessEqualDepth,this.colorWrite=this.depthWrite=this.depthTest=!0,this.precision=null,this.polygonOffset=!1,this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0,this._needsUpdate=this.visible=!0},THREE.Material.prototype={constructor:THREE.Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){!0===t&&this.update(),this._needsUpdate=t},setValues:function(t){if(void 0!==t)for(var e in t){var r,i=t[e];void 0===i?console.warn("THREE.Material: '"+e+"' parameter is undefined."):void 0===(r=this[e])?console.warn("THREE."+this.type+": '"+e+"' is not a property of this material."):r instanceof THREE.Color?r.set(i):r instanceof THREE.Vector3&&i instanceof THREE.Vector3?r.copy(i):this[e]="overdraw"===e?Number(i):i}},toJSON:function(t){var e={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};return e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),this.color instanceof THREE.Color&&(e.color=this.color.getHex()),this.emissive instanceof THREE.Color&&(e.emissive=this.emissive.getHex()),this.specular instanceof THREE.Color&&(e.specular=this.specular.getHex()),void 0!==this.shininess&&(e.shininess=this.shininess),this.map instanceof THREE.Texture&&(e.map=this.map.toJSON(t).uuid),this.alphaMap instanceof THREE.Texture&&(e.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap instanceof THREE.Texture&&(e.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap instanceof THREE.Texture&&(e.bumpMap=this.bumpMap.toJSON(t).uuid,e.bumpScale=this.bumpScale),this.normalMap instanceof THREE.Texture&&(e.normalMap=this.normalMap.toJSON(t).uuid,e.normalScale=this.normalScale),this.displacementMap instanceof THREE.Texture&&(e.displacementMap=this.displacementMap.toJSON(t).uuid,e.displacementScale=this.displacementScale,e.displacementBias=this.displacementBias),this.specularMap instanceof THREE.Texture&&(e.specularMap=this.specularMap.toJSON(t).uuid),this.envMap instanceof THREE.Texture&&(e.envMap=this.envMap.toJSON(t).uuid,e.reflectivity=this.reflectivity),void 0!==this.size&&(e.size=this.size),void 0!==this.sizeAttenuation&&(e.sizeAttenuation=this.sizeAttenuation),void 0!==this.vertexColors&&this.vertexColors!==THREE.NoColors&&(e.vertexColors=this.vertexColors),void 0!==this.shading&&this.shading!==THREE.SmoothShading&&(e.shading=this.shading),void 0!==this.blending&&this.blending!==THREE.NormalBlending&&(e.blending=this.blending),void 0!==this.side&&this.side!==THREE.FrontSide&&(e.side=this.side),this.opacity<1&&(e.opacity=this.opacity),!0===this.transparent&&(e.transparent=this.transparent),0<this.alphaTest&&(e.alphaTest=this.alphaTest),!0===this.wireframe&&(e.wireframe=this.wireframe),1<this.wireframeLinewidth&&(e.wireframeLinewidth=this.wireframeLinewidth),e},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.side=t.side,this.opacity=t.opacity,this.transparent=t.transparent,this.blending=t.blending,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.overdraw=t.overdraw,this.visible=t.visible,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})},get wrapAround(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set wrapAround(t){console.warn("THREE."+this.type+": .wrapAround has been removed.")},get wrapRGB(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new THREE.Color}},THREE.EventDispatcher.prototype.apply(THREE.Material.prototype),THREE.MaterialIdCount=0,THREE.LineBasicMaterial=function(t){THREE.Material.call(this),this.type="LineBasicMaterial",this.color=new THREE.Color(16777215),this.linewidth=1,this.linejoin=this.linecap="round",this.vertexColors=THREE.NoColors,this.fog=!0,this.setValues(t)},THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype),THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial,THREE.LineBasicMaterial.prototype.copy=function(t){return THREE.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.vertexColors=t.vertexColors,this.fog=t.fog,this},THREE.LineDashedMaterial=function(t){THREE.Material.call(this),this.type="LineDashedMaterial",this.color=new THREE.Color(16777215),this.scale=this.linewidth=1,this.dashSize=3,this.gapSize=1,this.vertexColors=!1,this.fog=!0,this.setValues(t)},THREE.LineDashedMaterial.prototype=Object.create(THREE.Material.prototype),THREE.LineDashedMaterial.prototype.constructor=THREE.LineDashedMaterial,THREE.LineDashedMaterial.prototype.copy=function(t){return THREE.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this.vertexColors=t.vertexColors,this.fog=t.fog,this},THREE.MeshBasicMaterial=function(t){THREE.Material.call(this),this.type="MeshBasicMaterial",this.color=new THREE.Color(16777215),this.aoMap=this.map=null,this.aoMapIntensity=1,this.envMap=this.alphaMap=this.specularMap=null,this.combine=THREE.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=THREE.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=THREE.NoColors,this.morphTargets=this.skinning=!1,this.setValues(t)},THREE.MeshBasicMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial,THREE.MeshBasicMaterial.prototype.copy=function(t){return THREE.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},THREE.MeshLambertMaterial=function(t){THREE.Material.call(this),this.type="MeshLambertMaterial",this.color=new THREE.Color(16777215),this.emissive=new THREE.Color(0),this.envMap=this.alphaMap=this.specularMap=this.map=null,this.combine=THREE.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=THREE.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)},THREE.MeshLambertMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial,THREE.MeshLambertMaterial.prototype.copy=function(t){return THREE.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.emissive.copy(t.emissive),this.map=t.map,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},THREE.MeshPhongMaterial=function(t){THREE.Material.call(this),this.type="MeshPhongMaterial",this.color=new THREE.Color(16777215),this.emissive=new THREE.Color(0),this.specular=new THREE.Color(1118481),this.shininess=30,this.metal=!1,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new THREE.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.specularMap=null,this.combine=THREE.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=THREE.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=THREE.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)},THREE.MeshPhongMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial,THREE.MeshPhongMaterial.prototype.copy=function(t){return THREE.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.emissive.copy(t.emissive),this.specular.copy(t.specular),this.shininess=t.shininess,this.metal=t.metal,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissiveMap=t.emissiveMap,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},THREE.MeshDepthMaterial=function(t){THREE.Material.call(this),this.type="MeshDepthMaterial",this.wireframe=this.morphTargets=!1,this.wireframeLinewidth=1,this.setValues(t)},THREE.MeshDepthMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial,THREE.MeshDepthMaterial.prototype.copy=function(t){return THREE.Material.prototype.copy.call(this,t),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},THREE.MeshNormalMaterial=function(t){THREE.Material.call(this,t),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(t)},THREE.MeshNormalMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial,THREE.MeshNormalMaterial.prototype.copy=function(t){return THREE.Material.prototype.copy.call(this,t),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},THREE.MultiMaterial=function(t){this.uuid=THREE.Math.generateUUID(),this.type="MultiMaterial",this.materials=t instanceof Array?t:[],this.visible=!0},THREE.MultiMaterial.prototype={constructor:THREE.MultiMaterial,toJSON:function(){for(var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},e=0,r=this.materials.length;e<r;e++)t.materials.push(this.materials[e].toJSON());return t.visible=this.visible,t},clone:function(){for(var t=new this.constructor,e=0;e<this.materials.length;e++)t.materials.push(this.materials[e].clone());return t.visible=this.visible,t}},THREE.MeshFaceMaterial=THREE.MultiMaterial,THREE.PointsMaterial=function(t){THREE.Material.call(this),this.type="PointsMaterial",this.color=new THREE.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.vertexColors=THREE.NoColors,this.fog=!0,this.setValues(t)},THREE.PointsMaterial.prototype=Object.create(THREE.Material.prototype),THREE.PointsMaterial.prototype.constructor=THREE.PointsMaterial,THREE.PointsMaterial.prototype.copy=function(t){return THREE.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.vertexColors=t.vertexColors,this.fog=t.fog,this},THREE.PointCloudMaterial=function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new THREE.PointsMaterial(t)},THREE.ParticleBasicMaterial=function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new THREE.PointsMaterial(t)},THREE.ParticleSystemMaterial=function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new THREE.PointsMaterial(t)},THREE.ShaderMaterial=function(t){THREE.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.shading=THREE.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.lights=this.fog=!1,this.vertexColors=THREE.NoColors,this.derivatives=this.morphNormals=this.morphTargets=this.skinning=!1,this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},(this.index0AttributeName=void 0)!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))},THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype),THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial,THREE.ShaderMaterial.prototype.copy=function(t){return THREE.Material.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=THREE.UniformsUtils.clone(t.uniforms),this.attributes=t.attributes,this.defines=t.defines,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.derivatives=t.derivatives,this},THREE.ShaderMaterial.prototype.toJSON=function(t){return(t=THREE.Material.prototype.toJSON.call(this,t)).uniforms=this.uniforms,t.attributes=this.attributes,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},THREE.RawShaderMaterial=function(t){THREE.ShaderMaterial.call(this,t),this.type="RawShaderMaterial"},THREE.RawShaderMaterial.prototype=Object.create(THREE.ShaderMaterial.prototype),THREE.RawShaderMaterial.prototype.constructor=THREE.RawShaderMaterial,THREE.SpriteMaterial=function(t){THREE.Material.call(this),this.type="SpriteMaterial",this.color=new THREE.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.setValues(t)},THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype),THREE.SpriteMaterial.prototype.constructor=THREE.SpriteMaterial,THREE.SpriteMaterial.prototype.copy=function(t){return THREE.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this.fog=t.fog,this},THREE.Texture=function(t,e,r,i,n,o,a,s,h){Object.defineProperty(this,"id",{value:THREE.TextureIdCount++}),this.uuid=THREE.Math.generateUUID(),this.sourceFile=this.name="",this.image=void 0!==t?t:THREE.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:THREE.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:THREE.ClampToEdgeWrapping,this.wrapT=void 0!==i?i:THREE.ClampToEdgeWrapping,this.magFilter=void 0!==n?n:THREE.LinearFilter,this.minFilter=void 0!==o?o:THREE.LinearMipMapLinearFilter,this.anisotropy=void 0!==h?h:1,this.format=void 0!==a?a:THREE.RGBAFormat,this.type=void 0!==s?s:THREE.UnsignedByteType,this.offset=new THREE.Vector2(0,0),this.repeat=new THREE.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.version=0,this.onUpdate=null},THREE.Texture.DEFAULT_IMAGE=void 0,THREE.Texture.DEFAULT_MAPPING=THREE.UVMapping,THREE.Texture.prototype={constructor:THREE.Texture,set needsUpdate(t){!0===t&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e,r,i,n,o,a={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};return void 0!==this.image&&(void 0===(e=this.image).uuid&&(e.uuid=THREE.Math.generateUUID()),void 0===t.images[e.uuid]&&(r=t.images,i=e.uuid,n=e.uuid,void 0!==e.toDataURL?o=e:((o=document.createElement("canvas")).width=e.width,o.height=e.height,o.getContext("2d").drawImage(e,0,0,e.width,e.height)),o=2048<o.width||2048<o.height?o.toDataURL("image/jpeg",.6):o.toDataURL("image/png"),r[i]={uuid:n,url:o}),a.image=e.uuid),t.textures[this.uuid]=a},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===THREE.UVMapping){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||1<t.x)switch(this.wrapS){case THREE.RepeatWrapping:t.x-=Math.floor(t.x);break;case THREE.ClampToEdgeWrapping:t.x=t.x<0?0:1;break;case THREE.MirroredRepeatWrapping:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x-=Math.floor(t.x)}if(t.y<0||1<t.y)switch(this.wrapT){case THREE.RepeatWrapping:t.y-=Math.floor(t.y);break;case THREE.ClampToEdgeWrapping:t.y=t.y<0?0:1;break;case THREE.MirroredRepeatWrapping:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y-=Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},THREE.EventDispatcher.prototype.apply(THREE.Texture.prototype),THREE.TextureIdCount=0,THREE.CanvasTexture=function(t,e,r,i,n,o,a,s,h){THREE.Texture.call(this,t,e,r,i,n,o,a,s,h),this.needsUpdate=!0},THREE.CanvasTexture.prototype=Object.create(THREE.Texture.prototype),THREE.CanvasTexture.prototype.constructor=THREE.CanvasTexture,THREE.CubeTexture=function(t,e,r,i,n,o,a,s,h){e=void 0!==e?e:THREE.CubeReflectionMapping,THREE.Texture.call(this,t,e,r,i,n,o,a,s,h),this.images=t,this.flipY=!1},THREE.CubeTexture.prototype=Object.create(THREE.Texture.prototype),THREE.CubeTexture.prototype.constructor=THREE.CubeTexture,THREE.CubeTexture.prototype.copy=function(t){return THREE.Texture.prototype.copy.call(this,t),this.images=t.images,this},THREE.CompressedTexture=function(t,e,r,i,n,o,a,s,h,c,u){THREE.Texture.call(this,null,o,a,s,h,c,i,n,u),this.image={width:e,height:r},this.mipmaps=t,this.generateMipmaps=this.flipY=!1},THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype),THREE.CompressedTexture.prototype.constructor=THREE.CompressedTexture,THREE.DataTexture=function(t,e,r,i,n,o,a,s,h,c,u){THREE.Texture.call(this,null,o,a,s,h,c,i,n,u),this.image={data:t,width:e,height:r},this.magFilter=void 0!==h?h:THREE.NearestFilter,this.minFilter=void 0!==c?c:THREE.NearestFilter,this.generateMipmaps=this.flipY=!1},THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype),THREE.DataTexture.prototype.constructor=THREE.DataTexture,THREE.VideoTexture=function(e,t,r,i,n,o,a,s,h){THREE.Texture.call(this,e,t,r,i,n,o,a,s,h),this.generateMipmaps=!1;var c=this;!function t(){requestAnimationFrame(t),e.readyState===e.HAVE_ENOUGH_DATA&&(c.needsUpdate=!0)}()},THREE.VideoTexture.prototype=Object.create(THREE.Texture.prototype),THREE.VideoTexture.prototype.constructor=THREE.VideoTexture,THREE.Group=function(){THREE.Object3D.call(this),this.type="Group"},THREE.Group.prototype=Object.create(THREE.Object3D.prototype),THREE.Group.prototype.constructor=THREE.Group,THREE.Points=function(t,e){THREE.Object3D.call(this),this.type="Points",this.geometry=void 0!==t?t:new THREE.Geometry,this.material=void 0!==e?e:new THREE.PointsMaterial({color:16777215*Math.random()})},THREE.Points.prototype=Object.create(THREE.Object3D.prototype),THREE.Points.prototype.constructor=THREE.Points,THREE.Points.prototype.raycast=function(){var l=new THREE.Matrix4,E=new THREE.Ray;return function(o,a){function t(t,e){var r,i,n=E.distanceSqToPoint(t);n<h&&((r=E.closestPointToPoint(t)).applyMatrix4(s.matrixWorld),(i=o.ray.origin.distanceTo(r))<o.near||i>o.far||a.push({distance:i,distanceToRay:Math.sqrt(n),point:r.clone(),index:e,face:null,object:s}))}var s=this,e=s.geometry,r=o.params.Points.threshold;if(l.getInverse(this.matrixWorld),E.copy(o.ray).applyMatrix4(l),null===e.boundingBox||!1!==E.isIntersectionBox(e.boundingBox)){var h=(r=r/((this.scale.x+this.scale.y+this.scale.z)/3))*r,r=new THREE.Vector3;if(e instanceof THREE.BufferGeometry){var i=e.index,e=e.attributes.position.array;if(null!==i)for(var n=i.array,i=0,c=n.length;i<c;i++){var u=n[i];r.fromArray(e,3*u),t(r,u)}else for(i=0,n=e.length/3;i<n;i++)r.fromArray(e,3*i),t(r,i)}else for(i=0,n=(r=e.vertices).length;i<n;i++)t(r[i],i)}}}(),THREE.Points.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},THREE.PointCloud=function(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new THREE.Points(t,e)},THREE.ParticleSystem=function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new THREE.Points(t,e)},THREE.Line=function(t,e,r){if(1===r)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new THREE.LineSegments(t,e);THREE.Object3D.call(this),this.type="Line",this.geometry=void 0!==t?t:new THREE.Geometry,this.material=void 0!==e?e:new THREE.LineBasicMaterial({color:16777215*Math.random()})},THREE.Line.prototype=Object.create(THREE.Object3D.prototype),THREE.Line.prototype.constructor=THREE.Line,THREE.Line.prototype.raycast=function(){var p=new THREE.Matrix4,d=new THREE.Ray,f=new THREE.Sphere;return function(t,e){var r=(r=t.linePrecision)*r;if(null===(u=this.geometry).boundingSphere&&u.computeBoundingSphere(),f.copy(u.boundingSphere),f.applyMatrix4(this.matrixWorld),!1!==t.ray.isIntersectionSphere(f)){p.getInverse(this.matrixWorld),d.copy(t.ray).applyMatrix4(p);var i=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Vector3,a=new THREE.Vector3,s=this instanceof THREE.LineSegments?2:1;if(u instanceof THREE.BufferGeometry){var h=u.index,c=u.attributes;if(null!==h)for(var u=h.array,c=c.position.array,h=0,l=u.length-1;h<l;h+=s){var E=u[h+1];i.fromArray(c,3*u[h]),n.fromArray(c,3*E),r<(E=d.distanceSqToSegment(i,n,a,o))||(a.applyMatrix4(this.matrixWorld),(E=t.ray.origin.distanceTo(a))<t.near||E>t.far||e.push({distance:E,point:o.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this}))}else for(h=0,l=(c=c.position.array).length/3-1;h<l;h+=s)i.fromArray(c,3*h),n.fromArray(c,3*h+3),r<(E=d.distanceSqToSegment(i,n,a,o))||(a.applyMatrix4(this.matrixWorld),(E=t.ray.origin.distanceTo(a))<t.near||E>t.far||e.push({distance:E,point:o.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this}))}else if(u instanceof THREE.Geometry)for(n=(i=u.vertices).length,h=0;h<n-1;h+=s)r<(E=d.distanceSqToSegment(i[h],i[h+1],a,o))||(a.applyMatrix4(this.matrixWorld),(E=t.ray.origin.distanceTo(a))<t.near||E>t.far||e.push({distance:E,point:o.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this}))}}}(),THREE.Line.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},THREE.LineStrip=0,THREE.LinePieces=1,THREE.LineSegments=function(t,e){THREE.Line.call(this,t,e),this.type="LineSegments"},THREE.LineSegments.prototype=Object.create(THREE.Line.prototype),THREE.LineSegments.prototype.constructor=THREE.LineSegments,THREE.Mesh=function(t,e){THREE.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new THREE.Geometry,this.material=void 0!==e?e:new THREE.MeshBasicMaterial({color:16777215*Math.random()}),this.updateMorphTargets()},THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype),THREE.Mesh.prototype.constructor=THREE.Mesh,THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,e=this.geometry.morphTargets.length;t<e;t++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[t].name]=t}},THREE.Mesh.prototype.getMorphTargetIndexByName=function(t){return void 0!==this.morphTargetDictionary[t]?this.morphTargetDictionary[t]:(console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+t+" does not exist. Returning 0."),0)},THREE.Mesh.prototype.raycast=function(){function v(t,e,r,i,n,o,a){return THREE.Triangle.barycoordFromPoint(t,e,r,i,s),n.multiplyScalar(s.x),o.multiplyScalar(s.y),a.multiplyScalar(s.z),n.add(o).add(a),n.clone()}function H(t,e,r,i,n,o,a){var s=t.material;return null===(s.side===THREE.BackSide?r.intersectTriangle(o,n,i,!0,a):r.intersectTriangle(i,n,o,s.side!==THREE.DoubleSide,a))?null:(h.copy(a),h.applyMatrix4(t.matrixWorld),(r=e.ray.origin.distanceTo(h))<e.near||r>e.far?null:{distance:r,point:h.clone(),object:t})}function x(t,e,r,i,n,o,a,s){return S.fromArray(i,3*o),_.fromArray(i,3*a),A.fromArray(i,3*s),(t=H(t,e,r,S,_,A,F))&&(n&&(D.fromArray(n,2*o),k.fromArray(n,2*a),V.fromArray(n,2*s),t.uv=v(F,S,_,A,D,k,V)),t.face=new THREE.Face3(o,a,s,THREE.Triangle.normal(S,_,A)),t.faceIndex=o),t}var b=new THREE.Matrix4,w=new THREE.Ray,M=new THREE.Sphere,S=new THREE.Vector3,_=new THREE.Vector3,A=new THREE.Vector3,C=new THREE.Vector3,L=new THREE.Vector3,P=new THREE.Vector3,D=new THREE.Vector2,k=new THREE.Vector2,V=new THREE.Vector2,s=new THREE.Vector3,F=new THREE.Vector3,h=new THREE.Vector3;return function(t,e){var r=this.geometry;if(void 0!==(o=this.material)){null===r.boundingSphere&&r.computeBoundingSphere();var i,n=this.matrixWorld;if(M.copy(r.boundingSphere),M.applyMatrix4(n),!1!==t.ray.isIntersectionSphere(M)&&(b.getInverse(n),w.copy(t.ray).applyMatrix4(b),null===r.boundingBox||!1!==w.isIntersectionBox(r.boundingBox)))if(r instanceof THREE.BufferGeometry){var o=r.index,r=(n=r.attributes).position.array;if(void 0!==n.uv&&(i=n.uv.array),null!==o)for(var a=0,s=(n=o.array).length;a<s;a+=3)o=n[a],l=n[a+1],u=n[a+2],(d=x(this,t,w,r,i,o,l,u))&&(d.faceIndex=Math.floor(a/3),e.push(d));else for(a=0,s=r.length;a<s;a+=9)(d=x(this,t,w,r,i,o=a/3,l=o+1,u=o+2))&&(d.index=o,e.push(d))}else if(r instanceof THREE.Geometry){var h,c,u,a=!0===(n=o instanceof THREE.MeshFaceMaterial)?o.materials:null,s=r.vertices,l=r.faces;0<(u=r.faceVertexUvs[0]).length&&(i=u);for(var E=0,p=l.length;E<p;E++){var d,f=l[E];if(void 0!==(d=!0===n?a[f.materialIndex]:o)){if(u=s[f.a],h=s[f.b],c=s[f.c],!0===d.morphTargets){d=r.morphTargets;var m=this.morphTargetInfluences;S.set(0,0,0),_.set(0,0,0),A.set(0,0,0);for(var T=0,g=d.length;T<g;T++){var y,R=m[T];0!==R&&(y=d[T].vertices,S.addScaledVector(C.subVectors(y[f.a],u),R),_.addScaledVector(L.subVectors(y[f.b],h),R),A.addScaledVector(P.subVectors(y[f.c],c),R))}S.add(u),_.add(h),A.add(c),u=S,h=_,c=A}(d=H(this,t,w,u,h,c,F))&&(i&&(m=i[E],D.copy(m[0]),k.copy(m[1]),V.copy(m[2]),d.uv=v(F,u,h,c,D,k,V)),d.face=f,d.faceIndex=E,e.push(d))}}}}}}(),THREE.Mesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},THREE.Bone=function(t){THREE.Object3D.call(this),this.type="Bone",this.skin=t},THREE.Bone.prototype=Object.create(THREE.Object3D.prototype),THREE.Bone.prototype.constructor=THREE.Bone,THREE.Bone.prototype.copy=function(t){return THREE.Object3D.prototype.copy.call(this,t),this.skin=t.skin,this},THREE.Skeleton=function(t,e,r){if(this.useVertexTexture=void 0===r||r,this.identityMatrix=new THREE.Matrix4,t=t||[],this.bones=t.slice(0),this.useVertexTexture?(t=Math.sqrt(4*this.bones.length),t=THREE.Math.nextPowerOfTwo(Math.ceil(t)),this.boneTextureHeight=this.boneTextureWidth=t=Math.max(t,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType)):this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new THREE.Matrix4)},THREE.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var r=new THREE.Matrix4;this.bones[t]&&r.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(r)}},THREE.Skeleton.prototype.pose=function(){for(var t,e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&(t.parent?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},THREE.Skeleton.prototype.update=function(){var r=new THREE.Matrix4;return function(){for(var t=0,e=this.bones.length;t<e;t++)r.multiplyMatrices(this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix,this.boneInverses[t]),r.flattenToArrayOffset(this.boneMatrices,16*t);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),THREE.Skeleton.prototype.clone=function(){return new THREE.Skeleton(this.bones,this.boneInverses,this.useVertexTexture)},THREE.SkinnedMesh=function(t,e,r){if(THREE.Mesh.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new THREE.Matrix4,this.bindMatrixInverse=new THREE.Matrix4,t=[],this.geometry&&void 0!==this.geometry.bones){for(var i,n=0,o=this.geometry.bones.length;n<o;++n)i=this.geometry.bones[n],e=new THREE.Bone(this),t.push(e),e.name=i.name,e.position.fromArray(i.pos),e.quaternion.fromArray(i.rotq),void 0!==i.scl&&e.scale.fromArray(i.scl);for(n=0,o=this.geometry.bones.length;n<o;++n)-1!==(i=this.geometry.bones[n]).parent&&null!==i.parent?t[i.parent].add(t[n]):this.add(t[n])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new THREE.Skeleton(t,void 0,r),this.matrixWorld)},THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype),THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh,THREE.SkinnedMesh.prototype.bind=function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},THREE.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},THREE.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof THREE.Geometry)for(var t=0;t<this.geometry.skinIndices.length;t++){var e=this.geometry.skinWeights[t],r=1/e.lengthManhattan();1/0!=r?e.multiplyScalar(r):e.set(1)}},THREE.SkinnedMesh.prototype.updateMatrixWorld=function(t){THREE.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)},THREE.SkinnedMesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material,this.useVertexTexture).copy(this)},THREE.LOD=function(){THREE.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}}})},THREE.LOD.prototype=Object.create(THREE.Object3D.prototype),THREE.LOD.prototype.constructor=THREE.LOD,THREE.LOD.prototype.addLevel=function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var r=this.levels,i=0;i<r.length&&!(e<r[i].distance);i++);r.splice(i,0,{distance:e,object:t}),this.add(t)},THREE.LOD.prototype.getObjectForDistance=function(t){for(var e=this.levels,r=1,i=e.length;r<i&&!(t<e[r].distance);r++);return e[r-1].object},THREE.LOD.prototype.raycast=function(){var i=new THREE.Vector3;return function(t,e){i.setFromMatrixPosition(this.matrixWorld);var r=t.ray.origin.distanceTo(i);this.getObjectForDistance(r).raycast(t,e)}}(),THREE.LOD.prototype.update=function(){var n=new THREE.Vector3,o=new THREE.Vector3;return function(t){var e=this.levels;if(1<e.length){n.setFromMatrixPosition(t.matrixWorld),o.setFromMatrixPosition(this.matrixWorld),t=n.distanceTo(o),e[0].object.visible=!0;for(var r=1,i=e.length;r<i&&t>=e[r].distance;r++)e[r-1].object.visible=!1,e[r].object.visible=!0;for(;r<i;r++)e[r].object.visible=!1}}}(),THREE.LOD.prototype.copy=function(t){THREE.Object3D.prototype.copy.call(this,t,!1);for(var e=0,r=(t=t.levels).length;e<r;e++){var i=t[e];this.addLevel(i.object.clone(),i.distance)}return this},THREE.LOD.prototype.toJSON=function(t){(t=THREE.Object3D.prototype.toJSON.call(this,t)).object.levels=[];for(var e=this.levels,r=0,i=e.length;r<i;r++){var n=e[r];t.object.levels.push({object:n.object.uuid,distance:n.distance})}return t},THREE.Sprite=function(){var t=new Uint16Array([0,1,2,0,2,3]),e=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]),i=new THREE.BufferGeometry;return i.setIndex(new THREE.BufferAttribute(t,1)),i.addAttribute("position",new THREE.BufferAttribute(e,3)),i.addAttribute("uv",new THREE.BufferAttribute(r,2)),function(t){THREE.Object3D.call(this),this.type="Sprite",this.geometry=i,this.material=void 0!==t?t:new THREE.SpriteMaterial}}(),THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype),THREE.Sprite.prototype.constructor=THREE.Sprite,THREE.Sprite.prototype.raycast=function(){var i=new THREE.Vector3;return function(t,e){i.setFromMatrixPosition(this.matrixWorld);var r=t.ray.distanceSqToPoint(i);r>this.scale.x*this.scale.y||e.push({distance:Math.sqrt(r),point:this.position,face:null,object:this})}}(),THREE.Sprite.prototype.clone=function(){return new this.constructor(this.material).copy(this)},THREE.Particle=THREE.Sprite,THREE.LensFlare=function(t,e,r,i,n){THREE.Object3D.call(this),this.lensFlares=[],this.positionScreen=new THREE.Vector3,(this.customUpdateCallback=void 0)!==t&&this.add(t,e,r,i,n)},THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype),THREE.LensFlare.prototype.constructor=THREE.LensFlare,THREE.LensFlare.prototype.add=function(t,e,r,i,n,o){void 0===e&&(e=-1),void 0===r&&(r=0),void 0===o&&(o=1),void 0===n&&(n=new THREE.Color(16777215)),void 0===i&&(i=THREE.NormalBlending),r=Math.min(r,Math.max(0,r)),this.lensFlares.push({texture:t,size:e,distance:r,x:0,y:0,z:0,scale:1,rotation:0,opacity:o,color:n,blending:i})},THREE.LensFlare.prototype.updateLensFlares=function(){for(var t,e=this.lensFlares.length,r=2*-this.positionScreen.x,i=2*-this.positionScreen.y,n=0;n<e;n++)(t=this.lensFlares[n]).x=this.positionScreen.x+r*t.distance,t.y=this.positionScreen.y+i*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)},THREE.LensFlare.prototype.copy=function(t){THREE.Object3D.prototype.copy.call(this,t),this.positionScreen.copy(t.positionScreen),this.customUpdateCallback=t.customUpdateCallback;for(var e=0,r=t.lensFlares.length;e<r;e++)this.lensFlares.push(t.lensFlares[e]);return this},THREE.Scene=function(){THREE.Object3D.call(this),this.type="Scene",this.overrideMaterial=this.fog=null,this.autoUpdate=!0},THREE.Scene.prototype=Object.create(THREE.Object3D.prototype),THREE.Scene.prototype.constructor=THREE.Scene,THREE.Scene.prototype.copy=function(t){return THREE.Object3D.prototype.copy.call(this,t),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},THREE.Fog=function(t,e,r){this.name="",this.color=new THREE.Color(t),this.near=void 0!==e?e:1,this.far=void 0!==r?r:1e3},THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)},THREE.FogExp2=function(t,e){this.name="",this.color=new THREE.Color(t),this.density=void 0!==e?e:25e-5},THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)},THREE.ShaderChunk={},THREE.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",THREE.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",THREE.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n",THREE.ShaderChunk.aomap_fragment="#ifdef USE_AOMAP\n\n\ttotalAmbientLight *= ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\n#endif\n",THREE.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n\n#endif",THREE.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",THREE.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",THREE.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n",THREE.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif",THREE.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n",THREE.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif",THREE.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n\tvColor.xyz = color.xyz;\n\n#endif",THREE.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\n\nvec3 transformDirection( in vec3 normal, in mat4 matrix ) {\n\n\treturn normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );\n\n}\n\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n\n\treturn normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n\n}\n\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\n\treturn - distance * planeNormal + point;\n\n}\n\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n\n}\n\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n\n}\n\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\n\n\tif ( decayExponent > 0.0 ) {\n\n\t return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\n\t}\n\n\treturn 1.0;\n\n}\n\nvec3 F_Schlick( in vec3 specularColor, in float dotLH ) {\n\n\n\tfloat fresnel = exp2( ( -5.55437 * dotLH - 6.98316 ) * dotLH );\n\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n\n}\n\nfloat G_BlinnPhong_Implicit( /* in float dotNL, in float dotNV */ ) {\n\n\n\treturn 0.25;\n\n}\n\nfloat D_BlinnPhong( in float shininess, in float dotNH ) {\n\n\n\treturn ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n\n}\n\nvec3 BRDF_BlinnPhong( in vec3 specularColor, in float shininess, in vec3 normal, in vec3 lightDir, in vec3 viewDir ) {\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( lightDir, halfDir ) );\n\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\n\tfloat G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\n\treturn F * G * D;\n\n}\n\nvec3 inputToLinear( in vec3 a ) {\n\n\t#ifdef GAMMA_INPUT\n\n\t\treturn pow( a, vec3( float( GAMMA_FACTOR ) ) );\n\n\t#else\n\n\t\treturn a;\n\n\t#endif\n\n}\n\nvec3 linearToOutput( in vec3 a ) {\n\n\t#ifdef GAMMA_OUTPUT\n\n\t\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n\n\t#else\n\n\t\treturn a;\n\n\t#endif\n\n}\n",THREE.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n\n\tobjectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n",THREE.ShaderChunk.displacementmap_vertex="#ifdef USE_DISPLACEMENTMAP\n\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n\n#endif\n",THREE.ShaderChunk.displacementmap_pars_vertex="#ifdef USE_DISPLACEMENTMAP\n\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n\n#endif\n",THREE.ShaderChunk.emissivemap_fragment="#ifdef USE_EMISSIVEMAP\n\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\n\temissiveColor.rgb = inputToLinear( emissiveColor.rgb );\n\n\ttotalEmissiveLight *= emissiveColor.rgb;\n\n#endif\n",THREE.ShaderChunk.emissivemap_pars_fragment="#ifdef USE_EMISSIVEMAP\n\n\tuniform sampler2D emissiveMap;\n\n#endif\n",THREE.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#else\n\t\tfloat flipNormal = 1.0;\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#endif\n\n\tenvColor.xyz = inputToLinear( envColor.xyz );\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n",THREE.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tuniform float refractionRatio;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\n\t#endif\n\n#endif\n",THREE.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvarying vec3 vReflect;\n\n\tuniform float refractionRatio;\n\n#endif\n",THREE.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\n\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t#else\n\n\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t#endif\n\n#endif\n",THREE.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n\t#else\n\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\n\t#endif\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\n\t#endif\n\t\n\toutgoingLight = mix( outgoingLight, fogColor, fogFactor );\n\n#endif",THREE.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n\n#endif",THREE.ShaderChunk.hemilight_fragment="#if MAX_HEMI_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec3 lightDir = hemisphereLightDirection[ i ];\n\n\t\tfloat dotProduct = dot( normal, lightDir );\n\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n\t\tvec3 lightColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\ttotalAmbientLight += lightColor;\n\n\t}\n\n#endif\n\n",THREE.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\n\ttotalAmbientLight += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\n#endif\n",THREE.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n\n#endif",THREE.ShaderChunk.lights_lambert_pars_vertex="#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n",THREE.ShaderChunk.lights_lambert_vertex="vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack = vec3( 0.0 );\n\n#endif\n\nvec3 normal = normalize( transformedNormal );\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec3 lightColor = pointLightColor[ i ];\n\n\t\tvec3 lVector = pointLightPosition[ i ] - mvPosition.xyz;\n\t\tvec3 lightDir = normalize( lVector );\n\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\n\t\tfloat dotProduct = dot( normal, lightDir );\n\n\t\tvLightFront += lightColor * attenuation * saturate( dotProduct );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += lightColor * attenuation * saturate( - dotProduct );\n\n\t\t#endif\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec3 lightColor = spotLightColor[ i ];\n\n\t\tvec3 lightPosition = spotLightPosition[ i ];\n\t\tvec3 lVector = lightPosition - mvPosition.xyz;\n\t\tvec3 lightDir = normalize( lVector );\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], lightDir );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = saturate( pow( saturate( spotEffect ), spotLightExponent[ i ] ) );\n\n\n\t\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n\t\t\tattenuation *= spotEffect;\n\n\n\t\t\tfloat dotProduct = dot( normal, lightDir );\n\n\t\t\tvLightFront += lightColor * attenuation * saturate( dotProduct );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvLightBack += lightColor * attenuation * saturate( - dotProduct );\n\n\t\t\t#endif\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\t\tvec3 lightColor = directionalLightColor[ i ];\n\n\t\tvec3 lightDir = directionalLightDirection[ i ];\n\n\n\t\tfloat dotProduct = dot( normal, lightDir );\n\n\t\tvLightFront += lightColor * saturate( dotProduct );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += lightColor * saturate( - dotProduct );\n\n\t\t#endif\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec3 lightDir = hemisphereLightDirection[ i ];\n\n\n\t\tfloat dotProduct = dot( normal, lightDir );\n\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n\t\tvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tfloat hemiDiffuseWeightBack = - 0.5 * dotProduct + 0.5;\n\n\t\t\tvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n\t\t#endif\n\n\t}\n\n#endif\n",THREE.ShaderChunk.lights_phong_fragment="vec3 viewDir = normalize( vViewPosition );\n\nvec3 totalDiffuseLight = vec3( 0.0 );\nvec3 totalSpecularLight = vec3( 0.0 );\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec3 lightColor = pointLightColor[ i ];\n\n\t\tvec3 lightPosition = pointLightPosition[ i ];\n\t\tvec3 lVector = lightPosition + vViewPosition.xyz;\n\t\tvec3 lightDir = normalize( lVector );\n\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\n\t\tfloat cosineTerm = saturate( dot( normal, lightDir ) );\n\n\t\ttotalDiffuseLight += lightColor * attenuation * cosineTerm;\n\n\n\t\tvec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\n\n\t\ttotalSpecularLight += brdf * specularStrength * lightColor * attenuation * cosineTerm;\n\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec3 lightColor = spotLightColor[ i ];\n\n\t\tvec3 lightPosition = spotLightPosition[ i ];\n\t\tvec3 lVector = lightPosition + vViewPosition.xyz;\n\t\tvec3 lightDir = normalize( lVector );\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], lightDir );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = saturate( pow( saturate( spotEffect ), spotLightExponent[ i ] ) );\n\n\n\t\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n\t\t\tattenuation *= spotEffect;\n\n\n\t\t\tfloat cosineTerm = saturate( dot( normal, lightDir ) );\n\n\t\t\ttotalDiffuseLight += lightColor * attenuation * cosineTerm;\n\n\n\t\t\tvec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\n\n\t\t\ttotalSpecularLight += brdf * specularStrength * lightColor * attenuation * cosineTerm;\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\t\tvec3 lightColor = directionalLightColor[ i ];\n\n\t\tvec3 lightDir = directionalLightDirection[ i ];\n\n\n\t\tfloat cosineTerm = saturate( dot( normal, lightDir ) );\n\n\t\ttotalDiffuseLight += lightColor * cosineTerm;\n\n\n\t\tvec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\n\n\t\ttotalSpecularLight += brdf * specularStrength * lightColor * cosineTerm;\n\n\t}\n\n#endif\n",THREE.ShaderChunk.lights_phong_pars_fragment="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n",THREE.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\n#endif\n",THREE.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_ENVMAP )\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif\n",THREE.ShaderChunk.linear_to_gamma_fragment="\n\toutgoingLight = linearToOutput( outgoingLight );\n",THREE.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",THREE.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n\tuniform float logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n#endif\n",THREE.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n\tuniform float logDepthBufFC;\n\n#endif",THREE.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n\t#endif\n\n#endif",THREE.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n\tvec4 texelColor = texture2D( map, vUv );\n\n\ttexelColor.xyz = inputToLinear( texelColor.xyz );\n\n\tdiffuseColor *= texelColor;\n\n#endif\n",THREE.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif",THREE.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n\tdiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\n#endif\n",THREE.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n\n#endif\n",THREE.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n#endif\n",THREE.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n\t#ifndef USE_MORPHNORMALS\n\n\tuniform float morphTargetInfluences[ 8 ];\n\n\t#else\n\n\tuniform float morphTargetInfluences[ 4 ];\n\n\t#endif\n\n#endif",THREE.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n\t#ifndef USE_MORPHNORMALS\n\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n\t#endif\n\n#endif\n",THREE.ShaderChunk.normal_phong_fragment="#ifndef FLAT_SHADED\n\n\tvec3 normal = normalize( vNormal );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n\t#endif\n\n#else\n\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n\n#endif\n\n#ifdef USE_NORMALMAP\n\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\n",THREE.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\n\t}\n\n#endif\n",THREE.ShaderChunk.project_vertex="#ifdef USE_SKINNING\n\n\tvec4 mvPosition = modelViewMatrix * skinned;\n\n#else\n\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n",THREE.ShaderChunk.shadowmap_fragment="#ifdef USE_SHADOWMAP\n\n\tfor ( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tfloat texelSizeY = 1.0 / shadowMapSize[ i ].y;\n\n\t\tfloat shadow = 0.0;\n\n#if defined( POINT_LIGHT_SHADOWS )\n\n\t\tbool isPointLight = shadowDarkness[ i ] < 0.0;\n\n\t\tif ( isPointLight ) {\n\n\t\t\tfloat realShadowDarkness = abs( shadowDarkness[ i ] );\n\n\t\t\tvec3 lightToPosition = vShadowCoord[ i ].xyz;\n\n\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tfloat dp = length( lightToPosition );\n\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D, texelSizeY ) ), shadowBias[ i ], shadow );\n\n\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tconst float Dr = 1.25;\n\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tconst float Dr = 2.25;\n\t#endif\n\n\t\t\tfloat os = Dr * 2.0 * texelSizeY;\n\n\t\t\tconst vec3 Gsd = vec3( - 1, 0, 1 );\n\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzy * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxy * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxy * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzy * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zyz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xyz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zyx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xyx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yzz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yxz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yxx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yzx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\n\t\t\tshadow *= realShadowDarkness * ( 1.0 / 21.0 );\n\n\t#else \n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tfloat dp = length( lightToPosition );\n\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D, texelSizeY ) ), shadowBias[ i ], shadow );\n\n\t\t\tshadow *= realShadowDarkness;\n\n\t#endif\n\n\t\t} else {\n\n#endif \n\t\t\tfloat texelSizeX = 1.0 / shadowMapSize[ i ].x;\n\n\t\t\tvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n\n\t\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\t\tbool inFrustum = all( inFrustumVec );\n\n\t\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\t\tbool frustumTest = all( frustumTestVec );\n\n\t\t\tif ( frustumTest ) {\n\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\n\t\t\t\t/*\n\t\t\t\t\tfor ( float y = -1.25; y <= 1.25; y += 1.25 )\n\t\t\t\t\t\tfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\t\t\t\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\t\t\t\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\t\t\t\t\t\t\tif ( fDepth < shadowCoord.z )\n\t\t\t\t\t\t\t\tshadow += 1.0;\n\t\t\t\t\t}\n\t\t\t\t\tshadow /= 9.0;\n\t\t\t\t*/\n\n\t\t\t\tshadowCoord.z += shadowBias[ i ];\n\n\t\t\t\tconst float ShadowDelta = 1.0 / 9.0;\n\n\t\t\t\tfloat xPixelOffset = texelSizeX;\n\t\t\t\tfloat yPixelOffset = texelSizeY;\n\n\t\t\t\tfloat dx0 = - 1.25 * xPixelOffset;\n\t\t\t\tfloat dy0 = - 1.25 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.25 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.25 * yPixelOffset;\n\n\t\t\t\tfloat fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tshadow *= shadowDarkness[ i ];\n\n\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\n\t\t\t\tshadowCoord.z += shadowBias[ i ];\n\n\t\t\t\tfloat xPixelOffset = texelSizeX;\n\t\t\t\tfloat yPixelOffset = texelSizeY;\n\n\t\t\t\tfloat dx0 = - 1.0 * xPixelOffset;\n\t\t\t\tfloat dy0 = - 1.0 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.0 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.0 * yPixelOffset;\n\n\t\t\t\tmat3 shadowKernel;\n\t\t\t\tmat3 depthKernel;\n\n\t\t\t\tdepthKernel[ 0 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tdepthKernel[ 0 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tdepthKernel[ 0 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tdepthKernel[ 1 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tdepthKernel[ 1 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tdepthKernel[ 1 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tdepthKernel[ 2 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tdepthKernel[ 2 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tdepthKernel[ 2 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n\t\t\t\tvec3 shadowZ = vec3( shadowCoord.z );\n\t\t\t\tshadowKernel[ 0 ] = vec3( lessThan( depthKernel[ 0 ], shadowZ ) );\n\t\t\t\tshadowKernel[ 0 ] *= vec3( 0.25 );\n\n\t\t\t\tshadowKernel[ 1 ] = vec3( lessThan( depthKernel[ 1 ], shadowZ ) );\n\t\t\t\tshadowKernel[ 1 ] *= vec3( 0.25 );\n\n\t\t\t\tshadowKernel[ 2 ] = vec3( lessThan( depthKernel[ 2 ], shadowZ ) );\n\t\t\t\tshadowKernel[ 2 ] *= vec3( 0.25 );\n\n\t\t\t\tvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[ i ].xy );\n\n\t\t\t\tshadowKernel[ 0 ] = mix( shadowKernel[ 1 ], shadowKernel[ 0 ], fractionalCoord.x );\n\t\t\t\tshadowKernel[ 1 ] = mix( shadowKernel[ 2 ], shadowKernel[ 1 ], fractionalCoord.x );\n\n\t\t\t\tvec4 shadowValues;\n\t\t\t\tshadowValues.x = mix( shadowKernel[ 0 ][ 1 ], shadowKernel[ 0 ][ 0 ], fractionalCoord.y );\n\t\t\t\tshadowValues.y = mix( shadowKernel[ 0 ][ 2 ], shadowKernel[ 0 ][ 1 ], fractionalCoord.y );\n\t\t\t\tshadowValues.z = mix( shadowKernel[ 1 ][ 1 ], shadowKernel[ 1 ][ 0 ], fractionalCoord.y );\n\t\t\t\tshadowValues.w = mix( shadowKernel[ 1 ][ 2 ], shadowKernel[ 1 ][ 1 ], fractionalCoord.y );\n\n\t\t\t\tshadow = dot( shadowValues, vec4( 1.0 ) ) * shadowDarkness[ i ];\n\n\t#else \n\t\t\t\tshadowCoord.z += shadowBias[ i ];\n\n\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\tif ( fDepth < shadowCoord.z )\n\t\t\t\t\tshadow = shadowDarkness[ i ];\n\n\t#endif\n\n\t\t\t}\n\n#ifdef SHADOWMAP_DEBUG\n\n\t\t\tif ( inFrustum ) {\n\n\t\t\t\tif ( i == 0 ) {\n\n\t\t\t\t\toutgoingLight *= vec3( 1.0, 0.5, 0.0 );\n\n\t\t\t\t} else if ( i == 1 ) {\n\n\t\t\t\t\toutgoingLight *= vec3( 0.0, 1.0, 0.8 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toutgoingLight *= vec3( 0.0, 0.5, 1.0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n#endif\n\n#if defined( POINT_LIGHT_SHADOWS )\n\n\t\t}\n\n#endif\n\n\t\tshadowMask = shadowMask * vec3( 1.0 - shadow );\n\n\t}\n\n#endif\n",THREE.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\n\tuniform sampler2D shadowMap[ MAX_SHADOWS ];\n\tuniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n\tuniform float shadowDarkness[ MAX_SHADOWS ];\n\tuniform float shadowBias[ MAX_SHADOWS ];\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n\tfloat unpackDepth( const in vec4 rgba_depth ) {\n\n\t\tconst 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\t\tfloat depth = dot( rgba_depth, bit_shift );\n\t\treturn depth;\n\n\t}\n\n\t#if defined(POINT_LIGHT_SHADOWS)\n\n\n\t\tvoid adjustShadowValue1K( const float testDepth, const vec4 textureData, const float bias, inout float shadowValue ) {\n\n\t\t\tconst vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\t\t\tif ( testDepth >= dot( textureData, bitSh ) * 1000.0 + bias )\n\t\t\t\tshadowValue += 1.0;\n\n\t\t}\n\n\n\t\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\n\n\t\t\tvec3 absV = abs( v );\n\n\n\t\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\t\tabsV *= scaleToCube;\n\n\n\t\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\n\n\n\t\t\tvec2 planar = v.xy;\n\n\t\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\t\tfloat almostOne = 1.0 - almostATexel;\n\n\t\t\tif ( absV.z >= almostOne ) {\n\n\t\t\t\tif ( v.z > 0.0 )\n\t\t\t\t\tplanar.x = 4.0 - v.x;\n\n\t\t\t} else if ( absV.x >= almostOne ) {\n\n\t\t\t\tfloat signX = sign( v.x );\n\t\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\n\t\t\t} else if ( absV.y >= almostOne ) {\n\n\t\t\t\tfloat signY = sign( v.y );\n\t\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\t\tplanar.y = v.z * signY - 2.0;\n\n\t\t\t}\n\n\n\t\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\n\t\t}\n\n\t#endif\n\n#endif\n",THREE.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n\tuniform float shadowDarkness[ MAX_SHADOWS ];\n\tuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n#endif",THREE.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n\tfor ( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\t\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n\t}\n\n#endif",THREE.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif",THREE.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\n\t\t\ty = dy * ( y + 0.5 );\n\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneGlobalMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n",THREE.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n\n#endif\n",THREE.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n#endif\n",THREE.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif",THREE.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif",THREE.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvarying vec2 vUv2;\n\n#endif",THREE.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\n#endif",THREE.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvUv2 = uv2;\n\n#endif",THREE.ShaderChunk.uv_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP )\n\n\tvarying vec2 vUv;\n\n#endif",THREE.ShaderChunk.uv_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP )\n\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n\n#endif\n",THREE.ShaderChunk.uv_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP )\n\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif",THREE.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n\t#ifdef USE_SKINNING\n\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\n\t#else\n\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\n\t#endif\n\n#endif\n",THREE.UniformsUtils={merge:function(t){for(var e={},r=0;r<t.length;r++){var i,n=this.clone(t[r]);for(i in n)e[i]=n[i]}return e},clone:function(t){var e,r={};for(e in t)for(var i in r[e]={},t[e]){var n=t[e][i];n instanceof THREE.Color||n instanceof THREE.Vector2||n instanceof THREE.Vector3||n instanceof THREE.Vector4||n instanceof THREE.Matrix3||n instanceof THREE.Matrix4||n instanceof THREE.Texture?r[e][i]=n.clone():Array.isArray(n)?r[e][i]=n.slice():r[e][i]=n}return r}},THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new THREE.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 THREE.Vector2(1,1)}},displacementmap:{displacementMap:{type:"t",value:null},displacementScale:{type:"f",value:1},displacementBias:{type:"f",value:0}},fog:{fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},hemisphereLightDirection:{type:"fv",value:[]},hemisphereLightSkyColor:{type:"fv",value:[]},hemisphereLightGroundColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]},pointLightDecay:{type:"fv1",value:[]},spotLightColor:{type:"fv",value:[]},spotLightPosition:{type:"fv",value:[]},spotLightDirection:{type:"fv",value:[]},spotLightDistance:{type:"fv1",value:[]},spotLightAngleCos:{type:"fv1",value:[]},spotLightExponent:{type:"fv1",value:[]},spotLightDecay:{type:"fv1",value:[]}},points:{psColor:{type:"c",value:new THREE.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 THREE.Vector4(0,0,1,1)},fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}},THREE.ShaderLib={basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.aomap,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.uv_pars_vertex,THREE.ShaderChunk.uv2_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.uv_vertex,THREE.ShaderChunk.uv2_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinbase_vertex,"\t#ifdef USE_ENVMAP",THREE.ShaderChunk.beginnormal_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"\t#endif",THREE.ShaderChunk.begin_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.project_vertex,THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.uv_pars_fragment,THREE.ShaderChunk.uv2_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.aomap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tvec3 totalAmbientLight = vec3( 1.0 );\n\tvec3 shadowMask = vec3( 1.0 );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.aomap_fragment,THREE.ShaderChunk.shadowmap_fragment,"\toutgoingLight = diffuseColor.rgb * totalAmbientLight * shadowMask;",THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{emissive:{type:"c",value:new THREE.Color(0)}}]),vertexShader:["#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif",THREE.ShaderChunk.common,THREE.ShaderChunk.uv_pars_vertex,THREE.ShaderChunk.uv2_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_lambert_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.uv_vertex,THREE.ShaderChunk.uv2_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.beginnormal_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,THREE.ShaderChunk.begin_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.project_vertex,THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_lambert_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nuniform vec3 ambientLightColor;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.uv_pars_fragment,THREE.ShaderChunk.uv2_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tvec3 totalAmbientLight = ambientLightColor;\n\tvec3 shadowMask = vec3( 1.0 );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.shadowmap_fragment,"\t#ifdef DOUBLE_SIDED\n\t\tif ( gl_FrontFacing )\n\t\t\toutgoingLight += diffuseColor.rgb * ( vLightFront * shadowMask + totalAmbientLight ) + emissive;\n\t\telse\n\t\t\toutgoingLight += diffuseColor.rgb * ( vLightBack * shadowMask + totalAmbientLight ) + emissive;\n\t#else\n\t\toutgoingLight += diffuseColor.rgb * ( vLightFront * shadowMask + totalAmbientLight ) + emissive;\n\t#endif",THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.aomap,THREE.UniformsLib.lightmap,THREE.UniformsLib.emissivemap,THREE.UniformsLib.bumpmap,THREE.UniformsLib.normalmap,THREE.UniformsLib.displacementmap,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{emissive:{type:"c",value:new THREE.Color(0)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),vertexShader:["#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",THREE.ShaderChunk.common,THREE.ShaderChunk.uv_pars_vertex,THREE.ShaderChunk.uv2_pars_vertex,THREE.ShaderChunk.displacementmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_phong_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.uv_vertex,THREE.ShaderChunk.uv2_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.beginnormal_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif",THREE.ShaderChunk.begin_vertex,THREE.ShaderChunk.displacementmap_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.project_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"\tvViewPosition = - mvPosition.xyz;",THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.uv_pars_fragment,THREE.ShaderChunk.uv2_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.aomap_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.emissivemap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.bumpmap_pars_fragment,THREE.ShaderChunk.normalmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tvec3 totalAmbientLight = ambientLightColor;\n\tvec3 totalEmissiveLight = emissive;\n\tvec3 shadowMask = vec3( 1.0 );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.normal_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.hemilight_fragment,THREE.ShaderChunk.aomap_fragment,THREE.ShaderChunk.emissivemap_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.shadowmap_fragment,"totalDiffuseLight *= shadowMask;\ntotalSpecularLight *= shadowMask;\n#ifdef METAL\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) * specular + totalSpecularLight + totalEmissiveLight;\n#else\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) + totalSpecularLight + totalEmissiveLight;\n#endif",THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},points:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.points,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\tgl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( psColor, opacity );\n\tvec3 shadowMask = vec3( 1.0 );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.shadowmap_fragment,"\toutgoingLight = diffuseColor.rgb * shadowMask;",THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},dashed:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.color_fragment,"\toutgoingLight = diffuseColor.rgb;",THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.begin_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.project_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;\nuniform float mFar;\nuniform float opacity;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );\n\tgl_FragColor = vec4( vec3( color ), opacity );\n}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.begin_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.project_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vNormal;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\nvec3 direction = normalize( vWorldPosition );\nvec2 sampleUV;\nsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\nsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\ngl_FragColor = texture2D( tEquirect, sampleUV );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.begin_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.project_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {\n\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\nvoid main() {",THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n\t#else\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n\t#endif\n}"].join("\n")},distanceRGBA:{uniforms:{lightPos:{type:"v3",value:new THREE.Vector3(0,0,0)}},vertexShader:["varying vec4 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.begin_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.project_vertex,THREE.ShaderChunk.worldpos_vertex,"vWorldPosition = worldPosition;\n}"].join("\n"),fragmentShader:["uniform vec3 lightPos;\nvarying vec4 vWorldPosition;",THREE.ShaderChunk.common,"vec4 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\tconst vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = fract( depth * bitSh );\n\tres -= res.xxyz * bitMsk;\n\treturn res; \n}\nfloat unpack1K ( vec4 color ) {\n\tconst vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\treturn dot( color, bitSh ) * 1000.0;\n}\nvoid main () {\n\tgl_FragColor = pack1K( length( vWorldPosition.xyz - lightPos.xyz ) );\n}"].join("\n")}},THREE.WebGLRenderer=function(t){function r(t,e,r,i){!0===A&&(t*=i,e*=i,r*=i),tt.clearColor(t,e,r,i)}function e(){yt.init(),tt.viewport(z,W,j,at),r(L.r,L.g,L.b,P)}function i(){nt=rt=null,it=-1,pt=!(I=""),yt.reset()}function n(t){t.preventDefault(),i(),e(),Rt.clear()}function d(t){(t=t.target).removeEventListener("dispose",d);t:{var e=Rt.get(t);if(t.image&&e.__image__webglTextureCube)tt.deleteTexture(e.__image__webglTextureCube);else{if(void 0===e.__webglInit)break t;tt.deleteTexture(e.__webglTexture)}Rt.delete(t)}ft.textures--}function s(t){(t=t.target).removeEventListener("dispose",s);var e=Rt.get(t),r=Rt.get(t.texture);if(t&&void 0!==r.__webglTexture){if(tt.deleteTexture(r.__webglTexture),t instanceof THREE.WebGLRenderTargetCube)for(r=0;r<6;r++)tt.deleteFramebuffer(e.__webglFramebuffer[r]),tt.deleteRenderbuffer(e.__webglRenderbuffer[r]);else tt.deleteFramebuffer(e.__webglFramebuffer),tt.deleteRenderbuffer(e.__webglRenderbuffer);Rt.delete(t.texture),Rt.delete(t)}ft.textures--}function X(t){(t=t.target).removeEventListener("dispose",X),q(t),Rt.delete(t)}function q(t){var e=Rt.get(t).program;(t.program=void 0)!==e&&Ht.releaseProgram(e)}function y(t,e){return e[0]-t[0]}function o(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function a(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function u(t,e,r,i,n){var o=r.transparent?(i=F,++U):(i=k,++V);void 0!==(o=i[o])?(o.id=t.id,o.object=t,o.geometry=e,o.material=r,o.z=lt.z,o.group=n):(o={id:t.id,object:t,geometry:e,material:r,z:lt.z,group:n},i.push(o))}function h(t,e,r,i,n){for(var o=0,a=t.length;o<a;o++){var s,h=(l=t[o]).object,c=l.geometry,u=void 0===n?l.material:n,l=l.group;h.modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,h.matrixWorld),h.normalMatrix.getNormalMatrix(h.modelViewMatrix),h instanceof THREE.ImmediateRenderObject?(R(u),s=v(e,r,i,u,h),I="",h.render(function(t){et.renderBufferImmediate(t,s,u)})):et.renderBufferDirect(e,r,i,c,u,h,l)}}function R(t){t.side!==THREE.DoubleSide?yt.enable(tt.CULL_FACE):yt.disable(tt.CULL_FACE),yt.setFlipSided(t.side===THREE.BackSide),!0===t.transparent?yt.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha):yt.setBlending(THREE.NoBlending),yt.setDepthFunc(t.depthFunc),yt.setDepthTest(t.depthTest),yt.setDepthWrite(t.depthWrite),yt.setColorWrite(t.colorWrite),yt.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function v(t,e,r,i,n){ot=0;var o,a=Rt.get(i);if(i.needsUpdate||!a.program){t:{var s=Rt.get(i),h=Ht.getParameters(i,e,r,n),c=Ht.getProgramCode(i,h),u=s.program,l=!0;if(void 0===u)i.addEventListener("dispose",X);else if(u.code!==c)q(i);else{if(void 0!==h.shaderID)break t;l=!1}if(l&&(h.shaderID?(u=THREE.ShaderLib[h.shaderID],s.__webglShader={name:i.type,uniforms:THREE.UniformsUtils.clone(u.uniforms),vertexShader:u.vertexShader,fragmentShader:u.fragmentShader}):s.__webglShader={name:i.type,uniforms:i.uniforms,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader},i.__webglShader=s.__webglShader,u=Ht.acquireProgram(i,h,c),s.program=u,i.program=u),h=u.getAttributes(),i.morphTargets)for(c=i.numSupportedMorphTargets=0;c<et.maxMorphTargets;c++)0<=h["morphTarget"+c]&&i.numSupportedMorphTargets++;if(i.morphNormals)for(c=i.numSupportedMorphNormals=0;c<et.maxMorphNormals;c++)0<=h["morphNormal"+c]&&i.numSupportedMorphNormals++;s.uniformsList=[];var E,h=s.program.getUniforms();for(E in s.__webglShader.uniforms)(c=h[E])&&s.uniformsList.push([s.__webglShader.uniforms[E],c])}i.needsUpdate=!1}if(c=u=l=!1,E=(s=a.program).getUniforms(),h=a.__webglShader.uniforms,s.id!==rt&&(tt.useProgram(s.program),rt=s.id,c=u=l=!0),i.id!==it&&(-1===it&&(c=!0),it=i.id,u=!0),!l&&t===nt||(tt.uniformMatrix4fv(E.projectionMatrix,!1,t.projectionMatrix.elements),gt.logarithmicDepthBuffer&&tt.uniform1f(E.logDepthBufFC,2/(Math.log(t.far+1)/Math.LN2)),t!==nt&&(nt=t),(i instanceof THREE.ShaderMaterial||i instanceof THREE.MeshPhongMaterial||i.envMap)&&void 0!==E.cameraPosition&&(lt.setFromMatrixPosition(t.matrixWorld),tt.uniform3f(E.cameraPosition,lt.x,lt.y,lt.z)),(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshBasicMaterial||i instanceof THREE.ShaderMaterial||i.skinning)&&void 0!==E.viewMatrix&&tt.uniformMatrix4fv(E.viewMatrix,!1,t.matrixWorldInverse.elements)),i.skinning&&(n.bindMatrix&&void 0!==E.bindMatrix&&tt.uniformMatrix4fv(E.bindMatrix,!1,n.bindMatrix.elements),n.bindMatrixInverse&&void 0!==E.bindMatrixInverse&&tt.uniformMatrix4fv(E.bindMatrixInverse,!1,n.bindMatrixInverse.elements),gt.floatVertexTextures&&n.skeleton&&n.skeleton.useVertexTexture?(void 0!==E.boneTexture&&(l=K(),tt.uniform1i(E.boneTexture,l),et.setTexture(n.skeleton.boneTexture,l)),void 0!==E.boneTextureWidth&&tt.uniform1i(E.boneTextureWidth,n.skeleton.boneTextureWidth),void 0!==E.boneTextureHeight&&tt.uniform1i(E.boneTextureHeight,n.skeleton.boneTextureHeight)):n.skeleton&&n.skeleton.boneMatrices&&void 0!==E.boneGlobalMatrices&&tt.uniformMatrix4fv(E.boneGlobalMatrices,!1,n.skeleton.boneMatrices)),u){if(r&&i.fog&&(h.fogColor.value=r.color,r instanceof THREE.Fog?(h.fogNear.value=r.near,h.fogFar.value=r.far):r instanceof THREE.FogExp2&&(h.fogDensity.value=r.density)),i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i.lights){if(pt){var p,d,f,m,c=!0,T=l=0,g=0,y=dt,R=t.matrixWorldInverse,v=y.directional.colors,H=y.directional.positions,x=y.point.colors,b=y.point.positions,w=y.point.distances,M=y.point.decays,S=y.spot.colors,_=y.spot.positions,A=y.spot.distances,C=y.spot.directions,L=y.spot.anglesCos,P=y.spot.exponents,D=y.spot.decays,k=y.hemi.skyColors,V=y.hemi.groundColors,F=y.hemi.positions,U=0,B=0,O=0,G=0,N=0,I=0,z=0,W=0,j=p=0;for(r=m=j=0,u=e.length;r<u;r++)d=(p=e[r]).color,f=p.intensity,m=p.distance,p instanceof THREE.AmbientLight?p.visible&&(l+=d.r,T+=d.g,g+=d.b):p instanceof THREE.DirectionalLight?(N+=1,p.visible&&(Et.setFromMatrixPosition(p.matrixWorld),lt.setFromMatrixPosition(p.target.matrixWorld),Et.sub(lt),Et.transformDirection(R),H[(p=3*U)+0]=Et.x,H[p+1]=Et.y,H[p+2]=Et.z,Q(v,p,d,f),U+=1)):p instanceof THREE.PointLight?(I+=1,p.visible&&(Q(x,j=3*B,d,f),lt.setFromMatrixPosition(p.matrixWorld),lt.applyMatrix4(R),b[j+0]=lt.x,b[j+1]=lt.y,b[j+2]=lt.z,w[B]=m,M[B]=0===p.distance?0:p.decay,B+=1)):p instanceof THREE.SpotLight?(z+=1,p.visible&&(Q(S,j=3*O,d,f),Et.setFromMatrixPosition(p.matrixWorld),lt.copy(Et).applyMatrix4(R),_[j+0]=lt.x,_[j+1]=lt.y,_[j+2]=lt.z,A[O]=m,lt.setFromMatrixPosition(p.target.matrixWorld),Et.sub(lt),Et.transformDirection(R),C[j+0]=Et.x,C[j+1]=Et.y,C[j+2]=Et.z,L[O]=Math.cos(p.angle),P[O]=p.exponent,D[O]=0===p.distance?0:p.decay,O+=1)):p instanceof THREE.HemisphereLight&&(W+=1,p.visible&&(Et.setFromMatrixPosition(p.matrixWorld),Et.transformDirection(R),F[(m=3*G)+0]=Et.x,F[m+1]=Et.y,F[m+2]=Et.z,d=p.color,p=p.groundColor,Q(k,m,d,f),Q(V,m,p,f),G+=1));for(r=3*U,u=Math.max(v.length,3*N);r<u;r++)v[r]=0;for(r=3*B,u=Math.max(x.length,3*I);r<u;r++)x[r]=0;for(r=3*O,u=Math.max(S.length,3*z);r<u;r++)S[r]=0;for(r=3*G,u=Math.max(k.length,3*W);r<u;r++)k[r]=0;for(r=3*G,u=Math.max(V.length,3*W);r<u;r++)V[r]=0;y.directional.length=U,y.point.length=B,y.spot.length=O,y.hemi.length=G,y.ambient[0]=l,y.ambient[1]=T,y.ambient[2]=g,pt=!1}c?(c=dt,h.ambientLightColor.value=c.ambient,h.directionalLightColor.value=c.directional.colors,h.directionalLightDirection.value=c.directional.positions,h.pointLightColor.value=c.point.colors,h.pointLightPosition.value=c.point.positions,h.pointLightDistance.value=c.point.distances,h.pointLightDecay.value=c.point.decays,h.spotLightColor.value=c.spot.colors,h.spotLightPosition.value=c.spot.positions,h.spotLightDistance.value=c.spot.distances,h.spotLightDirection.value=c.spot.directions,h.spotLightAngleCos.value=c.spot.anglesCos,h.spotLightExponent.value=c.spot.exponents,h.spotLightDecay.value=c.spot.decays,h.hemisphereLightSkyColor.value=c.hemi.skyColors,h.hemisphereLightGroundColor.value=c.hemi.groundColors,h.hemisphereLightDirection.value=c.hemi.positions,Y(h,!0)):Y(h,!1)}if((i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial)&&(h.opacity.value=i.opacity,h.diffuse.value=i.color,i.emissive&&(h.emissive.value=i.emissive),h.map.value=i.map,h.specularMap.value=i.specularMap,h.alphaMap.value=i.alphaMap,i.aoMap&&(h.aoMap.value=i.aoMap,h.aoMapIntensity.value=i.aoMapIntensity),i.map?o=i.map:i.specularMap?o=i.specularMap:i.displacementMap?o=i.displacementMap:i.normalMap?o=i.normalMap:i.bumpMap?o=i.bumpMap:i.alphaMap?o=i.alphaMap:i.emissiveMap&&(o=i.emissiveMap),void 0!==o&&(o instanceof THREE.WebGLRenderTarget&&(o=o.texture),c=o.offset,o=o.repeat,h.offsetRepeat.value.set(c.x,c.y,o.x,o.y)),h.envMap.value=i.envMap,h.flipEnvMap.value=i.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,h.reflectivity.value=i.reflectivity,h.refractionRatio.value=i.refractionRatio),i instanceof THREE.LineBasicMaterial?(h.diffuse.value=i.color,h.opacity.value=i.opacity):i instanceof THREE.LineDashedMaterial?(h.diffuse.value=i.color,h.opacity.value=i.opacity,h.dashSize.value=i.dashSize,h.totalSize.value=i.dashSize+i.gapSize,h.scale.value=i.scale):i instanceof THREE.PointsMaterial?(h.psColor.value=i.color,h.opacity.value=i.opacity,h.size.value=i.size,h.scale.value=$.height/2,h.map.value=i.map,null!==i.map&&(t=i.map.offset,o=i.map.repeat,h.offsetRepeat.value.set(t.x,t.y,o.x,o.y))):i instanceof THREE.MeshPhongMaterial?(h.specular.value=i.specular,h.shininess.value=Math.max(i.shininess,1e-4),i.lightMap&&(h.lightMap.value=i.lightMap,h.lightMapIntensity.value=i.lightMapIntensity),i.emissiveMap&&(h.emissiveMap.value=i.emissiveMap),i.bumpMap&&(h.bumpMap.value=i.bumpMap,h.bumpScale.value=i.bumpScale),i.normalMap&&(h.normalMap.value=i.normalMap,h.normalScale.value.copy(i.normalScale)),i.displacementMap&&(h.displacementMap.value=i.displacementMap,h.displacementScale.value=i.displacementScale,h.displacementBias.value=i.displacementBias)):i instanceof THREE.MeshDepthMaterial?(h.mNear.value=t.near,h.mFar.value=t.far,h.opacity.value=i.opacity):i instanceof THREE.MeshNormalMaterial&&(h.opacity.value=i.opacity),n.receiveShadow&&!i._shadowPass&&h.shadowMatrix)for(t=i=0,o=e.length;t<o;t++)!0===(c=e[t]).castShadow&&(c instanceof THREE.PointLight||c instanceof THREE.SpotLight||c instanceof THREE.DirectionalLight)&&(r=c.shadow,c instanceof THREE.PointLight?(lt.setFromMatrixPosition(c.matrixWorld).negate(),r.matrix.identity().setPosition(lt),h.shadowDarkness.value[i]=-r.darkness):h.shadowDarkness.value[i]=r.darkness,h.shadowMatrix.value[i]=r.matrix,h.shadowMap.value[i]=r.map,h.shadowMapSize.value[i]=r.mapSize,h.shadowBias.value[i]=r.bias,i++);for(e=a.uniformsList,a=0,i=e.length;a<i;a++)if(!1!==(t=e[a][0]).needsUpdate)switch(h=t.type,r=t.value,o=e[a][1],h){case"1i":tt.uniform1i(o,r);break;case"1f":tt.uniform1f(o,r);break;case"2f":tt.uniform2f(o,r[0],r[1]);break;case"3f":tt.uniform3f(o,r[0],r[1],r[2]);break;case"4f":tt.uniform4f(o,r[0],r[1],r[2],r[3]);break;case"1iv":tt.uniform1iv(o,r);break;case"3iv":tt.uniform3iv(o,r);break;case"1fv":tt.uniform1fv(o,r);break;case"2fv":tt.uniform2fv(o,r);break;case"3fv":tt.uniform3fv(o,r);break;case"4fv":tt.uniform4fv(o,r);break;case"Matrix3fv":tt.uniformMatrix3fv(o,!1,r);break;case"Matrix4fv":tt.uniformMatrix4fv(o,!1,r);break;case"i":tt.uniform1i(o,r);break;case"f":tt.uniform1f(o,r);break;case"v2":tt.uniform2f(o,r.x,r.y);break;case"v3":tt.uniform3f(o,r.x,r.y,r.z);break;case"v4":tt.uniform4f(o,r.x,r.y,r.z,r.w);break;case"c":tt.uniform3f(o,r.r,r.g,r.b);break;case"iv1":tt.uniform1iv(o,r);break;case"iv":tt.uniform3iv(o,r);break;case"fv1":tt.uniform1fv(o,r);break;case"fv":tt.uniform3fv(o,r);break;case"v2v":for(void 0===t._array&&(t._array=new Float32Array(2*r.length)),u=h=0,c=r.length;h<c;h++,u+=2)t._array[u+0]=r[h].x,t._array[u+1]=r[h].y;tt.uniform2fv(o,t._array);break;case"v3v":for(void 0===t._array&&(t._array=new Float32Array(3*r.length)),u=h=0,c=r.length;h<c;h++,u+=3)t._array[u+0]=r[h].x,t._array[u+1]=r[h].y,t._array[u+2]=r[h].z;tt.uniform3fv(o,t._array);break;case"v4v":for(void 0===t._array&&(t._array=new Float32Array(4*r.length)),u=h=0,c=r.length;h<c;h++,u+=4)t._array[u+0]=r[h].x,t._array[u+1]=r[h].y,t._array[u+2]=r[h].z,t._array[u+3]=r[h].w;tt.uniform4fv(o,t._array);break;case"m3":tt.uniformMatrix3fv(o,!1,r.elements);break;case"m3v":for(void 0===t._array&&(t._array=new Float32Array(9*r.length)),h=0,c=r.length;h<c;h++)r[h].flattenToArrayOffset(t._array,9*h);tt.uniformMatrix3fv(o,!1,t._array);break;case"m4":tt.uniformMatrix4fv(o,!1,r.elements);break;case"m4v":for(void 0===t._array&&(t._array=new Float32Array(16*r.length)),h=0,c=r.length;h<c;h++)r[h].flattenToArrayOffset(t._array,16*h);tt.uniformMatrix4fv(o,!1,t._array);break;case"t":if(u=K(),tt.uniform1i(o,u),!r)continue;r instanceof THREE.CubeTexture||Array.isArray(r.image)&&6===r.image.length?Z(r,u):r instanceof THREE.WebGLRenderTargetCube?J(r.texture,u):r instanceof THREE.WebGLRenderTarget?et.setTexture(r.texture,u):et.setTexture(r,u);break;case"tv":for(void 0===t._array&&(t._array=[]),h=0,c=t.value.length;h<c;h++)t._array[h]=K();for(tt.uniform1iv(o,t._array),h=0,c=t.value.length;h<c;h++)r=t.value[h],u=t._array[h],r&&(r instanceof THREE.CubeTexture||r.image instanceof Array&&6===r.image.length?Z(r,u):r instanceof THREE.WebGLRenderTarget?et.setTexture(r.texture,u):r instanceof THREE.WebGLRenderTargetCube?J(r.texture,u):et.setTexture(r,u));break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+h)}}return tt.uniformMatrix4fv(E.modelViewMatrix,!1,n.modelViewMatrix.elements),E.normalMatrix&&tt.uniformMatrix3fv(E.normalMatrix,!1,n.normalMatrix.elements),void 0!==E.modelMatrix&&tt.uniformMatrix4fv(E.modelMatrix,!1,n.matrixWorld.elements),s}function Y(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLightColor.needsUpdate=e,t.directionalLightDirection.needsUpdate=e,t.pointLightColor.needsUpdate=e,t.pointLightPosition.needsUpdate=e,t.pointLightDistance.needsUpdate=e,t.pointLightDecay.needsUpdate=e,t.spotLightColor.needsUpdate=e,t.spotLightPosition.needsUpdate=e,t.spotLightDistance.needsUpdate=e,t.spotLightDirection.needsUpdate=e,t.spotLightAngleCos.needsUpdate=e,t.spotLightExponent.needsUpdate=e,t.spotLightDecay.needsUpdate=e,t.hemisphereLightSkyColor.needsUpdate=e,t.hemisphereLightGroundColor.needsUpdate=e,t.hemisphereLightDirection.needsUpdate=e}function K(){var t=ot;return t>=gt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+gt.maxTextures),ot+=1,t}function Q(t,e,r,i){t[e+0]=r.r*i,t[e+1]=r.g*i,t[e+2]=r.b*i}function f(t,e,r){r?(tt.texParameteri(t,tt.TEXTURE_WRAP_S,g(e.wrapS)),tt.texParameteri(t,tt.TEXTURE_WRAP_T,g(e.wrapT)),tt.texParameteri(t,tt.TEXTURE_MAG_FILTER,g(e.magFilter)),tt.texParameteri(t,tt.TEXTURE_MIN_FILTER,g(e.minFilter))):(tt.texParameteri(t,tt.TEXTURE_WRAP_S,tt.CLAMP_TO_EDGE),tt.texParameteri(t,tt.TEXTURE_WRAP_T,tt.CLAMP_TO_EDGE),e.wrapS===THREE.ClampToEdgeWrapping&&e.wrapT===THREE.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",e),tt.texParameteri(t,tt.TEXTURE_MAG_FILTER,E(e.magFilter)),tt.texParameteri(t,tt.TEXTURE_MIN_FILTER,E(e.minFilter)),e.minFilter!==THREE.NearestFilter&&e.minFilter!==THREE.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",e)),!(r=Tt.get("EXT_texture_filter_anisotropic"))||e.type===THREE.FloatType&&null===Tt.get("OES_texture_float_linear")||e.type===THREE.HalfFloatType&&null===Tt.get("OES_texture_half_float_linear")||!(1<e.anisotropy||Rt.get(e).__currentAnisotropy)||(tt.texParameterf(t,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(e.anisotropy,et.getMaxAnisotropy())),Rt.get(e).__currentAnisotropy=e.anisotropy)}function m(t,e){if(t.width>e||t.height>e){var r=e/Math.max(t.width,t.height),i=document.createElement("canvas");return i.width=Math.floor(t.width*r),i.height=Math.floor(t.height*r),i.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t),i}return t}function T(t){return THREE.Math.isPowerOfTwo(t.width)&&THREE.Math.isPowerOfTwo(t.height)}function Z(t,e){var r=Rt.get(t);if(6===t.image.length)if(0<t.version&&r.__version!==t.version){r.__image__webglTextureCube||(t.addEventListener("dispose",d),r.__image__webglTextureCube=tt.createTexture(),ft.textures++),yt.activeTexture(tt.TEXTURE0+e),yt.bindTexture(tt.TEXTURE_CUBE_MAP,r.__image__webglTextureCube),tt.pixelStorei(tt.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var i=t instanceof THREE.CompressedTexture,n=t.image[0]instanceof THREE.DataTexture,o=[],a=0;a<6;a++)o[a]=!et.autoScaleCubemaps||i||n?n?t.image[a].image:t.image[a]:m(t.image[a],gt.maxCubemapSize);var s=T(o[0]),h=g(t.format),c=g(t.type);for(f(tt.TEXTURE_CUBE_MAP,t,s),a=0;a<6;a++)if(i)for(var u,l=o[a].mipmaps,E=0,p=l.length;E<p;E++)u=l[E],t.format!==THREE.RGBAFormat&&t.format!==THREE.RGBFormat?-1<yt.getCompressedTextureFormats().indexOf(h)?yt.compressedTexImage2D(tt.TEXTURE_CUBE_MAP_POSITIVE_X+a,E,h,u.width,u.height,0,u.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):yt.texImage2D(tt.TEXTURE_CUBE_MAP_POSITIVE_X+a,E,h,u.width,u.height,0,h,c,u.data);else n?yt.texImage2D(tt.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,h,o[a].width,o[a].height,0,h,c,o[a].data):yt.texImage2D(tt.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,h,h,c,o[a]);t.generateMipmaps&&s&&tt.generateMipmap(tt.TEXTURE_CUBE_MAP),r.__version=t.version,t.onUpdate&&t.onUpdate(t)}else yt.activeTexture(tt.TEXTURE0+e),yt.bindTexture(tt.TEXTURE_CUBE_MAP,r.__image__webglTextureCube)}function J(t,e){yt.activeTexture(tt.TEXTURE0+e),yt.bindTexture(tt.TEXTURE_CUBE_MAP,Rt.get(t).__webglTexture)}function c(t,e,r){tt.bindFramebuffer(tt.FRAMEBUFFER,t),tt.framebufferTexture2D(tt.FRAMEBUFFER,tt.COLOR_ATTACHMENT0,r,Rt.get(e.texture).__webglTexture,0)}function l(t,e){tt.bindRenderbuffer(tt.RENDERBUFFER,t),e.depthBuffer&&!e.stencilBuffer?(tt.renderbufferStorage(tt.RENDERBUFFER,tt.DEPTH_COMPONENT16,e.width,e.height),tt.framebufferRenderbuffer(tt.FRAMEBUFFER,tt.DEPTH_ATTACHMENT,tt.RENDERBUFFER,t)):e.depthBuffer&&e.stencilBuffer?(tt.renderbufferStorage(tt.RENDERBUFFER,tt.DEPTH_STENCIL,e.width,e.height),tt.framebufferRenderbuffer(tt.FRAMEBUFFER,tt.DEPTH_STENCIL_ATTACHMENT,tt.RENDERBUFFER,t)):tt.renderbufferStorage(tt.RENDERBUFFER,tt.RGBA4,e.width,e.height)}function E(t){return t===THREE.NearestFilter||t===THREE.NearestMipMapNearestFilter||t===THREE.NearestMipMapLinearFilter?tt.NEAREST:tt.LINEAR}function g(t){var e;if(t===THREE.RepeatWrapping)return tt.REPEAT;if(t===THREE.ClampToEdgeWrapping)return tt.CLAMP_TO_EDGE;if(t===THREE.MirroredRepeatWrapping)return tt.MIRRORED_REPEAT;if(t===THREE.NearestFilter)return tt.NEAREST;if(t===THREE.NearestMipMapNearestFilter)return tt.NEAREST_MIPMAP_NEAREST;if(t===THREE.NearestMipMapLinearFilter)return tt.NEAREST_MIPMAP_LINEAR;if(t===THREE.LinearFilter)return tt.LINEAR;if(t===THREE.LinearMipMapNearestFilter)return tt.LINEAR_MIPMAP_NEAREST;if(t===THREE.LinearMipMapLinearFilter)return tt.LINEAR_MIPMAP_LINEAR;if(t===THREE.UnsignedByteType)return tt.UNSIGNED_BYTE;if(t===THREE.UnsignedShort4444Type)return tt.UNSIGNED_SHORT_4_4_4_4;if(t===THREE.UnsignedShort5551Type)return tt.UNSIGNED_SHORT_5_5_5_1;if(t===THREE.UnsignedShort565Type)return tt.UNSIGNED_SHORT_5_6_5;if(t===THREE.ByteType)return tt.BYTE;if(t===THREE.ShortType)return tt.SHORT;if(t===THREE.UnsignedShortType)return tt.UNSIGNED_SHORT;if(t===THREE.IntType)return tt.INT;if(t===THREE.UnsignedIntType)return tt.UNSIGNED_INT;if(t===THREE.FloatType)return tt.FLOAT;if(null!==(e=Tt.get("OES_texture_half_float"))&&t===THREE.HalfFloatType)return e.HALF_FLOAT_OES;if(t===THREE.AlphaFormat)return tt.ALPHA;if(t===THREE.RGBFormat)return tt.RGB;if(t===THREE.RGBAFormat)return tt.RGBA;if(t===THREE.LuminanceFormat)return tt.LUMINANCE;if(t===THREE.LuminanceAlphaFormat)return tt.LUMINANCE_ALPHA;if(t===THREE.AddEquation)return tt.FUNC_ADD;if(t===THREE.SubtractEquation)return tt.FUNC_SUBTRACT;if(t===THREE.ReverseSubtractEquation)return tt.FUNC_REVERSE_SUBTRACT;if(t===THREE.ZeroFactor)return tt.ZERO;if(t===THREE.OneFactor)return tt.ONE;if(t===THREE.SrcColorFactor)return tt.SRC_COLOR;if(t===THREE.OneMinusSrcColorFactor)return tt.ONE_MINUS_SRC_COLOR;if(t===THREE.SrcAlphaFactor)return tt.SRC_ALPHA;if(t===THREE.OneMinusSrcAlphaFactor)return tt.ONE_MINUS_SRC_ALPHA;if(t===THREE.DstAlphaFactor)return tt.DST_ALPHA;if(t===THREE.OneMinusDstAlphaFactor)return tt.ONE_MINUS_DST_ALPHA;if(t===THREE.DstColorFactor)return tt.DST_COLOR;if(t===THREE.OneMinusDstColorFactor)return tt.ONE_MINUS_DST_COLOR;if(t===THREE.SrcAlphaSaturateFactor)return tt.SRC_ALPHA_SATURATE;if(null!==(e=Tt.get("WEBGL_compressed_texture_s3tc"))){if(t===THREE.RGB_S3TC_DXT1_Format)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===THREE.RGBA_S3TC_DXT1_Format)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===THREE.RGBA_S3TC_DXT3_Format)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===THREE.RGBA_S3TC_DXT5_Format)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(null!==(e=Tt.get("WEBGL_compressed_texture_pvrtc"))){if(t===THREE.RGB_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===THREE.RGB_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===THREE.RGBA_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===THREE.RGBA_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(null!==(e=Tt.get("EXT_blend_minmax"))){if(t===THREE.MinEquation)return e.MIN_EXT;if(t===THREE.MaxEquation)return e.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var $=void 0!==(t=t||{}).canvas?t.canvas:document.createElement("canvas"),p=void 0!==t.context?t.context:null,H=$.width,x=$.height,b=1,w=void 0!==t.alpha&&t.alpha,M=void 0===t.depth||t.depth,S=void 0===t.stencil||t.stencil,_=void 0!==t.antialias&&t.antialias,A=void 0===t.premultipliedAlpha||t.premultipliedAlpha,C=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,L=new THREE.Color(0),P=0,D=[],k=[],V=-1,F=[],U=-1,B=new Float32Array(8),O=[],G=[];this.domElement=$,this.context=null,this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0,this.gammaFactor=2,this.gammaOutput=this.gammaInput=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0;var tt,et=this,rt=null,N=null,it=-1,I="",nt=null,ot=0,z=0,W=0,j=$.width,at=$.height,st=0,ht=0,ct=new THREE.Frustum,ut=new THREE.Matrix4,lt=new THREE.Vector3,Et=new THREE.Vector3,pt=!0,dt={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[],decays:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[],decays:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},ft={geometries:0,textures:0},mt={calls:0,vertices:0,faces:0,points:0};this.info={render:mt,memory:ft,programs:null};try{if(w={alpha:w,depth:M,stencil:S,antialias:_,premultipliedAlpha:A,preserveDrawingBuffer:C},null===(tt=p||$.getContext("webgl",w)||$.getContext("experimental-webgl",w))){if(null!==$.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context."}$.addEventListener("webglcontextlost",n,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var Tt=new THREE.WebGLExtensions(tt);Tt.get("OES_texture_float"),Tt.get("OES_texture_float_linear"),Tt.get("OES_texture_half_float"),Tt.get("OES_texture_half_float_linear"),Tt.get("OES_standard_derivatives"),Tt.get("ANGLE_instanced_arrays"),Tt.get("OES_element_index_uint")&&(THREE.BufferGeometry.MaxIndex=4294967296);var gt=new THREE.WebGLCapabilities(tt,Tt,t),yt=new THREE.WebGLState(tt,Tt,g),Rt=new THREE.WebGLProperties,vt=new THREE.WebGLObjects(tt,Rt,this.info),Ht=new THREE.WebGLPrograms(this,gt);this.info.programs=Ht.programs;var xt=new THREE.WebGLBufferRenderer(tt,Tt,mt),bt=new THREE.WebGLIndexedBufferRenderer(tt,Tt,mt);e(),this.context=tt,this.capabilities=gt,this.extensions=Tt,this.state=yt;var wt=new THREE.WebGLShadowMap(this,D,vt);this.shadowMap=wt;var Mt,St=new THREE.SpritePlugin(this,O),_t=new THREE.LensFlarePlugin(this,G);this.getContext=function(){return tt},this.getContextAttributes=function(){return tt.getContextAttributes()},this.forceContextLoss=function(){Tt.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){if(void 0!==Mt)return Mt;var t=Tt.get("EXT_texture_filter_anisotropic");return Mt=null!==t?tt.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},this.getPrecision=function(){return gt.precision},this.getPixelRatio=function(){return b},this.setPixelRatio=function(t){void 0!==t&&(b=t)},this.getSize=function(){return{width:H,height:x}},this.setSize=function(t,e,r){H=t,x=e,$.width=t*b,$.height=e*b,!1!==r&&($.style.width=t+"px",$.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,r,i){z=t*b,W=e*b,j=r*b,at=i*b,tt.viewport(z,W,j,at)},this.getViewport=function(t){t.x=z/b,t.y=W/b,t.z=j/b,t.w=at/b},this.setScissor=function(t,e,r,i){tt.scissor(t*b,e*b,r*b,i*b)},this.enableScissorTest=function(t){yt.setScissorTest(t)},this.getClearColor=function(){return L},this.setClearColor=function(t,e){L.set(t),P=void 0!==e?e:1,r(L.r,L.g,L.b,P)},this.getClearAlpha=function(){return P},this.setClearAlpha=function(t){P=t,r(L.r,L.g,L.b,P)},this.clear=function(t,e,r){var i=0;void 0!==t&&!t||(i|=tt.COLOR_BUFFER_BIT),void 0!==e&&!e||(i|=tt.DEPTH_BUFFER_BIT),void 0!==r&&!r||(i|=tt.STENCIL_BUFFER_BIT),tt.clear(i)},this.clearColor=function(){tt.clear(tt.COLOR_BUFFER_BIT)},this.clearDepth=function(){tt.clear(tt.DEPTH_BUFFER_BIT)},this.clearStencil=function(){tt.clear(tt.STENCIL_BUFFER_BIT)},this.clearTarget=function(t,e,r,i){this.setRenderTarget(t),this.clear(e,r,i)},this.resetGLState=i,this.dispose=function(){$.removeEventListener("webglcontextlost",n,!1)},this.renderBufferImmediate=function(t,e,r){yt.initAttributes();var i=Rt.get(t);if(t.hasPositions&&!i.position&&(i.position=tt.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=tt.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=tt.createBuffer()),t.hasColors&&!i.color&&(i.color=tt.createBuffer()),e=e.getAttributes(),t.hasPositions&&(tt.bindBuffer(tt.ARRAY_BUFFER,i.position),tt.bufferData(tt.ARRAY_BUFFER,t.positionArray,tt.DYNAMIC_DRAW),yt.enableAttribute(e.position),tt.vertexAttribPointer(e.position,3,tt.FLOAT,!1,0,0)),t.hasNormals){if(tt.bindBuffer(tt.ARRAY_BUFFER,i.normal),"MeshPhongMaterial"!==r.type&&r.shading===THREE.FlatShading)for(var n=0,o=3*t.count;n<o;n+=9){var a=t.normalArray,s=(a[n+0]+a[n+3]+a[n+6])/3,h=(a[n+1]+a[n+4]+a[n+7])/3,c=(a[n+2]+a[n+5]+a[n+8])/3;a[n+0]=s,a[n+1]=h,a[n+2]=c,a[n+3]=s,a[n+4]=h,a[n+5]=c,a[n+6]=s,a[n+7]=h,a[n+8]=c}tt.bufferData(tt.ARRAY_BUFFER,t.normalArray,tt.DYNAMIC_DRAW),yt.enableAttribute(e.normal),tt.vertexAttribPointer(e.normal,3,tt.FLOAT,!1,0,0)}t.hasUvs&&r.map&&(tt.bindBuffer(tt.ARRAY_BUFFER,i.uv),tt.bufferData(tt.ARRAY_BUFFER,t.uvArray,tt.DYNAMIC_DRAW),yt.enableAttribute(e.uv),tt.vertexAttribPointer(e.uv,2,tt.FLOAT,!1,0,0)),t.hasColors&&r.vertexColors!==THREE.NoColors&&(tt.bindBuffer(tt.ARRAY_BUFFER,i.color),tt.bufferData(tt.ARRAY_BUFFER,t.colorArray,tt.DYNAMIC_DRAW),yt.enableAttribute(e.color),tt.vertexAttribPointer(e.color,3,tt.FLOAT,!1,0,0)),yt.disableUnusedAttributes(),tt.drawArrays(tt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,r,i,n,o,a){R(n);var s=v(t,e,r,n,o),h=!1;if((t=i.id+"_"+s.id+"_"+n.wireframe)!==I&&(I=t,h=!0),void 0!==(e=o.morphTargetInfluences)){for(t=[],r=0,h=e.length;r<h;r++){var c=e[r];t.push([c,r])}t.sort(y),8<t.length&&(t.length=8);var u=i.morphAttributes;for(r=0,h=t.length;r<h;r++)c=t[r],B[r]=c[0],0!==c[0]?(e=c[1],!0===n.morphTargets&&u.position&&i.addAttribute("morphTarget"+r,u.position[e]),!0===n.morphNormals&&u.normal&&i.addAttribute("morphNormal"+r,u.normal[e])):(!0===n.morphTargets&&i.removeAttribute("morphTarget"+r),!0===n.morphNormals&&i.removeAttribute("morphNormal"+r));null!==(t=s.getUniforms()).morphTargetInfluences&&tt.uniform1fv(t.morphTargetInfluences,B),h=!0}if(e=i.index,r=i.attributes.position,!0===n.wireframe&&(e=vt.getWireframeAttribute(i)),null!==e?(t=bt).setIndex(e):t=xt,h){var l,h=void 0;if(i instanceof THREE.InstancedBufferGeometry&&null===(l=Tt.get("ANGLE_instanced_arrays")))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{void 0===h&&(h=0),yt.initAttributes();var E,c=i.attributes,s=s.getAttributes(),u=n.defaultAttributeValues;for(E in s){var p=s[E];if(0<=p)if(void 0!==(m=c[E])){var d,f,m,T=m.itemSize,g=vt.getAttributeBuffer(m);m instanceof THREE.InterleavedBufferAttribute?(f=(d=m.data).stride,m=m.offset,d instanceof THREE.InstancedInterleavedBuffer?(yt.enableAttributeAndDivisor(p,d.meshPerAttribute,l),void 0===i.maxInstancedCount&&(i.maxInstancedCount=d.meshPerAttribute*d.count)):yt.enableAttribute(p),tt.bindBuffer(tt.ARRAY_BUFFER,g),tt.vertexAttribPointer(p,T,tt.FLOAT,!1,f*d.array.BYTES_PER_ELEMENT,(h*f+m)*d.array.BYTES_PER_ELEMENT)):(m instanceof THREE.InstancedBufferAttribute?(yt.enableAttributeAndDivisor(p,m.meshPerAttribute,l),void 0===i.maxInstancedCount&&(i.maxInstancedCount=m.meshPerAttribute*m.count)):yt.enableAttribute(p),tt.bindBuffer(tt.ARRAY_BUFFER,g),tt.vertexAttribPointer(p,T,tt.FLOAT,!1,0,h*T*4))}else if(void 0!==u&&void 0!==(T=u[E]))switch(T.length){case 2:tt.vertexAttrib2fv(p,T);break;case 3:tt.vertexAttrib3fv(p,T);break;case 4:tt.vertexAttrib4fv(p,T);break;default:tt.vertexAttrib1fv(p,T)}}yt.disableUnusedAttributes()}null!==e&&tt.bindBuffer(tt.ELEMENT_ARRAY_BUFFER,vt.getAttributeBuffer(e))}l=1/0,null!==e?l=e.count:void 0!==r&&(l=r.count),E=i.drawRange.start,e=i.drawRange.count,r=null!==a?a.start:0,h=null!==a?a.count:1/0,a=Math.max(0,E,r),l=Math.min(0+l,E+e,r+h)-1,l=Math.max(0,l-a+1),o instanceof THREE.Mesh?(!0===n.wireframe?(yt.setLineWidth(n.wireframeLinewidth*b),t.setMode(tt.LINES)):t.setMode(tt.TRIANGLES),i instanceof THREE.InstancedBufferGeometry&&0<i.maxInstancedCount?t.renderInstances(i):t.render(a,l)):o instanceof THREE.Line?(void 0===(i=n.linewidth)&&(i=1),yt.setLineWidth(i*b),o instanceof THREE.LineSegments?t.setMode(tt.LINES):t.setMode(tt.LINE_STRIP),t.render(a,l)):o instanceof THREE.Points&&(t.setMode(tt.POINTS),t.render(a,l))},this.render=function(t,e,r,i){var n;!1==e instanceof THREE.Camera?console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera."):(n=t.fog,I="",it=-1,(pt=!(nt=null))===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),ut.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),ct.setFromMatrix(ut),D.length=0,U=V=-1,O.length=0,G.length=0,function t(e,r){if(!1!==e.visible){if(0!=(e.channels.mask&r.channels.mask))if(e instanceof THREE.Light)D.push(e);else if(e instanceof THREE.Sprite)O.push(e);else if(e instanceof THREE.LensFlare)G.push(e);else if(e instanceof THREE.ImmediateRenderObject)!0===et.sortObjects&&(lt.setFromMatrixPosition(e.matrixWorld),lt.applyProjection(ut)),u(e,null,e.material,lt.z,null);else if((e instanceof THREE.Mesh||e instanceof THREE.Line||e instanceof THREE.Points)&&(e instanceof THREE.SkinnedMesh&&e.skeleton.update(),!1===e.frustumCulled||!0===ct.intersectsObject(e))&&!0===(a=e.material).visible){!0===et.sortObjects&&(lt.setFromMatrixPosition(e.matrixWorld),lt.applyProjection(ut));var i=vt.update(e);if(a instanceof THREE.MeshFaceMaterial)for(var n=i.groups,o=a.materials,a=0,s=n.length;a<s;a++){var h=n[a],c=o[h.materialIndex];!0===c.visible&&u(e,i,c,lt.z,h)}else u(e,i,a,lt.z,null)}for(a=0,s=(i=e.children).length;a<s;a++)t(i[a],r)}}(t,e),k.length=V+1,F.length=U+1,!0===et.sortObjects&&(k.sort(o),F.sort(a)),wt.render(t),mt.calls=0,mt.vertices=0,mt.faces=0,mt.points=0,this.setRenderTarget(r),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),t.overrideMaterial?(i=t.overrideMaterial,h(k,e,D,n,i),h(F,e,D,n,i)):(yt.setBlending(THREE.NoBlending),h(k,e,D,n),h(F,e,D,n)),St.render(t,e),_t.render(t,e,st,ht),r&&(t=r.texture,e=T(r),t.generateMipmaps&&e&&t.minFilter!==THREE.NearestFilter&&t.minFilter!==THREE.LinearFilter&&(t=r instanceof THREE.WebGLRenderTargetCube?tt.TEXTURE_CUBE_MAP:tt.TEXTURE_2D,r=Rt.get(r.texture).__webglTexture,yt.bindTexture(t,r),tt.generateMipmap(t),yt.bindTexture(t,null))),yt.setDepthTest(!0),yt.setDepthWrite(!0),yt.setColorWrite(!0))},this.setFaceCulling=function(t,e){t===THREE.CullFaceNone?yt.disable(tt.CULL_FACE):(e===THREE.FrontFaceDirectionCW?tt.frontFace(tt.CW):tt.frontFace(tt.CCW),t===THREE.CullFaceBack?tt.cullFace(tt.BACK):t===THREE.CullFaceFront?tt.cullFace(tt.FRONT):tt.cullFace(tt.FRONT_AND_BACK),yt.enable(tt.CULL_FACE))},this.setTexture=function(t,e){var r=Rt.get(t);if(0<t.version&&r.__version!==t.version)if(void 0===(n=t.image))console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",t);else if(!1===n.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",t);else{void 0===r.__webglInit&&(r.__webglInit=!0,t.addEventListener("dispose",d),r.__webglTexture=tt.createTexture(),ft.textures++),yt.activeTexture(tt.TEXTURE0+e),yt.bindTexture(tt.TEXTURE_2D,r.__webglTexture),tt.pixelStorei(tt.UNPACK_FLIP_Y_WEBGL,t.flipY),tt.pixelStorei(tt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),tt.pixelStorei(tt.UNPACK_ALIGNMENT,t.unpackAlignment),t.image=m(t.image,gt.maxTextureSize),(t.wrapS!==THREE.ClampToEdgeWrapping||t.wrapT!==THREE.ClampToEdgeWrapping||t.minFilter!==THREE.NearestFilter&&t.minFilter!==THREE.LinearFilter)&&!1===T(t.image)&&(((n=t.image)instanceof HTMLImageElement||n instanceof HTMLCanvasElement)&&((o=document.createElement("canvas")).width=THREE.Math.nearestPowerOfTwo(n.width),o.height=THREE.Math.nearestPowerOfTwo(n.height),o.getContext("2d").drawImage(n,0,0,o.width,o.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+n.width+"x"+n.height+"). Resized to "+o.width+"x"+o.height,n),n=o),t.image=n);var i=t.image,n=T(i),o=g(t.format),a=g(t.type);f(tt.TEXTURE_2D,t,n);var s=t.mipmaps;if(t instanceof THREE.DataTexture)if(0<s.length&&n){for(var h=0,c=s.length;h<c;h++)i=s[h],yt.texImage2D(tt.TEXTURE_2D,h,o,i.width,i.height,0,o,a,i.data);t.generateMipmaps=!1}else yt.texImage2D(tt.TEXTURE_2D,0,o,i.width,i.height,0,o,a,i.data);else if(t instanceof THREE.CompressedTexture)for(h=0,c=s.length;h<c;h++)i=s[h],t.format!==THREE.RGBAFormat&&t.format!==THREE.RGBFormat?-1<yt.getCompressedTextureFormats().indexOf(o)?yt.compressedTexImage2D(tt.TEXTURE_2D,h,o,i.width,i.height,0,i.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):yt.texImage2D(tt.TEXTURE_2D,h,o,i.width,i.height,0,o,a,i.data);else if(0<s.length&&n){for(h=0,c=s.length;h<c;h++)i=s[h],yt.texImage2D(tt.TEXTURE_2D,h,o,o,a,i);t.generateMipmaps=!1}else yt.texImage2D(tt.TEXTURE_2D,0,o,o,a,t.image);t.generateMipmaps&&n&&tt.generateMipmap(tt.TEXTURE_2D),r.__version=t.version,t.onUpdate&&t.onUpdate(t)}else yt.activeTexture(tt.TEXTURE0+e),yt.bindTexture(tt.TEXTURE_2D,r.__webglTexture)},this.setRenderTarget=function(t){var e=t instanceof THREE.WebGLRenderTargetCube;if(t&&void 0===Rt.get(t).__webglFramebuffer){var r=Rt.get(t),i=Rt.get(t.texture);void 0===t.depthBuffer&&(t.depthBuffer=!0),void 0===t.stencilBuffer&&(t.stencilBuffer=!0),t.addEventListener("dispose",s),i.__webglTexture=tt.createTexture(),ft.textures++;var n=T(t),o=g(t.texture.format),a=g(t.texture.type);if(e){for(r.__webglFramebuffer=[],r.__webglRenderbuffer=[],yt.bindTexture(tt.TEXTURE_CUBE_MAP,i.__webglTexture),f(tt.TEXTURE_CUBE_MAP,t.texture,n),i=0;i<6;i++)r.__webglFramebuffer[i]=tt.createFramebuffer(),r.__webglRenderbuffer[i]=tt.createRenderbuffer(),yt.texImage2D(tt.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,o,t.width,t.height,0,o,a,null),c(r.__webglFramebuffer[i],t,tt.TEXTURE_CUBE_MAP_POSITIVE_X+i),l(r.__webglRenderbuffer[i],t);t.texture.generateMipmaps&&n&&tt.generateMipmap(tt.TEXTURE_CUBE_MAP)}else r.__webglFramebuffer=tt.createFramebuffer(),r.__webglRenderbuffer=t.shareDepthFrom?t.shareDepthFrom.__webglRenderbuffer:tt.createRenderbuffer(),yt.bindTexture(tt.TEXTURE_2D,i.__webglTexture),f(tt.TEXTURE_2D,t.texture,n),yt.texImage2D(tt.TEXTURE_2D,0,o,t.width,t.height,0,o,a,null),c(r.__webglFramebuffer,t,tt.TEXTURE_2D),t.shareDepthFrom?t.depthBuffer&&!t.stencilBuffer?tt.framebufferRenderbuffer(tt.FRAMEBUFFER,tt.DEPTH_ATTACHMENT,tt.RENDERBUFFER,r.__webglRenderbuffer):t.depthBuffer&&t.stencilBuffer&&tt.framebufferRenderbuffer(tt.FRAMEBUFFER,tt.DEPTH_STENCIL_ATTACHMENT,tt.RENDERBUFFER,r.__webglRenderbuffer):l(r.__webglRenderbuffer,t),t.texture.generateMipmaps&&n&&tt.generateMipmap(tt.TEXTURE_2D);e?yt.bindTexture(tt.TEXTURE_CUBE_MAP,null):yt.bindTexture(tt.TEXTURE_2D,null),tt.bindRenderbuffer(tt.RENDERBUFFER,null),tt.bindFramebuffer(tt.FRAMEBUFFER,null)}a=t?(r=Rt.get(t),i=e?r.__webglFramebuffer[t.activeCubeFace]:r.__webglFramebuffer,r=t.width,n=t.height,o=0):(i=null,r=j,n=at,o=z,W),i!==N&&(tt.bindFramebuffer(tt.FRAMEBUFFER,i),tt.viewport(o,a,r,n),N=i),e&&(i=Rt.get(t.texture),tt.framebufferTexture2D(tt.FRAMEBUFFER,tt.COLOR_ATTACHMENT0,tt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,i.__webglTexture,0)),st=r,ht=n},this.readRenderTargetPixels=function(t,e,r,i,n,o){if(!1==t instanceof THREE.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var a=Rt.get(t).__webglFramebuffer;if(a){var s=!1;a!==N&&(tt.bindFramebuffer(tt.FRAMEBUFFER,a),s=!0);try{var h=t.texture;h.format!==THREE.RGBAFormat&&g(h.format)!==tt.getParameter(tt.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):h.type===THREE.UnsignedByteType||g(h.type)===tt.getParameter(tt.IMPLEMENTATION_COLOR_READ_TYPE)||h.type===THREE.FloatType&&Tt.get("WEBGL_color_buffer_float")||h.type===THREE.HalfFloatType&&Tt.get("EXT_color_buffer_half_float")?tt.checkFramebufferStatus(tt.FRAMEBUFFER)===tt.FRAMEBUFFER_COMPLETE?tt.readPixels(e,r,i,n,g(h.format),g(h.type),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{s&&tt.bindFramebuffer(tt.FRAMEBUFFER,N)}}}},this.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),Tt.get("OES_texture_float")},this.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),Tt.get("OES_texture_half_float")},this.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),Tt.get("OES_standard_derivatives")},this.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),Tt.get("WEBGL_compressed_texture_s3tc")},this.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),Tt.get("WEBGL_compressed_texture_pvrtc")},this.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),Tt.get("EXT_blend_minmax")},this.supportsVertexTextures=function(){return gt.vertexTextures},this.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),Tt.get("ANGLE_instanced_arrays")},this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},this.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},this.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},this.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},Object.defineProperties(this,{shadowMapEnabled:{get:function(){return wt.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),wt.enabled=t}},shadowMapType:{get:function(){return wt.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),wt.type=t}},shadowMapCullFace:{get:function(){return wt.cullFace},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),wt.cullFace=t}},shadowMapDebug:{get:function(){return wt.debug},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapDebug is now .shadowMap.debug."),wt.debug=t}}})},THREE.WebGLRenderTarget=function(t,e,r){this.uuid=THREE.Math.generateUUID(),this.width=t,this.height=e,void 0===(r=r||{}).minFilter&&(r.minFilter=THREE.LinearFilter),this.texture=new THREE.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,this.stencilBuffer=void 0===r.stencilBuffer||r.stencilBuffer,this.shareDepthFrom=void 0!==r.shareDepthFrom?r.shareDepthFrom:null},THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,get wrapS(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set wrapS(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t},get wrapT(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set wrapT(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t},get magFilter(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set magFilter(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t},get minFilter(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set minFilter(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t},get anisotropy(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set anisotropy(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t},get offset(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set offset(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t},get repeat(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set repeat(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t},get format(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set format(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t},get type(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set type(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t},get generateMipmaps(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set generateMipmaps(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t},setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose())},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.shareDepthFrom=t.shareDepthFrom,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype),THREE.WebGLRenderTargetCube=function(t,e,r){THREE.WebGLRenderTarget.call(this,t,e,r),this.activeCubeFace=0},THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype),THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube,THREE.WebGLBufferRenderer=function(r,i,n){var o;this.setMode=function(t){o=t},this.render=function(t,e){r.drawArrays(o,t,e),n.calls++,n.vertices+=e,o===r.TRIANGLES&&(n.faces+=e/3)},this.renderInstances=function(t){var e,r=i.get("ANGLE_instanced_arrays");null===r?console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(e=t.attributes.position)instanceof THREE.InterleavedBufferAttribute?r.drawArraysInstancedANGLE(o,0,e.data.count,t.maxInstancedCount):r.drawArraysInstancedANGLE(o,0,e.count,t.maxInstancedCount)}},THREE.WebGLIndexedBufferRenderer=function(r,i,n){var o,a,s;this.setMode=function(t){o=t},this.setIndex=function(t){s=t.array instanceof Uint32Array&&i.get("OES_element_index_uint")?(a=r.UNSIGNED_INT,4):(a=r.UNSIGNED_SHORT,2)},this.render=function(t,e){r.drawElements(o,e,a,t*s),n.calls++,n.vertices+=e,o===r.TRIANGLES&&(n.faces+=e/3)},this.renderInstances=function(t){var e=i.get("ANGLE_instanced_arrays");null===e?console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):e.drawElementsInstancedANGLE(o,t.index.array.length,a,0,t.maxInstancedCount)}},THREE.WebGLExtensions=function(r){var i={};this.get=function(t){if(void 0!==i[t])return i[t];var e;switch(t){case"EXT_texture_filter_anisotropic":e=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":e=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":e=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:e=r.getExtension(t)}return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),i[t]=e}},THREE.WebGLCapabilities=function(e,t,r){function i(t){if("highp"===t){if(0<e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision&&0<e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision)return"highp";t="mediump"}return"mediump"===t&&0<e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision&&0<e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision?"mediump":"lowp"}this.getMaxPrecision=i,this.precision=void 0!==r.precision?r.precision:"highp",this.logarithmicDepthBuffer=void 0!==r.logarithmicDepthBuffer&&r.logarithmicDepthBuffer,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=0<this.maxVertexTextures,this.floatFragmentTextures=!!t.get("OES_texture_float"),this.floatVertexTextures=this.vertexTextures&&this.floatFragmentTextures,(r=i(this.precision))!==this.precision&&(console.warn("THREE.WebGLRenderer:",this.precision,"not supported, using",r,"instead."),this.precision=r),this.logarithmicDepthBuffer&&(this.logarithmicDepthBuffer=!!t.get("EXT_frag_depth"))},THREE.WebGLGeometries=function(r,i,n){function o(t){t=t.target;var e,r=s[t.id].attributes;for(e in r)a(r[e]);t.removeEventListener("dispose",o),delete s[t.id],(e=i.get(t)).wireframe&&a(e.wireframe),n.memory.geometries--}function a(t){var e=t instanceof THREE.InterleavedBufferAttribute?i.get(t.data).__webglBuffer:i.get(t).__webglBuffer;void 0!==e&&(r.deleteBuffer(e),t instanceof THREE.InterleavedBufferAttribute?i.delete(t.data):i.delete(t))}var s={};this.get=function(t){var e,r=t.geometry;return void 0!==s[r.id]?s[r.id]:(r.addEventListener("dispose",o),r instanceof THREE.BufferGeometry?e=r:r instanceof THREE.Geometry&&(void 0===r._bufferGeometry&&(r._bufferGeometry=(new THREE.BufferGeometry).setFromObject(t)),e=r._bufferGeometry),s[r.id]=e,n.memory.geometries++,e)}},THREE.WebGLObjects=function(u,l,t){function E(t,e){var r=t instanceof THREE.InterleavedBufferAttribute?t.data:t,i=l.get(r);void 0===i.__webglBuffer?(i.__webglBuffer=u.createBuffer(),u.bindBuffer(e,i.__webglBuffer),u.bufferData(e,r.array,r.dynamic?u.DYNAMIC_DRAW:u.STATIC_DRAW),i.version=r.version):i.version!==r.version&&(u.bindBuffer(e,i.__webglBuffer),!1===r.dynamic||-1===r.updateRange.count?u.bufferSubData(e,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."):(u.bufferSubData(e,r.updateRange.offset*r.array.BYTES_PER_ELEMENT,r.array.subarray(r.updateRange.offset,r.updateRange.offset+r.updateRange.count)),r.updateRange.count=0),i.version=r.version)}function p(t,e,r){var i;return r<e&&(i=e,e=r,r=i),void 0===(i=t[e])?t[e]=[r]:-1===i.indexOf(r)&&(i.push(r),1)}var a=new THREE.WebGLGeometries(u,l,t);this.getAttributeBuffer=function(t){return t instanceof THREE.InterleavedBufferAttribute?l.get(t.data).__webglBuffer:l.get(t).__webglBuffer},this.getWireframeAttribute=function(t){var e=l.get(t);if(void 0!==e.wireframe)return e.wireframe;var r=[],i=t.index;if(t=(n=t.attributes).position,null!==i)for(var n={},o=0,a=(i=i.array).length;o<a;o+=3){var s=i[o+0],h=i[o+1],c=i[o+2];p(n,s,h)&&r.push(s,h),p(n,h,c)&&r.push(h,c),p(n,c,s)&&r.push(c,s)}else for(o=0,a=(i=n.position.array).length/3-1;o<a;o+=3)s=o+0,h=o+1,c=o+2,r.push(s,h,h,c,c,s);return E(r=new THREE.BufferAttribute(new(65535<t.count?Uint32Array:Uint16Array)(r),1),u.ELEMENT_ARRAY_BUFFER),e.wireframe=r},this.update=function(t){var e=a.get(t);t.geometry instanceof THREE.Geometry&&e.updateFromObject(t),t=e.index;var r,i=e.attributes;for(r in null!==t&&E(t,u.ELEMENT_ARRAY_BUFFER),i)E(i[r],u.ARRAY_BUFFER);for(r in t=e.morphAttributes)for(var n=0,o=(i=t[r]).length;n<o;n++)E(i[n],u.ARRAY_BUFFER);return e}},THREE.WebGLProgram=function(){function T(t){return""!==t}var g=0;return function(t,e,r,i){var a=t.context,n=r.defines,o=r.__webglShader.vertexShader,s=r.__webglShader.fragmentShader,h="SHADOWMAP_TYPE_BASIC";i.shadowMapType===THREE.PCFShadowMap?h="SHADOWMAP_TYPE_PCF":i.shadowMapType===THREE.PCFSoftShadowMap&&(h="SHADOWMAP_TYPE_PCF_SOFT");var c="ENVMAP_TYPE_CUBE",u="ENVMAP_MODE_REFLECTION",l="ENVMAP_BLENDING_MULTIPLY";if(i.envMap){switch(r.envMap.mapping){case THREE.CubeReflectionMapping:case THREE.CubeRefractionMapping:c="ENVMAP_TYPE_CUBE";break;case THREE.EquirectangularReflectionMapping:case THREE.EquirectangularRefractionMapping:c="ENVMAP_TYPE_EQUIREC";break;case THREE.SphericalReflectionMapping:c="ENVMAP_TYPE_SPHERE"}switch(r.envMap.mapping){case THREE.CubeRefractionMapping:case THREE.EquirectangularRefractionMapping:u="ENVMAP_MODE_REFRACTION"}switch(r.combine){case THREE.MultiplyOperation:l="ENVMAP_BLENDING_MULTIPLY";break;case THREE.MixOperation:l="ENVMAP_BLENDING_MIX";break;case THREE.AddOperation:l="ENVMAP_BLENDING_ADD"}}var E,p,d=0<t.gammaFactor?t.gammaFactor:1,f=function(t){var e,r=[];for(e in t){var i=t[e];!1!==i&&r.push("#define "+e+" "+i)}return r.join("\n")}(n),m=a.createProgram(),s=(t=r instanceof THREE.RawShaderMaterial?n="":(n=["precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+r.__webglShader.name,f,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"",t.gammaInput?"#define GAMMA_INPUT":"",t.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+d,"#define MAX_DIR_LIGHTS "+i.maxDirLights,"#define MAX_POINT_LIGHTS "+i.maxPointLights,"#define MAX_SPOT_LIGHTS "+i.maxSpotLights,"#define MAX_HEMI_LIGHTS "+i.maxHemiLights,"#define MAX_SHADOWS "+i.maxShadows,"#define MAX_BONES "+i.maxBones,i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+u:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+h:"",i.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",0<i.pointLightShadows?"#define POINT_LIGHT_SHADOWS":"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.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","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(T).join("\n"),[i.bumpMap||i.normalMap||i.flatShading||r.derivatives?"#extension GL_OES_standard_derivatives : enable":"",i.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"","precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+r.__webglShader.name,f,"#define MAX_DIR_LIGHTS "+i.maxDirLights,"#define MAX_POINT_LIGHTS "+i.maxPointLights,"#define MAX_SPOT_LIGHTS "+i.maxSpotLights,"#define MAX_HEMI_LIGHTS "+i.maxHemiLights,"#define MAX_SHADOWS "+i.maxShadows,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"",t.gammaInput?"#define GAMMA_INPUT":"",t.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+d,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+c:"",i.envMap?"#define "+u:"",i.envMap?"#define "+l:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.flatShading?"#define FLAT_SHADED":"",i.metal?"#define METAL":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+h:"",i.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",0<i.pointLightShadows?"#define POINT_LIGHT_SHADOWS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","\n"].filter(T).join("\n")))+s,o=THREE.WebGLShader(a,a.VERTEX_SHADER,n+o);return s=THREE.WebGLShader(a,a.FRAGMENT_SHADER,s),a.attachShader(m,o),a.attachShader(m,s),void 0!==r.index0AttributeName?a.bindAttribLocation(m,0,r.index0AttributeName):!0===i.morphTargets&&a.bindAttribLocation(m,0,"position"),a.linkProgram(m),i=a.getProgramInfoLog(m),h=a.getShaderInfoLog(o),c=a.getShaderInfoLog(s),!(l=u=!0)===a.getProgramParameter(m,a.LINK_STATUS)?(u=!1,console.error("THREE.WebGLProgram: shader error: ",a.getError(),"gl.VALIDATE_STATUS",a.getProgramParameter(m,a.VALIDATE_STATUS),"gl.getProgramInfoLog",i,h,c)):""!==i?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",i):""!==h&&""!==c||(l=!1),l&&(this.diagnostics={runnable:u,material:r,programLog:i,vertexShader:{log:h,prefix:n},fragmentShader:{log:c,prefix:t}}),a.deleteShader(o),a.deleteShader(s),this.getUniforms=function(){if(void 0===E){for(var t={},e=a.getProgramParameter(m,a.ACTIVE_UNIFORMS),r=0;r<e;r++){var i=a.getActiveUniform(m,r).name,n=a.getUniformLocation(m,i),o=i.lastIndexOf("[0]");-1!==o&&o===i.length-3&&(t[i.substr(0,o)]=n),t[i]=n}E=t}return E},this.getAttributes=function(){if(void 0===p){for(var t={},e=a.getProgramParameter(m,a.ACTIVE_ATTRIBUTES),r=0;r<e;r++){var i=a.getActiveAttrib(m,r).name;t[i]=a.getAttribLocation(m,i)}p=t}return p},this.destroy=function(){a.deleteProgram(m),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=g++,this.code=e,this.usedTimes=1,this.program=m,this.vertexShader=o,this.fragmentShader=s,this}}(),THREE.WebGLPrograms=function(d,f){var s=[],m={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},o="precision supportsVertexTextures map envMap envMapMode lightMap aoMap emissiveMap bumpMap normalMap displacementMap specularMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals maxDirLights maxPointLights maxSpotLights maxHemiLights maxShadows shadowMapEnabled pointLightShadows shadowMapType shadowMapDebug alphaTest metal doubleSided flipSided".split(" ");this.getParameters=function(t,e,r,i){for(var n,o,a,s,h=m[t.type],c=s=a=o=n=0,u=e.length;c<u;c++){!1!==(l=e[c]).visible&&(l instanceof THREE.DirectionalLight&&n++,l instanceof THREE.PointLight&&o++,l instanceof THREE.SpotLight&&a++,l instanceof THREE.HemisphereLight&&s++)}for(var l=c=u=0,E=e.length;l<E;l++){var p=e[l];p.castShadow&&((p instanceof THREE.SpotLight||p instanceof THREE.DirectionalLight)&&u++,p instanceof THREE.PointLight&&(u++,c++))}return e=u,f.floatVertexTextures&&i&&i.skeleton&&i.skeleton.useVertexTexture?u=1024:(u=Math.floor((f.maxVertexUniforms-20)/4),void 0!==i&&i instanceof THREE.SkinnedMesh&&((u=Math.min(i.skeleton.bones.length,u))<i.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+i.skeleton.bones.length+", this GPU supports just "+u+" (try OpenGL instead of ANGLE)"))),l=d.getPrecision(),null!==t.precision&&((l=f.getMaxPrecision(t.precision))!==t.precision&&console.warn("THREE.WebGLRenderer.initMaterial:",t.precision,"not supported, using",l,"instead.")),{shaderID:h,precision:l,supportsVertexTextures:f.vertexTextures,map:!!t.map,envMap:!!t.envMap,envMapMode:t.envMap&&t.envMap.mapping,lightMap:!!t.lightMap,aoMap:!!t.aoMap,emissiveMap:!!t.emissiveMap,bumpMap:!!t.bumpMap,normalMap:!!t.normalMap,displacementMap:!!t.displacementMap,specularMap:!!t.specularMap,alphaMap:!!t.alphaMap,combine:t.combine,vertexColors:t.vertexColors,fog:r,useFog:t.fog,fogExp:r instanceof THREE.FogExp2,flatShading:t.shading===THREE.FlatShading,sizeAttenuation:t.sizeAttenuation,logarithmicDepthBuffer:f.logarithmicDepthBuffer,skinning:t.skinning,maxBones:u,useVertexTexture:f.floatVertexTextures&&i&&i.skeleton&&i.skeleton.useVertexTexture,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:d.maxMorphTargets,maxMorphNormals:d.maxMorphNormals,maxDirLights:n,maxPointLights:o,maxSpotLights:a,maxHemiLights:s,maxShadows:e,pointLightShadows:c,shadowMapEnabled:d.shadowMap.enabled&&i.receiveShadow&&0<e,shadowMapType:d.shadowMap.type,shadowMapDebug:d.shadowMap.debug,alphaTest:t.alphaTest,metal:t.metal,doubleSided:t.side===THREE.DoubleSide,flipSided:t.side===THREE.BackSide}},this.getProgramCode=function(t,e){var r=[];if(e.shaderID?r.push(e.shaderID):(r.push(t.fragmentShader),r.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)r.push(i),r.push(t.defines[i]);for(i=0;i<o.length;i++){var n=o[i];r.push(n),r.push(e[n])}return r.join()},this.acquireProgram=function(t,e,r){for(var i,n=0,o=s.length;n<o;n++){var a=s[n];if(a.code===r){++(i=a).usedTimes;break}}return void 0===i&&(i=new THREE.WebGLProgram(d,r,t,e),s.push(i)),i},this.releaseProgram=function(t){var e;0==--t.usedTimes&&(e=s.indexOf(t),s[e]=s[s.length-1],s.pop(),t.destroy())},this.programs=s},THREE.WebGLProperties=function(){var r={};this.get=function(t){t=t.uuid;var e=r[t];return void 0===e&&(e={},r[t]=e),e},this.delete=function(t){delete r[t.uuid]},this.clear=function(){r={}}},THREE.WebGLShader=function(t,e,r){var i=t.createShader(e);return t.shaderSource(i,r),t.compileShader(i),!1===t.getShaderParameter(i,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(i)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(i),function(t){t=t.split("\n");for(var e=0;e<t.length;e++)t[e]=e+1+": "+t[e];return t.join("\n")}(r)),i},THREE.WebGLShadowMap=function(y,R,v){function H(t,e,r,i){var n=t.geometry,o=null,o=s,a=t.customDepthMaterial;return r&&(o=h,a=t.customDistanceMaterial),(o=a||(t=t instanceof THREE.SkinnedMesh&&e.skinning,void(a=0)!==n.morphTargets&&0<n.morphTargets.length&&e.morphTargets&&(a|=1),t&&(a|=2),o[a])).visible=e.visible,o.wireframe=e.wireframe,o.wireframeLinewidth=e.wireframeLinewidth,r&&void 0!==o.uniforms.lightPos&&o.uniforms.lightPos.value.copy(i),o}var x=y.context,b=y.state,w=new THREE.Frustum,M=new THREE.Matrix4;new THREE.Vector3,new THREE.Vector3;for(var S=new THREE.Vector3,_=new THREE.Vector3,A=[],s=Array(4),h=Array(4),C=[new THREE.Vector3(1,0,0),new THREE.Vector3(-1,0,0),new THREE.Vector3(0,0,1),new THREE.Vector3(0,0,-1),new THREE.Vector3(0,1,0),new THREE.Vector3(0,-1,0)],L=[new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,0,1),new THREE.Vector3(0,0,-1)],P=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,t=THREE.ShaderLib.depthRGBA,e=THREE.UniformsUtils.clone(t.uniforms),r=THREE.ShaderLib.distanceRGBA,i=THREE.UniformsUtils.clone(r.uniforms),n=0;4!==n;++n){var o=0!=(1&n),a=0!=(2&n),c=new THREE.ShaderMaterial({uniforms:e,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,morphTargets:o,skinning:a});c._shadowPass=!0,s[n]=c,(o=new THREE.ShaderMaterial({uniforms:i,vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,morphTargets:o,skinning:a}))._shadowPass=!0,h[n]=o}var k=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=THREE.PCFShadowMap,this.cullFace=THREE.CullFaceFront,this.render=function(t){var e,r;if(!1!==k.enabled&&(!1!==k.autoUpdate||!1!==k.needsUpdate)){x.clearColor(1,1,1,1),b.disable(x.BLEND),b.enable(x.CULL_FACE),x.frontFace(x.CCW),x.cullFace(k.cullFace===THREE.CullFaceFront?x.FRONT:x.BACK),b.setDepthTest(!0),y.getViewport(D);for(var i=0,n=R.length;i<n;i++){var o=R[i];if(!0===o.castShadow){var a,s,h=o.shadow,c=h.camera,u=h.mapSize;for(o instanceof THREE.PointLight?(e=6,r=!0,a=u.x/4,s=u.y/2,P[0].set(2*a,s,a,s),P[1].set(0,s,a,s),P[2].set(3*a,s,a,s),P[3].set(a,s,a,s),P[4].set(3*a,0,a,s),P[5].set(a,0,a,s)):r=!(e=1),null===h.map&&(a=THREE.LinearFilter,k.type===THREE.PCFSoftShadowMap&&(a=THREE.NearestFilter),h.map=new THREE.WebGLRenderTarget(u.x,u.y,{minFilter:a,magFilter:a,format:THREE.RGBAFormat}),h.matrix=new THREE.Matrix4,o instanceof THREE.SpotLight&&(c.aspect=u.x/u.y),c.updateProjectionMatrix()),u=h.map,h=h.matrix,_.setFromMatrixPosition(o.matrixWorld),c.position.copy(_),y.setRenderTarget(u),y.clear(),u=0;u<e;u++)for(r?(S.copy(c.position),S.add(C[u]),c.up.copy(L[u]),c.lookAt(S),a=P[u],y.setViewport(a.x,a.y,a.z,a.w)):(S.setFromMatrixPosition(o.target.matrixWorld),c.lookAt(S)),c.updateMatrixWorld(),c.matrixWorldInverse.getInverse(c.matrixWorld),h.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),h.multiply(c.projectionMatrix),h.multiply(c.matrixWorldInverse),M.multiplyMatrices(c.projectionMatrix,c.matrixWorldInverse),w.setFromMatrix(M),A.length=0,function t(e,r){if(!1!==e.visible){(e instanceof THREE.Mesh||e instanceof THREE.Line||e instanceof THREE.Points)&&e.castShadow&&(!1===e.frustumCulled||!0===w.intersectsObject(e))&&!0===e.material.visible&&(e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),A.push(e));for(var i=e.children,n=0,o=i.length;n<o;n++)t(i[n],r)}}(t,c),a=0,s=A.length;a<s;a++){var l=A[a],E=v.update(l);if((d=l.material)instanceof THREE.MeshFaceMaterial)for(var p=E.groups,d=d.materials,f=0,m=p.length;f<m;f++){var T=p[f],g=d[T.materialIndex];!0===g.visible&&(g=H(l,g,r,_),y.renderBufferDirect(c,R,null,E,g,l,T))}else g=H(l,d,r,_),y.renderBufferDirect(c,R,null,E,g,l,null)}y.resetGLState()}}y.setViewport(D.x,D.y,D.z,D.w),t=y.getClearColor(),e=y.getClearAlpha(),y.setClearColor(t,e),b.enable(x.BLEND),k.cullFace===THREE.CullFaceFront&&x.cullFace(x.BACK),y.resetGLState(),k.needsUpdate=!1}}},THREE.WebGLState=function(s,r,h){var i=this,n=new Uint8Array(16),o=new Uint8Array(16),a=new Uint8Array(16),e={},c=null,u=null,l=null,E=null,p=null,d=null,f=null,m=null,T=null,g=null,y=null,R=null,v=null,H=null,x=null,b=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),w=void 0,M={};this.init=function(){s.clearColor(0,0,0,1),s.clearDepth(1),s.clearStencil(0),this.enable(s.DEPTH_TEST),s.depthFunc(s.LEQUAL),s.frontFace(s.CCW),s.cullFace(s.BACK),this.enable(s.CULL_FACE),this.enable(s.BLEND),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA)},this.initAttributes=function(){for(var t=0,e=n.length;t<e;t++)n[t]=0},this.enableAttribute=function(t){n[t]=1,0===o[t]&&(s.enableVertexAttribArray(t),o[t]=1),0!==a[t]&&(r.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(t,0),a[t]=0)},this.enableAttributeAndDivisor=function(t,e,r){n[t]=1,0===o[t]&&(s.enableVertexAttribArray(t),o[t]=1),a[t]!==e&&(r.vertexAttribDivisorANGLE(t,e),a[t]=e)},this.disableUnusedAttributes=function(){for(var t=0,e=o.length;t<e;t++)o[t]!==n[t]&&(s.disableVertexAttribArray(t),o[t]=0)},this.enable=function(t){!0!==e[t]&&(s.enable(t),e[t]=!0)},this.disable=function(t){!1!==e[t]&&(s.disable(t),e[t]=!1)},this.getCompressedTextureFormats=function(){if(null===c&&(c=[],r.get("WEBGL_compressed_texture_pvrtc")||r.get("WEBGL_compressed_texture_s3tc")))for(var t=s.getParameter(s.COMPRESSED_TEXTURE_FORMATS),e=0;e<t.length;e++)c.push(t[e]);return c},this.setBlending=function(t,e,r,i,n,o,a){t!==u&&(t===THREE.NoBlending?this.disable(s.BLEND):t===THREE.AdditiveBlending?(this.enable(s.BLEND),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.SRC_ALPHA,s.ONE)):t===THREE.SubtractiveBlending?(this.enable(s.BLEND),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ZERO,s.ONE_MINUS_SRC_COLOR)):t===THREE.MultiplyBlending?(this.enable(s.BLEND),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ZERO,s.SRC_COLOR)):t===THREE.CustomBlending?this.enable(s.BLEND):(this.enable(s.BLEND),s.blendEquationSeparate(s.FUNC_ADD,s.FUNC_ADD),s.blendFuncSeparate(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA)),u=t),t===THREE.CustomBlending?(n=n||e,o=o||r,a=a||i,e===l&&n===d||(s.blendEquationSeparate(h(e),h(n)),l=e,d=n),r===E&&i===p&&o===f&&a===m||(s.blendFuncSeparate(h(r),h(i),h(o),h(a)),E=r,p=i,f=o,m=a)):m=f=d=p=E=l=null},this.setDepthFunc=function(t){if(T!==t){if(t)switch(t){case THREE.NeverDepth:s.depthFunc(s.NEVER);break;case THREE.AlwaysDepth:s.depthFunc(s.ALWAYS);break;case THREE.LessDepth:s.depthFunc(s.LESS);break;case THREE.LessEqualDepth:s.depthFunc(s.LEQUAL);break;case THREE.EqualDepth:s.depthFunc(s.EQUAL);break;case THREE.GreaterEqualDepth:s.depthFunc(s.GEQUAL);break;case THREE.GreaterDepth:s.depthFunc(s.GREATER);break;case THREE.NotEqualDepth:s.depthFunc(s.NOTEQUAL);break;default:s.depthFunc(s.LEQUAL)}else s.depthFunc(s.LEQUAL);T=t}},this.setDepthTest=function(t){t?this.enable(s.DEPTH_TEST):this.disable(s.DEPTH_TEST)},this.setDepthWrite=function(t){g!==t&&(s.depthMask(t),g=t)},this.setColorWrite=function(t){y!==t&&(s.colorMask(t,t,t,t),y=t)},this.setFlipSided=function(t){R!==t&&(t?s.frontFace(s.CW):s.frontFace(s.CCW),R=t)},this.setLineWidth=function(t){t!==v&&(s.lineWidth(t),v=t)},this.setPolygonOffset=function(t,e,r){t?this.enable(s.POLYGON_OFFSET_FILL):this.disable(s.POLYGON_OFFSET_FILL),!t||H===e&&x===r||(s.polygonOffset(e,r),H=e,x=r)},this.setScissorTest=function(t){t?this.enable(s.SCISSOR_TEST):this.disable(s.SCISSOR_TEST)},this.activeTexture=function(t){void 0===t&&(t=s.TEXTURE0+b-1),w!==t&&(s.activeTexture(t),w=t)},this.bindTexture=function(t,e){void 0===w&&i.activeTexture();var r=M[w];void 0===r&&(r={type:void 0,texture:void 0},M[w]=r),r.type===t&&r.texture===e||(s.bindTexture(t,e),r.type=t,r.texture=e)},this.compressedTexImage2D=function(){try{s.compressedTexImage2D.apply(s,arguments)}catch(t){console.error(t)}},this.texImage2D=function(){try{s.texImage2D.apply(s,arguments)}catch(t){console.error(t)}},this.reset=function(){for(var t=0;t<o.length;t++)1===o[t]&&(s.disableVertexAttribArray(t),o[t]=0);e={},R=y=g=u=c=null}},THREE.LensFlarePlugin=function(T,g){var y,R,v,H,x,b,w,M,S,_,A,C,L,P,D,k,V=T.context,F=T.state;this.render=function(t,e,r,i){if(0!==g.length){t=new THREE.Vector3;var n,o,a,s=i/r,h=.5*r,c=.5*i,u=16/i,l=new THREE.Vector2(u*s,u),E=new THREE.Vector3(1,1,0),p=new THREE.Vector2(1,1);for(void 0===L&&(u=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),n=new Uint16Array([0,1,2,0,2,3]),A=V.createBuffer(),C=V.createBuffer(),V.bindBuffer(V.ARRAY_BUFFER,A),V.bufferData(V.ARRAY_BUFFER,u,V.STATIC_DRAW),V.bindBuffer(V.ELEMENT_ARRAY_BUFFER,C),V.bufferData(V.ELEMENT_ARRAY_BUFFER,n,V.STATIC_DRAW),D=V.createTexture(),k=V.createTexture(),F.bindTexture(V.TEXTURE_2D,D),V.texImage2D(V.TEXTURE_2D,0,V.RGB,16,16,0,V.RGB,V.UNSIGNED_BYTE,null),V.texParameteri(V.TEXTURE_2D,V.TEXTURE_WRAP_S,V.CLAMP_TO_EDGE),V.texParameteri(V.TEXTURE_2D,V.TEXTURE_WRAP_T,V.CLAMP_TO_EDGE),V.texParameteri(V.TEXTURE_2D,V.TEXTURE_MAG_FILTER,V.NEAREST),V.texParameteri(V.TEXTURE_2D,V.TEXTURE_MIN_FILTER,V.NEAREST),F.bindTexture(V.TEXTURE_2D,k),V.texImage2D(V.TEXTURE_2D,0,V.RGBA,16,16,0,V.RGBA,V.UNSIGNED_BYTE,null),V.texParameteri(V.TEXTURE_2D,V.TEXTURE_WRAP_S,V.CLAMP_TO_EDGE),V.texParameteri(V.TEXTURE_2D,V.TEXTURE_WRAP_T,V.CLAMP_TO_EDGE),V.texParameteri(V.TEXTURE_2D,V.TEXTURE_MAG_FILTER,V.NEAREST),V.texParameteri(V.TEXTURE_2D,V.TEXTURE_MIN_FILTER,V.NEAREST),u=(P=0<V.getParameter(V.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *= visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},n=V.createProgram(),o=V.createShader(V.FRAGMENT_SHADER),a=V.createShader(V.VERTEX_SHADER),d="precision "+T.getPrecision()+" float;\n",V.shaderSource(o,d+u.fragmentShader),V.shaderSource(a,d+u.vertexShader),V.compileShader(o),V.compileShader(a),V.attachShader(n,o),V.attachShader(n,a),V.linkProgram(n),L=n,S=V.getAttribLocation(L,"position"),_=V.getAttribLocation(L,"uv"),y=V.getUniformLocation(L,"renderType"),R=V.getUniformLocation(L,"map"),v=V.getUniformLocation(L,"occlusionMap"),H=V.getUniformLocation(L,"opacity"),x=V.getUniformLocation(L,"color"),b=V.getUniformLocation(L,"scale"),w=V.getUniformLocation(L,"rotation"),M=V.getUniformLocation(L,"screenPosition")),V.useProgram(L),F.initAttributes(),F.enableAttribute(S),F.enableAttribute(_),F.disableUnusedAttributes(),V.uniform1i(v,0),V.uniform1i(R,1),V.bindBuffer(V.ARRAY_BUFFER,A),V.vertexAttribPointer(S,2,V.FLOAT,!1,16,0),V.vertexAttribPointer(_,2,V.FLOAT,!1,16,8),V.bindBuffer(V.ELEMENT_ARRAY_BUFFER,C),F.disable(V.CULL_FACE),V.depthMask(!1),n=0,o=g.length;n<o;n++)if(u=16/i,l.set(u*s,u),a=g[n],t.set(a.matrixWorld.elements[12],a.matrixWorld.elements[13],a.matrixWorld.elements[14]),t.applyMatrix4(e.matrixWorldInverse),t.applyProjection(e.projectionMatrix),E.copy(t),p.x=E.x*h+h,p.y=E.y*c+c,P||0<p.x&&p.x<r&&0<p.y&&p.y<i){F.activeTexture(V.TEXTURE0),F.bindTexture(V.TEXTURE_2D,null),F.activeTexture(V.TEXTURE1),F.bindTexture(V.TEXTURE_2D,D),V.copyTexImage2D(V.TEXTURE_2D,0,V.RGB,p.x-8,p.y-8,16,16,0),V.uniform1i(y,0),V.uniform2f(b,l.x,l.y),V.uniform3f(M,E.x,E.y,E.z),F.disable(V.BLEND),F.enable(V.DEPTH_TEST),V.drawElements(V.TRIANGLES,6,V.UNSIGNED_SHORT,0),F.activeTexture(V.TEXTURE0),F.bindTexture(V.TEXTURE_2D,k),V.copyTexImage2D(V.TEXTURE_2D,0,V.RGBA,p.x-8,p.y-8,16,16,0),V.uniform1i(y,1),F.disable(V.DEPTH_TEST),F.activeTexture(V.TEXTURE1),F.bindTexture(V.TEXTURE_2D,D),V.drawElements(V.TRIANGLES,6,V.UNSIGNED_SHORT,0),a.positionScreen.copy(E),a.customUpdateCallback?a.customUpdateCallback(a):a.updateLensFlares(),V.uniform1i(y,2),F.enable(V.BLEND);for(var d=0,f=a.lensFlares.length;d<f;d++){var m=a.lensFlares[d];.001<m.opacity&&.001<m.scale&&(E.x=m.x,E.y=m.y,E.z=m.z,u=m.size*m.scale/i,l.x=u*s,l.y=u,V.uniform3f(M,E.x,E.y,E.z),V.uniform2f(b,l.x,l.y),V.uniform1f(w,m.rotation),V.uniform1f(H,m.opacity),V.uniform3f(x,m.color.r,m.color.g,m.color.b),F.setBlending(m.blending,m.blendEquation,m.blendSrc,m.blendDst),T.setTexture(m.texture,1),V.drawElements(V.TRIANGLES,6,V.UNSIGNED_SHORT,0))}}F.enable(V.CULL_FACE),F.enable(V.DEPTH_TEST),V.depthMask(!0),T.resetGLState()}}},THREE.SpritePlugin=function(c,u){var l,E,p,d,f,m,T,g,y,R,v,H,x,b,w,M,S;function _(t,e){return t.z!==e.z?e.z-t.z:e.id-t.id}var A,C,L,P,D=c.context,k=c.state,V=new THREE.Vector3,F=new THREE.Quaternion,U=new THREE.Vector3;this.render=function(t,e){if(0!==u.length){var r,i;void 0===L&&(r=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),i=new Uint16Array([0,1,2,0,2,3]),A=D.createBuffer(),C=D.createBuffer(),D.bindBuffer(D.ARRAY_BUFFER,A),D.bufferData(D.ARRAY_BUFFER,r,D.STATIC_DRAW),D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,C),D.bufferData(D.ELEMENT_ARRAY_BUFFER,i,D.STATIC_DRAW),r=D.createProgram(),i=D.createShader(D.VERTEX_SHADER),n=D.createShader(D.FRAGMENT_SHADER),D.shaderSource(i,["precision "+c.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n")),D.shaderSource(n,["precision "+c.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")),D.compileShader(i),D.compileShader(n),D.attachShader(r,i),D.attachShader(r,n),D.linkProgram(r),L=r,M=D.getAttribLocation(L,"position"),S=D.getAttribLocation(L,"uv"),l=D.getUniformLocation(L,"uvOffset"),E=D.getUniformLocation(L,"uvScale"),p=D.getUniformLocation(L,"rotation"),d=D.getUniformLocation(L,"scale"),f=D.getUniformLocation(L,"color"),m=D.getUniformLocation(L,"map"),T=D.getUniformLocation(L,"opacity"),g=D.getUniformLocation(L,"modelViewMatrix"),y=D.getUniformLocation(L,"projectionMatrix"),R=D.getUniformLocation(L,"fogType"),v=D.getUniformLocation(L,"fogDensity"),H=D.getUniformLocation(L,"fogNear"),x=D.getUniformLocation(L,"fogFar"),b=D.getUniformLocation(L,"fogColor"),w=D.getUniformLocation(L,"alphaTest"),(r=document.createElement("canvas")).width=8,r.height=8,(i=r.getContext("2d")).fillStyle="white",i.fillRect(0,0,8,8),(P=new THREE.Texture(r)).needsUpdate=!0),D.useProgram(L),k.initAttributes(),k.enableAttribute(M),k.enableAttribute(S),k.disableUnusedAttributes(),k.disable(D.CULL_FACE),k.enable(D.BLEND),D.bindBuffer(D.ARRAY_BUFFER,A),D.vertexAttribPointer(M,2,D.FLOAT,!1,16,0),D.vertexAttribPointer(S,2,D.FLOAT,!1,16,8),D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,C),D.uniformMatrix4fv(y,!1,e.projectionMatrix.elements),k.activeTexture(D.TEXTURE0),D.uniform1i(m,0),i=r=0,(n=t.fog)?(D.uniform3f(b,n.color.r,n.color.g,n.color.b),n instanceof THREE.Fog?(D.uniform1f(H,n.near),D.uniform1f(x,n.far),D.uniform1i(R,1),i=r=1):n instanceof THREE.FogExp2&&(D.uniform1f(v,n.density),D.uniform1i(R,2),i=r=2)):(D.uniform1i(R,0),i=r=0);for(var n=0,o=u.length;n<o;n++){(s=u[n]).modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,s.matrixWorld),s.z=-s.modelViewMatrix.elements[14]}u.sort(_);for(var a=[],n=0,o=u.length;n<o;n++){var s,h=(s=u[n]).material;D.uniform1f(w,h.alphaTest),D.uniformMatrix4fv(g,!1,s.modelViewMatrix.elements),s.matrixWorld.decompose(V,F,U),a[0]=U.x,a[1]=U.y,s=0,t.fog&&h.fog&&(s=i),r!==s&&(D.uniform1i(R,s),r=s),null!==h.map?(D.uniform2f(l,h.map.offset.x,h.map.offset.y),D.uniform2f(E,h.map.repeat.x,h.map.repeat.y)):(D.uniform2f(l,0,0),D.uniform2f(E,1,1)),D.uniform1f(T,h.opacity),D.uniform3f(f,h.color.r,h.color.g,h.color.b),D.uniform1f(p,h.rotation),D.uniform2fv(d,a),k.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst),k.setDepthTest(h.depthTest),k.setDepthWrite(h.depthWrite),h.map&&h.map.image&&h.map.image.width?c.setTexture(h.map,0):c.setTexture(P,0),D.drawElements(D.TRIANGLES,6,D.UNSIGNED_SHORT,0)}k.enable(D.CULL_FACE),c.resetGLState()}}},THREE.CurveUtils={tangentQuadraticBezier:function(t,e,r,i){return 2*(1-t)*(r-e)+2*t*(i-r)},tangentCubicBezier:function(t,e,r,i,n){return-3*e*(1-t)*(1-t)+3*r*(1-t)*(1-t)-6*t*r*(1-t)+6*t*i*(1-t)-3*t*t*i+3*t*t*n},tangentSpline:function(t){return 6*t*t-6*t+(3*t*t-4*t+1)+(-6*t*t+6*t)+(3*t*t-2*t)},interpolate:function(t,e,r,i,n){var o=n*n;return(2*e-2*r+(t=.5*(r-t))+(i=.5*(i-e)))*n*o+(-3*e+3*r-2*t-i)*o+t*n+e}},THREE.GeometryUtils={merge:function(t,e,r){var i;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),e instanceof THREE.Mesh&&(e.matrixAutoUpdate&&e.updateMatrix(),i=e.matrix,e=e.geometry),t.merge(e,i,r)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}},THREE.ImageUtils={crossOrigin:void 0,loadTexture:function(t,e,r,i){console.warn("THREE.ImageUtils.loadTexture is being deprecated. Use THREE.TextureLoader() instead.");var n=new THREE.TextureLoader;return n.setCrossOrigin(this.crossOrigin),t=n.load(t,r,void 0,i),e&&(t.mapping=e),t},loadTextureCube:function(t,e,r,i){console.warn("THREE.ImageUtils.loadTextureCube is being deprecated. Use THREE.CubeTextureLoader() instead.");var n=new THREE.CubeTextureLoader;return n.setCrossOrigin(this.crossOrigin),t=n.load(t,r,void 0,i),e&&(t.mapping=e),t},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.")}},THREE.SceneUtils={createMultiMaterialObject:function(t,e){for(var r=new THREE.Group,i=0,n=e.length;i<n;i++)r.add(new THREE.Mesh(t,e[i]));return r},detach:function(t,e,r){t.applyMatrix(e.matrixWorld),e.remove(t),r.add(t)},attach:function(t,e,r){var i=new THREE.Matrix4;i.getInverse(r.matrixWorld),t.applyMatrix(i),e.remove(t),r.add(t)}},THREE.ShapeUtils={area:function(t){for(var e=t.length,r=0,i=e-1,n=0;n<e;i=n++)r+=t[i].x*t[n].y-t[n].x*t[i].y;return.5*r},triangulate:function(t,e){var r=t.length;if(r<3)return null;var i,n=[],o=[],a=[];if(0<THREE.ShapeUtils.area(t))for(c=0;c<r;c++)o[c]=c;else for(c=0;c<r;c++)o[c]=r-1-c;for(var s,h=2*r,c=r-1;2<r;){if(h--<=0){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}r<=(s=c)&&(s=0),r<=(c=s+1)&&(c=0),r<=(i=c+1)&&(i=0);t:{var u=_=void 0,l=void 0,E=void 0,u=t[o[s]].x,p=t[o[s]].y,d=t[o[c]].x,f=t[o[c]].y,m=t[o[i]].x,T=t[o[i]].y;if(Number.EPSILON>(d-u)*(T-p)-(f-p)*(m-u))_=!1;else{for(var g,y,R,v=E=l=void 0,H=m-d,x=T-f,b=u-m,w=p-T,M=d-u,S=f-p,_=0;_<r;_++)if(l=t[o[_]].x,E=t[o[_]].y,!(l===u&&E===p||l===d&&E===f||l===m&&E===T)&&(v=l-d,R=E-f,g=M*(E-p)-S*(l-u),y=b*(E-=T)-w*(l-=m),H*R-x*v>=-Number.EPSILON&&y>=-Number.EPSILON&&g>=-Number.EPSILON)){_=!1;break t}_=!0}}if(_){for(n.push([t[o[s]],t[o[c]],t[o[i]]]),a.push([o[s],o[c],o[i]]),i=(s=c)+1;i<r;s++,i++)o[s]=o[i];h=2*--r}}return e?a:n},triangulateShape:function(f,t){function p(t,e,r){return t.x!==e.x?t.x<e.x?t.x<=r.x&&r.x<=e.x:e.x<=r.x&&r.x<=t.x:t.y<e.y?t.y<=r.y&&r.y<=e.y:e.y<=r.y&&r.y<=t.y}function m(t,e,r,i,n){var o=e.x-t.x,a=e.y-t.y,s=i.x-r.x,h=i.y-r.y,c=t.x-r.x,u=t.y-r.y,l=a*s-o*h,E=a*c-o*u;if(Math.abs(l)>Number.EPSILON){if(0<l){if(E<0||l<E)return[];if((s=h*c-s*u)<0||l<s)return[]}else{if(0<E||E<l)return[];if(0<(s=h*c-s*u)||s<l)return[]}return 0===s?!n||0!=E&&E!==l?[t]:[]:s===l?!n||0!=E&&E!==l?[e]:[]:0==E?[r]:E===l?[i]:(n=s/l,[{x:t.x+n*o,y:t.y+n*a}])}return 0!=E||h*c!=s*u?[]:(s=0===s&&0===h,(a=0===o&&0===a)&&s?t.x!==r.x||t.y!==r.y?[]:[t]:a?p(r,i,t)?[t]:[]:s?p(t,e,r)?[r]:[]:(r=0!==o?(t=t.x<e.x?(s=(o=t).x,(a=e).x):(s=(o=e).x,(a=t).x),r.x<i.x?(l=(e=r).x,(h=i).x):(l=(e=i).x,(h=r).x)):(t=t.y<e.y?(s=(o=t).y,(a=e).y):(s=(o=e).y,(a=t).y),r.y<i.y?(l=(e=r).y,(h=i).y):(l=(e=i).y,(h=r).y)),s<=l?t<l?[]:t===l?n?[]:[e]:t<=r?[e,a]:[e,h]:r<s?[]:s===r?n?[]:[o]:t<=r?[o,a]:[o,h]))}function T(t,e,r,i){var n=e.x-t.x,o=e.y-t.y;e=r.x-t.x,r=r.y-t.y;var a=i.x-t.x;return i=i.y-t.y,t=n*r-o*e,n=n*i-o*a,Math.abs(t)>Number.EPSILON?(e=a*r-i*e,0<t?0<=n&&0<=e:0<=n||0<=e):0<n}for(var e,r,i={},n=f.concat(),o=0,a=t.length;o<a;o++)Array.prototype.push.apply(n,t[o]);for(o=0,a=n.length;o<a;o++)void 0!==i[r=n[o].x+":"+n[o].y]&&console.warn("THREE.Shape: Duplicate point",r),i[r]=o;o=function(a){for(var o,t,e,r,i,n,s,h,c=f.concat(),u=[],l=[],E=0,p=a.length;E<p;E++)u.push(E);n=0;for(var d=2*u.length;0<u.length;){if(--d<0){console.log("Infinite Loop! Holes left:"+u.length+", Probably Hole outside Shape!");break}for(t=n;t<c.length;t++){for(e=c[t],p=-1,E=0;E<u.length;E++)if(r=u[E],void 0===l[i=e.x+":"+e.y+":"+r]){for(o=a[r],s=0;s<o.length;s++)if(r=o[s],function(t,e){var r=c.length-1,i=t-1;i<0&&(i=r);var n=t+1;return r<n&&(n=0),(r=T(c[t],c[i],c[n],o[e]))&&(r=o.length-1,(i=e-1)<0&&(i=r),r<(n=e+1)&&(n=0),!!(r=T(o[e],o[i],o[n],c[t])))}(t,s)&&!function(t,e){for(var r,i=0;i<c.length;i++)if(r=i+1,r%=c.length,0<m(t,e,c[i],c[r],!0).length)return 1}(e,r)&&!function(t,e){for(var r,i,n,o=0;o<u.length;o++)for(r=a[u[o]],i=0;i<r.length;i++)if(n=i+1,n%=r.length,0<m(t,e,r[i],r[n],!0).length)return 1}(e,r)){p=s,u.splice(E,1),n=c.slice(0,t+1),r=c.slice(t),s=o.slice(p),h=o.slice(0,p+1),c=n.concat(s).concat(h).concat(r),n=t;break}if(0<=p)break;l[i]=!0}if(0<=p)break}}return c}(t);var s=THREE.ShapeUtils.triangulate(o,!1);for(o=0,a=s.length;o<a;o++)for(e=s[o],n=0;n<3;n++)void 0!==(r=i[r=e[n].x+":"+e[n].y])&&(e[n]=r);return s.concat()},isClockWise:function(t){return THREE.ShapeUtils.area(t)<0},b2:function(t,e,r,i){var n=1-t;return n*n*e+2*(1-t)*t*r+t*t*i},b3:function(t,e,r,i,n){var o=1-t,a=1-t;return o*o*o*e+3*a*a*t*r+3*(1-t)*t*t*i+t*t*t*n}},THREE.Audio=function(t){THREE.Object3D.call(this),this.type="Audio",this.context=t.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.panner=this.context.createPanner(),this.panner.connect(this.gain),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1},THREE.Audio.prototype=Object.create(THREE.Object3D.prototype),THREE.Audio.prototype.constructor=THREE.Audio,THREE.Audio.prototype.load=function(t){var e=this,r=new XMLHttpRequest;return r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(t){e.context.decodeAudioData(this.response,function(t){e.source.buffer=t,e.autoplay&&e.play()})},r.send(),this},THREE.Audio.prototype.play=function(){var t;!0===this.isPlaying?console.warn("THREE.Audio: Audio is already playing."):((t=this.context.createBufferSource()).buffer=this.source.buffer,t.loop=this.source.loop,t.onended=this.source.onended,t.start(0,this.startTime),t.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=t,this.connect())},THREE.Audio.prototype.pause=function(){this.source.stop(),this.startTime=this.context.currentTime},THREE.Audio.prototype.stop=function(){this.source.stop(),this.startTime=0},THREE.Audio.prototype.connect=function(){void 0!==this.filter?(this.source.connect(this.filter),this.filter.connect(this.panner)):this.source.connect(this.panner)},THREE.Audio.prototype.disconnect=function(){void 0!==this.filter?(this.source.disconnect(this.filter),this.filter.disconnect(this.panner)):this.source.disconnect(this.panner)},THREE.Audio.prototype.setFilter=function(t){!0===this.isPlaying?(this.disconnect(),this.filter=t,this.connect()):this.filter=t},THREE.Audio.prototype.getFilter=function(){return this.filter},THREE.Audio.prototype.setPlaybackRate=function(t){this.playbackRate=t,!0===this.isPlaying&&(this.source.playbackRate.value=this.playbackRate)},THREE.Audio.prototype.getPlaybackRate=function(){return this.playbackRate},THREE.Audio.prototype.onEnded=function(){this.isPlaying=!1},THREE.Audio.prototype.setLoop=function(t){this.source.loop=t},THREE.Audio.prototype.getLoop=function(){return this.source.loop},THREE.Audio.prototype.setRefDistance=function(t){this.panner.refDistance=t},THREE.Audio.prototype.getRefDistance=function(){return this.panner.refDistance},THREE.Audio.prototype.setRolloffFactor=function(t){this.panner.rolloffFactor=t},THREE.Audio.prototype.getRolloffFactor=function(){return this.panner.rolloffFactor},THREE.Audio.prototype.setVolume=function(t){this.gain.gain.value=t},THREE.Audio.prototype.getVolume=function(){return this.gain.gain.value},THREE.Audio.prototype.updateMatrixWorld=function(){var e=new THREE.Vector3;return function(t){THREE.Object3D.prototype.updateMatrixWorld.call(this,t),e.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(e.x,e.y,e.z)}}(),THREE.AudioListener=function(){THREE.Object3D.call(this),this.type="AudioListener",this.context=new(window.AudioContext||window.webkitAudioContext)},THREE.AudioListener.prototype=Object.create(THREE.Object3D.prototype),THREE.AudioListener.prototype.constructor=THREE.AudioListener,THREE.AudioListener.prototype.updateMatrixWorld=function(){var r=new THREE.Vector3,i=new THREE.Quaternion,n=new THREE.Vector3,o=new THREE.Vector3;return function(t){THREE.Object3D.prototype.updateMatrixWorld.call(this,t),t=this.context.listener;var e=this.up;this.matrixWorld.decompose(r,i,n),o.set(0,0,-1).applyQuaternion(i),t.setPosition(r.x,r.y,r.z),t.setOrientation(o.x,o.y,o.z,e.x,e.y,e.z)}}(),THREE.Curve=function(){},THREE.Curve.prototype={constructor:THREE.Curve,getPoint:function(){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(t){return t=this.getUtoTmapping(t),this.getPoint(t)},getPoints:function(t){t=t||5;for(var e=[],r=0;r<=t;r++)e.push(this.getPoint(r/t));return e},getSpacedPoints:function(t){t=t||5;for(var e=[],r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(t=t||(this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,r,i=[],n=this.getPoint(0),o=0;for(i.push(0),r=1;r<=t;r++)o+=(e=this.getPoint(r/t)).distanceTo(n),i.push(o),n=e;return this.cacheArcLengths=i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){for(var r,i=this.getLengths(),n=0,o=i.length,a=e||t*i[o-1],s=0,h=o-1;s<=h;)if((r=i[n=Math.floor(s+(h-s)/2)]-a)<0)s=n+1;else{if(!(0<r)){h=n;break}h=n-1}return i[n=h]===a?n/(o-1):(n+(a-(s=i[n]))/(i[n+1]-s))/(o-1)},getTangent:function(t){var e=t-1e-4;return e<0&&(e=0),1<(t+=1e-4)&&(t=1),e=this.getPoint(e),this.getPoint(t).clone().sub(e).normalize()},getTangentAt:function(t){return t=this.getUtoTmapping(t),this.getTangent(t)}},THREE.Curve.Utils=THREE.CurveUtils,THREE.Curve.create=function(t,e){return t.prototype=Object.create(THREE.Curve.prototype),(t.prototype.constructor=t).prototype.getPoint=e,t},THREE.CurvePath=function(){this.curves=[],this.autoClose=!1},THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype),THREE.CurvePath.prototype.constructor=THREE.CurvePath,THREE.CurvePath.prototype.add=function(t){this.curves.push(t)},THREE.CurvePath.prototype.closePath=function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new THREE.LineCurve(e,t))},THREE.CurvePath.prototype.getPoint=function(t){for(var e=t*this.getLength(),r=this.getCurveLengths(),i=0;i<r.length;){if(r[i]>=e)return t=this.curves[i],e=1-(r[i]-e)/t.getLength(),t.getPointAt(e);i++}return null},THREE.CurvePath.prototype.getLength=function(){var t=this.getCurveLengths();return t[t.length-1]},THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,r=0,i=this.curves.length;r<i;r++)e+=this.curves[r].getLength(),t.push(e);return this.cacheLengths=t},THREE.CurvePath.prototype.createPointsGeometry=function(t){return t=this.getPoints(t,!0),this.createGeometry(t)},THREE.CurvePath.prototype.createSpacedPointsGeometry=function(t){return t=this.getSpacedPoints(t,!0),this.createGeometry(t)},THREE.CurvePath.prototype.createGeometry=function(t){for(var e=new THREE.Geometry,r=0,i=t.length;r<i;r++){var n=t[r];e.vertices.push(new THREE.Vector3(n.x,n.y,n.z||0))}return e},THREE.Path=function(t){THREE.CurvePath.call(this),this.actions=[],t&&this.fromPoints(t)},THREE.Path.prototype=Object.create(THREE.CurvePath.prototype),THREE.Path.prototype.constructor=THREE.Path,THREE.Path.prototype.fromPoints=function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,r=t.length;e<r;e++)this.lineTo(t[e].x,t[e].y)},THREE.Path.prototype.moveTo=function(t,e){this.actions.push({action:"moveTo",args:[t,e]})},THREE.Path.prototype.lineTo=function(t,e){var r=this.actions[this.actions.length-1].args,r=new THREE.LineCurve(new THREE.Vector2(r[r.length-2],r[r.length-1]),new THREE.Vector2(t,e));this.curves.push(r),this.actions.push({action:"lineTo",args:[t,e]})},THREE.Path.prototype.quadraticCurveTo=function(t,e,r,i){var n=this.actions[this.actions.length-1].args,n=new THREE.QuadraticBezierCurve(new THREE.Vector2(n[n.length-2],n[n.length-1]),new THREE.Vector2(t,e),new THREE.Vector2(r,i));this.curves.push(n),this.actions.push({action:"quadraticCurveTo",args:[t,e,r,i]})},THREE.Path.prototype.bezierCurveTo=function(t,e,r,i,n,o){var a=this.actions[this.actions.length-1].args,a=new THREE.CubicBezierCurve(new THREE.Vector2(a[a.length-2],a[a.length-1]),new THREE.Vector2(t,e),new THREE.Vector2(r,i),new THREE.Vector2(n,o));this.curves.push(a),this.actions.push({action:"bezierCurveTo",args:[t,e,r,i,n,o]})},THREE.Path.prototype.splineThru=function(t){var e=Array.prototype.slice.call(arguments),r=this.actions[this.actions.length-1].args,r=[new THREE.Vector2(r[r.length-2],r[r.length-1])];Array.prototype.push.apply(r,t),r=new THREE.SplineCurve(r),this.curves.push(r),this.actions.push({action:"splineThru",args:e})},THREE.Path.prototype.arc=function(t,e,r,i,n,o){var a=this.actions[this.actions.length-1].args;this.absarc(t+a[a.length-2],e+a[a.length-1],r,i,n,o)},THREE.Path.prototype.absarc=function(t,e,r,i,n,o){this.absellipse(t,e,r,r,i,n,o)},THREE.Path.prototype.ellipse=function(t,e,r,i,n,o,a,s){var h=this.actions[this.actions.length-1].args;this.absellipse(t+h[h.length-2],e+h[h.length-1],r,i,n,o,a,s)},THREE.Path.prototype.absellipse=function(t,e,r,i,n,o,a,s){var h=[t,e,r,i,n,o,a,s||0];t=new THREE.EllipseCurve(t,e,r,i,n,o,a,s),this.curves.push(t),t=t.getPoint(1),h.push(t.x),h.push(t.y),this.actions.push({action:"ellipse",args:h})},THREE.Path.prototype.getSpacedPoints=function(t,e){t=t||40;for(var r=[],i=0;i<t;i++)r.push(this.getPoint(i/t));return r},THREE.Path.prototype.getPoints=function(t,e){t=t||12;for(var r,i,n,o,a,s,h=THREE.ShapeUtils.b2,c=THREE.ShapeUtils.b3,u=[],l=0,E=this.actions.length;l<E;l++){var p=(T=this.actions[l]).args;switch(T.action){case"moveTo":case"lineTo":u.push(new THREE.Vector2(p[0],p[1]));break;case"quadraticCurveTo":for(r=p[2],i=p[3],a=p[0],s=p[1],v=0<u.length?(R=(T=u[u.length-1]).x,T.y):(R=(T=this.actions[l-1].args)[T.length-2],T[T.length-1]),p=1;p<=t;p++)T=h(g=p/t,R,a,r),g=h(g,v,s,i),u.push(new THREE.Vector2(T,g));break;case"bezierCurveTo":for(r=p[4],i=p[5],a=p[0],s=p[1],n=p[2],o=p[3],v=0<u.length?(R=(T=u[u.length-1]).x,T.y):(R=(T=this.actions[l-1].args)[T.length-2],T[T.length-1]),p=1;p<=t;p++)T=c(g=p/t,R,a,n,r),g=c(g,v,s,o,i),u.push(new THREE.Vector2(T,g));break;case"splineThru":for(T=this.actions[l-1].args,g=[new THREE.Vector2(T[T.length-2],T[T.length-1])],T=t*p[0].length,g=g.concat(p[0]),g=new THREE.SplineCurve(g),p=1;p<=T;p++)u.push(g.getPointAt(p/T));break;case"arc":for(r=p[0],i=p[1],s=p[2],n=p[3],T=p[4],a=!!p[5],R=T-n,v=2*t,p=1;p<=v;p++)g=p/v,a||(g=1-g),g=n+g*R,T=r+s*Math.cos(g),g=i+s*Math.sin(g),u.push(new THREE.Vector2(T,g));break;case"ellipse":r=p[0],i=p[1],s=p[2],o=p[3],n=p[4],T=p[5],a=!!p[6];var d,f,m,T,g,y=p[7],R=T-n,v=2*t;for(0!==y&&(d=Math.cos(y),f=Math.sin(y)),p=1;p<=v;p++){g=p/v,a||(g=1-g),g=n+g*R,T=r+s*Math.cos(g),g=i+o*Math.sin(g),0!==y&&(T=((m=T)-r)*d-(g-i)*f+r,g=(m-r)*f+(g-i)*d+i),u.push(new THREE.Vector2(T,g))}}}return h=u[u.length-1],Math.abs(h.x-u[0].x)<Number.EPSILON&&Math.abs(h.y-u[0].y)<Number.EPSILON&&u.splice(u.length-1,1),e&&u.push(u[0]),u},THREE.Path.prototype.toShapes=function(t,e){function r(t){for(var e=[],r=0,i=t.length;r<i;r++){var n=t[r],o=new THREE.Shape;o.actions=n.actions,o.curves=n.curves,e.push(o)}return e}var i=THREE.ShapeUtils.isClockWise,n=function(t){for(var e=[],r=new THREE.Path,i=0,n=t.length;i<n;i++){var o=t[i],a=o.args;"moveTo"===(o=o.action)&&0!==r.actions.length&&(e.push(r),r=new THREE.Path),r[o].apply(r,a)}return 0!==r.actions.length&&e.push(r),e}(this.actions);if(0===n.length)return[];if(!0===e)return r(n);var o,a,s=[];if(1===n.length)return a=n[0],(u=new THREE.Shape).actions=a.actions,u.curves=a.curves,s.push(u),s;var h,c=!i(n[0].getPoints()),c=t?!c:c,u=[],l=[],E=[],p=0;l[p]=void 0,E[p]=[];for(var d=0,f=n.length;d<f;d++)o=i(h=(a=n[d]).getPoints()),(o=t?!o:o)?(!c&&l[p]&&p++,l[p]={s:new THREE.Shape,p:h},l[p].s.actions=a.actions,l[p].s.curves=a.curves,c&&p++,E[p]=[]):E[p].push({h:a,p:h[0]});if(!l[0])return r(n);if(1<l.length){for(d=!1,a=[],i=0,n=l.length;i<n;i++)u[i]=[];for(i=0,n=l.length;i<n;i++)for(o=E[i],c=0;c<o.length;c++){for(p=o[c],h=!0,f=0;f<l.length;f++)!function(t,e){for(var r=e.length,i=!1,n=r-1,o=0;o<r;n=o++){var a=e[n],s=e[o],h=s.x-a.x,c=s.y-a.y;if(Math.abs(c)>Number.EPSILON){if(c<0&&(a=e[o],h=-h,s=e[n],c=-c),!(t.y<a.y||t.y>s.y))if(t.y===a.y){if(t.x===a.x)return 1}else{if(0===(n=c*(t.x-a.x)-h*(t.y-a.y)))return 1;n<0||(i=!i)}}else if(t.y===a.y&&(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x))return 1}return i}(p.p,l[f].p)||(i!==f&&a.push({froms:i,tos:f,hole:c}),h?(h=!1,u[f].push(p)):d=!0);h&&u[i].push(p)}0<a.length&&(d||(E=u))}for(d=0,i=l.length;d<i;d++)for(u=l[d].s,s.push(u),n=0,o=(a=E[d]).length;n<o;n++)u.holes.push(a[n].h);return s},THREE.Shape=function(){THREE.Path.apply(this,arguments),this.holes=[]},THREE.Shape.prototype=Object.create(THREE.Path.prototype),THREE.Shape.prototype.constructor=THREE.Shape,THREE.Shape.prototype.extrude=function(t){return new THREE.ExtrudeGeometry(this,t)},THREE.Shape.prototype.makeGeometry=function(t){return new THREE.ShapeGeometry(this,t)},THREE.Shape.prototype.getPointsHoles=function(t){for(var e=[],r=0,i=this.holes.length;r<i;r++)e[r]=this.holes[r].getPoints(t);return e},THREE.Shape.prototype.extractAllPoints=function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},THREE.Shape.prototype.extractPoints=function(t){return this.extractAllPoints(t)},THREE.Shape.Utils=THREE.ShapeUtils,THREE.LineCurve=function(t,e){this.v1=t,this.v2=e},THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype),THREE.LineCurve.prototype.constructor=THREE.LineCurve,THREE.LineCurve.prototype.getPoint=function(t){var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},THREE.LineCurve.prototype.getPointAt=function(t){return this.getPoint(t)},THREE.LineCurve.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},THREE.QuadraticBezierCurve=function(t,e,r){this.v0=t,this.v1=e,this.v2=r},THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype),THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve,THREE.QuadraticBezierCurve.prototype.getPoint=function(t){var e=THREE.ShapeUtils.b2;return new THREE.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y))},THREE.QuadraticBezierCurve.prototype.getTangent=function(t){var e=THREE.CurveUtils.tangentQuadraticBezier;return new THREE.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y)).normalize()},THREE.CubicBezierCurve=function(t,e,r,i){this.v0=t,this.v1=e,this.v2=r,this.v3=i},THREE.CubicBezierCurve.prototype=Object.create(THREE.Curve.prototype),THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve,THREE.CubicBezierCurve.prototype.getPoint=function(t){var e=THREE.ShapeUtils.b3;return new THREE.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},THREE.CubicBezierCurve.prototype.getTangent=function(t){var e=THREE.CurveUtils.tangentCubicBezier;return new THREE.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},THREE.SplineCurve=function(t){this.points=null==t?[]:t},THREE.SplineCurve.prototype=Object.create(THREE.Curve.prototype),THREE.SplineCurve.prototype.constructor=THREE.SplineCurve,THREE.SplineCurve.prototype.getPoint=function(t){t*=(n=this.points).length-1,t-=o=Math.floor(t);var e=n[0===o?o:o-1],r=n[o],i=n[o>n.length-2?n.length-1:o+1],n=n[o>n.length-3?n.length-1:o+2],o=THREE.CurveUtils.interpolate;return new THREE.Vector2(o(e.x,r.x,i.x,n.x,t),o(e.y,r.y,i.y,n.y,t))},THREE.EllipseCurve=function(t,e,r,i,n,o,a,s){this.aX=t,this.aY=e,this.xRadius=r,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0},THREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype),THREE.EllipseCurve.prototype.constructor=THREE.EllipseCurve,THREE.EllipseCurve.prototype.getPoint=function(t){var e=this.aEndAngle-this.aStartAngle;e<0&&(e+=2*Math.PI),e>2*Math.PI&&(e-=2*Math.PI),e=!0===this.aClockwise?this.aEndAngle+(1-t)*(2*Math.PI-e):this.aStartAngle+t*e,t=this.aX+this.xRadius*Math.cos(e);var r,i,n=this.aY+this.yRadius*Math.sin(e);return 0!==this.aRotation&&(e=Math.cos(this.aRotation),r=Math.sin(this.aRotation),t=((i=t)-this.aX)*e-(n-this.aY)*r+this.aX,n=(i-this.aX)*r+(n-this.aY)*e+this.aY),new THREE.Vector2(t,n)},THREE.ArcCurve=function(t,e,r,i,n,o){THREE.EllipseCurve.call(this,t,e,r,r,i,n,o)},THREE.ArcCurve.prototype=Object.create(THREE.EllipseCurve.prototype),THREE.ArcCurve.prototype.constructor=THREE.ArcCurve,THREE.LineCurve3=THREE.Curve.create(function(t,e){this.v1=t,this.v2=e},function(t){var e=new THREE.Vector3;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e}),THREE.QuadraticBezierCurve3=THREE.Curve.create(function(t,e,r){this.v0=t,this.v1=e,this.v2=r},function(t){var e=THREE.ShapeUtils.b2;return new THREE.Vector3(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y),e(t,this.v0.z,this.v1.z,this.v2.z))}),THREE.CubicBezierCurve3=THREE.Curve.create(function(t,e,r,i){this.v0=t,this.v1=e,this.v2=r,this.v3=i},function(t){var e=THREE.ShapeUtils.b3;return new THREE.Vector3(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),THREE.SplineCurve3=THREE.Curve.create(function(t){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=null==t?[]:t},function(t){t*=(n=this.points).length-1,t-=o=Math.floor(t);var e=n[0==o?o:o-1],r=n[o],i=n[o>n.length-2?n.length-1:o+1],n=n[o>n.length-3?n.length-1:o+2],o=THREE.CurveUtils.interpolate;return new THREE.Vector3(o(e.x,r.x,i.x,n.x,t),o(e.y,r.y,i.y,n.y,t),o(e.z,r.z,i.z,n.z,t))}),THREE.CatmullRomCurve3=function(){function t(){}var h=new THREE.Vector3,c=new t,u=new t,l=new t;return t.prototype.init=function(t,e,r,i){this.c0=t,this.c1=r,this.c2=-3*t+3*e-2*r-i,this.c3=2*t-2*e+r+i},t.prototype.initNonuniformCatmullRom=function(t,e,r,i,n,o,a){t=((e-t)/n-(r-t)/(n+o)+(r-e)/o)*o,i=((r-e)/o-(i-e)/(o+a)+(i-r)/a)*o,this.init(e,r,t,i)},t.prototype.initCatmullRom=function(t,e,r,i,n){this.init(e,r,n*(r-t),n*(i-e))},t.prototype.calc=function(t){var e=t*t;return this.c0+this.c1*t+this.c2*e+this.c3*e*t},THREE.Curve.create(function(t){this.points=t||[]},function(t){var e,r,i,n,o,a,s=this.points;return(n=s.length)<2&&console.log("duh, you need at least 2 points"),t*=n-1,0===(t-=o=Math.floor(t))&&o===n-1&&(o=n-2,t=1),e=0===o?(h.subVectors(s[0],s[1]).add(s[0]),h):s[o-1],r=s[o],i=s[o+1],s=o+2<n?s[o+2]:(h.subVectors(s[n-1],s[n-2]).add(s[n-2]),h),void 0===this.type||"centripetal"===this.type||"chordal"===this.type?(a="chordal"===this.type?.5:.25,n=Math.pow(e.distanceToSquared(r),a),(o=Math.pow(r.distanceToSquared(i),a))<1e-4&&(o=1),n<1e-4&&(n=o),(a=Math.pow(i.distanceToSquared(s),a))<1e-4&&(a=o),c.initNonuniformCatmullRom(e.x,r.x,i.x,s.x,n,o,a),u.initNonuniformCatmullRom(e.y,r.y,i.y,s.y,n,o,a),l.initNonuniformCatmullRom(e.z,r.z,i.z,s.z,n,o,a)):"catmullrom"===this.type&&(n=void 0!==this.tension?this.tension:.5,c.initCatmullRom(e.x,r.x,i.x,s.x,n),u.initCatmullRom(e.y,r.y,i.y,s.y,n),l.initCatmullRom(e.z,r.z,i.z,s.z,n)),new THREE.Vector3(c.calc(t),u.calc(t),l.calc(t))})}(),THREE.ClosedSplineCurve3=THREE.Curve.create(function(t){this.points=null==t?[]:t},function(t){t*=+(n=this.points).length,t-=o=Math.floor(t);var e=n[((o=o+(0<o?0:(Math.floor(Math.abs(o)/n.length)+1)*n.length))-1)%n.length],r=n[o%n.length],i=n[(o+1)%n.length],n=n[(o+2)%n.length],o=THREE.CurveUtils.interpolate;return new THREE.Vector3(o(e.x,r.x,i.x,n.x,t),o(e.y,r.y,i.y,n.y,t),o(e.z,r.z,i.z,n.z,t))}),THREE.BoxGeometry=function(t,e,r,i,n,o){function a(t,e,r,i,n,o,a,s){var h,c=R.widthSegments,u=R.heightSegments,l=n/2,E=o/2,p=R.vertices.length;"x"===t&&"y"===e||"y"===t&&"x"===e?h="z":"x"===t&&"z"===e||"z"===t&&"x"===e?(h="y",u=R.depthSegments):("z"===t&&"y"===e||"y"===t&&"z"===e)&&(h="x",c=R.depthSegments);var d=c+1,f=u+1,m=n/c,T=o/u,g=new THREE.Vector3;for(g[h]=0<a?1:-1,n=0;n<f;n++)for(o=0;o<d;o++){var y=new THREE.Vector3;y[t]=(o*m-l)*r,y[e]=(n*T-E)*i,y[h]=a,R.vertices.push(y)}for(n=0;n<u;n++)for(o=0;o<c;o++)E=o+d*n,t=o+d*(n+1),e=o+1+d*(n+1),r=o+1+d*n,i=new THREE.Vector2(o/c,1-n/u),a=new THREE.Vector2(o/c,1-(n+1)/u),h=new THREE.Vector2((o+1)/c,1-(n+1)/u),l=new THREE.Vector2((o+1)/c,1-n/u),(E=new THREE.Face3(E+p,t+p,r+p)).normal.copy(g),E.vertexNormals.push(g.clone(),g.clone(),g.clone()),E.materialIndex=s,R.faces.push(E),R.faceVertexUvs[0].push([i,a,l]),(E=new THREE.Face3(t+p,e+p,r+p)).normal.copy(g),E.vertexNormals.push(g.clone(),g.clone(),g.clone()),E.materialIndex=s,R.faces.push(E),R.faceVertexUvs[0].push([a.clone(),h,l.clone()])}THREE.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:i,heightSegments:n,depthSegments:o},this.widthSegments=i||1,this.heightSegments=n||1,this.depthSegments=o||1;var R=this;n=e/2,o=r/2,a("z","y",-1,-1,r,e,i=t/2,0),a("z","y",1,-1,r,e,-i,1),a("x","z",1,1,t,r,n,2),a("x","z",1,-1,t,r,-n,3),a("x","y",1,-1,t,e,o,4),a("x","y",-1,-1,t,e,-o,5),this.mergeVertices()},THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.BoxGeometry.prototype.constructor=THREE.BoxGeometry,THREE.BoxGeometry.prototype.clone=function(){var t=this.parameters;return new THREE.BoxGeometry(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)},THREE.CubeGeometry=THREE.BoxGeometry,THREE.CircleGeometry=function(t,e,r,i){THREE.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:i},this.fromBufferGeometry(new THREE.CircleBufferGeometry(t,e,r,i))},THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.CircleGeometry.prototype.constructor=THREE.CircleGeometry,THREE.CircleGeometry.prototype.clone=function(){var t=this.parameters;return new THREE.CircleGeometry(t.radius,t.segments,t.thetaStart,t.thetaLength)},THREE.CircleBufferGeometry=function(t,e,r,i){THREE.BufferGeometry.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:i},t=t||50,e=void 0!==e?Math.max(3,e):8,r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var n=e+2,o=new Float32Array(3*n),a=new Float32Array(3*n),n=new Float32Array(2*n);a[2]=1,n[0]=.5,n[1]=.5;for(var s=0,h=3,c=2;s<=e;s++,h+=3,c+=2){var u=r+s/e*i;o[h]=t*Math.cos(u),o[h+1]=t*Math.sin(u),a[h+2]=1,n[c]=(o[h]/t+1)/2,n[c+1]=(o[h+1]/t+1)/2}for(r=[],h=1;h<=e;h++)r.push(h,h+1,0);this.setIndex(new THREE.BufferAttribute(new Uint16Array(r),1)),this.addAttribute("position",new THREE.BufferAttribute(o,3)),this.addAttribute("normal",new THREE.BufferAttribute(a,3)),this.addAttribute("uv",new THREE.BufferAttribute(n,2)),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,t)},THREE.CircleBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.CircleBufferGeometry.prototype.constructor=THREE.CircleBufferGeometry,THREE.CircleBufferGeometry.prototype.clone=function(){var t=this.parameters;return new THREE.CircleBufferGeometry(t.radius,t.segments,t.thetaStart,t.thetaLength)},THREE.CylinderGeometry=function(t,e,r,i,n,o,a,s){THREE.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:r,radialSegments:i,heightSegments:n,openEnded:o,thetaStart:a,thetaLength:s},t=void 0!==t?t:20,e=void 0!==e?e:20,r=void 0!==r?r:100,i=i||8,n=n||1,o=void 0!==o&&o,a=void 0!==a?a:0,s=void 0!==s?s:2*Math.PI;for(var h=r/2,c=[],u=[],l=0;l<=n;l++){for(var E=[],p=[],d=(T=l/n)*(e-t)+t,f=0;f<=i;f++){var m=f/i;(g=new THREE.Vector3).x=d*Math.sin(m*s+a),g.y=-T*r+h,g.z=d*Math.cos(m*s+a),this.vertices.push(g),E.push(this.vertices.length-1),p.push(new THREE.Vector2(m,1-T))}c.push(E),u.push(p)}for(r=(e-t)/r,f=0;f<i;f++)for(s=0!==t?(a=this.vertices[c[0][f]].clone(),this.vertices[c[0][f+1]].clone()):(a=this.vertices[c[1][f]].clone(),this.vertices[c[1][f+1]].clone()),a.setY(Math.sqrt(a.x*a.x+a.z*a.z)*r).normalize(),s.setY(Math.sqrt(s.x*s.x+s.z*s.z)*r).normalize(),l=0;l<n;l++){var E=c[l][f],p=c[l+1][f],T=c[l+1][f+1],d=c[l][f+1],m=a.clone(),g=a.clone(),y=s.clone(),R=s.clone(),v=u[l][f].clone(),H=u[l+1][f].clone(),x=u[l+1][f+1].clone(),b=u[l][f+1].clone();this.faces.push(new THREE.Face3(E,p,d,[m,g,R])),this.faceVertexUvs[0].push([v,H,b]),this.faces.push(new THREE.Face3(p,T,d,[g.clone(),y,R.clone()])),this.faceVertexUvs[0].push([H.clone(),x,b.clone()])}if(!1===o&&0<t)for(this.vertices.push(new THREE.Vector3(0,h,0)),f=0;f<i;f++)E=c[0][f],p=c[0][f+1],T=this.vertices.length-1,m=new THREE.Vector3(0,1,0),g=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),v=u[0][f].clone(),H=u[0][f+1].clone(),x=new THREE.Vector2(H.x,0),this.faces.push(new THREE.Face3(E,p,T,[m,g,y],void 0,1)),this.faceVertexUvs[0].push([v,H,x]);if(!1===o&&0<e)for(this.vertices.push(new THREE.Vector3(0,-h,0)),f=0;f<i;f++)E=c[n][f+1],p=c[n][f],T=this.vertices.length-1,m=new THREE.Vector3(0,-1,0),g=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),v=u[n][f+1].clone(),H=u[n][f].clone(),x=new THREE.Vector2(H.x,1),this.faces.push(new THREE.Face3(E,p,T,[m,g,y],void 0,2)),this.faceVertexUvs[0].push([v,H,x]);this.computeFaceNormals()},THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry,THREE.CylinderGeometry.prototype.clone=function(){var t=this.parameters;return new THREE.CylinderGeometry(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)},THREE.EdgesGeometry=function(t,e){function r(t,e){return t-e}THREE.BufferGeometry.call(this);var i=Math.cos(THREE.Math.degToRad(void 0!==e?e:1)),n=[0,0],o={},a=["a","b","c"];t instanceof THREE.BufferGeometry?(s=new THREE.Geometry).fromBufferGeometry(t):s=t.clone(),s.mergeVertices(),s.computeFaceNormals();for(var s,h=s.vertices,c=0,u=(s=s.faces).length;c<u;c++)for(var l=s[c],E=0;E<3;E++){n[0]=l[a[E]],n[1]=l[a[(E+1)%3]],n.sort(r);var p=n.toString();void 0===o[p]?o[p]={vert1:n[0],vert2:n[1],face1:c,face2:void 0}:o[p].face2=c}for(p in n=[],o)(void 0===(a=o[p]).face2||s[a.face1].normal.dot(s[a.face2].normal)<=i)&&(c=h[a.vert1],n.push(c.x),n.push(c.y),n.push(c.z),c=h[a.vert2],n.push(c.x),n.push(c.y),n.push(c.z));this.addAttribute("position",new THREE.BufferAttribute(new Float32Array(n),3))},THREE.EdgesGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.EdgesGeometry.prototype.constructor=THREE.EdgesGeometry,THREE.ExtrudeGeometry=function(t,e){void 0!==t&&(THREE.Geometry.call(this),this.type="ExtrudeGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),this.computeFaceNormals())},THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry,THREE.ExtrudeGeometry.prototype.addShapeList=function(t,e){for(var r=t.length,i=0;i<r;i++)this.addShape(t[i],e)},THREE.ExtrudeGeometry.prototype.addShape=function(t,e){function r(t,e,r){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(r).add(t)}function i(t,e,r){var i=1,i=t.x-e.x,n=t.y-e.y,o=r.x-t.x,a=r.y-t.y,s=i*i+n*n;if(Math.abs(i*a-n*o)>Number.EPSILON){var h=Math.sqrt(s),c=Math.sqrt(o*o+a*a),s=e.x-n/h;if(e=e.y+i/h,(i=(r=s+i*(o=((r.x-a/c-s)*a-(r.y+o/c-e)*o)/(i*a-n*o))-t.x)*r+(t=e+n*o-t.y)*t)<=2)return new THREE.Vector2(r,t);i=Math.sqrt(i/2)}else t=!1,i>Number.EPSILON?o>Number.EPSILON&&(t=!0):i<-Number.EPSILON?o<-Number.EPSILON&&(t=!0):Math.sign(n)===Math.sign(a)&&(t=!0),i=t?(r=-n,t=i,Math.sqrt(s)):(r=i,t=n,Math.sqrt(s/2));return new THREE.Vector2(r/i,t/i)}function n(t,e){var r,i;for(V=t.length;0<=--V;){(i=(r=V)-1)<0&&(i=t.length-1);for(var n=0,o=g+2*f,n=0;n<o;n++){var a=(a=e+r+(s=D*n))+b,s=(s=e+i+s)+b,h=(h=e+i+(c=D*(n+1)))+b,c=(c=e+r+c)+b;x.faces.push(new THREE.Face3(a,s,c,null,null,1)),x.faces.push(new THREE.Face3(s,h,c,null,null,1)),a=v.generateSideWallUV(x,a,s,h,c),x.faceVertexUvs[0].push([a[0],a[1],a[3]]),x.faceVertexUvs[0].push([a[1],a[2],a[3]])}}}function o(t,e,r){x.vertices.push(new THREE.Vector3(t,e,r))}function a(t,e,r){t+=b,e+=b,r+=b,x.faces.push(new THREE.Face3(t,e,r,null,null,0)),t=v.generateTopUV(x,t,e,r),x.faceVertexUvs[0].push(t)}var s,h,c,u,l,E=void 0!==e.amount?e.amount:100,p=void 0!==e.bevelThickness?e.bevelThickness:6,d=void 0!==e.bevelSize?e.bevelSize:p-2,f=void 0!==e.bevelSegments?e.bevelSegments:3,m=void 0===e.bevelEnabled||e.bevelEnabled,T=void 0!==e.curveSegments?e.curveSegments:12,g=void 0!==e.steps?e.steps:1,y=e.extrudePath,R=!1,v=void 0!==e.UVGenerator?e.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator;y&&(s=y.getSpacedPoints(g),m=!(R=!0),h=void 0!==e.frames?e.frames:new THREE.TubeGeometry.FrenetFrames(y,g,!1),c=new THREE.Vector3,u=new THREE.Vector3,l=new THREE.Vector3),m||(d=p=f=0);var H,x=this,b=this.vertices.length,T=(y=t.extractPoints(T)).shape,w=y.holes;if(y=!THREE.ShapeUtils.isClockWise(T)){for(T=T.reverse(),_=0,A=w.length;_<A;_++)H=w[_],THREE.ShapeUtils.isClockWise(H)&&(w[_]=H.reverse());y=!1}for(var M=THREE.ShapeUtils.triangulateShape(T,w),S=T,_=0,A=w.length;_<A;_++)H=w[_],T=T.concat(H);for(var C,L,P,D=T.length,k=M.length,y=[],V=0,F=S.length,U=F-1,B=V+1;V<F;V++,U++,B++)U===F&&(U=0),B===F&&(B=0),y[V]=i(S[V],S[U],S[B]);var O,G=[],N=y.concat();for(_=0,A=w.length;_<A;_++){for(H=w[_],O=[],V=0,U=(F=H.length)-1,B=V+1;V<F;V++,U++,B++)U===F&&(U=0),B===F&&(B=0),O[V]=i(H[V],H[U],H[B]);G.push(O),N=N.concat(O)}for(U=0;U<f;U++){for(C=p*(1-(F=U/f)),B=d*Math.sin(F*Math.PI/2),V=0,F=S.length;V<F;V++)o((L=r(S[V],y[V],B)).x,L.y,-C);for(_=0,A=w.length;_<A;_++)for(H=w[_],O=G[_],V=0,F=H.length;V<F;V++)o((L=r(H[V],O[V],B)).x,L.y,-C)}for(B=d,V=0;V<D;V++)L=m?r(T[V],N[V],B):T[V],R?(u.copy(h.normals[0]).multiplyScalar(L.x),c.copy(h.binormals[0]).multiplyScalar(L.y),l.copy(s[0]).add(u).add(c),o(l.x,l.y,l.z)):o(L.x,L.y,0);for(F=1;F<=g;F++)for(V=0;V<D;V++)L=m?r(T[V],N[V],B):T[V],R?(u.copy(h.normals[F]).multiplyScalar(L.x),c.copy(h.binormals[F]).multiplyScalar(L.y),l.copy(s[F]).add(u).add(c),o(l.x,l.y,l.z)):o(L.x,L.y,E/g*F);for(U=f-1;0<=U;U--){for(C=p*(1-(F=U/f)),B=d*Math.sin(F*Math.PI/2),V=0,F=S.length;V<F;V++)o((L=r(S[V],y[V],B)).x,L.y,E+C);for(_=0,A=w.length;_<A;_++)for(H=w[_],O=G[_],V=0,F=H.length;V<F;V++)L=r(H[V],O[V],B),R?o(L.x,L.y+s[g-1].y,s[g-1].x+C):o(L.x,L.y,E+C)}!function(){if(m){var t=0*D;for(V=0;V<k;V++)a((P=M[V])[2]+t,P[1]+t,P[0]+t);for(t=g+2*f,t*=D,V=0;V<k;V++)a((P=M[V])[0]+t,P[1]+t,P[2]+t)}else{for(V=0;V<k;V++)a((P=M[V])[2],P[1],P[0]);for(V=0;V<k;V++)a((P=M[V])[0]+D*g,P[1]+D*g,P[2]+D*g)}}(),function(){var t=0;for(n(S,t),t+=S.length,_=0,A=w.length;_<A;_++)n(H=w[_],t),t+=H.length}()},THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(t,e,r,i){return e=(t=t.vertices)[e],r=t[r],i=t[i],[new THREE.Vector2(e.x,e.y),new THREE.Vector2(r.x,r.y),new THREE.Vector2(i.x,i.y)]},generateSideWallUV:function(t,e,r,i,n){return e=(t=t.vertices)[e],r=t[r],i=t[i],n=t[n],Math.abs(e.y-r.y)<.01?[new THREE.Vector2(e.x,1-e.z),new THREE.Vector2(r.x,1-r.z),new THREE.Vector2(i.x,1-i.z),new THREE.Vector2(n.x,1-n.z)]:[new THREE.Vector2(e.y,1-e.z),new THREE.Vector2(r.y,1-r.z),new THREE.Vector2(i.y,1-i.z),new THREE.Vector2(n.y,1-n.z)]}},THREE.ShapeGeometry=function(t,e){THREE.Geometry.call(this),!(this.type="ShapeGeometry")===Array.isArray(t)&&(t=[t]),this.addShapeList(t,e),this.computeFaceNormals()},THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ShapeGeometry.prototype.constructor=THREE.ShapeGeometry,THREE.ShapeGeometry.prototype.addShapeList=function(t,e){for(var r=0,i=t.length;r<i;r++)this.addShape(t[r],e);return this},THREE.ShapeGeometry.prototype.addShape=function(t,e){void 0===e&&(e={});var r,i,n=e.material,o=void 0===e.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:e.UVGenerator,a=this.vertices.length,s=t.extractPoints(void 0!==e.curveSegments?e.curveSegments:12),h=s.shape,c=s.holes;if(!THREE.ShapeUtils.isClockWise(h))for(h=h.reverse(),s=0,r=c.length;s<r;s++)i=c[s],THREE.ShapeUtils.isClockWise(i)&&(c[s]=i.reverse());var u=THREE.ShapeUtils.triangulateShape(h,c);for(s=0,r=c.length;s<r;s++)i=c[s],h=h.concat(i);for(c=h.length,r=u.length,s=0;s<c;s++)i=h[s],this.vertices.push(new THREE.Vector3(i.x,i.y,0));for(s=0;s<r;s++)h=(c=u[s])[0]+a,i=c[1]+a,c=c[2]+a,this.faces.push(new THREE.Face3(h,i,c,null,null,n)),this.faceVertexUvs[0].push(o.generateTopUV(this,h,i,c))},THREE.LatheGeometry=function(t,e,r,i){THREE.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:r,phiLength:i},e=e||12,r=r||0,i=i||2*Math.PI;for(var n=1/(t.length-1),o=1/e,a=0,s=e;a<=s;a++)for(var h=r+a*o*i,c=Math.cos(h),u=Math.sin(h),h=0,l=t.length;h<l;h++){var E=t[h];(p=new THREE.Vector3).x=c*E.x-u*E.y,p.y=u*E.x+c*E.y,p.z=E.z,this.vertices.push(p)}for(r=t.length,a=0,s=e;a<s;a++)for(h=0,l=t.length-1;h<l;h++){e=u=h+r*a,i=u+r;var p,c=u+1+r,u=u+1,d=(E=a*o)+o,f=(p=h*n)+n;this.faces.push(new THREE.Face3(e,i,u)),this.faceVertexUvs[0].push([new THREE.Vector2(E,p),new THREE.Vector2(d,p),new THREE.Vector2(E,f)]),this.faces.push(new THREE.Face3(i,c,u)),this.faceVertexUvs[0].push([new THREE.Vector2(d,p),new THREE.Vector2(d,f),new THREE.Vector2(E,f)])}this.mergeVertices(),this.computeFaceNormals(),this.computeVertexNormals()},THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry,THREE.PlaneGeometry=function(t,e,r,i){THREE.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:i},this.fromBufferGeometry(new THREE.PlaneBufferGeometry(t,e,r,i))},THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry,THREE.PlaneGeometry.prototype.clone=function(){var t=this.parameters;return new THREE.PlaneGeometry(t.width,t.height,t.widthSegments,t.heightSegments)},THREE.PlaneBufferGeometry=function(t,e,r,i){THREE.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:i};var n=t/2,o=e/2,a=(r=Math.floor(r)||1)+1,s=(i=Math.floor(i)||1)+1,h=t/r,c=e/i;e=new Float32Array(a*s*3),t=new Float32Array(a*s*3);for(var u=new Float32Array(a*s*2),l=0,E=0,p=0;p<s;p++)for(var d=p*c-o,f=0;f<a;f++)e[l]=f*h-n,e[l+1]=-d,t[l+2]=1,u[E]=f/r,u[E+1]=1-p/i,l+=3,E+=2;for(l=0,n=new(65535<e.length/3?Uint32Array:Uint16Array)(r*i*6),p=0;p<i;p++)for(f=0;f<r;f++)o=f+a*(p+1),s=f+1+a*(p+1),h=f+1+a*p,n[l]=f+a*p,n[l+1]=o,n[l+2]=h,n[l+3]=o,n[l+4]=s,n[l+5]=h,l+=6;this.setIndex(new THREE.BufferAttribute(n,1)),this.addAttribute("position",new THREE.BufferAttribute(e,3)),this.addAttribute("normal",new THREE.BufferAttribute(t,3)),this.addAttribute("uv",new THREE.BufferAttribute(u,2))},THREE.PlaneBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.PlaneBufferGeometry.prototype.constructor=THREE.PlaneBufferGeometry,THREE.PlaneBufferGeometry.prototype.clone=function(){var t=this.parameters;return new THREE.PlaneBufferGeometry(t.width,t.height,t.widthSegments,t.heightSegments)},THREE.RingGeometry=function(t,e,r,i,n,o){THREE.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:o},t=t||0,e=e||50,n=void 0!==n?n:0,o=void 0!==o?o:2*Math.PI,r=void 0!==r?Math.max(3,r):8;var a,s=[],h=t,c=(e-t)/(i=void 0!==i?Math.max(1,i):8);for(t=0;t<i+1;t++){for(a=0;a<r+1;a++){var u=new THREE.Vector3,l=n+a/r*o;u.x=h*Math.cos(l),u.y=h*Math.sin(l),this.vertices.push(u),s.push(new THREE.Vector2((u.x/e+1)/2,(u.y/e+1)/2))}h+=c}for(e=new THREE.Vector3(0,0,1),t=0;t<i;t++)for(n=t*(r+1),a=0;a<r;a++)o=l=a+n,c=l+r+1,u=l+r+2,this.faces.push(new THREE.Face3(o,c,u,[e.clone(),e.clone(),e.clone()])),this.faceVertexUvs[0].push([s[o].clone(),s[c].clone(),s[u].clone()]),c=(o=l)+r+2,u=l+1,this.faces.push(new THREE.Face3(o,c,u,[e.clone(),e.clone(),e.clone()])),this.faceVertexUvs[0].push([s[o].clone(),s[c].clone(),s[u].clone()]);this.computeFaceNormals(),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,h)},THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.RingGeometry.prototype.constructor=THREE.RingGeometry,THREE.RingGeometry.prototype.clone=function(){var t=this.parameters;return new THREE.RingGeometry(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)},THREE.SphereGeometry=function(t,e,r,i,n,o,a){THREE.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new THREE.SphereBufferGeometry(t,e,r,i,n,o,a))},THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry,THREE.SphereGeometry.prototype.clone=function(){var t=this.parameters;return new THREE.SphereGeometry(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)},THREE.SphereBufferGeometry=function(t,e,r,i,n,o,a){THREE.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},t=t||50,e=Math.max(3,Math.floor(e)||8),r=Math.max(2,Math.floor(r)||6),i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;for(var s=(o=void 0!==o?o:0)+(a=void 0!==a?a:Math.PI),h=(e+1)*(r+1),c=new THREE.BufferAttribute(new Float32Array(3*h),3),u=new THREE.BufferAttribute(new Float32Array(3*h),3),h=new THREE.BufferAttribute(new Float32Array(2*h),2),l=0,E=[],p=new THREE.Vector3,d=0;d<=r;d++){for(var f=[],m=d/r,T=0;T<=e;T++){var g=T/e,y=-t*Math.cos(i+g*n)*Math.sin(o+m*a),R=t*Math.cos(o+m*a),v=t*Math.sin(i+g*n)*Math.sin(o+m*a);p.set(y,R,v).normalize(),c.setXYZ(l,y,R,v),u.setXYZ(l,p.x,p.y,p.z),h.setXY(l,g,1-m),f.push(l),l++}E.push(f)}for(i=[],d=0;d<r;d++)for(T=0;T<e;T++)n=E[d][T+1],a=E[d][T],l=E[d+1][T],p=E[d+1][T+1],(0!==d||0<o)&&i.push(n,a,p),(d!==r-1||s<Math.PI)&&i.push(a,l,p);this.setIndex(new(65535<c.count?THREE.Uint32Attribute:THREE.Uint16Attribute)(i,1)),this.addAttribute("position",c),this.addAttribute("normal",u),this.addAttribute("uv",h),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,t)},THREE.SphereBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.SphereBufferGeometry.prototype.constructor=THREE.SphereBufferGeometry,THREE.SphereBufferGeometry.prototype.clone=function(){var t=this.parameters;return new THREE.SphereBufferGeometry(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)},THREE.TorusGeometry=function(t,e,r,i,n){THREE.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:i,arc:n},t=t||100,e=e||40,r=r||8,i=i||6,n=n||2*Math.PI;for(var o=new THREE.Vector3,a=[],s=[],h=0;h<=r;h++)for(var c=0;c<=i;c++){var u=c/i*n,l=h/r*Math.PI*2;o.x=t*Math.cos(u),o.y=t*Math.sin(u);var E=new THREE.Vector3;E.x=(t+e*Math.cos(l))*Math.cos(u),E.y=(t+e*Math.cos(l))*Math.sin(u),E.z=e*Math.sin(l),this.vertices.push(E),a.push(new THREE.Vector2(c/i,h/r)),s.push(E.clone().sub(o).normalize())}for(h=1;h<=r;h++)for(c=1;c<=i;c++)t=(i+1)*h+c-1,e=(i+1)*(h-1)+c-1,n=(i+1)*(h-1)+c,o=(i+1)*h+c,u=new THREE.Face3(t,e,o,[s[t].clone(),s[e].clone(),s[o].clone()]),this.faces.push(u),this.faceVertexUvs[0].push([a[t].clone(),a[e].clone(),a[o].clone()]),u=new THREE.Face3(e,n,o,[s[e].clone(),s[n].clone(),s[o].clone()]),this.faces.push(u),this.faceVertexUvs[0].push([a[e].clone(),a[n].clone(),a[o].clone()]);this.computeFaceNormals()},THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry,THREE.TorusGeometry.prototype.clone=function(){var t=this.parameters;return new THREE.TorusGeometry(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)},THREE.TorusKnotGeometry=function(t,e,r,i,n,o,a){function s(t,e,r,i,n){var o=Math.cos(t),a=Math.sin(t);return t*=e/r,o*=i*(2+(e=Math.cos(t)))*.5,a=i*(2+e)*a*.5,i=n*i*Math.sin(t)*.5,new THREE.Vector3(o,a,i)}THREE.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:i,p:n,q:o,heightScale:a},t=t||100,e=e||40,r=r||64,i=i||8,n=n||2,o=o||3,a=a||1;for(var h=Array(r),c=new THREE.Vector3,u=new THREE.Vector3,l=new THREE.Vector3,E=0;E<r;++E){h[E]=Array(i);var p=s(d=E/r*2*n*Math.PI,o,n,t,a),d=s(d+.01,o,n,t,a);for(c.subVectors(d,p),u.addVectors(d,p),l.crossVectors(c,u),u.crossVectors(l,c),l.normalize(),u.normalize(),d=0;d<i;++d){var f=d/i*2*Math.PI,m=-e*Math.cos(f),f=e*Math.sin(f),T=new THREE.Vector3;T.x=p.x+m*u.x+f*l.x,T.y=p.y+m*u.y+f*l.y,T.z=p.z+m*u.z+f*l.z,h[E][d]=this.vertices.push(T)-1}}for(E=0;E<r;++E)for(d=0;d<i;++d)n=(E+1)%r,o=(d+1)%i,t=h[E][d],e=h[n][d],n=h[n][o],o=h[E][o],a=new THREE.Vector2(E/r,d/i),c=new THREE.Vector2((E+1)/r,d/i),u=new THREE.Vector2((E+1)/r,(d+1)/i),l=new THREE.Vector2(E/r,(d+1)/i),this.faces.push(new THREE.Face3(t,e,o)),this.faceVertexUvs[0].push([a,c,l]),this.faces.push(new THREE.Face3(e,n,o)),this.faceVertexUvs[0].push([c.clone(),u,l.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry,THREE.TorusKnotGeometry.prototype.clone=function(){var t=this.parameters;return new THREE.TorusKnotGeometry(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.p,t.q,t.heightScale)},THREE.TubeGeometry=function(t,e,r,i,n,o){THREE.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:t,segments:e,radius:r,radialSegments:i,closed:n,taper:o},e=e||64,r=r||1,i=i||8,n=n||!1,o=o||THREE.TubeGeometry.NoTaper;var a,s,h,c,u,l,E,p=[],d=e+1,f=new THREE.Vector3,m=new THREE.TubeGeometry.FrenetFrames(t,e,n),T=m.normals,g=m.binormals;for(this.tangents=m.tangents,this.normals=T,this.binormals=g,m=0;m<d;m++)for(p[m]=[],h=m/(d-1),E=t.getPointAt(h),a=T[m],s=g[m],u=r*o(h),h=0;h<i;h++)c=h/i*2*Math.PI,l=-u*Math.cos(c),c=u*Math.sin(c),f.copy(E),f.x+=l*a.x+c*s.x,f.y+=l*a.y+c*s.y,f.z+=l*a.z+c*s.z,p[m][h]=this.vertices.push(new THREE.Vector3(f.x,f.y,f.z))-1;for(m=0;m<e;m++)for(h=0;h<i;h++)o=n?(m+1)%e:m+1,d=(h+1)%i,t=p[m][h],r=p[o][h],o=p[o][d],d=p[m][d],f=new THREE.Vector2(m/e,h/i),T=new THREE.Vector2((m+1)/e,h/i),g=new THREE.Vector2((m+1)/e,(h+1)/i),a=new THREE.Vector2(m/e,(h+1)/i),this.faces.push(new THREE.Face3(t,r,d)),this.faceVertexUvs[0].push([f,T,a]),this.faces.push(new THREE.Face3(r,o,d)),this.faceVertexUvs[0].push([T.clone(),g,a.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry,THREE.TubeGeometry.prototype.clone=function(){return new this.constructor(this.parameters.path,this.parameters.segments,this.parameters.radius,this.parameters.radialSegments,this.parameters.closed,this.parameters.taper)},THREE.TubeGeometry.NoTaper=function(t){return 1},THREE.TubeGeometry.SinusoidalTaper=function(t){return Math.sin(Math.PI*t)},THREE.TubeGeometry.FrenetFrames=function(t,e,r){var i,n,o,a=new THREE.Vector3,s=[],h=[],c=[],u=new THREE.Vector3,l=new THREE.Matrix4;for(e+=1,this.tangents=s,this.normals=h,this.binormals=c,i=0;i<e;i++)n=i/(e-1),s[i]=t.getTangentAt(n),s[i].normalize();for(h[0]=new THREE.Vector3,c[0]=new THREE.Vector3,t=Number.MAX_VALUE,i=Math.abs(s[0].x),n=Math.abs(s[0].y),o=Math.abs(s[0].z),i<=t&&(t=i,a.set(1,0,0)),n<=t&&(t=n,a.set(0,1,0)),o<=t&&a.set(0,0,1),u.crossVectors(s[0],a).normalize(),h[0].crossVectors(s[0],u),c[0].crossVectors(s[0],h[0]),i=1;i<e;i++)h[i]=h[i-1].clone(),c[i]=c[i-1].clone(),u.crossVectors(s[i-1],s[i]),u.length()>Number.EPSILON&&(u.normalize(),a=Math.acos(THREE.Math.clamp(s[i-1].dot(s[i]),-1,1)),h[i].applyMatrix4(l.makeRotationAxis(u,a))),c[i].crossVectors(s[i],h[i]);if(r)for(a=Math.acos(THREE.Math.clamp(h[0].dot(h[e-1]),-1,1)),a/=e-1,0<s[0].dot(u.crossVectors(h[0],h[e-1]))&&(a=-a),i=1;i<e;i++)h[i].applyMatrix4(l.makeRotationAxis(s[i],a*i)),c[i].crossVectors(s[i],h[i])},THREE.PolyhedronGeometry=function(t,e,r,i){function p(t){var e=t.normalize().clone();e.index=f.vertices.push(e)-1;var r=Math.atan2(t.z,-t.x)/2/Math.PI+.5;return t=Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5,e.uv=new THREE.Vector2(r,1-t),e}function d(t,e,r,i){i=new THREE.Face3(t.index,e.index,r.index,[t.clone(),e.clone(),r.clone()],void 0,i),f.faces.push(i),E.copy(t).add(e).add(r).divideScalar(3),i=Math.atan2(E.z,-E.x),f.faceVertexUvs[0].push([n(t.uv,t,i),n(e.uv,e,i),n(r.uv,r,i)])}function n(t,e,r){return r<0&&1===t.x&&(t=new THREE.Vector2(t.x-1,t.y)),0===e.x&&0===e.z&&(t=new THREE.Vector2(r/2/Math.PI+.5,t.y)),t.clone()}THREE.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:r,detail:i},r=r||1,i=i||0;for(var f=this,o=0,a=t.length;o<a;o+=3)p(new THREE.Vector3(t[o],t[o+1],t[o+2]));t=this.vertices;for(var s=[],h=o=0,a=e.length;o<a;o+=3,h++){var c=t[e[o]],u=t[e[o+1]],l=t[e[o+2]];s[h]=new THREE.Face3(c.index,u.index,l.index,[c.clone(),u.clone(),l.clone()],void 0,h)}for(var E=new THREE.Vector3,o=0,a=s.length;o<a;o++)!function(t,e){for(var r=Math.pow(2,e),i=p(f.vertices[t.a]),n=p(f.vertices[t.b]),o=p(f.vertices[t.c]),a=[],s=t.materialIndex,h=0;h<=r;h++){a[h]=[];for(var c=p(i.clone().lerp(o,h/r)),u=p(n.clone().lerp(o,h/r)),l=r-h,E=0;E<=l;E++)a[h][E]=0===E&&h===r?c:p(c.clone().lerp(u,E/l))}for(h=0;h<r;h++)for(E=0;E<2*(r-h)-1;E++)i=Math.floor(E/2),0==E%2?d(a[h][i+1],a[h+1][i],a[h][i],s):d(a[h][i+1],a[h+1][i+1],a[h+1][i],s)}(s[o],i);for(o=0,a=this.faceVertexUvs[0].length;o<a;o++)i=(e=this.faceVertexUvs[0][o])[0].x,t=e[1].x,s=e[2].x,h=Math.max(i,t,s),c=Math.min(i,t,s),.9<h&&c<.1&&(i<.2&&(e[0].x+=1),t<.2&&(e[1].x+=1),s<.2&&(e[2].x+=1));for(o=0,a=this.vertices.length;o<a;o++)this.vertices[o].multiplyScalar(r);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,r)},THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry,THREE.PolyhedronGeometry.prototype.clone=function(){var t=this.parameters;return new THREE.PolyhedronGeometry(t.vertices,t.indices,t.radius,t.detail)},THREE.DodecahedronGeometry=function(t,e){var r=(1+Math.sqrt(5))/2,i=1/r;THREE.PolyhedronGeometry.call(this,[-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,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],[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],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}},THREE.DodecahedronGeometry.prototype=Object.create(THREE.PolyhedronGeometry.prototype),THREE.DodecahedronGeometry.prototype.constructor=THREE.DodecahedronGeometry,THREE.DodecahedronGeometry.prototype.clone=function(){var t=this.parameters;return new THREE.DodecahedronGeometry(t.radius,t.detail)},THREE.IcosahedronGeometry=function(t,e){var r=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[-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],[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],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}},THREE.IcosahedronGeometry.prototype=Object.create(THREE.PolyhedronGeometry.prototype),THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry,THREE.IcosahedronGeometry.prototype.clone=function(){var t=this.parameters;return new THREE.IcosahedronGeometry(t.radius,t.detail)},THREE.OctahedronGeometry=function(t,e){THREE.PolyhedronGeometry.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}},THREE.OctahedronGeometry.prototype=Object.create(THREE.PolyhedronGeometry.prototype),THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry,THREE.OctahedronGeometry.prototype.clone=function(){var t=this.parameters;return new THREE.OctahedronGeometry(t.radius,t.detail)},THREE.TetrahedronGeometry=function(t,e){THREE.PolyhedronGeometry.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}},THREE.TetrahedronGeometry.prototype=Object.create(THREE.PolyhedronGeometry.prototype),THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry,THREE.TetrahedronGeometry.prototype.clone=function(){var t=this.parameters;return new THREE.TetrahedronGeometry(t.radius,t.detail)},THREE.ParametricGeometry=function(t,e,r){THREE.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:r};for(var i,n,o,a,s,h,c,u=this.vertices,l=this.faces,E=this.faceVertexUvs[0],p=e+1,d=0;d<=r;d++)for(o=d/r,i=0;i<=e;i++)n=t(n=i/e,o),u.push(n);for(d=0;d<r;d++)for(i=0;i<e;i++)u=(t=d*p+i)+1,o=(d+1)*p+i+1,n=(d+1)*p+i,a=new THREE.Vector2(i/e,d/r),s=new THREE.Vector2((i+1)/e,d/r),h=new THREE.Vector2((i+1)/e,(d+1)/r),c=new THREE.Vector2(i/e,(d+1)/r),l.push(new THREE.Face3(t,u,n)),E.push([a,s,c]),l.push(new THREE.Face3(u,o,n)),E.push([s.clone(),h,c.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ParametricGeometry.prototype.constructor=THREE.ParametricGeometry,THREE.WireframeGeometry=function(t){function e(t,e){return t-e}THREE.BufferGeometry.call(this);var r=[0,0],i={},n=["a","b","c"];if(t instanceof THREE.Geometry){var o=t.vertices,a=t.faces,s=0,h=new Uint32Array(6*a.length);t=0;for(var c=a.length;t<c;t++)for(var u=a[t],l=0;l<3;l++){r[0]=u[n[l]],r[1]=u[n[(l+1)%3]],r.sort(e);var E=r.toString();void 0===i[E]&&(h[2*s]=r[0],h[2*s+1]=r[1],i[E]=!0,s++)}for(r=new Float32Array(6*s),t=0,c=s;t<c;t++)for(l=0;l<2;l++)i=o[h[2*t+l]],r[(s=6*t+3*l)+0]=i.x,r[s+1]=i.y,r[s+2]=i.z;this.addAttribute("position",new THREE.BufferAttribute(r,3))}else if(t instanceof THREE.BufferGeometry){if(null!==t.index){for(c=t.index.array,o=t.attributes.position,(s=0)===(n=t.drawcalls).length&&t.addGroup(0,c.length),h=new Uint32Array(2*c.length),a=0,u=n.length;a<u;++a){l=(t=n[a]).start,E=t.count;for(var p=(t=l)+E;t<p;t+=3)for(l=0;l<3;l++)r[0]=c[t+l],r[1]=c[t+(l+1)%3],r.sort(e),void 0===i[E=r.toString()]&&(h[2*s]=r[0],h[2*s+1]=r[1],i[E]=!0,s++)}for(r=new Float32Array(6*s),t=0,c=s;t<c;t++)for(l=0;l<2;l++)s=6*t+3*l,i=h[2*t+l],r[s+0]=o.getX(i),r[s+1]=o.getY(i),r[s+2]=o.getZ(i)}else for(h=(s=(o=t.attributes.position.array).length/3)/3,r=new Float32Array(6*s),t=0,c=h;t<c;t++)for(l=0;l<3;l++)h=9*t+3*l,r[(s=18*t+6*l)+0]=o[h],r[s+1]=o[h+1],r[s+2]=o[h+2],i=9*t+(l+1)%3*3,r[s+3]=o[i],r[s+4]=o[i+1],r[s+5]=o[i+2];this.addAttribute("position",new THREE.BufferAttribute(r,3))}},THREE.WireframeGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.WireframeGeometry.prototype.constructor=THREE.WireframeGeometry,THREE.AxisHelper=function(t){t=t||1;var e=new Float32Array([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t]),r=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);(t=new THREE.BufferGeometry).addAttribute("position",new THREE.BufferAttribute(e,3)),t.addAttribute("color",new THREE.BufferAttribute(r,3)),e=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors}),THREE.LineSegments.call(this,t,e)},THREE.AxisHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.AxisHelper.prototype.constructor=THREE.AxisHelper,THREE.ArrowHelper=function(){var a=new THREE.Geometry;a.vertices.push(new THREE.Vector3(0,0,0),new THREE.Vector3(0,1,0));var s=new THREE.CylinderGeometry(0,.5,1,5,1);return s.translate(0,-.5,0),function(t,e,r,i,n,o){THREE.Object3D.call(this),void 0===i&&(i=16776960),void 0===r&&(r=1),void 0===n&&(n=.2*r),void 0===o&&(o=.2*n),this.position.copy(e),n<r&&(this.line=new THREE.Line(a,new THREE.LineBasicMaterial({color:i})),this.line.matrixAutoUpdate=!1,this.add(this.line)),this.cone=new THREE.Mesh(s,new THREE.MeshBasicMaterial({color:i})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(r,n,o)}}(),THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype),THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper,THREE.ArrowHelper.prototype.setDirection=function(){var e,r=new THREE.Vector3;return function(t){.99999<t.y?this.quaternion.set(0,0,0,1):t.y<-.99999?this.quaternion.set(1,0,0,0):(r.set(t.z,0,-t.x).normalize(),e=Math.acos(t.y),this.quaternion.setFromAxisAngle(r,e))}}(),THREE.ArrowHelper.prototype.setLength=function(t,e,r){void 0===e&&(e=.2*t),void 0===r&&(r=.2*e),e<t&&(this.line.scale.set(1,t-e,1),this.line.updateMatrix()),this.cone.scale.set(r,e,r),this.cone.position.y=t,this.cone.updateMatrix()},THREE.ArrowHelper.prototype.setColor=function(t){void 0!==this.line&&this.line.material.color.set(t),this.cone.material.color.set(t)},THREE.BoxHelper=function(t){var e=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),i=new THREE.BufferGeometry;i.setIndex(new THREE.BufferAttribute(e,1)),i.addAttribute("position",new THREE.BufferAttribute(r,3)),THREE.LineSegments.call(this,i,new THREE.LineBasicMaterial({color:16776960})),void 0!==t&&this.update(t)},THREE.BoxHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.BoxHelper.prototype.constructor=THREE.BoxHelper,THREE.BoxHelper.prototype.update=function(){var n=new THREE.Box3;return function(t){var e,r,i;n.setFromObject(t),n.empty()||(t=n.min,e=n.max,(i=(r=this.geometry.attributes.position).array)[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=t.x,i[4]=e.y,i[5]=e.z,i[6]=t.x,i[7]=t.y,i[8]=e.z,i[9]=e.x,i[10]=t.y,i[11]=e.z,i[12]=e.x,i[13]=e.y,i[14]=t.z,i[15]=t.x,i[16]=e.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=e.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere())}}(),THREE.BoundingBoxHelper=function(t,e){var r=void 0!==e?e:8947848;this.object=t,this.box=new THREE.Box3,THREE.Mesh.call(this,new THREE.BoxGeometry(1,1,1),new THREE.MeshBasicMaterial({color:r,wireframe:!0}))},THREE.BoundingBoxHelper.prototype=Object.create(THREE.Mesh.prototype),THREE.BoundingBoxHelper.prototype.constructor=THREE.BoundingBoxHelper,THREE.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},THREE.CameraHelper=function(t){function e(t,e,r){i(t,r),i(e,r)}function i(t,e){r.vertices.push(new THREE.Vector3),r.colors.push(new THREE.Color(e)),void 0===o[t]&&(o[t]=[]),o[t].push(r.vertices.length-1)}var r=new THREE.Geometry,n=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors}),o={};e("n1","n2",16755200),e("n2","n4",16755200),e("n4","n3",16755200),e("n3","n1",16755200),e("f1","f2",16755200),e("f2","f4",16755200),e("f4","f3",16755200),e("f3","f1",16755200),e("n1","f1",16755200),e("n2","f2",16755200),e("n3","f3",16755200),e("n4","f4",16755200),e("p","n1",16711680),e("p","n2",16711680),e("p","n3",16711680),e("p","n4",16711680),e("u1","u2",43775),e("u2","u3",43775),e("u3","u1",43775),e("c","t",16777215),e("p","c",3355443),e("cn1","cn2",3355443),e("cn3","cn4",3355443),e("cf1","cf2",3355443),e("cf3","cf4",3355443),THREE.LineSegments.call(this,r,n),this.camera=t,this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()},THREE.CameraHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.CameraHelper.prototype.constructor=THREE.CameraHelper;THREE.CameraHelper.prototype.update=function(){function t(t,e,r,i){if(a.set(e,r,i).unproject(s),void 0!==(t=o[t]))for(e=0,r=t.length;e<r;e++)n.vertices[t[e]].copy(a)}var n,o,a=new THREE.Vector3,s=new THREE.Camera;return function(){n=this.geometry,o=this.pointMap,s.projectionMatrix.copy(this.camera.projectionMatrix),t("c",0,0,-1),t("t",0,0,1),t("n1",-1,-1,-1),t("n2",1,-1,-1),t("n3",-1,1,-1),t("n4",1,1,-1),t("f1",-1,-1,1),t("f2",1,-1,1),t("f3",-1,1,1),t("f4",1,1,1),t("u1",.7,1.1,-1),t("u2",-.7,1.1,-1),t("u3",0,2,-1),t("cf1",-1,0,1),t("cf2",1,0,1),t("cf3",0,-1,1),t("cf4",0,1,1),t("cn1",-1,0,-1),t("cn2",1,0,-1),t("cn3",0,-1,-1),t("cn4",0,1,-1),n.verticesNeedUpdate=!0}}(),THREE.DirectionalLightHelper=function(t,e){THREE.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,e=e||1;var r=new THREE.Geometry;r.vertices.push(new THREE.Vector3(-e,e,0),new THREE.Vector3(e,e,0),new THREE.Vector3(e,-e,0),new THREE.Vector3(-e,-e,0),new THREE.Vector3(-e,e,0));var i=new THREE.LineBasicMaterial({fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new THREE.Line(r,i),this.add(this.lightPlane),(r=new THREE.Geometry).vertices.push(new THREE.Vector3,new THREE.Vector3),(i=new THREE.LineBasicMaterial({fog:!1})).color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new THREE.Line(r,i),this.add(this.targetLine),this.update()},THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype),THREE.DirectionalLightHelper.prototype.constructor=THREE.DirectionalLightHelper,THREE.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},THREE.DirectionalLightHelper.prototype.update=function(){var t=new THREE.Vector3,e=new THREE.Vector3,r=new THREE.Vector3;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),r.subVectors(e,t),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)}}(),THREE.EdgesHelper=function(t,e,r){e=void 0!==e?e:16777215,THREE.LineSegments.call(this,new THREE.EdgesGeometry(t.geometry,r),new THREE.LineBasicMaterial({color:e})),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},THREE.EdgesHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.EdgesHelper.prototype.constructor=THREE.EdgesHelper,THREE.FaceNormalsHelper=function(t,e,r,i){this.object=t,this.size=void 0!==e?e:1,t=void 0!==r?r:16776960,i=void 0!==i?i:1,e=0,(r=this.object.geometry)instanceof THREE.Geometry?e=r.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."),r=new THREE.BufferGeometry,e=new THREE.Float32Attribute(6*e,3),r.addAttribute("position",e),THREE.LineSegments.call(this,r,new THREE.LineBasicMaterial({color:t,linewidth:i})),this.matrixAutoUpdate=!1,this.update()},THREE.FaceNormalsHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.FaceNormalsHelper.prototype.constructor=THREE.FaceNormalsHelper,THREE.FaceNormalsHelper.prototype.update=function(){var c=new THREE.Vector3,u=new THREE.Vector3,l=new THREE.Matrix3;return function(){this.object.updateMatrixWorld(!0),l.getNormalMatrix(this.object.matrixWorld);for(var t=this.object.matrixWorld,e=this.geometry.attributes.position,r=this.object.geometry,i=r.vertices,n=0,o=0,a=(r=r.faces).length;o<a;o++){var s=r[o],h=s.normal;c.copy(i[s.a]).add(i[s.b]).add(i[s.c]).divideScalar(3).applyMatrix4(t),u.copy(h).applyMatrix3(l).normalize().multiplyScalar(this.size).add(c),e.setXYZ(n,c.x,c.y,c.z),n+=1,e.setXYZ(n,u.x,u.y,u.z),n+=1}return e.needsUpdate=!0,this}}(),THREE.GridHelper=function(t,e){var r=new THREE.Geometry,i=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});this.color1=new THREE.Color(4473924),this.color2=new THREE.Color(8947848);for(var n=-t;n<=t;n+=e){r.vertices.push(new THREE.Vector3(-t,0,n),new THREE.Vector3(t,0,n),new THREE.Vector3(n,0,-t),new THREE.Vector3(n,0,t));var o=0===n?this.color1:this.color2;r.colors.push(o,o,o,o)}THREE.LineSegments.call(this,r,i)},THREE.GridHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.GridHelper.prototype.constructor=THREE.GridHelper,THREE.GridHelper.prototype.setColors=function(t,e){this.color1.set(t),this.color2.set(e),this.geometry.colorsNeedUpdate=!0},THREE.HemisphereLightHelper=function(t,e){THREE.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new THREE.Color,new THREE.Color];var r=new THREE.SphereGeometry(e,4,2);r.rotateX(-Math.PI/2);for(var i=0;i<8;i++)r.faces[i].color=this.colors[i<4?0:1];i=new THREE.MeshBasicMaterial({vertexColors:THREE.FaceColors,wireframe:!0}),this.lightSphere=new THREE.Mesh(r,i),this.add(this.lightSphere),this.update()},THREE.HemisphereLightHelper.prototype=Object.create(THREE.Object3D.prototype),THREE.HemisphereLightHelper.prototype.constructor=THREE.HemisphereLightHelper,THREE.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},THREE.HemisphereLightHelper.prototype.update=function(){var t=new THREE.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(t.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),THREE.PointLightHelper=function(t,e){this.light=t,this.light.updateMatrixWorld();var r=new THREE.SphereGeometry(e,4,2),i=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),THREE.Mesh.call(this,r,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},THREE.PointLightHelper.prototype=Object.create(THREE.Mesh.prototype),THREE.PointLightHelper.prototype.constructor=THREE.PointLightHelper,THREE.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},THREE.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},THREE.SkeletonHelper=function(t){this.bones=this.getBoneList(t);for(var e=new THREE.Geometry,r=0;r<this.bones.length;r++)this.bones[r].parent instanceof THREE.Bone&&(e.vertices.push(new THREE.Vector3),e.vertices.push(new THREE.Vector3),e.colors.push(new THREE.Color(0,0,1)),e.colors.push(new THREE.Color(0,1,0)));e.dynamic=!0,r=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0}),THREE.LineSegments.call(this,e,r),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()},THREE.SkeletonHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.SkeletonHelper.prototype.constructor=THREE.SkeletonHelper,THREE.SkeletonHelper.prototype.getBoneList=function(t){var e=[];t instanceof THREE.Bone&&e.push(t);for(var r=0;r<t.children.length;r++)e.push.apply(e,this.getBoneList(t.children[r]));return e},THREE.SkeletonHelper.prototype.update=function(){for(var t=this.geometry,e=(new THREE.Matrix4).getInverse(this.root.matrixWorld),r=new THREE.Matrix4,i=0,n=0;n<this.bones.length;n++){var o=this.bones[n];o.parent instanceof THREE.Bone&&(r.multiplyMatrices(e,o.matrixWorld),t.vertices[i].setFromMatrixPosition(r),r.multiplyMatrices(e,o.parent.matrixWorld),t.vertices[i+1].setFromMatrixPosition(r),i+=2)}t.verticesNeedUpdate=!0,t.computeBoundingSphere()},THREE.SpotLightHelper=function(t){THREE.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,(t=new THREE.CylinderGeometry(0,1,1,8,1,!0)).translate(0,-.5,0),t.rotateX(-Math.PI/2);var e=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new THREE.Mesh(t,e),this.add(this.cone),this.update()},THREE.SpotLightHelper.prototype=Object.create(THREE.Object3D.prototype),THREE.SpotLightHelper.prototype.constructor=THREE.SpotLightHelper,THREE.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},THREE.SpotLightHelper.prototype.update=function(){var r=new THREE.Vector3,i=new THREE.Vector3;return function(){var t=this.light.distance?this.light.distance:1e4,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),r.setFromMatrixPosition(this.light.matrixWorld),i.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(i.sub(r)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),THREE.VertexNormalsHelper=function(t,e,r,i){this.object=t,this.size=void 0!==e?e:1,t=void 0!==r?r:16711680,i=void 0!==i?i:1,e=0,(r=this.object.geometry)instanceof THREE.Geometry?e=3*r.faces.length:r instanceof THREE.BufferGeometry&&(e=r.attributes.normal.count),r=new THREE.BufferGeometry,e=new THREE.Float32Attribute(6*e,3),r.addAttribute("position",e),THREE.LineSegments.call(this,r,new THREE.LineBasicMaterial({color:t,linewidth:i})),this.matrixAutoUpdate=!1,this.update()},THREE.VertexNormalsHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.VertexNormalsHelper.prototype.constructor=THREE.VertexNormalsHelper,THREE.VertexNormalsHelper.prototype.update=function(){var E=new THREE.Vector3,p=new THREE.Vector3,d=new THREE.Matrix3;return function(){var t=["a","b","c"];this.object.updateMatrixWorld(!0),d.getNormalMatrix(this.object.matrixWorld);var e=this.object.matrixWorld,r=this.geometry.attributes.position,i=this.object.geometry;if(i instanceof THREE.Geometry)for(var n=i.vertices,o=i.faces,a=i=0,s=o.length;a<s;a++)for(var h=o[a],c=0,u=h.vertexNormals.length;c<u;c++){var l=h.vertexNormals[c];E.copy(n[h[t[c]]]).applyMatrix4(e),p.copy(l).applyMatrix3(d).normalize().multiplyScalar(this.size).add(E),r.setXYZ(i,E.x,E.y,E.z),i+=1,r.setXYZ(i,p.x,p.y,p.z),i+=1}else if(i instanceof THREE.BufferGeometry)for(t=i.attributes.position,n=i.attributes.normal,c=i=0,u=t.count;c<u;c++)E.set(t.getX(c),t.getY(c),t.getZ(c)).applyMatrix4(e),p.set(n.getX(c),n.getY(c),n.getZ(c)),p.applyMatrix3(d).normalize().multiplyScalar(this.size).add(E),r.setXYZ(i,E.x,E.y,E.z),i+=1,r.setXYZ(i,p.x,p.y,p.z),i+=1;return r.needsUpdate=!0,this}}(),THREE.WireframeHelper=function(t,e){var r=void 0!==e?e:16777215;THREE.LineSegments.call(this,new THREE.WireframeGeometry(t.geometry),new THREE.LineBasicMaterial({color:r})),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},THREE.WireframeHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.WireframeHelper.prototype.constructor=THREE.WireframeHelper,THREE.ImmediateRenderObject=function(t){THREE.Object3D.call(this),this.material=t,this.render=function(t){}},THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype),THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject,THREE.MorphBlendMesh=function(t,e){THREE.Mesh.call(this,t,e),this.animationsMap={},this.animationsList=[];var r=this.geometry.morphTargets.length;this.createAnimation("__default",0,r-1,+r),this.setAnimationWeight("__default",1)},THREE.MorphBlendMesh.prototype=Object.create(THREE.Mesh.prototype),THREE.MorphBlendMesh.prototype.constructor=THREE.MorphBlendMesh,THREE.MorphBlendMesh.prototype.createAnimation=function(t,e,r,i){e={start:e,end:r,length:r-e+1,fps:i,duration:(r-e)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1},this.animationsMap[t]=e,this.animationsList.push(e)},THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(t){for(var e,r=/([a-z]+)_?(\d+)/,i={},n=this.geometry,o=0,a=n.morphTargets.length;o<a;o++){var s,h=n.morphTargets[o].name.match(r);h&&1<h.length&&(i[s=h[1]]||(i[s]={start:1/0,end:-1/0}),o<(h=i[s]).start&&(h.start=o),o>h.end&&(h.end=o),e=e||s)}for(s in i)h=i[s],this.createAnimation(s,h.start,h.end,t);this.firstAnimation=e},THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(t){(t=this.animationsMap[t])&&(t.direction=1,t.directionBackwards=!1)},THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(t){(t=this.animationsMap[t])&&(t.direction=-1,t.directionBackwards=!0)},THREE.MorphBlendMesh.prototype.setAnimationFPS=function(t,e){var r=this.animationsMap[t];r&&(r.fps=e,r.duration=(r.end-r.start)/r.fps)},THREE.MorphBlendMesh.prototype.setAnimationDuration=function(t,e){var r=this.animationsMap[t];r&&(r.duration=e,r.fps=(r.end-r.start)/r.duration)},THREE.MorphBlendMesh.prototype.setAnimationWeight=function(t,e){var r=this.animationsMap[t];r&&(r.weight=e)},THREE.MorphBlendMesh.prototype.setAnimationTime=function(t,e){var r=this.animationsMap[t];r&&(r.time=e)},THREE.MorphBlendMesh.prototype.getAnimationTime=function(t){var e=0;return(t=this.animationsMap[t])&&(e=t.time),e},THREE.MorphBlendMesh.prototype.getAnimationDuration=function(t){var e=-1;return(t=this.animationsMap[t])&&(e=t.duration),e},THREE.MorphBlendMesh.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},THREE.MorphBlendMesh.prototype.stopAnimation=function(t){(t=this.animationsMap[t])&&(t.active=!1)},THREE.MorphBlendMesh.prototype.update=function(t){for(var e=0,r=this.animationsList.length;e<r;e++){var i,n,o,a=this.animationsList[e];a.active&&(i=a.duration/a.length,a.time+=a.direction*t,a.mirroredLoop?(a.time>a.duration||a.time<0)&&(a.direction*=-1,a.time>a.duration&&(a.time=a.duration,a.directionBackwards=!0),a.time<0&&(a.time=0,a.directionBackwards=!1)):(a.time%=a.duration,a.time<0&&(a.time+=a.duration)),n=a.start+THREE.Math.clamp(Math.floor(a.time/i),0,a.length-1),o=a.weight,n!==a.currentFrame&&(this.morphTargetInfluences[a.lastFrame]=0,this.morphTargetInfluences[a.currentFrame]=+o,this.morphTargetInfluences[n]=0,a.lastFrame=a.currentFrame,a.currentFrame=n),i=a.time%i/i,a.directionBackwards&&(i=1-i),a.currentFrame!==a.lastFrame?(this.morphTargetInfluences[a.currentFrame]=i*o,this.morphTargetInfluences[a.lastFrame]=(1-i)*o):this.morphTargetInfluences[a.currentFrame]=o)}};