ThreeWebGL.js 147 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. // ThreeWebGL.js r46dev - http://github.com/mrdoob/three.js
  2. var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
  3. THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,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},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var e,f,g;if(c===0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),f=a*6-e,a=c*(1-b),g=c*(1-
  4. b*f),b=c*(1-b*(1-f)),e){case 1:this.r=g;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=g;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=g;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},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},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
  5. Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
  6. THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
  7. divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},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.lengthSq())},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){return this.normalize().multiplyScalar(a)},
  8. equals:function(a){return a.x===this.x&&a.y===this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
  9. THREE.Vector3.prototype={constructor:THREE.Vector3,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},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
  10. addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){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},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
  11. divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);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*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
  12. cross: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},crossSelf:function(a){return this.set(this.y*a.z-this.z*a.y,this.z*a.x-this.x*a.z,this.x*a.y-this.y*a.x)},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){var b=Math.cos(this.y);this.y=Math.asin(a.n13);
  13. Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12/b,a.n11/b)):(this.x=0,this.z=Math.atan2(a.n21,a.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e!==void 0?e:1};
  14. THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add: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},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
  15. b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){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},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.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
  16. normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf: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}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
  17. THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(e,this.intersectObject(a[b]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function b(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function c(a,b,c,H){e.copy(H).subSelf(b);
  18. f.copy(c).subSelf(b);g.copy(a).subSelf(b);i=e.dot(e);h=e.dot(f);o=e.dot(g);p=f.dot(f);j=f.dot(g);r=1/(i*p-h*h);x=(p*o-h*j)*r;D=(i*j-h*o)*r;return x>=0&&D>=0&&x+D<1}for(var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,i,h,o,p,j,r,x,D,H,L=[],C=0,na=a.children.length;C<na;C++)Array.prototype.push.apply(L,this.intersectObject(a.children[C]));if(a instanceof THREE.Particle){C=b(this.origin,this.direction,a.matrixWorld.getPosition());if(C===null||C>a.scale.x)return[];H={distance:C,point:a.position,
  19. face:null,object:a};L.push(H)}else if(a instanceof THREE.Mesh){C=b(this.origin,this.direction,a.matrixWorld.getPosition());if(C===null||C>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return L;var Y,N,ka,E,P,J,F,U,M=a.geometry,S=M.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);C=0;for(na=M.faces.length;C<na;C++)if(H=M.faces[C],F=this.origin.clone(),U=this.direction.clone(),E=a.matrixWorld,Y=E.multiplyVector3(H.centroid.clone()).subSelf(F),J=Y.dot(U),
  20. !(J<=0)&&(Y=E.multiplyVector3(S[H.a].position.clone()),N=E.multiplyVector3(S[H.b].position.clone()),ka=E.multiplyVector3(S[H.c].position.clone()),E=H instanceof THREE.Face4?E.multiplyVector3(S[H.d].position.clone()):null,P=a.matrixRotationWorld.multiplyVector3(H.normal.clone()),J=U.dot(P),a.doubleSided||(a.flipSided?J>0:J<0)))if(J=P.dot((new THREE.Vector3).sub(Y,F))/J,F=F.addSelf(U.multiplyScalar(J)),H instanceof THREE.Face3)c(F,Y,N,ka)&&(H={distance:this.origin.distanceTo(F),point:F,face:H,object:a},
  21. L.push(H));else if(H instanceof THREE.Face4&&(c(F,Y,N,E)||c(F,N,ka,E)))H={distance:this.origin.distanceTo(F),point:F,face:H,object:a},L.push(H)}return L}};
  22. THREE.Rectangle=function(){function a(){g=e-b;i=f-c}var b,c,e,f,g,i,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(g,i,j,r){h=!1;b=g;c=i;e=j;f=r;a()};this.addPoint=function(g,i){h?(h=!1,b=g,c=i,e=g,f=i):(b=b<g?b:g,c=c<i?c:i,e=e>g?e:g,f=f>i?f:i);a()};this.add3Points=
  23. function(g,i,j,r,x,D){h?(h=!1,b=g<j?g<x?g:x:j<x?j:x,c=i<r?i<D?i:D:r<D?r:D,e=g>j?g>x?g:x:j>x?j:x,f=i>r?i>D?i:D:r>D?r:D):(b=g<j?g<x?g<b?g:b:x<b?x:b:j<x?j<b?j:b:x<b?x:b,c=i<r?i<D?i<c?i:c:D<c?D:c:r<D?r<c?r:c:D<c?D:c,e=g>j?g>x?g>e?g:e:x>e?x:e:j>x?j>e?j:e:x>e?x:e,f=i>r?i>D?i>f?i:f:D>f?D:f:r>D?r>f?r:f:D>f?D:f);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),e=g.getRight(),f=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),e=e>g.getRight()?e:g.getRight(),f=f>
  24. g.getBottom()?f:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;e+=g;f+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();e=e<g.getRight()?e:g.getRight();f=f<g.getBottom()?f:g.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;f=e=c=b=0;a()};this.isEmpty=function(){return h}};
  25. 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,e,f){return e+(a-b)*(f-e)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
  26. THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;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},transposeIntoArray:function(a){var b=this.m;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}};
  27. THREE.Matrix4=function(a,b,c,e,f,g,i,h,o,p,j,r,x,D,H,L){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,g!==void 0?g:1,i||0,h||0,o||0,p||0,j!==void 0?j:1,r||0,x||0,D||0,H||0,L!==void 0?L:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
  28. THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,g,i,h,o,p,j,r,x,D,H,L){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=g;this.n23=i;this.n24=h;this.n31=o;this.n32=p;this.n33=j;this.n34=r;this.n41=x;this.n42=D;this.n43=H;this.n44=L;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){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
  29. b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();e.length()===0&&(g.x+=1.0E-4,e.cross(c,g).normalize());f.cross(g,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=g.x;this.n21=e.y;this.n22=f.y;this.n23=g.y;this.n31=e.z;this.n32=f.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,g=a.n14,i=a.n21,h=a.n22,o=a.n23,p=a.n24,j=a.n31,r=a.n32,x=a.n33,D=a.n34,H=a.n41,L=a.n42,C=a.n43,
  30. na=a.n44,Y=b.n11,N=b.n12,ka=b.n13,E=b.n14,P=b.n21,J=b.n22,F=b.n23,U=b.n24,M=b.n31,S=b.n32,oa=b.n33,ha=b.n34,sa=b.n41,ta=b.n42,xa=b.n43,Ba=b.n44;this.n11=c*Y+e*P+f*M+g*sa;this.n12=c*N+e*J+f*S+g*ta;this.n13=c*ka+e*F+f*oa+g*xa;this.n14=c*E+e*U+f*ha+g*Ba;this.n21=i*Y+h*P+o*M+p*sa;this.n22=i*N+h*J+o*S+p*ta;this.n23=i*ka+h*F+o*oa+p*xa;this.n24=i*E+h*U+o*ha+p*Ba;this.n31=j*Y+r*P+x*M+D*sa;this.n32=j*N+r*J+x*S+D*ta;this.n33=j*ka+r*F+x*oa+D*xa;this.n34=j*E+r*U+x*ha+D*Ba;this.n41=H*Y+L*P+C*M+na*sa;this.n42=
  31. H*N+L*J+C*S+na*ta;this.n43=H*ka+L*F+C*oa+na*xa;this.n44=H*E+L*U+C*ha+na*Ba;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=
  32. a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*
  33. e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*
  34. a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,g=this.n22,i=this.n23,h=this.n24,o=this.n31,p=this.n32,j=this.n33,r=this.n34,x=this.n41,D=this.n42,H=this.n43,L=this.n44;return e*i*p*x-c*h*p*x-e*g*j*x+b*h*j*x+c*g*r*x-b*i*r*x-e*i*o*D+c*h*o*D+e*f*j*D-a*h*j*D-c*f*r*D+a*i*r*D+e*g*o*H-b*h*o*H-e*f*p*H+a*h*p*H+b*f*r*H-a*g*r*H-c*g*o*L+b*i*o*L+
  35. c*f*p*L-a*i*p*L-b*f*j*L+a*g*j*L},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;
  36. a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=
  37. this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=
  38. this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX: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},setRotationY: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},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,
  39. 0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),f=1-c,g=a.x,i=a.y,h=a.z,o=f*g,p=f*i;this.set(o*g+c,o*i-e*h,o*h+e*i,0,o*i+e*h,p*i+c,p*h-e*g,0,o*h-e*i,p*h+e*g,f*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
  40. this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,o=a.n24,p=a.n31,j=a.n32,r=a.n33,x=a.n34,D=a.n41,H=a.n42,L=a.n43,C=a.n44;this.n11=h*x*H-o*r*H+o*j*L-i*x*L-h*j*C+i*r*C;this.n12=f*r*H-e*x*H-f*j*L+c*x*L+e*j*C-c*r*C;this.n13=e*o*H-f*h*H+f*i*L-c*o*L-e*i*C+c*h*C;this.n14=f*h*j-e*o*j-f*i*r+c*o*r+e*i*x-c*h*x;this.n21=o*r*D-h*x*D-o*p*L+g*x*L+h*p*C-g*r*C;this.n22=e*x*D-f*r*D+
  41. f*p*L-b*x*L-e*p*C+b*r*C;this.n23=f*h*D-e*o*D-f*g*L+b*o*L+e*g*C-b*h*C;this.n24=e*o*p-f*h*p+f*g*r-b*o*r-e*g*x+b*h*x;this.n31=i*x*D-o*j*D+o*p*H-g*x*H-i*p*C+g*j*C;this.n32=f*j*D-c*x*D-f*p*H+b*x*H+c*p*C-b*j*C;this.n33=e*o*D-f*i*D+f*g*H-b*o*H-c*g*C+b*i*C;this.n34=f*i*p-c*o*p-f*g*j+b*o*j+c*g*x-b*i*x;this.n41=h*j*D-i*r*D-h*p*H+g*r*H+i*p*L-g*j*L;this.n42=c*r*D-e*j*D+e*p*H-b*r*H-c*p*L+b*j*L;this.n43=e*i*D-c*h*D-e*g*H+b*h*H+c*g*L-b*i*L;this.n44=c*h*p-e*i*p+e*g*j-b*h*j-c*g*r+b*i*r;this.multiplyScalar(1/a.determinant());
  42. return this},setRotationFromEuler:function(a,b){var c=a.x,e=a.y,f=a.z,g=Math.cos(c),c=Math.sin(c),i=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var o=i*h,p=i*f,j=e*h,r=e*f;this.n11=o+r*c;this.n12=j*c-p;this.n13=g*e;this.n21=g*f;this.n22=g*h;this.n23=-c;this.n31=p*c-j;this.n32=r+o*c;this.n33=g*i;break;case "ZXY":o=i*h;p=i*f;j=e*h;r=e*f;this.n11=o-r*c;this.n12=-g*f;this.n13=j+p*c;this.n21=p+j*c;this.n22=g*h;this.n23=r-o*c;this.n31=-g*e;this.n32=c;this.n33=g*i;break;case "ZYX":o=
  43. g*h;p=g*f;j=c*h;r=c*f;this.n11=i*h;this.n12=j*e-p;this.n13=o*e+r;this.n21=i*f;this.n22=r*e+o;this.n23=p*e-j;this.n31=-e;this.n32=c*i;this.n33=g*i;break;case "YZX":o=g*i;p=g*e;j=c*i;r=c*e;this.n11=i*h;this.n12=r-o*f;this.n13=j*f+p;this.n21=f;this.n22=g*h;this.n23=-c*h;this.n31=-e*h;this.n32=p*f+j;this.n33=o-r*f;break;case "XZY":o=g*i;p=g*e;j=c*i;r=c*e;this.n11=i*h;this.n12=-f;this.n13=e*h;this.n21=o*f+r;this.n22=g*h;this.n23=p*f-j;this.n31=j*f-p;this.n32=c*h;this.n33=r*f+o;break;default:o=g*h,p=g*
  44. f,j=c*h,r=c*f,this.n11=i*h,this.n12=-i*f,this.n13=e,this.n21=p+j*e,this.n22=o-r*e,this.n23=-c*i,this.n31=r-o*e,this.n32=j+p*e,this.n33=g*i}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,f=a.w,g=b+b,i=c+c,h=e+e,a=b*g,o=b*i;b*=h;var p=c*i;c*=h;e*=h;g*=f;i*=f;f*=h;this.n11=1-(p+e);this.n12=o-f;this.n13=b+i;this.n21=o+f;this.n22=1-(a+e);this.n23=c-g;this.n31=b-i;this.n32=c+g;this.n33=1-(a+p);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
  45. a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(e,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);g.set(this.n13,
  46. this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length();c.y=f.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=c.x;e.n21/=c.x;e.n31/=c.x;e.n12/=c.y;e.n22/=c.y;e.n32/=c.y;e.n13/=c.z;e.n23/=c.z;e.n33/=c.z;b.setFromRotationMatrix(e);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
  47. return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),e=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this}};
  48. THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,o=-a.n32*a.n11+a.n31*a.n12,p=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,r=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*i+a.n31*p;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*g;c[3]=a*i;c[4]=a*h;c[5]=a*o;c[6]=a*p;c[7]=a*j;c[8]=a*r;return b};
  49. THREE.Matrix4.makeFrustum=function(a,b,c,e,f,g){var i;i=new THREE.Matrix4;i.n11=2*f/(b-a);i.n12=0;i.n13=(b+a)/(b-a);i.n14=0;i.n21=0;i.n22=2*f/(e-c);i.n23=(e+c)/(e-c);i.n24=0;i.n31=0;i.n32=0;i.n33=-(g+f)/(g-f);i.n34=-2*g*f/(g-f);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(a,b,c,e){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
  50. THREE.Matrix4.makeOrtho=function(a,b,c,e,f,g){var i,h,o,p;i=new THREE.Matrix4;h=b-a;o=c-e;p=g-f;i.n11=2/h;i.n12=0;i.n13=0;i.n14=-((b+a)/h);i.n21=0;i.n22=2/o;i.n23=0;i.n24=-((c+e)/o);i.n31=0;i.n32=0;i.n33=-2/p;i.n34=-((g+f)/p);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
  51. THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;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="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!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=
  52. !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
  53. THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
  54. -1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeObject(a)}},getChildByName:function(a,b){var c,e,f;c=0;for(e=this.children.length;c<e;c++){f=this.children[c];if(f.name===a)return f;
  55. if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
  56. this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
  57. THREE.Projector=function(){function a(){var a=i[g]=i[g]||new THREE.RenderableObject;g++;return a}function b(){var a=p[o]=p[o]||new THREE.RenderableVertex;o++;return a}function c(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,g=a.z+a.w,f=b.z+b.w,i=-a.z+a.w,h=-b.z+b.w;return g>=0&&f>=0&&i>=0&&h>=0?!0:g<0&&f<0||i<0&&h<0?!1:(g<0?c=Math.max(c,g/(g-f)):f<0&&(e=Math.min(e,g/(g-f))),i<0?c=Math.max(c,i/(i-h)):h<0&&(e=Math.min(e,i/(i-h))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var f,g,i=[],h,o,p=[],
  58. j,r,x=[],D,H=[],L,C,na=[],Y,N,ka=[],E={objects:[],sprites:[],lights:[],elements:[]},P=new THREE.Vector3,J=new THREE.Vector4,F=new THREE.Matrix4,U=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],S=new THREE.Vector4,oa=new THREE.Vector4;this.computeFrustum=function(a){M[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);M[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);M[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
  59. a.n23,a.n44+a.n24);M[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);M[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);M[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=M[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);F.multiply(b.projectionMatrix,b.matrixWorldInverse);F.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
  60. F.multiply(b.matrixWorld,b.projectionMatrixInverse);F.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,e){g=0;E.objects.length=0;E.sprites.length=0;E.lights.length=0;var i=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var e=b.matrixWorld,
  61. g=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=M[h].x*e.n14+M[h].y*e.n24+M[h].z*e.n34+M[h].w,c<=g){c=!1;break a}c=!0}c?(F.multiplyVector3(P.copy(b.position)),f=a(),f.object=b,f.z=P.z,E.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(F.multiplyVector3(P.copy(b.position)),f=a(),f.object=b,f.z=P.z,E.sprites.push(f)):b instanceof THREE.Light&&E.lights.push(b);c=0;for(e=b.children.length;c<e;c++)i(b.children[c])}};i(b);e&&
  62. E.objects.sort(c);return E};this.projectScene=function(a,g,f){var i=g.near,P=g.far,M,ra,ja,K,d,Q,ga,pa,V,ma,va,Ca,Ga,ya,za,wa;N=C=D=r=0;E.elements.length=0;g.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(g));a.updateMatrixWorld();g.matrixWorldInverse.getInverse(g.matrixWorld);F.multiply(g.projectionMatrix,g.matrixWorldInverse);this.computeFrustum(F);E=this.projectGraph(a,!1);a=0;for(M=E.objects.length;a<M;a++)if(V=E.objects[a].object,ma=V.matrixWorld,
  63. Ca=V.material,o=0,V instanceof THREE.Mesh){va=V.geometry;Ga=V.geometry.materials;K=va.vertices;ya=va.faces;za=va.faceVertexUvs;va=V.matrixRotationWorld.extractRotation(ma);ra=0;for(ja=K.length;ra<ja;ra++)h=b(),h.positionWorld.copy(K[ra].position),ma.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),F.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>i&&h.positionScreen.z<P;K=0;for(ra=ya.length;K<
  64. ra;K++){ja=ya[K];if(ja instanceof THREE.Face3)if(d=p[ja.a],Q=p[ja.b],ga=p[ja.c],d.visible&&Q.visible&&ga.visible&&(V.doubleSided||V.flipSided!=(ga.positionScreen.x-d.positionScreen.x)*(Q.positionScreen.y-d.positionScreen.y)-(ga.positionScreen.y-d.positionScreen.y)*(Q.positionScreen.x-d.positionScreen.x)<0))pa=x[r]=x[r]||new THREE.RenderableFace3,r++,j=pa,j.v1.copy(d),j.v2.copy(Q),j.v3.copy(ga);else continue;else if(ja instanceof THREE.Face4)if(d=p[ja.a],Q=p[ja.b],ga=p[ja.c],pa=p[ja.d],d.visible&&
  65. Q.visible&&ga.visible&&pa.visible&&(V.doubleSided||V.flipSided!=((pa.positionScreen.x-d.positionScreen.x)*(Q.positionScreen.y-d.positionScreen.y)-(pa.positionScreen.y-d.positionScreen.y)*(Q.positionScreen.x-d.positionScreen.x)<0||(Q.positionScreen.x-ga.positionScreen.x)*(pa.positionScreen.y-ga.positionScreen.y)-(Q.positionScreen.y-ga.positionScreen.y)*(pa.positionScreen.x-ga.positionScreen.x)<0)))wa=H[D]=H[D]||new THREE.RenderableFace4,D++,j=wa,j.v1.copy(d),j.v2.copy(Q),j.v3.copy(ga),j.v4.copy(pa);
  66. else continue;j.normalWorld.copy(ja.normal);va.multiplyVector3(j.normalWorld);j.centroidWorld.copy(ja.centroid);ma.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);F.multiplyVector3(j.centroidScreen);ga=ja.vertexNormals;d=0;for(Q=ga.length;d<Q;d++)pa=j.vertexNormalsWorld[d],pa.copy(ga[d]),va.multiplyVector3(pa);d=0;for(Q=za.length;d<Q;d++)if(wa=za[d][K]){ga=0;for(pa=wa.length;ga<pa;ga++)j.uvs[d][ga]=wa[ga]}j.material=Ca;j.faceMaterial=ja.materialIndex!==null?Ga[ja.materialIndex]:
  67. null;j.z=j.centroidScreen.z;E.elements.push(j)}}else if(V instanceof THREE.Line){U.multiply(F,ma);K=V.geometry.vertices;d=b();d.positionScreen.copy(K[0].position);U.multiplyVector4(d.positionScreen);ra=1;for(ja=K.length;ra<ja;ra++)if(d=b(),d.positionScreen.copy(K[ra].position),U.multiplyVector4(d.positionScreen),Q=p[o-2],S.copy(d.positionScreen),oa.copy(Q.positionScreen),e(S,oa))S.multiplyScalar(1/S.w),oa.multiplyScalar(1/oa.w),V=na[C]=na[C]||new THREE.RenderableLine,C++,L=V,L.v1.positionScreen.copy(S),
  68. L.v2.positionScreen.copy(oa),L.z=Math.max(S.z,oa.z),L.material=Ca,E.elements.push(L)}a=0;for(M=E.sprites.length;a<M;a++)if(V=E.sprites[a].object,ma=V.matrixWorld,V instanceof THREE.Particle&&(J.set(ma.n14,ma.n24,ma.n34,1),F.multiplyVector4(J),J.z/=J.w,J.z>0&&J.z<1))i=ka[N]=ka[N]||new THREE.RenderableParticle,N++,Y=i,Y.x=J.x/J.w,Y.y=J.y/J.w,Y.z=J.z,Y.rotation=V.rotation.z,Y.scale.x=V.scale.x*Math.abs(Y.x-(J.x+g.projectionMatrix.n11)/(J.w+g.projectionMatrix.n14)),Y.scale.y=V.scale.y*Math.abs(Y.y-(J.y+
  69. g.projectionMatrix.n22)/(J.w+g.projectionMatrix.n24)),Y.material=V.material,E.elements.push(Y);f&&E.elements.sort(c);return E}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
  70. THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;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){var b=Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),g=Math.cos(c),c=Math.sin(c),i=a*b,h=e*f;this.w=i*g-h*c;this.x=i*c+h*g;this.y=e*b*g+a*f*c;this.z=a*f*g-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
  71. this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
  72. this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},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=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
  73. this.x,c=this.y,e=this.z,f=this.w,g=a.x,i=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-e*i;this.y=c*a+f*i+e*g-b*h;this.z=e*a+f*h+b*i-c*g;this.w=f*a-b*g-c*i-e*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,g=this.x,i=this.y,h=this.z,o=this.w,p=o*c+i*f-h*e,j=o*e+h*c-g*f,r=o*f+g*e-i*c,c=-g*
  74. c-i*e-h*f;b.x=p*o+c*-g+j*-h-r*-i;b.y=j*o+c*-i+r*-g-p*-h;b.z=r*o+c*-h+p*-i-j*-g;return b}};
  75. THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*b+c.w*e;c.x=a.x*b+c.x*e;c.y=a.y*b+c.y*e;c.z=a.z*b+c.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
  76. THREE.Face3=function(a,b,c,e,f,g){this.a=a;this.b=b;this.c=c;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=g;this.centroid=new THREE.Vector3};
  77. THREE.Face4=function(a,b,c,e,f,g,i){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=i;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
  78. THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
  79. THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
  80. THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c<e;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(e=this.faces.length;c<e;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var g=0,i=f.vertexNormals.length;g<i;g++)b.multiplyVector3(f.vertexNormals[g]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
  81. b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
  82. c,e,f,g,i,h=new THREE.Vector3,o=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){g=this.faces[e];if(a&&g.vertexNormals.length){h.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)h.addSelf(g.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[g.a],c=this.vertices[g.b],i=this.vertices[g.c],h.sub(i.position,c.position),o.sub(b.position,c.position),h.crossSelf(o);h.isZero()||h.normalize();g.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
  83. Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
  84. THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]),
  85. c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,b,c,e,g,d,f){h=a.vertices[b].position;o=a.vertices[c].position;p=a.vertices[e].position;j=i[g];r=i[d];x=i[f];D=o.x-h.x;H=p.x-h.x;L=o.y-h.y;C=p.y-h.y;na=o.z-h.z;Y=p.z-h.z;N=r.u-j.u;ka=x.u-j.u;E=r.v-j.v;P=x.v-j.v;J=1/(N*P-ka*E);S.set((P*D-E*H)*J,(P*L-E*C)*J,(P*na-E*Y)*J);oa.set((N*H-ka*D)*J,(N*C-ka*L)*J,(N*Y-ka*na)*J);U[b].addSelf(S);U[c].addSelf(S);U[e].addSelf(S);
  86. M[b].addSelf(oa);M[c].addSelf(oa);M[e].addSelf(oa)}var b,c,e,f,g,i,h,o,p,j,r,x,D,H,L,C,na,Y,N,ka,E,P,J,F,U=[],M=[],S=new THREE.Vector3,oa=new THREE.Vector3,ha=new THREE.Vector3,sa=new THREE.Vector3,ta=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)U[b]=new THREE.Vector3,M[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],i=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,
  87. g.d,0,1,3));var xa=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(e=0;e<g.vertexNormals.length;e++)ta.copy(g.vertexNormals[e]),f=g[xa[e]],F=U[f],ha.copy(F),ha.subSelf(ta.multiplyScalar(ta.dot(F))).normalize(),sa.cross(g.vertexNormals[e],F),f=sa.dot(M[f]),f=f<0?-1:1,g.vertexTangents[e]=new THREE.Vector4(ha.x,ha.y,ha.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
  88. y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<
  89. this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),g,i;g=0;for(i=this.vertices.length;g<i;g++)e=this.vertices[g].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),
  90. a[e]===void 0?(a[e]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[e]];g=0;for(i=this.faces.length;g<i;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];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];this.vertices=b}};THREE.GeometryCount=0;
  91. THREE.Spline=function(a){function b(a,b,c,e,g,f,i){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*i+(-3*(b-c)-2*a-e)*f+a*g+b}this.points=a;var c=[],e={x:0,y:0,z:0},f,g,i,h,o,p,j,r,x;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){f=(this.points.length-1)*a;g=Math.floor(f);i=f-g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>this.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;p=this.points[c[0]];j=this.points[c[1]];
  92. r=this.points[c[2]];x=this.points[c[3]];h=i*i;o=i*h;e.x=b(p.x,j.x,r.x,x.x,i,h,o);e.y=b(p.y,j.y,r.y,x.y,i,h,o);e.z=b(p.z,j.z,r.z,x.z,i,h,o);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e,g=b=b=0,f=new THREE.Vector3,i=new THREE.Vector3,h=[],j=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,e=this.getPoint(b),i.copy(e),j+=i.distanceTo(f),
  93. f.copy(e),b*=this.points.length-1,b=Math.floor(b),b!=g&&(h[b]=j,g=b);h[h.length]=j;return{chunks:h,total:j}};this.reparametrizeByArcLength=function(a){var b,c,e,g,f,i,h=[],j=new THREE.Vector3,o=this.getLength();h.push(j.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=o.chunks[b]-o.chunks[b-1];i=Math.ceil(a*c/o.total);g=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<i-1;c++)e=g+c*(1/i)*(f-g),e=this.getPoint(e),h.push(j.copy(e).clone());h.push(j.copy(this.points[b]).clone())}this.points=
  94. h}};THREE.Edge=function(a,b,c,e){this.vertices=[a,b];this.vertexIndices=[c,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};
  95. THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,e,f,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=e;this.near=f!==void 0?f:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
  96. THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,e){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
  97. THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,e,f,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=e;this.width=f;this.height=g;this.updateProjectionMatrix()};
  98. THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,e=a*c,a=Math.abs(a*b-e),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(e+this.x*a/this.fullWidth,e+(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=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
  99. this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
  100. THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;
  101. THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(a,b,c,e){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0;this.castShadow=e!==void 0?e:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
  102. THREE.Material=function(a){this.name="";this.id=THREE.MaterialCount++;a=a||{};this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:!1;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==void 0?a.depthTest:!0;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:!0;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:!1;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
  103. a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:!1};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;
  104. THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
  105. THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:
  106. !0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:
  107. !1};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
  108. THREE.MeshLambertMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(328965);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=
  109. a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=
  110. a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
  111. THREE.MeshPhongMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(328965);this.specular=a.specular!==void 0?new THREE.Color(a.specular):new THREE.Color(1118481);this.shininess=a.shininess!==void 0?a.shininess:30;this.metal=a.metal!==void 0?a.metal:!1;this.perPixel=a.perPixel!==void 0?a.perPixel:!1;this.map=a.map!==void 0?a.map:null;this.lightMap=
  112. a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=
  113. a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
  114. THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
  115. THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
  116. THREE.MeshShaderMaterial=function(a){console.warn("DEPRECATED: MeshShaderMaterial() is now ShaderMaterial().");return new THREE.ShaderMaterial(a)};
  117. THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
  118. THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=a.fog!==
  119. void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
  120. THREE.Texture=function(a,b,c,e,f,g){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=g!==void 0?g:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
  121. THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
  122. THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
  123. THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,e,f,g,i,h,o){THREE.Texture.call(this,null,f,g,i,h,o);this.image={data:a,width:b,height:c};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
  124. THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.sortParticles=!1};
  125. THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
  126. THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};
  127. for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
  128. THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
  129. THREE.Bone.prototype.update=function(a,b){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var c,e=this.children.length;for(c=0;c<e;c++)this.children[c].update(this.skinMatrix,b)};
  130. THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,e,f,g,i,h;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++)f=this.geometry.bones[c],g=f.pos,i=f.rotq,h=f.scl,e=this.addBone(),e.name=f.name,e.position.set(g[0],g[1],g[2]),e.quaternion.set(i[0],i[1],i[2],i[3]),e.useQuaternion=!0,h!==void 0?e.scale.set(h[0],h[1],h[2]):e.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)f=this.geometry.bones[c],
  131. e=this.bones[c],f.parent===-1?this.add(e):this.bones[f.parent].add(e);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
  132. THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(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)}for(var b=this.bones.length,c=this.bones,e=this.boneMatrices,a=0;a<b;a++)c[a].skinMatrix.flattenToArrayOffset(e,
  133. a*16)};
  134. THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var e=new THREE.Matrix4;e.getInverse(a.skinMatrix);b.push(e);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a].position,f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y,e=
  135. new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(e));e=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].multiplyVector3(e));this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1&&(c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5,this.geometry.skinWeights[a].x+=c,this.geometry.skinWeights[a].y+=c)}}};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};
  136. THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(a,b){b===void 0&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
  137. THREE.LOD.prototype.update=function(a){if(this.LODs.length>1){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);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=!1}};
  138. THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map instanceof THREE.Texture?a.map:THREE.ImageUtils.loadTexture(a.map);this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.useScreenCoordinates=a.useScreenCoordinates!==void 0?a.useScreenCoordinates:!0;this.mergeWith3D=a.mergeWith3D!==void 0?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=a.affectedByDistance!==void 0?a.affectedByDistance:
  139. !this.useScreenCoordinates;this.scaleByViewport=a.scaleByViewport!==void 0?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
  140. THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
  141. 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);
  142. 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=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
  143. THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
  144. THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
  145. THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
  146. 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",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
  147. envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
  148. map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
  149. 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",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_lambert_pars_vertex:"uniform vec3 ambient;\nuniform vec3 diffuse;\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_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif",
  150. lights_lambert_vertex:"vLightWeighting = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\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 pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n}\n#endif\nvLightWeighting = vLightWeighting * diffuse + ambient * ambientLightColor;",
  151. lights_phong_pars_vertex:"#if MAX_POINT_LIGHTS > 0\n#ifndef PHONG_PER_PIXEL\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif",lights_phong_vertex:"#if MAX_POINT_LIGHTS > 0\n#ifndef PHONG_PER_PIXEL\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 );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#endif",
  152. 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_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\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",
  153. lights_phong_fragment:"vec3 normal = normalize( vNormal );\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 ++ ) {\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\nvec3 pointHalfVector = normalize( lVector + viewPosition );\nfloat pointDistance = lDistance;\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointDiffuseWeight = max( dot( normal, lVector ), 0.0 );\nfloat pointSpecularWeight = pow( pointDotNormalHalf, shininess );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( lVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n#endif\npointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * pointDistance;\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 );\nvec3 dirHalfVector = normalize( lDirection.xyz + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = pow( dirDotNormalHalf, shininess );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\ndirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\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_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n#endif",
  154. 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\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif",
  155. morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif",
  156. default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\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",
  157. shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nshadowCoord.z += shadowBias;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( shadowDarkness );\n#endif\n}\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",
  158. 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 ] * objectMatrix * vec4( position, 1.0 );\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"};
  159. THREE.UniformsUtils={merge:function(a){var b,c,e,f={};for(b=0;b<a.length;b++)for(c in e=this.clone(a[b]),e)f[c]=e[c];return f},clone:function(a){var b,c,e,f={};for(b in a)for(c in f[b]={},a[b])e=a[b][c],f[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector2||e instanceof THREE.Vector3||e instanceof THREE.Vector4||e instanceof THREE.Matrix4||e instanceof THREE.Texture?e.clone():e instanceof Array?e.slice():e;return f}};
  160. THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture: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}},fog:{fogDensity:{type:"f",
  161. 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:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",
  162. value:1},map:{type:"t",value:0,texture: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:6,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
  163. THREE.ShaderLib={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\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 * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\n}"},
  164. depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",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}},
  165. vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}",fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}"},basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.map_pars_vertex,
  166. THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
  167. THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",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.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,
  168. THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,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(328965)}}]),vertexShader:["varying vec3 vLightWeighting;",THREE.ShaderChunk.map_pars_vertex,
  169. THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_lambert_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",
  170. THREE.ShaderChunk.lights_lambert_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vLightWeighting;",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.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",
  171. THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,"gl_FragColor.xyz = gl_FragColor.xyz * vLightWeighting;",THREE.ShaderChunk.lightmap_fragment,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.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",
  172. value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),vertexShader:["varying 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.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
  173. THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = -mvPosition.xyz;\nvec3 transformedNormal = normalMatrix * normal;\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,
  174. "}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\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,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,
  175. THREE.ShaderChunk.alphatest_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,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,
  176. 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;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
  177. 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,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
  178. 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}"}};
  179. THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,e=b.material;if(e.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var g in e.attributes){var f=e.attributes[g];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var q=1;f.type==="v2"?q=2:f.type==="v3"?q=3:f.type==="v4"?q=4:f.type==="c"&&(q=3);f.size=q;f.array=new Float32Array(c*q);f.buffer=d.createBuffer();f.buffer.belongsToAttribute=g;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
  180. function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,g,f,q,l=a.vertices;q=l.length;var i=a.colors,h=i.length,k=a.__vertexArray,m=a.__colorArray,j=a.__sortArray,y=a.__dirtyVertices,o=a.__dirtyColors,p=a.__webglCustomAttributesList;if(c.sortParticles){Aa.multiplySelf(c.matrixWorld);for(e=0;e<q;e++)g=l[e].position,Ea.copy(g),Aa.multiplyVector3(Ea),j[e]=[Ea.z,e];
  181. j.sort(function(a,b){return b[0]-a[0]});for(e=0;e<q;e++)g=l[j[e][1]].position,f=e*3,k[f]=g.x,k[f+1]=g.y,k[f+2]=g.z;for(e=0;e<h;e++)f=e*3,g=i[j[e][1]],m[f]=g.r,m[f+1]=g.g,m[f+2]=g.b;if(p){i=0;for(h=p.length;i<h;i++)if(l=p[i],l.boundTo===void 0||l.boundTo==="vertices")if(f=0,g=l.value.length,l.size===1)for(e=0;e<g;e++)q=j[e][1],l.array[e]=l.value[q];else if(l.size===2)for(e=0;e<g;e++)q=j[e][1],q=l.value[q],l.array[f]=q.x,l.array[f+1]=q.y,f+=2;else if(l.size===3)if(l.type==="c")for(e=0;e<g;e++)q=j[e][1],
  182. q=l.value[q],l.array[f]=q.r,l.array[f+1]=q.g,l.array[f+2]=q.b,f+=3;else for(e=0;e<g;e++)q=j[e][1],q=l.value[q],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,f+=3;else if(l.size===4)for(e=0;e<g;e++)q=j[e][1],q=l.value[q],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,l.array[f+3]=q.w,f+=4}}else{if(y)for(e=0;e<q;e++)g=l[e].position,f=e*3,k[f]=g.x,k[f+1]=g.y,k[f+2]=g.z;if(o)for(e=0;e<h;e++)g=i[e],f=e*3,m[f]=g.r,m[f+1]=g.g,m[f+2]=g.b;if(p){i=0;for(h=p.length;i<h;i++)if(l=p[i],l.needsUpdate&&(l.boundTo===
  183. void 0||l.boundTo==="vertices"))if(g=l.value.length,f=0,l.size===1)for(e=0;e<g;e++)l.array[e]=l.value[e];else if(l.size===2)for(e=0;e<g;e++)q=l.value[e],l.array[f]=q.x,l.array[f+1]=q.y,f+=2;else if(l.size===3)if(l.type==="c")for(e=0;e<g;e++)q=l.value[e],l.array[f]=q.r,l.array[f+1]=q.g,l.array[f+2]=q.b,f+=3;else for(e=0;e<g;e++)q=l.value[e],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,f+=3;else if(l.size===4)for(e=0;e<g;e++)q=l.value[e],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,l.array[f+
  184. 3]=q.w,f+=4}}if(y||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,k,b);if(o||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,m,b);if(p){i=0;for(h=p.length;i<h;i++)if(l=p[i],l.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,l.buffer),d.bufferData(d.ARRAY_BUFFER,l.array,b)}}function f(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=d.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=
  185. d.createBuffer();a.hasPos&&(d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,a.positionArray,d.DYNAMIC_DRAW),d.enableVertexAttribArray(b.attributes.position),d.vertexAttribPointer(b.attributes.position,3,d.FLOAT,!1,0,0));if(a.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,g,i,l,w,h,k,m,j,y=a.count*3;for(j=0;j<y;j+=9)c=a.normalArray,e=c[j],f=c[j+1],g=c[j+2],i=c[j+3],w=c[j+4],k=c[j+5],l=c[j+6],h=c[j+7],m=c[j+8],e=(e+i+l)/
  186. 3,f=(f+w+h)/3,g=(g+k+m)/3,c[j]=e,c[j+1]=f,c[j+2]=g,c[j+3]=e,c[j+4]=f,c[j+5]=g,c[j+6]=e,c[j+7]=f,c[j+8]=g}d.bufferData(d.ARRAY_BUFFER,a.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(b.attributes.normal);d.vertexAttribPointer(b.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,a.count);a.count=0}function g(a,b,c,e,f,g){if(e.opacity!==0){var i,l,c=C(a,b,c,e,g),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==ma&&(ma=c,a=!0);if(!e.morphTargets&&b.position>=0)a&&(d.bindBuffer(d.ARRAY_BUFFER,
  187. f.__webglVertexBuffer),d.vertexAttribPointer(b.position,3,d.FLOAT,!1,0,0));else if(g.morphTargetBase){c=e.program.attributes;g.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[g.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){i=0;var w=g.morphTargetForcedOrder;for(l=g.morphTargetInfluences;i<e.numSupportedMorphTargets&&
  188. i<w.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[w[i]]),d.vertexAttribPointer(c["morphTarget"+i],3,d.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[i]=l[w[i]],i++}else{var w=[],h=-1,k=0;l=g.morphTargetInfluences;var m,j=l.length;i=0;for(g.morphTargetBase!==-1&&(w[g.morphTargetBase]=!0);i<e.numSupportedMorphTargets;){for(m=0;m<j;m++)!w[m]&&l[m]>h&&(k=m,h=l[k]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);d.vertexAttribPointer(c["morphTarget"+i],3,d.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[i]=
  189. h;w[k]=1;h=-1;i++}}e.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(e.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){i=0;for(l=f.__webglCustomAttributesList.length;i<l;i++)c=f.__webglCustomAttributesList[i],b[c.buffer.belongsToAttribute]>=0&&(d.bindBuffer(d.ARRAY_BUFFER,c.buffer),d.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,d.FLOAT,!1,0,0))}b.color>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglColorBuffer),d.vertexAttribPointer(b.color,
  190. 3,d.FLOAT,!1,0,0));b.normal>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglNormalBuffer),d.vertexAttribPointer(b.normal,3,d.FLOAT,!1,0,0));b.tangent>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglTangentBuffer),d.vertexAttribPointer(b.tangent,4,d.FLOAT,!1,0,0));b.uv>=0&&(f.__webglUVBuffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUVBuffer),d.vertexAttribPointer(b.uv,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(b.uv)):d.disableVertexAttribArray(b.uv));b.uv2>=0&&(f.__webglUV2Buffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUV2Buffer),
  191. d.vertexAttribPointer(b.uv2,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(b.uv2)):d.disableVertexAttribArray(b.uv2));e.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexABuffer),d.vertexAttribPointer(b.skinVertexA,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),d.vertexAttribPointer(b.skinVertexB,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),d.vertexAttribPointer(b.skinIndex,
  192. 4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),d.vertexAttribPointer(b.skinWeight,4,d.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(e.wireframe?(e=e.wireframeLinewidth,e!==Ja&&(d.lineWidth(e),Ja=e),a&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),d.drawElements(d.LINES,f.__webglLineCount,d.UNSIGNED_SHORT,0)):(a&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),K.info.render.calls++,K.info.render.vertices+=
  193. f.__webglFaceCount,K.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?d.LINE_STRIP:d.LINES,e=e.linewidth,e!==Ja&&(d.lineWidth(e),Ja=e),d.drawArrays(g,0,f.__webglLineCount),K.info.render.calls++):g instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),K.info.render.calls++):g instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),K.info.render.calls++)}}function i(a){qa[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
  194. a.n13,a.n44-a.n14);qa[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);qa[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);qa[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);qa[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);qa[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=qa[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,d=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
  195. a.scale.z)),c=0;c<6;c++)if(a=qa[c].x*b.n14+qa[c].y*b.n24+qa[c].z*b.n34+qa[c].w,a<=d)return!1;return!0}function o(a,b){return b.z-a.z}function p(a){var b,c,e,j,Na,q,l,w,Da=0,k=a.lights;ia||(ia=new THREE.PerspectiveCamera(K.shadowCameraFov,K.shadowMapWidth/K.shadowMapHeight,K.shadowCameraNear,K.shadowCameraFar));b=0;for(c=k.length;b<c;b++)if(w=k[b],w.castShadow&&w instanceof THREE.SpotLight){V=-1;K.shadowMap[Da]||(K.shadowMap[Da]=new THREE.WebGLRenderTarget(K.shadowMapWidth,K.shadowMapHeight,{minFilter:THREE.LinearFilter,
  196. magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),Ka[Da]=new THREE.Matrix4);e=K.shadowMap[Da];j=Ka[Da];ia.position.copy(w.position);ia.lookAt(w.target.position);ia.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ia));this.autoUpdateScene&&a.updateMatrixWorld();ia.matrixWorldInverse.getInverse(ia.matrixWorld);j.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);j.multiplySelf(ia.projectionMatrix);j.multiplySelf(ia.matrixWorldInverse);ia.matrixWorldInverse.flattenToArray(La);
  197. ia.projectionMatrix.flattenToArray(Ma);Aa.multiply(ia.projectionMatrix,ia.matrixWorldInverse);i(Aa);S(e);d.clearColor(1,1,1,1);K.clear();d.clearColor(la.r,la.g,la.b,ra);j=a.__webglObjects.length;for(e=0;e<j;e++)if(q=a.__webglObjects[e],w=q.object,q.render=!1,w.visible&&w.castShadow&&(!(w instanceof THREE.Mesh)||!w.frustumCulled||h(w)))w.matrixWorld.flattenToArray(w._objectMatrixArray),na(w,ia,!1),q.render=!0;N(!0);P(THREE.NormalBlending);for(e=0;e<j;e++)if(q=a.__webglObjects[e],q.render)w=q.object,
  198. q=q.buffer,Y(w),l=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?Oa:Ha,g(ia,k,null,l,q,w);j=a.__webglObjectsImmediate.length;for(e=0;e<j;e++)q=a.__webglObjectsImmediate[e],w=q.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),ma=-1,na(w,ia,!1),Y(w),Na=C(ia,k,null,Ha,w),w.immediateRenderCallback?w.immediateRenderCallback(Na,d,qa):w.render(function(a){f(a,Na,Ha.shading)}));Da++}}function j(a,b,d,c,e,f,i,l){var w,h,k,m;
  199. b?(h=a.length-1,m=b=-1):(h=0,b=a.length,m=1);for(var j=h;j!==b;j+=m)if(w=a[j],w.render){h=w.object;k=w.buffer;if(l)w=l;else{w=w[d];if(!w)continue;i&&P(w.blending);N(w.depthTest);ka(w.depthWrite);E(w.polygonOffset,w.polygonOffsetFactor,w.polygonOffsetUnits)}Y(h);g(c,e,f,w,k,h)}}function r(a,b,c,e,g,i,q){for(var l,h,j,k,m=0,o=a.length;m<o;m++)if(l=a[m],h=l.object,h.visible){ma=-1;if(q)j=q;else{j=l[b];if(!j)continue;i&&P(j.blending);N(j.depthTest);ka(j.depthWrite);E(j.polygonOffset,j.polygonOffsetFactor,
  200. j.polygonOffsetUnits)}Y(h);k=C(c,e,g,j,h);h.immediateRenderCallback?h.immediateRenderCallback(k,d,qa):h.render(function(a){f(a,k,j.shading)})}}function x(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function D(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function H(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function L(a,b){for(var d=a.length-1;d>=0;d--)a[d].object===b&&a.splice(d,1)}function C(a,b,c,e,f){e.program||K.initMaterial(e,
  201. b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(K.maxMorphTargets);for(var g=0,i=K.maxMorphTargets;g<i;g++)f.__webglMorphTargetInfluences[g]=0}var l=!1,g=e.program,i=g.uniforms,h=e.uniforms;g!==ga&&(d.useProgram(g),ga=g,l=!0);if(e.id!==V)V=e.id,l=!0;if(l){d.uniformMatrix4fv(i.projectionMatrix,!1,Ma);if(c&&e.fog)if(h.fogColor.value=c.color,c instanceof THREE.Fog)h.fogNear.value=c.near,h.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)h.fogDensity.value=
  202. c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var j,k,m=0,o=0,y=0,p,r,x,t=Ra,v=t.directional.colors,D=t.directional.positions,u=t.point.colors,H=t.point.positions,L=t.point.distances,C=0,O=0,c=j=x=0,l=b.length;c<l;c++)if(j=b[c],k=j.color,p=j.position,r=j.intensity,x=j.distance,j instanceof THREE.AmbientLight)K.gammaInput?(m+=k.r*k.r,o+=k.g*k.g,y+=k.b*k.b):(m+=k.r,o+=k.g,y+=k.b);else if(j instanceof THREE.DirectionalLight)x=C*3,K.gammaInput?
  203. (v[x]=k.r*k.r*r*r,v[x+1]=k.g*k.g*r*r,v[x+2]=k.b*k.b*r*r):(v[x]=k.r*r,v[x+1]=k.g*r,v[x+2]=k.b*r),D[x]=p.x,D[x+1]=p.y,D[x+2]=p.z,C+=1;else if(j instanceof THREE.SpotLight)x=C*3,K.gammaInput?(v[x]=k.r*k.r*r*r,v[x+1]=k.g*k.g*r*r,v[x+2]=k.b*k.b*r*r):(v[x]=k.r*r,v[x+1]=k.g*r,v[x+2]=k.b*r),k=1/p.length(),D[x]=p.x*k,D[x+1]=p.y*k,D[x+2]=p.z*k,C+=1;else if(j instanceof THREE.PointLight)j=O*3,K.gammaInput?(u[j]=k.r*k.r*r*r,u[j+1]=k.g*k.g*r*r,u[j+2]=k.b*k.b*r*r):(u[j]=k.r*r,u[j+1]=k.g*r,u[j+2]=k.b*r),H[j]=p.x,
  204. H[j+1]=p.y,H[j+2]=p.z,L[O]=x,O+=1;c=C*3;for(l=v.length;c<l;c++)v[c]=0;c=O*3;for(l=u.length;c<l;c++)u[c]=0;t.point.length=O;t.directional.length=C;t.ambient[0]=m;t.ambient[1]=o;t.ambient[2]=y;b=Ra;h.ambientLightColor.value=b.ambient;h.directionalLightColor.value=b.directional.colors;h.directionalLightDirection.value=b.directional.positions;h.pointLightColor.value=b.point.colors;h.pointLightPosition.value=b.point.positions;h.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||
  205. e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)h.opacity.value=e.opacity,K.gammaInput?h.diffuse.value.copyGammaToLinear(e.color):h.diffuse.value=e.color,(h.map.texture=e.map)&&h.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),h.lightMap.texture=e.lightMap,h.envMap.texture=e.envMap,h.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,h.reflectivity.value=e.reflectivity,h.refractionRatio.value=e.refractionRatio,h.combine.value=
  206. e.combine,h.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)h.diffuse.value=e.color,h.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)h.psColor.value=e.color,h.opacity.value=e.opacity,h.size.value=e.size,h.scale.value=sa.height/2,h.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)h.shininess.value=e.shininess,K.gammaInput?(h.ambient.value.copyGammaToLinear(e.ambient),h.specular.value.copyGammaToLinear(e.specular)):
  207. (h.ambient.value=e.ambient,h.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)K.gammaInput?h.ambient.value.copyGammaToLinear(e.ambient):h.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)h.mNear.value=a.near,h.mFar.value=a.far,h.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)h.opacity.value=e.opacity;if(f.receiveShadow&&!e._shadowPass&&h.shadowMatrix){for(b=0;b<Ka.length;b++)h.shadowMatrix.value[b]=Ka[b],h.shadowMap.texture[b]=K.shadowMap[b];
  208. h.shadowDarkness.value=K.shadowMapDarkness;h.shadowBias.value=K.shadowMapBias}b=e.uniformsList;h=0;for(c=b.length;h<c;h++)if(o=g.uniforms[b[h][1]])if(m=b[h][0],y=m.type,l=m.value,y==="i")d.uniform1i(o,l);else if(y==="f")d.uniform1f(o,l);else if(y==="v2")d.uniform2f(o,l.x,l.y);else if(y==="v3")d.uniform3f(o,l.x,l.y,l.z);else if(y==="v4")d.uniform4f(o,l.x,l.y,l.z,l.w);else if(y==="c")d.uniform3f(o,l.r,l.g,l.b);else if(y==="fv1")d.uniform1fv(o,l);else if(y==="fv")d.uniform3fv(o,l);else if(y==="v3v"){if(!m._array)m._array=
  209. new Float32Array(3*l.length);y=0;for(p=l.length;y<p;y++)t=y*3,m._array[t]=l[y].x,m._array[t+1]=l[y].y,m._array[t+2]=l[y].z;d.uniform3fv(o,m._array)}else if(y==="m4"){if(!m._array)m._array=new Float32Array(16);l.flattenToArray(m._array);d.uniformMatrix4fv(o,!1,m._array)}else if(y==="m4v"){if(!m._array)m._array=new Float32Array(16*l.length);y=0;for(p=l.length;y<p;y++)l[y].flattenToArrayOffset(m._array,y*16);d.uniformMatrix4fv(o,!1,m._array)}else if(y==="t"){if(d.uniform1i(o,l),o=m.texture)if(o.image instanceof
  210. Array&&o.image.length===6){if(m=o,m.image.length===6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=d.createTexture();d.activeTexture(d.TEXTURE0+l);d.bindTexture(d.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(l=0;l<6;l++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,m.image[l]);F(d.TEXTURE_CUBE_MAP,m,m.image[0]);m.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+l),d.bindTexture(d.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else o instanceof
  211. THREE.WebGLRenderTargetCube?(m=o,d.activeTexture(d.TEXTURE0+l),d.bindTexture(d.TEXTURE_CUBE_MAP,m.__webglTexture)):U(o,l)}else if(y==="tv"){if(!m._array){m._array=[];y=0;for(p=m.texture.length;y<p;y++)m._array[y]=l+y}d.uniform1iv(o,m._array);y=0;for(p=m.texture.length;y<p;y++)(o=m.texture[y])&&U(o,m._array[y])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&i.cameraPosition!==null&&d.uniform3f(i.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof
  212. THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&i.viewMatrix!==null&&d.uniformMatrix4fv(i.viewMatrix,!1,La);e.skinning&&(d.uniformMatrix4fv(i.cameraInverseMatrix,!1,La),d.uniformMatrix4fv(i.boneGlobalMatrices,!1,f.boneMatrices))}d.uniformMatrix4fv(i.modelViewMatrix,!1,f._modelViewMatrixArray);i.normalMatrix&&d.uniformMatrix3fv(i.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||f.receiveShadow)&&
  213. i.objectMatrix!==null&&d.uniformMatrix4fv(i.objectMatrix,!1,f._objectMatrixArray);return g}function na(a,b,d){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function Y(a){if(Ca!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),Ca=a.doubleSided;if(Ga!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),Ga=a.flipSided}function N(a){za!==
  214. a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),za=a)}function ka(a){wa!==a&&(d.depthMask(a),wa=a)}function E(a,b,c){Sa!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),Sa=a);if(a&&(Ta!==b||Ua!==c))d.polygonOffset(b,c),Ta=b,Ua=c}function P(a){if(a!==ya){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);
  215. d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}ya=a}}function J(a,b){var c;a==="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a==="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function F(a,b,c){(c.width&c.width-1)===
  216. 0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,ha(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,ha(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,ha(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,ha(b.minFilter)),d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_MAG_FILTER,oa(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,oa(b.minFilter)))}function U(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
  217. !0,a.__webglTexture=d.createTexture(),K.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,ha(a.format),a.image.width,a.image.height,0,ha(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);F(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function M(a,b){d.bindRenderbuffer(d.RENDERBUFFER,
  218. a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function S(a){var b=a instanceof THREE.WebGLRenderTargetCube;
  219. if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=d.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);F(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,ha(a.format),a.width,a.height,0,ha(a.format),ha(a.type),
  220. null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,f,e.__webglTexture,0);M(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),F(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,ha(a.format),a.width,a.height,0,ha(a.format),ha(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,
  221. a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),M(a.__webglRenderbuffer,a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=Ia,a=Fa,e=Pa,f=Qa);b!==pa&&(d.bindFramebuffer(d.FRAMEBUFFER,
  222. b),d.viewport(e,f,c,a),pa=b)}function oa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function ha(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;
  223. case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;
  224. case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var a=a||{},sa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),ta=a.stencil!==void 0?a.stencil:!0,xa=a.antialias!==void 0?a.antialias:!1,Ba=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,la=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ra=a.clearAlpha!==void 0?a.clearAlpha:
  225. 0,ja=a.maxLights!==void 0?a.maxLights:4;this.domElement=sa;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=
  226. this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var K=this,d,Q=[],ga=null,pa=null,V=-1,ma=null,va=0,Ca=null,Ga=null,ya=null,za=null,wa=null,Sa=null,Ta=null,Ua=null,Ja=null,Pa=0,Qa=0,Ia=0,Fa=0,qa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Aa=new THREE.Matrix4,Ma=new Float32Array(16),La=new Float32Array(16),Ea=new THREE.Vector4,Ra={ambient:[0,
  227. 0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},ia,Ka=[],Ha,Oa,v={},Va=!1;d=function(){var a;try{if(!(a=sa.getContext("experimental-webgl",{antialias:xa,stencil:ta,preserveDrawingBuffer:Ba})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();
  228. d.clearColor(0,0,0,1);d.clearDepth(1);d.clearStencil(0);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(la.r,la.g,la.b,ra);(function(){v.vertices=new Float32Array(16);v.faces=new Uint16Array(6);var a=0;v.vertices[a++]=-1;v.vertices[a++]=-1;v.vertices[a++]=0;v.vertices[a++]=1;v.vertices[a++]=1;v.vertices[a++]=-1;v.vertices[a++]=1;v.vertices[a++]=
  229. 1;v.vertices[a++]=1;v.vertices[a++]=1;v.vertices[a++]=1;v.vertices[a++]=0;v.vertices[a++]=-1;v.vertices[a++]=1;v.vertices[a++]=0;a=v.vertices[a++]=0;v.faces[a++]=0;v.faces[a++]=1;v.faces[a++]=2;v.faces[a++]=0;v.faces[a++]=2;v.faces[a++]=3;v.vertexBuffer=d.createBuffer();v.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,v.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,v.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,v.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,v.faces,d.STATIC_DRAW);
  230. v.program=d.createProgram();d.attachShader(v.program,J("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(v.program,J("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(v.program);v.attributes={};v.uniforms={};v.attributes.position=d.getAttribLocation(v.program,"position");v.attributes.uv=d.getAttribLocation(v.program,"uv");v.uniforms.uvOffset=d.getUniformLocation(v.program,"uvOffset");v.uniforms.uvScale=d.getUniformLocation(v.program,"uvScale");v.uniforms.rotation=d.getUniformLocation(v.program,
  231. "rotation");v.uniforms.scale=d.getUniformLocation(v.program,"scale");v.uniforms.alignment=d.getUniformLocation(v.program,"alignment");v.uniforms.color=d.getUniformLocation(v.program,"color");v.uniforms.map=d.getUniformLocation(v.program,"map");v.uniforms.opacity=d.getUniformLocation(v.program,"opacity");v.uniforms.useScreenCoordinates=d.getUniformLocation(v.program,"useScreenCoordinates");v.uniforms.affectedByDistance=d.getUniformLocation(v.program,"affectedByDistance");v.uniforms.screenPosition=
  232. d.getUniformLocation(v.program,"screenPosition");v.uniforms.modelViewMatrix=d.getUniformLocation(v.program,"modelViewMatrix");v.uniforms.projectionMatrix=d.getUniformLocation(v.program,"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);Ha=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});Oa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});
  233. Ha._shadowPass=!0;Oa._shadowPass=!0})();this.context=d;var Wa=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return d};this.supportsVertexTextures=function(){return Wa};this.setSize=function(a,b){sa.width=a;sa.height=b;this.setViewport(0,0,sa.width,sa.height)};this.setViewport=function(a,b,c,e){Pa=a;Qa=b;Ia=c;Fa=e;d.viewport(Pa,Qa,Ia,Fa)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};
  234. this.setClearColorHex=function(a,b){la.setHex(a);ra=b;d.clearColor(la.r,la.g,la.b,ra)};this.setClearColor=function(a,b){la.copy(a);ra=b;d.clearColor(la.r,la.g,la.b,ra)};this.getClearColor=function(){return la};this.getClearAlpha=function(){return ra};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.clearTarget=function(a,b,c,d){S(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=
  235. !1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];d.deleteBuffer(c.__webglVertexBuffer);d.deleteBuffer(c.__webglNormalBuffer);d.deleteBuffer(c.__webglTangentBuffer);d.deleteBuffer(c.__webglColorBuffer);d.deleteBuffer(c.__webglUVBuffer);d.deleteBuffer(c.__webglUV2Buffer);d.deleteBuffer(c.__webglSkinVertexABuffer);d.deleteBuffer(c.__webglSkinVertexBBuffer);
  236. d.deleteBuffer(c.__webglSkinIndicesBuffer);d.deleteBuffer(c.__webglSkinWeightsBuffer);d.deleteBuffer(c.__webglFaceBuffer);d.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)d.deleteBuffer(c.__webglMorphTargetsBuffers[e]);K.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),K.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),
  237. d.deleteBuffer(a.__webglColorBuffer),K.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),K.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),K.info.memory.textures--};this.updateShadowMap=function(a,b){p(a,b)};this.render=function(a,b,c,e){var f,g,q,l,w=a.lights,x=a.fog;V=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
  238. this.shadowMapEnabled&&this.shadowMapAutoUpdate&&p(a,b);K.info.render.calls=0;K.info.render.vertices=0;K.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(La);b.projectionMatrix.flattenToArray(Ma);Aa.multiply(b.projectionMatrix,b.matrixWorldInverse);i(Aa);S(c);(this.autoClear||e)&&this.clear(this.autoClearColor,
  239. this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;e=0;for(f=l.length;e<f;e++)if(g=l[e],q=g.object,g.render=!1,q.visible&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||h(q))){q.matrixWorld.flattenToArray(q._objectMatrixArray);na(q,b,!0);var k=g,m=k.object,D=k.buffer,y=void 0,y=y=void 0,y=m.material;if(y instanceof THREE.MeshFaceMaterial){if(y=D.materialIndex,y>=0)y=m.geometry.materials[y],y.transparent?(k.transparent=y,k.opaque=null):(k.opaque=y,k.transparent=null)}else if(y)y.transparent?
  240. (k.transparent=y,k.opaque=null):(k.opaque=y,k.transparent=null);g.render=!0;if(this.sortObjects)q.renderDepth?g.z=q.renderDepth:(Ea.copy(q.position),Aa.multiplyVector3(Ea),g.z=Ea.z)}this.sortObjects&&l.sort(o);l=a.__webglObjectsImmediate;e=0;for(f=l.length;e<f;e++)if(g=l[e],q=g.object,q.visible)q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),na(q,b,!0),q=g.object.material,q.transparent?(g.transparent=q,g.opaque=null):(g.opaque=q,g.transparent=null);a.overrideMaterial?(P(a.overrideMaterial.blending),
  241. N(a.overrideMaterial.depthTest),ka(a.overrideMaterial.depthWrite),E(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),j(a.__webglObjects,!1,"",b,w,x,!0,a.overrideMaterial),r(a.__webglObjectsImmediate,"",b,w,x,!1,a.overrideMaterial)):(P(THREE.NormalBlending),j(a.__webglObjects,!0,"opaque",b,w,x,!1),r(a.__webglObjectsImmediate,"opaque",b,w,x,!1),j(a.__webglObjects,!1,"transparent",b,w,x,!0),r(a.__webglObjectsImmediate,"transparent",b,w,x,
  242. !0));if(a.__webglSprites.length){q=v.attributes;w=v.uniforms;x=Fa/Ia;e=[];f=Ia*0.5;l=Fa*0.5;g=!0;d.useProgram(v.program);ga=v.program;ma=za=ya=-1;Va||(d.enableVertexAttribArray(v.attributes.position),d.enableVertexAttribArray(v.attributes.uv),Va=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,v.vertexBuffer);d.vertexAttribPointer(q.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(q.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,v.elementBuffer);
  243. d.uniformMatrix4fv(w.projectionMatrix,!1,Ma);d.activeTexture(d.TEXTURE0);d.uniform1i(w.map,0);q=0;for(k=a.__webglSprites.length;q<k;q++)if(m=a.__webglSprites[q],m.visible&&m.opacity!==0)m.useScreenCoordinates?m.z=-m.position.z:(m._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),m.z=-m._modelViewMatrix.n34);a.__webglSprites.sort(o);q=0;for(k=a.__webglSprites.length;q<k;q++)m=a.__webglSprites[q],m.visible&&m.opacity!==0&&m.map&&m.map.image&&m.map.image.width&&
  244. (m.useScreenCoordinates?(d.uniform1i(w.useScreenCoordinates,1),d.uniform3f(w.screenPosition,(m.position.x-f)/f,(l-m.position.y)/l,Math.max(0,Math.min(1,m.position.z)))):(d.uniform1i(w.useScreenCoordinates,0),d.uniform1i(w.affectedByDistance,m.affectedByDistance?1:0),d.uniformMatrix4fv(w.modelViewMatrix,!1,m._modelViewMatrixArray)),b=m.map.image.width/(m.scaleByViewport?Fa:1),e[0]=b*x*m.scale.x,e[1]=b*m.scale.y,d.uniform2f(w.uvScale,m.uvScale.x,m.uvScale.y),d.uniform2f(w.uvOffset,m.uvOffset.x,m.uvOffset.y),
  245. d.uniform2f(w.alignment,m.alignment.x,m.alignment.y),d.uniform1f(w.opacity,m.opacity),d.uniform3f(w.color,m.color.r,m.color.g,m.color.b),d.uniform1f(w.rotation,m.rotation),d.uniform2fv(w.scale,e),m.mergeWith3D&&!g?(d.enable(d.DEPTH_TEST),g=!0):!m.mergeWith3D&&g&&(d.disable(d.DEPTH_TEST),g=!1),P(m.blending),U(m.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(wa)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&
  246. (c instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,c.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP,null)):(d.bindTexture(d.TEXTURE_2D,c.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],g=a,i=void 0,h=void 0,j=void 0;if(!f.__webglInit)if(f.__webglInit=
  247. !0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),f instanceof THREE.Mesh){h=f.geometry;if(h.geometryGroups===void 0){var j=h,q=void 0,l=void 0,w=void 0,o=void 0,k=void 0,m=void 0,p=void 0,y={},r=j.morphTargets.length;j.geometryGroups={};q=0;for(l=j.faces.length;q<l;q++)w=j.faces[q],o=w.materialIndex,m=o!==void 0?o:-1,y[m]===void 0&&
  248. (y[m]={hash:m,counter:0}),p=y[m].hash+"_"+y[m].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]={faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:r}),k=w instanceof THREE.Face3?3:4,j.geometryGroups[p].vertices+k>65535&&(y[m].counter+=1,p=y[m].hash+"_"+y[m].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]={faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:r})),w instanceof THREE.Face3?j.geometryGroups[p].faces3.push(q):j.geometryGroups[p].faces4.push(q),
  249. j.geometryGroups[p].vertices+=k;j.geometryGroupsList=[];q=void 0;for(q in j.geometryGroups)j.geometryGroups[q].id=va++,j.geometryGroupsList.push(j.geometryGroups[q])}for(i in h.geometryGroups)if(j=h.geometryGroups[i],!j.__webglVertexBuffer){q=j;q.__webglVertexBuffer=d.createBuffer();q.__webglNormalBuffer=d.createBuffer();q.__webglTangentBuffer=d.createBuffer();q.__webglColorBuffer=d.createBuffer();q.__webglUVBuffer=d.createBuffer();q.__webglUV2Buffer=d.createBuffer();q.__webglSkinVertexABuffer=d.createBuffer();
  250. q.__webglSkinVertexBBuffer=d.createBuffer();q.__webglSkinIndicesBuffer=d.createBuffer();q.__webglSkinWeightsBuffer=d.createBuffer();q.__webglFaceBuffer=d.createBuffer();q.__webglLineBuffer=d.createBuffer();if(q.numMorphTargets){w=l=void 0;q.__webglMorphTargetsBuffers=[];l=0;for(w=q.numMorphTargets;l<w;l++)q.__webglMorphTargetsBuffers.push(d.createBuffer())}K.info.memory.geometries++;o=f;k=o.geometry;l=j.faces3;m=j.faces4;q=l.length*3+m.length*4;w=l.length*1+m.length*2;m=l.length*3+m.length*4;l=c(o,
  251. j);p=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;y=l instanceof THREE.MeshBasicMaterial&&!l.envMap||l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;r=l.vertexColors?l.vertexColors:!1;j.__vertexArray=new Float32Array(q*3);if(y)j.__normalArray=new Float32Array(q*3);if(k.hasTangents)j.__tangentArray=new Float32Array(q*4);if(r)j.__colorArray=new Float32Array(q*3);if(p){if(k.faceUvs.length>0||k.faceVertexUvs.length>
  252. 0)j.__uvArray=new Float32Array(q*2);if(k.faceUvs.length>1||k.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(q*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(q*4),j.__skinVertexBArray=new Float32Array(q*4),j.__skinIndexArray=new Float32Array(q*4),j.__skinWeightArray=new Float32Array(q*4);j.__faceArray=new Uint16Array(w*3);j.__lineArray=new Uint16Array(m*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];o=0;for(k=j.numMorphTargets;o<k;o++)j.__morphTargetsArrays.push(new Float32Array(q*
  253. 3))}j.__needsSmoothNormals=y===THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=r;j.__normalType=y;j.__webglFaceCount=w*3;j.__webglLineCount=m*2;if(l.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];w=void 0;for(w in l.attributes){var o=l.attributes[w],k={},v;for(v in o)k[v]=o[v];if(!k.__webglInitialized||k.createUniqueBuffers)k.__webglInitialized=!0,m=1,k.type==="v2"?m=2:k.type==="v3"?m=3:k.type==="v4"?m=4:k.type==="c"&&(m=3),k.size=m,k.array=new Float32Array(q*
  254. m),k.buffer=d.createBuffer(),k.buffer.belongsToAttribute=w,o.needsUpdate=!0,k.__original=o;j.__webglCustomAttributesList.push(k)}}j.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(f instanceof THREE.Ribbon){if(h=f.geometry,!h.__webglVertexBuffer)j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),K.info.memory.geometries++,j=h,q=j.vertices.length,
  255. j.__vertexArray=new Float32Array(q*3),j.__colorArray=new Float32Array(q*3),j.__webglVertexCount=q,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof THREE.Line){if(h=f.geometry,!h.__webglVertexBuffer)j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),K.info.memory.geometries++,j=h,q=f,l=j.vertices.length,j.__vertexArray=new Float32Array(l*3),j.__colorArray=new Float32Array(l*3),j.__webglLineCount=l,b(j,q),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof
  256. THREE.ParticleSystem&&(h=f.geometry,!h.__webglVertexBuffer))j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),K.info.geometries++,j=h,q=f,l=j.vertices.length,j.__vertexArray=new Float32Array(l*3),j.__colorArray=new Float32Array(l*3),j.__sortArray=[],j.__webglParticleCount=l,b(j,q),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(i in h=f.geometry,h.geometryGroups)j=h.geometryGroups[i],x(g.__webglObjects,j,f);else f instanceof
  257. THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(h=f.geometry,x(g.__webglObjects,h,f)):THREE.MarchingCubes!==void 0&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?g.__webglObjectsImmediate.push({object:f,opaque:null,transparent:null}):f instanceof THREE.Sprite&&g.__webglSprites.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){f=a.__objectsRemoved[0];g=a;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof
  258. THREE.Ribbon||f instanceof THREE.Line)L(g.__webglObjects,f);else if(f instanceof THREE.Sprite){g=g.__webglSprites;i=f;for(h=g.length-1;h>=0;h--)g[h]===i&&g.splice(h,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&L(g.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(g=a.__webglObjects.length;f<g;f++)if(v=a.__webglObjects[f].object,i=v.geometry,h=w=l=void 0,v instanceof THREE.Mesh){j=0;for(q=i.geometryGroupsList.length;j<q;j++)if(l=i.geometryGroupsList[j],
  259. h=c(v,l),w=h.attributes&&D(h),i.__dirtyVertices||i.__dirtyMorphTargets||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents||w)if(w=d.DYNAMIC_DRAW,o=!i.dynamic,l.__inittedArrays){var C=m=k=void 0,t=void 0,E=void 0,J=void 0,u=void 0,F=void 0,M=void 0,Y=void 0,O=C=J=M=void 0,z=void 0,A=void 0,B=void 0,R=void 0,$=void 0,aa=void 0,W=t=M=t=void 0,X=void 0,I=t=B=A=z=R=B=A=z=R=B=A=z=R=B=A=z=u=void 0,Z=void 0,P=J=void 0,V=void 0,T=void 0,ea=void 0,N=void 0,G=O=T=Z=0,S=0,
  260. ba=I=C=0,Q=u=$=0,s=0,ca=void 0,ea=l.__vertexArray,V=l.__uvArray,s=l.__uv2Array,P=l.__normalArray,E=l.__tangentArray,aa=l.__colorArray,W=l.__skinVertexAArray,X=l.__skinVertexBArray,F=l.__skinIndexArray,fa=l.__skinWeightArray,ga=l.__morphTargetsArrays,p=l.__webglCustomAttributesList,n=void 0,n=l.__faceArray,ca=l.__lineArray,ha=l.__needsSmoothNormals,M=l.__vertexColorType,Y=l.__uvType,J=l.__normalType,U=v.geometry,ja=U.__dirtyElements,ka=U.__dirtyUvs,na=U.__dirtyNormals,oa=U.__dirtyTangents,ra=U.__dirtyColors,
  261. N=U.__dirtyMorphTargets,ia=U.vertices,y=l.faces3,r=l.faces4,da=U.faces,pa=U.faceVertexUvs[0],sa=U.faceVertexUvs[1],la=U.skinVerticesA,ma=U.skinVerticesB,qa=U.skinIndices,ta=U.skinWeights,ua=U.morphTargets;if(U.__dirtyVertices){k=0;for(m=y.length;k<m;k++)t=da[y[k]],z=ia[t.a].position,A=ia[t.b].position,B=ia[t.c].position,ea[T]=z.x,ea[T+1]=z.y,ea[T+2]=z.z,ea[T+3]=A.x,ea[T+4]=A.y,ea[T+5]=A.z,ea[T+6]=B.x,ea[T+7]=B.y,ea[T+8]=B.z,T+=9;k=0;for(m=r.length;k<m;k++)t=da[r[k]],z=ia[t.a].position,A=ia[t.b].position,
  262. B=ia[t.c].position,R=ia[t.d].position,ea[T]=z.x,ea[T+1]=z.y,ea[T+2]=z.z,ea[T+3]=A.x,ea[T+4]=A.y,ea[T+5]=A.z,ea[T+6]=B.x,ea[T+7]=B.y,ea[T+8]=B.z,ea[T+9]=R.x,ea[T+10]=R.y,ea[T+11]=R.z,T+=12;d.bindBuffer(d.ARRAY_BUFFER,l.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,ea,w)}if(N){k=0;for(m=y.length;k<m;k++){t=da[y[k]];T=0;for(ea=ua.length;T<ea;T++)z=ua[T].vertices[t.a].position,A=ua[T].vertices[t.b].position,B=ua[T].vertices[t.c].position,N=ga[T],N[Q]=z.x,N[Q+1]=z.y,N[Q+2]=z.z,N[Q+3]=A.x,N[Q+4]=A.y,
  263. N[Q+5]=A.z,N[Q+6]=B.x,N[Q+7]=B.y,N[Q+8]=B.z;Q+=9}k=0;for(m=r.length;k<m;k++){t=da[r[k]];T=0;for(ea=ua.length;T<ea;T++)z=ua[T].vertices[t.a].position,A=ua[T].vertices[t.b].position,B=ua[T].vertices[t.c].position,R=ua[T].vertices[t.d].position,N=ga[T],N[Q]=z.x,N[Q+1]=z.y,N[Q+2]=z.z,N[Q+3]=A.x,N[Q+4]=A.y,N[Q+5]=A.z,N[Q+6]=B.x,N[Q+7]=B.y,N[Q+8]=B.z,N[Q+9]=R.x,N[Q+10]=R.y,N[Q+11]=R.z;Q+=12}T=0;for(ea=ua.length;T<ea;T++)d.bindBuffer(d.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[T]),d.bufferData(d.ARRAY_BUFFER,
  264. ga[T],w)}if(ta.length){k=0;for(m=y.length;k<m;k++)t=da[y[k]],z=ta[t.a],A=ta[t.b],B=ta[t.c],fa[u]=z.x,fa[u+1]=z.y,fa[u+2]=z.z,fa[u+3]=z.w,fa[u+4]=A.x,fa[u+5]=A.y,fa[u+6]=A.z,fa[u+7]=A.w,fa[u+8]=B.x,fa[u+9]=B.y,fa[u+10]=B.z,fa[u+11]=B.w,z=qa[t.a],A=qa[t.b],B=qa[t.c],F[u]=z.x,F[u+1]=z.y,F[u+2]=z.z,F[u+3]=z.w,F[u+4]=A.x,F[u+5]=A.y,F[u+6]=A.z,F[u+7]=A.w,F[u+8]=B.x,F[u+9]=B.y,F[u+10]=B.z,F[u+11]=B.w,z=la[t.a],A=la[t.b],B=la[t.c],W[u]=z.x,W[u+1]=z.y,W[u+2]=z.z,W[u+3]=1,W[u+4]=A.x,W[u+5]=A.y,W[u+6]=A.z,W[u+
  265. 7]=1,W[u+8]=B.x,W[u+9]=B.y,W[u+10]=B.z,W[u+11]=1,z=ma[t.a],A=ma[t.b],B=ma[t.c],X[u]=z.x,X[u+1]=z.y,X[u+2]=z.z,X[u+3]=1,X[u+4]=A.x,X[u+5]=A.y,X[u+6]=A.z,X[u+7]=1,X[u+8]=B.x,X[u+9]=B.y,X[u+10]=B.z,X[u+11]=1,u+=12;k=0;for(m=r.length;k<m;k++)t=da[r[k]],z=ta[t.a],A=ta[t.b],B=ta[t.c],R=ta[t.d],fa[u]=z.x,fa[u+1]=z.y,fa[u+2]=z.z,fa[u+3]=z.w,fa[u+4]=A.x,fa[u+5]=A.y,fa[u+6]=A.z,fa[u+7]=A.w,fa[u+8]=B.x,fa[u+9]=B.y,fa[u+10]=B.z,fa[u+11]=B.w,fa[u+12]=R.x,fa[u+13]=R.y,fa[u+14]=R.z,fa[u+15]=R.w,z=qa[t.a],A=qa[t.b],
  266. B=qa[t.c],R=qa[t.d],F[u]=z.x,F[u+1]=z.y,F[u+2]=z.z,F[u+3]=z.w,F[u+4]=A.x,F[u+5]=A.y,F[u+6]=A.z,F[u+7]=A.w,F[u+8]=B.x,F[u+9]=B.y,F[u+10]=B.z,F[u+11]=B.w,F[u+12]=R.x,F[u+13]=R.y,F[u+14]=R.z,F[u+15]=R.w,z=la[t.a],A=la[t.b],B=la[t.c],R=la[t.d],W[u]=z.x,W[u+1]=z.y,W[u+2]=z.z,W[u+3]=1,W[u+4]=A.x,W[u+5]=A.y,W[u+6]=A.z,W[u+7]=1,W[u+8]=B.x,W[u+9]=B.y,W[u+10]=B.z,W[u+11]=1,W[u+12]=R.x,W[u+13]=R.y,W[u+14]=R.z,W[u+15]=1,z=ma[t.a],A=ma[t.b],B=ma[t.c],t=ma[t.d],X[u]=z.x,X[u+1]=z.y,X[u+2]=z.z,X[u+3]=1,X[u+4]=A.x,
  267. X[u+5]=A.y,X[u+6]=A.z,X[u+7]=1,X[u+8]=B.x,X[u+9]=B.y,X[u+10]=B.z,X[u+11]=1,X[u+12]=t.x,X[u+13]=t.y,X[u+14]=t.z,X[u+15]=1,u+=16;u>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,W,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,X,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,F,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,fa,w))}if(ra&&M){k=
  268. 0;for(m=y.length;k<m;k++)t=da[y[k]],u=t.vertexColors,F=t.color,u.length===3&&M===THREE.VertexColors?(t=u[0],W=u[1],X=u[2]):X=W=t=F,aa[$]=t.r,aa[$+1]=t.g,aa[$+2]=t.b,aa[$+3]=W.r,aa[$+4]=W.g,aa[$+5]=W.b,aa[$+6]=X.r,aa[$+7]=X.g,aa[$+8]=X.b,$+=9;k=0;for(m=r.length;k<m;k++)t=da[r[k]],u=t.vertexColors,F=t.color,u.length===4&&M===THREE.VertexColors?(t=u[0],W=u[1],X=u[2],u=u[3]):u=X=W=t=F,aa[$]=t.r,aa[$+1]=t.g,aa[$+2]=t.b,aa[$+3]=W.r,aa[$+4]=W.g,aa[$+5]=W.b,aa[$+6]=X.r,aa[$+7]=X.g,aa[$+8]=X.b,aa[$+9]=u.r,
  269. aa[$+10]=u.g,aa[$+11]=u.b,$+=12;$>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,aa,w))}if(oa&&U.hasTangents){k=0;for(m=y.length;k<m;k++)t=da[y[k]],M=t.vertexTangents,$=M[0],aa=M[1],t=M[2],E[I]=$.x,E[I+1]=$.y,E[I+2]=$.z,E[I+3]=$.w,E[I+4]=aa.x,E[I+5]=aa.y,E[I+6]=aa.z,E[I+7]=aa.w,E[I+8]=t.x,E[I+9]=t.y,E[I+10]=t.z,E[I+11]=t.w,I+=12;k=0;for(m=r.length;k<m;k++)t=da[r[k]],M=t.vertexTangents,$=M[0],aa=M[1],t=M[2],M=M[3],E[I]=$.x,E[I+1]=$.y,E[I+2]=$.z,E[I+3]=$.w,E[I+4]=
  270. aa.x,E[I+5]=aa.y,E[I+6]=aa.z,E[I+7]=aa.w,E[I+8]=t.x,E[I+9]=t.y,E[I+10]=t.z,E[I+11]=t.w,E[I+12]=M.x,E[I+13]=M.y,E[I+14]=M.z,E[I+15]=M.w,I+=16;d.bindBuffer(d.ARRAY_BUFFER,l.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,E,w)}if(na&&J){k=0;for(m=y.length;k<m;k++)if(t=da[y[k]],E=t.vertexNormals,J=t.normal,E.length===3&&ha)for(I=0;I<3;I++)J=E[I],P[C]=J.x,P[C+1]=J.y,P[C+2]=J.z,C+=3;else for(I=0;I<3;I++)P[C]=J.x,P[C+1]=J.y,P[C+2]=J.z,C+=3;k=0;for(m=r.length;k<m;k++)if(t=da[r[k]],E=t.vertexNormals,J=t.normal,
  271. E.length===4&&ha)for(I=0;I<4;I++)J=E[I],P[C]=J.x,P[C+1]=J.y,P[C+2]=J.z,C+=3;else for(I=0;I<4;I++)P[C]=J.x,P[C+1]=J.y,P[C+2]=J.z,C+=3;d.bindBuffer(d.ARRAY_BUFFER,l.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,P,w)}if(ka&&pa&&Y){k=0;for(m=y.length;k<m;k++)if(C=y[k],C=pa[C],C!==void 0)for(I=0;I<3;I++)P=C[I],V[O]=P.u,V[O+1]=P.v,O+=2;k=0;for(m=r.length;k<m;k++)if(C=r[k],C=pa[C],C!==void 0)for(I=0;I<4;I++)P=C[I],V[O]=P.u,V[O+1]=P.v,O+=2;O>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,
  272. V,w))}if(ka&&sa&&Y){k=0;for(m=y.length;k<m;k++)if(C=y[k],O=sa[C],O!==void 0)for(I=0;I<3;I++)V=O[I],s[G]=V.u,s[G+1]=V.v,G+=2;k=0;for(m=r.length;k<m;k++)if(C=r[k],O=sa[C],O!==void 0)for(I=0;I<4;I++)V=O[I],s[G]=V.u,s[G+1]=V.v,G+=2;G>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,s,w))}if(ja){k=0;for(m=y.length;k<m;k++)n[S]=Z,n[S+1]=Z+1,n[S+2]=Z+2,S+=3,ca[ba]=Z,ca[ba+1]=Z+1,ca[ba+2]=Z,ca[ba+3]=Z+2,ca[ba+4]=Z+1,ca[ba+5]=Z+2,ba+=6,Z+=3;k=0;for(m=r.length;k<m;k++)n[S]=Z,
  273. n[S+1]=Z+1,n[S+2]=Z+3,n[S+3]=Z+1,n[S+4]=Z+2,n[S+5]=Z+3,S+=6,ca[ba]=Z,ca[ba+1]=Z+1,ca[ba+2]=Z,ca[ba+3]=Z+3,ca[ba+4]=Z+1,ca[ba+5]=Z+2,ca[ba+6]=Z+2,ca[ba+7]=Z+3,ba+=8,Z+=4;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,n,w);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ca,w)}if(p){I=0;for(Z=p.length;I<Z;I++)if(n=p[I],n.__original.needsUpdate){s=0;if(n.size===1)if(n.boundTo===void 0||n.boundTo==="vertices"){k=
  274. 0;for(m=y.length;k<m;k++)t=da[y[k]],n.array[s]=n.value[t.a],n.array[s+1]=n.value[t.b],n.array[s+2]=n.value[t.c],s+=3;k=0;for(m=r.length;k<m;k++)t=da[r[k]],n.array[s]=n.value[t.a],n.array[s+1]=n.value[t.b],n.array[s+2]=n.value[t.c],n.array[s+3]=n.value[t.d],s+=4}else{if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)ca=n.value[y[k]],n.array[s]=ca,n.array[s+1]=ca,n.array[s+2]=ca,s+=3;k=0;for(m=r.length;k<m;k++)ca=n.value[r[k]],n.array[s]=ca,n.array[s+1]=ca,n.array[s+2]=ca,n.array[s+3]=ca,s+=4}}else if(n.size===
  275. 2)if(n.boundTo===void 0||n.boundTo==="vertices"){k=0;for(m=y.length;k<m;k++)t=da[y[k]],z=n.value[t.a],A=n.value[t.b],B=n.value[t.c],n.array[s]=z.x,n.array[s+1]=z.y,n.array[s+2]=A.x,n.array[s+3]=A.y,n.array[s+4]=B.x,n.array[s+5]=B.y,s+=6;k=0;for(m=r.length;k<m;k++)t=da[r[k]],z=n.value[t.a],A=n.value[t.b],B=n.value[t.c],R=n.value[t.d],n.array[s]=z.x,n.array[s+1]=z.y,n.array[s+2]=A.x,n.array[s+3]=A.y,n.array[s+4]=B.x,n.array[s+5]=B.y,n.array[s+6]=R.x,n.array[s+7]=R.y,s+=8}else{if(n.boundTo==="faces"){k=
  276. 0;for(m=y.length;k<m;k++)B=A=z=ca=n.value[y[k]],n.array[s]=z.x,n.array[s+1]=z.y,n.array[s+2]=A.x,n.array[s+3]=A.y,n.array[s+4]=B.x,n.array[s+5]=B.y,s+=6;k=0;for(m=r.length;k<m;k++)R=B=A=z=ca=n.value[r[k]],n.array[s]=z.x,n.array[s+1]=z.y,n.array[s+2]=A.x,n.array[s+3]=A.y,n.array[s+4]=B.x,n.array[s+5]=B.y,n.array[s+6]=R.x,n.array[s+7]=R.y,s+=8}}else if(n.size===3)if(G=n.type==="c"?["r","g","b"]:["x","y","z"],n.boundTo===void 0||n.boundTo==="vertices"){k=0;for(m=y.length;k<m;k++)t=da[y[k]],z=n.value[t.a],
  277. A=n.value[t.b],B=n.value[t.c],n.array[s]=z[G[0]],n.array[s+1]=z[G[1]],n.array[s+2]=z[G[2]],n.array[s+3]=A[G[0]],n.array[s+4]=A[G[1]],n.array[s+5]=A[G[2]],n.array[s+6]=B[G[0]],n.array[s+7]=B[G[1]],n.array[s+8]=B[G[2]],s+=9;k=0;for(m=r.length;k<m;k++)t=da[r[k]],z=n.value[t.a],A=n.value[t.b],B=n.value[t.c],R=n.value[t.d],n.array[s]=z[G[0]],n.array[s+1]=z[G[1]],n.array[s+2]=z[G[2]],n.array[s+3]=A[G[0]],n.array[s+4]=A[G[1]],n.array[s+5]=A[G[2]],n.array[s+6]=B[G[0]],n.array[s+7]=B[G[1]],n.array[s+8]=B[G[2]],
  278. n.array[s+9]=R[G[0]],n.array[s+10]=R[G[1]],n.array[s+11]=R[G[2]],s+=12}else{if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)B=A=z=ca=n.value[y[k]],n.array[s]=z[G[0]],n.array[s+1]=z[G[1]],n.array[s+2]=z[G[2]],n.array[s+3]=A[G[0]],n.array[s+4]=A[G[1]],n.array[s+5]=A[G[2]],n.array[s+6]=B[G[0]],n.array[s+7]=B[G[1]],n.array[s+8]=B[G[2]],s+=9;k=0;for(m=r.length;k<m;k++)R=B=A=z=ca=n.value[r[k]],n.array[s]=z[G[0]],n.array[s+1]=z[G[1]],n.array[s+2]=z[G[2]],n.array[s+3]=A[G[0]],n.array[s+4]=A[G[1]],n.array[s+
  279. 5]=A[G[2]],n.array[s+6]=B[G[0]],n.array[s+7]=B[G[1]],n.array[s+8]=B[G[2]],n.array[s+9]=R[G[0]],n.array[s+10]=R[G[1]],n.array[s+11]=R[G[2]],s+=12}}else if(n.size===4)if(n.boundTo===void 0||n.boundTo==="vertices"){k=0;for(m=y.length;k<m;k++)t=da[y[k]],z=n.value[t.a],A=n.value[t.b],B=n.value[t.c],n.array[s]=z.x,n.array[s+1]=z.y,n.array[s+2]=z.z,n.array[s+3]=z.w,n.array[s+4]=A.x,n.array[s+5]=A.y,n.array[s+6]=A.z,n.array[s+7]=A.w,n.array[s+8]=B.x,n.array[s+9]=B.y,n.array[s+10]=B.z,n.array[s+11]=B.w,s+=
  280. 12;k=0;for(m=r.length;k<m;k++)t=da[r[k]],z=n.value[t.a],A=n.value[t.b],B=n.value[t.c],R=n.value[t.d],n.array[s]=z.x,n.array[s+1]=z.y,n.array[s+2]=z.z,n.array[s+3]=z.w,n.array[s+4]=A.x,n.array[s+5]=A.y,n.array[s+6]=A.z,n.array[s+7]=A.w,n.array[s+8]=B.x,n.array[s+9]=B.y,n.array[s+10]=B.z,n.array[s+11]=B.w,n.array[s+12]=R.x,n.array[s+13]=R.y,n.array[s+14]=R.z,n.array[s+15]=R.w,s+=16}else if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)B=A=z=ca=n.value[y[k]],n.array[s]=z.x,n.array[s+1]=z.y,n.array[s+
  281. 2]=z.z,n.array[s+3]=z.w,n.array[s+4]=A.x,n.array[s+5]=A.y,n.array[s+6]=A.z,n.array[s+7]=A.w,n.array[s+8]=B.x,n.array[s+9]=B.y,n.array[s+10]=B.z,n.array[s+11]=B.w,s+=12;k=0;for(m=r.length;k<m;k++)R=B=A=z=ca=n.value[r[k]],n.array[s]=z.x,n.array[s+1]=z.y,n.array[s+2]=z.z,n.array[s+3]=z.w,n.array[s+4]=A.x,n.array[s+5]=A.y,n.array[s+6]=A.z,n.array[s+7]=A.w,n.array[s+8]=B.x,n.array[s+9]=B.y,n.array[s+10]=B.z,n.array[s+11]=B.w,n.array[s+12]=R.x,n.array[s+13]=R.y,n.array[s+14]=R.z,n.array[s+15]=R.w,s+=16}d.bindBuffer(d.ARRAY_BUFFER,
  282. n.buffer);d.bufferData(d.ARRAY_BUFFER,n.array,w)}}o&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}i.__dirtyVertices=!1;i.__dirtyMorphTargets=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyColors=!1;i.__dirtyTangents=
  283. !1;h.attributes&&H(h)}else if(v instanceof THREE.Ribbon){if(i.__dirtyVertices||i.__dirtyColors){h=i;v=d.DYNAMIC_DRAW;k=j=k=o=o=void 0;m=h.vertices;q=h.colors;p=m.length;l=q.length;y=h.__vertexArray;w=h.__colorArray;r=h.__dirtyColors;if(h.__dirtyVertices){for(o=0;o<p;o++)k=m[o].position,j=o*3,y[j]=k.x,y[j+1]=k.y,y[j+2]=k.z;d.bindBuffer(d.ARRAY_BUFFER,h.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,y,v)}if(r){for(o=0;o<l;o++)k=q[o],j=o*3,w[j]=k.r,w[j+1]=k.g,w[j+2]=k.b;d.bindBuffer(d.ARRAY_BUFFER,
  284. h.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,w,v)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(v instanceof THREE.Line){h=c(v,l);w=h.attributes&&D(h);if(i.__dirtyVertices||i.__dirtyColors||w){v=i;j=d.DYNAMIC_DRAW;p=q=Z=m=da=void 0;m=v.vertices;l=v.colors;p=m.length;w=l.length;y=v.__vertexArray;o=v.__colorArray;r=v.__dirtyColors;k=v.__webglCustomAttributesList;O=ba=S=G=Z=da=void 0;if(v.__dirtyVertices){for(da=0;da<p;da++)Z=m[da].position,q=da*3,y[q]=Z.x,y[q+1]=Z.y,y[q+2]=Z.z;d.bindBuffer(d.ARRAY_BUFFER,
  285. v.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,y,j)}if(r){for(m=0;m<w;m++)p=l[m],q=m*3,o[q]=p.r,o[q+1]=p.g,o[q+2]=p.b;d.bindBuffer(d.ARRAY_BUFFER,v.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,o,j)}if(k){da=0;for(Z=k.length;da<Z;da++)if(O=k[da],O.needsUpdate&&(O.boundTo===void 0||O.boundTo==="vertices")){q=0;S=O.value.length;if(O.size===1)for(G=0;G<S;G++)O.array[G]=O.value[G];else if(O.size===2)for(G=0;G<S;G++)ba=O.value[G],O.array[q]=ba.x,O.array[q+1]=ba.y,q+=2;else if(O.size===3)if(O.type===
  286. "c")for(G=0;G<S;G++)ba=O.value[G],O.array[q]=ba.r,O.array[q+1]=ba.g,O.array[q+2]=ba.b,q+=3;else for(G=0;G<S;G++)ba=O.value[G],O.array[q]=ba.x,O.array[q+1]=ba.y,O.array[q+2]=ba.z,q+=3;else if(O.size===4)for(G=0;G<S;G++)ba=O.value[G],O.array[q]=ba.x,O.array[q+1]=ba.y,O.array[q+2]=ba.z,O.array[q+3]=ba.w,q+=4;d.bindBuffer(d.ARRAY_BUFFER,O.buffer);d.bufferData(d.ARRAY_BUFFER,O.array,j)}}}i.__dirtyVertices=!1;i.__dirtyColors=!1;h.attributes&&H(h)}else if(v instanceof THREE.ParticleSystem)h=c(v,l),w=h.attributes&&
  287. D(h),(i.__dirtyVertices||i.__dirtyColors||v.sortParticles||w)&&e(i,d.DYNAMIC_DRAW,v),i.__dirtyVertices=!1,i.__dirtyColors=!1,h.attributes&&H(h)};this.initMaterial=function(a,b,c,e){var f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&
  288. (i="particle_basic");if(i){var j=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(j.uniforms);a.vertexShader=j.vertexShader;a.fragmentShader=j.fragmentShader}var o,k,m;o=m=j=0;for(k=b.length;o<k;o++)h=b[o],h instanceof THREE.SpotLight&&m++,h instanceof THREE.DirectionalLight&&m++,h instanceof THREE.PointLight&&j++;j+m<=ja?o=m:(o=Math.ceil(ja*m/(j+m)),j=ja-o);h={directional:o,point:j};j=m=0;for(o=b.length;j<o;j++)k=b[j],k instanceof THREE.SpotLight&&k.castShadow&&m++;var r=50;if(e!==void 0&&
  289. e instanceof THREE.SkinnedMesh)r=e.bones.length;var p;a:{o=a.fragmentShader;k=a.vertexShader;var j=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:r,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,
  290. shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},v,e=[];i?e.push(i):(e.push(o),e.push(k));for(v in c)e.push(v),e.push(c[v]);i=e.join();v=0;for(e=Q.length;v<e;v++)if(Q[v].code===i){p=Q[v].program;break a}v=d.createProgram();e=[Wa?"#define VERTEX_TEXTURES":"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+
  291. c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\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;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
  292. h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
  293. "",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");d.attachShader(v,J("fragment",h+o));d.attachShader(v,
  294. J("vertex",e+k));d.linkProgram(v);d.getProgramParameter(v,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(v,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");v.uniforms={};v.attributes={};var x,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in j)e.push(x);x=e;e=0;for(j=x.length;e<j;e++)o=x[e],v.uniforms[o]=d.getUniformLocation(v,
  295. o);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<c.maxMorphTargets;x++)e.push("morphTarget"+x);for(p in b)e.push(p);p=e;x=0;for(b=p.length;x<b;x++)c=p[x],v.attributes[c]=d.getAttribLocation(v,c);v.id=Q.length;Q.push({program:v,code:i});K.info.memory.programs=Q.length;p=v}a.program=p;p=a.program.attributes;p.position>=0&&d.enableVertexAttribArray(p.position);p.color>=0&&d.enableVertexAttribArray(p.color);p.normal>=0&&d.enableVertexAttribArray(p.normal);
  296. p.tangent>=0&&d.enableVertexAttribArray(p.tangent);a.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(d.enableVertexAttribArray(p.skinVertexA),d.enableVertexAttribArray(p.skinVertexB),d.enableVertexAttribArray(p.skinIndex),d.enableVertexAttribArray(p.skinWeight));if(a.attributes)for(g in a.attributes)p[g]!==void 0&&p[g]>=0&&d.enableVertexAttribArray(p[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)x="morphTarget"+g,p[x]>=0&&(d.enableVertexAttribArray(p[x]),
  297. a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW),a==="back"?d.cullFace(d.BACK):a==="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK),d.enable(d.CULL_FACE)):d.disable(d.CULL_FACE)}};
  298. THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
  299. THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
  300. 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.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;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
  301. THREE.WebGLRenderTargetCube.prototype=new THREE.WebGLRenderTarget;THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube;