Browse Source

Fixed Matrix4::setRotationFromEuler (using x,y,z order).

Mr.doob 14 years ago
parent
commit
059d0d7df2

File diff suppressed because it is too large
+ 0 - 300
build/Three.js


+ 56 - 55
build/custom/ThreeCanvas.js

@@ -13,7 +13,7 @@ this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,c,d){this.x=a||
 THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||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,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,h){return f.distance-h.distance});return e},intersectObject:function(a){function b(r,k,F,B){B=B.clone().subSelf(k);F=F.clone().subSelf(k);var J=r.clone().subSelf(k);r=B.dot(B);k=B.dot(F);B=B.dot(J);var G=F.dot(F);F=F.dot(J);J=1/(r*G-k*k);G=(G*B-k*F)*J;r=(r*F-k*B)*J;return G>0&&r>0&&G+r<1}var c,d,e,f,h,j,g,i,m,n,
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,h){return f.distance-h.distance});return e},intersectObject:function(a){function b(r,k,E,D){D=D.clone().subSelf(k);E=E.clone().subSelf(k);var J=r.clone().subSelf(k);r=D.dot(D);k=D.dot(E);D=D.dot(J);var F=E.dot(E);E=E.dot(J);J=1/(r*F-k*k);F=(F*D-k*E)*J;r=(r*E-k*D)*J;return F>0&&r>0&&F+r<1}var c,d,e,f,h,j,g,i,m,n,
 o,p=a.geometry,t=p.vertices,u=[];c=0;for(d=p.faces.length;c<d;c++){e=p.faces[c];n=this.origin.clone();o=this.direction.clone();g=a.globalMatrix;g.extractRotationMatrix(a.matrixRotation);f=g.multiplyVector3(t[e.a].position.clone());h=g.multiplyVector3(t[e.b].position.clone());j=g.multiplyVector3(t[e.c].position.clone());g=e instanceof THREE.Face4?g.multiplyVector3(t[e.d].position.clone()):null;i=a.matrixRotation.multiplyVector3(e.normal.clone());m=o.dot(i);if(m<0){i=i.dot((new THREE.Vector3).sub(f,
 n))/m;n=n.addSelf(o.multiplyScalar(i));if(e instanceof THREE.Face3){if(b(n,f,h,j)){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};u.push(e)}}else if(e instanceof THREE.Face4&&(b(n,f,h,g)||b(n,h,j,g))){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};u.push(e)}}}return u}};
 THREE.Rectangle=function(){function a(){f=d-b;h=e-c}var b,c,d,e,f,h,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,i,m,n){j=!1;b=g;c=i;d=m;e=n;a()};this.addPoint=function(g,i){if(j){j=!1;b=g;c=i;d=g;e=i}else{b=b<g?b:g;c=c<i?c:i;d=d>g?d:g;e=e>i?e:i}a()};
@@ -25,29 +25,30 @@ THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n
 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 d=THREE.Matrix4.__tmpVec1,e=THREE.Matrix4.__tmpVec2,f=THREE.Matrix4.__tmpVec3;f.sub(a,b).normalize();d.cross(c,f).normalize();e.cross(f,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=e.x;this.n22=e.y;this.n23=e.z;this.n24=-e.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,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*
 a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;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,d=a.n12,e=a.n13,f=a.n14,h=a.n21,j=a.n22,g=a.n23,i=a.n24,m=a.n31,n=a.n32,o=a.n33,p=a.n34,t=a.n41,u=a.n42,r=a.n43,k=a.n44,F=b.n11,B=b.n12,J=b.n13,G=b.n14,N=b.n21,C=b.n22,z=b.n23,K=b.n24,y=b.n31,L=b.n32,D=b.n33,w=b.n34,s=b.n41,O=b.n42,v=b.n43,P=b.n44;this.n11=c*F+d*N+e*y+f*s;this.n12=c*B+d*C+e*L+f*O;this.n13=c*J+d*z+e*D+f*v;this.n14=c*G+d*K+e*w+f*P;this.n21=h*F+j*N+g*y+i*s;this.n22=h*B+j*C+g*L+i*O;this.n23=h*J+
-j*z+g*D+i*v;this.n24=h*G+j*K+g*w+i*P;this.n31=m*F+n*N+o*y+p*s;this.n32=m*B+n*C+o*L+p*O;this.n33=m*J+n*z+o*D+p*v;this.n34=m*G+n*K+o*w+p*P;this.n41=t*F+u*N+r*y+k*s;this.n42=t*B+u*C+r*L+k*O;this.n43=t*J+u*z+r*D+k*v;this.n44=t*G+u*K+r*w+k*P;return this},multiplyToArray:function(a,b,c){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,j=a.n21,g=a.n22,i=a.n23,m=a.n24,n=a.n31,o=a.n32,p=a.n33,t=a.n34,u=a.n41,r=a.n42,k=a.n43;a=a.n44;var F=b.n11,B=b.n12,J=b.n13,G=b.n14,N=b.n21,C=b.n22,z=b.n23,K=b.n24,y=b.n31,L=b.n32,D=b.n33,
-w=b.n34,s=b.n41,O=b.n42,v=b.n43;b=b.n44;this.n11=d*F+e*N+f*y+h*s;this.n12=d*B+e*C+f*L+h*O;this.n13=d*J+e*z+f*D+h*v;this.n14=d*G+e*K+f*w+h*b;this.n21=j*F+g*N+i*y+m*s;this.n22=j*B+g*C+i*L+m*O;this.n23=j*J+g*z+i*D+m*v;this.n24=j*G+g*K+i*w+m*b;this.n31=n*F+o*N+p*y+t*s;this.n32=n*B+o*C+p*L+t*O;this.n33=n*J+o*z+p*D+t*v;this.n34=n*G+o*K+p*w+t*b;this.n41=u*F+r*N+k*y+a*s;this.n42=u*B+r*C+k*L+a*O;this.n43=u*J+r*z+k*D+a*v;this.n44=u*G+r*K+k*w+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,d=this.n13,e=this.n14,f=this.n21,h=this.n22,j=this.n23,g=this.n24,i=this.n31,m=this.n32,n=this.n33,o=this.n34,p=this.n41,t=this.n42,u=this.n43,r=this.n44,k=a.n11,F=a.n21,B=a.n31,J=a.n41,G=a.n12,N=a.n22,C=a.n32,z=a.n42,K=a.n13,y=a.n23,L=a.n33,D=a.n43,w=a.n14,s=a.n24,O=
-a.n34;a=a.n44;this.n11=b*k+c*F+d*B+e*J;this.n12=b*G+c*N+d*C+e*z;this.n13=b*K+c*y+d*L+e*D;this.n14=b*w+c*s+d*O+e*a;this.n21=f*k+h*F+j*B+g*J;this.n22=f*G+h*N+j*C+g*z;this.n23=f*K+h*y+j*L+g*D;this.n24=f*w+h*s+j*O+g*a;this.n31=i*k+m*F+n*B+o*J;this.n32=i*G+m*N+n*C+o*z;this.n33=i*K+m*y+n*L+o*D;this.n34=i*w+m*s+n*O+o*a;this.n41=p*k+t*F+u*B+r*J;this.n42=p*G+t*N+u*C+r*z;this.n43=p*K+t*y+u*L+r*D;this.n44=p*w+t*s+u*O+r*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;
+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,d=a.n12,e=a.n13,f=a.n14,h=a.n21,j=a.n22,g=a.n23,i=a.n24,m=a.n31,n=a.n32,o=a.n33,p=a.n34,t=a.n41,u=a.n42,r=a.n43,k=a.n44,E=b.n11,D=b.n12,J=b.n13,F=b.n14,N=b.n21,B=b.n22,z=b.n23,K=b.n24,x=b.n31,L=b.n32,C=b.n33,w=b.n34,s=b.n41,O=b.n42,v=b.n43,P=b.n44;this.n11=c*E+d*N+e*x+f*s;this.n12=c*D+d*B+e*L+f*O;this.n13=c*J+d*z+e*C+f*v;this.n14=c*F+d*K+e*w+f*P;this.n21=h*E+j*N+g*x+i*s;this.n22=h*D+j*B+g*L+i*O;this.n23=h*J+
+j*z+g*C+i*v;this.n24=h*F+j*K+g*w+i*P;this.n31=m*E+n*N+o*x+p*s;this.n32=m*D+n*B+o*L+p*O;this.n33=m*J+n*z+o*C+p*v;this.n34=m*F+n*K+o*w+p*P;this.n41=t*E+u*N+r*x+k*s;this.n42=t*D+u*B+r*L+k*O;this.n43=t*J+u*z+r*C+k*v;this.n44=t*F+u*K+r*w+k*P;return this},multiplyToArray:function(a,b,c){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,j=a.n21,g=a.n22,i=a.n23,m=a.n24,n=a.n31,o=a.n32,p=a.n33,t=a.n34,u=a.n41,r=a.n42,k=a.n43;a=a.n44;var E=b.n11,D=b.n12,J=b.n13,F=b.n14,N=b.n21,B=b.n22,z=b.n23,K=b.n24,x=b.n31,L=b.n32,C=b.n33,
+w=b.n34,s=b.n41,O=b.n42,v=b.n43;b=b.n44;this.n11=d*E+e*N+f*x+h*s;this.n12=d*D+e*B+f*L+h*O;this.n13=d*J+e*z+f*C+h*v;this.n14=d*F+e*K+f*w+h*b;this.n21=j*E+g*N+i*x+m*s;this.n22=j*D+g*B+i*L+m*O;this.n23=j*J+g*z+i*C+m*v;this.n24=j*F+g*K+i*w+m*b;this.n31=n*E+o*N+p*x+t*s;this.n32=n*D+o*B+p*L+t*O;this.n33=n*J+o*z+p*C+t*v;this.n34=n*F+o*K+p*w+t*b;this.n41=u*E+r*N+k*x+a*s;this.n42=u*D+r*B+k*L+a*O;this.n43=u*J+r*z+k*C+a*v;this.n44=u*F+r*K+k*w+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,d=this.n13,e=this.n14,f=this.n21,h=this.n22,j=this.n23,g=this.n24,i=this.n31,m=this.n32,n=this.n33,o=this.n34,p=this.n41,t=this.n42,u=this.n43,r=this.n44,k=a.n11,E=a.n21,D=a.n31,J=a.n41,F=a.n12,N=a.n22,B=a.n32,z=a.n42,K=a.n13,x=a.n23,L=a.n33,C=a.n43,w=a.n14,s=a.n24,O=
+a.n34;a=a.n44;this.n11=b*k+c*E+d*D+e*J;this.n12=b*F+c*N+d*B+e*z;this.n13=b*K+c*x+d*L+e*C;this.n14=b*w+c*s+d*O+e*a;this.n21=f*k+h*E+j*D+g*J;this.n22=f*F+h*N+j*B+g*z;this.n23=f*K+h*x+j*L+g*C;this.n24=f*w+h*s+j*O+g*a;this.n31=i*k+m*E+n*D+o*J;this.n32=i*F+m*N+n*B+o*z;this.n33=i*K+m*x+n*L+o*C;this.n34=i*w+m*s+n*O+o*a;this.n41=p*k+t*E+u*D+r*J;this.n42=p*F+t*N+u*B+r*z;this.n43=p*K+t*x+u*L+r*C;this.n44=p*w+t*s+u*O+r*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,d=this.n14,e=this.n21,f=this.n22,h=this.n23,j=this.n24,g=this.n31,i=this.n32,m=this.n33,n=this.n34,o=this.n41,p=this.n42,t=this.n43,u=this.n44;return d*h*i*o-c*j*i*o-d*f*m*o+b*j*m*o+c*f*n*o-b*h*n*o-d*h*g*p+c*j*g*p+d*e*m*p-a*j*m*p-c*e*n*p+a*h*n*p+d*f*g*t-b*j*g*t-d*e*i*t+a*j*i*t+b*e*n*
 t-a*f*n*t-c*f*g*u+b*h*g*u+c*e*i*u-a*h*i*u-b*e*m*u+a*f*m*u},transpose:function(){function a(b,c,d){var e=b[c];b[c]=b[d];b[d]=e}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},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,
 0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},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),d=Math.sin(b),e=1-c,f=a.x,h=a.y,j=a.z,g=e*f,i=e*h;this.set(g*f+c,g*h-d*j,g*j+d*h,0,g*h+d*j,
-i*h+c,i*j-d*f,0,g*j-d*h,i*j+d*f,e*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var e=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(b);b=Math.sin(b);var h=a*d,j=c*d;this.n11=a*e;this.n12=c*b-h*f;this.n13=h*b+c*f;this.n21=d;this.n22=e*f;this.n23=-e*b;this.n31=-c*e;this.n32=j*f+a*b;this.n33=-j*b+a*f},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=
+i*h+c,i*j-d*f,0,g*j-d*h,i*j+d*f,e*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var h=a*c,j=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=j*f+a*d;this.n22=-j*d+a*f;this.n23=-b*e;this.n31=-h*f+b*d;this.n32=h*d+b*f;this.n33=a*e},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=
 a.w,f=b+b,h=c+c,j=d+d;a=b*f;var g=b*h;b*=j;var i=c*h;c*=j;d*=j;f*=e;h*=e;e*=j;this.n11=1-(i+d);this.n12=g-e;this.n13=b+h;this.n21=g+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-h;this.n32=c+f;this.n33=1-(a+i)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;
-a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},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 d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};
-THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};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};
+a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},extractPositionVector:function(a){a.x=this.n14;a.y=this.n24;a.z=this.n34},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 d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};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,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,h=a.n21,j=a.n22,g=a.n23,i=a.n24,m=a.n31,n=a.n32,o=a.n33,p=a.n34,t=a.n41,u=a.n42,r=a.n43,k=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=g*p*u-i*o*u+i*n*r-j*p*r-g*n*k+j*o*k;b.n12=f*o*u-e*p*u-f*n*r+d*p*r+e*n*k-d*o*k;b.n13=e*i*u-f*g*u+f*j*r-d*i*r-e*j*k+d*g*k;b.n14=f*g*n-e*i*n-f*j*o+d*i*o+e*j*p-d*g*p;b.n21=i*o*t-g*p*t-i*m*r+h*p*r+g*m*k-h*o*k;b.n22=e*p*t-f*o*t+f*m*r-c*p*r-e*m*k+c*o*k;b.n23=f*g*t-e*i*t-f*h*r+c*i*r+e*h*k-c*g*k;
 b.n24=e*i*m-f*g*m+f*h*o-c*i*o-e*h*p+c*g*p;b.n31=j*p*t-i*n*t+i*m*u-h*p*u-j*m*k+h*n*k;b.n32=f*n*t-d*p*t-f*m*u+c*p*u+d*m*k-c*n*k;b.n33=e*i*t-f*j*t+f*h*u-c*i*u-d*h*k+c*j*k;b.n34=f*j*m-d*i*m-f*h*n+c*i*n+d*h*p-c*j*p;b.n41=g*n*t-j*o*t-g*m*u+h*o*u+j*m*r-h*n*r;b.n42=d*o*t-e*n*t+e*m*u-c*o*u-d*m*r+c*n*r;b.n43=e*j*t-d*g*t-e*h*u+c*g*u+d*h*r-c*j*r;b.n44=d*g*m-e*j*m+e*h*n-c*g*n-d*h*o+c*j*o;b.multiplyScalar(1/a.determinant());return b};
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-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,j=a.n33*a.n11-a.n31*a.n13,g=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*i;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*h;c[4]=a*j;c[5]=a*g;c[6]=a*i;c[7]=a*m;c[8]=a*n;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var h;h=new THREE.Matrix4;h.n11=2*e/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*e/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(f+e)/(f-e);h.n34=-2*f*e/(f-e);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var h,j,g,i;h=new THREE.Matrix4;j=b-a;g=c-d;i=f-e;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((b+a)/j);h.n21=0;h.n22=2/g;h.n23=0;h.n24=-((c+d)/g);h.n31=0;h.n32=0;h.n33=-2/i;h.n34=-((f+e)/i);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.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrixRotation=new THREE.Matrix4;this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=
-1;this.visible=!0};THREE.Object3D.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)}};
-THREE.Object3D.prototype.updateMatrix=function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.localMatrix.setRotationFromQuaternion(this.quaternion):this.localMatrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0};
-THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}};THREE.Object3DCounter={value:0};
+1;this.visible=!0};
+THREE.Object3D.prototype={update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)}},updateMatrix:function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.localMatrix.setRotationFromQuaternion(this.quaternion):this.localMatrix.setRotationFromEuler(this.rotation);
+if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}}};THREE.Object3DCounter={value:0};
 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=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
 THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];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};
@@ -56,16 +57,16 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,f,h,j=new THREE.Vector3,g=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){f=this.vertices[d];f.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];if(a&&f.vertexNormals.length){j.set(0,0,0);b=0;for(c=f.normal.length;b<c;b++)j.addSelf(f.vertexNormals[b]);j.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];h=this.vertices[f.c];j.sub(h.position,
 c.position);g.sub(b.position,c.position);j.crossSelf(g)}j.isZero()||j.normalize();f.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(w,s,O,v,P,ca,E){f=w.vertices[s].position;h=w.vertices[O].position;j=w.vertices[v].position;g=e[P];i=e[ca];m=e[E];n=h.x-f.x;o=j.x-f.x;p=h.y-f.y;t=j.y-f.y;
-u=h.z-f.z;r=j.z-f.z;k=i.u-g.u;F=m.u-g.u;B=i.v-g.v;J=m.v-g.v;G=1/(k*J-F*B);z.set((J*n-B*o)*G,(J*p-B*t)*G,(J*u-B*r)*G);K.set((k*o-F*n)*G,(k*t-F*p)*G,(k*r-F*u)*G);N[s].addSelf(z);N[O].addSelf(z);N[v].addSelf(z);C[s].addSelf(K);C[O].addSelf(K);C[v].addSelf(K)}var b,c,d,e,f,h,j,g,i,m,n,o,p,t,u,r,k,F,B,J,G,N=[],C=[],z=new THREE.Vector3,K=new THREE.Vector3,y=new THREE.Vector3,L=new THREE.Vector3,D=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){N[b]=new THREE.Vector3;C[b]=new THREE.Vector3}b=0;
+b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(w,s,O,v,P,Y,H){f=w.vertices[s].position;h=w.vertices[O].position;j=w.vertices[v].position;g=e[P];i=e[Y];m=e[H];n=h.x-f.x;o=j.x-f.x;p=h.y-f.y;t=j.y-f.y;
+u=h.z-f.z;r=j.z-f.z;k=i.u-g.u;E=m.u-g.u;D=i.v-g.v;J=m.v-g.v;F=1/(k*J-E*D);z.set((J*n-D*o)*F,(J*p-D*t)*F,(J*u-D*r)*F);K.set((k*o-E*n)*F,(k*t-E*p)*F,(k*r-E*u)*F);N[s].addSelf(z);N[O].addSelf(z);N[v].addSelf(z);B[s].addSelf(K);B[O].addSelf(K);B[v].addSelf(K)}var b,c,d,e,f,h,j,g,i,m,n,o,p,t,u,r,k,E,D,J,F,N=[],B=[],z=new THREE.Vector3,K=new THREE.Vector3,x=new THREE.Vector3,L=new THREE.Vector3,C=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){N[b]=new THREE.Vector3;B[b]=new THREE.Vector3}b=0;
 for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
-this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){D.copy(this.vertices[b].normal);d=N[b];y.copy(d);y.subSelf(D.multiplyScalar(D.dot(d))).normalize();L.cross(this.vertices[b].normal,d);d=L.dot(C[b]);d=d<0?-1:1;this.vertices[b].tangent.set(y.x,y.y,y.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
+this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){C.copy(this.vertices[b].normal);d=N[b];x.copy(d);x.subSelf(C.multiplyScalar(C.dot(d))).normalize();L.cross(this.vertices[b].normal,d);d=L.dot(B[b]);d=d<0?-1:1;this.vertices[b].tangent.set(x.x,x.y,x.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(m){var n=[];b=0;for(c=m.length;b<c;b++)m[b]==undefined?n.push("undefined"):n.push(m[b].id);return n.join("_")}var b,c,d,e,f,h,j,g,i={};d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];
 h=f.materials;j=a(h);i[j]==undefined&&(i[j]={hash:j,counter:0});g=i[j].hash+"_"+i[j].counter;this.geometryChunks[g]==undefined&&(this.geometryChunks[g]={faces:[],materials:h,vertices:0});f=f instanceof THREE.Face3?3:4;if(this.geometryChunks[g].vertices+f>65535){i[j].counter+=1;g=i[j].hash+"_"+i[j].counter;this.geometryChunks[g]==undefined&&(this.geometryChunks[g]={faces:[],materials:h,vertices:0})}this.geometryChunks[g].faces.push(d);this.geometryChunks[g].vertices+=f}},toString:function(){return"THREE.Geometry ( vertices: "+
 this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
-THREE.Camera=function(a,b,c,d,e,f){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=d||2E3;this.screenCenterY=this.screenCenterX=0;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;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.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Camera=function(a,b,c,d,e,f){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=d||2E3;this.screenCenterY=this.screenCenterX=0;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(h,j){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);if(j)this.tmpVec.y=
+0;this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};this.translateZ=function(h,j){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);if(j)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
 this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)};
