File: /var/www/html/wpprm/wp-content/themes/ronneby/assets/js/three.min.js
"use strict";var THREE={REVISION:"71"};"object"==typeof module&&(module.exports=THREE),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:0<t?1:+t}),THREE.log=function(){console.log.apply(console,arguments)},THREE.warn=function(){console.warn.apply(console,arguments)},THREE.error=function(){console.error.apply(console,arguments)},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.NoShading=0,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.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.Projector=function(){THREE.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){THREE.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){THREE.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(t,e){THREE.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},THREE.CanvasRenderer=function(){THREE.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.setRGB(t,arguments[1],arguments[2]):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(t,e,r){if(0===e)this.r=this.g=this.b=r;else{var i=function(t,e,r){return r<0&&(r+=1),1<r&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+6*(e-t)*(2/3-r):t};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)}return this},setStyle:function(t){return/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(t)?(t=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(t),this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,this):/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(t)?(t=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(t),this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,this):/^\#([0-9a-f]{6})$/i.test(t)?(t=/^\#([0-9a-f]{6})$/i.exec(t),this.setHex(parseInt(t[1],16)),this):/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(t)?(t=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(t),this.setHex(parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3],16)),this):/^(\w+)$/i.test(t)?(this.setHex(THREE.ColorKeywords[t]),this):void 0},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){return this.r=t[0],this.g=t[1],this.b=t[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},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}},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,_x:0,_y:0,_z:0,_w:0,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},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);return"XYZ"===t.order?(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"===t.order?(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"===t.order?(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"===t.order?(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"===t.order?(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"===t.order&&(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=(r=t.elements)[0];t=r[4];var r,i=r[8],n=r[1],o=r[5],a=r[9],s=r[2],h=r[6],l=e+o+(r=r[10]);return 0<l?(e=.5/Math.sqrt(l+1),this._w=.25/e,this._x=(h-a)*e,this._y=(i-s)*e,this._z=(n-t)*e):o<e&&r<e?(e=2*Math.sqrt(1+e-o-r),this._w=(h-a)/e,this._x=.25*e,this._y=(t+n)/e,this._z=(i+s)/e):r<o?(e=2*Math.sqrt(1+o-e-r),this._w=(i-s)/e,this._x=(t+n)/e,this._y=.25*e,this._z=(a+h)/e):(e=2*Math.sqrt(1+r-e-o),this._w=(n-t)/e,this._x=(i+s)/e,this._y=(a+h)/e,this._z=.25*e),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?(THREE.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,l=e._w;return this._x=r*l+o*a+i*h-n*s,this._y=i*l+o*s+n*a-r*h,this._z=n*l+o*h+r*s-i*a,this._w=o*l-r*a-i*s-n*h,this.onChangeCallback(),this},multiplyVector3:function(t){return THREE.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(){},clone:function(){return new THREE.Quaternion(this._x,this._y,this._z,this._w)}},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,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)}},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(THREE.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},sub:function(t,e){return void 0!==e?(THREE.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 this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return 0!==t?(t=1/t,this.x*=t,this.y*=t):this.y=this.x=0,this},min:function(t){return this.x>t.x&&(this.x=t.x),this.y>t.y&&(this.y=t.y),this},max:function(t){return this.x<t.x&&(this.x=t.x),this.y<t.y&&(this.y=t.y),this},clamp:function(t,e){return this.x<t.x?this.x=t.x:this.x>e.x&&(this.x=e.x),this.y<t.y?this.y=t.y:this.y>e.y&&(this.y=e.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)}}(),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)},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){var e=this.length();return 0!==e&&t!==e&&this.multiplyScalar(t/e),this},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},clone:function(){return new THREE.Vector2(this.x,this.y)}},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)}},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?(THREE.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},sub:function(t,e){return void 0!==e?(THREE.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?(THREE.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 this.x*=t,this.y*=t,this.z*=t,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&&THREE.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,l=t*i+n*r-o*e;e=-n*e-o*r-a*i;return this.x=s*t+e*-n+h*-a-l*-o,this.y=h*t+e*-o+l*-n-s*-a,this.z=l*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 0!==t?(t=1/t,this.x*=t,this.y*=t,this.z*=t):this.z=this.y=this.x=0,this},min:function(t){return this.x>t.x&&(this.x=t.x),this.y>t.y&&(this.y=t.y),this.z>t.z&&(this.z=t.z),this},max:function(t){return this.x<t.x&&(this.x=t.x),this.y<t.y&&(this.y=t.y),this.z<t.z&&(this.z=t.z),this},clamp:function(t,e){return this.x<t.x?this.x=t.x:this.x>e.x&&(this.x=e.x),this.y<t.y?this.y=t.y:this.y>e.y&&(this.y=e.y),this.z<t.z?this.z=t.z:this.z>e.z&&(this.z=e.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)}}(),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){var e=this.length();return 0!==e&&t!==e&&this.multiplyScalar(t/e),this},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 THREE.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(t,e){THREE.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(t,e){THREE.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return THREE.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return THREE.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return THREE.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[r+1],this.z=i[r+2],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},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}},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)}},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?(THREE.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},sub:function(t,e){return void 0!==e?(THREE.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 this.x*=t,this.y*=t,this.z*=t,this.w*=t,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 0!==t?(t=1/t,this.x*=t,this.y*=t,this.z*=t,this.w*=t):(this.z=this.y=this.x=0,this.w=1),this},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,r,i,n=(t=t.elements)[0];i=t[4];var o=t[8],a=t[1],s=t[5],h=t[9];r=t[2],e=t[6];var l=t[10];return Math.abs(i-a)<.01&&Math.abs(o-r)<.01&&Math.abs(h-e)<.01?Math.abs(i+a)<.1&&Math.abs(o+r)<.1&&Math.abs(h+e)<.1&&Math.abs(n+s+l-3)<.1?this.set(1,0,0,0):(t=Math.PI,l=(l+1)/2,i=(i+a)/4,o=(o+r)/4,h=(h+e)/4,(s=(s+1)/2)<(n=(n+1)/2)&&l<n?n<.01?(e=0,i=r=.707106781):(r=i/(e=Math.sqrt(n)),i=o/e):l<s?s<.01?(r=0,i=e=.707106781):(e=i/(r=Math.sqrt(s)),i=h/r):l<.01?(r=e=.707106781,i=0):(e=o/(i=Math.sqrt(l)),r=h/i),this.set(e,r,i,t)):(t=Math.sqrt((e-h)*(e-h)+(o-r)*(o-r)+(a-i)*(a-i)),Math.abs(t)<.001&&(t=1),this.x=(e-h)/t,this.y=(o-r)/t,this.z=(a-i)/t,this.w=Math.acos((n+s+l-1)/2)),this},min:function(t){return this.x>t.x&&(this.x=t.x),this.y>t.y&&(this.y=t.y),this.z>t.z&&(this.z=t.z),this.w>t.w&&(this.w=t.w),this},max:function(t){return this.x<t.x&&(this.x=t.x),this.y<t.y&&(this.y=t.y),this.z<t.z&&(this.z=t.z),this.w<t.w&&(this.w=t.w),this},clamp:function(t,e){return this.x<t.x?this.x=t.x:this.x>e.x&&(this.x=e.x),this.y<t.y?this.y=t.y:this.y>e.y&&(this.y=e.y),this.z<t.z?this.z=t.z:this.z>e.z&&(this.z=e.z),this.w<t.w?this.w=t.w:this.w>e.w&&(this.w=e.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){var e=this.length();return 0!==e&&t!==e&&this.multiplyScalar(t/e),this},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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}},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,_x:0,_y:0,_z:0,_order:THREE.Euler.DefaultOrder,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},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=(u=t.elements)[0];var n=u[4],o=u[8],a=u[1],s=u[5],h=u[9],l=u[2],c=u[6],u=u[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(i(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(-h,u),this._z=Math.atan2(-n,t)):(this._x=Math.atan2(c,s),this._z=0)):"YXZ"===e?(this._x=Math.asin(-i(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(o,u),this._z=Math.atan2(a,s)):(this._y=Math.atan2(-l,t),this._z=0)):"ZXY"===e?(this._x=Math.asin(i(c,-1,1)),Math.abs(c)<.99999?(this._y=Math.atan2(-l,u),this._z=Math.atan2(-n,s)):(this._y=0,this._z=Math.atan2(a,t))):"ZYX"===e?(this._y=Math.asin(-i(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(c,u),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(-l,t)):(this._x=0,this._y=Math.atan2(o,u))):"XZY"===e?(this._z=Math.asin(-i(n,-1,1)),Math.abs(n)<.99999?(this._x=Math.atan2(c,s),this._y=Math.atan2(o,t)):(this._x=Math.atan2(-h,u),this._y=0)):THREE.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(){},clone:function(){return new THREE.Euler(this._x,this._y,this._z,this._order)}},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},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)},clone:function(){return(new THREE.Line3).copy(this)}},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}}(),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)},clone:function(){return(new THREE.Box2).copy(this)}},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}}(),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)},clone:function(){return(new THREE.Box3).copy(this)}},THREE.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),0<arguments.length&&THREE.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 l=this.elements;return l[0]=t,l[3]=e,l[6]=r,l[1]=i,l[4]=n,l[7]=o,l[2]=a,l[5]=s,l[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},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 THREE.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){return THREE.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToVector3Array:function(){var n=new THREE.Vector3;return function(t,e,r){void 0===e&&(e=0),void 0===r&&(r=t.length);for(var i=0;i<r;i+=3,e+=3)n.x=t[e],n.y=t[e+1],n.z=t[e+2],n.applyMatrix3(this),t[e]=n.x,t[e+1]=n.y,t[e+2]=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,e=(t=this.elements)[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])){if(e)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");return THREE.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0"),this.identity(),this}return this.multiplyScalar(1/r),this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,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]]},clone:function(){return(new THREE.Matrix3).fromArray(this.elements)}},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&&THREE.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,l,c,u,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]=l,m[10]=c,m[14]=u,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},copy:function(t){return this.elements.set(t.elements),this},extractPosition:function(t){return THREE.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=new THREE.Vector3;return function(t){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&&THREE.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,r=t.x,i=t.y,n=t.z,o=Math.cos(r),a=(r=Math.sin(r),Math.cos(i)),s=(i=Math.sin(i),Math.cos(n));n=Math.sin(n);if("XYZ"===t.order){t=o*s;var h=o*n,l=r*s,c=r*n;e[0]=a*s,e[4]=-a*n,e[8]=i,e[1]=h+l*i,e[5]=t-c*i,e[9]=-r*a,e[2]=c-t*i,e[6]=l+h*i,e[10]=o*a}else"YXZ"===t.order?(t=a*s,h=a*n,l=i*s,c=i*n,e[0]=t+c*r,e[4]=l*r-h,e[8]=o*i,e[1]=o*n,e[5]=o*s,e[9]=-r,e[2]=h*r-l,e[6]=c+t*r,e[10]=o*a):"ZXY"===t.order?(t=a*s,h=a*n,l=i*s,c=i*n,e[0]=t-c*r,e[4]=-o*n,e[8]=l+h*r,e[1]=h+l*r,e[5]=o*s,e[9]=c-t*r,e[2]=-o*i,e[6]=r,e[10]=o*a):"ZYX"===t.order?(t=o*s,h=o*n,l=r*s,c=r*n,e[0]=a*s,e[4]=l*i-h,e[8]=t*i+c,e[1]=a*n,e[5]=c*i+t,e[9]=h*i-l,e[2]=-i,e[6]=r*a,e[10]=o*a):"YZX"===t.order?(t=o*a,h=o*i,l=r*a,c=r*i,e[0]=a*s,e[4]=c-t*n,e[8]=l*n+h,e[1]=n,e[5]=o*s,e[9]=-r*s,e[2]=-i*s,e[6]=h*n+l,e[10]=t-c*n):"XZY"===t.order&&(t=o*a,h=o*i,l=r*a,c=r*i,e[0]=a*s,e[4]=-n,e[8]=i*s,e[1]=t*n+c,e[5]=o*s,e[9]=h*n-l,e[2]=l*n-h,e[6]=r*s,e[10]=c*n+t);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},setRotationFromQuaternion:function(t){return THREE.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*(l=r+r);var s=r*(c=i+i),h=(r=r*a,i*c),l=(i=i*a,n=n*a,o*l),c=o*c;o*=a;return e[0]=1-(h+n),e[4]=s-o,e[8]=r+c,e[1]=s+o,e[5]=1-(t+n),e[9]=i-l,e[2]=r-c,e[6]=i+l,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=new THREE.Vector3,o=new THREE.Vector3,a=new THREE.Vector3;return function(t,e,r){var i=this.elements;return a.subVectors(t,e).normalize(),0===a.length()&&(a.z=1),n.crossVectors(r,a).normalize(),0===n.length()&&(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?(THREE.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],l=r[1],c=r[5],u=r[9],E=r[13],p=r[2],d=r[6],f=r[10],m=r[14],T=r[3],g=r[7],R=r[11],y=(r=r[15],i[0]),v=i[4],H=i[8],x=i[12],b=i[1],_=i[5],w=i[9],M=i[13],S=i[2],A=i[6],C=i[10],L=i[14],P=i[3],F=i[7],U=i[11];i=i[15];return n[0]=o*y+a*b+s*S+h*P,n[4]=o*v+a*_+s*A+h*F,n[8]=o*H+a*w+s*C+h*U,n[12]=o*x+a*M+s*L+h*i,n[1]=l*y+c*b+u*S+E*P,n[5]=l*v+c*_+u*A+E*F,n[9]=l*H+c*w+u*C+E*U,n[13]=l*x+c*M+u*L+E*i,n[2]=p*y+d*b+f*S+m*P,n[6]=p*v+d*_+f*A+m*F,n[10]=p*H+d*w+f*C+m*U,n[14]=p*x+d*M+f*L+m*i,n[3]=T*y+g*b+R*S+r*P,n[7]=T*v+g*_+R*A+r*F,n[11]=T*H+g*w+R*C+r*U,n[15]=T*x+g*M+R*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 THREE.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),t.applyProjection(this)},multiplyVector4:function(t){return THREE.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){return THREE.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToVector3Array:function(){var n=new THREE.Vector3;return function(t,e,r){void 0===e&&(e=0),void 0===r&&(r=t.length);for(var i=0;i<r;i+=3,e+=3)n.x=t[e],n.y=t[e+1],n.z=t[e+2],n.applyMatrix4(this),t[e]=n.x,t[e+1]=n.y,t[e+2]=n.z;return t}}(),rotateAxis:function(t){THREE.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return THREE.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],l=t[2],c=t[6],u=t[10],E=t[14];return t[3]*(+n*s*c-i*h*c-n*a*u+r*h*u+i*a*E-r*s*E)+t[7]*(+e*s*E-e*h*u+n*o*u-i*o*E+i*h*l-n*s*l)+t[11]*(+e*h*c-e*a*E-n*o*c+r*o*E+n*a*l-r*h*l)+t[15]*(-i*a*l-e*s*c+e*a*u+i*o*c-r*o*u+r*s*l)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,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=new THREE.Vector3;return function(){THREE.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],l=g[9],c=g[13],u=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]=l*d*m-c*p*m+c*E*T-h*d*T-l*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*c*m-a*l*m+a*h*T-n*c*T-o*h*g+n*l*g,r[12]=a*l*E-o*c*E-a*h*p+n*c*p+o*h*d-n*l*d,r[1]=c*p*f-l*d*f-c*u*T+s*d*T+l*u*g-s*p*g,r[5]=o*d*f-a*p*f+a*u*T-i*d*T-o*u*g+i*p*g,r[9]=a*l*f-o*c*f-a*s*T+i*c*T+o*s*g-i*l*g,r[13]=o*c*u-a*l*u+a*s*p-i*c*p-o*s*d+i*l*d,r[2]=h*d*f-c*E*f+c*u*m-s*d*m-h*u*g+s*E*g,r[6]=a*E*f-n*d*f-a*u*m+i*d*m+n*u*g-i*E*g,r[10]=n*c*f-a*h*f+a*s*m-i*c*m-n*s*g+i*h*g,r[14]=a*h*u-n*c*u-a*s*E+i*c*E+n*s*d-i*h*d,r[3]=l*E*f-h*p*f-l*u*m+s*p*m+h*u*T-s*E*T,r[7]=n*p*f-o*E*f+o*u*m-i*p*m-n*u*T+i*E*T,r[11]=o*h*f-n*l*f-o*s*m+i*l*m+n*s*T-i*h*T,r[15]=n*l*u-o*h*u+o*s*E-i*l*E-n*s*p+i*h*p,0==(r=i*r[0]+s*r[4]+u*r[8]+f*r[12])){if(e)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");return THREE.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"),this.identity(),this}return this.multiplyScalar(1/r),this},translate:function(t){THREE.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(t){THREE.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(t){THREE.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(t){THREE.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(t,e){THREE.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],Math.max(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,l=n*a;return this.set(h*o+r,h*a-i*s,h*s+i*a,0,h*a+i*s,l*a+r,l*s-i*o,0,h*s-i*a,l*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=new THREE.Vector3,l=new THREE.Matrix4;return function(t,e,r){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],l.elements.set(this.elements),t=1/n;i=1/o;var s=1/a;return l.elements[0]*=t,l.elements[1]*=t,l.elements[2]*=t,l.elements[4]*=i,l.elements[5]*=i,l.elements[6]*=i,l.elements[8]*=s,l.elements[9]*=s,l.elements[10]*=s,e.setFromRotationMatrix(l),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,l=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/l,a[14]=-(o+n)/l,a[3]=0,a[7]=0,a[11]=0,a[15]=1,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],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]},clone:function(){return(new THREE.Matrix4).fromArray(this.elements)}},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},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(){var r=new THREE.Vector3;return function(t){var e=r.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceTo(t):(r.copy(this.direction).multiplyScalar(e).add(this.origin),r.distanceTo(t))}}(),distanceSqToSegment:function(){var u=new THREE.Vector3,E=new THREE.Vector3,p=new THREE.Vector3;return function(t,e,r,i){u.copy(t).add(e).multiplyScalar(.5),E.copy(e).sub(t).normalize(),p.copy(this.origin).sub(u);var n,o=.5*t.distanceTo(e),a=-this.direction.dot(E),s=p.dot(this.direction),h=-p.dot(E),l=p.lengthSq(),c=Math.abs(1-a*a);return 0<c?(e=a*s-h,n=o*c,0<=(t=a*h-s)?-n<=e?e<=n?a=(t*=o=1/c)*(t+a*(e*=o)+2*s)+e*(a*t+e+2*h)+l:(e=o,a=-(t=Math.max(0,-(a*e+s)))*t+e*(e+2*h)+l):(e=-o,a=-(t=Math.max(0,-(a*e+s)))*t+e*(e+2*h)+l):e<=-n?a=-(t=Math.max(0,-(-a*o+s)))*t+(e=0<t?-o:Math.min(Math.max(-o,-h),o))*(e+2*h)+l:e<=n?(t=0,a=(e=Math.min(Math.max(-o,-h),o))*(e+2*h)+l):a=-(t=Math.max(0,-(a*o+s)))*t+(e=0<t?o:Math.min(Math.max(-o,-h),o))*(e+2*h)+l):(e=0<a?-o:o,a=-(t=Math.max(0,-(a*e+s)))*t+e*(e+2*h)+l),r&&r.copy(this.direction).multiplyScalar(t).add(this.origin),i&&i.copy(E).multiplyScalar(e).add(u),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,o,a;i=1/this.direction.x,o=1/this.direction.y,a=1/this.direction.z;var s=this.origin;return 0<=i?(r=(t.min.x-s.x)*i,i*=t.max.x-s.x):(r=(t.max.x-s.x)*i,i*=t.min.x-s.x),0<=o?(n=(t.min.y-s.y)*o,o*=t.max.y-s.y):(n=(t.max.y-s.y)*o,o*=t.min.y-s.y),o<r||i<n?null:((r<n||r!=r)&&(r=n),(o<i||i!=i)&&(i=o),0<=a?(n=(t.min.z-s.z)*a,a*=t.max.z-s.z):(n=(t.max.z-s.z)*a,a*=t.min.z-s.z),a<r||i<n?null:((r<n||r!=r)&&(r=n),(a<i||i!=i)&&(i=a),i<0?null:this.at(0<=r?r:i,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?null:(r=i*this.direction.dot(a.cross(o)))<0||e<t+r?null:(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)},clone:function(){return(new THREE.Ray).copy(this)}},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}}(),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},clone:function(){return(new THREE.Sphere).copy(this)}},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},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],l=m[8],c=m[9],u=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-l,m-p).normalize(),e[1].setComponents(n+t,h+o,E+l,m+p).normalize(),e[2].setComponents(n+r,h+a,E+c,m+d).normalize(),e[3].setComponents(n-r,h-a,E-c,m-d).normalize(),e[4].setComponents(n-i,h-s,E-u,m-f).normalize(),e[5].setComponents(n+i,h+s,E+u,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},clone:function(){return(new THREE.Frustum).copy(this)}},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}}(),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),i=(r=n.copy(this.normal).applyMatrix3(r),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},clone:function(){return(new THREE.Plane).copy(this)}},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 t<e?e:r<t?r:t},clampBottom:function(t,e){return t<e?e:t},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 Math.floor(this.randFloat(t,e))},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},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,l,c,u=[],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,u[0]=0===i?i:i-1,u[1]=i,u[2]=i>this.points.length-2?this.points.length-1:i+1,u[3]=i>this.points.length-3?this.points.length-1:i+2,s=this.points[u[0]],h=this.points[u[1]],l=this.points[u[2]],c=this.points[u[3]],a=n*(o=n*n),E.x=e(s.x,h.x,l.x,c.x,n,o,a),E.y=e(s.y,h.y,l.y,c.y,n,o,a),E.z=e(s.z,h.z,l.z,c.z,n,o,a),E},this.getControlPointsArray=function(){var t,e,r=this.points.length,i=[];for(t=0;t<r;t++)e=this.points[t],i[t]=[e.x,e.y,e.z];return i},this.getLength=function(t){var e,r,i,n=e=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,l=this.getLength();for(s.push(h.copy(this.points[0]).clone()),e=1;e<this.points.length;e++){for(r=l.chunks[e]-l.chunks[e-1],a=Math.ceil(t*r/l.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,l=new THREE.Vector3;return function(t,e,r,i,n){s.subVectors(i,e),h.subVectors(r,e),l.subVectors(t,e),t=s.dot(s),e=s.dot(h),r=s.dot(l);var o=h.dot(h);i=h.dot(l);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},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)},clone:function(){return(new THREE.Triangle).copy(this)}},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=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now(),this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running&&this.start(),this.running){var e=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now();t=.001*(e-this.oldTime);this.oldTime=e,this.elapsedTime+=t}return t}},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){if(void 0!==this._listeners){var r=this._listeners[t];if(void 0!==r){var i=r.indexOf(e);-1!==i&&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(o){o.Raycaster=function(t,e,r,i){this.ray=new o.Ray(t,e),this.near=r||0,this.far=i||1/0,this.params={Sprite:{},Mesh:{},PointCloud:{threshold:1},LOD:{},Line:{}}};var a=function(t,e){return t.distance-e.distance},s=function(t,e,r,i){if(t.raycast(e,r),!0===i){i=0;for(var n=(t=t.children).length;i<n;i++)s(t[i],e,r,!0)}};o.Raycaster.prototype={constructor:o.Raycaster,precision:1e-4,linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e instanceof o.PerspectiveCamera?(this.ray.origin.copy(e.position),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(e.position).normalize()):e instanceof o.OrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)):o.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e){var r=[];return s(t,this,r,e),r.sort(a),r},intersectObjects:function(t,e){var r=[];if(!1==t instanceof Array)return o.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),r;for(var i=0,n=t.length;i<n;i++)s(t[i],this,r,e);return r.sort(a),r}}}(THREE),THREE.Object3D=function(){Object.defineProperty(this,"id",{value:THREE.Object3DIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=void 0,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}}),this.rotationAutoUpdate=!0,this.matrix=new THREE.Matrix4,this.matrixWorld=new THREE.Matrix4,this.matrixAutoUpdate=!0,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.prototype={constructor:THREE.Object3D,get eulerOrder(){return THREE.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order},set eulerOrder(t){THREE.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order=t},get useQuaternion(){THREE.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(t){THREE.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},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 THREE.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?THREE.error("THREE.Object3D.add: object can't be added as a child of itself.",t):t instanceof THREE.Object3D?(void 0!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):THREE.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=void 0,t.dispatchEvent({type:"removed"}),this.children.splice(e,1))},getChildByName:function(t){return THREE.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=0,r=this.children.length;e<r;e++)this.children[e].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=0,r=this.children.length;e<r;e++)this.children[e].traverseVisible(t)}},traverseAncestors:function(t){this.parent&&(t(this.parent),this.parent.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||(void 0===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(){var n={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}},o={},r={},a=function(t){if(void 0===n.materials&&(n.materials=[]),void 0===r[t.uuid]){var e=t.toJSON();delete e.metadata,r[t.uuid]=e,n.materials.push(e)}return t.uuid},s=function(t){var e={};if(e.uuid=t.uuid,e.type=t.type,""!==t.name&&(e.name=t.name),"{}"!==JSON.stringify(t.userData)&&(e.userData=t.userData),!0!==t.visible&&(e.visible=t.visible),t instanceof THREE.PerspectiveCamera)e.fov=t.fov,e.aspect=t.aspect,e.near=t.near,e.far=t.far;else if(t instanceof THREE.OrthographicCamera)e.left=t.left,e.right=t.right,e.top=t.top,e.bottom=t.bottom,e.near=t.near,e.far=t.far;else if(t instanceof THREE.AmbientLight)e.color=t.color.getHex();else if(t instanceof THREE.DirectionalLight)e.color=t.color.getHex(),e.intensity=t.intensity;else if(t instanceof THREE.PointLight)e.color=t.color.getHex(),e.intensity=t.intensity,e.distance=t.distance,e.decay=t.decay;else if(t instanceof THREE.SpotLight)e.color=t.color.getHex(),e.intensity=t.intensity,e.distance=t.distance,e.angle=t.angle,e.exponent=t.exponent,e.decay=t.decay;else if(t instanceof THREE.HemisphereLight)e.color=t.color.getHex(),e.groundColor=t.groundColor.getHex();else if(t instanceof THREE.Mesh||t instanceof THREE.Line||t instanceof THREE.PointCloud){var r=t.geometry;if(void 0===n.geometries&&(n.geometries=[]),void 0===o[r.uuid]){var i=r.toJSON();delete i.metadata,o[r.uuid]=i,n.geometries.push(i)}e.geometry=r.uuid,e.material=a(t.material),t instanceof THREE.Line&&(e.mode=t.mode)}else t instanceof THREE.Sprite&&(e.material=a(t.material));if(e.matrix=t.matrix.toArray(),0<t.children.length)for(e.children=[],r=0;r<t.children.length;r++)e.children.push(s(t.children[r]));return e};return n.object=s(this),n},clone:function(t,e){if(void 0===t&&(t=new THREE.Object3D),void 0===e&&(e=!0),t.name=this.name,t.up.copy(this.up),t.position.copy(this.position),t.quaternion.copy(this.quaternion),t.scale.copy(this.scale),t.rotationAutoUpdate=this.rotationAutoUpdate,t.matrix.copy(this.matrix),t.matrixWorld.copy(this.matrixWorld),t.matrixAutoUpdate=this.matrixAutoUpdate,t.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate,t.visible=this.visible,t.castShadow=this.castShadow,t.receiveShadow=this.receiveShadow,t.frustumCulled=this.frustumCulled,t.userData=JSON.parse(JSON.stringify(this.userData)),!0===e)for(var r=0;r<this.children.length;r++)t.add(this.children[r].clone());return t}},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=i instanceof Array?i:[],this.color=n instanceof THREE.Color?n:new THREE.Color,this.vertexColors=n instanceof Array?n:[],this.vertexTangents=[],this.materialIndex=void 0!==o?o:0},THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var t=new THREE.Face3(this.a,this.b,this.c);t.normal.copy(this.normal),t.color.copy(this.color),t.materialIndex=this.materialIndex;for(var e=0,r=this.vertexNormals.length;e<r;e++)t.vertexNormals[e]=this.vertexNormals[e].clone();for(e=0,r=this.vertexColors.length;e<r;e++)t.vertexColors[e]=this.vertexColors[e].clone();for(e=0,r=this.vertexTangents.length;e<r;e++)t.vertexTangents[e]=this.vertexTangents[e].clone();return t}},THREE.Face4=function(t,e,r,i,n,o,a){return THREE.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.array=t,this.itemSize=e,this.needsUpdate=!1},THREE.BufferAttribute.prototype={constructor:THREE.BufferAttribute,get length(){return this.array.length},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},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},setX:function(t,e){return this.array[t*this.itemSize]=e,this},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},setXY:function(t,e,r){return t*=this.itemSize,this.array[t]=e,this.array[t+1]=r,this},setXYZ:function(t,e,r,i){return t*=this.itemSize,this.array[t]=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]=e,this.array[t+1]=r,this.array[t+2]=i,this.array[t+3]=n,this},clone:function(){return new THREE.BufferAttribute(new this.array.constructor(this.array),this.itemSize)}},THREE.Int8Attribute=function(t,e){return THREE.warn("THREE.Int8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.Uint8Attribute=function(t,e){return THREE.warn("THREE.Uint8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.Uint8ClampedAttribute=function(t,e){return THREE.warn("THREE.Uint8ClampedAttribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.Int16Attribute=function(t,e){return THREE.warn("THREE.Int16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.Uint16Attribute=function(t,e){return THREE.warn("THREE.Uint16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.Int32Attribute=function(t,e){return THREE.warn("THREE.Int32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.Uint32Attribute=function(t,e){return THREE.warn("THREE.Uint32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.Float32Attribute=function(t,e){return THREE.warn("THREE.Float32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.Float64Attribute=function(t,e){return THREE.warn("THREE.Float64Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.DynamicBufferAttribute=function(t,e){THREE.BufferAttribute.call(this,t,e),this.updateRange={offset:0,count:-1}},THREE.DynamicBufferAttribute.prototype=Object.create(THREE.BufferAttribute.prototype),THREE.DynamicBufferAttribute.prototype.constructor=THREE.DynamicBufferAttribute,THREE.DynamicBufferAttribute.prototype.clone=function(){return new THREE.DynamicBufferAttribute(new this.array.constructor(this.array),this.itemSize)},THREE.BufferGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="BufferGeometry",this.attributes={},this.attributesKeys=[],this.offsets=this.drawcalls=[],this.boundingSphere=this.boundingBox=null},THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(t,e,r){!1==e instanceof THREE.BufferAttribute?(THREE.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.attributes[t]={array:e,itemSize:r}):(this.attributes[t]=e,this.attributesKeys=Object.keys(this.attributes))},getAttribute:function(t){return this.attributes[t]},addDrawCall:function(t,e,r){this.drawcalls.push({start:t,count:e,index:void 0!==r?r:0})},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()},center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.applyMatrix((new THREE.Matrix4).setPosition(t)),t},fromGeometry:function(t,e){e=e||{vertexColors:THREE.NoColors};var r=t.vertices,i=t.faces,n=t.faceVertexUvs,o=e.vertexColors,a=0<n[0].length,s=3==i[0].vertexNormals.length,h=new Float32Array(9*i.length);this.addAttribute("position",new THREE.BufferAttribute(h,3));var l=new Float32Array(9*i.length);if(this.addAttribute("normal",new THREE.BufferAttribute(l,3)),o!==THREE.NoColors){var c=new Float32Array(9*i.length);this.addAttribute("color",new THREE.BufferAttribute(c,3))}if(!0===a){var u=new Float32Array(6*i.length);this.addAttribute("uv",new THREE.BufferAttribute(u,2))}for(var E=0,p=0,d=0;E<i.length;E++,p+=6,d+=9){var f=i[E],m=r[f.a],T=r[f.b],g=r[f.c];h[d]=m.x,h[d+1]=m.y,h[d+2]=m.z,h[d+3]=T.x,h[d+4]=T.y,h[d+5]=T.z,h[d+6]=g.x,h[d+7]=g.y,h[d+8]=g.z,!0===s?(m=f.vertexNormals[0],T=f.vertexNormals[1],g=f.vertexNormals[2],l[d]=m.x,l[d+1]=m.y,l[d+2]=m.z,l[d+3]=T.x,l[d+4]=T.y,l[d+5]=T.z,l[d+6]=g.x,l[d+7]=g.y,l[d+8]=g.z):(m=f.normal,l[d]=m.x,l[d+1]=m.y,l[d+2]=m.z,l[d+3]=m.x,l[d+4]=m.y,l[d+5]=m.z,l[d+6]=m.x,l[d+7]=m.y,l[d+8]=m.z),o===THREE.FaceColors?(f=f.color,c[d]=f.r,c[d+1]=f.g,c[d+2]=f.b,c[d+3]=f.r,c[d+4]=f.g,c[d+5]=f.b,c[d+6]=f.r,c[d+7]=f.g,c[d+8]=f.b):o===THREE.VertexColors&&(m=f.vertexColors[0],T=f.vertexColors[1],f=f.vertexColors[2],c[d]=m.r,c[d+1]=m.g,c[d+2]=m.b,c[d+3]=T.r,c[d+4]=T.g,c[d+5]=T.b,c[d+6]=f.r,c[d+7]=f.g,c[d+8]=f.b),!0===a&&(f=n[0][E][0],m=n[0][E][1],T=n[0][E][2],u[p]=f.x,u[p+1]=f.y,u[p+2]=m.x,u[p+3]=m.y,u[p+4]=T.x,u[p+5]=T.y)}return this.computeBoundingSphere(),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.set(t[r],t[r+1],t[r+2]),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))&&THREE.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.')}}(),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.set(t[r],t[r+1],t[r+2]),o.expandByPoint(a);o.center(e);var n=0;for(r=0,i=t.length;r<i;r+=3)a.set(t[r],t[r+1],t[r+2]),n=Math.max(n,e.distanceToSquared(a));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&THREE.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.attributes;if(t.position){var e=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(e.length),3));else for(var r=0,i=(s=t.normal.array).length;r<i;r++)s[r]=0;var n,o,a,s=t.normal.array,h=new THREE.Vector3,l=new THREE.Vector3,c=new THREE.Vector3,u=new THREE.Vector3,E=new THREE.Vector3;if(t.index)for(var p=t.index.array,d=0<this.offsets.length?this.offsets:[{start:0,count:p.length,index:0}],f=0,m=d.length;f<m;++f){i=d[f].start,n=d[f].count;var T=d[f].index;for(r=i,i=i+n;r<i;r+=3)n=3*(T+p[r]),o=3*(T+p[r+1]),a=3*(T+p[r+2]),h.fromArray(e,n),l.fromArray(e,o),c.fromArray(e,a),u.subVectors(c,l),E.subVectors(h,l),u.cross(E),s[n]+=u.x,s[n+1]+=u.y,s[n+2]+=u.z,s[o]+=u.x,s[o+1]+=u.y,s[o+2]+=u.z,s[a]+=u.x,s[a+1]+=u.y,s[a+2]+=u.z}else for(r=0,i=e.length;r<i;r+=9)h.fromArray(e,r),l.fromArray(e,r+3),c.fromArray(e,r+6),u.subVectors(c,l),E.subVectors(h,l),u.cross(E),s[r]=u.x,s[r+1]=u.y,s[r+2]=u.z,s[r+3]=u.x,s[r+4]=u.y,s[r+5]=u.z,s[r+6]=u.x,s[r+7]=u.y,s[r+8]=u.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},computeTangents:function(){function t(t){O.fromArray(i,3*t),G.copy(O),V=s[t],k.copy(V),k.sub(O.multiplyScalar(O.dot(V))).normalize(),N.crossVectors(G,V),z=N.dot(h[t]),D=z<0?-1:1,a[4*t]=k.x,a[4*t+1]=k.y,a[4*t+2]=k.z,a[4*t+3]=D}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)THREE.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var e=this.attributes.index.array,r=this.attributes.position.array,i=this.attributes.normal.array,n=this.attributes.uv.array,o=r.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*o),4));for(var a=this.attributes.tangent.array,s=[],h=[],l=0;l<o;l++)s[l]=new THREE.Vector3,h[l]=new THREE.Vector3;var c,u,E,p,d,f,m,T,g,R,y,v,H,x,b,_,w=new THREE.Vector3,M=new THREE.Vector3,S=new THREE.Vector3,A=new THREE.Vector2,C=new THREE.Vector2,L=new THREE.Vector2,P=new THREE.Vector3,F=new THREE.Vector3;0===this.drawcalls.length&&this.addDrawCall(0,e.length,0);var U=this.drawcalls;l=0;for(H=U.length;l<H;++l){v=U[l].start,x=U[l].count;var B=U[l].index;o=v;for(v+=x;o<v;o+=3)x=B+e[o],b=B+e[o+1],_=B+e[o+2],I=x,W=b,j=_,w.fromArray(r,3*I),M.fromArray(r,3*W),S.fromArray(r,3*j),A.fromArray(n,2*I),C.fromArray(n,2*W),L.fromArray(n,2*j),c=M.x-w.x,u=S.x-w.x,E=M.y-w.y,p=S.y-w.y,d=M.z-w.z,f=S.z-w.z,m=C.x-A.x,T=L.x-A.x,g=C.y-A.y,R=L.y-A.y,y=1/(m*R-T*g),P.set((R*c-g*u)*y,(R*E-g*p)*y,(R*d-g*f)*y),F.set((m*u-T*c)*y,(m*p-T*E)*y,(m*f-T*d)*y),s[I].add(P),s[W].add(P),s[j].add(P),h[I].add(F),h[W].add(F),h[j].add(F)}var D,V,z,k=new THREE.Vector3,N=new THREE.Vector3,O=new THREE.Vector3,G=new THREE.Vector3;l=0;for(H=U.length;l<H;++l)for(v=U[l].start,x=U[l].count,B=U[l].index,o=v,v+=x;o<v;o+=3)x=B+e[o],b=B+e[o+1],_=B+e[o+2],t(x),t(b),t(_)}var I,W,j},computeOffsets:function(t){void 0===t&&(t=65535);for(var e=this.attributes.index.array,r=this.attributes.position.array,i=e.length/3,n=new Uint16Array(e.length),o=0,a=0,s=[{start:0,count:0,index:0}],h=s[0],l=0,c=new Int32Array(6),u=new Int32Array(r.length),E=new Int32Array(r.length),p=0;p<r.length;p++)u[p]=-1,E[p]=-1;for(r=0;r<i;r++){for(var d=l=0;d<3;d++)-1==u[p=e[3*r+d]]?(c[2*d]=p,c[2*d+1]=-1,l++):u[p]<h.index?(c[2*d]=p,c[2*d+1]=-1,0):(c[2*d]=p,c[2*d+1]=u[p]);if(a+l>h.index+t)for(h={start:o,count:0,index:a},s.push(h),l=0;l<6;l+=2)-1<(d=c[l+1])&&d<h.index&&(c[l+1]=-1);for(l=0;l<6;l+=2)p=c[l],-1===(d=c[l+1])&&(d=a++),E[u[p]=d]=p,n[o++]=d-h.index,h.count++}return this.reorderBuffers(n,E,a),this.drawcalls=this.offsets=s},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}THREE.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},reorderBuffers:function(t,e,r){var i,n={};for(i in this.attributes)"index"!=i&&(n[i]=new this.attributes[i].array.constructor(this.attributes[i].itemSize*r));for(var o=0;o<r;o++){var a=e[o];for(i in this.attributes)if("index"!=i)for(var s=this.attributes[i].array,h=this.attributes[i].itemSize,l=n[i],c=0;c<h;c++)l[o*h+c]=s[a*h+c]}for(i in this.attributes.index.array=t,this.attributes)"index"!=i&&(this.attributes[i].array=n[i],this.attributes[i].numItems=this.attributes[i].itemSize*r)},toJSON:function(){var t,e={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type,data:{attributes:{}}},r=this.attributes,i=this.offsets,n=this.boundingSphere;for(t in r){var o=r[t],a=Array.prototype.slice.call(o.array);e.data.attributes[t]={itemSize:o.itemSize,type:o.array.constructor.name,array:a}}return 0<i.length&&(e.data.offsets=JSON.parse(JSON.stringify(i))),null!==n&&(e.data.boundingSphere={center:n.center.toArray(),radius:n.radius}),e},clone:function(){var t,e=new THREE.BufferGeometry;for(t in this.attributes)e.addAttribute(t,this.attributes[t].clone());t=0;for(var r=this.offsets.length;t<r;t++){var i=this.offsets[t];e.offsets.push({start:i.start,index:i.index,count:i.count})}return e},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype),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.morphColors=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingSphere=this.boundingBox=null,this.hasTangents=!1,this.dynamic=!0,this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=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},fromBufferGeometry:function(t){for(var o=this,e=t.attributes,r=e.position.array,i=void 0!==e.index?e.index.array:void 0,a=void 0!==e.normal?e.normal.array:void 0,s=void 0!==e.color?e.color.array:void 0,h=void 0!==e.uv?e.uv.array:void 0,l=[],c=[],n=e=0;e<r.length;e+=3,n+=2)o.vertices.push(new THREE.Vector3(r[e],r[e+1],r[e+2])),void 0!==a&&l.push(new THREE.Vector3(a[e],a[e+1],a[e+2])),void 0!==s&&o.colors.push(new THREE.Color(s[e],s[e+1],s[e+2])),void 0!==h&&c.push(new THREE.Vector2(h[n],h[n+1]));var u=function(t,e,r){var i=void 0!==a?[l[t].clone(),l[e].clone(),l[r].clone()]:[],n=void 0!==s?[o.colors[t].clone(),o.colors[e].clone(),o.colors[r].clone()]:[];o.faces.push(new THREE.Face3(t,e,r,i,n)),void 0!==h&&o.faceVertexUvs[0].push([c[t].clone(),c[e].clone(),c[r].clone()])};if(void 0!==i)if(0<(r=t.drawcalls).length)for(e=0;e<r.length;e++){var E=(n=r[e]).start,p=n.count,d=n.index;for(n=E,E=E+p;n<E;n+=3)u(d+i[n],d+i[n+1],d+i[n+2])}else for(e=0;e<i.length;e+=3)u(i[e],i[e+1],i[e+2]);else for(e=0;e<r.length/3;e+=3)u(e,e+1,e+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.applyMatrix((new THREE.Matrix4).setPosition(t)),t},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){var e,r,i;for(i=Array(this.vertices.length),e=0,r=this.vertices.length;e<r;e++)i[e]=new THREE.Vector3;if(t){var n,o,a,s=new THREE.Vector3,h=new THREE.Vector3;for(t=0,e=this.faces.length;t<e;t++)r=this.faces[t],n=this.vertices[r.a],o=this.vertices[r.b],a=this.vertices[r.c],s.subVectors(a,o),h.subVectors(n,o),s.cross(h),i[r.a].add(s),i[r.b].add(s),i[r.c].add(s)}else for(t=0,e=this.faces.length;t<e;t++)i[(r=this.faces[t]).a].add(r.normal),i[r.b].add(r.normal),i[r.c].add(r.normal);for(e=0,r=this.vertices.length;e<r;e++)i[e].normalize();for(t=0,e=this.faces.length;t<e;t++)(r=this.faces[t]).vertexNormals[0]=i[r.a].clone(),r.vertexNormals[1]=i[r.b].clone(),r.vertexNormals[2]=i[r.c].clone()},computeMorphNormals:function(){var t,e,r,i,n;for(r=0,i=this.faces.length;r<i;r++)for((n=this.faces[r]).__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]),t=0,e=n.vertexNormals.length;t<e;t++)n.__originalVertexNormals[t]?n.__originalVertexNormals[t].copy(n.vertexNormals[t]):n.__originalVertexNormals[t]=n.vertexNormals[t].clone();var o=new THREE.Geometry;for(o.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=[],n=this.morphNormals[t].faceNormals;var a,s,h=this.morphNormals[t].vertexNormals;for(r=0,i=this.faces.length;r<i;r++)a=new THREE.Vector3,s={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},n.push(a),h.push(s)}for(h=this.morphNormals[t],o.vertices=this.morphTargets[t].vertices,o.computeFaceNormals(),o.computeVertexNormals(),r=0,i=this.faces.length;r<i;r++)n=this.faces[r],a=h.faceNormals[r],s=h.vertexNormals[r],a.copy(n.normal),s.a.copy(n.vertexNormals[0]),s.b.copy(n.vertexNormals[1]),s.c.copy(n.vertexNormals[2])}for(r=0,i=this.faces.length;r<i;r++)(n=this.faces[r]).normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeTangents:function(){var t,e,r,i,n,o,a,s,h,l,c,u,E,p,d,f,m,T=[],g=[];r=new THREE.Vector3;var R=new THREE.Vector3,y=new THREE.Vector3,v=new THREE.Vector3,H=new THREE.Vector3;for(t=0,e=this.vertices.length;t<e;t++)T[t]=new THREE.Vector3,g[t]=new THREE.Vector3;for(t=0,e=this.faces.length;t<e;t++)n=this.faces[t],o=this.faceVertexUvs[0][t],i=n.a,m=n.b,n=n.c,a=this.vertices[i],s=this.vertices[m],h=this.vertices[n],l=o[0],c=o[1],u=o[2],o=s.x-a.x,E=h.x-a.x,p=s.y-a.y,d=h.y-a.y,s=s.z-a.z,a=h.z-a.z,h=c.x-l.x,f=u.x-l.x,c=c.y-l.y,u=1/(h*(l=u.y-l.y)-f*c),r.set((l*o-c*E)*u,(l*p-c*d)*u,(l*s-c*a)*u),R.set((h*E-f*o)*u,(h*d-f*p)*u,(h*a-f*s)*u),T[i].add(r),T[m].add(r),T[n].add(r),g[i].add(R),g[m].add(R),g[n].add(R);for(R=["a","b","c","d"],t=0,e=this.faces.length;t<e;t++)for(n=this.faces[t],r=0;r<Math.min(n.vertexNormals.length,3);r++)H.copy(n.vertexNormals[r]),m=T[i=n[R[r]]],y.copy(m),y.sub(H.multiplyScalar(H.dot(m))).normalize(),v.crossVectors(n.vertexNormals[r],m),i=(i=v.dot(g[i]))<0?-1:1,n.vertexTangents[r]=new THREE.Vector4(y.x,y.y,y.z,i);this.hasTangents=!0},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)THREE.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,l=this.faceVertexUvs[0];t=t.faceVertexUvs[0],void 0===r&&(r=0),void 0!==e&&(i=(new THREE.Matrix3).getNormalMatrix(e));for(var c=0,u=a.length;c<u;c++){var E=a[c].clone();void 0!==e&&E.applyMatrix4(e),o.push(E)}for(c=0,u=h.length;c<u;c++){var p,d=(a=h[c]).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(c=0,u=t.length;c<u;c++)if(i=[],void 0!==(r=t[c])){for(e=0,o=r.length;e<o;e++)i.push(r[e].clone());l.push(i)}}},mergeMesh:function(t){!1==t instanceof THREE.Mesh?THREE.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t):(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix))},mergeVertices:function(){var t,e,r,i={},n=[],o=[],a=Math.pow(10,4);for(e=0,r=this.vertices.length;e<r;e++)t=this.vertices[e],void 0===i[t=Math.round(t.x*a)+"_"+Math.round(t.y*a)+"_"+Math.round(t.z*a)]?(i[t]=e,n.push(this.vertices[e]),o[e]=n.length-1):o[e]=o[i[t]];for(i=[],e=0,r=this.faces.length;e<r;e++)for((a=this.faces[e]).a=o[a.a],a.b=o[a.b],a.c=o[a.c],a=[a.a,a.b,a.c],t=0;t<3;t++)if(a[t]==a[(t+1)%3]){i.push(e);break}for(e=i.length-1;0<=e;e--)for(a=i[e],this.faces.splice(a,1),o=0,r=this.faceVertexUvs.length;o<r;o++)this.faceVertexUvs[o].splice(a,1);return e=this.vertices.length-n.length,this.vertices=n,e},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!==l[e]||(l[e]=h.length/3,h.push(t.x,t.y,t.z)),l[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!==p[e]||(p[e]=E.length/2,E.push(t.x,t.y)),p[e]}var n={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type};if(""!==this.name&&(n.name=this.name),void 0!==this.parameters){var o,a=this.parameters;for(o in a)void 0!==a[o]&&(n[o]=a[o]);return n}for(a=[],o=0;o<this.vertices.length;o++){var s=this.vertices[o];a.push(s.x,s.y,s.z)}s=[];var h=[],l={},c=[],u={},E=[],p={};for(o=0;o<this.faces.length;o++){var d=this.faces[o],f=void 0!==this.faceVertexUvs[0][o],m=0<d.normal.length(),T=0<d.vertexNormals.length,g=1!==d.color.r||1!==d.color.g||1!==d.color.b,R=0<d.vertexColors.length,y=t(y=t(y=t(y=t(y=t(y=t(y=t(y=t(y=0,0,0),1,!1),2,!1),3,f),4,m),5,T),6,g),7,R);s.push(y),s.push(d.a,d.b,d.c),f&&(f=this.faceVertexUvs[0][o],s.push(i(f[0]),i(f[1]),i(f[2]))),m&&s.push(e(d.normal)),T&&(m=d.vertexNormals,s.push(e(m[0]),e(m[1]),e(m[2]))),g&&s.push(r(d.color)),R&&(d=d.vertexColors,s.push(r(d[0]),r(d[1]),r(d[2])))}return n.data={},n.data.vertices=a,n.data.normals=h,0<c.length&&(n.data.colors=c),0<E.length&&(n.data.uvs=[E]),n.data.faces=s,n},clone:function(){for(var t=new THREE.Geometry,e=this.vertices,r=0,i=e.length;r<i;r++)t.vertices.push(e[r].clone());for(r=0,i=(e=this.faces).length;r<i;r++)t.faces.push(e[r].clone());for(r=0,i=this.faceVertexUvs.length;r<i;r++){e=this.faceVertexUvs[r],void 0===t.faceVertexUvs[r]&&(t.faceVertexUvs[r]=[]);for(var n=0,o=e.length;n<o;n++){for(var a=e[n],s=[],h=0,l=a.length;h<l;h++)s.push(a[h].clone());t.faceVertexUvs[r].push(s)}}return t},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype),THREE.GeometryIdCount=0,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(t){return void 0===t&&(t=new THREE.Camera),THREE.Object3D.prototype.clone.call(this,t),t.matrixWorldInverse.copy(this.matrixWorldInverse),t.projectionMatrix.copy(this.projectionMatrix),t},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 l=new THREE.PerspectiveCamera(90,1,t,e);l.up.set(0,-1,0),l.lookAt(new THREE.Vector3(0,0,-1)),this.add(l),this.renderTarget=new THREE.WebGLRenderTargetCube(r,r,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter}),this.updateCubeMap=function(t,e){var r=this.renderTarget,i=r.generateMipmaps;r.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.generateMipmaps=i,r.activeCubeFace=5,t.render(e,l,r)}},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.clone=function(){var t=new THREE.OrthographicCamera;return THREE.Camera.prototype.clone.call(this,t),t.zoom=this.zoom,t.left=this.left,t.right=this.right,t.top=this.top,t.bottom=this.bottom,t.near=this.near,t.far=this.far,t.projectionMatrix.copy(this.projectionMatrix),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=THREE.Math.radToDeg(2*Math.atan(Math.tan(.5*THREE.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var e=(r=this.fullWidth/this.fullHeight)*(i=-(t=Math.tan(THREE.Math.degToRad(.5*t))*this.near)),r=Math.abs(r*t-e),i=Math.abs(t-i);this.projectionMatrix.makeFrustum(e+this.x*r/this.fullWidth,e+(this.x+this.width)*r/this.fullWidth,t-(this.y+this.height)*i/this.fullHeight,t-this.y*i/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(t,this.aspect,this.near,this.far)},THREE.PerspectiveCamera.prototype.clone=function(){var t=new THREE.PerspectiveCamera;return THREE.Camera.prototype.clone.call(this,t),t.zoom=this.zoom,t.fov=this.fov,t.aspect=this.aspect,t.near=this.near,t.far=this.far,t.projectionMatrix.copy(this.projectionMatrix),t},THREE.Light=function(t){THREE.Object3D.call(this),this.type="Light",this.color=new THREE.Color(t)},THREE.Light.prototype=Object.create(THREE.Object3D.prototype),THREE.Light.prototype.constructor=THREE.Light,THREE.Light.prototype.clone=function(t){return void 0===t&&(t=new THREE.Light),THREE.Object3D.prototype.clone.call(this,t),t.color.copy(this.color),t},THREE.AmbientLight=function(t){THREE.Light.call(this,t),this.type="AmbientLight"},THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype),THREE.AmbientLight.prototype.constructor=THREE.AmbientLight,THREE.AmbientLight.prototype.clone=function(){var t=new THREE.AmbientLight;return THREE.Light.prototype.clone.call(this,t),t},THREE.AreaLight=function(t,e){THREE.Light.call(this,t),this.type="AreaLight",this.normal=new THREE.Vector3(0,-1,0),this.right=new THREE.Vector3(1,0,0),this.intensity=void 0!==e?e:1,this.height=this.width=1,this.constantAttenuation=1.5,this.linearAttenuation=.5,this.quadraticAttenuation=.1},THREE.AreaLight.prototype=Object.create(THREE.Light.prototype),THREE.AreaLight.prototype.constructor=THREE.AreaLight,THREE.DirectionalLight=function(t,e){THREE.Light.call(this,t),this.type="DirectionalLight",this.position.set(0,1,0),this.target=new THREE.Object3D,this.intensity=void 0!==e?e:1,this.onlyShadow=this.castShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraLeft=-500,this.shadowCameraTop=this.shadowCameraRight=500,this.shadowCameraBottom=-500,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapHeight=this.shadowMapWidth=512,this.shadowCascade=!1,this.shadowCascadeOffset=new THREE.Vector3(0,0,-1e3),this.shadowCascadeCount=2,this.shadowCascadeBias=[0,0,0],this.shadowCascadeWidth=[512,512,512],this.shadowCascadeHeight=[512,512,512],this.shadowCascadeNearZ=[-1,.99,.998],this.shadowCascadeFarZ=[.99,.998,1],this.shadowCascadeArray=[],this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null},THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype),THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight,THREE.DirectionalLight.prototype.clone=function(){var t=new THREE.DirectionalLight;return THREE.Light.prototype.clone.call(this,t),t.target=this.target.clone(),t.intensity=this.intensity,t.castShadow=this.castShadow,t.onlyShadow=this.onlyShadow,t.shadowCameraNear=this.shadowCameraNear,t.shadowCameraFar=this.shadowCameraFar,t.shadowCameraLeft=this.shadowCameraLeft,t.shadowCameraRight=this.shadowCameraRight,t.shadowCameraTop=this.shadowCameraTop,t.shadowCameraBottom=this.shadowCameraBottom,t.shadowCameraVisible=this.shadowCameraVisible,t.shadowBias=this.shadowBias,t.shadowDarkness=this.shadowDarkness,t.shadowMapWidth=this.shadowMapWidth,t.shadowMapHeight=this.shadowMapHeight,t.shadowCascade=this.shadowCascade,t.shadowCascadeOffset.copy(this.shadowCascadeOffset),t.shadowCascadeCount=this.shadowCascadeCount,t.shadowCascadeBias=this.shadowCascadeBias.slice(0),t.shadowCascadeWidth=this.shadowCascadeWidth.slice(0),t.shadowCascadeHeight=this.shadowCascadeHeight.slice(0),t.shadowCascadeNearZ=this.shadowCascadeNearZ.slice(0),t.shadowCascadeFarZ=this.shadowCascadeFarZ.slice(0),t},THREE.HemisphereLight=function(t,e,r){THREE.Light.call(this,t),this.type="HemisphereLight",this.position.set(0,100,0),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.clone=function(){var t=new THREE.HemisphereLight;return THREE.Light.prototype.clone.call(this,t),t.groundColor.copy(this.groundColor),t.intensity=this.intensity,t},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},THREE.PointLight.prototype=Object.create(THREE.Light.prototype),THREE.PointLight.prototype.constructor=THREE.PointLight,THREE.PointLight.prototype.clone=function(){var t=new THREE.PointLight;return THREE.Light.prototype.clone.call(this,t),t.intensity=this.intensity,t.distance=this.distance,t.decay=this.decay,t},THREE.SpotLight=function(t,e,r,i,n,o){THREE.Light.call(this,t),this.type="SpotLight",this.position.set(0,1,0),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.onlyShadow=this.castShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraFov=50,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapHeight=this.shadowMapWidth=512,this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null},THREE.SpotLight.prototype=Object.create(THREE.Light.prototype),THREE.SpotLight.prototype.constructor=THREE.SpotLight,THREE.SpotLight.prototype.clone=function(){var t=new THREE.SpotLight;return THREE.Light.prototype.clone.call(this,t),t.target=this.target.clone(),t.intensity=this.intensity,t.distance=this.distance,t.angle=this.angle,t.exponent=this.exponent,t.decay=this.decay,t.castShadow=this.castShadow,t.onlyShadow=this.onlyShadow,t.shadowCameraNear=this.shadowCameraNear,t.shadowCameraFar=this.shadowCameraFar,t.shadowCameraFov=this.shadowCameraFov,t.shadowCameraVisible=this.shadowCameraVisible,t.shadowBias=this.shadowBias,t.shadowDarkness=this.shadowDarkness,t.shadowMapWidth=this.shadowMapWidth,t.shadowMapHeight=this.shadowMapHeight,t},THREE.Cache={files:{},add:function(t,e){this.files[t]=e},get:function(t){return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},THREE.Loader=function(t){this.statusDomElement=(this.showStatus=t)?THREE.Loader.prototype.addStatusElement():null,this.imageLoader=new THREE.ImageLoader,this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:void 0,addStatusElement:function(){var t=document.createElement("div");return t.style.position="absolute",t.style.right="0px",t.style.top="0px",t.style.fontSize="0.8em",t.style.textAlign="left",t.style.background="rgba(0,0,0,0.25)",t.style.color="#fff",t.style.width="120px",t.style.padding="0.5em 0.5em 0.5em 0.5em",t.style.zIndex=1e3,t.innerHTML="Loading ...",t},updateProgress:function(t){var e="Loaded ";e=t.total?e+((100*t.loaded/t.total).toFixed(0)+"%"):e+((t.loaded/1024).toFixed(2)+" KB");this.statusDomElement.innerHTML=e},extractUrlBase:function(t){return 1===(t=t.split("/")).length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(t,e){for(var r=[],i=0;i<t.length;++i)r[i]=this.createMaterial(t[i],e);return r},needsTangents:function(t){for(var e=0,r=t.length;e<r;e++)if(t[e]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(t,c){function u(t){return t=Math.log(t)/Math.LN2,Math.pow(2,Math.round(t))}function e(t,e,r,i,n,o,a){var s,h=c+r,l=THREE.Loader.Handlers.get(h);null!==l?s=l.load(h):(s=new THREE.Texture,(l=E.imageLoader).crossOrigin=E.crossOrigin,l.load(h,function(t){if(!1===THREE.Math.isPowerOfTwo(t.width)||!1===THREE.Math.isPowerOfTwo(t.height)){var e=u(t.width),r=u(t.height),i=document.createElement("canvas");i.width=e,i.height=r,i.getContext("2d").drawImage(t,0,0,e,r),s.image=i}else s.image=t;s.needsUpdate=!0})),s.sourceFile=r,i&&(s.repeat.set(i[0],i[1]),1!==i[0]&&(s.wrapS=THREE.RepeatWrapping),1!==i[1]&&(s.wrapT=THREE.RepeatWrapping)),n&&s.offset.set(n[0],n[1]),o&&(void 0!==(r={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping})[o[0]]&&(s.wrapS=r[o[0]]),void 0!==r[o[1]]&&(s.wrapT=r[o[1]])),a&&(s.anisotropy=a),t[e]=s}function r(t){return(255*t[0]<<16)+(255*t[1]<<8)+255*t[2]}var E=this,i="MeshLambertMaterial",n={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(t.shading){var o=t.shading.toLowerCase();"phong"===o?i="MeshPhongMaterial":"basic"===o&&(i="MeshBasicMaterial")}return void 0!==t.blending&&void 0!==THREE[t.blending]&&(n.blending=THREE[t.blending]),void 0!==t.transparent&&(n.transparent=t.transparent),void 0!==t.opacity&&t.opacity<1&&(n.transparent=!0),void 0!==t.depthTest&&(n.depthTest=t.depthTest),void 0!==t.depthWrite&&(n.depthWrite=t.depthWrite),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.flipSided&&(n.side=THREE.BackSide),void 0!==t.doubleSided&&(n.side=THREE.DoubleSide),void 0!==t.wireframe&&(n.wireframe=t.wireframe),void 0!==t.vertexColors&&("face"===t.vertexColors?n.vertexColors=THREE.FaceColors:t.vertexColors&&(n.vertexColors=THREE.VertexColors)),t.colorDiffuse?n.color=r(t.colorDiffuse):t.DbgColor&&(n.color=t.DbgColor),t.colorSpecular&&(n.specular=r(t.colorSpecular)),t.colorEmissive&&(n.emissive=r(t.colorEmissive)),void 0!==t.transparency&&(console.warn("THREE.Loader: transparency has been renamed to opacity"),t.opacity=t.transparency),void 0!==t.opacity&&(n.opacity=t.opacity),t.specularCoef&&(n.shininess=t.specularCoef),t.mapDiffuse&&c&&e(n,"map",t.mapDiffuse,t.mapDiffuseRepeat,t.mapDiffuseOffset,t.mapDiffuseWrap,t.mapDiffuseAnisotropy),t.mapLight&&c&&e(n,"lightMap",t.mapLight,t.mapLightRepeat,t.mapLightOffset,t.mapLightWrap,t.mapLightAnisotropy),t.mapBump&&c&&e(n,"bumpMap",t.mapBump,t.mapBumpRepeat,t.mapBumpOffset,t.mapBumpWrap,t.mapBumpAnisotropy),t.mapNormal&&c&&e(n,"normalMap",t.mapNormal,t.mapNormalRepeat,t.mapNormalOffset,t.mapNormalWrap,t.mapNormalAnisotropy),t.mapSpecular&&c&&e(n,"specularMap",t.mapSpecular,t.mapSpecularRepeat,t.mapSpecularOffset,t.mapSpecularWrap,t.mapSpecularAnisotropy),t.mapAlpha&&c&&e(n,"alphaMap",t.mapAlpha,t.mapAlphaRepeat,t.mapAlphaOffset,t.mapAlphaWrap,t.mapAlphaAnisotropy),t.mapBumpScale&&(n.bumpScale=t.mapBumpScale),t.mapNormalFactor&&(n.normalScale=new THREE.Vector2(t.mapNormalFactor,t.mapNormalFactor)),i=new THREE[i](n),void 0!==t.DbgName&&(i.name=t.DbgName),i}},THREE.Loader.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=0,r=this.handlers.length;e<r;e+=2){var i=this.handlers[e+1];if(this.handlers[e].test(t))return i}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);void 0!==t?r&&r(t):((t=new XMLHttpRequest).open("GET",e,!0),t.addEventListener("load",function(t){THREE.Cache.add(e,this.response),r&&r(this.response),o.manager.itemEnd(e)},!1),void 0!==i&&t.addEventListener("progress",function(t){i(t)},!1),void 0!==n&&t.addEventListener("error",function(t){n(t)},!1),void 0!==this.crossOrigin&&(t.crossOrigin=this.crossOrigin),void 0!==this.responseType&&(t.responseType=this.responseType),t.send(null),o.manager.itemStart(e))},setResponseType:function(t){this.responseType=t},setCrossOrigin:function(t){this.crossOrigin=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(t=document.createElement("img")).addEventListener("load",function(t){THREE.Cache.add(e,this),r&&r(this),o.manager.itemEnd(e)},!1),void 0!==i&&t.addEventListener("progress",function(t){i(t)},!1),void 0!==n&&t.addEventListener("error",function(t){n(t)},!1),void 0!==this.crossOrigin&&(t.crossOrigin=this.crossOrigin),t.src=e,o.manager.itemStart(e),t;r(t)},setCrossOrigin:function(t){this.crossOrigin=t}},THREE.JSONLoader=function(t){THREE.Loader.call(this,t),this.withCredentials=!1},THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype),THREE.JSONLoader.prototype.constructor=THREE.JSONLoader,THREE.JSONLoader.prototype.load=function(t,e,r){r=r&&"string"==typeof r?r:this.extractUrlBase(t),this.onLoadStart(),this.loadAjaxJSON(this,t,e,r)},THREE.JSONLoader.prototype.loadAjaxJSON=function(r,i,n,o,a){var s=new XMLHttpRequest,h=0;s.onreadystatechange=function(){if(s.readyState===s.DONE)if(200===s.status||0===s.status){if(s.responseText){var t=JSON.parse(s.responseText),e=t.metadata;if(void 0!==e){if("object"===e.type)return void THREE.error("THREE.JSONLoader: "+i+" should be loaded with THREE.ObjectLoader instead.");if("scene"===e.type)return void THREE.error("THREE.JSONLoader: "+i+" seems to be a Scene. Use THREE.SceneLoader instead.")}t=r.parse(t,o),n(t.geometry,t.materials)}else THREE.error("THREE.JSONLoader: "+i+" seems to be unreachable or the file is empty.");r.onLoadComplete()}else THREE.error("THREE.JSONLoader: Couldn't load "+i+" ("+s.status+")");else s.readyState===s.LOADING?a&&(0===h&&(h=s.getResponseHeader("Content-Length")),a({total:h,loaded:s.responseText.length})):s.readyState===s.HEADERS_RECEIVED&&void 0!==a&&(h=s.getResponseHeader("Content-Length"))},s.open("GET",i,!0),s.withCredentials=this.withCredentials,s.send(null)},THREE.JSONLoader.prototype.parse=function(g,t){var R=new THREE.Geometry,e=void 0!==g.scale?1/g.scale:1;return function(t){var e,r,i,n,o,a,s,h,l,c,u,E,p,d=g.faces;a=g.vertices;var 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++)R.faceVertexUvs[e]=[]}for(n=0,o=a.length;n<o;)(e=new THREE.Vector3).x=a[n++]*t,e.y=a[n++]*t,e.z=a[n++]*t,R.vertices.push(e);for(n=0,o=d.length;n<o;)if(l=1&(t=d[n++]),i=2&t,e=8&t,s=16&t,c=32&t,a=64&t,t&=128,l){if((l=new THREE.Face3).a=d[n],l.b=d[n+1],l.c=d[n+3],(u=new THREE.Face3).a=d[n+1],u.b=d[n+2],u.c=d[n+3],n+=4,i&&(i=d[n++],l.materialIndex=i,u.materialIndex=i),i=R.faces.length,e)for(e=0;e<T;e++)for(E=g.uvs[e],R.faceVertexUvs[e][i]=[],R.faceVertexUvs[e][i+1]=[],r=0;r<4;r++)p=E[2*(h=d[n++])],h=E[2*h+1],p=new THREE.Vector2(p,h),2!==r&&R.faceVertexUvs[e][i].push(p),0!==r&&R.faceVertexUvs[e][i+1].push(p);if(s&&(s=3*d[n++],l.normal.set(f[s++],f[s++],f[s]),u.normal.copy(l.normal)),c)for(e=0;e<4;e++)s=3*d[n++],c=new THREE.Vector3(f[s++],f[s++],f[s]),2!==e&&l.vertexNormals.push(c),0!==e&&u.vertexNormals.push(c);if(a&&(a=m[a=d[n++]],l.color.setHex(a),u.color.setHex(a)),t)for(e=0;e<4;e++)a=m[a=d[n++]],2!==e&&l.vertexColors.push(new THREE.Color(a)),0!==e&&u.vertexColors.push(new THREE.Color(a));R.faces.push(l),R.faces.push(u)}else{if((l=new THREE.Face3).a=d[n++],l.b=d[n++],l.c=d[n++],i&&(i=d[n++],l.materialIndex=i),i=R.faces.length,e)for(e=0;e<T;e++)for(E=g.uvs[e],R.faceVertexUvs[e][i]=[],r=0;r<3;r++)p=E[2*(h=d[n++])],h=E[2*h+1],p=new THREE.Vector2(p,h),R.faceVertexUvs[e][i].push(p);if(s&&(s=3*d[n++],l.normal.set(f[s++],f[s++],f[s])),c)for(e=0;e<3;e++)s=3*d[n++],c=new THREE.Vector3(f[s++],f[s++],f[s]),l.vertexNormals.push(c);if(a&&(a=d[n++],l.color.setHex(m[a])),t)for(e=0;e<3;e++)a=d[n++],l.vertexColors.push(new THREE.Color(m[a]));R.faces.push(l)}}(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)R.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)R.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));R.bones=g.bones,R.bones&&0<R.bones.length&&(R.skinWeights.length!==R.skinIndices.length||R.skinIndices.length!==R.vertices.length)&&THREE.warn("THREE.JSONLoader: When skinning, number of vertices ("+R.vertices.length+"), skinIndices ("+R.skinIndices.length+"), and skinWeights ("+R.skinWeights.length+") should match."),R.animation=g.animation,R.animations=g.animations}(),function(t){var e,r,i,n,o,a;if(void 0!==g.morphTargets)for(e=0,r=g.morphTargets.length;e<r;e++)for(R.morphTargets[e]={},R.morphTargets[e].name=g.morphTargets[e].name,R.morphTargets[e].vertices=[],o=R.morphTargets[e].vertices,i=0,n=(a=g.morphTargets[e].vertices).length;i<n;i+=3){var s=new THREE.Vector3;s.x=a[i]*t,s.y=a[i+1]*t,s.z=a[i+2]*t,o.push(s)}if(void 0!==g.morphColors)for(e=0,r=g.morphColors.length;e<r;e++)for(R.morphColors[e]={},R.morphColors[e].name=g.morphColors[e].name,R.morphColors[e].colors=[],n=R.morphColors[e].colors,t=0,i=(o=g.morphColors[e].colors).length;t<i;t+=3)(a=new THREE.Color(16755200)).setRGB(o[t],o[t+1],o[t+2]),n.push(a)}(e),R.computeFaceNormals(),R.computeBoundingSphere(),void 0===g.materials||0===g.materials.length?{geometry:R}:(e=this.initMaterials(g.materials,t),this.needsTangents(e)&&R.computeTangents(),{geometry:R,materials:e})},THREE.LoadingManager=function(t,e,r){var i=this,n=0,o=0;this.onLoad=t,this.onProgress=e,this.onError=r,this.itemStart=function(t){o++},this.itemEnd=function(t){n++,void 0!==i.onProgress&&i.onProgress(t,n,o),n===o&&void 0!==i.onLoad&&i.onLoad()}},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,r=new THREE.BufferGeometry,i=t.data.attributes;for(e in i){var n=i[e],o=new self[n.type](n.array);r.addAttribute(e,new THREE.BufferAttribute(o,n.itemSize))}return void 0!==(i=t.data.offsets)&&(r.offsets=JSON.parse(JSON.stringify(i))),void 0!==(t=t.data.boundingSphere)&&(i=new THREE.Vector3,void 0!==t.center&&i.fromArray(t.center),r.boundingSphere=new THREE.Sphere(i,t.radius)),r}},THREE.MaterialLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager},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},parse:function(t){var e=new THREE[t.type];if(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.wireframe&&(e.wireframe=t.wireframe),void 0!==t.size&&(e.size=t.size),void 0!==t.sizeAttenuation&&(e.sizeAttenuation=t.sizeAttenuation),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)}),n=(i=this.parseTextures(t.textures,i),i=this.parseMaterials(t.materials,i),this.parseObject(t.object,r,i));return 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"CircleGeometry":a=new THREE.CircleGeometry(s.radius,s.segments);break;case"CylinderGeometry":a=new THREE.CylinderGeometry(s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded);break;case"SphereGeometry":a=new THREE.SphereGeometry(s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"IcosahedronGeometry":a=new THREE.IcosahedronGeometry(s.radius,s.detail);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).geometry}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)for(var i=function(t){return void 0===e[t]&&THREE.warn("THREE.ObjectLoader: Undefined texture",t),e[t]},n=new THREE.MaterialLoader,o=0,a=t.length;o<a;o++){var s=t[o],h=n.parse(s);h.uuid=s.uuid,void 0!==s.name&&(h.name=s.name),void 0!==s.map&&(h.map=i(s.map)),void 0!==s.bumpMap&&(h.bumpMap=i(s.bumpMap),s.bumpScale&&(h.bumpScale=new THREE.Vector2(s.bumpScale,s.bumpScale))),void 0!==s.alphaMap&&(h.alphaMap=i(s.alphaMap)),void 0!==s.envMap&&(h.envMap=i(s.envMap)),void 0!==s.normalMap&&(h.normalMap=i(s.normalMap),s.normalScale&&(h.normalScale=new THREE.Vector2(s.normalScale,s.normalScale))),void 0!==s.lightMap&&(h.lightMap=i(s.lightMap)),void 0!==s.specularMap&&(h.specularMap=i(s.specularMap)),r[s.uuid]=h}return r},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);n=function(t){return r.manager.itemStart(t),o.load(t,function(){r.manager.itemEnd(t)})};for(var a=0,s=t.length;a<s;a++){var h=t[a],l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h.url)?h.url:r.texturePath+h.url;i[h.uuid]=n(l)}}return i},parseTextures:function(t,e){var r={};if(void 0!==t)for(var i=0,n=t.length;i<n;i++){var o=t[i];void 0===o.image&&THREE.warn('THREE.ObjectLoader: No "image" speficied for',o.uuid),void 0===e[o.image]&&THREE.warn("THREE.ObjectLoader: Undefined image",o.image);var a=new THREE.Texture(e[o.image]);a.needsUpdate=!0,a.uuid=o.uuid,void 0!==o.name&&(a.name=o.name),void 0!==o.repeat&&(a.repeat=new THREE.Vector2(o.repeat[0],o.repeat[1])),void 0!==o.minFilter&&(a.minFilter=THREE[o.minFilter]),void 0!==o.magFilter&&(a.magFilter=THREE[o.magFilter]),void 0!==o.anisotropy&&(a.anisotropy=o.anisotropy),o.wrap instanceof Array&&(a.wrapS=THREE[o.wrap[0]],a.wrapT=THREE[o.wrap[1]]),r[o.uuid]=a}return r},parseObject:function(){var a=new THREE.Matrix4;return function(t,e,r){var i;i=function(t){return void 0===e[t]&&THREE.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]};var n=function(t){return void 0===r[t]&&THREE.warn("THREE.ObjectLoader: Undefined material",t),r[t]};switch(t.type){case"Scene":i=new THREE.Scene;break;case"PerspectiveCamera":i=new THREE.PerspectiveCamera(t.fov,t.aspect,t.near,t.far);break;case"OrthographicCamera":i=new THREE.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":i=new THREE.AmbientLight(t.color);break;case"DirectionalLight":i=new THREE.DirectionalLight(t.color,t.intensity);break;case"PointLight":i=new THREE.PointLight(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":i=new THREE.SpotLight(t.color,t.intensity,t.distance,t.angle,t.exponent,t.decay);break;case"HemisphereLight":i=new THREE.HemisphereLight(t.color,t.groundColor,t.intensity);break;case"Mesh":i=new THREE.Mesh(i(t.geometry),n(t.material));break;case"Line":i=new THREE.Line(i(t.geometry),n(t.material),t.mode);break;case"PointCloud":i=new THREE.PointCloud(i(t.geometry),n(t.material));break;case"Sprite":i=new THREE.Sprite(n(t.material));break;case"Group":i=new THREE.Group;break;default:i=new THREE.Object3D}if(i.uuid=t.uuid,void 0!==t.name&&(i.name=t.name),void 0!==t.matrix?(a.fromArray(t.matrix),a.decompose(i.position,i.quaternion,i.scale)):(void 0!==t.position&&i.position.fromArray(t.position),void 0!==t.rotation&&i.rotation.fromArray(t.rotation),void 0!==t.scale&&i.scale.fromArray(t.scale)),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.children)for(var o in t.children)i.add(this.parseObject(t.children[o],e,r));return i}}()},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.ImageLoader(this.manager);n.setCrossOrigin(this.crossOrigin),n.load(t,function(t){(t=new THREE.Texture(t)).needsUpdate=!0,void 0!==e&&e(t)},r,i)},setCrossOrigin:function(t){this.crossOrigin=t}},THREE.DataTextureLoader=THREE.BinaryTextureLoader=function(){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;return 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}},THREE.CompressedTextureLoader=function(){this._parser=null},THREE.CompressedTextureLoader.prototype={constructor:THREE.CompressedTextureLoader,load:function(t,n,e){var o=this,a=[],s=new THREE.CompressedTexture;s.image=a;var r=new THREE.XHRLoader;if(r.setResponseType("arraybuffer"),t instanceof Array){var i=0;e=function(e){r.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===(i+=1)&&(1==t.mipmapCount&&(s.minFilter=THREE.LinearFilter),s.format=t.format,s.needsUpdate=!0,n&&n(s))})};for(var h=0,l=t.length;h<l;++h)e(h)}else r.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)});return s}},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.colorWrite=this.depthWrite=this.depthTest=!0,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=t[e];if(void 0===r)THREE.warn("THREE.Material: '"+e+"' parameter is undefined.");else if(e in this){var i=this[e];i instanceof THREE.Color?i.set(r):i instanceof THREE.Vector3&&r instanceof THREE.Vector3?i.copy(r):this[e]="overdraw"==e?Number(r):r}}},toJSON:function(){var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type};return""!==this.name&&(t.name=this.name),this instanceof THREE.MeshBasicMaterial?(t.color=this.color.getHex(),this.vertexColors!==THREE.NoColors&&(t.vertexColors=this.vertexColors),this.blending!==THREE.NormalBlending&&(t.blending=this.blending),this.side!==THREE.FrontSide&&(t.side=this.side)):this instanceof THREE.MeshLambertMaterial?(t.color=this.color.getHex(),t.emissive=this.emissive.getHex(),this.vertexColors!==THREE.NoColors&&(t.vertexColors=this.vertexColors),this.shading!==THREE.SmoothShading&&(t.shading=this.shading),this.blending!==THREE.NormalBlending&&(t.blending=this.blending),this.side!==THREE.FrontSide&&(t.side=this.side)):this instanceof THREE.MeshPhongMaterial?(t.color=this.color.getHex(),t.emissive=this.emissive.getHex(),t.specular=this.specular.getHex(),t.shininess=this.shininess,this.vertexColors!==THREE.NoColors&&(t.vertexColors=this.vertexColors),this.shading!==THREE.SmoothShading&&(t.shading=this.shading),this.blending!==THREE.NormalBlending&&(t.blending=this.blending),this.side!==THREE.FrontSide&&(t.side=this.side)):this instanceof THREE.MeshNormalMaterial?(this.blending!==THREE.NormalBlending&&(t.blending=this.blending),this.side!==THREE.FrontSide&&(t.side=this.side)):this instanceof THREE.MeshDepthMaterial?(this.blending!==THREE.NormalBlending&&(t.blending=this.blending),this.side!==THREE.FrontSide&&(t.side=this.side)):this instanceof THREE.PointCloudMaterial?(t.size=this.size,t.sizeAttenuation=this.sizeAttenuation,t.color=this.color.getHex(),this.vertexColors!==THREE.NoColors&&(t.vertexColors=this.vertexColors),this.blending!==THREE.NormalBlending&&(t.blending=this.blending)):this instanceof THREE.ShaderMaterial?(t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader):this instanceof THREE.SpriteMaterial&&(t.color=this.color.getHex()),this.opacity<1&&(t.opacity=this.opacity),!1!==this.transparent&&(t.transparent=this.transparent),!1!==this.wireframe&&(t.wireframe=this.wireframe),t},clone:function(t){return void 0===t&&(t=new THREE.Material),t.name=this.name,t.side=this.side,t.opacity=this.opacity,t.transparent=this.transparent,t.blending=this.blending,t.blendSrc=this.blendSrc,t.blendDst=this.blendDst,t.blendEquation=this.blendEquation,t.blendSrcAlpha=this.blendSrcAlpha,t.blendDstAlpha=this.blendDstAlpha,t.blendEquationAlpha=this.blendEquationAlpha,t.depthTest=this.depthTest,t.depthWrite=this.depthWrite,t.polygonOffset=this.polygonOffset,t.polygonOffsetFactor=this.polygonOffsetFactor,t.polygonOffsetUnits=this.polygonOffsetUnits,t.alphaTest=this.alphaTest,t.overdraw=this.overdraw,t.visible=this.visible,t},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},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.clone=function(){var t=new THREE.LineBasicMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.linewidth=this.linewidth,t.linecap=this.linecap,t.linejoin=this.linejoin,t.vertexColors=this.vertexColors,t.fog=this.fog,t},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.clone=function(){var t=new THREE.LineDashedMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.linewidth=this.linewidth,t.scale=this.scale,t.dashSize=this.dashSize,t.gapSize=this.gapSize,t.vertexColors=this.vertexColors,t.fog=this.fog,t},THREE.MeshBasicMaterial=function(t){THREE.Material.call(this),this.type="MeshBasicMaterial",this.color=new THREE.Color(16777215),this.envMap=this.alphaMap=this.specularMap=this.lightMap=this.map=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.clone=function(){var t=new THREE.MeshBasicMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.map=this.map,t.lightMap=this.lightMap,t.specularMap=this.specularMap,t.alphaMap=this.alphaMap,t.envMap=this.envMap,t.combine=this.combine,t.reflectivity=this.reflectivity,t.refractionRatio=this.refractionRatio,t.fog=this.fog,t.shading=this.shading,t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t.wireframeLinecap=this.wireframeLinecap,t.wireframeLinejoin=this.wireframeLinejoin,t.vertexColors=this.vertexColors,t.skinning=this.skinning,t.morphTargets=this.morphTargets,t},THREE.MeshLambertMaterial=function(t){THREE.Material.call(this),this.type="MeshLambertMaterial",this.color=new THREE.Color(16777215),this.emissive=new THREE.Color(0),this.wrapAround=!1,this.wrapRGB=new THREE.Vector3(1,1,1),this.envMap=this.alphaMap=this.specularMap=this.lightMap=this.map=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.MeshLambertMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial,THREE.MeshLambertMaterial.prototype.clone=function(){var t=new THREE.MeshLambertMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.emissive.copy(this.emissive),t.wrapAround=this.wrapAround,t.wrapRGB.copy(this.wrapRGB),t.map=this.map,t.lightMap=this.lightMap,t.specularMap=this.specularMap,t.alphaMap=this.alphaMap,t.envMap=this.envMap,t.combine=this.combine,t.reflectivity=this.reflectivity,t.refractionRatio=this.refractionRatio,t.fog=this.fog,t.shading=this.shading,t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t.wireframeLinecap=this.wireframeLinecap,t.wireframeLinejoin=this.wireframeLinejoin,t.vertexColors=this.vertexColors,t.skinning=this.skinning,t.morphTargets=this.morphTargets,t.morphNormals=this.morphNormals,t},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.wrapAround=this.metal=!1,this.wrapRGB=new THREE.Vector3(1,1,1),this.bumpMap=this.lightMap=this.map=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new THREE.Vector2(1,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.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.clone=function(){var t=new THREE.MeshPhongMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.emissive.copy(this.emissive),t.specular.copy(this.specular),t.shininess=this.shininess,t.metal=this.metal,t.wrapAround=this.wrapAround,t.wrapRGB.copy(this.wrapRGB),t.map=this.map,t.lightMap=this.lightMap,t.bumpMap=this.bumpMap,t.bumpScale=this.bumpScale,t.normalMap=this.normalMap,t.normalScale.copy(this.normalScale),t.specularMap=this.specularMap,t.alphaMap=this.alphaMap,t.envMap=this.envMap,t.combine=this.combine,t.reflectivity=this.reflectivity,t.refractionRatio=this.refractionRatio,t.fog=this.fog,t.shading=this.shading,t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t.wireframeLinecap=this.wireframeLinecap,t.wireframeLinejoin=this.wireframeLinejoin,t.vertexColors=this.vertexColors,t.skinning=this.skinning,t.morphTargets=this.morphTargets,t.morphNormals=this.morphNormals,t},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.clone=function(){var t=new THREE.MeshDepthMaterial;return THREE.Material.prototype.clone.call(this,t),t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t},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.clone=function(){var t=new THREE.MeshNormalMaterial;return THREE.Material.prototype.clone.call(this,t),t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t},THREE.MeshFaceMaterial=function(t){this.uuid=THREE.Math.generateUUID(),this.type="MeshFaceMaterial",this.materials=t instanceof Array?t:[]},THREE.MeshFaceMaterial.prototype={constructor:THREE.MeshFaceMaterial,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},clone:function(){for(var t=new THREE.MeshFaceMaterial,e=0;e<this.materials.length;e++)t.materials.push(this.materials[e].clone());return t}},THREE.PointCloudMaterial=function(t){THREE.Material.call(this),this.type="PointCloudMaterial",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.PointCloudMaterial.prototype=Object.create(THREE.Material.prototype),THREE.PointCloudMaterial.prototype.constructor=THREE.PointCloudMaterial,THREE.PointCloudMaterial.prototype.clone=function(){var t=new THREE.PointCloudMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.map=this.map,t.size=this.size,t.sizeAttenuation=this.sizeAttenuation,t.vertexColors=this.vertexColors,t.fog=this.fog,t},THREE.ParticleBasicMaterial=function(t){return THREE.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointCloudMaterial."),new THREE.PointCloudMaterial(t)},THREE.ParticleSystemMaterial=function(t){return THREE.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointCloudMaterial."),new THREE.PointCloudMaterial(t)},THREE.ShaderMaterial=function(t){THREE.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.attributes=null,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.morphNormals=this.morphTargets=this.skinning=!1,this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.setValues(t)},THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype),THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial,THREE.ShaderMaterial.prototype.clone=function(){var t=new THREE.ShaderMaterial;return THREE.Material.prototype.clone.call(this,t),t.fragmentShader=this.fragmentShader,t.vertexShader=this.vertexShader,t.uniforms=THREE.UniformsUtils.clone(this.uniforms),t.attributes=this.attributes,t.defines=this.defines,t.shading=this.shading,t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t.fog=this.fog,t.lights=this.lights,t.vertexColors=this.vertexColors,t.skinning=this.skinning,t.morphTargets=this.morphTargets,t.morphNormals=this.morphNormals,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.RawShaderMaterial.prototype.clone=function(){var t=new THREE.RawShaderMaterial;return THREE.ShaderMaterial.prototype.clone.call(this,t),t},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.clone=function(){var t=new THREE.SpriteMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.map=this.map,t.rotation=this.rotation,t.fog=this.fog,t},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._needsUpdate=!1,this.onUpdate=null},THREE.Texture.DEFAULT_IMAGE=void 0,THREE.Texture.DEFAULT_MAPPING=THREE.UVMapping,THREE.Texture.prototype={constructor:THREE.Texture,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){!0===t&&this.update(),this._needsUpdate=t},clone:function(t){return void 0===t&&(t=new THREE.Texture),t.image=this.image,t.mipmaps=this.mipmaps.slice(0),t.mapping=this.mapping,t.wrapS=this.wrapS,t.wrapT=this.wrapT,t.magFilter=this.magFilter,t.minFilter=this.minFilter,t.anisotropy=this.anisotropy,t.format=this.format,t.type=this.type,t.offset.copy(this.offset),t.repeat.copy(this.repeat),t.generateMipmaps=this.generateMipmaps,t.premultiplyAlpha=this.premultiplyAlpha,t.flipY=this.flipY,t.unpackAlignment=this.unpackAlignment,t},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.Texture.prototype),THREE.TextureIdCount=0,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},THREE.CubeTexture.prototype=Object.create(THREE.Texture.prototype),THREE.CubeTexture.prototype.constructor=THREE.CubeTexture,THREE.CubeTexture.clone=function(t){return void 0===t&&(t=new THREE.CubeTexture),THREE.Texture.prototype.clone.call(this,t),t.images=this.images,t},THREE.CompressedTexture=function(t,e,r,i,n,o,a,s,h,l,c){THREE.Texture.call(this,null,o,a,s,h,l,i,n,c),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.CompressedTexture.prototype.clone=function(){var t=new THREE.CompressedTexture;return THREE.Texture.prototype.clone.call(this,t),t},THREE.DataTexture=function(t,e,r,i,n,o,a,s,h,l,c){THREE.Texture.call(this,null,o,a,s,h,l,i,n,c),this.image={data:t,width:e,height:r}},THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype),THREE.DataTexture.prototype.constructor=THREE.DataTexture,THREE.DataTexture.prototype.clone=function(){var t=new THREE.DataTexture;return THREE.Texture.prototype.clone.call(this,t),t},THREE.VideoTexture=function(t,e,r,i,n,o,a,s,h){THREE.Texture.call(this,t,e,r,i,n,o,a,s,h),this.generateMipmaps=!1;var l=this,c=function(){requestAnimationFrame(c),t.readyState===t.HAVE_ENOUGH_DATA&&(l.needsUpdate=!0)};c()},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.PointCloud=function(t,e){THREE.Object3D.call(this),this.type="PointCloud",this.geometry=void 0!==t?t:new THREE.Geometry,this.material=void 0!==e?e:new THREE.PointCloudMaterial({color:16777215*Math.random()})},THREE.PointCloud.prototype=Object.create(THREE.Object3D.prototype),THREE.PointCloud.prototype.constructor=THREE.PointCloud,THREE.PointCloud.prototype.raycast=function(){var f=new THREE.Matrix4,m=new THREE.Ray;return function(o,a){var s=this,t=s.geometry,e=o.params.PointCloud.threshold;if(f.getInverse(this.matrixWorld),m.copy(o.ray).applyMatrix4(f),null===t.boundingBox||!1!==m.isIntersectionBox(t.boundingBox)){var h=e/((this.scale.x+this.scale.y+this.scale.z)/3),r=new THREE.Vector3;e=function(t,e){var r=m.distanceToPoint(t);if(r<h){var i=m.closestPointToPoint(t);i.applyMatrix4(s.matrixWorld);var n=o.ray.origin.distanceTo(i);a.push({distance:n,distanceToRay:r,point:i.clone(),index:e,face:null,object:s})}};if(t instanceof THREE.BufferGeometry){var i=(n=t.attributes).position.array;if(void 0!==n.index){var n=n.index.array,l=t.offsets;0===l.length&&(l=[{start:0,count:n.length,index:0}]);for(var c=0,u=l.length;c<u;++c){var E=l[c].start,p=l[c].index;for(t=E,E=E+l[c].count;t<E;t++){var d=p+n[t];r.fromArray(i,3*d),e(r,d)}}}else for(n=i.length/3,t=0;t<n;t++)r.set(i[3*t],i[3*t+1],i[3*t+2]),e(r,t)}else for(r=this.geometry.vertices,t=0;t<r.length;t++)e(r[t],t)}}}(),THREE.PointCloud.prototype.clone=function(t){return void 0===t&&(t=new THREE.PointCloud(this.geometry,this.material)),THREE.Object3D.prototype.clone.call(this,t),t},THREE.ParticleSystem=function(t,e){return THREE.warn("THREE.ParticleSystem has been renamed to THREE.PointCloud."),new THREE.PointCloud(t,e)},THREE.Line=function(t,e,r){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()}),this.mode=void 0!==r?r:THREE.LineStrip},THREE.LineStrip=0,THREE.LinePieces=1,THREE.Line.prototype=Object.create(THREE.Object3D.prototype),THREE.Line.prototype.constructor=THREE.Line,THREE.Line.prototype.raycast=function(){var T=new THREE.Matrix4,g=new THREE.Ray,R=new THREE.Sphere;return function(t,e){var r=(r=t.linePrecision)*r;if(null===(f=this.geometry).boundingSphere&&f.computeBoundingSphere(),R.copy(f.boundingSphere),R.applyMatrix4(this.matrixWorld),!1!==t.ray.isIntersectionSphere(R)){T.getInverse(this.matrixWorld),g.copy(t.ray).applyMatrix4(T);var i=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Vector3,a=new THREE.Vector3,s=this.mode===THREE.LineStrip?1:2;if(f instanceof THREE.BufferGeometry)if(void 0!==(l=f.attributes).index){var h=l.index.array,l=l.position.array,c=f.offsets;0===c.length&&(c=[{start:0,count:h.length,index:0}]);for(var u=0;u<c.length;u++)for(var E=c[u].start,p=c[u].count,d=c[u].index,f=E;f<E+p-1;f+=s){var m=d+h[f+1];i.fromArray(l,3*(d+h[f])),n.fromArray(l,3*m),r<(m=g.distanceSqToSegment(i,n,a,o))||((m=g.origin.distanceTo(a))<t.near||m>t.far||e.push({distance:m,point:o.clone().applyMatrix4(this.matrixWorld),index:f,offsetIndex:u,face:null,faceIndex:null,object:this}))}}else for(l=l.position.array,f=0;f<l.length/3-1;f+=s)i.fromArray(l,3*f),n.fromArray(l,3*f+3),r<(m=g.distanceSqToSegment(i,n,a,o))||((m=g.origin.distanceTo(a))<t.near||m>t.far||e.push({distance:m,point:o.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}));else if(f instanceof THREE.Geometry)for(n=(i=f.vertices).length,f=0;f<n-1;f+=s)r<(m=g.distanceSqToSegment(i[f],i[f+1],a,o))||((m=g.origin.distanceTo(a))<t.near||m>t.far||e.push({distance:m,point:o.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}}}(),THREE.Line.prototype.clone=function(t){return void 0===t&&(t=new THREE.Line(this.geometry,this.material,this.mode)),THREE.Object3D.prototype.clone.call(this,t),t},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.morphTargetForcedOrder=[],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]:(THREE.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+t+" does not exist. Returning 0."),0)},THREE.Mesh.prototype.raycast=function(){var y=new THREE.Matrix4,v=new THREE.Ray,H=new THREE.Sphere,x=new THREE.Vector3,b=new THREE.Vector3,_=new THREE.Vector3;return function(t,e){if(null===(p=this.geometry).boundingSphere&&p.computeBoundingSphere(),H.copy(p.boundingSphere),H.applyMatrix4(this.matrixWorld),!1!==t.ray.isIntersectionSphere(H)&&(y.getInverse(this.matrixWorld),v.copy(t.ray).applyMatrix4(y),null===p.boundingBox||!1!==v.isIntersectionBox(p.boundingBox)))if(p instanceof THREE.BufferGeometry){var r=this.material;if(void 0!==r){var i,n,o=p.attributes,a=t.precision;if(void 0!==o.index){var s=o.index.array,h=o.position.array,l=p.offsets;0===l.length&&(l=[{start:0,count:s.length,index:0}]);for(var c=0,u=l.length;c<u;++c){o=l[c].start;for(var E=l[c].index,p=o,d=o+l[c].count;p<d;p+=3){o=E+s[p],i=E+s[p+1],n=E+s[p+2],x.fromArray(h,3*o),b.fromArray(h,3*i),_.fromArray(h,3*n);var f=r.side===THREE.BackSide?v.intersectTriangle(_,b,x,!0):v.intersectTriangle(x,b,_,r.side!==THREE.DoubleSide);if(null!==f){f.applyMatrix4(this.matrixWorld);var m=t.ray.origin.distanceTo(f);m<a||m<t.near||m>t.far||e.push({distance:m,point:f,face:new THREE.Face3(o,i,n,THREE.Triangle.normal(x,b,_)),faceIndex:null,object:this})}}}}else for(s=p=0,d=(h=o.position.array).length;p<d;p+=3,s+=9)i=(o=p)+1,n=p+2,x.fromArray(h,s),b.fromArray(h,s+3),_.fromArray(h,s+6),null!==(f=r.side===THREE.BackSide?v.intersectTriangle(_,b,x,!0):v.intersectTriangle(x,b,_,r.side!==THREE.DoubleSide))&&(f.applyMatrix4(this.matrixWorld),(m=t.ray.origin.distanceTo(f))<a||m<t.near||m>t.far||e.push({distance:m,point:f,face:new THREE.Face3(o,i,n,THREE.Triangle.normal(x,b,_)),faceIndex:null,object:this}))}}else if(p instanceof THREE.Geometry)for(h=!0===(s=this.material instanceof THREE.MeshFaceMaterial)?this.material.materials:null,a=t.precision,l=p.vertices,c=0,u=p.faces.length;c<u;c++)if(E=p.faces[c],void 0!==(r=!0===s?h[E.materialIndex]:this.material)){if(o=l[E.a],i=l[E.b],n=l[E.c],!0===r.morphTargets){f=p.morphTargets,m=this.morphTargetInfluences,x.set(0,0,0),b.set(0,0,0),_.set(0,0,0);d=0;for(var T=f.length;d<T;d++){var g=m[d];if(0!==g){var R=f[d].vertices;x.x+=(R[E.a].x-o.x)*g,x.y+=(R[E.a].y-o.y)*g,x.z+=(R[E.a].z-o.z)*g,b.x+=(R[E.b].x-i.x)*g,b.y+=(R[E.b].y-i.y)*g,b.z+=(R[E.b].z-i.z)*g,_.x+=(R[E.c].x-n.x)*g,_.y+=(R[E.c].y-n.y)*g,_.z+=(R[E.c].z-n.z)*g}}x.add(o),b.add(i),_.add(n),o=x,i=b,n=_}null!==(f=r.side===THREE.BackSide?v.intersectTriangle(n,i,o,!0):v.intersectTriangle(o,i,n,r.side!==THREE.DoubleSide))&&(f.applyMatrix4(this.matrixWorld),(m=t.ray.origin.distanceTo(f))<a||m<t.near||m>t.far||e.push({distance:m,point:f,face:E,faceIndex:c,object:this}))}}}(),THREE.Mesh.prototype.clone=function(t,e){return void 0===t&&(t=new THREE.Mesh(this.geometry,this.material)),THREE.Object3D.prototype.clone.call(this,t,e),t},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.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?(this.boneTextureHeight=this.boneTextureWidth=t=256<this.bones.length?64:64<this.bones.length?32:16<this.bones.length?16:8,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.boneTexture.minFilter=THREE.NearestFilter,this.boneTexture.magFilter=THREE.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1):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(THREE.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.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,o,a,s=0,h=this.geometry.bones.length;s<h;++s)n=(i=this.geometry.bones[s]).pos,o=i.rotq,a=i.scl,e=new THREE.Bone(this),t.push(e),e.name=i.name,e.position.set(n[0],n[1],n[2]),e.quaternion.set(o[0],o[1],o[2],o[3]),void 0!==a?e.scale.set(a[0],a[1],a[2]):e.scale.set(1,1,1);for(s=0,h=this.geometry.bones.length;s<h;++s)-1!==(i=this.geometry.bones[s]).parent?t[i.parent].add(t[s]):this.add(t[s])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new THREE.Skeleton(t,void 0,r))},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),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):THREE.warn("THREE.SkinnedMesh unreckognized bindMode: "+this.bindMode)},THREE.SkinnedMesh.prototype.clone=function(t){return void 0===t&&(t=new THREE.SkinnedMesh(this.geometry,this.material,this.useVertexTexture)),THREE.Mesh.prototype.clone.call(this,t),t},THREE.MorphAnimMesh=function(t,e){THREE.Mesh.call(this,t,e),this.type="MorphAnimMesh",this.duration=1e3,this.mirroredLoop=!1,this.currentKeyframe=this.lastKeyframe=this.time=0,this.direction=1,this.directionBackwards=!1,this.setFrameRange(0,this.geometry.morphTargets.length-1)},THREE.MorphAnimMesh.prototype=Object.create(THREE.Mesh.prototype),THREE.MorphAnimMesh.prototype.constructor=THREE.MorphAnimMesh,THREE.MorphAnimMesh.prototype.setFrameRange=function(t,e){this.startKeyframe=t,this.endKeyframe=e,this.length=this.endKeyframe-this.startKeyframe+1},THREE.MorphAnimMesh.prototype.setDirectionForward=function(){this.direction=1,this.directionBackwards=!1},THREE.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1,this.directionBackwards=!0},THREE.MorphAnimMesh.prototype.parseAnimations=function(){var t=this.geometry;t.animations||(t.animations={});for(var e,r=t.animations,i=/([a-z]+)_?(\d+)/,n=0,o=t.morphTargets.length;n<o;n++){var a=t.morphTargets[n].name.match(i);if(a&&1<a.length){r[a=a[1]]||(r[a]={start:1/0,end:-1/0});var s=r[a];n<s.start&&(s.start=n),n>s.end&&(s.end=n),e||(e=a)}}t.firstAnimation=e},THREE.MorphAnimMesh.prototype.setAnimationLabel=function(t,e,r){this.geometry.animations||(this.geometry.animations={}),this.geometry.animations[t]={start:e,end:r}},THREE.MorphAnimMesh.prototype.playAnimation=function(t,e){var r=this.geometry.animations[t];r?(this.setFrameRange(r.start,r.end),this.duration=(r.end-r.start)/e*1e3,this.time=0):THREE.warn("THREE.MorphAnimMesh: animation["+t+"] undefined in .playAnimation()")},THREE.MorphAnimMesh.prototype.updateAnimation=function(t){var e=this.duration/this.length;this.time+=this.direction*t,this.mirroredLoop?(this.time>this.duration||this.time<0)&&(this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),this.time<0&&(this.time=0,this.directionBackwards=!1)):(this.time%=this.duration,this.time<0&&(this.time+=this.duration)),(t=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/e),0,this.length-1))!==this.currentKeyframe&&(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[t]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=t),e=this.time%e/e,this.directionBackwards&&(e=1-e),this.morphTargetInfluences[this.currentKeyframe]=e,this.morphTargetInfluences[this.lastKeyframe]=1-e},THREE.MorphAnimMesh.prototype.interpolateTargets=function(t,e,r){for(var i=this.morphTargetInfluences,n=0,o=i.length;n<o;n++)i[n]=0;-1<t&&(i[t]=1-r),-1<e&&(i[e]=r)},THREE.MorphAnimMesh.prototype.clone=function(t){return void 0===t&&(t=new THREE.MorphAnimMesh(this.geometry,this.material)),t.duration=this.duration,t.mirroredLoop=this.mirroredLoop,t.time=this.time,t.lastKeyframe=this.lastKeyframe,t.currentKeyframe=this.currentKeyframe,t.direction=this.direction,t.directionBackwards=this.directionBackwards,THREE.Mesh.prototype.clone.call(this,t),t},THREE.LOD=function(){THREE.Object3D.call(this),this.objects=[]},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=0;r<this.objects.length&&!(e<this.objects[r].distance);r++);this.objects.splice(r,0,{distance:e,object:t}),this.add(t)},THREE.LOD.prototype.getObjectForDistance=function(t){for(var e=1,r=this.objects.length;e<r&&!(t<this.objects[e].distance);e++);return this.objects[e-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 i=new THREE.Vector3,n=new THREE.Vector3;return function(t){if(1<this.objects.length){i.setFromMatrixPosition(t.matrixWorld),n.setFromMatrixPosition(this.matrixWorld),t=i.distanceTo(n),this.objects[0].object.visible=!0;for(var e=1,r=this.objects.length;e<r&&t>=this.objects[e].distance;e++)this.objects[e-1].object.visible=!1,this.objects[e].object.visible=!0;for(;e<r;e++)this.objects[e].object.visible=!1}}}(),THREE.LOD.prototype.clone=function(t){void 0===t&&(t=new THREE.LOD),THREE.Object3D.prototype.clone.call(this,t);for(var e=0,r=this.objects.length;e<r;e++){var i=this.objects[e].object.clone();i.visible=0===e,t.addLevel(i,this.objects[e].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.addAttribute("index",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.distanceToPoint(i);r>this.scale.x||e.push({distance:r,point:this.position,face:null,object:this})}}(),THREE.Sprite.prototype.clone=function(t){return void 0===t&&(t=new THREE.Sprite(this.material)),THREE.Object3D.prototype.clone.call(this,t),t},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:1,opacity:o,color:n,blending:i})},THREE.LensFlare.prototype.updateLensFlares=function(){var t,e,r=this.lensFlares.length,i=2*-this.positionScreen.x,n=2*-this.positionScreen.y;for(t=0;t<r;t++)(e=this.lensFlares[t]).x=this.positionScreen.x+i*e.distance,e.y=this.positionScreen.y+n*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)},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.clone=function(t){return void 0===t&&(t=new THREE.Scene),THREE.Object3D.prototype.clone.call(this,t),null!==this.fog&&(t.fog=this.fog.clone()),null!==this.overrideMaterial&&(t.overrideMaterial=this.overrideMaterial.clone()),t.autoUpdate=this.autoUpdate,t.matrixAutoUpdate=this.matrixAutoUpdate,t},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.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\nfloat square( in float a ) { return a*a; }\nvec2 square( in vec2 a ) { return vec2( a.x*a.x, a.y*a.y ); }\nvec3 square( in vec3 a ) { return vec3( a.x*a.x, a.y*a.y, a.z*a.z ); }\nvec4 square( in vec4 a ) { return vec4( a.x*a.x, a.y*a.y, a.z*a.z, a.w*a.w ); }\nfloat saturate( in float a ) { return clamp( a, 0.0, 1.0 ); }\nvec2 saturate( in vec2 a ) { return clamp( a, 0.0, 1.0 ); }\nvec3 saturate( in vec3 a ) { return clamp( a, 0.0, 1.0 ); }\nvec4 saturate( in vec4 a ) { return clamp( a, 0.0, 1.0 ); }\nfloat average( in float a ) { return a; }\nfloat average( in vec2 a ) { return ( a.x + a.y) * 0.5; }\nfloat average( in vec3 a ) { return ( a.x + a.y + a.z) / 3.0; }\nfloat average( in vec4 a ) { return ( a.x + a.y + a.z + a.w) * 0.25; }\nfloat whiteCompliment( in float a ) { return saturate( 1.0 - a ); }\nvec2 whiteCompliment( in vec2 a ) { return saturate( vec2(1.0) - a ); }\nvec3 whiteCompliment( in vec3 a ) { return saturate( vec3(1.0) - a ); }\nvec4 whiteCompliment( in vec4 a ) { return saturate( vec4(1.0) - a ); }\nvec3 transformDirection( in vec3 normal, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );\n}\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n\treturn normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\n\tfloat distance = dot( planeNormal, point-pointOnPlane );\n\treturn point - distance * planeNormal;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn pointOnLine + lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) );\n}\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\n\tif ( decayExponent > 0.0 ) {\n\t return pow( saturate( 1.0 - lightDistance / cutoffDistance ), decayExponent );\n\t}\n\treturn 1.0;\n}\n\nvec3 inputToLinear( in vec3 a ) {\n#ifdef GAMMA_INPUT\n\treturn pow( a, vec3( float( GAMMA_FACTOR ) ) );\n#else\n\treturn a;\n#endif\n}\nvec3 linearToOutput( in vec3 a ) {\n#ifdef GAMMA_OUTPUT\n\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n#else\n\treturn a;\n#endif\n}\n",THREE.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n\tif ( diffuseColor.a < ALPHATEST ) discard;\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\ntransformedNormal = normalize( transformedNormal );\n\n#if MAX_DIR_LIGHTS > 0\n\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\tvec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n\tfloat dotProduct = dot( transformedNormal, dirVector );\n\tvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t#endif\n\n\t#endif\n\n\t#ifdef WRAP_AROUND\n\n\t\tvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\tdirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tdirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n\n\t\t#endif\n\n\t#endif\n\n\tvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n\n\t#endif\n\n}\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\tpointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tpointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\tvLightFront += pointLightColor[ i ] * pointLightWeighting * attenuation;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += pointLightColor[ i ] * pointLightWeightingBack * attenuation;\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\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n\t\t\tlVector = normalize( lVector );\n\n\t\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\t\t\tvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\t\tvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\t\tspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n\n\t\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\t\tspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvLightFront += spotLightColor[ i ] * spotLightWeighting * attenuation * spotEffect;\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvLightBack += spotLightColor[ i ] * spotLightWeightingBack * attenuation * spotEffect;\n\n\t\t\t#endif\n\n\t\t}\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 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\t\tfloat hemiDiffuseWeightBack = -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\tvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n\t\t#endif\n\n\t}\n\n#endif\n\nvLightFront += ambientLightColor;\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack += ambientLightColor;\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.default_vertex="#ifdef USE_SKINNING\n\n\tvec4 mvPosition = modelViewMatrix * skinned;\n\n#elif defined( USE_MORPHTARGETS )\n\n\tvec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n\n#else\n\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n",THREE.ShaderChunk.map_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif",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\t#ifdef USE_MORPHNORMALS\n\n\tvec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n\n\t#else\n\n\tvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\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.lightmap_pars_vertex="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\n#endif",THREE.ShaderChunk.lights_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\nvec3 viewPosition = normalize( vViewPosition );\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\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\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\ttotalDiffuseLight += pointLightColor[ i ] * pointDiffuseWeight * attenuation;\n\n\t\t\t\t// specular\n\n\t\tvec3 pointHalfVector = normalize( lVector + viewPosition );\n\t\tfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n\t\tfloat pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;\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\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\t// diffuse\n\n\t\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\t\tfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\t\tvec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n\t\t\t#else\n\n\t\t\t\tfloat spotDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t\t#endif\n\n\t\t\ttotalDiffuseLight += spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;\n\n\t\t\t// specular\n\n\t\t\tvec3 spotHalfVector = normalize( lVector + viewPosition );\n\t\t\tfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n\t\t\tfloat spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n\t\t\ttotalSpecularLight += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;\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 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, dirVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\ttotalDiffuseLight += directionalLightColor[ i ] * dirDiffuseWeight;\n\n\t\t// specular\n\n\t\tvec3 dirHalfVector = normalize( dirVector + viewPosition );\n\t\tfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n\t\tfloat dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n\t\t/*\n\t\t// fresnel term from skin shader\n\t\tconst float F0 = 0.128;\n\n\t\tfloat base = 1.0 - dot( viewPosition, dirHalfVector );\n\t\tfloat exponential = pow( base, 5.0 );\n\n\t\tfloat fresnel = exponential + F0 * ( 1.0 - exponential );\n\t\t*/\n\n\t\t/*\n\t\t// fresnel term from fresnel shader\n\t\tconst float mFresnelBias = 0.08;\n\t\tconst float mFresnelScale = 0.3;\n\t\tconst float mFresnelPower = 5.0;\n\n\t\tfloat fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n\t\t*/\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t// \t\tdirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\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 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n\t\tvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\ttotalDiffuseLight += hemiColor;\n\n\t\t// specular (sky light)\n\n\t\tvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n\t\tfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n\t\tfloat hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n\t\t// specular (ground light)\n\n\t\tvec3 lVectorGround = -lVector;\n\n\t\tvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n\t\tfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n\t\tfloat hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n\t\tfloat dotProductGround = dot( normal, lVectorGround );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n\t\tvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n\t}\n\n#endif\n\n#ifdef METAL\n\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) * specular + totalSpecularLight + emissive;\n\n#else\n\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) + totalSpecularLight + emissive;\n\n#endif\n",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.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n\tvec3 morphedNormal = vec3( 0.0 );\n\n\tmorphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tmorphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tmorphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tmorphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n\tmorphedNormal += normal;\n\n#endif",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.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",THREE.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n\t// Per-Pixel Tangent Space Normal Mapping\n\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\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.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n",THREE.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\tuniform sampler2D lightMap;\n\n#endif",THREE.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n\t}\n\n#endif",THREE.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvWorldPosition = worldPosition.xyz;\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",THREE.ShaderChunk.lightmap_vertex="#ifdef USE_LIGHTMAP\n\n\tvUv2 = uv2;\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.color_pars_fragment="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n",THREE.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n\tvColor.xyz = inputToLinear( color.xyz );\n\n#endif",THREE.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n\t#ifdef USE_MORPHTARGETS\n\n\tvec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\n\n\t#else\n\n\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\n\t#endif\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.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.linear_to_gamma_fragment="\n\toutgoingLight = linearToOutput( outgoingLight );\n",THREE.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif",THREE.ShaderChunk.lights_lambert_pars_vertex="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\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\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n",THREE.ShaderChunk.map_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\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\t// Transforming Normal Vectors with the Inverse Transformation\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 = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\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.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\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.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.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.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 = exp2( - square( fogDensity ) * square( depth ) * LOG2 );\n\t\tfogFactor = whiteCompliment( fogFactor );\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.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n\t// http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\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;\t\t// normalized\n\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.defaultnormal_vertex="#ifdef USE_SKINNING\n\n\tvec3 objectNormal = skinnedNormal.xyz;\n\n#elif defined( USE_MORPHNORMALS )\n\n\tvec3 objectNormal = morphedNormal;\n\n#else\n\n\tvec3 objectNormal = normal;\n\n#endif\n\n#ifdef FLIP_SIDED\n\n\tobjectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\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_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n",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.map_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif",THREE.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\n\toutgoingLight *= diffuseColor.xyz * texture2D( lightMap, vUv2 ).xyz;\n\n#endif",THREE.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\tuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\n#endif",THREE.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif",THREE.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n\tvec3 morphed = vec3( 0.0 );\n\tmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\tmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\tmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\tmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n\t#ifndef USE_MORPHNORMALS\n\n\tmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\tmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\tmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\tmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n\t#endif\n\n\tmorphed += position;\n\n#endif",THREE.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvec3 worldNormal = transformDirection( objectNormal, modelMatrix );\n\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\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.shadowmap_fragment="#ifdef USE_SHADOWMAP\n\n\t#ifdef SHADOWMAP_DEBUG\n\n\t\tvec3 frustumColors[3];\n\t\tfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\n\t\tfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\n\t\tfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n\n\t#endif\n\n\t#ifdef SHADOWMAP_CASCADE\n\n\t\tint inFrustumCount = 0;\n\n\t#endif\n\n\tfloat fDepth;\n\tvec3 shadowColor = vec3( 1.0 );\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n\t\t\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\n\t\t\t\t// if ( all( something, something ) ) using this instead\n\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\n\t\t\t\t// don't shadow pixels outside of light frustum\n\t\t\t\t// use just first frustum (for cascades)\n\t\t\t\t// don't shadow pixels behind far plane of light frustum\n\n\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\tinFrustumCount += int( inFrustum );\n\t\t\tbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n\n\t\t#else\n\n\t\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\t#endif\n\n\t\tbool frustumTest = all( frustumTestVec );\n\n\t\tif ( frustumTest ) {\n\n\t\t\tshadowCoord.z += shadowBias[ i ];\n\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t/*\n\t\t\t\t\t\t// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n\t\t\t\t\t\t// must enroll loop manually\n\n\t\t\t\tfor ( float y = -1.25; y <= 1.25; y += 1.25 )\n\t\t\t\t\tfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\n\t\t\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\n\t\t\t\t\t\t\t\t// doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n\t\t\t\t\t\t\t\t//vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n\n\t\t\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\t\t\tif ( fDepth < shadowCoord.z )\n\t\t\t\t\t\t\tshadow += 1.0;\n\n\t\t\t\t}\n\n\t\t\t\tshadow /= 9.0;\n\n\t\t*/\n\n\t\t\t\tconst float shadowDelta = 1.0 / 9.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\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\tfDepth = 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\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\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 ) );\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#else\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\n\t\t// spot with multiple shadows is darker\n\n\t\t\t\t\tshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n\n\t\t// spot with multiple shadows has the same color as single shadow spot\n\n\t\t// \t\t\t\t\tshadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\n\n\t\t\t#endif\n\n\t\t}\n\n\n\t\t#ifdef SHADOWMAP_DEBUG\n\n\t\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\t\tif ( inFrustum && inFrustumCount == 1 ) outgoingLight *= frustumColors[ i ];\n\n\t\t\t#else\n\n\t\t\t\tif ( inFrustum ) outgoingLight *= frustumColors[ i ];\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t}\n\n\t// NOTE: I am unsure if this is correct in linear space. -bhouston, Dec 29, 2014\n\tshadowColor = inputToLinear( shadowColor );\n\n\toutgoingLight = outgoingLight * shadowColor;\n\n#endif\n",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#elif defined( USE_MORPHTARGETS )\n\n\t\tvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n\n\t#else\n\n\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\n\t#endif\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#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.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n\tuniform float logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\t#extension GL_EXT_frag_depth : enable\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n#endif",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.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];r[e][i]=n instanceof THREE.Color||n instanceof THREE.Vector2||n instanceof THREE.Vector3||n instanceof THREE.Vector4||n instanceof THREE.Matrix4||n instanceof THREE.Texture?n.clone():n instanceof Array?n.slice():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)},lightMap:{type:"t",value:null},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},morphTargetInfluences:{type:"f",value:0}},bump:{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)}},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:[]}},particle:{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.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_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.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinbase_vertex,"\t#ifdef USE_ENVMAP",THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"\t#endif",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_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.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.lightmap_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 );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,"\toutgoingLight = diffuseColor.rgb;",THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_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)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif",THREE.ShaderChunk.common,THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_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.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_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;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.lightmap_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 );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,"\t#ifdef DOUBLE_SIDED\n\t\tif ( gl_FrontFacing )\n\t\t\toutgoingLight += diffuseColor.rgb * vLightFront + emissive;\n\t\telse\n\t\t\toutgoingLight += diffuseColor.rgb * vLightBack + emissive;\n\t#else\n\t\toutgoingLight += diffuseColor.rgb * vLightFront + emissive;\n\t#endif",THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_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.bump,THREE.UniformsLib.normalmap,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},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",THREE.ShaderChunk.common,THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_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.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_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.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_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.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.lightmap_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 );",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.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,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 );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphatest_fragment,"\toutgoingLight = diffuseColor.rgb;",THREE.ShaderChunk.shadowmap_fragment,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.morphtarget_vertex,THREE.ShaderChunk.default_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.morphtarget_vertex,THREE.ShaderChunk.default_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.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_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")}},THREE.WebGLRenderer=function(t){function u(t){var e=t.geometry;t=t.material;var r=e.vertices.length;if(t.attributes)for(var i in void 0===e.__webglCustomAttributesList&&(e.__webglCustomAttributesList=[]),t.attributes){var n=t.attributes[i];if(!n.__webglInitialized||n.createUniqueBuffers){n.__webglInitialized=!0;var o=1;"v2"===n.type?o=2:"v3"===n.type?o=3:"v4"===n.type?o=4:"c"===n.type&&(o=3),n.size=o,n.array=new Float32Array(r*o),n.buffer=We.createBuffer(),n.buffer.belongsToAttribute=i,n.needsUpdate=!0}e.__webglCustomAttributesList.push(n)}}function Ne(t,e){return t.material instanceof THREE.MeshFaceMaterial?t.material.materials[e.materialIndex]:t.material}function E(t,e,r,i){r=r.attributes;for(var n=e.attributes,o=0,a=(e=e.attributesKeys).length;o<a;o++){var s=e[o],h=n[s];if(0<=h){var l=r[s];void 0!==l?(s=l.itemSize,We.bindBuffer(We.ARRAY_BUFFER,l.buffer),I.enableAttribute(h),We.vertexAttribPointer(h,s,We.FLOAT,!1,0,i*s*4)):void 0!==t.defaultAttributeValues&&(2===t.defaultAttributeValues[s].length?We.vertexAttrib2fv(h,t.defaultAttributeValues[s]):3===t.defaultAttributeValues[s].length&&We.vertexAttrib3fv(h,t.defaultAttributeValues[s]))}}I.disableUnusedAttributes()}function p(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 d(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 f(t,e){return e[0]-t[0]}function m(t,e,r,i,n){for(var o,a=0,s=t.length;a<s;a++){var h=(o=t[a]).object,l=o.buffer;if(H(h,e),n)o=n;else{if(!(o=o.material))continue;y(o)}be.setMaterialFaces(o),l instanceof THREE.BufferGeometry?be.renderBufferDirect(e,r,i,o,l,h):be.renderBuffer(e,r,i,o,l,h)}}function T(t,e,r,i,n,o){for(var a,s=0,h=t.length;s<h;s++){var l=(a=t[s]).object;if(l.visible){if(o)a=o;else{if(!(a=a[e]))continue;y(a)}be.renderImmediateObject(r,i,n,a,l)}}}function Oe(t,e){var r=t.material,i=!1;if(void 0===Xe[e.id]||!0===e.groupsNeedUpdate){delete w[t.id];for(var n,o,a=Xe,s=e.id,h=(r=r instanceof THREE.MeshFaceMaterial,W.get("OES_element_index_uint")?4294967296:65535),l=(i={},e.morphTargets.length),c=e.morphNormals.length,u={},E=[],p=0,d=e.faces.length;p<d;p++){n=e.faces[p];var f=r?n.materialIndex:0;f in i||(i[f]={hash:f,counter:0}),(n=i[f].hash+"_"+i[f].counter)in u||(o={id:Et++,faces3:[],materialIndex:f,vertices:0,numMorphTargets:l,numMorphNormals:c},u[n]=o,E.push(o)),u[n].vertices+3>h&&(i[f].counter+=1,(n=i[f].hash+"_"+i[f].counter)in u||(o={id:Et++,faces3:[],materialIndex:f,vertices:0,numMorphTargets:l,numMorphNormals:c},u[n]=o,E.push(o))),u[n].faces3.push(p),u[n].vertices+=3}a[s]=E,e.groupsNeedUpdate=!1}for(s=0,r=(a=Xe[e.id]).length;s<r;s++){if(void 0===(h=a[s]).__webglVertexBuffer){if((i=h).__webglVertexBuffer=We.createBuffer(),i.__webglNormalBuffer=We.createBuffer(),i.__webglTangentBuffer=We.createBuffer(),i.__webglColorBuffer=We.createBuffer(),i.__webglUVBuffer=We.createBuffer(),i.__webglUV2Buffer=We.createBuffer(),i.__webglSkinIndicesBuffer=We.createBuffer(),i.__webglSkinWeightsBuffer=We.createBuffer(),i.__webglFaceBuffer=We.createBuffer(),i.__webglLineBuffer=We.createBuffer(),c=i.numMorphTargets)for(i.__webglMorphTargetsBuffers=[],l=0;l<c;l++)i.__webglMorphTargetsBuffers.push(We.createBuffer());if(c=i.numMorphNormals)for(i.__webglMorphNormalsBuffers=[],l=0;l<c;l++)i.__webglMorphNormalsBuffers.push(We.createBuffer());if(be.info.memory.geometries++,i=h,d=(p=t).geometry,l=3*(c=i.faces3).length,u=1*c.length,E=3*c.length,c=Ne(p,i),i.__vertexArray=new Float32Array(3*l),i.__normalArray=new Float32Array(3*l),i.__colorArray=new Float32Array(3*l),i.__uvArray=new Float32Array(2*l),1<d.faceVertexUvs.length&&(i.__uv2Array=new Float32Array(2*l)),d.hasTangents&&(i.__tangentArray=new Float32Array(4*l)),p.geometry.skinWeights.length&&p.geometry.skinIndices.length&&(i.__skinIndexArray=new Float32Array(4*l),i.__skinWeightArray=new Float32Array(4*l)),p=null!==W.get("OES_element_index_uint")&&21845<u?Uint32Array:Uint16Array,i.__typeArray=p,i.__faceArray=new p(3*u),i.__lineArray=new p(2*E),d=i.numMorphTargets)for(i.__morphTargetsArrays=[],p=0;p<d;p++)i.__morphTargetsArrays.push(new Float32Array(3*l));if(d=i.numMorphNormals)for(i.__morphNormalsArrays=[],p=0;p<d;p++)i.__morphNormalsArrays.push(new Float32Array(3*l));if(i.__webglFaceCount=3*u,i.__webglLineCount=2*E,c.attributes)for(u in void 0===i.__webglCustomAttributesList&&(i.__webglCustomAttributesList=[]),u=void 0,c.attributes){var m;E=c.attributes[u],p={};for(m in E)p[m]=E[m];p.__webglInitialized&&!p.createUniqueBuffers||(p.__webglInitialized=!0,d=1,"v2"===p.type?d=2:"v3"===p.type?d=3:"v4"===p.type?d=4:"c"===p.type&&(d=3),p.size=d,p.array=new Float32Array(l*d),p.buffer=We.createBuffer(),p.buffer.belongsToAttribute=u,E.needsUpdate=!0,p.__original=E),i.__webglCustomAttributesList.push(p)}i.__inittedArrays=!0,e.verticesNeedUpdate=!0,e.morphTargetsNeedUpdate=!0,e.elementsNeedUpdate=!0,e.uvsNeedUpdate=!0,e.normalsNeedUpdate=!0,e.tangentsNeedUpdate=!0,i=e.colorsNeedUpdate=!0}else i=!1;(i||void 0===t.__webglActive)&&g(w,h,t)}t.__webglActive=!0}function g(t,e,r){var i=r.id;t[i]=t[i]||[],t[i].push({id:i,buffer:e,object:r,material:null,z:0})}function R(t){var e=t.geometry;if(e instanceof THREE.BufferGeometry)for(var r=e.attributes,i=e.attributesKeys,n=0,o=i.length;n<o;n++){var a=i[n],s=r[a],h="index"===a?We.ELEMENT_ARRAY_BUFFER:We.ARRAY_BUFFER;void 0===s.buffer?(s.buffer=We.createBuffer(),We.bindBuffer(h,s.buffer),We.bufferData(h,s.array,s instanceof THREE.DynamicBufferAttribute?We.DYNAMIC_DRAW:We.STATIC_DRAW),s.needsUpdate=!1):!0===s.needsUpdate&&(We.bindBuffer(h,s.buffer),void 0===s.updateRange||-1===s.updateRange.count?We.bufferSubData(h,0,s.array):0===s.updateRange.count?console.error("THREE.WebGLRenderer.updateObject: using updateRange for THREE.DynamicBufferAttribute and marked as needsUpdate but count is 0, ensure you are using set methods or updating manually."):(We.bufferSubData(h,s.updateRange.offset*s.array.BYTES_PER_ELEMENT,s.array.subarray(s.updateRange.offset,s.updateRange.offset+s.updateRange.count)),s.updateRange.count=0),s.needsUpdate=!1)}else if(t instanceof THREE.Mesh){!0===e.groupsNeedUpdate&&Oe(t,e);for(var l=Xe[e.id],c=(n=0,l.length);n<c;n++){var u=l[n],E=Ne(t,u),p=E.attributes&&Ge(E);if(e.verticesNeedUpdate||e.morphTargetsNeedUpdate||e.elementsNeedUpdate||e.uvsNeedUpdate||e.normalsNeedUpdate||e.colorsNeedUpdate||e.tangentsNeedUpdate||p){var d=u,f=t,m=We.DYNAMIC_DRAW,T=!e.dynamic,g=E;if(d.__inittedArrays){var R=!1==g instanceof THREE.MeshPhongMaterial&&g.shading===THREE.FlatShading,y=void 0,v=void 0,H=void 0,x=void 0,b=void 0,_=void 0,w=void 0,M=void 0,S=void 0,A=void 0,C=void 0,L=void 0,P=void 0,F=void 0,U=void 0,B=void 0,D=void 0,V=void 0,z=void 0,k=void 0,N=void 0,O=void 0,G=void 0,I=void 0,W=void 0,j=void 0,X=void 0,q=void 0,Y=void 0,K=void 0,Q=void 0,Z=void 0,J=void 0,$=void 0,tt=void 0,et=void 0,rt=void 0,it=void 0,nt=void 0,ot=0,at=0,st=0,ht=0,lt=0,ct=0,ut=0,Et=0,pt=0,dt=0,ft=0,mt=0,Tt=void 0,gt=d.__vertexArray,Rt=d.__uvArray,yt=d.__uv2Array,vt=d.__normalArray,Ht=d.__tangentArray,xt=d.__colorArray,bt=d.__skinIndexArray,_t=d.__skinWeightArray,wt=d.__morphTargetsArrays,Mt=d.__morphNormalsArrays,St=d.__webglCustomAttributesList,At=void 0,Ct=d.__faceArray,Lt=d.__lineArray,Pt=f.geometry,Ft=Pt.elementsNeedUpdate,Ut=Pt.uvsNeedUpdate,Bt=Pt.normalsNeedUpdate,Dt=Pt.tangentsNeedUpdate,Vt=Pt.colorsNeedUpdate,zt=Pt.morphTargetsNeedUpdate,kt=Pt.vertices,Nt=d.faces3,Ot=Pt.faces,Gt=Pt.faceVertexUvs[0],It=Pt.faceVertexUvs[1],Wt=Pt.skinIndices,jt=Pt.skinWeights,Xt=Pt.morphTargets,qt=Pt.morphNormals;if(Pt.verticesNeedUpdate){for(y=0,v=Nt.length;y<v;y++)C=kt[(H=Ot[Nt[y]]).a],L=kt[H.b],P=kt[H.c],gt[at]=C.x,gt[at+1]=C.y,gt[at+2]=C.z,gt[at+3]=L.x,gt[at+4]=L.y,gt[at+5]=L.z,gt[at+6]=P.x,gt[at+7]=P.y,gt[at+8]=P.z,at+=9;We.bindBuffer(We.ARRAY_BUFFER,d.__webglVertexBuffer),We.bufferData(We.ARRAY_BUFFER,gt,m)}if(zt)for($=0,tt=Xt.length;$<tt;$++){for(y=ft=0,v=Nt.length;y<v;y++)H=Ot[it=Nt[y]],C=Xt[$].vertices[H.a],L=Xt[$].vertices[H.b],P=Xt[$].vertices[H.c],(et=wt[$])[ft]=C.x,et[ft+1]=C.y,et[ft+2]=C.z,et[ft+3]=L.x,et[ft+4]=L.y,et[ft+5]=L.z,et[ft+6]=P.x,et[ft+7]=P.y,et[ft+8]=P.z,g.morphNormals&&(R?z=V=D=qt[$].faceNormals[it]:(D=(nt=qt[$].vertexNormals[it]).a,V=nt.b,z=nt.c),(rt=Mt[$])[ft]=D.x,rt[ft+1]=D.y,rt[ft+2]=D.z,rt[ft+3]=V.x,rt[ft+4]=V.y,rt[ft+5]=V.z,rt[ft+6]=z.x,rt[ft+7]=z.y,rt[ft+8]=z.z),ft+=9;We.bindBuffer(We.ARRAY_BUFFER,d.__webglMorphTargetsBuffers[$]),We.bufferData(We.ARRAY_BUFFER,wt[$],m),g.morphNormals&&(We.bindBuffer(We.ARRAY_BUFFER,d.__webglMorphNormalsBuffers[$]),We.bufferData(We.ARRAY_BUFFER,Mt[$],m))}if(jt.length){for(y=0,v=Nt.length;y<v;y++)G=jt[(H=Ot[Nt[y]]).a],I=jt[H.b],W=jt[H.c],_t[dt]=G.x,_t[dt+1]=G.y,_t[dt+2]=G.z,_t[dt+3]=G.w,_t[dt+4]=I.x,_t[dt+5]=I.y,_t[dt+6]=I.z,_t[dt+7]=I.w,_t[dt+8]=W.x,_t[dt+9]=W.y,_t[dt+10]=W.z,_t[dt+11]=W.w,j=Wt[H.a],X=Wt[H.b],q=Wt[H.c],bt[dt]=j.x,bt[dt+1]=j.y,bt[dt+2]=j.z,bt[dt+3]=j.w,bt[dt+4]=X.x,bt[dt+5]=X.y,bt[dt+6]=X.z,bt[dt+7]=X.w,bt[dt+8]=q.x,bt[dt+9]=q.y,bt[dt+10]=q.z,bt[dt+11]=q.w,dt+=12;0<dt&&(We.bindBuffer(We.ARRAY_BUFFER,d.__webglSkinIndicesBuffer),We.bufferData(We.ARRAY_BUFFER,bt,m),We.bindBuffer(We.ARRAY_BUFFER,d.__webglSkinWeightsBuffer),We.bufferData(We.ARRAY_BUFFER,_t,m))}if(Vt){for(y=0,v=Nt.length;y<v;y++)_=(H=Ot[Nt[y]]).vertexColors,w=H.color,3===_.length&&g.vertexColors===THREE.VertexColors?(k=_[0],N=_[1],O=_[2]):O=N=k=w,xt[pt]=k.r,xt[pt+1]=k.g,xt[pt+2]=k.b,xt[pt+3]=N.r,xt[pt+4]=N.g,xt[pt+5]=N.b,xt[pt+6]=O.r,xt[pt+7]=O.g,xt[pt+8]=O.b,pt+=9;0<pt&&(We.bindBuffer(We.ARRAY_BUFFER,d.__webglColorBuffer),We.bufferData(We.ARRAY_BUFFER,xt,m))}if(Dt&&Pt.hasTangents){for(y=0,v=Nt.length;y<v;y++)F=(M=(H=Ot[Nt[y]]).vertexTangents)[0],U=M[1],B=M[2],Ht[ut]=F.x,Ht[ut+1]=F.y,Ht[ut+2]=F.z,Ht[ut+3]=F.w,Ht[ut+4]=U.x,Ht[ut+5]=U.y,Ht[ut+6]=U.z,Ht[ut+7]=U.w,Ht[ut+8]=B.x,Ht[ut+9]=B.y,Ht[ut+10]=B.z,Ht[ut+11]=B.w,ut+=12;We.bindBuffer(We.ARRAY_BUFFER,d.__webglTangentBuffer),We.bufferData(We.ARRAY_BUFFER,Ht,m)}if(Bt){for(y=0,v=Nt.length;y<v;y++)if(x=(H=Ot[Nt[y]]).vertexNormals,b=H.normal,3===x.length&&!1===R)for(Y=0;Y<3;Y++)Q=x[Y],vt[ct]=Q.x,vt[ct+1]=Q.y,vt[ct+2]=Q.z,ct+=3;else for(Y=0;Y<3;Y++)vt[ct]=b.x,vt[ct+1]=b.y,vt[ct+2]=b.z,ct+=3;We.bindBuffer(We.ARRAY_BUFFER,d.__webglNormalBuffer),We.bufferData(We.ARRAY_BUFFER,vt,m)}if(Ut&&Gt){for(y=0,v=Nt.length;y<v;y++)if(void 0!==(S=Gt[Nt[y]]))for(Y=0;Y<3;Y++)Z=S[Y],Rt[st]=Z.x,Rt[st+1]=Z.y,st+=2;0<st&&(We.bindBuffer(We.ARRAY_BUFFER,d.__webglUVBuffer),We.bufferData(We.ARRAY_BUFFER,Rt,m))}if(Ut&&It){for(y=0,v=Nt.length;y<v;y++)if(void 0!==(A=It[Nt[y]]))for(Y=0;Y<3;Y++)J=A[Y],yt[ht]=J.x,yt[ht+1]=J.y,ht+=2;0<ht&&(We.bindBuffer(We.ARRAY_BUFFER,d.__webglUV2Buffer),We.bufferData(We.ARRAY_BUFFER,yt,m))}if(Ft){for(y=0,v=Nt.length;y<v;y++)Ct[lt]=ot,Ct[lt+1]=ot+1,Ct[lt+2]=ot+2,lt+=3,Lt[Et]=ot,Lt[Et+1]=ot+1,Lt[Et+2]=ot,Lt[Et+3]=ot+2,Lt[Et+4]=ot+1,Lt[Et+5]=ot+2,Et+=6,ot+=3;We.bindBuffer(We.ELEMENT_ARRAY_BUFFER,d.__webglFaceBuffer),We.bufferData(We.ELEMENT_ARRAY_BUFFER,Ct,m),We.bindBuffer(We.ELEMENT_ARRAY_BUFFER,d.__webglLineBuffer),We.bufferData(We.ELEMENT_ARRAY_BUFFER,Lt,m)}if(St)for(Y=0,K=St.length;Y<K;Y++)if((At=St[Y]).__original.needsUpdate){if(mt=0,1===At.size){if(void 0===At.boundTo||"vertices"===At.boundTo)for(y=0,v=Nt.length;y<v;y++)H=Ot[Nt[y]],At.array[mt]=At.value[H.a],At.array[mt+1]=At.value[H.b],At.array[mt+2]=At.value[H.c],mt+=3;else if("faces"===At.boundTo)for(y=0,v=Nt.length;y<v;y++)Tt=At.value[Nt[y]],At.array[mt]=Tt,At.array[mt+1]=Tt,At.array[mt+2]=Tt,mt+=3}else if(2===At.size){if(void 0===At.boundTo||"vertices"===At.boundTo)for(y=0,v=Nt.length;y<v;y++)H=Ot[Nt[y]],C=At.value[H.a],L=At.value[H.b],P=At.value[H.c],At.array[mt]=C.x,At.array[mt+1]=C.y,At.array[mt+2]=L.x,At.array[mt+3]=L.y,At.array[mt+4]=P.x,At.array[mt+5]=P.y,mt+=6;else if("faces"===At.boundTo)for(y=0,v=Nt.length;y<v;y++)P=L=C=Tt=At.value[Nt[y]],At.array[mt]=C.x,At.array[mt+1]=C.y,At.array[mt+2]=L.x,At.array[mt+3]=L.y,At.array[mt+4]=P.x,At.array[mt+5]=P.y,mt+=6}else if(3===At.size){var Yt;if(Yt="c"===At.type?["r","g","b"]:["x","y","z"],void 0===At.boundTo||"vertices"===At.boundTo)for(y=0,v=Nt.length;y<v;y++)H=Ot[Nt[y]],C=At.value[H.a],L=At.value[H.b],P=At.value[H.c],At.array[mt]=C[Yt[0]],At.array[mt+1]=C[Yt[1]],At.array[mt+2]=C[Yt[2]],At.array[mt+3]=L[Yt[0]],At.array[mt+4]=L[Yt[1]],At.array[mt+5]=L[Yt[2]],At.array[mt+6]=P[Yt[0]],At.array[mt+7]=P[Yt[1]],At.array[mt+8]=P[Yt[2]],mt+=9;else if("faces"===At.boundTo)for(y=0,v=Nt.length;y<v;y++)P=L=C=Tt=At.value[Nt[y]],At.array[mt]=C[Yt[0]],At.array[mt+1]=C[Yt[1]],At.array[mt+2]=C[Yt[2]],At.array[mt+3]=L[Yt[0]],At.array[mt+4]=L[Yt[1]],At.array[mt+5]=L[Yt[2]],At.array[mt+6]=P[Yt[0]],At.array[mt+7]=P[Yt[1]],At.array[mt+8]=P[Yt[2]],mt+=9;else if("faceVertices"===At.boundTo)for(y=0,v=Nt.length;y<v;y++)C=(Tt=At.value[Nt[y]])[0],L=Tt[1],P=Tt[2],At.array[mt]=C[Yt[0]],At.array[mt+1]=C[Yt[1]],At.array[mt+2]=C[Yt[2]],At.array[mt+3]=L[Yt[0]],At.array[mt+4]=L[Yt[1]],At.array[mt+5]=L[Yt[2]],At.array[mt+6]=P[Yt[0]],At.array[mt+7]=P[Yt[1]],At.array[mt+8]=P[Yt[2]],mt+=9}else if(4===At.size)if(void 0===At.boundTo||"vertices"===At.boundTo)for(y=0,v=Nt.length;y<v;y++)H=Ot[Nt[y]],C=At.value[H.a],L=At.value[H.b],P=At.value[H.c],At.array[mt]=C.x,At.array[mt+1]=C.y,At.array[mt+2]=C.z,At.array[mt+3]=C.w,At.array[mt+4]=L.x,At.array[mt+5]=L.y,At.array[mt+6]=L.z,At.array[mt+7]=L.w,At.array[mt+8]=P.x,At.array[mt+9]=P.y,At.array[mt+10]=P.z,At.array[mt+11]=P.w,mt+=12;else if("faces"===At.boundTo)for(y=0,v=Nt.length;y<v;y++)P=L=C=Tt=At.value[Nt[y]],At.array[mt]=C.x,At.array[mt+1]=C.y,At.array[mt+2]=C.z,At.array[mt+3]=C.w,At.array[mt+4]=L.x,At.array[mt+5]=L.y,At.array[mt+6]=L.z,At.array[mt+7]=L.w,At.array[mt+8]=P.x,At.array[mt+9]=P.y,At.array[mt+10]=P.z,At.array[mt+11]=P.w,mt+=12;else if("faceVertices"===At.boundTo)for(y=0,v=Nt.length;y<v;y++)C=(Tt=At.value[Nt[y]])[0],L=Tt[1],P=Tt[2],At.array[mt]=C.x,At.array[mt+1]=C.y,At.array[mt+2]=C.z,At.array[mt+3]=C.w,At.array[mt+4]=L.x,At.array[mt+5]=L.y,At.array[mt+6]=L.z,At.array[mt+7]=L.w,At.array[mt+8]=P.x,At.array[mt+9]=P.y,At.array[mt+10]=P.z,At.array[mt+11]=P.w,mt+=12;We.bindBuffer(We.ARRAY_BUFFER,At.buffer),We.bufferData(We.ARRAY_BUFFER,At.array,m)}T&&(delete d.__inittedArrays,delete d.__colorArray,delete d.__normalArray,delete d.__tangentArray,delete d.__uvArray,delete d.__uv2Array,delete d.__faceArray,delete d.__vertexArray,delete d.__lineArray,delete d.__skinIndexArray,delete d.__skinWeightArray)}}}e.verticesNeedUpdate=!1,e.morphTargetsNeedUpdate=!1,e.elementsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.tangentsNeedUpdate=!1,E.attributes&&Ie(E)}else if(t instanceof THREE.Line){if(p=(E=Ne(t,e)).attributes&&Ge(E),e.verticesNeedUpdate||e.colorsNeedUpdate||e.lineDistancesNeedUpdate||p){var Kt,Qt,Zt,Jt,$t,te,ee,re,ie,ne,oe,ae,se=We.DYNAMIC_DRAW,he=e.vertices,le=e.colors,ce=e.lineDistances,ue=he.length,Ee=le.length,pe=ce.length,de=e.__vertexArray,fe=e.__colorArray,me=e.__lineDistanceArray,Te=e.colorsNeedUpdate,ge=e.lineDistancesNeedUpdate,Re=e.__webglCustomAttributesList;if(e.verticesNeedUpdate){for(Kt=0;Kt<ue;Kt++)Jt=he[Kt],de[$t=3*Kt]=Jt.x,de[$t+1]=Jt.y,de[$t+2]=Jt.z;We.bindBuffer(We.ARRAY_BUFFER,e.__webglVertexBuffer),We.bufferData(We.ARRAY_BUFFER,de,se)}if(Te){for(Qt=0;Qt<Ee;Qt++)te=le[Qt],fe[$t=3*Qt]=te.r,fe[$t+1]=te.g,fe[$t+2]=te.b;We.bindBuffer(We.ARRAY_BUFFER,e.__webglColorBuffer),We.bufferData(We.ARRAY_BUFFER,fe,se)}if(ge){for(Zt=0;Zt<pe;Zt++)me[Zt]=ce[Zt];We.bindBuffer(We.ARRAY_BUFFER,e.__webglLineDistanceBuffer),We.bufferData(We.ARRAY_BUFFER,me,se)}if(Re)for(ee=0,re=Re.length;ee<re;ee++)if((ae=Re[ee]).needsUpdate&&(void 0===ae.boundTo||"vertices"===ae.boundTo)){if($t=0,ne=ae.value.length,1===ae.size)for(ie=0;ie<ne;ie++)ae.array[ie]=ae.value[ie];else if(2===ae.size)for(ie=0;ie<ne;ie++)oe=ae.value[ie],ae.array[$t]=oe.x,ae.array[$t+1]=oe.y,$t+=2;else if(3===ae.size)if("c"===ae.type)for(ie=0;ie<ne;ie++)oe=ae.value[ie],ae.array[$t]=oe.r,ae.array[$t+1]=oe.g,ae.array[$t+2]=oe.b,$t+=3;else for(ie=0;ie<ne;ie++)oe=ae.value[ie],ae.array[$t]=oe.x,ae.array[$t+1]=oe.y,ae.array[$t+2]=oe.z,$t+=3;else if(4===ae.size)for(ie=0;ie<ne;ie++)oe=ae.value[ie],ae.array[$t]=oe.x,ae.array[$t+1]=oe.y,ae.array[$t+2]=oe.z,ae.array[$t+3]=oe.w,$t+=4;We.bindBuffer(We.ARRAY_BUFFER,ae.buffer),We.bufferData(We.ARRAY_BUFFER,ae.array,se),ae.needsUpdate=!1}}e.verticesNeedUpdate=!1,e.colorsNeedUpdate=!1,e.lineDistancesNeedUpdate=!1,E.attributes&&Ie(E)}else if(t instanceof THREE.PointCloud){if(p=(E=Ne(t,e)).attributes&&Ge(E),e.verticesNeedUpdate||e.colorsNeedUpdate||p){var ye,ve,He,xe,be,_e,we,Me,Se,Ae,Ce,Le=We.DYNAMIC_DRAW,Pe=e.vertices,Fe=Pe.length,Ue=e.colors,Be=Ue.length,De=e.__vertexArray,Ve=e.__colorArray,ze=e.colorsNeedUpdate,ke=e.__webglCustomAttributesList;if(e.verticesNeedUpdate){for(ye=0;ye<Fe;ye++)He=Pe[ye],De[xe=3*ye]=He.x,De[xe+1]=He.y,De[xe+2]=He.z;We.bindBuffer(We.ARRAY_BUFFER,e.__webglVertexBuffer),We.bufferData(We.ARRAY_BUFFER,De,Le)}if(ze){for(ve=0;ve<Be;ve++)be=Ue[ve],Ve[xe=3*ve]=be.r,Ve[xe+1]=be.g,Ve[xe+2]=be.b;We.bindBuffer(We.ARRAY_BUFFER,e.__webglColorBuffer),We.bufferData(We.ARRAY_BUFFER,Ve,Le)}if(ke)for(_e=0,we=ke.length;_e<we;_e++){if((Ce=ke[_e]).needsUpdate&&(void 0===Ce.boundTo||"vertices"===Ce.boundTo))if(Se=Ce.value.length,xe=0,1===Ce.size)for(Me=0;Me<Se;Me++)Ce.array[Me]=Ce.value[Me];else if(2===Ce.size)for(Me=0;Me<Se;Me++)Ae=Ce.value[Me],Ce.array[xe]=Ae.x,Ce.array[xe+1]=Ae.y,xe+=2;else if(3===Ce.size)if("c"===Ce.type)for(Me=0;Me<Se;Me++)Ae=Ce.value[Me],Ce.array[xe]=Ae.r,Ce.array[xe+1]=Ae.g,Ce.array[xe+2]=Ae.b,xe+=3;else for(Me=0;Me<Se;Me++)Ae=Ce.value[Me],Ce.array[xe]=Ae.x,Ce.array[xe+1]=Ae.y,Ce.array[xe+2]=Ae.z,xe+=3;else if(4===Ce.size)for(Me=0;Me<Se;Me++)Ae=Ce.value[Me],Ce.array[xe]=Ae.x,Ce.array[xe+1]=Ae.y,Ce.array[xe+2]=Ae.z,Ce.array[xe+3]=Ae.w,xe+=4;We.bindBuffer(We.ARRAY_BUFFER,Ce.buffer),We.bufferData(We.ARRAY_BUFFER,Ce.array,Le),Ce.needsUpdate=!1}}e.verticesNeedUpdate=!1,e.colorsNeedUpdate=!1,E.attributes&&Ie(E)}}function Ge(t){for(var e in t.attributes)if(t.attributes[e].needsUpdate)return!0;return!1}function Ie(t){for(var e in t.attributes)t.attributes[e].needsUpdate=!1}function y(t){!0===t.transparent?I.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha):I.setBlending(THREE.NoBlending),I.setDepthTest(t.depthTest),I.setDepthWrite(t.depthWrite),I.setColorWrite(t.colorWrite),I.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function v(t,e,r,i,n){var o,a,s,h;if(Ae=0,i.needsUpdate){i.program&&je(i),i.addEventListener("dispose",ke);var l,c=qe[i.type];if(c){var u=THREE.ShaderLib[c];i.__webglShader={uniforms:THREE.UniformsUtils.clone(u.uniforms),vertexShader:u.vertexShader,fragmentShader:u.fragmentShader}}else i.__webglShader={uniforms:i.uniforms,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader};for(var E=0,p=0,d=0,f=0,m=0,T=e.length;m<T;m++){var g=e[m];g.onlyShadow||!1===g.visible||(g instanceof THREE.DirectionalLight&&E++,g instanceof THREE.PointLight&&p++,g instanceof THREE.SpotLight&&d++,g instanceof THREE.HemisphereLight&&f++)}o=E,a=p,s=d,h=f;for(var R,y=0,v=0,H=e.length;v<H;v++){var x=e[v];x.castShadow&&(x instanceof THREE.SpotLight&&y++,x instanceof THREE.DirectionalLight&&!x.shadowCascade&&y++)}if(R=y,De&&n&&n.skeleton&&n.skeleton.useVertexTexture)l=1024;else{var b=We.getParameter(We.MAX_VERTEX_UNIFORM_VECTORS),_=Math.floor((b-20)/4);void 0!==n&&n instanceof THREE.SkinnedMesh&&((_=Math.min(n.skeleton.bones.length,_))<n.skeleton.bones.length&&THREE.warn("WebGLRenderer: too many bones - "+n.skeleton.bones.length+", this GPU supports just "+_+" (try OpenGL instead of ANGLE)")),l=_}var w={precision:He,supportsVertexTextures:Be,map:!!i.map,envMap:!!i.envMap,envMapMode:i.envMap&&i.envMap.mapping,lightMap:!!i.lightMap,bumpMap:!!i.bumpMap,normalMap:!!i.normalMap,specularMap:!!i.specularMap,alphaMap:!!i.alphaMap,combine:i.combine,vertexColors:i.vertexColors,fog:r,useFog:i.fog,fogExp:r instanceof THREE.FogExp2,flatShading:i.shading===THREE.FlatShading,sizeAttenuation:i.sizeAttenuation,logarithmicDepthBuffer:xe,skinning:i.skinning,maxBones:l,useVertexTexture:De&&n&&n.skeleton&&n.skeleton.useVertexTexture,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:be.maxMorphTargets,maxMorphNormals:be.maxMorphNormals,maxDirLights:o,maxPointLights:a,maxSpotLights:s,maxHemiLights:h,maxShadows:R,shadowMapEnabled:be.shadowMapEnabled&&n.receiveShadow&&0<R,shadowMapType:be.shadowMapType,shadowMapDebug:be.shadowMapDebug,shadowMapCascade:be.shadowMapCascade,alphaTest:i.alphaTest,metal:i.metal,wrapAround:i.wrapAround,doubleSided:i.side===THREE.DoubleSide,flipSided:i.side===THREE.BackSide},M=[];if(c?M.push(c):(M.push(i.fragmentShader),M.push(i.vertexShader)),void 0!==i.defines)for(var S in i.defines)M.push(S),M.push(i.defines[S]);for(S in w)M.push(S),M.push(w[S]);for(var A,C=M.join(),L=0,P=_e.length;L<P;L++){var F=_e[L];if(F.code===C){(A=F).usedTimes++;break}}void 0===A&&(A=new THREE.WebGLProgram(be,C,i,w),_e.push(A),be.info.memory.programs=_e.length);var U=(i.program=A).attributes;if(i.morphTargets)for(var B="morphTarget",D=i.numSupportedMorphTargets=0;D<be.maxMorphTargets;D++)0<=U[B+D]&&i.numSupportedMorphTargets++;if(i.morphNormals)for(B="morphNormal",D=i.numSupportedMorphNormals=0;D<be.maxMorphNormals;D++)0<=U[B+D]&&i.numSupportedMorphNormals++;for(var V in i.uniformsList=[],i.__webglShader.uniforms){var z=i.program.uniforms[V];z&&i.uniformsList.push([i.__webglShader.uniforms[V],z])}i.needsUpdate=!1}i.morphTargets&&!n.__webglMorphTargetInfluences&&(n.__webglMorphTargetInfluences=new Float32Array(be.maxMorphTargets));var k=!1,N=!1,O=!1,G=i.program,I=G.uniforms,W=i.__webglShader.uniforms;if(G.id!==we&&(We.useProgram(G.program),we=G.id,O=N=k=!0),i.id!==Me&&(-1===Me&&(O=!0),Me=i.id,N=!0),(k||t!==Se)&&(We.uniformMatrix4fv(I.projectionMatrix,!1,t.projectionMatrix.elements),xe&&We.uniform1f(I.logDepthBufFC,2/(Math.log(t.far+1)/Math.LN2)),t!==Se&&(Se=t),(i instanceof THREE.ShaderMaterial||i instanceof THREE.MeshPhongMaterial||i.envMap)&&null!==I.cameraPosition&&(Ce.setFromMatrixPosition(t.matrixWorld),We.uniform3f(I.cameraPosition,Ce.x,Ce.y,Ce.z)),(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshBasicMaterial||i instanceof THREE.ShaderMaterial||i.skinning)&&null!==I.viewMatrix&&We.uniformMatrix4fv(I.viewMatrix,!1,t.matrixWorldInverse.elements)),i.skinning)if(n.bindMatrix&&null!==I.bindMatrix&&We.uniformMatrix4fv(I.bindMatrix,!1,n.bindMatrix.elements),n.bindMatrixInverse&&null!==I.bindMatrixInverse&&We.uniformMatrix4fv(I.bindMatrixInverse,!1,n.bindMatrixInverse.elements),De&&n.skeleton&&n.skeleton.useVertexTexture){if(null!==I.boneTexture){var j=me();We.uniform1i(I.boneTexture,j),be.setTexture(n.skeleton.boneTexture,j)}null!==I.boneTextureWidth&&We.uniform1i(I.boneTextureWidth,n.skeleton.boneTextureWidth),null!==I.boneTextureHeight&&We.uniform1i(I.boneTextureHeight,n.skeleton.boneTextureHeight)}else n.skeleton&&n.skeleton.boneMatrices&&null!==I.boneGlobalMatrices&&We.uniformMatrix4fv(I.boneGlobalMatrices,!1,n.skeleton.boneMatrices);if(N){if(r&&i.fog&&(W.fogColor.value=r.color,r instanceof THREE.Fog?(W.fogNear.value=r.near,W.fogFar.value=r.far):r instanceof THREE.FogExp2&&(W.fogDensity.value=r.density)),i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i.lights){if(Pe){O=!0;var X,q,Y,K,Q,Z,J,$,tt=0,et=0,rt=0,it=Fe,nt=it.directional.colors,ot=it.directional.positions,at=it.point.colors,st=it.point.positions,ht=it.point.distances,lt=it.point.decays,ct=it.spot.colors,ut=it.spot.positions,Et=it.spot.distances,pt=it.spot.directions,dt=it.spot.anglesCos,ft=it.spot.exponents,mt=it.spot.decays,Tt=it.hemi.skyColors,gt=it.hemi.groundColors,Rt=it.hemi.positions,yt=0,vt=0,Ht=0,xt=0,bt=0,_t=0,wt=0,Mt=0,St=0,At=0,Ct=0,Lt=0;for(X=0,q=e.length;X<q;X++)(Y=e[X]).onlyShadow||(K=Y.color,J=Y.intensity,$=Y.distance,Y instanceof THREE.AmbientLight?Y.visible&&(tt+=K.r,et+=K.g,rt+=K.b):Y instanceof THREE.DirectionalLight?(bt+=1,Y.visible&&(Le.setFromMatrixPosition(Y.matrixWorld),Ce.setFromMatrixPosition(Y.target.matrixWorld),Le.sub(Ce),Le.normalize(),ot[St=3*yt]=Le.x,ot[St+1]=Le.y,ot[St+2]=Le.z,Te(nt,St,K,J),yt+=1)):Y instanceof THREE.PointLight?(_t+=1,Y.visible&&(Te(at,At=3*vt,K,J),Ce.setFromMatrixPosition(Y.matrixWorld),st[At]=Ce.x,st[At+1]=Ce.y,st[At+2]=Ce.z,ht[vt]=$,lt[vt]=0===Y.distance?0:Y.decay,vt+=1)):Y instanceof THREE.SpotLight?(wt+=1,Y.visible&&(Te(ct,Ct=3*Ht,K,J),Le.setFromMatrixPosition(Y.matrixWorld),ut[Ct]=Le.x,ut[Ct+1]=Le.y,ut[Ct+2]=Le.z,Et[Ht]=$,Ce.setFromMatrixPosition(Y.target.matrixWorld),Le.sub(Ce),Le.normalize(),pt[Ct]=Le.x,pt[Ct+1]=Le.y,pt[Ct+2]=Le.z,dt[Ht]=Math.cos(Y.angle),ft[Ht]=Y.exponent,mt[Ht]=0===Y.distance?0:Y.decay,Ht+=1)):Y instanceof THREE.HemisphereLight&&(Mt+=1,Y.visible&&(Le.setFromMatrixPosition(Y.matrixWorld),Le.normalize(),Rt[Lt=3*xt]=Le.x,Rt[Lt+1]=Le.y,Rt[Lt+2]=Le.z,Q=Y.color,Z=Y.groundColor,Te(Tt,Lt,Q,J),Te(gt,Lt,Z,J),xt+=1)));for(X=3*yt,q=Math.max(nt.length,3*bt);X<q;X++)nt[X]=0;for(X=3*vt,q=Math.max(at.length,3*_t);X<q;X++)at[X]=0;for(X=3*Ht,q=Math.max(ct.length,3*wt);X<q;X++)ct[X]=0;for(X=3*xt,q=Math.max(Tt.length,3*Mt);X<q;X++)Tt[X]=0;for(X=3*xt,q=Math.max(gt.length,3*Mt);X<q;X++)gt[X]=0;it.directional.length=yt,it.point.length=vt,it.spot.length=Ht,it.hemi.length=xt,it.ambient[0]=tt,it.ambient[1]=et,it.ambient[2]=rt,Pe=!1}if(O){var Pt=Fe;W.ambientLightColor.value=Pt.ambient,W.directionalLightColor.value=Pt.directional.colors,W.directionalLightDirection.value=Pt.directional.positions,W.pointLightColor.value=Pt.point.colors,W.pointLightPosition.value=Pt.point.positions,W.pointLightDistance.value=Pt.point.distances,W.pointLightDecay.value=Pt.point.decays,W.spotLightColor.value=Pt.spot.colors,W.spotLightPosition.value=Pt.spot.positions,W.spotLightDistance.value=Pt.spot.distances,W.spotLightDirection.value=Pt.spot.directions,W.spotLightAngleCos.value=Pt.spot.anglesCos,W.spotLightExponent.value=Pt.spot.exponents,W.spotLightDecay.value=Pt.spot.decays,W.hemisphereLightSkyColor.value=Pt.hemi.skyColors,W.hemisphereLightGroundColor.value=Pt.hemi.groundColors,W.hemisphereLightDirection.value=Pt.hemi.positions,fe(W,!0)}else fe(W,!1)}if(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial){var Ft;if(W.opacity.value=i.opacity,W.diffuse.value=i.color,W.map.value=i.map,W.lightMap.value=i.lightMap,W.specularMap.value=i.specularMap,W.alphaMap.value=i.alphaMap,i.bumpMap&&(W.bumpMap.value=i.bumpMap,W.bumpScale.value=i.bumpScale),i.normalMap&&(W.normalMap.value=i.normalMap,W.normalScale.value.copy(i.normalScale)),i.map?Ft=i.map:i.specularMap?Ft=i.specularMap:i.normalMap?Ft=i.normalMap:i.bumpMap?Ft=i.bumpMap:i.alphaMap&&(Ft=i.alphaMap),void 0!==Ft){var Ut=Ft.offset,Bt=Ft.repeat;W.offsetRepeat.value.set(Ut.x,Ut.y,Bt.x,Bt.y)}W.envMap.value=i.envMap,W.flipEnvMap.value=i.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,W.reflectivity.value=i.reflectivity,W.refractionRatio.value=i.refractionRatio}if(i instanceof THREE.LineBasicMaterial)W.diffuse.value=i.color,W.opacity.value=i.opacity;else if(i instanceof THREE.LineDashedMaterial)W.diffuse.value=i.color,W.opacity.value=i.opacity,W.dashSize.value=i.dashSize,W.totalSize.value=i.dashSize+i.gapSize,W.scale.value=i.scale;else if(i instanceof THREE.PointCloudMaterial){if(W.psColor.value=i.color,W.opacity.value=i.opacity,W.size.value=i.size,W.scale.value=ve.height/2,W.map.value=i.map,null!==i.map){var Dt=i.map.offset,Vt=i.map.repeat;W.offsetRepeat.value.set(Dt.x,Dt.y,Vt.x,Vt.y)}}else i instanceof THREE.MeshPhongMaterial?(W.shininess.value=i.shininess,W.emissive.value=i.emissive,W.specular.value=i.specular,i.wrapAround&&W.wrapRGB.value.copy(i.wrapRGB)):i instanceof THREE.MeshLambertMaterial?(W.emissive.value=i.emissive,i.wrapAround&&W.wrapRGB.value.copy(i.wrapRGB)):i instanceof THREE.MeshDepthMaterial?(W.mNear.value=t.near,W.mFar.value=t.far,W.opacity.value=i.opacity):i instanceof THREE.MeshNormalMaterial&&(W.opacity.value=i.opacity);if(n.receiveShadow&&!i._shadowPass&&W.shadowMatrix)for(var zt=0,kt=0,Nt=e.length;kt<Nt;kt++){var Ot=e[kt];Ot.castShadow&&(Ot instanceof THREE.SpotLight||Ot instanceof THREE.DirectionalLight&&!Ot.shadowCascade)&&(W.shadowMap.value[zt]=Ot.shadowMap,W.shadowMapSize.value[zt]=Ot.shadowMapSize,W.shadowMatrix.value[zt]=Ot.shadowMatrix,W.shadowDarkness.value[zt]=Ot.shadowDarkness,W.shadowBias.value[zt]=Ot.shadowBias,zt++)}for(var Gt,It,Wt,jt=i.uniformsList,Xt=0,qt=jt.length;Xt<qt;Xt++){var Yt=jt[Xt][0];if(!1!==Yt.needsUpdate){var Kt=Yt.type,Qt=Yt.value,Zt=jt[Xt][1];switch(Kt){case"1i":We.uniform1i(Zt,Qt);break;case"1f":We.uniform1f(Zt,Qt);break;case"2f":We.uniform2f(Zt,Qt[0],Qt[1]);break;case"3f":We.uniform3f(Zt,Qt[0],Qt[1],Qt[2]);break;case"4f":We.uniform4f(Zt,Qt[0],Qt[1],Qt[2],Qt[3]);break;case"1iv":We.uniform1iv(Zt,Qt);break;case"3iv":We.uniform3iv(Zt,Qt);break;case"1fv":We.uniform1fv(Zt,Qt);break;case"2fv":We.uniform2fv(Zt,Qt);break;case"3fv":We.uniform3fv(Zt,Qt);break;case"4fv":We.uniform4fv(Zt,Qt);break;case"Matrix3fv":We.uniformMatrix3fv(Zt,!1,Qt);break;case"Matrix4fv":We.uniformMatrix4fv(Zt,!1,Qt);break;case"i":We.uniform1i(Zt,Qt);break;case"f":We.uniform1f(Zt,Qt);break;case"v2":We.uniform2f(Zt,Qt.x,Qt.y);break;case"v3":We.uniform3f(Zt,Qt.x,Qt.y,Qt.z);break;case"v4":We.uniform4f(Zt,Qt.x,Qt.y,Qt.z,Qt.w);break;case"c":We.uniform3f(Zt,Qt.r,Qt.g,Qt.b);break;case"iv1":We.uniform1iv(Zt,Qt);break;case"iv":We.uniform3iv(Zt,Qt);break;case"fv1":We.uniform1fv(Zt,Qt);break;case"fv":We.uniform3fv(Zt,Qt);break;case"v2v":void 0===Yt._array&&(Yt._array=new Float32Array(2*Qt.length));for(var Jt=0,$t=Qt.length;Jt<$t;Jt++)Wt=2*Jt,Yt._array[Wt]=Qt[Jt].x,Yt._array[Wt+1]=Qt[Jt].y;We.uniform2fv(Zt,Yt._array);break;case"v3v":for(void 0===Yt._array&&(Yt._array=new Float32Array(3*Qt.length)),Jt=0,$t=Qt.length;Jt<$t;Jt++)Wt=3*Jt,Yt._array[Wt]=Qt[Jt].x,Yt._array[Wt+1]=Qt[Jt].y,Yt._array[Wt+2]=Qt[Jt].z;We.uniform3fv(Zt,Yt._array);break;case"v4v":for(void 0===Yt._array&&(Yt._array=new Float32Array(4*Qt.length)),Jt=0,$t=Qt.length;Jt<$t;Jt++)Wt=4*Jt,Yt._array[Wt]=Qt[Jt].x,Yt._array[Wt+1]=Qt[Jt].y,Yt._array[Wt+2]=Qt[Jt].z,Yt._array[Wt+3]=Qt[Jt].w;We.uniform4fv(Zt,Yt._array);break;case"m3":We.uniformMatrix3fv(Zt,!1,Qt.elements);break;case"m3v":for(void 0===Yt._array&&(Yt._array=new Float32Array(9*Qt.length)),Jt=0,$t=Qt.length;Jt<$t;Jt++)Qt[Jt].flattenToArrayOffset(Yt._array,9*Jt);We.uniformMatrix3fv(Zt,!1,Yt._array);break;case"m4":We.uniformMatrix4fv(Zt,!1,Qt.elements);break;case"m4v":for(void 0===Yt._array&&(Yt._array=new Float32Array(16*Qt.length)),Jt=0,$t=Qt.length;Jt<$t;Jt++)Qt[Jt].flattenToArrayOffset(Yt._array,16*Jt);We.uniformMatrix4fv(Zt,!1,Yt._array);break;case"t":if(Gt=Qt,It=me(),We.uniform1i(Zt,It),!Gt)continue;if(Gt instanceof THREE.CubeTexture||Gt.image instanceof Array&&6===Gt.image.length){var te=Gt,ee=It;if(6===te.image.length)if(te.needsUpdate){te.image.__webglTextureCube||(te.addEventListener("dispose",ze),te.image.__webglTextureCube=We.createTexture(),be.info.memory.textures++),We.activeTexture(We.TEXTURE0+ee),We.bindTexture(We.TEXTURE_CUBE_MAP,te.image.__webglTextureCube),We.pixelStorei(We.UNPACK_FLIP_Y_WEBGL,te.flipY);for(var re=te instanceof THREE.CompressedTexture,ie=te.image[0]instanceof THREE.DataTexture,ne=[],oe=0;oe<6;oe++)ne[oe]=!be.autoScaleCubemaps||re||ie?ie?te.image[oe].image:te.image[oe]:Re(te.image[oe],Ue);var ae=ne[0],se=THREE.Math.isPowerOfTwo(ae.width)&&THREE.Math.isPowerOfTwo(ae.height),he=ye(te.format),le=ye(te.type);for(ge(We.TEXTURE_CUBE_MAP,te,se),oe=0;oe<6;oe++)if(re)for(var ce,ue=ne[oe].mipmaps,Ee=0,pe=ue.length;Ee<pe;Ee++)ce=ue[Ee],te.format!==THREE.RGBAFormat&&te.format!==THREE.RGBFormat?-1<Ve().indexOf(he)?We.compressedTexImage2D(We.TEXTURE_CUBE_MAP_POSITIVE_X+oe,Ee,he,ce.width,ce.height,0,ce.data):THREE.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):We.texImage2D(We.TEXTURE_CUBE_MAP_POSITIVE_X+oe,Ee,he,ce.width,ce.height,0,he,le,ce.data);else ie?We.texImage2D(We.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,he,ne[oe].width,ne[oe].height,0,he,le,ne[oe].data):We.texImage2D(We.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,he,he,le,ne[oe]);te.generateMipmaps&&se&&We.generateMipmap(We.TEXTURE_CUBE_MAP),te.needsUpdate=!1,te.onUpdate&&te.onUpdate()}else We.activeTexture(We.TEXTURE0+ee),We.bindTexture(We.TEXTURE_CUBE_MAP,te.image.__webglTextureCube)}else if(Gt instanceof THREE.WebGLRenderTargetCube){var de=Gt;We.activeTexture(We.TEXTURE0+It),We.bindTexture(We.TEXTURE_CUBE_MAP,de.__webglTexture)}else be.setTexture(Gt,It);break;case"tv":for(void 0===Yt._array&&(Yt._array=[]),Jt=0,$t=Yt.value.length;Jt<$t;Jt++)Yt._array[Jt]=me();for(We.uniform1iv(Zt,Yt._array),Jt=0,$t=Yt.value.length;Jt<$t;Jt++)Gt=Yt.value[Jt],It=Yt._array[Jt],Gt&&be.setTexture(Gt,It);break;default:THREE.warn("THREE.WebGLRenderer: Unknown uniform type: "+Kt)}}}}return We.uniformMatrix4fv(I.modelViewMatrix,!1,n._modelViewMatrix.elements),I.normalMatrix&&We.uniformMatrix3fv(I.normalMatrix,!1,n._normalMatrix.elements),null!==I.modelMatrix&&We.uniformMatrix4fv(I.modelMatrix,!1,n.matrixWorld.elements),G}function fe(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 me(){var t=Ae;return K<=t&&THREE.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+K),Ae+=1,t}function H(t,e){t._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,t.matrixWorld),t._normalMatrix.getNormalMatrix(t._modelViewMatrix)}function Te(t,e,r,i){t[e]=r.r*i,t[e+1]=r.g*i,t[e+2]=r.b*i}function ge(t,e,r){r?(We.texParameteri(t,We.TEXTURE_WRAP_S,ye(e.wrapS)),We.texParameteri(t,We.TEXTURE_WRAP_T,ye(e.wrapT)),We.texParameteri(t,We.TEXTURE_MAG_FILTER,ye(e.magFilter)),We.texParameteri(t,We.TEXTURE_MIN_FILTER,ye(e.minFilter))):(We.texParameteri(t,We.TEXTURE_WRAP_S,We.CLAMP_TO_EDGE),We.texParameteri(t,We.TEXTURE_WRAP_T,We.CLAMP_TO_EDGE),e.wrapS===THREE.ClampToEdgeWrapping&&e.wrapT===THREE.ClampToEdgeWrapping||THREE.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( "+e.sourceFile+" )"),We.texParameteri(t,We.TEXTURE_MAG_FILTER,i(e.magFilter)),We.texParameteri(t,We.TEXTURE_MIN_FILTER,i(e.minFilter)),e.minFilter!==THREE.NearestFilter&&e.minFilter!==THREE.LinearFilter&&THREE.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( "+e.sourceFile+" )")),(r=W.get("EXT_texture_filter_anisotropic"))&&e.type!==THREE.FloatType&&e.type!==THREE.HalfFloatType&&(1<e.anisotropy||e.__currentAnisotropy)&&(We.texParameterf(t,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(e.anisotropy,be.getMaxAnisotropy())),e.__currentAnisotropy=e.anisotropy)}function Re(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),THREE.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t),i}return t}function h(t,e){We.bindRenderbuffer(We.RENDERBUFFER,t),e.depthBuffer&&!e.stencilBuffer?(We.renderbufferStorage(We.RENDERBUFFER,We.DEPTH_COMPONENT16,e.width,e.height),We.framebufferRenderbuffer(We.FRAMEBUFFER,We.DEPTH_ATTACHMENT,We.RENDERBUFFER,t)):e.depthBuffer&&e.stencilBuffer?(We.renderbufferStorage(We.RENDERBUFFER,We.DEPTH_STENCIL,e.width,e.height),We.framebufferRenderbuffer(We.FRAMEBUFFER,We.DEPTH_STENCIL_ATTACHMENT,We.RENDERBUFFER,t)):We.renderbufferStorage(We.RENDERBUFFER,We.RGBA4,e.width,e.height)}function i(t){return t===THREE.NearestFilter||t===THREE.NearestMipMapNearestFilter||t===THREE.NearestMipMapLinearFilter?We.NEAREST:We.LINEAR}function ye(t){var e;if(t===THREE.RepeatWrapping)return We.REPEAT;if(t===THREE.ClampToEdgeWrapping)return We.CLAMP_TO_EDGE;if(t===THREE.MirroredRepeatWrapping)return We.MIRRORED_REPEAT;if(t===THREE.NearestFilter)return We.NEAREST;if(t===THREE.NearestMipMapNearestFilter)return We.NEAREST_MIPMAP_NEAREST;if(t===THREE.NearestMipMapLinearFilter)return We.NEAREST_MIPMAP_LINEAR;if(t===THREE.LinearFilter)return We.LINEAR;if(t===THREE.LinearMipMapNearestFilter)return We.LINEAR_MIPMAP_NEAREST;if(t===THREE.LinearMipMapLinearFilter)return We.LINEAR_MIPMAP_LINEAR;if(t===THREE.UnsignedByteType)return We.UNSIGNED_BYTE;if(t===THREE.UnsignedShort4444Type)return We.UNSIGNED_SHORT_4_4_4_4;if(t===THREE.UnsignedShort5551Type)return We.UNSIGNED_SHORT_5_5_5_1;if(t===THREE.UnsignedShort565Type)return We.UNSIGNED_SHORT_5_6_5;if(t===THREE.ByteType)return We.BYTE;if(t===THREE.ShortType)return We.SHORT;if(t===THREE.UnsignedShortType)return We.UNSIGNED_SHORT;if(t===THREE.IntType)return We.INT;if(t===THREE.UnsignedIntType)return We.UNSIGNED_INT;if(t===THREE.FloatType)return We.FLOAT;if(null!==(e=W.get("OES_texture_half_float"))&&t===THREE.HalfFloatType)return e.HALF_FLOAT_OES;if(t===THREE.AlphaFormat)return We.ALPHA;if(t===THREE.RGBFormat)return We.RGB;if(t===THREE.RGBAFormat)return We.RGBA;if(t===THREE.LuminanceFormat)return We.LUMINANCE;if(t===THREE.LuminanceAlphaFormat)return We.LUMINANCE_ALPHA;if(t===THREE.AddEquation)return We.FUNC_ADD;if(t===THREE.SubtractEquation)return We.FUNC_SUBTRACT;if(t===THREE.ReverseSubtractEquation)return We.FUNC_REVERSE_SUBTRACT;if(t===THREE.ZeroFactor)return We.ZERO;if(t===THREE.OneFactor)return We.ONE;if(t===THREE.SrcColorFactor)return We.SRC_COLOR;if(t===THREE.OneMinusSrcColorFactor)return We.ONE_MINUS_SRC_COLOR;if(t===THREE.SrcAlphaFactor)return We.SRC_ALPHA;if(t===THREE.OneMinusSrcAlphaFactor)return We.ONE_MINUS_SRC_ALPHA;if(t===THREE.DstAlphaFactor)return We.DST_ALPHA;if(t===THREE.OneMinusDstAlphaFactor)return We.ONE_MINUS_DST_ALPHA;if(t===THREE.DstColorFactor)return We.DST_COLOR;if(t===THREE.OneMinusDstColorFactor)return We.ONE_MINUS_DST_COLOR;if(t===THREE.SrcAlphaSaturateFactor)return We.SRC_ALPHA_SATURATE;if(null!==(e=W.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=W.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=W.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 ve=void 0!==(t=t||{}).canvas?t.canvas:document.createElement("canvas"),e=void 0!==t.context?t.context:null,x=1,He=void 0!==t.precision?t.precision:"highp",r=void 0!==t.alpha&&t.alpha,n=void 0===t.depth||t.depth,o=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,xe=void 0!==t.logarithmicDepthBuffer&&t.logarithmicDepthBuffer,c=new THREE.Color(0),b=0,_=[],w={},M=[],S=[],A=[],C=[],L=[];this.domElement=ve,this.context=null,this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0,this.gammaFactor=2,this.shadowMapEnabled=this.gammaOutput=this.gammaInput=!1,this.shadowMapType=THREE.PCFShadowMap,this.shadowMapCullFace=THREE.CullFaceFront,this.shadowMapCascade=this.shadowMapDebug=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0,this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var We,be=this,_e=[],we=null,P=null,Me=-1,F="",Se=null,Ae=0,U=0,B=0,D=ve.width,V=ve.height,z=0,k=0,N=new THREE.Frustum,O=new THREE.Matrix4,Ce=new THREE.Vector3,Le=new THREE.Vector3,Pe=!0,Fe={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:[]}};try{var G={alpha:r,depth:n,stencil:o,antialias:a,premultipliedAlpha:s,preserveDrawingBuffer:l};if(null===(We=e||ve.getContext("webgl",G)||ve.getContext("experimental-webgl",G))){if(null!==ve.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context."}ve.addEventListener("webglcontextlost",function(t){t.preventDefault(),q(),X(),w={}},!1)}catch(t){THREE.error("THREE.WebGLRenderer: "+t)}var I=new THREE.WebGLState(We,ye);void 0===We.getShaderPrecisionFormat&&(We.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var W=new THREE.WebGLExtensions(We);W.get("OES_texture_float"),W.get("OES_texture_float_linear"),W.get("OES_texture_half_float"),W.get("OES_texture_half_float_linear"),W.get("OES_standard_derivatives"),xe&&W.get("EXT_frag_depth");var j=function(t,e,r,i){!0===s&&(t*=i,e*=i,r*=i),We.clearColor(t,e,r,i)},X=function(){We.clearColor(0,0,0,1),We.clearDepth(1),We.clearStencil(0),We.enable(We.DEPTH_TEST),We.depthFunc(We.LEQUAL),We.frontFace(We.CCW),We.cullFace(We.BACK),We.enable(We.CULL_FACE),We.enable(We.BLEND),We.blendEquation(We.FUNC_ADD),We.blendFunc(We.SRC_ALPHA,We.ONE_MINUS_SRC_ALPHA),We.viewport(U,B,D,V),j(c.r,c.g,c.b,b)},q=function(){Se=we=null,Me=-1,Pe=!(F=""),I.reset()};X(),this.context=We,this.state=I;var Y,K=We.getParameter(We.MAX_TEXTURE_IMAGE_UNITS),Q=We.getParameter(We.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Z=We.getParameter(We.MAX_TEXTURE_SIZE),Ue=We.getParameter(We.MAX_CUBE_MAP_TEXTURE_SIZE),Be=0<Q,De=Be&&W.get("OES_texture_float"),J=We.getShaderPrecisionFormat(We.VERTEX_SHADER,We.HIGH_FLOAT),$=We.getShaderPrecisionFormat(We.VERTEX_SHADER,We.MEDIUM_FLOAT),tt=We.getShaderPrecisionFormat(We.FRAGMENT_SHADER,We.HIGH_FLOAT),et=We.getShaderPrecisionFormat(We.FRAGMENT_SHADER,We.MEDIUM_FLOAT),Ve=function(){if(void 0!==Y)return Y;if(Y=[],W.get("WEBGL_compressed_texture_pvrtc")||W.get("WEBGL_compressed_texture_s3tc"))for(var t=We.getParameter(We.COMPRESSED_TEXTURE_FORMATS),e=0;e<t.length;e++)Y.push(t[e]);return Y},rt=0<J.precision&&0<tt.precision,it=0<$.precision&&0<et.precision;"highp"!==He||rt||(it?(He="mediump",THREE.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(He="lowp",THREE.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp."))),"mediump"!==He||it||(He="lowp",THREE.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));var nt,ot=new THREE.ShadowMapPlugin(this,_,w,M),at=new THREE.SpritePlugin(this,C),st=new THREE.LensFlarePlugin(this,L);this.getContext=function(){return We},this.forceContextLoss=function(){W.get("WEBGL_lose_context").loseContext()},this.supportsVertexTextures=function(){return Be},this.supportsFloatTextures=function(){return W.get("OES_texture_float")},this.supportsHalfFloatTextures=function(){return W.get("OES_texture_half_float")},this.supportsStandardDerivatives=function(){return W.get("OES_standard_derivatives")},this.supportsCompressedTextureS3TC=function(){return W.get("WEBGL_compressed_texture_s3tc")},this.supportsCompressedTexturePVRTC=function(){return W.get("WEBGL_compressed_texture_pvrtc")},this.supportsBlendMinMax=function(){return W.get("EXT_blend_minmax")},this.getMaxAnisotropy=function(){if(void 0!==nt)return nt;var t=W.get("EXT_texture_filter_anisotropic");return nt=null!==t?We.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},this.getPrecision=function(){return He},this.getPixelRatio=function(){return x},this.setPixelRatio=function(t){x=t},this.setSize=function(t,e,r){ve.width=t*x,ve.height=e*x,!1!==r&&(ve.style.width=t+"px",ve.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,r,i){U=t*x,B=e*x,D=r*x,V=i*x,We.viewport(U,B,D,V)},this.setScissor=function(t,e,r,i){We.scissor(t*x,e*x,r*x,i*x)},this.enableScissorTest=function(t){t?We.enable(We.SCISSOR_TEST):We.disable(We.SCISSOR_TEST)},this.getClearColor=function(){return c},this.setClearColor=function(t,e){c.set(t),b=void 0!==e?e:1,j(c.r,c.g,c.b,b)},this.getClearAlpha=function(){return b},this.setClearAlpha=function(t){b=t,j(c.r,c.g,c.b,b)},this.clear=function(t,e,r){var i=0;(void 0===t||t)&&(i|=We.COLOR_BUFFER_BIT),(void 0===e||e)&&(i|=We.DEPTH_BUFFER_BIT),(void 0===r||r)&&(i|=We.STENCIL_BUFFER_BIT),We.clear(i)},this.clearColor=function(){We.clear(We.COLOR_BUFFER_BIT)},this.clearDepth=function(){We.clear(We.DEPTH_BUFFER_BIT)},this.clearStencil=function(){We.clear(We.STENCIL_BUFFER_BIT)},this.clearTarget=function(t,e,r,i){this.setRenderTarget(t),this.clear(e,r,i)},this.resetGLState=q;var ht=function(t){t.target.traverse(function(t){if(t.removeEventListener("remove",ht),t instanceof THREE.Mesh||t instanceof THREE.PointCloud||t instanceof THREE.Line)delete w[t.id];else if(t instanceof THREE.ImmediateRenderObject||t.immediateRenderCallback)for(var e=M,r=e.length-1;0<=r;r--)e[r].object===t&&e.splice(r,1);delete t.__webglInit,delete t._modelViewMatrix,delete t._normalMatrix,delete t.__webglActive})},lt=function(t){if((t=t.target).removeEventListener("dispose",lt),delete t.__webglInit,t instanceof THREE.BufferGeometry){for(var e in t.attributes){void 0!==(r=t.attributes[e]).buffer&&(We.deleteBuffer(r.buffer),delete r.buffer)}be.info.memory.geometries--}else if(void 0!==(e=Xe[t.id])){for(var r=0,i=e.length;r<i;r++){var n=e[r];if(void 0!==n.numMorphTargets){for(var o=0,a=n.numMorphTargets;o<a;o++)We.deleteBuffer(n.__webglMorphTargetsBuffers[o]);delete n.__webglMorphTargetsBuffers}if(void 0!==n.numMorphNormals){for(o=0,a=n.numMorphNormals;o<a;o++)We.deleteBuffer(n.__webglMorphNormalsBuffers[o]);delete n.__webglMorphNormalsBuffers}ut(n)}delete Xe[t.id]}else ut(t);F=""},ze=function(t){(t=t.target).removeEventListener("dispose",ze),t.image&&t.image.__webglTextureCube?(We.deleteTexture(t.image.__webglTextureCube),delete t.image.__webglTextureCube):void 0!==t.__webglInit&&(We.deleteTexture(t.__webglTexture),delete t.__webglTexture,delete t.__webglInit),be.info.memory.textures--},ct=function(t){if((t=t.target).removeEventListener("dispose",ct),t&&void 0!==t.__webglTexture){if(We.deleteTexture(t.__webglTexture),delete t.__webglTexture,t instanceof THREE.WebGLRenderTargetCube)for(var e=0;e<6;e++)We.deleteFramebuffer(t.__webglFramebuffer[e]),We.deleteRenderbuffer(t.__webglRenderbuffer[e]);else We.deleteFramebuffer(t.__webglFramebuffer),We.deleteRenderbuffer(t.__webglRenderbuffer);delete t.__webglFramebuffer,delete t.__webglRenderbuffer}be.info.memory.textures--},ke=function(t){(t=t.target).removeEventListener("dispose",ke),je(t)},ut=function(t){for(var e="__webglVertexBuffer __webglNormalBuffer __webglTangentBuffer __webglColorBuffer __webglUVBuffer __webglUV2Buffer __webglSkinIndicesBuffer __webglSkinWeightsBuffer __webglFaceBuffer __webglLineBuffer __webglLineDistanceBuffer".split(" "),r=0,i=e.length;r<i;r++){var n=e[r];void 0!==t[n]&&(We.deleteBuffer(t[n]),delete t[n])}if(void 0!==t.__webglCustomAttributesList){for(n in t.__webglCustomAttributesList)We.deleteBuffer(t.__webglCustomAttributesList[n].buffer);delete t.__webglCustomAttributesList}be.info.memory.geometries--},je=function(t){var e=t.program.program;if(void 0!==e){t.program=void 0;var r,i,n=!1;for(t=0,r=_e.length;t<r;t++)if((i=_e[t]).program===e){i.usedTimes--,0===i.usedTimes&&(n=!0);break}if(!0===n){for(n=[],t=0,r=_e.length;t<r;t++)(i=_e[t]).program!==e&&n.push(i);_e=n,We.deleteProgram(e),be.info.memory.programs--}}};this.renderBufferImmediate=function(t,e,r){if(I.initAttributes(),t.hasPositions&&!t.__webglVertexBuffer&&(t.__webglVertexBuffer=We.createBuffer()),t.hasNormals&&!t.__webglNormalBuffer&&(t.__webglNormalBuffer=We.createBuffer()),t.hasUvs&&!t.__webglUvBuffer&&(t.__webglUvBuffer=We.createBuffer()),t.hasColors&&!t.__webglColorBuffer&&(t.__webglColorBuffer=We.createBuffer()),t.hasPositions&&(We.bindBuffer(We.ARRAY_BUFFER,t.__webglVertexBuffer),We.bufferData(We.ARRAY_BUFFER,t.positionArray,We.DYNAMIC_DRAW),I.enableAttribute(e.attributes.position),We.vertexAttribPointer(e.attributes.position,3,We.FLOAT,!1,0,0)),t.hasNormals){if(We.bindBuffer(We.ARRAY_BUFFER,t.__webglNormalBuffer),!1==r instanceof THREE.MeshPhongMaterial&&r.shading===THREE.FlatShading){var i,n,o,a,s,h,l,c,u=3*t.count;for(c=0;c<u;c+=9)i=(l=t.normalArray)[c],n=l[c+1],o=l[c+2],a=l[c+3],s=l[c+4],h=l[c+5],i=(i+a+l[c+6])/3,n=(n+s+l[c+7])/3,o=(o+h+l[c+8])/3,l[c]=i,l[c+1]=n,l[c+2]=o,l[c+3]=i,l[c+4]=n,l[c+5]=o,l[c+6]=i,l[c+7]=n,l[c+8]=o}We.bufferData(We.ARRAY_BUFFER,t.normalArray,We.DYNAMIC_DRAW),I.enableAttribute(e.attributes.normal),We.vertexAttribPointer(e.attributes.normal,3,We.FLOAT,!1,0,0)}t.hasUvs&&r.map&&(We.bindBuffer(We.ARRAY_BUFFER,t.__webglUvBuffer),We.bufferData(We.ARRAY_BUFFER,t.uvArray,We.DYNAMIC_DRAW),I.enableAttribute(e.attributes.uv),We.vertexAttribPointer(e.attributes.uv,2,We.FLOAT,!1,0,0)),t.hasColors&&r.vertexColors!==THREE.NoColors&&(We.bindBuffer(We.ARRAY_BUFFER,t.__webglColorBuffer),We.bufferData(We.ARRAY_BUFFER,t.colorArray,We.DYNAMIC_DRAW),I.enableAttribute(e.attributes.color),We.vertexAttribPointer(e.attributes.color,3,We.FLOAT,!1,0,0)),I.disableUnusedAttributes(),We.drawArrays(We.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,r,i,n,o){if(!1!==i.visible)if(R(o),t=v(t,e,r,i,o),e=!1,(r="direct_"+n.id+"_"+t.id+"_"+(i.wireframe?1:0))!==F&&(F=r,e=!0),e&&I.initAttributes(),o instanceof THREE.Mesh){o=!0===i.wireframe?We.LINES:We.TRIANGLES;var a,s,h=n.attributes.index;if(h)if(h.array instanceof Uint32Array&&W.get("OES_element_index_uint")?(a=We.UNSIGNED_INT,s=4):(a=We.UNSIGNED_SHORT,s=2),0===(r=n.offsets).length)e&&(E(i,t,n,0),We.bindBuffer(We.ELEMENT_ARRAY_BUFFER,h.buffer)),We.drawElements(o,h.array.length,a,0),be.info.render.calls++,be.info.render.vertices+=h.array.length,be.info.render.faces+=h.array.length/3;else{e=!0;for(var l=0,c=r.length;l<c;l++){var u=r[l].index;e&&(E(i,t,n,u),We.bindBuffer(We.ELEMENT_ARRAY_BUFFER,h.buffer)),We.drawElements(o,r[l].count,a,r[l].start*s),be.info.render.calls++,be.info.render.vertices+=r[l].count,be.info.render.faces+=r[l].count/3}}else e&&E(i,t,n,0),i=n.attributes.position,We.drawArrays(o,0,i.array.length/i.itemSize),be.info.render.calls++,be.info.render.vertices+=i.array.length/i.itemSize,be.info.render.faces+=i.array.length/(3*i.itemSize)}else if(o instanceof THREE.PointCloud)if(o=We.POINTS,h=n.attributes.index)if(h.array instanceof Uint32Array&&W.get("OES_element_index_uint")?(a=We.UNSIGNED_INT,s=4):(a=We.UNSIGNED_SHORT,s=2),0===(r=n.offsets).length)e&&(E(i,t,n,0),We.bindBuffer(We.ELEMENT_ARRAY_BUFFER,h.buffer)),We.drawElements(o,h.array.length,a,0),be.info.render.calls++,be.info.render.points+=h.array.length;else for(1<r.length&&(e=!0),l=0,c=r.length;l<c;l++)u=r[l].index,e&&(E(i,t,n,u),We.bindBuffer(We.ELEMENT_ARRAY_BUFFER,h.buffer)),We.drawElements(o,r[l].count,a,r[l].start*s),be.info.render.calls++,be.info.render.points+=r[l].count;else if(e&&E(i,t,n,0),i=n.attributes.position,0===(r=n.offsets).length)We.drawArrays(o,0,i.array.length/3),be.info.render.calls++,be.info.render.points+=i.array.length/3;else for(l=0,c=r.length;l<c;l++)We.drawArrays(o,r[l].index,r[l].count),be.info.render.calls++,be.info.render.points+=r[l].count;else if(o instanceof THREE.Line)if(o=o.mode===THREE.LineStrip?We.LINE_STRIP:We.LINES,I.setLineWidth(i.linewidth*x),h=n.attributes.index)if(h.array instanceof Uint32Array?(a=We.UNSIGNED_INT,s=4):(a=We.UNSIGNED_SHORT,s=2),0===(r=n.offsets).length)e&&(E(i,t,n,0),We.bindBuffer(We.ELEMENT_ARRAY_BUFFER,h.buffer)),We.drawElements(o,h.array.length,a,0),be.info.render.calls++,be.info.render.vertices+=h.array.length;else for(1<r.length&&(e=!0),l=0,c=r.length;l<c;l++)u=r[l].index,e&&(E(i,t,n,u),We.bindBuffer(We.ELEMENT_ARRAY_BUFFER,h.buffer)),We.drawElements(o,r[l].count,a,r[l].start*s),be.info.render.calls++,be.info.render.vertices+=r[l].count;else if(e&&E(i,t,n,0),i=n.attributes.position,0===(r=n.offsets).length)We.drawArrays(o,0,i.array.length/3),be.info.render.calls++,be.info.render.vertices+=i.array.length/3;else for(l=0,c=r.length;l<c;l++)We.drawArrays(o,r[l].index,r[l].count),be.info.render.calls++,be.info.render.vertices+=r[l].count},this.renderBuffer=function(t,e,r,i,n,o){if(!1!==i.visible){if(R(o),e=(r=v(t,e,r,i,o)).attributes,t=!1,(r=n.id+"_"+r.id+"_"+(i.wireframe?1:0))!==F&&(F=r,t=!0),t&&I.initAttributes(),!i.morphTargets&&0<=e.position)t&&(We.bindBuffer(We.ARRAY_BUFFER,n.__webglVertexBuffer),I.enableAttribute(e.position),We.vertexAttribPointer(e.position,3,We.FLOAT,!1,0,0));else if(o.morphTargetBase){if(r=i.program.attributes,-1!==o.morphTargetBase&&0<=r.position?(We.bindBuffer(We.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[o.morphTargetBase]),I.enableAttribute(r.position),We.vertexAttribPointer(r.position,3,We.FLOAT,!1,0,0)):0<=r.position&&(We.bindBuffer(We.ARRAY_BUFFER,n.__webglVertexBuffer),I.enableAttribute(r.position),We.vertexAttribPointer(r.position,3,We.FLOAT,!1,0,0)),o.morphTargetForcedOrder.length)for(var a,s=0,h=o.morphTargetForcedOrder,l=o.morphTargetInfluences;s<i.numSupportedMorphTargets&&s<h.length;)0<=(a=r["morphTarget"+s])&&(We.bindBuffer(We.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[h[s]]),I.enableAttribute(a),We.vertexAttribPointer(a,3,We.FLOAT,!1,0,0)),0<=(a=r["morphNormal"+s])&&i.morphNormals&&(We.bindBuffer(We.ARRAY_BUFFER,n.__webglMorphNormalsBuffers[h[s]]),I.enableAttribute(a),We.vertexAttribPointer(a,3,We.FLOAT,!1,0,0)),o.__webglMorphTargetInfluences[s]=l[h[s]],s++;else{for(h=[],l=o.morphTargetInfluences,s=o.geometry.morphTargets,l.length>s.length&&(console.warn("THREE.WebGLRenderer: Influences array is bigger than morphTargets array."),l.length=s.length),s=0,a=l.length;s<a;s++)h.push([l[s],s]);h.length>i.numSupportedMorphTargets?(h.sort(f),h.length=i.numSupportedMorphTargets):h.length>i.numSupportedMorphNormals?h.sort(f):0===h.length&&h.push([0,0]);s=0;for(var c=i.numSupportedMorphTargets;s<c;s++)if(h[s]){var u=h[s][1];0<=(a=r["morphTarget"+s])&&(We.bindBuffer(We.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[u]),I.enableAttribute(a),We.vertexAttribPointer(a,3,We.FLOAT,!1,0,0)),0<=(a=r["morphNormal"+s])&&i.morphNormals&&(We.bindBuffer(We.ARRAY_BUFFER,n.__webglMorphNormalsBuffers[u]),I.enableAttribute(a),We.vertexAttribPointer(a,3,We.FLOAT,!1,0,0)),o.__webglMorphTargetInfluences[s]=l[u]}else o.__webglMorphTargetInfluences[s]=0}null!==i.program.uniforms.morphTargetInfluences&&We.uniform1fv(i.program.uniforms.morphTargetInfluences,o.__webglMorphTargetInfluences)}if(t){if(n.__webglCustomAttributesList)for(r=0,l=n.__webglCustomAttributesList.length;r<l;r++)0<=e[(h=n.__webglCustomAttributesList[r]).buffer.belongsToAttribute]&&(We.bindBuffer(We.ARRAY_BUFFER,h.buffer),I.enableAttribute(e[h.buffer.belongsToAttribute]),We.vertexAttribPointer(e[h.buffer.belongsToAttribute],h.size,We.FLOAT,!1,0,0));0<=e.color&&(0<o.geometry.colors.length||0<o.geometry.faces.length?(We.bindBuffer(We.ARRAY_BUFFER,n.__webglColorBuffer),I.enableAttribute(e.color),We.vertexAttribPointer(e.color,3,We.FLOAT,!1,0,0)):void 0!==i.defaultAttributeValues&&We.vertexAttrib3fv(e.color,i.defaultAttributeValues.color)),0<=e.normal&&(We.bindBuffer(We.ARRAY_BUFFER,n.__webglNormalBuffer),I.enableAttribute(e.normal),We.vertexAttribPointer(e.normal,3,We.FLOAT,!1,0,0)),0<=e.tangent&&(We.bindBuffer(We.ARRAY_BUFFER,n.__webglTangentBuffer),I.enableAttribute(e.tangent),We.vertexAttribPointer(e.tangent,4,We.FLOAT,!1,0,0)),0<=e.uv&&(o.geometry.faceVertexUvs[0]?(We.bindBuffer(We.ARRAY_BUFFER,n.__webglUVBuffer),I.enableAttribute(e.uv),We.vertexAttribPointer(e.uv,2,We.FLOAT,!1,0,0)):void 0!==i.defaultAttributeValues&&We.vertexAttrib2fv(e.uv,i.defaultAttributeValues.uv)),0<=e.uv2&&(o.geometry.faceVertexUvs[1]?(We.bindBuffer(We.ARRAY_BUFFER,n.__webglUV2Buffer),I.enableAttribute(e.uv2),We.vertexAttribPointer(e.uv2,2,We.FLOAT,!1,0,0)):void 0!==i.defaultAttributeValues&&We.vertexAttrib2fv(e.uv2,i.defaultAttributeValues.uv2)),i.skinning&&0<=e.skinIndex&&0<=e.skinWeight&&(We.bindBuffer(We.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),I.enableAttribute(e.skinIndex),We.vertexAttribPointer(e.skinIndex,4,We.FLOAT,!1,0,0),We.bindBuffer(We.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),I.enableAttribute(e.skinWeight),We.vertexAttribPointer(e.skinWeight,4,We.FLOAT,!1,0,0)),0<=e.lineDistance&&(We.bindBuffer(We.ARRAY_BUFFER,n.__webglLineDistanceBuffer),I.enableAttribute(e.lineDistance),We.vertexAttribPointer(e.lineDistance,1,We.FLOAT,!1,0,0))}I.disableUnusedAttributes(),o instanceof THREE.Mesh?(o=n.__typeArray===Uint32Array?We.UNSIGNED_INT:We.UNSIGNED_SHORT,i.wireframe?(I.setLineWidth(i.wireframeLinewidth*x),t&&We.bindBuffer(We.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),We.drawElements(We.LINES,n.__webglLineCount,o,0)):(t&&We.bindBuffer(We.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),We.drawElements(We.TRIANGLES,n.__webglFaceCount,o,0)),be.info.render.calls++,be.info.render.vertices+=n.__webglFaceCount,be.info.render.faces+=n.__webglFaceCount/3):o instanceof THREE.Line?(o=o.mode===THREE.LineStrip?We.LINE_STRIP:We.LINES,I.setLineWidth(i.linewidth*x),We.drawArrays(o,0,n.__webglLineCount),be.info.render.calls++):o instanceof THREE.PointCloud&&(We.drawArrays(We.POINTS,0,n.__webglParticleCount),be.info.render.calls++,be.info.render.points+=n.__webglParticleCount)}},this.render=function(t,e,r,i){if(!1==e instanceof THREE.Camera)THREE.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var n=t.fog;F="",Me=-1,(Pe=!(Se=null))===t.autoUpdate&&t.updateMatrixWorld(),void 0===e.parent&&e.updateMatrixWorld(),t.traverse(function(t){t instanceof THREE.SkinnedMesh&&t.skeleton.update()}),e.matrixWorldInverse.getInverse(e.matrixWorld),O.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),N.setFromMatrix(O),_.length=0,S.length=0,A.length=0,C.length=0,L.length=0,function t(e){if(!1!==e.visible){if(!(e instanceof THREE.Scene||e instanceof THREE.Group)){if(void 0===e.__webglInit&&(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrix=new THREE.Matrix3,e.addEventListener("removed",ht)),void 0!==(i=e.geometry)&&void 0===i.__webglInit)if(i.__webglInit=!0,i.addEventListener("dispose",lt),i instanceof THREE.BufferGeometry)be.info.memory.geometries++;else if(e instanceof THREE.Mesh)Oe(e,i);else if(e instanceof THREE.Line){if(void 0===i.__webglVertexBuffer){i.__webglVertexBuffer=We.createBuffer(),i.__webglColorBuffer=We.createBuffer(),i.__webglLineDistanceBuffer=We.createBuffer(),be.info.memory.geometries++;var r=i.vertices.length;i.__vertexArray=new Float32Array(3*r),i.__colorArray=new Float32Array(3*r),i.__lineDistanceArray=new Float32Array(1*r),i.__webglLineCount=r,u(e),i.verticesNeedUpdate=!0,i.colorsNeedUpdate=!0,i.lineDistancesNeedUpdate=!0}}else e instanceof THREE.PointCloud&&void 0===i.__webglVertexBuffer&&(i.__webglVertexBuffer=We.createBuffer(),i.__webglColorBuffer=We.createBuffer(),be.info.memory.geometries++,r=i.vertices.length,i.__vertexArray=new Float32Array(3*r),i.__colorArray=new Float32Array(3*r),i.__webglParticleCount=r,u(e),i.verticesNeedUpdate=!0,i.colorsNeedUpdate=!0);if(void 0===e.__webglActive)if(e.__webglActive=!0,e instanceof THREE.Mesh){if(i instanceof THREE.BufferGeometry)g(w,i,e);else if(i instanceof THREE.Geometry){r=0;for(var i,n=(i=Xe[i.id]).length;r<n;r++)g(w,i[r],e)}}else e instanceof THREE.Line||e instanceof THREE.PointCloud?g(w,i,e):(e instanceof THREE.ImmediateRenderObject||e.immediateRenderCallback)&&M.push({id:null,object:e,opaque:null,transparent:null,z:0});if(e instanceof THREE.Light)_.push(e);else if(e instanceof THREE.Sprite)C.push(e);else if(e instanceof THREE.LensFlare)L.push(e);else if((i=w[e.id])&&(!1===e.frustumCulled||!0===N.intersectsObject(e)))for(r=0,n=i.length;r<n;r++){var o=i[r],a=o,s=a.object,h=a.buffer,l=s.geometry;(s=s.material)instanceof THREE.MeshFaceMaterial?(s=s.materials[l instanceof THREE.BufferGeometry?0:h.materialIndex],(a.material=s).transparent?A.push(a):S.push(a)):s&&((a.material=s).transparent?A.push(a):S.push(a)),(o.render=!0)===be.sortObjects&&(Ce.setFromMatrixPosition(e.matrixWorld),Ce.applyProjection(O),o.z=Ce.z)}}for(r=0,n=e.children.length;r<n;r++)t(e.children[r])}}(t),!0===be.sortObjects&&(S.sort(p),A.sort(d)),ot.render(t,e),be.info.render.calls=0,be.info.render.vertices=0,be.info.render.faces=0,be.info.render.points=0,this.setRenderTarget(r),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),i=0;for(var o=M.length;i<o;i++){var a=M[i],s=a.object;s.visible&&(H(s,e),void 0,(c=(l=a).object.material).transparent?(l.transparent=c,l.opaque=null):(l.opaque=c,l.transparent=null))}t.overrideMaterial?(y(i=t.overrideMaterial),m(S,e,_,n,i),m(A,e,_,n,i),T(M,"",e,_,n,i)):(I.setBlending(THREE.NoBlending),m(S,e,_,n,null),T(M,"opaque",e,_,n,null),m(A,e,_,n,null),T(M,"transparent",e,_,n,null)),at.render(t,e),st.render(t,e,z,k),r&&r.generateMipmaps&&r.minFilter!==THREE.NearestFilter&&r.minFilter!==THREE.LinearFilter&&((h=r)instanceof THREE.WebGLRenderTargetCube?(We.bindTexture(We.TEXTURE_CUBE_MAP,h.__webglTexture),We.generateMipmap(We.TEXTURE_CUBE_MAP),We.bindTexture(We.TEXTURE_CUBE_MAP,null)):(We.bindTexture(We.TEXTURE_2D,h.__webglTexture),We.generateMipmap(We.TEXTURE_2D),We.bindTexture(We.TEXTURE_2D,null))),I.setDepthTest(!0),I.setDepthWrite(!0),I.setColorWrite(!0)}var h,l,c},this.renderImmediateObject=function(t,e,r,i,n){var o=v(t,e,r,i,n);F="",be.setMaterialFaces(i),n.immediateRenderCallback?n.immediateRenderCallback(o,We,N):n.render(function(t){be.renderBufferImmediate(t,o,i)})};var Xe={},Et=0,qe={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointCloudMaterial:"particle_basic"};this.setFaceCulling=function(t,e){t===THREE.CullFaceNone?We.disable(We.CULL_FACE):(e===THREE.FrontFaceDirectionCW?We.frontFace(We.CW):We.frontFace(We.CCW),t===THREE.CullFaceBack?We.cullFace(We.BACK):t===THREE.CullFaceFront?We.cullFace(We.FRONT):We.cullFace(We.FRONT_AND_BACK),We.enable(We.CULL_FACE))},this.setMaterialFaces=function(t){I.setDoubleSided(t.side===THREE.DoubleSide),I.setFlipSided(t.side===THREE.BackSide)},this.uploadTexture=function(t){void 0===t.__webglInit&&(t.__webglInit=!0,t.addEventListener("dispose",ze),t.__webglTexture=We.createTexture(),be.info.memory.textures++),We.bindTexture(We.TEXTURE_2D,t.__webglTexture),We.pixelStorei(We.UNPACK_FLIP_Y_WEBGL,t.flipY),We.pixelStorei(We.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),We.pixelStorei(We.UNPACK_ALIGNMENT,t.unpackAlignment),t.image=Re(t.image,Z);var e=t.image,r=THREE.Math.isPowerOfTwo(e.width)&&THREE.Math.isPowerOfTwo(e.height),i=ye(t.format),n=ye(t.type);ge(We.TEXTURE_2D,t,r);var o=t.mipmaps;if(t instanceof THREE.DataTexture)if(0<o.length&&r){for(var a=0,s=o.length;a<s;a++)e=o[a],We.texImage2D(We.TEXTURE_2D,a,i,e.width,e.height,0,i,n,e.data);t.generateMipmaps=!1}else We.texImage2D(We.TEXTURE_2D,0,i,e.width,e.height,0,i,n,e.data);else if(t instanceof THREE.CompressedTexture)for(a=0,s=o.length;a<s;a++)e=o[a],t.format!==THREE.RGBAFormat&&t.format!==THREE.RGBFormat?-1<Ve().indexOf(i)?We.compressedTexImage2D(We.TEXTURE_2D,a,i,e.width,e.height,0,e.data):THREE.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):We.texImage2D(We.TEXTURE_2D,a,i,e.width,e.height,0,i,n,e.data);else if(0<o.length&&r){for(a=0,s=o.length;a<s;a++)e=o[a],We.texImage2D(We.TEXTURE_2D,a,i,i,n,e);t.generateMipmaps=!1}else We.texImage2D(We.TEXTURE_2D,0,i,i,n,t.image);t.generateMipmaps&&r&&We.generateMipmap(We.TEXTURE_2D),t.needsUpdate=!1,t.onUpdate&&t.onUpdate()},this.setTexture=function(t,e){We.activeTexture(We.TEXTURE0+e),t.needsUpdate?be.uploadTexture(t):We.bindTexture(We.TEXTURE_2D,t.__webglTexture)},this.setRenderTarget=function(t){var e=t instanceof THREE.WebGLRenderTargetCube;if(t&&void 0===t.__webglFramebuffer){void 0===t.depthBuffer&&(t.depthBuffer=!0),void 0===t.stencilBuffer&&(t.stencilBuffer=!0),t.addEventListener("dispose",ct),t.__webglTexture=We.createTexture(),be.info.memory.textures++;var r=THREE.Math.isPowerOfTwo(t.width)&&THREE.Math.isPowerOfTwo(t.height),i=ye(t.format),n=ye(t.type);if(e){t.__webglFramebuffer=[],t.__webglRenderbuffer=[],We.bindTexture(We.TEXTURE_CUBE_MAP,t.__webglTexture),ge(We.TEXTURE_CUBE_MAP,t,r);for(var o=0;o<6;o++){t.__webglFramebuffer[o]=We.createFramebuffer(),t.__webglRenderbuffer[o]=We.createRenderbuffer(),We.texImage2D(We.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,i,t.width,t.height,0,i,n,null);var a=t,s=We.TEXTURE_CUBE_MAP_POSITIVE_X+o;We.bindFramebuffer(We.FRAMEBUFFER,t.__webglFramebuffer[o]),We.framebufferTexture2D(We.FRAMEBUFFER,We.COLOR_ATTACHMENT0,s,a.__webglTexture,0),h(t.__webglRenderbuffer[o],t)}r&&We.generateMipmap(We.TEXTURE_CUBE_MAP)}else t.__webglFramebuffer=We.createFramebuffer(),t.__webglRenderbuffer=t.shareDepthFrom?t.shareDepthFrom.__webglRenderbuffer:We.createRenderbuffer(),We.bindTexture(We.TEXTURE_2D,t.__webglTexture),ge(We.TEXTURE_2D,t,r),We.texImage2D(We.TEXTURE_2D,0,i,t.width,t.height,0,i,n,null),i=We.TEXTURE_2D,We.bindFramebuffer(We.FRAMEBUFFER,t.__webglFramebuffer),We.framebufferTexture2D(We.FRAMEBUFFER,We.COLOR_ATTACHMENT0,i,t.__webglTexture,0),t.shareDepthFrom?t.depthBuffer&&!t.stencilBuffer?We.framebufferRenderbuffer(We.FRAMEBUFFER,We.DEPTH_ATTACHMENT,We.RENDERBUFFER,t.__webglRenderbuffer):t.depthBuffer&&t.stencilBuffer&&We.framebufferRenderbuffer(We.FRAMEBUFFER,We.DEPTH_STENCIL_ATTACHMENT,We.RENDERBUFFER,t.__webglRenderbuffer):h(t.__webglRenderbuffer,t),r&&We.generateMipmap(We.TEXTURE_2D);e?We.bindTexture(We.TEXTURE_CUBE_MAP,null):We.bindTexture(We.TEXTURE_2D,null),We.bindRenderbuffer(We.RENDERBUFFER,null),We.bindFramebuffer(We.FRAMEBUFFER,null)}t?(e=e?t.__webglFramebuffer[t.activeCubeFace]:t.__webglFramebuffer,r=t.width,t=t.height,n=i=0):(e=null,r=D,t=V,i=U,n=B),e!==P&&(We.bindFramebuffer(We.FRAMEBUFFER,e),We.viewport(i,n,r,t),P=e),z=r,k=t},this.readRenderTargetPixels=function(t,e,r,i,n,o){if(t instanceof THREE.WebGLRenderTarget){if(t.__webglFramebuffer)if(t.format!==THREE.RGBAFormat)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.");else{var a=!1;t.__webglFramebuffer!==P&&(We.bindFramebuffer(We.FRAMEBUFFER,t.__webglFramebuffer),a=!0),We.checkFramebufferStatus(We.FRAMEBUFFER)===We.FRAMEBUFFER_COMPLETE?We.readPixels(e,r,i,n,We.RGBA,We.UNSIGNED_BYTE,o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."),a&&We.bindFramebuffer(We.FRAMEBUFFER,P)}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.initMaterial=function(){THREE.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},this.addPrePlugin=function(){THREE.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},this.addPostPlugin=function(){THREE.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},this.updateShadowMap=function(){THREE.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}},THREE.WebGLRenderTarget=function(t,e,r){this.width=t,this.height=e,r=r||{},this.wrapS=void 0!==r.wrapS?r.wrapS:THREE.ClampToEdgeWrapping,this.wrapT=void 0!==r.wrapT?r.wrapT:THREE.ClampToEdgeWrapping,this.magFilter=void 0!==r.magFilter?r.magFilter:THREE.LinearFilter,this.minFilter=void 0!==r.minFilter?r.minFilter:THREE.LinearMipMapLinearFilter,this.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,this.offset=new THREE.Vector2(0,0),this.repeat=new THREE.Vector2(1,1),this.format=void 0!==r.format?r.format:THREE.RGBAFormat,this.type=void 0!==r.type?r.type:THREE.UnsignedByteType,this.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,this.stencilBuffer=void 0===r.stencilBuffer||r.stencilBuffer,this.generateMipmaps=!0,this.shareDepthFrom=void 0!==r.shareDepthFrom?r.shareDepthFrom:null},THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(t,e){this.width=t,this.height=e},clone:function(){var t=new THREE.WebGLRenderTarget(this.width,this.height);return t.wrapS=this.wrapS,t.wrapT=this.wrapT,t.magFilter=this.magFilter,t.minFilter=this.minFilter,t.anisotropy=this.anisotropy,t.offset.copy(this.offset),t.repeat.copy(this.repeat),t.format=this.format,t.type=this.type,t.depthBuffer=this.depthBuffer,t.stencilBuffer=this.stencilBuffer,t.generateMipmaps=this.generateMipmaps,t.shareDepthFrom=this.shareDepthFrom,t},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.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&&THREE.warn("THREE.WebGLRenderer: "+t+" extension not supported."),i[t]=e}},THREE.WebGLProgram=function(){var v=0;return function(t,e,r,i){var n=t.context,o=r.defines,a=r.__webglShader.uniforms,s=r.attributes,h=r.__webglShader.vertexShader,l=r.__webglShader.fragmentShader,c=r.index0AttributeName;void 0===c&&!0===i.morphTargets&&(c="position");var u="SHADOWMAP_TYPE_BASIC";i.shadowMapType===THREE.PCFShadowMap?u="SHADOWMAP_TYPE_PCF":i.shadowMapType===THREE.PCFSoftShadowMap&&(u="SHADOWMAP_TYPE_PCF_SOFT");var E="ENVMAP_TYPE_CUBE",p="ENVMAP_MODE_REFLECTION",d="ENVMAP_BLENDING_MULTIPLY";if(i.envMap){switch(r.envMap.mapping){case THREE.CubeReflectionMapping:case THREE.CubeRefractionMapping:E="ENVMAP_TYPE_CUBE";break;case THREE.EquirectangularReflectionMapping:case THREE.EquirectangularRefractionMapping:E="ENVMAP_TYPE_EQUIREC";break;case THREE.SphericalReflectionMapping:E="ENVMAP_TYPE_SPHERE"}switch(r.envMap.mapping){case THREE.CubeRefractionMapping:case THREE.EquirectangularRefractionMapping:p="ENVMAP_MODE_REFRACTION"}switch(r.combine){case THREE.MultiplyOperation:d="ENVMAP_BLENDING_MULTIPLY";break;case THREE.MixOperation:d="ENVMAP_BLENDING_MIX";break;case THREE.AddOperation:d="ENVMAP_BLENDING_ADD"}}var f,m,T=0<t.gammaFactor?t.gammaFactor:1;for(var g in f=[],o)!1!==(m=o[g])&&(m="#define "+g+" "+m,f.push(m));for(var R in f=f.join("\n"),o=n.createProgram(),r instanceof THREE.RawShaderMaterial?t=r="":(r=["precision "+i.precision+" float;","precision "+i.precision+" int;",f,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"",t.gammaInput?"#define GAMMA_INPUT":"",t.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+T,"#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 "+p:"",i.lightMap?"#define USE_LIGHTMAP":"",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.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals?"#define USE_MORPHNORMALS":"",i.wrapAround?"#define WRAP_AROUND":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+u:"",i.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",i.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\n\tattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\n\tattribute vec3 morphTarget0;\n\tattribute vec3 morphTarget1;\n\tattribute vec3 morphTarget2;\n\tattribute vec3 morphTarget3;\n\t#ifdef USE_MORPHNORMALS\n\t\tattribute vec3 morphNormal0;\n\t\tattribute vec3 morphNormal1;\n\t\tattribute vec3 morphNormal2;\n\t\tattribute vec3 morphNormal3;\n\t#else\n\t\tattribute vec3 morphTarget4;\n\t\tattribute vec3 morphTarget5;\n\t\tattribute vec3 morphTarget6;\n\t\tattribute vec3 morphTarget7;\n\t#endif\n#endif\n#ifdef USE_SKINNING\n\tattribute vec4 skinIndex;\n\tattribute vec4 skinWeight;\n#endif\n"].join("\n"),t=["precision "+i.precision+" float;","precision "+i.precision+" int;",i.bumpMap||i.normalMap||i.flatShading?"#extension GL_OES_standard_derivatives : enable":"",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 "+T,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 "+E:"",i.envMap?"#define "+p:"",i.envMap?"#define "+d:"",i.lightMap?"#define USE_LIGHTMAP":"",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.wrapAround?"#define WRAP_AROUND":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+u:"",i.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",i.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n")),h=new THREE.WebGLShader(n,n.VERTEX_SHADER,r+h),l=new THREE.WebGLShader(n,n.FRAGMENT_SHADER,t+l),n.attachShader(o,h),n.attachShader(o,l),void 0!==c&&n.bindAttribLocation(o,0,c),n.linkProgram(o),c=n.getProgramInfoLog(o),!1===n.getProgramParameter(o,n.LINK_STATUS)&&THREE.error("THREE.WebGLProgram: shader error: "+n.getError(),"gl.VALIDATE_STATUS",n.getProgramParameter(o,n.VALIDATE_STATUS),"gl.getPRogramInfoLog",c),""!==c&&THREE.warn("THREE.WebGLProgram: gl.getProgramInfoLog()"+c),n.deleteShader(h),n.deleteShader(l),c="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences bindMatrix bindMatrixInverse".split(" "),i.useVertexTexture?(c.push("boneTexture"),c.push("boneTextureWidth"),c.push("boneTextureHeight")):c.push("boneGlobalMatrices"),i.logarithmicDepthBuffer&&c.push("logDepthBufFC"),a)c.push(R);for(a=c,R={},c=0,t=a.length;c<t;c++)R[u=a[c]]=n.getUniformLocation(o,u);for(this.uniforms=R,c="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" "),a=0;a<i.maxMorphTargets;a++)c.push("morphTarget"+a);for(a=0;a<i.maxMorphNormals;a++)c.push("morphNormal"+a);for(var y in s)c.push(y);for(s={},y=0,a=(i=c).length;y<a;y++)s[R=i[y]]=n.getAttribLocation(o,R);return this.attributes=s,this.attributesKeys=Object.keys(this.attributes),this.id=v++,this.code=e,this.usedTimes=1,this.program=o,this.vertexShader=h,this.fragmentShader=l,this}}(),THREE.WebGLShader=function(t,e,r){return e=t.createShader(e),t.shaderSource(e,r),t.compileShader(e),!1===t.getShaderParameter(e,t.COMPILE_STATUS)&&THREE.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(e)&&THREE.warn("THREE.WebGLShader: gl.getShaderInfoLog()",t.getShaderInfoLog(e),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)),e},THREE.WebGLState=function(s,h){var r=new Uint8Array(16),i=new Uint8Array(16),l=null,c=null,u=null,E=null,p=null,d=null,f=null,e=null,n=null,o=null,a=null,m=null,T=null,g=null,R=null,y=null;this.initAttributes=function(){for(var t=0,e=r.length;t<e;t++)r[t]=0},this.enableAttribute=function(t){r[t]=1,0===i[t]&&(s.enableVertexAttribArray(t),i[t]=1)},this.disableUnusedAttributes=function(){for(var t=0,e=i.length;t<e;t++)i[t]!==r[t]&&(s.disableVertexAttribArray(t),i[t]=0)},this.setBlending=function(t,e,r,i,n,o,a){t!==l&&(t===THREE.NoBlending?s.disable(s.BLEND):t===THREE.AdditiveBlending?(s.enable(s.BLEND),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.SRC_ALPHA,s.ONE)):t===THREE.SubtractiveBlending?(s.enable(s.BLEND),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ZERO,s.ONE_MINUS_SRC_COLOR)):t===THREE.MultiplyBlending?(s.enable(s.BLEND),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ZERO,s.SRC_COLOR)):t===THREE.CustomBlending?s.enable(s.BLEND):(s.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)),l=t),t===THREE.CustomBlending?(n=n||e,o=o||r,a=a||i,e===c&&n===p||(s.blendEquationSeparate(h(e),h(n)),c=e,p=n),r===u&&i===E&&o===d&&a===f||(s.blendFuncSeparate(h(r),h(i),h(o),h(a)),u=r,E=i,d=o,f=a)):f=d=p=E=u=c=null},this.setDepthTest=function(t){e!==t&&(t?s.enable(s.DEPTH_TEST):s.disable(s.DEPTH_TEST),e=t)},this.setDepthWrite=function(t){n!==t&&(s.depthMask(t),n=t)},this.setColorWrite=function(t){o!==t&&(s.colorMask(t,t,t,t),o=t)},this.setDoubleSided=function(t){a!==t&&(t?s.disable(s.CULL_FACE):s.enable(s.CULL_FACE),a=t)},this.setFlipSided=function(t){m!==t&&(t?s.frontFace(s.CW):s.frontFace(s.CCW),m=t)},this.setLineWidth=function(t){t!==T&&(s.lineWidth(t),T=t)},this.setPolygonOffset=function(t,e,r){g!==t&&(t?s.enable(s.POLYGON_OFFSET_FILL):s.disable(s.POLYGON_OFFSET_FILL),g=t),!t||R===e&&y===r||(s.polygonOffset(e,r),R=e,y=r)},this.reset=function(){for(var t=0;t<i.length;t++)i[t]=0;m=a=o=n=e=l=null}},THREE.LensFlarePlugin=function(T,g){var R,y,v,H,x,b,_,w,M,S,A,C,L,P,F,U,B=T.context;this.render=function(t,e,r,i){if(0!==g.length){t=new THREE.Vector3;var n=i/r,o=.5*r,a=.5*i,s=16/i,h=new THREE.Vector2(s*n,s),l=new THREE.Vector3(1,1,0),c=new THREE.Vector2(1,1);if(void 0===L){s=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]);var u=new Uint16Array([0,1,2,0,2,3]);A=B.createBuffer(),C=B.createBuffer(),B.bindBuffer(B.ARRAY_BUFFER,A),B.bufferData(B.ARRAY_BUFFER,s,B.STATIC_DRAW),B.bindBuffer(B.ELEMENT_ARRAY_BUFFER,C),B.bufferData(B.ELEMENT_ARRAY_BUFFER,u,B.STATIC_DRAW),F=B.createTexture(),U=B.createTexture(),B.bindTexture(B.TEXTURE_2D,F),B.texImage2D(B.TEXTURE_2D,0,B.RGB,16,16,0,B.RGB,B.UNSIGNED_BYTE,null),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_WRAP_S,B.CLAMP_TO_EDGE),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_WRAP_T,B.CLAMP_TO_EDGE),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MAG_FILTER,B.NEAREST),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MIN_FILTER,B.NEAREST),B.bindTexture(B.TEXTURE_2D,U),B.texImage2D(B.TEXTURE_2D,0,B.RGBA,16,16,0,B.RGBA,B.UNSIGNED_BYTE,null),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_WRAP_S,B.CLAMP_TO_EDGE),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_WRAP_T,B.CLAMP_TO_EDGE),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MAG_FILTER,B.NEAREST),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MIN_FILTER,B.NEAREST);s=(P=0<B.getParameter(B.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}"},u=B.createProgram();var E=B.createShader(B.FRAGMENT_SHADER),p=B.createShader(B.VERTEX_SHADER),d="precision "+T.getPrecision()+" float;\n";B.shaderSource(E,d+s.fragmentShader),B.shaderSource(p,d+s.vertexShader),B.compileShader(E),B.compileShader(p),B.attachShader(u,E),B.attachShader(u,p),B.linkProgram(u),L=u,M=B.getAttribLocation(L,"position"),S=B.getAttribLocation(L,"uv"),R=B.getUniformLocation(L,"renderType"),y=B.getUniformLocation(L,"map"),v=B.getUniformLocation(L,"occlusionMap"),H=B.getUniformLocation(L,"opacity"),x=B.getUniformLocation(L,"color"),b=B.getUniformLocation(L,"scale"),_=B.getUniformLocation(L,"rotation"),w=B.getUniformLocation(L,"screenPosition")}for(B.useProgram(L),B.enableVertexAttribArray(M),B.enableVertexAttribArray(S),B.uniform1i(v,0),B.uniform1i(y,1),B.bindBuffer(B.ARRAY_BUFFER,A),B.vertexAttribPointer(M,2,B.FLOAT,!1,16,0),B.vertexAttribPointer(S,2,B.FLOAT,!1,16,8),B.bindBuffer(B.ELEMENT_ARRAY_BUFFER,C),B.disable(B.CULL_FACE),B.depthMask(!1),u=0,E=g.length;u<E;u++)if(s=16/i,h.set(s*n,s),p=g[u],t.set(p.matrixWorld.elements[12],p.matrixWorld.elements[13],p.matrixWorld.elements[14]),t.applyMatrix4(e.matrixWorldInverse),t.applyProjection(e.projectionMatrix),l.copy(t),c.x=l.x*o+o,c.y=l.y*a+a,P||0<c.x&&c.x<r&&0<c.y&&c.y<i){B.activeTexture(B.TEXTURE1),B.bindTexture(B.TEXTURE_2D,F),B.copyTexImage2D(B.TEXTURE_2D,0,B.RGB,c.x-8,c.y-8,16,16,0),B.uniform1i(R,0),B.uniform2f(b,h.x,h.y),B.uniform3f(w,l.x,l.y,l.z),B.disable(B.BLEND),B.enable(B.DEPTH_TEST),B.drawElements(B.TRIANGLES,6,B.UNSIGNED_SHORT,0),B.activeTexture(B.TEXTURE0),B.bindTexture(B.TEXTURE_2D,U),B.copyTexImage2D(B.TEXTURE_2D,0,B.RGBA,c.x-8,c.y-8,16,16,0),B.uniform1i(R,1),B.disable(B.DEPTH_TEST),B.activeTexture(B.TEXTURE1),B.bindTexture(B.TEXTURE_2D,F),B.drawElements(B.TRIANGLES,6,B.UNSIGNED_SHORT,0),p.positionScreen.copy(l),p.customUpdateCallback?p.customUpdateCallback(p):p.updateLensFlares(),B.uniform1i(R,2),B.enable(B.BLEND);d=0;for(var f=p.lensFlares.length;d<f;d++){var m=p.lensFlares[d];.001<m.opacity&&.001<m.scale&&(l.x=m.x,l.y=m.y,l.z=m.z,s=m.size*m.scale/i,h.x=s*n,h.y=s,B.uniform3f(w,l.x,l.y,l.z),B.uniform2f(b,h.x,h.y),B.uniform1f(_,m.rotation),B.uniform1f(H,m.opacity),B.uniform3f(x,m.color.r,m.color.g,m.color.b),T.state.setBlending(m.blending,m.blendEquation,m.blendSrc,m.blendDst),T.setTexture(m.texture,1),B.drawElements(B.TRIANGLES,6,B.UNSIGNED_SHORT,0))}}B.enable(B.CULL_FACE),B.enable(B.DEPTH_TEST),B.depthMask(!0),T.resetGLState()}}},THREE.ShadowMapPlugin=function(d,f,s,m){function T(t,e,r){if(e.visible){var i=s[e.id];if(i&&e.castShadow&&(!1===e.frustumCulled||!0===x.intersectsObject(e)))for(var n=0,o=i.length;n<o;n++){var a=i[n];e._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),S.push(a)}for(n=0,o=e.children.length;n<o;n++)T(t,e.children[n],r)}}var g,R,y,v,H=d.context,x=new THREE.Frustum,b=new THREE.Matrix4,_=new THREE.Vector3,w=new THREE.Vector3,M=new THREE.Vector3,S=[],t=THREE.ShaderLib.depthRGBA,e=THREE.UniformsUtils.clone(t.uniforms);g=new THREE.ShaderMaterial({uniforms:e,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader}),R=new THREE.ShaderMaterial({uniforms:e,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,morphTargets:!0}),y=new THREE.ShaderMaterial({uniforms:e,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,skinning:!0}),v=new THREE.ShaderMaterial({uniforms:e,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,morphTargets:!0,skinning:!0}),g._shadowPass=!0,R._shadowPass=!0,y._shadowPass=!0,v._shadowPass=!0,this.render=function(t,e){if(!1!==d.shadowMapEnabled){var r,i,n,o,a,s,h,l,c=[];for(o=0,H.clearColor(1,1,1,1),H.disable(H.BLEND),H.enable(H.CULL_FACE),H.frontFace(H.CCW),d.shadowMapCullFace===THREE.CullFaceFront?H.cullFace(H.FRONT):H.cullFace(H.BACK),d.state.setDepthTest(!0),r=0,i=f.length;r<i;r++)if((n=f[r]).castShadow)if(n instanceof THREE.DirectionalLight&&n.shadowCascade)for(a=0;a<n.shadowCascadeCount;a++){var u;if(n.shadowCascadeArray[a])u=n.shadowCascadeArray[a];else{h=n;var E=a;(u=new THREE.DirectionalLight).isVirtual=!0,u.onlyShadow=!0,u.castShadow=!0,u.shadowCameraNear=h.shadowCameraNear,u.shadowCameraFar=h.shadowCameraFar,u.shadowCameraLeft=h.shadowCameraLeft,u.shadowCameraRight=h.shadowCameraRight,u.shadowCameraBottom=h.shadowCameraBottom,u.shadowCameraTop=h.shadowCameraTop,u.shadowCameraVisible=h.shadowCameraVisible,u.shadowDarkness=h.shadowDarkness,u.shadowBias=h.shadowCascadeBias[E],u.shadowMapWidth=h.shadowCascadeWidth[E],u.shadowMapHeight=h.shadowCascadeHeight[E],u.pointsWorld=[],u.pointsFrustum=[],l=u.pointsWorld,s=u.pointsFrustum;for(var p=0;p<8;p++)l[p]=new THREE.Vector3,s[p]=new THREE.Vector3;l=h.shadowCascadeNearZ[E],h=h.shadowCascadeFarZ[E],s[0].set(-1,-1,l),s[1].set(1,-1,l),s[2].set(-1,1,l),s[3].set(1,1,l),s[4].set(-1,-1,h),s[5].set(1,-1,h),s[6].set(-1,1,h),s[7].set(1,1,h),u.originalCamera=e,(s=new THREE.Gyroscope).position.copy(n.shadowCascadeOffset),s.add(u),s.add(u.target),e.add(s),n.shadowCascadeArray[a]=u}l=a,(h=(E=n).shadowCascadeArray[l]).position.copy(E.position),h.target.position.copy(E.target.position),h.lookAt(h.target),h.shadowCameraVisible=E.shadowCameraVisible,h.shadowDarkness=E.shadowDarkness,h.shadowBias=E.shadowCascadeBias[l],s=E.shadowCascadeNearZ[l],E=E.shadowCascadeFarZ[l],(h=h.pointsFrustum)[0].z=s,h[1].z=s,h[2].z=s,h[3].z=s,h[4].z=E,h[5].z=E,h[6].z=E,h[7].z=E,c[o]=u,o++}else c[o]=n,o++;for(r=0,i=c.length;r<i;r++){if((n=c[r]).shadowMap||(a=THREE.LinearFilter,d.shadowMapType===THREE.PCFSoftShadowMap&&(a=THREE.NearestFilter),n.shadowMap=new THREE.WebGLRenderTarget(n.shadowMapWidth,n.shadowMapHeight,{minFilter:a,magFilter:a,format:THREE.RGBAFormat}),n.shadowMapSize=new THREE.Vector2(n.shadowMapWidth,n.shadowMapHeight),n.shadowMatrix=new THREE.Matrix4),!n.shadowCamera){if(n instanceof THREE.SpotLight)n.shadowCamera=new THREE.PerspectiveCamera(n.shadowCameraFov,n.shadowMapWidth/n.shadowMapHeight,n.shadowCameraNear,n.shadowCameraFar);else{if(!(n instanceof THREE.DirectionalLight)){THREE.error("THREE.ShadowMapPlugin: Unsupported light type for shadow",n);continue}n.shadowCamera=new THREE.OrthographicCamera(n.shadowCameraLeft,n.shadowCameraRight,n.shadowCameraTop,n.shadowCameraBottom,n.shadowCameraNear,n.shadowCameraFar)}t.add(n.shadowCamera),!0===t.autoUpdate&&t.updateMatrixWorld()}if(n.shadowCameraVisible&&!n.cameraHelper&&(n.cameraHelper=new THREE.CameraHelper(n.shadowCamera),t.add(n.cameraHelper)),n.isVirtual&&u.originalCamera==e){for(a=e,o=n.shadowCamera,s=n.pointsFrustum,h=n.pointsWorld,_.set(1/0,1/0,1/0),w.set(-1/0,-1/0,-1/0),E=0;E<8;E++)(l=h[E]).copy(s[E]),l.unproject(a),l.applyMatrix4(o.matrixWorldInverse),l.x<_.x&&(_.x=l.x),l.x>w.x&&(w.x=l.x),l.y<_.y&&(_.y=l.y),l.y>w.y&&(w.y=l.y),l.z<_.z&&(_.z=l.z),l.z>w.z&&(w.z=l.z);o.left=_.x,o.right=w.x,o.top=w.y,o.bottom=_.y,o.updateProjectionMatrix()}for(o=n.shadowMap,s=n.shadowMatrix,(a=n.shadowCamera).position.setFromMatrixPosition(n.matrixWorld),M.setFromMatrixPosition(n.target.matrixWorld),a.lookAt(M),a.updateMatrixWorld(),a.matrixWorldInverse.getInverse(a.matrixWorld),n.cameraHelper&&(n.cameraHelper.visible=n.shadowCameraVisible),n.shadowCameraVisible&&n.cameraHelper.update(),s.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),s.multiply(a.projectionMatrix),s.multiply(a.matrixWorldInverse),b.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),x.setFromMatrix(b),d.setRenderTarget(o),d.clear(),S.length=0,T(t,t,a),n=0,o=S.length;n<o;n++)s=(h=S[n]).object,h=h.buffer,E=s.material instanceof THREE.MeshFaceMaterial?s.material.materials[0]:s.material,l=void 0!==s.geometry.morphTargets&&0<s.geometry.morphTargets.length&&E.morphTargets,p=s instanceof THREE.SkinnedMesh&&E.skinning,l=s.customDepthMaterial?s.customDepthMaterial:p?l?v:y:l?R:g,d.setMaterialFaces(E),h instanceof THREE.BufferGeometry?d.renderBufferDirect(a,f,null,l,h,s):d.renderBuffer(a,f,null,l,h,s);for(n=0,o=m.length;n<o;n++)(s=(h=m[n]).object).visible&&s.castShadow&&(s._modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,s.matrixWorld),d.renderImmediateObject(a,f,null,g,s))}r=d.getClearColor(),i=d.getClearAlpha(),H.clearColor(r.r,r.g,r.b,i),H.enable(H.BLEND),d.shadowMapCullFace===THREE.CullFaceFront&&H.cullFace(H.BACK),d.resetGLState()}}},THREE.SpritePlugin=function(l,c){var u,E,p,d,f,m,T,g,R,y,v,H,x,b,_,w,M;function S(t,e){return t.z!==e.z?e.z-t.z:e.id-t.id}var A,C,L,P,F=l.context,U=new THREE.Vector3,B=new THREE.Quaternion,D=new THREE.Vector3;this.render=function(t,e){if(0!==c.length){if(void 0===L){var 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=F.createBuffer(),C=F.createBuffer(),F.bindBuffer(F.ARRAY_BUFFER,A),F.bufferData(F.ARRAY_BUFFER,r,F.STATIC_DRAW),F.bindBuffer(F.ELEMENT_ARRAY_BUFFER,C),F.bufferData(F.ELEMENT_ARRAY_BUFFER,i,F.STATIC_DRAW);r=F.createProgram(),i=F.createShader(F.VERTEX_SHADER);var n=F.createShader(F.FRAGMENT_SHADER);F.shaderSource(i,["precision "+l.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")),F.shaderSource(n,["precision "+l.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;\nfloat fogFactor = 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")),F.compileShader(i),F.compileShader(n),F.attachShader(r,i),F.attachShader(r,n),F.linkProgram(r),L=r,w=F.getAttribLocation(L,"position"),M=F.getAttribLocation(L,"uv"),u=F.getUniformLocation(L,"uvOffset"),E=F.getUniformLocation(L,"uvScale"),p=F.getUniformLocation(L,"rotation"),d=F.getUniformLocation(L,"scale"),f=F.getUniformLocation(L,"color"),m=F.getUniformLocation(L,"map"),T=F.getUniformLocation(L,"opacity"),g=F.getUniformLocation(L,"modelViewMatrix"),R=F.getUniformLocation(L,"projectionMatrix"),y=F.getUniformLocation(L,"fogType"),v=F.getUniformLocation(L,"fogDensity"),H=F.getUniformLocation(L,"fogNear"),x=F.getUniformLocation(L,"fogFar"),b=F.getUniformLocation(L,"fogColor"),_=F.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}F.useProgram(L),F.enableVertexAttribArray(w),F.enableVertexAttribArray(M),F.disable(F.CULL_FACE),F.enable(F.BLEND),F.bindBuffer(F.ARRAY_BUFFER,A),F.vertexAttribPointer(w,2,F.FLOAT,!1,16,0),F.vertexAttribPointer(M,2,F.FLOAT,!1,16,8),F.bindBuffer(F.ELEMENT_ARRAY_BUFFER,C),F.uniformMatrix4fv(R,!1,e.projectionMatrix.elements),F.activeTexture(F.TEXTURE0),F.uniform1i(m,0),i=r=0,(n=t.fog)?(F.uniform3f(b,n.color.r,n.color.g,n.color.b),n instanceof THREE.Fog?(F.uniform1f(H,n.near),F.uniform1f(x,n.far),F.uniform1i(y,1),i=r=1):n instanceof THREE.FogExp2&&(F.uniform1f(v,n.density),F.uniform1i(y,2),i=r=2)):(F.uniform1i(y,0),i=r=0);n=0;for(var o=c.length;n<o;n++){(s=c[n])._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,s.matrixWorld),s.z=-s._modelViewMatrix.elements[14]}c.sort(S);var a=[];for(n=0,o=c.length;n<o;n++){var s,h=(s=c[n]).material;F.uniform1f(_,h.alphaTest),F.uniformMatrix4fv(g,!1,s._modelViewMatrix.elements),s.matrixWorld.decompose(U,B,D),a[0]=D.x,a[1]=D.y,s=0,t.fog&&h.fog&&(s=i),r!==s&&(F.uniform1i(y,s),r=s),null!==h.map?(F.uniform2f(u,h.map.offset.x,h.map.offset.y),F.uniform2f(E,h.map.repeat.x,h.map.repeat.y)):(F.uniform2f(u,0,0),F.uniform2f(E,1,1)),F.uniform1f(T,h.opacity),F.uniform3f(f,h.color.r,h.color.g,h.color.b),F.uniform1f(p,h.rotation),F.uniform2fv(d,a),l.state.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst),l.state.setDepthTest(h.depthTest),l.state.setDepthWrite(h.depthWrite),h.map&&h.map.image&&h.map.image.width?l.setTexture(h.map,0):l.setTexture(P,0),F.drawElements(F.TRIANGLES,6,F.UNSIGNED_SHORT,0)}F.enable(F.CULL_FACE),l.resetGLState()}}},THREE.GeometryUtils={merge:function(t,e,r){var i;THREE.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 THREE.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){var n=new THREE.ImageLoader;n.crossOrigin=this.crossOrigin;var o=new THREE.Texture(void 0,e);return n.load(t,function(t){o.image=t,o.needsUpdate=!0,r&&r(o)},void 0,function(t){i&&i(t)}),o.sourceFile=t,o},loadTextureCube:function(t,e,r,i){var n=new THREE.ImageLoader;n.crossOrigin=this.crossOrigin;var o=new THREE.CubeTexture([],e);o.flipY=!1;var a=0;e=function(e){n.load(t[e],function(t){o.images[e]=t,6===(a+=1)&&(o.needsUpdate=!0,r&&r(o))},void 0,i)};for(var s=0,h=t.length;s<h;++s)e(s);return o},loadCompressedTexture:function(){THREE.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){THREE.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},getNormalMap:function(t,e){e|=1;var r=t.width,i=t.height,n=document.createElement("canvas");n.width=r,n.height=i;var o,a,s=n.getContext("2d");s.drawImage(t,0,0);for(var h=s.getImageData(0,0,r,i).data,l=s.createImageData(r,i),c=l.data,u=0;u<r;u++)for(var E=0;E<i;E++){var p=E-1<0?0:E-1,d=i-1<E+1?i-1:E+1,f=u-1<0?0:u-1,m=r-1<u+1?r-1:u+1,T=[],g=[0,0,h[4*(E*r+u)]/255*e];for(T.push([-1,0,h[4*(E*r+f)]/255*e]),T.push([-1,-1,h[4*(p*r+f)]/255*e]),T.push([0,-1,h[4*(p*r+u)]/255*e]),T.push([1,-1,h[4*(p*r+m)]/255*e]),T.push([1,0,h[4*(E*r+m)]/255*e]),T.push([1,1,h[4*(d*r+m)]/255*e]),T.push([0,1,h[4*(d*r+u)]/255*e]),T.push([-1,1,h[4*(d*r+f)]/255*e]),p=[],f=T.length,d=0;d<f;d++){m=T[d];var R=T[(d+1)%f];m=[m[0]-g[0],m[1]-g[1],m[2]-g[2]],R=[R[0]-g[0],R[1]-g[1],R[2]-g[2]];p.push((o=[m[1]*R[2]-m[2]*R[1],m[2]*R[0]-m[0]*R[2],m[0]*R[1]-m[1]*R[0]],void 0,a=Math.sqrt(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]),[o[0]/a,o[1]/a,o[2]/a]))}for(T=[0,0,0],d=0;d<p.length;d++)T[0]+=p[d][0],T[1]+=p[d][1],T[2]+=p[d][2];T[0]/=p.length,T[1]/=p.length,T[2]/=p.length,c[g=4*(E*r+u)]=(T[0]+1)/2*255|0,c[g+1]=(T[1]+1)/2*255|0,c[g+2]=255*T[2]|0,c[g+3]=255}return s.putImageData(l,0,0),n},generateDataTexture:function(t,e,r){var i=t*e,n=new Uint8Array(3*i),o=Math.floor(255*r.r),a=Math.floor(255*r.g);r=Math.floor(255*r.b);for(var s=0;s<i;s++)n[3*s]=o,n[3*s+1]=a,n[3*s+2]=r;return(t=new THREE.DataTexture(n,t,e,THREE.RGBFormat)).needsUpdate=!0,t}},THREE.SceneUtils={createMultiMaterialObject:function(t,e){for(var r=new THREE.Object3D,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.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){try{return this.faces[this.face][this.weight][this.style]}catch(t){throw"The font "+this.face+" with "+this.weight+" weight and "+this.style+" style is missing."}},loadFace:function(t){var e=t.familyName.toLowerCase();return this.faces[e]=this.faces[e]||{},this.faces[e][t.cssFontWeight]=this.faces[e][t.cssFontWeight]||{},this.faces[e][t.cssFontWeight][t.cssFontStyle]=t,this.faces[e][t.cssFontWeight][t.cssFontStyle]=t},drawText:function(t){var e=this.getFace(),r=this.size/e.resolution,i=0,n=String(t).split(""),o=n.length,a=[];for(t=0;t<o;t++){var s=new THREE.Path;i=i+(s=this.extractGlyphPoints(n[t],e,r,i,s)).offset;a.push(s.path)}return{paths:a,offset:i/2}},extractGlyphPoints:function(t,e,r,i,n){var o,a,s,h,l,c,u,E,p,d,f,m=[],T=e.glyphs[t]||e.glyphs["?"];if(T){if(T.o)for(h=(e=T._cachedOutline||(T._cachedOutline=T.o.split(" "))).length,t=0;t<h;)switch(s=e[t++],s){case"m":s=e[t++]*r+i,l=e[t++]*r,n.moveTo(s,l);break;case"l":s=e[t++]*r+i,l=e[t++]*r,n.lineTo(s,l);break;case"q":if(s=e[t++]*r+i,l=e[t++]*r,E=e[t++]*r+i,p=e[t++]*r,n.quadraticCurveTo(E,p,s,l),o=m[m.length-1])for(c=o.x,u=o.y,o=1,a=this.divisions;o<=a;o++){var g=o/a;THREE.Shape.Utils.b2(g,c,E,s),THREE.Shape.Utils.b2(g,u,p,l)}break;case"b":if(s=e[t++]*r+i,l=e[t++]*r,E=e[t++]*r+i,p=e[t++]*r,d=e[t++]*r+i,f=e[t++]*r,n.bezierCurveTo(E,p,d,f,s,l),o=m[m.length-1])for(c=o.x,u=o.y,o=1,a=this.divisions;o<=a;o++)g=o/a,THREE.Shape.Utils.b3(g,c,E,d,s),THREE.Shape.Utils.b3(g,u,p,f,l)}return{offset:T.ha*r,path:n}}}},THREE.FontUtils.generateShapes=function(t,e){var r=void 0!==(e=e||{}).curveSegments?e.curveSegments:4,i=void 0!==e.font?e.font:"helvetiker",n=void 0!==e.weight?e.weight:"normal",o=void 0!==e.style?e.style:"normal";for(THREE.FontUtils.size=void 0!==e.size?e.size:100,THREE.FontUtils.divisions=r,THREE.FontUtils.face=i,THREE.FontUtils.weight=n,THREE.FontUtils.style=o,i=[],n=0,o=(r=THREE.FontUtils.drawText(t).paths).length;n<o;n++)Array.prototype.push.apply(i,r[n].toShapes());return i},function(t){var A=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};t.Triangulate=function(t,e){var r=t.length;if(r<3)return null;var i,n,o,a=[],s=[],h=[];if(0<A(t))for(n=0;n<r;n++)s[n]=n;else for(n=0;n<r;n++)s[n]=r-1-n;var l=2*r;for(n=r-1;2<r;){if(l--<=0){THREE.warn("THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()");break}var c;r<=(i=n)&&(i=0),r<=(n=i+1)&&(n=0),r<=(o=n+1)&&(o=0);t:{var u=c=void 0,E=void 0,p=void 0,d=void 0,f=(u=t[s[i]].x,t[s[i]].y),m=t[s[n]].x,T=t[s[n]].y,g=t[s[o]].x;if((m-u)*((E=t[s[o]].y)-f)-(T-f)*(g-u)<1e-10)c=!1;else{var R=void 0,y=void 0,v=void 0,H=void 0,x=(v=y=R=d=p=void 0,g-m),b=E-T,_=u-g,w=f-E,M=m-u,S=T-f;for(c=0;c<r;c++)if(p=t[s[c]].x,d=t[s[c]].y,!(p===u&&d===f||p===m&&d===T||p===g&&d===E)&&(v=p-m,H=d-T,R=M*(y=d-f)-S*(R=p-u),y=_*(d-=E)-w*(p-=g),-1e-10<=(v=x*H-b*v)&&-1e-10<=y&&-1e-10<=R)){c=!1;break t}c=!0}}if(c){for(a.push([t[s[i]],t[s[n]],t[s[o]]]),h.push([s[i],s[n],s[o]]),o=(i=n)+1;o<r;i++,o++)s[i]=s[o];l=2*--r}}return e?h:a},t.Triangulate.area=A}(THREE.FontUtils),self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace},THREE.typeface_js=self._typeface_js,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.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(){if(!0===this.isPlaying)THREE.warn("THREE.Audio: Audio is already playing.");else{var t=this.context.createBufferSource();t.buffer=this.source.buffer,t.loop=this.source.loop,t.onended=this.source.onended,t.connect(this.panner),t.start(0,this.startTime),this.isPlaying=!0,this.source=t}},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.onEnded=function(){this.isPlaying=!1},THREE.Audio.prototype.setLoop=function(t){this.source.loop=t},THREE.Audio.prototype.setRefDistance=function(t){this.panner.refDistance=t},THREE.Audio.prototype.setRolloffFactor=function(t){this.panner.rolloffFactor=t},THREE.Audio.prototype.setVolume=function(t){this.gain.gain.value=t},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,a=new THREE.Vector3,s=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),a.subVectors(r,s),t.setPosition(r.x,r.y,r.z),t.setOrientation(o.x,o.y,o.z,e.x,e.y,e.z),t.setVelocity(a.x,a.y,a.z),s.copy(r)}}(),THREE.Curve=function(){},THREE.Curve.prototype.getPoint=function(t){return THREE.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},THREE.Curve.prototype.getPointAt=function(t){return t=this.getUtoTmapping(t),this.getPoint(t)},THREE.Curve.prototype.getPoints=function(t){t||(t=5);var e,r=[];for(e=0;e<=t;e++)r.push(this.getPoint(e/t));return r},THREE.Curve.prototype.getSpacedPoints=function(t){t||(t=5);var e,r=[];for(e=0;e<=t;e++)r.push(this.getPointAt(e/t));return r},THREE.Curve.prototype.getLength=function(){var t=this.getLengths();return t[t.length-1]},THREE.Curve.prototype.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},THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0,this.getLengths()},THREE.Curve.prototype.getUtoTmapping=function(t,e){var r,i=this.getLengths(),n=0,o=i.length;r=e||t*i[o-1];for(var a,s=0,h=o-1;s<=h;)if((a=i[n=Math.floor(s+(h-s)/2)]-r)<0)s=n+1;else{if(!(0<a)){h=n;break}h=n-1}return i[n=h]==r?n/(o-1):(n+(r-(s=i[n]))/(i[n+1]-s))/(o-1)},THREE.Curve.prototype.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()},THREE.Curve.prototype.getTangentAt=function(t){return t=this.getUtoTmapping(t),this.getTangent(t)},THREE.Curve.Utils={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,e,r,i,n){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.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.bends=[],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.checkConnection=function(){},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){var e=t*this.getLength(),r=this.getCurveLengths();for(t=0;t<r.length;){if(r[t]>=e)return e=1-(e=r[t]-e)/(t=this.curves[t]).getLength(),t.getPointAt(e);t++}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;var t,e=[],r=0,i=this.curves.length;for(t=0;t<i;t++)r+=this.curves[t].getLength(),e.push(r);return this.cacheLengths=e},THREE.CurvePath.prototype.getBoundingBox=function(){var t,e,r,i,n,o,a=this.getPoints();t=e=Number.NEGATIVE_INFINITY,i=n=Number.POSITIVE_INFINITY;var s,h,l,c,u=a[0]instanceof THREE.Vector3;for(c=u?new THREE.Vector3:new THREE.Vector2,h=0,l=a.length;h<l;h++)(s=a[h]).x>t?t=s.x:s.x<i&&(i=s.x),s.y>e?e=s.y:s.y<n&&(n=s.y),u&&(s.z>r?r=s.z:s.z<o&&(o=s.z)),c.add(s);return a={minX:i,minY:n,maxX:t,maxY:e},u&&(a.maxZ=r,a.minZ=o),a},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;r<t.length;r++)e.vertices.push(new THREE.Vector3(t[r].x,t[r].y,t[r].z||0));return e},THREE.CurvePath.prototype.addWrapPath=function(t){this.bends.push(t)},THREE.CurvePath.prototype.getTransformedPoints=function(t,e){var r,i,n=this.getPoints(t);for(e||(e=this.bends),r=0,i=e.length;r<i;r++)n=this.getWrapPoints(n,e[r]);return n},THREE.CurvePath.prototype.getTransformedSpacedPoints=function(t,e){var r,i,n=this.getSpacedPoints(t);for(e||(e=this.bends),r=0,i=e.length;r<i;r++)n=this.getWrapPoints(n,e[r]);return n},THREE.CurvePath.prototype.getWrapPoints=function(t,e){var r,i,n,o,a,s,h=this.getBoundingBox();for(r=0,i=t.length;r<i;r++)o=(n=t[r]).x,a=n.y,s=o/h.maxX,s=e.getUtoTmapping(s,o),o=e.getPoint(s),(s=e.getTangent(s)).set(-s.y,s.x).multiplyScalar(a),n.x=o.x+s.x,n.y=o.y+s.y;return t},THREE.Gyroscope=function(){THREE.Object3D.call(this)},THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype),THREE.Gyroscope.prototype.constructor=THREE.Gyroscope,THREE.Gyroscope.prototype.updateMatrixWorld=function(){var i=new THREE.Vector3,n=new THREE.Quaternion,o=new THREE.Vector3,a=new THREE.Vector3,s=new THREE.Quaternion,h=new THREE.Vector3;return function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent?(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(a,s,h),this.matrix.decompose(i,n,o),this.matrixWorld.compose(a,n,h)):this.matrixWorld.copy(this.matrix),t=!(this.matrixWorldNeedsUpdate=!1));for(var e=0,r=this.children.length;e<r;e++)this.children[e].updateMatrixWorld(t)}}(),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.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"},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){var r=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:r})},THREE.Path.prototype.lineTo=function(t,e){var r=Array.prototype.slice.call(arguments),i=this.actions[this.actions.length-1].args;i=new THREE.LineCurve(new THREE.Vector2(i[i.length-2],i[i.length-1]),new THREE.Vector2(t,e));this.curves.push(i),this.actions.push({action:THREE.PathActions.LINE_TO,args:r})},THREE.Path.prototype.quadraticCurveTo=function(t,e,r,i){var n=Array.prototype.slice.call(arguments),o=this.actions[this.actions.length-1].args;o=new THREE.QuadraticBezierCurve(new THREE.Vector2(o[o.length-2],o[o.length-1]),new THREE.Vector2(t,e),new THREE.Vector2(r,i));this.curves.push(o),this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:n})},THREE.Path.prototype.bezierCurveTo=function(t,e,r,i,n,o){var a=Array.prototype.slice.call(arguments),s=this.actions[this.actions.length-1].args;s=new THREE.CubicBezierCurve(new THREE.Vector2(s[s.length-2],s[s.length-1]),new THREE.Vector2(t,e),new THREE.Vector2(r,i),new THREE.Vector2(n,o));this.curves.push(s),this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:a})},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:THREE.PathActions.CSPLINE_THRU,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){var s=this.actions[this.actions.length-1].args;this.absellipse(t+s[s.length-2],e+s[s.length-1],r,i,n,o,a)},THREE.Path.prototype.absellipse=function(t,e,r,i,n,o,a){var s=Array.prototype.slice.call(arguments),h=new THREE.EllipseCurve(t,e,r,i,n,o,a);this.curves.push(h),h=h.getPoint(1),s.push(h.x),s.push(h.y),this.actions.push({action:THREE.PathActions.ELLIPSE,args:s})},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){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(t,e);t=t||12;var r,i,n,o,a,s,h,l,c,u,E,p,d,f=[];for(r=0,i=this.actions.length;r<i;r++)switch(n=this.actions[r],o=n.action,n=n.args,o){case THREE.PathActions.MOVE_TO:case THREE.PathActions.LINE_TO:f.push(new THREE.Vector2(n[0],n[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:for(a=n[2],s=n[3],c=n[0],u=n[1],0<f.length?(E=(o=f[f.length-1]).x,p=o.y):(E=(o=this.actions[r-1].args)[o.length-2],p=o[o.length-1]),n=1;n<=t;n++)d=n/t,o=THREE.Shape.Utils.b2(d,E,c,a),d=THREE.Shape.Utils.b2(d,p,u,s),f.push(new THREE.Vector2(o,d));break;case THREE.PathActions.BEZIER_CURVE_TO:for(a=n[4],s=n[5],c=n[0],u=n[1],h=n[2],l=n[3],0<f.length?(E=(o=f[f.length-1]).x,p=o.y):(E=(o=this.actions[r-1].args)[o.length-2],p=o[o.length-1]),n=1;n<=t;n++)d=n/t,o=THREE.Shape.Utils.b3(d,E,c,h,a),d=THREE.Shape.Utils.b3(d,p,u,l,s),f.push(new THREE.Vector2(o,d));break;case THREE.PathActions.CSPLINE_THRU:for(o=this.actions[r-1].args,d=[new THREE.Vector2(o[o.length-2],o[o.length-1])],o=t*n[0].length,d=d.concat(n[0]),d=new THREE.SplineCurve(d),n=1;n<=o;n++)f.push(d.getPointAt(n/o));break;case THREE.PathActions.ARC:for(a=n[0],s=n[1],u=n[2],h=n[3],o=n[4],c=!!n[5],E=o-h,p=2*t,n=1;n<=p;n++)d=n/p,c||(d=1-d),d=h+d*E,o=a+u*Math.cos(d),d=s+u*Math.sin(d),f.push(new THREE.Vector2(o,d));break;case THREE.PathActions.ELLIPSE:for(a=n[0],s=n[1],u=n[2],l=n[3],h=n[4],o=n[5],c=!!n[6],E=o-h,p=2*t,n=1;n<=p;n++)d=n/p,c||(d=1-d),d=h+d*E,o=a+u*Math.cos(d),d=s+l*Math.sin(d),f.push(new THREE.Vector2(o,d))}return r=f[f.length-1],Math.abs(r.x-f[0].x)<1e-10&&Math.abs(r.y-f[0].y)<1e-10&&f.splice(f.length-1,1),e&&f.push(f[0]),f},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}function i(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,l=s.y-a.y;if(1e-10<Math.abs(l)){if(l<0&&(a=e[o],h=-h,s=e[n],l=-l),!(t.y<a.y||t.y>s.y))if(t.y==a.y){if(t.x==a.x)return!0}else{if(0==(n=l*(t.x-a.x)-h*(t.y-a.y)))return!0;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!0}return i}var n=function(t){var e,r,i,n,o=[],a=new THREE.Path;for(e=0,r=t.length;e<r;e++)n=(i=t[e]).args,(i=i.action)==THREE.PathActions.MOVE_TO&&0!=a.actions.length&&(o.push(a),a=new THREE.Path),a[i].apply(a,n);return 0!=a.actions.length&&o.push(a),o}(this.actions);if(0==n.length)return[];if(!0===e)return r(n);var o,a,s,h=[];if(1==n.length)return a=n[0],(s=new THREE.Shape).actions=a.actions,s.curves=a.curves,h.push(s),h;var l=!THREE.Shape.Utils.isClockWise(n[0].getPoints());l=t?!l:l;s=[];var c,u,E,p=[],d=[],f=0;for(p[f]=void 0,d[f]=[],u=0,E=n.length;u<E;u++)c=(a=n[u]).getPoints(),o=THREE.Shape.Utils.isClockWise(c),(o=t?!o:o)?(!l&&p[f]&&f++,p[f]={s:new THREE.Shape,p:c},p[f].s.actions=a.actions,p[f].s.curves=a.curves,l&&f++,d[f]=[]):d[f].push({h:a,p:c[0]});if(!p[0])return r(n);if(1<p.length){for(u=!1,E=[],a=0,n=p.length;a<n;a++)s[a]=[];for(a=0,n=p.length;a<n;a++)for(o=d[a],l=0;l<o.length;l++){f=o[l],c=!0;for(var m=0;m<p.length;m++)i(f.p,p[m].p)&&(a!=m&&E.push({froms:a,tos:m,hole:l}),c?(c=!1,s[m].push(f)):u=!0);c&&s[a].push(f)}0<E.length&&(u||(d=s))}for(u=0,E=p.length;u<E;u++)for(s=p[u].s,h.push(s),n=0,o=(a=d[u]).length;n<o;n++)s.holes.push(a[n].h);return h},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){var e,r=this.holes.length,i=[];for(e=0;e<r;e++)i[e]=this.holes[e].getTransformedPoints(t,this.bends);return i},THREE.Shape.prototype.getSpacedPointsHoles=function(t){var e,r=this.holes.length,i=[];for(e=0;e<r;e++)i[e]=this.holes[e].getTransformedSpacedPoints(t,this.bends);return i},THREE.Shape.prototype.extractAllPoints=function(t){return{shape:this.getTransformedPoints(t),holes:this.getPointsHoles(t)}},THREE.Shape.prototype.extractPoints=function(t){return this.useSpacedPoints?this.extractAllSpacedPoints(t):this.extractAllPoints(t)},THREE.Shape.prototype.extractAllSpacedPoints=function(t){return{shape:this.getTransformedSpacedPoints(t),holes:this.getSpacedPointsHoles(t)}},THREE.Shape.Utils={triangulateShape:function(R,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 y(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,l=t.x-r.x,c=t.y-r.y,u=a*s-o*h,E=a*l-o*c;if(1e-10<Math.abs(u)){if(0<u){if(E<0||u<E)return[];if((s=h*l-s*c)<0||u<s)return[]}else{if(0<E||E<u)return[];if(0<(s=h*l-s*c)||s<u)return[]}return 0==s?!n||0!=E&&E!=u?[t]:[]:s==u?!n||0!=E&&E!=u?[e]:[]:0==E?[r]:E==u?[i]:(n=s/u,[{x:t.x+n*o,y:t.y+n*a}])}return 0!=E||h*l!=s*c?[]:(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]:[]:(0!=o?(t.x<e.x?(s=(o=t).x,t=(a=e).x):(s=(o=e).x,t=(a=t).x),r.x<i.x?(u=(e=r).x,r=(h=i).x):(u=(e=i).x,r=(h=r).x)):(t.y<e.y?(s=(o=t).y,t=(a=e).y):(s=(o=e).y,t=(a=t).y),r.y<i.y?(u=(e=r).y,r=(h=i).y):(u=(e=i).y,r=(h=r).y)),s<=u?t<u?[]:t==u?n?[]:[e]:t<=r?[e,a]:[e,h]:r<s?[]:s==r?n?[]:[o]:t<=r?[o,a]:[o,h]))}function v(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,1e-10<Math.abs(t)?(e=a*r-i*e,0<t?0<=n&&0<=e:0<=n||0<=e):0<n}var e,r,i,n,o,a={};for(i=R.concat(),e=0,r=t.length;e<r;e++)Array.prototype.push.apply(i,t[e]);for(e=0,r=i.length;e<r;e++)void 0!==a[o=i[e].x+":"+i[e].y]&&THREE.warn("THREE.Shape: Duplicate point",o),a[o]=e;e=function(t,a){function e(t,e){var r=d.length-1,i=t-1;i<0&&(i=r);var n=t+1;return r<n&&(n=0),!!(r=v(d[t],d[i],d[n],o[e]))&&(r=o.length-1,(i=e-1)<0&&(i=r),r<(n=e+1)&&(n=0),!!(r=v(o[e],o[i],o[n],d[t])))}function r(t,e){var r,i;for(r=0;r<d.length;r++)if(i=r+1,i%=d.length,0<(i=y(t,e,d[r],d[i],!0)).length)return!0;return!1}function i(t,e){var r,i,n,o;for(r=0;r<f.length;r++)for(i=a[f[r]],n=0;n<i.length;n++)if(o=n+1,o%=i.length,0<(o=y(t,e,i[n],i[o],!0)).length)return!0;return!1}var o,n,s,h,l,c,u,E,p,d=R.concat(),f=[],m=[],T=0;for(n=a.length;T<n;T++)f.push(T);u=0;for(var g=2*f.length;0<f.length;){if(--g<0){console.log("Infinite Loop! Holes left:"+f.length+", Probably Hole outside Shape!");break}for(s=u;s<d.length;s++){for(h=d[s],n=-1,T=0;T<f.length;T++)if(l=f[T],void 0===m[c=h.x+":"+h.y+":"+l]){for(o=a[l],E=0;E<o.length;E++)if(l=o[E],e(s,E)&&!r(h,l)&&!i(h,l)){n=E,f.splice(T,1),u=d.slice(0,s+1),l=d.slice(s),E=o.slice(n),p=o.slice(0,n+1),d=u.concat(E).concat(p).concat(l),u=s;break}if(0<=n)break;m[c]=!0}if(0<=n)break}}return d}(0,t);var s=THREE.FontUtils.Triangulate(e,!1);for(e=0,r=s.length;e<r;e++)for(n=s[e],i=0;i<3;i++)void 0!==(o=a[o=n[i].x+":"+n[i].y])&&(n[i]=o);return s.concat()},isClockWise:function(t){return THREE.FontUtils.Triangulate.area(t)<0},b2p0:function(t,e){var r=1-t;return r*r*e},b2p1:function(t,e){return 2*(1-t)*t*e},b2p2:function(t,e){return t*t*e},b2:function(t,e,r,i){return this.b2p0(t,e)+this.b2p1(t,r)+this.b2p2(t,i)},b3p0:function(t,e){var r=1-t;return r*r*r*e},b3p1:function(t,e){var r=1-t;return 3*r*r*t*e},b3p2:function(t,e){return 3*(1-t)*t*t*e},b3p3:function(t,e){return t*t*t*e},b3:function(t,e,r,i,n){return this.b3p0(t,e)+this.b3p1(t,r)+this.b3p2(t,i)+this.b3p3(t,n)}},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=new THREE.Vector2;return e.x=THREE.Shape.Utils.b2(t,this.v0.x,this.v1.x,this.v2.x),e.y=THREE.Shape.Utils.b2(t,this.v0.y,this.v1.y,this.v2.y),e},THREE.QuadraticBezierCurve.prototype.getTangent=function(t){var e=new THREE.Vector2;return e.x=THREE.Curve.Utils.tangentQuadraticBezier(t,this.v0.x,this.v1.x,this.v2.x),e.y=THREE.Curve.Utils.tangentQuadraticBezier(t,this.v0.y,this.v1.y,this.v2.y),e.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;return e=THREE.Shape.Utils.b3(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t=THREE.Shape.Utils.b3(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),new THREE.Vector2(e,t)},THREE.CubicBezierCurve.prototype.getTangent=function(t){var e;return e=THREE.Curve.Utils.tangentCubicBezier(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t=THREE.Curve.Utils.tangentCubicBezier(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),(e=new THREE.Vector2(e,t)).normalize(),e},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*=(o=this.points).length-1,t-=e=Math.floor(t);var e,r=o[0==e?e:e-1],i=o[e],n=o[e>o.length-2?o.length-1:e+1],o=o[e>o.length-3?o.length-1:e+2];return(e=new THREE.Vector2).x=THREE.Curve.Utils.interpolate(r.x,i.x,n.x,o.x,t),e.y=THREE.Curve.Utils.interpolate(r.y,i.y,n.y,o.y,t),e},THREE.EllipseCurve=function(t,e,r,i,n,o,a){this.aX=t,this.aY=e,this.xRadius=r,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=o,this.aClockwise=a},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;return e<0&&(e+=2*Math.PI),e>2*Math.PI&&(e-=2*Math.PI),t=!0===this.aClockwise?this.aEndAngle+(1-t)*(2*Math.PI-e):this.aStartAngle+t*e,(e=new THREE.Vector2).x=this.aX+this.xRadius*Math.cos(t),e.y=this.aY+this.yRadius*Math.sin(t),e},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=new THREE.Vector3;return e.x=THREE.Shape.Utils.b2(t,this.v0.x,this.v1.x,this.v2.x),e.y=THREE.Shape.Utils.b2(t,this.v0.y,this.v1.y,this.v2.y),e.z=THREE.Shape.Utils.b2(t,this.v0.z,this.v1.z,this.v2.z),e}),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=new THREE.Vector3;return e.x=THREE.Shape.Utils.b3(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e.y=THREE.Shape.Utils.b3(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e.z=THREE.Shape.Utils.b3(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z),e}),THREE.SplineCurve3=THREE.Curve.create(function(t){this.points=null==t?[]:t},function(t){t*=(o=this.points).length-1,t-=e=Math.floor(t);var e,r=o[0==e?e:e-1],i=o[e],n=o[e>o.length-2?o.length-1:e+1],o=o[e>o.length-3?o.length-1:e+2];return(e=new THREE.Vector3).x=THREE.Curve.Utils.interpolate(r.x,i.x,n.x,o.x,t),e.y=THREE.Curve.Utils.interpolate(r.y,i.y,n.y,o.y,t),e.z=THREE.Curve.Utils.interpolate(r.z,i.z,n.z,o.z,t),e}),THREE.ClosedSplineCurve3=THREE.Curve.create(function(t){this.points=null==t?[]:t},function(t){t*=(o=this.points).length-0,t-=e=Math.floor(t);var e,r=o[((e=e+(0<e?0:(Math.floor(Math.abs(e)/o.length)+1)*o.length))-1)%o.length],i=o[e%o.length],n=o[(e+1)%o.length],o=o[(e+2)%o.length];return(e=new THREE.Vector3).x=THREE.Curve.Utils.interpolate(r.x,i.x,n.x,o.x,t),e.y=THREE.Curve.Utils.interpolate(r.y,i.y,n.y,o.y,t),e.z=THREE.Curve.Utils.interpolate(r.z,i.z,n.z,o.z,t),e}),THREE.AnimationHandler={LINEAR:0,CATMULLROM:1,CATMULLROM_FORWARD:2,add:function(){THREE.warn("THREE.AnimationHandler.add() has been deprecated.")},get:function(){THREE.warn("THREE.AnimationHandler.get() has been deprecated.")},remove:function(){THREE.warn("THREE.AnimationHandler.remove() has been deprecated.")},animations:[],init:function(t){if(!0===t.initialized)return t;for(var e=0;e<t.hierarchy.length;e++){for(var r=0;r<t.hierarchy[e].keys.length;r++)if(t.hierarchy[e].keys[r].time<0&&(t.hierarchy[e].keys[r].time=0),void 0!==t.hierarchy[e].keys[r].rot&&!(t.hierarchy[e].keys[r].rot instanceof THREE.Quaternion)){var i=t.hierarchy[e].keys[r].rot;t.hierarchy[e].keys[r].rot=(new THREE.Quaternion).fromArray(i)}if(t.hierarchy[e].keys.length&&void 0!==t.hierarchy[e].keys[0].morphTargets){for(i={},r=0;r<t.hierarchy[e].keys.length;r++)for(var n=0;n<t.hierarchy[e].keys[r].morphTargets.length;n++){var o=t.hierarchy[e].keys[r].morphTargets[n];i[o]=-1}for(t.hierarchy[e].usedMorphTargets=i,r=0;r<t.hierarchy[e].keys.length;r++){var a={};for(o in i){for(n=0;n<t.hierarchy[e].keys[r].morphTargets.length;n++)if(t.hierarchy[e].keys[r].morphTargets[n]===o){a[o]=t.hierarchy[e].keys[r].morphTargetsInfluences[n];break}n===t.hierarchy[e].keys[r].morphTargets.length&&(a[o]=0)}t.hierarchy[e].keys[r].morphTargetsInfluences=a}}for(r=1;r<t.hierarchy[e].keys.length;r++)t.hierarchy[e].keys[r].time===t.hierarchy[e].keys[r-1].time&&(t.hierarchy[e].keys.splice(r,1),r--);for(r=0;r<t.hierarchy[e].keys.length;r++)t.hierarchy[e].keys[r].index=r}return t.initialized=!0,t},parse:function(t){var i=function(t,e){e.push(t);for(var r=0;r<t.children.length;r++)i(t.children[r],e)},e=[];if(t instanceof THREE.SkinnedMesh)for(var r=0;r<t.skeleton.bones.length;r++)e.push(t.skeleton.bones[r]);else i(t,e);return e},play:function(t){-1===this.animations.indexOf(t)&&this.animations.push(t)},stop:function(t){-1!==(t=this.animations.indexOf(t))&&this.animations.splice(t,1)},update:function(t){for(var e=0;e<this.animations.length;e++)this.animations[e].resetBlendWeights();for(e=0;e<this.animations.length;e++)this.animations[e].update(t)}},THREE.Animation=function(t,e){this.root=t,this.data=THREE.AnimationHandler.init(e),this.hierarchy=THREE.AnimationHandler.parse(t),this.currentTime=0,this.timeScale=1,this.isPlaying=!1,this.loop=!0,this.weight=0,this.interpolationType=THREE.AnimationHandler.LINEAR},THREE.Animation.prototype={constructor:THREE.Animation,keyTypes:["pos","rot","scl"],play:function(t,e){this.currentTime=void 0!==t?t:0,this.weight=void 0!==e?e:1,this.isPlaying=!0,this.reset(),THREE.AnimationHandler.play(this)},stop:function(){this.isPlaying=!1,THREE.AnimationHandler.stop(this)},reset:function(){for(var t=0,e=this.hierarchy.length;t<e;t++){var r=this.hierarchy[t];void 0===r.animationCache&&(r.animationCache={animations:{},blending:{positionWeight:0,quaternionWeight:0,scaleWeight:0}});var i=this.data.name,n=(o=r.animationCache.animations)[i];for(void 0===n&&(n={prevKey:{pos:0,rot:0,scl:0},nextKey:{pos:0,rot:0,scl:0},originalMatrix:r.matrix},o[i]=n),r=0;r<3;r++){i=this.keyTypes[r];for(var o=this.data.hierarchy[t].keys[0],a=this.getNextKeyWith(i,t,1);a.time<this.currentTime&&a.index>o.index;)o=a,a=this.getNextKeyWith(i,t,a.index+1);n.prevKey[i]=o,n.nextKey[i]=a}}},resetBlendWeights:function(){for(var t=0,e=this.hierarchy.length;t<e;t++){var r=this.hierarchy[t].animationCache;void 0!==r&&((r=r.blending).positionWeight=0,r.quaternionWeight=0,r.scaleWeight=0)}},update:function(){var E=[],p=new THREE.Vector3,d=new THREE.Vector3,f=new THREE.Quaternion,m=function(t,e){var r,i,n,o,a,s,h=[],l=[];return r=(t.length-1)*e,r-=i=Math.floor(r),h[0]=0===i?i:i-1,h[1]=i,h[2]=i>t.length-2?i:i+1,h[3]=i>t.length-3?i:i+2,i=t[h[0]],o=t[h[1]],a=t[h[2]],s=t[h[3]],n=r*(h=r*r),l[0]=c(i[0],o[0],a[0],s[0],r,h,n),l[1]=c(i[1],o[1],a[1],s[1],r,h,n),l[2]=c(i[2],o[2],a[2],s[2],r,h,n),l},c=function(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};return function(t){if(!1!==this.isPlaying&&(this.currentTime+=t*this.timeScale,0!==this.weight)){t=this.data.length,(this.currentTime>t||this.currentTime<0)&&(this.loop?(this.currentTime%=t,this.currentTime<0&&(this.currentTime+=t),this.reset()):this.stop()),t=0;for(var e=this.hierarchy.length;t<e;t++)for(var r=this.hierarchy[t],i=r.animationCache.animations[this.data.name],n=r.animationCache.blending,o=0;o<3;o++){var a=this.keyTypes[o],s=i.prevKey[a],h=i.nextKey[a];if(0<this.timeScale&&h.time<=this.currentTime||this.timeScale<0&&s.time>=this.currentTime){for(s=this.data.hierarchy[t].keys[0],h=this.getNextKeyWith(a,t,1);h.time<this.currentTime&&h.index>s.index;)s=h,h=this.getNextKeyWith(a,t,h.index+1);i.prevKey[a]=s,i.nextKey[a]=h}var l=(this.currentTime-s.time)/(h.time-s.time),c=s[a],u=h[a];l<0&&(l=0),1<l&&(l=1),"pos"===a?this.interpolationType===THREE.AnimationHandler.LINEAR?(d.x=c[0]+(u[0]-c[0])*l,d.y=c[1]+(u[1]-c[1])*l,d.z=c[2]+(u[2]-c[2])*l,s=this.weight/(this.weight+n.positionWeight),r.position.lerp(d,s),n.positionWeight+=this.weight):this.interpolationType!==THREE.AnimationHandler.CATMULLROM&&this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD||(E[0]=this.getPrevKeyWith("pos",t,s.index-1).pos,E[1]=c,E[2]=u,E[3]=this.getNextKeyWith("pos",t,h.index+1).pos,h=m(E,l=.33*l+.33),s=this.weight/(this.weight+n.positionWeight),n.positionWeight+=this.weight,(a=r.position).x+=(h[0]-a.x)*s,a.y+=(h[1]-a.y)*s,a.z+=(h[2]-a.z)*s,this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(l=m(E,1.01*l),p.set(l[0],l[1],l[2]),p.sub(a),p.y=0,p.normalize(),l=Math.atan2(p.x,p.z),r.rotation.set(0,l,0))):"rot"===a?(THREE.Quaternion.slerp(c,u,f,l),0===n.quaternionWeight?(r.quaternion.copy(f),n.quaternionWeight=this.weight):(s=this.weight/(this.weight+n.quaternionWeight),THREE.Quaternion.slerp(r.quaternion,f,r.quaternion,s),n.quaternionWeight+=this.weight)):"scl"===a&&(d.x=c[0]+(u[0]-c[0])*l,d.y=c[1]+(u[1]-c[1])*l,d.z=c[2]+(u[2]-c[2])*l,s=this.weight/(this.weight+n.scaleWeight),r.scale.lerp(d,s),n.scaleWeight+=this.weight)}return!0}}}(),getNextKeyWith:function(t,e,r){var i=this.data.hierarchy[e].keys;for(r=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?r<i.length-1?r:i.length-1:r%i.length;r<i.length;r++)if(void 0!==i[r][t])return i[r];return this.data.hierarchy[e].keys[0]},getPrevKeyWith:function(t,e,r){var i=this.data.hierarchy[e].keys;for(r=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<r?r:0:0<=r?r:r+i.length;0<=r;r--)if(void 0!==i[r][t])return i[r];return this.data.hierarchy[e].keys[i.length-1]}},THREE.KeyFrameAnimation=function(t){this.root=t.node,this.data=THREE.AnimationHandler.init(t),this.hierarchy=THREE.AnimationHandler.parse(this.root),this.currentTime=0,this.timeScale=.001,this.isPlaying=!1,this.loop=this.isPaused=!0,t=0;for(var e=this.hierarchy.length;t<e;t++){var r=this.data.hierarchy[t].sids,i=this.hierarchy[t];if(this.data.hierarchy[t].keys.length&&r){for(var n=0;n<r.length;n++){var o=r[n],a=this.getNextKeyWith(o,t,0);a&&a.apply(o)}i.matrixAutoUpdate=!1,this.data.hierarchy[t].node.updateMatrix(),i.matrixWorldNeedsUpdate=!0}}},THREE.KeyFrameAnimation.prototype={constructor:THREE.KeyFrameAnimation,play:function(t){if(this.currentTime=void 0!==t?t:0,!1===this.isPlaying){this.isPlaying=!0;var e,r,i=this.hierarchy.length;for(t=0;t<i;t++)e=this.hierarchy[t],void 0===(r=this.data.hierarchy[t]).animationCache&&(r.animationCache={},r.animationCache.prevKey=null,r.animationCache.nextKey=null,r.animationCache.originalMatrix=e.matrix),(e=this.data.hierarchy[t].keys).length&&(r.animationCache.prevKey=e[0],r.animationCache.nextKey=e[1],this.startTime=Math.min(e[0].time,this.startTime),this.endTime=Math.max(e[e.length-1].time,this.endTime));this.update(0)}this.isPaused=!1,THREE.AnimationHandler.play(this)},stop:function(){this.isPaused=this.isPlaying=!1,THREE.AnimationHandler.stop(this);for(var t=0;t<this.data.hierarchy.length;t++){var e=this.hierarchy[t],r=this.data.hierarchy[t];if(void 0!==r.animationCache){var i=r.animationCache.originalMatrix;i.copy(e.matrix),e.matrix=i,delete r.animationCache}}},update:function(t){if(!1!==this.isPlaying){this.currentTime+=t*this.timeScale,t=this.data.length,!0===this.loop&&this.currentTime>t&&(this.currentTime%=t),this.currentTime=Math.min(this.currentTime,t),t=0;for(var e=this.hierarchy.length;t<e;t++){var r=this.hierarchy[t],i=(n=this.data.hierarchy[t]).keys,n=n.animationCache;if(i.length){var o=n.prevKey,a=n.nextKey;if(a.time<=this.currentTime){for(;a.time<this.currentTime&&a.index>o.index;)a=i[(o=a).index+1];n.prevKey=o,n.nextKey=a}a.time>=this.currentTime?o.interpolate(a,this.currentTime):o.interpolate(a,a.time),this.data.hierarchy[t].node.updateMatrix(),r.matrixWorldNeedsUpdate=!0}}}},getNextKeyWith:function(t,e,r){for(r%=(e=this.data.hierarchy[e].keys).length;r<e.length;r++)if(e[r].hasTarget(t))return e[r];return e[0]},getPrevKeyWith:function(t,e,r){for(e=this.data.hierarchy[e].keys,r=0<=r?r:r+e.length;0<=r;r--)if(e[r].hasTarget(t))return e[r];return e[e.length-1]}},THREE.MorphAnimation=function(t){this.mesh=t,this.frames=t.morphTargetInfluences.length,this.currentTime=0,this.duration=1e3,this.loop=!0,this.currentFrame=this.lastFrame=0,this.isPlaying=!1},THREE.MorphAnimation.prototype={constructor:THREE.MorphAnimation,play:function(){this.isPlaying=!0},pause:function(){this.isPlaying=!1},update:function(t){if(!1!==this.isPlaying){this.currentTime+=t,!0===this.loop&&this.currentTime>this.duration&&(this.currentTime%=this.duration),this.currentTime=Math.min(this.currentTime,this.duration),t=this.duration/this.frames;var e=Math.floor(this.currentTime/t),r=this.mesh.morphTargetInfluences;e!=this.currentFrame&&(r[this.lastFrame]=0,r[this.currentFrame]=1,r[e]=0,this.lastFrame=this.currentFrame,this.currentFrame=e),r[e]=this.currentTime%t/t,r[this.lastFrame]=1-r[e]}}},THREE.BoxGeometry=function(t,e,r,i,n,o){function a(t,e,r,i,n,o,a,s){var h,l=y.widthSegments,c=y.heightSegments,u=n/2,E=o/2,p=y.vertices.length;"x"===t&&"y"===e||"y"===t&&"x"===e?h="z":"x"===t&&"z"===e||"z"===t&&"x"===e?(h="y",c=y.depthSegments):("z"===t&&"y"===e||"y"===t&&"z"===e)&&(h="x",l=y.depthSegments);var d=l+1,f=c+1,m=n/l,T=o/c,g=new THREE.Vector3;for(g[h]=0<a?1:-1,n=0;n<f;n++)for(o=0;o<d;o++){var R=new THREE.Vector3;R[t]=(o*m-u)*r,R[e]=(n*T-E)*i,R[h]=a,y.vertices.push(R)}for(n=0;n<c;n++)for(o=0;o<l;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/l,1-n/c),a=new THREE.Vector2(o/l,1-(n+1)/c),h=new THREE.Vector2((o+1)/l,1-(n+1)/c),u=new THREE.Vector2((o+1)/l,1-n/c),(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,y.faces.push(E),y.faceVertexUvs[0].push([i,a,u]),(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,y.faces.push(E),y.faceVertexUvs[0].push([a.clone(),h,u.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 y=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.CircleGeometry=function(t,e,r,i){THREE.Geometry.call(this),this.type="CircleGeometry",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,o=[];n=new THREE.Vector3;var a=new THREE.Vector2(.5,.5);for(this.vertices.push(n),o.push(a),n=0;n<=e;n++){var s=new THREE.Vector3,h=r+n/e*i;s.x=t*Math.cos(h),s.y=t*Math.sin(h),this.vertices.push(s),o.push(new THREE.Vector2((s.x/t+1)/2,(s.y/t+1)/2))}for(r=new THREE.Vector3(0,0,1),n=1;n<=e;n++)this.faces.push(new THREE.Face3(n,n+1,0,[r.clone(),r.clone(),r.clone()])),this.faceVertexUvs[0].push([o[n].clone(),o[n+1].clone(),a.clone()]);this.computeFaceNormals(),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,t)},THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.CircleGeometry.prototype.constructor=THREE.CircleGeometry,THREE.CubeGeometry=function(t,e,r,i,n,o){return THREE.warn("THREE.CubeGeometry has been renamed to THREE.BoxGeometry."),new THREE.BoxGeometry(t,e,r,i,n,o)},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;var h,l,c=r/2,u=[],E=[];for(l=0;l<=n;l++){var p=[],d=[],f=(T=l/n)*(e-t)+t;for(h=0;h<=i;h++){var m=h/i;(g=new THREE.Vector3).x=f*Math.sin(m*s+a),g.y=-T*r+c,g.z=f*Math.cos(m*s+a),this.vertices.push(g),p.push(this.vertices.length-1),d.push(new THREE.Vector2(m,1-T))}u.push(p),E.push(d)}for(r=(e-t)/r,h=0;h<i;h++)for(0!==t?(a=this.vertices[u[0][h]].clone(),s=this.vertices[u[0][h+1]].clone()):(a=this.vertices[u[1][h]].clone(),s=this.vertices[u[1][h+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++){p=u[l][h],d=u[l+1][h];var T=u[l+1][h+1],g=(f=u[l][h+1],m=a.clone(),a.clone()),R=s.clone(),y=s.clone(),v=E[l][h].clone(),H=E[l+1][h].clone(),x=E[l+1][h+1].clone(),b=E[l][h+1].clone();this.faces.push(new THREE.Face3(p,d,f,[m,g,y])),this.faceVertexUvs[0].push([v,H,b]),this.faces.push(new THREE.Face3(d,T,f,[g.clone(),R,y.clone()])),this.faceVertexUvs[0].push([H.clone(),x,b.clone()])}if(!1===o&&0<t)for(this.vertices.push(new THREE.Vector3(0,c,0)),h=0;h<i;h++)p=u[0][h],d=u[0][h+1],T=this.vertices.length-1,m=new THREE.Vector3(0,1,0),g=new THREE.Vector3(0,1,0),R=new THREE.Vector3(0,1,0),v=E[0][h].clone(),H=E[0][h+1].clone(),x=new THREE.Vector2(H.x,0),this.faces.push(new THREE.Face3(p,d,T,[m,g,R])),this.faceVertexUvs[0].push([v,H,x]);if(!1===o&&0<e)for(this.vertices.push(new THREE.Vector3(0,-c,0)),h=0;h<i;h++)p=u[n][h+1],d=u[n][h],T=this.vertices.length-1,m=new THREE.Vector3(0,-1,0),g=new THREE.Vector3(0,-1,0),R=new THREE.Vector3(0,-1,0),v=E[n][h+1].clone(),H=E[n][h].clone(),x=new THREE.Vector2(H.x,1),this.faces.push(new THREE.Face3(p,d,T,[m,g,R])),this.faceVertexUvs[0].push([v,H,x]);this.computeFaceNormals()},THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry,THREE.ExtrudeGeometry=function(t,e){void 0!==t&&(THREE.Geometry.call(this),this.type="ExtrudeGeometry",t=t instanceof Array?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||THREE.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(r).add(t)}function i(t,e,r){var i=1,n=(i=t.x-e.x,t.y-e.y),o=r.x-t.x,a=r.y-t.y,s=i*i+n*n;if(1e-10<Math.abs(i*a-n*o)){var h=Math.sqrt(s),l=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/l-s)*a-(r.y+o/l-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,1e-10<i?1e-10<o&&(t=!0):i<-1e-10?o<-1e-10&&(t=!0):Math.sign(n)==Math.sign(a)&&(t=!0),t?(r=-n,t=i,i=Math.sqrt(s)):(r=i,t=n,i=Math.sqrt(s/2));return new THREE.Vector2(r/i,t/i)}function n(t,e){var r,i;for(N=t.length;0<=--N;){(i=(r=N)-1)<0&&(i=t.length-1);var n=0,o=g+2*f;for(n=0;n<o;n++){var a=(a=e+r+(s=z*n))+S,s=(s=e+i+s)+S,h=(h=e+i+(l=z*(n+1)))+S,l=(l=e+r+l)+S;M.faces.push(new THREE.Face3(a,s,l,null,null,H)),M.faces.push(new THREE.Face3(s,h,l,null,null,H)),a=x.generateSideWallUV(M,a,s,h,l),M.faceVertexUvs[0].push([a[0],a[1],a[3]]),M.faceVertexUvs[0].push([a[1],a[2],a[3]])}}}function o(t,e,r){M.vertices.push(new THREE.Vector3(t,e,r))}function a(t,e,r){t+=S,e+=S,r+=S,M.faces.push(new THREE.Face3(t,e,r,null,null,v)),t=x.generateTopUV(M,t,e,r),M.faceVertexUvs[0].push(t)}var s,h,l,c,u,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,R=e.extrudePath,y=!1,v=e.material,H=e.extrudeMaterial,x=void 0!==e.UVGenerator?e.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator;R&&(s=R.getSpacedPoints(g),m=!(y=!0),h=void 0!==e.frames?e.frames:new THREE.TubeGeometry.FrenetFrames(R,g,!1),l=new THREE.Vector3,c=new THREE.Vector3,u=new THREE.Vector3),m||(d=p=f=0);var b,_,w,M=this,S=this.vertices.length,A=(T=(R=t.extractPoints(T)).shape,R.holes);if(R=!THREE.Shape.Utils.isClockWise(T)){for(T=T.reverse(),_=0,w=A.length;_<w;_++)b=A[_],THREE.Shape.Utils.isClockWise(b)&&(A[_]=b.reverse());R=!1}var C=THREE.Shape.Utils.triangulateShape(T,A),L=T;for(_=0,w=A.length;_<w;_++)b=A[_],T=T.concat(b);var P,F,U,B,D,V,z=T.length,k=C.length,N=(R=[],0);for(P=(U=L.length)-1,F=N+1;N<U;N++,P++,F++)P===U&&(P=0),F===U&&(F=0),R[N]=i(L[N],L[P],L[F]);var O,G=[],I=R.concat();for(_=0,w=A.length;_<w;_++){for(b=A[_],O=[],N=0,P=(U=b.length)-1,F=N+1;N<U;N++,P++,F++)P===U&&(P=0),F===U&&(F=0),O[N]=i(b[N],b[P],b[F]);G.push(O),I=I.concat(O)}for(P=0;P<f;P++){for(B=p*(1-(U=P/f)),F=d*Math.sin(U*Math.PI/2),N=0,U=L.length;N<U;N++)o((D=r(L[N],R[N],F)).x,D.y,-B);for(_=0,w=A.length;_<w;_++)for(b=A[_],O=G[_],N=0,U=b.length;N<U;N++)o((D=r(b[N],O[N],F)).x,D.y,-B)}for(F=d,N=0;N<z;N++)D=m?r(T[N],I[N],F):T[N],y?(c.copy(h.normals[0]).multiplyScalar(D.x),l.copy(h.binormals[0]).multiplyScalar(D.y),u.copy(s[0]).add(c).add(l),o(u.x,u.y,u.z)):o(D.x,D.y,0);for(U=1;U<=g;U++)for(N=0;N<z;N++)D=m?r(T[N],I[N],F):T[N],y?(c.copy(h.normals[U]).multiplyScalar(D.x),l.copy(h.binormals[U]).multiplyScalar(D.y),u.copy(s[U]).add(c).add(l),o(u.x,u.y,u.z)):o(D.x,D.y,E/g*U);for(P=f-1;0<=P;P--){for(B=p*(1-(U=P/f)),F=d*Math.sin(U*Math.PI/2),N=0,U=L.length;N<U;N++)o((D=r(L[N],R[N],F)).x,D.y,E+B);for(_=0,w=A.length;_<w;_++)for(b=A[_],O=G[_],N=0,U=b.length;N<U;N++)D=r(b[N],O[N],F),y?o(D.x,D.y+s[g-1].y,s[g-1].x+B):o(D.x,D.y,E+B)}!function(){if(m){var t;for(t=0*z,N=0;N<k;N++)a((V=C[N])[2]+t,V[1]+t,V[0]+t);for(t=g+2*f,t*=z,N=0;N<k;N++)a((V=C[N])[0]+t,V[1]+t,V[2]+t)}else{for(N=0;N<k;N++)a((V=C[N])[2],V[1],V[0]);for(N=0;N<k;N++)a((V=C[N])[0]+z*g,V[1]+z*g,V[2]+z*g)}}(),function(){var t=0;for(n(L,t),t+=L.length,_=0,w=A.length;_<w;_++)n(b=A[_],t),t+=b.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")==t instanceof Array&&(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,o=e.material,a=void 0===e.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:e.UVGenerator,s=this.vertices.length,h=(r=t.extractPoints(void 0!==e.curveSegments?e.curveSegments:12)).shape,l=r.holes;if(!THREE.Shape.Utils.isClockWise(h))for(h=h.reverse(),r=0,i=l.length;r<i;r++)n=l[r],THREE.Shape.Utils.isClockWise(n)&&(l[r]=n.reverse());var c=THREE.Shape.Utils.triangulateShape(h,l);for(r=0,i=l.length;r<i;r++)n=l[r],h=h.concat(n);for(l=h.length,i=c.length,r=0;r<l;r++)n=h[r],this.vertices.push(new THREE.Vector3(n.x,n.y,0));for(r=0;r<i;r++)h=(l=c[r])[0]+s,n=l[1]+s,l=l[2]+s,this.faces.push(new THREE.Face3(h,n,l,null,null,o)),this.faceVertexUvs[0].push(a.generateTopUV(this,h,n,l))},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,l=Math.cos(h),c=Math.sin(h),u=(h=0,t.length);h<u;h++){var E=t[h];(p=new THREE.Vector3).x=l*E.x-c*E.y,p.y=c*E.x+l*E.y,p.z=E.z,this.vertices.push(p)}for(r=t.length,a=0,s=e;a<s;a++)for(h=0,u=t.length-1;h<u;h++){e=c=h+r*a,i=c+r;l=c+1+r,c=c+1;var p,d=(E=a*o)+o,f=(p=h*n)+n;this.faces.push(new THREE.Face3(e,i,c)),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,l,c)),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){console.info("THREE.PlaneGeometry: Consider using THREE.PlaneBufferGeometry for lower memory footprint."),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.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=r||1)+1,s=(i=i||1)+1,h=t/r,l=e/i;e=new Float32Array(a*s*3),t=new Float32Array(a*s*3);for(var c=new Float32Array(a*s*2),u=0,E=0,p=0;p<s;p++)for(var d=p*l-o,f=0;f<a;f++)e[u]=f*h-n,e[u+1]=-d,t[u+2]=1,c[E]=f/r,c[E+1]=1-p/i,u+=3,E+=2;for(u=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[u]=f+a*p,n[u+1]=o,n[u+2]=h,n[u+3]=o,n[u+4]=s,n[u+5]=h,u+=6;this.addAttribute("index",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(c,2))},THREE.PlaneBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.PlaneBufferGeometry.prototype.constructor=THREE.PlaneBufferGeometry,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,l=(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 c=new THREE.Vector3,u=n+a/r*o;c.x=h*Math.cos(u),c.y=h*Math.sin(u),this.vertices.push(c),s.push(new THREE.Vector2((c.x/e+1)/2,(c.y/e+1)/2))}h+=l}for(e=new THREE.Vector3(0,0,1),t=0;t<i;t++)for(n=t*(r+1),a=0;a<r;a++)o=u=a+n,l=u+r+1,c=u+r+2,this.faces.push(new THREE.Face3(o,l,c,[e.clone(),e.clone(),e.clone()])),this.faceVertexUvs[0].push([s[o].clone(),s[l].clone(),s[c].clone()]),l=(o=u)+r+2,c=u+1,this.faces.push(new THREE.Face3(o,l,c,[e.clone(),e.clone(),e.clone()])),this.faceVertexUvs[0].push([s[o].clone(),s[l].clone(),s[c].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.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},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,o=void 0!==o?o:0,a=void 0!==a?a:Math.PI;var s,h,l=[],c=[];for(h=0;h<=r;h++){var u=[],E=[];for(s=0;s<=e;s++){var p=s/e,d=h/r;(f=new THREE.Vector3).x=-t*Math.cos(i+p*n)*Math.sin(o+d*a),f.y=t*Math.cos(o+d*a),f.z=t*Math.sin(i+p*n)*Math.sin(o+d*a),this.vertices.push(f),u.push(this.vertices.length-1),E.push(new THREE.Vector2(p,1-d))}l.push(u),c.push(E)}for(h=0;h<r;h++)for(s=0;s<e;s++){i=l[h][s+1],n=l[h][s],o=l[h+1][s],a=l[h+1][s+1];u=this.vertices[i].clone().normalize(),E=this.vertices[n].clone().normalize(),p=this.vertices[o].clone().normalize(),d=this.vertices[a].clone().normalize();var f=c[h][s+1].clone(),m=c[h][s].clone(),T=c[h+1][s].clone(),g=c[h+1][s+1].clone();Math.abs(this.vertices[i].y)===t?(f.x=(f.x+m.x)/2,this.faces.push(new THREE.Face3(i,o,a,[u,p,d])),this.faceVertexUvs[0].push([f,T,g])):Math.abs(this.vertices[o].y)===t?(T.x=(T.x+g.x)/2,this.faces.push(new THREE.Face3(i,n,o,[u,E,p])),this.faceVertexUvs[0].push([f,m,T])):(this.faces.push(new THREE.Face3(i,n,a,[u,E,d])),this.faceVertexUvs[0].push([f,m,g]),this.faces.push(new THREE.Face3(n,o,a,[E.clone(),p,d.clone()])),this.faceVertexUvs[0].push([m.clone(),T,g.clone()]))}this.computeFaceNormals(),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,t)},THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry,THREE.TextGeometry=function(t,e){e=e||{};var r=THREE.FontUtils.generateShapes(t,e);e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),THREE.ExtrudeGeometry.call(this,r,e),this.type="TextGeometry"},THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype),THREE.TextGeometry.prototype.constructor=THREE.TextGeometry,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 l=0;l<=i;l++){var c=l/i*n,u=h/r*Math.PI*2;o.x=t*Math.cos(c),o.y=t*Math.sin(c);var E=new THREE.Vector3;E.x=(t+e*Math.cos(u))*Math.cos(c),E.y=(t+e*Math.cos(u))*Math.sin(c),E.z=e*Math.sin(u),this.vertices.push(E),a.push(new THREE.Vector2(l/i,h/r)),s.push(E.clone().sub(o).normalize())}for(h=1;h<=r;h++)for(l=1;l<=i;l++)t=(i+1)*h+l-1,e=(i+1)*(h-1)+l-1,n=(i+1)*(h-1)+l,o=(i+1)*h+l,c=new THREE.Face3(t,e,o,[s[t].clone(),s[e].clone(),s[o].clone()]),this.faces.push(c),this.faceVertexUvs[0].push([a[t].clone(),a[e].clone(),a[o].clone()]),c=new THREE.Face3(e,n,o,[s[e].clone(),s[n].clone(),s[o].clone()]),this.faces.push(c),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.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),l=new THREE.Vector3,c=new THREE.Vector3,u=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(l.subVectors(d,p),c.addVectors(d,p),u.crossVectors(l,c),c.crossVectors(u,l),u.normalize(),c.normalize(),d=0;d<i;++d){var f=d/i*2*Math.PI,m=-e*Math.cos(f),T=(f=e*Math.sin(f),new THREE.Vector3);T.x=p.x+m*c.x+f*u.x,T.y=p.y+m*c.y+f*u.y,T.z=p.z+m*c.z+f*u.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),l=new THREE.Vector2((E+1)/r,d/i),c=new THREE.Vector2((E+1)/r,(d+1)/i),u=new THREE.Vector2(E/r,(d+1)/i),this.faces.push(new THREE.Face3(t,e,o)),this.faceVertexUvs[0].push([a,l,u]),this.faces.push(new THREE.Face3(e,n,o)),this.faceVertexUvs[0].push([l.clone(),c,u.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry,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},e=e||64,r=r||1,i=i||8,n=n||!1,o=o||THREE.TubeGeometry.NoTaper;var a,s,h,l,c,u,E,p,d,f,m=[],T=e+1,g=new THREE.Vector3;for(d=(p=new THREE.TubeGeometry.FrenetFrames(t,e,n)).normals,f=p.binormals,this.tangents=p.tangents,this.normals=d,this.binormals=f,p=0;p<T;p++)for(m[p]=[],h=p/(T-1),E=t.getPointAt(h),a=d[p],s=f[p],c=r*o(h),h=0;h<i;h++)l=h/i*2*Math.PI,u=-c*Math.cos(l),l=c*Math.sin(l),g.copy(E),g.x+=u*a.x+l*s.x,g.y+=u*a.y+l*s.y,g.z+=u*a.z+l*s.z,m[p][h]=this.vertices.push(new THREE.Vector3(g.x,g.y,g.z))-1;for(p=0;p<e;p++)for(h=0;h<i;h++)o=n?(p+1)%e:p+1,T=(h+1)%i,t=m[p][h],r=m[o][h],o=m[o][T],T=m[p][T],g=new THREE.Vector2(p/e,h/i),d=new THREE.Vector2((p+1)/e,h/i),f=new THREE.Vector2((p+1)/e,(h+1)/i),a=new THREE.Vector2(p/e,(h+1)/i),this.faces.push(new THREE.Face3(t,r,T)),this.faceVertexUvs[0].push([g,d,a]),this.faces.push(new THREE.Face3(r,o,T)),this.faceVertexUvs[0].push([d.clone(),f,a.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry,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=[],l=[],c=new THREE.Vector3,u=new THREE.Matrix4;for(e+=1,this.tangents=s,this.normals=h,this.binormals=l,i=0;i<e;i++)n=i/(e-1),s[i]=t.getTangentAt(n),s[i].normalize();for(h[0]=new THREE.Vector3,l[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),c.crossVectors(s[0],a).normalize(),h[0].crossVectors(s[0],c),l[0].crossVectors(s[0],h[0]),i=1;i<e;i++)h[i]=h[i-1].clone(),l[i]=l[i-1].clone(),c.crossVectors(s[i-1],s[i]),1e-4<c.length()&&(c.normalize(),a=Math.acos(THREE.Math.clamp(s[i-1].dot(s[i]),-1,1)),h[i].applyMatrix4(u.makeRotationAxis(c,a))),l[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(c.crossVectors(h[0],h[e-1]))&&(a=-a),i=1;i<e;i++)h[i].applyMatrix4(u.makeRotationAxis(s[i],a*i)),l[i].crossVectors(s[i],h[i])},THREE.PolyhedronGeometry=function(t,e,r,i){function E(t){var e=t.normalize().clone();e.index=d.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 p(t,e,r){var i=new THREE.Face3(t.index,e.index,r.index,[t.clone(),e.clone(),r.clone()]);d.faces.push(i),m.copy(t).add(e).add(r).divideScalar(3),i=Math.atan2(m.z,-m.x),d.faceVertexUvs[0].push([o(t.uv,t,i),o(e.uv,e,i),o(r.uv,r,i)])}function n(t,e){for(var r=Math.pow(2,e),i=E(d.vertices[t.a]),n=E(d.vertices[t.b]),o=E(d.vertices[t.c]),a=[],s=0;s<=r;s++){a[s]=[];for(var h=E(i.clone().lerp(o,s/r)),l=E(n.clone().lerp(o,s/r)),c=r-s,u=0;u<=c;u++)a[s][u]=0==u&&s==r?h:E(h.clone().lerp(l,u/c))}for(s=0;s<r;s++)for(u=0;u<2*(r-s)-1;u++)i=Math.floor(u/2),0==u%2?p(a[s][i+1],a[s+1][i],a[s][i]):p(a[s][i+1],a[s+1][i+1],a[s+1][i])}function o(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 d=this,a=0,s=t.length;a<s;a+=3)E(new THREE.Vector3(t[a],t[a+1],t[a+2]));t=this.vertices;var h=[],l=a=0;for(s=e.length;a<s;a+=3,l++){var c=t[e[a]],u=t[e[a+1]],f=t[e[a+2]];h[l]=new THREE.Face3(c.index,u.index,f.index,[c.clone(),u.clone(),f.clone()])}var m=new THREE.Vector3;for(a=0,s=h.length;a<s;a++)n(h[a],i);for(a=0,s=this.faceVertexUvs[0].length;a<s;a++)i=(e=this.faceVertexUvs[0][a])[0].x,t=e[1].x,h=e[2].x,l=Math.max(i,Math.max(t,h)),c=Math.min(i,Math.min(t,h)),.9<l&&c<.1&&(i<.2&&(e[0].x+=1),t<.2&&(e[1].x+=1),h<.2&&(e[2].x+=1));for(a=0,s=this.vertices.length;a<s;a++)this.vertices[a].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.DodecahedronGeometry=function(t,e){this.parameters={radius:t,detail: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)},THREE.DodecahedronGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.DodecahedronGeometry.prototype.constructor=THREE.DodecahedronGeometry,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.Geometry.prototype),THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry,THREE.OctahedronGeometry=function(t,e){this.parameters={radius:t,detail: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.Geometry.prototype),THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry,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.Geometry.prototype),THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry,THREE.ParametricGeometry=function(t,e,r){THREE.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:r};var i,n,o,a,s,h,l,c,u=this.vertices,E=this.faces,p=this.faceVertexUvs[0],d=e+1;for(i=0;i<=r;i++)for(a=i/r,n=0;n<=e;n++)o=t(o=n/e,a),u.push(o);for(i=0;i<r;i++)for(n=0;n<e;n++)u=(t=i*d+n)+1,a=(i+1)*d+n+1,o=(i+1)*d+n,s=new THREE.Vector2(n/e,i/r),h=new THREE.Vector2((n+1)/e,i/r),l=new THREE.Vector2((n+1)/e,(i+1)/r),c=new THREE.Vector2(n/e,(i+1)/r),E.push(new THREE.Face3(t,u,o)),p.push([s,h,c]),E.push(new THREE.Face3(u,a,o)),p.push([h.clone(),l,c.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ParametricGeometry.prototype.constructor=THREE.ParametricGeometry,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.Line.call(this,t,e,THREE.LinePieces)},THREE.AxisHelper.prototype=Object.create(THREE.Line.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.applyMatrix((new THREE.Matrix4).makeTranslation(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),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),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){this.line.material.color.set(t),this.cone.material.color.set(t)},THREE.BoxHelper=function(t){var e=new THREE.BufferGeometry;e.addAttribute("position",new THREE.BufferAttribute(new Float32Array(72),3)),THREE.Line.call(this,e,new THREE.LineBasicMaterial({color:16776960}),THREE.LinePieces),void 0!==t&&this.update(t)},THREE.BoxHelper.prototype=Object.create(THREE.Line.prototype),THREE.BoxHelper.prototype.constructor=THREE.BoxHelper,THREE.BoxHelper.prototype.update=function(t){null===(r=t.geometry).boundingBox&&r.computeBoundingBox();var e=r.boundingBox.min,r=r.boundingBox.max,i=this.geometry.attributes.position.array;i[0]=r.x,i[1]=r.y,i[2]=r.z,i[3]=e.x,i[4]=r.y,i[5]=r.z,i[6]=e.x,i[7]=r.y,i[8]=r.z,i[9]=e.x,i[10]=e.y,i[11]=r.z,i[12]=e.x,i[13]=e.y,i[14]=r.z,i[15]=r.x,i[16]=e.y,i[17]=r.z,i[18]=r.x,i[19]=e.y,i[20]=r.z,i[21]=r.x,i[22]=r.y,i[23]=r.z,i[24]=r.x,i[25]=r.y,i[26]=e.z,i[27]=e.x,i[28]=r.y,i[29]=e.z,i[30]=e.x,i[31]=r.y,i[32]=e.z,i[33]=e.x,i[34]=e.y,i[35]=e.z,i[36]=e.x,i[37]=e.y,i[38]=e.z,i[39]=r.x,i[40]=e.y,i[41]=e.z,i[42]=r.x,i[43]=e.y,i[44]=e.z,i[45]=r.x,i[46]=r.y,i[47]=e.z,i[48]=r.x,i[49]=r.y,i[50]=r.z,i[51]=r.x,i[52]=r.y,i[53]=e.z,i[54]=e.x,i[55]=r.y,i[56]=r.z,i[57]=e.x,i[58]=r.y,i[59]=e.z,i[60]=e.x,i[61]=e.y,i[62]=r.z,i[63]=e.x,i[64]=e.y,i[65]=e.z,i[66]=r.x,i[67]=e.y,i[68]=r.z,i[69]=r.x,i[70]=e.y,i[71]=e.z,this.geometry.attributes.position.needsUpdate=!0,this.geometry.computeBoundingSphere(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},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.Line.call(this,r,n,THREE.LinePieces),this.camera=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()},THREE.CameraHelper.prototype=Object.create(THREE.Line.prototype),THREE.CameraHelper.prototype.constructor=THREE.CameraHelper,THREE.CameraHelper.prototype.update=function(){var n,o,a=new THREE.Vector3,s=new THREE.Camera,t=function(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)};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,r=Math.cos(THREE.Math.degToRad(void 0!==r?r:1));var i,n=[0,0],o={},a=function(t,e){return t-e},s=["a","b","c"],h=new THREE.BufferGeometry;t.geometry instanceof THREE.BufferGeometry?(i=new THREE.Geometry).fromBufferGeometry(t.geometry):i=t.geometry.clone(),i.mergeVertices(),i.computeFaceNormals();for(var l=i.vertices,c=0,u=0,E=(i=i.faces).length;u<E;u++)for(var p=i[u],d=0;d<3;d++){n[0]=p[s[d]],n[1]=p[s[(d+1)%3]],n.sort(a);var f=n.toString();void 0===o[f]?(o[f]={vert1:n[0],vert2:n[1],face1:u,face2:void 0},c++):o[f].face2=u}for(f in n=new Float32Array(6*c),a=0,o)(void 0===(s=o[f]).face2||i[s.face1].normal.dot(i[s.face2].normal)<=r)&&(c=l[s.vert1],n[a++]=c.x,n[a++]=c.y,n[a++]=c.z,c=l[s.vert2],n[a++]=c.x,n[a++]=c.y,n[a++]=c.z);h.addAttribute("position",new THREE.BufferAttribute(n,3)),THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:e}),THREE.LinePieces),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},THREE.EdgesHelper.prototype=Object.create(THREE.Line.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=new THREE.Geometry,r=0;for(var n=this.object.geometry.faces.length;r<n;r++)e.vertices.push(new THREE.Vector3,new THREE.Vector3);THREE.Line.call(this,e,new THREE.LineBasicMaterial({color:t,linewidth:i}),THREE.LinePieces),this.matrixAutoUpdate=!1,this.normalMatrix=new THREE.Matrix3,this.update()},THREE.FaceNormalsHelper.prototype=Object.create(THREE.Line.prototype),THREE.FaceNormalsHelper.prototype.constructor=THREE.FaceNormalsHelper,THREE.FaceNormalsHelper.prototype.update=function(){var t=this.geometry.vertices,e=this.object,r=e.geometry.vertices,i=e.geometry.faces,n=e.matrixWorld;e.updateMatrixWorld(!0),this.normalMatrix.getNormalMatrix(n);for(var o=e=0,a=i.length;e<a;e++,o+=2){var s=i[e];t[o].copy(r[s.a]).add(r[s.b]).add(r[s.c]).divideScalar(3).applyMatrix4(n),t[o+1].copy(s.normal).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size).add(t[o])}return this.geometry.verticesNeedUpdate=!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.Line.call(this,r,i,THREE.LinePieces)},THREE.GridHelper.prototype=Object.create(THREE.Line.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.applyMatrix((new THREE.Matrix4).makeRotationX(-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)));r=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0}),THREE.Line.call(this,e,r,THREE.LinePieces),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()},THREE.SkeletonHelper.prototype=Object.create(THREE.Line.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)).applyMatrix((new THREE.Matrix4).makeTranslation(0,-.5,0)),t.applyMatrix((new THREE.Matrix4).makeRotationX(-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,e=void 0!==r?r:16711680,i=void 0!==i?i:1,r=new THREE.Geometry;for(var n=0,o=(t=t.geometry.faces).length;n<o;n++)for(var a=0,s=t[n].vertexNormals.length;a<s;a++)r.vertices.push(new THREE.Vector3,new THREE.Vector3);THREE.Line.call(this,r,new THREE.LineBasicMaterial({color:e,linewidth:i}),THREE.LinePieces),this.matrixAutoUpdate=!1,this.normalMatrix=new THREE.Matrix3,this.update()},THREE.VertexNormalsHelper.prototype=Object.create(THREE.Line.prototype),THREE.VertexNormalsHelper.prototype.constructor=THREE.VertexNormalsHelper,THREE.VertexNormalsHelper.prototype.update=function(t){var E=new THREE.Vector3;return function(t){t=["a","b","c","d"],this.object.updateMatrixWorld(!0),this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var e=this.geometry.vertices,r=this.object.geometry.vertices,i=this.object.geometry.faces,n=this.object.matrixWorld,o=0,a=0,s=i.length;a<s;a++)for(var h=i[a],l=0,c=h.vertexNormals.length;l<c;l++){var u=h.vertexNormals[l];e[o].copy(r[h[t[l]]]).applyMatrix4(n),E.copy(u).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size),E.add(e[o]),e[o+=1].copy(E),o+=1}return this.geometry.verticesNeedUpdate=!0,this}}(),THREE.VertexTangentsHelper=function(t,e,r,i){this.object=t,this.size=void 0!==e?e:1,e=void 0!==r?r:255,i=void 0!==i?i:1,r=new THREE.Geometry;for(var n=0,o=(t=t.geometry.faces).length;n<o;n++)for(var a=0,s=t[n].vertexTangents.length;a<s;a++)r.vertices.push(new THREE.Vector3),r.vertices.push(new THREE.Vector3);THREE.Line.call(this,r,new THREE.LineBasicMaterial({color:e,linewidth:i}),THREE.LinePieces),this.matrixAutoUpdate=!1,this.update()},THREE.VertexTangentsHelper.prototype=Object.create(THREE.Line.prototype),THREE.VertexTangentsHelper.prototype.constructor=THREE.VertexTangentsHelper,THREE.VertexTangentsHelper.prototype.update=function(t){var E=new THREE.Vector3;return function(t){t=["a","b","c","d"],this.object.updateMatrixWorld(!0);for(var e=this.geometry.vertices,r=this.object.geometry.vertices,i=this.object.geometry.faces,n=this.object.matrixWorld,o=0,a=0,s=i.length;a<s;a++)for(var h=i[a],l=0,c=h.vertexTangents.length;l<c;l++){var u=h.vertexTangents[l];e[o].copy(r[h[t[l]]]).applyMatrix4(n),E.copy(u).transformDirection(n).multiplyScalar(this.size),E.add(e[o]),e[o+=1].copy(E),o+=1}return this.geometry.verticesNeedUpdate=!0,this}}(),THREE.WireframeHelper=function(t,e){var r=void 0!==e?e:16777215,i=[0,0],n={},o=function(t,e){return t-e},a=["a","b","c"],s=new THREE.BufferGeometry;if(t.geometry instanceof THREE.Geometry){for(var h=t.geometry.vertices,l=t.geometry.faces,c=0,u=new Uint32Array(6*l.length),E=0,p=l.length;E<p;E++)for(var d=l[E],f=0;f<3;f++){i[0]=d[a[f]],i[1]=d[a[(f+1)%3]],i.sort(o),void 0===n[T=i.toString()]&&(u[2*c]=i[0],u[2*c+1]=i[1],n[T]=!0,c++)}for(i=new Float32Array(6*c),E=0,p=c;E<p;E++)for(f=0;f<2;f++)c=h[u[2*E+f]],i[(a=6*E+3*f)+0]=c.x,i[a+1]=c.y,i[a+2]=c.z;s.addAttribute("position",new THREE.BufferAttribute(i,3))}else if(t.geometry instanceof THREE.BufferGeometry){if(void 0!==t.geometry.attributes.index){h=t.geometry.attributes.position.array,p=t.geometry.attributes.index.array,(c=0)===(l=t.geometry.drawcalls).length&&(l=[{count:p.length,index:0,start:0}]);u=new Uint32Array(2*p.length),d=0;for(var m=l.length;d<m;++d){f=l[d].start;for(var T=l[d].count,g=(a=l[d].index,E=f,f+T);E<g;E+=3)for(f=0;f<3;f++)i[0]=a+p[E+f],i[1]=a+p[E+(f+1)%3],i.sort(o),void 0===n[T=i.toString()]&&(u[2*c]=i[0],u[2*c+1]=i[1],n[T]=!0,c++)}for(i=new Float32Array(6*c),E=0,p=c;E<p;E++)for(f=0;f<2;f++)a=6*E+3*f,c=3*u[2*E+f],i[a+0]=h[c],i[a+1]=h[c+1],i[a+2]=h[c+2]}else for(u=(c=(h=t.geometry.attributes.position.array).length/3)/3,i=new Float32Array(6*c),E=0,p=u;E<p;E++)for(f=0;f<3;f++)u=9*E+3*f,i[(a=18*E+6*f)+0]=h[u],i[a+1]=h[u+1],i[a+2]=h[u+2],c=9*E+(f+1)%3*3,i[a+3]=h[c],i[a+4]=h[c+1],i[a+5]=h[c+2];s.addAttribute("position",new THREE.BufferAttribute(i,3))}THREE.Line.call(this,s,new THREE.LineBasicMaterial({color:r}),THREE.LinePieces),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},THREE.WireframeHelper.prototype=Object.create(THREE.Line.prototype),THREE.WireframeHelper.prototype.constructor=THREE.WireframeHelper,THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this),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/1),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={startFrame:e,endFrame: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=n.morphTargets[o].name.match(r);if(s&&1<s.length){var h=s[1];i[h]||(i[h]={start:1/0,end:-1/0}),o<(s=i[h]).start&&(s.start=o),o>s.end&&(s.end=o),e||(e=h)}}for(h in i)s=i[h],this.createAnimation(h,s.start,s.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):THREE.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=this.animationsList[e];if(i.active){var n=i.duration/i.length;i.time+=i.direction*t,i.mirroredLoop?(i.time>i.duration||i.time<0)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),i.time<0&&(i.time=0,i.directionBackwards=!1)):(i.time%=i.duration,i.time<0&&(i.time+=i.duration));var o=i.startFrame+THREE.Math.clamp(Math.floor(i.time/n),0,i.length-1),a=i.weight;o!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*a,this.morphTargetInfluences[o]=0,i.lastFrame=i.currentFrame,i.currentFrame=o),n=i.time%n/n,i.directionBackwards&&(n=1-n),this.morphTargetInfluences[i.currentFrame]=n*a,this.morphTargetInfluences[i.lastFrame]=(1-n)*a}}};