three.min.js 398 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. // three.js - http://github.com/mrdoob/three.js
  2. 'use strict';var THREE=THREE||{REVISION:"57dev"};self.console=self.console||{info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}};self.Int32Array=self.Int32Array||Array;self.Float32Array=self.Float32Array||Array;String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};
  3. THREE.extend=function(a,b){if(Object.keys)for(var c=Object.keys(b),d=0,e=c.length;d<e;d++){var f=c[d];Object.defineProperty(a,f,Object.getOwnPropertyDescriptor(b,f))}else for(f in c={}.hasOwnProperty,b)c.call(b,f)&&(a[f]=b[f]);return a};
  4. (function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];void 0===window.requestAnimationFrame&&(window.requestAnimationFrame=function(b){var c=Date.now(),f=Math.max(0,16-(c-a)),g=window.setTimeout(function(){b(c+f)},f);a=c+f;return g});window.cancelAnimationFrame=window.cancelAnimationFrame||
  5. function(a){window.clearTimeout(a)}})();THREE.CullFaceNone=0;THREE.CullFaceBack=1;THREE.CullFaceFront=2;THREE.CullFaceFrontBack=3;THREE.FrontFaceDirectionCW=0;THREE.FrontFaceDirectionCCW=1;THREE.BasicShadowMap=0;THREE.PCFShadowMap=1;THREE.PCFSoftShadowMap=2;THREE.FrontSide=0;THREE.BackSide=1;THREE.DoubleSide=2;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;
  6. THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.CustomBlending=5;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;THREE.SrcAlphaSaturateFactor=210;THREE.MultiplyOperation=0;
  7. THREE.MixOperation=1;THREE.AddOperation=2;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.RepeatWrapping=1E3;THREE.ClampToEdgeWrapping=1001;THREE.MirroredRepeatWrapping=1002;THREE.NearestFilter=1003;THREE.NearestMipMapNearestFilter=1004;THREE.NearestMipMapLinearFilter=1005;THREE.LinearFilter=1006;THREE.LinearMipMapNearestFilter=1007;
  8. 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.UnsignedShort4444Type=1016;THREE.UnsignedShort5551Type=1017;THREE.UnsignedShort565Type=1018;THREE.AlphaFormat=1019;THREE.RGBFormat=1020;THREE.RGBAFormat=1021;THREE.LuminanceFormat=1022;THREE.LuminanceAlphaFormat=1023;THREE.RGB_S3TC_DXT1_Format=2001;THREE.RGBA_S3TC_DXT1_Format=2002;
  9. THREE.RGBA_S3TC_DXT3_Format=2003;THREE.RGBA_S3TC_DXT5_Format=2004;THREE.Color=function(a){void 0!==a&&this.set(a);return this};
  10. THREE.extend(THREE.Color.prototype,{r:1,g:1,b:1,set:function(a){switch(typeof a){case "number":this.setHex(a);break;case "string":this.setStyle(a)}},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){console.log("DEPRECATED: Color's .setHSV() will be removed. Use .setHSL( h, s, l ) instead.");return this.setHSL(a,b*c/(1>(a=(2-b)*c)?a:2-a),a/2)},setHSL:function(a,
  11. b,c){if(0===b)this.r=this.g=this.b=c;else{var d=function(a,b,c){0>c&&(c+=1);1<c&&(c-=1);return c<1/6?a+6*(b-a)*c:0.5>c?b:c<2/3?a+6*(b-a)*(2/3-c):a},b=0.5>=c?c*(1+b):c+b-c*b,c=2*c-b;this.r=d(c,b,a+1/3);this.g=d(c,b,a);this.b=d(c,b,a-1/3)}return this},setStyle:function(a){if(/^rgb\((\d+),(\d+),(\d+)\)$/i.test(a))return a=/^rgb\((\d+),(\d+),(\d+)\)$/i.exec(a),this.r=Math.min(255,parseInt(a[1],10))/255,this.g=Math.min(255,parseInt(a[2],10))/255,this.b=Math.min(255,parseInt(a[3],10))/255,this;if(/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.test(a))return a=
  12. /^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.exec(a),this.r=Math.min(100,parseInt(a[1],10))/100,this.g=Math.min(100,parseInt(a[2],10))/100,this.b=Math.min(100,parseInt(a[3],10))/100,this;if(/^\#([0-9a-f]{6})$/i.test(a))return a=/^\#([0-9a-f]{6})$/i.exec(a),this.setHex(parseInt(a[1],16)),this;if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(a))return a=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(a),this.setHex(parseInt(a[1]+a[1]+a[2]+a[2]+a[3]+a[3],16)),this;if(/^(\w+)$/i.test(a))return this.setHex(THREE.ColorKeywords[a]),
  13. this},copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);this.b=Math.sqrt(this.b);return this},getHex:function(){return 255*
  14. this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(){var a={h:0,s:0,l:0};return function(){var b=this.r,c=this.g,d=this.b,e=Math.max(b,c,d),f=Math.min(b,c,d),g,i=(f+e)/2;if(f===e)f=g=0;else{var h=e-f,f=0.5>=i?h/(e+f):h/(2-e-f);switch(e){case b:g=(c-d)/h+(c<d?6:0);break;case c:g=(d-b)/h+2;break;case d:g=(b-c)/h+4}g/=6}a.h=g;a.s=f;a.l=i;return a}}(),getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+
  15. ","+(255*this.b|0)+")"},offsetHSL:function(a,b,c){var d=this.getHSL();d.h+=a;d.s+=b;d.l+=c;this.setHSL(d.h,d.s,d.l);return this},add:function(a){this.r+=a.r;this.g+=a.g;this.b+=a.b;return this},addColors:function(a,b){this.r=a.r+b.r;this.g=a.g+b.g;this.b=a.b+b.b;return this},addScalar:function(a){this.r+=a;this.g+=a;this.b+=a;return this},multiply:function(a){this.r*=a.r;this.g*=a.g;this.b*=a.b;return this},multiplyScalar:function(a){this.r*=a;this.g*=a;this.b*=a;return this},lerp:function(a,b){this.r+=
  16. (a.r-this.r)*b;this.g+=(a.g-this.g)*b;this.b+=(a.b-this.b)*b;return this},equals:function(a){return a.r===this.r&&a.g===this.g&&a.b===this.b},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}});
  17. 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,
  18. 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,
  19. 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,
  20. 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,
  21. 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,
  22. tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
  23. THREE.extend(THREE.Quaternion.prototype,{set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),g=Math.sin(a.y/2),i=Math.sin(a.z/2);void 0===b||"XYZ"===b?(this.x=f*d*e+c*g*i,this.y=c*g*e-f*d*i,this.z=c*d*i+f*g*e,this.w=c*d*e-f*g*i):"YXZ"===b?(this.x=f*d*e+c*g*i,this.y=c*g*e-f*d*i,this.z=c*d*i-f*g*e,this.w=c*
  24. d*e+f*g*i):"ZXY"===b?(this.x=f*d*e-c*g*i,this.y=c*g*e+f*d*i,this.z=c*d*i+f*g*e,this.w=c*d*e-f*g*i):"ZYX"===b?(this.x=f*d*e-c*g*i,this.y=c*g*e+f*d*i,this.z=c*d*i-f*g*e,this.w=c*d*e+f*g*i):"YZX"===b?(this.x=f*d*e+c*g*i,this.y=c*g*e+f*d*i,this.z=c*d*i-f*g*e,this.w=c*d*e-f*g*i):"XZY"===b&&(this.x=f*d*e-c*g*i,this.y=c*g*e-f*d*i,this.z=c*d*i+f*g*e,this.w=c*d*e+f*g*i);return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},
  25. setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],i=b[2],h=b[6],b=b[10],j=c+f+b;0<j?(c=0.5/Math.sqrt(j+1),this.w=0.25/c,this.x=(h-g)*c,this.y=(d-i)*c,this.z=(e-a)*c):c>f&&c>b?(c=2*Math.sqrt(1+c-f-b),this.w=(h-g)/c,this.x=0.25*c,this.y=(a+e)/c,this.z=(d+i)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this.w=(d-i)/c,this.x=(a+e)/c,this.y=0.25*c,this.z=(g+h)/c):(c=2*Math.sqrt(1+b-c-f),this.w=(e-a)/c,this.x=(d+i)/c,this.y=(g+h)/c,this.z=0.25*c);return this},inverse:function(){this.conjugate().normalize();
  26. return this},conjugate:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},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 a=this.length();0===a?(this.z=this.y=this.x=0,this.w=1):(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Quaternion's .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),
  27. this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},multiplyQuaternions:function(a,b){var c=a.x,d=a.y,e=a.z,f=a.w,g=b.x,i=b.y,h=b.z,j=b.w;this.x=c*j+f*g+d*h-e*i;this.y=d*j+f*i+e*g-c*h;this.z=e*j+f*h+c*i-d*g;this.w=f*j-c*g-d*i-e*h;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Quaternion's .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return a.applyQuaternion(this)},slerp:function(a,b){var c=this.x,d=this.y,e=this.z,
  28. f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;0>g?(this.w=-a.w,this.x=-a.x,this.y=-a.y,this.z=-a.z,g=-g):this.copy(a);if(1<=g)return this.w=f,this.x=c,this.y=d,this.z=e,this;var i=Math.acos(g),h=Math.sqrt(1-g*g);if(0.001>Math.abs(h))return this.w=0.5*(f+this.w),this.x=0.5*(c+this.x),this.y=0.5*(d+this.y),this.z=0.5*(e+this.z),this;g=Math.sin((1-b)*i)/h;i=Math.sin(b*i)/h;this.w=f*g+this.w*i;this.x=c*g+this.x*i;this.y=d*g+this.y*i;this.z=e*g+this.z*i;return this},equals:function(a){return a.x===this.x&&a.y===
  29. this.y&&a.z===this.z&&a.w===this.w},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}});THREE.Quaternion.slerp=function(a,b,c,d){return c.copy(a).slerp(b,d)};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
  30. THREE.extend(THREE.Vector2.prototype,{set:function(a,b){this.x=a;this.y=b;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){if(void 0!==
  31. b)return console.warn("DEPRECATED: Vector2's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector2's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},
  32. subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divideScalar:function(a){0!==a?(this.x/=a,this.y/=a):this.set(0,0);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);return this},negate:function(){return this.multiplyScalar(-1)},
  33. dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*
  34. b;this.y+=(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},toArray:function(){return[this.x,this.y]},clone:function(){return new THREE.Vector2(this.x,this.y)}});THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
  35. THREE.extend(THREE.Vector3.prototype,{set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+
  36. a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
  37. this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},multiplyVectors:function(a,b){this.x=a.x*
  38. b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12];this.y=a[1]*b+a[5]*c+a[9]*d+a[13];this.z=a[2]*b+a[6]*c+a[10]*d+a[14];return this},applyProjection:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements,e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);
  39. this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z,a=a.w,i=a*b+f*d-g*c,h=a*c+g*b-e*d,j=a*d+e*c-f*b,b=-e*b-f*c-g*d;this.x=i*a+b*-e+h*-g-j*-f;this.y=h*a+b*-f+j*-e-i*-g;this.z=j*a+b*-g+i*-f-h*-e;return this},applyEuler:function(){var a=new THREE.Quaternion;return function(b,c){var d=a.setFromEuler(b,c);this.applyQuaternion(d);return this}}(),applyAxisAngle:function(){var a=
  40. new THREE.Quaternion;return function(b,c){var d=a.setFromAxisAngle(b,c);this.applyQuaternion(d);return this}}(),transformDirection:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;this.normalize();return this},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){0!==a?(this.x/=a,this.y/=a,this.z/=a):this.z=this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=
  41. a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*
  42. 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(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},cross:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),
  43. this.crossVectors(a,b);var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},crossVectors:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},projectOnVector:function(){var a=new THREE.Vector3;return function(b){a.copy(b).normalize();b=this.dot(a);return this.copy(a).multiplyScalar(b)}}(),projectOnPlane:function(){var a=new THREE.Vector3;return function(b){a.copy(this).projectOnVector(b);return this.sub(a)}}(),
  44. reflect:function(){var a=new THREE.Vector3;return function(b){a.copy(this).projectOnVector(b).multiplyScalar(2);return this.subVectors(a,this)}}(),angleTo:function(a){a=this.dot(a)/(this.length()*a.length());return Math.acos(THREE.Math.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y,a=this.z-a.z;return b*b+c*c+a*a},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}
  45. var d=a.elements,e=d[0],f=d[4],g=d[8],i=d[1],h=d[5],j=d[9],k=d[2],n=d[6],d=d[10];void 0===b||"XYZ"===b?(this.y=Math.asin(c(g)),0.99999>Math.abs(g)?(this.x=Math.atan2(-j,d),this.z=Math.atan2(-f,e)):(this.x=Math.atan2(n,h),this.z=0)):"YXZ"===b?(this.x=Math.asin(-c(j)),0.99999>Math.abs(j)?(this.y=Math.atan2(g,d),this.z=Math.atan2(i,h)):(this.y=Math.atan2(-k,e),this.z=0)):"ZXY"===b?(this.x=Math.asin(c(n)),0.99999>Math.abs(n)?(this.y=Math.atan2(-k,d),this.z=Math.atan2(-f,h)):(this.y=0,this.z=Math.atan2(i,
  46. e))):"ZYX"===b?(this.y=Math.asin(-c(k)),0.99999>Math.abs(k)?(this.x=Math.atan2(n,d),this.z=Math.atan2(i,e)):(this.x=0,this.z=Math.atan2(-f,h))):"YZX"===b?(this.z=Math.asin(c(i)),0.99999>Math.abs(i)?(this.x=Math.atan2(-j,h),this.y=Math.atan2(-k,e)):(this.x=0,this.y=Math.atan2(g,d))):"XZY"===b&&(this.z=Math.asin(-c(f)),0.99999>Math.abs(f)?(this.x=Math.atan2(n,h),this.y=Math.atan2(g,e)):(this.x=Math.atan2(-j,d),this.y=0));return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,
  47. -1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w;void 0===b||"XYZ"===b?(this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-e+f),this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w))),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-e-f)):"YXZ"===b?(this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z))),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-e+f),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+e-f)):"ZXY"===b?(this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z))),this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-e+f),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+e-f)):
  48. "ZYX"===b?(this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-e+f),this.y=Math.asin(c(2*(a.y*a.w-a.x*a.z))),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-e-f)):"YZX"===b?(this.x=Math.atan2(2*(a.x*a.w-a.z*a.y),g-d+e-f),this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-e-f),this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))):"XZY"===b&&(this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+e-f),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-e-f),this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y))));return this},getPositionFromMatrix:function(a){this.x=a.elements[12];
  49. this.y=a.elements[13];this.z=a.elements[14];return this},getScaleFromMatrix:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a;return this},getColumnFromMatrix:function(a,b){var c=4*a,d=b.elements;this.x=d[c];this.y=d[c+1];this.z=d[c+2];return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},toArray:function(){return[this.x,
  50. this.y,this.z]},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}});THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
  51. THREE.extend(THREE.Vector4.prototype,{set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;
  52. case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector4's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a,
  53. b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector4's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},applyMatrix4:function(a){var b=
  54. this.x,c=this.y,d=this.z,e=this.w,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){0!==a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},
  55. setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],i=a[5],h=a[9];c=a[2];b=a[6];var j=a[10];if(0.01>Math.abs(d-g)&&0.01>Math.abs(f-c)&&0.01>Math.abs(h-b)){if(0.1>Math.abs(d+g)&&0.1>Math.abs(f+c)&&0.1>Math.abs(h+b)&&0.1>Math.abs(e+i+j-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;i=(i+1)/2;j=(j+1)/2;d=(d+g)/4;f=(f+c)/4;h=(h+b)/4;e>i&&e>j?0.01>e?(b=0,d=c=0.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):i>j?0.01>i?(b=0.707106781,c=0,d=0.707106781):(c=Math.sqrt(i),
  56. b=d/c,d=h/c):0.01>j?(c=b=0.707106781,d=0):(d=Math.sqrt(j),b=f/d,c=h/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-h)*(b-h)+(f-c)*(f-c)+(g-d)*(g-d));0.001>Math.abs(a)&&(a=1);this.x=(b-h)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+i+j-1)/2);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);this.w<a.w&&(this.w=
  57. a.w);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);this.w<a.w?this.w=a.w:this.w>b.w&&(this.w=b.w);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.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+
  58. 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(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},toArray:function(){return[this.x,
  59. this.y,this.z,this.w]},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}});THREE.Box2=function(a,b){this.min=void 0!==a?a:new THREE.Vector2(Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector2(-Infinity,-Infinity)};
  60. THREE.extend(THREE.Box2.prototype,{set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){if(0<a.length){var b=a[0];this.min.copy(b);this.max.copy(b);for(var c=1,d=a.length;c<d;c++)b=a[c],b.x<this.min.x?this.min.x=b.x:b.x>this.max.x&&(this.max.x=b.x),b.y<this.min.y?this.min.y=b.y:b.y>this.max.y&&(this.max.y=b.y)}else this.makeEmpty();return this},setFromCenterAndSize:function(){var a=new THREE.Vector2;return function(b,c){var d=a.copy(c).multiplyScalar(0.5);this.min.copy(b).sub(d);
  61. this.max.copy(b).add(d);return this}}(),copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function(){this.min.x=this.min.y=Infinity;this.max.x=this.max.y=-Infinity;return this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(a){return(a||new THREE.Vector2).addVectors(this.min,this.max).multiplyScalar(0.5)},size:function(a){return(a||new THREE.Vector2).subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);
  62. return this},expandByVector:function(a){this.min.sub(a);this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y?!0:!1},getParameter:function(a){return new THREE.Vector2((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/
  63. (this.max.y-this.min.y))},isIntersectionBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector2).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector2;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);
  64. return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box2).copy(this)}});THREE.Box3=function(a,b){this.min=void 0!==a?a:new THREE.Vector3(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector3(-Infinity,-Infinity,-Infinity)};
  65. THREE.extend(THREE.Box3.prototype,{set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){if(0<a.length){var b=a[0];this.min.copy(b);this.max.copy(b);for(var c=1,d=a.length;c<d;c++)b=a[c],b.x<this.min.x?this.min.x=b.x:b.x>this.max.x&&(this.max.x=b.x),b.y<this.min.y?this.min.y=b.y:b.y>this.max.y&&(this.max.y=b.y),b.z<this.min.z?this.min.z=b.z:b.z>this.max.z&&(this.max.z=b.z)}else this.makeEmpty();return this},setFromCenterAndSize:function(){var a=new THREE.Vector3;
  66. return function(b,c){var d=a.copy(c).multiplyScalar(0.5);this.min.copy(b).sub(d);this.max.copy(b).add(d);return this}}(),copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function(){this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(a){return(a||new THREE.Vector3).addVectors(this.min,this.max).multiplyScalar(0.5)},
  67. size:function(a){return(a||new THREE.Vector3).subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y||a.z<this.min.z||a.z>this.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=
  68. this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z?!0:!1},getParameter:function(a){return new THREE.Vector3((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y||a.max.z<this.min.z||a.min.z>this.max.z?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector3).copy(a).clamp(this.min,
  69. this.max)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new THREE.Vector3;return function(b){b=b||new THREE.Sphere;b.center=this.center();b.radius=0.5*this.size(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new THREE.Vector3,
  70. new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(b){a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,
  71. this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.makeEmpty();this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box3).copy(this)}});THREE.Matrix3=function(a,b,c,d,e,f,g,i,h){this.elements=new Float32Array(9);this.set(void 0!==a?a:1,b||0,c||0,d||0,void 0!==e?e:1,f||0,g||0,i||0,void 0!==h?h:1)};
  72. THREE.extend(THREE.Matrix3.prototype,{set:function(a,b,c,d,e,f,g,i,h){var j=this.elements;j[0]=a;j[3]=b;j[6]=c;j[1]=d;j[4]=e;j[7]=f;j[2]=g;j[5]=i;j[8]=h;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix3's .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)},multiplyVector3Array:function(){var a=
  73. new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix3(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],i=a[6],h=a[7],a=a[8];return b*f*a-b*g*h-c*e*a+c*g*i+d*e*h-d*f*i},getInverse:function(a,b){var c=a.elements,d=this.elements;
  74. d[0]=c[10]*c[5]-c[6]*c[9];d[1]=-c[10]*c[1]+c[2]*c[9];d[2]=c[6]*c[1]-c[2]*c[5];d[3]=-c[10]*c[4]+c[6]*c[8];d[4]=c[10]*c[0]-c[2]*c[8];d[5]=-c[6]*c[0]+c[2]*c[4];d[6]=c[9]*c[4]-c[5]*c[8];d[7]=-c[9]*c[0]+c[1]*c[8];d[8]=c[5]*c[0]-c[1]*c[4];c=c[0]*d[0]+c[1]*d[3]+c[2]*d[6];if(0===c){if(b)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},transpose:function(){var a,
  75. b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}});THREE.Matrix4=function(a,b,c,d,e,f,g,i,h,j,k,n,m,r,v,p){var q=this.elements=new Float32Array(16);q[0]=void 0!==a?a:1;q[4]=b||0;q[8]=c||0;q[12]=d||0;q[1]=e||0;q[5]=void 0!==f?f:1;q[9]=g||0;q[13]=i||0;q[2]=h||0;q[6]=j||0;q[10]=void 0!==k?k:1;q[14]=n||0;q[3]=m||0;q[7]=r||0;q[11]=v||0;q[15]=void 0!==p?p:1};
  76. THREE.extend(THREE.Matrix4.prototype,{set:function(a,b,c,d,e,f,g,i,h,j,k,n,m,r,v,p){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=i;q[2]=h;q[6]=j;q[10]=k;q[14]=n;q[3]=m;q[7]=r;q[11]=v;q[15]=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},setRotationFromEuler:function(a,b){var c=this.elements,
  77. d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),i=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f);if(void 0===b||"XYZ"===b){var j=g*h,k=g*f,n=d*h,m=d*f;c[0]=i*h;c[4]=-i*f;c[8]=e;c[1]=k+n*e;c[5]=j-m*e;c[9]=-d*i;c[2]=m-j*e;c[6]=n+k*e;c[10]=g*i}else"YXZ"===b?(j=i*h,k=i*f,n=e*h,m=e*f,c[0]=j+m*d,c[4]=n*d-k,c[8]=g*e,c[1]=g*f,c[5]=g*h,c[9]=-d,c[2]=k*d-n,c[6]=m+j*d,c[10]=g*i):"ZXY"===b?(j=i*h,k=i*f,n=e*h,m=e*f,c[0]=j-m*d,c[4]=-g*f,c[8]=n+k*d,c[1]=k+n*d,c[5]=g*h,c[9]=m-j*d,c[2]=-g*e,c[6]=d,c[10]=g*i):
  78. "ZYX"===b?(j=g*h,k=g*f,n=d*h,m=d*f,c[0]=i*h,c[4]=n*e-k,c[8]=j*e+m,c[1]=i*f,c[5]=m*e+j,c[9]=k*e-n,c[2]=-e,c[6]=d*i,c[10]=g*i):"YZX"===b?(j=g*i,k=g*e,n=d*i,m=d*e,c[0]=i*h,c[4]=m-j*f,c[8]=n*f+k,c[1]=f,c[5]=g*h,c[9]=-d*h,c[2]=-e*h,c[6]=k*f+n,c[10]=j-m*f):"XZY"===b&&(j=g*i,k=g*e,n=d*i,m=d*e,c[0]=i*h,c[4]=-f,c[8]=e*h,c[1]=j*f+m,c[5]=g*h,c[9]=k*f-n,c[2]=n*f-k,c[6]=d*h,c[10]=m*f+j);return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,i=d+d,h=e+e,a=c*g,j=c*i,
  79. c=c*h,k=d*i,d=d*h,e=e*h,g=f*g,i=f*i,f=f*h;b[0]=1-(k+e);b[4]=j-f;b[8]=c+i;b[1]=j+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-i;b[6]=d+g;b[10]=1-(a+k);return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var g=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;
  80. g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],i=c[8],h=c[12],j=c[1],k=c[5],n=c[9],m=c[13],r=c[2],v=c[6],p=c[10],q=c[14],x=c[3],u=c[7],z=c[11],c=c[15],y=d[0],t=d[4],C=d[8],E=d[12],l=d[1],I=d[5],J=d[9],
  81. B=d[13],P=d[2],A=d[6],G=d[10],D=d[14],H=d[3],s=d[7],F=d[11],d=d[15];e[0]=f*y+g*l+i*P+h*H;e[4]=f*t+g*I+i*A+h*s;e[8]=f*C+g*J+i*G+h*F;e[12]=f*E+g*B+i*D+h*d;e[1]=j*y+k*l+n*P+m*H;e[5]=j*t+k*I+n*A+m*s;e[9]=j*C+k*J+n*G+m*F;e[13]=j*E+k*B+n*D+m*d;e[2]=r*y+v*l+p*P+q*H;e[6]=r*t+v*I+p*A+q*s;e[10]=r*C+v*J+p*G+q*F;e[14]=r*E+v*B+p*D+q*d;e[3]=x*y+u*l+z*P+c*H;e[7]=x*t+u*I+z*A+c*s;e[11]=x*C+u*J+z*G+c*F;e[15]=x*E+u*B+z*D+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,b);
  82. c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");
  83. return a.applyProjection(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyProjection(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){console.warn("DEPRECATED: Matrix4's .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");
  84. a.transformDirection(this)},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],i=a[9],h=a[13],j=a[2],k=a[6],n=a[10],m=a[14];return a[3]*(+e*i*k-d*h*k-e*g*n+c*h*n+d*g*m-c*i*m)+a[7]*(+b*i*m-b*h*n+e*f*n-d*f*m+d*h*j-e*i*j)+a[11]*
  85. (+b*h*k-b*g*m-e*f*k+c*f*m+e*g*j-c*h*j)+a[15]*(-d*g*j-b*i*k+b*g*n+d*f*k-c*f*n+c*i*j)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=
  86. b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=new THREE.Vector3;return function(){console.warn("DEPRECATED: Matrix4's .getPosition() has been removed. Use Vector3.getPositionFromMatrix( matrix ) instead.");var b=this.elements;return a.set(b[12],
  87. b[13],b[14])}}(),setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],g=d[8],i=d[12],h=d[1],j=d[5],k=d[9],n=d[13],m=d[2],r=d[6],v=d[10],p=d[14],q=d[3],x=d[7],u=d[11],z=d[15];c[0]=k*p*x-n*v*x+n*r*u-j*p*u-k*r*z+j*v*z;c[4]=i*v*x-g*p*x-i*r*u+f*p*u+g*r*z-f*v*z;c[8]=g*n*x-i*k*x+i*j*u-f*n*u-g*j*z+f*k*z;c[12]=i*k*r-g*n*r-i*j*v+f*n*v+g*j*p-f*k*p;c[1]=n*v*q-k*p*q-n*m*u+h*p*u+k*m*z-h*v*z;c[5]=g*p*q-i*v*
  88. q+i*m*u-e*p*u-g*m*z+e*v*z;c[9]=i*k*q-g*n*q-i*h*u+e*n*u+g*h*z-e*k*z;c[13]=g*n*m-i*k*m+i*h*v-e*n*v-g*h*p+e*k*p;c[2]=j*p*q-n*r*q+n*m*x-h*p*x-j*m*z+h*r*z;c[6]=i*r*q-f*p*q-i*m*x+e*p*x+f*m*z-e*r*z;c[10]=f*n*q-i*j*q+i*h*x-e*n*x-f*h*z+e*j*z;c[14]=i*j*m-f*n*m-i*h*r+e*n*r+f*h*p-e*j*p;c[3]=k*r*q-j*v*q-k*m*x+h*v*x+j*m*u-h*r*u;c[7]=f*v*q-g*r*q+g*m*x-e*v*x-f*m*u+e*r*u;c[11]=g*j*q-f*k*q-g*h*x+e*k*x+f*h*u-e*j*u;c[15]=f*k*m-g*j*m+g*h*r-e*k*r-f*h*v+e*j*v;c=d[0]*c[0]+d[1]*c[4]+d[2]*c[8]+d[3]*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");
  89. console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},compose:function(){var a=new THREE.Matrix4,b=new THREE.Matrix4;return function(c,d,e){var f=this.elements;a.identity();a.setRotationFromQuaternion(d);b.makeScale(e.x,e.y,e.z);this.multiplyMatrices(a,b);f[12]=c.x;f[13]=c.y;f[14]=c.z;return this}}(),decompose:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Matrix4;return function(e,
  90. f,g){var i=this.elements;a.set(i[0],i[1],i[2]);b.set(i[4],i[5],i[6]);c.set(i[8],i[9],i[10]);e=e instanceof THREE.Vector3?e:new THREE.Vector3;f=f instanceof THREE.Quaternion?f:new THREE.Quaternion;g=g instanceof THREE.Vector3?g:new THREE.Vector3;g.x=a.length();g.y=b.length();g.z=c.length();e.x=i[12];e.y=i[13];e.z=i[14];d.copy(this);d.elements[0]/=g.x;d.elements[1]/=g.x;d.elements[2]/=g.x;d.elements[4]/=g.y;d.elements[5]/=g.y;d.elements[6]/=g.y;d.elements[8]/=g.z;d.elements[9]/=g.z;d.elements[10]/=
  91. g.z;f.setFromRotationMatrix(d);return[e,f,g]}}(),extractPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(){var a=new THREE.Vector3;return function(b){var c=this.elements,b=b.elements,d=1/a.set(b[0],b[1],b[2]).length(),e=1/a.set(b[4],b[5],b[6]).length(),f=1/a.set(b[8],b[9],b[10]).length();c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[4]=b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8]*f;c[9]=b[9]*f;c[10]=b[10]*f;return this}}(),translate:function(a){var b=
  92. this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],i=b[9],h=b[10],j=b[11],k=Math.cos(a),a=Math.sin(a);b[4]=k*c+a*g;b[5]=k*d+a*i;b[6]=k*e+a*h;b[7]=k*f+a*j;b[8]=k*g-a*c;b[9]=k*i-a*d;b[10]=k*h-a*e;b[11]=k*j-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],i=
  93. b[9],h=b[10],j=b[11],k=Math.cos(a),a=Math.sin(a);b[0]=k*c-a*g;b[1]=k*d-a*i;b[2]=k*e-a*h;b[3]=k*f-a*j;b[8]=k*g+a*c;b[9]=k*i+a*d;b[10]=k*h+a*e;b[11]=k*j+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],i=b[5],h=b[6],j=b[7],k=Math.cos(a),a=Math.sin(a);b[0]=k*c+a*g;b[1]=k*d+a*i;b[2]=k*e+a*h;b[3]=k*f+a*j;b[4]=k*g-a*c;b[5]=k*i-a*d;b[6]=k*h-a*e;b[7]=k*j-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);
  94. if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var d=a.x,e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,i=e*e,h=f*f,j=Math.cos(b),k=Math.sin(b),n=1-j,m=d*e*n,r=d*f*n,n=e*f*n,d=d*k,v=e*k,k=f*k,f=g+(1-g)*j,g=m+k,e=r-v,m=m-k,i=i+(1-i)*j,k=n+d,r=r+v,n=n-d,h=h+(1-h)*j,j=c[0],d=c[1],v=c[2],p=c[3],q=c[4],x=c[5],u=c[6],z=c[7],y=c[8],t=c[9],C=c[10],E=c[11];c[0]=f*j+g*q+e*y;c[1]=f*d+g*x+e*t;c[2]=f*v+g*u+e*C;c[3]=f*p+g*z+e*E;c[4]=m*j+i*q+
  95. k*y;c[5]=m*d+i*x+k*t;c[6]=m*v+i*u+k*C;c[7]=m*p+i*z+k*E;c[8]=r*j+n*q+h*y;c[9]=r*d+n*x+h*t;c[10]=r*v+n*u+h*C;c[11]=r*p+n*z+h*E;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,
  96. b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,h=e*f,j=e*g;
  97. this.set(h*f+c,h*g-d*i,h*i+d*g,0,h*g+d*i,j*g+c,j*i-d*f,0,h*i-d*g,j*i+d*f,e*i*i+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(THREE.Math.degToRad(0.5*
  98. a)),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,i=b-a,h=c-d,j=f-e;g[0]=2/i;g[4]=0;g[8]=0;g[12]=-((b+a)/i);g[1]=0;g[5]=2/h;g[9]=0;g[13]=-((c+d)/h);g[2]=0;g[6]=0;g[10]=-2/j;g[14]=-((f+e)/j);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}});THREE.Ray=function(a,b){this.origin=void 0!==a?a:new THREE.Vector3;this.direction=void 0!==b?b:new THREE.Vector3};
  99. THREE.extend(THREE.Ray.prototype,{set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new THREE.Vector3).copy(this.direction).multiplyScalar(a).add(this.origin)},recast:function(){var a=new THREE.Vector3;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){var c=b||new THREE.Vector3;c.subVectors(a,this.origin);var d=
  100. c.dot(this.direction);return c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceTo(b)}}(),isIntersectionSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},isIntersectionPlane:function(a){return 0!=a.normal.dot(this.direction)||0==a.distanceToPoint(this.origin)?!0:!1},distanceToPlane:function(a){var b=
  101. a.normal.dot(this.direction);if(0==b){if(0==a.distanceToPoint(this.origin))return 0}else return-(this.origin.dot(a.normal)+a.constant)/b},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return void 0===c?void 0:this.at(c,b)},applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)},clone:function(){return(new THREE.Ray).copy(this)}});THREE.Sphere=function(a,b){this.center=void 0!==a?a:new THREE.Vector3;this.radius=void 0!==b?b:0};
  102. THREE.extend(THREE.Sphere.prototype,{set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromCenterAndPoints:function(a,b){for(var c=0,d=0,e=b.length;d<e;d++)var f=a.distanceToSquared(b[d]),c=Math.max(c,f);this.center=a;this.radius=Math.sqrt(c);return this},copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-
  103. this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);
  104. this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}});THREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]};
  105. THREE.extend(THREE.Frustum.prototype,{set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],g=c[4],i=c[5],h=c[6],j=c[7],k=c[8],n=c[9],m=c[10],r=c[11],v=c[12],p=c[13],q=c[14],c=c[15];b[0].setComponents(f-a,j-g,r-k,c-v).normalize();b[1].setComponents(f+
  106. a,j+g,r+k,c+v).normalize();b[2].setComponents(f+d,j+i,r+n,c+p).normalize();b[3].setComponents(f-d,j-i,r-n,c-p).normalize();b[4].setComponents(f-e,j-h,r-m,c-q).normalize();b[5].setComponents(f+e,j+h,r+m,c+q).normalize();return this},intersectsObject:function(){var a=new THREE.Vector3;return function(b){var c=b.matrixWorld,d=this.planes,b=-b.geometry.boundingSphere.radius*c.getMaxScaleOnAxis();a.getPositionFromMatrix(c);for(c=0;6>c;c++)if(d[c].distanceToPoint(a)<b)return!1;return!0}}(),intersectsSphere:function(a){for(var b=
  107. this.planes,c=a.center,a=-a.radius,d=0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}});THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0};
  108. THREE.extend(THREE.Plane.prototype,{set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,c);return this}}(),
  109. copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate()},orthoPoint:function(a,
  110. b){var c=this.distanceToPoint(a);return(b||new THREE.Vector3).copy(this.normal).multiplyScalar(c)},isIntersectionLine:function(a){var b=this.distanceToPoint(a.start),a=this.distanceToPoint(a.end);return 0>b&&0<a||0>a&&0<b},intersectLine:function(){var a=new THREE.Vector3;return function(b,c){var d=c||new THREE.Vector3,e=b.delta(a),f=this.normal.dot(e);if(0==f){if(0==this.distanceToPoint(b.start))return d.copy(b.start)}else return f=-(b.start.dot(this.normal)+this.constant)/f,0>f||1<f?void 0:d.copy(e).multiplyScalar(f).add(b.start)}}(),
  111. coplanarPoint:function(a){return(a||new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d){var d=d||(new THREE.Matrix3).getInverse(c).transpose(),e=a.copy(this.normal).applyMatrix3(d),f=this.coplanarPoint(b);f.applyMatrix4(c);this.setFromNormalAndCoplanarPoint(e,f);return this}}(),translate:function(a){this.constant-=a.dot(this.normal);return this},equals:function(a){return a.normal.equals(this.normal)&&
  112. a.constant==this.constant},clone:function(){return(new THREE.Plane).copy(this)}});THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},smoothstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,
  113. b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0},degToRad:function(){var a=Math.PI/180;return function(b){return b*a}}(),radToDeg:function(){var a=180/Math.PI;return function(b){return b*a}}()};THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,i,h,j,k,n,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
  114. f+2;j=this.points[c[0]];k=this.points[c[1]];n=this.points[c[2]];m=this.points[c[3]];i=g*g;h=g*i;d.x=b(j.x,k.x,n.x,m.x,g,i,h);d.y=b(j.y,k.y,n.y,m.y,g,i,h);d.z=b(j.z,k.z,n.z,m.z,g,i,h);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,i=[],h=0;i[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
  115. a/c,d=this.getPoint(b),g.copy(d),h+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=h,e=b);i[i.length]=h;return{chunks:i,total:h}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,i=[],h=new THREE.Vector3,k=this.getLength();i.push(h.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];g=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),
  116. i.push(h.copy(d).clone());i.push(h.copy(this.points[b]).clone())}this.points=i}};THREE.Triangle=function(a,b,c){this.a=void 0!==a?a:new THREE.Vector3;this.b=void 0!==b?b:new THREE.Vector3;this.c=void 0!==c?c:new THREE.Vector3};THREE.Triangle.normal=function(){var a=new THREE.Vector3;return function(b,c,d,e){e=e||new THREE.Vector3;e.subVectors(d,c);a.subVectors(b,c);e.cross(a);b=e.lengthSq();return 0<b?e.multiplyScalar(1/Math.sqrt(b)):e.set(0,0,0)}}();
  117. THREE.Triangle.barycoordFromPoint=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f,g,i){a.subVectors(g,e);b.subVectors(f,e);c.subVectors(d,e);var d=a.dot(a),e=a.dot(b),f=a.dot(c),h=b.dot(b),g=b.dot(c),j=d*h-e*e,i=i||new THREE.Vector3;if(0==j)return i.set(-2,-1,-1);j=1/j;h=(h*f-e*g)*j;d=(d*g-e*f)*j;return i.set(1-h-d,d,h)}}();
  118. THREE.Triangle.containsPoint=function(){var a=new THREE.Vector3;return function(b,c,d,e){b=THREE.Triangle.barycoordFromPoint(b,c,d,e,a);return 0<=b.x&&0<=b.y&&1>=b.x+b.y}}();
  119. THREE.extend(THREE.Triangle.prototype,{constructor:THREE.Triangle,set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},area:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return 0.5*a.cross(b).length()}}(),
  120. midpoint:function(a){return(a||new THREE.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return THREE.Triangle.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new THREE.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return THREE.Triangle.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return THREE.Triangle.containsPoint(a,this.a,this.b,this.c)},equals:function(a){return a.a.equals(this.a)&&
  121. a.b.equals(this.b)&&a.c.equals(this.c)},clone:function(){return(new THREE.Triangle).copy(this)}});THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.UV=function(a,b){console.warn("THREE.UV has been DEPRECATED. Use THREE.Vector2 instead.");return new THREE.Vector2(a,b)};THREE.Clock=function(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};
  122. THREE.extend(THREE.Clock.prototype,{start:function(){this.oldTime=this.startTime=void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now();this.running=!0},stop:function(){this.getElapsedTime();this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now(),
  123. a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}});THREE.EventDispatcher=function(){var a={};this.addEventListener=function(b,c){void 0===a[b]&&(a[b]=[]);-1===a[b].indexOf(c)&&a[b].push(c)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)};this.dispatchEvent=function(b){var c=a[b.type];if(void 0!==c){b.target=this;for(var d=0,e=c.length;d<e;d++)c[d].call(this,b)}}};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);0<this.ray.direction.lengthSq()&&this.ray.direction.normalize();this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray,d=new a.Plane,e=new a.Vector3,f=new a.Vector3,g=new a.Matrix4,i=function(a,b){return a.distance-b.distance},h=function(i,h,j){if(i instanceof a.Particle){f.getPositionFromMatrix(i.matrixWorld);h=h.ray.distanceToPoint(f);if(h>i.scale.x)return j;j.push({distance:h,point:i.position,face:null,object:i})}else if(i instanceof
  124. a.Mesh){f.getPositionFromMatrix(i.matrixWorld);b.set(f,i.geometry.boundingSphere.radius*i.matrixWorld.getMaxScaleOnAxis());if(!h.ray.isIntersectionSphere(b))return j;var r=i.geometry,v=r.vertices,p=i.material instanceof a.MeshFaceMaterial,q=!0===p?i.material.materials:null,x=i.material.side,u,z,y,t=h.precision;i.matrixRotationWorld.extractRotation(i.matrixWorld);g.getInverse(i.matrixWorld);c.copy(h.ray).applyMatrix4(g);for(var C=0,E=r.faces.length;C<E;C++){var l=r.faces[C],x=!0===p?q[l.materialIndex]:
  125. i.material;if(void 0!==x){d.setFromNormalAndCoplanarPoint(l.normal,v[l.a]);var I=c.distanceToPlane(d);if(!(Math.abs(I)<t)&&!(0>I)){x=x.side;if(x!==a.DoubleSide&&(u=c.direction.dot(d.normal),!(x===a.FrontSide?0>u:0<u)))continue;if(!(I<h.near||I>h.far)){e=c.at(I,e);if(l instanceof a.Face3){if(x=v[l.a],u=v[l.b],z=v[l.c],!a.Triangle.containsPoint(e,x,u,z))continue}else if(l instanceof a.Face4){if(x=v[l.a],u=v[l.b],z=v[l.c],y=v[l.d],!a.Triangle.containsPoint(e,x,u,y)&&!a.Triangle.containsPoint(e,u,z,y))continue}else throw Error("face type not supported");
  126. j.push({distance:I,point:h.ray.at(I),face:l,faceIndex:C,object:i})}}}}}},j=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)h(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b);0<this.ray.direction.length()&&this.ray.direction.normalize()};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&j(a,this,c);h(a,this,c);c.sort(i);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<
  127. e;d++)h(a[d],this,c),!0===b&&j(a[d],this,c);c.sort(i);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder=THREE.Object3D.defaultEulerOrder;this.scale=new THREE.Vector3(1,1,1);this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=
  128. new THREE.Quaternion;this.useQuaternion=!1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.userData={}};
  129. THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(){var a=new THREE.Matrix4;return function(b){this.matrix.multiplyMatrices(b,this.matrix);this.position.getPositionFromMatrix(this.matrix);this.scale.getScaleFromMatrix(this.matrix);a.extractRotation(this.matrix);!0===this.useQuaternion?this.quaternion.setFromRotationMatrix(a):this.rotation.setEulerFromRotationMatrix(a,this.eulerOrder)}}(),translate:function(){var a=new THREE.Vector3;return function(b,c){a.copy(c);!0===this.useQuaternion?
  130. a.applyQuaternion(this.quaternion):a.applyEuler(this.rotation,this.eulerOrder);a.multiplyScalar(b);this.position.add(a);return this}}(),translateX:function(){var a=new THREE.Vector3(1,0,0);return function(b){return this.translate(b,a)}}(),translateY:function(){var a=new THREE.Vector3(0,1,0);return function(b){return this.translate(b,a)}}(),translateZ:function(){var a=new THREE.Vector3(0,0,1);return function(b){return this.translate(b,a)}}(),localToWorld:function(a){return a.applyMatrix4(this.matrixWorld)},
  131. worldToLocal:function(){var a=new THREE.Matrix4;return function(b){return b.applyMatrix4(a.getInverse(this.matrixWorld))}}(),lookAt:function(){var a=new THREE.Matrix4;return function(b){a.lookAt(b,this.position,this.up);!0===this.useQuaternion?this.quaternion.setFromRotationMatrix(a):this.rotation.setEulerFromRotationMatrix(a,this.eulerOrder)}}(),add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(a instanceof THREE.Object3D){void 0!==
  132. a.parent&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.__removeObject(a)}},traverse:function(a){a(this);for(var b=0,c=this.children.length;b<c;b++)this.children[b].traverse(a)},getChildByName:function(a,b){for(var c=
  133. 0,d=this.children.length;c<d;c++){var e=this.children[c];if(e.name===a||!0===b&&(e=e.getChildByName(a,b),void 0!==e))return e}},getDescendants:function(a){void 0===a&&(a=[]);Array.prototype.push.apply(a,this.children);for(var b=0,c=this.children.length;b<c;b++)this.children[b].getDescendants(a);return a},updateMatrix:function(){this.matrix.setPosition(this.position);!1===this.useQuaternion?this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder):this.matrix.setRotationFromQuaternion(this.quaternion);
  134. (1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)&&this.matrix.scale(this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},clone:function(a){void 0===
  135. a&&(a=new THREE.Object3D);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.rotation instanceof THREE.Vector3&&a.rotation.copy(this.rotation);a.eulerOrder=this.eulerOrder;a.scale.copy(this.scale);a.renderDepth=this.renderDepth;a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);a.matrixRotationWorld.copy(this.matrixRotationWorld);a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;
  136. a.quaternion.copy(this.quaternion);a.useQuaternion=this.useQuaternion;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;for(var b=0;b<this.children.length;b++)a.add(this.children[b].clone());return a}};THREE.Object3D.defaultEulerOrder="XYZ";THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(f===i){var a=new THREE.RenderableObject;g.push(a);i++;f++;return a}return g[f++]}function b(){if(j===n){var a=new THREE.RenderableVertex;k.push(a);n++;j++;return a}return k[j++]}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,i=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=i)return!0;if(0>e&&0>f||0>g&&0>i)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-i)):0>i&&(d=Math.min(d,g/(g-i)));if(d<
  137. c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var e,f,g=[],i=0,h,j,k=[],n=0,m,r,v=[],p=0,q,x=[],u=0,z,y,t=[],C=0,E,l,I=[],J=0,B={objects:[],sprites:[],lights:[],elements:[]},P=new THREE.Vector3,A=new THREE.Vector4,G=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),D=new THREE.Box3,H=Array(3),s=Array(4),F=new THREE.Matrix4,O=new THREE.Matrix4,K,w=new THREE.Matrix4,N=new THREE.Matrix3,R=new THREE.Matrix3,$=new THREE.Vector3,Y=new THREE.Frustum,W=new THREE.Vector4,M=new THREE.Vector4;
  138. this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);O.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(O)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);O.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(O)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,
  139. c)};this.projectScene=function(g,i,n,X){var S=!1,Z,T,aa,L,U,ba,ca,da,pa,Aa,ea,ra,wa;l=y=q=r=0;B.elements.length=0;g.updateMatrixWorld();void 0===i.parent&&i.updateMatrixWorld();F.copy(i.matrixWorldInverse.getInverse(i.matrixWorld));O.multiplyMatrices(i.projectionMatrix,F);R.getInverse(F);R.transpose();Y.setFromMatrix(O);f=0;B.objects.length=0;B.sprites.length=0;B.lights.length=0;var ka=function(b){for(var c=0,d=b.children.length;c<d;c++){var f=b.children[c];if(!1!==f.visible){if(f instanceof THREE.Light)B.lights.push(f);
  140. else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===f.frustumCulled||!0===Y.intersectsObject(f))e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(P.getPositionFromMatrix(f.matrixWorld),P.applyProjection(O),e.z=P.z),B.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(P.getPositionFromMatrix(f.matrixWorld),P.applyProjection(O),e.z=P.z),B.sprites.push(e)):(e=a(),e.object=f,null!==f.renderDepth?e.z=
  141. f.renderDepth:(P.getPositionFromMatrix(f.matrixWorld),P.applyProjection(O),e.z=P.z),B.objects.push(e));ka(f)}}};ka(g);!0===n&&B.objects.sort(c);g=0;for(n=B.objects.length;g<n;g++)if(da=B.objects[g].object,K=da.matrixWorld,j=0,da instanceof THREE.Mesh){pa=da.geometry;aa=pa.vertices;Aa=pa.faces;pa=pa.faceVertexUvs;N.getInverse(K);N.transpose();ra=da.material instanceof THREE.MeshFaceMaterial;wa=!0===ra?da.material:null;Z=0;for(T=aa.length;Z<T;Z++)h=b(),h.positionWorld.copy(aa[Z]).applyMatrix4(K),h.positionScreen.copy(h.positionWorld).applyMatrix4(O),
  142. h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.positionScreen.z/=h.positionScreen.w,h.visible=!(-1>h.positionScreen.x||1<h.positionScreen.x||-1>h.positionScreen.y||1<h.positionScreen.y||-1>h.positionScreen.z||1<h.positionScreen.z);aa=0;for(Z=Aa.length;aa<Z;aa++){T=Aa[aa];var ya=!0===ra?wa.materials[T.materialIndex]:da.material;if(void 0!==ya){ba=ya.side;if(T instanceof THREE.Face3)if(L=k[T.a],U=k[T.b],ca=k[T.c],H[0]=L.positionScreen,H[1]=U.positionScreen,H[2]=ca.positionScreen,
  143. !0===L.visible||!0===U.visible||!0===ca.visible||G.isIntersectionBox(D.setFromPoints(H)))if(S=0>(ca.positionScreen.x-L.positionScreen.x)*(U.positionScreen.y-L.positionScreen.y)-(ca.positionScreen.y-L.positionScreen.y)*(U.positionScreen.x-L.positionScreen.x),ba===THREE.DoubleSide||S===(ba===THREE.FrontSide))r===p?(ea=new THREE.RenderableFace3,v.push(ea),p++,r++,m=ea):m=v[r++],m.v1.copy(L),m.v2.copy(U),m.v3.copy(ca);else continue;else continue;else if(T instanceof THREE.Face4)if(L=k[T.a],U=k[T.b],ca=
  144. k[T.c],ea=k[T.d],s[0]=L.positionScreen,s[1]=U.positionScreen,s[2]=ca.positionScreen,s[3]=ea.positionScreen,!0===L.visible||!0===U.visible||!0===ca.visible||!0===ea.visible||G.isIntersectionBox(D.setFromPoints(s)))if(S=0>(ea.positionScreen.x-L.positionScreen.x)*(U.positionScreen.y-L.positionScreen.y)-(ea.positionScreen.y-L.positionScreen.y)*(U.positionScreen.x-L.positionScreen.x)||0>(U.positionScreen.x-ca.positionScreen.x)*(ea.positionScreen.y-ca.positionScreen.y)-(U.positionScreen.y-ca.positionScreen.y)*
  145. (ea.positionScreen.x-ca.positionScreen.x),ba===THREE.DoubleSide||S===(ba===THREE.FrontSide)){if(q===u){var Ga=new THREE.RenderableFace4;x.push(Ga);u++;q++;m=Ga}else m=x[q++];m.v1.copy(L);m.v2.copy(U);m.v3.copy(ca);m.v4.copy(ea)}else continue;else continue;m.normalModel.copy(T.normal);!1===S&&(ba===THREE.BackSide||ba===THREE.DoubleSide)&&m.normalModel.negate();m.normalModel.applyMatrix3(N).normalize();m.normalModelView.copy(m.normalModel).applyMatrix3(R);m.centroidModel.copy(T.centroid).applyMatrix4(K);
  146. ca=T.vertexNormals;L=0;for(U=ca.length;L<U;L++)ea=m.vertexNormalsModel[L],ea.copy(ca[L]),!1===S&&(ba===THREE.BackSide||ba===THREE.DoubleSide)&&ea.negate(),ea.applyMatrix3(N).normalize(),m.vertexNormalsModelView[L].copy(ea).applyMatrix3(R);m.vertexNormalsLength=ca.length;L=0;for(U=pa.length;L<U;L++)if(ea=pa[L][aa],void 0!==ea){ba=0;for(ca=ea.length;ba<ca;ba++)m.uvs[L][ba]=ea[ba]}m.color=T.color;m.material=ya;$.copy(m.centroidModel).applyProjection(O);m.z=$.z;B.elements.push(m)}}}else if(da instanceof
  147. THREE.Line){w.multiplyMatrices(O,K);aa=da.geometry.vertices;L=b();L.positionScreen.copy(aa[0]).applyMatrix4(w);Aa=da.type===THREE.LinePieces?2:1;Z=1;for(T=aa.length;Z<T;Z++)L=b(),L.positionScreen.copy(aa[Z]).applyMatrix4(w),0<(Z+1)%Aa||(U=k[j-2],W.copy(L.positionScreen),M.copy(U.positionScreen),!0===d(W,M)&&(W.multiplyScalar(1/W.w),M.multiplyScalar(1/M.w),y===C?(pa=new THREE.RenderableLine,t.push(pa),C++,y++,z=pa):z=t[y++],z.v1.positionScreen.copy(W),z.v2.positionScreen.copy(M),z.z=Math.max(W.z,M.z),
  148. z.material=da.material,B.elements.push(z)))}g=0;for(n=B.sprites.length;g<n;g++)da=B.sprites[g].object,K=da.matrixWorld,da instanceof THREE.Particle&&(A.set(K.elements[12],K.elements[13],K.elements[14],1),A.applyMatrix4(O),A.z/=A.w,0<A.z&&1>A.z&&(l===J?(S=new THREE.RenderableParticle,I.push(S),J++,l++,E=S):E=I[l++],E.object=da,E.x=A.x/A.w,E.y=A.y/A.w,E.z=A.z,E.rotation=da.rotation.z,E.scale.x=da.scale.x*Math.abs(E.x-(A.x+i.projectionMatrix.elements[0])/(A.w+i.projectionMatrix.elements[12])),E.scale.y=
  149. da.scale.y*Math.abs(E.y-(A.y+i.projectionMatrix.elements[5])/(A.w+i.projectionMatrix.elements[13])),E.material=da.material,B.elements.push(E)));!0===X&&B.elements.sort(c);return B}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
  150. THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
  151. return a}};THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=void 0!==g?g:0;this.centroid=new THREE.Vector3};
  152. THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
  153. return a}};THREE.Geometry=function(){THREE.EventDispatcher.call(this);this.id=THREE.GeometryIdCount++;this.name="";this.vertices=[];this.colors=[];this.normals=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.buffersNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=
  154. this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1};
  155. THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){for(var b=(new THREE.Matrix3).getInverse(a).transpose(),c=0,d=this.vertices.length;c<d;c++)this.vertices[c].applyMatrix4(a);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];e.normal.applyMatrix3(b).normalize();for(var f=0,g=e.vertexNormals.length;f<g;f++)e.vertexNormals[f].applyMatrix3(b).normalize();e.centroid.applyMatrix4(a)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],
  156. c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.add(this.vertices[c.a]),c.centroid.add(this.vertices[c.b]),c.centroid.add(this.vertices[c.c]),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.add(this.vertices[c.a]),c.centroid.add(this.vertices[c.b]),c.centroid.add(this.vertices[c.c]),c.centroid.add(this.vertices[c.d]),c.centroid.divideScalar(4))},computeFaceNormals:function(){for(var a=new THREE.Vector3,b=new THREE.Vector3,c=0,d=this.faces.length;c<d;c++){var e=this.faces[c],
  157. f=this.vertices[e.a],g=this.vertices[e.b];a.subVectors(this.vertices[e.c],g);b.subVectors(f,g);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){var b,c,d,e;if(void 0===this.__tmpVertices){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]:d instanceof THREE.Face4&&
  158. (d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3])}else{e=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}if(a){var f,g,i,h=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(a=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],h.subVectors(g,f),j.subVectors(a,f),h.cross(j),e[d.a].add(h),e[d.b].add(h),
  159. e[d.c].add(h)):d instanceof THREE.Face4&&(a=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],i=this.vertices[d.d],k.subVectors(i,f),j.subVectors(a,f),k.cross(j),e[d.a].add(k),e[d.b].add(k),e[d.d].add(k),n.subVectors(i,g),m.subVectors(f,g),n.cross(m),e[d.b].add(n),e[d.c].add(n),e[d.d].add(n))}else{b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].add(d.normal),e[d.b].add(d.normal),e[d.c].add(d.normal)):d instanceof THREE.Face4&&(e[d.a].add(d.normal),e[d.b].add(d.normal),
  160. e[d.c].add(d.normal),e[d.d].add(d.normal))}b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<
  161. d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=
  162. [];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,i=this.morphNormals[a].vertexNormals,h,j;c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],h=new THREE.Vector3,j=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(h),i.push(j)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=
  163. this.faces.length;c<d;c++)e=this.faces[c],h=g.faceNormals[c],j=g.vertexNormals[c],h.copy(e.normal),e instanceof THREE.Face3?(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2])):(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2]),j.d.copy(e.vertexNormals[3]))}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,
  164. d,e,f,l){i=a.vertices[b];h=a.vertices[c];j=a.vertices[d];k=g[e];n=g[f];m=g[l];r=h.x-i.x;v=j.x-i.x;p=h.y-i.y;q=j.y-i.y;x=h.z-i.z;u=j.z-i.z;z=n.x-k.x;y=m.x-k.x;t=n.y-k.y;C=m.y-k.y;E=1/(z*C-y*t);B.set((C*r-t*v)*E,(C*p-t*q)*E,(C*x-t*u)*E);P.set((z*v-y*r)*E,(z*q-y*p)*E,(z*u-y*x)*E);I[b].add(B);I[c].add(B);I[d].add(B);J[b].add(P);J[c].add(P);J[d].add(P)}var b,c,d,e,f,g,i,h,j,k,n,m,r,v,p,q,x,u,z,y,t,C,E,l,I=[],J=[],B=new THREE.Vector3,P=new THREE.Vector3,A=new THREE.Vector3,G=new THREE.Vector3,D=new THREE.Vector3;
  165. b=0;for(c=this.vertices.length;b<c;b++)I[b]=new THREE.Vector3,J[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var H=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)D.copy(f.vertexNormals[d]),e=f[H[d]],l=I[e],A.copy(l),A.sub(D.multiplyScalar(D.dot(l))).normalize(),
  166. G.crossVectors(f.vertexNormals[d],l),e=G.dot(J[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(A.x,A.y,A.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},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);
  167. this.boundingSphere.setFromCenterAndPoints(this.boundingSphere.center,this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,i,h,j;this.__tmpVertices=void 0;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];e=[];f=0;for(g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];
  168. i=[a.a,a.b,a.c];d=-1;for(h=0;3>h;h++)if(i[h]==i[(h+1)%3]){e.push(f);break}}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];i=[a.a,a.b,a.c,a.d];d=-1;for(h=0;4>h;h++)i[h]==i[(h+1)%4]&&(0<=d&&e.push(f),d=h);if(0<=d){i.splice(d,1);var k=new THREE.Face3(i[0],i[1],i[2],a.normal,a.color,a.materialIndex);i=0;for(h=this.faceVertexUvs.length;i<h;i++)(j=this.faceVertexUvs[i][f])&&j.splice(d,1);a.vertexNormals&&0<a.vertexNormals.length&&(k.vertexNormals=a.vertexNormals,k.vertexNormals.splice(d,
  169. 1));a.vertexColors&&0<a.vertexColors.length&&(k.vertexColors=a.vertexColors,k.vertexColors.splice(d,1));this.faces[f]=k}}for(f=e.length-1;0<=f;f--){this.faces.splice(f,1);i=0;for(h=this.faceVertexUvs.length;i<h;i++)this.faceVertexUvs[i].splice(f,1)}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];
  170. c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],g=0,i=e.length;g<i;g++)f.push(new THREE.Vector2(e[g].x,e[g].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.GeometryIdCount=0;THREE.BufferGeometry=function(){THREE.EventDispatcher.call(this);this.id=THREE.GeometryIdCount++;this.attributes={};this.dynamic=!1;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[]};
  171. THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),this.verticesNeedUpdate=!0);void 0!==c&&(b=new THREE.Matrix3,b.getInverse(a).transpose(),b.multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);
  172. var a=this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var f=3,g=a.length;f<g;f+=3)c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z?b.min.z=e:e>b.max.z&&(b.max.z=e)}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=
  173. new THREE.Sphere);var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f+=3)b=a[f],d=a[f+1],e=a[f+2],b=b*b+d*d+e*e,b>c&&(c=b);this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position){var a,b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=
  174. 0}var e=this.attributes.position.array,f=this.attributes.normal.array,g,i,h,j,k,n,m=new THREE.Vector3,r=new THREE.Vector3,v=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3;if(this.attributes.index){var x=this.attributes.index.array,u=this.offsets;c=0;for(d=u.length;c<d;++c){b=u[c].start;g=u[c].count;var z=u[c].index;a=b;for(b+=g;a<b;a+=3)g=z+x[a],i=z+x[a+1],h=z+x[a+2],j=e[3*g],k=e[3*g+1],n=e[3*g+2],m.set(j,k,n),j=e[3*i],k=e[3*i+1],n=e[3*i+2],r.set(j,k,n),j=e[3*h],k=e[3*h+1],n=e[3*h+2],v.set(j,
  175. k,n),p.subVectors(v,r),q.subVectors(m,r),p.cross(q),f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*i]+=p.x,f[3*i+1]+=p.y,f[3*i+2]+=p.z,f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z}}else{a=0;for(b=e.length;a<b;a+=9)j=e[a],k=e[a+1],n=e[a+2],m.set(j,k,n),j=e[a+3],k=e[a+4],n=e[a+5],r.set(j,k,n),j=e[a+6],k=e[a+7],n=e[a+8],v.set(j,k,n),p.subVectors(v,r),q.subVectors(m,r),p.cross(q),f[a]=p.x,f[a+1]=p.y,f[a+2]=p.z,f[a+3]=p.x,f[a+4]=p.y,f[a+5]=p.z,f[a+6]=p.x,f[a+7]=p.y,f[a+8]=p.z}this.normalizeNormals();this.normalsNeedUpdate=
  176. !0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){K.x=d[3*a];K.y=d[3*a+1];K.z=d[3*a+2];w.copy(K);R=h[a];F.copy(R);F.sub(K.multiplyScalar(K.dot(R))).normalize();O.crossVectors(w,R);$=O.dot(j[a]);N=0>$?-1:1;i[4*a]=F.x;i[4*a+1]=F.y;i[4*a+2]=F.z;i[4*a+3]=N}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===
  177. this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;if(void 0===this.attributes.tangent){var g=4*f;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var i=this.attributes.tangent.array,h=[],j=[],g=0;g<f;g++)h[g]=new THREE.Vector3,
  178. j[g]=new THREE.Vector3;var k,n,m,r,v,p,q,x,u,z,y,t,C,E,l,f=new THREE.Vector3,g=new THREE.Vector3,I,J,B,P,A,G,D,H=this.offsets;B=0;for(P=H.length;B<P;++B){J=H[B].start;A=H[B].count;var s=H[B].index;I=J;for(J+=A;I<J;I+=3)A=s+b[I],G=s+b[I+1],D=s+b[I+2],k=c[3*A],n=c[3*A+1],m=c[3*A+2],r=c[3*G],v=c[3*G+1],p=c[3*G+2],q=c[3*D],x=c[3*D+1],u=c[3*D+2],z=e[2*A],y=e[2*A+1],t=e[2*G],C=e[2*G+1],E=e[2*D],l=e[2*D+1],r-=k,k=q-k,v-=n,n=x-n,p-=m,m=u-m,t-=z,z=E-z,C-=y,y=l-y,l=1/(t*y-z*C),f.set((y*r-C*k)*l,(y*v-C*n)*l,
  179. (y*p-C*m)*l),g.set((t*k-z*r)*l,(t*n-z*v)*l,(t*m-z*p)*l),h[A].add(f),h[G].add(f),h[D].add(f),j[A].add(g),j[G].add(g),j[D].add(g)}var F=new THREE.Vector3,O=new THREE.Vector3,K=new THREE.Vector3,w=new THREE.Vector3,N,R,$;B=0;for(P=H.length;B<P;++B){J=H[B].start;A=H[B].count;s=H[B].index;I=J;for(J+=A;I<J;I+=3)A=s+b[I],G=s+b[I+1],D=s+b[I+2],a(A),a(G),a(D)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);!0===this.useQuaternion?this.quaternion.setFromRotationMatrix(a):this.rotation.setEulerFromRotationMatrix(a,this.eulerOrder)}}();THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
  180. THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
  181. THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(THREE.Math.degToRad(0.5*this.fov))*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=Object.create(THREE.Object3D.prototype);THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);THREE.AreaLight=function(a,b){THREE.Light.call(this,a);this.normal=new THREE.Vector3(0,-1,0);this.right=new THREE.Vector3(1,0,0);this.intensity=void 0!==b?b:1;this.height=this.width=1;this.constantAttenuation=1.5;this.linearAttenuation=0.5;this.quadraticAttenuation=0.1};THREE.AreaLight.prototype=Object.create(THREE.Light.prototype);THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=!1;this.shadowCascadeOffset=
  182. new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype);THREE.HemisphereLight=function(a,b,c){THREE.Light.call(this,a);this.groundColor=new THREE.Color(b);this.position=new THREE.Vector3(0,100,0);this.intensity=void 0!==c?c:1};THREE.HemisphereLight.prototype=Object.create(THREE.Light.prototype);THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight=function(a,b,c,d,e){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/2;this.exponent=void 0!==e?e:10;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=
  183. this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
  184. THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
  185. a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=THREE.Loader.prototype.createMaterial(a[d],b);return c},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[b]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
  186. a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,i,h,j,q){var x=/\.dds$/i.test(f),u=b+"/"+f;if(x){var z=THREE.ImageUtils.loadCompressedTexture(u);a[e]=z}else z=document.createElement("canvas"),a[e]=new THREE.Texture(z);a[e].sourceFile=f;i&&(a[e].repeat.set(i[0],i[1]),1!==i[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==i[1]&&(a[e].wrapT=THREE.RepeatWrapping));h&&a[e].offset.set(h[0],h[1]);j&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==
  187. f[j[0]]&&(a[e].wrapS=f[j[0]]),void 0!==f[j[1]]&&(a[e].wrapT=f[j[1]]));q&&(a[e].anisotropy=q);if(!x){var y=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);y.image.width=a;y.image.height=b;y.image.getContext("2d").drawImage(this,0,0,a,b)}else y.image=this;y.needsUpdate=!0};a.crossOrigin=g.crossOrigin;a.src=u}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var g=this,i="MeshLambertMaterial",h={color:15658734,opacity:1,map:null,
  188. lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var j=a.shading.toLowerCase();"phong"===j?i="MeshPhongMaterial":"basic"===j&&(i="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(h.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)h.transparent=a.transparent;void 0!==a.depthTest&&(h.depthTest=a.depthTest);void 0!==a.depthWrite&&(h.depthWrite=a.depthWrite);void 0!==a.visible&&(h.visible=a.visible);void 0!==a.flipSided&&(h.side=THREE.BackSide);
  189. void 0!==a.doubleSided&&(h.side=THREE.DoubleSide);void 0!==a.wireframe&&(h.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?h.vertexColors=THREE.FaceColors:a.vertexColors&&(h.vertexColors=THREE.VertexColors));a.colorDiffuse?h.color=f(a.colorDiffuse):a.DbgColor&&(h.color=a.DbgColor);a.colorSpecular&&(h.specular=f(a.colorSpecular));a.colorAmbient&&(h.ambient=f(a.colorAmbient));a.transparency&&(h.opacity=a.transparency);a.specularCoef&&(h.shininess=a.specularCoef);a.mapDiffuse&&
  190. b&&e(h,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&e(h,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&e(h,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&e(h,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&e(h,"specularMap",a.mapSpecular,a.mapSpecularRepeat,
  191. a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapBumpScale&&(h.bumpScale=a.mapBumpScale);a.mapNormal?(i=THREE.ShaderLib.normalmap,j=THREE.UniformsUtils.clone(i.uniforms),j.tNormal.value=h.normalMap,a.mapNormalFactor&&j.uNormalScale.value.set(a.mapNormalFactor,a.mapNormalFactor),h.map&&(j.tDiffuse.value=h.map,j.enableDiffuse.value=!0),h.specularMap&&(j.tSpecular.value=h.specularMap,j.enableSpecular.value=!0),h.lightMap&&(j.tAO.value=h.lightMap,j.enableAO.value=!0),j.uDiffuseColor.value.setHex(h.color),
  192. j.uSpecularColor.value.setHex(h.specular),j.uAmbientColor.value.setHex(h.ambient),j.uShininess.value=h.shininess,void 0!==h.opacity&&(j.uOpacity.value=h.opacity),i=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:j,lights:!0,fog:!0}),h.transparent&&(i.transparent=!0)):i=new THREE[i](h);void 0!==a.DbgName&&(i.name=a.DbgName);return i}};THREE.ImageLoader=function(){THREE.EventDispatcher.call(this);this.crossOrigin=null};THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b){var c=this;void 0===b&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},!1);b.addEventListener("error",function(){c.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);c.crossOrigin&&(b.crossOrigin=c.crossOrigin);b.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
  193. THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var i=JSON.parse(f.responseText),i=a.parse(i,d);c(i.geometry,i.material)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===f.LOADING?e&&(0===g&&
  194. (g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};
  195. THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1,e,f,g,i,h,j,k,n,m,r,v,p,q,x,u,z=a.faces;r=a.vertices;var y=a.normals,t=a.colors,C=0;for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&C++;for(e=0;e<C;e++)c.faceUvs[e]=[],c.faceVertexUvs[e]=[];i=0;for(h=r.length;i<h;)j=new THREE.Vector3,j.x=r[i++]*d,j.y=r[i++]*d,j.z=r[i++]*d,c.vertices.push(j);i=0;for(h=z.length;i<h;){r=z[i++];j=r&1;g=r&2;e=r&4;f=r&8;n=r&16;k=r&32;v=r&64;r&=128;j?(p=new THREE.Face4,p.a=
  196. z[i++],p.b=z[i++],p.c=z[i++],p.d=z[i++],j=4):(p=new THREE.Face3,p.a=z[i++],p.b=z[i++],p.c=z[i++],j=3);g&&(g=z[i++],p.materialIndex=g);g=c.faces.length;if(e)for(e=0;e<C;e++)q=a.uvs[e],m=z[i++],u=q[2*m],m=q[2*m+1],c.faceUvs[e][g]=new THREE.Vector2(u,m);if(f)for(e=0;e<C;e++){q=a.uvs[e];x=[];for(f=0;f<j;f++)m=z[i++],u=q[2*m],m=q[2*m+1],x[f]=new THREE.Vector2(u,m);c.faceVertexUvs[e][g]=x}n&&(n=3*z[i++],f=new THREE.Vector3,f.x=y[n++],f.y=y[n++],f.z=y[n],p.normal=f);if(k)for(e=0;e<j;e++)n=3*z[i++],f=new THREE.Vector3,
  197. f.x=y[n++],f.y=y[n++],f.z=y[n],p.vertexNormals.push(f);v&&(k=z[i++],k=new THREE.Color(t[k]),p.color=k);if(r)for(e=0;e<j;e++)k=z[i++],k=new THREE.Color(t[k]),p.vertexColors.push(k);c.faces.push(p)}if(a.skinWeights){i=0;for(h=a.skinWeights.length;i<h;i+=2)z=a.skinWeights[i],y=a.skinWeights[i+1],c.skinWeights.push(new THREE.Vector4(z,y,0,0))}if(a.skinIndices){i=0;for(h=a.skinIndices.length;i<h;i+=2)z=a.skinIndices[i],y=a.skinIndices[i+1],c.skinIndices.push(new THREE.Vector4(z,y,0,0))}c.bones=a.bones;
  198. c.animation=a.animation;if(void 0!==a.morphTargets){i=0;for(h=a.morphTargets.length;i<h;i++){c.morphTargets[i]={};c.morphTargets[i].name=a.morphTargets[i].name;c.morphTargets[i].vertices=[];t=c.morphTargets[i].vertices;C=a.morphTargets[i].vertices;z=0;for(y=C.length;z<y;z+=3)r=new THREE.Vector3,r.x=C[z]*d,r.y=C[z+1]*d,r.z=C[z+2]*d,t.push(r)}}if(void 0!==a.morphColors){i=0;for(h=a.morphColors.length;i<h;i++){c.morphColors[i]={};c.morphColors[i].name=a.morphColors[i].name;c.morphColors[i].colors=[];
  199. y=c.morphColors[i].colors;t=a.morphColors[i].colors;d=0;for(z=t.length;d<z;d+=3)C=new THREE.Color(16755200),C.setRGB(t[d],t[d+1],t[d+2]),y.push(C)}}c.computeCentroids();c.computeFaceNormals();d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingMonitor=function(){THREE.EventDispatcher.call(this);var a=this,b=0,c=0,d=function(){b++;a.dispatchEvent({type:"progress",loaded:b,total:c});b===c&&a.dispatchEvent({type:"load"})};this.add=function(a){c++;a.addEventListener("load",d,!1)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.hierarchyHandlerMap={};this.addGeometryHandler("ascii",THREE.JSONLoader)};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
  200. THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4===d.readyState)if(200===d.status||0===d.status){var e=JSON.parse(d.responseText);c.parse(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.send(null)};THREE.SceneLoader.prototype.addGeometryHandler=function(a,b){this.geometryHandlerMap[a]={loaderClass:b}};
  201. THREE.SceneLoader.prototype.addHierarchyHandler=function(a,b){this.hierarchyHandlerMap[a]={loaderClass:b}};
  202. THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:n+"/"+a}function e(){f(l.scene,J.objects)}function f(a,b){var c,e,g,h,j,n,p;for(p in b)if(void 0===l.objects[p]){var M=b[p],q=null;if(M.type&&M.type in k.hierarchyHandlerMap){if(void 0===M.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};g={};for(var s in M)s in e||(g[s]=M[s]);r=l.materials[M.material];M.loading=!0;
  203. e=k.hierarchyHandlerMap[M.type].loaderObject;e.options?e.load(d(M.url,J.urlBaseType),i(p,a,r,M)):e.load(d(M.url,J.urlBaseType),i(p,a,r,M),g)}}else if(void 0!==M.geometry){if(m=l.geometries[M.geometry]){q=!1;r=l.materials[M.material];q=r instanceof THREE.ShaderMaterial;g=M.position;h=M.rotation;j=M.scale;c=M.matrix;n=M.quaternion;M.material||(r=new THREE.MeshFaceMaterial(l.face_materials[M.geometry]));r instanceof THREE.MeshFaceMaterial&&0===r.materials.length&&(r=new THREE.MeshFaceMaterial(l.face_materials[M.geometry]));
  204. if(r instanceof THREE.MeshFaceMaterial)for(e=0;e<r.materials.length;e++)q=q||r.materials[e]instanceof THREE.ShaderMaterial;q&&m.computeTangents();M.skin?q=new THREE.SkinnedMesh(m,r):M.morph?(q=new THREE.MorphAnimMesh(m,r),void 0!==M.duration&&(q.duration=M.duration),void 0!==M.time&&(q.time=M.time),void 0!==M.mirroredLoop&&(q.mirroredLoop=M.mirroredLoop),r.morphNormals&&m.computeMorphNormals()):q=new THREE.Mesh(m,r);q.name=p;c?(q.matrixAutoUpdate=!1,q.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],
  205. c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(q.position.set(g[0],g[1],g[2]),n?(q.quaternion.set(n[0],n[1],n[2],n[3]),q.useQuaternion=!0):q.rotation.set(h[0],h[1],h[2]),q.scale.set(j[0],j[1],j[2]));q.visible=M.visible;q.castShadow=M.castShadow;q.receiveShadow=M.receiveShadow;a.add(q);l.objects[p]=q}}else"DirectionalLight"===M.type||"PointLight"===M.type||"AmbientLight"===M.type?(u=void 0!==M.color?M.color:16777215,z=void 0!==M.intensity?M.intensity:1,"DirectionalLight"===M.type?(g=M.direction,
  206. x=new THREE.DirectionalLight(u,z),x.position.set(g[0],g[1],g[2]),M.target&&(I.push({object:x,targetName:M.target}),x.target=null)):"PointLight"===M.type?(g=M.position,e=M.distance,x=new THREE.PointLight(u,z,e),x.position.set(g[0],g[1],g[2])):"AmbientLight"===M.type&&(x=new THREE.AmbientLight(u)),a.add(x),x.name=p,l.lights[p]=x,l.objects[p]=x):"PerspectiveCamera"===M.type||"OrthographicCamera"===M.type?("PerspectiveCamera"===M.type?v=new THREE.PerspectiveCamera(M.fov,M.aspect,M.near,M.far):"OrthographicCamera"===
  207. M.type&&(v=new THREE.OrthographicCamera(M.left,M.right,M.top,M.bottom,M.near,M.far)),g=M.position,v.position.set(g[0],g[1],g[2]),a.add(v),v.name=p,l.cameras[p]=v,l.objects[p]=v):(g=M.position,h=M.rotation,j=M.scale,n=M.quaternion,q=new THREE.Object3D,q.name=p,q.position.set(g[0],g[1],g[2]),n?(q.quaternion.set(n[0],n[1],n[2],n[3]),q.useQuaternion=!0):q.rotation.set(h[0],h[1],h[2]),q.scale.set(j[0],j[1],j[2]),q.visible=void 0!==M.visible?M.visible:!1,a.add(q),l.objects[p]=q,l.empties[p]=q);if(q){if(void 0!==
  208. M.userData)for(var t in M.userData)q.userData[t]=M.userData[t];if(void 0!==M.groups)for(e=0;e<M.groups.length;e++)g=M.groups[e],void 0===l.groups[g]&&(l.groups[g]=[]),l.groups[g].push(p);void 0!==M.children&&f(q,M.children)}}}function g(a){return function(b,c){l.geometries[a]=b;l.face_materials[a]=c;e();y-=1;k.onLoadComplete();j()}}function i(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.position,i=d.rotation,h=d.quaternion,m=d.scale;f.position.set(g[0],g[1],g[2]);h?(f.quaternion.set(h[0],
  209. h[1],h[2],h[3]),f.useQuaternion=!0):f.rotation.set(i[0],i[1],i[2]);f.scale.set(m[0],m[1],m[2]);c&&f.traverse(function(a){a.material=c});var n=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=n});b.add(f);f.name=a;l.objects[a]=f;e();y-=1;k.onLoadComplete();j()}}function h(a){return function(b,c){l.geometries[a]=b;l.face_materials[a]=c}}function j(){k.callbackProgress({totalModels:C,totalTextures:E,loadedModels:C-y,loadedTextures:E-t},l);k.onLoadProgress();if(0===y&&0===t){for(var a=
  210. 0;a<I.length;a++){var c=I[a],d=l.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,l.scene.add(c.object.target));c.object.target.userData.targetInverse=c.object}b(l)}}var k=this,n=THREE.Loader.prototype.extractUrlBase(c),m,r,v,p,q,x,u,z,y,t,C,E,l,I=[],J=a,B;for(B in this.geometryHandlerMap)a=this.geometryHandlerMap[B].loaderClass,this.geometryHandlerMap[B].loaderObject=new a;for(B in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[B].loaderClass,this.hierarchyHandlerMap[B].loaderObject=
  211. new a;t=y=0;l={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(J.transform&&(B=J.transform.position,a=J.transform.rotation,c=J.transform.scale,B&&l.scene.position.set(B[0],B[1],B[2]),a&&l.scene.rotation.set(a[0],a[1],a[2]),c&&l.scene.scale.set(c[0],c[1],c[2]),B||a||c))l.scene.updateMatrix(),l.scene.updateMatrixWorld();B=function(a){return function(){t-=a;j();k.onLoadComplete()}};for(var P in J.fogs)a=J.fogs[P],
  212. "linear"===a.type?p=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(p=new THREE.FogExp2(0,a.density)),a=a.color,p.color.setRGB(a[0],a[1],a[2]),l.fogs[P]=p;for(var A in J.geometries)p=J.geometries[A],p.type in this.geometryHandlerMap&&(y+=1,k.onLoadStart());for(var G in J.objects)p=J.objects[G],p.type&&p.type in this.hierarchyHandlerMap&&(y+=1,k.onLoadStart());C=y;for(A in J.geometries)if(p=J.geometries[A],"cube"===p.type)m=new THREE.CubeGeometry(p.width,p.height,p.depth,p.widthSegments,p.heightSegments,
  213. p.depthSegments),l.geometries[A]=m;else if("plane"===p.type)m=new THREE.PlaneGeometry(p.width,p.height,p.widthSegments,p.heightSegments),l.geometries[A]=m;else if("sphere"===p.type)m=new THREE.SphereGeometry(p.radius,p.widthSegments,p.heightSegments),l.geometries[A]=m;else if("cylinder"===p.type)m=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),l.geometries[A]=m;else if("torus"===p.type)m=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,p.segmentsT),l.geometries[A]=
  214. m;else if("icosahedron"===p.type)m=new THREE.IcosahedronGeometry(p.radius,p.subdivisions),l.geometries[A]=m;else if(p.type in this.geometryHandlerMap){G={};for(q in p)"type"!==q&&"url"!==q&&(G[q]=p[q]);this.geometryHandlerMap[p.type].loaderObject.load(d(p.url,J.urlBaseType),g(A),G)}else"embedded"===p.type&&(G=J.embeds[p.id],G.metadata=J.metadata,G&&(G=this.geometryHandlerMap.ascii.loaderObject.parse(G,""),h(A)(G.geometry,G.material)));for(var D in J.textures)if(A=J.textures[D],A.url instanceof Array){t+=
  215. A.url.length;for(q=0;q<A.url.length;q++)k.onLoadStart()}else t+=1,k.onLoadStart();E=t;for(D in J.textures){A=J.textures[D];void 0!==A.mapping&&void 0!==THREE[A.mapping]&&(A.mapping=new THREE[A.mapping]);if(A.url instanceof Array){G=A.url.length;p=[];for(q=0;q<G;q++)p[q]=d(A.url[q],J.urlBaseType);q=(q=/\.dds$/i.test(p[0]))?THREE.ImageUtils.loadCompressedTextureCube(p,A.mapping,B(G)):THREE.ImageUtils.loadTextureCube(p,A.mapping,B(G))}else q=/\.dds$/i.test(A.url),G=d(A.url,J.urlBaseType),p=B(1),q=q?
  216. THREE.ImageUtils.loadCompressedTexture(G,A.mapping,p):THREE.ImageUtils.loadTexture(G,A.mapping,p),void 0!==THREE[A.minFilter]&&(q.minFilter=THREE[A.minFilter]),void 0!==THREE[A.magFilter]&&(q.magFilter=THREE[A.magFilter]),A.anisotropy&&(q.anisotropy=A.anisotropy),A.repeat&&(q.repeat.set(A.repeat[0],A.repeat[1]),1!==A.repeat[0]&&(q.wrapS=THREE.RepeatWrapping),1!==A.repeat[1]&&(q.wrapT=THREE.RepeatWrapping)),A.offset&&q.offset.set(A.offset[0],A.offset[1]),A.wrap&&(G={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},
  217. void 0!==G[A.wrap[0]]&&(q.wrapS=G[A.wrap[0]]),void 0!==G[A.wrap[1]]&&(q.wrapT=G[A.wrap[1]]));l.textures[D]=q}var H,s;for(H in J.materials){D=J.materials[H];for(s in D.parameters)"envMap"===s||"map"===s||"lightMap"===s||"bumpMap"===s?D.parameters[s]=l.textures[D.parameters[s]]:"shading"===s?D.parameters[s]="flat"===D.parameters[s]?THREE.FlatShading:THREE.SmoothShading:"side"===s?D.parameters[s]="double"==D.parameters[s]?THREE.DoubleSide:"back"==D.parameters[s]?THREE.BackSide:THREE.FrontSide:"blending"===
  218. s?D.parameters[s]=D.parameters[s]in THREE?THREE[D.parameters[s]]:THREE.NormalBlending:"combine"===s?D.parameters[s]=D.parameters[s]in THREE?THREE[D.parameters[s]]:THREE.MultiplyOperation:"vertexColors"===s?"face"==D.parameters[s]?D.parameters[s]=THREE.FaceColors:D.parameters[s]&&(D.parameters[s]=THREE.VertexColors):"wrapRGB"===s&&(B=D.parameters[s],D.parameters[s]=new THREE.Vector3(B[0],B[1],B[2]));void 0!==D.parameters.opacity&&1>D.parameters.opacity&&(D.parameters.transparent=!0);D.parameters.normalMap?
  219. (B=THREE.ShaderLib.normalmap,A=THREE.UniformsUtils.clone(B.uniforms),q=D.parameters.color,G=D.parameters.specular,p=D.parameters.ambient,P=D.parameters.shininess,A.tNormal.value=l.textures[D.parameters.normalMap],D.parameters.normalScale&&A.uNormalScale.value.set(D.parameters.normalScale[0],D.parameters.normalScale[1]),D.parameters.map&&(A.tDiffuse.value=D.parameters.map,A.enableDiffuse.value=!0),D.parameters.envMap&&(A.tCube.value=D.parameters.envMap,A.enableReflection.value=!0,A.uReflectivity.value=
  220. D.parameters.reflectivity),D.parameters.lightMap&&(A.tAO.value=D.parameters.lightMap,A.enableAO.value=!0),D.parameters.specularMap&&(A.tSpecular.value=l.textures[D.parameters.specularMap],A.enableSpecular.value=!0),D.parameters.displacementMap&&(A.tDisplacement.value=l.textures[D.parameters.displacementMap],A.enableDisplacement.value=!0,A.uDisplacementBias.value=D.parameters.displacementBias,A.uDisplacementScale.value=D.parameters.displacementScale),A.uDiffuseColor.value.setHex(q),A.uSpecularColor.value.setHex(G),
  221. A.uAmbientColor.value.setHex(p),A.uShininess.value=P,D.parameters.opacity&&(A.uOpacity.value=D.parameters.opacity),r=new THREE.ShaderMaterial({fragmentShader:B.fragmentShader,vertexShader:B.vertexShader,uniforms:A,lights:!0,fog:!0})):r=new THREE[D.type](D.parameters);l.materials[H]=r}for(H in J.materials)if(D=J.materials[H],D.parameters.materials){s=[];for(q=0;q<D.parameters.materials.length;q++)s.push(l.materials[D.parameters.materials[q]]);l.materials[H].materials=s}e();l.cameras&&J.defaults.camera&&
  222. (l.currentCamera=l.cameras[J.defaults.camera]);l.fogs&&J.defaults.fog&&(l.scene.fog=l.fogs[J.defaults.fog]);k.callbackSync(l);j()};THREE.TextureLoader=function(){THREE.EventDispatcher.call(this);this.crossOrigin=null};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=!0;b.dispatchEvent({type:"load",content:a})},!1);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);b.crossOrigin&&(c.crossOrigin=b.crossOrigin);c.src=a}};THREE.Material=function(){THREE.EventDispatcher.call(this);this.id=THREE.MaterialIdCount++;this.name="";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.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=!1;this.needsUpdate=this.visible=!0};
  223. THREE.Material.prototype.setValues=function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color&&c instanceof THREE.Color?d.copy(c):d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]=c}}};
  224. THREE.Material.prototype.clone=function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;
  225. a.visible=this.visible;return a};THREE.Material.prototype.dispose=function(){this.dispatchEvent({type:"dispose"})};THREE.MaterialIdCount=0;THREE.LineBasicMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);
  226. THREE.LineBasicMaterial.prototype.clone=function(){var a=new THREE.LineBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.linewidth=this.linewidth;a.linecap=this.linecap;a.linejoin=this.linejoin;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};THREE.LineDashedMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.scale=this.linewidth=1;this.dashSize=3;this.gapSize=1;this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.LineDashedMaterial.prototype=Object.create(THREE.Material.prototype);
  227. THREE.LineDashedMaterial.prototype.clone=function(){var a=new THREE.LineDashedMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.linewidth=this.linewidth;a.scale=this.scale;a.dashSize=this.dashSize;a.gapSize=this.gapSize;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};THREE.MeshBasicMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.envMap=this.specularMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=THREE.NoColors;this.morphTargets=this.skinning=!1;this.setValues(a)};
  228. THREE.MeshBasicMaterial.prototype=Object.create(THREE.Material.prototype);
  229. THREE.MeshBasicMaterial.prototype.clone=function(){var a=new THREE.MeshBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.lightMap=this.lightMap;a.specularMap=this.specularMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;a.wireframeLinejoin=
  230. this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;return a};THREE.MeshLambertMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(16777215);this.emissive=new THREE.Color(0);this.wrapAround=!1;this.wrapRGB=new THREE.Vector3(1,1,1);this.envMap=this.specularMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap=
  231. "round";this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)};THREE.MeshLambertMaterial.prototype=Object.create(THREE.Material.prototype);
  232. THREE.MeshLambertMaterial.prototype.clone=function(){var a=new THREE.MeshLambertMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.ambient.copy(this.ambient);a.emissive.copy(this.emissive);a.wrapAround=this.wrapAround;a.wrapRGB.copy(this.wrapRGB);a.map=this.map;a.lightMap=this.lightMap;a.specularMap=this.specularMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;
  233. a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;a.wireframeLinejoin=this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;a.morphNormals=this.morphNormals;return a};THREE.MeshPhongMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(16777215);this.emissive=new THREE.Color(0);this.specular=new THREE.Color(1118481);this.shininess=30;this.metal=!1;this.perPixel=!0;this.wrapAround=!1;this.wrapRGB=new THREE.Vector3(1,1,1);this.bumpMap=this.lightMap=this.map=null;this.bumpScale=1;this.normalMap=null;this.normalScale=new THREE.Vector2(1,1);this.envMap=this.specularMap=null;this.combine=THREE.MultiplyOperation;
  234. this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)};THREE.MeshPhongMaterial.prototype=Object.create(THREE.Material.prototype);
  235. THREE.MeshPhongMaterial.prototype.clone=function(){var a=new THREE.MeshPhongMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.ambient.copy(this.ambient);a.emissive.copy(this.emissive);a.specular.copy(this.specular);a.shininess=this.shininess;a.metal=this.metal;a.perPixel=this.perPixel;a.wrapAround=this.wrapAround;a.wrapRGB.copy(this.wrapRGB);a.map=this.map;a.lightMap=this.lightMap;a.bumpMap=this.bumpMap;a.bumpScale=this.bumpScale;a.normalMap=this.normalMap;a.normalScale.copy(this.normalScale);
  236. a.specularMap=this.specularMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;a.wireframeLinejoin=this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;a.morphNormals=this.morphNormals;return a};THREE.MeshDepthMaterial=function(a){THREE.Material.call(this);this.wireframe=!1;this.wireframeLinewidth=1;this.setValues(a)};THREE.MeshDepthMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshDepthMaterial.prototype.clone=function(){var a=new THREE.LineBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;return a};THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);this.shading=THREE.FlatShading;this.wireframe=!1;this.wireframeLinewidth=1;this.setValues(a)};THREE.MeshNormalMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshNormalMaterial.prototype.clone=function(){var a=new THREE.MeshNormalMaterial;THREE.Material.prototype.clone.call(this,a);a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;return a};THREE.MeshFaceMaterial=function(a){this.materials=a instanceof Array?a:[]};THREE.MeshFaceMaterial.prototype.clone=function(){return new THREE.MeshFaceMaterial(this.materials.slice(0))};THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.map=null;this.size=1;this.sizeAttenuation=!0;this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.ParticleBasicMaterial.prototype=Object.create(THREE.Material.prototype);
  237. THREE.ParticleBasicMaterial.prototype.clone=function(){var a=new THREE.ParticleBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.size=this.size;a.sizeAttenuation=this.sizeAttenuation;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.program=function(){};this.setValues(a)};THREE.ParticleCanvasMaterial.prototype=Object.create(THREE.Material.prototype);THREE.ParticleCanvasMaterial.prototype.clone=function(){var a=new THREE.ParticleCanvasMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.program=this.program;return a};THREE.ShaderMaterial=function(a){THREE.Material.call(this);this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.defines={};this.attributes=null;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);
  238. THREE.ShaderMaterial.prototype.clone=function(){var a=new THREE.ShaderMaterial;THREE.Material.prototype.clone.call(this,a);a.fragmentShader=this.fragmentShader;a.vertexShader=this.vertexShader;a.uniforms=THREE.UniformsUtils.clone(this.uniforms);a.attributes=this.attributes;a.defines=this.defines;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.fog=this.fog;a.lights=this.lights;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=
  239. this.morphTargets;a.morphNormals=this.morphNormals;return a};THREE.SpriteMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.map=new THREE.Texture;this.useScreenCoordinates=!0;this.depthTest=!this.useScreenCoordinates;this.sizeAttenuation=!this.useScreenCoordinates;this.scaleByViewport=!this.sizeAttenuation;this.alignment=THREE.SpriteAlignment.center.clone();this.fog=!1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1);this.setValues(a);a=a||{};void 0===a.depthTest&&(this.depthTest=!this.useScreenCoordinates);
  240. void 0===a.sizeAttenuation&&(this.sizeAttenuation=!this.useScreenCoordinates);void 0===a.scaleByViewport&&(this.scaleByViewport=!this.sizeAttenuation)};THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype);
  241. THREE.SpriteMaterial.prototype.clone=function(){var a=new THREE.SpriteMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.useScreenCoordinates=this.useScreenCoordinates;a.sizeAttenuation=this.sizeAttenuation;a.scaleByViewport=this.scaleByViewport;a.alignment.copy(this.alignment);a.uvOffset.copy(this.uvOffset);a.uvScale.copy(this.uvScale);a.fog=this.fog;return a};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);
  242. THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Texture=function(a,b,c,d,e,f,g,i,h){THREE.EventDispatcher.call(this);this.id=THREE.TextureIdCount++;this.name="";this.image=a;this.mipmaps=[];this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==h?h:1;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==i?i:THREE.UnsignedByteType;
  243. this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.needsUpdate=!1;this.onUpdate=null};
  244. THREE.Texture.prototype={constructor:THREE.Texture,clone:function(a){void 0===a&&(a=new THREE.Texture);a.image=this.image;a.mipmaps=this.mipmaps.slice(0);a.mapping=this.mapping;a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.format=this.format;a.type=this.type;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps=this.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;a.unpackAlignment=
  245. this.unpackAlignment;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.TextureIdCount=0;THREE.CompressedTexture=function(a,b,c,d,e,f,g,i,h,j,k){THREE.Texture.call(this,null,f,g,i,h,j,d,e,k);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=!1};THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype);THREE.CompressedTexture.prototype.clone=function(){var a=new THREE.CompressedTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.DataTexture=function(a,b,c,d,e,f,g,i,h,j,k){THREE.Texture.call(this,null,f,g,i,h,j,d,e,k);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=Object.create(THREE.Object3D.prototype);THREE.Particle.prototype.clone=function(a){void 0===a&&(a=new THREE.Particle(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.ParticleBasicMaterial({color:16777215*Math.random()});this.sortParticles=!1;this.geometry&&null===this.geometry.boundingSphere&&this.geometry.computeBoundingSphere();this.frustumCulled=!1};THREE.ParticleSystem.prototype=Object.create(THREE.Object3D.prototype);
  246. THREE.ParticleSystem.prototype.clone=function(a){void 0===a&&(a=new THREE.ParticleSystem(this.geometry,this.material));a.sortParticles=this.sortParticles;THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random()});this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=Object.create(THREE.Object3D.prototype);
  247. THREE.Line.prototype.clone=function(a){void 0===a&&(a=new THREE.Line(this.geometry,this.material,this.type));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.MeshBasicMaterial({color:16777215*Math.random(),wireframe:!0});void 0!==this.geometry&&(null===this.geometry.boundingSphere&&this.geometry.computeBoundingSphere(),this.updateMorphTargets())};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);
  248. THREE.Mesh.prototype.updateMorphTargets=function(){if(0<this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var a=0,b=this.geometry.morphTargets.length;a<b;a++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[a].name]=a}};
  249. THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(void 0!==this.morphTargetDictionary[a])return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Mesh.prototype.clone=function(a){void 0===a&&(a=new THREE.Mesh(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);THREE.Bone.prototype.update=function(a,b){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiplyMatrices(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};THREE.SkinnedMesh=function(a,b,c){THREE.Mesh.call(this,a,b);this.useVertexTexture=void 0!==c?c:!0;this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,f;if(this.geometry&&void 0!==this.geometry.bones){for(a=0;a<this.geometry.bones.length;a++)c=this.geometry.bones[a],d=c.pos,e=c.rotq,f=c.scl,b=this.addBone(),b.name=c.name,b.position.set(d[0],d[1],d[2]),b.quaternion.set(e[0],e[1],e[2],e[3]),b.useQuaternion=!0,void 0!==f?b.scale.set(f[0],f[1],f[2]):b.scale.set(1,1,1);for(a=
  250. 0;a<this.bones.length;a++)c=this.geometry.bones[a],b=this.bones[a],-1===c.parent?this.add(b):this.bones[c.parent].add(b);a=this.bones.length;this.useVertexTexture?(this.boneTextureHeight=this.boneTextureWidth=a=256<a?64:64<a?32:16<a?16:8,this.boneMatrices=new Float32Array(4*this.boneTextureWidth*this.boneTextureHeight),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType),this.boneTexture.minFilter=THREE.NearestFilter,
  251. this.boneTexture.magFilter=THREE.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1):this.boneMatrices=new Float32Array(16*a);this.pose()}};THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.SkinnedMesh.prototype.addBone=function(a){void 0===a&&(a=new THREE.Bone(this));this.bones.push(a);return a};
  252. THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1;for(var a=0,b=this.children.length;a<b;a++){var c=this.children[a];c instanceof THREE.Bone?c.update(this.identityMatrix,!1):c.updateMatrixWorld(!0)}if(void 0==this.boneInverses){this.boneInverses=[];a=0;for(b=this.bones.length;a<
  253. b;a++)c=new THREE.Matrix4,c.getInverse(this.bones[a].skinMatrix),this.boneInverses.push(c)}a=0;for(b=this.bones.length;a<b;a++)THREE.SkinnedMesh.offsetMatrix.multiplyMatrices(this.bones[a].skinMatrix,this.boneInverses[a]),THREE.SkinnedMesh.offsetMatrix.flattenToArrayOffset(this.boneMatrices,16*a);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)};
  254. THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);for(var a=0;a<this.geometry.skinIndices.length;a++){var b=this.geometry.skinWeights[a],c=1/b.lengthManhattan();Infinity!==c?b.multiplyScalar(c):b.set(1)}};THREE.SkinnedMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.SkinnedMesh(this.geometry,this.material,this.useVertexTexture));THREE.Mesh.prototype.clone.call(this,a);return a};THREE.SkinnedMesh.offsetMatrix=new THREE.Matrix4;THREE.MorphAnimMesh=function(a,b){THREE.Mesh.call(this,a,b);this.duration=1E3;this.mirroredLoop=!1;this.currentKeyframe=this.lastKeyframe=this.time=0;this.direction=1;this.directionBackwards=!1;this.setFrameRange(0,this.geometry.morphTargets.length-1)};THREE.MorphAnimMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.MorphAnimMesh.prototype.setFrameRange=function(a,b){this.startKeyframe=a;this.endKeyframe=b;this.length=this.endKeyframe-this.startKeyframe+1};
  255. THREE.MorphAnimMesh.prototype.setDirectionForward=function(){this.direction=1;this.directionBackwards=!1};THREE.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1;this.directionBackwards=!0};
  256. THREE.MorphAnimMesh.prototype.parseAnimations=function(){var a=this.geometry;a.animations||(a.animations={});for(var b,c=a.animations,d=/([a-z]+)(\d+)/,e=0,f=a.morphTargets.length;e<f;e++){var g=a.morphTargets[e].name.match(d);if(g&&1<g.length){g=g[1];c[g]||(c[g]={start:Infinity,end:-Infinity});var i=c[g];e<i.start&&(i.start=e);e>i.end&&(i.end=e);b||(b=g)}}a.firstAnimation=b};
  257. THREE.MorphAnimMesh.prototype.setAnimationLabel=function(a,b,c){this.geometry.animations||(this.geometry.animations={});this.geometry.animations[a]={start:b,end:c}};THREE.MorphAnimMesh.prototype.playAnimation=function(a,b){var c=this.geometry.animations[a];c?(this.setFrameRange(c.start,c.end),this.duration=1E3*((c.end-c.start)/b),this.time=0):console.warn("animation["+a+"] undefined")};
  258. THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/this.length;this.time+=this.direction*a;if(this.mirroredLoop){if(this.time>this.duration||0>this.time)this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),0>this.time&&(this.time=0,this.directionBackwards=!1)}else this.time%=this.duration,0>this.time&&(this.time+=this.duration);a=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/b),0,this.length-1);a!==this.currentKeyframe&&
  259. (this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[a]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=a);b=this.time%b/b;this.directionBackwards&&(b=1-b);this.morphTargetInfluences[this.currentKeyframe]=b;this.morphTargetInfluences[this.lastKeyframe]=1-b};
  260. THREE.MorphAnimMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.MorphAnimMesh(this.geometry,this.material));a.duration=this.duration;a.mirroredLoop=this.mirroredLoop;a.time=this.time;a.lastKeyframe=this.lastKeyframe;a.currentKeyframe=this.currentKeyframe;a.direction=this.direction;a.directionBackwards=this.directionBackwards;THREE.Mesh.prototype.clone.call(this,a);return a};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};THREE.Ribbon.prototype=Object.create(THREE.Object3D.prototype);THREE.Ribbon.prototype.clone=function(a){void 0===a&&(a=new THREE.Ribbon(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=Object.create(THREE.Object3D.prototype);THREE.LOD.prototype.addLevel=function(a,b){void 0===b&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length&&!(b<this.LODs[c].visibleAtDistance);c++);this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
  261. THREE.LOD.prototype.update=function(a){if(1<this.LODs.length){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.matrixWorldInverse;a=-(a.elements[2]*this.matrixWorld.elements[12]+a.elements[6]*this.matrixWorld.elements[13]+a.elements[10]*this.matrixWorld.elements[14]+a.elements[14]);this.LODs[0].object3D.visible=!0;for(var b=1;b<this.LODs.length;b++)if(a>=this.LODs[b].visibleAtDistance)this.LODs[b-1].object3D.visible=!1,this.LODs[b].object3D.visible=!0;else break;for(;b<this.LODs.length;b++)this.LODs[b].object3D.visible=
  262. !1}};THREE.LOD.prototype.clone=function(){};THREE.Sprite=function(a){THREE.Object3D.call(this);this.material=void 0!==a?a:new THREE.SpriteMaterial;this.rotation3d=this.rotation;this.rotation=0};THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype);THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);(1!==this.scale.x||1!==this.scale.y)&&this.matrix.scale(this.scale);this.matrixWorldNeedsUpdate=!0};
  263. THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
  264. THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
  265. THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a){E!==a&&(E=y.globalAlpha=a)}function c(a){l!==a&&(a===THREE.NormalBlending?y.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?y.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(y.globalCompositeOperation="darker"),l=a)}function d(a){B!==a&&(B=y.lineWidth=a)}function e(a){P!==a&&(P=y.lineCap=a)}function f(a){A!==a&&(A=y.lineJoin=a)}function g(a){I!==a&&(I=y.strokeStyle=a)}function i(a){J!==a&&(J=y.fillStyle=a)}function h(a,
  266. b){if(G!==a||D!==b)y.setLineDash([a,b]),G=a,D=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var j=THREE.Math.smoothstep,a=a||{},k=this,n,m,r,v=new THREE.Projector,p=void 0!==a.canvas?a.canvas:document.createElement("canvas"),q,x,u,z,y=p.getContext("2d"),t=new THREE.Color(0),C=0,E=1,l=0,I=null,J=null,B=null,P=null,A=null,G=null,D=0,H,s,F,O,K=new THREE.RenderableVertex,w=new THREE.RenderableVertex,N,R,$,Y,W,M,la,na,qa,X,S,Z,T=new THREE.Color,aa=new THREE.Color,L=new THREE.Color,U=new THREE.Color,
  267. ba=new THREE.Color,ca=new THREE.Color,da=new THREE.Color,pa=new THREE.Color,Aa={},ea={},ra,wa,ka,ya,Ga,Ja,Ka,La,Ma,Na,Fa=new THREE.Box2,ia=new THREE.Box2,fa=new THREE.Box2,oa=new THREE.Color,Da=new THREE.Color,Ba=new THREE.Color,ga=new THREE.Vector3,xa,Ca,Ea,ma,za,ha,Q=16;xa=document.createElement("canvas");xa.width=xa.height=2;Ca=xa.getContext("2d");Ca.fillStyle="rgba(0,0,0,1)";Ca.fillRect(0,0,2,2);Ea=Ca.getImageData(0,0,2,2);ma=Ea.data;za=document.createElement("canvas");za.width=za.height=Q;ha=
  268. za.getContext("2d");ha.translate(-Q/2,-Q/2);ha.scale(Q,Q);Q--;void 0===y.setLineDash&&(y.setLineDash=void 0!==y.mozDash?function(a){y.mozDash=null!==a[0]?a:null}:function(){});this.domElement=p;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=
  269. function(a,b){q=a*this.devicePixelRatio;x=b*this.devicePixelRatio;u=Math.floor(q/2);z=Math.floor(x/2);p.width=q;p.height=x;p.style.width=a+"px";p.style.height=b+"px";Fa.set(new THREE.Vector2(-u,-z),new THREE.Vector2(u,z));ia.set(new THREE.Vector2(-u,-z),new THREE.Vector2(u,z));E=1;l=0;A=P=B=J=I=null};this.setClearColor=function(a,b){t.copy(a);C=void 0!==b?b:1;ia.set(new THREE.Vector2(-u,-z),new THREE.Vector2(u,z))};this.setClearColorHex=function(a,b){t.setHex(a);C=void 0!==b?b:1;ia.set(new THREE.Vector2(-u,
  270. -z),new THREE.Vector2(u,z))};this.getMaxAnisotropy=function(){return 0};this.clear=function(){y.setTransform(1,0,0,-1,u,z);!1===ia.empty()&&(ia.intersect(Fa),ia.expandByScalar(2),1>C&&y.clearRect(ia.min.x|0,ia.min.y|0,ia.max.x-ia.min.x|0,ia.max.y-ia.min.y|0),0<C&&(c(THREE.NormalBlending),b(1),i("rgba("+Math.floor(255*t.r)+","+Math.floor(255*t.g)+","+Math.floor(255*t.b)+","+C+")"),y.fillRect(ia.min.x|0,ia.min.y|0,ia.max.x-ia.min.x|0,ia.max.y-ia.min.y|0)),ia.makeEmpty())};this.render=function(a,l){function p(a,
  271. b,c){for(var d=0,e=r.length;d<e;d++){var f=r[d];pa.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=ga.getPositionFromMatrix(f.matrixWorld).normalize(),i=b.dot(g);0>=i||(i*=f.intensity,c.add(pa.multiplyScalar(i)))}else f instanceof THREE.PointLight&&(g=ga.getPositionFromMatrix(f.matrixWorld),i=b.dot(ga.subVectors(g,a).normalize()),0>=i||(i*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=i&&(i*=f.intensity,c.add(pa.multiplyScalar(i)))))}}function q(a,d,e,f,g,i,h,m){k.info.render.vertices+=
  272. 3;k.info.render.faces++;b(m.opacity);c(m.blending);N=a.positionScreen.x;R=a.positionScreen.y;$=d.positionScreen.x;Y=d.positionScreen.y;W=e.positionScreen.x;M=e.positionScreen.y;t(N,R,$,Y,W,M);(m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial)&&null===m.map?(ca.copy(m.color),da.copy(m.emissive),m.vertexColors===THREE.FaceColors&&ca.multiply(h.color),!1===m.wireframe&&m.shading==THREE.SmoothShading&&3==h.vertexNormalsLength?(aa.copy(oa),L.copy(oa),U.copy(oa),p(h.v1.positionWorld,
  273. h.vertexNormalsModel[0],aa),p(h.v2.positionWorld,h.vertexNormalsModel[1],L),p(h.v3.positionWorld,h.vertexNormalsModel[2],U),aa.multiply(ca).add(da),L.multiply(ca).add(da),U.multiply(ca).add(da),ba.addColors(L,U).multiplyScalar(0.5),ka=E(aa,L,U,ba),D(N,R,$,Y,W,M,0,0,1,0,0,1,ka)):(T.copy(oa),p(h.centroidModel,h.normalModel,T),T.multiply(ca).add(da),!0===m.wireframe?A(T,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):B(T))):m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||
  274. m instanceof THREE.MeshPhongMaterial?null!==m.map?m.map.mapping instanceof THREE.UVMapping&&(ya=h.uvs[0],C(N,R,$,Y,W,M,ya[f].x,ya[f].y,ya[g].x,ya[g].y,ya[i].x,ya[i].y,m.map)):null!==m.envMap?m.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ga.copy(h.vertexNormalsModelView[f]),Ga=0.5*ga.x+0.5,Ja=0.5*ga.y+0.5,ga.copy(h.vertexNormalsModelView[g]),Ka=0.5*ga.x+0.5,La=0.5*ga.y+0.5,ga.copy(h.vertexNormalsModelView[i]),Ma=0.5*ga.x+0.5,Na=0.5*ga.y+0.5,C(N,R,$,Y,W,M,Ga,Ja,Ka,La,Ma,Na,m.envMap)):
  275. (T.copy(m.color),m.vertexColors===THREE.FaceColors&&T.multiply(h.color),!0===m.wireframe?A(T,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):B(T)):m instanceof THREE.MeshDepthMaterial?(ra=l.near,wa=l.far,aa.r=aa.g=aa.b=1-j(a.positionScreen.z*a.positionScreen.w,ra,wa),L.r=L.g=L.b=1-j(d.positionScreen.z*d.positionScreen.w,ra,wa),U.r=U.g=U.b=1-j(e.positionScreen.z*e.positionScreen.w,ra,wa),ba.addColors(L,U).multiplyScalar(0.5),ka=E(aa,L,U,ba),D(N,R,$,Y,W,M,0,0,1,0,0,1,ka)):m instanceof THREE.MeshNormalMaterial&&
  276. (m.shading==THREE.FlatShading?(a=h.normalModelView,T.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),!0===m.wireframe?A(T,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):B(T)):m.shading==THREE.SmoothShading&&(a=h.vertexNormalsModelView[f],aa.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=h.vertexNormalsModelView[g],L.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=h.vertexNormalsModelView[i],U.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),ba.addColors(L,
  277. U).multiplyScalar(0.5),ka=E(aa,L,U,ba),D(N,R,$,Y,W,M,0,0,1,0,0,1,ka)))}function t(a,b,c,d,e,f){y.beginPath();y.moveTo(a,b);y.lineTo(c,d);y.lineTo(e,f);y.closePath()}function x(a,b,c,d,e,f,g,i){y.beginPath();y.moveTo(a,b);y.lineTo(c,d);y.lineTo(e,f);y.lineTo(g,i);y.closePath()}function A(a,b,c,i){d(b);e(c);f(i);g(a.getStyle());y.stroke();fa.expandByScalar(2*b)}function B(a){i(a.getStyle());y.fill()}function C(a,b,c,d,e,f,g,h,j,k,l,m,L){if(!(L instanceof THREE.DataTexture||void 0===L.image||0==L.image.width)){if(!0===
  278. L.needsUpdate){var n=L.wrapS==THREE.RepeatWrapping,p=L.wrapT==THREE.RepeatWrapping;Aa[L.id]=y.createPattern(L.image,!0===n&&!0===p?"repeat":!0===n&&!1===p?"repeat-x":!1===n&&!0===p?"repeat-y":"no-repeat");L.needsUpdate=!1}void 0===Aa[L.id]?i("rgba(0,0,0,1)"):i(Aa[L.id]);var n=L.offset.x/L.repeat.x,p=L.offset.y/L.repeat.y,r=L.image.width*L.repeat.x,q=L.image.height*L.repeat.y,g=(g+n)*r,h=(1-h+p)*q,c=c-a,d=d-b,e=e-a,f=f-b,j=(j+n)*r-g,k=(1-k+p)*q-h,l=(l+n)*r-g,m=(1-m+p)*q-h,n=j*m-l*k;0===n?(void 0===
  279. ea[L.id]&&(b=document.createElement("canvas"),b.width=L.image.width,b.height=L.image.height,b=b.getContext("2d"),b.drawImage(L.image,0,0),ea[L.id]=b.getImageData(0,0,L.image.width,L.image.height).data),b=ea[L.id],g=4*(Math.floor(g)+Math.floor(h)*L.image.width),T.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),B(T)):(n=1/n,L=(m*c-k*e)*n,k=(m*d-k*f)*n,c=(j*e-l*c)*n,d=(j*f-l*d)*n,a=a-L*g-c*h,g=b-k*g-d*h,y.save(),y.transform(L,k,c,d,a,g),y.fill(),y.restore())}}function D(a,b,c,d,e,f,g,i,h,j,k,l,m){var L,n;L=m.width-
  280. 1;n=m.height-1;g*=L;i*=n;c-=a;d-=b;e-=a;f-=b;h=h*L-g;j=j*n-i;k=k*L-g;l=l*n-i;n=1/(h*l-k*j);L=(l*c-j*e)*n;j=(l*d-j*f)*n;c=(h*e-k*c)*n;d=(h*f-k*d)*n;a=a-L*g-c*i;b=b-j*g-d*i;y.save();y.transform(L,j,c,d,a,b);y.clip();y.drawImage(m,0,0);y.restore()}function E(a,b,c,d){ma[0]=255*a.r|0;ma[1]=255*a.g|0;ma[2]=255*a.b|0;ma[4]=255*b.r|0;ma[5]=255*b.g|0;ma[6]=255*b.b|0;ma[8]=255*c.r|0;ma[9]=255*c.g|0;ma[10]=255*c.b|0;ma[12]=255*d.r|0;ma[13]=255*d.g|0;ma[14]=255*d.b|0;Ca.putImageData(Ea,0,0);ha.drawImage(xa,
  281. 0,0);return za}function I(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!==e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}if(!1===l instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{!0===this.autoClear&&this.clear();y.setTransform(1,0,0,-1,u,z);k.info.render.vertices=0;k.info.render.faces=0;n=v.projectScene(a,l,this.sortObjects,this.sortElements);m=n.elements;r=n.lights;oa.setRGB(0,0,0);Da.setRGB(0,0,0);Ba.setRGB(0,0,0);for(var J=
  282. 0,P=r.length;J<P;J++){var G=r[J],V=G.color;G instanceof THREE.AmbientLight?oa.add(V):G instanceof THREE.DirectionalLight?Da.add(V):G instanceof THREE.PointLight&&Ba.add(V)}J=0;for(P=m.length;J<P;J++){var Q=m[J],G=Q.material;if(!(void 0===G||!1===G.visible)){fa.makeEmpty();if(Q instanceof THREE.RenderableParticle){H=Q;H.x*=u;H.y*=z;var V=H,ja=Q;b(G.opacity);c(G.blending);var sa=void 0,ta=void 0,ua=void 0,va=void 0,Ha=Q=void 0,Ia=void 0;G instanceof THREE.ParticleBasicMaterial?null===G.map?(ua=ja.object.scale.x,
  283. va=ja.object.scale.y,ua*=ja.scale.x*u,va*=ja.scale.y*z,fa.min.set(V.x-ua,V.y-va),fa.max.set(V.x+ua,V.y+va),!1!==Fa.isIntersectionBox(fa)&&(i(G.color.getStyle()),y.save(),y.translate(V.x,V.y),y.rotate(-ja.rotation),y.scale(ua,va),y.fillRect(-1,-1,2,2),y.restore())):(Q=G.map.image,Ha=Q.width>>1,Ia=Q.height>>1,ua=ja.scale.x*u,va=ja.scale.y*z,sa=ua*Ha,ta=va*Ia,fa.min.set(V.x-sa,V.y-ta),fa.max.set(V.x+sa,V.y+ta),!1!==Fa.isIntersectionBox(fa)&&(y.save(),y.translate(V.x,V.y),y.rotate(-ja.rotation),y.scale(ua,
  284. -va),y.translate(-Ha,-Ia),y.drawImage(Q,0,0),y.restore())):G instanceof THREE.ParticleCanvasMaterial&&(sa=ja.scale.x*u,ta=ja.scale.y*z,fa.min.set(V.x-sa,V.y-ta),fa.max.set(V.x+sa,V.y+ta),!1!==Fa.isIntersectionBox(fa)&&(g(G.color.getStyle()),i(G.color.getStyle()),y.save(),y.translate(V.x,V.y),y.rotate(-ja.rotation),y.scale(sa,ta),G.program(y),y.restore()))}else if(Q instanceof THREE.RenderableLine)H=Q.v1,s=Q.v2,H.positionScreen.x*=u,H.positionScreen.y*=z,s.positionScreen.x*=u,s.positionScreen.y*=z,
  285. fa.setFromPoints([H.positionScreen,s.positionScreen]),!0===Fa.isIntersectionBox(fa)&&(V=H,ja=s,b(G.opacity),c(G.blending),y.beginPath(),y.moveTo(V.positionScreen.x,V.positionScreen.y),y.lineTo(ja.positionScreen.x,ja.positionScreen.y),G instanceof THREE.LineBasicMaterial?(d(G.linewidth),e(G.linecap),f(G.linejoin),g(G.color.getStyle()),y.stroke(),fa.expandByScalar(2*G.linewidth)):G instanceof THREE.LineDashedMaterial&&(d(G.linewidth),e(G.linecap),f(G.linejoin),g(G.color.getStyle()),h(G.dashSize,G.gapSize),
  286. y.stroke(),fa.expandByScalar(2*G.linewidth),h(null,null)));else if(Q instanceof THREE.RenderableFace3){H=Q.v1;s=Q.v2;F=Q.v3;if(-1>H.positionScreen.z||1<H.positionScreen.z)continue;if(-1>s.positionScreen.z||1<s.positionScreen.z)continue;if(-1>F.positionScreen.z||1<F.positionScreen.z)continue;H.positionScreen.x*=u;H.positionScreen.y*=z;s.positionScreen.x*=u;s.positionScreen.y*=z;F.positionScreen.x*=u;F.positionScreen.y*=z;!0===G.overdraw&&(I(H.positionScreen,s.positionScreen),I(s.positionScreen,F.positionScreen),
  287. I(F.positionScreen,H.positionScreen));fa.setFromPoints([H.positionScreen,s.positionScreen,F.positionScreen]);q(H,s,F,0,1,2,Q,G)}else if(Q instanceof THREE.RenderableFace4){H=Q.v1;s=Q.v2;F=Q.v3;O=Q.v4;if(-1>H.positionScreen.z||1<H.positionScreen.z)continue;if(-1>s.positionScreen.z||1<s.positionScreen.z)continue;if(-1>F.positionScreen.z||1<F.positionScreen.z)continue;if(-1>O.positionScreen.z||1<O.positionScreen.z)continue;H.positionScreen.x*=u;H.positionScreen.y*=z;s.positionScreen.x*=u;s.positionScreen.y*=
  288. z;F.positionScreen.x*=u;F.positionScreen.y*=z;O.positionScreen.x*=u;O.positionScreen.y*=z;K.positionScreen.copy(s.positionScreen);w.positionScreen.copy(O.positionScreen);!0===G.overdraw&&(I(H.positionScreen,s.positionScreen),I(s.positionScreen,O.positionScreen),I(O.positionScreen,H.positionScreen),I(F.positionScreen,K.positionScreen),I(F.positionScreen,w.positionScreen));fa.setFromPoints([H.positionScreen,s.positionScreen,F.positionScreen,O.positionScreen]);V=H;ja=s;sa=F;ta=O;ua=K;va=w;k.info.render.vertices+=
  289. 4;k.info.render.faces++;b(G.opacity);c(G.blending);void 0!==G.map&&null!==G.map||void 0!==G.envMap&&null!==G.envMap?(q(V,ja,ta,0,1,3,Q,G),q(ua,sa,va,1,2,3,Q,G)):(N=V.positionScreen.x,R=V.positionScreen.y,$=ja.positionScreen.x,Y=ja.positionScreen.y,W=sa.positionScreen.x,M=sa.positionScreen.y,la=ta.positionScreen.x,na=ta.positionScreen.y,qa=ua.positionScreen.x,X=ua.positionScreen.y,S=va.positionScreen.x,Z=va.positionScreen.y,G instanceof THREE.MeshLambertMaterial||G instanceof THREE.MeshPhongMaterial?
  290. (ca.copy(G.color),da.copy(G.emissive),G.vertexColors===THREE.FaceColors&&ca.multiply(Q.color),!1===G.wireframe&&G.shading==THREE.SmoothShading&&4==Q.vertexNormalsLength?(aa.copy(oa),L.copy(oa),U.copy(oa),ba.copy(oa),p(Q.v1.positionWorld,Q.vertexNormalsModel[0],aa),p(Q.v2.positionWorld,Q.vertexNormalsModel[1],L),p(Q.v4.positionWorld,Q.vertexNormalsModel[3],U),p(Q.v3.positionWorld,Q.vertexNormalsModel[2],ba),aa.multiply(ca).add(da),L.multiply(ca).add(da),U.multiply(ca).add(da),ba.multiply(ca).add(da),
  291. ka=E(aa,L,U,ba),t(N,R,$,Y,la,na),D(N,R,$,Y,la,na,0,0,1,0,0,1,ka),t(qa,X,W,M,S,Z),D(qa,X,W,M,S,Z,1,0,1,1,0,1,ka)):(T.copy(oa),p(Q.centroidModel,Q.normalModel,T),T.multiply(ca).add(da),x(N,R,$,Y,W,M,la,na),!0===G.wireframe?A(T,G.wireframeLinewidth,G.wireframeLinecap,G.wireframeLinejoin):B(T))):G instanceof THREE.MeshBasicMaterial?(T.copy(G.color),G.vertexColors===THREE.FaceColors&&T.multiply(Q.color),x(N,R,$,Y,W,M,la,na),!0===G.wireframe?A(T,G.wireframeLinewidth,G.wireframeLinecap,G.wireframeLinejoin):
  292. B(T)):G instanceof THREE.MeshNormalMaterial?(V=void 0,G.shading==THREE.FlatShading?(V=Q.normalModelView,T.setRGB(V.x,V.y,V.z).multiplyScalar(0.5).addScalar(0.5),x(N,R,$,Y,W,M,la,na),!0===G.wireframe?A(T,G.wireframeLinewidth,G.wireframeLinecap,G.wireframeLinejoin):B(T)):G.shading==THREE.SmoothShading&&(V=Q.vertexNormalsModelView[0],aa.setRGB(V.x,V.y,V.z).multiplyScalar(0.5).addScalar(0.5),V=Q.vertexNormalsModelView[1],L.setRGB(V.x,V.y,V.z).multiplyScalar(0.5).addScalar(0.5),V=Q.vertexNormalsModelView[3],
  293. U.setRGB(V.x,V.y,V.z).multiplyScalar(0.5).addScalar(0.5),V=Q.vertexNormalsModelView[2],ba.setRGB(V.x,V.y,V.z).multiplyScalar(0.5).addScalar(0.5),ka=E(aa,L,U,ba),t(N,R,$,Y,la,na),D(N,R,$,Y,la,na,0,0,1,0,0,1,ka),t(qa,X,W,M,S,Z),D(qa,X,W,M,S,Z,1,0,1,1,0,1,ka))):G instanceof THREE.MeshDepthMaterial&&(ra=l.near,wa=l.far,aa.r=aa.g=aa.b=1-j(V.positionScreen.z*V.positionScreen.w,ra,wa),L.r=L.g=L.b=1-j(ja.positionScreen.z*ja.positionScreen.w,ra,wa),U.r=U.g=U.b=1-j(ta.positionScreen.z*ta.positionScreen.w,ra,
  294. wa),ba.r=ba.g=ba.b=1-j(sa.positionScreen.z*sa.positionScreen.w,ra,wa),ka=E(aa,L,U,ba),t(N,R,$,Y,la,na),D(N,R,$,Y,la,na,0,0,1,0,0,1,ka),t(qa,X,W,M,S,Z),D(qa,X,W,M,S,Z,1,0,1,1,0,1,ka)))}ia.union(fa)}}y.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
  295. envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
  296. envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
  297. envmap_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\nworldNormal = normalize( worldNormal );\nvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, worldNormal );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
  298. map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );\n#endif",map_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )\nvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
  299. map_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\nvec4 texelColor = texture2D( map, vUv );\n#ifdef GAMMA_INPUT\ntexelColor.xyz *= texelColor.xyz;\n#endif\ngl_FragColor = gl_FragColor * texelColor;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",
  300. lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\nuniform sampler2D bumpMap;\nuniform float bumpScale;\nvec2 dHdxy_fwd() {\nvec2 dSTdx = dFdx( vUv );\nvec2 dSTdy = dFdy( vUv );\nfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\nfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\nfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\nreturn vec2( dBx, dBy );\n}\nvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\nvec3 vSigmaX = dFdx( surf_pos );\nvec3 vSigmaY = dFdy( surf_pos );\nvec3 vN = surf_norm;\nvec3 R1 = cross( vSigmaY, vN );\nvec3 R2 = cross( vN, vSigmaX );\nfloat fDet = dot( vSigmaX, R1 );\nvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\nreturn normalize( abs( fDet ) * surf_norm - vGrad );\n}\n#endif",
  301. normalmap_pars_fragment:"#ifdef USE_NORMALMAP\nuniform sampler2D normalMap;\nuniform vec2 normalScale;\nvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\nvec3 q0 = dFdx( eye_pos.xyz );\nvec3 q1 = dFdy( eye_pos.xyz );\nvec2 st0 = dFdx( vUv.st );\nvec2 st1 = dFdy( vUv.st );\nvec3 S = normalize( q0 * st1.t - q1 * st0.t );\nvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\nvec3 N = normalize( surf_norm );\nvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\nmapN.xy = normalScale * mapN.xy;\nmat3 tsn = mat3( S, T, N );\nreturn normalize( tsn * mapN );\n}\n#endif",
  302. specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\nuniform sampler2D specularMap;\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\nvec4 texelSpecular = texture2D( specularMap, vUv );\nspecularStrength = texelSpecular.r;\n#else\nspecularStrength = 1.0;\n#endif",lights_lambert_pars_vertex:"uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_HEMI_LIGHTS > 0\nuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\nuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif",
  303. lights_lambert_vertex:"vLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\nvLightBack = vec3( 0.0 );\n#endif\ntransformedNormal = normalize( transformedNormal );\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( transformedNormal, dirVector );\nvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\ndirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\ndirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n#ifdef DOUBLE_SIDED\nvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n#endif\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat dotProduct = dot( transformedNormal, lVector );\nvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\npointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\npointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef DOUBLE_SIDED\nvLightBack += pointLightColor[ i ] * pointLightWeightingBack * lDistance;\n#endif\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\nif ( spotEffect > spotLightAngleCos[ i ] ) {\nspotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat dotProduct = dot( transformedNormal, lVector );\nvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\nspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\nspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += spotLightColor[ i ] * spotLightWeighting * lDistance * spotEffect;\n#ifdef DOUBLE_SIDED\nvLightBack += spotLightColor[ i ] * spotLightWeightingBack * lDistance * spotEffect;\n#endif\n}\n}\n#endif\n#if MAX_HEMI_LIGHTS > 0\nfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\nvec3 lVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( transformedNormal, lVector );\nfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\nfloat hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\nvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n#ifdef DOUBLE_SIDED\nvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n#endif\n}\n#endif\nvLightFront = vLightFront * diffuse + ambient * ambientLightColor + emissive;\n#ifdef DOUBLE_SIDED\nvLightBack = vLightBack * diffuse + ambient * ambientLightColor + emissive;\n#endif",
  304. lights_phong_pars_vertex:"#ifndef PHONG_PER_PIXEL\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\nvarying vec4 vSpotLight[ MAX_SPOT_LIGHTS ];\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )\nvarying vec3 vWorldPosition;\n#endif",
  305. lights_phong_vertex:"#ifndef PHONG_PER_PIXEL\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nvSpotLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )\nvWorldPosition = worldPosition.xyz;\n#endif",
  306. lights_phong_pars_fragment:"uniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_HEMI_LIGHTS > 0\nuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n#ifdef PHONG_PER_PIXEL\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#else\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\nuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n#ifdef PHONG_PER_PIXEL\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n#else\nvarying vec4 vSpotLight[ MAX_SPOT_LIGHTS ];\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )\nvarying vec3 vWorldPosition;\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",
  307. lights_phong_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#ifdef DOUBLE_SIDED\nnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n#endif\n#ifdef USE_NORMALMAP\nnormal = perturbNormal2Arb( -viewPosition, normal );\n#elif defined( USE_BUMPMAP )\nnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n#ifdef PHONG_PER_PIXEL\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz + vViewPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#else\nvec3 lVector = normalize( vPointLight[ i ].xyz );\nfloat lDistance = vPointLight[ i ].w;\n#endif\nfloat dotProduct = dot( normal, lVector );\n#ifdef WRAP_AROUND\nfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n#else\nfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n#endif\npointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;\nvec3 pointHalfVector = normalize( lVector + viewPosition );\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance;\n#endif\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nvec3 spotDiffuse = vec3( 0.0 );\nvec3 spotSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n#ifdef PHONG_PER_PIXEL\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz + vViewPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#else\nvec3 lVector = normalize( vSpotLight[ i ].xyz );\nfloat lDistance = vSpotLight[ i ].w;\n#endif\nfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\nif ( spotEffect > spotLightAngleCos[ i ] ) {\nspotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );\nfloat dotProduct = dot( normal, lVector );\n#ifdef WRAP_AROUND\nfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 spotDiffuseWeight = mix( vec3 ( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n#else\nfloat spotDiffuseWeight = max( dotProduct, 0.0 );\n#endif\nspotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * lDistance * spotEffect;\nvec3 spotHalfVector = normalize( lVector + viewPosition );\nfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\nfloat spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, spotHalfVector ), 5.0 );\nspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * specularNormalization * spotEffect;\n#else\nspotSpecular += specular * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * spotEffect;\n#endif\n}\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( normal, dirVector );\n#ifdef WRAP_AROUND\nfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n#else\nfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n#endif\ndirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\nvec3 dirHalfVector = normalize( dirVector + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\n}\n#endif\n#if MAX_HEMI_LIGHTS > 0\nvec3 hemiDiffuse = vec3( 0.0 );\nvec3 hemiSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\nvec3 lVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( normal, lVector );\nfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\nvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\nhemiDiffuse += diffuse * hemiColor;\nvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\nfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\nfloat hemiSpecularWeightSky = specularStrength * max( pow( hemiDotNormalHalfSky, shininess ), 0.0 );\nvec3 lVectorGround = -lVector;\nvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\nfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\nfloat hemiSpecularWeightGround = specularStrength * max( pow( hemiDotNormalHalfGround, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat dotProductGround = dot( normal, lVectorGround );\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, hemiHalfVectorSky ), 5.0 );\nvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 5.0 );\nhemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n#else\nhemiSpecular += specular * hemiColor * ( hemiSpecularWeightSky + hemiSpecularWeightGround ) * hemiDiffuseWeight;\n#endif\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_HEMI_LIGHTS > 0\ntotalDiffuse += hemiDiffuse;\ntotalSpecular += hemiSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\n#if MAX_SPOT_LIGHTS > 0\ntotalDiffuse += spotDiffuse;\ntotalSpecular += spotSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n#endif",
  308. color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n#ifdef GAMMA_INPUT\nvColor = color * color;\n#else\nvColor = color;\n#endif\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n#ifdef BONE_TEXTURE\nuniform sampler2D boneTexture;\nmat4 getBoneMatrix( const in float i ) {\nfloat j = i * 4.0;\nfloat x = mod( j, N_BONE_PIXEL_X );\nfloat y = floor( j / N_BONE_PIXEL_X );\nconst float dx = 1.0 / N_BONE_PIXEL_X;\nconst float dy = 1.0 / N_BONE_PIXEL_Y;\ny = dy * ( y + 0.5 );\nvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\nvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\nvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\nvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\nmat4 bone = mat4( v1, v2, v3, v4 );\nreturn bone;\n}\n#else\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\nmat4 getBoneMatrix( const in float i ) {\nmat4 bone = boneGlobalMatrices[ int(i) ];\nreturn bone;\n}\n#endif\n#endif",
  309. skinbase_vertex:"#ifdef USE_SKINNING\nmat4 boneMatX = getBoneMatrix( skinIndex.x );\nmat4 boneMatY = getBoneMatrix( skinIndex.y );\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n#ifdef USE_MORPHTARGETS\nvec4 skinVertex = vec4( morphed, 1.0 );\n#else\nvec4 skinVertex = vec4( position, 1.0 );\n#endif\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n#ifndef USE_MORPHNORMALS\nuniform float morphTargetInfluences[ 8 ];\n#else\nuniform float morphTargetInfluences[ 4 ];\n#endif\n#endif",
  310. morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n#ifndef USE_MORPHNORMALS\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n#endif\nmorphed += position;\n#endif",
  311. default_vertex:"vec4 mvPosition;\n#ifdef USE_SKINNING\nmvPosition = modelViewMatrix * skinned;\n#endif\n#if !defined( USE_SKINNING ) && defined( USE_MORPHTARGETS )\nmvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n#endif\n#if !defined( USE_SKINNING ) && ! defined( USE_MORPHTARGETS )\nmvPosition = modelViewMatrix * vec4( position, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\nvec3 morphedNormal = vec3( 0.0 );\nmorphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\nmorphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\nmorphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\nmorphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\nmorphedNormal += normal;\n#endif",
  312. skinnormal_vertex:"#ifdef USE_SKINNING\nmat4 skinMatrix = skinWeight.x * boneMatX;\nskinMatrix \t+= skinWeight.y * boneMatY;\n#ifdef USE_MORPHNORMALS\nvec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n#else\nvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n#endif\n#endif",defaultnormal_vertex:"vec3 objectNormal;\n#ifdef USE_SKINNING\nobjectNormal = skinnedNormal.xyz;\n#endif\n#if !defined( USE_SKINNING ) && defined( USE_MORPHNORMALS )\nobjectNormal = morphedNormal;\n#endif\n#if !defined( USE_SKINNING ) && ! defined( USE_MORPHNORMALS )\nobjectNormal = normal;\n#endif\n#ifdef FLIP_SIDED\nobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;",
  313. shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform vec2 shadowMapSize[ MAX_SHADOWS ];\nuniform float shadowDarkness[ MAX_SHADOWS ];\nuniform float shadowBias[ MAX_SHADOWS ];\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_DEBUG\nvec3 frustumColors[3];\nfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\nfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\nfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n#endif\n#ifdef SHADOWMAP_CASCADE\nint inFrustumCount = 0;\n#endif\nfloat fDepth;\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\nbool inFrustum = all( inFrustumVec );\n#ifdef SHADOWMAP_CASCADE\ninFrustumCount += int( inFrustum );\nbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n#else\nbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n#endif\nbool frustumTest = all( frustumTestVec );\nif ( frustumTest ) {\nshadowCoord.z += shadowBias[ i ];\n#if defined( SHADOWMAP_TYPE_PCF )\nfloat shadow = 0.0;\nconst float shadowDelta = 1.0 / 9.0;\nfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\nfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\nfloat dx0 = -1.25 * xPixelOffset;\nfloat dy0 = -1.25 * yPixelOffset;\nfloat dx1 = 1.25 * xPixelOffset;\nfloat dy1 = 1.25 * yPixelOffset;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\nfloat shadow = 0.0;\nfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\nfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\nfloat dx0 = -1.0 * xPixelOffset;\nfloat dy0 = -1.0 * yPixelOffset;\nfloat dx1 = 1.0 * xPixelOffset;\nfloat dy1 = 1.0 * yPixelOffset;\nmat3 shadowKernel;\nmat3 depthKernel;\ndepthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\nif ( depthKernel[0][0] < shadowCoord.z ) shadowKernel[0][0] = 0.25;\nelse shadowKernel[0][0] = 0.0;\ndepthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\nif ( depthKernel[0][1] < shadowCoord.z ) shadowKernel[0][1] = 0.25;\nelse shadowKernel[0][1] = 0.0;\ndepthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i], shadowCoord.xy + vec2( dx0, dy1 ) ) );\nif ( depthKernel[0][2] < shadowCoord.z ) shadowKernel[0][2] = 0.25;\nelse shadowKernel[0][2] = 0.0;\ndepthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\nif ( depthKernel[1][0] < shadowCoord.z ) shadowKernel[1][0] = 0.25;\nelse shadowKernel[1][0] = 0.0;\ndepthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\nif ( depthKernel[1][1] < shadowCoord.z ) shadowKernel[1][1] = 0.25;\nelse shadowKernel[1][1] = 0.0;\ndepthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\nif ( depthKernel[1][2] < shadowCoord.z ) shadowKernel[1][2] = 0.25;\nelse shadowKernel[1][2] = 0.0;\ndepthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\nif ( depthKernel[2][0] < shadowCoord.z ) shadowKernel[2][0] = 0.25;\nelse shadowKernel[2][0] = 0.0;\ndepthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\nif ( depthKernel[2][1] < shadowCoord.z ) shadowKernel[2][1] = 0.25;\nelse shadowKernel[2][1] = 0.0;\ndepthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\nif ( depthKernel[2][2] < shadowCoord.z ) shadowKernel[2][2] = 0.25;\nelse shadowKernel[2][2] = 0.0;\nvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\nshadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\nshadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\nvec4 shadowValues;\nshadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\nshadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\nshadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\nshadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\nshadow = dot( shadowValues, vec4( 1.0 ) );\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n#endif\n}\n#ifdef SHADOWMAP_DEBUG\n#ifdef SHADOWMAP_CASCADE\nif ( inFrustum && inFrustumCount == 1 ) gl_FragColor.xyz *= frustumColors[ i ];\n#else\nif ( inFrustum ) gl_FragColor.xyz *= frustumColors[ i ];\n#endif\n#endif\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",
  314. shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"};
  315. THREE.UniformsUtils={merge:function(a){var b,c,d,e={};for(b=0;b<a.length;b++)for(c in d=this.clone(a[b]),d)e[c]=d[c];return e},clone:function(a){var b,c,d,e={};for(b in a)for(c in e[b]={},a[b])d=a[b][c],e[b][c]=d instanceof THREE.Color||d instanceof THREE.Vector2||d instanceof THREE.Vector3||d instanceof THREE.Vector4||d instanceof THREE.Matrix4||d instanceof THREE.Texture?d.clone():d instanceof Array?d.slice():d;return e}};
  316. THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:null},specularMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},bump:{bumpMap:{type:"t",
  317. value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new THREE.Vector2(1,1)}},fog:{fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},hemisphereLightDirection:{type:"fv",value:[]},hemisphereLightSkyColor:{type:"fv",
  318. value:[]},hemisphereLightGroundColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]},spotLightColor:{type:"fv",value:[]},spotLightPosition:{type:"fv",value:[]},spotLightDirection:{type:"fv",value:[]},spotLightDistance:{type:"fv1",value:[]},spotLightAngleCos:{type:"fv1",value:[]},spotLightExponent:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",
  319. value:1},scale:{type:"f",value:1},map:{type:"t",value:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}};
  320. THREE.ShaderLib={basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,
  321. THREE.ShaderChunk.skinbase_vertex,"#ifdef USE_ENVMAP",THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"#endif",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,
  322. THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,
  323. THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(16777215)},emissive:{type:"c",value:new THREE.Color(0)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\n#endif",
  324. THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_lambert_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,
  325. THREE.ShaderChunk.defaultnormal_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_lambert_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\n#endif",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,
  326. THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,"#ifdef DOUBLE_SIDED\nif ( gl_FrontFacing )\ngl_FragColor.xyz *= vLightFront;\nelse\ngl_FragColor.xyz *= vLightBack;\n#else\ngl_FragColor.xyz *= vLightFront;\n#endif",THREE.ShaderChunk.lightmap_fragment,
  327. THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.bump,THREE.UniformsLib.normalmap,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(16777215)},emissive:{type:"c",value:new THREE.Color(0)},specular:{type:"c",
  328. value:new THREE.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define PHONG\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_phong_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,
  329. "void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"vNormal = normalize( transformedNormal );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"vViewPosition = -mvPosition.xyz;",THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,
  330. THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,
  331. THREE.ShaderChunk.bumpmap_pars_fragment,THREE.ShaderChunk.normalmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,
  332. THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
  333. THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,
  334. THREE.ShaderChunk.fog_fragment,"}"].join("\n")},dashed:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vLineDistance = scale * lineDistance;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n"),
  335. fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\nif ( mod( vLineDistance, totalSize ) > dashSize ) {\ndiscard;\n}\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",
  336. value:1}},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}"},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}",
  337. fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}"},normalmap:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},enableDisplacement:{type:"i",value:0},tDisplacement:{type:"t",value:null},tDiffuse:{type:"t",value:null},
  338. tCube:{type:"t",value:null},tNormal:{type:"t",value:null},tSpecular:{type:"t",value:null},tAO:{type:"t",value:null},uNormalScale:{type:"v2",value:new THREE.Vector2(1,1)},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",value:new THREE.Color(16777215)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(16777215)},uShininess:{type:"f",value:30},uOpacity:{type:"f",value:1},useRefract:{type:"i",value:0},
  339. uRefractionRatio:{type:"f",value:0.98},uReflectivity:{type:"f",value:0.5},uOffset:{type:"v2",value:new THREE.Vector2(0,0)},uRepeat:{type:"v2",value:new THREE.Vector2(1,1)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),fragmentShader:["uniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform float uOpacity;\nuniform bool enableDiffuse;\nuniform bool enableSpecular;\nuniform bool enableAO;\nuniform bool enableReflection;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\nuniform sampler2D tAO;\nuniform samplerCube tCube;\nuniform vec2 uNormalScale;\nuniform bool useRefract;\nuniform float uRefractionRatio;\nuniform float uReflectivity;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_HEMI_LIGHTS > 0\nuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\nuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;",
  340. THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3( 1.0 ), uOpacity );\nvec3 specularTex = vec3( 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse ) {\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( tDiffuse, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( tDiffuse, vUv );\n#endif\n}\nif( enableAO ) {\n#ifdef GAMMA_INPUT\nvec4 aoColor = texture2D( tAO, vUv );\naoColor.xyz *= aoColor.xyz;\ngl_FragColor.xyz = gl_FragColor.xyz * aoColor.xyz;\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * texture2D( tAO, vUv ).xyz;\n#endif\n}\nif( enableSpecular )\nspecularTex = texture2D( tSpecular, vUv ).xyz;\nmat3 tsb = mat3( normalize( vTangent ), normalize( vBinormal ), normalize( vNormal ) );\nvec3 finalNormal = tsb * normalTex;\n#ifdef FLIP_SIDED\nfinalNormal = -finalNormal;\n#endif\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointVector = lPosition.xyz + vViewPosition.xyz;\nfloat pointDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\npointDistance = 1.0 - min( ( length( pointVector ) / pointLightDistance[ i ] ), 1.0 );\npointVector = normalize( pointVector );\n#ifdef WRAP_AROUND\nfloat pointDiffuseWeightFull = max( dot( normal, pointVector ), 0.0 );\nfloat pointDiffuseWeightHalf = max( 0.5 * dot( normal, pointVector ) + 0.5, 0.0 );\nvec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n#else\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\n#endif\npointDiffuse += pointDistance * pointLightColor[ i ] * uDiffuseColor * pointDiffuseWeight;\nvec3 pointHalfVector = normalize( pointVector + viewPosition );\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, uShininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( uShininess + 2.0001 ) / 8.0;\nvec3 schlick = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( pointVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance * specularNormalization;\n#else\npointSpecular += pointDistance * pointLightColor[ i ] * uSpecularColor * pointSpecularWeight * pointDiffuseWeight;\n#endif\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nvec3 spotDiffuse = vec3( 0.0 );\nvec3 spotSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 spotVector = lPosition.xyz + vViewPosition.xyz;\nfloat spotDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nspotDistance = 1.0 - min( ( length( spotVector ) / spotLightDistance[ i ] ), 1.0 );\nspotVector = normalize( spotVector );\nfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\nif ( spotEffect > spotLightAngleCos[ i ] ) {\nspotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );\n#ifdef WRAP_AROUND\nfloat spotDiffuseWeightFull = max( dot( normal, spotVector ), 0.0 );\nfloat spotDiffuseWeightHalf = max( 0.5 * dot( normal, spotVector ) + 0.5, 0.0 );\nvec3 spotDiffuseWeight = mix( vec3 ( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n#else\nfloat spotDiffuseWeight = max( dot( normal, spotVector ), 0.0 );\n#endif\nspotDiffuse += spotDistance * spotLightColor[ i ] * uDiffuseColor * spotDiffuseWeight * spotEffect;\nvec3 spotHalfVector = normalize( spotVector + viewPosition );\nfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\nfloat spotSpecularWeight = specularTex.r * max( pow( spotDotNormalHalf, uShininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( uShininess + 2.0001 ) / 8.0;\nvec3 schlick = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( spotVector, spotHalfVector ), 5.0 );\nspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * spotDistance * specularNormalization * spotEffect;\n#else\nspotSpecular += spotDistance * spotLightColor[ i ] * uSpecularColor * spotSpecularWeight * spotDiffuseWeight * spotEffect;\n#endif\n}\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\n#ifdef WRAP_AROUND\nfloat directionalLightWeightingFull = max( dot( normal, dirVector ), 0.0 );\nfloat directionalLightWeightingHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );\nvec3 dirDiffuseWeight = mix( vec3( directionalLightWeightingFull ), vec3( directionalLightWeightingHalf ), wrapRGB );\n#else\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\n#endif\ndirDiffuse += directionalLightColor[ i ] * uDiffuseColor * dirDiffuseWeight;\nvec3 dirHalfVector = normalize( dirVector + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, uShininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( uShininess + 2.0001 ) / 8.0;\nvec3 schlick = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n#else\ndirSpecular += directionalLightColor[ i ] * uSpecularColor * dirSpecularWeight * dirDiffuseWeight;\n#endif\n}\n#endif\n#if MAX_HEMI_LIGHTS > 0\nvec3 hemiDiffuse = vec3( 0.0 );\nvec3 hemiSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\nvec3 lVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( normal, lVector );\nfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\nvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\nhemiDiffuse += uDiffuseColor * hemiColor;\nvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\nfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\nfloat hemiSpecularWeightSky = specularTex.r * max( pow( hemiDotNormalHalfSky, uShininess ), 0.0 );\nvec3 lVectorGround = -lVector;\nvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\nfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\nfloat hemiSpecularWeightGround = specularTex.r * max( pow( hemiDotNormalHalfGround, uShininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat dotProductGround = dot( normal, lVectorGround );\nfloat specularNormalization = ( uShininess + 2.0001 ) / 8.0;\nvec3 schlickSky = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( lVector, hemiHalfVectorSky ), 5.0 );\nvec3 schlickGround = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 5.0 );\nhemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n#else\nhemiSpecular += uSpecularColor * hemiColor * ( hemiSpecularWeightSky + hemiSpecularWeightGround ) * hemiDiffuseWeight;\n#endif\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_HEMI_LIGHTS > 0\ntotalDiffuse += hemiDiffuse;\ntotalSpecular += hemiSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\n#if MAX_SPOT_LIGHTS > 0\ntotalDiffuse += spotDiffuse;\ntotalSpecular += spotSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * uAmbientColor + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * uAmbientColor ) + totalSpecular;\n#endif\nif ( enableReflection ) {\nvec3 vReflect;\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, normal, uRefractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, normal );\n}\nvec4 cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularTex.r * uReflectivity );\n}",
  341. THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["attribute vec4 tangent;\nuniform vec2 uOffset;\nuniform vec2 uRepeat;\nuniform bool enableDisplacement;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;",
  342. THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"#ifdef USE_SKINNING\nvNormal = normalize( normalMatrix * skinnedNormal.xyz );\nvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );\nvTangent = normalize( normalMatrix * skinnedTangent.xyz );\n#else\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\n#endif\nvBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );\nvUv = uv * uRepeat + uOffset;\nvec3 displacedPosition;\n#ifdef VERTEX_TEXTURES\nif ( enableDisplacement ) {\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\ndisplacedPosition = position + normalize( normal ) * df;\n} else {\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n}\n#else\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n#endif\nvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );\nvec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = worldPosition.xyz;\nvViewPosition = -mvPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif\n}"].join("\n")},
  343. cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vWorldPosition;\nvoid main() {\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvWorldPosition = worldPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\nvoid main() {\ngl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n}"},
  344. depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};THREE.WebGLRenderer=function(a){function b(a){if(a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)t.deleteBuffer(a.__webglCustomAttributesList[b].buffer)}function c(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function d(a){var b,c;for(b in a.attributes)c=a.attributes[b],c.buffer=t.createBuffer(),"index"===b?t.setStaticIndexBuffer(c.buffer,c.array):t.setStaticArrayBuffer(c.buffer,c.array)}function e(a,b){var c=a.attributes,
  345. d,e;for(d in c)e=c[d],e.needsUpdate&&("index"===d?t.setDynamicIndexBuffer(e.buffer,e.array):t.setDynamicArrayBuffer(e.buffer,e.array),e.needsUpdate=!1),b&&!e.dynamic&&delete e.array}function f(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function g(a,b){return b[0]-a[0]}function i(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)D=P=null,A=G=-1,N=!0,t.resetState(),a[d].render(b,c,t.getCurrentWidth(),t.getCurrentWidth()),D=P=null,A=G=-1,N=!0,t.resetState()}function h(a,b,c,d,e,f,g,i){var h,j,k,l;b?(j=
  346. a.length-1,l=b=-1):(j=0,b=a.length,l=1);for(var m=j;m!==b;m+=l)if(h=a[m],h.render){j=h.object;k=h.buffer;if(i)h=i;else{h=h[c];if(!h)continue;g&&t.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);t.setDepthTest(h.depthTest);t.setDepthWrite(h.depthWrite);t.setPolygonOffset(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}t.setMaterialFaces(h);k instanceof THREE.BufferGeometry?B.renderBufferDirect(d,e,f,h,k,j):B.renderBuffer(d,e,f,h,k,j)}}function j(a,b,c,d,e,f,g){for(var i,h,
  347. j=0,k=a.length;j<k;j++)if(i=a[j],h=i.object,h.visible){if(g)i=g;else{i=i[b];if(!i)continue;f&&t.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);t.setDepthTest(i.depthTest);t.setDepthWrite(i.depthWrite);t.setPolygonOffset(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}B.renderImmediateObject(c,d,e,i,h)}}function k(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,render:!1,z:0})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;
  348. return!1}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function r(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function v(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function p(a,b,c,d,e){s=0;d.needsUpdate&&(d.program&&W(d),B.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(B.maxMorphTargets));var f=!1,g=d.program,i=g.uniforms,h=d.uniforms;g!==P&&(t.useProgram(g),
  349. P=g,f=!0);d.id!==A&&(A=d.id,f=!0);if(f||a!==D)t.uniformMatrix4fv(i.projectionMatrix,a.projectionMatrix.elements),a!==D&&(D=a);if(d.skinning)if(t.supportsBoneTextures&&e.useVertexTexture){if(null!==i.boneTexture){var j=q();t.uniform1i(i.boneTexture,j);t.setTexture(e.boneTexture,j)}}else null!==i.boneGlobalMatrices&&t.uniformMatrix4fv(i.boneGlobalMatrices,e.boneMatrices);if(f){c&&d.fog&&(h.fogColor.value=c.color,c instanceof THREE.Fog?(h.fogNear.value=c.near,h.fogFar.value=c.far):c instanceof THREE.FogExp2&&
  350. (h.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(N){for(var k,l=j=0,m=0,n,p,r,v=R,x=v.directional.colors,y=v.directional.positions,C=v.point.colors,E=v.point.positions,G=v.point.distances,F=v.spot.colors,H=v.spot.positions,I=v.spot.distances,J=v.spot.directions,O=v.spot.anglesCos,Y=v.spot.exponents,$=v.hemi.skyColors,fa=v.hemi.groundColors,oa=v.hemi.positions,Da=0,Ba=0,ga=0,xa=0,Ca=0,Ea=0,ma=0,za=0,ha=k=0,c=r=ha=0,f=b.length;c<
  351. f;c++)k=b[c],k.onlyShadow||(n=k.color,p=k.intensity,r=k.distance,k instanceof THREE.AmbientLight?k.visible&&(B.gammaInput?(j+=n.r*n.r,l+=n.g*n.g,m+=n.b*n.b):(j+=n.r,l+=n.g,m+=n.b)):k instanceof THREE.DirectionalLight?(Ca+=1,k.visible&&(w.getPositionFromMatrix(k.matrixWorld),K.getPositionFromMatrix(k.target.matrixWorld),w.sub(K),w.normalize(),0===w.x&&0===w.y&&0===w.z||(k=3*Da,y[k]=w.x,y[k+1]=w.y,y[k+2]=w.z,B.gammaInput?u(x,k,n,p*p):z(x,k,n,p),Da+=1))):k instanceof THREE.PointLight?(Ea+=1,k.visible&&
  352. (ha=3*Ba,B.gammaInput?u(C,ha,n,p*p):z(C,ha,n,p),K.getPositionFromMatrix(k.matrixWorld),E[ha]=K.x,E[ha+1]=K.y,E[ha+2]=K.z,G[Ba]=r,Ba+=1)):k instanceof THREE.SpotLight?(ma+=1,k.visible&&(ha=3*ga,B.gammaInput?u(F,ha,n,p*p):z(F,ha,n,p),K.getPositionFromMatrix(k.matrixWorld),H[ha]=K.x,H[ha+1]=K.y,H[ha+2]=K.z,I[ga]=r,w.copy(K),K.getPositionFromMatrix(k.target.matrixWorld),w.sub(K),w.normalize(),J[ha]=w.x,J[ha+1]=w.y,J[ha+2]=w.z,O[ga]=Math.cos(k.angle),Y[ga]=k.exponent,ga+=1)):k instanceof THREE.HemisphereLight&&
  353. (za+=1,k.visible&&(w.getPositionFromMatrix(k.matrixWorld),w.normalize(),0===w.x&&0===w.y&&0===w.z||(r=3*xa,oa[r]=w.x,oa[r+1]=w.y,oa[r+2]=w.z,n=k.color,k=k.groundColor,B.gammaInput?(p*=p,u($,r,n,p),u(fa,r,k,p)):(z($,r,n,p),z(fa,r,k,p)),xa+=1))));c=3*Da;for(f=Math.max(x.length,3*Ca);c<f;c++)x[c]=0;c=3*Ba;for(f=Math.max(C.length,3*Ea);c<f;c++)C[c]=0;c=3*ga;for(f=Math.max(F.length,3*ma);c<f;c++)F[c]=0;c=3*xa;for(f=Math.max($.length,3*za);c<f;c++)$[c]=0;c=3*xa;for(f=Math.max(fa.length,3*za);c<f;c++)fa[c]=
  354. 0;v.directional.length=Da;v.point.length=Ba;v.spot.length=ga;v.hemi.length=xa;v.ambient[0]=j;v.ambient[1]=l;v.ambient[2]=m;N=!1}c=R;h.ambientLightColor.value=c.ambient;h.directionalLightColor.value=c.directional.colors;h.directionalLightDirection.value=c.directional.positions;h.pointLightColor.value=c.point.colors;h.pointLightPosition.value=c.point.positions;h.pointLightDistance.value=c.point.distances;h.spotLightColor.value=c.spot.colors;h.spotLightPosition.value=c.spot.positions;h.spotLightDistance.value=
  355. c.spot.distances;h.spotLightDirection.value=c.spot.directions;h.spotLightAngleCos.value=c.spot.anglesCos;h.spotLightExponent.value=c.spot.exponents;h.hemisphereLightSkyColor.value=c.hemi.skyColors;h.hemisphereLightGroundColor.value=c.hemi.groundColors;h.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){h.opacity.value=d.opacity;B.gammaInput?h.diffuse.value.copyGammaToLinear(d.color):
  356. h.diffuse.value=d.color;h.map.value=d.map;h.lightMap.value=d.lightMap;h.specularMap.value=d.specularMap;d.bumpMap&&(h.bumpMap.value=d.bumpMap,h.bumpScale.value=d.bumpScale);d.normalMap&&(h.normalMap.value=d.normalMap,h.normalScale.value.copy(d.normalScale));var Q;d.map?Q=d.map:d.specularMap?Q=d.specularMap:d.normalMap?Q=d.normalMap:d.bumpMap&&(Q=d.bumpMap);void 0!==Q&&(c=Q.offset,Q=Q.repeat,h.offsetRepeat.value.set(c.x,c.y,Q.x,Q.y));h.envMap.value=d.envMap;h.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?
  357. 1:-1;h.reflectivity.value=d.reflectivity;h.refractionRatio.value=d.refractionRatio;h.combine.value=d.combine;h.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(h.diffuse.value=d.color,h.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(h.diffuse.value=d.color,h.opacity.value=d.opacity,h.dashSize.value=d.dashSize,h.totalSize.value=d.dashSize+d.gapSize,h.scale.value=d.scale):d instanceof THREE.ParticleBasicMaterial?
  358. (h.psColor.value=d.color,h.opacity.value=d.opacity,h.size.value=d.size,h.scale.value=t.getDomElement().height/2,h.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(h.shininess.value=d.shininess,B.gammaInput?(h.ambient.value.copyGammaToLinear(d.ambient),h.emissive.value.copyGammaToLinear(d.emissive),h.specular.value.copyGammaToLinear(d.specular)):(h.ambient.value=d.ambient,h.emissive.value=d.emissive,h.specular.value=d.specular),d.wrapAround&&h.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?
  359. (B.gammaInput?(h.ambient.value.copyGammaToLinear(d.ambient),h.emissive.value.copyGammaToLinear(d.emissive)):(h.ambient.value=d.ambient,h.emissive.value=d.emissive),d.wrapAround&&h.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(h.mNear.value=a.near,h.mFar.value=a.far,h.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(h.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&h.shadowMatrix){c=Q=0;for(f=b.length;c<f;c++)if(j=b[c],j.castShadow&&(j instanceof
  360. THREE.SpotLight||j instanceof THREE.DirectionalLight&&!j.shadowCascade))h.shadowMap.value[Q]=j.shadowMap,h.shadowMapSize.value[Q]=j.shadowMapSize,h.shadowMatrix.value[Q]=j.shadowMatrix,h.shadowDarkness.value[Q]=j.shadowDarkness,h.shadowBias.value[Q]=j.shadowBias,Q++}b=d.uniformsList;c=0;for(f=b.length;c<f;c++)if(Q=g.uniforms[b[c][1]])if(h=b[c][0],j=h.type,m=h.value,"i"===j)t.uniform1i(Q,m);else if("f"===j)t.uniform1f(Q,m);else if("v2"===j)t.uniform2f(Q,m.x,m.y);else if("v3"===j)t.uniform3f(Q,m.x,
  361. m.y,m.z);else if("v4"===j)t.uniform4f(Q,m.x,m.y,m.z,m.w);else if("c"===j)t.uniform3f(Q,m.r,m.g,m.b);else if("iv1"===j)t.uniform1iv(Q,m);else if("iv"===j)t.uniform3iv(Q,m);else if("fv1"===j)t.uniform1fv(Q,m);else if("fv"===j)t.uniform3fv(Q,m);else if("v2v"===j){void 0===h._array&&(h._array=new Float32Array(2*m.length));j=0;for(l=m.length;j<l;j++)v=2*j,h._array[v]=m[j].x,h._array[v+1]=m[j].y;t.uniform2fv(Q,h._array)}else if("v3v"===j){void 0===h._array&&(h._array=new Float32Array(3*m.length));j=0;for(l=
  362. m.length;j<l;j++)v=3*j,h._array[v]=m[j].x,h._array[v+1]=m[j].y,h._array[v+2]=m[j].z;t.uniform3fv(Q,h._array)}else if("v4v"===j){void 0===h._array&&(h._array=new Float32Array(4*m.length));j=0;for(l=m.length;j<l;j++)v=4*j,h._array[v]=m[j].x,h._array[v+1]=m[j].y,h._array[v+2]=m[j].z,h._array[v+3]=m[j].w;t.uniform4fv(Q,h._array)}else if("m4"===j)void 0===h._array&&(h._array=new Float32Array(16)),m.flattenToArray(h._array),t.uniformMatrix4fv(Q,h._array);else if("m4v"===j){void 0===h._array&&(h._array=
  363. new Float32Array(16*m.length));j=0;for(l=m.length;j<l;j++)m[j].flattenToArrayOffset(h._array,16*j);t.uniformMatrix4fv(Q,h._array)}else if("t"===j)v=q(),t.uniform1i(Q,v),m&&(m.image instanceof Array&&6===m.image.length?t.setCubeTexture(m,v):m instanceof THREE.WebGLRenderTargetCube?t.setCubeTextureDynamic(m,v):t.setTexture(m,v));else if("tv"===j){void 0===h._array&&(h._array=[]);j=0;for(l=h.value.length;j<l;j++)h._array[j]=q();t.uniform1iv(Q,h._array);j=0;for(l=h.value.length;j<l;j++)m=h.value[j],v=
  364. h._array[j],m&&t.setTexture(m,v)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==i.cameraPosition)K.getPositionFromMatrix(a.matrixWorld),t.uniform3f(i.cameraPosition,K.x,K.y,K.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==i.viewMatrix&&t.uniformMatrix4fv(i.viewMatrix,a.matrixWorldInverse.elements)}t.uniformMatrix4fv(i.modelViewMatrix,e._modelViewMatrix.elements);
  365. i.normalMatrix&&t.uniformMatrix3fv(i.normalMatrix,e._normalMatrix.elements);null!==i.modelMatrix&&t.uniformMatrix4fv(i.modelMatrix,e.matrixWorld.elements);return g}function q(){var a=s;a>=t.maxTextures&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+t.maxTextures);s+=1;return a}function x(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function u(a,
  366. b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function z(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},y={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}},t=new THREE.WebGLRenderer.LowLevelRenderer(a),C=new THREE.WebGLRenderer.MeshRenderer(t,y),E=new THREE.WebGLRenderer.ParticleRenderer(t,y),l=new THREE.WebGLRenderer.LineRenderer(t,y),I=new THREE.WebGLRenderer.RibbonRenderer(t,y),J=new THREE.WebGLRenderer.ShaderBuilder(t,
  367. y);this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=
  368. [];this.info=y;var B=this,P=null,A=-1,G=null,D=null,H=0,s=0,F=new THREE.Frustum,O=new THREE.Matrix4;new THREE.Matrix4;var K=new THREE.Vector3,w=new THREE.Vector3,N=!0,R={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}};this.context=t.getContext();this.domElement=t.getDomElement();this.getPrecision=
  369. this.getPrecision=t.getPrecision;this.getContext=t.getContext;this.supportsVertexTextures=t.supportsVertexTextures;this.supportsFloatTextures=t.supportsFloatTextures;this.supportsStandardDerivatives=t.supportsStandardDerivatives;this.supportsCompressedTextureS3TC=t.supportsCompressedTextureS3TC;this.getMaxAnisotropy=t.getMaxAnisotropy;this.setSize=t.setSize;this.setViewport=t.setViewport;this.setScissor=t.setScissor;this.enableScissorTest=t.enableScissorTest;this.setDepthWrite=t.setDepthWrite;this.setDepthTest=
  370. t.setDepthTest;this.setRenderTarget=t.setRenderTarget;this.setBlending=t.setBlending;this.setTexture=t.setTexture;this.setMaterialFaces=t.setMaterialFaces;this.setFaceCulling=t.setFaceCulling;this.setClearColorHex=t.setClearColorHex;this.setClearColor=t.setClearColor;this.getClearColor=t.getClearColor;this.getClearAlpha=t.getClearAlpha;this.clear=t.clear;this.clearTarget=t.clearTarget;this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);
  371. this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){P=null;A=G=-1;N=!0;t.resetState();this.shadowMapPlugin.update(a,b)};var $=function(a){a=a.target;a.removeEventListener("dispose",$);var c,d;a.__webglInit=void 0;void 0!==a.__webglVertexBuffer&&t.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&t.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&t.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&t.deleteBuffer(a.__webglColorBuffer);
  372. void 0!==a.__webglUVBuffer&&t.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&t.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&t.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&t.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&t.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&t.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&t.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==
  373. a.geometryGroups)for(var e in a.geometryGroups){var f=a.geometryGroups[e];if(void 0!==f.numMorphTargets){c=0;for(d=f.numMorphTargets;c<d;c++)t.deleteBuffer(f.__webglMorphTargetsBuffers[c])}if(void 0!==f.numMorphNormals){c=0;for(d=f.numMorphNormals;c<d;c++)t.deleteBuffer(f.__webglMorphNormalsBuffers[c])}b(f)}b(a);B.info.memory.geometries--},Y=function(a){a=a.target;a.removeEventListener("dispose",Y);W(a)},W=function(a){var b=a.program;void 0!==b&&(a.program=void 0,J.removeProgram(b))};this.renderBufferImmediate=
  374. function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=t.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=t.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=t.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=t.createBuffer());a.hasPositions&&(t.setDynamicArrayBuffer(a.__webglVertexBuffer,a.positionArray),t.setFloatAttribute(b.attributes.position,a.__webglVertexBuffer,3,0));if(a.hasNormals){if(c.shading===
  375. THREE.FlatShading){var d,e,f,g,h,i,j,k,l,m,n,p=3*a.count;for(n=0;n<p;n+=9)m=a.normalArray,d=m[n],e=m[n+1],f=m[n+2],g=m[n+3],i=m[n+4],k=m[n+5],h=m[n+6],j=m[n+7],l=m[n+8],d=(d+g+h)/3,e=(e+i+j)/3,f=(f+k+l)/3,m[n]=d,m[n+1]=e,m[n+2]=f,m[n+3]=d,m[n+4]=e,m[n+5]=f,m[n+6]=d,m[n+7]=e,m[n+8]=f}t.setDynamicArrayBuffer(a.__webglNormalBuffer,a.normalArray);t.setFloatAttribute(b.attributes.normal,a.__webglNormalBuffer,3,0)}a.hasUvs&&c.map&&(t.setDynamicArrayBuffer(a.__webglUvBuffer,a.uvArray),t.setFloatAttribute(b.attributes.uv,
  376. a.__webglUvBuffer,2,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(t.setDynamicArrayBuffer(a.__webglColorBuffer,a.colorArray),t.setFloatAttribute(b.attributes.color,a.__webglColorBuffer,3,0));t.drawTriangles(a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var g,h,i;g=p(a,b,c,d,f);a=g.attributes;b=e.attributes;c=!1;g=16777215*e.id+2*g.id+(d.wireframe?1:0);g!==G&&(G=g,c=!0);c&&t.disableAttributes();if(f instanceof THREE.Mesh)if(d=b.index){e=e.offsets;1<e.length&&
  377. (c=!0);for(var j=0,k=e.length;j<k;j++){var l=e[j].index;if(c)for(h in b)"index"!==h&&(g=a[h],f=b[h],i=f.itemSize,0<=g&&t.setFloatAttribute(g,f.buffer,i,4*l*i));t.drawTriangleElements(d.buffer,e[j].count,2*e[j].start);B.info.render.calls++;B.info.render.vertices+=e[j].count;B.info.render.faces+=e[j].count/3}}else{if(c)for(h in b)g=a[h],f=b[h],i=f.itemSize,0<=g&&t.setFloatAttribute(g,f.buffer,i,0);h=e.attributes.position;t.drawTriangles(h.numItems/3);B.info.render.calls++;B.info.render.vertices+=h.numItems/
  378. 3;B.info.render.faces+=h.numItems/3/3}else if(f instanceof THREE.ParticleSystem){if(c){for(h in b)g=a[h],f=b[h],i=f.itemSize,0<=g&&t.setFloatAttribute(g,f.buffer,i,0);h=b.position;t.drawPoints(h.numItems/3);B.info.render.calls++;B.info.render.points+=h.numItems/3}}else if(f instanceof THREE.Line&&c){for(h in b)g=a[h],f=b[h],i=f.itemSize,0<=g&&t.setFloatAttribute(g,f.buffer,i,0);h=b.position;t.setLineWidth(d.linewidth);t.drawLineStrip(h.numItems/3);B.info.render.calls++;B.info.render.points+=h.numItems}}};
  379. this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var h,c=p(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==G&&(G=c,b=!0);b&&t.disableAttributes();if(!d.morphTargets&&0<=a.position)b&&t.setFloatAttribute(a.position,e.__webglVertexBuffer,3,0);else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?t.setFloatAttribute(c.position,e.__webglMorphTargetsBuffers[f.morphTargetBase],3,0):0<=c.position&&t.setFloatAttribute(c.position,e.__webglVertexBuffer,
  380. 3,0);if(f.morphTargetForcedOrder.length){var i=0,j=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;i<d.numSupportedMorphTargets&&i<j.length;)0<=c["morphTarget"+i]&&t.setFloatAttribute(c["morphTarget"+i],e.__webglMorphTargetsBuffers[j[i]],3,0),0<=c["morphNormal"+i]&&d.morphNormals&&t.setFloatAttribute(c["morphNormal"+i],e.__webglMorphNormalsBuffers[j[i]],3,0),f.__webglMorphTargetInfluences[i]=h[j[i]],i++}else{j=[];h=f.morphTargetInfluences;var k,l=h.length;for(k=0;k<l;k++)i=h[k],0<i&&j.push([i,
  381. k]);j.length>d.numSupportedMorphTargets?(j.sort(g),j.length=d.numSupportedMorphTargets):j.length>d.numSupportedMorphNormals?j.sort(g):0===j.length&&j.push([0,0]);for(i=0;i<d.numSupportedMorphTargets;)j[i]?(k=j[i][1],0<=c["morphTarget"+i]&&t.setFloatAttribute(c["morphTarget"+i],e.__webglMorphTargetsBuffers[k],3,0),0<=c["morphNormal"+i]&&d.morphNormals&&t.setFloatAttribute(c["morphNormal"+i],e.__webglMorphNormalsBuffers[k],3,0),f.__webglMorphTargetInfluences[i]=h[k]):f.__webglMorphTargetInfluences[i]=
  382. 0,i++}null!==d.program.uniforms.morphTargetInfluences&&t.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){c=0;for(h=e.__webglCustomAttributesList.length;c<h;c++)b=e.__webglCustomAttributesList[c],0<=a[b.buffer.belongsToAttribute]&&t.setFloatAttribute(a[b.buffer.belongsToAttribute],b.buffer,b.size,0)}0<=a.color&&t.setFloatAttribute(a.color,e.__webglColorBuffer,3,0);0<=a.normal&&t.setFloatAttribute(a.normal,e.__webglNormalBuffer,
  383. 3,0);0<=a.tangent&&t.setFloatAttribute(a.tangent,e.__webglTangentBuffer,4,0);0<=a.uv&&t.setFloatAttribute(a.uv,e.__webglUVBuffer,2,0);0<=a.uv2&&t.setFloatAttribute(a.uv2,e.__webglUV2Buffer,2,0);d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(t.setFloatAttribute(a.skinIndex,e.__webglSkinIndicesBuffer,4,0),t.setFloatAttribute(a.skinWeight,e.__webglSkinWeightsBuffer,4,0));0<=a.lineDistance&&t.setFloatAttribute(a.lineDistance,e.__webglLineDistanceBuffer,1,0)}f instanceof THREE.Mesh?(d.wireframe?(t.setLineWidth(d.wireframeLinewidth),
  384. t.drawLineElements(e.__webglLineBuffer,e.__webglLineCount,0)):t.drawTriangleElements(e.__webglFaceBuffer,e.__webglFaceCount,0),B.info.render.calls++,B.info.render.vertices+=e.__webglFaceCount,B.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(t.setLineWidth(d.linewidth),f.type===THREE.LineStrip?t.drawLineStrip(e.__webglLineCount):t.drawLines(e.__webglLineCount),B.info.render.calls++):f instanceof THREE.ParticleSystem?(t.drawPoints(e.__webglParticleCount),B.info.render.calls++,B.info.render.points+=
  385. e.__webglParticleCount):f instanceof THREE.Ribbon&&(t.drawTriangleStrip(e.__webglVertexCount),B.info.render.calls++)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,g,k,l,m=a.__lights,n=a.fog;A=-1;N=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);O.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);
  386. F.setFromMatrix(O);this.autoUpdateObjects&&this.initWebGLObjects(a);i(this.renderPluginsPre,a,b);B.info.render.calls=0;B.info.render.vertices=0;B.info.render.faces=0;B.info.render.points=0;t.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;d=0;for(e=l.length;d<e;d++)if(g=l[d],k=g.object,g.id=d,g.render=!1,k.visible&&(!(k instanceof THREE.Mesh||k instanceof THREE.ParticleSystem)||!k.frustumCulled||F.intersectsObject(k))){x(k,
  387. b);var p=g,r=p.buffer,q=void 0,s=q=void 0,s=p.object.material;if(s instanceof THREE.MeshFaceMaterial)q=r.materialIndex,q=s.materials[q],q.transparent?(p.transparent=q,p.opaque=null):(p.opaque=q,p.transparent=null);else if(q=s)q.transparent?(p.transparent=q,p.opaque=null):(p.opaque=q,p.transparent=null);g.render=!0;!0===this.sortObjects&&(null!==k.renderDepth?g.z=k.renderDepth:(K.getPositionFromMatrix(k.matrixWorld),K.applyProjection(O),g.z=K.z))}this.sortObjects&&l.sort(f);l=a.__webglObjectsImmediate;
  388. d=0;for(e=l.length;d<e;d++)g=l[d],k=g.object,k.visible&&(x(k,b),k=g.object.material,k.transparent?(g.transparent=k,g.opaque=null):(g.opaque=k,g.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,t.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),t.setDepthTest(d.depthTest),t.setDepthWrite(d.depthWrite),t.setPolygonOffset(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),h(a.__webglObjects,!1,"",b,m,n,!0,d),j(a.__webglObjectsImmediate,"",b,m,n,!1,d)):(d=null,t.setBlending(THREE.NoBlending),
  389. h(a.__webglObjects,!0,"opaque",b,m,n,!1,d),j(a.__webglObjectsImmediate,"opaque",b,m,n,!1,d),h(a.__webglObjects,!1,"transparent",b,m,n,!0,d),j(a.__webglObjectsImmediate,"transparent",b,m,n,!0,d));i(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&t.updateRenderTargetMipmap(c);t.setDepthTest(!0);t.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=p(a,b,c,d,e);G=-1;t.setMaterialFaces(d);e.immediateRenderCallback?
  390. e.immediateRenderCallback(f,t.getContext(),F):e.render(function(a){B.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var b=a.__objectsAdded[0],f=a,g=void 0,h=void 0,i=void 0,j=void 0;if(!b.__webglInit)if(b.__webglInit=!0,b._modelViewMatrix=new THREE.Matrix4,b._normalMatrix=new THREE.Matrix3,void 0!==b.geometry&&void 0===b.geometry.__webglInit&&
  391. (b.geometry.__webglInit=!0,b.geometry.addEventListener("dispose",$)),b instanceof THREE.Mesh)if(h=b.geometry,i=b.material,h instanceof THREE.Geometry){if(void 0===h.geometryGroups){var j=h,p=void 0,q=void 0,L=void 0,s=void 0,t=void 0,u=void 0,x={},w=j.morphTargets.length,y=j.morphNormals.length,i=i instanceof THREE.MeshFaceMaterial;j.geometryGroups={};p=0;for(q=j.faces.length;p<q;p++)L=j.faces[p],s=i?L.materialIndex:0,void 0===x[s]&&(x[s]={hash:s,counter:0}),u=x[s].hash+"_"+x[s].counter,void 0===
  392. j.geometryGroups[u]&&(j.geometryGroups[u]={faces3:[],faces4:[],materialIndex:s,vertices:0,numMorphTargets:w,numMorphNormals:y}),t=L instanceof THREE.Face3?3:4,65535<j.geometryGroups[u].vertices+t&&(x[s].counter+=1,u=x[s].hash+"_"+x[s].counter,void 0===j.geometryGroups[u]&&(j.geometryGroups[u]={faces3:[],faces4:[],materialIndex:s,vertices:0,numMorphTargets:w,numMorphNormals:y})),L instanceof THREE.Face3?j.geometryGroups[u].faces3.push(p):j.geometryGroups[u].faces4.push(p),j.geometryGroups[u].vertices+=
  393. t;j.geometryGroupsList=[];p=void 0;for(p in j.geometryGroups)j.geometryGroups[p].id=H++,j.geometryGroupsList.push(j.geometryGroups[p])}for(g in h.geometryGroups)j=h.geometryGroups[g],j.__webglVertexBuffer||(C.createBuffers(j),C.initBuffers(j,b),h.verticesNeedUpdate=!0,h.morphTargetsNeedUpdate=!0,h.elementsNeedUpdate=!0,h.uvsNeedUpdate=!0,h.normalsNeedUpdate=!0,h.tangentsNeedUpdate=!0,h.colorsNeedUpdate=!0)}else h instanceof THREE.BufferGeometry&&d(h);else b instanceof THREE.Ribbon?(h=b.geometry,h.__webglVertexBuffer||
  394. (I.createBuffers(h),I.initBuffers(h,b),h.verticesNeedUpdate=!0,h.colorsNeedUpdate=!0,h.normalsNeedUpdate=!0)):b instanceof THREE.Line?(h=b.geometry,h.__webglVertexBuffer||(h instanceof THREE.Geometry?(l.createBuffers(h),l.initBuffers(h,b),h.verticesNeedUpdate=!0,h.colorsNeedUpdate=!0,h.lineDistancesNeedUpdate=!0):h instanceof THREE.BufferGeometry&&d(h))):b instanceof THREE.ParticleSystem&&(h=b.geometry,h.__webglVertexBuffer||(h instanceof THREE.Geometry?(E.createBuffers(h),E.initBuffers(h,b),h.verticesNeedUpdate=
  395. !0,h.colorsNeedUpdate=!0):h instanceof THREE.BufferGeometry&&d(h)));if(!b.__webglActive){if(b instanceof THREE.Mesh)if(h=b.geometry,h instanceof THREE.BufferGeometry)k(f.__webglObjects,h,b);else{if(h instanceof THREE.Geometry)for(g in h.geometryGroups)j=h.geometryGroups[g],k(f.__webglObjects,j,b)}else b instanceof THREE.Ribbon||b instanceof THREE.Line||b instanceof THREE.ParticleSystem?(h=b.geometry,k(f.__webglObjects,h,b)):b instanceof THREE.ImmediateRenderObject||b.immediateRenderCallback?f.__webglObjectsImmediate.push({object:b,
  396. opaque:null,transparent:null}):b instanceof THREE.Sprite?f.__webglSprites.push(b):b instanceof THREE.LensFlare&&f.__webglFlares.push(b);b.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)b=a.__objectsRemoved[0],f=a,b instanceof THREE.Mesh||b instanceof THREE.ParticleSystem||b instanceof THREE.Ribbon||b instanceof THREE.Line?r(f.__webglObjects,b):b instanceof THREE.Sprite?v(f.__webglSprites,b):b instanceof THREE.LensFlare?v(f.__webglFlares,b):(b instanceof THREE.ImmediateRenderObject||
  397. b.immediateRenderCallback)&&r(f.__webglObjectsImmediate,b),b.__webglActive=!1,a.__objectsRemoved.splice(0,1);b=0;for(f=a.__webglObjects.length;b<f;b++)if(g=a.__webglObjects[b].object,h=g.geometry,q=p=j=void 0,g instanceof THREE.Mesh)if(h instanceof THREE.BufferGeometry)(h.verticesNeedUpdate||h.elementsNeedUpdate||h.uvsNeedUpdate||h.normalsNeedUpdate||h.colorsNeedUpdate||h.tangentsNeedUpdate)&&e(h,!h.dynamic),h.verticesNeedUpdate=!1,h.elementsNeedUpdate=!1,h.uvsNeedUpdate=!1,h.normalsNeedUpdate=!1,
  398. h.colorsNeedUpdate=!1,h.tangentsNeedUpdate=!1;else{L=0;for(s=h.geometryGroupsList.length;L<s;L++)j=h.geometryGroupsList[L],q=c(g,j),h.buffersNeedUpdate&&C.initBuffers(j,g),p=q.attributes&&n(q),(h.verticesNeedUpdate||h.morphTargetsNeedUpdate||h.elementsNeedUpdate||h.uvsNeedUpdate||h.normalsNeedUpdate||h.colorsNeedUpdate||h.tangentsNeedUpdate||p)&&C.setBuffers(j,g,!h.dynamic,q);h.verticesNeedUpdate=!1;h.morphTargetsNeedUpdate=!1;h.elementsNeedUpdate=!1;h.uvsNeedUpdate=!1;h.normalsNeedUpdate=!1;h.colorsNeedUpdate=
  399. !1;h.tangentsNeedUpdate=!1;h.buffersNeedUpdate=!1;q.attributes&&m(q)}else g instanceof THREE.Ribbon?(q=c(g,h),p=q.attributes&&n(q),(h.verticesNeedUpdate||h.colorsNeedUpdate||h.normalsNeedUpdate||p)&&I.setBuffers(h),h.verticesNeedUpdate=!1,h.colorsNeedUpdate=!1,h.normalsNeedUpdate=!1,q.attributes&&m(q)):g instanceof THREE.Line?h instanceof THREE.BufferGeometry?((h.verticesNeedUpdate||h.colorsNeedUpdate)&&e(h,!h.dynamic),h.verticesNeedUpdate=!1,h.colorsNeedUpdate=!1):(q=c(g,h),p=q.attributes&&n(q),
  400. (h.verticesNeedUpdate||h.colorsNeedUpdate||h.lineDistancesNeedUpdate||p)&&l.setBuffers(h),h.verticesNeedUpdate=!1,h.colorsNeedUpdate=!1,h.lineDistancesNeedUpdate=!1,q.attributes&&m(q)):g instanceof THREE.ParticleSystem&&(h instanceof THREE.BufferGeometry?((h.verticesNeedUpdate||h.colorsNeedUpdate)&&e(h,!h.dynamic),h.verticesNeedUpdate=!1,h.colorsNeedUpdate=!1):(q=c(g,h),p=q.attributes&&n(q),(h.verticesNeedUpdate||h.colorsNeedUpdate||g.sortParticles||p)&&E.setBuffers(h,g,O),h.verticesNeedUpdate=!1,
  401. h.colorsNeedUpdate=!1,q.attributes&&m(q)))};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",Y);var i,j,k;a instanceof THREE.MeshDepthMaterial?k="depth":a instanceof THREE.MeshNormalMaterial?k="normal":a instanceof THREE.MeshBasicMaterial?k="basic":a instanceof THREE.MeshLambertMaterial?k="lambert":a instanceof THREE.MeshPhongMaterial?k="phong":a instanceof THREE.LineBasicMaterial?k="basic":a instanceof THREE.LineDashedMaterial?k="dashed":a instanceof THREE.ParticleBasicMaterial&&
  402. (k="particle_basic");k&&(e=THREE.ShaderLib[k],a.uniforms=THREE.UniformsUtils.clone(e.uniforms),a.vertexShader=e.vertexShader,a.fragmentShader=e.fragmentShader);var l,m;e=m=f=g=h=0;for(j=b.length;e<j;e++)l=b[e],l.onlyShadow||(l instanceof THREE.DirectionalLight&&m++,l instanceof THREE.PointLight&&f++,l instanceof THREE.SpotLight&&g++,l instanceof THREE.HemisphereLight&&h++);e=m;var n=0;j=0;for(l=b.length;j<l;j++)m=b[j],m.castShadow&&(m instanceof THREE.SpotLight&&n++,m instanceof THREE.DirectionalLight&&
  403. !m.shadowCascade&&n++);b=n;t.supportsBoneTextures&&d&&d.useVertexTexture?j=1024:(j=Math.floor((t.maxVertexUniformVectors-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(j=Math.min(d.bones.length,j),j<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+j+" (try OpenGL instead of ANGLE)")));a.program=J.buildProgram(k,a.fragmentShader,a.vertexShader,a.uniforms,a.attributes,a.defines,{map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,
  404. normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:j,useVertexTexture:t.supportsBoneTextures&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,
  405. maxSpotLights:g,maxHemiLights:h,maxShadows:b,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide,gammaInput:this.gammaInput,gammaOutput:this.gammaOutput,physicallyBasedShading:this.physicallyBasedShading});d=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=
  406. 0;b="morphTarget";for(c=0;c<this.maxMorphTargets;c++)k=b+c,0<=d[k]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(c=0;c<this.maxMorphNormals;c++)k=b+c,0<=d[k]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderer.LowLevelRenderer=function(a){function b(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?l.NEAREST:l.LINEAR}function c(a,b,c,d){M=void 0!==a?a:0;la=void 0!==b?b:0;na=void 0!==c?c:r.width;qa=void 0!==d?d:r.height;l.viewport(M,la,na,qa)}function d(a,b,c){var d=0;if(void 0===a||a)d|=l.COLOR_BUFFER_BIT;if(void 0===b||b)d|=l.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)}function e(a){aa!=a&&(l.bindBuffer(l.ARRAY_BUFFER,
  407. a),aa=a)}function f(a){aa!=a&&(l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a),aa=a)}function g(a){s[a]||(l.enableVertexAttribArray(a),s[a]=!0)}function i(a,c,d){d?(l.texParameteri(a,l.TEXTURE_WRAP_S,k(c.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,k(c.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,k(c.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,k(c.minFilter))):(l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_MAG_FILTER,
  408. b(c.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,b(c.minFilter)));if(B&&c.type!==THREE.FloatType&&(1<c.anisotropy||c.__oldAnisotropy))l.texParameterf(a,B.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(c.anisotropy,D)),c.__oldAnisotropy=c.anisotropy}function h(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?
  409. (l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)):l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function j(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.__webglTexture=l.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=k(a.format),
  410. e=k(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);i(l.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=l.createFramebuffer();a.__webglRenderbuffer[f]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,j=l.TEXTURE_CUBE_MAP_POSITIVE_X+f;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[f]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,j,g.__webglTexture,
  411. 0);h(a.__webglRenderbuffer[f],a)}c&&l.generateMipmap(l.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),i(l.TEXTURE_2D,a,c),l.texImage2D(l.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?
  412. a.depthBuffer&&!a.stencilBuffer?l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):h(a.__webglRenderbuffer,a),c&&l.generateMipmap(l.TEXTURE_2D);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:
  413. a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=na,a=qa,d=M,e=la);b!==T&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,e,c,a),T=b);C=c;E=a}function k(a){if(a===THREE.RepeatWrapping)return l.REPEAT;if(a===THREE.ClampToEdgeWrapping)return l.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return l.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return l.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return l.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return l.NEAREST_MIPMAP_LINEAR;
  414. if(a===THREE.LinearFilter)return l.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return l.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return l.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return l.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return l.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return l.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return l.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return l.BYTE;if(a===THREE.ShortType)return l.SHORT;
  415. if(a===THREE.UnsignedShortType)return l.UNSIGNED_SHORT;if(a===THREE.IntType)return l.INT;if(a===THREE.UnsignedIntType)return l.UNSIGNED_INT;if(a===THREE.FloatType)return l.FLOAT;if(a===THREE.AlphaFormat)return l.ALPHA;if(a===THREE.RGBFormat)return l.RGB;if(a===THREE.RGBAFormat)return l.RGBA;if(a===THREE.LuminanceFormat)return l.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return l.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return l.FUNC_ADD;if(a===THREE.SubtractEquation)return l.FUNC_SUBTRACT;if(a===
  416. THREE.ReverseSubtractEquation)return l.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return l.ZERO;if(a===THREE.OneFactor)return l.ONE;if(a===THREE.SrcColorFactor)return l.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return l.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return l.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return l.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return l.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return l.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return l.DST_COLOR;
  417. if(a===THREE.OneMinusDstColorFactor)return l.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return l.SRC_ALPHA_SATURATE;if(void 0!==P){if(a===THREE.RGB_S3TC_DXT1_Format)return P.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return P.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return P.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return P.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}function n(a,b){var c;"fragment"===a?c=l.createShader(l.FRAGMENT_SHADER):
  418. "vertex"===a&&(c=l.createShader(l.VERTEX_SHADER));l.shaderSource(c,b);l.compileShader(c);return!l.getShaderParameter(c,l.COMPILE_STATUS)?(console.error(l.getShaderInfoLog(c)),console.error(m(b)),null):c}function m(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}var a=a||{},r=void 0!==a.canvas?a.canvas:document.createElement("canvas"),v=void 0!==a.precision?a.precision:"highp",p=void 0!==a.alpha?a.alpha:!0,q=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:
  419. !0,x=void 0!==a.antialias?a.antialias:!1,u=void 0!==a.stencil?a.stencil:!0,z=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,y=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),t=void 0!==a.clearAlpha?a.clearAlpha:0;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;var C=0,E=0,l,I,J,B,P;try{if(!(l=r.getContext("experimental-webgl",{alpha:p,premultipliedAlpha:q,antialias:x,stencil:u,preserveDrawingBuffer:z})))throw"Error creating WebGL context.";
  420. }catch(A){console.error(A)}I=l.getExtension("OES_texture_float");J=l.getExtension("OES_standard_derivatives");B=l.getExtension("EXT_texture_filter_anisotropic")||l.getExtension("MOZ_EXT_texture_filter_anisotropic")||l.getExtension("WEBKIT_EXT_texture_filter_anisotropic");P=l.getExtension("WEBGL_compressed_texture_s3tc")||l.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||l.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");I||console.log("THREE.WebGLRenderer: Float textures not supported.");J||
  421. console.log("THREE.WebGLRenderer: Standard derivatives not supported.");B||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");P||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===l.getShaderPrecisionFormat&&(l.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);
  422. l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.clearColor(y.r,y.g,y.b,t);l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS);a=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS);l.getParameter(l.MAX_TEXTURE_SIZE);var G=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),D=B?l.getParameter(B.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,H=0<a,a=H&&I;P&&l.getParameter(l.COMPRESSED_TEXTURE_FORMATS);x=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.HIGH_FLOAT);p=l.getShaderPrecisionFormat(l.VERTEX_SHADER,
  423. l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_FLOAT);u=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT);q=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.HIGH_INT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.MEDIUM_INT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_INT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_INT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,
  424. l.MEDIUM_INT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_INT);x=0<x.precision&&0<u.precision;p=0<p.precision&&0<q.precision;"highp"===v&&!x&&(p?(v="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(v="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===v&&!p&&(v="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));var s={},F,O,K,w,N=-1,R=-1,$=-1,Y=-1,W=-1,M=0,la=0,na=0,qa=0,X=null,S=null,Z=null,T=null,
  425. aa;return{context:l,autoScaleCubemaps:!0,supportsBoneTextures:a,precision:v,maxVertexUniformVectors:l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS),getContext:function(){return l},getDomElement:function(){return r},getPrecision:function(){return v},getCurrentWidth:function(){return C},getCurrentHeight:function(){return E},supportsVertexTextures:function(){return H},supportsFloatTextures:function(){return I},supportsStandardDerivatives:function(){return J},supportsCompressedTextureS3TC:function(){return P},
  426. getMaxAnisotropy:function(){return D},setRenderTarget:j,setSize:function(a,b){r.width=a;r.height=b;c(0,0,r.width,r.height)},setViewport:c,setScissor:function(a,b,c,d){l.scissor(a,b,c,d)},enableScissorTest:function(a){a?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)},setClearColorHex:function(a,b){y.setHex(a);t=b;l.clearColor(y.r,y.g,y.b,t)},setClearColor:function(a,b){y.copy(a);t=b;l.clearColor(y.r,y.g,y.b,t)},getClearColor:function(){return y},getClearAlpha:function(){return t},clear:d,clearTarget:function(a,
  427. b,c,e){j(a);d(b,c,e)},deleteBuffer:function(a){l.deleteBuffer(a)},deleteTexture:function(a){l.deleteTexture(a)},deleteFramebuffer:function(a){l.deleteFramebuffer(a)},deleteRenderbuffer:function(a){l.deleteRenderbuffer(a)},deleteProgram:function(a){l.deleteProgram(a)},createBuffer:function(){return l.createBuffer()},setStaticArrayBuffer:function(a,b){e(a);l.bufferData(l.ARRAY_BUFFER,b,l.STATIC_DRAW)},setStaticIndexBuffer:function(a,b){f(a);l.bufferData(l.ELEMENT_ARRAY_BUFFER,b,l.STATIC_DRAW)},setDynamicArrayBuffer:function(a,
  428. b){e(a);l.bufferData(l.ARRAY_BUFFER,b,l.DYNAMIC_DRAW)},setDynamicIndexBuffer:function(a,b){f(a);l.bufferData(l.ELEMENT_ARRAY_BUFFER,b,l.DYNAMIC_DRAW)},drawTriangles:function(a){l.drawArrays(l.TRIANGLES,0,a)},drawTriangleStrip:function(a){l.drawArrays(l.TRIANGLE_STRIP,0,a)},drawLines:function(a){l.drawArrays(l.LINES,0,a)},drawLineStrip:function(a){l.drawArrays(l.LINE_STRIP,0,a)},drawPoints:function(a){l.drawArrays(l.POINTS,0,a)},drawTriangleElements:function(a,b,c){f(a);l.drawElements(l.TRIANGLES,
  429. b,l.UNSIGNED_SHORT,c)},drawLineElements:function(a,b,c){f(a);l.drawElements(l.LINES,b,l.UNSIGNED_SHORT,c)},bindArrayBuffer:e,bindElementArrayBuffer:f,enableAttribute:g,disableAttributes:function(){for(var a in s)s[a]&&(l.disableVertexAttribArray(a),s[a]=!1)},getAttribLocation:function(a,b){return l.getAttribLocation(a,b)},setFloatAttribute:function(a,b,c,d){e(b);g(a);l.vertexAttribPointer(a,c,l.FLOAT,!1,0,d)},getUniformLocation:function(a,b){return l.getUniformLocation(a,b)},uniform1i:function(a,
  430. b){l.uniform1i(a,b)},uniform1f:function(a,b){l.uniform1f(a,b)},uniform2f:function(a,b,c){l.uniform2f(a,b,c)},uniform3f:function(a,b,c,d){l.uniform3f(a,b,c,d)},uniform4f:function(a,b,c,d,e){l.uniform4f(a,b,c,d,e)},uniform1iv:function(a,b){l.uniform1iv(a,b)},uniform2iv:function(a,b){l.uniform2iv(a,b)},uniform3iv:function(a,b){l.uniform3iv(a,b)},uniform1fv:function(a,b){l.uniform1fv(a,b)},uniform2fv:function(a,b){l.uniform2fv(a,b)},uniform3fv:function(a,b){l.uniform3fv(a,b)},uniform4fv:function(a,b){l.uniform3fv(a,
  431. b)},uniformMatrix3fv:function(a,b){l.uniformMatrix3fv(a,!1,b)},uniformMatrix4fv:function(a,b){l.uniformMatrix4fv(a,!1,b)},useProgram:function(a){l.useProgram(a)},compileShader:function(a,b){var c=l.createProgram(),d=n("fragment",b),e=n("vertex",a);l.attachShader(c,e);l.attachShader(c,d);l.linkProgram(c);l.getProgramParameter(c,l.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+l.getProgramParameter(c,l.VALIDATE_STATUS)+", gl error ["+l.getError()+"]");l.deleteShader(d);
  432. l.deleteShader(e);return c},setFaceCulling:function(a,b){a===THREE.CullFaceNone?l.disable(l.CULL_FACE):(b===THREE.FrontFaceDirectionCW?l.frontFace(l.CW):l.frontFace(l.CCW),a===THREE.CullFaceBack?l.cullFace(l.BACK):a===THREE.CullFaceFront?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK),l.enable(l.CULL_FACE))},setMaterialFaces:function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;N!==b&&(b?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),N=b);R!==a&&(a?l.frontFace(l.CW):l.frontFace(l.CCW),
  433. R=a)},setPolygonOffset:function(a,b,c){X!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),X=a);if(a&&(S!==b||Z!==c))l.polygonOffset(b,c),S=b,Z=c},setBlending:function(a,b,c,d){a!==F&&(a===THREE.NoBlending?l.disable(l.BLEND):a===THREE.AdditiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.SRC_ALPHA,l.ONE)):a===THREE.SubtractiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?
  434. (l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.SRC_COLOR)):a===THREE.CustomBlending?l.enable(l.BLEND):(l.enable(l.BLEND),l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)),F=a);if(a===THREE.CustomBlending){if(b!==O&&(l.blendEquation(k(b)),O=b),c!==K||d!==w)l.blendFunc(k(c),k(d)),K=c,w=d}else w=K=O=null},setDepthTest:function(a){$!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),$=a)},setDepthWrite:function(a){Y!==
  435. a&&(l.depthMask(a),Y=a)},setTexture:function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.__webglTexture=l.createTexture());l.activeTexture(l.TEXTURE0+b);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,a.flipY);l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);l.pixelStorei(l.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=k(a.format),f=k(a.type);i(l.TEXTURE_2D,a,d);var g=a.mipmaps;
  436. if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var h=0,j=g.length;h<j;h++)c=g[h],l.texImage2D(l.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){h=0;for(j=g.length;h<j;h++)c=g[h],l.compressedTexImage2D(l.TEXTURE_2D,h,e,c.width,c.height,0,c.data)}else if(0<g.length&&d){h=0;for(j=g.length;h<j;h++)c=g[h],l.texImage2D(l.TEXTURE_2D,h,e,e,f,c);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,
  437. 0,e,e,f,a.image);a.generateMipmaps&&d&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else l.activeTexture(l.TEXTURE0+b),l.bindTexture(l.TEXTURE_2D,a.__webglTexture)},setCubeTexture:function(a,b){if(6===a.image.length)if(a.needsUpdate){a.image.__webglTextureCube||(a.image.__webglTextureCube=l.createTexture());l.activeTexture(l.TEXTURE0+b);l.bindTexture(l.TEXTURE_CUBE_MAP,a.image.__webglTextureCube);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,a.flipY);for(var c=a instanceof THREE.CompressedTexture,
  438. d=[],e=0;6>e;e++)if(c)d[e]=a.image[e];else{var f=d,g=e,h;h=a.image[e];var j=G;if(!(h.width<=j&&h.height<=j)){var m=Math.max(h.width,h.height),n=Math.floor(h.width*j/m),j=Math.floor(h.height*j/m),m=document.createElement("canvas");m.width=n;m.height=j;m.getContext("2d").drawImage(h,0,0,h.width,h.height,0,0,n,j);h=m}f[g]=h}e=d[0];f=0===(e.width&e.width-1)&&0===(e.height&e.height-1);g=k(a.format);h=k(a.type);i(l.TEXTURE_CUBE_MAP,a,f);for(e=0;6>e;e++)if(c)for(var j=d[e].mipmaps,m=0,p=j.length;m<p;m++)n=
  439. j[m],l.compressedTexImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+e,m,g,n.width,n.height,0,n.data);else l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,g,g,h,d[e]);a.generateMipmaps&&f&&l.generateMipmap(l.TEXTURE_CUBE_MAP);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else l.activeTexture(l.TEXTURE0+b),l.bindTexture(l.TEXTURE_CUBE_MAP,a.image.__webglTextureCube)},updateRenderTargetMipmap:function(a){a instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),
  440. l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,a.__webglTexture),l.generateMipmap(l.TEXTURE_2D),l.bindTexture(l.TEXTURE_2D,null))},setCubeTextureDynamic:function(a,b){l.activeTexture(l.TEXTURE0+b);l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture)},paramThreeToGL:k,setLineWidth:function(a){a!==W&&(l.lineWidth(a),W=a)},resetState:function(){R=N=Y=$=F=-1}}};THREE.WebGLRenderer.ShaderBuilder=function(a,b){this.renderer=a;this.info=b;this.programs=[];this.programs_counter=0};
  441. THREE.extend(THREE.WebGLRenderer.ShaderBuilder.prototype,{buildProgram:function(a,b,c,d,e,f,g){var i=this.renderer,h,j,k=[];a?k.push(a):(k.push(b),k.push(c));for(j in f)k.push(j),k.push(f[j]);for(h in g)k.push(h),k.push(g[h]);a=k.join();h=0;for(j=this.programs.length;h<j;h++)if(k=this.programs[h],k.code===a)return k.usedTimes++,k.program;h="SHADOWMAP_TYPE_BASIC";g.shadowMapType===THREE.PCFShadowMap?h="SHADOWMAP_TYPE_PCF":g.shadowMapType===THREE.PCFSoftShadowMap&&(h="SHADOWMAP_TYPE_PCF_SOFT");j=this.generateDefines(f);
  442. f=["precision "+i.precision+" float;",j,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"",g.gammaInput?"#define GAMMA_INPUT":"",g.gammaOutput?"#define GAMMA_OUTPUT":"",g.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+g.maxDirLights,"#define MAX_POINT_LIGHTS "+g.maxPointLights,"#define MAX_SPOT_LIGHTS "+g.maxSpotLights,"#define MAX_HEMI_LIGHTS "+g.maxHemiLights,"#define MAX_SHADOWS "+g.maxShadows,"#define MAX_BONES "+g.maxBones,g.map?"#define USE_MAP":"",
  443. g.envMap?"#define USE_ENVMAP":"",g.lightMap?"#define USE_LIGHTMAP":"",g.bumpMap?"#define USE_BUMPMAP":"",g.normalMap?"#define USE_NORMALMAP":"",g.specularMap?"#define USE_SPECULARMAP":"",g.vertexColors?"#define USE_COLOR":"",g.skinning?"#define USE_SKINNING":"",g.useVertexTexture?"#define BONE_TEXTURE":"",g.boneTextureWidth?"#define N_BONE_PIXEL_X "+g.boneTextureWidth.toFixed(1):"",g.boneTextureHeight?"#define N_BONE_PIXEL_Y "+g.boneTextureHeight.toFixed(1):"",g.morphTargets?"#define USE_MORPHTARGETS":
  444. "",g.morphNormals?"#define USE_MORPHNORMALS":"",g.perPixel?"#define PHONG_PER_PIXEL":"",g.wrapAround?"#define WRAP_AROUND":"",g.doubleSided?"#define DOUBLE_SIDED":"",g.flipSided?"#define FLIP_SIDED":"",g.shadowMapEnabled?"#define USE_SHADOWMAP":"",g.shadowMapEnabled?"#define "+h:"",g.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",g.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",g.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
  445. h=["precision "+i.precision+" float;",g.bumpMap||g.normalMap?"#extension GL_OES_standard_derivatives : enable":"",j,"#define MAX_DIR_LIGHTS "+g.maxDirLights,"#define MAX_POINT_LIGHTS "+g.maxPointLights,"#define MAX_SPOT_LIGHTS "+g.maxSpotLights,"#define MAX_HEMI_LIGHTS "+g.maxHemiLights,"#define MAX_SHADOWS "+g.maxShadows,g.alphaTest?"#define ALPHATEST "+g.alphaTest:"",g.gammaInput?"#define GAMMA_INPUT":"",g.gammaOutput?"#define GAMMA_OUTPUT":"",g.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
  446. "",g.useFog&&g.fog?"#define USE_FOG":"",g.useFog&&g.fogExp?"#define FOG_EXP2":"",g.map?"#define USE_MAP":"",g.envMap?"#define USE_ENVMAP":"",g.lightMap?"#define USE_LIGHTMAP":"",g.bumpMap?"#define USE_BUMPMAP":"",g.normalMap?"#define USE_NORMALMAP":"",g.specularMap?"#define USE_SPECULARMAP":"",g.vertexColors?"#define USE_COLOR":"",g.metal?"#define METAL":"",g.perPixel?"#define PHONG_PER_PIXEL":"",g.wrapAround?"#define WRAP_AROUND":"",g.doubleSided?"#define DOUBLE_SIDED":"",g.flipSided?"#define FLIP_SIDED":
  447. "",g.shadowMapEnabled?"#define USE_SHADOWMAP":"",g.shadowMapEnabled?"#define "+h:"",g.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",g.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");b=i.compileShader(f+c,h+b);b.uniforms={};b.attributes={};var n,m,c="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");g.useVertexTexture?c.push("boneTexture"):c.push("boneGlobalMatrices");
  448. for(n in d)c.push(n);this.cacheUniformLocations(b,c);c="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(d=0;d<g.maxMorphTargets;d++)c.push("morphTarget"+d);for(d=0;d<g.maxMorphNormals;d++)c.push("morphNormal"+d);for(m in e)c.push(m);this.cacheAttributeLocations(b,c);b.id=this.programs_counter++;this.programs.push({program:b,code:a,usedTimes:1});this.info.memory.programs=this.programs.length;return b},generateDefines:function(a){var b,c=[],d;for(d in a)b=a[d],
  449. !1!==b&&(b="#define "+d+" "+b,c.push(b));return c.join("\n")},cacheUniformLocations:function(a,b){var c,d,e,f=this.renderer;c=0;for(d=b.length;c<d;c++)e=b[c],a.uniforms[e]=f.getUniformLocation(a,e)},cacheAttributeLocations:function(a,b){var c,d,e,f=this.renderer;c=0;for(d=b.length;c<d;c++)e=b[c],a.attributes[e]=f.getAttribLocation(a,e)},removeProgram:function(a){var b,c,d,e=!1,f=this.programs;b=0;for(c=f.length;b<c;b++)if(d=f[b],d.program===a){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=
  450. [];b=0;for(c=f.length;b<c;b++)d=f[b],d.program!==a&&e.push(d);this.programs=e;this.renderer.deleteProgram(a);this.info.memory.programs--}}});THREE.WebGLRenderer.Object3DRenderer=function(a,b){this.renderer=a;this.info=b};
  451. THREE.extend(THREE.WebGLRenderer.Object3DRenderer.prototype,{getBufferMaterial:function(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material},bufferGuessUVType:function(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1},bufferGuessNormalType:function(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:this.materialNeedsSmoothNormals(a)?THREE.SmoothShading:
  452. THREE.FlatShading},materialNeedsSmoothNormals:function(a){return a&&void 0!==a.shading&&a.shading===THREE.SmoothShading},bufferGuessVertexColorType:function(a){return a.vertexColors?a.vertexColors:!1},initCustomAttributes:function(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===
  453. f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=this.renderer.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}},numericalSort:function(a,b){return b[0]-a[0]}});THREE.WebGLRenderer.MeshRenderer=function(a,b){THREE.WebGLRenderer.Object3DRenderer.call(this,a,b)};THREE.WebGLRenderer.MeshRenderer.prototype=Object.create(THREE.WebGLRenderer.Object3DRenderer.prototype);
  454. THREE.extend(THREE.WebGLRenderer.MeshRenderer.prototype,{createBuffers:function(a){var b=this.renderer;a.__webglVertexBuffer=b.createBuffer();a.__webglNormalBuffer=b.createBuffer();a.__webglTangentBuffer=b.createBuffer();a.__webglColorBuffer=b.createBuffer();a.__webglUVBuffer=b.createBuffer();a.__webglUV2Buffer=b.createBuffer();a.__webglSkinIndicesBuffer=b.createBuffer();a.__webglSkinWeightsBuffer=b.createBuffer();a.__webglFaceBuffer=b.createBuffer();a.__webglLineBuffer=b.createBuffer();var c,d;if(a.numMorphTargets){a.__webglMorphTargetsBuffers=
  455. [];c=0;for(d=a.numMorphTargets;c<d;c++)a.__webglMorphTargetsBuffers.push(b.createBuffer())}if(a.numMorphNormals){a.__webglMorphNormalsBuffers=[];c=0;for(d=a.numMorphNormals;c<d;c++)a.__webglMorphNormalsBuffers.push(b.createBuffer())}this.info.memory.geometries++},initBuffers:function(a,b){var c=b.geometry,d=a.faces3,e=a.faces4,f=3*d.length+4*e.length,g=1*d.length+2*e.length,e=3*d.length+4*e.length,d=this.getBufferMaterial(b,a),i=this.bufferGuessUVType(d),h=this.bufferGuessNormalType(d),j=this.bufferGuessVertexColorType(d);
  456. a.__vertexArray=new Float32Array(3*f);h&&(a.__normalArray=new Float32Array(3*f));c.hasTangents&&(a.__tangentArray=new Float32Array(4*f));j&&(a.__colorArray=new Float32Array(3*f));if(i){if(0<c.faceUvs.length||0<c.faceVertexUvs.length)a.__uvArray=new Float32Array(2*f);if(1<c.faceUvs.length||1<c.faceVertexUvs.length)a.__uv2Array=new Float32Array(2*f)}b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&(a.__skinIndexArray=new Float32Array(4*f),a.__skinWeightArray=new Float32Array(4*f));a.__faceArray=
  457. new Uint16Array(3*g);a.__lineArray=new Uint16Array(2*e);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(i=a.numMorphTargets;c<i;c++)a.__morphTargetsArrays.push(new Float32Array(3*f))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(i=a.numMorphNormals;c<i;c++)a.__morphNormalsArrays.push(new Float32Array(3*f))}a.__webglFaceCount=3*g;a.__webglLineCount=2*e;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var k in d.attributes){var g=d.attributes[k],
  458. c={},n;for(n in g)c[n]=g[n];if(!c.__webglInitialized||c.createUniqueBuffers)c.__webglInitialized=!0,e=1,"v2"===c.type?e=2:"v3"===c.type?e=3:"v4"===c.type?e=4:"c"===c.type&&(e=3),c.size=e,c.array=new Float32Array(f*e),c.buffer=this.renderer.createBuffer(),c.buffer.belongsToAttribute=k,g.needsUpdate=!0,c.__original=g;a.__webglCustomAttributesList.push(c)}}a.__inittedArrays=!0},setBuffers:function(a,b,c,d){if(a.__inittedArrays){var e=this.renderer,f=this.bufferGuessNormalType(d),g=this.bufferGuessVertexColorType(d),
  459. i=this.bufferGuessUVType(d),h=f===THREE.SmoothShading,j,k,n,m,r,v,p,q,x,u,z,y,t,C,E,l,I,J,B,P,A,G,D,H,s=P=A=J=0,F=0,O=n=B=0,K=r=z=0,w=0,K=a.__vertexArray,N=a.__uvArray,w=a.__uv2Array,R=a.__normalArray;m=a.__tangentArray;y=a.__colorArray;t=a.__skinIndexArray;C=a.__skinWeightArray;l=a.__morphTargetsArrays;I=a.__morphNormalsArrays;var $=a.__webglCustomAttributesList,Y=a.__faceArray,W=a.__lineArray;p=b.geometry;var M=p.elementsNeedUpdate,la=p.uvsNeedUpdate,na=p.normalsNeedUpdate,qa=p.tangentsNeedUpdate;
  460. E=p.colorsNeedUpdate;G=p.morphTargetsNeedUpdate;H=p.vertices;var X=a.faces3,S=a.faces4,Z=p.faces,T=p.faceVertexUvs[0],aa=p.faceVertexUvs[1];v=p.skinIndices;var L=p.skinWeights,U=p.morphTargets,ba=p.morphNormals;if(p.verticesNeedUpdate){b=0;for(j=X.length;b<j;b++)k=Z[X[b]],q=H[k.a],x=H[k.b],u=H[k.c],K[A]=q.x,K[A+1]=q.y,K[A+2]=q.z,K[A+3]=x.x,K[A+4]=x.y,K[A+5]=x.z,K[A+6]=u.x,K[A+7]=u.y,K[A+8]=u.z,A+=9;b=0;for(j=S.length;b<j;b++)k=Z[S[b]],q=H[k.a],x=H[k.b],u=H[k.c],k=H[k.d],K[A]=q.x,K[A+1]=q.y,K[A+2]=
  461. q.z,K[A+3]=x.x,K[A+4]=x.y,K[A+5]=x.z,K[A+6]=u.x,K[A+7]=u.y,K[A+8]=u.z,K[A+9]=k.x,K[A+10]=k.y,K[A+11]=k.z,A+=12;e.setDynamicArrayBuffer(a.__webglVertexBuffer,K)}if(G){A=0;for(G=U.length;A<G;A++){b=K=0;for(j=X.length;b<j;b++)H=X[b],k=Z[H],q=U[A].vertices[k.a],x=U[A].vertices[k.b],u=U[A].vertices[k.c],D=l[A],D[K]=q.x,D[K+1]=q.y,D[K+2]=q.z,D[K+3]=x.x,D[K+4]=x.y,D[K+5]=x.z,D[K+6]=u.x,D[K+7]=u.y,D[K+8]=u.z,d.morphNormals&&(h?(u=ba[A].vertexNormals[H],k=u.a,q=u.b,x=u.c):x=q=k=ba[A].faceNormals[H],H=I[A],
  462. H[K]=k.x,H[K+1]=k.y,H[K+2]=k.z,H[K+3]=q.x,H[K+4]=q.y,H[K+5]=q.z,H[K+6]=x.x,H[K+7]=x.y,H[K+8]=x.z),K+=9;b=0;for(j=S.length;b<j;b++)H=S[b],k=Z[H],q=U[A].vertices[k.a],x=U[A].vertices[k.b],u=U[A].vertices[k.c],k=U[A].vertices[k.d],D=l[A],D[K]=q.x,D[K+1]=q.y,D[K+2]=q.z,D[K+3]=x.x,D[K+4]=x.y,D[K+5]=x.z,D[K+6]=u.x,D[K+7]=u.y,D[K+8]=u.z,D[K+9]=k.x,D[K+10]=k.y,D[K+11]=k.z,d.morphNormals&&(h?(u=ba[A].vertexNormals[H],k=u.a,q=u.b,x=u.c,u=u.d):u=x=q=k=ba[A].faceNormals[H],H=I[A],H[K]=k.x,H[K+1]=k.y,H[K+2]=k.z,
  463. H[K+3]=q.x,H[K+4]=q.y,H[K+5]=q.z,H[K+6]=x.x,H[K+7]=x.y,H[K+8]=x.z,H[K+9]=u.x,H[K+10]=u.y,H[K+11]=u.z),K+=12;this.renderer.setDynamicArrayBuffer(a.__webglMorphTargetsBuffers[A],l[A]);d.morphNormals&&this.renderer.setDynamicArrayBuffer(a.__webglMorphNormalsBuffers[A],I[A])}}if(L.length){b=0;for(j=X.length;b<j;b++)k=Z[X[b]],d=L[k.a],l=L[k.b],I=L[k.c],C[r]=d.x,C[r+1]=d.y,C[r+2]=d.z,C[r+3]=d.w,C[r+4]=l.x,C[r+5]=l.y,C[r+6]=l.z,C[r+7]=l.w,C[r+8]=I.x,C[r+9]=I.y,C[r+10]=I.z,C[r+11]=I.w,d=v[k.a],l=v[k.b],I=
  464. v[k.c],t[r]=d.x,t[r+1]=d.y,t[r+2]=d.z,t[r+3]=d.w,t[r+4]=l.x,t[r+5]=l.y,t[r+6]=l.z,t[r+7]=l.w,t[r+8]=I.x,t[r+9]=I.y,t[r+10]=I.z,t[r+11]=I.w,r+=12;b=0;for(j=S.length;b<j;b++)k=Z[S[b]],d=L[k.a],l=L[k.b],I=L[k.c],q=L[k.d],C[r]=d.x,C[r+1]=d.y,C[r+2]=d.z,C[r+3]=d.w,C[r+4]=l.x,C[r+5]=l.y,C[r+6]=l.z,C[r+7]=l.w,C[r+8]=I.x,C[r+9]=I.y,C[r+10]=I.z,C[r+11]=I.w,C[r+12]=q.x,C[r+13]=q.y,C[r+14]=q.z,C[r+15]=q.w,d=v[k.a],l=v[k.b],I=v[k.c],k=v[k.d],t[r]=d.x,t[r+1]=d.y,t[r+2]=d.z,t[r+3]=d.w,t[r+4]=l.x,t[r+5]=l.y,t[r+
  465. 6]=l.z,t[r+7]=l.w,t[r+8]=I.x,t[r+9]=I.y,t[r+10]=I.z,t[r+11]=I.w,t[r+12]=k.x,t[r+13]=k.y,t[r+14]=k.z,t[r+15]=k.w,r+=16;0<r&&(e.setDynamicArrayBuffer(a.__webglSkinIndicesBuffer,t),e.setDynamicArrayBuffer(a.__webglSkinWeightsBuffer,C))}if(E&&g){b=0;for(j=X.length;b<j;b++)k=Z[X[b]],r=k.vertexColors,v=k.color,3===r.length&&g===THREE.VertexColors?(t=r[0],C=r[1],E=r[2]):E=C=t=v,y[z]=t.r,y[z+1]=t.g,y[z+2]=t.b,y[z+3]=C.r,y[z+4]=C.g,y[z+5]=C.b,y[z+6]=E.r,y[z+7]=E.g,y[z+8]=E.b,z+=9;b=0;for(j=S.length;b<j;b++)k=
  466. Z[S[b]],r=k.vertexColors,v=k.color,4===r.length&&g===THREE.VertexColors?(t=r[0],C=r[1],E=r[2],r=r[3]):r=E=C=t=v,y[z]=t.r,y[z+1]=t.g,y[z+2]=t.b,y[z+3]=C.r,y[z+4]=C.g,y[z+5]=C.b,y[z+6]=E.r,y[z+7]=E.g,y[z+8]=E.b,y[z+9]=r.r,y[z+10]=r.g,y[z+11]=r.b,z+=12;0<z&&e.setDynamicArrayBuffer(a.__webglColorBuffer,y)}if(qa&&p.hasTangents){b=0;for(j=X.length;b<j;b++)k=Z[X[b]],p=k.vertexTangents,g=p[0],z=p[1],y=p[2],m[n]=g.x,m[n+1]=g.y,m[n+2]=g.z,m[n+3]=g.w,m[n+4]=z.x,m[n+5]=z.y,m[n+6]=z.z,m[n+7]=z.w,m[n+8]=y.x,m[n+
  467. 9]=y.y,m[n+10]=y.z,m[n+11]=y.w,n+=12;b=0;for(j=S.length;b<j;b++)k=Z[S[b]],p=k.vertexTangents,g=p[0],z=p[1],y=p[2],p=p[3],m[n]=g.x,m[n+1]=g.y,m[n+2]=g.z,m[n+3]=g.w,m[n+4]=z.x,m[n+5]=z.y,m[n+6]=z.z,m[n+7]=z.w,m[n+8]=y.x,m[n+9]=y.y,m[n+10]=y.z,m[n+11]=y.w,m[n+12]=p.x,m[n+13]=p.y,m[n+14]=p.z,m[n+15]=p.w,n+=16;e.setDynamicArrayBuffer(a.__webglTangentBuffer,m)}if(na&&f){b=0;for(j=X.length;b<j;b++)if(k=Z[X[b]],n=k.vertexNormals,m=k.normal,3===n.length&&h)for(f=0;3>f;f++)m=n[f],R[B]=m.x,R[B+1]=m.y,R[B+2]=
  468. m.z,B+=3;else for(f=0;3>f;f++)R[B]=m.x,R[B+1]=m.y,R[B+2]=m.z,B+=3;b=0;for(j=S.length;b<j;b++)if(k=Z[S[b]],n=k.vertexNormals,m=k.normal,4===n.length&&h)for(f=0;4>f;f++)m=n[f],R[B]=m.x,R[B+1]=m.y,R[B+2]=m.z,B+=3;else for(f=0;4>f;f++)R[B]=m.x,R[B+1]=m.y,R[B+2]=m.z,B+=3;e.setDynamicArrayBuffer(a.__webglNormalBuffer,R)}if(la&&T&&i){b=0;for(j=X.length;b<j;b++)if(h=X[b],h=T[h],void 0!==h)for(f=0;3>f;f++)B=h[f],N[P]=B.x,N[P+1]=B.y,P+=2;b=0;for(j=S.length;b<j;b++)if(h=S[b],h=T[h],void 0!==h)for(f=0;4>f;f++)B=
  469. h[f],N[P]=B.x,N[P+1]=B.y,P+=2;0<P&&e.setDynamicArrayBuffer(a.__webglUVBuffer,N)}if(la&&aa&&i){b=0;for(j=X.length;b<j;b++)if(h=X[b],i=aa[h],void 0!==i)for(f=0;3>f;f++)P=i[f],w[s]=P.x,w[s+1]=P.y,s+=2;b=0;for(j=S.length;b<j;b++)if(h=S[b],i=aa[h],void 0!==i)for(f=0;4>f;f++)P=i[f],w[s]=P.x,w[s+1]=P.y,s+=2;0<s&&e.setDynamicArrayBuffer(a.__webglUV2Buffer,w)}if(M){b=0;for(j=X.length;b<j;b++)Y[F]=J,Y[F+1]=J+1,Y[F+2]=J+2,F+=3,W[O]=J,W[O+1]=J+1,W[O+2]=J,W[O+3]=J+2,W[O+4]=J+1,W[O+5]=J+2,O+=6,J+=3;b=0;for(j=S.length;b<
  470. j;b++)Y[F]=J,Y[F+1]=J+1,Y[F+2]=J+3,Y[F+3]=J+1,Y[F+4]=J+2,Y[F+5]=J+3,F+=6,W[O]=J,W[O+1]=J+1,W[O+2]=J,W[O+3]=J+3,W[O+4]=J+1,W[O+5]=J+2,W[O+6]=J+2,W[O+7]=J+3,O+=8,J+=4;e.setDynamicIndexBuffer(a.__webglFaceBuffer,Y);e.setDynamicIndexBuffer(a.__webglLineBuffer,W)}if($){f=0;for(J=$.length;f<J;f++)if(s=$[f],s.__original.needsUpdate){w=0;if(1===s.size)if(void 0===s.boundTo||"vertices"===s.boundTo){b=0;for(j=X.length;b<j;b++)k=Z[X[b]],s.array[w]=s.value[k.a],s.array[w+1]=s.value[k.b],s.array[w+2]=s.value[k.c],
  471. w+=3;b=0;for(j=S.length;b<j;b++)k=Z[S[b]],s.array[w]=s.value[k.a],s.array[w+1]=s.value[k.b],s.array[w+2]=s.value[k.c],s.array[w+3]=s.value[k.d],w+=4}else{if("faces"===s.boundTo){b=0;for(j=X.length;b<j;b++)O=s.value[X[b]],s.array[w]=O,s.array[w+1]=O,s.array[w+2]=O,w+=3;b=0;for(j=S.length;b<j;b++)O=s.value[S[b]],s.array[w]=O,s.array[w+1]=O,s.array[w+2]=O,s.array[w+3]=O,w+=4}}else if(2===s.size)if(void 0===s.boundTo||"vertices"===s.boundTo){b=0;for(j=X.length;b<j;b++)k=Z[X[b]],q=s.value[k.a],x=s.value[k.b],
  472. u=s.value[k.c],s.array[w]=q.x,s.array[w+1]=q.y,s.array[w+2]=x.x,s.array[w+3]=x.y,s.array[w+4]=u.x,s.array[w+5]=u.y,w+=6;b=0;for(j=S.length;b<j;b++)k=Z[S[b]],q=s.value[k.a],x=s.value[k.b],u=s.value[k.c],k=s.value[k.d],s.array[w]=q.x,s.array[w+1]=q.y,s.array[w+2]=x.x,s.array[w+3]=x.y,s.array[w+4]=u.x,s.array[w+5]=u.y,s.array[w+6]=k.x,s.array[w+7]=k.y,w+=8}else{if("faces"===s.boundTo){b=0;for(j=X.length;b<j;b++)u=x=q=O=s.value[X[b]],s.array[w]=q.x,s.array[w+1]=q.y,s.array[w+2]=x.x,s.array[w+3]=x.y,s.array[w+
  473. 4]=u.x,s.array[w+5]=u.y,w+=6;b=0;for(j=S.length;b<j;b++)k=u=x=q=O=s.value[S[b]],s.array[w]=q.x,s.array[w+1]=q.y,s.array[w+2]=x.x,s.array[w+3]=x.y,s.array[w+4]=u.x,s.array[w+5]=u.y,s.array[w+6]=k.x,s.array[w+7]=k.y,w+=8}}else if(3===s.size)if(F="c"===s.type?["r","g","b"]:["x","y","z"],void 0===s.boundTo||"vertices"===s.boundTo){b=0;for(j=X.length;b<j;b++)k=Z[X[b]],q=s.value[k.a],x=s.value[k.b],u=s.value[k.c],s.array[w]=q[F[0]],s.array[w+1]=q[F[1]],s.array[w+2]=q[F[2]],s.array[w+3]=x[F[0]],s.array[w+
  474. 4]=x[F[1]],s.array[w+5]=x[F[2]],s.array[w+6]=u[F[0]],s.array[w+7]=u[F[1]],s.array[w+8]=u[F[2]],w+=9;b=0;for(j=S.length;b<j;b++)k=Z[S[b]],q=s.value[k.a],x=s.value[k.b],u=s.value[k.c],k=s.value[k.d],s.array[w]=q[F[0]],s.array[w+1]=q[F[1]],s.array[w+2]=q[F[2]],s.array[w+3]=x[F[0]],s.array[w+4]=x[F[1]],s.array[w+5]=x[F[2]],s.array[w+6]=u[F[0]],s.array[w+7]=u[F[1]],s.array[w+8]=u[F[2]],s.array[w+9]=k[F[0]],s.array[w+10]=k[F[1]],s.array[w+11]=k[F[2]],w+=12}else if("faces"===s.boundTo){b=0;for(j=X.length;b<
  475. j;b++)u=x=q=O=s.value[X[b]],s.array[w]=q[F[0]],s.array[w+1]=q[F[1]],s.array[w+2]=q[F[2]],s.array[w+3]=x[F[0]],s.array[w+4]=x[F[1]],s.array[w+5]=x[F[2]],s.array[w+6]=u[F[0]],s.array[w+7]=u[F[1]],s.array[w+8]=u[F[2]],w+=9;b=0;for(j=S.length;b<j;b++)k=u=x=q=O=s.value[S[b]],s.array[w]=q[F[0]],s.array[w+1]=q[F[1]],s.array[w+2]=q[F[2]],s.array[w+3]=x[F[0]],s.array[w+4]=x[F[1]],s.array[w+5]=x[F[2]],s.array[w+6]=u[F[0]],s.array[w+7]=u[F[1]],s.array[w+8]=u[F[2]],s.array[w+9]=k[F[0]],s.array[w+10]=k[F[1]],
  476. s.array[w+11]=k[F[2]],w+=12}else{if("faceVertices"===s.boundTo){b=0;for(j=X.length;b<j;b++)O=s.value[X[b]],q=O[0],x=O[1],u=O[2],s.array[w]=q[F[0]],s.array[w+1]=q[F[1]],s.array[w+2]=q[F[2]],s.array[w+3]=x[F[0]],s.array[w+4]=x[F[1]],s.array[w+5]=x[F[2]],s.array[w+6]=u[F[0]],s.array[w+7]=u[F[1]],s.array[w+8]=u[F[2]],w+=9;b=0;for(j=S.length;b<j;b++)O=s.value[S[b]],q=O[0],x=O[1],u=O[2],k=O[3],s.array[w]=q[F[0]],s.array[w+1]=q[F[1]],s.array[w+2]=q[F[2]],s.array[w+3]=x[F[0]],s.array[w+4]=x[F[1]],s.array[w+
  477. 5]=x[F[2]],s.array[w+6]=u[F[0]],s.array[w+7]=u[F[1]],s.array[w+8]=u[F[2]],s.array[w+9]=k[F[0]],s.array[w+10]=k[F[1]],s.array[w+11]=k[F[2]],w+=12}}else if(4===s.size)if(void 0===s.boundTo||"vertices"===s.boundTo){b=0;for(j=X.length;b<j;b++)k=Z[X[b]],q=s.value[k.a],x=s.value[k.b],u=s.value[k.c],s.array[w]=q.x,s.array[w+1]=q.y,s.array[w+2]=q.z,s.array[w+3]=q.w,s.array[w+4]=x.x,s.array[w+5]=x.y,s.array[w+6]=x.z,s.array[w+7]=x.w,s.array[w+8]=u.x,s.array[w+9]=u.y,s.array[w+10]=u.z,s.array[w+11]=u.w,w+=
  478. 12;b=0;for(j=S.length;b<j;b++)k=Z[S[b]],q=s.value[k.a],x=s.value[k.b],u=s.value[k.c],k=s.value[k.d],s.array[w]=q.x,s.array[w+1]=q.y,s.array[w+2]=q.z,s.array[w+3]=q.w,s.array[w+4]=x.x,s.array[w+5]=x.y,s.array[w+6]=x.z,s.array[w+7]=x.w,s.array[w+8]=u.x,s.array[w+9]=u.y,s.array[w+10]=u.z,s.array[w+11]=u.w,s.array[w+12]=k.x,s.array[w+13]=k.y,s.array[w+14]=k.z,s.array[w+15]=k.w,w+=16}else if("faces"===s.boundTo){b=0;for(j=X.length;b<j;b++)u=x=q=O=s.value[X[b]],s.array[w]=q.x,s.array[w+1]=q.y,s.array[w+
  479. 2]=q.z,s.array[w+3]=q.w,s.array[w+4]=x.x,s.array[w+5]=x.y,s.array[w+6]=x.z,s.array[w+7]=x.w,s.array[w+8]=u.x,s.array[w+9]=u.y,s.array[w+10]=u.z,s.array[w+11]=u.w,w+=12;b=0;for(j=S.length;b<j;b++)k=u=x=q=O=s.value[S[b]],s.array[w]=q.x,s.array[w+1]=q.y,s.array[w+2]=q.z,s.array[w+3]=q.w,s.array[w+4]=x.x,s.array[w+5]=x.y,s.array[w+6]=x.z,s.array[w+7]=x.w,s.array[w+8]=u.x,s.array[w+9]=u.y,s.array[w+10]=u.z,s.array[w+11]=u.w,s.array[w+12]=k.x,s.array[w+13]=k.y,s.array[w+14]=k.z,s.array[w+15]=k.w,w+=16}else if("faceVertices"===
  480. s.boundTo){b=0;for(j=X.length;b<j;b++)O=s.value[X[b]],q=O[0],x=O[1],u=O[2],s.array[w]=q.x,s.array[w+1]=q.y,s.array[w+2]=q.z,s.array[w+3]=q.w,s.array[w+4]=x.x,s.array[w+5]=x.y,s.array[w+6]=x.z,s.array[w+7]=x.w,s.array[w+8]=u.x,s.array[w+9]=u.y,s.array[w+10]=u.z,s.array[w+11]=u.w,w+=12;b=0;for(j=S.length;b<j;b++)O=s.value[S[b]],q=O[0],x=O[1],u=O[2],k=O[3],s.array[w]=q.x,s.array[w+1]=q.y,s.array[w+2]=q.z,s.array[w+3]=q.w,s.array[w+4]=x.x,s.array[w+5]=x.y,s.array[w+6]=x.z,s.array[w+7]=x.w,s.array[w+8]=
  481. u.x,s.array[w+9]=u.y,s.array[w+10]=u.z,s.array[w+11]=u.w,s.array[w+12]=k.x,s.array[w+13]=k.y,s.array[w+14]=k.z,s.array[w+15]=k.w,w+=16}e.setDynamicArrayBuffer(s.buffer,s.array)}}c&&(delete a.__inittedArrays,delete a.__colorArray,delete a.__normalArray,delete a.__tangentArray,delete a.__uvArray,delete a.__uv2Array,delete a.__faceArray,delete a.__vertexArray,delete a.__lineArray,delete a.__skinIndexArray,delete a.__skinWeightArray)}}});THREE.WebGLRenderer.ParticleRenderer=function(a,b){THREE.WebGLRenderer.Object3DRenderer.call(this,a,b)};THREE.WebGLRenderer.ParticleRenderer.prototype=Object.create(THREE.WebGLRenderer.Object3DRenderer.prototype);
  482. THREE.extend(THREE.WebGLRenderer.ParticleRenderer.prototype,{createBuffers:function(a){var b=this.renderer;a.__webglVertexBuffer=b.createBuffer();a.__webglColorBuffer=b.createBuffer();this.info.memory.geometries++},initBuffers:function(a,b){var c=a.vertices.length;a.__vertexArray=new Float32Array(3*c);a.__colorArray=new Float32Array(3*c);a.__sortArray=[];a.__webglParticleCount=c;this.initCustomAttributes(a,b)},setBuffers:function(a,b,c){var d=this.renderer,e,f,g,i;e=a.vertices;i=e.length;var h=a.colors,
  483. j=h.length,k=a.__vertexArray,n=a.__colorArray,m=a.__sortArray,r=a.verticesNeedUpdate,v=a.colorsNeedUpdate,p=a.__webglCustomAttributesList;g=THREE.WebGLRenderer.ParticleRenderer._m1;var q=THREE.WebGLRenderer.ParticleRenderer._v1;if(b.sortParticles){g.multiplyMatrices(c,b.matrixWorld);for(c=0;c<i;c++)f=e[c],q.copy(f),q.applyProjection(g),m[c]=[q.z,c];m.sort(this.numericalSort);for(c=0;c<i;c++)f=e[m[c][1]],g=3*c,k[g]=f.x,k[g+1]=f.y,k[g+2]=f.z;for(e=0;e<j;e++)g=3*e,i=h[m[e][1]],n[g]=i.r,n[g+1]=i.g,n[g+
  484. 2]=i.b;if(p){h=0;for(j=p.length;h<j;h++)if(c=p[h],void 0===c.boundTo||"vertices"===c.boundTo)if(g=0,i=c.value.length,1===c.size)for(e=0;e<i;e++)f=m[e][1],c.array[e]=c.value[f];else if(2===c.size)for(e=0;e<i;e++)f=m[e][1],f=c.value[f],c.array[g]=f.x,c.array[g+1]=f.y,g+=2;else if(3===c.size)if("c"===c.type)for(e=0;e<i;e++)f=m[e][1],f=c.value[f],c.array[g]=f.r,c.array[g+1]=f.g,c.array[g+2]=f.b,g+=3;else for(e=0;e<i;e++)f=m[e][1],f=c.value[f],c.array[g]=f.x,c.array[g+1]=f.y,c.array[g+2]=f.z,g+=3;else if(4===
  485. c.size)for(e=0;e<i;e++)f=m[e][1],f=c.value[f],c.array[g]=f.x,c.array[g+1]=f.y,c.array[g+2]=f.z,c.array[g+3]=f.w,g+=4}}else{if(r)for(c=0;c<i;c++)f=e[c],g=3*c,k[g]=f.x,k[g+1]=f.y,k[g+2]=f.z;if(v)for(e=0;e<j;e++)i=h[e],g=3*e,n[g]=i.r,n[g+1]=i.g,n[g+2]=i.b;if(p){h=0;for(j=p.length;h<j;h++)if(c=p[h],c.needsUpdate&&(void 0===c.boundTo||"vertices"===c.boundTo))if(i=c.value.length,g=0,1===c.size)for(e=0;e<i;e++)c.array[e]=c.value[e];else if(2===c.size)for(e=0;e<i;e++)f=c.value[e],c.array[g]=f.x,c.array[g+
  486. 1]=f.y,g+=2;else if(3===c.size)if("c"===c.type)for(e=0;e<i;e++)f=c.value[e],c.array[g]=f.r,c.array[g+1]=f.g,c.array[g+2]=f.b,g+=3;else for(e=0;e<i;e++)f=c.value[e],c.array[g]=f.x,c.array[g+1]=f.y,c.array[g+2]=f.z,g+=3;else if(4===c.size)for(e=0;e<i;e++)f=c.value[e],c.array[g]=f.x,c.array[g+1]=f.y,c.array[g+2]=f.z,c.array[g+3]=f.w,g+=4}}(r||b.sortParticles)&&d.setDynamicArrayBuffer(a.__webglVertexBuffer,k);(v||b.sortParticles)&&d.setDynamicArrayBuffer(a.__webglColorBuffer,n);if(p){h=0;for(j=p.length;h<
  487. j;h++)c=p[h],(c.needsUpdate||b.sortParticles)&&d.setDynamicArrayBuffer(c.buffer,c.array)}}});THREE.WebGLRenderer.ParticleRenderer._m1=new THREE.Matrix4;THREE.WebGLRenderer.ParticleRenderer._v1=new THREE.Vector3;THREE.WebGLRenderer.LineRenderer=function(a,b){THREE.WebGLRenderer.Object3DRenderer.call(this,a,b)};THREE.WebGLRenderer.LineRenderer.prototype=Object.create(THREE.WebGLRenderer.Object3DRenderer.prototype);
  488. THREE.extend(THREE.WebGLRenderer.LineRenderer.prototype,{createBuffers:function(a){var b=this.renderer;a.__webglVertexBuffer=b.createBuffer();a.__webglColorBuffer=b.createBuffer();a.__webglLineDistanceBuffer=b.createBuffer();this.info.memory.geometries++},initBuffers:function(a,b){var c=a.vertices.length;a.__vertexArray=new Float32Array(3*c);a.__colorArray=new Float32Array(3*c);a.__lineDistanceArray=new Float32Array(1*c);a.__webglLineCount=c;this.initCustomAttributes(a,b)},setBuffers:function(a){var b=
  489. this.renderer,c,d,e,f=a.vertices,g=a.colors,i=a.lineDistances,h=f.length,j=g.length,k=i.length,n=a.__vertexArray,m=a.__colorArray,r=a.__lineDistanceArray,v=a.colorsNeedUpdate,p=a.lineDistancesNeedUpdate,q=a.__webglCustomAttributesList;if(a.verticesNeedUpdate){for(c=0;c<h;c++)e=f[c],d=3*c,n[d]=e.x,n[d+1]=e.y,n[d+2]=e.z;b.setDynamicArrayBuffer(a.__webglVertexBuffer,n)}if(v){for(c=0;c<j;c++)e=g[c],d=3*c,m[d]=e.r,m[d+1]=e.g,m[d+2]=e.b;b.setDynamicArrayBuffer(a.__webglColorBuffer,m)}if(p){for(d=0;d<k;d++)r[d]=
  490. i[d];b.setDynamicArrayBuffer(a.__webglLineDistanceBuffer,r)}if(q){a=0;for(i=q.length;a<i;a++)if(j=q[a],j.needsUpdate&&(void 0===j.boundTo||"vertices"===j.boundTo)){d=0;r=j.value.length;if(1===j.size)for(k=0;k<r;k++)j.array[k]=j.value[k];else if(2===j.size)for(k=0;k<r;k++)g=j.value[k],j.array[d]=g.x,j.array[d+1]=g.y,d+=2;else if(3===j.size)if("c"===j.type)for(k=0;k<r;k++)g=j.value[k],j.array[d]=g.r,j.array[d+1]=g.g,j.array[d+2]=g.b,d+=3;else for(k=0;k<r;k++)g=j.value[k],j.array[d]=g.x,j.array[d+1]=
  491. g.y,j.array[d+2]=g.z,d+=3;else if(4===j.size)for(k=0;k<r;k++)g=j.value[k],j.array[d]=g.x,j.array[d+1]=g.y,j.array[d+2]=g.z,j.array[d+3]=g.w,d+=4;b.setDynamicArrayBuffer(j.buffer,j.array)}}}});THREE.WebGLRenderer.RibbonRenderer=function(a,b){THREE.WebGLRenderer.Object3DRenderer.call(this,a,b)};THREE.WebGLRenderer.RibbonRenderer.prototype=Object.create(THREE.WebGLRenderer.Object3DRenderer.prototype);
  492. THREE.extend(THREE.WebGLRenderer.RibbonRenderer.prototype,{createBuffers:function(a){var b=this.renderer;a.__webglVertexBuffer=b.createBuffer();a.__webglColorBuffer=b.createBuffer();a.__webglNormalBuffer=b.createBuffer();this.info.memory.geometries++},initBuffers:function(a,b){var c=a.vertices.length;a.__vertexArray=new Float32Array(3*c);a.__colorArray=new Float32Array(3*c);a.__normalArray=new Float32Array(3*c);a.__webglVertexCount=c;this.initCustomAttributes(a,b)},setBuffers:function(a){var b=this.renderer,
  493. c,d,e,f,g,i,h,j,k=a.vertices;d=a.colors;i=a.normals;var n=k.length;g=d.length;h=i.length;var m=a.__vertexArray,r=a.__colorArray;j=a.__normalArray;var v=a.colorsNeedUpdate,p=a.normalsNeedUpdate,q=a.__webglCustomAttributesList;if(a.verticesNeedUpdate){for(c=0;c<n;c++)e=k[c],f=3*c,m[f]=e.x,m[f+1]=e.y,m[f+2]=e.z;b.setDynamicArrayBuffer(a.__webglVertexBuffer,m)}if(v){for(c=0;c<g;c++)e=d[c],f=3*c,r[f]=e.r,r[f+1]=e.g,r[f+2]=e.b;b.setDynamicArrayBuffer(a.__webglColorBuffer,r)}if(p){for(d=0;d<h;d++)g=i[d],
  494. f=3*d,j[f]=g.x,j[f+1]=g.y,j[f+2]=g.z;b.setDynamicArrayBuffer(a.__webglNormalBuffer,j)}if(q){a=0;for(i=q.length;a<i;a++)if(d=q[a],d.needsUpdate&&(void 0===d.boundTo||"vertices"===d.boundTo)){f=0;j=d.value.length;if(1===d.size)for(h=0;h<j;h++)d.array[h]=d.value[h];else if(2===d.size)for(h=0;h<j;h++)g=d.value[h],d.array[f]=g.x,d.array[f+1]=g.y,f+=2;else if(3===d.size)if("c"===d.type)for(h=0;h<j;h++)g=d.value[h],d.array[f]=g.r,d.array[f+1]=g.g,d.array[f+2]=g.b,f+=3;else for(h=0;h<j;h++)g=d.value[h],d.array[f]=
  495. g.x,d.array[f+1]=g.y,d.array[f+2]=g.z,f+=3;else if(4===d.size)for(h=0;h<j;h++)g=d.value[h],d.array[f]=g.x,d.array[f+1]=g.y,d.array[f+2]=g.z,d.array[f+3]=g.w,f+=4;b.setDynamicArrayBuffer(d.buffer,d.array)}}}});THREE.WebGLRenderTarget=function(a,b,c){THREE.EventDispatcher.call(this);this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);
  496. this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null};
  497. THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;a.shareDepthFrom=this.shareDepthFrom;return a};
  498. THREE.WebGLRenderTarget.prototype.dispose=function(){this.dispatchEvent({type:"dispose"})};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
  499. this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=this.object=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};THREE.GeometryUtils={merge:function(a,b){var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,i=f.vertices,h=a.faces,j=f.faces,k=a.faceVertexUvs[0],f=f.faceVertexUvs[0];b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix3,d.getInverse(c),d.transpose());for(var n=0,m=i.length;n<m;n++){var r=i[n].clone();c&&r.applyMatrix4(c);g.push(r)}n=0;for(m=j.length;n<m;n++){var r=j[n],v,p,q=r.vertexNormals,x=r.vertexColors;r instanceof THREE.Face3?
  500. v=new THREE.Face3(r.a+e,r.b+e,r.c+e):r instanceof THREE.Face4&&(v=new THREE.Face4(r.a+e,r.b+e,r.c+e,r.d+e));v.normal.copy(r.normal);d&&v.normal.applyMatrix3(d).normalize();g=0;for(i=q.length;g<i;g++)p=q[g].clone(),d&&p.applyMatrix3(d).normalize(),v.vertexNormals.push(p);v.color.copy(r.color);g=0;for(i=x.length;g<i;g++)p=x[g],v.vertexColors.push(p.clone());v.materialIndex=r.materialIndex;v.centroid.copy(r.centroid);c&&v.centroid.applyMatrix4(c);h.push(v)}n=0;for(m=f.length;n<m;n++){c=f[n];d=[];g=0;
  501. for(i=c.length;g<i;g++)d.push(new THREE.Vector2(c[g].x,c[g].y));k.push(d)}},removeMaterials:function(a,b){for(var c={},d=0,e=b.length;d<e;d++)c[b[d]]=!0;for(var f,g=[],d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f.materialIndex in c||g.push(f);a.faces=g},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,i=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);i.copy(b);i.multiplyScalar(e);g.add(i);
  502. i.copy(c);i.multiplyScalar(f);g.add(i);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=b.vertices[a.a],e=b.vertices[a.b],f=b.vertices[a.c],THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(a instanceof THREE.Face4){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];var b=b.vertices[a.d],g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,
  503. e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,f=a.faces,g=a.vertices,i=f.length,h=0,j=[],k,n,m,r;for(e=0;e<i;e++)d=f[e],d instanceof THREE.Face3?(k=g[d.a],n=g[d.b],m=g[d.c],
  504. d._area=THREE.GeometryUtils.triangleArea(k,n,m)):d instanceof THREE.Face4&&(k=g[d.a],n=g[d.b],m=g[d.c],r=g[d.d],d._area1=THREE.GeometryUtils.triangleArea(k,n,r),d._area2=THREE.GeometryUtils.triangleArea(n,m,r),d._area=d._area1+d._area2),h+=d._area,j[e]=h;d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*h,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d=THREE.GeometryUtils.__v1,e=THREE.GeometryUtils.__v2;d.subVectors(b,a);e.subVectors(c,a);
  505. d.cross(e);return 0.5*d.length()},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.addVectors(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++)1!==d[e].x&&(d[e].x-=Math.floor(d[e].x)),1!==d[e].y&&(d[e].y-=Math.floor(d[e].y))},triangulateQuads:function(a){var b,c,d,e,
  506. f=[],g=[],i=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)i[b]=[];b=0;for(c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){e=d.a;var h=d.b,j=d.c,k=d.d,n=new THREE.Face3,m=new THREE.Face3;n.color.copy(d.color);m.color.copy(d.color);n.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;n.a=e;n.b=h;n.c=k;m.a=h;m.b=j;m.c=k;4===d.vertexColors.length&&(n.vertexColors[0]=d.vertexColors[0].clone(),n.vertexColors[1]=d.vertexColors[1].clone(),
  507. n.vertexColors[2]=d.vertexColors[3].clone(),m.vertexColors[0]=d.vertexColors[1].clone(),m.vertexColors[1]=d.vertexColors[2].clone(),m.vertexColors[2]=d.vertexColors[3].clone());f.push(n,m);d=0;for(e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(n=a.faceVertexUvs[d][b],h=n[1],j=n[2],k=n[3],n=[n[0].clone(),h.clone(),k.clone()],h=[h.clone(),j.clone(),k.clone()],i[d].push(n,h));d=0;for(e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(h=a.faceUvs[d][b],g[d].push(h,h))}else{f.push(d);d=0;for(e=
  508. a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d][b]);d=0;for(e=a.faceVertexUvs.length;d<e;d++)i[d].push(a.faceVertexUvs[d][b])}a.faces=f;a.faceUvs=g;a.faceVertexUvs=i;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},setMaterialIndex:function(a,b,c,d){a=a.faces;d=d||a.length-1;for(c=c||0;c<=d;c++)a[c].materialIndex=b}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;THREE.GeometryUtils.__v2=new THREE.Vector3;THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new Image,f=new THREE.Texture(e,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){f.image=a.content;f.needsUpdate=!0;c&&c(f)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a,e);f.sourceFile=a;return f},loadCompressedTexture:function(a,b,c,d){var e=new THREE.CompressedTexture;e.mapping=b;var f=new XMLHttpRequest;f.onload=function(){var a=THREE.ImageUtils.parseDDS(f.response,
  509. !0);e.format=a.format;e.mipmaps=a.mipmaps;e.image.width=a.width;e.image.height=a.height;e.generateMipmaps=!1;e.needsUpdate=!0;c&&c(e)};f.onerror=d;f.open("GET",a,!0);f.responseType="arraybuffer";f.send(null);return e},loadTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.Texture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;for(var b=0,g=a.length;b<g;++b){var i=new Image;e[b]=i;i.onload=function(){e.loadCount+=1;6===e.loadCount&&(f.needsUpdate=!0,c&&c(f))};i.onerror=d;i.crossOrigin=
  510. this.crossOrigin;i.src=a[b]}return f},loadCompressedTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;b=function(a,b){return function(){var d=THREE.ImageUtils.parseDDS(a.response,!0);b.format=d.format;b.mipmaps=d.mipmaps;b.width=d.width;b.height=d.height;e.loadCount+=1;6===e.loadCount&&(f.format=d.format,f.needsUpdate=!0,c&&c(f))}};if(a instanceof Array)for(var g=0,i=a.length;g<i;++g){var h={};
  511. e[g]=h;var j=new XMLHttpRequest;j.onload=b(j,h);j.onerror=d;h=a[g];j.open("GET",h,!0);j.responseType="arraybuffer";j.send(null)}else j=new XMLHttpRequest,j.onload=function(){var a=THREE.ImageUtils.parseDDS(j.response,!0);if(a.isCubemap){for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var g=0;g<a.mipmapCount;g++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+g]),e[d].format=a.format,e[d].width=a.width,e[d].height=a.height}f.format=a.format;f.needsUpdate=!0;c&&c(f)}},j.onerror=
  512. d,j.open("GET",a,!0),j.responseType="arraybuffer",j.send(null);return f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},e=c("DXT1"),f=c("DXT3"),g=c("DXT5"),i=new Int32Array(a,0,31);if(542327876!==i[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!i[20]&4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),
  513. d;var h=i[21];switch(h){case e:e=8;d.format=THREE.RGB_S3TC_DXT1_Format;break;case f:e=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case g:e=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(h&255,h>>8&255,h>>16&255,h>>24&255)),d}d.mipmapCount=1;i[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,i[7]));d.isCubemap=i[28]&512?!0:!1;d.width=i[4];d.height=i[3];for(var i=i[1]+4,f=d.width,g=d.height,h=d.isCubemap?
  514. 6:1,j=0;j<h;j++){for(var k=0;k<d.mipmapCount;k++){var n=Math.max(4,f)/4*Math.max(4,g)/4*e,m={data:new Uint8Array(a,i,n),width:f,height:g};d.mipmaps.push(m);i+=n;f=Math.max(0.5*f,1);g=Math.max(0.5*g,1)}f=d.width;g=d.height}return d},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var i=g.getImageData(0,
  515. 0,d,e).data,h=g.createImageData(d,e),j=h.data,k=0;k<d;k++)for(var n=0;n<e;n++){var m=0>n-1?0:n-1,r=n+1>e-1?e-1:n+1,v=0>k-1?0:k-1,p=k+1>d-1?d-1:k+1,q=[],x=[0,0,i[4*(n*d+k)]/255*b];q.push([-1,0,i[4*(n*d+v)]/255*b]);q.push([-1,-1,i[4*(m*d+v)]/255*b]);q.push([0,-1,i[4*(m*d+k)]/255*b]);q.push([1,-1,i[4*(m*d+p)]/255*b]);q.push([1,0,i[4*(n*d+p)]/255*b]);q.push([1,1,i[4*(r*d+p)]/255*b]);q.push([0,1,i[4*(r*d+k)]/255*b]);q.push([-1,1,i[4*(r*d+v)]/255*b]);m=[];v=q.length;for(r=0;r<v;r++){var p=q[r],u=q[(r+1)%
  516. v],p=[p[0]-x[0],p[1]-x[1],p[2]-x[2]],u=[u[0]-x[0],u[1]-x[1],u[2]-x[2]];m.push(c([p[1]*u[2]-p[2]*u[1],p[2]*u[0]-p[0]*u[2],p[0]*u[1]-p[1]*u[0]]))}q=[0,0,0];for(r=0;r<m.length;r++)q[0]+=m[r][0],q[1]+=m[r][1],q[2]+=m[r][2];q[0]/=m.length;q[1]/=m.length;q[2]/=m.length;x=4*(n*d+k);j[x]=255*((q[0]+1)/2)|0;j[x+1]=255*((q[1]+1)/2)|0;j[x+2]=255*q[2]|0;j[x+3]=255}g.putImageData(h,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),
  517. c=Math.floor(255*c.b),i=0;i<d;i++)e[3*i]=f,e[3*i+1]=g,e[3*i+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
  518. 0,e=String(a).split(""),f=e.length,g=[],a=0;a<f;a++){var i=new THREE.Path,i=this.extractGlyphPoints(e[a],b,c,d,i),d=d+i.offset;g.push(i.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,i,h,j,k,n,m,r,v,p,q,x=b.glyphs[a]||b.glyphs["?"];if(x){if(x.o){b=x._cachedOutline||(x._cachedOutline=x.o.split(" "));j=b.length;for(a=0;a<j;)switch(h=b[a++],h){case "m":h=b[a++]*c+d;k=b[a++]*c;e.moveTo(h,k);break;case "l":h=b[a++]*c+d;k=b[a++]*c;e.lineTo(h,k);break;case "q":h=b[a++]*
  519. c+d;k=b[a++]*c;r=b[a++]*c+d;v=b[a++]*c;e.quadraticCurveTo(r,v,h,k);if(g=f[f.length-1]){n=g.x;m=g.y;g=1;for(i=this.divisions;g<=i;g++){var u=g/i;THREE.Shape.Utils.b2(u,n,r,h);THREE.Shape.Utils.b2(u,m,v,k)}}break;case "b":if(h=b[a++]*c+d,k=b[a++]*c,r=b[a++]*c+d,v=b[a++]*-c,p=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(h,k,r,v,p,q),g=f[f.length-1]){n=g.x;m=g.y;g=1;for(i=this.divisions;g<=i;g++)u=g/i,THREE.Shape.Utils.b3(u,n,r,p,h),THREE.Shape.Utils.b3(u,m,v,q,k)}}}return{offset:x.ha*c,path:e}}}};
  520. THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
  521. (function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],i=[],h,j,k;if(0<b(a))for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var n=2*e;for(j=e-1;2<e;){if(0>=n--){console.log("Warning, unable to triangulate polygon!");break}h=j;e<=h&&(h=0);j=h+1;e<=j&&(j=0);k=j+1;e<=k&&(k=0);var m;a:{var r=m=void 0,v=void 0,p=void 0,q=void 0,x=void 0,u=void 0,z=void 0,y=
  522. void 0,r=a[g[h]].x,v=a[g[h]].y,p=a[g[j]].x,q=a[g[j]].y,x=a[g[k]].x,u=a[g[k]].y;if(1E-10>(p-r)*(u-v)-(q-v)*(x-r))m=!1;else{var t=void 0,C=void 0,E=void 0,l=void 0,I=void 0,J=void 0,B=void 0,P=void 0,A=void 0,G=void 0,A=P=B=y=z=void 0,t=x-p,C=u-q,E=r-x,l=v-u,I=p-r,J=q-v;for(m=0;m<e;m++)if(!(m===h||m===j||m===k))if(z=a[g[m]].x,y=a[g[m]].y,B=z-r,P=y-v,A=z-p,G=y-q,z-=x,y-=u,A=t*G-C*A,B=I*P-J*B,P=E*y-l*z,0<=A&&0<=P&&0<=B){m=!1;break a}m=!0}}if(m){f.push([a[g[h]],a[g[j]],a[g[k]]]);i.push([g[h],g[j],g[k]]);
  523. h=j;for(k=j+1;k<e;h++,k++)g[h]=g[k];e--;n=2*e}}return d?i:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
  524. THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
  525. THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,i=e-1,h;g<=i;)if(d=Math.floor(g+(i-g)/2),h=c[d]-f,0>h)g=d+1;else if(0<h)i=d-1;else{i=d;break}d=i;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4,a=a+1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};
  526. THREE.Curve.prototype.getTangentAt=function(a){a=this.getUtoTmapping(a);return this.getTangent(a)};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()};
  527. THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)};
  528. THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);b=new THREE.Vector2(b,a);b.normalize();return b};THREE.CubicBezierCurve=function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d};THREE.CubicBezierCurve.prototype=Object.create(THREE.Curve.prototype);
  529. THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b=new THREE.Vector2(b,a);b.normalize();return b};
  530. THREE.SplineCurve=function(a){this.points=void 0==a?[]:a};THREE.SplineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],d=this.points,e;e=(d.length-1)*a;a=Math.floor(e);e-=a;c[0]=0==a?a:a-1;c[1]=a;c[2]=a>d.length-2?d.length-1:a+1;c[3]=a>d.length-3?d.length-1:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,e);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,e);return b};
  531. THREE.EllipseCurve=function(a,b,c,d,e,f,g){this.aX=a;this.aY=b;this.xRadius=c;this.yRadius=d;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=g};THREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype);THREE.EllipseCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);b=this.aStartAngle+a*b;a=this.aX+this.xRadius*Math.cos(b);b=this.aY+this.yRadius*Math.sin(b);return new THREE.Vector2(a,b)};
  532. THREE.ArcCurve=function(a,b,c,d,e,f){THREE.EllipseCurve.call(this,a,b,c,c,d,e,f)};THREE.ArcCurve.prototype=Object.create(THREE.EllipseCurve.prototype);
  533. THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,e){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*e},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,d,e){var a=0.5*(c-a),d=0.5*(d-b),f=e*e;return(2*b-2*c+a+d)*e*f+(-3*b+3*c-2*a-d)*f+a*e+b}};
  534. THREE.Curve.create=function(a,b){a.prototype=Object.create(THREE.Curve.prototype);a.prototype.getPoint=b;return a};THREE.LineCurve3=THREE.Curve.create(function(a,b){this.v1=a;this.v2=b},function(a){var b=new THREE.Vector3;b.subVectors(this.v2,this.v1);b.multiplyScalar(a);b.add(this.v1);return b});
  535. THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b,c;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);c=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(b,c,a)});
  536. THREE.CubicBezierCurve3=THREE.Curve.create(function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d},function(a){var b,c;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);c=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(b,c,a)});
  537. THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,e,a=(d.length-1)*a;e=Math.floor(a);a-=e;c[0]=0==e?e:e-1;c[1]=e;c[2]=e>d.length-2?d.length-1:e+1;c[3]=e>d.length-3?d.length-1:e+2;e=d[c[0]];var f=d[c[1]],g=d[c[2]],c=d[c[3]];b.x=THREE.Curve.Utils.interpolate(e.x,f.x,g.x,c.x,a);b.y=THREE.Curve.Utils.interpolate(e.y,f.y,g.y,c.y,a);b.z=THREE.Curve.Utils.interpolate(e.z,f.z,g.z,c.z,a);return b});
  538. THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,e;e=(d.length-0)*a;a=Math.floor(e);e-=a;a+=0<a?0:(Math.floor(Math.abs(a)/d.length)+1)*d.length;c[0]=(a-1)%d.length;c[1]=a%d.length;c[2]=(a+1)%d.length;c[3]=(a+2)%d.length;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,e);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,e);b.z=THREE.Curve.Utils.interpolate(d[c[0]].z,
  539. d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=!1};THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype);THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};
  540. THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
  541. THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
  542. THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e,f,g;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var i,h,j,k,n=a[0]instanceof THREE.Vector3;k=n?new THREE.Vector3:new THREE.Vector2;h=0;for(j=a.length;h<j;h++)i=a[h],i.x>b?b=i.x:i.x<e&&(e=i.x),i.y>c?c=i.y:i.y<f&&(f=i.y),n&&(i.z>d?d=i.z:i.z<g&&(g=i.z)),k.add(i);a={minX:e,minY:f,maxX:b,maxY:c,centroid:k.divideScalar(j)};n&&(a.maxZ=d,a.minZ=g);return a};
  543. THREE.CurvePath.prototype.createPointsGeometry=function(a){a=this.getPoints(a,!0);return this.createGeometry(a)};THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){a=this.getSpacedPoints(a,!0);return this.createGeometry(a)};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vector3(a[c].x,a[c].y,a[c].z||0));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
  544. THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;b||(b=this.bends);d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;b||(b=this.bends);d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
  545. THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,i,h;d=0;for(e=a.length;d<e;d++)f=a[d],g=f.x,i=f.y,h=g/c.maxX,h=b.getUtoTmapping(h,g),g=b.getPoint(h),i=b.getNormalVector(h).multiplyScalar(i),f.x=g.x+i.x,f.y=g.y+i.y;return a};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
  546. THREE.Gyroscope.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(this.translationWorld,this.rotationWorld,this.scaleWorld),this.matrix.decompose(this.translationObject,this.rotationObject,this.scaleObject),this.matrixWorld.compose(this.translationWorld,this.rotationObject,this.scaleWorld)):this.matrixWorld.copy(this.matrix),
  547. this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)};THREE.Gyroscope.prototype.translationWorld=new THREE.Vector3;THREE.Gyroscope.prototype.translationObject=new THREE.Vector3;THREE.Gyroscope.prototype.rotationWorld=new THREE.Quaternion;THREE.Gyroscope.prototype.rotationObject=new THREE.Quaternion;THREE.Gyroscope.prototype.scaleWorld=new THREE.Vector3;THREE.Gyroscope.prototype.scaleObject=new THREE.Vector3;THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=Object.create(THREE.CurvePath.prototype);THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)};
  548. THREE.Path.prototype.moveTo=function(a,b){var c=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:c})};THREE.Path.prototype.lineTo=function(a,b){var c=Array.prototype.slice.call(arguments),d=this.actions[this.actions.length-1].args,d=new THREE.LineCurve(new THREE.Vector2(d[d.length-2],d[d.length-1]),new THREE.Vector2(a,b));this.curves.push(d);this.actions.push({action:THREE.PathActions.LINE_TO,args:c})};
  549. THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args,f=new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d));this.curves.push(f);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:e})};
  550. THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),i=this.actions[this.actions.length-1].args,i=new THREE.CubicBezierCurve(new THREE.Vector2(i[i.length-2],i[i.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,f));this.curves.push(i);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
  551. THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1].args;this.absarc(a+g[g.length-2],b+g[g.length-1],c,d,e,f)};
  552. THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var i=this.actions[this.actions.length-1].args;this.absellipse(a+i[i.length-2],b+i[i.length-1],c,d,e,f,g)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g){var i=Array.prototype.slice.call(arguments),h=new THREE.EllipseCurve(a,b,c,d,e,f,g);this.curves.push(h);h=h.getPoint(g?1:0);i.push(h.x);i.push(h.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:i})};
  553. THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
  554. THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);var a=a||12,c=[],d,e,f,g,i,h,j,k,n,m,r,v,p;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:i=f[2];h=f[3];n=f[0];m=f[1];0<c.length?(g=c[c.length-1],r=g.x,
  555. v=g.y):(g=this.actions[d-1].args,r=g[g.length-2],v=g[g.length-1]);for(f=1;f<=a;f++)p=f/a,g=THREE.Shape.Utils.b2(p,r,n,i),p=THREE.Shape.Utils.b2(p,v,m,h),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.BEZIER_CURVE_TO:i=f[4];h=f[5];n=f[0];m=f[1];j=f[2];k=f[3];0<c.length?(g=c[c.length-1],r=g.x,v=g.y):(g=this.actions[d-1].args,r=g[g.length-2],v=g[g.length-1]);for(f=1;f<=a;f++)p=f/a,g=THREE.Shape.Utils.b3(p,r,n,j,i),p=THREE.Shape.Utils.b3(p,v,m,k,h),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.CSPLINE_THRU:g=
  556. this.actions[d-1].args;p=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;p=p.concat(f[0]);p=new THREE.SplineCurve(p);for(f=1;f<=g;f++)c.push(p.getPointAt(f/g));break;case THREE.PathActions.ARC:i=f[0];h=f[1];m=f[2];j=f[3];g=f[4];n=!!f[5];r=g-j;v=2*a;for(f=1;f<=v;f++)p=f/v,n||(p=1-p),p=j+p*r,g=i+m*Math.cos(p),p=h+m*Math.sin(p),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.ELLIPSE:i=f[0];h=f[1];m=f[2];k=f[3];j=f[4];g=f[5];n=!!f[6];r=g-j;v=2*a;for(f=1;f<=v;f++)p=f/v,n||
  557. (p=1-p),p=j+p*r,g=i+m*Math.cos(p),p=h+k*Math.sin(p),c.push(new THREE.Vector2(g,p))}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
  558. THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&0!=f.actions.length&&(e.push(f),f=new THREE.Path),f[c].apply(f,d);0!=f.actions.length&&e.push(f);if(0==e.length)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(1==e.length)return f=e[0],g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves,d.push(g),d;if(a){g=new THREE.Shape;a=0;for(b=e.length;a<
  559. b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g.actions=f.actions,g.curves=f.curves,d.push(g),g=new THREE.Shape):g.holes.push(f)}else{a=0;for(b=e.length;a<b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g&&d.push(g),g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves):g.holes.push(f);d.push(g)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};
  560. THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};
  561. THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
  562. THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,i,h,j,k,n,m,r,v=[];for(h=0;h<b.length;h++){j=b[h];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){m=j[e];r=[];for(n=0;n<c.length;n++)k=c[n],k=m.distanceToSquared(k),r.push(k),k<f&&(f=k,g=e,i=n)}e=0<=i-1?i-1:c.length-1;f=0<=g-1?g-1:j.length-1;var p=[j[g],c[i],c[e]];n=THREE.FontUtils.Triangulate.area(p);var q=[j[g],j[f],c[i]];m=THREE.FontUtils.Triangulate.area(q);r=i;k=g;i+=1;g+=-1;0>
  563. i&&(i+=c.length);i%=c.length;0>g&&(g+=j.length);g%=j.length;e=0<=i-1?i-1:c.length-1;f=0<=g-1?g-1:j.length-1;p=[j[g],c[i],c[e]];p=THREE.FontUtils.Triangulate.area(p);q=[j[g],j[f],c[i]];q=THREE.FontUtils.Triangulate.area(q);n+m>p+q&&(i=r,g=k,0>i&&(i+=c.length),i%=c.length,0>g&&(g+=j.length),g%=j.length,e=0<=i-1?i-1:c.length-1,f=0<=g-1?g-1:j.length-1);n=c.slice(0,i);m=c.slice(i);r=j.slice(g);k=j.slice(0,g);f=[j[g],j[f],c[i]];v.push([j[g],c[i],c[e]]);v.push(f);c=n.concat(r).concat(k).concat(m)}return{shape:c,
  564. isolatedPts:v,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,i,h,j={};f=0;for(g=d.length;f<g;f++)h=d[f].x+":"+d[f].y,void 0!==j[h]&&console.log("Duplicate point",h),j[h]=f;f=0;for(g=c.length;f<g;f++){i=c[f];for(d=0;3>d;d++)h=i[d].x+":"+i[d].y,h=j[h],void 0!==h&&(i[d]=h)}f=0;for(g=e.length;f<g;f++){i=e[f];for(d=0;3>d;d++)h=i[d].x+":"+i[d].y,h=j[h],void 0!==h&&(i[d]=h)}return c.concat(e)},
  565. isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
  566. this.b3p3(a,e)}};THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){-1===a.indexOf(b)&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);-1!==b&&a.splice(b,1)},add:function(a){void 0!==b[a.name]&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(!0!==a.initialized){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++)if(0>a.hierarchy[c].keys[d].time&&
  567. (a.hierarchy[c].keys[d].time=0),void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var i=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){i={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var h=0;h<a.hierarchy[c].keys[d].morphTargets.length;h++){var j=a.hierarchy[c].keys[d].morphTargets[h];i[j]=-1}a.hierarchy[c].usedMorphTargets=i;
  568. for(d=0;d<a.hierarchy[c].keys.length;d++){var k={};for(j in i){for(h=0;h<a.hierarchy[c].keys[d].morphTargets.length;h++)if(a.hierarchy[c].keys[d].morphTargets[h]===j){k[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[h];break}h===a.hierarchy[c].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
  569. d}d=parseInt(a.length*a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if("string"===typeof a){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],
  570. b)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=void 0!==c?c:THREE.AnimationHandler.LINEAR;this.points=[];this.target=new THREE.Vector3};
  571. THREE.Animation.prototype.play=function(a,b){if(!1===this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD&&(e.useQuaternion=!0);e.matrixAutoUpdate=!0;void 0===e.animationCache&&(e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
  572. THREE.Bone?e.skinMatrix:e.matrix);var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
  573. THREE.Animation.prototype.pause=function(){!0===this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this)};
  574. THREE.Animation.prototype.update=function(a){if(!1!==this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,i,h,j,k;k=this.currentTime+=a*this.timeScale;j=this.currentTime%=this.data.length;parseInt(Math.min(j*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,m=this.hierarchy.length;n<m;n++){a=this.hierarchy[n];h=a.animationCache;for(var r=0;3>r;r++){c=b[r];g=h.prevKey[c];i=h.nextKey[c];if(i.time<=k){if(j<k)if(this.loop){g=this.data.hierarchy[n].keys[0];for(i=this.getNextKeyWith(c,n,1);i.time<
  575. j;)g=i,i=this.getNextKeyWith(c,n,i.index+1)}else{this.stop();return}else{do g=i,i=this.getNextKeyWith(c,n,i.index+1);while(i.time<j)}h.prevKey[c]=g;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(j-g.time)/(i.time-g.time);e=g[c];f=i[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+
  576. (f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)this.points[0]=this.getPrevKeyWith("pos",n,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",n,i.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(d=this.interpolateCatmullRom(this.points,1.01*d),
  577. this.target.set(d[0],d[1],d[2]),this.target.sub(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0))}else"rot"===c?THREE.Quaternion.slerp(e,f,a.quaternion,d):"scl"===c&&(c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d)}}}};
  578. THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,i,h,j;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];i=a[c[1]];h=a[c[2]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],i[0],h[0],j[0],e,c,g);d[1]=this.interpolate(f[1],i[1],h[1],j[1],e,c,g);d[2]=this.interpolate(f[2],i[2],h[2],j[2],e,c,g);return d};
  579. THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
  580. THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
  581. d.matrixWorldNeedsUpdate=!0}}};
  582. THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++)e=this.hierarchy[c],f=this.data.hierarchy[c],e.useQuaternion=!0,void 0===f.animationCache&&(f.animationCache={},f.animationCache.prevKey=null,f.animationCache.nextKey=null,f.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:
  583. e.matrix),e=this.data.hierarchy[c].keys,e.length&&(f.animationCache.prevKey=e[0],f.animationCache.nextKey=e[1],this.startTime=Math.min(e[0].time,this.startTime),this.endTime=Math.max(e[e.length-1].time,this.endTime));this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
  584. THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(void 0!==c.animationCache){var d=c.animationCache.originalMatrix;b instanceof THREE.Bone?(d.copy(b.skinMatrix),b.skinMatrix=d):(d.copy(b.matrix),b.matrix=d);delete c.animationCache}}};
  585. THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,i,h;i=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;g<this.startTimeMs&&(g=this.currentTime=this.startTimeMs+g);e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((h=g<i)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var k=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=k.length-1;e=this.hierarchy[a];if(k.length){for(k=
  586. 0;k<f.length;k++)g=f[k],(i=this.getPrevKeyWith(g,a,d))&&i.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,n=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(k.length){this.JITCompile&&n&&(d instanceof
  587. THREE.Bone?d.skinMatrix=n.originalMatrix:d.matrix=n.originalMatrix);b=n.prevKey;c=n.nextKey;if(b&&c){if(c.time<=i){if(h&&this.loop){b=k[0];for(c=k[1];c.time<g;)b=c,c=k[b.index+1]}else if(!h)for(var m=k.length-1;c.time<g&&c.index!==m;)b=c,c=k[b.index+1];n.prevKey=b;n.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=
  588. this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var i=new THREE.PerspectiveCamera(90,
  589. 1,a,b);i.up.set(0,-1,0);i.lookAt(new THREE.Vector3(0,0,1));this.add(i);var h=new THREE.PerspectiveCamera(90,1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,-1));this.add(h);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,m=c.generateMipmaps;c.generateMipmaps=!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=
  590. 2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,i,c);c.generateMipmaps=m;c.activeCubeFace=5;a.render(b,h,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CombinedCamera=function(a,b,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=Object.create(THREE.Camera.prototype);
  591. THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPerspectiveMode=!0;this.inOrthographicMode=!1};
  592. THREE.CombinedCamera.prototype.toOrthographic=function(){var a=this.cameraP.aspect,b=(this.cameraP.near+this.cameraP.far)/2,b=Math.tan(this.fov/2)*b,a=2*b*a/2,b=b/this.zoom,a=a/this.zoom;this.cameraO.left=-a;this.cameraO.right=a;this.cameraO.top=b;this.cameraO.bottom=-b;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPerspectiveMode=!1;this.inOrthographicMode=!0};
  593. THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2};THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.updateProjectionMatrix=function(){this.inPerspectiveMode?this.toPerspective():(this.toPerspective(),this.toOrthographic())};
  594. THREE.CombinedCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);var c=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
  595. THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
  596. THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.AsteriskGeometry=function(a,b){THREE.Geometry.call(this);for(var c=0.707*a,d=0.707*b,c=[[a,0,0],[b,0,0],[-a,0,0],[-b,0,0],[0,a,0],[0,b,0],[0,-a,0],[0,-b,0],[0,0,a],[0,0,b],[0,0,-a],[0,0,-b],[c,c,0],[d,d,0],[-c,-c,0],[-d,-d,0],[c,-c,0],[d,-d,0],[-c,c,0],[-d,d,0],[c,0,c],[d,0,d],[-c,0,-c],[-d,0,-d],[c,0,-c],[d,0,-d],[-c,0,c],[-d,0,d],[0,c,c],[0,d,d],[0,-c,-c],[0,-d,-d],[0,c,-c],[0,d,-d],[0,-c,c],[0,-d,d]],d=0,e=c.length;d<e;d++)this.vertices.push(new THREE.Vector3(c[d][0],c[d][1],c[d][2]))};
  597. THREE.AsteriskGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=void 0!==c?c:0,d=void 0!==d?d:2*Math.PI,b=void 0!==b?Math.max(3,b):8,e,f=[];e=new THREE.Vector3;var g=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var i=new THREE.Vector3,h=c+e/b*d;i.x=a*Math.cos(h);i.y=a*Math.sin(h);this.vertices.push(i);f.push(new THREE.Vector2((i.x/a+1)/2,-(i.y/a+1)/2+1))}c=new THREE.Vector3(0,0,-1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c])),this.faceVertexUvs[0].push([f[e],
  598. f[e+1],g]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,p){var q,x=i.widthSegments,u=i.heightSegments,z=e/2,y=f/2,t=i.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)q="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)q="y",u=i.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",x=i.depthSegments;var C=x+1,E=u+1,l=e/x,I=f/u,J=new THREE.Vector3;J[q]=0<g?1:-1;for(e=0;e<E;e++)for(f=0;f<C;f++){var B=new THREE.Vector3;B[a]=(f*l-z)*c;B[b]=(e*I-y)*d;B[q]=g;i.vertices.push(B)}for(e=
  599. 0;e<u;e++)for(f=0;f<x;f++)a=new THREE.Face4(f+C*e+t,f+C*(e+1)+t,f+1+C*(e+1)+t,f+1+C*e+t),a.normal.copy(J),a.vertexNormals.push(J.clone(),J.clone(),J.clone(),J.clone()),a.materialIndex=p,i.faces.push(a),i.faceVertexUvs[0].push([new THREE.Vector2(f/x,1-e/u),new THREE.Vector2(f/x,1-(e+1)/u),new THREE.Vector2((f+1)/x,1-(e+1)/u),new THREE.Vector2((f+1)/x,1-e/u)])}THREE.Geometry.call(this);var i=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=
  600. f||1;a=this.width/2;b=this.height/2;c=this.depth/2;g("z","y",-1,-1,this.depth,this.height,a,0);g("z","y",1,-1,this.depth,this.height,-a,1);g("x","z",1,1,this.width,this.depth,b,2);g("x","z",1,-1,this.width,this.depth,-b,3);g("x","y",1,-1,this.width,this.height,c,4);g("x","y",-1,-1,this.width,this.height,-c,5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,i,h,j=[],k=[];for(h=0;h<=e;h++){var n=[],m=[],r=h/e,v=r*(b-a)+a;for(i=0;i<=d;i++){var p=i/d,q=new THREE.Vector3;q.x=v*Math.sin(2*p*Math.PI);q.y=-r*c+g;q.z=v*Math.cos(2*p*Math.PI);this.vertices.push(q);n.push(this.vertices.length-1);m.push(new THREE.Vector2(p,1-r))}j.push(n);k.push(m)}c=(b-a)/c;for(i=0;i<d;i++){0!==a?(n=this.vertices[j[0][i]].clone(),
  601. m=this.vertices[j[0][i+1]].clone()):(n=this.vertices[j[1][i]].clone(),m=this.vertices[j[1][i+1]].clone());n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(h=0;h<e;h++){var r=j[h][i],v=j[h+1][i],p=j[h+1][i+1],q=j[h][i+1],x=n.clone(),u=n.clone(),z=m.clone(),y=m.clone(),t=k[h][i].clone(),C=k[h+1][i].clone(),E=k[h+1][i+1].clone(),l=k[h][i+1].clone();this.faces.push(new THREE.Face4(r,v,p,q,[x,u,z,y]));this.faceVertexUvs[0].push([t,C,E,l])}}if(!f&&0<
  602. a){this.vertices.push(new THREE.Vector3(0,g,0));for(i=0;i<d;i++)r=j[0][i],v=j[0][i+1],p=this.vertices.length-1,x=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),t=k[0][i].clone(),C=k[0][i+1].clone(),E=new THREE.Vector2(C.u,0),this.faces.push(new THREE.Face3(r,v,p,[x,u,z])),this.faceVertexUvs[0].push([t,C,E])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(i=0;i<d;i++)r=j[h][i+1],v=j[h][i],p=this.vertices.length-1,x=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,
  603. -1,0),z=new THREE.Vector3(0,-1,0),t=k[h][i+1].clone(),C=k[h][i].clone(),E=new THREE.Vector2(C.u,1),this.faces.push(new THREE.Face3(r,v,p,[x,u,z])),this.faceVertexUvs[0].push([t,C,E])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
  604. THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).add(f);i.copy(a).add(g);if(h.equals(i))return g.clone();
  605. h.copy(b).add(f);i.copy(c).add(g);f=d.dot(g);g=i.sub(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(h).sub(a).clone()}function e(c,d){var e,f;for(N=c.length;0<=--N;){e=N;f=N-1;0>f&&(f=c.length-1);for(var g=0,h=r+2*k,
  606. g=0;g<h;g++){var i=O*g,j=O*(g+1),l=d+e+i,i=d+f+i,m=d+f+j,j=d+e+j,n=c,p=g,q=h,s=e,t=f,l=l+P,i=i+P,m=m+P,j=j+P;B.faces.push(new THREE.Face4(l,i,m,j,null,null,u));l=z.generateSideWallUV(B,a,n,b,l,i,m,j,p,q,s,t);B.faceVertexUvs[0].push(l)}}}function f(a,b,c){B.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=P;d+=P;e+=P;B.faces.push(new THREE.Face3(c,d,e,null,null,x));c=f?z.generateBottomUV(B,a,b,c,d,e):z.generateTopUV(B,a,b,c,d,e);B.faceVertexUvs[0].push(c)}var i=void 0!==b.amount?b.amount:
  607. 100,h=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:h-2,k=void 0!==b.bevelSegments?b.bevelSegments:3,n=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,r=void 0!==b.steps?b.steps:1,v=b.extrudePath,p,q=!1,x=b.material,u=b.extrudeMaterial,z=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,y,t,C,E;v&&(p=v.getSpacedPoints(r),q=!0,n=!1,y=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(v,r,
  608. !1),t=new THREE.Vector3,C=new THREE.Vector3,E=new THREE.Vector3);n||(j=h=k=0);var l,I,J,B=this,P=this.vertices.length,m=a.extractPoints(m),A=m.shape,m=m.holes;if(v=!THREE.Shape.Utils.isClockWise(A)){A=A.reverse();I=0;for(J=m.length;I<J;I++)l=m[I],THREE.Shape.Utils.isClockWise(l)&&(m[I]=l.reverse());v=!1}var G=THREE.Shape.Utils.triangulateShape(A,m),v=A;I=0;for(J=m.length;I<J;I++)l=m[I],A=A.concat(l);var D,H,s,F,O=A.length,K=G.length,w=[],N=0,R=v.length;D=R-1;for(H=N+1;N<R;N++,D++,H++)D===R&&(D=0),
  609. H===R&&(H=0),w[N]=d(v[N],v[D],v[H]);var $=[],Y,W=w.concat();I=0;for(J=m.length;I<J;I++){l=m[I];Y=[];N=0;R=l.length;D=R-1;for(H=N+1;N<R;N++,D++,H++)D===R&&(D=0),H===R&&(H=0),Y[N]=d(l[N],l[D],l[H]);$.push(Y);W=W.concat(Y)}for(D=0;D<k;D++){l=D/k;s=h*(1-l);H=j*Math.sin(l*Math.PI/2);N=0;for(R=v.length;N<R;N++)F=c(v[N],w[N],H),f(F.x,F.y,-s);I=0;for(J=m.length;I<J;I++){l=m[I];Y=$[I];N=0;for(R=l.length;N<R;N++)F=c(l[N],Y[N],H),f(F.x,F.y,-s)}}H=j;for(N=0;N<O;N++)F=n?c(A[N],W[N],H):A[N],q?(C.copy(y.normals[0]).multiplyScalar(F.x),
  610. t.copy(y.binormals[0]).multiplyScalar(F.y),E.copy(p[0]).add(C).add(t),f(E.x,E.y,E.z)):f(F.x,F.y,0);for(l=1;l<=r;l++)for(N=0;N<O;N++)F=n?c(A[N],W[N],H):A[N],q?(C.copy(y.normals[l]).multiplyScalar(F.x),t.copy(y.binormals[l]).multiplyScalar(F.y),E.copy(p[l]).add(C).add(t),f(E.x,E.y,E.z)):f(F.x,F.y,i/r*l);for(D=k-1;0<=D;D--){l=D/k;s=h*(1-l);H=j*Math.sin(l*Math.PI/2);N=0;for(R=v.length;N<R;N++)F=c(v[N],w[N],H),f(F.x,F.y,i+s);I=0;for(J=m.length;I<J;I++){l=m[I];Y=$[I];N=0;for(R=l.length;N<R;N++)F=c(l[N],
  611. Y[N],H),q?f(F.x,F.y+p[r-1].y,p[r-1].x+s):f(F.x,F.y,i+s)}}if(n){h=0*O;for(N=0;N<K;N++)i=G[N],g(i[2]+h,i[1]+h,i[0]+h,!0);h=O*(r+2*k);for(N=0;N<K;N++)i=G[N],g(i[0]+h,i[1]+h,i[2]+h,!1)}else{for(N=0;N<K;N++)i=G[N],g(i[2],i[1],i[0],!0);for(N=0;N<K;N++)i=G[N],g(i[0]+O*r,i[1]+O*r,i[2]+O*r,!1)}i=0;e(v,i);i+=v.length;I=0;for(J=m.length;I<J;I++)l=m[I],e(l,i),i+=l.length};
  612. THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.Vector2(a.vertices[d].x,a.vertices[d].y),new THREE.Vector2(b,e),new THREE.Vector2(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,i){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,h=a.vertices[f].y,f=a.vertices[f].z,j=a.vertices[g].x,
  613. k=a.vertices[g].y,g=a.vertices[g].z,n=a.vertices[i].x,m=a.vertices[i].y,a=a.vertices[i].z;return 0.01>Math.abs(c-h)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(j,1-g),new THREE.Vector2(n,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(h,1-f),new THREE.Vector2(k,1-g),new THREE.Vector2(m,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;
  614. THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
  615. THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,g,i=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var h=e.shape,j=e.holes;if(!THREE.Shape.Utils.isClockWise(h)){h=h.reverse();e=0;for(f=j.length;e<f;e++)g=j[e],THREE.Shape.Utils.isClockWise(g)&&(j[e]=g.reverse())}var k=THREE.Shape.Utils.triangulateShape(h,j);e=0;for(f=j.length;e<f;e++)g=j[e],
  616. h=h.concat(g);j=h.length;f=k.length;for(e=0;e<j;e++)g=h[e],this.vertices.push(new THREE.Vector3(g.x,g.y,0));for(e=0;e<f;e++)j=k[e],h=j[0]+i,g=j[1]+i,j=j[2]+i,this.faces.push(new THREE.Face3(h,g,j,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,h,g,j))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var b=b||12,c=c||0,d=d||2*Math.PI,e=1/(a.length-1),f=1/b,g=0,i=b;g<=i;g++)for(var h=c+g*f*d,j=Math.cos(h),k=Math.sin(h),h=0,n=a.length;h<n;h++){var m=a[h],r=new THREE.Vector3;r.x=j*m.x-k*m.y;r.y=k*m.x+j*m.y;r.z=m.z;this.vertices.push(r)}c=a.length;g=0;for(i=b;g<i;g++){h=0;for(n=a.length-1;h<n;h++)d=b=h+c*g,k=b+c,j=b+1+c,this.faces.push(new THREE.Face4(d,k,j,b+1)),j=g*f,b=h*e,d=j+f,k=b+e,this.faceVertexUvs[0].push([new THREE.Vector2(j,
  617. b),new THREE.Vector2(d,b),new THREE.Vector2(d,k),new THREE.Vector2(j,k)])}this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.width=a;this.height=b;this.widthSegments=c||1;this.heightSegments=d||1;for(var c=a/2,e=b/2,d=this.widthSegments,f=this.heightSegments,g=d+1,i=f+1,h=this.width/d,j=this.height/f,k=new THREE.Vector3(0,0,1),a=0;a<i;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*h-c,-(a*j-e),0));for(a=0;a<f;a++)for(b=0;b<d;b++)c=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),c.normal.copy(k),c.vertexNormals.push(k.clone(),k.clone(),
  618. k.clone(),k.clone()),this.faces.push(c),this.faceVertexUvs[0].push([new THREE.Vector2(b/d,1-a/f),new THREE.Vector2(b/d,1-(a+1)/f),new THREE.Vector2((b+1)/d,1-(a+1)/f),new THREE.Vector2((b+1)/d,1-a/f)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);for(var a=a||0,b=b||50,e=void 0!==e?e:0,f=void 0!==f?f:2*Math.PI,c=void 0!==c?Math.max(3,c):8,d=void 0!==d?Math.max(3,d):8,g=[],i=a,h=(b-a)/d,a=0;a<=d;a++){for(b=0;b<=c;b++){var j=new THREE.Vector3,k=e+b/c*f;j.x=i*Math.cos(k);j.y=i*Math.sin(k);this.vertices.push(j);g.push(new THREE.Vector2((j.x/i+1)/2,-(j.y/i+1)/2+1))}i+=h}e=new THREE.Vector3(0,0,1);for(a=0;a<d;a++){f=a*c;for(b=0;b<=c;b++){var k=b+f,h=k+a,j=k+c+a,n=k+c+1+a;this.faces.push(new THREE.Face3(h,
  619. j,n,[e,e,e]));this.faceVertexUvs[0].push([g[h],g[j],g[n]]);h=k+a;j=k+c+1+a;n=k+1+a;this.faces.push(new THREE.Face3(h,j,n,[e,e,e]));this.faceVertexUvs[0].push([g[h],g[j],g[n]])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,i)};THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.radius=a||50;this.widthSegments=Math.max(3,Math.floor(b)||8);this.heightSegments=Math.max(2,Math.floor(c)||6);for(var d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI,i=[],h=[],c=0;c<=this.heightSegments;c++){for(var j=[],k=[],b=0;b<=this.widthSegments;b++){var n=b/this.widthSegments,m=c/this.heightSegments,r=new THREE.Vector3;r.x=-this.radius*Math.cos(d+n*e)*Math.sin(f+m*g);r.y=this.radius*
  620. Math.cos(f+m*g);r.z=this.radius*Math.sin(d+n*e)*Math.sin(f+m*g);this.vertices.push(r);j.push(this.vertices.length-1);k.push(new THREE.Vector2(n,1-m))}i.push(j);h.push(k)}for(c=0;c<this.heightSegments;c++)for(b=0;b<this.widthSegments;b++){var d=i[c][b+1],e=i[c][b],f=i[c+1][b],g=i[c+1][b+1],j=this.vertices[d].clone().normalize(),k=this.vertices[e].clone().normalize(),n=this.vertices[f].clone().normalize(),m=this.vertices[g].clone().normalize(),r=h[c][b+1].clone(),v=h[c][b].clone(),p=h[c+1][b].clone(),
  621. q=h[c+1][b+1].clone();Math.abs(this.vertices[d].y)===this.radius?(this.faces.push(new THREE.Face3(d,f,g,[j,n,m])),this.faceVertexUvs[0].push([r,p,q])):Math.abs(this.vertices[f].y)===this.radius?(this.faces.push(new THREE.Face3(d,e,f,[j,k,n])),this.faceVertexUvs[0].push([r,v,p])):(this.faces.push(new THREE.Face4(d,e,f,g,[j,k,n,m])),this.faceVertexUvs[0].push([r,v,p,q]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};
  622. THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TextGeometry=function(a,b){var c=THREE.FontUtils.generateShapes(a,b);b.amount=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||8;this.tubularSegments=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.radialSegments;c++)for(d=0;d<=this.tubularSegments;d++){var f=d/this.tubularSegments*this.arc,g=2*c/this.radialSegments*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var i=new THREE.Vector3;i.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);i.y=(this.radius+this.tube*
  623. Math.cos(g))*Math.sin(f);i.z=this.tube*Math.sin(g);this.vertices.push(i);a.push(new THREE.Vector2(d/this.tubularSegments,c/this.radialSegments));b.push(i.clone().sub(e).normalize())}for(c=1;c<=this.radialSegments;c++)for(d=1;d<=this.tubularSegments;d++){var e=(this.tubularSegments+1)*c+d-1,f=(this.tubularSegments+1)*(c-1)+d-1,g=(this.tubularSegments+1)*(c-1)+d,i=(this.tubularSegments+1)*c+d,h=new THREE.Face4(e,f,g,i,[b[e],b[f],b[g],b[i]]);h.normal.add(b[e]);h.normal.add(b[f]);h.normal.add(b[g]);h.normal.add(b[i]);
  624. h.normal.normalize();this.faces.push(h);this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[i].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function i(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*e*(2+c);b=0.5*e*(2+c)*b;e=0.5*f*e*Math.sin(a);return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||64;this.tubularSegments=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.radialSegments);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.radialSegments;++a){this.grid[a]=
  625. Array(this.tubularSegments);for(b=0;b<this.tubularSegments;++b){var h=2*(a/this.radialSegments)*this.p*Math.PI,g=2*(b/this.tubularSegments)*Math.PI,f=i(h,g,this.q,this.p,this.radius,this.heightScale),h=i(h+0.01,g,this.q,this.p,this.radius,this.heightScale);c.subVectors(h,f);d.addVectors(h,f);e.crossVectors(c,d);d.crossVectors(e,c);e.normalize();d.normalize();h=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=h*d.x+g*e.x;f.y+=h*d.y+g*e.y;f.z+=h*d.z+g*e.z;this.grid[a][b]=this.vertices.push(new THREE.Vector3(f.x,
  626. f.y,f.z))-1}}for(a=0;a<this.radialSegments;++a)for(b=0;b<this.tubularSegments;++b){var e=(a+1)%this.radialSegments,f=(b+1)%this.tubularSegments,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.Vector2(a/this.radialSegments,b/this.tubularSegments),h=new THREE.Vector2((a+1)/this.radialSegments,b/this.tubularSegments),j=new THREE.Vector2((a+1)/this.radialSegments,(b+1)/this.tubularSegments),k=new THREE.Vector2(a/this.radialSegments,(b+1)/this.tubularSegments);this.faces.push(new THREE.Face4(c,
  627. d,e,f));this.faceVertexUvs[0].push([g,h,j,k])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.radiusSegments=d||8;this.closed=e||!1;f&&(this.debug=new THREE.Object3D);this.grid=[];var g,i,e=this.segments+1,h,j,k,f=new THREE.Vector3,n,m,r,b=new THREE.TubeGeometry.FrenetFrames(this.path,this.segments,this.closed);n=b.tangents;m=b.normals;r=b.binormals;this.tangents=n;this.normals=m;this.binormals=r;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);k=a.getPointAt(d);d=n[b];g=m[b];
  628. i=r[b];this.debug&&(this.debug.add(new THREE.ArrowHelper(d,k,c,255)),this.debug.add(new THREE.ArrowHelper(g,k,c,16711680)),this.debug.add(new THREE.ArrowHelper(i,k,c,65280)));for(d=0;d<this.radiusSegments;d++)h=2*(d/this.radiusSegments)*Math.PI,j=-this.radius*Math.cos(h),h=this.radius*Math.sin(h),f.copy(k),f.x+=j*g.x+h*i.x,f.y+=j*g.y+h*i.y,f.z+=j*g.z+h*i.z,this.grid[b][d]=this.vertices.push(new THREE.Vector3(f.x,f.y,f.z))-1}for(b=0;b<this.segments;b++)for(d=0;d<this.radiusSegments;d++)e=this.closed?
  629. (b+1)%this.segments:b+1,f=(d+1)%this.radiusSegments,a=this.grid[b][d],c=this.grid[e][d],e=this.grid[e][f],f=this.grid[b][f],n=new THREE.Vector2(b/this.segments,d/this.radiusSegments),m=new THREE.Vector2((b+1)/this.segments,d/this.radiusSegments),r=new THREE.Vector2((b+1)/this.segments,(d+1)/this.radiusSegments),g=new THREE.Vector2(b/this.segments,(d+1)/this.radiusSegments),this.faces.push(new THREE.Face4(a,c,e,f)),this.faceVertexUvs[0].push([n,m,r,g]);this.computeCentroids();this.computeFaceNormals();
  630. this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
  631. THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],i=new THREE.Vector3,h=new THREE.Matrix4,b=b+1,j,k,n;this.tangents=e;this.normals=f;this.binormals=g;for(j=0;j<b;j++)k=j/(b-1),e[j]=a.getTangentAt(k),e[j].normalize();f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(e[0].x);k=Math.abs(e[0].y);n=Math.abs(e[0].z);j<=a&&(a=j,d.set(1,0,0));k<=a&&(a=k,d.set(0,1,0));n<=a&&d.set(0,0,1);i.crossVectors(e[0],
  632. d).normalize();f[0].crossVectors(e[0],i);g[0].crossVectors(e[0],f[0]);for(j=1;j<b;j++)f[j]=f[j-1].clone(),g[j]=g[j-1].clone(),i.crossVectors(e[j-1],e[j]),1E-4<i.length()&&(i.normalize(),d=Math.acos(e[j-1].dot(e[j])),f[j].applyMatrix4(h.makeRotationAxis(i,d))),g[j].crossVectors(e[j],f[j]);if(c){d=Math.acos(f[0].dot(f[b-1]));d/=b-1;0<e[0].dot(i.crossVectors(f[0],f[b-1]))&&(d=-d);for(j=1;j<b;j++)f[j].applyMatrix4(h.makeRotationAxis(e[j],d*j)),g[j].crossVectors(e[j],f[j])}};THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=h.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c,d){1>d?(d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]),d.centroid.add(a).add(b).add(c).divideScalar(3),d.normal=d.centroid.clone().normalize(),h.faces.push(d),d=Math.atan2(d.centroid.z,-d.centroid.x),h.faceVertexUvs[0].push([i(a.uv,
  633. a,d),i(b.uv,b,d),i(c.uv,c,d)])):(d-=1,f(a,g(a,b),g(a,c),d),f(g(a,b),b,g(b,c),d),f(g(a,c),g(b,c),c,d),f(g(a,b),g(b,c),g(a,c),d))}function g(a,b){n[a.index]||(n[a.index]=[]);n[b.index]||(n[b.index]=[]);var c=n[a.index][b.index];void 0===c&&(n[a.index][b.index]=n[b.index][a.index]=c=e((new THREE.Vector3).addVectors(a,b).divideScalar(2)));return c}function i(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+0.5,a.y));return a}THREE.Geometry.call(this);
  634. for(var c=c||1,d=d||0,h=this,j=0,k=a.length;j<k;j++)e(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var n=[],a=this.vertices,j=0,k=b.length;j<k;j++)f(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(k=this.vertices.length;j<k;j++)this.vertices[j].multiplyScalar(c);this.computeCentroids();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,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]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry=function(a,b){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]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){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]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,g=this.faceVertexUvs[0],d=void 0===d?!1:d,i,h,j,k,n=b+1;for(i=0;i<=c;i++){k=i/c;for(h=0;h<=b;h++)j=h/b,j=a(j,k),e.push(j)}var m,r,v,p;for(i=0;i<c;i++)for(h=0;h<b;h++)a=i*n+h,e=i*n+h+1,k=(i+1)*n+h,j=(i+1)*n+h+1,m=new THREE.Vector2(h/b,i/c),r=new THREE.Vector2((h+1)/b,i/c),v=new THREE.Vector2(h/b,(i+1)/c),p=new THREE.Vector2((h+1)/b,(i+1)/c),d?(f.push(new THREE.Face3(a,e,k)),f.push(new THREE.Face3(e,
  635. j,k)),g.push([m,r,v]),g.push([r,p,v])):(f.push(new THREE.Face4(a,e,j,k)),g.push([m,r,p,v]));this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ConvexGeometry=function(a){function b(a){var b=a.length();return new THREE.Vector2(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var c=[[0,1,2],[0,2,1]],d=3;d<a.length;d++){var e=d,f=a[e].clone(),g=f.length();f.x+=g*2E-6*(Math.random()-0.5);f.y+=g*2E-6*(Math.random()-0.5);f.z+=g*2E-6*(Math.random()-0.5);for(var g=[],i=0;i<c.length;){var h=c[i],j=f,k=a[h[0]],n;n=k;var m=a[h[1]],r=a[h[2]],v=new THREE.Vector3,p=new THREE.Vector3;v.subVectors(r,m);p.subVectors(n,m);v.cross(p);v.normalize();n=v;k=n.dot(k);
  636. if(n.dot(j)>=k){for(j=0;3>j;j++){k=[h[j],h[(j+1)%3]];n=!0;for(m=0;m<g.length;m++)if(g[m][0]===k[1]&&g[m][1]===k[0]){g[m]=g[g.length-1];g.pop();n=!1;break}n&&g.push(k)}c[i]=c[c.length-1];c.pop()}else i++}for(m=0;m<g.length;m++)c.push([g[m][0],g[m][1],e])}e=0;f=Array(a.length);for(d=0;d<c.length;d++){g=c[d];for(i=0;3>i;i++)void 0===f[g[i]]&&(f[g[i]]=e++,this.vertices.push(a[g[i]])),g[i]=f[g[i]]}for(d=0;d<c.length;d++)this.faces.push(new THREE.Face3(c[d][0],c[d][1],c[d][2]));for(d=0;d<this.faces.length;d++)g=
  637. this.faces[d],this.faceVertexUvs[0].push([b(this.vertices[g.a]),b(this.vertices[g.b]),b(this.vertices[g.c])]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ConvexGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){var b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a||1,0,0),new THREE.Vector3,new THREE.Vector3(0,a||1,0),new THREE.Vector3,new THREE.Vector3(0,0,a||1));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
  638. THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype);THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);void 0===c&&(c=20);void 0===d&&(d=16776960);var e=new THREE.Geometry;e.vertices.push(new THREE.Vector3(0,0,0));e.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:d}));this.add(this.line);e=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);b instanceof THREE.Vector3&&(this.position=
  639. b);this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.ArrowHelper.prototype.setDirection=function(a){var b=THREE.ArrowHelper.__v1.copy(a).normalize();0.999<b.y?this.rotation.set(0,0,0):-0.999>b.y?this.rotation.set(Math.PI,0,0):(a=THREE.ArrowHelper.__v2.set(b.z,0,-b.x).normalize(),b=Math.acos(b.y),a=THREE.ArrowHelper.__q1.setFromAxisAngle(a,b),this.rotation.setEulerFromQuaternion(a,this.eulerOrder))};
  640. THREE.ArrowHelper.prototype.setLength=function(a){this.scale.set(a,a,a)};THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.setHex(a);this.cone.material.color.setHex(a)};THREE.ArrowHelper.__v1=new THREE.Vector3;THREE.ArrowHelper.__v2=new THREE.Vector3;THREE.ArrowHelper.__q1=new THREE.Quaternion;THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.geometry.vertices.push(new THREE.Vector3);d.geometry.colors.push(new THREE.Color(b));void 0===d.pointMap[a]&&(d.pointMap[a]=[]);d.pointMap[a].push(d.geometry.vertices.length-1)}THREE.Line.call(this);var d=this;this.geometry=new THREE.Geometry;this.material=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors});this.type=THREE.LinePieces;this.matrixWorld=a.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=
  641. {};b("n1","n2",16755200);b("n2","n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200);b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1",
  642. "cf2",3355443);b("cf3","cf4",3355443);this.camera=a;this.update(a)};THREE.CameraHelper.prototype=Object.create(THREE.Line.prototype);
  643. THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(void 0!==a){d=0;for(e=a.length;d<e;d++)b.geometry.vertices[a[d]].copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",-1,-1,1);
  644. a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.geometry.verticesNeedUpdate=!0};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;THREE.DirectionalLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.position=a.position;this.direction=new THREE.Vector3;this.direction.subVectors(a.target.position,a.position);var c=THREE.Math.clamp(a.intensity,0,1);this.color=a.color.clone();this.color.multiplyScalar(c);var c=this.color.getHex(),d=new THREE.SphereGeometry(b,16,8),e=new THREE.AsteriskGeometry(1.25*b,2.25*b),f=new THREE.MeshBasicMaterial({color:c,fog:!1}),g=new THREE.LineBasicMaterial({color:c,fog:!1});this.lightSphere=
  645. new THREE.Mesh(d,f);this.lightRays=new THREE.Line(e,g,THREE.LinePieces);this.add(this.lightSphere);this.add(this.lightRays);this.lightSphere.userData.isGizmo=!0;this.lightSphere.userData.gizmoSubject=a;this.lightSphere.userData.gizmoRoot=this;this.targetSphere=null;void 0!==a.target.userData.targetInverse&&(d=new THREE.SphereGeometry(b,8,4),e=new THREE.MeshBasicMaterial({color:c,wireframe:!0,fog:!1}),this.targetSphere=new THREE.Mesh(d,e),this.targetSphere.position=a.target.position,this.targetSphere.userData.isGizmo=
  646. !0,this.targetSphere.userData.gizmoSubject=a.target,this.targetSphere.userData.gizmoRoot=this.targetSphere,c=new THREE.LineDashedMaterial({color:c,dashSize:4,gapSize:4,opacity:0.75,transparent:!0,fog:!1}),d=new THREE.Geometry,d.vertices.push(this.position.clone()),d.vertices.push(this.targetSphere.position.clone()),d.computeLineDistances(),this.targetLine=new THREE.Line(d,c),this.targetLine.userData.isGizmo=!0);this.userData.isGizmo=!0};THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype);
  647. THREE.DirectionalLightHelper.prototype.update=function(){this.direction.subVectors(this.light.target.position,this.light.position);var a=THREE.Math.clamp(this.light.intensity,0,1);this.color.copy(this.light.color);this.color.multiplyScalar(a);this.lightSphere.material.color.copy(this.color);this.lightRays.material.color.copy(this.color);null!==this.targetSphere&&(this.targetSphere.material.color.copy(this.color),this.targetLine.material.color.copy(this.color),this.targetLine.geometry.vertices[0].copy(this.light.position),
  648. this.targetLine.geometry.vertices[1].copy(this.light.target.position),this.targetLine.geometry.computeLineDistances(),this.targetLine.geometry.verticesNeedUpdate=!0)};THREE.HemisphereLightHelper=function(a,b,c){THREE.Object3D.call(this);this.light=a;this.position=a.position;var d=THREE.Math.clamp(a.intensity,0,1);this.color=a.color.clone();this.color.multiplyScalar(d);var e=this.color.getHex();this.groundColor=a.groundColor.clone();this.groundColor.multiplyScalar(d);for(var d=this.groundColor.getHex(),f=new THREE.SphereGeometry(b,16,8,0,2*Math.PI,0,0.5*Math.PI),g=new THREE.SphereGeometry(b,16,8,0,2*Math.PI,0.5*Math.PI,Math.PI),i=new THREE.MeshBasicMaterial({color:e,
  649. fog:!1}),h=new THREE.MeshBasicMaterial({color:d,fog:!1}),j=0,k=f.faces.length;j<k;j++)f.faces[j].materialIndex=0;j=0;for(k=g.faces.length;j<k;j++)g.faces[j].materialIndex=1;THREE.GeometryUtils.merge(f,g);this.lightSphere=new THREE.Mesh(f,new THREE.MeshFaceMaterial([i,h]));this.lightArrow=new THREE.ArrowHelper(new THREE.Vector3(0,1,0),new THREE.Vector3(0,1.1*(b+c),0),c,e);this.lightArrow.rotation.x=Math.PI;this.lightArrowGround=new THREE.ArrowHelper(new THREE.Vector3(0,1,0),new THREE.Vector3(0,-1.1*
  650. (b+c),0),c,d);b=new THREE.Object3D;b.rotation.x=0.5*-Math.PI;b.add(this.lightSphere);b.add(this.lightArrow);b.add(this.lightArrowGround);this.add(b);this.lightSphere.userData.isGizmo=!0;this.lightSphere.userData.gizmoSubject=a;this.lightSphere.userData.gizmoRoot=this;this.userData.isGizmo=!0;this.target=new THREE.Vector3;this.lookAt(this.target)};THREE.HemisphereLightHelper.prototype=Object.create(THREE.Object3D.prototype);
  651. THREE.HemisphereLightHelper.prototype.update=function(){var a=THREE.Math.clamp(this.light.intensity,0,1);this.color.copy(this.light.color);this.color.multiplyScalar(a);this.groundColor.copy(this.light.groundColor);this.groundColor.multiplyScalar(a);this.lightSphere.material.materials[0].color.copy(this.color);this.lightSphere.material.materials[1].color.copy(this.groundColor);this.lightArrow.setColor(this.color.getHex());this.lightArrowGround.setColor(this.groundColor.getHex());this.lookAt(this.target)};THREE.PointLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.position=a.position;var c=THREE.Math.clamp(a.intensity,0,1);this.color=a.color.clone();this.color.multiplyScalar(c);var d=this.color.getHex(),c=new THREE.SphereGeometry(b,16,8),e=new THREE.AsteriskGeometry(1.25*b,2.25*b),f=new THREE.IcosahedronGeometry(1,2),g=new THREE.MeshBasicMaterial({color:d,fog:!1}),i=new THREE.LineBasicMaterial({color:d,fog:!1}),d=new THREE.MeshBasicMaterial({color:d,fog:!1,wireframe:!0,opacity:0.1,
  652. transparent:!0});this.lightSphere=new THREE.Mesh(c,g);this.lightRays=new THREE.Line(e,i,THREE.LinePieces);this.lightDistance=new THREE.Mesh(f,d);c=a.distance;0===c?this.lightDistance.visible=!1:this.lightDistance.scale.set(c,c,c);this.add(this.lightSphere);this.add(this.lightRays);this.add(this.lightDistance);this.lightSphere.userData.isGizmo=!0;this.lightSphere.userData.gizmoSubject=a;this.lightSphere.userData.gizmoRoot=this;this.userData.isGizmo=!0};THREE.PointLightHelper.prototype=Object.create(THREE.Object3D.prototype);
  653. THREE.PointLightHelper.prototype.update=function(){var a=THREE.Math.clamp(this.light.intensity,0,1);this.color.copy(this.light.color);this.color.multiplyScalar(a);this.lightSphere.material.color.copy(this.color);this.lightRays.material.color.copy(this.color);this.lightDistance.material.color.copy(this.color);a=this.light.distance;0===a?this.lightDistance.visible=!1:(this.lightDistance.visible=!0,this.lightDistance.scale.set(a,a,a))};THREE.SpotLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.position=a.position;this.direction=new THREE.Vector3;this.direction.subVectors(a.target.position,a.position);var c=THREE.Math.clamp(a.intensity,0,1);this.color=a.color.clone();this.color.multiplyScalar(c);var c=this.color.getHex(),d=new THREE.SphereGeometry(b,16,8),e=new THREE.AsteriskGeometry(1.25*b,2.25*b),f=new THREE.CylinderGeometry(1E-4,1,1,8,1,!0),g=new THREE.Matrix4;g.rotateX(-Math.PI/2);g.translate(new THREE.Vector3(0,
  654. -0.5,0));f.applyMatrix(g);var i=new THREE.MeshBasicMaterial({color:c,fog:!1}),g=new THREE.LineBasicMaterial({color:c,fog:!1}),h=new THREE.MeshBasicMaterial({color:c,fog:!1,wireframe:!0,opacity:0.3,transparent:!0});this.lightSphere=new THREE.Mesh(d,i);this.lightCone=new THREE.Mesh(f,h);d=a.distance?a.distance:1E4;f=2*d*Math.tan(0.5*a.angle);this.lightCone.scale.set(f,f,d);this.lightRays=new THREE.Line(e,g,THREE.LinePieces);this.gyroscope=new THREE.Gyroscope;this.gyroscope.add(this.lightSphere);this.gyroscope.add(this.lightRays);
  655. this.add(this.gyroscope);this.add(this.lightCone);this.lookAt(a.target.position);this.lightSphere.userData.isGizmo=!0;this.lightSphere.userData.gizmoSubject=a;this.lightSphere.userData.gizmoRoot=this;this.targetSphere=null;void 0!==a.target.userData.targetInverse&&(e=new THREE.SphereGeometry(b,8,4),g=new THREE.MeshBasicMaterial({color:c,wireframe:!0,fog:!1}),this.targetSphere=new THREE.Mesh(e,g),this.targetSphere.position=a.target.position,this.targetSphere.userData.isGizmo=!0,this.targetSphere.userData.gizmoSubject=
  656. a.target,this.targetSphere.userData.gizmoRoot=this.targetSphere,c=new THREE.LineDashedMaterial({color:c,dashSize:4,gapSize:4,opacity:0.75,transparent:!0,fog:!1}),e=new THREE.Geometry,e.vertices.push(this.position.clone()),e.vertices.push(this.targetSphere.position.clone()),e.computeLineDistances(),this.targetLine=new THREE.Line(e,c),this.targetLine.userData.isGizmo=!0);this.userData.isGizmo=!0};THREE.SpotLightHelper.prototype=Object.create(THREE.Object3D.prototype);
  657. THREE.SpotLightHelper.prototype.update=function(){this.direction.subVectors(this.light.target.position,this.light.position);this.lookAt(this.light.target.position);var a=this.light.distance?this.light.distance:1E4,b=2*a*Math.tan(0.5*this.light.angle);this.lightCone.scale.set(b,b,a);a=THREE.Math.clamp(this.light.intensity,0,1);this.color.copy(this.light.color);this.color.multiplyScalar(a);this.lightSphere.material.color.copy(this.color);this.lightRays.material.color.copy(this.color);this.lightCone.material.color.copy(this.color);
  658. null!==this.targetSphere&&(this.targetSphere.material.color.copy(this.color),this.targetLine.material.color.copy(this.color),this.targetLine.geometry.vertices[0].copy(this.light.position),this.targetLine.geometry.vertices[1].copy(this.light.target.position),this.targetLine.geometry.computeLineDistances(),this.targetLine.geometry.verticesNeedUpdate=!0)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
  659. THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));void 0===d&&(d=THREE.NormalBlending);c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
  660. THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=Object.create(THREE.Mesh.prototype);
  661. THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[a]=b;this.animationsList.push(b)};
  662. THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},e=this.geometry,f=0,g=e.morphTargets.length;f<g;f++){var i=e.morphTargets[f].name.match(b);if(i&&1<i.length){var h=i[1];d[h]||(d[h]={start:Infinity,end:-Infinity});i=d[h];f<i.start&&(i.start=f);f>i.end&&(i.end=f);c||(c=h)}}for(h in d)i=d[h],this.createAnimation(h,i.start,i.end,a);this.firstAnimation=c};
  663. THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a])a.direction=1,a.directionBackwards=!1};THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a])a.direction=-1,a.directionBackwards=!0};THREE.MorphBlendMesh.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];c&&(c.fps=b,c.duration=(c.end-c.start)/c.fps)};
  664. THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};
  665. THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};
  666. THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight;
  667. f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,g,i,h,j,k,n,m,r;this.init=function(v){b=v.context;c=v;d=v.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);v=0;e[v++]=-1;e[v++]=-1;
  668. e[v++]=0;e[v++]=0;e[v++]=1;e[v++]=-1;e[v++]=1;e[v++]=0;e[v++]=1;e[v++]=1;e[v++]=1;e[v++]=1;e[v++]=-1;e[v++]=1;e[v++]=0;e[v++]=1;v=0;f[v++]=0;f[v++]=1;f[v++]=2;f[v++]=0;f[v++]=2;f[v++]=3;g=b.createBuffer();i=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);h=b.createTexture();j=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
  669. 0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,j);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
  670. b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(k=!1,n=a(THREE.ShaderFlares.lensFlare,d)):(k=!0,n=a(THREE.ShaderFlares.lensFlareVertexTexture,d));m={};r={};m.vertex=b.getAttribLocation(n,"position");m.uv=b.getAttribLocation(n,"uv");r.renderType=b.getUniformLocation(n,"renderType");r.map=b.getUniformLocation(n,"map");r.occlusionMap=b.getUniformLocation(n,"occlusionMap");r.opacity=
  671. b.getUniformLocation(n,"opacity");r.color=b.getUniformLocation(n,"color");r.scale=b.getUniformLocation(n,"scale");r.rotation=b.getUniformLocation(n,"rotation");r.screenPosition=b.getUniformLocation(n,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,u=a.length;if(u){var z=new THREE.Vector3,y=f/e,t=0.5*e,C=0.5*f,E=16/f,l=new THREE.Vector2(E*y,E),I=new THREE.Vector3(1,1,0),J=new THREE.Vector2(1,1),B=r,E=m;b.useProgram(n);b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);
  672. b.uniform1i(B.occlusionMap,0);b.uniform1i(B.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(E.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(E.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i);b.disable(b.CULL_FACE);b.depthMask(!1);var P,A,G,D,H;for(P=0;P<u;P++)if(E=16/f,l.set(E*y,E),D=a[P],z.set(D.matrixWorld.elements[12],D.matrixWorld.elements[13],D.matrixWorld.elements[14]),z.applyMatrix4(d.matrixWorldInverse),z.applyProjection(d.projectionMatrix),I.copy(z),J.x=I.x*t+t,
  673. J.y=I.y*C+C,k||0<J.x&&J.x<e&&0<J.y&&J.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,J.x-8,J.y-8,16,16,0);b.uniform1i(B.renderType,0);b.uniform2f(B.scale,l.x,l.y);b.uniform3f(B.screenPosition,I.x,I.y,I.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,J.x-8,J.y-8,16,16,0);b.uniform1i(B.renderType,1);b.disable(b.DEPTH_TEST);
  674. b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);D.positionScreen.copy(I);D.customUpdateCallback?D.customUpdateCallback(D):D.updateLensFlares();b.uniform1i(B.renderType,2);b.enable(b.BLEND);A=0;for(G=D.lensFlares.length;A<G;A++)H=D.lensFlares[A],0.001<H.opacity&&0.001<H.scale&&(I.x=H.x,I.y=H.y,I.z=H.z,E=H.size*H.scale/f,l.x=E*y,l.y=E,b.uniform3f(B.screenPosition,I.x,I.y,I.z),b.uniform2f(B.scale,l.x,l.y),b.uniform1f(B.rotation,H.rotation),b.uniform1f(B.opacity,
  675. H.opacity),b.uniform3f(B.color,H.color.r,H.color.g,H.color.b),c.setBlending(H.blending,H.blendEquation,H.blendSrc,H.blendDst),c.setTexture(H.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,g=new THREE.Frustum,i=new THREE.Matrix4,h=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
  676. vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(n,m){var r,v,p,q,x,u,z,y,t,C=[];q=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
  677. a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);r=0;for(v=n.__lights.length;r<v;r++)if(p=n.__lights[r],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(x=0;x<p.shadowCascadeCount;x++){var E;if(p.shadowCascadeArray[x])E=p.shadowCascadeArray[x];else{t=p;z=x;E=new THREE.DirectionalLight;E.isVirtual=!0;E.onlyShadow=!0;E.castShadow=!0;E.shadowCameraNear=t.shadowCameraNear;E.shadowCameraFar=t.shadowCameraFar;E.shadowCameraLeft=t.shadowCameraLeft;E.shadowCameraRight=t.shadowCameraRight;
  678. E.shadowCameraBottom=t.shadowCameraBottom;E.shadowCameraTop=t.shadowCameraTop;E.shadowCameraVisible=t.shadowCameraVisible;E.shadowDarkness=t.shadowDarkness;E.shadowBias=t.shadowCascadeBias[z];E.shadowMapWidth=t.shadowCascadeWidth[z];E.shadowMapHeight=t.shadowCascadeHeight[z];E.pointsWorld=[];E.pointsFrustum=[];y=E.pointsWorld;u=E.pointsFrustum;for(var l=0;8>l;l++)y[l]=new THREE.Vector3,u[l]=new THREE.Vector3;y=t.shadowCascadeNearZ[z];t=t.shadowCascadeFarZ[z];u[0].set(-1,-1,y);u[1].set(1,-1,y);u[2].set(-1,
  679. 1,y);u[3].set(1,1,y);u[4].set(-1,-1,t);u[5].set(1,-1,t);u[6].set(-1,1,t);u[7].set(1,1,t);E.originalCamera=m;u=new THREE.Gyroscope;u.position=p.shadowCascadeOffset;u.add(E);u.add(E.target);m.add(u);p.shadowCascadeArray[x]=E;console.log("Created virtualLight",E)}z=p;y=x;t=z.shadowCascadeArray[y];t.position.copy(z.position);t.target.position.copy(z.target.position);t.lookAt(t.target);t.shadowCameraVisible=z.shadowCameraVisible;t.shadowDarkness=z.shadowDarkness;t.shadowBias=z.shadowCascadeBias[y];u=z.shadowCascadeNearZ[y];
  680. z=z.shadowCascadeFarZ[y];t=t.pointsFrustum;t[0].z=u;t[1].z=u;t[2].z=u;t[3].z=u;t[4].z=z;t[5].z=z;t[6].z=z;t[7].z=z;C[q]=E;q++}else C[q]=p,q++;r=0;for(v=C.length;r<v;r++){p=C[r];p.shadowMap||(x=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(x=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:x,magFilter:x,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
  681. if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}n.add(p.shadowCamera);b.autoUpdateScene&&n.updateMatrixWorld()}p.shadowCameraVisible&&
  682. !p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&E.originalCamera==m){x=m;q=p.shadowCamera;u=p.pointsFrustum;t=p.pointsWorld;h.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(z=0;8>z;z++)y=t[z],y.copy(u[z]),THREE.ShadowMapPlugin.__projector.unprojectVector(y,x),y.applyMatrix4(q.matrixWorldInverse),y.x<h.x&&(h.x=y.x),y.x>j.x&&(j.x=y.x),y.y<h.y&&(h.y=y.y),y.y>j.y&&(j.y=y.y),y.z<h.z&&(h.z=y.z),y.z>j.z&&
  683. (j.z=y.z);q.left=h.x;q.right=j.x;q.top=j.y;q.bottom=h.y;q.updateProjectionMatrix()}q=p.shadowMap;u=p.shadowMatrix;x=p.shadowCamera;x.position.getPositionFromMatrix(p.matrixWorld);k.getPositionFromMatrix(p.target.matrixWorld);x.lookAt(k);x.updateMatrixWorld();x.matrixWorldInverse.getInverse(x.matrixWorld);p.cameraHelper&&(p.cameraHelper.visible=p.shadowCameraVisible);p.shadowCameraVisible&&p.cameraHelper.update();u.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);u.multiply(x.projectionMatrix);u.multiply(x.matrixWorldInverse);
  684. i.multiplyMatrices(x.projectionMatrix,x.matrixWorldInverse);g.setFromMatrix(i);b.setRenderTarget(q);b.clear();t=n.__webglObjects;p=0;for(q=t.length;p<q;p++)if(z=t[p],u=z.object,z.render=!1,u.visible&&u.castShadow&&(!(u instanceof THREE.Mesh||u instanceof THREE.ParticleSystem)||!u.frustumCulled||g.intersectsObject(u)))u._modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,u.matrixWorld),z.render=!0;p=0;for(q=t.length;p<q;p++)z=t[p],z.render&&(u=z.object,z=z.buffer,l=u.material instanceof THREE.MeshFaceMaterial?
  685. u.material.materials[0]:u.material,y=0<u.geometry.morphTargets.length&&l.morphTargets,l=u instanceof THREE.SkinnedMesh&&l.skinning,y=u.customDepthMaterial?u.customDepthMaterial:l?y?f:e:y?d:c,z instanceof THREE.BufferGeometry?b.renderBufferDirect(x,n.__lights,null,y,z,u):b.renderBuffer(x,n.__lights,null,y,z,u));t=n.__webglObjectsImmediate;p=0;for(q=t.length;p<q;p++)z=t[p],u=z.object,u.visible&&u.castShadow&&(u._modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,u.matrixWorld),b.renderImmediateObject(x,
  686. n.__lights,null,c,u))}r=b.getClearColor();v=b.getClearAlpha();a.clearColor(r.r,r.g,r.b,v);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,g,i,h,j,k;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-1;e[a++]=-1;e[a++]=0;e[a++]=0;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;g=b.createBuffer();i=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,
  687. e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),r=b.createShader(b.FRAGMENT_SHADER),v=b.createShader(b.VERTEX_SHADER),p="precision "+d+" float;\n";b.shaderSource(r,p+a.fragmentShader);b.shaderSource(v,p+a.vertexShader);b.compileShader(r);b.compileShader(v);b.attachShader(m,r);b.attachShader(m,v);b.linkProgram(m);h=m;j={};k={};j.position=b.getAttribLocation(h,"position");j.uv=b.getAttribLocation(h,
  688. "uv");k.uvOffset=b.getUniformLocation(h,"uvOffset");k.uvScale=b.getUniformLocation(h,"uvScale");k.rotation=b.getUniformLocation(h,"rotation");k.scale=b.getUniformLocation(h,"scale");k.alignment=b.getUniformLocation(h,"alignment");k.color=b.getUniformLocation(h,"color");k.map=b.getUniformLocation(h,"map");k.opacity=b.getUniformLocation(h,"opacity");k.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");k.sizeAttenuation=b.getUniformLocation(h,"sizeAttenuation");k.screenPosition=b.getUniformLocation(h,
  689. "screenPosition");k.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");k.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k.fogType=b.getUniformLocation(h,"fogType");k.fogDensity=b.getUniformLocation(h,"fogDensity");k.fogNear=b.getUniformLocation(h,"fogNear");k.fogFar=b.getUniformLocation(h,"fogFar");k.fogColor=b.getUniformLocation(h,"fogColor");k.alphaTest=b.getUniformLocation(h,"alphaTest")};this.render=function(d,e,f,v){var p=d.__webglSprites,q=p.length;if(q){var x=j,u=k,z=v/
  690. f,f=0.5*f,y=0.5*v;b.useProgram(h);b.enableVertexAttribArray(x.position);b.enableVertexAttribArray(x.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(x.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(x.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i);b.uniformMatrix4fv(u.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);var t=x=0,C=d.fog;C?(b.uniform3f(u.fogColor,C.color.r,C.color.g,C.color.b),
  691. C instanceof THREE.Fog?(b.uniform1f(u.fogNear,C.near),b.uniform1f(u.fogFar,C.far),b.uniform1i(u.fogType,1),t=x=1):C instanceof THREE.FogExp2&&(b.uniform1f(u.fogDensity,C.density),b.uniform1i(u.fogType,2),t=x=2)):(b.uniform1i(u.fogType,0),t=x=0);for(var E,l,I=[],C=0;C<q;C++)E=p[C],l=E.material,E.visible&&0!==l.opacity&&(l.useScreenCoordinates?E.z=-E.position.z:(E._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,E.matrixWorld),E.z=-E._modelViewMatrix.elements[14]));p.sort(a);for(C=0;C<q;C++)E=
  692. p[C],l=E.material,E.visible&&0!==l.opacity&&(l.map&&l.map.image&&l.map.image.width)&&(b.uniform1f(u.alphaTest,l.alphaTest),!0===l.useScreenCoordinates?(b.uniform1i(u.useScreenCoordinates,1),b.uniform3f(u.screenPosition,(E.position.x*c.devicePixelRatio-f)/f,(y-E.position.y*c.devicePixelRatio)/y,Math.max(0,Math.min(1,E.position.z))),I[0]=c.devicePixelRatio,I[1]=c.devicePixelRatio):(b.uniform1i(u.useScreenCoordinates,0),b.uniform1i(u.sizeAttenuation,l.sizeAttenuation?1:0),b.uniformMatrix4fv(u.modelViewMatrix,
  693. !1,E._modelViewMatrix.elements),I[0]=1,I[1]=1),e=d.fog&&l.fog?t:0,x!==e&&(b.uniform1i(u.fogType,e),x=e),e=1/(l.scaleByViewport?v:1),I[0]*=e*z*E.scale.x,I[1]*=e*E.scale.y,b.uniform2f(u.uvScale,l.uvScale.x,l.uvScale.y),b.uniform2f(u.uvOffset,l.uvOffset.x,l.uvOffset.y),b.uniform2f(u.alignment,l.alignment.x,l.alignment.y),b.uniform1f(u.opacity,l.opacity),b.uniform3f(u.color,l.color.r,l.color.g,l.color.b),b.uniform1f(u.rotation,E.rotation),b.uniform2fv(u.scale,I),c.setBlending(l.blending,l.blendEquation,
  694. l.blendSrc,l.blendDst),c.setDepthTest(l.depthTest),c.setDepthWrite(l.depthWrite),c.setTexture(l.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,g=new THREE.Frustum,i=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,i=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
  695. vertexShader:g.vertexShader,uniforms:i,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(h,j){var k,n,m,r,v,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&h.updateMatrixWorld();j.matrixWorldInverse.getInverse(j.matrixWorld);i.multiplyMatrices(j.projectionMatrix,
  696. j.matrixWorldInverse);g.setFromMatrix(i);b.setRenderTarget(this.renderTarget);b.clear();p=h.__webglObjects;k=0;for(n=p.length;k<n;k++)if(m=p[k],v=m.object,m.render=!1,v.visible&&(!(v instanceof THREE.Mesh||v instanceof THREE.ParticleSystem)||!v.frustumCulled||g.intersectsObject(v)))v._modelViewMatrix.multiplyMatrices(j.matrixWorldInverse,v.matrixWorld),m.render=!0;var q;k=0;for(n=p.length;k<n;k++)if(m=p[k],m.render&&(v=m.object,m=m.buffer,!(v instanceof THREE.ParticleSystem)||v.customDepthMaterial))(q=
  697. v.material instanceof THREE.MeshFaceMaterial?v.material.materials[0]:v.material)&&b.setMaterialFaces(v.material),r=0<v.geometry.morphTargets.length&&q.morphTargets,q=v instanceof THREE.SkinnedMesh&&q.skinning,r=v.customDepthMaterial?v.customDepthMaterial:q?r?f:e:r?d:c,m instanceof THREE.BufferGeometry?b.renderBufferDirect(j,h.__lights,null,r,m,v):b.renderBuffer(j,h.__lights,null,r,m,v);p=h.__webglObjectsImmediate;k=0;for(n=p.length;k<n;k++)m=p[k],v=m.object,v.visible&&(v._modelViewMatrix.multiplyMatrices(j.matrixWorldInverse,
  698. v.matrixWorld),b.renderImmediateObject(j,h.__lights,null,c,v));k=b.getClearColor();n=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,n);a.enable(a.BLEND)}};THREE.ShaderFlares={lensFlareVertexTexture:{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 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 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}",
  699. 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}"},lensFlare:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
  700. fragmentShader:"precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int sizeAttenuation;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( sizeAttenuation == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
  701. fragmentShader:"uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"}};