123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- // ThreeWebGL.js r46dev - http://github.com/mrdoob/three.js
- var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
- 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,h;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),h=c*(1-
- b*f),b=c*(1-b*(1-f)),e){case 1:this.r=h;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=h;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=h;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("+
- 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};
- 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},
- 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)},
- 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};
- 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},
- 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},
- 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)},
- 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);
- 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};
- 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-
- 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())},
- 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};
- THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},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,e){var e=e.clone().subSelf(b),
- c=c.clone().subSelf(b),f=a.clone().subSelf(b),a=e.dot(e),b=e.dot(c),e=e.dot(f),h=c.dot(c),c=c.dot(f),f=1/(a*h-b*b),h=(h*e-b*c)*f,a=(a*c-b*e)*f;return h>0&&a>0&&h+a<1}for(var e,f=[],h=0,i=a.children.length;h<i;h++)Array.prototype.push.apply(f,this.intersectObject(a.children[h]));if(a instanceof THREE.Particle){h=b(this.origin,this.direction,a.matrixWorld.getPosition());if(h==null||h>a.scale.x)return[];e={distance:h,point:a.position,face:null,object:a};f.push(e)}else if(a instanceof THREE.Mesh){h=b(this.origin,
- this.direction,a.matrixWorld.getPosition());if(h==null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var j,n,k,l,p,m,s,B,A=a.geometry,H=A.vertices,h=0,i=A.faces.length;h<i;h++)if(e=A.faces[h],s=this.origin.clone(),B=this.direction.clone(),l=a.matrixWorld,j=l.multiplyVector3(e.centroid.clone()).subSelf(s),m=j.dot(B),!(m<=0)&&(j=l.multiplyVector3(H[e.a].position.clone()),n=l.multiplyVector3(H[e.b].position.clone()),k=l.multiplyVector3(H[e.c].position.clone()),
- l=e instanceof THREE.Face4?l.multiplyVector3(H[e.d].position.clone()):null,p=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),m=B.dot(p),a.doubleSided||(a.flipSided?m>0:m<0)))if(m=p.dot((new THREE.Vector3).sub(j,s))/m,s=s.addSelf(B.multiplyScalar(m)),e instanceof THREE.Face3)c(s,j,n,k)&&(e={distance:this.origin.distanceTo(s),point:s,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(s,j,n,l)||c(s,n,k,l)))e={distance:this.origin.distanceTo(s),point:s,face:e,object:a},f.push(e)}return f}};
- THREE.Rectangle=function(){function a(){h=e-b;i=f-c}var b,c,e,f,h,i,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};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(h,i,l,p){j=!1;b=h;c=i;e=l;f=p;a()};this.addPoint=function(h,i){j?(j=!1,b=h,c=i,e=h,f=i):(b=b<h?b:h,c=c<i?c:i,e=e>h?e:h,f=f>i?f:i);a()};this.add3Points=
- function(h,i,l,p,m,s){j?(j=!1,b=h<l?h<m?h:m:l<m?l:m,c=i<p?i<s?i:s:p<s?p:s,e=h>l?h>m?h:m:l>m?l:m,f=i>p?i>s?i:s:p>s?p:s):(b=h<l?h<m?h<b?h:b:m<b?m:b:l<m?l<b?l:b:m<b?m:b,c=i<p?i<s?i<c?i:c:s<c?s:c:p<s?p<c?p:c:s<c?s:c,e=h>l?h>m?h>e?h:e:m>e?m:e:l>m?l>e?l:e:m>e?m:e,f=i>p?i>s?i>f?i:f:s>f?s:f:p>s?p>f?p:f:s>f?s:f);a()};this.addRectangle=function(h){j?(j=!1,b=h.getLeft(),c=h.getTop(),e=h.getRight(),f=h.getBottom()):(b=b<h.getLeft()?b:h.getLeft(),c=c<h.getTop()?c:h.getTop(),e=e>h.getRight()?e:h.getRight(),f=f>
- h.getBottom()?f:h.getBottom());a()};this.inflate=function(h){b-=h;c-=h;e+=h;f+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();e=e<h.getRight()?e:h.getRight();f=f<h.getBottom()?f:h.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(){j=!0;f=e=c=b=0;a()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]};
- 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}};
- THREE.Matrix4=function(a,b,c,e,f,h,i,j,n,k,l,p,m,s,B,A){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,h!==void 0?h:1,i||0,j||0,n||0,k||0,l!==void 0?l:1,p||0,m||0,s||0,B||0,A!==void 0?A:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
- THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,h,i,j,n,k,l,p,m,s,B,A){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=h;this.n23=i;this.n24=j;this.n31=n;this.n32=k;this.n33=l;this.n34=p;this.n41=m;this.n42=s;this.n43=B;this.n44=A;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,
- b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(c,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(c,h).normalize());f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;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*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*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},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,n=a.n23,k=a.n24,l=a.n31,p=a.n32,m=a.n33,s=a.n34,B=a.n41,A=a.n42,H=a.n43,C=a.n44,Q=b.n11,wa=b.n12,
- ja=b.n13,qa=b.n14,ha=b.n21,L=b.n22,z=b.n23,R=b.n24,M=b.n31,T=b.n32,ka=b.n33,Z=b.n34,Aa=b.n41,$=b.n42,F=b.n43,d=b.n44;this.n11=c*Q+e*ha+f*M+h*Aa;this.n12=c*wa+e*L+f*T+h*$;this.n13=c*ja+e*z+f*ka+h*F;this.n14=c*qa+e*R+f*Z+h*d;this.n21=i*Q+j*ha+n*M+k*Aa;this.n22=i*wa+j*L+n*T+k*$;this.n23=i*ja+j*z+n*ka+k*F;this.n24=i*qa+j*R+n*Z+k*d;this.n31=l*Q+p*ha+m*M+s*Aa;this.n32=l*wa+p*L+m*T+s*$;this.n33=l*ja+p*z+m*ka+s*F;this.n34=l*qa+p*R+m*Z+s*d;this.n41=B*Q+A*ha+H*M+C*Aa;this.n42=B*wa+A*L+H*T+C*$;this.n43=B*ja+
- A*z+H*ka+C*F;this.n44=B*qa+A*R+H*Z+C*d;return this},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},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,h=this.n22,i=this.n23,j=this.n24,n=this.n31,k=this.n32,l=this.n33,p=this.n34,m=this.n41,s=this.n42,B=this.n43,A=this.n44;return e*i*k*m-c*j*k*m-e*h*l*m+b*j*l*m+c*h*p*m-b*i*p*m-e*i*n*s+c*j*n*s+e*f*l*s-a*j*l*s-c*f*p*s+a*i*p*s+e*h*n*B-b*j*n*B-e*f*k*B+a*j*k*B+b*f*p*B-a*h*p*B-c*h*n*A+b*i*
- n*A+c*f*k*A-a*i*k*A-b*f*l*A+a*h*l*A},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;
- 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]=
- 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]=
- 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,
- 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,h=a.x,i=a.y,j=a.z,n=f*h,k=f*i;this.set(n*h+c,n*i-e*j,n*j+e*i,0,n*i+e*j,k*i+c,k*j-e*h,0,n*j-e*i,k*j+e*h,f*j*j+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(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
- new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a,b){var c=a.x,e=a.y,f=a.z,h=Math.cos(c),c=Math.sin(c),i=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var n=
- i*j,k=i*f,l=e*j,p=e*f;this.n11=n+p*c;this.n12=l*c-k;this.n13=h*e;this.n21=h*f;this.n22=h*j;this.n23=-c;this.n31=k*c-l;this.n32=p+n*c;this.n33=h*i;break;case "ZXY":n=i*j;k=i*f;l=e*j;p=e*f;this.n11=n-p*c;this.n12=-h*f;this.n13=l+k*c;this.n21=k+l*c;this.n22=h*j;this.n23=p-n*c;this.n31=-h*e;this.n32=c;this.n33=h*i;break;case "ZYX":n=h*j;k=h*f;l=c*j;p=c*f;this.n11=i*j;this.n12=l*e-k;this.n13=n*e+p;this.n21=i*f;this.n22=p*e+n;this.n23=k*e-l;this.n31=-e;this.n32=c*i;this.n33=h*i;break;case "YZX":n=h*i;k=
- h*e;l=c*i;p=c*e;this.n11=i*j;this.n12=p-n*f;this.n13=l*f+k;this.n21=f;this.n22=h*j;this.n23=-c*j;this.n31=-e*j;this.n32=k*f+l;this.n33=n-p*f;break;case "XZY":n=h*i;k=h*e;l=c*i;p=c*e;this.n11=i*j;this.n12=-f;this.n13=e*j;this.n21=n*f+p;this.n22=h*j;this.n23=k*f-l;this.n31=l*f-k;this.n32=c*j;this.n33=p*f+n;break;default:n=h*j,k=h*f,l=c*j,p=c*f,this.n11=i*j,this.n12=-i*f,this.n13=e,this.n21=k+l*e,this.n22=n-p*e,this.n23=-c*i,this.n31=p-n*e,this.n32=l+k*e,this.n33=h*i}return this},setRotationFromQuaternion:function(a){var b=
- a.x,c=a.y,e=a.z,f=a.w,h=b+b,i=c+c,j=e+e,a=b*h,n=b*i;b*=j;var k=c*i;c*=j;e*=j;h*=f;i*=f;f*=j;this.n11=1-(k+e);this.n12=n-f;this.n13=b+i;this.n21=n+f;this.n22=1-(a+e);this.n23=c-h;this.n31=b-i;this.n32=c+h;this.n33=1-(a+k);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=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,h=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);h.set(this.n13,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=h.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},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,f=1/b.z;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*f;this.n23=
- a.n23*f;this.n33=a.n33*f}};
- THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,n=a.n23,k=a.n24,l=a.n31,p=a.n32,m=a.n33,s=a.n34,B=a.n41,A=a.n42,H=a.n43,C=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=n*s*A-k*m*A+k*p*H-j*s*H-n*p*C+j*m*C;b.n12=h*m*A-f*s*A-h*p*H+e*s*H+f*p*C-e*m*C;b.n13=f*k*A-h*n*A+h*j*H-e*k*H-f*j*C+e*n*C;b.n14=h*n*p-f*k*p-h*j*m+e*k*m+f*j*s-e*n*s;b.n21=k*m*B-n*s*B-k*l*H+i*s*H+n*l*C-i*m*C;b.n22=f*s*B-h*m*B+h*l*H-c*s*H-f*l*C+c*m*C;b.n23=h*n*B-f*k*B-h*i*H+c*k*H+f*i*C-c*n*C;b.n24=
- f*k*l-h*n*l+h*i*m-c*k*m-f*i*s+c*n*s;b.n31=j*s*B-k*p*B+k*l*A-i*s*A-j*l*C+i*p*C;b.n32=h*p*B-e*s*B-h*l*A+c*s*A+e*l*C-c*p*C;b.n33=f*k*B-h*j*B+h*i*A-c*k*A-e*i*C+c*j*C;b.n34=h*j*l-e*k*l-h*i*p+c*k*p+e*i*s-c*j*s;b.n41=n*p*B-j*m*B-n*l*A+i*m*A+j*l*H-i*p*H;b.n42=e*m*B-f*p*B+f*l*A-c*m*A-e*l*H+c*p*H;b.n43=f*j*B-e*n*B-f*i*A+c*n*A+e*i*H-c*j*H;b.n44=e*n*l-f*j*l+f*i*p-c*n*p-e*i*m+c*j*m;b.multiplyScalar(1/a.determinant());return b};
- 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,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*i+a.n31*k;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*h;c[3]=a*i;c[4]=a*j;c[5]=a*n;c[6]=a*k;c[7]=a*l;c[8]=a*p;return b};
- THREE.Matrix4.makeFrustum=function(a,b,c,e,f,h){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=-(h+f)/(h-f);i.n34=-2*h*f/(h-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)};
- THREE.Matrix4.makeOrtho=function(a,b,c,e,f,h){var i,j,n,k;i=new THREE.Matrix4;j=b-a;n=c-e;k=h-f;i.n11=2/j;i.n12=0;i.n13=0;i.n14=-((b+a)/j);i.n21=0;i.n22=2/n;i.n23=0;i.n24=-((c+e)/n);i.n31=0;i.n32=0;i.n33=-2/k;i.n34=-((h+f)/k);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;
- 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=
- !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};
- 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)===
- -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.addChildRecurse(a)}},remove:function(a){var b=this,c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;for(this.children.splice(c,1);b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeChildRecurse(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;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},update:function(a,b,c){this.matrixAutoUpdate&&
- this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
- this.remove(a)}};THREE.Object3DCount=0;
- THREE.Projector=function(){function a(){var a=n[j]=n[j]||new THREE.RenderableVertex;j++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,e=1,d=a.z+a.w,h=b.z+b.w,f=-a.z+a.w,i=-b.z+b.w;return d>=0&&h>=0&&f>=0&&i>=0?!0:d<0&&h<0||f<0&&i<0?!1:(d<0?c=Math.max(c,d/(d-h)):h<0&&(e=Math.min(e,d/(d-h))),f<0?c=Math.max(c,f/(f-i)):i<0&&(e=Math.min(e,f/(f-i))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var e,f,h=[],i,j,n=[],k,l,p=[],m,s=[],B,A,H=[],C,Q,wa=[],ja=[],qa=[],ha=new THREE.Vector4,
- L=new THREE.Vector4,z=new THREE.Matrix4,R=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],T=new THREE.Vector4,ka=new THREE.Vector4;this.projectVector=function(a,b){z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=function(a,b){z.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));z.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.projectObjects=function(a,c,i){var j,d;f=ja.length=0;j=a.objects;a=0;for(c=j.length;a<c;a++){d=j[a];var k;if(!(k=!d.visible))if(k=d instanceof THREE.Mesh)if(k=d.frustumCulled){a:{k=void 0;for(var n=d.matrixWorld,s=-d.geometry.boundingSphere.radius*Math.max(d.scale.x,Math.max(d.scale.y,d.scale.z)),l=0;l<6;l++)if(k=M[l].x*n.n14+M[l].y*n.n24+M[l].z*n.n34+
- M[l].w,k<=s){k=!1;break a}k=!0}k=!k}if(!k)k=h[f]=h[f]||new THREE.RenderableObject,f++,e=k,ha.copy(d.position),z.multiplyVector3(ha),e.object=d,e.z=ha.z,ja.push(e)}i&&ja.sort(b);return ja};this.projectScene=function(e,h,f){var F=h.near,d=h.far,ja,ha,aa,ma,E,ra,N,V,ia,S,xa,Ka,Pa,Qa,ya,Ba,ua;Q=A=m=l=qa.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);e.update(void 0,!1,h);z.multiply(h.projectionMatrix,h.matrixWorldInverse);M[0].set(z.n41-z.n11,z.n42-z.n12,z.n43-z.n13,z.n44-z.n14);M[1].set(z.n41+z.n11,
- z.n42+z.n12,z.n43+z.n13,z.n44+z.n14);M[2].set(z.n41+z.n21,z.n42+z.n22,z.n43+z.n23,z.n44+z.n24);M[3].set(z.n41-z.n21,z.n42-z.n22,z.n43-z.n23,z.n44-z.n24);M[4].set(z.n41-z.n31,z.n42-z.n32,z.n43-z.n33,z.n44-z.n34);M[5].set(z.n41+z.n31,z.n42+z.n32,z.n43+z.n33,z.n44+z.n34);for(ja=0;ja<6;ja++)ia=M[ja],ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z));ia=this.projectObjects(e,h,!0);e=0;for(ja=ia.length;e<ja;e++)if(S=ia[e].object,S.visible)if(xa=S.matrixWorld,Ka=S.matrixRotationWorld,Pa=S.materials,
- Qa=S.overdraw,j=0,S instanceof THREE.Mesh){ya=S.geometry;ma=ya.vertices;Ba=ya.faces;ya=ya.faceVertexUvs;ha=0;for(aa=ma.length;ha<aa;ha++)i=a(),i.positionWorld.copy(ma[ha].position),xa.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),z.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>F&&i.positionScreen.z<d;ma=0;for(ha=Ba.length;ma<ha;ma++){aa=Ba[ma];if(aa instanceof THREE.Face3)if(E=
- n[aa.a],ra=n[aa.b],N=n[aa.c],E.visible&&ra.visible&&N.visible&&(S.doubleSided||S.flipSided!=(N.positionScreen.x-E.positionScreen.x)*(ra.positionScreen.y-E.positionScreen.y)-(N.positionScreen.y-E.positionScreen.y)*(ra.positionScreen.x-E.positionScreen.x)<0))V=p[l]=p[l]||new THREE.RenderableFace3,l++,k=V,k.v1.copy(E),k.v2.copy(ra),k.v3.copy(N);else continue;else if(aa instanceof THREE.Face4)if(E=n[aa.a],ra=n[aa.b],N=n[aa.c],V=n[aa.d],E.visible&&ra.visible&&N.visible&&V.visible&&(S.doubleSided||S.flipSided!=
- ((V.positionScreen.x-E.positionScreen.x)*(ra.positionScreen.y-E.positionScreen.y)-(V.positionScreen.y-E.positionScreen.y)*(ra.positionScreen.x-E.positionScreen.x)<0||(ra.positionScreen.x-N.positionScreen.x)*(V.positionScreen.y-N.positionScreen.y)-(ra.positionScreen.y-N.positionScreen.y)*(V.positionScreen.x-N.positionScreen.x)<0)))ua=s[m]=s[m]||new THREE.RenderableFace4,m++,k=ua,k.v1.copy(E),k.v2.copy(ra),k.v3.copy(N),k.v4.copy(V);else continue;k.normalWorld.copy(aa.normal);Ka.multiplyVector3(k.normalWorld);
- k.centroidWorld.copy(aa.centroid);xa.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);z.multiplyVector3(k.centroidScreen);N=aa.vertexNormals;E=0;for(ra=N.length;E<ra;E++)V=k.vertexNormalsWorld[E],V.copy(N[E]),Ka.multiplyVector3(V);E=0;for(ra=ya.length;E<ra;E++)if(ua=ya[E][ma]){N=0;for(V=ua.length;N<V;N++)k.uvs[E][N]=ua[N]}k.meshMaterials=Pa;k.faceMaterials=aa.materials;k.overdraw=Qa;k.z=k.centroidScreen.z;qa.push(k)}}else if(S instanceof THREE.Line){R.multiply(z,xa);ma=S.geometry.vertices;
- E=a();E.positionScreen.copy(ma[0].position);R.multiplyVector4(E.positionScreen);ha=1;for(aa=ma.length;ha<aa;ha++)if(E=a(),E.positionScreen.copy(ma[ha].position),R.multiplyVector4(E.positionScreen),ra=n[j-2],T.copy(E.positionScreen),ka.copy(ra.positionScreen),c(T,ka))T.multiplyScalar(1/T.w),ka.multiplyScalar(1/ka.w),xa=H[A]=H[A]||new THREE.RenderableLine,A++,B=xa,B.v1.positionScreen.copy(T),B.v2.positionScreen.copy(ka),B.z=Math.max(T.z,ka.z),B.materials=S.materials,qa.push(B)}else if(S instanceof THREE.Particle&&
- (L.set(S.matrixWorld.n14,S.matrixWorld.n24,S.matrixWorld.n34,1),z.multiplyVector4(L),L.z/=L.w,L.z>0&&L.z<1))xa=wa[Q]=wa[Q]||new THREE.RenderableParticle,Q++,C=xa,C.x=L.x/L.w,C.y=L.y/L.w,C.z=L.z,C.rotation=S.rotation.z,C.scale.x=S.scale.x*Math.abs(C.x-(L.x+h.projectionMatrix.n11)/(L.w+h.projectionMatrix.n14)),C.scale.y=S.scale.y*Math.abs(C.y-(L.y+h.projectionMatrix.n22)/(L.w+h.projectionMatrix.n24)),C.materials=S.materials,qa.push(C);f&&qa.sort(b);return qa}};
- THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
- 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),h=Math.cos(c),c=Math.sin(c),i=a*b,j=e*f;this.w=i*h-j*c;this.x=i*c+j*h;this.y=e*b*h+a*f*c;this.z=a*f*h-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
- 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);
- 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=
- this.x,c=this.y,e=this.z,f=this.w,h=a.x,i=a.y,j=a.z,a=a.w;this.x=b*a+f*h+c*j-e*i;this.y=c*a+f*i+e*h-b*j;this.z=e*a+f*j+b*i-c*h;this.w=f*a-b*h-c*i-e*j;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,h=this.x,i=this.y,j=this.z,n=this.w,k=n*c+i*f-j*e,l=n*e+j*c-h*f,p=n*f+h*e-i*c,c=-h*
- c-i*e-j*f;b.x=k*n+c*-h+l*-j-p*-i;b.y=l*n+c*-i+p*-h-k*-j;b.z=p*n+c*-j+k*-i-l*-h;return b}};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;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<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;f=Math.sin((1-e)*h)/i;e=Math.sin(e*h)/i;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c};
- THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,e,f,h){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=h;this.centroid=new THREE.Vector3};
- THREE.Face4=function(a,b,c,e,f,h,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=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materialIndex=i;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
- 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)}};
- 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};
- 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 h=0,i=f.vertexNormals.length;h<i;h++)b.multiplyVector3(f.vertexNormals[h]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
- 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,
- c,e,f,h,i,j=new THREE.Vector3,n=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){j.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)j.addSelf(h.vertexNormals[b]);j.divideScalar(3)}else b=this.vertices[h.a],c=this.vertices[h.b],i=this.vertices[h.c],j.sub(i.position,c.position),n.sub(b.position,c.position),j.crossSelf(n);j.isZero()||j.normalize();h.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=
- 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
- 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]),
- 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,h,f,z){j=a.vertices[b].position;n=a.vertices[c].position;k=a.vertices[e].position;l=i[h];p=i[f];m=i[z];s=n.x-j.x;B=k.x-j.x;A=n.y-j.y;H=k.y-j.y;C=n.z-j.z;Q=k.z-j.z;wa=p.u-l.u;ja=m.u-l.u;qa=p.v-l.v;ha=m.v-l.v;L=1/(wa*ha-ja*qa);T.set((ha*s-qa*B)*L,(ha*A-qa*H)*L,(ha*C-qa*Q)*L);ka.set((wa*B-ja*s)*L,(wa*H-ja*A)*L,(wa*Q-ja*C)*L);R[b].addSelf(T);R[c].addSelf(T);R[e].addSelf(T);
- M[b].addSelf(ka);M[c].addSelf(ka);M[e].addSelf(ka)}var b,c,e,f,h,i,j,n,k,l,p,m,s,B,A,H,C,Q,wa,ja,qa,ha,L,z,R=[],M=[],T=new THREE.Vector3,ka=new THREE.Vector3,Z=new THREE.Vector3,Aa=new THREE.Vector3,$=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)R[b]=new THREE.Vector3,M[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)h=this.faces[b],i=this.faceVertexUvs[0][b],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,
- h.d,0,1,3));var F=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(e=0;e<h.vertexNormals.length;e++)$.copy(h.vertexNormals[e]),f=h[F[e]],z=R[f],Z.copy(z),Z.subSelf($.multiplyScalar($.dot(z))).normalize(),Aa.cross(h.vertexNormals[e],z),f=Aa.dot(M[f]),f=f<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(Z.x,Z.y,Z.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],
- 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<
- 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),h,i;h=0;for(i=this.vertices.length;h<i;h++)e=this.vertices[h].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),
- a[e]===void 0?(a[e]=h,b.push(this.vertices[h]),c[h]=b.length-1):c[h]=c[a[e]];h=0;for(i=this.faces.length;h<i;h++){a=this.faces[h];if(a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];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;
- THREE.Spline=function(a){function b(a,b,c,e,h,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*h+b}this.points=a;var c=[],e={x:0,y:0,z:0},f,h,i,j,n,k,l,p,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;h=Math.floor(f);i=f-h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;k=this.points[c[0]];l=this.points[c[1]];
- p=this.points[c[2]];m=this.points[c[3]];j=i*i;n=i*j;e.x=b(k.x,l.x,p.x,m.x,i,j,n);e.y=b(k.y,l.y,p.y,m.y,i,j,n);e.z=b(k.z,l.z,p.z,m.z,i,j,n);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=b=b=0,h=new THREE.Vector3,f=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),f.copy(position),
- j+=f.distanceTo(h),h.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=j,e=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,e,h,f,i,j=[],k=new THREE.Vector3,n=this.getLength();j.push(k.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=n.chunks[b]-n.chunks[b-1];i=Math.ceil(a*c/n.total);h=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<i-1;c++)e=h+c*(1/i)*(f-h),position=this.getPoint(e),j.push(k.copy(position).clone());
- j.push(k.copy(this.points[b]).clone())}this.points=j}};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};
- 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.Camera.prototype.update=function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};
- THREE.OrthographicCamera=function(a,b,c,e,f,h){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=h!==void 0?h:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;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;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,h){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=e;this.width=f;this.height=h;this.updateProjectionMatrix()};
- 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,
- 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;
- 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;
- 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;
- 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=
- a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0};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;
- 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;
- 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:
- !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:
- !1};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
- 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=
- 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=
- 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;
- 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=
- 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=
- 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;
- 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;
- 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(){};
- THREE.MeshShaderMaterial=function(a){console.warn("DEPRECATED: MeshShaderMaterial() is now ShaderMaterial().");return new THREE.ShaderMaterial(a)};
- 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;
- 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!==
- 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;
- THREE.Texture=function(a,b,c,e,f,h){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=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
- 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(){};
- 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;
- 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,h,i,j,n){THREE.Texture.call(this,null,f,h,i,j,n);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;
- 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};
- 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};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
- THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.overdraw=!1;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={};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;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;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
- THREE.Bone.prototype.update=function(a,b,c){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 e,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<f;e++)a=this.children[e],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(e=0;e<f;e++)this.children[e].update(this.skinMatrix,
- b,c)};THREE.Bone.prototype.add=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
- THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,e,f,h,i,j;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++)f=this.geometry.bones[c],h=f.pos,i=f.rotq,j=f.scl,e=this.addBone(),e.name=f.name,e.position.set(h[0],h[1],h[2]),e.quaternion.set(i[0],i[1],i[2],i[3]),e.useQuaternion=!0,j!==void 0?e.scale.set(j[0],j[1],j[2]):e.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)f=this.geometry.bones[c],
- 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.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var e,f=this.children.length;for(e=0;e<f;e++)a=this.children[e],a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.matrixWorld,b,c);c=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(b=0;b<c;b++)ba[b].skinMatrix.flattenToArrayOffset(bm,
- b*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
- THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var a,b=[],c=0;c<this.bones.length;c++)a=this.bones[c],b.push(THREE.Matrix4.makeInvert(a.skinMatrix)),a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a].position,f=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y;e=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[h].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};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)};
- THREE.LOD.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;if(this.LODs.length>1){a=c.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 e=1;e<this.LODs.length;e++)if(a>=this.LODs[e].visibleAtDistance)this.LODs[e-1].object3D.visible=!1,
- this.LODs[e].object3D.visible=!0;else break;for(;e<this.LODs.length;e++)this.LODs[e].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};
- 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:
- !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;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
- THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);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);
- THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
- THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){this.supr.add.call(this,a);this.addChildRecurse(a)};
- THREE.Scene.prototype.addChildRecurse=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.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};
- THREE.Scene.prototype.removeChildRecurse=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.removeChildRecurse(a.children[b])};
- THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
- THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};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};
- 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",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",
- 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",
- 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 bool enableLighting;\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",
- lights_lambert_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = 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;\n}",
- 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",
- 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;",
- 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",
- 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",
- 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",
- 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",
- 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",
- 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"};
- 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}};
- 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",
- value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},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",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}}};
- 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}"},
- 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}},
- 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,
- 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,
- 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,
- 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,
- 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 );",
- 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 );",
- 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",
- 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 );",
- 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,
- "}"].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,
- 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,
- 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,
- 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,
- THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
- THREE.WebGLRenderer=function(a){function b(a,d){var b;a.material&&!(a.material instanceof THREE.MeshFaceMaterial)?b=a.material:d.materialIndex>=0&&(b=a.geometry.materials[d.materialIndex]);return b}function c(a,b,c){var e,h,f,i=a.vertices,r=i.length,J=a.colors,j=J.length,t=a.__vertexArray,k=a.__colorArray,n=a.__sortArray,v=a.__dirtyVertices,l=a.__dirtyColors,p=a.__webglCustomAttributesList,m;if(p){f=0;for(e=p.length;f<e;f++)p[f].offset=0}if(c.sortParticles){Ca.multiplySelf(c.matrixWorld);for(e=0;e<
- r;e++)h=i[e].position,Ha.copy(h),Ca.multiplyVector3(Ha),n[e]=[Ha.z,e];n.sort(function(a,d){return d[0]-a[0]});for(e=0;e<r;e++)h=i[n[e][1]].position,f=e*3,t[f]=h.x,t[f+1]=h.y,t[f+2]=h.z;for(e=0;e<j;e++)f=e*3,color=J[n[e][1]],k[f]=color.r,k[f+1]=color.g,k[f+2]=color.b;if(p){f=0;for(e=p.length;f<e;f++){r=p[f];j=r.value.length;for(J=0;J<j;J++){index=n[J][1];i=r.offset;if(r.size===1){if(r.boundTo===void 0||r.boundTo==="vertices")r.array[i]=r.value[index]}else{if(r.boundTo===void 0||r.boundTo==="vertices")m=
- r.value[index];r.size===2?(r.array[i]=m.x,r.array[i+1]=m.y):r.size===3?r.type==="c"?(r.array[i]=m.r,r.array[i+1]=m.g,r.array[i+2]=m.b):(r.array[i]=m.x,r.array[i+1]=m.y,r.array[i+2]=m.z):(r.array[i]=m.x,r.array[i+1]=m.y,r.array[i+2]=m.z,r.array[i+3]=m.w)}r.offset+=r.size}}}}else{if(v)for(e=0;e<r;e++)h=i[e].position,f=e*3,t[f]=h.x,t[f+1]=h.y,t[f+2]=h.z;if(l)for(e=0;e<j;e++)color=J[e],f=e*3,k[f]=color.r,k[f+1]=color.g,k[f+2]=color.b;if(p){f=0;for(e=p.length;f<e;f++)if(r=p[f],r.__original.needsUpdate){j=
- r.value.length;for(J=0;J<j;J++){i=r.offset;if(r.size===1){if(r.boundTo===void 0||r.boundTo==="vertices")r.array[i]=r.value[J]}else{if(r.boundTo===void 0||r.boundTo==="vertices")m=r.value[J];r.size===2?(r.array[i]=m.x,r.array[i+1]=m.y):r.size===3?r.type==="c"?(r.array[i]=m.r,r.array[i+1]=m.g,r.array[i+2]=m.b):(r.array[i]=m.x,r.array[i+1]=m.y,r.array[i+2]=m.z):(r.array[i]=m.x,r.array[i+1]=m.y,r.array[i+2]=m.z,r.array[i+3]=m.w)}r.offset+=r.size}}}}if(v||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),
- d.bufferData(d.ARRAY_BUFFER,t,b);if(l||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,k,b);if(p){f=0;for(e=p.length;f<e;f++)if(r=p[f],r.__original.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,r.buffer),d.bufferData(d.ARRAY_BUFFER,r.array,b)}}function e(a,b,c,e,h){e.program||F.initMaterial(e,b,c,h);if(e.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);for(var f=0,i=F.maxMorphTargets;f<
- i;f++)h.__webglMorphTargetInfluences[f]=0}var r=!1,f=e.program,i=f.uniforms,j=e.uniforms;f!=Va&&(d.useProgram(f),Va=f,r=!0);if(e.id!=ma)ma=e.id,r=!0;if(r){d.uniformMatrix4fv(i.projectionMatrix,!1,Sa);if(c&&e.fog)if(j.fogColor.value=c.color,c instanceof THREE.Fog)j.fogNear.value=c.near,j.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)j.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var W,t,k=0,n=0,v=0,l,m,p,s=Xa,y=s.directional.colors,
- u=s.directional.positions,B=s.point.colors,A=s.point.positions,C=s.point.distances,E=0,I=0,c=W=p=0,r=b.length;c<r;c++)if(W=b[c],t=W.color,l=W.position,m=W.intensity,p=W.distance,W instanceof THREE.AmbientLight)F.gammaInput?(k+=t.r*t.r,n+=t.g*t.g,v+=t.b*t.b):(k+=t.r,n+=t.g,v+=t.b);else if(W instanceof THREE.DirectionalLight)p=E*3,F.gammaInput?(y[p]=t.r*t.r*m*m,y[p+1]=t.g*t.g*m*m,y[p+2]=t.b*t.b*m*m):(y[p]=t.r*m,y[p+1]=t.g*m,y[p+2]=t.b*m),u[p]=l.x,u[p+1]=l.y,u[p+2]=l.z,E+=1;else if(W instanceof THREE.SpotLight)p=
- E*3,F.gammaInput?(y[p]=t.r*t.r*m*m,y[p+1]=t.g*t.g*m*m,y[p+2]=t.b*t.b*m*m):(y[p]=t.r*m,y[p+1]=t.g*m,y[p+2]=t.b*m),t=1/l.length(),u[p]=l.x*t,u[p+1]=l.y*t,u[p+2]=l.z*t,E+=1;else if(W instanceof THREE.PointLight)W=I*3,F.gammaInput?(B[W]=t.r*t.r*m*m,B[W+1]=t.g*t.g*m*m,B[W+2]=t.b*t.b*m*m):(B[W]=t.r*m,B[W+1]=t.g*m,B[W+2]=t.b*m),A[W]=l.x,A[W+1]=l.y,A[W+2]=l.z,C[I]=p,I+=1;c=E*3;for(r=y.length;c<r;c++)y[c]=0;c=I*3;for(r=B.length;c<r;c++)B[c]=0;s.point.length=I;s.directional.length=E;s.ambient[0]=k;s.ambient[1]=
- n;s.ambient[2]=v;b=Xa;j.enableLighting.value=b.directional.length+b.point.length;j.ambientLightColor.value=b.ambient;j.directionalLightColor.value=b.directional.colors;j.directionalLightDirection.value=b.directional.positions;j.pointLightColor.value=b.point.colors;j.pointLightPosition.value=b.point.positions;j.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)j.opacity.value=e.opacity,F.gammaInput?
- j.diffuse.value.copyGammaToLinear(e.color):j.diffuse.value=e.color,(j.map.texture=e.map)&&j.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),j.lightMap.texture=e.lightMap,j.envMap.texture=e.envMap,j.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,j.reflectivity.value=e.reflectivity,j.refractionRatio.value=e.refractionRatio,j.combine.value=e.combine,j.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof
- THREE.LineBasicMaterial)j.diffuse.value=e.color,j.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)j.psColor.value=e.color,j.opacity.value=e.opacity,j.size.value=e.size,j.scale.value=Da.height/2,j.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)j.shininess.value=e.shininess,F.gammaInput?(j.ambient.value.copyGammaToLinear(e.ambient),j.specular.value.copyGammaToLinear(e.specular)):(j.ambient.value=e.ambient,j.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)F.gammaInput?
- j.ambient.value.copyGammaToLinear(e.ambient):j.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)j.mNear.value=a.near,j.mFar.value=a.far,j.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)j.opacity.value=e.opacity;if(h.receiveShadow&&!e._shadowPass&&j.shadowMatrix){for(b=0;b<Ra.length;b++)j.shadowMatrix.value[b]=Ra[b],j.shadowMap.texture[b]=F.shadowMap[b];j.shadowDarkness.value=F.shadowMapDarkness;j.shadowBias.value=F.shadowMapBias}b=e.uniformsList;j=0;for(c=
- b.length;j<c;j++)if(n=f.uniforms[b[j][1]])if(k=b[j][0],v=k.type,r=k.value,v=="i")d.uniform1i(n,r);else if(v=="f")d.uniform1f(n,r);else if(v=="v2")d.uniform2f(n,r.x,r.y);else if(v=="v3")d.uniform3f(n,r.x,r.y,r.z);else if(v=="v4")d.uniform4f(n,r.x,r.y,r.z,r.w);else if(v=="c")d.uniform3f(n,r.r,r.g,r.b);else if(v=="fv1")d.uniform1fv(n,r);else if(v=="fv")d.uniform3fv(n,r);else if(v=="v3v"){if(!k._array)k._array=new Float32Array(3*r.length);v=0;for(l=r.length;v<l;v++)s=v*3,k._array[s]=r[v].x,k._array[s+
- 1]=r[v].y,k._array[s+2]=r[v].z;d.uniform3fv(n,k._array)}else if(v=="m4"){if(!k._array)k._array=new Float32Array(16);r.flattenToArray(k._array);d.uniformMatrix4fv(n,!1,k._array)}else if(v=="m4v"){if(!k._array)k._array=new Float32Array(16*r.length);v=0;for(l=r.length;v<l;v++)r[v].flattenToArrayOffset(k._array,v*16);d.uniformMatrix4fv(n,!1,k._array)}else if(v=="t"){if(d.uniform1i(n,r),n=k.texture)if(n.image instanceof Array&&n.image.length==6){if(k=n,k.image.length==6)if(k.needsUpdate){if(!k.image.__webglTextureCube)k.image.__webglTextureCube=
- d.createTexture();d.activeTexture(d.TEXTURE0+r);d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(r=0;r<6;r++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,k.image[r]);z(d.TEXTURE_CUBE_MAP,k,k.image[0]);k.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+r),d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(k=n,d.activeTexture(d.TEXTURE0+r),d.bindTexture(d.TEXTURE_CUBE_MAP,k.__webglTexture)):R(n,r)}else if(v==
- "tv"){if(!k._array){k._array=[];v=0;for(l=k.texture.length;v<l;v++)k._array[v]=r+v}d.uniform1iv(n,k._array);v=0;for(l=k.texture.length;v<l;v++)(n=k.texture[v])&&R(n,k._array[v])}(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 THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&i.viewMatrix!==null&&
- d.uniformMatrix4fv(i.viewMatrix,!1,Ta);e.skinning&&(d.uniformMatrix4fv(i.cameraInverseMatrix,!1,Ta),d.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices))}d.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);i.normalMatrix&&d.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||h.receiveShadow)&&i.objectMatrix!==null&&d.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);return f}function f(a,b,c,h,f,i){if(h.opacity!=
- 0){var j,r,c=e(a,b,c,h,i),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(h.wireframe?1:0);c!=E&&(E=c,b=!0);if(!h.morphTargets&&a.position>=0)b&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(a.position,3,d.FLOAT,!1,0,0));else if(i.morphTargetBase){c=h.program.attributes;i.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i.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(i.morphTargetForcedOrder.length){j=0;var k=i.morphTargetForcedOrder;for(r=i.morphTargetInfluences;j<h.numSupportedMorphTargets&&j<k.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k[j]]),d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[j]=r[k[j]],j++}else{var k=[],n=-1,t=0;r=i.morphTargetInfluences;var m,l=r.length;j=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=!0);j<h.numSupportedMorphTargets;){for(m=
- 0;m<l;m++)!k[m]&&r[m]>n&&(t=m,n=r[t]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[t]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[j]=n;k[t]=1;n=-1;j++}}h.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){j=0;for(r=f.__webglCustomAttributesList.length;j<r;j++)c=f.__webglCustomAttributesList[j],a[c.buffer.belongsToAttribute]>=
- 0&&(d.bindBuffer(d.ARRAY_BUFFER,c.buffer),d.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,d.FLOAT,!1,0,0))}a.color>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglColorBuffer),d.vertexAttribPointer(a.color,3,d.FLOAT,!1,0,0));a.normal>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglNormalBuffer),d.vertexAttribPointer(a.normal,3,d.FLOAT,!1,0,0));a.tangent>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglTangentBuffer),d.vertexAttribPointer(a.tangent,4,d.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(d.bindBuffer(d.ARRAY_BUFFER,
- f.__webglUVBuffer),d.vertexAttribPointer(a.uv,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(a.uv)):d.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUV2Buffer),d.vertexAttribPointer(a.uv2,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(a.uv2)):d.disableVertexAttribArray(a.uv2));h.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexABuffer),d.vertexAttribPointer(a.skinVertexA,4,
- d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),d.vertexAttribPointer(a.skinVertexB,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),d.vertexAttribPointer(a.skinIndex,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),d.vertexAttribPointer(a.skinWeight,4,d.FLOAT,!1,0,0))}i instanceof THREE.Mesh?(h.wireframe?(d.lineWidth(h.wireframeLinewidth),b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),d.drawElements(d.LINES,f.__webglLineCount,
- d.UNSIGNED_SHORT,0)):(b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),F.info.render.calls++,F.info.render.vertices+=f.__webglFaceCount,F.info.render.faces+=f.__webglFaceCount/3):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?d.LINE_STRIP:d.LINES,d.lineWidth(h.linewidth),d.drawArrays(i,0,f.__webglLineCount),F.info.render.calls++):i instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),F.info.render.calls++):
- i instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),F.info.render.calls++)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=d.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=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,h,i,j,k,n,t,m,l,p=a.count*3;for(l=0;l<p;l+=9)c=a.normalArray,e=c[l],f=c[l+1],h=c[l+2],i=c[l+3],k=c[l+4],t=c[l+5],j=c[l+6],n=c[l+7],m=c[l+8],e=(e+i+j)/3,f=(f+k+n)/3,h=(h+t+m)/3,c[l]=e,c[l+1]=f,c[l+2]=h,c[l+3]=e,c[l+4]=f,c[l+5]=h,c[l+6]=e,c[l+7]=f,c[l+8]=h}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 i(a){if(N!=a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),N=a.doubleSided;if(V!=a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),V=a.flipSided}function j(a){S!=a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),S=a)}function n(a){xa!=a&&(d.depthMask(a),xa=a)}function k(a,b,c){Ka!=a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),Ka=a);if(a&&(Pa!=b||Qa!=c))d.polygonOffset(b,c),Pa=b,Qa=c}function l(a){X[0].set(a.n41-
- a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);X[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);X[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);X[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);X[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);X[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=X[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function p(a){for(var b=a.matrixWorld,d=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,
- Math.max(a.scale.y,a.scale.z)),c=0;c<6;c++)if(a=X[c].x*b.n14+X[c].y*b.n24+X[c].z*b.n34+X[c].w,a<=d)return!1;return!0}function m(a,b){a.list[a.count]=b;a.count+=1}function s(a){var b;b=a.object;var d=a.opaque,a=a.transparent;a.count=0;d.count=0;b=b.material;b.transparent?m(a,b):m(d,b)}function B(a){var b,d;b=a.object;var c=a.buffer,e=a.opaque,a=a.transparent;a.count=0;e.count=0;d=b.material;d instanceof THREE.MeshFaceMaterial?(materialIndex=c.materialIndex,materialIndex>=0&&(b=b.geometry.materials[materialIndex],
- b.transparent?m(a,b):m(e,b))):(b=d)&&(b.transparent?m(a,b):m(e,b))}function A(a,b){return b.z-a.z}function H(a){var b,c,k,G=0,n,m,r,J,W=a.lights;sa||(sa=new THREE.PerspectiveCamera(F.shadowCameraFov,F.shadowMapWidth/F.shadowMapHeight,F.shadowCameraNear,F.shadowCameraFar));b=0;for(c=W.length;b<c;b++)if(k=W[b],k instanceof THREE.SpotLight&&k.castShadow){ma=-1;F.shadowMap[G]||(F.shadowMap[G]=new THREE.WebGLRenderTarget(F.shadowMapWidth,F.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
- format:THREE.RGBAFormat}));Ra[G]||(Ra[G]=new THREE.Matrix4);n=F.shadowMap[G];m=Ra[G];sa.position.copy(k.position);sa.lookAt(k.target.position);sa.update(void 0,!0);a.update(void 0,!1,sa);m.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);m.multiplySelf(sa.projectionMatrix);m.multiplySelf(sa.matrixWorldInverse);sa.matrixWorldInverse.flattenToArray(Ta);sa.projectionMatrix.flattenToArray(Sa);Ca.multiply(sa.projectionMatrix,sa.matrixWorldInverse);l(Ca);F.initWebGLObjects(a);T(n);d.clearColor(1,1,1,1);
- F.clear();d.clearColor(va.r,va.g,va.b,za);m=a.__webglObjects.length;k=a.__webglObjectsImmediate.length;for(n=0;n<m;n++)r=a.__webglObjects[n],J=r.object,J.visible&&J.castShadow?!(J instanceof THREE.Mesh)||!J.frustumCulled||p(J)?(J.matrixWorld.flattenToArray(J._objectMatrixArray),Q(J,sa,!1),r.render=!0):r.render=!1:r.render=!1;j(!0);L(THREE.NormalBlending);for(n=0;n<m;n++)if(r=a.__webglObjects[n],r.render)J=r.object,buffer=r.buffer,i(J),r=J.customDepthMaterial?J.customDepthMaterial:J.geometry.morphTargets.length?
- Ya:Ua,f(sa,W,null,r,buffer,J);for(n=0;n<k;n++)r=a.__webglObjectsImmediate[n],J=r.object,J.visible&&J.castShadow&&(J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray),E=-1,Q(J,sa,!1),i(J),program=e(sa,W,null,Ua,J),J.immediateRenderCallback?J.immediateRenderCallback(program,d,X):J.render(function(a){h(a,program,Ua.shading)}));G++}}function C(a,b){var c,e,f;c=u.attributes;var h=u.uniforms,i=Ia/ua,j,k=[],n=ua*0.5,t=Ia*0.5,l=!0;d.useProgram(u.program);Va=u.program;E=S=ia=-1;Za||(d.enableVertexAttribArray(u.attributes.position),
- d.enableVertexAttribArray(u.attributes.uv),Za=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,u.vertexBuffer);d.vertexAttribPointer(c.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,u.elementBuffer);d.uniformMatrix4fv(h.projectionMatrix,!1,Sa);d.activeTexture(d.TEXTURE0);d.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!=0)f.useScreenCoordinates?
- f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(A);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!=0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(d.uniform1i(h.useScreenCoordinates,1),d.uniform3f(h.screenPosition,(f.position.x-n)/n,(t-f.position.y)/t,Math.max(0,Math.min(1,f.position.z)))):(d.uniform1i(h.useScreenCoordinates,
- 0),d.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),d.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),j=f.map.image.width/(f.scaleByViewport?Ia:1),k[0]=j*i*f.scale.x,k[1]=j*f.scale.y,d.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),d.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),d.uniform2f(h.alignment,f.alignment.x,f.alignment.y),d.uniform1f(h.opacity,f.opacity),d.uniform3f(h.color,f.color.r,f.color.g,f.color.b),d.uniform1f(h.rotation,f.rotation),d.uniform2fv(h.scale,k),
- f.mergeWith3D&&!l?(d.enable(d.DEPTH_TEST),l=!0):!f.mergeWith3D&&l&&(d.disable(d.DEPTH_TEST),l=!1),L(f.blending),R(f.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(xa)}function Q(a,b,d){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function wa(a,d){var c=b(d,a);if(c.attributes)for(var e in c.attributes)if(c.attributes[e].needsUpdate)return!0;
- return!1}function ja(a,d){var c=b(d,a);if(c.attributes)for(var e in c.attributes)c.attributes[e].needsUpdate=!1}function qa(a,b){var d;for(d=a.length-1;d>=0;d--)a[d].object==b&&a.splice(d,1)}function ha(a,b,d){a.push({buffer:b,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(a){if(a!=ia){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);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)}ia=a}}function z(a,b,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(d.texParameteri(a,d.TEXTURE_WRAP_S,$(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,$(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,$(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,$(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,Aa(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,Aa(b.minFilter)))}function R(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=d.createTexture(),F.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,
- $(a.format),a.image.width,a.image.height,0,$(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);z(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,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 T(a){var b=a instanceof THREE.WebGLRenderTargetCube;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);z(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,$(a.format),a.width,a.height,0,$(a.format),$(a.type),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),z(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,$(a.format),a.width,a.height,0,$(a.format),$(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,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=ua,a=Ia,e=ya,f=Ba);b!=aa&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),aa=b)}function ka(a){a instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP,
- null)):(d.bindTexture(d.TEXTURE_2D,a.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null))}function Z(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 Aa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;
- default:return d.LINEAR}}function $(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;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;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 F=this,d,Fa=[],Va=null,aa=null,ma=-1,E=null,ra=0,N=null,V=null,ia=null,S=null,xa=null,Ka=null,Pa=null,Qa=null,ya=0,Ba=0,ua=0,Ia=0,X=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Sa=new Float32Array(16),Ta=new Float32Array(16),Ha=new THREE.Vector4,Xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},Da=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
- K=a.stencil!==void 0?a.stencil:!0,bb=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,cb=a.antialias!==void 0?a.antialias:!1,va=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),za=a.clearAlpha!==void 0?a.clearAlpha:0,Wa=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Da;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=this.shadowMapAutoUpdate=!0;var sa,Ra=[],a=THREE.ShaderLib.depthRGBA,$a=THREE.UniformsUtils.clone(a.uniforms),Ua=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,
- uniforms:$a}),Ya=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:$a,morphTargets:!0});Ua._shadowPass=!0;Ya._shadowPass=!0;try{if(!(d=Da.getContext("experimental-webgl",{antialias:cb,stencil:K,preserveDrawingBuffer:bb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+d.getParameter(d.VERSION)+" | "+d.getParameter(d.VENDOR)+" | "+d.getParameter(d.RENDERER)+" | "+d.getParameter(d.SHADING_LANGUAGE_VERSION))}catch(db){console.error(db)}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(va.r,va.g,va.b,za);this.context=d;var ab=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,u={};u.vertices=new Float32Array(16);u.faces=new Uint16Array(6);K=0;u.vertices[K++]=-1;u.vertices[K++]=-1;u.vertices[K++]=0;u.vertices[K++]=1;u.vertices[K++]=
- 1;u.vertices[K++]=-1;u.vertices[K++]=1;u.vertices[K++]=1;u.vertices[K++]=1;u.vertices[K++]=1;u.vertices[K++]=1;u.vertices[K++]=0;u.vertices[K++]=-1;u.vertices[K++]=1;u.vertices[K++]=0;K=u.vertices[K++]=0;u.faces[K++]=0;u.faces[K++]=1;u.faces[K++]=2;u.faces[K++]=0;u.faces[K++]=2;u.faces[K++]=3;u.vertexBuffer=d.createBuffer();u.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,u.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,u.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,u.elementBuffer);
- d.bufferData(d.ELEMENT_ARRAY_BUFFER,u.faces,d.STATIC_DRAW);u.program=d.createProgram();d.attachShader(u.program,Z("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(u.program,Z("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(u.program);u.attributes={};u.uniforms={};u.attributes.position=d.getAttribLocation(u.program,"position");u.attributes.uv=d.getAttribLocation(u.program,"uv");u.uniforms.uvOffset=d.getUniformLocation(u.program,"uvOffset");u.uniforms.uvScale=d.getUniformLocation(u.program,
- "uvScale");u.uniforms.rotation=d.getUniformLocation(u.program,"rotation");u.uniforms.scale=d.getUniformLocation(u.program,"scale");u.uniforms.alignment=d.getUniformLocation(u.program,"alignment");u.uniforms.color=d.getUniformLocation(u.program,"color");u.uniforms.map=d.getUniformLocation(u.program,"map");u.uniforms.opacity=d.getUniformLocation(u.program,"opacity");u.uniforms.useScreenCoordinates=d.getUniformLocation(u.program,"useScreenCoordinates");u.uniforms.affectedByDistance=d.getUniformLocation(u.program,
- "affectedByDistance");u.uniforms.screenPosition=d.getUniformLocation(u.program,"screenPosition");u.uniforms.modelViewMatrix=d.getUniformLocation(u.program,"modelViewMatrix");u.uniforms.projectionMatrix=d.getUniformLocation(u.program,"projectionMatrix");var Za=!1;this.setSize=function(a,b){Da.width=a;Da.height=b;this.setViewport(0,0,Da.width,Da.height)};this.setViewport=function(a,b,c,e){ya=a;Ba=b;ua=c;Ia=e;d.viewport(ya,Ba,ua,Ia)};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)};this.setClearColorHex=function(a,b){va.setHex(a);za=b;d.clearColor(va.r,va.g,va.b,za)};this.setClearColor=function(a,b){va.copy(a);za=b;d.clearColor(va.r,va.g,va.b,za)};this.getClearColor=function(){return va};this.getClearAlpha=function(){return za};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.getContext=function(){return d};
- this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];d.deleteBuffer(b.__webglVertexBuffer);d.deleteBuffer(b.__webglNormalBuffer);d.deleteBuffer(b.__webglTangentBuffer);d.deleteBuffer(b.__webglColorBuffer);d.deleteBuffer(b.__webglUVBuffer);d.deleteBuffer(b.__webglUV2Buffer);d.deleteBuffer(b.__webglSkinVertexABuffer);
- d.deleteBuffer(b.__webglSkinVertexBBuffer);d.deleteBuffer(b.__webglSkinIndicesBuffer);d.deleteBuffer(b.__webglSkinWeightsBuffer);d.deleteBuffer(b.__webglFaceBuffer);d.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)d.deleteBuffer(b.__webglMorphTargetsBuffers[c]);F.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--;else if(a instanceof
- THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),F.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,i,j;a instanceof THREE.MeshDepthMaterial?j="depth":
- a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var n,l,m;n=m=k=0;for(l=b.length;n<l;n++)i=b[n],i instanceof
- THREE.SpotLight&&m++,i instanceof THREE.DirectionalLight&&m++,i instanceof THREE.PointLight&&k++;k+m<=Wa?n=m:(n=Math.ceil(Wa*m/(k+m)),k=Wa-n);i={directional:n,point:k};k=m=0;for(n=b.length;k<n;k++)l=b[k],l instanceof THREE.SpotLight&&l.castShadow&&m++;var p=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)p=e.bones.length;var v;a:{n=a.fragmentShader;l=a.vertexShader;var k=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:i.directional,maxPointLights:i.point,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},s,e=[];j?e.push(j):(e.push(n),e.push(l));for(s in c)e.push(s),e.push(c[s]);j=e.join();s=0;
- for(e=Fa.length;s<e;s++)if(Fa[s].code==j){v=Fa[s].program;break a}s=d.createProgram();e=[ab?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+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.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");
- i=["#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:"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.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":
- "",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(s,Z("fragment",i+n));d.attachShader(s,
- Z("vertex",e+l));d.linkProgram(s);d.getProgramParameter(s,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(s,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");s.uniforms={};s.attributes={};var u,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in k)e.push(u);u=e;e=0;for(k=u.length;e<k;e++)n=u[e],s.uniforms[n]=d.getUniformLocation(s,
- n);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<c.maxMorphTargets;u++)e.push("morphTarget"+u);for(v in b)e.push(v);v=e;u=0;for(b=v.length;u<b;u++)c=v[u],s.attributes[c]=d.getAttribLocation(s,c);s.id=Fa.length;Fa.push({program:s,code:j});F.info.memory.programs=Fa.length;v=s}a.program=v;v=a.program.attributes;v.position>=0&&d.enableVertexAttribArray(v.position);v.color>=0&&d.enableVertexAttribArray(v.color);v.normal>=0&&d.enableVertexAttribArray(v.normal);
- v.tangent>=0&&d.enableVertexAttribArray(v.tangent);a.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(d.enableVertexAttribArray(v.skinVertexA),d.enableVertexAttribArray(v.skinVertexB),d.enableVertexAttribArray(v.skinIndex),d.enableVertexAttribArray(v.skinWeight));if(a.attributes)for(h in a.attributes)v[h]!==void 0&&v[h]>=0&&d.enableVertexAttribArray(v[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)u="morphTarget"+h,v[u]>=0&&(d.enableVertexAttribArray(v[u]),
- a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){T(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){H(a,b)};this.render=function(a,b,c,m){var G,Ga,u,r,J,W,t,z,Oa=a.lights,v=a.fog;ma=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&H(a,b);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=0;if(b.matrixAutoUpdate){for(J=b;J.parent;)J=J.parent;J.update(void 0,!0)}a.update(void 0,!1,
- b);b.matrixWorldInverse.flattenToArray(Ta);b.projectionMatrix.flattenToArray(Sa);Ca.multiply(b.projectionMatrix,b.matrixWorldInverse);l(Ca);this.initWebGLObjects(a);T(c);(this.autoClear||m)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);J=a.__webglObjects.length;for(m=0;m<J;m++)if(G=a.__webglObjects[m],t=G.object,t.visible)if(!(t instanceof THREE.Mesh)||!t.frustumCulled||p(t)){if(t.matrixWorld.flattenToArray(t._objectMatrixArray),Q(t,b,!0),B(G),G.render=!0,this.sortObjects)G.object.renderDepth?
- G.z=G.object.renderDepth:(Ha.copy(t.position),Ca.multiplyVector3(Ha),G.z=Ha.z)}else G.render=!1;else G.render=!1;this.sortObjects&&a.__webglObjects.sort(A);W=a.__webglObjectsImmediate.length;for(m=0;m<W;m++)G=a.__webglObjectsImmediate[m],t=G.object,t.visible&&(t.matrixAutoUpdate&&t.matrixWorld.flattenToArray(t._objectMatrixArray),Q(t,b,!0),s(G));if(a.overrideMaterial){j(a.overrideMaterial.depthTest);L(a.overrideMaterial.blending);for(m=0;m<J;m++)if(G=a.__webglObjects[m],G.render)t=G.object,z=G.buffer,
- i(t),f(b,Oa,v,a.overrideMaterial,z,t);for(m=0;m<W;m++)G=a.__webglObjectsImmediate[m],t=G.object,t.visible&&(E=-1,i(t),Ga=e(b,Oa,v,a.overrideMaterial,t),t.immediateRenderCallback?t.immediateRenderCallback(Ga,d,X):t.render(function(b){h(b,Ga,a.overrideMaterial.shading)}))}else{L(THREE.NormalBlending);for(m=J-1;m>=0;m--)if(G=a.__webglObjects[m],G.render){t=G.object;z=G.buffer;u=G.opaque;i(t);for(G=0;G<u.count;G++)r=u.list[G],j(r.depthTest),n(r.depthWrite),k(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),
- f(b,Oa,v,r,z,t)}for(m=0;m<W;m++)if(G=a.__webglObjectsImmediate[m],t=G.object,t.visible){E=-1;u=G.opaque;i(t);for(G=0;G<u.count;G++)r=u.list[G],j(r.depthTest),n(r.depthWrite),k(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),Ga=e(b,Oa,v,r,t),t.immediateRenderCallback?t.immediateRenderCallback(Ga,d,X):t.render(function(a){h(a,Ga,r.shading)})}for(m=0;m<J;m++)if(G=a.__webglObjects[m],G.render){t=G.object;z=G.buffer;u=G.transparent;i(t);for(G=0;G<u.count;G++)r=u.list[G],L(r.blending),j(r.depthTest),
- n(r.depthWrite),k(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),f(b,Oa,v,r,z,t)}for(m=0;m<W;m++)if(G=a.__webglObjectsImmediate[m],t=G.object,t.visible){E=-1;u=G.transparent;i(t);for(G=0;G<u.count;G++)r=u.list[G],L(r.blending),j(r.depthTest),n(r.depthWrite),k(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),Ga=e(b,Oa,v,r,t),t.immediateRenderCallback?t.immediateRenderCallback(Ga,d,X):t.render(function(a){h(a,Ga,r.shading)})}}a.__webglSprites.length&&C(a,b);c&&c.minFilter!==
- THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&ka(c)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,h=void 0,i=void 0,j=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),
- e instanceof THREE.Mesh){i=e.geometry;if(i.geometryGroups==void 0){var j=i,k=void 0,m=void 0,n=void 0,l=void 0,t=n=void 0,p=void 0,s={},v=j.morphTargets!==void 0?j.morphTargets.length:0;j.geometryGroups={};k=0;for(m=j.faces.length;k<m;k++)n=j.faces[k],l=n.materialIndex,t=l!==void 0?l:-1,s[t]==void 0&&(s[t]={hash:t,counter:0}),p=s[t].hash+"_"+s[t].counter,j.geometryGroups[p]==void 0&&(j.geometryGroups[p]={faces:[],materialIndex:l,vertices:0,numMorphTargets:v}),n=n instanceof THREE.Face3?3:4,j.geometryGroups[p].vertices+
- n>65535&&(s[t].counter+=1,p=s[t].hash+"_"+s[t].counter,j.geometryGroups[p]==void 0&&(j.geometryGroups[p]={faces:[],materialIndex:l,vertices:0,numMorphTargets:v})),j.geometryGroups[p].faces.push(k),j.geometryGroups[p].vertices+=n;j.geometryGroupsList=[];k=void 0;for(k in j.geometryGroups)j.geometryGroups[k].id=ra++,j.geometryGroupsList.push(j.geometryGroups[k])}for(h in i.geometryGroups)if(j=i.geometryGroups[h],!j.__webglVertexBuffer){k=j;k.__webglVertexBuffer=d.createBuffer();k.__webglNormalBuffer=
- d.createBuffer();k.__webglTangentBuffer=d.createBuffer();k.__webglColorBuffer=d.createBuffer();k.__webglUVBuffer=d.createBuffer();k.__webglUV2Buffer=d.createBuffer();k.__webglSkinVertexABuffer=d.createBuffer();k.__webglSkinVertexBBuffer=d.createBuffer();k.__webglSkinIndicesBuffer=d.createBuffer();k.__webglSkinWeightsBuffer=d.createBuffer();k.__webglFaceBuffer=d.createBuffer();k.__webglLineBuffer=d.createBuffer();if(k.numMorphTargets){l=m=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(l=k.numMorphTargets;m<
- l;m++)k.__webglMorphTargetsBuffers.push(d.createBuffer())}F.info.memory.geometries++;for(var l=e,u=n=s=void 0,t=u=v=u=void 0,p=t=k=0,z=n=void 0,B=void 0,n=m=v=s=void 0,v=l.geometry,z=v.faces,B=j.faces,s=0,n=B.length;s<n;s++)u=B[s],u=z[u],u instanceof THREE.Face3?(k+=3,t+=1,p+=3):u instanceof THREE.Face4&&(k+=4,t+=2,p+=4);s=b(l,j);n=s.map||s.lightMap||s instanceof THREE.ShaderMaterial?!0:!1;B=s instanceof THREE.MeshBasicMaterial&&!s.envMap||s instanceof THREE.MeshDepthMaterial?!1:s&&s.shading!=void 0&&
- s.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;z=s.vertexColors?s.vertexColors:!1;j.__vertexArray=new Float32Array(k*3);if(B)j.__normalArray=new Float32Array(k*3);if(v.hasTangents)j.__tangentArray=new Float32Array(k*4);if(z)j.__colorArray=new Float32Array(k*3);if(n){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)j.__uvArray=new Float32Array(k*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(k*2)}if(l.geometry.skinWeights.length&&l.geometry.skinIndices.length)j.__skinVertexAArray=
- new Float32Array(k*4),j.__skinVertexBArray=new Float32Array(k*4),j.__skinIndexArray=new Float32Array(k*4),j.__skinWeightArray=new Float32Array(k*4);j.__faceArray=new Uint16Array(t*3+(l.geometry.edgeFaces?l.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(p*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];v=0;for(u=j.numMorphTargets;v<u;v++)j.__morphTargetsArrays.push(new Float32Array(k*3))}j.__needsSmoothNormals=B==THREE.SmoothShading;j.__uvType=n;j.__vertexColorType=z;j.__normalType=
- B;j.__webglFaceCount=t*3+(l.geometry.edgeFaces?l.geometry.edgeFaces.length*6:0);j.__webglLineCount=p*2;if(s.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];l=void 0;for(l in s.attributes){n=s.attributes[l];v={};for(m in n)v[m]=n[m];if(!v.__webglInitialized||v.createUniqueBuffers)v.__webglInitialized=!0,t=1,v.type==="v2"?t=2:v.type==="v3"?t=3:v.type==="v4"?t=4:v.type==="c"&&(t=3),v.size=t,v.array=new Float32Array(k*t),v.buffer=d.createBuffer(),v.buffer.belongsToAttribute=
- l,n.needsUpdate=!0,v.__original=n;j.__webglCustomAttributesList.push(v)}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(i=e.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),F.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*
- 3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.Line){if(i=e.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),F.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(i=e.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=
- d.createBuffer();j.__webglColorBuffer=d.createBuffer();F.info.geometries++;j=i;m=e;k=j.vertices.length;j.__vertexArray=new Float32Array(k*3);j.__colorArray=new Float32Array(k*3);j.__sortArray=[];j.__webglParticleCount=k;m=m.material;if(m.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];l=void 0;for(l in m.attributes){originalAttribute=m.attributes[l];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||
- attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=d.createBuffer(),attribute.buffer.belongsToAttribute=l,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributesList.push(attribute)}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof
- THREE.Mesh)for(h in i=e.geometry,i.geometryGroups)j=i.geometryGroups[h],ha(f.__webglObjects,j,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(i=e.geometry,ha(f.__webglObjects,i,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,
- 1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)qa(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;i=void 0;for(i=f.length-1;i>=0;i--)f[i]==h&&f.splice(i,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&qa(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<
- f;e++)if(i=a.__webglObjects[e].object,l=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(m=h.geometryGroupsList.length;k<m;k++)if(j=h.geometryGroupsList[k],l=wa(j,i),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||l)if(l=j,t=d.DYNAMIC_DRAW,p=!h.dynamic,l.__inittedArrays){var A=v=s=void 0,y=void 0,E=A=void 0,C=void 0,H=void 0,L=void 0,S=u=B=z=n=void 0,I=void 0,O=void 0,P=void 0,M=void 0,w=y=L=y=H=C=void 0,D=void 0,
- q=D=w=C=void 0,o=void 0,q=D=w=A=A=E=D=w=y=q=D=w=o=q=D=w=o=q=D=w=void 0,K=0,N=0,$=0,aa=0,T=0,Q=0,Y=0,R=0,la=0,x=0,na=0,U=q=0,U=void 0,oa=l.__vertexArray,ka=l.__uvArray,ma=l.__uv2Array,V=l.__normalArray,ca=l.__tangentArray,pa=l.__colorArray,da=l.__skinVertexAArray,ea=l.__skinVertexBArray,fa=l.__skinIndexArray,ga=l.__skinWeightArray,sa=l.__morphTargetsArrays,Z=l.__webglCustomAttributesList,o=void 0,ia=l.__faceArray,X=l.__lineArray,va=l.__needsSmoothNormals,z=l.__vertexColorType,n=l.__uvType,B=l.__normalType,
- ta=i.geometry,xa=ta.__dirtyVertices,ya=ta.__dirtyElements,ua=ta.__dirtyUvs,Aa=ta.__dirtyNormals,Ba=ta.__dirtyTangents,Ca=ta.__dirtyColors,Da=ta.__dirtyMorphTargets,za=ta.vertices,Fa=l.faces,Ka=ta.faces,Ha=ta.faceVertexUvs[0],Ia=ta.faceVertexUvs[1],La=ta.skinVerticesA,Ma=ta.skinVerticesB,Na=ta.skinIndices,Ja=ta.skinWeights,Ea=ta.morphTargets;if(Z){w=0;for(D=Z.length;w<D;w++)Z[w].offset=0,Z[w].offsetSrc=0}s=0;for(v=Fa.length;s<v;s++)if(A=Fa[s],y=Ka[A],Ha&&(u=Ha[A]),Ia&&(S=Ia[A]),A=y.vertexNormals,E=
- y.normal,C=y.vertexColors,H=y.color,L=y.vertexTangents,y instanceof THREE.Face3){if(xa)I=za[y.a].position,O=za[y.b].position,P=za[y.c].position,oa[N]=I.x,oa[N+1]=I.y,oa[N+2]=I.z,oa[N+3]=O.x,oa[N+4]=O.y,oa[N+5]=O.z,oa[N+6]=P.x,oa[N+7]=P.y,oa[N+8]=P.z,N+=9;if(Z){w=0;for(D=Z.length;w<D;w++)if(o=Z[w],o.__original.needsUpdate)q=o.offset,U=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[q]=o.value[y.a],o.array[q+1]=o.value[y.b],o.array[q+2]=o.value[y.c]):o.boundTo==="faces"?
- (U=o.value[U],o.array[q]=U,o.array[q+1]=U,o.array[q+2]=U,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[q]=o.value[U],o.array[q+1]=o.value[U+1],o.array[q+2]=o.value[U+2],o.offsetSrc+=3),o.offset+=3):(o.boundTo===void 0||o.boundTo==="vertices"?(I=o.value[y.a],O=o.value[y.b],P=o.value[y.c]):o.boundTo==="faces"?(P=O=I=U=o.value[U],o.offsetSrc++):o.boundTo==="faceVertices"&&(I=o.value[U],O=o.value[U+1],P=o.value[U+2],o.offsetSrc+=3),o.size===2?(o.array[q]=I.x,o.array[q+1]=I.y,o.array[q+2]=O.x,o.array[q+
- 3]=O.y,o.array[q+4]=P.x,o.array[q+5]=P.y,o.offset+=6):o.size===3?(o.type==="c"?(o.array[q]=I.r,o.array[q+1]=I.g,o.array[q+2]=I.b,o.array[q+3]=O.r,o.array[q+4]=O.g,o.array[q+5]=O.b,o.array[q+6]=P.r,o.array[q+7]=P.g,o.array[q+8]=P.b):(o.array[q]=I.x,o.array[q+1]=I.y,o.array[q+2]=I.z,o.array[q+3]=O.x,o.array[q+4]=O.y,o.array[q+5]=O.z,o.array[q+6]=P.x,o.array[q+7]=P.y,o.array[q+8]=P.z),o.offset+=9):(o.array[q]=I.x,o.array[q+1]=I.y,o.array[q+2]=I.z,o.array[q+3]=I.w,o.array[q+4]=O.x,o.array[q+5]=O.y,o.array[q+
- 6]=O.z,o.array[q+7]=O.w,o.array[q+8]=P.x,o.array[q+9]=P.y,o.array[q+10]=P.z,o.array[q+11]=P.w,o.offset+=12))}if(Da){w=0;for(D=Ea.length;w<D;w++)I=Ea[w].vertices[y.a].position,O=Ea[w].vertices[y.b].position,P=Ea[w].vertices[y.c].position,q=sa[w],q[na]=I.x,q[na+1]=I.y,q[na+2]=I.z,q[na+3]=O.x,q[na+4]=O.y,q[na+5]=O.z,q[na+6]=P.x,q[na+7]=P.y,q[na+8]=P.z;na+=9}if(Ja.length)w=Ja[y.a],D=Ja[y.b],q=Ja[y.c],ga[x]=w.x,ga[x+1]=w.y,ga[x+2]=w.z,ga[x+3]=w.w,ga[x+4]=D.x,ga[x+5]=D.y,ga[x+6]=D.z,ga[x+7]=D.w,ga[x+8]=
- q.x,ga[x+9]=q.y,ga[x+10]=q.z,ga[x+11]=q.w,w=Na[y.a],D=Na[y.b],q=Na[y.c],fa[x]=w.x,fa[x+1]=w.y,fa[x+2]=w.z,fa[x+3]=w.w,fa[x+4]=D.x,fa[x+5]=D.y,fa[x+6]=D.z,fa[x+7]=D.w,fa[x+8]=q.x,fa[x+9]=q.y,fa[x+10]=q.z,fa[x+11]=q.w,w=La[y.a],D=La[y.b],q=La[y.c],da[x]=w.x,da[x+1]=w.y,da[x+2]=w.z,da[x+3]=1,da[x+4]=D.x,da[x+5]=D.y,da[x+6]=D.z,da[x+7]=1,da[x+8]=q.x,da[x+9]=q.y,da[x+10]=q.z,da[x+11]=1,w=Ma[y.a],D=Ma[y.b],q=Ma[y.c],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=1,ea[x+4]=D.x,ea[x+5]=D.y,ea[x+6]=D.z,ea[x+7]=
- 1,ea[x+8]=q.x,ea[x+9]=q.y,ea[x+10]=q.z,ea[x+11]=1,x+=12;if(Ca&&z)C.length==3&&z==THREE.VertexColors?(y=C[0],w=C[1],D=C[2]):D=w=y=H,pa[la]=y.r,pa[la+1]=y.g,pa[la+2]=y.b,pa[la+3]=w.r,pa[la+4]=w.g,pa[la+5]=w.b,pa[la+6]=D.r,pa[la+7]=D.g,pa[la+8]=D.b,la+=9;if(Ba&&ta.hasTangents)C=L[0],H=L[1],y=L[2],ca[Y]=C.x,ca[Y+1]=C.y,ca[Y+2]=C.z,ca[Y+3]=C.w,ca[Y+4]=H.x,ca[Y+5]=H.y,ca[Y+6]=H.z,ca[Y+7]=H.w,ca[Y+8]=y.x,ca[Y+9]=y.y,ca[Y+10]=y.z,ca[Y+11]=y.w,Y+=12;if(Aa&&B)if(A.length==3&&va)for(w=0;w<3;w++)E=A[w],V[Q]=
- E.x,V[Q+1]=E.y,V[Q+2]=E.z,Q+=3;else for(w=0;w<3;w++)V[Q]=E.x,V[Q+1]=E.y,V[Q+2]=E.z,Q+=3;if(ua&&u!==void 0&&n)for(w=0;w<3;w++)A=u[w],ka[$]=A.u,ka[$+1]=A.v,$+=2;if(ua&&S!==void 0&&n)for(w=0;w<3;w++)A=S[w],ma[aa]=A.u,ma[aa+1]=A.v,aa+=2;ya&&(ia[T]=K,ia[T+1]=K+1,ia[T+2]=K+2,T+=3,X[R]=K,X[R+1]=K+1,X[R+2]=K,X[R+3]=K+2,X[R+4]=K+1,X[R+5]=K+2,R+=6,K+=3)}else if(y instanceof THREE.Face4){if(xa)I=za[y.a].position,O=za[y.b].position,P=za[y.c].position,M=za[y.d].position,oa[N]=I.x,oa[N+1]=I.y,oa[N+2]=I.z,oa[N+
- 3]=O.x,oa[N+4]=O.y,oa[N+5]=O.z,oa[N+6]=P.x,oa[N+7]=P.y,oa[N+8]=P.z,oa[N+9]=M.x,oa[N+10]=M.y,oa[N+11]=M.z,N+=12;if(Z){w=0;for(D=Z.length;w<D;w++)if(o=Z[w],o.__original.needsUpdate)q=o.offset,U=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[q]=o.value[y.a],o.array[q+1]=o.value[y.b],o.array[q+2]=o.value[y.c],o.array[q+3]=o.value[y.d]):o.boundTo==="faces"?(U=o.value[U],o.array[q]=U,o.array[q+1]=U,o.array[q+2]=U,o.array[q+3]=U,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[q]=
- o.value[U],o.array[q+1]=o.value[U+1],o.array[q+2]=o.value[U+2],o.array[q+3]=o.value[U+3],o.offsetSrc+=4),o.offset+=4):(o.boundTo===void 0||o.boundTo==="vertices"?(I=o.value[y.a],O=o.value[y.b],P=o.value[y.c],M=o.value[y.d]):o.boundTo==="faces"?(M=P=O=I=U=o.value[U],o.offsetSrc++):o.boundTo==="faceVertices"&&(I=o.value[U],O=o.value[U+1],P=o.value[U+2],M=o.value[U+3],o.offsetSrc+=4),o.size===2?(o.array[q]=I.x,o.array[q+1]=I.y,o.array[q+2]=O.x,o.array[q+3]=O.y,o.array[q+4]=P.x,o.array[q+5]=P.y,o.array[q+
- 6]=M.x,o.array[q+7]=M.y,o.offset+=8):o.size===3?(o.type==="c"?(o.array[q]=I.r,o.array[q+1]=I.g,o.array[q+2]=I.b,o.array[q+3]=O.r,o.array[q+4]=O.g,o.array[q+5]=O.b,o.array[q+6]=P.r,o.array[q+7]=P.g,o.array[q+8]=P.b,o.array[q+9]=M.r,o.array[q+10]=M.g,o.array[q+11]=M.b):(o.array[q]=I.x,o.array[q+1]=I.y,o.array[q+2]=I.z,o.array[q+3]=O.x,o.array[q+4]=O.y,o.array[q+5]=O.z,o.array[q+6]=P.x,o.array[q+7]=P.y,o.array[q+8]=P.z,o.array[q+9]=M.x,o.array[q+10]=M.y,o.array[q+11]=M.z),o.offset+=12):(o.array[q]=I.x,
- o.array[q+1]=I.y,o.array[q+2]=I.z,o.array[q+3]=I.w,o.array[q+4]=O.x,o.array[q+5]=O.y,o.array[q+6]=O.z,o.array[q+7]=O.w,o.array[q+8]=P.x,o.array[q+9]=P.y,o.array[q+10]=P.z,o.array[q+11]=P.w,o.array[q+12]=M.x,o.array[q+13]=M.y,o.array[q+14]=M.z,o.array[q+15]=M.w,o.offset+=16))}if(Da){w=0;for(D=Ea.length;w<D;w++)I=Ea[w].vertices[y.a].position,O=Ea[w].vertices[y.b].position,P=Ea[w].vertices[y.c].position,M=Ea[w].vertices[y.d].position,q=sa[w],q[na]=I.x,q[na+1]=I.y,q[na+2]=I.z,q[na+3]=O.x,q[na+4]=O.y,
- q[na+5]=O.z,q[na+6]=P.x,q[na+7]=P.y,q[na+8]=P.z,q[na+9]=M.x,q[na+10]=M.y,q[na+11]=M.z;na+=12}if(Ja.length)w=Ja[y.a],D=Ja[y.b],q=Ja[y.c],o=Ja[y.d],ga[x]=w.x,ga[x+1]=w.y,ga[x+2]=w.z,ga[x+3]=w.w,ga[x+4]=D.x,ga[x+5]=D.y,ga[x+6]=D.z,ga[x+7]=D.w,ga[x+8]=q.x,ga[x+9]=q.y,ga[x+10]=q.z,ga[x+11]=q.w,ga[x+12]=o.x,ga[x+13]=o.y,ga[x+14]=o.z,ga[x+15]=o.w,w=Na[y.a],D=Na[y.b],q=Na[y.c],o=Na[y.d],fa[x]=w.x,fa[x+1]=w.y,fa[x+2]=w.z,fa[x+3]=w.w,fa[x+4]=D.x,fa[x+5]=D.y,fa[x+6]=D.z,fa[x+7]=D.w,fa[x+8]=q.x,fa[x+9]=q.y,fa[x+
- 10]=q.z,fa[x+11]=q.w,fa[x+12]=o.x,fa[x+13]=o.y,fa[x+14]=o.z,fa[x+15]=o.w,w=La[y.a],D=La[y.b],q=La[y.c],o=La[y.d],da[x]=w.x,da[x+1]=w.y,da[x+2]=w.z,da[x+3]=1,da[x+4]=D.x,da[x+5]=D.y,da[x+6]=D.z,da[x+7]=1,da[x+8]=q.x,da[x+9]=q.y,da[x+10]=q.z,da[x+11]=1,da[x+12]=o.x,da[x+13]=o.y,da[x+14]=o.z,da[x+15]=1,w=Ma[y.a],D=Ma[y.b],q=Ma[y.c],y=Ma[y.d],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=1,ea[x+4]=D.x,ea[x+5]=D.y,ea[x+6]=D.z,ea[x+7]=1,ea[x+8]=q.x,ea[x+9]=q.y,ea[x+10]=q.z,ea[x+11]=1,ea[x+12]=y.x,ea[x+13]=
- y.y,ea[x+14]=y.z,ea[x+15]=1,x+=16;if(Ca&&z)C.length==4&&z==THREE.VertexColors?(y=C[0],w=C[1],D=C[2],C=C[3]):C=D=w=y=H,pa[la]=y.r,pa[la+1]=y.g,pa[la+2]=y.b,pa[la+3]=w.r,pa[la+4]=w.g,pa[la+5]=w.b,pa[la+6]=D.r,pa[la+7]=D.g,pa[la+8]=D.b,pa[la+9]=C.r,pa[la+10]=C.g,pa[la+11]=C.b,la+=12;if(Ba&&ta.hasTangents)C=L[0],H=L[1],y=L[2],L=L[3],ca[Y]=C.x,ca[Y+1]=C.y,ca[Y+2]=C.z,ca[Y+3]=C.w,ca[Y+4]=H.x,ca[Y+5]=H.y,ca[Y+6]=H.z,ca[Y+7]=H.w,ca[Y+8]=y.x,ca[Y+9]=y.y,ca[Y+10]=y.z,ca[Y+11]=y.w,ca[Y+12]=L.x,ca[Y+13]=L.y,
- ca[Y+14]=L.z,ca[Y+15]=L.w,Y+=16;if(Aa&&B)if(A.length==4&&va)for(w=0;w<4;w++)E=A[w],V[Q]=E.x,V[Q+1]=E.y,V[Q+2]=E.z,Q+=3;else for(w=0;w<4;w++)V[Q]=E.x,V[Q+1]=E.y,V[Q+2]=E.z,Q+=3;if(ua&&u!==void 0&&n)for(w=0;w<4;w++)A=u[w],ka[$]=A.u,ka[$+1]=A.v,$+=2;if(ua&&S!==void 0&&n)for(w=0;w<4;w++)A=S[w],ma[aa]=A.u,ma[aa+1]=A.v,aa+=2;ya&&(ia[T]=K,ia[T+1]=K+1,ia[T+2]=K+3,ia[T+3]=K+1,ia[T+4]=K+2,ia[T+5]=K+3,T+=6,X[R]=K,X[R+1]=K+1,X[R+2]=K,X[R+3]=K+3,X[R+4]=K+1,X[R+5]=K+2,X[R+6]=K+2,X[R+7]=K+3,R+=8,K+=4)}xa&&(d.bindBuffer(d.ARRAY_BUFFER,
- l.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,oa,t));if(Z){w=0;for(D=Z.length;w<D;w++)o=Z[w],o.__original.needsUpdate&&(d.bindBuffer(d.ARRAY_BUFFER,o.buffer),d.bufferData(d.ARRAY_BUFFER,o.array,t))}if(Da){w=0;for(D=Ea.length;w<D;w++)d.bindBuffer(d.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[w]),d.bufferData(d.ARRAY_BUFFER,sa[w],t)}Ca&&la>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,pa,t));Aa&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglNormalBuffer),d.bufferData(d.ARRAY_BUFFER,
- V,t));Ba&&ta.hasTangents&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglTangentBuffer),d.bufferData(d.ARRAY_BUFFER,ca,t));ua&&$>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,ka,t));ua&&aa>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,ma,t));ya&&(d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ia,t),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,X,t));
- x>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,da,t),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,ea,t),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,fa,t),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ga,t));p&&(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)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;ja(j,i)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=s=p=p=void 0;v=i.vertices;m=i.colors;n=v.length;l=m.length;z=i.__vertexArray;
- t=i.__colorArray;B=i.__dirtyColors;if(i.__dirtyVertices){for(p=0;p<n;p++)s=v[p].position,k=p*3,z[k]=s.x,z[k+1]=s.y,z[k+2]=s.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,z,j)}if(B){for(p=0;p<l;p++)color=m[p],k=p*3,t[k]=color.r,t[k+1]=color.g,t[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,t,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=
- h;j=d.DYNAMIC_DRAW;k=s=p=p=void 0;v=i.vertices;m=i.colors;n=v.length;l=m.length;z=i.__vertexArray;t=i.__colorArray;B=i.__dirtyColors;if(i.__dirtyVertices){for(p=0;p<n;p++)s=v[p].position,k=p*3,z[k]=s.x,z[k+1]=s.y,z[k+2]=s.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,z,j)}if(B){for(p=0;p<l;p++)color=m[p],k=p*3,t[k]=color.r,t[k+1]=color.g,t[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,t,j)}}h.__dirtyVertices=!1;h.__dirtyColors=
- !1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,l=wa(h,i),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||l)&&c(h,d.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,ja(h,i)};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)};this.supportsVertexTextures=function(){return ab}};
- 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:
- THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
- 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};
- THREE.WebGLRenderTargetCube.prototype=new THREE.WebGLRenderTarget;THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube;
|