Browse Source

Extrude Geometry UV mapping WIP1

zz85 14 years ago
parent
commit
92cb10ea7f

+ 205 - 205
build/Three.js

@@ -25,15 +25,15 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,g,j,h,k,o,m,p,u,v,t,w,x){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=j;this.n23=h;this.n24=k;this.n31=o;this.n32=m;this.n33=p;this.n34=u;this.n41=v;this.n42=t;this.n43=w;this.n44=x;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(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
 c,e){var f=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,j=THREE.Matrix4.__v3;j.sub(b,c).normalize();if(j.length()===0)j.z=1;f.cross(e,j).normalize();f.length()===0&&(j.x+=1.0E-4,f.cross(e,j).normalize());g.cross(j,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=j.x;this.n21=f.y;this.n22=g.y;this.n23=j.y;this.n31=f.z;this.n32=g.z;this.n33=j.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;
 b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
-e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,k=b.n22,o=b.n23,m=b.n24,p=b.n31,u=b.n32,v=b.n33,t=b.n34,w=b.n41,x=b.n42,B=b.n43,A=b.n44,H=c.n11,y=c.n12,
-G=c.n13,I=c.n14,E=c.n21,K=c.n22,D=c.n23,J=c.n24,S=c.n31,X=c.n32,R=c.n33,C=c.n34,n=c.n41,W=c.n42,V=c.n43,fa=c.n44;this.n11=e*H+f*E+g*S+j*n;this.n12=e*y+f*K+g*X+j*W;this.n13=e*G+f*D+g*R+j*V;this.n14=e*I+f*J+g*C+j*fa;this.n21=h*H+k*E+o*S+m*n;this.n22=h*y+k*K+o*X+m*W;this.n23=h*G+k*D+o*R+m*V;this.n24=h*I+k*J+o*C+m*fa;this.n31=p*H+u*E+v*S+t*n;this.n32=p*y+u*K+v*X+t*W;this.n33=p*G+u*D+v*R+t*V;this.n34=p*I+u*J+v*C+t*fa;this.n41=w*H+x*E+B*S+A*n;this.n42=w*y+x*K+B*X+A*W;this.n43=w*G+x*D+B*R+A*V;this.n44=w*
-I+x*J+B*C+A*fa;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=
-b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,j=this.n22,h=this.n23,k=this.n24,o=this.n31,m=this.n32,p=this.n33,u=this.n34,v=this.n41,t=this.n42,w=this.n43,x=this.n44;return f*h*m*v-e*k*m*v-f*j*p*v+c*k*p*v+e*j*u*v-c*h*u*v-f*h*o*t+e*k*o*t+f*g*p*t-b*k*p*t-e*g*u*t+b*h*u*t+f*j*o*w-c*k*o*w-f*g*m*w+b*k*m*w+c*g*u*w-b*j*u*w-e*j*o*x+c*h*o*x+e*g*m*x-b*h*m*x-c*g*
-p*x+b*j*p*x},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=
-this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},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(b){b[0]=
-this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=
-this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,
-0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),g=1-e,j=b.x,h=b.y,k=b.z,o=g*j,m=g*h;this.set(o*j+e,o*h-f*k,o*k+f*h,0,o*h+f*k,m*h+e,m*k-f*j,0,o*k-f*h,m*k+f*j,g*k*k+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
+e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,k=b.n22,o=b.n23,m=b.n24,p=b.n31,u=b.n32,v=b.n33,t=b.n34,w=b.n41,x=b.n42,B=b.n43,A=b.n44,I=c.n11,z=c.n12,
+H=c.n13,G=c.n14,C=c.n21,O=c.n22,N=c.n23,D=c.n24,E=c.n31,U=c.n32,M=c.n33,L=c.n34,n=c.n41,S=c.n42,V=c.n43,X=c.n44;this.n11=e*I+f*C+g*E+j*n;this.n12=e*z+f*O+g*U+j*S;this.n13=e*H+f*N+g*M+j*V;this.n14=e*G+f*D+g*L+j*X;this.n21=h*I+k*C+o*E+m*n;this.n22=h*z+k*O+o*U+m*S;this.n23=h*H+k*N+o*M+m*V;this.n24=h*G+k*D+o*L+m*X;this.n31=p*I+u*C+v*E+t*n;this.n32=p*z+u*O+v*U+t*S;this.n33=p*H+u*N+v*M+t*V;this.n34=p*G+u*D+v*L+t*X;this.n41=w*I+x*C+B*E+A*n;this.n42=w*z+x*O+B*U+A*S;this.n43=w*H+x*N+B*M+A*V;this.n44=w*G+x*
+D+B*L+A*X;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=
+b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,j=this.n22,h=this.n23,k=this.n24,o=this.n31,m=this.n32,p=this.n33,u=this.n34,v=this.n41,t=this.n42,w=this.n43,x=this.n44;return f*h*m*v-e*k*m*v-f*j*p*v+c*k*p*v+e*j*u*v-c*h*u*v-f*h*o*t+e*k*o*t+f*g*p*t-b*k*p*t-e*g*u*t+b*h*u*t+f*j*o*w-c*k*o*w-f*g*m*w+b*k*m*w+c*g*u*w-b*j*u*w-e*j*o*x+c*h*o*x+e*g*m*x-b*h*m*x-c*g*p*x+b*j*p*x},
+transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;
+b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},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(b){b[0]=this.n11;
+b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;
+b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,
+0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),g=1-e,j=b.x,h=b.y,k=b.z,o=g*j,m=g*h;this.set(o*j+e,o*h-f*k,o*k+f*h,0,o*h+f*k,m*h+e,m*k-f*j,0,o*k-f*h,m*k+f*j,g*k*k+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
 new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,j=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),k=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var o=
 h*k,m=h*g,p=f*k,u=f*g;this.n11=o+u*e;this.n12=p*e-m;this.n13=j*f;this.n21=j*g;this.n22=j*k;this.n23=-e;this.n31=m*e-p;this.n32=u+o*e;this.n33=j*h;break;case "ZXY":o=h*k;m=h*g;p=f*k;u=f*g;this.n11=o-u*e;this.n12=-j*g;this.n13=p+m*e;this.n21=m+p*e;this.n22=j*k;this.n23=u-o*e;this.n31=-j*f;this.n32=e;this.n33=j*h;break;case "ZYX":o=j*k;m=j*g;p=e*k;u=e*g;this.n11=h*k;this.n12=p*f-m;this.n13=o*f+u;this.n21=h*g;this.n22=u*f+o;this.n23=m*f-p;this.n31=-f;this.n32=e*h;this.n33=j*h;break;case "YZX":o=j*h;m=
 j*f;p=e*h;u=e*f;this.n11=h*k;this.n12=u-o*g;this.n13=p*g+m;this.n21=g;this.n22=j*k;this.n23=-e*k;this.n31=-f*k;this.n32=m*g+p;this.n33=o-u*g;break;case "XZY":o=j*h;m=j*f;p=e*h;u=e*f;this.n11=h*k;this.n12=-g;this.n13=f*k;this.n21=o*g+u;this.n22=j*k;this.n23=m*g-p;this.n31=p*g-m;this.n32=e*k;this.n33=u*g+o;break;default:o=j*k,m=j*g,p=e*k,u=e*g,this.n11=h*k,this.n12=-h*g,this.n13=f,this.n21=m+p*f,this.n22=o-u*f,this.n23=-e*h,this.n31=u-o*f,this.n32=p+m*f,this.n33=j*h}return this},setRotationFromQuaternion:function(b){var c=
@@ -54,7 +54,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){t
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=
 b,this.w*=b);return this},multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,j=b.x,h=b.y,k=b.z,b=b.w;this.x=c*b+g*j+e*k-f*h;this.y=e*b+g*h+f*j-c*k;this.z=f*b+g*k+c*h-e*j;this.w=g*b-c*j-e*h-f*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,j=this.x,h=this.y,k=this.z,
 o=this.w,m=o*e+h*g-k*f,p=o*f+k*e-j*g,u=o*g+j*f-h*e,e=-j*e-h*f-k*g;c.x=m*o+e*-j+p*-k-u*-h;c.y=p*o+e*-h+u*-j-m*-k;c.z=u*o+e*-k+m*-h-p*-j;return c}};
-THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.001)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*j)/h;f=Math.sin(f*j)/h;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*j)/h;f=Math.sin(f*j)/h;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,c,e,f,g,j){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,e,f,g,j,h){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
@@ -62,9 +62,9 @@ THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function()
 e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,j,h,k=new THREE.Vector3,o=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){j=this.faces[f];if(b&&j.vertexNormals.length){k.set(0,0,0);c=0;for(e=j.vertexNormals.length;c<e;c++)k.addSelf(j.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[j.a],e=this.vertices[j.b],h=this.vertices[j.c],k.sub(h.position,e.position),o.sub(c.position,e.position),k.crossSelf(o);k.isZero()||
 k.normalize();j.normal.copy(k)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
 this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,c,e,f,g,j,n){k=b.vertices[c].position;o=b.vertices[e].position;m=b.vertices[f].position;p=h[g];u=h[j];v=h[n];t=o.x-k.x;w=m.x-k.x;x=o.y-k.y;B=m.y-k.y;A=o.z-k.z;H=m.z-k.z;y=u.u-p.u;G=v.u-p.u;I=u.v-p.v;E=v.v-p.v;K=1/(y*E-G*I);X.set((E*t-I*w)*
-K,(E*x-I*B)*K,(E*A-I*H)*K);R.set((y*w-G*t)*K,(y*B-G*x)*K,(y*H-G*A)*K);J[c].addSelf(X);J[e].addSelf(X);J[f].addSelf(X);S[c].addSelf(R);S[e].addSelf(R);S[f].addSelf(R)}var c,e,f,g,j,h,k,o,m,p,u,v,t,w,x,B,A,H,y,G,I,E,K,D,J=[],S=[],X=new THREE.Vector3,R=new THREE.Vector3,C=new THREE.Vector3,n=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)J[c]=new THREE.Vector3,S[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)j=this.faces[c],h=this.faceVertexUvs[0][c],j instanceof
-THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var V=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){j=this.faces[c];for(f=0;f<j.vertexNormals.length;f++)W.copy(j.vertexNormals[f]),g=j[V[f]],D=J[g],C.copy(D),C.subSelf(W.multiplyScalar(W.dot(D))).normalize(),n.cross(j.vertexNormals[f],D),g=n.dot(S[g]),g=g<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(C.x,C.y,C.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,c,e,f,g,j,n){k=b.vertices[c].position;o=b.vertices[e].position;m=b.vertices[f].position;p=h[g];u=h[j];v=h[n];t=o.x-k.x;w=m.x-k.x;x=o.y-k.y;B=m.y-k.y;A=o.z-k.z;I=m.z-k.z;z=u.u-p.u;H=v.u-p.u;G=u.v-p.v;C=v.v-p.v;O=1/(z*C-H*G);U.set((C*t-G*w)*
+O,(C*x-G*B)*O,(C*A-G*I)*O);M.set((z*w-H*t)*O,(z*B-H*x)*O,(z*I-H*A)*O);D[c].addSelf(U);D[e].addSelf(U);D[f].addSelf(U);E[c].addSelf(M);E[e].addSelf(M);E[f].addSelf(M)}var c,e,f,g,j,h,k,o,m,p,u,v,t,w,x,B,A,I,z,H,G,C,O,N,D=[],E=[],U=new THREE.Vector3,M=new THREE.Vector3,L=new THREE.Vector3,n=new THREE.Vector3,S=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)D[c]=new THREE.Vector3,E[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)j=this.faces[c],h=this.faceVertexUvs[0][c],j instanceof
+THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var V=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){j=this.faces[c];for(f=0;f<j.vertexNormals.length;f++)S.copy(j.vertexNormals[f]),g=j[V[f]],N=D[g],L.copy(N),L.subSelf(S.multiplyScalar(S.dot(N))).normalize(),n.cross(j.vertexNormals[f],N),g=n.dot(E[g]),g=g<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(L.x,L.y,L.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
 else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,c){return Math.min(b,c)+"_"+Math.max(b,c)}function c(b,c,e){b[c]===
 void 0?(b[c]={set:{},array:[]},b[c].set[e]=1,b[c].array.push(e)):b[c].set[e]===void 0&&(b[c].set[e]=1,b[c].array.push(e))}var e,f,g,j,h,k={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.a,h.c),c(k,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),c(k,g,e),g=b(h.a,h.b),c(k,g,e),g=b(h.a,h.d),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.d),c(k,g,e));e=0;for(f=this.edges.length;e<f;e++){h=this.edges[e];g=h.vertexIndices[0];j=h.vertexIndices[1];
@@ -127,58 +127,58 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};
 THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;
 THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
-THREE.Projector=function(){function b(){var b=o[k]=o[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,h=b.z+b.w,g=c.z+c.w,j=-b.z+b.w,k=-c.z+c.w;return h>=0&&g>=0&&j>=0&&k>=0?!0:h<0&&g<0||j<0&&k<0?!1:(h<0?e=Math.max(e,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),j<0?e=Math.max(e,j/(j-k)):k<0&&(f=Math.min(f,j/(j-k))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,g,j=[],h,k,o=[],m,p,u=[],v,t=[],w,x,B=[],A,H,y=[],G=new THREE.Vector4,I=new THREE.Vector4,
-E=new THREE.Matrix4,K=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,S=new THREE.Vector4;this.projectVector=function(b,c){E.multiply(c.projectionMatrix,c.matrixWorldInverse);E.multiplyVector3(b);return b};this.unprojectVector=function(b,c){E.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));E.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],k,o,u;g=0;o=
-b.objects;b=0;for(k=o.length;b<k;b++){u=o[b];var m;if(!(m=!u.visible))if(m=u instanceof THREE.Mesh){a:{m=void 0;for(var t=u.matrixWorld,p=-u.geometry.boundingSphere.radius*Math.max(u.scale.x,Math.max(u.scale.y,u.scale.z)),v=0;v<6;v++)if(m=D[v].x*t.n14+D[v].y*t.n24+D[v].z*t.n34+D[v].w,m<=p){m=!1;break a}m=!0}m=!m}if(!m)m=j[g]=j[g]||new THREE.RenderableObject,g++,f=m,G.copy(u.position),E.multiplyVector3(G),f.object=u,f.z=G.z,e.push(f)}h&&e.sort(c);return e};this.projectScene=function(f,g,j){var n=[],
-G=g.near,V=g.far,fa,L,ea,T,U,da,ha,ia,M,P,aa,Y,Z,ca,ja,la,ka;H=x=v=p=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);E.multiply(g.projectionMatrix,g.matrixWorldInverse);D[0].set(E.n41-E.n11,E.n42-E.n12,E.n43-E.n13,E.n44-E.n14);D[1].set(E.n41+E.n11,E.n42+E.n12,E.n43+E.n13,E.n44+E.n14);D[2].set(E.n41+E.n21,E.n42+E.n22,E.n43+E.n23,E.n44+E.n24);D[3].set(E.n41-E.n21,E.n42-E.n22,E.n43-E.n23,E.n44-E.n24);D[4].set(E.n41-E.n31,E.n42-E.n32,E.n43-E.n33,E.n44-E.n34);D[5].set(E.n41+E.n31,E.n42+
-E.n32,E.n43+E.n33,E.n44+E.n34);for(fa=0;fa<6;fa++)M=D[fa],M.divideScalar(Math.sqrt(M.x*M.x+M.y*M.y+M.z*M.z));M=this.projectObjects(f,g,!0);f=0;for(fa=M.length;f<fa;f++)if(P=M[f].object,P.visible)if(aa=P.matrixWorld,Y=P.matrixRotationWorld,Z=P.materials,ca=P.overdraw,k=0,P instanceof THREE.Mesh){ja=P.geometry;T=ja.vertices;la=ja.faces;ja=ja.faceVertexUvs;L=0;for(ea=T.length;L<ea;L++)h=b(),h.positionWorld.copy(T[L].position),aa.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
-E.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>G&&h.positionScreen.z<V;T=0;for(L=la.length;T<L;T++){ea=la[T];if(ea instanceof THREE.Face3)if(U=o[ea.a],da=o[ea.b],ha=o[ea.c],U.visible&&da.visible&&ha.visible&&(P.doubleSided||P.flipSided!=(ha.positionScreen.x-U.positionScreen.x)*(da.positionScreen.y-U.positionScreen.y)-(ha.positionScreen.y-U.positionScreen.y)*(da.positionScreen.x-U.positionScreen.x)<0))ia=
-u[p]=u[p]||new THREE.RenderableFace3,p++,m=ia,m.v1.copy(U),m.v2.copy(da),m.v3.copy(ha);else continue;else if(ea instanceof THREE.Face4)if(U=o[ea.a],da=o[ea.b],ha=o[ea.c],ia=o[ea.d],U.visible&&da.visible&&ha.visible&&ia.visible&&(P.doubleSided||P.flipSided!=((ia.positionScreen.x-U.positionScreen.x)*(da.positionScreen.y-U.positionScreen.y)-(ia.positionScreen.y-U.positionScreen.y)*(da.positionScreen.x-U.positionScreen.x)<0||(da.positionScreen.x-ha.positionScreen.x)*(ia.positionScreen.y-ha.positionScreen.y)-
-(da.positionScreen.y-ha.positionScreen.y)*(ia.positionScreen.x-ha.positionScreen.x)<0)))ka=t[v]=t[v]||new THREE.RenderableFace4,v++,m=ka,m.v1.copy(U),m.v2.copy(da),m.v3.copy(ha),m.v4.copy(ia);else continue;m.normalWorld.copy(ea.normal);Y.multiplyVector3(m.normalWorld);m.centroidWorld.copy(ea.centroid);aa.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);E.multiplyVector3(m.centroidScreen);ha=ea.vertexNormals;U=0;for(da=ha.length;U<da;U++)ia=m.vertexNormalsWorld[U],ia.copy(ha[U]),
-Y.multiplyVector3(ia);U=0;for(da=ja.length;U<da;U++)if(ka=ja[U][T]){ha=0;for(ia=ka.length;ha<ia;ha++)m.uvs[U][ha]=ka[ha]}m.meshMaterials=Z;m.faceMaterials=ea.materials;m.overdraw=ca;m.z=m.centroidScreen.z;n.push(m)}}else if(P instanceof THREE.Line){K.multiply(E,aa);T=P.geometry.vertices;U=b();U.positionScreen.copy(T[0].position);K.multiplyVector4(U.positionScreen);L=1;for(ea=T.length;L<ea;L++)if(U=b(),U.positionScreen.copy(T[L].position),K.multiplyVector4(U.positionScreen),da=o[k-2],J.copy(U.positionScreen),
-S.copy(da.positionScreen),e(J,S))J.multiplyScalar(1/J.w),S.multiplyScalar(1/S.w),aa=B[x]=B[x]||new THREE.RenderableLine,x++,w=aa,w.v1.positionScreen.copy(J),w.v2.positionScreen.copy(S),w.z=Math.max(J.z,S.z),w.materials=P.materials,n.push(w)}else if(P instanceof THREE.Particle&&(I.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34,1),E.multiplyVector4(I),I.z/=I.w,I.z>0&&I.z<1))aa=y[H]=y[H]||new THREE.RenderableParticle,H++,A=aa,A.x=I.x/I.w,A.y=I.y/I.w,A.z=I.z,A.rotation=P.rotation.z,A.scale.x=
-P.scale.x*Math.abs(A.x-(I.x+g.projectionMatrix.n11)/(I.w+g.projectionMatrix.n14)),A.scale.y=P.scale.y*Math.abs(A.y-(I.y+g.projectionMatrix.n22)/(I.w+g.projectionMatrix.n24)),A.materials=P.materials,n.push(A);j&&n.sort(c);return n}};
+THREE.Projector=function(){function b(){var b=o[k]=o[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,h=b.z+b.w,g=c.z+c.w,j=-b.z+b.w,k=-c.z+c.w;return h>=0&&g>=0&&j>=0&&k>=0?!0:h<0&&g<0||j<0&&k<0?!1:(h<0?e=Math.max(e,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),j<0?e=Math.max(e,j/(j-k)):k<0&&(f=Math.min(f,j/(j-k))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,g,j=[],h,k,o=[],m,p,u=[],v,t=[],w,x,B=[],A,I,z=[],H=new THREE.Vector4,G=new THREE.Vector4,
+C=new THREE.Matrix4,O=new THREE.Matrix4,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,E=new THREE.Vector4;this.projectVector=function(b,c){C.multiply(c.projectionMatrix,c.matrixWorldInverse);C.multiplyVector3(b);return b};this.unprojectVector=function(b,c){C.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));C.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],k,o,u;g=0;o=
+b.objects;b=0;for(k=o.length;b<k;b++){u=o[b];var m;if(!(m=!u.visible))if(m=u instanceof THREE.Mesh){a:{m=void 0;for(var t=u.matrixWorld,p=-u.geometry.boundingSphere.radius*Math.max(u.scale.x,Math.max(u.scale.y,u.scale.z)),v=0;v<6;v++)if(m=N[v].x*t.n14+N[v].y*t.n24+N[v].z*t.n34+N[v].w,m<=p){m=!1;break a}m=!0}m=!m}if(!m)m=j[g]=j[g]||new THREE.RenderableObject,g++,f=m,H.copy(u.position),C.multiplyVector3(H),f.object=u,f.z=H.z,e.push(f)}h&&e.sort(c);return e};this.projectScene=function(f,g,j){var n=[],
+H=g.near,V=g.far,X,Q,fa,W,ca,Y,ea,$,ga,K,da,Z,ka,ia,ja,R,oa;I=x=v=p=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);C.multiply(g.projectionMatrix,g.matrixWorldInverse);N[0].set(C.n41-C.n11,C.n42-C.n12,C.n43-C.n13,C.n44-C.n14);N[1].set(C.n41+C.n11,C.n42+C.n12,C.n43+C.n13,C.n44+C.n14);N[2].set(C.n41+C.n21,C.n42+C.n22,C.n43+C.n23,C.n44+C.n24);N[3].set(C.n41-C.n21,C.n42-C.n22,C.n43-C.n23,C.n44-C.n24);N[4].set(C.n41-C.n31,C.n42-C.n32,C.n43-C.n33,C.n44-C.n34);N[5].set(C.n41+C.n31,C.n42+
+C.n32,C.n43+C.n33,C.n44+C.n34);for(X=0;X<6;X++)ga=N[X],ga.divideScalar(Math.sqrt(ga.x*ga.x+ga.y*ga.y+ga.z*ga.z));ga=this.projectObjects(f,g,!0);f=0;for(X=ga.length;f<X;f++)if(K=ga[f].object,K.visible)if(da=K.matrixWorld,Z=K.matrixRotationWorld,ka=K.materials,ia=K.overdraw,k=0,K instanceof THREE.Mesh){ja=K.geometry;W=ja.vertices;R=ja.faces;ja=ja.faceVertexUvs;Q=0;for(fa=W.length;Q<fa;Q++)h=b(),h.positionWorld.copy(W[Q].position),da.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
+C.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>H&&h.positionScreen.z<V;W=0;for(Q=R.length;W<Q;W++){fa=R[W];if(fa instanceof THREE.Face3)if(ca=o[fa.a],Y=o[fa.b],ea=o[fa.c],ca.visible&&Y.visible&&ea.visible&&(K.doubleSided||K.flipSided!=(ea.positionScreen.x-ca.positionScreen.x)*(Y.positionScreen.y-ca.positionScreen.y)-(ea.positionScreen.y-ca.positionScreen.y)*(Y.positionScreen.x-ca.positionScreen.x)<0))$=
+u[p]=u[p]||new THREE.RenderableFace3,p++,m=$,m.v1.copy(ca),m.v2.copy(Y),m.v3.copy(ea);else continue;else if(fa instanceof THREE.Face4)if(ca=o[fa.a],Y=o[fa.b],ea=o[fa.c],$=o[fa.d],ca.visible&&Y.visible&&ea.visible&&$.visible&&(K.doubleSided||K.flipSided!=(($.positionScreen.x-ca.positionScreen.x)*(Y.positionScreen.y-ca.positionScreen.y)-($.positionScreen.y-ca.positionScreen.y)*(Y.positionScreen.x-ca.positionScreen.x)<0||(Y.positionScreen.x-ea.positionScreen.x)*($.positionScreen.y-ea.positionScreen.y)-
+(Y.positionScreen.y-ea.positionScreen.y)*($.positionScreen.x-ea.positionScreen.x)<0)))oa=t[v]=t[v]||new THREE.RenderableFace4,v++,m=oa,m.v1.copy(ca),m.v2.copy(Y),m.v3.copy(ea),m.v4.copy($);else continue;m.normalWorld.copy(fa.normal);Z.multiplyVector3(m.normalWorld);m.centroidWorld.copy(fa.centroid);da.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);C.multiplyVector3(m.centroidScreen);ea=fa.vertexNormals;ca=0;for(Y=ea.length;ca<Y;ca++)$=m.vertexNormalsWorld[ca],$.copy(ea[ca]),
+Z.multiplyVector3($);ca=0;for(Y=ja.length;ca<Y;ca++)if(oa=ja[ca][W]){ea=0;for($=oa.length;ea<$;ea++)m.uvs[ca][ea]=oa[ea]}m.meshMaterials=ka;m.faceMaterials=fa.materials;m.overdraw=ia;m.z=m.centroidScreen.z;n.push(m)}}else if(K instanceof THREE.Line){O.multiply(C,da);W=K.geometry.vertices;ca=b();ca.positionScreen.copy(W[0].position);O.multiplyVector4(ca.positionScreen);Q=1;for(fa=W.length;Q<fa;Q++)if(ca=b(),ca.positionScreen.copy(W[Q].position),O.multiplyVector4(ca.positionScreen),Y=o[k-2],D.copy(ca.positionScreen),
+E.copy(Y.positionScreen),e(D,E))D.multiplyScalar(1/D.w),E.multiplyScalar(1/E.w),da=B[x]=B[x]||new THREE.RenderableLine,x++,w=da,w.v1.positionScreen.copy(D),w.v2.positionScreen.copy(E),w.z=Math.max(D.z,E.z),w.materials=K.materials,n.push(w)}else if(K instanceof THREE.Particle&&(G.set(K.matrixWorld.n14,K.matrixWorld.n24,K.matrixWorld.n34,1),C.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))da=z[I]=z[I]||new THREE.RenderableParticle,I++,A=da,A.x=G.x/G.w,A.y=G.y/G.w,A.z=G.z,A.rotation=K.rotation.z,A.scale.x=
+K.scale.x*Math.abs(A.x-(G.x+g.projectionMatrix.n11)/(G.w+g.projectionMatrix.n14)),A.scale.y=K.scale.y*Math.abs(A.y-(G.y+g.projectionMatrix.n22)/(G.w+g.projectionMatrix.n24)),A.materials=K.materials,n.push(A);j&&n.sort(c);return n}};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,j;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;j=f/2};this.render=function(e,f){var o,m,p,u,v,t,w,x;b=c.projectScene(e,f);o=0;for(m=b.length;o<m;o++)if(v=b[o],v instanceof THREE.RenderableParticle){w=v.x*g+g;x=v.y*j+j;p=0;for(u=v.material.length;p<u;p++)if(t=v.material[p],t instanceof THREE.ParticleDOMMaterial)t=t.domElement,t.style.left=w+"px",t.style.top=x+"px"}}};
-THREE.CanvasRenderer=function(b){function c(b){if(B!=b)t.globalAlpha=B=b}function e(b){if(A!=b){switch(b){case THREE.NormalBlending:t.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:t.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:t.globalCompositeOperation="darker"}A=b}}function f(b){if(H!=b)t.strokeStyle=H=b}function g(b){if(y!=b)t.fillStyle=y=b}var j=this,h=null,k=new THREE.Projector,b=b||{},o=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-m,p,u,v,t=o.getContext("2d"),w=new THREE.Color(0),x=0,B=1,A=0,H=null,y=null,G=null,I=null,E=null,K,D,J,S,X=new THREE.RenderableVertex,R=new THREE.RenderableVertex,C,n,W,V,fa,L,ea,T,U,da,ha,ia,M=new THREE.Color(0),P=new THREE.Color(0),aa=new THREE.Color(0),Y=new THREE.Color(0),Z=new THREE.Color(0),ca=[],ja,la,ka,pa,sa,ua,Ia,Ja,Ka,va,ya=new THREE.Rectangle,$=new THREE.Rectangle,ta=new THREE.Rectangle,Ea=!1,oa=new THREE.Color,ma=new THREE.Color,Ga=new THREE.Color,Da=new THREE.Color,N=new THREE.Vector3,
-za,ga,Ya,Aa,Ba,Va,b=16;za=document.createElement("canvas");za.width=za.height=2;ga=za.getContext("2d");ga.fillStyle="rgba(0,0,0,1)";ga.fillRect(0,0,2,2);Ya=ga.getImageData(0,0,2,2);Aa=Ya.data;Ba=document.createElement("canvas");Ba.width=Ba.height=b;Va=Ba.getContext("2d");Va.translate(-b/2,-b/2);Va.scale(b,b);b--;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(b,c){m=b;p=c;u=Math.floor(m/2);v=Math.floor(p/2);o.width=m;o.height=
-p;ya.set(-u,-v,u,v);$.set(-u,-v,u,v);B=1;A=0;E=I=G=y=H=null};this.setClearColor=function(b,c){w.copy(b);x=c;$.set(-u,-v,u,v)};this.setClearColorHex=function(b,c){w.setHex(b);x=c;$.set(-u,-v,u,v)};this.clear=function(){t.setTransform(1,0,0,-1,u,v);$.isEmpty()||($.minSelf(ya),$.inflate(2),x<1&&t.clearRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight())),x>0&&(e(THREE.NormalBlending),c(1),g("rgba("+Math.floor(w.r*255)+","+Math.floor(w.g*255)+","+Math.floor(w.b*
-255)+","+x+")"),t.fillRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()))),$.empty())};this.render=function(b,o){function m(b){var c,e,f,h=b.lights;ma.setRGB(0,0,0);Ga.setRGB(0,0,0);Da.setRGB(0,0,0);b=0;for(c=h.length;b<c;b++)e=h[b],f=e.color,e instanceof THREE.AmbientLight?(ma.r+=f.r,ma.g+=f.g,ma.b+=f.b):e instanceof THREE.DirectionalLight?(Ga.r+=f.r,Ga.g+=f.g,Ga.b+=f.b):e instanceof THREE.PointLight&&(Da.r+=f.r,Da.g+=f.g,Da.b+=f.b)}function p(b,c,e,
-f){var h,g,j,k,n=b.lights,b=0;for(h=n.length;b<h;b++)g=n[b],j=g.color,g instanceof THREE.DirectionalLight?(k=e.dot(g.position),k<=0||(k*=g.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)):g instanceof THREE.PointLight&&(k=e.dot(N.sub(g.position,c).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(c.distanceTo(g.position)/g.distance,1),k!=0&&(k*=g.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)))}function w(b,h,j){c(j.opacity);e(j.blending);var k,n,o,m,p,ga;if(j instanceof THREE.ParticleBasicMaterial){if(j.map)m=
-j.map.image,p=m.width>>1,ga=m.height>>1,j=h.scale.x*u,o=h.scale.y*v,k=j*p,n=o*ga,ta.set(b.x-k,b.y-n,b.x+k,b.y+n),ya.instersects(ta)&&(t.save(),t.translate(b.x,b.y),t.rotate(-h.rotation),t.scale(j,-o),t.translate(-p,-ga),t.drawImage(m,0,0),t.restore())}else j instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*u,n=h.scale.y*v,ta.set(b.x-k,b.y-n,b.x+k,b.y+n),ya.instersects(ta)&&(f(j.color.getContextStyle()),g(j.color.getContextStyle()),t.save(),t.translate(b.x,b.y),t.rotate(-h.rotation),t.scale(k,
-n),j.program(t),t.restore()))}function x(b,h,g,j){c(j.opacity);e(j.blending);t.beginPath();t.moveTo(b.positionScreen.x,b.positionScreen.y);t.lineTo(h.positionScreen.x,h.positionScreen.y);t.closePath();if(j instanceof THREE.LineBasicMaterial){b=j.linewidth;if(G!=b)t.lineWidth=G=b;b=j.linecap;if(I!=b)t.lineCap=I=b;b=j.linejoin;if(E!=b)t.lineJoin=E=b;f(j.color.getContextStyle());t.stroke();ta.inflate(j.linewidth*2)}}function A(b,f,h,g,k,m,u,t,ga){j.data.vertices+=3;j.data.faces++;c(t.opacity);e(t.blending);
-C=b.positionScreen.x;n=b.positionScreen.y;W=f.positionScreen.x;V=f.positionScreen.y;fa=h.positionScreen.x;L=h.positionScreen.y;y(C,n,W,V,fa,L);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(pa=u.uvs[0],Za(C,n,W,V,fa,L,pa[g].u,pa[g].v,pa[k].u,pa[k].v,pa[m].u,pa[m].v,t.map));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=o.matrixWorldInverse,N.copy(u.vertexNormalsWorld[0]),sa=(N.x*b.n11+N.y*b.n12+N.z*b.n13)*0.5+0.5,ua=
--(N.x*b.n21+N.y*b.n22+N.z*b.n23)*0.5+0.5,N.copy(u.vertexNormalsWorld[1]),Ia=(N.x*b.n11+N.y*b.n12+N.z*b.n13)*0.5+0.5,Ja=-(N.x*b.n21+N.y*b.n22+N.z*b.n23)*0.5+0.5,N.copy(u.vertexNormalsWorld[2]),Ka=(N.x*b.n11+N.y*b.n12+N.z*b.n13)*0.5+0.5,va=-(N.x*b.n21+N.y*b.n22+N.z*b.n23)*0.5+0.5,Za(C,n,W,V,fa,L,sa,ua,Ia,Ja,Ka,va,t.envMap)}else t.wireframe?La(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ma(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&(t.map.mapping instanceof
-THREE.UVMapping&&(pa=u.uvs[0],Za(C,n,W,V,fa,L,pa[g].u,pa[g].v,pa[k].u,pa[k].v,pa[m].u,pa[m].v,t.map)),e(THREE.SubtractiveBlending)),Ea?!t.wireframe&&t.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?(P.r=aa.r=Y.r=ma.r,P.g=aa.g=Y.g=ma.g,P.b=aa.b=Y.b=ma.b,p(ga,u.v1.positionWorld,u.vertexNormalsWorld[0],P),p(ga,u.v2.positionWorld,u.vertexNormalsWorld[1],aa),p(ga,u.v3.positionWorld,u.vertexNormalsWorld[2],Y),Z.r=(aa.r+Y.r)*0.5,Z.g=(aa.g+Y.g)*0.5,Z.b=(aa.b+Y.b)*0.5,ka=Wa(P,aa,Y,Z),Ta(C,n,
-W,V,fa,L,0,0,1,0,0,1,ka)):(oa.r=ma.r,oa.g=ma.g,oa.b=ma.b,p(ga,u.centroidWorld,u.normalWorld,oa),M.r=Math.max(0,Math.min(t.color.r*oa.r,1)),M.g=Math.max(0,Math.min(t.color.g*oa.g,1)),M.b=Math.max(0,Math.min(t.color.b*oa.b,1)),t.wireframe?La(M,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ma(M)):t.wireframe?La(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ma(t.color);else if(t instanceof THREE.MeshDepthMaterial)ja=o.near,la=o.far,P.r=P.g=P.b=1-Oa(b.positionScreen.z,
-ja,la),aa.r=aa.g=aa.b=1-Oa(f.positionScreen.z,ja,la),Y.r=Y.g=Y.b=1-Oa(h.positionScreen.z,ja,la),Z.r=(aa.r+Y.r)*0.5,Z.g=(aa.g+Y.g)*0.5,Z.b=(aa.b+Y.b)*0.5,ka=Wa(P,aa,Y,Z),Ta(C,n,W,V,fa,L,0,0,1,0,0,1,ka);else if(t instanceof THREE.MeshNormalMaterial)M.r=Ua(u.normalWorld.x),M.g=Ua(u.normalWorld.y),M.b=Ua(u.normalWorld.z),t.wireframe?La(M,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ma(M)}function B(b,f,h,g,k,u,t,m,ga){j.data.vertices+=4;j.data.faces++;c(m.opacity);e(m.blending);if(m.map||
-m.envMap)A(b,f,g,0,1,3,t,m,ga),A(k,h,u,1,2,3,t,m,ga);else if(C=b.positionScreen.x,n=b.positionScreen.y,W=f.positionScreen.x,V=f.positionScreen.y,fa=h.positionScreen.x,L=h.positionScreen.y,ea=g.positionScreen.x,T=g.positionScreen.y,U=k.positionScreen.x,da=k.positionScreen.y,ha=u.positionScreen.x,ia=u.positionScreen.y,m instanceof THREE.MeshBasicMaterial)H(C,n,W,V,fa,L,ea,T),m.wireframe?La(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Ma(m.color);else if(m instanceof THREE.MeshLambertMaterial)Ea?
-!m.wireframe&&m.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==4?(P.r=aa.r=Y.r=Z.r=ma.r,P.g=aa.g=Y.g=Z.g=ma.g,P.b=aa.b=Y.b=Z.b=ma.b,p(ga,t.v1.positionWorld,t.vertexNormalsWorld[0],P),p(ga,t.v2.positionWorld,t.vertexNormalsWorld[1],aa),p(ga,t.v4.positionWorld,t.vertexNormalsWorld[3],Y),p(ga,t.v3.positionWorld,t.vertexNormalsWorld[2],Z),ka=Wa(P,aa,Y,Z),y(C,n,W,V,ea,T),Ta(C,n,W,V,ea,T,0,0,1,0,0,1,ka),y(U,da,fa,L,ha,ia),Ta(U,da,fa,L,ha,ia,1,0,1,1,0,1,ka)):(oa.r=ma.r,oa.g=ma.g,oa.b=ma.b,p(ga,
-t.centroidWorld,t.normalWorld,oa),M.r=Math.max(0,Math.min(m.color.r*oa.r,1)),M.g=Math.max(0,Math.min(m.color.g*oa.g,1)),M.b=Math.max(0,Math.min(m.color.b*oa.b,1)),H(C,n,W,V,fa,L,ea,T),m.wireframe?La(M,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Ma(M)):(H(C,n,W,V,fa,L,ea,T),m.wireframe?La(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Ma(m.color));else if(m instanceof THREE.MeshNormalMaterial)M.r=Ua(t.normalWorld.x),M.g=Ua(t.normalWorld.y),M.b=Ua(t.normalWorld.z),
-H(C,n,W,V,fa,L,ea,T),m.wireframe?La(M,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Ma(M);else if(m instanceof THREE.MeshDepthMaterial)ja=o.near,la=o.far,P.r=P.g=P.b=1-Oa(b.positionScreen.z,ja,la),aa.r=aa.g=aa.b=1-Oa(f.positionScreen.z,ja,la),Y.r=Y.g=Y.b=1-Oa(g.positionScreen.z,ja,la),Z.r=Z.g=Z.b=1-Oa(h.positionScreen.z,ja,la),ka=Wa(P,aa,Y,Z),y(C,n,W,V,ea,T),Ta(C,n,W,V,ea,T,0,0,1,0,0,1,ka),y(U,da,fa,L,ha,ia),Ta(U,da,fa,L,ha,ia,1,0,1,1,0,1,ka)}function y(b,c,e,f,h,g){t.beginPath();t.moveTo(b,
-c);t.lineTo(e,f);t.lineTo(h,g);t.lineTo(b,c);t.closePath()}function H(b,c,e,f,h,g,j,k){t.beginPath();t.moveTo(b,c);t.lineTo(e,f);t.lineTo(h,g);t.lineTo(j,k);t.lineTo(b,c);t.closePath()}function La(b,c,e,h){if(G!=c)t.lineWidth=G=c;if(I!=e)t.lineCap=I=e;if(E!=h)t.lineJoin=E=h;f(b.getContextStyle());t.stroke();ta.inflate(c*2)}function Ma(b){g(b.getContextStyle());t.fill()}function Za(b,c,e,f,h,j,k,n,o,m,u,p,ga){if(ga.image.width!=0){if(ga.needsUpdate==!0||ca[ga.id]==void 0){var v=ga.wrapS==THREE.RepeatWrapping,
-Ba=ga.wrapT==THREE.RepeatWrapping;ca[ga.id]=t.createPattern(ga.image,v&&Ba?"repeat":v&&!Ba?"repeat-x":!v&&Ba?"repeat-y":"no-repeat");ga.needsUpdate=!1}g(ca[ga.id]);var v=ga.offset.x/ga.repeat.x,Ba=ga.offset.y/ga.repeat.y,w=(ga.image.width-1)*ga.repeat.x,ga=(ga.image.height-1)*ga.repeat.y,k=(k+v)*w,n=(n+Ba)*ga,o=(o+v)*w,m=(m+Ba)*ga,u=(u+v)*w,p=(p+Ba)*ga;e-=b;f-=c;h-=b;j-=c;o-=k;m-=n;u-=k;p-=n;v=1/(o*p-u*m);ga=(p*e-m*h)*v;m=(p*f-m*j)*v;e=(o*h-u*e)*v;f=(o*j-u*f)*v;b=b-ga*k-e*n;c=c-m*k-f*n;t.save();t.transform(ga,
-m,e,f,b,c);t.fill();t.restore()}}function Ta(b,c,e,f,h,g,j,k,n,o,m,u,ga){var p,v;p=ga.width-1;v=ga.height-1;j*=p;k*=v;n*=p;o*=v;m*=p;u*=v;e-=b;f-=c;h-=b;g-=c;n-=j;o-=k;m-=j;u-=k;v=1/(n*u-m*o);p=(u*e-o*h)*v;o=(u*f-o*g)*v;e=(n*h-m*e)*v;f=(n*g-m*f)*v;b=b-p*j-e*k;c=c-o*j-f*k;t.save();t.transform(p,o,e,f,b,c);t.clip();t.drawImage(ga,0,0);t.restore()}function Wa(b,c,e,f){var h=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),j=~~(c.r*255),k=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),m=~~(f.r*
-255),u=~~(f.g*255),f=~~(f.b*255);Aa[0]=h<0?0:h>255?255:h;Aa[1]=g<0?0:g>255?255:g;Aa[2]=b<0?0:b>255?255:b;Aa[4]=j<0?0:j>255?255:j;Aa[5]=k<0?0:k>255?255:k;Aa[6]=c<0?0:c>255?255:c;Aa[8]=n<0?0:n>255?255:n;Aa[9]=o<0?0:o>255?255:o;Aa[10]=e<0?0:e>255?255:e;Aa[12]=m<0?0:m>255?255:m;Aa[13]=u<0?0:u>255?255:u;Aa[14]=f<0?0:f>255?255:f;ga.putImageData(Ya,0,0);Va.drawImage(za,0,0);return Ba}function Oa(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Ua(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Na(b,c){var e=
-c.x-b.x,f=c.y-b.y,h=e*e+f*f;h!=0&&(h=1/Math.sqrt(h),e*=h,f*=h,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Xa,$a,na,Ca,F,z,Q,wa;this.autoClear?this.clear():t.setTransform(1,0,0,-1,u,v);j.data.vertices=0;j.data.faces=0;h=k.projectScene(b,o,this.sortElements);(Ea=b.lights.length>0)&&m(b);Xa=0;for($a=h.length;Xa<$a;Xa++){na=h[Xa];ta.empty();if(na instanceof THREE.RenderableParticle){K=na;K.x*=u;K.y*=v;Ca=0;for(F=na.materials.length;Ca<F;)wa=na.materials[Ca++],wa.opacity!=0&&w(K,na,wa,b)}else if(na instanceof THREE.RenderableLine){if(K=
-na.v1,D=na.v2,K.positionScreen.x*=u,K.positionScreen.y*=v,D.positionScreen.x*=u,D.positionScreen.y*=v,ta.addPoint(K.positionScreen.x,K.positionScreen.y),ta.addPoint(D.positionScreen.x,D.positionScreen.y),ya.instersects(ta)){Ca=0;for(F=na.materials.length;Ca<F;)wa=na.materials[Ca++],wa.opacity!=0&&x(K,D,na,wa,b)}}else if(na instanceof THREE.RenderableFace3){if(K=na.v1,D=na.v2,J=na.v3,K.positionScreen.x*=u,K.positionScreen.y*=v,D.positionScreen.x*=u,D.positionScreen.y*=v,J.positionScreen.x*=u,J.positionScreen.y*=
-v,na.overdraw&&(Na(K.positionScreen,D.positionScreen),Na(D.positionScreen,J.positionScreen),Na(J.positionScreen,K.positionScreen)),ta.add3Points(K.positionScreen.x,K.positionScreen.y,D.positionScreen.x,D.positionScreen.y,J.positionScreen.x,J.positionScreen.y),ya.instersects(ta)){Ca=0;for(F=na.meshMaterials.length;Ca<F;)if(wa=na.meshMaterials[Ca++],wa instanceof THREE.MeshFaceMaterial){z=0;for(Q=na.faceMaterials.length;z<Q;)(wa=na.faceMaterials[z++])&&wa.opacity!=0&&A(K,D,J,0,1,2,na,wa,b)}else wa.opacity!=
-0&&A(K,D,J,0,1,2,na,wa,b)}}else if(na instanceof THREE.RenderableFace4&&(K=na.v1,D=na.v2,J=na.v3,S=na.v4,K.positionScreen.x*=u,K.positionScreen.y*=v,D.positionScreen.x*=u,D.positionScreen.y*=v,J.positionScreen.x*=u,J.positionScreen.y*=v,S.positionScreen.x*=u,S.positionScreen.y*=v,X.positionScreen.copy(D.positionScreen),R.positionScreen.copy(S.positionScreen),na.overdraw&&(Na(K.positionScreen,D.positionScreen),Na(D.positionScreen,S.positionScreen),Na(S.positionScreen,K.positionScreen),Na(J.positionScreen,
-X.positionScreen),Na(J.positionScreen,R.positionScreen)),ta.addPoint(K.positionScreen.x,K.positionScreen.y),ta.addPoint(D.positionScreen.x,D.positionScreen.y),ta.addPoint(J.positionScreen.x,J.positionScreen.y),ta.addPoint(S.positionScreen.x,S.positionScreen.y),ya.instersects(ta))){Ca=0;for(F=na.meshMaterials.length;Ca<F;)if(wa=na.meshMaterials[Ca++],wa instanceof THREE.MeshFaceMaterial){z=0;for(Q=na.faceMaterials.length;z<Q;)(wa=na.faceMaterials[z++])&&wa.opacity!=0&&B(K,D,J,S,X,R,na,wa,b)}else wa.opacity!=
-0&&B(K,D,J,S,X,R,na,wa,b)}$.addRectangle(ta)}t.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(b,c,e){var f,h,g,j;f=0;for(h=b.lights.length;f<h;f++)g=b.lights[f],g instanceof THREE.DirectionalLight?(j=c.normalWorld.dot(g.position)*g.intensity,j>0&&(e.r+=g.color.r*j,e.g+=g.color.g*j,e.b+=g.color.b*j)):g instanceof THREE.PointLight&&(S.sub(g.position,c.centroidWorld),S.normalize(),j=c.normalWorld.dot(S)*g.intensity,j>0&&(e.r+=g.color.r*j,e.g+=g.color.g*j,e.b+=g.color.b*j))}function c(c,e,h,k,m,u){j.data.vertices+=3;j.data.faces++;C=f(n++);C.setAttribute("d",
-"M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");m instanceof THREE.MeshBasicMaterial?G.copy(m.color):m instanceof THREE.MeshLambertMaterial?y?(I.r=E.r,I.g=E.g,I.b=E.b,b(u,k,I),G.r=Math.max(0,Math.min(m.color.r*I.r,1)),G.g=Math.max(0,Math.min(m.color.g*I.g,1)),G.b=Math.max(0,Math.min(m.color.b*I.b,1))):G.copy(m.color):m instanceof THREE.MeshDepthMaterial?(J=1-m.__2near/(m.__farPlusNear-k.z*m.__farMinusNear),
-G.setRGB(J,J,J)):m instanceof THREE.MeshNormalMaterial&&G.setRGB(g(k.normalWorld.x),g(k.normalWorld.y),g(k.normalWorld.z));m.wireframe?C.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+m.wireframeLinewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframeLinecap+"; stroke-linejoin: "+m.wireframeLinejoin):C.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+m.opacity);o.appendChild(C)}function e(c,e,h,k,m,u,t){j.data.vertices+=4;j.data.faces++;
-C=f(n++);C.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?G.copy(u.color):u instanceof THREE.MeshLambertMaterial?y?(I.r=E.r,I.g=E.g,I.b=E.b,b(t,m,I),G.r=Math.max(0,Math.min(u.color.r*I.r,1)),G.g=Math.max(0,Math.min(u.color.g*I.g,1)),G.b=Math.max(0,Math.min(u.color.b*I.b,1))):G.copy(u.color):u instanceof
-THREE.MeshDepthMaterial?(J=1-u.__2near/(u.__farPlusNear-m.z*u.__farMinusNear),G.setRGB(J,J,J)):u instanceof THREE.MeshNormalMaterial&&G.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));u.wireframe?C.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):C.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+
-u.opacity);o.appendChild(C)}function f(b){X[b]==null&&(X[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),V==0&&X[b].setAttribute("shape-rendering","crispEdges"));return X[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var j=this,h=null,k=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,p,u,v,t,w,x,B,A=new THREE.Rectangle,H=new THREE.Rectangle,y=!1,G=new THREE.Color(16777215),I=new THREE.Color(16777215),E=new THREE.Color(0),K=new THREE.Color(0),
-D=new THREE.Color(0),J,S=new THREE.Vector3,X=[],R=[],C,n,W,V=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":V=1;break;case "low":V=0}};this.setSize=function(b,c){m=b;p=c;u=m/2;v=p/2;o.setAttribute("viewBox",-u+" "+-v+" "+m+" "+p);o.setAttribute("width",m);o.setAttribute("height",p);A.set(-u,-v,u,v)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=
-function(b,f){var g,m,p,G,I,J,M,P;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;h=k.projectScene(b,f,this.sortElements);W=n=0;if(y=b.lights.length>0){M=b.lights;E.setRGB(0,0,0);K.setRGB(0,0,0);D.setRGB(0,0,0);g=0;for(m=M.length;g<m;g++)p=M[g],G=p.color,p instanceof THREE.AmbientLight?(E.r+=G.r,E.g+=G.g,E.b+=G.b):p instanceof THREE.DirectionalLight?(K.r+=G.r,K.g+=G.g,K.b+=G.b):p instanceof THREE.PointLight&&(D.r+=G.r,D.g+=G.g,D.b+=G.b)}g=0;for(m=h.length;g<m;g++)if(M=h[g],H.empty(),
-M instanceof THREE.RenderableParticle){t=M;t.x*=u;t.y*=-v;p=0;for(G=M.materials.length;p<G;)p++}else if(M instanceof THREE.RenderableLine){if(t=M.v1,w=M.v2,t.positionScreen.x*=u,t.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,H.addPoint(t.positionScreen.x,t.positionScreen.y),H.addPoint(w.positionScreen.x,w.positionScreen.y),A.instersects(H)){p=0;for(G=M.materials.length;p<G;)if((P=M.materials[p++])&&P.opacity!=0){I=t;J=w;var S=W++;R[S]==null&&(R[S]=document.createElementNS("http://www.w3.org/2000/svg",
-"line"),V==0&&R[S].setAttribute("shape-rendering","crispEdges"));C=R[S];C.setAttribute("x1",I.positionScreen.x);C.setAttribute("y1",I.positionScreen.y);C.setAttribute("x2",J.positionScreen.x);C.setAttribute("y2",J.positionScreen.y);P instanceof THREE.LineBasicMaterial&&(C.setAttribute("style","fill: none; stroke: "+P.color.getContextStyle()+"; stroke-width: "+P.linewidth+"; stroke-opacity: "+P.opacity+"; stroke-linecap: "+P.linecap+"; stroke-linejoin: "+P.linejoin),o.appendChild(C))}}}else if(M instanceof
-THREE.RenderableFace3){if(t=M.v1,w=M.v2,x=M.v3,t.positionScreen.x*=u,t.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,H.addPoint(t.positionScreen.x,t.positionScreen.y),H.addPoint(w.positionScreen.x,w.positionScreen.y),H.addPoint(x.positionScreen.x,x.positionScreen.y),A.instersects(H)){p=0;for(G=M.meshMaterials.length;p<G;)if(P=M.meshMaterials[p++],P instanceof THREE.MeshFaceMaterial){I=0;for(J=M.faceMaterials.length;I<J;)(P=M.faceMaterials[I++])&&
-P.opacity!=0&&c(t,w,x,M,P,b)}else P&&P.opacity!=0&&c(t,w,x,M,P,b)}}else if(M instanceof THREE.RenderableFace4&&(t=M.v1,w=M.v2,x=M.v3,B=M.v4,t.positionScreen.x*=u,t.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,B.positionScreen.x*=u,B.positionScreen.y*=-v,H.addPoint(t.positionScreen.x,t.positionScreen.y),H.addPoint(w.positionScreen.x,w.positionScreen.y),H.addPoint(x.positionScreen.x,x.positionScreen.y),H.addPoint(B.positionScreen.x,B.positionScreen.y),
-A.instersects(H))){p=0;for(G=M.meshMaterials.length;p<G;)if(P=M.meshMaterials[p++],P instanceof THREE.MeshFaceMaterial){I=0;for(J=M.faceMaterials.length;I<J;)(P=M.faceMaterials[I++])&&P.opacity!=0&&e(t,w,x,B,M,P,b)}else P&&P.opacity!=0&&e(t,w,x,B,M,P,b)}}};
+THREE.CanvasRenderer=function(b){function c(b){if(B!=b)t.globalAlpha=B=b}function e(b){if(A!=b){switch(b){case THREE.NormalBlending:t.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:t.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:t.globalCompositeOperation="darker"}A=b}}function f(b){if(I!=b)t.strokeStyle=I=b}function g(b){if(z!=b)t.fillStyle=z=b}var j=this,h=null,k=new THREE.Projector,b=b||{},o=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
+m,p,u,v,t=o.getContext("2d"),w=new THREE.Color(0),x=0,B=1,A=0,I=null,z=null,H=null,G=null,C=null,O,N,D,E,U=new THREE.RenderableVertex,M=new THREE.RenderableVertex,L,n,S,V,X,Q,fa,W,ca,Y,ea,$,ga=new THREE.Color(0),K=new THREE.Color(0),da=new THREE.Color(0),Z=new THREE.Color(0),ka=new THREE.Color(0),ia=[],ja,R,oa,qa,la,ua,Ia,Ja,Ka,va,ya=new THREE.Rectangle,aa=new THREE.Rectangle,ta=new THREE.Rectangle,Ea=!1,pa=new THREE.Color,ma=new THREE.Color,Ga=new THREE.Color,Da=new THREE.Color,J=new THREE.Vector3,
+za,ha,Ya,Aa,Ba,Va,b=16;za=document.createElement("canvas");za.width=za.height=2;ha=za.getContext("2d");ha.fillStyle="rgba(0,0,0,1)";ha.fillRect(0,0,2,2);Ya=ha.getImageData(0,0,2,2);Aa=Ya.data;Ba=document.createElement("canvas");Ba.width=Ba.height=b;Va=Ba.getContext("2d");Va.translate(-b/2,-b/2);Va.scale(b,b);b--;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(b,c){m=b;p=c;u=Math.floor(m/2);v=Math.floor(p/2);o.width=m;o.height=
+p;ya.set(-u,-v,u,v);aa.set(-u,-v,u,v);B=1;A=0;C=G=H=z=I=null};this.setClearColor=function(b,c){w.copy(b);x=c;aa.set(-u,-v,u,v)};this.setClearColorHex=function(b,c){w.setHex(b);x=c;aa.set(-u,-v,u,v)};this.clear=function(){t.setTransform(1,0,0,-1,u,v);aa.isEmpty()||(aa.minSelf(ya),aa.inflate(2),x<1&&t.clearRect(Math.floor(aa.getX()),Math.floor(aa.getY()),Math.floor(aa.getWidth()),Math.floor(aa.getHeight())),x>0&&(e(THREE.NormalBlending),c(1),g("rgba("+Math.floor(w.r*255)+","+Math.floor(w.g*255)+","+
+Math.floor(w.b*255)+","+x+")"),t.fillRect(Math.floor(aa.getX()),Math.floor(aa.getY()),Math.floor(aa.getWidth()),Math.floor(aa.getHeight()))),aa.empty())};this.render=function(b,o){function m(b){var c,e,f,h=b.lights;ma.setRGB(0,0,0);Ga.setRGB(0,0,0);Da.setRGB(0,0,0);b=0;for(c=h.length;b<c;b++)e=h[b],f=e.color,e instanceof THREE.AmbientLight?(ma.r+=f.r,ma.g+=f.g,ma.b+=f.b):e instanceof THREE.DirectionalLight?(Ga.r+=f.r,Ga.g+=f.g,Ga.b+=f.b):e instanceof THREE.PointLight&&(Da.r+=f.r,Da.g+=f.g,Da.b+=f.b)}
+function p(b,c,e,f){var h,g,j,k,n=b.lights,b=0;for(h=n.length;b<h;b++)g=n[b],j=g.color,g instanceof THREE.DirectionalLight?(k=e.dot(g.position),k<=0||(k*=g.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)):g instanceof THREE.PointLight&&(k=e.dot(J.sub(g.position,c).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(c.distanceTo(g.position)/g.distance,1),k!=0&&(k*=g.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)))}function w(b,h,j){c(j.opacity);e(j.blending);var k,n,o,m,p,ha;if(j instanceof THREE.ParticleBasicMaterial){if(j.map)m=
+j.map.image,p=m.width>>1,ha=m.height>>1,j=h.scale.x*u,o=h.scale.y*v,k=j*p,n=o*ha,ta.set(b.x-k,b.y-n,b.x+k,b.y+n),ya.instersects(ta)&&(t.save(),t.translate(b.x,b.y),t.rotate(-h.rotation),t.scale(j,-o),t.translate(-p,-ha),t.drawImage(m,0,0),t.restore())}else j instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*u,n=h.scale.y*v,ta.set(b.x-k,b.y-n,b.x+k,b.y+n),ya.instersects(ta)&&(f(j.color.getContextStyle()),g(j.color.getContextStyle()),t.save(),t.translate(b.x,b.y),t.rotate(-h.rotation),t.scale(k,
+n),j.program(t),t.restore()))}function x(b,h,g,j){c(j.opacity);e(j.blending);t.beginPath();t.moveTo(b.positionScreen.x,b.positionScreen.y);t.lineTo(h.positionScreen.x,h.positionScreen.y);t.closePath();if(j instanceof THREE.LineBasicMaterial){b=j.linewidth;if(H!=b)t.lineWidth=H=b;b=j.linecap;if(G!=b)t.lineCap=G=b;b=j.linejoin;if(C!=b)t.lineJoin=C=b;f(j.color.getContextStyle());t.stroke();ta.inflate(j.linewidth*2)}}function A(b,f,h,g,k,m,u,t,ha){j.data.vertices+=3;j.data.faces++;c(t.opacity);e(t.blending);
+L=b.positionScreen.x;n=b.positionScreen.y;S=f.positionScreen.x;V=f.positionScreen.y;X=h.positionScreen.x;Q=h.positionScreen.y;z(L,n,S,V,X,Q);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(qa=u.uvs[0],Za(L,n,S,V,X,Q,qa[g].u,qa[g].v,qa[k].u,qa[k].v,qa[m].u,qa[m].v,t.map));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=o.matrixWorldInverse,J.copy(u.vertexNormalsWorld[0]),la=(J.x*b.n11+J.y*b.n12+J.z*b.n13)*0.5+0.5,ua=-(J.x*
+b.n21+J.y*b.n22+J.z*b.n23)*0.5+0.5,J.copy(u.vertexNormalsWorld[1]),Ia=(J.x*b.n11+J.y*b.n12+J.z*b.n13)*0.5+0.5,Ja=-(J.x*b.n21+J.y*b.n22+J.z*b.n23)*0.5+0.5,J.copy(u.vertexNormalsWorld[2]),Ka=(J.x*b.n11+J.y*b.n12+J.z*b.n13)*0.5+0.5,va=-(J.x*b.n21+J.y*b.n22+J.z*b.n23)*0.5+0.5,Za(L,n,S,V,X,Q,la,ua,Ia,Ja,Ka,va,t.envMap)}else t.wireframe?La(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ma(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&(t.map.mapping instanceof
+THREE.UVMapping&&(qa=u.uvs[0],Za(L,n,S,V,X,Q,qa[g].u,qa[g].v,qa[k].u,qa[k].v,qa[m].u,qa[m].v,t.map)),e(THREE.SubtractiveBlending)),Ea?!t.wireframe&&t.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?(K.r=da.r=Z.r=ma.r,K.g=da.g=Z.g=ma.g,K.b=da.b=Z.b=ma.b,p(ha,u.v1.positionWorld,u.vertexNormalsWorld[0],K),p(ha,u.v2.positionWorld,u.vertexNormalsWorld[1],da),p(ha,u.v3.positionWorld,u.vertexNormalsWorld[2],Z),ka.r=(da.r+Z.r)*0.5,ka.g=(da.g+Z.g)*0.5,ka.b=(da.b+Z.b)*0.5,oa=Wa(K,da,Z,ka),Ta(L,
+n,S,V,X,Q,0,0,1,0,0,1,oa)):(pa.r=ma.r,pa.g=ma.g,pa.b=ma.b,p(ha,u.centroidWorld,u.normalWorld,pa),ga.r=Math.max(0,Math.min(t.color.r*pa.r,1)),ga.g=Math.max(0,Math.min(t.color.g*pa.g,1)),ga.b=Math.max(0,Math.min(t.color.b*pa.b,1)),t.wireframe?La(ga,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ma(ga)):t.wireframe?La(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ma(t.color);else if(t instanceof THREE.MeshDepthMaterial)ja=o.near,R=o.far,K.r=K.g=K.b=1-Oa(b.positionScreen.z,
+ja,R),da.r=da.g=da.b=1-Oa(f.positionScreen.z,ja,R),Z.r=Z.g=Z.b=1-Oa(h.positionScreen.z,ja,R),ka.r=(da.r+Z.r)*0.5,ka.g=(da.g+Z.g)*0.5,ka.b=(da.b+Z.b)*0.5,oa=Wa(K,da,Z,ka),Ta(L,n,S,V,X,Q,0,0,1,0,0,1,oa);else if(t instanceof THREE.MeshNormalMaterial)ga.r=Ua(u.normalWorld.x),ga.g=Ua(u.normalWorld.y),ga.b=Ua(u.normalWorld.z),t.wireframe?La(ga,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ma(ga)}function B(b,f,h,g,k,u,t,m,ha){j.data.vertices+=4;j.data.faces++;c(m.opacity);e(m.blending);if(m.map||
+m.envMap)A(b,f,g,0,1,3,t,m,ha),A(k,h,u,1,2,3,t,m,ha);else if(L=b.positionScreen.x,n=b.positionScreen.y,S=f.positionScreen.x,V=f.positionScreen.y,X=h.positionScreen.x,Q=h.positionScreen.y,fa=g.positionScreen.x,W=g.positionScreen.y,ca=k.positionScreen.x,Y=k.positionScreen.y,ea=u.positionScreen.x,$=u.positionScreen.y,m instanceof THREE.MeshBasicMaterial)I(L,n,S,V,X,Q,fa,W),m.wireframe?La(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Ma(m.color);else if(m instanceof THREE.MeshLambertMaterial)Ea?
+!m.wireframe&&m.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==4?(K.r=da.r=Z.r=ka.r=ma.r,K.g=da.g=Z.g=ka.g=ma.g,K.b=da.b=Z.b=ka.b=ma.b,p(ha,t.v1.positionWorld,t.vertexNormalsWorld[0],K),p(ha,t.v2.positionWorld,t.vertexNormalsWorld[1],da),p(ha,t.v4.positionWorld,t.vertexNormalsWorld[3],Z),p(ha,t.v3.positionWorld,t.vertexNormalsWorld[2],ka),oa=Wa(K,da,Z,ka),z(L,n,S,V,fa,W),Ta(L,n,S,V,fa,W,0,0,1,0,0,1,oa),z(ca,Y,X,Q,ea,$),Ta(ca,Y,X,Q,ea,$,1,0,1,1,0,1,oa)):(pa.r=ma.r,pa.g=ma.g,pa.b=ma.b,p(ha,
+t.centroidWorld,t.normalWorld,pa),ga.r=Math.max(0,Math.min(m.color.r*pa.r,1)),ga.g=Math.max(0,Math.min(m.color.g*pa.g,1)),ga.b=Math.max(0,Math.min(m.color.b*pa.b,1)),I(L,n,S,V,X,Q,fa,W),m.wireframe?La(ga,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Ma(ga)):(I(L,n,S,V,X,Q,fa,W),m.wireframe?La(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Ma(m.color));else if(m instanceof THREE.MeshNormalMaterial)ga.r=Ua(t.normalWorld.x),ga.g=Ua(t.normalWorld.y),ga.b=Ua(t.normalWorld.z),
+I(L,n,S,V,X,Q,fa,W),m.wireframe?La(ga,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Ma(ga);else if(m instanceof THREE.MeshDepthMaterial)ja=o.near,R=o.far,K.r=K.g=K.b=1-Oa(b.positionScreen.z,ja,R),da.r=da.g=da.b=1-Oa(f.positionScreen.z,ja,R),Z.r=Z.g=Z.b=1-Oa(g.positionScreen.z,ja,R),ka.r=ka.g=ka.b=1-Oa(h.positionScreen.z,ja,R),oa=Wa(K,da,Z,ka),z(L,n,S,V,fa,W),Ta(L,n,S,V,fa,W,0,0,1,0,0,1,oa),z(ca,Y,X,Q,ea,$),Ta(ca,Y,X,Q,ea,$,1,0,1,1,0,1,oa)}function z(b,c,e,f,h,g){t.beginPath();t.moveTo(b,
+c);t.lineTo(e,f);t.lineTo(h,g);t.lineTo(b,c);t.closePath()}function I(b,c,e,f,h,g,j,k){t.beginPath();t.moveTo(b,c);t.lineTo(e,f);t.lineTo(h,g);t.lineTo(j,k);t.lineTo(b,c);t.closePath()}function La(b,c,e,h){if(H!=c)t.lineWidth=H=c;if(G!=e)t.lineCap=G=e;if(C!=h)t.lineJoin=C=h;f(b.getContextStyle());t.stroke();ta.inflate(c*2)}function Ma(b){g(b.getContextStyle());t.fill()}function Za(b,c,e,f,h,j,k,n,o,m,u,p,ha){if(ha.image.width!=0){if(ha.needsUpdate==!0||ia[ha.id]==void 0){var v=ha.wrapS==THREE.RepeatWrapping,
+Ba=ha.wrapT==THREE.RepeatWrapping;ia[ha.id]=t.createPattern(ha.image,v&&Ba?"repeat":v&&!Ba?"repeat-x":!v&&Ba?"repeat-y":"no-repeat");ha.needsUpdate=!1}g(ia[ha.id]);var v=ha.offset.x/ha.repeat.x,Ba=ha.offset.y/ha.repeat.y,w=(ha.image.width-1)*ha.repeat.x,ha=(ha.image.height-1)*ha.repeat.y,k=(k+v)*w,n=(n+Ba)*ha,o=(o+v)*w,m=(m+Ba)*ha,u=(u+v)*w,p=(p+Ba)*ha;e-=b;f-=c;h-=b;j-=c;o-=k;m-=n;u-=k;p-=n;v=1/(o*p-u*m);ha=(p*e-m*h)*v;m=(p*f-m*j)*v;e=(o*h-u*e)*v;f=(o*j-u*f)*v;b=b-ha*k-e*n;c=c-m*k-f*n;t.save();t.transform(ha,
+m,e,f,b,c);t.fill();t.restore()}}function Ta(b,c,e,f,h,g,j,k,n,o,m,u,ha){var p,v;p=ha.width-1;v=ha.height-1;j*=p;k*=v;n*=p;o*=v;m*=p;u*=v;e-=b;f-=c;h-=b;g-=c;n-=j;o-=k;m-=j;u-=k;v=1/(n*u-m*o);p=(u*e-o*h)*v;o=(u*f-o*g)*v;e=(n*h-m*e)*v;f=(n*g-m*f)*v;b=b-p*j-e*k;c=c-o*j-f*k;t.save();t.transform(p,o,e,f,b,c);t.clip();t.drawImage(ha,0,0);t.restore()}function Wa(b,c,e,f){var h=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),j=~~(c.r*255),k=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),m=~~(f.r*
+255),u=~~(f.g*255),f=~~(f.b*255);Aa[0]=h<0?0:h>255?255:h;Aa[1]=g<0?0:g>255?255:g;Aa[2]=b<0?0:b>255?255:b;Aa[4]=j<0?0:j>255?255:j;Aa[5]=k<0?0:k>255?255:k;Aa[6]=c<0?0:c>255?255:c;Aa[8]=n<0?0:n>255?255:n;Aa[9]=o<0?0:o>255?255:o;Aa[10]=e<0?0:e>255?255:e;Aa[12]=m<0?0:m>255?255:m;Aa[13]=u<0?0:u>255?255:u;Aa[14]=f<0?0:f>255?255:f;ha.putImageData(Ya,0,0);Va.drawImage(za,0,0);return Ba}function Oa(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Ua(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Na(b,c){var e=
+c.x-b.x,f=c.y-b.y,h=e*e+f*f;h!=0&&(h=1/Math.sqrt(h),e*=h,f*=h,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Xa,$a,na,Ca,F,y,T,wa;this.autoClear?this.clear():t.setTransform(1,0,0,-1,u,v);j.data.vertices=0;j.data.faces=0;h=k.projectScene(b,o,this.sortElements);(Ea=b.lights.length>0)&&m(b);Xa=0;for($a=h.length;Xa<$a;Xa++){na=h[Xa];ta.empty();if(na instanceof THREE.RenderableParticle){O=na;O.x*=u;O.y*=v;Ca=0;for(F=na.materials.length;Ca<F;)wa=na.materials[Ca++],wa.opacity!=0&&w(O,na,wa,b)}else if(na instanceof THREE.RenderableLine){if(O=
+na.v1,N=na.v2,O.positionScreen.x*=u,O.positionScreen.y*=v,N.positionScreen.x*=u,N.positionScreen.y*=v,ta.addPoint(O.positionScreen.x,O.positionScreen.y),ta.addPoint(N.positionScreen.x,N.positionScreen.y),ya.instersects(ta)){Ca=0;for(F=na.materials.length;Ca<F;)wa=na.materials[Ca++],wa.opacity!=0&&x(O,N,na,wa,b)}}else if(na instanceof THREE.RenderableFace3){if(O=na.v1,N=na.v2,D=na.v3,O.positionScreen.x*=u,O.positionScreen.y*=v,N.positionScreen.x*=u,N.positionScreen.y*=v,D.positionScreen.x*=u,D.positionScreen.y*=
+v,na.overdraw&&(Na(O.positionScreen,N.positionScreen),Na(N.positionScreen,D.positionScreen),Na(D.positionScreen,O.positionScreen)),ta.add3Points(O.positionScreen.x,O.positionScreen.y,N.positionScreen.x,N.positionScreen.y,D.positionScreen.x,D.positionScreen.y),ya.instersects(ta)){Ca=0;for(F=na.meshMaterials.length;Ca<F;)if(wa=na.meshMaterials[Ca++],wa instanceof THREE.MeshFaceMaterial){y=0;for(T=na.faceMaterials.length;y<T;)(wa=na.faceMaterials[y++])&&wa.opacity!=0&&A(O,N,D,0,1,2,na,wa,b)}else wa.opacity!=
+0&&A(O,N,D,0,1,2,na,wa,b)}}else if(na instanceof THREE.RenderableFace4&&(O=na.v1,N=na.v2,D=na.v3,E=na.v4,O.positionScreen.x*=u,O.positionScreen.y*=v,N.positionScreen.x*=u,N.positionScreen.y*=v,D.positionScreen.x*=u,D.positionScreen.y*=v,E.positionScreen.x*=u,E.positionScreen.y*=v,U.positionScreen.copy(N.positionScreen),M.positionScreen.copy(E.positionScreen),na.overdraw&&(Na(O.positionScreen,N.positionScreen),Na(N.positionScreen,E.positionScreen),Na(E.positionScreen,O.positionScreen),Na(D.positionScreen,
+U.positionScreen),Na(D.positionScreen,M.positionScreen)),ta.addPoint(O.positionScreen.x,O.positionScreen.y),ta.addPoint(N.positionScreen.x,N.positionScreen.y),ta.addPoint(D.positionScreen.x,D.positionScreen.y),ta.addPoint(E.positionScreen.x,E.positionScreen.y),ya.instersects(ta))){Ca=0;for(F=na.meshMaterials.length;Ca<F;)if(wa=na.meshMaterials[Ca++],wa instanceof THREE.MeshFaceMaterial){y=0;for(T=na.faceMaterials.length;y<T;)(wa=na.faceMaterials[y++])&&wa.opacity!=0&&B(O,N,D,E,U,M,na,wa,b)}else wa.opacity!=
+0&&B(O,N,D,E,U,M,na,wa,b)}aa.addRectangle(ta)}t.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(b,c,e){var f,h,g,j;f=0;for(h=b.lights.length;f<h;f++)g=b.lights[f],g instanceof THREE.DirectionalLight?(j=c.normalWorld.dot(g.position)*g.intensity,j>0&&(e.r+=g.color.r*j,e.g+=g.color.g*j,e.b+=g.color.b*j)):g instanceof THREE.PointLight&&(E.sub(g.position,c.centroidWorld),E.normalize(),j=c.normalWorld.dot(E)*g.intensity,j>0&&(e.r+=g.color.r*j,e.g+=g.color.g*j,e.b+=g.color.b*j))}function c(c,e,h,k,m,u){j.data.vertices+=3;j.data.faces++;L=f(n++);L.setAttribute("d",
+"M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");m instanceof THREE.MeshBasicMaterial?H.copy(m.color):m instanceof THREE.MeshLambertMaterial?z?(G.r=C.r,G.g=C.g,G.b=C.b,b(u,k,G),H.r=Math.max(0,Math.min(m.color.r*G.r,1)),H.g=Math.max(0,Math.min(m.color.g*G.g,1)),H.b=Math.max(0,Math.min(m.color.b*G.b,1))):H.copy(m.color):m instanceof THREE.MeshDepthMaterial?(D=1-m.__2near/(m.__farPlusNear-k.z*m.__farMinusNear),
+H.setRGB(D,D,D)):m instanceof THREE.MeshNormalMaterial&&H.setRGB(g(k.normalWorld.x),g(k.normalWorld.y),g(k.normalWorld.z));m.wireframe?L.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+m.wireframeLinewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframeLinecap+"; stroke-linejoin: "+m.wireframeLinejoin):L.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+m.opacity);o.appendChild(L)}function e(c,e,h,k,m,u,t){j.data.vertices+=4;j.data.faces++;
+L=f(n++);L.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?H.copy(u.color):u instanceof THREE.MeshLambertMaterial?z?(G.r=C.r,G.g=C.g,G.b=C.b,b(t,m,G),H.r=Math.max(0,Math.min(u.color.r*G.r,1)),H.g=Math.max(0,Math.min(u.color.g*G.g,1)),H.b=Math.max(0,Math.min(u.color.b*G.b,1))):H.copy(u.color):u instanceof
+THREE.MeshDepthMaterial?(D=1-u.__2near/(u.__farPlusNear-m.z*u.__farMinusNear),H.setRGB(D,D,D)):u instanceof THREE.MeshNormalMaterial&&H.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));u.wireframe?L.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):L.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+
+u.opacity);o.appendChild(L)}function f(b){U[b]==null&&(U[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),V==0&&U[b].setAttribute("shape-rendering","crispEdges"));return U[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var j=this,h=null,k=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,p,u,v,t,w,x,B,A=new THREE.Rectangle,I=new THREE.Rectangle,z=!1,H=new THREE.Color(16777215),G=new THREE.Color(16777215),C=new THREE.Color(0),O=new THREE.Color(0),
+N=new THREE.Color(0),D,E=new THREE.Vector3,U=[],M=[],L,n,S,V=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":V=1;break;case "low":V=0}};this.setSize=function(b,c){m=b;p=c;u=m/2;v=p/2;o.setAttribute("viewBox",-u+" "+-v+" "+m+" "+p);o.setAttribute("width",m);o.setAttribute("height",p);A.set(-u,-v,u,v)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=
+function(b,f){var g,m,p,G,H,E,D,K;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;h=k.projectScene(b,f,this.sortElements);S=n=0;if(z=b.lights.length>0){D=b.lights;C.setRGB(0,0,0);O.setRGB(0,0,0);N.setRGB(0,0,0);g=0;for(m=D.length;g<m;g++)p=D[g],G=p.color,p instanceof THREE.AmbientLight?(C.r+=G.r,C.g+=G.g,C.b+=G.b):p instanceof THREE.DirectionalLight?(O.r+=G.r,O.g+=G.g,O.b+=G.b):p instanceof THREE.PointLight&&(N.r+=G.r,N.g+=G.g,N.b+=G.b)}g=0;for(m=h.length;g<m;g++)if(D=h[g],I.empty(),
+D instanceof THREE.RenderableParticle){t=D;t.x*=u;t.y*=-v;p=0;for(G=D.materials.length;p<G;)p++}else if(D instanceof THREE.RenderableLine){if(t=D.v1,w=D.v2,t.positionScreen.x*=u,t.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,I.addPoint(t.positionScreen.x,t.positionScreen.y),I.addPoint(w.positionScreen.x,w.positionScreen.y),A.instersects(I)){p=0;for(G=D.materials.length;p<G;)if((K=D.materials[p++])&&K.opacity!=0){H=t;E=w;var U=S++;M[U]==null&&(M[U]=document.createElementNS("http://www.w3.org/2000/svg",
+"line"),V==0&&M[U].setAttribute("shape-rendering","crispEdges"));L=M[U];L.setAttribute("x1",H.positionScreen.x);L.setAttribute("y1",H.positionScreen.y);L.setAttribute("x2",E.positionScreen.x);L.setAttribute("y2",E.positionScreen.y);K instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+K.color.getContextStyle()+"; stroke-width: "+K.linewidth+"; stroke-opacity: "+K.opacity+"; stroke-linecap: "+K.linecap+"; stroke-linejoin: "+K.linejoin),o.appendChild(L))}}}else if(D instanceof
+THREE.RenderableFace3){if(t=D.v1,w=D.v2,x=D.v3,t.positionScreen.x*=u,t.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,I.addPoint(t.positionScreen.x,t.positionScreen.y),I.addPoint(w.positionScreen.x,w.positionScreen.y),I.addPoint(x.positionScreen.x,x.positionScreen.y),A.instersects(I)){p=0;for(G=D.meshMaterials.length;p<G;)if(K=D.meshMaterials[p++],K instanceof THREE.MeshFaceMaterial){H=0;for(E=D.faceMaterials.length;H<E;)(K=D.faceMaterials[H++])&&
+K.opacity!=0&&c(t,w,x,D,K,b)}else K&&K.opacity!=0&&c(t,w,x,D,K,b)}}else if(D instanceof THREE.RenderableFace4&&(t=D.v1,w=D.v2,x=D.v3,B=D.v4,t.positionScreen.x*=u,t.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,B.positionScreen.x*=u,B.positionScreen.y*=-v,I.addPoint(t.positionScreen.x,t.positionScreen.y),I.addPoint(w.positionScreen.x,w.positionScreen.y),I.addPoint(x.positionScreen.x,x.positionScreen.y),I.addPoint(B.positionScreen.x,B.positionScreen.y),
+A.instersects(I))){p=0;for(G=D.meshMaterials.length;p<G;)if(K=D.meshMaterials[p++],K instanceof THREE.MeshFaceMaterial){H=0;for(E=D.faceMaterials.length;H<E;)(K=D.faceMaterials[H++])&&K.opacity!=0&&e(t,w,x,B,D,K,b)}else K&&K.opacity!=0&&e(t,w,x,B,D,K,b)}}};
 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",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
@@ -214,112 +214,112 @@ THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderCh
 "void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function c(b,c,e){var f,h,g,j=b.vertices,k=j.length,m=b.colors,o=m.length,u=b.__vertexArray,t=b.__colorArray,p=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors,x=b.__webglCustomAttributes,A,B;if(x)for(A in x)x[A].offset=0;if(e.sortParticles){ja.multiplySelf(e.matrixWorld);for(f=0;f<k;f++)h=j[f].position,pa.copy(h),ja.multiplyVector3(pa),p[f]=[pa.z,f];p.sort(function(b,c){return c[0]-b[0]});for(f=0;f<k;f++)h=j[p[f][1]].position,g=f*3,u[g]=h.x,u[g+1]=h.y,u[g+2]=h.z;
+THREE.WebGLRenderer=function(b){function c(b,c,e){var f,h,g,j=b.vertices,k=j.length,m=b.colors,o=m.length,u=b.__vertexArray,t=b.__colorArray,p=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors,x=b.__webglCustomAttributes,A,B;if(x)for(A in x)x[A].offset=0;if(e.sortParticles){ja.multiplySelf(e.matrixWorld);for(f=0;f<k;f++)h=j[f].position,qa.copy(h),ja.multiplyVector3(qa),p[f]=[qa.z,f];p.sort(function(b,c){return c[0]-b[0]});for(f=0;f<k;f++)h=j[p[f][1]].position,g=f*3,u[g]=h.x,u[g+1]=h.y,u[g+2]=h.z;
 for(f=0;f<o;f++)g=f*3,color=m[p[f][1]],t[g]=color.r,t[g+1]=color.g,t[g+2]=color.b;if(x)for(A in x){f=x[A];m=f.value.length;for(g=0;g<m;g++){index=p[g][1];o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")B=f.value[index];f.size===2?(f.array[o]=B.x,f.array[o+1]=B.y):f.size===3?f.type==="c"?(f.array[o]=B.r,f.array[o+1]=B.g,f.array[o+2]=B.b):(f.array[o]=B.x,f.array[o+1]=B.y,f.array[o+2]=B.z):(f.array[o]=
 B.x,f.array[o+1]=B.y,f.array[o+2]=B.z,f.array[o+3]=B.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<k;f++)h=j[f].position,g=f*3,u[g]=h.x,u[g+1]=h.y,u[g+2]=h.z;if(w)for(f=0;f<o;f++)color=m[f],g=f*3,t[g]=color.r,t[g+1]=color.g,t[g+2]=color.b;if(x)for(A in x)if(f=x[A],f.__original.needsUpdate){m=f.value.length;for(g=0;g<m;g++){o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[g]}else{if(f.boundTo===void 0||f.boundTo==="vertices")B=f.value[g];f.size===2?(f.array[o]=
 B.x,f.array[o+1]=B.y):f.size===3?f.type==="c"?(f.array[o]=B.r,f.array[o+1]=B.g,f.array[o+2]=B.b):(f.array[o]=B.x,f.array[o+1]=B.y,f.array[o+2]=B.z):(f.array[o]=B.x,f.array[o+1]=B.y,f.array[o+2]=B.z,f.array[o+3]=B.w)}f.offset+=f.size}}}if(v||e.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,b.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,u,c);if(w||e.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,b.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,t,c);if(x)for(A in x)if(f=x[A],f.__original.needsUpdate||e.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,
-f.buffer),n.bufferData(n.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,h){f.program||C.initMaterial(f,c,e,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(C.maxMorphTargets);for(var g=0,j=C.maxMorphTargets;g<j;g++)h.__webglMorphTargetInfluences[g]=0}var g=f.program,j=g.uniforms,k=f.uniforms;g!=V&&(n.useProgram(g),V=g);n.uniformMatrix4fv(j.projectionMatrix,!1,la);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||
-f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(k.fogColor.value=e.color,e instanceof THREE.Fog)k.fogNear.value=e.near,k.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)k.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var m,o,u,t=0,p=0,v=0,w,B,x,A=sa,y=A.directional.colors,G=A.directional.positions,H=A.point.colors,I=A.point.positions,ja=A.point.distances,
-E=0,J=0,e=o=x=0;for(m=c.length;e<m;e++)if(o=c[e],u=o.color,w=o.position,B=o.intensity,x=o.distance,o instanceof THREE.AmbientLight)t+=u.r,p+=u.g,v+=u.b;else if(o instanceof THREE.DirectionalLight)x=E*3,y[x]=u.r*B,y[x+1]=u.g*B,y[x+2]=u.b*B,G[x]=w.x,G[x+1]=w.y,G[x+2]=w.z,E+=1;else if(o instanceof THREE.SpotLight)x=E*3,y[x]=u.r*B,y[x+1]=u.g*B,y[x+2]=u.b*B,u=1/w.length(),G[x]=w.x*u,G[x+1]=w.y*u,G[x+2]=w.z*u,E+=1;else if(o instanceof THREE.PointLight)o=J*3,H[o]=u.r*B,H[o+1]=u.g*B,H[o+2]=u.b*B,I[o]=w.x,
-I[o+1]=w.y,I[o+2]=w.z,ja[J]=x,J+=1;for(e=E*3;e<y.length;e++)y[e]=0;for(e=J*3;e<H.length;e++)H[e]=0;A.point.length=J;A.directional.length=E;A.ambient[0]=t;A.ambient[1]=p;A.ambient[2]=v;c=sa;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=
+f.buffer),n.bufferData(n.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,h){f.program||L.initMaterial(f,c,e,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(L.maxMorphTargets);for(var g=0,j=L.maxMorphTargets;g<j;g++)h.__webglMorphTargetInfluences[g]=0}var g=f.program,j=g.uniforms,k=f.uniforms;g!=V&&(n.useProgram(g),V=g);n.uniformMatrix4fv(j.projectionMatrix,!1,R);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof
+THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(k.fogColor.value=e.color,e instanceof THREE.Fog)k.fogNear.value=e.near,k.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)k.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var m,o,u,t=0,p=0,v=0,w,B,x,A=la,z=A.directional.colors,I=A.directional.positions,G=A.point.colors,C=A.point.positions,ja=A.point.distances,
+H=0,D=0,e=o=x=0;for(m=c.length;e<m;e++)if(o=c[e],u=o.color,w=o.position,B=o.intensity,x=o.distance,o instanceof THREE.AmbientLight)t+=u.r,p+=u.g,v+=u.b;else if(o instanceof THREE.DirectionalLight)x=H*3,z[x]=u.r*B,z[x+1]=u.g*B,z[x+2]=u.b*B,I[x]=w.x,I[x+1]=w.y,I[x+2]=w.z,H+=1;else if(o instanceof THREE.SpotLight)x=H*3,z[x]=u.r*B,z[x+1]=u.g*B,z[x+2]=u.b*B,u=1/w.length(),I[x]=w.x*u,I[x+1]=w.y*u,I[x+2]=w.z*u,H+=1;else if(o instanceof THREE.PointLight)o=D*3,G[o]=u.r*B,G[o+1]=u.g*B,G[o+2]=u.b*B,C[o]=w.x,
+C[o+1]=w.y,C[o+2]=w.z,ja[D]=x,D+=1;for(e=H*3;e<z.length;e++)z[e]=0;for(e=D*3;e<G.length;e++)G[e]=0;A.point.length=D;A.directional.length=H;A.ambient[0]=t;A.ambient[1]=p;A.ambient[2]=v;c=la;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=
 c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)k.diffuse.value=f.color,k.opacity.value=f.opacity,(k.map.texture=f.map)&&k.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),k.lightMap.texture=f.lightMap,k.envMap.texture=f.envMap,k.reflectivity.value=f.reflectivity,k.refractionRatio.value=f.refractionRatio,k.combine.value=f.combine,k.useRefract.value=f.envMap&&f.envMap.mapping instanceof
 THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)k.diffuse.value=f.color,k.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)k.psColor.value=f.color,k.opacity.value=f.opacity,k.size.value=f.size,k.scale.value=ua.height/2,k.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)k.ambient.value=f.ambient,k.specular.value=f.specular,k.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)k.mNear.value=b.near,k.mFar.value=b.far,k.opacity.value=
-f.opacity;else if(f instanceof THREE.MeshNormalMaterial)k.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&k.shadowMatrix){for(c=0;c<ta.length;c++)k.shadowMatrix.value[c]=ta[c],k.shadowMap.texture[c]=C.shadowMap[c];k.shadowDarkness.value=C.shadowMapDarkness;k.shadowBias.value=C.shadowMapBias}for(var L in k)if(m=g.uniforms[L])if(e=k[L],t=e.type,c=e.value,t=="i")n.uniform1i(m,c);else if(t=="f")n.uniform1f(m,c);else if(t=="fv1")n.uniform1fv(m,c);else if(t=="fv")n.uniform3fv(m,c);else if(t==
+f.opacity;else if(f instanceof THREE.MeshNormalMaterial)k.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&k.shadowMatrix){for(c=0;c<ta.length;c++)k.shadowMatrix.value[c]=ta[c],k.shadowMap.texture[c]=L.shadowMap[c];k.shadowDarkness.value=L.shadowMapDarkness;k.shadowBias.value=L.shadowMapBias}for(var E in k)if(m=g.uniforms[E])if(e=k[E],t=e.type,c=e.value,t=="i")n.uniform1i(m,c);else if(t=="f")n.uniform1f(m,c);else if(t=="fv1")n.uniform1fv(m,c);else if(t=="fv")n.uniform3fv(m,c);else if(t==
 "v2")n.uniform2f(m,c.x,c.y);else if(t=="v3")n.uniform3f(m,c.x,c.y,c.z);else if(t=="v4")n.uniform4f(m,c.x,c.y,c.z,c.w);else if(t=="m4"){if(!e._array)e._array=new Float32Array(16);c.flattenToArray(e._array);n.uniformMatrix4fv(m,!1,e._array)}else if(t=="m4v"){if(!e._array)e._array=new Float32Array(16*c.length);t=0;for(p=c.length;t<p;t++)c[t].flattenToArrayOffset(e._array,t*16);n.uniformMatrix4fv(m,!1,e._array)}else if(t=="c")n.uniform3f(m,c.r,c.g,c.b);else if(t=="t"){if(n.uniform1i(m,c),m=e.texture)if(m.image instanceof
-Array&&m.image.length==6){if(e=m,e.image.length==6){if(e.needsUpdate){if(e.__webglInit){n.bindTexture(n.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);for(m=0;m<6;++m)n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,0,0,n.RGBA,n.UNSIGNED_BYTE,e.image[m])}else{e.image.__webglTextureCube=n.createTexture();n.bindTexture(n.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);for(m=0;m<6;++m)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e.image[m]);e.__webglInit=!0}K(n.TEXTURE_CUBE_MAP,
-e,e.image[0]);n.bindTexture(n.TEXTURE_CUBE_MAP,null);e.needsUpdate=!1}n.activeTexture(n.TEXTURE0+c);n.bindTexture(n.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else D(m,c)}else if(t=="tv"){if(!e._array){e._array=[];t=0;for(p=e.texture.length;t<p;t++)e._array[t]=c+t}n.uniform1iv(m,e._array);t=0;for(p=e.texture.length;t<p;t++)(m=e.texture[t])&&D(m,e._array[t])}n.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray);n.uniformMatrix3fv(j.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
-f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&n.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&j.objectMatrix!==null&&n.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&j.viewMatrix!==null&&n.uniformMatrix4fv(j.viewMatrix,!1,ka);f.skinning&&
-(n.uniformMatrix4fv(j.cameraInverseMatrix,!1,ka),n.uniformMatrix4fv(j.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,c,f,h,g,j){if(h.opacity!=0){var k,b=e(b,c,f,h,j).attributes;if(!h.morphTargets&&b.position>=0)n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer),n.vertexAttribPointer(b.position,3,n.FLOAT,!1,0,0);else if(j.morphTargetBase){c=h.program.attributes;j.morphTargetBase!==-1?(n.bindBuffer(n.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[j.morphTargetBase]),n.vertexAttribPointer(c.position,
+Array&&m.image.length==6){if(e=m,e.image.length==6){if(e.needsUpdate){if(e.__webglInit){n.bindTexture(n.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);for(m=0;m<6;++m)n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,0,0,n.RGBA,n.UNSIGNED_BYTE,e.image[m])}else{e.image.__webglTextureCube=n.createTexture();n.bindTexture(n.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);for(m=0;m<6;++m)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e.image[m]);e.__webglInit=!0}O(n.TEXTURE_CUBE_MAP,
+e,e.image[0]);n.bindTexture(n.TEXTURE_CUBE_MAP,null);e.needsUpdate=!1}n.activeTexture(n.TEXTURE0+c);n.bindTexture(n.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else N(m,c)}else if(t=="tv"){if(!e._array){e._array=[];t=0;for(p=e.texture.length;t<p;t++)e._array[t]=c+t}n.uniform1iv(m,e._array);t=0;for(p=e.texture.length;t<p;t++)(m=e.texture[t])&&N(m,e._array[t])}n.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray);n.uniformMatrix3fv(j.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
+f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&n.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&j.objectMatrix!==null&&n.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&j.viewMatrix!==null&&n.uniformMatrix4fv(j.viewMatrix,!1,oa);f.skinning&&
+(n.uniformMatrix4fv(j.cameraInverseMatrix,!1,oa),n.uniformMatrix4fv(j.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,c,f,h,g,j){if(h.opacity!=0){var k,b=e(b,c,f,h,j).attributes;if(!h.morphTargets&&b.position>=0)n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer),n.vertexAttribPointer(b.position,3,n.FLOAT,!1,0,0);else if(j.morphTargetBase){c=h.program.attributes;j.morphTargetBase!==-1?(n.bindBuffer(n.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[j.morphTargetBase]),n.vertexAttribPointer(c.position,
 3,n.FLOAT,!1,0,0)):c.position>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer),n.vertexAttribPointer(c.position,3,n.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,m=j.morphTargetForcedOrder,o=j.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<m.length;)n.bindBuffer(n.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[m[f]]),n.vertexAttribPointer(c["morphTarget"+f],3,n.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[f]=o[m[f]],f++;else{var m=[],u=-1,t=0,o=j.morphTargetInfluences,p,v=
 o.length,f=0;for(j.morphTargetBase!==-1&&(m[j.morphTargetBase]=!0);f<h.numSupportedMorphTargets;){for(p=0;p<v;p++)!m[p]&&o[p]>u&&(t=p,u=o[t]);n.bindBuffer(n.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[t]);n.vertexAttribPointer(c["morphTarget"+f],3,n.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[f]=u;m[t]=1;u=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&n.uniform1fv(h.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(k in g.__webglCustomAttributes)b[k]>=
 0&&(c=g.__webglCustomAttributes[k],n.bindBuffer(n.ARRAY_BUFFER,c.buffer),n.vertexAttribPointer(b[k],c.size,n.FLOAT,!1,0,0));b.color>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglColorBuffer),n.vertexAttribPointer(b.color,3,n.FLOAT,!1,0,0));b.normal>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglNormalBuffer),n.vertexAttribPointer(b.normal,3,n.FLOAT,!1,0,0));b.tangent>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglTangentBuffer),n.vertexAttribPointer(b.tangent,4,n.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(n.bindBuffer(n.ARRAY_BUFFER,
 g.__webglUVBuffer),n.vertexAttribPointer(b.uv,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(b.uv)):n.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(n.bindBuffer(n.ARRAY_BUFFER,g.__webglUV2Buffer),n.vertexAttribPointer(b.uv2,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(b.uv2)):n.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglSkinVertexABuffer),n.vertexAttribPointer(b.skinVertexA,4,
 n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),n.vertexAttribPointer(b.skinVertexB,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),n.vertexAttribPointer(b.skinIndex,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),n.vertexAttribPointer(b.skinWeight,4,n.FLOAT,!1,0,0));j instanceof THREE.Mesh?(h.wireframe?(n.lineWidth(h.wireframeLinewidth),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),n.drawElements(n.LINES,g.__webglLineCount,
-n.UNSIGNED_SHORT,0)):(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),n.drawElements(n.TRIANGLES,g.__webglFaceCount,n.UNSIGNED_SHORT,0)),C.data.vertices+=g.__webglFaceCount,C.data.faces+=g.__webglFaceCount/3,C.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?n.LINE_STRIP:n.LINES,n.lineWidth(h.linewidth),n.drawArrays(j,0,g.__webglLineCount),C.data.drawCalls++):j instanceof THREE.ParticleSystem?(n.drawArrays(n.POINTS,0,g.__webglParticleCount),C.data.drawCalls++):j instanceof
-THREE.Ribbon&&(n.drawArrays(n.TRIANGLE_STRIP,0,g.__webglVertexCount),C.data.drawCalls++)}}function g(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=n.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=n.createBuffer();b.hasPos&&(n.bindBuffer(n.ARRAY_BUFFER,b.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,b.positionArray,n.DYNAMIC_DRAW),n.enableVertexAttribArray(c.attributes.position),n.vertexAttribPointer(c.attributes.position,3,n.FLOAT,!1,0,0));if(b.hasNormal){n.bindBuffer(n.ARRAY_BUFFER,
+n.UNSIGNED_SHORT,0)):(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),n.drawElements(n.TRIANGLES,g.__webglFaceCount,n.UNSIGNED_SHORT,0)),L.data.vertices+=g.__webglFaceCount,L.data.faces+=g.__webglFaceCount/3,L.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?n.LINE_STRIP:n.LINES,n.lineWidth(h.linewidth),n.drawArrays(j,0,g.__webglLineCount),L.data.drawCalls++):j instanceof THREE.ParticleSystem?(n.drawArrays(n.POINTS,0,g.__webglParticleCount),L.data.drawCalls++):j instanceof
+THREE.Ribbon&&(n.drawArrays(n.TRIANGLE_STRIP,0,g.__webglVertexCount),L.data.drawCalls++)}}function g(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=n.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=n.createBuffer();b.hasPos&&(n.bindBuffer(n.ARRAY_BUFFER,b.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,b.positionArray,n.DYNAMIC_DRAW),n.enableVertexAttribArray(c.attributes.position),n.vertexAttribPointer(c.attributes.position,3,n.FLOAT,!1,0,0));if(b.hasNormal){n.bindBuffer(n.ARRAY_BUFFER,
 b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,g,h,j,k,m,o,u,t,p,v=b.count*3;for(p=0;p<v;p+=9)e=b.normalArray,f=e[p],g=e[p+1],h=e[p+2],j=e[p+3],m=e[p+4],u=e[p+5],k=e[p+6],o=e[p+7],t=e[p+8],f=(f+j+k)/3,g=(g+m+o)/3,h=(h+u+t)/3,e[p]=f,e[p+1]=g,e[p+2]=h,e[p+3]=f,e[p+4]=g,e[p+5]=h,e[p+6]=f,e[p+7]=g,e[p+8]=h}n.bufferData(n.ARRAY_BUFFER,b.normalArray,n.DYNAMIC_DRAW);n.enableVertexAttribArray(c.attributes.normal);n.vertexAttribPointer(c.attributes.normal,3,n.FLOAT,!1,0,0)}n.drawArrays(n.TRIANGLES,
-0,b.count);b.count=0}function j(b){if(ea!=b.doubleSided)b.doubleSided?n.disable(n.CULL_FACE):n.enable(n.CULL_FACE),ea=b.doubleSided;if(T!=b.flipSided)b.flipSided?n.frontFace(n.CW):n.frontFace(n.CCW),T=b.flipSided}function h(b){da!=b&&(b?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),da=b)}function k(b,c,e){ha!=b&&(b?n.enable(n.POLYGON_OFFSET_FILL):n.disable(n.POLYGON_OFFSET_FILL),ha=b);if(b&&(ia!=c||M!=e))n.polygonOffset(c,e),ia=c,M=e}function o(b){ca[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-
-b.n14);ca[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ca[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ca[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ca[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ca[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=ca[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function m(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),
-f=0;f<6;f++)if(b=ca[f].x*c.n14+ca[f].y*c.n24+ca[f].z*c.n34+ca[f].w,b<=e)return!1;return!0}function p(b,c){b.list[b.count]=c;b.count+=1}function u(b){var c,e,f=b.object,g=b.opaque,h=b.transparent;h.count=0;b=g.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?p(h,e):p(g,e)}function v(b){var c,e,f,g,h=b.object,j=b.buffer,k=b.opaque,n=b.transparent;n.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=j.materials.length;c<
-e;c++)(g=j.materials[c])&&(g.transparent?p(n,g):p(k,g))}else(g=c)&&(g.transparent?p(n,g):p(k,g))}function t(b,c){return c.z-b.z}function w(b,c){var k,u,t,p=0,v,w,x,A,y=b.lights;$||($=new THREE.Camera(C.shadowCameraFov,c.aspect,C.shadowCameraNear,C.shadowCameraFar));k=0;for(u=y.length;k<u;k++)if(t=y[k],t instanceof THREE.SpotLight&&t.castShadow){C.shadowMap[p]||(C.shadowMap[p]=new THREE.WebGLRenderTarget(C.shadowMapWidth,C.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
-format:THREE.RGBAFormat}));ta[p]||(ta[p]=new THREE.Matrix4);v=C.shadowMap[p];w=ta[p];$.position.copy(t.position);$.target.position.copy(t.target.position);$.update(void 0,!0);b.update(void 0,!1,$);w.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);w.multiplySelf($.projectionMatrix);w.multiplySelf($.matrixWorldInverse);$.matrixWorldInverse.flattenToArray(ka);$.projectionMatrix.flattenToArray(la);ja.multiply($.projectionMatrix,$.matrixWorldInverse);o(ja);C.initWebGLObjects(b);J(v);n.clearColor(1,1,
-1,1);C.clear();n.clearColor(va.r,va.g,va.b,ya);w=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(v=0;v<w;v++)x=b.__webglObjects[v],A=x.object,A.visible&&A.castShadow?!(A instanceof THREE.Mesh)||m(A)?(A.matrixWorld.flattenToArray(A._objectMatrixArray),B(A,$,!1),x.render=!0):x.render=!1:x.render=!1;h(!0);E(THREE.NormalBlending);for(v=0;v<w;v++)if(x=b.__webglObjects[v],x.render)A=x.object,buffer=x.buffer,j(A),x=A.customDepthMaterial?A.customDepthMaterial:A.geometry.morphTargets.length?
-ma:oa,f($,y,null,x,buffer,A);for(v=0;v<t;v++)x=b.__webglObjectsImmediate[v],A=x.object,A.visible&&A.castShadow&&(A.matrixAutoUpdate&&A.matrixWorld.flattenToArray(A._objectMatrixArray),B(A,$,!1),j(A),program=e($,y,null,oa,A),A.render(function(b){g(b,program,oa.shading)}));p++}}function x(b,c){var e,f,g;e=N.attributes;var h=N.uniforms,j=Z/Y,k,m=[],o=Y*0.5,u=Z*0.5,p=!0;n.useProgram(N.program);V=N.program;da=U=-1;za||(n.enableVertexAttribArray(N.attributes.position),n.enableVertexAttribArray(N.attributes.uv),
-za=!0);n.disable(n.CULL_FACE);n.enable(n.BLEND);n.depthMask(!0);n.bindBuffer(n.ARRAY_BUFFER,N.vertexBuffer);n.vertexAttribPointer(e.position,2,n.FLOAT,!1,16,0);n.vertexAttribPointer(e.uv,2,n.FLOAT,!1,16,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,N.elementBuffer);n.uniformMatrix4fv(h.projectionMatrix,!1,la);n.activeTexture(n.TEXTURE0);n.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
+0,b.count);b.count=0}function j(b){if(fa!=b.doubleSided)b.doubleSided?n.disable(n.CULL_FACE):n.enable(n.CULL_FACE),fa=b.doubleSided;if(W!=b.flipSided)b.flipSided?n.frontFace(n.CW):n.frontFace(n.CCW),W=b.flipSided}function h(b){Y!=b&&(b?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),Y=b)}function k(b,c,e){ea!=b&&(b?n.enable(n.POLYGON_OFFSET_FILL):n.disable(n.POLYGON_OFFSET_FILL),ea=b);if(b&&($!=c||ga!=e))n.polygonOffset(c,e),$=c,ga=e}function o(b){ia[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-
+b.n14);ia[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ia[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ia[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ia[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ia[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=ia[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function m(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),
+f=0;f<6;f++)if(b=ia[f].x*c.n14+ia[f].y*c.n24+ia[f].z*c.n34+ia[f].w,b<=e)return!1;return!0}function p(b,c){b.list[b.count]=c;b.count+=1}function u(b){var c,e,f=b.object,g=b.opaque,h=b.transparent;h.count=0;b=g.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?p(h,e):p(g,e)}function v(b){var c,e,f,g,h=b.object,j=b.buffer,k=b.opaque,n=b.transparent;n.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=j.materials.length;c<
+e;c++)(g=j.materials[c])&&(g.transparent?p(n,g):p(k,g))}else(g=c)&&(g.transparent?p(n,g):p(k,g))}function t(b,c){return c.z-b.z}function w(b,c){var k,u,t,p=0,v,w,x,A,z=b.lights;aa||(aa=new THREE.Camera(L.shadowCameraFov,c.aspect,L.shadowCameraNear,L.shadowCameraFar));k=0;for(u=z.length;k<u;k++)if(t=z[k],t instanceof THREE.SpotLight&&t.castShadow){L.shadowMap[p]||(L.shadowMap[p]=new THREE.WebGLRenderTarget(L.shadowMapWidth,L.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
+format:THREE.RGBAFormat}));ta[p]||(ta[p]=new THREE.Matrix4);v=L.shadowMap[p];w=ta[p];aa.position.copy(t.position);aa.target.position.copy(t.target.position);aa.update(void 0,!0);b.update(void 0,!1,aa);w.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);w.multiplySelf(aa.projectionMatrix);w.multiplySelf(aa.matrixWorldInverse);aa.matrixWorldInverse.flattenToArray(oa);aa.projectionMatrix.flattenToArray(R);ja.multiply(aa.projectionMatrix,aa.matrixWorldInverse);o(ja);L.initWebGLObjects(b);D(v);n.clearColor(1,
+1,1,1);L.clear();n.clearColor(va.r,va.g,va.b,ya);w=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(v=0;v<w;v++)x=b.__webglObjects[v],A=x.object,A.visible&&A.castShadow?!(A instanceof THREE.Mesh)||m(A)?(A.matrixWorld.flattenToArray(A._objectMatrixArray),B(A,aa,!1),x.render=!0):x.render=!1:x.render=!1;h(!0);C(THREE.NormalBlending);for(v=0;v<w;v++)if(x=b.__webglObjects[v],x.render)A=x.object,buffer=x.buffer,j(A),x=A.customDepthMaterial?A.customDepthMaterial:A.geometry.morphTargets.length?
+ma:pa,f(aa,z,null,x,buffer,A);for(v=0;v<t;v++)x=b.__webglObjectsImmediate[v],A=x.object,A.visible&&A.castShadow&&(A.matrixAutoUpdate&&A.matrixWorld.flattenToArray(A._objectMatrixArray),B(A,aa,!1),j(A),program=e(aa,z,null,pa,A),A.render(function(b){g(b,program,pa.shading)}));p++}}function x(b,c){var e,f,g;e=J.attributes;var h=J.uniforms,j=ka/Z,k,m=[],o=Z*0.5,u=ka*0.5,p=!0;n.useProgram(J.program);V=J.program;Y=ca=-1;za||(n.enableVertexAttribArray(J.attributes.position),n.enableVertexAttribArray(J.attributes.uv),
+za=!0);n.disable(n.CULL_FACE);n.enable(n.BLEND);n.depthMask(!0);n.bindBuffer(n.ARRAY_BUFFER,J.vertexBuffer);n.vertexAttribPointer(e.position,2,n.FLOAT,!1,16,0);n.vertexAttribPointer(e.uv,2,n.FLOAT,!1,16,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,J.elementBuffer);n.uniformMatrix4fv(h.projectionMatrix,!1,R);n.activeTexture(n.TEXTURE0);n.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
 g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(t);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(n.uniform1i(h.useScreenCoordinates,1),n.uniform3f(h.screenPosition,(g.position.x-o)/o,(u-g.position.y)/u,Math.max(0,Math.min(1,g.position.z)))):(n.uniform1i(h.useScreenCoordinates,0),n.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),n.uniformMatrix4fv(h.modelViewMatrix,
-!1,g._modelViewMatrixArray)),k=g.map.image.width/(g.scaleByViewport?Z:1),m[0]=k*j*g.scale.x,m[1]=k*g.scale.y,n.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),n.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),n.uniform2f(h.alignment,g.alignment.x,g.alignment.y),n.uniform1f(h.opacity,g.opacity),n.uniform1f(h.rotation,g.rotation),n.uniform2fv(h.scale,m),g.mergeWith3D&&!p?(n.enable(n.DEPTH_TEST),p=!0):!g.mergeWith3D&&p&&(n.disable(n.DEPTH_TEST),p=!1),E(g.blending),D(g.map,0),n.drawElements(n.TRIANGLES,
-6,n.UNSIGNED_SHORT,0));n.enable(n.CULL_FACE);n.enable(n.DEPTH_TEST);n.depthMask(L)}function B(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function A(b){var c,e,f,g;g=b.__materials;b=0;for(e=g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function H(b){var c,e,f,g;g=b.__materials;b=0;for(e=
-g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function y(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function G(b){function c(b){var g=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?g.push("undefined"):g.push(b[e].id);return g.join("_")}var e,f,g,h,j,k,n,m,o={},u=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};g=0;for(h=b.faces.length;g<h;g++)j=b.faces[g],k=j.materials,n=c(k),o[n]==void 0&&(o[n]={hash:n,counter:0}),
-m=o[n].hash+"_"+o[n].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:k,vertices:0,numMorphTargets:u}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[m].vertices+j>65535&&(o[n].counter+=1,m=o[n].hash+"_"+o[n].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:k,vertices:0,numMorphTargets:u})),b.geometryGroups[m].faces.push(g),b.geometryGroups[m].vertices+=j}function I(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],
-count:0}})}function E(b){if(b!=U){switch(b){case THREE.AdditiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE);break;case THREE.SubtractiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA)}U=b}}function K(b,c,e){(e.width&
-e.width-1)==0&&(e.height&e.height-1)==0?(n.texParameteri(b,n.TEXTURE_WRAP_S,R(c.wrapS)),n.texParameteri(b,n.TEXTURE_WRAP_T,R(c.wrapT)),n.texParameteri(b,n.TEXTURE_MAG_FILTER,R(c.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,R(c.minFilter)),n.generateMipmap(b)):(n.texParameteri(b,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_MAG_FILTER,X(c.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,X(c.minFilter)))}function D(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=
-n.createTexture(),b.__webglInit=!0;n.bindTexture(n.TEXTURE_2D,b.__webglTexture);b.image.data?n.texImage2D(n.TEXTURE_2D,0,R(b.format),b.image.width,b.image.height,0,R(b.format),n.UNSIGNED_BYTE,b.image.data):n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,b.image);K(n.TEXTURE_2D,b,b.image);n.bindTexture(n.TEXTURE_2D,null);b.needsUpdate=!1}n.activeTexture(n.TEXTURE0+c);n.bindTexture(n.TEXTURE_2D,b.__webglTexture)}function J(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=
-!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=n.createFramebuffer();b.__webglRenderbuffer=n.createRenderbuffer();b.__webglTexture=n.createTexture();n.bindTexture(n.TEXTURE_2D,b.__webglTexture);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,R(b.wrapS));n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,R(b.wrapT));n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,R(b.magFilter));n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,R(b.minFilter));n.texImage2D(n.TEXTURE_2D,0,R(b.format),
-b.width,b.height,0,R(b.format),R(b.type),null);n.bindRenderbuffer(n.RENDERBUFFER,b.__webglRenderbuffer);n.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer);n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,
-n.DEPTH_STENCIL,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):n.renderbufferStorage(n.RENDERBUFFER,n.RGBA4,b.width,b.height);n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER,null)}var c,e;b?(c=b.__webglFramebuffer,e=b.width,b=b.height):(c=null,e=Y,b=Z);c!=fa&&(n.bindFramebuffer(n.FRAMEBUFFER,c),n.viewport(P,aa,e,b),fa=c)}function S(b,c){var e;b=="fragment"?e=n.createShader(n.FRAGMENT_SHADER):
-b=="vertex"&&(e=n.createShader(n.VERTEX_SHADER));n.shaderSource(e,c);n.compileShader(e);if(!n.getShaderParameter(e,n.COMPILE_STATUS))return console.error(n.getShaderInfoLog(e)),console.error(c),null;return e}function X(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return n.NEAREST;default:return n.LINEAR}}function R(b){switch(b){case THREE.RepeatWrapping:return n.REPEAT;case THREE.ClampToEdgeWrapping:return n.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return n.MIRRORED_REPEAT;
+!1,g._modelViewMatrixArray)),k=g.map.image.width/(g.scaleByViewport?ka:1),m[0]=k*j*g.scale.x,m[1]=k*g.scale.y,n.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),n.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),n.uniform2f(h.alignment,g.alignment.x,g.alignment.y),n.uniform1f(h.opacity,g.opacity),n.uniform1f(h.rotation,g.rotation),n.uniform2fv(h.scale,m),g.mergeWith3D&&!p?(n.enable(n.DEPTH_TEST),p=!0):!g.mergeWith3D&&p&&(n.disable(n.DEPTH_TEST),p=!1),C(g.blending),N(g.map,0),n.drawElements(n.TRIANGLES,
+6,n.UNSIGNED_SHORT,0));n.enable(n.CULL_FACE);n.enable(n.DEPTH_TEST);n.depthMask(Q)}function B(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function A(b){var c,e,f,g;g=b.__materials;b=0;for(e=g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function I(b){var c,e,f,g;g=b.__materials;b=0;for(e=
+g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function z(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function H(b){function c(b){var g=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?g.push("undefined"):g.push(b[e].id);return g.join("_")}var e,f,g,h,j,k,n,m,o={},u=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};g=0;for(h=b.faces.length;g<h;g++)j=b.faces[g],k=j.materials,n=c(k),o[n]==void 0&&(o[n]={hash:n,counter:0}),
+m=o[n].hash+"_"+o[n].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:k,vertices:0,numMorphTargets:u}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[m].vertices+j>65535&&(o[n].counter+=1,m=o[n].hash+"_"+o[n].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:k,vertices:0,numMorphTargets:u})),b.geometryGroups[m].faces.push(g),b.geometryGroups[m].vertices+=j}function G(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],
+count:0}})}function C(b){if(b!=ca){switch(b){case THREE.AdditiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE);break;case THREE.SubtractiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA)}ca=b}}function O(b,c,e){(e.width&
+e.width-1)==0&&(e.height&e.height-1)==0?(n.texParameteri(b,n.TEXTURE_WRAP_S,M(c.wrapS)),n.texParameteri(b,n.TEXTURE_WRAP_T,M(c.wrapT)),n.texParameteri(b,n.TEXTURE_MAG_FILTER,M(c.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,M(c.minFilter)),n.generateMipmap(b)):(n.texParameteri(b,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_MAG_FILTER,U(c.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,U(c.minFilter)))}function N(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=
+n.createTexture(),b.__webglInit=!0;n.bindTexture(n.TEXTURE_2D,b.__webglTexture);b.image.data?n.texImage2D(n.TEXTURE_2D,0,M(b.format),b.image.width,b.image.height,0,M(b.format),n.UNSIGNED_BYTE,b.image.data):n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,b.image);O(n.TEXTURE_2D,b,b.image);n.bindTexture(n.TEXTURE_2D,null);b.needsUpdate=!1}n.activeTexture(n.TEXTURE0+c);n.bindTexture(n.TEXTURE_2D,b.__webglTexture)}function D(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=
+!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=n.createFramebuffer();b.__webglRenderbuffer=n.createRenderbuffer();b.__webglTexture=n.createTexture();n.bindTexture(n.TEXTURE_2D,b.__webglTexture);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,M(b.wrapS));n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,M(b.wrapT));n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,M(b.magFilter));n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,M(b.minFilter));n.texImage2D(n.TEXTURE_2D,0,M(b.format),
+b.width,b.height,0,M(b.format),M(b.type),null);n.bindRenderbuffer(n.RENDERBUFFER,b.__webglRenderbuffer);n.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer);n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,
+n.DEPTH_STENCIL,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):n.renderbufferStorage(n.RENDERBUFFER,n.RGBA4,b.width,b.height);n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER,null)}var c,e;b?(c=b.__webglFramebuffer,e=b.width,b=b.height):(c=null,e=Z,b=ka);c!=X&&(n.bindFramebuffer(n.FRAMEBUFFER,c),n.viewport(K,da,e,b),X=c)}function E(b,c){var e;b=="fragment"?e=n.createShader(n.FRAGMENT_SHADER):
+b=="vertex"&&(e=n.createShader(n.VERTEX_SHADER));n.shaderSource(e,c);n.compileShader(e);if(!n.getShaderParameter(e,n.COMPILE_STATUS))return console.error(n.getShaderInfoLog(e)),console.error(c),null;return e}function U(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return n.NEAREST;default:return n.LINEAR}}function M(b){switch(b){case THREE.RepeatWrapping:return n.REPEAT;case THREE.ClampToEdgeWrapping:return n.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return n.MIRRORED_REPEAT;
 case THREE.NearestFilter:return n.NEAREST;case THREE.NearestMipMapNearestFilter:return n.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return n.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return n.LINEAR;case THREE.LinearMipMapNearestFilter:return n.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return n.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return n.BYTE;case THREE.UnsignedByteType:return n.UNSIGNED_BYTE;case THREE.ShortType:return n.SHORT;case THREE.UnsignedShortType:return n.UNSIGNED_SHORT;
-case THREE.IntType:return n.INT;case THREE.UnsignedShortType:return n.UNSIGNED_INT;case THREE.FloatType:return n.FLOAT;case THREE.AlphaFormat:return n.ALPHA;case THREE.RGBFormat:return n.RGB;case THREE.RGBAFormat:return n.RGBA;case THREE.LuminanceFormat:return n.LUMINANCE;case THREE.LuminanceAlphaFormat:return n.LUMINANCE_ALPHA}return 0}var C=this,n,W=[],V=null,fa=null,L=!0,ea=null,T=null,U=null,da=null,ha=null,ia=null,M=null,P=0,aa=0,Y=0,Z=0,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Matrix4,la=new Float32Array(16),ka=new Float32Array(16),pa=new THREE.Vector4,sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ua=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Ia=b.stencil!==void 0?b.stencil:!0,Ja=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,Ka=b.antialias!==void 0?b.antialias:!1,va=b.clearColor!==void 0?new THREE.Color(b.clearColor):
-new THREE.Color(0),ya=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ua;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var $,ta=[],b=THREE.ShaderLib.depthRGBA,Ea=THREE.UniformsUtils.clone(b.uniforms),oa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,
-vertexShader:b.vertexShader,uniforms:Ea}),ma=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ea,morphTargets:!0});oa._shadowPass=!0;ma._shadowPass=!0;try{if(!(n=ua.getContext("experimental-webgl",{antialias:Ka,stencil:Ia,preserveDrawingBuffer:Ja})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+n.getParameter(n.VERSION)+" | "+n.getParameter(n.VENDOR)+" | "+n.getParameter(n.RENDERER)+" | "+n.getParameter(n.SHADING_LANGUAGE_VERSION))}catch(Ga){console.error(Ga)}n.clearColor(0,
-0,0,1);n.clearDepth(1);n.enable(n.DEPTH_TEST);n.depthFunc(n.LEQUAL);n.frontFace(n.CCW);n.cullFace(n.BACK);n.enable(n.CULL_FACE);n.enable(n.BLEND);n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA);n.clearColor(va.r,va.g,va.b,ya);this.context=n;var Da=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,N={};N.vertices=new Float32Array(16);N.faces=new Uint16Array(6);i=0;N.vertices[i++]=-1;N.vertices[i++]=-1;N.vertices[i++]=0;N.vertices[i++]=1;N.vertices[i++]=1;N.vertices[i++]=
--1;N.vertices[i++]=1;N.vertices[i++]=1;N.vertices[i++]=1;N.vertices[i++]=1;N.vertices[i++]=1;N.vertices[i++]=0;N.vertices[i++]=-1;N.vertices[i++]=1;N.vertices[i++]=0;i=N.vertices[i++]=0;N.faces[i++]=0;N.faces[i++]=1;N.faces[i++]=2;N.faces[i++]=0;N.faces[i++]=2;N.faces[i++]=3;N.vertexBuffer=n.createBuffer();N.elementBuffer=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,N.vertexBuffer);n.bufferData(n.ARRAY_BUFFER,N.vertices,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,N.elementBuffer);n.bufferData(n.ELEMENT_ARRAY_BUFFER,
-N.faces,n.STATIC_DRAW);N.program=n.createProgram();n.attachShader(N.program,S("fragment",THREE.ShaderLib.sprite.fragmentShader));n.attachShader(N.program,S("vertex",THREE.ShaderLib.sprite.vertexShader));n.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.position=n.getAttribLocation(N.program,"position");N.attributes.uv=n.getAttribLocation(N.program,"uv");N.uniforms.uvOffset=n.getUniformLocation(N.program,"uvOffset");N.uniforms.uvScale=n.getUniformLocation(N.program,"uvScale");N.uniforms.rotation=
-n.getUniformLocation(N.program,"rotation");N.uniforms.scale=n.getUniformLocation(N.program,"scale");N.uniforms.alignment=n.getUniformLocation(N.program,"alignment");N.uniforms.map=n.getUniformLocation(N.program,"map");N.uniforms.opacity=n.getUniformLocation(N.program,"opacity");N.uniforms.useScreenCoordinates=n.getUniformLocation(N.program,"useScreenCoordinates");N.uniforms.affectedByDistance=n.getUniformLocation(N.program,"affectedByDistance");N.uniforms.screenPosition=n.getUniformLocation(N.program,
-"screenPosition");N.uniforms.modelViewMatrix=n.getUniformLocation(N.program,"modelViewMatrix");N.uniforms.projectionMatrix=n.getUniformLocation(N.program,"projectionMatrix");var za=!1;this.setSize=function(b,c){ua.width=b;ua.height=c;this.setViewport(0,0,ua.width,ua.height)};this.setViewport=function(b,c,e,f){P=b;aa=c;Y=e;Z=f;n.viewport(P,aa,Y,Z)};this.setScissor=function(b,c,e,f){n.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?n.enable(n.SCISSOR_TEST):n.disable(n.SCISSOR_TEST)};this.enableDepthBufferWrite=
-function(b){L=b;n.depthMask(b)};this.setClearColorHex=function(b,c){va.setHex(b);ya=c;n.clearColor(va.r,va.g,va.b,ya)};this.setClearColor=function(b,c){va.copy(b);ya=c;n.clearColor(va.r,va.g,va.b,ya)};this.clear=function(){n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT|n.STENCIL_BUFFER_BIT)};this.getContext=function(){return n};this.initMaterial=function(b,c,e,f){var g,h,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?
+case THREE.IntType:return n.INT;case THREE.UnsignedShortType:return n.UNSIGNED_INT;case THREE.FloatType:return n.FLOAT;case THREE.AlphaFormat:return n.ALPHA;case THREE.RGBFormat:return n.RGB;case THREE.RGBAFormat:return n.RGBA;case THREE.LuminanceFormat:return n.LUMINANCE;case THREE.LuminanceAlphaFormat:return n.LUMINANCE_ALPHA}return 0}var L=this,n,S=[],V=null,X=null,Q=!0,fa=null,W=null,ca=null,Y=null,ea=null,$=null,ga=null,K=0,da=0,Z=0,ka=0,ia=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Matrix4,R=new Float32Array(16),oa=new Float32Array(16),qa=new THREE.Vector4,la={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ua=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Ia=b.stencil!==void 0?b.stencil:!0,Ja=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,Ka=b.antialias!==void 0?b.antialias:!1,va=b.clearColor!==void 0?new THREE.Color(b.clearColor):
+new THREE.Color(0),ya=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ua;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var aa,ta=[],b=THREE.ShaderLib.depthRGBA,Ea=THREE.UniformsUtils.clone(b.uniforms),pa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,
+vertexShader:b.vertexShader,uniforms:Ea}),ma=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ea,morphTargets:!0});pa._shadowPass=!0;ma._shadowPass=!0;try{if(!(n=ua.getContext("experimental-webgl",{antialias:Ka,stencil:Ia,preserveDrawingBuffer:Ja})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+n.getParameter(n.VERSION)+" | "+n.getParameter(n.VENDOR)+" | "+n.getParameter(n.RENDERER)+" | "+n.getParameter(n.SHADING_LANGUAGE_VERSION))}catch(Ga){console.error(Ga)}n.clearColor(0,
+0,0,1);n.clearDepth(1);n.enable(n.DEPTH_TEST);n.depthFunc(n.LEQUAL);n.frontFace(n.CCW);n.cullFace(n.BACK);n.enable(n.CULL_FACE);n.enable(n.BLEND);n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA);n.clearColor(va.r,va.g,va.b,ya);this.context=n;var Da=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,J={};J.vertices=new Float32Array(16);J.faces=new Uint16Array(6);i=0;J.vertices[i++]=-1;J.vertices[i++]=-1;J.vertices[i++]=0;J.vertices[i++]=1;J.vertices[i++]=1;J.vertices[i++]=
+-1;J.vertices[i++]=1;J.vertices[i++]=1;J.vertices[i++]=1;J.vertices[i++]=1;J.vertices[i++]=1;J.vertices[i++]=0;J.vertices[i++]=-1;J.vertices[i++]=1;J.vertices[i++]=0;i=J.vertices[i++]=0;J.faces[i++]=0;J.faces[i++]=1;J.faces[i++]=2;J.faces[i++]=0;J.faces[i++]=2;J.faces[i++]=3;J.vertexBuffer=n.createBuffer();J.elementBuffer=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,J.vertexBuffer);n.bufferData(n.ARRAY_BUFFER,J.vertices,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,J.elementBuffer);n.bufferData(n.ELEMENT_ARRAY_BUFFER,
+J.faces,n.STATIC_DRAW);J.program=n.createProgram();n.attachShader(J.program,E("fragment",THREE.ShaderLib.sprite.fragmentShader));n.attachShader(J.program,E("vertex",THREE.ShaderLib.sprite.vertexShader));n.linkProgram(J.program);J.attributes={};J.uniforms={};J.attributes.position=n.getAttribLocation(J.program,"position");J.attributes.uv=n.getAttribLocation(J.program,"uv");J.uniforms.uvOffset=n.getUniformLocation(J.program,"uvOffset");J.uniforms.uvScale=n.getUniformLocation(J.program,"uvScale");J.uniforms.rotation=
+n.getUniformLocation(J.program,"rotation");J.uniforms.scale=n.getUniformLocation(J.program,"scale");J.uniforms.alignment=n.getUniformLocation(J.program,"alignment");J.uniforms.map=n.getUniformLocation(J.program,"map");J.uniforms.opacity=n.getUniformLocation(J.program,"opacity");J.uniforms.useScreenCoordinates=n.getUniformLocation(J.program,"useScreenCoordinates");J.uniforms.affectedByDistance=n.getUniformLocation(J.program,"affectedByDistance");J.uniforms.screenPosition=n.getUniformLocation(J.program,
+"screenPosition");J.uniforms.modelViewMatrix=n.getUniformLocation(J.program,"modelViewMatrix");J.uniforms.projectionMatrix=n.getUniformLocation(J.program,"projectionMatrix");var za=!1;this.setSize=function(b,c){ua.width=b;ua.height=c;this.setViewport(0,0,ua.width,ua.height)};this.setViewport=function(b,c,e,f){K=b;da=c;Z=e;ka=f;n.viewport(K,da,Z,ka)};this.setScissor=function(b,c,e,f){n.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?n.enable(n.SCISSOR_TEST):n.disable(n.SCISSOR_TEST)};this.enableDepthBufferWrite=
+function(b){Q=b;n.depthMask(b)};this.setClearColorHex=function(b,c){va.setHex(b);ya=c;n.clearColor(va.r,va.g,va.b,ya)};this.setClearColor=function(b,c){va.copy(b);ya=c;n.clearColor(va.r,va.g,va.b,ya)};this.clear=function(){n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT|n.STENCIL_BUFFER_BIT)};this.getContext=function(){return n};this.initMaterial=function(b,c,e,f){var g,h,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?
 j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=k.fragmentShader}var m,o,u;m=u=k=0;for(o=c.length;m<o;m++)h=c[m],h instanceof THREE.SpotLight&&u++,h instanceof THREE.DirectionalLight&&u++,h instanceof THREE.PointLight&&
 k++;k+u<=4?m=u:(m=Math.ceil(4*u/(k+u)),k=4-m);h={directional:m,point:k};k=u=0;for(m=c.length;k<m;k++)o=c[k],o instanceof THREE.SpotLight&&o.castShadow&&u++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var p;a:{m=b.fragmentShader;o=b.vertexShader;var k=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
-maxDirLights:h.directional,maxPointLights:h.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},v,f=[];j?f.push(j):(f.push(m),f.push(o));for(v in e)f.push(v),f.push(e[v]);j=f.join();v=0;for(f=W.length;v<f;v++)if(W[v].code==j){p=W[v].program;break a}v=n.createProgram();f=[Da?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,
+maxDirLights:h.directional,maxPointLights:h.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},v,f=[];j?f.push(j):(f.push(m),f.push(o));for(v in e)f.push(v),f.push(e[v]);j=f.join();v=0;for(f=S.length;v<f;v++)if(S[v].code==j){p=S[v].program;break a}v=n.createProgram();f=[Da?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,
 "#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.fog?"#define USE_FOG":"",e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":
-"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");n.attachShader(v,S("fragment",h+m));n.attachShader(v,S("vertex",f+o));n.linkProgram(v);n.getProgramParameter(v,n.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+n.getProgramParameter(v,n.VALIDATE_STATUS)+", gl error ["+n.getError()+"]");v.uniforms=
+"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");n.attachShader(v,E("fragment",h+m));n.attachShader(v,E("vertex",f+o));n.linkProgram(v);n.getProgramParameter(v,n.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+n.getProgramParameter(v,n.VALIDATE_STATUS)+", gl error ["+n.getError()+"]");v.uniforms=
 {};v.attributes={};var w,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in k)f.push(w);w=f;f=0;for(k=w.length;f<k;f++)m=w[f],v.uniforms[m]=n.getUniformLocation(v,m);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<e.maxMorphTargets;w++)f.push("morphTarget"+w);for(p in c)f.push(p);p=f;w=0;for(c=p.length;w<c;w++)e=
-p[w],v.attributes[e]=n.getAttribLocation(v,e);W.push({program:v,code:j});p=v}b.program=p;p=b.program.attributes;p.position>=0&&n.enableVertexAttribArray(p.position);p.color>=0&&n.enableVertexAttribArray(p.color);p.normal>=0&&n.enableVertexAttribArray(p.normal);p.tangent>=0&&n.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(n.enableVertexAttribArray(p.skinVertexA),n.enableVertexAttribArray(p.skinVertexB),n.enableVertexAttribArray(p.skinIndex),
-n.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(g in b.attributes)p[g]!==void 0&&p[g]>=0&&n.enableVertexAttribArray(p[g]);if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)w="morphTarget"+g,p[w]>=0&&(n.enableVertexAttribArray(p[w]),b.numSupportedMorphTargets++)};this.render=function(b,c,p,A){var y,G,H,I,D,L,K,N,M=b.lights,P=b.fog;this.shadowMapEnabled&&w(b,c);C.data.vertices=0;C.data.faces=0;C.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
-!1,c);c.matrixWorldInverse.flattenToArray(ka);c.projectionMatrix.flattenToArray(la);ja.multiply(c.projectionMatrix,c.matrixWorldInverse);o(ja);this.initWebGLObjects(b);J(p);(this.autoClear||A)&&this.clear();D=b.__webglObjects.length;for(A=0;A<D;A++)if(y=b.__webglObjects[A],K=y.object,K.visible)if(!(K instanceof THREE.Mesh)||m(K)){if(K.matrixWorld.flattenToArray(K._objectMatrixArray),B(K,c,!0),v(y),y.render=!0,this.sortObjects)y.object.renderDepth?y.z=y.object.renderDepth:(pa.copy(K.position),ja.multiplyVector3(pa),
-y.z=pa.z)}else y.render=!1;else y.render=!1;this.sortObjects&&b.__webglObjects.sort(t);L=b.__webglObjectsImmediate.length;for(A=0;A<L;A++)y=b.__webglObjectsImmediate[A],K=y.object,K.visible&&(K.matrixAutoUpdate&&K.matrixWorld.flattenToArray(K._objectMatrixArray),B(K,c,!0),u(y));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);E(b.overrideMaterial.blending);for(A=0;A<D;A++)if(y=b.__webglObjects[A],y.render)K=y.object,N=y.buffer,j(K),f(c,M,P,b.overrideMaterial,N,K);for(A=0;A<L;A++)y=b.__webglObjectsImmediate[A],
-K=y.object,K.visible&&(j(K),G=e(c,M,P,b.overrideMaterial,K),K.render(function(c){g(c,G,b.overrideMaterial.shading)}))}else{E(THREE.NormalBlending);for(A=D-1;A>=0;A--)if(y=b.__webglObjects[A],y.render){K=y.object;N=y.buffer;H=y.opaque;j(K);for(y=0;y<H.count;y++)I=H.list[y],h(I.depthTest),k(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),f(c,M,P,I,N,K)}for(A=0;A<L;A++)if(y=b.__webglObjectsImmediate[A],K=y.object,K.visible){H=y.opaque;j(K);for(y=0;y<H.count;y++)I=H.list[y],h(I.depthTest),
-k(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),G=e(c,M,P,I,K),K.render(function(b){g(b,G,I.shading)})}for(A=0;A<D;A++)if(y=b.__webglObjects[A],y.render){K=y.object;N=y.buffer;H=y.transparent;j(K);for(y=0;y<H.count;y++)I=H.list[y],E(I.blending),h(I.depthTest),k(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),f(c,M,P,I,N,K)}for(A=0;A<L;A++)if(y=b.__webglObjectsImmediate[A],K=y.object,K.visible){H=y.transparent;j(K);for(y=0;y<H.count;y++)I=H.list[y],E(I.blending),h(I.depthTest),
-k(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),G=e(c,M,P,I,K),K.render(function(b){g(b,G,I.shading)})}}b.__webglSprites.length&&x(b,c);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&(n.bindTexture(n.TEXTURE_2D,p.__webglTexture),n.generateMipmap(n.TEXTURE_2D),n.bindTexture(n.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
-f=b,g=void 0,h=void 0,j=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(g in h=e.geometry,h.geometryGroups==void 0&&G(h),h.geometryGroups){j=h.geometryGroups[g];if(!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=n.createBuffer();k.__webglNormalBuffer=n.createBuffer();
+p[w],v.attributes[e]=n.getAttribLocation(v,e);S.push({program:v,code:j});p=v}b.program=p;p=b.program.attributes;p.position>=0&&n.enableVertexAttribArray(p.position);p.color>=0&&n.enableVertexAttribArray(p.color);p.normal>=0&&n.enableVertexAttribArray(p.normal);p.tangent>=0&&n.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(n.enableVertexAttribArray(p.skinVertexA),n.enableVertexAttribArray(p.skinVertexB),n.enableVertexAttribArray(p.skinIndex),
+n.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(g in b.attributes)p[g]!==void 0&&p[g]>=0&&n.enableVertexAttribArray(p[g]);if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)w="morphTarget"+g,p[w]>=0&&(n.enableVertexAttribArray(p[w]),b.numSupportedMorphTargets++)};this.render=function(b,c,p,A){var z,I,G,H,E,N,K,O,J=b.lights,M=b.fog;this.shadowMapEnabled&&w(b,c);L.data.vertices=0;L.data.faces=0;L.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
+!1,c);c.matrixWorldInverse.flattenToArray(oa);c.projectionMatrix.flattenToArray(R);ja.multiply(c.projectionMatrix,c.matrixWorldInverse);o(ja);this.initWebGLObjects(b);D(p);(this.autoClear||A)&&this.clear();E=b.__webglObjects.length;for(A=0;A<E;A++)if(z=b.__webglObjects[A],K=z.object,K.visible)if(!(K instanceof THREE.Mesh)||m(K)){if(K.matrixWorld.flattenToArray(K._objectMatrixArray),B(K,c,!0),v(z),z.render=!0,this.sortObjects)z.object.renderDepth?z.z=z.object.renderDepth:(qa.copy(K.position),ja.multiplyVector3(qa),
+z.z=qa.z)}else z.render=!1;else z.render=!1;this.sortObjects&&b.__webglObjects.sort(t);N=b.__webglObjectsImmediate.length;for(A=0;A<N;A++)z=b.__webglObjectsImmediate[A],K=z.object,K.visible&&(K.matrixAutoUpdate&&K.matrixWorld.flattenToArray(K._objectMatrixArray),B(K,c,!0),u(z));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);C(b.overrideMaterial.blending);for(A=0;A<E;A++)if(z=b.__webglObjects[A],z.render)K=z.object,O=z.buffer,j(K),f(c,J,M,b.overrideMaterial,O,K);for(A=0;A<N;A++)z=b.__webglObjectsImmediate[A],
+K=z.object,K.visible&&(j(K),I=e(c,J,M,b.overrideMaterial,K),K.render(function(c){g(c,I,b.overrideMaterial.shading)}))}else{C(THREE.NormalBlending);for(A=E-1;A>=0;A--)if(z=b.__webglObjects[A],z.render){K=z.object;O=z.buffer;G=z.opaque;j(K);for(z=0;z<G.count;z++)H=G.list[z],h(H.depthTest),k(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),f(c,J,M,H,O,K)}for(A=0;A<N;A++)if(z=b.__webglObjectsImmediate[A],K=z.object,K.visible){G=z.opaque;j(K);for(z=0;z<G.count;z++)H=G.list[z],h(H.depthTest),
+k(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),I=e(c,J,M,H,K),K.render(function(b){g(b,I,H.shading)})}for(A=0;A<E;A++)if(z=b.__webglObjects[A],z.render){K=z.object;O=z.buffer;G=z.transparent;j(K);for(z=0;z<G.count;z++)H=G.list[z],C(H.blending),h(H.depthTest),k(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),f(c,J,M,H,O,K)}for(A=0;A<N;A++)if(z=b.__webglObjectsImmediate[A],K=z.object,K.visible){G=z.transparent;j(K);for(z=0;z<G.count;z++)H=G.list[z],C(H.blending),h(H.depthTest),
+k(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),I=e(c,J,M,H,K),K.render(function(b){g(b,I,H.shading)})}}b.__webglSprites.length&&x(b,c);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&(n.bindTexture(n.TEXTURE_2D,p.__webglTexture),n.generateMipmap(n.TEXTURE_2D),n.bindTexture(n.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
+f=b,g=void 0,h=void 0,j=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(g in h=e.geometry,h.geometryGroups==void 0&&H(h),h.geometryGroups){j=h.geometryGroups[g];if(!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=n.createBuffer();k.__webglNormalBuffer=n.createBuffer();
 k.__webglTangentBuffer=n.createBuffer();k.__webglColorBuffer=n.createBuffer();k.__webglUVBuffer=n.createBuffer();k.__webglUV2Buffer=n.createBuffer();k.__webglSkinVertexABuffer=n.createBuffer();k.__webglSkinVertexBBuffer=n.createBuffer();k.__webglSkinIndicesBuffer=n.createBuffer();k.__webglSkinWeightsBuffer=n.createBuffer();k.__webglFaceBuffer=n.createBuffer();k.__webglLineBuffer=n.createBuffer();if(k.numMorphTargets){var m=void 0,o=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(o=k.numMorphTargets;m<
-o;m++)k.__webglMorphTargetsBuffers.push(n.createBuffer())}for(var k=j,m=e,u=void 0,p=void 0,t=void 0,v=t=void 0,w=void 0,x=void 0,B=x=o=0,D=t=p=void 0,ja=D=p=u=void 0,t=void 0,v=m.geometry,w=v.faces,D=k.faces,u=0,p=D.length;u<p;u++)t=D[u],t=w[t],t instanceof THREE.Face3?(o+=3,x+=1,B+=3):t instanceof THREE.Face4&&(o+=4,x+=2,B+=4);for(var u=k,p=m,E=D=w=void 0,J=void 0,E=void 0,t=[],w=0,D=p.materials.length;w<D;w++)if(E=p.materials[w],E instanceof THREE.MeshFaceMaterial){E=0;for(l=u.materials.length;E<
-l;E++)(J=u.materials[E])&&t.push(J)}else(J=E)&&t.push(J);u=t;k.__materials=u;a:{w=p=void 0;D=u.length;for(p=0;p<D;p++)if(w=u[p],w.map||w.lightMap||w instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{D=w=void 0;t=u.length;for(w=0;w<t;w++)if(D=u[w],!(D instanceof THREE.MeshBasicMaterial&&!D.envMap||D instanceof THREE.MeshDepthMaterial)){D=D&&D.shading!=void 0&&D.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}D=!1}a:{t=w=void 0;E=u.length;for(w=0;w<E;w++)if(t=u[w],
-t.vertexColors){t=t.vertexColors;break a}t=!1}k.__vertexArray=new Float32Array(o*3);if(D)k.__normalArray=new Float32Array(o*3);if(v.hasTangents)k.__tangentArray=new Float32Array(o*4);if(t)k.__colorArray=new Float32Array(o*3);if(p){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(o*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(o*4),
-k.__skinVertexBArray=new Float32Array(o*4),k.__skinIndexArray=new Float32Array(o*4),k.__skinWeightArray=new Float32Array(o*4);k.__faceArray=new Uint16Array(x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(B*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];v=0;for(w=k.numMorphTargets;v<w;v++)k.__morphTargetsArrays.push(new Float32Array(o*3))}k.__needsSmoothNormals=D==THREE.SmoothShading;k.__uvType=p;k.__vertexColorType=t;k.__normalType=D;k.__webglFaceCount=
-x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=B*2;v=0;for(w=u.length;v<w;v++)if(p=u[v],p.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in p.attributes){t=p.attributes[a];D={};for(ja in t)D[ja]=t[ja];if(!D.__webglInitialized||D.createUniqueBuffers)D.__webglInitialized=!0,x=1,D.type==="v2"?x=2:D.type==="v3"?x=3:D.type==="v4"?x=4:D.type==="c"&&(x=3),D.size=x,D.array=new Float32Array(o*x),D.buffer=n.createBuffer(),D.buffer.belongsToAttribute=
-a,t.needsUpdate=!0,D.__original=t;k.__webglCustomAttributes[a]=D}}k.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}I(f.__webglObjects,j,e)}else if(e instanceof THREE.Ribbon){h=e.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=n.createBuffer(),g.__webglColorBuffer=n.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*
-3),g.__webglVertexCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;I(f.__webglObjects,h,e)}else if(e instanceof THREE.Line){h=e.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=n.createBuffer(),g.__webglColorBuffer=n.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*3),g.__webglLineCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;I(f.__webglObjects,h,e)}else if(e instanceof THREE.ParticleSystem){h=e.geometry;if(!h.__webglVertexBuffer){g=
+o;m++)k.__webglMorphTargetsBuffers.push(n.createBuffer())}for(var k=j,m=e,u=void 0,p=void 0,t=void 0,v=t=void 0,w=void 0,x=void 0,B=x=o=0,C=t=p=void 0,ja=C=p=u=void 0,t=void 0,v=m.geometry,w=v.faces,C=k.faces,u=0,p=C.length;u<p;u++)t=C[u],t=w[t],t instanceof THREE.Face3?(o+=3,x+=1,B+=3):t instanceof THREE.Face4&&(o+=4,x+=2,B+=4);for(var u=k,p=m,D=C=w=void 0,E=void 0,D=void 0,t=[],w=0,C=p.materials.length;w<C;w++)if(D=p.materials[w],D instanceof THREE.MeshFaceMaterial){D=0;for(l=u.materials.length;D<
+l;D++)(E=u.materials[D])&&t.push(E)}else(E=D)&&t.push(E);u=t;k.__materials=u;a:{w=p=void 0;C=u.length;for(p=0;p<C;p++)if(w=u[p],w.map||w.lightMap||w instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{C=w=void 0;t=u.length;for(w=0;w<t;w++)if(C=u[w],!(C instanceof THREE.MeshBasicMaterial&&!C.envMap||C instanceof THREE.MeshDepthMaterial)){C=C&&C.shading!=void 0&&C.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}C=!1}a:{t=w=void 0;D=u.length;for(w=0;w<D;w++)if(t=u[w],
+t.vertexColors){t=t.vertexColors;break a}t=!1}k.__vertexArray=new Float32Array(o*3);if(C)k.__normalArray=new Float32Array(o*3);if(v.hasTangents)k.__tangentArray=new Float32Array(o*4);if(t)k.__colorArray=new Float32Array(o*3);if(p){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(o*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(o*4),
+k.__skinVertexBArray=new Float32Array(o*4),k.__skinIndexArray=new Float32Array(o*4),k.__skinWeightArray=new Float32Array(o*4);k.__faceArray=new Uint16Array(x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(B*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];v=0;for(w=k.numMorphTargets;v<w;v++)k.__morphTargetsArrays.push(new Float32Array(o*3))}k.__needsSmoothNormals=C==THREE.SmoothShading;k.__uvType=p;k.__vertexColorType=t;k.__normalType=C;k.__webglFaceCount=
+x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=B*2;v=0;for(w=u.length;v<w;v++)if(p=u[v],p.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in p.attributes){t=p.attributes[a];C={};for(ja in t)C[ja]=t[ja];if(!C.__webglInitialized||C.createUniqueBuffers)C.__webglInitialized=!0,x=1,C.type==="v2"?x=2:C.type==="v3"?x=3:C.type==="v4"?x=4:C.type==="c"&&(x=3),C.size=x,C.array=new Float32Array(o*x),C.buffer=n.createBuffer(),C.buffer.belongsToAttribute=
+a,t.needsUpdate=!0,C.__original=t;k.__webglCustomAttributes[a]=C}}k.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}G(f.__webglObjects,j,e)}else if(e instanceof THREE.Ribbon){h=e.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=n.createBuffer(),g.__webglColorBuffer=n.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*
+3),g.__webglVertexCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;G(f.__webglObjects,h,e)}else if(e instanceof THREE.Line){h=e.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=n.createBuffer(),g.__webglColorBuffer=n.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*3),g.__webglLineCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;G(f.__webglObjects,h,e)}else if(e instanceof THREE.ParticleSystem){h=e.geometry;if(!h.__webglVertexBuffer){g=
 h;g.__webglVertexBuffer=n.createBuffer();g.__webglColorBuffer=n.createBuffer();g=h;j=e;k=g.vertices.length;g.__vertexArray=new Float32Array(k*3);g.__colorArray=new Float32Array(k*3);g.__sortArray=[];g.__webglParticleCount=k;g.__materials=j.materials;ja=o=m=void 0;m=0;for(o=j.materials.length;m<o;m++)if(ja=j.materials[m],ja.attributes){if(g.__webglCustomAttributes===void 0)g.__webglCustomAttributes={};for(a in ja.attributes){originalAttribute=ja.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
 originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=n.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;g.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=
-!0;h.__dirtyColors=!0}I(f.__webglObjects,h,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];e=b;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)y(e.__webglObjects,f);else if(f instanceof
-THREE.Sprite){e=e.__webglSprites;h=void 0;for(h=e.length-1;h>=0;h--)e[h]==f&&e.splice(h,1)}else f instanceof THREE.MarchingCubes&&y(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(g=b.__webglObjects[e].object,m=k=h=j=void 0,g instanceof THREE.Mesh){h=g.geometry;for(j in h.geometryGroups)if(k=h.geometryGroups[j],m=A(k),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||
-m)if(m=k,o=n.DYNAMIC_DRAW,ja=!h.dynamic,m.__inittedArrays){var K=B=x=void 0,C=void 0,la=K=void 0,L=void 0,N=void 0,M=void 0,P=J=E=t=D=w=p=u=v=void 0,F=C=M=C=N=L=void 0,z=void 0,Q=z=F=L=void 0,S=void 0,R=Q=z=F=K=K=la=M=C=Q=z=F=S=Q=z=F=S=Q=z=F=void 0,ka=0,U=0,pa=0,X=0,W=0,ha=0,T=0,aa=0,V=0,O=0,Y=0,Q=F=0,Q=void 0,ia=m.__vertexArray,ea=m.__uvArray,fa=m.__uv2Array,da=m.__normalArray,Z=m.__tangentArray,sa=m.__colorArray,ca=m.__skinVertexAArray,$=m.__skinVertexBArray,qa=m.__skinIndexArray,ra=m.__skinWeightArray,
-ta=m.__morphTargetsArrays,ua=m.__webglCustomAttributes,z=void 0,oa=m.__faceArray,ma=m.__lineArray,va=m.__needsSmoothNormals,u=m.__vertexColorType,v=m.__uvType,p=m.__normalType,xa=g.geometry,ya=xa.__dirtyVertices,Ia=xa.__dirtyElements,za=xa.__dirtyUvs,Ja=xa.__dirtyNormals,Ka=xa.__dirtyTangents,Da=xa.__dirtyColors,Ea=xa.__dirtyMorphTargets,Pa=xa.vertices,Ga=m.faces,cb=xa.faces,ab=xa.faceVertexUvs[0],bb=xa.faceVertexUvs[1],Qa=xa.skinVerticesA,Ra=xa.skinVerticesB,Sa=xa.skinIndices,Ha=xa.skinWeights,Fa=
-xa.morphTargets;if(ua)for(R in ua)ua[R].offset=0,ua[R].offsetSrc=0;x=0;for(B=Ga.length;x<B;x++)if(K=Ga[x],C=cb[K],ab&&(w=ab[K]),bb&&(D=bb[K]),K=C.vertexNormals,la=C.normal,L=C.vertexColors,N=C.color,M=C.vertexTangents,C instanceof THREE.Face3){if(ya)t=Pa[C.a].position,E=Pa[C.b].position,J=Pa[C.c].position,ia[U]=t.x,ia[U+1]=t.y,ia[U+2]=t.z,ia[U+3]=E.x,ia[U+4]=E.y,ia[U+5]=E.z,ia[U+6]=J.x,ia[U+7]=J.y,ia[U+8]=J.z,U+=9;if(ua)for(R in ua)if(z=ua[R],z.__original.needsUpdate)F=z.offset,Q=z.offsetSrc,z.size===
-1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[F]=z.value[C.a],z.array[F+1]=z.value[C.b],z.array[F+2]=z.value[C.c]):z.boundTo==="faces"?(Q=z.value[Q],z.array[F]=Q,z.array[F+1]=Q,z.array[F+2]=Q,z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[F]=z.value[Q],z.array[F+1]=z.value[Q+1],z.array[F+2]=z.value[Q+2],z.offsetSrc+=3),z.offset+=3):(z.boundTo===void 0||z.boundTo==="vertices"?(t=z.value[C.a],E=z.value[C.b],J=z.value[C.c]):z.boundTo==="faces"?(J=E=t=Q=z.value[Q],z.offsetSrc++):z.boundTo===
-"faceVertices"&&(t=z.value[Q],E=z.value[Q+1],J=z.value[Q+2],z.offsetSrc+=3),z.size===2?(z.array[F]=t.x,z.array[F+1]=t.y,z.array[F+2]=E.x,z.array[F+3]=E.y,z.array[F+4]=J.x,z.array[F+5]=J.y,z.offset+=6):z.size===3?(z.type==="c"?(z.array[F]=t.r,z.array[F+1]=t.g,z.array[F+2]=t.b,z.array[F+3]=E.r,z.array[F+4]=E.g,z.array[F+5]=E.b,z.array[F+6]=J.r,z.array[F+7]=J.g,z.array[F+8]=J.b):(z.array[F]=t.x,z.array[F+1]=t.y,z.array[F+2]=t.z,z.array[F+3]=E.x,z.array[F+4]=E.y,z.array[F+5]=E.z,z.array[F+6]=J.x,z.array[F+
-7]=J.y,z.array[F+8]=J.z),z.offset+=9):(z.array[F]=t.x,z.array[F+1]=t.y,z.array[F+2]=t.z,z.array[F+3]=t.w,z.array[F+4]=E.x,z.array[F+5]=E.y,z.array[F+6]=E.z,z.array[F+7]=E.w,z.array[F+8]=J.x,z.array[F+9]=J.y,z.array[F+10]=J.z,z.array[F+11]=J.w,z.offset+=12));if(Ea){F=0;for(z=Fa.length;F<z;F++)t=Fa[F].vertices[C.a].position,E=Fa[F].vertices[C.b].position,J=Fa[F].vertices[C.c].position,Q=ta[F],Q[Y]=t.x,Q[Y+1]=t.y,Q[Y+2]=t.z,Q[Y+3]=E.x,Q[Y+4]=E.y,Q[Y+5]=E.z,Q[Y+6]=J.x,Q[Y+7]=J.y,Q[Y+8]=J.z;Y+=9}if(Ha.length)F=
-Ha[C.a],z=Ha[C.b],Q=Ha[C.c],ra[O]=F.x,ra[O+1]=F.y,ra[O+2]=F.z,ra[O+3]=F.w,ra[O+4]=z.x,ra[O+5]=z.y,ra[O+6]=z.z,ra[O+7]=z.w,ra[O+8]=Q.x,ra[O+9]=Q.y,ra[O+10]=Q.z,ra[O+11]=Q.w,F=Sa[C.a],z=Sa[C.b],Q=Sa[C.c],qa[O]=F.x,qa[O+1]=F.y,qa[O+2]=F.z,qa[O+3]=F.w,qa[O+4]=z.x,qa[O+5]=z.y,qa[O+6]=z.z,qa[O+7]=z.w,qa[O+8]=Q.x,qa[O+9]=Q.y,qa[O+10]=Q.z,qa[O+11]=Q.w,F=Qa[C.a],z=Qa[C.b],Q=Qa[C.c],ca[O]=F.x,ca[O+1]=F.y,ca[O+2]=F.z,ca[O+3]=1,ca[O+4]=z.x,ca[O+5]=z.y,ca[O+6]=z.z,ca[O+7]=1,ca[O+8]=Q.x,ca[O+9]=Q.y,ca[O+10]=Q.z,
-ca[O+11]=1,F=Ra[C.a],z=Ra[C.b],Q=Ra[C.c],$[O]=F.x,$[O+1]=F.y,$[O+2]=F.z,$[O+3]=1,$[O+4]=z.x,$[O+5]=z.y,$[O+6]=z.z,$[O+7]=1,$[O+8]=Q.x,$[O+9]=Q.y,$[O+10]=Q.z,$[O+11]=1,O+=12;if(Da&&u)L.length==3&&u==THREE.VertexColors?(C=L[0],F=L[1],z=L[2]):z=F=C=N,sa[V]=C.r,sa[V+1]=C.g,sa[V+2]=C.b,sa[V+3]=F.r,sa[V+4]=F.g,sa[V+5]=F.b,sa[V+6]=z.r,sa[V+7]=z.g,sa[V+8]=z.b,V+=9;if(Ka&&xa.hasTangents)L=M[0],N=M[1],C=M[2],Z[T]=L.x,Z[T+1]=L.y,Z[T+2]=L.z,Z[T+3]=L.w,Z[T+4]=N.x,Z[T+5]=N.y,Z[T+6]=N.z,Z[T+7]=N.w,Z[T+8]=C.x,Z[T+
-9]=C.y,Z[T+10]=C.z,Z[T+11]=C.w,T+=12;if(Ja&&p)if(K.length==3&&va)for(M=0;M<3;M++)la=K[M],da[ha]=la.x,da[ha+1]=la.y,da[ha+2]=la.z,ha+=3;else for(M=0;M<3;M++)da[ha]=la.x,da[ha+1]=la.y,da[ha+2]=la.z,ha+=3;if(za&&w!==void 0&&v)for(M=0;M<3;M++)K=w[M],ea[pa]=K.u,ea[pa+1]=K.v,pa+=2;if(za&&D!==void 0&&v)for(M=0;M<3;M++)K=D[M],fa[X]=K.u,fa[X+1]=K.v,X+=2;Ia&&(oa[W]=ka,oa[W+1]=ka+1,oa[W+2]=ka+2,W+=3,ma[aa]=ka,ma[aa+1]=ka+1,ma[aa+2]=ka,ma[aa+3]=ka+2,ma[aa+4]=ka+1,ma[aa+5]=ka+2,aa+=6,ka+=3)}else if(C instanceof
-THREE.Face4){if(ya)t=Pa[C.a].position,E=Pa[C.b].position,J=Pa[C.c].position,P=Pa[C.d].position,ia[U]=t.x,ia[U+1]=t.y,ia[U+2]=t.z,ia[U+3]=E.x,ia[U+4]=E.y,ia[U+5]=E.z,ia[U+6]=J.x,ia[U+7]=J.y,ia[U+8]=J.z,ia[U+9]=P.x,ia[U+10]=P.y,ia[U+11]=P.z,U+=12;if(ua)for(R in ua)if(z=ua[R],z.__original.needsUpdate)F=z.offset,Q=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[F]=z.value[C.a],z.array[F+1]=z.value[C.b],z.array[F+2]=z.value[C.c],z.array[F+3]=z.value[C.d]):z.boundTo==="faces"?
-(Q=z.value[Q],z.array[F]=Q,z.array[F+1]=Q,z.array[F+2]=Q,z.array[F+3]=Q,z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[F]=z.value[Q],z.array[F+1]=z.value[Q+1],z.array[F+2]=z.value[Q+2],z.array[F+3]=z.value[Q+3],z.offsetSrc+=4),z.offset+=4):(z.boundTo===void 0||z.boundTo==="vertices"?(t=z.value[C.a],E=z.value[C.b],J=z.value[C.c],P=z.value[C.d]):z.boundTo==="faces"?(P=J=E=t=Q=z.value[Q],z.offsetSrc++):z.boundTo==="faceVertices"&&(t=z.value[Q],E=z.value[Q+1],J=z.value[Q+2],P=z.value[Q+3],z.offsetSrc+=
-4),z.size===2?(z.array[F]=t.x,z.array[F+1]=t.y,z.array[F+2]=E.x,z.array[F+3]=E.y,z.array[F+4]=J.x,z.array[F+5]=J.y,z.array[F+6]=P.x,z.array[F+7]=P.y,z.offset+=8):z.size===3?(z.type==="c"?(z.array[F]=t.r,z.array[F+1]=t.g,z.array[F+2]=t.b,z.array[F+3]=E.r,z.array[F+4]=E.g,z.array[F+5]=E.b,z.array[F+6]=J.r,z.array[F+7]=J.g,z.array[F+8]=J.b,z.array[F+9]=P.r,z.array[F+10]=P.g,z.array[F+11]=P.b):(z.array[F]=t.x,z.array[F+1]=t.y,z.array[F+2]=t.z,z.array[F+3]=E.x,z.array[F+4]=E.y,z.array[F+5]=E.z,z.array[F+
-6]=J.x,z.array[F+7]=J.y,z.array[F+8]=J.z,z.array[F+9]=P.x,z.array[F+10]=P.y,z.array[F+11]=P.z),z.offset+=12):(z.array[F]=t.x,z.array[F+1]=t.y,z.array[F+2]=t.z,z.array[F+3]=t.w,z.array[F+4]=E.x,z.array[F+5]=E.y,z.array[F+6]=E.z,z.array[F+7]=E.w,z.array[F+8]=J.x,z.array[F+9]=J.y,z.array[F+10]=J.z,z.array[F+11]=J.w,z.array[F+12]=P.x,z.array[F+13]=P.y,z.array[F+14]=P.z,z.array[F+15]=P.w,z.offset+=16));if(Ea){F=0;for(z=Fa.length;F<z;F++)t=Fa[F].vertices[C.a].position,E=Fa[F].vertices[C.b].position,J=Fa[F].vertices[C.c].position,
-P=Fa[F].vertices[C.d].position,Q=ta[F],Q[Y]=t.x,Q[Y+1]=t.y,Q[Y+2]=t.z,Q[Y+3]=E.x,Q[Y+4]=E.y,Q[Y+5]=E.z,Q[Y+6]=J.x,Q[Y+7]=J.y,Q[Y+8]=J.z,Q[Y+9]=P.x,Q[Y+10]=P.y,Q[Y+11]=P.z;Y+=12}if(Ha.length)F=Ha[C.a],z=Ha[C.b],Q=Ha[C.c],S=Ha[C.d],ra[O]=F.x,ra[O+1]=F.y,ra[O+2]=F.z,ra[O+3]=F.w,ra[O+4]=z.x,ra[O+5]=z.y,ra[O+6]=z.z,ra[O+7]=z.w,ra[O+8]=Q.x,ra[O+9]=Q.y,ra[O+10]=Q.z,ra[O+11]=Q.w,ra[O+12]=S.x,ra[O+13]=S.y,ra[O+14]=S.z,ra[O+15]=S.w,F=Sa[C.a],z=Sa[C.b],Q=Sa[C.c],S=Sa[C.d],qa[O]=F.x,qa[O+1]=F.y,qa[O+2]=F.z,qa[O+
-3]=F.w,qa[O+4]=z.x,qa[O+5]=z.y,qa[O+6]=z.z,qa[O+7]=z.w,qa[O+8]=Q.x,qa[O+9]=Q.y,qa[O+10]=Q.z,qa[O+11]=Q.w,qa[O+12]=S.x,qa[O+13]=S.y,qa[O+14]=S.z,qa[O+15]=S.w,F=Qa[C.a],z=Qa[C.b],Q=Qa[C.c],S=Qa[C.d],ca[O]=F.x,ca[O+1]=F.y,ca[O+2]=F.z,ca[O+3]=1,ca[O+4]=z.x,ca[O+5]=z.y,ca[O+6]=z.z,ca[O+7]=1,ca[O+8]=Q.x,ca[O+9]=Q.y,ca[O+10]=Q.z,ca[O+11]=1,ca[O+12]=S.x,ca[O+13]=S.y,ca[O+14]=S.z,ca[O+15]=1,F=Ra[C.a],z=Ra[C.b],Q=Ra[C.c],C=Ra[C.d],$[O]=F.x,$[O+1]=F.y,$[O+2]=F.z,$[O+3]=1,$[O+4]=z.x,$[O+5]=z.y,$[O+6]=z.z,$[O+
-7]=1,$[O+8]=Q.x,$[O+9]=Q.y,$[O+10]=Q.z,$[O+11]=1,$[O+12]=C.x,$[O+13]=C.y,$[O+14]=C.z,$[O+15]=1,O+=16;if(Da&&u)L.length==4&&u==THREE.VertexColors?(C=L[0],F=L[1],z=L[2],L=L[3]):L=z=F=C=N,sa[V]=C.r,sa[V+1]=C.g,sa[V+2]=C.b,sa[V+3]=F.r,sa[V+4]=F.g,sa[V+5]=F.b,sa[V+6]=z.r,sa[V+7]=z.g,sa[V+8]=z.b,sa[V+9]=L.r,sa[V+10]=L.g,sa[V+11]=L.b,V+=12;if(Ka&&xa.hasTangents)L=M[0],N=M[1],C=M[2],M=M[3],Z[T]=L.x,Z[T+1]=L.y,Z[T+2]=L.z,Z[T+3]=L.w,Z[T+4]=N.x,Z[T+5]=N.y,Z[T+6]=N.z,Z[T+7]=N.w,Z[T+8]=C.x,Z[T+9]=C.y,Z[T+10]=
-C.z,Z[T+11]=C.w,Z[T+12]=M.x,Z[T+13]=M.y,Z[T+14]=M.z,Z[T+15]=M.w,T+=16;if(Ja&&p)if(K.length==4&&va)for(M=0;M<4;M++)la=K[M],da[ha]=la.x,da[ha+1]=la.y,da[ha+2]=la.z,ha+=3;else for(M=0;M<4;M++)da[ha]=la.x,da[ha+1]=la.y,da[ha+2]=la.z,ha+=3;if(za&&w!==void 0&&v)for(M=0;M<4;M++)K=w[M],ea[pa]=K.u,ea[pa+1]=K.v,pa+=2;if(za&&D!==void 0&&v)for(M=0;M<4;M++)K=D[M],fa[X]=K.u,fa[X+1]=K.v,X+=2;Ia&&(oa[W]=ka,oa[W+1]=ka+1,oa[W+2]=ka+3,oa[W+3]=ka+1,oa[W+4]=ka+2,oa[W+5]=ka+3,W+=6,ma[aa]=ka,ma[aa+1]=ka+1,ma[aa+2]=ka,ma[aa+
-3]=ka+3,ma[aa+4]=ka+1,ma[aa+5]=ka+2,ma[aa+6]=ka+2,ma[aa+7]=ka+3,aa+=8,ka+=4)}ya&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,ia,o));if(ua)for(R in ua)z=ua[R],z.__original.needsUpdate&&(n.bindBuffer(n.ARRAY_BUFFER,z.buffer),n.bufferData(n.ARRAY_BUFFER,z.array,o));if(Ea){F=0;for(z=Fa.length;F<z;F++)n.bindBuffer(n.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[F]),n.bufferData(n.ARRAY_BUFFER,ta[F],o)}Da&&V>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,
-sa,o));Ja&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglNormalBuffer),n.bufferData(n.ARRAY_BUFFER,da,o));Ka&&xa.hasTangents&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglTangentBuffer),n.bufferData(n.ARRAY_BUFFER,Z,o));za&&pa>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglUVBuffer),n.bufferData(n.ARRAY_BUFFER,ea,o));za&&X>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglUV2Buffer),n.bufferData(n.ARRAY_BUFFER,fa,o));Ia&&(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,oa,o),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,
-m.__webglLineBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,ma,o));O>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinVertexABuffer),n.bufferData(n.ARRAY_BUFFER,ca,o),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),n.bufferData(n.ARRAY_BUFFER,$,o),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),n.bufferData(n.ARRAY_BUFFER,qa,o),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),n.bufferData(n.ARRAY_BUFFER,ra,o));ja&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,
-delete m.__tangentArray,delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;H(k)}else if(g instanceof THREE.Ribbon){h=g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=n.DYNAMIC_DRAW;k=B=x=x=
+!0;h.__dirtyColors=!0}G(f.__webglObjects,h,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];e=b;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)z(e.__webglObjects,f);else if(f instanceof
+THREE.Sprite){e=e.__webglSprites;h=void 0;for(h=e.length-1;h>=0;h--)e[h]==f&&e.splice(h,1)}else f instanceof THREE.MarchingCubes&&z(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(g=b.__webglObjects[e].object,m=k=h=j=void 0,g instanceof THREE.Mesh){h=g.geometry;for(j in h.geometryGroups)if(k=h.geometryGroups[j],m=A(k),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||
+m)if(m=k,o=n.DYNAMIC_DRAW,ja=!h.dynamic,m.__inittedArrays){var K=B=x=void 0,R=void 0,N=K=void 0,L=void 0,O=void 0,J=void 0,M=E=D=t=C=w=p=u=v=void 0,F=R=J=R=O=L=void 0,y=void 0,T=y=F=L=void 0,Q=void 0,oa=T=y=F=K=K=N=J=R=T=y=F=Q=T=y=F=Q=T=y=F=void 0,S=0,U=0,qa=0,ca=0,ga=0,da=0,V=0,Y=0,Z=0,P=0,W=0,T=F=0,T=void 0,X=m.__vertexArray,ea=m.__uvArray,fa=m.__uv2Array,ka=m.__normalArray,la=m.__tangentArray,ia=m.__colorArray,$=m.__skinVertexAArray,aa=m.__skinVertexBArray,ra=m.__skinIndexArray,sa=m.__skinWeightArray,
+ta=m.__morphTargetsArrays,ua=m.__webglCustomAttributes,y=void 0,pa=m.__faceArray,ma=m.__lineArray,va=m.__needsSmoothNormals,u=m.__vertexColorType,v=m.__uvType,p=m.__normalType,xa=g.geometry,ya=xa.__dirtyVertices,Ia=xa.__dirtyElements,za=xa.__dirtyUvs,Ja=xa.__dirtyNormals,Ka=xa.__dirtyTangents,Da=xa.__dirtyColors,Ea=xa.__dirtyMorphTargets,Pa=xa.vertices,Ga=m.faces,cb=xa.faces,ab=xa.faceVertexUvs[0],bb=xa.faceVertexUvs[1],Qa=xa.skinVerticesA,Ra=xa.skinVerticesB,Sa=xa.skinIndices,Ha=xa.skinWeights,Fa=
+xa.morphTargets;if(ua)for(oa in ua)ua[oa].offset=0,ua[oa].offsetSrc=0;x=0;for(B=Ga.length;x<B;x++)if(K=Ga[x],R=cb[K],ab&&(w=ab[K]),bb&&(C=bb[K]),K=R.vertexNormals,N=R.normal,L=R.vertexColors,O=R.color,J=R.vertexTangents,R instanceof THREE.Face3){if(ya)t=Pa[R.a].position,D=Pa[R.b].position,E=Pa[R.c].position,X[U]=t.x,X[U+1]=t.y,X[U+2]=t.z,X[U+3]=D.x,X[U+4]=D.y,X[U+5]=D.z,X[U+6]=E.x,X[U+7]=E.y,X[U+8]=E.z,U+=9;if(ua)for(oa in ua)if(y=ua[oa],y.__original.needsUpdate)F=y.offset,T=y.offsetSrc,y.size===
+1?(y.boundTo===void 0||y.boundTo==="vertices"?(y.array[F]=y.value[R.a],y.array[F+1]=y.value[R.b],y.array[F+2]=y.value[R.c]):y.boundTo==="faces"?(T=y.value[T],y.array[F]=T,y.array[F+1]=T,y.array[F+2]=T,y.offsetSrc++):y.boundTo==="faceVertices"&&(y.array[F]=y.value[T],y.array[F+1]=y.value[T+1],y.array[F+2]=y.value[T+2],y.offsetSrc+=3),y.offset+=3):(y.boundTo===void 0||y.boundTo==="vertices"?(t=y.value[R.a],D=y.value[R.b],E=y.value[R.c]):y.boundTo==="faces"?(E=D=t=T=y.value[T],y.offsetSrc++):y.boundTo===
+"faceVertices"&&(t=y.value[T],D=y.value[T+1],E=y.value[T+2],y.offsetSrc+=3),y.size===2?(y.array[F]=t.x,y.array[F+1]=t.y,y.array[F+2]=D.x,y.array[F+3]=D.y,y.array[F+4]=E.x,y.array[F+5]=E.y,y.offset+=6):y.size===3?(y.type==="c"?(y.array[F]=t.r,y.array[F+1]=t.g,y.array[F+2]=t.b,y.array[F+3]=D.r,y.array[F+4]=D.g,y.array[F+5]=D.b,y.array[F+6]=E.r,y.array[F+7]=E.g,y.array[F+8]=E.b):(y.array[F]=t.x,y.array[F+1]=t.y,y.array[F+2]=t.z,y.array[F+3]=D.x,y.array[F+4]=D.y,y.array[F+5]=D.z,y.array[F+6]=E.x,y.array[F+
+7]=E.y,y.array[F+8]=E.z),y.offset+=9):(y.array[F]=t.x,y.array[F+1]=t.y,y.array[F+2]=t.z,y.array[F+3]=t.w,y.array[F+4]=D.x,y.array[F+5]=D.y,y.array[F+6]=D.z,y.array[F+7]=D.w,y.array[F+8]=E.x,y.array[F+9]=E.y,y.array[F+10]=E.z,y.array[F+11]=E.w,y.offset+=12));if(Ea){F=0;for(y=Fa.length;F<y;F++)t=Fa[F].vertices[R.a].position,D=Fa[F].vertices[R.b].position,E=Fa[F].vertices[R.c].position,T=ta[F],T[W]=t.x,T[W+1]=t.y,T[W+2]=t.z,T[W+3]=D.x,T[W+4]=D.y,T[W+5]=D.z,T[W+6]=E.x,T[W+7]=E.y,T[W+8]=E.z;W+=9}if(Ha.length)F=
+Ha[R.a],y=Ha[R.b],T=Ha[R.c],sa[P]=F.x,sa[P+1]=F.y,sa[P+2]=F.z,sa[P+3]=F.w,sa[P+4]=y.x,sa[P+5]=y.y,sa[P+6]=y.z,sa[P+7]=y.w,sa[P+8]=T.x,sa[P+9]=T.y,sa[P+10]=T.z,sa[P+11]=T.w,F=Sa[R.a],y=Sa[R.b],T=Sa[R.c],ra[P]=F.x,ra[P+1]=F.y,ra[P+2]=F.z,ra[P+3]=F.w,ra[P+4]=y.x,ra[P+5]=y.y,ra[P+6]=y.z,ra[P+7]=y.w,ra[P+8]=T.x,ra[P+9]=T.y,ra[P+10]=T.z,ra[P+11]=T.w,F=Qa[R.a],y=Qa[R.b],T=Qa[R.c],$[P]=F.x,$[P+1]=F.y,$[P+2]=F.z,$[P+3]=1,$[P+4]=y.x,$[P+5]=y.y,$[P+6]=y.z,$[P+7]=1,$[P+8]=T.x,$[P+9]=T.y,$[P+10]=T.z,$[P+11]=1,
+F=Ra[R.a],y=Ra[R.b],T=Ra[R.c],aa[P]=F.x,aa[P+1]=F.y,aa[P+2]=F.z,aa[P+3]=1,aa[P+4]=y.x,aa[P+5]=y.y,aa[P+6]=y.z,aa[P+7]=1,aa[P+8]=T.x,aa[P+9]=T.y,aa[P+10]=T.z,aa[P+11]=1,P+=12;if(Da&&u)L.length==3&&u==THREE.VertexColors?(R=L[0],F=L[1],y=L[2]):y=F=R=O,ia[Z]=R.r,ia[Z+1]=R.g,ia[Z+2]=R.b,ia[Z+3]=F.r,ia[Z+4]=F.g,ia[Z+5]=F.b,ia[Z+6]=y.r,ia[Z+7]=y.g,ia[Z+8]=y.b,Z+=9;if(Ka&&xa.hasTangents)L=J[0],O=J[1],R=J[2],la[V]=L.x,la[V+1]=L.y,la[V+2]=L.z,la[V+3]=L.w,la[V+4]=O.x,la[V+5]=O.y,la[V+6]=O.z,la[V+7]=O.w,la[V+
+8]=R.x,la[V+9]=R.y,la[V+10]=R.z,la[V+11]=R.w,V+=12;if(Ja&&p)if(K.length==3&&va)for(J=0;J<3;J++)N=K[J],ka[da]=N.x,ka[da+1]=N.y,ka[da+2]=N.z,da+=3;else for(J=0;J<3;J++)ka[da]=N.x,ka[da+1]=N.y,ka[da+2]=N.z,da+=3;if(za&&w!==void 0&&v)for(J=0;J<3;J++)K=w[J],ea[qa]=K.u,ea[qa+1]=K.v,qa+=2;if(za&&C!==void 0&&v)for(J=0;J<3;J++)K=C[J],fa[ca]=K.u,fa[ca+1]=K.v,ca+=2;Ia&&(pa[ga]=S,pa[ga+1]=S+1,pa[ga+2]=S+2,ga+=3,ma[Y]=S,ma[Y+1]=S+1,ma[Y+2]=S,ma[Y+3]=S+2,ma[Y+4]=S+1,ma[Y+5]=S+2,Y+=6,S+=3)}else if(R instanceof THREE.Face4){if(ya)t=
+Pa[R.a].position,D=Pa[R.b].position,E=Pa[R.c].position,M=Pa[R.d].position,X[U]=t.x,X[U+1]=t.y,X[U+2]=t.z,X[U+3]=D.x,X[U+4]=D.y,X[U+5]=D.z,X[U+6]=E.x,X[U+7]=E.y,X[U+8]=E.z,X[U+9]=M.x,X[U+10]=M.y,X[U+11]=M.z,U+=12;if(ua)for(oa in ua)if(y=ua[oa],y.__original.needsUpdate)F=y.offset,T=y.offsetSrc,y.size===1?(y.boundTo===void 0||y.boundTo==="vertices"?(y.array[F]=y.value[R.a],y.array[F+1]=y.value[R.b],y.array[F+2]=y.value[R.c],y.array[F+3]=y.value[R.d]):y.boundTo==="faces"?(T=y.value[T],y.array[F]=T,y.array[F+
+1]=T,y.array[F+2]=T,y.array[F+3]=T,y.offsetSrc++):y.boundTo==="faceVertices"&&(y.array[F]=y.value[T],y.array[F+1]=y.value[T+1],y.array[F+2]=y.value[T+2],y.array[F+3]=y.value[T+3],y.offsetSrc+=4),y.offset+=4):(y.boundTo===void 0||y.boundTo==="vertices"?(t=y.value[R.a],D=y.value[R.b],E=y.value[R.c],M=y.value[R.d]):y.boundTo==="faces"?(M=E=D=t=T=y.value[T],y.offsetSrc++):y.boundTo==="faceVertices"&&(t=y.value[T],D=y.value[T+1],E=y.value[T+2],M=y.value[T+3],y.offsetSrc+=4),y.size===2?(y.array[F]=t.x,
+y.array[F+1]=t.y,y.array[F+2]=D.x,y.array[F+3]=D.y,y.array[F+4]=E.x,y.array[F+5]=E.y,y.array[F+6]=M.x,y.array[F+7]=M.y,y.offset+=8):y.size===3?(y.type==="c"?(y.array[F]=t.r,y.array[F+1]=t.g,y.array[F+2]=t.b,y.array[F+3]=D.r,y.array[F+4]=D.g,y.array[F+5]=D.b,y.array[F+6]=E.r,y.array[F+7]=E.g,y.array[F+8]=E.b,y.array[F+9]=M.r,y.array[F+10]=M.g,y.array[F+11]=M.b):(y.array[F]=t.x,y.array[F+1]=t.y,y.array[F+2]=t.z,y.array[F+3]=D.x,y.array[F+4]=D.y,y.array[F+5]=D.z,y.array[F+6]=E.x,y.array[F+7]=E.y,y.array[F+
+8]=E.z,y.array[F+9]=M.x,y.array[F+10]=M.y,y.array[F+11]=M.z),y.offset+=12):(y.array[F]=t.x,y.array[F+1]=t.y,y.array[F+2]=t.z,y.array[F+3]=t.w,y.array[F+4]=D.x,y.array[F+5]=D.y,y.array[F+6]=D.z,y.array[F+7]=D.w,y.array[F+8]=E.x,y.array[F+9]=E.y,y.array[F+10]=E.z,y.array[F+11]=E.w,y.array[F+12]=M.x,y.array[F+13]=M.y,y.array[F+14]=M.z,y.array[F+15]=M.w,y.offset+=16));if(Ea){F=0;for(y=Fa.length;F<y;F++)t=Fa[F].vertices[R.a].position,D=Fa[F].vertices[R.b].position,E=Fa[F].vertices[R.c].position,M=Fa[F].vertices[R.d].position,
+T=ta[F],T[W]=t.x,T[W+1]=t.y,T[W+2]=t.z,T[W+3]=D.x,T[W+4]=D.y,T[W+5]=D.z,T[W+6]=E.x,T[W+7]=E.y,T[W+8]=E.z,T[W+9]=M.x,T[W+10]=M.y,T[W+11]=M.z;W+=12}if(Ha.length)F=Ha[R.a],y=Ha[R.b],T=Ha[R.c],Q=Ha[R.d],sa[P]=F.x,sa[P+1]=F.y,sa[P+2]=F.z,sa[P+3]=F.w,sa[P+4]=y.x,sa[P+5]=y.y,sa[P+6]=y.z,sa[P+7]=y.w,sa[P+8]=T.x,sa[P+9]=T.y,sa[P+10]=T.z,sa[P+11]=T.w,sa[P+12]=Q.x,sa[P+13]=Q.y,sa[P+14]=Q.z,sa[P+15]=Q.w,F=Sa[R.a],y=Sa[R.b],T=Sa[R.c],Q=Sa[R.d],ra[P]=F.x,ra[P+1]=F.y,ra[P+2]=F.z,ra[P+3]=F.w,ra[P+4]=y.x,ra[P+5]=
+y.y,ra[P+6]=y.z,ra[P+7]=y.w,ra[P+8]=T.x,ra[P+9]=T.y,ra[P+10]=T.z,ra[P+11]=T.w,ra[P+12]=Q.x,ra[P+13]=Q.y,ra[P+14]=Q.z,ra[P+15]=Q.w,F=Qa[R.a],y=Qa[R.b],T=Qa[R.c],Q=Qa[R.d],$[P]=F.x,$[P+1]=F.y,$[P+2]=F.z,$[P+3]=1,$[P+4]=y.x,$[P+5]=y.y,$[P+6]=y.z,$[P+7]=1,$[P+8]=T.x,$[P+9]=T.y,$[P+10]=T.z,$[P+11]=1,$[P+12]=Q.x,$[P+13]=Q.y,$[P+14]=Q.z,$[P+15]=1,F=Ra[R.a],y=Ra[R.b],T=Ra[R.c],R=Ra[R.d],aa[P]=F.x,aa[P+1]=F.y,aa[P+2]=F.z,aa[P+3]=1,aa[P+4]=y.x,aa[P+5]=y.y,aa[P+6]=y.z,aa[P+7]=1,aa[P+8]=T.x,aa[P+9]=T.y,aa[P+
+10]=T.z,aa[P+11]=1,aa[P+12]=R.x,aa[P+13]=R.y,aa[P+14]=R.z,aa[P+15]=1,P+=16;if(Da&&u)L.length==4&&u==THREE.VertexColors?(R=L[0],F=L[1],y=L[2],L=L[3]):L=y=F=R=O,ia[Z]=R.r,ia[Z+1]=R.g,ia[Z+2]=R.b,ia[Z+3]=F.r,ia[Z+4]=F.g,ia[Z+5]=F.b,ia[Z+6]=y.r,ia[Z+7]=y.g,ia[Z+8]=y.b,ia[Z+9]=L.r,ia[Z+10]=L.g,ia[Z+11]=L.b,Z+=12;if(Ka&&xa.hasTangents)L=J[0],O=J[1],R=J[2],J=J[3],la[V]=L.x,la[V+1]=L.y,la[V+2]=L.z,la[V+3]=L.w,la[V+4]=O.x,la[V+5]=O.y,la[V+6]=O.z,la[V+7]=O.w,la[V+8]=R.x,la[V+9]=R.y,la[V+10]=R.z,la[V+11]=R.w,
+la[V+12]=J.x,la[V+13]=J.y,la[V+14]=J.z,la[V+15]=J.w,V+=16;if(Ja&&p)if(K.length==4&&va)for(J=0;J<4;J++)N=K[J],ka[da]=N.x,ka[da+1]=N.y,ka[da+2]=N.z,da+=3;else for(J=0;J<4;J++)ka[da]=N.x,ka[da+1]=N.y,ka[da+2]=N.z,da+=3;if(za&&w!==void 0&&v)for(J=0;J<4;J++)K=w[J],ea[qa]=K.u,ea[qa+1]=K.v,qa+=2;if(za&&C!==void 0&&v)for(J=0;J<4;J++)K=C[J],fa[ca]=K.u,fa[ca+1]=K.v,ca+=2;Ia&&(pa[ga]=S,pa[ga+1]=S+1,pa[ga+2]=S+3,pa[ga+3]=S+1,pa[ga+4]=S+2,pa[ga+5]=S+3,ga+=6,ma[Y]=S,ma[Y+1]=S+1,ma[Y+2]=S,ma[Y+3]=S+3,ma[Y+4]=S+
+1,ma[Y+5]=S+2,ma[Y+6]=S+2,ma[Y+7]=S+3,Y+=8,S+=4)}ya&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,X,o));if(ua)for(oa in ua)y=ua[oa],y.__original.needsUpdate&&(n.bindBuffer(n.ARRAY_BUFFER,y.buffer),n.bufferData(n.ARRAY_BUFFER,y.array,o));if(Ea){F=0;for(y=Fa.length;F<y;F++)n.bindBuffer(n.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[F]),n.bufferData(n.ARRAY_BUFFER,ta[F],o)}Da&&Z>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,ia,o));Ja&&
+(n.bindBuffer(n.ARRAY_BUFFER,m.__webglNormalBuffer),n.bufferData(n.ARRAY_BUFFER,ka,o));Ka&&xa.hasTangents&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglTangentBuffer),n.bufferData(n.ARRAY_BUFFER,la,o));za&&qa>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglUVBuffer),n.bufferData(n.ARRAY_BUFFER,ea,o));za&&ca>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglUV2Buffer),n.bufferData(n.ARRAY_BUFFER,fa,o));Ia&&(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,pa,o),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,
+m.__webglLineBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,ma,o));P>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinVertexABuffer),n.bufferData(n.ARRAY_BUFFER,$,o),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),n.bufferData(n.ARRAY_BUFFER,aa,o),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),n.bufferData(n.ARRAY_BUFFER,ra,o),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),n.bufferData(n.ARRAY_BUFFER,sa,o));ja&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,
+delete m.__tangentArray,delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;I(k)}else if(g instanceof THREE.Ribbon){h=g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=n.DYNAMIC_DRAW;k=B=x=x=
 void 0;v=g.vertices;m=g.colors;u=v.length;o=m.length;p=g.__vertexArray;ja=g.__colorArray;w=g.__dirtyColors;if(g.__dirtyVertices){for(x=0;x<u;x++)B=v[x].position,k=x*3,p[k]=B.x,p[k+1]=B.y,p[k+2]=B.z;n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,p,j)}if(w){for(x=0;x<o;x++)color=m[x],k=x*3,ja[k]=color.r,ja[k+1]=color.g,ja[k+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,g.__webglColorBuffer);n.bufferData(n.ARRAY_BUFFER,ja,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof
 THREE.Line){h=g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=n.DYNAMIC_DRAW;k=B=x=x=void 0;v=g.vertices;m=g.colors;u=v.length;o=m.length;p=g.__vertexArray;ja=g.__colorArray;w=g.__dirtyColors;if(g.__dirtyVertices){for(x=0;x<u;x++)B=v[x].position,k=x*3,p[k]=B.x,p[k+1]=B.y,p[k+2]=B.z;n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,p,j)}if(w){for(x=0;x<o;x++)color=m[x],k=x*3,ja[k]=color.r,ja[k+1]=color.g,ja[k+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,g.__webglColorBuffer);
-n.bufferData(n.ARRAY_BUFFER,ja,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof THREE.ParticleSystem)h=g.geometry,m=A(h),(h.__dirtyVertices||h.__dirtyColors||g.sortParticles||m)&&c(h,n.DYNAMIC_DRAW,g),h.__dirtyVertices=!1,h.__dirtyColors=!1,H(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?n.frontFace(n.CCW):n.frontFace(n.CW),b=="back"?n.cullFace(n.BACK):b=="front"?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK),n.enable(n.CULL_FACE)):n.disable(n.CULL_FACE)};this.supportsVertexTextures=
+n.bufferData(n.ARRAY_BUFFER,ja,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof THREE.ParticleSystem)h=g.geometry,m=A(h),(h.__dirtyVertices||h.__dirtyColors||g.sortParticles||m)&&c(h,n.DYNAMIC_DRAW,g),h.__dirtyVertices=!1,h.__dirtyColors=!1,I(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?n.frontFace(n.CCW):n.frontFace(n.CW),b=="back"?n.cullFace(n.BACK):b=="front"?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK),n.enable(n.CULL_FACE)):n.disable(n.CULL_FACE)};this.supportsVertexTextures=
 function(){return Da}};
 THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
@@ -365,7 +365,7 @@ this.getPrevKeyWith("pos",t,h.index-1).pos,this.points[1]=g,this.points[2]=j,thi
 THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,j,h,k,o,m;g=(b.length-1)*c;j=Math.floor(g);g-=j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>b.length-2?j:j+1;e[3]=j>b.length-3?j:j+2;j=b[e[0]];k=b[e[1]];o=b[e[2]];m=b[e[3]];e=g*g;h=g*e;f[0]=this.interpolate(j[0],k[0],o[0],m[0],g,e,h);f[1]=this.interpolate(j[1],k[1],o[1],m[1],g,e,h);f[2]=this.interpolate(j[2],k[2],o[2],m[2],g,e,h);return f};
 THREE.Animation.prototype.interpolate=function(b,c,e,f,g,j,h){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*h+(-3*(c-e)-2*b-f)*j+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
-THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
+THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
 b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
 void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this.verticalMin=b.verticalMin;if(b.verticalMax!==void 0)this.verticalMax=b.verticalMax;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();
 b.stopPropagation();if(this.activeLook)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.activeLook)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=
@@ -375,9 +375,9 @@ this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown
 1;this.constrainVertical&&(b=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*
 Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
 THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
-THREE.PathCamera=function(b){function c(b,c,e,f){var g={name:e,fps:0.6,length:f,hierarchy:[]},h,j=c.getControlPointsArray(),k=c.getLength(),o=j.length,H=0;h=o-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:f,pos:j[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<o-1;h++)H=f*k.chunks[h]/k.total,c.keys[h]={time:H,pos:j[h]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,c){var e,
+THREE.PathCamera=function(b){function c(b,c,e,f){var g={name:e,fps:0.6,length:f,hierarchy:[]},h,j=c.getControlPointsArray(),k=c.getLength(),o=j.length,I=0;h=o-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:f,pos:j[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<o-1;h++)I=f*k.chunks[h]/k.total,c.keys[h]={time:I,pos:j[h]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,c){var e,
 f,g=new THREE.Geometry;for(e=0;e<b.points.length*c;e++)f=e/(b.points.length*c),f=b.getPoint(f),g.vertices[e]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return g}function f(b,c){var f=e(c,10),g=e(c,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,h);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);g=new THREE.SphereGeometry(1,
-16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(g,h),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.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.lookHorizontal=
+16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(g,h),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.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.lookHorizontal=
 this.lookVertical=!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(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
 void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.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,j=Math.PI/180;this.update=function(b,c,e){var f,h;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)*j;this.theta=this.lon*j;f=this.phi%g;this.phi=f>=0?f:f+g;f=this.verticalAngleMap.srcRange;h=this.verticalAngleMap.dstRange;var k=h[1]-h[0];this.phi=
@@ -385,7 +385,7 @@ TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h
 b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),h=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.CubeGeometry(10,10,20),o=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(o,h);b.position.set(0,10,0);this.animation=
 c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,c){return function(){c.apply(b,arguments)}}(this,this.onMouseMove),
 !1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
+THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
 b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
 this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
@@ -456,26 +456,26 @@ allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles
 0},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)}};
 THREE.TextPath=function(b,c){THREE.Path.call(this);this.parameters=c||{};this.set(b)};THREE.TextPath.prototype.set=function(b,c){this.text=b;var c=c||this.parameters,e=c.curveSegments!==void 0?c.curveSegments:4,f=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",j=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=e;THREE.FontUtils.face=f;THREE.FontUtils.weight=g;THREE.FontUtils.style=j};
 THREE.TextPath.prototype.toShapes=function(){for(var b=THREE.FontUtils.drawText(this.text).paths,c=[],e=0,f=b.length;e<f;e++)c=c.concat(b[e].toShapes());return c};
-THREE.CubeGeometry=function(b,c,e,f,g,j,h,k,o){function m(b,c,e,h,k,m,o,t){var u,v,w=f||1,x=g||1,R=k/2,C=m/2,n=p.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",x=j||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",w=j||1;var W=w+1,V=x+1;k/=w;var fa=m/x;for(v=0;v<V;v++)for(m=0;m<W;m++){var L=new THREE.Vector3;L[b]=(m*k-R)*e;L[c]=(v*fa-C)*h;L[u]=o;p.vertices.push(new THREE.Vertex(L))}for(v=0;v<x;v++)for(m=0;m<w;m++)p.faces.push(new THREE.Face4(m+W*
-v+n,m+W*(v+1)+n,m+1+W*(v+1)+n,m+1+W*v+n,null,null,t)),p.faceVertexUvs[0].push([new THREE.UV(m/w,v/x),new THREE.UV(m/w,(v+1)/x),new THREE.UV((m+1)/w,(v+1)/x),new THREE.UV((m+1)/w,v/x)])}THREE.Geometry.call(this);var p=this,u=b/2,v=c/2,t=e/2,k=k?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(o!=void 0)for(var x in o)this.sides[x]!=void 0&&(this.sides[x]=
+THREE.CubeGeometry=function(b,c,e,f,g,j,h,k,o){function m(b,c,e,h,k,m,o,t){var u,v,w=f||1,x=g||1,M=k/2,L=m/2,n=p.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",x=j||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",w=j||1;var S=w+1,V=x+1;k/=w;var X=m/x;for(v=0;v<V;v++)for(m=0;m<S;m++){var Q=new THREE.Vector3;Q[b]=(m*k-M)*e;Q[c]=(v*X-L)*h;Q[u]=o;p.vertices.push(new THREE.Vertex(Q))}for(v=0;v<x;v++)for(m=0;m<w;m++)p.faces.push(new THREE.Face4(m+S*v+
+n,m+S*(v+1)+n,m+1+S*(v+1)+n,m+1+S*v+n,null,null,t)),p.faceVertexUvs[0].push([new THREE.UV(m/w,v/x),new THREE.UV(m/w,(v+1)/x),new THREE.UV((m+1)/w,(v+1)/x),new THREE.UV((m+1)/w,v/x)])}THREE.Geometry.call(this);var p=this,u=b/2,v=c/2,t=e/2,k=k?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(o!=void 0)for(var x in o)this.sides[x]!=void 0&&(this.sides[x]=
 o[x]);this.sides.px&&m("z","y",1*k,-1,e,c,-u,this.materials[0]);this.sides.nx&&m("z","y",-1*k,-1,e,c,u,this.materials[1]);this.sides.py&&m("x","z",1*k,1,b,e,v,this.materials[2]);this.sides.ny&&m("x","z",1*k,-1,b,e,-v,this.materials[3]);this.sides.pz&&m("x","y",1*k,-1,b,c,t,this.materials[4]);this.sides.nz&&m("x","y",-1*k,-1,b,c,-t,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=p.vertices.length;e<f;e++){for(var g=p.vertices[e],h=!1,j=0,k=b.length;j<k;j++){var m=b[j];if(g.position.x==m.position.x&&
 g.position.y==m.position.y&&g.position.z==m.position.z){c[e]=j;h=!0;break}}if(!h)c[e]=b.length,b.push(new THREE.Vertex(g.position.clone()))}e=0;for(f=p.faces.length;e<f;e++)g=p.faces[e],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];p.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CylinderGeometry=function(b,c,e,f,g,j){function h(b,c,e){k.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var k=this,o,m=Math.PI*2,p=f/2;for(o=0;o<b;o++)h(Math.sin(m*o/b)*c,Math.cos(m*o/b)*c,-p);for(o=0;o<b;o++)h(Math.sin(m*o/b)*e,Math.cos(m*o/b)*e,p);for(o=0;o<b;o++)k.faces.push(new THREE.Face4(o,o+b,b+(o+1)%b,(o+1)%b));if(e>0){h(0,0,-p-(j||0));for(o=b;o<b+b/2;o++)k.faces.push(new THREE.Face4(2*b,(2*o-2*b)%b,(2*o-2*b+1)%b,(2*o-2*b+2)%b))}if(c>0){h(0,0,p+
 (g||0));for(o=b+b/2;o<2*b;o++)k.faces.push(new THREE.Face4(2*b+1,(2*o-2*b+2)%b+b,(2*o-2*b+1)%b+b,(2*o-2*b)%b+b))}o=0;for(b=this.faces.length;o<b;o++){var c=[],e=this.faces[o],g=this.vertices[e.a],j=this.vertices[e.b],p=this.vertices[e.c],u=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/m,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(j.position.x,j.position.y)/m,0.5+j.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/m,0.5+p.position.z/
-f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(u.position.x,u.position.y)/m,0.5+u.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,g;for(e=0;e<f;e++)g=b[e],this.addShape(g,c)}};
-THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
+f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(u.position.x,u.position.y)/m,0.5+u.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,g;this.shapebb=b[f-1].getBoundingBox();for(e=0;e<f;e++)g=b[e],this.addShape(g,c)}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,g=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,j=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);g.set(b.x-e.x,b.y-e.y);f=f.normalize();g=g.normalize();h.set(-f.y,f.x);j.set(g.y,-g.x);k.copy(b).addSelf(h);m.copy(b).addSelf(j);if(k.equals(m))return j.clone();
-k.copy(c).addSelf(h);m.copy(e).addSelf(j);h=f.dot(j);j=m.subSelf(k).dot(j);h==0&&(console.log("Either infinite or no solutions!"),j==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));j/=h;if(j<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(j).addSelf(k).subSelf(b).clone()}function g(b){for(D=b.length;--D>=0;){T=D;U=D-1;U<0&&(U=b.length-
-1);for(var c=0,c=0;c<t+p*2;c++){var e=n*c,f=n*(c+1),g=da+T+e,e=da+U+e,h=da+U+f,f=da+T+f;g+=K;e+=K;h+=K;f+=K;E.faces.push(new THREE.Face4(g,e,h,f))}}}function j(b,c,e){E.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function h(b,c,e){b+=K;c+=K;e+=K;E.faces.push(new THREE.Face3(b,c,e))}var k=c.amount!==void 0?c.amount:100,o=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:o-2,p=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,v=c.curveSegments!==void 0?c.curveSegments:12,t=c.steps!==void 0?c.steps:1,w=c.bendPath,x=c.extrudePath,B,A=!1,H=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1;if(x)B=x.getPoints(v),t=B.length,A=!0,u=!1;u||(m=o=p=0);var y,G,I,E=this,K=this.vertices.length;w&&b.addWrapPath(w);v=H?b.extractAllSpacedPoints(v):b.extractAllPoints(v);w=v.shape;v=v.holes;if(x=!THREE.Shape.Utils.isClockWise(w)){w=w.reverse();G=0;for(I=v.length;G<I;G++)y=v[G],THREE.Shape.Utils.isClockWise(y)&&(v[G]=y.reverse());x=!1}x=
-THREE.Shape.Utils.triangulateShape(w,v);H=w;G=0;for(I=v.length;G<I;G++)y=v[G],w=w.concat(y);var D,J,S,X,R,C,n=w.length,W=x.length,V=[];D=0;J=H.length;T=J-1;for(U=D+1;D<J;D++,T++,U++)T==J&&(T=0),U==J&&(U=0),V[D]=f(H[D],H[T],H[U]);var fa=[],L,ea=V.concat();G=0;for(I=v.length;G<I;G++){y=v[G];L=[];D=0;J=y.length;T=J-1;for(U=D+1;D<J;D++,T++,U++)T==J&&(T=0),U==J&&(U=0),L[D]=f(y[D],y[T],y[U]);fa.push(L);ea=ea.concat(L)}for(S=0;S<p;S++){X=S/p;R=o*(1-X);X=m*Math.sin(X*Math.PI/2);D=0;for(J=H.length;D<J;D++)C=
-e(H[D],V[D],X),j(C.x,C.y,-R);G=0;for(I=v.length;G<I;G++){y=v[G];L=fa[G];D=0;for(J=y.length;D<J;D++)C=e(y[D],L[D],X),j(C.x,C.y,-R)}}X=m;for(D=0;D<n;D++)C=u?e(w[D],ea[D],X):w[D],A?j(C.x,C.y+B[0].y,B[0].x):j(C.x,C.y,0);for(S=1;S<=t;S++)for(D=0;D<n;D++)C=u?e(w[D],ea[D],X):w[D],A?j(C.x,C.y+B[S-1].y,B[S-1].x):j(C.x,C.y,k/t*S);for(S=p-1;S>=0;S--){X=S/p;R=o*(1-X);X=m*Math.sin(X*Math.PI/2);D=0;for(J=H.length;D<J;D++)C=e(H[D],V[D],X),j(C.x,C.y,k+R);G=0;for(I=v.length;G<I;G++){y=v[G];L=fa[G];D=0;for(J=y.length;D<
-J;D++)C=e(y[D],L[D],X),A?j(C.x,C.y+B[t-1].y,B[t-1].x+R):j(C.x,C.y,k+R)}}if(u){o=n*0;for(D=0;D<W;D++)k=x[D],h(k[2]+o,k[1]+o,k[0]+o);o=n*(t+p*2);for(D=0;D<W;D++)k=x[D],h(k[0]+o,k[1]+o,k[2]+o)}else{for(D=0;D<W;D++)k=x[D],h(k[2],k[1],k[0]);for(D=0;D<W;D++)k=x[D],h(k[0]+n*t,k[1]+n*t,k[2]+n*t)}var T,U,da=0;g(H);da+=H.length;G=0;for(I=v.length;G<I;G++)y=v[G],g(y),da+=y.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
-THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
+k.copy(c).addSelf(h);m.copy(e).addSelf(j);h=f.dot(j);j=m.subSelf(k).dot(j);h==0&&(console.log("Either infinite or no solutions!"),j==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));j/=h;if(j<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(j).addSelf(k).subSelf(b).clone()}function g(b){for(E=b.length;--E>=0;){Y=E;ea=E-1;ea<0&&(ea=b.length-
+1);for(var c=0,c=0;c<t+p*2;c++){var e=V*c,f=V*(c+1),g=$+Y+e,e=$+ea+e,h=$+ea+f,f=$+Y+f;g+=D;e+=D;h+=D;f+=D;N.faces.push(new THREE.Face4(g,e,h,f))}}}function j(b,c,e){N.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function h(b,c,e){b+=D;c+=D;e+=D;N.faces.push(new THREE.Face3(b,c,e,null,null,z));N.faceVertexUvs[0].push([new THREE.UV(N.vertices[b].x/H.maxX,N.vertices[b].y/H.maxY),new THREE.UV(N.vertices[c].x/H.maxX,N.vertices[c].y/H.maxY),new THREE.UV(N.vertices[e].x/H.maxX,N.vertices[e].y/
+H.maxY)])}var k=c.amount!==void 0?c.amount:100,o=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:o-2,p=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:!0,v=c.curveSegments!==void 0?c.curveSegments:12,t=c.steps!==void 0?c.steps:1,w=c.bendPath,x=c.extrudePath,B,A=!1,I=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,z=c.material,H=this.shapebb;console.log(H);if(x)B=x.getPoints(v),t=B.length,A=!0,u=!1;u||(m=o=p=0);var G,C,O,N=this,D=
+this.vertices.length;w&&b.addWrapPath(w);v=I?b.extractAllSpacedPoints(v):b.extractAllPoints(v);w=v.shape;v=v.holes;if(x=!THREE.Shape.Utils.isClockWise(w)){w=w.reverse();C=0;for(O=v.length;C<O;C++)G=v[C],THREE.Shape.Utils.isClockWise(G)&&(v[C]=G.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(w,v);I=w;C=0;for(O=v.length;C<O;C++)G=v[C],w=w.concat(G);var E,U,M,L,n,S,V=w.length,X=x.length,Q=[];E=0;U=I.length;Y=U-1;for(ea=E+1;E<U;E++,Y++,ea++)Y==U&&(Y=0),ea==U&&(ea=0),Q[E]=f(I[E],I[Y],I[ea]);var fa=
+[],W,ca=Q.concat();C=0;for(O=v.length;C<O;C++){G=v[C];W=[];E=0;U=G.length;Y=U-1;for(ea=E+1;E<U;E++,Y++,ea++)Y==U&&(Y=0),ea==U&&(ea=0),W[E]=f(G[E],G[Y],G[ea]);fa.push(W);ca=ca.concat(W)}for(M=0;M<p;M++){L=M/p;n=o*(1-L);L=m*Math.sin(L*Math.PI/2);E=0;for(U=I.length;E<U;E++)S=e(I[E],Q[E],L),j(S.x,S.y,-n);C=0;for(O=v.length;C<O;C++){G=v[C];W=fa[C];E=0;for(U=G.length;E<U;E++)S=e(G[E],W[E],L),j(S.x,S.y,-n)}}L=m;for(E=0;E<V;E++)S=u?e(w[E],ca[E],L):w[E],A?j(S.x,S.y+B[0].y,B[0].x):j(S.x,S.y,0);for(M=1;M<=t;M++)for(E=
+0;E<V;E++)S=u?e(w[E],ca[E],L):w[E],A?j(S.x,S.y+B[M-1].y,B[M-1].x):j(S.x,S.y,k/t*M);for(M=p-1;M>=0;M--){L=M/p;n=o*(1-L);L=m*Math.sin(L*Math.PI/2);E=0;for(U=I.length;E<U;E++)S=e(I[E],Q[E],L),j(S.x,S.y,k+n);C=0;for(O=v.length;C<O;C++){G=v[C];W=fa[C];E=0;for(U=G.length;E<U;E++)S=e(G[E],W[E],L),A?j(S.x,S.y+B[t-1].y,B[t-1].x+n):j(S.x,S.y,k+n)}}if(u){o=V*0;for(E=0;E<X;E++)k=x[E],h(k[2]+o,k[1]+o,k[0]+o);o=V*(t+p*2);for(E=0;E<X;E++)k=x[E],h(k[0]+o,k[1]+o,k[2]+o)}else{for(E=0;E<X;E++)k=x[E],h(k[2],k[1],k[0]);
+for(E=0;E<X;E++)k=x[E],h(k[0]+V*t,k[1]+V*t,k[2]+V*t)}var Y,ea,$=0;g(I);$+=I.length;C=0;for(O=v.length;C<O;C++)G=v[C],g(G),$+=G.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=g.vertices[b].position,h=g.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var g=this,j=new THREE.Geometry;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
 -b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,j);e(0,5,1,j);e(0,1,7,j);e(0,7,10,j);e(0,10,11,j);e(1,5,9,j);e(5,11,4,j);e(11,10,2,j);e(10,7,6,j);e(7,1,8,j);e(3,9,4,j);e(3,4,2,j);e(3,2,6,j);e(3,6,8,j);e(3,8,9,j);e(4,9,5,j);e(2,4,11,j);e(6,2,10,j);e(8,6,7,j);e(9,8,1,j);for(var h=0;h<this.subdivisions;h++){var b=new THREE.Geometry,k;for(k in j.faces){var o=f(j.faces[k].a,j.faces[k].b),m=f(j.faces[k].b,j.faces[k].c),p=f(j.faces[k].c,j.faces[k].a);e(j.faces[k].a,o,p,b);e(j.faces[k].b,m,
 o,b);e(j.faces[k].c,p,m,b);e(o,m,p,b)}j.faces=b.faces}g.faces=j.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],g=[],j=[],h=(new THREE.Matrix4).setRotationZ(c),k=0;k<b.length;k++)this.vertices.push(new THREE.Vertex(b[k])),e[k]=b[k].clone(),f[k]=this.vertices.length-1;for(var o=0;o<=this.angle+0.001;o+=c){for(k=0;k<e.length;k++)o<this.angle?(e[k]=h.multiplyVector3(e[k].clone()),this.vertices.push(new THREE.Vertex(e[k])),g[k]=this.vertices.length-1):g=j;o==0&&(j=f);
+THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],g=[],j=[],h=(new THREE.Matrix4).setRotationZ(c),k=0;k<b.length;k++)this.vertices.push(new THREE.Vertex(b[k])),e[k]=b[k].clone(),f[k]=this.vertices.length-1;for(var o=0;o<=this.angle+0.0010;o+=c){for(k=0;k<e.length;k++)o<this.angle?(e[k]=h.multiplyVector3(e[k].clone()),this.vertices.push(new THREE.Vertex(e[k])),g[k]=this.vertices.length-1):g=j;o==0&&(j=f);
 for(k=0;k<f.length-1;k++)this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k])),this.faceVertexUvs[0].push([new THREE.UV(1-o/this.angle,k/b.length),new THREE.UV(1-o/this.angle,(k+1)/b.length),new THREE.UV(1-(o-c)/this.angle,(k+1)/b.length),new THREE.UV(1-(o-c)/this.angle,k/b.length)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var g,j=b/2,h=c/2,e=e||1,f=f||1,k=e+1,o=f+1;b/=e;var m=c/f;for(g=0;g<o;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-j,-(g*m-h),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
@@ -487,10 +487,10 @@ THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.am
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c=
 this.getFace(),e=this.size/c.resolution,f=0,g=String(b).split(""),j=g.length,h=[],b=0;b<j;b++){var k=new THREE.Path,k=this.extractGlyphPoints(g[b],c,e,f,k);f+=k.offset;h.push(k.path)}return{paths:h,offset:f/2}},extractGlyphPoints:function(b,c,e,f,g){var j=[],h,k,o,m,p,u,v,t,w,x,B=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(B){if(B.o){c=B._cachedOutline||(B._cachedOutline=B.o.split(" "));o=c.length;for(b=0;b<o;)switch(k=c[b++],k){case "m":k=c[b++]*e+f;m=c[b++]*e;j.push(new THREE.Vector2(k,
-m));g.moveTo(k,m);break;case "l":k=c[b++]*e+f;m=c[b++]*e;j.push(new THREE.Vector2(k,m));g.lineTo(k,m);break;case "q":k=c[b++]*e+f;m=c[b++]*e;v=c[b++]*e+f;t=c[b++]*e;g.quadraticCurveTo(v,t,k,m);if(h=j[j.length-1]){p=h.x;u=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var A=h/divisions,H=THREE.Shape.Utils.b2(A,p,v,k),A=THREE.Shape.Utils.b2(A,u,t,m);j.push(new THREE.Vector2(H,A))}}break;case "b":if(k=c[b++]*e+f,m=c[b++]*e,v=c[b++]*e+f,t=c[b++]*-e,w=c[b++]*e+f,x=c[b++]*-e,g.bezierCurveTo(k,m,
-v,t,w,x),h=j[j.length-1]){p=h.x;u=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)A=h/divisions,H=THREE.Shape.Utils.b3(A,p,v,w,k),A=THREE.Shape.Utils.b3(A,u,t,x,m),j.push(new THREE.Vector2(H,A))}}}return{offset:B.ha*e,points:j,path:g}}}};
-(function(b){var c=function(b){for(var c=b.length,g=0,j=c-1,h=0;h<c;j=h++)g+=b[j].x*b[h].y-b[h].x*b[j].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var j=[],h=[],k=[],o,m,p;if(c(b)>0)for(m=0;m<g;m++)h[m]=m;else for(m=0;m<g;m++)h[m]=g-1-m;var u=2*g;for(m=g-1;g>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return k;return j}o=m;g<=o&&(o=0);m=o+1;g<=m&&(m=0);p=m+1;g<=p&&(p=0);var v;a:{v=b;var t=o,w=m,x=p,B=g,A=h,H=void 0,y=void 0,G=void 0,
-I=void 0,E=void 0,K=void 0,D=void 0,J=void 0,S=void 0,y=v[A[t]].x,G=v[A[t]].y,I=v[A[w]].x,E=v[A[w]].y,K=v[A[x]].x,D=v[A[x]].y;if(1.0E-10>(I-y)*(D-G)-(E-G)*(K-y))v=!1;else{for(H=0;H<B;H++)if(!(H==t||H==w||H==x)){var J=v[A[H]].x,S=v[A[H]].y,X=void 0,R=void 0,C=void 0,n=void 0,W=void 0,V=void 0,fa=void 0,L=void 0,ea=void 0,T=void 0,U=void 0,da=void 0,X=C=W=void 0,X=K-I,R=D-E,C=y-K,n=G-D,W=I-y,V=E-G,fa=J-y,L=S-G,ea=J-I,T=S-E,U=J-K,da=S-D,X=X*T-R*ea,W=W*L-V*fa,C=C*da-n*U;if(X>=0&&C>=0&&W>=0){v=!1;break a}}v=
+m));g.moveTo(k,m);break;case "l":k=c[b++]*e+f;m=c[b++]*e;j.push(new THREE.Vector2(k,m));g.lineTo(k,m);break;case "q":k=c[b++]*e+f;m=c[b++]*e;v=c[b++]*e+f;t=c[b++]*e;g.quadraticCurveTo(v,t,k,m);if(h=j[j.length-1]){p=h.x;u=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var A=h/divisions,I=THREE.Shape.Utils.b2(A,p,v,k),A=THREE.Shape.Utils.b2(A,u,t,m);j.push(new THREE.Vector2(I,A))}}break;case "b":if(k=c[b++]*e+f,m=c[b++]*e,v=c[b++]*e+f,t=c[b++]*-e,w=c[b++]*e+f,x=c[b++]*-e,g.bezierCurveTo(k,m,
+v,t,w,x),h=j[j.length-1]){p=h.x;u=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)A=h/divisions,I=THREE.Shape.Utils.b3(A,p,v,w,k),A=THREE.Shape.Utils.b3(A,u,t,x,m),j.push(new THREE.Vector2(I,A))}}}return{offset:B.ha*e,points:j,path:g}}}};
+(function(b){var c=function(b){for(var c=b.length,g=0,j=c-1,h=0;h<c;j=h++)g+=b[j].x*b[h].y-b[h].x*b[j].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var j=[],h=[],k=[],o,m,p;if(c(b)>0)for(m=0;m<g;m++)h[m]=m;else for(m=0;m<g;m++)h[m]=g-1-m;var u=2*g;for(m=g-1;g>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return k;return j}o=m;g<=o&&(o=0);m=o+1;g<=m&&(m=0);p=m+1;g<=p&&(p=0);var v;a:{v=b;var t=o,w=m,x=p,B=g,A=h,I=void 0,z=void 0,H=void 0,
+G=void 0,C=void 0,O=void 0,N=void 0,D=void 0,E=void 0,z=v[A[t]].x,H=v[A[t]].y,G=v[A[w]].x,C=v[A[w]].y,O=v[A[x]].x,N=v[A[x]].y;if(1.0E-10>(G-z)*(N-H)-(C-H)*(O-z))v=!1;else{for(I=0;I<B;I++)if(!(I==t||I==w||I==x)){var D=v[A[I]].x,E=v[A[I]].y,U=void 0,M=void 0,L=void 0,n=void 0,S=void 0,V=void 0,X=void 0,Q=void 0,fa=void 0,W=void 0,ca=void 0,Y=void 0,U=L=S=void 0,U=O-G,M=N-C,L=z-O,n=H-N,S=G-z,V=C-H,X=D-z,Q=E-H,fa=D-G,W=E-C,ca=D-O,Y=E-N,U=U*W-M*fa,S=S*Q-V*X,L=L*Y-n*ca;if(U>=0&&L>=0&&S>=0){v=!1;break a}}v=
 !0}}if(v){j.push([b[h[o]],b[h[m]],b[h[p]]]);k.push([h[o],h[m],h[p]]);o=m;for(p=m+1;p<g;o++,p++)h[o]=h[p];g--;u=2*g}}if(f)return k;return j};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
 1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,j=(this.segmentsT+1)*(c-1)+e-1,h=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,j,h));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[j][0],b[j][1]),new THREE.UV(b[h][0],b[h][1])])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
@@ -508,59 +508,59 @@ else if(b.DbgColor)h.color=b.DbgColor;if(b.colorSpecular)h.specular=j(b.colorSpe
 b.mapSpecular&&c&&g(h,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var m=THREE.ShaderUtils.lib.normal,p=THREE.UniformsUtils.clone(m.uniforms),u=h.color;k=h.specular;o=h.ambient;var v=h.shininess;p.tNormal.texture=h.normalMap;if(b.mapNormalFactor)p.uNormalScale.value=b.mapNormalFactor;if(h.map)p.tDiffuse.texture=h.map,p.enableDiffuse.value=!0;if(h.specularMap)p.tSpecular.texture=h.specularMap,p.enableSpecular.value=!0;if(h.lightMap)p.tAO.texture=
 h.lightMap,p.enableAO.value=!0;p.uDiffuseColor.value.setHex(u);p.uSpecularColor.value.setHex(k);p.uAmbientColor.value.setHex(o);p.uShininess.value=v;if(h.opacity)p.uOpacity.value=h.opacity;h=new THREE.MeshShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:p,lights:!0,fog:!0})}else h=new THREE[k](h);return h},constructor:THREE.Loader};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
 THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,g,o,m,p,u,v,t,w,x,B,A,H,y,G=b.faces;u=b.vertices;var I=b.normals,E=b.colors,K=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&K++;for(e=0;e<K;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];m=0;for(p=u.length;m<p;)v=new THREE.Vertex,v.position.x=u[m++]*c,v.position.y=
-u[m++]*c,v.position.z=u[m++]*c,f.vertices.push(v);m=0;for(p=G.length;m<p;){c=G[m++];u=c&1;o=c&2;e=c&4;g=c&8;t=c&16;v=c&32;x=c&64;c&=128;u?(B=new THREE.Face4,B.a=G[m++],B.b=G[m++],B.c=G[m++],B.d=G[m++],u=4):(B=new THREE.Face3,B.a=G[m++],B.b=G[m++],B.c=G[m++],u=3);if(o)o=G[m++],B.materials=f.materials[o];o=f.faces.length;if(e)for(e=0;e<K;e++)A=b.uvs[e],w=G[m++],y=A[w*2],w=A[w*2+1],f.faceUvs[e][o]=new THREE.UV(y,w);if(g)for(e=0;e<K;e++){A=b.uvs[e];H=[];for(g=0;g<u;g++)w=G[m++],y=A[w*2],w=A[w*2+1],H[g]=
-new THREE.UV(y,w);f.faceVertexUvs[e][o]=H}if(t)t=G[m++]*3,g=new THREE.Vector3,g.x=I[t++],g.y=I[t++],g.z=I[t],B.normal=g;if(v)for(e=0;e<u;e++)t=G[m++]*3,g=new THREE.Vector3,g.x=I[t++],g.y=I[t++],g.z=I[t],B.vertexNormals.push(g);if(x)v=G[m++],v=new THREE.Color(E[v]),B.color=v;if(c)for(e=0;e<u;e++)v=G[m++],v=new THREE.Color(E[v]),B.vertexColors.push(v);f.faces.push(B)}}})(g);(function(){var c,e,g,o;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],o=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,g,o,m,p,u,v,t,w,x,B,A,I,z,H=b.faces;u=b.vertices;var G=b.normals,C=b.colors,O=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&O++;for(e=0;e<O;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];m=0;for(p=u.length;m<p;)v=new THREE.Vertex,v.position.x=u[m++]*c,v.position.y=
+u[m++]*c,v.position.z=u[m++]*c,f.vertices.push(v);m=0;for(p=H.length;m<p;){c=H[m++];u=c&1;o=c&2;e=c&4;g=c&8;t=c&16;v=c&32;x=c&64;c&=128;u?(B=new THREE.Face4,B.a=H[m++],B.b=H[m++],B.c=H[m++],B.d=H[m++],u=4):(B=new THREE.Face3,B.a=H[m++],B.b=H[m++],B.c=H[m++],u=3);if(o)o=H[m++],B.materials=f.materials[o];o=f.faces.length;if(e)for(e=0;e<O;e++)A=b.uvs[e],w=H[m++],z=A[w*2],w=A[w*2+1],f.faceUvs[e][o]=new THREE.UV(z,w);if(g)for(e=0;e<O;e++){A=b.uvs[e];I=[];for(g=0;g<u;g++)w=H[m++],z=A[w*2],w=A[w*2+1],I[g]=
+new THREE.UV(z,w);f.faceVertexUvs[e][o]=I}if(t)t=H[m++]*3,g=new THREE.Vector3,g.x=G[t++],g.y=G[t++],g.z=G[t],B.normal=g;if(v)for(e=0;e<u;e++)t=H[m++]*3,g=new THREE.Vector3,g.x=G[t++],g.y=G[t++],g.z=G[t],B.vertexNormals.push(g);if(x)v=H[m++],v=new THREE.Color(C[v]),B.color=v;if(c)for(e=0;e<u;e++)v=H[m++],v=new THREE.Color(C[v]),B.vertexColors.push(v);f.faces.push(B)}}})(g);(function(){var c,e,g,o;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],o=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
 o,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],o=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,o,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,o,m,p,u,v,t,w;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];t=f.morphTargets[e].vertices;w=b.morphTargets[e].vertices;o=0;for(m=w.length;o<m;o+=3)p=w[o]*c,u=w[o+1]*
 c,v=w[o+2]*c,t.push(new THREE.Vertex(new THREE.Vector3(p,u,v)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];m=f.morphColors[e].colors;p=b.morphColors[e].colors;c=0;for(o=p.length;c<o;c+=3)u=new THREE.Color(16755200),u.setRGB(p[c],p[c+1],p[c+2]),m.push(u)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
 f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),j=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,j)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
 c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,j){var h=new XMLHttpRequest,k=f+"/"+b,o=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,e,g,c):alert("Couldn't load ["+k+"] ["+h.status+"]"):h.readyState==3?j&&(o==0&&(o=h.getResponseHeader("Content-Length")),j({total:o,loaded:h.responseText.length})):h.readyState==2&&(o=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
 h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=p(b,c),g=p(b,c+1),h=p(b,c+2),j=p(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=p(b,c),f=p(b,c+1),h=p(b,c+2);return(p(b,c+3)<<24)+(h<<16)+(f<<8)+e}function o(b,c){var e=p(b,c);return(p(b,c+1)<<8)+e}function m(b,c){var e=p(b,c);return e>127?e-256:e}function p(b,
-c){return b.charCodeAt(c)&255}function u(c){var e,f,h;e=g(b,c);f=g(b,c+E);h=g(b,c+K);c=o(b,c+D);THREE.BinaryLoader.prototype.f3(A,e,f,h,c)}function v(c){var e,f,h,j,m,n;e=g(b,c);f=g(b,c+E);h=g(b,c+K);j=o(b,c+D);m=g(b,c+J);n=g(b,c+S);c=g(b,c+X);THREE.BinaryLoader.prototype.f3n(A,G,e,f,h,j,m,n,c)}function t(c){var e,f,h,j;e=g(b,c);f=g(b,c+R);h=g(b,c+C);j=g(b,c+n);c=o(b,c+W);THREE.BinaryLoader.prototype.f4(A,e,f,h,j,c)}function w(c){var e,f,h,j,m,p,t,u;e=g(b,c);f=g(b,c+R);h=g(b,c+C);j=g(b,c+n);m=o(b,
-c+W);p=g(b,c+V);t=g(b,c+fa);u=g(b,c+L);c=g(b,c+ea);THREE.BinaryLoader.prototype.f4n(A,G,e,f,h,j,m,p,t,u,c)}function x(c){var e,f;e=g(b,c);f=g(b,c+T);c=g(b,c+U);THREE.BinaryLoader.prototype.uv3(A.faceVertexUvs[0],I[e*2],I[e*2+1],I[f*2],I[f*2+1],I[c*2],I[c*2+1])}function B(c){var e,f,h;e=g(b,c);f=g(b,c+da);h=g(b,c+ha);c=g(b,c+ia);THREE.BinaryLoader.prototype.uv4(A.faceVertexUvs[0],I[e*2],I[e*2+1],I[f*2],I[f*2+1],I[h*2],I[h*2+1],I[c*2],I[c*2+1])}var A=this,H=0,y,G=[],I=[],E,K,D,J,S,X,R,C,n,W,V,fa,L,
-ea,T,U,da,ha,ia,M,P,aa,Y,Z,ca;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,f,c);y={signature:b.substr(H,8),header_bytes:p(b,H+8),vertex_coordinate_bytes:p(b,H+9),normal_coordinate_bytes:p(b,H+10),uv_coordinate_bytes:p(b,H+11),vertex_index_bytes:p(b,H+12),normal_index_bytes:p(b,H+13),uv_index_bytes:p(b,H+14),material_index_bytes:p(b,H+15),nvertices:g(b,H+16),nnormals:g(b,H+16+4),nuvs:g(b,H+16+8),ntri_flat:g(b,H+16+12),ntri_smooth:g(b,H+16+16),ntri_flat_uv:g(b,H+16+20),ntri_smooth_uv:g(b,
-H+16+24),nquad_flat:g(b,H+16+28),nquad_smooth:g(b,H+16+32),nquad_flat_uv:g(b,H+16+36),nquad_smooth_uv:g(b,H+16+40)};H+=y.header_bytes;E=y.vertex_index_bytes;K=y.vertex_index_bytes*2;D=y.vertex_index_bytes*3;J=y.vertex_index_bytes*3+y.material_index_bytes;S=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes;X=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*2;R=y.vertex_index_bytes;C=y.vertex_index_bytes*2;n=y.vertex_index_bytes*3;W=y.vertex_index_bytes*4;V=y.vertex_index_bytes*
-4+y.material_index_bytes;fa=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes;L=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*2;ea=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*3;T=y.uv_index_bytes;U=y.uv_index_bytes*2;da=y.uv_index_bytes;ha=y.uv_index_bytes*2;ia=y.uv_index_bytes*3;c=y.vertex_index_bytes*3+y.material_index_bytes;ca=y.vertex_index_bytes*4+y.material_index_bytes;M=y.ntri_flat*c;P=y.ntri_smooth*(c+y.normal_index_bytes*3);aa=
-y.ntri_flat_uv*(c+y.uv_index_bytes*3);Y=y.ntri_smooth_uv*(c+y.normal_index_bytes*3+y.uv_index_bytes*3);Z=y.nquad_flat*ca;c=y.nquad_smooth*(ca+y.normal_index_bytes*4);ca=y.nquad_flat_uv*(ca+y.uv_index_bytes*4);H+=function(c){for(var f,g,j,k=y.vertex_coordinate_bytes*3,m=c+y.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+y.vertex_coordinate_bytes),j=e(b,c+y.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(A,f,g,j);return y.nvertices*k}(H);H+=function(c){for(var e,f,g,h=y.normal_coordinate_bytes*3,j=
-c+y.nnormals*h;c<j;c+=h)e=m(b,c),f=m(b,c+y.normal_coordinate_bytes),g=m(b,c+y.normal_coordinate_bytes*2),G.push(e/127,f/127,g/127);return y.nnormals*h}(H);H+=function(c){for(var f,g,j=y.uv_coordinate_bytes*2,k=c+y.nuvs*j;c<k;c+=j)f=e(b,c),g=e(b,c+y.uv_coordinate_bytes),I.push(f,g);return y.nuvs*j}(H);M=H+M;P=M+P;aa=P+aa;Y=aa+Y;Z=Y+Z;c=Z+c;ca=c+ca;(function(b){var c,e=y.vertex_index_bytes*3+y.material_index_bytes,f=e+y.uv_index_bytes*3,g=b+y.ntri_flat_uv*f;for(c=b;c<g;c+=f)u(c),x(c+e);return g-b})(P);
-(function(b){var c,e=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*3,f=e+y.uv_index_bytes*3,g=b+y.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),x(c+e);return g-b})(aa);(function(b){var c,e=y.vertex_index_bytes*4+y.material_index_bytes,f=e+y.uv_index_bytes*4,g=b+y.nquad_flat_uv*f;for(c=b;c<g;c+=f)t(c),B(c+e);return g-b})(c);(function(b){var c,e=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*4,f=e+y.uv_index_bytes*4,g=b+y.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),B(c+
-e);return g-b})(ca);(function(b){var c,e=y.vertex_index_bytes*3+y.material_index_bytes,f=b+y.ntri_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(H);(function(b){var c,e=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*3,f=b+y.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(M);(function(b){var c,e=y.vertex_index_bytes*4+y.material_index_bytes,f=b+y.nquad_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(Y);(function(b){var c,e=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*
-4,f=b+y.nquad_smooth*e;for(c=b;c<f;c+=e)w(c);return f-b})(Z);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,j){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[j]))},
-f3n:function(b,c,e,f,g,j,h,k,o){var j=b.materials[j],m=c[k*3],p=c[k*3+1],k=c[k*3+2],u=c[o*3],v=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(m,p,k),new THREE.Vector3(u,v,o)],null,j))},f4n:function(b,c,e,f,g,j,h,k,o,m,p){var h=b.materials[h],u=c[o*3],v=c[o*3+1],o=c[o*3+2],t=c[m*3],w=c[m*3+1],m=c[m*3+2],x=c[p*3],B=c[p*3+1],p=c[p*3+2];b.faces.push(new THREE.Face4(e,f,g,j,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(u,
-v,o),new THREE.Vector3(t,w,m),new THREE.Vector3(x,B,p)],null,h))},uv3:function(b,c,e,f,g,j,h){var k=[];k.push(new THREE.UV(c,e));k.push(new THREE.UV(f,g));k.push(new THREE.UV(j,h));b.push(k)},uv4:function(b,c,e,f,g,j,h,k,o){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(j,h));m.push(new THREE.UV(k,o));b.push(m)},constructor:THREE.BinaryLoader};
+c){return b.charCodeAt(c)&255}function u(c){var e,f,h;e=g(b,c);f=g(b,c+C);h=g(b,c+O);c=o(b,c+N);THREE.BinaryLoader.prototype.f3(A,e,f,h,c)}function v(c){var e,f,h,j,m,n;e=g(b,c);f=g(b,c+C);h=g(b,c+O);j=o(b,c+N);m=g(b,c+D);n=g(b,c+E);c=g(b,c+U);THREE.BinaryLoader.prototype.f3n(A,H,e,f,h,j,m,n,c)}function t(c){var e,f,h,j;e=g(b,c);f=g(b,c+M);h=g(b,c+L);j=g(b,c+n);c=o(b,c+S);THREE.BinaryLoader.prototype.f4(A,e,f,h,j,c)}function w(c){var e,f,h,j,m,p,t,u;e=g(b,c);f=g(b,c+M);h=g(b,c+L);j=g(b,c+n);m=o(b,
+c+S);p=g(b,c+V);t=g(b,c+X);u=g(b,c+Q);c=g(b,c+fa);THREE.BinaryLoader.prototype.f4n(A,H,e,f,h,j,m,p,t,u,c)}function x(c){var e,f;e=g(b,c);f=g(b,c+W);c=g(b,c+ca);THREE.BinaryLoader.prototype.uv3(A.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[c*2],G[c*2+1])}function B(c){var e,f,h;e=g(b,c);f=g(b,c+Y);h=g(b,c+ea);c=g(b,c+$);THREE.BinaryLoader.prototype.uv4(A.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[h*2],G[h*2+1],G[c*2],G[c*2+1])}var A=this,I=0,z,H=[],G=[],C,O,N,D,E,U,M,L,n,S,V,X,Q,fa,
+W,ca,Y,ea,$,ga,K,da,Z,ka,ia;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,f,c);z={signature:b.substr(I,8),header_bytes:p(b,I+8),vertex_coordinate_bytes:p(b,I+9),normal_coordinate_bytes:p(b,I+10),uv_coordinate_bytes:p(b,I+11),vertex_index_bytes:p(b,I+12),normal_index_bytes:p(b,I+13),uv_index_bytes:p(b,I+14),material_index_bytes:p(b,I+15),nvertices:g(b,I+16),nnormals:g(b,I+16+4),nuvs:g(b,I+16+8),ntri_flat:g(b,I+16+12),ntri_smooth:g(b,I+16+16),ntri_flat_uv:g(b,I+16+20),ntri_smooth_uv:g(b,
+I+16+24),nquad_flat:g(b,I+16+28),nquad_smooth:g(b,I+16+32),nquad_flat_uv:g(b,I+16+36),nquad_smooth_uv:g(b,I+16+40)};I+=z.header_bytes;C=z.vertex_index_bytes;O=z.vertex_index_bytes*2;N=z.vertex_index_bytes*3;D=z.vertex_index_bytes*3+z.material_index_bytes;E=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;U=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;M=z.vertex_index_bytes;L=z.vertex_index_bytes*2;n=z.vertex_index_bytes*3;S=z.vertex_index_bytes*4;V=z.vertex_index_bytes*
+4+z.material_index_bytes;X=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;Q=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;fa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;W=z.uv_index_bytes;ca=z.uv_index_bytes*2;Y=z.uv_index_bytes;ea=z.uv_index_bytes*2;$=z.uv_index_bytes*3;c=z.vertex_index_bytes*3+z.material_index_bytes;ia=z.vertex_index_bytes*4+z.material_index_bytes;ga=z.ntri_flat*c;K=z.ntri_smooth*(c+z.normal_index_bytes*3);da=z.ntri_flat_uv*
+(c+z.uv_index_bytes*3);Z=z.ntri_smooth_uv*(c+z.normal_index_bytes*3+z.uv_index_bytes*3);ka=z.nquad_flat*ia;c=z.nquad_smooth*(ia+z.normal_index_bytes*4);ia=z.nquad_flat_uv*(ia+z.uv_index_bytes*4);I+=function(c){for(var f,g,j,k=z.vertex_coordinate_bytes*3,m=c+z.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+z.vertex_coordinate_bytes),j=e(b,c+z.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(A,f,g,j);return z.nvertices*k}(I);I+=function(c){for(var e,f,g,h=z.normal_coordinate_bytes*3,j=c+z.nnormals*
+h;c<j;c+=h)e=m(b,c),f=m(b,c+z.normal_coordinate_bytes),g=m(b,c+z.normal_coordinate_bytes*2),H.push(e/127,f/127,g/127);return z.nnormals*h}(I);I+=function(c){for(var f,g,j=z.uv_coordinate_bytes*2,k=c+z.nuvs*j;c<k;c+=j)f=e(b,c),g=e(b,c+z.uv_coordinate_bytes),G.push(f,g);return z.nuvs*j}(I);ga=I+ga;K=ga+K;da=K+da;Z=da+Z;ka=Z+ka;c=ka+c;ia=c+ia;(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes,f=e+z.uv_index_bytes*3,g=b+z.ntri_flat_uv*f;for(c=b;c<g;c+=f)u(c),x(c+e);return g-b})(K);(function(b){var c,
+e=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,f=e+z.uv_index_bytes*3,g=b+z.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),x(c+e);return g-b})(da);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes,f=e+z.uv_index_bytes*4,g=b+z.nquad_flat_uv*f;for(c=b;c<g;c+=f)t(c),B(c+e);return g-b})(c);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,f=e+z.uv_index_bytes*4,g=b+z.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),B(c+e);return g-b})(ia);
+(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes,f=b+z.ntri_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(I);(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,f=b+z.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(ga);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes,f=b+z.nquad_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(Z);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,f=b+z.nquad_smooth*
+e;for(c=b;c<f;c+=e)w(c);return f-b})(ka);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,j){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[j]))},f3n:function(b,c,e,
+f,g,j,h,k,o){var j=b.materials[j],m=c[k*3],p=c[k*3+1],k=c[k*3+2],u=c[o*3],v=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(m,p,k),new THREE.Vector3(u,v,o)],null,j))},f4n:function(b,c,e,f,g,j,h,k,o,m,p){var h=b.materials[h],u=c[o*3],v=c[o*3+1],o=c[o*3+2],t=c[m*3],w=c[m*3+1],m=c[m*3+2],x=c[p*3],B=c[p*3+1],p=c[p*3+2];b.faces.push(new THREE.Face4(e,f,g,j,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(u,v,o),new THREE.Vector3(t,
+w,m),new THREE.Vector3(x,B,p)],null,h))},uv3:function(b,c,e,f,g,j,h){var k=[];k.push(new THREE.UV(c,e));k.push(new THREE.UV(f,g));k.push(new THREE.UV(j,h));b.push(k)},uv4:function(b,c,e,f,g,j,h,k,o){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(j,h));m.push(new THREE.UV(k,o));b.push(m)},constructor:THREE.BinaryLoader};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function k(){for(t in R.objects)if(!L.objects[t])if(H=R.objects[t],H.geometry!==void 0){if(E=L.geometries[H.geometry]){var b=!1;S=[];for(T=0;T<H.materials.length;T++)S[T]=L.materials[H.materials[T]],b=S[T]instanceof THREE.MeshShaderMaterial;b&&E.computeTangents();y=H.position;r=H.rotation;
-q=H.quaternion;s=H.scale;q=0;S.length==0&&(S[0]=new THREE.MeshFaceMaterial);S.length>1&&(S=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(E,S);object.name=t;object.position.set(y[0],y[1],y[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=H.visible;L.scene.addObject(object);L.objects[t]=object;H.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),L.scene.collisions.colliders.push(b));
-if(H.castsShadow)b=new THREE.ShadowVolume(E),L.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},L.triggers[object.name]=b)}}else y=H.position,r=H.rotation,q=H.quaternion,s=H.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(y[0],y[1],y[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=H.visible!==void 0?H.visible:!1,L.scene.addObject(object),L.objects[t]=object,L.empties[t]=object,H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},L.triggers[object.name]=b)}function o(b){return function(c){L.geometries[b]=c;k();n-=1;e.onLoadComplete();p()}}function m(b){return function(c){L.geometries[b]=c}}function p(){e.callbackProgress({totalModels:V,totalTextures:fa,loadedModels:V-n,loadedTextures:fa-W},L);e.onLoadProgress();n==0&&W==0&&c(L)}
-var u,v,t,w,x,B,A,H,y,G,I,E,K,D,J,S,X,R,C,n,W,V,fa,L;R=b.data;J=new THREE.BinaryLoader;C=new THREE.JSONLoader;W=n=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(t in R.objects)if(H=R.objects[t],H.meshCollider){b=!0;break}if(b)L.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;G=R.transform.rotation;var ea=R.transform.scale;b&&L.scene.position.set(b[0],b[1],b[2]);G&&L.scene.rotation.set(G[0],
-G[1],G[2]);ea&&L.scene.scale.set(ea[0],ea[1],ea[2]);(b||G||ea)&&L.scene.updateMatrix()}b=function(){W-=1;p();e.onLoadComplete()};for(x in R.cameras){G=R.cameras[x];if(G.type=="perspective")K=new THREE.Camera(G.fov,G.aspect,G.near,G.far);else if(G.type=="ortho")K=new THREE.Camera,K.projectionMatrix=THREE.Matrix4.makeOrtho(G.left,G.right,G.top,G.bottom,G.near,G.far);y=G.position;G=G.target;K.position.set(y[0],y[1],y[2]);K.target.position.set(G[0],G[1],G[2]);L.cameras[x]=K}for(w in R.lights)x=R.lights[w],
-K=x.color!==void 0?x.color:16777215,G=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(y=x.direction,X=new THREE.DirectionalLight(K,G),X.position.set(y[0],y[1],y[2]),X.position.normalize()):x.type=="point"?(y=x.position,d=x.distance,X=new THREE.PointLight(K,G,d),X.position.set(y[0],y[1],y[2])):x.type=="ambient"&&(X=new THREE.AmbientLight(K)),L.scene.addLight(X),L.lights[w]=X;for(B in R.fogs)w=R.fogs[B],w.type=="linear"?D=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(D=new THREE.FogExp2(0,
-w.density)),G=w.color,D.color.setRGB(G[0],G[1],G[2]),L.fogs[B]=D;if(L.cameras&&R.defaults.camera)L.currentCamera=L.cameras[R.defaults.camera];if(L.fogs&&R.defaults.fog)L.scene.fog=L.fogs[R.defaults.fog];G=R.defaults.bgcolor;L.bgColor=new THREE.Color;L.bgColor.setRGB(G[0],G[1],G[2]);L.bgColorAlpha=R.defaults.bgalpha;for(u in R.geometries)if(B=R.geometries[u],B.type=="bin_mesh"||B.type=="ascii_mesh")n+=1,e.onLoadStart();V=n;for(u in R.geometries)B=R.geometries[u],B.type=="cube"?(E=new THREE.CubeGeometry(B.width,
-B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),L.geometries[u]=E):B.type=="plane"?(E=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),L.geometries[u]=E):B.type=="sphere"?(E=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),L.geometries[u]=E):B.type=="cylinder"?(E=new THREE.CylinderGeometry(B.numSegs,B.topRad,B.botRad,B.height,B.topOffset,B.botOffset),L.geometries[u]=E):B.type=="torus"?(E=new THREE.TorusGeometry(B.radius,
-B.tube,B.segmentsR,B.segmentsT),L.geometries[u]=E):B.type=="icosahedron"?(E=new THREE.IcosahedronGeometry(B.subdivisions),L.geometries[u]=E):B.type=="bin_mesh"?J.load({model:f(B.url,R.urlBaseType),callback:o(u)}):B.type=="ascii_mesh"?C.load({model:f(B.url,R.urlBaseType),callback:o(u)}):B.type=="embedded_mesh"&&(B=R.embeds[B.id])&&C.createModel(B,m(u),"");for(A in R.textures)if(u=R.textures[A],u.url instanceof Array){W+=u.url.length;for(J=0;J<u.url.length;J++)e.onLoadStart()}else W+=1,e.onLoadStart();
-fa=W;for(A in R.textures){u=R.textures[A];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){J=[];for(var T=0;T<u.url.length;T++)J[T]=f(u.url[T],R.urlBaseType);J=THREE.ImageUtils.loadTextureCube(J,u.mapping,b)}else{J=THREE.ImageUtils.loadTexture(f(u.url,R.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)J.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)J.magFilter=THREE[u.magFilter];if(u.repeat){J.repeat.set(u.repeat[0],u.repeat[1]);
-if(u.repeat[0]!=1)J.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)J.wrapT=THREE.RepeatWrapping}u.offset&&J.offset.set(u.offset[0],u.offset[1]);if(u.wrap){C={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(C[u.wrap[0]]!==void 0)J.wrapS=C[u.wrap[0]];if(C[u.wrap[1]]!==void 0)J.wrapT=C[u.wrap[1]]}}L.textures[A]=J}for(v in R.materials){A=R.materials[v];for(I in A.parameters)if(I=="envMap"||I=="map"||I=="lightMap")A.parameters[I]=L.textures[A.parameters[I]];else if(I=="shading")A.parameters[I]=
-A.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")A.parameters[I]=THREE[A.parameters[I]]?THREE[A.parameters[I]]:THREE.NormalBlending;else if(I=="combine")A.parameters[I]=A.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(I=="vertexColors")if(A.parameters[I]=="face")A.parameters[I]=THREE.FaceColors;else if(A.parameters[I])A.parameters[I]=THREE.VertexColors;if(A.parameters.opacity!==void 0&&A.parameters.opacity<1)A.parameters.transparent=
-!0;if(A.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);J=A.parameters.color;C=A.parameters.specular;B=A.parameters.ambient;D=A.parameters.shininess;b.tNormal.texture=L.textures[A.parameters.normalMap];if(A.parameters.normalMapFactor)b.uNormalScale.value=A.parameters.normalMapFactor;if(A.parameters.map)b.tDiffuse.texture=A.parameters.map,b.enableDiffuse.value=!0;if(A.parameters.lightMap)b.tAO.texture=A.parameters.lightMap,b.enableAO.value=!0;if(A.parameters.specularMap)b.tSpecular.texture=
-L.textures[A.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(J);b.uSpecularColor.value.setHex(C);b.uAmbientColor.value.setHex(B);b.uShininess.value=D;if(A.parameters.opacity)b.uOpacity.value=A.parameters.opacity;A=new THREE.MeshShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else A=new THREE[A.type](A.parameters);L.materials[v]=A}k();e.callbackSync(L)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function k(){for(t in M.objects)if(!Q.objects[t])if(I=M.objects[t],I.geometry!==void 0){if(C=Q.geometries[I.geometry]){var b=!1;E=[];for(W=0;W<I.materials.length;W++)E[W]=Q.materials[I.materials[W]],b=E[W]instanceof THREE.MeshShaderMaterial;b&&C.computeTangents();z=I.position;r=I.rotation;
+q=I.quaternion;s=I.scale;q=0;E.length==0&&(E[0]=new THREE.MeshFaceMaterial);E.length>1&&(E=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,E);object.name=t;object.position.set(z[0],z[1],z[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=I.visible;Q.scene.addObject(object);Q.objects[t]=object;I.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),Q.scene.collisions.colliders.push(b));
+if(I.castsShadow)b=new THREE.ShadowVolume(C),Q.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},Q.triggers[object.name]=b)}}else z=I.position,r=I.rotation,q=I.quaternion,s=I.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(z[0],z[1],z[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
+s[1],s[2]),object.visible=I.visible!==void 0?I.visible:!1,Q.scene.addObject(object),Q.objects[t]=object,Q.empties[t]=object,I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},Q.triggers[object.name]=b)}function o(b){return function(c){Q.geometries[b]=c;k();n-=1;e.onLoadComplete();p()}}function m(b){return function(c){Q.geometries[b]=c}}function p(){e.callbackProgress({totalModels:V,totalTextures:X,loadedModels:V-n,loadedTextures:X-S},Q);e.onLoadProgress();n==0&&S==0&&c(Q)}var u,
+v,t,w,x,B,A,I,z,H,G,C,O,N,D,E,U,M,L,n,S,V,X,Q;M=b.data;D=new THREE.BinaryLoader;L=new THREE.JSONLoader;S=n=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(t in M.objects)if(I=M.objects[t],I.meshCollider){b=!0;break}if(b)Q.scene.collisions=new THREE.CollisionSystem;if(M.transform){b=M.transform.position;H=M.transform.rotation;var fa=M.transform.scale;b&&Q.scene.position.set(b[0],b[1],b[2]);H&&Q.scene.rotation.set(H[0],
+H[1],H[2]);fa&&Q.scene.scale.set(fa[0],fa[1],fa[2]);(b||H||fa)&&Q.scene.updateMatrix()}b=function(){S-=1;p();e.onLoadComplete()};for(x in M.cameras){H=M.cameras[x];if(H.type=="perspective")O=new THREE.Camera(H.fov,H.aspect,H.near,H.far);else if(H.type=="ortho")O=new THREE.Camera,O.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);z=H.position;H=H.target;O.position.set(z[0],z[1],z[2]);O.target.position.set(H[0],H[1],H[2]);Q.cameras[x]=O}for(w in M.lights)x=M.lights[w],
+O=x.color!==void 0?x.color:16777215,H=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(z=x.direction,U=new THREE.DirectionalLight(O,H),U.position.set(z[0],z[1],z[2]),U.position.normalize()):x.type=="point"?(z=x.position,d=x.distance,U=new THREE.PointLight(O,H,d),U.position.set(z[0],z[1],z[2])):x.type=="ambient"&&(U=new THREE.AmbientLight(O)),Q.scene.addLight(U),Q.lights[w]=U;for(B in M.fogs)w=M.fogs[B],w.type=="linear"?N=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(N=new THREE.FogExp2(0,
+w.density)),H=w.color,N.color.setRGB(H[0],H[1],H[2]),Q.fogs[B]=N;if(Q.cameras&&M.defaults.camera)Q.currentCamera=Q.cameras[M.defaults.camera];if(Q.fogs&&M.defaults.fog)Q.scene.fog=Q.fogs[M.defaults.fog];H=M.defaults.bgcolor;Q.bgColor=new THREE.Color;Q.bgColor.setRGB(H[0],H[1],H[2]);Q.bgColorAlpha=M.defaults.bgalpha;for(u in M.geometries)if(B=M.geometries[u],B.type=="bin_mesh"||B.type=="ascii_mesh")n+=1,e.onLoadStart();V=n;for(u in M.geometries)B=M.geometries[u],B.type=="cube"?(C=new THREE.CubeGeometry(B.width,
+B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),Q.geometries[u]=C):B.type=="plane"?(C=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),Q.geometries[u]=C):B.type=="sphere"?(C=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),Q.geometries[u]=C):B.type=="cylinder"?(C=new THREE.CylinderGeometry(B.numSegs,B.topRad,B.botRad,B.height,B.topOffset,B.botOffset),Q.geometries[u]=C):B.type=="torus"?(C=new THREE.TorusGeometry(B.radius,
+B.tube,B.segmentsR,B.segmentsT),Q.geometries[u]=C):B.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(B.subdivisions),Q.geometries[u]=C):B.type=="bin_mesh"?D.load({model:f(B.url,M.urlBaseType),callback:o(u)}):B.type=="ascii_mesh"?L.load({model:f(B.url,M.urlBaseType),callback:o(u)}):B.type=="embedded_mesh"&&(B=M.embeds[B.id])&&L.createModel(B,m(u),"");for(A in M.textures)if(u=M.textures[A],u.url instanceof Array){S+=u.url.length;for(D=0;D<u.url.length;D++)e.onLoadStart()}else S+=1,e.onLoadStart();
+X=S;for(A in M.textures){u=M.textures[A];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){D=[];for(var W=0;W<u.url.length;W++)D[W]=f(u.url[W],M.urlBaseType);D=THREE.ImageUtils.loadTextureCube(D,u.mapping,b)}else{D=THREE.ImageUtils.loadTexture(f(u.url,M.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)D.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)D.magFilter=THREE[u.magFilter];if(u.repeat){D.repeat.set(u.repeat[0],u.repeat[1]);
+if(u.repeat[0]!=1)D.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)D.wrapT=THREE.RepeatWrapping}u.offset&&D.offset.set(u.offset[0],u.offset[1]);if(u.wrap){L={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(L[u.wrap[0]]!==void 0)D.wrapS=L[u.wrap[0]];if(L[u.wrap[1]]!==void 0)D.wrapT=L[u.wrap[1]]}}Q.textures[A]=D}for(v in M.materials){A=M.materials[v];for(G in A.parameters)if(G=="envMap"||G=="map"||G=="lightMap")A.parameters[G]=Q.textures[A.parameters[G]];else if(G=="shading")A.parameters[G]=
+A.parameters[G]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(G=="blending")A.parameters[G]=THREE[A.parameters[G]]?THREE[A.parameters[G]]:THREE.NormalBlending;else if(G=="combine")A.parameters[G]=A.parameters[G]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(G=="vertexColors")if(A.parameters[G]=="face")A.parameters[G]=THREE.FaceColors;else if(A.parameters[G])A.parameters[G]=THREE.VertexColors;if(A.parameters.opacity!==void 0&&A.parameters.opacity<1)A.parameters.transparent=
+!0;if(A.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);D=A.parameters.color;L=A.parameters.specular;B=A.parameters.ambient;N=A.parameters.shininess;b.tNormal.texture=Q.textures[A.parameters.normalMap];if(A.parameters.normalMapFactor)b.uNormalScale.value=A.parameters.normalMapFactor;if(A.parameters.map)b.tDiffuse.texture=A.parameters.map,b.enableDiffuse.value=!0;if(A.parameters.lightMap)b.tAO.texture=A.parameters.lightMap,b.enableAO.value=!0;if(A.parameters.specularMap)b.tSpecular.texture=
+Q.textures[A.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(D);b.uSpecularColor.value.setHex(L);b.uAmbientColor.value.setHex(B);b.uShininess.value=N;if(A.parameters.opacity)b.uOpacity.value=A.parameters.opacity;A=new THREE.MeshShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else A=new THREE[A.type](A.parameters);Q.materials[v]=A}k();e.callbackSync(Q)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
 THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype={load:function(b){var c=new XMLHttpRequest,e=b.model,f=b.callback,g=b.scale!==void 0?b.scale:1,j=b.offsetX!==void 0?b.offsetX:0,h=b.offsetY!==void 0?b.offsetY:0,k=b.offsetZ!==void 0?b.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,f,g,j,h,k):alert("Couldn't load ["+e+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",e,!0);c.send(null)},
 decompressMesh:function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,g=0;g<8;g++){for(var j=0,h=0;h<c;++h){var k=b.charCodeAt(h+f);j+=k>>1^-(k&1);e[8*h+g]=j}f+=c}c=b.length-f;j=new Uint16Array(c);for(g=h=0;g<c;g++)k=b.charCodeAt(g+f),j[g]=h-k,k==0&&h++;return[e,j]},createModel:function(b,c,e,f,g,j){var h=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var h=THREE.UTF8Loader.prototype.decompressMesh(b),m=[],p=[];(function(b,h,m){for(var o,p,B,
-A=b.length;m<A;m+=h)o=b[m],p=b[m+1],B=b[m+2],o=o/16383*e,p=p/16383*e,B=B/16383*e,o+=f,p+=g,B+=j,THREE.UTF8Loader.prototype.v(c,o,p,B)})(h[0],8,0);(function(b,c,e){for(var f,g,h=b.length;e<h;e+=c)f=b[e],g=b[e+1],f/=1023,g/=1023,p.push(f,g)})(h[0],8,3);(function(b,c,e){for(var f,g,h,j=b.length;e<j;e+=c)f=b[e],g=b[e+1],h=b[e+2],f=(f-512)/511,g=(g-512)/511,h=(h-512)/511,m.push(f,g,h)})(h[0],8,5);(function(b){var e,f,g,h,j,o,H,y=b.length;for(e=0;e<y;e+=3)f=b[e],g=b[e+1],h=b[e+2],THREE.UTF8Loader.prototype.f3n(c,
-m,f,g,h,0,f,g,h),j=p[f*2],f=p[f*2+1],o=p[g*2],g=p[g*2+1],H=p[h*2],h=p[h*2+1],THREE.UTF8Loader.prototype.uv3(c.faceVertexUvs[0],j,f,o,g,H,h)})(h[1]);this.computeCentroids();this.computeFaceNormals()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h)},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3n:function(b,c,e,f,g,j,h,k,o){var j=b.materials[j],m=c[k*3],p=c[k*3+1],k=c[k*3+2],u=c[o*3],v=c[o*3+1],o=c[o*3+2],h=new THREE.Vector3(c[h*3],c[h*3+1],c[h*
+A=b.length;m<A;m+=h)o=b[m],p=b[m+1],B=b[m+2],o=o/16383*e,p=p/16383*e,B=B/16383*e,o+=f,p+=g,B+=j,THREE.UTF8Loader.prototype.v(c,o,p,B)})(h[0],8,0);(function(b,c,e){for(var f,g,h=b.length;e<h;e+=c)f=b[e],g=b[e+1],f/=1023,g/=1023,p.push(f,g)})(h[0],8,3);(function(b,c,e){for(var f,g,h,j=b.length;e<j;e+=c)f=b[e],g=b[e+1],h=b[e+2],f=(f-512)/511,g=(g-512)/511,h=(h-512)/511,m.push(f,g,h)})(h[0],8,5);(function(b){var e,f,g,h,j,o,I,z=b.length;for(e=0;e<z;e+=3)f=b[e],g=b[e+1],h=b[e+2],THREE.UTF8Loader.prototype.f3n(c,
+m,f,g,h,0,f,g,h),j=p[f*2],f=p[f*2+1],o=p[g*2],g=p[g*2+1],I=p[h*2],h=p[h*2+1],THREE.UTF8Loader.prototype.uv3(c.faceVertexUvs[0],j,f,o,g,I,h)})(h[1]);this.computeCentroids();this.computeFaceNormals()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h)},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3n:function(b,c,e,f,g,j,h,k,o){var j=b.materials[j],m=c[k*3],p=c[k*3+1],k=c[k*3+2],u=c[o*3],v=c[o*3+1],o=c[o*3+2],h=new THREE.Vector3(c[h*3],c[h*3+1],c[h*
 3+2]),k=new THREE.Vector3(m,p,k),o=new THREE.Vector3(u,v,o);b.faces.push(new THREE.Face3(e,f,g,[h,k,o],null,j))},uv3:function(b,c,e,f,g,j,h){var k=[];k.push(new THREE.UV(c,e));k.push(new THREE.UV(f,g));k.push(new THREE.UV(j,h));b.push(k)},constructor:THREE.UTF8Loader};
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,j,h,k,o,m,p,u){h=(h-p)/(u-p);p=this.normal_cache;c[j]=k+h*this.delta;c[j+1]=o;c[j+2]=m;g[j]=this.lerp(p[b],p[b+3],h);g[j+1]=this.lerp(p[b+1],p[b+4],h);g[j+2]=this.lerp(p[b+2],p[b+5],h)};this.VIntY=function(b,c,g,j,h,k,o,m,p,u){h=(h-p)/(u-p);p=this.normal_cache;c[j]=k;c[j+1]=o+h*this.delta;c[j+
 2]=m;c=b+this.yd*3;g[j]=this.lerp(p[b],p[c],h);g[j+1]=this.lerp(p[b+1],p[c+1],h);g[j+2]=this.lerp(p[b+2],p[c+2],h)};this.VIntZ=function(b,c,g,j,h,k,o,m,p,u){h=(h-p)/(u-p);p=this.normal_cache;c[j]=k;c[j+1]=o;c[j+2]=m+h*this.delta;c=b+this.zd*3;g[j]=this.lerp(p[b],p[c],h);g[j+1]=this.lerp(p[b+1],p[c+1],h);g[j+2]=this.lerp(p[b+2],p[c+2],h)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
-this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,g,j,h,k){var o=j+1,m=j+this.yd,p=j+this.zd,u=o+this.yd,v=o+this.zd,t=j+this.yd+this.zd,w=o+this.yd+this.zd,x=0,B=this.field[j],A=this.field[o],H=this.field[m],y=this.field[u],G=this.field[p],I=this.field[v],E=this.field[t],K=this.field[w];B<h&&(x|=1);A<h&&(x|=2);H<h&&(x|=8);y<h&&(x|=4);G<h&&(x|=16);I<h&&(x|=32);E<h&&(x|=128);K<h&&(x|=64);var D=THREE.edgeTable[x];if(D==0)return 0;var J=this.delta,
-S=b+J,X=c+J,J=g+J;D&1&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,0,h,b,c,g,B,A));D&2&&(this.compNorm(o),this.compNorm(u),this.VIntY(o*3,this.vlist,this.nlist,3,h,S,c,g,A,y));D&4&&(this.compNorm(m),this.compNorm(u),this.VIntX(m*3,this.vlist,this.nlist,6,h,b,X,g,H,y));D&8&&(this.compNorm(j),this.compNorm(m),this.VIntY(j*3,this.vlist,this.nlist,9,h,b,c,g,B,H));D&16&&(this.compNorm(p),this.compNorm(v),this.VIntX(p*3,this.vlist,this.nlist,12,h,b,c,J,G,I));D&32&&(this.compNorm(v),
-this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,15,h,S,c,J,I,K));D&64&&(this.compNorm(t),this.compNorm(w),this.VIntX(t*3,this.vlist,this.nlist,18,h,b,X,J,E,K));D&128&&(this.compNorm(p),this.compNorm(t),this.VIntY(p*3,this.vlist,this.nlist,21,h,b,c,J,G,E));D&256&&(this.compNorm(j),this.compNorm(p),this.VIntZ(j*3,this.vlist,this.nlist,24,h,b,c,g,B,G));D&512&&(this.compNorm(o),this.compNorm(v),this.VIntZ(o*3,this.vlist,this.nlist,27,h,S,c,g,A,I));D&1024&&(this.compNorm(u),this.compNorm(w),this.VIntZ(u*
-3,this.vlist,this.nlist,30,h,S,X,g,y,K));D&2048&&(this.compNorm(m),this.compNorm(t),this.VIntZ(m*3,this.vlist,this.nlist,33,h,b,X,g,H,E));x<<=4;for(h=j=0;THREE.triTable[x+h]!=-1;)b=x+h,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],k),h+=3,j++;return j};this.posnormtriv=function(b,c,g,j,h,k){var o=this.count*3;this.positionArray[o]=b[g];this.positionArray[o+1]=b[g+1];this.positionArray[o+2]=b[g+2];this.positionArray[o+3]=b[j];this.positionArray[o+
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,g,j,h,k){var o=j+1,m=j+this.yd,p=j+this.zd,u=o+this.yd,v=o+this.zd,t=j+this.yd+this.zd,w=o+this.yd+this.zd,x=0,B=this.field[j],A=this.field[o],I=this.field[m],z=this.field[u],H=this.field[p],G=this.field[v],C=this.field[t],O=this.field[w];B<h&&(x|=1);A<h&&(x|=2);I<h&&(x|=8);z<h&&(x|=4);H<h&&(x|=16);G<h&&(x|=32);C<h&&(x|=128);O<h&&(x|=64);var N=THREE.edgeTable[x];if(N==0)return 0;var D=this.delta,
+E=b+D,U=c+D,D=g+D;N&1&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,0,h,b,c,g,B,A));N&2&&(this.compNorm(o),this.compNorm(u),this.VIntY(o*3,this.vlist,this.nlist,3,h,E,c,g,A,z));N&4&&(this.compNorm(m),this.compNorm(u),this.VIntX(m*3,this.vlist,this.nlist,6,h,b,U,g,I,z));N&8&&(this.compNorm(j),this.compNorm(m),this.VIntY(j*3,this.vlist,this.nlist,9,h,b,c,g,B,I));N&16&&(this.compNorm(p),this.compNorm(v),this.VIntX(p*3,this.vlist,this.nlist,12,h,b,c,D,H,G));N&32&&(this.compNorm(v),
+this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,15,h,E,c,D,G,O));N&64&&(this.compNorm(t),this.compNorm(w),this.VIntX(t*3,this.vlist,this.nlist,18,h,b,U,D,C,O));N&128&&(this.compNorm(p),this.compNorm(t),this.VIntY(p*3,this.vlist,this.nlist,21,h,b,c,D,H,C));N&256&&(this.compNorm(j),this.compNorm(p),this.VIntZ(j*3,this.vlist,this.nlist,24,h,b,c,g,B,H));N&512&&(this.compNorm(o),this.compNorm(v),this.VIntZ(o*3,this.vlist,this.nlist,27,h,E,c,g,A,G));N&1024&&(this.compNorm(u),this.compNorm(w),this.VIntZ(u*
+3,this.vlist,this.nlist,30,h,E,U,g,z,O));N&2048&&(this.compNorm(m),this.compNorm(t),this.VIntZ(m*3,this.vlist,this.nlist,33,h,b,U,g,I,C));x<<=4;for(h=j=0;THREE.triTable[x+h]!=-1;)b=x+h,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],k),h+=3,j++;return j};this.posnormtriv=function(b,c,g,j,h,k){var o=this.count*3;this.positionArray[o]=b[g];this.positionArray[o+1]=b[g+1];this.positionArray[o+2]=b[g+2];this.positionArray[o+3]=b[j];this.positionArray[o+
 4]=b[j+1];this.positionArray[o+5]=b[j+2];this.positionArray[o+6]=b[h];this.positionArray[o+7]=b[h+1];this.positionArray[o+8]=b[h+2];this.normalArray[o]=c[g];this.normalArray[o+1]=c[g+1];this.normalArray[o+2]=c[g+2];this.normalArray[o+3]=c[j];this.normalArray[o+4]=c[j+1];this.normalArray[o+5]=c[j+2];this.normalArray[o+6]=c[h];this.normalArray[o+7]=c[h+1];this.normalArray[o+8]=c[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;
 this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,j,h){var k=this.size*Math.sqrt(j/h),o=g*this.size,m=c*this.size,p=b*this.size,u=Math.floor(o-k);u<1&&(u=1);o=Math.floor(o+k);o>this.size-1&&(o=this.size-1);var v=Math.floor(m-k);v<1&&(v=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(p-k);t<1&&(t=1);k=Math.floor(p+k);k>this.size-1&&(k=this.size-
-1);for(var w,x,B,A,H,y;u<o;u++){p=this.size2*u;x=u/this.size-g;H=x*x;for(x=v;x<m;x++){B=p+this.size*x;w=x/this.size-c;y=w*w;for(w=t;w<k;w++)A=w/this.size-b,A=j/(1.0E-6+A*A+y+H)-h,A>0&&(this.field[B+w]+=A)}}};this.addPlaneX=function(b,c){var g,j,h,k,o,m=this.size,p=this.yd,u=this.zd,v=this.field,t=m*Math.sqrt(b/c);t>m&&(t=m);for(g=0;g<t;g++)if(j=g/m,j*=j,k=b/(1.0E-4+j)-c,k>0)for(j=0;j<m;j++){o=g+j*p;for(h=0;h<m;h++)v[u*h+o]+=k}};this.addPlaneY=function(b,c){var g,j,h,k,o,m,p=this.size,u=this.yd,v=
+1);for(var w,x,B,A,I,z;u<o;u++){p=this.size2*u;x=u/this.size-g;I=x*x;for(x=v;x<m;x++){B=p+this.size*x;w=x/this.size-c;z=w*w;for(w=t;w<k;w++)A=w/this.size-b,A=j/(1.0E-6+A*A+z+I)-h,A>0&&(this.field[B+w]+=A)}}};this.addPlaneX=function(b,c){var g,j,h,k,o,m=this.size,p=this.yd,u=this.zd,v=this.field,t=m*Math.sqrt(b/c);t>m&&(t=m);for(g=0;g<t;g++)if(j=g/m,j*=j,k=b/(1.0E-4+j)-c,k>0)for(j=0;j<m;j++){o=g+j*p;for(h=0;h<m;h++)v[u*h+o]+=k}};this.addPlaneY=function(b,c){var g,j,h,k,o,m,p=this.size,u=this.yd,v=
 this.zd,t=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(j=0;j<w;j++)if(g=j/p,g*=g,k=b/(1.0E-4+g)-c,k>0){o=j*u;for(g=0;g<p;g++){m=o+g;for(h=0;h<p;h++)t[v*h+m]+=k}}};this.addPlaneZ=function(b,c){var g,j,h,k,o,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(g=h/size,g*=g,k=b/(1.0E-4+g)-c,k>0){o=zd*h;for(j=0;j<size;j++){m=o+j*yd;for(g=0;g<size;g++)field[m+g]+=k}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
 3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,g,j,h,k,o,m,p,u,v=this.size-2;for(h=1;h<v;h++){u=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(j=1;j<v;j++){p=u+this.size*j;o=(j-this.halfsize)/this.halfsize;for(g=1;g<v;g++)k=(g-this.halfsize)/this.halfsize,c=p+g,this.polygonize(k,o,m,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(j){var h,k,o,m,p,u,v,t;for(h=0;h<j.count;h++)v=h*3,p=v+1,t=v+2,k=j.positionArray[v],
 o=j.positionArray[p],m=j.positionArray[t],u=new THREE.Vector3(k,o,m),k=j.normalArray[v],o=j.normalArray[p],m=j.normalArray[t],v=new THREE.Vector3(k,o,m),v.normalize(),p=new THREE.Vertex(u),c.vertices.push(p),g.push(v);nfaces=j.count/3;for(h=0;h<nfaces;h++)v=(b+h)*3,p=v+1,t=v+2,u=g[v],k=g[p],o=g[t],v=new THREE.Face3(v,p,t,[u,k,o]),c.faces.push(v);b+=nfaces;j.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
@@ -608,7 +608,7 @@ THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionU
 THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
 if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,j=new THREE.Camera,h=new THREE.Matrix4,k=new THREE.Matrix4,o,m,p;g.useTarget=j.useTarget=!1;g.matrixAutoUpdate=j.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),t=new THREE.Camera(53,1,1,1E4);t.position.z=
 2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:v}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var w=new THREE.Scene;w.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(o!==e.aspect||m!==e.near||p!==e.fov){o=e.aspect;m=e.near;p=e.fov;var A=e.projectionMatrix.clone(),H=125/30*0.5,y=H*m/125,G=m*Math.tan(p*Math.PI/360),I;h.n14=H;k.n14=-H;H=-G*o+y;I=G*o+y;A.n11=2*m/(I-H);A.n13=(I+H)/(I-H);g.projectionMatrix=A.clone();H=-G*o-y;I=G*o-y;A.n11=2*m/(I-H);
-A.n13=(I+H)/(I-H);j.projectionMatrix=A.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(k);g.update(null,!0);g.position.copy(e.position);g.near=m;g.far=e.far;f.call(c,b,g,u,!0);j.matrix=e.matrixWorld.clone().multiplySelf(h);j.update(null,!0);j.position.copy(e.position);j.near=m;j.far=e.far;f.call(c,b,j,v,!0);f.call(c,w,t)}};
+var w=new THREE.Scene;w.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(o!==e.aspect||m!==e.near||p!==e.fov){o=e.aspect;m=e.near;p=e.fov;var A=e.projectionMatrix.clone(),I=125/30*0.5,z=I*m/125,H=m*Math.tan(p*Math.PI/360),G;h.n14=I;k.n14=-I;I=-H*o+z;G=H*o+z;A.n11=2*m/(G-I);A.n13=(G+I)/(G-I);g.projectionMatrix=A.clone();I=-H*o-z;G=H*o-z;A.n11=2*m/(G-I);
+A.n13=(G+I)/(G-I);j.projectionMatrix=A.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(k);g.update(null,!0);g.position.copy(e.position);g.near=m;g.far=e.far;f.call(c,b,g,u,!0);j.matrix=e.matrixWorld.clone().multiplySelf(h);j.update(null,!0);j.position.copy(e.position);j.near=m;j.far=e.far;f.call(c,b,j,v,!0);f.call(c,w,t)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,j,h=new THREE.Camera,k=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=b/2;j=f};this.render=function(b,e){this.clear();h.fov=e.fov;h.aspect=0.5*e.aspect;h.near=e.near;h.far=e.far;
 h.updateProjectionMatrix();h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(c.separation);k.projectionMatrix=h.projectionMatrix;k.position.copy(e.position);k.target.position.copy(e.target.position);k.translateX(-c.separation);this.setViewport(0,0,g,j);f.call(c,b,h);this.setViewport(g,0,g,j);f.call(c,b,k,!1)}};

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -54,7 +54,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){t
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(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);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=
 a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,e=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-d*e;this.y=c*a+f*e+d*g-b*h;this.z=d*a+f*h+b*e-c*g;this.w=f*a-b*g-c*e-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,e=this.y,h=this.z,
 j=this.w,l=j*c+e*f-h*d,m=j*d+h*c-g*f,i=j*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=l*j+c*-g+m*-h-i*-e;b.y=m*j+c*-e+i*-g-l*-h;b.z=i*j+c*-h+l*-e-m*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,f,g){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=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,g,e){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={constructor:THREE.UV,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.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};

+ 1 - 1
build/custom/ThreeDOM.js

@@ -54,7 +54,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){t
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(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);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=
 a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,
 j=this.w,i=j*c+f*e-h*d,k=j*d+h*c-g*e,l=j*e+g*d-f*c,c=-g*c-f*d-h*e;b.x=i*j+c*-g+k*-h-l*-f;b.y=k*j+c*-f+l*-g-i*-h;b.z=l*j+c*-h+i*-f-k*-g;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)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;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.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)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;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,g){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.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,g,f){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=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];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={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;

+ 84 - 84
build/custom/ThreeExtras.js

@@ -1,13 +1,13 @@
 // ThreeExtras.js r43 - http://github.com/mrdoob/three.js
 THREE.ColorUtils={adjustHSV:function(a,b,c,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.ColorUtils.clamp(f.h+b,0,1);f.s=THREE.ColorUtils.clamp(f.s+c,0,1);f.v=THREE.ColorUtils.clamp(f.v+e,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,e=a.g,f=a.b,h=Math.max(Math.max(c,e),f),g=Math.min(Math.min(c,e),f);if(g==h)g=c=0;else{var j=h-g,g=j/h,c=c==h?(e-f)/j:e==h?2+(f-c)/j:4+(c-e)/j;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=h;return b},
 clamp:function(a,b,c){return a<b?b:a>c?c:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,e=a.vertices.length,f=c?b.geometry:b,h=a.vertices,g=f.vertices,j=a.faces,k=f.faces,l=a.faceVertexUvs[0],f=f.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var m=0,n=g.length;m<n;m++){var o=new THREE.Vertex(g[m].position.clone());c&&b.matrix.multiplyVector3(o.position);h.push(o)}m=0;for(n=k.length;m<n;m++){var g=k[m],t,v,u=g.vertexNormals,o=g.vertexColors;g instanceof THREE.Face3?t=new THREE.Face3(g.a+e,g.b+e,g.c+
-e):g instanceof THREE.Face4&&(t=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));t.normal.copy(g.normal);c=0;for(h=u.length;c<h;c++)v=u[c],t.vertexNormals.push(v.clone());t.color.copy(g.color);c=0;for(h=o.length;c<h;c++)v=o[c],t.vertexColors.push(v.clone());t.materials=g.materials.slice();t.centroid.copy(g.centroid);j.push(t)}m=0;for(n=f.length;m<n;m++){e=f[m];j=[];c=0;for(h=e.length;c<h;c++)j.push(new THREE.UV(e[c].u,e[c].v));l.push(j)}},clone:function(a){var b=new THREE.Geometry,c,e=a.vertices,f=a.faces,
+THREE.GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,e=a.vertices.length,f=c?b.geometry:b,h=a.vertices,g=f.vertices,j=a.faces,k=f.faces,l=a.faceVertexUvs[0],f=f.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var m=0,n=g.length;m<n;m++){var o=new THREE.Vertex(g[m].position.clone());c&&b.matrix.multiplyVector3(o.position);h.push(o)}m=0;for(n=k.length;m<n;m++){var g=k[m],p,v,u=g.vertexNormals,o=g.vertexColors;g instanceof THREE.Face3?p=new THREE.Face3(g.a+e,g.b+e,g.c+
+e):g instanceof THREE.Face4&&(p=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));p.normal.copy(g.normal);c=0;for(h=u.length;c<h;c++)v=u[c],p.vertexNormals.push(v.clone());p.color.copy(g.color);c=0;for(h=o.length;c<h;c++)v=o[c],p.vertexColors.push(v.clone());p.materials=g.materials.slice();p.centroid.copy(g.centroid);j.push(p)}m=0;for(n=f.length;m<n;m++){e=f[m];j=[];c=0;for(h=e.length;c<h;c++)j.push(new THREE.UV(e[c].u,e[c].v));l.push(j)}},clone:function(a){var b=new THREE.Geometry,c,e=a.vertices,f=a.faces,
 h=a.faceVertexUvs[0],a=0;for(c=e.length;a<c;a++){var g=new THREE.Vertex(e[a].position.clone());b.vertices.push(g)}a=0;for(c=f.length;a<c;a++){var j=f[a],k,l,m=j.vertexNormals,n=j.vertexColors;j instanceof THREE.Face3?k=new THREE.Face3(j.a,j.b,j.c):j instanceof THREE.Face4&&(k=new THREE.Face4(j.a,j.b,j.c,j.d));k.normal.copy(j.normal);e=0;for(g=m.length;e<g;e++)l=m[e],k.vertexNormals.push(l.clone());k.color.copy(j.color);e=0;for(g=n.length;e<g;e++)l=n[e],k.vertexColors.push(l.clone());k.materials=j.materials.slice();
 k.centroid.copy(j.centroid);b.faces.push(k)}a=0;for(c=h.length;a<c;a++){f=h[a];k=[];e=0;for(g=f.length;e<g;e++)k.push(new THREE.UV(f[e].u,f[e].v));b.faceVertexUvs[0].push(k)}return b},randomPointInTriangle:function(a,b,c){var e,f,h,g=new THREE.Vector3,j=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();e+f>1&&(e=1-e,f=1-f);h=1-e-f;g.copy(a);g.multiplyScalar(e);j.copy(b);j.multiplyScalar(f);g.addSelf(j);j.copy(c);j.multiplyScalar(h);g.addSelf(j);return g},randomPointInFace:function(a,
 b,c){var e,f,h;if(a instanceof THREE.Face3)return e=b.vertices[a.a].position,f=b.vertices[a.b].position,h=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,f,h);else if(a instanceof THREE.Face4){e=b.vertices[a.a].position;f=b.vertices[a.b].position;h=b.vertices[a.c].position;var b=b.vertices[a.d].position,g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(e,f,b),g=THREE.GeometryUtils.triangleArea(f,h,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(e,
-f,b),g=THREE.GeometryUtils.triangleArea(f,h,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(e,f,b):THREE.GeometryUtils.randomPointInTriangle(f,h,b)}},randomPointsInGeometry:function(a,b){function c(a){function c(b,e){if(e<b)return b;var g=b+Math.floor((e-b)/2);return l[g]>a?c(b,g-1):l[g]<a?c(g+1,e):g}return c(0,l.length-1)}var e,f,h=a.faces,g=a.vertices,j=h.length,k=0,l=[],m,n,o,t;for(f=0;f<j;f++){e=h[f];if(e instanceof THREE.Face3)m=g[e.a].position,n=g[e.b].position,
-o=g[e.c].position,e._area=THREE.GeometryUtils.triangleArea(m,n,o);else if(e instanceof THREE.Face4)m=g[e.a].position,n=g[e.b].position,o=g[e.c].position,t=g[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(m,n,t),e._area2=THREE.GeometryUtils.triangleArea(n,o,t),e._area=e._area1+e._area2;k+=e._area;l[f]=k}e=[];g={};for(f=0;f<b;f++)j=THREE.GeometryUtils.random()*k,j=c(j),e[f]=THREE.GeometryUtils.randomPointInFace(h[j],a,!0),g[j]?g[j]+=1:g[j]=1;return e},triangleArea:function(a,b,c){var e,f=THREE.GeometryUtils.__v1;
+f,b),g=THREE.GeometryUtils.triangleArea(f,h,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(e,f,b):THREE.GeometryUtils.randomPointInTriangle(f,h,b)}},randomPointsInGeometry:function(a,b){function c(a){function c(b,e){if(e<b)return b;var g=b+Math.floor((e-b)/2);return l[g]>a?c(b,g-1):l[g]<a?c(g+1,e):g}return c(0,l.length-1)}var e,f,h=a.faces,g=a.vertices,j=h.length,k=0,l=[],m,n,o,p;for(f=0;f<j;f++){e=h[f];if(e instanceof THREE.Face3)m=g[e.a].position,n=g[e.b].position,
+o=g[e.c].position,e._area=THREE.GeometryUtils.triangleArea(m,n,o);else if(e instanceof THREE.Face4)m=g[e.a].position,n=g[e.b].position,o=g[e.c].position,p=g[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(m,n,p),e._area2=THREE.GeometryUtils.triangleArea(n,o,p),e._area=e._area1+e._area2;k+=e._area;l[f]=k}e=[];g={};for(f=0;f<b;f++)j=THREE.GeometryUtils.random()*k,j=c(j),e[f]=THREE.GeometryUtils.randomPointInFace(h[j],a,!0),g[j]?g[j]+=1:g[j]=1;return e},triangleArea:function(a,b,c){var e,f=THREE.GeometryUtils.__v1;
 f.sub(a,b);e=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();b=0.5*(e+a+c);return Math.sqrt(b*(b-e)*(b-a)*(b-c))},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,b,c){var e=new Image,f=new THREE.Texture(e,b);e.onload=function(){f.needsUpdate=!0;c&&c(this)};e.crossOrigin="";e.src=a;return f},loadTextureCube:function(a,b,c){var e,f=[],h=new THREE.Texture(f,b),b=f.loadCount=0;for(e=a.length;b<e;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)h.needsUpdate=!0;c&&c(this)},f[b].crossOrigin="",f[b].src=a[b];return h}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,e,f=a.children.length;for(e=0;e<f;e++)c=a.children[e],b(c),THREE.SceneUtils.traverseHierarchy(c,b)}};
@@ -30,15 +30,15 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
 THREE.Bone?f.skinMatrix:f.matrix;var h=f.animationCache.prevKey;f=f.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.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.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix: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,h,g,j,k,l,m=this.data.JIT.hierarchy,n,o;this.currentTime+=a*this.timeScale;o=this.currentTime;n=this.currentTime%=this.data.length;l=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,v=this.hierarchy.length;t<v;t++)if(a=this.hierarchy[t],k=a.animationCache,this.JITCompile&&m[t][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=m[t][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=m[t][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var u=0;u<3;u++){c=b[u];g=k.prevKey[c];j=k.nextKey[c];if(j.time<=o){if(n<o)if(this.loop){g=this.data.hierarchy[t].keys[0];for(j=this.getNextKeyWith(c,t,1);j.time<n;)g=j,j=this.getNextKeyWith(c,t,j.index+1)}else{this.stop();return}else{do g=j,j=this.getNextKeyWith(c,t,j.index+1);while(j.time<
-n)}k.prevKey[c]=g;k.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(n-g.time)/(j.time-g.time);f=g[c];h=j[c];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+t),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",t,g.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",t,j.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],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,h,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&m[0][l]===void 0){this.hierarchy[0].update(void 0,!0);for(t=0;t<this.hierarchy.length;t++)m[t][l]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,f,h,g,j,k,l,m=this.data.JIT.hierarchy,n,o;this.currentTime+=a*this.timeScale;o=this.currentTime;n=this.currentTime%=this.data.length;l=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,v=this.hierarchy.length;p<v;p++)if(a=this.hierarchy[p],k=a.animationCache,this.JITCompile&&m[p][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=m[p][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=m[p][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var u=0;u<3;u++){c=b[u];g=k.prevKey[c];j=k.nextKey[c];if(j.time<=o){if(n<o)if(this.loop){g=this.data.hierarchy[p].keys[0];for(j=this.getNextKeyWith(c,p,1);j.time<n;)g=j,j=this.getNextKeyWith(c,p,j.index+1)}else{this.stop();return}else{do g=j,j=this.getNextKeyWith(c,p,j.index+1);while(j.time<
+n)}k.prevKey[c]=g;k.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(n-g.time)/(j.time-g.time);f=g[c];h=j[c];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+p),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",p,g.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",p,j.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],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,h,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&m[0][l]===void 0){this.hierarchy[0].update(void 0,!0);for(p=0;p<this.hierarchy.length;p++)m[p][l]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],f,h,g,j,k,l;f=(a.length-1)*b;h=Math.floor(f);f-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];j=a[c[1]];k=a[c[2]];l=a[c[3]];c=f*f;g=f*c;e[0]=this.interpolate(h[0],j[0],k[0],l[0],f,c,g);e[1]=this.interpolate(h[1],j[1],k[1],l[1],f,c,g);e[2]=this.interpolate(h[2],j[2],k[2],l[2],f,c,g);return e};
 THREE.Animation.prototype.interpolate=function(a,b,c,e,f,h,g){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*g+(-3*(b-c)-2*a-e)*h+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<e.length-1?c:e.length-1:c%=e.length;c<e.length;c++)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var e=this.data.hierarchy[b].keys,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]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
-THREE.FirstPersonCamera=function(a){function b(a,b){return function(){b.apply(a,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.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
+THREE.FirstPersonCamera=function(a){function b(a,b){return function(){b.apply(a,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.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
 a.movementSpeed;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.noFly!==void 0)this.noFly=a.noFly;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.autoForward!==void 0)this.autoForward=a.autoForward;if(a.activeLook!==void 0)this.activeLook=a.activeLook;if(a.heightSpeed!==void 0)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==void 0)this.heightCoef=a.heightCoef;if(a.heightMin!==void 0)this.heightMin=a.heightMin;if(a.heightMax!==void 0)this.heightMax=a.heightMax;if(a.constrainVertical!==
 void 0)this.constrainVertical=a.constrainVertical;if(a.verticalMin!==void 0)this.verticalMin=a.verticalMin;if(a.verticalMax!==void 0)this.verticalMax=a.verticalMax;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(a){a.preventDefault();
 a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.mouseX=a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=
@@ -50,7 +50,7 @@ Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListen
 THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);if(this.noFly)b.y=0;this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};
 THREE.PathCamera=function(a){function b(a,c,b,e){var g={name:b,fps:0.6,length:e,hierarchy:[]},h,f=c.getControlPointsArray(),j=c.getLength(),k=f.length,x=0;h=k-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<k-1;h++)x=e*j.chunks[h]/j.total,c.keys[h]={time:x,pos:f[h]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var b,
 e,g=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),g.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return g}function e(a,b){var e=c(b,10),g=c(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,h);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.addChild(lineObj);particleObj.scale.set(1,1,1);a.addChild(particleObj);g=new THREE.SphereGeometry(1,
-16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)e=new THREE.Mesh(g,h),e.position.copy(b.points[i]),e.updateMatrix(),a.addChild(e)}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.lookHorizontal=
+16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)e=new THREE.Mesh(g,h),e.position.copy(b.points[i]),e.updateMatrix(),a.addChild(e)}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.lookHorizontal=
 this.lookVertical=!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!==void 0)this.duration=a.duration*1E3;if(a.waypoints!==void 0)this.waypoints=a.waypoints;if(a.useConstantSpeed!==void 0)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==void 0)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==void 0)this.createDebugPath=a.createDebugPath;if(a.createDebugDummy!==
 void 0)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==void 0)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==void 0)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==void 0)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==void 0)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 f=Math.PI*2,h=Math.PI/180;this.update=function(a,c,b){var e,g;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)*h;this.theta=this.lon*h;e=this.phi%f;this.phi=e>=0?e:e+f;e=this.verticalAngleMap.srcRange;g=this.verticalAngleMap.dstRange;var j=g[1]-g[0];this.phi=
@@ -58,7 +58,7 @@ TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(g[1]-g[0])/(e[1]-e[0])+g[0]-g
 a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),g=new THREE.MeshLambertMaterial({color:65280}),j=new THREE.CubeGeometry(10,10,20),k=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(k,g);a.position.set(0,10,0);this.animation=
 b(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=b(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(a,c){return function(){c.apply(a,arguments)}}(this,this.onMouseMove),
 !1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-THREE.FlyCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward=
+THREE.FlyCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward=
 a.autoForward;if(a.domElement!==void 0)this.domElement=a.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=
 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
 this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
@@ -68,12 +68,12 @@ this.rollSpeed;this.translateX(this.moveVector.x*a);this.translateY(this.moveVec
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
 document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,this.mouseup),!1);window.addEventListener("keydown",b(this,this.keydown),!1);window.addEventListener("keyup",b(this,
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
-THREE.RollCamera=function(a,b,c,e){THREE.Camera.call(this,a,b,c,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var f=new THREE.Vector3,h=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Matrix4,k=!1,l=1,m=0,n=0,o=0,t=0,v=0,u=window.innerWidth/2,w=window.innerHeight/2;this.update=
-function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.delta=(a-this.lastUpdate)/1E3;this.lastUpdate=a;this.mouseLook&&(a=this.delta*this.lookSpeed,this.rotateHorizontally(a*t),this.rotateVertically(a*v));a=this.delta*this.movementSpeed;this.translateZ(a*(m>0||this.autoForward&&!(m<0)?1:m));this.translateX(a*n);this.translateY(a*o);k&&(this.roll+=this.rollSpeed*this.delta*l);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+THREE.RollCamera=function(a,b,c,e){THREE.Camera.call(this,a,b,c,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var f=new THREE.Vector3,h=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Matrix4,k=!1,l=1,m=0,n=0,o=0,p=0,v=0,u=window.innerWidth/2,w=window.innerHeight/2;this.update=
+function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.delta=(a-this.lastUpdate)/1E3;this.lastUpdate=a;this.mouseLook&&(a=this.delta*this.lookSpeed,this.rotateHorizontally(a*p),this.rotateVertically(a*v));a=this.delta*this.movementSpeed;this.translateZ(a*(m>0||this.autoForward&&!(m<0)?1:m));this.translateX(a*n);this.translateY(a*o);k&&(this.roll+=this.rollSpeed*this.delta*l);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
 else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);h.set(0,1,0);f.cross(h,g).normalize();h.cross(g,f).normalize();this.matrix.n11=f.x;this.matrix.n12=h.x;this.matrix.n13=g.x;this.matrix.n21=f.y;this.matrix.n22=h.y;this.matrix.n23=g.y;this.matrix.n31=f.z;this.matrix.n32=h.z;this.matrix.n33=g.z;j.identity();j.n11=Math.cos(this.roll);j.n12=-Math.sin(this.roll);j.n21=Math.sin(this.roll);j.n22=Math.cos(this.roll);this.matrix.multiplySelf(j);
 this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(a){this.position.x+=this.matrix.n11*a;this.position.y+=this.matrix.n21*a;this.position.z+=this.matrix.n31*a};this.translateY=function(a){this.position.x+=this.matrix.n12*a;this.position.y+=this.matrix.n22*a;this.position.z+=this.matrix.n32*a};this.translateZ=function(a){this.position.x-=this.matrix.n13*a;this.position.y-=
 this.matrix.n23*a;this.position.z-=this.matrix.n33*a};this.rotateHorizontally=function(a){f.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);f.multiplyScalar(a);this.forward.subSelf(f);this.forward.normalize()};this.rotateVertically=function(a){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(a);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(a){t=(a.clientX-u)/window.innerWidth;v=(a.clientY-w)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=1;break;case 2:m=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=0;break;case 2:m=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:m=1;break;case 37:case 65:n=-1;break;
+function(a){p=(a.clientX-u)/window.innerWidth;v=(a.clientY-w)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=1;break;case 2:m=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=0;break;case 2:m=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:m=1;break;case 37:case 65:n=-1;break;
 case 40:case 83:m=-1;break;case 39:case 68:n=1;break;case 81:k=!0;l=1;break;case 69:k=!0;l=-1;break;case 82:o=1;break;case 70:o=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:m=0;break;case 37:case 65:n=0;break;case 40:case 83:m=0;break;case 39:case 68:n=0;break;case 81:k=!1;break;case 69:k=!1;break;case 82:o=0;break;case 70:o=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}a=a||{};THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.domElement=a.domElement||document;this.screen=a.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=a.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=a.rotateSpeed||1;this.zoomSpeed=a.zoomSpeed||1.2;this.panSpeed=a.panSpeed||0.3;this.noZoom=a.noZoom||!1;this.noPan=a.noPan||
@@ -113,9 +113,9 @@ THREE.Path.prototype.quadraticCurveTo=function(a,b,c,e){var f=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,b,c,e,f,h){var g=Array.prototype.slice.call(arguments),j=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(j[j.length-2],j[j.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,e),new THREE.Vector2(f,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])],c=c.concat(a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,e,f,h){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,e,f,h));this.actions.push({action:THREE.PathActions.ARC,args:g})};
 THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],e,f,h,g,j,k,l,m,n,o,t,v,u;e=0;for(f=this.actions.length;e<f;e++)switch(h=this.actions[e],g=h.action,h=h.args,g){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:j=h[2];k=h[3];n=h[0];o=h[1];c.length>0?(g=c[c.length-1],t=g.x,v=g.y):(g=this.actions[e-1].args,t=g[g.length-2],v=g[g.length-1]);for(g=1;g<=a;g++)u=g/a,h=THREE.Shape.Utils.b2(u,t,n,j),u=THREE.Shape.Utils.b2(u,v,o,
-k),c.push(new THREE.Vector2(h,u));break;case THREE.PathActions.BEZIER_CURVE_TO:j=h[4];k=h[5];n=h[0];o=h[1];l=h[2];m=h[3];c.length>0?(g=c[c.length-1],t=g.x,v=g.y):(g=this.actions[e-1].args,t=g[g.length-2],v=g[g.length-1]);for(g=1;g<=a;g++)u=g/a,h=THREE.Shape.Utils.b3(u,t,n,l,j),u=THREE.Shape.Utils.b3(u,v,o,m,k),c.push(new THREE.Vector2(h,u));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[e-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];u=a*h[0].length;g=g.concat(h[0]);h=new THREE.SplineCurve(g);
-for(g=1;g<=u;g++)c.push(h.getPointAt(g/u));break;case THREE.PathActions.ARC:g=this.actions[e-1].args;j=h[0];k=h[1];l=h[2];n=h[3];u=h[4];o=!!h[5];m=g[g.length-2];t=g[g.length-1];g.length==0&&(m=t=0);v=u-n;var w=a*2;for(g=1;g<=w;g++)u=g/w,o||(u=1-u),u=n+u*v,h=m+j+l*Math.cos(u),u=t+k+l*Math.sin(u),c.push(new THREE.Vector2(h,u))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],e,f,h,g,j,k,l,m,n,o,p,v,u;e=0;for(f=this.actions.length;e<f;e++)switch(h=this.actions[e],g=h.action,h=h.args,g){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:j=h[2];k=h[3];n=h[0];o=h[1];c.length>0?(g=c[c.length-1],p=g.x,v=g.y):(g=this.actions[e-1].args,p=g[g.length-2],v=g[g.length-1]);for(g=1;g<=a;g++)u=g/a,h=THREE.Shape.Utils.b2(u,p,n,j),u=THREE.Shape.Utils.b2(u,v,o,
+k),c.push(new THREE.Vector2(h,u));break;case THREE.PathActions.BEZIER_CURVE_TO:j=h[4];k=h[5];n=h[0];o=h[1];l=h[2];m=h[3];c.length>0?(g=c[c.length-1],p=g.x,v=g.y):(g=this.actions[e-1].args,p=g[g.length-2],v=g[g.length-1]);for(g=1;g<=a;g++)u=g/a,h=THREE.Shape.Utils.b3(u,p,n,l,j),u=THREE.Shape.Utils.b3(u,v,o,m,k),c.push(new THREE.Vector2(h,u));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[e-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];u=a*h[0].length;g=g.concat(h[0]);h=new THREE.SplineCurve(g);
+for(g=1;g<=u;g++)c.push(h.getPointAt(g/u));break;case THREE.PathActions.ARC:g=this.actions[e-1].args;j=h[0];k=h[1];l=h[2];n=h[3];u=h[4];o=!!h[5];m=g[g.length-2];p=g[g.length-1];g.length==0&&(m=p=0);v=u-n;var w=a*2;for(g=1;g<=w;g++)u=g/w,o||(u=1-u),u=n+u*v,h=m+j+l*Math.cos(u),u=p+k+l*Math.sin(u),c.push(new THREE.Vector2(h,u))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
 THREE.Path.prototype.nltransform=function(a,b,c,e,f,h){var g=this.getPoints(),j,k,l,m,n;j=0;for(k=g.length;j<k;j++)l=g[j],m=l.x,n=l.y,l.x=a*m+b*n+c,l.y=e*n+f*m+h;return g};
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,e,f,a=0;for(c=this.actions.length;a<c;a++)e=this.actions[a],f=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&b[e].apply(b,f);b.stroke();b.closePath();b.strokeStyle="red";e=
 this.getPoints();a=0;for(c=e.length;a<c;a++)f=e[a],b.beginPath(),b.arc(f.x,f.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
@@ -123,47 +123,47 @@ THREE.Path.prototype.toShapes=function(){var a,b,c,e,f=[],h=new THREE.Path;a=0;f
 e.curves):g.holes.push(e);h.push(g)}else{g=new THREE.Shape;a=0;for(b=f.length;a<b;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(g.actions=e.actions,g.curves=e.curves,h.push(g),g=new THREE.Shape):g.holes.push(e)}return h};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),e=c.concat(),f,h,g,j,k,l,m,n,o,t,v=[];for(k=0;k<b.length;k++){l=b[k];e=e.concat(l);h=Number.POSITIVE_INFINITY;for(f=0;f<l.length;f++){o=l[f];t=[];for(n=0;n<c.length;n++)m=c[n],m=o.distanceToSquared(m),t.push(m),m<h&&(h=m,g=f,j=n)}f=j-1>=0?j-1:c.length-1;h=g-1>=0?g-1:l.length-1;var u=[l[g],c[j],c[f]];n=THREE.FontUtils.Triangulate.area(u);var w=[l[g],l[h],c[j]];o=THREE.FontUtils.Triangulate.area(w);t=j;m=g;j+=1;g+=-1;j<0&&(j+=c.length);j%=
-c.length;g<0&&(g+=l.length);g%=l.length;f=j-1>=0?j-1:c.length-1;h=g-1>=0?g-1:l.length-1;u=[l[g],c[j],c[f]];u=THREE.FontUtils.Triangulate.area(u);w=[l[g],l[h],c[j]];w=THREE.FontUtils.Triangulate.area(w);n+o>u+w&&(j=t,g=m,j<0&&(j+=c.length),j%=c.length,g<0&&(g+=l.length),g%=l.length,f=j-1>=0?j-1:c.length-1,h=g-1>=0?g-1:l.length-1);n=c.slice(0,j);o=c.slice(j);t=l.slice(g);m=l.slice(0,g);h=[l[g],l[h],c[j]];v.push([l[g],c[j],c[f]]);v.push(h);c=n.concat(t).concat(m).concat(o)}return{shape:c,isolatedPts:v,
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),e=c.concat(),f,h,g,j,k,l,m,n,o,p,v=[];for(k=0;k<b.length;k++){l=b[k];e=e.concat(l);h=Number.POSITIVE_INFINITY;for(f=0;f<l.length;f++){o=l[f];p=[];for(n=0;n<c.length;n++)m=c[n],m=o.distanceToSquared(m),p.push(m),m<h&&(h=m,g=f,j=n)}f=j-1>=0?j-1:c.length-1;h=g-1>=0?g-1:l.length-1;var u=[l[g],c[j],c[f]];n=THREE.FontUtils.Triangulate.area(u);var w=[l[g],l[h],c[j]];o=THREE.FontUtils.Triangulate.area(w);p=j;m=g;j+=1;g+=-1;j<0&&(j+=c.length);j%=
+c.length;g<0&&(g+=l.length);g%=l.length;f=j-1>=0?j-1:c.length-1;h=g-1>=0?g-1:l.length-1;u=[l[g],c[j],c[f]];u=THREE.FontUtils.Triangulate.area(u);w=[l[g],l[h],c[j]];w=THREE.FontUtils.Triangulate.area(w);n+o>u+w&&(j=p,g=m,j<0&&(j+=c.length),j%=c.length,g<0&&(g+=l.length),g%=l.length,f=j-1>=0?j-1:c.length-1,h=g-1>=0?g-1:l.length-1);n=c.slice(0,j);o=c.slice(j);p=l.slice(g);m=l.slice(0,g);h=[l[g],l[h],c[j]];v.push([l[g],c[j],c[f]]);v.push(h);c=n.concat(p).concat(m).concat(o)}return{shape:c,isolatedPts:v,
 allpoints:e}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),e=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),h,g,j,k,l={};h=0;for(g=e.length;h<g;h++)k=e[h].x+":"+e[h].y,l[k]!==void 0&&console.log("Duplicate point",k),l[k]=h;h=0;for(g=c.length;h<g;h++){j=c[h];for(e=0;e<3;e++)k=j[e].x+":"+j[e].y,k=l[k],k!==void 0&&(j[e]=k)}h=0;for(g=f.length;h<g;h++){j=f[h];for(e=0;e<3;e++)k=j[e].x+":"+j[e].y,k=l[k],k!==void 0&&(j[e]=k)}return c.concat(f)},isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<
 0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,e){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,e)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,e,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,e)+this.b3p3(a,f)}};
 THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,e=b.font!==void 0?b.font:"helvetiker",f=b.weight!==void 0?b.weight:"normal",h=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=e;THREE.FontUtils.weight=f;THREE.FontUtils.style=h};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,e=a.length;c<e;c++)b=b.concat(a[c].toShapes());return b};
-THREE.CubeGeometry=function(a,b,c,e,f,h,g,j,k){function l(a,b,c,g,j,k,l,n){var t,o,v=e||1,u=f||1,E=j/2,F=k/2,L=m.vertices.length;if(a=="x"&&b=="y"||a=="y"&&b=="x")t="z";else if(a=="x"&&b=="z"||a=="z"&&b=="x")t="y",u=h||1;else if(a=="z"&&b=="y"||a=="y"&&b=="z")t="x",v=h||1;var M=v+1,O=u+1;j/=v;var Q=k/u;for(o=0;o<O;o++)for(k=0;k<M;k++){var C=new THREE.Vector3;C[a]=(k*j-E)*c;C[b]=(o*Q-F)*g;C[t]=l;m.vertices.push(new THREE.Vertex(C))}for(o=0;o<u;o++)for(k=0;k<v;k++)m.faces.push(new THREE.Face4(k+M*o+
-L,k+M*(o+1)+L,k+1+M*(o+1)+L,k+1+M*o+L,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(k/v,o/u),new THREE.UV(k/v,(o+1)/u),new THREE.UV((k+1)/v,(o+1)/u),new THREE.UV((k+1)/v,o/u)])}THREE.Geometry.call(this);var m=this,n=a/2,o=b/2,t=c/2,j=j?-1:1;if(g!==void 0)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var u in k)this.sides[u]!=void 0&&(this.sides[u]=
-k[u]);this.sides.px&&l("z","y",1*j,-1,c,b,-n,this.materials[0]);this.sides.nx&&l("z","y",-1*j,-1,c,b,n,this.materials[1]);this.sides.py&&l("x","z",1*j,1,a,c,o,this.materials[2]);this.sides.ny&&l("x","z",1*j,-1,a,c,-o,this.materials[3]);this.sides.pz&&l("x","y",1*j,-1,a,b,t,this.materials[4]);this.sides.nz&&l("x","y",-1*j,-1,a,b,-t,this.materials[5]);(function(){for(var a=[],b=[],c=0,e=m.vertices.length;c<e;c++){for(var g=m.vertices[c],h=!1,f=0,j=a.length;f<j;f++){var k=a[f];if(g.position.x==k.position.x&&
+THREE.CubeGeometry=function(a,b,c,e,f,h,g,j,k){function l(a,b,c,g,j,k,l,n){var p,o,v=e||1,u=f||1,E=j/2,K=k/2,L=m.vertices.length;if(a=="x"&&b=="y"||a=="y"&&b=="x")p="z";else if(a=="x"&&b=="z"||a=="z"&&b=="x")p="y",u=h||1;else if(a=="z"&&b=="y"||a=="y"&&b=="z")p="x",v=h||1;var F=v+1,N=u+1;j/=v;var Q=k/u;for(o=0;o<N;o++)for(k=0;k<F;k++){var C=new THREE.Vector3;C[a]=(k*j-E)*c;C[b]=(o*Q-K)*g;C[p]=l;m.vertices.push(new THREE.Vertex(C))}for(o=0;o<u;o++)for(k=0;k<v;k++)m.faces.push(new THREE.Face4(k+F*o+
+L,k+F*(o+1)+L,k+1+F*(o+1)+L,k+1+F*o+L,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(k/v,o/u),new THREE.UV(k/v,(o+1)/u),new THREE.UV((k+1)/v,(o+1)/u),new THREE.UV((k+1)/v,o/u)])}THREE.Geometry.call(this);var m=this,n=a/2,o=b/2,p=c/2,j=j?-1:1;if(g!==void 0)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var u in k)this.sides[u]!=void 0&&(this.sides[u]=
+k[u]);this.sides.px&&l("z","y",1*j,-1,c,b,-n,this.materials[0]);this.sides.nx&&l("z","y",-1*j,-1,c,b,n,this.materials[1]);this.sides.py&&l("x","z",1*j,1,a,c,o,this.materials[2]);this.sides.ny&&l("x","z",1*j,-1,a,c,-o,this.materials[3]);this.sides.pz&&l("x","y",1*j,-1,a,b,p,this.materials[4]);this.sides.nz&&l("x","y",-1*j,-1,a,b,-p,this.materials[5]);(function(){for(var a=[],b=[],c=0,e=m.vertices.length;c<e;c++){for(var g=m.vertices[c],h=!1,f=0,j=a.length;f<j;f++){var k=a[f];if(g.position.x==k.position.x&&
 g.position.y==k.position.y&&g.position.z==k.position.z){b[c]=f;h=!0;break}}if(!h)b[c]=a.length,a.push(new THREE.Vertex(g.position.clone()))}c=0;for(e=m.faces.length;c<e;c++)g=m.faces[c],g.a=b[g.a],g.b=b[g.b],g.c=b[g.c],g.d=b[g.d];m.vertices=a})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CylinderGeometry=function(a,b,c,e,f,h){function g(a,b,c){j.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}THREE.Geometry.call(this);var j=this,k,l=Math.PI*2,m=e/2;for(k=0;k<a;k++)g(Math.sin(l*k/a)*b,Math.cos(l*k/a)*b,-m);for(k=0;k<a;k++)g(Math.sin(l*k/a)*c,Math.cos(l*k/a)*c,m);for(k=0;k<a;k++)j.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(c>0){g(0,0,-m-(h||0));for(k=a;k<a+a/2;k++)j.faces.push(new THREE.Face4(2*a,(2*k-2*a)%a,(2*k-2*a+1)%a,(2*k-2*a+2)%a))}if(b>0){g(0,0,m+
 (f||0));for(k=a+a/2;k<2*a;k++)j.faces.push(new THREE.Face4(2*a+1,(2*k-2*a+2)%a+a,(2*k-2*a+1)%a+a,(2*k-2*a)%a+a))}k=0;for(a=this.faces.length;k<a;k++){var b=[],c=this.faces[k],f=this.vertices[c.a],h=this.vertices[c.b],m=this.vertices[c.c],n=this.vertices[c.d];b.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/l,0.5+f.position.z/e));b.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/l,0.5+h.position.z/e));b.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.position.y)/l,0.5+m.position.z/
-e));c instanceof THREE.Face4&&b.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/l,0.5+n.position.z/e));this.faceVertexUvs[0].push(b)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){if(typeof a!="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,e=a.length,f;for(c=0;c<e;c++)f=a[c],this.addShape(f,b)}};
-THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
+e));c instanceof THREE.Face4&&b.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/l,0.5+n.position.z/e));this.faceVertexUvs[0].push(b)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.ExtrudeGeometry=function(a,b){if(typeof a!="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,e=a.length,f;this.shapebb=a[e-1].getBoundingBox();for(c=0;c<e;c++)f=a[c],this.addShape(f,b)}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,g=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,j=THREE.ExtrudeGeometry.__v5,k=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);g.set(a.x-c.x,a.y-c.y);e=e.normalize();g=g.normalize();h.set(-e.y,e.x);f.set(g.y,-g.x);j.copy(a).addSelf(h);k.copy(a).addSelf(f);if(j.equals(k))return f.clone();
-j.copy(b).addSelf(h);k.copy(c).addSelf(f);h=e.dot(f);f=k.subSelf(j).dot(f);h==0&&(console.log("Either infinite or no solutions!"),f==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(j).subSelf(a).clone()}function f(a){for(A=a.length;--A>=0;){K=A;N=A-1;N<0&&(N=a.length-
-1);for(var b=0,b=0;b<t+m*2;b++){var c=L*b,e=L*(b+1),g=R+K+c,c=R+N+c,h=R+N+e,e=R+K+e;g+=H;c+=H;h+=H;e+=H;G.faces.push(new THREE.Face4(g,c,h,e))}}}function h(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=H;b+=H;c+=H;G.faces.push(new THREE.Face3(a,b,c))}var j=b.amount!==void 0?b.amount:100,k=b.bevelThickness!==void 0?b.bevelThickness:6,l=b.bevelSize!==void 0?b.bevelSize:k-2,m=b.bevelSegments!==void 0?b.bevelSegments:3,n=b.bevelEnabled!==void 0?b.bevelEnabled:
-!0,o=b.curveSegments!==void 0?b.curveSegments:12,t=b.steps!==void 0?b.steps:1,v=b.bendPath,u=b.extrudePath,w,y=!1,x=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1;if(u)w=u.getPoints(o),t=w.length,y=!0,n=!1;n||(l=k=m=0);var p,z,B,G=this,H=this.vertices.length;v&&a.addWrapPath(v);o=x?a.extractAllSpacedPoints(o):a.extractAllPoints(o);v=o.shape;o=o.holes;if(u=!THREE.Shape.Utils.isClockWise(v)){v=v.reverse();z=0;for(B=o.length;z<B;z++)p=o[z],THREE.Shape.Utils.isClockWise(p)&&(o[z]=p.reverse());u=!1}u=
-THREE.Shape.Utils.triangulateShape(v,o);x=v;z=0;for(B=o.length;z<B;z++)p=o[z],v=v.concat(p);var A,D,J,I,E,F,L=v.length,M=u.length,O=[];A=0;D=x.length;K=D-1;for(N=A+1;A<D;A++,K++,N++)K==D&&(K=0),N==D&&(N=0),O[A]=e(x[A],x[K],x[N]);var Q=[],C,P=O.concat();z=0;for(B=o.length;z<B;z++){p=o[z];C=[];A=0;D=p.length;K=D-1;for(N=A+1;A<D;A++,K++,N++)K==D&&(K=0),N==D&&(N=0),C[A]=e(p[A],p[K],p[N]);Q.push(C);P=P.concat(C)}for(J=0;J<m;J++){I=J/m;E=k*(1-I);I=l*Math.sin(I*Math.PI/2);A=0;for(D=x.length;A<D;A++)F=c(x[A],
-O[A],I),h(F.x,F.y,-E);z=0;for(B=o.length;z<B;z++){p=o[z];C=Q[z];A=0;for(D=p.length;A<D;A++)F=c(p[A],C[A],I),h(F.x,F.y,-E)}}I=l;for(A=0;A<L;A++)F=n?c(v[A],P[A],I):v[A],y?h(F.x,F.y+w[0].y,w[0].x):h(F.x,F.y,0);for(J=1;J<=t;J++)for(A=0;A<L;A++)F=n?c(v[A],P[A],I):v[A],y?h(F.x,F.y+w[J-1].y,w[J-1].x):h(F.x,F.y,j/t*J);for(J=m-1;J>=0;J--){I=J/m;E=k*(1-I);I=l*Math.sin(I*Math.PI/2);A=0;for(D=x.length;A<D;A++)F=c(x[A],O[A],I),h(F.x,F.y,j+E);z=0;for(B=o.length;z<B;z++){p=o[z];C=Q[z];A=0;for(D=p.length;A<D;A++)F=
-c(p[A],C[A],I),y?h(F.x,F.y+w[t-1].y,w[t-1].x+E):h(F.x,F.y,j+E)}}if(n){k=L*0;for(A=0;A<M;A++)j=u[A],g(j[2]+k,j[1]+k,j[0]+k);k=L*(t+m*2);for(A=0;A<M;A++)j=u[A],g(j[0]+k,j[1]+k,j[2]+k)}else{for(A=0;A<M;A++)j=u[A],g(j[2],j[1],j[0]);for(A=0;A<M;A++)j=u[A],g(j[0]+L*t,j[1]+L*t,j[2]+L*t)}var K,N,R=0;f(x);R+=x.length;z=0;for(B=o.length;z<B;z++)p=o[z],f(p),R+=p.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
-THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
+j.copy(b).addSelf(h);k.copy(c).addSelf(f);h=e.dot(f);f=k.subSelf(j).dot(f);h==0&&(console.log("Either infinite or no solutions!"),f==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(j).subSelf(a).clone()}function f(a){for(z=a.length;--z>=0;){O=z;P=z-1;P<0&&(P=a.length-
+1);for(var b=0,b=0;b<p+m*2;b++){var c=N*b,e=N*(b+1),g=T+O+c,c=T+P+c,h=T+P+e,e=T+O+e;g+=G;c+=G;h+=G;e+=G;I.faces.push(new THREE.Face4(g,c,h,e))}}}function h(a,b,c){I.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=G;b+=G;c+=G;I.faces.push(new THREE.Face3(a,b,c,null,null,t));I.faceVertexUvs[0].push([new THREE.UV(I.vertices[a].x/B.maxX,I.vertices[a].y/B.maxY),new THREE.UV(I.vertices[b].x/B.maxX,I.vertices[b].y/B.maxY),new THREE.UV(I.vertices[c].x/B.maxX,I.vertices[c].y/
+B.maxY)])}var j=b.amount!==void 0?b.amount:100,k=b.bevelThickness!==void 0?b.bevelThickness:6,l=b.bevelSize!==void 0?b.bevelSize:k-2,m=b.bevelSegments!==void 0?b.bevelSegments:3,n=b.bevelEnabled!==void 0?b.bevelEnabled:!0,o=b.curveSegments!==void 0?b.curveSegments:12,p=b.steps!==void 0?b.steps:1,v=b.bendPath,u=b.extrudePath,w,y=!1,x=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,t=b.material,B=this.shapebb;console.log(B);if(u)w=u.getPoints(o),p=w.length,y=!0,n=!1;n||(l=k=m=0);var A,D,H,I=this,G=
+this.vertices.length;v&&a.addWrapPath(v);o=x?a.extractAllSpacedPoints(o):a.extractAllPoints(o);v=o.shape;o=o.holes;if(u=!THREE.Shape.Utils.isClockWise(v)){v=v.reverse();D=0;for(H=o.length;D<H;D++)A=o[D],THREE.Shape.Utils.isClockWise(A)&&(o[D]=A.reverse());u=!1}u=THREE.Shape.Utils.triangulateShape(v,o);x=v;D=0;for(H=o.length;D<H;D++)A=o[D],v=v.concat(A);var z,J,E,K,L,F,N=v.length,Q=u.length,C=[];z=0;J=x.length;O=J-1;for(P=z+1;z<J;z++,O++,P++)O==J&&(O=0),P==J&&(P=0),C[z]=e(x[z],x[O],x[P]);var R=[],
+M,S=C.concat();D=0;for(H=o.length;D<H;D++){A=o[D];M=[];z=0;J=A.length;O=J-1;for(P=z+1;z<J;z++,O++,P++)O==J&&(O=0),P==J&&(P=0),M[z]=e(A[z],A[O],A[P]);R.push(M);S=S.concat(M)}for(E=0;E<m;E++){K=E/m;L=k*(1-K);K=l*Math.sin(K*Math.PI/2);z=0;for(J=x.length;z<J;z++)F=c(x[z],C[z],K),h(F.x,F.y,-L);D=0;for(H=o.length;D<H;D++){A=o[D];M=R[D];z=0;for(J=A.length;z<J;z++)F=c(A[z],M[z],K),h(F.x,F.y,-L)}}K=l;for(z=0;z<N;z++)F=n?c(v[z],S[z],K):v[z],y?h(F.x,F.y+w[0].y,w[0].x):h(F.x,F.y,0);for(E=1;E<=p;E++)for(z=0;z<
+N;z++)F=n?c(v[z],S[z],K):v[z],y?h(F.x,F.y+w[E-1].y,w[E-1].x):h(F.x,F.y,j/p*E);for(E=m-1;E>=0;E--){K=E/m;L=k*(1-K);K=l*Math.sin(K*Math.PI/2);z=0;for(J=x.length;z<J;z++)F=c(x[z],C[z],K),h(F.x,F.y,j+L);D=0;for(H=o.length;D<H;D++){A=o[D];M=R[D];z=0;for(J=A.length;z<J;z++)F=c(A[z],M[z],K),y?h(F.x,F.y+w[p-1].y,w[p-1].x+L):h(F.x,F.y,j+L)}}if(n){k=N*0;for(z=0;z<Q;z++)j=u[z],g(j[2]+k,j[1]+k,j[0]+k);k=N*(p+m*2);for(z=0;z<Q;z++)j=u[z],g(j[0]+k,j[1]+k,j[2]+k)}else{for(z=0;z<Q;z++)j=u[z],g(j[2],j[1],j[0]);for(z=
+0;z<Q;z++)j=u[z],g(j[0]+N*p,j[1]+N*p,j[2]+N*p)}var O,P,T=0;f(x);T+=x.length;D=0;for(H=o.length;D<H;D++)A=o[D],f(A),T+=A.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function b(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function c(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,c){var e=f.vertices[a].position,g=f.vertices[c].position;return b((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,
 -a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(var g=0;g<this.subdivisions;g++){var a=new THREE.Geometry,j;for(j in h.faces){var k=e(h.faces[j].a,h.faces[j].b),l=e(h.faces[j].b,h.faces[j].c),m=e(h.faces[j].c,h.faces[j].a);c(h.faces[j].a,k,m,a);c(h.faces[j].b,l,
 k,a);c(h.faces[j].c,m,l,a);c(k,l,m,a)}h.faces=a.faces}f.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],e=[],f=[],h=[],g=(new THREE.Matrix4).setRotationZ(b),j=0;j<a.length;j++)this.vertices.push(new THREE.Vertex(a[j])),c[j]=a[j].clone(),e[j]=this.vertices.length-1;for(var k=0;k<=this.angle+0.001;k+=b){for(j=0;j<c.length;j++)k<this.angle?(c[j]=g.multiplyVector3(c[j].clone()),this.vertices.push(new THREE.Vertex(c[j])),f[j]=this.vertices.length-1):f=h;k==0&&(h=e);
+THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],e=[],f=[],h=[],g=(new THREE.Matrix4).setRotationZ(b),j=0;j<a.length;j++)this.vertices.push(new THREE.Vertex(a[j])),c[j]=a[j].clone(),e[j]=this.vertices.length-1;for(var k=0;k<=this.angle+0.0010;k+=b){for(j=0;j<c.length;j++)k<this.angle?(c[j]=g.multiplyVector3(c[j].clone()),this.vertices.push(new THREE.Vertex(c[j])),f[j]=this.vertices.length-1):f=h;k==0&&(h=e);
 for(j=0;j<e.length-1;j++)this.faces.push(new THREE.Face4(f[j],f[j+1],e[j+1],e[j])),this.faceVertexUvs[0].push([new THREE.UV(1-k/this.angle,j/a.length),new THREE.UV(1-k/this.angle,(j+1)/a.length),new THREE.UV(1-(k-b)/this.angle,(j+1)/a.length),new THREE.UV(1-(k-b)/this.angle,j/a.length)]);e=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.PlaneGeometry=function(a,b,c,e){THREE.Geometry.call(this);var f,h=a/2,g=b/2,c=c||1,e=e||1,j=c+1,k=e+1;a/=c;var l=b/e;for(f=0;f<k;f++)for(b=0;b<j;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-h,-(f*l-g),0)));for(f=0;f<e;f++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+j*f,b+j*(f+1),b+1+j*(f+1),b+1+j*f)),this.faceVertexUvs[0].push([new THREE.UV(b/c,f/e),new THREE.UV(b/c,(f+1)/e),new THREE.UV((b+1)/c,(f+1)/e),new THREE.UV((b+1)/c,f/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c){THREE.Geometry.call(this);for(var a=a||50,e,f=Math.PI,h=Math.max(3,b||8),g=Math.max(2,c||6),b=[],c=0;c<g+1;c++){e=c/g;var j=a*Math.cos(e*f),k=a*Math.sin(e*f),l=[],m=0;for(e=0;e<h;e++){var n=2*e/h,o=k*Math.sin(n*f),n=k*Math.cos(n*f);(c==0||c==g)&&e>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,j,o)))-1);l.push(m)}b.push(l)}for(var t,v,u,f=b.length,c=0;c<f;c++)if(h=b[c].length,c>0)for(e=0;e<h;e++){l=e==h-1;g=b[c][l?0:e+1];j=b[c][l?h-1:e];k=b[c-1][l?
-h-1:e];l=b[c-1][l?0:e+1];o=c/(f-1);t=(c-1)/(f-1);v=(e+1)/h;var n=e/h,m=new THREE.UV(1-v,o),o=new THREE.UV(1-n,o),n=new THREE.UV(1-n,t),w=new THREE.UV(1-v,t);c<b.length-1&&(t=this.vertices[g].position.clone(),v=this.vertices[j].position.clone(),u=this.vertices[k].position.clone(),t.normalize(),v.normalize(),u.normalize(),this.faces.push(new THREE.Face3(g,j,k,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(u.x,u.y,u.z)])),this.faceVertexUvs[0].push([m,o,n]));c>1&&(t=
-this.vertices[g].position.clone(),v=this.vertices[k].position.clone(),u=this.vertices[l].position.clone(),t.normalize(),v.normalize(),u.normalize(),this.faces.push(new THREE.Face3(g,k,l,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(u.x,u.y,u.z)])),this.faceVertexUvs[0].push([m,n,w]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(a,b,c){THREE.Geometry.call(this);for(var a=a||50,e,f=Math.PI,h=Math.max(3,b||8),g=Math.max(2,c||6),b=[],c=0;c<g+1;c++){e=c/g;var j=a*Math.cos(e*f),k=a*Math.sin(e*f),l=[],m=0;for(e=0;e<h;e++){var n=2*e/h,o=k*Math.sin(n*f),n=k*Math.cos(n*f);(c==0||c==g)&&e>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,j,o)))-1);l.push(m)}b.push(l)}for(var p,v,u,f=b.length,c=0;c<f;c++)if(h=b[c].length,c>0)for(e=0;e<h;e++){l=e==h-1;g=b[c][l?0:e+1];j=b[c][l?h-1:e];k=b[c-1][l?
+h-1:e];l=b[c-1][l?0:e+1];o=c/(f-1);p=(c-1)/(f-1);v=(e+1)/h;var n=e/h,m=new THREE.UV(1-v,o),o=new THREE.UV(1-n,o),n=new THREE.UV(1-n,p),w=new THREE.UV(1-v,p);c<b.length-1&&(p=this.vertices[g].position.clone(),v=this.vertices[j].position.clone(),u=this.vertices[k].position.clone(),p.normalize(),v.normalize(),u.normalize(),this.faces.push(new THREE.Face3(g,j,k,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(u.x,u.y,u.z)])),this.faceVertexUvs[0].push([m,o,n]));c>1&&(p=
+this.vertices[g].position.clone(),v=this.vertices[k].position.clone(),u=this.vertices[l].position.clone(),p.normalize(),v.normalize(),u.normalize(),this.faces.push(new THREE.Face3(g,k,l,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(u.x,u.y,u.z)])),this.faceVertexUvs[0].push([m,n,w]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var e=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,b){return(new TextPath(a,b)).toShapes()},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=
-this.getFace(),c=this.size/b.resolution,e=0,f=String(a).split(""),h=f.length,g=[],a=0;a<h;a++){var j=new THREE.Path,j=this.extractGlyphPoints(f[a],b,c,e,j);e+=j.offset;g.push(j.path)}return{paths:g,offset:e/2}},extractGlyphPoints:function(a,b,c,e,f){var h=[],g,j,k,l,m,n,o,t,v,u,w=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(w){if(w.o){b=w._cachedOutline||(w._cachedOutline=w.o.split(" "));k=b.length;for(a=0;a<k;)switch(j=b[a++],j){case "m":j=b[a++]*c+e;l=b[a++]*c;h.push(new THREE.Vector2(j,
-l));f.moveTo(j,l);break;case "l":j=b[a++]*c+e;l=b[a++]*c;h.push(new THREE.Vector2(j,l));f.lineTo(j,l);break;case "q":j=b[a++]*c+e;l=b[a++]*c;o=b[a++]*c+e;t=b[a++]*c;f.quadraticCurveTo(o,t,j,l);if(g=h[h.length-1]){m=g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var y=g/divisions,x=THREE.Shape.Utils.b2(y,m,o,j),y=THREE.Shape.Utils.b2(y,n,t,l);h.push(new THREE.Vector2(x,y))}}break;case "b":if(j=b[a++]*c+e,l=b[a++]*c,o=b[a++]*c+e,t=b[a++]*-c,v=b[a++]*c+e,u=b[a++]*-c,f.bezierCurveTo(j,l,
-o,t,v,u),g=h[h.length-1]){m=g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)y=g/divisions,x=THREE.Shape.Utils.b3(y,m,o,v,j),y=THREE.Shape.Utils.b3(y,n,t,u,l),h.push(new THREE.Vector2(x,y))}}}return{offset:w.ha*c,points:h,path:f}}}};
-(function(a){var b=function(a){for(var b=a.length,f=0,h=b-1,g=0;g<b;h=g++)f+=a[h].x*a[g].y-a[g].x*a[h].y;return f*0.5};a.Triangulate=function(a,e){var f=a.length;if(f<3)return null;var h=[],g=[],j=[],k,l,m;if(b(a)>0)for(l=0;l<f;l++)g[l]=l;else for(l=0;l<f;l++)g[l]=f-1-l;var n=2*f;for(l=f-1;f>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return j;return h}k=l;f<=k&&(k=0);l=k+1;f<=l&&(l=0);m=l+1;f<=m&&(m=0);var o;a:{o=a;var t=k,v=l,u=m,w=f,y=g,x=void 0,p=void 0,z=void 0,
-B=void 0,G=void 0,H=void 0,A=void 0,D=void 0,J=void 0,p=o[y[t]].x,z=o[y[t]].y,B=o[y[v]].x,G=o[y[v]].y,H=o[y[u]].x,A=o[y[u]].y;if(1.0E-10>(B-p)*(A-z)-(G-z)*(H-p))o=!1;else{for(x=0;x<w;x++)if(!(x==t||x==v||x==u)){var D=o[y[x]].x,J=o[y[x]].y,I=void 0,E=void 0,F=void 0,L=void 0,M=void 0,O=void 0,Q=void 0,C=void 0,P=void 0,K=void 0,N=void 0,R=void 0,I=F=M=void 0,I=H-B,E=A-G,F=p-H,L=z-A,M=B-p,O=G-z,Q=D-p,C=J-z,P=D-B,K=J-G,N=D-H,R=J-A,I=I*K-E*P,M=M*C-O*Q,F=F*R-L*N;if(I>=0&&F>=0&&M>=0){o=!1;break a}}o=!0}}if(o){h.push([a[g[k]],
+this.getFace(),c=this.size/b.resolution,e=0,f=String(a).split(""),h=f.length,g=[],a=0;a<h;a++){var j=new THREE.Path,j=this.extractGlyphPoints(f[a],b,c,e,j);e+=j.offset;g.push(j.path)}return{paths:g,offset:e/2}},extractGlyphPoints:function(a,b,c,e,f){var h=[],g,j,k,l,m,n,o,p,v,u,w=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(w){if(w.o){b=w._cachedOutline||(w._cachedOutline=w.o.split(" "));k=b.length;for(a=0;a<k;)switch(j=b[a++],j){case "m":j=b[a++]*c+e;l=b[a++]*c;h.push(new THREE.Vector2(j,
+l));f.moveTo(j,l);break;case "l":j=b[a++]*c+e;l=b[a++]*c;h.push(new THREE.Vector2(j,l));f.lineTo(j,l);break;case "q":j=b[a++]*c+e;l=b[a++]*c;o=b[a++]*c+e;p=b[a++]*c;f.quadraticCurveTo(o,p,j,l);if(g=h[h.length-1]){m=g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var y=g/divisions,x=THREE.Shape.Utils.b2(y,m,o,j),y=THREE.Shape.Utils.b2(y,n,p,l);h.push(new THREE.Vector2(x,y))}}break;case "b":if(j=b[a++]*c+e,l=b[a++]*c,o=b[a++]*c+e,p=b[a++]*-c,v=b[a++]*c+e,u=b[a++]*-c,f.bezierCurveTo(j,l,
+o,p,v,u),g=h[h.length-1]){m=g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)y=g/divisions,x=THREE.Shape.Utils.b3(y,m,o,v,j),y=THREE.Shape.Utils.b3(y,n,p,u,l),h.push(new THREE.Vector2(x,y))}}}return{offset:w.ha*c,points:h,path:f}}}};
+(function(a){var b=function(a){for(var b=a.length,f=0,h=b-1,g=0;g<b;h=g++)f+=a[h].x*a[g].y-a[g].x*a[h].y;return f*0.5};a.Triangulate=function(a,e){var f=a.length;if(f<3)return null;var h=[],g=[],j=[],k,l,m;if(b(a)>0)for(l=0;l<f;l++)g[l]=l;else for(l=0;l<f;l++)g[l]=f-1-l;var n=2*f;for(l=f-1;f>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return j;return h}k=l;f<=k&&(k=0);l=k+1;f<=l&&(l=0);m=l+1;f<=m&&(m=0);var o;a:{o=a;var p=k,v=l,u=m,w=f,y=g,x=void 0,t=void 0,B=void 0,
+A=void 0,D=void 0,H=void 0,I=void 0,G=void 0,z=void 0,t=o[y[p]].x,B=o[y[p]].y,A=o[y[v]].x,D=o[y[v]].y,H=o[y[u]].x,I=o[y[u]].y;if(1.0E-10>(A-t)*(I-B)-(D-B)*(H-t))o=!1;else{for(x=0;x<w;x++)if(!(x==p||x==v||x==u)){var G=o[y[x]].x,z=o[y[x]].y,J=void 0,E=void 0,K=void 0,L=void 0,F=void 0,N=void 0,Q=void 0,C=void 0,R=void 0,M=void 0,S=void 0,O=void 0,J=K=F=void 0,J=H-A,E=I-D,K=t-H,L=B-I,F=A-t,N=D-B,Q=G-t,C=z-B,R=G-A,M=z-D,S=G-H,O=z-I,J=J*M-E*R,F=F*C-N*Q,K=K*O-L*S;if(J>=0&&K>=0&&F>=0){o=!1;break a}}o=!0}}if(o){h.push([a[g[k]],
 a[g[l]],a[g[m]]]);j.push([g[k],g[l],g[m]]);k=l;for(m=l+1;m<f;k++,m++)g[k]=g[m];f--;n=2*f}}if(e)return j;return h};a.Triangulate.area=b;return a})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;a=[];for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){var e=c/this.segmentsT*2*Math.PI,f=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
 1;c<=this.segmentsT;++c){var e=(this.segmentsT+1)*b+c,f=(this.segmentsT+1)*b+c-1,h=(this.segmentsT+1)*(b-1)+c-1,g=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(e,f,h,g));this.faceVertexUvs[0].push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[g][0],a[g][1])])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
@@ -181,62 +181,62 @@ else if(a.DbgColor)g.color=a.DbgColor;if(a.colorSpecular)g.specular=h(a.colorSpe
 a.mapSpecular&&b&&f(g,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,m=THREE.UniformsUtils.clone(l.uniforms),n=g.color;j=g.specular;k=g.ambient;var o=g.shininess;m.tNormal.texture=g.normalMap;if(a.mapNormalFactor)m.uNormalScale.value=a.mapNormalFactor;if(g.map)m.tDiffuse.texture=g.map,m.enableDiffuse.value=!0;if(g.specularMap)m.tSpecular.texture=g.specularMap,m.enableSpecular.value=!0;if(g.lightMap)m.tAO.texture=
 g.lightMap,m.enableAO.value=!0;m.uDiffuseColor.value.setHex(n);m.uSpecularColor.value.setHex(j);m.uAmbientColor.value.setHex(k);m.uShininess.value=o;if(g.opacity)m.uOpacity.value=g.opacity;g=new THREE.MeshShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:m,lights:!0,fog:!0})}else g=new THREE[j](g);return g},constructor:THREE.Loader};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;
 THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var b=this,c=a.model,e=a.callback,f=a.texture_path?a.texture_path:this.extractUrlbase(c),a=new Worker(c);a.onmessage=function(a){b.createModel(a.data,e,f);b.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,c);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,f,k,l,m,n,o,t,v,u,w,y,x,p,z=a.faces;n=a.vertices;var B=a.normals,G=a.colors,H=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&H++;for(c=0;c<H;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];l=0;for(m=n.length;l<m;)o=new THREE.Vertex,o.position.x=n[l++]*b,o.position.y=
-n[l++]*b,o.position.z=n[l++]*b,e.vertices.push(o);l=0;for(m=z.length;l<m;){b=z[l++];n=b&1;k=b&2;c=b&4;f=b&8;t=b&16;o=b&32;u=b&64;b&=128;n?(w=new THREE.Face4,w.a=z[l++],w.b=z[l++],w.c=z[l++],w.d=z[l++],n=4):(w=new THREE.Face3,w.a=z[l++],w.b=z[l++],w.c=z[l++],n=3);if(k)k=z[l++],w.materials=e.materials[k];k=e.faces.length;if(c)for(c=0;c<H;c++)y=a.uvs[c],v=z[l++],p=y[v*2],v=y[v*2+1],e.faceUvs[c][k]=new THREE.UV(p,v);if(f)for(c=0;c<H;c++){y=a.uvs[c];x=[];for(f=0;f<n;f++)v=z[l++],p=y[v*2],v=y[v*2+1],x[f]=
-new THREE.UV(p,v);e.faceVertexUvs[c][k]=x}if(t)t=z[l++]*3,f=new THREE.Vector3,f.x=B[t++],f.y=B[t++],f.z=B[t],w.normal=f;if(o)for(c=0;c<n;c++)t=z[l++]*3,f=new THREE.Vector3,f.x=B[t++],f.y=B[t++],f.z=B[t],w.vertexNormals.push(f);if(u)o=z[l++],o=new THREE.Color(G[o]),w.color=o;if(b)for(c=0;c<n;c++)o=z[l++],o=new THREE.Color(G[o]),w.vertexColors.push(o);e.faces.push(w)}}})(f);(function(){var b,c,f,k;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)f=a.skinWeights[b],k=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(f,
-k,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)f=a.skinIndices[b],k=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(f,k,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,k,l,m,n,o,t,v;c=0;for(f=a.morphTargets.length;c<f;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];t=e.morphTargets[c].vertices;v=a.morphTargets[c].vertices;k=0;for(l=v.length;k<l;k+=3)m=v[k]*b,n=v[k+1]*
-b,o=v[k+2]*b,t.push(new THREE.Vertex(new THREE.Vector3(m,n,o)))}}if(a.morphColors!==void 0){c=0;for(f=a.morphColors.length;c<f;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];l=e.morphColors[c].colors;m=a.morphColors[c].colors;b=0;for(k=m.length;b<k;b+=3)n=new THREE.Color(16755200),n.setRGB(m[b],m[b+1],m[b+2]),l.push(n)}}})(f);(function(){if(a.edges!==void 0){var b,c,f;for(b=0;b<a.edges.length;b+=2)c=a.edges[b],f=a.edges[b+1],e.edges.push(new THREE.Edge(e.vertices[c],
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,c);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,f,k,l,m,n,o,p,v,u,w,y,x,t,B=a.faces;n=a.vertices;var A=a.normals,D=a.colors,H=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&H++;for(c=0;c<H;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];l=0;for(m=n.length;l<m;)o=new THREE.Vertex,o.position.x=n[l++]*b,o.position.y=
+n[l++]*b,o.position.z=n[l++]*b,e.vertices.push(o);l=0;for(m=B.length;l<m;){b=B[l++];n=b&1;k=b&2;c=b&4;f=b&8;p=b&16;o=b&32;u=b&64;b&=128;n?(w=new THREE.Face4,w.a=B[l++],w.b=B[l++],w.c=B[l++],w.d=B[l++],n=4):(w=new THREE.Face3,w.a=B[l++],w.b=B[l++],w.c=B[l++],n=3);if(k)k=B[l++],w.materials=e.materials[k];k=e.faces.length;if(c)for(c=0;c<H;c++)y=a.uvs[c],v=B[l++],t=y[v*2],v=y[v*2+1],e.faceUvs[c][k]=new THREE.UV(t,v);if(f)for(c=0;c<H;c++){y=a.uvs[c];x=[];for(f=0;f<n;f++)v=B[l++],t=y[v*2],v=y[v*2+1],x[f]=
+new THREE.UV(t,v);e.faceVertexUvs[c][k]=x}if(p)p=B[l++]*3,f=new THREE.Vector3,f.x=A[p++],f.y=A[p++],f.z=A[p],w.normal=f;if(o)for(c=0;c<n;c++)p=B[l++]*3,f=new THREE.Vector3,f.x=A[p++],f.y=A[p++],f.z=A[p],w.vertexNormals.push(f);if(u)o=B[l++],o=new THREE.Color(D[o]),w.color=o;if(b)for(c=0;c<n;c++)o=B[l++],o=new THREE.Color(D[o]),w.vertexColors.push(o);e.faces.push(w)}}})(f);(function(){var b,c,f,k;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)f=a.skinWeights[b],k=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(f,
+k,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)f=a.skinIndices[b],k=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(f,k,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,k,l,m,n,o,p,v;c=0;for(f=a.morphTargets.length;c<f;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];p=e.morphTargets[c].vertices;v=a.morphTargets[c].vertices;k=0;for(l=v.length;k<l;k+=3)m=v[k]*b,n=v[k+1]*
+b,o=v[k+2]*b,p.push(new THREE.Vertex(new THREE.Vector3(m,n,o)))}}if(a.morphColors!==void 0){c=0;for(f=a.morphColors.length;c<f;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];l=e.morphColors[c].colors;m=a.morphColors[c].colors;b=0;for(k=m.length;b<k;b+=3)n=new THREE.Color(16755200),n.setRGB(m[b],m[b+1],m[b+2]),l.push(n)}}})(f);(function(){if(a.edges!==void 0){var b,c,f;for(b=0;b<a.edges.length;b+=2)c=a.edges[b],f=a.edges[b+1],e.edges.push(new THREE.Edge(e.vertices[c],
 e.vertices[f],c,f))}})();e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();b(e)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype={load:function(a){var b=a.model,c=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b),a=(new Date).getTime(),b=new Worker(b),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,c,f,e,h)};b.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
 b.postMessage(a)},loadAjaxBuffers:function(a,b,c,e,f,h){var g=new XMLHttpRequest,j=e+"/"+a,k=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,c,f,b):alert("Couldn't load ["+j+"] ["+g.status+"]"):g.readyState==3?h&&(k==0&&(k=g.getResponseHeader("Content-Length")),h({total:k,loaded:g.responseText.length})):g.readyState==2&&(k=g.getResponseHeader("Content-Length"))};g.open("GET",j,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
 g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,b,c,e){var f=function(b){function c(a,b){var e=m(a,b),f=m(a,b+1),g=m(a,b+2),h=m(a,b+3),j=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function f(a,b){var c=m(a,b),e=m(a,b+1),g=m(a,b+2);return(m(a,b+3)<<24)+(g<<16)+(e<<8)+c}function k(a,b){var c=m(a,b);return(m(a,b+1)<<8)+c}function l(a,b){var c=m(a,b);return c>127?c-256:c}function m(a,
-b){return a.charCodeAt(b)&255}function n(b){var c,e,g;c=f(a,b);e=f(a,b+G);g=f(a,b+H);b=k(a,b+A);THREE.BinaryLoader.prototype.f3(y,c,e,g,b)}function o(b){var c,e,g,h,l,m;c=f(a,b);e=f(a,b+G);g=f(a,b+H);h=k(a,b+A);l=f(a,b+D);m=f(a,b+J);b=f(a,b+I);THREE.BinaryLoader.prototype.f3n(y,z,c,e,g,h,l,m,b)}function t(b){var c,e,g,h;c=f(a,b);e=f(a,b+E);g=f(a,b+F);h=f(a,b+L);b=k(a,b+M);THREE.BinaryLoader.prototype.f4(y,c,e,g,h,b)}function v(b){var c,e,g,h,l,m,n,o;c=f(a,b);e=f(a,b+E);g=f(a,b+F);h=f(a,b+L);l=k(a,
-b+M);m=f(a,b+O);n=f(a,b+Q);o=f(a,b+C);b=f(a,b+P);THREE.BinaryLoader.prototype.f4n(y,z,c,e,g,h,l,m,n,o,b)}function u(b){var c,e;c=f(a,b);e=f(a,b+K);b=f(a,b+N);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],B[c*2],B[c*2+1],B[e*2],B[e*2+1],B[b*2],B[b*2+1])}function w(b){var c,e,g;c=f(a,b);e=f(a,b+R);g=f(a,b+Y);b=f(a,b+Z);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],B[c*2],B[c*2+1],B[e*2],B[e*2+1],B[g*2],B[g*2+1],B[b*2],B[b*2+1])}var y=this,x=0,p,z=[],B=[],G,H,A,D,J,I,E,F,L,M,O,Q,C,P,K,N,
-R,Y,Z,T,U,V,W,X,S;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,e,b);p={signature:a.substr(x,8),header_bytes:m(a,x+8),vertex_coordinate_bytes:m(a,x+9),normal_coordinate_bytes:m(a,x+10),uv_coordinate_bytes:m(a,x+11),vertex_index_bytes:m(a,x+12),normal_index_bytes:m(a,x+13),uv_index_bytes:m(a,x+14),material_index_bytes:m(a,x+15),nvertices:f(a,x+16),nnormals:f(a,x+16+4),nuvs:f(a,x+16+8),ntri_flat:f(a,x+16+12),ntri_smooth:f(a,x+16+16),ntri_flat_uv:f(a,x+16+20),ntri_smooth_uv:f(a,x+
-16+24),nquad_flat:f(a,x+16+28),nquad_smooth:f(a,x+16+32),nquad_flat_uv:f(a,x+16+36),nquad_smooth_uv:f(a,x+16+40)};x+=p.header_bytes;G=p.vertex_index_bytes;H=p.vertex_index_bytes*2;A=p.vertex_index_bytes*3;D=p.vertex_index_bytes*3+p.material_index_bytes;J=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes;I=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*2;E=p.vertex_index_bytes;F=p.vertex_index_bytes*2;L=p.vertex_index_bytes*3;M=p.vertex_index_bytes*4;O=p.vertex_index_bytes*
-4+p.material_index_bytes;Q=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes;C=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*2;P=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*3;K=p.uv_index_bytes;N=p.uv_index_bytes*2;R=p.uv_index_bytes;Y=p.uv_index_bytes*2;Z=p.uv_index_bytes*3;b=p.vertex_index_bytes*3+p.material_index_bytes;S=p.vertex_index_bytes*4+p.material_index_bytes;T=p.ntri_flat*b;U=p.ntri_smooth*(b+p.normal_index_bytes*3);V=p.ntri_flat_uv*
-(b+p.uv_index_bytes*3);W=p.ntri_smooth_uv*(b+p.normal_index_bytes*3+p.uv_index_bytes*3);X=p.nquad_flat*S;b=p.nquad_smooth*(S+p.normal_index_bytes*4);S=p.nquad_flat_uv*(S+p.uv_index_bytes*4);x+=function(b){for(var e,f,h,j=p.vertex_coordinate_bytes*3,k=b+p.nvertices*j;b<k;b+=j)e=c(a,b),f=c(a,b+p.vertex_coordinate_bytes),h=c(a,b+p.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,e,f,h);return p.nvertices*j}(x);x+=function(b){for(var c,e,f,g=p.normal_coordinate_bytes*3,h=b+p.nnormals*g;b<h;b+=
-g)c=l(a,b),e=l(a,b+p.normal_coordinate_bytes),f=l(a,b+p.normal_coordinate_bytes*2),z.push(c/127,e/127,f/127);return p.nnormals*g}(x);x+=function(b){for(var e,f,h=p.uv_coordinate_bytes*2,j=b+p.nuvs*h;b<j;b+=h)e=c(a,b),f=c(a,b+p.uv_coordinate_bytes),B.push(e,f);return p.nuvs*h}(x);T=x+T;U=T+U;V=U+V;W=V+W;X=W+X;b=X+b;S=b+S;(function(a){var b,c=p.vertex_index_bytes*3+p.material_index_bytes,e=c+p.uv_index_bytes*3,f=a+p.ntri_flat_uv*e;for(b=a;b<f;b+=e)n(b),u(b+c);return f-a})(U);(function(a){var b,c=p.vertex_index_bytes*
-3+p.material_index_bytes+p.normal_index_bytes*3,e=c+p.uv_index_bytes*3,f=a+p.ntri_smooth_uv*e;for(b=a;b<f;b+=e)o(b),u(b+c);return f-a})(V);(function(a){var b,c=p.vertex_index_bytes*4+p.material_index_bytes,e=c+p.uv_index_bytes*4,f=a+p.nquad_flat_uv*e;for(b=a;b<f;b+=e)t(b),w(b+c);return f-a})(b);(function(a){var b,c=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,e=c+p.uv_index_bytes*4,f=a+p.nquad_smooth_uv*e;for(b=a;b<f;b+=e)v(b),w(b+c);return f-a})(S);(function(a){var b,c=p.vertex_index_bytes*
-3+p.material_index_bytes,e=a+p.ntri_flat*c;for(b=a;b<e;b+=c)n(b);return e-a})(x);(function(a){var b,c=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*3,e=a+p.ntri_smooth*c;for(b=a;b<e;b+=c)o(b);return e-a})(T);(function(a){var b,c=p.vertex_index_bytes*4+p.material_index_bytes,e=a+p.nquad_flat*c;for(b=a;b<e;b+=c)t(b);return e-a})(W);(function(a){var b,c=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,e=a+p.nquad_smooth*c;for(b=a;b<e;b+=c)v(b);return e-a})(X);
+b){return a.charCodeAt(b)&255}function n(b){var c,e,g;c=f(a,b);e=f(a,b+D);g=f(a,b+H);b=k(a,b+I);THREE.BinaryLoader.prototype.f3(y,c,e,g,b)}function o(b){var c,e,g,h,l,m;c=f(a,b);e=f(a,b+D);g=f(a,b+H);h=k(a,b+I);l=f(a,b+G);m=f(a,b+z);b=f(a,b+J);THREE.BinaryLoader.prototype.f3n(y,B,c,e,g,h,l,m,b)}function p(b){var c,e,g,h;c=f(a,b);e=f(a,b+E);g=f(a,b+K);h=f(a,b+L);b=k(a,b+F);THREE.BinaryLoader.prototype.f4(y,c,e,g,h,b)}function v(b){var c,e,g,h,l,m,n,o;c=f(a,b);e=f(a,b+E);g=f(a,b+K);h=f(a,b+L);l=k(a,
+b+F);m=f(a,b+N);n=f(a,b+Q);o=f(a,b+C);b=f(a,b+R);THREE.BinaryLoader.prototype.f4n(y,B,c,e,g,h,l,m,n,o,b)}function u(b){var c,e;c=f(a,b);e=f(a,b+M);b=f(a,b+S);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],A[c*2],A[c*2+1],A[e*2],A[e*2+1],A[b*2],A[b*2+1])}function w(b){var c,e,g;c=f(a,b);e=f(a,b+O);g=f(a,b+P);b=f(a,b+T);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],A[c*2],A[c*2+1],A[e*2],A[e*2+1],A[g*2],A[g*2+1],A[b*2],A[b*2+1])}var y=this,x=0,t,B=[],A=[],D,H,I,G,z,J,E,K,L,F,N,Q,C,R,M,S,
+O,P,T,V,W,X,Y,Z,U;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,e,b);t={signature:a.substr(x,8),header_bytes:m(a,x+8),vertex_coordinate_bytes:m(a,x+9),normal_coordinate_bytes:m(a,x+10),uv_coordinate_bytes:m(a,x+11),vertex_index_bytes:m(a,x+12),normal_index_bytes:m(a,x+13),uv_index_bytes:m(a,x+14),material_index_bytes:m(a,x+15),nvertices:f(a,x+16),nnormals:f(a,x+16+4),nuvs:f(a,x+16+8),ntri_flat:f(a,x+16+12),ntri_smooth:f(a,x+16+16),ntri_flat_uv:f(a,x+16+20),ntri_smooth_uv:f(a,x+
+16+24),nquad_flat:f(a,x+16+28),nquad_smooth:f(a,x+16+32),nquad_flat_uv:f(a,x+16+36),nquad_smooth_uv:f(a,x+16+40)};x+=t.header_bytes;D=t.vertex_index_bytes;H=t.vertex_index_bytes*2;I=t.vertex_index_bytes*3;G=t.vertex_index_bytes*3+t.material_index_bytes;z=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes;J=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*2;E=t.vertex_index_bytes;K=t.vertex_index_bytes*2;L=t.vertex_index_bytes*3;F=t.vertex_index_bytes*4;N=t.vertex_index_bytes*
+4+t.material_index_bytes;Q=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes;C=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*2;R=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*3;M=t.uv_index_bytes;S=t.uv_index_bytes*2;O=t.uv_index_bytes;P=t.uv_index_bytes*2;T=t.uv_index_bytes*3;b=t.vertex_index_bytes*3+t.material_index_bytes;U=t.vertex_index_bytes*4+t.material_index_bytes;V=t.ntri_flat*b;W=t.ntri_smooth*(b+t.normal_index_bytes*3);X=t.ntri_flat_uv*
+(b+t.uv_index_bytes*3);Y=t.ntri_smooth_uv*(b+t.normal_index_bytes*3+t.uv_index_bytes*3);Z=t.nquad_flat*U;b=t.nquad_smooth*(U+t.normal_index_bytes*4);U=t.nquad_flat_uv*(U+t.uv_index_bytes*4);x+=function(b){for(var e,f,h,j=t.vertex_coordinate_bytes*3,k=b+t.nvertices*j;b<k;b+=j)e=c(a,b),f=c(a,b+t.vertex_coordinate_bytes),h=c(a,b+t.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,e,f,h);return t.nvertices*j}(x);x+=function(b){for(var c,e,f,g=t.normal_coordinate_bytes*3,h=b+t.nnormals*g;b<h;b+=
+g)c=l(a,b),e=l(a,b+t.normal_coordinate_bytes),f=l(a,b+t.normal_coordinate_bytes*2),B.push(c/127,e/127,f/127);return t.nnormals*g}(x);x+=function(b){for(var e,f,h=t.uv_coordinate_bytes*2,j=b+t.nuvs*h;b<j;b+=h)e=c(a,b),f=c(a,b+t.uv_coordinate_bytes),A.push(e,f);return t.nuvs*h}(x);V=x+V;W=V+W;X=W+X;Y=X+Y;Z=Y+Z;b=Z+b;U=b+U;(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes,e=c+t.uv_index_bytes*3,f=a+t.ntri_flat_uv*e;for(b=a;b<f;b+=e)n(b),u(b+c);return f-a})(W);(function(a){var b,c=t.vertex_index_bytes*
+3+t.material_index_bytes+t.normal_index_bytes*3,e=c+t.uv_index_bytes*3,f=a+t.ntri_smooth_uv*e;for(b=a;b<f;b+=e)o(b),u(b+c);return f-a})(X);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes,e=c+t.uv_index_bytes*4,f=a+t.nquad_flat_uv*e;for(b=a;b<f;b+=e)p(b),w(b+c);return f-a})(b);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*4,e=c+t.uv_index_bytes*4,f=a+t.nquad_smooth_uv*e;for(b=a;b<f;b+=e)v(b),w(b+c);return f-a})(U);(function(a){var b,c=t.vertex_index_bytes*
+3+t.material_index_bytes,e=a+t.ntri_flat*c;for(b=a;b<e;b+=c)n(b);return e-a})(x);(function(a){var b,c=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*3,e=a+t.ntri_smooth*c;for(b=a;b<e;b+=c)o(b);return e-a})(V);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes,e=a+t.nquad_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(Y);(function(a){var b,c=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*4,e=a+t.nquad_smooth*c;for(b=a;b<e;b+=c)v(b);return e-a})(Z);
 this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},v:function(a,b,c,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))},f3:function(a,b,c,e,f){a.faces.push(new THREE.Face3(b,c,e,null,null,a.materials[f]))},f4:function(a,b,c,e,f,h){a.faces.push(new THREE.Face4(b,c,e,f,null,null,a.materials[h]))},f3n:function(a,b,c,e,f,h,g,j,k){var h=a.materials[h],l=b[j*
-3],m=b[j*3+1],j=b[j*3+2],n=b[k*3],o=b[k*3+1],k=b[k*3+2];a.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(b[g*3],b[g*3+1],b[g*3+2]),new THREE.Vector3(l,m,j),new THREE.Vector3(n,o,k)],null,h))},f4n:function(a,b,c,e,f,h,g,j,k,l,m){var g=a.materials[g],n=b[k*3],o=b[k*3+1],k=b[k*3+2],t=b[l*3],v=b[l*3+1],l=b[l*3+2],u=b[m*3],w=b[m*3+1],m=b[m*3+2];a.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(b[j*3],b[j*3+1],b[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(t,v,l),new THREE.Vector3(u,w,
+3],m=b[j*3+1],j=b[j*3+2],n=b[k*3],o=b[k*3+1],k=b[k*3+2];a.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(b[g*3],b[g*3+1],b[g*3+2]),new THREE.Vector3(l,m,j),new THREE.Vector3(n,o,k)],null,h))},f4n:function(a,b,c,e,f,h,g,j,k,l,m){var g=a.materials[g],n=b[k*3],o=b[k*3+1],k=b[k*3+2],p=b[l*3],v=b[l*3+1],l=b[l*3+2],u=b[m*3],w=b[m*3+1],m=b[m*3+2];a.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(b[j*3],b[j*3+1],b[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,v,l),new THREE.Vector3(u,w,
 m)],null,g))},uv3:function(a,b,c,e,f,h,g){var j=[];j.push(new THREE.UV(b,c));j.push(new THREE.UV(e,f));j.push(new THREE.UV(h,g));a.push(j)},uv4:function(a,b,c,e,f,h,g,j,k){var l=[];l.push(new THREE.UV(b,c));l.push(new THREE.UV(e,f));l.push(new THREE.UV(h,g));l.push(new THREE.UV(j,k));a.push(l)},constructor:THREE.BinaryLoader};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:f+"/"+a}function j(){for(t in E.objects)if(!C.objects[t])if(x=E.objects[t],x.geometry!==void 0){if(G=C.geometries[x.geometry]){var a=!1;J=[];for(K=0;K<x.materials.length;K++)J[K]=C.materials[x.materials[K]],a=J[K]instanceof THREE.MeshShaderMaterial;a&&G.computeTangents();p=x.position;r=x.rotation;
-q=x.quaternion;s=x.scale;q=0;J.length==0&&(J[0]=new THREE.MeshFaceMaterial);J.length>1&&(J=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(G,J);object.name=t;object.position.set(p[0],p[1],p[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=x.visible;C.scene.addObject(object);C.objects[t]=object;x.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),C.scene.collisions.colliders.push(a));
-if(x.castsShadow)a=new THREE.ShadowVolume(G),C.scene.addChild(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},C.triggers[object.name]=a)}}else p=x.position,r=x.rotation,q=x.quaternion,s=x.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(p[0],p[1],p[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=x.visible!==void 0?x.visible:!1,C.scene.addObject(object),C.objects[t]=object,C.empties[t]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},C.triggers[object.name]=a)}function k(a){return function(b){C.geometries[a]=b;j();L-=1;c.onLoadComplete();m()}}function l(a){return function(b){C.geometries[a]=b}}function m(){c.callbackProgress({totalModels:O,totalTextures:Q,loadedModels:O-L,loadedTextures:Q-M},C);c.onLoadProgress();L==0&&M==0&&b(C)}var n,
-o,t,v,u,w,y,x,p,z,B,G,H,A,D,J,I,E,F,L,M,O,Q,C;E=a.data;D=new THREE.BinaryLoader;F=new THREE.JSONLoader;M=L=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(t in E.objects)if(x=E.objects[t],x.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(E.transform){a=E.transform.position;z=E.transform.rotation;var P=E.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);z&&C.scene.rotation.set(z[0],
-z[1],z[2]);P&&C.scene.scale.set(P[0],P[1],P[2]);(a||z||P)&&C.scene.updateMatrix()}a=function(){M-=1;m();c.onLoadComplete()};for(u in E.cameras){z=E.cameras[u];if(z.type=="perspective")H=new THREE.Camera(z.fov,z.aspect,z.near,z.far);else if(z.type=="ortho")H=new THREE.Camera,H.projectionMatrix=THREE.Matrix4.makeOrtho(z.left,z.right,z.top,z.bottom,z.near,z.far);p=z.position;z=z.target;H.position.set(p[0],p[1],p[2]);H.target.position.set(z[0],z[1],z[2]);C.cameras[u]=H}for(v in E.lights)u=E.lights[v],
-H=u.color!==void 0?u.color:16777215,z=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(p=u.direction,I=new THREE.DirectionalLight(H,z),I.position.set(p[0],p[1],p[2]),I.position.normalize()):u.type=="point"?(p=u.position,d=u.distance,I=new THREE.PointLight(H,z,d),I.position.set(p[0],p[1],p[2])):u.type=="ambient"&&(I=new THREE.AmbientLight(H)),C.scene.addLight(I),C.lights[v]=I;for(w in E.fogs)v=E.fogs[w],v.type=="linear"?A=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(A=new THREE.FogExp2(0,
-v.density)),z=v.color,A.color.setRGB(z[0],z[1],z[2]),C.fogs[w]=A;if(C.cameras&&E.defaults.camera)C.currentCamera=C.cameras[E.defaults.camera];if(C.fogs&&E.defaults.fog)C.scene.fog=C.fogs[E.defaults.fog];z=E.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(z[0],z[1],z[2]);C.bgColorAlpha=E.defaults.bgalpha;for(n in E.geometries)if(w=E.geometries[n],w.type=="bin_mesh"||w.type=="ascii_mesh")L+=1,c.onLoadStart();O=L;for(n in E.geometries)w=E.geometries[n],w.type=="cube"?(G=new THREE.CubeGeometry(w.width,
-w.height,w.depth,w.segmentsWidth,w.segmentsHeight,w.segmentsDepth,null,w.flipped,w.sides),C.geometries[n]=G):w.type=="plane"?(G=new THREE.PlaneGeometry(w.width,w.height,w.segmentsWidth,w.segmentsHeight),C.geometries[n]=G):w.type=="sphere"?(G=new THREE.SphereGeometry(w.radius,w.segmentsWidth,w.segmentsHeight),C.geometries[n]=G):w.type=="cylinder"?(G=new THREE.CylinderGeometry(w.numSegs,w.topRad,w.botRad,w.height,w.topOffset,w.botOffset),C.geometries[n]=G):w.type=="torus"?(G=new THREE.TorusGeometry(w.radius,
-w.tube,w.segmentsR,w.segmentsT),C.geometries[n]=G):w.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(w.subdivisions),C.geometries[n]=G):w.type=="bin_mesh"?D.load({model:e(w.url,E.urlBaseType),callback:k(n)}):w.type=="ascii_mesh"?F.load({model:e(w.url,E.urlBaseType),callback:k(n)}):w.type=="embedded_mesh"&&(w=E.embeds[w.id])&&F.createModel(w,l(n),"");for(y in E.textures)if(n=E.textures[y],n.url instanceof Array){M+=n.url.length;for(D=0;D<n.url.length;D++)c.onLoadStart()}else M+=1,c.onLoadStart();
-Q=M;for(y in E.textures){n=E.textures[y];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){D=[];for(var K=0;K<n.url.length;K++)D[K]=e(n.url[K],E.urlBaseType);D=THREE.ImageUtils.loadTextureCube(D,n.mapping,a)}else{D=THREE.ImageUtils.loadTexture(e(n.url,E.urlBaseType),n.mapping,a);if(THREE[n.minFilter]!=void 0)D.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)D.magFilter=THREE[n.magFilter];if(n.repeat){D.repeat.set(n.repeat[0],n.repeat[1]);
-if(n.repeat[0]!=1)D.wrapS=THREE.RepeatWrapping;if(n.repeat[1]!=1)D.wrapT=THREE.RepeatWrapping}n.offset&&D.offset.set(n.offset[0],n.offset[1]);if(n.wrap){F={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(F[n.wrap[0]]!==void 0)D.wrapS=F[n.wrap[0]];if(F[n.wrap[1]]!==void 0)D.wrapT=F[n.wrap[1]]}}C.textures[y]=D}for(o in E.materials){y=E.materials[o];for(B in y.parameters)if(B=="envMap"||B=="map"||B=="lightMap")y.parameters[B]=C.textures[y.parameters[B]];else if(B=="shading")y.parameters[B]=
-y.parameters[B]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(B=="blending")y.parameters[B]=THREE[y.parameters[B]]?THREE[y.parameters[B]]:THREE.NormalBlending;else if(B=="combine")y.parameters[B]=y.parameters[B]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(B=="vertexColors")if(y.parameters[B]=="face")y.parameters[B]=THREE.FaceColors;else if(y.parameters[B])y.parameters[B]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=
-!0;if(y.parameters.normalMap){n=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(n.uniforms);D=y.parameters.color;F=y.parameters.specular;w=y.parameters.ambient;A=y.parameters.shininess;a.tNormal.texture=C.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)a.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)a.tDiffuse.texture=y.parameters.map,a.enableDiffuse.value=!0;if(y.parameters.lightMap)a.tAO.texture=y.parameters.lightMap,a.enableAO.value=!0;if(y.parameters.specularMap)a.tSpecular.texture=
-C.textures[y.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(D);a.uSpecularColor.value.setHex(F);a.uAmbientColor.value.setHex(w);a.uShininess.value=A;if(y.parameters.opacity)a.uOpacity.value=y.parameters.opacity;y=new THREE.MeshShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:a,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);C.materials[o]=y}j();c.callbackSync(C)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
+THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:f+"/"+a}function j(){for(p in E.objects)if(!C.objects[p])if(x=E.objects[p],x.geometry!==void 0){if(D=C.geometries[x.geometry]){var a=!1;z=[];for(M=0;M<x.materials.length;M++)z[M]=C.materials[x.materials[M]],a=z[M]instanceof THREE.MeshShaderMaterial;a&&D.computeTangents();t=x.position;r=x.rotation;
+q=x.quaternion;s=x.scale;q=0;z.length==0&&(z[0]=new THREE.MeshFaceMaterial);z.length>1&&(z=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(D,z);object.name=p;object.position.set(t[0],t[1],t[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=x.visible;C.scene.addObject(object);C.objects[p]=object;x.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),C.scene.collisions.colliders.push(a));
+if(x.castsShadow)a=new THREE.ShadowVolume(D),C.scene.addChild(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},C.triggers[object.name]=a)}}else t=x.position,r=x.rotation,q=x.quaternion,s=x.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(t[0],t[1],t[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
+s[1],s[2]),object.visible=x.visible!==void 0?x.visible:!1,C.scene.addObject(object),C.objects[p]=object,C.empties[p]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},C.triggers[object.name]=a)}function k(a){return function(b){C.geometries[a]=b;j();L-=1;c.onLoadComplete();m()}}function l(a){return function(b){C.geometries[a]=b}}function m(){c.callbackProgress({totalModels:N,totalTextures:Q,loadedModels:N-L,loadedTextures:Q-F},C);c.onLoadProgress();L==0&&F==0&&b(C)}var n,
+o,p,v,u,w,y,x,t,B,A,D,H,I,G,z,J,E,K,L,F,N,Q,C;E=a.data;G=new THREE.BinaryLoader;K=new THREE.JSONLoader;F=L=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(p in E.objects)if(x=E.objects[p],x.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(E.transform){a=E.transform.position;B=E.transform.rotation;var R=E.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);B&&C.scene.rotation.set(B[0],
+B[1],B[2]);R&&C.scene.scale.set(R[0],R[1],R[2]);(a||B||R)&&C.scene.updateMatrix()}a=function(){F-=1;m();c.onLoadComplete()};for(u in E.cameras){B=E.cameras[u];if(B.type=="perspective")H=new THREE.Camera(B.fov,B.aspect,B.near,B.far);else if(B.type=="ortho")H=new THREE.Camera,H.projectionMatrix=THREE.Matrix4.makeOrtho(B.left,B.right,B.top,B.bottom,B.near,B.far);t=B.position;B=B.target;H.position.set(t[0],t[1],t[2]);H.target.position.set(B[0],B[1],B[2]);C.cameras[u]=H}for(v in E.lights)u=E.lights[v],
+H=u.color!==void 0?u.color:16777215,B=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(t=u.direction,J=new THREE.DirectionalLight(H,B),J.position.set(t[0],t[1],t[2]),J.position.normalize()):u.type=="point"?(t=u.position,d=u.distance,J=new THREE.PointLight(H,B,d),J.position.set(t[0],t[1],t[2])):u.type=="ambient"&&(J=new THREE.AmbientLight(H)),C.scene.addLight(J),C.lights[v]=J;for(w in E.fogs)v=E.fogs[w],v.type=="linear"?I=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(I=new THREE.FogExp2(0,
+v.density)),B=v.color,I.color.setRGB(B[0],B[1],B[2]),C.fogs[w]=I;if(C.cameras&&E.defaults.camera)C.currentCamera=C.cameras[E.defaults.camera];if(C.fogs&&E.defaults.fog)C.scene.fog=C.fogs[E.defaults.fog];B=E.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(B[0],B[1],B[2]);C.bgColorAlpha=E.defaults.bgalpha;for(n in E.geometries)if(w=E.geometries[n],w.type=="bin_mesh"||w.type=="ascii_mesh")L+=1,c.onLoadStart();N=L;for(n in E.geometries)w=E.geometries[n],w.type=="cube"?(D=new THREE.CubeGeometry(w.width,
+w.height,w.depth,w.segmentsWidth,w.segmentsHeight,w.segmentsDepth,null,w.flipped,w.sides),C.geometries[n]=D):w.type=="plane"?(D=new THREE.PlaneGeometry(w.width,w.height,w.segmentsWidth,w.segmentsHeight),C.geometries[n]=D):w.type=="sphere"?(D=new THREE.SphereGeometry(w.radius,w.segmentsWidth,w.segmentsHeight),C.geometries[n]=D):w.type=="cylinder"?(D=new THREE.CylinderGeometry(w.numSegs,w.topRad,w.botRad,w.height,w.topOffset,w.botOffset),C.geometries[n]=D):w.type=="torus"?(D=new THREE.TorusGeometry(w.radius,
+w.tube,w.segmentsR,w.segmentsT),C.geometries[n]=D):w.type=="icosahedron"?(D=new THREE.IcosahedronGeometry(w.subdivisions),C.geometries[n]=D):w.type=="bin_mesh"?G.load({model:e(w.url,E.urlBaseType),callback:k(n)}):w.type=="ascii_mesh"?K.load({model:e(w.url,E.urlBaseType),callback:k(n)}):w.type=="embedded_mesh"&&(w=E.embeds[w.id])&&K.createModel(w,l(n),"");for(y in E.textures)if(n=E.textures[y],n.url instanceof Array){F+=n.url.length;for(G=0;G<n.url.length;G++)c.onLoadStart()}else F+=1,c.onLoadStart();
+Q=F;for(y in E.textures){n=E.textures[y];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){G=[];for(var M=0;M<n.url.length;M++)G[M]=e(n.url[M],E.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,n.mapping,a)}else{G=THREE.ImageUtils.loadTexture(e(n.url,E.urlBaseType),n.mapping,a);if(THREE[n.minFilter]!=void 0)G.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)G.magFilter=THREE[n.magFilter];if(n.repeat){G.repeat.set(n.repeat[0],n.repeat[1]);
+if(n.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(n.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}n.offset&&G.offset.set(n.offset[0],n.offset[1]);if(n.wrap){K={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(K[n.wrap[0]]!==void 0)G.wrapS=K[n.wrap[0]];if(K[n.wrap[1]]!==void 0)G.wrapT=K[n.wrap[1]]}}C.textures[y]=G}for(o in E.materials){y=E.materials[o];for(A in y.parameters)if(A=="envMap"||A=="map"||A=="lightMap")y.parameters[A]=C.textures[y.parameters[A]];else if(A=="shading")y.parameters[A]=
+y.parameters[A]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(A=="blending")y.parameters[A]=THREE[y.parameters[A]]?THREE[y.parameters[A]]:THREE.NormalBlending;else if(A=="combine")y.parameters[A]=y.parameters[A]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(A=="vertexColors")if(y.parameters[A]=="face")y.parameters[A]=THREE.FaceColors;else if(y.parameters[A])y.parameters[A]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=
+!0;if(y.parameters.normalMap){n=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(n.uniforms);G=y.parameters.color;K=y.parameters.specular;w=y.parameters.ambient;I=y.parameters.shininess;a.tNormal.texture=C.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)a.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)a.tDiffuse.texture=y.parameters.map,a.enableDiffuse.value=!0;if(y.parameters.lightMap)a.tAO.texture=y.parameters.lightMap,a.enableAO.value=!0;if(y.parameters.specularMap)a.tSpecular.texture=
+C.textures[y.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);a.uSpecularColor.value.setHex(K);a.uAmbientColor.value.setHex(w);a.uShininess.value=I;if(y.parameters.opacity)a.uOpacity.value=y.parameters.opacity;y=new THREE.MeshShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:a,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);C.materials[o]=y}j();c.callbackSync(C)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
 THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype={load:function(a){var b=new XMLHttpRequest,c=a.model,e=a.callback,f=a.scale!==void 0?a.scale:1,h=a.offsetX!==void 0?a.offsetX:0,g=a.offsetY!==void 0?a.offsetY:0,j=a.offsetZ!==void 0?a.offsetZ:0;b.onreadystatechange=function(){b.readyState==4?b.status==200||b.status==0?THREE.UTF8Loader.prototype.createModel(b.responseText,e,f,h,g,j):alert("Couldn't load ["+c+"] ["+b.status+"]"):b.readyState!=3&&b.readyState==2&&b.getResponseHeader("Content-Length")};b.open("GET",c,!0);b.send(null)},
 decompressMesh:function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),e=1,f=0;f<8;f++){for(var h=0,g=0;g<b;++g){var j=a.charCodeAt(g+e);h+=j>>1^-(j&1);c[8*g+f]=h}e+=b}b=a.length-e;h=new Uint16Array(b);for(f=g=0;f<b;f++)j=a.charCodeAt(f+e),h[f]=g-j,j==0&&g++;return[c,h]},createModel:function(a,b,c,e,f,h){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],m=[];(function(a,g,k){for(var l,m,w,
-y=a.length;k<y;k+=g)l=a[k],m=a[k+1],w=a[k+2],l=l/16383*c,m=m/16383*c,w=w/16383*c,l+=e,m+=f,w+=h,THREE.UTF8Loader.prototype.v(b,l,m,w)})(g[0],8,0);(function(a,b,c){for(var e,f,g=a.length;c<g;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,m.push(e,f)})(g[0],8,3);(function(a,b,c){for(var e,f,g,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],g=a[c+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,l.push(e,f,g)})(g[0],8,5);(function(a){var c,e,f,g,h,k,x,p=a.length;for(c=0;c<p;c+=3)e=a[c],f=a[c+1],g=a[c+2],THREE.UTF8Loader.prototype.f3n(b,
+y=a.length;k<y;k+=g)l=a[k],m=a[k+1],w=a[k+2],l=l/16383*c,m=m/16383*c,w=w/16383*c,l+=e,m+=f,w+=h,THREE.UTF8Loader.prototype.v(b,l,m,w)})(g[0],8,0);(function(a,b,c){for(var e,f,g=a.length;c<g;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,m.push(e,f)})(g[0],8,3);(function(a,b,c){for(var e,f,g,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],g=a[c+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,l.push(e,f,g)})(g[0],8,5);(function(a){var c,e,f,g,h,k,x,t=a.length;for(c=0;c<t;c+=3)e=a[c],f=a[c+1],g=a[c+2],THREE.UTF8Loader.prototype.f3n(b,
 l,e,f,g,0,e,f,g),h=m[e*2],e=m[e*2+1],k=m[f*2],f=m[f*2+1],x=m[g*2],g=m[g*2+1],THREE.UTF8Loader.prototype.uv3(b.faceVertexUvs[0],h,e,k,f,x,g)})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)},v:function(a,b,c,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))},f3n:function(a,b,c,e,f,h,g,j,k){var h=a.materials[h],l=b[j*3],m=b[j*3+1],j=b[j*3+2],n=b[k*3],o=b[k*3+1],k=b[k*3+2],g=new THREE.Vector3(b[g*3],b[g*3+1],b[g*
 3+2]),j=new THREE.Vector3(l,m,j),k=new THREE.Vector3(n,o,k);a.faces.push(new THREE.Face3(c,e,f,[g,j,k],null,h))},uv3:function(a,b,c,e,f,h,g){var j=[];j.push(new THREE.UV(b,c));j.push(new THREE.UV(e,f));j.push(new THREE.UV(h,g));a.push(j)},constructor:THREE.UTF8Loader};
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,f){return a+(b-a)*f};this.VIntX=function(a,b,f,h,g,j,k,l,m,n){g=(g-m)/(n-m);m=this.normal_cache;b[h]=j+g*this.delta;b[h+1]=k;b[h+2]=l;f[h]=this.lerp(m[a],m[a+3],g);f[h+1]=this.lerp(m[a+1],m[a+4],g);f[h+2]=this.lerp(m[a+2],m[a+5],g)};this.VIntY=function(a,b,f,h,g,j,k,l,m,n){g=(g-m)/(n-m);m=this.normal_cache;b[h]=j;b[h+1]=k+g*this.delta;b[h+
 2]=l;b=a+this.yd*3;f[h]=this.lerp(m[a],m[b],g);f[h+1]=this.lerp(m[a+1],m[b+1],g);f[h+2]=this.lerp(m[a+2],m[b+2],g)};this.VIntZ=function(a,b,f,h,g,j,k,l,m,n){g=(g-m)/(n-m);m=this.normal_cache;b[h]=j;b[h+1]=k;b[h+2]=l+g*this.delta;b=a+this.zd*3;f[h]=this.lerp(m[a],m[b],g);f[h+1]=this.lerp(m[a+1],m[b+1],g);f[h+2]=this.lerp(m[a+2],m[b+2],g)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]==0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+
-this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,h,g,j){var k=h+1,l=h+this.yd,m=h+this.zd,n=k+this.yd,o=k+this.zd,t=h+this.yd+this.zd,v=k+this.yd+this.zd,u=0,w=this.field[h],y=this.field[k],x=this.field[l],p=this.field[n],z=this.field[m],B=this.field[o],G=this.field[t],H=this.field[v];w<g&&(u|=1);y<g&&(u|=2);x<g&&(u|=8);p<g&&(u|=4);z<g&&(u|=16);B<g&&(u|=32);G<g&&(u|=128);H<g&&(u|=64);var A=THREE.edgeTable[u];if(A==0)return 0;var D=this.delta,
-J=a+D,I=b+D,D=f+D;A&1&&(this.compNorm(h),this.compNorm(k),this.VIntX(h*3,this.vlist,this.nlist,0,g,a,b,f,w,y));A&2&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,3,g,J,b,f,y,p));A&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,6,g,a,I,f,x,p));A&8&&(this.compNorm(h),this.compNorm(l),this.VIntY(h*3,this.vlist,this.nlist,9,g,a,b,f,w,x));A&16&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,12,g,a,b,D,z,B));A&32&&(this.compNorm(o),
-this.compNorm(v),this.VIntY(o*3,this.vlist,this.nlist,15,g,J,b,D,B,H));A&64&&(this.compNorm(t),this.compNorm(v),this.VIntX(t*3,this.vlist,this.nlist,18,g,a,I,D,G,H));A&128&&(this.compNorm(m),this.compNorm(t),this.VIntY(m*3,this.vlist,this.nlist,21,g,a,b,D,z,G));A&256&&(this.compNorm(h),this.compNorm(m),this.VIntZ(h*3,this.vlist,this.nlist,24,g,a,b,f,w,z));A&512&&(this.compNorm(k),this.compNorm(o),this.VIntZ(k*3,this.vlist,this.nlist,27,g,J,b,f,y,B));A&1024&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*
-3,this.vlist,this.nlist,30,g,J,I,f,p,H));A&2048&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,33,g,a,I,f,x,G));u<<=4;for(g=h=0;THREE.triTable[u+g]!=-1;)a=u+g,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],j),g+=3,h++;return h};this.posnormtriv=function(a,b,f,h,g,j){var k=this.count*3;this.positionArray[k]=a[f];this.positionArray[k+1]=a[f+1];this.positionArray[k+2]=a[f+2];this.positionArray[k+3]=a[h];this.positionArray[k+
+this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,h,g,j){var k=h+1,l=h+this.yd,m=h+this.zd,n=k+this.yd,o=k+this.zd,p=h+this.yd+this.zd,v=k+this.yd+this.zd,u=0,w=this.field[h],y=this.field[k],x=this.field[l],t=this.field[n],B=this.field[m],A=this.field[o],D=this.field[p],H=this.field[v];w<g&&(u|=1);y<g&&(u|=2);x<g&&(u|=8);t<g&&(u|=4);B<g&&(u|=16);A<g&&(u|=32);D<g&&(u|=128);H<g&&(u|=64);var I=THREE.edgeTable[u];if(I==0)return 0;var G=this.delta,
+z=a+G,J=b+G,G=f+G;I&1&&(this.compNorm(h),this.compNorm(k),this.VIntX(h*3,this.vlist,this.nlist,0,g,a,b,f,w,y));I&2&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,3,g,z,b,f,y,t));I&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,6,g,a,J,f,x,t));I&8&&(this.compNorm(h),this.compNorm(l),this.VIntY(h*3,this.vlist,this.nlist,9,g,a,b,f,w,x));I&16&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,12,g,a,b,G,B,A));I&32&&(this.compNorm(o),
+this.compNorm(v),this.VIntY(o*3,this.vlist,this.nlist,15,g,z,b,G,A,H));I&64&&(this.compNorm(p),this.compNorm(v),this.VIntX(p*3,this.vlist,this.nlist,18,g,a,J,G,D,H));I&128&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,21,g,a,b,G,B,D));I&256&&(this.compNorm(h),this.compNorm(m),this.VIntZ(h*3,this.vlist,this.nlist,24,g,a,b,f,w,B));I&512&&(this.compNorm(k),this.compNorm(o),this.VIntZ(k*3,this.vlist,this.nlist,27,g,z,b,f,y,A));I&1024&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*
+3,this.vlist,this.nlist,30,g,z,J,f,t,H));I&2048&&(this.compNorm(l),this.compNorm(p),this.VIntZ(l*3,this.vlist,this.nlist,33,g,a,J,f,x,D));u<<=4;for(g=h=0;THREE.triTable[u+g]!=-1;)a=u+g,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],j),g+=3,h++;return h};this.posnormtriv=function(a,b,f,h,g,j){var k=this.count*3;this.positionArray[k]=a[f];this.positionArray[k+1]=a[f+1];this.positionArray[k+2]=a[f+2];this.positionArray[k+3]=a[h];this.positionArray[k+
 4]=a[h+1];this.positionArray[k+5]=a[h+2];this.positionArray[k+6]=a[g];this.positionArray[k+7]=a[g+1];this.positionArray[k+8]=a[g+2];this.normalArray[k]=b[f];this.normalArray[k+1]=b[f+1];this.normalArray[k+2]=b[f+2];this.normalArray[k+3]=b[h];this.normalArray[k+4]=b[h+1];this.normalArray[k+5]=b[h+2];this.normalArray[k+6]=b[g];this.normalArray[k+7]=b[g+1];this.normalArray[k+8]=b[g+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,f,h,g){var j=this.size*Math.sqrt(h/g),k=f*this.size,l=b*this.size,m=a*this.size,n=Math.floor(k-j);n<1&&(n=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var o=Math.floor(l-j);o<1&&(o=1);l=Math.floor(l+j);l>this.size-1&&(l=this.size-1);var t=Math.floor(m-j);t<1&&(t=1);j=Math.floor(m+j);j>this.size-1&&(j=this.size-
-1);for(var v,u,w,y,x,p;n<k;n++){m=this.size2*n;u=n/this.size-f;x=u*u;for(u=o;u<l;u++){w=m+this.size*u;v=u/this.size-b;p=v*v;for(v=t;v<j;v++)y=v/this.size-a,y=h/(1.0E-6+y*y+p+x)-g,y>0&&(this.field[w+v]+=y)}}};this.addPlaneX=function(a,b){var f,h,g,j,k,l=this.size,m=this.yd,n=this.zd,o=this.field,t=l*Math.sqrt(a/b);t>l&&(t=l);for(f=0;f<t;f++)if(h=f/l,h*=h,j=a/(1.0E-4+h)-b,j>0)for(h=0;h<l;h++){k=f+h*m;for(g=0;g<l;g++)o[n*g+k]+=j}};this.addPlaneY=function(a,b){var f,h,g,j,k,l,m=this.size,n=this.yd,o=
-this.zd,t=this.field,v=m*Math.sqrt(a/b);v>m&&(v=m);for(h=0;h<v;h++)if(f=h/m,f*=f,j=a/(1.0E-4+f)-b,j>0){k=h*n;for(f=0;f<m;f++){l=k+f;for(g=0;g<m;g++)t[o*g+l]+=j}}};this.addPlaneZ=function(a,b){var f,h,g,j,k,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(g=0;g<dist;g++)if(f=g/size,f*=f,j=a/(1.0E-4+f)-b,j>0){k=zd*g;for(h=0;h<size;h++){l=k+h*yd;for(f=0;f<size;f++)field[l+f]+=j}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
-3]=0,this.field[a]=0};this.render=function(a){this.begin();var b,f,h,g,j,k,l,m,n,o=this.size-2;for(g=1;g<o;g++){n=this.size2*g;l=(g-this.halfsize)/this.halfsize;for(h=1;h<o;h++){m=n+this.size*h;k=(h-this.halfsize)/this.halfsize;for(f=1;f<o;f++)j=(f-this.halfsize)/this.halfsize,b=m+f,this.polygonize(j,k,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(h){var g,j,k,l,m,n,o,t;for(g=0;g<h.count;g++)o=g*3,m=o+1,t=o+2,j=h.positionArray[o],
-k=h.positionArray[m],l=h.positionArray[t],n=new THREE.Vector3(j,k,l),j=h.normalArray[o],k=h.normalArray[m],l=h.normalArray[t],o=new THREE.Vector3(j,k,l),o.normalize(),m=new THREE.Vertex(n),b.vertices.push(m),f.push(o);nfaces=h.count/3;for(g=0;g<nfaces;g++)o=(a+g)*3,m=o+1,t=o+2,n=f[o],j=f[m],k=f[t],o=new THREE.Face3(o,m,t,[n,j,k]),b.faces.push(o);a+=nfaces;h.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,f,h,g){var j=this.size*Math.sqrt(h/g),k=f*this.size,l=b*this.size,m=a*this.size,n=Math.floor(k-j);n<1&&(n=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var o=Math.floor(l-j);o<1&&(o=1);l=Math.floor(l+j);l>this.size-1&&(l=this.size-1);var p=Math.floor(m-j);p<1&&(p=1);j=Math.floor(m+j);j>this.size-1&&(j=this.size-
+1);for(var v,u,w,y,x,t;n<k;n++){m=this.size2*n;u=n/this.size-f;x=u*u;for(u=o;u<l;u++){w=m+this.size*u;v=u/this.size-b;t=v*v;for(v=p;v<j;v++)y=v/this.size-a,y=h/(1.0E-6+y*y+t+x)-g,y>0&&(this.field[w+v]+=y)}}};this.addPlaneX=function(a,b){var f,h,g,j,k,l=this.size,m=this.yd,n=this.zd,o=this.field,p=l*Math.sqrt(a/b);p>l&&(p=l);for(f=0;f<p;f++)if(h=f/l,h*=h,j=a/(1.0E-4+h)-b,j>0)for(h=0;h<l;h++){k=f+h*m;for(g=0;g<l;g++)o[n*g+k]+=j}};this.addPlaneY=function(a,b){var f,h,g,j,k,l,m=this.size,n=this.yd,o=
+this.zd,p=this.field,v=m*Math.sqrt(a/b);v>m&&(v=m);for(h=0;h<v;h++)if(f=h/m,f*=f,j=a/(1.0E-4+f)-b,j>0){k=h*n;for(f=0;f<m;f++){l=k+f;for(g=0;g<m;g++)p[o*g+l]+=j}}};this.addPlaneZ=function(a,b){var f,h,g,j,k,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(g=0;g<dist;g++)if(f=g/size,f*=f,j=a/(1.0E-4+f)-b,j>0){k=zd*g;for(h=0;h<size;h++){l=k+h*yd;for(f=0;f<size;f++)field[l+f]+=j}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
+3]=0,this.field[a]=0};this.render=function(a){this.begin();var b,f,h,g,j,k,l,m,n,o=this.size-2;for(g=1;g<o;g++){n=this.size2*g;l=(g-this.halfsize)/this.halfsize;for(h=1;h<o;h++){m=n+this.size*h;k=(h-this.halfsize)/this.halfsize;for(f=1;f<o;f++)j=(f-this.halfsize)/this.halfsize,b=m+f,this.polygonize(j,k,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(h){var g,j,k,l,m,n,o,p;for(g=0;g<h.count;g++)o=g*3,m=o+1,p=o+2,j=h.positionArray[o],
+k=h.positionArray[m],l=h.positionArray[p],n=new THREE.Vector3(j,k,l),j=h.normalArray[o],k=h.normalArray[m],l=h.normalArray[p],o=new THREE.Vector3(j,k,l),o.normalize(),m=new THREE.Vertex(n),b.vertices.push(m),f.push(o);nfaces=h.count/3;for(g=0;g<nfaces;g++)o=(a+g)*3,m=o+1,p=o+2,n=f[o],j=f[m],k=f[p],o=new THREE.Face3(o,m,p,[n,j,k]),b.faces.push(o);a+=nfaces;h.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -279,9 +279,9 @@ e;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(0,j,0);break;case
 THREE.CollisionSystem.prototype.raySphere=function(a,b){var c=b.center.clone().subSelf(a.origin);if(c.lengthSq<b.radiusSq)return-1;var e=c.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;c=b.radiusSq-(c.lengthSq()-e*e);if(c>=0)return Math.abs(e)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var b=a.geometry.boundingBox,c=new THREE.Vector3(b.x[0],b.y[0],b.z[0]),b=new THREE.Vector3(b.x[1],b.y[1],b.z[1]),c=new THREE.BoxCollider(c,b);c.mesh=a;return c};THREE.CollisionUtils.MeshAABB=function(a){var b=THREE.CollisionUtils.MeshOBB(a);b.min.addSelf(a.position);b.max.addSelf(a.position);b.dynamic=!1;return b};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,e=this.render,f=new THREE.Camera,h=new THREE.Camera,g=new THREE.Matrix4,j=new THREE.Matrix4,k,l,m;f.useTarget=h.useTarget=!1;f.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.Camera(53,1,1,1E4);t.position.z=
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,e=this.render,f=new THREE.Camera,h=new THREE.Camera,g=new THREE.Matrix4,j=new THREE.Matrix4,k,l,m;f.useTarget=h.useTarget=!1;f.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.Camera(53,1,1,1E4);p.position.z=
 2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:n},mapRight:{type:"t",value:1,texture:o}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var v=new THREE.Scene;v.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);n.width=a;n.height=e;o.width=a;o.height=e};this.render=function(a,c){c.update(null,!0);if(k!==c.aspect||l!==c.near||m!==c.fov){k=c.aspect;l=c.near;m=c.fov;var y=c.projectionMatrix.clone(),x=125/30*0.5,p=x*l/125,z=l*Math.tan(m*Math.PI/360),B;g.n14=x;j.n14=-x;x=-z*k+p;B=z*k+p;y.n11=2*l/(B-x);y.n13=(B+x)/(B-x);f.projectionMatrix=y.clone();x=-z*k-p;B=z*k-p;y.n11=2*l/(B-x);
-y.n13=(B+x)/(B-x);h.projectionMatrix=y.clone()}f.matrix=c.matrixWorld.clone().multiplySelf(j);f.update(null,!0);f.position.copy(c.position);f.near=l;f.far=c.far;e.call(b,a,f,n,!0);h.matrix=c.matrixWorld.clone().multiplySelf(g);h.update(null,!0);h.position.copy(c.position);h.near=l;h.far=c.far;e.call(b,a,h,o,!0);e.call(b,v,t)}};
+var v=new THREE.Scene;v.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);n.width=a;n.height=e;o.width=a;o.height=e};this.render=function(a,c){c.update(null,!0);if(k!==c.aspect||l!==c.near||m!==c.fov){k=c.aspect;l=c.near;m=c.fov;var y=c.projectionMatrix.clone(),x=125/30*0.5,t=x*l/125,B=l*Math.tan(m*Math.PI/360),A;g.n14=x;j.n14=-x;x=-B*k+t;A=B*k+t;y.n11=2*l/(A-x);y.n13=(A+x)/(A-x);f.projectionMatrix=y.clone();x=-B*k-t;A=B*k-t;y.n11=2*l/(A-x);
+y.n13=(A+x)/(A-x);h.projectionMatrix=y.clone()}f.matrix=c.matrixWorld.clone().multiplySelf(j);f.update(null,!0);f.position.copy(c.position);f.near=l;f.far=c.far;e.call(b,a,f,n,!0);h.matrix=c.matrixWorld.clone().multiplySelf(g);h.update(null,!0);h.position.copy(c.position);h.near=l;h.far=c.far;e.call(b,a,h,o,!0);e.call(b,v,p)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,e=this.render,f,h,g=new THREE.Camera,j=new THREE.Camera;b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(a,e){c.call(b,a,e);f=a/2;h=e};this.render=function(a,c){this.clear();g.fov=c.fov;g.aspect=0.5*c.aspect;g.near=c.near;g.far=c.far;
 g.updateProjectionMatrix();g.position.copy(c.position);g.target.position.copy(c.target.position);g.translateX(b.separation);j.projectionMatrix=g.projectionMatrix;j.position.copy(c.position);j.target.position.copy(c.target.position);j.translateX(-b.separation);this.setViewport(0,0,f,h);e.call(b,a,g);this.setViewport(f,0,f,h);e.call(b,a,j,!1)}};

+ 1 - 1
build/custom/ThreeSVG.js

@@ -54,7 +54,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){t
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(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);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=
 a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,e=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-d*e;this.y=c*a+f*e+d*g-b*h;this.z=d*a+f*h+b*e-c*g;this.w=f*a-b*g-c*e-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,e=this.y,h=this.z,
 l=this.w,i=l*c+e*f-h*d,k=l*d+h*c-g*f,j=l*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=i*l+c*-g+k*-h-j*-e;b.y=k*l+c*-e+j*-g-i*-h;b.z=j*l+c*-h+i*-e-k*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,f,g){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=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,g,e){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={constructor:THREE.UV,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.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};

+ 1 - 1
build/custom/ThreeWebGL.js

@@ -54,7 +54,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,e){t
 this.x=b.x*e;this.y=b.y*e;this.z=b.z*e;this.w=Math.cos(d);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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=
 b,this.w*=b);return this},multiplySelf:function(b){var c=this.x,d=this.y,e=this.z,h=this.w,j=b.x,g=b.y,k=b.z,b=b.w;this.x=c*b+h*j+d*k-e*g;this.y=d*b+h*g+e*j-c*k;this.z=e*b+h*k+c*g-d*j;this.w=h*b-c*j-d*g-e*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,h=b.z,j=this.x,g=this.y,k=this.z,
 q=this.w,m=q*d+g*h-k*e,o=q*e+k*d-j*h,p=q*h+j*e-g*d,d=-j*d-g*e-k*h;c.x=m*q+d*-j+o*-k-p*-g;c.y=o*q+d*-g+p*-j-m*-k;c.z=p*q+d*-k+m*-g-o*-j;return c}};
-THREE.Quaternion.slerp=function(b,c,d,e){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var j=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<0.001)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;h=Math.sin((1-e)*j)/g;e=Math.sin(e*j)/g;d.w=b.w*h+c.w*e;d.x=b.x*h+c.x*e;d.y=b.y*h+c.y*e;d.z=b.z*h+c.z*e;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Quaternion.slerp=function(b,c,d,e){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var j=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;h=Math.sin((1-e)*j)/g;e=Math.sin(e*j)/g;d.w=b.w*h+c.w*e;d.x=b.x*h+c.x*e;d.y=b.y*h+c.y*e;d.z=b.z*h+c.z*e;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,c,d,e,h,j){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,d,e,h,j,g){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};

+ 40 - 14
src/extras/geometries/ExtrudeGeometry.js

@@ -37,6 +37,8 @@ THREE.ExtrudeGeometry = function( shapes, options ) {
 
 	var s, sl = shapes.length, shape;
 
+	this.shapebb = shapes[ sl - 1 ].getBoundingBox();
+	
 	for ( s = 0; s < sl; s ++ ) {
 
 		shape = shapes[ s ];
@@ -44,6 +46,16 @@ THREE.ExtrudeGeometry = function( shapes, options ) {
 		this.addShape( shape, options );
 
 	}
+	
+	
+	// UVs to be added
+	// How can we create UVs on this?
+
+	this.computeCentroids();
+	this.computeFaceNormals();
+	this.computeVertexNormals();
+
+	//console.log( "took", ( Date.now() - startTime ) );
 
 };
 
@@ -53,8 +65,6 @@ THREE.ExtrudeGeometry.prototype.constructor = THREE.ExtrudeGeometry;
 
 THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 
-	//var startTime = Date.now();
-
 	var amount = options.amount !== undefined ? options.amount : 100;
 
 	var bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6; // 10
@@ -73,6 +83,13 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 	var extrudePts, extrudeByPath = false;
 
 	var useSpacedPoints = options.useSpacedPoints !== undefined ? options.useSpacedPoints : false;
+	
+	var material = options.material;
+	var shapebb = this.shapebb;
+	//shapebb = shape.getBoundingBox();
+	
+	console.log(shapebb,material);
+	
 
 	if ( extrudePath ) {
 
@@ -502,9 +519,6 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 	///   Handle Faces
 	////
 
-	// not used anywhere
-	// var layers = ( steps + bevelSegments * 2 ) * vlen;
-
 	// Bottom faces
 
 	if ( bevelEnabled ) {
@@ -603,14 +617,6 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 
 	}
 
-	// UVs to be added
-	// How can we create UVs on this?
-
-	this.computeCentroids();
-	this.computeFaceNormals();
-	//this.computeVertexNormals();
-
-	//console.log( "took", ( Date.now() - startTime ) );
 
 	function v( x, y, z ) {
 
@@ -624,7 +630,20 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 		b += shapesOffset;
 		c += shapesOffset;
 
-		scope.faces.push( new THREE.Face3( a, b, c ) );
+		scope.faces.push( new THREE.Face3( a, b, c , null, null, material ) );
+		//normal, color, materials
+		
+		var mx = shapebb.minX, my = shapebb.minY;
+		var uy = shapebb.maxY; // - shapebb.minY;
+		var ux = shapebb.maxX; // - shapebb.minX;
+	
+		
+		scope.faceVertexUvs[ 0 ].push( [
+					new THREE.UV( (scope.vertices[a].position.x ) / ux, (scope.vertices[a].position.y ) / uy ),
+					new THREE.UV( (scope.vertices[b].position.x ) / ux, (scope.vertices[b].position.y ) / uy ),
+					new THREE.UV( (scope.vertices[c].position.x ) / ux, (scope.vertices[c].position.y ) / uy ),
+					
+				] );
 
 	}
 
@@ -637,6 +656,13 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 
  		scope.faces.push( new THREE.Face4( a, b, c, d ) );
 
+		scope.faceVertexUvs[ 0 ].push( [
+					new THREE.UV( 0, 0 ),
+					new THREE.UV( 1, 0 ),
+					new THREE.UV( 1, 1 ),
+					new THREE.UV( 0, 1 )
+				] );
+
 	}
 
 };

+ 3 - 3
src/extras/geometries/TextGeometry.js

@@ -67,20 +67,20 @@ THREE.TextGeometry = function ( text, parameters ) {
 	// // Bend Testings.
 	//
 	// var path = new THREE.CurvePath();
-	//
+	// 
 	// path.add(new THREE.CubicBezierCurve(
 	// 		new THREE.Vector2(0, 0),
 	//   		new THREE.Vector2(10, 100),
 	// 		new THREE.Vector2(200, -10),
 	// 		new THREE.Vector2(300, 0)
 	// 	));
-	//
+	// 
 	// path.add(new THREE.QuadraticBezierCurve(
 	// 	new THREE.Vector2(300, 0),
 	//   		new THREE.Vector2(450, -10),
 	// 	new THREE.Vector2(500, 100)
 	// ));
-	//
+	// 
 	// parameters.bendPath = path;
 
 	// var path = new THREE.CurvePath();