@@ -100,46 +101,46 @@ THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;th
 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 (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};
 THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;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 (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
-THREE.Texture=function(a,b,c,d,e,f){if(a.getContext)a.loaded=!0;this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=d!==undefined?d:THREE.ClampToEdgeWrapping;this.mag_filter=e!==undefined?e:THREE.LinearFilter;this.min_filter=f!==undefined?f:THREE.LinearMipMapLinearFilter};
+THREE.Texture=function(a,b,c,d,e,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=d!==undefined?d:THREE.ClampToEdgeWrapping;this.mag_filter=e!==undefined?e:THREE.LinearFilter;this.min_filter=f!==undefined?f:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};
 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 (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};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.CubeReflectionMapping=function(){};
 THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 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&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
-THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
-THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};
-THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;
-THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(C,z){return z.z-C.z}function b(C,z){var K=0,y=1,L=C.z+C.w,D=z.z+z.w,w=-C.z+C.w,s=-z.z+z.w;if(L>=0&&D>=0&&w>=0&&s>=0)return!0;else if(L<0&&D<0||w<0&&s<0)return!1;else{if(L<0)K=Math.max(K,L/(L-D));else D<0&&(y=Math.min(y,L/(L-D)));if(w<0)K=Math.max(K,w/(w-s));else s<0&&(y=Math.min(y,w/(w-s)));if(y<K)return!1;else{C.lerpSelf(z,K);z.lerpSelf(C,1-y);return!0}}}var c,d,e=[],f,h,j,g=[],i,m,n=[],o,p,t=[],u=new THREE.Vector4,r=new THREE.Vector4,k=new THREE.Matrix4,F=new THREE.Matrix4,
-B=[],J=new THREE.Vector4,G=new THREE.Vector4,N;this.projectObjects=function(C,z,K){z=[];var y,L,D;d=0;L=C.objects;C=0;for(y=L.length;C<y;C++){D=L[C];var w;if(!(w=!D.visible))if(w=D instanceof THREE.Mesh){a:{w=void 0;for(var s=D.globalMatrix,O=-D.geometry.boundingSphere.radius*Math.max(D.scale.x,Math.max(D.scale.y,D.scale.z)),v=0;v<6;v++){w=B[v].x*s.n14+B[v].y*s.n24+B[v].z*s.n34+B[v].w;if(w<=O){w=!1;break a}}w=!0}w=!w}if(!w){c=e[d]=e[d]||new THREE.RenderableObject;u.copy(D.position);k.multiplyVector3(u);
-c.object=D;c.z=u.z;z.push(c);d++}}K&&z.sort(a);return z};this.projectScene=function(C,z,K){var y=[],L=z.zNear,D=z.zFar,w,s,O,v,P,ca,E,ga,ka,la,ma,Z,Q,I,U,R;j=m=p=0;z.matrixAutoUpdate&&z.update();k.multiply(z.projectionMatrix,z.globalMatrix);B[0]=new THREE.Vector4(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);B[1]=new THREE.Vector4(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);B[2]=new THREE.Vector4(k.n41+k.n21,k.n42+k.n22,k.n43+k.n23,k.n44+k.n24);B[3]=new THREE.Vector4(k.n41-k.n21,k.n42-k.n22,
-k.n43-k.n23,k.n44-k.n24);B[4]=new THREE.Vector4(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);B[5]=new THREE.Vector4(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);w=0;for(ca=B.length;w<ca;w++){E=B[w];E.divideScalar(Math.sqrt(E.x*E.x+E.y*E.y+E.z*E.z))}C.update(undefined,!1,z);ca=this.projectObjects(C,z,!0);C=0;for(w=ca.length;C<w;C++){E=ca[C].object;if(E.visible){E.matrixAutoUpdate&&E.updateMatrix();ga=E.globalMatrix;ga.extractRotationMatrix(E.matrixRotation);ma=E.matrixRotation;ka=E.materials;
-la=E.overdraw;if(E instanceof THREE.Mesh){Z=E.geometry;Q=Z.vertices;s=0;for(O=Q.length;s<O;s++){I=Q[s];I.positionWorld.copy(I.position);ga.multiplyVector3(I.positionWorld);v=I.positionScreen;v.copy(I.positionWorld);k.multiplyVector4(v);v.x/=v.w;v.y/=v.w;I.__visible=v.z>L&&v.z<D}Z=Z.faces;s=0;for(O=Z.length;s<O;s++){I=Z[s];if(I instanceof THREE.Face3){v=Q[I.a];P=Q[I.b];U=Q[I.c];if(v.__visible&&P.__visible&&U.__visible&&(E.doubleSided||E.flipSided!=(U.positionScreen.x-v.positionScreen.x)*(P.positionScreen.y-
-v.positionScreen.y)-(U.positionScreen.y-v.positionScreen.y)*(P.positionScreen.x-v.positionScreen.x)<0)){f=g[j]=g[j]||new THREE.RenderableFace3;f.v1.positionWorld.copy(v.positionWorld);f.v2.positionWorld.copy(P.positionWorld);f.v3.positionWorld.copy(U.positionWorld);f.v1.positionScreen.copy(v.positionScreen);f.v2.positionScreen.copy(P.positionScreen);f.v3.positionScreen.copy(U.positionScreen);f.normalWorld.copy(I.normal);ma.multiplyVector3(f.normalWorld);f.centroidWorld.copy(I.centroid);ga.multiplyVector3(f.centroidWorld);
-f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);U=I.vertexNormals;N=f.vertexNormalsWorld;v=0;for(P=U.length;v<P;v++){R=N[v]=N[v]||new THREE.Vector3;R.copy(U[v]);ma.multiplyVector3(R)}f.z=f.centroidScreen.z;f.meshMaterials=ka;f.faceMaterials=I.materials;f.overdraw=la;if(E.geometry.uvs[s]){f.uvs[0]=E.geometry.uvs[s][0];f.uvs[1]=E.geometry.uvs[s][1];f.uvs[2]=E.geometry.uvs[s][2]}y.push(f);j++}}else if(I instanceof THREE.Face4){v=Q[I.a];P=Q[I.b];U=Q[I.c];R=Q[I.d];if(v.__visible&&
-P.__visible&&U.__visible&&R.__visible&&(E.doubleSided||E.flipSided!=((R.positionScreen.x-v.positionScreen.x)*(P.positionScreen.y-v.positionScreen.y)-(R.positionScreen.y-v.positionScreen.y)*(P.positionScreen.x-v.positionScreen.x)<0||(P.positionScreen.x-U.positionScreen.x)*(R.positionScreen.y-U.positionScreen.y)-(P.positionScreen.y-U.positionScreen.y)*(R.positionScreen.x-U.positionScreen.x)<0))){f=g[j]=g[j]||new THREE.RenderableFace3;f.v1.positionWorld.copy(v.positionWorld);f.v2.positionWorld.copy(P.positionWorld);
-f.v3.positionWorld.copy(R.positionWorld);f.v1.positionScreen.copy(v.positionScreen);f.v2.positionScreen.copy(P.positionScreen);f.v3.positionScreen.copy(R.positionScreen);f.normalWorld.copy(I.normal);ma.multiplyVector3(f.normalWorld);f.centroidWorld.copy(I.centroid);ga.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=ka;f.faceMaterials=I.materials;f.overdraw=la;if(E.geometry.uvs[s]){f.uvs[0]=E.geometry.uvs[s][0];
-f.uvs[1]=E.geometry.uvs[s][1];f.uvs[2]=E.geometry.uvs[s][3]}y.push(f);j++;h=g[j]=g[j]||new THREE.RenderableFace3;h.v1.positionWorld.copy(P.positionWorld);h.v2.positionWorld.copy(U.positionWorld);h.v3.positionWorld.copy(R.positionWorld);h.v1.positionScreen.copy(P.positionScreen);h.v2.positionScreen.copy(U.positionScreen);h.v3.positionScreen.copy(R.positionScreen);h.normalWorld.copy(f.normalWorld);h.centroidWorld.copy(f.centroidWorld);h.centroidScreen.copy(f.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=
-ka;h.faceMaterials=I.materials;h.overdraw=la;if(E.geometry.uvs[s]){h.uvs[0]=E.geometry.uvs[s][1];h.uvs[1]=E.geometry.uvs[s][2];h.uvs[2]=E.geometry.uvs[s][3]}y.push(h);j++}}}}else if(E instanceof THREE.Line){F.multiply(k,ga);Q=E.geometry.vertices;I=Q[0];I.positionScreen.copy(I.position);F.multiplyVector4(I.positionScreen);s=1;for(O=Q.length;s<O;s++){v=Q[s];v.positionScreen.copy(v.position);F.multiplyVector4(v.positionScreen);P=Q[s-1];J.copy(v.positionScreen);G.copy(P.positionScreen);if(b(J,G)){J.multiplyScalar(1/
-J.w);G.multiplyScalar(1/G.w);i=n[m]=n[m]||new THREE.RenderableLine;i.v1.positionScreen.copy(J);i.v2.positionScreen.copy(G);i.z=Math.max(J.z,G.z);i.materials=E.materials;y.push(i);m++}}}else if(E instanceof THREE.Particle){r.set(E.position.x,E.position.y,E.position.z,1);k.multiplyVector4(r);r.z/=r.w;if(r.z>0&&r.z<1){o=t[p]=t[p]||new THREE.RenderableParticle;o.x=r.x/r.w;o.y=r.y/r.w;o.z=r.z;o.rotation=E.rotation.z;o.scale.x=E.scale.x*Math.abs(o.x-(r.x+z.projectionMatrix.n11)/(r.w+z.projectionMatrix.n14));
-o.scale.y=E.scale.y*Math.abs(o.y-(r.y+z.projectionMatrix.n22)/(r.w+z.projectionMatrix.n24));o.materials=E.materials;y.push(o);p++}}}}K&&y.sort(a);return y};this.unprojectVector=function(C,z){var K=THREE.Matrix4.makeInvert(z.globalMatrix);K.multiplySelf(THREE.Matrix4.makeInvert(z.projectionMatrix));K.multiplyVector3(C);return C}};
-THREE.CanvasRenderer=function(){function a(V){if(o!=V)i.globalAlpha=o=V}function b(V){if(p!=V){switch(V){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}p=V}}var c=null,d=new THREE.Projector,e=document.createElement("canvas"),f,h,j,g,i=e.getContext("2d"),m=new THREE.Color(0),n=0,o=1,p=0,t=null,u=null,r=1,k,F,B,J,G,N,C,z,K,y=new THREE.Color,
-L=new THREE.Color,D=new THREE.Color,w=new THREE.Color,s=new THREE.Color,O,v,P,ca,E,ga,ka,la,ma,Z=new THREE.Rectangle,Q=new THREE.Rectangle,I=new THREE.Rectangle,U=!1,R=new THREE.Color,$=new THREE.Color,na=new THREE.Color,oa=new THREE.Color,La=Math.PI*2,S=new THREE.Vector3,ra,sa,Ca,aa,ta,xa,pa=16;ra=document.createElement("canvas");ra.width=ra.height=2;sa=ra.getContext("2d");sa.fillStyle="rgba(0,0,0,1)";sa.fillRect(0,0,2,2);Ca=sa.getImageData(0,0,2,2);aa=Ca.data;ta=document.createElement("canvas");
-ta.width=ta.height=pa;xa=ta.getContext("2d");xa.translate(-pa/2,-pa/2);xa.scale(pa,pa);pa--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(V,da){f=V;h=da;j=f/2;g=h/2;e.width=f;e.height=h;Z.set(-j,-g,j,g);o=1;p=0;u=t=null;r=1};this.setClearColor=function(V,da){m=V;n=da;Q.set(-j,-g,j,g);i.setTransform(1,0,0,-1,j,g);this.clear()};this.setClearColorHex=function(V,da){m.setHex(V);n=da;Q.set(-j,-g,j,g);i.setTransform(1,0,0,-1,j,g);this.clear()};this.clear=
-function(){i.setTransform(1,0,0,-1,j,g);if(!Q.isEmpty()){Q.inflate(1);Q.minSelf(Z);if(m.hex==0&&n==0)i.clearRect(Q.getX(),Q.getY(),Q.getWidth(),Q.getHeight());else{b(THREE.NormalBlending);a(1);i.fillStyle="rgba("+Math.floor(m.r*255)+","+Math.floor(m.g*255)+","+Math.floor(m.b*255)+","+n+")";i.fillRect(Q.getX(),Q.getY(),Q.getWidth(),Q.getHeight())}Q.empty()}};this.render=function(V,da){function Ma(l){var H,A,q,x=l.lights;$.setRGB(0,0,0);na.setRGB(0,0,0);oa.setRGB(0,0,0);l=0;for(H=x.length;l<H;l++){A=
-x[l];q=A.color;if(A instanceof THREE.AmbientLight){$.r+=q.r;$.g+=q.g;$.b+=q.b}else if(A instanceof THREE.DirectionalLight){na.r+=q.r;na.g+=q.g;na.b+=q.b}else if(A instanceof THREE.PointLight){oa.r+=q.r;oa.g+=q.g;oa.b+=q.b}}}function ya(l,H,A,q){var x,M,W,X,Y=l.lights;l=0;for(x=Y.length;l<x;l++){M=Y[l];W=M.color;X=M.intensity;if(M instanceof THREE.DirectionalLight){M=A.dot(M.position)*X;if(M>0){q.r+=W.r*M;q.g+=W.g*M;q.b+=W.b*M}}else if(M instanceof THREE.PointLight){S.sub(M.position,H);S.normalize();
-M=A.dot(S)*X;if(M>0){q.r+=W.r*M;q.g+=W.g*M;q.b+=W.b*M}}}}function Na(l,H,A){if(A.opacity!=0){a(A.opacity);b(A.blending);var q,x,M,W,X,Y;if(A instanceof THREE.ParticleBasicMaterial){if(A.map&&A.map.image.loaded){W=A.map.image;X=W.width>>1;Y=W.height>>1;x=H.scale.x*j;M=H.scale.y*g;A=x*X;q=M*Y;I.set(l.x-A,l.y-q,l.x+A,l.y+q);if(Z.instersects(I)){i.save();i.translate(l.x,l.y);i.rotate(-H.rotation);i.scale(x,-M);i.translate(-X,-Y);i.drawImage(W,0,0);i.restore()}}}else if(A instanceof THREE.ParticleCircleMaterial){if(U){R.r=
-$.r+na.r+oa.r;R.g=$.g+na.g+oa.g;R.b=$.b+na.b+oa.b;y.r=A.color.r*R.r;y.g=A.color.g*R.g;y.b=A.color.b*R.b;y.updateStyleString()}else y.__styleString=A.color.__styleString;A=H.scale.x*j;q=H.scale.y*g;I.set(l.x-A,l.y-q,l.x+A,l.y+q);if(Z.instersects(I)){x=y.__styleString;if(u!=x)i.fillStyle=u=x;i.save();i.translate(l.x,l.y);i.rotate(-H.rotation);i.scale(A,q);i.beginPath();i.arc(0,0,1,0,La,!0);i.closePath();i.fill();i.restore()}}}}function Oa(l,H,A,q){if(q.opacity!=0){a(q.opacity);b(q.blending);i.beginPath();
-i.moveTo(l.positionScreen.x,l.positionScreen.y);i.lineTo(H.positionScreen.x,H.positionScreen.y);i.closePath();if(q instanceof THREE.LineBasicMaterial){y.__styleString=q.color.__styleString;l=q.linewidth;if(r!=l)i.lineWidth=r=l;l=y.__styleString;if(t!=l)i.strokeStyle=t=l;i.stroke();I.inflate(q.linewidth*2)}}}function Ha(l,H,A,q,x,M){if(x.opacity!=0){a(x.opacity);b(x.blending);J=l.positionScreen.x;G=l.positionScreen.y;N=H.positionScreen.x;C=H.positionScreen.y;z=A.positionScreen.x;K=A.positionScreen.y;
-i.beginPath();i.moveTo(J,G);i.lineTo(N,C);i.lineTo(z,K);i.lineTo(J,G);i.closePath();if(x instanceof THREE.MeshBasicMaterial)if(x.map)x.map.image.loaded&&x.map.mapping instanceof THREE.UVMapping&&ua(J,G,N,C,z,K,x.map.image,q.uvs[0].u,q.uvs[0].v,q.uvs[1].u,q.uvs[1].v,q.uvs[2].u,q.uvs[2].v);else if(x.env_map){if(x.env_map.image.loaded&&x.env_map.mapping instanceof THREE.SphericalReflectionMapping){l=da.globalMatrix;S.copy(q.vertexNormalsWorld[0]);ca=(S.x*l.n11+S.y*l.n12+S.z*l.n13)*0.5+0.5;E=-(S.x*l.n21+
-S.y*l.n22+S.z*l.n23)*0.5+0.5;S.copy(q.vertexNormalsWorld[1]);ga=(S.x*l.n11+S.y*l.n12+S.z*l.n13)*0.5+0.5;ka=-(S.x*l.n21+S.y*l.n22+S.z*l.n23)*0.5+0.5;S.copy(q.vertexNormalsWorld[2]);la=(S.x*l.n11+S.y*l.n12+S.z*l.n13)*0.5+0.5;ma=-(S.x*l.n21+S.y*l.n22+S.z*l.n23)*0.5+0.5;ua(J,G,N,C,z,K,x.env_map.image,ca,E,ga,ka,la,ma)}}else x.wireframe?za(x.color.__styleString,x.wireframe_linewidth):Aa(x.color.__styleString);else if(x instanceof THREE.MeshLambertMaterial){if(x.map&&!x.wireframe){x.map.mapping instanceof
-THREE.UVMapping&&ua(J,G,N,C,z,K,x.map.image,q.uvs[0].u,q.uvs[0].v,q.uvs[1].u,q.uvs[1].v,q.uvs[2].u,q.uvs[2].v);b(THREE.SubtractiveBlending)}if(U)if(!x.wireframe&&x.shading==THREE.SmoothShading&&q.vertexNormalsWorld.length==3){L.r=D.r=w.r=$.r;L.g=D.g=w.g=$.g;L.b=D.b=w.b=$.b;ya(M,q.v1.positionWorld,q.vertexNormalsWorld[0],L);ya(M,q.v2.positionWorld,q.vertexNormalsWorld[1],D);ya(M,q.v3.positionWorld,q.vertexNormalsWorld[2],w);s.r=(D.r+w.r)*0.5;s.g=(D.g+w.g)*0.5;s.b=(D.b+w.b)*0.5;P=Ia(L,D,w,s);ua(J,G,
-N,C,z,K,P,0,0,1,0,0,1)}else{R.r=$.r;R.g=$.g;R.b=$.b;ya(M,q.centroidWorld,q.normalWorld,R);y.r=x.color.r*R.r;y.g=x.color.g*R.g;y.b=x.color.b*R.b;y.updateStyleString();x.wireframe?za(y.__styleString,x.wireframe_linewidth):Aa(y.__styleString)}else x.wireframe?za(x.color.__styleString,x.wireframe_linewidth):Aa(x.color.__styleString)}else if(x instanceof THREE.MeshDepthMaterial){O=da.near;v=da.far;L.r=L.g=L.b=1-Da(l.positionScreen.z,O,v);D.r=D.g=D.b=1-Da(H.positionScreen.z,O,v);w.r=w.g=w.b=1-Da(A.positionScreen.z,
-O,v);s.r=(D.r+w.r)*0.5;s.g=(D.g+w.g)*0.5;s.b=(D.b+w.b)*0.5;P=Ia(L,D,w,s);ua(J,G,N,C,z,K,P,0,0,1,0,0,1)}else if(x instanceof THREE.MeshNormalMaterial){y.r=Ea(q.normalWorld.x);y.g=Ea(q.normalWorld.y);y.b=Ea(q.normalWorld.z);y.updateStyleString();x.wireframe?za(y.__styleString,x.wireframe_linewidth):Aa(y.__styleString)}}}function za(l,H){if(t!=l)i.strokeStyle=t=l;if(r!=H)i.lineWidth=r=H;i.stroke();I.inflate(H*2)}function Aa(l){if(u!=l)i.fillStyle=u=l;i.fill()}function ua(l,H,A,q,x,M,W,X,Y,ha,ba,ia,va){var ea,
-ja;ea=W.width-1;ja=W.height-1;X*=ea;Y*=ja;ha*=ea;ba*=ja;ia*=ea;va*=ja;A-=l;q-=H;x-=l;M-=H;ha-=X;ba-=Y;ia-=X;va-=Y;ea=ha*va-ia*ba;if(ea!=0){ja=1/ea;ea=(va*A-ba*x)*ja;ba=(va*q-ba*M)*ja;A=(ha*x-ia*A)*ja;q=(ha*M-ia*q)*ja;l=l-ea*X-A*Y;H=H-ba*X-q*Y;i.save();i.transform(ea,ba,A,q,l,H);i.clip();i.drawImage(W,0,0);i.restore()}}function Ia(l,H,A,q){var x=~~(l.r*255),M=~~(l.g*255);l=~~(l.b*255);var W=~~(H.r*255),X=~~(H.g*255);H=~~(H.b*255);var Y=~~(A.r*255),ha=~~(A.g*255);A=~~(A.b*255);var ba=~~(q.r*255),ia=
-~~(q.g*255);q=~~(q.b*255);aa[0]=x<0?0:x>255?255:x;aa[1]=M<0?0:M>255?255:M;aa[2]=l<0?0:l>255?255:l;aa[4]=W<0?0:W>255?255:W;aa[5]=X<0?0:X>255?255:X;aa[6]=H<0?0:H>255?255:H;aa[8]=Y<0?0:Y>255?255:Y;aa[9]=ha<0?0:ha>255?255:ha;aa[10]=A<0?0:A>255?255:A;aa[12]=ba<0?0:ba>255?255:ba;aa[13]=ia<0?0:ia>255?255:ia;aa[14]=q<0?0:q>255?255:q;sa.putImageData(Ca,0,0);xa.drawImage(ra,0,0);return ta}function Da(l,H,A){l=(l-H)/(A-H);return l*l*(3-2*l)}function Ea(l){l=(l+1)*0.5;return l<0?0:l>1?1:l}function Fa(l,H){var A=
-H.x-l.x,q=H.y-l.y,x=1/Math.sqrt(A*A+q*q);A*=x;q*=x;H.x+=A;H.y+=q;l.x-=A;l.y-=q}var Ba,Ja,T,fa,qa,Ga,Ka,wa;this.autoClear?this.clear():i.setTransform(1,0,0,-1,j,g);c=d.projectScene(V,da,this.sortElements);(U=V.lights.length>0)&&Ma(V);Ba=0;for(Ja=c.length;Ba<Ja;Ba++){T=c[Ba];I.empty();if(T instanceof THREE.RenderableParticle){k=T;k.x*=j;k.y*=g;fa=0;for(qa=T.materials.length;fa<qa;fa++)Na(k,T,T.materials[fa],V)}else if(T instanceof THREE.RenderableLine){k=T.v1;F=T.v2;k.positionScreen.x*=j;k.positionScreen.y*=
-g;F.positionScreen.x*=j;F.positionScreen.y*=g;I.addPoint(k.positionScreen.x,k.positionScreen.y);I.addPoint(F.positionScreen.x,F.positionScreen.y);if(Z.instersects(I)){fa=0;for(qa=T.materials.length;fa<qa;)Oa(k,F,T,T.materials[fa++],V)}}else if(T instanceof THREE.RenderableFace3){k=T.v1;F=T.v2;B=T.v3;k.positionScreen.x*=j;k.positionScreen.y*=g;F.positionScreen.x*=j;F.positionScreen.y*=g;B.positionScreen.x*=j;B.positionScreen.y*=g;if(T.overdraw){Fa(k.positionScreen,F.positionScreen);Fa(F.positionScreen,
-B.positionScreen);Fa(B.positionScreen,k.positionScreen)}I.add3Points(k.positionScreen.x,k.positionScreen.y,F.positionScreen.x,F.positionScreen.y,B.positionScreen.x,B.positionScreen.y);if(Z.instersects(I)){fa=0;for(qa=T.meshMaterials.length;fa<qa;){wa=T.meshMaterials[fa++];if(wa instanceof THREE.MeshFaceMaterial){Ga=0;for(Ka=T.faceMaterials.length;Ga<Ka;)(wa=T.faceMaterials[Ga++])&&Ha(k,F,B,T,wa,V)}else Ha(k,F,B,T,wa,V)}}}Q.addRectangle(I)}i.setTransform(1,0,0,1,0,0)}};
-THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
-THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
+THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.sounds=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
+THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound3D)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};
+THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound3D){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;
+THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
+THREE.Projector=function(){function a(B,z){return z.z-B.z}function b(B,z){var K=0,x=1,L=B.z+B.w,C=z.z+z.w,w=-B.z+B.w,s=-z.z+z.w;if(L>=0&&C>=0&&w>=0&&s>=0)return!0;else if(L<0&&C<0||w<0&&s<0)return!1;else{if(L<0)K=Math.max(K,L/(L-C));else C<0&&(x=Math.min(x,L/(L-C)));if(w<0)K=Math.max(K,w/(w-s));else s<0&&(x=Math.min(x,w/(w-s)));if(x<K)return!1;else{B.lerpSelf(z,K);z.lerpSelf(B,1-x);return!0}}}var c,d,e=[],f,h,j,g=[],i,m,n=[],o,p,t=[],u=new THREE.Vector4,r=new THREE.Vector4,k=new THREE.Matrix4,E=new THREE.Matrix4,
+D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,F=new THREE.Vector4,N;this.projectObjects=function(B,z,K){z=[];var x,L,C;d=0;L=B.objects;B=0;for(x=L.length;B<x;B++){C=L[B];var w;if(!(w=!C.visible))if(w=C instanceof THREE.Mesh){a:{w=void 0;for(var s=C.globalMatrix,O=-C.geometry.boundingSphere.radius*Math.max(C.scale.x,Math.max(C.scale.y,C.scale.z)),v=0;v<6;v++){w=D[v].x*s.n14+D[v].y*s.n24+D[v].z*s.n34+D[v].w;if(w<=
+O){w=!1;break a}}w=!0}w=!w}if(!w){c=e[d]=e[d]||new THREE.RenderableObject;u.copy(C.position);k.multiplyVector3(u);c.object=C;c.z=u.z;z.push(c);d++}}K&&z.sort(a);return z};this.projectScene=function(B,z,K){var x=[],L=z.zNear,C=z.zFar,w,s,O,v,P,Y,H,ga,ka,la,ma,$,Q,I,U,R;j=m=p=0;z.matrixAutoUpdate&&z.update();k.multiply(z.projectionMatrix,z.globalMatrix);D[0].set(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);D[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);D[2].set(k.n41+k.n21,k.n42+k.n22,
+k.n43+k.n23,k.n44+k.n24);D[3].set(k.n41-k.n21,k.n42-k.n22,k.n43-k.n23,k.n44-k.n24);D[4].set(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);D[5].set(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);for(w=0;w<6;w++){Y=D[w];Y.divideScalar(Math.sqrt(Y.x*Y.x+Y.y*Y.y+Y.z*Y.z))}B.update(undefined,!1,z);Y=this.projectObjects(B,z,!0);B=0;for(w=Y.length;B<w;B++){H=Y[B].object;if(H.visible){H.matrixAutoUpdate&&H.updateMatrix();ga=H.globalMatrix;ga.extractRotationMatrix(H.matrixRotation);ma=H.matrixRotation;
+ka=H.materials;la=H.overdraw;if(H instanceof THREE.Mesh){$=H.geometry;Q=$.vertices;s=0;for(O=Q.length;s<O;s++){I=Q[s];I.positionWorld.copy(I.position);ga.multiplyVector3(I.positionWorld);v=I.positionScreen;v.copy(I.positionWorld);k.multiplyVector4(v);v.x/=v.w;v.y/=v.w;I.__visible=v.z>L&&v.z<C}$=$.faces;s=0;for(O=$.length;s<O;s++){I=$[s];if(I instanceof THREE.Face3){v=Q[I.a];P=Q[I.b];U=Q[I.c];if(v.__visible&&P.__visible&&U.__visible&&(H.doubleSided||H.flipSided!=(U.positionScreen.x-v.positionScreen.x)*
+(P.positionScreen.y-v.positionScreen.y)-(U.positionScreen.y-v.positionScreen.y)*(P.positionScreen.x-v.positionScreen.x)<0)){f=g[j]=g[j]||new THREE.RenderableFace3;f.v1.positionWorld.copy(v.positionWorld);f.v2.positionWorld.copy(P.positionWorld);f.v3.positionWorld.copy(U.positionWorld);f.v1.positionScreen.copy(v.positionScreen);f.v2.positionScreen.copy(P.positionScreen);f.v3.positionScreen.copy(U.positionScreen);f.normalWorld.copy(I.normal);ma.multiplyVector3(f.normalWorld);f.centroidWorld.copy(I.centroid);
+ga.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);U=I.vertexNormals;N=f.vertexNormalsWorld;v=0;for(P=U.length;v<P;v++){R=N[v]=N[v]||new THREE.Vector3;R.copy(U[v]);ma.multiplyVector3(R)}f.z=f.centroidScreen.z;f.meshMaterials=ka;f.faceMaterials=I.materials;f.overdraw=la;if(H.geometry.uvs[s]){f.uvs[0]=H.geometry.uvs[s][0];f.uvs[1]=H.geometry.uvs[s][1];f.uvs[2]=H.geometry.uvs[s][2]}x.push(f);j++}}else if(I instanceof THREE.Face4){v=Q[I.a];P=
+Q[I.b];U=Q[I.c];R=Q[I.d];if(v.__visible&&P.__visible&&U.__visible&&R.__visible&&(H.doubleSided||H.flipSided!=((R.positionScreen.x-v.positionScreen.x)*(P.positionScreen.y-v.positionScreen.y)-(R.positionScreen.y-v.positionScreen.y)*(P.positionScreen.x-v.positionScreen.x)<0||(P.positionScreen.x-U.positionScreen.x)*(R.positionScreen.y-U.positionScreen.y)-(P.positionScreen.y-U.positionScreen.y)*(R.positionScreen.x-U.positionScreen.x)<0))){f=g[j]=g[j]||new THREE.RenderableFace3;f.v1.positionWorld.copy(v.positionWorld);
+f.v2.positionWorld.copy(P.positionWorld);f.v3.positionWorld.copy(R.positionWorld);f.v1.positionScreen.copy(v.positionScreen);f.v2.positionScreen.copy(P.positionScreen);f.v3.positionScreen.copy(R.positionScreen);f.normalWorld.copy(I.normal);ma.multiplyVector3(f.normalWorld);f.centroidWorld.copy(I.centroid);ga.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=ka;f.faceMaterials=I.materials;f.overdraw=la;
+if(H.geometry.uvs[s]){f.uvs[0]=H.geometry.uvs[s][0];f.uvs[1]=H.geometry.uvs[s][1];f.uvs[2]=H.geometry.uvs[s][3]}x.push(f);j++;h=g[j]=g[j]||new THREE.RenderableFace3;h.v1.positionWorld.copy(P.positionWorld);h.v2.positionWorld.copy(U.positionWorld);h.v3.positionWorld.copy(R.positionWorld);h.v1.positionScreen.copy(P.positionScreen);h.v2.positionScreen.copy(U.positionScreen);h.v3.positionScreen.copy(R.positionScreen);h.normalWorld.copy(f.normalWorld);h.centroidWorld.copy(f.centroidWorld);h.centroidScreen.copy(f.centroidScreen);
+h.z=h.centroidScreen.z;h.meshMaterials=ka;h.faceMaterials=I.materials;h.overdraw=la;if(H.geometry.uvs[s]){h.uvs[0]=H.geometry.uvs[s][1];h.uvs[1]=H.geometry.uvs[s][2];h.uvs[2]=H.geometry.uvs[s][3]}x.push(h);j++}}}}else if(H instanceof THREE.Line){E.multiply(k,ga);Q=H.geometry.vertices;I=Q[0];I.positionScreen.copy(I.position);E.multiplyVector4(I.positionScreen);s=1;for(O=Q.length;s<O;s++){v=Q[s];v.positionScreen.copy(v.position);E.multiplyVector4(v.positionScreen);P=Q[s-1];J.copy(v.positionScreen);
+F.copy(P.positionScreen);if(b(J,F)){J.multiplyScalar(1/J.w);F.multiplyScalar(1/F.w);i=n[m]=n[m]||new THREE.RenderableLine;i.v1.positionScreen.copy(J);i.v2.positionScreen.copy(F);i.z=Math.max(J.z,F.z);i.materials=H.materials;x.push(i);m++}}}else if(H instanceof THREE.Particle){r.set(H.position.x,H.position.y,H.position.z,1);k.multiplyVector4(r);r.z/=r.w;if(r.z>0&&r.z<1){o=t[p]=t[p]||new THREE.RenderableParticle;o.x=r.x/r.w;o.y=r.y/r.w;o.z=r.z;o.rotation=H.rotation.z;o.scale.x=H.scale.x*Math.abs(o.x-
+(r.x+z.projectionMatrix.n11)/(r.w+z.projectionMatrix.n14));o.scale.y=H.scale.y*Math.abs(o.y-(r.y+z.projectionMatrix.n22)/(r.w+z.projectionMatrix.n24));o.materials=H.materials;x.push(o);p++}}}}K&&x.sort(a);return x};this.unprojectVector=function(B,z){var K=THREE.Matrix4.makeInvert(z.globalMatrix);K.multiplySelf(THREE.Matrix4.makeInvert(z.projectionMatrix));K.multiplyVector3(B);return B}};
+THREE.CanvasRenderer=function(){function a(V){if(o!=V)i.globalAlpha=o=V}function b(V){if(p!=V){switch(V){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}p=V}}var c=null,d=new THREE.Projector,e=document.createElement("canvas"),f,h,j,g,i=e.getContext("2d"),m=new THREE.Color(0),n=0,o=1,p=0,t=null,u=null,r=1,k,E,D,J,F,N,B,z,K,x=new THREE.Color,
+L=new THREE.Color,C=new THREE.Color,w=new THREE.Color,s=new THREE.Color,O,v,P,Y,H,ga,ka,la,ma,$=new THREE.Rectangle,Q=new THREE.Rectangle,I=new THREE.Rectangle,U=!1,R=new THREE.Color,aa=new THREE.Color,na=new THREE.Color,oa=new THREE.Color,La=Math.PI*2,S=new THREE.Vector3,ra,sa,Ca,ba,ta,xa,pa=16;ra=document.createElement("canvas");ra.width=ra.height=2;sa=ra.getContext("2d");sa.fillStyle="rgba(0,0,0,1)";sa.fillRect(0,0,2,2);Ca=sa.getImageData(0,0,2,2);ba=Ca.data;ta=document.createElement("canvas");
+ta.width=ta.height=pa;xa=ta.getContext("2d");xa.translate(-pa/2,-pa/2);xa.scale(pa,pa);pa--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(V,da){f=V;h=da;j=f/2;g=h/2;e.width=f;e.height=h;$.set(-j,-g,j,g);o=1;p=0;u=t=null;r=1};this.setClearColor=function(V,da){m=V;n=da;Q.set(-j,-g,j,g);i.setTransform(1,0,0,-1,j,g);this.clear()};this.setClearColorHex=function(V,da){m.setHex(V);n=da;Q.set(-j,-g,j,g);i.setTransform(1,0,0,-1,j,g);this.clear()};this.clear=
+function(){i.setTransform(1,0,0,-1,j,g);if(!Q.isEmpty()){Q.inflate(1);Q.minSelf($);if(m.hex==0&&n==0)i.clearRect(Q.getX(),Q.getY(),Q.getWidth(),Q.getHeight());else{b(THREE.NormalBlending);a(1);i.fillStyle="rgba("+Math.floor(m.r*255)+","+Math.floor(m.g*255)+","+Math.floor(m.b*255)+","+n+")";i.fillRect(Q.getX(),Q.getY(),Q.getWidth(),Q.getHeight())}Q.empty()}};this.render=function(V,da){function Ma(l){var G,A,q,y=l.lights;aa.setRGB(0,0,0);na.setRGB(0,0,0);oa.setRGB(0,0,0);l=0;for(G=y.length;l<G;l++){A=
+y[l];q=A.color;if(A instanceof THREE.AmbientLight){aa.r+=q.r;aa.g+=q.g;aa.b+=q.b}else if(A instanceof THREE.DirectionalLight){na.r+=q.r;na.g+=q.g;na.b+=q.b}else if(A instanceof THREE.PointLight){oa.r+=q.r;oa.g+=q.g;oa.b+=q.b}}}function ya(l,G,A,q){var y,M,W,X,Z=l.lights;l=0;for(y=Z.length;l<y;l++){M=Z[l];W=M.color;X=M.intensity;if(M instanceof THREE.DirectionalLight){M=A.dot(M.position)*X;if(M>0){q.r+=W.r*M;q.g+=W.g*M;q.b+=W.b*M}}else if(M instanceof THREE.PointLight){S.sub(M.position,G);S.normalize();
+M=A.dot(S)*X;if(M>0){q.r+=W.r*M;q.g+=W.g*M;q.b+=W.b*M}}}}function Na(l,G,A){if(A.opacity!=0){a(A.opacity);b(A.blending);var q,y,M,W,X,Z;if(A instanceof THREE.ParticleBasicMaterial){if(A.map){W=A.map.image;X=W.width>>1;Z=W.height>>1;y=G.scale.x*j;M=G.scale.y*g;A=y*X;q=M*Z;I.set(l.x-A,l.y-q,l.x+A,l.y+q);if($.instersects(I)){i.save();i.translate(l.x,l.y);i.rotate(-G.rotation);i.scale(y,-M);i.translate(-X,-Z);i.drawImage(W,0,0);i.restore()}}}else if(A instanceof THREE.ParticleCircleMaterial){if(U){R.r=
+aa.r+na.r+oa.r;R.g=aa.g+na.g+oa.g;R.b=aa.b+na.b+oa.b;x.r=A.color.r*R.r;x.g=A.color.g*R.g;x.b=A.color.b*R.b;x.updateStyleString()}else x.__styleString=A.color.__styleString;A=G.scale.x*j;q=G.scale.y*g;I.set(l.x-A,l.y-q,l.x+A,l.y+q);if($.instersects(I)){y=x.__styleString;if(u!=y)i.fillStyle=u=y;i.save();i.translate(l.x,l.y);i.rotate(-G.rotation);i.scale(A,q);i.beginPath();i.arc(0,0,1,0,La,!0);i.closePath();i.fill();i.restore()}}}}function Oa(l,G,A,q){if(q.opacity!=0){a(q.opacity);b(q.blending);i.beginPath();
+i.moveTo(l.positionScreen.x,l.positionScreen.y);i.lineTo(G.positionScreen.x,G.positionScreen.y);i.closePath();if(q instanceof THREE.LineBasicMaterial){x.__styleString=q.color.__styleString;l=q.linewidth;if(r!=l)i.lineWidth=r=l;l=x.__styleString;if(t!=l)i.strokeStyle=t=l;i.stroke();I.inflate(q.linewidth*2)}}}function Ha(l,G,A,q,y,M){if(y.opacity!=0){a(y.opacity);b(y.blending);J=l.positionScreen.x;F=l.positionScreen.y;N=G.positionScreen.x;B=G.positionScreen.y;z=A.positionScreen.x;K=A.positionScreen.y;
+i.beginPath();i.moveTo(J,F);i.lineTo(N,B);i.lineTo(z,K);i.lineTo(J,F);i.closePath();if(y instanceof THREE.MeshBasicMaterial)if(y.map)y.map.mapping instanceof THREE.UVMapping&&ua(J,F,N,B,z,K,y.map.image,q.uvs[0].u,q.uvs[0].v,q.uvs[1].u,q.uvs[1].v,q.uvs[2].u,q.uvs[2].v);else if(y.env_map){if(y.env_map.mapping instanceof THREE.SphericalReflectionMapping){l=da.globalMatrix;S.copy(q.vertexNormalsWorld[0]);Y=(S.x*l.n11+S.y*l.n12+S.z*l.n13)*0.5+0.5;H=-(S.x*l.n21+S.y*l.n22+S.z*l.n23)*0.5+0.5;S.copy(q.vertexNormalsWorld[1]);
+ga=(S.x*l.n11+S.y*l.n12+S.z*l.n13)*0.5+0.5;ka=-(S.x*l.n21+S.y*l.n22+S.z*l.n23)*0.5+0.5;S.copy(q.vertexNormalsWorld[2]);la=(S.x*l.n11+S.y*l.n12+S.z*l.n13)*0.5+0.5;ma=-(S.x*l.n21+S.y*l.n22+S.z*l.n23)*0.5+0.5;ua(J,F,N,B,z,K,y.env_map.image,Y,H,ga,ka,la,ma)}}else y.wireframe?za(y.color.__styleString,y.wireframe_linewidth):Aa(y.color.__styleString);else if(y instanceof THREE.MeshLambertMaterial){if(y.map&&!y.wireframe){y.map.mapping instanceof THREE.UVMapping&&ua(J,F,N,B,z,K,y.map.image,q.uvs[0].u,q.uvs[0].v,
+q.uvs[1].u,q.uvs[1].v,q.uvs[2].u,q.uvs[2].v);b(THREE.SubtractiveBlending)}if(U)if(!y.wireframe&&y.shading==THREE.SmoothShading&&q.vertexNormalsWorld.length==3){L.r=C.r=w.r=aa.r;L.g=C.g=w.g=aa.g;L.b=C.b=w.b=aa.b;ya(M,q.v1.positionWorld,q.vertexNormalsWorld[0],L);ya(M,q.v2.positionWorld,q.vertexNormalsWorld[1],C);ya(M,q.v3.positionWorld,q.vertexNormalsWorld[2],w);s.r=(C.r+w.r)*0.5;s.g=(C.g+w.g)*0.5;s.b=(C.b+w.b)*0.5;P=Ia(L,C,w,s);ua(J,F,N,B,z,K,P,0,0,1,0,0,1)}else{R.r=aa.r;R.g=aa.g;R.b=aa.b;ya(M,q.centroidWorld,
+q.normalWorld,R);x.r=y.color.r*R.r;x.g=y.color.g*R.g;x.b=y.color.b*R.b;x.updateStyleString();y.wireframe?za(x.__styleString,y.wireframe_linewidth):Aa(x.__styleString)}else y.wireframe?za(y.color.__styleString,y.wireframe_linewidth):Aa(y.color.__styleString)}else if(y instanceof THREE.MeshDepthMaterial){O=da.near;v=da.far;L.r=L.g=L.b=1-Da(l.positionScreen.z,O,v);C.r=C.g=C.b=1-Da(G.positionScreen.z,O,v);w.r=w.g=w.b=1-Da(A.positionScreen.z,O,v);s.r=(C.r+w.r)*0.5;s.g=(C.g+w.g)*0.5;s.b=(C.b+w.b)*0.5;P=
+Ia(L,C,w,s);ua(J,F,N,B,z,K,P,0,0,1,0,0,1)}else if(y instanceof THREE.MeshNormalMaterial){x.r=Ea(q.normalWorld.x);x.g=Ea(q.normalWorld.y);x.b=Ea(q.normalWorld.z);x.updateStyleString();y.wireframe?za(x.__styleString,y.wireframe_linewidth):Aa(x.__styleString)}}}function za(l,G){if(t!=l)i.strokeStyle=t=l;if(r!=G)i.lineWidth=r=G;i.stroke();I.inflate(G*2)}function Aa(l){if(u!=l)i.fillStyle=u=l;i.fill()}function ua(l,G,A,q,y,M,W,X,Z,ha,ca,ia,va){var ea,ja;ea=W.width-1;ja=W.height-1;X*=ea;Z*=ja;ha*=ea;ca*=
+ja;ia*=ea;va*=ja;A-=l;q-=G;y-=l;M-=G;ha-=X;ca-=Z;ia-=X;va-=Z;ea=ha*va-ia*ca;if(ea!=0){ja=1/ea;ea=(va*A-ca*y)*ja;ca=(va*q-ca*M)*ja;A=(ha*y-ia*A)*ja;q=(ha*M-ia*q)*ja;l=l-ea*X-A*Z;G=G-ca*X-q*Z;i.save();i.transform(ea,ca,A,q,l,G);i.clip();i.drawImage(W,0,0);i.restore()}}function Ia(l,G,A,q){var y=~~(l.r*255),M=~~(l.g*255);l=~~(l.b*255);var W=~~(G.r*255),X=~~(G.g*255);G=~~(G.b*255);var Z=~~(A.r*255),ha=~~(A.g*255);A=~~(A.b*255);var ca=~~(q.r*255),ia=~~(q.g*255);q=~~(q.b*255);ba[0]=y<0?0:y>255?255:y;ba[1]=
+M<0?0:M>255?255:M;ba[2]=l<0?0:l>255?255:l;ba[4]=W<0?0:W>255?255:W;ba[5]=X<0?0:X>255?255:X;ba[6]=G<0?0:G>255?255:G;ba[8]=Z<0?0:Z>255?255:Z;ba[9]=ha<0?0:ha>255?255:ha;ba[10]=A<0?0:A>255?255:A;ba[12]=ca<0?0:ca>255?255:ca;ba[13]=ia<0?0:ia>255?255:ia;ba[14]=q<0?0:q>255?255:q;sa.putImageData(Ca,0,0);xa.drawImage(ra,0,0);return ta}function Da(l,G,A){l=(l-G)/(A-G);return l*l*(3-2*l)}function Ea(l){l=(l+1)*0.5;return l<0?0:l>1?1:l}function Fa(l,G){var A=G.x-l.x,q=G.y-l.y,y=1/Math.sqrt(A*A+q*q);A*=y;q*=y;G.x+=
+A;G.y+=q;l.x-=A;l.y-=q}var Ba,Ja,T,fa,qa,Ga,Ka,wa;this.autoClear?this.clear():i.setTransform(1,0,0,-1,j,g);c=d.projectScene(V,da,this.sortElements);(U=V.lights.length>0)&&Ma(V);Ba=0;for(Ja=c.length;Ba<Ja;Ba++){T=c[Ba];I.empty();if(T instanceof THREE.RenderableParticle){k=T;k.x*=j;k.y*=g;fa=0;for(qa=T.materials.length;fa<qa;fa++)Na(k,T,T.materials[fa],V)}else if(T instanceof THREE.RenderableLine){k=T.v1;E=T.v2;k.positionScreen.x*=j;k.positionScreen.y*=g;E.positionScreen.x*=j;E.positionScreen.y*=g;
+I.addPoint(k.positionScreen.x,k.positionScreen.y);I.addPoint(E.positionScreen.x,E.positionScreen.y);if($.instersects(I)){fa=0;for(qa=T.materials.length;fa<qa;)Oa(k,E,T,T.materials[fa++],V)}}else if(T instanceof THREE.RenderableFace3){k=T.v1;E=T.v2;D=T.v3;k.positionScreen.x*=j;k.positionScreen.y*=g;E.positionScreen.x*=j;E.positionScreen.y*=g;D.positionScreen.x*=j;D.positionScreen.y*=g;if(T.overdraw){Fa(k.positionScreen,E.positionScreen);Fa(E.positionScreen,D.positionScreen);Fa(D.positionScreen,k.positionScreen)}I.add3Points(k.positionScreen.x,
+k.positionScreen.y,E.positionScreen.x,E.positionScreen.y,D.positionScreen.x,D.positionScreen.y);if($.instersects(I)){fa=0;for(qa=T.meshMaterials.length;fa<qa;){wa=T.meshMaterials[fa++];if(wa instanceof THREE.MeshFaceMaterial){Ga=0;for(Ka=T.faceMaterials.length;Ga<Ka;)(wa=T.faceMaterials[Ga++])&&Ha(k,E,D,T,wa,V)}else Ha(k,E,D,T,wa,V)}}}Q.addRectangle(I)}i.setTransform(1,0,0,1,0,0)}};THREE.RenderableObject=function(){this.z=this.object=null};
+THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};
+THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};

+ 31 - 30
build/custom/ThreeDOM.js

@@ -25,56 +25,57 @@ THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n
 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,d=THREE.Matrix4.__tmpVec2,f=THREE.Matrix4.__tmpVec3;f.sub(a,b).normalize();e.cross(c,f).normalize();d.cross(f,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=d.x;this.n22=d.y;this.n23=d.z;this.n24=-d.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,d=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)*d;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*d;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*d;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*
 a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,d=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*d;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*d;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*d;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*d;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,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,m=a.n31,n=a.n32,l=a.n33,o=a.n34,q=a.n41,r=a.n42,p=a.n43,k=a.n44,C=b.n11,y=b.n12,F=b.n13,G=b.n14,J=b.n21,x=b.n22,v=b.n23,D=b.n24,A=b.n31,E=b.n32,z=b.n33,w=b.n34,t=b.n41,I=b.n42,s=b.n43,H=b.n44;this.n11=c*C+e*J+d*A+f*t;this.n12=c*y+e*x+d*E+f*I;this.n13=c*F+e*v+d*z+f*s;this.n14=c*G+e*D+d*w+f*H;this.n21=g*C+i*J+h*A+j*t;this.n22=g*y+i*x+h*E+j*I;this.n23=g*F+
-i*v+h*z+j*s;this.n24=g*G+i*D+h*w+j*H;this.n31=m*C+n*J+l*A+o*t;this.n32=m*y+n*x+l*E+o*I;this.n33=m*F+n*v+l*z+o*s;this.n34=m*G+n*D+l*w+o*H;this.n41=q*C+r*J+p*A+k*t;this.n42=q*y+r*x+p*E+k*I;this.n43=q*F+r*v+p*z+k*s;this.n44=q*G+r*D+p*w+k*H;return this},multiplyToArray:function(a,b,c){var e=a.n11,d=a.n12,f=a.n13,g=a.n14,i=a.n21,h=a.n22,j=a.n23,m=a.n24,n=a.n31,l=a.n32,o=a.n33,q=a.n34,r=a.n41,p=a.n42,k=a.n43;a=a.n44;var C=b.n11,y=b.n12,F=b.n13,G=b.n14,J=b.n21,x=b.n22,v=b.n23,D=b.n24,A=b.n31,E=b.n32,z=b.n33,
-w=b.n34,t=b.n41,I=b.n42,s=b.n43;b=b.n44;this.n11=e*C+d*J+f*A+g*t;this.n12=e*y+d*x+f*E+g*I;this.n13=e*F+d*v+f*z+g*s;this.n14=e*G+d*D+f*w+g*b;this.n21=i*C+h*J+j*A+m*t;this.n22=i*y+h*x+j*E+m*I;this.n23=i*F+h*v+j*z+m*s;this.n24=i*G+h*D+j*w+m*b;this.n31=n*C+l*J+o*A+q*t;this.n32=n*y+l*x+o*E+q*I;this.n33=n*F+l*v+o*z+q*s;this.n34=n*G+l*D+o*w+q*b;this.n41=r*C+p*J+k*A+a*t;this.n42=r*y+p*x+k*E+a*I;this.n43=r*F+p*v+k*z+a*s;this.n44=r*G+p*D+k*w+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,d=this.n14,f=this.n21,g=this.n22,i=this.n23,h=this.n24,j=this.n31,m=this.n32,n=this.n33,l=this.n34,o=this.n41,q=this.n42,r=this.n43,p=this.n44,k=a.n11,C=a.n21,y=a.n31,F=a.n41,G=a.n12,J=a.n22,x=a.n32,v=a.n42,D=a.n13,A=a.n23,E=a.n33,z=a.n43,w=a.n14,t=a.n24,I=
-a.n34;a=a.n44;this.n11=b*k+c*C+e*y+d*F;this.n12=b*G+c*J+e*x+d*v;this.n13=b*D+c*A+e*E+d*z;this.n14=b*w+c*t+e*I+d*a;this.n21=f*k+g*C+i*y+h*F;this.n22=f*G+g*J+i*x+h*v;this.n23=f*D+g*A+i*E+h*z;this.n24=f*w+g*t+i*I+h*a;this.n31=j*k+m*C+n*y+l*F;this.n32=j*G+m*J+n*x+l*v;this.n33=j*D+m*A+n*E+l*z;this.n34=j*w+m*t+n*I+l*a;this.n41=o*k+q*C+r*y+p*F;this.n42=o*G+q*J+r*x+p*v;this.n43=o*D+q*A+r*E+p*z;this.n44=o*w+q*t+r*I+p*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;
+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,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,m=a.n31,n=a.n32,l=a.n33,o=a.n34,q=a.n41,r=a.n42,p=a.n43,k=a.n44,C=b.n11,y=b.n12,F=b.n13,G=b.n14,J=b.n21,w=b.n22,u=b.n23,D=b.n24,A=b.n31,E=b.n32,z=b.n33,v=b.n34,t=b.n41,I=b.n42,s=b.n43,H=b.n44;this.n11=c*C+e*J+d*A+f*t;this.n12=c*y+e*w+d*E+f*I;this.n13=c*F+e*u+d*z+f*s;this.n14=c*G+e*D+d*v+f*H;this.n21=g*C+i*J+h*A+j*t;this.n22=g*y+i*w+h*E+j*I;this.n23=g*F+
+i*u+h*z+j*s;this.n24=g*G+i*D+h*v+j*H;this.n31=m*C+n*J+l*A+o*t;this.n32=m*y+n*w+l*E+o*I;this.n33=m*F+n*u+l*z+o*s;this.n34=m*G+n*D+l*v+o*H;this.n41=q*C+r*J+p*A+k*t;this.n42=q*y+r*w+p*E+k*I;this.n43=q*F+r*u+p*z+k*s;this.n44=q*G+r*D+p*v+k*H;return this},multiplyToArray:function(a,b,c){var e=a.n11,d=a.n12,f=a.n13,g=a.n14,i=a.n21,h=a.n22,j=a.n23,m=a.n24,n=a.n31,l=a.n32,o=a.n33,q=a.n34,r=a.n41,p=a.n42,k=a.n43;a=a.n44;var C=b.n11,y=b.n12,F=b.n13,G=b.n14,J=b.n21,w=b.n22,u=b.n23,D=b.n24,A=b.n31,E=b.n32,z=b.n33,
+v=b.n34,t=b.n41,I=b.n42,s=b.n43;b=b.n44;this.n11=e*C+d*J+f*A+g*t;this.n12=e*y+d*w+f*E+g*I;this.n13=e*F+d*u+f*z+g*s;this.n14=e*G+d*D+f*v+g*b;this.n21=i*C+h*J+j*A+m*t;this.n22=i*y+h*w+j*E+m*I;this.n23=i*F+h*u+j*z+m*s;this.n24=i*G+h*D+j*v+m*b;this.n31=n*C+l*J+o*A+q*t;this.n32=n*y+l*w+o*E+q*I;this.n33=n*F+l*u+o*z+q*s;this.n34=n*G+l*D+o*v+q*b;this.n41=r*C+p*J+k*A+a*t;this.n42=r*y+p*w+k*E+a*I;this.n43=r*F+p*u+k*z+a*s;this.n44=r*G+p*D+k*v+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,d=this.n14,f=this.n21,g=this.n22,i=this.n23,h=this.n24,j=this.n31,m=this.n32,n=this.n33,l=this.n34,o=this.n41,q=this.n42,r=this.n43,p=this.n44,k=a.n11,C=a.n21,y=a.n31,F=a.n41,G=a.n12,J=a.n22,w=a.n32,u=a.n42,D=a.n13,A=a.n23,E=a.n33,z=a.n43,v=a.n14,t=a.n24,I=
+a.n34;a=a.n44;this.n11=b*k+c*C+e*y+d*F;this.n12=b*G+c*J+e*w+d*u;this.n13=b*D+c*A+e*E+d*z;this.n14=b*v+c*t+e*I+d*a;this.n21=f*k+g*C+i*y+h*F;this.n22=f*G+g*J+i*w+h*u;this.n23=f*D+g*A+i*E+h*z;this.n24=f*v+g*t+i*I+h*a;this.n31=j*k+m*C+n*y+l*F;this.n32=j*G+m*J+n*w+l*u;this.n33=j*D+m*A+n*E+l*z;this.n34=j*v+m*t+n*I+l*a;this.n41=o*k+q*C+r*y+p*F;this.n42=o*G+q*J+r*w+p*u;this.n43=o*D+q*A+r*E+p*z;this.n44=o*v+q*t+r*I+p*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,d=this.n21,f=this.n22,g=this.n23,i=this.n24,h=this.n31,j=this.n32,m=this.n33,n=this.n34,l=this.n41,o=this.n42,q=this.n43,r=this.n44;return e*g*j*l-c*i*j*l-e*f*m*l+b*i*m*l+c*f*n*l-b*g*n*l-e*g*h*o+c*i*h*o+e*d*m*o-a*i*m*o-c*d*n*o+a*g*n*o+e*f*h*q-b*i*h*q-e*d*j*q+a*i*j*q+b*d*n*
 q-a*f*n*q-c*f*h*r+b*g*h*r+c*d*j*r-a*g*j*r-b*d*m*r+a*f*m*r},transpose:function(){function a(b,c,e){var d=b[c];b[c]=b[e];b[e]=d}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},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,
 0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},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),d=1-c,f=a.x,g=a.y,i=a.z,h=d*f,j=d*g;this.set(h*f+c,h*g-e*i,h*i+e*g,0,h*g+e*i,
-j*g+c,j*i-e*f,0,h*i-e*g,j*i+e*f,d*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var d=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(b);b=Math.sin(b);var g=a*e,i=c*e;this.n11=a*d;this.n12=c*b-g*f;this.n13=g*b+c*f;this.n21=e;this.n22=d*f;this.n23=-d*b;this.n31=-c*d;this.n32=i*f+a*b;this.n33=-i*b+a*f},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,d=
+j*g+c,j*i-e*f,0,h*i-e*g,j*i+e*f,d*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var d=Math.cos(c);c=Math.sin(c);var f=Math.cos(e);e=Math.sin(e);var g=a*c,i=b*c;this.n11=d*f;this.n12=-d*e;this.n13=c;this.n21=i*f+a*e;this.n22=-i*e+a*f;this.n23=-b*d;this.n31=-g*f+b*e;this.n32=g*e+b*f;this.n33=a*d},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,d=
 a.w,f=b+b,g=c+c,i=e+e;a=b*f;var h=b*g;b*=i;var j=c*g;c*=i;e*=i;f*=d;g*=d;d*=i;this.n11=1-(j+e);this.n12=h-d;this.n13=b+g;this.n21=h+d;this.n22=1-(a+e);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;
-a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},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};
+a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},extractPositionVector:function(a){a.x=this.n14;a.y=this.n24;a.z=this.n34},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,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,m=a.n31,n=a.n32,l=a.n33,o=a.n34,q=a.n41,r=a.n42,p=a.n43,k=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*o*r-j*l*r+j*n*p-i*o*p-h*n*k+i*l*k;b.n12=f*l*r-d*o*r-f*n*p+e*o*p+d*n*k-e*l*k;b.n13=d*j*r-f*h*r+f*i*p-e*j*p-d*i*k+e*h*k;b.n14=f*h*n-d*j*n-f*i*l+e*j*l+d*i*o-e*h*o;b.n21=j*l*q-h*o*q-j*m*p+g*o*p+h*m*k-g*l*k;b.n22=d*o*q-f*l*q+f*m*p-c*o*p-d*m*k+c*l*k;b.n23=f*h*q-d*j*q-f*g*p+c*j*p+d*g*k-c*h*k;
 b.n24=d*j*m-f*h*m+f*g*l-c*j*l-d*g*o+c*h*o;b.n31=i*o*q-j*n*q+j*m*r-g*o*r-i*m*k+g*n*k;b.n32=f*n*q-e*o*q-f*m*r+c*o*r+e*m*k-c*n*k;b.n33=d*j*q-f*i*q+f*g*r-c*j*r-e*g*k+c*i*k;b.n34=f*i*m-e*j*m-f*g*n+c*j*n+e*g*o-c*i*o;b.n41=h*n*q-i*l*q-h*m*r+g*l*r+i*m*p-g*n*p;b.n42=e*l*q-d*n*q+d*m*r-c*l*r-e*m*p+c*n*p;b.n43=d*i*q-e*h*q-d*g*r+c*h*r+e*g*p-c*i*p;b.n44=e*h*m-d*i*m+d*g*n-c*h*n-e*g*l+c*i*l;b.multiplyScalar(1/a.determinant());return b};
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,d=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*g+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*d;c[2]=a*f;c[3]=a*g;c[4]=a*i;c[5]=a*h;c[6]=a*j;c[7]=a*m;c[8]=a*n;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,e,d,f){var g;g=new THREE.Matrix4;g.n11=2*d/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*d/(e-c);g.n23=(e+c)/(e-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+d)/(f-d);g.n34=-2*f*d/(f-d);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,e){var d;a=c*Math.tan(a*Math.PI/360);d=-a;return THREE.Matrix4.makeFrustum(d*b,a*b,d,a,c,e)};
 THREE.Matrix4.makeOrtho=function(a,b,c,e,d,f){var g,i,h,j;g=new THREE.Matrix4;i=b-a;h=c-e;j=f-d;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+e)/h);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+d)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrixRotation=new THREE.Matrix4;this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=
-1;this.visible=!0};THREE.Object3D.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.globalMatrix,b,c)}};
-THREE.Object3D.prototype.updateMatrix=function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.localMatrix.setRotationFromQuaternion(this.quaternion):this.localMatrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0};
-THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}};THREE.Object3DCounter={value:0};
+1;this.visible=!0};
+THREE.Object3D.prototype={update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.globalMatrix,b,c)}},updateMatrix:function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.localMatrix.setRotationFromQuaternion(this.quaternion):this.localMatrix.setRotationFromEuler(this.rotation);
+if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}}};THREE.Object3DCounter={value:0};
 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=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
 THREE.Face3=function(a,b,c,e,d){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=d instanceof Array?d:[d]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
 THREE.Face4=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.d=e;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];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.Camera=function(a,b,c,e,d,f){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=e||2E3;this.screenCenterY=this.screenCenterX=0;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;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.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Camera=function(a,b,c,e,d,f){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=e||2E3;this.screenCenterY=this.screenCenterX=0;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(g,i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);if(i)this.tmpVec.y=
+0;this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};this.translateZ=function(g,i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);if(i)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
 this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)};
 THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,c=a.globalMatrix.n24,e=a.globalMatrix.n34,d=this.inverseMatrix,f=a.boundRadius*a.boundRadiusScale,g=d.n31*b+d.n32*c+d.n33*e+d.n34;if(g-f>-this.zNear)return!1;if(g+f<-this.zFar)return!1;g-=f;var i=this.projectionMatrix,h=1/(i.n43*g),j=h*this.screenCenterX,m=(d.n11*b+d.n12*c+d.n13*e+d.n14)*i.n11*j;f=i.n11*f*j;if(m+f<-this.screenCenterX)return!1;if(m-f>this.screenCenterX)return!1;b=(d.n21*b+d.n22*c+d.n23*e+d.n24)*i.n22*h*this.screenCenterY;
 if(b+f<-this.screenCenterY)return!1;if(b-f>this.screenCenterY)return!1;a.screenPosition.set(m,b,g,f);return!0};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
-THREE.Particle.prototype.constructor=THREE.Particle;THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
-THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};
-THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;
-THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(x,v){return v.z-x.z}function b(x,v){var D=0,A=1,E=x.z+x.w,z=v.z+v.w,w=-x.z+x.w,t=-v.z+v.w;if(E>=0&&z>=0&&w>=0&&t>=0)return!0;else if(E<0&&z<0||w<0&&t<0)return!1;else{if(E<0)D=Math.max(D,E/(E-z));else z<0&&(A=Math.min(A,E/(E-z)));if(w<0)D=Math.max(D,w/(w-t));else t<0&&(A=Math.min(A,w/(w-t)));if(A<D)return!1;else{x.lerpSelf(v,D);v.lerpSelf(x,1-A);return!0}}}var c,e,d=[],f,g,i,h=[],j,m,n=[],l,o,q=[],r=new THREE.Vector4,p=new THREE.Vector4,k=new THREE.Matrix4,C=new THREE.Matrix4,
-y=[],F=new THREE.Vector4,G=new THREE.Vector4,J;this.projectObjects=function(x,v,D){v=[];var A,E,z;e=0;E=x.objects;x=0;for(A=E.length;x<A;x++){z=E[x];var w;if(!(w=!z.visible))if(w=z instanceof THREE.Mesh){a:{w=void 0;for(var t=z.globalMatrix,I=-z.geometry.boundingSphere.radius*Math.max(z.scale.x,Math.max(z.scale.y,z.scale.z)),s=0;s<6;s++){w=y[s].x*t.n14+y[s].y*t.n24+y[s].z*t.n34+y[s].w;if(w<=I){w=!1;break a}}w=!0}w=!w}if(!w){c=d[e]=d[e]||new THREE.RenderableObject;r.copy(z.position);k.multiplyVector3(r);
-c.object=z;c.z=r.z;v.push(c);e++}}D&&v.sort(a);return v};this.projectScene=function(x,v,D){var A=[],E=v.zNear,z=v.zFar,w,t,I,s,H,P,u,N,Q,R,S,O,L,B,K,M;i=m=o=0;v.matrixAutoUpdate&&v.update();k.multiply(v.projectionMatrix,v.globalMatrix);y[0]=new THREE.Vector4(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);y[1]=new THREE.Vector4(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);y[2]=new THREE.Vector4(k.n41+k.n21,k.n42+k.n22,k.n43+k.n23,k.n44+k.n24);y[3]=new THREE.Vector4(k.n41-k.n21,k.n42-k.n22,k.n43-
-k.n23,k.n44-k.n24);y[4]=new THREE.Vector4(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);y[5]=new THREE.Vector4(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);w=0;for(P=y.length;w<P;w++){u=y[w];u.divideScalar(Math.sqrt(u.x*u.x+u.y*u.y+u.z*u.z))}x.update(undefined,!1,v);P=this.projectObjects(x,v,!0);x=0;for(w=P.length;x<w;x++){u=P[x].object;if(u.visible){u.matrixAutoUpdate&&u.updateMatrix();N=u.globalMatrix;N.extractRotationMatrix(u.matrixRotation);S=u.matrixRotation;Q=u.materials;R=u.overdraw;
-if(u instanceof THREE.Mesh){O=u.geometry;L=O.vertices;t=0;for(I=L.length;t<I;t++){B=L[t];B.positionWorld.copy(B.position);N.multiplyVector3(B.positionWorld);s=B.positionScreen;s.copy(B.positionWorld);k.multiplyVector4(s);s.x/=s.w;s.y/=s.w;B.__visible=s.z>E&&s.z<z}O=O.faces;t=0;for(I=O.length;t<I;t++){B=O[t];if(B instanceof THREE.Face3){s=L[B.a];H=L[B.b];K=L[B.c];if(s.__visible&&H.__visible&&K.__visible&&(u.doubleSided||u.flipSided!=(K.positionScreen.x-s.positionScreen.x)*(H.positionScreen.y-s.positionScreen.y)-
-(K.positionScreen.y-s.positionScreen.y)*(H.positionScreen.x-s.positionScreen.x)<0)){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(s.positionWorld);f.v2.positionWorld.copy(H.positionWorld);f.v3.positionWorld.copy(K.positionWorld);f.v1.positionScreen.copy(s.positionScreen);f.v2.positionScreen.copy(H.positionScreen);f.v3.positionScreen.copy(K.positionScreen);f.normalWorld.copy(B.normal);S.multiplyVector3(f.normalWorld);f.centroidWorld.copy(B.centroid);N.multiplyVector3(f.centroidWorld);
-f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);K=B.vertexNormals;J=f.vertexNormalsWorld;s=0;for(H=K.length;s<H;s++){M=J[s]=J[s]||new THREE.Vector3;M.copy(K[s]);S.multiplyVector3(M)}f.z=f.centroidScreen.z;f.meshMaterials=Q;f.faceMaterials=B.materials;f.overdraw=R;if(u.geometry.uvs[t]){f.uvs[0]=u.geometry.uvs[t][0];f.uvs[1]=u.geometry.uvs[t][1];f.uvs[2]=u.geometry.uvs[t][2]}A.push(f);i++}}else if(B instanceof THREE.Face4){s=L[B.a];H=L[B.b];K=L[B.c];M=L[B.d];if(s.__visible&&
-H.__visible&&K.__visible&&M.__visible&&(u.doubleSided||u.flipSided!=((M.positionScreen.x-s.positionScreen.x)*(H.positionScreen.y-s.positionScreen.y)-(M.positionScreen.y-s.positionScreen.y)*(H.positionScreen.x-s.positionScreen.x)<0||(H.positionScreen.x-K.positionScreen.x)*(M.positionScreen.y-K.positionScreen.y)-(H.positionScreen.y-K.positionScreen.y)*(M.positionScreen.x-K.positionScreen.x)<0))){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(s.positionWorld);f.v2.positionWorld.copy(H.positionWorld);
-f.v3.positionWorld.copy(M.positionWorld);f.v1.positionScreen.copy(s.positionScreen);f.v2.positionScreen.copy(H.positionScreen);f.v3.positionScreen.copy(M.positionScreen);f.normalWorld.copy(B.normal);S.multiplyVector3(f.normalWorld);f.centroidWorld.copy(B.centroid);N.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=Q;f.faceMaterials=B.materials;f.overdraw=R;if(u.geometry.uvs[t]){f.uvs[0]=u.geometry.uvs[t][0];
-f.uvs[1]=u.geometry.uvs[t][1];f.uvs[2]=u.geometry.uvs[t][3]}A.push(f);i++;g=h[i]=h[i]||new THREE.RenderableFace3;g.v1.positionWorld.copy(H.positionWorld);g.v2.positionWorld.copy(K.positionWorld);g.v3.positionWorld.copy(M.positionWorld);g.v1.positionScreen.copy(H.positionScreen);g.v2.positionScreen.copy(K.positionScreen);g.v3.positionScreen.copy(M.positionScreen);g.normalWorld.copy(f.normalWorld);g.centroidWorld.copy(f.centroidWorld);g.centroidScreen.copy(f.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=
-Q;g.faceMaterials=B.materials;g.overdraw=R;if(u.geometry.uvs[t]){g.uvs[0]=u.geometry.uvs[t][1];g.uvs[1]=u.geometry.uvs[t][2];g.uvs[2]=u.geometry.uvs[t][3]}A.push(g);i++}}}}else if(u instanceof THREE.Line){C.multiply(k,N);L=u.geometry.vertices;B=L[0];B.positionScreen.copy(B.position);C.multiplyVector4(B.positionScreen);t=1;for(I=L.length;t<I;t++){s=L[t];s.positionScreen.copy(s.position);C.multiplyVector4(s.positionScreen);H=L[t-1];F.copy(s.positionScreen);G.copy(H.positionScreen);if(b(F,G)){F.multiplyScalar(1/
-F.w);G.multiplyScalar(1/G.w);j=n[m]=n[m]||new THREE.RenderableLine;j.v1.positionScreen.copy(F);j.v2.positionScreen.copy(G);j.z=Math.max(F.z,G.z);j.materials=u.materials;A.push(j);m++}}}else if(u instanceof THREE.Particle){p.set(u.position.x,u.position.y,u.position.z,1);k.multiplyVector4(p);p.z/=p.w;if(p.z>0&&p.z<1){l=q[o]=q[o]||new THREE.RenderableParticle;l.x=p.x/p.w;l.y=p.y/p.w;l.z=p.z;l.rotation=u.rotation.z;l.scale.x=u.scale.x*Math.abs(l.x-(p.x+v.projectionMatrix.n11)/(p.w+v.projectionMatrix.n14));
-l.scale.y=u.scale.y*Math.abs(l.y-(p.y+v.projectionMatrix.n22)/(p.w+v.projectionMatrix.n24));l.materials=u.materials;A.push(l);o++}}}}D&&A.sort(a);return A};this.unprojectVector=function(x,v){var D=THREE.Matrix4.makeInvert(v.globalMatrix);D.multiplySelf(THREE.Matrix4.makeInvert(v.projectionMatrix));D.multiplyVector3(x);return x}};
+THREE.Particle.prototype.constructor=THREE.Particle;THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.sounds=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
+THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound3D)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};
+THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound3D){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;
+THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
+THREE.Projector=function(){function a(w,u){return u.z-w.z}function b(w,u){var D=0,A=1,E=w.z+w.w,z=u.z+u.w,v=-w.z+w.w,t=-u.z+u.w;if(E>=0&&z>=0&&v>=0&&t>=0)return!0;else if(E<0&&z<0||v<0&&t<0)return!1;else{if(E<0)D=Math.max(D,E/(E-z));else z<0&&(A=Math.min(A,E/(E-z)));if(v<0)D=Math.max(D,v/(v-t));else t<0&&(A=Math.min(A,v/(v-t)));if(A<D)return!1;else{w.lerpSelf(u,D);u.lerpSelf(w,1-A);return!0}}}var c,e,d=[],f,g,i,h=[],j,m,n=[],l,o,q=[],r=new THREE.Vector4,p=new THREE.Vector4,k=new THREE.Matrix4,C=new THREE.Matrix4,
+y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],F=new THREE.Vector4,G=new THREE.Vector4,J;this.projectObjects=function(w,u,D){u=[];var A,E,z;e=0;E=w.objects;w=0;for(A=E.length;w<A;w++){z=E[w];var v;if(!(v=!z.visible))if(v=z instanceof THREE.Mesh){a:{v=void 0;for(var t=z.globalMatrix,I=-z.geometry.boundingSphere.radius*Math.max(z.scale.x,Math.max(z.scale.y,z.scale.z)),s=0;s<6;s++){v=y[s].x*t.n14+y[s].y*t.n24+y[s].z*t.n34+y[s].w;if(v<=
+I){v=!1;break a}}v=!0}v=!v}if(!v){c=d[e]=d[e]||new THREE.RenderableObject;r.copy(z.position);k.multiplyVector3(r);c.object=z;c.z=r.z;u.push(c);e++}}D&&u.sort(a);return u};this.projectScene=function(w,u,D){var A=[],E=u.zNear,z=u.zFar,v,t,I,s,H,N,x,O,Q,R,S,P,L,B,K,M;i=m=o=0;u.matrixAutoUpdate&&u.update();k.multiply(u.projectionMatrix,u.globalMatrix);y[0].set(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);y[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);y[2].set(k.n41+k.n21,k.n42+k.n22,k.n43+
+k.n23,k.n44+k.n24);y[3].set(k.n41-k.n21,k.n42-k.n22,k.n43-k.n23,k.n44-k.n24);y[4].set(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);y[5].set(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);for(v=0;v<6;v++){N=y[v];N.divideScalar(Math.sqrt(N.x*N.x+N.y*N.y+N.z*N.z))}w.update(undefined,!1,u);N=this.projectObjects(w,u,!0);w=0;for(v=N.length;w<v;w++){x=N[w].object;if(x.visible){x.matrixAutoUpdate&&x.updateMatrix();O=x.globalMatrix;O.extractRotationMatrix(x.matrixRotation);S=x.matrixRotation;Q=x.materials;
+R=x.overdraw;if(x instanceof THREE.Mesh){P=x.geometry;L=P.vertices;t=0;for(I=L.length;t<I;t++){B=L[t];B.positionWorld.copy(B.position);O.multiplyVector3(B.positionWorld);s=B.positionScreen;s.copy(B.positionWorld);k.multiplyVector4(s);s.x/=s.w;s.y/=s.w;B.__visible=s.z>E&&s.z<z}P=P.faces;t=0;for(I=P.length;t<I;t++){B=P[t];if(B instanceof THREE.Face3){s=L[B.a];H=L[B.b];K=L[B.c];if(s.__visible&&H.__visible&&K.__visible&&(x.doubleSided||x.flipSided!=(K.positionScreen.x-s.positionScreen.x)*(H.positionScreen.y-
+s.positionScreen.y)-(K.positionScreen.y-s.positionScreen.y)*(H.positionScreen.x-s.positionScreen.x)<0)){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(s.positionWorld);f.v2.positionWorld.copy(H.positionWorld);f.v3.positionWorld.copy(K.positionWorld);f.v1.positionScreen.copy(s.positionScreen);f.v2.positionScreen.copy(H.positionScreen);f.v3.positionScreen.copy(K.positionScreen);f.normalWorld.copy(B.normal);S.multiplyVector3(f.normalWorld);f.centroidWorld.copy(B.centroid);O.multiplyVector3(f.centroidWorld);
+f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);K=B.vertexNormals;J=f.vertexNormalsWorld;s=0;for(H=K.length;s<H;s++){M=J[s]=J[s]||new THREE.Vector3;M.copy(K[s]);S.multiplyVector3(M)}f.z=f.centroidScreen.z;f.meshMaterials=Q;f.faceMaterials=B.materials;f.overdraw=R;if(x.geometry.uvs[t]){f.uvs[0]=x.geometry.uvs[t][0];f.uvs[1]=x.geometry.uvs[t][1];f.uvs[2]=x.geometry.uvs[t][2]}A.push(f);i++}}else if(B instanceof THREE.Face4){s=L[B.a];H=L[B.b];K=L[B.c];M=L[B.d];if(s.__visible&&
+H.__visible&&K.__visible&&M.__visible&&(x.doubleSided||x.flipSided!=((M.positionScreen.x-s.positionScreen.x)*(H.positionScreen.y-s.positionScreen.y)-(M.positionScreen.y-s.positionScreen.y)*(H.positionScreen.x-s.positionScreen.x)<0||(H.positionScreen.x-K.positionScreen.x)*(M.positionScreen.y-K.positionScreen.y)-(H.positionScreen.y-K.positionScreen.y)*(M.positionScreen.x-K.positionScreen.x)<0))){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(s.positionWorld);f.v2.positionWorld.copy(H.positionWorld);
+f.v3.positionWorld.copy(M.positionWorld);f.v1.positionScreen.copy(s.positionScreen);f.v2.positionScreen.copy(H.positionScreen);f.v3.positionScreen.copy(M.positionScreen);f.normalWorld.copy(B.normal);S.multiplyVector3(f.normalWorld);f.centroidWorld.copy(B.centroid);O.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=Q;f.faceMaterials=B.materials;f.overdraw=R;if(x.geometry.uvs[t]){f.uvs[0]=x.geometry.uvs[t][0];
+f.uvs[1]=x.geometry.uvs[t][1];f.uvs[2]=x.geometry.uvs[t][3]}A.push(f);i++;g=h[i]=h[i]||new THREE.RenderableFace3;g.v1.positionWorld.copy(H.positionWorld);g.v2.positionWorld.copy(K.positionWorld);g.v3.positionWorld.copy(M.positionWorld);g.v1.positionScreen.copy(H.positionScreen);g.v2.positionScreen.copy(K.positionScreen);g.v3.positionScreen.copy(M.positionScreen);g.normalWorld.copy(f.normalWorld);g.centroidWorld.copy(f.centroidWorld);g.centroidScreen.copy(f.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=
+Q;g.faceMaterials=B.materials;g.overdraw=R;if(x.geometry.uvs[t]){g.uvs[0]=x.geometry.uvs[t][1];g.uvs[1]=x.geometry.uvs[t][2];g.uvs[2]=x.geometry.uvs[t][3]}A.push(g);i++}}}}else if(x instanceof THREE.Line){C.multiply(k,O);L=x.geometry.vertices;B=L[0];B.positionScreen.copy(B.position);C.multiplyVector4(B.positionScreen);t=1;for(I=L.length;t<I;t++){s=L[t];s.positionScreen.copy(s.position);C.multiplyVector4(s.positionScreen);H=L[t-1];F.copy(s.positionScreen);G.copy(H.positionScreen);if(b(F,G)){F.multiplyScalar(1/
+F.w);G.multiplyScalar(1/G.w);j=n[m]=n[m]||new THREE.RenderableLine;j.v1.positionScreen.copy(F);j.v2.positionScreen.copy(G);j.z=Math.max(F.z,G.z);j.materials=x.materials;A.push(j);m++}}}else if(x instanceof THREE.Particle){p.set(x.position.x,x.position.y,x.position.z,1);k.multiplyVector4(p);p.z/=p.w;if(p.z>0&&p.z<1){l=q[o]=q[o]||new THREE.RenderableParticle;l.x=p.x/p.w;l.y=p.y/p.w;l.z=p.z;l.rotation=x.rotation.z;l.scale.x=x.scale.x*Math.abs(l.x-(p.x+u.projectionMatrix.n11)/(p.w+u.projectionMatrix.n14));
+l.scale.y=x.scale.y*Math.abs(l.y-(p.y+u.projectionMatrix.n22)/(p.w+u.projectionMatrix.n24));l.materials=x.materials;A.push(l);o++}}}}D&&A.sort(a);return A};this.unprojectVector=function(w,u){var D=THREE.Matrix4.makeInvert(u.globalMatrix);D.multiplySelf(THREE.Matrix4.makeInvert(u.projectionMatrix));D.multiplyVector3(w);return w}};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,d,f;this.domElement=document.createElement("div");this.setSize=function(g,i){c=g;e=i;d=c/2;f=e/2};this.render=function(g,i){var h,j,m,n,l,o,q,r;a=b.projectScene(g,i);h=0;for(j=a.length;h<j;h++){l=a[h];if(l instanceof THREE.RenderableParticle){q=l.x*d+d;r=l.y*f+f;m=0;for(n=l.material.length;m<n;m++){o=l.material[m];if(o instanceof THREE.ParticleDOMMaterial){o=o.domElement;o.style.left=q+"px";o.style.top=r+"px"}}}}}};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};

File diff suppressed because it is too large
+ 14 - 14
build/custom/ThreeExtras.js


+ 49 - 48
build/custom/ThreeSVG.js

@@ -13,7 +13,7 @@ this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,c,d){this.x=a||
 THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||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,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,h){return f.distance-h.distance});return e},intersectObject:function(a){function b(s,j,H,p){p=p.clone().subSelf(j);H=H.clone().subSelf(j);var A=s.clone().subSelf(j);s=p.dot(p);j=p.dot(H);p=p.dot(A);var D=H.dot(H);H=H.dot(A);A=1/(s*D-j*j);D=(D*p-j*H)*A;s=(s*H-j*p)*A;return D>0&&s>0&&D+s<1}var c,d,e,f,h,i,g,k,n,m,
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,h){return f.distance-h.distance});return e},intersectObject:function(a){function b(s,j,I,p){p=p.clone().subSelf(j);I=I.clone().subSelf(j);var z=s.clone().subSelf(j);s=p.dot(p);j=p.dot(I);p=p.dot(z);var D=I.dot(I);I=I.dot(z);z=1/(s*D-j*j);D=(D*p-j*I)*z;s=(s*I-j*p)*z;return D>0&&s>0&&D+s<1}var c,d,e,f,h,i,g,k,n,m,
 l,o=a.geometry,q=o.vertices,u=[];c=0;for(d=o.faces.length;c<d;c++){e=o.faces[c];m=this.origin.clone();l=this.direction.clone();g=a.globalMatrix;g.extractRotationMatrix(a.matrixRotation);f=g.multiplyVector3(q[e.a].position.clone());h=g.multiplyVector3(q[e.b].position.clone());i=g.multiplyVector3(q[e.c].position.clone());g=e instanceof THREE.Face4?g.multiplyVector3(q[e.d].position.clone()):null;k=a.matrixRotation.multiplyVector3(e.normal.clone());n=l.dot(k);if(n<0){k=k.dot((new THREE.Vector3).sub(f,
 m))/n;m=m.addSelf(l.multiplyScalar(k));if(e instanceof THREE.Face3){if(b(m,f,h,i)){e={distance:this.origin.distanceTo(m),point:m,face:e,object:a};u.push(e)}}else if(e instanceof THREE.Face4&&(b(m,f,h,g)||b(m,h,i,g))){e={distance:this.origin.distanceTo(m),point:m,face:e,object:a};u.push(e)}}}return u}};
 THREE.Rectangle=function(){function a(){f=d-b;h=e-c}var b,c,d,e,f,h,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,k,n,m){i=!1;b=g;c=k;d=n;e=m;a()};this.addPoint=function(g,k){if(i){i=!1;b=g;c=k;d=g;e=k}else{b=b<g?b:g;c=c<k?c:k;d=d>g?d:g;e=e>k?e:k}a()};
@@ -25,29 +25,30 @@ THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n
 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 d=THREE.Matrix4.__tmpVec1,e=THREE.Matrix4.__tmpVec2,f=THREE.Matrix4.__tmpVec3;f.sub(a,b).normalize();d.cross(c,f).normalize();e.cross(f,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=e.x;this.n22=e.y;this.n23=e.z;this.n24=-e.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,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*
 a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;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,d=a.n12,e=a.n13,f=a.n14,h=a.n21,i=a.n22,g=a.n23,k=a.n24,n=a.n31,m=a.n32,l=a.n33,o=a.n34,q=a.n41,u=a.n42,s=a.n43,j=a.n44,H=b.n11,p=b.n12,A=b.n13,D=b.n14,M=b.n21,B=b.n22,x=b.n23,I=b.n24,E=b.n31,K=b.n32,G=b.n33,r=b.n34,y=b.n41,O=b.n42,w=b.n43,L=b.n44;this.n11=c*H+d*M+e*E+f*y;this.n12=c*p+d*B+e*K+f*O;this.n13=c*A+d*x+e*G+f*w;this.n14=c*D+d*I+e*r+f*L;this.n21=h*H+i*M+g*E+k*y;this.n22=h*p+i*B+g*K+k*O;this.n23=h*A+
-i*x+g*G+k*w;this.n24=h*D+i*I+g*r+k*L;this.n31=n*H+m*M+l*E+o*y;this.n32=n*p+m*B+l*K+o*O;this.n33=n*A+m*x+l*G+o*w;this.n34=n*D+m*I+l*r+o*L;this.n41=q*H+u*M+s*E+j*y;this.n42=q*p+u*B+s*K+j*O;this.n43=q*A+u*x+s*G+j*w;this.n44=q*D+u*I+s*r+j*L;return this},multiplyToArray:function(a,b,c){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,g=a.n22,k=a.n23,n=a.n24,m=a.n31,l=a.n32,o=a.n33,q=a.n34,u=a.n41,s=a.n42,j=a.n43;a=a.n44;var H=b.n11,p=b.n12,A=b.n13,D=b.n14,M=b.n21,B=b.n22,x=b.n23,I=b.n24,E=b.n31,K=b.n32,G=b.n33,
-r=b.n34,y=b.n41,O=b.n42,w=b.n43;b=b.n44;this.n11=d*H+e*M+f*E+h*y;this.n12=d*p+e*B+f*K+h*O;this.n13=d*A+e*x+f*G+h*w;this.n14=d*D+e*I+f*r+h*b;this.n21=i*H+g*M+k*E+n*y;this.n22=i*p+g*B+k*K+n*O;this.n23=i*A+g*x+k*G+n*w;this.n24=i*D+g*I+k*r+n*b;this.n31=m*H+l*M+o*E+q*y;this.n32=m*p+l*B+o*K+q*O;this.n33=m*A+l*x+o*G+q*w;this.n34=m*D+l*I+o*r+q*b;this.n41=u*H+s*M+j*E+a*y;this.n42=u*p+s*B+j*K+a*O;this.n43=u*A+s*x+j*G+a*w;this.n44=u*D+s*I+j*r+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,d=this.n13,e=this.n14,f=this.n21,h=this.n22,i=this.n23,g=this.n24,k=this.n31,n=this.n32,m=this.n33,l=this.n34,o=this.n41,q=this.n42,u=this.n43,s=this.n44,j=a.n11,H=a.n21,p=a.n31,A=a.n41,D=a.n12,M=a.n22,B=a.n32,x=a.n42,I=a.n13,E=a.n23,K=a.n33,G=a.n43,r=a.n14,y=a.n24,O=
-a.n34;a=a.n44;this.n11=b*j+c*H+d*p+e*A;this.n12=b*D+c*M+d*B+e*x;this.n13=b*I+c*E+d*K+e*G;this.n14=b*r+c*y+d*O+e*a;this.n21=f*j+h*H+i*p+g*A;this.n22=f*D+h*M+i*B+g*x;this.n23=f*I+h*E+i*K+g*G;this.n24=f*r+h*y+i*O+g*a;this.n31=k*j+n*H+m*p+l*A;this.n32=k*D+n*M+m*B+l*x;this.n33=k*I+n*E+m*K+l*G;this.n34=k*r+n*y+m*O+l*a;this.n41=o*j+q*H+u*p+s*A;this.n42=o*D+q*M+u*B+s*x;this.n43=o*I+q*E+u*K+s*G;this.n44=o*r+q*y+u*O+s*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;
+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,d=a.n12,e=a.n13,f=a.n14,h=a.n21,i=a.n22,g=a.n23,k=a.n24,n=a.n31,m=a.n32,l=a.n33,o=a.n34,q=a.n41,u=a.n42,s=a.n43,j=a.n44,I=b.n11,p=b.n12,z=b.n13,D=b.n14,M=b.n21,B=b.n22,w=b.n23,J=b.n24,E=b.n31,K=b.n32,H=b.n33,r=b.n34,x=b.n41,O=b.n42,v=b.n43,L=b.n44;this.n11=c*I+d*M+e*E+f*x;this.n12=c*p+d*B+e*K+f*O;this.n13=c*z+d*w+e*H+f*v;this.n14=c*D+d*J+e*r+f*L;this.n21=h*I+i*M+g*E+k*x;this.n22=h*p+i*B+g*K+k*O;this.n23=h*z+
+i*w+g*H+k*v;this.n24=h*D+i*J+g*r+k*L;this.n31=n*I+m*M+l*E+o*x;this.n32=n*p+m*B+l*K+o*O;this.n33=n*z+m*w+l*H+o*v;this.n34=n*D+m*J+l*r+o*L;this.n41=q*I+u*M+s*E+j*x;this.n42=q*p+u*B+s*K+j*O;this.n43=q*z+u*w+s*H+j*v;this.n44=q*D+u*J+s*r+j*L;return this},multiplyToArray:function(a,b,c){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,g=a.n22,k=a.n23,n=a.n24,m=a.n31,l=a.n32,o=a.n33,q=a.n34,u=a.n41,s=a.n42,j=a.n43;a=a.n44;var I=b.n11,p=b.n12,z=b.n13,D=b.n14,M=b.n21,B=b.n22,w=b.n23,J=b.n24,E=b.n31,K=b.n32,H=b.n33,
+r=b.n34,x=b.n41,O=b.n42,v=b.n43;b=b.n44;this.n11=d*I+e*M+f*E+h*x;this.n12=d*p+e*B+f*K+h*O;this.n13=d*z+e*w+f*H+h*v;this.n14=d*D+e*J+f*r+h*b;this.n21=i*I+g*M+k*E+n*x;this.n22=i*p+g*B+k*K+n*O;this.n23=i*z+g*w+k*H+n*v;this.n24=i*D+g*J+k*r+n*b;this.n31=m*I+l*M+o*E+q*x;this.n32=m*p+l*B+o*K+q*O;this.n33=m*z+l*w+o*H+q*v;this.n34=m*D+l*J+o*r+q*b;this.n41=u*I+s*M+j*E+a*x;this.n42=u*p+s*B+j*K+a*O;this.n43=u*z+s*w+j*H+a*v;this.n44=u*D+s*J+j*r+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,d=this.n13,e=this.n14,f=this.n21,h=this.n22,i=this.n23,g=this.n24,k=this.n31,n=this.n32,m=this.n33,l=this.n34,o=this.n41,q=this.n42,u=this.n43,s=this.n44,j=a.n11,I=a.n21,p=a.n31,z=a.n41,D=a.n12,M=a.n22,B=a.n32,w=a.n42,J=a.n13,E=a.n23,K=a.n33,H=a.n43,r=a.n14,x=a.n24,O=
+a.n34;a=a.n44;this.n11=b*j+c*I+d*p+e*z;this.n12=b*D+c*M+d*B+e*w;this.n13=b*J+c*E+d*K+e*H;this.n14=b*r+c*x+d*O+e*a;this.n21=f*j+h*I+i*p+g*z;this.n22=f*D+h*M+i*B+g*w;this.n23=f*J+h*E+i*K+g*H;this.n24=f*r+h*x+i*O+g*a;this.n31=k*j+n*I+m*p+l*z;this.n32=k*D+n*M+m*B+l*w;this.n33=k*J+n*E+m*K+l*H;this.n34=k*r+n*x+m*O+l*a;this.n41=o*j+q*I+u*p+s*z;this.n42=o*D+q*M+u*B+s*w;this.n43=o*J+q*E+u*K+s*H;this.n44=o*r+q*x+u*O+s*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,d=this.n14,e=this.n21,f=this.n22,h=this.n23,i=this.n24,g=this.n31,k=this.n32,n=this.n33,m=this.n34,l=this.n41,o=this.n42,q=this.n43,u=this.n44;return d*h*k*l-c*i*k*l-d*f*n*l+b*i*n*l+c*f*m*l-b*h*m*l-d*h*g*o+c*i*g*o+d*e*n*o-a*i*n*o-c*e*m*o+a*h*m*o+d*f*g*q-b*i*g*q-d*e*k*q+a*i*k*q+b*e*m*
 q-a*f*m*q-c*f*g*u+b*h*g*u+c*e*k*u-a*h*k*u-b*e*n*u+a*f*n*u},transpose:function(){function a(b,c,d){var e=b[c];b[c]=b[d];b[d]=e}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},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,
 0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},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),d=Math.sin(b),e=1-c,f=a.x,h=a.y,i=a.z,g=e*f,k=e*h;this.set(g*f+c,g*h-d*i,g*i+d*h,0,g*h+d*i,
-k*h+c,k*i-d*f,0,g*i-d*h,k*i+d*f,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var e=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(b);b=Math.sin(b);var h=a*d,i=c*d;this.n11=a*e;this.n12=c*b-h*f;this.n13=h*b+c*f;this.n21=d;this.n22=e*f;this.n23=-e*b;this.n31=-c*e;this.n32=i*f+a*b;this.n33=-i*b+a*f},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=
+k*h+c,k*i-d*f,0,g*i-d*h,k*i+d*f,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var h=a*c,i=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=i*f+a*d;this.n22=-i*d+a*f;this.n23=-b*e;this.n31=-h*f+b*d;this.n32=h*d+b*f;this.n33=a*e},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=
 a.w,f=b+b,h=c+c,i=d+d;a=b*f;var g=b*h;b*=i;var k=c*h;c*=i;d*=i;f*=e;h*=e;e*=i;this.n11=1-(k+d);this.n12=g-e;this.n13=b+h;this.n21=g+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-h;this.n32=c+f;this.n33=1-(a+k)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;
-a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},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 d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};
-THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};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};
+a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},extractPositionVector:function(a){a.x=this.n14;a.y=this.n24;a.z=this.n34},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 d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};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,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,h=a.n21,i=a.n22,g=a.n23,k=a.n24,n=a.n31,m=a.n32,l=a.n33,o=a.n34,q=a.n41,u=a.n42,s=a.n43,j=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=g*o*u-k*l*u+k*m*s-i*o*s-g*m*j+i*l*j;b.n12=f*l*u-e*o*u-f*m*s+d*o*s+e*m*j-d*l*j;b.n13=e*k*u-f*g*u+f*i*s-d*k*s-e*i*j+d*g*j;b.n14=f*g*m-e*k*m-f*i*l+d*k*l+e*i*o-d*g*o;b.n21=k*l*q-g*o*q-k*n*s+h*o*s+g*n*j-h*l*j;b.n22=e*o*q-f*l*q+f*n*s-c*o*s-e*n*j+c*l*j;b.n23=f*g*q-e*k*q-f*h*s+c*k*s+e*h*j-c*g*j;
 b.n24=e*k*n-f*g*n+f*h*l-c*k*l-e*h*o+c*g*o;b.n31=i*o*q-k*m*q+k*n*u-h*o*u-i*n*j+h*m*j;b.n32=f*m*q-d*o*q-f*n*u+c*o*u+d*n*j-c*m*j;b.n33=e*k*q-f*i*q+f*h*u-c*k*u-d*h*j+c*i*j;b.n34=f*i*n-d*k*n-f*h*m+c*k*m+d*h*o-c*i*o;b.n41=g*m*q-i*l*q-g*n*u+h*l*u+i*n*s-h*m*s;b.n42=d*l*q-e*m*q+e*n*u-c*l*u-d*n*s+c*m*s;b.n43=e*i*q-d*g*q-e*h*u+c*g*u+d*h*s-c*i*s;b.n44=d*g*n-e*i*n+e*h*m-c*g*m-d*h*l+c*i*l;b.multiplyScalar(1/a.determinant());return b};
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-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,i=a.n33*a.n11-a.n31*a.n13,g=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*k;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*h;c[4]=a*i;c[5]=a*g;c[6]=a*k;c[7]=a*n;c[8]=a*m;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var h;h=new THREE.Matrix4;h.n11=2*e/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*e/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(f+e)/(f-e);h.n34=-2*f*e/(f-e);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var h,i,g,k;h=new THREE.Matrix4;i=b-a;g=c-d;k=f-e;h.n11=2/i;h.n12=0;h.n13=0;h.n14=-((b+a)/i);h.n21=0;h.n22=2/g;h.n23=0;h.n24=-((c+d)/g);h.n31=0;h.n32=0;h.n33=-2/k;h.n34=-((f+e)/k);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.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrixRotation=new THREE.Matrix4;this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=
-1;this.visible=!0};THREE.Object3D.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)}};
-THREE.Object3D.prototype.updateMatrix=function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.localMatrix.setRotationFromQuaternion(this.quaternion):this.localMatrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0};
-THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}};THREE.Object3DCounter={value:0};
+1;this.visible=!0};
+THREE.Object3D.prototype={update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)}},updateMatrix:function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.localMatrix.setRotationFromQuaternion(this.quaternion):this.localMatrix.setRotationFromEuler(this.rotation);
+if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}}};THREE.Object3DCounter={value:0};
 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=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
 THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];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};
@@ -56,16 +57,16 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,f,h,i=new THREE.Vector3,g=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){f=this.vertices[d];f.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];if(a&&f.vertexNormals.length){i.set(0,0,0);b=0;for(c=f.normal.length;b<c;b++)i.addSelf(f.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];h=this.vertices[f.c];i.sub(h.position,
 c.position);g.sub(b.position,c.position);i.crossSelf(g)}i.isZero()||i.normalize();f.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(r,y,O,w,L,J,v){f=r.vertices[y].position;h=r.vertices[O].position;i=r.vertices[w].position;g=e[L];k=e[J];n=e[v];m=h.x-f.x;l=i.x-f.x;o=h.y-f.y;q=i.y-f.y;
-u=h.z-f.z;s=i.z-f.z;j=k.u-g.u;H=n.u-g.u;p=k.v-g.v;A=n.v-g.v;D=1/(j*A-H*p);x.set((A*m-p*l)*D,(A*o-p*q)*D,(A*u-p*s)*D);I.set((j*l-H*m)*D,(j*q-H*o)*D,(j*s-H*u)*D);M[y].addSelf(x);M[O].addSelf(x);M[w].addSelf(x);B[y].addSelf(I);B[O].addSelf(I);B[w].addSelf(I)}var b,c,d,e,f,h,i,g,k,n,m,l,o,q,u,s,j,H,p,A,D,M=[],B=[],x=new THREE.Vector3,I=new THREE.Vector3,E=new THREE.Vector3,K=new THREE.Vector3,G=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){M[b]=new THREE.Vector3;B[b]=new THREE.Vector3}b=0;
+b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(r,x,O,v,L,F,A){f=r.vertices[x].position;h=r.vertices[O].position;i=r.vertices[v].position;g=e[L];k=e[F];n=e[A];m=h.x-f.x;l=i.x-f.x;o=h.y-f.y;q=i.y-f.y;
+u=h.z-f.z;s=i.z-f.z;j=k.u-g.u;I=n.u-g.u;p=k.v-g.v;z=n.v-g.v;D=1/(j*z-I*p);w.set((z*m-p*l)*D,(z*o-p*q)*D,(z*u-p*s)*D);J.set((j*l-I*m)*D,(j*q-I*o)*D,(j*s-I*u)*D);M[x].addSelf(w);M[O].addSelf(w);M[v].addSelf(w);B[x].addSelf(J);B[O].addSelf(J);B[v].addSelf(J)}var b,c,d,e,f,h,i,g,k,n,m,l,o,q,u,s,j,I,p,z,D,M=[],B=[],w=new THREE.Vector3,J=new THREE.Vector3,E=new THREE.Vector3,K=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){M[b]=new THREE.Vector3;B[b]=new THREE.Vector3}b=0;
 for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
-this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){G.copy(this.vertices[b].normal);d=M[b];E.copy(d);E.subSelf(G.multiplyScalar(G.dot(d))).normalize();K.cross(this.vertices[b].normal,d);d=K.dot(B[b]);d=d<0?-1:1;this.vertices[b].tangent.set(E.x,E.y,E.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
+this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){H.copy(this.vertices[b].normal);d=M[b];E.copy(d);E.subSelf(H.multiplyScalar(H.dot(d))).normalize();K.cross(this.vertices[b].normal,d);d=K.dot(B[b]);d=d<0?-1:1;this.vertices[b].tangent.set(E.x,E.y,E.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(n){var m=[];b=0;for(c=n.length;b<c;b++)n[b]==undefined?m.push("undefined"):m.push(n[b].id);return m.join("_")}var b,c,d,e,f,h,i,g,k={};d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];
 h=f.materials;i=a(h);k[i]==undefined&&(k[i]={hash:i,counter:0});g=k[i].hash+"_"+k[i].counter;this.geometryChunks[g]==undefined&&(this.geometryChunks[g]={faces:[],materials:h,vertices:0});f=f instanceof THREE.Face3?3:4;if(this.geometryChunks[g].vertices+f>65535){k[i].counter+=1;g=k[i].hash+"_"+k[i].counter;this.geometryChunks[g]==undefined&&(this.geometryChunks[g]={faces:[],materials:h,vertices:0})}this.geometryChunks[g].faces.push(d);this.geometryChunks[g].vertices+=f}},toString:function(){return"THREE.Geometry ( vertices: "+
 this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
-THREE.Camera=function(a,b,c,d,e,f){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=d||2E3;this.screenCenterY=this.screenCenterX=0;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;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.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Camera=function(a,b,c,d,e,f){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=d||2E3;this.screenCenterY=this.screenCenterX=0;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(h,i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);if(i)this.tmpVec.y=
+0;this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};this.translateZ=function(h,i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);if(i)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
 this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)};
@@ -102,36 +103,36 @@ THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;t
 THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 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&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
-THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
-THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};
-THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;
-THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(B,x){return x.z-B.z}function b(B,x){var I=0,E=1,K=B.z+B.w,G=x.z+x.w,r=-B.z+B.w,y=-x.z+x.w;if(K>=0&&G>=0&&r>=0&&y>=0)return!0;else if(K<0&&G<0||r<0&&y<0)return!1;else{if(K<0)I=Math.max(I,K/(K-G));else G<0&&(E=Math.min(E,K/(K-G)));if(r<0)I=Math.max(I,r/(r-y));else y<0&&(E=Math.min(E,r/(r-y)));if(E<I)return!1;else{B.lerpSelf(x,I);x.lerpSelf(B,1-E);return!0}}}var c,d,e=[],f,h,i,g=[],k,n,m=[],l,o,q=[],u=new THREE.Vector4,s=new THREE.Vector4,j=new THREE.Matrix4,H=new THREE.Matrix4,
-p=[],A=new THREE.Vector4,D=new THREE.Vector4,M;this.projectObjects=function(B,x,I){x=[];var E,K,G;d=0;K=B.objects;B=0;for(E=K.length;B<E;B++){G=K[B];var r;if(!(r=!G.visible))if(r=G instanceof THREE.Mesh){a:{r=void 0;for(var y=G.globalMatrix,O=-G.geometry.boundingSphere.radius*Math.max(G.scale.x,Math.max(G.scale.y,G.scale.z)),w=0;w<6;w++){r=p[w].x*y.n14+p[w].y*y.n24+p[w].z*y.n34+p[w].w;if(r<=O){r=!1;break a}}r=!0}r=!r}if(!r){c=e[d]=e[d]||new THREE.RenderableObject;u.copy(G.position);j.multiplyVector3(u);
-c.object=G;c.z=u.z;x.push(c);d++}}I&&x.sort(a);return x};this.projectScene=function(B,x,I){var E=[],K=x.zNear,G=x.zFar,r,y,O,w,L,J,v,P,R,C,z,N,Q,t,F,S;i=n=o=0;x.matrixAutoUpdate&&x.update();j.multiply(x.projectionMatrix,x.globalMatrix);p[0]=new THREE.Vector4(j.n41-j.n11,j.n42-j.n12,j.n43-j.n13,j.n44-j.n14);p[1]=new THREE.Vector4(j.n41+j.n11,j.n42+j.n12,j.n43+j.n13,j.n44+j.n14);p[2]=new THREE.Vector4(j.n41+j.n21,j.n42+j.n22,j.n43+j.n23,j.n44+j.n24);p[3]=new THREE.Vector4(j.n41-j.n21,j.n42-j.n22,j.n43-
-j.n23,j.n44-j.n24);p[4]=new THREE.Vector4(j.n41-j.n31,j.n42-j.n32,j.n43-j.n33,j.n44-j.n34);p[5]=new THREE.Vector4(j.n41+j.n31,j.n42+j.n32,j.n43+j.n33,j.n44+j.n34);r=0;for(J=p.length;r<J;r++){v=p[r];v.divideScalar(Math.sqrt(v.x*v.x+v.y*v.y+v.z*v.z))}B.update(undefined,!1,x);J=this.projectObjects(B,x,!0);B=0;for(r=J.length;B<r;B++){v=J[B].object;if(v.visible){v.matrixAutoUpdate&&v.updateMatrix();P=v.globalMatrix;P.extractRotationMatrix(v.matrixRotation);z=v.matrixRotation;R=v.materials;C=v.overdraw;
-if(v instanceof THREE.Mesh){N=v.geometry;Q=N.vertices;y=0;for(O=Q.length;y<O;y++){t=Q[y];t.positionWorld.copy(t.position);P.multiplyVector3(t.positionWorld);w=t.positionScreen;w.copy(t.positionWorld);j.multiplyVector4(w);w.x/=w.w;w.y/=w.w;t.__visible=w.z>K&&w.z<G}N=N.faces;y=0;for(O=N.length;y<O;y++){t=N[y];if(t instanceof THREE.Face3){w=Q[t.a];L=Q[t.b];F=Q[t.c];if(w.__visible&&L.__visible&&F.__visible&&(v.doubleSided||v.flipSided!=(F.positionScreen.x-w.positionScreen.x)*(L.positionScreen.y-w.positionScreen.y)-
-(F.positionScreen.y-w.positionScreen.y)*(L.positionScreen.x-w.positionScreen.x)<0)){f=g[i]=g[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(w.positionWorld);f.v2.positionWorld.copy(L.positionWorld);f.v3.positionWorld.copy(F.positionWorld);f.v1.positionScreen.copy(w.positionScreen);f.v2.positionScreen.copy(L.positionScreen);f.v3.positionScreen.copy(F.positionScreen);f.normalWorld.copy(t.normal);z.multiplyVector3(f.normalWorld);f.centroidWorld.copy(t.centroid);P.multiplyVector3(f.centroidWorld);
-f.centroidScreen.copy(f.centroidWorld);j.multiplyVector3(f.centroidScreen);F=t.vertexNormals;M=f.vertexNormalsWorld;w=0;for(L=F.length;w<L;w++){S=M[w]=M[w]||new THREE.Vector3;S.copy(F[w]);z.multiplyVector3(S)}f.z=f.centroidScreen.z;f.meshMaterials=R;f.faceMaterials=t.materials;f.overdraw=C;if(v.geometry.uvs[y]){f.uvs[0]=v.geometry.uvs[y][0];f.uvs[1]=v.geometry.uvs[y][1];f.uvs[2]=v.geometry.uvs[y][2]}E.push(f);i++}}else if(t instanceof THREE.Face4){w=Q[t.a];L=Q[t.b];F=Q[t.c];S=Q[t.d];if(w.__visible&&
-L.__visible&&F.__visible&&S.__visible&&(v.doubleSided||v.flipSided!=((S.positionScreen.x-w.positionScreen.x)*(L.positionScreen.y-w.positionScreen.y)-(S.positionScreen.y-w.positionScreen.y)*(L.positionScreen.x-w.positionScreen.x)<0||(L.positionScreen.x-F.positionScreen.x)*(S.positionScreen.y-F.positionScreen.y)-(L.positionScreen.y-F.positionScreen.y)*(S.positionScreen.x-F.positionScreen.x)<0))){f=g[i]=g[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(w.positionWorld);f.v2.positionWorld.copy(L.positionWorld);
-f.v3.positionWorld.copy(S.positionWorld);f.v1.positionScreen.copy(w.positionScreen);f.v2.positionScreen.copy(L.positionScreen);f.v3.positionScreen.copy(S.positionScreen);f.normalWorld.copy(t.normal);z.multiplyVector3(f.normalWorld);f.centroidWorld.copy(t.centroid);P.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);j.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=R;f.faceMaterials=t.materials;f.overdraw=C;if(v.geometry.uvs[y]){f.uvs[0]=v.geometry.uvs[y][0];
-f.uvs[1]=v.geometry.uvs[y][1];f.uvs[2]=v.geometry.uvs[y][3]}E.push(f);i++;h=g[i]=g[i]||new THREE.RenderableFace3;h.v1.positionWorld.copy(L.positionWorld);h.v2.positionWorld.copy(F.positionWorld);h.v3.positionWorld.copy(S.positionWorld);h.v1.positionScreen.copy(L.positionScreen);h.v2.positionScreen.copy(F.positionScreen);h.v3.positionScreen.copy(S.positionScreen);h.normalWorld.copy(f.normalWorld);h.centroidWorld.copy(f.centroidWorld);h.centroidScreen.copy(f.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=
-R;h.faceMaterials=t.materials;h.overdraw=C;if(v.geometry.uvs[y]){h.uvs[0]=v.geometry.uvs[y][1];h.uvs[1]=v.geometry.uvs[y][2];h.uvs[2]=v.geometry.uvs[y][3]}E.push(h);i++}}}}else if(v instanceof THREE.Line){H.multiply(j,P);Q=v.geometry.vertices;t=Q[0];t.positionScreen.copy(t.position);H.multiplyVector4(t.positionScreen);y=1;for(O=Q.length;y<O;y++){w=Q[y];w.positionScreen.copy(w.position);H.multiplyVector4(w.positionScreen);L=Q[y-1];A.copy(w.positionScreen);D.copy(L.positionScreen);if(b(A,D)){A.multiplyScalar(1/
-A.w);D.multiplyScalar(1/D.w);k=m[n]=m[n]||new THREE.RenderableLine;k.v1.positionScreen.copy(A);k.v2.positionScreen.copy(D);k.z=Math.max(A.z,D.z);k.materials=v.materials;E.push(k);n++}}}else if(v instanceof THREE.Particle){s.set(v.position.x,v.position.y,v.position.z,1);j.multiplyVector4(s);s.z/=s.w;if(s.z>0&&s.z<1){l=q[o]=q[o]||new THREE.RenderableParticle;l.x=s.x/s.w;l.y=s.y/s.w;l.z=s.z;l.rotation=v.rotation.z;l.scale.x=v.scale.x*Math.abs(l.x-(s.x+x.projectionMatrix.n11)/(s.w+x.projectionMatrix.n14));
-l.scale.y=v.scale.y*Math.abs(l.y-(s.y+x.projectionMatrix.n22)/(s.w+x.projectionMatrix.n24));l.materials=v.materials;E.push(l);o++}}}}I&&E.sort(a);return E};this.unprojectVector=function(B,x){var I=THREE.Matrix4.makeInvert(x.globalMatrix);I.multiplySelf(THREE.Matrix4.makeInvert(x.projectionMatrix));I.multiplyVector3(B);return B}};
-THREE.SVGRenderer=function(){function a(J,v,P){var R,C,z,N;R=0;for(C=J.lights.length;R<C;R++){z=J.lights[R];if(z instanceof THREE.DirectionalLight){N=v.normalWorld.dot(z.position)*z.intensity;if(N>0){P.r+=z.color.r*N;P.g+=z.color.g*N;P.b+=z.color.b*N}}else if(z instanceof THREE.PointLight){I.sub(z.position,v.centroidWorld);I.normalize();N=v.normalWorld.dot(I)*z.intensity;if(N>0){P.r+=z.color.r*N;P.g+=z.color.g*N;P.b+=z.color.b*N}}}}function b(J,v,P,R,C,z){r=d(y++);r.setAttribute("d","M "+J.positionScreen.x+
-" "+J.positionScreen.y+" L "+v.positionScreen.x+" "+v.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+"z");if(C instanceof THREE.MeshBasicMaterial)p.__styleString=C.color.__styleString;else if(C instanceof THREE.MeshLambertMaterial)if(H){A.r=D.r;A.g=D.g;A.b=D.b;a(z,R,A);p.r=C.color.r*A.r;p.g=C.color.g*A.g;p.b=C.color.b*A.b;p.updateStyleString()}else p.__styleString=C.color.__styleString;else if(C instanceof THREE.MeshDepthMaterial){x=1-C.__2near/(C.__farPlusNear-R.z*C.__farMinusNear);
-p.setRGB(x,x,x)}else C instanceof THREE.MeshNormalMaterial&&p.setRGB(e(R.normalWorld.x),e(R.normalWorld.y),e(R.normalWorld.z));C.wireframe?r.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+C.wireframe_linewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframe_linecap+"; stroke-linejoin: "+C.wireframe_linejoin):r.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+C.opacity);i.appendChild(r)}function c(J,v,P,R,C,z,N){r=d(y++);r.setAttribute("d",
-"M "+J.positionScreen.x+" "+J.positionScreen.y+" L "+v.positionScreen.x+" "+v.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+"z");if(z instanceof THREE.MeshBasicMaterial)p.__styleString=z.color.__styleString;else if(z instanceof THREE.MeshLambertMaterial)if(H){A.r=D.r;A.g=D.g;A.b=D.b;a(N,C,A);p.r=z.color.r*A.r;p.g=z.color.g*A.g;p.b=z.color.b*A.b;p.updateStyleString()}else p.__styleString=z.color.__styleString;else if(z instanceof THREE.MeshDepthMaterial){x=
-1-z.__2near/(z.__farPlusNear-C.z*z.__farMinusNear);p.setRGB(x,x,x)}else z instanceof THREE.MeshNormalMaterial&&p.setRGB(e(C.normalWorld.x),e(C.normalWorld.y),e(C.normalWorld.z));z.wireframe?r.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+z.wireframe_linewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframe_linecap+"; stroke-linejoin: "+z.wireframe_linejoin):r.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+z.opacity);i.appendChild(r)}
-function d(J){if(E[J]==null){E[J]=document.createElementNS("http://www.w3.org/2000/svg","path");L==0&&E[J].setAttribute("shape-rendering","crispEdges")}return E[J]}function e(J){return J<0?Math.min((1+J)*0.5,0.5):0.5+Math.min(J*0.5,0.5)}var f=null,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),g,k,n,m,l,o,q,u,s=new THREE.Rectangle,j=new THREE.Rectangle,H=!1,p=new THREE.Color(16777215),A=new THREE.Color(16777215),D=new THREE.Color(0),M=new THREE.Color(0),B=new THREE.Color(0),
-x,I=new THREE.Vector3,E=[],K=[],G=[],r,y,O,w,L=1;this.domElement=i;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(J){switch(J){case "high":L=1;break;case "low":L=0}};this.setSize=function(J,v){g=J;k=v;n=g/2;m=k/2;i.setAttribute("viewBox",-n+" "+-m+" "+g+" "+k);i.setAttribute("width",g);i.setAttribute("height",k);s.set(-n,-m,n,m)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(J,v){var P,R,C,z,N,Q,t,F;this.autoClear&&
-this.clear();f=h.projectScene(J,v,this.sortElements);w=O=y=0;if(H=J.lights.length>0){t=J.lights;D.setRGB(0,0,0);M.setRGB(0,0,0);B.setRGB(0,0,0);P=0;for(R=t.length;P<R;P++){C=t[P];z=C.color;if(C instanceof THREE.AmbientLight){D.r+=z.r;D.g+=z.g;D.b+=z.b}else if(C instanceof THREE.DirectionalLight){M.r+=z.r;M.g+=z.g;M.b+=z.b}else if(C instanceof THREE.PointLight){B.r+=z.r;B.g+=z.g;B.b+=z.b}}}P=0;for(R=f.length;P<R;P++){t=f[P];j.empty();if(t instanceof THREE.RenderableParticle){l=t;l.x*=n;l.y*=-m;C=0;
-for(z=t.materials.length;C<z;C++)if(F=t.materials[C]){N=l;Q=t;var S=O++;if(K[S]==null){K[S]=document.createElementNS("http://www.w3.org/2000/svg","circle");L==0&&K[S].setAttribute("shape-rendering","crispEdges")}r=K[S];r.setAttribute("cx",N.x);r.setAttribute("cy",N.y);r.setAttribute("r",Q.scale.x*n);if(F instanceof THREE.ParticleCircleMaterial){if(H){A.r=D.r+M.r+B.r;A.g=D.g+M.g+B.g;A.b=D.b+M.b+B.b;p.r=F.color.r*A.r;p.g=F.color.g*A.g;p.b=F.color.b*A.b;p.updateStyleString()}else p=F.color;r.setAttribute("style",
-"fill: "+p.__styleString)}i.appendChild(r)}}else if(t instanceof THREE.RenderableLine){l=t.v1;o=t.v2;l.positionScreen.x*=n;l.positionScreen.y*=-m;o.positionScreen.x*=n;o.positionScreen.y*=-m;j.addPoint(l.positionScreen.x,l.positionScreen.y);j.addPoint(o.positionScreen.x,o.positionScreen.y);if(s.instersects(j)){C=0;for(z=t.materials.length;C<z;)if(F=t.materials[C++]){N=l;Q=o;S=w++;if(G[S]==null){G[S]=document.createElementNS("http://www.w3.org/2000/svg","line");L==0&&G[S].setAttribute("shape-rendering",
-"crispEdges")}r=G[S];r.setAttribute("x1",N.positionScreen.x);r.setAttribute("y1",N.positionScreen.y);r.setAttribute("x2",Q.positionScreen.x);r.setAttribute("y2",Q.positionScreen.y);if(F instanceof THREE.LineBasicMaterial){p.__styleString=F.color.__styleString;r.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+F.linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.linecap+"; stroke-linejoin: "+F.linejoin);i.appendChild(r)}}}}else if(t instanceof THREE.RenderableFace3){l=
-t.v1;o=t.v2;q=t.v3;l.positionScreen.x*=n;l.positionScreen.y*=-m;o.positionScreen.x*=n;o.positionScreen.y*=-m;q.positionScreen.x*=n;q.positionScreen.y*=-m;j.addPoint(l.positionScreen.x,l.positionScreen.y);j.addPoint(o.positionScreen.x,o.positionScreen.y);j.addPoint(q.positionScreen.x,q.positionScreen.y);if(s.instersects(j)){C=0;for(z=t.meshMaterials.length;C<z;){F=t.meshMaterials[C++];if(F instanceof THREE.MeshFaceMaterial){N=0;for(Q=t.faceMaterials.length;N<Q;)(F=t.faceMaterials[N++])&&b(l,o,q,t,
-F,J)}else F&&b(l,o,q,t,F,J)}}}else if(t instanceof THREE.RenderableFace4){l=t.v1;o=t.v2;q=t.v3;u=t.v4;l.positionScreen.x*=n;l.positionScreen.y*=-m;o.positionScreen.x*=n;o.positionScreen.y*=-m;q.positionScreen.x*=n;q.positionScreen.y*=-m;u.positionScreen.x*=n;u.positionScreen.y*=-m;j.addPoint(l.positionScreen.x,l.positionScreen.y);j.addPoint(o.positionScreen.x,o.positionScreen.y);j.addPoint(q.positionScreen.x,q.positionScreen.y);j.addPoint(u.positionScreen.x,u.positionScreen.y);if(s.instersects(j)){C=
-0;for(z=t.meshMaterials.length;C<z;){F=t.meshMaterials[C++];if(F instanceof THREE.MeshFaceMaterial){N=0;for(Q=t.faceMaterials.length;N<Q;)(F=t.faceMaterials[N++])&&c(l,o,q,u,t,F,J)}else F&&c(l,o,q,u,t,F,J)}}}}}};THREE.RenderableObject=function(){this.z=this.object=null};
+THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.sounds=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
+THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound3D)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};
+THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound3D){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;
+THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
+THREE.Projector=function(){function a(B,w){return w.z-B.z}function b(B,w){var J=0,E=1,K=B.z+B.w,H=w.z+w.w,r=-B.z+B.w,x=-w.z+w.w;if(K>=0&&H>=0&&r>=0&&x>=0)return!0;else if(K<0&&H<0||r<0&&x<0)return!1;else{if(K<0)J=Math.max(J,K/(K-H));else H<0&&(E=Math.min(E,K/(K-H)));if(r<0)J=Math.max(J,r/(r-x));else x<0&&(E=Math.min(E,r/(r-x)));if(E<J)return!1;else{B.lerpSelf(w,J);w.lerpSelf(B,1-E);return!0}}}var c,d,e=[],f,h,i,g=[],k,n,m=[],l,o,q=[],u=new THREE.Vector4,s=new THREE.Vector4,j=new THREE.Matrix4,I=new THREE.Matrix4,
+p=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],z=new THREE.Vector4,D=new THREE.Vector4,M;this.projectObjects=function(B,w,J){w=[];var E,K,H;d=0;K=B.objects;B=0;for(E=K.length;B<E;B++){H=K[B];var r;if(!(r=!H.visible))if(r=H instanceof THREE.Mesh){a:{r=void 0;for(var x=H.globalMatrix,O=-H.geometry.boundingSphere.radius*Math.max(H.scale.x,Math.max(H.scale.y,H.scale.z)),v=0;v<6;v++){r=p[v].x*x.n14+p[v].y*x.n24+p[v].z*x.n34+p[v].w;if(r<=
+O){r=!1;break a}}r=!0}r=!r}if(!r){c=e[d]=e[d]||new THREE.RenderableObject;u.copy(H.position);j.multiplyVector3(u);c.object=H;c.z=u.z;w.push(c);d++}}J&&w.sort(a);return w};this.projectScene=function(B,w,J){var E=[],K=w.zNear,H=w.zFar,r,x,O,v,L,F,A,P,R,C,y,N,Q,t,G,S;i=n=o=0;w.matrixAutoUpdate&&w.update();j.multiply(w.projectionMatrix,w.globalMatrix);p[0].set(j.n41-j.n11,j.n42-j.n12,j.n43-j.n13,j.n44-j.n14);p[1].set(j.n41+j.n11,j.n42+j.n12,j.n43+j.n13,j.n44+j.n14);p[2].set(j.n41+j.n21,j.n42+j.n22,j.n43+
+j.n23,j.n44+j.n24);p[3].set(j.n41-j.n21,j.n42-j.n22,j.n43-j.n23,j.n44-j.n24);p[4].set(j.n41-j.n31,j.n42-j.n32,j.n43-j.n33,j.n44-j.n34);p[5].set(j.n41+j.n31,j.n42+j.n32,j.n43+j.n33,j.n44+j.n34);for(r=0;r<6;r++){F=p[r];F.divideScalar(Math.sqrt(F.x*F.x+F.y*F.y+F.z*F.z))}B.update(undefined,!1,w);F=this.projectObjects(B,w,!0);B=0;for(r=F.length;B<r;B++){A=F[B].object;if(A.visible){A.matrixAutoUpdate&&A.updateMatrix();P=A.globalMatrix;P.extractRotationMatrix(A.matrixRotation);y=A.matrixRotation;R=A.materials;
+C=A.overdraw;if(A instanceof THREE.Mesh){N=A.geometry;Q=N.vertices;x=0;for(O=Q.length;x<O;x++){t=Q[x];t.positionWorld.copy(t.position);P.multiplyVector3(t.positionWorld);v=t.positionScreen;v.copy(t.positionWorld);j.multiplyVector4(v);v.x/=v.w;v.y/=v.w;t.__visible=v.z>K&&v.z<H}N=N.faces;x=0;for(O=N.length;x<O;x++){t=N[x];if(t instanceof THREE.Face3){v=Q[t.a];L=Q[t.b];G=Q[t.c];if(v.__visible&&L.__visible&&G.__visible&&(A.doubleSided||A.flipSided!=(G.positionScreen.x-v.positionScreen.x)*(L.positionScreen.y-
+v.positionScreen.y)-(G.positionScreen.y-v.positionScreen.y)*(L.positionScreen.x-v.positionScreen.x)<0)){f=g[i]=g[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(v.positionWorld);f.v2.positionWorld.copy(L.positionWorld);f.v3.positionWorld.copy(G.positionWorld);f.v1.positionScreen.copy(v.positionScreen);f.v2.positionScreen.copy(L.positionScreen);f.v3.positionScreen.copy(G.positionScreen);f.normalWorld.copy(t.normal);y.multiplyVector3(f.normalWorld);f.centroidWorld.copy(t.centroid);P.multiplyVector3(f.centroidWorld);
+f.centroidScreen.copy(f.centroidWorld);j.multiplyVector3(f.centroidScreen);G=t.vertexNormals;M=f.vertexNormalsWorld;v=0;for(L=G.length;v<L;v++){S=M[v]=M[v]||new THREE.Vector3;S.copy(G[v]);y.multiplyVector3(S)}f.z=f.centroidScreen.z;f.meshMaterials=R;f.faceMaterials=t.materials;f.overdraw=C;if(A.geometry.uvs[x]){f.uvs[0]=A.geometry.uvs[x][0];f.uvs[1]=A.geometry.uvs[x][1];f.uvs[2]=A.geometry.uvs[x][2]}E.push(f);i++}}else if(t instanceof THREE.Face4){v=Q[t.a];L=Q[t.b];G=Q[t.c];S=Q[t.d];if(v.__visible&&
+L.__visible&&G.__visible&&S.__visible&&(A.doubleSided||A.flipSided!=((S.positionScreen.x-v.positionScreen.x)*(L.positionScreen.y-v.positionScreen.y)-(S.positionScreen.y-v.positionScreen.y)*(L.positionScreen.x-v.positionScreen.x)<0||(L.positionScreen.x-G.positionScreen.x)*(S.positionScreen.y-G.positionScreen.y)-(L.positionScreen.y-G.positionScreen.y)*(S.positionScreen.x-G.positionScreen.x)<0))){f=g[i]=g[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(v.positionWorld);f.v2.positionWorld.copy(L.positionWorld);
+f.v3.positionWorld.copy(S.positionWorld);f.v1.positionScreen.copy(v.positionScreen);f.v2.positionScreen.copy(L.positionScreen);f.v3.positionScreen.copy(S.positionScreen);f.normalWorld.copy(t.normal);y.multiplyVector3(f.normalWorld);f.centroidWorld.copy(t.centroid);P.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);j.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=R;f.faceMaterials=t.materials;f.overdraw=C;if(A.geometry.uvs[x]){f.uvs[0]=A.geometry.uvs[x][0];
+f.uvs[1]=A.geometry.uvs[x][1];f.uvs[2]=A.geometry.uvs[x][3]}E.push(f);i++;h=g[i]=g[i]||new THREE.RenderableFace3;h.v1.positionWorld.copy(L.positionWorld);h.v2.positionWorld.copy(G.positionWorld);h.v3.positionWorld.copy(S.positionWorld);h.v1.positionScreen.copy(L.positionScreen);h.v2.positionScreen.copy(G.positionScreen);h.v3.positionScreen.copy(S.positionScreen);h.normalWorld.copy(f.normalWorld);h.centroidWorld.copy(f.centroidWorld);h.centroidScreen.copy(f.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=
+R;h.faceMaterials=t.materials;h.overdraw=C;if(A.geometry.uvs[x]){h.uvs[0]=A.geometry.uvs[x][1];h.uvs[1]=A.geometry.uvs[x][2];h.uvs[2]=A.geometry.uvs[x][3]}E.push(h);i++}}}}else if(A instanceof THREE.Line){I.multiply(j,P);Q=A.geometry.vertices;t=Q[0];t.positionScreen.copy(t.position);I.multiplyVector4(t.positionScreen);x=1;for(O=Q.length;x<O;x++){v=Q[x];v.positionScreen.copy(v.position);I.multiplyVector4(v.positionScreen);L=Q[x-1];z.copy(v.positionScreen);D.copy(L.positionScreen);if(b(z,D)){z.multiplyScalar(1/
+z.w);D.multiplyScalar(1/D.w);k=m[n]=m[n]||new THREE.RenderableLine;k.v1.positionScreen.copy(z);k.v2.positionScreen.copy(D);k.z=Math.max(z.z,D.z);k.materials=A.materials;E.push(k);n++}}}else if(A instanceof THREE.Particle){s.set(A.position.x,A.position.y,A.position.z,1);j.multiplyVector4(s);s.z/=s.w;if(s.z>0&&s.z<1){l=q[o]=q[o]||new THREE.RenderableParticle;l.x=s.x/s.w;l.y=s.y/s.w;l.z=s.z;l.rotation=A.rotation.z;l.scale.x=A.scale.x*Math.abs(l.x-(s.x+w.projectionMatrix.n11)/(s.w+w.projectionMatrix.n14));
+l.scale.y=A.scale.y*Math.abs(l.y-(s.y+w.projectionMatrix.n22)/(s.w+w.projectionMatrix.n24));l.materials=A.materials;E.push(l);o++}}}}J&&E.sort(a);return E};this.unprojectVector=function(B,w){var J=THREE.Matrix4.makeInvert(w.globalMatrix);J.multiplySelf(THREE.Matrix4.makeInvert(w.projectionMatrix));J.multiplyVector3(B);return B}};
+THREE.SVGRenderer=function(){function a(F,A,P){var R,C,y,N;R=0;for(C=F.lights.length;R<C;R++){y=F.lights[R];if(y instanceof THREE.DirectionalLight){N=A.normalWorld.dot(y.position)*y.intensity;if(N>0){P.r+=y.color.r*N;P.g+=y.color.g*N;P.b+=y.color.b*N}}else if(y instanceof THREE.PointLight){J.sub(y.position,A.centroidWorld);J.normalize();N=A.normalWorld.dot(J)*y.intensity;if(N>0){P.r+=y.color.r*N;P.g+=y.color.g*N;P.b+=y.color.b*N}}}}function b(F,A,P,R,C,y){r=d(x++);r.setAttribute("d","M "+F.positionScreen.x+
+" "+F.positionScreen.y+" L "+A.positionScreen.x+" "+A.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+"z");if(C instanceof THREE.MeshBasicMaterial)p.__styleString=C.color.__styleString;else if(C instanceof THREE.MeshLambertMaterial)if(I){z.r=D.r;z.g=D.g;z.b=D.b;a(y,R,z);p.r=C.color.r*z.r;p.g=C.color.g*z.g;p.b=C.color.b*z.b;p.updateStyleString()}else p.__styleString=C.color.__styleString;else if(C instanceof THREE.MeshDepthMaterial){w=1-C.__2near/(C.__farPlusNear-R.z*C.__farMinusNear);
+p.setRGB(w,w,w)}else C instanceof THREE.MeshNormalMaterial&&p.setRGB(e(R.normalWorld.x),e(R.normalWorld.y),e(R.normalWorld.z));C.wireframe?r.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+C.wireframe_linewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframe_linecap+"; stroke-linejoin: "+C.wireframe_linejoin):r.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+C.opacity);i.appendChild(r)}function c(F,A,P,R,C,y,N){r=d(x++);r.setAttribute("d",
+"M "+F.positionScreen.x+" "+F.positionScreen.y+" L "+A.positionScreen.x+" "+A.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+"z");if(y instanceof THREE.MeshBasicMaterial)p.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshLambertMaterial)if(I){z.r=D.r;z.g=D.g;z.b=D.b;a(N,C,z);p.r=y.color.r*z.r;p.g=y.color.g*z.g;p.b=y.color.b*z.b;p.updateStyleString()}else p.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshDepthMaterial){w=
+1-y.__2near/(y.__farPlusNear-C.z*y.__farMinusNear);p.setRGB(w,w,w)}else y instanceof THREE.MeshNormalMaterial&&p.setRGB(e(C.normalWorld.x),e(C.normalWorld.y),e(C.normalWorld.z));y.wireframe?r.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+y.wireframe_linewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframe_linecap+"; stroke-linejoin: "+y.wireframe_linejoin):r.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+y.opacity);i.appendChild(r)}
+function d(F){if(E[F]==null){E[F]=document.createElementNS("http://www.w3.org/2000/svg","path");L==0&&E[F].setAttribute("shape-rendering","crispEdges")}return E[F]}function e(F){return F<0?Math.min((1+F)*0.5,0.5):0.5+Math.min(F*0.5,0.5)}var f=null,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),g,k,n,m,l,o,q,u,s=new THREE.Rectangle,j=new THREE.Rectangle,I=!1,p=new THREE.Color(16777215),z=new THREE.Color(16777215),D=new THREE.Color(0),M=new THREE.Color(0),B=new THREE.Color(0),
+w,J=new THREE.Vector3,E=[],K=[],H=[],r,x,O,v,L=1;this.domElement=i;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(F){switch(F){case "high":L=1;break;case "low":L=0}};this.setSize=function(F,A){g=F;k=A;n=g/2;m=k/2;i.setAttribute("viewBox",-n+" "+-m+" "+g+" "+k);i.setAttribute("width",g);i.setAttribute("height",k);s.set(-n,-m,n,m)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(F,A){var P,R,C,y,N,Q,t,G;this.autoClear&&
+this.clear();f=h.projectScene(F,A,this.sortElements);v=O=x=0;if(I=F.lights.length>0){t=F.lights;D.setRGB(0,0,0);M.setRGB(0,0,0);B.setRGB(0,0,0);P=0;for(R=t.length;P<R;P++){C=t[P];y=C.color;if(C instanceof THREE.AmbientLight){D.r+=y.r;D.g+=y.g;D.b+=y.b}else if(C instanceof THREE.DirectionalLight){M.r+=y.r;M.g+=y.g;M.b+=y.b}else if(C instanceof THREE.PointLight){B.r+=y.r;B.g+=y.g;B.b+=y.b}}}P=0;for(R=f.length;P<R;P++){t=f[P];j.empty();if(t instanceof THREE.RenderableParticle){l=t;l.x*=n;l.y*=-m;C=0;
+for(y=t.materials.length;C<y;C++)if(G=t.materials[C]){N=l;Q=t;var S=O++;if(K[S]==null){K[S]=document.createElementNS("http://www.w3.org/2000/svg","circle");L==0&&K[S].setAttribute("shape-rendering","crispEdges")}r=K[S];r.setAttribute("cx",N.x);r.setAttribute("cy",N.y);r.setAttribute("r",Q.scale.x*n);if(G instanceof THREE.ParticleCircleMaterial){if(I){z.r=D.r+M.r+B.r;z.g=D.g+M.g+B.g;z.b=D.b+M.b+B.b;p.r=G.color.r*z.r;p.g=G.color.g*z.g;p.b=G.color.b*z.b;p.updateStyleString()}else p=G.color;r.setAttribute("style",
+"fill: "+p.__styleString)}i.appendChild(r)}}else if(t instanceof THREE.RenderableLine){l=t.v1;o=t.v2;l.positionScreen.x*=n;l.positionScreen.y*=-m;o.positionScreen.x*=n;o.positionScreen.y*=-m;j.addPoint(l.positionScreen.x,l.positionScreen.y);j.addPoint(o.positionScreen.x,o.positionScreen.y);if(s.instersects(j)){C=0;for(y=t.materials.length;C<y;)if(G=t.materials[C++]){N=l;Q=o;S=v++;if(H[S]==null){H[S]=document.createElementNS("http://www.w3.org/2000/svg","line");L==0&&H[S].setAttribute("shape-rendering",
+"crispEdges")}r=H[S];r.setAttribute("x1",N.positionScreen.x);r.setAttribute("y1",N.positionScreen.y);r.setAttribute("x2",Q.positionScreen.x);r.setAttribute("y2",Q.positionScreen.y);if(G instanceof THREE.LineBasicMaterial){p.__styleString=G.color.__styleString;r.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+G.linewidth+"; stroke-opacity: "+G.opacity+"; stroke-linecap: "+G.linecap+"; stroke-linejoin: "+G.linejoin);i.appendChild(r)}}}}else if(t instanceof THREE.RenderableFace3){l=
+t.v1;o=t.v2;q=t.v3;l.positionScreen.x*=n;l.positionScreen.y*=-m;o.positionScreen.x*=n;o.positionScreen.y*=-m;q.positionScreen.x*=n;q.positionScreen.y*=-m;j.addPoint(l.positionScreen.x,l.positionScreen.y);j.addPoint(o.positionScreen.x,o.positionScreen.y);j.addPoint(q.positionScreen.x,q.positionScreen.y);if(s.instersects(j)){C=0;for(y=t.meshMaterials.length;C<y;){G=t.meshMaterials[C++];if(G instanceof THREE.MeshFaceMaterial){N=0;for(Q=t.faceMaterials.length;N<Q;)(G=t.faceMaterials[N++])&&b(l,o,q,t,
+G,F)}else G&&b(l,o,q,t,G,F)}}}else if(t instanceof THREE.RenderableFace4){l=t.v1;o=t.v2;q=t.v3;u=t.v4;l.positionScreen.x*=n;l.positionScreen.y*=-m;o.positionScreen.x*=n;o.positionScreen.y*=-m;q.positionScreen.x*=n;q.positionScreen.y*=-m;u.positionScreen.x*=n;u.positionScreen.y*=-m;j.addPoint(l.positionScreen.x,l.positionScreen.y);j.addPoint(o.positionScreen.x,o.positionScreen.y);j.addPoint(q.positionScreen.x,q.positionScreen.y);j.addPoint(u.positionScreen.x,u.positionScreen.y);if(s.instersects(j)){C=
+0;for(y=t.meshMaterials.length;C<y;){G=t.meshMaterials[C++];if(G instanceof THREE.MeshFaceMaterial){N=0;for(Q=t.faceMaterials.length;N<Q;)(G=t.faceMaterials[N++])&&c(l,o,q,u,t,G,F)}else G&&c(l,o,q,u,t,G,F)}}}}}};THREE.RenderableObject=function(){this.z=this.object=null};
 THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};
 THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};

+ 117 - 116
build/custom/ThreeWebGL.js

@@ -1,6 +1,6 @@
 // ThreeWebGL.js r32 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,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,h,k,l,o,j;if(d==0)f=h=k=0;else{l=Math.floor(a*6);o=a*6-l;a=d*(1-c);j=d*(1-c*o);c=d*(1-c*(1-o));switch(l){case 1:f=j;h=d;k=a;break;case 2:f=a;h=d;k=c;break;case 3:f=a;h=j;k=d;break;case 4:f=c;h=a;k=d;break;case 5:f=d;h=a;k=j;break;case 6:case 0:f=d;h=c;k=a}}this.r=f;this.g=h;this.b=k;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,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,g,j,k,o,i;if(d==0)f=g=j=0;else{k=Math.floor(a*6);o=a*6-k;a=d*(1-c);i=d*(1-c*o);c=d*(1-c*(1-o));switch(k){case 1:f=i;g=d;j=a;break;case 2:f=a;g=d;j=c;break;case 3:f=a;g=i;j=d;break;case 4:f=c;g=a;j=d;break;case 5:f=d;g=a;j=i;break;case 6:case 0:f=d;g=c;j=a}}this.r=f;this.g=g;this.b=j;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*
@@ -13,65 +13,65 @@ this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,c,d,f){this.x=a||
 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,d,f=a.objects,h=[];a=0;for(c=f.length;a<c;a++){d=f[a];d instanceof THREE.Mesh&&(h=h.concat(this.intersectObject(d)))}h.sort(function(k,l){return k.distance-l.distance});return h},intersectObject:function(a){function c(J,I,R,L){L=L.clone().subSelf(I);R=R.clone().subSelf(I);var Q=J.clone().subSelf(I);J=L.dot(L);I=L.dot(R);L=L.dot(Q);var b=R.dot(R);R=R.dot(Q);Q=1/(J*b-I*I);b=(b*L-I*R)*Q;J=(J*R-I*L)*Q;return b>0&&J>0&&b+J<1}var d,f,h,k,l,o,j,r,v,w,
-x,y=a.geometry,F=y.vertices,G=[];d=0;for(f=y.faces.length;d<f;d++){h=y.faces[d];w=this.origin.clone();x=this.direction.clone();j=a.globalMatrix;j.extractRotationMatrix(a.matrixRotation);k=j.multiplyVector3(F[h.a].position.clone());l=j.multiplyVector3(F[h.b].position.clone());o=j.multiplyVector3(F[h.c].position.clone());j=h instanceof THREE.Face4?j.multiplyVector3(F[h.d].position.clone()):null;r=a.matrixRotation.multiplyVector3(h.normal.clone());v=x.dot(r);if(v<0){r=r.dot((new THREE.Vector3).sub(k,
-w))/v;w=w.addSelf(x.multiplyScalar(r));if(h instanceof THREE.Face3){if(c(w,k,l,o)){h={distance:this.origin.distanceTo(w),point:w,face:h,object:a};G.push(h)}}else if(h instanceof THREE.Face4&&(c(w,k,l,j)||c(w,l,o,j))){h={distance:this.origin.distanceTo(w),point:w,face:h,object:a};G.push(h)}}}return G}};
-THREE.Rectangle=function(){function a(){k=f-c;l=h-d}var c,d,f,h,k,l,o=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return k};this.getHeight=function(){return l};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(j,r,v,w){o=!1;c=j;d=r;f=v;h=w;a()};this.addPoint=function(j,r){if(o){o=!1;c=j;d=r;f=j;h=r}else{c=c<j?c:j;d=d<r?d:r;f=f>j?f:j;h=h>r?h:r}a()};
-this.add3Points=function(j,r,v,w,x,y){if(o){o=!1;c=j<v?j<x?j:x:v<x?v:x;d=r<w?r<y?r:y:w<y?w:y;f=j>v?j>x?j:x:v>x?v:x;h=r>w?r>y?r:y:w>y?w:y}else{c=j<v?j<x?j<c?j:c:x<c?x:c:v<x?v<c?v:c:x<c?x:c;d=r<w?r<y?r<d?r:d:y<d?y:d:w<y?w<d?w:d:y<d?y:d;f=j>v?j>x?j>f?j:f:x>f?x:f:v>x?v>f?v:f:x>f?x:f;h=r>w?r>y?r>h?r:h:y>h?y:h:w>y?w>h?w:h:y>h?y:h}a()};this.addRectangle=function(j){if(o){o=!1;c=j.getLeft();d=j.getTop();f=j.getRight();h=j.getBottom()}else{c=c<j.getLeft()?c:j.getLeft();d=d<j.getTop()?d:j.getTop();f=f>j.getRight()?
-f:j.getRight();h=h>j.getBottom()?h:j.getBottom()}a()};this.inflate=function(j){c-=j;d-=j;f+=j;h+=j;a()};this.minSelf=function(j){c=c>j.getLeft()?c:j.getLeft();d=d>j.getTop()?d:j.getTop();f=f<j.getRight()?f:j.getRight();h=h<j.getBottom()?h:j.getBottom();a()};this.instersects=function(j){return Math.min(f,j.getRight())-Math.max(c,j.getLeft())>=0&&Math.min(h,j.getBottom())-Math.max(d,j.getTop())>=0};this.empty=function(){o=!0;h=f=d=c=0;a()};this.isEmpty=function(){return o};this.toString=function(){return"THREE.Rectangle ( left: "+
-c+", right: "+f+", top: "+d+", bottom: "+h+", width: "+k+", height: "+l+" )"}};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,h,k,l,o,j,r,v,w,x,y,F,G){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=f||0;this.n21=h||0;this.n22=k||1;this.n23=l||0;this.n24=o||0;this.n31=j||0;this.n32=r||0;this.n33=v||1;this.n34=w||0;this.n41=x||0;this.n42=y||0;this.n43=F||0;this.n44=G||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,h,k,l,o,j,r,v,w,x,y,F,G){this.n11=a;this.n12=c;this.n13=d;this.n14=f;this.n21=h;this.n22=k;this.n23=l;this.n24=o;this.n31=j;this.n32=r;this.n33=v;this.n34=w;this.n41=x;this.n42=y;this.n43=F;this.n44=G;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,h=THREE.Matrix4.__tmpVec2,k=THREE.Matrix4.__tmpVec3;k.sub(a,c).normalize();f.cross(d,k).normalize();h.cross(k,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.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,h=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)*h;a.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*h;a.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*h;return a},multiplyVector3OnlyZ:function(a){var c=a.x,d=a.y;a=a.z;return(this.n31*c+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*c+this.n42*d+this.n43*
-a+this.n44))},multiplyVector4:function(a){var c=a.x,d=a.y,f=a.z,h=a.w;a.x=this.n11*c+this.n12*d+this.n13*f+this.n14*h;a.y=this.n21*c+this.n22*d+this.n23*f+this.n24*h;a.z=this.n31*c+this.n32*d+this.n33*f+this.n34*h;a.w=this.n41*c+this.n42*d+this.n43*f+this.n44*h;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,h=a.n13,k=a.n14,l=a.n21,o=a.n22,j=a.n23,r=a.n24,v=a.n31,w=a.n32,x=a.n33,y=a.n34,F=a.n41,G=a.n42,J=a.n43,I=a.n44,R=c.n11,L=c.n12,Q=c.n13,b=c.n14,ba=c.n21,ca=c.n22,da=c.n23,ga=c.n24,ea=c.n31,ma=c.n32,ja=c.n33,T=c.n34,aa=c.n41,ka=c.n42,pa=c.n43,ya=c.n44;this.n11=d*R+f*ba+h*ea+k*aa;this.n12=d*L+f*ca+h*ma+k*ka;this.n13=d*Q+f*da+h*ja+k*pa;this.n14=d*b+f*ga+h*T+k*ya;this.n21=l*R+o*ba+j*ea+r*aa;this.n22=l*L+
-o*ca+j*ma+r*ka;this.n23=l*Q+o*da+j*ja+r*pa;this.n24=l*b+o*ga+j*T+r*ya;this.n31=v*R+w*ba+x*ea+y*aa;this.n32=v*L+w*ca+x*ma+y*ka;this.n33=v*Q+w*da+x*ja+y*pa;this.n34=v*b+w*ga+x*T+y*ya;this.n41=F*R+G*ba+J*ea+I*aa;this.n42=F*L+G*ca+J*ma+I*ka;this.n43=F*Q+G*da+J*ja+I*pa;this.n44=F*b+G*ga+J*T+I*ya;return this},multiplyToArray:function(a,c,d){var f=a.n11,h=a.n12,k=a.n13,l=a.n14,o=a.n21,j=a.n22,r=a.n23,v=a.n24,w=a.n31,x=a.n32,y=a.n33,F=a.n34,G=a.n41,J=a.n42,I=a.n43;a=a.n44;var R=c.n11,L=c.n12,Q=c.n13,b=c.n14,
-ba=c.n21,ca=c.n22,da=c.n23,ga=c.n24,ea=c.n31,ma=c.n32,ja=c.n33,T=c.n34,aa=c.n41,ka=c.n42,pa=c.n43;c=c.n44;this.n11=f*R+h*ba+k*ea+l*aa;this.n12=f*L+h*ca+k*ma+l*ka;this.n13=f*Q+h*da+k*ja+l*pa;this.n14=f*b+h*ga+k*T+l*c;this.n21=o*R+j*ba+r*ea+v*aa;this.n22=o*L+j*ca+r*ma+v*ka;this.n23=o*Q+j*da+r*ja+v*pa;this.n24=o*b+j*ga+r*T+v*c;this.n31=w*R+x*ba+y*ea+F*aa;this.n32=w*L+x*ca+y*ma+F*ka;this.n33=w*Q+x*da+y*ja+F*pa;this.n34=w*b+x*ga+y*T+F*c;this.n41=G*R+J*ba+I*ea+a*aa;this.n42=G*L+J*ca+I*ma+a*ka;this.n43=
-G*Q+J*da+I*ja+a*pa;this.n44=G*b+J*ga+I*T+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,h=this.n14,k=this.n21,l=this.n22,o=this.n23,j=this.n24,r=this.n31,v=this.n32,w=this.n33,x=this.n34,y=this.n41,F=this.n42,G=this.n43,J=this.n44,I=a.n11,
-R=a.n21,L=a.n31,Q=a.n41,b=a.n12,ba=a.n22,ca=a.n32,da=a.n42,ga=a.n13,ea=a.n23,ma=a.n33,ja=a.n43,T=a.n14,aa=a.n24,ka=a.n34;a=a.n44;this.n11=c*I+d*R+f*L+h*Q;this.n12=c*b+d*ba+f*ca+h*da;this.n13=c*ga+d*ea+f*ma+h*ja;this.n14=c*T+d*aa+f*ka+h*a;this.n21=k*I+l*R+o*L+j*Q;this.n22=k*b+l*ba+o*ca+j*da;this.n23=k*ga+l*ea+o*ma+j*ja;this.n24=k*T+l*aa+o*ka+j*a;this.n31=r*I+v*R+w*L+x*Q;this.n32=r*b+v*ba+w*ca+x*da;this.n33=r*ga+v*ea+w*ma+x*ja;this.n34=r*T+v*aa+w*ka+x*a;this.n41=y*I+F*R+G*L+J*Q;this.n42=y*b+F*ba+G*
-ca+J*da;this.n43=y*ga+F*ea+G*ma+J*ja;this.n44=y*T+F*aa+G*ka+J*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,h=this.n21,k=this.n22,l=this.n23,o=this.n24,j=this.n31,r=this.n32,v=this.n33,w=this.n34,x=this.n41,y=this.n42,F=this.n43,
-G=this.n44;return f*l*r*x-d*o*r*x-f*k*v*x+c*o*v*x+d*k*w*x-c*l*w*x-f*l*j*y+d*o*j*y+f*h*v*y-a*o*v*y-d*h*w*y+a*l*w*y+f*k*j*F-c*o*j*F-f*h*r*F+a*o*r*F+c*h*w*F-a*k*w*F-d*k*j*G+c*l*j*G+d*h*r*G-a*l*r*G-c*h*v*G+a*k*v*G},transpose:function(){function a(c,d,f){var h=c[d];c[d]=c[f];c[f]=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=
+THREE.Ray.prototype={intersectScene:function(a){var c,d,f=a.objects,g=[];a=0;for(c=f.length;a<c;a++){d=f[a];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(j,k){return j.distance-k.distance});return g},intersectObject:function(a){function c(K,J,R,L){L=L.clone().subSelf(J);R=R.clone().subSelf(J);var P=K.clone().subSelf(J);K=L.dot(L);J=L.dot(R);L=L.dot(P);var b=R.dot(R);R=R.dot(P);P=1/(K*b-J*J);b=(b*L-J*R)*P;K=(K*R-J*L)*P;return b>0&&K>0&&b+K<1}var d,f,g,j,k,o,i,s,w,x,
+z,A=a.geometry,E=A.vertices,H=[];d=0;for(f=A.faces.length;d<f;d++){g=A.faces[d];x=this.origin.clone();z=this.direction.clone();i=a.globalMatrix;i.extractRotationMatrix(a.matrixRotation);j=i.multiplyVector3(E[g.a].position.clone());k=i.multiplyVector3(E[g.b].position.clone());o=i.multiplyVector3(E[g.c].position.clone());i=g instanceof THREE.Face4?i.multiplyVector3(E[g.d].position.clone()):null;s=a.matrixRotation.multiplyVector3(g.normal.clone());w=z.dot(s);if(w<0){s=s.dot((new THREE.Vector3).sub(j,
+x))/w;x=x.addSelf(z.multiplyScalar(s));if(g instanceof THREE.Face3){if(c(x,j,k,o)){g={distance:this.origin.distanceTo(x),point:x,face:g,object:a};H.push(g)}}else if(g instanceof THREE.Face4&&(c(x,j,k,i)||c(x,k,o,i))){g={distance:this.origin.distanceTo(x),point:x,face:g,object:a};H.push(g)}}}return H}};
+THREE.Rectangle=function(){function a(){j=f-c;k=g-d}var c,d,f,g,j,k,o=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return j};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(i,s,w,x){o=!1;c=i;d=s;f=w;g=x;a()};this.addPoint=function(i,s){if(o){o=!1;c=i;d=s;f=i;g=s}else{c=c<i?c:i;d=d<s?d:s;f=f>i?f:i;g=g>s?g:s}a()};
+this.add3Points=function(i,s,w,x,z,A){if(o){o=!1;c=i<w?i<z?i:z:w<z?w:z;d=s<x?s<A?s:A:x<A?x:A;f=i>w?i>z?i:z:w>z?w:z;g=s>x?s>A?s:A:x>A?x:A}else{c=i<w?i<z?i<c?i:c:z<c?z:c:w<z?w<c?w:c:z<c?z:c;d=s<x?s<A?s<d?s:d:A<d?A:d:x<A?x<d?x:d:A<d?A:d;f=i>w?i>z?i>f?i:f:z>f?z:f:w>z?w>f?w:f:z>f?z:f;g=s>x?s>A?s>g?s:g:A>g?A:g:x>A?x>g?x:g:A>g?A:g}a()};this.addRectangle=function(i){if(o){o=!1;c=i.getLeft();d=i.getTop();f=i.getRight();g=i.getBottom()}else{c=c<i.getLeft()?c:i.getLeft();d=d<i.getTop()?d:i.getTop();f=f>i.getRight()?
+f:i.getRight();g=g>i.getBottom()?g:i.getBottom()}a()};this.inflate=function(i){c-=i;d-=i;f+=i;g+=i;a()};this.minSelf=function(i){c=c>i.getLeft()?c:i.getLeft();d=d>i.getTop()?d:i.getTop();f=f<i.getRight()?f:i.getRight();g=g<i.getBottom()?g:i.getBottom();a()};this.instersects=function(i){return Math.min(f,i.getRight())-Math.max(c,i.getLeft())>=0&&Math.min(g,i.getBottom())-Math.max(d,i.getTop())>=0};this.empty=function(){o=!0;g=f=d=c=0;a()};this.isEmpty=function(){return o};this.toString=function(){return"THREE.Rectangle ( left: "+
+c+", right: "+f+", top: "+d+", bottom: "+g+", width: "+j+", height: "+k+" )"}};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,g,j,k,o,i,s,w,x,z,A,E,H){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=f||0;this.n21=g||0;this.n22=j||1;this.n23=k||0;this.n24=o||0;this.n31=i||0;this.n32=s||0;this.n33=w||1;this.n34=x||0;this.n41=z||0;this.n42=A||0;this.n43=E||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,g,j,k,o,i,s,w,x,z,A,E,H){this.n11=a;this.n12=c;this.n13=d;this.n14=f;this.n21=g;this.n22=j;this.n23=k;this.n24=o;this.n31=i;this.n32=s;this.n33=w;this.n34=x;this.n41=z;this.n42=A;this.n43=E;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,g=THREE.Matrix4.__tmpVec2,j=THREE.Matrix4.__tmpVec3;j.sub(a,c).normalize();f.cross(d,j).normalize();g.cross(j,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a);
+this.n31=j.x;this.n32=j.y;this.n33=j.z;this.n34=-j.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,g=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)*g;a.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*g;a.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*g;return a},multiplyVector3OnlyZ:function(a){var c=a.x,d=a.y;a=a.z;return(this.n31*c+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*c+this.n42*d+this.n43*
+a+this.n44))},multiplyVector4:function(a){var c=a.x,d=a.y,f=a.z,g=a.w;a.x=this.n11*c+this.n12*d+this.n13*f+this.n14*g;a.y=this.n21*c+this.n22*d+this.n23*f+this.n24*g;a.z=this.n31*c+this.n32*d+this.n33*f+this.n34*g;a.w=this.n41*c+this.n42*d+this.n43*f+this.n44*g;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,g=a.n13,j=a.n14,k=a.n21,o=a.n22,i=a.n23,s=a.n24,w=a.n31,x=a.n32,z=a.n33,A=a.n34,E=a.n41,H=a.n42,K=a.n43,J=a.n44,R=c.n11,L=c.n12,P=c.n13,b=c.n14,ba=c.n21,ca=c.n22,da=c.n23,ha=c.n24,ea=c.n31,ma=c.n32,ka=c.n33,U=c.n34,aa=c.n41,la=c.n42,qa=c.n43,za=c.n44;this.n11=d*R+f*ba+g*ea+j*aa;this.n12=d*L+f*ca+g*ma+j*la;this.n13=d*P+f*da+g*ka+j*qa;this.n14=d*b+f*ha+g*U+j*za;this.n21=k*R+o*ba+i*ea+s*aa;this.n22=k*L+
+o*ca+i*ma+s*la;this.n23=k*P+o*da+i*ka+s*qa;this.n24=k*b+o*ha+i*U+s*za;this.n31=w*R+x*ba+z*ea+A*aa;this.n32=w*L+x*ca+z*ma+A*la;this.n33=w*P+x*da+z*ka+A*qa;this.n34=w*b+x*ha+z*U+A*za;this.n41=E*R+H*ba+K*ea+J*aa;this.n42=E*L+H*ca+K*ma+J*la;this.n43=E*P+H*da+K*ka+J*qa;this.n44=E*b+H*ha+K*U+J*za;return this},multiplyToArray:function(a,c,d){var f=a.n11,g=a.n12,j=a.n13,k=a.n14,o=a.n21,i=a.n22,s=a.n23,w=a.n24,x=a.n31,z=a.n32,A=a.n33,E=a.n34,H=a.n41,K=a.n42,J=a.n43;a=a.n44;var R=c.n11,L=c.n12,P=c.n13,b=c.n14,
+ba=c.n21,ca=c.n22,da=c.n23,ha=c.n24,ea=c.n31,ma=c.n32,ka=c.n33,U=c.n34,aa=c.n41,la=c.n42,qa=c.n43;c=c.n44;this.n11=f*R+g*ba+j*ea+k*aa;this.n12=f*L+g*ca+j*ma+k*la;this.n13=f*P+g*da+j*ka+k*qa;this.n14=f*b+g*ha+j*U+k*c;this.n21=o*R+i*ba+s*ea+w*aa;this.n22=o*L+i*ca+s*ma+w*la;this.n23=o*P+i*da+s*ka+w*qa;this.n24=o*b+i*ha+s*U+w*c;this.n31=x*R+z*ba+A*ea+E*aa;this.n32=x*L+z*ca+A*ma+E*la;this.n33=x*P+z*da+A*ka+E*qa;this.n34=x*b+z*ha+A*U+E*c;this.n41=H*R+K*ba+J*ea+a*aa;this.n42=H*L+K*ca+J*ma+a*la;this.n43=
+H*P+K*da+J*ka+a*qa;this.n44=H*b+K*ha+J*U+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,g=this.n14,j=this.n21,k=this.n22,o=this.n23,i=this.n24,s=this.n31,w=this.n32,x=this.n33,z=this.n34,A=this.n41,E=this.n42,H=this.n43,K=this.n44,J=a.n11,
+R=a.n21,L=a.n31,P=a.n41,b=a.n12,ba=a.n22,ca=a.n32,da=a.n42,ha=a.n13,ea=a.n23,ma=a.n33,ka=a.n43,U=a.n14,aa=a.n24,la=a.n34;a=a.n44;this.n11=c*J+d*R+f*L+g*P;this.n12=c*b+d*ba+f*ca+g*da;this.n13=c*ha+d*ea+f*ma+g*ka;this.n14=c*U+d*aa+f*la+g*a;this.n21=j*J+k*R+o*L+i*P;this.n22=j*b+k*ba+o*ca+i*da;this.n23=j*ha+k*ea+o*ma+i*ka;this.n24=j*U+k*aa+o*la+i*a;this.n31=s*J+w*R+x*L+z*P;this.n32=s*b+w*ba+x*ca+z*da;this.n33=s*ha+w*ea+x*ma+z*ka;this.n34=s*U+w*aa+x*la+z*a;this.n41=A*J+E*R+H*L+K*P;this.n42=A*b+E*ba+H*
+ca+K*da;this.n43=A*ha+E*ea+H*ma+K*ka;this.n44=A*U+E*aa+H*la+K*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,g=this.n21,j=this.n22,k=this.n23,o=this.n24,i=this.n31,s=this.n32,w=this.n33,x=this.n34,z=this.n41,A=this.n42,E=this.n43,
+H=this.n44;return f*k*s*z-d*o*s*z-f*j*w*z+c*o*w*z+d*j*x*z-c*k*x*z-f*k*i*A+d*o*i*A+f*g*w*A-a*o*w*A-d*g*x*A+a*k*x*A+f*j*i*E-c*o*i*E-f*g*s*E+a*o*s*E+c*g*x*E-a*j*x*E-d*j*i*H+c*k*i*H+d*g*s*H-a*k*s*H-c*g*w*H+a*j*w*H},transpose:function(){function a(c,d,f){var g=c[d];c[d]=c[f];c[f]=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},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=
 this.n34;a[c+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),h=1-d,k=a.x,l=a.y,o=a.z,j=h*k,r=h*l;this.set(j*k+d,j*l-f*o,j*o+f*l,0,j*l+f*o,r*l+d,r*o-f*k,0,j*o-f*l,r*o+f*k,h*o*o+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,d=a.y,f=a.z;a=Math.cos(d);d=Math.sin(d);var h=Math.cos(-f);f=Math.sin(-f);var k=Math.cos(c);c=Math.sin(c);var l=a*f,o=d*f;this.n11=a*h;this.n12=d*c-l*k;this.n13=
-l*c+d*k;this.n21=f;this.n22=h*k;this.n23=-h*c;this.n31=-d*h;this.n32=o*k+a*c;this.n33=-o*c+a*k},setRotationFromQuaternion:function(a){var c=a.x,d=a.y,f=a.z,h=a.w,k=c+c,l=d+d,o=f+f;a=c*k;var j=c*l;c*=o;var r=d*l;d*=o;f*=o;k*=h;l*=h;h*=o;this.n11=1-(r+f);this.n12=j-h;this.n13=c+l;this.n21=j+h;this.n22=1-(a+f);this.n23=d-k;this.n31=c-l;this.n32=d+k;this.n33=1-(a+r)},scale:function(a){var c=a.x,d=a.y;a=a.z;this.n11*=c;this.n12*=c;this.n13*=c;this.n21*=d;this.n22*=d;this.n23*=d;this.n31*=a;this.n32*=a;
-this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},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,c){var d=a.n11,f=a.n12,h=a.n13,k=a.n14,l=a.n21,o=a.n22,j=a.n23,r=a.n24,v=a.n31,w=a.n32,x=a.n33,y=a.n34,F=a.n41,G=a.n42,J=a.n43,I=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=j*y*G-r*x*G+r*w*J-o*y*J-j*w*I+o*x*I;c.n12=k*x*G-h*y*G-k*w*J+f*y*J+h*w*I-f*x*I;c.n13=h*r*G-k*j*G+k*o*J-f*r*J-h*o*I+f*j*I;c.n14=k*j*w-h*r*w-k*o*x+f*r*x+h*o*y-f*j*y;c.n21=r*x*F-j*y*F-r*v*J+l*y*J+j*v*I-l*x*I;c.n22=h*y*F-k*x*F+k*v*J-d*y*J-h*v*I+d*x*I;c.n23=k*j*F-h*r*F-k*l*J+d*r*J+h*l*I-d*j*I;
-c.n24=h*r*v-k*j*v+k*l*x-d*r*x-h*l*y+d*j*y;c.n31=o*y*F-r*w*F+r*v*G-l*y*G-o*v*I+l*w*I;c.n32=k*w*F-f*y*F-k*v*G+d*y*G+f*v*I-d*w*I;c.n33=h*r*F-k*o*F+k*l*G-d*r*G-f*l*I+d*o*I;c.n34=k*o*v-f*r*v-k*l*w+d*r*w+f*l*y-d*o*y;c.n41=j*w*F-o*x*F-j*v*G+l*x*G+o*v*J-l*w*J;c.n42=f*x*F-h*w*F+h*v*G-d*x*G-f*v*J+d*w*J;c.n43=h*o*F-f*j*F-h*l*G+d*j*G+f*l*J-d*o*J;c.n44=f*j*v-h*o*v+h*l*w-d*j*w-f*l*x+d*o*x;c.multiplyScalar(1/a.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,d=c.m,f=a.n33*a.n22-a.n32*a.n23,h=-a.n33*a.n21+a.n31*a.n23,k=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,r=a.n23*a.n12-a.n22*a.n13,v=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*f+a.n21*l+a.n31*r;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*f;d[1]=a*h;d[2]=a*k;d[3]=a*l;d[4]=a*o;d[5]=a*j;d[6]=a*r;d[7]=a*v;d[8]=a*w;return c};
-THREE.Matrix4.makeFrustum=function(a,c,d,f,h,k){var l;l=new THREE.Matrix4;l.n11=2*h/(c-a);l.n12=0;l.n13=(c+a)/(c-a);l.n14=0;l.n21=0;l.n22=2*h/(f-d);l.n23=(f+d)/(f-d);l.n24=0;l.n31=0;l.n32=0;l.n33=-(k+h)/(k-h);l.n34=-2*k*h/(k-h);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,c,d,f){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,d,f)};
-THREE.Matrix4.makeOrtho=function(a,c,d,f,h,k){var l,o,j,r;l=new THREE.Matrix4;o=c-a;j=d-f;r=k-h;l.n11=2/o;l.n12=0;l.n13=0;l.n14=-((c+a)/o);l.n21=0;l.n22=2/j;l.n23=0;l.n24=-((d+f)/j);l.n31=0;l.n32=0;l.n33=-2/r;l.n34=-((k+h)/r);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
+0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),f=Math.sin(c),g=1-d,j=a.x,k=a.y,o=a.z,i=g*j,s=g*k;this.set(i*j+d,i*k-f*o,i*o+f*k,0,i*k+f*o,s*k+d,s*o-f*j,0,i*o-f*k,s*o+f*j,g*o*o+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,d=a.y,f=a.z;a=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var j=Math.cos(f);f=Math.sin(f);var k=a*d,o=c*d;this.n11=g*j;this.n12=-g*f;this.n13=d;this.n21=
+o*j+a*f;this.n22=-o*f+a*j;this.n23=-c*g;this.n31=-k*j+c*f;this.n32=k*f+c*j;this.n33=a*g},setRotationFromQuaternion:function(a){var c=a.x,d=a.y,f=a.z,g=a.w,j=c+c,k=d+d,o=f+f;a=c*j;var i=c*k;c*=o;var s=d*k;d*=o;f*=o;j*=g;k*=g;g*=o;this.n11=1-(s+f);this.n12=i-g;this.n13=c+k;this.n21=i+g;this.n22=1-(a+f);this.n23=d-j;this.n31=c-k;this.n32=d+j;this.n33=1-(a+s)},scale:function(a){var c=a.x,d=a.y;a=a.z;this.n11*=c;this.n12*=c;this.n13*=c;this.n21*=d;this.n22*=d;this.n23*=d;this.n31*=a;this.n32*=a;this.n33*=
+a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},extractPositionVector:function(a){a.x=this.n14;a.y=this.n24;a.z=this.n34},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,c){var d=a.n11,f=a.n12,g=a.n13,j=a.n14,k=a.n21,o=a.n22,i=a.n23,s=a.n24,w=a.n31,x=a.n32,z=a.n33,A=a.n34,E=a.n41,H=a.n42,K=a.n43,J=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=i*A*H-s*z*H+s*x*K-o*A*K-i*x*J+o*z*J;c.n12=j*z*H-g*A*H-j*x*K+f*A*K+g*x*J-f*z*J;c.n13=g*s*H-j*i*H+j*o*K-f*s*K-g*o*J+f*i*J;c.n14=j*i*x-g*s*x-j*o*z+f*s*z+g*o*A-f*i*A;c.n21=s*z*E-i*A*E-s*w*K+k*A*K+i*w*J-k*z*J;c.n22=g*A*E-j*z*E+j*w*K-d*A*K-g*w*J+d*z*J;c.n23=j*i*E-g*s*E-j*k*K+d*s*K+g*k*J-d*i*J;
+c.n24=g*s*w-j*i*w+j*k*z-d*s*z-g*k*A+d*i*A;c.n31=o*A*E-s*x*E+s*w*H-k*A*H-o*w*J+k*x*J;c.n32=j*x*E-f*A*E-j*w*H+d*A*H+f*w*J-d*x*J;c.n33=g*s*E-j*o*E+j*k*H-d*s*H-f*k*J+d*o*J;c.n34=j*o*w-f*s*w-j*k*x+d*s*x+f*k*A-d*o*A;c.n41=i*x*E-o*z*E-i*w*H+k*z*H+o*w*K-k*x*K;c.n42=f*z*E-g*x*E+g*w*H-d*z*H-f*w*K+d*x*K;c.n43=g*o*E-f*i*E-g*k*H+d*i*H+f*k*K-d*o*K;c.n44=f*i*w-g*o*w+g*k*x-d*i*x-f*k*z+d*o*z;c.multiplyScalar(1/a.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,d=c.m,f=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,j=a.n32*a.n21-a.n31*a.n22,k=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,s=a.n23*a.n12-a.n22*a.n13,w=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*f+a.n21*k+a.n31*s;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*f;d[1]=a*g;d[2]=a*j;d[3]=a*k;d[4]=a*o;d[5]=a*i;d[6]=a*s;d[7]=a*w;d[8]=a*x;return c};
+THREE.Matrix4.makeFrustum=function(a,c,d,f,g,j){var k;k=new THREE.Matrix4;k.n11=2*g/(c-a);k.n12=0;k.n13=(c+a)/(c-a);k.n14=0;k.n21=0;k.n22=2*g/(f-d);k.n23=(f+d)/(f-d);k.n24=0;k.n31=0;k.n32=0;k.n33=-(j+g)/(j-g);k.n34=-2*j*g/(j-g);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,c,d,f){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*c,a*c,g,a,d,f)};
+THREE.Matrix4.makeOrtho=function(a,c,d,f,g,j){var k,o,i,s;k=new THREE.Matrix4;o=c-a;i=d-f;s=j-g;k.n11=2/o;k.n12=0;k.n13=0;k.n14=-((c+a)/o);k.n21=0;k.n22=2/i;k.n23=0;k.n24=-((d+f)/i);k.n31=0;k.n32=0;k.n33=-2/s;k.n34=-((j+g)/s);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrixRotation=new THREE.Matrix4;this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=
-1;this.visible=!0};THREE.Object3D.prototype.update=function(a,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;c=!0}var f=this.children.length;for(a=0;a<f;a++)this.children[a].update(this.globalMatrix,c,d)}};
-THREE.Object3D.prototype.updateMatrix=function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.localMatrix.setRotationFromQuaternion(this.quaternion):this.localMatrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0};
-THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var c=this.children.indexOf(a);if(c!==-1){this.children.splice(c,1);a.parent=undefined}};THREE.Object3DCounter={value:0};
+1;this.visible=!0};
+THREE.Object3D.prototype={update:function(a,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;c=!0}var f=this.children.length;for(a=0;a<f;a++)this.children[a].update(this.globalMatrix,c,d)}},updateMatrix:function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.localMatrix.setRotationFromQuaternion(this.quaternion):this.localMatrix.setRotationFromEuler(this.rotation);
+if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){this.children.splice(c,1);a.parent=undefined}}};THREE.Object3DCounter={value:0};
 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=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
-THREE.Face3=function(a,c,d,f,h){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=h instanceof Array?h:[h]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
-THREE.Face4=function(a,c,d,f,h,k){this.a=a;this.b=c;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];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.Face3=function(a,c,d,f,g){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=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
+THREE.Face4=function(a,c,d,f,g,j){this.a=a;this.b=c;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=j instanceof Array?j:[j]};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.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
-d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,f,h,k,l,o=new THREE.Vector3,j=new THREE.Vector3;f=0;for(h=this.vertices.length;f<h;f++){k=this.vertices[f];k.normal.set(0,0,0)}f=0;for(h=this.faces.length;f<h;f++){k=this.faces[f];if(a&&k.vertexNormals.length){o.set(0,0,0);c=0;for(d=k.normal.length;c<d;c++)o.addSelf(k.vertexNormals[c]);o.divideScalar(3)}else{c=this.vertices[k.a];d=this.vertices[k.b];l=this.vertices[k.c];o.sub(l.position,
-d.position);j.sub(c.position,d.position);o.crossSelf(j)}o.isZero()||o.normalize();k.normal.copy(o)}},computeVertexNormals:function(){var a,c,d,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)f[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
+d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,f,g,j,k,o=new THREE.Vector3,i=new THREE.Vector3;f=0;for(g=this.vertices.length;f<g;f++){j=this.vertices[f];j.normal.set(0,0,0)}f=0;for(g=this.faces.length;f<g;f++){j=this.faces[f];if(a&&j.vertexNormals.length){o.set(0,0,0);c=0;for(d=j.normal.length;c<d;c++)o.addSelf(j.vertexNormals[c]);o.divideScalar(3)}else{c=this.vertices[j.a];d=this.vertices[j.b];k=this.vertices[j.c];o.sub(k.position,
+d.position);i.sub(c.position,d.position);o.crossSelf(i)}o.isZero()||o.normalize();j.normal.copy(o)}},computeVertexNormals:function(){var a,c,d,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)f[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)f[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal);f[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)f[a].normalize();a=0;for(c=this.faces.length;a<
-c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c]);d.vertexNormals[3].copy(f[d.d])}}},computeTangents:function(){function a(T,aa,ka,pa,ya,Aa,Ha){k=T.vertices[aa].position;l=T.vertices[ka].position;o=T.vertices[pa].position;j=h[ya];r=h[Aa];v=h[Ha];w=l.x-k.x;x=o.x-k.x;y=l.y-k.y;
-F=o.y-k.y;G=l.z-k.z;J=o.z-k.z;I=r.u-j.u;R=v.u-j.u;L=r.v-j.v;Q=v.v-j.v;b=1/(I*Q-R*L);da.set((Q*w-L*x)*b,(Q*y-L*F)*b,(Q*G-L*J)*b);ga.set((I*x-R*w)*b,(I*F-R*y)*b,(I*J-R*G)*b);ba[aa].addSelf(da);ba[ka].addSelf(da);ba[pa].addSelf(da);ca[aa].addSelf(ga);ca[ka].addSelf(ga);ca[pa].addSelf(ga)}var c,d,f,h,k,l,o,j,r,v,w,x,y,F,G,J,I,R,L,Q,b,ba=[],ca=[],da=new THREE.Vector3,ga=new THREE.Vector3,ea=new THREE.Vector3,ma=new THREE.Vector3,ja=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){ba[c]=new THREE.Vector3;
-ca[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];h=this.uvs[c];if(f instanceof THREE.Face3){a(this,f.a,f.b,f.c,0,1,2);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2])}else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.c,0,1,2);a(this,f.a,f.b,f.d,0,1,3);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2]);
-this.vertices[f.d].normal.copy(f.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){ja.copy(this.vertices[c].normal);f=ba[c];ea.copy(f);ea.subSelf(ja.multiplyScalar(ja.dot(f))).normalize();ma.cross(this.vertices[c].normal,f);f=ma.dot(ca[c]);f=f<0?-1:1;this.vertices[c].tangent.set(ea.x,ea.y,ea.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
+c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c]);d.vertexNormals[3].copy(f[d.d])}}},computeTangents:function(){function a(U,aa,la,qa,za,Ba,Ia){j=U.vertices[aa].position;k=U.vertices[la].position;o=U.vertices[qa].position;i=g[za];s=g[Ba];w=g[Ia];x=k.x-j.x;z=o.x-j.x;A=k.y-j.y;
+E=o.y-j.y;H=k.z-j.z;K=o.z-j.z;J=s.u-i.u;R=w.u-i.u;L=s.v-i.v;P=w.v-i.v;b=1/(J*P-R*L);da.set((P*x-L*z)*b,(P*A-L*E)*b,(P*H-L*K)*b);ha.set((J*z-R*x)*b,(J*E-R*A)*b,(J*K-R*H)*b);ba[aa].addSelf(da);ba[la].addSelf(da);ba[qa].addSelf(da);ca[aa].addSelf(ha);ca[la].addSelf(ha);ca[qa].addSelf(ha)}var c,d,f,g,j,k,o,i,s,w,x,z,A,E,H,K,J,R,L,P,b,ba=[],ca=[],da=new THREE.Vector3,ha=new THREE.Vector3,ea=new THREE.Vector3,ma=new THREE.Vector3,ka=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){ba[c]=new THREE.Vector3;
+ca[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];g=this.uvs[c];if(f instanceof THREE.Face3){a(this,f.a,f.b,f.c,0,1,2);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2])}else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.c,0,1,2);a(this,f.a,f.b,f.d,0,1,3);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2]);
+this.vertices[f.d].normal.copy(f.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){ka.copy(this.vertices[c].normal);f=ba[c];ea.copy(f);ea.subSelf(ka.multiplyScalar(ka.dot(f))).normalize();ma.cross(this.vertices[c].normal,f);f=ma.dot(ca[c]);f=f<0?-1:1;this.vertices[c].tangent.set(ea.x,ea.y,ea.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
-this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(v){var w=[];c=0;for(d=v.length;c<d;c++)v[c]==undefined?w.push("undefined"):w.push(v[c].id);return w.join("_")}var c,d,f,h,k,l,o,j,r={};f=0;for(h=this.faces.length;f<h;f++){k=this.faces[f];
-l=k.materials;o=a(l);r[o]==undefined&&(r[o]={hash:o,counter:0});j=r[o].hash+"_"+r[o].counter;this.geometryChunks[j]==undefined&&(this.geometryChunks[j]={faces:[],materials:l,vertices:0});k=k instanceof THREE.Face3?3:4;if(this.geometryChunks[j].vertices+k>65535){r[o].counter+=1;j=r[o].hash+"_"+r[o].counter;this.geometryChunks[j]==undefined&&(this.geometryChunks[j]={faces:[],materials:l,vertices:0})}this.geometryChunks[j].faces.push(f);this.geometryChunks[j].vertices+=k}},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,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(w){var x=[];c=0;for(d=w.length;c<d;c++)w[c]==undefined?x.push("undefined"):x.push(w[c].id);return x.join("_")}var c,d,f,g,j,k,o,i,s={};f=0;for(g=this.faces.length;f<g;f++){j=this.faces[f];
+k=j.materials;o=a(k);s[o]==undefined&&(s[o]={hash:o,counter:0});i=s[o].hash+"_"+s[o].counter;this.geometryChunks[i]==undefined&&(this.geometryChunks[i]={faces:[],materials:k,vertices:0});j=j instanceof THREE.Face3?3:4;if(this.geometryChunks[i].vertices+j>65535){s[o].counter+=1;i=s[o].hash+"_"+s[o].counter;this.geometryChunks[i]==undefined&&(this.geometryChunks[i]={faces:[],materials:k,vertices:0})}this.geometryChunks[i].faces.push(f);this.geometryChunks[i].vertices+=j}},toString:function(){return"THREE.Geometry ( vertices: "+
 this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
-THREE.Camera=function(a,c,d,f,h,k){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=c||1;this.zNear=d||0.1;this.zFar=f||2E3;this.screenCenterY=this.screenCenterX=0;this.target=k||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);
-this.target.position.addSelf(this.tmpVec)};this.translateZ=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Camera=function(a,c,d,f,g,j){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=c||1;this.zNear=d||0.1;this.zFar=f||2E3;this.screenCenterY=this.screenCenterX=0;this.target=j||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(k,o){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(k);this.tmpVec.crossSelf(this.up);if(o)this.tmpVec.y=
+0;this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};this.translateZ=function(k,o){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(k);if(o)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
 THREE.Camera.prototype.update=function(a,c,d){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;c=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
 this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,c,d)};
-THREE.Camera.prototype.frustumContains=function(a){var c=a.globalMatrix.n14,d=a.globalMatrix.n24,f=a.globalMatrix.n34,h=this.inverseMatrix,k=a.boundRadius*a.boundRadiusScale,l=h.n31*c+h.n32*d+h.n33*f+h.n34;if(l-k>-this.zNear)return!1;if(l+k<-this.zFar)return!1;l-=k;var o=this.projectionMatrix,j=1/(o.n43*l),r=j*this.screenCenterX,v=(h.n11*c+h.n12*d+h.n13*f+h.n14)*o.n11*r;k=o.n11*k*r;if(v+k<-this.screenCenterX)return!1;if(v-k>this.screenCenterX)return!1;c=(h.n21*c+h.n22*d+h.n23*f+h.n24)*o.n22*j*this.screenCenterY;
-if(c+k<-this.screenCenterY)return!1;if(c-k>this.screenCenterY)return!1;a.screenPosition.set(v,c,l,k);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
+THREE.Camera.prototype.frustumContains=function(a){var c=a.globalMatrix.n14,d=a.globalMatrix.n24,f=a.globalMatrix.n34,g=this.inverseMatrix,j=a.boundRadius*a.boundRadiusScale,k=g.n31*c+g.n32*d+g.n33*f+g.n34;if(k-j>-this.zNear)return!1;if(k+j<-this.zFar)return!1;k-=j;var o=this.projectionMatrix,i=1/(o.n43*k),s=i*this.screenCenterX,w=(g.n11*c+g.n12*d+g.n13*f+g.n14)*o.n11*s;j=o.n11*j*s;if(w+j<-this.screenCenterX)return!1;if(w-j>this.screenCenterX)return!1;c=(g.n21*c+g.n22*d+g.n23*f+g.n24)*o.n22*i*this.screenCenterY;
+if(c+j<-this.screenCenterY)return!1;if(c-j>this.screenCenterY)return!1;a.screenPosition.set(w,c,k,j);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 THREE.DirectionalLight=function(a,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.FlatShading=0;THREE.SmoothShading=1;
 THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;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=
@@ -105,81 +105,82 @@ THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;th
 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 (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};
 THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;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 (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
-THREE.Texture=function(a,c,d,f,h,k){if(a.getContext)a.loaded=!0;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=h!==undefined?h:THREE.LinearFilter;this.min_filter=k!==undefined?k:THREE.LinearMipMapLinearFilter};
+THREE.Texture=function(a,c,d,f,g,j){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=g!==undefined?g:THREE.LinearFilter;this.min_filter=j!==undefined?j:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};
 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 (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};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,d){this.width=a;this.height=c;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
-var Uniforms={clone:function(a){var c,d,f,h={};for(c in a){h[c]={};for(d in a[c]){f=a[c][d];h[c][d]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return h},merge:function(a){var c,d,f,h={};for(c=0;c<a.length;c++){f=this.clone(a[c]);for(d in f)h[d]=f[d]}return h}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
+var Uniforms={clone:function(a){var c,d,f,g={};for(c in a){g[c]={};for(d in a[c]){f=a[c][d];g[c][d]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return g},merge:function(a){var c,d,f,g={};for(c=0;c<a.length;c++){f=this.clone(a[c]);for(d in f)g[d]=f[d]}return g}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};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=!1};
 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&&c.length?c:[c];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
-THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
-THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.push(a);for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};
-THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);c!==-1&&this.objects.splice(c,1)}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;
-THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;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.WebGLRenderer=function(a){function c(e,m,n){var g,i,q,t=e.vertices,u=t.length,H=e.colors,B=H.length,A=e.__vertexArray,z=e.__colorArray,K=e.__sortArray,M=e.__dirtyVertices,Z=e.__dirtyColors;if(n.sortParticles){aa.multiplySelf(n.globalMatrix);for(g=0;g<u;g++){i=t[g].position;Aa.copy(i);aa.multiplyVector3(Aa);K[g]=[Aa.z,g]}K.sort(function($,N){return N[0]-$[0]});for(g=0;g<u;g++){i=t[K[g][1]].position;q=g*3;A[q]=i.x;A[q+1]=i.y;A[q+2]=i.z}for(g=0;g<B;g++){q=g*3;color=H[K[g][1]];z[q]=color.r;z[q+
-1]=color.g;z[q+2]=color.b}}else{if(M)for(g=0;g<u;g++){i=t[g].position;q=g*3;A[q]=i.x;A[q+1]=i.y;A[q+2]=i.z}if(Z)for(g=0;g<B;g++){color=H[g];q=g*3;z[q]=color.r;z[q+1]=color.g;z[q+2]=color.b}}if(M||n.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,A,m)}if(Z||n.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,z,m)}}function d(e,m){e.fragment_shader=m.fragment_shader;e.vertex_shader=m.vertex_shader;e.uniforms=Uniforms.clone(m.uniforms)}
-function f(e,m,n,g,i){g.program||da.initMaterial(g,m,n);var q=g.program,t=q.uniforms,u=g.uniforms;if(q!=ba){b.useProgram(q);ba=q;b.uniformMatrix4fv(t.projectionMatrix,!1,ka)}if(n&&(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial||g instanceof THREE.LineBasicMaterial||g instanceof THREE.ParticleBasicMaterial)){u.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){u.fogNear.value=n.near;u.fogFar.value=n.far}else if(n instanceof
-THREE.FogExp2)u.fogDensity.value=n.density}if(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial){var H,B,A=0,z=0,K=0,M,Z,$,N=da.lights,O=N.directional.colors,P=N.directional.positions,qa=N.point.colors,s=N.point.positions,oa=0,la=0;n=B=B=0;for(H=m.length;n<H;n++){B=m[n];M=B.color;Z=B.position;$=B.intensity;if(B instanceof THREE.AmbientLight){A+=M.r;z+=M.g;K+=M.b}else if(B instanceof THREE.DirectionalLight){B=oa*3;O[B]=M.r*$;O[B+1]=M.g*$;O[B+2]=M.b*$;P[B]=Z.x;P[B+1]=Z.y;
-P[B+2]=Z.z;oa+=1}else if(B instanceof THREE.PointLight){B=la*3;qa[B]=M.r*$;qa[B+1]=M.g*$;qa[B+2]=M.b*$;s[B]=Z.x;s[B+1]=Z.y;s[B+2]=Z.z;la+=1}}for(n=oa*3;n<O.length;n++)O[n]=0;for(n=la*3;n<qa.length;n++)qa[n]=0;N.point.length=la;N.directional.length=oa;N.ambient[0]=A;N.ambient[1]=z;N.ambient[2]=K;m=da.lights;u.enableLighting.value=m.directional.length+m.point.length;u.ambientLightColor.value=m.ambient;u.directionalLightColor.value=m.directional.colors;u.directionalLightDirection.value=m.directional.positions;
-u.pointLightColor.value=m.point.colors;u.pointLightPosition.value=m.point.positions}if(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial){u.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);u.opacity.value=g.opacity;u.map.texture=g.map;u.light_map.texture=g.light_map;u.env_map.texture=g.env_map;u.reflectivity.value=g.reflectivity;u.refraction_ratio.value=g.refraction_ratio;u.combine.value=g.combine;u.useRefract.value=
-g.env_map&&g.env_map.mapping instanceof THREE.CubeRefractionMapping}if(g instanceof THREE.LineBasicMaterial){u.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);u.opacity.value=g.opacity}else if(g instanceof THREE.ParticleBasicMaterial){u.psColor.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);u.opacity.value=g.opacity;u.size.value=g.size;u.map.texture=g.map}else if(g instanceof THREE.MeshPhongMaterial){u.ambient.value.setRGB(g.ambient.r,g.ambient.g,
-g.ambient.b);u.specular.value.setRGB(g.specular.r,g.specular.g,g.specular.b);u.shininess.value=g.shininess}else if(g instanceof THREE.MeshDepthMaterial){u.mNear.value=e.zNear;u.mFar.value=e.zFar;u.opacity.value=g.opacity}else if(g instanceof THREE.MeshNormalMaterial)u.opacity.value=g.opacity;for(var sa in u)if(A=q.uniforms[sa]){n=u[sa];H=n.type;m=n.value;if(H=="i")b.uniform1i(A,m);else if(H=="f")b.uniform1f(A,m);else if(H=="fv1")b.uniform1fv(A,m);else if(H=="fv")b.uniform3fv(A,m);else if(H=="v2")b.uniform2f(A,
-m.x,m.y);else if(H=="v3")b.uniform3f(A,m.x,m.y,m.z);else if(H=="c")b.uniform3f(A,m.r,m.g,m.b);else if(H=="t"){b.uniform1i(A,m);if(n=n.texture)if(n.image instanceof Array&&n.image.length==6){if(n.image.length==6){if(!n.image.__webGLTextureCube&&!n.image.__cubeMapInitialized&&n.image.loadCount==6){n.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,n.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,
-b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(H=0;H<6;++H)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+H,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,n.image[H]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);n.image.__cubeMapInitialized=!0}b.activeTexture(b.TEXTURE0+m);b.bindTexture(b.TEXTURE_CUBE_MAP,n.image.__webGLTextureCube)}}else{if(!n.__webGLTexture&&
-n.image.loaded){n.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,n.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,n.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,L(n.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,L(n.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,L(n.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,L(n.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+
-m);b.bindTexture(b.TEXTURE_2D,n.__webGLTexture)}}}b.uniformMatrix4fv(t.modelViewMatrix,!1,i._modelViewMatrixArray);b.uniformMatrix3fv(t.normalMatrix,!1,i._normalMatrixArray);(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshPhongMaterial||g.env_map)&&b.uniform3f(t.cameraPosition,e.position.x,e.position.y,e.position.z);(g instanceof THREE.MeshShaderMaterial||g.env_map||g.skinning)&&b.uniformMatrix4fv(t.objectMatrix,!1,i._objectMatrixArray);(g instanceof THREE.MeshPhongMaterial||g instanceof
-THREE.MeshLambertMaterial||g instanceof THREE.MeshShaderMaterial||g.skinning)&&b.uniformMatrix4fv(t.viewMatrix,!1,ya);if(g.skinning){b.uniformMatrix4fv(t.cameraInverseMatrix,!1,pa);b.uniformMatrix4fv(t.boneGlobalMatrices,!1,i.boneMatrices)}return q}function h(e,m,n,g,i,q){e=f(e,m,n,g,q).attributes;b.bindBuffer(b.ARRAY_BUFFER,i.__webGLVertexBuffer);b.vertexAttribPointer(e.position,3,b.FLOAT,!1,0,0);if(e.color>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLColorBuffer);b.vertexAttribPointer(e.color,3,b.FLOAT,
-!1,0,0)}if(e.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT,!1,0,0)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLTangentBuffer);b.vertexAttribPointer(e.tangent,4,b.FLOAT,!1,0,0)}if(e.uv>=0)if(i.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLUVBuffer);b.vertexAttribPointer(e.uv,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv)}else b.disableVertexAttribArray(e.uv);if(e.uv2>=0)if(i.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,
-i.__webGLUV2Buffer);b.vertexAttribPointer(e.uv2,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(g.skinning&&e.skinVertexA>=0&&e.skinVertexB>=0&&e.skinIndex>=0&&e.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);b.vertexAttribPointer(e.skinVertexA,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);b.vertexAttribPointer(e.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);b.vertexAttribPointer(e.skinIndex,
-4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);b.vertexAttribPointer(e.skinWeight,4,b.FLOAT,!1,0,0)}if(q instanceof THREE.Mesh)if(g.wireframe){b.lineWidth(g.wireframe_linewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);b.drawElements(b.LINES,i.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,i.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(q instanceof THREE.Line){q=q.type==THREE.LineStrip?
-b.LINE_STRIP:b.LINES;b.lineWidth(g.linewidth);b.drawArrays(q,0,i.__webGLLineCount)}else if(q instanceof THREE.ParticleSystem)b.drawArrays(b.POINTS,0,i.__webGLParticleCount);else q instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,i.__webGLVertexCount)}function k(e,m){if(!e.__webGLVertexBuffer)e.__webGLVertexBuffer=b.createBuffer();if(!e.__webGLNormalBuffer)e.__webGLNormalBuffer=b.createBuffer();if(e.hasPos){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,e.positionArray,
-b.DYNAMIC_DRAW);b.enableVertexAttribArray(m.attributes.position);b.vertexAttribPointer(m.attributes.position,3,b.FLOAT,!1,0,0)}if(e.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,e.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(m.attributes.normal);b.vertexAttribPointer(m.attributes.normal,3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,e.count);e.count=0}function l(e){if(ga!=e.doubleSided){e.doubleSided?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);ga=
-e.doubleSided}if(ea!=e.flipSided){e.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);ea=e.flipSided}}function o(e){if(ja!=e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);ja=e}}function j(e){T[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14);T[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14);T[2].set(e.n41+e.n21,e.n42+e.n22,e.n43+e.n23,e.n44+e.n24);T[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24);T[4].set(e.n41-e.n31,e.n42-e.n32,e.n43-e.n33,e.n44-e.n34);T[5].set(e.n41+e.n31,
-e.n42+e.n32,e.n43+e.n33,e.n44+e.n34);var m;for(e=0;e<6;e++){m=T[e];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function r(e){for(var m=e.globalMatrix,n=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),g=0;g<6;g++){e=T[g].x*m.n14+T[g].y*m.n24+T[g].z*m.n34+T[g].w;if(e<=n)return!1}return!0}function v(e,m){e.list[e.count]=m;e.count+=1}function w(e){var m,n,g=e.object,i=e.opaque,q=e.transparent;q.count=0;e=i.count=0;for(m=g.materials.length;e<m;e++){n=g.materials[e];
-n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?v(q,n):v(i,n)}}function x(e){var m,n,g,i,q=e.object,t=e.buffer,u=e.opaque,H=e.transparent;H.count=0;e=u.count=0;for(g=q.materials.length;e<g;e++){m=q.materials[e];if(m instanceof THREE.MeshFaceMaterial){m=0;for(n=t.materials.length;m<n;m++)(i=t.materials[m])&&(i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?v(H,i):v(u,i))}else{i=m;i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?v(H,i):v(u,i)}}}function y(e,m){return m.z-e.z}
-function F(e,m,n,g,i){if(m[n]==undefined){e.push({buffer:g,object:i,opaque:{list:[],count:0},transparent:{list:[],count:0}});m[n]=1}}function G(e,m){e._modelViewMatrix.multiplyToArray(m.globalMatrix,e.globalMatrix,e._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(e._modelViewMatrix).transposeIntoArray(e._normalMatrixArray)}function J(e){if(e!=ma){switch(e){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,
-b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:b.blendEquation(b.FUNC_REVERSE_SUBTRACT);b.blendFunc(b.ONE,b.ONE);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}ma=e}}function I(e,m){if(e&&!e.__webGLFramebuffer){e.__webGLFramebuffer=b.createFramebuffer();e.__webGLRenderbuffer=b.createRenderbuffer();e.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,
-e.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,e.width,e.height);b.bindTexture(b.TEXTURE_2D,e.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,L(e.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,L(e.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,L(e.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,L(e.min_filter));b.texImage2D(b.TEXTURE_2D,0,L(e.format),e.width,e.height,0,L(e.format),L(e.type),null);b.bindFramebuffer(b.FRAMEBUFFER,
-e.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,e.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,e.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}var n,g,i;if(e){n=e.__webGLFramebuffer;g=e.width;i=e.height}else{n=null;g=Q.width;i=Q.height}if(n!=ca){b.bindFramebuffer(b.FRAMEBUFFER,n);b.viewport(0,0,g,i);m&&b.clear(b.COLOR_BUFFER_BIT|
-b.DEPTH_BUFFER_BIT);ca=n}}function R(e,m){var n;if(e=="fragment")n=b.createShader(b.FRAGMENT_SHADER);else e=="vertex"&&(n=b.createShader(b.VERTEX_SHADER));b.shaderSource(n,m);b.compileShader(n);if(!b.getShaderParameter(n,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(n));return null}return n}function L(e){switch(e){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;
-case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;
-case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var Q=document.createElement("canvas"),b,ba=null,ca=null,da=this,ga=null,ea=null,ma=null,ja=null,T=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],
-aa=new THREE.Matrix4,ka=new Float32Array(16),pa=new Float32Array(16),ya=new Float32Array(16),Aa=new THREE.Vector4,Ha=!0,Na=new THREE.Color(0),Oa=0;if(a){if(a.antialias!==undefined)Ha=a.antialias;a.clearColor!==undefined&&Na.setHex(a.clearColor);if(a.clearAlpha!==undefined)Oa=a.clearAlpha}this.domElement=Q;this.autoClear=!0;this.sortObjects=!1;(function(e,m,n){try{b=Q.getContext("experimental-webgl",{antialias:e})}catch(g){console.log(g)}if(!b)throw"cannot create webgl context";b.clearColor(0,0,0,
-1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(m.r,m.g,m.b,n);_cullEnabled=!0})(Ha,Na,Oa);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(e,m){Q.width=e;Q.height=m;b.viewport(0,0,Q.width,Q.height)};this.setClearColorHex=function(e,m){var n=new THREE.Color(e);
-b.clearColor(n.r,n.g,n.b,m)};this.setClearColor=function(e,m){b.clearColor(e.r,e.g,e.b,m)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.initMaterial=function(e,m,n){var g,i;if(e instanceof THREE.MeshDepthMaterial)d(e,THREE.ShaderLib.depth);else if(e instanceof THREE.MeshNormalMaterial)d(e,THREE.ShaderLib.normal);else if(e instanceof THREE.MeshBasicMaterial)d(e,THREE.ShaderLib.basic);else if(e instanceof THREE.MeshLambertMaterial)d(e,THREE.ShaderLib.lambert);else if(e instanceof
-THREE.MeshPhongMaterial)d(e,THREE.ShaderLib.phong);else if(e instanceof THREE.LineBasicMaterial)d(e,THREE.ShaderLib.basic);else e instanceof THREE.ParticleBasicMaterial&&d(e,THREE.ShaderLib.particle_basic);var q,t,u,H;i=u=H=0;for(q=m.length;i<q;i++){t=m[i];t instanceof THREE.DirectionalLight&&u++;t instanceof THREE.PointLight&&H++}if(H+u<=4)m=u;else{m=Math.ceil(4*u/(H+u));H=4-m}i={directional:m,point:H};H=e.fragment_shader;m=e.vertex_shader;q={fog:n,map:e.map,env_map:e.env_map,light_map:e.light_map,
-vertex_colors:e.vertex_colors,skinning:e.skinning,maxDirLights:i.directional,maxPointLights:i.point};n=b.createProgram();i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.fog?"#define USE_FOG":"",q.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
-q=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-b.attachShader(n,R("fragment",i+H));b.attachShader(n,R("vertex",q+m));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","cameraInverseMatrix","boneGlobalMatrices"];for(g in e.uniforms)n.push(g);g=e.program;H=0;for(m=n.length;H<
-m;H++){i=n[H];g.uniforms[i]=b.getUniformLocation(g,i)}g=e.program;n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];H=0;for(m=n.length;H<m;H++){i=n[H];g.attributes[i]=b.getAttribLocation(g,i)}g=e.program.attributes;b.enableVertexAttribArray(g.position);g.color>=0&&b.enableVertexAttribArray(g.color);g.normal>=0&&b.enableVertexAttribArray(g.normal);g.tangent>=0&&b.enableVertexAttribArray(g.tangent);if(e.skinning&&g.skinVertexA>=0&&g.skinVertexB>=
-0&&g.skinIndex>=0&&g.skinWeight>=0){b.enableVertexAttribArray(g.skinVertexA);b.enableVertexAttribArray(g.skinVertexB);b.enableVertexAttribArray(g.skinIndex);b.enableVertexAttribArray(g.skinWeight)}};this.render=function(e,m,n,g){var i,q,t,u,H,B,A,z,K=e.lights,M=e.fog;m.matrixAutoUpdate&&m.update();m.globalMatrix.flattenToArray(ya);m.projectionMatrix.flattenToArray(ka);m.inverseMatrix.flattenToArray(pa);aa.multiply(m.projectionMatrix,m.globalMatrix);j(aa);THREE.AnimationHandler&&THREE.AnimationHandler.update();
-e.update(undefined,!1,m);this.initWebGLObjects(e,m);I(n,g!==undefined?g:!0);this.autoClear&&this.clear();H=e.__webGLObjects.length;for(g=0;g<H;g++){i=e.__webGLObjects[g];A=i.object;if(A.visible)if(!(A instanceof THREE.Mesh)||r(A)){A.globalMatrix.flattenToArray(A._objectMatrixArray);G(A,m);x(i);i.render=!0;if(this.sortObjects){Aa.copy(A.position);aa.multiplyVector3(Aa);i.z=Aa.z}}else i.render=!1;else i.render=!1}this.sortObjects&&e.__webGLObjects.sort(y);B=e.__webGLObjectsImmediate.length;for(g=0;g<
-B;g++){i=e.__webGLObjectsImmediate[g];A=i.object;if(A.visible){A.matrixAutoUpdate&&A.globalMatrix.flattenToArray(A._objectMatrixArray);G(A,m);w(i)}}J(THREE.NormalBlending);for(g=0;g<H;g++){i=e.__webGLObjects[g];if(i.render){A=i.object;z=i.buffer;t=i.opaque;l(A);for(i=0;i<t.count;i++){u=t.list[i];o(u.depth_test);h(m,K,M,u,z,A)}}}for(g=0;g<B;g++){i=e.__webGLObjectsImmediate[g];A=i.object;if(A.visible){t=i.opaque;l(A);for(i=0;i<t.count;i++){u=t.list[i];o(u.depth_test);q=f(m,K,M,u,A);A.render(function(Z){k(Z,
-q)})}}}for(g=0;g<H;g++){i=e.__webGLObjects[g];if(i.render){A=i.object;z=i.buffer;t=i.transparent;l(A);for(i=0;i<t.count;i++){u=t.list[i];J(u.blending);o(u.depth_test);h(m,K,M,u,z,A)}}}for(g=0;g<B;g++){i=e.__webGLObjectsImmediate[g];A=i.object;if(A.visible){t=i.transparent;l(A);for(i=0;i<t.count;i++){u=t.list[i];J(u.blending);o(u.depth_test);q=f(m,K,M,u,A);A.render(function(Z){k(Z,q)})}}}if(n&&n.min_filter!==THREE.NearestFilter&&n.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,n.__webGLTexture);
-b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=function(e){var m,n,g;if(!e.__webGLObjects){e.__webGLObjects=[];e.__webGLObjectsMap={};e.__webGLObjectsImmediate=[]}m=0;for(n=e.objects.length;m<n;m++){g=e.objects[m];var i=e,q=void 0,t=void 0,u=void 0,H=void 0;t=g.geometry;if(i.__webGLObjectsMap[g.id]==undefined){i.__webGLObjectsMap[g.id]={};g._modelViewMatrix=new THREE.Matrix4;g._normalMatrixArray=new Float32Array(9);g._modelViewMatrixArray=new Float32Array(16);
-g._objectMatrixArray=new Float32Array(16);g.globalMatrix.flattenToArray(g._objectMatrixArray)}H=i.__webGLObjectsMap[g.id];objlist=i.__webGLObjects;if(g instanceof THREE.Mesh){for(q in t.geometryChunks){u=t.geometryChunks[q];if(!u.__webGLVertexBuffer){i=u;i.__webGLVertexBuffer=b.createBuffer();i.__webGLNormalBuffer=b.createBuffer();i.__webGLTangentBuffer=b.createBuffer();i.__webGLColorBuffer=b.createBuffer();i.__webGLUVBuffer=b.createBuffer();i.__webGLUV2Buffer=b.createBuffer();i.__webGLSkinVertexABuffer=
-b.createBuffer();i.__webGLSkinVertexBBuffer=b.createBuffer();i.__webGLSkinIndicesBuffer=b.createBuffer();i.__webGLSkinWeightsBuffer=b.createBuffer();i.__webGLFaceBuffer=b.createBuffer();i.__webGLLineBuffer=b.createBuffer();i=u;var B=g,A=void 0,z=void 0,K=0,M=0,Z=0,$=B.geometry.faces,N=i.faces;A=0;for(z=N.length;A<z;A++){fi=N[A];face=$[fi];if(face instanceof THREE.Face3){K+=3;M+=1;Z+=3}else if(face instanceof THREE.Face4){K+=4;M+=2;Z+=4}}i.__vertexArray=new Float32Array(K*3);i.__normalArray=new Float32Array(K*
-3);i.__tangentArray=new Float32Array(K*4);i.__colorArray=new Float32Array(K*3);i.__uvArray=new Float32Array(K*2);i.__uv2Array=new Float32Array(K*2);i.__skinVertexAArray=new Float32Array(K*4);i.__skinVertexBArray=new Float32Array(K*4);i.__skinIndexArray=new Float32Array(K*4);i.__skinWeightArray=new Float32Array(K*4);i.__faceArray=new Uint16Array(M*3);i.__lineArray=new Uint16Array(Z*2);z=A=i;K=void 0;$=void 0;var O=void 0,P=void 0;O=void 0;N=!1;K=0;for($=B.materials.length;K<$;K++){O=B.materials[K];
-if(O instanceof THREE.MeshFaceMaterial){O=0;for(P=z.materials.length;O<P;O++)if(z.materials[O]&&z.materials[O].shading!=undefined&&z.materials[O].shading==THREE.SmoothShading){N=!0;break}}else if(O&&O.shading!=undefined&&O.shading==THREE.SmoothShading){N=!0;break}if(N)break}A.__needsSmoothNormals=N;i.__webGLFaceCount=M*3;i.__webGLLineCount=Z*2;t.__dirtyVertices=!0;t.__dirtyElements=!0;t.__dirtyUvs=!0;t.__dirtyNormals=!0;t.__dirtyTangents=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyElements||
-t.__dirtyUvs||t.__dirtyNormals||t.__dirtyColors||t.__dirtyTangents){i=u;M=b.DYNAMIC_DRAW;Z=void 0;A=void 0;var qa=void 0,s=void 0,oa=void 0,la=void 0,sa=void 0;qa=void 0;var C=void 0,D=void 0,E=void 0,S=void 0;C=void 0;D=void 0;E=void 0;s=void 0;C=void 0;D=void 0;E=void 0;S=void 0;C=void 0;D=void 0;E=void 0;S=void 0;C=void 0;D=void 0;E=void 0;S=void 0;C=void 0;D=void 0;E=void 0;S=void 0;C=void 0;D=void 0;E=void 0;S=void 0;s=void 0;la=void 0;oa=void 0;sa=void 0;var ra=P=O=N=$=K=B=z=0,fa=0,p=0,ha=i.__vertexArray,
-Fa=i.__uvArray,Ga=i.__uv2Array,va=i.__normalArray,U=i.__tangentArray,ia=i.__colorArray,V=i.__skinVertexAArray,W=i.__skinVertexBArray,X=i.__skinIndexArray,Y=i.__skinWeightArray,wa=i.__faceArray,ta=i.__lineArray,Pa=i.__needsSmoothNormals,na=g.geometry,Ia=na.__dirtyVertices,Ja=na.__dirtyElements,Ea=na.__dirtyUvs,Ka=na.__dirtyNormals,La=na.__dirtyTangents,Ma=na.__dirtyColors,ua=na.vertices,Qa=i.faces,Ra=na.faces,Sa=na.uvs,Ta=na.uvs2,xa=na.colors,Ba=na.skinVerticesA,Ca=na.skinVerticesB,Da=na.skinIndices,
-za=na.skinWeights;Z=0;for(A=Qa.length;Z<A;Z++){qa=Qa[Z];s=Ra[qa];sa=Sa[qa];qa=Ta[qa];oa=s.vertexNormals;la=s.normal;if(s instanceof THREE.Face3){if(Ia){C=ua[s.a].position;D=ua[s.b].position;E=ua[s.c].position;ha[B]=C.x;ha[B+1]=C.y;ha[B+2]=C.z;ha[B+3]=D.x;ha[B+4]=D.y;ha[B+5]=D.z;ha[B+6]=E.x;ha[B+7]=E.y;ha[B+8]=E.z;B+=9}if(za.length){C=za[s.a];D=za[s.b];E=za[s.c];Y[p]=C.x;Y[p+1]=C.y;Y[p+2]=C.z;Y[p+3]=C.w;Y[p+4]=D.x;Y[p+5]=D.y;Y[p+6]=D.z;Y[p+7]=D.w;Y[p+8]=E.x;Y[p+9]=E.y;Y[p+10]=E.z;Y[p+11]=E.w;C=Da[s.a];
-D=Da[s.b];E=Da[s.c];X[p]=C.x;X[p+1]=C.y;X[p+2]=C.z;X[p+3]=C.w;X[p+4]=D.x;X[p+5]=D.y;X[p+6]=D.z;X[p+7]=D.w;X[p+8]=E.x;X[p+9]=E.y;X[p+10]=E.z;X[p+11]=E.w;C=Ba[s.a];D=Ba[s.b];E=Ba[s.c];V[p]=C.x;V[p+1]=C.y;V[p+2]=C.z;V[p+3]=1;V[p+4]=D.x;V[p+5]=D.y;V[p+6]=D.z;V[p+7]=1;V[p+8]=E.x;V[p+9]=E.y;V[p+10]=E.z;V[p+11]=1;C=Ca[s.a];D=Ca[s.b];E=Ca[s.c];W[p]=C.x;W[p+1]=C.y;W[p+2]=C.z;W[p+3]=1;W[p+4]=D.x;W[p+5]=D.y;W[p+6]=D.z;W[p+7]=1;W[p+8]=E.x;W[p+9]=E.y;W[p+10]=E.z;W[p+11]=1;p+=12}if(Ma&&xa.length){C=xa[s.a];D=xa[s.b];
-E=xa[s.c];ia[fa]=C.r;ia[fa+1]=C.g;ia[fa+2]=C.b;ia[fa+3]=D.r;ia[fa+4]=D.g;ia[fa+5]=D.b;ia[fa+6]=E.r;ia[fa+7]=E.g;ia[fa+8]=E.b;fa+=9}if(La&&na.hasTangents){C=ua[s.a].tangent;D=ua[s.b].tangent;E=ua[s.c].tangent;U[P]=C.x;U[P+1]=C.y;U[P+2]=C.z;U[P+3]=C.w;U[P+4]=D.x;U[P+5]=D.y;U[P+6]=D.z;U[P+7]=D.w;U[P+8]=E.x;U[P+9]=E.y;U[P+10]=E.z;U[P+11]=E.w;P+=12}if(Ka)if(oa.length==3&&Pa)for(s=0;s<3;s++){la=oa[s];va[O]=la.x;va[O+1]=la.y;va[O+2]=la.z;O+=3}else for(s=0;s<3;s++){va[O]=la.x;va[O+1]=la.y;va[O+2]=la.z;O+=
-3}if(Ea&&sa)for(s=0;s<3;s++){oa=sa[s];Fa[K]=oa.u;Fa[K+1]=oa.v;K+=2}if(Ea&&qa)for(s=0;s<3;s++){sa=qa[s];Ga[$]=sa.u;Ga[$+1]=sa.v;$+=2}if(Ja){wa[N]=z;wa[N+1]=z+1;wa[N+2]=z+2;N+=3;ta[ra]=z;ta[ra+1]=z+1;ta[ra+2]=z;ta[ra+3]=z+2;ta[ra+4]=z+1;ta[ra+5]=z+2;ra+=6;z+=3}}else if(s instanceof THREE.Face4){if(Ia){C=ua[s.a].position;D=ua[s.b].position;E=ua[s.c].position;S=ua[s.d].position;ha[B]=C.x;ha[B+1]=C.y;ha[B+2]=C.z;ha[B+3]=D.x;ha[B+4]=D.y;ha[B+5]=D.z;ha[B+6]=E.x;ha[B+7]=E.y;ha[B+8]=E.z;ha[B+9]=S.x;ha[B+10]=
-S.y;ha[B+11]=S.z;B+=12}if(za.length){C=za[s.a];D=za[s.b];E=za[s.c];S=za[s.d];Y[p]=C.x;Y[p+1]=C.y;Y[p+2]=C.z;Y[p+3]=C.w;Y[p+4]=D.x;Y[p+5]=D.y;Y[p+6]=D.z;Y[p+7]=D.w;Y[p+8]=E.x;Y[p+9]=E.y;Y[p+10]=E.z;Y[p+11]=E.w;Y[p+12]=S.x;Y[p+13]=S.y;Y[p+14]=S.z;Y[p+15]=S.w;C=Da[s.a];D=Da[s.b];E=Da[s.c];S=Da[s.d];X[p]=C.x;X[p+1]=C.y;X[p+2]=C.z;X[p+3]=C.w;X[p+4]=D.x;X[p+5]=D.y;X[p+6]=D.z;X[p+7]=D.w;X[p+8]=E.x;X[p+9]=E.y;X[p+10]=E.z;X[p+11]=E.w;X[p+12]=S.x;X[p+13]=S.y;X[p+14]=S.z;X[p+15]=S.w;C=Ba[s.a];D=Ba[s.b];E=Ba[s.c];
-S=Ba[s.d];V[p]=C.x;V[p+1]=C.y;V[p+2]=C.z;V[p+3]=1;V[p+4]=D.x;V[p+5]=D.y;V[p+6]=D.z;V[p+7]=1;V[p+8]=E.x;V[p+9]=E.y;V[p+10]=E.z;V[p+11]=1;V[p+12]=S.x;V[p+13]=S.y;V[p+14]=S.z;V[p+15]=1;C=Ca[s.a];D=Ca[s.b];E=Ca[s.c];S=Ca[s.d];W[p]=C.x;W[p+1]=C.y;W[p+2]=C.z;W[p+3]=1;W[p+4]=D.x;W[p+5]=D.y;W[p+6]=D.z;W[p+7]=1;W[p+8]=E.x;W[p+9]=E.y;W[p+10]=E.z;W[p+11]=1;W[p+12]=S.x;W[p+13]=S.y;W[p+14]=S.z;W[p+15]=1;p+=16}if(Ma&&xa.length){C=xa[s.a];D=xa[s.b];E=xa[s.c];S=xa[s.d];ia[fa]=C.r;ia[fa+1]=C.g;ia[fa+2]=C.b;ia[fa+
-3]=D.r;ia[fa+4]=D.g;ia[fa+5]=D.b;ia[fa+6]=E.r;ia[fa+7]=E.g;ia[fa+8]=E.b;ia[fa+9]=S.r;ia[fa+10]=S.g;ia[fa+11]=S.b;fa+=12}if(La&&na.hasTangents){C=ua[s.a].tangent;D=ua[s.b].tangent;E=ua[s.c].tangent;s=ua[s.d].tangent;U[P]=C.x;U[P+1]=C.y;U[P+2]=C.z;U[P+3]=C.w;U[P+4]=D.x;U[P+5]=D.y;U[P+6]=D.z;U[P+7]=D.w;U[P+8]=E.x;U[P+9]=E.y;U[P+10]=E.z;U[P+11]=E.w;U[P+12]=s.x;U[P+13]=s.y;U[P+14]=s.z;U[P+15]=s.w;P+=16}if(Ka)if(oa.length==4&&Pa)for(s=0;s<4;s++){la=oa[s];va[O]=la.x;va[O+1]=la.y;va[O+2]=la.z;O+=3}else for(s=
-0;s<4;s++){va[O]=la.x;va[O+1]=la.y;va[O+2]=la.z;O+=3}if(Ea&&sa)for(s=0;s<4;s++){oa=sa[s];Fa[K]=oa.u;Fa[K+1]=oa.v;K+=2}if(Ea&&qa)for(s=0;s<4;s++){sa=qa[s];Ga[$]=sa.u;Ga[$+1]=sa.v;$+=2}if(Ja){wa[N]=z;wa[N+1]=z+1;wa[N+2]=z+2;wa[N+3]=z;wa[N+4]=z+2;wa[N+5]=z+3;N+=6;ta[ra]=z;ta[ra+1]=z+1;ta[ra+2]=z;ta[ra+3]=z+3;ta[ra+4]=z+1;ta[ra+5]=z+2;ta[ra+6]=z+2;ta[ra+7]=z+3;ra+=8;z+=4}}}if(Ia){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,ha,M)}if(Ma&&xa.length){b.bindBuffer(b.ARRAY_BUFFER,
-i.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,ia,M)}if(Ka){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,va,M)}if(La&&na.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,U,M)}if(Ea&&K>0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Fa,M)}if(Ea&&$>0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,Ga,M)}if(Ja){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);
-b.bufferData(b.ELEMENT_ARRAY_BUFFER,wa,M);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ta,M)}if(p>0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);b.bufferData(b.ARRAY_BUFFER,V,M);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);b.bufferData(b.ARRAY_BUFFER,W,M);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);b.bufferData(b.ARRAY_BUFFER,X,M);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);b.bufferData(b.ARRAY_BUFFER,Y,
-M)}}F(objlist,H,q,u,g)}t.__dirtyVertices=!1;t.__dirtyElements=!1;t.__dirtyUvs=!1;t.__dirtyNormals=!1;t.__dirtyTangents=!1;t.__dirtyColors=!1}else if(g instanceof THREE.Ribbon){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=b.createBuffer();q.__webGLColorBuffer=b.createBuffer();q=t;u=q.vertices.length;q.__vertexArray=new Float32Array(u*3);q.__colorArray=new Float32Array(u*3);q.__webGLVertexCount=u;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){q=t;u=b.DYNAMIC_DRAW;
-z=void 0;z=void 0;B=void 0;i=void 0;K=q.vertices;M=q.colors;$=K.length;Z=M.length;N=q.__vertexArray;A=q.__colorArray;O=q.__dirtyColors;if(q.__dirtyVertices){for(z=0;z<$;z++){B=K[z].position;i=z*3;N[i]=B.x;N[i+1]=B.y;N[i+2]=B.z}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,N,u)}if(O){for(z=0;z<Z;z++){color=M[z];i=z*3;A[i]=color.r;A[i+1]=color.g;A[i+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,A,u)}}F(objlist,H,0,t,g);t.__dirtyVertices=
-!1;t.__dirtyColors=!1}else if(g instanceof THREE.Line){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=b.createBuffer();q.__webGLColorBuffer=b.createBuffer();q=t;u=q.vertices.length;q.__vertexArray=new Float32Array(u*3);q.__colorArray=new Float32Array(u*3);q.__webGLLineCount=u;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){q=t;u=b.DYNAMIC_DRAW;z=void 0;z=void 0;B=void 0;i=void 0;K=q.vertices;M=q.colors;$=K.length;Z=M.length;N=q.__vertexArray;A=q.__colorArray;O=
-q.__dirtyColors;if(q.__dirtyVertices){for(z=0;z<$;z++){B=K[z].position;i=z*3;N[i]=B.x;N[i+1]=B.y;N[i+2]=B.z}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,N,u)}if(O){for(z=0;z<Z;z++){color=M[z];i=z*3;A[i]=color.r;A[i+1]=color.g;A[i+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,A,u)}}F(objlist,H,0,t,g);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(g instanceof THREE.ParticleSystem){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=
-b.createBuffer();q.__webGLColorBuffer=b.createBuffer();q=t;u=q.vertices.length;q.__vertexArray=new Float32Array(u*3);q.__colorArray=new Float32Array(u*3);q.__sortArray=[];q.__webGLParticleCount=u;t.__dirtyVertices=!0;t.__dirtyColors=!0}(t.__dirtyVertices||t.__dirtyColors||g.sortParticles)&&c(t,b.DYNAMIC_DRAW,g,camera);F(objlist,H,0,t,g);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(g instanceof THREE.MarchingCubes){t=H;if(t[0]==undefined){i.__webGLObjectsImmediate.push({object:g,opaque:{list:[],
-count:0},transparent:{list:[],count:0}});t[0]=1}}}};this.removeObject=function(e,m){var n,g;for(n=e.__webGLObjects.length-1;n>=0;n--){g=e.__webGLObjects[n].object;m==g&&e.__webGLObjects.splice(n,1)}};this.setFaceCulling=function(e,m){if(e){!m||m=="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)>
+THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.sounds=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
+THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound3D)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.push(a);for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};
+THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound3D){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);c!==-1&&this.objects.splice(c,1)}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;
+THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;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.WebGLRenderer=function(a){function c(e,n,m){var h,l,v,r=e.vertices,q=r.length,t=e.colors,G=t.length,F=e.__vertexArray,I=e.__colorArray,S=e.__sortArray,y=e.__dirtyVertices,M=e.__dirtyColors;if(m.sortParticles){aa.multiplySelf(m.globalMatrix);for(h=0;h<q;h++){l=r[h].position;Ba.copy(l);aa.multiplyVector3(Ba);S[h]=[Ba.z,h]}S.sort(function(fa,$){return $[0]-fa[0]});for(h=0;h<q;h++){l=r[S[h][1]].position;v=h*3;F[v]=l.x;F[v+1]=l.y;F[v+2]=l.z}for(h=0;h<G;h++){v=h*3;color=t[S[h][1]];I[v]=color.r;I[v+
+1]=color.g;I[v+2]=color.b}}else{if(y)for(h=0;h<q;h++){l=r[h].position;v=h*3;F[v]=l.x;F[v+1]=l.y;F[v+2]=l.z}if(M)for(h=0;h<G;h++){color=t[h];v=h*3;I[v]=color.r;I[v+1]=color.g;I[v+2]=color.b}}if(y||m.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,F,n)}if(M||m.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,I,n)}}function d(e,n){e.fragment_shader=n.fragment_shader;e.vertex_shader=n.vertex_shader;e.uniforms=Uniforms.clone(n.uniforms)}
+function f(e,n,m,h,l){h.program||da.initMaterial(h,n,m);var v=h.program,r=v.uniforms,q=h.uniforms;if(v!=ba){b.useProgram(v);ba=v;b.uniformMatrix4fv(r.projectionMatrix,!1,la)}if(m&&(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial||h instanceof THREE.LineBasicMaterial||h instanceof THREE.ParticleBasicMaterial)){q.fogColor.value.setHex(m.color.hex);if(m instanceof THREE.Fog){q.fogNear.value=m.near;q.fogFar.value=m.far}else if(m instanceof
+THREE.FogExp2)q.fogDensity.value=m.density}if(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial){var t,G,F=0,I=0,S=0,y,M,fa,$=da.lights,Q=$.directional.colors,O=$.directional.positions,N=$.point.colors,ta=$.point.positions,u=0,pa=0;m=G=G=0;for(t=n.length;m<t;m++){G=n[m];y=G.color;M=G.position;fa=G.intensity;if(G instanceof THREE.AmbientLight){F+=y.r;I+=y.g;S+=y.b}else if(G instanceof THREE.DirectionalLight){G=u*3;Q[G]=y.r*fa;Q[G+1]=y.g*fa;Q[G+2]=y.b*fa;O[G]=M.x;O[G+1]=M.y;
+O[G+2]=M.z;u+=1}else if(G instanceof THREE.PointLight){G=pa*3;N[G]=y.r*fa;N[G+1]=y.g*fa;N[G+2]=y.b*fa;ta[G]=M.x;ta[G+1]=M.y;ta[G+2]=M.z;pa+=1}}for(m=u*3;m<Q.length;m++)Q[m]=0;for(m=pa*3;m<N.length;m++)N[m]=0;$.point.length=pa;$.directional.length=u;$.ambient[0]=F;$.ambient[1]=I;$.ambient[2]=S;n=da.lights;q.enableLighting.value=n.directional.length+n.point.length;q.ambientLightColor.value=n.ambient;q.directionalLightColor.value=n.directional.colors;q.directionalLightDirection.value=n.directional.positions;
+q.pointLightColor.value=n.point.colors;q.pointLightPosition.value=n.point.positions}if(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial){q.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);q.opacity.value=h.opacity;q.map.texture=h.map;q.light_map.texture=h.light_map;q.env_map.texture=h.env_map;q.reflectivity.value=h.reflectivity;q.refraction_ratio.value=h.refraction_ratio;q.combine.value=h.combine;q.useRefract.value=
+h.env_map&&h.env_map.mapping instanceof THREE.CubeRefractionMapping}if(h instanceof THREE.LineBasicMaterial){q.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);q.opacity.value=h.opacity}else if(h instanceof THREE.ParticleBasicMaterial){q.psColor.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);q.opacity.value=h.opacity;q.size.value=h.size;q.map.texture=h.map}else if(h instanceof THREE.MeshPhongMaterial){q.ambient.value.setRGB(h.ambient.r,h.ambient.g,
+h.ambient.b);q.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);q.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){q.mNear.value=e.zNear;q.mFar.value=e.zFar;q.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)q.opacity.value=h.opacity;for(var na in q)if(F=v.uniforms[na]){m=q[na];t=m.type;n=m.value;if(t=="i")b.uniform1i(F,n);else if(t=="f")b.uniform1f(F,n);else if(t=="fv1")b.uniform1fv(F,n);else if(t=="fv")b.uniform3fv(F,n);else if(t=="v2")b.uniform2f(F,
+n.x,n.y);else if(t=="v3")b.uniform3f(F,n.x,n.y,n.z);else if(t=="c")b.uniform3f(F,n.r,n.g,n.b);else if(t=="t"){b.uniform1i(F,n);if(m=m.texture)if(m.image instanceof Array&&m.image.length==6){if(m.image.length==6){if(m.needsUpdate){if(!m.image.__webGLTextureCube)m.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,m.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
+b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(t=0;t<6;++t)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,m.image[t]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);m.needsUpdate=!1}b.activeTexture(b.TEXTURE0+n);b.bindTexture(b.TEXTURE_CUBE_MAP,m.image.__webGLTextureCube)}}else{if(m.needsUpdate){if(m.__wasSetOnce){b.bindTexture(b.TEXTURE_2D,
+m.__webGLTexture);b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,m.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,L(m.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,L(m.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,L(m.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,L(m.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}else{m.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,m.__webGLTexture);b.texImage2D(b.TEXTURE_2D,
+0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,m.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,L(m.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,L(m.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,L(m.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,L(m.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null);m.__wasSetOnce=!0}m.needsUpdate=!1}b.activeTexture(b.TEXTURE0+n);b.bindTexture(b.TEXTURE_2D,m.__webGLTexture)}}}b.uniformMatrix4fv(r.modelViewMatrix,
+!1,l._modelViewMatrixArray);b.uniformMatrix3fv(r.normalMatrix,!1,l._normalMatrixArray);(h instanceof THREE.MeshShaderMaterial||h instanceof THREE.MeshPhongMaterial||h.env_map)&&b.uniform3f(r.cameraPosition,e.position.x,e.position.y,e.position.z);(h instanceof THREE.MeshShaderMaterial||h.env_map||h.skinning)&&b.uniformMatrix4fv(r.objectMatrix,!1,l._objectMatrixArray);(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshShaderMaterial||h.skinning)&&b.uniformMatrix4fv(r.viewMatrix,
+!1,za);if(h.skinning){b.uniformMatrix4fv(r.cameraInverseMatrix,!1,qa);b.uniformMatrix4fv(r.boneGlobalMatrices,!1,l.boneMatrices)}return v}function g(e,n,m,h,l,v){e=f(e,n,m,h,v).attributes;b.bindBuffer(b.ARRAY_BUFFER,l.__webGLVertexBuffer);b.vertexAttribPointer(e.position,3,b.FLOAT,!1,0,0);if(e.color>=0){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLColorBuffer);b.vertexAttribPointer(e.color,3,b.FLOAT,!1,0,0)}if(e.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLNormalBuffer);b.vertexAttribPointer(e.normal,
+3,b.FLOAT,!1,0,0)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLTangentBuffer);b.vertexAttribPointer(e.tangent,4,b.FLOAT,!1,0,0)}if(e.uv>=0)if(l.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLUVBuffer);b.vertexAttribPointer(e.uv,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv)}else b.disableVertexAttribArray(e.uv);if(e.uv2>=0)if(l.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLUV2Buffer);b.vertexAttribPointer(e.uv2,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);
+if(h.skinning&&e.skinVertexA>=0&&e.skinVertexB>=0&&e.skinIndex>=0&&e.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLSkinVertexABuffer);b.vertexAttribPointer(e.skinVertexA,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,l.__webGLSkinVertexBBuffer);b.vertexAttribPointer(e.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,l.__webGLSkinIndicesBuffer);b.vertexAttribPointer(e.skinIndex,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,l.__webGLSkinWeightsBuffer);b.vertexAttribPointer(e.skinWeight,
+4,b.FLOAT,!1,0,0)}if(v instanceof THREE.Mesh)if(h.wireframe){b.lineWidth(h.wireframe_linewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,l.__webGLLineBuffer);b.drawElements(b.LINES,l.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,l.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,l.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(v instanceof THREE.Line){v=v.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(h.linewidth);b.drawArrays(v,0,l.__webGLLineCount)}else if(v instanceof
+THREE.ParticleSystem)b.drawArrays(b.POINTS,0,l.__webGLParticleCount);else v instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,l.__webGLVertexCount)}function j(e,n){if(!e.__webGLVertexBuffer)e.__webGLVertexBuffer=b.createBuffer();if(!e.__webGLNormalBuffer)e.__webGLNormalBuffer=b.createBuffer();if(e.hasPos){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,e.positionArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(n.attributes.position);b.vertexAttribPointer(n.attributes.position,
+3,b.FLOAT,!1,0,0)}if(e.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,e.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(n.attributes.normal);b.vertexAttribPointer(n.attributes.normal,3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,e.count);e.count=0}function k(e){if(ha!=e.doubleSided){e.doubleSided?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);ha=e.doubleSided}if(ea!=e.flipSided){e.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);ea=e.flipSided}}function o(e){if(ka!=
+e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);ka=e}}function i(e){U[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14);U[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14);U[2].set(e.n41+e.n21,e.n42+e.n22,e.n43+e.n23,e.n44+e.n24);U[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24);U[4].set(e.n41-e.n31,e.n42-e.n32,e.n43-e.n33,e.n44-e.n34);U[5].set(e.n41+e.n31,e.n42+e.n32,e.n43+e.n33,e.n44+e.n34);var n;for(e=0;e<6;e++){n=U[e];n.divideScalar(Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z))}}
+function s(e){for(var n=e.globalMatrix,m=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),h=0;h<6;h++){e=U[h].x*n.n14+U[h].y*n.n24+U[h].z*n.n34+U[h].w;if(e<=m)return!1}return!0}function w(e,n){e.list[e.count]=n;e.count+=1}function x(e){var n,m,h=e.object,l=e.opaque,v=e.transparent;v.count=0;e=l.count=0;for(n=h.materials.length;e<n;e++){m=h.materials[e];m.opacity&&m.opacity<1||m.blending!=THREE.NormalBlending?w(v,m):w(l,m)}}function z(e){var n,m,h,l,v=e.object,r=
+e.buffer,q=e.opaque,t=e.transparent;t.count=0;e=q.count=0;for(h=v.materials.length;e<h;e++){n=v.materials[e];if(n instanceof THREE.MeshFaceMaterial){n=0;for(m=r.materials.length;n<m;n++)(l=r.materials[n])&&(l.opacity&&l.opacity<1||l.blending!=THREE.NormalBlending?w(t,l):w(q,l))}else{l=n;l.opacity&&l.opacity<1||l.blending!=THREE.NormalBlending?w(t,l):w(q,l)}}}function A(e,n){return n.z-e.z}function E(e,n,m,h,l){if(n[m]==undefined){e.push({buffer:h,object:l,opaque:{list:[],count:0},transparent:{list:[],
+count:0}});n[m]=1}}function H(e,n){e._modelViewMatrix.multiplyToArray(n.globalMatrix,e.globalMatrix,e._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(e._modelViewMatrix).transposeIntoArray(e._normalMatrixArray)}function K(e){if(e!=ma){switch(e){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);
+break;case THREE.ReverseSubtractiveBlending:b.blendEquation(b.FUNC_REVERSE_SUBTRACT);b.blendFunc(b.ONE,b.ONE);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}ma=e}}function J(e,n){if(e&&!e.__webGLFramebuffer){e.__webGLFramebuffer=b.createFramebuffer();e.__webGLRenderbuffer=b.createRenderbuffer();e.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,e.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,e.width,e.height);b.bindTexture(b.TEXTURE_2D,
+e.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,L(e.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,L(e.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,L(e.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,L(e.min_filter));b.texImage2D(b.TEXTURE_2D,0,L(e.format),e.width,e.height,0,L(e.format),L(e.type),null);b.bindFramebuffer(b.FRAMEBUFFER,e.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,e.__webGLTexture,0);
+b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,e.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}var m,h,l;if(e){m=e.__webGLFramebuffer;h=e.width;l=e.height}else{m=null;h=P.width;l=P.height}if(m!=ca){b.bindFramebuffer(b.FRAMEBUFFER,m);b.viewport(0,0,h,l);n&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);ca=m}}function R(e,n){var m;if(e=="fragment")m=b.createShader(b.FRAGMENT_SHADER);else e==
+"vertex"&&(m=b.createShader(b.VERTEX_SHADER));b.shaderSource(m,n);b.compileShader(m);if(!b.getShaderParameter(m,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(m));return null}return m}function L(e){switch(e){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;
+case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;
+case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var P=document.createElement("canvas"),b,ba=null,ca=null,da=this,ha=null,ea=null,ma=null,ka=null,U=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],aa=new THREE.Matrix4,la=new Float32Array(16),qa=new Float32Array(16),za=new Float32Array(16),Ba=new THREE.Vector4,
+Ia=!0,Oa=new THREE.Color(0),Pa=0;if(a){if(a.antialias!==undefined)Ia=a.antialias;a.clearColor!==undefined&&Oa.setHex(a.clearColor);if(a.clearAlpha!==undefined)Pa=a.clearAlpha}this.domElement=P;this.autoClear=!0;this.sortObjects=!1;(function(e,n,m){try{b=P.getContext("experimental-webgl",{antialias:e})}catch(h){console.log(h)}if(!b)throw"cannot create webgl context";b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);
+b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(n.r,n.g,n.b,m);_cullEnabled=!0})(Ia,Oa,Pa);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(e,n){P.width=e;P.height=n;b.viewport(0,0,P.width,P.height)};this.setClearColorHex=function(e,n){var m=new THREE.Color(e);b.clearColor(m.r,m.g,m.b,n)};this.setClearColor=function(e,n){b.clearColor(e.r,e.g,e.b,n)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|
+b.DEPTH_BUFFER_BIT)};this.initMaterial=function(e,n,m){var h,l;if(e instanceof THREE.MeshDepthMaterial)d(e,THREE.ShaderLib.depth);else if(e instanceof THREE.MeshNormalMaterial)d(e,THREE.ShaderLib.normal);else if(e instanceof THREE.MeshBasicMaterial)d(e,THREE.ShaderLib.basic);else if(e instanceof THREE.MeshLambertMaterial)d(e,THREE.ShaderLib.lambert);else if(e instanceof THREE.MeshPhongMaterial)d(e,THREE.ShaderLib.phong);else if(e instanceof THREE.LineBasicMaterial)d(e,THREE.ShaderLib.basic);else e instanceof
+THREE.ParticleBasicMaterial&&d(e,THREE.ShaderLib.particle_basic);var v,r,q,t;l=q=t=0;for(v=n.length;l<v;l++){r=n[l];r instanceof THREE.DirectionalLight&&q++;r instanceof THREE.PointLight&&t++}if(t+q<=4)n=q;else{n=Math.ceil(4*q/(t+q));t=4-n}l={directional:n,point:t};t=e.fragment_shader;n=e.vertex_shader;v={fog:m,map:e.map,env_map:e.env_map,light_map:e.light_map,vertex_colors:e.vertex_colors,skinning:e.skinning,maxDirLights:l.directional,maxPointLights:l.point};m=b.createProgram();l=["#ifdef GL_ES\nprecision highp float;\n#endif",
+"#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.fog?"#define USE_FOG":"",v.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",v.map?"#define USE_MAP":"",v.env_map?"#define USE_ENVMAP":"",v.light_map?"#define USE_LIGHTMAP":"",v.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");v=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+
+v.maxPointLights,v.map?"#define USE_MAP":"",v.env_map?"#define USE_ENVMAP":"",v.light_map?"#define USE_LIGHTMAP":"",v.vertex_colors?"#define USE_COLOR":"",v.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
+b.attachShader(m,R("fragment",l+t));b.attachShader(m,R("vertex",v+n));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","cameraInverseMatrix","boneGlobalMatrices"];for(h in e.uniforms)m.push(h);h=e.program;t=0;for(n=m.length;t<
+n;t++){l=m[t];h.uniforms[l]=b.getUniformLocation(h,l)}h=e.program;m=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];t=0;for(n=m.length;t<n;t++){l=m[t];h.attributes[l]=b.getAttribLocation(h,l)}h=e.program.attributes;b.enableVertexAttribArray(h.position);h.color>=0&&b.enableVertexAttribArray(h.color);h.normal>=0&&b.enableVertexAttribArray(h.normal);h.tangent>=0&&b.enableVertexAttribArray(h.tangent);if(e.skinning&&h.skinVertexA>=0&&h.skinVertexB>=
+0&&h.skinIndex>=0&&h.skinWeight>=0){b.enableVertexAttribArray(h.skinVertexA);b.enableVertexAttribArray(h.skinVertexB);b.enableVertexAttribArray(h.skinIndex);b.enableVertexAttribArray(h.skinWeight)}};this.render=function(e,n,m,h){var l,v,r,q,t,G,F,I,S=e.lights,y=e.fog;n.matrixAutoUpdate&&n.update();n.globalMatrix.flattenToArray(za);n.projectionMatrix.flattenToArray(la);n.inverseMatrix.flattenToArray(qa);aa.multiply(n.projectionMatrix,n.globalMatrix);i(aa);THREE.AnimationHandler&&THREE.AnimationHandler.update();
+e.update(undefined,!1,n);this.initWebGLObjects(e,n);J(m,h!==undefined?h:!0);this.autoClear&&this.clear();t=e.__webGLObjects.length;for(h=0;h<t;h++){l=e.__webGLObjects[h];F=l.object;if(F.visible)if(!(F instanceof THREE.Mesh)||s(F)){F.globalMatrix.flattenToArray(F._objectMatrixArray);H(F,n);z(l);l.render=!0;if(this.sortObjects){Ba.copy(F.position);aa.multiplyVector3(Ba);l.z=Ba.z}}else l.render=!1;else l.render=!1}this.sortObjects&&e.__webGLObjects.sort(A);G=e.__webGLObjectsImmediate.length;for(h=0;h<
+G;h++){l=e.__webGLObjectsImmediate[h];F=l.object;if(F.visible){F.matrixAutoUpdate&&F.globalMatrix.flattenToArray(F._objectMatrixArray);H(F,n);x(l)}}K(THREE.NormalBlending);for(h=0;h<t;h++){l=e.__webGLObjects[h];if(l.render){F=l.object;I=l.buffer;r=l.opaque;k(F);for(l=0;l<r.count;l++){q=r.list[l];o(q.depth_test);g(n,S,y,q,I,F)}}}for(h=0;h<G;h++){l=e.__webGLObjectsImmediate[h];F=l.object;if(F.visible){r=l.opaque;k(F);for(l=0;l<r.count;l++){q=r.list[l];o(q.depth_test);v=f(n,S,y,q,F);F.render(function(M){j(M,
+v)})}}}for(h=0;h<t;h++){l=e.__webGLObjects[h];if(l.render){F=l.object;I=l.buffer;r=l.transparent;k(F);for(l=0;l<r.count;l++){q=r.list[l];K(q.blending);o(q.depth_test);g(n,S,y,q,I,F)}}}for(h=0;h<G;h++){l=e.__webGLObjectsImmediate[h];F=l.object;if(F.visible){r=l.transparent;k(F);for(l=0;l<r.count;l++){q=r.list[l];K(q.blending);o(q.depth_test);v=f(n,S,y,q,F);F.render(function(M){j(M,v)})}}}if(m&&m.min_filter!==THREE.NearestFilter&&m.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,m.__webGLTexture);
+b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=function(e,n){var m,h,l;if(!e.__webGLObjects){e.__webGLObjects=[];e.__webGLObjectsMap={};e.__webGLObjectsImmediate=[]}m=0;for(h=e.objects.length;m<h;m++){l=e.objects[m];var v=e,r=n,q=void 0,t=void 0,G=void 0,F=void 0;t=l.geometry;if(v.__webGLObjectsMap[l.id]==undefined){v.__webGLObjectsMap[l.id]={};l._modelViewMatrix=new THREE.Matrix4;l._normalMatrixArray=new Float32Array(9);l._modelViewMatrixArray=new Float32Array(16);
+l._objectMatrixArray=new Float32Array(16);l.globalMatrix.flattenToArray(l._objectMatrixArray)}F=v.__webGLObjectsMap[l.id];objlist=v.__webGLObjects;if(l instanceof THREE.Mesh){for(q in t.geometryChunks){G=t.geometryChunks[q];if(!G.__webGLVertexBuffer){r=G;r.__webGLVertexBuffer=b.createBuffer();r.__webGLNormalBuffer=b.createBuffer();r.__webGLTangentBuffer=b.createBuffer();r.__webGLColorBuffer=b.createBuffer();r.__webGLUVBuffer=b.createBuffer();r.__webGLUV2Buffer=b.createBuffer();r.__webGLSkinVertexABuffer=
+b.createBuffer();r.__webGLSkinVertexBBuffer=b.createBuffer();r.__webGLSkinIndicesBuffer=b.createBuffer();r.__webGLSkinWeightsBuffer=b.createBuffer();r.__webGLFaceBuffer=b.createBuffer();r.__webGLLineBuffer=b.createBuffer();r=G;var I=l,S=void 0,y=void 0,M=0,fa=v=0,$=I.geometry.faces,Q=r.faces;S=0;for(y=Q.length;S<y;S++){fi=Q[S];face=$[fi];if(face instanceof THREE.Face3){M+=3;v+=1;fa+=3}else if(face instanceof THREE.Face4){M+=4;v+=2;fa+=4}}r.__vertexArray=new Float32Array(M*3);r.__normalArray=new Float32Array(M*
+3);r.__tangentArray=new Float32Array(M*4);r.__colorArray=new Float32Array(M*3);r.__uvArray=new Float32Array(M*2);r.__uv2Array=new Float32Array(M*2);r.__skinVertexAArray=new Float32Array(M*4);r.__skinVertexBArray=new Float32Array(M*4);r.__skinIndexArray=new Float32Array(M*4);r.__skinWeightArray=new Float32Array(M*4);r.__faceArray=new Uint16Array(v*3);r.__lineArray=new Uint16Array(fa*2);y=S=r;M=void 0;$=void 0;var O=void 0,N=void 0;O=void 0;Q=!1;M=0;for($=I.materials.length;M<$;M++){O=I.materials[M];
+if(O instanceof THREE.MeshFaceMaterial){O=0;for(N=y.materials.length;O<N;O++)if(y.materials[O]&&y.materials[O].shading!=undefined&&y.materials[O].shading==THREE.SmoothShading){Q=!0;break}}else if(O&&O.shading!=undefined&&O.shading==THREE.SmoothShading){Q=!0;break}if(Q)break}S.__needsSmoothNormals=Q;r.__webGLFaceCount=v*3;r.__webGLLineCount=fa*2;t.__dirtyVertices=!0;t.__dirtyElements=!0;t.__dirtyUvs=!0;t.__dirtyNormals=!0;t.__dirtyTangents=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyElements||
+t.__dirtyUvs||t.__dirtyNormals||t.__dirtyColors||t.__dirtyTangents){r=G;v=b.DYNAMIC_DRAW;fa=void 0;S=void 0;var ta=void 0,u=void 0,pa=void 0,na=void 0,wa=void 0;ta=void 0;var B=void 0,C=void 0,D=void 0,T=void 0;B=void 0;C=void 0;D=void 0;u=void 0;B=void 0;C=void 0;D=void 0;T=void 0;B=void 0;C=void 0;D=void 0;T=void 0;B=void 0;C=void 0;D=void 0;T=void 0;B=void 0;C=void 0;D=void 0;T=void 0;B=void 0;C=void 0;D=void 0;T=void 0;u=void 0;na=void 0;pa=void 0;wa=void 0;var ra=N=O=Q=$=M=I=y=0,ga=0,p=0,ia=
+r.__vertexArray,Ga=r.__uvArray,Ha=r.__uv2Array,va=r.__normalArray,V=r.__tangentArray,ja=r.__colorArray,W=r.__skinVertexAArray,X=r.__skinVertexBArray,Y=r.__skinIndexArray,Z=r.__skinWeightArray,xa=r.__faceArray,sa=r.__lineArray,Qa=r.__needsSmoothNormals,oa=l.geometry,Ja=oa.__dirtyVertices,Ka=oa.__dirtyElements,Fa=oa.__dirtyUvs,La=oa.__dirtyNormals,Ma=oa.__dirtyTangents,Na=oa.__dirtyColors,ua=oa.vertices,Ra=r.faces,Sa=oa.faces,Ta=oa.uvs,Ua=oa.uvs2,ya=oa.colors,Ca=oa.skinVerticesA,Da=oa.skinVerticesB,
+Ea=oa.skinIndices,Aa=oa.skinWeights;fa=0;for(S=Ra.length;fa<S;fa++){ta=Ra[fa];u=Sa[ta];wa=Ta[ta];ta=Ua[ta];pa=u.vertexNormals;na=u.normal;if(u instanceof THREE.Face3){if(Ja){B=ua[u.a].position;C=ua[u.b].position;D=ua[u.c].position;ia[I]=B.x;ia[I+1]=B.y;ia[I+2]=B.z;ia[I+3]=C.x;ia[I+4]=C.y;ia[I+5]=C.z;ia[I+6]=D.x;ia[I+7]=D.y;ia[I+8]=D.z;I+=9}if(Aa.length){B=Aa[u.a];C=Aa[u.b];D=Aa[u.c];Z[p]=B.x;Z[p+1]=B.y;Z[p+2]=B.z;Z[p+3]=B.w;Z[p+4]=C.x;Z[p+5]=C.y;Z[p+6]=C.z;Z[p+7]=C.w;Z[p+8]=D.x;Z[p+9]=D.y;Z[p+10]=
+D.z;Z[p+11]=D.w;B=Ea[u.a];C=Ea[u.b];D=Ea[u.c];Y[p]=B.x;Y[p+1]=B.y;Y[p+2]=B.z;Y[p+3]=B.w;Y[p+4]=C.x;Y[p+5]=C.y;Y[p+6]=C.z;Y[p+7]=C.w;Y[p+8]=D.x;Y[p+9]=D.y;Y[p+10]=D.z;Y[p+11]=D.w;B=Ca[u.a];C=Ca[u.b];D=Ca[u.c];W[p]=B.x;W[p+1]=B.y;W[p+2]=B.z;W[p+3]=1;W[p+4]=C.x;W[p+5]=C.y;W[p+6]=C.z;W[p+7]=1;W[p+8]=D.x;W[p+9]=D.y;W[p+10]=D.z;W[p+11]=1;B=Da[u.a];C=Da[u.b];D=Da[u.c];X[p]=B.x;X[p+1]=B.y;X[p+2]=B.z;X[p+3]=1;X[p+4]=C.x;X[p+5]=C.y;X[p+6]=C.z;X[p+7]=1;X[p+8]=D.x;X[p+9]=D.y;X[p+10]=D.z;X[p+11]=1;p+=12}if(Na&&
+ya.length){B=ya[u.a];C=ya[u.b];D=ya[u.c];ja[ga]=B.r;ja[ga+1]=B.g;ja[ga+2]=B.b;ja[ga+3]=C.r;ja[ga+4]=C.g;ja[ga+5]=C.b;ja[ga+6]=D.r;ja[ga+7]=D.g;ja[ga+8]=D.b;ga+=9}if(Ma&&oa.hasTangents){B=ua[u.a].tangent;C=ua[u.b].tangent;D=ua[u.c].tangent;V[N]=B.x;V[N+1]=B.y;V[N+2]=B.z;V[N+3]=B.w;V[N+4]=C.x;V[N+5]=C.y;V[N+6]=C.z;V[N+7]=C.w;V[N+8]=D.x;V[N+9]=D.y;V[N+10]=D.z;V[N+11]=D.w;N+=12}if(La)if(pa.length==3&&Qa)for(u=0;u<3;u++){na=pa[u];va[O]=na.x;va[O+1]=na.y;va[O+2]=na.z;O+=3}else for(u=0;u<3;u++){va[O]=na.x;
+va[O+1]=na.y;va[O+2]=na.z;O+=3}if(Fa&&wa)for(u=0;u<3;u++){pa=wa[u];Ga[M]=pa.u;Ga[M+1]=pa.v;M+=2}if(Fa&&ta)for(u=0;u<3;u++){wa=ta[u];Ha[$]=wa.u;Ha[$+1]=wa.v;$+=2}if(Ka){xa[Q]=y;xa[Q+1]=y+1;xa[Q+2]=y+2;Q+=3;sa[ra]=y;sa[ra+1]=y+1;sa[ra+2]=y;sa[ra+3]=y+2;sa[ra+4]=y+1;sa[ra+5]=y+2;ra+=6;y+=3}}else if(u instanceof THREE.Face4){if(Ja){B=ua[u.a].position;C=ua[u.b].position;D=ua[u.c].position;T=ua[u.d].position;ia[I]=B.x;ia[I+1]=B.y;ia[I+2]=B.z;ia[I+3]=C.x;ia[I+4]=C.y;ia[I+5]=C.z;ia[I+6]=D.x;ia[I+7]=D.y;ia[I+
+8]=D.z;ia[I+9]=T.x;ia[I+10]=T.y;ia[I+11]=T.z;I+=12}if(Aa.length){B=Aa[u.a];C=Aa[u.b];D=Aa[u.c];T=Aa[u.d];Z[p]=B.x;Z[p+1]=B.y;Z[p+2]=B.z;Z[p+3]=B.w;Z[p+4]=C.x;Z[p+5]=C.y;Z[p+6]=C.z;Z[p+7]=C.w;Z[p+8]=D.x;Z[p+9]=D.y;Z[p+10]=D.z;Z[p+11]=D.w;Z[p+12]=T.x;Z[p+13]=T.y;Z[p+14]=T.z;Z[p+15]=T.w;B=Ea[u.a];C=Ea[u.b];D=Ea[u.c];T=Ea[u.d];Y[p]=B.x;Y[p+1]=B.y;Y[p+2]=B.z;Y[p+3]=B.w;Y[p+4]=C.x;Y[p+5]=C.y;Y[p+6]=C.z;Y[p+7]=C.w;Y[p+8]=D.x;Y[p+9]=D.y;Y[p+10]=D.z;Y[p+11]=D.w;Y[p+12]=T.x;Y[p+13]=T.y;Y[p+14]=T.z;Y[p+15]=
+T.w;B=Ca[u.a];C=Ca[u.b];D=Ca[u.c];T=Ca[u.d];W[p]=B.x;W[p+1]=B.y;W[p+2]=B.z;W[p+3]=1;W[p+4]=C.x;W[p+5]=C.y;W[p+6]=C.z;W[p+7]=1;W[p+8]=D.x;W[p+9]=D.y;W[p+10]=D.z;W[p+11]=1;W[p+12]=T.x;W[p+13]=T.y;W[p+14]=T.z;W[p+15]=1;B=Da[u.a];C=Da[u.b];D=Da[u.c];T=Da[u.d];X[p]=B.x;X[p+1]=B.y;X[p+2]=B.z;X[p+3]=1;X[p+4]=C.x;X[p+5]=C.y;X[p+6]=C.z;X[p+7]=1;X[p+8]=D.x;X[p+9]=D.y;X[p+10]=D.z;X[p+11]=1;X[p+12]=T.x;X[p+13]=T.y;X[p+14]=T.z;X[p+15]=1;p+=16}if(Na&&ya.length){B=ya[u.a];C=ya[u.b];D=ya[u.c];T=ya[u.d];ja[ga]=B.r;
+ja[ga+1]=B.g;ja[ga+2]=B.b;ja[ga+3]=C.r;ja[ga+4]=C.g;ja[ga+5]=C.b;ja[ga+6]=D.r;ja[ga+7]=D.g;ja[ga+8]=D.b;ja[ga+9]=T.r;ja[ga+10]=T.g;ja[ga+11]=T.b;ga+=12}if(Ma&&oa.hasTangents){B=ua[u.a].tangent;C=ua[u.b].tangent;D=ua[u.c].tangent;u=ua[u.d].tangent;V[N]=B.x;V[N+1]=B.y;V[N+2]=B.z;V[N+3]=B.w;V[N+4]=C.x;V[N+5]=C.y;V[N+6]=C.z;V[N+7]=C.w;V[N+8]=D.x;V[N+9]=D.y;V[N+10]=D.z;V[N+11]=D.w;V[N+12]=u.x;V[N+13]=u.y;V[N+14]=u.z;V[N+15]=u.w;N+=16}if(La)if(pa.length==4&&Qa)for(u=0;u<4;u++){na=pa[u];va[O]=na.x;va[O+
+1]=na.y;va[O+2]=na.z;O+=3}else for(u=0;u<4;u++){va[O]=na.x;va[O+1]=na.y;va[O+2]=na.z;O+=3}if(Fa&&wa)for(u=0;u<4;u++){pa=wa[u];Ga[M]=pa.u;Ga[M+1]=pa.v;M+=2}if(Fa&&ta)for(u=0;u<4;u++){wa=ta[u];Ha[$]=wa.u;Ha[$+1]=wa.v;$+=2}if(Ka){xa[Q]=y;xa[Q+1]=y+1;xa[Q+2]=y+2;xa[Q+3]=y;xa[Q+4]=y+2;xa[Q+5]=y+3;Q+=6;sa[ra]=y;sa[ra+1]=y+1;sa[ra+2]=y;sa[ra+3]=y+3;sa[ra+4]=y+1;sa[ra+5]=y+2;sa[ra+6]=y+2;sa[ra+7]=y+3;ra+=8;y+=4}}}if(Ja){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,ia,v)}if(Na&&
+ya.length){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,ja,v)}if(La){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,va,v)}if(Ma&&oa.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,V,v)}if(Fa&&M>0){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Ga,v)}if(Fa&&$>0){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,Ha,v)}if(Ka){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+r.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,xa,v);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,r.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,sa,v)}if(p>0){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLSkinVertexABuffer);b.bufferData(b.ARRAY_BUFFER,W,v);b.bindBuffer(b.ARRAY_BUFFER,r.__webGLSkinVertexBBuffer);b.bufferData(b.ARRAY_BUFFER,X,v);b.bindBuffer(b.ARRAY_BUFFER,r.__webGLSkinIndicesBuffer);b.bufferData(b.ARRAY_BUFFER,Y,v);b.bindBuffer(b.ARRAY_BUFFER,r.__webGLSkinWeightsBuffer);b.bufferData(b.ARRAY_BUFFER,
+Z,v)}}E(objlist,F,q,G,l)}t.__dirtyVertices=!1;t.__dirtyElements=!1;t.__dirtyUvs=!1;t.__dirtyNormals=!1;t.__dirtyTangents=!1;t.__dirtyColors=!1}else if(l instanceof THREE.Ribbon){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=b.createBuffer();q.__webGLColorBuffer=b.createBuffer();q=t;G=q.vertices.length;q.__vertexArray=new Float32Array(G*3);q.__colorArray=new Float32Array(G*3);q.__webGLVertexCount=G;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){q=t;G=b.DYNAMIC_DRAW;
+y=void 0;y=void 0;I=void 0;r=void 0;M=q.vertices;v=q.colors;$=M.length;fa=v.length;Q=q.__vertexArray;S=q.__colorArray;O=q.__dirtyColors;if(q.__dirtyVertices){for(y=0;y<$;y++){I=M[y].position;r=y*3;Q[r]=I.x;Q[r+1]=I.y;Q[r+2]=I.z}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,Q,G)}if(O){for(y=0;y<fa;y++){color=v[y];r=y*3;S[r]=color.r;S[r+1]=color.g;S[r+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,S,G)}}E(objlist,F,0,t,l);t.__dirtyVertices=
+!1;t.__dirtyColors=!1}else if(l instanceof THREE.Line){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=b.createBuffer();q.__webGLColorBuffer=b.createBuffer();q=t;G=q.vertices.length;q.__vertexArray=new Float32Array(G*3);q.__colorArray=new Float32Array(G*3);q.__webGLLineCount=G;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){q=t;G=b.DYNAMIC_DRAW;y=void 0;y=void 0;I=void 0;r=void 0;M=q.vertices;v=q.colors;$=M.length;fa=v.length;Q=q.__vertexArray;S=q.__colorArray;
+O=q.__dirtyColors;if(q.__dirtyVertices){for(y=0;y<$;y++){I=M[y].position;r=y*3;Q[r]=I.x;Q[r+1]=I.y;Q[r+2]=I.z}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,Q,G)}if(O){for(y=0;y<fa;y++){color=v[y];r=y*3;S[r]=color.r;S[r+1]=color.g;S[r+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,S,G)}}E(objlist,F,0,t,l);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(l instanceof THREE.ParticleSystem){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=
+b.createBuffer();q.__webGLColorBuffer=b.createBuffer();q=t;G=q.vertices.length;q.__vertexArray=new Float32Array(G*3);q.__colorArray=new Float32Array(G*3);q.__sortArray=[];q.__webGLParticleCount=G;t.__dirtyVertices=!0;t.__dirtyColors=!0}(t.__dirtyVertices||t.__dirtyColors||l.sortParticles)&&c(t,b.DYNAMIC_DRAW,l,r);E(objlist,F,0,t,l);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(THREE.MarchingCubes!==undefined&&l instanceof THREE.MarchingCubes){t=F;if(t[0]==undefined){v.__webGLObjectsImmediate.push({object:l,
+opaque:{list:[],count:0},transparent:{list:[],count:0}});t[0]=1}}}};this.removeObject=function(e,n){var m,h;for(m=e.__webGLObjects.length-1;m>=0;m--){h=e.__webGLObjects[m].object;n==h&&e.__webGLObjects.splice(m,1)}};this.setFaceCulling=function(e,n){if(e){!n||n=="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",

+ 1 - 79
examples/canvas_geometry_cube.html

@@ -15,85 +15,7 @@
 	</head>
 	<body>
 
-		<!-- <script type="text/javascript" src="../build/Three.js"></script> -->
-
-		<script type="text/javascript" src="../src/Three.js"></script>
-		<script type="text/javascript" src="../src/core/Color.js"></script>
-		<script type="text/javascript" src="../src/core/Vector2.js"></script>
-		<script type="text/javascript" src="../src/core/Vector3.js"></script>
-		<script type="text/javascript" src="../src/core/Vector4.js"></script>
-		<script type="text/javascript" src="../src/core/Ray.js"></script>
-		<script type="text/javascript" src="../src/core/Rectangle.js"></script>
-		<script type="text/javascript" src="../src/core/Matrix3.js"></script>
-		<script type="text/javascript" src="../src/core/Matrix4.js"></script>
-		<script type="text/javascript" src="../src/core/Object3D.js"></script>
-		<script type="text/javascript" src="../src/core/Quaternion.js"></script>
-		<script type="text/javascript" src="../src/core/Vertex.js"></script>
-		<script type="text/javascript" src="../src/core/Face3.js"></script>
-		<script type="text/javascript" src="../src/core/Face4.js"></script>
-		<script type="text/javascript" src="../src/core/UV.js"></script>
-		<script type="text/javascript" src="../src/core/Geometry.js"></script>
-		<script type="text/javascript" src="../src/animation/AnimationHandler.js"></script>
-		<script type="text/javascript" src="../src/animation/Animation.js"></script>
-		<script type="text/javascript" src="../src/cameras/Camera.js"></script>
-		<script type="text/javascript" src="../src/lights/Light.js"></script>
-		<script type="text/javascript" src="../src/lights/AmbientLight.js"></script>
-		<script type="text/javascript" src="../src/lights/DirectionalLight.js"></script>
-		<script type="text/javascript" src="../src/lights/PointLight.js"></script>
-		<script type="text/javascript" src="../src/materials/Material.js"></script>
-		<script type="text/javascript" src="../src/materials/LineBasicMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshBasicMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshLambertMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshPhongMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshDepthMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshNormalMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshFaceMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshShaderMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/ParticleBasicMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/ParticleCircleMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/ParticleDOMMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/Texture.js"></script>
-		<script type="text/javascript" src="../src/materials/RenderTarget.js"></script>
-		<script type="text/javascript" src="../src/materials/Uniforms.js"></script>
-		<script type="text/javascript" src="../src/materials/mappings/CubeReflectionMapping.js"></script>
-		<script type="text/javascript" src="../src/materials/mappings/CubeRefractionMapping.js"></script>
-		<script type="text/javascript" src="../src/materials/mappings/LatitudeReflectionMapping.js"></script>
-		<script type="text/javascript" src="../src/materials/mappings/LatitudeRefractionMapping.js"></script>
-		<script type="text/javascript" src="../src/materials/mappings/SphericalReflectionMapping.js"></script>
-		<script type="text/javascript" src="../src/materials/mappings/SphericalRefractionMapping.js"></script>
-		<script type="text/javascript" src="../src/materials/mappings/UVMapping.js"></script>
-		<script type="text/javascript" src="../src/objects/Particle.js"></script>
-		<script type="text/javascript" src="../src/objects/ParticleSystem.js"></script>
-		<script type="text/javascript" src="../src/objects/Line.js"></script>
-		<script type="text/javascript" src="../src/objects/Mesh.js"></script>
-		<script type="text/javascript" src="../src/objects/Bone.js"></script>
-		<script type="text/javascript" src="../src/objects/SkinnedMesh.js"></script>
-		<script type="text/javascript" src="../src/objects/Ribbon.js"></script>
-		<script type="text/javascript" src="../src/scenes/Scene.js"></script>
-		<script type="text/javascript" src="../src/scenes/Fog.js"></script>
-		<script type="text/javascript" src="../src/scenes/FogExp2.js"></script>
-		<script type="text/javascript" src="../src/renderers/Projector.js"></script>
-		<script type="text/javascript" src="../src/renderers/DOMRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/CanvasRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/SVGRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableObject.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableParticle.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableLine.js"></script>
-		<script type="text/javascript" src="../src/extras/GeometryUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/ImageUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/SceneUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/ShaderUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/primitives/Cube.js"></script>
-		<script type="text/javascript" src="../src/extras/primitives/Cylinder.js"></script>
-		<script type="text/javascript" src="../src/extras/primitives/Plane.js"></script>
-		<script type="text/javascript" src="../src/extras/primitives/Sphere.js"></script>
-		<script type="text/javascript" src="../src/extras/primitives/Torus.js"></script>
-		<script type="text/javascript" src="../src/extras/primitives/Icosahedron.js"></script>
-		<script type="text/javascript" src="../src/extras/primitives/LathedObject.js"></script>
-		<script type="text/javascript" src="../src/extras/objects/MarchingCubes.js"></script>
-		<script type="text/javascript" src="../src/extras/io/Loader.js"></script>
+		<script type="text/javascript" src="../build/Three.js"></script>
 
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>

+ 2 - 0
examples/misc_uqbiquity_test.html

@@ -69,6 +69,7 @@
 		<script type="text/javascript" src="../src/objects/Bone.js"></script>
 		<script type="text/javascript" src="../src/objects/SkinnedMesh.js"></script>
 		<script type="text/javascript" src="../src/objects/Ribbon.js"></script>
+		<script type="text/javascript" src="../src/objects/Sound3D.js"></script>
 		<script type="text/javascript" src="../src/scenes/Scene.js"></script>
 		<script type="text/javascript" src="../src/scenes/Fog.js"></script>
 		<script type="text/javascript" src="../src/scenes/FogExp2.js"></script>
@@ -77,6 +78,7 @@
 		<script type="text/javascript" src="../src/renderers/CanvasRenderer.js"></script>
 		<script type="text/javascript" src="../src/renderers/SVGRenderer.js"></script>
 		<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/SoundRenderer.js"></script>
 		<script type="text/javascript" src="../src/renderers/renderables/RenderableObject.js"></script>
 		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>
 		<script type="text/javascript" src="../src/renderers/renderables/RenderableParticle.js"></script>

+ 17 - 26
src/core/Matrix4.js

@@ -507,32 +507,23 @@ THREE.Matrix4.prototype = {
 
 	setRotationFromEuler: function( vec3 ) {
 
-		//var c = Math.PI / 180;
-		var x = vec3.x,// * c;
-			y = vec3.y,// * c;
-			z = vec3.z,// * c;
+		var x = vec3.x, y = vec3.y, z = vec3.z,
+		a = Math.cos( x ), b = Math.sin( x ),
+		c = Math.cos( y ), d = Math.sin( y ),
+		e = Math.cos( z ), f = Math.sin( z ),
+		ad = a * d, bd = b * d;
 
-			ch = Math.cos( y  ),
-			sh = Math.sin( y  ),
-			ca = Math.cos( -z ),
-			sa = Math.sin( -z ),
-			cb = Math.cos( x  ),
-			sb = Math.sin( x  ),
+		this.n11 = c * e;
+		this.n12 = - c * f;
+		this.n13 = d;
 
-			chsa = ch * sa,
-			shsa = sh * sa;
+		this.n21 = bd * e + a * f;
+		this.n22 = - bd * f + a * e;
+		this.n23 = - b * c;
 
-	    this.n11 = ch * ca;
-	    this.n12 = sh * sb - chsa * cb;
-	    this.n13 = chsa * sb + sh * cb;
-
-	    this.n21 = sa;
-	    this.n22 = ca * cb;
-	    this.n23 = - ca * sb;
-
-	    this.n31 = - sh * ca;
-	    this.n32 = shsa * cb + ch * sb;
-	    this.n33 = - shsa * sb + ch * cb;
+		this.n31 = - ad * e + b * f;
+		this.n32 = ad * f + b * e;
+		this.n33 = a * c;
 
 	},
 
@@ -592,7 +583,7 @@ THREE.Matrix4.prototype = {
 	},
 
 	extractPositionVector: function( v ) {
-		
+
 		v.x = this.n14;
 		v.y = this.n24;
 		v.z = this.n34;
@@ -761,9 +752,9 @@ THREE.Matrix4.makeInvert3x3 = function ( m1 ) {
 	a13 =   m1.n23 * m1.n12 - m1.n22 * m1.n13,
 	a23 = - m1.n23 * m1.n11 + m1.n21 * m1.n13,
 	a33 =   m1.n22 * m1.n11 - m1.n21 * m1.n12,
-	
+
 	det = m1.n11 * a11 + m1.n21 * a12 + m1.n31 * a13,
-	
+
 	idet;
 
 	// no inverse

Some files were not shown because too many files changed in this diff