2
0
Mr.doob 14 жил өмнө
parent
commit
dd27dac124

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 168 - 163
build/Three.js


+ 61 - 53
build/custom/ThreeCanvas.js

@@ -12,21 +12,21 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
 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.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(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)}};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,g){return f.distance-g.distance});return e},intersectObject:function(a){function b(z,s,B,x){x=x.clone().subSelf(s);B=B.clone().subSelf(s);var o=z.clone().subSelf(s);z=x.dot(x);s=x.dot(B);x=x.dot(o);var J=B.dot(B);B=B.dot(o);o=1/(z*J-s*s);J=(J*x-s*B)*o;z=(z*B-s*x)*o;return J>0&&z>0&&J+z<1}var c,d,e,f,g,j,h,i,n,m,
-p,l=a.geometry,u=l.vertices,r=[];c=0;for(d=l.faces.length;c<d;c++){e=l.faces[c];m=this.origin.clone();p=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(u[e.a].position.clone());g=h.multiplyVector3(u[e.b].position.clone());j=h.multiplyVector3(u[e.c].position.clone());h=e instanceof THREE.Face4?h.multiplyVector3(u[e.d].position.clone()):null;i=a.matrixRotationWorld.multiplyVector3(e.normal.clone());n=p.dot(i);if(n<0){i=i.dot((new THREE.Vector3).sub(f,m))/n;m=m.addSelf(p.multiplyScalar(i));
-if(e instanceof THREE.Face3){if(b(m,f,g,j)){e={distance:this.origin.distanceTo(m),point:m,face:e,object:a};r.push(e)}}else if(e instanceof THREE.Face4&&(b(m,f,g,h)||b(m,g,j,h))){e={distance:this.origin.distanceTo(m),point:m,face:e,object:a};r.push(e)}}}return r}};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(h,i,n,m){j=!1;b=h;c=i;d=n;e=m;a()};this.addPoint=function(h,i){if(j){j=!1;b=h;c=i;d=h;e=i}else{b=b<h?b:h;c=c<i?c:i;d=d>h?d:h;e=e>i?e:i}a()};
-this.add3Points=function(h,i,n,m,p,l){if(j){j=!1;b=h<n?h<p?h:p:n<p?n:p;c=i<m?i<l?i:l:m<l?m:l;d=h>n?h>p?h:p:n>p?n:p;e=i>m?i>l?i:l:m>l?m:l}else{b=h<n?h<p?h<b?h:b:p<b?p:b:n<p?n<b?n:b:p<b?p:b;c=i<m?i<l?i<c?i:c:l<c?l:c:m<l?m<c?m:c:l<c?l:c;d=h>n?h>p?h>d?h:d:p>d?p:d:n>p?n>d?n:d:p>d?p:d;e=i>m?i>l?i>e?i:e:l>e?l:e:m>l?m>e?m:e:l>e?l:e}a()};this.addRectangle=function(h){if(j){j=!1;b=h.getLeft();c=h.getTop();d=h.getRight();e=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();d=d>h.getRight()?
+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,g){return f.distance-g.distance});return e},intersectObject:function(a){function b(D,p,y,E){E=E.clone().subSelf(p);y=y.clone().subSelf(p);var O=D.clone().subSelf(p);D=E.dot(E);p=E.dot(y);E=E.dot(O);var G=y.dot(y);y=y.dot(O);O=1/(D*G-p*p);G=(G*E-p*y)*O;D=(D*y-p*E)*O;return G>0&&D>0&&G+D<1}var c,d,e,f,g,j,h,i,n,l,
+q,m=a.geometry,t=m.vertices,v=[];c=0;for(d=m.faces.length;c<d;c++){e=m.faces[c];l=this.origin.clone();q=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(t[e.a].position.clone());g=h.multiplyVector3(t[e.b].position.clone());j=h.multiplyVector3(t[e.c].position.clone());h=e instanceof THREE.Face4?h.multiplyVector3(t[e.d].position.clone()):null;i=a.matrixRotationWorld.multiplyVector3(e.normal.clone());n=q.dot(i);if(n<0){i=i.dot((new THREE.Vector3).sub(f,l))/n;l=l.addSelf(q.multiplyScalar(i));
+if(e instanceof THREE.Face3){if(b(l,f,g,j)){e={distance:this.origin.distanceTo(l),point:l,face:e,object:a};v.push(e)}}else if(e instanceof THREE.Face4&&(b(l,f,g,h)||b(l,g,j,h))){e={distance:this.origin.distanceTo(l),point:l,face:e,object:a};v.push(e)}}}return v}};
+THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(h,i,n,l){j=!1;b=h;c=i;d=n;e=l;a()};this.addPoint=function(h,i){if(j){j=!1;b=h;c=i;d=h;e=i}else{b=b<h?b:h;c=c<i?c:i;d=d>h?d:h;e=e>i?e:i}a()};
+this.add3Points=function(h,i,n,l,q,m){if(j){j=!1;b=h<n?h<q?h:q:n<q?n:q;c=i<l?i<m?i:m:l<m?l:m;d=h>n?h>q?h:q:n>q?n:q;e=i>l?i>m?i:m:l>m?l:m}else{b=h<n?h<q?h<b?h:b:q<b?q:b:n<q?n<b?n:b:q<b?q:b;c=i<l?i<m?i<c?i:c:m<c?m:c:l<m?l<c?l:c:m<c?m:c;d=h>n?h>q?h>d?h:d:q>d?q:d:n>q?n>d?n:d:q>d?q:d;e=i>l?i>m?i>e?i:e:m>e?m:e:l>m?l>e?l:e:m>e?m:e}a()};this.addRectangle=function(h){if(j){j=!1;b=h.getLeft();c=h.getTop();d=h.getRight();e=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();d=d>h.getRight()?
 d:h.getRight();e=e>h.getBottom()?e:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;d+=h;e+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();d=d<h.getRight()?d:h.getRight();e=e<h.getBottom()?e:h.getBottom();a()};this.instersects=function(h){return Math.min(d,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(e,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){j=!0;e=d=c=b=0;a()};this.isEmpty=function(){return j}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,e,f,g,j,h,i,n,m,p,l,u,r){this.set(a||1,b||0,c||0,d||0,e||0,f||1,g||0,j||0,h||0,i||0,n||1,m||0,p||0,l||0,u||0,r||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,j,h,i,n,m,p,l,u,r){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=j;this.n31=h;this.n32=i;this.n33=n;this.n34=m;this.n41=p;this.n42=l;this.n43=u;this.n44=r;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,b,c,d,e,f,g,j,h,i,n,l,q,m,t,v){this.set(a||1,b||0,c||0,d||0,e||0,f||1,g||0,j||0,h||0,i||0,n||1,l||0,q||0,m||0,t||0,v||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,j,h,i,n,l,q,m,t,v){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=j;this.n31=h;this.n32=i;this.n33=n;this.n34=l;this.n41=q;this.n42=m;this.n43=t;this.n44=v;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
 e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();if(d.length()===0){f.x+=1.0E-4;d.cross(c,f).normalize()}e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;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},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},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,j=a.n22,h=a.n23,i=a.n24,n=a.n31,m=a.n32,p=a.n33,l=a.n34,u=a.n41,r=a.n42,z=a.n43,s=a.n44,B=b.n11,x=b.n12,o=b.n13,J=b.n14,K=b.n21,O=b.n22,
-P=b.n23,y=b.n24,w=b.n31,E=b.n32,H=b.n33,F=b.n34;this.n11=c*B+d*K+e*w;this.n12=c*x+d*O+e*E;this.n13=c*o+d*P+e*H;this.n14=c*J+d*y+e*F+f;this.n21=g*B+j*K+h*w;this.n22=g*x+j*O+h*E;this.n23=g*o+j*P+h*H;this.n24=g*J+j*y+h*F+i;this.n31=n*B+m*K+p*w;this.n32=n*x+m*O+p*E;this.n33=n*o+m*P+p*H;this.n34=n*J+m*y+p*F+l;this.n41=u*B+r*K+z*w;this.n42=u*x+r*O+z*E;this.n43=u*o+r*P+z*H;this.n44=u*J+r*y+z*F+s;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
+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,g=a.n21,j=a.n22,h=a.n23,i=a.n24,n=a.n31,l=a.n32,q=a.n33,m=a.n34,t=a.n41,v=a.n42,D=a.n43,p=a.n44,y=b.n11,E=b.n12,O=b.n13,G=b.n14,r=b.n21,S=b.n22,
+M=b.n23,R=b.n24,Q=b.n31,B=b.n32,x=b.n33,X=b.n34;this.n11=c*y+d*r+e*Q;this.n12=c*E+d*S+e*B;this.n13=c*O+d*M+e*x;this.n14=c*G+d*R+e*X+f;this.n21=g*y+j*r+h*Q;this.n22=g*E+j*S+h*B;this.n23=g*O+j*M+h*x;this.n24=g*G+j*R+h*X+i;this.n31=n*y+l*r+q*Q;this.n32=n*E+l*S+q*B;this.n33=n*O+l*M+q*x;this.n34=n*G+l*R+q*X+m;this.n41=t*y+v*r+D*Q;this.n42=t*E+v*S+D*B;this.n43=t*O+v*M+D*x;this.n44=t*G+v*R+D*X+p;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
 this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,j=this.n24,h=this.n31,i=this.n32,n=this.n33,m=this.n34,p=this.n41,l=this.n42,u=this.n43,r=this.n44;return d*g*i*p-c*j*i*p-d*f*n*p+b*j*n*p+c*f*m*p-b*g*m*p-d*g*h*l+c*j*h*l+d*e*n*l-a*j*n*l-c*e*m*l+a*g*m*l+d*f*h*u-b*j*h*u-d*e*i*u+a*j*i*u+b*e*m*u-a*f*m*u-c*f*h*r+b*g*h*r+c*e*i*r-a*g*i*r-b*e*n*r+a*f*n*r},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
+this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,j=this.n24,h=this.n31,i=this.n32,n=this.n33,l=this.n34,q=this.n41,m=this.n42,t=this.n43,v=this.n44;return d*g*i*q-c*j*i*q-d*f*n*q+b*j*n*q+c*f*l*q-b*g*l*q-d*g*h*m+c*j*h*m+d*e*n*m-a*j*n*m-c*e*l*m+a*g*l*m+d*f*h*t-b*j*h*t-d*e*i*t+a*j*i*t+b*e*l*t-a*f*l*t-c*f*h*v+b*g*h*v+c*e*i*v-a*g*i*v-b*e*n*v+a*f*n*v},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
@@ -34,9 +34,9 @@ b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:functio
 f+c,h*g-d*j,h*j+d*g,0,h*g+d*j,i*g+c,i*j-d*f,0,h*j-d*g,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 g=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=-g*f+b*d;this.n32=g*d+b*f;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var b=
 a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,j=d+d;a=b*f;var h=b*g;b*=j;var i=c*g;c*=j;d*=j;f*=e;g*=e;e*=j;this.n11=1-(i+d);this.n12=h-e;this.n13=b+g;this.n21=h+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
 a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,j=a.n22,h=a.n23,i=a.n24,n=a.n31,m=a.n32,p=a.n33,l=a.n34,u=a.n41,r=a.n42,z=a.n43,s=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*l*r-i*p*r+i*m*z-j*l*z-h*m*s+j*p*s;b.n12=f*p*r-e*l*r-f*m*z+d*l*z+e*m*s-d*p*s;b.n13=e*i*r-f*h*r+f*j*z-d*i*z-e*j*s+d*h*s;b.n14=f*h*m-e*i*m-f*j*p+d*i*p+e*j*l-d*h*l;b.n21=i*p*u-h*l*u-i*n*z+g*l*z+h*n*s-g*p*s;b.n22=e*l*u-f*p*u+f*n*z-c*l*z-e*n*s+c*p*s;b.n23=f*h*u-e*i*u-f*g*z+c*i*z+e*g*s-c*h*s;
-b.n24=e*i*n-f*h*n+f*g*p-c*i*p-e*g*l+c*h*l;b.n31=j*l*u-i*m*u+i*n*r-g*l*r-j*n*s+g*m*s;b.n32=f*m*u-d*l*u-f*n*r+c*l*r+d*n*s-c*m*s;b.n33=e*i*u-f*j*u+f*g*r-c*i*r-d*g*s+c*j*s;b.n34=f*j*n-d*i*n-f*g*m+c*i*m+d*g*l-c*j*l;b.n41=h*m*u-j*p*u-h*n*r+g*p*r+j*n*z-g*m*z;b.n42=d*p*u-e*m*u+e*n*r-c*p*r-d*n*z+c*m*z;b.n43=e*j*u-d*h*u-e*g*r+c*h*r+d*g*z-c*j*z;b.n44=d*h*n-e*j*n+e*g*m-c*h*m-d*g*p+c*j*p;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,g=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,i=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*g+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*g;c[4]=a*j;c[5]=a*h;c[6]=a*i;c[7]=a*n;c[8]=a*m;return b};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,j=a.n22,h=a.n23,i=a.n24,n=a.n31,l=a.n32,q=a.n33,m=a.n34,t=a.n41,v=a.n42,D=a.n43,p=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*m*v-i*q*v+i*l*D-j*m*D-h*l*p+j*q*p;b.n12=f*q*v-e*m*v-f*l*D+d*m*D+e*l*p-d*q*p;b.n13=e*i*v-f*h*v+f*j*D-d*i*D-e*j*p+d*h*p;b.n14=f*h*l-e*i*l-f*j*q+d*i*q+e*j*m-d*h*m;b.n21=i*q*t-h*m*t-i*n*D+g*m*D+h*n*p-g*q*p;b.n22=e*m*t-f*q*t+f*n*D-c*m*D-e*n*p+c*q*p;b.n23=f*h*t-e*i*t-f*g*D+c*i*D+e*g*p-c*h*p;
+b.n24=e*i*n-f*h*n+f*g*q-c*i*q-e*g*m+c*h*m;b.n31=j*m*t-i*l*t+i*n*v-g*m*v-j*n*p+g*l*p;b.n32=f*l*t-d*m*t-f*n*v+c*m*v+d*n*p-c*l*p;b.n33=e*i*t-f*j*t+f*g*v-c*i*v-d*g*p+c*j*p;b.n34=f*j*n-d*i*n-f*g*l+c*i*l+d*g*m-c*j*m;b.n41=h*l*t-j*q*t-h*n*v+g*q*v+j*n*D-g*l*D;b.n42=d*q*t-e*l*t+e*n*v-c*q*v-d*n*D+c*l*D;b.n43=e*j*t-d*h*t-e*g*v+c*h*v+d*g*D-c*j*D;b.n44=d*h*n-e*j*n+e*g*l-c*h*l-d*g*q+c*j*q;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,g=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,l=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*g+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*g;c[4]=a*j;c[5]=a*h;c[6]=a*i;c[7]=a*n;c[8]=a*l;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};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 g,j,h,i;g=new THREE.Matrix4;j=b-a;h=c-d;i=f-e;g.n11=2/j;g.n12=0;g.n13=0;g.n14=-((b+a)/j);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+d)/h);g.n31=0;g.n32=0;g.n33=-2/i;g.n34=-((f+e)/i);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
@@ -47,8 +47,8 @@ undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b
 b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,j=d*e;this.w=g*f-j*c;this.x=g*c+j*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,j=a.z;a=a.w;this.x=b*a+e*f+c*j-d*g;this.y=c*a+e*g+d*f-b*j;this.z=d*a+e*j+b*g-c*f;this.w=e*a-b*f-c*g-d*j;return this},
-multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,j=this.z,h=this.w,i=h*c+g*e-j*d,n=h*d+j*c-f*e,m=h*e+f*d-g*c;c=-f*c-g*d-j*e;b.x=i*h+c*-f+n*-j-m*-g;b.y=n*h+c*-g+m*-f-i*-j;b.z=m*h+c*-j+i*-g-n*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,j=this.z,h=this.w,i=h*c+g*e-j*d,n=h*d+j*c-f*e,l=h*e+f*d-g*c;c=-f*c-g*d-j*e;b.x=i*h+c*-f+n*-j-l*-g;b.y=n*h+c*-g+l*-f-i*-j;b.z=l*h+c*-j+i*-g-n*-f;return b}};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
 THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -56,10 +56,10 @@ 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,g,j=new THREE.Vector3,h=new THREE.Vector3;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.vertexNormals.length;b<c;b++)j.addSelf(f.vertexNormals[b]);j.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];j.sub(g.position,c.position);h.sub(b.position,c.position);j.crossSelf(h)}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(F,G,D,L,S,N,C){f=F.vertices[G].position;g=F.vertices[D].position;j=F.vertices[L].position;h=e[S];i=e[N];n=e[C];m=g.x-f.x;p=j.x-f.x;l=g.y-f.y;u=j.y-f.y;r=g.z-f.z;z=j.z-f.z;s=i.u-h.u;B=n.u-h.u;x=i.v-h.v;o=n.v-h.v;J=1/(s*o-B*x);P.set((o*
-m-x*p)*J,(o*l-x*u)*J,(o*r-x*z)*J);y.set((s*p-B*m)*J,(s*u-B*l)*J,(s*z-B*r)*J);K[G].addSelf(P);K[D].addSelf(P);K[L].addSelf(P);O[G].addSelf(y);O[D].addSelf(y);O[L].addSelf(y)}var b,c,d,e,f,g,j,h,i,n,m,p,l,u,r,z,s,B,x,o,J,K=[],O=[],P=new THREE.Vector3,y=new THREE.Vector3,w=new THREE.Vector3,E=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){K[b]=new THREE.Vector3;O[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.faceVertexUvs[b][0];if(d instanceof
+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(X,Y,aa,T,N,U,w){f=X.vertices[Y].position;g=X.vertices[aa].position;j=X.vertices[T].position;h=e[N];i=e[U];n=e[w];l=g.x-f.x;q=j.x-f.x;m=g.y-f.y;t=j.y-f.y;v=g.z-f.z;D=j.z-f.z;p=i.u-h.u;y=n.u-h.u;E=i.v-h.v;O=n.v-h.v;G=1/(p*O-y*E);M.set((O*
+l-E*q)*G,(O*m-E*t)*G,(O*v-E*D)*G);R.set((p*q-y*l)*G,(p*t-y*m)*G,(p*D-y*v)*G);r[Y].addSelf(M);r[aa].addSelf(M);r[T].addSelf(M);S[Y].addSelf(R);S[aa].addSelf(R);S[T].addSelf(R)}var b,c,d,e,f,g,j,h,i,n,l,q,m,t,v,D,p,y,E,O,G,r=[],S=[],M=new THREE.Vector3,R=new THREE.Vector3,Q=new THREE.Vector3,B=new THREE.Vector3,x=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){r[b]=new THREE.Vector3;S[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.faceVertexUvs[b][0];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++){H.copy(this.vertices[b].normal);d=K[b];w.copy(d);w.subSelf(H.multiplyScalar(H.dot(d))).normalize();E.cross(this.vertices[b].normal,d);d=E.dot(O[b]);d=d<0?-1:1;this.vertices[b].tangent.set(w.x,w.y,w.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=
+c;b++){x.copy(this.vertices[b].normal);d=r[b];Q.copy(d);Q.subSelf(x.multiplyScalar(x.dot(d))).normalize();B.cross(this.vertices[b].normal,d);d=B.dot(S[b]);d=d<0?-1:1;this.vertices[b].tangent.set(Q.x,Q.y,Q.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}}};THREE.GeometryIdCounter=0;
 THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(e){for(var f=0;f<a.length;f++)a[f].update(e)};c.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};c.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};c.add=function(e){b[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");b[e.name]=e;if(e.initialized!==!0){for(var f=0;f<e.hierarchy.length;f++){for(var g=0;g<e.hierarchy[f].keys.length;g++){if(e.hierarchy[f].keys[g].time<
@@ -71,11 +71,11 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
 e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,j,h,i,n=this.data.JIT.hierarchy,m,p;this.currentTime+=a*this.timeScale;p=this.currentTime;m=this.currentTime%=this.data.length;i=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var l=0,u=this.hierarchy.length;l<u;l++){a=this.hierarchy[l];h=a.animationCache;if(this.JITCompile&&n[l][i]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=n[l][i];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=n[l][i];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var r=0;r<3;r++){c=b[r];g=h.prevKey[c];j=h.nextKey[c];if(j.time<=p){if(m<p)if(this.loop){g=this.data.hierarchy[l].keys[0];for(j=this.getNextKeyWith(c,l,1);j.time<m;){g=j;j=this.getNextKeyWith(c,l,j.index+1)}}else{this.stop();return}else{do{g=j;j=this.getNextKeyWith(c,l,j.index+1)}while(j.time<
-m)}h.prevKey[c]=g;h.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(m-g.time)/(j.time-g.time);e=g[c];f=j[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+l);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",l,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",l,j.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(c===
-"rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&n[0][i]===undefined){this.hierarchy[0].update(undefined,!0);for(l=0;l<this.hierarchy.length;l++)n[l][i]=this.hierarchy[l]instanceof THREE.Bone?this.hierarchy[l].skinMatrix.clone():this.hierarchy[l].matrix.clone()}}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,j,h,i,n=this.data.JIT.hierarchy,l,q;this.currentTime+=a*this.timeScale;q=this.currentTime;l=this.currentTime%=this.data.length;i=parseInt(Math.min(l*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,t=this.hierarchy.length;m<t;m++){a=this.hierarchy[m];h=a.animationCache;if(this.JITCompile&&n[m][i]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=n[m][i];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=n[m][i];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var v=0;v<3;v++){c=b[v];g=h.prevKey[c];j=h.nextKey[c];if(j.time<=q){if(l<q)if(this.loop){g=this.data.hierarchy[m].keys[0];for(j=this.getNextKeyWith(c,m,1);j.time<l;){g=j;j=this.getNextKeyWith(c,m,j.index+1)}}else{this.stop();return}else{do{g=j;j=this.getNextKeyWith(c,m,j.index+1)}while(j.time<
+l)}h.prevKey[c]=g;h.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(l-g.time)/(j.time-g.time);e=g[c];f=j[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",m,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",m,j.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(c===
+"rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&n[0][i]===undefined){this.hierarchy[0].update(undefined,!0);for(m=0;m<this.hierarchy.length;m++)n[m][i]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,j,h,i;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=f==0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];j=a[c[1]];h=a[c[2]];i=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],j[0],h[0],i[0],e,c,g);d[1]=this.interpolate(f[1],j[1],h[1],i[1],e,c,g);d[2]=this.interpolate(f[2],j[2],h[2],i[2],e,c,g);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<d.length-1?c:d.length-1;else c%=d.length;for(;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
@@ -125,35 +125,43 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.f
 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.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}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.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}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(){var y=h[j]=h[j]||new THREE.RenderableVertex;j++;return y}function b(y,w){return w.z-y.z}function c(y,w){var E=0,H=1,F=y.z+y.w,G=w.z+w.w,D=-y.z+y.w,L=-w.z+w.w;if(F>=0&&G>=0&&D>=0&&L>=0)return!0;else if(F<0&&G<0||D<0&&L<0)return!1;else{if(F<0)E=Math.max(E,F/(F-G));else G<0&&(H=Math.min(H,F/(F-G)));if(D<0)E=Math.max(E,D/(D-L));else L<0&&(H=Math.min(H,D/(D-L)));if(H<E)return!1;else{y.lerpSelf(w,E);w.lerpSelf(y,1-H);return!0}}}var d,e,f=[],g,j,h=[],i,n,m=[],p,l,
-u=[],r,z,s=[],B=new THREE.Vector4,x=new THREE.Vector4,o=new THREE.Matrix4,J=new THREE.Matrix4,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],O=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(y,w){o.multiply(w.projectionMatrix,w.matrixWorldInverse);o.multiplyVector3(y);return y};this.unprojectVector=function(y,w){o.multiply(THREE.Matrix4.makeInvert(w.projectionMatrix),w.matrixWorld);o.multiplyVector3(y);return y};this.projectObjects=
-function(y,w,E){w=[];var H,F,G;e=0;F=y.objects;y=0;for(H=F.length;y<H;y++){G=F[y];var D;if(!(D=!G.visible))if(D=G instanceof THREE.Mesh){a:{D=void 0;for(var L=G.matrixWorld,S=-G.geometry.boundingSphere.radius*Math.max(G.scale.x,Math.max(G.scale.y,G.scale.z)),N=0;N<6;N++){D=K[N].x*L.n14+K[N].y*L.n24+K[N].z*L.n34+K[N].w;if(D<=S){D=!1;break a}}D=!0}D=!D}if(!D){D=f[e]=f[e]||new THREE.RenderableObject;e++;d=D;B.copy(G.position);o.multiplyVector3(B);d.object=G;d.z=B.z;w.push(d)}}E&&w.sort(b);return w};
-this.projectScene=function(y,w,E){var H=[],F=w.near,G=w.far,D,L,S,N,C,ba,Y,ha,ca,Q,fa,ia,Z,$,ga,V,W;z=l=n=0;w.matrixAutoUpdate&&w.updateMatrix();y.update(undefined,!1,w);o.multiply(w.projectionMatrix,w.matrixWorldInverse);K[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);K[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);K[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);K[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);K[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-
-o.n34);K[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(D=0;D<6;D++){ca=K[D];ca.divideScalar(Math.sqrt(ca.x*ca.x+ca.y*ca.y+ca.z*ca.z))}ca=this.projectObjects(y,w,!0);y=0;for(D=ca.length;y<D;y++){Q=ca[y].object;if(Q.visible){fa=Q.matrixWorld;ia=Q.matrixRotationWorld;Z=Q.materials;$=Q.overdraw;j=0;if(Q instanceof THREE.Mesh){ga=Q.geometry;N=ga.vertices;V=ga.faces;ga=ga.faceVertexUvs;L=0;for(S=N.length;L<S;L++){g=a();g.positionWorld.copy(N[L].position);fa.multiplyVector3(g.positionWorld);
-g.positionScreen.copy(g.positionWorld);o.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>F&&g.positionScreen.z<G}N=0;for(L=V.length;N<L;N++){S=V[N];if(S instanceof THREE.Face3){C=h[S.a];ba=h[S.b];Y=h[S.c];if(C.visible&&ba.visible&&Y.visible&&(Q.doubleSided||Q.flipSided!=(Y.positionScreen.x-C.positionScreen.x)*(ba.positionScreen.y-C.positionScreen.y)-(Y.positionScreen.y-C.positionScreen.y)*(ba.positionScreen.x-
-C.positionScreen.x)<0)){ha=m[n]=m[n]||new THREE.RenderableFace3;n++;i=ha;i.v1.copy(C);i.v2.copy(ba);i.v3.copy(Y);i.normalWorld.copy(S.normal);ia.multiplyVector3(i.normalWorld);i.centroidWorld.copy(S.centroid);fa.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);o.multiplyVector3(i.centroidScreen);Y=S.vertexNormals;C=0;for(ba=Y.length;C<ba;C++){ha=i.vertexNormalsWorld[C];ha.copy(Y[C]);ia.multiplyVector3(ha)}C=0;for(ba=ga.length;C<ba;C++)if(W=ga[C][N]){Y=0;for(ha=W.length;Y<ha;Y++)i.uvs[C][Y]=
-W[Y]}i.meshMaterials=Z;i.faceMaterials=S.materials;i.overdraw=$;i.z=i.centroidScreen.z;H.push(i)}}}}else if(Q instanceof THREE.Line){J.multiply(o,fa);N=Q.geometry.vertices;C=a();C.positionScreen.copy(N[0].position);J.multiplyVector4(C.positionScreen);L=1;for(S=N.length;L<S;L++){C=a();C.positionScreen.copy(N[L].position);J.multiplyVector4(C.positionScreen);ba=h[j-2];O.copy(C.positionScreen);P.copy(ba.positionScreen);if(c(O,P)){O.multiplyScalar(1/O.w);P.multiplyScalar(1/P.w);fa=u[l]=u[l]||new THREE.RenderableLine;
-l++;p=fa;p.v1.positionScreen.copy(O);p.v2.positionScreen.copy(P);p.z=Math.max(O.z,P.z);p.materials=Q.materials;H.push(p)}}}else if(Q instanceof THREE.Particle){x.set(Q.position.x,Q.position.y,Q.position.z,1);o.multiplyVector4(x);x.z/=x.w;if(x.z>0&&x.z<1){fa=s[z]=s[z]||new THREE.RenderableParticle;z++;r=fa;r.x=x.x/x.w;r.y=x.y/x.w;r.z=x.z;r.rotation=Q.rotation.z;r.scale.x=Q.scale.x*Math.abs(r.x-(x.x+w.projectionMatrix.n11)/(x.w+w.projectionMatrix.n14));r.scale.y=Q.scale.y*Math.abs(r.y-(x.y+w.projectionMatrix.n22)/
-(x.w+w.projectionMatrix.n24));r.materials=Q.materials;H.push(r)}}}}E&&H.sort(b);return H}};
-THREE.CanvasRenderer=function(){function a(T){if(p!=T)i.globalAlpha=p=T}function b(T){if(l!=T){switch(T){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}l=T}}var c=null,d=new THREE.Projector,e=document.createElement("canvas"),f,g,j,h,i=e.getContext("2d"),n=new THREE.Color(0),m=0,p=1,l=0,u=null,r=null,z=1,s,B,x,o,J,K,O,P,y,w,E=new THREE.Color,
-H=new THREE.Color,F=new THREE.Color,G=new THREE.Color,D=new THREE.Color,L,S,N,C,ba,Y,ha,ca,Q,fa,ia=new THREE.Rectangle,Z=new THREE.Rectangle,$=new THREE.Rectangle,ga=!1,V=new THREE.Color,W=new THREE.Color,pa=new THREE.Color,qa=new THREE.Color,R=new THREE.Vector3,ta,ua,Ea,da,va,za,ra=16;ta=document.createElement("canvas");ta.width=ta.height=2;ua=ta.getContext("2d");ua.fillStyle="rgba(0,0,0,1)";ua.fillRect(0,0,2,2);Ea=ua.getImageData(0,0,2,2);da=Ea.data;va=document.createElement("canvas");va.width=
-va.height=ra;za=va.getContext("2d");za.translate(-ra/2,-ra/2);za.scale(ra,ra);ra--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(T,ja){f=T;g=ja;j=f/2;h=g/2;e.width=f;e.height=g;ia.set(-j,-h,j,h);p=1;l=0;r=u=null;z=1};this.setClearColor=function(T,ja){n=T;m=ja};this.setClearColorHex=function(T,ja){n.setHex(T);m=ja};this.clear=function(){i.setTransform(1,0,0,-1,j,h);if(!Z.isEmpty()){Z.inflate(1);Z.minSelf(ia);if(n.hex==0&&m==0)i.clearRect(Z.getX(),
-Z.getY(),Z.getWidth(),Z.getHeight());else{b(THREE.NormalBlending);a(1);i.fillStyle="rgba("+Math.floor(n.r*255)+","+Math.floor(n.g*255)+","+Math.floor(n.b*255)+","+m+")";i.fillRect(Z.getX(),Z.getY(),Z.getWidth(),Z.getHeight())}Z.empty()}};this.render=function(T,ja){function Na(k){var A,v,q,t=k.lights;W.setRGB(0,0,0);pa.setRGB(0,0,0);qa.setRGB(0,0,0);k=0;for(A=t.length;k<A;k++){v=t[k];q=v.color;if(v instanceof THREE.AmbientLight){W.r+=q.r;W.g+=q.g;W.b+=q.b}else if(v instanceof THREE.DirectionalLight){pa.r+=
-q.r;pa.g+=q.g;pa.b+=q.b}else if(v instanceof THREE.PointLight){qa.r+=q.r;qa.g+=q.g;qa.b+=q.b}}}function Aa(k,A,v,q){var t,I,U,X,aa=k.lights;k=0;for(t=aa.length;k<t;k++){I=aa[k];U=I.color;X=I.intensity;if(I instanceof THREE.DirectionalLight){I=v.dot(I.position)*X;if(I>0){q.r+=U.r*I;q.g+=U.g*I;q.b+=U.b*I}}else if(I instanceof THREE.PointLight){R.sub(I.position,A);R.normalize();I=v.dot(R)*X;if(I>0){q.r+=U.r*I;q.g+=U.g*I;q.b+=U.b*I}}}}function Oa(k,A,v){if(v.opacity!=0){a(v.opacity);b(v.blending);var q,
-t,I,U,X,aa;if(v instanceof THREE.ParticleBasicMaterial){if(v.map){U=v.map.image;X=U.width>>1;aa=U.height>>1;v=A.scale.x*j;I=A.scale.y*h;q=v*X;t=I*aa;$.set(k.x-q,k.y-t,k.x+q,k.y+t);if(ia.instersects($)){i.save();i.translate(k.x,k.y);i.rotate(-A.rotation);i.scale(v,-I);i.translate(-X,-aa);i.drawImage(U,0,0);i.restore()}}}else if(v instanceof THREE.ParticleCanvasMaterial){if(ga){V.r=W.r+pa.r+qa.r;V.g=W.g+pa.g+qa.g;V.b=W.b+pa.b+qa.b;E.r=v.color.r*V.r;E.g=v.color.g*V.g;E.b=v.color.b*V.b;E.updateStyleString()}else E.__styleString=
-v.color.__styleString;q=A.scale.x*j;t=A.scale.y*h;$.set(k.x-q,k.y-t,k.x+q,k.y+t);if(ia.instersects($)){i.save();i.translate(k.x,k.y);i.rotate(-A.rotation);i.scale(q,t);v.program(i,E);i.restore()}}}}function Pa(k,A,v,q){if(q.opacity!=0){a(q.opacity);b(q.blending);i.beginPath();i.moveTo(k.positionScreen.x,k.positionScreen.y);i.lineTo(A.positionScreen.x,A.positionScreen.y);i.closePath();if(q instanceof THREE.LineBasicMaterial){E.__styleString=q.color.__styleString;k=q.linewidth;if(z!=k)i.lineWidth=z=
-k;k=E.__styleString;if(u!=k)i.strokeStyle=u=k;i.stroke();$.inflate(q.linewidth*2)}}}function Ja(k,A,v,q,t,I){if(t.opacity!=0){a(t.opacity);b(t.blending);J=k.positionScreen.x;K=k.positionScreen.y;O=A.positionScreen.x;P=A.positionScreen.y;y=v.positionScreen.x;w=v.positionScreen.y;i.beginPath();i.moveTo(J,K);i.lineTo(O,P);i.lineTo(y,w);i.lineTo(J,K);i.closePath();if(t instanceof THREE.MeshBasicMaterial)if(t.map){if(t.map.mapping instanceof THREE.UVMapping){C=q.uvs[0];wa(J,K,O,P,y,w,t.map.image,C[0].u,
-C[0].v,C[1].u,C[1].v,C[2].u,C[2].v)}}else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping){k=ja.matrixWorldInverse;R.copy(q.vertexNormalsWorld[0]);ba=(R.x*k.n11+R.y*k.n12+R.z*k.n13)*0.5+0.5;Y=-(R.x*k.n21+R.y*k.n22+R.z*k.n23)*0.5+0.5;R.copy(q.vertexNormalsWorld[1]);ha=(R.x*k.n11+R.y*k.n12+R.z*k.n13)*0.5+0.5;ca=-(R.x*k.n21+R.y*k.n22+R.z*k.n23)*0.5+0.5;R.copy(q.vertexNormalsWorld[2]);Q=(R.x*k.n11+R.y*k.n12+R.z*k.n13)*0.5+0.5;fa=-(R.x*k.n21+R.y*k.n22+R.z*k.n23)*0.5+0.5;wa(J,
-K,O,P,y,w,t.envMap.image,ba,Y,ha,ca,Q,fa)}}else t.wireframe?Ba(t.color.__styleString,t.wireframeLinewidth):Ca(t.color.__styleString);else if(t instanceof THREE.MeshLambertMaterial){if(t.map&&!t.wireframe){if(t.map.mapping instanceof THREE.UVMapping){C=q.uvs[0];wa(J,K,O,P,y,w,t.map.image,C[0].u,C[0].v,C[1].u,C[1].v,C[2].u,C[2].v)}b(THREE.SubtractiveBlending)}if(ga)if(!t.wireframe&&t.shading==THREE.SmoothShading&&q.vertexNormalsWorld.length==3){H.r=F.r=G.r=W.r;H.g=F.g=G.g=W.g;H.b=F.b=G.b=W.b;Aa(I,q.v1.positionWorld,
-q.vertexNormalsWorld[0],H);Aa(I,q.v2.positionWorld,q.vertexNormalsWorld[1],F);Aa(I,q.v3.positionWorld,q.vertexNormalsWorld[2],G);D.r=(F.r+G.r)*0.5;D.g=(F.g+G.g)*0.5;D.b=(F.b+G.b)*0.5;N=Ka(H,F,G,D);wa(J,K,O,P,y,w,N,0,0,1,0,0,1)}else{V.r=W.r;V.g=W.g;V.b=W.b;Aa(I,q.centroidWorld,q.normalWorld,V);E.r=t.color.r*V.r;E.g=t.color.g*V.g;E.b=t.color.b*V.b;E.updateStyleString();t.wireframe?Ba(E.__styleString,t.wireframeLinewidth):Ca(E.__styleString)}else t.wireframe?Ba(t.color.__styleString,t.wireframeLinewidth):
-Ca(t.color.__styleString)}else if(t instanceof THREE.MeshDepthMaterial){L=ja.near;S=ja.far;H.r=H.g=H.b=1-Fa(k.positionScreen.z,L,S);F.r=F.g=F.b=1-Fa(A.positionScreen.z,L,S);G.r=G.g=G.b=1-Fa(v.positionScreen.z,L,S);D.r=(F.r+G.r)*0.5;D.g=(F.g+G.g)*0.5;D.b=(F.b+G.b)*0.5;N=Ka(H,F,G,D);wa(J,K,O,P,y,w,N,0,0,1,0,0,1)}else if(t instanceof THREE.MeshNormalMaterial){E.r=Ga(q.normalWorld.x);E.g=Ga(q.normalWorld.y);E.b=Ga(q.normalWorld.z);E.updateStyleString();t.wireframe?Ba(E.__styleString,t.wireframeLinewidth):
-Ca(E.__styleString)}}}function Ba(k,A){if(u!=k)i.strokeStyle=u=k;if(z!=A)i.lineWidth=z=A;i.stroke();$.inflate(A*2)}function Ca(k){if(r!=k)i.fillStyle=r=k;i.fill()}function wa(k,A,v,q,t,I,U,X,aa,ma,ea,na,xa){var ka,oa;ka=U.width-1;oa=U.height-1;X*=ka;aa*=oa;ma*=ka;ea*=oa;na*=ka;xa*=oa;v-=k;q-=A;t-=k;I-=A;ma-=X;ea-=aa;na-=X;xa-=aa;ka=ma*xa-na*ea;if(ka!=0){oa=1/ka;ka=(xa*v-ea*t)*oa;ea=(xa*q-ea*I)*oa;v=(ma*t-na*v)*oa;q=(ma*I-na*q)*oa;k=k-ka*X-v*aa;A=A-ea*X-q*aa;i.save();i.transform(ka,ea,v,q,k,A);i.clip();
-i.drawImage(U,0,0);i.restore()}}function Ka(k,A,v,q){var t=~~(k.r*255),I=~~(k.g*255);k=~~(k.b*255);var U=~~(A.r*255),X=~~(A.g*255);A=~~(A.b*255);var aa=~~(v.r*255),ma=~~(v.g*255);v=~~(v.b*255);var ea=~~(q.r*255),na=~~(q.g*255);q=~~(q.b*255);da[0]=t<0?0:t>255?255:t;da[1]=I<0?0:I>255?255:I;da[2]=k<0?0:k>255?255:k;da[4]=U<0?0:U>255?255:U;da[5]=X<0?0:X>255?255:X;da[6]=A<0?0:A>255?255:A;da[8]=aa<0?0:aa>255?255:aa;da[9]=ma<0?0:ma>255?255:ma;da[10]=v<0?0:v>255?255:v;da[12]=ea<0?0:ea>255?255:ea;da[13]=na<
-0?0:na>255?255:na;da[14]=q<0?0:q>255?255:q;ua.putImageData(Ea,0,0);za.drawImage(ta,0,0);return va}function Fa(k,A,v){k=(k-A)/(v-A);return k*k*(3-2*k)}function Ga(k){k=(k+1)*0.5;return k<0?0:k>1?1:k}function Ha(k,A){var v=A.x-k.x,q=A.y-k.y,t=1/Math.sqrt(v*v+q*q);v*=t;q*=t;A.x+=v;A.y+=q;k.x-=v;k.y-=q}var Da,La,M,la,sa,Ia,Ma,ya;this.autoClear?this.clear():i.setTransform(1,0,0,-1,j,h);c=d.projectScene(T,ja,this.sortElements);(ga=T.lights.length>0)&&Na(T);Da=0;for(La=c.length;Da<La;Da++){M=c[Da];$.empty();
-if(M instanceof THREE.RenderableParticle){s=M;s.x*=j;s.y*=h;la=0;for(sa=M.materials.length;la<sa;la++)Oa(s,M,M.materials[la],T)}else if(M instanceof THREE.RenderableLine){s=M.v1;B=M.v2;s.positionScreen.x*=j;s.positionScreen.y*=h;B.positionScreen.x*=j;B.positionScreen.y*=h;$.addPoint(s.positionScreen.x,s.positionScreen.y);$.addPoint(B.positionScreen.x,B.positionScreen.y);if(ia.instersects($)){la=0;for(sa=M.materials.length;la<sa;)Pa(s,B,M,M.materials[la++],T)}}else if(M instanceof THREE.RenderableFace3){s=
-M.v1;B=M.v2;x=M.v3;s.positionScreen.x*=j;s.positionScreen.y*=h;B.positionScreen.x*=j;B.positionScreen.y*=h;x.positionScreen.x*=j;x.positionScreen.y*=h;if(M.overdraw){Ha(s.positionScreen,B.positionScreen);Ha(B.positionScreen,x.positionScreen);Ha(x.positionScreen,s.positionScreen)}$.add3Points(s.positionScreen.x,s.positionScreen.y,B.positionScreen.x,B.positionScreen.y,x.positionScreen.x,x.positionScreen.y);if(ia.instersects($)){la=0;for(sa=M.meshMaterials.length;la<sa;){ya=M.meshMaterials[la++];if(ya instanceof
-THREE.MeshFaceMaterial){Ia=0;for(Ma=M.faceMaterials.length;Ia<Ma;)(ya=M.faceMaterials[Ia++])&&Ja(s,B,x,M,ya,T)}else Ja(s,B,x,M,ya,T)}}}else if(M instanceof THREE.RenderableFace4){s=M.v1;B=M.v2;x=M.v3;o=M.v4;s.positionScreen.x*=j;s.positionScreen.y*=h;B.positionScreen.x*=j;B.positionScreen.y*=h;x.positionScreen.x*=j;x.positionScreen.y*=h;o.positionScreen.x*=j;o.positionScreen.y*=h}Z.addRectangle($)}i.setTransform(1,0,0,1,0,0)}};
+THREE.Projector=function(){function a(){var B=h[j]=h[j]||new THREE.RenderableVertex;j++;return B}function b(B,x){return x.z-B.z}function c(B,x){var X=0,Y=1,aa=B.z+B.w,T=x.z+x.w,N=-B.z+B.w,U=-x.z+x.w;if(aa>=0&&T>=0&&N>=0&&U>=0)return!0;else if(aa<0&&T<0||N<0&&U<0)return!1;else{if(aa<0)X=Math.max(X,aa/(aa-T));else T<0&&(Y=Math.min(Y,aa/(aa-T)));if(N<0)X=Math.max(X,N/(N-U));else U<0&&(Y=Math.min(Y,N/(N-U)));if(Y<X)return!1;else{B.lerpSelf(x,X);x.lerpSelf(B,1-Y);return!0}}}var d,e,f=[],g,j,h=[],i,n,l=
+[],q,m=[],t,v,D=[],p,y,E=[],O=new THREE.Vector4,G=new THREE.Vector4,r=new THREE.Matrix4,S=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],R=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(B,x){r.multiply(x.projectionMatrix,x.matrixWorldInverse);r.multiplyVector3(B);return B};this.unprojectVector=function(B,x){r.multiply(x.matrixWorld,THREE.Matrix4.makeInvert(x.projectionMatrix));r.multiplyVector3(B);
+return B};this.projectObjects=function(B,x,X){x=[];var Y,aa,T;e=0;aa=B.objects;B=0;for(Y=aa.length;B<Y;B++){T=aa[B];var N;if(!(N=!T.visible))if(N=T instanceof THREE.Mesh){a:{N=void 0;for(var U=T.matrixWorld,w=-T.geometry.boundingSphere.radius*Math.max(T.scale.x,Math.max(T.scale.y,T.scale.z)),K=0;K<6;K++){N=M[K].x*U.n14+M[K].y*U.n24+M[K].z*U.n34+M[K].w;if(N<=w){N=!1;break a}}N=!0}N=!N}if(!N){N=f[e]=f[e]||new THREE.RenderableObject;e++;d=N;O.copy(T.position);r.multiplyVector3(O);d.object=T;d.z=O.z;
+x.push(d)}}X&&x.sort(b);return x};this.projectScene=function(B,x,X){var Y=[],aa=x.near,T=x.far,N,U,w,K,z,H,L,da,ga,P,Z,Ba,Fa,Ga,pa,Ca,ta;y=v=q=n=0;x.matrixAutoUpdate&&x.updateMatrix();B.update(undefined,!1,x);r.multiply(x.projectionMatrix,x.matrixWorldInverse);M[0].set(r.n41-r.n11,r.n42-r.n12,r.n43-r.n13,r.n44-r.n14);M[1].set(r.n41+r.n11,r.n42+r.n12,r.n43+r.n13,r.n44+r.n14);M[2].set(r.n41+r.n21,r.n42+r.n22,r.n43+r.n23,r.n44+r.n24);M[3].set(r.n41-r.n21,r.n42-r.n22,r.n43-r.n23,r.n44-r.n24);M[4].set(r.n41-
+r.n31,r.n42-r.n32,r.n43-r.n33,r.n44-r.n34);M[5].set(r.n41+r.n31,r.n42+r.n32,r.n43+r.n33,r.n44+r.n34);for(N=0;N<6;N++){ga=M[N];ga.divideScalar(Math.sqrt(ga.x*ga.x+ga.y*ga.y+ga.z*ga.z))}ga=this.projectObjects(B,x,!0);B=0;for(N=ga.length;B<N;B++){P=ga[B].object;if(P.visible){Z=P.matrixWorld;Ba=P.matrixRotationWorld;Fa=P.materials;Ga=P.overdraw;j=0;if(P instanceof THREE.Mesh){pa=P.geometry;K=pa.vertices;Ca=pa.faces;pa=pa.faceVertexUvs;U=0;for(w=K.length;U<w;U++){g=a();g.positionWorld.copy(K[U].position);
+Z.multiplyVector3(g.positionWorld);g.positionScreen.copy(g.positionWorld);r.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>aa&&g.positionScreen.z<T}K=0;for(U=Ca.length;K<U;K++){w=Ca[K];if(w instanceof THREE.Face3){z=h[w.a];H=h[w.b];L=h[w.c];if(z.visible&&H.visible&&L.visible&&(P.doubleSided||P.flipSided!=(L.positionScreen.x-z.positionScreen.x)*(H.positionScreen.y-z.positionScreen.y)-(L.positionScreen.y-z.positionScreen.y)*
+(H.positionScreen.x-z.positionScreen.x)<0)){da=l[n]=l[n]||new THREE.RenderableFace3;n++;i=da;i.v1.copy(z);i.v2.copy(H);i.v3.copy(L)}else continue}else if(w instanceof THREE.Face4){z=h[w.a];H=h[w.b];L=h[w.c];da=h[w.d];if(z.visible&&H.visible&&L.visible&&da.visible&&(P.doubleSided||P.flipSided!=((da.positionScreen.x-z.positionScreen.x)*(H.positionScreen.y-z.positionScreen.y)-(da.positionScreen.y-z.positionScreen.y)*(H.positionScreen.x-z.positionScreen.x)<0||(H.positionScreen.x-L.positionScreen.x)*(da.positionScreen.y-
+L.positionScreen.y)-(H.positionScreen.y-L.positionScreen.y)*(da.positionScreen.x-L.positionScreen.x)<0))){ta=m[q]=m[q]||new THREE.RenderableFace4;q++;i=ta;i.v1.copy(z);i.v2.copy(H);i.v3.copy(L);i.v4.copy(da)}else continue}i.normalWorld.copy(w.normal);Ba.multiplyVector3(i.normalWorld);i.centroidWorld.copy(w.centroid);Z.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);r.multiplyVector3(i.centroidScreen);L=w.vertexNormals;z=0;for(H=L.length;z<H;z++){da=i.vertexNormalsWorld[z];
+da.copy(L[z]);Ba.multiplyVector3(da)}z=0;for(H=pa.length;z<H;z++)if(ta=pa[z][K]){L=0;for(da=ta.length;L<da;L++)i.uvs[z][L]=ta[L]}i.meshMaterials=Fa;i.faceMaterials=w.materials;i.overdraw=Ga;i.z=i.centroidScreen.z;Y.push(i)}}else if(P instanceof THREE.Line){S.multiply(r,Z);K=P.geometry.vertices;z=a();z.positionScreen.copy(K[0].position);S.multiplyVector4(z.positionScreen);U=1;for(w=K.length;U<w;U++){z=a();z.positionScreen.copy(K[U].position);S.multiplyVector4(z.positionScreen);H=h[j-2];R.copy(z.positionScreen);
+Q.copy(H.positionScreen);if(c(R,Q)){R.multiplyScalar(1/R.w);Q.multiplyScalar(1/Q.w);Z=D[v]=D[v]||new THREE.RenderableLine;v++;t=Z;t.v1.positionScreen.copy(R);t.v2.positionScreen.copy(Q);t.z=Math.max(R.z,Q.z);t.materials=P.materials;Y.push(t)}}}else if(P instanceof THREE.Particle){G.set(P.position.x,P.position.y,P.position.z,1);r.multiplyVector4(G);G.z/=G.w;if(G.z>0&&G.z<1){Z=E[y]=E[y]||new THREE.RenderableParticle;y++;p=Z;p.x=G.x/G.w;p.y=G.y/G.w;p.z=G.z;p.rotation=P.rotation.z;p.scale.x=P.scale.x*
+Math.abs(p.x-(G.x+x.projectionMatrix.n11)/(G.w+x.projectionMatrix.n14));p.scale.y=P.scale.y*Math.abs(p.y-(G.y+x.projectionMatrix.n22)/(G.w+x.projectionMatrix.n24));p.materials=P.materials;Y.push(p)}}}}X&&Y.sort(b);return Y}};
+THREE.CanvasRenderer=function(){function a($){if(q!=$)i.globalAlpha=q=$}function b($){if(m!=$){switch($){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}m=$}}var c=null,d=new THREE.Projector,e=document.createElement("canvas"),f,g,j,h,i=e.getContext("2d"),n=new THREE.Color(0),l=0,q=1,m=0,t=null,v=null,D=1,p,y,E,O,G=new THREE.RenderableVertex,
+r=new THREE.RenderableVertex,S,M,R,Q,B,x,X,Y,aa,T,N,U,w=new THREE.Color,K=new THREE.Color,z=new THREE.Color,H=new THREE.Color,L=new THREE.Color,da,ga,P,Z,Ba,Fa,Ga,pa,Ca,ta,ya=new THREE.Rectangle,ja=new THREE.Rectangle,ea=new THREE.Rectangle,Ma=!1,ba=new THREE.Color,ha=new THREE.Color,za=new THREE.Color,Aa=new THREE.Color,W=new THREE.Vector3,Ha,Ia,Ra,ka,Ja,Na,qa=16;Ha=document.createElement("canvas");Ha.width=Ha.height=2;Ia=Ha.getContext("2d");Ia.fillStyle="rgba(0,0,0,1)";Ia.fillRect(0,0,2,2);Ra=Ia.getImageData(0,
+0,2,2);ka=Ra.data;Ja=document.createElement("canvas");Ja.width=Ja.height=qa;Na=Ja.getContext("2d");Na.translate(-qa/2,-qa/2);Na.scale(qa,qa);qa--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function($,ra){f=$;g=ra;j=f/2;h=g/2;e.width=f;e.height=g;ya.set(-j,-h,j,h);q=1;m=0;v=t=null;D=1};this.setClearColor=function($,ra){n=$;l=ra};this.setClearColorHex=function($,ra){n.setHex($);l=ra};this.clear=function(){i.setTransform(1,0,0,-1,j,h);if(!ja.isEmpty()){ja.inflate(1);
+ja.minSelf(ya);if(n.hex==0&&l==0)i.clearRect(ja.getX(),ja.getY(),ja.getWidth(),ja.getHeight());else{b(THREE.NormalBlending);a(1);i.fillStyle="rgba("+Math.floor(n.r*255)+","+Math.floor(n.g*255)+","+Math.floor(n.b*255)+","+l+")";i.fillRect(ja.getX(),ja.getY(),ja.getWidth(),ja.getHeight())}ja.empty()}};this.render=function($,ra){function Wa(k){var A,u,s,I=k.lights;ha.setRGB(0,0,0);za.setRGB(0,0,0);Aa.setRGB(0,0,0);k=0;for(A=I.length;k<A;k++){u=I[k];s=u.color;if(u instanceof THREE.AmbientLight){ha.r+=
+s.r;ha.g+=s.g;ha.b+=s.b}else if(u instanceof THREE.DirectionalLight){za.r+=s.r;za.g+=s.g;za.b+=s.b}else if(u instanceof THREE.PointLight){Aa.r+=s.r;Aa.g+=s.g;Aa.b+=s.b}}}function Ka(k,A,u,s){var I,F,C,o,V=k.lights;k=0;for(I=V.length;k<I;k++){F=V[k];C=F.color;o=F.intensity;if(F instanceof THREE.DirectionalLight){F=u.dot(F.position)*o;if(F>0){s.r+=C.r*F;s.g+=C.g*F;s.b+=C.b*F}}else if(F instanceof THREE.PointLight){W.sub(F.position,A);W.normalize();F=u.dot(W)*o;if(F>0){s.r+=C.r*F;s.g+=C.g*F;s.b+=C.b*
+F}}}}function Xa(k,A,u){a(u.opacity);b(u.blending);var s,I,F,C,o,V;if(u instanceof THREE.ParticleBasicMaterial){if(u.map){C=u.map.image;o=C.width>>1;V=C.height>>1;u=A.scale.x*j;F=A.scale.y*h;s=u*o;I=F*V;ea.set(k.x-s,k.y-I,k.x+s,k.y+I);if(ya.instersects(ea)){i.save();i.translate(k.x,k.y);i.rotate(-A.rotation);i.scale(u,-F);i.translate(-o,-V);i.drawImage(C,0,0);i.restore()}}}else if(u instanceof THREE.ParticleCanvasMaterial){if(Ma){ba.r=ha.r+za.r+Aa.r;ba.g=ha.g+za.g+Aa.g;ba.b=ha.b+za.b+Aa.b;w.r=u.color.r*
+ba.r;w.g=u.color.g*ba.g;w.b=u.color.b*ba.b;w.updateStyleString()}else w.__styleString=u.color.__styleString;s=A.scale.x*j;I=A.scale.y*h;ea.set(k.x-s,k.y-I,k.x+s,k.y+I);if(ya.instersects(ea)){i.save();i.translate(k.x,k.y);i.rotate(-A.rotation);i.scale(s,I);u.program(i,w);i.restore()}}}function Ya(k,A,u,s){a(s.opacity);b(s.blending);i.beginPath();i.moveTo(k.positionScreen.x,k.positionScreen.y);i.lineTo(A.positionScreen.x,A.positionScreen.y);i.closePath();if(s instanceof THREE.LineBasicMaterial){w.__styleString=
+s.color.__styleString;k=s.linewidth;if(D!=k)i.lineWidth=D=k;k=w.__styleString;if(t!=k)i.strokeStyle=t=k;i.stroke();ea.inflate(s.linewidth*2)}}function Oa(k,A,u,s,I,F,C,o,V){a(o.opacity);b(o.blending);S=k.positionScreen.x;M=k.positionScreen.y;R=A.positionScreen.x;Q=A.positionScreen.y;B=u.positionScreen.x;x=u.positionScreen.y;var ia=S,fa=M,la=R,sa=Q,ma=B,oa=x;i.beginPath();i.moveTo(ia,fa);i.lineTo(la,sa);i.lineTo(ma,oa);i.lineTo(ia,fa);i.closePath();if(o instanceof THREE.MeshBasicMaterial)if(o.map){if(o.map.mapping instanceof
+THREE.UVMapping){Z=C.uvs[0];La(S,M,R,Q,B,x,o.map.image,Z[s].u,Z[s].v,Z[I].u,Z[I].v,Z[F].u,Z[F].v)}}else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping){k=ra.matrixWorldInverse;W.copy(C.vertexNormalsWorld[0]);Ba=(W.x*k.n11+W.y*k.n12+W.z*k.n13)*0.5+0.5;Fa=-(W.x*k.n21+W.y*k.n22+W.z*k.n23)*0.5+0.5;W.copy(C.vertexNormalsWorld[1]);Ga=(W.x*k.n11+W.y*k.n12+W.z*k.n13)*0.5+0.5;pa=-(W.x*k.n21+W.y*k.n22+W.z*k.n23)*0.5+0.5;W.copy(C.vertexNormalsWorld[2]);Ca=(W.x*k.n11+W.y*k.n12+W.z*
+k.n13)*0.5+0.5;ta=-(W.x*k.n21+W.y*k.n22+W.z*k.n23)*0.5+0.5;La(S,M,R,Q,B,x,o.envMap.image,Ba,Fa,Ga,pa,Ca,ta)}}else o.wireframe?ua(o.color.__styleString,o.wireframeLinewidth):va(o.color.__styleString);else if(o instanceof THREE.MeshLambertMaterial){if(o.map&&!o.wireframe){if(o.map.mapping instanceof THREE.UVMapping){Z=C.uvs[0];La(S,M,R,Q,B,x,o.map.image,Z[s].u,Z[s].v,Z[I].u,Z[I].v,Z[F].u,Z[F].v)}b(THREE.SubtractiveBlending)}if(Ma)if(!o.wireframe&&o.shading==THREE.SmoothShading&&C.vertexNormalsWorld.length==
+3){K.r=z.r=H.r=ha.r;K.g=z.g=H.g=ha.g;K.b=z.b=H.b=ha.b;Ka(V,C.v1.positionWorld,C.vertexNormalsWorld[0],K);Ka(V,C.v2.positionWorld,C.vertexNormalsWorld[1],z);Ka(V,C.v3.positionWorld,C.vertexNormalsWorld[2],H);L.r=(z.r+H.r)*0.5;L.g=(z.g+H.g)*0.5;L.b=(z.b+H.b)*0.5;P=Sa(K,z,H,L);La(S,M,R,Q,B,x,P,0,0,1,0,0,1)}else{ba.r=ha.r;ba.g=ha.g;ba.b=ha.b;Ka(V,C.centroidWorld,C.normalWorld,ba);w.r=o.color.r*ba.r;w.g=o.color.g*ba.g;w.b=o.color.b*ba.b;w.updateStyleString();o.wireframe?ua(w.__styleString,o.wireframeLinewidth):
+va(w.__styleString)}else o.wireframe?ua(o.color.__styleString,o.wireframeLinewidth):va(o.color.__styleString)}else if(o instanceof THREE.MeshDepthMaterial){da=ra.near;ga=ra.far;K.r=K.g=K.b=1-Ta(k.positionScreen.z,da,ga);z.r=z.g=z.b=1-Ta(A.positionScreen.z,da,ga);H.r=H.g=H.b=1-Ta(u.positionScreen.z,da,ga);L.r=(z.r+H.r)*0.5;L.g=(z.g+H.g)*0.5;L.b=(z.b+H.b)*0.5;P=Sa(K,z,H,L);La(S,M,R,Q,B,x,P,0,0,1,0,0,1)}else if(o instanceof THREE.MeshNormalMaterial){w.r=Da(C.normalWorld.x);w.g=Da(C.normalWorld.y);w.b=
+Da(C.normalWorld.z);w.updateStyleString();o.wireframe?ua(w.__styleString,o.wireframeLinewidth):va(w.__styleString)}}function Ua(k,A,u,s,I,F,C,o,V){a(o.opacity);b(o.blending);if(o.map||o.envMap){Oa(k,A,s,0,1,3,C,o,V);Oa(I,u,F,1,2,3,C,o,V)}else{S=k.positionScreen.x;M=k.positionScreen.y;R=A.positionScreen.x;Q=A.positionScreen.y;B=u.positionScreen.x;x=u.positionScreen.y;X=s.positionScreen.x;Y=s.positionScreen.y;aa=I.positionScreen.x;T=I.positionScreen.y;N=F.positionScreen.x;U=F.positionScreen.y;I=S;F=
+M;var ia=R,fa=Q,la=B,sa=x;i.beginPath();i.moveTo(I,F);i.lineTo(ia,fa);i.lineTo(la,sa);i.lineTo(X,Y);i.lineTo(I,F);i.closePath();if(o instanceof THREE.MeshBasicMaterial)o.wireframe?ua(o.color.__styleString,o.wireframeLinewidth):va(o.color.__styleString);else if(o instanceof THREE.MeshLambertMaterial)if(Ma){ba.r=ha.r;ba.g=ha.g;ba.b=ha.b;Ka(V,C.centroidWorld,C.normalWorld,ba);w.r=o.color.r*ba.r;w.g=o.color.g*ba.g;w.b=o.color.b*ba.b;w.updateStyleString();o.wireframe?ua(w.__styleString,o.wireframeLinewidth):
+va(w.__styleString)}else o.wireframe?ua(o.color.__styleString,o.wireframeLinewidth):va(o.color.__styleString);else if(o instanceof THREE.MeshDepthMaterial){_2near=o.__2near;_farPlusNear=o.__farPlusNear;_farMinusNear=o.__farMinusNear;K=~~((1-_2near/(_farPlusNear-k.positionScreen.z*_farMinusNear))*255);z=~~((1-_2near/(_farPlusNear-A.positionScreen.z*_farMinusNear))*255);H=~~((1-_2near/(_farPlusNear-u.positionScreen.z*_farMinusNear))*255);L=~~((1-_2near/(_farPlusNear-s.positionScreen.z*_farMinusNear))*
+255);P=Sa([K,K,K],[z,z,z],[L,L,L],[H,H,H]);_uv1.u=0;_uv1.v=0;_uv2.u=qa;_uv2.v=0;_uv3.u=qa;_uv3.v=qa;_uv4.u=0;_uv4.v=qa;drawTexturedTriangle(P,S,M,R,Q,X,Y,_uv1.u,_uv1.v,_uv2.u,_uv2.v,_uv4.u,_uv4.v);drawTexturedTriangle(P,aa,T,B,x,N,U,_uv2.u,_uv2.v,_uv3.u,_uv3.v,_uv4.u,_uv4.v)}else if(o instanceof THREE.MeshNormalMaterial){w.r=Da(C.normalWorld.x);w.g=Da(C.normalWorld.y);w.b=Da(C.normalWorld.z);w.updateStyleString();o.wireframe?ua(w.__styleString,o.wireframeLinewidth):va(w.__styleString)}}}function ua(k,
+A){if(t!=k)i.strokeStyle=t=k;if(D!=A)i.lineWidth=D=A;i.stroke();ea.inflate(A*2)}function va(k){if(v!=k)i.fillStyle=v=k;i.fill()}function La(k,A,u,s,I,F,C,o,V,ia,fa,la,sa){var ma,oa;ma=C.width-1;oa=C.height-1;o*=ma;V*=oa;ia*=ma;fa*=oa;la*=ma;sa*=oa;u-=k;s-=A;I-=k;F-=A;ia-=o;fa-=V;la-=o;sa-=V;ma=ia*sa-la*fa;if(ma!=0){oa=1/ma;ma=(sa*u-fa*I)*oa;fa=(sa*s-fa*F)*oa;u=(ia*I-la*u)*oa;s=(ia*F-la*s)*oa;k=k-ma*o-u*V;A=A-fa*o-s*V;i.save();i.transform(ma,fa,u,s,k,A);i.clip();i.drawImage(C,0,0);i.restore()}}function Sa(k,
+A,u,s){var I=~~(k.r*255),F=~~(k.g*255);k=~~(k.b*255);var C=~~(A.r*255),o=~~(A.g*255);A=~~(A.b*255);var V=~~(u.r*255),ia=~~(u.g*255);u=~~(u.b*255);var fa=~~(s.r*255),la=~~(s.g*255);s=~~(s.b*255);ka[0]=I<0?0:I>255?255:I;ka[1]=F<0?0:F>255?255:F;ka[2]=k<0?0:k>255?255:k;ka[4]=C<0?0:C>255?255:C;ka[5]=o<0?0:o>255?255:o;ka[6]=A<0?0:A>255?255:A;ka[8]=V<0?0:V>255?255:V;ka[9]=ia<0?0:ia>255?255:ia;ka[10]=u<0?0:u>255?255:u;ka[12]=fa<0?0:fa>255?255:fa;ka[13]=la<0?0:la>255?255:la;ka[14]=s<0?0:s>255?255:s;Ia.putImageData(Ra,
+0,0);Na.drawImage(Ha,0,0);return Ja}function Ta(k,A,u){k=(k-A)/(u-A);return k*k*(3-2*k)}function Da(k){k=(k+1)*0.5;return k<0?0:k>1?1:k}function wa(k,A){var u=A.x-k.x,s=A.y-k.y,I=1/Math.sqrt(u*u+s*s);u*=I;s*=I;A.x+=u;A.y+=s;k.x-=u;k.y-=s}var Pa,Va,J,na,xa,Ea,Qa,ca;this.autoClear?this.clear():i.setTransform(1,0,0,-1,j,h);c=d.projectScene($,ra,this.sortElements);(Ma=$.lights.length>0)&&Wa($);Pa=0;for(Va=c.length;Pa<Va;Pa++){J=c[Pa];ea.empty();if(J instanceof THREE.RenderableParticle){p=J;p.x*=j;p.y*=
+h;na=0;for(xa=J.materials.length;na<xa;){ca=J.materials[na++];ca.opacity!=0&&Xa(p,J,ca,$)}}else if(J instanceof THREE.RenderableLine){p=J.v1;y=J.v2;p.positionScreen.x*=j;p.positionScreen.y*=h;y.positionScreen.x*=j;y.positionScreen.y*=h;ea.addPoint(p.positionScreen.x,p.positionScreen.y);ea.addPoint(y.positionScreen.x,y.positionScreen.y);if(ya.instersects(ea)){na=0;for(xa=J.materials.length;na<xa;){ca=J.materials[na++];ca.opacity!=0&&Ya(p,y,J,ca,$)}}}else if(J instanceof THREE.RenderableFace3){p=J.v1;
+y=J.v2;E=J.v3;p.positionScreen.x*=j;p.positionScreen.y*=h;y.positionScreen.x*=j;y.positionScreen.y*=h;E.positionScreen.x*=j;E.positionScreen.y*=h;if(J.overdraw){wa(p.positionScreen,y.positionScreen);wa(y.positionScreen,E.positionScreen);wa(E.positionScreen,p.positionScreen)}ea.add3Points(p.positionScreen.x,p.positionScreen.y,y.positionScreen.x,y.positionScreen.y,E.positionScreen.x,E.positionScreen.y);if(ya.instersects(ea)){na=0;for(xa=J.meshMaterials.length;na<xa;){ca=J.meshMaterials[na++];if(ca instanceof
+THREE.MeshFaceMaterial){Ea=0;for(Qa=J.faceMaterials.length;Ea<Qa;)(ca=J.faceMaterials[Ea++])&&ca.opacity!=0&&Oa(p,y,E,0,1,2,J,ca,$)}else ca.opacity!=0&&Oa(p,y,E,0,1,2,J,ca,$)}}}else if(J instanceof THREE.RenderableFace4){p=J.v1;y=J.v2;E=J.v3;O=J.v4;p.positionScreen.x*=j;p.positionScreen.y*=h;y.positionScreen.x*=j;y.positionScreen.y*=h;E.positionScreen.x*=j;E.positionScreen.y*=h;O.positionScreen.x*=j;O.positionScreen.y*=h;G.positionScreen.copy(y.positionScreen);r.positionScreen.copy(O.positionScreen);
+if(J.overdraw){wa(p.positionScreen,y.positionScreen);wa(y.positionScreen,O.positionScreen);wa(O.positionScreen,p.positionScreen);wa(E.positionScreen,G.positionScreen);wa(E.positionScreen,r.positionScreen)}ea.addPoint(p.positionScreen.x,p.positionScreen.y);ea.addPoint(y.positionScreen.x,y.positionScreen.y);ea.addPoint(E.positionScreen.x,E.positionScreen.y);ea.addPoint(O.positionScreen.x,O.positionScreen.y);if(ya.instersects(ea)){na=0;for(xa=J.meshMaterials.length;na<xa;){ca=J.meshMaterials[na++];if(ca instanceof
+THREE.MeshFaceMaterial){Ea=0;for(Qa=J.faceMaterials.length;Ea<Qa;)(ca=J.faceMaterials[Ea++])&&ca.opacity!=0&&Ua(p,y,E,O,G,r,J,ca,$)}else ca.opacity!=0&&Ua(p,y,E,O,G,r,J,ca,$)}}}ja.addRectangle(ea)}i.setTransform(1,0,0,1,0,0)}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,e=c.length;for(d=0;d<e;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
-THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=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.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
+THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
+THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
+THREE.RenderableObject=function(){this.z=this.object=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.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};

+ 25 - 24
build/custom/ThreeDOM.js

@@ -12,21 +12,21 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,e){this.set(a||0,b||0,c||0,e||1)};
 THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(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)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,d=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(d=d.concat(this.intersectObject(c)))}d.sort(function(g,f){return g.distance-f.distance});return d},intersectObject:function(a){function b(s,u,C,v){v=v.clone().subSelf(u);C=C.clone().subSelf(u);var o=s.clone().subSelf(u);s=v.dot(v);u=v.dot(C);v=v.dot(o);var I=C.dot(C);C=C.dot(o);o=1/(s*I-u*u);I=(I*v-u*C)*o;s=(s*C-u*v)*o;return I>0&&s>0&&I+s<1}var c,e,d,g,f,i,h,j,m,l,
-n,k=a.geometry,q=k.vertices,p=[];c=0;for(e=k.faces.length;c<e;c++){d=k.faces[c];l=this.origin.clone();n=this.direction.clone();h=a.matrixWorld;g=h.multiplyVector3(q[d.a].position.clone());f=h.multiplyVector3(q[d.b].position.clone());i=h.multiplyVector3(q[d.c].position.clone());h=d instanceof THREE.Face4?h.multiplyVector3(q[d.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(d.normal.clone());m=n.dot(j);if(m<0){j=j.dot((new THREE.Vector3).sub(g,l))/m;l=l.addSelf(n.multiplyScalar(j));
-if(d instanceof THREE.Face3){if(b(l,g,f,i)){d={distance:this.origin.distanceTo(l),point:l,face:d,object:a};p.push(d)}}else if(d instanceof THREE.Face4&&(b(l,g,f,h)||b(l,f,i,h))){d={distance:this.origin.distanceTo(l),point:l,face:d,object:a};p.push(d)}}}return p}};
+THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,d=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(d=d.concat(this.intersectObject(c)))}d.sort(function(g,f){return g.distance-f.distance});return d},intersectObject:function(a){function b(t,r,C,G){G=G.clone().subSelf(r);C=C.clone().subSelf(r);var K=t.clone().subSelf(r);t=G.dot(G);r=G.dot(C);G=G.dot(K);var x=C.dot(C);C=C.dot(K);K=1/(t*x-r*r);x=(x*G-r*C)*K;t=(t*C-r*G)*K;return x>0&&t>0&&x+t<1}var c,e,d,g,f,i,h,j,m,l,
+n,k=a.geometry,p=k.vertices,q=[];c=0;for(e=k.faces.length;c<e;c++){d=k.faces[c];l=this.origin.clone();n=this.direction.clone();h=a.matrixWorld;g=h.multiplyVector3(p[d.a].position.clone());f=h.multiplyVector3(p[d.b].position.clone());i=h.multiplyVector3(p[d.c].position.clone());h=d instanceof THREE.Face4?h.multiplyVector3(p[d.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(d.normal.clone());m=n.dot(j);if(m<0){j=j.dot((new THREE.Vector3).sub(g,l))/m;l=l.addSelf(n.multiplyScalar(j));
+if(d instanceof THREE.Face3){if(b(l,g,f,i)){d={distance:this.origin.distanceTo(l),point:l,face:d,object:a};q.push(d)}}else if(d instanceof THREE.Face4&&(b(l,g,f,h)||b(l,f,i,h))){d={distance:this.origin.distanceTo(l),point:l,face:d,object:a};q.push(d)}}}return q}};
 THREE.Rectangle=function(){function a(){g=e-b;f=d-c}var b,c,e,d,g,f,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return d};this.set=function(h,j,m,l){i=!1;b=h;c=j;e=m;d=l;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;e=h;d=j}else{b=b<h?b:h;c=c<j?c:j;e=e>h?e:h;d=d>j?d:j}a()};
 this.add3Points=function(h,j,m,l,n,k){if(i){i=!1;b=h<m?h<n?h:n:m<n?m:n;c=j<l?j<k?j:k:l<k?l:k;e=h>m?h>n?h:n:m>n?m:n;d=j>l?j>k?j:k:l>k?l:k}else{b=h<m?h<n?h<b?h:b:n<b?n:b:m<n?m<b?m:b:n<b?n:b;c=j<l?j<k?j<c?j:c:k<c?k:c:l<k?l<c?l:c:k<c?k:c;e=h>m?h>n?h>e?h:e:n>e?n:e:m>n?m>e?m:e:n>e?n:e;d=j>l?j>k?j>d?j:d:k>d?k:d:l>k?l>d?l:d:k>d?k:d}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();e=h.getRight();d=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();e=e>h.getRight()?
 e:h.getRight();d=d>h.getBottom()?d:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;e+=h;d+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();e=e<h.getRight()?e:h.getRight();d=d<h.getBottom()?d:h.getBottom();a()};this.instersects=function(h){return Math.min(e,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(d,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;d=e=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,e,d,g,f,i,h,j,m,l,n,k,q,p){this.set(a||1,b||0,c||0,e||0,d||0,g||1,f||0,i||0,h||0,j||0,m||1,l||0,n||0,k||0,q||0,p||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,e,d,g,f,i,h,j,m,l,n,k,q,p){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=d;this.n22=g;this.n23=f;this.n24=i;this.n31=h;this.n32=j;this.n33=m;this.n34=l;this.n41=n;this.n42=k;this.n43=q;this.n44=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,b,c,e,d,g,f,i,h,j,m,l,n,k,p,q){this.set(a||1,b||0,c||0,e||0,d||0,g||1,f||0,i||0,h||0,j||0,m||1,l||0,n||0,k||0,p||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,e,d,g,f,i,h,j,m,l,n,k,p,q){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=d;this.n22=g;this.n23=f;this.n24=i;this.n31=h;this.n32=j;this.n33=m;this.n34=l;this.n41=n;this.n42=k;this.n43=p;this.n44=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
 d=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x+=1.0E-4;e.cross(c,g).normalize()}d.cross(g,e).normalize();this.n11=e.x;this.n12=d.x;this.n13=g.x;this.n21=e.y;this.n22=d.y;this.n23=g.y;this.n31=e.z;this.n32=d.z;this.n33=g.z;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},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},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,d=a.n13,g=a.n14,f=a.n21,i=a.n22,h=a.n23,j=a.n24,m=a.n31,l=a.n32,n=a.n33,k=a.n34,q=a.n41,p=a.n42,s=a.n43,u=a.n44,C=b.n11,v=b.n12,o=b.n13,I=b.n14,F=b.n21,K=b.n22,
-L=b.n23,t=b.n24,r=b.n31,G=b.n32,z=b.n33,D=b.n34;this.n11=c*C+e*F+d*r;this.n12=c*v+e*K+d*G;this.n13=c*o+e*L+d*z;this.n14=c*I+e*t+d*D+g;this.n21=f*C+i*F+h*r;this.n22=f*v+i*K+h*G;this.n23=f*o+i*L+h*z;this.n24=f*I+i*t+h*D+j;this.n31=m*C+l*F+n*r;this.n32=m*v+l*K+n*G;this.n33=m*o+l*L+n*z;this.n34=m*I+l*t+n*D+k;this.n41=q*C+p*F+s*r;this.n42=q*v+p*K+s*G;this.n43=q*o+p*L+s*z;this.n44=q*I+p*t+s*D+u;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
+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,g=a.n14,f=a.n21,i=a.n22,h=a.n23,j=a.n24,m=a.n31,l=a.n32,n=a.n33,k=a.n34,p=a.n41,q=a.n42,t=a.n43,r=a.n44,C=b.n11,G=b.n12,K=b.n13,x=b.n14,o=b.n21,Q=b.n22,
+H=b.n23,N=b.n24,O=b.n31,u=b.n32,s=b.n33,I=b.n34;this.n11=c*C+e*o+d*O;this.n12=c*G+e*Q+d*u;this.n13=c*K+e*H+d*s;this.n14=c*x+e*N+d*I+g;this.n21=f*C+i*o+h*O;this.n22=f*G+i*Q+h*u;this.n23=f*K+i*H+h*s;this.n24=f*x+i*N+h*I+j;this.n31=m*C+l*o+n*O;this.n32=m*G+l*Q+n*u;this.n33=m*K+l*H+n*s;this.n34=m*x+l*N+n*I+k;this.n41=p*C+q*o+t*O;this.n42=p*G+q*Q+t*u;this.n43=p*K+q*H+t*s;this.n44=p*x+q*N+t*I+r;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
 this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,b=this.n12,c=this.n13,e=this.n14,d=this.n21,g=this.n22,f=this.n23,i=this.n24,h=this.n31,j=this.n32,m=this.n33,l=this.n34,n=this.n41,k=this.n42,q=this.n43,p=this.n44;return e*f*j*n-c*i*j*n-e*g*m*n+b*i*m*n+c*g*l*n-b*f*l*n-e*f*h*k+c*i*h*k+e*d*m*k-a*i*m*k-c*d*l*k+a*f*l*k+e*g*h*q-b*i*h*q-e*d*j*q+a*i*j*q+b*d*l*q-a*g*l*q-c*g*h*p+b*f*h*p+c*d*j*p-a*f*j*p-b*d*m*p+a*g*m*p},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
+this.n11,b=this.n12,c=this.n13,e=this.n14,d=this.n21,g=this.n22,f=this.n23,i=this.n24,h=this.n31,j=this.n32,m=this.n33,l=this.n34,n=this.n41,k=this.n42,p=this.n43,q=this.n44;return e*f*j*n-c*i*j*n-e*g*m*n+b*i*m*n+c*g*l*n-b*f*l*n-e*f*h*k+c*i*h*k+e*d*m*k-a*i*m*k-c*d*l*k+a*f*l*k+e*g*h*p-b*i*h*p-e*d*j*p+a*i*j*p+b*d*l*p-a*g*l*p-c*g*h*q+b*f*h*q+c*d*j*q-a*f*j*q-b*d*m*q+a*g*m*q},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
@@ -34,8 +34,8 @@ b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:functio
 g+c,h*f-e*i,h*i+e*f,0,h*f+e*i,j*f+c,j*i-e*g,0,h*i-e*f,j*i+e*g,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 g=Math.cos(e);e=Math.sin(e);var f=a*c,i=b*c;this.n11=d*g;this.n12=-d*e;this.n13=c;this.n21=i*g+a*e;this.n22=-i*e+a*g;this.n23=-b*d;this.n31=-f*g+b*e;this.n32=f*e+b*g;this.n33=a*d;return this},setRotationFromQuaternion:function(a){var b=
 a.x,c=a.y,e=a.z,d=a.w,g=b+b,f=c+c,i=e+e;a=b*g;var h=b*f;b*=i;var j=c*f;c*=i;e*=i;g*=d;f*=d;d*=i;this.n11=1-(j+e);this.n12=h-d;this.n13=b+f;this.n21=h+d;this.n22=1-(a+e);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
 a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,d=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*d;this.n23=a.n23*d;this.n33=a.n33*d}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,d=a.n13,g=a.n14,f=a.n21,i=a.n22,h=a.n23,j=a.n24,m=a.n31,l=a.n32,n=a.n33,k=a.n34,q=a.n41,p=a.n42,s=a.n43,u=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*k*p-j*n*p+j*l*s-i*k*s-h*l*u+i*n*u;b.n12=g*n*p-d*k*p-g*l*s+e*k*s+d*l*u-e*n*u;b.n13=d*j*p-g*h*p+g*i*s-e*j*s-d*i*u+e*h*u;b.n14=g*h*l-d*j*l-g*i*n+e*j*n+d*i*k-e*h*k;b.n21=j*n*q-h*k*q-j*m*s+f*k*s+h*m*u-f*n*u;b.n22=d*k*q-g*n*q+g*m*s-c*k*s-d*m*u+c*n*u;b.n23=g*h*q-d*j*q-g*f*s+c*j*s+d*f*u-c*h*u;
-b.n24=d*j*m-g*h*m+g*f*n-c*j*n-d*f*k+c*h*k;b.n31=i*k*q-j*l*q+j*m*p-f*k*p-i*m*u+f*l*u;b.n32=g*l*q-e*k*q-g*m*p+c*k*p+e*m*u-c*l*u;b.n33=d*j*q-g*i*q+g*f*p-c*j*p-e*f*u+c*i*u;b.n34=g*i*m-e*j*m-g*f*l+c*j*l+e*f*k-c*i*k;b.n41=h*l*q-i*n*q-h*m*p+f*n*p+i*m*s-f*l*s;b.n42=e*n*q-d*l*q+d*m*p-c*n*p-e*m*s+c*l*s;b.n43=d*i*q-e*h*q-d*f*p+c*h*p+e*f*s-c*i*s;b.n44=e*h*m-d*i*m+d*f*l-c*h*l-e*f*n+c*i*n;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,d=a.n13,g=a.n14,f=a.n21,i=a.n22,h=a.n23,j=a.n24,m=a.n31,l=a.n32,n=a.n33,k=a.n34,p=a.n41,q=a.n42,t=a.n43,r=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*k*q-j*n*q+j*l*t-i*k*t-h*l*r+i*n*r;b.n12=g*n*q-d*k*q-g*l*t+e*k*t+d*l*r-e*n*r;b.n13=d*j*q-g*h*q+g*i*t-e*j*t-d*i*r+e*h*r;b.n14=g*h*l-d*j*l-g*i*n+e*j*n+d*i*k-e*h*k;b.n21=j*n*p-h*k*p-j*m*t+f*k*t+h*m*r-f*n*r;b.n22=d*k*p-g*n*p+g*m*t-c*k*t-d*m*r+c*n*r;b.n23=g*h*p-d*j*p-g*f*t+c*j*t+d*f*r-c*h*r;
+b.n24=d*j*m-g*h*m+g*f*n-c*j*n-d*f*k+c*h*k;b.n31=i*k*p-j*l*p+j*m*q-f*k*q-i*m*r+f*l*r;b.n32=g*l*p-e*k*p-g*m*q+c*k*q+e*m*r-c*l*r;b.n33=d*j*p-g*i*p+g*f*q-c*j*q-e*f*r+c*i*r;b.n34=g*i*m-e*j*m-g*f*l+c*j*l+e*f*k-c*i*k;b.n41=h*l*p-i*n*p-h*m*q+f*n*q+i*m*t-f*l*t;b.n42=e*n*p-d*l*p+d*m*q-c*n*q-e*m*t+c*l*t;b.n43=d*i*p-e*h*p-d*f*q+c*h*q+e*f*t-c*i*t;b.n44=e*h*m-d*i*m+d*f*l-c*h*l-e*f*n+c*i*n;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,g=a.n32*a.n21-a.n31*a.n22,f=-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,l=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*f+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*d;c[2]=a*g;c[3]=a*f;c[4]=a*i;c[5]=a*h;c[6]=a*j;c[7]=a*m;c[8]=a*l;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,e,d,g){var f;f=new THREE.Matrix4;f.n11=2*d/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*d/(e-c);f.n23=(e+c)/(e-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+d)/(g-d);f.n34=-2*g*d/(g-d);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};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,g){var f,i,h,j;f=new THREE.Matrix4;i=b-a;h=c-e;j=g-d;f.n11=2/i;f.n12=0;f.n13=0;f.n14=-((b+a)/i);f.n21=0;f.n22=2/h;f.n23=0;f.n24=-((c+e)/h);f.n31=0;f.n32=0;f.n33=-2/j;f.n34=-((g+d)/j);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var g=Math.cos(c);c=Math.sin(c);var f=a*b,i=e*d;this.w=f*g-i*c;this.x=f*c+i*g;this.y=e*b*g+a*d*c;this.z=a*d*g-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,g=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+d*g+c*i-e*f;this.y=c*a+d*f+e*g-b*i;this.z=e*a+d*i+b*f-c*g;this.w=d*a-b*g-c*f-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,g=this.x,f=this.y,i=this.z,h=this.w,j=h*c+f*d-i*e,m=h*e+i*c-g*d,l=h*d+g*e-f*c;c=-g*c-f*e-i*d;b.x=j*h+c*-g+m*-i-l*-f;b.y=m*h+c*-f+l*-g-j*-i;b.z=l*h+c*-i+j*-f-m*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
 THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(d){for(var g=0;g<a.length;g++)a[g].update(d)};c.addToUpdate=function(d){a.indexOf(d)===-1&&a.push(d)};c.removeFromUpdate=function(d){d=a.indexOf(d);d!==-1&&a.splice(d,1)};c.add=function(d){b[d.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+d.name+" already exists in library. Overwriting.");b[d.name]=d;if(d.initialized!==!0){for(var g=0;g<d.hierarchy.length;g++){for(var f=0;f<d.hierarchy[g].keys.length;f++){if(d.hierarchy[g].keys[f].time<
@@ -60,8 +60,8 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
 d instanceof THREE.Bone?d.skinMatrix:d.matrix}var g=d.animationCache.prevKey;d=d.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];d.pos=this.getNextKeyWith("pos",c,1);d.rot=this.getNextKeyWith("rot",c,1);d.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,d,g,f,i,h,j,m=this.data.JIT.hierarchy,l,n;this.currentTime+=a*this.timeScale;n=this.currentTime;l=this.currentTime%=this.data.length;j=parseInt(Math.min(l*this.data.fps,this.data.length*this.data.fps),10);for(var k=0,q=this.hierarchy.length;k<q;k++){a=this.hierarchy[k];h=a.animationCache;if(this.JITCompile&&m[k][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=m[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=m[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var p=0;p<3;p++){c=b[p];f=h.prevKey[c];i=h.nextKey[c];if(i.time<=n){if(l<n)if(this.loop){f=this.data.hierarchy[k].keys[0];for(i=this.getNextKeyWith(c,k,1);i.time<l;){f=i;i=this.getNextKeyWith(c,k,i.index+1)}}else{this.stop();return}else{do{f=i;i=this.getNextKeyWith(c,k,i.index+1)}while(i.time<
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,d,g,f,i,h,j,m=this.data.JIT.hierarchy,l,n;this.currentTime+=a*this.timeScale;n=this.currentTime;l=this.currentTime%=this.data.length;j=parseInt(Math.min(l*this.data.fps,this.data.length*this.data.fps),10);for(var k=0,p=this.hierarchy.length;k<p;k++){a=this.hierarchy[k];h=a.animationCache;if(this.JITCompile&&m[k][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=m[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=m[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var q=0;q<3;q++){c=b[q];f=h.prevKey[c];i=h.nextKey[c];if(i.time<=n){if(l<n)if(this.loop){f=this.data.hierarchy[k].keys[0];for(i=this.getNextKeyWith(c,k,1);i.time<l;){f=i;i=this.getNextKeyWith(c,k,i.index+1)}}else{this.stop();return}else{do{f=i;i=this.getNextKeyWith(c,k,i.index+1)}while(i.time<
 l)}h.prevKey[c]=f;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(l-f.time)/(i.time-f.time);d=f[c];g=i[c];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+k);e=e<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=d[0]+(g[0]-d[0])*e;c.y=d[1]+(g[1]-d[1])*e;c.z=d[2]+(g[2]-d[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
 this.getPrevKeyWith("pos",k,f.index-1).pos;this.points[1]=d;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",k,i.index+1).pos;e=e*0.33+0.33;d=this.interpolateCatmullRom(this.points,e);c.x=d[0];c.y=d[1];c.z=d[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(c===
 "rot")THREE.Quaternion.slerp(d,g,a.quaternion,e);else if(c==="scl"){c=a.scale;c.x=d[0]+(g[0]-d[0])*e;c.y=d[1]+(g[1]-d[1])*e;c.z=d[2]+(g[2]-d[2])*e}}}}if(this.JITCompile&&m[0][j]===undefined){this.hierarchy[0].update(undefined,!0);for(k=0;k<this.hierarchy.length;k++)m[k][j]=this.hierarchy[k]instanceof THREE.Bone?this.hierarchy[k].skinMatrix.clone():this.hierarchy[k].matrix.clone()}}};
@@ -84,16 +84,17 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.f
 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.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}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.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}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(){var t=h[i]=h[i]||new THREE.RenderableVertex;i++;return t}function b(t,r){return r.z-t.z}function c(t,r){var G=0,z=1,D=t.z+t.w,E=r.z+r.w,w=-t.z+t.w,A=-r.z+r.w;if(D>=0&&E>=0&&w>=0&&A>=0)return!0;else if(D<0&&E<0||w<0&&A<0)return!1;else{if(D<0)G=Math.max(G,D/(D-E));else E<0&&(z=Math.min(z,D/(D-E)));if(w<0)G=Math.max(G,w/(w-A));else A<0&&(z=Math.min(z,w/(w-A)));if(z<G)return!1;else{t.lerpSelf(r,G);r.lerpSelf(t,1-z);return!0}}}var e,d,g=[],f,i,h=[],j,m,l=[],n,k,
-q=[],p,s,u=[],C=new THREE.Vector4,v=new THREE.Vector4,o=new THREE.Matrix4,I=new THREE.Matrix4,F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],K=new THREE.Vector4,L=new THREE.Vector4;this.projectVector=function(t,r){o.multiply(r.projectionMatrix,r.matrixWorldInverse);o.multiplyVector3(t);return t};this.unprojectVector=function(t,r){o.multiply(THREE.Matrix4.makeInvert(r.projectionMatrix),r.matrixWorld);o.multiplyVector3(t);return t};this.projectObjects=
-function(t,r,G){r=[];var z,D,E;d=0;D=t.objects;t=0;for(z=D.length;t<z;t++){E=D[t];var w;if(!(w=!E.visible))if(w=E instanceof THREE.Mesh){a:{w=void 0;for(var A=E.matrixWorld,H=-E.geometry.boundingSphere.radius*Math.max(E.scale.x,Math.max(E.scale.y,E.scale.z)),B=0;B<6;B++){w=F[B].x*A.n14+F[B].y*A.n24+F[B].z*A.n34+F[B].w;if(w<=H){w=!1;break a}}w=!0}w=!w}if(!w){w=g[d]=g[d]||new THREE.RenderableObject;d++;e=w;C.copy(E.position);o.multiplyVector3(C);e.object=E;e.z=C.z;r.push(e)}}G&&r.sort(b);return r};
-this.projectScene=function(t,r,G){var z=[],D=r.near,E=r.far,w,A,H,B,x,M,J,P,N,y,O,R,U,V,Q,S,T;s=k=m=0;r.matrixAutoUpdate&&r.updateMatrix();t.update(undefined,!1,r);o.multiply(r.projectionMatrix,r.matrixWorldInverse);F[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);F[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);F[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);F[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);F[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);
-F[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(w=0;w<6;w++){N=F[w];N.divideScalar(Math.sqrt(N.x*N.x+N.y*N.y+N.z*N.z))}N=this.projectObjects(t,r,!0);t=0;for(w=N.length;t<w;t++){y=N[t].object;if(y.visible){O=y.matrixWorld;R=y.matrixRotationWorld;U=y.materials;V=y.overdraw;i=0;if(y instanceof THREE.Mesh){Q=y.geometry;B=Q.vertices;S=Q.faces;Q=Q.faceVertexUvs;A=0;for(H=B.length;A<H;A++){f=a();f.positionWorld.copy(B[A].position);O.multiplyVector3(f.positionWorld);f.positionScreen.copy(f.positionWorld);
-o.multiplyVector4(f.positionScreen);f.positionScreen.x/=f.positionScreen.w;f.positionScreen.y/=f.positionScreen.w;f.visible=f.positionScreen.z>D&&f.positionScreen.z<E}B=0;for(A=S.length;B<A;B++){H=S[B];if(H instanceof THREE.Face3){x=h[H.a];M=h[H.b];J=h[H.c];if(x.visible&&M.visible&&J.visible&&(y.doubleSided||y.flipSided!=(J.positionScreen.x-x.positionScreen.x)*(M.positionScreen.y-x.positionScreen.y)-(J.positionScreen.y-x.positionScreen.y)*(M.positionScreen.x-x.positionScreen.x)<0)){P=l[m]=l[m]||new THREE.RenderableFace3;
-m++;j=P;j.v1.copy(x);j.v2.copy(M);j.v3.copy(J);j.normalWorld.copy(H.normal);R.multiplyVector3(j.normalWorld);j.centroidWorld.copy(H.centroid);O.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);o.multiplyVector3(j.centroidScreen);J=H.vertexNormals;x=0;for(M=J.length;x<M;x++){P=j.vertexNormalsWorld[x];P.copy(J[x]);R.multiplyVector3(P)}x=0;for(M=Q.length;x<M;x++)if(T=Q[x][B]){J=0;for(P=T.length;J<P;J++)j.uvs[x][J]=T[J]}j.meshMaterials=U;j.faceMaterials=H.materials;j.overdraw=V;
-j.z=j.centroidScreen.z;z.push(j)}}}}else if(y instanceof THREE.Line){I.multiply(o,O);B=y.geometry.vertices;x=a();x.positionScreen.copy(B[0].position);I.multiplyVector4(x.positionScreen);A=1;for(H=B.length;A<H;A++){x=a();x.positionScreen.copy(B[A].position);I.multiplyVector4(x.positionScreen);M=h[i-2];K.copy(x.positionScreen);L.copy(M.positionScreen);if(c(K,L)){K.multiplyScalar(1/K.w);L.multiplyScalar(1/L.w);O=q[k]=q[k]||new THREE.RenderableLine;k++;n=O;n.v1.positionScreen.copy(K);n.v2.positionScreen.copy(L);
-n.z=Math.max(K.z,L.z);n.materials=y.materials;z.push(n)}}}else if(y instanceof THREE.Particle){v.set(y.position.x,y.position.y,y.position.z,1);o.multiplyVector4(v);v.z/=v.w;if(v.z>0&&v.z<1){O=u[s]=u[s]||new THREE.RenderableParticle;s++;p=O;p.x=v.x/v.w;p.y=v.y/v.w;p.z=v.z;p.rotation=y.rotation.z;p.scale.x=y.scale.x*Math.abs(p.x-(v.x+r.projectionMatrix.n11)/(v.w+r.projectionMatrix.n14));p.scale.y=y.scale.y*Math.abs(p.y-(v.y+r.projectionMatrix.n22)/(v.w+r.projectionMatrix.n24));p.materials=y.materials;
-z.push(p)}}}}G&&z.sort(b);return z}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,d,g;this.domElement=document.createElement("div");this.setSize=function(f,i){c=f;e=i;d=c/2;g=e/2};this.render=function(f,i){var h,j,m,l,n,k,q,p;a=b.projectScene(f,i);h=0;for(j=a.length;h<j;h++){n=a[h];if(n instanceof THREE.RenderableParticle){q=n.x*d+d;p=n.y*g+g;m=0;for(l=n.material.length;m<l;m++){k=n.material[m];if(k instanceof THREE.ParticleDOMMaterial){k=k.domElement;k.style.left=q+"px";k.style.top=p+"px"}}}}}};
+THREE.Projector=function(){function a(){var u=h[i]=h[i]||new THREE.RenderableVertex;i++;return u}function b(u,s){return s.z-u.z}function c(u,s){var I=0,J=1,M=u.z+u.w,E=s.z+s.w,w=-u.z+u.w,z=-s.z+s.w;if(M>=0&&E>=0&&w>=0&&z>=0)return!0;else if(M<0&&E<0||w<0&&z<0)return!1;else{if(M<0)I=Math.max(I,M/(M-E));else E<0&&(J=Math.min(J,M/(M-E)));if(w<0)I=Math.max(I,w/(w-z));else z<0&&(J=Math.min(J,w/(w-z)));if(J<I)return!1;else{u.lerpSelf(s,I);s.lerpSelf(u,1-J);return!0}}}var e,d,g=[],f,i,h=[],j,m,l=[],n,k=
+[],p,q,t=[],r,C,G=[],K=new THREE.Vector4,x=new THREE.Vector4,o=new THREE.Matrix4,Q=new THREE.Matrix4,H=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(u,s){o.multiply(s.projectionMatrix,s.matrixWorldInverse);o.multiplyVector3(u);return u};this.unprojectVector=function(u,s){o.multiply(s.matrixWorld,THREE.Matrix4.makeInvert(s.projectionMatrix));o.multiplyVector3(u);return u};
+this.projectObjects=function(u,s,I){s=[];var J,M,E;d=0;M=u.objects;u=0;for(J=M.length;u<J;u++){E=M[u];var w;if(!(w=!E.visible))if(w=E instanceof THREE.Mesh){a:{w=void 0;for(var z=E.matrixWorld,A=-E.geometry.boundingSphere.radius*Math.max(E.scale.x,Math.max(E.scale.y,E.scale.z)),D=0;D<6;D++){w=H[D].x*z.n14+H[D].y*z.n24+H[D].z*z.n34+H[D].w;if(w<=A){w=!1;break a}}w=!0}w=!w}if(!w){w=g[d]=g[d]||new THREE.RenderableObject;d++;e=w;K.copy(E.position);o.multiplyVector3(K);e.object=E;e.z=K.z;s.push(e)}}I&&
+s.sort(b);return s};this.projectScene=function(u,s,I){var J=[],M=s.near,E=s.far,w,z,A,D,v,F,B,L,P,y,R,U,W,X,S,V,T;C=q=n=m=0;s.matrixAutoUpdate&&s.updateMatrix();u.update(undefined,!1,s);o.multiply(s.projectionMatrix,s.matrixWorldInverse);H[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);H[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);H[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);H[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);H[4].set(o.n41-o.n31,o.n42-o.n32,
+o.n43-o.n33,o.n44-o.n34);H[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(w=0;w<6;w++){P=H[w];P.divideScalar(Math.sqrt(P.x*P.x+P.y*P.y+P.z*P.z))}P=this.projectObjects(u,s,!0);u=0;for(w=P.length;u<w;u++){y=P[u].object;if(y.visible){R=y.matrixWorld;U=y.matrixRotationWorld;W=y.materials;X=y.overdraw;i=0;if(y instanceof THREE.Mesh){S=y.geometry;D=S.vertices;V=S.faces;S=S.faceVertexUvs;z=0;for(A=D.length;z<A;z++){f=a();f.positionWorld.copy(D[z].position);R.multiplyVector3(f.positionWorld);
+f.positionScreen.copy(f.positionWorld);o.multiplyVector4(f.positionScreen);f.positionScreen.x/=f.positionScreen.w;f.positionScreen.y/=f.positionScreen.w;f.visible=f.positionScreen.z>M&&f.positionScreen.z<E}D=0;for(z=V.length;D<z;D++){A=V[D];if(A instanceof THREE.Face3){v=h[A.a];F=h[A.b];B=h[A.c];if(v.visible&&F.visible&&B.visible&&(y.doubleSided||y.flipSided!=(B.positionScreen.x-v.positionScreen.x)*(F.positionScreen.y-v.positionScreen.y)-(B.positionScreen.y-v.positionScreen.y)*(F.positionScreen.x-
+v.positionScreen.x)<0)){L=l[m]=l[m]||new THREE.RenderableFace3;m++;j=L;j.v1.copy(v);j.v2.copy(F);j.v3.copy(B)}else continue}else if(A instanceof THREE.Face4){v=h[A.a];F=h[A.b];B=h[A.c];L=h[A.d];if(v.visible&&F.visible&&B.visible&&L.visible&&(y.doubleSided||y.flipSided!=((L.positionScreen.x-v.positionScreen.x)*(F.positionScreen.y-v.positionScreen.y)-(L.positionScreen.y-v.positionScreen.y)*(F.positionScreen.x-v.positionScreen.x)<0||(F.positionScreen.x-B.positionScreen.x)*(L.positionScreen.y-B.positionScreen.y)-
+(F.positionScreen.y-B.positionScreen.y)*(L.positionScreen.x-B.positionScreen.x)<0))){T=k[n]=k[n]||new THREE.RenderableFace4;n++;j=T;j.v1.copy(v);j.v2.copy(F);j.v3.copy(B);j.v4.copy(L)}else continue}j.normalWorld.copy(A.normal);U.multiplyVector3(j.normalWorld);j.centroidWorld.copy(A.centroid);R.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);o.multiplyVector3(j.centroidScreen);B=A.vertexNormals;v=0;for(F=B.length;v<F;v++){L=j.vertexNormalsWorld[v];L.copy(B[v]);U.multiplyVector3(L)}v=
+0;for(F=S.length;v<F;v++)if(T=S[v][D]){B=0;for(L=T.length;B<L;B++)j.uvs[v][B]=T[B]}j.meshMaterials=W;j.faceMaterials=A.materials;j.overdraw=X;j.z=j.centroidScreen.z;J.push(j)}}else if(y instanceof THREE.Line){Q.multiply(o,R);D=y.geometry.vertices;v=a();v.positionScreen.copy(D[0].position);Q.multiplyVector4(v.positionScreen);z=1;for(A=D.length;z<A;z++){v=a();v.positionScreen.copy(D[z].position);Q.multiplyVector4(v.positionScreen);F=h[i-2];N.copy(v.positionScreen);O.copy(F.positionScreen);if(c(N,O)){N.multiplyScalar(1/
+N.w);O.multiplyScalar(1/O.w);R=t[q]=t[q]||new THREE.RenderableLine;q++;p=R;p.v1.positionScreen.copy(N);p.v2.positionScreen.copy(O);p.z=Math.max(N.z,O.z);p.materials=y.materials;J.push(p)}}}else if(y instanceof THREE.Particle){x.set(y.position.x,y.position.y,y.position.z,1);o.multiplyVector4(x);x.z/=x.w;if(x.z>0&&x.z<1){R=G[C]=G[C]||new THREE.RenderableParticle;C++;r=R;r.x=x.x/x.w;r.y=x.y/x.w;r.z=x.z;r.rotation=y.rotation.z;r.scale.x=y.scale.x*Math.abs(r.x-(x.x+s.projectionMatrix.n11)/(x.w+s.projectionMatrix.n14));
+r.scale.y=y.scale.y*Math.abs(r.y-(x.y+s.projectionMatrix.n22)/(x.w+s.projectionMatrix.n24));r.materials=y.materials;J.push(r)}}}}I&&J.sort(b);return J}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,d,g;this.domElement=document.createElement("div");this.setSize=function(f,i){c=f;e=i;d=c/2;g=e/2};this.render=function(f,i){var h,j,m,l,n,k,p,q;a=b.projectScene(f,i);h=0;for(j=a.length;h<j;h++){n=a[h];if(n instanceof THREE.RenderableParticle){p=n.x*d+d;q=n.y*g+g;m=0;for(l=n.material.length;m<l;m++){k=n.material[m];if(k instanceof THREE.ParticleDOMMaterial){k=k.domElement;k.style.left=p+"px";k.style.top=q+"px"}}}}}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var e,d=c.length;for(e=0;e<d;e++){a=c[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};

+ 3 - 3
build/custom/ThreeExtras.js

@@ -23,7 +23,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var e,b,c,g,f=2*Math.ceil(a*3)+1;f>25&&(f=25);g=(f-1)*0.5;b=Array(f);for(e=c=0;e<f;++e){b[e]=Math.exp(-((e-g)*(e-g))/(2*a*a));c+=b[e]}for(e=0;e<f;++e)b[e]/=c;return b}};
-THREE.QuakeCamera=function(a){function e(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
+THREE.QuakeCamera=function(a){function e(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
 a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
 this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=
 !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
@@ -33,7 +33,7 @@ var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mo
 THREE.QuakeCamera.prototype.translate=function(a,e){this.matrix.rotateAxis(e);if(this.noFly)e.y=0;this.position.addSelf(e.multiplyScalar(a));this.target.position.addSelf(e.multiplyScalar(a))};
 THREE.PathCamera=function(a){function e(l,k,o,q){var m={name:o,fps:0.6,length:q,hierarchy:[]},t,B=k.getControlPointsArray(),z=k.getLength(),x=B.length,y=0;t=x-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:B[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[t]={time:q,pos:B[t],rot:[0,0,0,1],scl:[1,1,1]};for(t=1;t<x-1;t++){y=q*z.chunks[t]/z.total;k.keys[t]={time:y,pos:B[t]}}m.hierarchy[0]=k;THREE.AnimationHandler.add(m);return new THREE.Animation(l,o,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(l,k){var o,
 q,m=new THREE.Geometry;for(o=0;o<l.points.length*k;o++){q=o/(l.points.length*k);q=l.getPoint(q);m.vertices[o]=new THREE.Vertex(new THREE.Vector3(q.x,q.y,q.z))}return m}function c(l,k){var o=b(k,10),q=b(k,10),m=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(o,m);particleObj=new THREE.ParticleSystem(q,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);l.addChild(lineObj);particleObj.scale.set(1,1,1);l.addChild(particleObj);q=new Sphere(1,
-16,8);m=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){o=new THREE.Mesh(q,m);o.position.copy(k.points[i]);o.updateMatrix();l.addChild(o)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
+16,8);m=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){o=new THREE.Mesh(q,m);o.position.copy(k.points[i]);o.updateMatrix();l.addChild(o)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=
 !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
 this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,f=Math.PI/180;this.update=function(l,k,o){var q,m;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*f;this.theta=this.lon*f;q=this.phi%g;this.phi=q>=0?q:q+g;q=this.verticalAngleMap.srcRange;m=this.verticalAngleMap.dstRange;
@@ -49,7 +49,7 @@ for(c=a+a/2;c<2*a;c++)h.faces.push(new THREE.Face4(2*a+1,(2*c-2*a+2)%a+a,(2*c-2*
 var Icosahedron=function(a){function e(o,q,m){var t=Math.sqrt(o*o+q*q+m*m);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(o/t,q/t,m/t)))-1}function b(o,q,m,t){t.faces.push(new THREE.Face3(o,q,m))}function c(o,q){var m=g.vertices[o].position,t=g.vertices[q].position;return e((m.x+t.x)/2,(m.y+t.y)/2,(m.z+t.z)/2)}var g=this,f=new THREE.Geometry,d;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;e(-1,a,0);e(1,a,0);e(-1,-a,0);e(1,-a,0);e(0,-1,a);e(0,1,a);e(0,-1,-a);e(0,
 1,-a);e(a,0,-1);e(a,0,1);e(-a,0,-1);e(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(a=0;a<this.subdivisions;a++){d=new THREE.Geometry;for(var h in f.faces){var j=c(f.faces[h].a,f.faces[h].b),l=c(f.faces[h].b,f.faces[h].c),k=c(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,j,k,d);b(f.faces[h].b,l,j,d);b(f.faces[h].c,
 k,l,d);b(j,l,k,d)}f.faces=d.faces}g.faces=f.faces;delete f;delete d;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(a,e,b){THREE.Geometry.call(this);this.steps=e||12;this.angle=b||2*Math.PI;e=this.angle/this.steps;for(var c=[],g=[],f=[],d=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));c[h]=a[h].clone();g[h]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(e),l=0;l<=this.angle+0.0010;l+=e){for(h=0;h<c.length;h++)if(l<this.angle){c[h]=j.multiplyVector3(c[h].clone());this.vertices.push(new THREE.Vertex(c[h]));f[h]=this.vertices.length-1}else f=d;l==0&&(d=g);for(h=
+function Lathe(a,e,b){THREE.Geometry.call(this);this.steps=e||12;this.angle=b||2*Math.PI;e=this.angle/this.steps;for(var c=[],g=[],f=[],d=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));c[h]=a[h].clone();g[h]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(e),l=0;l<=this.angle+0.001;l+=e){for(h=0;h<c.length;h++)if(l<this.angle){c[h]=j.multiplyVector3(c[h].clone());this.vertices.push(new THREE.Vertex(c[h]));f[h]=this.vertices.length-1}else f=d;l==0&&(d=g);for(h=
 0;h<g.length-1;h++){this.faces.push(new THREE.Face4(f[h],f[h+1],g[h+1],g[h]));this.faceVertexUvs[0].push([new THREE.UV(l/b,h/a.length),new THREE.UV(l/b,(h+1)/a.length),new THREE.UV((l-e)/b,(h+1)/a.length),new THREE.UV((l-e)/b,h/a.length)])}g=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
 var Plane=function(a,e,b,c){THREE.Geometry.call(this);var g,f=a/2,d=e/2;b=b||1;c=c||1;var h=b+1,j=c+1;a/=b;var l=e/c;for(g=0;g<j;g++)for(e=0;e<h;e++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(e*a-f,-(g*l-d),0)));for(g=0;g<c;g++)for(e=0;e<b;e++){this.faces.push(new THREE.Face4(e+h*g,e+h*(g+1),e+1+h*(g+1),e+1+h*g));this.faceVertexUvs[0].push([new THREE.UV(e/b,g/c),new THREE.UV(e/b,(g+1)/c),new THREE.UV((e+1)/b,(g+1)/c),new THREE.UV((e+1)/b,g/c)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;

+ 51 - 50
build/custom/ThreeSVG.js

@@ -12,21 +12,21 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,e){this.set(a||0,b||0,c||0,e||1)};
 THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(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)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,d=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(d=d.concat(this.intersectObject(c)))}d.sort(function(f,g){return f.distance-g.distance});return d},intersectObject:function(a){function b(z,u,I,q){q=q.clone().subSelf(u);I=I.clone().subSelf(u);var n=z.clone().subSelf(u);z=q.dot(q);u=q.dot(I);q=q.dot(n);var D=I.dot(I);I=I.dot(n);n=1/(z*D-u*u);D=(D*q-u*I)*n;z=(z*I-u*q)*n;return D>0&&z>0&&D+z<1}var c,e,d,f,g,i,h,j,o,m,
-l,k=a.geometry,s=k.vertices,p=[];c=0;for(e=k.faces.length;c<e;c++){d=k.faces[c];m=this.origin.clone();l=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(s[d.a].position.clone());g=h.multiplyVector3(s[d.b].position.clone());i=h.multiplyVector3(s[d.c].position.clone());h=d instanceof THREE.Face4?h.multiplyVector3(s[d.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(d.normal.clone());o=l.dot(j);if(o<0){j=j.dot((new THREE.Vector3).sub(f,m))/o;m=m.addSelf(l.multiplyScalar(j));
-if(d instanceof THREE.Face3){if(b(m,f,g,i)){d={distance:this.origin.distanceTo(m),point:m,face:d,object:a};p.push(d)}}else if(d instanceof THREE.Face4&&(b(m,f,g,h)||b(m,g,i,h))){d={distance:this.origin.distanceTo(m),point:m,face:d,object:a};p.push(d)}}}return p}};
-THREE.Rectangle=function(){function a(){f=e-b;g=d-c}var b,c,e,d,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return d};this.set=function(h,j,o,m){i=!1;b=h;c=j;e=o;d=m;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;e=h;d=j}else{b=b<h?b:h;c=c<j?c:j;e=e>h?e:h;d=d>j?d:j}a()};
-this.add3Points=function(h,j,o,m,l,k){if(i){i=!1;b=h<o?h<l?h:l:o<l?o:l;c=j<m?j<k?j:k:m<k?m:k;e=h>o?h>l?h:l:o>l?o:l;d=j>m?j>k?j:k:m>k?m:k}else{b=h<o?h<l?h<b?h:b:l<b?l:b:o<l?o<b?o:b:l<b?l:b;c=j<m?j<k?j<c?j:c:k<c?k:c:m<k?m<c?m:c:k<c?k:c;e=h>o?h>l?h>e?h:e:l>e?l:e:o>l?o>e?o:e:l>e?l:e;d=j>m?j>k?j>d?j:d:k>d?k:d:m>k?m>d?m:d:k>d?k:d}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();e=h.getRight();d=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();e=e>h.getRight()?
+THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,d=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(d=d.concat(this.intersectObject(c)))}d.sort(function(f,g){return f.distance-g.distance});return d},intersectObject:function(a){function b(A,s,I,x){x=x.clone().subSelf(s);I=I.clone().subSelf(s);var G=A.clone().subSelf(s);A=x.dot(x);s=x.dot(I);x=x.dot(G);var y=I.dot(I);I=I.dot(G);G=1/(A*y-s*s);y=(y*x-s*I)*G;A=(A*I-s*x)*G;return y>0&&A>0&&y+A<1}var c,e,d,f,g,i,h,j,n,l,
+m,k=a.geometry,q=k.vertices,t=[];c=0;for(e=k.faces.length;c<e;c++){d=k.faces[c];l=this.origin.clone();m=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(q[d.a].position.clone());g=h.multiplyVector3(q[d.b].position.clone());i=h.multiplyVector3(q[d.c].position.clone());h=d instanceof THREE.Face4?h.multiplyVector3(q[d.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(d.normal.clone());n=m.dot(j);if(n<0){j=j.dot((new THREE.Vector3).sub(f,l))/n;l=l.addSelf(m.multiplyScalar(j));
+if(d instanceof THREE.Face3){if(b(l,f,g,i)){d={distance:this.origin.distanceTo(l),point:l,face:d,object:a};t.push(d)}}else if(d instanceof THREE.Face4&&(b(l,f,g,h)||b(l,g,i,h))){d={distance:this.origin.distanceTo(l),point:l,face:d,object:a};t.push(d)}}}return t}};
+THREE.Rectangle=function(){function a(){f=e-b;g=d-c}var b,c,e,d,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return d};this.set=function(h,j,n,l){i=!1;b=h;c=j;e=n;d=l;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;e=h;d=j}else{b=b<h?b:h;c=c<j?c:j;e=e>h?e:h;d=d>j?d:j}a()};
+this.add3Points=function(h,j,n,l,m,k){if(i){i=!1;b=h<n?h<m?h:m:n<m?n:m;c=j<l?j<k?j:k:l<k?l:k;e=h>n?h>m?h:m:n>m?n:m;d=j>l?j>k?j:k:l>k?l:k}else{b=h<n?h<m?h<b?h:b:m<b?m:b:n<m?n<b?n:b:m<b?m:b;c=j<l?j<k?j<c?j:c:k<c?k:c:l<k?l<c?l:c:k<c?k:c;e=h>n?h>m?h>e?h:e:m>e?m:e:n>m?n>e?n:e:m>e?m:e;d=j>l?j>k?j>d?j:d:k>d?k:d:l>k?l>d?l:d:k>d?k:d}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();e=h.getRight();d=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();e=e>h.getRight()?
 e:h.getRight();d=d>h.getBottom()?d:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;e+=h;d+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();e=e<h.getRight()?e:h.getRight();d=d<h.getBottom()?d:h.getBottom();a()};this.instersects=function(h){return Math.min(e,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(d,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;d=e=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,e,d,f,g,i,h,j,o,m,l,k,s,p){this.set(a||1,b||0,c||0,e||0,d||0,f||1,g||0,i||0,h||0,j||0,o||1,m||0,l||0,k||0,s||0,p||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,e,d,f,g,i,h,j,o,m,l,k,s,p){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=d;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=j;this.n33=o;this.n34=m;this.n41=l;this.n42=k;this.n43=s;this.n44=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,b,c,e,d,f,g,i,h,j,n,l,m,k,q,t){this.set(a||1,b||0,c||0,e||0,d||0,f||1,g||0,i||0,h||0,j||0,n||1,l||0,m||0,k||0,q||0,t||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,e,d,f,g,i,h,j,n,l,m,k,q,t){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=d;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=j;this.n33=n;this.n34=l;this.n41=m;this.n42=k;this.n43=q;this.n44=t;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
 d=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;e.cross(c,f).normalize();if(e.length()===0){f.x+=1.0E-4;e.cross(c,f).normalize()}d.cross(f,e).normalize();this.n11=e.x;this.n12=d.x;this.n13=f.x;this.n21=e.y;this.n22=d.y;this.n23=f.y;this.n31=e.z;this.n32=d.z;this.n33=f.z;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},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},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,m=a.n32,l=a.n33,k=a.n34,s=a.n41,p=a.n42,z=a.n43,u=a.n44,I=b.n11,q=b.n12,n=b.n13,D=b.n14,H=b.n21,N=b.n22,
-O=b.n23,A=b.n24,w=b.n31,P=b.n32,J=b.n33,y=b.n34;this.n11=c*I+e*H+d*w;this.n12=c*q+e*N+d*P;this.n13=c*n+e*O+d*J;this.n14=c*D+e*A+d*y+f;this.n21=g*I+i*H+h*w;this.n22=g*q+i*N+h*P;this.n23=g*n+i*O+h*J;this.n24=g*D+i*A+h*y+j;this.n31=o*I+m*H+l*w;this.n32=o*q+m*N+l*P;this.n33=o*n+m*O+l*J;this.n34=o*D+m*A+l*y+k;this.n41=s*I+p*H+z*w;this.n42=s*q+p*N+z*P;this.n43=s*n+p*O+z*J;this.n44=s*D+p*A+z*y+u;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
+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,n=a.n31,l=a.n32,m=a.n33,k=a.n34,q=a.n41,t=a.n42,A=a.n43,s=a.n44,I=b.n11,x=b.n12,G=b.n13,y=b.n14,p=b.n21,Q=b.n22,
+H=b.n23,P=b.n24,M=b.n31,C=b.n32,u=b.n33,L=b.n34;this.n11=c*I+e*p+d*M;this.n12=c*x+e*Q+d*C;this.n13=c*G+e*H+d*u;this.n14=c*y+e*P+d*L+f;this.n21=g*I+i*p+h*M;this.n22=g*x+i*Q+h*C;this.n23=g*G+i*H+h*u;this.n24=g*y+i*P+h*L+j;this.n31=n*I+l*p+m*M;this.n32=n*x+l*Q+m*C;this.n33=n*G+l*H+m*u;this.n34=n*y+l*P+m*L+k;this.n41=q*I+t*p+A*M;this.n42=q*x+t*Q+A*C;this.n43=q*G+t*H+A*u;this.n44=q*y+t*P+A*L+s;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
 this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,b=this.n12,c=this.n13,e=this.n14,d=this.n21,f=this.n22,g=this.n23,i=this.n24,h=this.n31,j=this.n32,o=this.n33,m=this.n34,l=this.n41,k=this.n42,s=this.n43,p=this.n44;return e*g*j*l-c*i*j*l-e*f*o*l+b*i*o*l+c*f*m*l-b*g*m*l-e*g*h*k+c*i*h*k+e*d*o*k-a*i*o*k-c*d*m*k+a*g*m*k+e*f*h*s-b*i*h*s-e*d*j*s+a*i*j*s+b*d*m*s-a*f*m*s-c*f*h*p+b*g*h*p+c*d*j*p-a*g*j*p-b*d*o*p+a*f*o*p},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
+this.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,n=this.n33,l=this.n34,m=this.n41,k=this.n42,q=this.n43,t=this.n44;return e*g*j*m-c*i*j*m-e*f*n*m+b*i*n*m+c*f*l*m-b*g*l*m-e*g*h*k+c*i*h*k+e*d*n*k-a*i*n*k-c*d*l*k+a*g*l*k+e*f*h*q-b*i*h*q-e*d*j*q+a*i*j*q+b*d*l*q-a*f*l*q-c*f*h*t+b*g*h*t+c*d*j*t-a*g*j*t-b*d*n*t+a*f*n*t},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
@@ -34,9 +34,9 @@ b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:functio
 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(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;return this},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);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
 a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,d=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*d;this.n23=a.n23*d;this.n33=a.n33*d}};
-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,o=a.n31,m=a.n32,l=a.n33,k=a.n34,s=a.n41,p=a.n42,z=a.n43,u=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*k*p-j*l*p+j*m*z-i*k*z-h*m*u+i*l*u;b.n12=f*l*p-d*k*p-f*m*z+e*k*z+d*m*u-e*l*u;b.n13=d*j*p-f*h*p+f*i*z-e*j*z-d*i*u+e*h*u;b.n14=f*h*m-d*j*m-f*i*l+e*j*l+d*i*k-e*h*k;b.n21=j*l*s-h*k*s-j*o*z+g*k*z+h*o*u-g*l*u;b.n22=d*k*s-f*l*s+f*o*z-c*k*z-d*o*u+c*l*u;b.n23=f*h*s-d*j*s-f*g*z+c*j*z+d*g*u-c*h*u;
-b.n24=d*j*o-f*h*o+f*g*l-c*j*l-d*g*k+c*h*k;b.n31=i*k*s-j*m*s+j*o*p-g*k*p-i*o*u+g*m*u;b.n32=f*m*s-e*k*s-f*o*p+c*k*p+e*o*u-c*m*u;b.n33=d*j*s-f*i*s+f*g*p-c*j*p-e*g*u+c*i*u;b.n34=f*i*o-e*j*o-f*g*m+c*j*m+e*g*k-c*i*k;b.n41=h*m*s-i*l*s-h*o*p+g*l*p+i*o*z-g*m*z;b.n42=e*l*s-d*m*s+d*o*p-c*l*p-e*o*z+c*m*z;b.n43=d*i*s-e*h*s-d*g*p+c*h*p+e*g*z-c*i*z;b.n44=e*h*o-d*i*o+d*g*m-c*h*m-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,o=-a.n23*a.n11+a.n21*a.n13,m=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*o;c[8]=a*m;return b};
+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,n=a.n31,l=a.n32,m=a.n33,k=a.n34,q=a.n41,t=a.n42,A=a.n43,s=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*k*t-j*m*t+j*l*A-i*k*A-h*l*s+i*m*s;b.n12=f*m*t-d*k*t-f*l*A+e*k*A+d*l*s-e*m*s;b.n13=d*j*t-f*h*t+f*i*A-e*j*A-d*i*s+e*h*s;b.n14=f*h*l-d*j*l-f*i*m+e*j*m+d*i*k-e*h*k;b.n21=j*m*q-h*k*q-j*n*A+g*k*A+h*n*s-g*m*s;b.n22=d*k*q-f*m*q+f*n*A-c*k*A-d*n*s+c*m*s;b.n23=f*h*q-d*j*q-f*g*A+c*j*A+d*g*s-c*h*s;
+b.n24=d*j*n-f*h*n+f*g*m-c*j*m-d*g*k+c*h*k;b.n31=i*k*q-j*l*q+j*n*t-g*k*t-i*n*s+g*l*s;b.n32=f*l*q-e*k*q-f*n*t+c*k*t+e*n*s-c*l*s;b.n33=d*j*q-f*i*q+f*g*t-c*j*t-e*g*s+c*i*s;b.n34=f*i*n-e*j*n-f*g*l+c*j*l+e*g*k-c*i*k;b.n41=h*l*q-i*m*q-h*n*t+g*m*t+i*n*A-g*l*A;b.n42=e*m*q-d*l*q+d*n*t-c*m*t-e*n*A+c*l*A;b.n43=d*i*q-e*h*q-d*g*t+c*h*t+e*g*A-c*i*A;b.n44=e*h*n-d*i*n+d*g*l-c*h*l-e*g*m+c*i*m;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,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,n=-a.n23*a.n11+a.n21*a.n13,l=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*n;c[8]=a*l;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.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
@@ -47,8 +47,8 @@ undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b
 b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?e:1)};
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=e*d;this.w=g*f-i*c;this.x=g*c+i*f;this.y=e*b*f+a*d*c;this.z=a*d*f-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+d*f+c*i-e*g;this.y=c*a+d*g+e*f-b*i;this.z=e*a+d*i+b*g-c*f;this.w=d*a-b*f-c*g-e*i;return this},
-multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*d-i*e,o=h*e+i*c-f*d,m=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+o*-i-m*-g;b.y=o*h+c*-g+m*-f-j*-i;b.z=m*h+c*-i+j*-g-o*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*d-i*e,n=h*e+i*c-f*d,l=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+n*-i-l*-g;b.y=n*h+c*-g+l*-f-j*-i;b.z=l*h+c*-i+j*-g-n*-f;return b}};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,f,g){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
 THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -56,26 +56,26 @@ 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,e,d,f,g,i=new THREE.Vector3,h=new THREE.Vector3;e=0;for(d=this.faces.length;e<d;e++){f=this.faces[e];if(a&&f.vertexNormals.length){i.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)i.addSelf(f.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];i.sub(g.position,c.position);h.sub(b.position,c.position);i.crossSelf(h)}i.isZero()||
 i.normalize();f.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){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{e=
 this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal);e[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(e[c.a]);
-c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c]);c.vertexNormals[3].copy(e[c.d])}}},computeTangents:function(){function a(y,M,E,L,Q,v,B){f=y.vertices[M].position;g=y.vertices[E].position;i=y.vertices[L].position;h=d[Q];j=d[v];o=d[B];m=g.x-f.x;l=i.x-f.x;k=g.y-f.y;s=i.y-f.y;p=g.z-f.z;z=i.z-f.z;u=j.u-h.u;I=o.u-h.u;q=j.v-h.v;n=o.v-h.v;D=1/(u*n-I*q);O.set((n*
-m-q*l)*D,(n*k-q*s)*D,(n*p-q*z)*D);A.set((u*l-I*m)*D,(u*s-I*k)*D,(u*z-I*p)*D);H[M].addSelf(O);H[E].addSelf(O);H[L].addSelf(O);N[M].addSelf(A);N[E].addSelf(A);N[L].addSelf(A)}var b,c,e,d,f,g,i,h,j,o,m,l,k,s,p,z,u,I,q,n,D,H=[],N=[],O=new THREE.Vector3,A=new THREE.Vector3,w=new THREE.Vector3,P=new THREE.Vector3,J=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){H[b]=new THREE.Vector3;N[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];d=this.faceVertexUvs[b][0];if(e instanceof
+c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c]);c.vertexNormals[3].copy(e[c.d])}}},computeTangents:function(){function a(L,N,O,v,B,z,D){f=L.vertices[N].position;g=L.vertices[O].position;i=L.vertices[v].position;h=d[B];j=d[z];n=d[D];l=g.x-f.x;m=i.x-f.x;k=g.y-f.y;q=i.y-f.y;t=g.z-f.z;A=i.z-f.z;s=j.u-h.u;I=n.u-h.u;x=j.v-h.v;G=n.v-h.v;y=1/(s*G-I*x);H.set((G*
+l-x*m)*y,(G*k-x*q)*y,(G*t-x*A)*y);P.set((s*m-I*l)*y,(s*q-I*k)*y,(s*A-I*t)*y);p[N].addSelf(H);p[O].addSelf(H);p[v].addSelf(H);Q[N].addSelf(P);Q[O].addSelf(P);Q[v].addSelf(P)}var b,c,e,d,f,g,i,h,j,n,l,m,k,q,t,A,s,I,x,G,y,p=[],Q=[],H=new THREE.Vector3,P=new THREE.Vector3,M=new THREE.Vector3,C=new THREE.Vector3,u=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){p[b]=new THREE.Vector3;Q[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];d=this.faceVertexUvs[b][0];if(e instanceof
 THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<
-c;b++){J.copy(this.vertices[b].normal);e=H[b];w.copy(e);w.subSelf(J.multiplyScalar(J.dot(e))).normalize();P.cross(this.vertices[b].normal,e);e=P.dot(N[b]);e=e<0?-1:1;this.vertices[b].tangent.set(w.x,w.y,w.z,e)}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=
+c;b++){u.copy(this.vertices[b].normal);e=p[b];M.copy(e);M.subSelf(u.multiplyScalar(u.dot(e))).normalize();C.cross(this.vertices[b].normal,e);e=C.dot(Q[b]);e=e<0?-1:1;this.vertices[b].tangent.set(M.x,M.y,M.z,e)}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}}};THREE.GeometryIdCounter=0;
 THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(d){for(var f=0;f<a.length;f++)a[f].update(d)};c.addToUpdate=function(d){a.indexOf(d)===-1&&a.push(d)};c.removeFromUpdate=function(d){d=a.indexOf(d);d!==-1&&a.splice(d,1)};c.add=function(d){b[d.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+d.name+" already exists in library. Overwriting.");b[d.name]=d;if(d.initialized!==!0){for(var f=0;f<d.hierarchy.length;f++){for(var g=0;g<d.hierarchy[f].keys.length;g++){if(d.hierarchy[f].keys[g].time<
-0)d.hierarchy[f].keys[g].time=0;if(d.hierarchy[f].keys[g].rot!==undefined&&!(d.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var i=d.hierarchy[f].keys[g].rot;d.hierarchy[f].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}if(d.hierarchy[f].keys[0].morphTargets!==undefined){i={};for(g=0;g<d.hierarchy[f].keys.length;g++)for(var h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++){var j=d.hierarchy[f].keys[g].morphTargets[h];i[j]=-1}d.hierarchy[f].usedMorphTargets=i;for(g=0;g<d.hierarchy[f].keys.length;g++){var o=
-{};for(j in i){for(h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++)if(d.hierarchy[f].keys[g].morphTargets[h]===j){o[j]=d.hierarchy[f].keys[g].morphTargetsInfluences[h];break}h===d.hierarchy[f].keys[g].morphTargets.length&&(o[j]=0)}d.hierarchy[f].keys[g].morphTargetsInfluences=o}}for(g=1;g<d.hierarchy[f].keys.length;g++)if(d.hierarchy[f].keys[g].time===d.hierarchy[f].keys[g-1].time){d.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<d.hierarchy[f].keys.length;g++)d.hierarchy[f].keys[g].index=g}g=parseInt(d.length*
+0)d.hierarchy[f].keys[g].time=0;if(d.hierarchy[f].keys[g].rot!==undefined&&!(d.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var i=d.hierarchy[f].keys[g].rot;d.hierarchy[f].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}if(d.hierarchy[f].keys[0].morphTargets!==undefined){i={};for(g=0;g<d.hierarchy[f].keys.length;g++)for(var h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++){var j=d.hierarchy[f].keys[g].morphTargets[h];i[j]=-1}d.hierarchy[f].usedMorphTargets=i;for(g=0;g<d.hierarchy[f].keys.length;g++){var n=
+{};for(j in i){for(h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++)if(d.hierarchy[f].keys[g].morphTargets[h]===j){n[j]=d.hierarchy[f].keys[g].morphTargetsInfluences[h];break}h===d.hierarchy[f].keys[g].morphTargets.length&&(n[j]=0)}d.hierarchy[f].keys[g].morphTargetsInfluences=n}}for(g=1;g<d.hierarchy[f].keys.length;g++)if(d.hierarchy[f].keys[g].time===d.hierarchy[f].keys[g-1].time){d.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<d.hierarchy[f].keys.length;g++)d.hierarchy[f].keys[g].index=g}g=parseInt(d.length*
 d.fps,10);d.JIT={};d.JIT.hierarchy=[];for(f=0;f<d.hierarchy.length;f++)d.JIT.hierarchy.push(Array(g));d.initialized=!0}};c.get=function(d){if(typeof d==="string")if(b[d])return b[d];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+d);return null}};c.parse=function(d){var f=[];if(d instanceof THREE.SkinnedMesh)for(var g=0;g<d.bones.length;g++)f.push(d.bones[g]);else e(d,f);return f};var e=function(d,f){f.push(d);for(var g=0;g<d.children.length;g++)e(d.children[g],f)};c.LINEAR=
 0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,e=this.hierarchy.length,d;for(c=0;c<e;c++){d=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)d.useQuaternion=!0;d.matrixAutoUpdate=!0;if(d.animationCache===undefined){d.animationCache={};d.animationCache.prevKey={pos:0,rot:0,scl:0};d.animationCache.nextKey={pos:0,rot:0,scl:0};d.animationCache.originalMatrix=
 d instanceof THREE.Bone?d.skinMatrix:d.matrix}var f=d.animationCache.prevKey;d=d.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];d.pos=this.getNextKeyWith("pos",c,1);d.rot=this.getNextKeyWith("rot",c,1);d.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,d,f,g,i,h,j,o=this.data.JIT.hierarchy,m,l;this.currentTime+=a*this.timeScale;l=this.currentTime;m=this.currentTime%=this.data.length;j=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var k=0,s=this.hierarchy.length;k<s;k++){a=this.hierarchy[k];h=a.animationCache;if(this.JITCompile&&o[k][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=o[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=o[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var p=0;p<3;p++){c=b[p];g=h.prevKey[c];i=h.nextKey[c];if(i.time<=l){if(m<l)if(this.loop){g=this.data.hierarchy[k].keys[0];for(i=this.getNextKeyWith(c,k,1);i.time<m;){g=i;i=this.getNextKeyWith(c,k,i.index+1)}}else{this.stop();return}else{do{g=i;i=this.getNextKeyWith(c,k,i.index+1)}while(i.time<
-m)}h.prevKey[c]=g;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(m-g.time)/(i.time-g.time);d=g[c];f=i[c];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+k);e=e<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=d[0]+(f[0]-d[0])*e;c.y=d[1]+(f[1]-d[1])*e;c.z=d[2]+(f[2]-d[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,d,f,g,i,h,j,n=this.data.JIT.hierarchy,l,m;this.currentTime+=a*this.timeScale;m=this.currentTime;l=this.currentTime%=this.data.length;j=parseInt(Math.min(l*this.data.fps,this.data.length*this.data.fps),10);for(var k=0,q=this.hierarchy.length;k<q;k++){a=this.hierarchy[k];h=a.animationCache;if(this.JITCompile&&n[k][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=n[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=n[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var t=0;t<3;t++){c=b[t];g=h.prevKey[c];i=h.nextKey[c];if(i.time<=m){if(l<m)if(this.loop){g=this.data.hierarchy[k].keys[0];for(i=this.getNextKeyWith(c,k,1);i.time<l;){g=i;i=this.getNextKeyWith(c,k,i.index+1)}}else{this.stop();return}else{do{g=i;i=this.getNextKeyWith(c,k,i.index+1)}while(i.time<
+l)}h.prevKey[c]=g;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(l-g.time)/(i.time-g.time);d=g[c];f=i[c];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+k);e=e<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=d[0]+(f[0]-d[0])*e;c.y=d[1]+(f[1]-d[1])*e;c.z=d[2]+(f[2]-d[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
 this.getPrevKeyWith("pos",k,g.index-1).pos;this.points[1]=d;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",k,i.index+1).pos;e=e*0.33+0.33;d=this.interpolateCatmullRom(this.points,e);c.x=d[0];c.y=d[1];c.z=d[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(c===
-"rot")THREE.Quaternion.slerp(d,f,a.quaternion,e);else if(c==="scl"){c=a.scale;c.x=d[0]+(f[0]-d[0])*e;c.y=d[1]+(f[1]-d[1])*e;c.z=d[2]+(f[2]-d[2])*e}}}}if(this.JITCompile&&o[0][j]===undefined){this.hierarchy[0].update(undefined,!0);for(k=0;k<this.hierarchy.length;k++)o[k][j]=this.hierarchy[k]instanceof THREE.Bone?this.hierarchy[k].skinMatrix.clone():this.hierarchy[k].matrix.clone()}}};
+"rot")THREE.Quaternion.slerp(d,f,a.quaternion,e);else if(c==="scl"){c=a.scale;c.x=d[0]+(f[0]-d[0])*e;c.y=d[1]+(f[1]-d[1])*e;c.z=d[2]+(f[2]-d[2])*e}}}}if(this.JITCompile&&n[0][j]===undefined){this.hierarchy[0].update(undefined,!0);for(k=0;k<this.hierarchy.length;k++)n[k][j]=this.hierarchy[k]instanceof THREE.Bone?this.hierarchy[k].skinMatrix.clone():this.hierarchy[k].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],d,f,g,i,h,j;d=(a.length-1)*b;f=Math.floor(d);d-=f;c[0]=f==0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];i=a[c[1]];h=a[c[2]];j=a[c[3]];c=d*d;g=d*c;e[0]=this.interpolate(f[0],i[0],h[0],j[0],d,c,g);e[1]=this.interpolate(f[1],i[1],h[1],j[1],d,c,g);e[2]=this.interpolate(f[2],i[2],h[2],j[2],d,c,g);return e};
 THREE.Animation.prototype.interpolate=function(a,b,c,e,d,f,g){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*g+(-3*(b-c)-2*a-e)*f+a*d+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<e.length-1?c:e.length-1;else c%=e.length;for(;c<e.length;c++)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
@@ -121,31 +121,32 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.f
 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.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}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.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}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(){var A=h[i]=h[i]||new THREE.RenderableVertex;i++;return A}function b(A,w){return w.z-A.z}function c(A,w){var P=0,J=1,y=A.z+A.w,M=w.z+w.w,E=-A.z+A.w,L=-w.z+w.w;if(y>=0&&M>=0&&E>=0&&L>=0)return!0;else if(y<0&&M<0||E<0&&L<0)return!1;else{if(y<0)P=Math.max(P,y/(y-M));else M<0&&(J=Math.min(J,y/(y-M)));if(E<0)P=Math.max(P,E/(E-L));else L<0&&(J=Math.min(J,E/(E-L)));if(J<P)return!1;else{A.lerpSelf(w,P);w.lerpSelf(A,1-J);return!0}}}var e,d,f=[],g,i,h=[],j,o,m=[],l,k,
-s=[],p,z,u=[],I=new THREE.Vector4,q=new THREE.Vector4,n=new THREE.Matrix4,D=new THREE.Matrix4,H=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(A,w){n.multiply(w.projectionMatrix,w.matrixWorldInverse);n.multiplyVector3(A);return A};this.unprojectVector=function(A,w){n.multiply(THREE.Matrix4.makeInvert(w.projectionMatrix),w.matrixWorld);n.multiplyVector3(A);return A};this.projectObjects=
-function(A,w,P){w=[];var J,y,M;d=0;y=A.objects;A=0;for(J=y.length;A<J;A++){M=y[A];var E;if(!(E=!M.visible))if(E=M instanceof THREE.Mesh){a:{E=void 0;for(var L=M.matrixWorld,Q=-M.geometry.boundingSphere.radius*Math.max(M.scale.x,Math.max(M.scale.y,M.scale.z)),v=0;v<6;v++){E=H[v].x*L.n14+H[v].y*L.n24+H[v].z*L.n34+H[v].w;if(E<=Q){E=!1;break a}}E=!0}E=!E}if(!E){E=f[d]=f[d]||new THREE.RenderableObject;d++;e=E;I.copy(M.position);n.multiplyVector3(I);e.object=M;e.z=I.z;w.push(e)}}P&&w.sort(b);return w};
-this.projectScene=function(A,w,P){var J=[],y=w.near,M=w.far,E,L,Q,v,B,F,G,t,r,x,R,C,K,S,T,U,V;z=k=o=0;w.matrixAutoUpdate&&w.updateMatrix();A.update(undefined,!1,w);n.multiply(w.projectionMatrix,w.matrixWorldInverse);H[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);H[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);H[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);H[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);H[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);
-H[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);for(E=0;E<6;E++){r=H[E];r.divideScalar(Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z))}r=this.projectObjects(A,w,!0);A=0;for(E=r.length;A<E;A++){x=r[A].object;if(x.visible){R=x.matrixWorld;C=x.matrixRotationWorld;K=x.materials;S=x.overdraw;i=0;if(x instanceof THREE.Mesh){T=x.geometry;v=T.vertices;U=T.faces;T=T.faceVertexUvs;L=0;for(Q=v.length;L<Q;L++){g=a();g.positionWorld.copy(v[L].position);R.multiplyVector3(g.positionWorld);g.positionScreen.copy(g.positionWorld);
-n.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>y&&g.positionScreen.z<M}v=0;for(L=U.length;v<L;v++){Q=U[v];if(Q instanceof THREE.Face3){B=h[Q.a];F=h[Q.b];G=h[Q.c];if(B.visible&&F.visible&&G.visible&&(x.doubleSided||x.flipSided!=(G.positionScreen.x-B.positionScreen.x)*(F.positionScreen.y-B.positionScreen.y)-(G.positionScreen.y-B.positionScreen.y)*(F.positionScreen.x-B.positionScreen.x)<0)){t=m[o]=m[o]||new THREE.RenderableFace3;
-o++;j=t;j.v1.copy(B);j.v2.copy(F);j.v3.copy(G);j.normalWorld.copy(Q.normal);C.multiplyVector3(j.normalWorld);j.centroidWorld.copy(Q.centroid);R.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);n.multiplyVector3(j.centroidScreen);G=Q.vertexNormals;B=0;for(F=G.length;B<F;B++){t=j.vertexNormalsWorld[B];t.copy(G[B]);C.multiplyVector3(t)}B=0;for(F=T.length;B<F;B++)if(V=T[B][v]){G=0;for(t=V.length;G<t;G++)j.uvs[B][G]=V[G]}j.meshMaterials=K;j.faceMaterials=Q.materials;j.overdraw=S;
-j.z=j.centroidScreen.z;J.push(j)}}}}else if(x instanceof THREE.Line){D.multiply(n,R);v=x.geometry.vertices;B=a();B.positionScreen.copy(v[0].position);D.multiplyVector4(B.positionScreen);L=1;for(Q=v.length;L<Q;L++){B=a();B.positionScreen.copy(v[L].position);D.multiplyVector4(B.positionScreen);F=h[i-2];N.copy(B.positionScreen);O.copy(F.positionScreen);if(c(N,O)){N.multiplyScalar(1/N.w);O.multiplyScalar(1/O.w);R=s[k]=s[k]||new THREE.RenderableLine;k++;l=R;l.v1.positionScreen.copy(N);l.v2.positionScreen.copy(O);
-l.z=Math.max(N.z,O.z);l.materials=x.materials;J.push(l)}}}else if(x instanceof THREE.Particle){q.set(x.position.x,x.position.y,x.position.z,1);n.multiplyVector4(q);q.z/=q.w;if(q.z>0&&q.z<1){R=u[z]=u[z]||new THREE.RenderableParticle;z++;p=R;p.x=q.x/q.w;p.y=q.y/q.w;p.z=q.z;p.rotation=x.rotation.z;p.scale.x=x.scale.x*Math.abs(p.x-(q.x+w.projectionMatrix.n11)/(q.w+w.projectionMatrix.n14));p.scale.y=x.scale.y*Math.abs(p.y-(q.y+w.projectionMatrix.n22)/(q.w+w.projectionMatrix.n24));p.materials=x.materials;
-J.push(p)}}}}P&&J.sort(b);return J}};
-THREE.SVGRenderer=function(){function a(v,B,F){var G,t,r,x;G=0;for(t=v.lights.length;G<t;G++){r=v.lights[G];if(r instanceof THREE.DirectionalLight){x=B.normalWorld.dot(r.position)*r.intensity;if(x>0){F.r+=r.color.r*x;F.g+=r.color.g*x;F.b+=r.color.b*x}}else if(r instanceof THREE.PointLight){A.sub(r.position,B.centroidWorld);A.normalize();x=B.normalWorld.dot(A)*r.intensity;if(x>0){F.r+=r.color.r*x;F.g+=r.color.g*x;F.b+=r.color.b*x}}}}function b(v,B,F,G,t,r){y=e(M++);y.setAttribute("d","M "+v.positionScreen.x+
-" "+v.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+"z");if(t instanceof THREE.MeshBasicMaterial)q.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshLambertMaterial)if(I){n.r=D.r;n.g=D.g;n.b=D.b;a(r,G,n);q.r=t.color.r*n.r;q.g=t.color.g*n.g;q.b=t.color.b*n.b;q.updateStyleString()}else q.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshDepthMaterial){O=1-t.__2near/(t.__farPlusNear-G.z*t.__farMinusNear);
-q.setRGB(O,O,O)}else t instanceof THREE.MeshNormalMaterial&&q.setRGB(d(G.normalWorld.x),d(G.normalWorld.y),d(G.normalWorld.z));t.wireframe?y.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):y.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+t.opacity);i.appendChild(y)}function c(v,B,F,G,t,r,x){y=e(M++);y.setAttribute("d",
-"M "+v.positionScreen.x+" "+v.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+" L "+G.positionScreen.x+","+G.positionScreen.y+"z");if(r instanceof THREE.MeshBasicMaterial)q.__styleString=r.color.__styleString;else if(r instanceof THREE.MeshLambertMaterial)if(I){n.r=D.r;n.g=D.g;n.b=D.b;a(x,t,n);q.r=r.color.r*n.r;q.g=r.color.g*n.g;q.b=r.color.b*n.b;q.updateStyleString()}else q.__styleString=r.color.__styleString;else if(r instanceof THREE.MeshDepthMaterial){O=
-1-r.__2near/(r.__farPlusNear-t.z*r.__farMinusNear);q.setRGB(O,O,O)}else r instanceof THREE.MeshNormalMaterial&&q.setRGB(d(t.normalWorld.x),d(t.normalWorld.y),d(t.normalWorld.z));r.wireframe?y.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+r.wireframeLinewidth+"; stroke-opacity: "+r.opacity+"; stroke-linecap: "+r.wireframeLinecap+"; stroke-linejoin: "+r.wireframeLinejoin):y.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+r.opacity);i.appendChild(y)}
-function e(v){if(w[v]==null){w[v]=document.createElementNS("http://www.w3.org/2000/svg","path");Q==0&&w[v].setAttribute("shape-rendering","crispEdges")}return w[v]}function d(v){return v<0?Math.min((1+v)*0.5,0.5):0.5+Math.min(v*0.5,0.5)}var f=null,g=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,j,o,m,l,k,s,p,z=new THREE.Rectangle,u=new THREE.Rectangle,I=!1,q=new THREE.Color(16777215),n=new THREE.Color(16777215),D=new THREE.Color(0),H=new THREE.Color(0),N=new THREE.Color(0),
-O,A=new THREE.Vector3,w=[],P=[],J=[],y,M,E,L,Q=1;this.domElement=i;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(v){switch(v){case "high":Q=1;break;case "low":Q=0}};this.setSize=function(v,B){h=v;j=B;o=h/2;m=j/2;i.setAttribute("viewBox",-o+" "+-m+" "+h+" "+j);i.setAttribute("width",h);i.setAttribute("height",j);z.set(-o,-m,o,m)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(v,B){var F,G,t,r,x,R,C,K;this.autoClear&&
-this.clear();f=g.projectScene(v,B,this.sortElements);L=E=M=0;if(I=v.lights.length>0){C=v.lights;D.setRGB(0,0,0);H.setRGB(0,0,0);N.setRGB(0,0,0);F=0;for(G=C.length;F<G;F++){t=C[F];r=t.color;if(t instanceof THREE.AmbientLight){D.r+=r.r;D.g+=r.g;D.b+=r.b}else if(t instanceof THREE.DirectionalLight){H.r+=r.r;H.g+=r.g;H.b+=r.b}else if(t instanceof THREE.PointLight){N.r+=r.r;N.g+=r.g;N.b+=r.b}}}F=0;for(G=f.length;F<G;F++){C=f[F];u.empty();if(C instanceof THREE.RenderableParticle){l=C;l.x*=o;l.y*=-m;t=0;
-for(r=C.materials.length;t<r;t++)if(K=C.materials[t]){x=l;R=C;var S=E++;if(P[S]==null){P[S]=document.createElementNS("http://www.w3.org/2000/svg","circle");Q==0&&P[S].setAttribute("shape-rendering","crispEdges")}y=P[S];y.setAttribute("cx",x.x);y.setAttribute("cy",x.y);y.setAttribute("r",R.scale.x*o);if(K instanceof THREE.ParticleCircleMaterial){if(I){n.r=D.r+H.r+N.r;n.g=D.g+H.g+N.g;n.b=D.b+H.b+N.b;q.r=K.color.r*n.r;q.g=K.color.g*n.g;q.b=K.color.b*n.b;q.updateStyleString()}else q=K.color;y.setAttribute("style",
-"fill: "+q.__styleString)}i.appendChild(y)}}else if(C instanceof THREE.RenderableLine){l=C.v1;k=C.v2;l.positionScreen.x*=o;l.positionScreen.y*=-m;k.positionScreen.x*=o;k.positionScreen.y*=-m;u.addPoint(l.positionScreen.x,l.positionScreen.y);u.addPoint(k.positionScreen.x,k.positionScreen.y);if(z.instersects(u)){t=0;for(r=C.materials.length;t<r;)if(K=C.materials[t++]){x=l;R=k;S=L++;if(J[S]==null){J[S]=document.createElementNS("http://www.w3.org/2000/svg","line");Q==0&&J[S].setAttribute("shape-rendering",
-"crispEdges")}y=J[S];y.setAttribute("x1",x.positionScreen.x);y.setAttribute("y1",x.positionScreen.y);y.setAttribute("x2",R.positionScreen.x);y.setAttribute("y2",R.positionScreen.y);if(K instanceof THREE.LineBasicMaterial){q.__styleString=K.color.__styleString;y.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+K.linewidth+"; stroke-opacity: "+K.opacity+"; stroke-linecap: "+K.linecap+"; stroke-linejoin: "+K.linejoin);i.appendChild(y)}}}}else if(C instanceof THREE.RenderableFace3){l=
-C.v1;k=C.v2;s=C.v3;l.positionScreen.x*=o;l.positionScreen.y*=-m;k.positionScreen.x*=o;k.positionScreen.y*=-m;s.positionScreen.x*=o;s.positionScreen.y*=-m;u.addPoint(l.positionScreen.x,l.positionScreen.y);u.addPoint(k.positionScreen.x,k.positionScreen.y);u.addPoint(s.positionScreen.x,s.positionScreen.y);if(z.instersects(u)){t=0;for(r=C.meshMaterials.length;t<r;){K=C.meshMaterials[t++];if(K instanceof THREE.MeshFaceMaterial){x=0;for(R=C.faceMaterials.length;x<R;)(K=C.faceMaterials[x++])&&b(l,k,s,C,
-K,v)}else K&&b(l,k,s,C,K,v)}}}else if(C instanceof THREE.RenderableFace4){l=C.v1;k=C.v2;s=C.v3;p=C.v4;l.positionScreen.x*=o;l.positionScreen.y*=-m;k.positionScreen.x*=o;k.positionScreen.y*=-m;s.positionScreen.x*=o;s.positionScreen.y*=-m;p.positionScreen.x*=o;p.positionScreen.y*=-m;u.addPoint(l.positionScreen.x,l.positionScreen.y);u.addPoint(k.positionScreen.x,k.positionScreen.y);u.addPoint(s.positionScreen.x,s.positionScreen.y);u.addPoint(p.positionScreen.x,p.positionScreen.y);if(z.instersects(u)){t=
-0;for(r=C.meshMaterials.length;t<r;){K=C.meshMaterials[t++];if(K instanceof THREE.MeshFaceMaterial){x=0;for(R=C.faceMaterials.length;x<R;)(K=C.faceMaterials[x++])&&c(l,k,s,p,C,K,v)}else K&&c(l,k,s,p,C,K,v)}}}}}};
+THREE.Projector=function(){function a(){var C=h[i]=h[i]||new THREE.RenderableVertex;i++;return C}function b(C,u){return u.z-C.z}function c(C,u){var L=0,N=1,O=C.z+C.w,v=u.z+u.w,B=-C.z+C.w,z=-u.z+u.w;if(O>=0&&v>=0&&B>=0&&z>=0)return!0;else if(O<0&&v<0||B<0&&z<0)return!1;else{if(O<0)L=Math.max(L,O/(O-v));else v<0&&(N=Math.min(N,O/(O-v)));if(B<0)L=Math.max(L,B/(B-z));else z<0&&(N=Math.min(N,B/(B-z)));if(N<L)return!1;else{C.lerpSelf(u,L);u.lerpSelf(C,1-N);return!0}}}var e,d,f=[],g,i,h=[],j,n,l=[],m,k=
+[],q,t,A=[],s,I,x=[],G=new THREE.Vector4,y=new THREE.Vector4,p=new THREE.Matrix4,Q=new THREE.Matrix4,H=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],P=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(C,u){p.multiply(u.projectionMatrix,u.matrixWorldInverse);p.multiplyVector3(C);return C};this.unprojectVector=function(C,u){p.multiply(u.matrixWorld,THREE.Matrix4.makeInvert(u.projectionMatrix));p.multiplyVector3(C);return C};
+this.projectObjects=function(C,u,L){u=[];var N,O,v;d=0;O=C.objects;C=0;for(N=O.length;C<N;C++){v=O[C];var B;if(!(B=!v.visible))if(B=v instanceof THREE.Mesh){a:{B=void 0;for(var z=v.matrixWorld,D=-v.geometry.boundingSphere.radius*Math.max(v.scale.x,Math.max(v.scale.y,v.scale.z)),r=0;r<6;r++){B=H[r].x*z.n14+H[r].y*z.n24+H[r].z*z.n34+H[r].w;if(B<=D){B=!1;break a}}B=!0}B=!B}if(!B){B=f[d]=f[d]||new THREE.RenderableObject;d++;e=B;G.copy(v.position);p.multiplyVector3(G);e.object=v;e.z=G.z;u.push(e)}}L&&
+u.sort(b);return u};this.projectScene=function(C,u,L){var N=[],O=u.near,v=u.far,B,z,D,r,o,E,J,w,F,K,R,U,W,X,S,V,T;I=t=m=n=0;u.matrixAutoUpdate&&u.updateMatrix();C.update(undefined,!1,u);p.multiply(u.projectionMatrix,u.matrixWorldInverse);H[0].set(p.n41-p.n11,p.n42-p.n12,p.n43-p.n13,p.n44-p.n14);H[1].set(p.n41+p.n11,p.n42+p.n12,p.n43+p.n13,p.n44+p.n14);H[2].set(p.n41+p.n21,p.n42+p.n22,p.n43+p.n23,p.n44+p.n24);H[3].set(p.n41-p.n21,p.n42-p.n22,p.n43-p.n23,p.n44-p.n24);H[4].set(p.n41-p.n31,p.n42-p.n32,
+p.n43-p.n33,p.n44-p.n34);H[5].set(p.n41+p.n31,p.n42+p.n32,p.n43+p.n33,p.n44+p.n34);for(B=0;B<6;B++){F=H[B];F.divideScalar(Math.sqrt(F.x*F.x+F.y*F.y+F.z*F.z))}F=this.projectObjects(C,u,!0);C=0;for(B=F.length;C<B;C++){K=F[C].object;if(K.visible){R=K.matrixWorld;U=K.matrixRotationWorld;W=K.materials;X=K.overdraw;i=0;if(K instanceof THREE.Mesh){S=K.geometry;r=S.vertices;V=S.faces;S=S.faceVertexUvs;z=0;for(D=r.length;z<D;z++){g=a();g.positionWorld.copy(r[z].position);R.multiplyVector3(g.positionWorld);
+g.positionScreen.copy(g.positionWorld);p.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>O&&g.positionScreen.z<v}r=0;for(z=V.length;r<z;r++){D=V[r];if(D instanceof THREE.Face3){o=h[D.a];E=h[D.b];J=h[D.c];if(o.visible&&E.visible&&J.visible&&(K.doubleSided||K.flipSided!=(J.positionScreen.x-o.positionScreen.x)*(E.positionScreen.y-o.positionScreen.y)-(J.positionScreen.y-o.positionScreen.y)*(E.positionScreen.x-
+o.positionScreen.x)<0)){w=l[n]=l[n]||new THREE.RenderableFace3;n++;j=w;j.v1.copy(o);j.v2.copy(E);j.v3.copy(J)}else continue}else if(D instanceof THREE.Face4){o=h[D.a];E=h[D.b];J=h[D.c];w=h[D.d];if(o.visible&&E.visible&&J.visible&&w.visible&&(K.doubleSided||K.flipSided!=((w.positionScreen.x-o.positionScreen.x)*(E.positionScreen.y-o.positionScreen.y)-(w.positionScreen.y-o.positionScreen.y)*(E.positionScreen.x-o.positionScreen.x)<0||(E.positionScreen.x-J.positionScreen.x)*(w.positionScreen.y-J.positionScreen.y)-
+(E.positionScreen.y-J.positionScreen.y)*(w.positionScreen.x-J.positionScreen.x)<0))){T=k[m]=k[m]||new THREE.RenderableFace4;m++;j=T;j.v1.copy(o);j.v2.copy(E);j.v3.copy(J);j.v4.copy(w)}else continue}j.normalWorld.copy(D.normal);U.multiplyVector3(j.normalWorld);j.centroidWorld.copy(D.centroid);R.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);p.multiplyVector3(j.centroidScreen);J=D.vertexNormals;o=0;for(E=J.length;o<E;o++){w=j.vertexNormalsWorld[o];w.copy(J[o]);U.multiplyVector3(w)}o=
+0;for(E=S.length;o<E;o++)if(T=S[o][r]){J=0;for(w=T.length;J<w;J++)j.uvs[o][J]=T[J]}j.meshMaterials=W;j.faceMaterials=D.materials;j.overdraw=X;j.z=j.centroidScreen.z;N.push(j)}}else if(K instanceof THREE.Line){Q.multiply(p,R);r=K.geometry.vertices;o=a();o.positionScreen.copy(r[0].position);Q.multiplyVector4(o.positionScreen);z=1;for(D=r.length;z<D;z++){o=a();o.positionScreen.copy(r[z].position);Q.multiplyVector4(o.positionScreen);E=h[i-2];P.copy(o.positionScreen);M.copy(E.positionScreen);if(c(P,M)){P.multiplyScalar(1/
+P.w);M.multiplyScalar(1/M.w);R=A[t]=A[t]||new THREE.RenderableLine;t++;q=R;q.v1.positionScreen.copy(P);q.v2.positionScreen.copy(M);q.z=Math.max(P.z,M.z);q.materials=K.materials;N.push(q)}}}else if(K instanceof THREE.Particle){y.set(K.position.x,K.position.y,K.position.z,1);p.multiplyVector4(y);y.z/=y.w;if(y.z>0&&y.z<1){R=x[I]=x[I]||new THREE.RenderableParticle;I++;s=R;s.x=y.x/y.w;s.y=y.y/y.w;s.z=y.z;s.rotation=K.rotation.z;s.scale.x=K.scale.x*Math.abs(s.x-(y.x+u.projectionMatrix.n11)/(y.w+u.projectionMatrix.n14));
+s.scale.y=K.scale.y*Math.abs(s.y-(y.y+u.projectionMatrix.n22)/(y.w+u.projectionMatrix.n24));s.materials=K.materials;N.push(s)}}}}L&&N.sort(b);return N}};
+THREE.SVGRenderer=function(){function a(v,B,z){var D,r,o,E;D=0;for(r=v.lights.length;D<r;D++){o=v.lights[D];if(o instanceof THREE.DirectionalLight){E=B.normalWorld.dot(o.position)*o.intensity;if(E>0){z.r+=o.color.r*E;z.g+=o.color.g*E;z.b+=o.color.b*E}}else if(o instanceof THREE.PointLight){P.sub(o.position,B.centroidWorld);P.normalize();E=B.normalWorld.dot(P)*o.intensity;if(E>0){z.r+=o.color.r*E;z.g+=o.color.g*E;z.b+=o.color.b*E}}}}function b(v,B,z,D,r,o){u=e(L++);u.setAttribute("d","M "+v.positionScreen.x+
+" "+v.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+z.positionScreen.x+","+z.positionScreen.y+"z");if(r instanceof THREE.MeshBasicMaterial)x.__styleString=r.color.__styleString;else if(r instanceof THREE.MeshLambertMaterial)if(I){G.r=y.r;G.g=y.g;G.b=y.b;a(o,D,G);x.r=r.color.r*G.r;x.g=r.color.g*G.g;x.b=r.color.b*G.b;x.updateStyleString()}else x.__styleString=r.color.__styleString;else if(r instanceof THREE.MeshDepthMaterial){H=1-r.__2near/(r.__farPlusNear-D.z*r.__farMinusNear);
+x.setRGB(H,H,H)}else r instanceof THREE.MeshNormalMaterial&&x.setRGB(d(D.normalWorld.x),d(D.normalWorld.y),d(D.normalWorld.z));r.wireframe?u.setAttribute("style","fill: none; stroke: "+x.__styleString+"; stroke-width: "+r.wireframeLinewidth+"; stroke-opacity: "+r.opacity+"; stroke-linecap: "+r.wireframeLinecap+"; stroke-linejoin: "+r.wireframeLinejoin):u.setAttribute("style","fill: "+x.__styleString+"; fill-opacity: "+r.opacity);i.appendChild(u)}function c(v,B,z,D,r,o,E){u=e(L++);u.setAttribute("d",
+"M "+v.positionScreen.x+" "+v.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+z.positionScreen.x+","+z.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+"z");if(o instanceof THREE.MeshBasicMaterial)x.__styleString=o.color.__styleString;else if(o instanceof THREE.MeshLambertMaterial)if(I){G.r=y.r;G.g=y.g;G.b=y.b;a(E,r,G);x.r=o.color.r*G.r;x.g=o.color.g*G.g;x.b=o.color.b*G.b;x.updateStyleString()}else x.__styleString=o.color.__styleString;else if(o instanceof THREE.MeshDepthMaterial){H=
+1-o.__2near/(o.__farPlusNear-r.z*o.__farMinusNear);x.setRGB(H,H,H)}else o instanceof THREE.MeshNormalMaterial&&x.setRGB(d(r.normalWorld.x),d(r.normalWorld.y),d(r.normalWorld.z));o.wireframe?u.setAttribute("style","fill: none; stroke: "+x.__styleString+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):u.setAttribute("style","fill: "+x.__styleString+"; fill-opacity: "+o.opacity);i.appendChild(u)}
+function e(v){if(M[v]==null){M[v]=document.createElementNS("http://www.w3.org/2000/svg","path");O==0&&M[v].setAttribute("shape-rendering","crispEdges")}return M[v]}function d(v){return v<0?Math.min((1+v)*0.5,0.5):0.5+Math.min(v*0.5,0.5)}var f=null,g=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,j,n,l,m,k,q,t,A=new THREE.Rectangle,s=new THREE.Rectangle,I=!1,x=new THREE.Color(16777215),G=new THREE.Color(16777215),y=new THREE.Color(0),p=new THREE.Color(0),Q=new THREE.Color(0),
+H,P=new THREE.Vector3,M=[],C=[],u,L,N,O=1;this.domElement=i;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(v){switch(v){case "high":O=1;break;case "low":O=0}};this.setSize=function(v,B){h=v;j=B;n=h/2;l=j/2;i.setAttribute("viewBox",-n+" "+-l+" "+h+" "+j);i.setAttribute("width",h);i.setAttribute("height",j);A.set(-n,-l,n,l)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(v,B){var z,D,r,o,E,J,w,F;this.autoClear&&
+this.clear();f=g.projectScene(v,B,this.sortElements);N=L=0;if(I=v.lights.length>0){w=v.lights;y.setRGB(0,0,0);p.setRGB(0,0,0);Q.setRGB(0,0,0);z=0;for(D=w.length;z<D;z++){r=w[z];o=r.color;if(r instanceof THREE.AmbientLight){y.r+=o.r;y.g+=o.g;y.b+=o.b}else if(r instanceof THREE.DirectionalLight){p.r+=o.r;p.g+=o.g;p.b+=o.b}else if(r instanceof THREE.PointLight){Q.r+=o.r;Q.g+=o.g;Q.b+=o.b}}}z=0;for(D=f.length;z<D;z++){w=f[z];s.empty();if(w instanceof THREE.RenderableParticle){m=w;m.x*=n;m.y*=-l;r=0;for(o=
+w.materials.length;r<o;)r++}else if(w instanceof THREE.RenderableLine){m=w.v1;k=w.v2;m.positionScreen.x*=n;m.positionScreen.y*=-l;k.positionScreen.x*=n;k.positionScreen.y*=-l;s.addPoint(m.positionScreen.x,m.positionScreen.y);s.addPoint(k.positionScreen.x,k.positionScreen.y);if(A.instersects(s)){r=0;for(o=w.materials.length;r<o;)if((F=w.materials[r++])&&F.opacity!=0){E=m;J=k;var K=N++;if(C[K]==null){C[K]=document.createElementNS("http://www.w3.org/2000/svg","line");O==0&&C[K].setAttribute("shape-rendering",
+"crispEdges")}u=C[K];u.setAttribute("x1",E.positionScreen.x);u.setAttribute("y1",E.positionScreen.y);u.setAttribute("x2",J.positionScreen.x);u.setAttribute("y2",J.positionScreen.y);if(F instanceof THREE.LineBasicMaterial){x.__styleString=F.color.__styleString;u.setAttribute("style","fill: none; stroke: "+x.__styleString+"; stroke-width: "+F.linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.linecap+"; stroke-linejoin: "+F.linejoin);i.appendChild(u)}}}}else if(w instanceof THREE.RenderableFace3){m=
+w.v1;k=w.v2;q=w.v3;m.positionScreen.x*=n;m.positionScreen.y*=-l;k.positionScreen.x*=n;k.positionScreen.y*=-l;q.positionScreen.x*=n;q.positionScreen.y*=-l;s.addPoint(m.positionScreen.x,m.positionScreen.y);s.addPoint(k.positionScreen.x,k.positionScreen.y);s.addPoint(q.positionScreen.x,q.positionScreen.y);if(A.instersects(s)){r=0;for(o=w.meshMaterials.length;r<o;){F=w.meshMaterials[r++];if(F instanceof THREE.MeshFaceMaterial){E=0;for(J=w.faceMaterials.length;E<J;)(F=w.faceMaterials[E++])&&F.opacity!=
+0&&b(m,k,q,w,F,v)}else F&&F.opacity!=0&&b(m,k,q,w,F,v)}}}else if(w instanceof THREE.RenderableFace4){m=w.v1;k=w.v2;q=w.v3;t=w.v4;m.positionScreen.x*=n;m.positionScreen.y*=-l;k.positionScreen.x*=n;k.positionScreen.y*=-l;q.positionScreen.x*=n;q.positionScreen.y*=-l;t.positionScreen.x*=n;t.positionScreen.y*=-l;s.addPoint(m.positionScreen.x,m.positionScreen.y);s.addPoint(k.positionScreen.x,k.positionScreen.y);s.addPoint(q.positionScreen.x,q.positionScreen.y);s.addPoint(t.positionScreen.x,t.positionScreen.y);
+if(A.instersects(s)){r=0;for(o=w.meshMaterials.length;r<o;){F=w.meshMaterials[r++];if(F instanceof THREE.MeshFaceMaterial){E=0;for(J=w.faceMaterials.length;E<J;)(F=w.faceMaterials[E++])&&F.opacity!=0&&c(m,k,q,t,w,F,v)}else F&&F.opacity!=0&&c(m,k,q,t,w,F,v)}}}}}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var e,d=c.length;for(e=0;e<d;e++){a=c[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
-THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=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.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
+THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
+THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
+THREE.RenderableObject=function(){this.z=this.object=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.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};

+ 94 - 93
build/custom/ThreeWebGL.js

@@ -12,21 +12,21 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,e){this.set(a||0,b||0,c||0,e||1)};
 THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(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)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,f=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(i,j){return i.distance-j.distance});return f},intersectObject:function(a){function b(N,O,ja,R){R=R.clone().subSelf(O);ja=ja.clone().subSelf(O);var B=N.clone().subSelf(O);N=R.dot(R);O=R.dot(ja);R=R.dot(B);var la=ja.dot(ja);ja=ja.dot(B);B=1/(N*la-O*O);la=(la*R-O*ja)*B;N=(N*ja-O*R)*B;return la>0&&N>0&&la+N<1}var c,e,
-f,i,j,p,n,s,z,A,D,y=a.geometry,K=y.vertices,I=[];c=0;for(e=y.faces.length;c<e;c++){f=y.faces[c];A=this.origin.clone();D=this.direction.clone();n=a.matrixWorld;i=n.multiplyVector3(K[f.a].position.clone());j=n.multiplyVector3(K[f.b].position.clone());p=n.multiplyVector3(K[f.c].position.clone());n=f instanceof THREE.Face4?n.multiplyVector3(K[f.d].position.clone()):null;s=a.matrixRotationWorld.multiplyVector3(f.normal.clone());z=D.dot(s);if(z<0){s=s.dot((new THREE.Vector3).sub(i,A))/z;A=A.addSelf(D.multiplyScalar(s));
-if(f instanceof THREE.Face3){if(b(A,i,j,p)){f={distance:this.origin.distanceTo(A),point:A,face:f,object:a};I.push(f)}}else if(f instanceof THREE.Face4&&(b(A,i,j,n)||b(A,j,p,n))){f={distance:this.origin.distanceTo(A),point:A,face:f,object:a};I.push(f)}}}return I}};
-THREE.Rectangle=function(){function a(){i=e-b;j=f-c}var b,c,e,f,i,j,p=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return i};this.getHeight=function(){return j};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(n,s,z,A){p=!1;b=n;c=s;e=z;f=A;a()};this.addPoint=function(n,s){if(p){p=!1;b=n;c=s;e=n;f=s}else{b=b<n?b:n;c=c<s?c:s;e=e>n?e:n;f=f>s?f:s}a()};
-this.add3Points=function(n,s,z,A,D,y){if(p){p=!1;b=n<z?n<D?n:D:z<D?z:D;c=s<A?s<y?s:y:A<y?A:y;e=n>z?n>D?n:D:z>D?z:D;f=s>A?s>y?s:y:A>y?A:y}else{b=n<z?n<D?n<b?n:b:D<b?D:b:z<D?z<b?z:b:D<b?D:b;c=s<A?s<y?s<c?s:c:y<c?y:c:A<y?A<c?A:c:y<c?y:c;e=n>z?n>D?n>e?n:e:D>e?D:e:z>D?z>e?z:e:D>e?D:e;f=s>A?s>y?s>f?s:f:y>f?y:f:A>y?A>f?A:f:y>f?y:f}a()};this.addRectangle=function(n){if(p){p=!1;b=n.getLeft();c=n.getTop();e=n.getRight();f=n.getBottom()}else{b=b<n.getLeft()?b:n.getLeft();c=c<n.getTop()?c:n.getTop();e=e>n.getRight()?
+THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,f=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(i,j){return i.distance-j.distance});return f},intersectObject:function(a){function b(O,L,ha,ma){ma=ma.clone().subSelf(L);ha=ha.clone().subSelf(L);var pa=O.clone().subSelf(L);O=ma.dot(ma);L=ma.dot(ha);ma=ma.dot(pa);var R=ha.dot(ha);ha=ha.dot(pa);pa=1/(O*R-L*L);R=(R*ma-L*ha)*pa;O=(O*ha-L*ma)*pa;return R>0&&O>0&&R+O<
+1}var c,e,f,i,j,p,n,s,y,A,D,z=a.geometry,J=z.vertices,K=[];c=0;for(e=z.faces.length;c<e;c++){f=z.faces[c];A=this.origin.clone();D=this.direction.clone();n=a.matrixWorld;i=n.multiplyVector3(J[f.a].position.clone());j=n.multiplyVector3(J[f.b].position.clone());p=n.multiplyVector3(J[f.c].position.clone());n=f instanceof THREE.Face4?n.multiplyVector3(J[f.d].position.clone()):null;s=a.matrixRotationWorld.multiplyVector3(f.normal.clone());y=D.dot(s);if(y<0){s=s.dot((new THREE.Vector3).sub(i,A))/y;A=A.addSelf(D.multiplyScalar(s));
+if(f instanceof THREE.Face3){if(b(A,i,j,p)){f={distance:this.origin.distanceTo(A),point:A,face:f,object:a};K.push(f)}}else if(f instanceof THREE.Face4&&(b(A,i,j,n)||b(A,j,p,n))){f={distance:this.origin.distanceTo(A),point:A,face:f,object:a};K.push(f)}}}return K}};
+THREE.Rectangle=function(){function a(){i=e-b;j=f-c}var b,c,e,f,i,j,p=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return i};this.getHeight=function(){return j};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(n,s,y,A){p=!1;b=n;c=s;e=y;f=A;a()};this.addPoint=function(n,s){if(p){p=!1;b=n;c=s;e=n;f=s}else{b=b<n?b:n;c=c<s?c:s;e=e>n?e:n;f=f>s?f:s}a()};
+this.add3Points=function(n,s,y,A,D,z){if(p){p=!1;b=n<y?n<D?n:D:y<D?y:D;c=s<A?s<z?s:z:A<z?A:z;e=n>y?n>D?n:D:y>D?y:D;f=s>A?s>z?s:z:A>z?A:z}else{b=n<y?n<D?n<b?n:b:D<b?D:b:y<D?y<b?y:b:D<b?D:b;c=s<A?s<z?s<c?s:c:z<c?z:c:A<z?A<c?A:c:z<c?z:c;e=n>y?n>D?n>e?n:e:D>e?D:e:y>D?y>e?y:e:D>e?D:e;f=s>A?s>z?s>f?s:f:z>f?z:f:A>z?A>f?A:f:z>f?z:f}a()};this.addRectangle=function(n){if(p){p=!1;b=n.getLeft();c=n.getTop();e=n.getRight();f=n.getBottom()}else{b=b<n.getLeft()?b:n.getLeft();c=c<n.getTop()?c:n.getTop();e=e>n.getRight()?
 e:n.getRight();f=f>n.getBottom()?f:n.getBottom()}a()};this.inflate=function(n){b-=n;c-=n;e+=n;f+=n;a()};this.minSelf=function(n){b=b>n.getLeft()?b:n.getLeft();c=c>n.getTop()?c:n.getTop();e=e<n.getRight()?e:n.getRight();f=f<n.getBottom()?f:n.getBottom();a()};this.instersects=function(n){return Math.min(e,n.getRight())-Math.max(b,n.getLeft())>=0&&Math.min(f,n.getBottom())-Math.max(c,n.getTop())>=0};this.empty=function(){p=!0;f=e=c=b=0;a()};this.isEmpty=function(){return p}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,e,f,i,j,p,n,s,z,A,D,y,K,I){this.set(a||1,b||0,c||0,e||0,f||0,i||1,j||0,p||0,n||0,s||0,z||1,A||0,D||0,y||0,K||0,I||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,e,f,i,j,p,n,s,z,A,D,y,K,I){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=i;this.n23=j;this.n24=p;this.n31=n;this.n32=s;this.n33=z;this.n34=A;this.n41=D;this.n42=y;this.n43=K;this.n44=I;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,b,c,e,f,i,j,p,n,s,y,A,D,z,J,K){this.set(a||1,b||0,c||0,e||0,f||0,i||1,j||0,p||0,n||0,s||0,y||1,A||0,D||0,z||0,J||0,K||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,e,f,i,j,p,n,s,y,A,D,z,J,K){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=i;this.n23=j;this.n24=p;this.n31=n;this.n32=s;this.n33=y;this.n34=A;this.n41=D;this.n42=z;this.n43=J;this.n44=K;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
 f=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(a,b).normalize();if(i.length()===0)i.z=1;e.cross(c,i).normalize();if(e.length()===0){i.x+=1.0E-4;e.cross(c,i).normalize()}f.cross(i,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=i.x;this.n21=e.y;this.n22=f.y;this.n23=i.y;this.n31=e.z;this.n32=f.z;this.n33=i.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*
 e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,i=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,z=a.n31,A=a.n32,D=a.n33,y=a.n34,K=a.n41,I=a.n42,N=a.n43,O=a.n44,ja=b.n11,R=b.n12,B=b.n13,la=b.n14,T=b.n21,ma=b.n22,
-d=b.n23,P=b.n24,M=b.n31,ya=b.n32,ka=b.n33,na=b.n34;this.n11=c*ja+e*T+f*M;this.n12=c*R+e*ma+f*ya;this.n13=c*B+e*d+f*ka;this.n14=c*la+e*P+f*na+i;this.n21=j*ja+p*T+n*M;this.n22=j*R+p*ma+n*ya;this.n23=j*B+p*d+n*ka;this.n24=j*la+p*P+n*na+s;this.n31=z*ja+A*T+D*M;this.n32=z*R+A*ma+D*ya;this.n33=z*B+A*d+D*ka;this.n34=z*la+A*P+D*na+y;this.n41=K*ja+I*T+N*M;this.n42=K*R+I*ma+N*ya;this.n43=K*B+I*d+N*ka;this.n44=K*la+I*P+N*na+O;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=
-this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
-a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,i=this.n22,j=this.n23,p=this.n24,n=this.n31,s=this.n32,z=this.n33,A=this.n34,D=this.n41,y=this.n42,K=this.n43,I=this.n44;return e*j*s*D-c*p*s*D-e*i*z*D+b*p*z*D+c*i*A*D-b*j*A*D-e*j*n*y+c*p*n*y+e*f*z*y-a*p*z*y-c*f*A*y+a*j*A*y+e*i*n*K-b*p*n*K-e*f*s*K+a*p*s*K+b*f*A*K-a*i*A*K-c*i*n*I+b*j*n*I+c*f*s*I-a*j*s*I-b*f*z*I+a*i*z*I},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,i=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,y=a.n31,A=a.n32,D=a.n33,z=a.n34,J=a.n41,K=a.n42,O=a.n43,L=a.n44,ha=b.n11,ma=b.n12,pa=b.n13,R=b.n14,B=b.n21,sa=b.n22,
+d=b.n23,Da=b.n24,Aa=b.n31,Q=b.n32,N=b.n33,ta=b.n34;this.n11=c*ha+e*B+f*Aa;this.n12=c*ma+e*sa+f*Q;this.n13=c*pa+e*d+f*N;this.n14=c*R+e*Da+f*ta+i;this.n21=j*ha+p*B+n*Aa;this.n22=j*ma+p*sa+n*Q;this.n23=j*pa+p*d+n*N;this.n24=j*R+p*Da+n*ta+s;this.n31=y*ha+A*B+D*Aa;this.n32=y*ma+A*sa+D*Q;this.n33=y*pa+A*d+D*N;this.n34=y*R+A*Da+D*ta+z;this.n41=J*ha+K*B+O*Aa;this.n42=J*ma+K*sa+O*Q;this.n43=J*pa+K*d+O*N;this.n44=J*R+K*Da+O*ta+L;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;
+c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
+a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,i=this.n22,j=this.n23,p=this.n24,n=this.n31,s=this.n32,y=this.n33,A=this.n34,D=this.n41,z=this.n42,J=this.n43,K=this.n44;return e*j*s*D-c*p*s*D-e*i*y*D+b*p*y*D+c*i*A*D-b*j*A*D-e*j*n*z+c*p*n*z+e*f*y*z-a*p*y*z-c*f*A*z+a*j*A*z+e*i*n*J-b*p*n*J-e*f*s*J+a*p*s*J+b*f*A*J-a*i*A*J-c*i*n*K+b*j*n*K+c*f*s*K-a*j*s*K-b*f*y*K+a*i*y*K},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
 this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=
 this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;
 a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,
@@ -34,9 +34,9 @@ a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=t
 1-c,i=a.x,j=a.y,p=a.z,n=f*i,s=f*j;this.set(n*i+c,n*j-e*p,n*p+e*j,0,n*j+e*p,s*j+c,s*p-e*i,0,n*p-e*j,s*p+e*i,f*p*p+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 f=Math.cos(c);c=Math.sin(c);var i=Math.cos(e);e=Math.sin(e);var j=a*c,p=b*c;this.n11=f*i;this.n12=-f*e;this.n13=c;this.n21=p*i+a*e;this.n22=-p*e+a*i;this.n23=-b*f;this.n31=-j*i+b*e;this.n32=j*e+b*i;this.n33=
 a*f;return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,f=a.w,i=b+b,j=c+c,p=e+e;a=b*i;var n=b*j;b*=p;var s=c*j;c*=p;e*=p;i*=f;j*=f;f*=p;this.n11=1-(s+e);this.n12=n-f;this.n13=b+j;this.n21=n+f;this.n22=1-(a+e);this.n23=c-i;this.n31=b-j;this.n32=c+i;this.n33=1-(a+s);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
 a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,f=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,i=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,z=a.n31,A=a.n32,D=a.n33,y=a.n34,K=a.n41,I=a.n42,N=a.n43,O=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*y*I-s*D*I+s*A*N-p*y*N-n*A*O+p*D*O;b.n12=i*D*I-f*y*I-i*A*N+e*y*N+f*A*O-e*D*O;b.n13=f*s*I-i*n*I+i*p*N-e*s*N-f*p*O+e*n*O;b.n14=i*n*A-f*s*A-i*p*D+e*s*D+f*p*y-e*n*y;b.n21=s*D*K-n*y*K-s*z*N+j*y*N+n*z*O-j*D*O;b.n22=f*y*K-i*D*K+i*z*N-c*y*N-f*z*O+c*D*O;b.n23=i*n*K-f*s*K-i*j*N+c*s*N+f*j*O-c*n*O;
-b.n24=f*s*z-i*n*z+i*j*D-c*s*D-f*j*y+c*n*y;b.n31=p*y*K-s*A*K+s*z*I-j*y*I-p*z*O+j*A*O;b.n32=i*A*K-e*y*K-i*z*I+c*y*I+e*z*O-c*A*O;b.n33=f*s*K-i*p*K+i*j*I-c*s*I-e*j*O+c*p*O;b.n34=i*p*z-e*s*z-i*j*A+c*s*A+e*j*y-c*p*y;b.n41=n*A*K-p*D*K-n*z*I+j*D*I+p*z*N-j*A*N;b.n42=e*D*K-f*A*K+f*z*I-c*D*I-e*z*N+c*A*N;b.n43=f*p*K-e*n*K-f*j*I+c*n*I+e*j*N-c*p*N;b.n44=e*n*z-f*p*z+f*j*A-c*n*A-e*j*D+c*p*D;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,p=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,s=a.n23*a.n12-a.n22*a.n13,z=-a.n23*a.n11+a.n21*a.n13,A=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*j+a.n31*s;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*i;c[3]=a*j;c[4]=a*p;c[5]=a*n;c[6]=a*s;c[7]=a*z;c[8]=a*A;return b};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,i=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,y=a.n31,A=a.n32,D=a.n33,z=a.n34,J=a.n41,K=a.n42,O=a.n43,L=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*z*K-s*D*K+s*A*O-p*z*O-n*A*L+p*D*L;b.n12=i*D*K-f*z*K-i*A*O+e*z*O+f*A*L-e*D*L;b.n13=f*s*K-i*n*K+i*p*O-e*s*O-f*p*L+e*n*L;b.n14=i*n*A-f*s*A-i*p*D+e*s*D+f*p*z-e*n*z;b.n21=s*D*J-n*z*J-s*y*O+j*z*O+n*y*L-j*D*L;b.n22=f*z*J-i*D*J+i*y*O-c*z*O-f*y*L+c*D*L;b.n23=i*n*J-f*s*J-i*j*O+c*s*O+f*j*L-c*n*L;
+b.n24=f*s*y-i*n*y+i*j*D-c*s*D-f*j*z+c*n*z;b.n31=p*z*J-s*A*J+s*y*K-j*z*K-p*y*L+j*A*L;b.n32=i*A*J-e*z*J-i*y*K+c*z*K+e*y*L-c*A*L;b.n33=f*s*J-i*p*J+i*j*K-c*s*K-e*j*L+c*p*L;b.n34=i*p*y-e*s*y-i*j*A+c*s*A+e*j*z-c*p*z;b.n41=n*A*J-p*D*J-n*y*K+j*D*K+p*y*O-j*A*O;b.n42=e*D*J-f*A*J+f*y*K-c*D*K-e*y*O+c*A*O;b.n43=f*p*J-e*n*J-f*j*K+c*n*K+e*j*O-c*p*O;b.n44=e*n*y-f*p*y+f*j*A-c*n*A-e*j*D+c*p*D;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,p=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,s=a.n23*a.n12-a.n22*a.n13,y=-a.n23*a.n11+a.n21*a.n13,A=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*j+a.n31*s;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*i;c[3]=a*j;c[4]=a*p;c[5]=a*n;c[6]=a*s;c[7]=a*y;c[8]=a*A;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,e,f,i){var j;j=new THREE.Matrix4;j.n11=2*f/(b-a);j.n12=0;j.n13=(b+a)/(b-a);j.n14=0;j.n21=0;j.n22=2*f/(e-c);j.n23=(e+c)/(e-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(i+f)/(i-f);j.n34=-2*i*f/(i-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,b,c,e){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
 THREE.Matrix4.makeOrtho=function(a,b,c,e,f,i){var j,p,n,s;j=new THREE.Matrix4;p=b-a;n=c-e;s=i-f;j.n11=2/p;j.n12=0;j.n13=0;j.n14=-((b+a)/p);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((c+e)/n);j.n31=0;j.n32=0;j.n33=-2/s;j.n34=-((i+f)/s);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
@@ -47,8 +47,8 @@ undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b
 b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?e:1)};
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-f);f=Math.sin(-f);var i=Math.cos(c);c=Math.sin(c);var j=a*b,p=e*f;this.w=j*i-p*c;this.x=j*c+p*i;this.y=e*b*i+a*f*c;this.z=a*f*i-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,f=this.w,i=a.x,j=a.y,p=a.z;a=a.w;this.x=b*a+f*i+c*p-e*j;this.y=c*a+f*j+e*i-b*p;this.z=e*a+f*p+b*j-c*i;this.w=f*a-b*i-c*j-e*p;return this},
-multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,i=this.x,j=this.y,p=this.z,n=this.w,s=n*c+j*f-p*e,z=n*e+p*c-i*f,A=n*f+i*e-j*c;c=-i*c-j*e-p*f;b.x=s*n+c*-i+z*-p-A*-j;b.y=z*n+c*-j+A*-i-s*-p;b.z=A*n+c*-p+s*-j-z*-i;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var i=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-e)*i)/j;e=Math.sin(e*i)/j;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,i=this.x,j=this.y,p=this.z,n=this.w,s=n*c+j*f-p*e,y=n*e+p*c-i*f,A=n*f+i*e-j*c;c=-i*c-j*e-p*f;b.x=s*n+c*-i+y*-p-A*-j;b.y=y*n+c*-j+A*-i-s*-p;b.z=A*n+c*-p+s*-j-y*-i;return b}};
+THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var i=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-e)*i)/j;e=Math.sin(e*i)/j;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,f,i){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,f,i,j){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
 THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -56,26 +56,26 @@ 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,e,f,i,j,p=new THREE.Vector3,n=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){i=this.faces[e];if(a&&i.vertexNormals.length){p.set(0,0,0);b=0;for(c=i.vertexNormals.length;b<c;b++)p.addSelf(i.vertexNormals[b]);p.divideScalar(3)}else{b=this.vertices[i.a];c=this.vertices[i.b];j=this.vertices[i.c];p.sub(j.position,c.position);n.sub(b.position,c.position);p.crossSelf(n)}p.isZero()||
 p.normalize();i.normal.copy(p)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){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{e=
 this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal);e[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(e[c.a]);
-c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c]);c.vertexNormals[3].copy(e[c.d])}}},computeTangents:function(){function a(na,oa,U,ha,wa,pa,X){i=na.vertices[oa].position;j=na.vertices[U].position;p=na.vertices[ha].position;n=f[wa];s=f[pa];z=f[X];A=j.x-i.x;D=p.x-i.x;y=j.y-i.y;K=p.y-i.y;I=j.z-i.z;N=p.z-i.z;O=s.u-n.u;ja=z.u-n.u;R=s.v-n.v;B=z.v-n.v;la=1/(O*B-
-ja*R);d.set((B*A-R*D)*la,(B*y-R*K)*la,(B*I-R*N)*la);P.set((O*D-ja*A)*la,(O*K-ja*y)*la,(O*N-ja*I)*la);T[oa].addSelf(d);T[U].addSelf(d);T[ha].addSelf(d);ma[oa].addSelf(P);ma[U].addSelf(P);ma[ha].addSelf(P)}var b,c,e,f,i,j,p,n,s,z,A,D,y,K,I,N,O,ja,R,B,la,T=[],ma=[],d=new THREE.Vector3,P=new THREE.Vector3,M=new THREE.Vector3,ya=new THREE.Vector3,ka=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){T[b]=new THREE.Vector3;ma[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];
-f=this.faceVertexUvs[b][0];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=
-0;for(c=this.vertices.length;b<c;b++){ka.copy(this.vertices[b].normal);e=T[b];M.copy(e);M.subSelf(ka.multiplyScalar(ka.dot(e))).normalize();ya.cross(this.vertices[b].normal,e);e=ya.dot(ma[b]);e=e<0?-1:1;this.vertices[b].tangent.set(M.x,M.y,M.z,e)}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]};
+c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c]);c.vertexNormals[3].copy(e[c.d])}}},computeTangents:function(){function a(ta,ua,Ba,ia,V,ja,ka){i=ta.vertices[ua].position;j=ta.vertices[Ba].position;p=ta.vertices[ia].position;n=f[V];s=f[ja];y=f[ka];A=j.x-i.x;D=p.x-i.x;z=j.y-i.y;J=p.y-i.y;K=j.z-i.z;O=p.z-i.z;L=s.u-n.u;ha=y.u-n.u;ma=s.v-n.v;pa=y.v-n.v;R=1/(L*
+pa-ha*ma);d.set((pa*A-ma*D)*R,(pa*z-ma*J)*R,(pa*K-ma*O)*R);Da.set((L*D-ha*A)*R,(L*J-ha*z)*R,(L*O-ha*K)*R);B[ua].addSelf(d);B[Ba].addSelf(d);B[ia].addSelf(d);sa[ua].addSelf(Da);sa[Ba].addSelf(Da);sa[ia].addSelf(Da)}var b,c,e,f,i,j,p,n,s,y,A,D,z,J,K,O,L,ha,ma,pa,R,B=[],sa=[],d=new THREE.Vector3,Da=new THREE.Vector3,Aa=new THREE.Vector3,Q=new THREE.Vector3,N=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){B[b]=new THREE.Vector3;sa[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=
+this.faces[b];f=this.faceVertexUvs[b][0];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=
+0;for(c=this.vertices.length;b<c;b++){N.copy(this.vertices[b].normal);e=B[b];Aa.copy(e);Aa.subSelf(N.multiplyScalar(N.dot(e))).normalize();Q.cross(this.vertices[b].normal,e);e=Q.dot(sa[b]);e=e<0?-1:1;this.vertices[b].tangent.set(Aa.x,Aa.y,Aa.z,e)}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}}};THREE.GeometryIdCounter=0;
 THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(f){for(var i=0;i<a.length;i++)a[i].update(f)};c.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};c.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};c.add=function(f){b[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");b[f.name]=f;if(f.initialized!==!0){for(var i=0;i<f.hierarchy.length;i++){for(var j=0;j<f.hierarchy[i].keys.length;j++){if(f.hierarchy[i].keys[j].time<
-0)f.hierarchy[i].keys[j].time=0;if(f.hierarchy[i].keys[j].rot!==undefined&&!(f.hierarchy[i].keys[j].rot instanceof THREE.Quaternion)){var p=f.hierarchy[i].keys[j].rot;f.hierarchy[i].keys[j].rot=new THREE.Quaternion(p[0],p[1],p[2],p[3])}}if(f.hierarchy[i].keys[0].morphTargets!==undefined){p={};for(j=0;j<f.hierarchy[i].keys.length;j++)for(var n=0;n<f.hierarchy[i].keys[j].morphTargets.length;n++){var s=f.hierarchy[i].keys[j].morphTargets[n];p[s]=-1}f.hierarchy[i].usedMorphTargets=p;for(j=0;j<f.hierarchy[i].keys.length;j++){var z=
-{};for(s in p){for(n=0;n<f.hierarchy[i].keys[j].morphTargets.length;n++)if(f.hierarchy[i].keys[j].morphTargets[n]===s){z[s]=f.hierarchy[i].keys[j].morphTargetsInfluences[n];break}n===f.hierarchy[i].keys[j].morphTargets.length&&(z[s]=0)}f.hierarchy[i].keys[j].morphTargetsInfluences=z}}for(j=1;j<f.hierarchy[i].keys.length;j++)if(f.hierarchy[i].keys[j].time===f.hierarchy[i].keys[j-1].time){f.hierarchy[i].keys.splice(j,1);j--}for(j=1;j<f.hierarchy[i].keys.length;j++)f.hierarchy[i].keys[j].index=j}j=parseInt(f.length*
+0)f.hierarchy[i].keys[j].time=0;if(f.hierarchy[i].keys[j].rot!==undefined&&!(f.hierarchy[i].keys[j].rot instanceof THREE.Quaternion)){var p=f.hierarchy[i].keys[j].rot;f.hierarchy[i].keys[j].rot=new THREE.Quaternion(p[0],p[1],p[2],p[3])}}if(f.hierarchy[i].keys[0].morphTargets!==undefined){p={};for(j=0;j<f.hierarchy[i].keys.length;j++)for(var n=0;n<f.hierarchy[i].keys[j].morphTargets.length;n++){var s=f.hierarchy[i].keys[j].morphTargets[n];p[s]=-1}f.hierarchy[i].usedMorphTargets=p;for(j=0;j<f.hierarchy[i].keys.length;j++){var y=
+{};for(s in p){for(n=0;n<f.hierarchy[i].keys[j].morphTargets.length;n++)if(f.hierarchy[i].keys[j].morphTargets[n]===s){y[s]=f.hierarchy[i].keys[j].morphTargetsInfluences[n];break}n===f.hierarchy[i].keys[j].morphTargets.length&&(y[s]=0)}f.hierarchy[i].keys[j].morphTargetsInfluences=y}}for(j=1;j<f.hierarchy[i].keys.length;j++)if(f.hierarchy[i].keys[j].time===f.hierarchy[i].keys[j-1].time){f.hierarchy[i].keys.splice(j,1);j--}for(j=1;j<f.hierarchy[i].keys.length;j++)f.hierarchy[i].keys[j].index=j}j=parseInt(f.length*
 f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(i=0;i<f.hierarchy.length;i++)f.JIT.hierarchy.push(Array(j));f.initialized=!0}};c.get=function(f){if(typeof f==="string")if(b[f])return b[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};c.parse=function(f){var i=[];if(f instanceof THREE.SkinnedMesh)for(var j=0;j<f.bones.length;j++)i.push(f.bones[j]);else e(f,i);return i};var e=function(f,i){i.push(f);for(var j=0;j<f.children.length;j++)e(f.children[j],i)};c.LINEAR=
 0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,e=this.hierarchy.length,f;for(c=0;c<e;c++){f=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
 f instanceof THREE.Bone?f.skinMatrix:f.matrix}var i=f.animationCache.prevKey;f=f.animationCache.nextKey;i.pos=this.data.hierarchy[c].keys[0];i.rot=this.data.hierarchy[c].keys[0];i.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,f,i,j,p,n,s,z=this.data.JIT.hierarchy,A,D;this.currentTime+=a*this.timeScale;D=this.currentTime;A=this.currentTime%=this.data.length;s=parseInt(Math.min(A*this.data.fps,this.data.length*this.data.fps),10);for(var y=0,K=this.hierarchy.length;y<K;y++){a=this.hierarchy[y];n=a.animationCache;if(this.JITCompile&&z[y][s]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=z[y][s];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=z[y][s];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var I=0;I<3;I++){c=b[I];j=n.prevKey[c];p=n.nextKey[c];if(p.time<=D){if(A<D)if(this.loop){j=this.data.hierarchy[y].keys[0];for(p=this.getNextKeyWith(c,y,1);p.time<A;){j=p;p=this.getNextKeyWith(c,y,p.index+1)}}else{this.stop();return}else{do{j=p;p=this.getNextKeyWith(c,y,p.index+1)}while(p.time<
-A)}n.prevKey[c]=j;n.nextKey[c]=p}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(A-j.time)/(p.time-j.time);f=j[c];i=p[c];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+y);e=e<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=f[0]+(i[0]-f[0])*e;c.y=f[1]+(i[1]-f[1])*e;c.z=f[2]+(i[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",y,j.index-1).pos;this.points[1]=f;this.points[2]=i;this.points[3]=this.getNextKeyWith("pos",y,p.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);c.x=f[0];c.y=f[1];c.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(c===
-"rot")THREE.Quaternion.slerp(f,i,a.quaternion,e);else if(c==="scl"){c=a.scale;c.x=f[0]+(i[0]-f[0])*e;c.y=f[1]+(i[1]-f[1])*e;c.z=f[2]+(i[2]-f[2])*e}}}}if(this.JITCompile&&z[0][s]===undefined){this.hierarchy[0].update(undefined,!0);for(y=0;y<this.hierarchy.length;y++)z[y][s]=this.hierarchy[y]instanceof THREE.Bone?this.hierarchy[y].skinMatrix.clone():this.hierarchy[y].matrix.clone()}}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,f,i,j,p,n,s,y=this.data.JIT.hierarchy,A,D;this.currentTime+=a*this.timeScale;D=this.currentTime;A=this.currentTime%=this.data.length;s=parseInt(Math.min(A*this.data.fps,this.data.length*this.data.fps),10);for(var z=0,J=this.hierarchy.length;z<J;z++){a=this.hierarchy[z];n=a.animationCache;if(this.JITCompile&&y[z][s]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=y[z][s];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=y[z][s];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var K=0;K<3;K++){c=b[K];j=n.prevKey[c];p=n.nextKey[c];if(p.time<=D){if(A<D)if(this.loop){j=this.data.hierarchy[z].keys[0];for(p=this.getNextKeyWith(c,z,1);p.time<A;){j=p;p=this.getNextKeyWith(c,z,p.index+1)}}else{this.stop();return}else{do{j=p;p=this.getNextKeyWith(c,z,p.index+1)}while(p.time<
+A)}n.prevKey[c]=j;n.nextKey[c]=p}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(A-j.time)/(p.time-j.time);f=j[c];i=p[c];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+z);e=e<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=f[0]+(i[0]-f[0])*e;c.y=f[1]+(i[1]-f[1])*e;c.z=f[2]+(i[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",z,j.index-1).pos;this.points[1]=f;this.points[2]=i;this.points[3]=this.getNextKeyWith("pos",z,p.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);c.x=f[0];c.y=f[1];c.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(c===
+"rot")THREE.Quaternion.slerp(f,i,a.quaternion,e);else if(c==="scl"){c=a.scale;c.x=f[0]+(i[0]-f[0])*e;c.y=f[1]+(i[1]-f[1])*e;c.z=f[2]+(i[2]-f[2])*e}}}}if(this.JITCompile&&y[0][s]===undefined){this.hierarchy[0].update(undefined,!0);for(z=0;z<this.hierarchy.length;z++)y[z][s]=this.hierarchy[z]instanceof THREE.Bone?this.hierarchy[z].skinMatrix.clone():this.hierarchy[z].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],f,i,j,p,n,s;f=(a.length-1)*b;i=Math.floor(f);f-=i;c[0]=i==0?i:i-1;c[1]=i;c[2]=i>a.length-2?i:i+1;c[3]=i>a.length-3?i:i+2;i=a[c[0]];p=a[c[1]];n=a[c[2]];s=a[c[3]];c=f*f;j=f*c;e[0]=this.interpolate(i[0],p[0],n[0],s[0],f,c,j);e[1]=this.interpolate(i[1],p[1],n[1],s[1],f,c,j);e[2]=this.interpolate(i[2],p[2],n[2],s[2],f,c,j);return e};
 THREE.Animation.prototype.interpolate=function(a,b,c,e,f,i,j){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*j+(-3*(b-c)-2*a-e)*i+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<e.length-1?c:e.length-1;else c%=e.length;for(;c<e.length;c++)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
@@ -139,16 +139,17 @@ THREE.LOD.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updat
 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.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}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.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}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.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==undefined?b:2.5E-4};
-THREE.Projector=function(){function a(){var P=n[p]=n[p]||new THREE.RenderableVertex;p++;return P}function b(P,M){return M.z-P.z}function c(P,M){var ya=0,ka=1,na=P.z+P.w,oa=M.z+M.w,U=-P.z+P.w,ha=-M.z+M.w;if(na>=0&&oa>=0&&U>=0&&ha>=0)return!0;else if(na<0&&oa<0||U<0&&ha<0)return!1;else{if(na<0)ya=Math.max(ya,na/(na-oa));else oa<0&&(ka=Math.min(ka,na/(na-oa)));if(U<0)ya=Math.max(ya,U/(U-ha));else ha<0&&(ka=Math.min(ka,U/(U-ha)));if(ka<ya)return!1;else{P.lerpSelf(M,ya);M.lerpSelf(P,1-ka);return!0}}}var e,
-f,i=[],j,p,n=[],s,z,A=[],D,y,K=[],I,N,O=[],ja=new THREE.Vector4,R=new THREE.Vector4,B=new THREE.Matrix4,la=new THREE.Matrix4,T=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ma=new THREE.Vector4,d=new THREE.Vector4;this.projectVector=function(P,M){B.multiply(M.projectionMatrix,M.matrixWorldInverse);B.multiplyVector3(P);return P};this.unprojectVector=function(P,M){B.multiply(THREE.Matrix4.makeInvert(M.projectionMatrix),M.matrixWorld);B.multiplyVector3(P);
-return P};this.projectObjects=function(P,M,ya){M=[];var ka,na,oa;f=0;na=P.objects;P=0;for(ka=na.length;P<ka;P++){oa=na[P];var U;if(!(U=!oa.visible))if(U=oa instanceof THREE.Mesh){a:{U=void 0;for(var ha=oa.matrixWorld,wa=-oa.geometry.boundingSphere.radius*Math.max(oa.scale.x,Math.max(oa.scale.y,oa.scale.z)),pa=0;pa<6;pa++){U=T[pa].x*ha.n14+T[pa].y*ha.n24+T[pa].z*ha.n34+T[pa].w;if(U<=wa){U=!1;break a}}U=!0}U=!U}if(!U){U=i[f]=i[f]||new THREE.RenderableObject;f++;e=U;ja.copy(oa.position);B.multiplyVector3(ja);
-e.object=oa;e.z=ja.z;M.push(e)}}ya&&M.sort(b);return M};this.projectScene=function(P,M,ya){var ka=[],na=M.near,oa=M.far,U,ha,wa,pa,X,ra,Aa,Ma,Ga,ia,Ka,Ta,Wa,Xa,g,m,o;N=y=z=0;M.matrixAutoUpdate&&M.updateMatrix();P.update(undefined,!1,M);B.multiply(M.projectionMatrix,M.matrixWorldInverse);T[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);T[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);T[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);T[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-
-B.n23,B.n44-B.n24);T[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);T[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(U=0;U<6;U++){Ga=T[U];Ga.divideScalar(Math.sqrt(Ga.x*Ga.x+Ga.y*Ga.y+Ga.z*Ga.z))}Ga=this.projectObjects(P,M,!0);P=0;for(U=Ga.length;P<U;P++){ia=Ga[P].object;if(ia.visible){Ka=ia.matrixWorld;Ta=ia.matrixRotationWorld;Wa=ia.materials;Xa=ia.overdraw;p=0;if(ia instanceof THREE.Mesh){g=ia.geometry;pa=g.vertices;m=g.faces;g=g.faceVertexUvs;ha=0;for(wa=pa.length;ha<wa;ha++){j=
-a();j.positionWorld.copy(pa[ha].position);Ka.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);B.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>na&&j.positionScreen.z<oa}pa=0;for(ha=m.length;pa<ha;pa++){wa=m[pa];if(wa instanceof THREE.Face3){X=n[wa.a];ra=n[wa.b];Aa=n[wa.c];if(X.visible&&ra.visible&&Aa.visible&&(ia.doubleSided||ia.flipSided!=(Aa.positionScreen.x-X.positionScreen.x)*(ra.positionScreen.y-
-X.positionScreen.y)-(Aa.positionScreen.y-X.positionScreen.y)*(ra.positionScreen.x-X.positionScreen.x)<0)){Ma=A[z]=A[z]||new THREE.RenderableFace3;z++;s=Ma;s.v1.copy(X);s.v2.copy(ra);s.v3.copy(Aa);s.normalWorld.copy(wa.normal);Ta.multiplyVector3(s.normalWorld);s.centroidWorld.copy(wa.centroid);Ka.multiplyVector3(s.centroidWorld);s.centroidScreen.copy(s.centroidWorld);B.multiplyVector3(s.centroidScreen);Aa=wa.vertexNormals;X=0;for(ra=Aa.length;X<ra;X++){Ma=s.vertexNormalsWorld[X];Ma.copy(Aa[X]);Ta.multiplyVector3(Ma)}X=
-0;for(ra=g.length;X<ra;X++)if(o=g[X][pa]){Aa=0;for(Ma=o.length;Aa<Ma;Aa++)s.uvs[X][Aa]=o[Aa]}s.meshMaterials=Wa;s.faceMaterials=wa.materials;s.overdraw=Xa;s.z=s.centroidScreen.z;ka.push(s)}}}}else if(ia instanceof THREE.Line){la.multiply(B,Ka);pa=ia.geometry.vertices;X=a();X.positionScreen.copy(pa[0].position);la.multiplyVector4(X.positionScreen);ha=1;for(wa=pa.length;ha<wa;ha++){X=a();X.positionScreen.copy(pa[ha].position);la.multiplyVector4(X.positionScreen);ra=n[p-2];ma.copy(X.positionScreen);
-d.copy(ra.positionScreen);if(c(ma,d)){ma.multiplyScalar(1/ma.w);d.multiplyScalar(1/d.w);Ka=K[y]=K[y]||new THREE.RenderableLine;y++;D=Ka;D.v1.positionScreen.copy(ma);D.v2.positionScreen.copy(d);D.z=Math.max(ma.z,d.z);D.materials=ia.materials;ka.push(D)}}}else if(ia instanceof THREE.Particle){R.set(ia.position.x,ia.position.y,ia.position.z,1);B.multiplyVector4(R);R.z/=R.w;if(R.z>0&&R.z<1){Ka=O[N]=O[N]||new THREE.RenderableParticle;N++;I=Ka;I.x=R.x/R.w;I.y=R.y/R.w;I.z=R.z;I.rotation=ia.rotation.z;I.scale.x=
-ia.scale.x*Math.abs(I.x-(R.x+M.projectionMatrix.n11)/(R.w+M.projectionMatrix.n14));I.scale.y=ia.scale.y*Math.abs(I.y-(R.y+M.projectionMatrix.n22)/(R.w+M.projectionMatrix.n24));I.materials=ia.materials;ka.push(I)}}}}ya&&ka.sort(b);return ka}};
+THREE.Projector=function(){function a(){var Q=n[p]=n[p]||new THREE.RenderableVertex;p++;return Q}function b(Q,N){return N.z-Q.z}function c(Q,N){var ta=0,ua=1,Ba=Q.z+Q.w,ia=N.z+N.w,V=-Q.z+Q.w,ja=-N.z+N.w;if(Ba>=0&&ia>=0&&V>=0&&ja>=0)return!0;else if(Ba<0&&ia<0||V<0&&ja<0)return!1;else{if(Ba<0)ta=Math.max(ta,Ba/(Ba-ia));else ia<0&&(ua=Math.min(ua,Ba/(Ba-ia)));if(V<0)ta=Math.max(ta,V/(V-ja));else ja<0&&(ua=Math.min(ua,V/(V-ja)));if(ua<ta)return!1;else{Q.lerpSelf(N,ta);N.lerpSelf(Q,1-ua);return!0}}}var e,
+f,i=[],j,p,n=[],s,y,A=[],D,z=[],J,K,O=[],L,ha,ma=[],pa=new THREE.Vector4,R=new THREE.Vector4,B=new THREE.Matrix4,sa=new THREE.Matrix4,d=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Vector4,Aa=new THREE.Vector4;this.projectVector=function(Q,N){B.multiply(N.projectionMatrix,N.matrixWorldInverse);B.multiplyVector3(Q);return Q};this.unprojectVector=function(Q,N){B.multiply(N.matrixWorld,THREE.Matrix4.makeInvert(N.projectionMatrix));
+B.multiplyVector3(Q);return Q};this.projectObjects=function(Q,N,ta){N=[];var ua,Ba,ia;f=0;Ba=Q.objects;Q=0;for(ua=Ba.length;Q<ua;Q++){ia=Ba[Q];var V;if(!(V=!ia.visible))if(V=ia instanceof THREE.Mesh){a:{V=void 0;for(var ja=ia.matrixWorld,ka=-ia.geometry.boundingSphere.radius*Math.max(ia.scale.x,Math.max(ia.scale.y,ia.scale.z)),X=0;X<6;X++){V=d[X].x*ja.n14+d[X].y*ja.n24+d[X].z*ja.n34+d[X].w;if(V<=ka){V=!1;break a}}V=!0}V=!V}if(!V){V=i[f]=i[f]||new THREE.RenderableObject;f++;e=V;pa.copy(ia.position);
+B.multiplyVector3(pa);e.object=ia;e.z=pa.z;N.push(e)}}ta&&N.sort(b);return N};this.projectScene=function(Q,N,ta){var ua=[],Ba=N.near,ia=N.far,V,ja,ka,X,S,xa,na,ya,Ka,la,Na,Va,g,m,o,h,k;ha=K=D=y=0;N.matrixAutoUpdate&&N.updateMatrix();Q.update(undefined,!1,N);B.multiply(N.projectionMatrix,N.matrixWorldInverse);d[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);d[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);d[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);d[3].set(B.n41-B.n21,
+B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);d[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);d[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(V=0;V<6;V++){Ka=d[V];Ka.divideScalar(Math.sqrt(Ka.x*Ka.x+Ka.y*Ka.y+Ka.z*Ka.z))}Ka=this.projectObjects(Q,N,!0);Q=0;for(V=Ka.length;Q<V;Q++){la=Ka[Q].object;if(la.visible){Na=la.matrixWorld;Va=la.matrixRotationWorld;g=la.materials;m=la.overdraw;p=0;if(la instanceof THREE.Mesh){o=la.geometry;X=o.vertices;h=o.faces;o=o.faceVertexUvs;ja=0;for(ka=X.length;ja<
+ka;ja++){j=a();j.positionWorld.copy(X[ja].position);Na.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);B.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Ba&&j.positionScreen.z<ia}X=0;for(ja=h.length;X<ja;X++){ka=h[X];if(ka instanceof THREE.Face3){S=n[ka.a];xa=n[ka.b];na=n[ka.c];if(S.visible&&xa.visible&&na.visible&&(la.doubleSided||la.flipSided!=(na.positionScreen.x-S.positionScreen.x)*
+(xa.positionScreen.y-S.positionScreen.y)-(na.positionScreen.y-S.positionScreen.y)*(xa.positionScreen.x-S.positionScreen.x)<0)){ya=A[y]=A[y]||new THREE.RenderableFace3;y++;s=ya;s.v1.copy(S);s.v2.copy(xa);s.v3.copy(na)}else continue}else if(ka instanceof THREE.Face4){S=n[ka.a];xa=n[ka.b];na=n[ka.c];ya=n[ka.d];if(S.visible&&xa.visible&&na.visible&&ya.visible&&(la.doubleSided||la.flipSided!=((ya.positionScreen.x-S.positionScreen.x)*(xa.positionScreen.y-S.positionScreen.y)-(ya.positionScreen.y-S.positionScreen.y)*
+(xa.positionScreen.x-S.positionScreen.x)<0||(xa.positionScreen.x-na.positionScreen.x)*(ya.positionScreen.y-na.positionScreen.y)-(xa.positionScreen.y-na.positionScreen.y)*(ya.positionScreen.x-na.positionScreen.x)<0))){k=z[D]=z[D]||new THREE.RenderableFace4;D++;s=k;s.v1.copy(S);s.v2.copy(xa);s.v3.copy(na);s.v4.copy(ya)}else continue}s.normalWorld.copy(ka.normal);Va.multiplyVector3(s.normalWorld);s.centroidWorld.copy(ka.centroid);Na.multiplyVector3(s.centroidWorld);s.centroidScreen.copy(s.centroidWorld);
+B.multiplyVector3(s.centroidScreen);na=ka.vertexNormals;S=0;for(xa=na.length;S<xa;S++){ya=s.vertexNormalsWorld[S];ya.copy(na[S]);Va.multiplyVector3(ya)}S=0;for(xa=o.length;S<xa;S++)if(k=o[S][X]){na=0;for(ya=k.length;na<ya;na++)s.uvs[S][na]=k[na]}s.meshMaterials=g;s.faceMaterials=ka.materials;s.overdraw=m;s.z=s.centroidScreen.z;ua.push(s)}}else if(la instanceof THREE.Line){sa.multiply(B,Na);X=la.geometry.vertices;S=a();S.positionScreen.copy(X[0].position);sa.multiplyVector4(S.positionScreen);ja=1;
+for(ka=X.length;ja<ka;ja++){S=a();S.positionScreen.copy(X[ja].position);sa.multiplyVector4(S.positionScreen);xa=n[p-2];Da.copy(S.positionScreen);Aa.copy(xa.positionScreen);if(c(Da,Aa)){Da.multiplyScalar(1/Da.w);Aa.multiplyScalar(1/Aa.w);Na=O[K]=O[K]||new THREE.RenderableLine;K++;J=Na;J.v1.positionScreen.copy(Da);J.v2.positionScreen.copy(Aa);J.z=Math.max(Da.z,Aa.z);J.materials=la.materials;ua.push(J)}}}else if(la instanceof THREE.Particle){R.set(la.position.x,la.position.y,la.position.z,1);B.multiplyVector4(R);
+R.z/=R.w;if(R.z>0&&R.z<1){Na=ma[ha]=ma[ha]||new THREE.RenderableParticle;ha++;L=Na;L.x=R.x/R.w;L.y=R.y/R.w;L.z=R.z;L.rotation=la.rotation.z;L.scale.x=la.scale.x*Math.abs(L.x-(R.x+N.projectionMatrix.n11)/(R.w+N.projectionMatrix.n14));L.scale.y=la.scale.y*Math.abs(L.y-(R.y+N.projectionMatrix.n22)/(R.w+N.projectionMatrix.n24));L.materials=la.materials;ua.push(L)}}}}ta&&ua.sort(b);return ua}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var e,f=c.length;for(e=0;e<f;e++){a=c[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, 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 refractionRatio;\nuniform bool useRefract;\n#endif",
@@ -174,79 +175,79 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
 THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(a){function b(g,m,o){var h,k,t,q=g.vertices,r=q.length,E=g.colors,x=E.length,v=g.__vertexArray,L=g.__colorArray,V=g.__sortArray,H=g.__dirtyVertices,Q=g.__dirtyColors;if(o.sortParticles){Aa.multiplySelf(o.matrixWorld);for(h=0;h<r;h++){k=q[h].position;ia.copy(k);Aa.multiplyVector3(ia);V[h]=[ia.z,h]}V.sort(function(J,Y){return Y[0]-J[0]});for(h=0;h<r;h++){k=q[V[h][1]].position;t=h*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}for(h=0;h<x;h++){t=h*3;color=E[V[h][1]];L[t]=color.r;L[t+1]=
-color.g;L[t+2]=color.b}}else{if(H)for(h=0;h<r;h++){k=q[h].position;t=h*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}if(Q)for(h=0;h<x;h++){color=E[h];t=h*3;L[t]=color.r;L[t+1]=color.g;L[t+2]=color.b}}if(H||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,v,m)}if(Q||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,L,m)}}function c(g,m){g.fragmentShader=m.fragmentShader;g.vertexShader=m.vertexShader;g.uniforms=Uniforms.clone(m.uniforms)}
-function e(g,m,o,h,k){h.program||ya.initMaterial(h,m,o,k);var t=h.program,q=t.uniforms,r=h.uniforms;if(t!=P){d.useProgram(t);P=t}d.uniformMatrix4fv(q.projectionMatrix,!1,Ma);if(o&&(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial||h instanceof THREE.LineBasicMaterial||h instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(o.color.hex);if(o instanceof THREE.Fog){r.fogNear.value=o.near;r.fogFar.value=o.far}else if(o instanceof
-THREE.FogExp2)r.fogDensity.value=o.density}if(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h.lights){var E,x,v=0,L=0,V=0,H,Q,J,Y=Ka,Ca=Y.directional.colors,S=Y.directional.positions,Z=Y.point.colors,w=Y.point.positions,xa=0,W=0;o=x=x=0;for(E=m.length;o<E;o++){x=m[o];H=x.color;Q=x.position;J=x.intensity;if(x instanceof THREE.AmbientLight){v+=H.r;L+=H.g;V+=H.b}else if(x instanceof THREE.DirectionalLight){x=xa*3;Ca[x]=H.r*J;Ca[x+1]=H.g*J;Ca[x+2]=H.b*J;S[x]=Q.x;S[x+1]=
-Q.y;S[x+2]=Q.z;xa+=1}else if(x instanceof THREE.PointLight){x=W*3;Z[x]=H.r*J;Z[x+1]=H.g*J;Z[x+2]=H.b*J;w[x]=Q.x;w[x+1]=Q.y;w[x+2]=Q.z;W+=1}}for(o=xa*3;o<Ca.length;o++)Ca[o]=0;for(o=W*3;o<Z.length;o++)Z[o]=0;Y.point.length=W;Y.directional.length=xa;Y.ambient[0]=v;Y.ambient[1]=L;Y.ambient[2]=V;m=Ka;r.enableLighting.value=m.directional.length+m.point.length;r.ambientLightColor.value=m.ambient;r.directionalLightColor.value=m.directional.colors;r.directionalLightDirection.value=m.directional.positions;
+THREE.WebGLRenderer=function(a){function b(g,m,o){var h,k,t,q=g.vertices,r=q.length,E=g.colors,x=E.length,v=g.__vertexArray,M=g.__colorArray,U=g.__sortArray,H=g.__dirtyVertices,P=g.__dirtyColors;if(o.sortParticles){S.multiplySelf(o.matrixWorld);for(h=0;h<r;h++){k=q[h].position;ya.copy(k);S.multiplyVector3(ya);U[h]=[ya.z,h]}U.sort(function(I,Y){return Y[0]-I[0]});for(h=0;h<r;h++){k=q[U[h][1]].position;t=h*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}for(h=0;h<x;h++){t=h*3;color=E[U[h][1]];M[t]=color.r;M[t+1]=
+color.g;M[t+2]=color.b}}else{if(H)for(h=0;h<r;h++){k=q[h].position;t=h*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}if(P)for(h=0;h<x;h++){color=E[h];t=h*3;M[t]=color.r;M[t+1]=color.g;M[t+2]=color.b}}if(H||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,v,m)}if(P||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,M,m)}}function c(g,m){g.fragmentShader=m.fragmentShader;g.vertexShader=m.vertexShader;g.uniforms=Uniforms.clone(m.uniforms)}
+function e(g,m,o,h,k){h.program||Q.initMaterial(h,m,o,k);var t=h.program,q=t.uniforms,r=h.uniforms;if(t!=Da){d.useProgram(t);Da=t}d.uniformMatrix4fv(q.projectionMatrix,!1,xa);if(o&&(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial||h instanceof THREE.LineBasicMaterial||h instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(o.color.hex);if(o instanceof THREE.Fog){r.fogNear.value=o.near;r.fogFar.value=o.far}else if(o instanceof
+THREE.FogExp2)r.fogDensity.value=o.density}if(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h.lights){var E,x,v=0,M=0,U=0,H,P,I,Y=Ka,Fa=Y.directional.colors,T=Y.directional.positions,Z=Y.point.colors,w=Y.point.positions,za=0,W=0;o=x=x=0;for(E=m.length;o<E;o++){x=m[o];H=x.color;P=x.position;I=x.intensity;if(x instanceof THREE.AmbientLight){v+=H.r;M+=H.g;U+=H.b}else if(x instanceof THREE.DirectionalLight){x=za*3;Fa[x]=H.r*I;Fa[x+1]=H.g*I;Fa[x+2]=H.b*I;T[x]=P.x;T[x+1]=
+P.y;T[x+2]=P.z;za+=1}else if(x instanceof THREE.PointLight){x=W*3;Z[x]=H.r*I;Z[x+1]=H.g*I;Z[x+2]=H.b*I;w[x]=P.x;w[x+1]=P.y;w[x+2]=P.z;W+=1}}for(o=za*3;o<Fa.length;o++)Fa[o]=0;for(o=W*3;o<Z.length;o++)Z[o]=0;Y.point.length=W;Y.directional.length=za;Y.ambient[0]=v;Y.ambient[1]=M;Y.ambient[2]=U;m=Ka;r.enableLighting.value=m.directional.length+m.point.length;r.ambientLightColor.value=m.ambient;r.directionalLightColor.value=m.directional.colors;r.directionalLightDirection.value=m.directional.positions;
 r.pointLightColor.value=m.point.colors;r.pointLightPosition.value=m.point.positions}if(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);r.opacity.value=h.opacity;r.map.texture=h.map;r.lightMap.texture=h.lightMap;r.envMap.texture=h.envMap;r.reflectivity.value=h.reflectivity;r.refractionRatio.value=h.refractionRatio;r.combine.value=h.combine;r.useRefract.value=
-h.envMap&&h.envMap.mapping instanceof THREE.CubeRefractionMapping}if(h instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);r.opacity.value=h.opacity}else if(h instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);r.opacity.value=h.opacity;r.size.value=h.size;r.scale.value=ma.height/2;r.map.texture=h.map}else if(h instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(h.ambient.r,
-h.ambient.g,h.ambient.b);r.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);r.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){r.mNear.value=g.near;r.mFar.value=g.far;r.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)r.opacity.value=h.opacity;for(var Da in r)if(v=t.uniforms[Da]){o=r[Da];E=o.type;m=o.value;if(E=="i")d.uniform1i(v,m);else if(E=="f")d.uniform1f(v,m);else if(E=="fv1")d.uniform1fv(v,m);else if(E=="fv")d.uniform3fv(v,m);else if(E==
+h.envMap&&h.envMap.mapping instanceof THREE.CubeRefractionMapping}if(h instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);r.opacity.value=h.opacity}else if(h instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);r.opacity.value=h.opacity;r.size.value=h.size;r.scale.value=sa.height/2;r.map.texture=h.map}else if(h instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(h.ambient.r,
+h.ambient.g,h.ambient.b);r.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);r.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){r.mNear.value=g.near;r.mFar.value=g.far;r.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)r.opacity.value=h.opacity;for(var Ga in r)if(v=t.uniforms[Ga]){o=r[Ga];E=o.type;m=o.value;if(E=="i")d.uniform1i(v,m);else if(E=="f")d.uniform1f(v,m);else if(E=="fv1")d.uniform1fv(v,m);else if(E=="fv")d.uniform3fv(v,m);else if(E==
 "v2")d.uniform2f(v,m.x,m.y);else if(E=="v3")d.uniform3f(v,m.x,m.y,m.z);else if(E=="c")d.uniform3f(v,m.r,m.g,m.b);else if(E=="t"){d.uniform1i(v,m);if(o=o.texture)if(o.image instanceof Array&&o.image.length==6){if(o.image.length==6){if(o.needsUpdate){if(o.__wasSetOnce){d.bindTexture(d.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube);for(E=0;E<6;++E)d.texSubImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,0,0,d.RGBA,d.UNSIGNED_BYTE,o.image[E])}else{o.image.__webGLTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,
-o.image.__webGLTextureCube);for(E=0;E<6;++E)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image[E]);o.__wasSetOnce=!0}ja(d.TEXTURE_CUBE_MAP,o,o.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);o.needsUpdate=!1}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube)}}else{if(o.needsUpdate){if(o.__wasSetOnce){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,o.image)}else{o.__webGLTexture=
-d.createTexture();d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image);o.__wasSetOnce=!0}ja(d.TEXTURE_2D,o,o.image);d.bindTexture(d.TEXTURE_2D,null);o.needsUpdate=!1}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_2D,o.__webGLTexture)}}}d.uniformMatrix4fv(q.modelViewMatrix,!1,k._modelViewMatrixArray);d.uniformMatrix3fv(q.normalMatrix,!1,k._normalMatrixArray);(h instanceof THREE.MeshShaderMaterial||h instanceof THREE.MeshPhongMaterial||
-h.envMap)&&d.uniform3f(q.cameraPosition,g.position.x,g.position.y,g.position.z);(h instanceof THREE.MeshShaderMaterial||h.envMap||h.skinning)&&d.uniformMatrix4fv(q.objectMatrix,!1,k._objectMatrixArray);(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshShaderMaterial||h.skinning)&&d.uniformMatrix4fv(q.viewMatrix,!1,Ga);if(h.skinning){d.uniformMatrix4fv(q.cameraInverseMatrix,!1,Ga);d.uniformMatrix4fv(q.boneGlobalMatrices,!1,k.boneMatrices)}return t}
+o.image.__webGLTextureCube);for(E=0;E<6;++E)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image[E]);o.__wasSetOnce=!0}ha(d.TEXTURE_CUBE_MAP,o,o.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);o.needsUpdate=!1}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube)}}else{if(o.needsUpdate){if(o.__wasSetOnce){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,o.image)}else{o.__webGLTexture=
+d.createTexture();d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image);o.__wasSetOnce=!0}ha(d.TEXTURE_2D,o,o.image);d.bindTexture(d.TEXTURE_2D,null);o.needsUpdate=!1}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_2D,o.__webGLTexture)}}}d.uniformMatrix4fv(q.modelViewMatrix,!1,k._modelViewMatrixArray);d.uniformMatrix3fv(q.normalMatrix,!1,k._normalMatrixArray);(h instanceof THREE.MeshShaderMaterial||h instanceof THREE.MeshPhongMaterial||
+h.envMap)&&d.uniform3f(q.cameraPosition,g.position.x,g.position.y,g.position.z);(h instanceof THREE.MeshShaderMaterial||h.envMap||h.skinning)&&d.uniformMatrix4fv(q.objectMatrix,!1,k._objectMatrixArray);(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshShaderMaterial||h.skinning)&&d.uniformMatrix4fv(q.viewMatrix,!1,na);if(h.skinning){d.uniformMatrix4fv(q.cameraInverseMatrix,!1,na);d.uniformMatrix4fv(q.boneGlobalMatrices,!1,k.boneMatrices)}return t}
 function f(g,m,o,h,k,t){if(h.opacity!=0){g=e(g,m,o,h,t).attributes;if(h.morphTargets){m=h.program.attributes;t.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[t.morphTargetBase]):d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.vertexAttribPointer(m.position,3,d.FLOAT,!1,0,0);if(t.morphTargetForcedOrder.length){o=0;for(var q=t.morphTargetForcedOrder,r=t.morphTargetInfluences;o<h.numSupportedMorphTargets&&o<q.length;){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[q[o]]);
-d.vertexAttribPointer(m["morphTarget"+o],3,d.FLOAT,!1,0,0);t.__webGLMorphTargetInfluences[o]=r[q[o]];o++}}else{q=[];var E=-1,x=0;r=t.morphTargetInfluences;var v,L=r.length;o=0;for(t.morphTargetBase!==-1&&(q[t.morphTargetBase]=!0);o<h.numSupportedMorphTargets;){for(v=0;v<L;v++)if(!q[v]&&r[v]>E){x=v;E=r[x]}d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[x]);d.vertexAttribPointer(m["morphTarget"+o],3,d.FLOAT,!1,0,0);t.__webGLMorphTargetInfluences[o]=E;q[x]=1;E=-1;o++}}d.uniform1fv(h.program.uniforms.morphTargetInfluences,
+d.vertexAttribPointer(m["morphTarget"+o],3,d.FLOAT,!1,0,0);t.__webGLMorphTargetInfluences[o]=r[q[o]];o++}}else{q=[];var E=-1,x=0;r=t.morphTargetInfluences;var v,M=r.length;o=0;for(t.morphTargetBase!==-1&&(q[t.morphTargetBase]=!0);o<h.numSupportedMorphTargets;){for(v=0;v<M;v++)if(!q[v]&&r[v]>E){x=v;E=r[x]}d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[x]);d.vertexAttribPointer(m["morphTarget"+o],3,d.FLOAT,!1,0,0);t.__webGLMorphTargetInfluences[o]=E;q[x]=1;E=-1;o++}}d.uniform1fv(h.program.uniforms.morphTargetInfluences,
 t.__webGLMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.vertexAttribPointer(g.position,3,d.FLOAT,!1,0,0)}if(g.color>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLColorBuffer);d.vertexAttribPointer(g.color,3,d.FLOAT,!1,0,0)}if(g.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLNormalBuffer);d.vertexAttribPointer(g.normal,3,d.FLOAT,!1,0,0)}if(g.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLTangentBuffer);d.vertexAttribPointer(g.tangent,4,d.FLOAT,!1,0,0)}if(g.uv>=0)if(k.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,
 k.__webGLUVBuffer);d.vertexAttribPointer(g.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(g.uv)}else d.disableVertexAttribArray(g.uv);if(g.uv2>=0)if(k.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLUV2Buffer);d.vertexAttribPointer(g.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(g.uv2)}else d.disableVertexAttribArray(g.uv2);if(h.skinning&&g.skinVertexA>=0&&g.skinVertexB>=0&&g.skinIndex>=0&&g.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinVertexABuffer);d.vertexAttribPointer(g.skinVertexA,
 4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinVertexBBuffer);d.vertexAttribPointer(g.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinIndicesBuffer);d.vertexAttribPointer(g.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinWeightsBuffer);d.vertexAttribPointer(g.skinWeight,4,d.FLOAT,!1,0,0)}if(t instanceof THREE.Mesh)if(h.wireframe){d.lineWidth(h.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);d.drawElements(d.LINES,
 k.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,k.__webGLFaceCount,d.UNSIGNED_SHORT,0)}else if(t instanceof THREE.Line){t=t.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(h.linewidth);d.drawArrays(t,0,k.__webGLLineCount)}else if(t instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,k.__webGLParticleCount);else t instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,k.__webGLVertexCount)}}function i(g,m){if(!g.__webGLVertexBuffer)g.__webGLVertexBuffer=
 d.createBuffer();if(!g.__webGLNormalBuffer)g.__webGLNormalBuffer=d.createBuffer();if(g.hasPos){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,g.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(m.attributes.position);d.vertexAttribPointer(m.attributes.position,3,d.FLOAT,!1,0,0)}if(g.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,g.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(m.attributes.normal);d.vertexAttribPointer(m.attributes.normal,
-3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,g.count);g.count=0}function j(g){if(ka!=g.doubleSided){g.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);ka=g.doubleSided}if(na!=g.flipSided){g.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);na=g.flipSided}}function p(g){if(U!=g){g?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);U=g}}function n(g){ra[0].set(g.n41-g.n11,g.n42-g.n12,g.n43-g.n13,g.n44-g.n14);ra[1].set(g.n41+g.n11,g.n42+g.n12,g.n43+g.n13,g.n44+g.n14);ra[2].set(g.n41+g.n21,g.n42+g.n22,
-g.n43+g.n23,g.n44+g.n24);ra[3].set(g.n41-g.n21,g.n42-g.n22,g.n43-g.n23,g.n44-g.n24);ra[4].set(g.n41-g.n31,g.n42-g.n32,g.n43-g.n33,g.n44-g.n34);ra[5].set(g.n41+g.n31,g.n42+g.n32,g.n43+g.n33,g.n44+g.n34);var m;for(g=0;g<6;g++){m=ra[g];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function s(g){for(var m=g.matrixWorld,o=-g.geometry.boundingSphere.radius*Math.max(g.scale.x,Math.max(g.scale.y,g.scale.z)),h=0;h<6;h++){g=ra[h].x*m.n14+ra[h].y*m.n24+ra[h].z*m.n34+ra[h].w;if(g<=o)return!1}return!0}function z(g,
-m){g.list[g.count]=m;g.count+=1}function A(g){var m,o,h=g.object,k=g.opaque,t=g.transparent;t.count=0;g=k.count=0;for(m=h.materials.length;g<m;g++){o=h.materials[g];o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?z(t,o):z(k,o)}}function D(g){var m,o,h,k,t=g.object,q=g.buffer,r=g.opaque,E=g.transparent;E.count=0;g=r.count=0;for(h=t.materials.length;g<h;g++){m=t.materials[g];if(m instanceof THREE.MeshFaceMaterial){m=0;for(o=q.materials.length;m<o;m++)(k=q.materials[m])&&(k.opacity&&k.opacity<
-1||k.blending!=THREE.NormalBlending?z(E,k):z(r,k))}else{k=m;k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?z(E,k):z(r,k)}}}function y(g,m){return m.z-g.z}function K(g,m){g._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(g._modelViewMatrix).transposeIntoArray(g._normalMatrixArray)}function I(g){function m(V){var H=[];o=0;for(h=V.length;o<h;o++)V[o]==undefined?H.push("undefined"):H.push(V[o].id);return H.join("_")}var o,
-h,k,t,q,r,E,x,v={},L=g.morphTargets!==undefined?g.morphTargets.length:0;g.geometryGroups={};k=0;for(t=g.faces.length;k<t;k++){q=g.faces[k];r=q.materials;E=m(r);v[E]==undefined&&(v[E]={hash:E,counter:0});x=v[E].hash+"_"+v[E].counter;g.geometryGroups[x]==undefined&&(g.geometryGroups[x]={faces:[],materials:r,vertices:0,numMorphTargets:L});q=q instanceof THREE.Face3?3:4;if(g.geometryGroups[x].vertices+q>65535){v[E].counter+=1;x=v[E].hash+"_"+v[E].counter;g.geometryGroups[x]==undefined&&(g.geometryGroups[x]=
-{faces:[],materials:r,vertices:0,numMorphTargets:L})}g.geometryGroups[x].faces.push(k);g.geometryGroups[x].vertices+=q}}function N(g,m,o){g.push({buffer:m,object:o,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function O(g){if(g!=oa){switch(g){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE);break;case THREE.SubtractiveBlending:d.blendFunc(d.DST_COLOR,d.ZERO);break;case THREE.BillboardBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);
-break;case THREE.ReverseSubtractiveBlending:d.blendEquation(d.FUNC_REVERSE_SUBTRACT);d.blendFunc(d.ONE,d.ONE);break;default:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA)}oa=g}}function ja(g,m,o){if((o.width&o.width-1)==0&&(o.height&o.height-1)==0){d.texParameteri(g,d.TEXTURE_WRAP_S,T(m.wrapS));d.texParameteri(g,d.TEXTURE_WRAP_T,T(m.wrapT));d.texParameteri(g,d.TEXTURE_MAG_FILTER,T(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,T(m.minFilter));d.generateMipmap(g)}else{d.texParameteri(g,
-d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(g,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(g,d.TEXTURE_MAG_FILTER,la(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,la(m.minFilter))}}function R(g){if(g&&!g.__webGLFramebuffer){g.__webGLFramebuffer=d.createFramebuffer();g.__webGLRenderbuffer=d.createRenderbuffer();g.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,g.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,g.width,g.height);d.bindTexture(d.TEXTURE_2D,
-g.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,T(g.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,T(g.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,T(g.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,T(g.minFilter));d.texImage2D(d.TEXTURE_2D,0,T(g.format),g.width,g.height,0,T(g.format),T(g.type),null);d.bindFramebuffer(d.FRAMEBUFFER,g.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,g.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,
-d.DEPTH_ATTACHMENT,d.RENDERBUFFER,g.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var m,o;if(g){m=g.__webGLFramebuffer;o=g.width;g=g.height}else{m=null;o=pa;g=X}if(m!=M){d.bindFramebuffer(d.FRAMEBUFFER,m);d.viewport(ha,wa,o,g);M=m}}function B(g,m){var o;if(g=="fragment")o=d.createShader(d.FRAGMENT_SHADER);else g=="vertex"&&(o=d.createShader(d.VERTEX_SHADER));d.shaderSource(o,m);d.compileShader(o);if(!d.getShaderParameter(o,
-d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(o));console.error(m);return null}return o}function la(g){switch(g){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return d.LINEAR}}function T(g){switch(g){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;
+3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,g.count);g.count=0}function j(g){if(N!=g.doubleSided){g.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);N=g.doubleSided}if(ta!=g.flipSided){g.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);ta=g.flipSided}}function p(g){if(Ba!=g){g?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);Ba=g}}function n(g){X[0].set(g.n41-g.n11,g.n42-g.n12,g.n43-g.n13,g.n44-g.n14);X[1].set(g.n41+g.n11,g.n42+g.n12,g.n43+g.n13,g.n44+g.n14);X[2].set(g.n41+g.n21,g.n42+g.n22,
+g.n43+g.n23,g.n44+g.n24);X[3].set(g.n41-g.n21,g.n42-g.n22,g.n43-g.n23,g.n44-g.n24);X[4].set(g.n41-g.n31,g.n42-g.n32,g.n43-g.n33,g.n44-g.n34);X[5].set(g.n41+g.n31,g.n42+g.n32,g.n43+g.n33,g.n44+g.n34);var m;for(g=0;g<6;g++){m=X[g];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function s(g){for(var m=g.matrixWorld,o=-g.geometry.boundingSphere.radius*Math.max(g.scale.x,Math.max(g.scale.y,g.scale.z)),h=0;h<6;h++){g=X[h].x*m.n14+X[h].y*m.n24+X[h].z*m.n34+X[h].w;if(g<=o)return!1}return!0}function y(g,
+m){g.list[g.count]=m;g.count+=1}function A(g){var m,o,h=g.object,k=g.opaque,t=g.transparent;t.count=0;g=k.count=0;for(m=h.materials.length;g<m;g++){o=h.materials[g];o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?y(t,o):y(k,o)}}function D(g){var m,o,h,k,t=g.object,q=g.buffer,r=g.opaque,E=g.transparent;E.count=0;g=r.count=0;for(h=t.materials.length;g<h;g++){m=t.materials[g];if(m instanceof THREE.MeshFaceMaterial){m=0;for(o=q.materials.length;m<o;m++)(k=q.materials[m])&&(k.opacity&&k.opacity<
+1||k.blending!=THREE.NormalBlending?y(E,k):y(r,k))}else{k=m;k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?y(E,k):y(r,k)}}}function z(g,m){return m.z-g.z}function J(g,m){g._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(g._modelViewMatrix).transposeIntoArray(g._normalMatrixArray)}function K(g){function m(U){var H=[];o=0;for(h=U.length;o<h;o++)U[o]==undefined?H.push("undefined"):H.push(U[o].id);return H.join("_")}var o,
+h,k,t,q,r,E,x,v={},M=g.morphTargets!==undefined?g.morphTargets.length:0;g.geometryGroups={};k=0;for(t=g.faces.length;k<t;k++){q=g.faces[k];r=q.materials;E=m(r);v[E]==undefined&&(v[E]={hash:E,counter:0});x=v[E].hash+"_"+v[E].counter;g.geometryGroups[x]==undefined&&(g.geometryGroups[x]={faces:[],materials:r,vertices:0,numMorphTargets:M});q=q instanceof THREE.Face3?3:4;if(g.geometryGroups[x].vertices+q>65535){v[E].counter+=1;x=v[E].hash+"_"+v[E].counter;g.geometryGroups[x]==undefined&&(g.geometryGroups[x]=
+{faces:[],materials:r,vertices:0,numMorphTargets:M})}g.geometryGroups[x].faces.push(k);g.geometryGroups[x].vertices+=q}}function O(g,m,o){g.push({buffer:m,object:o,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(g){if(g!=ua){switch(g){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE);break;case THREE.SubtractiveBlending:d.blendFunc(d.DST_COLOR,d.ZERO);break;case THREE.BillboardBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);
+break;case THREE.ReverseSubtractiveBlending:d.blendEquation(d.FUNC_REVERSE_SUBTRACT);d.blendFunc(d.ONE,d.ONE);break;default:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA)}ua=g}}function ha(g,m,o){if((o.width&o.width-1)==0&&(o.height&o.height-1)==0){d.texParameteri(g,d.TEXTURE_WRAP_S,B(m.wrapS));d.texParameteri(g,d.TEXTURE_WRAP_T,B(m.wrapT));d.texParameteri(g,d.TEXTURE_MAG_FILTER,B(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,B(m.minFilter));d.generateMipmap(g)}else{d.texParameteri(g,
+d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(g,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(g,d.TEXTURE_MAG_FILTER,R(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,R(m.minFilter))}}function ma(g){if(g&&!g.__webGLFramebuffer){g.__webGLFramebuffer=d.createFramebuffer();g.__webGLRenderbuffer=d.createRenderbuffer();g.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,g.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,g.width,g.height);d.bindTexture(d.TEXTURE_2D,
+g.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,B(g.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,B(g.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,B(g.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,B(g.minFilter));d.texImage2D(d.TEXTURE_2D,0,B(g.format),g.width,g.height,0,B(g.format),B(g.type),null);d.bindFramebuffer(d.FRAMEBUFFER,g.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,g.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,
+d.DEPTH_ATTACHMENT,d.RENDERBUFFER,g.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var m,o;if(g){m=g.__webGLFramebuffer;o=g.width;g=g.height}else{m=null;o=ja;g=ka}if(m!=Aa){d.bindFramebuffer(d.FRAMEBUFFER,m);d.viewport(ia,V,o,g);Aa=m}}function pa(g,m){var o;if(g=="fragment")o=d.createShader(d.FRAGMENT_SHADER);else g=="vertex"&&(o=d.createShader(d.VERTEX_SHADER));d.shaderSource(o,m);d.compileShader(o);if(!d.getShaderParameter(o,
+d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(o));console.error(m);return null}return o}function R(g){switch(g){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return d.LINEAR}}function B(g){switch(g){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;
 case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;
-case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var ma=document.createElement("canvas"),d,P=null,M=null,ya=this,ka=null,na=null,oa=null,U=null,ha=0,wa=0,pa=0,X=0,ra=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Aa=new THREE.Matrix4,Ma=new Float32Array(16),Ga=new Float32Array(16),ia=new THREE.Vector4,Ka={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Ta=!0,Wa=new THREE.Color(0),Xa=0;if(a){if(a.antialias!==undefined)Ta=a.antialias;a.clearColor!==undefined&&Wa.setHex(a.clearColor);if(a.clearAlpha!==undefined)Xa=a.clearAlpha}this.maxMorphTargets=8;this.domElement=ma;this.autoClear=!0;this.sortObjects=
-!0;(function(g,m,o){try{if(!(d=ma.getContext("experimental-webgl",{antialias:g})))throw"Error creating WebGL context.";}catch(h){console.error(h)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.clearColor(m.r,m.g,m.b,o);_cullEnabled=!0})(Ta,Wa,Xa);this.context=d;this.setSize=function(g,m){ma.width=g;ma.height=m;this.setViewport(0,0,ma.width,ma.height)};
-this.setViewport=function(g,m,o,h){ha=g;wa=m;pa=o;X=h;d.viewport(ha,wa,pa,X)};this.setScissor=function(g,m,o,h){d.scissor(g,m,o,h)};this.enableScissorTest=function(g){g?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(g){d.depthMask(g)};this.setClearColorHex=function(g,m){var o=new THREE.Color(g);d.clearColor(o.r,o.g,o.b,m)};this.setClearColor=function(g,m){d.clearColor(g.r,g.g,g.b,m)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT)};this.initMaterial=
+case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var sa=document.createElement("canvas"),d,Da=null,Aa=null,Q=this,N=null,ta=null,ua=null,Ba=null,ia=0,V=0,ja=0,ka=0,X=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],S=new THREE.Matrix4,xa=new Float32Array(16),na=new Float32Array(16),ya=new THREE.Vector4,Ka={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},la=!0,Na=new THREE.Color(0),Va=0;if(a){if(a.antialias!==undefined)la=a.antialias;a.clearColor!==undefined&&Na.setHex(a.clearColor);if(a.clearAlpha!==undefined)Va=a.clearAlpha}this.maxMorphTargets=8;this.domElement=sa;this.autoClear=!0;this.sortObjects=
+!0;(function(g,m,o){try{if(!(d=sa.getContext("experimental-webgl",{antialias:g})))throw"Error creating WebGL context.";}catch(h){console.error(h)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.clearColor(m.r,m.g,m.b,o);_cullEnabled=!0})(la,Na,Va);this.context=d;this.setSize=function(g,m){sa.width=g;sa.height=m;this.setViewport(0,0,sa.width,sa.height)};
+this.setViewport=function(g,m,o,h){ia=g;V=m;ja=o;ka=h;d.viewport(ia,V,ja,ka)};this.setScissor=function(g,m,o,h){d.scissor(g,m,o,h)};this.enableScissorTest=function(g){g?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(g){d.depthMask(g)};this.setClearColorHex=function(g,m){var o=new THREE.Color(g);d.clearColor(o.r,o.g,o.b,m)};this.setClearColor=function(g,m){d.clearColor(g.r,g.g,g.b,m)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT)};this.initMaterial=
 function(g,m,o,h){var k,t,q;if(g instanceof THREE.MeshDepthMaterial)c(g,THREE.ShaderLib.depth);else if(g instanceof THREE.MeshNormalMaterial)c(g,THREE.ShaderLib.normal);else if(g instanceof THREE.MeshBasicMaterial)c(g,THREE.ShaderLib.basic);else if(g instanceof THREE.MeshLambertMaterial)c(g,THREE.ShaderLib.lambert);else if(g instanceof THREE.MeshPhongMaterial)c(g,THREE.ShaderLib.phong);else if(g instanceof THREE.LineBasicMaterial)c(g,THREE.ShaderLib.basic);else g instanceof THREE.ParticleBasicMaterial&&
 c(g,THREE.ShaderLib.particle_basic);var r,E,x,v;q=x=v=0;for(r=m.length;q<r;q++){E=m[q];E instanceof THREE.DirectionalLight&&x++;E instanceof THREE.PointLight&&v++}if(v+x<=4)m=x;else{m=Math.ceil(4*x/(v+x));v=4-m}q={directional:m,point:v};r=50;if(h!==undefined&&h instanceof THREE.SkinnedMesh)r=h.bones.length;v=g.fragmentShader;m=g.vertexShader;r={fog:o,map:g.map,envMap:g.envMap,lightMap:g.lightMap,vertexColors:g.vertexColors,sizeAttenuation:g.sizeAttenuation,skinning:g.skinning,morphTargets:g.morphTargets,
 maxDirLights:q.directional,maxPointLights:q.point,maxBones:r};o=d.createProgram();q=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,r.fog?"#define USE_FOG":"",r.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
 r=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,"#define MAX_BONES "+r.maxBones,r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\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");
-d.attachShader(o,B("fragment",q+v));d.attachShader(o,B("vertex",r+m));d.linkProgram(o);d.getProgramParameter(o,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(o,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");o.uniforms={};o.attributes={};g.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(k in g.uniforms)o.push(k);
+d.attachShader(o,pa("fragment",q+v));d.attachShader(o,pa("vertex",r+m));d.linkProgram(o);d.getProgramParameter(o,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(o,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");o.uniforms={};o.attributes={};g.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(k in g.uniforms)o.push(k);
 k=g.program;v=0;for(m=o.length;v<m;v++){q=o[v];k.uniforms[q]=d.getUniformLocation(k,q)}o=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(k=0;k<this.maxMorphTargets;k++)o.push("morphTarget"+k);for(t in g.attributes)o.push(t);t=g.program;k=o;o=0;for(v=k.length;o<v;o++){m=k[o];t.attributes[m]=d.getAttribLocation(t,m)}t=g.program.attributes;d.enableVertexAttribArray(t.position);t.color>=0&&d.enableVertexAttribArray(t.color);t.normal>=0&&d.enableVertexAttribArray(t.normal);
 t.tangent>=0&&d.enableVertexAttribArray(t.tangent);if(g.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0){d.enableVertexAttribArray(t.skinVertexA);d.enableVertexAttribArray(t.skinVertexB);d.enableVertexAttribArray(t.skinIndex);d.enableVertexAttribArray(t.skinWeight)}if(g.morphTargets){g.numSupportedMorphTargets=0;if(t.morphTarget0>=0){d.enableVertexAttribArray(t.morphTarget0);g.numSupportedMorphTargets++}if(t.morphTarget1>=0){d.enableVertexAttribArray(t.morphTarget1);
 g.numSupportedMorphTargets++}if(t.morphTarget2>=0){d.enableVertexAttribArray(t.morphTarget2);g.numSupportedMorphTargets++}if(t.morphTarget3>=0){d.enableVertexAttribArray(t.morphTarget3);g.numSupportedMorphTargets++}if(t.morphTarget4>=0){d.enableVertexAttribArray(t.morphTarget4);g.numSupportedMorphTargets++}if(t.morphTarget5>=0){d.enableVertexAttribArray(t.morphTarget5);g.numSupportedMorphTargets++}if(t.morphTarget6>=0){d.enableVertexAttribArray(t.morphTarget6);g.numSupportedMorphTargets++}if(t.morphTarget7>=
-0){d.enableVertexAttribArray(t.morphTarget7);g.numSupportedMorphTargets++}h.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(k=0;k<this.maxMorphTargets;k++)h.__webGLMorphTargetInfluences[k]=0}};this.render=function(g,m,o,h){var k,t,q,r,E,x,v,L,V=g.lights,H=g.fog;m.matrixAutoUpdate&&m.updateMatrix();g.update(undefined,!1,m);m.matrixWorldInverse.flattenToArray(Ga);m.projectionMatrix.flattenToArray(Ma);Aa.multiply(m.projectionMatrix,m.matrixWorldInverse);n(Aa);this.initWebGLObjects(g);
-R(o);(this.autoClear||h)&&this.clear();E=g.__webglObjects.length;for(h=0;h<E;h++){k=g.__webglObjects[h];v=k.object;if(v.visible)if(!(v instanceof THREE.Mesh)||s(v)){v.matrixWorld.flattenToArray(v._objectMatrixArray);K(v,m);D(k);k.render=!0;if(this.sortObjects){ia.copy(v.position);Aa.multiplyVector3(ia);k.z=ia.z}}else k.render=!1;else k.render=!1}this.sortObjects&&g.__webglObjects.sort(y);x=g.__webglObjectsImmediate.length;for(h=0;h<x;h++){k=g.__webglObjectsImmediate[h];v=k.object;if(v.visible){v.matrixAutoUpdate&&
-v.matrixWorld.flattenToArray(v._objectMatrixArray);K(v,m);A(k)}}O(THREE.NormalBlending);for(h=0;h<E;h++){k=g.__webglObjects[h];if(k.render){v=k.object;L=k.buffer;q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);f(m,V,H,r,L,v)}}}for(h=0;h<x;h++){k=g.__webglObjectsImmediate[h];v=k.object;if(v.visible){q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);t=e(m,V,H,r,v);v.render(function(Q){i(Q,t)})}}}for(h=0;h<E;h++){k=g.__webglObjects[h];if(k.render){v=k.object;L=k.buffer;
-q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];O(r.blending);p(r.depthTest);f(m,V,H,r,L,v)}}}for(h=0;h<x;h++){k=g.__webglObjectsImmediate[h];v=k.object;if(v.visible){q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];O(r.blending);p(r.depthTest);t=e(m,V,H,r,v);v.render(function(Q){i(Q,t)})}}}if(o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}};this.initWebGLObjects=
-function(g){if(!g.__webglObjects){g.__webglObjects=[];g.__webglObjectsImmediate=[]}for(;g.__objectsAdded.length;){var m=g.__objectsAdded[0],o=g,h=void 0,k=void 0,t=void 0;if(m._modelViewMatrix==undefined){m._modelViewMatrix=new THREE.Matrix4;m._normalMatrixArray=new Float32Array(9);m._modelViewMatrixArray=new Float32Array(16);m._objectMatrixArray=new Float32Array(16);m.matrixWorld.flattenToArray(m._objectMatrixArray)}if(m instanceof THREE.Mesh){k=m.geometry;k.geometryGroups==undefined&&I(k);for(h in k.geometryGroups){t=
+0){d.enableVertexAttribArray(t.morphTarget7);g.numSupportedMorphTargets++}h.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(k=0;k<this.maxMorphTargets;k++)h.__webGLMorphTargetInfluences[k]=0}};this.render=function(g,m,o,h){var k,t,q,r,E,x,v,M,U=g.lights,H=g.fog;m.matrixAutoUpdate&&m.updateMatrix();g.update(undefined,!1,m);m.matrixWorldInverse.flattenToArray(na);m.projectionMatrix.flattenToArray(xa);S.multiply(m.projectionMatrix,m.matrixWorldInverse);n(S);this.initWebGLObjects(g);
+ma(o);(this.autoClear||h)&&this.clear();E=g.__webglObjects.length;for(h=0;h<E;h++){k=g.__webglObjects[h];v=k.object;if(v.visible)if(!(v instanceof THREE.Mesh)||s(v)){v.matrixWorld.flattenToArray(v._objectMatrixArray);J(v,m);D(k);k.render=!0;if(this.sortObjects){ya.copy(v.position);S.multiplyVector3(ya);k.z=ya.z}}else k.render=!1;else k.render=!1}this.sortObjects&&g.__webglObjects.sort(z);x=g.__webglObjectsImmediate.length;for(h=0;h<x;h++){k=g.__webglObjectsImmediate[h];v=k.object;if(v.visible){v.matrixAutoUpdate&&
+v.matrixWorld.flattenToArray(v._objectMatrixArray);J(v,m);A(k)}}L(THREE.NormalBlending);for(h=0;h<E;h++){k=g.__webglObjects[h];if(k.render){v=k.object;M=k.buffer;q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);f(m,U,H,r,M,v)}}}for(h=0;h<x;h++){k=g.__webglObjectsImmediate[h];v=k.object;if(v.visible){q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);t=e(m,U,H,r,v);v.render(function(P){i(P,t)})}}}for(h=0;h<E;h++){k=g.__webglObjects[h];if(k.render){v=k.object;M=k.buffer;
+q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];L(r.blending);p(r.depthTest);f(m,U,H,r,M,v)}}}for(h=0;h<x;h++){k=g.__webglObjectsImmediate[h];v=k.object;if(v.visible){q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];L(r.blending);p(r.depthTest);t=e(m,U,H,r,v);v.render(function(P){i(P,t)})}}}if(o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}};this.initWebGLObjects=
+function(g){if(!g.__webglObjects){g.__webglObjects=[];g.__webglObjectsImmediate=[]}for(;g.__objectsAdded.length;){var m=g.__objectsAdded[0],o=g,h=void 0,k=void 0,t=void 0;if(m._modelViewMatrix==undefined){m._modelViewMatrix=new THREE.Matrix4;m._normalMatrixArray=new Float32Array(9);m._modelViewMatrixArray=new Float32Array(16);m._objectMatrixArray=new Float32Array(16);m.matrixWorld.flattenToArray(m._objectMatrixArray)}if(m instanceof THREE.Mesh){k=m.geometry;k.geometryGroups==undefined&&K(k);for(h in k.geometryGroups){t=
 k.geometryGroups[h];if(!t.__webGLVertexBuffer){var q=t;q.__webGLVertexBuffer=d.createBuffer();q.__webGLNormalBuffer=d.createBuffer();q.__webGLTangentBuffer=d.createBuffer();q.__webGLColorBuffer=d.createBuffer();q.__webGLUVBuffer=d.createBuffer();q.__webGLUV2Buffer=d.createBuffer();q.__webGLSkinVertexABuffer=d.createBuffer();q.__webGLSkinVertexBBuffer=d.createBuffer();q.__webGLSkinIndicesBuffer=d.createBuffer();q.__webGLSkinWeightsBuffer=d.createBuffer();q.__webGLFaceBuffer=d.createBuffer();q.__webGLLineBuffer=
-d.createBuffer();if(q.numMorphTargets){var r=void 0,E=void 0;q.__webGLMorphTargetsBuffers=[];r=0;for(E=q.numMorphTargets;r<E;r++)q.__webGLMorphTargetsBuffers.push(d.createBuffer())}q=t;var x=m,v=void 0,L=void 0,V=E=r=0;v=void 0;L=void 0;var H=void 0;L=void 0;var Q=x.geometry;H=Q.faces;var J=q.faces;v=0;for(L=J.length;v<L;v++){fi=J[v];face=H[fi];if(face instanceof THREE.Face3){r+=3;E+=1;V+=3}else if(face instanceof THREE.Face4){r+=4;E+=2;V+=4}}v=q;L=x;H=void 0;J=void 0;var Y=void 0,Ca=void 0;Y=void 0;
-var S=[];H=0;for(J=L.materials.length;H<J;H++){Y=L.materials[H];if(Y instanceof THREE.MeshFaceMaterial){Y=0;for(l=v.materials.length;Y<l;Y++)(Ca=v.materials[Y])&&S.push(Ca)}else(Ca=Y)&&S.push(Ca)}L=S;a:{v=void 0;H=void 0;J=L.length;for(v=0;v<J;v++){H=L[v];if(H.map||H.lightMap||H instanceof THREE.MeshShaderMaterial){v=!0;break a}}v=!1}a:{H=void 0;J=void 0;S=L.length;for(H=0;H<S;H++){J=L[H];if(!(J instanceof THREE.MeshBasicMaterial&&!J.envMap||J instanceof THREE.MeshDepthMaterial)){H=J&&J.shading!=
-undefined&&J.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}H=!1}a:{J=void 0;S=void 0;Y=L.length;for(J=0;J<Y;J++){S=L[J];if(S.vertexColors){L=S.vertexColors;break a}}L=!1}q.__vertexArray=new Float32Array(r*3);if(H)q.__normalArray=new Float32Array(r*3);if(Q.hasTangents)q.__tangentArray=new Float32Array(r*4);if(L)q.__colorArray=new Float32Array(r*3);if(v){if(Q.faceUvs.length>0||Q.faceVertexUvs.length>0)q.__uvArray=new Float32Array(r*2);if(Q.faceUvs.length>1||Q.faceVertexUvs.length>
-1)q.__uv2Array=new Float32Array(r*2)}if(x.geometry.skinWeights.length&&x.geometry.skinIndices.length){q.__skinVertexAArray=new Float32Array(r*4);q.__skinVertexBArray=new Float32Array(r*4);q.__skinIndexArray=new Float32Array(r*4);q.__skinWeightArray=new Float32Array(r*4)}q.__faceArray=new Uint16Array(E*3);q.__lineArray=new Uint16Array(V*2);if(q.numMorphTargets){x=void 0;Q=void 0;q.__morphTargetsArrays=[];x=0;for(Q=q.numMorphTargets;x<Q;x++)q.__morphTargetsArrays.push(new Float32Array(r*3))}q.__needsSmoothNormals=
-H==THREE.SmoothShading;q.__uvType=v;q.__vertexColorType=L;q.__normalType=H;q.__webGLFaceCount=E*3;q.__webGLLineCount=V*2;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}N(o.__webglObjects,t,m)}}else if(m instanceof THREE.Ribbon){k=m.geometry;if(!k.__webGLVertexBuffer){h=k;h.__webGLVertexBuffer=d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h=k;t=h.vertices.length;h.__vertexArray=new Float32Array(t*
-3);h.__colorArray=new Float32Array(t*3);h.__webGLVertexCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}N(o.__webglObjects,k,m)}else if(m instanceof THREE.Line){k=m.geometry;if(!k.__webGLVertexBuffer){h=k;h.__webGLVertexBuffer=d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h=k;t=h.vertices.length;h.__vertexArray=new Float32Array(t*3);h.__colorArray=new Float32Array(t*3);h.__webGLLineCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}N(o.__webglObjects,k,m)}else if(m instanceof THREE.ParticleSystem){k=
-m.geometry;if(!k.__webGLVertexBuffer){h=k;h.__webGLVertexBuffer=d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h=k;t=h.vertices.length;h.__vertexArray=new Float32Array(t*3);h.__colorArray=new Float32Array(t*3);h.__sortArray=[];h.__webGLParticleCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}N(o.__webglObjects,k,m)}else THREE.MarchingCubes!==undefined&&m instanceof THREE.MarchingCubes&&o.__webglObjectsImmediate.push({object:m,opaque:{list:[],count:0},transparent:{list:[],count:0}});g.__objectsAdded.splice(0,
+d.createBuffer();if(q.numMorphTargets){var r=void 0,E=void 0;q.__webGLMorphTargetsBuffers=[];r=0;for(E=q.numMorphTargets;r<E;r++)q.__webGLMorphTargetsBuffers.push(d.createBuffer())}q=t;var x=m,v=void 0,M=void 0,U=E=r=0;v=void 0;M=void 0;var H=void 0;M=void 0;var P=x.geometry;H=P.faces;var I=q.faces;v=0;for(M=I.length;v<M;v++){fi=I[v];face=H[fi];if(face instanceof THREE.Face3){r+=3;E+=1;U+=3}else if(face instanceof THREE.Face4){r+=4;E+=2;U+=4}}v=q;M=x;H=void 0;I=void 0;var Y=void 0,Fa=void 0;Y=void 0;
+var T=[];H=0;for(I=M.materials.length;H<I;H++){Y=M.materials[H];if(Y instanceof THREE.MeshFaceMaterial){Y=0;for(l=v.materials.length;Y<l;Y++)(Fa=v.materials[Y])&&T.push(Fa)}else(Fa=Y)&&T.push(Fa)}M=T;a:{v=void 0;H=void 0;I=M.length;for(v=0;v<I;v++){H=M[v];if(H.map||H.lightMap||H instanceof THREE.MeshShaderMaterial){v=!0;break a}}v=!1}a:{H=void 0;I=void 0;T=M.length;for(H=0;H<T;H++){I=M[H];if(!(I instanceof THREE.MeshBasicMaterial&&!I.envMap||I instanceof THREE.MeshDepthMaterial)){H=I&&I.shading!=
+undefined&&I.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}H=!1}a:{I=void 0;T=void 0;Y=M.length;for(I=0;I<Y;I++){T=M[I];if(T.vertexColors){M=T.vertexColors;break a}}M=!1}q.__vertexArray=new Float32Array(r*3);if(H)q.__normalArray=new Float32Array(r*3);if(P.hasTangents)q.__tangentArray=new Float32Array(r*4);if(M)q.__colorArray=new Float32Array(r*3);if(v){if(P.faceUvs.length>0||P.faceVertexUvs.length>0)q.__uvArray=new Float32Array(r*2);if(P.faceUvs.length>1||P.faceVertexUvs.length>
+1)q.__uv2Array=new Float32Array(r*2)}if(x.geometry.skinWeights.length&&x.geometry.skinIndices.length){q.__skinVertexAArray=new Float32Array(r*4);q.__skinVertexBArray=new Float32Array(r*4);q.__skinIndexArray=new Float32Array(r*4);q.__skinWeightArray=new Float32Array(r*4)}q.__faceArray=new Uint16Array(E*3);q.__lineArray=new Uint16Array(U*2);if(q.numMorphTargets){x=void 0;P=void 0;q.__morphTargetsArrays=[];x=0;for(P=q.numMorphTargets;x<P;x++)q.__morphTargetsArrays.push(new Float32Array(r*3))}q.__needsSmoothNormals=
+H==THREE.SmoothShading;q.__uvType=v;q.__vertexColorType=M;q.__normalType=H;q.__webGLFaceCount=E*3;q.__webGLLineCount=U*2;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}O(o.__webglObjects,t,m)}}else if(m instanceof THREE.Ribbon){k=m.geometry;if(!k.__webGLVertexBuffer){h=k;h.__webGLVertexBuffer=d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h=k;t=h.vertices.length;h.__vertexArray=new Float32Array(t*
+3);h.__colorArray=new Float32Array(t*3);h.__webGLVertexCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}O(o.__webglObjects,k,m)}else if(m instanceof THREE.Line){k=m.geometry;if(!k.__webGLVertexBuffer){h=k;h.__webGLVertexBuffer=d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h=k;t=h.vertices.length;h.__vertexArray=new Float32Array(t*3);h.__colorArray=new Float32Array(t*3);h.__webGLLineCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}O(o.__webglObjects,k,m)}else if(m instanceof THREE.ParticleSystem){k=
+m.geometry;if(!k.__webGLVertexBuffer){h=k;h.__webGLVertexBuffer=d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h=k;t=h.vertices.length;h.__vertexArray=new Float32Array(t*3);h.__colorArray=new Float32Array(t*3);h.__sortArray=[];h.__webGLParticleCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}O(o.__webglObjects,k,m)}else THREE.MarchingCubes!==undefined&&m instanceof THREE.MarchingCubes&&o.__webglObjectsImmediate.push({object:m,opaque:{list:[],count:0},transparent:{list:[],count:0}});g.__objectsAdded.splice(0,
 1)}for(;g.__objectsRemoved.length;){m=g.__objectsRemoved[0];o=g;k=void 0;h=void 0;for(k=o.__webglObjects.length-1;k>=0;k--){h=o.__webglObjects[k].object;m==h&&o.__webglObjects.splice(k,1)}g.__objectsRemoved.splice(0,1)}m=0;for(o=g.__webglObjects.length;m<o;m++){h=g.__webglObjects[m].object;t=void 0;k=void 0;q=void 0;if(h instanceof THREE.Mesh){k=h.geometry;for(t in k.geometryGroups){q=k.geometryGroups[t];if(k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||
-k.__dirtyColors||k.__dirtyTangents){r=d.DYNAMIC_DRAW;E=void 0;V=void 0;var Z=void 0,w=void 0;Z=void 0;var xa=void 0,W=void 0,Da=void 0;x=void 0;Q=void 0;v=void 0;L=void 0;H=void 0;var C=void 0,F=void 0,G=void 0,$=void 0;W=void 0;Da=void 0;C=void 0;w=void 0;C=void 0;F=void 0;G=void 0;W=void 0;C=void 0;F=void 0;G=void 0;$=void 0;C=void 0;F=void 0;G=void 0;$=void 0;C=void 0;F=void 0;G=void 0;$=void 0;C=void 0;F=void 0;G=void 0;$=void 0;w=void 0;xa=void 0;Z=void 0;Z=void 0;var za=void 0,Ua=void 0,sa=
-void 0,La=Ca=Y=S=J=0,Ea=0,aa=0,Fa=0,qa=0,u=0,ta=0,ua=q.__vertexArray,Ya=q.__uvArray,Za=q.__uv2Array,Ja=q.__normalArray,ca=q.__tangentArray,va=q.__colorArray,da=q.__skinVertexAArray,ea=q.__skinVertexBArray,fa=q.__skinIndexArray,ga=q.__skinWeightArray,$a=q.__morphTargetsArrays,Na=q.__faceArray,Ha=q.__lineArray,gb=q.__needsSmoothNormals;Q=q.__vertexColorType;x=q.__uvType;v=q.__normalType;var Ba=h.geometry,ab=Ba.__dirtyVertices,bb=Ba.__dirtyElements,Va=Ba.__dirtyUvs,cb=Ba.__dirtyNormals,db=Ba.__dirtyTangents,
-eb=Ba.__dirtyColors,fb=Ba.__dirtyMorphTargets,Ia=Ba.vertices,hb=q.faces,kb=Ba.faces,ib=Ba.faceVertexUvs[0],jb=Ba.faceVertexUvs[1],Qa=Ba.skinVerticesA,Ra=Ba.skinVerticesB,Sa=Ba.skinIndices,Pa=Ba.skinWeights,Oa=Ba.morphTargets;E=0;for(V=hb.length;E<V;E++){Z=hb[E];w=kb[Z];ib&&(L=ib[Z]);jb&&(H=jb[Z]);Z=w.vertexNormals;xa=w.normal;W=w.vertexColors;Da=w.color;if(w instanceof THREE.Face3){if(ab){C=Ia[w.a].position;F=Ia[w.b].position;G=Ia[w.c].position;ua[S]=C.x;ua[S+1]=C.y;ua[S+2]=C.z;ua[S+3]=F.x;ua[S+4]=
-F.y;ua[S+5]=F.z;ua[S+6]=G.x;ua[S+7]=G.y;ua[S+8]=G.z;S+=9}if(fb){za=0;for(Ua=Oa.length;za<Ua;za++){C=Oa[za].vertices[w.a].position;F=Oa[za].vertices[w.b].position;G=Oa[za].vertices[w.c].position;sa=$a[za];sa[ta+0]=C.x;sa[ta+1]=C.y;sa[ta+2]=C.z;sa[ta+3]=F.x;sa[ta+4]=F.y;sa[ta+5]=F.z;sa[ta+6]=G.x;sa[ta+7]=G.y;sa[ta+8]=G.z}ta+=9}if(Pa.length){C=Pa[w.a];F=Pa[w.b];G=Pa[w.c];ga[u]=C.x;ga[u+1]=C.y;ga[u+2]=C.z;ga[u+3]=C.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;ga[u+8]=G.x;ga[u+9]=G.y;ga[u+10]=G.z;
-ga[u+11]=G.w;C=Sa[w.a];F=Sa[w.b];G=Sa[w.c];fa[u]=C.x;fa[u+1]=C.y;fa[u+2]=C.z;fa[u+3]=C.w;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=F.w;fa[u+8]=G.x;fa[u+9]=G.y;fa[u+10]=G.z;fa[u+11]=G.w;C=Qa[w.a];F=Qa[w.b];G=Qa[w.c];da[u]=C.x;da[u+1]=C.y;da[u+2]=C.z;da[u+3]=1;da[u+4]=F.x;da[u+5]=F.y;da[u+6]=F.z;da[u+7]=1;da[u+8]=G.x;da[u+9]=G.y;da[u+10]=G.z;da[u+11]=1;C=Ra[w.a];F=Ra[w.b];G=Ra[w.c];ea[u]=C.x;ea[u+1]=C.y;ea[u+2]=C.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;ea[u+7]=1;ea[u+8]=G.x;ea[u+9]=G.y;ea[u+
-10]=G.z;ea[u+11]=1;u+=12}if(eb&&Q){if(W.length==3&&Q==THREE.VertexColors){C=W[0];F=W[1];G=W[2]}else G=F=C=Da;va[qa]=C.r;va[qa+1]=C.g;va[qa+2]=C.b;va[qa+3]=F.r;va[qa+4]=F.g;va[qa+5]=F.b;va[qa+6]=G.r;va[qa+7]=G.g;va[qa+8]=G.b;qa+=9}if(db&&Ba.hasTangents){W=Ia[w.a].tangent;Da=Ia[w.b].tangent;C=Ia[w.c].tangent;ca[aa]=W.x;ca[aa+1]=W.y;ca[aa+2]=W.z;ca[aa+3]=W.w;ca[aa+4]=Da.x;ca[aa+5]=Da.y;ca[aa+6]=Da.z;ca[aa+7]=Da.w;ca[aa+8]=C.x;ca[aa+9]=C.y;ca[aa+10]=C.z;ca[aa+11]=C.w;aa+=12}if(cb&&v)if(Z.length==3&&gb)for(w=
-0;w<3;w++){xa=Z[w];Ja[Ea]=xa.x;Ja[Ea+1]=xa.y;Ja[Ea+2]=xa.z;Ea+=3}else for(w=0;w<3;w++){Ja[Ea]=xa.x;Ja[Ea+1]=xa.y;Ja[Ea+2]=xa.z;Ea+=3}if(Va&&L!==undefined&&x)for(w=0;w<3;w++){Z=L[w];Ya[Y]=Z.u;Ya[Y+1]=Z.v;Y+=2}if(Va&&H!==undefined&&x)for(w=0;w<3;w++){Z=H[w];Za[Ca]=Z.u;Za[Ca+1]=Z.v;Ca+=2}if(bb){Na[La]=J;Na[La+1]=J+1;Na[La+2]=J+2;La+=3;Ha[Fa]=J;Ha[Fa+1]=J+1;Ha[Fa+2]=J;Ha[Fa+3]=J+2;Ha[Fa+4]=J+1;Ha[Fa+5]=J+2;Fa+=6;J+=3}}else if(w instanceof THREE.Face4){if(ab){C=Ia[w.a].position;F=Ia[w.b].position;G=Ia[w.c].position;
-$=Ia[w.d].position;ua[S]=C.x;ua[S+1]=C.y;ua[S+2]=C.z;ua[S+3]=F.x;ua[S+4]=F.y;ua[S+5]=F.z;ua[S+6]=G.x;ua[S+7]=G.y;ua[S+8]=G.z;ua[S+9]=$.x;ua[S+10]=$.y;ua[S+11]=$.z;S+=12}if(fb){za=0;for(Ua=Oa.length;za<Ua;za++){C=Oa[za].vertices[w.a].position;F=Oa[za].vertices[w.b].position;G=Oa[za].vertices[w.c].position;$=Oa[za].vertices[w.d].position;sa=$a[za];sa[ta+0]=C.x;sa[ta+1]=C.y;sa[ta+2]=C.z;sa[ta+3]=F.x;sa[ta+4]=F.y;sa[ta+5]=F.z;sa[ta+6]=G.x;sa[ta+7]=G.y;sa[ta+8]=G.z;sa[ta+9]=$.x;sa[ta+10]=$.y;sa[ta+11]=
-$.z}ta+=12}if(Pa.length){C=Pa[w.a];F=Pa[w.b];G=Pa[w.c];$=Pa[w.d];ga[u]=C.x;ga[u+1]=C.y;ga[u+2]=C.z;ga[u+3]=C.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;ga[u+8]=G.x;ga[u+9]=G.y;ga[u+10]=G.z;ga[u+11]=G.w;ga[u+12]=$.x;ga[u+13]=$.y;ga[u+14]=$.z;ga[u+15]=$.w;C=Sa[w.a];F=Sa[w.b];G=Sa[w.c];$=Sa[w.d];fa[u]=C.x;fa[u+1]=C.y;fa[u+2]=C.z;fa[u+3]=C.w;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=F.w;fa[u+8]=G.x;fa[u+9]=G.y;fa[u+10]=G.z;fa[u+11]=G.w;fa[u+12]=$.x;fa[u+13]=$.y;fa[u+14]=$.z;fa[u+15]=$.w;C=Qa[w.a];
-F=Qa[w.b];G=Qa[w.c];$=Qa[w.d];da[u]=C.x;da[u+1]=C.y;da[u+2]=C.z;da[u+3]=1;da[u+4]=F.x;da[u+5]=F.y;da[u+6]=F.z;da[u+7]=1;da[u+8]=G.x;da[u+9]=G.y;da[u+10]=G.z;da[u+11]=1;da[u+12]=$.x;da[u+13]=$.y;da[u+14]=$.z;da[u+15]=1;C=Ra[w.a];F=Ra[w.b];G=Ra[w.c];$=Ra[w.d];ea[u]=C.x;ea[u+1]=C.y;ea[u+2]=C.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;ea[u+7]=1;ea[u+8]=G.x;ea[u+9]=G.y;ea[u+10]=G.z;ea[u+11]=1;ea[u+12]=$.x;ea[u+13]=$.y;ea[u+14]=$.z;ea[u+15]=1;u+=16}if(eb&&Q){if(W.length==4&&Q==THREE.VertexColors){C=
-W[0];F=W[1];G=W[2];W=W[3]}else W=G=F=C=Da;va[qa]=C.r;va[qa+1]=C.g;va[qa+2]=C.b;va[qa+3]=F.r;va[qa+4]=F.g;va[qa+5]=F.b;va[qa+6]=G.r;va[qa+7]=G.g;va[qa+8]=G.b;va[qa+9]=W.r;va[qa+10]=W.g;va[qa+11]=W.b;qa+=12}if(db&&Ba.hasTangents){W=Ia[w.a].tangent;Da=Ia[w.b].tangent;C=Ia[w.c].tangent;w=Ia[w.d].tangent;ca[aa]=W.x;ca[aa+1]=W.y;ca[aa+2]=W.z;ca[aa+3]=W.w;ca[aa+4]=Da.x;ca[aa+5]=Da.y;ca[aa+6]=Da.z;ca[aa+7]=Da.w;ca[aa+8]=C.x;ca[aa+9]=C.y;ca[aa+10]=C.z;ca[aa+11]=C.w;ca[aa+12]=w.x;ca[aa+13]=w.y;ca[aa+14]=w.z;
-ca[aa+15]=w.w;aa+=16}if(cb&&v)if(Z.length==4&&gb)for(w=0;w<4;w++){xa=Z[w];Ja[Ea]=xa.x;Ja[Ea+1]=xa.y;Ja[Ea+2]=xa.z;Ea+=3}else for(w=0;w<4;w++){Ja[Ea]=xa.x;Ja[Ea+1]=xa.y;Ja[Ea+2]=xa.z;Ea+=3}if(Va&&L!==undefined&&x)for(w=0;w<4;w++){Z=L[w];Ya[Y]=Z.u;Ya[Y+1]=Z.v;Y+=2}if(Va&&H!==undefined&&x)for(w=0;w<4;w++){Z=H[w];Za[Ca]=Z.u;Za[Ca+1]=Z.v;Ca+=2}if(bb){Na[La]=J;Na[La+1]=J+1;Na[La+2]=J+2;Na[La+3]=J;Na[La+4]=J+2;Na[La+5]=J+3;La+=6;Ha[Fa]=J;Ha[Fa+1]=J+1;Ha[Fa+2]=J;Ha[Fa+3]=J+3;Ha[Fa+4]=J+1;Ha[Fa+5]=J+2;Ha[Fa+
-6]=J+2;Ha[Fa+7]=J+3;Fa+=8;J+=4}}}if(ab){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,ua,r)}if(fb){za=0;for(Ua=Oa.length;za<Ua;za++){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[za]);d.bufferData(d.ARRAY_BUFFER,$a[za],r)}}if(eb&&qa>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,va,r)}if(cb){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ja,r)}if(db&&Ba.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,
-q.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,ca,r)}if(Va&&Y>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Ya,r)}if(Va&&Ca>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Za,r)}if(bb){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Na,r);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Ha,r)}if(u>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);
+k.__dirtyColors||k.__dirtyTangents){r=d.DYNAMIC_DRAW;E=void 0;U=void 0;var Z=void 0,w=void 0;Z=void 0;var za=void 0,W=void 0,Ga=void 0;x=void 0;P=void 0;v=void 0;M=void 0;H=void 0;var C=void 0,F=void 0,G=void 0,$=void 0;W=void 0;Ga=void 0;C=void 0;w=void 0;C=void 0;F=void 0;G=void 0;W=void 0;C=void 0;F=void 0;G=void 0;$=void 0;C=void 0;F=void 0;G=void 0;$=void 0;C=void 0;F=void 0;G=void 0;$=void 0;C=void 0;F=void 0;G=void 0;$=void 0;w=void 0;za=void 0;Z=void 0;Z=void 0;var Ca=void 0,Wa=void 0,qa=
+void 0,Oa=Fa=Y=T=I=0,Ha=0,aa=0,Ia=0,oa=0,u=0,ra=0,va=q.__vertexArray,Ya=q.__uvArray,Za=q.__uv2Array,Ma=q.__normalArray,ca=q.__tangentArray,wa=q.__colorArray,da=q.__skinVertexAArray,ea=q.__skinVertexBArray,fa=q.__skinIndexArray,ga=q.__skinWeightArray,$a=q.__morphTargetsArrays,Pa=q.__faceArray,Ja=q.__lineArray,gb=q.__needsSmoothNormals;P=q.__vertexColorType;x=q.__uvType;v=q.__normalType;var Ea=h.geometry,ab=Ea.__dirtyVertices,bb=Ea.__dirtyElements,Xa=Ea.__dirtyUvs,cb=Ea.__dirtyNormals,db=Ea.__dirtyTangents,
+eb=Ea.__dirtyColors,fb=Ea.__dirtyMorphTargets,La=Ea.vertices,hb=q.faces,kb=Ea.faces,ib=Ea.faceVertexUvs[0],jb=Ea.faceVertexUvs[1],Sa=Ea.skinVerticesA,Ta=Ea.skinVerticesB,Ua=Ea.skinIndices,Ra=Ea.skinWeights,Qa=Ea.morphTargets;E=0;for(U=hb.length;E<U;E++){Z=hb[E];w=kb[Z];ib&&(M=ib[Z]);jb&&(H=jb[Z]);Z=w.vertexNormals;za=w.normal;W=w.vertexColors;Ga=w.color;if(w instanceof THREE.Face3){if(ab){C=La[w.a].position;F=La[w.b].position;G=La[w.c].position;va[T]=C.x;va[T+1]=C.y;va[T+2]=C.z;va[T+3]=F.x;va[T+4]=
+F.y;va[T+5]=F.z;va[T+6]=G.x;va[T+7]=G.y;va[T+8]=G.z;T+=9}if(fb){Ca=0;for(Wa=Qa.length;Ca<Wa;Ca++){C=Qa[Ca].vertices[w.a].position;F=Qa[Ca].vertices[w.b].position;G=Qa[Ca].vertices[w.c].position;qa=$a[Ca];qa[ra+0]=C.x;qa[ra+1]=C.y;qa[ra+2]=C.z;qa[ra+3]=F.x;qa[ra+4]=F.y;qa[ra+5]=F.z;qa[ra+6]=G.x;qa[ra+7]=G.y;qa[ra+8]=G.z}ra+=9}if(Ra.length){C=Ra[w.a];F=Ra[w.b];G=Ra[w.c];ga[u]=C.x;ga[u+1]=C.y;ga[u+2]=C.z;ga[u+3]=C.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;ga[u+8]=G.x;ga[u+9]=G.y;ga[u+10]=G.z;
+ga[u+11]=G.w;C=Ua[w.a];F=Ua[w.b];G=Ua[w.c];fa[u]=C.x;fa[u+1]=C.y;fa[u+2]=C.z;fa[u+3]=C.w;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=F.w;fa[u+8]=G.x;fa[u+9]=G.y;fa[u+10]=G.z;fa[u+11]=G.w;C=Sa[w.a];F=Sa[w.b];G=Sa[w.c];da[u]=C.x;da[u+1]=C.y;da[u+2]=C.z;da[u+3]=1;da[u+4]=F.x;da[u+5]=F.y;da[u+6]=F.z;da[u+7]=1;da[u+8]=G.x;da[u+9]=G.y;da[u+10]=G.z;da[u+11]=1;C=Ta[w.a];F=Ta[w.b];G=Ta[w.c];ea[u]=C.x;ea[u+1]=C.y;ea[u+2]=C.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;ea[u+7]=1;ea[u+8]=G.x;ea[u+9]=G.y;ea[u+
+10]=G.z;ea[u+11]=1;u+=12}if(eb&&P){if(W.length==3&&P==THREE.VertexColors){C=W[0];F=W[1];G=W[2]}else G=F=C=Ga;wa[oa]=C.r;wa[oa+1]=C.g;wa[oa+2]=C.b;wa[oa+3]=F.r;wa[oa+4]=F.g;wa[oa+5]=F.b;wa[oa+6]=G.r;wa[oa+7]=G.g;wa[oa+8]=G.b;oa+=9}if(db&&Ea.hasTangents){W=La[w.a].tangent;Ga=La[w.b].tangent;C=La[w.c].tangent;ca[aa]=W.x;ca[aa+1]=W.y;ca[aa+2]=W.z;ca[aa+3]=W.w;ca[aa+4]=Ga.x;ca[aa+5]=Ga.y;ca[aa+6]=Ga.z;ca[aa+7]=Ga.w;ca[aa+8]=C.x;ca[aa+9]=C.y;ca[aa+10]=C.z;ca[aa+11]=C.w;aa+=12}if(cb&&v)if(Z.length==3&&gb)for(w=
+0;w<3;w++){za=Z[w];Ma[Ha]=za.x;Ma[Ha+1]=za.y;Ma[Ha+2]=za.z;Ha+=3}else for(w=0;w<3;w++){Ma[Ha]=za.x;Ma[Ha+1]=za.y;Ma[Ha+2]=za.z;Ha+=3}if(Xa&&M!==undefined&&x)for(w=0;w<3;w++){Z=M[w];Ya[Y]=Z.u;Ya[Y+1]=Z.v;Y+=2}if(Xa&&H!==undefined&&x)for(w=0;w<3;w++){Z=H[w];Za[Fa]=Z.u;Za[Fa+1]=Z.v;Fa+=2}if(bb){Pa[Oa]=I;Pa[Oa+1]=I+1;Pa[Oa+2]=I+2;Oa+=3;Ja[Ia]=I;Ja[Ia+1]=I+1;Ja[Ia+2]=I;Ja[Ia+3]=I+2;Ja[Ia+4]=I+1;Ja[Ia+5]=I+2;Ia+=6;I+=3}}else if(w instanceof THREE.Face4){if(ab){C=La[w.a].position;F=La[w.b].position;G=La[w.c].position;
+$=La[w.d].position;va[T]=C.x;va[T+1]=C.y;va[T+2]=C.z;va[T+3]=F.x;va[T+4]=F.y;va[T+5]=F.z;va[T+6]=G.x;va[T+7]=G.y;va[T+8]=G.z;va[T+9]=$.x;va[T+10]=$.y;va[T+11]=$.z;T+=12}if(fb){Ca=0;for(Wa=Qa.length;Ca<Wa;Ca++){C=Qa[Ca].vertices[w.a].position;F=Qa[Ca].vertices[w.b].position;G=Qa[Ca].vertices[w.c].position;$=Qa[Ca].vertices[w.d].position;qa=$a[Ca];qa[ra+0]=C.x;qa[ra+1]=C.y;qa[ra+2]=C.z;qa[ra+3]=F.x;qa[ra+4]=F.y;qa[ra+5]=F.z;qa[ra+6]=G.x;qa[ra+7]=G.y;qa[ra+8]=G.z;qa[ra+9]=$.x;qa[ra+10]=$.y;qa[ra+11]=
+$.z}ra+=12}if(Ra.length){C=Ra[w.a];F=Ra[w.b];G=Ra[w.c];$=Ra[w.d];ga[u]=C.x;ga[u+1]=C.y;ga[u+2]=C.z;ga[u+3]=C.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;ga[u+8]=G.x;ga[u+9]=G.y;ga[u+10]=G.z;ga[u+11]=G.w;ga[u+12]=$.x;ga[u+13]=$.y;ga[u+14]=$.z;ga[u+15]=$.w;C=Ua[w.a];F=Ua[w.b];G=Ua[w.c];$=Ua[w.d];fa[u]=C.x;fa[u+1]=C.y;fa[u+2]=C.z;fa[u+3]=C.w;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=F.w;fa[u+8]=G.x;fa[u+9]=G.y;fa[u+10]=G.z;fa[u+11]=G.w;fa[u+12]=$.x;fa[u+13]=$.y;fa[u+14]=$.z;fa[u+15]=$.w;C=Sa[w.a];
+F=Sa[w.b];G=Sa[w.c];$=Sa[w.d];da[u]=C.x;da[u+1]=C.y;da[u+2]=C.z;da[u+3]=1;da[u+4]=F.x;da[u+5]=F.y;da[u+6]=F.z;da[u+7]=1;da[u+8]=G.x;da[u+9]=G.y;da[u+10]=G.z;da[u+11]=1;da[u+12]=$.x;da[u+13]=$.y;da[u+14]=$.z;da[u+15]=1;C=Ta[w.a];F=Ta[w.b];G=Ta[w.c];$=Ta[w.d];ea[u]=C.x;ea[u+1]=C.y;ea[u+2]=C.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;ea[u+7]=1;ea[u+8]=G.x;ea[u+9]=G.y;ea[u+10]=G.z;ea[u+11]=1;ea[u+12]=$.x;ea[u+13]=$.y;ea[u+14]=$.z;ea[u+15]=1;u+=16}if(eb&&P){if(W.length==4&&P==THREE.VertexColors){C=
+W[0];F=W[1];G=W[2];W=W[3]}else W=G=F=C=Ga;wa[oa]=C.r;wa[oa+1]=C.g;wa[oa+2]=C.b;wa[oa+3]=F.r;wa[oa+4]=F.g;wa[oa+5]=F.b;wa[oa+6]=G.r;wa[oa+7]=G.g;wa[oa+8]=G.b;wa[oa+9]=W.r;wa[oa+10]=W.g;wa[oa+11]=W.b;oa+=12}if(db&&Ea.hasTangents){W=La[w.a].tangent;Ga=La[w.b].tangent;C=La[w.c].tangent;w=La[w.d].tangent;ca[aa]=W.x;ca[aa+1]=W.y;ca[aa+2]=W.z;ca[aa+3]=W.w;ca[aa+4]=Ga.x;ca[aa+5]=Ga.y;ca[aa+6]=Ga.z;ca[aa+7]=Ga.w;ca[aa+8]=C.x;ca[aa+9]=C.y;ca[aa+10]=C.z;ca[aa+11]=C.w;ca[aa+12]=w.x;ca[aa+13]=w.y;ca[aa+14]=w.z;
+ca[aa+15]=w.w;aa+=16}if(cb&&v)if(Z.length==4&&gb)for(w=0;w<4;w++){za=Z[w];Ma[Ha]=za.x;Ma[Ha+1]=za.y;Ma[Ha+2]=za.z;Ha+=3}else for(w=0;w<4;w++){Ma[Ha]=za.x;Ma[Ha+1]=za.y;Ma[Ha+2]=za.z;Ha+=3}if(Xa&&M!==undefined&&x)for(w=0;w<4;w++){Z=M[w];Ya[Y]=Z.u;Ya[Y+1]=Z.v;Y+=2}if(Xa&&H!==undefined&&x)for(w=0;w<4;w++){Z=H[w];Za[Fa]=Z.u;Za[Fa+1]=Z.v;Fa+=2}if(bb){Pa[Oa]=I;Pa[Oa+1]=I+1;Pa[Oa+2]=I+2;Pa[Oa+3]=I;Pa[Oa+4]=I+2;Pa[Oa+5]=I+3;Oa+=6;Ja[Ia]=I;Ja[Ia+1]=I+1;Ja[Ia+2]=I;Ja[Ia+3]=I+3;Ja[Ia+4]=I+1;Ja[Ia+5]=I+2;Ja[Ia+
+6]=I+2;Ja[Ia+7]=I+3;Ia+=8;I+=4}}}if(ab){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,va,r)}if(fb){Ca=0;for(Wa=Qa.length;Ca<Wa;Ca++){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[Ca]);d.bufferData(d.ARRAY_BUFFER,$a[Ca],r)}}if(eb&&oa>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,wa,r)}if(cb){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ma,r)}if(db&&Ea.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,
+q.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,ca,r)}if(Xa&&Y>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Ya,r)}if(Xa&&Fa>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Za,r)}if(bb){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Pa,r);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Ja,r)}if(u>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);
 d.bufferData(d.ARRAY_BUFFER,da,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,ea,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,fa,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,ga,r)}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||
-k.__dirtyColors){h=k;t=d.DYNAMIC_DRAW;x=void 0;x=void 0;Q=void 0;q=void 0;v=h.vertices;r=h.colors;L=v.length;E=r.length;H=h.__vertexArray;V=h.__colorArray;J=h.__dirtyColors;if(h.__dirtyVertices){for(x=0;x<L;x++){Q=v[x].position;q=x*3;H[q]=Q.x;H[q+1]=Q.y;H[q+2]=Q.z}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,H,t)}if(J){for(x=0;x<E;x++){color=r[x];q=x*3;V[q]=color.r;V[q+1]=color.g;V[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,
-V,t)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;t=d.DYNAMIC_DRAW;x=void 0;x=void 0;Q=void 0;q=void 0;v=h.vertices;r=h.colors;L=v.length;E=r.length;H=h.__vertexArray;V=h.__colorArray;J=h.__dirtyColors;if(h.__dirtyVertices){for(x=0;x<L;x++){Q=v[x].position;q=x*3;H[q]=Q.x;H[q+1]=Q.y;H[q+2]=Q.z}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,H,t)}if(J){for(x=0;x<E;x++){color=r[x];q=x*
-3;V[q]=color.r;V[q+1]=color.g;V[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,V,t)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem){k=h.geometry;(k.__dirtyVertices||k.__dirtyColors||h.sortParticles)&&b(k,d.DYNAMIC_DRAW,h);k.__dirtyVertices=!1;k.__dirtyColors=!1}}};this.setFaceCulling=function(g,m){if(g){!m||m=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(g=="back")d.cullFace(d.BACK);else g=="front"?d.cullFace(d.FRONT):
+k.__dirtyColors){h=k;t=d.DYNAMIC_DRAW;x=void 0;x=void 0;P=void 0;q=void 0;v=h.vertices;r=h.colors;M=v.length;E=r.length;H=h.__vertexArray;U=h.__colorArray;I=h.__dirtyColors;if(h.__dirtyVertices){for(x=0;x<M;x++){P=v[x].position;q=x*3;H[q]=P.x;H[q+1]=P.y;H[q+2]=P.z}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,H,t)}if(I){for(x=0;x<E;x++){color=r[x];q=x*3;U[q]=color.r;U[q+1]=color.g;U[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,
+U,t)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;t=d.DYNAMIC_DRAW;x=void 0;x=void 0;P=void 0;q=void 0;v=h.vertices;r=h.colors;M=v.length;E=r.length;H=h.__vertexArray;U=h.__colorArray;I=h.__dirtyColors;if(h.__dirtyVertices){for(x=0;x<M;x++){P=v[x].position;q=x*3;H[q]=P.x;H[q+1]=P.y;H[q+2]=P.z}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,H,t)}if(I){for(x=0;x<E;x++){color=r[x];q=x*
+3;U[q]=color.r;U[q+1]=color.g;U[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,U,t)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem){k=h.geometry;(k.__dirtyVertices||k.__dirtyColors||h.sortParticles)&&b(k,d.DYNAMIC_DRAW,h);k.__dirtyVertices=!1;k.__dirtyColors=!1}}};this.setFaceCulling=function(g,m){if(g){!m||m=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(g=="back")d.cullFace(d.BACK);else g=="front"?d.cullFace(d.FRONT):
 d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно