WebGL experience

HTML
<div id="canvas"></div>
CSS
body { margin: 0px; background-color: #000000; overflow: hidden; } div { position: absolute; margin: 0px; padding: 0; width: 100%; }
JAVASCRIPT
"use strict";var THREE={REVISION:"76"};"function"==typeof define&&define.amd?define("three",THREE):"undefined"!=typeof exports&&"undefined"!=typeof module&&(module.exports=THREE),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(e){return 0>e?-1:e>0?1:+e}),void 0===Function.prototype.name&&void 0!==Object.defineProperty&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&Object.defineProperty(Object,"assign",{writable:!0,configurable:!0,value:function(e){if(void 0===e||null===e)throw new TypeError("Cannot convert first argument to object");for(var t=Object(e),r=1,i=arguments.length;r!==i;++r){var n=arguments[r];if(void 0!==n&&null!==n)for(var n=Object(n),o=Object.keys(n),a=0,s=o.length;a!==s;++a){var c=o[a],h=Object.getOwnPropertyDescriptor(n,c);void 0!==h&&h.enumerable&&(t[c]=n[c])}}return t}}),THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},THREE.CullFaceNone=0,THREE.CullFaceBack=1,THREE.CullFaceFront=2,THREE.CullFaceFrontBack=3,THREE.FrontFaceDirectionCW=0,THREE.FrontFaceDirectionCCW=1,THREE.BasicShadowMap=0,THREE.PCFShadowMap=1,THREE.PCFSoftShadowMap=2,THREE.FrontSide=0,THREE.BackSide=1,THREE.DoubleSide=2,THREE.FlatShading=1,THREE.SmoothShading=2,THREE.NoColors=0,THREE.FaceColors=1,THREE.VertexColors=2,THREE.NoBlending=0,THREE.NormalBlending=1,THREE.AdditiveBlending=2,THREE.SubtractiveBlending=3,THREE.MultiplyBlending=4,THREE.CustomBlending=5,THREE.AddEquation=100,THREE.SubtractEquation=101,THREE.ReverseSubtractEquation=102,THREE.MinEquation=103,THREE.MaxEquation=104,THREE.ZeroFactor=200,THREE.OneFactor=201,THREE.SrcColorFactor=202,THREE.OneMinusSrcColorFactor=203,THREE.SrcAlphaFactor=204,THREE.OneMinusSrcAlphaFactor=205,THREE.DstAlphaFactor=206,THREE.OneMinusDstAlphaFactor=207,THREE.DstColorFactor=208,THREE.OneMinusDstColorFactor=209,THREE.SrcAlphaSaturateFactor=210,THREE.NeverDepth=0,THREE.AlwaysDepth=1,THREE.LessDepth=2,THREE.LessEqualDepth=3,THREE.EqualDepth=4,THREE.GreaterEqualDepth=5,THREE.GreaterDepth=6,THREE.NotEqualDepth=7,THREE.MultiplyOperation=0,THREE.MixOperation=1,THREE.AddOperation=2,THREE.NoToneMapping=0,THREE.LinearToneMapping=1,THREE.ReinhardToneMapping=2,THREE.Uncharted2ToneMapping=3,THREE.CineonToneMapping=4,THREE.UVMapping=300,THREE.CubeReflectionMapping=301,THREE.CubeRefractionMapping=302,THREE.EquirectangularReflectionMapping=303,THREE.EquirectangularRefractionMapping=304,THREE.SphericalReflectionMapping=305,THREE.CubeUVReflectionMapping=306,THREE.CubeUVRefractionMapping=307,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.DepthFormat=1026,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.RGB_ETC1_Format=2151,THREE.LoopOnce=2200,THREE.LoopRepeat=2201,THREE.LoopPingPong=2202,THREE.InterpolateDiscrete=2300,THREE.InterpolateLinear=2301,THREE.InterpolateSmooth=2302,THREE.ZeroCurvatureEnding=2400,THREE.ZeroSlopeEnding=2401,THREE.WrapAroundEnding=2402,THREE.TrianglesDrawMode=0,THREE.TriangleStripDrawMode=1,THREE.TriangleFanDrawMode=2,THREE.LinearEncoding=3e3,THREE.sRGBEncoding=3001,THREE.GammaEncoding=3007,THREE.RGBEEncoding=3002,THREE.LogLuvEncoding=3003,THREE.RGBM7Encoding=3004,THREE.RGBM16Encoding=3005,THREE.RGBDEncoding=3006,THREE.BasicDepthPacking=3200,THREE.RGBADepthPacking=3201,THREE.Color=function(e){return 3===arguments.length?this.fromArray(arguments):this.set(e)},THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(e){return e instanceof THREE.Color?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){this.b=this.g=this.r=e},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,r){return this.r=e,this.g=t,this.b=r,this},setHSL:function(){function e(e,t,r){return 0>r&&(r+=1),r>1&&(r-=1),1/6>r?e+6*(t-e)*r:.5>r?t:2/3>r?e+6*(t-e)*(2/3-r):e}return function(t,r,i){return t=THREE.Math.euclideanModulo(t,1),r=THREE.Math.clamp(r,0,1),i=THREE.Math.clamp(i,0,1),0===r?this.r=this.g=this.b=i:(r=.5>=i?i*(1+r):i+r-i*r,i=2*i-r,this.r=e(i,r,t+1/3),this.g=e(i,r,t),this.b=e(i,r,t-1/3)),this}}(),setStyle:function(e){function t(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i=r[2];switch(r[1]){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,t(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,t(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i)){var i=parseFloat(r[1])/360,n=parseInt(r[2],10)/100,o=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(i,n,o)}}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(e)){if(r=r[1],i=r.length,3===i)return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,this;if(6===i)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,this}return e&&0<e.length&&(r=THREE.ColorKeywords[e],void 0!==r?this.setHex(r):console.warn("THREE.Color: Unknown color "+e)),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var r=t>0?1/t:1;return this.r=Math.pow(e.r,r),this.g=Math.pow(e.g,r),this.b=Math.pow(e.b,r),this},convertGammaToLinear:function(){var e=this.r,t=this.g,r=this.b;return this.r=e*e,this.g=t*t,this.b=r*r,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){e=e||{h:0,s:0,l:0};var t,r=this.r,i=this.g,n=this.b,o=Math.max(r,i,n),a=Math.min(r,i,n),s=(a+o)/2;if(a===o)a=t=0;else{var c=o-a,a=.5>=s?c/(o+a):c/(2-o-a);switch(o){case r:t=(i-n)/c+(n>i?6:0);break;case i:t=(n-r)/c+2;break;case n:t=(r-i)/c+4}t/=6}return e.h=t,e.s=a,e.l=s,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,r){var i=this.getHSL();return i.h+=e,i.s+=t,i.l+=r,this.setHSL(i.h,i.s,i.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},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(e,t,r,i){this._x=e||0,this._y=t||0,this._z=r||0,this._w=void 0!==i?i:1},THREE.Quaternion.prototype={constructor:THREE.Quaternion,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!1==e instanceof THREE.Euler)throw Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var r=Math.cos(e._x/2),i=Math.cos(e._y/2),n=Math.cos(e._z/2),o=Math.sin(e._x/2),a=Math.sin(e._y/2),s=Math.sin(e._z/2),c=e.order;return"XYZ"===c?(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"===c?(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"===c?(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"===c?(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"===c?(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"===c&&(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!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t=e.elements,r=t[0];e=t[4];var i=t[8],n=t[1],o=t[5],a=t[9],s=t[2],c=t[6],t=t[10],h=r+o+t;return h>0?(r=.5/Math.sqrt(h+1),this._w=.25/r,this._x=(c-a)*r,this._y=(i-s)*r,this._z=(n-e)*r):r>o&&r>t?(r=2*Math.sqrt(1+r-o-t),this._w=(c-a)/r,this._x=.25*r,this._y=(e+n)/r,this._z=(i+s)/r):o>t?(r=2*Math.sqrt(1+o-r-t),this._w=(i-s)/r,this._x=(e+n)/r,this._y=.25*r,this._z=(a+c)/r):(r=2*Math.sqrt(1+t-r-o),this._w=(n-e)/r,this._x=(i+s)/r,this._y=(a+c)/r,this._z=.25*r),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t;return function(r,i){return void 0===e&&(e=new THREE.Vector3),t=r.dot(i)+1,1e-6>t?(t=0,Math.abs(r.x)>Math.abs(r.z)?e.set(-r.y,r.x,0):e.set(0,-r.z,r.y)):e.crossVectors(r,i),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize(),this}}(),inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._z=this._y=this._x=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},multiplyQuaternions:function(e,t){var r=e._x,i=e._y,n=e._z,o=e._w,a=t._x,s=t._y,c=t._z,h=t._w;return this._x=r*h+o*a+i*c-n*s,this._y=i*h+o*s+n*a-r*c,this._z=n*h+o*c+r*s-i*a,this._w=o*h-r*a-i*s-n*c,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,i=this._y,n=this._z,o=this._w,a=o*e._w+r*e._x+i*e._y+n*e._z;if(0>a?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=n,this;var s=Math.sqrt(1-a*a);if(.001>Math.abs(s))return this._w=.5*(o+this._w),this._x=.5*(r+this._x),this._y=.5*(i+this._y),this._z=.5*(n+this._z),this;var c=Math.atan2(s,a),a=Math.sin((1-t)*c)/s,s=Math.sin(t*c)/s;return 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(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},Object.assign(THREE.Quaternion,{slerp:function(e,t,r,i){return r.copy(e).slerp(t,i)},slerpFlat:function(e,t,r,i,n,o,a){var s=r[i+0],c=r[i+1],h=r[i+2];r=r[i+3],i=n[o+0];var l=n[o+1],u=n[o+2];if(n=n[o+3],r!==n||s!==i||c!==l||h!==u){o=1-a;var p=s*i+c*l+h*u+r*n,d=p>=0?1:-1,E=1-p*p;E>Number.EPSILON&&(E=Math.sqrt(E),p=Math.atan2(E,p*d),o=Math.sin(o*p)/E,a=Math.sin(a*p)/E),d*=a,s=s*o+i*d,c=c*o+l*d,h=h*o+u*d,r=r*o+n*d,o===1-a&&(a=1/Math.sqrt(s*s+c*c+h*h+r*r),s*=a,c*=a,h*=a,r*=a)}e[t]=s,e[t+1]=c,e[t+2]=h,e[t+3]=r}}),THREE.Vector2=function(e,t){this.x=e||0,this.y=t||0},THREE.Vector2.prototype={constructor:THREE.Vector2,get width(){return this.x},set width(e){this.x=e},get height(){return this.y},set height(e){this.y=e},set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.y=this.x=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e):this.y=this.x=0,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(){var e,t;return function(r,i){return void 0===e&&(e=new THREE.Vector2,t=new THREE.Vector2),e.set(r,r),t.set(i,i),this.clamp(e,t)}}(),clampLength:function(e,t){var r=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,r))/r),this},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var e=Math.atan2(this.y,this.x);return 0>e&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x;return e=this.y-e.y,t*t+e*e},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this},rotateAround:function(e,t){var r=Math.cos(t),i=Math.sin(t),n=this.x-e.x,o=this.y-e.y;return this.x=n*r-o*i+e.x,this.y=n*i+o*r+e.y,this}},THREE.Vector3=function(e,t,r){this.x=e||0,this.y=t||0,this.z=r||0},THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(e,t,r){return this.x=e,this.y=t,this.z=r,this},setScalar:function(e){return this.z=this.y=this.x=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):this.z=this.y=this.x=0,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e;return function(t){return!1==t instanceof THREE.Euler&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new THREE.Quaternion),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var e;return function(t,r){return void 0===e&&(e=new THREE.Quaternion),this.applyQuaternion(e.setFromAxisAngle(t,r)),this}}(),applyMatrix3:function(e){var t=this.x,r=this.y,i=this.z;return e=e.elements,this.x=e[0]*t+e[3]*r+e[6]*i,this.y=e[1]*t+e[4]*r+e[7]*i,this.z=e[2]*t+e[5]*r+e[8]*i,this},applyMatrix4:function(e){var t=this.x,r=this.y,i=this.z;return e=e.elements,this.x=e[0]*t+e[4]*r+e[8]*i+e[12],this.y=e[1]*t+e[5]*r+e[9]*i+e[13],this.z=e[2]*t+e[6]*r+e[10]*i+e[14],this},applyProjection:function(e){var t=this.x,r=this.y,i=this.z;e=e.elements;var n=1/(e[3]*t+e[7]*r+e[11]*i+e[15]);return this.x=(e[0]*t+e[4]*r+e[8]*i+e[12])*n,this.y=(e[1]*t+e[5]*r+e[9]*i+e[13])*n,this.z=(e[2]*t+e[6]*r+e[10]*i+e[14])*n,this},applyQuaternion:function(e){var t=this.x,r=this.y,i=this.z,n=e.x,o=e.y,a=e.z;e=e.w;var s=e*t+o*i-a*r,c=e*r+a*t-n*i,h=e*i+n*r-o*t,t=-n*t-o*r-a*i;return this.x=s*e+t*-n+c*-a-h*-o,this.y=c*e+t*-o+h*-n-s*-a,this.z=h*e+t*-a+s*-o-c*-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(e){var t=this.x,r=this.y,i=this.z;return e=e.elements,this.x=e[0]*t+e[4]*r+e[8]*i,this.y=e[1]*t+e[5]*r+e[9]*i,this.z=e[2]*t+e[6]*r+e[10]*i,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e,t;return function(r,i){return void 0===e&&(e=new THREE.Vector3,t=new THREE.Vector3),e.set(r,r,r),t.set(i,i,i),this.clamp(e,t)}}(),clampLength:function(e,t){var r=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,r))/r),this},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var r=this.x,i=this.y,n=this.z;return this.x=i*e.z-n*e.y,this.y=n*e.x-r*e.z,this.z=r*e.y-i*e.x,this},crossVectors:function(e,t){var r=e.x,i=e.y,n=e.z,o=t.x,a=t.y,s=t.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*o,this},projectOnVector:function(){var e,t;return function(r){return void 0===e&&(e=new THREE.Vector3),e.copy(r).normalize(),t=this.dot(e),this.copy(e).multiplyScalar(t)}}(),projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new 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(e){return e=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq()),Math.acos(THREE.Math.clamp(e,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y;return e=this.z-e.z,t*t+r*r+e*e},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromMatrixPosition:function(e){return this.setFromMatrixColumn(e,3)},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length();return e=this.setFromMatrixColumn(e,2).length(),this.x=t,this.y=r,this.z=e,this},setFromMatrixColumn:function(e,t){return"number"==typeof e&&(console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index )."),t=e=t),this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this}},THREE.Vector4=function(e,t,r,i){this.x=e||0,this.y=t||0,this.z=r||0,this.w=void 0!==i?i:1},THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this},setScalar:function(e){return this.w=this.z=this.y=this.x=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this.w*=e):this.w=this.z=this.y=this.x=0,this},applyMatrix4:function(e){var t=this.x,r=this.y,i=this.z,n=this.w;return e=e.elements,this.x=e[0]*t+e[4]*r+e[8]*i+e[12]*n,this.y=e[1]*t+e[5]*r+e[9]*i+e[13]*n,this.z=e[2]*t+e[6]*r+e[10]*i+e[14]*n,this.w=e[3]*t+e[7]*r+e[11]*i+e[15]*n,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return 1e-4>t?(this.x=1,this.z=this.y=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,r,i;e=e.elements;var n=e[0];i=e[4];var o=e[8],a=e[1],s=e[5],c=e[9];r=e[2],t=e[6];var h=e[10];return.01>Math.abs(i-a)&&.01>Math.abs(o-r)&&.01>Math.abs(c-t)?.1>Math.abs(i+a)&&.1>Math.abs(o+r)&&.1>Math.abs(c+t)&&.1>Math.abs(n+s+h-3)?(this.set(1,0,0,0),this):(e=Math.PI,n=(n+1)/2,s=(s+1)/2,h=(h+1)/2,i=(i+a)/4,o=(o+r)/4,c=(c+t)/4,n>s&&n>h?.01>n?(t=0,i=r=.707106781):(t=Math.sqrt(n),r=i/t,i=o/t):s>h?.01>s?(t=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),t=i/r,i=c/r):.01>h?(r=t=.707106781,i=0):(i=Math.sqrt(h),t=o/i,r=c/i),this.set(t,r,i,e),this):(e=Math.sqrt((t-c)*(t-c)+(o-r)*(o-r)+(a-i)*(a-i)),.001>Math.abs(e)&&(e=1),this.x=(t-c)/e,this.y=(o-r)/e,this.z=(a-i)/e,this.w=Math.acos((n+s+h-1)/2),this)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(){var e,t;return function(r,i){return void 0===e&&(e=new THREE.Vector4, t=new THREE.Vector4),e.set(r,r,r,r),t.set(i,i,i,i),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z),this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this}},THREE.Euler=function(e,t,r,i){this._x=e||0,this._y=t||0,this._z=r||0,this._order=i||THREE.Euler.DefaultOrder},THREE.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),THREE.Euler.DefaultOrder="XYZ",THREE.Euler.prototype={constructor:THREE.Euler,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,r){var i=THREE.Math.clamp,n=e.elements;e=n[0];var o=n[4],a=n[8],s=n[1],c=n[5],h=n[9],l=n[2],u=n[6],n=n[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(i(a,-1,1)),.99999>Math.abs(a)?(this._x=Math.atan2(-h,n),this._z=Math.atan2(-o,e)):(this._x=Math.atan2(u,c),this._z=0)):"YXZ"===t?(this._x=Math.asin(-i(h,-1,1)),.99999>Math.abs(h)?(this._y=Math.atan2(a,n),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-l,e),this._z=0)):"ZXY"===t?(this._x=Math.asin(i(u,-1,1)),.99999>Math.abs(u)?(this._y=Math.atan2(-l,n),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(s,e))):"ZYX"===t?(this._y=Math.asin(-i(l,-1,1)),.99999>Math.abs(l)?(this._x=Math.atan2(u,n),this._z=Math.atan2(s,e)):(this._x=0,this._z=Math.atan2(-o,c))):"YZX"===t?(this._z=Math.asin(i(s,-1,1)),.99999>Math.abs(s)?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-l,e)):(this._x=0,this._y=Math.atan2(a,n))):"XZY"===t?(this._z=Math.asin(-i(o,-1,1)),.99999>Math.abs(o)?(this._x=Math.atan2(u,c),this._y=Math.atan2(a,e)):(this._x=Math.atan2(-h,n),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,r,i){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,r,i),this}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new THREE.Quaternion;return function(t){e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new THREE.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},THREE.Line3=function(e,t){this.start=void 0!==e?e:new THREE.Vector3,this.end=void 0!==t?t:new THREE.Vector3},THREE.Line3.prototype={constructor:THREE.Line3,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},center:function(e){return(e||new THREE.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return(e||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(e,t){var r=t||new THREE.Vector3;return this.delta(r).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(r,i){e.subVectors(r,this.start),t.subVectors(this.end,this.start);var n=t.dot(t),n=t.dot(e)/n;return i&&(n=THREE.Math.clamp(n,0,1)),n}}(),closestPointToPoint:function(e,t,r){return e=this.closestPointToPointParameter(e,t),r=r||new THREE.Vector3,this.delta(r).multiplyScalar(e).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},THREE.Box2=function(e,t){this.min=void 0!==e?e:new THREE.Vector2(1/0,1/0),this.max=void 0!==t?t:new THREE.Vector2(-(1/0),-(1/0))},THREE.Box2.prototype={constructor:THREE.Box2,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;r>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new THREE.Vector2;return function(t,r){var i=e.copy(r).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-(1/0),this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(e){return(e||new THREE.Vector2).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){return(e||new THREE.Vector2).subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y?!0:!1},getParameter:function(e,t){return(t||new THREE.Vector2).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y?!1:!0},clampPoint:function(e,t){return(t||new THREE.Vector2).copy(e).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(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},THREE.Box3=function(e,t){this.min=void 0!==e?e:new THREE.Vector3(1/0,1/0,1/0),this.max=void 0!==t?t:new THREE.Vector3(-(1/0),-(1/0),-(1/0))},THREE.Box3.prototype={constructor:THREE.Box3,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,r=1/0,i=1/0,n=-(1/0),o=-(1/0),a=-(1/0),s=0,c=e.length;c>s;s+=3){var h=e[s],l=e[s+1],u=e[s+2];t>h&&(t=h),r>l&&(r=l),i>u&&(i=u),h>n&&(n=h),l>o&&(o=l),u>a&&(a=u)}this.min.set(t,r,i),this.max.set(n,o,a)},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;r>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new THREE.Vector3;return function(t,r){var i=e.copy(r).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}}(),setFromObject:function(){var e=new THREE.Vector3;return function(t){var r=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse(function(t){var i=t.geometry;if(void 0!==i)if(i instanceof THREE.Geometry)for(var n=i.vertices,i=0,o=n.length;o>i;i++)e.copy(n[i]),e.applyMatrix4(t.matrixWorld),r.expandByPoint(e);else if(i instanceof THREE.BufferGeometry&&void 0!==i.attributes.position)for(n=i.attributes.position.array,i=0,o=n.length;o>i;i+=3)e.fromArray(n,i),e.applyMatrix4(t.matrixWorld),r.expandByPoint(e)}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-(1/0),this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(e){return(e||new THREE.Vector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){return(e||new THREE.Vector3).subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z?!0:!1},getParameter:function(e,t){return(t||new THREE.Vector3).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z?!1:!0},intersectsSphere:function(){var e;return function(t){return void 0===e&&(e=new THREE.Vector3),this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(e){var t,r;return 0<e.normal.x?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),0<e.normal.y?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),0<e.normal.z?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=e.constant&&r>=e.constant},clampPoint:function(e,t){return(t||new THREE.Vector3).copy(e).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,t.center=this.center(),t.radius=.5*this.size(e).length(),t}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.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 this.isEmpty()?this:(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.setFromPoints(e),this)}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},THREE.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(e,t,r,i,n,o,a,s,c){var h=this.elements;return h[0]=e,h[1]=i,h[2]=a,h[3]=t,h[4]=n,h[5]=s,h[6]=r,h[7]=o,h[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){return e=e.elements,this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},setFromMatrix4:function(e){return e=e.elements,this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToVector3Array:function(){var e;return function(t,r,i){void 0===e&&(e=new THREE.Vector3),void 0===r&&(r=0),void 0===i&&(i=t.length);for(var n=0;i>n;n+=3,r+=3)e.fromArray(t,r),e.applyMatrix3(this),e.toArray(t,r);return t}}(),applyToBuffer:function(){var e;return function(t,r,i){void 0===e&&(e=new THREE.Vector3),void 0===r&&(r=0),void 0===i&&(i=t.length/t.itemSize);for(var n=0;i>n;n++,r++)e.x=t.getX(r),e.y=t.getY(r),e.z=t.getZ(r),e.applyMatrix3(this),t.setXYZ(e.x,e.y,e.z);return t}}(),multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],a=e[5],s=e[6],c=e[7],e=e[8];return t*o*e-t*a*c-r*n*e+r*a*s+i*n*c-i*o*s},getInverse:function(e,t){e instanceof THREE.Matrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var r=e.elements,i=this.elements,n=r[0],o=r[1],a=r[2],s=r[3],c=r[4],h=r[5],l=r[6],u=r[7],r=r[8],p=r*c-h*u,d=h*l-r*s,E=u*s-c*l,f=n*p+o*d+a*E;if(0===f){if(t)throw Error("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0"),this.identity()}return i[0]=p,i[1]=a*u-r*o,i[2]=h*o-a*c,i[3]=d,i[4]=r*n-a*l,i[5]=a*s-h*n,i[6]=E,i[7]=o*l-u*n,i[8]=c*n-o*s,this.multiplyScalar(1/f)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(e,t)},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},fromArray:function(e){return this.elements.set(e),this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}},THREE.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(e,t,r,i,n,o,a,s,c,h,l,u,p,d,E,f){var m=this.elements;return m[0]=e,m[4]=t,m[8]=r,m[12]=i,m[1]=n,m[5]=o,m[9]=a,m[13]=s,m[2]=c,m[6]=h,m[10]=l,m[14]=u,m[3]=p,m[7]=d,m[11]=E,m[15]=f,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new THREE.Matrix4).fromArray(this.elements)},copy:function(e){return this.elements.set(e.elements),this},copyPosition:function(e){var t=this.elements;return e=e.elements,t[12]=e[12],t[13]=e[13],t[14]=e[14],this},extractBasis:function(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this},extractRotation:function(){var e;return function(t){void 0===e&&(e=new THREE.Vector3);var r=this.elements,i=t.elements,n=1/e.setFromMatrixColumn(t,0).length(),o=1/e.setFromMatrixColumn(t,1).length();return t=1/e.setFromMatrixColumn(t,2).length(),r[0]=i[0]*n,r[1]=i[1]*n,r[2]=i[2]*n,r[4]=i[4]*o,r[5]=i[5]*o,r[6]=i[6]*o,r[8]=i[8]*t,r[9]=i[9]*t,r[10]=i[10]*t,this}}(),makeRotationFromEuler:function(e){!1==e instanceof THREE.Euler&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,r=e.x,i=e.y,n=e.z,o=Math.cos(r),r=Math.sin(r),a=Math.cos(i),i=Math.sin(i),s=Math.cos(n),n=Math.sin(n);if("XYZ"===e.order){e=o*s;var c=o*n,h=r*s,l=r*n;t[0]=a*s,t[4]=-a*n,t[8]=i,t[1]=c+h*i,t[5]=e-l*i,t[9]=-r*a,t[2]=l-e*i,t[6]=h+c*i,t[10]=o*a}else"YXZ"===e.order?(e=a*s,c=a*n,h=i*s,l=i*n,t[0]=e+l*r,t[4]=h*r-c,t[8]=o*i,t[1]=o*n,t[5]=o*s,t[9]=-r,t[2]=c*r-h,t[6]=l+e*r,t[10]=o*a):"ZXY"===e.order?(e=a*s,c=a*n,h=i*s,l=i*n,t[0]=e-l*r,t[4]=-o*n,t[8]=h+c*r,t[1]=c+h*r,t[5]=o*s,t[9]=l-e*r,t[2]=-o*i,t[6]=r,t[10]=o*a):"ZYX"===e.order?(e=o*s,c=o*n,h=r*s,l=r*n,t[0]=a*s,t[4]=h*i-c,t[8]=e*i+l,t[1]=a*n,t[5]=l*i+e,t[9]=c*i-h,t[2]=-i,t[6]=r*a,t[10]=o*a):"YZX"===e.order?(e=o*a,c=o*i,h=r*a,l=r*i,t[0]=a*s,t[4]=l-e*n,t[8]=h*n+c,t[1]=n,t[5]=o*s,t[9]=-r*s,t[2]=-i*s,t[6]=c*n+h,t[10]=e-l*n):"XZY"===e.order&&(e=o*a,c=o*i,h=r*a,l=r*i,t[0]=a*s,t[4]=-n,t[8]=i*s,t[1]=e*n+l,t[5]=o*s,t[9]=c*n-h,t[2]=h*n-c,t[6]=r*s,t[10]=l*n+e);return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,r=e.x,i=e.y,n=e.z,o=e.w,a=r+r,s=i+i,c=n+n;e=r*a;var h=r*s,r=r*c,l=i*s,i=i*c,n=n*c,a=o*a,s=o*s,o=o*c;return t[0]=1-(l+n),t[4]=h-o,t[8]=r+s,t[1]=h+o,t[5]=1-(e+n),t[9]=i-a,t[2]=r-s,t[6]=i+a,t[10]=1-(e+l),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e,t,r;return function(i,n,o){void 0===e&&(e=new THREE.Vector3),void 0===t&&(t=new THREE.Vector3),void 0===r&&(r=new THREE.Vector3);var a=this.elements;return r.subVectors(i,n).normalize(),0===r.lengthSq()&&(r.z=1),e.crossVectors(o,r).normalize(),0===e.lengthSq()&&(r.x+=1e-4,e.crossVectors(o,r).normalize()),t.crossVectors(r,e),a[0]=e.x,a[4]=t.x,a[8]=r.x,a[1]=e.y,a[5]=t.y,a[9]=r.y,a[2]=e.z,a[6]=t.z,a[10]=r.z,this}}(),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var r=e.elements,i=t.elements,n=this.elements,o=r[0],a=r[4],s=r[8],c=r[12],h=r[1],l=r[5],u=r[9],p=r[13],d=r[2],E=r[6],f=r[10],m=r[14],g=r[3],T=r[7],v=r[11],r=r[15],y=i[0],R=i[4],H=i[8],x=i[12],b=i[1],_=i[5],M=i[9],w=i[13],S=i[2],L=i[6],A=i[10],C=i[14],P=i[3],B=i[7],D=i[11],i=i[15];return n[0]=o*y+a*b+s*S+c*P,n[4]=o*R+a*_+s*L+c*B,n[8]=o*H+a*M+s*A+c*D,n[12]=o*x+a*w+s*C+c*i,n[1]=h*y+l*b+u*S+p*P,n[5]=h*R+l*_+u*L+p*B,n[9]=h*H+l*M+u*A+p*D,n[13]=h*x+l*w+u*C+p*i,n[2]=d*y+E*b+f*S+m*P,n[6]=d*R+E*_+f*L+m*B,n[10]=d*H+E*M+f*A+m*D,n[14]=d*x+E*w+f*C+m*i,n[3]=g*y+T*b+v*S+r*P,n[7]=g*R+T*_+v*L+r*B,n[11]=g*H+T*M+v*A+r*D,n[15]=g*x+T*w+v*C+r*i,this},multiplyToArray:function(e,t,r){var i=this.elements;return this.multiplyMatrices(e,t),r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToVector3Array:function(){var e;return function(t,r,i){void 0===e&&(e=new THREE.Vector3),void 0===r&&(r=0),void 0===i&&(i=t.length);for(var n=0;i>n;n+=3,r+=3)e.fromArray(t,r),e.applyMatrix4(this),e.toArray(t,r);return t}}(),applyToBuffer:function(){var e;return function(t,r,i){void 0===e&&(e=new THREE.Vector3),void 0===r&&(r=0),void 0===i&&(i=t.length/t.itemSize);for(var n=0;i>n;n++,r++)e.x=t.getX(r),e.y=t.getY(r),e.z=t.getZ(r),e.applyMatrix4(this),t.setXYZ(e.x,e.y,e.z);return t}}(),determinant:function(){var e=this.elements,t=e[0],r=e[4],i=e[8],n=e[12],o=e[1],a=e[5],s=e[9],c=e[13],h=e[2],l=e[6],u=e[10],p=e[14];return e[3]*(+n*s*l-i*c*l-n*a*u+r*c*u+i*a*p-r*s*p)+e[7]*(+t*s*p-t*c*u+n*o*u-i*o*p+i*c*h-n*s*h)+e[11]*(+t*c*l-t*a*p-n*o*l+r*o*p+n*a*h-r*c*h)+e[15]*(-i*a*h-t*s*l+t*a*u+i*o*l-r*o*u+r*s*h)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(e,t)},getPosition:function(){var e;return function(){return void 0===e&&(e=new THREE.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),e.setFromMatrixColumn(this,3)}}(),setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var r=this.elements,i=e.elements,n=i[0],o=i[1],a=i[2],s=i[3],c=i[4],h=i[5],l=i[6],u=i[7],p=i[8],d=i[9],E=i[10],f=i[11],m=i[12],g=i[13],T=i[14],i=i[15],v=d*T*u-g*E*u+g*l*f-h*T*f-d*l*i+h*E*i,y=m*E*u-p*T*u-m*l*f+c*T*f+p*l*i-c*E*i,R=p*g*u-m*d*u+m*h*f-c*g*f-p*h*i+c*d*i,H=m*d*l-p*g*l-m*h*E+c*g*E+p*h*T-c*d*T,x=n*v+o*y+a*R+s*H;if(0===x){if(t)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"),this.identity()}return r[0]=v,r[1]=g*E*s-d*T*s-g*a*f+o*T*f+d*a*i-o*E*i,r[2]=h*T*s-g*l*s+g*a*u-o*T*u-h*a*i+o*l*i,r[3]=d*l*s-h*E*s-d*a*u+o*E*u+h*a*f-o*l*f,r[4]=y,r[5]=p*T*s-m*E*s+m*a*f-n*T*f-p*a*i+n*E*i,r[6]=m*l*s-c*T*s-m*a*u+n*T*u+c*a*i-n*l*i,r[7]=c*E*s-p*l*s+p*a*u-n*E*u-c*a*f+n*l*f,r[8]=R,r[9]=m*d*s-p*g*s-m*o*f+n*g*f+p*o*i-n*d*i,r[10]=c*g*s-m*h*s+m*o*u-n*g*u-c*o*i+n*h*i,r[11]=p*h*s-c*d*s-p*o*u+n*d*u+c*o*f-n*h*f,r[12]=H,r[13]=p*g*a-m*d*a+m*o*E-n*g*E-p*o*T+n*d*T,r[14]=m*h*a-c*g*a-m*o*l+n*g*l+c*o*T-n*h*T,r[15]=c*d*a-p*h*a+p*o*l-n*d*l-c*o*E+n*h*E,this.multiplyScalar(1/x)},scale:function(e){var t=this.elements,r=e.x,i=e.y;return e=e.z,t[0]*=r,t[4]*=i,t[8]*=e,t[1]*=r,t[5]*=i,t[9]*=e,t[2]*=r,t[6]*=i,t[10]*=e,t[3]*=r,t[7]*=i,t[11]*=e,this},getMaxScaleOnAxis:function(){var e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))},makeTranslation:function(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(1,0,0,0,0,t,-e,0,0,e,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(t,0,e,0,0,1,0,0,-e,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(t,-e,0,0,e,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var r=Math.cos(t),i=Math.sin(t),n=1-r,o=e.x,a=e.y,s=e.z,c=n*o,h=n*a;return this.set(c*o+r,c*a-i*s,c*s+i*a,0,c*a+i*s,h*a+r,h*s-i*o,0,c*s-i*a,h*s+i*o,n*s*s+r,0,0,0,0,1),this},makeScale:function(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this},compose:function(e,t,r){return this.makeRotationFromQuaternion(t),this.scale(r),this.setPosition(e),this},decompose:function(){var e,t;return function(r,i,n){void 0===e&&(e=new THREE.Vector3),void 0===t&&(t=new THREE.Matrix4);var o=this.elements,a=e.set(o[0],o[1],o[2]).length(),s=e.set(o[4],o[5],o[6]).length(),c=e.set(o[8],o[9],o[10]).length();0>this.determinant()&&(a=-a),r.x=o[12],r.y=o[13],r.z=o[14],t.elements.set(this.elements),r=1/a;var o=1/s,h=1/c;return t.elements[0]*=r,t.elements[1]*=r,t.elements[2]*=r,t.elements[4]*=o,t.elements[5]*=o,t.elements[6]*=o,t.elements[8]*=h,t.elements[9]*=h,t.elements[10]*=h,i.setFromRotationMatrix(t),n.x=a,n.y=s,n.z=c,this}}(),makeFrustum:function(e,t,r,i,n,o){var a=this.elements;return a[0]=2*n/(t-e),a[4]=0,a[8]=(t+e)/(t-e),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(e,t,r,i){e=r*Math.tan(THREE.Math.DEG2RAD*e*.5);var n=-e;return this.makeFrustum(n*t,e*t,n,e,r,i)},makeOrthographic:function(e,t,r,i,n,o){var a=this.elements,s=1/(t-e),c=1/(r-i),h=1/(o-n);return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-((t+e)*s),a[1]=0,a[5]=2*c,a[9]=0,a[13]=-((r+i)*c),a[2]=0,a[6]=0,a[10]=-2*h,a[14]=-((o+n)*h),a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(e){var t=this.elements;e=e.elements;for(var r=0;16>r;r++)if(t[r]!==e[r])return!1;return!0},fromArray:function(e){return this.elements.set(e),this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}},THREE.Ray=function(e,t){this.origin=void 0!==e?e:new THREE.Vector3,this.direction=void 0!==t?t:new THREE.Vector3},THREE.Ray.prototype={constructor:THREE.Ray,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return(t||new THREE.Vector3).copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){this.direction.copy(e).sub(this.origin).normalize()},recast:function(){var e=new THREE.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var r=t||new THREE.Vector3;r.subVectors(e,this.origin);var i=r.dot(this.direction);return 0>i?r.copy(this.origin):r.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new THREE.Vector3;return function(t){var r=e.subVectors(t,this.origin).dot(this.direction);return 0>r?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(r).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3;return function(i,n,o,a){e.copy(i).add(n).multiplyScalar(.5),t.copy(n).sub(i).normalize(),r.copy(this.origin).sub(e);var s,c=.5*i.distanceTo(n),h=-this.direction.dot(t),l=r.dot(this.direction),u=-r.dot(t),p=r.lengthSq(),d=Math.abs(1-h*h);return d>0?(i=h*u-l,n=h*l-u,s=c*d,i>=0?n>=-s?s>=n?(c=1/d,i*=c,n*=c,h=i*(i+h*n+2*l)+n*(h*i+n+2*u)+p):(n=c,i=Math.max(0,-(h*n+l)),h=-i*i+n*(n+2*u)+p):(n=-c,i=Math.max(0,-(h*n+l)),h=-i*i+n*(n+2*u)+p):-s>=n?(i=Math.max(0,-(-h*c+l)),n=i>0?-c:Math.min(Math.max(-c,-u),c),h=-i*i+n*(n+2*u)+p):s>=n?(i=0,n=Math.min(Math.max(-c,-u),c),h=n*(n+2*u)+p):(i=Math.max(0,-(h*c+l)),n=i>0?c:Math.min(Math.max(-c,-u),c),h=-i*i+n*(n+2*u)+p)):(n=h>0?-c:c,i=Math.max(0,-(h*n+l)),h=-i*i+n*(n+2*u)+p),o&&o.copy(this.direction).multiplyScalar(i).add(this.origin),a&&a.copy(t).multiplyScalar(n).add(e),h}}(),intersectSphere:function(){var e=new THREE.Vector3;return function(t,r){e.subVectors(t.center,this.origin);var i=e.dot(this.direction),n=e.dot(e)-i*i,o=t.radius*t.radius;return n>o?null:(o=Math.sqrt(o-n),n=i-o,i+=o,0>n&&0>i?null:0>n?this.at(i,r):this.at(n,r))}}(),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);return 0===t?0===e.distanceToPoint(this.origin)?0:null:(e=-(this.origin.dot(e.normal)+e.constant)/t,e>=0?e:null)},intersectPlane:function(e,t){var r=this.distanceToPlane(e);return null===r?null:this.at(r,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||0>e.normal.dot(this.direction)*t?!0:!1},intersectBox:function(e,t){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 i>=0?(r=(e.min.x-s.x)*i,i*=e.max.x-s.x):(r=(e.max.x-s.x)*i,i*=e.min.x-s.x),o>=0?(n=(e.min.y-s.y)*o,o*=e.max.y-s.y):(n=(e.max.y-s.y)*o,o*=e.min.y-s.y),r>o||n>i?null:((n>r||r!==r)&&(r=n),(i>o||i!==i)&&(i=o),a>=0?(n=(e.min.z-s.z)*a,a*=e.max.z-s.z):(n=(e.max.z-s.z)*a,a*=e.min.z-s.z),r>a||n>i?null:((n>r||r!==r)&&(r=n),(i>a||i!==i)&&(i=a),0>i?null:this.at(r>=0?r:i,t)))},intersectsBox:function(){var e=new THREE.Vector3;return function(t){return null!==this.intersectBox(t,e)}}(),intersectTriangle:function(){var e=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3,i=new THREE.Vector3;return function(n,o,a,s,c){if(t.subVectors(o,n),r.subVectors(a,n),i.crossVectors(t,r),o=this.direction.dot(i),o>0){if(s)return null;s=1}else{if(!(0>o))return null;s=-1,o=-o}return e.subVectors(this.origin,n),n=s*this.direction.dot(r.crossVectors(e,r)),0>n?null:(a=s*this.direction.dot(t.cross(e)),0>a||n+a>o?null:(n=-s*e.dot(i),0>n?null:this.at(n/o,c)))}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},THREE.Sphere=function(e,t){this.center=void 0!==e?e:new THREE.Vector3,this.radius=void 0!==t?t:0},THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new THREE.Box3;return function(t,r){var i=this.center;void 0!==r?i.copy(r):e.setFromPoints(t).center(i);for(var n=0,o=0,a=t.length;a>o;o++)n=Math.max(n,i.distanceToSquared(t[o]));return this.radius=Math.sqrt(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return 0>=this.radius},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(this.center.dot(e.normal)-e.constant)<=this.radius},clampPoint:function(e,t){var r=this.center.distanceToSquared(e),i=t||new THREE.Vector3;return i.copy(e),r>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(e){return e=e||new THREE.Box3,e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},THREE.Frustum=function(e,t,r,i,n,o){ this.planes=[void 0!==e?e:new THREE.Plane,void 0!==t?t: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(e,t,r,i,n,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(i),a[4].copy(n),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,r=0;6>r;r++)t[r].copy(e.planes[r]);return this},setFromMatrix:function(e){var t=this.planes,r=e.elements;e=r[0];var i=r[1],n=r[2],o=r[3],a=r[4],s=r[5],c=r[6],h=r[7],l=r[8],u=r[9],p=r[10],d=r[11],E=r[12],f=r[13],m=r[14],r=r[15];return t[0].setComponents(o-e,h-a,d-l,r-E).normalize(),t[1].setComponents(o+e,h+a,d+l,r+E).normalize(),t[2].setComponents(o+i,h+s,d+u,r+f).normalize(),t[3].setComponents(o-i,h-s,d-u,r-f).normalize(),t[4].setComponents(o-n,h-c,d-p,r-m).normalize(),t[5].setComponents(o+n,h+c,d+p,r+m).normalize(),this},intersectsObject:function(){var e=new THREE.Sphere;return function(t){var r=t.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),e.copy(r.boundingSphere),e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){var t=this.planes,r=e.center;e=-e.radius;for(var i=0;6>i;i++)if(t[i].distanceToPoint(r)<e)return!1;return!0},intersectsBox:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(r){for(var i=this.planes,n=0;6>n;n++){var o=i[n];e.x=0<o.normal.x?r.min.x:r.max.x,t.x=0<o.normal.x?r.max.x:r.min.x,e.y=0<o.normal.y?r.min.y:r.max.y,t.y=0<o.normal.y?r.max.y:r.min.y,e.z=0<o.normal.z?r.min.z:r.max.z,t.z=0<o.normal.z?r.max.z:r.min.z;var a=o.distanceToPoint(e),o=o.distanceToPoint(t);if(0>a&&0>o)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,r=0;6>r;r++)if(0>t[r].distanceToPoint(e))return!1;return!0}},THREE.Plane=function(e,t){this.normal=void 0!==e?e:new THREE.Vector3(1,0,0),this.constant=void 0!==t?t:0},THREE.Plane.prototype={constructor:THREE.Plane,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(r,i,n){return i=e.subVectors(n,i).cross(t.subVectors(r,i)).normalize(),this.setFromNormalAndCoplanarPoint(i,r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var r=this.distanceToPoint(e);return(t||new THREE.Vector3).copy(this.normal).multiplyScalar(r)},intersectLine:function(){var e=new THREE.Vector3;return function(t,r){var i=r||new THREE.Vector3,n=t.delta(e),o=this.normal.dot(n);return 0!==o?(o=-(t.start.dot(this.normal)+this.constant)/o,0>o||o>1?void 0:i.copy(n).multiplyScalar(o).add(t.start)):0===this.distanceToPoint(t.start)?i.copy(t.start):void 0}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start);return e=this.distanceToPoint(e.end),0>t&&e>0||0>e&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return(e||new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new THREE.Vector3,t=new THREE.Matrix3;return function(r,i){var n=this.coplanarPoint(e).applyMatrix4(r),o=i||t.getNormalMatrix(r),o=this.normal.applyMatrix3(o).normalize();return this.constant=-n.dot(o),this}}(),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},THREE.Spherical=function(e,t,r){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==r?r:0,this},THREE.Spherical.prototype={constructor:THREE.Spherical,set:function(e,t,r){this.radius=e,this.phi=t,this.theta=r},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius.copy(e.radius),this.phi.copy(e.phi),this.theta.copy(e.theta),this},makeSafe:function(){this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi))},setFromVector3:function(e){return this.radius=e.length(),0===this.radius?this.phi=this.theta=0:(this.theta=Math.atan2(e.x,e.z),this.phi=Math.acos(THREE.Math.clamp(e.y/this.radius,-1,1))),this}},THREE.Math={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=Array(36),i=0;return function(){for(var n=0;36>n;n++)8===n||13===n||18===n||23===n?r[n]="-":14===n?r[n]="4":(2>=i&&(i=33554432+16777216*Math.random()|0),e=15&i,i>>=4,r[n]=t[19===n?3&e|8:e]);return r.join("")}}(),clamp:function(e,t,r){return Math.max(t,Math.min(r,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,r,i,n){return i+(e-t)*(n-i)/(r-t)},smoothstep:function(e,t,r){return t>=e?0:e>=r?1:(e=(e-t)/(r-t),e*e*(3-2*e))},smootherstep:function(e,t,r){return t>=e?0:e>=r?1:(e=(e-t)/(r-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*THREE.Math.DEG2RAD},radToDeg:function(e){return e*THREE.Math.RAD2DEG},isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}},THREE.Spline=function(e){function t(e,t,r,i,n,o,a){return e=.5*(r-e),i=.5*(i-t),(2*(t-r)+e+i)*a+(-3*(t-r)-2*e-i)*o+e*n+t}this.points=e;var r,i,n,o,a,s,c,h,l,u=[],p={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;t<e.length;t++)this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}},this.getPoint=function(e){return r=(this.points.length-1)*e,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]],c=this.points[u[1]],h=this.points[u[2]],l=this.points[u[3]],o=n*n,a=n*o,p.x=t(s.x,c.x,h.x,l.x,n,o,a),p.y=t(s.y,c.y,h.y,l.y,n,o,a),p.z=t(s.z,c.z,h.z,l.z,n,o,a),p},this.getControlPointsArray=function(){var e,t,r=this.points.length,i=[];for(e=0;r>e;e++)t=this.points[e],i[e]=[t.x,t.y,t.z];return i},this.getLength=function(e){var t,r,i,n=t=t=0,o=new THREE.Vector3,a=new THREE.Vector3,s=[],c=0;for(s[0]=0,e||(e=100),r=this.points.length*e,o.copy(this.points[0]),e=1;r>e;e++)t=e/r,i=this.getPoint(t),a.copy(i),c+=a.distanceTo(o),o.copy(i),t*=this.points.length-1,t=Math.floor(t),t!==n&&(s[t]=c,n=t);return s[s.length]=c,{chunks:s,total:c}},this.reparametrizeByArcLength=function(e){var t,r,i,n,o,a,s=[],c=new THREE.Vector3,h=this.getLength();for(s.push(c.copy(this.points[0]).clone()),t=1;t<this.points.length;t++){for(r=h.chunks[t]-h.chunks[t-1],a=Math.ceil(e*r/h.total),n=(t-1)/(this.points.length-1),o=t/(this.points.length-1),r=1;a-1>r;r++)i=n+1/a*r*(o-n),i=this.getPoint(i),s.push(c.copy(i).clone());s.push(c.copy(this.points[t]).clone())}this.points=s}},THREE.Triangle=function(e,t,r){this.a=void 0!==e?e:new THREE.Vector3,this.b=void 0!==t?t:new THREE.Vector3,this.c=void 0!==r?r:new THREE.Vector3},THREE.Triangle.normal=function(){var e=new THREE.Vector3;return function(t,r,i,n){return n=n||new THREE.Vector3,n.subVectors(i,r),e.subVectors(t,r),n.cross(e),t=n.lengthSq(),t>0?n.multiplyScalar(1/Math.sqrt(t)):n.set(0,0,0)}}(),THREE.Triangle.barycoordFromPoint=function(){var e=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3;return function(i,n,o,a,s){e.subVectors(a,n),t.subVectors(o,n),r.subVectors(i,n),i=e.dot(e),n=e.dot(t),o=e.dot(r);var c=t.dot(t);a=t.dot(r);var h=i*c-n*n;return s=s||new THREE.Vector3,0===h?s.set(-2,-1,-1):(h=1/h,c=(c*o-n*a)*h,i=(i*a-n*o)*h,s.set(1-c-i,i,c))}}(),THREE.Triangle.containsPoint=function(){var e=new THREE.Vector3;return function(t,r,i,n){return t=THREE.Triangle.barycoordFromPoint(t,r,i,n,e),0<=t.x&&0<=t.y&&1>=t.x+t.y}}(),THREE.Triangle.prototype={constructor:THREE.Triangle,set:function(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this},setFromPointsAndIndices:function(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){return(e||new THREE.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return THREE.Triangle.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new THREE.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return THREE.Triangle.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return THREE.Triangle.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(){var e,t,r,i;return function(n,o){void 0===e&&(e=new THREE.Plane,t=[new THREE.Line3,new THREE.Line3,new THREE.Line3],r=new THREE.Vector3,i=new THREE.Vector3);var a=o||new THREE.Vector3,s=1/0;if(e.setFromCoplanarPoints(this.a,this.b,this.c),e.projectPoint(n,r),!0===this.containsPoint(r))a.copy(r);else{t[0].set(this.a,this.b),t[1].set(this.b,this.c),t[2].set(this.c,this.a);for(var c=0;c<t.length;c++){t[c].closestPointToPoint(r,!0,i);var h=r.distanceToSquared(i);s>h&&(s=h,a.copy(i))}}return a}}(),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},THREE.Interpolant=function(e,t,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(r),this.sampleValues=t,this.valueSize=r},THREE.Interpolant.prototype={constructor:THREE.Interpolant,evaluate:function(e){var t=this.parameterPositions,r=this._cachedIndex,i=t[r],n=t[r-1];e:{t:{r:{i:if(!(i>e)){for(var o=r+2;;){if(void 0===i){if(n>e)break i;return this._cachedIndex=r=t.length,this.afterEnd_(r-1,e,n)}if(r===o)break;if(n=i,i=t[++r],i>e)break t}i=t.length;break r}if(e>=n)break e;for(o=t[1],o>e&&(r=2,n=o),o=r-2;;){if(void 0===n)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(r===o)break;if(i=n,n=t[--r-1],e>=n)break t}i=r,r=0}for(;i>r;)n=r+i>>>1,e<t[n]?i=n:r=n+1;if(i=t[r],n=t[r-1],void 0===n)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(void 0===i)return this._cachedIndex=r=t.length,this.afterEnd_(r-1,n,e)}this._cachedIndex=r,this.intervalChanged_(r,n,i)}return this.interpolate_(r,n,e,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){var t=this.resultBuffer,r=this.sampleValues,i=this.valueSize;e*=i;for(var n=0;n!==i;++n)t[n]=r[e+n];return t},interpolate_:function(e,t,r,i){throw Error("call to abstract method")},intervalChanged_:function(e,t,r){}},Object.assign(THREE.Interpolant.prototype,{beforeStart_:THREE.Interpolant.prototype.copySampleValue_,afterEnd_:THREE.Interpolant.prototype.copySampleValue_}),THREE.CubicInterpolant=function(e,t,r,i){THREE.Interpolant.call(this,e,t,r,i),this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0},THREE.CubicInterpolant.prototype=Object.assign(Object.create(THREE.Interpolant.prototype),{constructor:THREE.CubicInterpolant,DefaultSettings_:{endingStart:THREE.ZeroCurvatureEnding,endingEnd:THREE.ZeroCurvatureEnding},intervalChanged_:function(e,t,r){var i=this.parameterPositions,n=e-2,o=e+1,a=i[n],s=i[o];if(void 0===a)switch(this.getSettings_().endingStart){case THREE.ZeroSlopeEnding:n=e,a=2*t-r;break;case THREE.WrapAroundEnding:n=i.length-2,a=t+i[n]-i[n+1];break;default:n=e,a=r}if(void 0===s)switch(this.getSettings_().endingEnd){case THREE.ZeroSlopeEnding:o=e,s=2*r-t;break;case THREE.WrapAroundEnding:o=1,s=r+i[1]-i[0];break;default:o=e-1,s=t}e=.5*(r-t),i=this.valueSize,this._weightPrev=e/(t-a),this._weightNext=e/(s-r),this._offsetPrev=n*i,this._offsetNext=o*i},interpolate_:function(e,t,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize;e*=a;var s=e-a,c=this._offsetPrev,h=this._offsetNext,l=this._weightPrev,u=this._weightNext,p=(r-t)/(i-t);for(r=p*p,i=r*p,t=-l*i+2*l*r-l*p,l=(1+l)*i+(-1.5-2*l)*r+(-.5+l)*p+1,p=(-1-u)*i+(1.5+u)*r+.5*p,u=u*i-u*r,r=0;r!==a;++r)n[r]=t*o[c+r]+l*o[s+r]+p*o[e+r]+u*o[h+r];return n}}),THREE.DiscreteInterpolant=function(e,t,r,i){THREE.Interpolant.call(this,e,t,r,i)},THREE.DiscreteInterpolant.prototype=Object.assign(Object.create(THREE.Interpolant.prototype),{constructor:THREE.DiscreteInterpolant,interpolate_:function(e,t,r,i){return this.copySampleValue_(e-1)}}),THREE.LinearInterpolant=function(e,t,r,i){THREE.Interpolant.call(this,e,t,r,i)},THREE.LinearInterpolant.prototype=Object.assign(Object.create(THREE.Interpolant.prototype),{constructor:THREE.LinearInterpolant,interpolate_:function(e,t,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize;e*=a;var s=e-a;for(t=(r-t)/(i-t),r=1-t,i=0;i!==a;++i)n[i]=o[s+i]*r+o[e+i]*t;return n}}),THREE.QuaternionLinearInterpolant=function(e,t,r,i){THREE.Interpolant.call(this,e,t,r,i)},THREE.QuaternionLinearInterpolant.prototype=Object.assign(Object.create(THREE.Interpolant.prototype),{constructor:THREE.QuaternionLinearInterpolant,interpolate_:function(e,t,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize;for(e*=a,t=(r-t)/(i-t),r=e+a;e!==r;e+=4)THREE.Quaternion.slerpFlat(n,0,o,e-a,o,e,t);return n}}),THREE.Clock=function(e){this.autoStart=void 0!==e?e:!0,this.elapsedTime=this.oldTime=this.startTime=0,this.running=!1},THREE.Clock.prototype={constructor:THREE.Clock,start:function(){this.oldTime=this.startTime=(performance||Date).now(),this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running&&this.start(),this.running){var t=(performance||Date).now(),e=(t-this.oldTime)/1e3;this.oldTime=t,this.elapsedTime+=e}return e}},THREE.EventDispatcher=function(){},THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(e){e.addEventListener=THREE.EventDispatcher.prototype.addEventListener,e.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener,e.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener,e.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)?!0:!1},removeEventListener:function(e,t){if(void 0!==this._listeners){var r=this._listeners[e];if(void 0!==r){var i=r.indexOf(t);-1!==i&&r.splice(i,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var r=[],i=t.length,n=0;i>n;n++)r[n]=t[n];for(n=0;i>n;n++)r[n].call(this,e)}}}},THREE.Layers=function(){this.mask=1},THREE.Layers.prototype={constructor:THREE.Layers,set:function(e){this.mask=1<<e},enable:function(e){this.mask|=1<<e},toggle:function(e){this.mask^=1<<e},disable:function(e){this.mask&=~(1<<e)},test:function(e){return 0!==(this.mask&e.mask)}},function(e){function t(e,t){return e.distance-t.distance}function r(e,t,i,n){if(!1!==e.visible&&(e.raycast(t,i),!0===n)){e=e.children,n=0;for(var o=e.length;o>n;n++)r(e[n],t,i,!0)}}e.Raycaster=function(t,r,i,n){this.ray=new e.Ray(t,r),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})},e.Raycaster.prototype={constructor:e.Raycaster,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(t,r){r instanceof e.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(r.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(r).sub(this.ray.origin).normalize()):r instanceof e.OrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(r),this.ray.direction.set(0,0,-1).transformDirection(r.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,i){var n=[];return r(e,this,n,i),n.sort(t),n},intersectObjects:function(e,i){var n=[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var o=0,a=e.length;a>o;o++)r(e[o],this,n,i);return n.sort(t),n}}}(THREE),THREE.Object3D=function(){Object.defineProperty(this,"id",{value:THREE.Object3DIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=THREE.Object3D.DefaultUp.clone();var e=new THREE.Vector3,t=new THREE.Euler,r=new THREE.Quaternion,i=new THREE.Vector3(1,1,1);t.onChange(function(){r.setFromEuler(t,!1)}),r.onChange(function(){t.setFromQuaternion(r,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:e},rotation:{enumerable:!0,value:t},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:i},modelViewMatrix:{value:new THREE.Matrix4},normalMatrix:{value:new THREE.Matrix3}}),this.rotationAutoUpdate=!0,this.matrix=new THREE.Matrix4,this.matrixWorld=new THREE.Matrix4,this.matrixAutoUpdate=THREE.Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new THREE.Layers,this.visible=!0,this.receiveShadow=this.castShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},THREE.Object3D.DefaultUp=new THREE.Vector3(0,1,0),THREE.Object3D.DefaultMatrixAutoUpdate=!0,THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(){var e=new THREE.Quaternion;return function(t,r){return e.setFromAxisAngle(t,r),this.quaternion.multiply(e),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 e=new THREE.Vector3;return function(t,r){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(r)),this}}(),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(e){return e.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(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e instanceof THREE.Object3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(1<arguments.length)for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);t=this.children.indexOf(e),-1!==t&&(e.parent=null,e.dispatchEvent({type:"removed"}),this.children.splice(t,1))},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var r=0,i=this.children.length;i>r;r++){var n=this.children[r].getObjectByProperty(e,t);if(void 0!==n)return n}},getWorldPosition:function(e){return e=e||new THREE.Vector3,this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(r){return r=r||new THREE.Quaternion,this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,r,t),r}}(),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,t=new THREE.Quaternion;return function(r){return r=r||new THREE.Vector3,this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,r),r}}(),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(e){e(this);for(var t=this.children,r=0,i=t.length;i>r;r++)t[r].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,r=0,i=t.length;i>r;r++)t[r].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){!0===this.matrixAutoUpdate&&this.updateMatrix(),(!0===this.matrixWorldNeedsUpdate||!0===e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=0,r=this.children.length;r>t;t++)this.children[t].updateMatrixWorld(e)},toJSON:function(e){function t(e){var t,r=[];for(t in e){var i=e[t];delete i.metadata,r.push(i)}return r}var r=void 0===e||""===e,i={};r&&(e={geometries:{},materials:{},textures:{},images:{}},i.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var n={};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),n.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===e.geometries[this.geometry.uuid]&&(e.geometries[this.geometry.uuid]=this.geometry.toJSON(e)),n.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===e.materials[this.material.uuid]&&(e.materials[this.material.uuid]=this.material.toJSON(e)),n.material=this.material.uuid),0<this.children.length){n.children=[];for(var o=0;o<this.children.length;o++)n.children.push(this.children[o].toJSON(e).object)}if(r){var r=t(e.geometries),o=t(e.materials),a=t(e.textures);e=t(e.images),0<r.length&&(i.geometries=r),0<o.length&&(i.materials=o),0<a.length&&(i.textures=a),0<e.length&&(i.images=e)}return i.object=n,i},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.rotationAutoUpdate=e.rotationAutoUpdate,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var r=0;r<e.children.length;r++)this.add(e.children[r].clone());return this}},THREE.EventDispatcher.prototype.apply(THREE.Object3D.prototype),THREE.Object3DIdCount=0,THREE.Face3=function(e,t,r,i,n,o){this.a=e,this.b=t,this.c=r,this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3,this.vertexNormals=Array.isArray(i)?i:[],this.color=n instanceof THREE.Color?n:new THREE.Color,this.vertexColors=Array.isArray(n)?n:[],this.materialIndex=void 0!==o?o:0},THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,r=e.vertexNormals.length;r>t;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,r=e.vertexColors.length;r>t;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},THREE.BufferAttribute=function(e,t,r){this.uuid=THREE.Math.generateUUID(),this.array=e,this.itemSize=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0,this.normalized=!0===r},THREE.BufferAttribute.prototype={constructor:THREE.BufferAttribute,get count(){return this.array.length/this.itemSize},set needsUpdate(e){!0===e&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.dynamic=e.dynamic,this},copyAt:function(e,t,r){e*=this.itemSize,r*=t.itemSize;for(var i=0,n=this.itemSize;n>i;i++)this.array[e+i]=t.array[r+i];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;n>i;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new THREE.Color),t[r++]=o.r,t[r++]=o.g,t[r++]=o.b}return this},copyIndicesArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;n>i;i++){var o=e[i];t[r++]=o.a,t[r++]=o.b,t[r++]=o.c}return this},copyVector2sArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;n>i;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),o=new THREE.Vector2),t[r++]=o.x,t[r++]=o.y}return this},copyVector3sArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;n>i;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new THREE.Vector3),t[r++]=o.x,t[r++]=o.y,t[r++]=o.z}return this},copyVector4sArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;n>i;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new THREE.Vector4),t[r++]=o.x,t[r++]=o.y,t[r++]=o.z,t[r++]=o.w}return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this},setXYZ:function(e,t,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this},setXYZW:function(e,t,r,i,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=n,this},clone:function(){return(new this.constructor).copy(this)}},THREE.Int8Attribute=function(e,t){return new THREE.BufferAttribute(new Int8Array(e),t)},THREE.Uint8Attribute=function(e,t){return new THREE.BufferAttribute(new Uint8Array(e),t)},THREE.Uint8ClampedAttribute=function(e,t){return new THREE.BufferAttribute(new Uint8ClampedArray(e),t)},THREE.Int16Attribute=function(e,t){return new THREE.BufferAttribute(new Int16Array(e),t)},THREE.Uint16Attribute=function(e,t){return new THREE.BufferAttribute(new Uint16Array(e),t)},THREE.Int32Attribute=function(e,t){return new THREE.BufferAttribute(new Int32Array(e),t)},THREE.Uint32Attribute=function(e,t){return new THREE.BufferAttribute(new Uint32Array(e),t)},THREE.Float32Attribute=function(e,t){return new THREE.BufferAttribute(new Float32Array(e),t)},THREE.Float64Attribute=function(e,t){return new THREE.BufferAttribute(new Float64Array(e),t)},THREE.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new THREE.BufferAttribute(e,t).setDynamic(!0)},THREE.InstancedBufferAttribute=function(e,t,r){THREE.BufferAttribute.call(this,e,t),this.meshPerAttribute=r||1},THREE.InstancedBufferAttribute.prototype=Object.create(THREE.BufferAttribute.prototype),THREE.InstancedBufferAttribute.prototype.constructor=THREE.InstancedBufferAttribute,THREE.InstancedBufferAttribute.prototype.copy=function(e){return THREE.BufferAttribute.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},THREE.InterleavedBuffer=function(e,t){this.uuid=THREE.Math.generateUUID(),this.array=e,this.stride=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},THREE.InterleavedBuffer.prototype={constructor:THREE.InterleavedBuffer,get length(){return this.array.length},get count(){return this.array.length/this.stride},set needsUpdate(e){!0===e&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,r){e*=this.stride,r*=t.stride;for(var i=0,n=this.stride;n>i;i++)this.array[e+i]=t.array[r+i];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)}},THREE.InstancedInterleavedBuffer=function(e,t,r){THREE.InterleavedBuffer.call(this,e,t),this.meshPerAttribute=r||1},THREE.InstancedInterleavedBuffer.prototype=Object.create(THREE.InterleavedBuffer.prototype),THREE.InstancedInterleavedBuffer.prototype.constructor=THREE.InstancedInterleavedBuffer,THREE.InstancedInterleavedBuffer.prototype.copy=function(e){return THREE.InterleavedBuffer.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},THREE.InterleavedBufferAttribute=function(e,t,r){this.uuid=THREE.Math.generateUUID(),this.data=e,this.itemSize=t,this.offset=r},THREE.InterleavedBufferAttribute.prototype={constructor:THREE.InterleavedBufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.data.count},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]; },getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this},setXYZ:function(e,t,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this},setXYZW:function(e,t,r,i,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this.data.array[e+3]=n,this}},THREE.Geometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1},THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(e){for(var t=(new THREE.Matrix3).getNormalMatrix(e),r=0,i=this.vertices.length;i>r;r++)this.vertices[r].applyMatrix4(e);for(r=0,i=this.faces.length;i>r;r++){e=this.faces[r],e.normal.applyMatrix3(t).normalize();for(var n=0,o=e.vertexNormals.length;o>n;n++)e.vertexNormals[n].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.normalsNeedUpdate=this.verticesNeedUpdate=!0,this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,r,i){return void 0===e&&(e=new THREE.Matrix4),e.makeTranslation(t,r,i),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,r,i){return void 0===e&&(e=new THREE.Matrix4),e.makeScale(t,r,i),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new THREE.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),fromBufferGeometry:function(e){function t(e,t,i,n){var o=void 0!==a?[l[e].clone(),l[t].clone(),l[i].clone()]:[],d=void 0!==s?[r.colors[e].clone(),r.colors[t].clone(),r.colors[i].clone()]:[];n=new THREE.Face3(e,t,i,o,d,n),r.faces.push(n),void 0!==c&&r.faceVertexUvs[0].push([u[e].clone(),u[t].clone(),u[i].clone()]),void 0!==h&&r.faceVertexUvs[1].push([p[e].clone(),p[t].clone(),p[i].clone()])}var r=this,i=null!==e.index?e.index.array:void 0,n=e.attributes,o=n.position.array,a=void 0!==n.normal?n.normal.array:void 0,s=void 0!==n.color?n.color.array:void 0,c=void 0!==n.uv?n.uv.array:void 0,h=void 0!==n.uv2?n.uv2.array:void 0;void 0!==h&&(this.faceVertexUvs[1]=[]);for(var l=[],u=[],p=[],d=n=0;n<o.length;n+=3,d+=2)r.vertices.push(new THREE.Vector3(o[n],o[n+1],o[n+2])),void 0!==a&&l.push(new THREE.Vector3(a[n],a[n+1],a[n+2])),void 0!==s&&r.colors.push(new THREE.Color(s[n],s[n+1],s[n+2])),void 0!==c&&u.push(new THREE.Vector2(c[d],c[d+1])),void 0!==h&&p.push(new THREE.Vector2(h[d],h[d+1]));if(void 0!==i)if(o=e.groups,0<o.length)for(n=0;n<o.length;n++)for(var E=o[n],f=E.start,m=E.count,d=f,f=f+m;f>d;d+=3)t(i[d],i[d+1],i[d+2],E.materialIndex);else for(n=0;n<i.length;n+=3)t(i[n],i[n+1],i[n+2]);else for(n=0;n<o.length/3;n+=3)t(n,n+1,n+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.translate(e.x,e.y,e.z),e},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,t=0===t?1:1/t,r=new THREE.Matrix4;return r.set(t,0,0,-t*e.x,0,t,0,-t*e.y,0,0,t,-t*e.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var e=new THREE.Vector3,t=new THREE.Vector3,r=0,i=this.faces.length;i>r;r++){var n=this.faces[r],o=this.vertices[n.a],a=this.vertices[n.b];e.subVectors(this.vertices[n.c],a),t.subVectors(o,a),e.cross(t),e.normalize(),n.normal.copy(e)}},computeVertexNormals:function(e){void 0===e&&(e=!0);var t,r,i;for(i=Array(this.vertices.length),t=0,r=this.vertices.length;r>t;t++)i[t]=new THREE.Vector3;if(e){var n,o,a,s=new THREE.Vector3,c=new THREE.Vector3;for(e=0,t=this.faces.length;t>e;e++)r=this.faces[e],n=this.vertices[r.a],o=this.vertices[r.b],a=this.vertices[r.c],s.subVectors(a,o),c.subVectors(n,o),s.cross(c),i[r.a].add(s),i[r.b].add(s),i[r.c].add(s)}else for(e=0,t=this.faces.length;t>e;e++)r=this.faces[e],i[r.a].add(r.normal),i[r.b].add(r.normal),i[r.c].add(r.normal);for(t=0,r=this.vertices.length;r>t;t++)i[t].normalize();for(e=0,t=this.faces.length;t>e;e++)r=this.faces[e],n=r.vertexNormals,3===n.length?(n[0].copy(i[r.a]),n[1].copy(i[r.b]),n[2].copy(i[r.c])):(n[0]=i[r.a].clone(),n[1]=i[r.b].clone(),n[2]=i[r.c].clone());0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,r,i,n;for(r=0,i=this.faces.length;i>r;r++)for(n=this.faces[r],n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]),e=0,t=n.vertexNormals.length;t>e;e++)n.__originalVertexNormals[e]?n.__originalVertexNormals[e].copy(n.vertexNormals[e]):n.__originalVertexNormals[e]=n.vertexNormals[e].clone();var o=new THREE.Geometry;for(o.faces=this.faces,e=0,t=this.morphTargets.length;t>e;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[],n=this.morphNormals[e].faceNormals;var a,s,c=this.morphNormals[e].vertexNormals;for(r=0,i=this.faces.length;i>r;r++)a=new THREE.Vector3,s={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},n.push(a),c.push(s)}for(c=this.morphNormals[e],o.vertices=this.morphTargets[e].vertices,o.computeFaceNormals(),o.computeVertexNormals(),r=0,i=this.faces.length;i>r;r++)n=this.faces[r],a=c.faceNormals[r],s=c.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;i>r;r++)n=this.faces[r],n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var e=0,t=this.vertices,r=0,i=t.length;i>r;r++)r>0&&(e+=t[r].distanceTo(t[r-1])),this.lineDistances[r]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,r){if(!1==e instanceof THREE.Geometry)console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);else{var i,n=this.vertices.length,o=this.vertices,a=e.vertices,s=this.faces,c=e.faces,h=this.faceVertexUvs[0];e=e.faceVertexUvs[0],void 0===r&&(r=0),void 0!==t&&(i=(new THREE.Matrix3).getNormalMatrix(t));for(var l=0,u=a.length;u>l;l++){var p=a[l].clone();void 0!==t&&p.applyMatrix4(t),o.push(p)}for(l=0,u=c.length;u>l;l++){var d,a=c[l],E=a.vertexNormals,f=a.vertexColors,p=new THREE.Face3(a.a+n,a.b+n,a.c+n);for(p.normal.copy(a.normal),void 0!==i&&p.normal.applyMatrix3(i).normalize(),t=0,o=E.length;o>t;t++)d=E[t].clone(),void 0!==i&&d.applyMatrix3(i).normalize(),p.vertexNormals.push(d);for(p.color.copy(a.color),t=0,o=f.length;o>t;t++)d=f[t],p.vertexColors.push(d.clone());p.materialIndex=a.materialIndex+r,s.push(p)}for(l=0,u=e.length;u>l;l++)if(r=e[l],i=[],void 0!==r){for(t=0,o=r.length;o>t;t++)i.push(r[t].clone());h.push(i)}}},mergeMesh:function(e){!1==e instanceof THREE.Mesh?console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e):(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix))},mergeVertices:function(){var e,t,r,i={},n=[],o=[],a=Math.pow(10,4);for(t=0,r=this.vertices.length;r>t;t++)e=this.vertices[t],e=Math.round(e.x*a)+"_"+Math.round(e.y*a)+"_"+Math.round(e.z*a),void 0===i[e]?(i[e]=t,n.push(this.vertices[t]),o[t]=n.length-1):o[t]=o[i[e]];for(i=[],t=0,r=this.faces.length;r>t;t++)for(a=this.faces[t],a.a=o[a.a],a.b=o[a.b],a.c=o[a.c],a=[a.a,a.b,a.c],e=0;3>e;e++)if(a[e]===a[(e+1)%3]){i.push(t);break}for(t=i.length-1;t>=0;t--)for(a=i[t],this.faces.splice(a,1),o=0,r=this.faceVertexUvs.length;r>o;o++)this.faceVertexUvs[o].splice(a,1);return t=this.vertices.length-n.length,this.vertices=n,t},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,r=0;t>r;r++)e[r]._id=r;e.sort(function(e,t){return e.materialIndex-t.materialIndex});var i,n,o=this.faceVertexUvs[0],a=this.faceVertexUvs[1];for(o&&o.length===t&&(i=[]),a&&a.length===t&&(n=[]),r=0;t>r;r++){var s=e[r]._id;i&&i.push(o[s]),n&&n.push(a[s])}i&&(this.faceVertexUvs[0]=i),n&&(this.faceVertexUvs[1]=n)},toJSON:function(){function e(e,t,r){return r?e|1<<t:e&~(1<<t)}function t(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==h[t]?h[t]:(h[t]=c.length/3,c.push(e.x,e.y,e.z),h[t])}function r(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==u[t]?u[t]:(u[t]=l.length,l.push(e.getHex()),u[t])}function i(e){var t=e.x.toString()+e.y.toString();return void 0!==d[t]?d[t]:(d[t]=p.length/2,p.push(e.x,e.y),d[t])}var n={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),void 0!==this.parameters){var o,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)}var s=[],c=[],h={},l=[],u={},p=[],d={};for(o=0;o<this.faces.length;o++){var E=this.faces[o],f=void 0!==this.faceVertexUvs[0][o],m=0<E.normal.length(),g=0<E.vertexNormals.length,T=1!==E.color.r||1!==E.color.g||1!==E.color.b,v=0<E.vertexColors.length,y=0,y=e(y,0,0),y=e(y,1,!0),y=e(y,2,!1),y=e(y,3,f),y=e(y,4,m),y=e(y,5,g),y=e(y,6,T),y=e(y,7,v);s.push(y),s.push(E.a,E.b,E.c),s.push(E.materialIndex),f&&(f=this.faceVertexUvs[0][o],s.push(i(f[0]),i(f[1]),i(f[2]))),m&&s.push(t(E.normal)),g&&(m=E.vertexNormals,s.push(t(m[0]),t(m[1]),t(m[2]))),T&&s.push(r(E.color)),v&&(E=E.vertexColors,s.push(r(E[0]),r(E[1]),r(E[2])))}return n.data={},n.data.vertices=a,n.data.normals=c,0<l.length&&(n.data.colors=l),0<p.length&&(n.data.uvs=[p]),n.data.faces=s,n},clone:function(){return(new THREE.Geometry).copy(this)},copy:function(e){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var t=e.vertices,r=0,i=t.length;i>r;r++)this.vertices.push(t[r].clone());for(t=e.faces,r=0,i=t.length;i>r;r++)this.faces.push(t[r].clone());for(r=0,i=e.faceVertexUvs.length;i>r;r++){t=e.faceVertexUvs[r],void 0===this.faceVertexUvs[r]&&(this.faceVertexUvs[r]=[]);for(var n=0,o=t.length;o>n;n++){for(var a=t[n],s=[],c=0,h=a.length;h>c;c++)s.push(a[c].clone());this.faceVertexUvs[r].push(s)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype),THREE.GeometryIdCount=0,THREE.DirectGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="DirectGeometry",this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1},THREE.DirectGeometry.prototype={constructor:THREE.DirectGeometry,computeBoundingBox:THREE.Geometry.prototype.computeBoundingBox,computeBoundingSphere:THREE.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(e){var t,r,i=[];e=e.faces;for(var n=0;n<e.length;n++){var o=e[n];o.materialIndex!==r&&(r=o.materialIndex,void 0!==t&&(t.count=3*n-t.start,i.push(t)),t={start:3*n,materialIndex:r})}void 0!==t&&(t.count=3*n-t.start,i.push(t)),this.groups=i},fromGeometry:function(e){var t,r=e.faces,i=e.vertices,n=e.faceVertexUvs,o=n[0]&&0<n[0].length,a=n[1]&&0<n[1].length,s=e.morphTargets,c=s.length;if(c>0){t=[];for(var h=0;c>h;h++)t[h]=[];this.morphTargets.position=t}var l,u=e.morphNormals,p=u.length;if(p>0){for(l=[],h=0;p>h;h++)l[h]=[];this.morphTargets.normal=l}for(var d=e.skinIndices,E=e.skinWeights,f=d.length===i.length,m=E.length===i.length,h=0;h<r.length;h++){var g=r[h];this.vertices.push(i[g.a],i[g.b],i[g.c]);var T=g.vertexNormals;for(3===T.length?this.normals.push(T[0],T[1],T[2]):(T=g.normal,this.normals.push(T,T,T)),T=g.vertexColors,3===T.length?this.colors.push(T[0],T[1],T[2]):(T=g.color,this.colors.push(T,T,T)),!0===o&&(T=n[0][h],void 0!==T?this.uvs.push(T[0],T[1],T[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",h),this.uvs.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2))),!0===a&&(T=n[1][h],void 0!==T?this.uvs2.push(T[0],T[1],T[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",h),this.uvs2.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2))),T=0;c>T;T++){var v=s[T].vertices;t[T].push(v[g.a],v[g.b],v[g.c])}for(T=0;p>T;T++)v=u[T].vertexNormals[h],l[T].push(v.a,v.b,v.c);f&&this.skinIndices.push(d[g.a],d[g.b],d[g.c]),m&&this.skinWeights.push(E[g.a],E[g.b],E[g.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.DirectGeometry.prototype),THREE.BufferGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingSphere=this.boundingBox=null,this.drawRange={start:0,count:1/0}},THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,getIndex:function(){return this.index},setIndex:function(e){this.index=e},addAttribute:function(e,t,r){if(!1==t instanceof THREE.BufferAttribute&&!1==t instanceof THREE.InterleavedBufferAttribute)console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(e,new THREE.BufferAttribute(t,r));else{if("index"!==e)return this.attributes[e]=t,this;console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t)}},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,r){this.groups.push({start:e,count:t,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;return void 0!==t&&(e.applyToVector3Array(t.array),t.needsUpdate=!0),t=this.attributes.normal,void 0!==t&&((new THREE.Matrix3).getNormalMatrix(e).applyToVector3Array(t.array),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,r,i){return void 0===e&&(e=new THREE.Matrix4),e.makeTranslation(t,r,i),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,r,i){return void 0===e&&(e=new THREE.Matrix4),e.makeScale(t,r,i),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new THREE.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e instanceof THREE.Points||e instanceof THREE.Line){e=new THREE.Float32Attribute(3*t.vertices.length,3);var r=new THREE.Float32Attribute(3*t.colors.length,3);this.addAttribute("position",e.copyVector3sArray(t.vertices)),this.addAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length&&(e=new THREE.Float32Attribute(t.lineDistances.length,1),this.addAttribute("lineDistance",e.copyArray(t.lineDistances))),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e instanceof THREE.Mesh&&t instanceof THREE.Geometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t=e.geometry;if(e instanceof THREE.Mesh){var r=t.__directGeometry;if(void 0===r)return this.fromGeometry(t);r.verticesNeedUpdate=t.verticesNeedUpdate,r.normalsNeedUpdate=t.normalsNeedUpdate,r.colorsNeedUpdate=t.colorsNeedUpdate,r.uvsNeedUpdate=t.uvsNeedUpdate,r.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=r}return!0===t.verticesNeedUpdate&&(r=this.attributes.position,void 0!==r&&(r.copyVector3sArray(t.vertices),r.needsUpdate=!0),t.verticesNeedUpdate=!1),!0===t.normalsNeedUpdate&&(r=this.attributes.normal,void 0!==r&&(r.copyVector3sArray(t.normals),r.needsUpdate=!0),t.normalsNeedUpdate=!1),!0===t.colorsNeedUpdate&&(r=this.attributes.color,void 0!==r&&(r.copyColorsArray(t.colors),r.needsUpdate=!0),t.colorsNeedUpdate=!1),t.uvsNeedUpdate&&(r=this.attributes.uv,void 0!==r&&(r.copyVector2sArray(t.uvs),r.needsUpdate=!0),t.uvsNeedUpdate=!1),t.lineDistancesNeedUpdate&&(r=this.attributes.lineDistance,void 0!==r&&(r.copyArray(t.lineDistances),r.needsUpdate=!0),t.lineDistancesNeedUpdate=!1),t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new THREE.DirectGeometry).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);this.addAttribute("position",new THREE.BufferAttribute(t,3).copyVector3sArray(e.vertices)),0<e.normals.length&&(t=new Float32Array(3*e.normals.length),this.addAttribute("normal",new THREE.BufferAttribute(t,3).copyVector3sArray(e.normals))),0<e.colors.length&&(t=new Float32Array(3*e.colors.length),this.addAttribute("color",new THREE.BufferAttribute(t,3).copyColorsArray(e.colors))),0<e.uvs.length&&(t=new Float32Array(2*e.uvs.length),this.addAttribute("uv",new THREE.BufferAttribute(t,2).copyVector2sArray(e.uvs))),0<e.uvs2.length&&(t=new Float32Array(2*e.uvs2.length),this.addAttribute("uv2",new THREE.BufferAttribute(t,2).copyVector2sArray(e.uvs2))),0<e.indices.length&&(t=new(65535<e.vertices.length?Uint32Array:Uint16Array)(3*e.indices.length),this.setIndex(new THREE.BufferAttribute(t,1).copyIndicesArray(e.indices))),this.groups=e.groups;for(var r in e.morphTargets){for(var t=[],i=e.morphTargets[r],n=0,o=i.length;o>n;n++){var a=i[n],s=new THREE.Float32Attribute(3*a.length,3);t.push(s.copyVector3sArray(a))}this.morphAttributes[r]=t}return 0<e.skinIndices.length&&(r=new THREE.Float32Attribute(4*e.skinIndices.length,4),this.addAttribute("skinIndex",r.copyVector4sArray(e.skinIndices))),0<e.skinWeights.length&&(r=new THREE.Float32Attribute(4*e.skinWeights.length,4),this.addAttribute("skinWeight",r.copyVector4sArray(e.skinWeights))),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var e=this.attributes.position.array;void 0!==e?this.boundingBox.setFromArray(e):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var e=new THREE.Box3,t=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var r=this.attributes.position.array;if(r){var i=this.boundingSphere.center;e.setFromArray(r),e.center(i);for(var n=0,o=0,a=r.length;a>o;o+=3)t.fromArray(r,o),n=Math.max(n,i.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes,r=this.groups;if(t.position){var i=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(i.length),3));else for(var n=t.normal.array,o=0,a=n.length;a>o;o++)n[o]=0;var s,c,h,n=t.normal.array,l=new THREE.Vector3,u=new THREE.Vector3,p=new THREE.Vector3,d=new THREE.Vector3,E=new THREE.Vector3;if(e){e=e.array,0===r.length&&this.addGroup(0,e.length);for(var f=0,m=r.length;m>f;++f)for(o=r[f],a=o.start,s=o.count,o=a,a+=s;a>o;o+=3)s=3*e[o+0],c=3*e[o+1],h=3*e[o+2],l.fromArray(i,s),u.fromArray(i,c),p.fromArray(i,h),d.subVectors(p,u),E.subVectors(l,u),d.cross(E),n[s]+=d.x,n[s+1]+=d.y,n[s+2]+=d.z,n[c]+=d.x,n[c+1]+=d.y,n[c+2]+=d.z,n[h]+=d.x,n[h+1]+=d.y,n[h+2]+=d.z}else for(o=0,a=i.length;a>o;o+=9)l.fromArray(i,o),u.fromArray(i,o+3),p.fromArray(i,o+6),d.subVectors(p,u),E.subVectors(l,u),d.cross(E),n[o]=d.x,n[o+1]=d.y,n[o+2]=d.z,n[o+3]=d.x,n[o+4]=d.y,n[o+5]=d.z,n[o+6]=d.x,n[o+7]=d.y,n[o+8]=d.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(!1!=e instanceof THREE.BufferGeometry){void 0===t&&(t=0);var r,i=this.attributes;for(r in i)if(void 0!==e.attributes[r])for(var n=i[r].array,o=e.attributes[r],a=o.array,s=0,o=o.itemSize*t;s<a.length;s++,o++)n[o]=a[s];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){for(var e,t,r,i=this.attributes.normal.array,n=0,o=i.length;o>n;n+=3)e=i[n],t=i[n+1],r=i[n+2],e=1/Math.sqrt(e*e+t*t+r*r),i[n]*=e,i[n+1]*=e,i[n+2]*=e},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e,t=new THREE.BufferGeometry,r=this.index.array,i=this.attributes;for(e in i){for(var n=i[e],o=n.array,n=n.itemSize,a=new o.constructor(r.length*n),s=0,c=0,h=0,l=r.length;l>h;h++)for(var s=r[h]*n,u=0;n>u;u++)a[c++]=o[s++];t.addAttribute(e,new THREE.BufferAttribute(a,n))}return t},toJSON:function(){var e={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t,r=this.parameters;for(t in r)void 0!==r[t]&&(e[t]=r[t]);return e}e.data={attributes:{}};var i=this.index;null!==i&&(r=Array.prototype.slice.call(i.array),e.data.index={type:i.array.constructor.name,array:r}),i=this.attributes;for(t in i){var n=i[t],r=Array.prototype.slice.call(n.array);e.data.attributes[t]={itemSize:n.itemSize,type:n.array.constructor.name,array:r,normalized:n.normalized}}return t=this.groups,0<t.length&&(e.data.groups=JSON.parse(JSON.stringify(t))),t=this.boundingSphere,null!==t&&(e.data.boundingSphere={center:t.center.toArray(),radius:t.radius}),e},clone:function(){return(new THREE.BufferGeometry).copy(this)},copy:function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var r,t=e.attributes;for(r in t)this.addAttribute(r,t[r].clone());for(e=e.groups,r=0,t=e.length;t>r;r++){var i=e[r];this.addGroup(i.start,i.count,i.materialIndex)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype),THREE.BufferGeometry.MaxIndex=65535,THREE.InstancedBufferGeometry=function(){THREE.BufferGeometry.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0},THREE.InstancedBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.InstancedBufferGeometry.prototype.constructor=THREE.InstancedBufferGeometry,THREE.InstancedBufferGeometry.prototype.addGroup=function(e,t,r){this.groups.push({start:e,count:t,instances:r})},THREE.InstancedBufferGeometry.prototype.copy=function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var r,t=e.attributes;for(r in t)this.addAttribute(r,t[r].clone());for(e=e.groups,r=0,t=e.length;t>r;r++){var i=e[r];this.addGroup(i.start,i.count,i.instances)}return this},THREE.EventDispatcher.prototype.apply(THREE.InstancedBufferGeometry.prototype),THREE.Uniform=function(e,t){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=t),this.value=e,this.dynamic=!1},THREE.Uniform.prototype={constructor:THREE.Uniform,onUpdate:function(e){return this.dynamic=!0,this.onUpdateCallback=e,this}},THREE.AnimationClip=function(e,t,r){this.name=e||THREE.Math.generateUUID(),this.tracks=r,this.duration=void 0!==t?t:-1,0>this.duration&&this.resetDuration(),this.trim(),this.optimize()},THREE.AnimationClip.prototype={constructor:THREE.AnimationClip,resetDuration:function(){for(var e=0,t=0,r=this.tracks.length;t!==r;++t)var i=this.tracks[t],e=Math.max(e,i.times[i.times.length-1]);this.duration=e},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},Object.assign(THREE.AnimationClip,{parse:function(e){for(var t=[],r=e.tracks,i=1/(e.fps||1),n=0,o=r.length;n!==o;++n)t.push(THREE.KeyframeTrack.parse(r[n]).scale(i));return new THREE.AnimationClip(e.name,e.duration,t)},toJSON:function(e){var t=[],r=e.tracks;e={name:e.name,duration:e.duration,tracks:t};for(var i=0,n=r.length;i!==n;++i)t.push(THREE.KeyframeTrack.toJSON(r[i]));return e},CreateFromMorphTargetSequence:function(e,t,r,i){for(var n=t.length,o=[],a=0;n>a;a++){var s=[],c=[];s.push((a+n-1)%n,a,(a+1)%n),c.push(0,1,0);var h=THREE.AnimationUtils.getKeyframeOrder(s),s=THREE.AnimationUtils.sortedArray(s,1,h),c=THREE.AnimationUtils.sortedArray(c,1,h);i||0!==s[0]||(s.push(n),c.push(c[0])),o.push(new THREE.NumberKeyframeTrack(".morphTargetInfluences["+t[a].name+"]",s,c).scale(1/r))}return new THREE.AnimationClip(e,-1,o)},findByName:function(e,t){for(var r=0;r<e.length;r++)if(e[r].name===t)return e[r];return null},CreateClipsFromMorphTargetSequences:function(e,t,r){for(var i={},n=/^([\w-]*?)([\d]+)$/,o=0,a=e.length;a>o;o++){var s=e[o],c=s.name.match(n);if(c&&1<c.length){var h=c[1];(c=i[h])||(i[h]=c=[]),c.push(s)}}e=[];for(h in i)e.push(THREE.AnimationClip.CreateFromMorphTargetSequence(h,i[h],t,r));return e},parseAnimation:function(e,t,r){if(!e)return console.error(" no animation in JSONLoader data"),null;r=function(e,t,r,i,n){if(0!==r.length){var o=[],a=[];THREE.AnimationUtils.flattenJSON(r,o,a,i),0!==o.length&&n.push(new e(t,o,a))}};var i=[],n=e.name||"default",o=e.length||-1,a=e.fps||30;e=e.hierarchy||[];for(var s=0;s<e.length;s++){var c=e[s].keys;if(c&&0!=c.length)if(c[0].morphTargets){for(var o={},h=0;h<c.length;h++)if(c[h].morphTargets)for(var l=0;l<c[h].morphTargets.length;l++)o[c[h].morphTargets[l]]=-1;for(var u in o){for(var p=[],d=[],l=0;l!==c[h].morphTargets.length;++l){var E=c[h];p.push(E.time),d.push(E.morphTarget===u?1:0)}i.push(new THREE.NumberKeyframeTrack(".morphTargetInfluence["+u+"]",p,d))}o=o.length*(a||1)}else h=".bones["+t[s].name+"]",r(THREE.VectorKeyframeTrack,h+".position",c,"pos",i),r(THREE.QuaternionKeyframeTrack,h+".quaternion",c,"rot",i),r(THREE.VectorKeyframeTrack,h+".scale",c,"scl",i)}return 0===i.length?null:new THREE.AnimationClip(n,o,i)}}),THREE.AnimationMixer=function(e){this._root=e,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1},THREE.AnimationMixer.prototype={constructor:THREE.AnimationMixer,clipAction:function(e,t){var r,i=(t||this._root).uuid,n="string"==typeof e?e:e.name,o=e!==n?e:null,a=this._actionsByClip[n];if(void 0!==a){if(r=a.actionByRoot[i],void 0!==r)return r;if(r=a.knownActions[0],o=r._clip,e!==n&&e!==o)throw Error("Different clips with the same name detected!")}return null===o?null:(a=new THREE.AnimationMixer._Action(this,o,t),this._bindAction(a,r),this._addInactiveAction(a,n,i),a)},existingAction:function(e,t){var r=(t||this._root).uuid,i=this._actionsByClip["string"==typeof e?e:e.name];return void 0!==i?i.actionByRoot[r]||null:null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions,r=this._bindings,i=this._nActiveBindings,n=this._nActiveBindings=this._nActiveActions=0;n!==t;++n)e[n].reset();for(n=0;n!==i;++n)r[n].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,r=this._nActiveActions,i=this.time+=e,n=Math.sign(e),o=this._accuIndex^=1,a=0;a!==r;++a){var s=t[a];s.enabled&&s._update(i,e,n,o)}for(e=this._bindings,t=this._nActiveBindings,a=0;a!==t;++a)e[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions;e=e.name;var r=this._actionsByClip,i=r[e];if(void 0!==i){for(var i=i.knownActions,n=0,o=i.length;n!==o;++n){var a=i[n];this._deactivateAction(a);var s=a._cacheIndex,c=t[t.length-1];a._cacheIndex=null,a._byClipCacheIndex=null,c._cacheIndex=s,t[s]=c,t.pop(),this._removeInactiveBindingsForAction(a)}delete r[e]}},uncacheRoot:function(e){e=e.uuid;var t,r=this._actionsByClip;for(t in r){var i=r[t].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}if(t=this._bindingsByRootAndName[e],void 0!==t)for(var n in t)e=t[n],e.restoreOriginalState(),this._removeInactiveBinding(e)},uncacheAction:function(e,t){var r=this.existingAction(e,t);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}},THREE.EventDispatcher.prototype.apply(THREE.AnimationMixer.prototype),THREE.AnimationMixer._Action=function(e,t,r){this._mixer=e,this._clip=t,this._localRoot=r||null,e=t.tracks,t=e.length,r=Array(t);for(var i={endingStart:THREE.ZeroCurvatureEnding,endingEnd:THREE.ZeroCurvatureEnding},n=0;n!==t;++n){var o=e[n].createInterpolant(null);r[n]=o,o.settings=i}this._interpolantSettings=i,this._interpolants=r,this._propertyBindings=Array(t),this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null,this.loop=THREE.LoopRepeat,this._loopCount=-1,this._startTime=null,this.time=0,this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0},THREE.AnimationMixer._Action.prototype={constructor:THREE.AnimationMixer._Action,play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0, this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,r){if(e.fadeOut(t),this.fadeIn(t),r){r=this._clip.duration;var i=e._clip.duration,n=r/i;e.warp(1,i/r,t),this.warp(n,1,t)}return this},crossFadeTo:function(e,t,r){return e.crossFadeFrom(this,t,r)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._currentTimeScale,0,e)},warp:function(e,t,r){var i=this._mixer,n=i.time,o=this._timeScaleInterpolant,a=this.timeScale;return null===o&&(this._timeScaleInterpolant=o=i._lendControlInterpolant()),i=o.parameterPositions,o=o.sampleValues,i[0]=n,i[1]=n+r,o[0]=e/a,o[1]=t/a,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,r,i){var n=this._startTime;if(null!==n){if(t=(e-n)*r,0>t||0===r)return;this._startTime=null,t*=r}if(t*=this._updateTimeScale(e),r=this._updateTime(t),e=this._updateWeight(e),e>0){t=this._interpolants;for(var n=this._propertyBindings,o=0,a=t.length;o!==a;++o)t[o].evaluate(r),n[o].accumulate(i,e)}},_updateWeight:function(e){var t=0;if(this.enabled){var t=this.weight,r=this._weightInterpolant;if(null!==r){var i=r.evaluate(e)[0],t=t*i;e>r.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t},_updateTimeScale:function(e){var t=0;if(!this.paused){var t=this.timeScale,r=this._timeScaleInterpolant;if(null!==r){var i=r.evaluate(e)[0],t=t*i;e>r.parameterPositions[1]&&(this.stopWarping(),0===t?this.pause=!0:this.timeScale=t)}}return this._effectiveTimeScale=t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var r=this._clip.duration,i=this.loop,n=this._loopCount,o=!1;switch(i){case THREE.LoopOnce:if(-1===n&&(this.loopCount=0,this._setEndings(!0,!0,!1)),t>=r)t=r;else{if(!(0>t))break;t=0}this.clampWhenFinished?this.pause=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>e?-1:1});break;case THREE.LoopPingPong:o=!0;case THREE.LoopRepeat:if(-1===n&&(e>0?(n=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),t>=r||0>t){var a=Math.floor(t/r),t=t-r*a,n=n+Math.abs(a),s=this.repetitions-n;if(0>s){this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?r:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});break}0===s?(e=0>e,this._setEndings(e,!e,o)):this._setEndings(!1,!1,o),this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}if(i===THREE.LoopPingPong&&1===(1&n))return this.time=t,r-t}return this.time=t},_setEndings:function(e,t,r){var i=this._interpolantSettings;r?(i.endingStart=THREE.ZeroSlopeEnding,i.endingEnd=THREE.ZeroSlopeEnding):(i.endingStart=e?this.zeroSlopeAtStart?THREE.ZeroSlopeEnding:THREE.ZeroCurvatureEnding:THREE.WrapAroundEnding,i.endingEnd=t?this.zeroSlopeAtEnd?THREE.ZeroSlopeEnding:THREE.ZeroCurvatureEnding:THREE.WrapAroundEnding)},_scheduleFading:function(e,t,r){var i=this._mixer,n=i.time,o=this._weightInterpolant;return null===o&&(this._weightInterpolant=o=i._lendControlInterpolant()),i=o.parameterPositions,o=o.sampleValues,i[0]=n,o[0]=t,i[1]=n+e,o[1]=r,this}},Object.assign(THREE.AnimationMixer.prototype,{_bindAction:function(e,t){var r=e._localRoot||this._root,i=e._clip.tracks,n=i.length,o=e._propertyBindings,a=e._interpolants,s=r.uuid,c=this._bindingsByRootAndName,h=c[s];for(void 0===h&&(h={},c[s]=h),c=0;c!==n;++c){var l=i[c],u=l.name,p=h[u];if(void 0===p){if(p=o[c],void 0!==p){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,u));continue}p=new THREE.PropertyMixer(THREE.PropertyBinding.create(r,u,t&&t._propertyBindings[c].binding.parsedPath),l.ValueTypeName,l.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,s,u)}o[c]=p,a[c].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,r=e._clip.name,i=this._actionsByClip[r];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,r,t)}for(t=e._propertyBindings,r=0,i=t.length;r!==i;++r){var n=t[r];0===n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,r=0,i=t.length;r!==i;++r){var n=t[r];0===--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){return e=e._cacheIndex,null!==e&&e<this._nActiveActions},_addInactiveAction:function(e,t,r){var i=this._actions,n=this._actionsByClip,o=n[t];void 0===o?(o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,n[t]=o):(t=o.knownActions,e._byClipCacheIndex=t.length,t.push(e)),e._cacheIndex=i.length,i.push(e),o.actionByRoot[r]=e},_removeInactiveAction:function(e){var t=this._actions,r=t[t.length-1],i=e._cacheIndex;r._cacheIndex=i,t[i]=r,t.pop(),e._cacheIndex=null;var r=e._clip.name,i=this._actionsByClip,n=i[r],o=n.knownActions,a=o[o.length-1],s=e._byClipCacheIndex;a._byClipCacheIndex=s,o[s]=a,o.pop(),e._byClipCacheIndex=null,delete n.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete i[r],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){e=e._propertyBindings;for(var t=0,r=e.length;t!==r;++t){var i=e[t];0===--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(e){var t=this._actions,r=e._cacheIndex,i=this._nActiveActions++,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n},_takeBackAction:function(e){var t=this._actions,r=e._cacheIndex,i=--this._nActiveActions,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n},_addInactiveBinding:function(e,t,r){var i=this._bindingsByRootAndName,n=i[t],o=this._bindings;void 0===n&&(n={},i[t]=n),n[r]=e,e._cacheIndex=o.length,o.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,r=e.binding,i=r.rootNode.uuid,r=r.path,n=this._bindingsByRootAndName,o=n[i],a=t[t.length-1];e=e._cacheIndex,a._cacheIndex=e,t[e]=a,t.pop(),delete o[r];e:{for(var s in o)break e;delete n[i]}},_lendBinding:function(e){var t=this._bindings,r=e._cacheIndex,i=this._nActiveBindings++,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n},_takeBackBinding:function(e){var t=this._bindings,r=e._cacheIndex,i=--this._nActiveBindings,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return void 0===r&&(r=new THREE.LinearInterpolant(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=t,e[t]=r),r},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,r=e.__cacheIndex,i=--this._nActiveControlInterpolants,n=t[i];e.__cacheIndex=i,t[i]=e,n.__cacheIndex=r,t[r]=n},_controlInterpolantsResultBuffer:new Float32Array(1)}),THREE.AnimationObjectGroup=function(e){this.uuid=THREE.Math.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var r=0,i=arguments.length;r!==i;++r)t[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}},THREE.AnimationObjectGroup.prototype={constructor:THREE.AnimationObjectGroup,add:function(e){for(var t=this._objects,r=t.length,i=this.nCachedObjects_,n=this._indicesByUUID,o=this._paths,a=this._parsedPaths,s=this._bindings,c=s.length,h=0,l=arguments.length;h!==l;++h){var u=arguments[h],p=u.uuid,d=n[p];if(void 0===d){d=r++,n[p]=d,t.push(u);for(var p=0,E=c;p!==E;++p)s[p].push(new THREE.PropertyBinding(u,o[p],a[p]))}else if(i>d){var f=t[d],m=--i,E=t[m];for(n[E.uuid]=d,t[d]=E,n[p]=m,t[m]=u,p=0,E=c;p!==E;++p){var g=s[p],T=g[d];g[d]=g[m],void 0===T&&(T=new THREE.PropertyBinding(u,o[p],a[p])),g[m]=T}}else t[d]!==f&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=i},remove:function(e){for(var t=this._objects,r=this.nCachedObjects_,i=this._indicesByUUID,n=this._bindings,o=n.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],h=c.uuid,l=i[h];if(void 0!==l&&l>=r){var u=r++,p=t[u];for(i[p.uuid]=l,t[l]=p,i[h]=u,t[u]=c,c=0,h=o;c!==h;++c){var p=n[c],d=p[l];p[l]=p[u],p[u]=d}}}this.nCachedObjects_=r},uncache:function(e){for(var t=this._objects,r=t.length,i=this.nCachedObjects_,n=this._indicesByUUID,o=this._bindings,a=o.length,s=0,c=arguments.length;s!==c;++s){var h=arguments[s].uuid,l=n[h];if(void 0!==l)if(delete n[h],i>l){var h=--i,u=t[h],p=--r,d=t[p];for(n[u.uuid]=l,t[l]=u,n[d.uuid]=h,t[h]=d,t.pop(),u=0,d=a;u!==d;++u){var E=o[u],f=E[p];E[l]=E[h],E[h]=f,E.pop()}}else for(p=--r,d=t[p],n[d.uuid]=l,t[l]=d,t.pop(),u=0,d=a;u!==d;++u)E=o[u],E[l]=E[p],E.pop()}this.nCachedObjects_=i},subscribe_:function(e,t){var r=this._bindingsIndicesByPath,i=r[e],n=this._bindings;if(void 0!==i)return n[i];var o=this._paths,a=this._parsedPaths,s=this._objects,c=this.nCachedObjects_,h=Array(s.length),i=n.length;for(r[e]=i,o.push(e),a.push(t),n.push(h),r=c,i=s.length;r!==i;++r)h[r]=new THREE.PropertyBinding(s[r],e,t);return h},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,r=t[e];if(void 0!==r){var i=this._paths,n=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];t[e[a]]=r,o[r]=s,o.pop(),n[r]=n[a],n.pop(),i[r]=i[a],i.pop()}}},THREE.AnimationUtils={arraySlice:function(e,t,r){return THREE.AnimationUtils.isTypedArray(e)?new e.constructor(e.subarray(t,r)):e.slice(t,r)},convertArray:function(e,t,r){return!e||!r&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,r=Array(t),i=0;i!==t;++i)r[i]=i;return r.sort(function(t,r){return e[t]-e[r]}),r},sortedArray:function(e,t,r){for(var i=e.length,n=new e.constructor(i),o=0,a=0;a!==i;++o)for(var s=r[o]*t,c=0;c!==t;++c)n[a++]=e[s+c];return n},flattenJSON:function(e,t,r,i){for(var n=1,o=e[0];void 0!==o&&void 0===o[i];)o=e[n++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a)){do a=o[i],void 0!==a&&(t.push(o.time),r.push.apply(r,a)),o=e[n++];while(void 0!==o)}else if(void 0!==a.toArray){do a=o[i],void 0!==a&&(t.push(o.time),a.toArray(r,r.length)),o=e[n++];while(void 0!==o)}else do a=o[i],void 0!==a&&(t.push(o.time),r.push(a)),o=e[n++];while(void 0!==o)}}},THREE.KeyframeTrack=function(e,t,r,i){if(void 0===e)throw Error("track name is undefined");if(void 0===t||0===t.length)throw Error("no keyframes in track named "+e);this.name=e,this.times=THREE.AnimationUtils.convertArray(t,this.TimeBufferType),this.values=THREE.AnimationUtils.convertArray(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()},THREE.KeyframeTrack.prototype={constructor:THREE.KeyframeTrack,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:THREE.InterpolateLinear,InterpolantFactoryMethodDiscrete:function(e){return new THREE.DiscreteInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new THREE.LinearInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new THREE.CubicInterpolant(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t=void 0;switch(e){case THREE.InterpolateDiscrete:t=this.InterpolantFactoryMethodDiscrete;break;case THREE.InterpolateLinear:t=this.InterpolantFactoryMethodLinear;break;case THREE.InterpolateSmooth:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){if(t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name,void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw Error(t);this.setInterpolation(this.DefaultInterpolation)}console.warn(t)}else this.createInterpolant=t},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return THREE.InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return THREE.InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return THREE.InterpolateSmooth}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,r=0,i=t.length;r!==i;++r)t[r]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,r=0,i=t.length;r!==i;++r)t[r]*=e;return this},trim:function(e,t){for(var r=this.times,i=r.length,n=0,o=i-1;n!==i&&r[n]<e;)++n;for(;-1!==o&&r[o]>t;)--o;return++o,(0!==n||o!==i)&&(n>=o&&(o=Math.max(o,1),n=o-1),i=this.getValueSize(),this.times=THREE.AnimationUtils.arraySlice(r,n,o),this.values=THREE.AnimationUtils.arraySlice(this.values,n*i,o*i)),this},validate:function(){var e=!0,t=this.getValueSize();0!==t-Math.floor(t)&&(console.error("invalid value size in track",this),e=!1);var r=this.times,t=this.values,i=r.length;0===i&&(console.error("track is empty",this),e=!1);for(var n=null,o=0;o!==i;o++){var a=r[o];if("number"==typeof a&&isNaN(a)){console.error("time is not a valid number",this,o,a),e=!1;break}if(null!==n&&n>a){console.error("out of order keys",this,o,a,n),e=!1;break}n=a}if(void 0!==t&&THREE.AnimationUtils.isTypedArray(t))for(o=0,r=t.length;o!==r;++o)if(i=t[o],isNaN(i)){console.error("value is not a valid number",this,o,i),e=!1;break}return e},optimize:function(){for(var e=this.times,t=this.values,r=this.getValueSize(),i=1,n=1,o=e.length-1;o>=n;++n){var a=!1,s=e[n];if(s!==e[n+1]&&(1!==n||s!==s[0]))for(var c=n*r,h=c-r,l=c+r,s=0;s!==r;++s){var u=t[c+s];if(u!==t[h+s]||u!==t[l+s]){a=!0;break}}if(a){if(n!==i)for(e[i]=e[n],a=n*r,c=i*r,s=0;s!==r;++s)t[c+s]=t[a+s];++i}}return i!==e.length&&(this.times=THREE.AnimationUtils.arraySlice(e,0,i),this.values=THREE.AnimationUtils.arraySlice(t,0,i*r)),this}},Object.assign(THREE.KeyframeTrack,{parse:function(e){if(void 0===e.type)throw Error("track type undefined, can not parse");var t=THREE.KeyframeTrack._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){console.warn("legacy JSON format detected, converting");var r=[],i=[];THREE.AnimationUtils.flattenJSON(e.keys,r,i,"value"),e.times=r,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t=e.constructor;if(void 0!==t.toJSON)t=t.toJSON(e);else{var t={name:e.name,times:THREE.AnimationUtils.convertArray(e.times,Array),values:THREE.AnimationUtils.convertArray(e.values,Array)},r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return THREE.NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return THREE.VectorKeyframeTrack;case"color":return THREE.ColorKeyframeTrack;case"quaternion":return THREE.QuaternionKeyframeTrack;case"bool":case"boolean":return THREE.BooleanKeyframeTrack;case"string":return THREE.StringKeyframeTrack}throw Error("Unsupported typeName: "+e)}}),THREE.PropertyBinding=function(e,t,r){this.path=t,this.parsedPath=r||THREE.PropertyBinding.parseTrackName(t),this.node=THREE.PropertyBinding.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e},THREE.PropertyBinding.prototype={constructor:THREE.PropertyBinding,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,r=t.objectName,i=t.propertyName,n=t.propertyIndex;if(e||(this.node=e=THREE.PropertyBinding.findNode(this.rootNode,t.nodeName)||this.rootNode),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(r){var o=t.objectIndex;switch(r){case"materials":if(!e.material)return void console.error(" can not bind to material as node does not have a material",this);if(!e.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);for(e=e.skeleton.bones,r=0;r<e.length;r++)if(e[r].name===o){o=r;break}break;default:if(void 0===e[r])return void console.error(" can not bind to objectName of node, undefined",this);e=e[r]}if(void 0!==o){if(void 0===e[o])return void console.error(" trying to bind to objectIndex of objectName, but is undefined:",this,e);e=e[o]}}if(o=e[i]){if(t=this.Versioning.None,void 0!==e.needsUpdate?(t=this.Versioning.NeedsUpdate,this.targetObject=e):void 0!==e.matrixWorldNeedsUpdate&&(t=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=e),r=this.BindingType.Direct,void 0!==n){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!e.geometry.morphTargets)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(r=0;r<this.node.geometry.morphTargets.length;r++)if(e.geometry.morphTargets[r].name===n){n=r;break}}r=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=n}else void 0!==o.fromArray&&void 0!==o.toArray?(r=this.BindingType.HasFromToArray,this.resolvedProperty=o):void 0!==o.length?(r=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[r],this.setValue=this.SetterByBindingTypeAndVersioning[r][t]}else console.error(" trying to update property for track: "+t.nodeName+"."+i+" but it wasn't found.",e)}else console.error(" trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Object.assign(THREE.PropertyBinding.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:THREE.PropertyBinding.prototype.getValue,_setValue_unbound:THREE.PropertyBinding.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)e[t++]=r[i]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.node[this.propertyName]=e[t]},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++]},function(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),THREE.PropertyBinding.Composite=function(e,t,r){r=r||THREE.PropertyBinding.parseTrackName(t),this._targetGroup=e,this._bindings=e.subscribe_(t,r)},THREE.PropertyBinding.Composite.prototype={constructor:THREE.PropertyBinding.Composite,getValue:function(e,t){this.bind();var r=this._bindings[this._targetGroup.nCachedObjects_];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var r=this._bindings,i=this._targetGroup.nCachedObjects_,n=r.length;i!==n;++i)r[i].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}},THREE.PropertyBinding.create=function(e,t,r){return e instanceof THREE.AnimationObjectGroup?new THREE.PropertyBinding.Composite(e,t,r):new THREE.PropertyBinding(e,t,r)},THREE.PropertyBinding.parseTrackName=function(e){var t=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_.:\- ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,r=t.exec(e);if(!r)throw Error("cannot parse trackName at all: "+e);if(r.index===t.lastIndex&&t.lastIndex++,t={nodeName:r[3],objectName:r[5],objectIndex:r[7],propertyName:r[9],propertyIndex:r[11]},null===t.propertyName||0===t.propertyName.length)throw Error("can not parse propertyName from trackName: "+e);return t},THREE.PropertyBinding.findNode=function(e,t){if(!t||""===t||"root"===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var r=function(e){for(var r=0;r<e.bones.length;r++){var i=e.bones[r];if(i.name===t)return i}return null}(e.skeleton);if(r)return r}if(e.children){var i=function(e){for(var r=0;r<e.length;r++){var n=e[r];if(n.name===t||n.uuid===t||(n=i(n.children)))return n}return null};if(r=i(e.children))return r}return null},THREE.PropertyMixer=function(e,t,r){switch(this.binding=e,this.valueSize=r,e=Float64Array,t){case"quaternion":t=this._slerp;break;case"string":case"bool":e=Array,t=this._select;break;default:t=this._lerp}this.buffer=new e(4*r),this._mixBufferRegion=t,this.referenceCount=this.useCount=this.cumulativeWeight=0},THREE.PropertyMixer.prototype={constructor:THREE.PropertyMixer,accumulate:function(e,t){var r=this.buffer,i=this.valueSize,n=e*i+i,o=this.cumulativeWeight;if(0===o){for(o=0;o!==i;++o)r[n+o]=r[o];o=t}else o+=t,this._mixBufferRegion(r,n,0,t/o,i);this.cumulativeWeight=o},apply:function(e){var t=this.valueSize,r=this.buffer;e=e*t+t;var i=this.cumulativeWeight,n=this.binding;this.cumulativeWeight=0,1>i&&this._mixBufferRegion(r,e,3*t,1-i,t);for(var i=t,o=t+t;i!==o;++i)if(r[i]!==r[i+t]){n.setValue(r,e);break}},saveOriginalState:function(){var e=this.buffer,t=this.valueSize,r=3*t;this.binding.getValue(e,r);for(var i=t;i!==r;++i)e[i]=e[r+i%t];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(e,t,r,i,n){if(i>=.5)for(i=0;i!==n;++i)e[t+i]=e[r+i]},_slerp:function(e,t,r,i,n){THREE.Quaternion.slerpFlat(e,t,e,t,e,r,i)},_lerp:function(e,t,r,i,n){for(var o=1-i,a=0;a!==n;++a){var s=t+a;e[s]=e[s]*o+e[r+a]*i}}},THREE.BooleanKeyframeTrack=function(e,t,r){THREE.KeyframeTrack.call(this,e,t,r)},THREE.BooleanKeyframeTrack.prototype=Object.assign(Object.create(THREE.KeyframeTrack.prototype),{constructor:THREE.BooleanKeyframeTrack,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:THREE.InterpolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),THREE.ColorKeyframeTrack=function(e,t,r,i){THREE.KeyframeTrack.call(this,e,t,r,i)},THREE.ColorKeyframeTrack.prototype=Object.assign(Object.create(THREE.KeyframeTrack.prototype),{constructor:THREE.ColorKeyframeTrack,ValueTypeName:"color"}),THREE.NumberKeyframeTrack=function(e,t,r,i){THREE.KeyframeTrack.call(this,e,t,r,i)},THREE.NumberKeyframeTrack.prototype=Object.assign(Object.create(THREE.KeyframeTrack.prototype),{constructor:THREE.NumberKeyframeTrack,ValueTypeName:"number"}),THREE.QuaternionKeyframeTrack=function(e,t,r,i){THREE.KeyframeTrack.call(this,e,t,r,i)},THREE.QuaternionKeyframeTrack.prototype=Object.assign(Object.create(THREE.KeyframeTrack.prototype),{constructor:THREE.QuaternionKeyframeTrack,ValueTypeName:"quaternion",DefaultInterpolation:THREE.InterpolateLinear,InterpolantFactoryMethodLinear:function(e){return new THREE.QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),THREE.StringKeyframeTrack=function(e,t,r,i){THREE.KeyframeTrack.call(this,e,t,r,i)},THREE.StringKeyframeTrack.prototype=Object.assign(Object.create(THREE.KeyframeTrack.prototype),{constructor:THREE.StringKeyframeTrack,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:THREE.InterpolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),THREE.VectorKeyframeTrack=function(e,t,r,i){THREE.KeyframeTrack.call(this,e,t,r,i)},THREE.VectorKeyframeTrack.prototype=Object.assign(Object.create(THREE.KeyframeTrack.prototype),{constructor:THREE.VectorKeyframeTrack,ValueTypeName:"vector"}),THREE.Audio=function(e){THREE.Object3D.call(this),this.type="Audio",this.context=e.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filter=null},THREE.Audio.prototype=Object.create(THREE.Object3D.prototype),THREE.Audio.prototype.constructor=THREE.Audio,THREE.Audio.prototype.getOutput=function(){return this.gain},THREE.Audio.prototype.setNodeSource=function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},THREE.Audio.prototype.setBuffer=function(e){return this.source.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},THREE.Audio.prototype.play=function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else{var e=this.context.createBufferSource();e.buffer=this.source.buffer,e.loop=this.source.loop,e.onended=this.source.onended,e.start(0,this.startTime),e.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=e,this.connect()}},THREE.Audio.prototype.pause=function(){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=this.context.currentTime)},THREE.Audio.prototype.stop=function(){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=0)},THREE.Audio.prototype.connect=function(){null!==this.filter?(this.source.connect(this.filter),this.filter.connect(this.getOutput())):this.source.connect(this.getOutput())},THREE.Audio.prototype.disconnect=function(){null!==this.filter?(this.source.disconnect(this.filter),this.filter.disconnect(this.getOutput())):this.source.disconnect(this.getOutput())},THREE.Audio.prototype.getFilter=function(){return this.filter},THREE.Audio.prototype.setFilter=function(e){void 0===e&&(e=null),!0===this.isPlaying?(this.disconnect(),this.filter=e,this.connect()):this.filter=e},THREE.Audio.prototype.setPlaybackRate=function(e){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=e,!0===this.isPlaying&&(this.source.playbackRate.value=this.playbackRate))},THREE.Audio.prototype.getPlaybackRate=function(){return this.playbackRate},THREE.Audio.prototype.onEnded=function(){this.isPlaying=!1},THREE.Audio.prototype.setLoop=function(e){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):this.source.loop=e},THREE.Audio.prototype.getLoop=function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop},THREE.Audio.prototype.setVolume=function(e){this.gain.gain.value=e},THREE.Audio.prototype.getVolume=function(){return this.gain.gain.value},THREE.AudioAnalyser=function(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)},THREE.AudioAnalyser.prototype={constructor:THREE.AudioAnalyser,getData:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},Object.defineProperty(THREE,"AudioContext",{get:function(){var e;return function(){return void 0===e&&(e=new(window.AudioContext||window.webkitAudioContext)),e}}()}),THREE.PositionalAudio=function(e){THREE.Audio.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)},THREE.PositionalAudio.prototype=Object.create(THREE.Audio.prototype),THREE.PositionalAudio.prototype.constructor=THREE.PositionalAudio,THREE.PositionalAudio.prototype.getOutput=function(){return this.panner},THREE.PositionalAudio.prototype.setRefDistance=function(e){this.panner.refDistance=e},THREE.PositionalAudio.prototype.getRefDistance=function(){return this.panner.refDistance},THREE.PositionalAudio.prototype.setRolloffFactor=function(e){this.panner.rolloffFactor=e},THREE.PositionalAudio.prototype.getRolloffFactor=function(){return this.panner.rolloffFactor},THREE.PositionalAudio.prototype.setDistanceModel=function(e){this.panner.distanceModel=e},THREE.PositionalAudio.prototype.getDistanceModel=function(){return this.panner.distanceModel},THREE.PositionalAudio.prototype.setMaxDistance=function(e){this.panner.maxDistance=e},THREE.PositionalAudio.prototype.getMaxDistance=function(){return this.panner.maxDistance},THREE.PositionalAudio.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=THREE.AudioContext,this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null},THREE.AudioListener.prototype=Object.create(THREE.Object3D.prototype),THREE.AudioListener.prototype.constructor=THREE.AudioListener,THREE.AudioListener.prototype.getInput=function(){return this.gain},THREE.AudioListener.prototype.removeFilter=function(){null!==this.filter&&(this.gain.disconnect(this.filter), this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},THREE.AudioListener.prototype.setFilter=function(e){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},THREE.AudioListener.prototype.getFilter=function(){return this.filter},THREE.AudioListener.prototype.setMasterVolume=function(e){this.gain.gain.value=e},THREE.AudioListener.prototype.getMasterVolume=function(){return this.gain.gain.value},THREE.AudioListener.prototype.updateMatrixWorld=function(){var e=new THREE.Vector3,t=new THREE.Quaternion,r=new THREE.Vector3,i=new THREE.Vector3;return function(n){THREE.Object3D.prototype.updateMatrixWorld.call(this,n),n=this.context.listener;var o=this.up;this.matrixWorld.decompose(e,t,r),i.set(0,0,-1).applyQuaternion(t),n.setPosition(e.x,e.y,e.z),n.setOrientation(i.x,i.y,i.z,o.x,o.y,o.z)}}(),THREE.Camera=function(){THREE.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new THREE.Matrix4,this.projectionMatrix=new THREE.Matrix4},THREE.Camera.prototype=Object.create(THREE.Object3D.prototype),THREE.Camera.prototype.constructor=THREE.Camera,THREE.Camera.prototype.getWorldDirection=function(){var e=new THREE.Quaternion;return function(t){return t=t||new THREE.Vector3,this.getWorldQuaternion(e),t.set(0,0,-1).applyQuaternion(e)}}(),THREE.Camera.prototype.lookAt=function(){var e=new THREE.Matrix4;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),THREE.Camera.prototype.clone=function(){return(new this.constructor).copy(this)},THREE.Camera.prototype.copy=function(e){return THREE.Object3D.prototype.copy.call(this,e),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this},THREE.CubeCamera=function(e,t,r){THREE.Object3D.call(this),this.type="CubeCamera";var i=new THREE.PerspectiveCamera(90,1,e,t);i.up.set(0,-1,0),i.lookAt(new THREE.Vector3(1,0,0)),this.add(i);var n=new THREE.PerspectiveCamera(90,1,e,t);n.up.set(0,-1,0),n.lookAt(new THREE.Vector3(-1,0,0)),this.add(n);var o=new THREE.PerspectiveCamera(90,1,e,t);o.up.set(0,0,1),o.lookAt(new THREE.Vector3(0,1,0)),this.add(o);var a=new THREE.PerspectiveCamera(90,1,e,t);a.up.set(0,0,-1),a.lookAt(new THREE.Vector3(0,-1,0)),this.add(a);var s=new THREE.PerspectiveCamera(90,1,e,t);s.up.set(0,-1,0),s.lookAt(new THREE.Vector3(0,0,1)),this.add(s);var c=new THREE.PerspectiveCamera(90,1,e,t);c.up.set(0,-1,0),c.lookAt(new THREE.Vector3(0,0,-1)),this.add(c),this.renderTarget=new THREE.WebGLRenderTargetCube(r,r,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter}),this.updateCubeMap=function(e,t){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,h=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,e.render(t,i,r),r.activeCubeFace=1,e.render(t,n,r),r.activeCubeFace=2,e.render(t,o,r),r.activeCubeFace=3,e.render(t,a,r),r.activeCubeFace=4,e.render(t,s,r),r.texture.generateMipmaps=h,r.activeCubeFace=5,e.render(t,c,r),e.setRenderTarget(null)}},THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype),THREE.CubeCamera.prototype.constructor=THREE.CubeCamera,THREE.OrthographicCamera=function(e,t,r,i,n,o){THREE.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=e,this.right=t,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 e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(r-e,r+e,i+t,i-t,this.near,this.far)},THREE.OrthographicCamera.prototype.copy=function(e){return THREE.Camera.prototype.copy.call(this,e),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this},THREE.OrthographicCamera.prototype.toJSON=function(e){return e=THREE.Object3D.prototype.toJSON.call(this,e),e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,e},THREE.PerspectiveCamera=function(e,t,r,i){THREE.Camera.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==r?r:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()},THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype),THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera,THREE.PerspectiveCamera.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},THREE.PerspectiveCamera.prototype.setFocalLength=function(e){e=.5*this.getFilmHeight()/e,this.fov=2*THREE.Math.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},THREE.PerspectiveCamera.prototype.getFocalLength=function(){var e=Math.tan(.5*THREE.Math.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},THREE.PerspectiveCamera.prototype.getEffectiveFOV=function(){return 2*THREE.Math.RAD2DEG*Math.atan(Math.tan(.5*THREE.Math.DEG2RAD*this.fov)/this.zoom)},THREE.PerspectiveCamera.prototype.getFilmWidth=function(){return this.filmGauge*Math.min(this.aspect,1)},THREE.PerspectiveCamera.prototype.getFilmHeight=function(){return this.filmGauge/Math.max(this.aspect,1)},THREE.PerspectiveCamera.prototype.setViewOffset=function(e,t,r,i,n,o){this.aspect=e/t,this.view={fullWidth:e,fullHeight:t,offsetX:r,offsetY:i,width:n,height:o},this.updateProjectionMatrix()},THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var e=this.near,t=e*Math.tan(.5*THREE.Math.DEG2RAD*this.fov)/this.zoom,r=2*t,i=this.aspect*r,n=-.5*i,o=this.view;if(null!==o)var a=o.fullWidth,s=o.fullHeight,n=n+o.offsetX*i/a,t=t-o.offsetY*r/s,i=o.width/a*i,r=o.height/s*r;o=this.filmOffset,0!==o&&(n+=e*o/this.getFilmWidth()),this.projectionMatrix.makeFrustum(n,n+i,t-r,t,e,this.far)},THREE.PerspectiveCamera.prototype.copy=function(e){return THREE.Camera.prototype.copy.call(this,e),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},THREE.PerspectiveCamera.prototype.toJSON=function(e){return e=THREE.Object3D.prototype.toJSON.call(this,e),e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e},THREE.StereoCamera=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new THREE.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new THREE.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1},THREE.StereoCamera.prototype={constructor:THREE.StereoCamera,update:function(){var e,t,r,i,n,o=new THREE.Matrix4,a=new THREE.Matrix4;return function(s){if(e!==s.focus||t!==s.fov||r!==s.aspect*this.aspect||i!==s.near||n!==s.far){e=s.focus,t=s.fov,r=s.aspect*this.aspect,i=s.near,n=s.far;var c,h,l=s.projectionMatrix.clone(),u=.032*i/e,p=i*Math.tan(THREE.Math.DEG2RAD*t*.5);a.elements[12]=-.032,o.elements[12]=.032,c=-p*r+u,h=p*r+u,l.elements[0]=2*i/(h-c),l.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(l),c=-p*r-u,h=p*r-u,l.elements[0]=2*i/(h-c),l.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(l)}this.cameraL.matrixWorld.copy(s.matrixWorld).multiply(a),this.cameraR.matrixWorld.copy(s.matrixWorld).multiply(o)}}()},THREE.Light=function(e,t){THREE.Object3D.call(this),this.type="Light",this.color=new THREE.Color(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0},THREE.Light.prototype=Object.create(THREE.Object3D.prototype),THREE.Light.prototype.constructor=THREE.Light,THREE.Light.prototype.copy=function(e){return THREE.Object3D.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},THREE.Light.prototype.toJSON=function(e){return e=THREE.Object3D.prototype.toJSON.call(this,e),e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),e},THREE.LightShadow=function(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new THREE.Vector2(512,512),this.map=null,this.matrix=new THREE.Matrix4},THREE.LightShadow.prototype={constructor:THREE.LightShadow,copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)}},THREE.AmbientLight=function(e,t){THREE.Light.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0},THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype),THREE.AmbientLight.prototype.constructor=THREE.AmbientLight,THREE.DirectionalLight=function(e,t){THREE.Light.call(this,e,t),this.type="DirectionalLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new THREE.Object3D,this.shadow=new THREE.DirectionalLightShadow},THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype),THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight,THREE.DirectionalLight.prototype.copy=function(e){return THREE.Light.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},THREE.DirectionalLightShadow=function(e){THREE.LightShadow.call(this,new THREE.OrthographicCamera(-5,5,5,-5,.5,500))},THREE.DirectionalLightShadow.prototype=Object.create(THREE.LightShadow.prototype),THREE.DirectionalLightShadow.prototype.constructor=THREE.DirectionalLightShadow,THREE.HemisphereLight=function(e,t,r){THREE.Light.call(this,e,r),this.type="HemisphereLight",this.castShadow=void 0,this.position.set(0,1,0),this.updateMatrix(),this.groundColor=new THREE.Color(t)},THREE.HemisphereLight.prototype=Object.create(THREE.Light.prototype),THREE.HemisphereLight.prototype.constructor=THREE.HemisphereLight,THREE.HemisphereLight.prototype.copy=function(e){return THREE.Light.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this},THREE.PointLight=function(e,t,r,i){THREE.Light.call(this,e,t),this.type="PointLight",this.distance=void 0!==r?r:0,this.decay=void 0!==i?i:1,this.shadow=new THREE.LightShadow(new THREE.PerspectiveCamera(90,1,.5,500))},THREE.PointLight.prototype=Object.create(THREE.Light.prototype),THREE.PointLight.prototype.constructor=THREE.PointLight,Object.defineProperty(THREE.PointLight.prototype,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),THREE.PointLight.prototype.copy=function(e){return THREE.Light.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this},THREE.SpotLight=function(e,t,r,i,n,o){THREE.Light.call(this,e,t),this.type="SpotLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new THREE.Object3D,this.distance=void 0!==r?r:0,this.angle=void 0!==i?i:Math.PI/3,this.penumbra=void 0!==n?n:0,this.decay=void 0!==o?o:1,this.shadow=new THREE.SpotLightShadow},THREE.SpotLight.prototype=Object.create(THREE.Light.prototype),THREE.SpotLight.prototype.constructor=THREE.SpotLight,Object.defineProperty(THREE.SpotLight.prototype,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),THREE.SpotLight.prototype.copy=function(e){return THREE.Light.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},THREE.SpotLightShadow=function(){THREE.LightShadow.call(this,new THREE.PerspectiveCamera(50,1,.5,500))},THREE.SpotLightShadow.prototype=Object.create(THREE.LightShadow.prototype),THREE.SpotLightShadow.prototype.constructor=THREE.SpotLightShadow,THREE.SpotLightShadow.prototype.update=function(e){var t=2*THREE.Math.RAD2DEG*e.angle,r=this.mapSize.width/this.mapSize.height;e=e.distance||500;var i=this.camera;(t!==i.fov||r!==i.aspect||e!==i.far)&&(i.fov=t,i.aspect=r,i.far=e,i.updateProjectionMatrix())},THREE.AudioLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager},THREE.AudioLoader.prototype={constructor:THREE.AudioLoader,load:function(e,t,r,i){var n=new THREE.XHRLoader(this.manager);n.setResponseType("arraybuffer"),n.load(e,function(e){THREE.AudioContext.decodeAudioData(e,function(e){t(e)})},r,i)}},THREE.Cache={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){return!1!==this.enabled?this.files[e]:void 0},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},THREE.Loader=function(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:void 0,extractUrlBase:function(e){return e=e.split("/"),1===e.length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(e,t,r){for(var i=[],n=0;n<e.length;++n)i[n]=this.createMaterial(e[n],t,r);return i},createMaterial:function(){var e,t,r;return function(i,n,o){function a(e,r,i,a,s){e=n+e;var h=THREE.Loader.Handlers.get(e);return null!==h?e=h.load(e):(t.setCrossOrigin(o),e=t.load(e)),void 0!==r&&(e.repeat.fromArray(r),1!==r[0]&&(e.wrapS=THREE.RepeatWrapping),1!==r[1]&&(e.wrapT=THREE.RepeatWrapping)),void 0!==i&&e.offset.fromArray(i),void 0!==a&&("repeat"===a[0]&&(e.wrapS=THREE.RepeatWrapping),"mirror"===a[0]&&(e.wrapS=THREE.MirroredRepeatWrapping),"repeat"===a[1]&&(e.wrapT=THREE.RepeatWrapping),"mirror"===a[1]&&(e.wrapT=THREE.MirroredRepeatWrapping)),void 0!==s&&(e.anisotropy=s),r=THREE.Math.generateUUID(),c[r]=e,r}void 0===e&&(e=new THREE.Color),void 0===t&&(t=new THREE.TextureLoader),void 0===r&&(r=new THREE.MaterialLoader);var s,c={},h={uuid:THREE.Math.generateUUID(),type:"MeshLambertMaterial"};for(s in i){var l=i[s];switch(s){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":h.name=l;break;case"blending":h.blending=THREE[l];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",s,"is no longer supported.");break;case"colorDiffuse":h.color=e.fromArray(l).getHex();break;case"colorSpecular":h.specular=e.fromArray(l).getHex();break;case"colorEmissive":h.emissive=e.fromArray(l).getHex();break;case"specularCoef":h.shininess=l;break;case"shading":"basic"===l.toLowerCase()&&(h.type="MeshBasicMaterial"),"phong"===l.toLowerCase()&&(h.type="MeshPhongMaterial");break;case"mapDiffuse":h.map=a(l,i.mapDiffuseRepeat,i.mapDiffuseOffset,i.mapDiffuseWrap,i.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapLight":h.lightMap=a(l,i.mapLightRepeat,i.mapLightOffset,i.mapLightWrap,i.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":h.aoMap=a(l,i.mapAORepeat,i.mapAOOffset,i.mapAOWrap,i.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":h.bumpMap=a(l,i.mapBumpRepeat,i.mapBumpOffset,i.mapBumpWrap,i.mapBumpAnisotropy);break;case"mapBumpScale":h.bumpScale=l;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":h.normalMap=a(l,i.mapNormalRepeat,i.mapNormalOffset,i.mapNormalWrap,i.mapNormalAnisotropy);break;case"mapNormalFactor":h.normalScale=[l,l];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":h.specularMap=a(l,i.mapSpecularRepeat,i.mapSpecularOffset,i.mapSpecularWrap,i.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapAlpha":h.alphaMap=a(l,i.mapAlphaRepeat,i.mapAlphaOffset,i.mapAlphaWrap,i.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":h.side=THREE.BackSide;break;case"doubleSided":h.side=THREE.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),h.opacity=l;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":h[s]=l;break;case"vertexColors":!0===l&&(h.vertexColors=THREE.VertexColors),"face"===l&&(h.vertexColors=THREE.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",s,l)}}return"MeshBasicMaterial"===h.type&&delete h.emissive,"MeshPhongMaterial"!==h.type&&delete h.specular,1>h.opacity&&(h.transparent=!0),r.setTextures(c),r.parse(h)}}()},THREE.Loader.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,r=0,i=t.length;i>r;r+=2){var n=t[r+1];if(t[r].test(e))return n}return null}},THREE.XHRLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager},THREE.XHRLoader.prototype={constructor:THREE.XHRLoader,load:function(e,t,r,i){void 0!==this.path&&(e=this.path+e);var n=this,o=THREE.Cache.get(e);if(void 0!==o)return t&&setTimeout(function(){t(o)},0),o;var a=new XMLHttpRequest;return a.overrideMimeType("text/plain"),a.open("GET",e,!0),a.addEventListener("load",function(r){var o=r.target.response;THREE.Cache.add(e,o),200===this.status?(t&&t(o),n.manager.itemEnd(e)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),t&&t(o),n.manager.itemEnd(e)):(i&&i(r),n.manager.itemError(e))},!1),void 0!==r&&a.addEventListener("progress",function(e){r(e)},!1),a.addEventListener("error",function(t){i&&i(t),n.manager.itemError(e)},!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.send(null),n.manager.itemStart(e),a},setPath:function(e){this.path=e},setResponseType:function(e){this.responseType=e},setWithCredentials:function(e){this.withCredentials=e}},THREE.FontLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager},THREE.FontLoader.prototype={constructor:THREE.FontLoader,load:function(e,t,r,i){new THREE.XHRLoader(this.manager).load(e,function(e){t(new THREE.Font(JSON.parse(e.substring(65,e.length-2))))},r,i)}},THREE.ImageLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager},THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(e,t,r,i){void 0!==this.path&&(e=this.path+e);var n=this,o=THREE.Cache.get(e);if(void 0!==o)return n.manager.itemStart(e),t?setTimeout(function(){t(o),n.manager.itemEnd(e)},0):n.manager.itemEnd(e),o;var a=document.createElement("img");return a.addEventListener("load",function(r){THREE.Cache.add(e,this),t&&t(this),n.manager.itemEnd(e)},!1),void 0!==r&&a.addEventListener("progress",function(e){r(e)},!1),a.addEventListener("error",function(t){i&&i(t),n.manager.itemError(e)},!1),void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),n.manager.itemStart(e),a.src=e,a},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},THREE.JSONLoader=function(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:THREE.DefaultLoadingManager,this.withCredentials=!1},THREE.JSONLoader.prototype={constructor:THREE.JSONLoader,get statusDomElement(){return void 0===this._statusDomElement&&(this._statusDomElement=document.createElement("div")),console.warn("THREE.JSONLoader: .statusDomElement has been removed."),this._statusDomElement},load:function(e,t,r,i){var n=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:THREE.Loader.prototype.extractUrlBase(e),a=new THREE.XHRLoader(this.manager);a.setWithCredentials(this.withCredentials),a.load(e,function(r){r=JSON.parse(r);var i=r.metadata;if(void 0!==i&&(i=i.type,void 0!==i)){if("object"===i.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.");if("scene"===i.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.SceneLoader instead.")}r=n.parse(r,o),t(r.geometry,r.materials)},r,i)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){var r=new THREE.Geometry,i=void 0!==e.scale?1/e.scale:1;return function(t){var i,n,o,a,s,c,h,l,u,p,d,E,f,m=e.faces;c=e.vertices;var g=e.normals,T=e.colors,v=0;if(void 0!==e.uvs){for(i=0;i<e.uvs.length;i++)e.uvs[i].length&&v++;for(i=0;v>i;i++)r.faceVertexUvs[i]=[]}for(a=0,s=c.length;s>a;)i=new THREE.Vector3,i.x=c[a++]*t,i.y=c[a++]*t,i.z=c[a++]*t,r.vertices.push(i);for(a=0,s=m.length;s>a;)if(t=m[a++],u=1&t,o=2&t,i=8&t,h=16&t,p=32&t,c=64&t,t&=128,u){if(u=new THREE.Face3,u.a=m[a],u.b=m[a+1],u.c=m[a+3],d=new THREE.Face3,d.a=m[a+1],d.b=m[a+2],d.c=m[a+3],a+=4,o&&(o=m[a++],u.materialIndex=o,d.materialIndex=o),o=r.faces.length,i)for(i=0;v>i;i++)for(E=e.uvs[i],r.faceVertexUvs[i][o]=[],r.faceVertexUvs[i][o+1]=[],n=0;4>n;n++)l=m[a++],f=E[2*l],l=E[2*l+1],f=new THREE.Vector2(f,l),2!==n&&r.faceVertexUvs[i][o].push(f),0!==n&&r.faceVertexUvs[i][o+1].push(f);if(h&&(h=3*m[a++],u.normal.set(g[h++],g[h++],g[h]),d.normal.copy(u.normal)),p)for(i=0;4>i;i++)h=3*m[a++],p=new THREE.Vector3(g[h++],g[h++],g[h]),2!==i&&u.vertexNormals.push(p),0!==i&&d.vertexNormals.push(p);if(c&&(c=m[a++],c=T[c],u.color.setHex(c),d.color.setHex(c)),t)for(i=0;4>i;i++)c=m[a++],c=T[c],2!==i&&u.vertexColors.push(new THREE.Color(c)),0!==i&&d.vertexColors.push(new THREE.Color(c));r.faces.push(u),r.faces.push(d)}else{if(u=new THREE.Face3,u.a=m[a++],u.b=m[a++],u.c=m[a++],o&&(o=m[a++],u.materialIndex=o),o=r.faces.length,i)for(i=0;v>i;i++)for(E=e.uvs[i],r.faceVertexUvs[i][o]=[],n=0;3>n;n++)l=m[a++],f=E[2*l],l=E[2*l+1],f=new THREE.Vector2(f,l),r.faceVertexUvs[i][o].push(f);if(h&&(h=3*m[a++],u.normal.set(g[h++],g[h++],g[h])),p)for(i=0;3>i;i++)h=3*m[a++],p=new THREE.Vector3(g[h++],g[h++],g[h]),u.vertexNormals.push(p);if(c&&(c=m[a++],u.color.setHex(T[c])),t)for(i=0;3>i;i++)c=m[a++],u.vertexColors.push(new THREE.Color(T[c]));r.faces.push(u)}}(i),function(){var t=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var i=0,n=e.skinWeights.length;n>i;i+=t)r.skinWeights.push(new THREE.Vector4(e.skinWeights[i],t>1?e.skinWeights[i+1]:0,t>2?e.skinWeights[i+2]:0,t>3?e.skinWeights[i+3]:0));if(e.skinIndices)for(i=0,n=e.skinIndices.length;n>i;i+=t)r.skinIndices.push(new THREE.Vector4(e.skinIndices[i],t>1?e.skinIndices[i+1]:0,t>2?e.skinIndices[i+2]:0,t>3?e.skinIndices[i+3]:0));r.bones=e.bones,r.bones&&0<r.bones.length&&(r.skinWeights.length!==r.skinIndices.length||r.skinIndices.length!==r.vertices.length)&&console.warn("When skinning, number of vertices ("+r.vertices.length+"), skinIndices ("+r.skinIndices.length+"), and skinWeights ("+r.skinWeights.length+") should match.")}(),function(t){if(void 0!==e.morphTargets)for(var i=0,n=e.morphTargets.length;n>i;i++){r.morphTargets[i]={},r.morphTargets[i].name=e.morphTargets[i].name,r.morphTargets[i].vertices=[];for(var o=r.morphTargets[i].vertices,a=e.morphTargets[i].vertices,s=0,c=a.length;c>s;s+=3){var h=new THREE.Vector3;h.x=a[s]*t,h.y=a[s+1]*t,h.z=a[s+2]*t,o.push(h)}}if(void 0!==e.morphColors&&0<e.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),t=r.faces,o=e.morphColors[0].colors,i=0,n=t.length;n>i;i++)t[i].color.fromArray(o,3*i)}(i),function(){var t=[],i=[];void 0!==e.animation&&i.push(e.animation),void 0!==e.animations&&(e.animations.length?i=i.concat(e.animations):i.push(e.animations));for(var n=0;n<i.length;n++){var o=THREE.AnimationClip.parseAnimation(i[n],r.bones);o&&t.push(o)}r.morphTargets&&(i=THREE.AnimationClip.CreateClipsFromMorphTargetSequences(r.morphTargets,10),t=t.concat(i)),0<t.length&&(r.animations=t)}(),r.computeFaceNormals(),r.computeBoundingSphere(),void 0===e.materials||0===e.materials.length?{geometry:r}:(i=THREE.Loader.prototype.initMaterials(e.materials,t,this.crossOrigin),{geometry:r,materials:i})}},THREE.LoadingManager=function(e,t,r){var i=this,n=!1,o=0,a=0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){a++,!1===n&&void 0!==i.onStart&&i.onStart(e,o,a),n=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,a),o===a&&(n=!1,void 0!==i.onLoad)&&i.onLoad()},this.itemError=function(e){void 0!==i.onError&&i.onError(e)}},THREE.DefaultLoadingManager=new THREE.LoadingManager,THREE.BufferGeometryLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager},THREE.BufferGeometryLoader.prototype={constructor:THREE.BufferGeometryLoader,load:function(e,t,r,i){var n=this;new THREE.XHRLoader(n.manager).load(e,function(e){t(n.parse(JSON.parse(e)))},r,i)},parse:function(e){var t=new THREE.BufferGeometry,r=e.data.index,i={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};void 0!==r&&(r=new i[r.type](r.array),t.setIndex(new THREE.BufferAttribute(r,1)));var n,o=e.data.attributes;for(n in o){var a=o[n],r=new i[a.type](a.array);t.addAttribute(n,new THREE.BufferAttribute(r,a.itemSize,a.normalized))}if(i=e.data.groups||e.data.drawcalls||e.data.offsets,void 0!==i)for(n=0,r=i.length;n!==r;++n)o=i[n],t.addGroup(o.start,o.count,o.materialIndex);return e=e.data.boundingSphere,void 0!==e&&(i=new THREE.Vector3,void 0!==e.center&&i.fromArray(e.center),t.boundingSphere=new THREE.Sphere(i,e.radius)),t}},THREE.MaterialLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager,this.textures={}},THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(e,t,r,i){var n=this;new THREE.XHRLoader(n.manager).load(e,function(e){t(n.parse(JSON.parse(e)))},r,i)},setTextures:function(e){this.textures=e},getTexture:function(e){var t=this.textures;return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]},parse:function(e){var t=new THREE[e.type];if(void 0!==e.uuid&&(t.uuid=e.uuid),void 0!==e.name&&(t.name=e.name),void 0!==e.color&&t.color.setHex(e.color),void 0!==e.roughness&&(t.roughness=e.roughness),void 0!==e.metalness&&(t.metalness=e.metalness),void 0!==e.emissive&&t.emissive.setHex(e.emissive),void 0!==e.specular&&t.specular.setHex(e.specular),void 0!==e.shininess&&(t.shininess=e.shininess),void 0!==e.uniforms&&(t.uniforms=e.uniforms),void 0!==e.vertexShader&&(t.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(t.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(t.vertexColors=e.vertexColors),void 0!==e.shading&&(t.shading=e.shading),void 0!==e.blending&&(t.blending=e.blending),void 0!==e.side&&(t.side=e.side),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e.transparent&&(t.transparent=e.transparent),void 0!==e.alphaTest&&(t.alphaTest=e.alphaTest),void 0!==e.depthTest&&(t.depthTest=e.depthTest),void 0!==e.depthWrite&&(t.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(t.colorWrite=e.colorWrite),void 0!==e.wireframe&&(t.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(t.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.size&&(t.size=e.size),void 0!==e.sizeAttenuation&&(t.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(t.map=this.getTexture(e.map)),void 0!==e.alphaMap&&(t.alphaMap=this.getTexture(e.alphaMap),t.transparent=!0),void 0!==e.bumpMap&&(t.bumpMap=this.getTexture(e.bumpMap)),void 0!==e.bumpScale&&(t.bumpScale=e.bumpScale),void 0!==e.normalMap&&(t.normalMap=this.getTexture(e.normalMap)),void 0!==e.normalScale){var r=e.normalScale;!1===Array.isArray(r)&&(r=[r,r]),t.normalScale=(new THREE.Vector2).fromArray(r)}if(void 0!==e.displacementMap&&(t.displacementMap=this.getTexture(e.displacementMap)),void 0!==e.displacementScale&&(t.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(t.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(t.roughnessMap=this.getTexture(e.roughnessMap)),void 0!==e.metalnessMap&&(t.metalnessMap=this.getTexture(e.metalnessMap)),void 0!==e.emissiveMap&&(t.emissiveMap=this.getTexture(e.emissiveMap)),void 0!==e.emissiveIntensity&&(t.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(t.specularMap=this.getTexture(e.specularMap)),void 0!==e.envMap&&(t.envMap=this.getTexture(e.envMap),t.combine=THREE.MultiplyOperation),e.reflectivity&&(t.reflectivity=e.reflectivity),void 0!==e.lightMap&&(t.lightMap=this.getTexture(e.lightMap)),void 0!==e.lightMapIntensity&&(t.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(t.aoMap=this.getTexture(e.aoMap)),void 0!==e.aoMapIntensity&&(t.aoMapIntensity=e.aoMapIntensity),void 0!==e.materials)for(var r=0,i=e.materials.length;i>r;r++)t.materials.push(this.parse(e.materials[r]));return t}},THREE.ObjectLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager,this.texturePath=""},THREE.ObjectLoader.prototype={constructor:THREE.ObjectLoader,load:function(e,t,r,i){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var n=this;new THREE.XHRLoader(n.manager).load(e,function(e){n.parse(JSON.parse(e),t)},r,i)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var r=this.parseGeometries(e.geometries),i=this.parseImages(e.images,function(){void 0!==t&&t(n)}),i=this.parseTextures(e.textures,i),i=this.parseMaterials(e.materials,i),n=this.parseObject(e.object,r,i);return e.animations&&(n.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0===t||t(n),n},parseGeometries:function(e){var t={};if(void 0!==e)for(var r=new THREE.JSONLoader,i=new THREE.BufferGeometryLoader,n=0,o=e.length;o>n;n++){var a,s=e[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"BoxBufferGeometry":case"CubeGeometry":a=new THREE[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":a=new THREE[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":a=new THREE[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":a=new THREE[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":a=new THREE.DodecahedronGeometry(s.radius,s.detail);break;case"IcosahedronGeometry":a=new THREE.IcosahedronGeometry(s.radius,s.detail);break;case"OctahedronGeometry":a=new THREE.OctahedronGeometry(s.radius,s.detail);break;case"TetrahedronGeometry":a=new THREE.TetrahedronGeometry(s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":a=new THREE[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":a=new THREE[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc); break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":a=new THREE[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":a=new THREE[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":a=i.parse(s);break;case"Geometry":a=r.parse(s.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),t[s.uuid]=a}return t},parseMaterials:function(e,t){var r={};if(void 0!==e){var i=new THREE.MaterialLoader;i.setTextures(t);for(var n=0,o=e.length;o>n;n++){var a=i.parse(e[n]);r[a.uuid]=a}}return r},parseAnimations:function(e){for(var t=[],r=0;r<e.length;r++){var i=THREE.AnimationClip.parse(e[r]);t.push(i)}return t},parseImages:function(e,t){function r(e){return i.manager.itemStart(e),a.load(e,function(){i.manager.itemEnd(e)})}var i=this,n={};if(void 0!==e&&0<e.length){var o=new THREE.LoadingManager(t),a=new THREE.ImageLoader(o);a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;s>o;o++){var c=e[o],h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:i.texturePath+c.url;n[c.uuid]=r(h)}}return n},parseTextures:function(e,t){function r(e){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),THREE[e])}var i={};if(void 0!==e)for(var n=0,o=e.length;o>n;n++){var a=e[n];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===t[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);var s=new THREE.Texture(t[a.image]);s.needsUpdate=!0,s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),void 0!==a.mapping&&(s.mapping=r(a.mapping)),void 0!==a.offset&&(s.offset=new THREE.Vector2(a.offset[0],a.offset[1])),void 0!==a.repeat&&(s.repeat=new THREE.Vector2(a.repeat[0],a.repeat[1])),void 0!==a.minFilter&&(s.minFilter=r(a.minFilter)),void 0!==a.magFilter&&(s.magFilter=r(a.magFilter)),void 0!==a.anisotropy&&(s.anisotropy=a.anisotropy),Array.isArray(a.wrap)&&(s.wrapS=r(a.wrap[0]),s.wrapT=r(a.wrap[1])),i[a.uuid]=s}return i},parseObject:function(){var e=new THREE.Matrix4;return function(t,r,i){function n(e){return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),r[e]}function o(e){return void 0!==e?(void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),i[e]):void 0}var a;switch(t.type){case"Scene":a=new THREE.Scene;break;case"PerspectiveCamera":a=new THREE.PerspectiveCamera(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(a.focus=t.focus),void 0!==t.zoom&&(a.zoom=t.zoom),void 0!==t.filmGauge&&(a.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(a.filmOffset=t.filmOffset),void 0!==t.view&&(a.view=Object.assign({},t.view));break;case"OrthographicCamera":a=new THREE.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":a=new THREE.AmbientLight(t.color,t.intensity);break;case"DirectionalLight":a=new THREE.DirectionalLight(t.color,t.intensity);break;case"PointLight":a=new THREE.PointLight(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":a=new THREE.SpotLight(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":a=new THREE.HemisphereLight(t.color,t.groundColor,t.intensity);break;case"Mesh":a=n(t.geometry);var s=o(t.material);a=a.bones&&0<a.bones.length?new THREE.SkinnedMesh(a,s):new THREE.Mesh(a,s);break;case"LOD":a=new THREE.LOD;break;case"Line":a=new THREE.Line(n(t.geometry),o(t.material),t.mode);break;case"PointCloud":case"Points":a=new THREE.Points(n(t.geometry),o(t.material));break;case"Sprite":a=new THREE.Sprite(o(t.material));break;case"Group":a=new THREE.Group;break;default:a=new THREE.Object3D}if(a.uuid=t.uuid,void 0!==t.name&&(a.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(a.position,a.quaternion,a.scale)):(void 0!==t.position&&a.position.fromArray(t.position),void 0!==t.rotation&&a.rotation.fromArray(t.rotation),void 0!==t.scale&&a.scale.fromArray(t.scale)),void 0!==t.castShadow&&(a.castShadow=t.castShadow),void 0!==t.receiveShadow&&(a.receiveShadow=t.receiveShadow),void 0!==t.visible&&(a.visible=t.visible),void 0!==t.userData&&(a.userData=t.userData),void 0!==t.children)for(var c in t.children)a.add(this.parseObject(t.children[c],r,i));if("LOD"===t.type)for(t=t.levels,s=0;s<t.length;s++){var h=t[s];c=a.getObjectByProperty("uuid",h.object),void 0!==c&&a.addLevel(c,h.distance)}return a}}()},THREE.TextureLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager},THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(e,t,r,i){var n=new THREE.Texture,o=new THREE.ImageLoader(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(e){n.image=e,n.needsUpdate=!0,void 0!==t&&t(n)},r,i),n},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},THREE.CubeTextureLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager},THREE.CubeTextureLoader.prototype={constructor:THREE.CubeTextureLoader,load:function(e,t,r,i){function n(r){a.load(e[r],function(e){o.images[r]=e,s++,6===s&&(o.needsUpdate=!0,t&&t(o))},void 0,i)}var o=new THREE.CubeTexture,a=new THREE.ImageLoader(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var s=0;for(r=0;r<e.length;++r)n(r);return o},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},THREE.DataTextureLoader=THREE.BinaryTextureLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager,this._parser=null},THREE.BinaryTextureLoader.prototype={constructor:THREE.BinaryTextureLoader,load:function(e,t,r,i){var n=this,o=new THREE.DataTexture,a=new THREE.XHRLoader(this.manager);return a.setResponseType("arraybuffer"),a.load(e,function(e){(e=n._parser(e))&&(void 0!==e.image?o.image=e.image:void 0!==e.data&&(o.image.width=e.width,o.image.height=e.height,o.image.data=e.data),o.wrapS=void 0!==e.wrapS?e.wrapS:THREE.ClampToEdgeWrapping,o.wrapT=void 0!==e.wrapT?e.wrapT:THREE.ClampToEdgeWrapping,o.magFilter=void 0!==e.magFilter?e.magFilter:THREE.LinearFilter,o.minFilter=void 0!==e.minFilter?e.minFilter:THREE.LinearMipMapLinearFilter,o.anisotropy=void 0!==e.anisotropy?e.anisotropy:1,void 0!==e.format&&(o.format=e.format),void 0!==e.type&&(o.type=e.type),void 0!==e.mipmaps&&(o.mipmaps=e.mipmaps),1===e.mipmapCount&&(o.minFilter=THREE.LinearFilter),o.needsUpdate=!0,t&&t(o,e))},r,i),o}},THREE.CompressedTextureLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager,this._parser=null},THREE.CompressedTextureLoader.prototype={constructor:THREE.CompressedTextureLoader,load:function(e,t,r,i){function n(n){c.load(e[n],function(e){e=o._parser(e,!0),a[n]={width:e.width,height:e.height,format:e.format,mipmaps:e.mipmaps},h+=1,6===h&&(1===e.mipmapCount&&(s.minFilter=THREE.LinearFilter),s.format=e.format,s.needsUpdate=!0,t&&t(s))},r,i)}var o=this,a=[],s=new THREE.CompressedTexture;s.image=a;var c=new THREE.XHRLoader(this.manager);if(c.setPath(this.path),c.setResponseType("arraybuffer"),Array.isArray(e))for(var h=0,l=0,u=e.length;u>l;++l)n(l);else c.load(e,function(e){if(e=o._parser(e,!0),e.isCubemap)for(var r=e.mipmaps.length/e.mipmapCount,i=0;r>i;i++){a[i]={mipmaps:[]};for(var n=0;n<e.mipmapCount;n++)a[i].mipmaps.push(e.mipmaps[i*e.mipmapCount+n]),a[i].format=e.format,a[i].width=e.width,a[i].height=e.height}else s.image.width=e.width,s.image.height=e.height,s.mipmaps=e.mipmaps;1===e.mipmapCount&&(s.minFilter=THREE.LinearFilter),s.format=e.format,s.needsUpdate=!0,t&&t(s)},r,i);return s},setPath:function(e){this.path=e}},THREE.Material=function(){Object.defineProperty(this,"id",{value:THREE.MaterialIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="Material",this.side=THREE.FrontSide,this.opacity=1,this.transparent=!1,this.blending=THREE.NormalBlending,this.blendSrc=THREE.SrcAlphaFactor,this.blendDst=THREE.OneMinusSrcAlphaFactor,this.blendEquation=THREE.AddEquation,this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null,this.depthFunc=THREE.LessEqualDepth,this.depthWrite=this.depthTest=!0,this.clippingPlanes=null,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0,this.premultipliedAlpha=!1,this.overdraw=0,this._needsUpdate=this.visible=!0},THREE.Material.prototype={constructor:THREE.Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){!0===e&&this.update(),this._needsUpdate=e},setValues:function(e){if(void 0!==e)for(var t in e){var r=e[t];if(void 0===r)console.warn("THREE.Material: '"+t+"' parameter is undefined.");else{var i=this[t];void 0===i?console.warn("THREE."+this.type+": '"+t+"' is not a property of this material."):i instanceof THREE.Color?i.set(r):i instanceof THREE.Vector3&&r instanceof THREE.Vector3?i.copy(r):this[t]="overdraw"===t?Number(r):r}}},toJSON:function(e){function t(e){var t,r=[];for(t in e){var i=e[t];delete i.metadata,r.push(i)}return r}var r=void 0===e;r&&(e={textures:{},images:{}});var i={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};return i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color instanceof THREE.Color&&(i.color=this.color.getHex()),.5!==this.roughness&&(i.roughness=this.roughness),.5!==this.metalness&&(i.metalness=this.metalness),this.emissive instanceof THREE.Color&&(i.emissive=this.emissive.getHex()),this.specular instanceof THREE.Color&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),this.map instanceof THREE.Texture&&(i.map=this.map.toJSON(e).uuid),this.alphaMap instanceof THREE.Texture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap instanceof THREE.Texture&&(i.lightMap=this.lightMap.toJSON(e).uuid),this.bumpMap instanceof THREE.Texture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap instanceof THREE.Texture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalScale=this.normalScale.toArray()),this.displacementMap instanceof THREE.Texture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap instanceof THREE.Texture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap instanceof THREE.Texture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap instanceof THREE.Texture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap instanceof THREE.Texture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.envMap instanceof THREE.Texture&&(i.envMap=this.envMap.toJSON(e).uuid,i.reflectivity=this.reflectivity),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),void 0!==this.vertexColors&&this.vertexColors!==THREE.NoColors&&(i.vertexColors=this.vertexColors),void 0!==this.shading&&this.shading!==THREE.SmoothShading&&(i.shading=this.shading),void 0!==this.blending&&this.blending!==THREE.NormalBlending&&(i.blending=this.blending),void 0!==this.side&&this.side!==THREE.FrontSide&&(i.side=this.side),1>this.opacity&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),0<this.alphaTest&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),1<this.wireframeLinewidth&&(i.wireframeLinewidth=this.wireframeLinewidth),r&&(r=t(e.textures),e=t(e.images),0<r.length&&(i.textures=r),0<e.length&&(i.images=e)),i},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.side=e.side,this.opacity=e.opacity,this.transparent=e.transparent,this.blending=e.blending,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.clipShadows=e.clipShadows,e=e.clippingPlanes;var t=null;if(null!==e)for(var r=e.length,t=Array(r),i=0;i!==r;++i)t[i]=e[i].clone();return this.clippingPlanes=t,this},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(e){THREE.Material.call(this),this.type="LineBasicMaterial",this.color=new THREE.Color(16777215),this.linewidth=1,this.linejoin=this.linecap="round",this.blending=THREE.NormalBlending,this.vertexColors=THREE.NoColors,this.fog=!0,this.setValues(e)},THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype),THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial,THREE.LineBasicMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.vertexColors=e.vertexColors,this.fog=e.fog,this},THREE.LineDashedMaterial=function(e){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.blending=THREE.NormalBlending,this.vertexColors=THREE.NoColors,this.fog=!0,this.setValues(e)},THREE.LineDashedMaterial.prototype=Object.create(THREE.Material.prototype),THREE.LineDashedMaterial.prototype.constructor=THREE.LineDashedMaterial,THREE.LineDashedMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this.vertexColors=e.vertexColors,this.fog=e.fog,this},THREE.MeshBasicMaterial=function(e){THREE.Material.call(this),this.type="MeshBasicMaterial",this.color=new THREE.Color(16777215),this.aoMap=this.map=null,this.aoMapIntensity=1,this.envMap=this.alphaMap=this.specularMap=null,this.combine=THREE.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=THREE.SmoothShading,this.blending=THREE.NormalBlending,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=THREE.NoColors,this.morphTargets=this.skinning=!1,this.setValues(e)},THREE.MeshBasicMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial,THREE.MeshBasicMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},THREE.MeshDepthMaterial=function(e){THREE.Material.call(this),this.type="MeshDepthMaterial",this.depthPacking=THREE.BasicDepthPacking,this.morphTargets=this.skinning=!1,this.displacementMap=this.alphaMap=this.map=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)},THREE.MeshDepthMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial,THREE.MeshDepthMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},THREE.MeshLambertMaterial=function(e){THREE.Material.call(this),this.type="MeshLambertMaterial",this.color=new THREE.Color(16777215),this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new THREE.Color(0),this.emissiveIntensity=1,this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null,this.combine=THREE.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.blending=THREE.NormalBlending,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=THREE.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(e)},THREE.MeshLambertMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial,THREE.MeshLambertMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},THREE.MeshNormalMaterial=function(e){THREE.Material.call(this,e),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(e)},THREE.MeshNormalMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial,THREE.MeshNormalMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},THREE.MeshPhongMaterial=function(e){THREE.Material.call(this),this.type="MeshPhongMaterial",this.color=new THREE.Color(16777215),this.specular=new THREE.Color(1118481),this.shininess=30,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new THREE.Color(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new THREE.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.specularMap=null,this.combine=THREE.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=THREE.SmoothShading,this.blending=THREE.NormalBlending,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=THREE.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(e)},THREE.MeshPhongMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial,THREE.MeshPhongMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},THREE.MeshStandardMaterial=function(e){THREE.Material.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new THREE.Color(16777215),this.metalness=this.roughness=.5,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new THREE.Color(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new THREE.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.metalnessMap=this.roughnessMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.fog=!0,this.shading=THREE.SmoothShading,this.blending=THREE.NormalBlending,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=THREE.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(e)},THREE.MeshStandardMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshStandardMaterial.prototype.constructor=THREE.MeshStandardMaterial,THREE.MeshStandardMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},THREE.MeshPhysicalMaterial=function(e){THREE.MeshStandardMaterial.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.setValues(e)},THREE.MeshPhysicalMaterial.prototype=Object.create(THREE.MeshStandardMaterial.prototype),THREE.MeshPhysicalMaterial.prototype.constructor=THREE.MeshPhysicalMaterial,THREE.MeshPhysicalMaterial.prototype.copy=function(e){return THREE.MeshStandardMaterial.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this},THREE.MultiMaterial=function(e){this.uuid=THREE.Math.generateUUID(),this.type="MultiMaterial",this.materials=e instanceof Array?e:[],this.visible=!0},THREE.MultiMaterial.prototype={constructor:THREE.MultiMaterial,toJSON:function(e){for(var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},r=this.materials,i=0,n=r.length;n>i;i++){var o=r[i].toJSON(e);delete o.metadata,t.materials.push(o)}return t.visible=this.visible,t},clone:function(){for(var e=new this.constructor,t=0;t<this.materials.length;t++)e.materials.push(this.materials[t].clone());return e.visible=this.visible,e}},THREE.PointsMaterial=function(e){THREE.Material.call(this),this.type="PointsMaterial",this.color=new THREE.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.blending=THREE.NormalBlending,this.vertexColors=THREE.NoColors,this.fog=!0,this.setValues(e)},THREE.PointsMaterial.prototype=Object.create(THREE.Material.prototype),THREE.PointsMaterial.prototype.constructor=THREE.PointsMaterial,THREE.PointsMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.vertexColors=e.vertexColors,this.fog=e.fog,this},THREE.ShaderMaterial=function(e){THREE.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.shading=THREE.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.clipping=this.lights=this.fog=!1,this.vertexColors=THREE.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))},THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype),THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial,THREE.ShaderMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=THREE.UniformsUtils.clone(e.uniforms),this.defines=e.defines,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},THREE.ShaderMaterial.prototype.toJSON=function(e){return e=THREE.Material.prototype.toJSON.call(this,e),e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},THREE.RawShaderMaterial=function(e){THREE.ShaderMaterial.call(this,e),this.type="RawShaderMaterial"},THREE.RawShaderMaterial.prototype=Object.create(THREE.ShaderMaterial.prototype),THREE.RawShaderMaterial.prototype.constructor=THREE.RawShaderMaterial,THREE.SpriteMaterial=function(e){THREE.Material.call(this),this.type="SpriteMaterial",this.color=new THREE.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.setValues(e)},THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype),THREE.SpriteMaterial.prototype.constructor=THREE.SpriteMaterial,THREE.SpriteMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this.fog=e.fog,this},THREE.Texture=function(e,t,r,i,n,o,a,s,c,h){Object.defineProperty(this,"id",{value:THREE.TextureIdCount++}),this.uuid=THREE.Math.generateUUID(),this.sourceFile=this.name="",this.image=void 0!==e?e:THREE.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t: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!==c?c: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.encoding=void 0!==h?h:THREE.LinearEncoding,this.version=0,this.onUpdate=null},THREE.Texture.DEFAULT_IMAGE=void 0,THREE.Texture.DEFAULT_MAPPING=THREE.UVMapping,THREE.Texture.prototype={constructor:THREE.Texture,set needsUpdate(e){!0===e&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var t={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy};if(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=THREE.Math.generateUUID()),void 0===e.images[r.uuid]){var i,n=e.images,o=r.uuid,a=r.uuid;void 0!==r.toDataURL?i=r:(i=document.createElement("canvas"),i.width=r.width,i.height=r.height,i.getContext("2d").drawImage(r,0,0,r.width,r.height)),i=2048<i.width||2048<i.height?i.toDataURL("image/jpeg",.6):i.toDataURL("image/png"),n[o]={uuid:a,url:i}}t.image=r.uuid}return e.textures[this.uuid]=t},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping===THREE.UVMapping){if(e.multiply(this.repeat),e.add(this.offset),0>e.x||1<e.x)switch(this.wrapS){case THREE.RepeatWrapping:e.x-=Math.floor(e.x);break;case THREE.ClampToEdgeWrapping:e.x=0>e.x?0:1;break;case THREE.MirroredRepeatWrapping:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x)}if(0>e.y||1<e.y)switch(this.wrapT){case THREE.RepeatWrapping:e.y-=Math.floor(e.y);break;case THREE.ClampToEdgeWrapping:e.y=0>e.y?0:1;break;case THREE.MirroredRepeatWrapping:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},THREE.EventDispatcher.prototype.apply(THREE.Texture.prototype),THREE.TextureIdCount=0,THREE.DepthTexture=function(e,t,r,i,n,o,a,s,c){THREE.Texture.call(this,null,i,n,o,a,s,THREE.DepthFormat,r,c),this.image={width:e,height:t},this.type=void 0!==r?r:THREE.UnsignedShortType,this.magFilter=void 0!==a?a:THREE.NearestFilter,this.minFilter=void 0!==s?s:THREE.NearestFilter,this.generateMipmaps=this.flipY=!1},THREE.DepthTexture.prototype=Object.create(THREE.Texture.prototype),THREE.DepthTexture.prototype.constructor=THREE.DepthTexture,THREE.CanvasTexture=function(e,t,r,i,n,o,a,s,c){THREE.Texture.call(this,e,t,r,i,n,o,a,s,c),this.needsUpdate=!0},THREE.CanvasTexture.prototype=Object.create(THREE.Texture.prototype),THREE.CanvasTexture.prototype.constructor=THREE.CanvasTexture,THREE.CubeTexture=function(e,t,r,i,n,o,a,s,c,h){e=void 0!==e?e:[],t=void 0!==t?t:THREE.CubeReflectionMapping,THREE.Texture.call(this,e,t,r,i,n,o,a,s,c,h),this.flipY=!1},THREE.CubeTexture.prototype=Object.create(THREE.Texture.prototype),THREE.CubeTexture.prototype.constructor=THREE.CubeTexture,Object.defineProperty(THREE.CubeTexture.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),THREE.CompressedTexture=function(e,t,r,i,n,o,a,s,c,h,l,u){THREE.Texture.call(this,null,o,a,s,c,h,i,n,l,u),this.image={width:t,height:r},this.mipmaps=e,this.generateMipmaps=this.flipY=!1}, THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype),THREE.CompressedTexture.prototype.constructor=THREE.CompressedTexture,THREE.DataTexture=function(e,t,r,i,n,o,a,s,c,h,l,u){THREE.Texture.call(this,null,o,a,s,c,h,i,n,l,u),this.image={data:e,width:t,height:r},this.magFilter=void 0!==c?c:THREE.NearestFilter,this.minFilter=void 0!==h?h:THREE.NearestFilter,this.generateMipmaps=this.flipY=!1},THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype),THREE.DataTexture.prototype.constructor=THREE.DataTexture,THREE.VideoTexture=function(e,t,r,i,n,o,a,s,c){function h(){requestAnimationFrame(h),e.readyState>=e.HAVE_CURRENT_DATA&&(l.needsUpdate=!0)}THREE.Texture.call(this,e,t,r,i,n,o,a,s,c),this.generateMipmaps=!1;var l=this;h()},THREE.VideoTexture.prototype=Object.create(THREE.Texture.prototype),THREE.VideoTexture.prototype.constructor=THREE.VideoTexture,THREE.Group=function(){THREE.Object3D.call(this),this.type="Group"},THREE.Group.prototype=Object.create(THREE.Object3D.prototype),THREE.Group.prototype.constructor=THREE.Group,THREE.Points=function(e,t){THREE.Object3D.call(this),this.type="Points",this.geometry=void 0!==e?e:new THREE.Geometry,this.material=void 0!==t?t:new THREE.PointsMaterial({color:16777215*Math.random()})},THREE.Points.prototype=Object.create(THREE.Object3D.prototype),THREE.Points.prototype.constructor=THREE.Points,THREE.Points.prototype.raycast=function(){var e=new THREE.Matrix4,t=new THREE.Ray,r=new THREE.Sphere;return function(i,n){function o(e,r){var o=t.distanceSqToPoint(e);if(l>o){var s=t.closestPointToPoint(e);s.applyMatrix4(c);var h=i.ray.origin.distanceTo(s);h<i.near||h>i.far||n.push({distance:h,distanceToRay:Math.sqrt(o),point:s.clone(),index:r,face:null,object:a})}}var a=this,s=this.geometry,c=this.matrixWorld,h=i.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(c),!1!==i.ray.intersectsSphere(r)){e.getInverse(c),t.copy(i.ray).applyMatrix4(e);var h=h/((this.scale.x+this.scale.y+this.scale.z)/3),l=h*h,h=new THREE.Vector3;if(s instanceof THREE.BufferGeometry){var u=s.index,s=s.attributes.position.array;if(null!==u)for(var p=u.array,u=0,d=p.length;d>u;u++){var E=p[u];h.fromArray(s,3*E),o(h,E)}else for(u=0,p=s.length/3;p>u;u++)h.fromArray(s,3*u),o(h,u)}else for(h=s.vertices,u=0,p=h.length;p>u;u++)o(h[u],u)}}}(),THREE.Points.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},THREE.Line=function(e,t,r){return 1===r?(console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new THREE.LineSegments(e,t)):(THREE.Object3D.call(this),this.type="Line",this.geometry=void 0!==e?e:new THREE.Geometry,void(this.material=void 0!==t?t:new THREE.LineBasicMaterial({color:16777215*Math.random()})))},THREE.Line.prototype=Object.create(THREE.Object3D.prototype),THREE.Line.prototype.constructor=THREE.Line,THREE.Line.prototype.raycast=function(){var e=new THREE.Matrix4,t=new THREE.Ray,r=new THREE.Sphere;return function(i,n){var o=i.linePrecision,o=o*o,a=this.geometry,s=this.matrixWorld;if(null===a.boundingSphere&&a.computeBoundingSphere(),r.copy(a.boundingSphere),r.applyMatrix4(s),!1!==i.ray.intersectsSphere(r)){e.getInverse(s),t.copy(i.ray).applyMatrix4(e);var c=new THREE.Vector3,h=new THREE.Vector3,s=new THREE.Vector3,l=new THREE.Vector3,u=this instanceof THREE.LineSegments?2:1;if(a instanceof THREE.BufferGeometry){var p=a.index,d=a.attributes.position.array;if(null!==p)for(var p=p.array,a=0,E=p.length-1;E>a;a+=u){var f=p[a+1];c.fromArray(d,3*p[a]),h.fromArray(d,3*f),f=t.distanceSqToSegment(c,h,l,s),f>o||(l.applyMatrix4(this.matrixWorld),f=i.ray.origin.distanceTo(l),f<i.near||f>i.far||n.push({distance:f,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else for(a=0,E=d.length/3-1;E>a;a+=u)c.fromArray(d,3*a),h.fromArray(d,3*a+3),f=t.distanceSqToSegment(c,h,l,s),f>o||(l.applyMatrix4(this.matrixWorld),f=i.ray.origin.distanceTo(l),f<i.near||f>i.far||n.push({distance:f,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else if(a instanceof THREE.Geometry)for(c=a.vertices,h=c.length,a=0;h-1>a;a+=u)f=t.distanceSqToSegment(c[a],c[a+1],l,s),f>o||(l.applyMatrix4(this.matrixWorld),f=i.ray.origin.distanceTo(l),f<i.near||f>i.far||n.push({distance:f,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}}}(),THREE.Line.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},THREE.LineStrip=0,THREE.LinePieces=1,THREE.LineSegments=function(e,t){THREE.Line.call(this,e,t),this.type="LineSegments"},THREE.LineSegments.prototype=Object.create(THREE.Line.prototype),THREE.LineSegments.prototype.constructor=THREE.LineSegments,THREE.Mesh=function(e,t){THREE.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new THREE.Geometry,this.material=void 0!==t?t:new THREE.MeshBasicMaterial({color:16777215*Math.random()}),this.drawMode=THREE.TrianglesDrawMode,this.updateMorphTargets()},THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype),THREE.Mesh.prototype.constructor=THREE.Mesh,THREE.Mesh.prototype.setDrawMode=function(e){this.drawMode=e},THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,t=this.geometry.morphTargets.length;t>e;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}},THREE.Mesh.prototype.getMorphTargetIndexByName=function(e){return void 0!==this.morphTargetDictionary[e]?this.morphTargetDictionary[e]:(console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+e+" does not exist. Returning 0."),0)},THREE.Mesh.prototype.raycast=function(){function e(e,t,r,i,n,o,a){return THREE.Triangle.barycoordFromPoint(e,t,r,i,f),n.multiplyScalar(f.x),o.multiplyScalar(f.y),a.multiplyScalar(f.z),n.add(o).add(a),n.clone()}function t(e,t,r,i,n,o,a){var s=e.material;return null===(s.side===THREE.BackSide?r.intersectTriangle(o,n,i,!0,a):r.intersectTriangle(i,n,o,s.side!==THREE.DoubleSide,a))?null:(g.copy(a),g.applyMatrix4(e.matrixWorld),r=t.ray.origin.distanceTo(g),r<t.near||r>t.far?null:{distance:r,point:g.clone(),object:e})}function r(r,i,n,o,h,l,u,f){return a.fromArray(o,3*l),s.fromArray(o,3*u),c.fromArray(o,3*f),(r=t(r,i,n,a,s,c,m))&&(h&&(p.fromArray(h,2*l),d.fromArray(h,2*u),E.fromArray(h,2*f),r.uv=e(m,a,s,c,p,d,E)),r.face=new THREE.Face3(l,u,f,THREE.Triangle.normal(a,s,c)),r.faceIndex=l),r}var i=new THREE.Matrix4,n=new THREE.Ray,o=new THREE.Sphere,a=new THREE.Vector3,s=new THREE.Vector3,c=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,u=new THREE.Vector3,p=new THREE.Vector2,d=new THREE.Vector2,E=new THREE.Vector2,f=new THREE.Vector3,m=new THREE.Vector3,g=new THREE.Vector3;return function(f,g){var T=this.geometry,v=this.material,y=this.matrixWorld;if(void 0!==v&&(null===T.boundingSphere&&T.computeBoundingSphere(),o.copy(T.boundingSphere),o.applyMatrix4(y),!1!==f.ray.intersectsSphere(o)&&(i.getInverse(y),n.copy(f.ray).applyMatrix4(i),null===T.boundingBox||!1!==n.intersectsBox(T.boundingBox)))){var R,H;if(T instanceof THREE.BufferGeometry){var x,b,v=T.index,y=T.attributes,T=y.position.array;if(void 0!==y.uv&&(R=y.uv.array),null!==v)for(var y=v.array,_=0,M=y.length;M>_;_+=3)v=y[_],x=y[_+1],b=y[_+2],(H=r(this,f,n,T,R,v,x,b))&&(H.faceIndex=Math.floor(_/3),g.push(H));else for(_=0,M=T.length;M>_;_+=9)v=_/3,x=v+1,b=v+2,(H=r(this,f,n,T,R,v,x,b))&&(H.index=v,g.push(H))}else if(T instanceof THREE.Geometry){var w,S,y=v instanceof THREE.MultiMaterial,_=!0===y?v.materials:null,M=T.vertices;x=T.faces,b=T.faceVertexUvs[0],0<b.length&&(R=b);for(var L=0,A=x.length;A>L;L++){var C=x[L];if(H=!0===y?_[C.materialIndex]:v,void 0!==H){if(b=M[C.a],w=M[C.b],S=M[C.c],!0===H.morphTargets){H=T.morphTargets;var P=this.morphTargetInfluences;a.set(0,0,0),s.set(0,0,0),c.set(0,0,0);for(var B=0,D=H.length;D>B;B++){var I=P[B];if(0!==I){var U=H[B].vertices;a.addScaledVector(h.subVectors(U[C.a],b),I),s.addScaledVector(l.subVectors(U[C.b],w),I),c.addScaledVector(u.subVectors(U[C.c],S),I)}}a.add(b),s.add(w),c.add(S),b=a,w=s,S=c}(H=t(this,f,n,b,w,S,m))&&(R&&(P=R[L],p.copy(P[0]),d.copy(P[1]),E.copy(P[2]),H.uv=e(m,b,w,S,p,d,E)),H.face=C,H.faceIndex=L,g.push(H))}}}}}}(),THREE.Mesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},THREE.Bone=function(e){THREE.Object3D.call(this),this.type="Bone",this.skin=e},THREE.Bone.prototype=Object.create(THREE.Object3D.prototype),THREE.Bone.prototype.constructor=THREE.Bone,THREE.Bone.prototype.copy=function(e){return THREE.Object3D.prototype.copy.call(this,e),this.skin=e.skin,this},THREE.Skeleton=function(e,t,r){if(this.useVertexTexture=void 0!==r?r:!0,this.identityMatrix=new THREE.Matrix4,e=e||[],this.bones=e.slice(0),this.useVertexTexture?(e=Math.sqrt(4*this.bones.length),e=THREE.Math.nextPowerOfTwo(Math.ceil(e)),this.boneTextureHeight=this.boneTextureWidth=e=Math.max(e,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType)):this.boneMatrices=new Float32Array(16*this.bones.length),void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],t=0,e=this.bones.length;e>t;t++)this.boneInverses.push(new THREE.Matrix4)},THREE.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var e=0,t=this.bones.length;t>e;e++){var r=new THREE.Matrix4;this.bones[e]&&r.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(r)}},THREE.Skeleton.prototype.pose=function(){for(var e,t=0,r=this.bones.length;r>t;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,r=this.bones.length;r>t;t++)(e=this.bones[t])&&(e.parent?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},THREE.Skeleton.prototype.update=function(){var e=new THREE.Matrix4;return function(){for(var t=0,r=this.bones.length;r>t;t++)e.multiplyMatrices(this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix,this.boneInverses[t]),e.toArray(this.boneMatrices,16*t);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),THREE.Skeleton.prototype.clone=function(){return new THREE.Skeleton(this.bones,this.boneInverses,this.useVertexTexture)},THREE.SkinnedMesh=function(e,t,r){if(THREE.Mesh.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new THREE.Matrix4,this.bindMatrixInverse=new THREE.Matrix4,e=[],this.geometry&&void 0!==this.geometry.bones){for(var i,n=0,o=this.geometry.bones.length;o>n;++n)i=this.geometry.bones[n],t=new THREE.Bone(this),e.push(t),t.name=i.name,t.position.fromArray(i.pos),t.quaternion.fromArray(i.rotq),void 0!==i.scl&&t.scale.fromArray(i.scl);for(n=0,o=this.geometry.bones.length;o>n;++n)i=this.geometry.bones[n],-1!==i.parent&&null!==i.parent&&void 0!==e[i.parent]?e[i.parent].add(e[n]):this.add(e[n])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new THREE.Skeleton(e,void 0,r),this.matrixWorld)},THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype),THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh,THREE.SkinnedMesh.prototype.bind=function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},THREE.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},THREE.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof THREE.Geometry)for(var e=0;e<this.geometry.skinWeights.length;e++){var t=this.geometry.skinWeights[e],r=1/t.lengthManhattan();1/0!==r?t.multiplyScalar(r):t.set(1,0,0,0)}else if(this.geometry instanceof THREE.BufferGeometry)for(var t=new THREE.Vector4,i=this.geometry.attributes.skinWeight,e=0;e<i.count;e++)t.x=i.getX(e),t.y=i.getY(e),t.z=i.getZ(e),t.w=i.getW(e),r=1/t.lengthManhattan(),1/0!==r?t.multiplyScalar(r):t.set(1,0,0,0),i.setXYZW(e,t.x,t.y,t.z,t.w)},THREE.SkinnedMesh.prototype.updateMatrixWorld=function(e){THREE.Mesh.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unrecognized bindMode: "+this.bindMode)},THREE.SkinnedMesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material,this.useVertexTexture).copy(this)},THREE.LOD=function(){THREE.Object3D.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})},THREE.LOD.prototype=Object.create(THREE.Object3D.prototype),THREE.LOD.prototype.constructor=THREE.LOD,THREE.LOD.prototype.addLevel=function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var r=this.levels,i=0;i<r.length&&!(t<r[i].distance);i++);r.splice(i,0,{distance:t,object:e}),this.add(e)},THREE.LOD.prototype.getObjectForDistance=function(e){for(var t=this.levels,r=1,i=t.length;i>r&&!(e<t[r].distance);r++);return t[r-1].object},THREE.LOD.prototype.raycast=function(){var e=new THREE.Vector3;return function(t,r){e.setFromMatrixPosition(this.matrixWorld);var i=t.ray.origin.distanceTo(e);this.getObjectForDistance(i).raycast(t,r)}}(),THREE.LOD.prototype.update=function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(r){var i=this.levels;if(1<i.length){e.setFromMatrixPosition(r.matrixWorld),t.setFromMatrixPosition(this.matrixWorld),r=e.distanceTo(t),i[0].object.visible=!0;for(var n=1,o=i.length;o>n&&r>=i[n].distance;n++)i[n-1].object.visible=!1,i[n].object.visible=!0;for(;o>n;n++)i[n].object.visible=!1}}}(),THREE.LOD.prototype.copy=function(e){THREE.Object3D.prototype.copy.call(this,e,!1),e=e.levels;for(var t=0,r=e.length;r>t;t++){var i=e[t];this.addLevel(i.object.clone(),i.distance)}return this},THREE.LOD.prototype.toJSON=function(e){e=THREE.Object3D.prototype.toJSON.call(this,e),e.object.levels=[];for(var t=this.levels,r=0,i=t.length;i>r;r++){var n=t[r];e.object.levels.push({object:n.object.uuid,distance:n.distance})}return e},THREE.Sprite=function(){var e=new Uint16Array([0,1,2,0,2,3]),t=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),r=new Float32Array([0,0,1,0,1,1,0,1]),i=new THREE.BufferGeometry;return i.setIndex(new THREE.BufferAttribute(e,1)),i.addAttribute("position",new THREE.BufferAttribute(t,3)),i.addAttribute("uv",new THREE.BufferAttribute(r,2)),function(e){THREE.Object3D.call(this),this.type="Sprite",this.geometry=i,this.material=void 0!==e?e:new THREE.SpriteMaterial}}(),THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype),THREE.Sprite.prototype.constructor=THREE.Sprite,THREE.Sprite.prototype.raycast=function(){var e=new THREE.Vector3;return function(t,r){e.setFromMatrixPosition(this.matrixWorld);var i=t.ray.distanceSqToPoint(e);i>this.scale.x*this.scale.y/4||r.push({distance:Math.sqrt(i),point:this.position,face:null,object:this})}}(),THREE.Sprite.prototype.clone=function(){return new this.constructor(this.material).copy(this)},THREE.Particle=THREE.Sprite,THREE.LensFlare=function(e,t,r,i,n){THREE.Object3D.call(this),this.lensFlares=[],this.positionScreen=new THREE.Vector3,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,r,i,n)},THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype),THREE.LensFlare.prototype.constructor=THREE.LensFlare,THREE.LensFlare.prototype.add=function(e,t,r,i,n,o){void 0===t&&(t=-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:e,size:t,distance:r,x:0,y:0,z:0,scale:1,rotation:0,opacity:o,color:n,blending:i})},THREE.LensFlare.prototype.updateLensFlares=function(){var e,t,r=this.lensFlares.length,i=2*-this.positionScreen.x,n=2*-this.positionScreen.y;for(e=0;r>e;e++)t=this.lensFlares[e],t.x=this.positionScreen.x+i*t.distance,t.y=this.positionScreen.y+n*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)},THREE.LensFlare.prototype.copy=function(e){THREE.Object3D.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,r=e.lensFlares.length;r>t;t++)this.lensFlares.push(e.lensFlares[t]);return this},THREE.Scene=function(){THREE.Object3D.call(this),this.type="Scene",this.overrideMaterial=this.fog=null,this.autoUpdate=!0},THREE.Scene.prototype=Object.create(THREE.Object3D.prototype),THREE.Scene.prototype.constructor=THREE.Scene,THREE.Scene.prototype.copy=function(e,t){return THREE.Object3D.prototype.copy.call(this,e,t),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},THREE.Fog=function(e,t,r){this.name="",this.color=new THREE.Color(e),this.near=void 0!==t?t: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(e,t){this.name="",this.color=new THREE.Color(e),this.density=void 0!==t?t:25e-5},THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)},THREE.ShaderChunk={},THREE.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",THREE.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif\n",THREE.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n if ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",THREE.ShaderChunk.aomap_fragment="#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_ENVMAP ) && defined( PHYSICAL )\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n #endif\n#endif\n",THREE.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",THREE.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",THREE.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",THREE.ShaderChunk.bsdfs="bool testLightInRange( const in float lightDistance, const in float cutoffDistance ) {\n return any( bvec2( cutoffDistance == 0.0, lightDistance < cutoffDistance ) );\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n if( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n float maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n return distanceFalloff * maxDistanceCutoffFactor;\n#else\n return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n }\n return 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n return ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n return 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n float dotNH = saturate( dot( geometry.normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n return specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n float dotNH = saturate( dot( geometry.normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n return sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",THREE.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n vec3 vSigmaX = dFdx( surf_pos );\n vec3 vSigmaY = dFdy( surf_pos );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 );\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif\n",THREE.ShaderChunk.clipping_planes_fragment="#if NUM_CLIPPING_PLANES > 0\n for ( int i = 0; i < NUM_CLIPPING_PLANES; ++ i ) {\n vec4 plane = clippingPlanes[ i ];\n if ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n }\n#endif\n",THREE.ShaderChunk.clipping_planes_pars_fragment="#if NUM_CLIPPING_PLANES > 0\n #if ! defined( PHYSICAL ) && ! defined( PHONG )\n varying vec3 vViewPosition;\n #endif\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",THREE.ShaderChunk.clipping_planes_pars_vertex="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n varying vec3 vViewPosition;\n#endif\n",THREE.ShaderChunk.clipping_planes_vertex="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n vViewPosition = - mvPosition.xyz;\n#endif\n",THREE.ShaderChunk.color_fragment="#ifdef USE_COLOR\n diffuseColor.rgb *= vColor;\n#endif",THREE.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n varying vec3 vColor;\n#endif\n",THREE.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n varying vec3 vColor;\n#endif",THREE.ShaderChunk.color_vertex="#ifdef USE_COLOR\n vColor.xyz = color.xyz;\n#endif",THREE.ShaderChunk.common="#define PI 3.14159265359\n#define PI2 6.28318530718\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract(sin(sn) * c);\n}\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n float distance = dot( planeNormal, point - pointOnPlane );\n return - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\n",THREE.ShaderChunk.cube_uv_reflection_fragment="#ifdef ENVMAP_TYPE_CUBE_UV\nconst float cubeUV_textureSize = 1024.0;\nint getFaceFromDirection(vec3 direction) {\n vec3 absDirection = abs(direction);\n int face = -1;\n if( absDirection.x > absDirection.z ) {\n if(absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0 : 3;\n else\n face = direction.y > 0.0 ? 1 : 4;\n }\n else {\n if(absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2 : 5;\n else\n face = direction.y > 0.0 ? 1 : 4;\n }\n return face;\n}\nfloat cubeUV_maxLods1 = log2(cubeUV_textureSize*0.25) - 1.0;\nfloat cubeUV_rangeClamp = exp2((6.0 - 1.0) * 2.0);\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n float scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n float dxRoughness = dFdx(roughness);\n float dyRoughness = dFdy(roughness);\n vec3 dx = dFdx( vec * scale * dxRoughness );\n vec3 dy = dFdy( vec * scale * dyRoughness );\n float d = max( dot( dx, dx ), dot( dy, dy ) );\n d = clamp(d, 1.0, cubeUV_rangeClamp);\n float mipLevel = 0.5 * log2(d);\n return vec2(floor(mipLevel), fract(mipLevel));\n}\nfloat cubeUV_maxLods2 = log2(cubeUV_textureSize*0.25) - 2.0;\nconst float cubeUV_rcpTextureSize = 1.0 / cubeUV_textureSize;\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n mipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n float a = 16.0 * cubeUV_rcpTextureSize;\n vec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n vec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n float powScale = exp2_packed.x * exp2_packed.y;\n float scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n float mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n bool bRes = mipLevel == 0.0;\n scale = bRes && (scale < a) ? a : scale;\n vec3 r;\n vec2 offset;\n int face = getFaceFromDirection(direction);\n float rcpPowScale = 1.0 / powScale;\n if( face == 0) {\n r = vec3(direction.x, -direction.z, direction.y);\n offset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if( face == 1) {\n r = vec3(direction.y, direction.x, direction.z);\n offset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if( face == 2) {\n r = vec3(direction.z, direction.x, direction.y);\n offset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if( face == 3) {\n r = vec3(direction.x, direction.z, direction.y);\n offset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n else if( face == 4) {\n r = vec3(direction.y, direction.x, -direction.z);\n offset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n else {\n r = vec3(direction.z, -direction.x, direction.y);\n offset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n r = normalize(r);\n float texelOffset = 0.5 * cubeUV_rcpTextureSize;\n vec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n vec2 base = offset + vec2( texelOffset );\n return base + s * ( scale - 2.0 * texelOffset );\n}\nfloat cubeUV_maxLods3 = log2(cubeUV_textureSize*0.25) - 3.0;\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n float roughnessVal = roughness* cubeUV_maxLods3;\n float r1 = floor(roughnessVal);\n float r2 = r1 + 1.0;\n float t = fract(roughnessVal);\n vec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n float s = mipInfo.y;\n float level0 = mipInfo.x;\n float level1 = level0 + 1.0;\n level1 = level1 > 5.0 ? 5.0 : level1;\n level0 += min( floor( s + 0.5 ), 5.0 );\n vec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n vec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n vec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n vec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n vec4 result = mix(color10, color20, t);\n return vec4(result.rgb, 1.0);\n}\n#endif\n",THREE.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n objectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",THREE.ShaderChunk.displacementmap_vertex="#ifdef USE_DISPLACEMENTMAP\n transformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",THREE.ShaderChunk.displacementmap_pars_vertex="#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif\n",THREE.ShaderChunk.emissivemap_fragment="#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vUv );\n emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",THREE.ShaderChunk.emissivemap_pars_fragment="#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif\n",THREE.ShaderChunk.encodings_pars_fragment="\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n", THREE.ShaderChunk.encodings_fragment=" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",THREE.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToVertex, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n vec4 envColor = texture2D( envMap, sampleUV );\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n #endif\n envColor = envMapTexelToLinear( envColor );\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif\n",THREE.ShaderChunk.envmap_pars_fragment="#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n uniform float reflectivity;\n uniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n #if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n varying vec3 vWorldPosition;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n uniform float flipEnvMap;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif\n",THREE.ShaderChunk.envmap_pars_vertex="#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif\n",THREE.ShaderChunk.envmap_vertex="#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif\n",THREE.ShaderChunk.fog_fragment="#ifdef USE_FOG\n #ifdef USE_LOGDEPTHBUF_EXT\n float depth = gl_FragDepthEXT / gl_FragCoord.w;\n #else\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n #endif\n #ifdef FOG_EXP2\n float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, depth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",THREE.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n uniform vec3 fogColor;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",THREE.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n reflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",THREE.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",THREE.ShaderChunk.lights_lambert_vertex="vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n vLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_DIR_LIGHTS > 0\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_HEMI_LIGHTS > 0\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n vLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n #ifdef DOUBLE_SIDED\n vLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n #endif\n }\n#endif\n",THREE.ShaderChunk.lights_pars="uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n directLight.color = directionalLight.color;\n directLight.direction = directionalLight.direction;\n directLight.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = pointLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n if ( testLightInRange( lightDistance, pointLight.distance ) ) {\n directLight.color = pointLight.color;\n directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n directLight.visible = true;\n } else {\n directLight.color = vec3( 0.0 );\n directLight.visible = false;\n }\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = spotLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n float angleCos = dot( directLight.direction, spotLight.direction );\n if ( all( bvec2( angleCos > spotLight.coneCos, testLightInRange( lightDistance, spotLight.distance ) ) ) ) {\n float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n directLight.color = spotLight.color;\n directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n directLight.visible = true;\n } else {\n directLight.color = vec3( 0.0 );\n directLight.visible = false;\n }\n }\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n float dotNL = dot( geometry.normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n }\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n #else\n vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n vec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n #else\n vec4 envMapColor = vec4( 0.0 );\n #endif\n return PI * envMapColor.rgb * envMapIntensity;\n }\n float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n float maxMIPLevelScalar = float( maxMIPLevel );\n float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n }\n vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n #else\n vec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n #endif\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n float specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n #else\n vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n vec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #endif\n return envMapColor.rgb * envMapIntensity;\n }\n#endif\n",THREE.ShaderChunk.lights_phong_fragment="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",THREE.ShaderChunk.lights_phong_pars_fragment="varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material ) (0)\n",THREE.ShaderChunk.lights_physical_fragment="PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.16 * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#endif\n",THREE.ShaderChunk.lights_physical_pars_fragment="struct PhysicalMaterial {\n vec3 diffuseColor;\n float specularRoughness;\n vec3 specularColor;\n #ifndef STANDARD\n #endif\n};\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectSpecular += radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",THREE.ShaderChunk.lights_template="\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointDirectLightIrradiance( pointLight, geometry, directLight );\n #ifdef USE_SHADOWMAP\n directLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotDirectLightIrradiance( spotLight, geometry, directLight );\n #ifdef USE_SHADOWMAP\n directLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n #ifdef USE_SHADOWMAP\n directLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #ifdef USE_LIGHTMAP\n vec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n lightMapIrradiance *= PI;\n #endif\n irradiance += lightMapIrradiance;\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n }\n #endif\n #if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n irradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n #endif\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n vec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n RE_IndirectSpecular( radiance, geometry, material, reflectedLight );\n#endif\n",THREE.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",THREE.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n uniform float logDepthBufFC;\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n #endif\n#endif\n",THREE.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n #endif\n uniform float logDepthBufFC;\n#endif",THREE.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n #else\n gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n #endif\n#endif\n",THREE.ShaderChunk.map_fragment="#ifdef USE_MAP\n vec4 texelColor = texture2D( map, vUv );\n texelColor = mapTexelToLinear( texelColor );\n diffuseColor *= texelColor;\n#endif\n",THREE.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n",THREE.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n vec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n diffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",THREE.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n uniform vec4 offsetRepeat;\n uniform sampler2D map;\n#endif\n",THREE.ShaderChunk.metalnessmap_fragment="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vUv );\n metalnessFactor *= texelMetalness.r;\n#endif\n",THREE.ShaderChunk.metalnessmap_pars_fragment="#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",THREE.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n objectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n objectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",THREE.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n#endif",THREE.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n transformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n transformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n transformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n transformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n transformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n transformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n transformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n #endif\n#endif\n",THREE.ShaderChunk.normal_fragment="#ifdef FLAT_SHADED\n vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n #endif\n#endif\n#ifdef USE_NORMALMAP\n normal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",THREE.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n vec3 N = normalize( surf_norm );\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy = normalScale * mapN.xy;\n mat3 tsn = mat3( S, T, N );\n return normalize( tsn * mapN );\n }\n#endif\n",THREE.ShaderChunk.packing="vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 1.0 - 2.0 * rgb.xyz;\n}\nvec4 packDepthToRGBA( const in float value ) {\n const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n vec4 res = mod( value * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n res -= res.xxyz * bit_mask;\n return res;\n}\nfloat unpackRGBAToDepth( const in vec4 rgba ) {\n const vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n return dot( rgba, bitSh );\n}\nfloat viewZToOrthoDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat OrthoDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",THREE.ShaderChunk.premultiplied_alpha_fragment="#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",THREE.ShaderChunk.project_vertex="#ifdef USE_SKINNING\n vec4 mvPosition = modelViewMatrix * skinned;\n#else\n vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",THREE.ShaderChunk.roughnessmap_fragment="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vUv );\n roughnessFactor *= texelRoughness.r;\n#endif\n",THREE.ShaderChunk.roughnessmap_pars_fragment="#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",THREE.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n #endif\n #if NUM_SPOT_LIGHTS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n #endif\n #if NUM_POINT_LIGHTS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n float texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n const vec2 offset = vec2( 0.0, 1.0 );\n vec2 texelSize = vec2( 1.0 ) / size;\n vec2 centroidUV = floor( uv * size + 0.5 ) / size;\n float lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n float lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n float rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n float rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n vec2 f = fract( uv * size + 0.5 );\n float a = mix( lb, lt, f.y );\n float b = mix( rb, rt, f.y );\n float c = mix( a, b, f.x );\n return c;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n bool frustumTest = all( frustumTestVec );\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n return (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n return (\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return 1.0;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n float dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif\n", THREE.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n #endif\n #if NUM_SPOT_LIGHTS > 0\n uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n #endif\n #if NUM_POINT_LIGHTS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n #endif\n#endif\n",THREE.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n }\n #endif\n #if NUM_SPOT_LIGHTS > 0\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n }\n #endif\n #if NUM_POINT_LIGHTS > 0\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n }\n #endif\n#endif\n",THREE.ShaderChunk.shadowmask_pars_fragment="float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n DirectionalLight directionalLight;\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n shadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #endif\n #if NUM_SPOT_LIGHTS > 0\n SpotLight spotLight;\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n shadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n }\n #endif\n #if NUM_POINT_LIGHTS > 0\n PointLight pointLight;\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n shadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n }\n #endif\n #endif\n return shadow;\n}\n",THREE.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",THREE.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n #ifdef BONE_TEXTURE\n uniform sampler2D boneTexture;\n uniform int boneTextureWidth;\n uniform int boneTextureHeight;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureWidth ) );\n float y = floor( j / float( boneTextureWidth ) );\n float dx = 1.0 / float( boneTextureWidth );\n float dy = 1.0 / float( boneTextureHeight );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n #else\n uniform mat4 boneMatrices[ MAX_BONES ];\n mat4 getBoneMatrix( const in float i ) {\n mat4 bone = boneMatrices[ int(i) ];\n return bone;\n }\n #endif\n#endif\n",THREE.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n skinned = bindMatrixInverse * skinned;\n#endif\n",THREE.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",THREE.ShaderChunk.specularmap_fragment="float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",THREE.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",THREE.ShaderChunk.tonemapping_fragment="#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",THREE.ShaderChunk.tonemapping_pars_fragment="#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",THREE.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n varying vec2 vUv2;\n#endif",THREE.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n attribute vec2 uv2;\n varying vec2 vUv2;\n#endif",THREE.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n vUv2 = uv2;\n#endif",THREE.ShaderChunk.uv_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n varying vec2 vUv;\n#endif",THREE.ShaderChunk.uv_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n varying vec2 vUv;\n uniform vec4 offsetRepeat;\n#endif\n",THREE.ShaderChunk.uv_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",THREE.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n #ifdef USE_SKINNING\n vec4 worldPosition = modelMatrix * skinned;\n #else\n vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n #endif\n#endif\n",THREE.UniformsUtils={merge:function(e){for(var t={},r=0;r<e.length;r++){var i,n=this.clone(e[r]);for(i in n)t[i]=n[i]}return t},clone:function(e){var t,r={};for(t in e){r[t]={};for(var i in e[t]){var n=e[t][i];n instanceof THREE.Color||n instanceof THREE.Vector2||n instanceof THREE.Vector3||n instanceof THREE.Vector4||n instanceof THREE.Matrix3||n instanceof THREE.Matrix4||n instanceof THREE.Texture?r[t][i]=n.clone():Array.isArray(n)?r[t][i]=n.slice():r[t][i]=n}}return r}},THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"1f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"1f",value:-1},reflectivity:{type:"1f",value:1},refractionRatio:{type:"1f",value:.98}},aomap:{aoMap:{type:"t",value:null},aoMapIntensity:{type:"1f",value:1}},lightmap:{lightMap:{type:"t",value:null},lightMapIntensity:{type:"1f",value:1}},emissivemap:{emissiveMap:{type:"t",value:null}},bumpmap:{bumpMap:{type:"t",value:null},bumpScale:{type:"1f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new THREE.Vector2(1,1)}},displacementmap:{displacementMap:{type:"t",value:null},displacementScale:{type:"1f",value:1},displacementBias:{type:"1f",value:0}},roughnessmap:{roughnessMap:{type:"t",value:null}},metalnessmap:{metalnessMap:{type:"t",value:null}},fog:{fogDensity:{type:"1f",value:25e-5},fogNear:{type:"1f",value:1},fogFar:{type:"1f",value:2e3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{ambientLightColor:{type:"3fv",value:[]},directionalLights:{type:"sa",value:[],properties:{direction:{type:"v3"},color:{type:"c"},shadow:{type:"1i"},shadowBias:{type:"1f"},shadowRadius:{type:"1f"},shadowMapSize:{type:"v2"}}},directionalShadowMap:{type:"tv",value:[]},directionalShadowMatrix:{type:"m4v",value:[]},spotLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},direction:{type:"v3"},distance:{type:"1f"},coneCos:{type:"1f"},penumbraCos:{type:"1f"},decay:{type:"1f"},shadow:{type:"1i"},shadowBias:{type:"1f"},shadowRadius:{type:"1f"},shadowMapSize:{type:"v2"}}},spotShadowMap:{type:"tv",value:[]},spotShadowMatrix:{type:"m4v",value:[]},pointLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},decay:{type:"1f"},distance:{type:"1f"},shadow:{type:"1i"},shadowBias:{type:"1f"},shadowRadius:{type:"1f"},shadowMapSize:{type:"v2"}}},pointShadowMap:{type:"tv",value:[]},pointShadowMatrix:{type:"m4v",value:[]},hemisphereLights:{type:"sa",value:[],properties:{direction:{type:"v3"},skyColor:{type:"c"},groundColor:{type:"c"}}}},points:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"1f",value:1},size:{type:"1f",value:1},scale:{type:"1f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)}}},THREE.ShaderChunk.cube_frag="uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n #include <logdepthbuf_fragment>\n}\n",THREE.ShaderChunk.cube_vert="varying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vWorldPosition = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n}\n",THREE.ShaderChunk.depth_frag="#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <logdepthbuf_fragment>\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n #endif\n}\n",THREE.ShaderChunk.depth_vert="#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #include <begin_vertex>\n #include <displacementmap_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n}\n",THREE.ShaderChunk.distanceRGBA_frag="uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n #include <clipping_planes_fragment>\n gl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",THREE.ShaderChunk.distanceRGBA_vert="varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <skinbase_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition;\n}\n",THREE.ShaderChunk.equirect_frag="uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 direction = normalize( vWorldPosition );\n vec2 sampleUV;\n sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <logdepthbuf_fragment>\n}\n",THREE.ShaderChunk.equirect_vert="varying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vWorldPosition = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n}\n",THREE.ShaderChunk.linedashed_frag="uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",THREE.ShaderChunk.linedashed_vert="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <color_vertex>\n vLineDistance = scale * lineDistance;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n}\n",THREE.ShaderChunk.meshbasic_frag="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight;\n reflectedLight.directDiffuse = vec3( 0.0 );\n reflectedLight.directSpecular = vec3( 0.0 );\n reflectedLight.indirectDiffuse = diffuseColor.rgb;\n reflectedLight.indirectSpecular = vec3( 0.0 );\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",THREE.ShaderChunk.meshbasic_vert="#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <skinbase_vertex>\n #ifdef USE_ENVMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n #include <envmap_vertex>\n}\n",THREE.ShaderChunk.meshlambert_frag="uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <emissivemap_fragment>\n reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n #include <lightmap_fragment>\n reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n #ifdef DOUBLE_SIDED\n reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n #else\n reflectedLight.directDiffuse = vLightFront;\n #endif\n reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",THREE.ShaderChunk.meshlambert_vert="#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <lights_lambert_vertex>\n #include <shadowmap_vertex>\n}\n",THREE.ShaderChunk.meshphong_frag="#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_template>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",THREE.ShaderChunk.meshphong_vert="#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <displacementmap_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n}\n",THREE.ShaderChunk.meshphysical_frag="#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_template>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",THREE.ShaderChunk.meshphysical_vert="#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <displacementmap_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n}\n",THREE.ShaderChunk.normal_frag="uniform float opacity;\nvarying vec3 vNormal;\n#include <common>\n#include <packing>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n gl_FragColor = vec4( packNormalToRGB( vNormal ), opacity );\n #include <logdepthbuf_fragment>\n}\n",THREE.ShaderChunk.normal_vert="varying vec3 vNormal;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vNormal = normalize( normalMatrix * normal );\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n}\n",THREE.ShaderChunk.points_frag="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",THREE.ShaderChunk.points_vert="uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <color_vertex>\n #include <begin_vertex>\n #include <project_vertex>\n #ifdef USE_SIZEATTENUATION\n gl_PointSize = size * ( scale / - mvPosition.z );\n #else\n gl_PointSize = size;\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n}\n",THREE.ShaderLib={basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.aomap,THREE.UniformsLib.fog]),vertexShader:THREE.ShaderChunk.meshbasic_vert,fragmentShader:THREE.ShaderChunk.meshbasic_frag},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.aomap,THREE.UniformsLib.lightmap,THREE.UniformsLib.emissivemap,THREE.UniformsLib.fog,THREE.UniformsLib.lights,{emissive:{type:"c",value:new THREE.Color(0)}}]),vertexShader:THREE.ShaderChunk.meshlambert_vert,fragmentShader:THREE.ShaderChunk.meshlambert_frag},phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.aomap,THREE.UniformsLib.lightmap,THREE.UniformsLib.emissivemap,THREE.UniformsLib.bumpmap,THREE.UniformsLib.normalmap,THREE.UniformsLib.displacementmap,THREE.UniformsLib.fog,THREE.UniformsLib.lights,{emissive:{type:"c",value:new THREE.Color(0)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"1f",value:30}}]),vertexShader:THREE.ShaderChunk.meshphong_vert,fragmentShader:THREE.ShaderChunk.meshphong_frag},standard:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.aomap,THREE.UniformsLib.lightmap,THREE.UniformsLib.emissivemap,THREE.UniformsLib.bumpmap,THREE.UniformsLib.normalmap,THREE.UniformsLib.displacementmap,THREE.UniformsLib.roughnessmap,THREE.UniformsLib.metalnessmap,THREE.UniformsLib.fog,THREE.UniformsLib.lights,{emissive:{type:"c",value:new THREE.Color(0)},roughness:{type:"1f",value:.5},metalness:{type:"1f",value:0},envMapIntensity:{type:"1f",value:1}}]),vertexShader:THREE.ShaderChunk.meshphysical_vert,fragmentShader:THREE.ShaderChunk.meshphysical_frag},points:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.points,THREE.UniformsLib.fog]),vertexShader:THREE.ShaderChunk.points_vert,fragmentShader:THREE.ShaderChunk.points_frag},dashed:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,{scale:{type:"1f",value:1},dashSize:{type:"1f",value:1},totalSize:{type:"1f",value:2}}]),vertexShader:THREE.ShaderChunk.linedashed_vert,fragmentShader:THREE.ShaderChunk.linedashed_frag},depth:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.displacementmap]),vertexShader:THREE.ShaderChunk.depth_vert,fragmentShader:THREE.ShaderChunk.depth_frag},normal:{uniforms:{opacity:{type:"1f",value:1}},vertexShader:THREE.ShaderChunk.normal_vert,fragmentShader:THREE.ShaderChunk.normal_frag},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"1f",value:-1}},vertexShader:THREE.ShaderChunk.cube_vert,fragmentShader:THREE.ShaderChunk.cube_frag},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"1f",value:-1}},vertexShader:THREE.ShaderChunk.equirect_vert,fragmentShader:THREE.ShaderChunk.equirect_frag},distanceRGBA:{uniforms:{lightPos:{type:"v3",value:new THREE.Vector3}},vertexShader:THREE.ShaderChunk.distanceRGBA_vert,fragmentShader:THREE.ShaderChunk.distanceRGBA_frag}},THREE.ShaderLib.physical={ uniforms:THREE.UniformsUtils.merge([THREE.ShaderLib.standard.uniforms,{}]),vertexShader:THREE.ShaderChunk.meshphysical_vert,fragmentShader:THREE.ShaderChunk.meshphysical_frag},THREE.WebGLRenderer=function(e){function t(e,t,r,i){!0===I&&(e*=i,t*=i,r*=i),Ce.clearColor(e,t,r,i)}function r(){Ce.init(),Ce.scissor(J.copy(se).multiplyScalar(ae)),Ce.viewport(ee.copy(he).multiplyScalar(ae)),t(re.r,re.g,re.b,ie)}function i(){Q=X=null,K="",Z=-1,Ce.reset()}function n(e){e.preventDefault(),i(),r(),Pe.clear()}function o(e){e=e.target,e.removeEventListener("dispose",o);e:{var t=Pe.get(e);if(e.image&&t.__image__webglTextureCube)Me.deleteTexture(t.__image__webglTextureCube);else{if(void 0===t.__webglInit)break e;Me.deleteTexture(t.__webglTexture)}Pe["delete"](e)}be.textures--}function a(e){e=e.target,e.removeEventListener("dispose",a);var t=Pe.get(e),r=Pe.get(e.texture);if(e){if(void 0!==r.__webglTexture&&Me.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e instanceof THREE.WebGLRenderTargetCube)for(r=0;6>r;r++)Me.deleteFramebuffer(t.__webglFramebuffer[r]),t.__webglDepthbuffer&&Me.deleteRenderbuffer(t.__webglDepthbuffer[r]);else Me.deleteFramebuffer(t.__webglFramebuffer),t.__webglDepthbuffer&&Me.deleteRenderbuffer(t.__webglDepthbuffer);Pe["delete"](e.texture),Pe["delete"](e)}be.textures--}function s(e){e=e.target,e.removeEventListener("dispose",s),c(e),Pe["delete"](e)}function c(e){var t=Pe.get(e).program;e.program=void 0,void 0!==t&&De.releaseProgram(t)}function h(e,t){return Math.abs(t[0])-Math.abs(e[0])}function l(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function u(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function p(e,t,r,i,n){var o;r.transparent?(i=V,o=++G):(i=N,o=++O),o=i[o],void 0!==o?(o.id=e.id,o.object=e,o.geometry=t,o.material=r,o.z=He.z,o.group=n):(o={id:e.id,object:e,geometry:t,material:r,z:He.z,group:n},i.push(o))}function d(e){var t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere();var r=ve.copy(t.boundingSphere).applyMatrix4(e.matrixWorld);if(!le.intersectsSphere(r))return!1;if(0===Ee)return!0;e=W.clippingPlanes;var t=r.center,r=-r.radius,i=0;do if(e[i].distanceToPoint(t)<r)return!1;while(++i!==Ee);return!0}function E(e,t){if(!1!==e.visible){if(e.layers.test(t.layers))if(e instanceof THREE.Light)F.push(e);else if(e instanceof THREE.Sprite)!1!==e.frustumCulled&&!0!==d(e)||k.push(e);else if(e instanceof THREE.LensFlare)j.push(e);else if(e instanceof THREE.ImmediateRenderObject)!0===W.sortObjects&&(He.setFromMatrixPosition(e.matrixWorld),He.applyProjection(Re)),p(e,null,e.material,He.z,null);else if((e instanceof THREE.Mesh||e instanceof THREE.Line||e instanceof THREE.Points)&&(e instanceof THREE.SkinnedMesh&&e.skeleton.update(),!1===e.frustumCulled||!0===d(e))){var r=e.material;if(!0===r.visible){!0===W.sortObjects&&(He.setFromMatrixPosition(e.matrixWorld),He.applyProjection(Re));var i=Be.update(e);if(r instanceof THREE.MultiMaterial)for(var n=i.groups,o=r.materials,r=0,a=n.length;a>r;r++){var s=n[r],c=o[s.materialIndex];!0===c.visible&&p(e,i,c,He.z,s)}else p(e,i,r,He.z,null)}}for(i=e.children,r=0,a=i.length;a>r;r++)E(i[r],t)}}function f(e,t,r,i){for(var n=0,o=e.length;o>n;n++){var a=e[n],s=a.object,c=a.geometry,h=void 0===i?a.material:i,a=a.group;if(s.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,s.matrixWorld),s.normalMatrix.getNormalMatrix(s.modelViewMatrix),s instanceof THREE.ImmediateRenderObject){m(h);var l=g(t,r,h,s);K="",s.render(function(e){W.renderBufferImmediate(e,l,h)})}else W.renderBufferDirect(t,r,c,h,s,a)}}function m(e){e.side!==THREE.DoubleSide?Ce.enable(Me.CULL_FACE):Ce.disable(Me.CULL_FACE),Ce.setFlipSided(e.side===THREE.BackSide),!0===e.transparent?Ce.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):Ce.setBlending(THREE.NoBlending),Ce.setDepthFunc(e.depthFunc),Ce.setDepthTest(e.depthTest),Ce.setDepthWrite(e.depthWrite),Ce.setColorWrite(e.colorWrite),Ce.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function g(e,t,r,i){te=0;var n=Pe.get(r);if(ue){if(pe||e!==Q){var o=r.clippingPlanes,a=e===Q&&r.id===Z;if(!pe||null===o||0===o.length||de&&!r.clipShadows)de?v(null):y();else{var h=de?0:ge,l=4*h,u=n.clippingState||null;for(fe.value=u,u=v(o,e,l,a),o=0;o!==l;++o)u[o]=me[o];n.clippingState=u,Ee+=h}}void 0!==n.numClippingPlanes&&n.numClippingPlanes!==Ee&&(r.needsUpdate=!0)}if(void 0===n.program&&(r.needsUpdate=!0),void 0!==n.lightsHash&&n.lightsHash!==xe.hash&&(r.needsUpdate=!0),r.needsUpdate){e:{if(h=Pe.get(r),l=De.getParameters(r,xe,t,Ee,i),u=De.getProgramCode(r,l),o=h.program,a=!0,void 0===o)r.addEventListener("dispose",s);else if(o.code!==u)c(r);else{if(void 0!==l.shaderID)break e;a=!1}if(a&&(l.shaderID?(o=THREE.ShaderLib[l.shaderID],h.__webglShader={name:r.type,uniforms:THREE.UniformsUtils.clone(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader}):h.__webglShader={name:r.type,uniforms:r.uniforms,vertexShader:r.vertexShader,fragmentShader:r.fragmentShader},r.__webglShader=h.__webglShader,o=De.acquireProgram(r,l,u),h.program=o,r.program=o),l=o.getAttributes(),r.morphTargets)for(u=r.numSupportedMorphTargets=0;u<W.maxMorphTargets;u++)0<=l["morphTarget"+u]&&r.numSupportedMorphTargets++;if(r.morphNormals)for(u=r.numSupportedMorphNormals=0;u<W.maxMorphNormals;u++)0<=l["morphNormal"+u]&&r.numSupportedMorphNormals++;l=h.__webglShader.uniforms,(r instanceof THREE.ShaderMaterial||r instanceof THREE.RawShaderMaterial)&&!0!==r.clipping||(h.numClippingPlanes=Ee,l.clippingPlanes=fe),(r instanceof THREE.MeshPhongMaterial||r instanceof THREE.MeshLambertMaterial||r instanceof THREE.MeshStandardMaterial||r.lights)&&(h.lightsHash=xe.hash,l.ambientLightColor.value=xe.ambient,l.directionalLights.value=xe.directional,l.spotLights.value=xe.spot,l.pointLights.value=xe.point,l.hemisphereLights.value=xe.hemi,l.directionalShadowMap.value=xe.directionalShadowMap,l.directionalShadowMatrix.value=xe.directionalShadowMatrix,l.spotShadowMap.value=xe.spotShadowMap,l.spotShadowMatrix.value=xe.spotShadowMatrix,l.pointShadowMap.value=xe.pointShadowMap,l.pointShadowMatrix.value=xe.pointShadowMatrix),u=h.program.getUniforms(),u=THREE.WebGLUniforms.seqWithValue(u.seq,l),h.uniformsList=u,h.dynamicUniforms=THREE.WebGLUniforms.splitDynamic(u,l)}r.needsUpdate=!1}var p=!1,a=o=!1,h=n.program,u=h.getUniforms(),l=n.__webglShader.uniforms;if(h.id!==X&&(Me.useProgram(h.program),X=h.id,a=o=p=!0),r.id!==Z&&(Z=r.id,o=!0),(p||e!==Q)&&(u.set(Me,e,"projectionMatrix"),Ae.logarithmicDepthBuffer&&u.setValue(Me,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),e!==Q&&(Q=e,a=o=!0),(r instanceof THREE.ShaderMaterial||r instanceof THREE.MeshPhongMaterial||r instanceof THREE.MeshStandardMaterial||r.envMap)&&(p=u.map.cameraPosition,void 0!==p&&p.setValue(Me,He.setFromMatrixPosition(e.matrixWorld))),(r instanceof THREE.MeshPhongMaterial||r instanceof THREE.MeshLambertMaterial||r instanceof THREE.MeshBasicMaterial||r instanceof THREE.MeshStandardMaterial||r instanceof THREE.ShaderMaterial||r.skinning)&&u.setValue(Me,"viewMatrix",e.matrixWorldInverse),u.set(Me,W,"toneMappingExposure"),u.set(Me,W,"toneMappingWhitePoint")),r.skinning&&(u.setOptional(Me,i,"bindMatrix"),u.setOptional(Me,i,"bindMatrixInverse"),p=i.skeleton)&&(Ae.floatVertexTextures&&p.useVertexTexture?(u.set(Me,p,"boneTexture"),u.set(Me,p,"boneTextureWidth"),u.set(Me,p,"boneTextureHeight")):u.setOptional(Me,p,"boneMatrices")),o){if((r instanceof THREE.MeshPhongMaterial||r instanceof THREE.MeshLambertMaterial||r instanceof THREE.MeshStandardMaterial||r.lights)&&(o=a,l.ambientLightColor.needsUpdate=o,l.directionalLights.needsUpdate=o,l.pointLights.needsUpdate=o,l.spotLights.needsUpdate=o,l.hemisphereLights.needsUpdate=o),t&&r.fog&&(l.fogColor.value=t.color,t instanceof THREE.Fog?(l.fogNear.value=t.near,l.fogFar.value=t.far):t instanceof THREE.FogExp2&&(l.fogDensity.value=t.density)),r instanceof THREE.MeshBasicMaterial||r instanceof THREE.MeshLambertMaterial||r instanceof THREE.MeshPhongMaterial||r instanceof THREE.MeshStandardMaterial||r instanceof THREE.MeshDepthMaterial){l.opacity.value=r.opacity,l.diffuse.value=r.color,r.emissive&&l.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),l.map.value=r.map,l.specularMap.value=r.specularMap,l.alphaMap.value=r.alphaMap,r.aoMap&&(l.aoMap.value=r.aoMap,l.aoMapIntensity.value=r.aoMapIntensity);var d;r.map?d=r.map:r.specularMap?d=r.specularMap:r.displacementMap?d=r.displacementMap:r.normalMap?d=r.normalMap:r.bumpMap?d=r.bumpMap:r.roughnessMap?d=r.roughnessMap:r.metalnessMap?d=r.metalnessMap:r.alphaMap?d=r.alphaMap:r.emissiveMap&&(d=r.emissiveMap),void 0!==d&&(d instanceof THREE.WebGLRenderTarget&&(d=d.texture),t=d.offset,d=d.repeat,l.offsetRepeat.value.set(t.x,t.y,d.x,d.y)),l.envMap.value=r.envMap,l.flipEnvMap.value=r.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,l.reflectivity.value=r.reflectivity,l.refractionRatio.value=r.refractionRatio}r instanceof THREE.LineBasicMaterial?(l.diffuse.value=r.color,l.opacity.value=r.opacity):r instanceof THREE.LineDashedMaterial?(l.diffuse.value=r.color,l.opacity.value=r.opacity,l.dashSize.value=r.dashSize,l.totalSize.value=r.dashSize+r.gapSize,l.scale.value=r.scale):r instanceof THREE.PointsMaterial?(l.diffuse.value=r.color,l.opacity.value=r.opacity,l.size.value=r.size*ae,l.scale.value=.5*L.clientHeight,l.map.value=r.map,null!==r.map&&(d=r.map.offset,r=r.map.repeat,l.offsetRepeat.value.set(d.x,d.y,r.x,r.y))):r instanceof THREE.MeshLambertMaterial?(r.lightMap&&(l.lightMap.value=r.lightMap,l.lightMapIntensity.value=r.lightMapIntensity),r.emissiveMap&&(l.emissiveMap.value=r.emissiveMap)):r instanceof THREE.MeshPhongMaterial?(l.specular.value=r.specular,l.shininess.value=Math.max(r.shininess,1e-4),r.lightMap&&(l.lightMap.value=r.lightMap,l.lightMapIntensity.value=r.lightMapIntensity),r.emissiveMap&&(l.emissiveMap.value=r.emissiveMap),r.bumpMap&&(l.bumpMap.value=r.bumpMap,l.bumpScale.value=r.bumpScale),r.normalMap&&(l.normalMap.value=r.normalMap,l.normalScale.value.copy(r.normalScale)),r.displacementMap&&(l.displacementMap.value=r.displacementMap,l.displacementScale.value=r.displacementScale,l.displacementBias.value=r.displacementBias)):r instanceof THREE.MeshPhysicalMaterial?T(l,r):r instanceof THREE.MeshStandardMaterial?T(l,r):r instanceof THREE.MeshDepthMaterial?r.displacementMap&&(l.displacementMap.value=r.displacementMap,l.displacementScale.value=r.displacementScale,l.displacementBias.value=r.displacementBias):r instanceof THREE.MeshNormalMaterial&&(l.opacity.value=r.opacity),THREE.WebGLUniforms.upload(Me,n.uniformsList,l,W)}return u.set(Me,i,"modelViewMatrix"),u.set(Me,i,"normalMatrix"),u.setValue(Me,"modelMatrix",i.matrixWorld),n=n.dynamicUniforms,null!==n&&(THREE.WebGLUniforms.evalDynamic(n,l,i,e),THREE.WebGLUniforms.upload(Me,n,l,W)),h}function T(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function v(e,t,r,i){var n=null!==e?e.length:0,o=null;if(0!==n){if(o=fe.value,!0!==i||null===o){var a=r+4*n;for(t=t.matrixWorldInverse,i=Te.getNormalMatrix(t),(null===o||o.length<a)&&(o=new Float32Array(a)),a=0;a!==n;++a,r+=4){var s=ye.copy(e[a]).applyMatrix4(t,i);s.normal.toArray(o,r),o[r+3]=s.constant}}fe.value=o,fe.needsUpdate=!0}return Ee=n,o}function y(){fe.value!==me&&(fe.value=me,fe.needsUpdate=ge>0),Ee=ge}function R(e,t,r){r?(Me.texParameteri(e,Me.TEXTURE_WRAP_S,S(t.wrapS)),Me.texParameteri(e,Me.TEXTURE_WRAP_T,S(t.wrapT)),Me.texParameteri(e,Me.TEXTURE_MAG_FILTER,S(t.magFilter)),Me.texParameteri(e,Me.TEXTURE_MIN_FILTER,S(t.minFilter))):(Me.texParameteri(e,Me.TEXTURE_WRAP_S,Me.CLAMP_TO_EDGE),Me.texParameteri(e,Me.TEXTURE_WRAP_T,Me.CLAMP_TO_EDGE),t.wrapS===THREE.ClampToEdgeWrapping&&t.wrapT===THREE.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",t),Me.texParameteri(e,Me.TEXTURE_MAG_FILTER,w(t.magFilter)),Me.texParameteri(e,Me.TEXTURE_MIN_FILTER,w(t.minFilter)),t.minFilter!==THREE.NearestFilter&&t.minFilter!==THREE.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",t)),!(r=Le.get("EXT_texture_filter_anisotropic"))||t.type===THREE.FloatType&&null===Le.get("OES_texture_float_linear")||t.type===THREE.HalfFloatType&&null===Le.get("OES_texture_half_float_linear")||!(1<t.anisotropy||Pe.get(t).__currentAnisotropy)||(Me.texParameterf(e,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,W.getMaxAnisotropy())),Pe.get(t).__currentAnisotropy=t.anisotropy)}function H(e,t){e instanceof THREE.WebGLRenderTarget&&(e=e.texture);var r=Pe.get(e);if(0<e.version&&r.__version!==e.version){var i=e.image;if(void 0===i)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else if(!1===i.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e);else{i=e,void 0===r.__webglInit&&(r.__webglInit=!0,i.addEventListener("dispose",o),r.__webglTexture=Me.createTexture(),be.textures++),Ce.activeTexture(Me.TEXTURE0+t),Ce.bindTexture(Me.TEXTURE_2D,r.__webglTexture),Me.pixelStorei(Me.UNPACK_FLIP_Y_WEBGL,i.flipY),Me.pixelStorei(Me.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),Me.pixelStorei(Me.UNPACK_ALIGNMENT,i.unpackAlignment);var n=x(i.image,Ae.maxTextureSize);if((i.wrapS!==THREE.ClampToEdgeWrapping||i.wrapT!==THREE.ClampToEdgeWrapping||i.minFilter!==THREE.NearestFilter&&i.minFilter!==THREE.LinearFilter)&&!1===b(n)){var a=n;if(a instanceof HTMLImageElement||a instanceof HTMLCanvasElement){var s=document.createElement("canvas");s.width=THREE.Math.nearestPowerOfTwo(a.width),s.height=THREE.Math.nearestPowerOfTwo(a.height),s.getContext("2d").drawImage(a,0,0,s.width,s.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+a.width+"x"+a.height+"). Resized to "+s.width+"x"+s.height,a),n=s}else n=a}var a=b(n),s=S(i.format),c=S(i.type);R(Me.TEXTURE_2D,i,a);var h=i.mipmaps;if(i instanceof THREE.DepthTexture){if(h=Me.DEPTH_COMPONENT,i.type===THREE.FloatType){if(!Se)throw Error("Float Depth Texture only supported in WebGL2.0");h=Me.DEPTH_COMPONENT32F}else Se&&(h=Me.DEPTH_COMPONENT16);Ce.texImage2D(Me.TEXTURE_2D,0,h,n.width,n.height,0,s,c,null)}else if(i instanceof THREE.DataTexture)if(0<h.length&&a){for(var l=0,u=h.length;u>l;l++)n=h[l],Ce.texImage2D(Me.TEXTURE_2D,l,s,n.width,n.height,0,s,c,n.data);i.generateMipmaps=!1}else Ce.texImage2D(Me.TEXTURE_2D,0,s,n.width,n.height,0,s,c,n.data);else if(i instanceof THREE.CompressedTexture)for(l=0,u=h.length;u>l;l++)n=h[l],i.format!==THREE.RGBAFormat&&i.format!==THREE.RGBFormat?-1<Ce.getCompressedTextureFormats().indexOf(s)?Ce.compressedTexImage2D(Me.TEXTURE_2D,l,s,n.width,n.height,0,n.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ce.texImage2D(Me.TEXTURE_2D,l,s,n.width,n.height,0,s,c,n.data);else if(0<h.length&&a){for(l=0,u=h.length;u>l;l++)n=h[l],Ce.texImage2D(Me.TEXTURE_2D,l,s,s,c,n);i.generateMipmaps=!1}else Ce.texImage2D(Me.TEXTURE_2D,0,s,s,c,n);i.generateMipmaps&&a&&Me.generateMipmap(Me.TEXTURE_2D),r.__version=i.version,i.onUpdate&&i.onUpdate(i)}}else Ce.activeTexture(Me.TEXTURE0+t),Ce.bindTexture(Me.TEXTURE_2D,r.__webglTexture)}function x(e,t){if(e.width>t||e.height>t){var r=t/Math.max(e.width,e.height),i=document.createElement("canvas");return i.width=Math.floor(e.width*r),i.height=Math.floor(e.height*r),i.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+i.width+"x"+i.height,e),i}return e}function b(e){return THREE.Math.isPowerOfTwo(e.width)&&THREE.Math.isPowerOfTwo(e.height)}function _(e,t,r,i){var n=S(t.texture.format),o=S(t.texture.type);Ce.texImage2D(i,0,n,t.width,t.height,0,n,o,null),Me.bindFramebuffer(Me.FRAMEBUFFER,e),Me.framebufferTexture2D(Me.FRAMEBUFFER,r,i,Pe.get(t.texture).__webglTexture,0),Me.bindFramebuffer(Me.FRAMEBUFFER,null)}function M(e,t){Me.bindRenderbuffer(Me.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(Me.renderbufferStorage(Me.RENDERBUFFER,Me.DEPTH_COMPONENT16,t.width,t.height),Me.framebufferRenderbuffer(Me.FRAMEBUFFER,Me.DEPTH_ATTACHMENT,Me.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(Me.renderbufferStorage(Me.RENDERBUFFER,Me.DEPTH_STENCIL,t.width,t.height),Me.framebufferRenderbuffer(Me.FRAMEBUFFER,Me.DEPTH_STENCIL_ATTACHMENT,Me.RENDERBUFFER,e)):Me.renderbufferStorage(Me.RENDERBUFFER,Me.RGBA4,t.width,t.height),Me.bindRenderbuffer(Me.RENDERBUFFER,null)}function w(e){return e===THREE.NearestFilter||e===THREE.NearestMipMapNearestFilter||e===THREE.NearestMipMapLinearFilter?Me.NEAREST:Me.LINEAR}function S(e){var t;if(e===THREE.RepeatWrapping)return Me.REPEAT;if(e===THREE.ClampToEdgeWrapping)return Me.CLAMP_TO_EDGE;if(e===THREE.MirroredRepeatWrapping)return Me.MIRRORED_REPEAT;if(e===THREE.NearestFilter)return Me.NEAREST;if(e===THREE.NearestMipMapNearestFilter)return Me.NEAREST_MIPMAP_NEAREST;if(e===THREE.NearestMipMapLinearFilter)return Me.NEAREST_MIPMAP_LINEAR;if(e===THREE.LinearFilter)return Me.LINEAR;if(e===THREE.LinearMipMapNearestFilter)return Me.LINEAR_MIPMAP_NEAREST;if(e===THREE.LinearMipMapLinearFilter)return Me.LINEAR_MIPMAP_LINEAR;if(e===THREE.UnsignedByteType)return Me.UNSIGNED_BYTE;if(e===THREE.UnsignedShort4444Type)return Me.UNSIGNED_SHORT_4_4_4_4;if(e===THREE.UnsignedShort5551Type)return Me.UNSIGNED_SHORT_5_5_5_1;if(e===THREE.UnsignedShort565Type)return Me.UNSIGNED_SHORT_5_6_5;if(e===THREE.ByteType)return Me.BYTE;if(e===THREE.ShortType)return Me.SHORT;if(e===THREE.UnsignedShortType)return Me.UNSIGNED_SHORT;if(e===THREE.IntType)return Me.INT;if(e===THREE.UnsignedIntType)return Me.UNSIGNED_INT;if(e===THREE.FloatType)return Me.FLOAT;if(t=Le.get("OES_texture_half_float"),null!==t&&e===THREE.HalfFloatType)return t.HALF_FLOAT_OES;if(e===THREE.AlphaFormat)return Me.ALPHA;if(e===THREE.RGBFormat)return Me.RGB;if(e===THREE.RGBAFormat)return Me.RGBA;if(e===THREE.LuminanceFormat)return Me.LUMINANCE;if(e===THREE.LuminanceAlphaFormat)return Me.LUMINANCE_ALPHA;if(e===THREE.DepthFormat)return Me.DEPTH_COMPONENT;if(e===THREE.AddEquation)return Me.FUNC_ADD;if(e===THREE.SubtractEquation)return Me.FUNC_SUBTRACT;if(e===THREE.ReverseSubtractEquation)return Me.FUNC_REVERSE_SUBTRACT;if(e===THREE.ZeroFactor)return Me.ZERO;if(e===THREE.OneFactor)return Me.ONE;if(e===THREE.SrcColorFactor)return Me.SRC_COLOR;if(e===THREE.OneMinusSrcColorFactor)return Me.ONE_MINUS_SRC_COLOR;if(e===THREE.SrcAlphaFactor)return Me.SRC_ALPHA;if(e===THREE.OneMinusSrcAlphaFactor)return Me.ONE_MINUS_SRC_ALPHA;if(e===THREE.DstAlphaFactor)return Me.DST_ALPHA;if(e===THREE.OneMinusDstAlphaFactor)return Me.ONE_MINUS_DST_ALPHA;if(e===THREE.DstColorFactor)return Me.DST_COLOR;if(e===THREE.OneMinusDstColorFactor)return Me.ONE_MINUS_DST_COLOR;if(e===THREE.SrcAlphaSaturateFactor)return Me.SRC_ALPHA_SATURATE;if(t=Le.get("WEBGL_compressed_texture_s3tc"),null!==t){if(e===THREE.RGB_S3TC_DXT1_Format)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===THREE.RGBA_S3TC_DXT1_Format)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===THREE.RGBA_S3TC_DXT3_Format)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===THREE.RGBA_S3TC_DXT5_Format)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t=Le.get("WEBGL_compressed_texture_pvrtc"),null!==t){if(e===THREE.RGB_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===THREE.RGB_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===THREE.RGBA_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===THREE.RGBA_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t=Le.get("WEBGL_compressed_texture_etc1"),null!==t&&e===THREE.RGB_ETC1_Format)return t.COMPRESSED_RGB_ETC1_WEBGL;if(t=Le.get("EXT_blend_minmax"),null!==t){if(e===THREE.MinEquation)return t.MIN_EXT;if(e===THREE.MaxEquation)return t.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION),e=e||{};var L=void 0!==e.canvas?e.canvas:document.createElement("canvas"),A=void 0!==e.context?e.context:null,C=void 0!==e.alpha?e.alpha:!1,P=void 0!==e.depth?e.depth:!0,B=void 0!==e.stencil?e.stencil:!0,D=void 0!==e.antialias?e.antialias:!1,I=void 0!==e.premultipliedAlpha?e.premultipliedAlpha:!0,U=void 0!==e.preserveDrawingBuffer?e.preserveDrawingBuffer:!1,F=[],N=[],O=-1,V=[],G=-1,z=new Float32Array(8),k=[],j=[];this.domElement=L,this.context=null,this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.physicallyCorrectLights=this.gammaOutput=this.gammaInput=!1,this.toneMapping=THREE.LinearToneMapping,this.toneMappingWhitePoint=this.toneMappingExposure=1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0;var W=this,X=null,q=null,Y=null,Z=-1,K="",Q=null,J=new THREE.Vector4,$=null,ee=new THREE.Vector4,te=0,re=new THREE.Color(0),ie=0,ne=L.width,oe=L.height,ae=1,se=new THREE.Vector4(0,0,ne,oe),ce=!1,he=new THREE.Vector4(0,0,ne,oe),le=new THREE.Frustum,ue=!1,pe=!1,de=!1,Ee=0,fe={type:"4fv",value:null,needsUpdate:!1},me=null,ge=0,Te=new THREE.Matrix3,ve=new THREE.Sphere,ye=new THREE.Plane,Re=new THREE.Matrix4,He=new THREE.Vector3,xe={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},be={geometries:0,textures:0},_e={calls:0,vertices:0,faces:0,points:0};this.info={render:_e,memory:be,programs:null};var Me;try{if(C={alpha:C,depth:P,stencil:B,antialias:D,premultipliedAlpha:I,preserveDrawingBuffer:U},Me=A||L.getContext("webgl",C)||L.getContext("experimental-webgl",C),null===Me){if(null!==L.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context."}void 0===Me.getShaderPrecisionFormat&&(Me.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),L.addEventListener("webglcontextlost",n,!1)}catch(we){console.error("THREE.WebGLRenderer: "+we)}var Se="undefined"!=typeof WebGL2RenderingContext&&Me instanceof WebGL2RenderingContext,Le=new THREE.WebGLExtensions(Me);Le.get("WEBGL_depth_texture"),Le.get("OES_texture_float"),Le.get("OES_texture_float_linear"),Le.get("OES_texture_half_float"),Le.get("OES_texture_half_float_linear"),Le.get("OES_standard_derivatives"),Le.get("ANGLE_instanced_arrays"),Le.get("OES_element_index_uint")&&(THREE.BufferGeometry.MaxIndex=4294967296);var Ae=new THREE.WebGLCapabilities(Me,Le,e),Ce=new THREE.WebGLState(Me,Le,S),Pe=new THREE.WebGLProperties,Be=new THREE.WebGLObjects(Me,Pe,this.info),De=new THREE.WebGLPrograms(this,Ae),Ie=new THREE.WebGLLights;this.info.programs=De.programs;var Ue=new THREE.WebGLBufferRenderer(Me,Le,_e),Fe=new THREE.WebGLIndexedBufferRenderer(Me,Le,_e);r(),this.context=Me,this.capabilities=Ae,this.extensions=Le,this.properties=Pe,this.state=Ce;var Ne=new THREE.WebGLShadowMap(this,xe,Be);this.shadowMap=Ne;var Oe=new THREE.SpritePlugin(this,k),Ve=new THREE.LensFlarePlugin(this,j);this.getContext=function(){return Me},this.getContextAttributes=function(){return Me.getContextAttributes()},this.forceContextLoss=function(){Le.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){var e;return function(){if(void 0!==e)return e;var t=Le.get("EXT_texture_filter_anisotropic");return e=null!==t?Me.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}(),this.getPrecision=function(){return Ae.precision},this.getPixelRatio=function(){return ae},this.setPixelRatio=function(e){void 0!==e&&(ae=e,this.setSize(he.z,he.w,!1))},this.getSize=function(){return{width:ne,height:oe}},this.setSize=function(e,t,r){ne=e,oe=t,L.width=e*ae,L.height=t*ae,!1!==r&&(L.style.width=e+"px",L.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,r,i){Ce.viewport(he.set(e,t,r,i))},this.setScissor=function(e,t,r,i){Ce.scissor(se.set(e,t,r,i))},this.setScissorTest=function(e){Ce.setScissorTest(ce=e)},this.getClearColor=function(){return re},this.setClearColor=function(e,r){re.set(e),ie=void 0!==r?r:1,t(re.r,re.g,re.b,ie)},this.getClearAlpha=function(){return ie},this.setClearAlpha=function(e){ie=e,t(re.r,re.g,re.b,ie)},this.clear=function(e,t,r){var i=0;(void 0===e||e)&&(i|=Me.COLOR_BUFFER_BIT),(void 0===t||t)&&(i|=Me.DEPTH_BUFFER_BIT),(void 0===r||r)&&(i|=Me.STENCIL_BUFFER_BIT),Me.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(e,t,r,i){this.setRenderTarget(e),this.clear(t,r,i)},this.resetGLState=i,this.dispose=function(){L.removeEventListener("webglcontextlost",n,!1)},this.renderBufferImmediate=function(e,t,r){Ce.initAttributes();var i=Pe.get(e);if(e.hasPositions&&!i.position&&(i.position=Me.createBuffer()),e.hasNormals&&!i.normal&&(i.normal=Me.createBuffer()),e.hasUvs&&!i.uv&&(i.uv=Me.createBuffer()),e.hasColors&&!i.color&&(i.color=Me.createBuffer()),t=t.getAttributes(),e.hasPositions&&(Me.bindBuffer(Me.ARRAY_BUFFER,i.position),Me.bufferData(Me.ARRAY_BUFFER,e.positionArray,Me.DYNAMIC_DRAW),Ce.enableAttribute(t.position),Me.vertexAttribPointer(t.position,3,Me.FLOAT,!1,0,0)),e.hasNormals){if(Me.bindBuffer(Me.ARRAY_BUFFER,i.normal),"MeshPhongMaterial"!==r.type&&"MeshStandardMaterial"!==r.type&&"MeshPhysicalMaterial"!==r.type&&r.shading===THREE.FlatShading)for(var n=0,o=3*e.count;o>n;n+=9){var a=e.normalArray,s=(a[n+0]+a[n+3]+a[n+6])/3,c=(a[n+1]+a[n+4]+a[n+7])/3,h=(a[n+2]+a[n+5]+a[n+8])/3;a[n+0]=s,a[n+1]=c,a[n+2]=h,a[n+3]=s,a[n+4]=c,a[n+5]=h,a[n+6]=s,a[n+7]=c,a[n+8]=h}Me.bufferData(Me.ARRAY_BUFFER,e.normalArray,Me.DYNAMIC_DRAW),Ce.enableAttribute(t.normal),Me.vertexAttribPointer(t.normal,3,Me.FLOAT,!1,0,0)}e.hasUvs&&r.map&&(Me.bindBuffer(Me.ARRAY_BUFFER,i.uv),Me.bufferData(Me.ARRAY_BUFFER,e.uvArray,Me.DYNAMIC_DRAW),Ce.enableAttribute(t.uv),Me.vertexAttribPointer(t.uv,2,Me.FLOAT,!1,0,0)),e.hasColors&&r.vertexColors!==THREE.NoColors&&(Me.bindBuffer(Me.ARRAY_BUFFER,i.color),Me.bufferData(Me.ARRAY_BUFFER,e.colorArray,Me.DYNAMIC_DRAW),Ce.enableAttribute(t.color),Me.vertexAttribPointer(t.color,3,Me.FLOAT,!1,0,0)),Ce.disableUnusedAttributes(),Me.drawArrays(Me.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,r,i,n,o){m(i);var a=g(e,t,i,n),s=!1;if(e=r.id+"_"+a.id+"_"+i.wireframe,e!==K&&(K=e,s=!0),t=n.morphTargetInfluences,void 0!==t){e=[];for(var c=0,s=t.length;s>c;c++){var l=t[c];e.push([l,c])}e.sort(h),8<e.length&&(e.length=8);for(var u=r.morphAttributes,c=0,s=e.length;s>c;c++)l=e[c],z[c]=l[0],0!==l[0]?(t=l[1],!0===i.morphTargets&&u.position&&r.addAttribute("morphTarget"+c,u.position[t]),!0===i.morphNormals&&u.normal&&r.addAttribute("morphNormal"+c,u.normal[t])):(!0===i.morphTargets&&r.removeAttribute("morphTarget"+c),!0===i.morphNormals&&r.removeAttribute("morphNormal"+c));a.getUniforms().setValue(Me,"morphTargetInfluences",z),s=!0}if(t=r.index,c=r.attributes.position,!0===i.wireframe&&(t=Be.getWireframeAttribute(r)),null!==t?(e=Fe,e.setIndex(t)):e=Ue,s){var p,s=void 0;if(r instanceof THREE.InstancedBufferGeometry&&(p=Le.get("ANGLE_instanced_arrays"),null===p))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{void 0===s&&(s=0),Ce.initAttributes();var d,l=r.attributes,a=a.getAttributes(),u=i.defaultAttributeValues;for(d in a){var E=a[d];if(E>=0){var f=l[d];if(void 0!==f){var T=Me.FLOAT,v=f.array,y=f.normalized;v instanceof Float32Array?T=Me.FLOAT:v instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):v instanceof Uint16Array?T=Me.UNSIGNED_SHORT:v instanceof Int16Array?T=Me.SHORT:v instanceof Uint32Array?T=Me.UNSIGNED_INT:v instanceof Int32Array?T=Me.INT:v instanceof Int8Array?T=Me.BYTE:v instanceof Uint8Array&&(T=Me.UNSIGNED_BYTE);var v=f.itemSize,R=Be.getAttributeBuffer(f);if(f instanceof THREE.InterleavedBufferAttribute){var H=f.data,x=H.stride,f=f.offset;H instanceof THREE.InstancedInterleavedBuffer?(Ce.enableAttributeAndDivisor(E,H.meshPerAttribute,p),void 0===r.maxInstancedCount&&(r.maxInstancedCount=H.meshPerAttribute*H.count)):Ce.enableAttribute(E),Me.bindBuffer(Me.ARRAY_BUFFER,R),Me.vertexAttribPointer(E,v,T,y,x*H.array.BYTES_PER_ELEMENT,(s*x+f)*H.array.BYTES_PER_ELEMENT)}else f instanceof THREE.InstancedBufferAttribute?(Ce.enableAttributeAndDivisor(E,f.meshPerAttribute,p),void 0===r.maxInstancedCount&&(r.maxInstancedCount=f.meshPerAttribute*f.count)):Ce.enableAttribute(E),Me.bindBuffer(Me.ARRAY_BUFFER,R),Me.vertexAttribPointer(E,v,T,y,0,s*v*f.array.BYTES_PER_ELEMENT)}else if(void 0!==u&&(T=u[d],void 0!==T))switch(T.length){case 2:Me.vertexAttrib2fv(E,T);break;case 3:Me.vertexAttrib3fv(E,T);break;case 4:Me.vertexAttrib4fv(E,T);break;default:Me.vertexAttrib1fv(E,T)}}}Ce.disableUnusedAttributes()}null!==t&&Me.bindBuffer(Me.ELEMENT_ARRAY_BUFFER,Be.getAttributeBuffer(t))}if(p=1/0,null!==t?p=t.count:void 0!==c&&(p=c.count),d=r.drawRange.start,t=r.drawRange.count,c=null!==o?o.start:0,s=null!==o?o.count:1/0,o=Math.max(0,d,c),p=Math.min(0+p,d+t,c+s)-1,p=Math.max(0,p-o+1),n instanceof THREE.Mesh)if(!0===i.wireframe)Ce.setLineWidth(i.wireframeLinewidth*(null===q?ae:1)),e.setMode(Me.LINES);else switch(n.drawMode){case THREE.TrianglesDrawMode:e.setMode(Me.TRIANGLES);break;case THREE.TriangleStripDrawMode:e.setMode(Me.TRIANGLE_STRIP);break;case THREE.TriangleFanDrawMode:e.setMode(Me.TRIANGLE_FAN)}else n instanceof THREE.Line?(i=i.linewidth,void 0===i&&(i=1),Ce.setLineWidth(i*(null===q?ae:1)),n instanceof THREE.LineSegments?e.setMode(Me.LINES):e.setMode(Me.LINE_STRIP)):n instanceof THREE.Points&&e.setMode(Me.POINTS);r instanceof THREE.InstancedBufferGeometry?0<r.maxInstancedCount&&e.renderInstances(r,o,p):e.render(o,p)},this.render=function(e,t,r,i){if(!1==t instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var n=e.fog;K="",Z=-1,Q=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),Re.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),le.setFromMatrix(Re),F.length=0,G=O=-1,k.length=0,j.length=0;var o=this.clippingPlanes;ue=0!==W.clippingPlanes.length||W.localClippingEnabled||0!==ge||pe,pe=W.localClippingEnabled,me=v(o,t,0),ge=null!==o?o.length:0,E(e,t),N.length=O+1,V.length=G+1,!0===W.sortObjects&&(N.sort(l),V.sort(u)),ue&&(de=!0,v(null));for(var o=F,a=0,s=0,c=o.length;c>s;s++){var h=o[s];h.castShadow&&(xe.shadows[a++]=h)}xe.shadows.length=a,Ne.render(e,t);for(var p,d,m,o=F,g=h=0,T=0,R=t.matrixWorldInverse,H=0,x=0,_=0,M=0,a=0,s=o.length;s>a;a++)if(c=o[a],p=c.color,d=c.intensity,m=c.distance,c instanceof THREE.AmbientLight)h+=p.r*d,g+=p.g*d,T+=p.b*d;else if(c instanceof THREE.DirectionalLight){var w=Ie.get(c);w.color.copy(c.color).multiplyScalar(c.intensity),w.direction.setFromMatrixPosition(c.matrixWorld),He.setFromMatrixPosition(c.target.matrixWorld),w.direction.sub(He),w.direction.transformDirection(R),(w.shadow=c.castShadow)&&(w.shadowBias=c.shadow.bias,w.shadowRadius=c.shadow.radius, w.shadowMapSize=c.shadow.mapSize),xe.directionalShadowMap[H]=c.shadow.map,xe.directionalShadowMatrix[H]=c.shadow.matrix,xe.directional[H++]=w}else c instanceof THREE.SpotLight?(w=Ie.get(c),w.position.setFromMatrixPosition(c.matrixWorld),w.position.applyMatrix4(R),w.color.copy(p).multiplyScalar(d),w.distance=m,w.direction.setFromMatrixPosition(c.matrixWorld),He.setFromMatrixPosition(c.target.matrixWorld),w.direction.sub(He),w.direction.transformDirection(R),w.coneCos=Math.cos(c.angle),w.penumbraCos=Math.cos(c.angle*(1-c.penumbra)),w.decay=0===c.distance?0:c.decay,(w.shadow=c.castShadow)&&(w.shadowBias=c.shadow.bias,w.shadowRadius=c.shadow.radius,w.shadowMapSize=c.shadow.mapSize),xe.spotShadowMap[_]=c.shadow.map,xe.spotShadowMatrix[_]=c.shadow.matrix,xe.spot[_++]=w):c instanceof THREE.PointLight?(w=Ie.get(c),w.position.setFromMatrixPosition(c.matrixWorld),w.position.applyMatrix4(R),w.color.copy(c.color).multiplyScalar(c.intensity),w.distance=c.distance,w.decay=0===c.distance?0:c.decay,(w.shadow=c.castShadow)&&(w.shadowBias=c.shadow.bias,w.shadowRadius=c.shadow.radius,w.shadowMapSize=c.shadow.mapSize),xe.pointShadowMap[x]=c.shadow.map,void 0===xe.pointShadowMatrix[x]&&(xe.pointShadowMatrix[x]=new THREE.Matrix4),He.setFromMatrixPosition(c.matrixWorld).negate(),xe.pointShadowMatrix[x].identity().setPosition(He),xe.point[x++]=w):c instanceof THREE.HemisphereLight&&(w=Ie.get(c),w.direction.setFromMatrixPosition(c.matrixWorld),w.direction.transformDirection(R),w.direction.normalize(),w.skyColor.copy(c.color).multiplyScalar(d),w.groundColor.copy(c.groundColor).multiplyScalar(d),xe.hemi[M++]=w);xe.ambient[0]=h,xe.ambient[1]=g,xe.ambient[2]=T,xe.directional.length=H,xe.spot.length=_,xe.point.length=x,xe.hemi.length=M,xe.hash=H+","+x+","+_+","+M+","+xe.shadows.length,ue&&(de=!1,y()),_e.calls=0,_e.vertices=0,_e.faces=0,_e.points=0,void 0===r&&(r=null),this.setRenderTarget(r),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),e.overrideMaterial?(i=e.overrideMaterial,f(N,t,n,i),f(V,t,n,i)):(Ce.setBlending(THREE.NoBlending),f(N,t,n),f(V,t,n)),Oe.render(e,t),Ve.render(e,t,ee),r&&(e=r.texture,e.generateMipmaps&&b(r)&&e.minFilter!==THREE.NearestFilter&&e.minFilter!==THREE.LinearFilter&&(e=r instanceof THREE.WebGLRenderTargetCube?Me.TEXTURE_CUBE_MAP:Me.TEXTURE_2D,r=Pe.get(r.texture).__webglTexture,Ce.bindTexture(e,r),Me.generateMipmap(e),Ce.bindTexture(e,null))),Ce.setDepthTest(!0),Ce.setDepthWrite(!0),Ce.setColorWrite(!0)}},this.setFaceCulling=function(e,t){e===THREE.CullFaceNone?Ce.disable(Me.CULL_FACE):(t===THREE.FrontFaceDirectionCW?Me.frontFace(Me.CW):Me.frontFace(Me.CCW),e===THREE.CullFaceBack?Me.cullFace(Me.BACK):e===THREE.CullFaceFront?Me.cullFace(Me.FRONT):Me.cullFace(Me.FRONT_AND_BACK),Ce.enable(Me.CULL_FACE))};var Ge=!1;this.setTexture=function(e,t){Ge||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),Ge=!0),H(e,t)},this.allocTextureUnit=function(){var e=te;return e>=Ae.maxTextures&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+Ae.maxTextures),te+=1,e},this.setTexture2D=H,this.setTextureCube=function(e,t){if(e instanceof THREE.CubeTexture||Array.isArray(e.image)&&6===e.image.length){var r=Pe.get(e);if(6===e.image.length)if(0<e.version&&r.__version!==e.version){r.__image__webglTextureCube||(e.addEventListener("dispose",o),r.__image__webglTextureCube=Me.createTexture(),be.textures++),Ce.activeTexture(Me.TEXTURE0+t),Ce.bindTexture(Me.TEXTURE_CUBE_MAP,r.__image__webglTextureCube),Me.pixelStorei(Me.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var i=e instanceof THREE.CompressedTexture,n=e.image[0]instanceof THREE.DataTexture,a=[],s=0;6>s;s++)a[s]=!W.autoScaleCubemaps||i||n?n?e.image[s].image:e.image[s]:x(e.image[s],Ae.maxCubemapSize);var c=b(a[0]),h=S(e.format),l=S(e.type);for(R(Me.TEXTURE_CUBE_MAP,e,c),s=0;6>s;s++)if(i)for(var u,p=a[s].mipmaps,d=0,E=p.length;E>d;d++)u=p[d],e.format!==THREE.RGBAFormat&&e.format!==THREE.RGBFormat?-1<Ce.getCompressedTextureFormats().indexOf(h)?Ce.compressedTexImage2D(Me.TEXTURE_CUBE_MAP_POSITIVE_X+s,d,h,u.width,u.height,0,u.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):Ce.texImage2D(Me.TEXTURE_CUBE_MAP_POSITIVE_X+s,d,h,u.width,u.height,0,h,l,u.data);else n?Ce.texImage2D(Me.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,h,a[s].width,a[s].height,0,h,l,a[s].data):Ce.texImage2D(Me.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,h,h,l,a[s]);e.generateMipmaps&&c&&Me.generateMipmap(Me.TEXTURE_CUBE_MAP),r.__version=e.version,e.onUpdate&&e.onUpdate(e)}else Ce.activeTexture(Me.TEXTURE0+t),Ce.bindTexture(Me.TEXTURE_CUBE_MAP,r.__image__webglTextureCube)}else r=e.texture,Ce.activeTexture(Me.TEXTURE0+t),Ce.bindTexture(Me.TEXTURE_CUBE_MAP,Pe.get(r).__webglTexture)},this.getCurrentRenderTarget=function(){return q},this.setRenderTarget=function(e){if((q=e)&&void 0===Pe.get(e).__webglFramebuffer){var t=Pe.get(e),r=Pe.get(e.texture);e.addEventListener("dispose",a),r.__webglTexture=Me.createTexture(),be.textures++;var i=e instanceof THREE.WebGLRenderTargetCube,n=THREE.Math.isPowerOfTwo(e.width)&&THREE.Math.isPowerOfTwo(e.height);if(i){t.__webglFramebuffer=[];for(var o=0;6>o;o++)t.__webglFramebuffer[o]=Me.createFramebuffer()}else t.__webglFramebuffer=Me.createFramebuffer();if(i){for(Ce.bindTexture(Me.TEXTURE_CUBE_MAP,r.__webglTexture),R(Me.TEXTURE_CUBE_MAP,e.texture,n),o=0;6>o;o++)_(t.__webglFramebuffer[o],e,Me.COLOR_ATTACHMENT0,Me.TEXTURE_CUBE_MAP_POSITIVE_X+o);e.texture.generateMipmaps&&n&&Me.generateMipmap(Me.TEXTURE_CUBE_MAP),Ce.bindTexture(Me.TEXTURE_CUBE_MAP,null)}else Ce.bindTexture(Me.TEXTURE_2D,r.__webglTexture),R(Me.TEXTURE_2D,e.texture,n),_(t.__webglFramebuffer,e,Me.COLOR_ATTACHMENT0,Me.TEXTURE_2D),e.texture.generateMipmaps&&n&&Me.generateMipmap(Me.TEXTURE_2D),Ce.bindTexture(Me.TEXTURE_2D,null);if(e.depthBuffer){if(t=Pe.get(e),r=e instanceof THREE.WebGLRenderTargetCube,e.depthTexture){if(r)throw Error("target.depthTexture not supported in Cube render targets");if(e instanceof THREE.WebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported!");if(Me.bindFramebuffer(Me.FRAMEBUFFER,t.__webglFramebuffer),!(e.depthTexture instanceof THREE.DepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");Pe.get(e.depthTexture).__webglTexture&&e.depthTexture.image.width===e.width&&e.depthTexture.image.height===e.height||(e.depthTexture.image.width=e.width,e.depthTexture.image.height=e.height,e.depthTexture.needsUpdate=!0),W.setTexture(e.depthTexture,0),t=Pe.get(e.depthTexture).__webglTexture,Me.framebufferTexture2D(Me.FRAMEBUFFER,Me.DEPTH_ATTACHMENT,Me.TEXTURE_2D,t,0)}else if(r)for(t.__webglDepthbuffer=[],r=0;6>r;r++)Me.bindFramebuffer(Me.FRAMEBUFFER,t.__webglFramebuffer[r]),t.__webglDepthbuffer[r]=Me.createRenderbuffer(),M(t.__webglDepthbuffer[r],e);else Me.bindFramebuffer(Me.FRAMEBUFFER,t.__webglFramebuffer),t.__webglDepthbuffer=Me.createRenderbuffer(),M(t.__webglDepthbuffer,e);Me.bindFramebuffer(Me.FRAMEBUFFER,null)}}t=e instanceof THREE.WebGLRenderTargetCube,e?(r=Pe.get(e),r=t?r.__webglFramebuffer[e.activeCubeFace]:r.__webglFramebuffer,J.copy(e.scissor),$=e.scissorTest,ee.copy(e.viewport)):(r=null,J.copy(se).multiplyScalar(ae),$=ce,ee.copy(he).multiplyScalar(ae)),Y!==r&&(Me.bindFramebuffer(Me.FRAMEBUFFER,r),Y=r),Ce.scissor(J),Ce.setScissorTest($),Ce.viewport(ee),t&&(t=Pe.get(e.texture),Me.framebufferTexture2D(Me.FRAMEBUFFER,Me.COLOR_ATTACHMENT0,Me.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,t.__webglTexture,e.activeMipMapLevel))},this.readRenderTargetPixels=function(e,t,r,i,n,o){if(!1==e instanceof THREE.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var a=Pe.get(e).__webglFramebuffer;if(a){var s=!1;a!==Y&&(Me.bindFramebuffer(Me.FRAMEBUFFER,a),s=!0);try{var c=e.texture;c.format!==THREE.RGBAFormat&&S(c.format)!==Me.getParameter(Me.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):c.type===THREE.UnsignedByteType||S(c.type)===Me.getParameter(Me.IMPLEMENTATION_COLOR_READ_TYPE)||c.type===THREE.FloatType&&Le.get("WEBGL_color_buffer_float")||c.type===THREE.HalfFloatType&&Le.get("EXT_color_buffer_half_float")?Me.checkFramebufferStatus(Me.FRAMEBUFFER)===Me.FRAMEBUFFER_COMPLETE?t>0&&t<=e.width-i&&r>0&&r<=e.height-n&&Me.readPixels(t,r,i,n,S(c.format),S(c.type),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{s&&Me.bindFramebuffer(Me.FRAMEBUFFER,Y)}}}}},THREE.WebGLRenderTarget=function(e,t,r){this.uuid=THREE.Math.generateUUID(),this.width=e,this.height=t,this.scissor=new THREE.Vector4(0,0,e,t),this.scissorTest=!1,this.viewport=new THREE.Vector4(0,0,e,t),r=r||{},void 0===r.minFilter&&(r.minFilter=THREE.LinearFilter),this.texture=new THREE.Texture(void 0,void 0,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.depthBuffer=void 0!==r.depthBuffer?r.depthBuffer:!0,this.stencilBuffer=void 0!==r.stencilBuffer?r.stencilBuffer:!0,this.depthTexture=null},THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(e,t){(this.width!==e||this.height!==t)&&(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype),THREE.WebGLRenderTargetCube=function(e,t,r){THREE.WebGLRenderTarget.call(this,e,t,r),this.activeMipMapLevel=this.activeCubeFace=0},THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype),THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube,THREE.WebGLBufferRenderer=function(e,t,r){var i;this.setMode=function(e){i=e},this.render=function(t,n){e.drawArrays(i,t,n),r.calls++,r.vertices+=n,i===e.TRIANGLES&&(r.faces+=n/3)},this.renderInstances=function(n){var o=t.get("ANGLE_instanced_arrays");if(null===o)console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{var a=n.attributes.position,s=0,s=a instanceof THREE.InterleavedBufferAttribute?a.data.count:a.count;o.drawArraysInstancedANGLE(i,0,s,n.maxInstancedCount),r.calls++,r.vertices+=s*n.maxInstancedCount,i===e.TRIANGLES&&(r.faces+=n.maxInstancedCount*s/3)}}},THREE.WebGLIndexedBufferRenderer=function(e,t,r){var i,n,o;this.setMode=function(e){i=e},this.setIndex=function(r){r.array instanceof Uint32Array&&t.get("OES_element_index_uint")?(n=e.UNSIGNED_INT,o=4):(n=e.UNSIGNED_SHORT,o=2)},this.render=function(t,a){e.drawElements(i,a,n,t*o),r.calls++,r.vertices+=a,i===e.TRIANGLES&&(r.faces+=a/3)},this.renderInstances=function(a,s,c){var h=t.get("ANGLE_instanced_arrays");null===h?console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(h.drawElementsInstancedANGLE(i,c,n,s*o,a.maxInstancedCount),r.calls++,r.vertices+=c*a.maxInstancedCount,i===e.TRIANGLES&&(r.faces+=a.maxInstancedCount*c/3))}},THREE.WebGLExtensions=function(e){var t={};this.get=function(r){if(void 0!==t[r])return t[r];var i;switch(r){case"WEBGL_depth_texture":e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=e.getExtension("WEBGL_compressed_texture_etc1");break;default:i=e.getExtension(r)}return null===i&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),t[r]=i}},THREE.WebGLCapabilities=function(e,t,r){function i(t){if("highp"===t){if(0<e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision&&0<e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision)return"highp";t="mediump"}return"mediump"===t&&0<e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision&&0<e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision?"mediump":"lowp"}this.getMaxPrecision=i,this.precision=void 0!==r.precision?r.precision:"highp",this.logarithmicDepthBuffer=void 0!==r.logarithmicDepthBuffer?r.logarithmicDepthBuffer:!1,this.maxTextures=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),this.maxVertexTextures=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxCubemapSize=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),this.maxAttributes=e.getParameter(e.MAX_VERTEX_ATTRIBS),this.maxVertexUniforms=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),this.maxVaryings=e.getParameter(e.MAX_VARYING_VECTORS),this.maxFragmentUniforms=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),this.vertexTextures=0<this.maxVertexTextures,this.floatFragmentTextures=!!t.get("OES_texture_float"),this.floatVertexTextures=this.vertexTextures&&this.floatFragmentTextures,r=i(this.precision),r!==this.precision&&(console.warn("THREE.WebGLRenderer:",this.precision,"not supported, using",r,"instead."),this.precision=r),this.logarithmicDepthBuffer&&(this.logarithmicDepthBuffer=!!t.get("EXT_frag_depth"))},THREE.WebGLGeometries=function(e,t,r){function i(e){var a=e.target;e=o[a.id],null!==e.index&&n(e.index);var s,c=e.attributes;for(s in c)n(c[s]);a.removeEventListener("dispose",i),delete o[a.id],s=t.get(a),s.wireframe&&n(s.wireframe),t["delete"](a),a=t.get(e),a.wireframe&&n(a.wireframe),t["delete"](e),r.memory.geometries--}function n(r){var i;i=r instanceof THREE.InterleavedBufferAttribute?t.get(r.data).__webglBuffer:t.get(r).__webglBuffer,void 0!==i&&(e.deleteBuffer(i),r instanceof THREE.InterleavedBufferAttribute?t["delete"](r.data):t["delete"](r))}var o={};this.get=function(e){var t=e.geometry;if(void 0!==o[t.id])return o[t.id];t.addEventListener("dispose",i);var n;return t instanceof THREE.BufferGeometry?n=t:t instanceof THREE.Geometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new THREE.BufferGeometry).setFromObject(e)),n=t._bufferGeometry),o[t.id]=n,r.memory.geometries++,n}},THREE.WebGLLights=function(){var e={};this.get=function(t){if(void 0!==e[t.id])return e[t.id];var r;switch(t.type){case"DirectionalLight":r={direction:new THREE.Vector3,color:new THREE.Color,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new THREE.Vector2};break;case"SpotLight":r={position:new THREE.Vector3,direction:new THREE.Vector3,color:new THREE.Color,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new THREE.Vector2};break;case"PointLight":r={position:new THREE.Vector3,color:new THREE.Color,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new THREE.Vector2};break;case"HemisphereLight":r={direction:new THREE.Vector3,skyColor:new THREE.Color,groundColor:new THREE.Color}}return e[t.id]=r}},THREE.WebGLObjects=function(e,t,r){function i(r,i){var n=r instanceof THREE.InterleavedBufferAttribute?r.data:r,o=t.get(n);void 0===o.__webglBuffer?(o.__webglBuffer=e.createBuffer(),e.bindBuffer(i,o.__webglBuffer),e.bufferData(i,n.array,n.dynamic?e.DYNAMIC_DRAW:e.STATIC_DRAW),o.version=n.version):o.version!==n.version&&(e.bindBuffer(i,o.__webglBuffer),!1===n.dynamic||-1===n.updateRange.count?e.bufferSubData(i,0,n.array):0===n.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(e.bufferSubData(i,n.updateRange.offset*n.array.BYTES_PER_ELEMENT,n.array.subarray(n.updateRange.offset,n.updateRange.offset+n.updateRange.count)),n.updateRange.count=0),o.version=n.version)}function n(e,t,r){if(t>r){var i=t;t=r,r=i}return i=e[t],void 0===i?(e[t]=[r],!0):-1===i.indexOf(r)?(i.push(r),!0):!1}var o=new THREE.WebGLGeometries(e,t,r);this.getAttributeBuffer=function(e){return e instanceof THREE.InterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer},this.getWireframeAttribute=function(r){var o=t.get(r);if(void 0!==o.wireframe)return o.wireframe;var a=[],s=r.index,c=r.attributes;if(r=c.position,null!==s)for(var c={},s=s.array,h=0,l=s.length;l>h;h+=3){var u=s[h+0],p=s[h+1],d=s[h+2];n(c,u,p)&&a.push(u,p),n(c,p,d)&&a.push(p,d),n(c,d,u)&&a.push(d,u)}else for(s=c.position.array,h=0,l=s.length/3-1;l>h;h+=3)u=h+0,p=h+1,d=h+2,a.push(u,p,p,d,d,u);return a=new THREE.BufferAttribute(new(65535<r.count?Uint32Array:Uint16Array)(a),1),i(a,e.ELEMENT_ARRAY_BUFFER),o.wireframe=a},this.update=function(t){var r=o.get(t);t.geometry instanceof THREE.Geometry&&r.updateFromObject(t),t=r.index;var n=r.attributes;null!==t&&i(t,e.ELEMENT_ARRAY_BUFFER);for(var a in n)i(n[a],e.ARRAY_BUFFER);t=r.morphAttributes;for(a in t)for(var n=t[a],s=0,c=n.length;c>s;s++)i(n[s],e.ARRAY_BUFFER);return r}},THREE.WebGLProgram=function(){function e(e){switch(e){case THREE.LinearEncoding:return["Linear","( value )"];case THREE.sRGBEncoding:return["sRGB","( value )"];case THREE.RGBEEncoding:return["RGBE","( value )"];case THREE.RGBM7Encoding:return["RGBM","( value, 7.0 )"];case THREE.RGBM16Encoding:return["RGBM","( value, 16.0 )"];case THREE.RGBDEncoding:return["RGBD","( value, 256.0 )"];case THREE.GammaEncoding:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw Error("unsupported encoding: "+e)}}function t(t,r){var i=e(r);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function r(t,r){var i=e(r);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function i(e,t){var r;switch(t){case THREE.LinearToneMapping:r="Linear";break;case THREE.ReinhardToneMapping:r="Reinhard";break;case THREE.Uncharted2ToneMapping:r="Uncharted2";break;case THREE.CineonToneMapping:r="OptimizedCineon";break;default:throw Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+r+"ToneMapping( color ); }"}function n(e,t,r){return e=e||{},[e.derivatives||t.envMapCubeUV||t.bumpMap||t.normalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&r.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&r.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&r.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(a).join("\n")}function o(e){var t,r=[];for(t in e){var i=e[t];!1!==i&&r.push("#define "+t+" "+i)}return r.join("\n")}function a(e){return""!==e}function s(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights)}function c(e){return e.replace(/#include +<([\w\d.]+)>/g,function(e,t){var r=THREE.ShaderChunk[t];if(void 0===r)throw Error("Can not resolve #include <"+t+">");return c(r)})}function h(e){return e.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(e,t,r,i){for(e="",t=parseInt(t);t<parseInt(r);t++)e+=i.replace(/\[ i \]/g,"[ "+t+" ]");return e})}var l=0;return function(e,u,p,d){var E=e.context,f=p.extensions,m=p.defines,g=p.__webglShader.vertexShader,T=p.__webglShader.fragmentShader,v="SHADOWMAP_TYPE_BASIC";d.shadowMapType===THREE.PCFShadowMap?v="SHADOWMAP_TYPE_PCF":d.shadowMapType===THREE.PCFSoftShadowMap&&(v="SHADOWMAP_TYPE_PCF_SOFT");var y="ENVMAP_TYPE_CUBE",R="ENVMAP_MODE_REFLECTION",H="ENVMAP_BLENDING_MULTIPLY";if(d.envMap){switch(p.envMap.mapping){case THREE.CubeReflectionMapping:case THREE.CubeRefractionMapping:y="ENVMAP_TYPE_CUBE";break;case THREE.CubeUVReflectionMapping:case THREE.CubeUVRefractionMapping:y="ENVMAP_TYPE_CUBE_UV";break;case THREE.EquirectangularReflectionMapping:case THREE.EquirectangularRefractionMapping:y="ENVMAP_TYPE_EQUIREC";break;case THREE.SphericalReflectionMapping:y="ENVMAP_TYPE_SPHERE"}switch(p.envMap.mapping){case THREE.CubeRefractionMapping:case THREE.EquirectangularRefractionMapping:R="ENVMAP_MODE_REFRACTION"}switch(p.combine){case THREE.MultiplyOperation:H="ENVMAP_BLENDING_MULTIPLY";break;case THREE.MixOperation:H="ENVMAP_BLENDING_MIX";break;case THREE.AddOperation:H="ENVMAP_BLENDING_ADD"}}var x=0<e.gammaFactor?e.gammaFactor:1,f=n(f,d,e.extensions),b=o(m),_=E.createProgram();p instanceof THREE.RawShaderMaterial?v=m="":(m=["precision "+d.precision+" float;","precision "+d.precision+" int;","#define SHADER_NAME "+p.__webglShader.name,b,d.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+x,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.envMap?"#define "+R:"",d.lightMap?"#define USE_LIGHTMAP":"",d.aoMap?"#define USE_AOMAP":"",d.emissiveMap?"#define USE_EMISSIVEMAP":"",d.bumpMap?"#define USE_BUMPMAP":"",d.normalMap?"#define USE_NORMALMAP":"",d.displacementMap&&d.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",d.specularMap?"#define USE_SPECULARMAP":"",d.roughnessMap?"#define USE_ROUGHNESSMAP":"",d.metalnessMap?"#define USE_METALNESSMAP":"",d.alphaMap?"#define USE_ALPHAMAP":"",d.vertexColors?"#define USE_COLOR":"",d.flatShading?"#define FLAT_SHADED":"",d.skinning?"#define USE_SKINNING":"",d.useVertexTexture?"#define BONE_TEXTURE":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.morphNormals&&!1===d.flatShading?"#define USE_MORPHNORMALS":"",d.doubleSided?"#define DOUBLE_SIDED":"",d.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+d.numClippingPlanes,d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapEnabled?"#define "+v:"",d.sizeAttenuation?"#define USE_SIZEATTENUATION":"",d.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",d.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(a).join("\n"),v=[f,"precision "+d.precision+" float;","precision "+d.precision+" int;","#define SHADER_NAME "+p.__webglShader.name,b,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"","#define GAMMA_FACTOR "+x,d.useFog&&d.fog?"#define USE_FOG":"",d.useFog&&d.fogExp?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.envMap?"#define "+y:"",d.envMap?"#define "+R:"",d.envMap?"#define "+H:"",d.lightMap?"#define USE_LIGHTMAP":"",d.aoMap?"#define USE_AOMAP":"",d.emissiveMap?"#define USE_EMISSIVEMAP":"",d.bumpMap?"#define USE_BUMPMAP":"",d.normalMap?"#define USE_NORMALMAP":"",d.specularMap?"#define USE_SPECULARMAP":"",d.roughnessMap?"#define USE_ROUGHNESSMAP":"",d.metalnessMap?"#define USE_METALNESSMAP":"",d.alphaMap?"#define USE_ALPHAMAP":"",d.vertexColors?"#define USE_COLOR":"",d.flatShading?"#define FLAT_SHADED":"",d.doubleSided?"#define DOUBLE_SIDED":"",d.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+d.numClippingPlanes,d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapEnabled?"#define "+v:"",d.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",d.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",d.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",d.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",d.envMap&&e.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",d.toneMapping!==THREE.NoToneMapping?"#define TONE_MAPPING":"",d.toneMapping!==THREE.NoToneMapping?THREE.ShaderChunk.tonemapping_pars_fragment:"",d.toneMapping!==THREE.NoToneMapping?i("toneMapping",d.toneMapping):"",d.outputEncoding||d.mapEncoding||d.envMapEncoding||d.emissiveMapEncoding?THREE.ShaderChunk.encodings_pars_fragment:"",d.mapEncoding?t("mapTexelToLinear",d.mapEncoding):"",d.envMapEncoding?t("envMapTexelToLinear",d.envMapEncoding):"",d.emissiveMapEncoding?t("emissiveMapTexelToLinear",d.emissiveMapEncoding):"",d.outputEncoding?r("linearToOutputTexel",d.outputEncoding):"",d.depthPacking?"#define DEPTH_PACKING "+p.depthPacking:"","\n"].filter(a).join("\n")),g=c(g,d),g=s(g,d),T=c(T,d),T=s(T,d),!1==p instanceof THREE.ShaderMaterial&&(g=h(g),T=h(T)),T=v+T,g=THREE.WebGLShader(E,E.VERTEX_SHADER,m+g),T=THREE.WebGLShader(E,E.FRAGMENT_SHADER,T),E.attachShader(_,g),E.attachShader(_,T),void 0!==p.index0AttributeName?E.bindAttribLocation(_,0,p.index0AttributeName):!0===d.morphTargets&&E.bindAttribLocation(_,0,"position"),E.linkProgram(_),d=E.getProgramInfoLog(_),y=E.getShaderInfoLog(g),R=E.getShaderInfoLog(T),x=H=!0,!1===E.getProgramParameter(_,E.LINK_STATUS)?(H=!1,console.error("THREE.WebGLProgram: shader error: ",E.getError(),"gl.VALIDATE_STATUS",E.getProgramParameter(_,E.VALIDATE_STATUS),"gl.getProgramInfoLog",d,y,R)):""!==d?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",d):(""===y||""===R)&&(x=!1),x&&(this.diagnostics={runnable:H,material:p,programLog:d,vertexShader:{log:y,prefix:m},fragmentShader:{log:R,prefix:v}}),E.deleteShader(g),E.deleteShader(T);var M;this.getUniforms=function(){return void 0===M&&(M=new THREE.WebGLUniforms(E,_,e)),M};var w;return this.getAttributes=function(){if(void 0===w){for(var e={},t=E.getProgramParameter(_,E.ACTIVE_ATTRIBUTES),r=0;t>r;r++){var i=E.getActiveAttrib(_,r).name;e[i]=E.getAttribLocation(_,i)}w=e}return w},this.destroy=function(){E.deleteProgram(_),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=l++,this.code=u,this.usedTimes=1,this.program=_,this.vertexShader=g,this.fragmentShader=T,this}}(),THREE.WebGLPrograms=function(e,t){function r(e,t){var r;return e?e instanceof THREE.Texture?r=e.encoding:e instanceof THREE.WebGLRenderTarget&&(r=e.texture.encoding):r=THREE.LinearEncoding,r===THREE.LinearEncoding&&t&&(r=THREE.GammaEncoding),r}var i=[],n={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},o="precision supportsVertexTextures map mapEncoding envMap envMapMode envMapEncoding lightMap aoMap emissiveMap emissiveMapEncoding bumpMap normalMap displacementMap specularMap roughnessMap metalnessMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals premultipliedAlpha numDirLights numPointLights numSpotLights numHemiLights shadowMapEnabled shadowMapType toneMapping physicallyCorrectLights alphaTest doubleSided flipSided numClippingPlanes depthPacking".split(" ");this.getParameters=function(i,o,a,s,c){var h,l=n[i.type];t.floatVertexTextures&&c&&c.skeleton&&c.skeleton.useVertexTexture?h=1024:(h=Math.floor((t.maxVertexUniforms-20)/4),void 0!==c&&c instanceof THREE.SkinnedMesh&&(h=Math.min(c.skeleton.bones.length,h),h<c.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+c.skeleton.bones.length+", this GPU supports just "+h+" (try OpenGL instead of ANGLE)")));var u=e.getPrecision();return null!==i.precision&&(u=t.getMaxPrecision(i.precision),u!==i.precision&&console.warn("THREE.WebGLProgram.getParameters:",i.precision,"not supported, using",u,"instead.")),{shaderID:l,precision:u,supportsVertexTextures:t.vertexTextures,outputEncoding:r(e.getCurrentRenderTarget(),e.gammaOutput),map:!!i.map,mapEncoding:r(i.map,e.gammaInput),envMap:!!i.envMap,envMapMode:i.envMap&&i.envMap.mapping,envMapEncoding:r(i.envMap,e.gammaInput),envMapCubeUV:!!i.envMap&&(i.envMap.mapping===THREE.CubeUVReflectionMapping||i.envMap.mapping===THREE.CubeUVRefractionMapping),lightMap:!!i.lightMap,aoMap:!!i.aoMap,emissiveMap:!!i.emissiveMap,emissiveMapEncoding:r(i.emissiveMap,e.gammaInput),bumpMap:!!i.bumpMap,normalMap:!!i.normalMap,displacementMap:!!i.displacementMap,roughnessMap:!!i.roughnessMap,metalnessMap:!!i.metalnessMap,specularMap:!!i.specularMap,alphaMap:!!i.alphaMap,combine:i.combine,vertexColors:i.vertexColors,fog:a,useFog:i.fog,fogExp:a instanceof THREE.FogExp2,flatShading:i.shading===THREE.FlatShading,sizeAttenuation:i.sizeAttenuation,logarithmicDepthBuffer:t.logarithmicDepthBuffer,skinning:i.skinning,maxBones:h,useVertexTexture:t.floatVertexTextures&&c&&c.skeleton&&c.skeleton.useVertexTexture,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numHemiLights:o.hemi.length,numClippingPlanes:s,shadowMapEnabled:e.shadowMap.enabled&&c.receiveShadow&&0<o.shadows.length,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===THREE.DoubleSide,flipSided:i.side===THREE.BackSide,depthPacking:void 0!==i.depthPacking?i.depthPacking:!1}},this.getProgramCode=function(e,t){var r=[];if(t.shaderID?r.push(t.shaderID):(r.push(e.fragmentShader),r.push(e.vertexShader)),void 0!==e.defines)for(var i in e.defines)r.push(i),r.push(e.defines[i]);for(i=0;i<o.length;i++)r.push(t[o[i]]);return r.join()},this.acquireProgram=function(t,r,n){for(var o,a=0,s=i.length;s>a;a++){var c=i[a];if(c.code===n){o=c,++o.usedTimes;break}}return void 0===o&&(o=new THREE.WebGLProgram(e,n,t,r),i.push(o)),o},this.releaseProgram=function(e){if(0===--e.usedTimes){var t=i.indexOf(e);i[t]=i[i.length-1],i.pop(),e.destroy()}},this.programs=i},THREE.WebGLProperties=function(){var e={};this.get=function(t){t=t.uuid;var r=e[t];return void 0===r&&(r={},e[t]=r),r},this["delete"]=function(t){delete e[t.uuid]},this.clear=function(){e={}}},THREE.WebGLShader=function(){function e(e){e=e.split("\n");for(var t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}return function(t,r,i){var n=t.createShader(r);return t.shaderSource(n,i),t.compileShader(n),!1===t.getShaderParameter(n,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."), ""!==t.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",r===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(n),e(i)),n}}(),THREE.WebGLShadowMap=function(e,t,r){function i(t,r,i,n){var o=t.geometry,a=null,a=E,s=t.customDepthMaterial;return i&&(a=f,s=t.customDistanceMaterial),s?a=s:(t=t instanceof THREE.SkinnedMesh&&r.skinning,s=0,void 0!==o.morphTargets&&0<o.morphTargets.length&&r.morphTargets&&(s|=1),t&&(s|=2),a=a[s]),e.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length&&(s=a.uuid,o=r.uuid,t=m[s],void 0===t&&(t={},m[s]=t),s=t[o],void 0===s&&(s=a.clone(),t[o]=s),a=s),a.visible=r.visible,a.wireframe=r.wireframe,a.side=r.side,a.clipShadows=r.clipShadows,a.clippingPlanes=r.clippingPlanes,a.wireframeLinewidth=r.wireframeLinewidth,a.linewidth=r.linewidth,i&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(n),a}function n(e,t,r){if(!1!==e.visible){e.layers.test(t.layers)&&(e instanceof THREE.Mesh||e instanceof THREE.Line||e instanceof THREE.Points)&&e.castShadow&&(!1===e.frustumCulled||!0===s.intersectsObject(e))&&!0===e.material.visible&&(e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),d.push(e)),e=e.children;for(var i=0,o=e.length;o>i;i++)n(e[i],t,r)}}var o=e.context,a=e.state,s=new THREE.Frustum,c=new THREE.Matrix4,h=t.shadows,l=new THREE.Vector2,u=new THREE.Vector3,p=new THREE.Vector3,d=[],E=Array(4),f=Array(4),m={},g=[new THREE.Vector3(1,0,0),new THREE.Vector3(-1,0,0),new THREE.Vector3(0,0,1),new THREE.Vector3(0,0,-1),new THREE.Vector3(0,1,0),new THREE.Vector3(0,-1,0)],T=[new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,0,1),new THREE.Vector3(0,0,-1)],v=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4];t=new THREE.MeshDepthMaterial,t.depthPacking=THREE.RGBADepthPacking,t.clipping=!0;for(var y=THREE.ShaderLib.distanceRGBA,R=THREE.UniformsUtils.clone(y.uniforms),H=0;4!==H;++H){var x=0!==(1&H),b=0!==(2&H),_=t.clone();_.morphTargets=x,_.skinning=b,E[H]=_,x=new THREE.ShaderMaterial({defines:{USE_SHADOWMAP:""},uniforms:R,vertexShader:y.vertexShader,fragmentShader:y.fragmentShader,morphTargets:x,skinning:b,clipping:!0}),f[H]=x}var M=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=THREE.PCFShadowMap,this.cullFace=THREE.CullFaceFront,this.render=function(t,E){if(!1!==M.enabled&&(!1!==M.autoUpdate||!1!==M.needsUpdate)&&0!==h.length){a.clearColor(1,1,1,1),a.disable(o.BLEND),a.enable(o.CULL_FACE),o.frontFace(o.CCW),o.cullFace(M.cullFace===THREE.CullFaceFront?o.FRONT:o.BACK),a.setDepthTest(!0),a.setScissorTest(!1);for(var f,m,y=0,R=h.length;R>y;y++){var H=h[y],x=H.shadow,b=x.camera;if(l.copy(x.mapSize),H instanceof THREE.PointLight){f=6,m=!0;var _=l.x,w=l.y;v[0].set(2*_,w,_,w),v[1].set(0,w,_,w),v[2].set(3*_,w,_,w),v[3].set(_,w,_,w),v[4].set(3*_,0,_,w),v[5].set(_,0,_,w),l.x*=4,l.y*=2}else f=1,m=!1;for(null===x.map&&(x.map=new THREE.WebGLRenderTarget(l.x,l.y,{minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat}),b.updateProjectionMatrix()),x instanceof THREE.SpotLightShadow&&x.update(H),_=x.map,x=x.matrix,p.setFromMatrixPosition(H.matrixWorld),b.position.copy(p),e.setRenderTarget(_),e.clear(),_=0;f>_;_++){m?(u.copy(b.position),u.add(g[_]),b.up.copy(T[_]),b.lookAt(u),a.viewport(v[_])):(u.setFromMatrixPosition(H.target.matrixWorld),b.lookAt(u)),b.updateMatrixWorld(),b.matrixWorldInverse.getInverse(b.matrixWorld),x.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),x.multiply(b.projectionMatrix),x.multiply(b.matrixWorldInverse),c.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse),s.setFromMatrix(c),d.length=0,n(t,E,b);for(var w=0,S=d.length;S>w;w++){var L=d[w],A=r.update(L),C=L.material;if(C instanceof THREE.MultiMaterial)for(var P=A.groups,C=C.materials,B=0,D=P.length;D>B;B++){var I=P[B],U=C[I.materialIndex];!0===U.visible&&(U=i(L,U,m,p),e.renderBufferDirect(b,null,A,U,L,I))}else U=i(L,C,m,p),e.renderBufferDirect(b,null,A,U,L,null)}}}f=e.getClearColor(),m=e.getClearAlpha(),e.setClearColor(f,m),a.enable(o.BLEND),M.cullFace===THREE.CullFaceFront&&o.cullFace(o.BACK),M.needsUpdate=!1}}},THREE.WebGLState=function(e,t,r){var i=this,n=new THREE.Vector4,o=e.getParameter(e.MAX_VERTEX_ATTRIBS),a=new Uint8Array(o),s=new Uint8Array(o),c=new Uint8Array(o),h={},l=null,u=null,p=null,d=null,E=null,f=null,m=null,g=null,T=!1,v=null,y=null,R=null,H=null,x=null,b=null,_=null,M=null,w=null,S=null,L=null,A=null,C=null,P=null,B=null,D=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),I=void 0,U={},F=new THREE.Vector4,N=null,O=null,V=new THREE.Vector4,G=new THREE.Vector4;this.init=function(){this.clearColor(0,0,0,1),this.clearDepth(1),this.clearStencil(0),this.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.frontFace(e.CCW),e.cullFace(e.BACK),this.enable(e.CULL_FACE),this.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA)},this.initAttributes=function(){for(var e=0,t=a.length;t>e;e++)a[e]=0},this.enableAttribute=function(r){a[r]=1,0===s[r]&&(e.enableVertexAttribArray(r),s[r]=1),0!==c[r]&&(t.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(r,0),c[r]=0)},this.enableAttributeAndDivisor=function(t,r,i){a[t]=1,0===s[t]&&(e.enableVertexAttribArray(t),s[t]=1),c[t]!==r&&(i.vertexAttribDivisorANGLE(t,r),c[t]=r)},this.disableUnusedAttributes=function(){for(var t=0,r=s.length;r>t;t++)s[t]!==a[t]&&(e.disableVertexAttribArray(t),s[t]=0)},this.enable=function(t){!0!==h[t]&&(e.enable(t),h[t]=!0)},this.disable=function(t){!1!==h[t]&&(e.disable(t),h[t]=!1)},this.getCompressedTextureFormats=function(){if(null===l&&(l=[],t.get("WEBGL_compressed_texture_pvrtc")||t.get("WEBGL_compressed_texture_s3tc")||t.get("WEBGL_compressed_texture_etc1")))for(var r=e.getParameter(e.COMPRESSED_TEXTURE_FORMATS),i=0;i<r.length;i++)l.push(r[i]);return l},this.setBlending=function(t,i,n,o,a,s,c,h){t===THREE.NoBlending?this.disable(e.BLEND):this.enable(e.BLEND),(t!==u||h!==T)&&(t===THREE.AdditiveBlending?h?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE)):t===THREE.SubtractiveBlending?h?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ZERO,e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ONE_MINUS_SRC_ALPHA)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR)):t===THREE.MultiplyBlending?h?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ZERO,e.ZERO,e.SRC_COLOR,e.SRC_ALPHA)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.SRC_COLOR)):h?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)):(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)),u=t,T=h),t===THREE.CustomBlending?(a=a||i,s=s||n,c=c||o,(i!==p||a!==f)&&(e.blendEquationSeparate(r(i),r(a)),p=i,f=a),(n!==d||o!==E||s!==m||c!==g)&&(e.blendFuncSeparate(r(n),r(o),r(s),r(c)),d=n,E=o,m=s,g=c)):g=m=f=E=d=p=null},this.setDepthFunc=function(t){if(v!==t){if(t)switch(t){case THREE.NeverDepth:e.depthFunc(e.NEVER);break;case THREE.AlwaysDepth:e.depthFunc(e.ALWAYS);break;case THREE.LessDepth:e.depthFunc(e.LESS);break;case THREE.LessEqualDepth:e.depthFunc(e.LEQUAL);break;case THREE.EqualDepth:e.depthFunc(e.EQUAL);break;case THREE.GreaterEqualDepth:e.depthFunc(e.GEQUAL);break;case THREE.GreaterDepth:e.depthFunc(e.GREATER);break;case THREE.NotEqualDepth:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}else e.depthFunc(e.LEQUAL);v=t}},this.setDepthTest=function(t){t?this.enable(e.DEPTH_TEST):this.disable(e.DEPTH_TEST)},this.setDepthWrite=function(t){y!==t&&(e.depthMask(t),y=t)},this.setColorWrite=function(t){R!==t&&(e.colorMask(t,t,t,t),R=t)},this.setStencilFunc=function(t,r,i){(x!==t||b!==r||_!==i)&&(e.stencilFunc(t,r,i),x=t,b=r,_=i)},this.setStencilOp=function(t,r,i){(M!==t||w!==r||S!==i)&&(e.stencilOp(t,r,i),M=t,w=r,S=i)},this.setStencilTest=function(t){t?this.enable(e.STENCIL_TEST):this.disable(e.STENCIL_TEST)},this.setStencilWrite=function(t){H!==t&&(e.stencilMask(t),H=t)},this.setFlipSided=function(t){L!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),L=t)},this.setLineWidth=function(t){t!==A&&(e.lineWidth(t),A=t)},this.setPolygonOffset=function(t,r,i){t?this.enable(e.POLYGON_OFFSET_FILL):this.disable(e.POLYGON_OFFSET_FILL),!t||C===r&&P===i||(e.polygonOffset(r,i),C=r,P=i)},this.getScissorTest=function(){return B},this.setScissorTest=function(t){(B=t)?this.enable(e.SCISSOR_TEST):this.disable(e.SCISSOR_TEST)},this.activeTexture=function(t){void 0===t&&(t=e.TEXTURE0+D-1),I!==t&&(e.activeTexture(t),I=t)},this.bindTexture=function(t,r){void 0===I&&i.activeTexture();var n=U[I];void 0===n&&(n={type:void 0,texture:void 0},U[I]=n),(n.type!==t||n.texture!==r)&&(e.bindTexture(t,r),n.type=t,n.texture=r)},this.compressedTexImage2D=function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(t){console.error(t)}},this.texImage2D=function(){try{e.texImage2D.apply(e,arguments)}catch(t){console.error(t)}},this.clearColor=function(t,r,i,o){n.set(t,r,i,o),!1===F.equals(n)&&(e.clearColor(t,r,i,o),F.copy(n))},this.clearDepth=function(t){N!==t&&(e.clearDepth(t),N=t)},this.clearStencil=function(t){O!==t&&(e.clearStencil(t),O=t)},this.scissor=function(t){!1===V.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),V.copy(t))},this.viewport=function(t){!1===G.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),G.copy(t))},this.reset=function(){for(var t=0;t<s.length;t++)1===s[t]&&(e.disableVertexAttribArray(t),s[t]=0);h={},l=null,I=void 0,U={},L=H=y=R=u=null}},THREE.WebGLUniforms=function(){var e=[],t=[],r=function(t,r,i){var n=t[0];if(0>=n||n>0)return t;var o=r*i,a=e[o];if(void 0===a&&(a=new Float32Array(o),e[o]=a),0!==r)for(n.toArray(a,0),n=1,o=0;n!==r;++n)o+=i,t[n].toArray(a,o);return a},i=function(e,r){var i=t[r];void 0===i&&(i=new Int32Array(r),t[r]=i);for(var n=0;n!==r;++n)i[n]=e.allocTextureUnit();return i},n=function(e,t){e.uniform1f(this.addr,t)},o=function(e,t){e.uniform1i(this.addr,t)},a=function(e,t){void 0===t.x?e.uniform2fv(this.addr,t):e.uniform2f(this.addr,t.x,t.y)},s=function(e,t){void 0!==t.x?e.uniform3f(this.addr,t.x,t.y,t.z):void 0!==t.r?e.uniform3f(this.addr,t.r,t.g,t.b):e.uniform3fv(this.addr,t)},c=function(e,t){void 0===t.x?e.uniform4fv(this.addr,t):e.uniform4f(this.addr,t.x,t.y,t.z,t.w)},h=function(e,t){e.uniformMatrix2fv(this.addr,!1,t.elements||t)},l=function(e,t){e.uniformMatrix3fv(this.addr,!1,t.elements||t)},u=function(e,t){e.uniformMatrix4fv(this.addr,!1,t.elements||t)},p=function(e,t,r){var i=r.allocTextureUnit();e.uniform1i(this.addr,i),t&&r.setTexture2D(t,i)},d=function(e,t,r){var i=r.allocTextureUnit();e.uniform1i(this.addr,i),t&&r.setTextureCube(t,i)},E=function(e,t){e.uniform2iv(this.addr,t)},f=function(e,t){e.uniform3iv(this.addr,t)},m=function(e,t){e.uniform4iv(this.addr,t)},g=function(e){switch(e){case 5126:return n;case 35664:return a;case 35665:return s;case 35666:return c;case 35674:return h;case 35675:return l;case 35676:return u;case 35678:return p;case 35680:return d;case 5124:case 35670:return o;case 35667:case 35671:return E;case 35668:case 35672:return f;case 35669:case 35673:return m}},T=function(e,t){e.uniform1fv(this.addr,t)},v=function(e,t){e.uniform1iv(this.addr,t)},y=function(e,t){e.uniform2fv(this.addr,r(t,this.size,2))},R=function(e,t){e.uniform3fv(this.addr,r(t,this.size,3))},H=function(e,t){e.uniform4fv(this.addr,r(t,this.size,4))},x=function(e,t){e.uniformMatrix2fv(this.addr,!1,r(t,this.size,4))},b=function(e,t){e.uniformMatrix3fv(this.addr,!1,r(t,this.size,9))},_=function(e,t){e.uniformMatrix4fv(this.addr,!1,r(t,this.size,16))},M=function(e,t,r){var n=t.length,o=i(r,n);for(e.uniform1iv(this.addr,o),e=0;e!==n;++e){var a=t[e];a&&r.setTexture2D(a,o[e])}},w=function(e,t,r){var n=t.length,o=i(r,n);for(e.uniform1iv(this.addr,o),e=0;e!==n;++e){var a=t[e];a&&r.setTextureCube(a,o[e])}},S=function(e){switch(e){case 5126:return T;case 35664:return y;case 35665:return R;case 35666:return H;case 35674:return x;case 35675:return b;case 35676:return _;case 35678:return M;case 35680:return w;case 5124:case 35670:return v;case 35667:case 35671:return E;case 35668:case 35672:return f;case 35669:case 35673:return m}},L=function(e,t,r){this.id=e,this.addr=r,this.setValue=g(t.type)},A=function(e,t,r){this.id=e,this.addr=r,this.size=t.size,this.setValue=S(t.type)},C=function(e){this.id=e,this.seq=[],this.map={}};C.prototype.setValue=function(e,t){for(var r=this.seq,i=0,n=r.length;i!==n;++i){var o=r[i];o.setValue(e,t[o.id])}};var P=/([\w\d_]+)(\])?(\[|\.)?/g,B=function(e,t,r){this.seq=[],this.map={},this.renderer=r,r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(var i=0;i!==r;++i){var n=e.getActiveUniform(t,i),o=e.getUniformLocation(t,n.name),a=this,s=n.name,c=s.length;for(P.lastIndex=0;;){var h=P.exec(s),l=P.lastIndex,u=h[1],p=h[3];if("]"===h[2]&&(u|=0),void 0===p||"["===p&&l+2===c){s=a,n=void 0===p?new L(u,n,o):new A(u,n,o),s.seq.push(n),s.map[n.id]=n;break}p=a.map[u],void 0===p&&(p=new C(u),u=a,a=p,u.seq.push(a),u.map[a.id]=a),a=p}}};return B.prototype.setValue=function(e,t,r){t=this.map[t],void 0!==t&&t.setValue(e,r,this.renderer)},B.prototype.set=function(e,t,r){var i=this.map[r];void 0!==i&&i.setValue(e,t[r],this.renderer)},B.prototype.setOptional=function(e,t,r){t=t[r],void 0!==t&&this.setValue(e,r,t)},B.upload=function(e,t,r,i){for(var n=0,o=t.length;n!==o;++n){var a=t[n],s=r[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,i)}},B.seqWithValue=function(e,t){for(var r=[],i=0,n=e.length;i!==n;++i){var o=e[i];o.id in t&&r.push(o)}return r},B.splitDynamic=function(e,t){for(var r=null,i=e.length,n=0,o=0;o!==i;++o){var a=e[o],s=t[a.id];s&&!0===s.dynamic?(null===r&&(r=[]),r.push(a)):(o>n&&(e[n]=a),++n)}return i>n&&(e.length=n),r},B.evalDynamic=function(e,t,r,i){for(var n=0,o=e.length;n!==o;++n){var a=t[e[n].id],s=a.onUpdateCallback;void 0!==s&&s.call(a,r,i)}},B}(),THREE.LensFlarePlugin=function(e,t){var r,i,n,o,a,s,c,h,l,u,p,d,E,f,m,g,T=e.context,v=e.state;this.render=function(y,R,H){if(0!==t.length){y=new THREE.Vector3;var x=H.w/H.z,b=.5*H.z,_=.5*H.w,M=16/H.w,w=new THREE.Vector2(M*x,M),S=new THREE.Vector3(1,1,0),L=new THREE.Vector2(1,1),A=new THREE.Box2;if(A.min.set(0,0),A.max.set(H.z-16,H.w-16),void 0===f){var M=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),C=new Uint16Array([0,1,2,0,2,3]);p=T.createBuffer(),d=T.createBuffer(),T.bindBuffer(T.ARRAY_BUFFER,p),T.bufferData(T.ARRAY_BUFFER,M,T.STATIC_DRAW),T.bindBuffer(T.ELEMENT_ARRAY_BUFFER,d),T.bufferData(T.ELEMENT_ARRAY_BUFFER,C,T.STATIC_DRAW),m=T.createTexture(),g=T.createTexture(),v.bindTexture(T.TEXTURE_2D,m),T.texImage2D(T.TEXTURE_2D,0,T.RGB,16,16,0,T.RGB,T.UNSIGNED_BYTE,null),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_S,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_T,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MAG_FILTER,T.NEAREST),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MIN_FILTER,T.NEAREST),v.bindTexture(T.TEXTURE_2D,g),T.texImage2D(T.TEXTURE_2D,0,T.RGBA,16,16,0,T.RGBA,T.UNSIGNED_BYTE,null),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_S,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_T,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MAG_FILTER,T.NEAREST),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MIN_FILTER,T.NEAREST);var M=E={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}"},C=T.createProgram(),P=T.createShader(T.FRAGMENT_SHADER),B=T.createShader(T.VERTEX_SHADER),D="precision "+e.getPrecision()+" float;\n";T.shaderSource(P,D+M.fragmentShader),T.shaderSource(B,D+M.vertexShader),T.compileShader(P),T.compileShader(B),T.attachShader(C,P),T.attachShader(C,B),T.linkProgram(C),f=C,l=T.getAttribLocation(f,"position"),u=T.getAttribLocation(f,"uv"),r=T.getUniformLocation(f,"renderType"),i=T.getUniformLocation(f,"map"),n=T.getUniformLocation(f,"occlusionMap"),o=T.getUniformLocation(f,"opacity"),a=T.getUniformLocation(f,"color"),s=T.getUniformLocation(f,"scale"),c=T.getUniformLocation(f,"rotation"),h=T.getUniformLocation(f,"screenPosition")}for(T.useProgram(f),v.initAttributes(),v.enableAttribute(l),v.enableAttribute(u),v.disableUnusedAttributes(),T.uniform1i(n,0),T.uniform1i(i,1),T.bindBuffer(T.ARRAY_BUFFER,p),T.vertexAttribPointer(l,2,T.FLOAT,!1,16,0),T.vertexAttribPointer(u,2,T.FLOAT,!1,16,8),T.bindBuffer(T.ELEMENT_ARRAY_BUFFER,d),v.disable(T.CULL_FACE),v.setDepthWrite(!1),C=0,P=t.length;P>C;C++)if(M=16/H.w,w.set(M*x,M),B=t[C],y.set(B.matrixWorld.elements[12],B.matrixWorld.elements[13],B.matrixWorld.elements[14]),y.applyMatrix4(R.matrixWorldInverse),y.applyProjection(R.projectionMatrix),S.copy(y),L.x=H.x+S.x*b+b-8,L.y=H.y+S.y*_+_-8,!0===A.containsPoint(L)){v.activeTexture(T.TEXTURE0),v.bindTexture(T.TEXTURE_2D,null),v.activeTexture(T.TEXTURE1),v.bindTexture(T.TEXTURE_2D,m),T.copyTexImage2D(T.TEXTURE_2D,0,T.RGB,L.x,L.y,16,16,0),T.uniform1i(r,0),T.uniform2f(s,w.x,w.y),T.uniform3f(h,S.x,S.y,S.z),v.disable(T.BLEND),v.enable(T.DEPTH_TEST),T.drawElements(T.TRIANGLES,6,T.UNSIGNED_SHORT,0),v.activeTexture(T.TEXTURE0),v.bindTexture(T.TEXTURE_2D,g),T.copyTexImage2D(T.TEXTURE_2D,0,T.RGBA,L.x,L.y,16,16,0),T.uniform1i(r,1),v.disable(T.DEPTH_TEST),v.activeTexture(T.TEXTURE1),v.bindTexture(T.TEXTURE_2D,m),T.drawElements(T.TRIANGLES,6,T.UNSIGNED_SHORT,0),B.positionScreen.copy(S),B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares(),T.uniform1i(r,2),v.enable(T.BLEND);for(var D=0,I=B.lensFlares.length;I>D;D++){var U=B.lensFlares[D];.001<U.opacity&&.001<U.scale&&(S.x=U.x,S.y=U.y,S.z=U.z,M=U.size*U.scale/H.w,w.x=M*x,w.y=M,T.uniform3f(h,S.x,S.y,S.z),T.uniform2f(s,w.x,w.y),T.uniform1f(c,U.rotation),T.uniform1f(o,U.opacity),T.uniform3f(a,U.color.r,U.color.g,U.color.b),v.setBlending(U.blending,U.blendEquation,U.blendSrc,U.blendDst),e.setTexture2D(U.texture,1),T.drawElements(T.TRIANGLES,6,T.UNSIGNED_SHORT,0))}}v.enable(T.CULL_FACE),v.enable(T.DEPTH_TEST),v.setDepthWrite(!0),e.resetGLState()}}},THREE.SpritePlugin=function(e,t){function r(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}var i,n,o,a,s,c,h,l,u,p,d,E,f,m,g,T,v,y,R,H,x,b=e.context,_=e.state,M=new THREE.Vector3,w=new THREE.Quaternion,S=new THREE.Vector3;this.render=function(L,A){if(0!==t.length){if(void 0===H){var C=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),P=new Uint16Array([0,1,2,0,2,3]);y=b.createBuffer(),R=b.createBuffer(),b.bindBuffer(b.ARRAY_BUFFER,y),b.bufferData(b.ARRAY_BUFFER,C,b.STATIC_DRAW),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,R),b.bufferData(b.ELEMENT_ARRAY_BUFFER,P,b.STATIC_DRAW);var C=b.createProgram(),P=b.createShader(b.VERTEX_SHADER),B=b.createShader(b.FRAGMENT_SHADER);b.shaderSource(P,["precision "+e.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")),b.shaderSource(B,["precision "+e.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")),b.compileShader(P),b.compileShader(B),b.attachShader(C,P),b.attachShader(C,B),b.linkProgram(C),H=C,T=b.getAttribLocation(H,"position"),v=b.getAttribLocation(H,"uv"),i=b.getUniformLocation(H,"uvOffset"),n=b.getUniformLocation(H,"uvScale"),o=b.getUniformLocation(H,"rotation"),a=b.getUniformLocation(H,"scale"),s=b.getUniformLocation(H,"color"),c=b.getUniformLocation(H,"map"),h=b.getUniformLocation(H,"opacity"),l=b.getUniformLocation(H,"modelViewMatrix"),u=b.getUniformLocation(H,"projectionMatrix"),p=b.getUniformLocation(H,"fogType"),d=b.getUniformLocation(H,"fogDensity"),E=b.getUniformLocation(H,"fogNear"),f=b.getUniformLocation(H,"fogFar"),m=b.getUniformLocation(H,"fogColor"),g=b.getUniformLocation(H,"alphaTest"),C=document.createElement("canvas"),C.width=8,C.height=8,P=C.getContext("2d"),P.fillStyle="white",P.fillRect(0,0,8,8),x=new THREE.Texture(C),x.needsUpdate=!0}b.useProgram(H),_.initAttributes(),_.enableAttribute(T),_.enableAttribute(v),_.disableUnusedAttributes(),_.disable(b.CULL_FACE),_.enable(b.BLEND),b.bindBuffer(b.ARRAY_BUFFER,y),b.vertexAttribPointer(T,2,b.FLOAT,!1,16,0),b.vertexAttribPointer(v,2,b.FLOAT,!1,16,8),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,R),b.uniformMatrix4fv(u,!1,A.projectionMatrix.elements),_.activeTexture(b.TEXTURE0),b.uniform1i(c,0),P=C=0,(B=L.fog)?(b.uniform3f(m,B.color.r,B.color.g,B.color.b),B instanceof THREE.Fog?(b.uniform1f(E,B.near),b.uniform1f(f,B.far),b.uniform1i(p,1),P=C=1):B instanceof THREE.FogExp2&&(b.uniform1f(d,B.density),b.uniform1i(p,2),P=C=2)):(b.uniform1i(p,0),P=C=0);for(var B=0,D=t.length;D>B;B++){var I=t[B];I.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,I.matrixWorld),I.z=-I.modelViewMatrix.elements[14]}t.sort(r);for(var U=[],B=0,D=t.length;D>B;B++){var I=t[B],F=I.material;b.uniform1f(g,F.alphaTest),b.uniformMatrix4fv(l,!1,I.modelViewMatrix.elements),I.matrixWorld.decompose(M,w,S),U[0]=S.x,U[1]=S.y,I=0,L.fog&&F.fog&&(I=P),C!==I&&(b.uniform1i(p,I),C=I),null!==F.map?(b.uniform2f(i,F.map.offset.x,F.map.offset.y),b.uniform2f(n,F.map.repeat.x,F.map.repeat.y)):(b.uniform2f(i,0,0),b.uniform2f(n,1,1)),b.uniform1f(h,F.opacity),b.uniform3f(s,F.color.r,F.color.g,F.color.b),b.uniform1f(o,F.rotation),b.uniform2fv(a,U),_.setBlending(F.blending,F.blendEquation,F.blendSrc,F.blendDst),_.setDepthTest(F.depthTest),_.setDepthWrite(F.depthWrite),F.map?e.setTexture2D(F.map,0):e.setTexture2D(x,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}_.enable(b.CULL_FACE),e.resetGLState()}}},Object.defineProperties(THREE.Box2.prototype,{empty:{value:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}}}),Object.defineProperties(THREE.Box3.prototype,{empty:{value:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}},isIntersectionSphere:{value:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}}),Object.defineProperties(THREE.Matrix3.prototype,{multiplyVector3:{value:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)}},multiplyVector3Array:{value:function(e){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)}}}),Object.defineProperties(THREE.Matrix4.prototype,{extractPosition:{value:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)}},setRotationFromQuaternion:{value:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)}},multiplyVector3:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),e.applyProjection(this)}},multiplyVector4:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)}},multiplyVector3Array:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)}},rotateAxis:{value:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)}},crossVector:{value:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)}},translate:{value:function(e){console.error("THREE.Matrix4: .translate() has been removed.")}},rotateX:{value:function(e){console.error("THREE.Matrix4: .rotateX() has been removed.")}},rotateY:{value:function(e){console.error("THREE.Matrix4: .rotateY() has been removed.")}},rotateZ:{value:function(e){console.error("THREE.Matrix4: .rotateZ() has been removed.")}},rotateByAxis:{value:function(e,t){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}}}),Object.defineProperties(THREE.Plane.prototype,{isIntersectionLine:{value:function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)}}}),Object.defineProperties(THREE.Quaternion.prototype,{multiplyVector3:{value:function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)}}}),Object.defineProperties(THREE.Ray.prototype,{isIntersectionBox:{value:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}},isIntersectionPlane:{value:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)}},isIntersectionSphere:{value:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}}),Object.defineProperties(THREE.Vector3.prototype,{setEulerFromRotationMatrix:{value:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")}},setEulerFromQuaternion:{value:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")}},getPositionFromMatrix:{value:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)}},getScaleFromMatrix:{value:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)}},getColumnFromMatrix:{value:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)}}}),THREE.Face4=function(e,t,r,i,n,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new THREE.Face3(e,t,r,n,o,a)},THREE.Vertex=function(e,t,r){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new THREE.Vector3(e,t,r)},Object.defineProperties(THREE.Object3D.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},getChildByName:{value:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)}},renderDepth:{set:function(e){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")}},translate:{value:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(e){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(THREE,{PointCloud:{value:function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new THREE.Points(e,t)}},ParticleSystem:{value:function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new THREE.Points(e,t)}}}),Object.defineProperties(THREE.Light.prototype,{onlyShadow:{set:function(e){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."), this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(e){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(e){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(THREE.BufferAttribute.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length}}}),Object.defineProperties(THREE.BufferGeometry.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}},addIndex:{value:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)}},addDrawCall:{value:function(e,t,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)}},clearDrawCalls:{value:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()}},computeTangents:{value:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")}},computeOffsets:{value:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}}),Object.defineProperties(THREE.Material.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(e){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new THREE.Color}}}),Object.defineProperties(THREE,{PointCloudMaterial:{value:function(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new THREE.PointsMaterial(e)}},ParticleBasicMaterial:{value:function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new THREE.PointsMaterial(e)}},ParticleSystemMaterial:{value:function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new THREE.PointsMaterial(e)}}}),Object.defineProperties(THREE.MeshPhongMaterial.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(e){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(THREE.ShaderMaterial.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.defineProperties(THREE.WebGLRenderer.prototype,{supportsFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")}},supportsHalfFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")}},supportsStandardDerivatives:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")}},supportsCompressedTextureS3TC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")}},supportsCompressedTexturePVRTC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")}},supportsBlendMinMax:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")}},supportsVertexTextures:{value:function(){return this.capabilities.vertexTextures}},supportsInstancedArrays:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")}},enableScissorTest:{value:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)}},initMaterial:{value:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")}},addPrePlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")}},addPostPlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")}},updateShadowMap:{value:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}},shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=e}}}),Object.defineProperties(THREE.WebGLRenderTarget.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(THREE.Audio.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Please use THREE.AudioLoader.");var t=this;return(new THREE.AudioLoader).load(e,function(e){t.setBuffer(e)}),this}}}),THREE.GeometryUtils={merge:function(e,t,r){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var i;t instanceof THREE.Mesh&&(t.matrixAutoUpdate&&t.updateMatrix(),i=t.matrix,t=t.geometry),e.merge(t,i,r)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},THREE.ImageUtils={crossOrigin:void 0,loadTexture:function(e,t,r,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var n=new THREE.TextureLoader;return n.setCrossOrigin(this.crossOrigin),e=n.load(e,r,void 0,i),t&&(e.mapping=t),e},loadTextureCube:function(e,t,r,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var n=new THREE.CubeTextureLoader;return n.setCrossOrigin(this.crossOrigin),e=n.load(e,r,void 0,i),t&&(e.mapping=t),e},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}},THREE.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){console.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(e,t){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},THREE.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},THREE.MeshFaceMaterial=THREE.MultiMaterial,Object.defineProperties(THREE.LOD.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),THREE.CurveUtils={tangentQuadraticBezier:function(e,t,r,i){return 2*(1-e)*(r-t)+2*e*(i-r)},tangentCubicBezier:function(e,t,r,i,n){return-3*t*(1-e)*(1-e)+3*r*(1-e)*(1-e)-6*e*r*(1-e)+6*e*i*(1-e)-3*e*e*i+3*e*e*n},tangentSpline:function(e,t,r,i,n){return 6*e*e-6*e+(3*e*e-4*e+1)+(-6*e*e+6*e)+(3*e*e-2*e)},interpolate:function(e,t,r,i,n){e=.5*(r-e),i=.5*(i-t);var o=n*n;return(2*t-2*r+e+i)*n*o+(-3*t+3*r-2*e-i)*o+e*n+t}},THREE.SceneUtils={createMultiMaterialObject:function(e,t){for(var r=new THREE.Group,i=0,n=t.length;n>i;i++)r.add(new THREE.Mesh(e,t[i]));return r},detach:function(e,t,r){e.applyMatrix(t.matrixWorld),t.remove(e),r.add(e)},attach:function(e,t,r){var i=new THREE.Matrix4;i.getInverse(r.matrixWorld),e.applyMatrix(i),t.remove(e),r.add(e)}},THREE.ShapeUtils={area:function(e){for(var t=e.length,r=0,i=t-1,n=0;t>n;i=n++)r+=e[i].x*e[n].y-e[n].x*e[i].y;return.5*r},triangulate:function(){return function(e,t){var r=e.length;if(3>r)return null;var i,n,o,a=[],s=[],c=[];if(0<THREE.ShapeUtils.area(e))for(n=0;r>n;n++)s[n]=n;else for(n=0;r>n;n++)s[n]=r-1-n;var h=2*r;for(n=r-1;r>2;){if(0>=h--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}i=n,i>=r&&(i=0),n=i+1,n>=r&&(n=0),o=n+1,o>=r&&(o=0);var l;e:{var u=l=void 0,p=void 0,d=void 0,E=void 0,f=void 0,m=void 0,g=void 0,T=void 0,u=e[s[i]].x,p=e[s[i]].y,d=e[s[n]].x,E=e[s[n]].y,f=e[s[o]].x,m=e[s[o]].y;if(Number.EPSILON>(d-u)*(m-p)-(E-p)*(f-u))l=!1;else{var v=void 0,y=void 0,R=void 0,H=void 0,x=void 0,b=void 0,_=void 0,M=void 0,w=void 0,S=void 0,w=M=_=T=g=void 0,v=f-d,y=m-E,R=u-f,H=p-m,x=d-u,b=E-p;for(l=0;r>l;l++)if(g=e[s[l]].x,T=e[s[l]].y,!(g===u&&T===p||g===d&&T===E||g===f&&T===m)&&(_=g-u,M=T-p,w=g-d,S=T-E,g-=f,T-=m,w=v*S-y*w,_=x*M-b*_,M=R*T-H*g,w>=-Number.EPSILON&&M>=-Number.EPSILON&&_>=-Number.EPSILON)){l=!1;break e}l=!0}}if(l){for(a.push([e[s[i]],e[s[n]],e[s[o]]]),c.push([s[i],s[n],s[o]]),i=n,o=n+1;r>o;i++,o++)s[i]=s[o];r--,h=2*r}}return t?c:a}}(),triangulateShape:function(e,t){function r(e,t,r){return e.x!==t.x?e.x<t.x?e.x<=r.x&&r.x<=t.x:t.x<=r.x&&r.x<=e.x:e.y<t.y?e.y<=r.y&&r.y<=t.y:t.y<=r.y&&r.y<=e.y}function i(e,t,i,n,o){var a=t.x-e.x,s=t.y-e.y,c=n.x-i.x,h=n.y-i.y,l=e.x-i.x,u=e.y-i.y,p=s*c-a*h,d=s*l-a*u;if(Math.abs(p)>Number.EPSILON){if(p>0){if(0>d||d>p)return[];if(c=h*l-c*u,0>c||c>p)return[]}else{if(d>0||p>d)return[];if(c=h*l-c*u,c>0||p>c)return[]}return 0===c?!o||0!==d&&d!==p?[e]:[]:c===p?!o||0!==d&&d!==p?[t]:[]:0===d?[i]:d===p?[n]:(o=c/p,[{x:e.x+o*a,y:e.y+o*s}])}return 0!==d||h*l!==c*u?[]:(s=0===a&&0===s,c=0===c&&0===h,s&&c?e.x!==i.x||e.y!==i.y?[]:[e]:s?r(i,n,e)?[e]:[]:c?r(e,t,i)?[i]:[]:(0!==a?(e.x<t.x?(a=e,c=e.x,s=t,e=t.x):(a=t,c=t.x,s=e,e=e.x),i.x<n.x?(t=i,p=i.x,h=n,i=n.x):(t=n,p=n.x,h=i,i=i.x)):(e.y<t.y?(a=e,c=e.y,s=t,e=t.y):(a=t,c=t.y,s=e,e=e.y),i.y<n.y?(t=i,p=i.y,h=n,i=n.y):(t=n,p=n.y,h=i,i=i.y)),p>=c?p>e?[]:e===p?o?[]:[t]:i>=e?[t,s]:[t,h]:c>i?[]:c===i?o?[]:[a]:i>=e?[a,s]:[a,h]))}function n(e,t,r,i){var n=t.x-e.x,o=t.y-e.y;t=r.x-e.x,r=r.y-e.y;var a=i.x-e.x;return i=i.y-e.y,e=n*r-o*t,n=n*i-o*a,Math.abs(e)>Number.EPSILON?(t=a*r-i*t,e>0?n>=0&&t>=0:n>=0||t>=0):n>0}var o,a,s,c,h,l={};for(s=e.concat(),o=0,a=t.length;a>o;o++)Array.prototype.push.apply(s,t[o]);for(o=0,a=s.length;a>o;o++)h=s[o].x+":"+s[o].y,void 0!==l[h]&&console.warn("THREE.Shape: Duplicate point",h),l[h]=o;o=function(e,t){function r(e,t){var r=m.length-1,i=e-1;0>i&&(i=r);var o=e+1;return o>r&&(o=0),(r=n(m[e],m[i],m[o],s[t]))?(r=s.length-1,i=t-1,0>i&&(i=r),o=t+1,o>r&&(o=0),(r=n(s[t],s[i],s[o],m[e]))?!0:!1):!1}function o(e,t){var r,n;for(r=0;r<m.length;r++)if(n=r+1,n%=m.length,n=i(e,t,m[r],m[n],!0),0<n.length)return!0;return!1}function a(e,r){var n,o,a,s;for(n=0;n<g.length;n++)for(o=t[g[n]],a=0;a<o.length;a++)if(s=a+1,s%=o.length,s=i(e,r,o[a],o[s],!0),0<s.length)return!0;return!1}var s,c,h,l,u,p,d,E,f,m=e.concat(),g=[],T=[],v=0;for(c=t.length;c>v;v++)g.push(v);d=0;for(var y=2*g.length;0<g.length;){if(y--,0>y){console.log("Infinite Loop! Holes left:"+g.length+", Probably Hole outside Shape!");break}for(h=d;h<m.length;h++){for(l=m[h],c=-1,v=0;v<g.length;v++)if(u=g[v],p=l.x+":"+l.y+":"+u,void 0===T[p]){for(s=t[u],E=0;E<s.length;E++)if(u=s[E],r(h,E)&&!o(l,u)&&!a(l,u)){c=E,g.splice(v,1),d=m.slice(0,h+1),u=m.slice(h),E=s.slice(c),f=s.slice(0,c+1),m=d.concat(E).concat(f).concat(u),d=h;break}if(c>=0)break;T[p]=!0}if(c>=0)break}}return m}(e,t);var u=THREE.ShapeUtils.triangulate(o,!1);for(o=0,a=u.length;a>o;o++)for(c=u[o],s=0;3>s;s++)h=c[s].x+":"+c[s].y,h=l[h],void 0!==h&&(c[s]=h);return u.concat()},isClockWise:function(e){return 0>THREE.ShapeUtils.area(e)},b2:function(){return function(e,t,r,i){var n=1-e;return n*n*t+2*(1-e)*e*r+e*e*i}}(),b3:function(){return function(e,t,r,i,n){var o=1-e,a=1-e;return o*o*o*t+3*a*a*e*r+3*(1-e)*e*e*i+e*e*e*n}}()},THREE.Curve=function(){},THREE.Curve.prototype={constructor:THREE.Curve,getPoint:function(e){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(e){return e=this.getUtoTmapping(e),this.getPoint(e)},getPoints:function(e){e||(e=5);var t,r=[];for(t=0;e>=t;t++)r.push(this.getPoint(t/e));return r},getSpacedPoints:function(e){e||(e=5);var t,r=[];for(t=0;e>=t;t++)r.push(this.getPointAt(t/e));return r},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,r,i=[],n=this.getPoint(0),o=0;for(i.push(0),r=1;e>=r;r++)t=this.getPoint(r/e),o+=t.distanceTo(n),i.push(o),n=t;return this.cacheArcLengths=i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var r,i=this.getLengths(),n=0,o=i.length;r=t?t:e*i[o-1];for(var a,s=0,c=o-1;c>=s;)if(n=Math.floor(s+(c-s)/2),a=i[n]-r,0>a)s=n+1;else{if(!(a>0)){c=n;break}c=n-1}return n=c,i[n]===r?n/(o-1):(s=i[n],i=(n+(r-s)/(i[n+1]-s))/(o-1))},getTangent:function(e){var t=e-1e-4;return e+=1e-4,0>t&&(t=0),e>1&&(e=1),t=this.getPoint(t),this.getPoint(e).clone().sub(t).normalize()},getTangentAt:function(e){return e=this.getUtoTmapping(e),this.getTangent(e)}},THREE.Curve.create=function(e,t){return e.prototype=Object.create(THREE.Curve.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},THREE.CurvePath=function(){this.curves=[],this.autoClose=!1},THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype),THREE.CurvePath.prototype.constructor=THREE.CurvePath,THREE.CurvePath.prototype.add=function(e){this.curves.push(e)},THREE.CurvePath.prototype.closePath=function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new THREE.LineCurve(t,e))},THREE.CurvePath.prototype.getPoint=function(e){for(var t=e*this.getLength(),r=this.getCurveLengths(),i=0;i<r.length;){if(r[i]>=t)return e=this.curves[i],t=1-(r[i]-t)/e.getLength(),e.getPointAt(t);i++}return null},THREE.CurvePath.prototype.getLength=function(){var e=this.getCurveLengths();return e[e.length-1]},THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,r=0,i=this.curves.length;i>r;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e},THREE.CurvePath.prototype.createPointsGeometry=function(e){return e=this.getPoints(e),this.createGeometry(e)},THREE.CurvePath.prototype.createSpacedPointsGeometry=function(e){return e=this.getSpacedPoints(e),this.createGeometry(e)},THREE.CurvePath.prototype.createGeometry=function(e){for(var t=new THREE.Geometry,r=0,i=e.length;i>r;r++){var n=e[r];t.vertices.push(new THREE.Vector3(n.x,n.y,n.z||0))}return t},THREE.Font=function(e){this.data=e},THREE.Font.prototype={constructor:THREE.Font,generateShapes:function(e,t,r){void 0===t&&(t=100),void 0===r&&(r=4);var i=this.data;e=String(e).split("");var n=t/i.resolution,o=0;t=[];for(var a=0;a<e.length;a++){var s;s=n;var c=o,h=i.glyphs[e[a]]||i.glyphs["?"];if(h){var l=new THREE.Path,u=[],p=THREE.ShapeUtils.b2,d=THREE.ShapeUtils.b3,E=void 0,f=void 0,m=f=E=void 0,g=void 0,T=void 0,v=void 0,y=void 0,R=void 0,g=void 0;if(h.o)for(var H=h._cachedOutline||(h._cachedOutline=h.o.split(" ")),x=0,b=H.length;b>x;)switch(H[x++]){case"m":E=H[x++]*s+c,f=H[x++]*s,l.moveTo(E,f);break;case"l":E=H[x++]*s+c,f=H[x++]*s,l.lineTo(E,f);break;case"q":if(E=H[x++]*s+c,f=H[x++]*s,T=H[x++]*s+c,v=H[x++]*s,l.quadraticCurveTo(T,v,E,f),g=u[u.length-1])for(var m=g.x,g=g.y,_=1;r>=_;_++){var M=_/r;p(M,m,T,E),p(M,g,v,f)}break;case"b":if(E=H[x++]*s+c,f=H[x++]*s,T=H[x++]*s+c,v=H[x++]*s,y=H[x++]*s+c,R=H[x++]*s,l.bezierCurveTo(T,v,y,R,E,f),g=u[u.length-1])for(m=g.x,g=g.y,_=1;r>=_;_++)M=_/r,d(M,m,T,y,E),d(M,g,v,R,f)}s={offset:h.ha*s,path:l}}else s=void 0;o+=s.offset,t.push(s.path)}for(r=[],i=0,e=t.length;e>i;i++)Array.prototype.push.apply(r,t[i].toShapes());return r}},THREE.Path=function(e){THREE.CurvePath.call(this),this.actions=[],e&&this.fromPoints(e)},THREE.Path.prototype=Object.create(THREE.CurvePath.prototype),THREE.Path.prototype.constructor=THREE.Path,THREE.Path.prototype.fromPoints=function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,r=e.length;r>t;t++)this.lineTo(e[t].x,e[t].y)},THREE.Path.prototype.moveTo=function(e,t){this.actions.push({action:"moveTo",args:[e,t]})},THREE.Path.prototype.lineTo=function(e,t){var r=this.actions[this.actions.length-1].args,r=new THREE.LineCurve(new THREE.Vector2(r[r.length-2],r[r.length-1]),new THREE.Vector2(e,t));this.curves.push(r),this.actions.push({action:"lineTo",args:[e,t]})},THREE.Path.prototype.quadraticCurveTo=function(e,t,r,i){var n=this.actions[this.actions.length-1].args,n=new THREE.QuadraticBezierCurve(new THREE.Vector2(n[n.length-2],n[n.length-1]),new THREE.Vector2(e,t),new THREE.Vector2(r,i));this.curves.push(n),this.actions.push({action:"quadraticCurveTo",args:[e,t,r,i]})},THREE.Path.prototype.bezierCurveTo=function(e,t,r,i,n,o){var a=this.actions[this.actions.length-1].args,a=new THREE.CubicBezierCurve(new THREE.Vector2(a[a.length-2],a[a.length-1]),new THREE.Vector2(e,t),new THREE.Vector2(r,i),new THREE.Vector2(n,o));this.curves.push(a),this.actions.push({action:"bezierCurveTo",args:[e,t,r,i,n,o]})},THREE.Path.prototype.splineThru=function(e){var t=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,e),r=new THREE.SplineCurve(r),this.curves.push(r),this.actions.push({action:"splineThru",args:t})},THREE.Path.prototype.arc=function(e,t,r,i,n,o){var a=this.actions[this.actions.length-1].args;this.absarc(e+a[a.length-2],t+a[a.length-1],r,i,n,o)},THREE.Path.prototype.absarc=function(e,t,r,i,n,o){this.absellipse(e,t,r,r,i,n,o)},THREE.Path.prototype.ellipse=function(e,t,r,i,n,o,a,s){var c=this.actions[this.actions.length-1].args;this.absellipse(e+c[c.length-2],t+c[c.length-1],r,i,n,o,a,s)},THREE.Path.prototype.absellipse=function(e,t,r,i,n,o,a,s){var c=[e,t,r,i,n,o,a,s||0];e=new THREE.EllipseCurve(e,t,r,i,n,o,a,s),this.curves.push(e),e=e.getPoint(1),c.push(e.x),c.push(e.y),this.actions.push({action:"ellipse",args:c})},THREE.Path.prototype.getSpacedPoints=function(e){e||(e=40);for(var t=[],r=0;e>r;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t},THREE.Path.prototype.getPoints=function(e){e=e||12;for(var t,r,i,n,o,a,s,c,h,l,u=THREE.ShapeUtils.b2,p=THREE.ShapeUtils.b3,d=[],E=0,f=this.actions.length;f>E;E++){h=this.actions[E];var m=h.args;switch(h.action){case"moveTo":d.push(new THREE.Vector2(m[0],m[1]));break;case"lineTo":d.push(new THREE.Vector2(m[0],m[1]));break;case"quadraticCurveTo":for(t=m[2],r=m[3],o=m[0],a=m[1],0<d.length?(h=d[d.length-1],s=h.x,c=h.y):(h=this.actions[E-1].args,s=h[h.length-2],c=h[h.length-1]),m=1;e>=m;m++)l=m/e,h=u(l,s,o,t),l=u(l,c,a,r),d.push(new THREE.Vector2(h,l));break;case"bezierCurveTo":for(t=m[4],r=m[5],o=m[0],a=m[1],i=m[2],n=m[3],0<d.length?(h=d[d.length-1],s=h.x,c=h.y):(h=this.actions[E-1].args,s=h[h.length-2],c=h[h.length-1]),m=1;e>=m;m++)l=m/e,h=p(l,s,o,i,t),l=p(l,c,a,n,r),d.push(new THREE.Vector2(h,l));break;case"splineThru":for(h=this.actions[E-1].args,l=[new THREE.Vector2(h[h.length-2],h[h.length-1])],h=e*m[0].length,l=l.concat(m[0]),l=new THREE.SplineCurve(l),m=1;h>=m;m++)d.push(l.getPointAt(m/h));break;case"arc":for(t=m[0],r=m[1],a=m[2],i=m[3],h=m[4],o=!!m[5],s=h-i,c=2*e,m=1;c>=m;m++)l=m/c,o||(l=1-l),l=i+l*s,h=t+a*Math.cos(l),l=r+a*Math.sin(l),d.push(new THREE.Vector2(h,l));break;case"ellipse":t=m[0],r=m[1],a=m[2],n=m[3],i=m[4],h=m[5],o=!!m[6];var g=m[7];s=h-i,c=2*e;var T,v;for(0!==g&&(T=Math.cos(g),v=Math.sin(g)),m=1;c>=m;m++){if(l=m/c,o||(l=1-l),l=i+l*s,h=t+a*Math.cos(l),l=r+n*Math.sin(l),0!==g){var y=h;h=(y-t)*T-(l-r)*v+t,l=(y-t)*v+(l-r)*T+r}d.push(new THREE.Vector2(h,l))}}}return e=d[d.length-1],Math.abs(e.x-d[0].x)<Number.EPSILON&&Math.abs(e.y-d[0].y)<Number.EPSILON&&d.splice(d.length-1,1),this.autoClose&&d.push(d[0]),d},THREE.Path.prototype.toShapes=function(e,t){function r(e){for(var t=[],r=0,i=e.length;i>r;r++){var n=e[r],o=new THREE.Shape;o.actions=n.actions,o.curves=n.curves,t.push(o)}return t}function i(e,t){for(var r=t.length,i=!1,n=r-1,o=0;r>o;n=o++){var a=t[n],s=t[o],c=s.x-a.x,h=s.y-a.y;if(Math.abs(h)>Number.EPSILON){if(0>h&&(a=t[o],c=-c,s=t[n],h=-h),!(e.y<a.y||e.y>s.y))if(e.y===a.y){if(e.x===a.x)return!0}else{if(n=h*(e.x-a.x)-c*(e.y-a.y),0===n)return!0;0>n||(i=!i)}}else if(e.y===a.y&&(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x))return!0}return i}var n=THREE.ShapeUtils.isClockWise,o=function(e){for(var t=[],r=new THREE.Path,i=0,n=e.length;n>i;i++){var o=e[i],a=o.args,o=o.action;"moveTo"===o&&0!==r.actions.length&&(t.push(r),r=new THREE.Path),r[o].apply(r,a)}return 0!==r.actions.length&&t.push(r),t}(this.actions);if(0===o.length)return[];if(!0===t)return r(o);var a,s,c,h=[];if(1===o.length)return s=o[0],c=new THREE.Shape,c.actions=s.actions,c.curves=s.curves,h.push(c),h;var l=!n(o[0].getPoints()),l=e?!l:l;c=[];var u,p=[],d=[],E=0;p[E]=void 0,d[E]=[];for(var f=0,m=o.length;m>f;f++)s=o[f],u=s.getPoints(),a=n(u),(a=e?!a:a)?(!l&&p[E]&&E++,p[E]={s:new THREE.Shape,p:u},p[E].s.actions=s.actions,p[E].s.curves=s.curves,l&&E++,d[E]=[]):d[E].push({h:s,p:u[0]});if(!p[0])return r(o);if(1<p.length){for(f=!1,s=[],n=0,o=p.length;o>n;n++)c[n]=[];for(n=0,o=p.length;o>n;n++)for(a=d[n],l=0;l<a.length;l++){for(E=a[l],u=!0,m=0;m<p.length;m++)i(E.p,p[m].p)&&(n!==m&&s.push({froms:n,tos:m,hole:l}),u?(u=!1,c[m].push(E)):f=!0);u&&c[n].push(E)}0<s.length&&(f||(d=c))}for(f=0,n=p.length;n>f;f++)for(c=p[f].s,h.push(c),s=d[f],o=0,a=s.length;a>o;o++)c.holes.push(s[o].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(e){return new THREE.ExtrudeGeometry(this,e)},THREE.Shape.prototype.makeGeometry=function(e){return new THREE.ShapeGeometry(this,e)},THREE.Shape.prototype.getPointsHoles=function(e){for(var t=[],r=0,i=this.holes.length;i>r;r++)t[r]=this.holes[r].getPoints(e);return t},THREE.Shape.prototype.extractAllPoints=function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},THREE.Shape.prototype.extractPoints=function(e){return this.extractAllPoints(e)},THREE.LineCurve=function(e,t){this.v1=e,this.v2=t},THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype),THREE.LineCurve.prototype.constructor=THREE.LineCurve,THREE.LineCurve.prototype.getPoint=function(e){var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},THREE.LineCurve.prototype.getPointAt=function(e){return this.getPoint(e)},THREE.LineCurve.prototype.getTangent=function(e){return this.v2.clone().sub(this.v1).normalize()},THREE.QuadraticBezierCurve=function(e,t,r){this.v0=e,this.v1=t,this.v2=r},THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype),THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve,THREE.QuadraticBezierCurve.prototype.getPoint=function(e){var t=THREE.ShapeUtils.b2;return new THREE.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y))},THREE.QuadraticBezierCurve.prototype.getTangent=function(e){var t=THREE.CurveUtils.tangentQuadraticBezier;return new THREE.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y)).normalize()},THREE.CubicBezierCurve=function(e,t,r,i){this.v0=e,this.v1=t,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(e){var t=THREE.ShapeUtils.b3;return new THREE.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},THREE.CubicBezierCurve.prototype.getTangent=function(e){var t=THREE.CurveUtils.tangentCubicBezier;return new THREE.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},THREE.SplineCurve=function(e){this.points=void 0==e?[]:e},THREE.SplineCurve.prototype=Object.create(THREE.Curve.prototype),THREE.SplineCurve.prototype.constructor=THREE.SplineCurve,THREE.SplineCurve.prototype.getPoint=function(e){var t=this.points;e*=t.length-1;var r=Math.floor(e);e-=r;var i=t[0===r?r:r-1],n=t[r],o=t[r>t.length-2?t.length-1:r+1],t=t[r>t.length-3?t.length-1:r+2],r=THREE.CurveUtils.interpolate;return new THREE.Vector2(r(i.x,n.x,o.x,t.x,e),r(i.y,n.y,o.y,t.y,e))},THREE.EllipseCurve=function(e,t,r,i,n,o,a,s){this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0},THREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype),THREE.EllipseCurve.prototype.constructor=THREE.EllipseCurve,THREE.EllipseCurve.prototype.getPoint=function(e){var t=this.aEndAngle-this.aStartAngle;0>t&&(t+=2*Math.PI),t>2*Math.PI&&(t-=2*Math.PI),t=!0===this.aClockwise?this.aEndAngle+(1-e)*(2*Math.PI-t):this.aStartAngle+e*t,e=this.aX+this.xRadius*Math.cos(t);var r=this.aY+this.yRadius*Math.sin(t);if(0!==this.aRotation){var t=Math.cos(this.aRotation),i=Math.sin(this.aRotation),n=e;e=(n-this.aX)*t-(r-this.aY)*i+this.aX,r=(n-this.aX)*i+(r-this.aY)*t+this.aY}return new THREE.Vector2(e,r)},THREE.ArcCurve=function(e,t,r,i,n,o){THREE.EllipseCurve.call(this,e,t,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(e,t){this.v1=e,this.v2=t},function(e){var t=new THREE.Vector3;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t}),THREE.QuadraticBezierCurve3=THREE.Curve.create(function(e,t,r){this.v0=e,this.v1=t,this.v2=r},function(e){var t=THREE.ShapeUtils.b2;return new THREE.Vector3(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y),t(e,this.v0.z,this.v1.z,this.v2.z))}),THREE.CubicBezierCurve3=THREE.Curve.create(function(e,t,r,i){this.v0=e,this.v1=t,this.v2=r,this.v3=i},function(e){var t=THREE.ShapeUtils.b3;return new THREE.Vector3(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),t(e,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),THREE.SplineCurve3=THREE.Curve.create(function(e){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0==e?[]:e},function(e){var t=this.points;e*=t.length-1;var r=Math.floor(e);e-=r;var i=t[0==r?r:r-1],n=t[r],o=t[r>t.length-2?t.length-1:r+1],t=t[r>t.length-3?t.length-1:r+2],r=THREE.CurveUtils.interpolate;return new THREE.Vector3(r(i.x,n.x,o.x,t.x,e),r(i.y,n.y,o.y,t.y,e),r(i.z,n.z,o.z,t.z,e))}),THREE.CatmullRomCurve3=function(){function e(){}var t=new THREE.Vector3,r=new e,i=new e,n=new e;return e.prototype.init=function(e,t,r,i){this.c0=e,this.c1=r,this.c2=-3*e+3*t-2*r-i,this.c3=2*e-2*t+r+i},e.prototype.initNonuniformCatmullRom=function(e,t,r,i,n,o,a){e=((t-e)/n-(r-e)/(n+o)+(r-t)/o)*o,i=((r-t)/o-(i-t)/(o+a)+(i-r)/a)*o,this.init(t,r,e,i)},e.prototype.initCatmullRom=function(e,t,r,i,n){this.init(t,r,n*(r-e),n*(i-t))},e.prototype.calc=function(e){var t=e*e;return this.c0+this.c1*e+this.c2*t+this.c3*t*e},THREE.Curve.create(function(e){this.points=e||[],this.closed=!1},function(e){var o,a,s=this.points;a=s.length,2>a&&console.log("duh, you need at least 2 points"),e*=a-(this.closed?0:1),o=Math.floor(e),e-=o,this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s.length)+1)*s.length:0===e&&o===a-1&&(o=a-2,e=1);var c,h,l;if(this.closed||o>0?c=s[(o-1)%a]:(t.subVectors(s[0],s[1]).add(s[0]),c=t),h=s[o%a],l=s[(o+1)%a], this.closed||a>o+2?s=s[(o+2)%a]:(t.subVectors(s[a-1],s[a-2]).add(s[a-1]),s=t),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var u="chordal"===this.type?.5:.25;a=Math.pow(c.distanceToSquared(h),u),o=Math.pow(h.distanceToSquared(l),u),u=Math.pow(l.distanceToSquared(s),u),1e-4>o&&(o=1),1e-4>a&&(a=o),1e-4>u&&(u=o),r.initNonuniformCatmullRom(c.x,h.x,l.x,s.x,a,o,u),i.initNonuniformCatmullRom(c.y,h.y,l.y,s.y,a,o,u),n.initNonuniformCatmullRom(c.z,h.z,l.z,s.z,a,o,u)}else"catmullrom"===this.type&&(a=void 0!==this.tension?this.tension:.5,r.initCatmullRom(c.x,h.x,l.x,s.x,a),i.initCatmullRom(c.y,h.y,l.y,s.y,a),n.initCatmullRom(c.z,h.z,l.z,s.z,a));return new THREE.Vector3(r.calc(e),i.calc(e),n.calc(e))})}(),THREE.ClosedSplineCurve3=function(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."),THREE.CatmullRomCurve3.call(this,e),this.type="catmullrom",this.closed=!0},THREE.ClosedSplineCurve3.prototype=Object.create(THREE.CatmullRomCurve3.prototype),THREE.BoxGeometry=function(e,t,r,i,n,o){THREE.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:n,depthSegments:o},this.fromBufferGeometry(new THREE.BoxBufferGeometry(e,t,r,i,n,o)),this.mergeVertices()},THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.BoxGeometry.prototype.constructor=THREE.BoxGeometry,THREE.CubeGeometry=THREE.BoxGeometry,THREE.BoxBufferGeometry=function(e,t,r,i,n,o){function a(e,t,r,i,n,o,a,c,h,v,y){var R=o/h,H=a/v,x=o/2,b=a/2,_=c/2;a=h+1;for(var M=v+1,w=o=0,S=new THREE.Vector3,L=0;M>L;L++)for(var A=L*H-b,C=0;a>C;C++)S[e]=(C*R-x)*i,S[t]=A*n,S[r]=_,u[E]=S.x,u[E+1]=S.y,u[E+2]=S.z,S[e]=0,S[t]=0,S[r]=c>0?1:-1,p[E]=S.x,p[E+1]=S.y,p[E+2]=S.z,d[f]=C/h,d[f+1]=1-L/v,E+=3,f+=2,o+=1;for(L=0;v>L;L++)for(C=0;h>C;C++)e=g+C+a*(L+1),t=g+(C+1)+a*(L+1),r=g+(C+1)+a*L,l[m]=g+C+a*L,l[m+1]=e,l[m+2]=r,l[m+3]=e,l[m+4]=t,l[m+5]=r,m+=6,w+=6;s.addGroup(T,w,y),T+=w,g+=o}THREE.BufferGeometry.call(this),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:n,depthSegments:o};var s=this;i=Math.floor(i)||1,n=Math.floor(n)||1,o=Math.floor(o)||1;var c=function(e,t,r){return e=0+e*t*2+e*r*2,e+=r*t*2,4*e}(i,n,o),h=c/4*6,l=new(h>65535?Uint32Array:Uint16Array)(h),u=new Float32Array(3*c),p=new Float32Array(3*c),d=new Float32Array(2*c),E=0,f=0,m=0,g=0,T=0;a("z","y","x",-1,-1,r,t,e,o,n,0),a("z","y","x",1,-1,r,t,-e,o,n,1),a("x","z","y",1,1,e,r,t,i,o,2),a("x","z","y",1,-1,e,r,-t,i,o,3),a("x","y","z",1,-1,e,t,r,i,n,4),a("x","y","z",-1,-1,e,t,-r,i,n,5),this.setIndex(new THREE.BufferAttribute(l,1)),this.addAttribute("position",new THREE.BufferAttribute(u,3)),this.addAttribute("normal",new THREE.BufferAttribute(p,3)),this.addAttribute("uv",new THREE.BufferAttribute(d,2))},THREE.BoxBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.BoxBufferGeometry.prototype.constructor=THREE.BoxBufferGeometry,THREE.CircleGeometry=function(e,t,r,i){THREE.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:i},this.fromBufferGeometry(new THREE.CircleBufferGeometry(e,t,r,i))},THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.CircleGeometry.prototype.constructor=THREE.CircleGeometry,THREE.CircleBufferGeometry=function(e,t,r,i){THREE.BufferGeometry.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:i},e=e||50,t=void 0!==t?Math.max(3,t):8,r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var n=t+2,o=new Float32Array(3*n),a=new Float32Array(3*n),n=new Float32Array(2*n);a[2]=1,n[0]=.5,n[1]=.5;for(var s=0,c=3,h=2;t>=s;s++,c+=3,h+=2){var l=r+s/t*i;o[c]=e*Math.cos(l),o[c+1]=e*Math.sin(l),a[c+2]=1,n[h]=(o[c]/e+1)/2,n[h+1]=(o[c+1]/e+1)/2}for(r=[],c=1;t>=c;c++)r.push(c,c+1,0);this.setIndex(new THREE.BufferAttribute(new Uint16Array(r),1)),this.addAttribute("position",new THREE.BufferAttribute(o,3)),this.addAttribute("normal",new THREE.BufferAttribute(a,3)),this.addAttribute("uv",new THREE.BufferAttribute(n,2)),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,e)},THREE.CircleBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.CircleBufferGeometry.prototype.constructor=THREE.CircleBufferGeometry,THREE.CylinderBufferGeometry=function(e,t,r,i,n,o,a,s){function c(r){var n,o,c;c=new THREE.Vector2;var l=new THREE.Vector3,u=0,T=!0===r?e:t,R=!0===r?1:-1;for(o=m,n=1;i>=n;n++)d.setXYZ(m,0,v*R,0),E.setXYZ(m,0,R,0),!0===r?(c.x=n/i,c.y=0):(c.x=(n-1)/i,c.y=1),f.setXY(m,c.x,c.y),m++;for(c=m,n=0;i>=n;n++){var H=n/i;l.x=T*Math.sin(H*s+a),l.y=v*R,l.z=T*Math.cos(H*s+a),d.setXYZ(m,l.x,l.y,l.z),E.setXYZ(m,0,R,0),f.setXY(m,H,!0===r?1:0),m++}for(n=0;i>n;n++)l=o+n,T=c+n,!0===r?(p.setX(g,T),g++,p.setX(g,T+1)):(p.setX(g,T+1),g++,p.setX(g,T)),g++,p.setX(g,l),g++,u+=3;h.addGroup(y,u,!0===r?1:2),y+=u}THREE.BufferGeometry.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:i,heightSegments:n,openEnded:o,thetaStart:a,thetaLength:s};var h=this;e=void 0!==e?e:20,t=void 0!==t?t:20,r=void 0!==r?r:100,i=Math.floor(i)||8,n=Math.floor(n)||1,o=void 0!==o?o:!1,a=void 0!==a?a:0,s=void 0!==s?s:2*Math.PI;var l=function(){var e=(i+1)*(n+1);return!1===o&&(e+=2*(i+1)+2*i),e}(),u=function(){var e=i*n*6;return!1===o&&(e+=6*i),e}(),p=new THREE.BufferAttribute(new(u>65535?Uint32Array:Uint16Array)(u),1),d=new THREE.BufferAttribute(new Float32Array(3*l),3),E=new THREE.BufferAttribute(new Float32Array(3*l),3),f=new THREE.BufferAttribute(new Float32Array(2*l),2),m=0,g=0,T=[],v=r/2,y=0;!function(){var o,c,l=new THREE.Vector3,u=new THREE.Vector3,R=0,H=(t-e)/r;for(c=0;n>=c;c++){var x=[],b=c/n,_=b*(t-e)+e;for(o=0;i>=o;o++){var M=o/i;u.x=_*Math.sin(M*s+a),u.y=-b*r+v,u.z=_*Math.cos(M*s+a),d.setXYZ(m,u.x,u.y,u.z),l.copy(u),(0===e&&0===c||0===t&&c===n)&&(l.x=Math.sin(M*s+a),l.z=Math.cos(M*s+a)),l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*H).normalize(),E.setXYZ(m,l.x,l.y,l.z),f.setXY(m,M,1-b),x.push(m),m++}T.push(x)}for(o=0;i>o;o++)for(c=0;n>c;c++)l=T[c+1][o],u=T[c+1][o+1],H=T[c][o+1],p.setX(g,T[c][o]),g++,p.setX(g,l),g++,p.setX(g,H),g++,p.setX(g,l),g++,p.setX(g,u),g++,p.setX(g,H),g++,R+=6;h.addGroup(y,R,0),y+=R}(),!1===o&&(e>0&&c(!0),t>0&&c(!1)),this.setIndex(p),this.addAttribute("position",d),this.addAttribute("normal",E),this.addAttribute("uv",f)},THREE.CylinderBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.CylinderBufferGeometry.prototype.constructor=THREE.CylinderBufferGeometry,THREE.CylinderGeometry=function(e,t,r,i,n,o,a,s){THREE.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:i,heightSegments:n,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new THREE.CylinderBufferGeometry(e,t,r,i,n,o,a,s)),this.mergeVertices()},THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry,THREE.EdgesGeometry=function(e,t){function r(e,t){return e-t}THREE.BufferGeometry.call(this);var i,n=Math.cos(THREE.Math.DEG2RAD*(void 0!==t?t:1)),o=[0,0],a={},s=["a","b","c"];e instanceof THREE.BufferGeometry?(i=new THREE.Geometry,i.fromBufferGeometry(e)):i=e.clone(),i.mergeVertices(),i.computeFaceNormals();var c=i.vertices;i=i.faces;for(var h=0,l=i.length;l>h;h++)for(var u=i[h],p=0;3>p;p++){o[0]=u[s[p]],o[1]=u[s[(p+1)%3]],o.sort(r);var d=o.toString();void 0===a[d]?a[d]={vert1:o[0],vert2:o[1],face1:h,face2:void 0}:a[d].face2=h}o=[];for(d in a)s=a[d],(void 0===s.face2||i[s.face1].normal.dot(i[s.face2].normal)<=n)&&(h=c[s.vert1],o.push(h.x),o.push(h.y),o.push(h.z),h=c[s.vert2],o.push(h.x),o.push(h.y),o.push(h.z));this.addAttribute("position",new THREE.BufferAttribute(new Float32Array(o),3))},THREE.EdgesGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.EdgesGeometry.prototype.constructor=THREE.EdgesGeometry,THREE.ExtrudeGeometry=function(e,t){"undefined"!=typeof e&&(THREE.Geometry.call(this),this.type="ExtrudeGeometry",e=Array.isArray(e)?e:[e],this.addShapeList(e,t),this.computeFaceNormals())},THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry,THREE.ExtrudeGeometry.prototype.addShapeList=function(e,t){for(var r=e.length,i=0;r>i;i++)this.addShape(e[i],t)},THREE.ExtrudeGeometry.prototype.addShape=function(e,t){function r(e,t,r){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(r).add(e)}function i(e,t,r){var i=1,i=e.x-t.x,n=e.y-t.y,o=r.x-e.x,a=r.y-e.y,s=i*i+n*n;if(Math.abs(i*a-n*o)>Number.EPSILON){var c=Math.sqrt(s),h=Math.sqrt(o*o+a*a),s=t.x-n/c;if(t=t.y+i/c,o=((r.x-a/h-s)*a-(r.y+o/h-t)*o)/(i*a-n*o),r=s+i*o-e.x,e=t+n*o-e.y,i=r*r+e*e,2>=i)return new THREE.Vector2(r,e);i=Math.sqrt(i/2)}else e=!1,i>Number.EPSILON?o>Number.EPSILON&&(e=!0):i<-Number.EPSILON?o<-Number.EPSILON&&(e=!0):Math.sign(n)===Math.sign(a)&&(e=!0),e?(r=-n,e=i,i=Math.sqrt(s)):(r=i,e=n,i=Math.sqrt(s/2));return new THREE.Vector2(r/i,e/i)}function n(e,t){var r,i;for(N=e.length;0<=--N;){r=N,i=N-1,0>i&&(i=e.length-1);for(var n=0,o=T+2*f,n=0;o>n;n++){var a=U*n,s=U*(n+1),c=t+r+a,a=t+i+a,h=t+i+s,s=t+r+s,c=c+M,a=a+M,h=h+M,s=s+M;_.faces.push(new THREE.Face3(c,a,s,null,null,1)),_.faces.push(new THREE.Face3(a,h,s,null,null,1)),c=R.generateSideWallUV(_,c,a,h,s),_.faceVertexUvs[0].push([c[0],c[1],c[3]]),_.faceVertexUvs[0].push([c[1],c[2],c[3]])}}}function o(e,t,r){_.vertices.push(new THREE.Vector3(e,t,r))}function a(e,t,r){e+=M,t+=M,r+=M,_.faces.push(new THREE.Face3(e,t,r,null,null,0)),e=R.generateTopUV(_,e,t,r),_.faceVertexUvs[0].push(e)}var s,c,h,l,u,p=void 0!==t.amount?t.amount:100,d=void 0!==t.bevelThickness?t.bevelThickness:6,E=void 0!==t.bevelSize?t.bevelSize:d-2,f=void 0!==t.bevelSegments?t.bevelSegments:3,m=void 0!==t.bevelEnabled?t.bevelEnabled:!0,g=void 0!==t.curveSegments?t.curveSegments:12,T=void 0!==t.steps?t.steps:1,v=t.extrudePath,y=!1,R=void 0!==t.UVGenerator?t.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator;v&&(s=v.getSpacedPoints(T),y=!0,m=!1,c=void 0!==t.frames?t.frames:new THREE.TubeGeometry.FrenetFrames(v,T,!1),h=new THREE.Vector3,l=new THREE.Vector3,u=new THREE.Vector3),m||(E=d=f=0);var H,x,b,_=this,M=this.vertices.length,v=e.extractPoints(g),g=v.shape,w=v.holes;if(v=!THREE.ShapeUtils.isClockWise(g)){for(g=g.reverse(),x=0,b=w.length;b>x;x++)H=w[x],THREE.ShapeUtils.isClockWise(H)&&(w[x]=H.reverse());v=!1}var S=THREE.ShapeUtils.triangulateShape(g,w),L=g;for(x=0,b=w.length;b>x;x++)H=w[x],g=g.concat(H);var A,C,P,B,D,I,U=g.length,F=S.length,v=[],N=0;for(P=L.length,A=P-1,C=N+1;P>N;N++,A++,C++)A===P&&(A=0),C===P&&(C=0),v[N]=i(L[N],L[A],L[C]);var O,V=[],G=v.concat();for(x=0,b=w.length;b>x;x++){for(H=w[x],O=[],N=0,P=H.length,A=P-1,C=N+1;P>N;N++,A++,C++)A===P&&(A=0),C===P&&(C=0),O[N]=i(H[N],H[A],H[C]);V.push(O),G=G.concat(O)}for(A=0;f>A;A++){for(P=A/f,B=d*(1-P),C=E*Math.sin(P*Math.PI/2),N=0,P=L.length;P>N;N++)D=r(L[N],v[N],C),o(D.x,D.y,-B);for(x=0,b=w.length;b>x;x++)for(H=w[x],O=V[x],N=0,P=H.length;P>N;N++)D=r(H[N],O[N],C),o(D.x,D.y,-B)}for(C=E,N=0;U>N;N++)D=m?r(g[N],G[N],C):g[N],y?(l.copy(c.normals[0]).multiplyScalar(D.x),h.copy(c.binormals[0]).multiplyScalar(D.y),u.copy(s[0]).add(l).add(h),o(u.x,u.y,u.z)):o(D.x,D.y,0);for(P=1;T>=P;P++)for(N=0;U>N;N++)D=m?r(g[N],G[N],C):g[N],y?(l.copy(c.normals[P]).multiplyScalar(D.x),h.copy(c.binormals[P]).multiplyScalar(D.y),u.copy(s[P]).add(l).add(h),o(u.x,u.y,u.z)):o(D.x,D.y,p/T*P);for(A=f-1;A>=0;A--){for(P=A/f,B=d*(1-P),C=E*Math.sin(P*Math.PI/2),N=0,P=L.length;P>N;N++)D=r(L[N],v[N],C),o(D.x,D.y,p+B);for(x=0,b=w.length;b>x;x++)for(H=w[x],O=V[x],N=0,P=H.length;P>N;N++)D=r(H[N],O[N],C),y?o(D.x,D.y+s[T-1].y,s[T-1].x+B):o(D.x,D.y,p+B)}!function(){if(m){var e;for(e=0*U,N=0;F>N;N++)I=S[N],a(I[2]+e,I[1]+e,I[0]+e);for(e=T+2*f,e*=U,N=0;F>N;N++)I=S[N],a(I[0]+e,I[1]+e,I[2]+e)}else{for(N=0;F>N;N++)I=S[N],a(I[2],I[1],I[0]);for(N=0;F>N;N++)I=S[N],a(I[0]+U*T,I[1]+U*T,I[2]+U*T)}}(),function(){var e=0;for(n(L,e),e+=L.length,x=0,b=w.length;b>x;x++)H=w[x],n(H,e),e+=H.length}()},THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(e,t,r,i){return e=e.vertices,t=e[t],r=e[r],i=e[i],[new THREE.Vector2(t.x,t.y),new THREE.Vector2(r.x,r.y),new THREE.Vector2(i.x,i.y)]},generateSideWallUV:function(e,t,r,i,n){return e=e.vertices,t=e[t],r=e[r],i=e[i],n=e[n],.01>Math.abs(t.y-r.y)?[new THREE.Vector2(t.x,1-t.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(t.y,1-t.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(e,t){THREE.Geometry.call(this),this.type="ShapeGeometry",!1===Array.isArray(e)&&(e=[e]),this.addShapeList(e,t),this.computeFaceNormals()},THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ShapeGeometry.prototype.constructor=THREE.ShapeGeometry,THREE.ShapeGeometry.prototype.addShapeList=function(e,t){for(var r=0,i=e.length;i>r;r++)this.addShape(e[r],t);return this},THREE.ShapeGeometry.prototype.addShape=function(e,t){void 0===t&&(t={});var r,i,n,o=t.material,a=void 0===t.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:t.UVGenerator,s=this.vertices.length;r=e.extractPoints(void 0!==t.curveSegments?t.curveSegments:12);var c=r.shape,h=r.holes;if(!THREE.ShapeUtils.isClockWise(c))for(c=c.reverse(),r=0,i=h.length;i>r;r++)n=h[r],THREE.ShapeUtils.isClockWise(n)&&(h[r]=n.reverse());var l=THREE.ShapeUtils.triangulateShape(c,h);for(r=0,i=h.length;i>r;r++)n=h[r],c=c.concat(n);for(h=c.length,i=l.length,r=0;h>r;r++)n=c[r],this.vertices.push(new THREE.Vector3(n.x,n.y,0));for(r=0;i>r;r++)h=l[r],c=h[0]+s,n=h[1]+s,h=h[2]+s,this.faces.push(new THREE.Face3(c,n,h,null,null,o)),this.faceVertexUvs[0].push(a.generateTopUV(this,c,n,h))},THREE.LatheBufferGeometry=function(e,t,r,i){THREE.BufferGeometry.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:i},t=Math.floor(t)||12,r=r||0,i=i||2*Math.PI,i=THREE.Math.clamp(i,0,2*Math.PI);for(var n=(t+1)*e.length,o=t*e.length*6,a=new THREE.BufferAttribute(new(o>65535?Uint32Array:Uint16Array)(o),1),s=new THREE.BufferAttribute(new Float32Array(3*n),3),c=new THREE.BufferAttribute(new Float32Array(2*n),2),h=0,l=0,u=1/t,p=new THREE.Vector3,d=new THREE.Vector2,n=0;t>=n;n++)for(var o=r+n*u*i,E=Math.sin(o),f=Math.cos(o),o=0;o<=e.length-1;o++)p.x=e[o].x*E,p.y=e[o].y,p.z=e[o].x*f,s.setXYZ(h,p.x,p.y,p.z),d.x=n/t,d.y=o/(e.length-1),c.setXY(h,d.x,d.y),h++;for(n=0;t>n;n++)for(o=0;o<e.length-1;o++)r=o+n*e.length,h=r+e.length,u=r+e.length+1,p=r+1,a.setX(l,r),l++,a.setX(l,h),l++,a.setX(l,p),l++,a.setX(l,h),l++,a.setX(l,u),l++,a.setX(l,p),l++;if(this.setIndex(a),this.addAttribute("position",s),this.addAttribute("uv",c),this.computeVertexNormals(),i===2*Math.PI)for(i=this.attributes.normal.array,a=new THREE.Vector3,s=new THREE.Vector3,c=new THREE.Vector3,r=t*e.length*3,o=n=0;n<e.length;n++,o+=3)a.x=i[o+0],a.y=i[o+1],a.z=i[o+2],s.x=i[r+o+0],s.y=i[r+o+1],s.z=i[r+o+2],c.addVectors(a,s).normalize(),i[o+0]=i[r+o+0]=c.x,i[o+1]=i[r+o+1]=c.y,i[o+2]=i[r+o+2]=c.z},THREE.LatheBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.LatheBufferGeometry.prototype.constructor=THREE.LatheBufferGeometry,THREE.LatheGeometry=function(e,t,r,i){THREE.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:i},this.fromBufferGeometry(new THREE.LatheBufferGeometry(e,t,r,i)),this.mergeVertices()},THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry,THREE.PlaneGeometry=function(e,t,r,i){THREE.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:i},this.fromBufferGeometry(new THREE.PlaneBufferGeometry(e,t,r,i))},THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry,THREE.PlaneBufferGeometry=function(e,t,r,i){THREE.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:i};var n=e/2,o=t/2;r=Math.floor(r)||1,i=Math.floor(i)||1;var a=r+1,s=i+1,c=e/r,h=t/i;t=new Float32Array(a*s*3),e=new Float32Array(a*s*3);for(var l=new Float32Array(a*s*2),u=0,p=0,d=0;s>d;d++)for(var E=d*h-o,f=0;a>f;f++)t[u]=f*c-n,t[u+1]=-E,e[u+2]=1,l[p]=f/r,l[p+1]=1-d/i,u+=3,p+=2;for(u=0,n=new(65535<t.length/3?Uint32Array:Uint16Array)(r*i*6),d=0;i>d;d++)for(f=0;r>f;f++)o=f+a*(d+1),s=f+1+a*(d+1),c=f+1+a*d,n[u]=f+a*d,n[u+1]=o,n[u+2]=c,n[u+3]=o,n[u+4]=s,n[u+5]=c,u+=6;this.setIndex(new THREE.BufferAttribute(n,1)),this.addAttribute("position",new THREE.BufferAttribute(t,3)),this.addAttribute("normal",new THREE.BufferAttribute(e,3)),this.addAttribute("uv",new THREE.BufferAttribute(l,2))},THREE.PlaneBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.PlaneBufferGeometry.prototype.constructor=THREE.PlaneBufferGeometry,THREE.RingBufferGeometry=function(e,t,r,i,n,o){THREE.BufferGeometry.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:o},e=e||20,t=t||50,n=void 0!==n?n:0,o=void 0!==o?o:2*Math.PI,r=void 0!==r?Math.max(3,r):8,i=void 0!==i?Math.max(1,i):1;var a,s,c=(r+1)*(i+1),h=r*i*6,h=new THREE.BufferAttribute(new(h>65535?Uint32Array:Uint16Array)(h),1),l=new THREE.BufferAttribute(new Float32Array(3*c),3),u=new THREE.BufferAttribute(new Float32Array(3*c),3),c=new THREE.BufferAttribute(new Float32Array(2*c),2),p=0,d=0,E=e,f=(t-e)/i,m=new THREE.Vector3,g=new THREE.Vector2;for(e=0;i>=e;e++){for(s=0;r>=s;s++)a=n+s/r*o,m.x=E*Math.cos(a),m.y=E*Math.sin(a),l.setXYZ(p,m.x,m.y,m.z),u.setXYZ(p,0,0,1),g.x=(m.x/t+1)/2,g.y=(m.y/t+1)/2,c.setXY(p,g.x,g.y),p++;E+=f}for(e=0;i>e;e++)for(t=e*(r+1),s=0;r>s;s++)n=a=s+t,o=a+r+1,p=a+r+2,a+=1,h.setX(d,n),d++,h.setX(d,o),d++,h.setX(d,p),d++,h.setX(d,n),d++,h.setX(d,p),d++,h.setX(d,a),d++;this.setIndex(h),this.addAttribute("position",l),this.addAttribute("normal",u),this.addAttribute("uv",c)},THREE.RingBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.RingBufferGeometry.prototype.constructor=THREE.RingBufferGeometry,THREE.RingGeometry=function(e,t,r,i,n,o){THREE.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:o},this.fromBufferGeometry(new THREE.RingBufferGeometry(e,t,r,i,n,o))},THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.RingGeometry.prototype.constructor=THREE.RingGeometry,THREE.SphereGeometry=function(e,t,r,i,n,o,a){THREE.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new THREE.SphereBufferGeometry(e,t,r,i,n,o,a))},THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry,THREE.SphereBufferGeometry=function(e,t,r,i,n,o,a){THREE.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},e=e||50,t=Math.max(3,Math.floor(t)||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;for(var s=o+a,c=(t+1)*(r+1),h=new THREE.BufferAttribute(new Float32Array(3*c),3),l=new THREE.BufferAttribute(new Float32Array(3*c),3),c=new THREE.BufferAttribute(new Float32Array(2*c),2),u=0,p=[],d=new THREE.Vector3,E=0;r>=E;E++){for(var f=[],m=E/r,g=0;t>=g;g++){var T=g/t,v=-e*Math.cos(i+T*n)*Math.sin(o+m*a),y=e*Math.cos(o+m*a),R=e*Math.sin(i+T*n)*Math.sin(o+m*a);d.set(v,y,R).normalize(),h.setXYZ(u,v,y,R),l.setXYZ(u,d.x,d.y,d.z),c.setXY(u,T,1-m),f.push(u),u++}p.push(f)}for(i=[],E=0;r>E;E++)for(g=0;t>g;g++)n=p[E][g+1],a=p[E][g],u=p[E+1][g],d=p[E+1][g+1],(0!==E||o>0)&&i.push(n,a,d),(E!==r-1||s<Math.PI)&&i.push(a,u,d);this.setIndex(new(65535<h.count?THREE.Uint32Attribute:THREE.Uint16Attribute)(i,1)),this.addAttribute("position",h),this.addAttribute("normal",l),this.addAttribute("uv",c),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,e)},THREE.SphereBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.SphereBufferGeometry.prototype.constructor=THREE.SphereBufferGeometry,THREE.TextGeometry=function(e,t){t=t||{};var r=t.font;return!1==r instanceof THREE.Font?(console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new THREE.Geometry):(r=r.generateShapes(e,t.size,t.curveSegments),t.amount=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),THREE.ExtrudeGeometry.call(this,r,t),void(this.type="TextGeometry"))},THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype),THREE.TextGeometry.prototype.constructor=THREE.TextGeometry,THREE.TorusBufferGeometry=function(e,t,r,i,n){THREE.BufferGeometry.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:i,arc:n},e=e||100,t=t||40,r=Math.floor(r)||8,i=Math.floor(i)||6,n=n||2*Math.PI;var o,a,s=(r+1)*(i+1),c=r*i*6,c=new(c>65535?Uint32Array:Uint16Array)(c),h=new Float32Array(3*s),l=new Float32Array(3*s),s=new Float32Array(2*s),u=0,p=0,d=0,E=new THREE.Vector3,f=new THREE.Vector3,m=new THREE.Vector3;for(o=0;r>=o;o++)for(a=0;i>=a;a++){var g=a/i*n,T=o/r*Math.PI*2;f.x=(e+t*Math.cos(T))*Math.cos(g),f.y=(e+t*Math.cos(T))*Math.sin(g),f.z=t*Math.sin(T),h[u]=f.x,h[u+1]=f.y,h[u+2]=f.z,E.x=e*Math.cos(g),E.y=e*Math.sin(g),m.subVectors(f,E).normalize(),l[u]=m.x,l[u+1]=m.y,l[u+2]=m.z,s[p]=a/i,s[p+1]=o/r,u+=3,p+=2}for(o=1;r>=o;o++)for(a=1;i>=a;a++)e=(i+1)*(o-1)+a-1,t=(i+1)*(o-1)+a,n=(i+1)*o+a,c[d]=(i+1)*o+a-1,c[d+1]=e,c[d+2]=n,c[d+3]=e,c[d+4]=t,c[d+5]=n,d+=6;this.setIndex(new THREE.BufferAttribute(c,1)),this.addAttribute("position",new THREE.BufferAttribute(h,3)),this.addAttribute("normal",new THREE.BufferAttribute(l,3)),this.addAttribute("uv",new THREE.BufferAttribute(s,2))},THREE.TorusBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.TorusBufferGeometry.prototype.constructor=THREE.TorusBufferGeometry,THREE.TorusGeometry=function(e,t,r,i,n){THREE.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:i,arc:n},this.fromBufferGeometry(new THREE.TorusBufferGeometry(e,t,r,i,n))},THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry,THREE.TorusKnotBufferGeometry=function(e,t,r,i,n,o){function a(e,t,r,i,n){var o=Math.cos(e),a=Math.sin(e);e*=r/t,t=Math.cos(e),n.x=i*(2+t)*.5*o,n.y=i*(2+t)*a*.5,n.z=i*Math.sin(e)*.5}THREE.BufferGeometry.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:i,p:n,q:o},e=e||100,t=t||40,r=Math.floor(r)||64,i=Math.floor(i)||8,n=n||2,o=o||3;var s,c,h=(i+1)*(r+1),l=i*r*6,l=new THREE.BufferAttribute(new(l>65535?Uint32Array:Uint16Array)(l),1),u=new THREE.BufferAttribute(new Float32Array(3*h),3),p=new THREE.BufferAttribute(new Float32Array(3*h),3),h=new THREE.BufferAttribute(new Float32Array(2*h),2),d=0,E=0,f=new THREE.Vector3,m=new THREE.Vector3,g=new THREE.Vector2,T=new THREE.Vector3,v=new THREE.Vector3,y=new THREE.Vector3,R=new THREE.Vector3,H=new THREE.Vector3;for(s=0;r>=s;++s)for(c=s/r*n*Math.PI*2,a(c,n,o,e,T),a(c+.01,n,o,e,v),R.subVectors(v,T),H.addVectors(v,T),y.crossVectors(R,H),H.crossVectors(y,R),y.normalize(),H.normalize(),c=0;i>=c;++c){var x=c/i*Math.PI*2,b=-t*Math.cos(x),x=t*Math.sin(x);f.x=T.x+(b*H.x+x*y.x),f.y=T.y+(b*H.y+x*y.y),f.z=T.z+(b*H.z+x*y.z),u.setXYZ(d,f.x,f.y,f.z),m.subVectors(f,T).normalize(),p.setXYZ(d,m.x,m.y,m.z),g.x=s/r,g.y=c/i,h.setXY(d,g.x,g.y),d++}for(c=1;r>=c;c++)for(s=1;i>=s;s++)e=(i+1)*c+(s-1),t=(i+1)*c+s,n=(i+1)*(c-1)+s,l.setX(E,(i+1)*(c-1)+(s-1)),E++,l.setX(E,e),E++,l.setX(E,n),E++,l.setX(E,e),E++,l.setX(E,t),E++,l.setX(E,n),E++;this.setIndex(l),this.addAttribute("position",u),this.addAttribute("normal",p),this.addAttribute("uv",h)},THREE.TorusKnotBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.TorusKnotBufferGeometry.prototype.constructor=THREE.TorusKnotBufferGeometry,THREE.TorusKnotGeometry=function(e,t,r,i,n,o,a){THREE.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:i,p:n,q:o},void 0!==a&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new THREE.TorusKnotBufferGeometry(e,t,r,i,n,o)),this.mergeVertices()},THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry,THREE.TubeGeometry=function(e,t,r,i,n,o){THREE.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:e,segments:t,radius:r,radialSegments:i,closed:n,taper:o},t=t||64,r=r||1,i=i||8,n=n||!1,o=o||THREE.TubeGeometry.NoTaper;var a,s,c,h,l,u,p,d,E,f,m=[],g=t+1,T=new THREE.Vector3;for(d=new THREE.TubeGeometry.FrenetFrames(e,t,n),E=d.normals,f=d.binormals,this.tangents=d.tangents,this.normals=E,this.binormals=f,d=0;g>d;d++)for(m[d]=[],c=d/(g-1),p=e.getPointAt(c),a=E[d],s=f[d],l=r*o(c),c=0;i>c;c++)h=c/i*2*Math.PI,u=-l*Math.cos(h),h=l*Math.sin(h),T.copy(p),T.x+=u*a.x+h*s.x,T.y+=u*a.y+h*s.y,T.z+=u*a.z+h*s.z,m[d][c]=this.vertices.push(new THREE.Vector3(T.x,T.y,T.z))-1;for(d=0;t>d;d++)for(c=0;i>c;c++)o=n?(d+1)%t:d+1,g=(c+1)%i,e=m[d][c],r=m[o][c],o=m[o][g],g=m[d][g],T=new THREE.Vector2(d/t,c/i),E=new THREE.Vector2((d+1)/t,c/i),f=new THREE.Vector2((d+1)/t,(c+1)/i),a=new THREE.Vector2(d/t,(c+1)/i),this.faces.push(new THREE.Face3(e,r,g)),this.faceVertexUvs[0].push([T,E,a]),this.faces.push(new THREE.Face3(r,o,g)),this.faceVertexUvs[0].push([E.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(e){return 1},THREE.TubeGeometry.SinusoidalTaper=function(e){return Math.sin(Math.PI*e)},THREE.TubeGeometry.FrenetFrames=function(e,t,r){var i=new THREE.Vector3,n=[],o=[],a=[],s=new THREE.Vector3,c=new THREE.Matrix4;t+=1;var h,l,u;for(this.tangents=n,this.normals=o,this.binormals=a,h=0;t>h;h++)l=h/(t-1),n[h]=e.getTangentAt(l),n[h].normalize();for(o[0]=new THREE.Vector3,a[0]=new THREE.Vector3,e=Number.MAX_VALUE,h=Math.abs(n[0].x),l=Math.abs(n[0].y),u=Math.abs(n[0].z),e>=h&&(e=h,i.set(1,0,0)),e>=l&&(e=l,i.set(0,1,0)),e>=u&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),o[0].crossVectors(n[0],s),a[0].crossVectors(n[0],o[0]),h=1;t>h;h++)o[h]=o[h-1].clone(),a[h]=a[h-1].clone(),s.crossVectors(n[h-1],n[h]),s.length()>Number.EPSILON&&(s.normalize(),i=Math.acos(THREE.Math.clamp(n[h-1].dot(n[h]),-1,1)),o[h].applyMatrix4(c.makeRotationAxis(s,i))),a[h].crossVectors(n[h],o[h]);if(r)for(i=Math.acos(THREE.Math.clamp(o[0].dot(o[t-1]),-1,1)),i/=t-1,0<n[0].dot(s.crossVectors(o[0],o[t-1]))&&(i=-i),h=1;t>h;h++)o[h].applyMatrix4(c.makeRotationAxis(n[h],i*h)),a[h].crossVectors(n[h],o[h])},THREE.PolyhedronGeometry=function(e,t,r,i){function n(e){var t=e.normalize().clone();t.index=c.vertices.push(t)-1;var r=Math.atan2(e.z,-e.x)/2/Math.PI+.5;return e=Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5,t.uv=new THREE.Vector2(r,1-e),t}function o(e,t,r,i){i=new THREE.Face3(e.index,t.index,r.index,[e.clone(),t.clone(),r.clone()],void 0,i),c.faces.push(i),m.copy(e).add(t).add(r).divideScalar(3),i=Math.atan2(m.z,-m.x),c.faceVertexUvs[0].push([s(e.uv,e,i),s(t.uv,t,i),s(r.uv,r,i)])}function a(e,t){for(var r=Math.pow(2,t),i=n(c.vertices[e.a]),a=n(c.vertices[e.b]),s=n(c.vertices[e.c]),h=[],l=e.materialIndex,u=0;r>=u;u++){h[u]=[];for(var p=n(i.clone().lerp(s,u/r)),d=n(a.clone().lerp(s,u/r)),E=r-u,f=0;E>=f;f++)h[u][f]=0===f&&u===r?p:n(p.clone().lerp(d,f/E))}for(u=0;r>u;u++)for(f=0;2*(r-u)-1>f;f++)i=Math.floor(f/2),0===f%2?o(h[u][i+1],h[u+1][i],h[u][i],l):o(h[u][i+1],h[u+1][i+1],h[u+1][i],l)}function s(e,t,r){return 0>r&&1===e.x&&(e=new THREE.Vector2(e.x-1,e.y)),0===t.x&&0===t.z&&(e=new THREE.Vector2(r/2/Math.PI+.5,e.y)),e.clone()}THREE.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:i},r=r||1,i=i||0;for(var c=this,h=0,l=e.length;l>h;h+=3)n(new THREE.Vector3(e[h],e[h+1],e[h+2]));e=this.vertices;for(var u=[],p=h=0,l=t.length;l>h;h+=3,p++){var d=e[t[h]],E=e[t[h+1]],f=e[t[h+2]];u[p]=new THREE.Face3(d.index,E.index,f.index,[d.clone(),E.clone(),f.clone()],void 0,p)}for(var m=new THREE.Vector3,h=0,l=u.length;l>h;h++)a(u[h],i);for(h=0,l=this.faceVertexUvs[0].length;l>h;h++)t=this.faceVertexUvs[0][h],i=t[0].x,e=t[1].x,u=t[2].x,p=Math.max(i,e,u),d=Math.min(i,e,u),p>.9&&.1>d&&(.2>i&&(t[0].x+=1),.2>e&&(t[1].x+=1),.2>u&&(t[2].x+=1));for(h=0,l=this.vertices.length;l>h;h++)this.vertices[h].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(e,t){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],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}},THREE.DodecahedronGeometry.prototype=Object.create(THREE.PolyhedronGeometry.prototype),THREE.DodecahedronGeometry.prototype.constructor=THREE.DodecahedronGeometry,THREE.IcosahedronGeometry=function(e,t){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],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}},THREE.IcosahedronGeometry.prototype=Object.create(THREE.PolyhedronGeometry.prototype),THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry,THREE.OctahedronGeometry=function(e,t){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],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}},THREE.OctahedronGeometry.prototype=Object.create(THREE.PolyhedronGeometry.prototype),THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry,THREE.TetrahedronGeometry=function(e,t){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],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}},THREE.TetrahedronGeometry.prototype=Object.create(THREE.PolyhedronGeometry.prototype),THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry,THREE.ParametricGeometry=function(e,t,r){THREE.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:r};var i,n,o,a,s=this.vertices,c=this.faces,h=this.faceVertexUvs[0],l=t+1;for(i=0;r>=i;i++)for(a=i/r,n=0;t>=n;n++)o=n/t,o=e(o,a),s.push(o);var u,p,d,E;for(i=0;r>i;i++)for(n=0;t>n;n++)e=i*l+n,s=i*l+n+1,a=(i+1)*l+n+1,o=(i+1)*l+n,u=new THREE.Vector2(n/t,i/r),p=new THREE.Vector2((n+1)/t,i/r), d=new THREE.Vector2((n+1)/t,(i+1)/r),E=new THREE.Vector2(n/t,(i+1)/r),c.push(new THREE.Face3(e,s,o)),h.push([u,p,E]),c.push(new THREE.Face3(s,a,o)),h.push([p.clone(),d,E.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ParametricGeometry.prototype.constructor=THREE.ParametricGeometry,THREE.WireframeGeometry=function(e){function t(e,t){return e-t}THREE.BufferGeometry.call(this);var r=[0,0],i={},n=["a","b","c"];if(e instanceof THREE.Geometry){var o=e.vertices,a=e.faces,s=0,c=new Uint32Array(6*a.length);e=0;for(var h=a.length;h>e;e++)for(var l=a[e],u=0;3>u;u++){r[0]=l[n[u]],r[1]=l[n[(u+1)%3]],r.sort(t);var p=r.toString();void 0===i[p]&&(c[2*s]=r[0],c[2*s+1]=r[1],i[p]=!0,s++)}for(r=new Float32Array(6*s),e=0,h=s;h>e;e++)for(u=0;2>u;u++)i=o[c[2*e+u]],s=6*e+3*u,r[s+0]=i.x,r[s+1]=i.y,r[s+2]=i.z;this.addAttribute("position",new THREE.BufferAttribute(r,3))}else if(e instanceof THREE.BufferGeometry){if(null!==e.index){for(h=e.index.array,o=e.attributes.position,n=e.groups,s=0,0===n.length&&e.addGroup(0,h.length),c=new Uint32Array(2*h.length),a=0,l=n.length;l>a;++a){e=n[a],u=e.start,p=e.count,e=u;for(var d=u+p;d>e;e+=3)for(u=0;3>u;u++)r[0]=h[e+u],r[1]=h[e+(u+1)%3],r.sort(t),p=r.toString(),void 0===i[p]&&(c[2*s]=r[0],c[2*s+1]=r[1],i[p]=!0,s++)}for(r=new Float32Array(6*s),e=0,h=s;h>e;e++)for(u=0;2>u;u++)s=6*e+3*u,i=c[2*e+u],r[s+0]=o.getX(i),r[s+1]=o.getY(i),r[s+2]=o.getZ(i)}else for(o=e.attributes.position.array,s=o.length/3,c=s/3,r=new Float32Array(6*s),e=0,h=c;h>e;e++)for(u=0;3>u;u++)s=18*e+6*u,c=9*e+3*u,r[s+0]=o[c],r[s+1]=o[c+1],r[s+2]=o[c+2],i=9*e+(u+1)%3*3,r[s+3]=o[i],r[s+4]=o[i+1],r[s+5]=o[i+2];this.addAttribute("position",new THREE.BufferAttribute(r,3))}},THREE.WireframeGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.WireframeGeometry.prototype.constructor=THREE.WireframeGeometry,THREE.AxisHelper=function(e){e=e||1;var t=new Float32Array([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e]),r=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);e=new THREE.BufferGeometry,e.addAttribute("position",new THREE.BufferAttribute(t,3)),e.addAttribute("color",new THREE.BufferAttribute(r,3)),t=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors}),THREE.LineSegments.call(this,e,t)},THREE.AxisHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.AxisHelper.prototype.constructor=THREE.AxisHelper,THREE.ArrowHelper=function(){var e=new THREE.Geometry;e.vertices.push(new THREE.Vector3(0,0,0),new THREE.Vector3(0,1,0));var t=new THREE.CylinderGeometry(0,.5,1,5,1);return t.translate(0,-.5,0),function(r,i,n,o,a,s){THREE.Object3D.call(this),void 0===o&&(o=16776960),void 0===n&&(n=1),void 0===a&&(a=.2*n),void 0===s&&(s=.2*a),this.position.copy(i),this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:o})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new THREE.Mesh(t,new THREE.MeshBasicMaterial({color:o})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(r),this.setLength(n,a,s)}}(),THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype),THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper,THREE.ArrowHelper.prototype.setDirection=function(){var e,t=new THREE.Vector3;return function(r){.99999<r.y?this.quaternion.set(0,0,0,1):-.99999>r.y?this.quaternion.set(1,0,0,0):(t.set(r.z,0,-r.x).normalize(),e=Math.acos(r.y),this.quaternion.setFromAxisAngle(t,e))}}(),THREE.ArrowHelper.prototype.setLength=function(e,t,r){void 0===t&&(t=.2*e),void 0===r&&(r=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()},THREE.ArrowHelper.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},THREE.BoxHelper=function(e){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new THREE.BufferGeometry;i.setIndex(new THREE.BufferAttribute(t,1)),i.addAttribute("position",new THREE.BufferAttribute(r,3)),THREE.LineSegments.call(this,i,new THREE.LineBasicMaterial({color:16776960})),void 0!==e&&this.update(e)},THREE.BoxHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.BoxHelper.prototype.constructor=THREE.BoxHelper,THREE.BoxHelper.prototype.update=function(){var e=new THREE.Box3;return function(t){if(t instanceof THREE.Box3?e.copy(t):e.setFromObject(t),!e.isEmpty()){t=e.min;var r=e.max,i=this.geometry.attributes.position,n=i.array;n[0]=r.x,n[1]=r.y,n[2]=r.z,n[3]=t.x,n[4]=r.y,n[5]=r.z,n[6]=t.x,n[7]=t.y,n[8]=r.z,n[9]=r.x,n[10]=t.y,n[11]=r.z,n[12]=r.x,n[13]=r.y,n[14]=t.z,n[15]=t.x,n[16]=r.y,n[17]=t.z,n[18]=t.x,n[19]=t.y,n[20]=t.z,n[21]=r.x,n[22]=t.y,n[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),THREE.BoundingBoxHelper=function(e,t){var r=void 0!==t?t:8947848;this.object=e,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(e){function t(e,t,i){r(e,i),r(t,i)}function r(e,t){i.vertices.push(new THREE.Vector3),i.colors.push(new THREE.Color(t)),void 0===o[e]&&(o[e]=[]),o[e].push(i.vertices.length-1)}var i=new THREE.Geometry,n=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors}),o={};t("n1","n2",16755200),t("n2","n4",16755200),t("n4","n3",16755200),t("n3","n1",16755200),t("f1","f2",16755200),t("f2","f4",16755200),t("f4","f3",16755200),t("f3","f1",16755200),t("n1","f1",16755200),t("n2","f2",16755200),t("n3","f3",16755200),t("n4","f4",16755200),t("p","n1",16711680),t("p","n2",16711680),t("p","n3",16711680),t("p","n4",16711680),t("u1","u2",43775),t("u2","u3",43775),t("u3","u1",43775),t("c","t",16777215),t("p","c",3355443),t("cn1","cn2",3355443),t("cn3","cn4",3355443),t("cf1","cf2",3355443),t("cf3","cf4",3355443),THREE.LineSegments.call(this,i,n),this.camera=e,this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()},THREE.CameraHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.CameraHelper.prototype.constructor=THREE.CameraHelper,THREE.CameraHelper.prototype.update=function(){function e(e,o,a,s){if(i.set(o,a,s).unproject(n),e=r[e],void 0!==e)for(o=0,a=e.length;a>o;o++)t.vertices[e[o]].copy(i)}var t,r,i=new THREE.Vector3,n=new THREE.Camera;return function(){t=this.geometry,r=this.pointMap,n.projectionMatrix.copy(this.camera.projectionMatrix),e("c",0,0,-1),e("t",0,0,1),e("n1",-1,-1,-1),e("n2",1,-1,-1),e("n3",-1,1,-1),e("n4",1,1,-1),e("f1",-1,-1,1),e("f2",1,-1,1),e("f3",-1,1,1),e("f4",1,1,1),e("u1",.7,1.1,-1),e("u2",-.7,1.1,-1),e("u3",0,2,-1),e("cf1",-1,0,1),e("cf2",1,0,1),e("cf3",0,-1,1),e("cf4",0,1,1),e("cn1",-1,0,-1),e("cn2",1,0,-1),e("cn3",0,-1,-1),e("cn4",0,1,-1),t.verticesNeedUpdate=!0}}(),THREE.DirectionalLightHelper=function(e,t){THREE.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,t=t||1;var r=new THREE.Geometry;r.vertices.push(new THREE.Vector3(-t,t,0),new THREE.Vector3(t,t,0),new THREE.Vector3(t,-t,0),new THREE.Vector3(-t,-t,0),new THREE.Vector3(-t,t,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,r.vertices.push(new THREE.Vector3,new THREE.Vector3),i=new THREE.LineBasicMaterial({fog:!1}),i.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 e=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3;return function(){e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),r.subVectors(t,e),this.lightPlane.lookAt(r),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(r),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),THREE.EdgesHelper=function(e,t,r){t=void 0!==t?t:16777215,THREE.LineSegments.call(this,new THREE.EdgesGeometry(e.geometry,r),new THREE.LineBasicMaterial({color:t})),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},THREE.EdgesHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.EdgesHelper.prototype.constructor=THREE.EdgesHelper,THREE.FaceNormalsHelper=function(e,t,r,i){this.object=e,this.size=void 0!==t?t:1,e=void 0!==r?r:16776960,i=void 0!==i?i:1,t=0,r=this.object.geometry,r instanceof THREE.Geometry?t=r.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."),r=new THREE.BufferGeometry,t=new THREE.Float32Attribute(6*t,3),r.addAttribute("position",t),THREE.LineSegments.call(this,r,new THREE.LineBasicMaterial({color:e,linewidth:i})),this.matrixAutoUpdate=!1,this.update()},THREE.FaceNormalsHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.FaceNormalsHelper.prototype.constructor=THREE.FaceNormalsHelper,THREE.FaceNormalsHelper.prototype.update=function(){var e=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Matrix3;return function(){this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);for(var i=this.object.matrixWorld,n=this.geometry.attributes.position,o=this.object.geometry,a=o.vertices,o=o.faces,s=0,c=0,h=o.length;h>c;c++){var l=o[c],u=l.normal;e.copy(a[l.a]).add(a[l.b]).add(a[l.c]).divideScalar(3).applyMatrix4(i),t.copy(u).applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),n.setXYZ(s,e.x,e.y,e.z),s+=1,n.setXYZ(s,t.x,t.y,t.z),s+=1}return n.needsUpdate=!0,this}}(),THREE.GridHelper=function(e,t){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=-e;e>=n;n+=t){r.vertices.push(new THREE.Vector3(-e,0,n),new THREE.Vector3(e,0,n),new THREE.Vector3(n,0,-e),new THREE.Vector3(n,0,e));var o=0===n?this.color1:this.color2;r.colors.push(o,o,o,o)}THREE.LineSegments.call(this,r,i)},THREE.GridHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.GridHelper.prototype.constructor=THREE.GridHelper,THREE.GridHelper.prototype.setColors=function(e,t){this.color1.set(e),this.color2.set(t),this.geometry.colorsNeedUpdate=!0},THREE.HemisphereLightHelper=function(e,t){THREE.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new THREE.Color,new THREE.Color];var r=new THREE.SphereGeometry(t,4,2);r.rotateX(-Math.PI/2);for(var i=0;8>i;i++)r.faces[i].color=this.colors[4>i?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 e=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(e.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),THREE.PointLightHelper=function(e,t){this.light=e,this.light.updateMatrixWorld();var r=new THREE.SphereGeometry(t,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(e){this.bones=this.getBoneList(e);for(var t=new THREE.Geometry,r=0;r<this.bones.length;r++)this.bones[r].parent instanceof THREE.Bone&&(t.vertices.push(new THREE.Vector3),t.vertices.push(new THREE.Vector3),t.colors.push(new THREE.Color(0,0,1)),t.colors.push(new THREE.Color(0,1,0)));t.dynamic=!0,r=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0}),THREE.LineSegments.call(this,t,r),this.root=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.update()},THREE.SkeletonHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.SkeletonHelper.prototype.constructor=THREE.SkeletonHelper,THREE.SkeletonHelper.prototype.getBoneList=function(e){var t=[];e instanceof THREE.Bone&&t.push(e);for(var r=0;r<e.children.length;r++)t.push.apply(t,this.getBoneList(e.children[r]));return t},THREE.SkeletonHelper.prototype.update=function(){for(var e=this.geometry,t=(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(t,o.matrixWorld),e.vertices[i].setFromMatrixPosition(r),r.multiplyMatrices(t,o.parent.matrixWorld),e.vertices[i+1].setFromMatrixPosition(r),i+=2)}e.verticesNeedUpdate=!0,e.computeBoundingSphere()},THREE.SpotLightHelper=function(e){THREE.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,e=new THREE.BufferGeometry;for(var t=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,i=1;32>r;r++,i++){var n=r/32*Math.PI*2,o=i/32*Math.PI*2;t.push(Math.cos(n),Math.sin(n),1,Math.cos(o),Math.sin(o),1)}e.addAttribute("position",new THREE.Float32Attribute(t,3)),t=new THREE.LineBasicMaterial({fog:!1}),this.cone=new THREE.LineSegments(e,t),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 e=new THREE.Vector3,t=new THREE.Vector3;return function(){var r=this.light.distance?this.light.distance:1e3,i=r*Math.tan(this.light.angle);this.cone.scale.set(i,i,r),e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(t.sub(e)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),THREE.VertexNormalsHelper=function(e,t,r,i){this.object=e,this.size=void 0!==t?t:1,e=void 0!==r?r:16711680,i=void 0!==i?i:1,t=0,r=this.object.geometry,r instanceof THREE.Geometry?t=3*r.faces.length:r instanceof THREE.BufferGeometry&&(t=r.attributes.normal.count),r=new THREE.BufferGeometry,t=new THREE.Float32Attribute(6*t,3),r.addAttribute("position",t),THREE.LineSegments.call(this,r,new THREE.LineBasicMaterial({color:e,linewidth:i})),this.matrixAutoUpdate=!1,this.update()},THREE.VertexNormalsHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.VertexNormalsHelper.prototype.constructor=THREE.VertexNormalsHelper,THREE.VertexNormalsHelper.prototype.update=function(){var e=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Matrix3;return function(){var i=["a","b","c"];this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);var n=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a instanceof THREE.Geometry)for(var s=a.vertices,c=a.faces,h=a=0,l=c.length;l>h;h++)for(var u=c[h],p=0,d=u.vertexNormals.length;d>p;p++){var E=u.vertexNormals[p];e.copy(s[u[i[p]]]).applyMatrix4(n),t.copy(E).applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),o.setXYZ(a,e.x,e.y,e.z),a+=1,o.setXYZ(a,t.x,t.y,t.z),a+=1}else if(a instanceof THREE.BufferGeometry)for(i=a.attributes.position,s=a.attributes.normal,p=a=0,d=i.count;d>p;p++)e.set(i.getX(p),i.getY(p),i.getZ(p)).applyMatrix4(n),t.set(s.getX(p),s.getY(p),s.getZ(p)),t.applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),o.setXYZ(a,e.x,e.y,e.z),a+=1,o.setXYZ(a,t.x,t.y,t.z),a+=1;return o.needsUpdate=!0,this}}(),THREE.WireframeHelper=function(e,t){var r=void 0!==t?t:16777215;THREE.LineSegments.call(this,new THREE.WireframeGeometry(e.geometry),new THREE.LineBasicMaterial({color:r})),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},THREE.WireframeHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.WireframeHelper.prototype.constructor=THREE.WireframeHelper,THREE.ImmediateRenderObject=function(e){THREE.Object3D.call(this),this.material=e,this.render=function(e){}},THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype),THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject,THREE.MorphBlendMesh=function(e,t){THREE.Mesh.call(this,e,t),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(e,t,r,i){t={start:t,end:r,length:r-t+1,fps:i,duration:(r-t)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1},this.animationsMap[e]=t,this.animationsList.push(t)},THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(e){for(var t,r=/([a-z]+)_?(\d+)/i,i={},n=this.geometry,o=0,a=n.morphTargets.length;a>o;o++){var s=n.morphTargets[o].name.match(r);if(s&&1<s.length){var c=s[1];i[c]||(i[c]={start:1/0,end:-(1/0)}),s=i[c],o<s.start&&(s.start=o),o>s.end&&(s.end=o),t||(t=c)}}for(c in i)s=i[c],this.createAnimation(c,s.start,s.end,e);this.firstAnimation=t},THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(e){(e=this.animationsMap[e])&&(e.direction=1,e.directionBackwards=!1)},THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(e){(e=this.animationsMap[e])&&(e.direction=-1,e.directionBackwards=!0)},THREE.MorphBlendMesh.prototype.setAnimationFPS=function(e,t){var r=this.animationsMap[e];r&&(r.fps=t,r.duration=(r.end-r.start)/r.fps)},THREE.MorphBlendMesh.prototype.setAnimationDuration=function(e,t){var r=this.animationsMap[e];r&&(r.duration=t,r.fps=(r.end-r.start)/r.duration)},THREE.MorphBlendMesh.prototype.setAnimationWeight=function(e,t){var r=this.animationsMap[e];r&&(r.weight=t)},THREE.MorphBlendMesh.prototype.setAnimationTime=function(e,t){var r=this.animationsMap[e];r&&(r.time=t)},THREE.MorphBlendMesh.prototype.getAnimationTime=function(e){var t=0;return(e=this.animationsMap[e])&&(t=e.time),t},THREE.MorphBlendMesh.prototype.getAnimationDuration=function(e){var t=-1;return(e=this.animationsMap[e])&&(t=e.duration),t},THREE.MorphBlendMesh.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},THREE.MorphBlendMesh.prototype.stopAnimation=function(e){(e=this.animationsMap[e])&&(e.active=!1)},THREE.MorphBlendMesh.prototype.update=function(e){for(var t=0,r=this.animationsList.length;r>t;t++){var i=this.animationsList[t];if(i.active){var n=i.duration/i.length;i.time+=i.direction*e,i.mirroredLoop?(i.time>i.duration||0>i.time)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),0>i.time&&(i.time=0,i.directionBackwards=!1)):(i.time%=i.duration,0>i.time&&(i.time+=i.duration));var o=i.start+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),i.currentFrame!==i.lastFrame?(this.morphTargetInfluences[i.currentFrame]=n*a,this.morphTargetInfluences[i.lastFrame]=(1-n)*a):this.morphTargetInfluences[i.currentFrame]=a}}}; function init(){renderer=new THREE.WebGLRenderer,renderer.setSize(window.innerWidth,window.innerHeight),renderer.autoClear=!1,renderer.setClearColor(0,1),document.getElementById("canvas").appendChild(renderer.domElement),scene=new THREE.Scene,scene.fog=new THREE.Fog(0,1,1e3),camera=new THREE.PerspectiveCamera(75,window.innerWidth/window.innerHeight,1,1e3),camera.position.z=400,scene.add(camera),object=new THREE.Object3D,circle=new THREE.Object3D,skelet=new THREE.Object3D,particle=new THREE.Object3D,scene.add(object),scene.add(circle),scene.add(skelet),scene.add(particle);for(var e=new THREE.TetrahedronGeometry(2,0),n=new THREE.TetrahedronGeometry(2,2),a=new THREE.MeshPhongMaterial({color:3487029,shading:THREE.FlatShading}),r=new THREE.MeshPhongMaterial({color:1118481,shading:THREE.FlatShading}),t=0;50>t;t++){var o=new THREE.Mesh(e,a);o.position.set(Math.random()-.5,Math.random()-.5,Math.random()-.5).normalize(),o.position.multiplyScalar(700*Math.random()),o.rotation.set(2*Math.random(),2*Math.random(),2*Math.random()),o.scale.x=o.scale.y=o.scale.z=15,object.add(o)}for(var t=0;1e3>t;t++){var o=new THREE.Mesh(n,r);o.position.set(Math.random()-.5,Math.random()-.5,Math.random()-.5).normalize(),o.position.multiplyScalar(700*Math.random()),o.rotation.set(2*Math.random(),2*Math.random(),2*Math.random()),particle.add(o)}var i=new THREE.IcosahedronGeometry(7,1),d=new THREE.IcosahedronGeometry(15,1),c=new THREE.MeshPhongMaterial({color:16777215,shading:THREE.FlatShading}),s=new THREE.MeshPhongMaterial({color:5592405,wireframe:!0,side:THREE.DoubleSide}),l=new THREE.Mesh(i,c);l.scale.x=l.scale.y=l.scale.z=12,circle.add(l);var E=new THREE.Mesh(d,s);E.scale.x=E.scale.y=E.scale.z=8,skelet.add(E);var h=new THREE.AmbientLight(3487029);scene.add(h);var w=new THREE.DirectionalLight(16777215);w.position.set(1,1,1).normalize(),scene.add(w),window.addEventListener("resize",onWindowResize,!1)}function onWindowResize(){camera.aspect=window.innerWidth/window.innerHeight,camera.updateProjectionMatrix(),renderer.setSize(window.innerWidth,window.innerHeight),composer.setSize(window.innerWidth,window.innerHeight)}function animate(){requestAnimationFrame(animate),object.rotation.x+=.003,object.rotation.y+=.003,particle.rotation.x+=0,particle.rotation.y-=.004,circle.rotation.x-=.002,circle.rotation.y-=.002,skelet.rotation.x-=.001,skelet.rotation.y+=.001,renderer.clear(),renderer.render(scene,camera)}var renderer,scene,camera,composer,object,circle,skelet,particle;window.onload=function(){init(),animate()};
Expand for more options Login