diff --git a/build/Three.js b/build/Three.js index 190c6609..df3ddc79 100755 --- a/build/Three.js +++ b/build/Three.js @@ -1,70 +1,70 @@ // Three.js r32 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)}; -THREE.Color.prototype={setRGB:function(a,c,e){this.r=a;this.g=c;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,e){var f,k,l,p,q,m;if(e==0)f=k=l=0;else{p=Math.floor(a*6);q=a*6-p;a=e*(1-c);m=e*(1-c*q);c=e*(1-c*(1-q));switch(p){case 1:f=m;k=e;l=a;break;case 2:f=a;k=e;l=c;break;case 3:f=a;k=m;l=e;break;case 4:f=c;k=a;l=e;break;case 5:f=e;k=a;l=m;break;case 6:case 0:f=e;k=c;l=a}}this.r=f;this.g=k;this.b=l;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, +THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var f,j,k,q,o,l;if(d==0)f=j=k=0;else{q=Math.floor(a*6);o=a*6-q;a=d*(1-c);l=d*(1-c*o);c=d*(1-c*(1-o));switch(q){case 1:f=l;j=d;k=a;break;case 2:f=a;j=d;k=c;break;case 3:f=a;j=l;k=d;break;case 4:f=c;j=a;k=d;break;case 5:f=d;j=a;k=l;break;case 6:case 0:f=d;j=c;k=a}}this.r=f;this.g=j;this.b=k;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+ this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0}; THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x* -this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,e){this.x=a||0;this.y=c||0;this.z=e||0}; -THREE.Vector3.prototype={set:function(a,c,e){this.x=a;this.y=c;this.z=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, -cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,e=this.y,f=this.z;this.x=e*a.z-f*a.y;this.y=f*a.x-c*a.z;this.z=c*a.y-e*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.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){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+e*e+a*a)},distanceToSquared:function(a){var c=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return c*c+e*e+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x= +this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,d){this.x=a||0;this.y=c||0;this.z=d||0}; +THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, +cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,f=this.z;this.x=d*a.z-f*a.y;this.y=f*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.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){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x= -this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}}; -THREE.Vector4=function(a,c,e,f){this.x=a||0;this.y=c||0;this.z=e||0;this.w=f||1}; -THREE.Vector4.prototype={set:function(a,c,e,f){this.x=a;this.y=c;this.z=e;this.w=f;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; +THREE.Vector4=function(a,c,d,f){this.x=a||0;this.y=c||0;this.z=d||0;this.w=f||1}; +THREE.Vector4.prototype={set:function(a,c,d,f){this.x=a;this.y=c;this.z=d;this.w=f;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.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){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var c,e,f=a.objects,k=[];a=0;for(c=f.length;a0&&I>0&&O+I<1}var e,f,k,l,p,q,m,o,C,B, -u,x=a.geometry,b=x.vertices,H=[];e=0;for(f=x.faces.length;em?f:m;k=k>o? -k:o}a()};this.add3Points=function(m,o,C,B,u,x){if(q){q=false;c=mC?m>u?m:u:C>u?C:u;k=o>B?o>x?o:x:B>x?B:x}else{c=mC?m>u?m>f?m:f:u>f?u:f:C>u?C>f?C:f:u>f?u:f;k=o>B?o>x?o>k?o:k:x>k?x:k:B>x?B>k?B:k:x>k?x:k}a()};this.addRectangle=function(m){if(q){q=false;c=m.getLeft();e=m.getTop();f=m.getRight();k=m.getBottom()}else{c=cm.getRight()?f:m.getRight();k=k>m.getBottom()?k:m.getBottom()}a()};this.inflate=function(m){c-=m;e-=m;f+=m;k+=m;a()};this.minSelf=function(m){c=c>m.getLeft()?c:m.getLeft();e=e>m.getTop()?e:m.getTop();f=f=0&&Math.min(k,m.getBottom())-Math.max(e,m.getTop())>=0};this.empty=function(){q=true;k=f=e=c=0;a()};this.isEmpty=function(){return q};this.toString= -function(){return"THREE.Rectangle ( left: "+c+", right: "+f+", top: "+e+", bottom: "+k+", width: "+l+", height: "+p+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}}; -THREE.Matrix4=function(a,c,e,f,k,l,p,q,m,o,C,B,u,x,b,H){this.n11=a||1;this.n12=c||0;this.n13=e||0;this.n14=f||0;this.n21=k||0;this.n22=l||1;this.n23=p||0;this.n24=q||0;this.n31=m||0;this.n32=o||0;this.n33=C||1;this.n34=B||0;this.n41=u||0;this.n42=x||0;this.n43=b||0;this.n44=H||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,e,f,k,l,p,q,m,o,C,B,u,x,b,H){this.n11=a;this.n12=c;this.n13=e;this.n14=f;this.n21=k;this.n22=l;this.n23=p;this.n24=q;this.n31=m;this.n32=o;this.n33=C;this.n34=B;this.n41=u;this.n42=x;this.n43=b;this.n44=H;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= -a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,e){var f=THREE.Matrix4.__tmpVec1,k=THREE.Matrix4.__tmpVec2,l=THREE.Matrix4.__tmpVec3;l.sub(a,c).normalize();f.cross(e,l).normalize();k.cross(l,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=k.x;this.n22=k.y;this.n23=k.z;this.n24=-k.dot(a); -this.n31=l.x;this.n32=l.y;this.n33=l.z;this.n34=-l.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,e=a.y,f=a.z,k=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);a.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*k;a.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*k;a.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*k;return a},multiplyVector4:function(a){var c=a.x,e=a.y,f=a.z,k=a.w;a.x=this.n11*c+this.n12*e+this.n13*f+this.n14*k;a.y=this.n21*c+this.n22*e+this.n23* -f+this.n24*k;a.z=this.n31*c+this.n32*e+this.n33*f+this.n34*k;a.w=this.n41*c+this.n42*e+this.n43*f+this.n44*k;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var e=a.n11,f=a.n12,k=a.n13,l=a.n14,p=a.n21,q=a.n22,m=a.n23,o=a.n24,C=a.n31, -B=a.n32,u=a.n33,x=a.n34,b=a.n41,H=a.n42,I=a.n43,s=a.n44,R=c.n11,E=c.n12,J=c.n13,O=c.n14,Y=c.n21,P=c.n22,K=c.n23,V=c.n24,M=c.n31,U=c.n32,d=c.n33,h=c.n34,i=c.n41,j=c.n42,g=c.n43,n=c.n44;this.n11=e*R+f*Y+k*M+l*i;this.n12=e*E+f*P+k*U+l*j;this.n13=e*J+f*K+k*d+l*g;this.n14=e*O+f*V+k*h+l*n;this.n21=p*R+q*Y+m*M+o*i;this.n22=p*E+q*P+m*U+o*j;this.n23=p*J+q*K+m*d+o*g;this.n24=p*O+q*V+m*h+o*n;this.n31=C*R+B*Y+u*M+x*i;this.n32=C*E+B*P+u*U+x*j;this.n33=C*J+B*K+u*d+x*g;this.n34=C*O+B*V+u*h+x*n;this.n41=b*R+H*Y+ -I*M+s*i;this.n42=b*E+H*P+I*U+s*j;this.n43=b*J+H*K+I*d+s*g;this.n44=b*O+H*V+I*h+s*n;return this},multiplyToArray:function(a,c,e){var f=a.n11,k=a.n12,l=a.n13,p=a.n14,q=a.n21,m=a.n22,o=a.n23,C=a.n24,B=a.n31,u=a.n32,x=a.n33,b=a.n34,H=a.n41,I=a.n42,s=a.n43;a=a.n44;var R=c.n11,E=c.n12,J=c.n13,O=c.n14,Y=c.n21,P=c.n22,K=c.n23,V=c.n24,M=c.n31,U=c.n32,d=c.n33,h=c.n34,i=c.n41,j=c.n42,g=c.n43;c=c.n44;this.n11=f*R+k*Y+l*M+p*i;this.n12=f*E+k*P+l*U+p*j;this.n13=f*J+k*K+l*d+p*g;this.n14=f*O+k*V+l*h+p*c;this.n21= -q*R+m*Y+o*M+C*i;this.n22=q*E+m*P+o*U+C*j;this.n23=q*J+m*K+o*d+C*g;this.n24=q*O+m*V+o*h+C*c;this.n31=B*R+u*Y+x*M+b*i;this.n32=B*E+u*P+x*U+b*j;this.n33=B*J+u*K+x*d+b*g;this.n34=B*O+u*V+x*h+b*c;this.n41=H*R+I*Y+s*M+a*i;this.n42=H*E+I*P+s*U+a*j;this.n43=H*J+I*K+s*d+a*g;this.n44=H*O+I*V+s*h+a*c;e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34; -e[15]=this.n44;return this},multiplySelf:function(a){var c=this.n11,e=this.n12,f=this.n13,k=this.n14,l=this.n21,p=this.n22,q=this.n23,m=this.n24,o=this.n31,C=this.n32,B=this.n33,u=this.n34,x=this.n41,b=this.n42,H=this.n43,I=this.n44,s=a.n11,R=a.n21,E=a.n31,J=a.n41,O=a.n12,Y=a.n22,P=a.n32,K=a.n42,V=a.n13,M=a.n23,U=a.n33,d=a.n43,h=a.n14,i=a.n24,j=a.n34;a=a.n44;this.n11=c*s+e*R+f*E+k*J;this.n12=c*O+e*Y+f*P+k*K;this.n13=c*V+e*M+f*U+k*d;this.n14=c*h+e*i+f*j+k*a;this.n21=l*s+p*R+q*E+m*J;this.n22=l*O+p* -Y+q*P+m*K;this.n23=l*V+p*M+q*U+m*d;this.n24=l*h+p*i+q*j+m*a;this.n31=o*s+C*R+B*E+u*J;this.n32=o*O+C*Y+B*P+u*K;this.n33=o*V+C*M+B*U+u*d;this.n34=o*h+C*i+B*j+u*a;this.n41=x*s+b*R+H*E+I*J;this.n42=x*O+b*Y+H*P+I*K;this.n43=x*V+b*M+H*U+I*d;this.n44=x*h+b*i+H*j+I*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,c=this.n12,e=this.n13,f=this.n14,k=this.n21,l=this.n22,p=this.n23,q=this.n24,m=this.n31,o=this.n32,C=this.n33,B=this.n34,u=this.n41,x=this.n42,b=this.n43,H=this.n44;return f*p*o*u-e*q*o*u-f*l*C*u+c*q*C*u+e*l*B*u-c*p*B*u-f*p*m*x+e*q*m*x+f*k*C*x-a*q*C*x-e*k*B*x+a*p*B*x+f*l*m*b-c*q*m*b-f*k*o*b+a*q*o*b+c*k*B*b-a*l*B*b-e*l*m*H+c*p*m*H+e*k*o*H-a*p*o*H-c*k*C*H+a*l*C*H},transpose:function(){function a(c,e,f){var k=c[e];c[e]=c[f];c[f]=k}a(this,"n21","n12");a(this,"n31", -"n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){var a=this.flat;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},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},setTranslation:function(a,c,e){this.set(1,0,0,a,0,1,0,c,0,0,1,e,0,0,0, -1);return this},setScale:function(a,c,e){this.set(a,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var e=Math.cos(c),f=Math.sin(c),k=1-e,l=a.x,p=a.y,q=a.z, -m=k*l,o=k*p;this.set(m*l+e,m*p-f*q,m*q+f*p,0,m*p+f*q,o*p+e,o*q-f*l,0,m*q-f*p,o*q+f*l,k*q*q+e,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,e){var f=new THREE.Matrix4;f.setTranslation(a,c,e);return f}; -THREE.Matrix4.scaleMatrix=function(a,c,e){var f=new THREE.Matrix4;f.setScale(a,c,e);return f};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var e=new THREE.Matrix4;e.setRotAxis(a,c);return e}; -THREE.Matrix4.makeInvert=function(a){var c=a.n11,e=a.n12,f=a.n13,k=a.n14,l=a.n21,p=a.n22,q=a.n23,m=a.n24,o=a.n31,C=a.n32,B=a.n33,u=a.n34,x=a.n41,b=a.n42,H=a.n43,I=a.n44,s=new THREE.Matrix4;s.n11=q*u*b-m*B*b+m*C*H-p*u*H-q*C*I+p*B*I;s.n12=k*B*b-f*u*b-k*C*H+e*u*H+f*C*I-e*B*I;s.n13=f*m*b-k*q*b+k*p*H-e*m*H-f*p*I+e*q*I;s.n14=k*q*C-f*m*C-k*p*B+e*m*B+f*p*u-e*q*u;s.n21=m*B*x-q*u*x-m*o*H+l*u*H+q*o*I-l*B*I;s.n22=f*u*x-k*B*x+k*o*H-c*u*H-f*o*I+c*B*I;s.n23=k*q*x-f*m*x-k*l*H+c*m*H+f*l*I-c*q*I;s.n24=f*m*o-k*q*o+ -k*l*B-c*m*B-f*l*u+c*q*u;s.n31=p*u*x-m*C*x+m*o*b-l*u*b-p*o*I+l*C*I;s.n32=k*C*x-e*u*x-k*o*b+c*u*b+e*o*I-c*C*I;s.n33=f*m*x-k*p*x+k*l*b-c*m*b-e*l*I+c*p*I;s.n34=k*p*o-e*m*o-k*l*C+c*m*C+e*l*u-c*p*u;s.n41=q*C*x-p*B*x-q*o*b+l*B*b+p*o*H-l*C*H;s.n42=e*B*x-f*C*x+f*o*b-c*B*b-e*o*H+c*C*H;s.n43=f*p*x-e*q*x-f*l*b+c*q*b+e*l*H-c*p*H;s.n44=e*q*o-f*p*o+f*l*C-c*q*C-e*l*B+c*p*B;s.multiplyScalar(1/a.determinant());return s}; -THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,e=c.m,f=a.n33*a.n22-a.n32*a.n23,k=-a.n33*a.n21+a.n31*a.n23,l=a.n32*a.n21-a.n31*a.n22,p=-a.n33*a.n12+a.n32*a.n13,q=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,o=a.n23*a.n12-a.n22*a.n13,C=-a.n23*a.n11+a.n21*a.n13,B=a.n22*a.n11-a.n21*a.n12;a=a.n11*f+a.n21*p+a.n31*o;if(a==0)throw"matrix not invertible";a=1/a;e[0]=a*f;e[1]=a*k;e[2]=a*l;e[3]=a*p;e[4]=a*q;e[5]=a*m;e[6]=a*o;e[7]=a*C;e[8]=a*B;return c}; -THREE.Matrix4.makeFrustum=function(a,c,e,f,k,l){var p,q,m;p=new THREE.Matrix4;q=2*k/(c-a);m=2*k/(f-e);a=(c+a)/(c-a);e=(f+e)/(f-e);f=-(l+k)/(l-k);k=-2*l*k/(l-k);p.n11=q;p.n12=0;p.n13=a;p.n14=0;p.n21=0;p.n22=m;p.n23=e;p.n24=0;p.n31=0;p.n32=0;p.n33=f;p.n34=k;p.n41=0;p.n42=0;p.n43=-1;p.n44=0;return p};THREE.Matrix4.makePerspective=function(a,c,e,f){var k;a=e*Math.tan(a*Math.PI/360);k=-a;return THREE.Matrix4.makeFrustum(k*c,a*c,k,a,e,f)}; -THREE.Matrix4.makeOrtho=function(a,c,e,f,k,l){var p,q,m,o;p=new THREE.Matrix4;q=c-a;m=e-f;o=l-k;a=(c+a)/q;e=(e+f)/m;k=(l+k)/o;p.n11=2/q;p.n12=0;p.n13=0;p.n14=-a;p.n21=0;p.n22=2/m;p.n23=0;p.n24=-e;p.n31=0;p.n32=0;p.n33=-2/o;p.n34=-k;p.n41=0;p.n42=0;p.n43=0;p.n44=1;return p};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Ray.prototype={intersectScene:function(a){var c,d,f=a.objects,j=[];a=0;for(c=f.length;a0&&I>0&&R+I<1}var d,f,j,k,q,o,l,n,z,y, +v,x=a.geometry,F=x.vertices,H=[];d=0;for(f=x.faces.length;dl?f:l;j=j>n? +j:n}a()};this.add3Points=function(l,n,z,y,v,x){if(o){o=false;c=lz?l>v?l:v:z>v?z:v;j=n>y?n>x?n:x:y>x?y:x}else{c=lz?l>v?l>f?l:f:v>f?v:f:z>v?z>f?z:f:v>f?v:f;j=n>y?n>x?n>j?n:j:x>j?x:j:y>x?y>j?y:j:x>j?x:j}a()};this.addRectangle=function(l){if(o){o=false;c=l.getLeft();d=l.getTop();f=l.getRight();j=l.getBottom()}else{c=cl.getRight()?f:l.getRight();j=j>l.getBottom()?j:l.getBottom()}a()};this.inflate=function(l){c-=l;d-=l;f+=l;j+=l;a()};this.minSelf=function(l){c=c>l.getLeft()?c:l.getLeft();d=d>l.getTop()?d:l.getTop();f=f=0&&Math.min(j,l.getBottom())-Math.max(d,l.getTop())>=0};this.empty=function(){o=true;j=f=d=c=0;a()};this.isEmpty=function(){return o};this.toString= +function(){return"THREE.Rectangle ( left: "+c+", right: "+f+", top: "+d+", bottom: "+j+", width: "+k+", height: "+q+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}}; +THREE.Matrix4=function(a,c,d,f,j,k,q,o,l,n,z,y,v,x,F,H){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=f||0;this.n21=j||0;this.n22=k||1;this.n23=q||0;this.n24=o||0;this.n31=l||0;this.n32=n||0;this.n33=z||1;this.n34=y||0;this.n41=v||0;this.n42=x||0;this.n43=F||0;this.n44=H||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,f,j,k,q,o,l,n,z,y,v,x,F,H){this.n11=a;this.n12=c;this.n13=d;this.n14=f;this.n21=j;this.n22=k;this.n23=q;this.n24=o;this.n31=l;this.n32=n;this.n33=z;this.n34=y;this.n41=v;this.n42=x;this.n43=F;this.n44=H;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var f=THREE.Matrix4.__tmpVec1,j=THREE.Matrix4.__tmpVec2,k=THREE.Matrix4.__tmpVec3;k.sub(a,c).normalize();f.cross(d,k).normalize();j.cross(k,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=j.x;this.n22=j.y;this.n23=j.z;this.n24=-j.dot(a); +this.n31=k.x;this.n32=k.y;this.n33=k.z;this.n34=-k.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,f=a.z,j=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*j;a.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*j;a.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*j;return a},multiplyVector4:function(a){var c=a.x,d=a.y,f=a.z,j=a.w;a.x=this.n11*c+this.n12*d+this.n13*f+this.n14*j;a.y=this.n21*c+this.n22*d+this.n23* +f+this.n24*j;a.z=this.n31*c+this.n32*d+this.n33*f+this.n34*j;a.w=this.n41*c+this.n42*d+this.n43*f+this.n44*j;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,f=a.n12,j=a.n13,k=a.n14,q=a.n21,o=a.n22,l=a.n23,n=a.n24,z=a.n31, +y=a.n32,v=a.n33,x=a.n34,F=a.n41,H=a.n42,I=a.n43,s=a.n44,O=c.n11,C=c.n12,b=c.n13,R=c.n14,$=c.n21,Q=c.n22,J=c.n23,X=c.n24,G=c.n31,U=c.n32,M=c.n33,D=c.n34,K=c.n41,ca=c.n42,N=c.n43,aa=c.n44;this.n11=d*O+f*$+j*G+k*K;this.n12=d*C+f*Q+j*U+k*ca;this.n13=d*b+f*J+j*M+k*N;this.n14=d*R+f*X+j*D+k*aa;this.n21=q*O+o*$+l*G+n*K;this.n22=q*C+o*Q+l*U+n*ca;this.n23=q*b+o*J+l*M+n*N;this.n24=q*R+o*X+l*D+n*aa;this.n31=z*O+y*$+v*G+x*K;this.n32=z*C+y*Q+v*U+x*ca;this.n33=z*b+y*J+v*M+x*N;this.n34=z*R+y*X+v*D+x*aa;this.n41= +F*O+H*$+I*G+s*K;this.n42=F*C+H*Q+I*U+s*ca;this.n43=F*b+H*J+I*M+s*N;this.n44=F*R+H*X+I*D+s*aa;return this},multiplyToArray:function(a,c,d){var f=a.n11,j=a.n12,k=a.n13,q=a.n14,o=a.n21,l=a.n22,n=a.n23,z=a.n24,y=a.n31,v=a.n32,x=a.n33,F=a.n34,H=a.n41,I=a.n42,s=a.n43;a=a.n44;var O=c.n11,C=c.n12,b=c.n13,R=c.n14,$=c.n21,Q=c.n22,J=c.n23,X=c.n24,G=c.n31,U=c.n32,M=c.n33,D=c.n34,K=c.n41,ca=c.n42,N=c.n43;c=c.n44;this.n11=f*O+j*$+k*G+q*K;this.n12=f*C+j*Q+k*U+q*ca;this.n13=f*b+j*J+k*M+q*N;this.n14=f*R+j*X+k*D+q* +c;this.n21=o*O+l*$+n*G+z*K;this.n22=o*C+l*Q+n*U+z*ca;this.n23=o*b+l*J+n*M+z*N;this.n24=o*R+l*X+n*D+z*c;this.n31=y*O+v*$+x*G+F*K;this.n32=y*C+v*Q+x*U+F*ca;this.n33=y*b+v*J+x*M+F*N;this.n34=y*R+v*X+x*D+F*c;this.n41=H*O+I*$+s*G+a*K;this.n42=H*C+I*Q+s*U+a*ca;this.n43=H*b+I*J+s*M+a*N;this.n44=H*R+I*X+s*D+a*c;d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24; +d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,f=this.n13,j=this.n14,k=this.n21,q=this.n22,o=this.n23,l=this.n24,n=this.n31,z=this.n32,y=this.n33,v=this.n34,x=this.n41,F=this.n42,H=this.n43,I=this.n44,s=a.n11,O=a.n21,C=a.n31,b=a.n41,R=a.n12,$=a.n22,Q=a.n32,J=a.n42,X=a.n13,G=a.n23,U=a.n33,M=a.n43,D=a.n14,K=a.n24,ca=a.n34;a=a.n44;this.n11=c*s+d*O+f*C+j*b;this.n12=c*R+d*$+f*Q+j*J;this.n13=c*X+d*G+f*U+j*M;this.n14=c*D+d*K+f*ca+j*a;this.n21=k*s+q*O+o*C+l* +b;this.n22=k*R+q*$+o*Q+l*J;this.n23=k*X+q*G+o*U+l*M;this.n24=k*D+q*K+o*ca+l*a;this.n31=n*s+z*O+y*C+v*b;this.n32=n*R+z*$+y*Q+v*J;this.n33=n*X+z*G+y*U+v*M;this.n34=n*D+z*K+y*ca+v*a;this.n41=x*s+F*O+H*C+I*b;this.n42=x*R+F*$+H*Q+I*J;this.n43=x*X+F*G+H*U+I*M;this.n44=x*D+F*K+H*ca+I*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,c=this.n12,d=this.n13,f=this.n14,j=this.n21,k=this.n22,q=this.n23,o=this.n24,l=this.n31,n=this.n32,z=this.n33,y=this.n34,v=this.n41,x=this.n42,F=this.n43,H=this.n44;return f*q*n*v-d*o*n*v-f*k*z*v+c*o*z*v+d*k*y*v-c*q*y*v-f*q*l*x+d*o*l*x+f*j*z*x-a*o*z*x-d*j*y*x+a*q*y*x+f*k*l*F-c*o*l*F-f*j*n*F+a*o*n*F+c*j*y*F-a*k*y*F-d*k*l*H+c*q*l*H+d*j*n*H-a*q*n*H-c*j*z*H+a*k*z*H},transpose:function(){function a(c,d,f){var j=c[d];c[d]=c[f];c[f]=j}a(this,"n21","n12"); +a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){var a=this.flat;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},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},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d, +0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),f=Math.sin(c),j=1-d,k=a.x,q=a.y, +o=a.z,l=j*k,n=j*q;this.set(l*k+d,l*q-f*o,l*o+f*q,0,l*q+f*o,n*q+d,n*o-f*k,0,l*o-f*q,n*o+f*k,j*o*o+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setTranslation(a,c,d);return f}; +THREE.Matrix4.scaleMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setScale(a,c,d);return f};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d}; +THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,f=a.n13,j=a.n14,k=a.n21,q=a.n22,o=a.n23,l=a.n24,n=a.n31,z=a.n32,y=a.n33,v=a.n34,x=a.n41,F=a.n42,H=a.n43,I=a.n44,s=new THREE.Matrix4;s.n11=o*v*F-l*y*F+l*z*H-q*v*H-o*z*I+q*y*I;s.n12=j*y*F-f*v*F-j*z*H+d*v*H+f*z*I-d*y*I;s.n13=f*l*F-j*o*F+j*q*H-d*l*H-f*q*I+d*o*I;s.n14=j*o*z-f*l*z-j*q*y+d*l*y+f*q*v-d*o*v;s.n21=l*y*x-o*v*x-l*n*H+k*v*H+o*n*I-k*y*I;s.n22=f*v*x-j*y*x+j*n*H-c*v*H-f*n*I+c*y*I;s.n23=j*o*x-f*l*x-j*k*H+c*l*H+f*k*I-c*o*I;s.n24=f*l*n-j*o*n+ +j*k*y-c*l*y-f*k*v+c*o*v;s.n31=q*v*x-l*z*x+l*n*F-k*v*F-q*n*I+k*z*I;s.n32=j*z*x-d*v*x-j*n*F+c*v*F+d*n*I-c*z*I;s.n33=f*l*x-j*q*x+j*k*F-c*l*F-d*k*I+c*q*I;s.n34=j*q*n-d*l*n-j*k*z+c*l*z+d*k*v-c*q*v;s.n41=o*z*x-q*y*x-o*n*F+k*y*F+q*n*H-k*z*H;s.n42=d*y*x-f*z*x+f*n*F-c*y*F-d*n*H+c*z*H;s.n43=f*q*x-d*o*x-f*k*F+c*o*F+d*k*H-c*q*H;s.n44=d*o*n-f*q*n+f*k*z-c*o*z-d*k*y+c*q*y;s.multiplyScalar(1/a.determinant());return s}; +THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,d=c.m,f=a.n33*a.n22-a.n32*a.n23,j=-a.n33*a.n21+a.n31*a.n23,k=a.n32*a.n21-a.n31*a.n22,q=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,z=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*f+a.n21*q+a.n31*n;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*f;d[1]=a*j;d[2]=a*k;d[3]=a*q;d[4]=a*o;d[5]=a*l;d[6]=a*n;d[7]=a*z;d[8]=a*y;return c}; +THREE.Matrix4.makeFrustum=function(a,c,d,f,j,k){var q,o,l;q=new THREE.Matrix4;o=2*j/(c-a);l=2*j/(f-d);a=(c+a)/(c-a);d=(f+d)/(f-d);f=-(k+j)/(k-j);j=-2*k*j/(k-j);q.n11=o;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=l;q.n23=d;q.n24=0;q.n31=0;q.n32=0;q.n33=f;q.n34=j;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,c,d,f){var j;a=d*Math.tan(a*Math.PI/360);j=-a;return THREE.Matrix4.makeFrustum(j*c,a*c,j,a,d,f)}; +THREE.Matrix4.makeOrtho=function(a,c,d,f,j,k){var q,o,l,n;q=new THREE.Matrix4;o=c-a;l=d-f;n=k-j;a=(c+a)/o;d=(d+f)/l;j=(k+j)/n;q.n11=2/o;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/l;q.n23=0;q.n24=-d;q.n31=0;q.n32=0;q.n33=-2/n;q.n34=-j;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,c,e,f,k){this.a=a;this.b=c;this.c=e;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=k instanceof Array?k:[k]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,c,e,f,k,l){this.a=a;this.b=c;this.c=e;this.d=f;this.centroid=new THREE.Vector3;this.normal=k instanceof THREE.Vector3?k:new THREE.Vector3;this.vertexNormals=k instanceof Array?k:[];this.materials=l instanceof Array?l:[l]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; +THREE.Face3=function(a,c,d,f,j){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=j instanceof Array?j:[j]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; +THREE.Face4=function(a,c,d,f,j,k){this.a=a;this.b=c;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.materials=k instanceof Array?k:[k]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; -THREE.Geometry.prototype={computeCentroids:function(){var a,c,e;a=0;for(c=this.faces.length;a0){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 c=1,e=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z -this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,e=this.vertices.length;c65535){o[q].counter+=1;m=o[q].hash+"_"+o[q].counter;if(this.geometryChunks[m]==undefined)this.geometryChunks[m]={faces:[],materials:p,vertices:0}}this.geometryChunks[m].faces.push(f);this.geometryChunks[m].vertices+=l}},toString:function(){return"THREE.Geometry ( vertices: "+ +THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a0){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 c=1,d=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z +this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c65535){n[o].counter+=1;l=n[o].hash+"_"+n[o].counter;if(this.geometryChunks[l]==undefined)this.geometryChunks[l]={faces:[],materials:q,vertices:0}}this.geometryChunks[l].faces.push(f);this.geometryChunks[l].vertices+=k}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; -THREE.Camera=function(a,c,e,f){this.fov=a;this.aspect=c;this.near=e;this.far=f;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(k){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(k);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; -this.translateZ=function(k){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(k);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; +THREE.Camera=function(a,c,d,f){this.fov=a;this.aspect=c;this.near=d;this.far=f;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(j){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(j);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; +this.translateZ=function(j){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(j);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};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,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light; THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; -THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true}; -THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,e=this.scale,f=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){f.setRotY(c.y);this.rotationMatrix.multiplySelf(f)}if(c.z!=0){f.setRotZ(c.z);this.rotationMatrix.multiplySelf(f)}this.matrix.multiplySelf(this.rotationMatrix);if(e.x!=0||e.y!=0||e.z!=0){f.setScale(e.x,e.y,e.z);this.matrix.multiplySelf(f)}}};THREE.Object3DCounter={value:0}; -THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; -THREE.Line=function(a,c,e){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=e!=undefined?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()}; +THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true;this.children=[]}; +THREE.Object3D.prototype={addChild:function(a){this.children.indexOf(a)===-1&&this.children.push(a)},removeChild:function(a){a=this.children.indexOf(a);a!==-1&&this.children.splice(a,1)},updateMatrix:function(){var a=this.position,c=this.rotation,d=this.scale,f=this.matrix,j=this.rotationMatrix,k=this.tmpMatrix;f.setTranslation(a.x,a.y,a.z);j.setRotX(c.x);c.y!=0&&j.multiplySelf(k.setRotY(c.y));c.z!=0&&j.multiplySelf(k.setRotZ(c.z));f.multiplySelf(j);if(d.x!=0||d.y!=0||d.z!=0)f.multiplySelf(k.setScale(d.x, +d.y,d.z))}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; +THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()}; THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3; THREE.LineBasicMaterial=function(a){this.id=THREE.LineBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth= a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; @@ -96,115 +96,116 @@ THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderM THREE.ParticleBasicMaterial=function(a){this.id=THREE.ParticleBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.offset=new THREE.Vector2;this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending; if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
size: "+this.size+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.ParticleBasicMaterialCounter={value:0}; THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}}; -THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,e,f,k,l){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrap_t=f!==undefined?f:THREE.ClampToEdgeWrapping;this.mag_filter=k!==undefined?k:THREE.LinearFilter;this.min_filter=l!==undefined?l:THREE.LinearMipMapLinearFilter}; +THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,d,f,j,k){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=f!==undefined?f:THREE.ClampToEdgeWrapping;this.mag_filter=j!==undefined?j:THREE.LinearFilter;this.min_filter=k!==undefined?k:THREE.LinearMipMapLinearFilter}; THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;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.RenderTarget=function(a,c,e){this.width=a;this.height=c;e=e||{};this.wrap_s=e.wrap_s!==undefined?e.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=e.wrap_t!==undefined?e.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=e.mag_filter!==undefined?e.mag_filter:THREE.LinearFilter;this.min_filter=e.min_filter!==undefined?e.min_filter:THREE.LinearMipMapLinearFilter;this.format=e.format!==undefined?e.format:THREE.RGBFormat;this.type=e.type!==undefined?e.type:THREE.UnsignedByteType}; -var Uniforms={clone:function(a){var c,e,f,k={};for(c in a){k[c]={};for(e in a[c]){f=a[c][e];k[c][e]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return k},merge:function(a){var c,e,f,k={};for(c=0;c=0&&d>=0&&h>=0&&i>=0)return true;else if(U<0&&d<0||h<0&&i<0)return false;else{if(U<0)V=Math.max(V,U/(U-d));else if(d<0)M=Math.min(M,U/(U-d));if(h<0)V=Math.max(V,h/(h-i));else if(i<0)M=Math.min(M,h/(h-i));if(MU&&g.z0&&I.z<1){u=b[x]=b[x]||new THREE.RenderableParticle;u.x=I.x/I.w;u.y=I.y/I.w;u.z=I.z;u.rotation=r.rotation.z;u.scale.x=r.scale.x*Math.abs(u.x-(I.x+K.projectionMatrix.n11)/(I.w+K.projectionMatrix.n14)); -u.scale.y=r.scale.y*Math.abs(u.y-(I.y+K.projectionMatrix.n22)/(I.w+K.projectionMatrix.n24));u.materials=r.materials;M.push(u);x++}}}}V&&M.sort(a);return M};this.unprojectVector=function(P,K){var V=THREE.Matrix4.makeInvert(K.matrix);V.multiplySelf(THREE.Matrix4.makeInvert(K.projectionMatrix));V.multiplyVector3(P);return P}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,e,f,k,l;this.domElement=document.createElement("div");this.setSize=function(p,q){e=p;f=q;k=e/2;l=f/2};this.render=function(p,q){var m,o,C,B,u,x,b,H;a=c.projectScene(p,q);m=0;for(o=a.length;m0){G.r+=ia.r*ba;G.g+=ia.g*ba;G.b+=ia.b*ba}}else if(ba instanceof THREE.PointLight){W.sub(ba.position,X);W.normalize();ba=S.dot(W)* -ma;if(ba>0){G.r+=ia.r*ba;G.g+=ia.g*ba;G.b+=ia.b*ba}}}}function Fa(D,X,S){if(S.opacity!=0){a(S.opacity);c(S.blending);var G,Q,ba,ia,ma,oa;if(S instanceof THREE.ParticleBasicMaterial){if(S.map&&S.map.image.loaded){ia=S.map.image;ma=ia.width>>1;oa=ia.height>>1;Q=X.scale.x*q;ba=X.scale.y*m;S=Q*ma;G=ba*oa;A.set(D.x-S,D.y-G,D.x+S,D.y+G);if(L.instersects(A)){o.save();o.translate(D.x,D.y);o.rotate(-X.rotation);o.scale(Q,-ba);o.translate(-ma,-oa);o.drawImage(ia,0,0);o.restore()}}}else if(S instanceof THREE.ParticleCircleMaterial){if(N){T.r= -ca.r+ga.r+Z.r;T.g=ca.g+ga.g+Z.g;T.b=ca.b+ga.b+Z.b;M.r=S.color.r*T.r;M.g=S.color.g*T.g;M.b=S.color.b*T.b;M.updateStyleString()}else M.__styleString=S.color.__styleString;S=X.scale.x*q;G=X.scale.y*m;A.set(D.x-S,D.y-G,D.x+S,D.y+G);if(L.instersects(A)){Q=M.__styleString;if(H!=Q)o.fillStyle=H=Q;o.save();o.translate(D.x,D.y);o.rotate(-X.rotation);o.scale(S,G);o.beginPath();o.arc(0,0,1,0,ka,true);o.closePath();o.fill();o.restore()}}}}function Aa(D,X,S,G){if(G.opacity!=0){a(G.opacity);c(G.blending);o.beginPath(); -o.moveTo(D.positionScreen.x,D.positionScreen.y);o.lineTo(X.positionScreen.x,X.positionScreen.y);o.closePath();if(G instanceof THREE.LineBasicMaterial){M.__styleString=G.color.__styleString;D=G.linewidth;if(I!=D)o.lineWidth=I=D;D=M.__styleString;if(b!=D)o.strokeStyle=b=D;o.stroke();A.inflate(G.linewidth*2)}}}function Da(D,X,S,G,Q,ba){if(Q.opacity!=0){a(Q.opacity);c(Q.blending);J=D.positionScreen.x;O=D.positionScreen.y;Y=X.positionScreen.x;P=X.positionScreen.y;K=S.positionScreen.x;V=S.positionScreen.y; -o.beginPath();o.moveTo(J,O);o.lineTo(Y,P);o.lineTo(K,V);o.lineTo(J,O);o.closePath();if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.image.loaded&&Q.map.mapping instanceof THREE.UVMapping&&ja(J,O,Y,P,K,V,Q.map.image,G.uvs[0].u,G.uvs[0].v,G.uvs[1].u,G.uvs[1].v,G.uvs[2].u,G.uvs[2].v);else if(Q.env_map){if(Q.env_map.image.loaded)if(Q.env_map.mapping instanceof THREE.SphericalReflectionMapping){D=qa.matrix;W.copy(G.vertexNormalsWorld[0]);z=(W.x*D.n11+W.y*D.n12+W.z*D.n13)*0.5+0.5;r=-(W.x*D.n21+W.y* -D.n22+W.z*D.n23)*0.5+0.5;W.copy(G.vertexNormalsWorld[1]);t=(W.x*D.n11+W.y*D.n12+W.z*D.n13)*0.5+0.5;v=-(W.x*D.n21+W.y*D.n22+W.z*D.n23)*0.5+0.5;W.copy(G.vertexNormalsWorld[2]);w=(W.x*D.n11+W.y*D.n12+W.z*D.n13)*0.5+0.5;y=-(W.x*D.n21+W.y*D.n22+W.z*D.n23)*0.5+0.5;ja(J,O,Y,P,K,V,Q.env_map.image,z,r,t,v,w,y)}}else Q.wireframe?Ba(Q.color.__styleString,Q.wireframe_linewidth):Ca(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){Q.map.mapping instanceof THREE.UVMapping&& -ja(J,O,Y,P,K,V,Q.map.image,G.uvs[0].u,G.uvs[0].v,G.uvs[1].u,G.uvs[1].v,G.uvs[2].u,G.uvs[2].v);c(THREE.SubtractiveBlending)}if(N)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&G.vertexNormalsWorld.length==3){U.r=d.r=h.r=ca.r;U.g=d.g=h.g=ca.g;U.b=d.b=h.b=ca.b;za(ba,G.v1.positionWorld,G.vertexNormalsWorld[0],U);za(ba,G.v2.positionWorld,G.vertexNormalsWorld[1],d);za(ba,G.v3.positionWorld,G.vertexNormalsWorld[2],h);i.r=(d.r+h.r)*0.5;i.g=(d.g+h.g)*0.5;i.b=(d.b+h.b)*0.5;n=Ga(U,d,h,i);ja(J,O,Y,P,K,V,n, -0,0,1,0,0,1)}else{T.r=ca.r;T.g=ca.g;T.b=ca.b;za(ba,G.centroidWorld,G.normalWorld,T);M.r=Q.color.r*T.r;M.g=Q.color.g*T.g;M.b=Q.color.b*T.b;M.updateStyleString();Q.wireframe?Ba(M.__styleString,Q.wireframe_linewidth):Ca(M.__styleString)}else Q.wireframe?Ba(Q.color.__styleString,Q.wireframe_linewidth):Ca(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){j=qa.near;g=qa.far;U.r=U.g=U.b=1-Ha(D.positionScreen.z,j,g);d.r=d.g=d.b=1-Ha(X.positionScreen.z,j,g);h.r=h.g=h.b=1-Ha(S.positionScreen.z, -j,g);i.r=(d.r+h.r)*0.5;i.g=(d.g+h.g)*0.5;i.b=(d.b+h.b)*0.5;n=Ga(U,d,h,i);ja(J,O,Y,P,K,V,n,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){M.r=Ia(G.normalWorld.x);M.g=Ia(G.normalWorld.y);M.b=Ia(G.normalWorld.z);M.updateStyleString();Q.wireframe?Ba(M.__styleString,Q.wireframe_linewidth):Ca(M.__styleString)}}}function Ba(D,X){if(b!=D)o.strokeStyle=b=D;if(I!=X)o.lineWidth=I=X;o.stroke();A.inflate(X*2)}function Ca(D){if(H!=D)o.fillStyle=H=D;o.fill()}function ja(D,X,S,G,Q,ba,ia,ma,oa,wa,ra, -xa,Ja){var ta,ya;ta=ia.width-1;ya=ia.height-1;ma*=ta;oa*=ya;wa*=ta;ra*=ya;xa*=ta;Ja*=ya;S-=D;G-=X;Q-=D;ba-=X;wa-=ma;ra-=oa;xa-=ma;Ja-=oa;ta=wa*Ja-xa*ra;if(ta!=0){ya=1/ta;ta=(Ja*S-ra*Q)*ya;ra=(Ja*G-ra*ba)*ya;S=(wa*Q-xa*S)*ya;G=(wa*ba-xa*G)*ya;D=D-ta*ma-S*oa;X=X-ra*ma-G*oa;o.save();o.transform(ta,ra,S,G,D,X);o.clip();o.drawImage(ia,0,0);o.restore()}}function Ga(D,X,S,G){var Q=~~(D.r*255),ba=~~(D.g*255);D=~~(D.b*255);var ia=~~(X.r*255),ma=~~(X.g*255);X=~~(X.b*255);var oa=~~(S.r*255),wa=~~(S.g*255);S= -~~(S.b*255);var ra=~~(G.r*255),xa=~~(G.g*255);G=~~(G.b*255);ea[0]=Q<0?0:Q>255?255:Q;ea[1]=ba<0?0:ba>255?255:ba;ea[2]=D<0?0:D>255?255:D;ea[4]=ia<0?0:ia>255?255:ia;ea[5]=ma<0?0:ma>255?255:ma;ea[6]=X<0?0:X>255?255:X;ea[8]=oa<0?0:oa>255?255:oa;ea[9]=wa<0?0:wa>255?255:wa;ea[10]=S<0?0:S>255?255:S;ea[12]=ra<0?0:ra>255?255:ra;ea[13]=xa<0?0:xa>255?255:xa;ea[14]=G<0?0:G>255?255:G;sa.putImageData(va,0,0);fa.drawImage(da,0,0);return aa}function Ha(D,X,S){D=(D-X)/(S-X);return D*D*(3-2*D)}function Ia(D){D=(D+1)* -0.5;return D<0?0:D>1?1:D}function Ka(D,X){var S=X.x-D.x,G=X.y-D.y,Q=1/Math.sqrt(S*S+G*G);S*=Q;G*=Q;X.x+=S;X.y+=G;D.x-=S;D.y-=G}var pa,Na,ha,ua,Ea,Ma,Oa,La;this.autoClear?this.clear():o.setTransform(1,0,0,-1,q,m);e=f.projectScene($,qa,this.sortElements);(N=$.lights.length>0)&&na($);pa=0;for(Na=e.length;pa=0&&M>=0&&D>=0&&K>=0)return true;else if(U<0&&M<0||D<0&&K<0)return false;else{if(U<0)X=Math.max(X,U/(U-M));else if(M<0)G=Math.min(G,U/(U-M));if(D<0)X=Math.max(X,D/(D-K));else if(K<0)G=Math.min(G,D/(D-K));if(GU&&N.z0&&I.z<1){v=F[x]=F[x]||new THREE.RenderableParticle;v.x=I.x/I.w;v.y=I.y/I.w;v.z=I.z;v.rotation=i.rotation.z;v.scale.x=i.scale.x*Math.abs(v.x-(I.x+J.projectionMatrix.n11)/ +(I.w+J.projectionMatrix.n14));v.scale.y=i.scale.y*Math.abs(v.y-(I.y+J.projectionMatrix.n22)/(I.w+J.projectionMatrix.n24));v.materials=i.materials;G.push(v);x++}}}}X&&G.sort(a);return G};this.unprojectVector=function(Q,J){var X=THREE.Matrix4.makeInvert(J.matrix);X.multiplySelf(THREE.Matrix4.makeInvert(J.projectionMatrix));X.multiplyVector3(Q);return Q}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,f,j,k;this.domElement=document.createElement("div");this.setSize=function(q,o){d=q;f=o;j=d/2;k=f/2};this.render=function(q,o){var l,n,z,y,v,x,F,H;a=c.projectScene(q,o);l=0;for(n=a.length;l0){E.r+=ra.r*ha;E.g+=ra.g*ha;E.b+=ra.b*ha}}else if(ha instanceof THREE.PointLight){S.sub(ha.position,Z);S.normalize();ha=T.dot(S)* +xa;if(ha>0){E.r+=ra.r*ha;E.g+=ra.g*ha;E.b+=ra.b*ha}}}}function la(A,Z,T){if(T.opacity!=0){a(T.opacity);c(T.blending);var E,L,ha,ra,xa,za;if(T instanceof THREE.ParticleBasicMaterial){if(T.map&&T.map.image.loaded){ra=T.map.image;xa=ra.width>>1;za=ra.height>>1;L=Z.scale.x*o;ha=Z.scale.y*l;T=L*xa;E=ha*za;r.set(A.x-T,A.y-E,A.x+T,A.y+E);if(w.instersects(r)){n.save();n.translate(A.x,A.y);n.rotate(-Z.rotation);n.scale(L,-ha);n.translate(-xa,-za);n.drawImage(ra,0,0);n.restore()}}}else if(T instanceof THREE.ParticleCircleMaterial){if(p){B.r= +V.r+da.r+ea.r;B.g=V.g+da.g+ea.g;B.b=V.b+da.b+ea.b;G.r=T.color.r*B.r;G.g=T.color.g*B.g;G.b=T.color.b*B.b;G.updateStyleString()}else G.__styleString=T.color.__styleString;T=Z.scale.x*o;E=Z.scale.y*l;r.set(A.x-T,A.y-E,A.x+T,A.y+E);if(w.instersects(r)){L=G.__styleString;if(H!=L)n.fillStyle=H=L;n.save();n.translate(A.x,A.y);n.rotate(-Z.rotation);n.scale(T,E);n.beginPath();n.arc(0,0,1,0,ia,true);n.closePath();n.fill();n.restore()}}}}function na(A,Z,T,E){if(E.opacity!=0){a(E.opacity);c(E.blending);n.beginPath(); +n.moveTo(A.positionScreen.x,A.positionScreen.y);n.lineTo(Z.positionScreen.x,Z.positionScreen.y);n.closePath();if(E instanceof THREE.LineBasicMaterial){G.__styleString=E.color.__styleString;A=E.linewidth;if(I!=A)n.lineWidth=I=A;A=G.__styleString;if(F!=A)n.strokeStyle=F=A;n.stroke();r.inflate(E.linewidth*2)}}}function Ja(A,Z,T,E,L,ha){if(L.opacity!=0){a(L.opacity);c(L.blending);b=A.positionScreen.x;R=A.positionScreen.y;$=Z.positionScreen.x;Q=Z.positionScreen.y;J=T.positionScreen.x;X=T.positionScreen.y; +n.beginPath();n.moveTo(b,R);n.lineTo($,Q);n.lineTo(J,X);n.lineTo(b,R);n.closePath();if(L instanceof THREE.MeshBasicMaterial)if(L.map)L.map.image.loaded&&L.map.mapping instanceof THREE.UVMapping&&ga(b,R,$,Q,J,X,L.map.image,E.uvs[0].u,E.uvs[0].v,E.uvs[1].u,E.uvs[1].v,E.uvs[2].u,E.uvs[2].v);else if(L.env_map){if(L.env_map.image.loaded)if(L.env_map.mapping instanceof THREE.SphericalReflectionMapping){A=ba.matrix;S.copy(E.vertexNormalsWorld[0]);e=(S.x*A.n11+S.y*A.n12+S.z*A.n13)*0.5+0.5;i=-(S.x*A.n21+S.y* +A.n22+S.z*A.n23)*0.5+0.5;S.copy(E.vertexNormalsWorld[1]);m=(S.x*A.n11+S.y*A.n12+S.z*A.n13)*0.5+0.5;h=-(S.x*A.n21+S.y*A.n22+S.z*A.n23)*0.5+0.5;S.copy(E.vertexNormalsWorld[2]);g=(S.x*A.n11+S.y*A.n12+S.z*A.n13)*0.5+0.5;t=-(S.x*A.n21+S.y*A.n22+S.z*A.n23)*0.5+0.5;ga(b,R,$,Q,J,X,L.env_map.image,e,i,m,h,g,t)}}else L.wireframe?Da(L.color.__styleString,L.wireframe_linewidth):va(L.color.__styleString);else if(L instanceof THREE.MeshLambertMaterial){if(L.map&&!L.wireframe){L.map.mapping instanceof THREE.UVMapping&& +ga(b,R,$,Q,J,X,L.map.image,E.uvs[0].u,E.uvs[0].v,E.uvs[1].u,E.uvs[1].v,E.uvs[2].u,E.uvs[2].v);c(THREE.SubtractiveBlending)}if(p)if(!L.wireframe&&L.shading==THREE.SmoothShading&&E.vertexNormalsWorld.length==3){U.r=M.r=D.r=V.r;U.g=M.g=D.g=V.g;U.b=M.b=D.b=V.b;qa(ha,E.v1.positionWorld,E.vertexNormalsWorld[0],U);qa(ha,E.v2.positionWorld,E.vertexNormalsWorld[1],M);qa(ha,E.v3.positionWorld,E.vertexNormalsWorld[2],D);K.r=(M.r+D.r)*0.5;K.g=(M.g+D.g)*0.5;K.b=(M.b+D.b)*0.5;aa=ma(U,M,D,K);ga(b,R,$,Q,J,X,aa,0, +0,1,0,0,1)}else{B.r=V.r;B.g=V.g;B.b=V.b;qa(ha,E.centroidWorld,E.normalWorld,B);G.r=L.color.r*B.r;G.g=L.color.g*B.g;G.b=L.color.b*B.b;G.updateStyleString();L.wireframe?Da(G.__styleString,L.wireframe_linewidth):va(G.__styleString)}else L.wireframe?Da(L.color.__styleString,L.wireframe_linewidth):va(L.color.__styleString)}else if(L instanceof THREE.MeshDepthMaterial){ca=ba.near;N=ba.far;U.r=U.g=U.b=1-Aa(A.positionScreen.z,ca,N);M.r=M.g=M.b=1-Aa(Z.positionScreen.z,ca,N);D.r=D.g=D.b=1-Aa(T.positionScreen.z, +ca,N);K.r=(M.r+D.r)*0.5;K.g=(M.g+D.g)*0.5;K.b=(M.b+D.b)*0.5;aa=ma(U,M,D,K);ga(b,R,$,Q,J,X,aa,0,0,1,0,0,1)}else if(L instanceof THREE.MeshNormalMaterial){G.r=ta(E.normalWorld.x);G.g=ta(E.normalWorld.y);G.b=ta(E.normalWorld.z);G.updateStyleString();L.wireframe?Da(G.__styleString,L.wireframe_linewidth):va(G.__styleString)}}}function Da(A,Z){if(F!=A)n.strokeStyle=F=A;if(I!=Z)n.lineWidth=I=Z;n.stroke();r.inflate(Z*2)}function va(A){if(H!=A)n.fillStyle=H=A;n.fill()}function ga(A,Z,T,E,L,ha,ra,xa,za,Ga, +Ba,Ha,Oa){var Ea,Ia;Ea=ra.width-1;Ia=ra.height-1;xa*=Ea;za*=Ia;Ga*=Ea;Ba*=Ia;Ha*=Ea;Oa*=Ia;T-=A;E-=Z;L-=A;ha-=Z;Ga-=xa;Ba-=za;Ha-=xa;Oa-=za;Ea=Ga*Oa-Ha*Ba;if(Ea!=0){Ia=1/Ea;Ea=(Oa*T-Ba*L)*Ia;Ba=(Oa*E-Ba*ha)*Ia;T=(Ga*L-Ha*T)*Ia;E=(Ga*ha-Ha*E)*Ia;A=A-Ea*xa-T*za;Z=Z-Ba*xa-E*za;n.save();n.transform(Ea,Ba,T,E,A,Z);n.clip();n.drawImage(ra,0,0);n.restore()}}function ma(A,Z,T,E){var L=~~(A.r*255),ha=~~(A.g*255);A=~~(A.b*255);var ra=~~(Z.r*255),xa=~~(Z.g*255);Z=~~(Z.b*255);var za=~~(T.r*255),Ga=~~(T.g*255); +T=~~(T.b*255);var Ba=~~(E.r*255),Ha=~~(E.g*255);E=~~(E.b*255);ka[0]=L<0?0:L>255?255:L;ka[1]=ha<0?0:ha>255?255:ha;ka[2]=A<0?0:A>255?255:A;ka[4]=ra<0?0:ra>255?255:ra;ka[5]=xa<0?0:xa>255?255:xa;ka[6]=Z<0?0:Z>255?255:Z;ka[8]=za<0?0:za>255?255:za;ka[9]=Ga<0?0:Ga>255?255:Ga;ka[10]=T<0?0:T>255?255:T;ka[12]=Ba<0?0:Ba>255?255:Ba;ka[13]=Ha<0?0:Ha>255?255:Ha;ka[14]=E<0?0:E>255?255:E;pa.putImageData(P,0,0);wa.drawImage(Y,0,0);return oa}function Aa(A,Z,T){A=(A-Z)/(T-Z);return A*A*(3-2*A)}function ta(A){A=(A+1)* +0.5;return A<0?0:A>1?1:A}function La(A,Z){var T=Z.x-A.x,E=Z.y-A.y,L=1/Math.sqrt(T*T+E*E);T*=L;E*=L;Z.x+=T;Z.y+=E;A.x-=T;A.y-=E}var ua,Ma,ja,ya,Fa,Ka,Na,sa;this.autoClear?this.clear():n.setTransform(1,0,0,-1,o,l);d=f.projectScene(W,ba,this.sortElements);(p=W.lights.length>0)&&Ca(W);ua=0;for(Ma=d.length;ua0){t.r+=y.color.r*L;t.g+=y.color.g*L;t.b+=y.color.b*L}}else if(y instanceof THREE.PointLight){V.sub(y.position,r.centroidWorld);V.normalize();L=r.normalWorld.dot(V)*y.intensity;if(L>0){t.r+=y.color.r*L;t.g+=y.color.g*L;t.b+=y.color.b*L}}}}function c(z,r,t,v,w,y){h=f(i++);h.setAttribute("d","M "+z.positionScreen.x+ -" "+z.positionScreen.y+" L "+r.positionScreen.x+" "+r.positionScreen.y+" L "+t.positionScreen.x+","+t.positionScreen.y+"z");if(w instanceof THREE.MeshBasicMaterial)E.__styleString=w.color.__styleString;else if(w instanceof THREE.MeshLambertMaterial)if(R){J.r=O.r;J.g=O.g;J.b=O.b;a(y,v,J);E.r=w.color.r*J.r;E.g=w.color.g*J.g;E.b=w.color.b*J.b;E.updateStyleString()}else E.__styleString=w.color.__styleString;else if(w instanceof THREE.MeshDepthMaterial){K=1-w.__2near/(w.__farPlusNear-v.z*w.__farMinusNear); -E.setRGB(K,K,K)}else w instanceof THREE.MeshNormalMaterial&&E.setRGB(k(v.normalWorld.x),k(v.normalWorld.y),k(v.normalWorld.z));w.wireframe?h.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+w.wireframe_linewidth+"; stroke-opacity: "+w.opacity+"; stroke-linecap: "+w.wireframe_linecap+"; stroke-linejoin: "+w.wireframe_linejoin):h.setAttribute("style","fill: "+E.__styleString+"; fill-opacity: "+w.opacity);q.appendChild(h)}function e(z,r,t,v,w,y,L){h=f(i++);h.setAttribute("d", -"M "+z.positionScreen.x+" "+z.positionScreen.y+" L "+r.positionScreen.x+" "+r.positionScreen.y+" L "+t.positionScreen.x+","+t.positionScreen.y+" L "+v.positionScreen.x+","+v.positionScreen.y+"z");if(y instanceof THREE.MeshBasicMaterial)E.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshLambertMaterial)if(R){J.r=O.r;J.g=O.g;J.b=O.b;a(L,w,J);E.r=y.color.r*J.r;E.g=y.color.g*J.g;E.b=y.color.b*J.b;E.updateStyleString()}else E.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshDepthMaterial){K= -1-y.__2near/(y.__farPlusNear-w.z*y.__farMinusNear);E.setRGB(K,K,K)}else y instanceof THREE.MeshNormalMaterial&&E.setRGB(k(w.normalWorld.x),k(w.normalWorld.y),k(w.normalWorld.z));y.wireframe?h.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+y.wireframe_linewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframe_linecap+"; stroke-linejoin: "+y.wireframe_linejoin):h.setAttribute("style","fill: "+E.__styleString+"; fill-opacity: "+y.opacity);q.appendChild(h)} -function f(z){if(M[z]==null){M[z]=document.createElementNS("http://www.w3.org/2000/svg","path");n==0&&M[z].setAttribute("shape-rendering","crispEdges");return M[z]}return M[z]}function k(z){return z<0?Math.min((1+z)*0.5,0.5):0.5+Math.min(z*0.5,0.5)}var l=null,p=new THREE.Projector,q=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,o,C,B,u,x,b,H,I=new THREE.Rectangle,s=new THREE.Rectangle,R=false,E=new THREE.Color(16777215),J=new THREE.Color(16777215),O=new THREE.Color(0),Y=new THREE.Color(0), -P=new THREE.Color(0),K,V=new THREE.Vector3,M=[],U=[],d=[],h,i,j,g,n=1;this.domElement=q;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(z){switch(z){case "high":n=1;break;case "low":n=0}};this.setSize=function(z,r){m=z;o=r;C=m/2;B=o/2;q.setAttribute("viewBox",-C+" "+-B+" "+m+" "+o);q.setAttribute("width",m);q.setAttribute("height",o);I.set(-C,-B,C,B)};this.clear=function(){for(;q.childNodes.length>0;)q.removeChild(q.childNodes[0])};this.render=function(z,r){var t,v, -w,y,L,F,A,N;this.autoClear&&this.clear();l=p.projectScene(z,r,this.sortElements);g=j=i=0;if(R=z.lights.length>0){A=z.lights;O.setRGB(0,0,0);Y.setRGB(0,0,0);P.setRGB(0,0,0);t=0;for(v=A.length;t0){b.bindBuffer(b.ARRAY_BUFFER,d.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,sa,i)}if(Aa&&T>0){b.bindBuffer(b.ARRAY_BUFFER,d.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,va,i)}if(Fa){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,la,i);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,$,i)}};this.setLineBuffers=function(d,h){var i,j,g,n=d.vertices, -z=d.colors,r=n.length,t=z.length,v=d.__vertexArray,w=d.__colorArray,y=d.__dirtyColors;if(d.__dirtyVertices){for(i=0;i0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,n.map?"#define USE_MAP":"",n.env_map?"#define USE_ENVMAP":"",n.light_map?"#define USE_LIGHTMAP":"",n.vertex_colors?"#define USE_COLOR":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n"); -b.attachShader(i,B("fragment",g+t));b.attachShader(i,B("vertex",n+h));b.linkProgram(i);b.getProgramParameter(i,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(i,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");i.uniforms={};i.attributes={};d.program=i;i=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(j in d.uniforms)i.push(j);j=d.program;t=0;for(h=i.length;t=0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLColorBuffer);b.vertexAttribPointer(d.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.color)}if(d.normal>= -0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLNormalBuffer);b.vertexAttribPointer(d.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.normal)}if(d.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLTangentBuffer);b.vertexAttribPointer(d.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.tangent)}if(d.uv>=0)if(g.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUVBuffer);b.vertexAttribPointer(d.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.uv)}else b.disableVertexAttribArray(d.uv);if(d.uv2>= -0)if(g.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUV2Buffer);b.vertexAttribPointer(d.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.uv2)}else b.disableVertexAttribArray(d.uv2);if(n instanceof THREE.Mesh)if(j.wireframe){b.lineWidth(j.wireframe_linewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);b.drawElements(b.LINES,g.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,g.__webGLFaceCount,b.UNSIGNED_SHORT, -0)}else if(n instanceof THREE.Line){n=n.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(j.linewidth);b.drawArrays(n,0,g.__webGLLineCount)}else n instanceof THREE.ParticleSystem&&b.drawArrays(b.POINTS,0,g.__webGLParticleCount)};this.render=function(d,h,i,j){var g,n,z,r,t,v,w,y=d.lights,L=d.fog;h.autoUpdateMatrix&&h.updateMatrix();h.matrix.flattenToArray(P);h.projectionMatrix.flattenToArray(Y);O.multiply(h.projectionMatrix,h.matrix);k(O);this.initWebGLObjects(d,h);C(i,j!==undefined?j:true);this.autoClear&& -this.clear();r=d.__webGLObjects.length;for(j=0;j=0;i--){j=d.__webGLObjects[i].object;h==j&&d.__webGLObjects.splice(i,1)}};this.setupMatrices=function(d,h){d._modelViewMatrix.multiplyToArray(h.matrix,d.matrix,d._modelViewMatrixArray);d._normalMatrix=THREE.Matrix4.makeInvert3x3(d._modelViewMatrix).transposeIntoArray(d._normalMatrixArray)}; -this.setDepthTest=function(d){d?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST)};this.setFaceCulling=function(d,h){if(d){!h||h=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(d=="back")b.cullFace(b.BACK);else d=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; +THREE.SVGRenderer=function(){function a(e,i,m){var h,g,t,w;h=0;for(g=e.lights.length;h0){m.r+=t.color.r*w;m.g+=t.color.g*w;m.b+=t.color.b*w}}else if(t instanceof THREE.PointLight){X.sub(t.position,i.centroidWorld);X.normalize();w=i.normalWorld.dot(X)*t.intensity;if(w>0){m.r+=t.color.r*w;m.g+=t.color.g*w;m.b+=t.color.b*w}}}}function c(e,i,m,h,g,t){D=f(K++);D.setAttribute("d","M "+e.positionScreen.x+ +" "+e.positionScreen.y+" L "+i.positionScreen.x+" "+i.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");if(g instanceof THREE.MeshBasicMaterial)C.__styleString=g.color.__styleString;else if(g instanceof THREE.MeshLambertMaterial)if(O){b.r=R.r;b.g=R.g;b.b=R.b;a(t,h,b);C.r=g.color.r*b.r;C.g=g.color.g*b.g;C.b=g.color.b*b.b;C.updateStyleString()}else C.__styleString=g.color.__styleString;else if(g instanceof THREE.MeshDepthMaterial){J=1-g.__2near/(g.__farPlusNear-h.z*g.__farMinusNear); +C.setRGB(J,J,J)}else g instanceof THREE.MeshNormalMaterial&&C.setRGB(j(h.normalWorld.x),j(h.normalWorld.y),j(h.normalWorld.z));g.wireframe?D.setAttribute("style","fill: none; stroke: "+C.__styleString+"; stroke-width: "+g.wireframe_linewidth+"; stroke-opacity: "+g.opacity+"; stroke-linecap: "+g.wireframe_linecap+"; stroke-linejoin: "+g.wireframe_linejoin):D.setAttribute("style","fill: "+C.__styleString+"; fill-opacity: "+g.opacity);o.appendChild(D)}function d(e,i,m,h,g,t,w){D=f(K++);D.setAttribute("d", +"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+i.positionScreen.x+" "+i.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");if(t instanceof THREE.MeshBasicMaterial)C.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshLambertMaterial)if(O){b.r=R.r;b.g=R.g;b.b=R.b;a(w,g,b);C.r=t.color.r*b.r;C.g=t.color.g*b.g;C.b=t.color.b*b.b;C.updateStyleString()}else C.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshDepthMaterial){J= +1-t.__2near/(t.__farPlusNear-g.z*t.__farMinusNear);C.setRGB(J,J,J)}else t instanceof THREE.MeshNormalMaterial&&C.setRGB(j(g.normalWorld.x),j(g.normalWorld.y),j(g.normalWorld.z));t.wireframe?D.setAttribute("style","fill: none; stroke: "+C.__styleString+"; stroke-width: "+t.wireframe_linewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframe_linecap+"; stroke-linejoin: "+t.wireframe_linejoin):D.setAttribute("style","fill: "+C.__styleString+"; fill-opacity: "+t.opacity);o.appendChild(D)} +function f(e){if(G[e]==null){G[e]=document.createElementNS("http://www.w3.org/2000/svg","path");aa==0&&G[e].setAttribute("shape-rendering","crispEdges");return G[e]}return G[e]}function j(e){return e<0?Math.min((1+e)*0.5,0.5):0.5+Math.min(e*0.5,0.5)}var k=null,q=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,n,z,y,v,x,F,H,I=new THREE.Rectangle,s=new THREE.Rectangle,O=false,C=new THREE.Color(16777215),b=new THREE.Color(16777215),R=new THREE.Color(0),$=new THREE.Color(0), +Q=new THREE.Color(0),J,X=new THREE.Vector3,G=[],U=[],M=[],D,K,ca,N,aa=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(e){switch(e){case "high":aa=1;break;case "low":aa=0}};this.setSize=function(e,i){l=e;n=i;z=l/2;y=n/2;o.setAttribute("viewBox",-z+" "+-y+" "+l+" "+n);o.setAttribute("width",l);o.setAttribute("height",n);I.set(-z,-y,z,y)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(e,i){var m, +h,g,t,w,u,r,p;this.autoClear&&this.clear();k=q.projectScene(e,i,this.sortElements);N=ca=K=0;if(O=e.lights.length>0){r=e.lights;R.setRGB(0,0,0);$.setRGB(0,0,0);Q.setRGB(0,0,0);m=0;for(h=r.length;m0){b.bindBuffer(b.ARRAY_BUFFER,w.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Ja,V)}if(ya&&ea>0){b.bindBuffer(b.ARRAY_BUFFER,w.__webGLUV2Buffer); +b.bufferData(b.ARRAY_BUFFER,Da,V)}if(ja){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,w.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Aa,V);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,w.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ta,V)}}x(objlist,t,h,e,i,m)}g.__dirtyVertices=false;g.__dirtyElements=false;g.__dirtyUvs=false;g.__dirtyNormals=false;g.__dirtyTangents=false;g.__dirtyColors=false}else if(i instanceof THREE.Line){if(!g.__webGLVertexBuffer){g.__webGLVertexBuffer=b.createBuffer();g.__webGLColorBuffer= +b.createBuffer();h=g.vertices.length;g.__vertexArray=new Float32Array(h*3);g.__colorArray=new Float32Array(h*3);g.__webGLLineCount=h;g.__dirtyVertices=true;g.__dirtyColors=true}if(g.__dirtyVertices||g.__dirtyColors){h=b.DYNAMIC_DRAW;u=g.vertices;w=g.colors;B=u.length;V=w.length;ea=g.__vertexArray;da=g.__colorArray;ia=g.__dirtyColors;if(g.__dirtyVertices){for(r=0;r0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+t.maxDirLights,"#define MAX_POINT_LIGHTS "+ +t.maxPointLights,t.map?"#define USE_MAP":"",t.env_map?"#define USE_ENVMAP":"",t.light_map?"#define USE_LIGHTMAP":"",t.vertex_colors?"#define USE_COLOR":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(m,s("fragment",g+r));b.attachShader(m, +s("vertex",t+i));b.linkProgram(m);b.getProgramParameter(m,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(m,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");m.uniforms={};m.attributes={};e.program=m;m=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(h in e.uniforms)m.push(h);h=e.program;r=0;for(i=m.length;r=0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLColorBuffer);b.vertexAttribPointer(e.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.color)}if(e.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT, +false,0,0);b.enableVertexAttribArray(e.normal)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLTangentBuffer);b.vertexAttribPointer(e.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.tangent)}if(e.uv>=0)if(g.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUVBuffer);b.vertexAttribPointer(e.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.uv)}else b.disableVertexAttribArray(e.uv);if(e.uv2>=0)if(g.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUV2Buffer);b.vertexAttribPointer(e.uv2, +2,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(t instanceof THREE.Mesh)if(h.wireframe){b.lineWidth(h.wireframe_linewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);b.drawElements(b.LINES,g.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,g.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(t instanceof THREE.Line){t=t.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(h.linewidth); +b.drawArrays(t,0,g.__webGLLineCount)}else t instanceof THREE.ParticleSystem&&b.drawArrays(b.POINTS,0,g.__webGLParticleCount)};this.render=function(e,i,m,h){var g,t,w,u,r,p,B,V=e.lights,da=e.fog;i.autoUpdateMatrix&&i.updateMatrix();i.matrix.flattenToArray(D);i.projectionMatrix.flattenToArray(M);U.multiply(i.projectionMatrix,i.matrix);k(U);this.initWebGLObjects(e,i);I(m,h!==undefined?h:true);this.autoClear&&this.clear();u=e.__webGLObjects.length;for(h=0;h=0;m--){h=e.__webGLObjects[m].object;i==h&&e.__webGLObjects.splice(m,1)}};this.setDepthTest=function(e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST)}; +this.setFaceCulling=function(e,i){if(e){!i||i=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(e=="back")b.cullFace(b.BACK);else e=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; THREE.Snippets={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 env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\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 ), refraction_ratio );\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", diff --git a/build/ThreeDebug.js b/build/ThreeDebug.js index e1168069..4d7f1d14 100644 --- a/build/ThreeDebug.js +++ b/build/ThreeDebug.js @@ -1,70 +1,70 @@ // ThreeDebug.js r32 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)}; -THREE.Color.prototype={setRGB:function(a,c,e){this.r=a;this.g=c;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,e){var f,k,l,p,q,m;if(e==0)f=k=l=0;else{p=Math.floor(a*6);q=a*6-p;a=e*(1-c);m=e*(1-c*q);c=e*(1-c*(1-q));switch(p){case 1:f=m;k=e;l=a;break;case 2:f=a;k=e;l=c;break;case 3:f=a;k=m;l=e;break;case 4:f=c;k=a;l=e;break;case 5:f=e;k=a;l=m;break;case 6:case 0:f=e;k=c;l=a}}this.r=f;this.g=k;this.b=l;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, +THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var f,j,k,q,o,l;if(d==0)f=j=k=0;else{q=Math.floor(a*6);o=a*6-q;a=d*(1-c);l=d*(1-c*o);c=d*(1-c*(1-o));switch(q){case 1:f=l;j=d;k=a;break;case 2:f=a;j=d;k=c;break;case 3:f=a;j=l;k=d;break;case 4:f=c;j=a;k=d;break;case 5:f=d;j=a;k=l;break;case 6:case 0:f=d;j=c;k=a}}this.r=f;this.g=j;this.b=k;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+ this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0}; THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x* -this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,e){this.x=a||0;this.y=c||0;this.z=e||0}; -THREE.Vector3.prototype={set:function(a,c,e){this.x=a;this.y=c;this.z=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, -cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,e=this.y,f=this.z;this.x=e*a.z-f*a.y;this.y=f*a.x-c*a.z;this.z=c*a.y-e*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.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){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+e*e+a*a)},distanceToSquared:function(a){var c=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return c*c+e*e+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x= +this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,d){this.x=a||0;this.y=c||0;this.z=d||0}; +THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, +cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,f=this.z;this.x=d*a.z-f*a.y;this.y=f*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.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){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x= -this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}}; -THREE.Vector4=function(a,c,e,f){this.x=a||0;this.y=c||0;this.z=e||0;this.w=f||1}; -THREE.Vector4.prototype={set:function(a,c,e,f){this.x=a;this.y=c;this.z=e;this.w=f;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; +THREE.Vector4=function(a,c,d,f){this.x=a||0;this.y=c||0;this.z=d||0;this.w=f||1}; +THREE.Vector4.prototype={set:function(a,c,d,f){this.x=a;this.y=c;this.z=d;this.w=f;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.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){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var c,e,f=a.objects,k=[];a=0;for(c=f.length;a0&&I>0&&O+I<1}var e,f,k,l,p,q,m,n,C,B, -u,x=a.geometry,b=x.vertices,H=[];e=0;for(f=x.faces.length;em?f:m;k=k>n? -k:n}a()};this.add3Points=function(m,n,C,B,u,x){if(q){q=false;c=mC?m>u?m:u:C>u?C:u;k=n>B?n>x?n:x:B>x?B:x}else{c=mC?m>u?m>f?m:f:u>f?u:f:C>u?C>f?C:f:u>f?u:f;k=n>B?n>x?n>k?n:k:x>k?x:k:B>x?B>k?B:k:x>k?x:k}a()};this.addRectangle=function(m){if(q){q=false;c=m.getLeft();e=m.getTop();f=m.getRight();k=m.getBottom()}else{c=cm.getRight()?f:m.getRight();k=k>m.getBottom()?k:m.getBottom()}a()};this.inflate=function(m){c-=m;e-=m;f+=m;k+=m;a()};this.minSelf=function(m){c=c>m.getLeft()?c:m.getLeft();e=e>m.getTop()?e:m.getTop();f=f=0&&Math.min(k,m.getBottom())-Math.max(e,m.getTop())>=0};this.empty=function(){q=true;k=f=e=c=0;a()};this.isEmpty=function(){return q};this.toString= -function(){return"THREE.Rectangle ( left: "+c+", right: "+f+", top: "+e+", bottom: "+k+", width: "+l+", height: "+p+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}}; -THREE.Matrix4=function(a,c,e,f,k,l,p,q,m,n,C,B,u,x,b,H){this.n11=a||1;this.n12=c||0;this.n13=e||0;this.n14=f||0;this.n21=k||0;this.n22=l||1;this.n23=p||0;this.n24=q||0;this.n31=m||0;this.n32=n||0;this.n33=C||1;this.n34=B||0;this.n41=u||0;this.n42=x||0;this.n43=b||0;this.n44=H||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,e,f,k,l,p,q,m,n,C,B,u,x,b,H){this.n11=a;this.n12=c;this.n13=e;this.n14=f;this.n21=k;this.n22=l;this.n23=p;this.n24=q;this.n31=m;this.n32=n;this.n33=C;this.n34=B;this.n41=u;this.n42=x;this.n43=b;this.n44=H;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= -a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,e){var f=THREE.Matrix4.__tmpVec1,k=THREE.Matrix4.__tmpVec2,l=THREE.Matrix4.__tmpVec3;l.sub(a,c).normalize();f.cross(e,l).normalize();k.cross(l,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=k.x;this.n22=k.y;this.n23=k.z;this.n24=-k.dot(a); -this.n31=l.x;this.n32=l.y;this.n33=l.z;this.n34=-l.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,e=a.y,f=a.z,k=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);a.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*k;a.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*k;a.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*k;return a},multiplyVector4:function(a){var c=a.x,e=a.y,f=a.z,k=a.w;a.x=this.n11*c+this.n12*e+this.n13*f+this.n14*k;a.y=this.n21*c+this.n22*e+this.n23* -f+this.n24*k;a.z=this.n31*c+this.n32*e+this.n33*f+this.n34*k;a.w=this.n41*c+this.n42*e+this.n43*f+this.n44*k;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var e=a.n11,f=a.n12,k=a.n13,l=a.n14,p=a.n21,q=a.n22,m=a.n23,n=a.n24,C=a.n31, -B=a.n32,u=a.n33,x=a.n34,b=a.n41,H=a.n42,I=a.n43,s=a.n44,R=c.n11,F=c.n12,J=c.n13,O=c.n14,Y=c.n21,P=c.n22,L=c.n23,V=c.n24,M=c.n31,U=c.n32,d=c.n33,h=c.n34,i=c.n41,j=c.n42,g=c.n43,o=c.n44;this.n11=e*R+f*Y+k*M+l*i;this.n12=e*F+f*P+k*U+l*j;this.n13=e*J+f*L+k*d+l*g;this.n14=e*O+f*V+k*h+l*o;this.n21=p*R+q*Y+m*M+n*i;this.n22=p*F+q*P+m*U+n*j;this.n23=p*J+q*L+m*d+n*g;this.n24=p*O+q*V+m*h+n*o;this.n31=C*R+B*Y+u*M+x*i;this.n32=C*F+B*P+u*U+x*j;this.n33=C*J+B*L+u*d+x*g;this.n34=C*O+B*V+u*h+x*o;this.n41=b*R+H*Y+ -I*M+s*i;this.n42=b*F+H*P+I*U+s*j;this.n43=b*J+H*L+I*d+s*g;this.n44=b*O+H*V+I*h+s*o;return this},multiplyToArray:function(a,c,e){var f=a.n11,k=a.n12,l=a.n13,p=a.n14,q=a.n21,m=a.n22,n=a.n23,C=a.n24,B=a.n31,u=a.n32,x=a.n33,b=a.n34,H=a.n41,I=a.n42,s=a.n43;a=a.n44;var R=c.n11,F=c.n12,J=c.n13,O=c.n14,Y=c.n21,P=c.n22,L=c.n23,V=c.n24,M=c.n31,U=c.n32,d=c.n33,h=c.n34,i=c.n41,j=c.n42,g=c.n43;c=c.n44;this.n11=f*R+k*Y+l*M+p*i;this.n12=f*F+k*P+l*U+p*j;this.n13=f*J+k*L+l*d+p*g;this.n14=f*O+k*V+l*h+p*c;this.n21= -q*R+m*Y+n*M+C*i;this.n22=q*F+m*P+n*U+C*j;this.n23=q*J+m*L+n*d+C*g;this.n24=q*O+m*V+n*h+C*c;this.n31=B*R+u*Y+x*M+b*i;this.n32=B*F+u*P+x*U+b*j;this.n33=B*J+u*L+x*d+b*g;this.n34=B*O+u*V+x*h+b*c;this.n41=H*R+I*Y+s*M+a*i;this.n42=H*F+I*P+s*U+a*j;this.n43=H*J+I*L+s*d+a*g;this.n44=H*O+I*V+s*h+a*c;e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34; -e[15]=this.n44;return this},multiplySelf:function(a){var c=this.n11,e=this.n12,f=this.n13,k=this.n14,l=this.n21,p=this.n22,q=this.n23,m=this.n24,n=this.n31,C=this.n32,B=this.n33,u=this.n34,x=this.n41,b=this.n42,H=this.n43,I=this.n44,s=a.n11,R=a.n21,F=a.n31,J=a.n41,O=a.n12,Y=a.n22,P=a.n32,L=a.n42,V=a.n13,M=a.n23,U=a.n33,d=a.n43,h=a.n14,i=a.n24,j=a.n34;a=a.n44;this.n11=c*s+e*R+f*F+k*J;this.n12=c*O+e*Y+f*P+k*L;this.n13=c*V+e*M+f*U+k*d;this.n14=c*h+e*i+f*j+k*a;this.n21=l*s+p*R+q*F+m*J;this.n22=l*O+p* -Y+q*P+m*L;this.n23=l*V+p*M+q*U+m*d;this.n24=l*h+p*i+q*j+m*a;this.n31=n*s+C*R+B*F+u*J;this.n32=n*O+C*Y+B*P+u*L;this.n33=n*V+C*M+B*U+u*d;this.n34=n*h+C*i+B*j+u*a;this.n41=x*s+b*R+H*F+I*J;this.n42=x*O+b*Y+H*P+I*L;this.n43=x*V+b*M+H*U+I*d;this.n44=x*h+b*i+H*j+I*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,c=this.n12,e=this.n13,f=this.n14,k=this.n21,l=this.n22,p=this.n23,q=this.n24,m=this.n31,n=this.n32,C=this.n33,B=this.n34,u=this.n41,x=this.n42,b=this.n43,H=this.n44;return f*p*n*u-e*q*n*u-f*l*C*u+c*q*C*u+e*l*B*u-c*p*B*u-f*p*m*x+e*q*m*x+f*k*C*x-a*q*C*x-e*k*B*x+a*p*B*x+f*l*m*b-c*q*m*b-f*k*n*b+a*q*n*b+c*k*B*b-a*l*B*b-e*l*m*H+c*p*m*H+e*k*n*H-a*p*n*H-c*k*C*H+a*l*C*H},transpose:function(){function a(c,e,f){var k=c[e];c[e]=c[f];c[f]=k}a(this,"n21","n12");a(this,"n31", -"n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){var a=this.flat;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},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},setTranslation:function(a,c,e){this.set(1,0,0,a,0,1,0,c,0,0,1,e,0,0,0, -1);return this},setScale:function(a,c,e){this.set(a,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var e=Math.cos(c),f=Math.sin(c),k=1-e,l=a.x,p=a.y,q=a.z, -m=k*l,n=k*p;this.set(m*l+e,m*p-f*q,m*q+f*p,0,m*p+f*q,n*p+e,n*q-f*l,0,m*q-f*p,n*q+f*l,k*q*q+e,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,e){var f=new THREE.Matrix4;f.setTranslation(a,c,e);return f}; -THREE.Matrix4.scaleMatrix=function(a,c,e){var f=new THREE.Matrix4;f.setScale(a,c,e);return f};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var e=new THREE.Matrix4;e.setRotAxis(a,c);return e}; -THREE.Matrix4.makeInvert=function(a){var c=a.n11,e=a.n12,f=a.n13,k=a.n14,l=a.n21,p=a.n22,q=a.n23,m=a.n24,n=a.n31,C=a.n32,B=a.n33,u=a.n34,x=a.n41,b=a.n42,H=a.n43,I=a.n44,s=new THREE.Matrix4;s.n11=q*u*b-m*B*b+m*C*H-p*u*H-q*C*I+p*B*I;s.n12=k*B*b-f*u*b-k*C*H+e*u*H+f*C*I-e*B*I;s.n13=f*m*b-k*q*b+k*p*H-e*m*H-f*p*I+e*q*I;s.n14=k*q*C-f*m*C-k*p*B+e*m*B+f*p*u-e*q*u;s.n21=m*B*x-q*u*x-m*n*H+l*u*H+q*n*I-l*B*I;s.n22=f*u*x-k*B*x+k*n*H-c*u*H-f*n*I+c*B*I;s.n23=k*q*x-f*m*x-k*l*H+c*m*H+f*l*I-c*q*I;s.n24=f*m*n-k*q*n+ -k*l*B-c*m*B-f*l*u+c*q*u;s.n31=p*u*x-m*C*x+m*n*b-l*u*b-p*n*I+l*C*I;s.n32=k*C*x-e*u*x-k*n*b+c*u*b+e*n*I-c*C*I;s.n33=f*m*x-k*p*x+k*l*b-c*m*b-e*l*I+c*p*I;s.n34=k*p*n-e*m*n-k*l*C+c*m*C+e*l*u-c*p*u;s.n41=q*C*x-p*B*x-q*n*b+l*B*b+p*n*H-l*C*H;s.n42=e*B*x-f*C*x+f*n*b-c*B*b-e*n*H+c*C*H;s.n43=f*p*x-e*q*x-f*l*b+c*q*b+e*l*H-c*p*H;s.n44=e*q*n-f*p*n+f*l*C-c*q*C-e*l*B+c*p*B;s.multiplyScalar(1/a.determinant());return s}; -THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,e=c.m,f=a.n33*a.n22-a.n32*a.n23,k=-a.n33*a.n21+a.n31*a.n23,l=a.n32*a.n21-a.n31*a.n22,p=-a.n33*a.n12+a.n32*a.n13,q=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,C=-a.n23*a.n11+a.n21*a.n13,B=a.n22*a.n11-a.n21*a.n12;a=a.n11*f+a.n21*p+a.n31*n;if(a==0)throw"matrix not invertible";a=1/a;e[0]=a*f;e[1]=a*k;e[2]=a*l;e[3]=a*p;e[4]=a*q;e[5]=a*m;e[6]=a*n;e[7]=a*C;e[8]=a*B;return c}; -THREE.Matrix4.makeFrustum=function(a,c,e,f,k,l){var p,q,m;p=new THREE.Matrix4;q=2*k/(c-a);m=2*k/(f-e);a=(c+a)/(c-a);e=(f+e)/(f-e);f=-(l+k)/(l-k);k=-2*l*k/(l-k);p.n11=q;p.n12=0;p.n13=a;p.n14=0;p.n21=0;p.n22=m;p.n23=e;p.n24=0;p.n31=0;p.n32=0;p.n33=f;p.n34=k;p.n41=0;p.n42=0;p.n43=-1;p.n44=0;return p};THREE.Matrix4.makePerspective=function(a,c,e,f){var k;a=e*Math.tan(a*Math.PI/360);k=-a;return THREE.Matrix4.makeFrustum(k*c,a*c,k,a,e,f)}; -THREE.Matrix4.makeOrtho=function(a,c,e,f,k,l){var p,q,m,n;p=new THREE.Matrix4;q=c-a;m=e-f;n=l-k;a=(c+a)/q;e=(e+f)/m;k=(l+k)/n;p.n11=2/q;p.n12=0;p.n13=0;p.n14=-a;p.n21=0;p.n22=2/m;p.n23=0;p.n24=-e;p.n31=0;p.n32=0;p.n33=-2/n;p.n34=-k;p.n41=0;p.n42=0;p.n43=0;p.n44=1;return p};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Ray.prototype={intersectScene:function(a){var c,d,f=a.objects,j=[];a=0;for(c=f.length;a0&&I>0&&R+I<1}var d,f,j,k,q,o,l,m,z,y, +v,x=a.geometry,F=x.vertices,H=[];d=0;for(f=x.faces.length;dl?f:l;j=j>m? +j:m}a()};this.add3Points=function(l,m,z,y,v,x){if(o){o=false;c=lz?l>v?l:v:z>v?z:v;j=m>y?m>x?m:x:y>x?y:x}else{c=lz?l>v?l>f?l:f:v>f?v:f:z>v?z>f?z:f:v>f?v:f;j=m>y?m>x?m>j?m:j:x>j?x:j:y>x?y>j?y:j:x>j?x:j}a()};this.addRectangle=function(l){if(o){o=false;c=l.getLeft();d=l.getTop();f=l.getRight();j=l.getBottom()}else{c=cl.getRight()?f:l.getRight();j=j>l.getBottom()?j:l.getBottom()}a()};this.inflate=function(l){c-=l;d-=l;f+=l;j+=l;a()};this.minSelf=function(l){c=c>l.getLeft()?c:l.getLeft();d=d>l.getTop()?d:l.getTop();f=f=0&&Math.min(j,l.getBottom())-Math.max(d,l.getTop())>=0};this.empty=function(){o=true;j=f=d=c=0;a()};this.isEmpty=function(){return o};this.toString= +function(){return"THREE.Rectangle ( left: "+c+", right: "+f+", top: "+d+", bottom: "+j+", width: "+k+", height: "+q+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}}; +THREE.Matrix4=function(a,c,d,f,j,k,q,o,l,m,z,y,v,x,F,H){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=f||0;this.n21=j||0;this.n22=k||1;this.n23=q||0;this.n24=o||0;this.n31=l||0;this.n32=m||0;this.n33=z||1;this.n34=y||0;this.n41=v||0;this.n42=x||0;this.n43=F||0;this.n44=H||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,f,j,k,q,o,l,m,z,y,v,x,F,H){this.n11=a;this.n12=c;this.n13=d;this.n14=f;this.n21=j;this.n22=k;this.n23=q;this.n24=o;this.n31=l;this.n32=m;this.n33=z;this.n34=y;this.n41=v;this.n42=x;this.n43=F;this.n44=H;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var f=THREE.Matrix4.__tmpVec1,j=THREE.Matrix4.__tmpVec2,k=THREE.Matrix4.__tmpVec3;k.sub(a,c).normalize();f.cross(d,k).normalize();j.cross(k,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=j.x;this.n22=j.y;this.n23=j.z;this.n24=-j.dot(a); +this.n31=k.x;this.n32=k.y;this.n33=k.z;this.n34=-k.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,f=a.z,j=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*j;a.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*j;a.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*j;return a},multiplyVector4:function(a){var c=a.x,d=a.y,f=a.z,j=a.w;a.x=this.n11*c+this.n12*d+this.n13*f+this.n14*j;a.y=this.n21*c+this.n22*d+this.n23* +f+this.n24*j;a.z=this.n31*c+this.n32*d+this.n33*f+this.n34*j;a.w=this.n41*c+this.n42*d+this.n43*f+this.n44*j;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,f=a.n12,j=a.n13,k=a.n14,q=a.n21,o=a.n22,l=a.n23,m=a.n24,z=a.n31, +y=a.n32,v=a.n33,x=a.n34,F=a.n41,H=a.n42,I=a.n43,s=a.n44,O=c.n11,C=c.n12,b=c.n13,R=c.n14,$=c.n21,Q=c.n22,J=c.n23,X=c.n24,G=c.n31,U=c.n32,M=c.n33,D=c.n34,K=c.n41,ca=c.n42,N=c.n43,aa=c.n44;this.n11=d*O+f*$+j*G+k*K;this.n12=d*C+f*Q+j*U+k*ca;this.n13=d*b+f*J+j*M+k*N;this.n14=d*R+f*X+j*D+k*aa;this.n21=q*O+o*$+l*G+m*K;this.n22=q*C+o*Q+l*U+m*ca;this.n23=q*b+o*J+l*M+m*N;this.n24=q*R+o*X+l*D+m*aa;this.n31=z*O+y*$+v*G+x*K;this.n32=z*C+y*Q+v*U+x*ca;this.n33=z*b+y*J+v*M+x*N;this.n34=z*R+y*X+v*D+x*aa;this.n41= +F*O+H*$+I*G+s*K;this.n42=F*C+H*Q+I*U+s*ca;this.n43=F*b+H*J+I*M+s*N;this.n44=F*R+H*X+I*D+s*aa;return this},multiplyToArray:function(a,c,d){var f=a.n11,j=a.n12,k=a.n13,q=a.n14,o=a.n21,l=a.n22,m=a.n23,z=a.n24,y=a.n31,v=a.n32,x=a.n33,F=a.n34,H=a.n41,I=a.n42,s=a.n43;a=a.n44;var O=c.n11,C=c.n12,b=c.n13,R=c.n14,$=c.n21,Q=c.n22,J=c.n23,X=c.n24,G=c.n31,U=c.n32,M=c.n33,D=c.n34,K=c.n41,ca=c.n42,N=c.n43;c=c.n44;this.n11=f*O+j*$+k*G+q*K;this.n12=f*C+j*Q+k*U+q*ca;this.n13=f*b+j*J+k*M+q*N;this.n14=f*R+j*X+k*D+q* +c;this.n21=o*O+l*$+m*G+z*K;this.n22=o*C+l*Q+m*U+z*ca;this.n23=o*b+l*J+m*M+z*N;this.n24=o*R+l*X+m*D+z*c;this.n31=y*O+v*$+x*G+F*K;this.n32=y*C+v*Q+x*U+F*ca;this.n33=y*b+v*J+x*M+F*N;this.n34=y*R+v*X+x*D+F*c;this.n41=H*O+I*$+s*G+a*K;this.n42=H*C+I*Q+s*U+a*ca;this.n43=H*b+I*J+s*M+a*N;this.n44=H*R+I*X+s*D+a*c;d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24; +d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,f=this.n13,j=this.n14,k=this.n21,q=this.n22,o=this.n23,l=this.n24,m=this.n31,z=this.n32,y=this.n33,v=this.n34,x=this.n41,F=this.n42,H=this.n43,I=this.n44,s=a.n11,O=a.n21,C=a.n31,b=a.n41,R=a.n12,$=a.n22,Q=a.n32,J=a.n42,X=a.n13,G=a.n23,U=a.n33,M=a.n43,D=a.n14,K=a.n24,ca=a.n34;a=a.n44;this.n11=c*s+d*O+f*C+j*b;this.n12=c*R+d*$+f*Q+j*J;this.n13=c*X+d*G+f*U+j*M;this.n14=c*D+d*K+f*ca+j*a;this.n21=k*s+q*O+o*C+l* +b;this.n22=k*R+q*$+o*Q+l*J;this.n23=k*X+q*G+o*U+l*M;this.n24=k*D+q*K+o*ca+l*a;this.n31=m*s+z*O+y*C+v*b;this.n32=m*R+z*$+y*Q+v*J;this.n33=m*X+z*G+y*U+v*M;this.n34=m*D+z*K+y*ca+v*a;this.n41=x*s+F*O+H*C+I*b;this.n42=x*R+F*$+H*Q+I*J;this.n43=x*X+F*G+H*U+I*M;this.n44=x*D+F*K+H*ca+I*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,c=this.n12,d=this.n13,f=this.n14,j=this.n21,k=this.n22,q=this.n23,o=this.n24,l=this.n31,m=this.n32,z=this.n33,y=this.n34,v=this.n41,x=this.n42,F=this.n43,H=this.n44;return f*q*m*v-d*o*m*v-f*k*z*v+c*o*z*v+d*k*y*v-c*q*y*v-f*q*l*x+d*o*l*x+f*j*z*x-a*o*z*x-d*j*y*x+a*q*y*x+f*k*l*F-c*o*l*F-f*j*m*F+a*o*m*F+c*j*y*F-a*k*y*F-d*k*l*H+c*q*l*H+d*j*m*H-a*q*m*H-c*j*z*H+a*k*z*H},transpose:function(){function a(c,d,f){var j=c[d];c[d]=c[f];c[f]=j}a(this,"n21","n12"); +a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){var a=this.flat;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},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},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d, +0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),f=Math.sin(c),j=1-d,k=a.x,q=a.y, +o=a.z,l=j*k,m=j*q;this.set(l*k+d,l*q-f*o,l*o+f*q,0,l*q+f*o,m*q+d,m*o-f*k,0,l*o-f*q,m*o+f*k,j*o*o+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setTranslation(a,c,d);return f}; +THREE.Matrix4.scaleMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setScale(a,c,d);return f};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d}; +THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,f=a.n13,j=a.n14,k=a.n21,q=a.n22,o=a.n23,l=a.n24,m=a.n31,z=a.n32,y=a.n33,v=a.n34,x=a.n41,F=a.n42,H=a.n43,I=a.n44,s=new THREE.Matrix4;s.n11=o*v*F-l*y*F+l*z*H-q*v*H-o*z*I+q*y*I;s.n12=j*y*F-f*v*F-j*z*H+d*v*H+f*z*I-d*y*I;s.n13=f*l*F-j*o*F+j*q*H-d*l*H-f*q*I+d*o*I;s.n14=j*o*z-f*l*z-j*q*y+d*l*y+f*q*v-d*o*v;s.n21=l*y*x-o*v*x-l*m*H+k*v*H+o*m*I-k*y*I;s.n22=f*v*x-j*y*x+j*m*H-c*v*H-f*m*I+c*y*I;s.n23=j*o*x-f*l*x-j*k*H+c*l*H+f*k*I-c*o*I;s.n24=f*l*m-j*o*m+ +j*k*y-c*l*y-f*k*v+c*o*v;s.n31=q*v*x-l*z*x+l*m*F-k*v*F-q*m*I+k*z*I;s.n32=j*z*x-d*v*x-j*m*F+c*v*F+d*m*I-c*z*I;s.n33=f*l*x-j*q*x+j*k*F-c*l*F-d*k*I+c*q*I;s.n34=j*q*m-d*l*m-j*k*z+c*l*z+d*k*v-c*q*v;s.n41=o*z*x-q*y*x-o*m*F+k*y*F+q*m*H-k*z*H;s.n42=d*y*x-f*z*x+f*m*F-c*y*F-d*m*H+c*z*H;s.n43=f*q*x-d*o*x-f*k*F+c*o*F+d*k*H-c*q*H;s.n44=d*o*m-f*q*m+f*k*z-c*o*z-d*k*y+c*q*y;s.multiplyScalar(1/a.determinant());return s}; +THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,d=c.m,f=a.n33*a.n22-a.n32*a.n23,j=-a.n33*a.n21+a.n31*a.n23,k=a.n32*a.n21-a.n31*a.n22,q=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,z=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*f+a.n21*q+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*f;d[1]=a*j;d[2]=a*k;d[3]=a*q;d[4]=a*o;d[5]=a*l;d[6]=a*m;d[7]=a*z;d[8]=a*y;return c}; +THREE.Matrix4.makeFrustum=function(a,c,d,f,j,k){var q,o,l;q=new THREE.Matrix4;o=2*j/(c-a);l=2*j/(f-d);a=(c+a)/(c-a);d=(f+d)/(f-d);f=-(k+j)/(k-j);j=-2*k*j/(k-j);q.n11=o;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=l;q.n23=d;q.n24=0;q.n31=0;q.n32=0;q.n33=f;q.n34=j;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,c,d,f){var j;a=d*Math.tan(a*Math.PI/360);j=-a;return THREE.Matrix4.makeFrustum(j*c,a*c,j,a,d,f)}; +THREE.Matrix4.makeOrtho=function(a,c,d,f,j,k){var q,o,l,m;q=new THREE.Matrix4;o=c-a;l=d-f;m=k-j;a=(c+a)/o;d=(d+f)/l;j=(k+j)/m;q.n11=2/o;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/l;q.n23=0;q.n24=-d;q.n31=0;q.n32=0;q.n33=-2/m;q.n34=-j;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,c,e,f,k){this.a=a;this.b=c;this.c=e;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=k instanceof Array?k:[k]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,c,e,f,k,l){this.a=a;this.b=c;this.c=e;this.d=f;this.centroid=new THREE.Vector3;this.normal=k instanceof THREE.Vector3?k:new THREE.Vector3;this.vertexNormals=k instanceof Array?k:[];this.materials=l instanceof Array?l:[l]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; +THREE.Face3=function(a,c,d,f,j){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=j instanceof Array?j:[j]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; +THREE.Face4=function(a,c,d,f,j,k){this.a=a;this.b=c;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.materials=k instanceof Array?k:[k]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; -THREE.Geometry.prototype={computeCentroids:function(){var a,c,e;a=0;for(c=this.faces.length;a0){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 c=1,e=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z -this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,e=this.vertices.length;c65535){n[q].counter+=1;m=n[q].hash+"_"+n[q].counter;if(this.geometryChunks[m]==undefined)this.geometryChunks[m]={faces:[],materials:p,vertices:0}}this.geometryChunks[m].faces.push(f);this.geometryChunks[m].vertices+=l}},toString:function(){return"THREE.Geometry ( vertices: "+ +THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a0){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 c=1,d=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z +this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c65535){m[o].counter+=1;l=m[o].hash+"_"+m[o].counter;if(this.geometryChunks[l]==undefined)this.geometryChunks[l]={faces:[],materials:q,vertices:0}}this.geometryChunks[l].faces.push(f);this.geometryChunks[l].vertices+=k}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; -THREE.Camera=function(a,c,e,f){this.fov=a;this.aspect=c;this.near=e;this.far=f;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(k){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(k);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; -this.translateZ=function(k){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(k);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; +THREE.Camera=function(a,c,d,f){this.fov=a;this.aspect=c;this.near=d;this.far=f;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(j){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(j);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; +this.translateZ=function(j){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(j);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};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,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light; THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; -THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true}; -THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,e=this.scale,f=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){f.setRotY(c.y);this.rotationMatrix.multiplySelf(f)}if(c.z!=0){f.setRotZ(c.z);this.rotationMatrix.multiplySelf(f)}this.matrix.multiplySelf(this.rotationMatrix);if(e.x!=0||e.y!=0||e.z!=0){f.setScale(e.x,e.y,e.z);this.matrix.multiplySelf(f)}}};THREE.Object3DCounter={value:0}; -THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; -THREE.Line=function(a,c,e){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=e!=undefined?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()}; +THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true;this.children=[]}; +THREE.Object3D.prototype={addChild:function(a){this.children.indexOf(a)===-1&&this.children.push(a)},removeChild:function(a){a=this.children.indexOf(a);a!==-1&&this.children.splice(a,1)},updateMatrix:function(){var a=this.position,c=this.rotation,d=this.scale,f=this.matrix,j=this.rotationMatrix,k=this.tmpMatrix;f.setTranslation(a.x,a.y,a.z);j.setRotX(c.x);c.y!=0&&j.multiplySelf(k.setRotY(c.y));c.z!=0&&j.multiplySelf(k.setRotZ(c.z));f.multiplySelf(j);if(d.x!=0||d.y!=0||d.z!=0)f.multiplySelf(k.setScale(d.x, +d.y,d.z))}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; +THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()}; THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3; THREE.LineBasicMaterial=function(a){this.id=THREE.LineBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth= a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; @@ -96,115 +96,116 @@ THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderM THREE.ParticleBasicMaterial=function(a){this.id=THREE.ParticleBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.offset=new THREE.Vector2;this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending; if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
size: "+this.size+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.ParticleBasicMaterialCounter={value:0}; THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}}; -THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,e,f,k,l){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrap_t=f!==undefined?f:THREE.ClampToEdgeWrapping;this.mag_filter=k!==undefined?k:THREE.LinearFilter;this.min_filter=l!==undefined?l:THREE.LinearMipMapLinearFilter}; +THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,d,f,j,k){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=f!==undefined?f:THREE.ClampToEdgeWrapping;this.mag_filter=j!==undefined?j:THREE.LinearFilter;this.min_filter=k!==undefined?k:THREE.LinearMipMapLinearFilter}; THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;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.RenderTarget=function(a,c,e){this.width=a;this.height=c;e=e||{};this.wrap_s=e.wrap_s!==undefined?e.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=e.wrap_t!==undefined?e.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=e.mag_filter!==undefined?e.mag_filter:THREE.LinearFilter;this.min_filter=e.min_filter!==undefined?e.min_filter:THREE.LinearMipMapLinearFilter;this.format=e.format!==undefined?e.format:THREE.RGBFormat;this.type=e.type!==undefined?e.type:THREE.UnsignedByteType}; -var Uniforms={clone:function(a){var c,e,f,k={};for(c in a){k[c]={};for(e in a[c]){f=a[c][e];k[c][e]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return k},merge:function(a){var c,e,f,k={};for(c=0;c=0&&d>=0&&h>=0&&i>=0)return true;else if(U<0&&d<0||h<0&&i<0)return false;else{if(U<0)V=Math.max(V,U/(U-d));else if(d<0)M=Math.min(M,U/(U-d));if(h<0)V=Math.max(V,h/(h-i));else if(i<0)M=Math.min(M,h/(h-i));if(MU&&g.z0&&I.z<1){u=b[x]=b[x]||new THREE.RenderableParticle;u.x=I.x/I.w;u.y=I.y/I.w;u.z=I.z;u.rotation=r.rotation.z;u.scale.x=r.scale.x*Math.abs(u.x-(I.x+L.projectionMatrix.n11)/(I.w+L.projectionMatrix.n14)); -u.scale.y=r.scale.y*Math.abs(u.y-(I.y+L.projectionMatrix.n22)/(I.w+L.projectionMatrix.n24));u.materials=r.materials;M.push(u);x++}}}}V&&M.sort(a);return M};this.unprojectVector=function(P,L){var V=THREE.Matrix4.makeInvert(L.matrix);V.multiplySelf(THREE.Matrix4.makeInvert(L.projectionMatrix));V.multiplyVector3(P);return P}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,e,f,k,l;this.domElement=document.createElement("div");this.setSize=function(p,q){e=p;f=q;k=e/2;l=f/2};this.render=function(p,q){var m,n,C,B,u,x,b,H;a=c.projectScene(p,q);m=0;for(n=a.length;m0){G.r+=ia.r*ba;G.g+=ia.g*ba;G.b+=ia.b*ba}}else if(ba instanceof THREE.PointLight){W.sub(ba.position,X);W.normalize();ba=S.dot(W)* -ma;if(ba>0){G.r+=ia.r*ba;G.g+=ia.g*ba;G.b+=ia.b*ba}}}}function Fa(D,X,S){if(S.opacity!=0){a(S.opacity);c(S.blending);var G,Q,ba,ia,ma,oa;if(S instanceof THREE.ParticleBasicMaterial){if(S.map&&S.map.image.loaded){ia=S.map.image;ma=ia.width>>1;oa=ia.height>>1;Q=X.scale.x*q;ba=X.scale.y*m;S=Q*ma;G=ba*oa;A.set(D.x-S,D.y-G,D.x+S,D.y+G);if(!K.instersects(A))return;n.save();n.translate(D.x,D.y);n.rotate(-X.rotation);n.scale(Q,-ba);n.translate(-ma,-oa);n.drawImage(ia,0,0);n.restore()}n.beginPath();n.moveTo(D.x- -10,D.y);n.lineTo(D.x+10,D.y);n.moveTo(D.x,D.y-10);n.lineTo(D.x,D.y+10);n.closePath();n.strokeStyle="rgb(255,255,0)";n.stroke()}else if(S instanceof THREE.ParticleCircleMaterial){if(N){T.r=ca.r+ga.r+Z.r;T.g=ca.g+ga.g+Z.g;T.b=ca.b+ga.b+Z.b;M.r=S.color.r*T.r;M.g=S.color.g*T.g;M.b=S.color.b*T.b;M.updateStyleString()}else M.__styleString=S.color.__styleString;S=X.scale.x*q;G=X.scale.y*m;A.set(D.x-S,D.y-G,D.x+S,D.y+G);if(K.instersects(A)){Q=M.__styleString;if(H!=Q)n.fillStyle=H=Q;n.save();n.translate(D.x, -D.y);n.rotate(-X.rotation);n.scale(S,G);n.beginPath();n.arc(0,0,1,0,ka,true);n.closePath();n.fill();n.restore()}}}}function Aa(D,X,S,G){if(G.opacity!=0){a(G.opacity);c(G.blending);n.beginPath();n.moveTo(D.positionScreen.x,D.positionScreen.y);n.lineTo(X.positionScreen.x,X.positionScreen.y);n.closePath();if(G instanceof THREE.LineBasicMaterial){M.__styleString=G.color.__styleString;D=G.linewidth;if(I!=D)n.lineWidth=I=D;D=M.__styleString;if(b!=D)n.strokeStyle=b=D;n.stroke();A.inflate(G.linewidth*2)}}} -function Da(D,X,S,G,Q,ba){if(Q.opacity!=0){a(Q.opacity);c(Q.blending);J=D.positionScreen.x;O=D.positionScreen.y;Y=X.positionScreen.x;P=X.positionScreen.y;L=S.positionScreen.x;V=S.positionScreen.y;n.beginPath();n.moveTo(J,O);n.lineTo(Y,P);n.lineTo(L,V);n.lineTo(J,O);n.closePath();if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.image.loaded&&Q.map.mapping instanceof THREE.UVMapping&&ja(J,O,Y,P,L,V,Q.map.image,G.uvs[0].u,G.uvs[0].v,G.uvs[1].u,G.uvs[1].v,G.uvs[2].u,G.uvs[2].v);else if(Q.env_map){if(Q.env_map.image.loaded)if(Q.env_map.mapping instanceof -THREE.SphericalReflectionMapping){D=qa.matrix;W.copy(G.vertexNormalsWorld[0]);z=(W.x*D.n11+W.y*D.n12+W.z*D.n13)*0.5+0.5;r=-(W.x*D.n21+W.y*D.n22+W.z*D.n23)*0.5+0.5;W.copy(G.vertexNormalsWorld[1]);t=(W.x*D.n11+W.y*D.n12+W.z*D.n13)*0.5+0.5;v=-(W.x*D.n21+W.y*D.n22+W.z*D.n23)*0.5+0.5;W.copy(G.vertexNormalsWorld[2]);w=(W.x*D.n11+W.y*D.n12+W.z*D.n13)*0.5+0.5;y=-(W.x*D.n21+W.y*D.n22+W.z*D.n23)*0.5+0.5;ja(J,O,Y,P,L,V,Q.env_map.image,z,r,t,v,w,y)}}else Q.wireframe?Ba(Q.color.__styleString,Q.wireframe_linewidth): -Ca(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){Q.map.mapping instanceof THREE.UVMapping&&ja(J,O,Y,P,L,V,Q.map.image,G.uvs[0].u,G.uvs[0].v,G.uvs[1].u,G.uvs[1].v,G.uvs[2].u,G.uvs[2].v);c(THREE.SubtractiveBlending)}if(N)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&G.vertexNormalsWorld.length==3){U.r=d.r=h.r=ca.r;U.g=d.g=h.g=ca.g;U.b=d.b=h.b=ca.b;za(ba,G.v1.positionWorld,G.vertexNormalsWorld[0],U);za(ba,G.v2.positionWorld,G.vertexNormalsWorld[1], -d);za(ba,G.v3.positionWorld,G.vertexNormalsWorld[2],h);i.r=(d.r+h.r)*0.5;i.g=(d.g+h.g)*0.5;i.b=(d.b+h.b)*0.5;o=Ga(U,d,h,i);ja(J,O,Y,P,L,V,o,0,0,1,0,0,1)}else{T.r=ca.r;T.g=ca.g;T.b=ca.b;za(ba,G.centroidWorld,G.normalWorld,T);M.r=Q.color.r*T.r;M.g=Q.color.g*T.g;M.b=Q.color.b*T.b;M.updateStyleString();Q.wireframe?Ba(M.__styleString,Q.wireframe_linewidth):Ca(M.__styleString)}else Q.wireframe?Ba(Q.color.__styleString,Q.wireframe_linewidth):Ca(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){j= -qa.near;g=qa.far;U.r=U.g=U.b=1-Ha(D.positionScreen.z,j,g);d.r=d.g=d.b=1-Ha(X.positionScreen.z,j,g);h.r=h.g=h.b=1-Ha(S.positionScreen.z,j,g);i.r=(d.r+h.r)*0.5;i.g=(d.g+h.g)*0.5;i.b=(d.b+h.b)*0.5;o=Ga(U,d,h,i);ja(J,O,Y,P,L,V,o,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){M.r=Ia(G.normalWorld.x);M.g=Ia(G.normalWorld.y);M.b=Ia(G.normalWorld.z);M.updateStyleString();Q.wireframe?Ba(M.__styleString,Q.wireframe_linewidth):Ca(M.__styleString)}}}function Ba(D,X){if(b!=D)n.strokeStyle=b=D;if(I!= -X)n.lineWidth=I=X;n.stroke();A.inflate(X*2)}function Ca(D){if(H!=D)n.fillStyle=H=D;n.fill()}function ja(D,X,S,G,Q,ba,ia,ma,oa,wa,ra,xa,Ja){var ta,ya;ta=ia.width-1;ya=ia.height-1;ma*=ta;oa*=ya;wa*=ta;ra*=ya;xa*=ta;Ja*=ya;S-=D;G-=X;Q-=D;ba-=X;wa-=ma;ra-=oa;xa-=ma;Ja-=oa;ta=wa*Ja-xa*ra;if(ta!=0){ya=1/ta;ta=(Ja*S-ra*Q)*ya;ra=(Ja*G-ra*ba)*ya;S=(wa*Q-xa*S)*ya;G=(wa*ba-xa*G)*ya;D=D-ta*ma-S*oa;X=X-ra*ma-G*oa;n.save();n.transform(ta,ra,S,G,D,X);n.clip();n.drawImage(ia,0,0);n.restore()}}function Ga(D,X,S,G){var Q= -~~(D.r*255),ba=~~(D.g*255);D=~~(D.b*255);var ia=~~(X.r*255),ma=~~(X.g*255);X=~~(X.b*255);var oa=~~(S.r*255),wa=~~(S.g*255);S=~~(S.b*255);var ra=~~(G.r*255),xa=~~(G.g*255);G=~~(G.b*255);ea[0]=Q<0?0:Q>255?255:Q;ea[1]=ba<0?0:ba>255?255:ba;ea[2]=D<0?0:D>255?255:D;ea[4]=ia<0?0:ia>255?255:ia;ea[5]=ma<0?0:ma>255?255:ma;ea[6]=X<0?0:X>255?255:X;ea[8]=oa<0?0:oa>255?255:oa;ea[9]=wa<0?0:wa>255?255:wa;ea[10]=S<0?0:S>255?255:S;ea[12]=ra<0?0:ra>255?255:ra;ea[13]=xa<0?0:xa>255?255:xa;ea[14]=G<0?0:G>255?255:G;sa.putImageData(va, -0,0);fa.drawImage(da,0,0);return aa}function Ha(D,X,S){D=(D-X)/(S-X);return D*D*(3-2*D)}function Ia(D){D=(D+1)*0.5;return D<0?0:D>1?1:D}function Ka(D,X){var S=X.x-D.x,G=X.y-D.y,Q=1/Math.sqrt(S*S+G*G);S*=Q;G*=Q;X.x+=S;X.y+=G;D.x-=S;D.y-=G}var pa,Na,ha,ua,Ea,Ma,Oa,La;this.autoClear?this.clear():n.setTransform(1,0,0,-1,q,m);e=f.projectScene($,qa,this.sortElements);n.fillStyle="rgba( 0, 255, 255, 0.5 )";n.fillRect(K.getX(),K.getY(),K.getWidth(),K.getHeight());(N=$.lights.length>0)&&na($);pa=0;for(Na= -e.length;pa0){t.r+=y.color.r*K;t.g+=y.color.g*K;t.b+=y.color.b*K}}else if(y instanceof THREE.PointLight){V.sub(y.position,r.centroidWorld);V.normalize();K=r.normalWorld.dot(V)*y.intensity;if(K>0){t.r+=y.color.r*K;t.g+=y.color.g*K;t.b+=y.color.b*K}}}}function c(z,r,t,v,w,y){h=f(i++);h.setAttribute("d","M "+z.positionScreen.x+ -" "+z.positionScreen.y+" L "+r.positionScreen.x+" "+r.positionScreen.y+" L "+t.positionScreen.x+","+t.positionScreen.y+"z");if(w instanceof THREE.MeshBasicMaterial)F.__styleString=w.color.__styleString;else if(w instanceof THREE.MeshLambertMaterial)if(R){J.r=O.r;J.g=O.g;J.b=O.b;a(y,v,J);F.r=w.color.r*J.r;F.g=w.color.g*J.g;F.b=w.color.b*J.b;F.updateStyleString()}else F.__styleString=w.color.__styleString;else if(w instanceof THREE.MeshDepthMaterial){L=1-w.__2near/(w.__farPlusNear-v.z*w.__farMinusNear); -F.setRGB(L,L,L)}else w instanceof THREE.MeshNormalMaterial&&F.setRGB(k(v.normalWorld.x),k(v.normalWorld.y),k(v.normalWorld.z));w.wireframe?h.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+w.wireframe_linewidth+"; stroke-opacity: "+w.opacity+"; stroke-linecap: "+w.wireframe_linecap+"; stroke-linejoin: "+w.wireframe_linejoin):h.setAttribute("style","fill: "+F.__styleString+"; fill-opacity: "+w.opacity);q.appendChild(h)}function e(z,r,t,v,w,y,K){h=f(i++);h.setAttribute("d", -"M "+z.positionScreen.x+" "+z.positionScreen.y+" L "+r.positionScreen.x+" "+r.positionScreen.y+" L "+t.positionScreen.x+","+t.positionScreen.y+" L "+v.positionScreen.x+","+v.positionScreen.y+"z");if(y instanceof THREE.MeshBasicMaterial)F.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshLambertMaterial)if(R){J.r=O.r;J.g=O.g;J.b=O.b;a(K,w,J);F.r=y.color.r*J.r;F.g=y.color.g*J.g;F.b=y.color.b*J.b;F.updateStyleString()}else F.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshDepthMaterial){L= -1-y.__2near/(y.__farPlusNear-w.z*y.__farMinusNear);F.setRGB(L,L,L)}else y instanceof THREE.MeshNormalMaterial&&F.setRGB(k(w.normalWorld.x),k(w.normalWorld.y),k(w.normalWorld.z));y.wireframe?h.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+y.wireframe_linewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframe_linecap+"; stroke-linejoin: "+y.wireframe_linejoin):h.setAttribute("style","fill: "+F.__styleString+"; fill-opacity: "+y.opacity);q.appendChild(h)} -function f(z){if(M[z]==null){M[z]=document.createElementNS("http://www.w3.org/2000/svg","path");o==0&&M[z].setAttribute("shape-rendering","crispEdges");return M[z]}return M[z]}function k(z){return z<0?Math.min((1+z)*0.5,0.5):0.5+Math.min(z*0.5,0.5)}var l=null,p=new THREE.Projector,q=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,n,C,B,u,x,b,H,I=new THREE.Rectangle,s=new THREE.Rectangle,R=false,F=new THREE.Color(16777215),J=new THREE.Color(16777215),O=new THREE.Color(0),Y=new THREE.Color(0), -P=new THREE.Color(0),L,V=new THREE.Vector3,M=[],U=[],d=[],h,i,j,g,o=1;this.domElement=q;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(z){switch(z){case "high":o=1;break;case "low":o=0}};this.setSize=function(z,r){m=z;n=r;C=m/2;B=n/2;q.setAttribute("viewBox",-C+" "+-B+" "+m+" "+n);q.setAttribute("width",m);q.setAttribute("height",n);I.set(-C,-B,C,B)};this.clear=function(){for(;q.childNodes.length>0;)q.removeChild(q.childNodes[0])};this.render=function(z,r){var t,v, -w,y,K,E,A,N;this.autoClear&&this.clear();l=p.projectScene(z,r,this.sortElements);g=j=i=0;if(R=z.lights.length>0){A=z.lights;O.setRGB(0,0,0);Y.setRGB(0,0,0);P.setRGB(0,0,0);t=0;for(v=A.length;t0){b.bindBuffer(b.ARRAY_BUFFER,d.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,sa,i)}if(Aa&&T>0){b.bindBuffer(b.ARRAY_BUFFER,d.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,va,i)}if(Fa){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,la,i);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,$,i)}};this.setLineBuffers=function(d,h){var i,j,g,o=d.vertices, -z=d.colors,r=o.length,t=z.length,v=d.__vertexArray,w=d.__colorArray,y=d.__dirtyColors;if(d.__dirtyVertices){for(i=0;i0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+o.maxDirLights,"#define MAX_POINT_LIGHTS "+o.maxPointLights,o.map?"#define USE_MAP":"",o.env_map?"#define USE_ENVMAP":"",o.light_map?"#define USE_LIGHTMAP":"",o.vertex_colors?"#define USE_COLOR":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n"); -b.attachShader(i,B("fragment",g+t));b.attachShader(i,B("vertex",o+h));b.linkProgram(i);b.getProgramParameter(i,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(i,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");i.uniforms={};i.attributes={};d.program=i;i=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(j in d.uniforms)i.push(j);j=d.program;t=0;for(h=i.length;t=0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLColorBuffer);b.vertexAttribPointer(d.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.color)}if(d.normal>= -0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLNormalBuffer);b.vertexAttribPointer(d.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.normal)}if(d.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLTangentBuffer);b.vertexAttribPointer(d.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.tangent)}if(d.uv>=0)if(g.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUVBuffer);b.vertexAttribPointer(d.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.uv)}else b.disableVertexAttribArray(d.uv);if(d.uv2>= -0)if(g.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUV2Buffer);b.vertexAttribPointer(d.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.uv2)}else b.disableVertexAttribArray(d.uv2);if(o instanceof THREE.Mesh)if(j.wireframe){b.lineWidth(j.wireframe_linewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);b.drawElements(b.LINES,g.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,g.__webGLFaceCount,b.UNSIGNED_SHORT, -0)}else if(o instanceof THREE.Line){o=o.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(j.linewidth);b.drawArrays(o,0,g.__webGLLineCount)}else o instanceof THREE.ParticleSystem&&b.drawArrays(b.POINTS,0,g.__webGLParticleCount)};this.render=function(d,h,i,j){var g,o,z,r,t,v,w,y=d.lights,K=d.fog;h.autoUpdateMatrix&&h.updateMatrix();h.matrix.flattenToArray(P);h.projectionMatrix.flattenToArray(Y);O.multiply(h.projectionMatrix,h.matrix);k(O);this.initWebGLObjects(d,h);C(i,j!==undefined?j:true);this.autoClear&& -this.clear();r=d.__webGLObjects.length;for(j=0;j=0;i--){j=d.__webGLObjects[i].object;h==j&&d.__webGLObjects.splice(i,1)}};this.setupMatrices=function(d,h){d._modelViewMatrix.multiplyToArray(h.matrix,d.matrix,d._modelViewMatrixArray);d._normalMatrix=THREE.Matrix4.makeInvert3x3(d._modelViewMatrix).transposeIntoArray(d._normalMatrixArray)}; -this.setDepthTest=function(d){d?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST)};this.setFaceCulling=function(d,h){if(d){!h||h=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(d=="back")b.cullFace(b.BACK);else d=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; +THREE.Fog=function(a,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c||2.5E-4}; +THREE.Projector=function(){function a(Q,J){return J.z-Q.z}function c(Q,J){var X=0,G=1,U=Q.z+Q.w,M=J.z+J.w,D=-Q.z+Q.w,K=-J.z+J.w;if(U>=0&&M>=0&&D>=0&&K>=0)return true;else if(U<0&&M<0||D<0&&K<0)return false;else{if(U<0)X=Math.max(X,U/(U-M));else if(M<0)G=Math.min(G,U/(U-M));if(D<0)X=Math.max(X,D/(D-K));else if(K<0)G=Math.min(G,D/(D-K));if(GU&&N.z0&&I.z<1){v=F[x]=F[x]||new THREE.RenderableParticle;v.x=I.x/I.w;v.y=I.y/I.w;v.z=I.z;v.rotation=i.rotation.z;v.scale.x=i.scale.x*Math.abs(v.x-(I.x+J.projectionMatrix.n11)/ +(I.w+J.projectionMatrix.n14));v.scale.y=i.scale.y*Math.abs(v.y-(I.y+J.projectionMatrix.n22)/(I.w+J.projectionMatrix.n24));v.materials=i.materials;G.push(v);x++}}}}X&&G.sort(a);return G};this.unprojectVector=function(Q,J){var X=THREE.Matrix4.makeInvert(J.matrix);X.multiplySelf(THREE.Matrix4.makeInvert(J.projectionMatrix));X.multiplyVector3(Q);return Q}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,f,j,k;this.domElement=document.createElement("div");this.setSize=function(q,o){d=q;f=o;j=d/2;k=f/2};this.render=function(q,o){var l,m,z,y,v,x,F,H;a=c.projectScene(q,o);l=0;for(m=a.length;l0){E.r+=ra.r*ha;E.g+=ra.g*ha;E.b+=ra.b*ha}}else if(ha instanceof THREE.PointLight){S.sub(ha.position,Z);S.normalize();ha=T.dot(S)* +xa;if(ha>0){E.r+=ra.r*ha;E.g+=ra.g*ha;E.b+=ra.b*ha}}}}function la(A,Z,T){if(T.opacity!=0){a(T.opacity);c(T.blending);var E,L,ha,ra,xa,za;if(T instanceof THREE.ParticleBasicMaterial){if(T.map&&T.map.image.loaded){ra=T.map.image;xa=ra.width>>1;za=ra.height>>1;L=Z.scale.x*o;ha=Z.scale.y*l;T=L*xa;E=ha*za;r.set(A.x-T,A.y-E,A.x+T,A.y+E);if(!w.instersects(r))return;m.save();m.translate(A.x,A.y);m.rotate(-Z.rotation);m.scale(L,-ha);m.translate(-xa,-za);m.drawImage(ra,0,0);m.restore()}m.beginPath();m.moveTo(A.x- +10,A.y);m.lineTo(A.x+10,A.y);m.moveTo(A.x,A.y-10);m.lineTo(A.x,A.y+10);m.closePath();m.strokeStyle="rgb(255,255,0)";m.stroke()}else if(T instanceof THREE.ParticleCircleMaterial){if(p){B.r=V.r+da.r+ea.r;B.g=V.g+da.g+ea.g;B.b=V.b+da.b+ea.b;G.r=T.color.r*B.r;G.g=T.color.g*B.g;G.b=T.color.b*B.b;G.updateStyleString()}else G.__styleString=T.color.__styleString;T=Z.scale.x*o;E=Z.scale.y*l;r.set(A.x-T,A.y-E,A.x+T,A.y+E);if(w.instersects(r)){L=G.__styleString;if(H!=L)m.fillStyle=H=L;m.save();m.translate(A.x, +A.y);m.rotate(-Z.rotation);m.scale(T,E);m.beginPath();m.arc(0,0,1,0,ia,true);m.closePath();m.fill();m.restore()}}}}function na(A,Z,T,E){if(E.opacity!=0){a(E.opacity);c(E.blending);m.beginPath();m.moveTo(A.positionScreen.x,A.positionScreen.y);m.lineTo(Z.positionScreen.x,Z.positionScreen.y);m.closePath();if(E instanceof THREE.LineBasicMaterial){G.__styleString=E.color.__styleString;A=E.linewidth;if(I!=A)m.lineWidth=I=A;A=G.__styleString;if(F!=A)m.strokeStyle=F=A;m.stroke();r.inflate(E.linewidth*2)}}} +function Ja(A,Z,T,E,L,ha){if(L.opacity!=0){a(L.opacity);c(L.blending);b=A.positionScreen.x;R=A.positionScreen.y;$=Z.positionScreen.x;Q=Z.positionScreen.y;J=T.positionScreen.x;X=T.positionScreen.y;m.beginPath();m.moveTo(b,R);m.lineTo($,Q);m.lineTo(J,X);m.lineTo(b,R);m.closePath();if(L instanceof THREE.MeshBasicMaterial)if(L.map)L.map.image.loaded&&L.map.mapping instanceof THREE.UVMapping&&ga(b,R,$,Q,J,X,L.map.image,E.uvs[0].u,E.uvs[0].v,E.uvs[1].u,E.uvs[1].v,E.uvs[2].u,E.uvs[2].v);else if(L.env_map){if(L.env_map.image.loaded)if(L.env_map.mapping instanceof +THREE.SphericalReflectionMapping){A=ba.matrix;S.copy(E.vertexNormalsWorld[0]);e=(S.x*A.n11+S.y*A.n12+S.z*A.n13)*0.5+0.5;i=-(S.x*A.n21+S.y*A.n22+S.z*A.n23)*0.5+0.5;S.copy(E.vertexNormalsWorld[1]);n=(S.x*A.n11+S.y*A.n12+S.z*A.n13)*0.5+0.5;h=-(S.x*A.n21+S.y*A.n22+S.z*A.n23)*0.5+0.5;S.copy(E.vertexNormalsWorld[2]);g=(S.x*A.n11+S.y*A.n12+S.z*A.n13)*0.5+0.5;t=-(S.x*A.n21+S.y*A.n22+S.z*A.n23)*0.5+0.5;ga(b,R,$,Q,J,X,L.env_map.image,e,i,n,h,g,t)}}else L.wireframe?Da(L.color.__styleString,L.wireframe_linewidth): +va(L.color.__styleString);else if(L instanceof THREE.MeshLambertMaterial){if(L.map&&!L.wireframe){L.map.mapping instanceof THREE.UVMapping&&ga(b,R,$,Q,J,X,L.map.image,E.uvs[0].u,E.uvs[0].v,E.uvs[1].u,E.uvs[1].v,E.uvs[2].u,E.uvs[2].v);c(THREE.SubtractiveBlending)}if(p)if(!L.wireframe&&L.shading==THREE.SmoothShading&&E.vertexNormalsWorld.length==3){U.r=M.r=D.r=V.r;U.g=M.g=D.g=V.g;U.b=M.b=D.b=V.b;qa(ha,E.v1.positionWorld,E.vertexNormalsWorld[0],U);qa(ha,E.v2.positionWorld,E.vertexNormalsWorld[1],M); +qa(ha,E.v3.positionWorld,E.vertexNormalsWorld[2],D);K.r=(M.r+D.r)*0.5;K.g=(M.g+D.g)*0.5;K.b=(M.b+D.b)*0.5;aa=ma(U,M,D,K);ga(b,R,$,Q,J,X,aa,0,0,1,0,0,1)}else{B.r=V.r;B.g=V.g;B.b=V.b;qa(ha,E.centroidWorld,E.normalWorld,B);G.r=L.color.r*B.r;G.g=L.color.g*B.g;G.b=L.color.b*B.b;G.updateStyleString();L.wireframe?Da(G.__styleString,L.wireframe_linewidth):va(G.__styleString)}else L.wireframe?Da(L.color.__styleString,L.wireframe_linewidth):va(L.color.__styleString)}else if(L instanceof THREE.MeshDepthMaterial){ca= +ba.near;N=ba.far;U.r=U.g=U.b=1-Aa(A.positionScreen.z,ca,N);M.r=M.g=M.b=1-Aa(Z.positionScreen.z,ca,N);D.r=D.g=D.b=1-Aa(T.positionScreen.z,ca,N);K.r=(M.r+D.r)*0.5;K.g=(M.g+D.g)*0.5;K.b=(M.b+D.b)*0.5;aa=ma(U,M,D,K);ga(b,R,$,Q,J,X,aa,0,0,1,0,0,1)}else if(L instanceof THREE.MeshNormalMaterial){G.r=ta(E.normalWorld.x);G.g=ta(E.normalWorld.y);G.b=ta(E.normalWorld.z);G.updateStyleString();L.wireframe?Da(G.__styleString,L.wireframe_linewidth):va(G.__styleString)}}}function Da(A,Z){if(F!=A)m.strokeStyle=F= +A;if(I!=Z)m.lineWidth=I=Z;m.stroke();r.inflate(Z*2)}function va(A){if(H!=A)m.fillStyle=H=A;m.fill()}function ga(A,Z,T,E,L,ha,ra,xa,za,Ga,Ba,Ha,Oa){var Ea,Ia;Ea=ra.width-1;Ia=ra.height-1;xa*=Ea;za*=Ia;Ga*=Ea;Ba*=Ia;Ha*=Ea;Oa*=Ia;T-=A;E-=Z;L-=A;ha-=Z;Ga-=xa;Ba-=za;Ha-=xa;Oa-=za;Ea=Ga*Oa-Ha*Ba;if(Ea!=0){Ia=1/Ea;Ea=(Oa*T-Ba*L)*Ia;Ba=(Oa*E-Ba*ha)*Ia;T=(Ga*L-Ha*T)*Ia;E=(Ga*ha-Ha*E)*Ia;A=A-Ea*xa-T*za;Z=Z-Ba*xa-E*za;m.save();m.transform(Ea,Ba,T,E,A,Z);m.clip();m.drawImage(ra,0,0);m.restore()}}function ma(A, +Z,T,E){var L=~~(A.r*255),ha=~~(A.g*255);A=~~(A.b*255);var ra=~~(Z.r*255),xa=~~(Z.g*255);Z=~~(Z.b*255);var za=~~(T.r*255),Ga=~~(T.g*255);T=~~(T.b*255);var Ba=~~(E.r*255),Ha=~~(E.g*255);E=~~(E.b*255);ka[0]=L<0?0:L>255?255:L;ka[1]=ha<0?0:ha>255?255:ha;ka[2]=A<0?0:A>255?255:A;ka[4]=ra<0?0:ra>255?255:ra;ka[5]=xa<0?0:xa>255?255:xa;ka[6]=Z<0?0:Z>255?255:Z;ka[8]=za<0?0:za>255?255:za;ka[9]=Ga<0?0:Ga>255?255:Ga;ka[10]=T<0?0:T>255?255:T;ka[12]=Ba<0?0:Ba>255?255:Ba;ka[13]=Ha<0?0:Ha>255?255:Ha;ka[14]=E<0?0:E> +255?255:E;pa.putImageData(P,0,0);wa.drawImage(Y,0,0);return oa}function Aa(A,Z,T){A=(A-Z)/(T-Z);return A*A*(3-2*A)}function ta(A){A=(A+1)*0.5;return A<0?0:A>1?1:A}function La(A,Z){var T=Z.x-A.x,E=Z.y-A.y,L=1/Math.sqrt(T*T+E*E);T*=L;E*=L;Z.x+=T;Z.y+=E;A.x-=T;A.y-=E}var ua,Ma,ja,ya,Fa,Ka,Na,sa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,l);d=f.projectScene(W,ba,this.sortElements);m.fillStyle="rgba( 0, 255, 255, 0.5 )";m.fillRect(w.getX(),w.getY(),w.getWidth(),w.getHeight());(p=W.lights.length> +0)&&Ca(W);ua=0;for(Ma=d.length;ua0){n.r+=t.color.r*w;n.g+=t.color.g*w;n.b+=t.color.b*w}}else if(t instanceof THREE.PointLight){X.sub(t.position,i.centroidWorld);X.normalize();w=i.normalWorld.dot(X)*t.intensity;if(w>0){n.r+=t.color.r*w;n.g+=t.color.g*w;n.b+=t.color.b*w}}}}function c(e,i,n,h,g,t){D=f(K++);D.setAttribute("d","M "+e.positionScreen.x+ +" "+e.positionScreen.y+" L "+i.positionScreen.x+" "+i.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z");if(g instanceof THREE.MeshBasicMaterial)C.__styleString=g.color.__styleString;else if(g instanceof THREE.MeshLambertMaterial)if(O){b.r=R.r;b.g=R.g;b.b=R.b;a(t,h,b);C.r=g.color.r*b.r;C.g=g.color.g*b.g;C.b=g.color.b*b.b;C.updateStyleString()}else C.__styleString=g.color.__styleString;else if(g instanceof THREE.MeshDepthMaterial){J=1-g.__2near/(g.__farPlusNear-h.z*g.__farMinusNear); +C.setRGB(J,J,J)}else g instanceof THREE.MeshNormalMaterial&&C.setRGB(j(h.normalWorld.x),j(h.normalWorld.y),j(h.normalWorld.z));g.wireframe?D.setAttribute("style","fill: none; stroke: "+C.__styleString+"; stroke-width: "+g.wireframe_linewidth+"; stroke-opacity: "+g.opacity+"; stroke-linecap: "+g.wireframe_linecap+"; stroke-linejoin: "+g.wireframe_linejoin):D.setAttribute("style","fill: "+C.__styleString+"; fill-opacity: "+g.opacity);o.appendChild(D)}function d(e,i,n,h,g,t,w){D=f(K++);D.setAttribute("d", +"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+i.positionScreen.x+" "+i.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");if(t instanceof THREE.MeshBasicMaterial)C.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshLambertMaterial)if(O){b.r=R.r;b.g=R.g;b.b=R.b;a(w,g,b);C.r=t.color.r*b.r;C.g=t.color.g*b.g;C.b=t.color.b*b.b;C.updateStyleString()}else C.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshDepthMaterial){J= +1-t.__2near/(t.__farPlusNear-g.z*t.__farMinusNear);C.setRGB(J,J,J)}else t instanceof THREE.MeshNormalMaterial&&C.setRGB(j(g.normalWorld.x),j(g.normalWorld.y),j(g.normalWorld.z));t.wireframe?D.setAttribute("style","fill: none; stroke: "+C.__styleString+"; stroke-width: "+t.wireframe_linewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframe_linecap+"; stroke-linejoin: "+t.wireframe_linejoin):D.setAttribute("style","fill: "+C.__styleString+"; fill-opacity: "+t.opacity);o.appendChild(D)} +function f(e){if(G[e]==null){G[e]=document.createElementNS("http://www.w3.org/2000/svg","path");aa==0&&G[e].setAttribute("shape-rendering","crispEdges");return G[e]}return G[e]}function j(e){return e<0?Math.min((1+e)*0.5,0.5):0.5+Math.min(e*0.5,0.5)}var k=null,q=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,m,z,y,v,x,F,H,I=new THREE.Rectangle,s=new THREE.Rectangle,O=false,C=new THREE.Color(16777215),b=new THREE.Color(16777215),R=new THREE.Color(0),$=new THREE.Color(0), +Q=new THREE.Color(0),J,X=new THREE.Vector3,G=[],U=[],M=[],D,K,ca,N,aa=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(e){switch(e){case "high":aa=1;break;case "low":aa=0}};this.setSize=function(e,i){l=e;m=i;z=l/2;y=m/2;o.setAttribute("viewBox",-z+" "+-y+" "+l+" "+m);o.setAttribute("width",l);o.setAttribute("height",m);I.set(-z,-y,z,y)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(e,i){var n, +h,g,t,w,u,r,p;this.autoClear&&this.clear();k=q.projectScene(e,i,this.sortElements);N=ca=K=0;if(O=e.lights.length>0){r=e.lights;R.setRGB(0,0,0);$.setRGB(0,0,0);Q.setRGB(0,0,0);n=0;for(h=r.length;n0){b.bindBuffer(b.ARRAY_BUFFER,w.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Ja,V)}if(ya&&ea>0){b.bindBuffer(b.ARRAY_BUFFER,w.__webGLUV2Buffer); +b.bufferData(b.ARRAY_BUFFER,Da,V)}if(ja){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,w.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Aa,V);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,w.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ta,V)}}x(objlist,t,h,e,i,n)}g.__dirtyVertices=false;g.__dirtyElements=false;g.__dirtyUvs=false;g.__dirtyNormals=false;g.__dirtyTangents=false;g.__dirtyColors=false}else if(i instanceof THREE.Line){if(!g.__webGLVertexBuffer){g.__webGLVertexBuffer=b.createBuffer();g.__webGLColorBuffer= +b.createBuffer();h=g.vertices.length;g.__vertexArray=new Float32Array(h*3);g.__colorArray=new Float32Array(h*3);g.__webGLLineCount=h;g.__dirtyVertices=true;g.__dirtyColors=true}if(g.__dirtyVertices||g.__dirtyColors){h=b.DYNAMIC_DRAW;u=g.vertices;w=g.colors;B=u.length;V=w.length;ea=g.__vertexArray;da=g.__colorArray;ia=g.__dirtyColors;if(g.__dirtyVertices){for(r=0;r0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+t.maxDirLights,"#define MAX_POINT_LIGHTS "+ +t.maxPointLights,t.map?"#define USE_MAP":"",t.env_map?"#define USE_ENVMAP":"",t.light_map?"#define USE_LIGHTMAP":"",t.vertex_colors?"#define USE_COLOR":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(n,s("fragment",g+r));b.attachShader(n, +s("vertex",t+i));b.linkProgram(n);b.getProgramParameter(n,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(n,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");n.uniforms={};n.attributes={};e.program=n;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(h in e.uniforms)n.push(h);h=e.program;r=0;for(i=n.length;r=0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLColorBuffer);b.vertexAttribPointer(e.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.color)}if(e.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT, +false,0,0);b.enableVertexAttribArray(e.normal)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLTangentBuffer);b.vertexAttribPointer(e.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.tangent)}if(e.uv>=0)if(g.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUVBuffer);b.vertexAttribPointer(e.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.uv)}else b.disableVertexAttribArray(e.uv);if(e.uv2>=0)if(g.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUV2Buffer);b.vertexAttribPointer(e.uv2, +2,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(t instanceof THREE.Mesh)if(h.wireframe){b.lineWidth(h.wireframe_linewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);b.drawElements(b.LINES,g.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,g.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(t instanceof THREE.Line){t=t.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(h.linewidth); +b.drawArrays(t,0,g.__webGLLineCount)}else t instanceof THREE.ParticleSystem&&b.drawArrays(b.POINTS,0,g.__webGLParticleCount)};this.render=function(e,i,n,h){var g,t,w,u,r,p,B,V=e.lights,da=e.fog;i.autoUpdateMatrix&&i.updateMatrix();i.matrix.flattenToArray(D);i.projectionMatrix.flattenToArray(M);U.multiply(i.projectionMatrix,i.matrix);k(U);this.initWebGLObjects(e,i);I(n,h!==undefined?h:true);this.autoClear&&this.clear();u=e.__webGLObjects.length;for(h=0;h=0;n--){h=e.__webGLObjects[n].object;i==h&&e.__webGLObjects.splice(n,1)}};this.setDepthTest=function(e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST)}; +this.setFaceCulling=function(e,i){if(e){!i||i=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(e=="back")b.cullFace(b.BACK);else e=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; THREE.Snippets={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 env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\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 ), refraction_ratio );\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", diff --git a/build/ThreeExtras.js b/build/ThreeExtras.js index 3572695e..708d0856 100644 --- a/build/ThreeExtras.js +++ b/build/ThreeExtras.js @@ -1,6 +1,6 @@ // ThreeExtras.js r32 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)}; -THREE.Color.prototype={setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,h,f,j,l,k;if(c==0)e=h=f=0;else{j=Math.floor(a*6);l=a*6-j;a=c*(1-b);k=c*(1-b*l);b=c*(1-b*(1-l));switch(j){case 1:e=k;h=c;f=a;break;case 2:e=a;h=c;f=b;break;case 3:e=a;h=k;f=c;break;case 4:e=b;h=a;f=c;break;case 5:e=c;h=a;f=k;break;case 6:case 0:e=c;h=b;f=a}}this.r=e;this.g=h;this.b=f;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, +THREE.Color.prototype={setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,g,f,h,k,j;if(c==0)e=g=f=0;else{h=Math.floor(a*6);k=a*6-h;a=c*(1-b);j=c*(1-b*k);b=c*(1-b*(1-k));switch(h){case 1:e=j;g=c;f=a;break;case 2:e=a;g=c;f=b;break;case 3:e=a;g=j;f=c;break;case 4:e=b;g=a;f=c;break;case 5:e=c;g=a;f=j;break;case 6:case 0:e=c;g=b;f=a}}this.r=e;this.g=g;this.b=f;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+ this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0}; THREE.Vector2.prototype={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},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add: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},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x* @@ -13,57 +13,57 @@ THREE.Vector4=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e||1} THREE.Vector4.prototype={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||1;return this},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){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,h=[];a=0;for(b=e.length;a0&&E>0&&Q+E<1}var c,e,h,f,j,l,k,m,p,y, -t,o=a.geometry,d=o.vertices,A=[];c=0;for(e=o.faces.length;ck?e:k;h=h>m? -h:m}a()};this.add3Points=function(k,m,p,y,t,o){if(l){l=false;b=kp?k>t?k:t:p>t?p:t;h=m>y?m>o?m:o:y>o?y:o}else{b=kp?k>t?k>e?k:e:t>e?t:e:p>t?p>e?p:e:t>e?t:e;h=m>y?m>o?m>h?m:h:o>h?o:h:y>o?y>h?y:h:o>h?o:h}a()};this.addRectangle=function(k){if(l){l=false;b=k.getLeft();c=k.getTop();e=k.getRight();h=k.getBottom()}else{b=bk.getRight()?e:k.getRight();h=h>k.getBottom()?h:k.getBottom()}a()};this.inflate=function(k){b-=k;c-=k;e+=k;h+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();c=c>k.getTop()?c:k.getTop();e=e=0&&Math.min(h,k.getBottom())-Math.max(c,k.getTop())>=0};this.empty=function(){l=true;h=e=c=b=0;a()};this.isEmpty=function(){return l};this.toString= -function(){return"THREE.Rectangle ( left: "+b+", right: "+e+", top: "+c+", bottom: "+h+", width: "+f+", height: "+j+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={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,h,f,j,l,k,m,p,y,t,o,d,A){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=e||0;this.n21=h||0;this.n22=f||1;this.n23=j||0;this.n24=l||0;this.n31=k||0;this.n32=m||0;this.n33=p||1;this.n34=y||0;this.n41=t||0;this.n42=o||0;this.n43=d||0;this.n44=A||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,c,e,h,f,j,l,k,m,p,y,t,o,d,A){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=h;this.n22=f;this.n23=j;this.n24=l;this.n31=k;this.n32=m;this.n33=p;this.n34=y;this.n41=t;this.n42=o;this.n43=d;this.n44=A;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= -a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__tmpVec1,h=THREE.Matrix4.__tmpVec2,f=THREE.Matrix4.__tmpVec3;f.sub(a,b).normalize();e.cross(c,f).normalize();h.cross(f,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a); -this.n31=f.x;this.n32=f.y;this.n33=f.z;this.n34=-f.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,h=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)*h;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*h;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*h;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,h=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*h;a.y=this.n21*b+this.n22*c+this.n23* -e+this.n24*h;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*h;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*h;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,h=a.n13,f=a.n14,j=a.n21,l=a.n22,k=a.n23,m=a.n24,p=a.n31, -y=a.n32,t=a.n33,o=a.n34,d=a.n41,A=a.n42,E=a.n43,w=a.n44,F=b.n11,u=b.n12,I=b.n13,Q=b.n14,$=b.n21,N=b.n22,K=b.n23,W=b.n24,R=b.n31,X=b.n32,g=b.n33,n=b.n34,v=b.n41,x=b.n42,q=b.n43,z=b.n44;this.n11=c*F+e*$+h*R+f*v;this.n12=c*u+e*N+h*X+f*x;this.n13=c*I+e*K+h*g+f*q;this.n14=c*Q+e*W+h*n+f*z;this.n21=j*F+l*$+k*R+m*v;this.n22=j*u+l*N+k*X+m*x;this.n23=j*I+l*K+k*g+m*q;this.n24=j*Q+l*W+k*n+m*z;this.n31=p*F+y*$+t*R+o*v;this.n32=p*u+y*N+t*X+o*x;this.n33=p*I+y*K+t*g+o*q;this.n34=p*Q+y*W+t*n+o*z;this.n41=d*F+A*$+ -E*R+w*v;this.n42=d*u+A*N+E*X+w*x;this.n43=d*I+A*K+E*g+w*q;this.n44=d*Q+A*W+E*n+w*z;return this},multiplyToArray:function(a,b,c){var e=a.n11,h=a.n12,f=a.n13,j=a.n14,l=a.n21,k=a.n22,m=a.n23,p=a.n24,y=a.n31,t=a.n32,o=a.n33,d=a.n34,A=a.n41,E=a.n42,w=a.n43;a=a.n44;var F=b.n11,u=b.n12,I=b.n13,Q=b.n14,$=b.n21,N=b.n22,K=b.n23,W=b.n24,R=b.n31,X=b.n32,g=b.n33,n=b.n34,v=b.n41,x=b.n42,q=b.n43;b=b.n44;this.n11=e*F+h*$+f*R+j*v;this.n12=e*u+h*N+f*X+j*x;this.n13=e*I+h*K+f*g+j*q;this.n14=e*Q+h*W+f*n+j*b;this.n21= -l*F+k*$+m*R+p*v;this.n22=l*u+k*N+m*X+p*x;this.n23=l*I+k*K+m*g+p*q;this.n24=l*Q+k*W+m*n+p*b;this.n31=y*F+t*$+o*R+d*v;this.n32=y*u+t*N+o*X+d*x;this.n33=y*I+t*K+o*g+d*q;this.n34=y*Q+t*W+o*n+d*b;this.n41=A*F+E*$+w*R+a*v;this.n42=A*u+E*N+w*X+a*x;this.n43=A*I+E*K+w*g+a*q;this.n44=A*Q+E*W+w*n+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){var b=this.n11,c=this.n12,e=this.n13,h=this.n14,f=this.n21,j=this.n22,l=this.n23,k=this.n24,m=this.n31,p=this.n32,y=this.n33,t=this.n34,o=this.n41,d=this.n42,A=this.n43,E=this.n44,w=a.n11,F=a.n21,u=a.n31,I=a.n41,Q=a.n12,$=a.n22,N=a.n32,K=a.n42,W=a.n13,R=a.n23,X=a.n33,g=a.n43,n=a.n14,v=a.n24,x=a.n34;a=a.n44;this.n11=b*w+c*F+e*u+h*I;this.n12=b*Q+c*$+e*N+h*K;this.n13=b*W+c*R+e*X+h*g;this.n14=b*n+c*v+e*x+h*a;this.n21=f*w+j*F+l*u+k*I;this.n22=f*Q+j* -$+l*N+k*K;this.n23=f*W+j*R+l*X+k*g;this.n24=f*n+j*v+l*x+k*a;this.n31=m*w+p*F+y*u+t*I;this.n32=m*Q+p*$+y*N+t*K;this.n33=m*W+p*R+y*X+t*g;this.n34=m*n+p*v+y*x+t*a;this.n41=o*w+d*F+A*u+E*I;this.n42=o*Q+d*$+A*N+E*K;this.n43=o*W+d*R+A*X+E*g;this.n44=o*n+d*v+A*x+E*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,h=this.n21,f=this.n22,j=this.n23,l=this.n24,k=this.n31,m=this.n32,p=this.n33,y=this.n34,t=this.n41,o=this.n42,d=this.n43,A=this.n44;return e*j*m*t-c*l*m*t-e*f*p*t+b*l*p*t+c*f*y*t-b*j*y*t-e*j*k*o+c*l*k*o+e*h*p*o-a*l*p*o-c*h*y*o+a*j*y*o+e*f*k*d-b*l*k*d-e*h*m*d+a*l*m*d+b*h*y*d-a*f*y*d-c*f*k*A+b*j*k*A+c*h*m*A-a*j*m*A-b*h*p*A+a*f*p*A},transpose:function(){function a(b,c,e){var h=b[c];b[c]=b[e];b[e]=h}a(this,"n21","n12");a(this,"n31", -"n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){var a=this.flat;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},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},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},setRotX: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},setRotY: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},setRotZ: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},setRotAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),h=1-c,f=a.x,j=a.y,l=a.z, -k=h*f,m=h*j;this.set(k*f+c,k*j-e*l,k*l+e*j,0,k*j+e*l,m*j+c,m*l-e*f,0,k*l-e*j,m*l+e*f,h*l*l+c,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setTranslation(a,b,c);return e}; +THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,g=[];a=0;for(b=e.length;a0&&H>0&&P+H<1}var c,e,g,f,h,k,j,m,p,x, +t,q=a.geometry,y=q.vertices,z=[];c=0;for(e=q.faces.length;cj?e:j;g=g>m? +g:m}a()};this.add3Points=function(j,m,p,x,t,q){if(k){k=false;b=jp?j>t?j:t:p>t?p:t;g=m>x?m>q?m:q:x>q?x:q}else{b=jp?j>t?j>e?j:e:t>e?t:e:p>t?p>e?p:e:t>e?t:e;g=m>x?m>q?m>g?m:g:q>g?q:g:x>q?x>g?x:g:q>g?q:g}a()};this.addRectangle=function(j){if(k){k=false;b=j.getLeft();c=j.getTop();e=j.getRight();g=j.getBottom()}else{b=bj.getRight()?e:j.getRight();g=g>j.getBottom()?g:j.getBottom()}a()};this.inflate=function(j){b-=j;c-=j;e+=j;g+=j;a()};this.minSelf=function(j){b=b>j.getLeft()?b:j.getLeft();c=c>j.getTop()?c:j.getTop();e=e=0&&Math.min(g,j.getBottom())-Math.max(c,j.getTop())>=0};this.empty=function(){k=true;g=e=c=b=0;a()};this.isEmpty=function(){return k};this.toString= +function(){return"THREE.Rectangle ( left: "+b+", right: "+e+", top: "+c+", bottom: "+g+", width: "+f+", height: "+h+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={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,g,f,h,k,j,m,p,x,t,q,y,z){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=e||0;this.n21=g||0;this.n22=f||1;this.n23=h||0;this.n24=k||0;this.n31=j||0;this.n32=m||0;this.n33=p||1;this.n34=x||0;this.n41=t||0;this.n42=q||0;this.n43=y||0;this.n44=z||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,c,e,g,f,h,k,j,m,p,x,t,q,y,z){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=g;this.n22=f;this.n23=h;this.n24=k;this.n31=j;this.n32=m;this.n33=p;this.n34=x;this.n41=t;this.n42=q;this.n43=y;this.n44=z;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,f=THREE.Matrix4.__tmpVec3;f.sub(a,b).normalize();e.cross(c,f).normalize();g.cross(f,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a); +this.n31=f.x;this.n32=f.y;this.n33=f.z;this.n34=-f.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,g=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)*g;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*c+this.n23* +e+this.n24*g;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*g;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,g=a.n13,f=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,p=a.n31, +x=a.n32,t=a.n33,q=a.n34,y=a.n41,z=a.n42,H=a.n43,w=a.n44,E=b.n11,o=b.n12,d=b.n13,P=b.n14,aa=b.n21,N=b.n22,M=b.n23,U=b.n24,O=b.n31,Y=b.n32,W=b.n33,J=b.n34,X=b.n41,ha=b.n42,Z=b.n43,ea=b.n44;this.n11=c*E+e*aa+g*O+f*X;this.n12=c*o+e*N+g*Y+f*ha;this.n13=c*d+e*M+g*W+f*Z;this.n14=c*P+e*U+g*J+f*ea;this.n21=h*E+k*aa+j*O+m*X;this.n22=h*o+k*N+j*Y+m*ha;this.n23=h*d+k*M+j*W+m*Z;this.n24=h*P+k*U+j*J+m*ea;this.n31=p*E+x*aa+t*O+q*X;this.n32=p*o+x*N+t*Y+q*ha;this.n33=p*d+x*M+t*W+q*Z;this.n34=p*P+x*U+t*J+q*ea;this.n41= +y*E+z*aa+H*O+w*X;this.n42=y*o+z*N+H*Y+w*ha;this.n43=y*d+z*M+H*W+w*Z;this.n44=y*P+z*U+H*J+w*ea;return this},multiplyToArray:function(a,b,c){var e=a.n11,g=a.n12,f=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,p=a.n24,x=a.n31,t=a.n32,q=a.n33,y=a.n34,z=a.n41,H=a.n42,w=a.n43;a=a.n44;var E=b.n11,o=b.n12,d=b.n13,P=b.n14,aa=b.n21,N=b.n22,M=b.n23,U=b.n24,O=b.n31,Y=b.n32,W=b.n33,J=b.n34,X=b.n41,ha=b.n42,Z=b.n43;b=b.n44;this.n11=e*E+g*aa+f*O+h*X;this.n12=e*o+g*N+f*Y+h*ha;this.n13=e*d+g*M+f*W+h*Z;this.n14=e*P+g*U+f* +J+h*b;this.n21=k*E+j*aa+m*O+p*X;this.n22=k*o+j*N+m*Y+p*ha;this.n23=k*d+j*M+m*W+p*Z;this.n24=k*P+j*U+m*J+p*b;this.n31=x*E+t*aa+q*O+y*X;this.n32=x*o+t*N+q*Y+y*ha;this.n33=x*d+t*M+q*W+y*Z;this.n34=x*P+t*U+q*J+y*b;this.n41=z*E+H*aa+w*O+a*X;this.n42=z*o+H*N+w*Y+a*ha;this.n43=z*d+H*M+w*W+a*Z;this.n44=z*P+H*U+w*J+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){var b=this.n11,c=this.n12,e=this.n13,g=this.n14,f=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,p=this.n32,x=this.n33,t=this.n34,q=this.n41,y=this.n42,z=this.n43,H=this.n44,w=a.n11,E=a.n21,o=a.n31,d=a.n41,P=a.n12,aa=a.n22,N=a.n32,M=a.n42,U=a.n13,O=a.n23,Y=a.n33,W=a.n43,J=a.n14,X=a.n24,ha=a.n34;a=a.n44;this.n11=b*w+c*E+e*o+g*d;this.n12=b*P+c*aa+e*N+g*M;this.n13=b*U+c*O+e*Y+g*W;this.n14=b*J+c*X+e*ha+g*a;this.n21=f*w+ +h*E+k*o+j*d;this.n22=f*P+h*aa+k*N+j*M;this.n23=f*U+h*O+k*Y+j*W;this.n24=f*J+h*X+k*ha+j*a;this.n31=m*w+p*E+x*o+t*d;this.n32=m*P+p*aa+x*N+t*M;this.n33=m*U+p*O+x*Y+t*W;this.n34=m*J+p*X+x*ha+t*a;this.n41=q*w+y*E+z*o+H*d;this.n42=q*P+y*aa+z*N+H*M;this.n43=q*U+y*O+z*Y+H*W;this.n44=q*J+y*X+z*ha+H*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,g=this.n21,f=this.n22,h=this.n23,k=this.n24,j=this.n31,m=this.n32,p=this.n33,x=this.n34,t=this.n41,q=this.n42,y=this.n43,z=this.n44;return e*h*m*t-c*k*m*t-e*f*p*t+b*k*p*t+c*f*x*t-b*h*x*t-e*h*j*q+c*k*j*q+e*g*p*q-a*k*p*q-c*g*x*q+a*h*x*q+e*f*j*y-b*k*j*y-e*g*m*y+a*k*m*y+b*g*x*y-a*f*x*y-c*f*j*z+b*h*j*z+c*g*m*z-a*h*m*z-b*g*p*z+a*f*p*z},transpose:function(){function a(b,c,e){var g=b[c];b[c]=b[e];b[e]= +g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){var a=this.flat;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},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},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},setRotX: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},setRotY: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},setRotZ: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},setRotAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b), +g=1-c,f=a.x,h=a.y,k=a.z,j=g*f,m=g*h;this.set(j*f+c,j*h-e*k,j*k+e*h,0,j*h+e*k,m*h+c,m*k-e*f,0,j*k-e*h,m*k+e*f,g*k*k+c,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setTranslation(a,b,c);return e}; THREE.Matrix4.scaleMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setScale(a,b,c);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c}; -THREE.Matrix4.makeInvert=function(a){var b=a.n11,c=a.n12,e=a.n13,h=a.n14,f=a.n21,j=a.n22,l=a.n23,k=a.n24,m=a.n31,p=a.n32,y=a.n33,t=a.n34,o=a.n41,d=a.n42,A=a.n43,E=a.n44,w=new THREE.Matrix4;w.n11=l*t*d-k*y*d+k*p*A-j*t*A-l*p*E+j*y*E;w.n12=h*y*d-e*t*d-h*p*A+c*t*A+e*p*E-c*y*E;w.n13=e*k*d-h*l*d+h*j*A-c*k*A-e*j*E+c*l*E;w.n14=h*l*p-e*k*p-h*j*y+c*k*y+e*j*t-c*l*t;w.n21=k*y*o-l*t*o-k*m*A+f*t*A+l*m*E-f*y*E;w.n22=e*t*o-h*y*o+h*m*A-b*t*A-e*m*E+b*y*E;w.n23=h*l*o-e*k*o-h*f*A+b*k*A+e*f*E-b*l*E;w.n24=e*k*m-h*l*m+ -h*f*y-b*k*y-e*f*t+b*l*t;w.n31=j*t*o-k*p*o+k*m*d-f*t*d-j*m*E+f*p*E;w.n32=h*p*o-c*t*o-h*m*d+b*t*d+c*m*E-b*p*E;w.n33=e*k*o-h*j*o+h*f*d-b*k*d-c*f*E+b*j*E;w.n34=h*j*m-c*k*m-h*f*p+b*k*p+c*f*t-b*j*t;w.n41=l*p*o-j*y*o-l*m*d+f*y*d+j*m*A-f*p*A;w.n42=c*y*o-e*p*o+e*m*d-b*y*d-c*m*A+b*p*A;w.n43=e*j*o-c*l*o-e*f*d+b*l*d+c*f*A-b*j*A;w.n44=c*l*m-e*j*m+e*f*p-b*l*p-c*f*y+b*j*y;w.multiplyScalar(1/a.determinant());return w}; -THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,h=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,l=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,p=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*j+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*h;c[2]=a*f;c[3]=a*j;c[4]=a*l;c[5]=a*k;c[6]=a*m;c[7]=a*p;c[8]=a*y;return b}; -THREE.Matrix4.makeFrustum=function(a,b,c,e,h,f){var j,l,k;j=new THREE.Matrix4;l=2*h/(b-a);k=2*h/(e-c);a=(b+a)/(b-a);c=(e+c)/(e-c);e=-(f+h)/(f-h);h=-2*f*h/(f-h);j.n11=l;j.n12=0;j.n13=a;j.n14=0;j.n21=0;j.n22=k;j.n23=c;j.n24=0;j.n31=0;j.n32=0;j.n33=e;j.n34=h;j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,b,c,e){var h;a=c*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*b,a*b,h,a,c,e)}; -THREE.Matrix4.makeOrtho=function(a,b,c,e,h,f){var j,l,k,m;j=new THREE.Matrix4;l=b-a;k=c-e;m=f-h;a=(b+a)/l;c=(c+e)/k;h=(f+h)/m;j.n11=2/l;j.n12=0;j.n13=0;j.n14=-a;j.n21=0;j.n22=2/k;j.n23=0;j.n24=-c;j.n31=0;j.n32=0;j.n33=-2/m;j.n34=-h;j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Matrix4.makeInvert=function(a){var b=a.n11,c=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,k=a.n23,j=a.n24,m=a.n31,p=a.n32,x=a.n33,t=a.n34,q=a.n41,y=a.n42,z=a.n43,H=a.n44,w=new THREE.Matrix4;w.n11=k*t*y-j*x*y+j*p*z-h*t*z-k*p*H+h*x*H;w.n12=g*x*y-e*t*y-g*p*z+c*t*z+e*p*H-c*x*H;w.n13=e*j*y-g*k*y+g*h*z-c*j*z-e*h*H+c*k*H;w.n14=g*k*p-e*j*p-g*h*x+c*j*x+e*h*t-c*k*t;w.n21=j*x*q-k*t*q-j*m*z+f*t*z+k*m*H-f*x*H;w.n22=e*t*q-g*x*q+g*m*z-b*t*z-e*m*H+b*x*H;w.n23=g*k*q-e*j*q-g*f*z+b*j*z+e*f*H-b*k*H;w.n24=e*j*m-g*k*m+ +g*f*x-b*j*x-e*f*t+b*k*t;w.n31=h*t*q-j*p*q+j*m*y-f*t*y-h*m*H+f*p*H;w.n32=g*p*q-c*t*q-g*m*y+b*t*y+c*m*H-b*p*H;w.n33=e*j*q-g*h*q+g*f*y-b*j*y-c*f*H+b*h*H;w.n34=g*h*m-c*j*m-g*f*p+b*j*p+c*f*t-b*h*t;w.n41=k*p*q-h*x*q-k*m*y+f*x*y+h*m*z-f*p*z;w.n42=c*x*q-e*p*q+e*m*y-b*x*y-c*m*z+b*p*z;w.n43=e*h*q-c*k*q-e*f*y+b*k*y+c*f*z-b*h*z;w.n44=c*k*m-e*h*m+e*f*p-b*k*p-c*f*x+b*h*x;w.multiplyScalar(1/a.determinant());return w}; +THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,p=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*g;c[2]=a*f;c[3]=a*h;c[4]=a*k;c[5]=a*j;c[6]=a*m;c[7]=a*p;c[8]=a*x;return b}; +THREE.Matrix4.makeFrustum=function(a,b,c,e,g,f){var h,k,j;h=new THREE.Matrix4;k=2*g/(b-a);j=2*g/(e-c);a=(b+a)/(b-a);c=(e+c)/(e-c);e=-(f+g)/(f-g);g=-2*f*g/(f-g);h.n11=k;h.n12=0;h.n13=a;h.n14=0;h.n21=0;h.n22=j;h.n23=c;h.n24=0;h.n31=0;h.n32=0;h.n33=e;h.n34=g;h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,e){var g;a=c*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,c,e)}; +THREE.Matrix4.makeOrtho=function(a,b,c,e,g,f){var h,k,j,m;h=new THREE.Matrix4;k=b-a;j=c-e;m=f-g;a=(b+a)/k;c=(c+e)/j;g=(f+g)/m;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-a;h.n21=0;h.n22=2/j;h.n23=0;h.n24=-c;h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-g;h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,b,c,e,h){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=h instanceof Array?h:[h]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,b,c,e,h,f){this.a=a;this.b=b;this.c=c;this.d=e;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=f instanceof Array?f:[f]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; +THREE.Face3=function(a,b,c,e,g){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; +THREE.Face4=function(a,b,c,e,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=f instanceof Array?f:[f]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], +b;a++){c=this.faces[a];if(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])}else if(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(J,X,ha,Z,ea,l,v){f=J.vertices[X].position;h=J.vertices[ha].position;k=J.vertices[Z].position;j=g[ea];m=g[l];p=g[v];x=h.x-f.x;t=k.x-f.x;q=h.y-f.y;y=k.y- +f.y;z=h.z-f.z;H=k.z-f.z;w=m.u-j.u;E=p.u-j.u;o=m.v-j.v;d=p.v-j.v;P=1/(w*d-E*o);M.set((d*x-o*t)*P,(d*q-o*y)*P,(d*z-o*H)*P);U.set((w*t-E*x)*P,(w*y-E*q)*P,(w*H-E*z)*P);aa[X].addSelf(M);aa[ha].addSelf(M);aa[Z].addSelf(M);N[X].addSelf(U);N[ha].addSelf(U);N[Z].addSelf(U)}var b,c,e,g,f,h,k,j,m,p,x,t,q,y,z,H,w,E,o,d,P,aa=[],N=[],M=new THREE.Vector3,U=new THREE.Vector3,O=new THREE.Vector3,Y=new THREE.Vector3,W=new THREE.Vector3;b=0;for(c=this.vertices.length;b0){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;bthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z -this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b65535){m[l].counter+=1;k=m[l].hash+"_"+m[l].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:j,vertices:0}}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=f}},toString:function(){return"THREE.Geometry ( vertices: "+ +this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b65535){m[k].counter+=1;j=m[k].hash+"_"+m[k].counter;if(this.geometryChunks[j]==undefined)this.geometryChunks[j]={faces:[],materials:h,vertices:0}}this.geometryChunks[j].faces.push(e);this.geometryChunks[j].vertices+=f}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; -THREE.Camera=function(a,b,c,e){this.fov=a;this.aspect=b;this.near=c;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; -this.translateZ=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; +THREE.Camera=function(a,b,c,e){this.fov=a;this.aspect=b;this.near=c;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; +this.translateZ=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};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){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light; THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; -THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true}; -THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,b=this.rotation,c=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(b.x);if(b.y!=0){e.setRotY(b.y);this.rotationMatrix.multiplySelf(e)}if(b.z!=0){e.setRotZ(b.z);this.rotationMatrix.multiplySelf(e)}this.matrix.multiplySelf(this.rotationMatrix);if(c.x!=0||c.y!=0||c.z!=0){e.setScale(c.x,c.y,c.z);this.matrix.multiplySelf(e)}}};THREE.Object3DCounter={value:0}; -THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};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.materials=b instanceof Array?b:[b];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; +THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true;this.children=[]}; +THREE.Object3D.prototype={addChild:function(a){this.children.indexOf(a)===-1&&this.children.push(a)},removeChild:function(a){a=this.children.indexOf(a);a!==-1&&this.children.splice(a,1)},updateMatrix:function(){var a=this.position,b=this.rotation,c=this.scale,e=this.matrix,g=this.rotationMatrix,f=this.tmpMatrix;e.setTranslation(a.x,a.y,a.z);g.setRotX(b.x);b.y!=0&&g.multiplySelf(f.setRotY(b.y));b.z!=0&&g.multiplySelf(f.setRotZ(b.z));e.multiplySelf(g);if(c.x!=0||c.y!=0||c.z!=0)e.multiplySelf(f.setScale(c.x, +c.y,c.z))}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};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.materials=b instanceof Array?b:[b];this.sortParticles=false};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.materials=b instanceof Array?b:[b];this.type=c!=undefined?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.materials=b instanceof Array?b:[b];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()}; THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3; THREE.LineBasicMaterial=function(a){this.id=THREE.LineBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth= @@ -96,120 +96,121 @@ THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderM THREE.ParticleBasicMaterial=function(a){this.id=THREE.ParticleBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.offset=new THREE.Vector2;this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending; if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
size: "+this.size+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.ParticleBasicMaterialCounter={value:0}; THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}}; -THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,b,c,e,h,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=h!==undefined?h:THREE.LinearFilter;this.min_filter=f!==undefined?f:THREE.LinearMipMapLinearFilter}; +THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,b,c,e,g,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=f!==undefined?f:THREE.LinearMipMapLinearFilter}; THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;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.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrap_s=c.wrap_s!==undefined?c.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=c.wrap_t!==undefined?c.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=c.mag_filter!==undefined?c.mag_filter:THREE.LinearFilter;this.min_filter=c.min_filter!==undefined?c.min_filter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType}; -var Uniforms={clone:function(a){var b,c,e,h={};for(b in a){h[b]={};for(c in a[b]){e=a[b][c];h[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return h},merge:function(a){var b,c,e,h={};for(b=0;b=0&&g>=0&&n>=0&&v>=0)return true;else if(X<0&&g<0||n<0&&v<0)return false;else{if(X<0)W=Math.max(W,X/(X-g));else if(g<0)R=Math.min(R,X/(X-g));if(n<0)W=Math.max(W,n/(n-v));else if(v<0)R=Math.min(R,n/(n-v));if(RX&&q.z0&&E.z<1){t=d[o]=d[o]||new THREE.RenderableParticle;t.x=E.x/E.w;t.y=E.y/E.w;t.z=E.z;t.rotation=C.rotation.z;t.scale.x=C.scale.x*Math.abs(t.x-(E.x+K.projectionMatrix.n11)/(E.w+ -K.projectionMatrix.n14));t.scale.y=C.scale.y*Math.abs(t.y-(E.y+K.projectionMatrix.n22)/(E.w+K.projectionMatrix.n24));t.materials=C.materials;R.push(t);o++}}}}W&&R.sort(a);return R};this.unprojectVector=function(N,K){var W=THREE.Matrix4.makeInvert(K.matrix);W.multiplySelf(THREE.Matrix4.makeInvert(K.projectionMatrix));W.multiplyVector3(N);return N}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,h,f;this.domElement=document.createElement("div");this.setSize=function(j,l){c=j;e=l;h=c/2;f=e/2};this.render=function(j,l){var k,m,p,y,t,o,d,A;a=b.projectScene(j,l);k=0;for(m=a.length;k0){V.r+=oa.r*ja;V.g+=oa.g*ja;V.b+=oa.b*ja}}else if(ja instanceof THREE.PointLight){O.sub(ja.position,ea);O.normalize(); -ja=ca.dot(O)*ra;if(ja>0){V.r+=oa.r*ja;V.g+=oa.g*ja;V.b+=oa.b*ja}}}}function Ia(S,ea,ca){if(ca.opacity!=0){a(ca.opacity);b(ca.blending);var V,aa,ja,oa,ra,ta;if(ca instanceof THREE.ParticleBasicMaterial){if(ca.map&&ca.map.image.loaded){oa=ca.map.image;ra=oa.width>>1;ta=oa.height>>1;aa=ea.scale.x*l;ja=ea.scale.y*k;ca=aa*ra;V=ja*ta;M.set(S.x-ca,S.y-V,S.x+ca,S.y+V);if(Y.instersects(M)){m.save();m.translate(S.x,S.y);m.rotate(-ea.rotation);m.scale(aa,-ja);m.translate(-ra,-ta);m.drawImage(oa,0,0);m.restore()}}}else if(ca instanceof -THREE.ParticleCircleMaterial){if(Z){ba.r=ha.r+ka.r+B.r;ba.g=ha.g+ka.g+B.g;ba.b=ha.b+ka.b+B.b;R.r=ca.color.r*ba.r;R.g=ca.color.g*ba.g;R.b=ca.color.b*ba.b;R.updateStyleString()}else R.__styleString=ca.color.__styleString;ca=ea.scale.x*l;V=ea.scale.y*k;M.set(S.x-ca,S.y-V,S.x+ca,S.y+V);if(Y.instersects(M)){aa=R.__styleString;if(A!=aa)m.fillStyle=A=aa;m.save();m.translate(S.x,S.y);m.rotate(-ea.rotation);m.scale(ca,V);m.beginPath();m.arc(0,0,1,0,P,true);m.closePath();m.fill();m.restore()}}}}function Da(S, -ea,ca,V){if(V.opacity!=0){a(V.opacity);b(V.blending);m.beginPath();m.moveTo(S.positionScreen.x,S.positionScreen.y);m.lineTo(ea.positionScreen.x,ea.positionScreen.y);m.closePath();if(V instanceof THREE.LineBasicMaterial){R.__styleString=V.color.__styleString;S=V.linewidth;if(E!=S)m.lineWidth=E=S;S=R.__styleString;if(d!=S)m.strokeStyle=d=S;m.stroke();M.inflate(V.linewidth*2)}}}function Ga(S,ea,ca,V,aa,ja){if(aa.opacity!=0){a(aa.opacity);b(aa.blending);I=S.positionScreen.x;Q=S.positionScreen.y;$=ea.positionScreen.x; -N=ea.positionScreen.y;K=ca.positionScreen.x;W=ca.positionScreen.y;m.beginPath();m.moveTo(I,Q);m.lineTo($,N);m.lineTo(K,W);m.lineTo(I,Q);m.closePath();if(aa instanceof THREE.MeshBasicMaterial)if(aa.map)aa.map.image.loaded&&aa.map.mapping instanceof THREE.UVMapping&&pa(I,Q,$,N,K,W,aa.map.image,V.uvs[0].u,V.uvs[0].v,V.uvs[1].u,V.uvs[1].v,V.uvs[2].u,V.uvs[2].v);else if(aa.env_map){if(aa.env_map.image.loaded)if(aa.env_map.mapping instanceof THREE.SphericalReflectionMapping){S=va.matrix;O.copy(V.vertexNormalsWorld[0]); -L=(O.x*S.n11+O.y*S.n12+O.z*S.n13)*0.5+0.5;C=-(O.x*S.n21+O.y*S.n22+O.z*S.n23)*0.5+0.5;O.copy(V.vertexNormalsWorld[1]);D=(O.x*S.n11+O.y*S.n12+O.z*S.n13)*0.5+0.5;G=-(O.x*S.n21+O.y*S.n22+O.z*S.n23)*0.5+0.5;O.copy(V.vertexNormalsWorld[2]);H=(O.x*S.n11+O.y*S.n12+O.z*S.n13)*0.5+0.5;J=-(O.x*S.n21+O.y*S.n22+O.z*S.n23)*0.5+0.5;pa(I,Q,$,N,K,W,aa.env_map.image,L,C,D,G,H,J)}}else aa.wireframe?Ea(aa.color.__styleString,aa.wireframe_linewidth):Fa(aa.color.__styleString);else if(aa instanceof THREE.MeshLambertMaterial){if(aa.map&& -!aa.wireframe){aa.map.mapping instanceof THREE.UVMapping&&pa(I,Q,$,N,K,W,aa.map.image,V.uvs[0].u,V.uvs[0].v,V.uvs[1].u,V.uvs[1].v,V.uvs[2].u,V.uvs[2].v);b(THREE.SubtractiveBlending)}if(Z)if(!aa.wireframe&&aa.shading==THREE.SmoothShading&&V.vertexNormalsWorld.length==3){X.r=g.r=n.r=ha.r;X.g=g.g=n.g=ha.g;X.b=g.b=n.b=ha.b;Ca(ja,V.v1.positionWorld,V.vertexNormalsWorld[0],X);Ca(ja,V.v2.positionWorld,V.vertexNormalsWorld[1],g);Ca(ja,V.v3.positionWorld,V.vertexNormalsWorld[2],n);v.r=(g.r+n.r)*0.5;v.g=(g.g+ -n.g)*0.5;v.b=(g.b+n.b)*0.5;z=Ja(X,g,n,v);pa(I,Q,$,N,K,W,z,0,0,1,0,0,1)}else{ba.r=ha.r;ba.g=ha.g;ba.b=ha.b;Ca(ja,V.centroidWorld,V.normalWorld,ba);R.r=aa.color.r*ba.r;R.g=aa.color.g*ba.g;R.b=aa.color.b*ba.b;R.updateStyleString();aa.wireframe?Ea(R.__styleString,aa.wireframe_linewidth):Fa(R.__styleString)}else aa.wireframe?Ea(aa.color.__styleString,aa.wireframe_linewidth):Fa(aa.color.__styleString)}else if(aa instanceof THREE.MeshDepthMaterial){x=va.near;q=va.far;X.r=X.g=X.b=1-Ka(S.positionScreen.z, -x,q);g.r=g.g=g.b=1-Ka(ea.positionScreen.z,x,q);n.r=n.g=n.b=1-Ka(ca.positionScreen.z,x,q);v.r=(g.r+n.r)*0.5;v.g=(g.g+n.g)*0.5;v.b=(g.b+n.b)*0.5;z=Ja(X,g,n,v);pa(I,Q,$,N,K,W,z,0,0,1,0,0,1)}else if(aa instanceof THREE.MeshNormalMaterial){R.r=La(V.normalWorld.x);R.g=La(V.normalWorld.y);R.b=La(V.normalWorld.z);R.updateStyleString();aa.wireframe?Ea(R.__styleString,aa.wireframe_linewidth):Fa(R.__styleString)}}}function Ea(S,ea){if(d!=S)m.strokeStyle=d=S;if(E!=ea)m.lineWidth=E=ea;m.stroke();M.inflate(ea* -2)}function Fa(S){if(A!=S)m.fillStyle=A=S;m.fill()}function pa(S,ea,ca,V,aa,ja,oa,ra,ta,za,wa,Aa,Ma){var xa,Ba;xa=oa.width-1;Ba=oa.height-1;ra*=xa;ta*=Ba;za*=xa;wa*=Ba;Aa*=xa;Ma*=Ba;ca-=S;V-=ea;aa-=S;ja-=ea;za-=ra;wa-=ta;Aa-=ra;Ma-=ta;xa=za*Ma-Aa*wa;if(xa!=0){Ba=1/xa;xa=(Ma*ca-wa*aa)*Ba;wa=(Ma*V-wa*ja)*Ba;ca=(za*aa-Aa*ca)*Ba;V=(za*ja-Aa*V)*Ba;S=S-xa*ra-ca*ta;ea=ea-wa*ra-V*ta;m.save();m.transform(xa,wa,ca,V,S,ea);m.clip();m.drawImage(oa,0,0);m.restore()}}function Ja(S,ea,ca,V){var aa=~~(S.r*255),ja= -~~(S.g*255);S=~~(S.b*255);var oa=~~(ea.r*255),ra=~~(ea.g*255);ea=~~(ea.b*255);var ta=~~(ca.r*255),za=~~(ca.g*255);ca=~~(ca.b*255);var wa=~~(V.r*255),Aa=~~(V.g*255);V=~~(V.b*255);ia[0]=aa<0?0:aa>255?255:aa;ia[1]=ja<0?0:ja>255?255:ja;ia[2]=S<0?0:S>255?255:S;ia[4]=oa<0?0:oa>255?255:oa;ia[5]=ra<0?0:ra>255?255:ra;ia[6]=ea<0?0:ea>255?255:ea;ia[8]=ta<0?0:ta>255?255:ta;ia[9]=za<0?0:za>255?255:za;ia[10]=ca<0?0:ca>255?255:ca;ia[12]=wa<0?0:wa>255?255:wa;ia[13]=Aa<0?0:Aa>255?255:Aa;ia[14]=V<0?0:V>255?255:V;da.putImageData(na, -0,0);la.drawImage(U,0,0);return fa}function Ka(S,ea,ca){S=(S-ea)/(ca-ea);return S*S*(3-2*S)}function La(S){S=(S+1)*0.5;return S<0?0:S>1?1:S}function Na(S,ea){var ca=ea.x-S.x,V=ea.y-S.y,aa=1/Math.sqrt(ca*ca+V*V);ca*=aa;V*=aa;ea.x+=ca;ea.y+=V;S.x-=ca;S.y-=V}var ua,Qa,ma,ya,Ha,Pa,Ra,Oa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,l,k);c=e.projectScene(ga,va,this.sortElements);(Z=ga.lights.length>0)&&sa(ga);ua=0;for(Qa=c.length;ua0){D.r+=J.color.r*Y;D.g+=J.color.g*Y;D.b+=J.color.b*Y}}else if(J instanceof THREE.PointLight){W.sub(J.position,C.centroidWorld);W.normalize();Y=C.normalWorld.dot(W)*J.intensity;if(Y>0){D.r+=J.color.r*Y;D.g+=J.color.g*Y;D.b+=J.color.b*Y}}}}function b(L,C,D,G,H,J){n=e(v++);n.setAttribute("d","M "+L.positionScreen.x+ -" "+L.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+"z");if(H instanceof THREE.MeshBasicMaterial)u.__styleString=H.color.__styleString;else if(H instanceof THREE.MeshLambertMaterial)if(F){I.r=Q.r;I.g=Q.g;I.b=Q.b;a(J,G,I);u.r=H.color.r*I.r;u.g=H.color.g*I.g;u.b=H.color.b*I.b;u.updateStyleString()}else u.__styleString=H.color.__styleString;else if(H instanceof THREE.MeshDepthMaterial){K=1-H.__2near/(H.__farPlusNear-G.z*H.__farMinusNear); -u.setRGB(K,K,K)}else H instanceof THREE.MeshNormalMaterial&&u.setRGB(h(G.normalWorld.x),h(G.normalWorld.y),h(G.normalWorld.z));H.wireframe?n.setAttribute("style","fill: none; stroke: "+u.__styleString+"; stroke-width: "+H.wireframe_linewidth+"; stroke-opacity: "+H.opacity+"; stroke-linecap: "+H.wireframe_linecap+"; stroke-linejoin: "+H.wireframe_linejoin):n.setAttribute("style","fill: "+u.__styleString+"; fill-opacity: "+H.opacity);l.appendChild(n)}function c(L,C,D,G,H,J,Y){n=e(v++);n.setAttribute("d", -"M "+L.positionScreen.x+" "+L.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+" L "+G.positionScreen.x+","+G.positionScreen.y+"z");if(J instanceof THREE.MeshBasicMaterial)u.__styleString=J.color.__styleString;else if(J instanceof THREE.MeshLambertMaterial)if(F){I.r=Q.r;I.g=Q.g;I.b=Q.b;a(Y,H,I);u.r=J.color.r*I.r;u.g=J.color.g*I.g;u.b=J.color.b*I.b;u.updateStyleString()}else u.__styleString=J.color.__styleString;else if(J instanceof THREE.MeshDepthMaterial){K= -1-J.__2near/(J.__farPlusNear-H.z*J.__farMinusNear);u.setRGB(K,K,K)}else J instanceof THREE.MeshNormalMaterial&&u.setRGB(h(H.normalWorld.x),h(H.normalWorld.y),h(H.normalWorld.z));J.wireframe?n.setAttribute("style","fill: none; stroke: "+u.__styleString+"; stroke-width: "+J.wireframe_linewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.wireframe_linecap+"; stroke-linejoin: "+J.wireframe_linejoin):n.setAttribute("style","fill: "+u.__styleString+"; fill-opacity: "+J.opacity);l.appendChild(n)} -function e(L){if(R[L]==null){R[L]=document.createElementNS("http://www.w3.org/2000/svg","path");z==0&&R[L].setAttribute("shape-rendering","crispEdges");return R[L]}return R[L]}function h(L){return L<0?Math.min((1+L)*0.5,0.5):0.5+Math.min(L*0.5,0.5)}var f=null,j=new THREE.Projector,l=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,p,y,t,o,d,A,E=new THREE.Rectangle,w=new THREE.Rectangle,F=false,u=new THREE.Color(16777215),I=new THREE.Color(16777215),Q=new THREE.Color(0),$=new THREE.Color(0), -N=new THREE.Color(0),K,W=new THREE.Vector3,R=[],X=[],g=[],n,v,x,q,z=1;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(L){switch(L){case "high":z=1;break;case "low":z=0}};this.setSize=function(L,C){k=L;m=C;p=k/2;y=m/2;l.setAttribute("viewBox",-p+" "+-y+" "+k+" "+m);l.setAttribute("width",k);l.setAttribute("height",m);E.set(-p,-y,p,y)};this.clear=function(){for(;l.childNodes.length>0;)l.removeChild(l.childNodes[0])};this.render=function(L,C){var D,G, -H,J,Y,T,M,Z;this.autoClear&&this.clear();f=j.projectScene(L,C,this.sortElements);q=x=v=0;if(F=L.lights.length>0){M=L.lights;Q.setRGB(0,0,0);$.setRGB(0,0,0);N.setRGB(0,0,0);D=0;for(G=M.length;D0){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,da,v)}if(Da&&ba>0){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,na,v)}if(Ia){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,g.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,qa,v);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ga,v)}};this.setLineBuffers=function(g,n){var v,x,q,z=g.vertices, -L=g.colors,C=z.length,D=L.length,G=g.__vertexArray,H=g.__colorArray,J=g.__dirtyColors;if(g.__dirtyVertices){for(v=0;v0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+z.maxDirLights,"#define MAX_POINT_LIGHTS "+z.maxPointLights,z.map?"#define USE_MAP":"",z.env_map?"#define USE_ENVMAP":"",z.light_map?"#define USE_LIGHTMAP":"",z.vertex_colors?"#define USE_COLOR":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n"); -d.attachShader(v,y("fragment",q+D));d.attachShader(v,y("vertex",z+n));d.linkProgram(v);d.getProgramParameter(v,d.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+d.getProgramParameter(v,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");v.uniforms={};v.attributes={};g.program=v;v=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(x in g.uniforms)v.push(x);x=g.program;D=0;for(n=v.length;D=0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.vertexAttribPointer(g.color,3,d.FLOAT,false,0,0);d.enableVertexAttribArray(g.color)}if(g.normal>= -0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLNormalBuffer);d.vertexAttribPointer(g.normal,3,d.FLOAT,false,0,0);d.enableVertexAttribArray(g.normal)}if(g.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLTangentBuffer);d.vertexAttribPointer(g.tangent,4,d.FLOAT,false,0,0);d.enableVertexAttribArray(g.tangent)}if(g.uv>=0)if(q.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUVBuffer);d.vertexAttribPointer(g.uv,2,d.FLOAT,false,0,0);d.enableVertexAttribArray(g.uv)}else d.disableVertexAttribArray(g.uv);if(g.uv2>= -0)if(q.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUV2Buffer);d.vertexAttribPointer(g.uv2,2,d.FLOAT,false,0,0);d.enableVertexAttribArray(g.uv2)}else d.disableVertexAttribArray(g.uv2);if(z instanceof THREE.Mesh)if(x.wireframe){d.lineWidth(x.wireframe_linewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);d.drawElements(d.LINES,q.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,q.__webGLFaceCount,d.UNSIGNED_SHORT, -0)}else if(z instanceof THREE.Line){z=z.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(x.linewidth);d.drawArrays(z,0,q.__webGLLineCount)}else z instanceof THREE.ParticleSystem&&d.drawArrays(d.POINTS,0,q.__webGLParticleCount)};this.render=function(g,n,v,x){var q,z,L,C,D,G,H,J=g.lights,Y=g.fog;n.autoUpdateMatrix&&n.updateMatrix();n.matrix.flattenToArray(N);n.projectionMatrix.flattenToArray($);Q.multiply(n.projectionMatrix,n.matrix);h(Q);this.initWebGLObjects(g,n);p(v,x!==undefined?x:true);this.autoClear&& -this.clear();C=g.__webGLObjects.length;for(x=0;x=0;v--){x=g.__webGLObjects[v].object;n==x&&g.__webGLObjects.splice(v,1)}};this.setupMatrices=function(g,n){g._modelViewMatrix.multiplyToArray(n.matrix,g.matrix,g._modelViewMatrixArray);g._normalMatrix=THREE.Matrix4.makeInvert3x3(g._modelViewMatrix).transposeIntoArray(g._normalMatrixArray)}; -this.setDepthTest=function(g){g?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST)};this.setFaceCulling=function(g,n){if(g){!n||n=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(g=="back")d.cullFace(d.BACK);else g=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; -THREE.Snippets={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 env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\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 ), refraction_ratio );\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_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif", -lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform 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 ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", +THREE.Projector=function(){function a(N,M){return M.z-N.z}function b(N,M){var U=0,O=1,Y=N.z+N.w,W=M.z+M.w,J=-N.z+N.w,X=-M.z+M.w;if(Y>=0&&W>=0&&J>=0&&X>=0)return true;else if(Y<0&&W<0||J<0&&X<0)return false;else{if(Y<0)U=Math.max(U,Y/(Y-W));else if(W<0)O=Math.min(O,Y/(Y-W));if(J<0)U=Math.max(U,J/(J-X));else if(X<0)O=Math.min(O,J/(J-X));if(OY&&Z.z0&&H.z<1){t=y[q]=y[q]||new THREE.RenderableParticle;t.x=H.x/H.w;t.y=H.y/H.w;t.z=H.z;t.rotation=v.rotation.z;t.scale.x=v.scale.x*Math.abs(t.x-(H.x+M.projectionMatrix.n11)/ +(H.w+M.projectionMatrix.n14));t.scale.y=v.scale.y*Math.abs(t.y-(H.y+M.projectionMatrix.n22)/(H.w+M.projectionMatrix.n24));t.materials=v.materials;O.push(t);q++}}}}U&&O.sort(a);return O};this.unprojectVector=function(N,M){var U=THREE.Matrix4.makeInvert(M.matrix);U.multiplySelf(THREE.Matrix4.makeInvert(M.projectionMatrix));U.multiplyVector3(N);return N}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,g,f;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;e=k;g=c/2;f=e/2};this.render=function(h,k){var j,m,p,x,t,q,y,z;a=b.projectScene(h,k);j=0;for(m=a.length;j0){T.r+=va.r*na;T.g+=va.g*na;T.b+=va.b*na}}else if(na instanceof THREE.PointLight){I.sub(na.position,ia);I.normalize(); +na=ca.dot(I)*Aa;if(na>0){T.r+=va.r*na;T.g+=va.g*na;T.b+=va.b*na}}}}function qa(S,ia,ca){if(ca.opacity!=0){a(ca.opacity);b(ca.blending);var T,$,na,va,Aa,Ca;if(ca instanceof THREE.ParticleBasicMaterial){if(ca.map&&ca.map.image.loaded){va=ca.map.image;Aa=va.width>>1;Ca=va.height>>1;$=ia.scale.x*k;na=ia.scale.y*j;ca=$*Aa;T=na*Ca;D.set(S.x-ca,S.y-T,S.x+ca,S.y+T);if(L.instersects(D)){m.save();m.translate(S.x,S.y);m.rotate(-ia.rotation);m.scale($,-na);m.translate(-Aa,-Ca);m.drawImage(va,0,0);m.restore()}}}else if(ca instanceof +THREE.ParticleCircleMaterial){if(C){R.r=ba.r+ga.r+B.r;R.g=ba.g+ga.g+B.g;R.b=ba.b+ga.b+B.b;O.r=ca.color.r*R.r;O.g=ca.color.g*R.g;O.b=ca.color.b*R.b;O.updateStyleString()}else O.__styleString=ca.color.__styleString;ca=ia.scale.x*k;T=ia.scale.y*j;D.set(S.x-ca,S.y-T,S.x+ca,S.y+T);if(L.instersects(D)){$=O.__styleString;if(z!=$)m.fillStyle=z=$;m.save();m.translate(S.x,S.y);m.rotate(-ia.rotation);m.scale(ca,T);m.beginPath();m.arc(0,0,1,0,K,true);m.closePath();m.fill();m.restore()}}}}function sa(S,ia,ca, +T){if(T.opacity!=0){a(T.opacity);b(T.blending);m.beginPath();m.moveTo(S.positionScreen.x,S.positionScreen.y);m.lineTo(ia.positionScreen.x,ia.positionScreen.y);m.closePath();if(T instanceof THREE.LineBasicMaterial){O.__styleString=T.color.__styleString;S=T.linewidth;if(H!=S)m.lineWidth=H=S;S=O.__styleString;if(y!=S)m.strokeStyle=y=S;m.stroke();D.inflate(T.linewidth*2)}}}function Ma(S,ia,ca,T,$,na){if($.opacity!=0){a($.opacity);b($.blending);d=S.positionScreen.x;P=S.positionScreen.y;aa=ia.positionScreen.x; +N=ia.positionScreen.y;M=ca.positionScreen.x;U=ca.positionScreen.y;m.beginPath();m.moveTo(d,P);m.lineTo(aa,N);m.lineTo(M,U);m.lineTo(d,P);m.closePath();if($ instanceof THREE.MeshBasicMaterial)if($.map)$.map.image.loaded&&$.map.mapping instanceof THREE.UVMapping&&ma(d,P,aa,N,M,U,$.map.image,T.uvs[0].u,T.uvs[0].v,T.uvs[1].u,T.uvs[1].v,T.uvs[2].u,T.uvs[2].v);else if($.env_map){if($.env_map.image.loaded)if($.env_map.mapping instanceof THREE.SphericalReflectionMapping){S=ja.matrix;I.copy(T.vertexNormalsWorld[0]); +l=(I.x*S.n11+I.y*S.n12+I.z*S.n13)*0.5+0.5;v=-(I.x*S.n21+I.y*S.n22+I.z*S.n23)*0.5+0.5;I.copy(T.vertexNormalsWorld[1]);A=(I.x*S.n11+I.y*S.n12+I.z*S.n13)*0.5+0.5;u=-(I.x*S.n21+I.y*S.n22+I.z*S.n23)*0.5+0.5;I.copy(T.vertexNormalsWorld[2]);n=(I.x*S.n11+I.y*S.n12+I.z*S.n13)*0.5+0.5;F=-(I.x*S.n21+I.y*S.n22+I.z*S.n23)*0.5+0.5;ma(d,P,aa,N,M,U,$.env_map.image,l,v,A,u,n,F)}}else $.wireframe?Ga($.color.__styleString,$.wireframe_linewidth):za($.color.__styleString);else if($ instanceof THREE.MeshLambertMaterial){if($.map&& +!$.wireframe){$.map.mapping instanceof THREE.UVMapping&&ma(d,P,aa,N,M,U,$.map.image,T.uvs[0].u,T.uvs[0].v,T.uvs[1].u,T.uvs[1].v,T.uvs[2].u,T.uvs[2].v);b(THREE.SubtractiveBlending)}if(C)if(!$.wireframe&&$.shading==THREE.SmoothShading&&T.vertexNormalsWorld.length==3){Y.r=W.r=J.r=ba.r;Y.g=W.g=J.g=ba.g;Y.b=W.b=J.b=ba.b;ta(na,T.v1.positionWorld,T.vertexNormalsWorld[0],Y);ta(na,T.v2.positionWorld,T.vertexNormalsWorld[1],W);ta(na,T.v3.positionWorld,T.vertexNormalsWorld[2],J);X.r=(W.r+J.r)*0.5;X.g=(W.g+J.g)* +0.5;X.b=(W.b+J.b)*0.5;ea=ra(Y,W,J,X);ma(d,P,aa,N,M,U,ea,0,0,1,0,0,1)}else{R.r=ba.r;R.g=ba.g;R.b=ba.b;ta(na,T.centroidWorld,T.normalWorld,R);O.r=$.color.r*R.r;O.g=$.color.g*R.g;O.b=$.color.b*R.b;O.updateStyleString();$.wireframe?Ga(O.__styleString,$.wireframe_linewidth):za(O.__styleString)}else $.wireframe?Ga($.color.__styleString,$.wireframe_linewidth):za($.color.__styleString)}else if($ instanceof THREE.MeshDepthMaterial){ha=ja.near;Z=ja.far;Y.r=Y.g=Y.b=1-Da(S.positionScreen.z,ha,Z);W.r=W.g=W.b= +1-Da(ia.positionScreen.z,ha,Z);J.r=J.g=J.b=1-Da(ca.positionScreen.z,ha,Z);X.r=(W.r+J.r)*0.5;X.g=(W.g+J.g)*0.5;X.b=(W.b+J.b)*0.5;ea=ra(Y,W,J,X);ma(d,P,aa,N,M,U,ea,0,0,1,0,0,1)}else if($ instanceof THREE.MeshNormalMaterial){O.r=xa(T.normalWorld.x);O.g=xa(T.normalWorld.y);O.b=xa(T.normalWorld.z);O.updateStyleString();$.wireframe?Ga(O.__styleString,$.wireframe_linewidth):za(O.__styleString)}}}function Ga(S,ia){if(y!=S)m.strokeStyle=y=S;if(H!=ia)m.lineWidth=H=ia;m.stroke();D.inflate(ia*2)}function za(S){if(z!= +S)m.fillStyle=z=S;m.fill()}function ma(S,ia,ca,T,$,na,va,Aa,Ca,Ja,Ea,Ka,Ra){var Ha,La;Ha=va.width-1;La=va.height-1;Aa*=Ha;Ca*=La;Ja*=Ha;Ea*=La;Ka*=Ha;Ra*=La;ca-=S;T-=ia;$-=S;na-=ia;Ja-=Aa;Ea-=Ca;Ka-=Aa;Ra-=Ca;Ha=Ja*Ra-Ka*Ea;if(Ha!=0){La=1/Ha;Ha=(Ra*ca-Ea*$)*La;Ea=(Ra*T-Ea*na)*La;ca=(Ja*$-Ka*ca)*La;T=(Ja*na-Ka*T)*La;S=S-Ha*Aa-ca*Ca;ia=ia-Ea*Aa-T*Ca;m.save();m.transform(Ha,Ea,ca,T,S,ia);m.clip();m.drawImage(va,0,0);m.restore()}}function ra(S,ia,ca,T){var $=~~(S.r*255),na=~~(S.g*255);S=~~(S.b*255);var va= +~~(ia.r*255),Aa=~~(ia.g*255);ia=~~(ia.b*255);var Ca=~~(ca.r*255),Ja=~~(ca.g*255);ca=~~(ca.b*255);var Ea=~~(T.r*255),Ka=~~(T.g*255);T=~~(T.b*255);ka[0]=$<0?0:$>255?255:$;ka[1]=na<0?0:na>255?255:na;ka[2]=S<0?0:S>255?255:S;ka[4]=va<0?0:va>255?255:va;ka[5]=Aa<0?0:Aa>255?255:Aa;ka[6]=ia<0?0:ia>255?255:ia;ka[8]=Ca<0?0:Ca>255?255:Ca;ka[9]=Ja<0?0:Ja>255?255:Ja;ka[10]=ca<0?0:ca>255?255:ca;ka[12]=Ea<0?0:Ea>255?255:Ea;ka[13]=Ka<0?0:Ka>255?255:Ka;ka[14]=T<0?0:T>255?255:T;da.putImageData(V,0,0);ua.drawImage(Q, +0,0);return pa}function Da(S,ia,ca){S=(S-ia)/(ca-ia);return S*S*(3-2*S)}function xa(S){S=(S+1)*0.5;return S<0?0:S>1?1:S}function Oa(S,ia){var ca=ia.x-S.x,T=ia.y-S.y,$=1/Math.sqrt(ca*ca+T*T);ca*=$;T*=$;ia.x+=ca;ia.y+=T;S.x-=ca;S.y-=T}var ya,Pa,oa,Ba,Ia,Na,Qa,wa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=e.projectScene(fa,ja,this.sortElements);(C=fa.lights.length>0)&&Fa(fa);ya=0;for(Pa=c.length;ya0){A.r+=F.color.r*L;A.g+=F.color.g*L;A.b+=F.color.b*L}}else if(F instanceof THREE.PointLight){U.sub(F.position,v.centroidWorld);U.normalize();L=v.normalWorld.dot(U)*F.intensity;if(L>0){A.r+=F.color.r*L;A.g+=F.color.g*L;A.b+=F.color.b*L}}}}function b(l,v,A,u,n,F){J=e(X++);J.setAttribute("d","M "+l.positionScreen.x+ +" "+l.positionScreen.y+" L "+v.positionScreen.x+" "+v.positionScreen.y+" L "+A.positionScreen.x+","+A.positionScreen.y+"z");if(n instanceof THREE.MeshBasicMaterial)o.__styleString=n.color.__styleString;else if(n instanceof THREE.MeshLambertMaterial)if(E){d.r=P.r;d.g=P.g;d.b=P.b;a(F,u,d);o.r=n.color.r*d.r;o.g=n.color.g*d.g;o.b=n.color.b*d.b;o.updateStyleString()}else o.__styleString=n.color.__styleString;else if(n instanceof THREE.MeshDepthMaterial){M=1-n.__2near/(n.__farPlusNear-u.z*n.__farMinusNear); +o.setRGB(M,M,M)}else n instanceof THREE.MeshNormalMaterial&&o.setRGB(g(u.normalWorld.x),g(u.normalWorld.y),g(u.normalWorld.z));n.wireframe?J.setAttribute("style","fill: none; stroke: "+o.__styleString+"; stroke-width: "+n.wireframe_linewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframe_linecap+"; stroke-linejoin: "+n.wireframe_linejoin):J.setAttribute("style","fill: "+o.__styleString+"; fill-opacity: "+n.opacity);k.appendChild(J)}function c(l,v,A,u,n,F,L){J=e(X++);J.setAttribute("d", +"M "+l.positionScreen.x+" "+l.positionScreen.y+" L "+v.positionScreen.x+" "+v.positionScreen.y+" L "+A.positionScreen.x+","+A.positionScreen.y+" L "+u.positionScreen.x+","+u.positionScreen.y+"z");if(F instanceof THREE.MeshBasicMaterial)o.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshLambertMaterial)if(E){d.r=P.r;d.g=P.g;d.b=P.b;a(L,n,d);o.r=F.color.r*d.r;o.g=F.color.g*d.g;o.b=F.color.b*d.b;o.updateStyleString()}else o.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshDepthMaterial){M= +1-F.__2near/(F.__farPlusNear-n.z*F.__farMinusNear);o.setRGB(M,M,M)}else F instanceof THREE.MeshNormalMaterial&&o.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));F.wireframe?J.setAttribute("style","fill: none; stroke: "+o.__styleString+"; stroke-width: "+F.wireframe_linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.wireframe_linecap+"; stroke-linejoin: "+F.wireframe_linejoin):J.setAttribute("style","fill: "+o.__styleString+"; fill-opacity: "+F.opacity);k.appendChild(J)} +function e(l){if(O[l]==null){O[l]=document.createElementNS("http://www.w3.org/2000/svg","path");ea==0&&O[l].setAttribute("shape-rendering","crispEdges");return O[l]}return O[l]}function g(l){return l<0?Math.min((1+l)*0.5,0.5):0.5+Math.min(l*0.5,0.5)}var f=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,p,x,t,q,y,z,H=new THREE.Rectangle,w=new THREE.Rectangle,E=false,o=new THREE.Color(16777215),d=new THREE.Color(16777215),P=new THREE.Color(0),aa=new THREE.Color(0), +N=new THREE.Color(0),M,U=new THREE.Vector3,O=[],Y=[],W=[],J,X,ha,Z,ea=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(l){switch(l){case "high":ea=1;break;case "low":ea=0}};this.setSize=function(l,v){j=l;m=v;p=j/2;x=m/2;k.setAttribute("viewBox",-p+" "+-x+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);H.set(-p,-x,p,x)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(l,v){var A, +u,n,F,L,G,D,C;this.autoClear&&this.clear();f=h.projectScene(l,v,this.sortElements);Z=ha=X=0;if(E=l.lights.length>0){D=l.lights;P.setRGB(0,0,0);aa.setRGB(0,0,0);N.setRGB(0,0,0);A=0;for(u=D.length;A0){d.bindBuffer(d.ARRAY_BUFFER,L.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Ma,ba)}if(Ba&& +B>0){d.bindBuffer(d.ARRAY_BUFFER,L.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Ga,ba)}if(oa){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,L.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Da,ba);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,L.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,xa,ba)}}q(objlist,F,u,l,v,A)}n.__dirtyVertices=false;n.__dirtyElements=false;n.__dirtyUvs=false;n.__dirtyNormals=false;n.__dirtyTangents=false;n.__dirtyColors=false}else if(v instanceof THREE.Line){if(!n.__webGLVertexBuffer){n.__webGLVertexBuffer= +d.createBuffer();n.__webGLColorBuffer=d.createBuffer();u=n.vertices.length;n.__vertexArray=new Float32Array(u*3);n.__colorArray=new Float32Array(u*3);n.__webGLLineCount=u;n.__dirtyVertices=true;n.__dirtyColors=true}if(n.__dirtyVertices||n.__dirtyColors){u=d.DYNAMIC_DRAW;G=n.vertices;L=n.colors;R=G.length;ba=L.length;B=n.__vertexArray;ga=n.__colorArray;K=n.__dirtyColors;if(n.__dirtyVertices){for(D=0;D +0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+F.maxDirLights,"#define MAX_POINT_LIGHTS "+F.maxPointLights,F.map?"#define USE_MAP":"",F.env_map?"#define USE_ENVMAP":"",F.light_map?"#define USE_LIGHTMAP":"",F.vertex_colors?"#define USE_COLOR":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n"); +d.attachShader(A,w("fragment",n+D));d.attachShader(A,w("vertex",F+v));d.linkProgram(A);d.getProgramParameter(A,d.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+d.getProgramParameter(A,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");A.uniforms={};A.attributes={};l.program=A;A=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(u in l.uniforms)A.push(u);u=l.program;D=0;for(v=A.length;D=0){d.bindBuffer(d.ARRAY_BUFFER,n.__webGLColorBuffer);d.vertexAttribPointer(l.color,3,d.FLOAT,false,0,0);d.enableVertexAttribArray(l.color)}if(l.normal>= +0){d.bindBuffer(d.ARRAY_BUFFER,n.__webGLNormalBuffer);d.vertexAttribPointer(l.normal,3,d.FLOAT,false,0,0);d.enableVertexAttribArray(l.normal)}if(l.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,n.__webGLTangentBuffer);d.vertexAttribPointer(l.tangent,4,d.FLOAT,false,0,0);d.enableVertexAttribArray(l.tangent)}if(l.uv>=0)if(n.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,n.__webGLUVBuffer);d.vertexAttribPointer(l.uv,2,d.FLOAT,false,0,0);d.enableVertexAttribArray(l.uv)}else d.disableVertexAttribArray(l.uv);if(l.uv2>= +0)if(n.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,n.__webGLUV2Buffer);d.vertexAttribPointer(l.uv2,2,d.FLOAT,false,0,0);d.enableVertexAttribArray(l.uv2)}else d.disableVertexAttribArray(l.uv2);if(F instanceof THREE.Mesh)if(u.wireframe){d.lineWidth(u.wireframe_linewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer);d.drawElements(d.LINES,n.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,n.__webGLFaceCount,d.UNSIGNED_SHORT, +0)}else if(F instanceof THREE.Line){F=F.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(u.linewidth);d.drawArrays(F,0,n.__webGLLineCount)}else F instanceof THREE.ParticleSystem&&d.drawArrays(d.POINTS,0,n.__webGLParticleCount)};this.render=function(l,v,A,u){var n,F,L,G,D,C,R,ba=l.lights,ga=l.fog;v.autoUpdateMatrix&&v.updateMatrix();v.matrix.flattenToArray(J);v.projectionMatrix.flattenToArray(W);Y.multiply(v.projectionMatrix,v.matrix);f(Y);this.initWebGLObjects(l,v);H(A,u!==undefined?u:true); +this.autoClear&&this.clear();G=l.__webGLObjects.length;for(u=0;u=0;A--){u=l.__webGLObjects[A].object;v==u&&l.__webGLObjects.splice(A,1)}};this.setDepthTest=function(l){l?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST)};this.setFaceCulling=function(l,v){if(l){!v||v=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(l=="back")d.cullFace(d.BACK);else l=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)> +0}}; +THREE.Snippets={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 env_map;\nuniform int combine;\n#endif", +envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\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 ), refraction_ratio );\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_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif", +lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform 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 ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\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 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}", lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 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 + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", 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\nvColor = color;\n#endif"}; @@ -230,20 +231,20 @@ THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=ne THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null}; THREE.Detector={canvas:!!document.createElement("canvas").getContext,webgl:window.Uint8Array!=undefined,workers:!!window.Worker,addGetWebGLMessage:function(a){var b=document.body,c="oldie";if(a){if(a.parent!==undefined)b=a.parent;if(a.id!==undefined)c=a.id}a=document.createElement("center");var e=document.createElement("div");e.innerHTML='Sorry, your browser doesn\'t support WebGL
\n
\nPlease try in\nChrome 9+ /\nFirefox 4+ /\nSafari OSX 10.6+';e.id= c;c=e.style;c.fontFamily="monospace";c.fontSize="13px";c.textAlign="center";c.background="#eee";c.color="#000";c.padding="1em";c.width="475px";c.margin="5em auto 0";a.appendChild(e);b.appendChild(a);return e}}; -var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,e=a.vertices.length,h=c?b.geometry:b,f=a.vertices,j=h.vertices,l=a.faces,k=h.faces,m=a.uvs;h=h.uvs;c&&b.autoUpdateMatrix&&b.updateMatrix();for(var p=0,y=j.length;p= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}", @@ -252,38 +253,38 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertex_shader:"varying ve value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertex_shader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i25)f=25;h=(f-1)*0.5;c=Array(f);for(b=e=0;b25)f=25;g=(f-1)*0.5;c=Array(f);for(b=e=0;b0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(y,l,t)))-1);m.push(p)}b.push(m)}var o,d,A;h=b.length;for(c=0;c0)for(e=0;e1){o=this.vertices[j].position.clone(); -d=this.vertices[k].position.clone();A=this.vertices[m].position.clone();o.normalize();d.normalize();A.normalize();this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(d.x,d.y,d.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([p,y,E])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; -var Torus=function(a,b,c,e){this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){e=c/this.segmentsT*2*Math.PI;var h=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(h))*Math.cos(e),(this.radius+this.tube*Math.cos(h))*Math.sin(e),this.tube*Math.sin(h))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c= -1;c<=this.segmentsT;++c){e=(this.segmentsT+1)*b+c;h=(this.segmentsT+1)*b+c-1;var f=(this.segmentsT+1)*(b-1)+c-1,j=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(e,h,f,j));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[j][0],a[j][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; -var Icosahedron=function(a){function b(y,t,o){var d=Math.sqrt(y*y+t*t+o*o);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(y/d,t/d,o/d)))-1}function c(y,t,o,d){d.faces.push(new THREE.Face3(y,t,o))}function e(y,t){var o=h.vertices[y].position,d=h.vertices[t].position;return b((o.x+d.x)/2,(o.y+d.y)/2,(o.z+d.z)/2)}var h=this,f=new THREE.Geometry,j;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0, -1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,f);c(0,5,1,f);c(0,1,7,f);c(0,7,10,f);c(0,10,11,f);c(1,5,9,f);c(5,11,4,f);c(11,10,2,f);c(10,7,6,f);c(7,1,8,f);c(3,9,4,f);c(3,4,2,f);c(3,2,6,f);c(3,6,8,f);c(3,8,9,f);c(4,9,5,f);c(2,4,11,f);c(6,2,10,f);c(8,6,7,f);c(9,8,1,f);for(a=0;a0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,t)))-1);m.push(p)}b.push(m)}var q,y,z;g=b.length;for(c=0;c0)for(e=0;e1){q=this.vertices[h].position.clone(); +y=this.vertices[j].position.clone();z=this.vertices[m].position.clone();q.normalize();y.normalize();z.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)]));this.uvs.push([p,x,H])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; +var Torus=function(a,b,c,e){this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){e=c/this.segmentsT*2*Math.PI;var g=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(e),(this.radius+this.tube*Math.cos(g))*Math.sin(e),this.tube*Math.sin(g))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c= +1;c<=this.segmentsT;++c){e=(this.segmentsT+1)*b+c;g=(this.segmentsT+1)*b+c-1;var f=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(e,g,f,h));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; +var Icosahedron=function(a){function b(x,t,q){var y=Math.sqrt(x*x+t*t+q*q);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(x/y,t/y,q/y)))-1}function c(x,t,q,y){y.faces.push(new THREE.Face3(x,t,q))}function e(x,t){var q=g.vertices[x].position,y=g.vertices[t].position;return b((q.x+y.x)/2,(q.y+y.y)/2,(q.z+y.z)/2)}var g=this,f=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0, +1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,f);c(0,5,1,f);c(0,1,7,f);c(0,7,10,f);c(0,10,11,f);c(1,5,9,f);c(5,11,4,f);c(11,10,2,f);c(10,7,6,f);c(7,1,8,f);c(3,9,4,f);c(3,4,2,f);c(3,2,6,f);c(3,6,8,f);c(3,8,9,f);c(4,9,5,f);c(2,4,11,f);c(6,2,10,f);c(8,6,7,f);c(9,8,1,f);for(a=0;a=this.maxCount-3&&l(this)};this.begin= -function(){this.count=0;this.hasNormal=this.hasPos=false};this.end=function(c){if(this.count!=0){for(var e=this.count*3;ethis.size-1)k=this.size-1;var t=Math.floor(m-l);if(t<1)t=1;m=Math.floor(m+l);if(m>this.size-1)m=this.size-1;var o=Math.floor(p-l);if(o<1)o=1;l=Math.floor(p+l); -if(l>this.size-1)l=this.size-1;var d,A,E,w,F,u;for(y=y;y0)this.field[E+d]+=w}}}};this.addPlaneX=function(c,e){var h,f,j,l,k,m=this.size,p=this.yd,y=this.zd,t=this.field,o=m*Math.sqrt(c/e);if(o>m)o=m;for(h=0;h0)for(f=0;fp)d=p;for(f=0;f0){k=f*y;for(h=0;hsize)dist=size;for(j=0;j0){k=zd*j;for(f=0;f=this.maxCount-3&&k(this)};this.begin= +function(){this.count=0;this.hasNormal=this.hasPos=false};this.end=function(c){if(this.count!=0){for(var e=this.count*3;ethis.size-1)j=this.size-1;var t=Math.floor(m-k);if(t<1)t=1;m=Math.floor(m+k);if(m>this.size-1)m=this.size-1;var q=Math.floor(p-k);if(q<1)q=1;k=Math.floor(p+k); +if(k>this.size-1)k=this.size-1;var y,z,H,w,E,o;for(x=x;x0)this.field[H+y]+=w}}}};this.addPlaneX=function(c,e){var g,f,h,k,j,m=this.size,p=this.yd,x=this.zd,t=this.field,q=m*Math.sqrt(c/e);if(q>m)q=m;for(g=0;g0)for(f=0;fp)y=p;for(f=0;f0){j=f*x;for(g=0;gsize)dist=size;for(h=0;h0){j=zd*h;for(f=0;f>7)-127;O=(da&127)<<16|U<<8|O;if(O==0&&ia==-127)return 0;return(1-2*(na>>7))*(1+O*Math.pow(2,-23))*Math.pow(2,ia)}function l(B,P){var O=p(B,P),U=p(B,P+1),da=p(B,P+2);return(p(B,P+3)<<24)+(da<<16)+(U<<8)+O}function k(B,P){var O=p(B,P);return(p(B,P+1)<<8)+O}function m(B,P){var O=p(B,P);return O>127?O-256:O}function p(B,P){return B.charCodeAt(P)&255}function y(B){var P, -O,U;P=l(a,B);O=l(a,B+$);U=l(a,B+N);B=k(a,B+K);THREE.Loader.prototype.f3(w,P,O,U,B)}function t(B){var P,O,U,da,na,ia;P=l(a,B);O=l(a,B+$);U=l(a,B+N);da=k(a,B+K);na=l(a,B+W);ia=l(a,B+R);B=l(a,B+X);THREE.Loader.prototype.f3n(w,I,P,O,U,da,na,ia,B)}function o(B){var P,O,U,da;P=l(a,B);O=l(a,B+g);U=l(a,B+n);da=l(a,B+v);B=k(a,B+x);THREE.Loader.prototype.f4(w,P,O,U,da,B)}function d(B){var P,O,U,da,na,ia,fa,la;P=l(a,B);O=l(a,B+g);U=l(a,B+n);da=l(a,B+v);na=k(a,B+x);ia=l(a,B+q);fa=l(a,B+z);la=l(a,B+L);B=l(a,B+ -C);THREE.Loader.prototype.f4n(w,I,P,O,U,da,na,ia,fa,la,B)}function A(B){var P,O;P=l(a,B);O=l(a,B+D);B=l(a,B+G);THREE.Loader.prototype.uv3(w.uvs,Q[P*2],Q[P*2+1],Q[O*2],Q[O*2+1],Q[B*2],Q[B*2+1])}function E(B){var P,O,U;P=l(a,B);O=l(a,B+H);U=l(a,B+J);B=l(a,B+Y);THREE.Loader.prototype.uv4(w.uvs,Q[P*2],Q[P*2+1],Q[O*2],Q[O*2+1],Q[U*2],Q[U*2+1],Q[B*2],Q[B*2+1])}var w=this,F=0,u,I=[],Q=[],$,N,K,W,R,X,g,n,v,x,q,z,L,C,D,G,H,J,Y,T,M,Z,ba,ha,ka;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w, -e,f);u={signature:a.substr(F,8),header_bytes:p(a,F+8),vertex_coordinate_bytes:p(a,F+9),normal_coordinate_bytes:p(a,F+10),uv_coordinate_bytes:p(a,F+11),vertex_index_bytes:p(a,F+12),normal_index_bytes:p(a,F+13),uv_index_bytes:p(a,F+14),material_index_bytes:p(a,F+15),nvertices:l(a,F+16),nnormals:l(a,F+16+4),nuvs:l(a,F+16+8),ntri_flat:l(a,F+16+12),ntri_smooth:l(a,F+16+16),ntri_flat_uv:l(a,F+16+20),ntri_smooth_uv:l(a,F+16+24),nquad_flat:l(a,F+16+28),nquad_smooth:l(a,F+16+32),nquad_flat_uv:l(a,F+16+36), -nquad_smooth_uv:l(a,F+16+40)};F+=u.header_bytes;$=u.vertex_index_bytes;N=u.vertex_index_bytes*2;K=u.vertex_index_bytes*3;W=u.vertex_index_bytes*3+u.material_index_bytes;R=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes;X=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*2;g=u.vertex_index_bytes;n=u.vertex_index_bytes*2;v=u.vertex_index_bytes*3;x=u.vertex_index_bytes*4;q=u.vertex_index_bytes*4+u.material_index_bytes;z=u.vertex_index_bytes*4+u.material_index_bytes+ -u.normal_index_bytes;L=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*2;C=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*3;D=u.uv_index_bytes;G=u.uv_index_bytes*2;H=u.uv_index_bytes;J=u.uv_index_bytes*2;Y=u.uv_index_bytes*3;f=u.vertex_index_bytes*3+u.material_index_bytes;ka=u.vertex_index_bytes*4+u.material_index_bytes;T=u.ntri_flat*f;M=u.ntri_smooth*(f+u.normal_index_bytes*3);Z=u.ntri_flat_uv*(f+u.uv_index_bytes*3);ba=u.ntri_smooth_uv*(f+u.normal_index_bytes* -3+u.uv_index_bytes*3);ha=u.nquad_flat*ka;f=u.nquad_smooth*(ka+u.normal_index_bytes*4);ka=u.nquad_flat_uv*(ka+u.uv_index_bytes*4);F+=function(B){var P,O,U,da=u.vertex_coordinate_bytes*3,na=B+u.nvertices*da;for(B=B;B>7)-127;I=(da&127)<<16|Q<<8|I;if(I==0&&ka==-127)return 0;return(1-2*(V>>7))*(1+I*Math.pow(2,-23))*Math.pow(2,ka)}function k(B,K){var I=p(B,K),Q=p(B,K+1),da=p(B,K+2);return(p(B,K+3)<<24)+(da<<16)+(Q<<8)+I}function j(B,K){var I=p(B,K);return(p(B,K+1)<<8)+I}function m(B,K){var I=p(B,K);return I>127?I-256:I}function p(B,K){return B.charCodeAt(K)&255}function x(B){var K,I,Q; +K=k(a,B);I=k(a,B+aa);Q=k(a,B+N);B=j(a,B+M);THREE.Loader.prototype.f3(w,K,I,Q,B)}function t(B){var K,I,Q,da,V,ka;K=k(a,B);I=k(a,B+aa);Q=k(a,B+N);da=j(a,B+M);V=k(a,B+U);ka=k(a,B+O);B=k(a,B+Y);THREE.Loader.prototype.f3n(w,d,K,I,Q,da,V,ka,B)}function q(B){var K,I,Q,da;K=k(a,B);I=k(a,B+W);Q=k(a,B+J);da=k(a,B+X);B=j(a,B+ha);THREE.Loader.prototype.f4(w,K,I,Q,da,B)}function y(B){var K,I,Q,da,V,ka,pa,ua;K=k(a,B);I=k(a,B+W);Q=k(a,B+J);da=k(a,B+X);V=j(a,B+ha);ka=k(a,B+Z);pa=k(a,B+ea);ua=k(a,B+l);B=k(a,B+v); +THREE.Loader.prototype.f4n(w,d,K,I,Q,da,V,ka,pa,ua,B)}function z(B){var K,I;K=k(a,B);I=k(a,B+A);B=k(a,B+u);THREE.Loader.prototype.uv3(w.uvs,P[K*2],P[K*2+1],P[I*2],P[I*2+1],P[B*2],P[B*2+1])}function H(B){var K,I,Q;K=k(a,B);I=k(a,B+n);Q=k(a,B+F);B=k(a,B+L);THREE.Loader.prototype.uv4(w.uvs,P[K*2],P[K*2+1],P[I*2],P[I*2+1],P[Q*2],P[Q*2+1],P[B*2],P[B*2+1])}var w=this,E=0,o,d=[],P=[],aa,N,M,U,O,Y,W,J,X,ha,Z,ea,l,v,A,u,n,F,L,G,D,C,R,ba,ga;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w, +e,f);o={signature:a.substr(E,8),header_bytes:p(a,E+8),vertex_coordinate_bytes:p(a,E+9),normal_coordinate_bytes:p(a,E+10),uv_coordinate_bytes:p(a,E+11),vertex_index_bytes:p(a,E+12),normal_index_bytes:p(a,E+13),uv_index_bytes:p(a,E+14),material_index_bytes:p(a,E+15),nvertices:k(a,E+16),nnormals:k(a,E+16+4),nuvs:k(a,E+16+8),ntri_flat:k(a,E+16+12),ntri_smooth:k(a,E+16+16),ntri_flat_uv:k(a,E+16+20),ntri_smooth_uv:k(a,E+16+24),nquad_flat:k(a,E+16+28),nquad_smooth:k(a,E+16+32),nquad_flat_uv:k(a,E+16+36), +nquad_smooth_uv:k(a,E+16+40)};E+=o.header_bytes;aa=o.vertex_index_bytes;N=o.vertex_index_bytes*2;M=o.vertex_index_bytes*3;U=o.vertex_index_bytes*3+o.material_index_bytes;O=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes;Y=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*2;W=o.vertex_index_bytes;J=o.vertex_index_bytes*2;X=o.vertex_index_bytes*3;ha=o.vertex_index_bytes*4;Z=o.vertex_index_bytes*4+o.material_index_bytes;ea=o.vertex_index_bytes*4+o.material_index_bytes+ +o.normal_index_bytes;l=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*2;v=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*3;A=o.uv_index_bytes;u=o.uv_index_bytes*2;n=o.uv_index_bytes;F=o.uv_index_bytes*2;L=o.uv_index_bytes*3;f=o.vertex_index_bytes*3+o.material_index_bytes;ga=o.vertex_index_bytes*4+o.material_index_bytes;G=o.ntri_flat*f;D=o.ntri_smooth*(f+o.normal_index_bytes*3);C=o.ntri_flat_uv*(f+o.uv_index_bytes*3);R=o.ntri_smooth_uv*(f+o.normal_index_bytes* +3+o.uv_index_bytes*3);ba=o.nquad_flat*ga;f=o.nquad_smooth*(ga+o.normal_index_bytes*4);ga=o.nquad_flat_uv*(ga+o.uv_index_bytes*4);E+=function(B){var K,I,Q,da=o.vertex_coordinate_bytes*3,V=B+o.nvertices*da;for(B=B;BWebGL renderer
-

Models by Reallusion +

Models by Reallusion iClone.

Using a modified version of Three.js by mrdoob. diff --git a/src/objects/Object3D.js b/src/objects/Object3D.js index 2900e5e8..130fa58c 100644 --- a/src/objects/Object3D.js +++ b/src/objects/Object3D.js @@ -4,13 +4,14 @@ THREE.Object3D = function () { - this.id = THREE.Object3DCounter.value ++; + this.id = THREE.Object3DCounter.value ++; // TODO: Probably not needed? this.position = new THREE.Vector3(); this.rotation = new THREE.Vector3(); this.scale = new THREE.Vector3( 1, 1, 1 ); this.matrix = new THREE.Matrix4(); + this.matrixWorld = new THREE.Matrix4(); this.rotationMatrix = new THREE.Matrix4(); this.tmpMatrix = new THREE.Matrix4(); @@ -19,34 +20,52 @@ THREE.Object3D = function () { this.autoUpdateMatrix = true; this.visible = true; + this.children = []; + }; THREE.Object3D.prototype = { + addChild: function ( object ) { + + var i = this.children.indexOf( object ); + + if ( i === -1 ) { + + this.children.push( object ); + + } + + }, + + removeChild: function ( object ) { + + var i = this.children.indexOf( object ); + + if ( i !== -1 ) { + + this.children.splice( i, 1 ); + + } + + }, + updateMatrix: function () { - var p = this.position, r = this.rotation, s = this.scale, m = this.tmpMatrix; + var p = this.position, r = this.rotation, s = this.scale, + matrix = this.matrix, rotationMatrix = this.rotationMatrix, + tmpMatrix = this.tmpMatrix; - this.matrix.setTranslation( p.x, p.y, p.z ); + matrix.setTranslation( p.x, p.y, p.z ); - this.rotationMatrix.setRotX( r.x ); + rotationMatrix.setRotX( r.x ); - if ( r.y != 0 ) { - m.setRotY( r.y ); - this.rotationMatrix.multiplySelf( m ); - } + if ( r.y != 0 ) rotationMatrix.multiplySelf( tmpMatrix.setRotY( r.y ) ); + if ( r.z != 0 ) rotationMatrix.multiplySelf( tmpMatrix.setRotZ( r.z ) ); - if ( r.z != 0 ) { - m.setRotZ( r.z ); - this.rotationMatrix.multiplySelf( m ); - } + matrix.multiplySelf( rotationMatrix ); - this.matrix.multiplySelf( this.rotationMatrix ); - - if ( s.x != 0 || s.y != 0 || s.z != 0 ) { - m.setScale( s.x, s.y, s.z ); - this.matrix.multiplySelf( m ); - } + if ( s.x != 0 || s.y != 0 || s.z != 0 ) matrix.multiplySelf( tmpMatrix.setScale( s.x, s.y, s.z ) ); } diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index 087fb84d..b36b4833 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -87,14 +87,14 @@ THREE.WebGLRenderer = function ( parameters ) { }; - this.setClearColorHex = function( hex, alpha ) { + this.setClearColorHex = function ( hex, alpha ) { var color = new THREE.Color( hex ); _gl.clearColor( color.r, color.g, color.b, alpha ); }; - this.setClearColor = function( color, alpha ) { + this.setClearColor = function ( color, alpha ) { _gl.clearColor( color.r, color.g, color.b, alpha ); @@ -186,21 +186,21 @@ THREE.WebGLRenderer = function ( parameters ) { }; - this.createParticleBuffers = function( geometry ) { + function createParticleBuffers ( geometry ) { geometry.__webGLVertexBuffer = _gl.createBuffer(); geometry.__webGLColorBuffer = _gl.createBuffer(); }; - this.createLineBuffers = function( geometry ) { + function createLineBuffers ( geometry ) { geometry.__webGLVertexBuffer = _gl.createBuffer(); geometry.__webGLColorBuffer = _gl.createBuffer(); }; - this.createMeshBuffers = function( geometryChunk ) { + function createMeshBuffers ( geometryChunk ) { geometryChunk.__webGLVertexBuffer = _gl.createBuffer(); geometryChunk.__webGLNormalBuffer = _gl.createBuffer(); @@ -214,7 +214,7 @@ THREE.WebGLRenderer = function ( parameters ) { }; - this.initLineBuffers = function( geometry ) { + function initLineBuffers ( geometry ) { var nvertices = geometry.vertices.length; @@ -225,7 +225,7 @@ THREE.WebGLRenderer = function ( parameters ) { }; - this.initParticleBuffers = function( geometry ) { + function initParticleBuffers ( geometry ) { var nvertices = geometry.vertices.length; @@ -238,7 +238,7 @@ THREE.WebGLRenderer = function ( parameters ) { }; - this.initMeshBuffers = function( geometryChunk, object ) { + function initMeshBuffers ( geometryChunk, object ) { var f, fl, nvertices = 0, ntris = 0, nlines = 0, obj_faces = object.geometry.faces, @@ -284,7 +284,7 @@ THREE.WebGLRenderer = function ( parameters ) { }; - this.setMeshBuffers = function ( geometryChunk, object, hint ) { + function setMeshBuffers ( geometryChunk, object, hint ) { var f, fl, fi, face, vertexNormals, faceNormal, normal, uv, uv2, v1, v2, v3, v4, t1, t2, t3, t4, @@ -735,7 +735,7 @@ THREE.WebGLRenderer = function ( parameters ) { }; - this.setLineBuffers = function( geometry, hint ) { + function setLineBuffers ( geometry, hint ) { var v, c, vertex, offset, vertices = geometry.vertices, @@ -789,7 +789,7 @@ THREE.WebGLRenderer = function ( parameters ) { }; - this.setParticleBuffers = function( geometry, hint, object, camera ) { + function setParticleBuffers ( geometry, hint, object, camera ) { var v, c, vertex, offset, vertices = geometry.vertices, @@ -809,7 +809,7 @@ THREE.WebGLRenderer = function ( parameters ) { if ( object.sortParticles ) { - _projScreenMatrix.multiplySelf( object.matrix ); + _projScreenMatrix.multiplySelf( object.matrixWorld ); for ( v = 0; v < vl; v++ ) { @@ -1446,6 +1446,23 @@ THREE.WebGLRenderer = function ( parameters ) { }; + function updateChildren( object ) { + + var i, l, child, children = object.children; + + for ( i = 0, l = children.length; i < l; i ++ ) { + + child = children[ i ]; + + child.autoUpdateMatrix && child.updateMatrix(); + child.matrixWorld.multiply( object.matrixWorld, child.matrix ); + + updateChildren( child ); + + } + + }; + this.render = function( scene, camera, renderTarget, clear ) { var i, program, opaque, transparent, @@ -1453,7 +1470,7 @@ THREE.WebGLRenderer = function ( parameters ) { lights = scene.lights, fog = scene.fog, ol; - + camera.autoUpdateMatrix && camera.updateMatrix(); camera.matrix.flattenToArray( _viewMatrixArray ); @@ -1481,26 +1498,38 @@ THREE.WebGLRenderer = function ( parameters ) { webGLObject = scene.__webGLObjects[ o ]; object = webGLObject.object; - if ( object.visible && ( ! ( object instanceof THREE.Mesh ) || isInFrustum( object ) ) ) { + if ( object.visible ) { - if( object.autoUpdateMatrix ) { + if ( webGLObject.root ) { + + object.autoUpdateMatrix && object.updateMatrix(); + object.matrixWorld.copy( object.matrix ); + + updateChildren( object ); + + } + + if ( ! ( object instanceof THREE.Mesh ) || isInFrustum( object ) ) { + + object.matrixWorld.flattenToArray( object._objectMatrixArray ); + + setupMatrices( object, camera ); + + unrollBufferMaterials( webGLObject ); + + webGLObject.render = true; - object.updateMatrix(); - object.matrix.flattenToArray( object._objectMatrixArray ); + } else { + + webGLObject.render = false; + } - this.setupMatrices( object, camera ); - - unrollBufferMaterials( webGLObject ); - - webGLObject.render = true; - - } else { webGLObject.render = false; - + } } @@ -1517,11 +1546,12 @@ THREE.WebGLRenderer = function ( parameters ) { if( object.autoUpdateMatrix ) { object.updateMatrix(); - object.matrix.flattenToArray( object._objectMatrixArray ); + object.matrixWorld.copy( object.matrix ); + object.matrixWorld.flattenToArray( object._objectMatrixArray ); } - this.setupMatrices( object, camera ); + setupMatrices( object, camera ); unrollImmediateBufferMaterials( webGLObject ); @@ -1640,7 +1670,7 @@ THREE.WebGLRenderer = function ( parameters ) { } } - + // Generate mipmap if we're using any kind of mipmap filtering if ( renderTarget && renderTarget.min_filter !== THREE.NearestFilter && renderTarget.min_filter !== THREE.LinearFilter ) { @@ -1651,37 +1681,180 @@ THREE.WebGLRenderer = function ( parameters ) { }; + function addChildren( scene, object ) { + + var i, l, children = object.children; + + for ( i = 0, l = children.length; i < l; i ++ ) { + + child = children[ i ]; + + addObject( scene, child, false ); + addChildren( scene, child ); + + } + + }; + + function addObject( scene, object, root ) { + + var g, geometry, geometryChunk, objmap; + + geometry = object.geometry; + + if ( scene.__webGLObjectsMap[ object.id ] == undefined ) { + + scene.__webGLObjectsMap[ object.id ] = {}; + + object._modelViewMatrix = new THREE.Matrix4(); + + object._normalMatrixArray = new Float32Array( 9 ); + object._modelViewMatrixArray = new Float32Array( 16 ); + object._objectMatrixArray = new Float32Array( 16 ); + + object.matrix.flattenToArray( object._objectMatrixArray ); + + } + + objmap = scene.__webGLObjectsMap[ object.id ]; + objlist = scene.__webGLObjects; + + if ( object instanceof THREE.Mesh ) { + + // create separate VBOs per geometry chunk + + for ( g in geometry.geometryChunks ) { + + geometryChunk = geometry.geometryChunks[ g ]; + + // initialise VBO on the first access + + if( ! geometryChunk.__webGLVertexBuffer ) { + + createMeshBuffers( geometryChunk ); + initMeshBuffers( geometryChunk, object ); + + geometry.__dirtyVertices = true; + geometry.__dirtyElements = true; + geometry.__dirtyUvs = true; + geometry.__dirtyNormals = true; + geometry.__dirtyTangents = true; + geometry.__dirtyColors = true; + + } + + if( geometry.__dirtyVertices || geometry.__dirtyElements || + geometry.__dirtyUvs || geometry.__dirtyNormals || + geometry.__dirtyColors || geometry.__dirtyTangents ) { + + setMeshBuffers( geometryChunk, object, _gl.DYNAMIC_DRAW ); + + } + + // create separate wrapper per each use of VBO + + add_buffer( objlist, objmap, g, geometryChunk, object, root ); + + } + + geometry.__dirtyVertices = false; + geometry.__dirtyElements = false; + geometry.__dirtyUvs = false; + geometry.__dirtyNormals = false; + geometry.__dirtyTangents = false; + geometry.__dirtyColors = false; + + } else if ( object instanceof THREE.Line ) { + + if( ! geometry.__webGLVertexBuffer ) { + + createLineBuffers( geometry ); + initLineBuffers( geometry ); + + geometry.__dirtyVertices = true; + geometry.__dirtyColors = true; + + } + + if( geometry.__dirtyVertices || geometry.__dirtyColors ) { + + setLineBuffers( geometry, _gl.DYNAMIC_DRAW ); + + } + + add_buffer( objlist, objmap, 0, geometry, object, root ); + + geometry.__dirtyVertices = false; + geometry.__dirtyColors = false; + + } else if ( object instanceof THREE.ParticleSystem ) { + + if( ! geometry.__webGLVertexBuffer ) { + + createParticleBuffers( geometry ); + initParticleBuffers( geometry ); + + geometry.__dirtyVertices = true; + geometry.__dirtyColors = true; + + } + + if( geometry.__dirtyVertices || geometry.__dirtyColors || object.sortParticles ) { + + setParticleBuffers( geometry, _gl.DYNAMIC_DRAW, object, camera ); + + } + + add_buffer( objlist, objmap, 0, geometry, object, root ); + + geometry.__dirtyVertices = false; + geometry.__dirtyColors = false; + + } else if ( object instanceof THREE.MarchingCubes ) { + + add_buffer_immediate( scene.__webGLObjectsImmediate, objmap, 0, object, root ); + + }/*else if ( object instanceof THREE.Particle ) { + + }*/ + + }; + + function add_buffer( objlist, objmap, id, buffer, object, root ) { + + if ( objmap[ id ] == undefined ) { + + objlist.push( { buffer: buffer, object: object, + opaque: { list: [], count: 0 }, + transparent: { list: [], count: 0 }, + root: root + } ); + + objmap[ id ] = 1; + + } + + }; + + function add_buffer_immediate( objlist, objmap, id, object, root ) { + + if ( objmap[ id ] == undefined ) { + + objlist.push( { object: object, + opaque: { list: [], count: 0 }, + transparent: { list: [], count: 0 }, + root: root + } ); + + objmap[ id ] = 1; + + } + + }; + this.initWebGLObjects = function( scene, camera ) { - function add_buffer( objmap, id, buffer, object ) { - - if ( objmap[ id ] == undefined ) { - - scene.__webGLObjects.push( { buffer: buffer, object: object, - opaque: { list: [], count: 0 }, - transparent: { list: [], count: 0 } - } ); - objmap[ id ] = 1; - - } - - }; - - function add_buffer_immediate( objmap, id, object ) { - - if ( objmap[ id ] == undefined ) { - - scene.__webGLObjectsImmediate.push( { object: object, - opaque: { list: [], count: 0 }, - transparent: { list: [], count: 0 } - } ); - objmap[ id ] = 1; - - } - - }; - - var o, ol, object, g, geometry, geometryChunk, objmap; + var o, ol, object; if ( !scene.__webGLObjects ) { @@ -1691,128 +1864,14 @@ THREE.WebGLRenderer = function ( parameters ) { scene.__webGLObjectsImmediate = []; } - + for ( o = 0, ol = scene.objects.length; o < ol; o++ ) { object = scene.objects[ o ]; - geometry = object.geometry; - - if ( scene.__webGLObjectsMap[ object.id ] == undefined ) { - - scene.__webGLObjectsMap[ object.id ] = {}; - - object._modelViewMatrix = new THREE.Matrix4(); - - object._normalMatrixArray = new Float32Array( 9 ); - object._modelViewMatrixArray = new Float32Array( 16 ); - object._objectMatrixArray = new Float32Array( 16 ); - - object.matrix.flattenToArray( object._objectMatrixArray ); - - } - - objmap = scene.__webGLObjectsMap[ object.id ]; - - if ( object instanceof THREE.Mesh ) { - - // create separate VBOs per geometry chunk - - for ( g in geometry.geometryChunks ) { - - geometryChunk = geometry.geometryChunks[ g ]; - - // initialise VBO on the first access - - if( ! geometryChunk.__webGLVertexBuffer ) { - - this.createMeshBuffers( geometryChunk ); - this.initMeshBuffers( geometryChunk, object ); - - geometry.__dirtyVertices = true; - geometry.__dirtyElements = true; - geometry.__dirtyUvs = true; - geometry.__dirtyNormals = true; - geometry.__dirtyTangents = true; - geometry.__dirtyColors = true; - - } - - if( geometry.__dirtyVertices || geometry.__dirtyElements || - geometry.__dirtyUvs || geometry.__dirtyNormals || - geometry.__dirtyColors || geometry.__dirtyTangents ) { - - this.setMeshBuffers( geometryChunk, object, _gl.DYNAMIC_DRAW ); - - } - - // create separate wrapper per each use of VBO - - add_buffer( objmap, g, geometryChunk, object ); - - } - - geometry.__dirtyVertices = false; - geometry.__dirtyElements = false; - geometry.__dirtyUvs = false; - geometry.__dirtyNormals = false; - geometry.__dirtyTangents = false; - geometry.__dirtyColors = false; - - } else if ( object instanceof THREE.Line ) { - - - if( ! geometry.__webGLVertexBuffer ) { - - this.createLineBuffers( geometry ); - this.initLineBuffers( geometry ); - - geometry.__dirtyVertices = true; - geometry.__dirtyColors = true; - - } - - if( geometry.__dirtyVertices || geometry.__dirtyColors ) { - - this.setLineBuffers( geometry, _gl.DYNAMIC_DRAW ); - - } - - add_buffer( objmap, 0, geometry, object ); - - geometry.__dirtyVertices = false; - geometry.__dirtyColors = false; - - } else if ( object instanceof THREE.ParticleSystem ) { - - if( ! geometry.__webGLVertexBuffer ) { - - this.createParticleBuffers( geometry ); - this.initParticleBuffers( geometry ); - - geometry.__dirtyVertices = true; - geometry.__dirtyColors = true; - - } - - if( geometry.__dirtyVertices || geometry.__dirtyColors || object.sortParticles ) { - - this.setParticleBuffers( geometry, _gl.DYNAMIC_DRAW, object, camera ); - - } - - add_buffer( objmap, 0, geometry, object ); - - geometry.__dirtyVertices = false; - geometry.__dirtyColors = false; - - } else if ( object instanceof THREE.MarchingCubes ) { - - add_buffer_immediate( objmap, 0, object ); - - }/*else if ( object instanceof THREE.Particle ) { - - }*/ + addObject( scene, object, true ); + addChildren( scene, object ); + } }; @@ -1835,9 +1894,9 @@ THREE.WebGLRenderer = function ( parameters ) { }; - this.setupMatrices = function ( object, camera ) { + function setupMatrices ( object, camera ) { - object._modelViewMatrix.multiplyToArray( camera.matrix, object.matrix, object._modelViewMatrixArray ); + object._modelViewMatrix.multiplyToArray( camera.matrix, object.matrixWorld, object._modelViewMatrixArray ); object._normalMatrix = THREE.Matrix4.makeInvert3x3( object._modelViewMatrix ).transposeIntoArray( object._normalMatrixArray ); };