Explorar el Código

Made PathControls work.

Aargh, I feel dirty now.
alteredq hace 14 años
padre
commit
1f7bc4e31d

+ 295 - 295
build/Three.js

@@ -16,37 +16,37 @@ c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this
 normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c<e;c++)Array.prototype.push.apply(f,this.intersectObject(b[c]));f.sort(function(b,c){return b.distance-c.distance});return f},intersectObject:function(b){function c(b,c,e){var f;f=e.clone().subSelf(b).dot(c);if(f<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(f));return e.distanceTo(b)}function e(b,c,e,f){var f=f.clone().subSelf(c),
 e=e.clone().subSelf(c),h=b.clone().subSelf(c),b=f.dot(f),c=f.dot(e),f=f.dot(h),k=e.dot(e),e=e.dot(h),h=1/(b*k-c*c),k=(k*f-c*e)*h,b=(b*e-c*f)*h;return k>0&&b>0&&k+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,
-Math.max(b.scale.y,b.scale.z)))return[];var h,k,m,n,p,u,v,t,w,x,y=b.geometry,z=y.vertices,A=[],f=0;for(h=y.faces.length;f<h;f++)if(k=y.faces[f],w=this.origin.clone(),x=this.direction.clone(),u=b.matrixWorld,m=u.multiplyVector3(k.centroid.clone()).subSelf(w),t=m.dot(x),!(t<=0)&&(m=u.multiplyVector3(z[k.a].position.clone()),n=u.multiplyVector3(z[k.b].position.clone()),p=u.multiplyVector3(z[k.c].position.clone()),u=k instanceof THREE.Face4?u.multiplyVector3(z[k.d].position.clone()):null,v=b.matrixRotationWorld.multiplyVector3(k.normal.clone()),
-t=x.dot(v),b.doubleSided||(b.flipSided?t>0:t<0)))if(t=v.dot((new THREE.Vector3).sub(m,w))/t,w=w.addSelf(x.multiplyScalar(t)),k instanceof THREE.Face3)e(w,m,n,p)&&(k={distance:this.origin.distanceTo(w),point:w,face:k,object:b},A.push(k));else if(k instanceof THREE.Face4&&(e(w,m,n,u)||e(w,n,p,u)))k={distance:this.origin.distanceTo(w),point:w,face:k,object:b},A.push(k);A.sort(function(b,c){return b.distance-c.distance});return A}else return[]}};
-THREE.Rectangle=function(){function b(){k=f-c;m=h-e}var c,e,f,h,k,m,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return m};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(k,m,v,t){n=!1;c=k;e=m;f=v;h=t;b()};this.addPoint=function(k,m){n?(n=!1,c=k,e=m,f=k,h=m):(c=c<k?c:k,e=e<m?e:m,f=f>k?f:k,h=h>m?h:m);b()};this.add3Points=
-function(k,m,v,t,w,x){n?(n=!1,c=k<v?k<w?k:w:v<w?v:w,e=m<t?m<x?m:x:t<x?t:x,f=k>v?k>w?k:w:v>w?v:w,h=m>t?m>x?m:x:t>x?t:x):(c=k<v?k<w?k<c?k:c:w<c?w:c:v<w?v<c?v:c:w<c?w:c,e=m<t?m<x?m<e?m:e:x<e?x:e:t<x?t<e?t:e:x<e?x:e,f=k>v?k>w?k>f?k:f:w>f?w:f:v>w?v>f?v:f:w>f?w:f,h=m>t?m>x?m>h?m:h:x>h?x:h:t>x?t>h?t:h:x>h?x:h);b()};this.addRectangle=function(k){n?(n=!1,c=k.getLeft(),e=k.getTop(),f=k.getRight(),h=k.getBottom()):(c=c<k.getLeft()?c:k.getLeft(),e=e<k.getTop()?e:k.getTop(),f=f>k.getRight()?f:k.getRight(),h=h>
+Math.max(b.scale.y,b.scale.z)))return[];var h,k,m,n,p,t,w,u,x,v,A=b.geometry,z=A.vertices,y=[],f=0;for(h=A.faces.length;f<h;f++)if(k=A.faces[f],x=this.origin.clone(),v=this.direction.clone(),t=b.matrixWorld,m=t.multiplyVector3(k.centroid.clone()).subSelf(x),u=m.dot(v),!(u<=0)&&(m=t.multiplyVector3(z[k.a].position.clone()),n=t.multiplyVector3(z[k.b].position.clone()),p=t.multiplyVector3(z[k.c].position.clone()),t=k instanceof THREE.Face4?t.multiplyVector3(z[k.d].position.clone()):null,w=b.matrixRotationWorld.multiplyVector3(k.normal.clone()),
+u=v.dot(w),b.doubleSided||(b.flipSided?u>0:u<0)))if(u=w.dot((new THREE.Vector3).sub(m,x))/u,x=x.addSelf(v.multiplyScalar(u)),k instanceof THREE.Face3)e(x,m,n,p)&&(k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},y.push(k));else if(k instanceof THREE.Face4&&(e(x,m,n,t)||e(x,n,p,t)))k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},y.push(k);y.sort(function(b,c){return b.distance-c.distance});return y}else return[]}};
+THREE.Rectangle=function(){function b(){k=f-c;m=h-e}var c,e,f,h,k,m,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return m};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(k,m,w,u){n=!1;c=k;e=m;f=w;h=u;b()};this.addPoint=function(k,m){n?(n=!1,c=k,e=m,f=k,h=m):(c=c<k?c:k,e=e<m?e:m,f=f>k?f:k,h=h>m?h:m);b()};this.add3Points=
+function(k,m,w,u,x,v){n?(n=!1,c=k<w?k<x?k:x:w<x?w:x,e=m<u?m<v?m:v:u<v?u:v,f=k>w?k>x?k:x:w>x?w:x,h=m>u?m>v?m:v:u>v?u:v):(c=k<w?k<x?k<c?k:c:x<c?x:c:w<x?w<c?w:c:x<c?x:c,e=m<u?m<v?m<e?m:e:v<e?v:e:u<v?u<e?u:e:v<e?v:e,f=k>w?k>x?k>f?k:f:x>f?x:f:w>x?w>f?w:f:x>f?x:f,h=m>u?m>v?m>h?m:h:v>h?v:h:u>v?u>h?u:h:v>h?v:h);b()};this.addRectangle=function(k){n?(n=!1,c=k.getLeft(),e=k.getTop(),f=k.getRight(),h=k.getBottom()):(c=c<k.getLeft()?c:k.getLeft(),e=e<k.getTop()?e:k.getTop(),f=f>k.getRight()?f:k.getRight(),h=h>
 k.getBottom()?h:k.getBottom());b()};this.inflate=function(k){c-=k;e-=k;f+=k;h+=k;b()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();e=e>k.getTop()?e:k.getTop();f=f<k.getRight()?f:k.getRight();h=h<k.getBottom()?h:k.getBottom();b()};this.intersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){n=!0;h=f=e=c=0;b()};this.isEmpty=function(){return n}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};
-THREE.Matrix4=function(b,c,e,f,h,k,m,n,p,u,v,t,w,x,y,z){this.set(b!==void 0?b:1,c||0,e||0,f||0,h||0,k!==void 0?k:1,m||0,n||0,p||0,u||0,v!==void 0?v:1,t||0,w||0,x||0,y||0,z!==void 0?z:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,m,n,p,u,v,t,w,x,y,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=m;this.n24=n;this.n31=p;this.n32=u;this.n33=v;this.n34=t;this.n41=w;this.n42=x;this.n43=y;this.n44=z;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,
+THREE.Matrix4=function(b,c,e,f,h,k,m,n,p,t,w,u,x,v,A,z){this.set(b!==void 0?b:1,c||0,e||0,f||0,h||0,k!==void 0?k:1,m||0,n||0,p||0,t||0,w!==void 0?w:1,u||0,x||0,v||0,A||0,z!==void 0?z:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,m,n,p,t,w,u,x,v,A,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=m;this.n24=n;this.n31=p;this.n32=t;this.n33=w;this.n34=u;this.n41=x;this.n42=v;this.n43=A;this.n44=z;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,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());h.cross(k,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=k.x;this.n21=f.y;this.n22=h.y;this.n23=k.y;this.n31=f.z;this.n32=h.z;this.n33=k.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=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)*h;
 b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;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,h=b.n13,k=b.n14,m=b.n21,n=b.n22,p=b.n23,u=b.n24,v=b.n31,t=b.n32,w=b.n33,x=b.n34,y=b.n41,z=b.n42,A=b.n43,E=b.n44,F=c.n11,D=c.n12,
-H=c.n13,L=c.n14,M=c.n21,K=c.n22,G=c.n23,B=c.n24,da=c.n31,J=c.n32,Q=c.n33,R=c.n34,Y=c.n41,W=c.n42,o=c.n43,ea=c.n44;this.n11=e*F+f*M+h*da+k*Y;this.n12=e*D+f*K+h*J+k*W;this.n13=e*H+f*G+h*Q+k*o;this.n14=e*L+f*B+h*R+k*ea;this.n21=m*F+n*M+p*da+u*Y;this.n22=m*D+n*K+p*J+u*W;this.n23=m*H+n*G+p*Q+u*o;this.n24=m*L+n*B+p*R+u*ea;this.n31=v*F+t*M+w*da+x*Y;this.n32=v*D+t*K+w*J+x*W;this.n33=v*H+t*G+w*Q+x*o;this.n34=v*L+t*B+w*R+x*ea;this.n41=y*F+z*M+A*da+E*Y;this.n42=y*D+z*K+A*J+E*W;this.n43=y*H+z*G+A*Q+E*o;this.n44=
-y*L+z*B+A*R+E*ea;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,h=this.n21,k=this.n22,m=this.n23,n=this.n24,p=this.n31,u=this.n32,v=this.n33,t=this.n34,w=this.n41,x=this.n42,y=this.n43,z=this.n44;return f*m*u*w-e*n*u*w-f*k*v*w+c*n*v*w+e*k*t*w-c*m*t*w-f*m*p*x+e*n*p*x+f*h*v*x-b*n*v*x-e*h*t*x+b*m*t*x+f*k*p*y-c*n*p*y-f*h*u*y+b*n*u*y+c*h*t*y-b*k*t*y-e*k*p*z+c*m*p*z+e*h*u*z-b*m*u*z-c*h*
-v*z+b*k*v*z},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=
+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,h=b.n13,k=b.n14,m=b.n21,n=b.n22,p=b.n23,t=b.n24,w=b.n31,u=b.n32,x=b.n33,v=b.n34,A=b.n41,z=b.n42,y=b.n43,D=b.n44,F=c.n11,E=c.n12,
+H=c.n13,L=c.n14,M=c.n21,K=c.n22,G=c.n23,B=c.n24,da=c.n31,J=c.n32,Q=c.n33,R=c.n34,Y=c.n41,W=c.n42,o=c.n43,ea=c.n44;this.n11=e*F+f*M+h*da+k*Y;this.n12=e*E+f*K+h*J+k*W;this.n13=e*H+f*G+h*Q+k*o;this.n14=e*L+f*B+h*R+k*ea;this.n21=m*F+n*M+p*da+t*Y;this.n22=m*E+n*K+p*J+t*W;this.n23=m*H+n*G+p*Q+t*o;this.n24=m*L+n*B+p*R+t*ea;this.n31=w*F+u*M+x*da+v*Y;this.n32=w*E+u*K+x*J+v*W;this.n33=w*H+u*G+x*Q+v*o;this.n34=w*L+u*B+x*R+v*ea;this.n41=A*F+z*M+y*da+D*Y;this.n42=A*E+z*K+y*J+D*W;this.n43=A*H+z*G+y*Q+D*o;this.n44=
+A*L+z*B+y*R+D*ea;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,h=this.n21,k=this.n22,m=this.n23,n=this.n24,p=this.n31,t=this.n32,w=this.n33,u=this.n34,x=this.n41,v=this.n42,A=this.n43,z=this.n44;return f*m*t*x-e*n*t*x-f*k*w*x+c*n*w*x+e*k*u*x-c*m*u*x-f*m*p*v+e*n*p*v+f*h*w*v-b*n*w*v-e*h*u*v+b*m*u*v+f*k*p*A-c*n*p*A-f*h*t*A+b*n*t*A+c*h*u*A-b*k*u*A-e*k*p*z+c*m*p*z+e*h*t*z-b*m*t*z-c*h*
+w*z+b*k*w*z},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),h=1-e,k=b.x,m=b.y,n=b.z,p=h*k,u=h*m;this.set(p*k+e,p*m-f*n,p*n+f*m,0,p*m+f*n,u*m+e,u*n-f*k,0,p*n-f*m,u*n+f*k,h*n*n+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=
+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),h=1-e,k=b.x,m=b.y,n=b.z,p=h*k,t=h*m;this.set(p*k+e,p*m-f*n,p*n+f*m,0,p*m+f*n,t*m+e,t*n-f*k,0,p*n-f*m,t*n+f*k,h*n*n+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,h=b.z,k=Math.cos(e),e=Math.sin(e),m=Math.cos(f),f=Math.sin(f),n=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var p=
-m*n,u=m*h,v=f*n,t=f*h;this.n11=p+t*e;this.n12=v*e-u;this.n13=k*f;this.n21=k*h;this.n22=k*n;this.n23=-e;this.n31=u*e-v;this.n32=t+p*e;this.n33=k*m;break;case "ZXY":p=m*n;u=m*h;v=f*n;t=f*h;this.n11=p-t*e;this.n12=-k*h;this.n13=v+u*e;this.n21=u+v*e;this.n22=k*n;this.n23=t-p*e;this.n31=-k*f;this.n32=e;this.n33=k*m;break;case "ZYX":p=k*n;u=k*h;v=e*n;t=e*h;this.n11=m*n;this.n12=v*f-u;this.n13=p*f+t;this.n21=m*h;this.n22=t*f+p;this.n23=u*f-v;this.n31=-f;this.n32=e*m;this.n33=k*m;break;case "YZX":p=k*m;u=
-k*f;v=e*m;t=e*f;this.n11=m*n;this.n12=t-p*h;this.n13=v*h+u;this.n21=h;this.n22=k*n;this.n23=-e*n;this.n31=-f*n;this.n32=u*h+v;this.n33=p-t*h;break;case "XZY":p=k*m;u=k*f;v=e*m;t=e*f;this.n11=m*n;this.n12=-h;this.n13=f*n;this.n21=p*h+t;this.n22=k*n;this.n23=u*h-v;this.n31=v*h-u;this.n32=e*n;this.n33=t*h+p;break;default:p=k*n,u=k*h,v=e*n,t=e*h,this.n11=m*n,this.n12=-m*h,this.n13=f,this.n21=u+v*f,this.n22=p-t*f,this.n23=-e*m,this.n31=t-p*f,this.n32=v+u*f,this.n33=k*m}return this},setRotationFromQuaternion:function(b){var c=
-b.x,e=b.y,f=b.z,h=b.w,k=c+c,m=e+e,n=f+f,b=c*k,p=c*m;c*=n;var u=e*m;e*=n;f*=n;k*=h;m*=h;h*=n;this.n11=1-(u+f);this.n12=p-h;this.n13=c+m;this.n21=p+h;this.n22=1-(b+f);this.n23=e-k;this.n31=c-m;this.n32=e+k;this.n33=1-(b+u);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var f=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2;
+m*n,t=m*h,w=f*n,u=f*h;this.n11=p+u*e;this.n12=w*e-t;this.n13=k*f;this.n21=k*h;this.n22=k*n;this.n23=-e;this.n31=t*e-w;this.n32=u+p*e;this.n33=k*m;break;case "ZXY":p=m*n;t=m*h;w=f*n;u=f*h;this.n11=p-u*e;this.n12=-k*h;this.n13=w+t*e;this.n21=t+w*e;this.n22=k*n;this.n23=u-p*e;this.n31=-k*f;this.n32=e;this.n33=k*m;break;case "ZYX":p=k*n;t=k*h;w=e*n;u=e*h;this.n11=m*n;this.n12=w*f-t;this.n13=p*f+u;this.n21=m*h;this.n22=u*f+p;this.n23=t*f-w;this.n31=-f;this.n32=e*m;this.n33=k*m;break;case "YZX":p=k*m;t=
+k*f;w=e*m;u=e*f;this.n11=m*n;this.n12=u-p*h;this.n13=w*h+t;this.n21=h;this.n22=k*n;this.n23=-e*n;this.n31=-f*n;this.n32=t*h+w;this.n33=p-u*h;break;case "XZY":p=k*m;t=k*f;w=e*m;u=e*f;this.n11=m*n;this.n12=-h;this.n13=f*n;this.n21=p*h+u;this.n22=k*n;this.n23=t*h-w;this.n31=w*h-t;this.n32=e*n;this.n33=u*h+p;break;default:p=k*n,t=k*h,w=e*n,u=e*h,this.n11=m*n,this.n12=-m*h,this.n13=f,this.n21=t+w*f,this.n22=p-u*f,this.n23=-e*m,this.n31=u-p*f,this.n32=w+t*f,this.n33=k*m}return this},setRotationFromQuaternion:function(b){var c=
+b.x,e=b.y,f=b.z,h=b.w,k=c+c,m=e+e,n=f+f,b=c*k,p=c*m;c*=n;var t=e*m;e*=n;f*=n;k*=h;m*=h;h*=n;this.n11=1-(t+f);this.n12=p-h;this.n13=c+m;this.n21=p+h;this.n22=1-(b+f);this.n23=e-k;this.n31=c-m;this.n32=e+k;this.n33=1-(b+t);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var f=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2;
 f.identity();f.setRotationFromQuaternion(c);h.setScale(e.x,e.y,e.z);this.multiply(f,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);k.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length();
 e.y=h.length();e.z=k.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,h=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23=
 b.n23*h;this.n33=b.n33*h}};
-THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,p=b.n23,u=b.n24,v=b.n31,t=b.n32,w=b.n33,x=b.n34,y=b.n41,z=b.n42,A=b.n43,E=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*x*z-u*w*z+u*t*A-n*x*A-p*t*E+n*w*E;c.n12=k*w*z-h*x*z-k*t*A+f*x*A+h*t*E-f*w*E;c.n13=h*u*z-k*p*z+k*n*A-f*u*A-h*n*E+f*p*E;c.n14=k*p*t-h*u*t-k*n*w+f*u*w+h*n*x-f*p*x;c.n21=u*w*y-p*x*y-u*v*A+m*x*A+p*v*E-m*w*E;c.n22=h*x*y-k*w*y+k*v*A-e*x*A-h*v*E+e*w*E;c.n23=k*p*y-h*u*y-k*m*A+e*u*A+h*m*E-e*p*E;c.n24=
-h*u*v-k*p*v+k*m*w-e*u*w-h*m*x+e*p*x;c.n31=n*x*y-u*t*y+u*v*z-m*x*z-n*v*E+m*t*E;c.n32=k*t*y-f*x*y-k*v*z+e*x*z+f*v*E-e*t*E;c.n33=h*u*y-k*n*y+k*m*z-e*u*z-f*m*E+e*n*E;c.n34=k*n*v-f*u*v-k*m*t+e*u*t+f*m*x-e*n*x;c.n41=p*t*y-n*w*y-p*v*z+m*w*z+n*v*A-m*t*A;c.n42=f*w*y-h*t*y+h*v*z-e*w*z-f*v*A+e*t*A;c.n43=h*n*y-f*p*y-h*m*z+e*p*z+f*m*A-e*n*A;c.n44=f*p*v-h*n*v+h*m*t-e*p*t-f*m*w+e*n*w;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,m=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,u=b.n23*b.n12-b.n22*b.n13,v=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*m+b.n31*u;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*k;e[3]=b*m;e[4]=b*n;e[5]=b*p;e[6]=b*u;e[7]=b*v;e[8]=b*t;return c};
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,p=b.n23,t=b.n24,w=b.n31,u=b.n32,x=b.n33,v=b.n34,A=b.n41,z=b.n42,y=b.n43,D=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*v*z-t*x*z+t*u*y-n*v*y-p*u*D+n*x*D;c.n12=k*x*z-h*v*z-k*u*y+f*v*y+h*u*D-f*x*D;c.n13=h*t*z-k*p*z+k*n*y-f*t*y-h*n*D+f*p*D;c.n14=k*p*u-h*t*u-k*n*x+f*t*x+h*n*v-f*p*v;c.n21=t*x*A-p*v*A-t*w*y+m*v*y+p*w*D-m*x*D;c.n22=h*v*A-k*x*A+k*w*y-e*v*y-h*w*D+e*x*D;c.n23=k*p*A-h*t*A-k*m*y+e*t*y+h*m*D-e*p*D;c.n24=
+h*t*w-k*p*w+k*m*x-e*t*x-h*m*v+e*p*v;c.n31=n*v*A-t*u*A+t*w*z-m*v*z-n*w*D+m*u*D;c.n32=k*u*A-f*v*A-k*w*z+e*v*z+f*w*D-e*u*D;c.n33=h*t*A-k*n*A+k*m*z-e*t*z-f*m*D+e*n*D;c.n34=k*n*w-f*t*w-k*m*u+e*t*u+f*m*v-e*n*v;c.n41=p*u*A-n*x*A-p*w*z+m*x*z+n*w*y-m*u*y;c.n42=f*x*A-h*u*A+h*w*z-e*x*z-f*w*y+e*u*y;c.n43=h*n*A-f*p*A-h*m*z+e*p*z+f*m*y-e*n*y;c.n44=f*p*w-h*n*w+h*m*u-e*p*u-f*m*x+e*n*x;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,m=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,t=b.n23*b.n12-b.n22*b.n13,w=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*m+b.n31*t;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*k;e[3]=b*m;e[4]=b*n;e[5]=b*p;e[6]=b*t;e[7]=b*w;e[8]=b*u;return c};
 THREE.Matrix4.makeFrustum=function(b,c,e,f,h,k){var m;m=new THREE.Matrix4;m.n11=2*h/(c-b);m.n12=0;m.n13=(c+b)/(c-b);m.n14=0;m.n21=0;m.n22=2*h/(f-e);m.n23=(f+e)/(f-e);m.n24=0;m.n31=0;m.n32=0;m.n33=-(k+h)/(k-h);m.n34=-2*k*h/(k-h);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};THREE.Matrix4.makePerspective=function(b,c,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,f)};
-THREE.Matrix4.makeOrtho=function(b,c,e,f,h,k){var m,n,p,u;m=new THREE.Matrix4;n=c-b;p=e-f;u=k-h;m.n11=2/n;m.n12=0;m.n13=0;m.n14=-((c+b)/n);m.n21=0;m.n22=2/p;m.n23=0;m.n24=-((e+f)/p);m.n31=0;m.n32=0;m.n33=-2/u;m.n34=-((k+h)/u);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(b,c,e,f,h,k){var m,n,p,t;m=new THREE.Matrix4;n=c-b;p=e-f;t=k-h;m.n11=2/n;m.n12=0;m.n13=0;m.n14=-((c+b)/n);m.n21=0;m.n22=2/p;m.n23=0;m.n24=-((e+f)/p);m.n31=0;m.n32=0;m.n33=-2/t;m.n34=-((k+h)/t);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.children.indexOf(b)===
@@ -54,22 +54,22 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){thi
 b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 this.remove(b)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function b(){var b=p[n]=p[n]||new THREE.RenderableVertex;n++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,k=b.z+b.w,h=c.z+c.w,m=-b.z+b.w,n=-c.z+c.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?e=Math.max(e,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?e=Math.max(e,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,h,k=[],m,n,p=[],u,v,t=[],w,x=[],y,z,A=[],E,F,D=[],H=[],L=[],M=new THREE.Vector4,K=new THREE.Vector4,
+THREE.Projector=function(){function b(){var b=p[n]=p[n]||new THREE.RenderableVertex;n++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,k=b.z+b.w,h=c.z+c.w,m=-b.z+b.w,n=-c.z+c.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?e=Math.max(e,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?e=Math.max(e,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,h,k=[],m,n,p=[],t,w,u=[],x,v=[],A,z,y=[],D,F,E=[],H=[],L=[],M=new THREE.Vector4,K=new THREE.Vector4,
 G=new THREE.Matrix4,B=new THREE.Matrix4,da=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(b,c){G.multiply(c.projectionMatrix,c.matrixWorldInverse);G.multiplyVector3(b);return b};this.unprojectVector=function(b,c){G.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));G.multiplyVector3(b);return b};this.projectObjects=function(b,e,m){var o,n;h=H.length=
-0;o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var u;if(!(u=!n.visible))if(u=n instanceof THREE.Mesh)if(u=n.frustumCulled){a:{u=void 0;for(var p=n.matrixWorld,x=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),t=0;t<6;t++)if(u=da[t].x*p.n14+da[t].y*p.n24+da[t].z*p.n34+da[t].w,u<=x){u=!1;break a}u=!0}u=!u}if(!u)u=k[h]=k[h]||new THREE.RenderableObject,h++,f=u,M.copy(n.position),G.multiplyVector3(M),f.object=n,f.z=M.z,H.push(f)}m&&H.sort(c);return H};this.projectScene=
-function(f,k,h){var o=k.near,H=k.far,M,ma,Z,ia,aa,ka,fa,ca,$,X,ga,la,ra,na,O,oa,qa;F=z=w=v=L.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);G.multiply(k.projectionMatrix,k.matrixWorldInverse);da[0].set(G.n41-G.n11,G.n42-G.n12,G.n43-G.n13,G.n44-G.n14);da[1].set(G.n41+G.n11,G.n42+G.n12,G.n43+G.n13,G.n44+G.n14);da[2].set(G.n41+G.n21,G.n42+G.n22,G.n43+G.n23,G.n44+G.n24);da[3].set(G.n41-G.n21,G.n42-G.n22,G.n43-G.n23,G.n44-G.n24);da[4].set(G.n41-G.n31,G.n42-G.n32,G.n43-G.n33,G.n44-
+0;o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var p;if(!(p=!n.visible))if(p=n instanceof THREE.Mesh)if(p=n.frustumCulled){a:{p=void 0;for(var t=n.matrixWorld,v=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(p=da[u].x*t.n14+da[u].y*t.n24+da[u].z*t.n34+da[u].w,p<=v){p=!1;break a}p=!0}p=!p}if(!p)p=k[h]=k[h]||new THREE.RenderableObject,h++,f=p,M.copy(n.position),G.multiplyVector3(M),f.object=n,f.z=M.z,H.push(f)}m&&H.sort(c);return H};this.projectScene=
+function(f,k,h){var o=k.near,H=k.far,M,ma,Z,ia,aa,ka,fa,ca,$,X,ga,la,ra,na,O,oa,qa;F=z=x=w=L.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);G.multiply(k.projectionMatrix,k.matrixWorldInverse);da[0].set(G.n41-G.n11,G.n42-G.n12,G.n43-G.n13,G.n44-G.n14);da[1].set(G.n41+G.n11,G.n42+G.n12,G.n43+G.n13,G.n44+G.n14);da[2].set(G.n41+G.n21,G.n42+G.n22,G.n43+G.n23,G.n44+G.n24);da[3].set(G.n41-G.n21,G.n42-G.n22,G.n43-G.n23,G.n44-G.n24);da[4].set(G.n41-G.n31,G.n42-G.n32,G.n43-G.n33,G.n44-
 G.n34);da[5].set(G.n41+G.n31,G.n42+G.n32,G.n43+G.n33,G.n44+G.n34);for(M=0;M<6;M++)$=da[M],$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z));$=this.projectObjects(f,k,!0);f=0;for(M=$.length;f<M;f++)if(X=$[f].object,X.visible)if(ga=X.matrixWorld,la=X.matrixRotationWorld,ra=X.materials,na=X.overdraw,n=0,X instanceof THREE.Mesh){O=X.geometry;ia=O.vertices;oa=O.faces;O=O.faceVertexUvs;ma=0;for(Z=ia.length;ma<Z;ma++)m=b(),m.positionWorld.copy(ia[ma].position),ga.multiplyVector3(m.positionWorld),m.positionScreen.copy(m.positionWorld),
 G.multiplyVector4(m.positionScreen),m.positionScreen.x/=m.positionScreen.w,m.positionScreen.y/=m.positionScreen.w,m.visible=m.positionScreen.z>o&&m.positionScreen.z<H;ia=0;for(ma=oa.length;ia<ma;ia++){Z=oa[ia];if(Z instanceof THREE.Face3)if(aa=p[Z.a],ka=p[Z.b],fa=p[Z.c],aa.visible&&ka.visible&&fa.visible&&(X.doubleSided||X.flipSided!=(fa.positionScreen.x-aa.positionScreen.x)*(ka.positionScreen.y-aa.positionScreen.y)-(fa.positionScreen.y-aa.positionScreen.y)*(ka.positionScreen.x-aa.positionScreen.x)<
-0))ca=t[v]=t[v]||new THREE.RenderableFace3,v++,u=ca,u.v1.copy(aa),u.v2.copy(ka),u.v3.copy(fa);else continue;else if(Z instanceof THREE.Face4)if(aa=p[Z.a],ka=p[Z.b],fa=p[Z.c],ca=p[Z.d],aa.visible&&ka.visible&&fa.visible&&ca.visible&&(X.doubleSided||X.flipSided!=((ca.positionScreen.x-aa.positionScreen.x)*(ka.positionScreen.y-aa.positionScreen.y)-(ca.positionScreen.y-aa.positionScreen.y)*(ka.positionScreen.x-aa.positionScreen.x)<0||(ka.positionScreen.x-fa.positionScreen.x)*(ca.positionScreen.y-fa.positionScreen.y)-
-(ka.positionScreen.y-fa.positionScreen.y)*(ca.positionScreen.x-fa.positionScreen.x)<0)))qa=x[w]=x[w]||new THREE.RenderableFace4,w++,u=qa,u.v1.copy(aa),u.v2.copy(ka),u.v3.copy(fa),u.v4.copy(ca);else continue;u.normalWorld.copy(Z.normal);la.multiplyVector3(u.normalWorld);u.centroidWorld.copy(Z.centroid);ga.multiplyVector3(u.centroidWorld);u.centroidScreen.copy(u.centroidWorld);G.multiplyVector3(u.centroidScreen);fa=Z.vertexNormals;aa=0;for(ka=fa.length;aa<ka;aa++)ca=u.vertexNormalsWorld[aa],ca.copy(fa[aa]),
-la.multiplyVector3(ca);aa=0;for(ka=O.length;aa<ka;aa++)if(qa=O[aa][ia]){fa=0;for(ca=qa.length;fa<ca;fa++)u.uvs[aa][fa]=qa[fa]}u.meshMaterials=ra;u.faceMaterials=Z.materials;u.overdraw=na;u.z=u.centroidScreen.z;L.push(u)}}else if(X instanceof THREE.Line){B.multiply(G,ga);ia=X.geometry.vertices;aa=b();aa.positionScreen.copy(ia[0].position);B.multiplyVector4(aa.positionScreen);ma=1;for(Z=ia.length;ma<Z;ma++)if(aa=b(),aa.positionScreen.copy(ia[ma].position),B.multiplyVector4(aa.positionScreen),ka=p[n-
-2],J.copy(aa.positionScreen),Q.copy(ka.positionScreen),e(J,Q))J.multiplyScalar(1/J.w),Q.multiplyScalar(1/Q.w),ga=A[z]=A[z]||new THREE.RenderableLine,z++,y=ga,y.v1.positionScreen.copy(J),y.v2.positionScreen.copy(Q),y.z=Math.max(J.z,Q.z),y.materials=X.materials,L.push(y)}else if(X instanceof THREE.Particle&&(K.set(X.matrixWorld.n14,X.matrixWorld.n24,X.matrixWorld.n34,1),G.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))ga=D[F]=D[F]||new THREE.RenderableParticle,F++,E=ga,E.x=K.x/K.w,E.y=K.y/K.w,E.z=K.z,E.rotation=
-X.rotation.z,E.scale.x=X.scale.x*Math.abs(E.x-(K.x+k.projectionMatrix.n11)/(K.w+k.projectionMatrix.n14)),E.scale.y=X.scale.y*Math.abs(E.y-(K.y+k.projectionMatrix.n22)/(K.w+k.projectionMatrix.n24)),E.materials=X.materials,L.push(E);h&&L.sort(c);return L}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
+0))ca=u[w]=u[w]||new THREE.RenderableFace3,w++,t=ca,t.v1.copy(aa),t.v2.copy(ka),t.v3.copy(fa);else continue;else if(Z instanceof THREE.Face4)if(aa=p[Z.a],ka=p[Z.b],fa=p[Z.c],ca=p[Z.d],aa.visible&&ka.visible&&fa.visible&&ca.visible&&(X.doubleSided||X.flipSided!=((ca.positionScreen.x-aa.positionScreen.x)*(ka.positionScreen.y-aa.positionScreen.y)-(ca.positionScreen.y-aa.positionScreen.y)*(ka.positionScreen.x-aa.positionScreen.x)<0||(ka.positionScreen.x-fa.positionScreen.x)*(ca.positionScreen.y-fa.positionScreen.y)-
+(ka.positionScreen.y-fa.positionScreen.y)*(ca.positionScreen.x-fa.positionScreen.x)<0)))qa=v[x]=v[x]||new THREE.RenderableFace4,x++,t=qa,t.v1.copy(aa),t.v2.copy(ka),t.v3.copy(fa),t.v4.copy(ca);else continue;t.normalWorld.copy(Z.normal);la.multiplyVector3(t.normalWorld);t.centroidWorld.copy(Z.centroid);ga.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);G.multiplyVector3(t.centroidScreen);fa=Z.vertexNormals;aa=0;for(ka=fa.length;aa<ka;aa++)ca=t.vertexNormalsWorld[aa],ca.copy(fa[aa]),
+la.multiplyVector3(ca);aa=0;for(ka=O.length;aa<ka;aa++)if(qa=O[aa][ia]){fa=0;for(ca=qa.length;fa<ca;fa++)t.uvs[aa][fa]=qa[fa]}t.meshMaterials=ra;t.faceMaterials=Z.materials;t.overdraw=na;t.z=t.centroidScreen.z;L.push(t)}}else if(X instanceof THREE.Line){B.multiply(G,ga);ia=X.geometry.vertices;aa=b();aa.positionScreen.copy(ia[0].position);B.multiplyVector4(aa.positionScreen);ma=1;for(Z=ia.length;ma<Z;ma++)if(aa=b(),aa.positionScreen.copy(ia[ma].position),B.multiplyVector4(aa.positionScreen),ka=p[n-
+2],J.copy(aa.positionScreen),Q.copy(ka.positionScreen),e(J,Q))J.multiplyScalar(1/J.w),Q.multiplyScalar(1/Q.w),ga=y[z]=y[z]||new THREE.RenderableLine,z++,A=ga,A.v1.positionScreen.copy(J),A.v2.positionScreen.copy(Q),A.z=Math.max(J.z,Q.z),A.materials=X.materials,L.push(A)}else if(X instanceof THREE.Particle&&(K.set(X.matrixWorld.n14,X.matrixWorld.n24,X.matrixWorld.n34,1),G.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))ga=E[F]=E[F]||new THREE.RenderableParticle,F++,D=ga,D.x=K.x/K.w,D.y=K.y/K.w,D.z=K.z,D.rotation=
+X.rotation.z,D.scale.x=X.scale.x*Math.abs(D.x-(K.x+k.projectionMatrix.n11)/(K.w+k.projectionMatrix.n14)),D.scale.y=X.scale.y*Math.abs(D.y-(K.y+k.projectionMatrix.n22)/(K.w+k.projectionMatrix.n24)),D.materials=X.materials,L.push(D);h&&L.sort(c);return L}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),k=Math.cos(e),e=Math.sin(e),m=b*c,n=f*h;this.w=m*k-n*e;this.x=m*e+n*k;this.y=f*c*k+b*h*e;this.z=b*h*k-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var 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,h=this.w,k=b.x,m=b.y,n=b.z,b=b.w;this.x=c*b+h*k+e*n-f*m;this.y=e*b+h*m+f*k-c*n;this.z=f*b+h*n+c*m-e*k;this.w=h*b-c*k-e*m-f*n;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,h=b.z,k=this.x,m=this.y,n=this.z,p=this.w,u=p*e+m*h-n*f,v=p*f+n*e-k*h,t=p*h+k*f-m*e,e=-k*
-e-m*f-n*h;c.x=u*p+e*-k+v*-n-t*-m;c.y=v*p+e*-m+t*-k-u*-n;c.z=t*p+e*-n+u*-m-v*-k;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var k=Math.acos(h),m=Math.sqrt(1-h*h);if(Math.abs(m)<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;h=Math.sin((1-f)*k)/m;f=Math.sin(f*k)/m;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e};
+this.x,e=this.y,f=this.z,h=this.w,k=b.x,m=b.y,n=b.z,b=b.w;this.x=c*b+h*k+e*n-f*m;this.y=e*b+h*m+f*k-c*n;this.z=f*b+h*n+c*m-e*k;this.w=h*b-c*k-e*m-f*n;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,h=b.z,k=this.x,m=this.y,n=this.z,p=this.w,t=p*e+m*h-n*f,w=p*f+n*e-k*h,u=p*h+k*f-m*e,e=-k*
+e-m*f-n*h;c.x=t*p+e*-k+w*-n-u*-m;c.y=w*p+e*-m+u*-k-t*-n;c.z=u*p+e*-n+t*-m-w*-k;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var k=Math.acos(h),m=Math.sqrt(1-h*h);if(Math.abs(m)<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;h=Math.sin((1-f)*k)/m;f=Math.sin(f*k)/m;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e};
 THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,h,k){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=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,e,f,h,k,m){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
@@ -78,16 +78,16 @@ c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid
 e,f,h,k,m,n=new THREE.Vector3,p=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){k=this.faces[f];if(b&&k.vertexNormals.length){n.set(0,0,0);c=0;for(e=k.vertexNormals.length;c<e;c++)n.addSelf(k.vertexNormals[c]);n.divideScalar(3)}else c=this.vertices[k.a],e=this.vertices[k.b],m=this.vertices[k.c],n.sub(m.position,e.position),p.sub(c.position,e.position),n.crossSelf(p);n.isZero()||n.normalize();k.normal.copy(n)}},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,k,h,o){n=b.vertices[c].position;p=b.vertices[e].position;u=b.vertices[f].position;v=m[k];t=m[h];w=m[o];x=p.x-n.x;y=u.x-n.x;z=p.y-n.y;A=u.y-n.y;E=p.z-n.z;F=u.z-n.z;D=t.u-v.u;H=w.u-v.u;L=t.v-v.v;M=w.v-v.v;K=1/(D*M-H*L);J.set((M*x-L*y)*K,(M*z-L*A)*K,(M*E-L*F)*K);Q.set((D*y-H*x)*K,(D*A-H*z)*K,(D*F-H*E)*K);B[c].addSelf(J);B[e].addSelf(J);B[f].addSelf(J);da[c].addSelf(Q);
-da[e].addSelf(Q);da[f].addSelf(Q)}var c,e,f,h,k,m,n,p,u,v,t,w,x,y,z,A,E,F,D,H,L,M,K,G,B=[],da=[],J=new THREE.Vector3,Q=new THREE.Vector3,R=new THREE.Vector3,Y=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)B[c]=new THREE.Vector3,da[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],m=this.faceVertexUvs[0][c],k instanceof THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var o=["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,k,h,o){n=b.vertices[c].position;p=b.vertices[e].position;t=b.vertices[f].position;w=m[k];u=m[h];x=m[o];v=p.x-n.x;A=t.x-n.x;z=p.y-n.y;y=t.y-n.y;D=p.z-n.z;F=t.z-n.z;E=u.u-w.u;H=x.u-w.u;L=u.v-w.v;M=x.v-w.v;K=1/(E*M-H*L);J.set((M*v-L*A)*K,(M*z-L*y)*K,(M*D-L*F)*K);Q.set((E*A-H*v)*K,(E*y-H*z)*K,(E*F-H*D)*K);B[c].addSelf(J);B[e].addSelf(J);B[f].addSelf(J);da[c].addSelf(Q);
+da[e].addSelf(Q);da[f].addSelf(Q)}var c,e,f,h,k,m,n,p,t,w,u,x,v,A,z,y,D,F,E,H,L,M,K,G,B=[],da=[],J=new THREE.Vector3,Q=new THREE.Vector3,R=new THREE.Vector3,Y=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)B[c]=new THREE.Vector3,da[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],m=this.faceVertexUvs[0][c],k instanceof THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var o=["a",
 "b","c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)W.copy(k.vertexNormals[f]),h=k[o[f]],G=B[h],R.copy(G),R.subSelf(W.multiplyScalar(W.dot(G))).normalize(),Y.cross(k.vertexNormals[f],G),h=Y.dot(da[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(R.x,R.y,R.z,h)}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}},mergeVertices:function(){var b={},c=[],e=[],f,h=Math.pow(10,4),k,m;k=0;for(m=this.vertices.length;k<m;k++)f=this.vertices[k].position,f=[Math.round(f.x*h),Math.round(f.y*h),Math.round(f.z*h)].join("_"),b[f]===void 0?(b[f]=k,c.push(this.vertices[k]),
 e[k]=c.length-1):e[k]=e[b[f]];k=0;for(m=this.faces.length;k<m;k++){b=this.faces[k];if(b instanceof THREE.Face3)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c];if(b instanceof THREE.Face4)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c],b.d=e[b.d]}this.vertices=c}};THREE.GeometryCount=0;
-THREE.Spline=function(b){function c(b,c,e,f,k,h,m){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*m+(-3*(c-e)-2*b-f)*h+b*k+c}this.points=b;var e=[],f={x:0,y:0,z:0},h,k,m,n,p,u,v,t,w;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;k=Math.floor(h);m=h-k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>this.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;u=this.points[e[0]];v=this.points[e[1]];
-t=this.points[e[2]];w=this.points[e[3]];n=m*m;p=m*n;f.x=c(u.x,v.x,t.x,w.x,m,n,p);f.y=c(u.y,v.y,t.y,w.y,m,n,p);f.z=c(u.z,v.z,t.z,w.z,m,n,p);return f};this.getControlPointsArray=function(){var b,c,e=this.points.length,f=[];for(b=0;b<e;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,e,f=c=c=0,k=new THREE.Vector3,h=new THREE.Vector3,m=[],n=0;m[0]=0;b||(b=100);e=this.points.length*b;k.copy(this.points[0]);for(b=1;b<e;b++)c=b/e,position=this.getPoint(c),h.copy(position),
-n+=h.distanceTo(k),k.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(m[c]=n,f=c);m[m.length]=n;return{chunks:m,total:n}};this.reparametrizeByArcLength=function(b){var c,e,f,k,h,m,n=[],u=new THREE.Vector3,p=this.getLength();n.push(u.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){e=p.chunks[c]-p.chunks[c-1];m=Math.ceil(b*e/p.total);k=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(e=1;e<m-1;e++)f=k+e*(1/m)*(h-k),position=this.getPoint(f),n.push(u.copy(position).clone());
-n.push(u.copy(this.points[c]).clone())}this.points=n}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){THREE.Object3D.call(this);arguments.length&&console.warn("DEPRECATED: Camera() is now PerspectiveCamera().");this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
+THREE.Spline=function(b){function c(b,c,e,f,k,h,m){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*m+(-3*(c-e)-2*b-f)*h+b*k+c}this.points=b;var e=[],f={x:0,y:0,z:0},h,k,m,n,p,t,w,u,x;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;k=Math.floor(h);m=h-k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>this.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;t=this.points[e[0]];w=this.points[e[1]];
+u=this.points[e[2]];x=this.points[e[3]];n=m*m;p=m*n;f.x=c(t.x,w.x,u.x,x.x,m,n,p);f.y=c(t.y,w.y,u.y,x.y,m,n,p);f.z=c(t.z,w.z,u.z,x.z,m,n,p);return f};this.getControlPointsArray=function(){var b,c,e=this.points.length,f=[];for(b=0;b<e;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,e,f=c=c=0,k=new THREE.Vector3,h=new THREE.Vector3,m=[],n=0;m[0]=0;b||(b=100);e=this.points.length*b;k.copy(this.points[0]);for(b=1;b<e;b++)c=b/e,position=this.getPoint(c),h.copy(position),
+n+=h.distanceTo(k),k.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(m[c]=n,f=c);m[m.length]=n;return{chunks:m,total:n}};this.reparametrizeByArcLength=function(b){var c,e,f,k,h,m,n=[],p=new THREE.Vector3,t=this.getLength();n.push(p.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){e=t.chunks[c]-t.chunks[c-1];m=Math.ceil(b*e/t.total);k=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(e=1;e<m-1;e++)f=k+e*(1/m)*(h-k),position=this.getPoint(f),n.push(p.copy(position).clone());
+n.push(p.copy(this.points[c]).clone())}this.points=n}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){THREE.Object3D.call(this);arguments.length&&console.warn("DEPRECATED: Camera() is now PerspectiveCamera().");this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
 THREE.Camera.prototype.lookAt=function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
 THREE.Camera.prototype.update=function(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};
 THREE.OrthographicCamera=function(b,c,e,f,h,k){THREE.Camera.call(this);this.left=b;this.right=c;this.top=e;this.bottom=f;this.near=h!==void 0?h:0.1;this.far=k!==void 0?k:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
@@ -145,49 +145,49 @@ THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)th
 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),c=this.__objectsAdded.indexOf(b),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};
 THREE.Scene.prototype.addChild=function(b){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addObject=function(b){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addLight=function(b){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(b)};THREE.Scene.prototype.removeChild=function(b){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(b)};
 THREE.Scene.prototype.removeObject=function(b){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(b)};THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;k=f/2};this.render=function(e,f){var p,u,v,t,w,x,y,z;b=c.projectScene(e,f);p=0;for(u=b.length;p<u;p++)if(w=b[p],w instanceof THREE.RenderableParticle){y=w.x*h+h;z=w.y*k+k;v=0;for(t=w.material.length;v<t;v++)if(x=w.material[v],x instanceof THREE.ParticleDOMMaterial)x=x.domElement,x.style.left=y+"px",x.style.top=z+"px"}}};
-THREE.CanvasRenderer=function(b){function c(b){if(A!=b)x.globalAlpha=A=b}function e(b){if(E!=b){switch(b){case THREE.NormalBlending:x.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:x.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:x.globalCompositeOperation="darker"}E=b}}function f(b){if(F!=b)x.strokeStyle=F=b}function h(b){if(D!=b)x.fillStyle=D=b}var k=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-u,v,t,w,x=p.getContext("2d"),y=new THREE.Color(0),z=0,A=1,E=0,F=null,D=null,H=null,L=null,M=null,K,G,B,da,J=new THREE.RenderableVertex,Q=new THREE.RenderableVertex,R,Y,W,o,ea,P,ma,Z,ia,aa,ka,fa,ca=new THREE.Color(0),$=new THREE.Color(0),X=new THREE.Color(0),ga=new THREE.Color(0),la=new THREE.Color(0),ra=[],na,O,oa,qa,va,ta,Ea,Aa,Ca,Fa,U=new THREE.Rectangle,T=new THREE.Rectangle,N=new THREE.Rectangle,ua=!1,ha=new THREE.Color,ja=new THREE.Color,ya=new THREE.Color,wa=new THREE.Color,pa=new THREE.Vector3,
-Ia,Da,Ka,Ba,Ga,V,b=16;Ia=document.createElement("canvas");Ia.width=Ia.height=2;Da=Ia.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Ka=Da.getImageData(0,0,2,2);Ba=Ka.data;Ga=document.createElement("canvas");Ga.width=Ga.height=b;V=Ga.getContext("2d");V.translate(-b/2,-b/2);V.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,c){u=b;v=c;t=Math.floor(u/2);w=Math.floor(v/2);p.width=u;
-p.height=v;U.set(-t,-w,t,w);T.set(-t,-w,t,w);A=1;E=0;M=L=H=D=F=null};this.setClearColor=function(b,c){y.copy(b);z=c;T.set(-t,-w,t,w)};this.setClearColorHex=function(b,c){y.setHex(b);z=c;T.set(-t,-w,t,w)};this.clear=function(){x.setTransform(1,0,0,-1,t,w);T.isEmpty()||(T.minSelf(U),T.inflate(2),z<1&&x.clearRect(Math.floor(T.getX()),Math.floor(T.getY()),Math.floor(T.getWidth()),Math.floor(T.getHeight())),z>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
-255)+","+z+")"),x.fillRect(Math.floor(T.getX()),Math.floor(T.getY()),Math.floor(T.getWidth()),Math.floor(T.getHeight()))),T.empty())};this.render=function(b,u){function p(b){var c,e,f,k=b.lights;ja.setRGB(0,0,0);ya.setRGB(0,0,0);wa.setRGB(0,0,0);b=0;for(c=k.length;b<c;b++)e=k[b],f=e.color,e instanceof THREE.AmbientLight?(ja.r+=f.r,ja.g+=f.g,ja.b+=f.b):e instanceof THREE.DirectionalLight?(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b):e instanceof THREE.PointLight&&(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b)}function v(b,c,e,
-f){var k,h,m,o,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],m=h.color,h instanceof THREE.DirectionalLight?(o=e.dot(h.position),o<=0||(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)):h instanceof THREE.PointLight&&(o=e.dot(pa.sub(h.position,c).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(c.distanceTo(h.position)/h.distance,1),o!=0&&(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)))}function z(b,k,m){c(m.opacity);e(m.blending);var o,n,u,p,v,xa;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)p=
-m.map.image,v=p.width>>1,xa=p.height>>1,m=k.scale.x*t,u=k.scale.y*w,o=m*v,n=u*xa,N.set(b.x-o,b.y-n,b.x+o,b.y+n),U.intersects(N)&&(x.save(),x.translate(b.x,b.y),x.rotate(-k.rotation),x.scale(m,-u),x.translate(-v,-xa),x.drawImage(p,0,0),x.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*t,n=k.scale.y*w,N.set(b.x-o,b.y-n,b.x+o,b.y+n),U.intersects(N)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),x.save(),x.translate(b.x,b.y),x.rotate(-k.rotation),x.scale(o,n),m.program(x),
-x.restore()))}function A(b,k,h,m){c(m.opacity);e(m.blending);x.beginPath();x.moveTo(b.positionScreen.x,b.positionScreen.y);x.lineTo(k.positionScreen.x,k.positionScreen.y);x.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(H!=b)x.lineWidth=H=b;b=m.linecap;if(L!=b)x.lineCap=L=b;b=m.linejoin;if(M!=b)x.lineJoin=M=b;f(m.color.getContextStyle());x.stroke();N.inflate(m.linewidth*2)}}function y(b,f,h,m,n,p,t,w,x){k.info.render.vertices+=3;k.info.render.faces++;c(w.opacity);e(w.blending);
-R=b.positionScreen.x;Y=b.positionScreen.y;W=f.positionScreen.x;o=f.positionScreen.y;ea=h.positionScreen.x;P=h.positionScreen.y;F(R,Y,W,o,ea,P);if(w instanceof THREE.MeshBasicMaterial)if(w.map)w.map.mapping instanceof THREE.UVMapping&&(qa=t.uvs[0],ab(R,Y,W,o,ea,P,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[p].u,qa[p].v,w.map));else if(w.envMap){if(w.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,pa.copy(t.vertexNormalsWorld[0]),va=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,
-ta=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[1]),Ea=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Aa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[2]),Ca=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Fa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,ab(R,Y,W,o,ea,P,va,ta,Ea,Aa,Ca,Fa,w.envMap)}else w.wireframe?Na(w.color,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(w.color);else if(w instanceof THREE.MeshLambertMaterial)w.map&&!w.wireframe&&
-(w.map.mapping instanceof THREE.UVMapping&&(qa=t.uvs[0],ab(R,Y,W,o,ea,P,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[p].u,qa[p].v,w.map)),e(THREE.SubtractiveBlending)),ua?!w.wireframe&&w.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==3?($.r=X.r=ga.r=ja.r,$.g=X.g=ga.g=ja.g,$.b=X.b=ga.b=ja.b,v(x,t.v1.positionWorld,t.vertexNormalsWorld[0],$),v(x,t.v2.positionWorld,t.vertexNormalsWorld[1],X),v(x,t.v3.positionWorld,t.vertexNormalsWorld[2],ga),$.r=Math.max(0,Math.min(w.color.r*$.r,1)),$.g=Math.max(0,
-Math.min(w.color.g*$.g,1)),$.b=Math.max(0,Math.min(w.color.b*$.b,1)),X.r=Math.max(0,Math.min(w.color.r*X.r,1)),X.g=Math.max(0,Math.min(w.color.g*X.g,1)),X.b=Math.max(0,Math.min(w.color.b*X.b,1)),ga.r=Math.max(0,Math.min(w.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(w.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(w.color.b*ga.b,1)),la.r=(X.r+ga.r)*0.5,la.g=(X.g+ga.g)*0.5,la.b=(X.b+ga.b)*0.5,oa=Ya($,X,ga,la),Va(R,Y,W,o,ea,P,0,0,1,0,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,v(x,t.centroidWorld,t.normalWorld,
-ha),ca.r=Math.max(0,Math.min(w.color.r*ha.r,1)),ca.g=Math.max(0,Math.min(w.color.g*ha.g,1)),ca.b=Math.max(0,Math.min(w.color.b*ha.b,1)),w.wireframe?Na(ca,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(ca)):w.wireframe?Na(w.color,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(w.color);else if(w instanceof THREE.MeshDepthMaterial)na=u.near,O=u.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,O),X.r=X.g=X.b=1-Ra(f.positionScreen.z,na,O),ga.r=ga.g=ga.b=1-Ra(h.positionScreen.z,
-na,O),la.r=(X.r+ga.r)*0.5,la.g=(X.g+ga.g)*0.5,la.b=(X.b+ga.b)*0.5,oa=Ya($,X,ga,la),Va(R,Y,W,o,ea,P,0,0,1,0,0,1,oa);else if(w instanceof THREE.MeshNormalMaterial)ca.r=Wa(t.normalWorld.x),ca.g=Wa(t.normalWorld.y),ca.b=Wa(t.normalWorld.z),w.wireframe?Na(ca,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(ca)}function E(b,f,h,m,n,w,p,t,x){k.info.render.vertices+=4;k.info.render.faces++;c(t.opacity);e(t.blending);if(t.map||t.envMap)y(b,f,m,0,1,3,p,t,x),y(n,h,w,1,2,3,p,t,x);else if(R=b.positionScreen.x,
-Y=b.positionScreen.y,W=f.positionScreen.x,o=f.positionScreen.y,ea=h.positionScreen.x,P=h.positionScreen.y,ma=m.positionScreen.x,Z=m.positionScreen.y,ia=n.positionScreen.x,aa=n.positionScreen.y,ka=w.positionScreen.x,fa=w.positionScreen.y,t instanceof THREE.MeshBasicMaterial)D(R,Y,W,o,ea,P,ma,Z),t.wireframe?Na(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Oa(t.color);else if(t instanceof THREE.MeshLambertMaterial)ua?!t.wireframe&&t.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==
-4?($.r=X.r=ga.r=la.r=ja.r,$.g=X.g=ga.g=la.g=ja.g,$.b=X.b=ga.b=la.b=ja.b,v(x,p.v1.positionWorld,p.vertexNormalsWorld[0],$),v(x,p.v2.positionWorld,p.vertexNormalsWorld[1],X),v(x,p.v4.positionWorld,p.vertexNormalsWorld[3],ga),v(x,p.v3.positionWorld,p.vertexNormalsWorld[2],la),$.r=Math.max(0,Math.min(t.color.r*$.r,1)),$.g=Math.max(0,Math.min(t.color.g*$.g,1)),$.b=Math.max(0,Math.min(t.color.b*$.b,1)),X.r=Math.max(0,Math.min(t.color.r*X.r,1)),X.g=Math.max(0,Math.min(t.color.g*X.g,1)),X.b=Math.max(0,Math.min(t.color.b*
-X.b,1)),ga.r=Math.max(0,Math.min(t.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(t.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(t.color.b*ga.b,1)),la.r=Math.max(0,Math.min(t.color.r*la.r,1)),la.g=Math.max(0,Math.min(t.color.g*la.g,1)),la.b=Math.max(0,Math.min(t.color.b*la.b,1)),oa=Ya($,X,ga,la),F(R,Y,W,o,ma,Z),Va(R,Y,W,o,ma,Z,0,0,1,0,0,1,oa),F(ia,aa,ea,P,ka,fa),Va(ia,aa,ea,P,ka,fa,1,0,1,1,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,v(x,p.centroidWorld,p.normalWorld,ha),ca.r=Math.max(0,Math.min(t.color.r*ha.r,
-1)),ca.g=Math.max(0,Math.min(t.color.g*ha.g,1)),ca.b=Math.max(0,Math.min(t.color.b*ha.b,1)),D(R,Y,W,o,ea,P,ma,Z),t.wireframe?Na(ca,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Oa(ca)):(D(R,Y,W,o,ea,P,ma,Z),t.wireframe?Na(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Oa(t.color));else if(t instanceof THREE.MeshNormalMaterial)ca.r=Wa(p.normalWorld.x),ca.g=Wa(p.normalWorld.y),ca.b=Wa(p.normalWorld.z),D(R,Y,W,o,ea,P,ma,Z),t.wireframe?Na(ca,t.wireframeLinewidth,t.wireframeLinecap,
-t.wireframeLinejoin):Oa(ca);else if(t instanceof THREE.MeshDepthMaterial)na=u.near,O=u.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,O),X.r=X.g=X.b=1-Ra(f.positionScreen.z,na,O),ga.r=ga.g=ga.b=1-Ra(m.positionScreen.z,na,O),la.r=la.g=la.b=1-Ra(h.positionScreen.z,na,O),oa=Ya($,X,ga,la),F(R,Y,W,o,ma,Z),Va(R,Y,W,o,ma,Z,0,0,1,0,0,1,oa),F(ia,aa,ea,P,ka,fa),Va(ia,aa,ea,P,ka,fa,1,0,1,1,0,1,oa)}function F(b,c,e,f,k,h){x.beginPath();x.moveTo(b,c);x.lineTo(e,f);x.lineTo(k,h);x.lineTo(b,c);x.closePath()}function D(b,
-c,e,f,k,h,m,o){x.beginPath();x.moveTo(b,c);x.lineTo(e,f);x.lineTo(k,h);x.lineTo(m,o);x.lineTo(b,c);x.closePath()}function Na(b,c,e,k){if(H!=c)x.lineWidth=H=c;if(L!=e)x.lineCap=L=e;if(M!=k)x.lineJoin=M=k;f(b.getContextStyle());x.stroke();N.inflate(c*2)}function Oa(b){h(b.getContextStyle());x.fill()}function ab(b,c,e,f,k,m,o,n,t,p,u,w,v){if(v.image.width!=0){if(v.needsUpdate==!0||ra[v.id]==void 0){var xa=v.wrapS==THREE.RepeatWrapping,z=v.wrapT==THREE.RepeatWrapping;ra[v.id]=x.createPattern(v.image,
-xa&&z?"repeat":xa&&!z?"repeat-x":!xa&&z?"repeat-y":"no-repeat");v.needsUpdate=!1}h(ra[v.id]);var xa=v.offset.x/v.repeat.x,z=v.offset.y/v.repeat.y,U=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,o=(o+xa)*U,n=(n+z)*v,t=(t+xa)*U,p=(p+z)*v,u=(u+xa)*U,w=(w+z)*v;e-=b;f-=c;k-=b;m-=c;t-=o;p-=n;u-=o;w-=n;xa=1/(t*w-u*p);v=(w*e-p*k)*xa;p=(w*f-p*m)*xa;e=(t*k-u*e)*xa;f=(t*m-u*f)*xa;b=b-v*o-e*n;c=c-p*o-f*n;x.save();x.transform(v,p,e,f,b,c);x.fill();x.restore()}}function Va(b,c,e,f,k,h,m,o,n,t,p,
-u,w){var v,xa;v=w.width-1;xa=w.height-1;m*=v;o*=xa;n*=v;t*=xa;p*=v;u*=xa;e-=b;f-=c;k-=b;h-=c;n-=m;t-=o;p-=m;u-=o;xa=1/(n*u-p*t);v=(u*e-t*k)*xa;t=(u*f-t*h)*xa;e=(n*k-p*e)*xa;f=(n*h-p*f)*xa;b=b-v*m-e*o;c=c-t*m-f*o;x.save();x.transform(v,t,e,f,b,c);x.clip();x.drawImage(w,0,0);x.restore()}function Ya(b,c,e,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),t=~~(e.g*255),e=~~(e.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Ba[0]=k<0?0:k>255?255:
-k;Ba[1]=h<0?0:h>255?255:h;Ba[2]=b<0?0:b>255?255:b;Ba[4]=m<0?0:m>255?255:m;Ba[5]=o<0?0:o>255?255:o;Ba[6]=c<0?0:c>255?255:c;Ba[8]=n<0?0:n>255?255:n;Ba[9]=t<0?0:t>255?255:t;Ba[10]=e<0?0:e>255?255:e;Ba[12]=p<0?0:p>255?255:p;Ba[13]=u<0?0:u>255?255:u;Ba[14]=f<0?0:f>255?255:f;Da.putImageData(Ka,0,0);V.drawImage(Ia,0,0);return Ga}function Ra(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Wa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(b,c){var e=c.x-b.x,f=c.y-b.y,k=e*e+f*f;k!=0&&(k=1/Math.sqrt(k),e*=
-k,f*=k,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Za,bb,sa,Ha,Qa,Xa,$a,za;this.autoClear?this.clear():x.setTransform(1,0,0,-1,t,w);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,u,this.sortElements);(ua=b.lights.length>0)&&p(b);Za=0;for(bb=m.length;Za<bb;Za++){sa=m[Za];N.empty();if(sa instanceof THREE.RenderableParticle){K=sa;K.x*=t;K.y*=w;Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&z(K,sa,za,b)}else if(sa instanceof THREE.RenderableLine){if(K=sa.v1,G=sa.v2,
-K.positionScreen.x*=t,K.positionScreen.y*=w,G.positionScreen.x*=t,G.positionScreen.y*=w,N.addPoint(K.positionScreen.x,K.positionScreen.y),N.addPoint(G.positionScreen.x,G.positionScreen.y),U.intersects(N)){Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&A(K,G,sa,za,b)}}else if(sa instanceof THREE.RenderableFace3){if(K=sa.v1,G=sa.v2,B=sa.v3,K.positionScreen.x*=t,K.positionScreen.y*=w,G.positionScreen.x*=t,G.positionScreen.y*=w,B.positionScreen.x*=t,B.positionScreen.y*=w,
-sa.overdraw&&(Pa(K.positionScreen,G.positionScreen),Pa(G.positionScreen,B.positionScreen),Pa(B.positionScreen,K.positionScreen)),N.add3Points(K.positionScreen.x,K.positionScreen.y,G.positionScreen.x,G.positionScreen.y,B.positionScreen.x,B.positionScreen.y),U.intersects(N)){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&y(K,G,B,0,1,2,sa,za,b)}else za.opacity!=
-0&&y(K,G,B,0,1,2,sa,za,b)}}else if(sa instanceof THREE.RenderableFace4&&(K=sa.v1,G=sa.v2,B=sa.v3,da=sa.v4,K.positionScreen.x*=t,K.positionScreen.y*=w,G.positionScreen.x*=t,G.positionScreen.y*=w,B.positionScreen.x*=t,B.positionScreen.y*=w,da.positionScreen.x*=t,da.positionScreen.y*=w,J.positionScreen.copy(G.positionScreen),Q.positionScreen.copy(da.positionScreen),sa.overdraw&&(Pa(K.positionScreen,G.positionScreen),Pa(G.positionScreen,da.positionScreen),Pa(da.positionScreen,K.positionScreen),Pa(B.positionScreen,
-J.positionScreen),Pa(B.positionScreen,Q.positionScreen)),N.addPoint(K.positionScreen.x,K.positionScreen.y),N.addPoint(G.positionScreen.x,G.positionScreen.y),N.addPoint(B.positionScreen.x,B.positionScreen.y),N.addPoint(da.positionScreen.x,da.positionScreen.y),U.intersects(N))){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&E(K,G,B,da,J,Q,sa,za,b)}else za.opacity!=
-0&&E(K,G,B,da,J,Q,sa,za,b)}T.addRectangle(N)}x.setTransform(1,0,0,1,0,0)}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;k=f/2};this.render=function(e,f){var p,t,w,u,x,v,A,z;b=c.projectScene(e,f);p=0;for(t=b.length;p<t;p++)if(x=b[p],x instanceof THREE.RenderableParticle){A=x.x*h+h;z=x.y*k+k;w=0;for(u=x.material.length;w<u;w++)if(v=x.material[w],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=A+"px",v.style.top=z+"px"}}};
+THREE.CanvasRenderer=function(b){function c(b){if(y!=b)v.globalAlpha=y=b}function e(b){if(D!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}D=b}}function f(b){if(F!=b)v.strokeStyle=F=b}function h(b){if(E!=b)v.fillStyle=E=b}var k=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
+t,w,u,x,v=p.getContext("2d"),A=new THREE.Color(0),z=0,y=1,D=0,F=null,E=null,H=null,L=null,M=null,K,G,B,da,J=new THREE.RenderableVertex,Q=new THREE.RenderableVertex,R,Y,W,o,ea,P,ma,Z,ia,aa,ka,fa,ca=new THREE.Color(0),$=new THREE.Color(0),X=new THREE.Color(0),ga=new THREE.Color(0),la=new THREE.Color(0),ra=[],na,O,oa,qa,va,ta,Ea,Aa,Ca,Fa,U=new THREE.Rectangle,T=new THREE.Rectangle,N=new THREE.Rectangle,ua=!1,ha=new THREE.Color,ja=new THREE.Color,ya=new THREE.Color,wa=new THREE.Color,pa=new THREE.Vector3,
+Ia,Da,Ka,Ba,Ga,V,b=16;Ia=document.createElement("canvas");Ia.width=Ia.height=2;Da=Ia.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Ka=Da.getImageData(0,0,2,2);Ba=Ka.data;Ga=document.createElement("canvas");Ga.width=Ga.height=b;V=Ga.getContext("2d");V.translate(-b/2,-b/2);V.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,c){t=b;w=c;u=Math.floor(t/2);x=Math.floor(w/2);p.width=t;
+p.height=w;U.set(-u,-x,u,x);T.set(-u,-x,u,x);y=1;D=0;M=L=H=E=F=null};this.setClearColor=function(b,c){A.copy(b);z=c;T.set(-u,-x,u,x)};this.setClearColorHex=function(b,c){A.setHex(b);z=c;T.set(-u,-x,u,x)};this.clear=function(){v.setTransform(1,0,0,-1,u,x);T.isEmpty()||(T.minSelf(U),T.inflate(2),z<1&&v.clearRect(Math.floor(T.getX()),Math.floor(T.getY()),Math.floor(T.getWidth()),Math.floor(T.getHeight())),z>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(A.r*255)+","+Math.floor(A.g*255)+","+Math.floor(A.b*
+255)+","+z+")"),v.fillRect(Math.floor(T.getX()),Math.floor(T.getY()),Math.floor(T.getWidth()),Math.floor(T.getHeight()))),T.empty())};this.render=function(b,p){function t(b){var c,e,f,k=b.lights;ja.setRGB(0,0,0);ya.setRGB(0,0,0);wa.setRGB(0,0,0);b=0;for(c=k.length;b<c;b++)e=k[b],f=e.color,e instanceof THREE.AmbientLight?(ja.r+=f.r,ja.g+=f.g,ja.b+=f.b):e instanceof THREE.DirectionalLight?(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b):e instanceof THREE.PointLight&&(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b)}function w(b,c,e,
+f){var k,h,m,o,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],m=h.color,h instanceof THREE.DirectionalLight?(o=e.dot(h.position),o<=0||(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)):h instanceof THREE.PointLight&&(o=e.dot(pa.sub(h.position,c).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(c.distanceTo(h.position)/h.distance,1),o!=0&&(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)))}function z(b,k,m){c(m.opacity);e(m.blending);var o,n,p,t,w,xa;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)t=
+m.map.image,w=t.width>>1,xa=t.height>>1,m=k.scale.x*u,p=k.scale.y*x,o=m*w,n=p*xa,N.set(b.x-o,b.y-n,b.x+o,b.y+n),U.intersects(N)&&(v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(m,-p),v.translate(-w,-xa),v.drawImage(t,0,0),v.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*u,n=k.scale.y*x,N.set(b.x-o,b.y-n,b.x+o,b.y+n),U.intersects(N)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(o,n),m.program(v),
+v.restore()))}function y(b,k,h,m){c(m.opacity);e(m.blending);v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(k.positionScreen.x,k.positionScreen.y);v.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(H!=b)v.lineWidth=H=b;b=m.linecap;if(L!=b)v.lineCap=L=b;b=m.linejoin;if(M!=b)v.lineJoin=M=b;f(m.color.getContextStyle());v.stroke();N.inflate(m.linewidth*2)}}function A(b,f,h,m,n,t,u,v,x){k.info.render.vertices+=3;k.info.render.faces++;c(v.opacity);e(v.blending);
+R=b.positionScreen.x;Y=b.positionScreen.y;W=f.positionScreen.x;o=f.positionScreen.y;ea=h.positionScreen.x;P=h.positionScreen.y;F(R,Y,W,o,ea,P);if(v instanceof THREE.MeshBasicMaterial)if(v.map)v.map.mapping instanceof THREE.UVMapping&&(qa=u.uvs[0],ab(R,Y,W,o,ea,P,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[t].u,qa[t].v,v.map));else if(v.envMap){if(v.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=p.matrixWorldInverse,pa.copy(u.vertexNormalsWorld[0]),va=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,
+ta=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(u.vertexNormalsWorld[1]),Ea=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Aa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(u.vertexNormalsWorld[2]),Ca=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Fa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,ab(R,Y,W,o,ea,P,va,ta,Ea,Aa,Ca,Fa,v.envMap)}else v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshLambertMaterial)v.map&&!v.wireframe&&
+(v.map.mapping instanceof THREE.UVMapping&&(qa=u.uvs[0],ab(R,Y,W,o,ea,P,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[t].u,qa[t].v,v.map)),e(THREE.SubtractiveBlending)),ua?!v.wireframe&&v.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?($.r=X.r=ga.r=ja.r,$.g=X.g=ga.g=ja.g,$.b=X.b=ga.b=ja.b,w(x,u.v1.positionWorld,u.vertexNormalsWorld[0],$),w(x,u.v2.positionWorld,u.vertexNormalsWorld[1],X),w(x,u.v3.positionWorld,u.vertexNormalsWorld[2],ga),$.r=Math.max(0,Math.min(v.color.r*$.r,1)),$.g=Math.max(0,
+Math.min(v.color.g*$.g,1)),$.b=Math.max(0,Math.min(v.color.b*$.b,1)),X.r=Math.max(0,Math.min(v.color.r*X.r,1)),X.g=Math.max(0,Math.min(v.color.g*X.g,1)),X.b=Math.max(0,Math.min(v.color.b*X.b,1)),ga.r=Math.max(0,Math.min(v.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(v.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(v.color.b*ga.b,1)),la.r=(X.r+ga.r)*0.5,la.g=(X.g+ga.g)*0.5,la.b=(X.b+ga.b)*0.5,oa=Ya($,X,ga,la),Va(R,Y,W,o,ea,P,0,0,1,0,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,w(x,u.centroidWorld,u.normalWorld,
+ha),ca.r=Math.max(0,Math.min(v.color.r*ha.r,1)),ca.g=Math.max(0,Math.min(v.color.g*ha.g,1)),ca.b=Math.max(0,Math.min(v.color.b*ha.b,1)),v.wireframe?Na(ca,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(ca)):v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshDepthMaterial)na=p.near,O=p.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,O),X.r=X.g=X.b=1-Ra(f.positionScreen.z,na,O),ga.r=ga.g=ga.b=1-Ra(h.positionScreen.z,
+na,O),la.r=(X.r+ga.r)*0.5,la.g=(X.g+ga.g)*0.5,la.b=(X.b+ga.b)*0.5,oa=Ya($,X,ga,la),Va(R,Y,W,o,ea,P,0,0,1,0,0,1,oa);else if(v instanceof THREE.MeshNormalMaterial)ca.r=Wa(u.normalWorld.x),ca.g=Wa(u.normalWorld.y),ca.b=Wa(u.normalWorld.z),v.wireframe?Na(ca,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(ca)}function D(b,f,h,m,n,t,v,u,x){k.info.render.vertices+=4;k.info.render.faces++;c(u.opacity);e(u.blending);if(u.map||u.envMap)A(b,f,m,0,1,3,v,u,x),A(n,h,t,1,2,3,v,u,x);else if(R=b.positionScreen.x,
+Y=b.positionScreen.y,W=f.positionScreen.x,o=f.positionScreen.y,ea=h.positionScreen.x,P=h.positionScreen.y,ma=m.positionScreen.x,Z=m.positionScreen.y,ia=n.positionScreen.x,aa=n.positionScreen.y,ka=t.positionScreen.x,fa=t.positionScreen.y,u instanceof THREE.MeshBasicMaterial)E(R,Y,W,o,ea,P,ma,Z),u.wireframe?Na(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color);else if(u instanceof THREE.MeshLambertMaterial)ua?!u.wireframe&&u.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==
+4?($.r=X.r=ga.r=la.r=ja.r,$.g=X.g=ga.g=la.g=ja.g,$.b=X.b=ga.b=la.b=ja.b,w(x,v.v1.positionWorld,v.vertexNormalsWorld[0],$),w(x,v.v2.positionWorld,v.vertexNormalsWorld[1],X),w(x,v.v4.positionWorld,v.vertexNormalsWorld[3],ga),w(x,v.v3.positionWorld,v.vertexNormalsWorld[2],la),$.r=Math.max(0,Math.min(u.color.r*$.r,1)),$.g=Math.max(0,Math.min(u.color.g*$.g,1)),$.b=Math.max(0,Math.min(u.color.b*$.b,1)),X.r=Math.max(0,Math.min(u.color.r*X.r,1)),X.g=Math.max(0,Math.min(u.color.g*X.g,1)),X.b=Math.max(0,Math.min(u.color.b*
+X.b,1)),ga.r=Math.max(0,Math.min(u.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(u.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(u.color.b*ga.b,1)),la.r=Math.max(0,Math.min(u.color.r*la.r,1)),la.g=Math.max(0,Math.min(u.color.g*la.g,1)),la.b=Math.max(0,Math.min(u.color.b*la.b,1)),oa=Ya($,X,ga,la),F(R,Y,W,o,ma,Z),Va(R,Y,W,o,ma,Z,0,0,1,0,0,1,oa),F(ia,aa,ea,P,ka,fa),Va(ia,aa,ea,P,ka,fa,1,0,1,1,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,w(x,v.centroidWorld,v.normalWorld,ha),ca.r=Math.max(0,Math.min(u.color.r*ha.r,
+1)),ca.g=Math.max(0,Math.min(u.color.g*ha.g,1)),ca.b=Math.max(0,Math.min(u.color.b*ha.b,1)),E(R,Y,W,o,ea,P,ma,Z),u.wireframe?Na(ca,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(ca)):(E(R,Y,W,o,ea,P,ma,Z),u.wireframe?Na(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color));else if(u instanceof THREE.MeshNormalMaterial)ca.r=Wa(v.normalWorld.x),ca.g=Wa(v.normalWorld.y),ca.b=Wa(v.normalWorld.z),E(R,Y,W,o,ea,P,ma,Z),u.wireframe?Na(ca,u.wireframeLinewidth,u.wireframeLinecap,
+u.wireframeLinejoin):Oa(ca);else if(u instanceof THREE.MeshDepthMaterial)na=p.near,O=p.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,O),X.r=X.g=X.b=1-Ra(f.positionScreen.z,na,O),ga.r=ga.g=ga.b=1-Ra(m.positionScreen.z,na,O),la.r=la.g=la.b=1-Ra(h.positionScreen.z,na,O),oa=Ya($,X,ga,la),F(R,Y,W,o,ma,Z),Va(R,Y,W,o,ma,Z,0,0,1,0,0,1,oa),F(ia,aa,ea,P,ka,fa),Va(ia,aa,ea,P,ka,fa,1,0,1,1,0,1,oa)}function F(b,c,e,f,k,h){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(b,c);v.closePath()}function E(b,
+c,e,f,k,h,m,o){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(m,o);v.lineTo(b,c);v.closePath()}function Na(b,c,e,k){if(H!=c)v.lineWidth=H=c;if(L!=e)v.lineCap=L=e;if(M!=k)v.lineJoin=M=k;f(b.getContextStyle());v.stroke();N.inflate(c*2)}function Oa(b){h(b.getContextStyle());v.fill()}function ab(b,c,e,f,k,m,o,n,p,t,u,x,w){if(w.image.width!=0){if(w.needsUpdate==!0||ra[w.id]==void 0){var xa=w.wrapS==THREE.RepeatWrapping,z=w.wrapT==THREE.RepeatWrapping;ra[w.id]=v.createPattern(w.image,
+xa&&z?"repeat":xa&&!z?"repeat-x":!xa&&z?"repeat-y":"no-repeat");w.needsUpdate=!1}h(ra[w.id]);var xa=w.offset.x/w.repeat.x,z=w.offset.y/w.repeat.y,U=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+xa)*U,n=(n+z)*w,p=(p+xa)*U,t=(t+z)*w,u=(u+xa)*U,x=(x+z)*w;e-=b;f-=c;k-=b;m-=c;p-=o;t-=n;u-=o;x-=n;xa=1/(p*x-u*t);w=(x*e-t*k)*xa;t=(x*f-t*m)*xa;e=(p*k-u*e)*xa;f=(p*m-u*f)*xa;b=b-w*o-e*n;c=c-t*o-f*n;v.save();v.transform(w,t,e,f,b,c);v.fill();v.restore()}}function Va(b,c,e,f,k,h,m,o,n,p,t,
+u,w){var x,xa;x=w.width-1;xa=w.height-1;m*=x;o*=xa;n*=x;p*=xa;t*=x;u*=xa;e-=b;f-=c;k-=b;h-=c;n-=m;p-=o;t-=m;u-=o;xa=1/(n*u-t*p);x=(u*e-p*k)*xa;p=(u*f-p*h)*xa;e=(n*k-t*e)*xa;f=(n*h-t*f)*xa;b=b-x*m-e*o;c=c-p*m-f*o;v.save();v.transform(x,p,e,f,b,c);v.clip();v.drawImage(w,0,0);v.restore()}function Ya(b,c,e,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255),t=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Ba[0]=k<0?0:k>255?255:
+k;Ba[1]=h<0?0:h>255?255:h;Ba[2]=b<0?0:b>255?255:b;Ba[4]=m<0?0:m>255?255:m;Ba[5]=o<0?0:o>255?255:o;Ba[6]=c<0?0:c>255?255:c;Ba[8]=n<0?0:n>255?255:n;Ba[9]=p<0?0:p>255?255:p;Ba[10]=e<0?0:e>255?255:e;Ba[12]=t<0?0:t>255?255:t;Ba[13]=u<0?0:u>255?255:u;Ba[14]=f<0?0:f>255?255:f;Da.putImageData(Ka,0,0);V.drawImage(Ia,0,0);return Ga}function Ra(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Wa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(b,c){var e=c.x-b.x,f=c.y-b.y,k=e*e+f*f;k!=0&&(k=1/Math.sqrt(k),e*=
+k,f*=k,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Za,bb,sa,Ha,Qa,Xa,$a,za;this.autoClear?this.clear():v.setTransform(1,0,0,-1,u,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,p,this.sortElements);(ua=b.lights.length>0)&&t(b);Za=0;for(bb=m.length;Za<bb;Za++){sa=m[Za];N.empty();if(sa instanceof THREE.RenderableParticle){K=sa;K.x*=u;K.y*=x;Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&z(K,sa,za,b)}else if(sa instanceof THREE.RenderableLine){if(K=sa.v1,G=sa.v2,
+K.positionScreen.x*=u,K.positionScreen.y*=x,G.positionScreen.x*=u,G.positionScreen.y*=x,N.addPoint(K.positionScreen.x,K.positionScreen.y),N.addPoint(G.positionScreen.x,G.positionScreen.y),U.intersects(N)){Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&y(K,G,sa,za,b)}}else if(sa instanceof THREE.RenderableFace3){if(K=sa.v1,G=sa.v2,B=sa.v3,K.positionScreen.x*=u,K.positionScreen.y*=x,G.positionScreen.x*=u,G.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,
+sa.overdraw&&(Pa(K.positionScreen,G.positionScreen),Pa(G.positionScreen,B.positionScreen),Pa(B.positionScreen,K.positionScreen)),N.add3Points(K.positionScreen.x,K.positionScreen.y,G.positionScreen.x,G.positionScreen.y,B.positionScreen.x,B.positionScreen.y),U.intersects(N)){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&A(K,G,B,0,1,2,sa,za,b)}else za.opacity!=
+0&&A(K,G,B,0,1,2,sa,za,b)}}else if(sa instanceof THREE.RenderableFace4&&(K=sa.v1,G=sa.v2,B=sa.v3,da=sa.v4,K.positionScreen.x*=u,K.positionScreen.y*=x,G.positionScreen.x*=u,G.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,da.positionScreen.x*=u,da.positionScreen.y*=x,J.positionScreen.copy(G.positionScreen),Q.positionScreen.copy(da.positionScreen),sa.overdraw&&(Pa(K.positionScreen,G.positionScreen),Pa(G.positionScreen,da.positionScreen),Pa(da.positionScreen,K.positionScreen),Pa(B.positionScreen,
+J.positionScreen),Pa(B.positionScreen,Q.positionScreen)),N.addPoint(K.positionScreen.x,K.positionScreen.y),N.addPoint(G.positionScreen.x,G.positionScreen.y),N.addPoint(B.positionScreen.x,B.positionScreen.y),N.addPoint(da.positionScreen.x,da.positionScreen.y),U.intersects(N))){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&D(K,G,B,da,J,Q,sa,za,b)}else za.opacity!=
+0&&D(K,G,B,da,J,Q,sa,za,b)}T.addRectangle(N)}v.setTransform(1,0,0,1,0,0)}};
 THREE.SVGRenderer=function(){function b(b,c,e){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=c.normalWorld.dot(h.position)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m)):h instanceof THREE.PointLight&&(da.sub(h.position,c.centroidWorld),da.normalize(),m=c.normalWorld.dot(da)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m))}function c(c,e,m,o,n,t){k.info.render.vertices+=3;k.info.render.faces++;R=f(Y++);
-R.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(L.r=M.r,L.g=M.g,L.b=M.b,b(t,o,L),H.r=Math.max(0,Math.min(n.color.r*L.r,1)),H.g=Math.max(0,Math.min(n.color.g*L.g,1)),H.b=Math.max(0,Math.min(n.color.b*L.b,1))):H.copy(n.color):n instanceof THREE.MeshDepthMaterial?(B=1-n.__2near/(n.__farPlusNear-
+R.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?E?(L.r=M.r,L.g=M.g,L.b=M.b,b(t,o,L),H.r=Math.max(0,Math.min(n.color.r*L.r,1)),H.g=Math.max(0,Math.min(n.color.g*L.g,1)),H.b=Math.max(0,Math.min(n.color.b*L.b,1))):H.copy(n.color):n instanceof THREE.MeshDepthMaterial?(B=1-n.__2near/(n.__farPlusNear-
 o.z*n.__farMinusNear),H.setRGB(B,B,B)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?R.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):R.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+n.opacity);p.appendChild(R)}function e(c,e,m,o,n,t,u){k.info.render.vertices+=
-4;k.info.render.faces++;R=f(Y++);R.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?H.copy(t.color):t instanceof THREE.MeshLambertMaterial?D?(L.r=M.r,L.g=M.g,L.b=M.b,b(u,n,L),H.r=Math.max(0,Math.min(t.color.r*L.r,1)),H.g=Math.max(0,Math.min(t.color.g*L.g,1)),H.b=Math.max(0,Math.min(t.color.b*L.b,1))):
+4;k.info.render.faces++;R=f(Y++);R.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?H.copy(t.color):t instanceof THREE.MeshLambertMaterial?E?(L.r=M.r,L.g=M.g,L.b=M.b,b(u,n,L),H.r=Math.max(0,Math.min(t.color.r*L.r,1)),H.g=Math.max(0,Math.min(t.color.g*L.g,1)),H.b=Math.max(0,Math.min(t.color.b*L.b,1))):
 H.copy(t.color):t instanceof THREE.MeshDepthMaterial?(B=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),H.setRGB(B,B,B)):t instanceof THREE.MeshNormalMaterial&&H.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));t.wireframe?R.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):R.setAttribute("style","fill: "+H.getContextStyle()+
-"; fill-opacity: "+t.opacity);p.appendChild(R)}function f(b){J[b]==null&&(J[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&J[b].setAttribute("shape-rendering","crispEdges"));return J[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,v,t,w,x,y,z,A,E=new THREE.Rectangle,F=new THREE.Rectangle,D=!1,H=new THREE.Color(16777215),L=new THREE.Color(16777215),M=new THREE.Color(0),
-K=new THREE.Color(0),G=new THREE.Color(0),B,da=new THREE.Vector3,J=[],Q=[],R,Y,W,o=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,c){u=b;v=c;t=u/2;w=v/2;p.setAttribute("viewBox",-t+" "+-w+" "+u+" "+v);p.setAttribute("width",u);p.setAttribute("height",v);E.set(-t,-w,t,w)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};
-this.render=function(b,f){var h,u,v,H,L,J,B,$;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);W=Y=0;if(D=b.lights.length>0){B=b.lights;M.setRGB(0,0,0);K.setRGB(0,0,0);G.setRGB(0,0,0);h=0;for(u=B.length;h<u;h++)v=B[h],H=v.color,v instanceof THREE.AmbientLight?(M.r+=H.r,M.g+=H.g,M.b+=H.b):v instanceof THREE.DirectionalLight?(K.r+=H.r,K.g+=H.g,K.b+=H.b):v instanceof THREE.PointLight&&(G.r+=H.r,G.g+=H.g,G.b+=H.b)}h=0;for(u=m.length;h<
-u;h++)if(B=m[h],F.empty(),B instanceof THREE.RenderableParticle){x=B;x.x*=t;x.y*=-w;v=0;for(H=B.materials.length;v<H;)v++}else if(B instanceof THREE.RenderableLine){if(x=B.v1,y=B.v2,x.positionScreen.x*=t,x.positionScreen.y*=-w,y.positionScreen.x*=t,y.positionScreen.y*=-w,F.addPoint(x.positionScreen.x,x.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),E.intersects(F)){v=0;for(H=B.materials.length;v<H;)if(($=B.materials[v++])&&$.opacity!=0){L=x;J=y;var X=W++;Q[X]==null&&(Q[X]=document.createElementNS("http://www.w3.org/2000/svg",
+"; fill-opacity: "+t.opacity);p.appendChild(R)}function f(b){J[b]==null&&(J[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&J[b].setAttribute("shape-rendering","crispEdges"));return J[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,w,u,x,v,A,z,y,D=new THREE.Rectangle,F=new THREE.Rectangle,E=!1,H=new THREE.Color(16777215),L=new THREE.Color(16777215),M=new THREE.Color(0),
+K=new THREE.Color(0),G=new THREE.Color(0),B,da=new THREE.Vector3,J=[],Q=[],R,Y,W,o=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,c){t=b;w=c;u=t/2;x=w/2;p.setAttribute("viewBox",-u+" "+-x+" "+t+" "+w);p.setAttribute("width",t);p.setAttribute("height",w);D.set(-u,-x,u,x)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};
+this.render=function(b,f){var h,t,w,H,L,J,B,$;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);W=Y=0;if(E=b.lights.length>0){B=b.lights;M.setRGB(0,0,0);K.setRGB(0,0,0);G.setRGB(0,0,0);h=0;for(t=B.length;h<t;h++)w=B[h],H=w.color,w instanceof THREE.AmbientLight?(M.r+=H.r,M.g+=H.g,M.b+=H.b):w instanceof THREE.DirectionalLight?(K.r+=H.r,K.g+=H.g,K.b+=H.b):w instanceof THREE.PointLight&&(G.r+=H.r,G.g+=H.g,G.b+=H.b)}h=0;for(t=m.length;h<
+t;h++)if(B=m[h],F.empty(),B instanceof THREE.RenderableParticle){v=B;v.x*=u;v.y*=-x;w=0;for(H=B.materials.length;w<H;)w++}else if(B instanceof THREE.RenderableLine){if(v=B.v1,A=B.v2,v.positionScreen.x*=u,v.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),D.intersects(F)){w=0;for(H=B.materials.length;w<H;)if(($=B.materials[w++])&&$.opacity!=0){L=v;J=A;var X=W++;Q[X]==null&&(Q[X]=document.createElementNS("http://www.w3.org/2000/svg",
 "line"),o==0&&Q[X].setAttribute("shape-rendering","crispEdges"));R=Q[X];R.setAttribute("x1",L.positionScreen.x);R.setAttribute("y1",L.positionScreen.y);R.setAttribute("x2",J.positionScreen.x);R.setAttribute("y2",J.positionScreen.y);$ instanceof THREE.LineBasicMaterial&&(R.setAttribute("style","fill: none; stroke: "+$.color.getContextStyle()+"; stroke-width: "+$.linewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.linecap+"; stroke-linejoin: "+$.linejoin),p.appendChild(R))}}}else if(B instanceof
-THREE.RenderableFace3){if(x=B.v1,y=B.v2,z=B.v3,x.positionScreen.x*=t,x.positionScreen.y*=-w,y.positionScreen.x*=t,y.positionScreen.y*=-w,z.positionScreen.x*=t,z.positionScreen.y*=-w,F.addPoint(x.positionScreen.x,x.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),E.intersects(F)){v=0;for(H=B.meshMaterials.length;v<H;)if($=B.meshMaterials[v++],$ instanceof THREE.MeshFaceMaterial){L=0;for(J=B.faceMaterials.length;L<J;)($=B.faceMaterials[L++])&&
-$.opacity!=0&&c(x,y,z,B,$,b)}else $&&$.opacity!=0&&c(x,y,z,B,$,b)}}else if(B instanceof THREE.RenderableFace4&&(x=B.v1,y=B.v2,z=B.v3,A=B.v4,x.positionScreen.x*=t,x.positionScreen.y*=-w,y.positionScreen.x*=t,y.positionScreen.y*=-w,z.positionScreen.x*=t,z.positionScreen.y*=-w,A.positionScreen.x*=t,A.positionScreen.y*=-w,F.addPoint(x.positionScreen.x,x.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),
-E.intersects(F))){v=0;for(H=B.meshMaterials.length;v<H;)if($=B.meshMaterials[v++],$ instanceof THREE.MeshFaceMaterial){L=0;for(J=B.faceMaterials.length;L<J;)($=B.faceMaterials[L++])&&$.opacity!=0&&e(x,y,z,A,B,$,b)}else $&&$.opacity!=0&&e(x,y,z,A,B,$,b)}}};
+THREE.RenderableFace3){if(v=B.v1,A=B.v2,z=B.v3,v.positionScreen.x*=u,v.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),D.intersects(F)){w=0;for(H=B.meshMaterials.length;w<H;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){L=0;for(J=B.faceMaterials.length;L<J;)($=B.faceMaterials[L++])&&
+$.opacity!=0&&c(v,A,z,B,$,b)}else $&&$.opacity!=0&&c(v,A,z,B,$,b)}}else if(B instanceof THREE.RenderableFace4&&(v=B.v1,A=B.v2,z=B.v3,y=B.v4,v.positionScreen.x*=u,v.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),
+D.intersects(F))){w=0;for(H=B.meshMaterials.length;w<H;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){L=0;for(J=B.faceMaterials.length;L<J;)($=B.faceMaterials[L++])&&$.opacity!=0&&e(v,A,z,y,B,$,b)}else $&&$.opacity!=0&&e(v,A,z,y,B,$,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",
@@ -219,44 +219,44 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
 "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(b){function c(b,c,e){var f,k,h,m=b.vertices,n=m.length,t=b.colors,p=t.length,u=b.__vertexArray,w=b.__colorArray,v=b.__sortArray,x=b.__dirtyVertices,z=b.__dirtyColors,U=b.__webglCustomAttributes,A,y;if(U)for(A in U)U[A].offset=0;if(e.sortParticles){ta.multiplySelf(e.matrixWorld);for(f=0;f<n;f++)k=m[f].position,Ca.copy(k),ta.multiplyVector3(Ca),v[f]=[Ca.z,f];v.sort(function(b,c){return c[0]-b[0]});for(f=0;f<n;f++)k=m[v[f][1]].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;
-for(f=0;f<p;f++)h=f*3,color=t[v[f][1]],w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if(U)for(A in U){f=U[A];t=f.value.length;for(h=0;h<t;h++){index=v[h][1];p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[index];f.size===2?(f.array[p]=y.x,f.array[p+1]=y.y):f.size===3?f.type==="c"?(f.array[p]=y.r,f.array[p+1]=y.g,f.array[p+2]=y.b):(f.array[p]=y.x,f.array[p+1]=y.y,f.array[p+2]=y.z):(f.array[p]=
-y.x,f.array[p+1]=y.y,f.array[p+2]=y.z,f.array[p+3]=y.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;if(z)for(f=0;f<p;f++)color=t[f],h=f*3,w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if(U)for(A in U)if(f=U[A],f.__original.needsUpdate){t=f.value.length;for(h=0;h<t;h++){p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[h];f.size===2?(f.array[p]=
-y.x,f.array[p+1]=y.y):f.size===3?f.type==="c"?(f.array[p]=y.r,f.array[p+1]=y.g,f.array[p+2]=y.b):(f.array[p]=y.x,f.array[p+1]=y.y,f.array[p+2]=y.z):(f.array[p]=y.x,f.array[p+1]=y.y,f.array[p+2]=y.z,f.array[p+3]=y.w)}f.offset+=f.size}}}if(x||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,u,c);if(z||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,w,c);if(U)for(A in U)if(f=U[A],f.__original.needsUpdate||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
+THREE.WebGLRenderer=function(b){function c(b,c,e){var f,k,h,m=b.vertices,n=m.length,p=b.colors,t=p.length,u=b.__vertexArray,v=b.__colorArray,w=b.__sortArray,x=b.__dirtyVertices,z=b.__dirtyColors,U=b.__webglCustomAttributes,y,A;if(U)for(y in U)U[y].offset=0;if(e.sortParticles){ta.multiplySelf(e.matrixWorld);for(f=0;f<n;f++)k=m[f].position,Ca.copy(k),ta.multiplyVector3(Ca),w[f]=[Ca.z,f];w.sort(function(b,c){return c[0]-b[0]});for(f=0;f<n;f++)k=m[w[f][1]].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;
+for(f=0;f<t;f++)h=f*3,color=p[w[f][1]],v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(U)for(y in U){f=U[y];p=f.value.length;for(h=0;h<p;h++){index=w[h][1];t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")A=f.value[index];f.size===2?(f.array[t]=A.x,f.array[t+1]=A.y):f.size===3?f.type==="c"?(f.array[t]=A.r,f.array[t+1]=A.g,f.array[t+2]=A.b):(f.array[t]=A.x,f.array[t+1]=A.y,f.array[t+2]=A.z):(f.array[t]=
+A.x,f.array[t+1]=A.y,f.array[t+2]=A.z,f.array[t+3]=A.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;if(z)for(f=0;f<t;f++)color=p[f],h=f*3,v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(U)for(y in U)if(f=U[y],f.__original.needsUpdate){p=f.value.length;for(h=0;h<p;h++){t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")A=f.value[h];f.size===2?(f.array[t]=
+A.x,f.array[t+1]=A.y):f.size===3?f.type==="c"?(f.array[t]=A.r,f.array[t+1]=A.g,f.array[t+2]=A.b):(f.array[t]=A.x,f.array[t+1]=A.y,f.array[t+2]=A.z):(f.array[t]=A.x,f.array[t+1]=A.y,f.array[t+2]=A.z,f.array[t+3]=A.w)}f.offset+=f.size}}}if(x||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,u,c);if(z||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,v,c);if(U)for(y in U)if(f=U[y],f.__original.needsUpdate||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
 f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,k){f.program||W.initMaterial(f,c,e,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(W.maxMorphTargets);for(var h=0,m=W.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var n=!1,h=f.program,m=h.uniforms,t=f.uniforms;h!=P&&(o.useProgram(h),P=h,n=!0);if(f.id!=Z)Z=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ea);if(e&&f.fog)if(t.fogColor.value=e.color,e instanceof
-THREE.Fog)t.fogNear.value=e.near,t.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)t.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var p,u,w=0,v=0,x=0,y,z,A,N=Fa,T=N.directional.colors,E=N.directional.positions,F=N.point.colors,D=N.point.positions,H=N.point.distances,na=0,ua=0,e=p=A=0,n=c.length;e<n;e++)if(p=c[e],u=p.color,y=p.position,z=p.intensity,A=p.distance,p instanceof THREE.AmbientLight)w+=u.r,v+=u.g,x+=u.b;else if(p instanceof
-THREE.DirectionalLight)A=na*3,T[A]=u.r*z,T[A+1]=u.g*z,T[A+2]=u.b*z,E[A]=y.x,E[A+1]=y.y,E[A+2]=y.z,na+=1;else if(p instanceof THREE.SpotLight)A=na*3,T[A]=u.r*z,T[A+1]=u.g*z,T[A+2]=u.b*z,u=1/y.length(),E[A]=y.x*u,E[A+1]=y.y*u,E[A+2]=y.z*u,na+=1;else if(p instanceof THREE.PointLight)p=ua*3,F[p]=u.r*z,F[p+1]=u.g*z,F[p+2]=u.b*z,D[p]=y.x,D[p+1]=y.y,D[p+2]=y.z,H[ua]=A,ua+=1;e=na*3;for(n=T.length;e<n;e++)T[e]=0;e=ua*3;for(n=F.length;e<n;e++)F[e]=0;N.point.length=ua;N.directional.length=na;N.ambient[0]=w;
-N.ambient[1]=v;N.ambient[2]=x;c=Fa;t.enableLighting.value=c.directional.length+c.point.length;t.ambientLightColor.value=c.ambient;t.directionalLightColor.value=c.directional.colors;t.directionalLightDirection.value=c.directional.positions;t.pointLightColor.value=c.point.colors;t.pointLightPosition.value=c.point.positions;t.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)t.diffuse.value=
+THREE.Fog)t.fogNear.value=e.near,t.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)t.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var p,u,v=0,w=0,x=0,z,A,y,N=Fa,T=N.directional.colors,D=N.directional.positions,F=N.point.colors,E=N.point.positions,H=N.point.distances,na=0,ua=0,e=p=y=0,n=c.length;e<n;e++)if(p=c[e],u=p.color,z=p.position,A=p.intensity,y=p.distance,p instanceof THREE.AmbientLight)v+=u.r,w+=u.g,x+=u.b;else if(p instanceof
+THREE.DirectionalLight)y=na*3,T[y]=u.r*A,T[y+1]=u.g*A,T[y+2]=u.b*A,D[y]=z.x,D[y+1]=z.y,D[y+2]=z.z,na+=1;else if(p instanceof THREE.SpotLight)y=na*3,T[y]=u.r*A,T[y+1]=u.g*A,T[y+2]=u.b*A,u=1/z.length(),D[y]=z.x*u,D[y+1]=z.y*u,D[y+2]=z.z*u,na+=1;else if(p instanceof THREE.PointLight)p=ua*3,F[p]=u.r*A,F[p+1]=u.g*A,F[p+2]=u.b*A,E[p]=z.x,E[p+1]=z.y,E[p+2]=z.z,H[ua]=y,ua+=1;e=na*3;for(n=T.length;e<n;e++)T[e]=0;e=ua*3;for(n=F.length;e<n;e++)F[e]=0;N.point.length=ua;N.directional.length=na;N.ambient[0]=v;
+N.ambient[1]=w;N.ambient[2]=x;c=Fa;t.enableLighting.value=c.directional.length+c.point.length;t.ambientLightColor.value=c.ambient;t.directionalLightColor.value=c.directional.colors;t.directionalLightDirection.value=c.directional.positions;t.pointLightColor.value=c.point.colors;t.pointLightPosition.value=c.point.positions;t.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)t.diffuse.value=
 f.color,t.opacity.value=f.opacity,(t.map.texture=f.map)&&t.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),t.lightMap.texture=f.lightMap,t.envMap.texture=f.envMap,t.reflectivity.value=f.reflectivity,t.refractionRatio.value=f.refractionRatio,t.combine.value=f.combine,t.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)t.diffuse.value=f.color,t.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)t.psColor.value=
 f.color,t.opacity.value=f.opacity,t.size.value=f.size,t.scale.value=U.height/2,t.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)t.ambient.value=f.ambient,t.specular.value=f.specular,t.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)t.mNear.value=b.near,t.mFar.value=b.far,t.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)t.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&t.shadowMatrix){for(c=0;c<pa.length;c++)t.shadowMatrix.value[c]=
-pa[c],t.shadowMap.texture[c]=W.shadowMap[c];t.shadowDarkness.value=W.shadowMapDarkness;t.shadowBias.value=W.shadowMapBias}c=f.uniformsList;t=0;for(e=c.length;t<e;t++)if(v=h.uniforms[c[t][1]])if(w=c[t][0],x=w.type,n=w.value,x=="i")o.uniform1i(v,n);else if(x=="f")o.uniform1f(v,n);else if(x=="v2")o.uniform2f(v,n.x,n.y);else if(x=="v3")o.uniform3f(v,n.x,n.y,n.z);else if(x=="v4")o.uniform4f(v,n.x,n.y,n.z,n.w);else if(x=="c")o.uniform3f(v,n.r,n.g,n.b);else if(x=="fv1")o.uniform1fv(v,n);else if(x=="fv")o.uniform3fv(v,
-n);else if(x=="v3v"){if(!w._array)w._array=new Float32Array(3*n.length);x=0;for(y=n.length;x<y;x++)N=x*3,w._array[N]=n[x].x,w._array[N+1]=n[x].y,w._array[N+2]=n[x].z;o.uniform3fv(v,w._array)}else if(x=="m4"){if(!w._array)w._array=new Float32Array(16);n.flattenToArray(w._array);o.uniformMatrix4fv(v,!1,w._array)}else if(x=="m4v"){if(!w._array)w._array=new Float32Array(16*n.length);x=0;for(y=n.length;x<y;x++)n[x].flattenToArrayOffset(w._array,x*16);o.uniformMatrix4fv(v,!1,w._array)}else if(x=="t"){if(o.uniform1i(v,
-n),v=w.texture)if(v.image instanceof Array&&v.image.length==6){if(w=v,w.image.length==6)if(w.needsUpdate){if(!w.image.__webglTextureCube)w.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube);for(n=0;n<6;n++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,w.image[n]);G(o.TEXTURE_CUBE_MAP,w,w.image[0]);w.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube)}else v instanceof
-THREE.WebGLRenderTargetCube?(w=v,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,w.__webglTexture)):B(v,n)}else if(x=="tv"){if(!w._array){w._array=[];x=0;for(y=w.texture.length;x<y;x++)w._array[x]=n+x}o.uniform1iv(v,w._array);x=0;for(y=w.texture.length;x<y;x++)(v=w.texture[x])&&B(v,w._array[x])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof
+pa[c],t.shadowMap.texture[c]=W.shadowMap[c];t.shadowDarkness.value=W.shadowMapDarkness;t.shadowBias.value=W.shadowMapBias}c=f.uniformsList;t=0;for(e=c.length;t<e;t++)if(w=h.uniforms[c[t][1]])if(v=c[t][0],x=v.type,n=v.value,x=="i")o.uniform1i(w,n);else if(x=="f")o.uniform1f(w,n);else if(x=="v2")o.uniform2f(w,n.x,n.y);else if(x=="v3")o.uniform3f(w,n.x,n.y,n.z);else if(x=="v4")o.uniform4f(w,n.x,n.y,n.z,n.w);else if(x=="c")o.uniform3f(w,n.r,n.g,n.b);else if(x=="fv1")o.uniform1fv(w,n);else if(x=="fv")o.uniform3fv(w,
+n);else if(x=="v3v"){if(!v._array)v._array=new Float32Array(3*n.length);x=0;for(z=n.length;x<z;x++)N=x*3,v._array[N]=n[x].x,v._array[N+1]=n[x].y,v._array[N+2]=n[x].z;o.uniform3fv(w,v._array)}else if(x=="m4"){if(!v._array)v._array=new Float32Array(16);n.flattenToArray(v._array);o.uniformMatrix4fv(w,!1,v._array)}else if(x=="m4v"){if(!v._array)v._array=new Float32Array(16*n.length);x=0;for(z=n.length;x<z;x++)n[x].flattenToArrayOffset(v._array,x*16);o.uniformMatrix4fv(w,!1,v._array)}else if(x=="t"){if(o.uniform1i(w,
+n),w=v.texture)if(w.image instanceof Array&&w.image.length==6){if(v=w,v.image.length==6)if(v.needsUpdate){if(!v.image.__webglTextureCube)v.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube);for(n=0;n<6;n++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,v.image[n]);G(o.TEXTURE_CUBE_MAP,v,v.image[0]);v.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube)}else w instanceof
+THREE.WebGLRenderTargetCube?(v=w,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.__webglTexture)):B(w,n)}else if(x=="tv"){if(!v._array){v._array=[];x=0;for(z=v.texture.length;x<z;x++)v._array[x]=n+x}o.uniform1iv(w,v._array);x=0;for(z=v.texture.length;x<z;x++)(w=v.texture[x])&&B(w,v._array[x])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof
 THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,Aa);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,Aa),o.uniformMatrix4fv(m.boneGlobalMatrices,!1,k.boneMatrices))}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&
 m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,f=e(b,c,f,k,m),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=ia&&(ia=f,c=!0);if(!k.morphTargets&&b.position>=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),
-o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var t=0,p=m.morphTargetForcedOrder,w=m.morphTargetInfluences;t<k.numSupportedMorphTargets&&t<p.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p[t]]),o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[t]=w[p[t]],t++;else{var p=[],u=-1,
-v=0,w=m.morphTargetInfluences,x,y=w.length,t=0;for(m.morphTargetBase!==-1&&(p[m.morphTargetBase]=!0);t<k.numSupportedMorphTargets;){for(x=0;x<y;x++)!p[x]&&w[x]>u&&(v=x,u=w[v]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[v]);o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[t]=u;p[v]=1;u=-1;t++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=
+o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var t=0,p=m.morphTargetForcedOrder,u=m.morphTargetInfluences;t<k.numSupportedMorphTargets&&t<p.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p[t]]),o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[t]=u[p[t]],t++;else{var p=[],v=-1,
+w=0,u=m.morphTargetInfluences,x,z=u.length,t=0;for(m.morphTargetBase!==-1&&(p[m.morphTargetBase]=!0);t<k.numSupportedMorphTargets;){for(x=0;x<z;x++)!p[x]&&u[x]>v&&(w=x,v=u[w]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[t]=v;p[w]=1;v=-1;t++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=
 0&&(f=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,f.buffer),o.vertexAttribPointer(b[n],f.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,
 h.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));k.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,
 o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0))}m instanceof THREE.Mesh?(k.wireframe?(o.lineWidth(k.wireframeLinewidth),c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,
 o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=h.__webglFaceCount,W.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),W.info.render.calls++):
 m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),W.info.render.calls++)}}function h(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(c.attributes.position),o.vertexAttribPointer(c.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,
-b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,k,m,n,t,p,w,u,v,x=b.count*3;for(v=0;v<x;v+=9)e=b.normalArray,f=e[v],h=e[v+1],k=e[v+2],m=e[v+3],t=e[v+4],w=e[v+5],n=e[v+6],p=e[v+7],u=e[v+8],f=(f+m+n)/3,h=(h+t+p)/3,k=(k+w+u)/3,e[v]=f,e[v+1]=h,e[v+2]=k,e[v+3]=f,e[v+4]=h,e[v+5]=k,e[v+6]=f,e[v+7]=h,e[v+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(c.attributes.normal);o.vertexAttribPointer(c.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,
-0,b.count);b.count=0}function k(b){if(ka!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ka=b.doubleSided;if(fa!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),fa=b.flipSided}function m(b){$!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),$=b)}function n(b){X!=b&&(o.depthMask(b),X=b)}function p(b,c,e){ga!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ga=b);if(b&&(la!=c||ra!=e))o.polygonOffset(c,e),la=c,ra=e}function u(b){va[0].set(b.n41-
-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);va[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);va[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);va[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);va[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);va[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=va[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function v(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=va[f].x*c.n14+va[f].y*c.n24+va[f].z*c.n34+va[f].w,b<=e)return!1;return!0}function t(b,c){b.list[b.count]=c;b.count+=1}function w(b){var c,e,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?t(k,e):t(h,e)}function x(b){var c,e,f,h,k=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=k.materials.length;b<f;b++)if(c=k.materials[b],c instanceof THREE.MeshFaceMaterial){c=
-0;for(e=m.materials.length;c<e;c++)(h=m.materials[c])&&(h.transparent?t(o,h):t(n,h))}else(h=c)&&(h.transparent?t(o,h):t(n,h))}function y(b,c){return c.z-b.z}function z(b){var c,n,t,p=0,w,x,y,z,A=b.lights;wa||(wa=new THREE.PerspectiveCamera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar));c=0;for(n=A.length;c<n;c++)if(t=A[c],t instanceof THREE.SpotLight&&t.castShadow){Z=-1;W.shadowMap[p]||(W.shadowMap[p]=new THREE.WebGLRenderTarget(W.shadowMapWidth,W.shadowMapHeight,
-{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[p]||(pa[p]=new THREE.Matrix4);w=W.shadowMap[p];x=pa[p];wa.position.copy(t.position);wa.lookAt(t.target.position);wa.update(void 0,!0);b.update(void 0,!1,wa);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(wa.projectionMatrix);x.multiplySelf(wa.matrixWorldInverse);wa.matrixWorldInverse.flattenToArray(Aa);wa.projectionMatrix.flattenToArray(Ea);ta.multiply(wa.projectionMatrix,wa.matrixWorldInverse);
-u(ta);W.initWebGLObjects(b);da(w);o.clearColor(1,1,1,1);W.clear();o.clearColor(ha.r,ha.g,ha.b,ja);x=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(w=0;w<x;w++)y=b.__webglObjects[w],z=y.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||v(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,wa,!1),y.render=!0):y.render=!1:y.render=!1;m(!0);K(THREE.NormalBlending);for(w=0;w<x;w++)if(y=b.__webglObjects[w],y.render)z=y.object,buffer=y.buffer,k(z),y=z.customDepthMaterial?
-z.customDepthMaterial:z.geometry.morphTargets.length?Ka:Da,f(wa,A,null,y,buffer,z);for(w=0;w<t;w++)y=b.__webglObjectsImmediate[w],z=y.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,wa,!1),k(z),program=e(wa,A,null,Da,z),z.immediateRenderCallback?z.immediateRenderCallback(program,o,va):z.render(function(b){h(b,program,Da.shading)}));p++}}function A(b,c){var e,f,h;e=V.attributes;var k=V.uniforms,m=qa/oa,n,t=[],p=oa*0.5,w=qa*0.5,u=!0;o.useProgram(V.program);
+b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,k,m,n,t,p,u,v,w,x=b.count*3;for(w=0;w<x;w+=9)e=b.normalArray,f=e[w],h=e[w+1],k=e[w+2],m=e[w+3],t=e[w+4],u=e[w+5],n=e[w+6],p=e[w+7],v=e[w+8],f=(f+m+n)/3,h=(h+t+p)/3,k=(k+u+v)/3,e[w]=f,e[w+1]=h,e[w+2]=k,e[w+3]=f,e[w+4]=h,e[w+5]=k,e[w+6]=f,e[w+7]=h,e[w+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(c.attributes.normal);o.vertexAttribPointer(c.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,
+0,b.count);b.count=0}function k(b){if(ka!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ka=b.doubleSided;if(fa!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),fa=b.flipSided}function m(b){$!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),$=b)}function n(b){X!=b&&(o.depthMask(b),X=b)}function p(b,c,e){ga!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ga=b);if(b&&(la!=c||ra!=e))o.polygonOffset(c,e),la=c,ra=e}function t(b){va[0].set(b.n41-
+b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);va[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);va[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);va[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);va[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);va[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=va[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function w(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=va[f].x*c.n14+va[f].y*c.n24+va[f].z*c.n34+va[f].w,b<=e)return!1;return!0}function u(b,c){b.list[b.count]=c;b.count+=1}function x(b){var c,e,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?u(k,e):u(h,e)}function v(b){var c,e,f,h,k=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=k.materials.length;b<f;b++)if(c=k.materials[b],c instanceof THREE.MeshFaceMaterial){c=
+0;for(e=m.materials.length;c<e;c++)(h=m.materials[c])&&(h.transparent?u(o,h):u(n,h))}else(h=c)&&(h.transparent?u(o,h):u(n,h))}function A(b,c){return c.z-b.z}function z(b){var c,n,p,u=0,v,x,z,y,U=b.lights;wa||(wa=new THREE.PerspectiveCamera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar));c=0;for(n=U.length;c<n;c++)if(p=U[c],p instanceof THREE.SpotLight&&p.castShadow){Z=-1;W.shadowMap[u]||(W.shadowMap[u]=new THREE.WebGLRenderTarget(W.shadowMapWidth,W.shadowMapHeight,
+{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[u]||(pa[u]=new THREE.Matrix4);v=W.shadowMap[u];x=pa[u];wa.position.copy(p.position);wa.lookAt(p.target.position);wa.update(void 0,!0);b.update(void 0,!1,wa);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(wa.projectionMatrix);x.multiplySelf(wa.matrixWorldInverse);wa.matrixWorldInverse.flattenToArray(Aa);wa.projectionMatrix.flattenToArray(Ea);ta.multiply(wa.projectionMatrix,wa.matrixWorldInverse);
+t(ta);W.initWebGLObjects(b);da(v);o.clearColor(1,1,1,1);W.clear();o.clearColor(ha.r,ha.g,ha.b,ja);x=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)z=b.__webglObjects[v],y=z.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||!y.frustumCulled||w(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),D(y,wa,!1),z.render=!0):z.render=!1:z.render=!1;m(!0);K(THREE.NormalBlending);for(v=0;v<x;v++)if(z=b.__webglObjects[v],z.render)y=z.object,buffer=z.buffer,k(y),z=y.customDepthMaterial?
+y.customDepthMaterial:y.geometry.morphTargets.length?Ka:Da,f(wa,U,null,z,buffer,y);for(v=0;v<p;v++)z=b.__webglObjectsImmediate[v],y=z.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),D(y,wa,!1),k(y),program=e(wa,U,null,Da,y),y.immediateRenderCallback?y.immediateRenderCallback(program,o,va):y.render(function(b){h(b,program,Da.shading)}));u++}}function y(b,c){var e,f,h;e=V.attributes;var k=V.uniforms,m=qa/oa,n,t=[],p=oa*0.5,u=qa*0.5,v=!0;o.useProgram(V.program);
 P=V.program;ia=$=ca=-1;Ja||(o.enableVertexAttribArray(V.attributes.position),o.enableVertexAttribArray(V.attributes.uv),Ja=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.vertexAttribPointer(e.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(e.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Ea);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);e=0;for(f=b.__webglSprites.length;e<
-f;e++)if(h=b.__webglSprites[e],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(y);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-p)/p,(w-h.position.y)/
-w,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?qa:1),t[0]=n*m*h.scale.x,t[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),o.uniform1f(k.opacity,h.opacity),o.uniform3f(k.color,h.color.r,h.color.g,
-h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,t),h.mergeWith3D&&!u?(o.enable(o.DEPTH_TEST),u=!0):!h.mergeWith3D&&u&&(o.disable(o.DEPTH_TEST),u=!1),K(h.blending),B(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(X)}function E(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
-function F(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function D(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function H(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function L(b){function c(b){var h=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?h.push("undefined"):h.push(b[e].id);return h.join("_")}
-var e,f,h,k,m,n,o,t,p={},w=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h<k;h++)m=b.faces[h],n=m.materials,o=c(n),p[o]==void 0&&(p[o]={hash:o,counter:0}),t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:w}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[t].vertices+m>65535&&(p[o].counter+=1,t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],
-materials:n,vertices:0,numMorphTargets:w})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroups[u].id=aa++,b.geometryGroupsList.push(b.geometryGroups[u])}function M(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=ca){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);
+f;e++)if(h=b.__webglSprites[e],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(A);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-p)/p,(u-h.position.y)/
+u,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?qa:1),t[0]=n*m*h.scale.x,t[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),o.uniform1f(k.opacity,h.opacity),o.uniform3f(k.color,h.color.r,h.color.g,
+h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,t),h.mergeWith3D&&!v?(o.enable(o.DEPTH_TEST),v=!0):!h.mergeWith3D&&v&&(o.disable(o.DEPTH_TEST),v=!1),K(h.blending),B(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(X)}function D(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function F(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function E(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function H(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function L(b){function c(b){var h=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?h.push("undefined"):h.push(b[e].id);return h.join("_")}
+var e,f,h,k,m,n,o,t,p={},u=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h<k;h++)m=b.faces[h],n=m.materials,o=c(n),p[o]==void 0&&(p[o]={hash:o,counter:0}),t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:u}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[t].vertices+m>65535&&(p[o].counter+=1,t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],
+materials:n,vertices:0,numMorphTargets:u})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroups[v].id=aa++,b.geometryGroupsList.push(b.geometryGroups[v])}function M(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=ca){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);
 o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}ca=b}}function G(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,Y(c.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,Y(c.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Y(c.magFilter)),
 o.texParameteri(b,o.TEXTURE_MIN_FILTER,Y(c.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,R(c.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,R(c.minFilter)))}function B(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.info.memory.textures++;o.activeTexture(o.TEXTURE0+c);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof
 THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,Y(b.format),b.image.width,b.image.height,0,Y(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);G(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+c),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function da(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;
@@ -280,59 +280,59 @@ function(b,c){ha.setHex(b);ja=c;o.clearColor(ha.r,ha.g,ha.b,ja)};this.setClearCo
 delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];o.deleteBuffer(c.__webglVertexBuffer);o.deleteBuffer(c.__webglNormalBuffer);o.deleteBuffer(c.__webglTangentBuffer);o.deleteBuffer(c.__webglColorBuffer);o.deleteBuffer(c.__webglUVBuffer);o.deleteBuffer(c.__webglUV2Buffer);o.deleteBuffer(c.__webglSkinVertexABuffer);o.deleteBuffer(c.__webglSkinVertexBBuffer);o.deleteBuffer(c.__webglSkinIndicesBuffer);
 o.deleteBuffer(c.__webglSkinWeightsBuffer);o.deleteBuffer(c.__webglFaceBuffer);o.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)o.deleteBuffer(c.__webglMorphTargetsBuffers[e]);W.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),
 W.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),W.info.memory.textures--};this.initMaterial=function(b,c,e,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":
-b instanceof THREE.MeshLambertMaterial?n="lambert":b instanceof THREE.MeshPhongMaterial?n="phong":b instanceof THREE.LineBasicMaterial?n="basic":b instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var t=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(t.uniforms);b.vertexShader=t.vertexShader;b.fragmentShader=t.fragmentShader}var p,w,u;p=u=t=0;for(w=c.length;p<w;p++)m=c[p],m instanceof THREE.SpotLight&&u++,m instanceof THREE.DirectionalLight&&u++,m instanceof THREE.PointLight&&
-t++;t+u<=ya?p=u:(p=Math.ceil(ya*u/(t+u)),t=ya-p);m={directional:p,point:t};t=u=0;for(p=c.length;t<p;t++)w=c[t],w instanceof THREE.SpotLight&&w.castShadow&&u++;var v=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)v=f.bones.length;var x;a:{p=b.fragmentShader;w=b.vertexShader;var t=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
-maxDirLights:m.directional,maxPointLights:m.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},z,f=[];n?f.push(n):(f.push(p),f.push(w));for(z in e)f.push(z),f.push(e[z]);n=f.join();z=0;for(f=ea.length;z<f;z++)if(ea[z].code==n){x=ea[z].program;break a}z=o.createProgram();f=[Ga?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,
+b instanceof THREE.MeshLambertMaterial?n="lambert":b instanceof THREE.MeshPhongMaterial?n="phong":b instanceof THREE.LineBasicMaterial?n="basic":b instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var t=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(t.uniforms);b.vertexShader=t.vertexShader;b.fragmentShader=t.fragmentShader}var p,u,v;p=v=t=0;for(u=c.length;p<u;p++)m=c[p],m instanceof THREE.SpotLight&&v++,m instanceof THREE.DirectionalLight&&v++,m instanceof THREE.PointLight&&
+t++;t+v<=ya?p=v:(p=Math.ceil(ya*v/(t+v)),t=ya-p);m={directional:p,point:t};t=v=0;for(p=c.length;t<p;t++)u=c[t],u instanceof THREE.SpotLight&&u.castShadow&&v++;var w=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)w=f.bones.length;var x;a:{p=b.fragmentShader;u=b.vertexShader;var t=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
+maxDirLights:m.directional,maxPointLights:m.point,maxBones:w,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:v,alphaTest:b.alphaTest},y,f=[];n?f.push(n):(f.push(p),f.push(u));for(y in e)f.push(y),f.push(e[y]);n=f.join();y=0;for(f=ea.length;y<f;y++)if(ea[y].code==n){x=ea[y].program;break a}y=o.createProgram();f=[Ga?"#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");
 m=["#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.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&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");o.attachShader(z,Q("fragment",m+p));o.attachShader(z,Q("vertex",f+w));o.linkProgram(z);o.getProgramParameter(z,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(z,o.VALIDATE_STATUS)+", gl error ["+
-o.getError()+"]");z.uniforms={};z.attributes={};var y,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in t)f.push(y);y=f;f=0;for(t=y.length;f<t;f++)p=y[f],z.uniforms[p]=o.getUniformLocation(z,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(y=0;y<e.maxMorphTargets;y++)f.push("morphTarget"+y);for(x in c)f.push(x);
-x=f;y=0;for(c=x.length;y<c;y++)e=x[y],z.attributes[e]=o.getAttribLocation(z,e);z.id=ea.length;ea.push({program:z,code:n});W.info.memory.programs=ea.length;x=z}b.program=x;x=b.program.attributes;x.position>=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);x.tangent>=0&&o.enableVertexAttribArray(x.tangent);b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA),
-o.enableVertexAttribArray(x.skinVertexB),o.enableVertexAttribArray(x.skinIndex),o.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(k in b.attributes)x[k]!==void 0&&x[k]>=0&&o.enableVertexAttribArray(x[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)y="morphTarget"+k,x[y]>=0&&(o.enableVertexAttribArray(x[y]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,e,f){da(b);
-this.clear(c,e,f)};this.render=function(b,c,t,U){var N,T,F,D,H,na,B,G,ua=b.lights,L=b.fog;Z=-1;this.shadowMapEnabled&&z(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Aa);c.projectionMatrix.flattenToArray(Ea);ta.multiply(c.projectionMatrix,c.matrixWorldInverse);u(ta);this.initWebGLObjects(b);da(t);(this.autoClear||U)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
-H=b.__webglObjects.length;for(U=0;U<H;U++)if(N=b.__webglObjects[U],B=N.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||v(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),x(N),N.render=!0,this.sortObjects)N.object.renderDepth?N.z=N.object.renderDepth:(Ca.copy(B.position),ta.multiplyVector3(Ca),N.z=Ca.z)}else N.render=!1;else N.render=!1;this.sortObjects&&b.__webglObjects.sort(y);na=b.__webglObjectsImmediate.length;for(U=0;U<na;U++)N=b.__webglObjectsImmediate[U],
-B=N.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),w(N));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(U=0;U<H;U++)if(N=b.__webglObjects[U],N.render)B=N.object,G=N.buffer,k(B),f(c,ua,L,b.overrideMaterial,G,B);for(U=0;U<na;U++)N=b.__webglObjectsImmediate[U],B=N.object,B.visible&&(k(B),T=e(c,ua,L,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(T,o,va):B.render(function(b){h(b,T,
-Da.shading)}))}else{K(THREE.NormalBlending);for(U=H-1;U>=0;U--)if(N=b.__webglObjects[U],N.render){B=N.object;G=N.buffer;F=N.opaque;k(B);for(N=0;N<F.count;N++)D=F.list[N],m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,L,D,G,B)}for(U=0;U<na;U++)if(N=b.__webglObjectsImmediate[U],B=N.object,B.visible){F=N.opaque;k(B);for(N=0;N<F.count;N++)D=F.list[N],m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),T=e(c,
-ua,L,D,B),B.immediateRenderCallback?B.immediateRenderCallback(T,o,va):B.render(function(b){h(b,T,Da.shading)})}for(U=0;U<H;U++)if(N=b.__webglObjects[U],N.render){B=N.object;G=N.buffer;F=N.transparent;k(B);for(N=0;N<F.count;N++)D=F.list[N],K(D.blending),m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,L,D,G,B)}for(U=0;U<na;U++)if(N=b.__webglObjectsImmediate[U],B=N.object,B.visible){F=N.transparent;k(B);for(N=0;N<F.count;N++)D=F.list[N],K(D.blending),
-m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),T=e(c,ua,L,D,B),B.immediateRenderCallback?B.immediateRenderCallback(T,o,va):B.render(function(b){h(b,T,Da.shading)})}}b.__webglSprites.length&&A(b,c);t&&t.minFilter!==THREE.NearestFilter&&t.minFilter!==THREE.LinearFilter&&J(t)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
+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");o.attachShader(y,Q("fragment",m+p));o.attachShader(y,Q("vertex",f+u));o.linkProgram(y);o.getProgramParameter(y,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(y,o.VALIDATE_STATUS)+", gl error ["+
+o.getError()+"]");y.uniforms={};y.attributes={};var z,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(z in t)f.push(z);z=f;f=0;for(t=z.length;f<t;f++)p=z[f],y.uniforms[p]=o.getUniformLocation(y,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(z=0;z<e.maxMorphTargets;z++)f.push("morphTarget"+z);for(x in c)f.push(x);
+x=f;z=0;for(c=x.length;z<c;z++)e=x[z],y.attributes[e]=o.getAttribLocation(y,e);y.id=ea.length;ea.push({program:y,code:n});W.info.memory.programs=ea.length;x=y}b.program=x;x=b.program.attributes;x.position>=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);x.tangent>=0&&o.enableVertexAttribArray(x.tangent);b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA),
+o.enableVertexAttribArray(x.skinVertexB),o.enableVertexAttribArray(x.skinIndex),o.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(k in b.attributes)x[k]!==void 0&&x[k]>=0&&o.enableVertexAttribArray(x[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)z="morphTarget"+k,x[z]>=0&&(o.enableVertexAttribArray(x[z]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,e,f){da(b);
+this.clear(c,e,f)};this.render=function(b,c,u,U){var N,T,F,E,H,na,B,G,ua=b.lights,L=b.fog;Z=-1;this.shadowMapEnabled&&z(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Aa);c.projectionMatrix.flattenToArray(Ea);ta.multiply(c.projectionMatrix,c.matrixWorldInverse);t(ta);this.initWebGLObjects(b);da(u);(this.autoClear||U)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
+H=b.__webglObjects.length;for(U=0;U<H;U++)if(N=b.__webglObjects[U],B=N.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||w(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),D(B,c,!0),v(N),N.render=!0,this.sortObjects)N.object.renderDepth?N.z=N.object.renderDepth:(Ca.copy(B.position),ta.multiplyVector3(Ca),N.z=Ca.z)}else N.render=!1;else N.render=!1;this.sortObjects&&b.__webglObjects.sort(A);na=b.__webglObjectsImmediate.length;for(U=0;U<na;U++)N=b.__webglObjectsImmediate[U],
+B=N.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),D(B,c,!0),x(N));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(U=0;U<H;U++)if(N=b.__webglObjects[U],N.render)B=N.object,G=N.buffer,k(B),f(c,ua,L,b.overrideMaterial,G,B);for(U=0;U<na;U++)N=b.__webglObjectsImmediate[U],B=N.object,B.visible&&(k(B),T=e(c,ua,L,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(T,o,va):B.render(function(b){h(b,T,
+Da.shading)}))}else{K(THREE.NormalBlending);for(U=H-1;U>=0;U--)if(N=b.__webglObjects[U],N.render){B=N.object;G=N.buffer;F=N.opaque;k(B);for(N=0;N<F.count;N++)E=F.list[N],m(E.depthTest),n(E.depthWrite),p(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,ua,L,E,G,B)}for(U=0;U<na;U++)if(N=b.__webglObjectsImmediate[U],B=N.object,B.visible){F=N.opaque;k(B);for(N=0;N<F.count;N++)E=F.list[N],m(E.depthTest),n(E.depthWrite),p(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),T=e(c,
+ua,L,E,B),B.immediateRenderCallback?B.immediateRenderCallback(T,o,va):B.render(function(b){h(b,T,Da.shading)})}for(U=0;U<H;U++)if(N=b.__webglObjects[U],N.render){B=N.object;G=N.buffer;F=N.transparent;k(B);for(N=0;N<F.count;N++)E=F.list[N],K(E.blending),m(E.depthTest),n(E.depthWrite),p(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,ua,L,E,G,B)}for(U=0;U<na;U++)if(N=b.__webglObjectsImmediate[U],B=N.object,B.visible){F=N.transparent;k(B);for(N=0;N<F.count;N++)E=F.list[N],K(E.blending),
+m(E.depthTest),n(E.depthWrite),p(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),T=e(c,ua,L,E,B),B.immediateRenderCallback?B.immediateRenderCallback(T,o,va):B.render(function(b){h(b,T,Da.shading)})}}b.__webglSprites.length&&y(b,c);u&&u.minFilter!==THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter&&J(u)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
 f=b,h=void 0,k=void 0,m=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups==void 0&&L(k),k.geometryGroups){if(m=k.geometryGroups[h],!m.__webglVertexBuffer){var n=m;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();
 n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var t=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];t=0;for(p=n.numMorphTargets;t<
-p;t++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=e,w=void 0,u=void 0,x=void 0,v=x=void 0,z=void 0,y=void 0,U=y=t=0,N=x=u=void 0,x=p=N=u=w=void 0,v=n.geometry,z=v.faces,N=m.faces,w=0,u=N.length;w<u;w++)x=N[w],x=z[x],x instanceof THREE.Face3?(t+=3,y+=1,U+=3):x instanceof THREE.Face4&&(t+=4,y+=2,U+=4);for(var w=m,u=n,A=N=z=void 0,T=void 0,A=void 0,x=[],z=0,N=u.materials.length;z<N;z++)if(A=u.materials[z],A instanceof THREE.MeshFaceMaterial){A=0;for(l=w.materials.length;A<
-l;A++)(T=w.materials[A])&&x.push(T)}else(T=A)&&x.push(T);w=x;m.__materials=w;a:{z=u=void 0;N=w.length;for(u=0;u<N;u++)if(z=w[u],z.map||z.lightMap||z instanceof THREE.ShaderMaterial){u=!0;break a}u=!1}a:{N=z=void 0;x=w.length;for(z=0;z<x;z++)if(N=w[z],!(N instanceof THREE.MeshBasicMaterial&&!N.envMap||N instanceof THREE.MeshDepthMaterial)){N=N&&N.shading!=void 0&&N.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}N=!1}a:{x=z=void 0;A=w.length;for(z=0;z<A;z++)if(x=w[z],x.vertexColors){x=
-x.vertexColors;break a}x=!1}m.__vertexArray=new Float32Array(t*3);if(N)m.__normalArray=new Float32Array(t*3);if(v.hasTangents)m.__tangentArray=new Float32Array(t*4);if(x)m.__colorArray=new Float32Array(t*3);if(u){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)m.__uvArray=new Float32Array(t*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(t*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(t*4),m.__skinVertexBArray=
-new Float32Array(t*4),m.__skinIndexArray=new Float32Array(t*4),m.__skinWeightArray=new Float32Array(t*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(U*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];v=0;for(z=m.numMorphTargets;v<z;v++)m.__morphTargetsArrays.push(new Float32Array(t*3))}m.__needsSmoothNormals=N==THREE.SmoothShading;m.__uvType=u;m.__vertexColorType=x;m.__normalType=N;m.__webglFaceCount=y*3+(n.geometry.edgeFaces?
-n.geometry.edgeFaces.length*6:0);m.__webglLineCount=U*2;v=0;for(z=w.length;v<z;v++)if(u=w[v],u.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in u.attributes){x=u.attributes[a];N={};for(p in x)N[p]=x[p];if(!N.__webglInitialized||N.createUniqueBuffers)N.__webglInitialized=!0,y=1,N.type==="v2"?y=2:N.type==="v3"?y=3:N.type==="v4"?y=4:N.type==="c"&&(y=3),N.size=y,N.array=new Float32Array(t*y),N.buffer=o.createBuffer(),N.buffer.belongsToAttribute=a,x.needsUpdate=!0,
+p;t++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=e,u=void 0,v=void 0,x=void 0,w=x=void 0,y=void 0,z=void 0,U=z=t=0,N=x=v=void 0,x=p=N=v=u=void 0,w=n.geometry,y=w.faces,N=m.faces,u=0,v=N.length;u<v;u++)x=N[u],x=y[x],x instanceof THREE.Face3?(t+=3,z+=1,U+=3):x instanceof THREE.Face4&&(t+=4,z+=2,U+=4);for(var u=m,v=n,A=N=y=void 0,T=void 0,A=void 0,x=[],y=0,N=v.materials.length;y<N;y++)if(A=v.materials[y],A instanceof THREE.MeshFaceMaterial){A=0;for(l=u.materials.length;A<
+l;A++)(T=u.materials[A])&&x.push(T)}else(T=A)&&x.push(T);u=x;m.__materials=u;a:{y=v=void 0;N=u.length;for(v=0;v<N;v++)if(y=u[v],y.map||y.lightMap||y instanceof THREE.ShaderMaterial){v=!0;break a}v=!1}a:{N=y=void 0;x=u.length;for(y=0;y<x;y++)if(N=u[y],!(N instanceof THREE.MeshBasicMaterial&&!N.envMap||N instanceof THREE.MeshDepthMaterial)){N=N&&N.shading!=void 0&&N.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}N=!1}a:{x=y=void 0;A=u.length;for(y=0;y<A;y++)if(x=u[y],x.vertexColors){x=
+x.vertexColors;break a}x=!1}m.__vertexArray=new Float32Array(t*3);if(N)m.__normalArray=new Float32Array(t*3);if(w.hasTangents)m.__tangentArray=new Float32Array(t*4);if(x)m.__colorArray=new Float32Array(t*3);if(v){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)m.__uvArray=new Float32Array(t*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(t*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(t*4),m.__skinVertexBArray=
+new Float32Array(t*4),m.__skinIndexArray=new Float32Array(t*4),m.__skinWeightArray=new Float32Array(t*4);m.__faceArray=new Uint16Array(z*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(U*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];w=0;for(y=m.numMorphTargets;w<y;w++)m.__morphTargetsArrays.push(new Float32Array(t*3))}m.__needsSmoothNormals=N==THREE.SmoothShading;m.__uvType=v;m.__vertexColorType=x;m.__normalType=N;m.__webglFaceCount=z*3+(n.geometry.edgeFaces?
+n.geometry.edgeFaces.length*6:0);m.__webglLineCount=U*2;w=0;for(y=u.length;w<y;w++)if(v=u[w],v.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in v.attributes){x=v.attributes[a];N={};for(p in x)N[p]=x[p];if(!N.__webglInitialized||N.createUniqueBuffers)N.__webglInitialized=!0,z=1,N.type==="v2"?z=2:N.type==="v3"?z=3:N.type==="v4"?z=4:N.type==="c"&&(z=3),N.size=z,N.array=new Float32Array(t*z),N.buffer=o.createBuffer(),N.buffer.belongsToAttribute=a,x.needsUpdate=!0,
 N.__original=x;m.__webglCustomAttributes[a]=N}}m.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=
 n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.Line){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglLineCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(k=e.geometry,!k.__webglVertexBuffer)){m=k;m.__webglVertexBuffer=o.createBuffer();
-m.__webglColorBuffer=o.createBuffer();W.info.geometries++;m=k;n=e;t=m.vertices.length;m.__vertexArray=new Float32Array(t*3);m.__colorArray=new Float32Array(t*3);m.__sortArray=[];m.__webglParticleCount=t;m.__materials=n.materials;U=y=p=void 0;p=0;for(y=n.materials.length;p<y;p++)if(U=n.materials[p],U.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in U.attributes){originalAttribute=U.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
+m.__webglColorBuffer=o.createBuffer();W.info.geometries++;m=k;n=e;t=m.vertices.length;m.__vertexArray=new Float32Array(t*3);m.__colorArray=new Float32Array(t*3);m.__sortArray=[];m.__webglParticleCount=t;m.__materials=n.materials;U=z=p=void 0;p=0;for(z=n.materials.length;p<z;p++)if(U=n.materials[p],U.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in U.attributes){originalAttribute=U.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(t*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=
 !0;k.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups)m=k.geometryGroups[h],M(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(k=e.geometry,M(f.__webglObjects,k,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);
 e.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];f=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)H(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;k=void 0;for(k=f.length-1;k>=0;k--)f[k]==h&&f.splice(k,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&H(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,
-1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,p=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(t=h.geometryGroupsList.length;n<t;n++)if(m=h.geometryGroupsList[n],p=F(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||p)if(p=m,y=o.DYNAMIC_DRAW,U=!h.dynamic,p.__inittedArrays){var E=w=v=void 0,B=void 0,na=E=void 0,G=void 0,ua=void 0,ja=void 0,J=T=A=x=N=z=u=void 0,ha=void 0,K=void 0,
-I=B=ja=B=ua=G=void 0,C=void 0,O=C=I=G=void 0,X=void 0,Q=O=C=I=E=E=na=ja=B=O=C=I=X=O=C=I=X=O=C=I=void 0,R=0,oa=0,$=0,da=0,qa=0,Y=0,P=0,ya=0,V=0,S=0,pa=0,O=I=0,O=void 0,ga=p.__vertexArray,wa=p.__uvArray,va=p.__uv2Array,la=p.__normalArray,ia=p.__tangentArray,ca=p.__colorArray,aa=p.__skinVertexAArray,Z=p.__skinVertexBArray,ea=p.__skinIndexArray,fa=p.__skinWeightArray,Da=p.__morphTargetsArrays,ka=p.__webglCustomAttributes,C=void 0,ma=p.__faceArray,ra=p.__lineArray,Ia=p.__needsSmoothNormals,z=p.__vertexColorType,
-u=p.__uvType,N=p.__normalType,ta=k.geometry,Ea=ta.__dirtyVertices,Ba=ta.__dirtyElements,Aa=ta.__dirtyUvs,Ga=ta.__dirtyNormals,Ka=ta.__dirtyTangents,Ca=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ja=ta.vertices,cb=p.faces,fb=ta.faces,db=ta.faceVertexUvs[0],eb=ta.faceVertexUvs[1],Sa=ta.skinVerticesA,Ta=ta.skinVerticesB,Ua=ta.skinIndices,Ma=ta.skinWeights,La=ta.morphTargets;if(ka)for(Q in ka)ka[Q].offset=0,ka[Q].offsetSrc=0;v=0;for(w=cb.length;v<w;v++)if(E=cb[v],B=fb[E],db&&(x=db[E]),eb&&(A=eb[E]),E=
+1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,p=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(t=h.geometryGroupsList.length;n<t;n++)if(m=h.geometryGroupsList[n],p=F(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||p)if(p=m,z=o.DYNAMIC_DRAW,U=!h.dynamic,p.__inittedArrays){var D=u=w=void 0,B=void 0,na=D=void 0,G=void 0,ua=void 0,ja=void 0,J=T=A=x=N=y=v=void 0,ha=void 0,K=void 0,
+I=B=ja=B=ua=G=void 0,C=void 0,O=C=I=G=void 0,X=void 0,Q=O=C=I=D=D=na=ja=B=O=C=I=X=O=C=I=X=O=C=I=void 0,R=0,oa=0,$=0,da=0,qa=0,Y=0,P=0,ya=0,V=0,S=0,pa=0,O=I=0,O=void 0,ga=p.__vertexArray,wa=p.__uvArray,va=p.__uv2Array,la=p.__normalArray,ia=p.__tangentArray,ca=p.__colorArray,aa=p.__skinVertexAArray,Z=p.__skinVertexBArray,ea=p.__skinIndexArray,fa=p.__skinWeightArray,Da=p.__morphTargetsArrays,ka=p.__webglCustomAttributes,C=void 0,ma=p.__faceArray,ra=p.__lineArray,Ia=p.__needsSmoothNormals,y=p.__vertexColorType,
+v=p.__uvType,N=p.__normalType,ta=k.geometry,Ea=ta.__dirtyVertices,Ba=ta.__dirtyElements,Aa=ta.__dirtyUvs,Ga=ta.__dirtyNormals,Ka=ta.__dirtyTangents,Ca=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ja=ta.vertices,cb=p.faces,fb=ta.faces,db=ta.faceVertexUvs[0],eb=ta.faceVertexUvs[1],Sa=ta.skinVerticesA,Ta=ta.skinVerticesB,Ua=ta.skinIndices,Ma=ta.skinWeights,La=ta.morphTargets;if(ka)for(Q in ka)ka[Q].offset=0,ka[Q].offsetSrc=0;w=0;for(u=cb.length;w<u;w++)if(D=cb[w],B=fb[D],db&&(x=db[D]),eb&&(A=eb[D]),D=
 B.vertexNormals,na=B.normal,G=B.vertexColors,ua=B.color,ja=B.vertexTangents,B instanceof THREE.Face3){if(Ea)T=Ja[B.a].position,J=Ja[B.b].position,ha=Ja[B.c].position,ga[oa]=T.x,ga[oa+1]=T.y,ga[oa+2]=T.z,ga[oa+3]=J.x,ga[oa+4]=J.y,ga[oa+5]=J.z,ga[oa+6]=ha.x,ga[oa+7]=ha.y,ga[oa+8]=ha.z,oa+=9;if(ka)for(Q in ka)if(C=ka[Q],C.__original.needsUpdate)I=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[I]=C.value[B.a],C.array[I+1]=C.value[B.b],C.array[I+2]=C.value[B.c]):
 C.boundTo==="faces"?(O=C.value[O],C.array[I]=O,C.array[I+1]=O,C.array[I+2]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[O],C.array[I+1]=C.value[O+1],C.array[I+2]=C.value[O+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(T=C.value[B.a],J=C.value[B.b],ha=C.value[B.c]):C.boundTo==="faces"?(ha=J=T=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(T=C.value[O],J=C.value[O+1],ha=C.value[O+2],C.offsetSrc+=3),C.size===2?(C.array[I]=T.x,C.array[I+1]=
 T.y,C.array[I+2]=J.x,C.array[I+3]=J.y,C.array[I+4]=ha.x,C.array[I+5]=ha.y,C.offset+=6):C.size===3?(C.type==="c"?(C.array[I]=T.r,C.array[I+1]=T.g,C.array[I+2]=T.b,C.array[I+3]=J.r,C.array[I+4]=J.g,C.array[I+5]=J.b,C.array[I+6]=ha.r,C.array[I+7]=ha.g,C.array[I+8]=ha.b):(C.array[I]=T.x,C.array[I+1]=T.y,C.array[I+2]=T.z,C.array[I+3]=J.x,C.array[I+4]=J.y,C.array[I+5]=J.z,C.array[I+6]=ha.x,C.array[I+7]=ha.y,C.array[I+8]=ha.z),C.offset+=9):(C.array[I]=T.x,C.array[I+1]=T.y,C.array[I+2]=T.z,C.array[I+3]=T.w,
 C.array[I+4]=J.x,C.array[I+5]=J.y,C.array[I+6]=J.z,C.array[I+7]=J.w,C.array[I+8]=ha.x,C.array[I+9]=ha.y,C.array[I+10]=ha.z,C.array[I+11]=ha.w,C.offset+=12));if(Fa){I=0;for(C=La.length;I<C;I++)T=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ha=La[I].vertices[B.c].position,O=Da[I],O[pa]=T.x,O[pa+1]=T.y,O[pa+2]=T.z,O[pa+3]=J.x,O[pa+4]=J.y,O[pa+5]=J.z,O[pa+6]=ha.x,O[pa+7]=ha.y,O[pa+8]=ha.z;pa+=9}if(Ma.length)I=Ma[B.a],C=Ma[B.b],O=Ma[B.c],fa[S]=I.x,fa[S+1]=I.y,fa[S+2]=I.z,fa[S+3]=I.w,fa[S+
 4]=C.x,fa[S+5]=C.y,fa[S+6]=C.z,fa[S+7]=C.w,fa[S+8]=O.x,fa[S+9]=O.y,fa[S+10]=O.z,fa[S+11]=O.w,I=Ua[B.a],C=Ua[B.b],O=Ua[B.c],ea[S]=I.x,ea[S+1]=I.y,ea[S+2]=I.z,ea[S+3]=I.w,ea[S+4]=C.x,ea[S+5]=C.y,ea[S+6]=C.z,ea[S+7]=C.w,ea[S+8]=O.x,ea[S+9]=O.y,ea[S+10]=O.z,ea[S+11]=O.w,I=Sa[B.a],C=Sa[B.b],O=Sa[B.c],aa[S]=I.x,aa[S+1]=I.y,aa[S+2]=I.z,aa[S+3]=1,aa[S+4]=C.x,aa[S+5]=C.y,aa[S+6]=C.z,aa[S+7]=1,aa[S+8]=O.x,aa[S+9]=O.y,aa[S+10]=O.z,aa[S+11]=1,I=Ta[B.a],C=Ta[B.b],O=Ta[B.c],Z[S]=I.x,Z[S+1]=I.y,Z[S+2]=I.z,Z[S+3]=
-1,Z[S+4]=C.x,Z[S+5]=C.y,Z[S+6]=C.z,Z[S+7]=1,Z[S+8]=O.x,Z[S+9]=O.y,Z[S+10]=O.z,Z[S+11]=1,S+=12;if(Ca&&z)G.length==3&&z==THREE.VertexColors?(B=G[0],I=G[1],C=G[2]):C=I=B=ua,ca[V]=B.r,ca[V+1]=B.g,ca[V+2]=B.b,ca[V+3]=I.r,ca[V+4]=I.g,ca[V+5]=I.b,ca[V+6]=C.r,ca[V+7]=C.g,ca[V+8]=C.b,V+=9;if(Ka&&ta.hasTangents)G=ja[0],ua=ja[1],B=ja[2],ia[P]=G.x,ia[P+1]=G.y,ia[P+2]=G.z,ia[P+3]=G.w,ia[P+4]=ua.x,ia[P+5]=ua.y,ia[P+6]=ua.z,ia[P+7]=ua.w,ia[P+8]=B.x,ia[P+9]=B.y,ia[P+10]=B.z,ia[P+11]=B.w,P+=12;if(Ga&&N)if(E.length==
-3&&Ia)for(ja=0;ja<3;ja++)na=E[ja],la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;else for(ja=0;ja<3;ja++)la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;if(Aa&&x!==void 0&&u)for(ja=0;ja<3;ja++)E=x[ja],wa[$]=E.u,wa[$+1]=E.v,$+=2;if(Aa&&A!==void 0&&u)for(ja=0;ja<3;ja++)E=A[ja],va[da]=E.u,va[da+1]=E.v,da+=2;Ba&&(ma[qa]=R,ma[qa+1]=R+1,ma[qa+2]=R+2,qa+=3,ra[ya]=R,ra[ya+1]=R+1,ra[ya+2]=R,ra[ya+3]=R+2,ra[ya+4]=R+1,ra[ya+5]=R+2,ya+=6,R+=3)}else if(B instanceof THREE.Face4){if(Ea)T=Ja[B.a].position,J=Ja[B.b].position,
+1,Z[S+4]=C.x,Z[S+5]=C.y,Z[S+6]=C.z,Z[S+7]=1,Z[S+8]=O.x,Z[S+9]=O.y,Z[S+10]=O.z,Z[S+11]=1,S+=12;if(Ca&&y)G.length==3&&y==THREE.VertexColors?(B=G[0],I=G[1],C=G[2]):C=I=B=ua,ca[V]=B.r,ca[V+1]=B.g,ca[V+2]=B.b,ca[V+3]=I.r,ca[V+4]=I.g,ca[V+5]=I.b,ca[V+6]=C.r,ca[V+7]=C.g,ca[V+8]=C.b,V+=9;if(Ka&&ta.hasTangents)G=ja[0],ua=ja[1],B=ja[2],ia[P]=G.x,ia[P+1]=G.y,ia[P+2]=G.z,ia[P+3]=G.w,ia[P+4]=ua.x,ia[P+5]=ua.y,ia[P+6]=ua.z,ia[P+7]=ua.w,ia[P+8]=B.x,ia[P+9]=B.y,ia[P+10]=B.z,ia[P+11]=B.w,P+=12;if(Ga&&N)if(D.length==
+3&&Ia)for(ja=0;ja<3;ja++)na=D[ja],la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;else for(ja=0;ja<3;ja++)la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;if(Aa&&x!==void 0&&v)for(ja=0;ja<3;ja++)D=x[ja],wa[$]=D.u,wa[$+1]=D.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<3;ja++)D=A[ja],va[da]=D.u,va[da+1]=D.v,da+=2;Ba&&(ma[qa]=R,ma[qa+1]=R+1,ma[qa+2]=R+2,qa+=3,ra[ya]=R,ra[ya+1]=R+1,ra[ya+2]=R,ra[ya+3]=R+2,ra[ya+4]=R+1,ra[ya+5]=R+2,ya+=6,R+=3)}else if(B instanceof THREE.Face4){if(Ea)T=Ja[B.a].position,J=Ja[B.b].position,
 ha=Ja[B.c].position,K=Ja[B.d].position,ga[oa]=T.x,ga[oa+1]=T.y,ga[oa+2]=T.z,ga[oa+3]=J.x,ga[oa+4]=J.y,ga[oa+5]=J.z,ga[oa+6]=ha.x,ga[oa+7]=ha.y,ga[oa+8]=ha.z,ga[oa+9]=K.x,ga[oa+10]=K.y,ga[oa+11]=K.z,oa+=12;if(ka)for(Q in ka)if(C=ka[Q],C.__original.needsUpdate)I=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[I]=C.value[B.a],C.array[I+1]=C.value[B.b],C.array[I+2]=C.value[B.c],C.array[I+3]=C.value[B.d]):C.boundTo==="faces"?(O=C.value[O],C.array[I]=O,C.array[I+1]=
 O,C.array[I+2]=O,C.array[I+3]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[O],C.array[I+1]=C.value[O+1],C.array[I+2]=C.value[O+2],C.array[I+3]=C.value[O+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo==="vertices"?(T=C.value[B.a],J=C.value[B.b],ha=C.value[B.c],K=C.value[B.d]):C.boundTo==="faces"?(K=ha=J=T=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(T=C.value[O],J=C.value[O+1],ha=C.value[O+2],K=C.value[O+3],C.offsetSrc+=4),C.size===2?(C.array[I]=T.x,
 C.array[I+1]=T.y,C.array[I+2]=J.x,C.array[I+3]=J.y,C.array[I+4]=ha.x,C.array[I+5]=ha.y,C.array[I+6]=K.x,C.array[I+7]=K.y,C.offset+=8):C.size===3?(C.type==="c"?(C.array[I]=T.r,C.array[I+1]=T.g,C.array[I+2]=T.b,C.array[I+3]=J.r,C.array[I+4]=J.g,C.array[I+5]=J.b,C.array[I+6]=ha.r,C.array[I+7]=ha.g,C.array[I+8]=ha.b,C.array[I+9]=K.r,C.array[I+10]=K.g,C.array[I+11]=K.b):(C.array[I]=T.x,C.array[I+1]=T.y,C.array[I+2]=T.z,C.array[I+3]=J.x,C.array[I+4]=J.y,C.array[I+5]=J.z,C.array[I+6]=ha.x,C.array[I+7]=ha.y,
 C.array[I+8]=ha.z,C.array[I+9]=K.x,C.array[I+10]=K.y,C.array[I+11]=K.z),C.offset+=12):(C.array[I]=T.x,C.array[I+1]=T.y,C.array[I+2]=T.z,C.array[I+3]=T.w,C.array[I+4]=J.x,C.array[I+5]=J.y,C.array[I+6]=J.z,C.array[I+7]=J.w,C.array[I+8]=ha.x,C.array[I+9]=ha.y,C.array[I+10]=ha.z,C.array[I+11]=ha.w,C.array[I+12]=K.x,C.array[I+13]=K.y,C.array[I+14]=K.z,C.array[I+15]=K.w,C.offset+=16));if(Fa){I=0;for(C=La.length;I<C;I++)T=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ha=La[I].vertices[B.c].position,
 K=La[I].vertices[B.d].position,O=Da[I],O[pa]=T.x,O[pa+1]=T.y,O[pa+2]=T.z,O[pa+3]=J.x,O[pa+4]=J.y,O[pa+5]=J.z,O[pa+6]=ha.x,O[pa+7]=ha.y,O[pa+8]=ha.z,O[pa+9]=K.x,O[pa+10]=K.y,O[pa+11]=K.z;pa+=12}if(Ma.length)I=Ma[B.a],C=Ma[B.b],O=Ma[B.c],X=Ma[B.d],fa[S]=I.x,fa[S+1]=I.y,fa[S+2]=I.z,fa[S+3]=I.w,fa[S+4]=C.x,fa[S+5]=C.y,fa[S+6]=C.z,fa[S+7]=C.w,fa[S+8]=O.x,fa[S+9]=O.y,fa[S+10]=O.z,fa[S+11]=O.w,fa[S+12]=X.x,fa[S+13]=X.y,fa[S+14]=X.z,fa[S+15]=X.w,I=Ua[B.a],C=Ua[B.b],O=Ua[B.c],X=Ua[B.d],ea[S]=I.x,ea[S+1]=I.y,
 ea[S+2]=I.z,ea[S+3]=I.w,ea[S+4]=C.x,ea[S+5]=C.y,ea[S+6]=C.z,ea[S+7]=C.w,ea[S+8]=O.x,ea[S+9]=O.y,ea[S+10]=O.z,ea[S+11]=O.w,ea[S+12]=X.x,ea[S+13]=X.y,ea[S+14]=X.z,ea[S+15]=X.w,I=Sa[B.a],C=Sa[B.b],O=Sa[B.c],X=Sa[B.d],aa[S]=I.x,aa[S+1]=I.y,aa[S+2]=I.z,aa[S+3]=1,aa[S+4]=C.x,aa[S+5]=C.y,aa[S+6]=C.z,aa[S+7]=1,aa[S+8]=O.x,aa[S+9]=O.y,aa[S+10]=O.z,aa[S+11]=1,aa[S+12]=X.x,aa[S+13]=X.y,aa[S+14]=X.z,aa[S+15]=1,I=Ta[B.a],C=Ta[B.b],O=Ta[B.c],B=Ta[B.d],Z[S]=I.x,Z[S+1]=I.y,Z[S+2]=I.z,Z[S+3]=1,Z[S+4]=C.x,Z[S+5]=C.y,
-Z[S+6]=C.z,Z[S+7]=1,Z[S+8]=O.x,Z[S+9]=O.y,Z[S+10]=O.z,Z[S+11]=1,Z[S+12]=B.x,Z[S+13]=B.y,Z[S+14]=B.z,Z[S+15]=1,S+=16;if(Ca&&z)G.length==4&&z==THREE.VertexColors?(B=G[0],I=G[1],C=G[2],G=G[3]):G=C=I=B=ua,ca[V]=B.r,ca[V+1]=B.g,ca[V+2]=B.b,ca[V+3]=I.r,ca[V+4]=I.g,ca[V+5]=I.b,ca[V+6]=C.r,ca[V+7]=C.g,ca[V+8]=C.b,ca[V+9]=G.r,ca[V+10]=G.g,ca[V+11]=G.b,V+=12;if(Ka&&ta.hasTangents)G=ja[0],ua=ja[1],B=ja[2],ja=ja[3],ia[P]=G.x,ia[P+1]=G.y,ia[P+2]=G.z,ia[P+3]=G.w,ia[P+4]=ua.x,ia[P+5]=ua.y,ia[P+6]=ua.z,ia[P+7]=ua.w,
-ia[P+8]=B.x,ia[P+9]=B.y,ia[P+10]=B.z,ia[P+11]=B.w,ia[P+12]=ja.x,ia[P+13]=ja.y,ia[P+14]=ja.z,ia[P+15]=ja.w,P+=16;if(Ga&&N)if(E.length==4&&Ia)for(ja=0;ja<4;ja++)na=E[ja],la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;else for(ja=0;ja<4;ja++)la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;if(Aa&&x!==void 0&&u)for(ja=0;ja<4;ja++)E=x[ja],wa[$]=E.u,wa[$+1]=E.v,$+=2;if(Aa&&A!==void 0&&u)for(ja=0;ja<4;ja++)E=A[ja],va[da]=E.u,va[da+1]=E.v,da+=2;Ba&&(ma[qa]=R,ma[qa+1]=R+1,ma[qa+2]=R+3,ma[qa+3]=R+1,ma[qa+4]=R+2,ma[qa+
-5]=R+3,qa+=6,ra[ya]=R,ra[ya+1]=R+1,ra[ya+2]=R,ra[ya+3]=R+3,ra[ya+4]=R+1,ra[ya+5]=R+2,ra[ya+6]=R+2,ra[ya+7]=R+3,ya+=8,R+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,ga,y));if(ka)for(Q in ka)C=ka[Q],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,y));if(Fa){I=0;for(C=La.length;I<C;I++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[I]),o.bufferData(o.ARRAY_BUFFER,Da[I],y)}Ca&&V>0&&(o.bindBuffer(o.ARRAY_BUFFER,
-p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ca,y));Ga&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,la,y));Ka&&ta.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ia,y));Aa&&$>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Aa&&da>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,va,y));Ba&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),
-o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,y));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,Z,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ea,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
-fa,y));U&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(m)}else if(k instanceof THREE.Ribbon){h=
-k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=v=U=U=void 0;w=k.vertices;t=k.colors;u=w.length;p=t.length;z=k.__vertexArray;y=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(U=0;U<u;U++)v=w[U].position,n=U*3,z[n]=v.x,z[n+1]=v.y,z[n+2]=v.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}if(N){for(U=0;U<p;U++)color=t[U],n=U*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,
-y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=v=U=U=void 0;w=k.vertices;t=k.colors;u=w.length;p=t.length;z=k.__vertexArray;y=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(U=0;U<u;U++)v=w[U].position,n=U*3,z[n]=v.x,z[n+1]=v.y,z[n+2]=v.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}if(N){for(U=0;U<p;U++)color=t[U],n=U*3,y[n]=color.r,y[n+1]=color.g,
-y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem)h=k.geometry,p=F(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||p)&&c(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,D(h)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),
+Z[S+6]=C.z,Z[S+7]=1,Z[S+8]=O.x,Z[S+9]=O.y,Z[S+10]=O.z,Z[S+11]=1,Z[S+12]=B.x,Z[S+13]=B.y,Z[S+14]=B.z,Z[S+15]=1,S+=16;if(Ca&&y)G.length==4&&y==THREE.VertexColors?(B=G[0],I=G[1],C=G[2],G=G[3]):G=C=I=B=ua,ca[V]=B.r,ca[V+1]=B.g,ca[V+2]=B.b,ca[V+3]=I.r,ca[V+4]=I.g,ca[V+5]=I.b,ca[V+6]=C.r,ca[V+7]=C.g,ca[V+8]=C.b,ca[V+9]=G.r,ca[V+10]=G.g,ca[V+11]=G.b,V+=12;if(Ka&&ta.hasTangents)G=ja[0],ua=ja[1],B=ja[2],ja=ja[3],ia[P]=G.x,ia[P+1]=G.y,ia[P+2]=G.z,ia[P+3]=G.w,ia[P+4]=ua.x,ia[P+5]=ua.y,ia[P+6]=ua.z,ia[P+7]=ua.w,
+ia[P+8]=B.x,ia[P+9]=B.y,ia[P+10]=B.z,ia[P+11]=B.w,ia[P+12]=ja.x,ia[P+13]=ja.y,ia[P+14]=ja.z,ia[P+15]=ja.w,P+=16;if(Ga&&N)if(D.length==4&&Ia)for(ja=0;ja<4;ja++)na=D[ja],la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;else for(ja=0;ja<4;ja++)la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;if(Aa&&x!==void 0&&v)for(ja=0;ja<4;ja++)D=x[ja],wa[$]=D.u,wa[$+1]=D.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<4;ja++)D=A[ja],va[da]=D.u,va[da+1]=D.v,da+=2;Ba&&(ma[qa]=R,ma[qa+1]=R+1,ma[qa+2]=R+3,ma[qa+3]=R+1,ma[qa+4]=R+2,ma[qa+
+5]=R+3,qa+=6,ra[ya]=R,ra[ya+1]=R+1,ra[ya+2]=R,ra[ya+3]=R+3,ra[ya+4]=R+1,ra[ya+5]=R+2,ra[ya+6]=R+2,ra[ya+7]=R+3,ya+=8,R+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,ga,z));if(ka)for(Q in ka)C=ka[Q],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,z));if(Fa){I=0;for(C=La.length;I<C;I++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[I]),o.bufferData(o.ARRAY_BUFFER,Da[I],z)}Ca&&V>0&&(o.bindBuffer(o.ARRAY_BUFFER,
+p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ca,z));Ga&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,la,z));Ka&&ta.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ia,z));Aa&&$>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,z));Aa&&da>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,va,z));Ba&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),
+o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,z));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,Z,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ea,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
+fa,z));U&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;E(m)}else if(k instanceof THREE.Ribbon){h=
+k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=w=U=U=void 0;u=k.vertices;t=k.colors;v=u.length;p=t.length;y=k.__vertexArray;z=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(U=0;U<v;U++)w=u[U].position,n=U*3,y[n]=w.x,y[n+1]=w.y,y[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}if(N){for(U=0;U<p;U++)color=t[U],n=U*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,
+z,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=w=U=U=void 0;u=k.vertices;t=k.colors;v=u.length;p=t.length;y=k.__vertexArray;z=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(U=0;U<v;U++)w=u[U].position,n=U*3,y[n]=w.x,y[n+1]=w.y,y[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}if(N){for(U=0;U<p;U++)color=t[U],n=U*3,z[n]=color.r,z[n+1]=color.g,
+z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem)h=k.geometry,p=F(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||p)&&c(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,E(h)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),
 o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Ga}};
 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};
@@ -343,19 +343,19 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
 THREE.ColorUtils={adjustHSV:function(b,c,e,f){var h=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,h);h.h=THREE.ColorUtils.clamp(h.h+c,0,1);h.s=THREE.ColorUtils.clamp(h.s+e,0,1);h.v=THREE.ColorUtils.clamp(h.v+f,0,1);b.setHSV(h.h,h.s,h.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,h=b.b,k=Math.max(Math.max(e,f),h),m=Math.min(Math.min(e,f),h);if(m==k)m=e=0;else{var n=k-m,m=n/k,e=e==k?(f-h)/n:f==k?2+(h-e)/n:4+(e-f)/n;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=m;c.v=k;return c},
 clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(b,c){var e,f,h=b.vertices.length,k=c instanceof THREE.Mesh?c.geometry:c,m=b.vertices,n=k.vertices,p=b.faces,u=k.faces,v=b.faceVertexUvs[0],k=k.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),e=c.matrix,f=new THREE.Matrix4,f.extractRotation(e,c.scale);for(var t=0,w=n.length;t<w;t++){var x=new THREE.Vertex(n[t].position.clone());e&&e.multiplyVector3(x.position);m.push(x)}t=0;for(w=u.length;t<w;t++){var x=u[t],y,z,A=x.vertexNormals,
-E=x.vertexColors;x instanceof THREE.Face3?y=new THREE.Face3(x.a+h,x.b+h,x.c+h):x instanceof THREE.Face4&&(y=new THREE.Face4(x.a+h,x.b+h,x.c+h,x.d+h));y.normal.copy(x.normal);f&&f.multiplyVector3(y.normal);m=0;for(n=A.length;m<n;m++)z=A[m].clone(),f&&f.multiplyVector3(z),y.vertexNormals.push(z);y.color.copy(x.color);m=0;for(n=E.length;m<n;m++)z=E[m],y.vertexColors.push(z.clone());y.materials=x.materials.slice();y.centroid.copy(x.centroid);e&&e.multiplyVector3(y.centroid);p.push(y)}t=0;for(w=k.length;t<
-w;t++){e=k[t];f=[];m=0;for(n=e.length;m<n;m++)f.push(new THREE.UV(e[m].u,e[m].v));v.push(f)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,k=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var m=new THREE.Vertex(f[b].position.clone());c.vertices.push(m)}b=0;for(e=h.length;b<e;b++){var n=h[b],p,u,v=n.vertexNormals,t=n.vertexColors;n instanceof THREE.Face3?p=new THREE.Face3(n.a,n.b,n.c):n instanceof THREE.Face4&&(p=new THREE.Face4(n.a,n.b,n.c,n.d));p.normal.copy(n.normal);f=0;
-for(m=v.length;f<m;f++)u=v[f],p.vertexNormals.push(u.clone());p.color.copy(n.color);f=0;for(m=t.length;f<m;f++)u=t[f],p.vertexColors.push(u.clone());p.materials=n.materials.slice();p.centroid.copy(n.centroid);c.faces.push(p)}b=0;for(e=k.length;b<e;b++){h=k[b];p=[];f=0;for(m=h.length;f<m;f++)p.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(p)}return c},randomPointInTriangle:function(b,c,e){var f,h,k,m=new THREE.Vector3,n=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();h=THREE.GeometryUtils.random();
+THREE.GeometryUtils={merge:function(b,c){var e,f,h=b.vertices.length,k=c instanceof THREE.Mesh?c.geometry:c,m=b.vertices,n=k.vertices,p=b.faces,t=k.faces,w=b.faceVertexUvs[0],k=k.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),e=c.matrix,f=new THREE.Matrix4,f.extractRotation(e,c.scale);for(var u=0,x=n.length;u<x;u++){var v=new THREE.Vertex(n[u].position.clone());e&&e.multiplyVector3(v.position);m.push(v)}u=0;for(x=t.length;u<x;u++){var v=t[u],A,z,y=v.vertexNormals,
+D=v.vertexColors;v instanceof THREE.Face3?A=new THREE.Face3(v.a+h,v.b+h,v.c+h):v instanceof THREE.Face4&&(A=new THREE.Face4(v.a+h,v.b+h,v.c+h,v.d+h));A.normal.copy(v.normal);f&&f.multiplyVector3(A.normal);m=0;for(n=y.length;m<n;m++)z=y[m].clone(),f&&f.multiplyVector3(z),A.vertexNormals.push(z);A.color.copy(v.color);m=0;for(n=D.length;m<n;m++)z=D[m],A.vertexColors.push(z.clone());A.materials=v.materials.slice();A.centroid.copy(v.centroid);e&&e.multiplyVector3(A.centroid);p.push(A)}u=0;for(x=k.length;u<
+x;u++){e=k[u];f=[];m=0;for(n=e.length;m<n;m++)f.push(new THREE.UV(e[m].u,e[m].v));w.push(f)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,k=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var m=new THREE.Vertex(f[b].position.clone());c.vertices.push(m)}b=0;for(e=h.length;b<e;b++){var n=h[b],p,t,w=n.vertexNormals,u=n.vertexColors;n instanceof THREE.Face3?p=new THREE.Face3(n.a,n.b,n.c):n instanceof THREE.Face4&&(p=new THREE.Face4(n.a,n.b,n.c,n.d));p.normal.copy(n.normal);f=0;
+for(m=w.length;f<m;f++)t=w[f],p.vertexNormals.push(t.clone());p.color.copy(n.color);f=0;for(m=u.length;f<m;f++)t=u[f],p.vertexColors.push(t.clone());p.materials=n.materials.slice();p.centroid.copy(n.centroid);c.faces.push(p)}b=0;for(e=k.length;b<e;b++){h=k[b];p=[];f=0;for(m=h.length;f<m;f++)p.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(p)}return c},randomPointInTriangle:function(b,c,e){var f,h,k,m=new THREE.Vector3,n=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();h=THREE.GeometryUtils.random();
 f+h>1&&(f=1-f,h=1-h);k=1-f-h;m.copy(b);m.multiplyScalar(f);n.copy(c);n.multiplyScalar(h);m.addSelf(n);n.copy(e);n.multiplyScalar(k);m.addSelf(n);return m},randomPointInFace:function(b,c,e){var f,h,k;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,k=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,k);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;k=c.vertices[b.c].position;var c=c.vertices[b.d].position,
-m;e?b._area1&&b._area2?(e=b._area1,m=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c),b._area1=e,b._area2=m):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c));return THREE.GeometryUtils.random()*(e+m)<e?THREE.GeometryUtils.randomPointInTriangle(f,h,c):THREE.GeometryUtils.randomPointInTriangle(h,k,c)}},randomPointsInGeometry:function(b,c){function e(b){function e(c,f){if(f<c)return c;var h=c+Math.floor((f-c)/2);return u[h]>
-b?e(c,h-1):u[h]<b?e(h+1,f):h}return e(0,u.length-1)}var f,h,k=b.faces,m=b.vertices,n=k.length,p=0,u=[],v,t,w,x;for(h=0;h<n;h++){f=k[h];if(f instanceof THREE.Face3)v=m[f.a].position,t=m[f.b].position,w=m[f.c].position,f._area=THREE.GeometryUtils.triangleArea(v,t,w);else if(f instanceof THREE.Face4)v=m[f.a].position,t=m[f.b].position,w=m[f.c].position,x=m[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(v,t,x),f._area2=THREE.GeometryUtils.triangleArea(t,w,x),f._area=f._area1+f._area2;p+=f._area;
-u[h]=p}f=[];m={};for(h=0;h<c;h++)n=THREE.GeometryUtils.random()*p,n=e(n),f[h]=THREE.GeometryUtils.randomPointInFace(k[n],b,!0),m[n]?m[n]+=1:m[n]=1;return f},triangleArea:function(b,c,e){var f,h=THREE.GeometryUtils.__v1;h.sub(b,c);f=h.length();h.sub(b,e);b=h.length();h.sub(c,e);e=h.length();c=0.5*(f+b+e);return Math.sqrt(c*(c-f)*(c-b)*(c-e))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},center:function(b){b.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*
+m;e?b._area1&&b._area2?(e=b._area1,m=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c),b._area1=e,b._area2=m):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c));return THREE.GeometryUtils.random()*(e+m)<e?THREE.GeometryUtils.randomPointInTriangle(f,h,c):THREE.GeometryUtils.randomPointInTriangle(h,k,c)}},randomPointsInGeometry:function(b,c){function e(b){function e(c,f){if(f<c)return c;var h=c+Math.floor((f-c)/2);return t[h]>
+b?e(c,h-1):t[h]<b?e(h+1,f):h}return e(0,t.length-1)}var f,h,k=b.faces,m=b.vertices,n=k.length,p=0,t=[],w,u,x,v;for(h=0;h<n;h++){f=k[h];if(f instanceof THREE.Face3)w=m[f.a].position,u=m[f.b].position,x=m[f.c].position,f._area=THREE.GeometryUtils.triangleArea(w,u,x);else if(f instanceof THREE.Face4)w=m[f.a].position,u=m[f.b].position,x=m[f.c].position,v=m[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(w,u,v),f._area2=THREE.GeometryUtils.triangleArea(u,x,v),f._area=f._area1+f._area2;p+=f._area;
+t[h]=p}f=[];m={};for(h=0;h<c;h++)n=THREE.GeometryUtils.random()*p,n=e(n),f[h]=THREE.GeometryUtils.randomPointInFace(k[n],b,!0),m[n]?m[n]+=1:m[n]=1;return f},triangleArea:function(b,c,e){var f,h=THREE.GeometryUtils.__v1;h.sub(b,c);f=h.length();h.sub(b,e);b=h.length();h.sub(c,e);e=h.length();c=0.5*(f+b+e);return Math.sqrt(c*(c-f)*(c-b)*(c-e))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},center:function(b){b.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*
 (b.boundingBox.x[1]+b.boundingBox.x[0]),-0.5*(b.boundingBox.y[1]+b.boundingBox.y[0]),-0.5*(b.boundingBox.z[1]+b.boundingBox.z[0]));b.applyMatrix(c);b.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,h=new THREE.Texture(f,c);f.onload=function(){h.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return h},loadTextureCube:function(b,c,e){var f,h=[],k=new THREE.Texture(h,c),c=h.loadCount=0;for(f=b.length;c<f;++c)h[c]=new Image,h[c].onload=function(){h.loadCount+=1;if(h.loadCount==6)k.needsUpdate=!0;e&&e(this)},h[c].crossOrigin="",h[c].src=b[c];return k},getNormalMap:function(b,c){var e=function(b){var e=Math.sqrt(b[0]*b[0]+b[1]*b[1]+
-b[2]*b[2]);return[b[0]/e,b[1]/e,b[2]/e]};c|=1;var f=b.width,h=b.height,k=document.createElement("canvas");k.width=f;k.height=h;var m=k.getContext("2d");m.drawImage(b,0,0);for(var n=m.getImageData(0,0,f,h).data,p=m.createImageData(f,h),u=p.data,v=0;v<f;v++)for(var t=1;t<h;t++){var w=t-1<0?h-1:t-1,x=(t+1)%h,y=v-1<0?f-1:v-1,z=(v+1)%f,A=[],E=[0,0,n[(t*f+v)*4]/255*c];A.push([-1,0,n[(t*f+y)*4]/255*c]);A.push([-1,-1,n[(w*f+y)*4]/255*c]);A.push([0,-1,n[(w*f+v)*4]/255*c]);A.push([1,-1,n[(w*f+z)*4]/255*c]);
-A.push([1,0,n[(t*f+z)*4]/255*c]);A.push([1,1,n[(x*f+z)*4]/255*c]);A.push([0,1,n[(x*f+v)*4]/255*c]);A.push([-1,1,n[(x*f+y)*4]/255*c]);w=[];y=A.length;for(x=0;x<y;x++){var z=A[x],F=A[(x+1)%y],z=[z[0]-E[0],z[1]-E[1],z[2]-E[2]],F=[F[0]-E[0],F[1]-E[1],F[2]-E[2]];w.push(e([z[1]*F[2]-z[2]*F[1],z[2]*F[0]-z[0]*F[2],z[0]*F[1]-z[1]*F[0]]))}A=[0,0,0];for(x=0;x<w.length;x++)A[0]+=w[x][0],A[1]+=w[x][1],A[2]+=w[x][2];A[0]/=w.length;A[1]/=w.length;A[2]/=w.length;E=(t*f+v)*4;u[E]=(A[0]+1)/2*255|0;u[E+1]=(A[1]+0.5)*
-255|0;u[E+2]=A[2]*255|0;u[E+3]=255}m.putImageData(p,0,0);return k}};THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,h=b.children.length;for(f=0;f<h;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
+b[2]*b[2]);return[b[0]/e,b[1]/e,b[2]/e]};c|=1;var f=b.width,h=b.height,k=document.createElement("canvas");k.width=f;k.height=h;var m=k.getContext("2d");m.drawImage(b,0,0);for(var n=m.getImageData(0,0,f,h).data,p=m.createImageData(f,h),t=p.data,w=0;w<f;w++)for(var u=1;u<h;u++){var x=u-1<0?h-1:u-1,v=(u+1)%h,A=w-1<0?f-1:w-1,z=(w+1)%f,y=[],D=[0,0,n[(u*f+w)*4]/255*c];y.push([-1,0,n[(u*f+A)*4]/255*c]);y.push([-1,-1,n[(x*f+A)*4]/255*c]);y.push([0,-1,n[(x*f+w)*4]/255*c]);y.push([1,-1,n[(x*f+z)*4]/255*c]);
+y.push([1,0,n[(u*f+z)*4]/255*c]);y.push([1,1,n[(v*f+z)*4]/255*c]);y.push([0,1,n[(v*f+w)*4]/255*c]);y.push([-1,1,n[(v*f+A)*4]/255*c]);x=[];A=y.length;for(v=0;v<A;v++){var z=y[v],F=y[(v+1)%A],z=[z[0]-D[0],z[1]-D[1],z[2]-D[2]],F=[F[0]-D[0],F[1]-D[1],F[2]-D[2]];x.push(e([z[1]*F[2]-z[2]*F[1],z[2]*F[0]-z[0]*F[2],z[0]*F[1]-z[1]*F[0]]))}y=[0,0,0];for(v=0;v<x.length;v++)y[0]+=x[v][0],y[1]+=x[v][1],y[2]+=x[v][2];y[0]/=x.length;y[1]/=x.length;y[2]/=x.length;D=(u*f+w)*4;t[D]=(y[0]+1)/2*255|0;t[D+1]=(y[1]+0.5)*
+255|0;t[D+2]=y[2]*255|0;t[D+3]=255}m.putImageData(p,0,0);return k}};THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,h=b.children.length;for(f=0;f<h;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",
@@ -393,37 +393,37 @@ THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var h=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,h,k){var m=Array.prototype.slice.call(arguments),n=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(n[n.length-2],n[n.length-1]),new THREE.Vector2(b,c),new THREE.Vector2(e,f),new THREE.Vector2(h,k)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:m})};
 THREE.Path.prototype.splineThru=function(b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args,e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];Array.prototype.push.apply(e,b);this.curves.push(new THREE.SplineCurve(e));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
 THREE.Path.prototype.arc=function(b,c,e,f,h,k){var m=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,h,k));this.actions.push({action:THREE.PathActions.ARC,args:m})};THREE.Path.prototype.getSpacedPoints=function(b){b||(b=40);for(var c=[],e=0;e<b;e++)c.push(this.getPoint(e/b));return c};
-THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,h,k,m,n,p,u,v,t,w,x,y,z;f=0;for(h=this.actions.length;f<h;f++)switch(k=this.actions[f],m=k.action,k=k.args,m){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(k[0],k[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:n=k[2];p=k[3];t=k[0];w=k[1];e.length>0?(m=e[e.length-1],x=m.x,y=m.y):(m=this.actions[f-1].args,x=m[m.length-2],y=m[m.length-1]);for(m=1;m<=b;m++)z=m/b,k=THREE.Shape.Utils.b2(z,x,t,n),z=THREE.Shape.Utils.b2(z,y,w,
-p),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.BEZIER_CURVE_TO:n=k[4];p=k[5];t=k[0];w=k[1];u=k[2];v=k[3];e.length>0?(m=e[e.length-1],x=m.x,y=m.y):(m=this.actions[f-1].args,x=m[m.length-2],y=m[m.length-1]);for(m=1;m<=b;m++)z=m/b,k=THREE.Shape.Utils.b3(z,x,t,u,n),z=THREE.Shape.Utils.b3(z,y,w,v,p),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.CSPLINE_THRU:m=this.actions[f-1].args;m=[new THREE.Vector2(m[m.length-2],m[m.length-1])];z=b*k[0].length;m=m.concat(k[0]);k=new THREE.SplineCurve(m);
-for(m=1;m<=z;m++)e.push(k.getPointAt(m/z));break;case THREE.PathActions.ARC:m=this.actions[f-1].args;n=k[0];p=k[1];u=k[2];t=k[3];z=k[4];w=!!k[5];v=m[m.length-2];x=m[m.length-1];m.length==0&&(v=x=0);y=z-t;var A=b*2;for(m=1;m<=A;m++)z=m/A,w||(z=1-z),z=t+z*y,k=v+n+u*Math.cos(z),z=x+p+u*Math.sin(z),e.push(new THREE.Vector2(k,z))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)};
-THREE.Path.prototype.nltransform=function(b,c,e,f,h,k){var m=this.getPoints(),n,p,u,v,t;n=0;for(p=m.length;n<p;n++)u=m[n],v=u.x,t=u.y,u.x=b*v+c*t+e,u.y=f*t+h*v+k;return m};
+THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,h,k,m,n,p,t,w,u,x,v,A,z;f=0;for(h=this.actions.length;f<h;f++)switch(k=this.actions[f],m=k.action,k=k.args,m){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(k[0],k[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:n=k[2];p=k[3];u=k[0];x=k[1];e.length>0?(m=e[e.length-1],v=m.x,A=m.y):(m=this.actions[f-1].args,v=m[m.length-2],A=m[m.length-1]);for(m=1;m<=b;m++)z=m/b,k=THREE.Shape.Utils.b2(z,v,u,n),z=THREE.Shape.Utils.b2(z,A,x,
+p),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.BEZIER_CURVE_TO:n=k[4];p=k[5];u=k[0];x=k[1];t=k[2];w=k[3];e.length>0?(m=e[e.length-1],v=m.x,A=m.y):(m=this.actions[f-1].args,v=m[m.length-2],A=m[m.length-1]);for(m=1;m<=b;m++)z=m/b,k=THREE.Shape.Utils.b3(z,v,u,t,n),z=THREE.Shape.Utils.b3(z,A,x,w,p),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.CSPLINE_THRU:m=this.actions[f-1].args;m=[new THREE.Vector2(m[m.length-2],m[m.length-1])];z=b*k[0].length;m=m.concat(k[0]);k=new THREE.SplineCurve(m);
+for(m=1;m<=z;m++)e.push(k.getPointAt(m/z));break;case THREE.PathActions.ARC:m=this.actions[f-1].args;n=k[0];p=k[1];t=k[2];u=k[3];z=k[4];x=!!k[5];w=m[m.length-2];v=m[m.length-1];m.length==0&&(w=v=0);A=z-u;var y=b*2;for(m=1;m<=y;m++)z=m/y,x||(z=1-z),z=u+z*A,k=w+n+t*Math.cos(z),z=v+p+t*Math.sin(z),e.push(new THREE.Vector2(k,z))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)};
+THREE.Path.prototype.nltransform=function(b,c,e,f,h,k){var m=this.getPoints(),n,p,t,w,u;n=0;for(p=m.length;n<p;n++)t=m[n],w=t.x,u=t.y,t.x=b*w+c*u+e,t.y=f*u+h*w+k;return m};
 THREE.Path.prototype.debug=function(b){var c=this.getBoundingBox();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,h,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],h=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,h);c.stroke();c.closePath();c.strokeStyle="red";f=
 this.getPoints();b=0;for(e=f.length;b<e;b++)h=f[b],c.beginPath(),c.arc(h.x,h.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
 THREE.Path.prototype.toShapes=function(){var b,c,e,f,h=[],k=new THREE.Path;b=0;for(c=this.actions.length;b<c;b++)e=this.actions[b],f=e.args,e=e.action,e==THREE.PathActions.MOVE_TO&&k.actions.length!=0&&(h.push(k),k=new THREE.Path),k[e].apply(k,f);k.actions.length!=0&&h.push(k);if(h.length==0)return[];var m,k=[];if(THREE.Shape.Utils.isClockWise(h[0].getPoints())){b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(m&&k.push(m),m=new THREE.Shape,m.actions=f.actions,m.curves=
 f.curves):m.holes.push(f);k.push(m)}else{m=new THREE.Shape;b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(m.actions=f.actions,m.curves=f.curves,k.push(m),m=new THREE.Shape):m.holes.push(f)}return k};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(b){return new THREE.ExtrudeGeometry(this,b)};
 THREE.Shape.prototype.getPointsHoles=function(b){var c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c].getTransformedPoints(b,this.bends);return f};THREE.Shape.prototype.getSpacedPointsHoles=function(b){var c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c].getTransformedSpacedPoints(b,this.bends);return f};THREE.Shape.prototype.extractAllPoints=function(b){return{shape:this.getTransformedPoints(b),holes:this.getPointsHoles(b)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(b){return{shape:this.getTransformedSpacedPoints(b),holes:this.getSpacedPointsHoles(b)}};
-THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),h,k,m,n,p,u,v,t,w,x,y=[];for(p=0;p<c.length;p++){u=c[p];Array.prototype.push.apply(f,u);k=Number.POSITIVE_INFINITY;for(h=0;h<u.length;h++){w=u[h];x=[];for(t=0;t<e.length;t++)v=e[t],v=w.distanceToSquared(v),x.push(v),v<k&&(k=v,m=h,n=t)}h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:u.length-1;var z=[u[m],e[n],e[h]];t=THREE.FontUtils.Triangulate.area(z);var A=[u[m],u[k],e[n]];w=THREE.FontUtils.Triangulate.area(A);x=n;v=m;n+=1;m+=-1;n<
-0&&(n+=e.length);n%=e.length;m<0&&(m+=u.length);m%=u.length;h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:u.length-1;z=[u[m],e[n],e[h]];z=THREE.FontUtils.Triangulate.area(z);A=[u[m],u[k],e[n]];A=THREE.FontUtils.Triangulate.area(A);t+w>z+A&&(n=x,m=v,n<0&&(n+=e.length),n%=e.length,m<0&&(m+=u.length),m%=u.length,h=n-1>=0?n-1:e.length-1,k=m-1>=0?m-1:u.length-1);t=e.slice(0,n);w=e.slice(n);x=u.slice(m);v=u.slice(0,m);k=[u[m],u[k],e[n]];y.push([u[m],e[n],e[h]]);y.push(k);e=t.concat(x).concat(v).concat(w)}return{shape:e,
-isolatedPts:y,allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),k,m,n,p,u={};k=0;for(m=f.length;k<m;k++)p=f[k].x+":"+f[k].y,u[p]!==void 0&&console.log("Duplicate point",p),u[p]=k;k=0;for(m=e.length;k<m;k++){n=e[k];for(f=0;f<3;f++)p=n[f].x+":"+n[f].y,p=u[p],p!==void 0&&(n[f]=p)}k=0;for(m=h.length;k<m;k++){n=h[k];for(f=0;f<3;f++)p=n[f].x+":"+n[f].y,p=u[p],p!==void 0&&(n[f]=p)}return e.concat(h)},
+THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),h,k,m,n,p,t,w,u,x,v,A=[];for(p=0;p<c.length;p++){t=c[p];Array.prototype.push.apply(f,t);k=Number.POSITIVE_INFINITY;for(h=0;h<t.length;h++){x=t[h];v=[];for(u=0;u<e.length;u++)w=e[u],w=x.distanceToSquared(w),v.push(w),w<k&&(k=w,m=h,n=u)}h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:t.length-1;var z=[t[m],e[n],e[h]];u=THREE.FontUtils.Triangulate.area(z);var y=[t[m],t[k],e[n]];x=THREE.FontUtils.Triangulate.area(y);v=n;w=m;n+=1;m+=-1;n<
+0&&(n+=e.length);n%=e.length;m<0&&(m+=t.length);m%=t.length;h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:t.length-1;z=[t[m],e[n],e[h]];z=THREE.FontUtils.Triangulate.area(z);y=[t[m],t[k],e[n]];y=THREE.FontUtils.Triangulate.area(y);u+x>z+y&&(n=v,m=w,n<0&&(n+=e.length),n%=e.length,m<0&&(m+=t.length),m%=t.length,h=n-1>=0?n-1:e.length-1,k=m-1>=0?m-1:t.length-1);u=e.slice(0,n);x=e.slice(n);v=t.slice(m);w=t.slice(0,m);k=[t[m],t[k],e[n]];A.push([t[m],e[n],e[h]]);A.push(k);e=u.concat(v).concat(w).concat(x)}return{shape:e,
+isolatedPts:A,allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),k,m,n,p,t={};k=0;for(m=f.length;k<m;k++)p=f[k].x+":"+f[k].y,t[p]!==void 0&&console.log("Duplicate point",p),t[p]=k;k=0;for(m=e.length;k<m;k++){n=e[k];for(f=0;f<3;f++)p=n[f].x+":"+n[f].y,p=t[p],p!==void 0&&(n[f]=p)}k=0;for(m=h.length;k<m;k++){n=h[k];for(f=0;f<3;f++)p=n[f].x+":"+n[f].y,p=t[p],p!==void 0&&(n[f]=p)}return e.concat(h)},
 isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<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,h){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+
 this.b3p3(b,h)}};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",h=c.weight!==void 0?c.weight:"normal",k=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=h;THREE.FontUtils.style=k};
 THREE.TextPath.prototype.toShapes=function(){for(var b=THREE.FontUtils.drawText(this.text).paths,c=[],e=0,f=b.length;e<f;e++)Array.prototype.push.apply(c,b[e].toShapes());return c};
 THREE.AnimationHandler=function(){var b=[],c={},e={update:function(e){for(var c=0;c<b.length;c++)b[c].update(e)},addToUpdate:function(e){b.indexOf(e)===-1&&b.push(e)},removeFromUpdate:function(e){e=b.indexOf(e);e!==-1&&b.splice(e,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
-0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var n=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(n[0],n[1],n[2],n[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){n={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var p=0;p<b.hierarchy[e].keys[f].morphTargets.length;p++){var u=b.hierarchy[e].keys[f].morphTargets[p];n[u]=-1}b.hierarchy[e].usedMorphTargets=n;for(f=0;f<b.hierarchy[e].keys.length;f++){var v=
-{};for(u in n){for(p=0;p<b.hierarchy[e].keys[f].morphTargets.length;p++)if(b.hierarchy[e].keys[f].morphTargets[p]===u){v[u]=b.hierarchy[e].keys[f].morphTargetsInfluences[p];break}p===b.hierarchy[e].keys[f].morphTargets.length&&(v[u]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=v}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
+0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var n=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(n[0],n[1],n[2],n[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){n={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var p=0;p<b.hierarchy[e].keys[f].morphTargets.length;p++){var t=b.hierarchy[e].keys[f].morphTargets[p];n[t]=-1}b.hierarchy[e].usedMorphTargets=n;for(f=0;f<b.hierarchy[e].keys.length;f++){var w=
+{};for(t in n){for(p=0;p<b.hierarchy[e].keys[f].morphTargets.length;p++)if(b.hierarchy[e].keys[f].morphTargets[p]===t){w[t]=b.hierarchy[e].keys[f].morphTargetsInfluences[p];break}p===b.hierarchy[e].keys[f].morphTargets.length&&(w[t]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=w}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
 b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(e=0;e<b.hierarchy.length;e++)b.JIT.hierarchy.push(Array(f));b.initialized=!0}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var e=[];if(b instanceof THREE.SkinnedMesh)for(var c=0;c<b.bones.length;c++)e.push(b.bones[c]);else f(b,e);return e}},f=function(b,e){e.push(b);for(var c=0;c<b.children.length;c++)f(b.children[c],e)};e.LINEAR=0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=
 2;return e}();THREE.Animation=function(b,c,e,f){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=e!==void 0?e:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=c!==void 0?c:0;var e,f=this.hierarchy.length,h;for(e=0;e<f;e++){h=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)h.useQuaternion=!0;h.matrixAutoUpdate=!0;if(h.animationCache===void 0)h.animationCache={},h.animationCache.prevKey={pos:0,rot:0,scl:0},h.animationCache.nextKey={pos:0,rot:0,scl:0},h.animationCache.originalMatrix=h instanceof
 THREE.Bone?h.skinMatrix:h.matrix;var k=h.animationCache.prevKey;h=h.animationCache.nextKey;k.pos=this.data.hierarchy[e].keys[0];k.rot=this.data.hierarchy[e].keys[0];k.scl=this.data.hierarchy[e].keys[0];h.pos=this.getNextKeyWith("pos",e,1);h.rot=this.getNextKeyWith("rot",e,1);h.scl=this.getNextKeyWith("scl",e,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 b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,h,k,m,n,p,u,v=this.data.JIT.hierarchy,t,w;this.currentTime+=b*this.timeScale;w=this.currentTime;t=this.currentTime%=this.data.length;u=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var x=0,y=this.hierarchy.length;x<y;x++)if(b=this.hierarchy[x],p=b.animationCache,this.JITCompile&&v[x][u]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=v[x][u],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
-!1):(b.matrix=v[x][u],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var z=0;z<3;z++){e=c[z];m=p.prevKey[e];n=p.nextKey[e];if(n.time<=w){if(t<w)if(this.loop){m=this.data.hierarchy[x].keys[0];for(n=this.getNextKeyWith(e,x,1);n.time<t;)m=n,n=this.getNextKeyWith(e,x,n.index+1)}else{this.stop();return}else{do m=n,n=this.getNextKeyWith(e,x,n.index+1);while(n.time<
-t)}p.prevKey[e]=m;p.nextKey[e]=n}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-m.time)/(n.time-m.time);h=m[e];k=n[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+x),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",x,m.index-1).pos,this.points[1]=h,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",x,n.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
-"rot")THREE.Quaternion.slerp(h,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f}}if(this.JITCompile&&v[0][u]===void 0){this.hierarchy[0].update(void 0,!0);for(x=0;x<this.hierarchy.length;x++)v[x][u]=this.hierarchy[x]instanceof THREE.Bone?this.hierarchy[x].skinMatrix.clone():this.hierarchy[x].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],h,k,m,n,p,u;h=(b.length-1)*c;k=Math.floor(h);h-=k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>b.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];n=b[e[1]];p=b[e[2]];u=b[e[3]];e=h*h;m=h*e;f[0]=this.interpolate(k[0],n[0],p[0],u[0],h,e,m);f[1]=this.interpolate(k[1],n[1],p[1],u[1],h,e,m);f[2]=this.interpolate(k[2],n[2],p[2],u[2],h,e,m);return f};
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,h,k,m,n,p,t,w=this.data.JIT.hierarchy,u,x;this.currentTime+=b*this.timeScale;x=this.currentTime;u=this.currentTime%=this.data.length;t=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,A=this.hierarchy.length;v<A;v++)if(b=this.hierarchy[v],p=b.animationCache,this.JITCompile&&w[v][t]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=w[v][t],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
+!1):(b.matrix=w[v][t],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var z=0;z<3;z++){e=c[z];m=p.prevKey[e];n=p.nextKey[e];if(n.time<=x){if(u<x)if(this.loop){m=this.data.hierarchy[v].keys[0];for(n=this.getNextKeyWith(e,v,1);n.time<u;)m=n,n=this.getNextKeyWith(e,v,n.index+1)}else{this.stop();return}else{do m=n,n=this.getNextKeyWith(e,v,n.index+1);while(n.time<
+u)}p.prevKey[e]=m;p.nextKey[e]=n}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(u-m.time)/(n.time-m.time);h=m[e];k=n[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",v,m.index-1).pos,this.points[1]=h,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",v,n.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
+"rot")THREE.Quaternion.slerp(h,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f}}if(this.JITCompile&&w[0][t]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;v<this.hierarchy.length;v++)w[v][t]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],h,k,m,n,p,t;h=(b.length-1)*c;k=Math.floor(h);h-=k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>b.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];n=b[e[1]];p=b[e[2]];t=b[e[3]];e=h*h;m=h*e;f[0]=this.interpolate(k[0],n[0],p[0],t[0],h,e,m);f[1]=this.interpolate(k[1],n[1],p[1],t[1],h,e,m);f[2]=this.interpolate(k[2],n[2],p[2],t[2],h,e,m);return f};
 THREE.Animation.prototype.interpolate=function(b,c,e,f,h,k,m){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*m+(-3*(c-e)-2*b-f)*k+b*h+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.CubeCamera=function(b,c,e,f){this.cameraPX=new THREE.PerspectiveCamera(90,1,b,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,b,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,b,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,b,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,b,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,b,c);this.cameraPXTarget=new THREE.Vector3(0,0,0);this.cameraNXTarget=new THREE.Vector3(0,0,0);this.cameraPYTarget=new THREE.Vector3(0,0,0);this.cameraNYTarget=
@@ -441,15 +441,15 @@ b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=function(b){sw
 Math.PI/180;var b=this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e*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)/(Math.PI-0)+this.verticalMin;b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",e(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",e(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",
 e(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",e(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",e(this,this.onKeyUp),!1)};
-THREE.PathControls=function(b){function c(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),p=m.length,F=0;k=p-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<p-1;k++)F=f*n.chunks[k]/n.total,e.keys[k]={time:F,pos:m[k]};h.hierarchy[0]=e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
-f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,k);particleObj=new THREE.ParticleSystem(h,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);h=new THREE.SphereGeometry(1,
-16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,k),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}this.object=b;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,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.domElement=document;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var h=Math.PI*2,k=Math.PI/180;this.update=function(b,e,
-c){var f,m;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;f=this.phi%h;this.phi=f>=0?f:f+h;f=this.verticalAngleMap.srcRange;m=this.verticalAngleMap.dstRange;var n=m[1]-m[0];this.phi=TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(m[1]-m[0])/(f[1]-f[0])+m[0]-m[0])/n)*n+m[0];f=this.horizontalAngleMap.srcRange;
-m=this.horizontalAngleMap.dstRange;n=m[1]-m[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(m[1]-m[0])/(f[1]-f[0])+m[0]-m[0])/n)*n+m[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-
-this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};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}),m=new THREE.MeshLambertMaterial({color:65280}),n=new THREE.CubeGeometry(10,10,20),p=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(n,b);b=new THREE.Mesh(p,m);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,e){return function(){e.apply(b,arguments)}}(this,
-this.onMouseMove),!1)};THREE.PathCameraIdCounter=0;
+THREE.PathControls=function(b,c){function e(b){if((b*=2)<1)return 0.5*b*b;return-0.5*(--b*(b-2)-1)}function f(b,e){return function(){e.apply(b,arguments)}}function h(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),y=m.length,D=0;k=y-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<y-1;k++)D=f*n.chunks[k]/n.total,e.keys[k]={time:D,pos:m[k]};h.hierarchy[0]=
+e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function k(b,e){var c,f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}this.object=b;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;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,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
+this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var m=Math.PI*2,n=Math.PI/180;this.update=function(){var b,c;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)*n;this.theta=this.lon*n;b=this.phi%m;this.phi=b>=0?b:b+m;b=this.verticalAngleMap.srcRange;
+c=this.verticalAngleMap.dstRange;var f=c[1]-c[0];this.phi=e(((this.phi-b[0])*(c[1]-c[0])/(b[1]-b[0])+c[0]-c[0])/f)*f+c[0];b=this.horizontalAngleMap.srcRange;c=this.horizontalAngleMap.dstRange;f=c[1]-c[0];this.theta=e(((this.theta-b[0])*(c[1]-c[0])/(b[1]-b[0])+c[0]-c[0])/f)*f+c[0];b=this.target.position;b.x=100*Math.sin(this.phi)*Math.cos(this.theta);b.y=100*Math.cos(this.phi);b.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(b){this.domElement===
+document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){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}),e=new THREE.MeshLambertMaterial({color:65280}),
+c=new THREE.CubeGeometry(10,10,20),m=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,b);b=new THREE.Mesh(m,e);b.position.set(0,10,0);this.animation=h(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(b)}else this.animation=h(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var b=
+this.debugPath,e=this.spline,c=k(e,10),m=k(e,10),n=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,n);particleObj=new THREE.ParticleSystem(m,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.add(lineObj);particleObj.scale.set(1,1,1);b.add(particleObj);m=new THREE.SphereGeometry(1,16,8);n=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<e.points.length;i++)c=new THREE.Mesh(m,n),c.position.copy(e.points[i]),b.add(c)}this.domElement.addEventListener("mousemove",
+f(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
 THREE.FlyControls=function(b,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;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=
@@ -459,113 +459,113 @@ THREE.FlyControls=function(b,c){function e(b,e){return function(){e.apply(b,argu
 1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var b=this.moveState.forward||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=-b+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",e(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",e(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",e(this,this.mouseup),!1);this.domElement.addEventListener("keydown",e(this,this.keydown),!1);this.domElement.addEventListener("keyup",e(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(b,c){this.object=b;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,m=!1,n=1,p=0,u=0,v=0,t=0,w=0,x=window.innerWidth/2,y=window.innerHeight/2;this.update=function(){var b=
-(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*t),this.rotateVertically(b*w));b=this.delta*this.movementSpeed;this.object.translateZ(-b*(p>0||this.autoForward&&!(p<0)?1:p));this.object.translateX(b*u);this.object.translateY(b*v);m&&(this.roll+=this.rollSpeed*this.delta*n);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+THREE.RollControls=function(b,c){this.object=b;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,m=!1,n=1,p=0,t=0,w=0,u=0,x=0,v=window.innerWidth/2,A=window.innerHeight/2;this.update=function(){var b=
+(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*u),this.rotateVertically(b*x));b=this.delta*this.movementSpeed;this.object.translateZ(-b*(p>0||this.autoForward&&!(p<0)?1:p));this.object.translateX(b*t);this.object.translateY(b*w);m&&(this.roll+=this.rollSpeed*this.delta*n);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();h.copy(this.forward);f.set(0,1,0);e.cross(f,h).normalize();f.cross(h,e).normalize();this.object.matrix.n11=e.x;this.object.matrix.n12=f.x;this.object.matrix.n13=h.x;this.object.matrix.n21=e.y;this.object.matrix.n22=f.y;this.object.matrix.n23=h.y;this.object.matrix.n31=e.z;this.object.matrix.n32=f.z;this.object.matrix.n33=h.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);
 k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(k);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(b){this.object.position.x+=this.object.matrix.n11*b;this.object.position.y+=this.object.matrix.n21*b;this.object.position.z+=this.object.matrix.n31*b};this.translateY=function(b){this.object.position.x+=this.object.matrix.n12*
 b;this.object.position.y+=this.object.matrix.n22*b;this.object.position.z+=this.object.matrix.n32*b};this.translateZ=function(b){this.object.position.x-=this.object.matrix.n13*b;this.object.position.y-=this.object.matrix.n23*b;this.object.position.z-=this.object.matrix.n33*b};this.rotateHorizontally=function(b){e.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);e.multiplyScalar(b);this.forward.subSelf(e);this.forward.normalize()};this.rotateVertically=function(b){f.set(this.object.matrix.n12,
-this.object.matrix.n22,this.object.matrix.n32);f.multiplyScalar(b);this.forward.addSelf(f);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(b){t=(b.clientX-x)/window.innerWidth;w=(b.clientY-y)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",
-function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:p=1;break;case 37:case 65:u=-1;break;case 40:case 83:p=-1;break;case 39:case 68:u=1;break;case 81:m=!0;n=1;break;case 69:m=!0;n=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:p=0;break;case 37:case 65:u=0;break;case 40:case 83:p=
-0;break;case 39:case 68:u=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:v=0;break;case 70:v=0}},!1)};
+this.object.matrix.n22,this.object.matrix.n32);f.multiplyScalar(b);this.forward.addSelf(f);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(b){u=(b.clientX-v)/window.innerWidth;x=(b.clientY-A)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",
+function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:p=1;break;case 37:case 65:t=-1;break;case 40:case 83:p=-1;break;case 39:case 68:t=1;break;case 81:m=!0;n=1;break;case 69:m=!0;n=-1;break;case 82:w=1;break;case 70:w=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:p=0;break;case 37:case 65:t=0;break;case 40:case 83:p=
+0;break;case 39:case 68:t=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:w=0;break;case 70:w=0}},!1)};
 THREE.TrackballControls=function(b,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.domElement=c!==void 0?c:document;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
-0,0);var f=!1,h=this.STATE.NONE,k=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector2,u=new THREE.Vector2,v=new THREE.Vector2,t=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,e){return new THREE.Vector2((b-this.screen.offsetLeft)/this.radius*0.5,(e-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,e){var c=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/
+0,0);var f=!1,h=this.STATE.NONE,k=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector2,t=new THREE.Vector2,w=new THREE.Vector2,u=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,e){return new THREE.Vector2((b-this.screen.offsetLeft)/this.radius*0.5,(e-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,e){var c=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/
 this.radius,(this.screen.height*0.5+this.screen.offsetTop-e)/this.radius,0),f=c.length();f>1?c.normalize():c.z=Math.sqrt(1-f*f);k.copy(this.object.position).subSelf(this.target);f=this.object.up.clone().setLength(c.y);f.addSelf(this.object.up.clone().crossSelf(k).setLength(c.x));f.addSelf(k.setLength(c.z));return f};this.rotateCamera=function(){var b=Math.acos(m.dot(n)/m.length()/n.length());if(b){var e=(new THREE.Vector3).cross(m,n).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e,
--b);c.multiplyVector3(k);c.multiplyVector3(this.object.up);c.multiplyVector3(n);this.staticMoving?m=n:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(m))}};this.zoomCamera=function(){var b=1+(u.y-p.y)*this.zoomSpeed;b!==1&&b>0&&(k.multiplyScalar(b),this.staticMoving?p=u:p.y+=(u.y-p.y)*this.dynamicDampingFactor)};this.panCamera=function(){var b=t.clone().subSelf(v);if(b.lengthSq()){b.multiplyScalar(k.length()*this.panSpeed);var e=k.clone().crossSelf(this.object.up).setLength(b.x);
-e.addSelf(this.object.up.clone().setLength(b.y));this.object.position.addSelf(e);this.target.addSelf(e);this.staticMoving?v=t:v.addSelf(b.sub(t,v).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.object.position.lengthSq()>this.maxDistance*this.maxDistance&&this.object.position.setLength(this.maxDistance),k.lengthSq()<this.minDistance*this.minDistance&&this.object.position.add(this.target,k.setLength(this.minDistance))};this.update=function(){k.copy(this.object.position).subSelf(this.target);
-this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.object.position.add(this.target,k);this.checkDistances();this.object.lookAt(this.target)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",e(this,function(b){f&&(m=n=this.getMouseProjectionOnBall(b.clientX,b.clientY),p=u=this.getMouseOnScreen(b.clientX,b.clientY),v=t=this.getMouseOnScreen(b.clientX,b.clientY),f=!1);h!==this.STATE.NONE&&
-(h===this.STATE.ROTATE?n=this.getMouseProjectionOnBall(b.clientX,b.clientY):h===this.STATE.ZOOM&&!this.noZoom?u=this.getMouseOnScreen(b.clientX,b.clientY):h===this.STATE.PAN&&!this.noPan&&(t=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",e(this,function(b){b.preventDefault();b.stopPropagation();if(h===this.STATE.NONE)h=b.button,h===this.STATE.ROTATE?m=n=this.getMouseProjectionOnBall(b.clientX,b.clientY):h===this.STATE.ZOOM&&!this.noZoom?p=u=this.getMouseOnScreen(b.clientX,
-b.clientY):this.noPan||(v=t=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",e(this,function(b){b.preventDefault();b.stopPropagation();h=this.STATE.NONE}),!1);window.addEventListener("keydown",e(this,function(b){if(h===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])h=this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)h=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)h=this.STATE.PAN;h!==
+-b);c.multiplyVector3(k);c.multiplyVector3(this.object.up);c.multiplyVector3(n);this.staticMoving?m=n:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(m))}};this.zoomCamera=function(){var b=1+(t.y-p.y)*this.zoomSpeed;b!==1&&b>0&&(k.multiplyScalar(b),this.staticMoving?p=t:p.y+=(t.y-p.y)*this.dynamicDampingFactor)};this.panCamera=function(){var b=u.clone().subSelf(w);if(b.lengthSq()){b.multiplyScalar(k.length()*this.panSpeed);var e=k.clone().crossSelf(this.object.up).setLength(b.x);
+e.addSelf(this.object.up.clone().setLength(b.y));this.object.position.addSelf(e);this.target.addSelf(e);this.staticMoving?w=u:w.addSelf(b.sub(u,w).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.object.position.lengthSq()>this.maxDistance*this.maxDistance&&this.object.position.setLength(this.maxDistance),k.lengthSq()<this.minDistance*this.minDistance&&this.object.position.add(this.target,k.setLength(this.minDistance))};this.update=function(){k.copy(this.object.position).subSelf(this.target);
+this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.object.position.add(this.target,k);this.checkDistances();this.object.lookAt(this.target)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",e(this,function(b){f&&(m=n=this.getMouseProjectionOnBall(b.clientX,b.clientY),p=t=this.getMouseOnScreen(b.clientX,b.clientY),w=u=this.getMouseOnScreen(b.clientX,b.clientY),f=!1);h!==this.STATE.NONE&&
+(h===this.STATE.ROTATE?n=this.getMouseProjectionOnBall(b.clientX,b.clientY):h===this.STATE.ZOOM&&!this.noZoom?t=this.getMouseOnScreen(b.clientX,b.clientY):h===this.STATE.PAN&&!this.noPan&&(u=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",e(this,function(b){b.preventDefault();b.stopPropagation();if(h===this.STATE.NONE)h=b.button,h===this.STATE.ROTATE?m=n=this.getMouseProjectionOnBall(b.clientX,b.clientY):h===this.STATE.ZOOM&&!this.noZoom?p=t=this.getMouseOnScreen(b.clientX,
+b.clientY):this.noPan||(w=u=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",e(this,function(b){b.preventDefault();b.stopPropagation();h=this.STATE.NONE}),!1);window.addEventListener("keydown",e(this,function(b){if(h===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])h=this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)h=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)h=this.STATE.PAN;h!==
 this.STATE.NONE&&(f=!0)}}),!1);window.addEventListener("keyup",e(this,function(){if(h!==this.STATE.NONE)h=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.CubeGeometry=function(b,c,e,f,h,k,m,n,p){function u(b,e,c,m,n,p,t,u){var w,x,y=f||1,z=h||1,Q=n/2,R=p/2,Y=v.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")w="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")w="y",z=k||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")w="x",y=k||1;var W=y+1,o=z+1;n/=y;var ea=p/z;for(x=0;x<o;x++)for(p=0;p<W;p++){var P=new THREE.Vector3;P[b]=(p*n-Q)*c;P[e]=(x*ea-R)*m;P[w]=t;v.vertices.push(new THREE.Vertex(P))}for(x=0;x<z;x++)for(p=0;p<y;p++)v.faces.push(new THREE.Face4(p+W*
-x+Y,p+W*(x+1)+Y,p+1+W*(x+1)+Y,p+1+W*x+Y,null,null,u)),v.faceVertexUvs[0].push([new THREE.UV(p/y,x/z),new THREE.UV(p/y,(x+1)/z),new THREE.UV((p+1)/y,(x+1)/z),new THREE.UV((p+1)/y,x/z)])}THREE.Geometry.call(this);var v=this,t=b/2,w=c/2,x=e/2,n=n?-1:1;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var z in p)this.sides[z]!=void 0&&(this.sides[z]=
-p[z]);this.sides.px&&u("z","y",1*n,-1,e,c,-t,this.materials[0]);this.sides.nx&&u("z","y",-1*n,-1,e,c,t,this.materials[1]);this.sides.py&&u("x","z",1*n,1,b,e,w,this.materials[2]);this.sides.ny&&u("x","z",1*n,-1,b,e,-w,this.materials[3]);this.sides.pz&&u("x","y",1*n,-1,b,c,x,this.materials[4]);this.sides.nz&&u("x","y",-1*n,-1,b,c,-x,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(b,c,e,f,h,k,m,n,p){function t(b,e,c,m,n,t,p,u){var v,x,z=f||1,A=h||1,Q=n/2,R=t/2,Y=w.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")v="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")v="y",A=k||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",z=k||1;var W=z+1,o=A+1;n/=z;var ea=t/A;for(x=0;x<o;x++)for(t=0;t<W;t++){var P=new THREE.Vector3;P[b]=(t*n-Q)*c;P[e]=(x*ea-R)*m;P[v]=p;w.vertices.push(new THREE.Vertex(P))}for(x=0;x<A;x++)for(t=0;t<z;t++)w.faces.push(new THREE.Face4(t+W*
+x+Y,t+W*(x+1)+Y,t+1+W*(x+1)+Y,t+1+W*x+Y,null,null,u)),w.faceVertexUvs[0].push([new THREE.UV(t/z,x/A),new THREE.UV(t/z,(x+1)/A),new THREE.UV((t+1)/z,(x+1)/A),new THREE.UV((t+1)/z,x/A)])}THREE.Geometry.call(this);var w=this,u=b/2,x=c/2,v=e/2,n=n?-1:1;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var A=0;A<6;A++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var z in p)this.sides[z]!=void 0&&(this.sides[z]=
+p[z]);this.sides.px&&t("z","y",1*n,-1,e,c,-u,this.materials[0]);this.sides.nx&&t("z","y",-1*n,-1,e,c,u,this.materials[1]);this.sides.py&&t("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&t("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&t("x","y",1*n,-1,b,c,v,this.materials[4]);this.sides.nz&&t("x","y",-1*n,-1,b,c,-v,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(b,c,e,f,h,k){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,m=e/2,f=f||8,h=h||1,n,p,u=[],v=[];for(p=0;p<=h;p++){var t=[],w=[],x=p/h,y=x*(c-b)+b;for(n=0;n<=f;n++){var z=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(z*Math.PI*2),-x*e+m,y*Math.cos(z*Math.PI*2))));t.push(this.vertices.length-1);w.push(new THREE.UV(z,x))}u.push(t);v.push(w)}for(p=0;p<h;p++)for(n=0;n<f;n++){var e=u[p][n],t=u[p+1][n],w=u[p+1][n+1],x=u[p][n+1],y=
-this.vertices[e].position.clone().setY(0).normalize(),z=this.vertices[t].position.clone().setY(0).normalize(),A=this.vertices[w].position.clone().setY(0).normalize(),E=this.vertices[x].position.clone().setY(0).normalize(),F=v[p][n].clone(),D=v[p+1][n].clone(),H=v[p+1][n+1].clone(),L=v[p][n+1].clone();this.faces.push(new THREE.Face4(e,t,w,x,[y,z,A,E]));this.faceVertexUvs[0].push([F,D,H,L])}if(!k&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n<f;n++)e=u[0][n],t=u[0][n+
-1],w=this.vertices.length-1,y=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),F=v[0][n].clone(),D=v[0][n+1].clone(),H=new THREE.UV(D.u,0),this.faces.push(new THREE.Face3(e,t,w,[y,z,A])),this.faceVertexUvs[0].push([F,D,H])}if(!k&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;n<f;n++)e=u[p][n+1],t=u[p][n],w=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),F=v[p][n+1].clone(),D=v[p][n].clone(),
-H=new THREE.UV(D.u,1),this.faces.push(new THREE.Face3(e,t,w,[y,z,A])),this.faceVertexUvs[0].push([F,D,H])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(b,c,e,f,h,k){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,m=e/2,f=f||8,h=h||1,n,p,t=[],w=[];for(p=0;p<=h;p++){var u=[],x=[],v=p/h,A=v*(c-b)+b;for(n=0;n<=f;n++){var z=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(A*Math.sin(z*Math.PI*2),-v*e+m,A*Math.cos(z*Math.PI*2))));u.push(this.vertices.length-1);x.push(new THREE.UV(z,v))}t.push(u);w.push(x)}for(p=0;p<h;p++)for(n=0;n<f;n++){var e=t[p][n],u=t[p+1][n],x=t[p+1][n+1],v=t[p][n+1],A=
+this.vertices[e].position.clone().setY(0).normalize(),z=this.vertices[u].position.clone().setY(0).normalize(),y=this.vertices[x].position.clone().setY(0).normalize(),D=this.vertices[v].position.clone().setY(0).normalize(),F=w[p][n].clone(),E=w[p+1][n].clone(),H=w[p+1][n+1].clone(),L=w[p][n+1].clone();this.faces.push(new THREE.Face4(e,u,x,v,[A,z,y,D]));this.faceVertexUvs[0].push([F,E,H,L])}if(!k&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n<f;n++)e=t[0][n],u=t[0][n+
+1],x=this.vertices.length-1,A=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),F=w[0][n].clone(),E=w[0][n+1].clone(),H=new THREE.UV(E.u,0),this.faces.push(new THREE.Face3(e,u,x,[A,z,y])),this.faceVertexUvs[0].push([F,E,H])}if(!k&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;n<f;n++)e=t[p][n+1],u=t[p][n],x=this.vertices.length-1,A=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),F=w[p][n+1].clone(),E=w[p][n].clone(),
+H=new THREE.UV(E.u,1),this.faces.push(new THREE.Face3(e,u,x,[A,z,y])),this.faceVertexUvs[0].push([F,E,H])}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,h;this.shapebb=b[f-1].getBoundingBox();for(e=0;e<f;e++)h=b[e],this.addShape(h,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,e,c){e||console.log("die");return e.clone().multiplyScalar(c).addSelf(b)}function f(b,e,c){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,k=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-e.x,b.y-e.y);h.set(b.x-c.x,b.y-c.y);f=f.normalize();h=h.normalize();k.set(-f.y,f.x);m.set(h.y,-h.x);n.copy(b).addSelf(k);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
 n.copy(e).addSelf(k);o.copy(c).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<0)return e=Math.atan2(e.y-b.y,e.x-b.x),b=Math.atan2(c.y-b.y,c.x-b.x),e>b&&(b+=Math.PI*2),anglec=(e+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(J=b.length;--J>=0;){ka=J;fa=J-1;fa<0&&(fa=b.length-
-1);for(var e=0,c=x+v*2,e=0;e<c;e++){var f=ea*e,h=ea*(e+1),k=ca+ka+f,m=ca+ka+h,o=k,f=ca+fa+f,h=ca+fa+h,t=m;o+=da;f+=da;h+=da;t+=da;B.faces.push(new THREE.Face4(o,f,h,t,null,null,H));H&&(o=e/c,f=(e+1)/c,h=n+p*2,k=(B.vertices[k].position.z+p)/h,m=(B.vertices[m].position.z+p)/h,B.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function k(b,e,c){B.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function m(b,e,c){b+=da;e+=da;c+=da;B.faces.push(new THREE.Face3(b,
-e,c,null,null,D));if(D){var f=L.maxY,h=L.maxX,k=B.vertices[e].position.x,e=B.vertices[e].position.y,m=B.vertices[c].position.x,c=B.vertices[c].position.y;B.faceVertexUvs[0].push([new THREE.UV(B.vertices[b].position.x/h,B.vertices[b].position.y/f),new THREE.UV(k/h,e/f),new THREE.UV(m/h,c/f)])}}var n=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,u=c.bevelSize!==void 0?c.bevelSize:p-2,v=c.bevelSegments!==void 0?c.bevelSegments:3,t=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,w=c.curveSegments!==void 0?c.curveSegments:12,x=c.steps!==void 0?c.steps:1,y=c.bendPath,z=c.extrudePath,A,E=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,H=c.extrudeMaterial,L=this.shapebb;if(z)A=z.getPoints(w),x=A.length,E=!0,t=!1;t||(u=p=v=0);var M,K,G,B=this,da=this.vertices.length;y&&b.addWrapPath(y);w=F?b.extractAllSpacedPoints(w):b.extractAllPoints(w);y=w.shape;w=w.holes;if(z=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();K=0;for(G=w.length;K<G;K++)M=w[K],THREE.Shape.Utils.isClockWise(M)&&
-(w[K]=M.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(y,w);F=y;K=0;for(G=w.length;K<G;K++)M=w[K],y=y.concat(M);var J,Q,R,Y,W,o,ea=y.length,P=z.length,ma=[];J=0;Q=F.length;ka=Q-1;for(fa=J+1;J<Q;J++,ka++,fa++)ka==Q&&(ka=0),fa==Q&&(fa=0),ma[J]=f(F[J],F[ka],F[fa]);var Z=[],ia,aa=ma.concat();K=0;for(G=w.length;K<G;K++){M=w[K];ia=[];J=0;Q=M.length;ka=Q-1;for(fa=J+1;J<Q;J++,ka++,fa++)ka==Q&&(ka=0),fa==Q&&(fa=0),ia[J]=f(M[J],M[ka],M[fa]);Z.push(ia);aa=aa.concat(ia)}for(R=0;R<v;R++){Y=R/v;W=p*(1-Y);
-Y=u*Math.sin(Y*Math.PI/2);J=0;for(Q=F.length;J<Q;J++)o=e(F[J],ma[J],Y),k(o.x,o.y,-W);K=0;for(G=w.length;K<G;K++){M=w[K];ia=Z[K];J=0;for(Q=M.length;J<Q;J++)o=e(M[J],ia[J],Y),k(o.x,o.y,-W)}}Y=u;for(J=0;J<ea;J++)o=t?e(y[J],aa[J],Y):y[J],E?k(o.x,o.y+A[0].y,A[0].x):k(o.x,o.y,0);for(R=1;R<=x;R++)for(J=0;J<ea;J++)o=t?e(y[J],aa[J],Y):y[J],E?k(o.x,o.y+A[R-1].y,A[R-1].x):k(o.x,o.y,n/x*R);for(R=v-1;R>=0;R--){Y=R/v;W=p*(1-Y);Y=u*Math.sin(Y*Math.PI/2);J=0;for(Q=F.length;J<Q;J++)o=e(F[J],ma[J],Y),k(o.x,o.y,n+W);
-K=0;for(G=w.length;K<G;K++){M=w[K];ia=Z[K];J=0;for(Q=M.length;J<Q;J++)o=e(M[J],ia[J],Y),E?k(o.x,o.y+A[x-1].y,A[x-1].x+W):k(o.x,o.y,n+W)}}if(t){t=ea*0;for(J=0;J<P;J++)u=z[J],m(u[2]+t,u[1]+t,u[0]+t);t=ea*(x+v*2);for(J=0;J<P;J++)u=z[J],m(u[0]+t,u[1]+t,u[2]+t)}else{for(J=0;J<P;J++)u=z[J],m(u[2],u[1],u[0]);for(J=0;J<P;J++)u=z[J],m(u[0]+ea*x,u[1]+ea*x,u[2]+ea*x)}var ka,fa,ca=0;h(F);ca+=F.length;K=0;for(G=w.length;K<G;K++)M=w[K],h(M),ca+=M.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+1);for(var e=0,c=v+w*2,e=0;e<c;e++){var f=ea*e,h=ea*(e+1),k=ca+ka+f,m=ca+ka+h,o=k,f=ca+fa+f,h=ca+fa+h,t=m;o+=da;f+=da;h+=da;t+=da;B.faces.push(new THREE.Face4(o,f,h,t,null,null,H));H&&(o=e/c,f=(e+1)/c,h=n+p*2,k=(B.vertices[k].position.z+p)/h,m=(B.vertices[m].position.z+p)/h,B.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function k(b,e,c){B.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function m(b,e,c){b+=da;e+=da;c+=da;B.faces.push(new THREE.Face3(b,
+e,c,null,null,E));if(E){var f=L.maxY,h=L.maxX,k=B.vertices[e].position.x,e=B.vertices[e].position.y,m=B.vertices[c].position.x,c=B.vertices[c].position.y;B.faceVertexUvs[0].push([new THREE.UV(B.vertices[b].position.x/h,B.vertices[b].position.y/f),new THREE.UV(k/h,e/f),new THREE.UV(m/h,c/f)])}}var n=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:p-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,A=c.bendPath,z=c.extrudePath,y,D=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,E=c.material,H=c.extrudeMaterial,L=this.shapebb;if(z)y=z.getPoints(x),v=y.length,D=!0,u=!1;u||(t=p=w=0);var M,K,G,B=this,da=this.vertices.length;A&&b.addWrapPath(A);x=F?b.extractAllSpacedPoints(x):b.extractAllPoints(x);A=x.shape;x=x.holes;if(z=!THREE.Shape.Utils.isClockWise(A)){A=A.reverse();K=0;for(G=x.length;K<G;K++)M=x[K],THREE.Shape.Utils.isClockWise(M)&&
+(x[K]=M.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(A,x);F=A;K=0;for(G=x.length;K<G;K++)M=x[K],A=A.concat(M);var J,Q,R,Y,W,o,ea=A.length,P=z.length,ma=[];J=0;Q=F.length;ka=Q-1;for(fa=J+1;J<Q;J++,ka++,fa++)ka==Q&&(ka=0),fa==Q&&(fa=0),ma[J]=f(F[J],F[ka],F[fa]);var Z=[],ia,aa=ma.concat();K=0;for(G=x.length;K<G;K++){M=x[K];ia=[];J=0;Q=M.length;ka=Q-1;for(fa=J+1;J<Q;J++,ka++,fa++)ka==Q&&(ka=0),fa==Q&&(fa=0),ia[J]=f(M[J],M[ka],M[fa]);Z.push(ia);aa=aa.concat(ia)}for(R=0;R<w;R++){Y=R/w;W=p*(1-Y);
+Y=t*Math.sin(Y*Math.PI/2);J=0;for(Q=F.length;J<Q;J++)o=e(F[J],ma[J],Y),k(o.x,o.y,-W);K=0;for(G=x.length;K<G;K++){M=x[K];ia=Z[K];J=0;for(Q=M.length;J<Q;J++)o=e(M[J],ia[J],Y),k(o.x,o.y,-W)}}Y=t;for(J=0;J<ea;J++)o=u?e(A[J],aa[J],Y):A[J],D?k(o.x,o.y+y[0].y,y[0].x):k(o.x,o.y,0);for(R=1;R<=v;R++)for(J=0;J<ea;J++)o=u?e(A[J],aa[J],Y):A[J],D?k(o.x,o.y+y[R-1].y,y[R-1].x):k(o.x,o.y,n/v*R);for(R=w-1;R>=0;R--){Y=R/w;W=p*(1-Y);Y=t*Math.sin(Y*Math.PI/2);J=0;for(Q=F.length;J<Q;J++)o=e(F[J],ma[J],Y),k(o.x,o.y,n+W);
+K=0;for(G=x.length;K<G;K++){M=x[K];ia=Z[K];J=0;for(Q=M.length;J<Q;J++)o=e(M[J],ia[J],Y),D?k(o.x,o.y+y[v-1].y,y[v-1].x+W):k(o.x,o.y,n+W)}}if(u){u=ea*0;for(J=0;J<P;J++)t=z[J],m(t[2]+u,t[1]+u,t[0]+u);u=ea*(v+w*2);for(J=0;J<P;J++)t=z[J],m(t[0]+u,t[1]+u,t[2]+u)}else{for(J=0;J<P;J++)t=z[J],m(t[2],t[1],t[0]);for(J=0;J<P;J++)t=z[J],m(t[0]+ea*v,t[1]+ea*v,t[2]+ea*v)}var ka,fa,ca=0;h(F);ca+=F.length;K=0;for(G=x.length;K<G;K++)M=x[K],h(M),ca+=M.length};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,e,c){var f=Math.sqrt(b*b+e*e+c*c);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,e/f,c/f)))-1}function e(b,e,c,f){f.faces.push(new THREE.Face3(b,e,c))}function f(b,e){var f=h.vertices[b].position,k=h.vertices[e].position;return c((f.x+k.x)/2,(f.y+k.y)/2,(f.z+k.z)/2)}var h=this,k=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,k);e(0,5,1,k);e(0,1,7,k);e(0,7,10,k);e(0,10,11,k);e(1,5,9,k);e(5,11,4,k);e(11,10,2,k);e(10,7,6,k);e(7,1,8,k);e(3,9,4,k);e(3,4,2,k);e(3,2,6,k);e(3,6,8,k);e(3,8,9,k);e(4,9,5,k);e(2,4,11,k);e(6,2,10,k);e(8,6,7,k);e(9,8,1,k);for(var m=0;m<this.subdivisions;m++){var b=new THREE.Geometry,n;for(n in k.faces){var p=f(k.faces[n].a,k.faces[n].b),u=f(k.faces[n].b,k.faces[n].c),v=f(k.faces[n].c,k.faces[n].a);e(k.faces[n].a,p,v,b);e(k.faces[n].b,u,
-p,b);e(k.faces[n].c,v,u,b);e(p,u,v,b)}k.faces=b.faces}h.faces=k.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+-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,k);e(0,5,1,k);e(0,1,7,k);e(0,7,10,k);e(0,10,11,k);e(1,5,9,k);e(5,11,4,k);e(11,10,2,k);e(10,7,6,k);e(7,1,8,k);e(3,9,4,k);e(3,4,2,k);e(3,2,6,k);e(3,6,8,k);e(3,8,9,k);e(4,9,5,k);e(2,4,11,k);e(6,2,10,k);e(8,6,7,k);e(9,8,1,k);for(var m=0;m<this.subdivisions;m++){var b=new THREE.Geometry,n;for(n in k.faces){var p=f(k.faces[n].a,k.faces[n].b),t=f(k.faces[n].b,k.faces[n].c),w=f(k.faces[n].c,k.faces[n].a);e(k.faces[n].a,p,w,b);e(k.faces[n].b,t,
+p,b);e(k.faces[n].c,w,t,b);e(p,t,w,b)}k.faces=b.faces}h.faces=k.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=[],h=[],k=[],m=(new THREE.Matrix4).setRotationZ(c),n=0;n<b.length;n++)this.vertices.push(new THREE.Vertex(b[n])),e[n]=b[n].clone(),f[n]=this.vertices.length-1;for(var p=0;p<=this.angle+0.0010;p+=c){for(n=0;n<e.length;n++)p<this.angle?(e[n]=m.multiplyVector3(e[n].clone()),this.vertices.push(new THREE.Vertex(e[n])),h[n]=this.vertices.length-1):h=k;p==0&&(k=f);
 for(n=0;n<f.length-1;n++)this.faces.push(new THREE.Face4(h[n],h[n+1],f[n+1],f[n])),this.faceVertexUvs[0].push([new THREE.UV(1-p/this.angle,n/b.length),new THREE.UV(1-p/this.angle,(n+1)/b.length),new THREE.UV(1-(p-c)/this.angle,(n+1)/b.length),new THREE.UV(1-(p-c)/this.angle,n/b.length)]);f=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(b,c){function e(e){var c=e.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(b));c.index=m.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(e.z,-e.x)/2/Math.PI+0.5,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+0.5);return c}function f(b,e,c,n){n<1?(n=new THREE.Face3(b.index,e.index,c.index,[b.position,e.position,c.position]),n.centroid.addSelf(b.position).addSelf(e.position).addSelf(c.position).divideScalar(3),n.normal=n.centroid.clone().normalize(),
 m.faces.push(n),n=Math.atan2(n.centroid.z,-n.centroid.x),m.faceVertexUvs[0].push([k(b.uv,b.position,n),k(e.uv,e.position,n),k(c.uv,c.position,n)])):(n-=1,f(b,h(b,e),h(b,c),n),f(h(b,e),e,h(e,c),n),f(h(b,c),h(e,c),c,n),f(h(b,e),h(e,c),h(b,c),n))}function h(b,c){n[b.index]||(n[b.index]=[]);n[c.index]||(n[c.index]=[]);var f=n[b.index][c.index];f===void 0&&(n[b.index][c.index]=n[c.index][b.index]=f=e((new THREE.Vector3).add(b.position,c.position).divideScalar(2)));return f}function k(b,e,c){c<0&&b.u===
 1&&(b=new THREE.UV(b.u-1,b.v));e.x===0&&e.z===0&&(b=new THREE.UV(c/2/Math.PI+0.5,b.v));return b}THREE.Geometry.call(this);var c=isFinite(c)?c:3,m=this;e(new THREE.Vector3(1,0,0));e(new THREE.Vector3(-1,0,0));e(new THREE.Vector3(0,1,0));e(new THREE.Vector3(0,-1,0));e(new THREE.Vector3(0,0,1));e(new THREE.Vector3(0,0,-1));var n=[],p=this.vertices;f(p[0],p[2],p[4],c);f(p[0],p[4],p[3],c);f(p[0],p[3],p[5],c);f(p[0],p[5],p[2],c);f(p[1],p[2],p[5],c);f(p[1],p[5],p[3],c);f(p[1],p[3],p[4],c);f(p[1],p[4],p[2],
 c);this.boundingSphere={radius:b}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var h,k=b/2,m=c/2,e=e||1,f=f||1,n=e+1,p=f+1;b/=e;var u=c/f;for(h=0;h<p;h++)for(c=0;c<n;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-k,-(h*u-m),0)));for(h=0;h<f;h++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+n*h,c+n*(h+1),c+1+n*(h+1),c+1+n*h)),this.faceVertexUvs[0].push([new THREE.UV(c/e,h/f),new THREE.UV(c/e,(h+1)/f),new THREE.UV((c+1)/e,(h+1)/f),new THREE.UV((c+1)/e,h/f)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var h,k=b/2,m=c/2,e=e||1,f=f||1,n=e+1,p=f+1;b/=e;var t=c/f;for(h=0;h<p;h++)for(c=0;c<n;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-k,-(h*t-m),0)));for(h=0;h<f;h++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+n*h,c+n*(h+1),c+1+n*(h+1),c+1+n*h)),this.faceVertexUvs[0].push([new THREE.UV(c/e,h/f),new THREE.UV(c/e,(h+1)/f),new THREE.UV((c+1)/e,(h+1)/f),new THREE.UV((c+1)/e,h/f)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,h=Math.PI,k=Math.max(3,c||8),m=Math.max(2,e||6),c=[],e=0;e<m+1;e++){f=e/m;var n=b*Math.cos(f*h),p=b*Math.sin(f*h),u=[],v=0;for(f=0;f<k;f++){var t=2*f/k,w=p*Math.sin(t*h),t=p*Math.cos(t*h);(e==0||e==m)&&f>0||(v=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,n,w)))-1);u.push(v)}c.push(u)}for(var x,y,z,h=c.length,e=0;e<h;e++)if(k=c[e].length,e>0)for(f=0;f<k;f++){u=f==k-1;m=c[e][u?0:f+1];n=c[e][u?k-1:f];p=c[e-1][u?
-k-1:f];u=c[e-1][u?0:f+1];w=e/(h-1);x=(e-1)/(h-1);y=(f+1)/k;var t=f/k,v=new THREE.UV(1-y,w),w=new THREE.UV(1-t,w),t=new THREE.UV(1-t,x),A=new THREE.UV(1-y,x);e<c.length-1&&(x=this.vertices[m].position.clone(),y=this.vertices[n].position.clone(),z=this.vertices[p].position.clone(),x.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(m,n,p,[new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([v,w,t]));e>1&&(x=
-this.vertices[m].position.clone(),y=this.vertices[p].position.clone(),z=this.vertices[u].position.clone(),x.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(m,p,u,[new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([v,t,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,h=Math.PI,k=Math.max(3,c||8),m=Math.max(2,e||6),c=[],e=0;e<m+1;e++){f=e/m;var n=b*Math.cos(f*h),p=b*Math.sin(f*h),t=[],w=0;for(f=0;f<k;f++){var u=2*f/k,x=p*Math.sin(u*h),u=p*Math.cos(u*h);(e==0||e==m)&&f>0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,n,x)))-1);t.push(w)}c.push(t)}for(var v,A,z,h=c.length,e=0;e<h;e++)if(k=c[e].length,e>0)for(f=0;f<k;f++){t=f==k-1;m=c[e][t?0:f+1];n=c[e][t?k-1:f];p=c[e-1][t?
+k-1:f];t=c[e-1][t?0:f+1];x=e/(h-1);v=(e-1)/(h-1);A=(f+1)/k;var u=f/k,w=new THREE.UV(1-A,x),x=new THREE.UV(1-u,x),u=new THREE.UV(1-u,v),y=new THREE.UV(1-A,v);e<c.length-1&&(v=this.vertices[m].position.clone(),A=this.vertices[n].position.clone(),z=this.vertices[p].position.clone(),v.normalize(),A.normalize(),z.normalize(),this.faces.push(new THREE.Face3(m,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,x,u]));e>1&&(v=
+this.vertices[m].position.clone(),A=this.vertices[p].position.clone(),z=this.vertices[t].position.clone(),v.normalize(),A.normalize(),z.normalize(),this.faces.push(new THREE.Face3(m,p,t,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,u,y]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var f=e[e.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(f/2,120),new THREE.Vector2(f,0))}THREE.ExtrudeGeometry.call(this,e,c)};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(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,h=String(b).split(""),k=h.length,m=[],b=0;b<k;b++){var n=new THREE.Path,n=this.extractGlyphPoints(h[b],c,e,f,n);f+=n.offset;m.push(n.path)}return{paths:m,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var k=[],m,n,p,u,v,t,w,x,y,z,A=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));p=c.length;for(b=0;b<p;)switch(n=c[b++],n){case "m":n=c[b++]*e+f;u=c[b++]*e;k.push(new THREE.Vector2(n,
-u));h.moveTo(n,u);break;case "l":n=c[b++]*e+f;u=c[b++]*e;k.push(new THREE.Vector2(n,u));h.lineTo(n,u);break;case "q":n=c[b++]*e+f;u=c[b++]*e;w=c[b++]*e+f;x=c[b++]*e;h.quadraticCurveTo(w,x,n,u);if(m=k[k.length-1]){v=m.x;t=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++){var E=m/divisions,F=THREE.Shape.Utils.b2(E,v,w,n),E=THREE.Shape.Utils.b2(E,t,x,u);k.push(new THREE.Vector2(F,E))}}break;case "b":if(n=c[b++]*e+f,u=c[b++]*e,w=c[b++]*e+f,x=c[b++]*-e,y=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(n,u,
-w,x,y,z),m=k[k.length-1]){v=m.x;t=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)E=m/divisions,F=THREE.Shape.Utils.b3(E,v,w,y,n),E=THREE.Shape.Utils.b3(E,t,x,z,u),k.push(new THREE.Vector2(F,E))}}}return{offset:A.ha*e,points:k,path:h}}}};
-(function(b){var c=function(b){for(var c=b.length,h=0,k=c-1,m=0;m<c;k=m++)h+=b[k].x*b[m].y-b[m].x*b[k].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var k=[],m=[],n=[],p,u,v;if(c(b)>0)for(u=0;u<h;u++)m[u]=u;else for(u=0;u<h;u++)m[u]=h-1-u;var t=2*h;for(u=h-1;h>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}p=u;h<=p&&(p=0);u=p+1;h<=u&&(u=0);v=u+1;h<=v&&(v=0);var w;a:{w=b;var x=p,y=u,z=v,A=h,E=m,F=void 0,D=void 0,H=void 0,
-L=void 0,M=void 0,K=void 0,G=void 0,B=void 0,da=void 0,D=w[E[x]].x,H=w[E[x]].y,L=w[E[y]].x,M=w[E[y]].y,K=w[E[z]].x,G=w[E[z]].y;if(1.0E-10>(L-D)*(G-H)-(M-H)*(K-D))w=!1;else{for(F=0;F<A;F++)if(!(F==x||F==y||F==z)){var B=w[E[F]].x,da=w[E[F]].y,J=void 0,Q=void 0,R=void 0,Y=void 0,W=void 0,o=void 0,ea=void 0,P=void 0,ma=void 0,Z=void 0,ia=void 0,aa=void 0,J=R=W=void 0,J=K-L,Q=G-M,R=D-K,Y=H-G,W=L-D,o=M-H,ea=B-D,P=da-H,ma=B-L,Z=da-M,ia=B-K,aa=da-G,J=J*Z-Q*ma,W=W*P-o*ea,R=R*aa-Y*ia;if(J>=0&&R>=0&&W>=0){w=
-!1;break a}}w=!0}}if(w){k.push([b[m[p]],b[m[u]],b[m[v]]]);n.push([m[p],m[u],m[v]]);p=u;for(v=u+1;v<h;p++,v++)m[p]=m[v];h--;t=2*h}}if(f)return n;return k};b.Triangulate.area=c;return b})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),k=h.length,m=[],b=0;b<k;b++){var n=new THREE.Path,n=this.extractGlyphPoints(h[b],c,e,f,n);f+=n.offset;m.push(n.path)}return{paths:m,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var k=[],m,n,p,t,w,u,x,v,A,z,y=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));p=c.length;for(b=0;b<p;)switch(n=c[b++],n){case "m":n=c[b++]*e+f;t=c[b++]*e;k.push(new THREE.Vector2(n,
+t));h.moveTo(n,t);break;case "l":n=c[b++]*e+f;t=c[b++]*e;k.push(new THREE.Vector2(n,t));h.lineTo(n,t);break;case "q":n=c[b++]*e+f;t=c[b++]*e;x=c[b++]*e+f;v=c[b++]*e;h.quadraticCurveTo(x,v,n,t);if(m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++){var D=m/divisions,F=THREE.Shape.Utils.b2(D,w,x,n),D=THREE.Shape.Utils.b2(D,u,v,t);k.push(new THREE.Vector2(F,D))}}break;case "b":if(n=c[b++]*e+f,t=c[b++]*e,x=c[b++]*e+f,v=c[b++]*-e,A=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(n,t,
+x,v,A,z),m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)D=m/divisions,F=THREE.Shape.Utils.b3(D,w,x,A,n),D=THREE.Shape.Utils.b3(D,u,v,z,t),k.push(new THREE.Vector2(F,D))}}}return{offset:y.ha*e,points:k,path:h}}}};
+(function(b){var c=function(b){for(var c=b.length,h=0,k=c-1,m=0;m<c;k=m++)h+=b[k].x*b[m].y-b[m].x*b[k].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var k=[],m=[],n=[],p,t,w;if(c(b)>0)for(t=0;t<h;t++)m[t]=t;else for(t=0;t<h;t++)m[t]=h-1-t;var u=2*h;for(t=h-1;h>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}p=t;h<=p&&(p=0);t=p+1;h<=t&&(t=0);w=t+1;h<=w&&(w=0);var x;a:{x=b;var v=p,A=t,z=w,y=h,D=m,F=void 0,E=void 0,H=void 0,
+L=void 0,M=void 0,K=void 0,G=void 0,B=void 0,da=void 0,E=x[D[v]].x,H=x[D[v]].y,L=x[D[A]].x,M=x[D[A]].y,K=x[D[z]].x,G=x[D[z]].y;if(1.0E-10>(L-E)*(G-H)-(M-H)*(K-E))x=!1;else{for(F=0;F<y;F++)if(!(F==v||F==A||F==z)){var B=x[D[F]].x,da=x[D[F]].y,J=void 0,Q=void 0,R=void 0,Y=void 0,W=void 0,o=void 0,ea=void 0,P=void 0,ma=void 0,Z=void 0,ia=void 0,aa=void 0,J=R=W=void 0,J=K-L,Q=G-M,R=E-K,Y=H-G,W=L-E,o=M-H,ea=B-E,P=da-H,ma=B-L,Z=da-M,ia=B-K,aa=da-G,J=J*Z-Q*ma,W=W*P-o*ea,R=R*aa-Y*ia;if(J>=0&&R>=0&&W>=0){x=
+!1;break a}}x=!0}}if(x){k.push([b[m[p]],b[m[t]],b[m[w]]]);n.push([m[p],m[t],m[w]]);p=t;for(w=t+1;w<h;p++,w++)m[p]=m[w];h--;u=2*h}}if(f)return n;return k};b.Triangulate.area=c;return b})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(b,c,e,f,h){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=h||Math.PI*2;h=new THREE.Vector3;b=[];c=[];for(e=0;e<=this.segmentsR;e++)for(f=0;f<=this.segmentsT;f++){var k=f/this.segmentsT*this.arc,m=e/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(k);h.y=this.radius*Math.sin(k);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(m))*Math.cos(k);n.y=(this.radius+this.tube*Math.cos(m))*Math.sin(k);n.z=
 this.tube*Math.sin(m);this.vertices.push(new THREE.Vertex(n));b.push(new THREE.UV(f/this.segmentsT,1-e/this.segmentsR));c.push(n.clone().subSelf(h).normalize())}for(e=1;e<=this.segmentsR;e++)for(f=1;f<=this.segmentsT;f++){var h=(this.segmentsT+1)*e+f-1,k=(this.segmentsT+1)*(e-1)+f-1,m=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,p=new THREE.Face4(h,k,m,n,[c[h],c[k],c[m],c[n]]);p.normal.addSelf(c[h]);p.normal.addSelf(c[k]);p.normal.addSelf(c[m]);p.normal.addSelf(c[n]);p.normal.normalize();this.faces.push(p);
 this.faceVertexUvs[0].push([b[h].clone(),b[k].clone(),b[m].clone(),b[n].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(b,c,e,f,h,k,m){function n(b,e,c,f,h,k){e=c/f*b;c=Math.cos(e);return new THREE.Vector3(h*(2+c)*0.5*Math.cos(b),h*(2+c)*Math.sin(b)*0.5,k*h*Math.sin(e)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=h||2;this.q=k||3;this.heightScale=m||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;k=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
 this.segmentsT;++c){var p=b/this.segmentsR*2*this.p*Math.PI,m=c/this.segmentsT*2*Math.PI,h=n(p,m,this.q,this.p,this.radius,this.heightScale),p=n(p+0.01,m,this.q,this.p,this.radius,this.heightScale);e.x=p.x-h.x;e.y=p.y-h.y;e.z=p.z-h.z;f.x=p.x+h.x;f.y=p.y+h.y;f.z=p.z+h.z;k.cross(e,f);f.cross(k,e);k.normalize();f.normalize();p=-this.tube*Math.cos(m);m=this.tube*Math.sin(m);h.x+=p*f.x+m*k.x;h.y+=p*f.y+m*k.y;h.z+=p*f.z+m*k.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(h.x,h.y,
-h.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,k=(c+1)%this.segmentsT,h=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][k],k=this.grid[b][k],m=new THREE.UV(b/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),u=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),v=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(h,e,f,k));this.faceVertexUvs[0].push([m,p,u,v])}this.computeCentroids();
+h.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,k=(c+1)%this.segmentsT,h=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][k],k=this.grid[b][k],m=new THREE.UV(b/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),t=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),w=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(h,e,f,k));this.faceVertexUvs[0].push([m,p,t,w])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(b){this.subdivisions=b===void 0?1:b;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(b){for(var c=this.subdivisions;c--;)this.smooth(b)};
-THREE.SubdivisionModifier.prototype.smooth=function(b){function c(b,e,c,f,n){var p=new THREE.Face4(b,e,c,f,null,n.color,n.material);if(m.useOldVertexColors)p.vertexColors=n.vertexColors;h.push(p);(!m.supportUVs||t.length!=0)&&k.push([t[b],t[e],t[c],t[f]])}function e(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}var f=[],h=[],k=[],m=this,n=b.vertices,f=b.faces,p=n.concat(),u=[],v={},t=[],w,x,y,z,A,E=b.faceVertexUvs[0];w=0;for(x=E.length;w<x;w++){y=0;for(z=E[w].length;y<z;y++)A=f[w]["abcd".charAt(y)],
-t[A]||(t[A]=E[w][y])}var F;w=0;for(x=f.length;w<x;w++)if(A=f[w],u.push(A.centroid),p.push(new THREE.Vertex(A.centroid)),m.supportUVs&&t.length!=0){F=new THREE.UV;if(A instanceof THREE.Face3)F.u=t[A.a].u+t[A.b].u+t[A.c].u,F.v=t[A.a].v+t[A.b].v+t[A.c].v,F.u/=3,F.v/=3;else if(A instanceof THREE.Face4)F.u=t[A.a].u+t[A.b].u+t[A.c].u+t[A.d].u,F.v=t[A.a].v+t[A.b].v+t[A.c].v+t[A.d].v,F.u/=4,F.v/=4;t.push(F)}z=function(b){function c(b,e,f){b[e]===void 0&&(b[e]=[]);b[e].push(f)}var f,h,k,m,n={};f=0;for(h=b.faces.length;f<
-h;f++)k=b.faces[f],k instanceof THREE.Face3?(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.a),c(n,m,f)):k instanceof THREE.Face4&&(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.d),c(n,m,f),m=e(k.d,k.a),c(n,m,f));return n}(b);var D,H,L=0,E=n.length,M;for(w in z)if(A=z[w],F=A[0],D=A[1],H=new THREE.Vector3,A.length!=2)console.log("warning, edge fail",A);else if(H.addSelf(u[F]),H.addSelf(u[D]),M=w.split("_"),x=M[0],M=M[1],H.addSelf(n[x].position),H.addSelf(n[M].position),H.multiplyScalar(0.25),
-v[w]=E+f.length+L,p.push(new THREE.Vertex(H)),L++,m.supportUVs&&t.length!=0)F=new THREE.UV,F.u=t[x].u+t[M].u,F.v=t[x].v+t[M].v,F.u/=2,F.v/=2,t.push(F);w=0;for(x=u.length;w<x;w++)A=f[w],M=E+w,A instanceof THREE.Face3?(F=e(A.a,A.b),D=e(A.b,A.c),L=e(A.c,A.a),c(M,v[F],A.b,v[D],A),c(M,v[D],A.c,v[L],A),c(M,v[L],A.a,v[F],A)):A instanceof THREE.Face4?(F=e(A.a,A.b),D=e(A.b,A.c),L=e(A.c,A.d),H=e(A.d,A.a),c(M,v[F],A.b,v[D],A),c(M,v[D],A.c,v[L],A),c(M,v[L],A.d,v[H],A),c(M,v[H],A.a,v[F],A)):console.log("face should be a face!",
-A);var f=p,K={},G={},p=function(b,e){K[b]===void 0&&(K[b]=[]);K[b].push(e)},v=function(b,e){G[b]===void 0&&(G[b]={});G[b][e]=null};for(w in z)A=z[w],M=w.split("_"),x=M[0],M=M[1],p(x,[x,M]),p(M,[x,M]),F=A[0],D=A[1],v(x,F),v(x,D),v(M,F),v(M,D);p=new THREE.Vector3;v=new THREE.Vector3;w=0;for(x=n.length;w<x;w++)if(K[w]!==void 0){p.set(0,0,0);v.set(0,0,0);z=new THREE.Vector3(0,0,0);E=0;for(y in G[w])p.addSelf(u[y]),E++;p.divideScalar(E);E=K[w].length;for(y=0;y<E;y++)A=K[w][y],A=n[A[0]].position.clone().addSelf(n[A[1]].position).divideScalar(2),
-v.addSelf(A);v.divideScalar(E);z.addSelf(n[w].position);z.multiplyScalar(E-3);z.addSelf(p);z.addSelf(v.multiplyScalar(2));z.divideScalar(E);f[w].position=z}b.vertices=f;b.faces=h;b.faceVertexUvs[0]=k;delete b.__tmpVertices;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals()};THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+THREE.SubdivisionModifier.prototype.smooth=function(b){function c(b,e,c,f,n){var t=new THREE.Face4(b,e,c,f,null,n.color,n.material);if(m.useOldVertexColors)t.vertexColors=n.vertexColors;h.push(t);(!m.supportUVs||u.length!=0)&&k.push([u[b],u[e],u[c],u[f]])}function e(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}var f=[],h=[],k=[],m=this,n=b.vertices,f=b.faces,p=n.concat(),t=[],w={},u=[],x,v,A,z,y,D=b.faceVertexUvs[0];x=0;for(v=D.length;x<v;x++){A=0;for(z=D[x].length;A<z;A++)y=f[x]["abcd".charAt(A)],
+u[y]||(u[y]=D[x][A])}var F;x=0;for(v=f.length;x<v;x++)if(y=f[x],t.push(y.centroid),p.push(new THREE.Vertex(y.centroid)),m.supportUVs&&u.length!=0){F=new THREE.UV;if(y instanceof THREE.Face3)F.u=u[y.a].u+u[y.b].u+u[y.c].u,F.v=u[y.a].v+u[y.b].v+u[y.c].v,F.u/=3,F.v/=3;else if(y instanceof THREE.Face4)F.u=u[y.a].u+u[y.b].u+u[y.c].u+u[y.d].u,F.v=u[y.a].v+u[y.b].v+u[y.c].v+u[y.d].v,F.u/=4,F.v/=4;u.push(F)}z=function(b){function c(b,e,f){b[e]===void 0&&(b[e]=[]);b[e].push(f)}var f,h,k,m,n={};f=0;for(h=b.faces.length;f<
+h;f++)k=b.faces[f],k instanceof THREE.Face3?(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.a),c(n,m,f)):k instanceof THREE.Face4&&(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.d),c(n,m,f),m=e(k.d,k.a),c(n,m,f));return n}(b);var E,H,L=0,D=n.length,M;for(x in z)if(y=z[x],F=y[0],E=y[1],H=new THREE.Vector3,y.length!=2)console.log("warning, edge fail",y);else if(H.addSelf(t[F]),H.addSelf(t[E]),M=x.split("_"),v=M[0],M=M[1],H.addSelf(n[v].position),H.addSelf(n[M].position),H.multiplyScalar(0.25),
+w[x]=D+f.length+L,p.push(new THREE.Vertex(H)),L++,m.supportUVs&&u.length!=0)F=new THREE.UV,F.u=u[v].u+u[M].u,F.v=u[v].v+u[M].v,F.u/=2,F.v/=2,u.push(F);x=0;for(v=t.length;x<v;x++)y=f[x],M=D+x,y instanceof THREE.Face3?(F=e(y.a,y.b),E=e(y.b,y.c),L=e(y.c,y.a),c(M,w[F],y.b,w[E],y),c(M,w[E],y.c,w[L],y),c(M,w[L],y.a,w[F],y)):y instanceof THREE.Face4?(F=e(y.a,y.b),E=e(y.b,y.c),L=e(y.c,y.d),H=e(y.d,y.a),c(M,w[F],y.b,w[E],y),c(M,w[E],y.c,w[L],y),c(M,w[L],y.d,w[H],y),c(M,w[H],y.a,w[F],y)):console.log("face should be a face!",
+y);var f=p,K={},G={},p=function(b,e){K[b]===void 0&&(K[b]=[]);K[b].push(e)},w=function(b,e){G[b]===void 0&&(G[b]={});G[b][e]=null};for(x in z)y=z[x],M=x.split("_"),v=M[0],M=M[1],p(v,[v,M]),p(M,[v,M]),F=y[0],E=y[1],w(v,F),w(v,E),w(M,F),w(M,E);p=new THREE.Vector3;w=new THREE.Vector3;x=0;for(v=n.length;x<v;x++)if(K[x]!==void 0){p.set(0,0,0);w.set(0,0,0);z=new THREE.Vector3(0,0,0);D=0;for(A in G[x])p.addSelf(t[A]),D++;p.divideScalar(D);D=K[x].length;for(A=0;A<D;A++)y=K[x][A],y=n[y[0]].position.clone().addSelf(n[y[1]].position).divideScalar(2),
+w.addSelf(y);w.divideScalar(D);z.addSelf(n[x].position);z.multiplyScalar(D-3);z.addSelf(p);z.addSelf(w.multiplyScalar(2));z.divideScalar(D);f[x].position=z}b.vertices=f;b.faces=h;b.faceVertexUvs[0]=k;delete b.__tmpVertices;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals()};THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.length<1?".":b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==
-b}function f(b,c){var f=new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function h(b,e,k,h,m,n){var p=document.createElement("canvas");b[e]=new THREE.Texture(p);b[e].sourceFile=k;if(h){b[e].repeat.set(h[0],h[1]);if(h[0]!=1)b[e].wrapS=THREE.RepeatWrapping;
+b}function f(b,c){var f=new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function h(b,e,k,h,m,n){var t=document.createElement("canvas");b[e]=new THREE.Texture(t);b[e].sourceFile=k;if(h){b[e].repeat.set(h[0],h[1]);if(h[0]!=1)b[e].wrapS=THREE.RepeatWrapping;
 if(h[1]!=1)b[e].wrapT=THREE.RepeatWrapping}m&&b[e].offset.set(m[0],m[1]);if(n){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[n[0]]!==void 0)b[e].wrapS=h[n[0]];if(h[n[1]]!==void 0)b[e].wrapT=h[n[1]]}f(b[e],c+"/"+k)}function k(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var m,n,p;n="MeshLambertMaterial";m={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?n="MeshPhongMaterial":b.shading=="Basic"&&(n="MeshBasicMaterial"));
 if(b.blending)if(b.blending=="Additive")m.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")m.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")m.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)m.transparent=b.transparent;if(b.depthTest!==void 0)m.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")m.vertexColors=THREE.FaceColors;else if(b.vertexColors)m.vertexColors=THREE.VertexColors;if(b.colorDiffuse)m.color=k(b.colorDiffuse);
 else if(b.DbgColor)m.color=b.DbgColor;if(b.colorSpecular)m.specular=k(b.colorSpecular);if(b.colorAmbient)m.ambient=k(b.colorAmbient);if(b.transparency)m.opacity=b.transparency;if(b.specularCoef)m.shininess=b.specularCoef;b.mapDiffuse&&c&&h(m,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&h(m,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&h(m,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
-b.mapSpecular&&c&&h(m,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var u=THREE.ShaderUtils.lib.normal,v=THREE.UniformsUtils.clone(u.uniforms),t=m.color;n=m.specular;p=m.ambient;var w=m.shininess;v.tNormal.texture=m.normalMap;if(b.mapNormalFactor)v.uNormalScale.value=b.mapNormalFactor;if(m.map)v.tDiffuse.texture=m.map,v.enableDiffuse.value=!0;if(m.specularMap)v.tSpecular.texture=m.specularMap,v.enableSpecular.value=!0;if(m.lightMap)v.tAO.texture=
-m.lightMap,v.enableAO.value=!0;v.uDiffuseColor.value.setHex(t);v.uSpecularColor.value.setHex(n);v.uAmbientColor.value.setHex(p);v.uShininess.value=w;if(m.opacity)v.uOpacity.value=m.opacity;m=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:v,lights:!0,fog:!0})}else m=new THREE[n](m);return m}};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+b.mapSpecular&&c&&h(m,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var t=THREE.ShaderUtils.lib.normal,w=THREE.UniformsUtils.clone(t.uniforms),u=m.color;n=m.specular;p=m.ambient;var x=m.shininess;w.tNormal.texture=m.normalMap;if(b.mapNormalFactor)w.uNormalScale.value=b.mapNormalFactor;if(m.map)w.tDiffuse.texture=m.map,w.enableDiffuse.value=!0;if(m.specularMap)w.tSpecular.texture=m.specularMap,w.enableSpecular.value=!0;if(m.lightMap)w.tAO.texture=
+m.lightMap,w.enableAO.value=!0;w.uDiffuseColor.value.setHex(u);w.uSpecularColor.value.setHex(n);w.uAmbientColor.value.setHex(p);w.uShininess.value=x;if(m.opacity)w.uOpacity.value=m.opacity;m=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:w,lights:!0,fog:!0})}else m=new THREE[n](m);return m}};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),h=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),k=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,h,f,k)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
 c.postMessage(b)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,k){var m=new XMLHttpRequest,n=f+"/"+b,p=0;m.onreadystatechange=function(){m.readyState==4?m.status==200||m.status==0?THREE.BinaryLoader.prototype.createBinModel(m.responseText,e,h,c):alert("Couldn't load ["+n+"] ["+m.status+"]"):m.readyState==3?k&&(p==0&&(p=m.getResponseHeader("Content-Length")),k({total:p,loaded:m.responseText.length})):m.readyState==2&&(p=m.getResponseHeader("Content-Length"))};m.open("GET",n,!0);m.overrideMimeType("text/plain; charset=x-user-defined");
 m.setRequestHeader("Content-Type","text/plain");m.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(e){function c(b,e){var f=v(b,e),h=v(b,e+1),k=v(b,e+2),m=v(b,e+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,e){var c=v(b,e),f=v(b,e+1),k=v(b,e+2);return(v(b,e+3)<<24)+(k<<16)+(f<<8)+c}function p(b,e){var c=v(b,e);return(v(b,e+1)<<8)+c}function u(b,e){var c=v(b,e);return c>127?c-256:c}function v(b,e){return b.charCodeAt(e)&255}function t(e){var c,
-f,k;c=h(b,e);f=h(b,e+M);k=h(b,e+K);e=p(b,e+G);E.faces.push(new THREE.Face3(c,f,k,null,null,E.materials[e]))}function w(e){var c,f,k,m,o,t;c=h(b,e);f=h(b,e+M);k=h(b,e+K);m=p(b,e+G);o=h(b,e+B);t=h(b,e+da);e=h(b,e+J);m=E.materials[m];var u=H[t*3],v=H[t*3+1];t=H[t*3+2];var w=H[e*3],x=H[e*3+1],e=H[e*3+2];E.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(u,v,t),new THREE.Vector3(w,x,e)],null,m))}function x(e){var c,f,k,m;c=h(b,e);f=h(b,e+Q);k=h(b,e+R);m=h(b,
-e+Y);e=p(b,e+W);E.faces.push(new THREE.Face4(c,f,k,m,null,null,E.materials[e]))}function y(e){var c,f,k,m,t,u,v,w;c=h(b,e);f=h(b,e+Q);k=h(b,e+R);m=h(b,e+Y);t=p(b,e+W);u=h(b,e+o);v=h(b,e+ea);w=h(b,e+P);e=h(b,e+ma);t=E.materials[t];var x=H[v*3],U=H[v*3+1];v=H[v*3+2];var y=H[w*3],N=H[w*3+1];w=H[w*3+2];var z=H[e*3],A=H[e*3+1],e=H[e*3+2];E.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(H[u*3],H[u*3+1],H[u*3+2]),new THREE.Vector3(x,U,v),new THREE.Vector3(y,N,w),new THREE.Vector3(z,A,e)],null,t))}
-function z(e){var c,f,k,m;c=h(b,e);f=h(b,e+Z);k=h(b,e+ia);e=L[c*2];m=L[c*2+1];c=L[f*2];var o=E.faceVertexUvs[0];f=L[f*2+1];var p=L[k*2];k=L[k*2+1];var t=[];t.push(new THREE.UV(e,m));t.push(new THREE.UV(c,f));t.push(new THREE.UV(p,k));o.push(t)}function A(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+aa);k=h(b,e+ka);m=h(b,e+fa);e=L[c*2];o=L[c*2+1];c=L[f*2];p=L[f*2+1];f=L[k*2];var t=E.faceVertexUvs[0];k=L[k*2+1];var u=L[m*2];m=L[m*2+1];var v=[];v.push(new THREE.UV(e,o));v.push(new THREE.UV(c,p));v.push(new THREE.UV(f,
-k));v.push(new THREE.UV(u,m));t.push(v)}var E=this,F=0,D,H=[],L=[],M,K,G,B,da,J,Q,R,Y,W,o,ea,P,ma,Z,ia,aa,ka,fa,ca,$,X,ga,la,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,e);D={signature:b.substr(F,8),header_bytes:v(b,F+8),vertex_coordinate_bytes:v(b,F+9),normal_coordinate_bytes:v(b,F+10),uv_coordinate_bytes:v(b,F+11),vertex_index_bytes:v(b,F+12),normal_index_bytes:v(b,F+13),uv_index_bytes:v(b,F+14),material_index_bytes:v(b,F+15),nvertices:h(b,F+16),nnormals:h(b,F+16+4),nuvs:h(b,
-F+16+8),ntri_flat:h(b,F+16+12),ntri_smooth:h(b,F+16+16),ntri_flat_uv:h(b,F+16+20),ntri_smooth_uv:h(b,F+16+24),nquad_flat:h(b,F+16+28),nquad_smooth:h(b,F+16+32),nquad_flat_uv:h(b,F+16+36),nquad_smooth_uv:h(b,F+16+40)};F+=D.header_bytes;M=D.vertex_index_bytes;K=D.vertex_index_bytes*2;G=D.vertex_index_bytes*3;B=D.vertex_index_bytes*3+D.material_index_bytes;da=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;J=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;Q=D.vertex_index_bytes;
-R=D.vertex_index_bytes*2;Y=D.vertex_index_bytes*3;W=D.vertex_index_bytes*4;o=D.vertex_index_bytes*4+D.material_index_bytes;ea=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;P=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;ma=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;Z=D.uv_index_bytes;ia=D.uv_index_bytes*2;aa=D.uv_index_bytes;ka=D.uv_index_bytes*2;fa=D.uv_index_bytes*3;e=D.vertex_index_bytes*3+D.material_index_bytes;ra=D.vertex_index_bytes*
-4+D.material_index_bytes;ca=D.ntri_flat*e;$=D.ntri_smooth*(e+D.normal_index_bytes*3);X=D.ntri_flat_uv*(e+D.uv_index_bytes*3);ga=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);la=D.nquad_flat*ra;e=D.nquad_smooth*(ra+D.normal_index_bytes*4);ra=D.nquad_flat_uv*(ra+D.uv_index_bytes*4);F+=function(e){for(var f,h,k,n=D.vertex_coordinate_bytes*3,o=e+D.nvertices*n;e<o;e+=n)f=c(b,e),h=c(b,e+D.vertex_coordinate_bytes),k=c(b,e+D.vertex_coordinate_bytes*2),E.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
-h,k)));return D.nvertices*n}(F);F+=function(e){for(var c,f,h,k=D.normal_coordinate_bytes*3,m=e+D.nnormals*k;e<m;e+=k)c=u(b,e),f=u(b,e+D.normal_coordinate_bytes),h=u(b,e+D.normal_coordinate_bytes*2),H.push(c/127,f/127,h/127);return D.nnormals*k}(F);F+=function(e){for(var f,h,k=D.uv_coordinate_bytes*2,n=e+D.nuvs*k;e<n;e+=k)f=c(b,e),h=c(b,e+D.uv_coordinate_bytes),L.push(f,h);return D.nuvs*k}(F);ca=F+ca;$=ca+$;X=$+X;ga=X+ga;la=ga+la;e=la+e;ra=e+ra;(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,
-f=c+D.uv_index_bytes*3,h=b+D.ntri_flat_uv*f;for(e=b;e<h;e+=f)t(e),z(e+c);return h-b})($);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=c+D.uv_index_bytes*3,h=b+D.ntri_smooth_uv*f;for(e=b;e<h;e+=f)w(e),z(e+c);return h-b})(X);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=c+D.uv_index_bytes*4,h=b+D.nquad_flat_uv*f;for(e=b;e<h;e+=f)x(e),A(e+c);return h-b})(e);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*
-4,f=c+D.uv_index_bytes*4,h=b+D.nquad_smooth_uv*f;for(e=b;e<h;e+=f)y(e),A(e+c);return h-b})(ra);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,f=b+D.ntri_flat*c;for(e=b;e<f;e+=c)t(e);return f-b})(F);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=b+D.ntri_smooth*c;for(e=b;e<f;e+=c)w(e);return f-b})(ca);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=b+D.nquad_flat*c;for(e=b;e<f;e+=c)x(e);return f-b})(ga);(function(b){var e,
-c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,f=b+D.nquad_smooth*c;for(e=b;e<f;e+=c)y(e);return f-b})(la);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
+THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(e){function c(b,e){var f=w(b,e),h=w(b,e+1),k=w(b,e+2),m=w(b,e+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,e){var c=w(b,e),f=w(b,e+1),k=w(b,e+2);return(w(b,e+3)<<24)+(k<<16)+(f<<8)+c}function p(b,e){var c=w(b,e);return(w(b,e+1)<<8)+c}function t(b,e){var c=w(b,e);return c>127?c-256:c}function w(b,e){return b.charCodeAt(e)&255}function u(e){var c,
+f,k;c=h(b,e);f=h(b,e+M);k=h(b,e+K);e=p(b,e+G);D.faces.push(new THREE.Face3(c,f,k,null,null,D.materials[e]))}function x(e){var c,f,k,m,o,t;c=h(b,e);f=h(b,e+M);k=h(b,e+K);m=p(b,e+G);o=h(b,e+B);t=h(b,e+da);e=h(b,e+J);m=D.materials[m];var u=H[t*3],v=H[t*3+1];t=H[t*3+2];var w=H[e*3],x=H[e*3+1],e=H[e*3+2];D.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(u,v,t),new THREE.Vector3(w,x,e)],null,m))}function v(e){var c,f,k,m;c=h(b,e);f=h(b,e+Q);k=h(b,e+R);m=h(b,
+e+Y);e=p(b,e+W);D.faces.push(new THREE.Face4(c,f,k,m,null,null,D.materials[e]))}function A(e){var c,f,k,m,t,u,v,w;c=h(b,e);f=h(b,e+Q);k=h(b,e+R);m=h(b,e+Y);t=p(b,e+W);u=h(b,e+o);v=h(b,e+ea);w=h(b,e+P);e=h(b,e+ma);t=D.materials[t];var x=H[v*3],U=H[v*3+1];v=H[v*3+2];var y=H[w*3],N=H[w*3+1];w=H[w*3+2];var z=H[e*3],A=H[e*3+1],e=H[e*3+2];D.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(H[u*3],H[u*3+1],H[u*3+2]),new THREE.Vector3(x,U,v),new THREE.Vector3(y,N,w),new THREE.Vector3(z,A,e)],null,t))}
+function z(e){var c,f,k,m;c=h(b,e);f=h(b,e+Z);k=h(b,e+ia);e=L[c*2];m=L[c*2+1];c=L[f*2];var o=D.faceVertexUvs[0];f=L[f*2+1];var t=L[k*2];k=L[k*2+1];var p=[];p.push(new THREE.UV(e,m));p.push(new THREE.UV(c,f));p.push(new THREE.UV(t,k));o.push(p)}function y(e){var c,f,k,m,o,t;c=h(b,e);f=h(b,e+aa);k=h(b,e+ka);m=h(b,e+fa);e=L[c*2];o=L[c*2+1];c=L[f*2];t=L[f*2+1];f=L[k*2];var p=D.faceVertexUvs[0];k=L[k*2+1];var u=L[m*2];m=L[m*2+1];var v=[];v.push(new THREE.UV(e,o));v.push(new THREE.UV(c,t));v.push(new THREE.UV(f,
+k));v.push(new THREE.UV(u,m));p.push(v)}var D=this,F=0,E,H=[],L=[],M,K,G,B,da,J,Q,R,Y,W,o,ea,P,ma,Z,ia,aa,ka,fa,ca,$,X,ga,la,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(D,f,e);E={signature:b.substr(F,8),header_bytes:w(b,F+8),vertex_coordinate_bytes:w(b,F+9),normal_coordinate_bytes:w(b,F+10),uv_coordinate_bytes:w(b,F+11),vertex_index_bytes:w(b,F+12),normal_index_bytes:w(b,F+13),uv_index_bytes:w(b,F+14),material_index_bytes:w(b,F+15),nvertices:h(b,F+16),nnormals:h(b,F+16+4),nuvs:h(b,
+F+16+8),ntri_flat:h(b,F+16+12),ntri_smooth:h(b,F+16+16),ntri_flat_uv:h(b,F+16+20),ntri_smooth_uv:h(b,F+16+24),nquad_flat:h(b,F+16+28),nquad_smooth:h(b,F+16+32),nquad_flat_uv:h(b,F+16+36),nquad_smooth_uv:h(b,F+16+40)};F+=E.header_bytes;M=E.vertex_index_bytes;K=E.vertex_index_bytes*2;G=E.vertex_index_bytes*3;B=E.vertex_index_bytes*3+E.material_index_bytes;da=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes;J=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*2;Q=E.vertex_index_bytes;
+R=E.vertex_index_bytes*2;Y=E.vertex_index_bytes*3;W=E.vertex_index_bytes*4;o=E.vertex_index_bytes*4+E.material_index_bytes;ea=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes;P=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*2;ma=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*3;Z=E.uv_index_bytes;ia=E.uv_index_bytes*2;aa=E.uv_index_bytes;ka=E.uv_index_bytes*2;fa=E.uv_index_bytes*3;e=E.vertex_index_bytes*3+E.material_index_bytes;ra=E.vertex_index_bytes*
+4+E.material_index_bytes;ca=E.ntri_flat*e;$=E.ntri_smooth*(e+E.normal_index_bytes*3);X=E.ntri_flat_uv*(e+E.uv_index_bytes*3);ga=E.ntri_smooth_uv*(e+E.normal_index_bytes*3+E.uv_index_bytes*3);la=E.nquad_flat*ra;e=E.nquad_smooth*(ra+E.normal_index_bytes*4);ra=E.nquad_flat_uv*(ra+E.uv_index_bytes*4);F+=function(e){for(var f,h,k,n=E.vertex_coordinate_bytes*3,o=e+E.nvertices*n;e<o;e+=n)f=c(b,e),h=c(b,e+E.vertex_coordinate_bytes),k=c(b,e+E.vertex_coordinate_bytes*2),D.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
+h,k)));return E.nvertices*n}(F);F+=function(e){for(var c,f,h,k=E.normal_coordinate_bytes*3,m=e+E.nnormals*k;e<m;e+=k)c=t(b,e),f=t(b,e+E.normal_coordinate_bytes),h=t(b,e+E.normal_coordinate_bytes*2),H.push(c/127,f/127,h/127);return E.nnormals*k}(F);F+=function(e){for(var f,h,k=E.uv_coordinate_bytes*2,n=e+E.nuvs*k;e<n;e+=k)f=c(b,e),h=c(b,e+E.uv_coordinate_bytes),L.push(f,h);return E.nuvs*k}(F);ca=F+ca;$=ca+$;X=$+X;ga=X+ga;la=ga+la;e=la+e;ra=e+ra;(function(b){var e,c=E.vertex_index_bytes*3+E.material_index_bytes,
+f=c+E.uv_index_bytes*3,h=b+E.ntri_flat_uv*f;for(e=b;e<h;e+=f)u(e),z(e+c);return h-b})($);(function(b){var e,c=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*3,f=c+E.uv_index_bytes*3,h=b+E.ntri_smooth_uv*f;for(e=b;e<h;e+=f)x(e),z(e+c);return h-b})(X);(function(b){var e,c=E.vertex_index_bytes*4+E.material_index_bytes,f=c+E.uv_index_bytes*4,h=b+E.nquad_flat_uv*f;for(e=b;e<h;e+=f)v(e),y(e+c);return h-b})(e);(function(b){var e,c=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*
+4,f=c+E.uv_index_bytes*4,h=b+E.nquad_smooth_uv*f;for(e=b;e<h;e+=f)A(e),y(e+c);return h-b})(ra);(function(b){var e,c=E.vertex_index_bytes*3+E.material_index_bytes,f=b+E.ntri_flat*c;for(e=b;e<f;e+=c)u(e);return f-b})(F);(function(b){var e,c=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*3,f=b+E.ntri_smooth*c;for(e=b;e<f;e+=c)x(e);return f-b})(ca);(function(b){var e,c=E.vertex_index_bytes*4+E.material_index_bytes,f=b+E.nquad_flat*c;for(e=b;e<f;e+=c)v(e);return f-b})(ga);(function(b){var e,
+c=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*4,f=b+E.nquad_smooth*c;for(e=b;e<f;e+=c)A(e);return f-b})(la);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
 THREE.ColladaLoader=function(){function b(b,e,c){for(var b=ca.evaluate(b,ca,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new e).parse(h);if(h.id.length==0)h.id=c+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,e=-b,c=0,f;for(f in na)for(var h=na[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);e=Math.max(e,m.endTime);c=Math.max(c,m.input.length)}return{start:b,end:e,frames:c}}function e(b,c,f,h){b.world=b.world||
 new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=b.channels[0].sampler.output[f];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);c.push(b);for(h=0;h<b.nodes.length;h++)e(b.nodes[h],c,f,b.world)}function f(b,f,h){var k=O[f.url];if(!k||!k.skin)console.log("could not find skin controller!");else if(!f.skeleton||!f.skeleton.length)console.log("could not find the skeleton for the skin!");else{var m=c(),f=X.getChildById(f.skeleton[0],!0)||X.getChildBySid(f.skeleton[0],
-!0),n,o,p,t,u=new THREE.Vector3,v;for(n=0;n<b.vertices.length;n++)k.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(h=0;h<m.frames;h++){var w=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));e(f,w,h);n=w;o=k.skin;for(t=0;t<n.length;t++){p=n[t];v=-1;for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];
-for(y=0;y<o.weights.length;y++)for(var z=0;z<o.weights[y].length;z++){var A=o.weights[y][z];A.joint==v&&p.weights.push(A)}}else throw"could not find joint!";}for(n=0;n<w.length;n++)for(o=0;o<w[n].weights.length;o++)p=w[n].weights[o],t=p.index,p=p.weight,v=b.vertices[t],t=x[t],u.x=v.position.x,u.y=v.position.y,u.z=v.position.z,w[n].skinningMatrix.multiplyVector3(u),t.position.x+=u.x*p,t.position.y+=u.y*p,t.position.z+=u.z*p;b.morphTargets.push({name:"target_"+h,vertices:x})}}}function h(b){var e=new THREE.Object3D,
-c,k,m;e.name=b.id||"";e.matrixAutoUpdate=!1;e.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=O[b.controllers[m].url];switch(n.type){case "skin":if(oa[n.skin.source]){var o=new y;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);c=b.controllers[m]}else if(O[n.skin.source]&&(k=n=O[n.skin.source],n.morph&&oa[n.morph.source]))o=new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(oa[n.morph.source])o=
-new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),k=b.controllers[m];console.log("DAE: morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=oa[n.url],p={},t=0,u;if(n&&n.mesh&&n.mesh.primitives){if(e.name.length==0)e.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=va[qa[u.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;u=p[u.symbol]=
-v.material;t++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(t>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)t=n.faces[j],t.materials=[p[t.daeMaterial]]}if(c!==void 0)f(n,c),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=c.skeleton,o.skinController=O[c.url],o.skinInstanceController=c,o.name="skin_"+Ca.length,Ca.push(o);else if(k!==void 0){p=n;t=k instanceof w?O[k.url]:k;if(!t||!t.morph)console.log("could not find morph controller!");
-else{t=t.morph;for(v=0;v<t.targets.length;v++){var x=oa[t.targets[v]];if(x.mesh&&x.mesh.primitives&&x.mesh.primitives.length)x=x.mesh.primitives[0].geometry,x.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:x.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+Aa.length;Aa.push(o)}else o=new THREE.Mesh(n,o);e.add(o)}}for(m=0;m<b.nodes.length;m++)e.add(h(b.nodes[m],b));return e}function k(){this.init_from=
-this.id=""}function m(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function p(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function u(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function v(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function t(){this.type=
-this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function w(){this.url="";this.skeleton=[];this.instance_material=[]}function x(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function A(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function E(){}function F(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){this.source="";
+!0),n,o,t,p,u=new THREE.Vector3,v;for(n=0;n<b.vertices.length;n++)k.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(h=0;h<m.frames;h++){var w=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));e(f,w,h);n=w;o=k.skin;for(p=0;p<n.length;p++){t=n[p];v=-1;for(var y=0;y<o.joints.length;y++)if(t.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];t.invBindMatrix=y;t.skinningMatrix=new THREE.Matrix4;t.skinningMatrix.multiply(t.world,y);t.weights=[];
+for(y=0;y<o.weights.length;y++)for(var z=0;z<o.weights[y].length;z++){var A=o.weights[y][z];A.joint==v&&t.weights.push(A)}}else throw"could not find joint!";}for(n=0;n<w.length;n++)for(o=0;o<w[n].weights.length;o++)t=w[n].weights[o],p=t.index,t=t.weight,v=b.vertices[p],p=x[p],u.x=v.position.x,u.y=v.position.y,u.z=v.position.z,w[n].skinningMatrix.multiplyVector3(u),p.position.x+=u.x*t,p.position.y+=u.y*t,p.position.z+=u.z*t;b.morphTargets.push({name:"target_"+h,vertices:x})}}}function h(b){var e=new THREE.Object3D,
+c,k,m;e.name=b.id||"";e.matrixAutoUpdate=!1;e.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=O[b.controllers[m].url];switch(n.type){case "skin":if(oa[n.skin.source]){var o=new A;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);c=b.controllers[m]}else if(O[n.skin.source]&&(k=n=O[n.skin.source],n.morph&&oa[n.morph.source]))o=new A,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(oa[n.morph.source])o=
+new A,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),k=b.controllers[m];console.log("DAE: morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=oa[n.url],t={},p=0,u;if(n&&n.mesh&&n.mesh.primitives){if(e.name.length==0)e.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=va[qa[u.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;u=t[u.symbol]=
+v.material;p++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(p>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)p=n.faces[j],p.materials=[t[p.daeMaterial]]}if(c!==void 0)f(n,c),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=c.skeleton,o.skinController=O[c.url],o.skinInstanceController=c,o.name="skin_"+Ca.length,Ca.push(o);else if(k!==void 0){t=n;p=k instanceof x?O[k.url]:k;if(!p||!p.morph)console.log("could not find morph controller!");
+else{p=p.morph;for(v=0;v<p.targets.length;v++){var w=oa[p.targets[v]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===t.vertices.length&&t.morphTargets.push({name:"target_1",vertices:w.vertices})}t.morphTargets.push({name:"target_Z",vertices:t.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+Aa.length;Aa.push(o)}else o=new THREE.Mesh(n,o);e.add(o)}}for(m=0;m<b.nodes.length;m++)e.add(h(b.nodes[m],b));return e}function k(){this.init_from=
+this.id=""}function m(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function p(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function t(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function w(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function u(){this.type=
+this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function v(){this.target=this.symbol=""}function A(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function y(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function D(){}function F(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function E(){this.source="";
 this.stride=this.count=0;this.params=[]}function H(){this.input={}}function L(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(b){this.id=b;this.type=null}function K(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function B(b,e){this.type=b;this.effect=e;this.material=null}function da(b){this.effect=b;this.format=this.init_from=
 null}function J(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Q(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function R(){this.url=""}function Y(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function W(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
 this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ea(b){var e=b.getAttribute("id");if(la[e]!=void 0)return la[e];la[e]=(new M(e)).parse(b);return la[e]}function P(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function ma(b){for(var b=ia(b),e=[],c=0;c<b.length;c++)e.push(parseFloat(b[c]));return e}function Z(b){for(var b=ia(b),e=[],c=0;c<b.length;c++)e.push(parseInt(b[c],10));return e}function ia(b){return b.replace(/^\s+/,"").replace(/\s+$/,
@@ -574,27 +574,27 @@ b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e
 {},c=[],f;this.method=b.getAttribute("method");this.source=b.getAttribute("source").replace(/^#/,"");for(f=0;f<b.childNodes.length;f++){var h=b.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new M).parse(h);e[h.id]=h;break;case "targets":c=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<c.length;f++)switch(b=c[f],h=e[b.source],b.semantic){case "MORPH_TARGET":this.targets=h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};n.prototype.parseInputs=
 function(b){for(var e=[],c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":e.push((new L).parse(f))}}return e};p.prototype.parse=function(b){var e={},c,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=ma(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],
 k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15]);break;case "source":k=(new M).parse(k);e[k.id]=k;break;case "joints":c=k;break;case "vertex_weights":f=k;break;default:console.log(k.nodeName)}}this.parseJoints(c,e);this.parseWeights(f,e);return this};p.prototype.parseJoints=function(b,e){for(var c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":var f=(new L).parse(f),h=e[f.source];if(f.semantic=="JOINT")this.joints=
-h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};p.prototype.parseWeights=function(b,e){for(var c,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new L).parse(m));break;case "v":c=Z(m.textContent);break;case "vcount":f=Z(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],p=0;p<n;p++){for(var t={},u=0;u<h.length;u++){var v=h[u],w=c[m+v.offset];switch(v.semantic){case "JOINT":t.joint=w;break;
-case "WEIGHT":t.weight=e[v.source].data[w]}}o.push(t);m+=h.length}for(p=0;p<o.length;p++)o[p].index=k;this.weights.push(o)}};u.prototype.getChildById=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};u.prototype.getChildBySid=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};u.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");
-this.nodes=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new v).parse(c))}}return this};v.prototype.getChannelForTransform=function(b){for(var e=0;e<this.channels.length;e++){var c=this.channels[e],f=c.target.split("/");f.shift();var h=f.shift(),k=h.indexOf(".")>=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,
-""))}if(h==b)return c.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},c}return null};v.prototype.getChildById=function(b,e){if(this.id==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};v.prototype.getChildBySid=function(b,e){if(this.sid==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};v.prototype.getTransformBySid=function(b){for(var e=0;e<this.transforms.length;e++)if(this.transforms[e].sid==
-b)return this.transforms[e];return null};v.prototype.parse=function(b){var e;this.id=b.getAttribute("id");this.sid=b.getAttribute("sid");this.name=b.getAttribute("name");this.type=b.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<b.childNodes.length;c++)if(e=b.childNodes[c],e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new v).parse(e));break;case "instance_camera":break;
-case "instance_controller":this.controllers.push((new w).parse(e));break;case "instance_geometry":this.geometries.push((new y).parse(e));break;case "instance_light":break;case "instance_node":e=e.getAttribute("url").replace(/^#/,"");(e=ca.evaluate(".//dae:library_nodes//dae:node[@id='"+e+"']",ca,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new v).parse(e));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new t).parse(e));
+h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};p.prototype.parseWeights=function(b,e){for(var c,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new L).parse(m));break;case "v":c=Z(m.textContent);break;case "vcount":f=Z(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],t=0;t<n;t++){for(var p={},u=0;u<h.length;u++){var v=h[u],w=c[m+v.offset];switch(v.semantic){case "JOINT":p.joint=w;break;
+case "WEIGHT":p.weight=e[v.source].data[w]}}o.push(p);m+=h.length}for(t=0;t<o.length;t++)o[t].index=k;this.weights.push(o)}};t.prototype.getChildById=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};t.prototype.getChildBySid=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};t.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");
+this.nodes=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new w).parse(c))}}return this};w.prototype.getChannelForTransform=function(b){for(var e=0;e<this.channels.length;e++){var c=this.channels[e],f=c.target.split("/");f.shift();var h=f.shift(),k=h.indexOf(".")>=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,
+""))}if(h==b)return c.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},c}return null};w.prototype.getChildById=function(b,e){if(this.id==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};w.prototype.getChildBySid=function(b,e){if(this.sid==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};w.prototype.getTransformBySid=function(b){for(var e=0;e<this.transforms.length;e++)if(this.transforms[e].sid==
+b)return this.transforms[e];return null};w.prototype.parse=function(b){var e;this.id=b.getAttribute("id");this.sid=b.getAttribute("sid");this.name=b.getAttribute("name");this.type=b.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<b.childNodes.length;c++)if(e=b.childNodes[c],e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new w).parse(e));break;case "instance_camera":break;
+case "instance_controller":this.controllers.push((new x).parse(e));break;case "instance_geometry":this.geometries.push((new A).parse(e));break;case "instance_light":break;case "instance_node":e=e.getAttribute("url").replace(/^#/,"");(e=ca.evaluate(".//dae:library_nodes//dae:node[@id='"+e+"']",ca,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new w).parse(e));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new u).parse(e));
 break;case "extra":break;default:console.log(e.nodeName)}b=[];c=1E6;e=-1E6;for(var f in na)for(var h=na[f],k=0;k<h.channel.length;k++){var m=h.channel[k],n=h.sampler[k];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,c=Math.min(c,n.startTime),e=Math.max(e,n.endTime),b.push(m)}if(b.length)this.startTime=c,this.endTime=e;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(c=0;c<b.input.length-1;c++)f=Math.min(f,b.input[c+
-1]-b.input[c])}c=[];for(b=this.startTime;b<this.endTime;b+=f){e=b;for(var h={},o=k=void 0,k=0;k<this.channels.length;k++)o=this.channels[k],h[o.sid]=o;m=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(n=this.transforms[k],o=h[n.sid],o!==void 0){for(var p=o.sampler,u,o=0;o<p.input.length-1;o++)if(p.input[o+1]>e){u=p.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);e=m;c.push({time:b,pos:[e.n14,
-e.n24,e.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};v.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};t.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=ma(b.textContent);this.updateMatrix();return this};t.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
+1]-b.input[c])}c=[];for(b=this.startTime;b<this.endTime;b+=f){e=b;for(var h={},o=k=void 0,k=0;k<this.channels.length;k++)o=this.channels[k],h[o.sid]=o;m=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(n=this.transforms[k],o=h[n.sid],o!==void 0){for(var t=o.sampler,p,o=0;o<t.input.length-1;o++)if(t.input[o+1]>e){p=t.output[o];break}m=p!==void 0?p instanceof THREE.Matrix4?m.multiply(m,p):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);e=m;c.push({time:b,pos:[e.n14,
+e.n24,e.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};u.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=ma(b.textContent);this.updateMatrix();return this};u.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
 this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":b=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),b);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
-w.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=ca.evaluate(".//dae:instance_material",c,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=c.iterateNext();f;)this.instance_material.push((new x).parse(f)),f=c.iterateNext()}}return this};
-x.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1&&c.nodeName=="bind_material"){if(b=ca.evaluate(".//dae:instance_material",c,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new x).parse(e)),
-e=b.iterateNext();break}}return this};z.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "mesh":this.mesh=(new A(this)).parse(c)}}return this};A.prototype.parse=function(b){function e(b,c){var f=fa(b.position);h[f]===void 0&&(h[f]={v:b,index:c});return h[f]}this.primitives=[];var c;for(c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];switch(f.nodeName){case "source":ea(f);break;case "vertices":this.vertices=
-(new H).parse(f);break;case "triangles":this.primitives.push((new F).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new E).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=la[this.vertices.input.POSITION.source].data;for(b=c=0;c<f.length;c+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[c],f[c+1],f[c+2]));e(k,b);this.geometry3js.vertices.push(k)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),
-this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};A.prototype.handlePrimitive=function(b,e,c){var f=0,h,k,m=b.p,n=b.inputs,o,p,t,u=0,v=3,w=[];for(h=0;h<n.length;h++)switch(o=n[h],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(v=b.vcount[u++]);for(h=0;h<v;h++)for(k=0;k<n.length;k++)switch(o=
-n[k],source=la[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=fa(e.vertices[p].position);x.push(c[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[t],source.data[t+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var B;v==
-3?B=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],A.length?A:new THREE.Color):v==4&&(B=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],A.length?A:new THREE.Color));B.daeMaterial=b.material;e.faces.push(B);for(k=0;k<w.length;k++)h=z[w[k]],e.faceVertexUvs[k].push([h[0],h[1],h[2]]);f+=n.length*v}};E.prototype=new F;E.prototype.constructor=E;F.prototype.setVertices=function(b){for(var e=0;e<this.inputs.length;e++)if(this.inputs[e].source==b.id)this.inputs[e].source=b.input.POSITION.source};
-F.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=aa(b,"count",0);for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "input":this.inputs.push((new L).parse(b.childNodes[e]));break;case "vcount":this.vcount=Z(c.textContent);break;case "p":this.p=Z(c.textContent)}}return this};D.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=aa(b,"count",0);this.stride=aa(b,"stride",0);for(var e=
+x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=ca.evaluate(".//dae:instance_material",c,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=c.iterateNext();f;)this.instance_material.push((new v).parse(f)),f=c.iterateNext()}}return this};
+v.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};A.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1&&c.nodeName=="bind_material"){if(b=ca.evaluate(".//dae:instance_material",c,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new v).parse(e)),
+e=b.iterateNext();break}}return this};z.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "mesh":this.mesh=(new y(this)).parse(c)}}return this};y.prototype.parse=function(b){function e(b,c){var f=fa(b.position);h[f]===void 0&&(h[f]={v:b,index:c});return h[f]}this.primitives=[];var c;for(c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];switch(f.nodeName){case "source":ea(f);break;case "vertices":this.vertices=
+(new H).parse(f);break;case "triangles":this.primitives.push((new F).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new D).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=la[this.vertices.input.POSITION.source].data;for(b=c=0;c<f.length;c+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[c],f[c+1],f[c+2]));e(k,b);this.geometry3js.vertices.push(k)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),
+this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};y.prototype.handlePrimitive=function(b,e,c){var f=0,h,k,m=b.p,n=b.inputs,o,t,p,u=0,v=3,w=[];for(h=0;h<n.length;h++)switch(o=n[h],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(v=b.vcount[u++]);for(h=0;h<v;h++)for(k=0;k<n.length;k++)switch(o=
+n[k],source=la[o.source],t=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,p=t*numParams,o.semantic){case "VERTEX":o=fa(e.vertices[t].position);x.push(c[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[p],source.data[p+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var B;v==
+3?B=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],A.length?A:new THREE.Color):v==4&&(B=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],A.length?A:new THREE.Color));B.daeMaterial=b.material;e.faces.push(B);for(k=0;k<w.length;k++)h=z[w[k]],e.faceVertexUvs[k].push([h[0],h[1],h[2]]);f+=n.length*v}};D.prototype=new F;D.prototype.constructor=D;F.prototype.setVertices=function(b){for(var e=0;e<this.inputs.length;e++)if(this.inputs[e].source==b.id)this.inputs[e].source=b.input.POSITION.source};
+F.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=aa(b,"count",0);for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "input":this.inputs.push((new L).parse(b.childNodes[e]));break;case "vcount":this.vcount=Z(c.textContent);break;case "p":this.p=Z(c.textContent)}}return this};E.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=aa(b,"count",0);this.stride=aa(b,"stride",0);for(var e=
 0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="param"){var f={};f.name=c.getAttribute("name");f.type=c.getAttribute("type");this.params.push(f)}}return this};H.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++)b.childNodes[e].nodeName=="input"&&(input=(new L).parse(b.childNodes[e]),this.input[input.semantic]=input);return this};L.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,
 "");this.set=aa(b,"set",-1);this.offset=aa(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};M.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "bool_array":for(var f=ia(c.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=c.nodeName;break;case "float_array":this.data=ma(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
-Z(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ia(c.textContent);this.type=c.nodeName;break;case "technique_common":for(f=0;f<c.childNodes.length;f++)if(c.childNodes[f].nodeName=="accessor"){this.accessor=(new D).parse(c.childNodes[f]);break}}}return this};M.prototype.read=function(){var b=[],e=this.accessor.params[0];switch(e.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(e=0;e<this.data.length;e+=16){var c=
+Z(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ia(c.textContent);this.type=c.nodeName;break;case "technique_common":for(f=0;f<c.childNodes.length;f++)if(c.childNodes[f].nodeName=="accessor"){this.accessor=(new E).parse(c.childNodes[f]);break}}}return this};M.prototype.read=function(){var b=[],e=this.accessor.params[0];switch(e.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(e=0;e<this.data.length;e+=16){var c=
 this.data.slice(e,e+16),f=new THREE.Matrix4;f.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+e.type)}return b};K.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="instance_effect"){this.instance_effect=(new R).parse(b.childNodes[e]);break}return this};G.prototype.isColor=
 function(){return this.texture==null};G.prototype.isTexture=function(){return this.texture!=null};G.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "color":c=ma(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};B.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=
 b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var f;f=ca.evaluate(".//dae:float",c,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};B.prototype.create=function(){var b=
@@ -608,51 +608,51 @@ Q.prototype.parseTechnique=function(b){for(var e=0;e<b.childNodes.length;e++){va
 parseInt(h[e].replace(/\)/,""))}this.sid=b;this.dotSyntax=c;this.arrSyntax=f;this.arrIndices=h;this.member=k;return this};o.prototype.parse=function(b){this.id=b.getAttribute("id");this.inputs=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new L).parse(c))}}return this};o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var e=this.inputs[b],c=this.animation.source[e.source];switch(e.semantic){case "INPUT":this.input=
 c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(e.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(b=0;b<this.input.length;b++)this.startTime=Math.min(this.startTime,this.input[b]),this.endTime=Math.max(this.endTime,this.input[b]);this.duration=this.endTime-this.startTime}};return{load:function(e,f){if(document.implementation&&
 document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var n=new XMLHttpRequest;n.overrideMimeType&&n.overrideMimeType("text/xml");n.onreadystatechange=function(){if(n.readyState==4&&(n.status==0||n.status==200)){ga=f;var o,p=e;ca=n.responseXML;o=ga;p!==void 0&&(p=p.split("/"),p.pop(),Ea=p.join("/")+"/");ra=b("//dae:library_images/dae:image",k,"image");qa=b("//dae:library_materials/dae:material",
-K,"material");va=b("//dae:library_effects/dae:effect",Q,"effect");oa=b("//dae:library_geometries/dae:geometry",z,"geometry");O=b("//dae:library_controllers/dae:controller",m,"controller");na=b("//dae:library_animations/dae:animation",Y,"animation");ta=b(".//dae:library_visual_scenes/dae:visual_scene",u,"visual_scene");Aa=[];Ca=[];(p=ca.evaluate(".//dae:scene/dae:instance_visual_scene",ca,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),X=ta[p]):
-X=null;$=new THREE.Object3D;for(p=0;p<X.nodes.length;p++)$.add(h(X.nodes[p]));c();for(var t in na);t={scene:$,morphs:Aa,skins:Ca,dae:{images:ra,materials:qa,effects:va,geometries:oa,controllers:O,animations:na,visualScenes:ta,scene:X}};o&&o(t)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Fa=b},applySkin:f,geometries:oa}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
+K,"material");va=b("//dae:library_effects/dae:effect",Q,"effect");oa=b("//dae:library_geometries/dae:geometry",z,"geometry");O=b("//dae:library_controllers/dae:controller",m,"controller");na=b("//dae:library_animations/dae:animation",Y,"animation");ta=b(".//dae:library_visual_scenes/dae:visual_scene",t,"visual_scene");Aa=[];Ca=[];(p=ca.evaluate(".//dae:scene/dae:instance_visual_scene",ca,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),X=ta[p]):
+X=null;$=new THREE.Object3D;for(p=0;p<X.nodes.length;p++)$.add(h(X.nodes[p]));c();for(var u in na);u={scene:$,morphs:Aa,skins:Ca,dae:{images:ra,materials:qa,effects:va,geometries:oa,controllers:O,animations:na,visualScenes:ta,scene:X}};o&&o(u)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Fa=b},applySkin:f,geometries:oa}};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,h=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,h);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,h,p,u,v,t,w,x,y,z,A,E,F,D,H=b.faces;t=b.vertices;var L=b.normals,M=b.colors,K=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&K++;for(c=0;c<K;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];u=0;for(v=t.length;u<v;)w=new THREE.Vertex,w.position.x=t[u++]*e,w.position.y=
-t[u++]*e,w.position.z=t[u++]*e,f.vertices.push(w);u=0;for(v=H.length;u<v;){e=H[u++];t=e&1;p=e&2;c=e&4;h=e&8;x=e&16;w=e&32;z=e&64;e&=128;t?(A=new THREE.Face4,A.a=H[u++],A.b=H[u++],A.c=H[u++],A.d=H[u++],t=4):(A=new THREE.Face3,A.a=H[u++],A.b=H[u++],A.c=H[u++],t=3);if(p)p=H[u++],A.materials=f.materials[p];p=f.faces.length;if(c)for(c=0;c<K;c++)E=b.uvs[c],y=H[u++],D=E[y*2],y=E[y*2+1],f.faceUvs[c][p]=new THREE.UV(D,y);if(h)for(c=0;c<K;c++){E=b.uvs[c];F=[];for(h=0;h<t;h++)y=H[u++],D=E[y*2],y=E[y*2+1],F[h]=
-new THREE.UV(D,y);f.faceVertexUvs[c][p]=F}if(x)x=H[u++]*3,h=new THREE.Vector3,h.x=L[x++],h.y=L[x++],h.z=L[x],A.normal=h;if(w)for(c=0;c<t;c++)x=H[u++]*3,h=new THREE.Vector3,h.x=L[x++],h.y=L[x++],h.z=L[x],A.vertexNormals.push(h);if(z)w=H[u++],w=new THREE.Color(M[w]),A.color=w;if(e)for(c=0;c<t;c++)w=H[u++],w=new THREE.Color(M[w]),A.vertexColors.push(w);f.faces.push(A)}}})(h);(function(){var e,c,h,p;if(b.skinWeights){e=0;for(c=b.skinWeights.length;e<c;e+=2)h=b.skinWeights[e],p=b.skinWeights[e+1],f.skinWeights.push(new THREE.Vector4(h,
-p,0,0))}if(b.skinIndices){e=0;for(c=b.skinIndices.length;e<c;e+=2)h=b.skinIndices[e],p=b.skinIndices[e+1],f.skinIndices.push(new THREE.Vector4(h,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(e){if(b.morphTargets!==void 0){var c,h,p,u,v,t,w,x,y;c=0;for(h=b.morphTargets.length;c<h;c++){f.morphTargets[c]={};f.morphTargets[c].name=b.morphTargets[c].name;f.morphTargets[c].vertices=[];x=f.morphTargets[c].vertices;y=b.morphTargets[c].vertices;p=0;for(u=y.length;p<u;p+=3)v=y[p]*e,t=y[p+1]*
-e,w=y[p+2]*e,x.push(new THREE.Vertex(new THREE.Vector3(v,t,w)))}}if(b.morphColors!==void 0){c=0;for(h=b.morphColors.length;c<h;c++){f.morphColors[c]={};f.morphColors[c].name=b.morphColors[c].name;f.morphColors[c].colors=[];u=f.morphColors[c].colors;v=b.morphColors[c].colors;e=0;for(p=v.length;e<p;e+=3)t=new THREE.Color(16755200),t.setRGB(v[e],v[e+1],v[e+2]),u.push(t)}}})(h);f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,h,p,t,w,u,x,v,A,z,y,D,F,E,H=b.faces;u=b.vertices;var L=b.normals,M=b.colors,K=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&K++;for(c=0;c<K;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];t=0;for(w=u.length;t<w;)x=new THREE.Vertex,x.position.x=u[t++]*e,x.position.y=
+u[t++]*e,x.position.z=u[t++]*e,f.vertices.push(x);t=0;for(w=H.length;t<w;){e=H[t++];u=e&1;p=e&2;c=e&4;h=e&8;v=e&16;x=e&32;z=e&64;e&=128;u?(y=new THREE.Face4,y.a=H[t++],y.b=H[t++],y.c=H[t++],y.d=H[t++],u=4):(y=new THREE.Face3,y.a=H[t++],y.b=H[t++],y.c=H[t++],u=3);if(p)p=H[t++],y.materials=f.materials[p];p=f.faces.length;if(c)for(c=0;c<K;c++)D=b.uvs[c],A=H[t++],E=D[A*2],A=D[A*2+1],f.faceUvs[c][p]=new THREE.UV(E,A);if(h)for(c=0;c<K;c++){D=b.uvs[c];F=[];for(h=0;h<u;h++)A=H[t++],E=D[A*2],A=D[A*2+1],F[h]=
+new THREE.UV(E,A);f.faceVertexUvs[c][p]=F}if(v)v=H[t++]*3,h=new THREE.Vector3,h.x=L[v++],h.y=L[v++],h.z=L[v],y.normal=h;if(x)for(c=0;c<u;c++)v=H[t++]*3,h=new THREE.Vector3,h.x=L[v++],h.y=L[v++],h.z=L[v],y.vertexNormals.push(h);if(z)x=H[t++],x=new THREE.Color(M[x]),y.color=x;if(e)for(c=0;c<u;c++)x=H[t++],x=new THREE.Color(M[x]),y.vertexColors.push(x);f.faces.push(y)}}})(h);(function(){var e,c,h,p;if(b.skinWeights){e=0;for(c=b.skinWeights.length;e<c;e+=2)h=b.skinWeights[e],p=b.skinWeights[e+1],f.skinWeights.push(new THREE.Vector4(h,
+p,0,0))}if(b.skinIndices){e=0;for(c=b.skinIndices.length;e<c;e+=2)h=b.skinIndices[e],p=b.skinIndices[e+1],f.skinIndices.push(new THREE.Vector4(h,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(e){if(b.morphTargets!==void 0){var c,h,p,t,w,u,x,v,A;c=0;for(h=b.morphTargets.length;c<h;c++){f.morphTargets[c]={};f.morphTargets[c].name=b.morphTargets[c].name;f.morphTargets[c].vertices=[];v=f.morphTargets[c].vertices;A=b.morphTargets[c].vertices;p=0;for(t=A.length;p<t;p+=3)w=A[p]*e,u=A[p+1]*
+e,x=A[p+2]*e,v.push(new THREE.Vertex(new THREE.Vector3(w,u,x)))}}if(b.morphColors!==void 0){c=0;for(h=b.morphColors.length;c<h;c++){f.morphColors[c]={};f.morphColors[c].name=b.morphColors[c].name;f.morphColors[c].colors=[];t=f.morphColors[c].colors;w=b.morphColors[c].colors;e=0;for(p=w.length;e<p;e+=3)u=new THREE.Color(16755200),u.setRGB(w[e],w[e+1],w[e+2]),t.push(u)}}})(h);f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};
 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 h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,e){return e=="relativeToHTML"?b:h+"/"+b}function n(){for(x in Q.objects)if(!P.objects[x])if(F=Q.objects[x],F.geometry!==void 0){if(M=P.geometries[F.geometry]){var b=!1;da=[];for(Z=0;Z<F.materials.length;Z++)da[Z]=P.materials[F.materials[Z]],b=da[Z]instanceof THREE.ShaderMaterial;b&&M.computeTangents();D=F.position;r=F.rotation;
-q=F.quaternion;s=F.scale;q=0;da.length==0&&(da[0]=new THREE.MeshFaceMaterial);da.length>1&&(da=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,da);object.name=x;object.position.set(D[0],D[1],D[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=F.visible;P.scene.add(object);P.objects[x]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),P.scene.collisions.colliders.push(b));
-if(F.castsShadow)b=new THREE.ShadowVolume(M),P.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},P.triggers[object.name]=b)}}else D=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=x,object.position.set(D[0],D[1],D[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=F.visible!==void 0?F.visible:!1,P.scene.add(object),P.objects[x]=object,P.empties[x]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},P.triggers[object.name]=b)}function p(b){return function(c){P.geometries[b]=c;n();Y-=1;e.onLoadComplete();v()}}function u(b){return function(e){P.geometries[b]=e}}function v(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-Y,loadedTextures:ea-W},P);e.onLoadProgress();Y==0&&W==0&&c(P)}var t,
-w,x,y,z,A,E,F,D,H,L,M,K,G,B,da,J,Q,R,Y,W,o,ea,P;Q=b.data;B=new THREE.BinaryLoader;R=new THREE.JSONLoader;W=Y=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(x in Q.objects)if(F=Q.objects[x],F.meshCollider){b=!0;break}if(b)P.scene.collisions=new THREE.CollisionSystem;if(Q.transform){b=Q.transform.position;H=Q.transform.rotation;var ma=Q.transform.scale;b&&P.scene.position.set(b[0],b[1],b[2]);H&&P.scene.rotation.set(H[0],
-H[1],H[2]);ma&&P.scene.scale.set(ma[0],ma[1],ma[2]);(b||H||ma)&&P.scene.updateMatrix()}b=function(){W-=1;v();e.onLoadComplete()};for(z in Q.cameras){H=Q.cameras[z];if(H.type=="perspective")K=new THREE.Camera(H.fov,H.aspect,H.near,H.far),K.useTarget=!0;else if(H.type=="ortho")K=new THREE.Camera,K.useTarget=!0,K.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);D=H.position;H=H.target;K.position.set(D[0],D[1],D[2]);K.target.position.set(H[0],H[1],H[2]);P.cameras[z]=
-K}for(y in Q.lights)z=Q.lights[y],K=z.color!==void 0?z.color:16777215,H=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(D=z.direction,J=new THREE.DirectionalLight(K,H),J.position.set(D[0],D[1],D[2]),J.position.normalize()):z.type=="point"?(D=z.position,d=z.distance,J=new THREE.PointLight(K,H,d),J.position.set(D[0],D[1],D[2])):z.type=="ambient"&&(J=new THREE.AmbientLight(K)),P.scene.add(J),P.lights[y]=J;for(A in Q.fogs)y=Q.fogs[A],y.type=="linear"?G=new THREE.Fog(0,y.near,y.far):y.type==
-"exp2"&&(G=new THREE.FogExp2(0,y.density)),H=y.color,G.color.setRGB(H[0],H[1],H[2]),P.fogs[A]=G;if(P.cameras&&Q.defaults.camera)P.currentCamera=P.cameras[Q.defaults.camera];if(P.fogs&&Q.defaults.fog)P.scene.fog=P.fogs[Q.defaults.fog];H=Q.defaults.bgcolor;P.bgColor=new THREE.Color;P.bgColor.setRGB(H[0],H[1],H[2]);P.bgColorAlpha=Q.defaults.bgalpha;for(t in Q.geometries)if(A=Q.geometries[t],A.type=="bin_mesh"||A.type=="ascii_mesh")Y+=1,e.onLoadStart();o=Y;for(t in Q.geometries)A=Q.geometries[t],A.type==
-"cube"?(M=new THREE.CubeGeometry(A.width,A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),P.geometries[t]=M):A.type=="plane"?(M=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),P.geometries[t]=M):A.type=="sphere"?(M=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),P.geometries[t]=M):A.type=="cylinder"?(M=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),P.geometries[t]=M):A.type=="torus"?
-(M=new THREE.TorusGeometry(A.radius,A.tube,A.segmentsR,A.segmentsT),P.geometries[t]=M):A.type=="icosahedron"?(M=new THREE.IcosahedronGeometry(A.subdivisions),P.geometries[t]=M):A.type=="bin_mesh"?B.load({model:f(A.url,Q.urlBaseType),callback:p(t)}):A.type=="ascii_mesh"?R.load({model:f(A.url,Q.urlBaseType),callback:p(t)}):A.type=="embedded_mesh"&&(A=Q.embeds[A.id])&&R.createModel(A,u(t),"");for(E in Q.textures)if(t=Q.textures[E],t.url instanceof Array){W+=t.url.length;for(B=0;B<t.url.length;B++)e.onLoadStart()}else W+=
-1,e.onLoadStart();ea=W;for(E in Q.textures){t=Q.textures[E];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){B=[];for(var Z=0;Z<t.url.length;Z++)B[Z]=f(t.url[Z],Q.urlBaseType);B=THREE.ImageUtils.loadTextureCube(B,t.mapping,b)}else{B=THREE.ImageUtils.loadTexture(f(t.url,Q.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)B.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)B.magFilter=THREE[t.magFilter];if(t.repeat){B.repeat.set(t.repeat[0],
-t.repeat[1]);if(t.repeat[0]!=1)B.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)B.wrapT=THREE.RepeatWrapping}t.offset&&B.offset.set(t.offset[0],t.offset[1]);if(t.wrap){R={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(R[t.wrap[0]]!==void 0)B.wrapS=R[t.wrap[0]];if(R[t.wrap[1]]!==void 0)B.wrapT=R[t.wrap[1]]}}P.textures[E]=B}for(w in Q.materials){E=Q.materials[w];for(L in E.parameters)if(L=="envMap"||L=="map"||L=="lightMap")E.parameters[L]=P.textures[E.parameters[L]];else if(L=="shading")E.parameters[L]=
-E.parameters[L]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")E.parameters[L]=THREE[E.parameters[L]]?THREE[E.parameters[L]]:THREE.NormalBlending;else if(L=="combine")E.parameters[L]=E.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(E.parameters[L]=="face")E.parameters[L]=THREE.FaceColors;else if(E.parameters[L])E.parameters[L]=THREE.VertexColors;if(E.parameters.opacity!==void 0&&E.parameters.opacity<1)E.parameters.transparent=
-!0;if(E.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);B=E.parameters.color;R=E.parameters.specular;A=E.parameters.ambient;G=E.parameters.shininess;b.tNormal.texture=P.textures[E.parameters.normalMap];if(E.parameters.normalMapFactor)b.uNormalScale.value=E.parameters.normalMapFactor;if(E.parameters.map)b.tDiffuse.texture=E.parameters.map,b.enableDiffuse.value=!0;if(E.parameters.lightMap)b.tAO.texture=E.parameters.lightMap,b.enableAO.value=!0;if(E.parameters.specularMap)b.tSpecular.texture=
-P.textures[E.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(B);b.uSpecularColor.value.setHex(R);b.uAmbientColor.value.setHex(A);b.uShininess.value=G;if(E.parameters.opacity)b.uOpacity.value=E.parameters.opacity;E=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else E=new THREE[E.type](E.parameters);P.materials[w]=E}n();e.callbackSync(P)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,e){return e=="relativeToHTML"?b:h+"/"+b}function n(){for(v in Q.objects)if(!P.objects[v])if(F=Q.objects[v],F.geometry!==void 0){if(M=P.geometries[F.geometry]){var b=!1;da=[];for(Z=0;Z<F.materials.length;Z++)da[Z]=P.materials[F.materials[Z]],b=da[Z]instanceof THREE.ShaderMaterial;b&&M.computeTangents();E=F.position;r=F.rotation;
+q=F.quaternion;s=F.scale;q=0;da.length==0&&(da[0]=new THREE.MeshFaceMaterial);da.length>1&&(da=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,da);object.name=v;object.position.set(E[0],E[1],E[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=F.visible;P.scene.add(object);P.objects[v]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),P.scene.collisions.colliders.push(b));
+if(F.castsShadow)b=new THREE.ShadowVolume(M),P.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},P.triggers[object.name]=b)}}else E=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(E[0],E[1],E[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=F.visible!==void 0?F.visible:!1,P.scene.add(object),P.objects[v]=object,P.empties[v]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},P.triggers[object.name]=b)}function p(b){return function(c){P.geometries[b]=c;n();Y-=1;e.onLoadComplete();w()}}function t(b){return function(e){P.geometries[b]=e}}function w(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-Y,loadedTextures:ea-W},P);e.onLoadProgress();Y==0&&W==0&&c(P)}var u,
+x,v,A,z,y,D,F,E,H,L,M,K,G,B,da,J,Q,R,Y,W,o,ea,P;Q=b.data;B=new THREE.BinaryLoader;R=new THREE.JSONLoader;W=Y=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in Q.objects)if(F=Q.objects[v],F.meshCollider){b=!0;break}if(b)P.scene.collisions=new THREE.CollisionSystem;if(Q.transform){b=Q.transform.position;H=Q.transform.rotation;var ma=Q.transform.scale;b&&P.scene.position.set(b[0],b[1],b[2]);H&&P.scene.rotation.set(H[0],
+H[1],H[2]);ma&&P.scene.scale.set(ma[0],ma[1],ma[2]);(b||H||ma)&&P.scene.updateMatrix()}b=function(){W-=1;w();e.onLoadComplete()};for(z in Q.cameras){H=Q.cameras[z];if(H.type=="perspective")K=new THREE.Camera(H.fov,H.aspect,H.near,H.far),K.useTarget=!0;else if(H.type=="ortho")K=new THREE.Camera,K.useTarget=!0,K.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);E=H.position;H=H.target;K.position.set(E[0],E[1],E[2]);K.target.position.set(H[0],H[1],H[2]);P.cameras[z]=
+K}for(A in Q.lights)z=Q.lights[A],K=z.color!==void 0?z.color:16777215,H=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(E=z.direction,J=new THREE.DirectionalLight(K,H),J.position.set(E[0],E[1],E[2]),J.position.normalize()):z.type=="point"?(E=z.position,d=z.distance,J=new THREE.PointLight(K,H,d),J.position.set(E[0],E[1],E[2])):z.type=="ambient"&&(J=new THREE.AmbientLight(K)),P.scene.add(J),P.lights[A]=J;for(y in Q.fogs)A=Q.fogs[y],A.type=="linear"?G=new THREE.Fog(0,A.near,A.far):A.type==
+"exp2"&&(G=new THREE.FogExp2(0,A.density)),H=A.color,G.color.setRGB(H[0],H[1],H[2]),P.fogs[y]=G;if(P.cameras&&Q.defaults.camera)P.currentCamera=P.cameras[Q.defaults.camera];if(P.fogs&&Q.defaults.fog)P.scene.fog=P.fogs[Q.defaults.fog];H=Q.defaults.bgcolor;P.bgColor=new THREE.Color;P.bgColor.setRGB(H[0],H[1],H[2]);P.bgColorAlpha=Q.defaults.bgalpha;for(u in Q.geometries)if(y=Q.geometries[u],y.type=="bin_mesh"||y.type=="ascii_mesh")Y+=1,e.onLoadStart();o=Y;for(u in Q.geometries)y=Q.geometries[u],y.type==
+"cube"?(M=new THREE.CubeGeometry(y.width,y.height,y.depth,y.segmentsWidth,y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides),P.geometries[u]=M):y.type=="plane"?(M=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),P.geometries[u]=M):y.type=="sphere"?(M=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),P.geometries[u]=M):y.type=="cylinder"?(M=new THREE.CylinderGeometry(y.topRad,y.botRad,y.height,y.radSegs,y.heightSegs),P.geometries[u]=M):y.type=="torus"?
+(M=new THREE.TorusGeometry(y.radius,y.tube,y.segmentsR,y.segmentsT),P.geometries[u]=M):y.type=="icosahedron"?(M=new THREE.IcosahedronGeometry(y.subdivisions),P.geometries[u]=M):y.type=="bin_mesh"?B.load({model:f(y.url,Q.urlBaseType),callback:p(u)}):y.type=="ascii_mesh"?R.load({model:f(y.url,Q.urlBaseType),callback:p(u)}):y.type=="embedded_mesh"&&(y=Q.embeds[y.id])&&R.createModel(y,t(u),"");for(D in Q.textures)if(u=Q.textures[D],u.url instanceof Array){W+=u.url.length;for(B=0;B<u.url.length;B++)e.onLoadStart()}else W+=
+1,e.onLoadStart();ea=W;for(D in Q.textures){u=Q.textures[D];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){B=[];for(var Z=0;Z<u.url.length;Z++)B[Z]=f(u.url[Z],Q.urlBaseType);B=THREE.ImageUtils.loadTextureCube(B,u.mapping,b)}else{B=THREE.ImageUtils.loadTexture(f(u.url,Q.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)B.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)B.magFilter=THREE[u.magFilter];if(u.repeat){B.repeat.set(u.repeat[0],
+u.repeat[1]);if(u.repeat[0]!=1)B.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)B.wrapT=THREE.RepeatWrapping}u.offset&&B.offset.set(u.offset[0],u.offset[1]);if(u.wrap){R={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(R[u.wrap[0]]!==void 0)B.wrapS=R[u.wrap[0]];if(R[u.wrap[1]]!==void 0)B.wrapT=R[u.wrap[1]]}}P.textures[D]=B}for(x in Q.materials){D=Q.materials[x];for(L in D.parameters)if(L=="envMap"||L=="map"||L=="lightMap")D.parameters[L]=P.textures[D.parameters[L]];else if(L=="shading")D.parameters[L]=
+D.parameters[L]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")D.parameters[L]=THREE[D.parameters[L]]?THREE[D.parameters[L]]:THREE.NormalBlending;else if(L=="combine")D.parameters[L]=D.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(D.parameters[L]=="face")D.parameters[L]=THREE.FaceColors;else if(D.parameters[L])D.parameters[L]=THREE.VertexColors;if(D.parameters.opacity!==void 0&&D.parameters.opacity<1)D.parameters.transparent=
+!0;if(D.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);B=D.parameters.color;R=D.parameters.specular;y=D.parameters.ambient;G=D.parameters.shininess;b.tNormal.texture=P.textures[D.parameters.normalMap];if(D.parameters.normalMapFactor)b.uNormalScale.value=D.parameters.normalMapFactor;if(D.parameters.map)b.tDiffuse.texture=D.parameters.map,b.enableDiffuse.value=!0;if(D.parameters.lightMap)b.tAO.texture=D.parameters.lightMap,b.enableAO.value=!0;if(D.parameters.specularMap)b.tSpecular.texture=
+P.textures[D.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(B);b.uSpecularColor.value.setHex(R);b.uAmbientColor.value.setHex(y);b.uShininess.value=G;if(D.parameters.opacity)b.uOpacity.value=D.parameters.opacity;D=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else D=new THREE[D.type](D.parameters);P.materials[x]=D}n();e.callbackSync(P)}},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,h=b.scale!==void 0?b.scale:1,k=b.offsetX!==void 0?b.offsetX:0,m=b.offsetY!==void 0?b.offsetY:0,n=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,h,k,m,n):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)};
 THREE.UTF8Loader.prototype.decompressMesh=function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var k=0,m=0;m<c;++m){var n=b.charCodeAt(m+f);k+=n>>1^-(n&1);e[8*m+h]=k}f+=c}c=b.length-f;k=new Uint16Array(c);for(h=m=0;h<c;h++)n=b.charCodeAt(h+f),k[h]=m-n,n==0&&m++;return[e,k]};
-THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,k){var m=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var m=THREE.UTF8Loader.prototype.decompressMesh(b),u=[],v=[];(function(b,m,p){for(var u,v,A,E=b.length;p<E;p+=m)u=b[p],v=b[p+1],A=b[p+2],u=u/16383*e,v=v/16383*e,A=A/16383*e,u+=f,v+=h,A+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(u,v,A)))})(m[0],8,0);(function(b,e,c){for(var f,h,k=b.length;c<k;c+=e)f=b[c],h=b[c+1],f/=1023,h/=1023,v.push(f,1-h)})(m[0],8,3);(function(b,
-e,c){for(var f,h,k,m=b.length;c<m;c+=e)f=b[c],h=b[c+1],k=b[c+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,u.push(f,h,k)})(m[0],8,5);(function(b){var e,f,h,k,m,p,F,D,H,L=b.length;for(e=0;e<L;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;D=f;H=h;p=k;F=f;var M=h,K=k,G=m.materials[0],B=u[M*3],da=u[M*3+1],M=u[M*3+2],J=u[K*3],Q=u[K*3+1],K=u[K*3+2];F=new THREE.Vector3(u[F*3],u[F*3+1],u[F*3+2]);M=new THREE.Vector3(B,da,M);K=new THREE.Vector3(J,Q,K);m.faces.push(new THREE.Face3(D,H,p,[F,M,K],null,G));m=v[f*2];f=v[f*
-2+1];p=v[h*2];F=v[h*2+1];D=v[k*2];H=v[k*2+1];k=c.faceVertexUvs[0];h=p;p=F;F=[];F.push(new THREE.UV(m,f));F.push(new THREE.UV(h,p));F.push(new THREE.UV(D,H));k.push(F)}})(m[1]);this.computeCentroids();this.computeFaceNormals()};m.prototype=new THREE.Geometry;m.prototype.constructor=m;c(new m)};
+THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,k){var m=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var m=THREE.UTF8Loader.prototype.decompressMesh(b),t=[],w=[];(function(b,m,t){for(var p,w,y,D=b.length;t<D;t+=m)p=b[t],w=b[t+1],y=b[t+2],p=p/16383*e,w=w/16383*e,y=y/16383*e,p+=f,w+=h,y+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(p,w,y)))})(m[0],8,0);(function(b,e,c){for(var f,h,k=b.length;c<k;c+=e)f=b[c],h=b[c+1],f/=1023,h/=1023,w.push(f,1-h)})(m[0],8,3);(function(b,
+e,c){for(var f,h,k,m=b.length;c<m;c+=e)f=b[c],h=b[c+1],k=b[c+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,t.push(f,h,k)})(m[0],8,5);(function(b){var e,f,h,k,m,p,F,E,H,L=b.length;for(e=0;e<L;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;E=f;H=h;p=k;F=f;var M=h,K=k,G=m.materials[0],B=t[M*3],da=t[M*3+1],M=t[M*3+2],J=t[K*3],Q=t[K*3+1],K=t[K*3+2];F=new THREE.Vector3(t[F*3],t[F*3+1],t[F*3+2]);M=new THREE.Vector3(B,da,M);K=new THREE.Vector3(J,Q,K);m.faces.push(new THREE.Face3(E,H,p,[F,M,K],null,G));m=w[f*2];f=w[f*
+2+1];p=w[h*2];F=w[h*2+1];E=w[k*2];H=w[k*2+1];k=c.faceVertexUvs[0];h=p;p=F;F=[];F.push(new THREE.UV(m,f));F.push(new THREE.UV(h,p));F.push(new THREE.UV(E,H));k.push(F)}})(m[1]);this.computeCentroids();this.computeFaceNormals()};m.prototype=new THREE.Geometry;m.prototype.constructor=m;c(new m)};
 THREE.Axes=function(){THREE.Object3D.call(this);var b=new THREE.Geometry;b.vertices.push(new THREE.Vertex);b.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),e=new THREE.Line(b,new THREE.LineBasicMaterial({color:16711680}));e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));e.position.x=100;e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:65280}));this.add(e);
 e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));e.position.y=100;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:255}));e.rotation.x=Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));e.position.z=100;e.rotation.x=Math.PI/2;this.add(e)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 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,h){return b+(c-b)*h};this.VIntX=function(b,c,h,k,m,n,p,u,v,t){m=(m-v)/(t-v);v=this.normal_cache;c[k]=n+m*this.delta;c[k+1]=p;c[k+2]=u;h[k]=this.lerp(v[b],v[b+3],m);h[k+1]=this.lerp(v[b+1],v[b+4],m);h[k+2]=this.lerp(v[b+2],v[b+5],m)};this.VIntY=function(b,c,h,k,m,n,p,u,v,t){m=(m-v)/(t-v);v=this.normal_cache;c[k]=n;c[k+1]=p+m*this.delta;c[k+
-2]=u;c=b+this.yd*3;h[k]=this.lerp(v[b],v[c],m);h[k+1]=this.lerp(v[b+1],v[c+1],m);h[k+2]=this.lerp(v[b+2],v[c+2],m)};this.VIntZ=function(b,c,h,k,m,n,p,u,v,t){m=(m-v)/(t-v);v=this.normal_cache;c[k]=n;c[k+1]=p;c[k+2]=u+m*this.delta;c=b+this.zd*3;h[k]=this.lerp(v[b],v[c],m);h[k+1]=this.lerp(v[b+1],v[c+1],m);h[k+2]=this.lerp(v[b+2],v[c+2],m)};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,h,k,m,n){var p=k+1,u=k+this.yd,v=k+this.zd,t=p+this.yd,w=p+this.zd,x=k+this.yd+this.zd,y=p+this.yd+this.zd,z=0,A=this.field[k],E=this.field[p],F=this.field[u],D=this.field[t],H=this.field[v],L=this.field[w],M=this.field[x],K=this.field[y];A<m&&(z|=1);E<m&&(z|=2);F<m&&(z|=8);D<m&&(z|=4);H<m&&(z|=16);L<m&&(z|=32);M<m&&(z|=128);K<m&&(z|=64);var G=THREE.edgeTable[z];if(G==0)return 0;var B=this.delta,
-da=b+B,J=c+B,B=h+B;G&1&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,A,E));G&2&&(this.compNorm(p),this.compNorm(t),this.VIntY(p*3,this.vlist,this.nlist,3,m,da,c,h,E,D));G&4&&(this.compNorm(u),this.compNorm(t),this.VIntX(u*3,this.vlist,this.nlist,6,m,b,J,h,F,D));G&8&&(this.compNorm(k),this.compNorm(u),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,A,F));G&16&&(this.compNorm(v),this.compNorm(w),this.VIntX(v*3,this.vlist,this.nlist,12,m,b,c,B,H,L));G&32&&(this.compNorm(w),
-this.compNorm(y),this.VIntY(w*3,this.vlist,this.nlist,15,m,da,c,B,L,K));G&64&&(this.compNorm(x),this.compNorm(y),this.VIntX(x*3,this.vlist,this.nlist,18,m,b,J,B,M,K));G&128&&(this.compNorm(v),this.compNorm(x),this.VIntY(v*3,this.vlist,this.nlist,21,m,b,c,B,H,M));G&256&&(this.compNorm(k),this.compNorm(v),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,A,H));G&512&&(this.compNorm(p),this.compNorm(w),this.VIntZ(p*3,this.vlist,this.nlist,27,m,da,c,h,E,L));G&1024&&(this.compNorm(t),this.compNorm(y),this.VIntZ(t*
-3,this.vlist,this.nlist,30,m,da,J,h,D,K));G&2048&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*3,this.vlist,this.nlist,33,m,b,J,h,F,M));z<<=4;for(m=k=0;THREE.triTable[z+m]!=-1;)b=z+m,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),m+=3,k++;return k};this.posnormtriv=function(b,c,h,k,m,n){var p=this.count*3;this.positionArray[p]=b[h];this.positionArray[p+1]=b[h+1];this.positionArray[p+2]=b[h+2];this.positionArray[p+3]=b[k];this.positionArray[p+
+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,h){return b+(c-b)*h};this.VIntX=function(b,c,h,k,m,n,p,t,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n+m*this.delta;c[k+1]=p;c[k+2]=t;h[k]=this.lerp(w[b],w[b+3],m);h[k+1]=this.lerp(w[b+1],w[b+4],m);h[k+2]=this.lerp(w[b+2],w[b+5],m)};this.VIntY=function(b,c,h,k,m,n,p,t,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n;c[k+1]=p+m*this.delta;c[k+
+2]=t;c=b+this.yd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};this.VIntZ=function(b,c,h,k,m,n,p,t,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n;c[k+1]=p;c[k+2]=t+m*this.delta;c=b+this.zd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};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,h,k,m,n){var p=k+1,t=k+this.yd,w=k+this.zd,u=p+this.yd,x=p+this.zd,v=k+this.yd+this.zd,A=p+this.yd+this.zd,z=0,y=this.field[k],D=this.field[p],F=this.field[t],E=this.field[u],H=this.field[w],L=this.field[x],M=this.field[v],K=this.field[A];y<m&&(z|=1);D<m&&(z|=2);F<m&&(z|=8);E<m&&(z|=4);H<m&&(z|=16);L<m&&(z|=32);M<m&&(z|=128);K<m&&(z|=64);var G=THREE.edgeTable[z];if(G==0)return 0;var B=this.delta,
+da=b+B,J=c+B,B=h+B;G&1&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,y,D));G&2&&(this.compNorm(p),this.compNorm(u),this.VIntY(p*3,this.vlist,this.nlist,3,m,da,c,h,D,E));G&4&&(this.compNorm(t),this.compNorm(u),this.VIntX(t*3,this.vlist,this.nlist,6,m,b,J,h,F,E));G&8&&(this.compNorm(k),this.compNorm(t),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,y,F));G&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,B,H,L));G&32&&(this.compNorm(x),
+this.compNorm(A),this.VIntY(x*3,this.vlist,this.nlist,15,m,da,c,B,L,K));G&64&&(this.compNorm(v),this.compNorm(A),this.VIntX(v*3,this.vlist,this.nlist,18,m,b,J,B,M,K));G&128&&(this.compNorm(w),this.compNorm(v),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,B,H,M));G&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,y,H));G&512&&(this.compNorm(p),this.compNorm(x),this.VIntZ(p*3,this.vlist,this.nlist,27,m,da,c,h,D,L));G&1024&&(this.compNorm(u),this.compNorm(A),this.VIntZ(u*
+3,this.vlist,this.nlist,30,m,da,J,h,E,K));G&2048&&(this.compNorm(t),this.compNorm(v),this.VIntZ(t*3,this.vlist,this.nlist,33,m,b,J,h,F,M));z<<=4;for(m=k=0;THREE.triTable[z+m]!=-1;)b=z+m,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),m+=3,k++;return k};this.posnormtriv=function(b,c,h,k,m,n){var p=this.count*3;this.positionArray[p]=b[h];this.positionArray[p+1]=b[h+1];this.positionArray[p+2]=b[h+2];this.positionArray[p+3]=b[k];this.positionArray[p+
 4]=b[k+1];this.positionArray[p+5]=b[k+2];this.positionArray[p+6]=b[m];this.positionArray[p+7]=b[m+1];this.positionArray[p+8]=b[m+2];this.normalArray[p]=c[h];this.normalArray[p+1]=c[h+1];this.normalArray[p+2]=c[h+2];this.normalArray[p+3]=c[k];this.normalArray[p+4]=c[k+1];this.normalArray[p+5]=c[k+2];this.normalArray[p+6]=c[m];this.normalArray[p+7]=c[m+1];this.normalArray[p+8]=c[m+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&n(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,h,k,m){var n=this.size*Math.sqrt(k/m),p=h*this.size,u=c*this.size,v=b*this.size,t=Math.floor(p-n);t<1&&(t=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var w=Math.floor(u-n);w<1&&(w=1);u=Math.floor(u+n);u>this.size-1&&(u=this.size-1);var x=Math.floor(v-n);x<1&&(x=1);n=Math.floor(v+n);n>this.size-1&&(n=this.size-
-1);for(var y,z,A,E,F,D;t<p;t++){v=this.size2*t;z=t/this.size-h;F=z*z;for(z=w;z<u;z++){A=v+this.size*z;y=z/this.size-c;D=y*y;for(y=x;y<n;y++)E=y/this.size-b,E=k/(1.0E-6+E*E+D+F)-m,E>0&&(this.field[A+y]+=E)}}};this.addPlaneX=function(b,c){var h,k,m,n,p,u=this.size,v=this.yd,t=this.zd,w=this.field,x=u*Math.sqrt(b/c);x>u&&(x=u);for(h=0;h<x;h++)if(k=h/u,k*=k,n=b/(1.0E-4+k)-c,n>0)for(k=0;k<u;k++){p=h+k*v;for(m=0;m<u;m++)w[t*m+p]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,p,u,v=this.size,t=this.yd,w=
-this.zd,x=this.field,y=v*Math.sqrt(b/c);y>v&&(y=v);for(k=0;k<y;k++)if(h=k/v,h*=h,n=b/(1.0E-4+h)-c,n>0){p=k*t;for(h=0;h<v;h++){u=p+h;for(m=0;m<v;m++)x[w*m+u]+=n}}};this.addPlaneZ=function(b,c){var h,k,m,n,p,u;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(m=0;m<dist;m++)if(h=m/size,h*=h,n=b/(1.0E-4+h)-c,n>0){p=zd*m;for(k=0;k<size;k++){u=p+k*yd;for(h=0;h<size;h++)field[u+h]+=n}}};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,h,k,m,n,p,u,v,t,w=this.size-2;for(m=1;m<w;m++){t=this.size2*m;u=(m-this.halfsize)/this.halfsize;for(k=1;k<w;k++){v=t+this.size*k;p=(k-this.halfsize)/this.halfsize;for(h=1;h<w;h++)n=(h-this.halfsize)/this.halfsize,c=v+h,this.polygonize(n,p,u,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(k){var m,n,p,u,v,t,w,x;for(m=0;m<k.count;m++)w=m*3,v=w+1,x=w+2,n=k.positionArray[w],
-p=k.positionArray[v],u=k.positionArray[x],t=new THREE.Vector3(n,p,u),n=k.normalArray[w],p=k.normalArray[v],u=k.normalArray[x],w=new THREE.Vector3(n,p,u),w.normalize(),v=new THREE.Vertex(t),c.vertices.push(v),h.push(w);nfaces=k.count/3;for(m=0;m<nfaces;m++)w=(b+m)*3,v=w+1,x=w+2,t=h[w],n=h[v],p=h[x],w=new THREE.Face3(w,v,x,[t,n,p]),c.faces.push(w);b+=nfaces;k.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+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,h,k,m){var n=this.size*Math.sqrt(k/m),p=h*this.size,t=c*this.size,w=b*this.size,u=Math.floor(p-n);u<1&&(u=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var x=Math.floor(t-n);x<1&&(x=1);t=Math.floor(t+n);t>this.size-1&&(t=this.size-1);var v=Math.floor(w-n);v<1&&(v=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size-
+1);for(var A,z,y,D,F,E;u<p;u++){w=this.size2*u;z=u/this.size-h;F=z*z;for(z=x;z<t;z++){y=w+this.size*z;A=z/this.size-c;E=A*A;for(A=v;A<n;A++)D=A/this.size-b,D=k/(1.0E-6+D*D+E+F)-m,D>0&&(this.field[y+A]+=D)}}};this.addPlaneX=function(b,c){var h,k,m,n,p,t=this.size,w=this.yd,u=this.zd,x=this.field,v=t*Math.sqrt(b/c);v>t&&(v=t);for(h=0;h<v;h++)if(k=h/t,k*=k,n=b/(1.0E-4+k)-c,n>0)for(k=0;k<t;k++){p=h+k*w;for(m=0;m<t;m++)x[u*m+p]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,p,t,w=this.size,u=this.yd,x=
+this.zd,v=this.field,A=w*Math.sqrt(b/c);A>w&&(A=w);for(k=0;k<A;k++)if(h=k/w,h*=h,n=b/(1.0E-4+h)-c,n>0){p=k*u;for(h=0;h<w;h++){t=p+h;for(m=0;m<w;m++)v[x*m+t]+=n}}};this.addPlaneZ=function(b,c){var h,k,m,n,p,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(m=0;m<dist;m++)if(h=m/size,h*=h,n=b/(1.0E-4+h)-c,n>0){p=zd*m;for(k=0;k<size;k++){t=p+k*yd;for(h=0;h<size;h++)field[t+h]+=n}}};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,h,k,m,n,p,t,w,u,x=this.size-2;for(m=1;m<x;m++){u=this.size2*m;t=(m-this.halfsize)/this.halfsize;for(k=1;k<x;k++){w=u+this.size*k;p=(k-this.halfsize)/this.halfsize;for(h=1;h<x;h++)n=(h-this.halfsize)/this.halfsize,c=w+h,this.polygonize(n,p,t,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(k){var m,n,p,t,w,u,x,v;for(m=0;m<k.count;m++)x=m*3,w=x+1,v=x+2,n=k.positionArray[x],
+p=k.positionArray[w],t=k.positionArray[v],u=new THREE.Vector3(n,p,t),n=k.normalArray[x],p=k.normalArray[w],t=k.normalArray[v],x=new THREE.Vector3(n,p,t),x.normalize(),w=new THREE.Vertex(u),c.vertices.push(w),h.push(x);nfaces=k.count/3;for(m=0;m<nfaces;m++)x=(b+m)*3,w=x+1,v=x+2,u=h[x],n=h[w],p=h[v],x=new THREE.Face3(x,w,v,[u,n,p]),c.faces.push(x);b+=nfaces;k.count=0});return c};this.init(b)};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]);
@@ -681,20 +681,20 @@ THREE.MeshCollider=function(b,c){this.mesh=b;this.box=c;this.numFaces=this.mesh.
 THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,h,k=0;c=0;for(e=this.colliders.length;c<e;c++)if(h=this.colliders[c],f=this.rayCast(b,h),f<Number.MAX_VALUE)h.distance=f,f>k?this.hits.push(h):this.hits.unshift(h),k=f;return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.dist<Number.MAX_VALUE){c[e].distance=f.dist;c[e].faceIndex=f.faceIndex;break}e++}if(e>c.length)return null;return c[e]};
 THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,h,k=0;k<c.numFaces;k++){var m=c.mesh.geometry.faces[k],n=c.mesh.geometry.vertices[m.a].position,p=c.mesh.geometry.vertices[m.b].position,u=c.mesh.geometry.vertices[m.c].position,v=m instanceof THREE.Face4?c.mesh.geometry.vertices[m.d].position:null;m instanceof THREE.Face3?(m=this.rayTriangle(e,n,p,u,f,this.collisionNormal,c.mesh),m<f&&(f=m,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-m instanceof THREE.Face4&&(m=this.rayTriangle(e,n,p,v,f,this.collisionNormal,c.mesh),m<f&&(f=m,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize()),m=this.rayTriangle(e,p,u,v,f,this.collisionNormal,c.mesh),m<f&&(f=m,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:h}};
+THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,h,k=0;k<c.numFaces;k++){var m=c.mesh.geometry.faces[k],n=c.mesh.geometry.vertices[m.a].position,p=c.mesh.geometry.vertices[m.b].position,t=c.mesh.geometry.vertices[m.c].position,w=m instanceof THREE.Face4?c.mesh.geometry.vertices[m.d].position:null;m instanceof THREE.Face3?(m=this.rayTriangle(e,n,p,t,f,this.collisionNormal,c.mesh),m<f&&(f=m,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+m instanceof THREE.Face4&&(m=this.rayTriangle(e,n,p,w,f,this.collisionNormal,c.mesh),m<f&&(f=m,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize()),m=this.rayTriangle(e,p,t,w,f,this.collisionNormal,c.mesh),m<f&&(f=m,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:h}};
 THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,h,k,m){var n=THREE.CollisionSystem.__v1,p=THREE.CollisionSystem.__v2;k.set(0,0,0);n.sub(e,c);p.sub(f,e);k.cross(n,p);n=k.dot(b.direction);if(!(n<0))if(m.doubleSided||m.flipSided)k.multiplyScalar(-1),n*=-1;else return Number.MAX_VALUE;m=k.dot(c)-k.dot(b.origin);if(!(m<=0))return Number.MAX_VALUE;if(!(m>=n*h))return Number.MAX_VALUE;m/=n;n=THREE.CollisionSystem.__v3;n.copy(b.direction);n.multiplyScalar(m);n.addSelf(b.origin);Math.abs(k.x)>
 Math.abs(k.y)?Math.abs(k.x)>Math.abs(k.z)?(b=n.y-c.y,k=e.y-c.y,h=f.y-c.y,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,k=e.x-c.x,h=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(k.y)>Math.abs(k.z)?(b=n.x-c.x,k=e.x-c.x,h=f.x-c.x,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,k=e.x-c.x,h=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y);c=k*f-e*h;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-n*h)*c;if(!(f>=0))return Number.MAX_VALUE;c*=k*n-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return m};
 THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f};
-THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,h=0,k=0,m=0,n=0,p=0,u=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,u=!1,m=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,u=!1,m=1);e.origin.y<c.min.y?(h=c.min.y-e.origin.y,h/=e.direction.y,u=!1,n=-1):e.origin.y>c.max.y&&(h=c.max.y-e.origin.y,h/=e.direction.y,
-u=!1,n=1);e.origin.z<c.min.z?(k=c.min.z-e.origin.z,k/=e.direction.z,u=!1,p=-1):e.origin.z>c.max.z&&(k=c.max.z-e.origin.z,k/=e.direction.z,u=!1,p=1);if(u)return-1;u=0;h>f&&(u=1,f=h);k>f&&(u=2,f=k);switch(u){case 0:n=e.origin.y+e.direction.y*f;if(n<c.min.y||n>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(m,0,0);break;case 1:m=e.origin.x+e.direction.x*f;if(m<c.min.x||m>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
+THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,h=0,k=0,m=0,n=0,p=0,t=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,t=!1,m=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,t=!1,m=1);e.origin.y<c.min.y?(h=c.min.y-e.origin.y,h/=e.direction.y,t=!1,n=-1):e.origin.y>c.max.y&&(h=c.max.y-e.origin.y,h/=e.direction.y,
+t=!1,n=1);e.origin.z<c.min.z?(k=c.min.z-e.origin.z,k/=e.direction.z,t=!1,p=-1):e.origin.z>c.max.z&&(k=c.max.z-e.origin.z,k/=e.direction.z,t=!1,p=1);if(t)return-1;t=0;h>f&&(t=1,f=h);k>f&&(t=2,f=k);switch(t){case 0:n=e.origin.y+e.direction.y*f;if(n<c.min.y||n>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(m,0,0);break;case 1:m=e.origin.x+e.direction.x*f;if(m<c.min.x||m>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
 f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,n,0);break;case 2:m=e.origin.x+e.direction.x*f;if(m<c.min.x||m>c.max.x)return Number.MAX_VALUE;n=e.origin.y+e.direction.y*f;if(n<c.min.y||n>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,p)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
 THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);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(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
 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,h=new THREE.Camera,k=new THREE.Camera,m=new THREE.Matrix4,n=new THREE.Matrix4,p,u,v;h.useTarget=k.useTarget=!1;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.Camera(53,1,1,1E4);x.position.z=
-2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:w}},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 y=new THREE.Scene;y.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;w.width=b;w.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||u!==e.near||v!==e.fov){p=e.aspect;u=e.near;v=e.fov;var E=e.projectionMatrix.clone(),F=125/30*0.5,D=F*u/125,H=u*Math.tan(v*Math.PI/360),L;m.n14=F;n.n14=-F;F=-H*p+D;L=H*p+D;E.n11=2*u/(L-F);E.n13=(L+F)/(L-F);h.projectionMatrix=E.clone();F=-H*p-D;L=H*p-D;E.n11=2*u/(L-F);E.n13=
-(L+F)/(L-F);k.projectionMatrix=E.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=u;h.far=e.far;f.call(c,b,h,t,!0);k.matrix=e.matrixWorld.clone().multiplySelf(m);k.update(null,!0);k.position.copy(e.position);k.near=u;k.far=e.far;f.call(c,b,k,w,!0);f.call(c,y,x)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,k=new THREE.Camera,m=new THREE.Matrix4,n=new THREE.Matrix4,p,t,w;h.useTarget=k.useTarget=!1;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.Camera(53,1,1,1E4);v.position.z=
+2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:x}},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 A=new THREE.Scene;A.add(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;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||t!==e.near||w!==e.fov){p=e.aspect;t=e.near;w=e.fov;var D=e.projectionMatrix.clone(),F=125/30*0.5,E=F*t/125,H=t*Math.tan(w*Math.PI/360),L;m.n14=F;n.n14=-F;F=-H*p+E;L=H*p+E;D.n11=2*t/(L-F);D.n13=(L+F)/(L-F);h.projectionMatrix=D.clone();F=-H*p-E;L=H*p-E;D.n11=2*t/(L-F);D.n13=
+(L+F)/(L-F);k.projectionMatrix=D.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=t;h.far=e.far;f.call(c,b,h,u,!0);k.matrix=e.matrixWorld.clone().multiplySelf(m);k.update(null,!0);k.position.copy(e.position);k.near=t;k.far=e.far;f.call(c,b,k,x,!0);f.call(c,A,v)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,k,m=new THREE.Camera;m.useTarget=!0;var n=new THREE.Camera;n.useTarget=!0;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;this.setSize=function(b,f){e.call(c,b,f);h=b/2;k=f};this.render=function(b,e){this.clear();m.fov=e.fov;m.aspect=0.5*e.aspect;m.near=e.near;m.far=e.far;m.updateProjectionMatrix();m.position.copy(e.position);
 m.target.position.copy(e.target.position);m.translateX(c.separation);n.projectionMatrix=m.projectionMatrix;n.position.copy(e.position);n.target.position.copy(e.target.position);n.translateX(-c.separation);this.setViewport(0,0,h,k);f.call(c,b,m);this.setViewport(h,0,h,k);f.call(c,b,n,!1)}};

+ 134 - 134
build/custom/ThreeExtras.js

@@ -1,18 +1,18 @@
 // ThreeExtras.js r45dev - http://github.com/mrdoob/three.js
 THREE.ColorUtils={adjustHSV:function(a,c,b,e){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+b,0,1);g.v=THREE.ColorUtils.clamp(g.v+e,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,g=a.b,h=Math.max(Math.max(b,e),g),f=Math.min(Math.min(b,e),g);if(f==h)f=b=0;else{var k=h-f,f=k/h,b=b==h?(e-g)/k:e==h?2+(g-b)/k:4+(b-e)/k;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=f;c.v=h;return c},
 clamp:function(a,c,b){return a<c?c:a>b?b:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,c){var b,e,g=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,k=h.vertices,l=a.faces,m=h.faces,n=a.faceVertexUvs[0],h=h.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var o=0,t=k.length;o<t;o++){var u=new THREE.Vertex(k[o].position.clone());b&&b.multiplyVector3(u.position);f.push(u)}o=0;for(t=m.length;o<t;o++){var u=m[o],y,v,p=u.vertexNormals,
-z=u.vertexColors;u instanceof THREE.Face3?y=new THREE.Face3(u.a+g,u.b+g,u.c+g):u instanceof THREE.Face4&&(y=new THREE.Face4(u.a+g,u.b+g,u.c+g,u.d+g));y.normal.copy(u.normal);e&&e.multiplyVector3(y.normal);f=0;for(k=p.length;f<k;f++)v=p[f].clone(),e&&e.multiplyVector3(v),y.vertexNormals.push(v);y.color.copy(u.color);f=0;for(k=z.length;f<k;f++)v=z[f],y.vertexColors.push(v.clone());y.materials=u.materials.slice();y.centroid.copy(u.centroid);b&&b.multiplyVector3(y.centroid);l.push(y)}o=0;for(t=h.length;o<
-t;o++){b=h[o];e=[];f=0;for(k=b.length;f<k;f++)e.push(new THREE.UV(b[f].u,b[f].v));n.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,g=a.faces,h=a.faceVertexUvs[0],a=0;for(b=e.length;a<b;a++){var f=new THREE.Vertex(e[a].position.clone());c.vertices.push(f)}a=0;for(b=g.length;a<b;a++){var k=g[a],l,m,n=k.vertexNormals,o=k.vertexColors;k instanceof THREE.Face3?l=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(l=new THREE.Face4(k.a,k.b,k.c,k.d));l.normal.copy(k.normal);e=0;
-for(f=n.length;e<f;e++)m=n[e],l.vertexNormals.push(m.clone());l.color.copy(k.color);e=0;for(f=o.length;e<f;e++)m=o[e],l.vertexColors.push(m.clone());l.materials=k.materials.slice();l.centroid.copy(k.centroid);c.faces.push(l)}a=0;for(b=h.length;a<b;a++){g=h[a];l=[];e=0;for(f=g.length;e<f;e++)l.push(new THREE.UV(g[e].u,g[e].v));c.faceVertexUvs[0].push(l)}return c},randomPointInTriangle:function(a,c,b){var e,g,h,f=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();
+THREE.GeometryUtils={merge:function(a,c){var b,e,g=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,k=h.vertices,l=a.faces,m=h.faces,o=a.faceVertexUvs[0],h=h.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var n=0,t=k.length;n<t;n++){var u=new THREE.Vertex(k[n].position.clone());b&&b.multiplyVector3(u.position);f.push(u)}n=0;for(t=m.length;n<t;n++){var u=m[n],y,v,p=u.vertexNormals,
+z=u.vertexColors;u instanceof THREE.Face3?y=new THREE.Face3(u.a+g,u.b+g,u.c+g):u instanceof THREE.Face4&&(y=new THREE.Face4(u.a+g,u.b+g,u.c+g,u.d+g));y.normal.copy(u.normal);e&&e.multiplyVector3(y.normal);f=0;for(k=p.length;f<k;f++)v=p[f].clone(),e&&e.multiplyVector3(v),y.vertexNormals.push(v);y.color.copy(u.color);f=0;for(k=z.length;f<k;f++)v=z[f],y.vertexColors.push(v.clone());y.materials=u.materials.slice();y.centroid.copy(u.centroid);b&&b.multiplyVector3(y.centroid);l.push(y)}n=0;for(t=h.length;n<
+t;n++){b=h[n];e=[];f=0;for(k=b.length;f<k;f++)e.push(new THREE.UV(b[f].u,b[f].v));o.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,g=a.faces,h=a.faceVertexUvs[0],a=0;for(b=e.length;a<b;a++){var f=new THREE.Vertex(e[a].position.clone());c.vertices.push(f)}a=0;for(b=g.length;a<b;a++){var k=g[a],l,m,o=k.vertexNormals,n=k.vertexColors;k instanceof THREE.Face3?l=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(l=new THREE.Face4(k.a,k.b,k.c,k.d));l.normal.copy(k.normal);e=0;
+for(f=o.length;e<f;e++)m=o[e],l.vertexNormals.push(m.clone());l.color.copy(k.color);e=0;for(f=n.length;e<f;e++)m=n[e],l.vertexColors.push(m.clone());l.materials=k.materials.slice();l.centroid.copy(k.centroid);c.faces.push(l)}a=0;for(b=h.length;a<b;a++){g=h[a];l=[];e=0;for(f=g.length;e<f;e++)l.push(new THREE.UV(g[e].u,g[e].v));c.faceVertexUvs[0].push(l)}return c},randomPointInTriangle:function(a,c,b){var e,g,h,f=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();
 e+g>1&&(e=1-e,g=1-g);h=1-e-g;f.copy(a);f.multiplyScalar(e);k.copy(c);k.multiplyScalar(g);f.addSelf(k);k.copy(b);k.multiplyScalar(h);f.addSelf(k);return f},randomPointInFace:function(a,c,b){var e,g,h;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,g=c.vertices[a.b].position,h=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,g,h);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;g=c.vertices[a.b].position;h=c.vertices[a.c].position;var c=c.vertices[a.d].position,
 f;b?a._area1&&a._area2?(b=a._area1,f=a._area2):(b=THREE.GeometryUtils.triangleArea(e,g,c),f=THREE.GeometryUtils.triangleArea(g,h,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(e,g,c),f=THREE.GeometryUtils.triangleArea(g,h,c));return THREE.GeometryUtils.random()*(b+f)<b?THREE.GeometryUtils.randomPointInTriangle(e,g,c):THREE.GeometryUtils.randomPointInTriangle(g,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,e){if(e<c)return c;var f=c+Math.floor((e-c)/2);return m[f]>
-a?b(c,f-1):m[f]<a?b(f+1,e):f}return b(0,m.length-1)}var e,g,h=a.faces,f=a.vertices,k=h.length,l=0,m=[],n,o,t,u;for(g=0;g<k;g++){e=h[g];if(e instanceof THREE.Face3)n=f[e.a].position,o=f[e.b].position,t=f[e.c].position,e._area=THREE.GeometryUtils.triangleArea(n,o,t);else if(e instanceof THREE.Face4)n=f[e.a].position,o=f[e.b].position,t=f[e.c].position,u=f[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(n,o,u),e._area2=THREE.GeometryUtils.triangleArea(o,t,u),e._area=e._area1+e._area2;l+=e._area;
+a?b(c,f-1):m[f]<a?b(f+1,e):f}return b(0,m.length-1)}var e,g,h=a.faces,f=a.vertices,k=h.length,l=0,m=[],o,n,t,u;for(g=0;g<k;g++){e=h[g];if(e instanceof THREE.Face3)o=f[e.a].position,n=f[e.b].position,t=f[e.c].position,e._area=THREE.GeometryUtils.triangleArea(o,n,t);else if(e instanceof THREE.Face4)o=f[e.a].position,n=f[e.b].position,t=f[e.c].position,u=f[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(o,n,u),e._area2=THREE.GeometryUtils.triangleArea(n,t,u),e._area=e._area1+e._area2;l+=e._area;
 m[g]=l}e=[];f={};for(g=0;g<c;g++)k=THREE.GeometryUtils.random()*l,k=b(k),e[g]=THREE.GeometryUtils.randomPointInFace(h[k],a,!0),f[k]?f[k]+=1:f[k]=1;return e},triangleArea:function(a,c,b){var e,g=THREE.GeometryUtils.__v1;g.sub(a,c);e=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*
 (a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,g=new THREE.Texture(e,c);e.onload=function(){g.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return g},loadTextureCube:function(a,c,b){var e,g=[],h=new THREE.Texture(g,c),c=g.loadCount=0;for(e=a.length;c<e;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return h},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,g=a.height,h=document.createElement("canvas");h.width=e;h.height=g;var f=h.getContext("2d");f.drawImage(a,0,0);for(var k=f.getImageData(0,0,e,g).data,l=f.createImageData(e,g),m=l.data,n=0;n<e;n++)for(var o=1;o<g;o++){var t=o-1<0?g-1:o-1,u=(o+1)%g,y=n-1<0?e-1:n-1,v=(n+1)%e,p=[],z=[0,0,k[(o*e+n)*4]/255*c];p.push([-1,0,k[(o*e+y)*4]/255*c]);p.push([-1,-1,k[(t*e+y)*4]/255*c]);p.push([0,-1,k[(t*e+n)*4]/255*c]);p.push([1,-1,k[(t*e+v)*4]/255*c]);
-p.push([1,0,k[(o*e+v)*4]/255*c]);p.push([1,1,k[(u*e+v)*4]/255*c]);p.push([0,1,k[(u*e+n)*4]/255*c]);p.push([-1,1,k[(u*e+y)*4]/255*c]);t=[];y=p.length;for(u=0;u<y;u++){var v=p[u],w=p[(u+1)%y],v=[v[0]-z[0],v[1]-z[1],v[2]-z[2]],w=[w[0]-z[0],w[1]-z[1],w[2]-z[2]];t.push(b([v[1]*w[2]-v[2]*w[1],v[2]*w[0]-v[0]*w[2],v[0]*w[1]-v[1]*w[0]]))}p=[0,0,0];for(u=0;u<t.length;u++)p[0]+=t[u][0],p[1]+=t[u][1],p[2]+=t[u][2];p[0]/=t.length;p[1]/=t.length;p[2]/=t.length;z=(o*e+n)*4;m[z]=(p[0]+1)/2*255|0;m[z+1]=(p[1]+0.5)*
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,g=a.height,h=document.createElement("canvas");h.width=e;h.height=g;var f=h.getContext("2d");f.drawImage(a,0,0);for(var k=f.getImageData(0,0,e,g).data,l=f.createImageData(e,g),m=l.data,o=0;o<e;o++)for(var n=1;n<g;n++){var t=n-1<0?g-1:n-1,u=(n+1)%g,y=o-1<0?e-1:o-1,v=(o+1)%e,p=[],z=[0,0,k[(n*e+o)*4]/255*c];p.push([-1,0,k[(n*e+y)*4]/255*c]);p.push([-1,-1,k[(t*e+y)*4]/255*c]);p.push([0,-1,k[(t*e+o)*4]/255*c]);p.push([1,-1,k[(t*e+v)*4]/255*c]);
+p.push([1,0,k[(n*e+v)*4]/255*c]);p.push([1,1,k[(u*e+v)*4]/255*c]);p.push([0,1,k[(u*e+o)*4]/255*c]);p.push([-1,1,k[(u*e+y)*4]/255*c]);t=[];y=p.length;for(u=0;u<y;u++){var v=p[u],x=p[(u+1)%y],v=[v[0]-z[0],v[1]-z[1],v[2]-z[2]],x=[x[0]-z[0],x[1]-z[1],x[2]-z[2]];t.push(b([v[1]*x[2]-v[2]*x[1],v[2]*x[0]-v[0]*x[2],v[0]*x[1]-v[1]*x[0]]))}p=[0,0,0];for(u=0;u<t.length;u++)p[0]+=t[u][0],p[1]+=t[u][1],p[2]+=t[u][2];p[0]/=t.length;p[1]/=t.length;p[2]/=t.length;z=(n*e+o)*4;m[z]=(p[0]+1)/2*255|0;m[z+1]=(p[1]+0.5)*
 255|0;m[z+2]=p[2]*255|0;m[z+3]=255}f.putImageData(l,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,g=a.children.length;for(e=0;e<g;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
@@ -51,36 +51,36 @@ THREE.Path.prototype.quadraticCurveTo=function(a,c,b,e){var g=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,c,b,e,g,h){var f=Array.prototype.slice.call(arguments),k=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(k[k.length-2],k[k.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e),new THREE.Vector2(g,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
 THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
 THREE.Path.prototype.arc=function(a,c,b,e,g,h){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,g,h));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,g,h,f,k,l,m,n,o,t,u,y,v;e=0;for(g=this.actions.length;e<g;e++)switch(h=this.actions[e],f=h.action,h=h.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=h[2];l=h[3];o=h[0];t=h[1];b.length>0?(f=b[b.length-1],u=f.x,y=f.y):(f=this.actions[e-1].args,u=f[f.length-2],y=f[f.length-1]);for(f=1;f<=a;f++)v=f/a,h=THREE.Shape.Utils.b2(v,u,o,k),v=THREE.Shape.Utils.b2(v,y,t,
-l),b.push(new THREE.Vector2(h,v));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];l=h[5];o=h[0];t=h[1];m=h[2];n=h[3];b.length>0?(f=b[b.length-1],u=f.x,y=f.y):(f=this.actions[e-1].args,u=f[f.length-2],y=f[f.length-1]);for(f=1;f<=a;f++)v=f/a,h=THREE.Shape.Utils.b3(v,u,o,m,k),v=THREE.Shape.Utils.b3(v,y,t,n,l),b.push(new THREE.Vector2(h,v));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];v=a*h[0].length;f=f.concat(h[0]);h=new THREE.SplineCurve(f);
-for(f=1;f<=v;f++)b.push(h.getPointAt(f/v));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;k=h[0];l=h[1];m=h[2];o=h[3];v=h[4];t=!!h[5];n=f[f.length-2];u=f[f.length-1];f.length==0&&(n=u=0);y=v-o;var p=a*2;for(f=1;f<=p;f++)v=f/p,t||(v=1-v),v=o+v*y,h=n+k+m*Math.cos(v),v=u+l+m*Math.sin(v),b.push(new THREE.Vector2(h,v))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
-THREE.Path.prototype.nltransform=function(a,c,b,e,g,h){var f=this.getPoints(),k,l,m,n,o;k=0;for(l=f.length;k<l;k++)m=f[k],n=m.x,o=m.y,m.x=a*n+c*o+b,m.y=e*o+g*n+h;return f};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,g,h,f,k,l,m,o,n,t,u,y,v;e=0;for(g=this.actions.length;e<g;e++)switch(h=this.actions[e],f=h.action,h=h.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=h[2];l=h[3];n=h[0];t=h[1];b.length>0?(f=b[b.length-1],u=f.x,y=f.y):(f=this.actions[e-1].args,u=f[f.length-2],y=f[f.length-1]);for(f=1;f<=a;f++)v=f/a,h=THREE.Shape.Utils.b2(v,u,n,k),v=THREE.Shape.Utils.b2(v,y,t,
+l),b.push(new THREE.Vector2(h,v));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];l=h[5];n=h[0];t=h[1];m=h[2];o=h[3];b.length>0?(f=b[b.length-1],u=f.x,y=f.y):(f=this.actions[e-1].args,u=f[f.length-2],y=f[f.length-1]);for(f=1;f<=a;f++)v=f/a,h=THREE.Shape.Utils.b3(v,u,n,m,k),v=THREE.Shape.Utils.b3(v,y,t,o,l),b.push(new THREE.Vector2(h,v));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];v=a*h[0].length;f=f.concat(h[0]);h=new THREE.SplineCurve(f);
+for(f=1;f<=v;f++)b.push(h.getPointAt(f/v));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;k=h[0];l=h[1];m=h[2];n=h[3];v=h[4];t=!!h[5];o=f[f.length-2];u=f[f.length-1];f.length==0&&(o=u=0);y=v-n;var p=a*2;for(f=1;f<=p;f++)v=f/p,t||(v=1-v),v=n+v*y,h=o+k+m*Math.cos(v),v=u+l+m*Math.sin(v),b.push(new THREE.Vector2(h,v))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
+THREE.Path.prototype.nltransform=function(a,c,b,e,g,h){var f=this.getPoints(),k,l,m,o,n;k=0;for(l=f.length;k<l;k++)m=f[k],o=m.x,n=m.y,m.x=a*o+c*n+b,m.y=e*n+g*o+h;return f};
 THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,g,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],g=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";e=
 this.getPoints();a=0;for(b=e.length;a<b;a++)g=e[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,c,b,e,g=[],h=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],e=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(g.push(h),h=new THREE.Path),h[b].apply(h,e);h.actions.length!=0&&g.push(h);if(g.length==0)return[];var f,h=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(c=g.length;a<c;a++)e=g[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f&&h.push(f),f=new THREE.Shape,f.actions=e.actions,f.curves=
 e.curves):f.holes.push(e);h.push(f)}else{f=new THREE.Shape;a=0;for(c=g.length;a<c;a++)e=g[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f.actions=e.actions,f.curves=e.curves,h.push(f),f=new THREE.Shape):f.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 c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].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,c){var b=a.concat(),e=b.concat(),g,h,f,k,l,m,n,o,t,u,y=[];for(l=0;l<c.length;l++){m=c[l];Array.prototype.push.apply(e,m);h=Number.POSITIVE_INFINITY;for(g=0;g<m.length;g++){t=m[g];u=[];for(o=0;o<b.length;o++)n=b[o],n=t.distanceToSquared(n),u.push(n),n<h&&(h=n,f=g,k=o)}g=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:m.length-1;var v=[m[f],b[k],b[g]];o=THREE.FontUtils.Triangulate.area(v);var p=[m[f],m[h],b[k]];t=THREE.FontUtils.Triangulate.area(p);u=k;n=f;k+=1;f+=-1;k<
-0&&(k+=b.length);k%=b.length;f<0&&(f+=m.length);f%=m.length;g=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:m.length-1;v=[m[f],b[k],b[g]];v=THREE.FontUtils.Triangulate.area(v);p=[m[f],m[h],b[k]];p=THREE.FontUtils.Triangulate.area(p);o+t>v+p&&(k=u,f=n,k<0&&(k+=b.length),k%=b.length,f<0&&(f+=m.length),f%=m.length,g=k-1>=0?k-1:b.length-1,h=f-1>=0?f-1:m.length-1);o=b.slice(0,k);t=b.slice(k);u=m.slice(f);n=m.slice(0,f);h=[m[f],m[h],b[k]];y.push([m[f],b[k],b[g]]);y.push(h);b=o.concat(u).concat(n).concat(t)}return{shape:b,
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),g,h,f,k,l,m,o,n,t,u,y=[];for(l=0;l<c.length;l++){m=c[l];Array.prototype.push.apply(e,m);h=Number.POSITIVE_INFINITY;for(g=0;g<m.length;g++){t=m[g];u=[];for(n=0;n<b.length;n++)o=b[n],o=t.distanceToSquared(o),u.push(o),o<h&&(h=o,f=g,k=n)}g=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:m.length-1;var v=[m[f],b[k],b[g]];n=THREE.FontUtils.Triangulate.area(v);var p=[m[f],m[h],b[k]];t=THREE.FontUtils.Triangulate.area(p);u=k;o=f;k+=1;f+=-1;k<
+0&&(k+=b.length);k%=b.length;f<0&&(f+=m.length);f%=m.length;g=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:m.length-1;v=[m[f],b[k],b[g]];v=THREE.FontUtils.Triangulate.area(v);p=[m[f],m[h],b[k]];p=THREE.FontUtils.Triangulate.area(p);n+t>v+p&&(k=u,f=o,k<0&&(k+=b.length),k%=b.length,f<0&&(f+=m.length),f%=m.length,g=k-1>=0?k-1:b.length-1,h=f-1>=0?f-1:m.length-1);n=b.slice(0,k);t=b.slice(k);u=m.slice(f);o=m.slice(0,f);h=[m[f],m[h],b[k]];y.push([m[f],b[k],b[g]]);y.push(h);b=n.concat(u).concat(o).concat(t)}return{shape:b,
 isolatedPts:y,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),h,f,k,l,m={};h=0;for(f=e.length;h<f;h++)l=e[h].x+":"+e[h].y,m[l]!==void 0&&console.log("Duplicate point",l),m[l]=h;h=0;for(f=b.length;h<f;h++){k=b[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}h=0;for(f=g.length;h<f;h++){k=g[h];for(e=0;e<3;e++)l=k[e].x+":"+k[e].y,l=m[l],l!==void 0&&(k[e]=l)}return b.concat(g)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
 this.b3p3(a,g)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",h=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=g;THREE.FontUtils.style=h};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,e=a.length;b<e;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
 THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var e=0;e<a.hierarchy[b].keys.length;e++){if(a.hierarchy[b].keys[e].time<
-0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var k=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){k={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var l=0;l<a.hierarchy[b].keys[e].morphTargets.length;l++){var m=a.hierarchy[b].keys[e].morphTargets[l];k[m]=-1}a.hierarchy[b].usedMorphTargets=k;for(e=0;e<a.hierarchy[b].keys.length;e++){var n=
-{};for(m in k){for(l=0;l<a.hierarchy[b].keys[e].morphTargets.length;l++)if(a.hierarchy[b].keys[e].morphTargets[l]===m){n[m]=a.hierarchy[b].keys[e].morphTargetsInfluences[l];break}l===a.hierarchy[b].keys[e].morphTargets.length&&(n[m]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=n}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
+0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var k=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){k={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var l=0;l<a.hierarchy[b].keys[e].morphTargets.length;l++){var m=a.hierarchy[b].keys[e].morphTargets[l];k[m]=-1}a.hierarchy[b].usedMorphTargets=k;for(e=0;e<a.hierarchy[b].keys.length;e++){var o=
+{};for(m in k){for(l=0;l<a.hierarchy[b].keys[e].morphTargets.length;l++)if(a.hierarchy[b].keys[e].morphTargets[l]===m){o[m]=a.hierarchy[b].keys[e].morphTargetsInfluences[l];break}l===a.hierarchy[b].keys[e].morphTargets.length&&(o[m]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=o}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else e(a,b);return b}},e=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)e(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
 2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,e=this.hierarchy.length,g;for(b=0;b<e;b++){g=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
 THREE.Bone?g.skinMatrix:g.matrix;var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[b].keys[0];h.rot=this.data.hierarchy[b].keys[0];h.scl=this.data.hierarchy[b].keys[0];g.pos=this.getNextKeyWith("pos",b,1);g.rot=this.getNextKeyWith("rot",b,1);g.scl=this.getNextKeyWith("scl",b,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 c=["pos","rot","scl"],b,e,g,h,f,k,l,m,n=this.data.JIT.hierarchy,o,t;this.currentTime+=a*this.timeScale;t=this.currentTime;o=this.currentTime%=this.data.length;m=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,y=this.hierarchy.length;u<y;u++)if(a=this.hierarchy[u],l=a.animationCache,this.JITCompile&&n[u][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=n[u][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=n[u][m],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 v=0;v<3;v++){b=c[v];f=l.prevKey[b];k=l.nextKey[b];if(k.time<=t){if(o<t)if(this.loop){f=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(b,u,1);k.time<o;)f=k,k=this.getNextKeyWith(b,u,k.index+1)}else{this.stop();return}else{do f=k,k=this.getNextKeyWith(b,u,k.index+1);while(k.time<
-o)}l.prevKey[b]=f;l.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(o-f.time)/(k.time-f.time);g=f[b];h=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+u),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(h[0]-g[0])*e,b.y=g[1]+(h[1]-g[1])*e,b.z=g[2]+(h[2]-g[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,g,h,f,k,l,m,o=this.data.JIT.hierarchy,n,t;this.currentTime+=a*this.timeScale;t=this.currentTime;n=this.currentTime%=this.data.length;m=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,y=this.hierarchy.length;u<y;u++)if(a=this.hierarchy[u],l=a.animationCache,this.JITCompile&&o[u][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=o[u][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=o[u][m],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 v=0;v<3;v++){b=c[v];f=l.prevKey[b];k=l.nextKey[b];if(k.time<=t){if(n<t)if(this.loop){f=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(b,u,1);k.time<n;)f=k,k=this.getNextKeyWith(b,u,k.index+1)}else{this.stop();return}else{do f=k,k=this.getNextKeyWith(b,u,k.index+1);while(k.time<
+n)}l.prevKey[b]=f;l.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(n-f.time)/(k.time-f.time);g=f[b];h=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+u),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(h[0]-g[0])*e,b.y=g[1]+(h[1]-g[1])*e,b.z=g[2]+(h[2]-g[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",u,f.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos,e=e*0.33+0.33,g=this.interpolateCatmullRom(this.points,e),b.x=g[0],b.y=g[1],b.z=g[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(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
-"rot")THREE.Quaternion.slerp(g,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=g[0]+(h[0]-g[0])*e,b.y=g[1]+(h[1]-g[1])*e,b.z=g[2]+(h[2]-g[2])*e}}if(this.JITCompile&&n[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)n[u][m]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
+"rot")THREE.Quaternion.slerp(g,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=g[0]+(h[0]-g[0])*e,b.y=g[1]+(h[1]-g[1])*e,b.z=g[2]+(h[2]-g[2])*e}}if(this.JITCompile&&o[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)o[u][m]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],g,h,f,k,l,m;g=(a.length-1)*c;h=Math.floor(g);g-=h;b[0]=h==0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];k=a[b[1]];l=a[b[2]];m=a[b[3]];b=g*g;f=g*b;e[0]=this.interpolate(h[0],k[0],l[0],m[0],g,b,f);e[1]=this.interpolate(h[1],k[1],l[1],m[1],g,b,f);e[2]=this.interpolate(h[2],k[2],l[2],m[2],g,b,f);return e};
 THREE.Animation.prototype.interpolate=function(a,c,b,e,g,h,f){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*f+(-3*(c-b)-2*a-e)*h+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var e=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
@@ -99,15 +99,15 @@ a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=function(a){sw
 Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);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)/(Math.PI-0)+this.verticalMin;a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",
 b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a){function c(a,b,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,g=b.getControlPointsArray(),k=b.getLength(),l=g.length,w=0;h=l-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<l-1;h++)w=e*k.chunks[h]/k.total,b.keys[h]={time:w,pos:g[h]};f.hierarchy[0]=b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(a,b){var c,
-e,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}function e(a,c){var e=b(c,10),f=b(c,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,h);particleObj=new THREE.ParticleSystem(f,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);f=new THREE.SphereGeometry(1,
-16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)e=new THREE.Mesh(f,h),e.position.copy(c.points[i]),e.updateMatrix(),a.addChild(e)}this.object=a;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,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.domElement=document;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var g=Math.PI*2,h=Math.PI/180;this.update=function(a,b,
-c){var e,f;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%g;this.phi=e>=0?e:e+g;e=this.verticalAngleMap.srcRange;f=this.verticalAngleMap.dstRange;var k=f[1]-f[0];this.phi=TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(f[1]-f[0])/(e[1]-e[0])+f[0]-f[0])/k)*k+f[0];e=this.horizontalAngleMap.srcRange;
-f=this.horizontalAngleMap.dstRange;k=f[1]-f[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-e[0])*(f[1]-f[0])/(e[1]-e[0])+f[0]-f[0])/k)*k+f[0];e=this.target.position;e.x=100*Math.sin(this.phi)*Math.cos(this.theta);e.y=100*Math.cos(this.phi);e.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,a,b,c)};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-
-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};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}),f=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.CubeGeometry(10,10,20),l=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(k,a);a=new THREE.Mesh(l,f);a.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(a)}else this.animation=c(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,b){return function(){b.apply(a,arguments)}}(this,
-this.onMouseMove),!1)};THREE.PathCameraIdCounter=0;
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,g=b.getControlPointsArray(),k=b.getLength(),p=g.length,z=0;h=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<p-1;h++)z=e*k.chunks[h]/k.total,b.keys[h]={time:z,pos:g[h]};f.hierarchy[0]=
+b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var c,e,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;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,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
+this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,k=Math.PI/180;this.update=function(){var a,c;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)*k;this.theta=this.lon*k;a=this.phi%f;this.phi=a>=0?a:a+f;a=this.verticalAngleMap.srcRange;
+c=this.verticalAngleMap.dstRange;var e=c[1]-c[0];this.phi=b(((this.phi-a[0])*(c[1]-c[0])/(a[1]-a[0])+c[0]-c[0])/e)*e+c[0];a=this.horizontalAngleMap.srcRange;c=this.horizontalAngleMap.dstRange;e=c[1]-c[0];this.theta=b(((this.theta-a[0])*(c[1]-c[0])/(a[1]-a[0])+c[0]-c[0])/e)*e+c[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(a){this.domElement===
+document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){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}),b=new THREE.MeshLambertMaterial({color:65280}),
+c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
+this.debugPath,b=this.spline,c=h(b,10),f=h(b,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,k);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);f=new THREE.SphereGeometry(1,16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)c=new THREE.Mesh(f,k),c.position.copy(b.points[i]),a.add(c)}this.domElement.addEventListener("mousemove",
+e(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
 THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;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=
@@ -117,44 +117,44 @@ THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,argu
 1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||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);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var b=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Matrix4,f=!1,k=1,l=0,m=0,n=0,o=0,t=0,u=window.innerWidth/2,y=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*o),this.rotateVertically(a*t));a=this.delta*this.movementSpeed;this.object.translateZ(-a*(l>0||this.autoForward&&!(l<0)?1:l));this.object.translateX(a*m);this.object.translateY(a*n);f&&(this.roll+=this.rollSpeed*this.delta*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var b=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Matrix4,f=!1,k=1,l=0,m=0,o=0,n=0,t=0,u=window.innerWidth/2,y=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*n),this.rotateVertically(a*t));a=this.delta*this.movementSpeed;this.object.translateZ(-a*(l>0||this.autoForward&&!(l<0)?1:l));this.object.translateX(a*m);this.object.translateY(a*o);f&&(this.roll+=this.rollSpeed*this.delta*k);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);e.set(0,1,0);b.cross(e,g).normalize();e.cross(g,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=e.x;this.object.matrix.n13=g.x;this.object.matrix.n21=b.y;this.object.matrix.n22=e.y;this.object.matrix.n23=g.y;this.object.matrix.n31=b.z;this.object.matrix.n32=e.z;this.object.matrix.n33=g.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);
 h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*
 a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,
-this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-u)/window.innerWidth;t=(a.clientY-y)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",
-function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:l=1;break;case 37:case 65:m=-1;break;case 40:case 83:l=-1;break;case 39:case 68:m=1;break;case 81:f=!0;k=1;break;case 69:f=!0;k=-1;break;case 82:n=1;break;case 70:n=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:l=0;break;case 37:case 65:m=0;break;case 40:case 83:l=
-0;break;case 39:case 68:m=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:n=0;break;case 70:n=0}},!1)};
-THREE.TrackballControls=function(a){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=parameters.domElement||document;this.screen=parameters.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=parameters.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=parameters.rotateSpeed||1;this.zoomSpeed=parameters.zoomSpeed||1.2;this.panSpeed=parameters.panSpeed||0.3;this.noZoom=parameters.noZoom||!1;this.noPan=
-parameters.noPan||!1;this.staticMoving=parameters.staticMoving||!1;this.dynamicDampingFactor=parameters.dynamicDampingFactor||0.2;this.minDistance=parameters.minDistance||0;this.maxDistance=parameters.maxDistance||Infinity;this.keys=parameters.keys||[65,83,68];this.useTarget=!0;var b=!1,e=this.STATE.NONE,g=new THREE.Vector3,h=new THREE.Vector3,f=new THREE.Vector3,k=new THREE.Vector2,l=new THREE.Vector2,m=new THREE.Vector2,n=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};
-this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-this.screen.offsetLeft)/this.radius*0.5,(b-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var c=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-b)/this.radius,0),e=c.length();e>1?c.normalize():c.z=Math.sqrt(1-e*e);g=this.position.clone().subSelf(this.target.position);e=this.up.clone().setLength(c.y);e.addSelf(this.up.clone().crossSelf(g).setLength(c.x));
-e.addSelf(g.setLength(c.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(f)/h.length()/f.length());if(a){var b=(new THREE.Vector3).cross(h,f).normalize(),c=new THREE.Quaternion;a*=this.rotateSpeed;c.setFromAxisAngle(b,-a);c.multiplyVector3(g);c.multiplyVector3(this.up);c.multiplyVector3(f);this.staticMoving?h=f:(c.setFromAxisAngle(b,a*(this.dynamicDampingFactor-1)),c.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(l.y-k.y)*this.zoomSpeed;a!==1&&a>0&&(g.multiplyScalar(a),
-this.staticMoving?k=l:k.y+=(l.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=n.clone().subSelf(m);if(a.lengthSq()){a.multiplyScalar(g.length()*this.panSpeed);var b=g.clone().crossSelf(this.up).setLength(a.x);b.addSelf(this.up.clone().setLength(a.y));this.position.addSelf(b);this.target.position.addSelf(b);this.staticMoving?m=n:m.addSelf(a.sub(n,m).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*
-this.maxDistance&&this.position.setLength(this.maxDistance),g.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,g.setLength(this.minDistance))};this.update=function(a,b,c){g=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,g);this.checkDistances();this.supr.update.call(this,a,b,c)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},
-!1);this.domElement.addEventListener("mousemove",c(this,function(a){b&&(h=f=this.getMouseProjectionOnBall(a.clientX,a.clientY),k=l=this.getMouseOnScreen(a.clientX,a.clientY),m=n=this.getMouseOnScreen(a.clientX,a.clientY),b=!1);e!==this.STATE.NONE&&(e===this.STATE.ROTATE?f=this.getMouseProjectionOnBall(a.clientX,a.clientY):e===this.STATE.ZOOM&&!this.noZoom?l=this.getMouseOnScreen(a.clientX,a.clientY):e===this.STATE.PAN&&!this.noPan&&(n=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",
-c(this,function(a){a.preventDefault();a.stopPropagation();if(e===this.STATE.NONE)e=a.button,e===this.STATE.ROTATE?h=f=this.getMouseProjectionOnBall(a.clientX,a.clientY):e===this.STATE.ZOOM&&!this.noZoom?k=l=this.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(m=n=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(a){a.preventDefault();a.stopPropagation();e=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(a){if(e===
-this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])e=this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)e=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)e=this.STATE.PAN;e!==this.STATE.NONE&&(b=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(e!==this.STATE.NONE)e=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.CubeGeometry=function(a,c,b,e,g,h,f,k,l){function m(a,b,c,f,k,l,m,o){var u,t,y=e||1,v=g||1,F=k/2,J=l/2,L=n.vertices.length;if(a=="x"&&b=="y"||a=="y"&&b=="x")u="z";else if(a=="x"&&b=="z"||a=="z"&&b=="x")u="y",v=h||1;else if(a=="z"&&b=="y"||a=="y"&&b=="z")u="x",y=h||1;var N=y+1,K=v+1;k/=y;var P=l/v;for(t=0;t<K;t++)for(l=0;l<N;l++){var G=new THREE.Vector3;G[a]=(l*k-F)*c;G[b]=(t*P-J)*f;G[u]=m;n.vertices.push(new THREE.Vertex(G))}for(t=0;t<v;t++)for(l=0;l<y;l++)n.faces.push(new THREE.Face4(l+N*t+
-L,l+N*(t+1)+L,l+1+N*(t+1)+L,l+1+N*t+L,null,null,o)),n.faceVertexUvs[0].push([new THREE.UV(l/y,t/v),new THREE.UV(l/y,(t+1)/v),new THREE.UV((l+1)/y,(t+1)/v),new THREE.UV((l+1)/y,t/v)])}THREE.Geometry.call(this);var n=this,o=a/2,t=c/2,u=b/2,k=k?-1:1;if(f!==void 0)if(f instanceof Array)this.materials=f;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([f])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=void 0)for(var v in l)this.sides[v]!=void 0&&(this.sides[v]=
-l[v]);this.sides.px&&m("z","y",1*k,-1,b,c,-o,this.materials[0]);this.sides.nx&&m("z","y",-1*k,-1,b,c,o,this.materials[1]);this.sides.py&&m("x","z",1*k,1,a,b,t,this.materials[2]);this.sides.ny&&m("x","z",1*k,-1,a,b,-t,this.materials[3]);this.sides.pz&&m("x","y",1*k,-1,a,c,u,this.materials[4]);this.sides.nz&&m("x","y",-1*k,-1,a,c,-u,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){n=(a.clientX-u)/window.innerWidth;t=(a.clientY-y)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",
+function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:l=1;break;case 37:case 65:m=-1;break;case 40:case 83:l=-1;break;case 39:case 68:m=1;break;case 81:f=!0;k=1;break;case 69:f=!0;k=-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:l=0;break;case 37:case 65:m=0;break;case 40:case 83:l=
+0;break;case 39:case 68:m=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:o=0;break;case 70:o=0}},!1)};
+THREE.TrackballControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
+0,0);var e=!1,g=this.STATE.NONE,h=new THREE.Vector3,f=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector2,m=new THREE.Vector2,o=new THREE.Vector2,n=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-this.screen.offsetLeft)/this.radius*0.5,(b-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var c=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/
+this.radius,(this.screen.height*0.5+this.screen.offsetTop-b)/this.radius,0),e=c.length();e>1?c.normalize():c.z=Math.sqrt(1-e*e);h.copy(this.object.position).subSelf(this.target);e=this.object.up.clone().setLength(c.y);e.addSelf(this.object.up.clone().crossSelf(h).setLength(c.x));e.addSelf(h.setLength(c.z));return e};this.rotateCamera=function(){var a=Math.acos(f.dot(k)/f.length()/k.length());if(a){var b=(new THREE.Vector3).cross(f,k).normalize(),c=new THREE.Quaternion;a*=this.rotateSpeed;c.setFromAxisAngle(b,
+-a);c.multiplyVector3(h);c.multiplyVector3(this.object.up);c.multiplyVector3(k);this.staticMoving?f=k:(c.setFromAxisAngle(b,a*(this.dynamicDampingFactor-1)),c.multiplyVector3(f))}};this.zoomCamera=function(){var a=1+(m.y-l.y)*this.zoomSpeed;a!==1&&a>0&&(h.multiplyScalar(a),this.staticMoving?l=m:l.y+=(m.y-l.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=n.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(h.length()*this.panSpeed);var b=h.clone().crossSelf(this.object.up).setLength(a.x);
+b.addSelf(this.object.up.clone().setLength(a.y));this.object.position.addSelf(b);this.target.addSelf(b);this.staticMoving?o=n:o.addSelf(a.sub(n,o).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.object.position.lengthSq()>this.maxDistance*this.maxDistance&&this.object.position.setLength(this.maxDistance),h.lengthSq()<this.minDistance*this.minDistance&&this.object.position.add(this.target,h.setLength(this.minDistance))};this.update=function(){h.copy(this.object.position).subSelf(this.target);
+this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.object.position.add(this.target,h);this.checkDistances();this.object.lookAt(this.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,function(a){e&&(f=k=this.getMouseProjectionOnBall(a.clientX,a.clientY),l=m=this.getMouseOnScreen(a.clientX,a.clientY),o=n=this.getMouseOnScreen(a.clientX,a.clientY),e=!1);g!==this.STATE.NONE&&
+(g===this.STATE.ROTATE?k=this.getMouseProjectionOnBall(a.clientX,a.clientY):g===this.STATE.ZOOM&&!this.noZoom?m=this.getMouseOnScreen(a.clientX,a.clientY):g===this.STATE.PAN&&!this.noPan&&(n=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",b(this,function(a){a.preventDefault();a.stopPropagation();if(g===this.STATE.NONE)g=a.button,g===this.STATE.ROTATE?f=k=this.getMouseProjectionOnBall(a.clientX,a.clientY):g===this.STATE.ZOOM&&!this.noZoom?l=m=this.getMouseOnScreen(a.clientX,
+a.clientY):this.noPan||(o=n=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",b(this,function(a){a.preventDefault();a.stopPropagation();g=this.STATE.NONE}),!1);window.addEventListener("keydown",b(this,function(a){if(g===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])g=this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)g=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)g=this.STATE.PAN;g!==
+this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",b(this,function(){if(g!==this.STATE.NONE)g=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
+THREE.CubeGeometry=function(a,c,b,e,g,h,f,k,l){function m(a,b,c,f,k,l,m,n){var u,t,y=e||1,v=g||1,F=k/2,J=l/2,L=o.vertices.length;if(a=="x"&&b=="y"||a=="y"&&b=="x")u="z";else if(a=="x"&&b=="z"||a=="z"&&b=="x")u="y",v=h||1;else if(a=="z"&&b=="y"||a=="y"&&b=="z")u="x",y=h||1;var N=y+1,K=v+1;k/=y;var P=l/v;for(t=0;t<K;t++)for(l=0;l<N;l++){var G=new THREE.Vector3;G[a]=(l*k-F)*c;G[b]=(t*P-J)*f;G[u]=m;o.vertices.push(new THREE.Vertex(G))}for(t=0;t<v;t++)for(l=0;l<y;l++)o.faces.push(new THREE.Face4(l+N*t+
+L,l+N*(t+1)+L,l+1+N*(t+1)+L,l+1+N*t+L,null,null,n)),o.faceVertexUvs[0].push([new THREE.UV(l/y,t/v),new THREE.UV(l/y,(t+1)/v),new THREE.UV((l+1)/y,(t+1)/v),new THREE.UV((l+1)/y,t/v)])}THREE.Geometry.call(this);var o=this,n=a/2,t=c/2,u=b/2,k=k?-1:1;if(f!==void 0)if(f instanceof Array)this.materials=f;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([f])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=void 0)for(var v in l)this.sides[v]!=void 0&&(this.sides[v]=
+l[v]);this.sides.px&&m("z","y",1*k,-1,b,c,-n,this.materials[0]);this.sides.nx&&m("z","y",-1*k,-1,b,c,n,this.materials[1]);this.sides.py&&m("x","z",1*k,1,a,b,t,this.materials[2]);this.sides.ny&&m("x","z",1*k,-1,a,b,-t,this.materials[3]);this.sides.pz&&m("x","y",1*k,-1,a,c,u,this.materials[4]);this.sides.nz&&m("x","y",-1*k,-1,a,c,-u,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,c,b,e,g,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,e=e||8,g=g||1,k,l,m=[],n=[];for(l=0;l<=g;l++){var o=[],t=[],u=l/g,y=u*(c-a)+a;for(k=0;k<=e;k++){var v=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(v*Math.PI*2),-u*b+f,y*Math.cos(v*Math.PI*2))));o.push(this.vertices.length-1);t.push(new THREE.UV(v,u))}m.push(o);n.push(t)}for(l=0;l<g;l++)for(k=0;k<e;k++){var b=m[l][k],o=m[l+1][k],t=m[l+1][k+1],u=m[l][k+1],y=
-this.vertices[b].position.clone().setY(0).normalize(),v=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[t].position.clone().setY(0).normalize(),z=this.vertices[u].position.clone().setY(0).normalize(),w=n[l][k].clone(),x=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(b,o,t,u,[y,v,p,z]));this.faceVertexUvs[0].push([w,x,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(k=0;k<e;k++)b=m[0][k],o=m[0][k+
-1],t=this.vertices.length-1,y=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),w=n[0][k].clone(),x=n[0][k+1].clone(),A=new THREE.UV(x.u,0),this.faces.push(new THREE.Face3(b,o,t,[y,v,p])),this.faceVertexUvs[0].push([w,x,A])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(k=0;k<e;k++)b=m[l][k+1],o=m[l][k],t=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),w=n[l][k+1].clone(),x=n[l][k].clone(),
-A=new THREE.UV(x.u,1),this.faces.push(new THREE.Face3(b,o,t,[y,v,p])),this.faceVertexUvs[0].push([w,x,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,c,b,e,g,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,e=e||8,g=g||1,k,l,m=[],o=[];for(l=0;l<=g;l++){var n=[],t=[],u=l/g,y=u*(c-a)+a;for(k=0;k<=e;k++){var v=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(v*Math.PI*2),-u*b+f,y*Math.cos(v*Math.PI*2))));n.push(this.vertices.length-1);t.push(new THREE.UV(v,u))}m.push(n);o.push(t)}for(l=0;l<g;l++)for(k=0;k<e;k++){var b=m[l][k],n=m[l+1][k],t=m[l+1][k+1],u=m[l][k+1],y=
+this.vertices[b].position.clone().setY(0).normalize(),v=this.vertices[n].position.clone().setY(0).normalize(),p=this.vertices[t].position.clone().setY(0).normalize(),z=this.vertices[u].position.clone().setY(0).normalize(),x=o[l][k].clone(),w=o[l+1][k].clone(),A=o[l+1][k+1].clone(),D=o[l][k+1].clone();this.faces.push(new THREE.Face4(b,n,t,u,[y,v,p,z]));this.faceVertexUvs[0].push([x,w,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(k=0;k<e;k++)b=m[0][k],n=m[0][k+
+1],t=this.vertices.length-1,y=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),x=o[0][k].clone(),w=o[0][k+1].clone(),A=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(b,n,t,[y,v,p])),this.faceVertexUvs[0].push([x,w,A])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(k=0;k<e;k++)b=m[l][k+1],n=m[l][k],t=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),x=o[l][k+1].clone(),w=o[l][k].clone(),
+A=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(b,n,t,[y,v,p])),this.faceVertexUvs[0].push([x,w,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,c){if(typeof a!="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,g;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)g=a[b],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,l=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);e=e.normalize();f=f.normalize();h.set(-e.y,e.x);g.set(f.y,-f.x);k.copy(a).addSelf(h);l.copy(a).addSelf(g);if(k.equals(l))return g.clone();
 k.copy(b).addSelf(h);l.copy(c).addSelf(g);h=e.dot(g);g=l.subSelf(k).dot(g);h==0&&(console.log("Either infinite or no solutions!"),g==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=h;if(g<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(g).addSelf(k).subSelf(a).clone()}function g(a){for(C=a.length;--C>=0;){T=C;R=C-1;R<0&&(R=a.length-
-1);for(var b=0,c=u+n*2,b=0;b<c;b++){var e=P*b,f=P*(b+1),h=Q+T+e,g=Q+T+f,m=h,e=Q+R+e,f=Q+R+f,o=g;m+=M;e+=M;f+=M;o+=M;H.faces.push(new THREE.Face4(m,e,f,o,null,null,A));A&&(m=b/c,e=(b+1)/c,f=k+l*2,h=(H.vertices[h].position.z+l)/f,g=(H.vertices[g].position.z+l)/f,H.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(g,m),new THREE.UV(g,e),new THREE.UV(h,e)]))}}}function h(a,b,c){H.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=M;b+=M;c+=M;H.faces.push(new THREE.Face3(a,
-b,c,null,null,x));if(x){var e=D.maxY,f=D.maxX,h=H.vertices[b].position.x,b=H.vertices[b].position.y,g=H.vertices[c].position.x,c=H.vertices[c].position.y;H.faceVertexUvs[0].push([new THREE.UV(H.vertices[a].position.x/f,H.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(g/f,c/e)])}}var k=c.amount!==void 0?c.amount:100,l=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:l-2,n=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,t=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,y=c.bendPath,v=c.extrudePath,p,z=!1,w=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,x=c.material,A=c.extrudeMaterial,D=this.shapebb;if(v)p=v.getPoints(t),u=p.length,z=!0,o=!1;o||(m=l=n=0);var B,E,I,H=this,M=this.vertices.length;y&&a.addWrapPath(y);t=w?a.extractAllSpacedPoints(t):a.extractAllPoints(t);y=t.shape;t=t.holes;if(v=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();E=0;for(I=t.length;E<I;E++)B=t[E],THREE.Shape.Utils.isClockWise(B)&&
-(t[E]=B.reverse());v=!1}v=THREE.Shape.Utils.triangulateShape(y,t);w=y;E=0;for(I=t.length;E<I;E++)B=t[E],y=y.concat(B);var C,F,J,L,N,K,P=y.length,G=v.length,S=[];C=0;F=w.length;T=F-1;for(R=C+1;C<F;C++,T++,R++)T==F&&(T=0),R==F&&(R=0),S[C]=e(w[C],w[T],w[R]);var O=[],U,V=S.concat();E=0;for(I=t.length;E<I;E++){B=t[E];U=[];C=0;F=B.length;T=F-1;for(R=C+1;C<F;C++,T++,R++)T==F&&(T=0),R==F&&(R=0),U[C]=e(B[C],B[T],B[R]);O.push(U);V=V.concat(U)}for(J=0;J<n;J++){L=J/n;N=l*(1-L);L=m*Math.sin(L*Math.PI/2);C=0;for(F=
-w.length;C<F;C++)K=b(w[C],S[C],L),h(K.x,K.y,-N);E=0;for(I=t.length;E<I;E++){B=t[E];U=O[E];C=0;for(F=B.length;C<F;C++)K=b(B[C],U[C],L),h(K.x,K.y,-N)}}L=m;for(C=0;C<P;C++)K=o?b(y[C],V[C],L):y[C],z?h(K.x,K.y+p[0].y,p[0].x):h(K.x,K.y,0);for(J=1;J<=u;J++)for(C=0;C<P;C++)K=o?b(y[C],V[C],L):y[C],z?h(K.x,K.y+p[J-1].y,p[J-1].x):h(K.x,K.y,k/u*J);for(J=n-1;J>=0;J--){L=J/n;N=l*(1-L);L=m*Math.sin(L*Math.PI/2);C=0;for(F=w.length;C<F;C++)K=b(w[C],S[C],L),h(K.x,K.y,k+N);E=0;for(I=t.length;E<I;E++){B=t[E];U=O[E];
-C=0;for(F=B.length;C<F;C++)K=b(B[C],U[C],L),z?h(K.x,K.y+p[u-1].y,p[u-1].x+N):h(K.x,K.y,k+N)}}if(o){o=P*0;for(C=0;C<G;C++)m=v[C],f(m[2]+o,m[1]+o,m[0]+o);o=P*(u+n*2);for(C=0;C<G;C++)m=v[C],f(m[0]+o,m[1]+o,m[2]+o)}else{for(C=0;C<G;C++)m=v[C],f(m[2],m[1],m[0]);for(C=0;C<G;C++)m=v[C],f(m[0]+P*u,m[1]+P*u,m[2]+P*u)}var T,R,Q=0;g(w);Q+=w.length;E=0;for(I=t.length;E<I;E++)B=t[E],g(B),Q+=B.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+1);for(var b=0,c=u+o*2,b=0;b<c;b++){var e=P*b,f=P*(b+1),h=Q+T+e,g=Q+T+f,m=h,e=Q+R+e,f=Q+R+f,n=g;m+=M;e+=M;f+=M;n+=M;H.faces.push(new THREE.Face4(m,e,f,n,null,null,A));A&&(m=b/c,e=(b+1)/c,f=k+l*2,h=(H.vertices[h].position.z+l)/f,g=(H.vertices[g].position.z+l)/f,H.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(g,m),new THREE.UV(g,e),new THREE.UV(h,e)]))}}}function h(a,b,c){H.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=M;b+=M;c+=M;H.faces.push(new THREE.Face3(a,
+b,c,null,null,w));if(w){var e=D.maxY,f=D.maxX,h=H.vertices[b].position.x,b=H.vertices[b].position.y,g=H.vertices[c].position.x,c=H.vertices[c].position.y;H.faceVertexUvs[0].push([new THREE.UV(H.vertices[a].position.x/f,H.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(g/f,c/e)])}}var k=c.amount!==void 0?c.amount:100,l=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:l-2,o=c.bevelSegments!==void 0?c.bevelSegments:3,n=c.bevelEnabled!==void 0?c.bevelEnabled:
+!0,t=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,y=c.bendPath,v=c.extrudePath,p,z=!1,x=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,w=c.material,A=c.extrudeMaterial,D=this.shapebb;if(v)p=v.getPoints(t),u=p.length,z=!0,n=!1;n||(m=l=o=0);var B,E,I,H=this,M=this.vertices.length;y&&a.addWrapPath(y);t=x?a.extractAllSpacedPoints(t):a.extractAllPoints(t);y=t.shape;t=t.holes;if(v=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();E=0;for(I=t.length;E<I;E++)B=t[E],THREE.Shape.Utils.isClockWise(B)&&
+(t[E]=B.reverse());v=!1}v=THREE.Shape.Utils.triangulateShape(y,t);x=y;E=0;for(I=t.length;E<I;E++)B=t[E],y=y.concat(B);var C,F,J,L,N,K,P=y.length,G=v.length,S=[];C=0;F=x.length;T=F-1;for(R=C+1;C<F;C++,T++,R++)T==F&&(T=0),R==F&&(R=0),S[C]=e(x[C],x[T],x[R]);var O=[],U,V=S.concat();E=0;for(I=t.length;E<I;E++){B=t[E];U=[];C=0;F=B.length;T=F-1;for(R=C+1;C<F;C++,T++,R++)T==F&&(T=0),R==F&&(R=0),U[C]=e(B[C],B[T],B[R]);O.push(U);V=V.concat(U)}for(J=0;J<o;J++){L=J/o;N=l*(1-L);L=m*Math.sin(L*Math.PI/2);C=0;for(F=
+x.length;C<F;C++)K=b(x[C],S[C],L),h(K.x,K.y,-N);E=0;for(I=t.length;E<I;E++){B=t[E];U=O[E];C=0;for(F=B.length;C<F;C++)K=b(B[C],U[C],L),h(K.x,K.y,-N)}}L=m;for(C=0;C<P;C++)K=n?b(y[C],V[C],L):y[C],z?h(K.x,K.y+p[0].y,p[0].x):h(K.x,K.y,0);for(J=1;J<=u;J++)for(C=0;C<P;C++)K=n?b(y[C],V[C],L):y[C],z?h(K.x,K.y+p[J-1].y,p[J-1].x):h(K.x,K.y,k/u*J);for(J=o-1;J>=0;J--){L=J/o;N=l*(1-L);L=m*Math.sin(L*Math.PI/2);C=0;for(F=x.length;C<F;C++)K=b(x[C],S[C],L),h(K.x,K.y,k+N);E=0;for(I=t.length;E<I;E++){B=t[E];U=O[E];
+C=0;for(F=B.length;C<F;C++)K=b(B[C],U[C],L),z?h(K.x,K.y+p[u-1].y,p[u-1].x+N):h(K.x,K.y,k+N)}}if(n){n=P*0;for(C=0;C<G;C++)m=v[C],f(m[2]+n,m[1]+n,m[0]+n);n=P*(u+o*2);for(C=0;C<G;C++)m=v[C],f(m[0]+n,m[1]+n,m[2]+n)}else{for(C=0;C<G;C++)m=v[C],f(m[2],m[1],m[0]);for(C=0;C<G;C++)m=v[C],f(m[0]+P*u,m[1]+P*u,m[2]+P*u)}var T,R,Q=0;g(x);Q+=x.length;E=0;for(I=t.length;E<I;E++)B=t[E],g(B),Q+=B.length};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 c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=g.vertices[a].position,f=g.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
--a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,l,n,a);b(h.faces[k].b,m,
-l,a);b(h.faces[k].c,n,m,a);b(l,m,n,a)}h.faces=a.faces}g.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),o=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,l,o,a);b(h.faces[k].b,m,
+l,a);b(h.faces[k].c,o,m,a);b(l,m,o,a)}h.faces=a.faces}g.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,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],g=[],h=[],f=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var l=0;l<=this.angle+0.0010;l+=c){for(k=0;k<b.length;k++)l<this.angle?(b[k]=f.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),g[k]=this.vertices.length-1):g=h;l==0&&(h=e);
 for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(g[k],g[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-l/this.angle,k/a.length),new THREE.UV(1-l/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,k/a.length)]);e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,k){k<1?(k=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),k.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),k.normal=k.centroid.clone().normalize(),
@@ -163,57 +163,57 @@ f.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),f.faceVertexUvs[0].push
 c);this.boundingSphere={radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var g,h=a/2,f=c/2,b=b||1,e=e||1,k=b+1,l=e+1;a/=b;var m=c/e;for(g=0;g<l;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(g*m-f),0)));for(g=0;g<e;g++)for(c=0;c<b;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/b,g/e),new THREE.UV(c/b,(g+1)/e),new THREE.UV((c+1)/b,(g+1)/e),new THREE.UV((c+1)/b,g/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,g=Math.PI,h=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){e=b/f;var k=a*Math.cos(e*g),l=a*Math.sin(e*g),m=[],n=0;for(e=0;e<h;e++){var o=2*e/h,t=l*Math.sin(o*g),o=l*Math.cos(o*g);(b==0||b==f)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,k,t)))-1);m.push(n)}c.push(m)}for(var u,y,v,g=c.length,b=0;b<g;b++)if(h=c[b].length,b>0)for(e=0;e<h;e++){m=e==h-1;f=c[b][m?0:e+1];k=c[b][m?h-1:e];l=c[b-1][m?
-h-1:e];m=c[b-1][m?0:e+1];t=b/(g-1);u=(b-1)/(g-1);y=(e+1)/h;var o=e/h,n=new THREE.UV(1-y,t),t=new THREE.UV(1-o,t),o=new THREE.UV(1-o,u),p=new THREE.UV(1-y,u);b<c.length-1&&(u=this.vertices[f].position.clone(),y=this.vertices[k].position.clone(),v=this.vertices[l].position.clone(),u.normalize(),y.normalize(),v.normalize(),this.faces.push(new THREE.Face3(f,k,l,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([n,t,o]));b>1&&(u=
-this.vertices[f].position.clone(),y=this.vertices[l].position.clone(),v=this.vertices[m].position.clone(),u.normalize(),y.normalize(),v.normalize(),this.faces.push(new THREE.Face3(f,l,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([n,o,p]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,g=Math.PI,h=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){e=b/f;var k=a*Math.cos(e*g),l=a*Math.sin(e*g),m=[],o=0;for(e=0;e<h;e++){var n=2*e/h,t=l*Math.sin(n*g),n=l*Math.cos(n*g);(b==0||b==f)&&e>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,k,t)))-1);m.push(o)}c.push(m)}for(var u,y,v,g=c.length,b=0;b<g;b++)if(h=c[b].length,b>0)for(e=0;e<h;e++){m=e==h-1;f=c[b][m?0:e+1];k=c[b][m?h-1:e];l=c[b-1][m?
+h-1:e];m=c[b-1][m?0:e+1];t=b/(g-1);u=(b-1)/(g-1);y=(e+1)/h;var n=e/h,o=new THREE.UV(1-y,t),t=new THREE.UV(1-n,t),n=new THREE.UV(1-n,u),p=new THREE.UV(1-y,u);b<c.length-1&&(u=this.vertices[f].position.clone(),y=this.vertices[k].position.clone(),v=this.vertices[l].position.clone(),u.normalize(),y.normalize(),v.normalize(),this.faces.push(new THREE.Face3(f,k,l,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([o,t,n]));b>1&&(u=
+this.vertices[f].position.clone(),y=this.vertices[l].position.clone(),v=this.vertices[m].position.clone(),u.normalize(),y.normalize(),v.normalize(),this.faces.push(new THREE.Face3(f,l,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([o,n,p]))}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,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};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,c){return(new TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=
-this.getFace(),b=this.size/c.resolution,e=0,g=String(a).split(""),h=g.length,f=[],a=0;a<h;a++){var k=new THREE.Path,k=this.extractGlyphPoints(g[a],c,b,e,k);e+=k.offset;f.push(k.path)}return{paths:f,offset:e/2}},extractGlyphPoints:function(a,c,b,e,g){var h=[],f,k,l,m,n,o,t,u,y,v,p=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(p){if(p.o){c=p._cachedOutline||(p._cachedOutline=p.o.split(" "));l=c.length;for(a=0;a<l;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,
-m));g.moveTo(k,m);break;case "l":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,m));g.lineTo(k,m);break;case "q":k=c[a++]*b+e;m=c[a++]*b;t=c[a++]*b+e;u=c[a++]*b;g.quadraticCurveTo(t,u,k,m);if(f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var z=f/divisions,w=THREE.Shape.Utils.b2(z,n,t,k),z=THREE.Shape.Utils.b2(z,o,u,m);h.push(new THREE.Vector2(w,z))}}break;case "b":if(k=c[a++]*b+e,m=c[a++]*b,t=c[a++]*b+e,u=c[a++]*-b,y=c[a++]*b+e,v=c[a++]*-b,g.bezierCurveTo(k,m,
-t,u,y,v),f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)z=f/divisions,w=THREE.Shape.Utils.b3(z,n,t,y,k),z=THREE.Shape.Utils.b3(z,o,u,v,m),h.push(new THREE.Vector2(w,z))}}}return{offset:p.ha*b,points:h,path:g}}}};
-(function(a){var c=function(a){for(var c=a.length,g=0,h=c-1,f=0;f<c;h=f++)g+=a[h].x*a[f].y-a[f].x*a[h].y;return g*0.5};a.Triangulate=function(a,e){var g=a.length;if(g<3)return null;var h=[],f=[],k=[],l,m,n;if(c(a)>0)for(m=0;m<g;m++)f[m]=m;else for(m=0;m<g;m++)f[m]=g-1-m;var o=2*g;for(m=g-1;g>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;g<=l&&(l=0);m=l+1;g<=m&&(m=0);n=m+1;g<=n&&(n=0);var t;a:{t=a;var u=l,y=m,v=n,p=g,z=f,w=void 0,x=void 0,A=void 0,
-D=void 0,B=void 0,E=void 0,I=void 0,H=void 0,M=void 0,x=t[z[u]].x,A=t[z[u]].y,D=t[z[y]].x,B=t[z[y]].y,E=t[z[v]].x,I=t[z[v]].y;if(1.0E-10>(D-x)*(I-A)-(B-A)*(E-x))t=!1;else{for(w=0;w<p;w++)if(!(w==u||w==y||w==v)){var H=t[z[w]].x,M=t[z[w]].y,C=void 0,F=void 0,J=void 0,L=void 0,N=void 0,K=void 0,P=void 0,G=void 0,S=void 0,O=void 0,U=void 0,V=void 0,C=J=N=void 0,C=E-D,F=I-B,J=x-E,L=A-I,N=D-x,K=B-A,P=H-x,G=M-A,S=H-D,O=M-B,U=H-E,V=M-I,C=C*O-F*S,N=N*G-K*P,J=J*V-L*U;if(C>=0&&J>=0&&N>=0){t=!1;break a}}t=!0}}if(t){h.push([a[f[l]],
-a[f[m]],a[f[n]]]);k.push([f[l],f[m],f[n]]);l=m;for(n=m+1;n<g;l++,n++)f[l]=f[n];g--;o=2*g}}if(e)return k;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+this.getFace(),b=this.size/c.resolution,e=0,g=String(a).split(""),h=g.length,f=[],a=0;a<h;a++){var k=new THREE.Path,k=this.extractGlyphPoints(g[a],c,b,e,k);e+=k.offset;f.push(k.path)}return{paths:f,offset:e/2}},extractGlyphPoints:function(a,c,b,e,g){var h=[],f,k,l,m,o,n,t,u,y,v,p=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(p){if(p.o){c=p._cachedOutline||(p._cachedOutline=p.o.split(" "));l=c.length;for(a=0;a<l;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,
+m));g.moveTo(k,m);break;case "l":k=c[a++]*b+e;m=c[a++]*b;h.push(new THREE.Vector2(k,m));g.lineTo(k,m);break;case "q":k=c[a++]*b+e;m=c[a++]*b;t=c[a++]*b+e;u=c[a++]*b;g.quadraticCurveTo(t,u,k,m);if(f=h[h.length-1]){o=f.x;n=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var z=f/divisions,x=THREE.Shape.Utils.b2(z,o,t,k),z=THREE.Shape.Utils.b2(z,n,u,m);h.push(new THREE.Vector2(x,z))}}break;case "b":if(k=c[a++]*b+e,m=c[a++]*b,t=c[a++]*b+e,u=c[a++]*-b,y=c[a++]*b+e,v=c[a++]*-b,g.bezierCurveTo(k,m,
+t,u,y,v),f=h[h.length-1]){o=f.x;n=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)z=f/divisions,x=THREE.Shape.Utils.b3(z,o,t,y,k),z=THREE.Shape.Utils.b3(z,n,u,v,m),h.push(new THREE.Vector2(x,z))}}}return{offset:p.ha*b,points:h,path:g}}}};
+(function(a){var c=function(a){for(var c=a.length,g=0,h=c-1,f=0;f<c;h=f++)g+=a[h].x*a[f].y-a[f].x*a[h].y;return g*0.5};a.Triangulate=function(a,e){var g=a.length;if(g<3)return null;var h=[],f=[],k=[],l,m,o;if(c(a)>0)for(m=0;m<g;m++)f[m]=m;else for(m=0;m<g;m++)f[m]=g-1-m;var n=2*g;for(m=g-1;g>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;g<=l&&(l=0);m=l+1;g<=m&&(m=0);o=m+1;g<=o&&(o=0);var t;a:{t=a;var u=l,y=m,v=o,p=g,z=f,x=void 0,w=void 0,A=void 0,
+D=void 0,B=void 0,E=void 0,I=void 0,H=void 0,M=void 0,w=t[z[u]].x,A=t[z[u]].y,D=t[z[y]].x,B=t[z[y]].y,E=t[z[v]].x,I=t[z[v]].y;if(1.0E-10>(D-w)*(I-A)-(B-A)*(E-w))t=!1;else{for(x=0;x<p;x++)if(!(x==u||x==y||x==v)){var H=t[z[x]].x,M=t[z[x]].y,C=void 0,F=void 0,J=void 0,L=void 0,N=void 0,K=void 0,P=void 0,G=void 0,S=void 0,O=void 0,U=void 0,V=void 0,C=J=N=void 0,C=E-D,F=I-B,J=w-E,L=A-I,N=D-w,K=B-A,P=H-w,G=M-A,S=H-D,O=M-B,U=H-E,V=M-I,C=C*O-F*S,N=N*G-K*P,J=J*V-L*U;if(C>=0&&J>=0&&N>=0){t=!1;break a}}t=!0}}if(t){h.push([a[f[l]],
+a[f[m]],a[f[o]]]);k.push([f[l],f[m],f[o]]);l=m;for(o=m+1;o<g;l++,o++)f[l]=f[o];g--;n=2*g}}if(e)return k;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,c,b,e,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(h);g.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(f))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(f))*Math.sin(h);k.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(k.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var g=(this.segmentsT+1)*b+e-1,h=(this.segmentsT+1)*(b-1)+e-1,f=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,l=new THREE.Face4(g,h,f,k,[c[g],c[h],c[f],c[k]]);l.normal.addSelf(c[g]);l.normal.addSelf(c[h]);l.normal.addSelf(c[f]);l.normal.addSelf(c[k]);l.normal.normalize();this.faces.push(l);
 this.faceVertexUvs[0].push([a[g].clone(),a[h].clone(),a[f].clone(),a[k].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(a,c,b,e,g,h,f){function k(a,b,c,e,f,h){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(f*(2+c)*0.5*Math.cos(a),f*(2+c)*Math.sin(a)*0.5,h*f*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=g||2;this.q=h||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
 this.segmentsT;++c){var l=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,g=k(l,f,this.q,this.p,this.radius,this.heightScale),l=k(l+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=l.x-g.x;b.y=l.y-g.y;b.z=l.z-g.z;e.x=l.x+g.x;e.y=l.y+g.y;e.z=l.z+g.z;h.cross(b,e);e.cross(h,b);h.normalize();e.normalize();l=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=l*e.x+f*h.x;g.y+=l*e.y+f*h.y;g.z+=l*e.z+f*h.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
-g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,h=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][h],h=this.grid[a][h],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),m=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,e,h));this.faceVertexUvs[0].push([f,l,m,n])}this.computeCentroids();
+g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,h=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][h],h=this.grid[a][h],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),m=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),o=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,e,h));this.faceVertexUvs[0].push([f,l,m,o])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c--;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k){var l=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(f.useOldVertexColors)l.vertexColors=k.vertexColors;g.push(l);(!f.supportUVs||o.length!=0)&&h.push([o[a],o[b],o[c],o[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}var e=[],g=[],h=[],f=this,k=a.vertices,e=a.faces,l=k.concat(),m=[],n={},o=[],t,u,y,v,p,z=a.faceVertexUvs[0];t=0;for(u=z.length;t<u;t++){y=0;for(v=z[t].length;y<v;y++)p=e[t]["abcd".charAt(y)],
-o[p]||(o[p]=z[t][y])}var w;t=0;for(u=e.length;t<u;t++)if(p=e[t],m.push(p.centroid),l.push(new THREE.Vertex(p.centroid)),f.supportUVs&&o.length!=0){w=new THREE.UV;if(p instanceof THREE.Face3)w.u=o[p.a].u+o[p.b].u+o[p.c].u,w.v=o[p.a].v+o[p.b].v+o[p.c].v,w.u/=3,w.v/=3;else if(p instanceof THREE.Face4)w.u=o[p.a].u+o[p.b].u+o[p.c].u+o[p.d].u,w.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,w.u/=4,w.v/=4;o.push(w)}v=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,g,k={};e=0;for(f=a.faces.length;e<
-f;e++)h=a.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.c,h.a),c(k,g,e)):h instanceof THREE.Face4&&(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.d),c(k,g,e),g=b(h.d,h.a),c(k,g,e));return k}(a);var x,A,D=0,z=k.length,B;for(t in v)if(p=v[t],w=p[0],x=p[1],A=new THREE.Vector3,p.length!=2)console.log("warning, edge fail",p);else if(A.addSelf(m[w]),A.addSelf(m[x]),B=t.split("_"),u=B[0],B=B[1],A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.25),
-n[t]=z+e.length+D,l.push(new THREE.Vertex(A)),D++,f.supportUVs&&o.length!=0)w=new THREE.UV,w.u=o[u].u+o[B].u,w.v=o[u].v+o[B].v,w.u/=2,w.v/=2,o.push(w);t=0;for(u=m.length;t<u;t++)p=e[t],B=z+t,p instanceof THREE.Face3?(w=b(p.a,p.b),x=b(p.b,p.c),D=b(p.c,p.a),c(B,n[w],p.b,n[x],p),c(B,n[x],p.c,n[D],p),c(B,n[D],p.a,n[w],p)):p instanceof THREE.Face4?(w=b(p.a,p.b),x=b(p.b,p.c),D=b(p.c,p.d),A=b(p.d,p.a),c(B,n[w],p.b,n[x],p),c(B,n[x],p.c,n[D],p),c(B,n[D],p.d,n[A],p),c(B,n[A],p.a,n[w],p)):console.log("face should be a face!",
-p);var e=l,E={},I={},l=function(a,b){E[a]===void 0&&(E[a]=[]);E[a].push(b)},n=function(a,b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(t in v)p=v[t],B=t.split("_"),u=B[0],B=B[1],l(u,[u,B]),l(B,[u,B]),w=p[0],x=p[1],n(u,w),n(u,x),n(B,w),n(B,x);l=new THREE.Vector3;n=new THREE.Vector3;t=0;for(u=k.length;t<u;t++)if(E[t]!==void 0){l.set(0,0,0);n.set(0,0,0);v=new THREE.Vector3(0,0,0);z=0;for(y in I[t])l.addSelf(m[y]),z++;l.divideScalar(z);z=E[t].length;for(y=0;y<z;y++)p=E[t][y],p=k[p[0]].position.clone().addSelf(k[p[1]].position).divideScalar(2),
-n.addSelf(p);n.divideScalar(z);v.addSelf(k[t].position);v.multiplyScalar(z-3);v.addSelf(l);v.addSelf(n.multiplyScalar(2));v.divideScalar(z);e[t].position=v}a.vertices=e;a.faces=g;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k){var l=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(f.useOldVertexColors)l.vertexColors=k.vertexColors;g.push(l);(!f.supportUVs||n.length!=0)&&h.push([n[a],n[b],n[c],n[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}var e=[],g=[],h=[],f=this,k=a.vertices,e=a.faces,l=k.concat(),m=[],o={},n=[],t,u,y,v,p,z=a.faceVertexUvs[0];t=0;for(u=z.length;t<u;t++){y=0;for(v=z[t].length;y<v;y++)p=e[t]["abcd".charAt(y)],
+n[p]||(n[p]=z[t][y])}var x;t=0;for(u=e.length;t<u;t++)if(p=e[t],m.push(p.centroid),l.push(new THREE.Vertex(p.centroid)),f.supportUVs&&n.length!=0){x=new THREE.UV;if(p instanceof THREE.Face3)x.u=n[p.a].u+n[p.b].u+n[p.c].u,x.v=n[p.a].v+n[p.b].v+n[p.c].v,x.u/=3,x.v/=3;else if(p instanceof THREE.Face4)x.u=n[p.a].u+n[p.b].u+n[p.c].u+n[p.d].u,x.v=n[p.a].v+n[p.b].v+n[p.c].v+n[p.d].v,x.u/=4,x.v/=4;n.push(x)}v=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,g,k={};e=0;for(f=a.faces.length;e<
+f;e++)h=a.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.c,h.a),c(k,g,e)):h instanceof THREE.Face4&&(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.d),c(k,g,e),g=b(h.d,h.a),c(k,g,e));return k}(a);var w,A,D=0,z=k.length,B;for(t in v)if(p=v[t],x=p[0],w=p[1],A=new THREE.Vector3,p.length!=2)console.log("warning, edge fail",p);else if(A.addSelf(m[x]),A.addSelf(m[w]),B=t.split("_"),u=B[0],B=B[1],A.addSelf(k[u].position),A.addSelf(k[B].position),A.multiplyScalar(0.25),
+o[t]=z+e.length+D,l.push(new THREE.Vertex(A)),D++,f.supportUVs&&n.length!=0)x=new THREE.UV,x.u=n[u].u+n[B].u,x.v=n[u].v+n[B].v,x.u/=2,x.v/=2,n.push(x);t=0;for(u=m.length;t<u;t++)p=e[t],B=z+t,p instanceof THREE.Face3?(x=b(p.a,p.b),w=b(p.b,p.c),D=b(p.c,p.a),c(B,o[x],p.b,o[w],p),c(B,o[w],p.c,o[D],p),c(B,o[D],p.a,o[x],p)):p instanceof THREE.Face4?(x=b(p.a,p.b),w=b(p.b,p.c),D=b(p.c,p.d),A=b(p.d,p.a),c(B,o[x],p.b,o[w],p),c(B,o[w],p.c,o[D],p),c(B,o[D],p.d,o[A],p),c(B,o[A],p.a,o[x],p)):console.log("face should be a face!",
+p);var e=l,E={},I={},l=function(a,b){E[a]===void 0&&(E[a]=[]);E[a].push(b)},o=function(a,b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(t in v)p=v[t],B=t.split("_"),u=B[0],B=B[1],l(u,[u,B]),l(B,[u,B]),x=p[0],w=p[1],o(u,x),o(u,w),o(B,x),o(B,w);l=new THREE.Vector3;o=new THREE.Vector3;t=0;for(u=k.length;t<u;t++)if(E[t]!==void 0){l.set(0,0,0);o.set(0,0,0);v=new THREE.Vector3(0,0,0);z=0;for(y in I[t])l.addSelf(m[y]),z++;l.divideScalar(z);z=E[t].length;for(y=0;y<z;y++)p=E[t][y],p=k[p[0]].position.clone().addSelf(k[p[1]].position).divideScalar(2),
+o.addSelf(p);o.divideScalar(z);v.addSelf(k[t].position);v.multiplyScalar(z-3);v.addSelf(l);v.addSelf(o.multiplyScalar(2));v.divideScalar(z);e[t].position=v}a.vertices=e;a.faces=g;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?".":a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],b)]},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b][0],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
 a}function e(a,c){var e=new Image;e.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,c,e)}else a.image=this;a.needsUpdate=!0};e.src=c}function g(a,b,f,h,g,k){var l=document.createElement("canvas");a[b]=new THREE.Texture(l);a[b].sourceFile=f;if(h){a[b].repeat.set(h[0],h[1]);if(h[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
 if(h[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(k){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[k[0]]!==void 0)a[b].wrapS=h[k[0]];if(h[k[1]]!==void 0)a[b].wrapT=h[k[1]]}e(a[b],c+"/"+f)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,k,l;k="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?k="MeshPhongMaterial":a.shading=="Basic"&&(k="MeshBasicMaterial"));
 if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=h(a.colorDiffuse);
 else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=h(a.colorSpecular);if(a.colorAmbient)f.ambient=h(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&c&&g(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var m=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(m.uniforms),o=f.color;k=f.specular;l=f.ambient;var t=f.shininess;n.tNormal.texture=f.normalMap;if(a.mapNormalFactor)n.uNormalScale.value=a.mapNormalFactor;if(f.map)n.tDiffuse.texture=f.map,n.enableDiffuse.value=!0;if(f.specularMap)n.tSpecular.texture=f.specularMap,n.enableSpecular.value=!0;if(f.lightMap)n.tAO.texture=
-f.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(o);n.uSpecularColor.value.setHex(k);n.uAmbientColor.value.setHex(l);n.uShininess.value=t;if(f.opacity)n.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:n,lights:!0,fog:!0})}else f=new THREE[k](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var m=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(m.uniforms),n=f.color;k=f.specular;l=f.ambient;var t=f.shininess;o.tNormal.texture=f.normalMap;if(a.mapNormalFactor)o.uNormalScale.value=a.mapNormalFactor;if(f.map)o.tDiffuse.texture=f.map,o.enableDiffuse.value=!0;if(f.specularMap)o.tSpecular.texture=f.specularMap,o.enableSpecular.value=!0;if(f.lightMap)o.tAO.texture=
+f.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(n);o.uSpecularColor.value.setHex(k);o.uAmbientColor.value.setHex(l);o.uShininess.value=t;if(f.opacity)o.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:o,lights:!0,fog:!0})}else f=new THREE[k](f);return f}};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 c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c),a=(new Date).getTime(),c=new Worker(c),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,b,g,e,h)};c.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
 c.postMessage(a)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,g,h){var f=new XMLHttpRequest,k=e+"/"+a,l=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,g,c):alert("Couldn't load ["+k+"] ["+f.status+"]"):f.readyState==3?h&&(l==0&&(l=f.getResponseHeader("Content-Length")),h({total:l,loaded:f.responseText.length})):f.readyState==2&&(l=f.getResponseHeader("Content-Length"))};f.open("GET",k,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
 f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var g=function(b){function c(a,b){var e=n(a,b),f=n(a,b+1),g=n(a,b+2),h=n(a,b+3),k=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&k==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function g(a,b){var c=n(a,b),e=n(a,b+1),f=n(a,b+2);return(n(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=n(a,b);return(n(a,b+1)<<8)+c}function m(a,b){var c=n(a,b);return c>127?c-256:c}function n(a,b){return a.charCodeAt(b)&255}function o(b){var c,
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var g=function(b){function c(a,b){var e=o(a,b),f=o(a,b+1),g=o(a,b+2),h=o(a,b+3),k=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&k==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function g(a,b){var c=o(a,b),e=o(a,b+1),f=o(a,b+2);return(o(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=o(a,b);return(o(a,b+1)<<8)+c}function m(a,b){var c=o(a,b);return c>127?c-256:c}function o(a,b){return a.charCodeAt(b)&255}function n(b){var c,
 e,f;c=g(a,b);e=g(a,b+B);f=g(a,b+E);b=l(a,b+I);z.faces.push(new THREE.Face3(c,e,f,null,null,z.materials[b]))}function t(b){var c,e,f,h,m,n;c=g(a,b);e=g(a,b+B);f=g(a,b+E);h=l(a,b+I);m=g(a,b+H);n=g(a,b+M);b=g(a,b+C);h=z.materials[h];var o=A[n*3],p=A[n*3+1];n=A[n*3+2];var t=A[b*3],ia=A[b*3+1],b=A[b*3+2];z.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(o,p,n),new THREE.Vector3(t,ia,b)],null,h))}function u(b){var c,e,f,h;c=g(a,b);e=g(a,b+F);f=g(a,b+J);h=
 g(a,b+L);b=l(a,b+N);z.faces.push(new THREE.Face4(c,e,f,h,null,null,z.materials[b]))}function y(b){var c,e,f,h,m,n,o,p;c=g(a,b);e=g(a,b+F);f=g(a,b+J);h=g(a,b+L);m=l(a,b+N);n=g(a,b+K);o=g(a,b+P);p=g(a,b+G);b=g(a,b+S);m=z.materials[m];var t=A[o*3],ia=A[o*3+1];o=A[o*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var u=A[b*3],v=A[b*3+1],b=A[b*3+2];z.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(t,ia,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(u,v,b)],
 null,m))}function v(b){var c,e,f,h;c=g(a,b);e=g(a,b+O);f=g(a,b+U);b=D[c*2];h=D[c*2+1];c=D[e*2];var l=z.faceVertexUvs[0];e=D[e*2+1];var m=D[f*2];f=D[f*2+1];var n=[];n.push(new THREE.UV(b,h));n.push(new THREE.UV(c,e));n.push(new THREE.UV(m,f));l.push(n)}function p(b){var c,e,f,h,l,m;c=g(a,b);e=g(a,b+V);f=g(a,b+T);h=g(a,b+R);b=D[c*2];l=D[c*2+1];c=D[e*2];m=D[e*2+1];e=D[f*2];var n=z.faceVertexUvs[0];f=D[f*2+1];var o=D[h*2];h=D[h*2+1];var p=[];p.push(new THREE.UV(b,l));p.push(new THREE.UV(c,m));p.push(new THREE.UV(e,
-f));p.push(new THREE.UV(o,h));n.push(p)}var z=this,w=0,x,A=[],D=[],B,E,I,H,M,C,F,J,L,N,K,P,G,S,O,U,V,T,R,Q,Z,W,$,X,Y;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,b);x={signature:a.substr(w,8),header_bytes:n(a,w+8),vertex_coordinate_bytes:n(a,w+9),normal_coordinate_bytes:n(a,w+10),uv_coordinate_bytes:n(a,w+11),vertex_index_bytes:n(a,w+12),normal_index_bytes:n(a,w+13),uv_index_bytes:n(a,w+14),material_index_bytes:n(a,w+15),nvertices:g(a,w+16),nnormals:g(a,w+16+4),nuvs:g(a,w+16+
-8),ntri_flat:g(a,w+16+12),ntri_smooth:g(a,w+16+16),ntri_flat_uv:g(a,w+16+20),ntri_smooth_uv:g(a,w+16+24),nquad_flat:g(a,w+16+28),nquad_smooth:g(a,w+16+32),nquad_flat_uv:g(a,w+16+36),nquad_smooth_uv:g(a,w+16+40)};w+=x.header_bytes;B=x.vertex_index_bytes;E=x.vertex_index_bytes*2;I=x.vertex_index_bytes*3;H=x.vertex_index_bytes*3+x.material_index_bytes;M=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes;C=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*2;F=x.vertex_index_bytes;
-J=x.vertex_index_bytes*2;L=x.vertex_index_bytes*3;N=x.vertex_index_bytes*4;K=x.vertex_index_bytes*4+x.material_index_bytes;P=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes;G=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*2;S=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*3;O=x.uv_index_bytes;U=x.uv_index_bytes*2;V=x.uv_index_bytes;T=x.uv_index_bytes*2;R=x.uv_index_bytes*3;b=x.vertex_index_bytes*3+x.material_index_bytes;Y=x.vertex_index_bytes*
-4+x.material_index_bytes;Q=x.ntri_flat*b;Z=x.ntri_smooth*(b+x.normal_index_bytes*3);W=x.ntri_flat_uv*(b+x.uv_index_bytes*3);$=x.ntri_smooth_uv*(b+x.normal_index_bytes*3+x.uv_index_bytes*3);X=x.nquad_flat*Y;b=x.nquad_smooth*(Y+x.normal_index_bytes*4);Y=x.nquad_flat_uv*(Y+x.uv_index_bytes*4);w+=function(b){for(var e,h,g,k=x.vertex_coordinate_bytes*3,l=b+x.nvertices*k;b<l;b+=k)e=c(a,b),h=c(a,b+x.vertex_coordinate_bytes),g=c(a,b+x.vertex_coordinate_bytes*2),z.vertices.push(new THREE.Vertex(new THREE.Vector3(e,
-h,g)));return x.nvertices*k}(w);w+=function(b){for(var c,e,f,h=x.normal_coordinate_bytes*3,g=b+x.nnormals*h;b<g;b+=h)c=m(a,b),e=m(a,b+x.normal_coordinate_bytes),f=m(a,b+x.normal_coordinate_bytes*2),A.push(c/127,e/127,f/127);return x.nnormals*h}(w);w+=function(b){for(var e,h,g=x.uv_coordinate_bytes*2,k=b+x.nuvs*g;b<k;b+=g)e=c(a,b),h=c(a,b+x.uv_coordinate_bytes),D.push(e,h);return x.nuvs*g}(w);Q=w+Q;Z=Q+Z;W=Z+W;$=W+$;X=$+X;b=X+b;Y=b+Y;(function(a){var b,c=x.vertex_index_bytes*3+x.material_index_bytes,
-e=c+x.uv_index_bytes*3,f=a+x.ntri_flat_uv*e;for(b=a;b<f;b+=e)o(b),v(b+c);return f-a})(Z);(function(a){var b,c=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*3,e=c+x.uv_index_bytes*3,f=a+x.ntri_smooth_uv*e;for(b=a;b<f;b+=e)t(b),v(b+c);return f-a})(W);(function(a){var b,c=x.vertex_index_bytes*4+x.material_index_bytes,e=c+x.uv_index_bytes*4,f=a+x.nquad_flat_uv*e;for(b=a;b<f;b+=e)u(b),p(b+c);return f-a})(b);(function(a){var b,c=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*
-4,e=c+x.uv_index_bytes*4,f=a+x.nquad_smooth_uv*e;for(b=a;b<f;b+=e)y(b),p(b+c);return f-a})(Y);(function(a){var b,c=x.vertex_index_bytes*3+x.material_index_bytes,e=a+x.ntri_flat*c;for(b=a;b<e;b+=c)o(b);return e-a})(w);(function(a){var b,c=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*3,e=a+x.ntri_smooth*c;for(b=a;b<e;b+=c)t(b);return e-a})(Q);(function(a){var b,c=x.vertex_index_bytes*4+x.material_index_bytes,e=a+x.nquad_flat*c;for(b=a;b<e;b+=c)u(b);return e-a})($);(function(a){var b,
-c=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*4,e=a+x.nquad_smooth*c;for(b=a;b<e;b+=c)y(b);return e-a})(X);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
+f));p.push(new THREE.UV(o,h));n.push(p)}var z=this,x=0,w,A=[],D=[],B,E,I,H,M,C,F,J,L,N,K,P,G,S,O,U,V,T,R,Q,Z,W,$,X,Y;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,b);w={signature:a.substr(x,8),header_bytes:o(a,x+8),vertex_coordinate_bytes:o(a,x+9),normal_coordinate_bytes:o(a,x+10),uv_coordinate_bytes:o(a,x+11),vertex_index_bytes:o(a,x+12),normal_index_bytes:o(a,x+13),uv_index_bytes:o(a,x+14),material_index_bytes:o(a,x+15),nvertices:g(a,x+16),nnormals:g(a,x+16+4),nuvs:g(a,x+16+
+8),ntri_flat:g(a,x+16+12),ntri_smooth:g(a,x+16+16),ntri_flat_uv:g(a,x+16+20),ntri_smooth_uv:g(a,x+16+24),nquad_flat:g(a,x+16+28),nquad_smooth:g(a,x+16+32),nquad_flat_uv:g(a,x+16+36),nquad_smooth_uv:g(a,x+16+40)};x+=w.header_bytes;B=w.vertex_index_bytes;E=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;H=w.vertex_index_bytes*3+w.material_index_bytes;M=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;C=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;F=w.vertex_index_bytes;
+J=w.vertex_index_bytes*2;L=w.vertex_index_bytes*3;N=w.vertex_index_bytes*4;K=w.vertex_index_bytes*4+w.material_index_bytes;P=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;G=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;S=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;O=w.uv_index_bytes;U=w.uv_index_bytes*2;V=w.uv_index_bytes;T=w.uv_index_bytes*2;R=w.uv_index_bytes*3;b=w.vertex_index_bytes*3+w.material_index_bytes;Y=w.vertex_index_bytes*
+4+w.material_index_bytes;Q=w.ntri_flat*b;Z=w.ntri_smooth*(b+w.normal_index_bytes*3);W=w.ntri_flat_uv*(b+w.uv_index_bytes*3);$=w.ntri_smooth_uv*(b+w.normal_index_bytes*3+w.uv_index_bytes*3);X=w.nquad_flat*Y;b=w.nquad_smooth*(Y+w.normal_index_bytes*4);Y=w.nquad_flat_uv*(Y+w.uv_index_bytes*4);x+=function(b){for(var e,h,g,k=w.vertex_coordinate_bytes*3,l=b+w.nvertices*k;b<l;b+=k)e=c(a,b),h=c(a,b+w.vertex_coordinate_bytes),g=c(a,b+w.vertex_coordinate_bytes*2),z.vertices.push(new THREE.Vertex(new THREE.Vector3(e,
+h,g)));return w.nvertices*k}(x);x+=function(b){for(var c,e,f,h=w.normal_coordinate_bytes*3,g=b+w.nnormals*h;b<g;b+=h)c=m(a,b),e=m(a,b+w.normal_coordinate_bytes),f=m(a,b+w.normal_coordinate_bytes*2),A.push(c/127,e/127,f/127);return w.nnormals*h}(x);x+=function(b){for(var e,h,g=w.uv_coordinate_bytes*2,k=b+w.nuvs*g;b<k;b+=g)e=c(a,b),h=c(a,b+w.uv_coordinate_bytes),D.push(e,h);return w.nuvs*g}(x);Q=x+Q;Z=Q+Z;W=Z+W;$=W+$;X=$+X;b=X+b;Y=b+Y;(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,
+e=c+w.uv_index_bytes*3,f=a+w.ntri_flat_uv*e;for(b=a;b<f;b+=e)n(b),v(b+c);return f-a})(Z);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=c+w.uv_index_bytes*3,f=a+w.ntri_smooth_uv*e;for(b=a;b<f;b+=e)t(b),v(b+c);return f-a})(W);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=c+w.uv_index_bytes*4,f=a+w.nquad_flat_uv*e;for(b=a;b<f;b+=e)u(b),p(b+c);return f-a})(b);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*
+4,e=c+w.uv_index_bytes*4,f=a+w.nquad_smooth_uv*e;for(b=a;b<f;b+=e)y(b),p(b+c);return f-a})(Y);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes,e=a+w.ntri_flat*c;for(b=a;b<e;b+=c)n(b);return e-a})(x);(function(a){var b,c=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=a+w.ntri_smooth*c;for(b=a;b<e;b+=c)t(b);return e-a})(Q);(function(a){var b,c=w.vertex_index_bytes*4+w.material_index_bytes,e=a+w.nquad_flat*c;for(b=a;b<e;b+=c)u(b);return e-a})($);(function(a){var b,
+c=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,e=a+w.nquad_smooth*c;for(b=a;b<e;b+=c)y(b);return e-a})(X);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
 THREE.ColladaLoader=function(){function a(a,b,c){for(var a=Q.evaluate(a,Q,G,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},f=a.iterateNext(),h=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+h++;e[f.id]=f;f=a.iterateNext()}return e}function c(){var a=1E6,b=-a,c=0,e;for(e in ca)for(var f=ca[e],h=0;h<f.sampler.length;h++){var g=f.sampler[h];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function b(a,c,e,f){a.world=a.world||
 new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=a.channels[0].sampler.output[e];h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);c.push(a);for(f=0;f<a.nodes.length;f++)b(a.nodes[f],c,e,a.world)}function e(a,e,f){var h=aa[e.url];if(!h||!h.skin)console.log("could not find skin controller!");else if(!e.skeleton||!e.skeleton.length)console.log("could not find the skeleton for the skin!");else{var g=c(),e=W.getChildById(e.skeleton[0],!0)||W.getChildBySid(e.skeleton[0],
 !0),k,l,m,n,o=new THREE.Vector3,p;for(k=0;k<a.vertices.length;k++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);for(f=0;f<g.frames;f++){var t=[],u=[];for(k=0;k<a.vertices.length;k++)u.push(new THREE.Vertex(new THREE.Vector3));b(e,t,f);k=t;l=h.skin;for(n=0;n<k.length;n++){m=k[n];p=-1;for(var v=0;v<l.joints.length;v++)if(m.sid==l.joints[v]){p=v;break}if(p>=0){v=l.invBindMatrices[p];m.invBindMatrix=v;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,v);m.weights=[];
@@ -222,8 +222,8 @@ c,f,h;b.name=a.id||"";b.matrixAutoUpdate=!1;b.matrix=a.matrix;for(h=0;h<a.contro
 new y,l.url=k.morph.source,l.instance_material=a.controllers[h].instance_material,a.geometries.push(l),f=a.controllers[h];console.log("DAE: morph-controller partially supported.")}}for(h=0;h<a.geometries.length;h++){var k=a.geometries[h],l=k.instance_material,k=ba[k.url],m={},n=0,o;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(l)for(j=0;j<l.length;j++){o=l[j];var p=ga[fa[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=m[o.symbol]=
 p.material;n++}l=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(n>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)n=k.faces[j],n.materials=[m[n.daeMaterial]]}if(c!==void 0)e(k,c),l.morphTargets=!0,l=new THREE.SkinnedMesh(k,l),l.skeleton=c.skeleton,l.skinController=aa[c.url],l.skinInstanceController=c,l.name="skin_"+ea.length,ea.push(l);else if(f!==void 0){m=k;n=f instanceof t?aa[f.url]:f;if(!n||!n.morph)console.log("could not find morph controller!");
 else{n=n.morph;for(p=0;p<n.targets.length;p++){var u=ba[n.targets[p]];if(u.mesh&&u.mesh.primitives&&u.mesh.primitives.length)u=u.mesh.primitives[0].geometry,u.vertices.length===m.vertices.length&&m.morphTargets.push({name:"target_1",vertices:u.vertices})}m.morphTargets.push({name:"target_Z",vertices:m.vertices})}l.morphTargets=!0;l=new THREE.Mesh(k,l);l.name="morph_"+da.length;da.push(l)}else l=new THREE.Mesh(k,l);b.add(l)}}for(h=0;h<a.nodes.length;h++)b.add(g(a.nodes[h],a));return b}function h(){this.init_from=
-this.id=""}function f(){this.type=this.name=this.id="";this.morph=this.skin=null}function k(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function m(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function n(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=
-this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function t(){this.url="";this.skeleton=[];this.instance_material=[]}function u(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function v(){this.id="";this.mesh=null}function p(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function z(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function x(){this.source="";
+this.id=""}function f(){this.type=this.name=this.id="";this.morph=this.skin=null}function k(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function m(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function n(){this.type=
+this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function t(){this.url="";this.skeleton=[];this.instance_material=[]}function u(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function v(){this.id="";this.mesh=null}function p(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function z(){}function x(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";
 this.stride=this.count=0;this.params=[]}function A(){this.input={}}function D(){this.semantic="";this.offset=0;this.source="";this.set=0}function B(a){this.id=a;this.type=null}function E(){this.name=this.id="";this.instance_effect=null}function I(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function H(a,b){this.type=a;this.effect=b;this.material=null}function M(a){this.effect=a;this.format=this.init_from=
 null}function C(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function F(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function J(){this.url=""}function L(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function N(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function K(a){this.id="";this.animation=a;this.inputs=[];this.endTime=
 this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function P(a){var b=a.getAttribute("id");if(X[b]!=void 0)return X[b];X[b]=(new B(b)).parse(a);return X[b]}function G(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function S(a){for(var a=U(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function O(a){for(var a=U(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function U(a){return a.replace(/^\s+/,
@@ -234,25 +234,25 @@ function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if
 h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new B).parse(h);b[h.id]=h;break;case "joints":c=h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new D).parse(e),f=b[e.source];if(e.semantic=="JOINT")this.joints=
 f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};l.prototype.parseWeights=function(a,b){for(var c,e,f=[],h=0;h<a.childNodes.length;h++){var g=a.childNodes[h];if(g.nodeType==1)switch(g.nodeName){case "input":f.push((new D).parse(g));break;case "v":c=O(g.textContent);break;case "vcount":e=O(g.textContent)}}for(h=g=0;h<e.length;h++){for(var k=e[h],l=[],m=0;m<k;m++){for(var n={},o=0;o<f.length;o++){var p=f[o],t=c[g+p.offset];switch(p.semantic){case "JOINT":n.joint=t;break;
 case "WEIGHT":n.weight=b[p.source].data[t]}}l.push(n);g+=f.length}for(m=0;m<l.length;m++)l[m].index=h;this.weights.push(l)}};m.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};m.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};m.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");
-this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new n).parse(c))}}return this};n.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,g=f.indexOf("(")>=0,k;if(h)e=f.split("."),f=e.shift(),e.shift();else if(g){k=f.split("(");f=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,
-""))}if(f==a)return c.info={sid:f,dotSyntax:h,arrSyntax:g,arrIndices:k},c}return null};n.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};n.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};n.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==
-a)return this.transforms[b];return null};n.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new n).parse(b));break;case "instance_camera":break;
-case "instance_controller":this.controllers.push((new t).parse(b));break;case "instance_geometry":this.geometries.push((new y).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=Q.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",Q,G,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new n).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(b));
+this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,g=f.indexOf("(")>=0,k;if(h)e=f.split("."),f=e.shift(),e.shift();else if(g){k=f.split("(");f=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,
+""))}if(f==a)return c.info={sid:f,dotSyntax:h,arrSyntax:g,arrIndices:k},c}return null};o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};o.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};o.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==
+a)return this.transforms[b];return null};o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;
+case "instance_controller":this.controllers.push((new t).parse(b));break;case "instance_geometry":this.geometries.push((new y).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=Q.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",Q,G,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new n).parse(b));
 break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var e in ca)for(var f=ca[e],h=0;h<f.channel.length;h++){var g=f.channel[h],k=f.sampler[h];e=g.target.split("/")[0];if(e==this.id)k.create(),g.sampler=k,c=Math.min(c,k.startTime),b=Math.max(b,k.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+
 1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=e){b=a;for(var f={},l=h=void 0,h=0;h<this.channels.length;h++)l=this.channels[h],f[l.sid]=l;g=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(k=this.transforms[h],l=f[k.sid],l!==void 0){for(var m=l.sampler,p,l=0;l<m.input.length-1;l++)if(m.input[l+1]>b){p=m.output[l];break}g=p!==void 0?p instanceof THREE.Matrix4?g.multiply(g,p):g.multiply(g,k.matrix):g.multiply(g,k.matrix)}else g=g.multiply(g,k.matrix);b=g;c.push({time:a,pos:[b.n14,
-b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=S(a.textContent);this.updateMatrix();return this};o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
+b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};n.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=S(a.textContent);this.updateMatrix();return this};n.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
 this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
 t.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Q.evaluate(".//dae:instance_material",c,G,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=c.iterateNext();e;)this.instance_material.push((new u).parse(e)),e=c.iterateNext()}}return this};
 u.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=Q.evaluate(".//dae:instance_material",c,G,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new u).parse(b)),
 b=a.iterateNext();break}}return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new p(this)).parse(c)}}return this};p.prototype.parse=function(a){function b(a,c){var e=R(a.position);f[e]===void 0&&(f[e]={v:a,index:c});return f[e]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":P(e);break;case "vertices":this.vertices=
-(new A).parse(e);break;case "triangles":this.primitives.push((new w).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new z).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=X[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[c],e[c+1],e[c+2]));b(h,a);this.geometry3js.vertices.push(h)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),
+(new A).parse(e);break;case "triangles":this.primitives.push((new x).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new z).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=X[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[c],e[c+1],e[c+2]));b(h,a);this.geometry3js.vertices.push(h)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),
 this.handlePrimitive(primitive,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};p.prototype.handlePrimitive=function(a,b,c){var e=0,f,h,g=a.p,k=a.inputs,l,m,n,o=0,p=3,t=[];for(f=0;f<k.length;f++)switch(l=k[f],l.semantic){case "TEXCOORD":t.push(l.set)}for(;e<g.length;){var u=[],v=[],y={},w=[];a.vcount&&(p=a.vcount[o++]);for(f=0;f<p;f++)for(h=0;h<k.length;h++)switch(l=
 k[h],source=X[l.source],m=g[e+f*k.length+l.offset],numParams=source.accessor.params.length,n=m*numParams,l.semantic){case "VERTEX":l=R(b.vertices[m].position);u.push(c[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[n],source.data[n+1],source.data[n+2]));break;case "TEXCOORD":y[l.set]===void 0&&(y[l.set]=[]);y[l.set].push(new THREE.UV(source.data[n],source.data[n+1]));break;case "COLOR":w.push((new THREE.Color).setRGB(source.data[n],source.data[n+1],source.data[n+2]))}var x;p==
-3?x=new THREE.Face3(u[0],u[1],u[2],[v[0],v[1],v[2]],w.length?w:new THREE.Color):p==4&&(x=new THREE.Face4(u[0],u[1],u[2],u[3],[v[0],v[1],v[2],v[3]],w.length?w:new THREE.Color));x.daeMaterial=a.material;b.faces.push(x);for(h=0;h<t.length;h++)f=y[t[h]],b.faceVertexUvs[h].push([f[0],f[1],f[2]]);e+=k.length*p}};z.prototype=new w;z.prototype.constructor=z;w.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};
-w.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=V(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new D).parse(a.childNodes[b]));break;case "vcount":this.vcount=O(c.textContent);break;case "p":this.p=O(c.textContent)}}return this};x.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=V(a,"count",0);this.stride=V(a,"stride",0);for(var b=
+3?x=new THREE.Face3(u[0],u[1],u[2],[v[0],v[1],v[2]],w.length?w:new THREE.Color):p==4&&(x=new THREE.Face4(u[0],u[1],u[2],u[3],[v[0],v[1],v[2],v[3]],w.length?w:new THREE.Color));x.daeMaterial=a.material;b.faces.push(x);for(h=0;h<t.length;h++)f=y[t[h]],b.faceVertexUvs[h].push([f[0],f[1],f[2]]);e+=k.length*p}};z.prototype=new x;z.prototype.constructor=z;x.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};
+x.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=V(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new D).parse(a.childNodes[b]));break;case "vcount":this.vcount=O(c.textContent);break;case "p":this.p=O(c.textContent)}}return this};w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=V(a,"count",0);this.stride=V(a,"stride",0);for(var b=
 0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};A.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName=="input"&&(input=(new D).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};D.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
 "");this.set=V(a,"set",-1);this.offset=V(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};B.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=U(c.textContent).split(/\s+/),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?!0:!1);this.data=f;this.type=c.nodeName;break;case "float_array":this.data=S(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
-O(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=U(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new x).parse(c.childNodes[e]);break}}}return this};B.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=
+O(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=U(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new w).parse(c.childNodes[e]);break}}}return this};B.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=
 16){var c=this.data.slice(b,b+16),e=new THREE.Matrix4;e.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(e)}break;default:console.log("Dae::Source:read dont know how to read "+b.type)}return a};E.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new J).parse(a.childNodes[b]);break}return this};I.prototype.isColor=
 function(){return this.texture==null};I.prototype.isTexture=function(){return this.texture!=null};I.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=S(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};H.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=
 a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new I).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=Q.evaluate(".//dae:float",c,G,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};H.prototype.create=function(){var a=
@@ -269,48 +269,48 @@ document.implementation.createDocument){document.implementation.createDocument("
 E,"material");ga=a("//dae:library_effects/dae:effect",F,"effect");ba=a("//dae:library_geometries/dae:geometry",v,"geometry");aa=a("//dae:library_controllers/dae:controller",f,"controller");ca=a("//dae:library_animations/dae:animation",L,"animation");ha=a(".//dae:library_visual_scenes/dae:visual_scene",m,"visual_scene");da=[];ea=[];(n=Q.evaluate(".//dae:scene/dae:instance_visual_scene",Q,G,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(n=n.getAttribute("url").replace(/^#/,""),W=ha[n]):
 W=null;Z=new THREE.Object3D;for(n=0;n<W.nodes.length;n++)Z.add(g(W.nodes[n]));c();for(var o in ca);o={scene:Z,morphs:da,skins:ea,dae:{images:Y,materials:fa,effects:ga,geometries:ba,controllers:aa,animations:ca,visualScenes:ha,scene:W}};l&&l(o)}};k.open("GET",b,!0);k.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(a){ka=a},applySkin:e,geometries:ba}};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 c=this,b=a.model,e=a.callback,g=a.texture_path?a.texture_path:this.extractUrlbase(b),a=new Worker(b);a.onmessage=function(a){c.createModel(a.data,e,g);c.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,g,l,m,n,o,t,u,y,v,p,z,w,x,A=a.faces;o=a.vertices;var D=a.normals,B=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];m=0;for(n=o.length;m<n;)t=new THREE.Vertex,t.position.x=o[m++]*b,t.position.y=
-o[m++]*b,t.position.z=o[m++]*b,e.vertices.push(t);m=0;for(n=A.length;m<n;){b=A[m++];o=b&1;l=b&2;c=b&4;g=b&8;u=b&16;t=b&32;v=b&64;b&=128;o?(p=new THREE.Face4,p.a=A[m++],p.b=A[m++],p.c=A[m++],p.d=A[m++],o=4):(p=new THREE.Face3,p.a=A[m++],p.b=A[m++],p.c=A[m++],o=3);if(l)l=A[m++],p.materials=e.materials[l];l=e.faces.length;if(c)for(c=0;c<E;c++)z=a.uvs[c],y=A[m++],x=z[y*2],y=z[y*2+1],e.faceUvs[c][l]=new THREE.UV(x,y);if(g)for(c=0;c<E;c++){z=a.uvs[c];w=[];for(g=0;g<o;g++)y=A[m++],x=z[y*2],y=z[y*2+1],w[g]=
-new THREE.UV(x,y);e.faceVertexUvs[c][l]=w}if(u)u=A[m++]*3,g=new THREE.Vector3,g.x=D[u++],g.y=D[u++],g.z=D[u],p.normal=g;if(t)for(c=0;c<o;c++)u=A[m++]*3,g=new THREE.Vector3,g.x=D[u++],g.y=D[u++],g.z=D[u],p.vertexNormals.push(g);if(v)t=A[m++],t=new THREE.Color(B[t]),p.color=t;if(b)for(c=0;c<o;c++)t=A[m++],t=new THREE.Color(B[t]),p.vertexColors.push(t);e.faces.push(p)}}})(g);(function(){var b,c,g,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)g=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(g,
-l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(g,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,l,m,n,o,t,u,y;c=0;for(g=a.morphTargets.length;c<g;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];u=e.morphTargets[c].vertices;y=a.morphTargets[c].vertices;l=0;for(m=y.length;l<m;l+=3)n=y[l]*b,o=y[l+1]*
-b,t=y[l+2]*b,u.push(new THREE.Vertex(new THREE.Vector3(n,o,t)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];m=e.morphColors[c].colors;n=a.morphColors[c].colors;b=0;for(l=n.length;b<l;b+=3)o=new THREE.Color(16755200),o.setRGB(n[b],n[b+1],n[b+2]),m.push(o)}}})(g);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,g,l,m,o,n,t,u,y,v,p,z,x,w,A=a.faces;n=a.vertices;var D=a.normals,B=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];m=0;for(o=n.length;m<o;)t=new THREE.Vertex,t.position.x=n[m++]*b,t.position.y=
+n[m++]*b,t.position.z=n[m++]*b,e.vertices.push(t);m=0;for(o=A.length;m<o;){b=A[m++];n=b&1;l=b&2;c=b&4;g=b&8;u=b&16;t=b&32;v=b&64;b&=128;n?(p=new THREE.Face4,p.a=A[m++],p.b=A[m++],p.c=A[m++],p.d=A[m++],n=4):(p=new THREE.Face3,p.a=A[m++],p.b=A[m++],p.c=A[m++],n=3);if(l)l=A[m++],p.materials=e.materials[l];l=e.faces.length;if(c)for(c=0;c<E;c++)z=a.uvs[c],y=A[m++],w=z[y*2],y=z[y*2+1],e.faceUvs[c][l]=new THREE.UV(w,y);if(g)for(c=0;c<E;c++){z=a.uvs[c];x=[];for(g=0;g<n;g++)y=A[m++],w=z[y*2],y=z[y*2+1],x[g]=
+new THREE.UV(w,y);e.faceVertexUvs[c][l]=x}if(u)u=A[m++]*3,g=new THREE.Vector3,g.x=D[u++],g.y=D[u++],g.z=D[u],p.normal=g;if(t)for(c=0;c<n;c++)u=A[m++]*3,g=new THREE.Vector3,g.x=D[u++],g.y=D[u++],g.z=D[u],p.vertexNormals.push(g);if(v)t=A[m++],t=new THREE.Color(B[t]),p.color=t;if(b)for(c=0;c<n;c++)t=A[m++],t=new THREE.Color(B[t]),p.vertexColors.push(t);e.faces.push(p)}}})(g);(function(){var b,c,g,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)g=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(g,
+l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(g,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,l,m,o,n,t,u,y;c=0;for(g=a.morphTargets.length;c<g;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];u=e.morphTargets[c].vertices;y=a.morphTargets[c].vertices;l=0;for(m=y.length;l<m;l+=3)o=y[l]*b,n=y[l+1]*
+b,t=y[l+2]*b,u.push(new THREE.Vertex(new THREE.Vector3(o,n,t)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];m=e.morphColors[c].colors;o=a.morphColors[c].colors;b=0;for(l=o.length;b<l;b+=3)n=new THREE.Color(16755200),n.setRGB(o[b],o[b+1],o[b+2]),m.push(n)}}})(g);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:g+"/"+a}function k(){for(u in F.objects)if(!G.objects[u])if(w=F.objects[u],w.geometry!==void 0){if(B=G.geometries[w.geometry]){var a=!1;M=[];for(O=0;O<w.materials.length;O++)M[O]=G.materials[w.materials[O]],a=M[O]instanceof THREE.ShaderMaterial;a&&B.computeTangents();x=w.position;r=w.rotation;
-q=w.quaternion;s=w.scale;q=0;M.length==0&&(M[0]=new THREE.MeshFaceMaterial);M.length>1&&(M=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(B,M);object.name=u;object.position.set(x[0],x[1],x[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=w.visible;G.scene.add(object);G.objects[u]=object;w.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),G.scene.collisions.colliders.push(a));
-if(w.castsShadow)a=new THREE.ShadowVolume(B),G.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;w.trigger&&w.trigger.toLowerCase()!="none"&&(a={type:w.trigger,object:w},G.triggers[object.name]=a)}}else x=w.position,r=w.rotation,q=w.quaternion,s=w.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(x[0],x[1],x[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=w.visible!==void 0?w.visible:!1,G.scene.add(object),G.objects[u]=object,G.empties[u]=object,w.trigger&&w.trigger.toLowerCase()!="none"&&(a={type:w.trigger,object:w},G.triggers[object.name]=a)}function l(a){return function(c){G.geometries[a]=c;k();L-=1;b.onLoadComplete();n()}}function m(a){return function(b){G.geometries[a]=b}}function n(){b.callbackProgress({totalModels:K,totalTextures:P,loadedModels:K-L,loadedTextures:P-N},G);b.onLoadProgress();L==0&&N==0&&c(G)}var o,t,
-u,y,v,p,z,w,x,A,D,B,E,I,H,M,C,F,J,L,N,K,P,G;F=a.data;H=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=L=0;G={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(u in F.objects)if(w=F.objects[u],w.meshCollider){a=!0;break}if(a)G.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;A=F.transform.rotation;var S=F.transform.scale;a&&G.scene.position.set(a[0],a[1],a[2]);A&&G.scene.rotation.set(A[0],
-A[1],A[2]);S&&G.scene.scale.set(S[0],S[1],S[2]);(a||A||S)&&G.scene.updateMatrix()}a=function(){N-=1;n();b.onLoadComplete()};for(v in F.cameras){A=F.cameras[v];if(A.type=="perspective")E=new THREE.Camera(A.fov,A.aspect,A.near,A.far),E.useTarget=!0;else if(A.type=="ortho")E=new THREE.Camera,E.useTarget=!0,E.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far);x=A.position;A=A.target;E.position.set(x[0],x[1],x[2]);E.target.position.set(A[0],A[1],A[2]);G.cameras[v]=E}for(y in F.lights)v=
-F.lights[y],E=v.color!==void 0?v.color:16777215,A=v.intensity!==void 0?v.intensity:1,v.type=="directional"?(x=v.direction,C=new THREE.DirectionalLight(E,A),C.position.set(x[0],x[1],x[2]),C.position.normalize()):v.type=="point"?(x=v.position,d=v.distance,C=new THREE.PointLight(E,A,d),C.position.set(x[0],x[1],x[2])):v.type=="ambient"&&(C=new THREE.AmbientLight(E)),G.scene.add(C),G.lights[y]=C;for(p in F.fogs)y=F.fogs[p],y.type=="linear"?I=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(I=new THREE.FogExp2(0,
-y.density)),A=y.color,I.color.setRGB(A[0],A[1],A[2]),G.fogs[p]=I;if(G.cameras&&F.defaults.camera)G.currentCamera=G.cameras[F.defaults.camera];if(G.fogs&&F.defaults.fog)G.scene.fog=G.fogs[F.defaults.fog];A=F.defaults.bgcolor;G.bgColor=new THREE.Color;G.bgColor.setRGB(A[0],A[1],A[2]);G.bgColorAlpha=F.defaults.bgalpha;for(o in F.geometries)if(p=F.geometries[o],p.type=="bin_mesh"||p.type=="ascii_mesh")L+=1,b.onLoadStart();K=L;for(o in F.geometries)p=F.geometries[o],p.type=="cube"?(B=new THREE.CubeGeometry(p.width,
-p.height,p.depth,p.segmentsWidth,p.segmentsHeight,p.segmentsDepth,null,p.flipped,p.sides),G.geometries[o]=B):p.type=="plane"?(B=new THREE.PlaneGeometry(p.width,p.height,p.segmentsWidth,p.segmentsHeight),G.geometries[o]=B):p.type=="sphere"?(B=new THREE.SphereGeometry(p.radius,p.segmentsWidth,p.segmentsHeight),G.geometries[o]=B):p.type=="cylinder"?(B=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),G.geometries[o]=B):p.type=="torus"?(B=new THREE.TorusGeometry(p.radius,p.tube,
-p.segmentsR,p.segmentsT),G.geometries[o]=B):p.type=="icosahedron"?(B=new THREE.IcosahedronGeometry(p.subdivisions),G.geometries[o]=B):p.type=="bin_mesh"?H.load({model:e(p.url,F.urlBaseType),callback:l(o)}):p.type=="ascii_mesh"?J.load({model:e(p.url,F.urlBaseType),callback:l(o)}):p.type=="embedded_mesh"&&(p=F.embeds[p.id])&&J.createModel(p,m(o),"");for(z in F.textures)if(o=F.textures[z],o.url instanceof Array){N+=o.url.length;for(H=0;H<o.url.length;H++)b.onLoadStart()}else N+=1,b.onLoadStart();P=N;
-for(z in F.textures){o=F.textures[z];if(o.mapping!=void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];if(o.url instanceof Array){H=[];for(var O=0;O<o.url.length;O++)H[O]=e(o.url[O],F.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,o.mapping,a)}else{H=THREE.ImageUtils.loadTexture(e(o.url,F.urlBaseType),o.mapping,a);if(THREE[o.minFilter]!=void 0)H.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)H.magFilter=THREE[o.magFilter];if(o.repeat){H.repeat.set(o.repeat[0],o.repeat[1]);
-if(o.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=1)H.wrapT=THREE.RepeatWrapping}o.offset&&H.offset.set(o.offset[0],o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)H.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)H.wrapT=J[o.wrap[1]]}}G.textures[z]=H}for(t in F.materials){z=F.materials[t];for(D in z.parameters)if(D=="envMap"||D=="map"||D=="lightMap")z.parameters[D]=G.textures[z.parameters[D]];else if(D=="shading")z.parameters[D]=
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:g+"/"+a}function k(){for(u in F.objects)if(!G.objects[u])if(x=F.objects[u],x.geometry!==void 0){if(B=G.geometries[x.geometry]){var a=!1;M=[];for(O=0;O<x.materials.length;O++)M[O]=G.materials[x.materials[O]],a=M[O]instanceof THREE.ShaderMaterial;a&&B.computeTangents();w=x.position;r=x.rotation;
+q=x.quaternion;s=x.scale;q=0;M.length==0&&(M[0]=new THREE.MeshFaceMaterial);M.length>1&&(M=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(B,M);object.name=u;object.position.set(w[0],w[1],w[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;G.scene.add(object);G.objects[u]=object;x.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),G.scene.collisions.colliders.push(a));
+if(x.castsShadow)a=new THREE.ShadowVolume(B),G.scene.add(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},G.triggers[object.name]=a)}}else w=x.position,r=x.rotation,q=x.quaternion,s=x.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(w[0],w[1],w[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,G.scene.add(object),G.objects[u]=object,G.empties[u]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},G.triggers[object.name]=a)}function l(a){return function(c){G.geometries[a]=c;k();L-=1;b.onLoadComplete();o()}}function m(a){return function(b){G.geometries[a]=b}}function o(){b.callbackProgress({totalModels:K,totalTextures:P,loadedModels:K-L,loadedTextures:P-N},G);b.onLoadProgress();L==0&&N==0&&c(G)}var n,t,
+u,y,v,p,z,x,w,A,D,B,E,I,H,M,C,F,J,L,N,K,P,G;F=a.data;H=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=L=0;G={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(u in F.objects)if(x=F.objects[u],x.meshCollider){a=!0;break}if(a)G.scene.collisions=new THREE.CollisionSystem;if(F.transform){a=F.transform.position;A=F.transform.rotation;var S=F.transform.scale;a&&G.scene.position.set(a[0],a[1],a[2]);A&&G.scene.rotation.set(A[0],
+A[1],A[2]);S&&G.scene.scale.set(S[0],S[1],S[2]);(a||A||S)&&G.scene.updateMatrix()}a=function(){N-=1;o();b.onLoadComplete()};for(v in F.cameras){A=F.cameras[v];if(A.type=="perspective")E=new THREE.Camera(A.fov,A.aspect,A.near,A.far),E.useTarget=!0;else if(A.type=="ortho")E=new THREE.Camera,E.useTarget=!0,E.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far);w=A.position;A=A.target;E.position.set(w[0],w[1],w[2]);E.target.position.set(A[0],A[1],A[2]);G.cameras[v]=E}for(y in F.lights)v=
+F.lights[y],E=v.color!==void 0?v.color:16777215,A=v.intensity!==void 0?v.intensity:1,v.type=="directional"?(w=v.direction,C=new THREE.DirectionalLight(E,A),C.position.set(w[0],w[1],w[2]),C.position.normalize()):v.type=="point"?(w=v.position,d=v.distance,C=new THREE.PointLight(E,A,d),C.position.set(w[0],w[1],w[2])):v.type=="ambient"&&(C=new THREE.AmbientLight(E)),G.scene.add(C),G.lights[y]=C;for(p in F.fogs)y=F.fogs[p],y.type=="linear"?I=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(I=new THREE.FogExp2(0,
+y.density)),A=y.color,I.color.setRGB(A[0],A[1],A[2]),G.fogs[p]=I;if(G.cameras&&F.defaults.camera)G.currentCamera=G.cameras[F.defaults.camera];if(G.fogs&&F.defaults.fog)G.scene.fog=G.fogs[F.defaults.fog];A=F.defaults.bgcolor;G.bgColor=new THREE.Color;G.bgColor.setRGB(A[0],A[1],A[2]);G.bgColorAlpha=F.defaults.bgalpha;for(n in F.geometries)if(p=F.geometries[n],p.type=="bin_mesh"||p.type=="ascii_mesh")L+=1,b.onLoadStart();K=L;for(n in F.geometries)p=F.geometries[n],p.type=="cube"?(B=new THREE.CubeGeometry(p.width,
+p.height,p.depth,p.segmentsWidth,p.segmentsHeight,p.segmentsDepth,null,p.flipped,p.sides),G.geometries[n]=B):p.type=="plane"?(B=new THREE.PlaneGeometry(p.width,p.height,p.segmentsWidth,p.segmentsHeight),G.geometries[n]=B):p.type=="sphere"?(B=new THREE.SphereGeometry(p.radius,p.segmentsWidth,p.segmentsHeight),G.geometries[n]=B):p.type=="cylinder"?(B=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),G.geometries[n]=B):p.type=="torus"?(B=new THREE.TorusGeometry(p.radius,p.tube,
+p.segmentsR,p.segmentsT),G.geometries[n]=B):p.type=="icosahedron"?(B=new THREE.IcosahedronGeometry(p.subdivisions),G.geometries[n]=B):p.type=="bin_mesh"?H.load({model:e(p.url,F.urlBaseType),callback:l(n)}):p.type=="ascii_mesh"?J.load({model:e(p.url,F.urlBaseType),callback:l(n)}):p.type=="embedded_mesh"&&(p=F.embeds[p.id])&&J.createModel(p,m(n),"");for(z in F.textures)if(n=F.textures[z],n.url instanceof Array){N+=n.url.length;for(H=0;H<n.url.length;H++)b.onLoadStart()}else N+=1,b.onLoadStart();P=N;
+for(z in F.textures){n=F.textures[z];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){H=[];for(var O=0;O<n.url.length;O++)H[O]=e(n.url[O],F.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,n.mapping,a)}else{H=THREE.ImageUtils.loadTexture(e(n.url,F.urlBaseType),n.mapping,a);if(THREE[n.minFilter]!=void 0)H.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)H.magFilter=THREE[n.magFilter];if(n.repeat){H.repeat.set(n.repeat[0],n.repeat[1]);
+if(n.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(n.repeat[1]!=1)H.wrapT=THREE.RepeatWrapping}n.offset&&H.offset.set(n.offset[0],n.offset[1]);if(n.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[n.wrap[0]]!==void 0)H.wrapS=J[n.wrap[0]];if(J[n.wrap[1]]!==void 0)H.wrapT=J[n.wrap[1]]}}G.textures[z]=H}for(t in F.materials){z=F.materials[t];for(D in z.parameters)if(D=="envMap"||D=="map"||D=="lightMap")z.parameters[D]=G.textures[z.parameters[D]];else if(D=="shading")z.parameters[D]=
 z.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(D=="blending")z.parameters[D]=THREE[z.parameters[D]]?THREE[z.parameters[D]]:THREE.NormalBlending;else if(D=="combine")z.parameters[D]=z.parameters[D]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(D=="vertexColors")if(z.parameters[D]=="face")z.parameters[D]=THREE.FaceColors;else if(z.parameters[D])z.parameters[D]=THREE.VertexColors;if(z.parameters.opacity!==void 0&&z.parameters.opacity<1)z.parameters.transparent=
-!0;if(z.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(o.uniforms);H=z.parameters.color;J=z.parameters.specular;p=z.parameters.ambient;I=z.parameters.shininess;a.tNormal.texture=G.textures[z.parameters.normalMap];if(z.parameters.normalMapFactor)a.uNormalScale.value=z.parameters.normalMapFactor;if(z.parameters.map)a.tDiffuse.texture=z.parameters.map,a.enableDiffuse.value=!0;if(z.parameters.lightMap)a.tAO.texture=z.parameters.lightMap,a.enableAO.value=!0;if(z.parameters.specularMap)a.tSpecular.texture=
-G.textures[z.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(H);a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(p);a.uShininess.value=I;if(z.parameters.opacity)a.uOpacity.value=z.parameters.opacity;z=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else z=new THREE[z.type](z.parameters);G.materials[t]=z}k();b.callbackSync(G)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
+!0;if(z.parameters.normalMap){n=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(n.uniforms);H=z.parameters.color;J=z.parameters.specular;p=z.parameters.ambient;I=z.parameters.shininess;a.tNormal.texture=G.textures[z.parameters.normalMap];if(z.parameters.normalMapFactor)a.uNormalScale.value=z.parameters.normalMapFactor;if(z.parameters.map)a.tDiffuse.texture=z.parameters.map,a.enableDiffuse.value=!0;if(z.parameters.lightMap)a.tAO.texture=z.parameters.lightMap,a.enableAO.value=!0;if(z.parameters.specularMap)a.tSpecular.texture=
+G.textures[z.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(H);a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(p);a.uShininess.value=I;if(z.parameters.opacity)a.uOpacity.value=z.parameters.opacity;z=new THREE.ShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:a,lights:!0,fog:!0})}else z=new THREE[z.type](z.parameters);G.materials[t]=z}k();b.callbackSync(G)}},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 c=new XMLHttpRequest,b=a.model,e=a.callback,g=a.scale!==void 0?a.scale:1,h=a.offsetX!==void 0?a.offsetX:0,f=a.offsetY!==void 0?a.offsetY:0,k=a.offsetZ!==void 0?a.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,e,g,h,f,k):alert("Couldn't load ["+b+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",b,!0);c.send(null)};
 THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,g=0;g<8;g++){for(var h=0,f=0;f<c;++f){var k=a.charCodeAt(f+e);h+=k>>1^-(k&1);b[8*f+g]=h}e+=c}c=a.length-e;h=new Uint16Array(c);for(g=f=0;g<c;g++)k=a.charCodeAt(g+e),h[g]=f-k,k==0&&f++;return[b,h]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,g,h){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],n=[];(function(a,f,l){for(var m,n,p,z=a.length;l<z;l+=f)m=a[l],n=a[l+1],p=a[l+2],m=m/16383*b,n=n/16383*b,p=p/16383*b,m+=e,n+=g,p+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,p)))})(f[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,n.push(e,1-f)})(f[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,m.push(e,f,g)})(f[0],8,5);(function(a){var b,e,f,g,h,l,w,x,A,D=a.length;for(b=0;b<D;b+=3){e=a[b];f=a[b+1];g=a[b+2];h=c;x=e;A=f;l=g;w=e;var B=f,E=g,I=h.materials[0],H=m[B*3],M=m[B*3+1],B=m[B*3+2],C=m[E*3],F=m[E*3+1],E=m[E*3+2];w=new THREE.Vector3(m[w*3],m[w*3+1],m[w*3+2]);B=new THREE.Vector3(H,M,B);E=new THREE.Vector3(C,F,E);h.faces.push(new THREE.Face3(x,A,l,[w,B,E],null,I));h=n[e*2];e=n[e*2+
-1];l=n[f*2];w=n[f*2+1];x=n[g*2];A=n[g*2+1];g=c.faceVertexUvs[0];f=l;l=w;w=[];w.push(new THREE.UV(h,e));w.push(new THREE.UV(f,l));w.push(new THREE.UV(x,A));g.push(w)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,g,h){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],o=[];(function(a,f,l){for(var m,o,p,z=a.length;l<z;l+=f)m=a[l],o=a[l+1],p=a[l+2],m=m/16383*b,o=o/16383*b,p=p/16383*b,m+=e,o+=g,p+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(m,o,p)))})(f[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,o.push(e,1-f)})(f[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,m.push(e,f,g)})(f[0],8,5);(function(a){var b,e,f,g,h,l,x,w,A,D=a.length;for(b=0;b<D;b+=3){e=a[b];f=a[b+1];g=a[b+2];h=c;w=e;A=f;l=g;x=e;var B=f,E=g,I=h.materials[0],H=m[B*3],M=m[B*3+1],B=m[B*3+2],C=m[E*3],F=m[E*3+1],E=m[E*3+2];x=new THREE.Vector3(m[x*3],m[x*3+1],m[x*3+2]);B=new THREE.Vector3(H,M,B);E=new THREE.Vector3(C,F,E);h.faces.push(new THREE.Face3(w,A,l,[x,B,E],null,I));h=o[e*2];e=o[e*2+
+1];l=o[f*2];x=o[f*2+1];w=o[g*2];A=o[g*2+1];g=c.faceVertexUvs[0];f=l;l=x;x=[];x.push(new THREE.UV(h,e));x.push(new THREE.UV(f,l));x.push(new THREE.UV(w,A));g.push(x)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
 b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];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,c,g){return a+(c-a)*g};this.VIntX=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k+f*this.delta;c[h+1]=l;c[h+2]=m;g[h]=this.lerp(n[a],n[a+3],f);g[h+1]=this.lerp(n[a+1],n[a+4],f);g[h+2]=this.lerp(n[a+2],n[a+5],f)};this.VIntY=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l+f*this.delta;c[h+
-2]=m;c=a+this.yd*3;g[h]=this.lerp(n[a],n[c],f);g[h+1]=this.lerp(n[a+1],n[c+1],f);g[h+2]=this.lerp(n[a+2],n[c+2],f)};this.VIntZ=function(a,c,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;c[h]=k;c[h+1]=l;c[h+2]=m+f*this.delta;c=a+this.zd*3;g[h]=this.lerp(n[a],n[c],f);g[h+1]=this.lerp(n[a+1],n[c+1],f);g[h+2]=this.lerp(n[a+2],n[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-this.field[a+
-this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,h,f,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,t=l+this.zd,u=h+this.yd+this.zd,y=l+this.yd+this.zd,v=0,p=this.field[h],z=this.field[l],w=this.field[m],x=this.field[o],A=this.field[n],D=this.field[t],B=this.field[u],E=this.field[y];p<f&&(v|=1);z<f&&(v|=2);w<f&&(v|=8);x<f&&(v|=4);A<f&&(v|=16);D<f&&(v|=32);B<f&&(v|=128);E<f&&(v|=64);var I=THREE.edgeTable[v];if(I==0)return 0;var H=this.delta,
-M=a+H,C=c+H,H=g+H;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,c,g,p,z));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,f,M,c,g,z,x));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,f,a,C,g,w,x));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,c,g,p,w));I&16&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,12,f,a,c,H,A,D));I&32&&(this.compNorm(t),
-this.compNorm(y),this.VIntY(t*3,this.vlist,this.nlist,15,f,M,c,H,D,E));I&64&&(this.compNorm(u),this.compNorm(y),this.VIntX(u*3,this.vlist,this.nlist,18,f,a,C,H,B,E));I&128&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,21,f,a,c,H,A,B));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,c,g,p,A));I&512&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,27,f,M,c,g,z,D));I&1024&&(this.compNorm(o),this.compNorm(y),this.VIntZ(o*
-3,this.vlist,this.nlist,30,f,M,C,g,x,E));I&2048&&(this.compNorm(m),this.compNorm(u),this.VIntZ(m*3,this.vlist,this.nlist,33,f,a,C,g,w,B));v<<=4;for(f=h=0;THREE.triTable[v+f]!=-1;)a=v+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],k),f+=3,h++;return h};this.posnormtriv=function(a,c,g,h,f,k){var l=this.count*3;this.positionArray[l]=a[g];this.positionArray[l+1]=a[g+1];this.positionArray[l+2]=a[g+2];this.positionArray[l+3]=a[h];this.positionArray[l+
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,g){return a+(c-a)*g};this.VIntX=function(a,c,g,h,f,k,l,m,o,n){f=(f-o)/(n-o);o=this.normal_cache;c[h]=k+f*this.delta;c[h+1]=l;c[h+2]=m;g[h]=this.lerp(o[a],o[a+3],f);g[h+1]=this.lerp(o[a+1],o[a+4],f);g[h+2]=this.lerp(o[a+2],o[a+5],f)};this.VIntY=function(a,c,g,h,f,k,l,m,o,n){f=(f-o)/(n-o);o=this.normal_cache;c[h]=k;c[h+1]=l+f*this.delta;c[h+
+2]=m;c=a+this.yd*3;g[h]=this.lerp(o[a],o[c],f);g[h+1]=this.lerp(o[a+1],o[c+1],f);g[h+2]=this.lerp(o[a+2],o[c+2],f)};this.VIntZ=function(a,c,g,h,f,k,l,m,o,n){f=(f-o)/(n-o);o=this.normal_cache;c[h]=k;c[h+1]=l;c[h+2]=m+f*this.delta;c=a+this.zd*3;g[h]=this.lerp(o[a],o[c],f);g[h+1]=this.lerp(o[a+1],o[c+1],f);g[h+2]=this.lerp(o[a+2],o[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-this.field[a+
+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,h,f,k){var l=h+1,m=h+this.yd,o=h+this.zd,n=l+this.yd,t=l+this.zd,u=h+this.yd+this.zd,y=l+this.yd+this.zd,v=0,p=this.field[h],z=this.field[l],x=this.field[m],w=this.field[n],A=this.field[o],D=this.field[t],B=this.field[u],E=this.field[y];p<f&&(v|=1);z<f&&(v|=2);x<f&&(v|=8);w<f&&(v|=4);A<f&&(v|=16);D<f&&(v|=32);B<f&&(v|=128);E<f&&(v|=64);var I=THREE.edgeTable[v];if(I==0)return 0;var H=this.delta,
+M=a+H,C=c+H,H=g+H;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,c,g,p,z));I&2&&(this.compNorm(l),this.compNorm(n),this.VIntY(l*3,this.vlist,this.nlist,3,f,M,c,g,z,w));I&4&&(this.compNorm(m),this.compNorm(n),this.VIntX(m*3,this.vlist,this.nlist,6,f,a,C,g,x,w));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,c,g,p,x));I&16&&(this.compNorm(o),this.compNorm(t),this.VIntX(o*3,this.vlist,this.nlist,12,f,a,c,H,A,D));I&32&&(this.compNorm(t),
+this.compNorm(y),this.VIntY(t*3,this.vlist,this.nlist,15,f,M,c,H,D,E));I&64&&(this.compNorm(u),this.compNorm(y),this.VIntX(u*3,this.vlist,this.nlist,18,f,a,C,H,B,E));I&128&&(this.compNorm(o),this.compNorm(u),this.VIntY(o*3,this.vlist,this.nlist,21,f,a,c,H,A,B));I&256&&(this.compNorm(h),this.compNorm(o),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,c,g,p,A));I&512&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,27,f,M,c,g,z,D));I&1024&&(this.compNorm(n),this.compNorm(y),this.VIntZ(n*
+3,this.vlist,this.nlist,30,f,M,C,g,w,E));I&2048&&(this.compNorm(m),this.compNorm(u),this.VIntZ(m*3,this.vlist,this.nlist,33,f,a,C,g,x,B));v<<=4;for(f=h=0;THREE.triTable[v+f]!=-1;)a=v+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],k),f+=3,h++;return h};this.posnormtriv=function(a,c,g,h,f,k){var l=this.count*3;this.positionArray[l]=a[g];this.positionArray[l+1]=a[g+1];this.positionArray[l+2]=a[g+2];this.positionArray[l+3]=a[h];this.positionArray[l+
 4]=a[h+1];this.positionArray[l+5]=a[h+2];this.positionArray[l+6]=a[f];this.positionArray[l+7]=a[f+1];this.positionArray[l+8]=a[f+2];this.normalArray[l]=c[g];this.normalArray[l+1]=c[g+1];this.normalArray[l+2]=c[g+2];this.normalArray[l+3]=c[h];this.normalArray[l+4]=c[h+1];this.normalArray[l+5]=c[h+2];this.normalArray[l+6]=c[f];this.normalArray[l+7]=c[f+1];this.normalArray[l+8]=c[f+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(a){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,h,f){var k=this.size*Math.sqrt(h/f),l=g*this.size,m=c*this.size,n=a*this.size,o=Math.floor(l-k);o<1&&(o=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var u=Math.floor(n-k);u<1&&(u=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size-
-1);for(var y,v,p,z,w,x;o<l;o++){n=this.size2*o;v=o/this.size-g;w=v*v;for(v=t;v<m;v++){p=n+this.size*v;y=v/this.size-c;x=y*y;for(y=u;y<k;y++)z=y/this.size-a,z=h/(1.0E-6+z*z+x+w)-f,z>0&&(this.field[p+y]+=z)}}};this.addPlaneX=function(a,c){var g,h,f,k,l,m=this.size,n=this.yd,o=this.zd,t=this.field,u=m*Math.sqrt(a/c);u>m&&(u=m);for(g=0;g<u;g++)if(h=g/m,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<m;h++){l=g+h*n;for(f=0;f<m;f++)t[o*f+l]+=k}};this.addPlaneY=function(a,c){var g,h,f,k,l,m,n=this.size,o=this.yd,t=
-this.zd,u=this.field,y=n*Math.sqrt(a/c);y>n&&(y=n);for(h=0;h<y;h++)if(g=h/n,g*=g,k=a/(1.0E-4+g)-c,k>0){l=h*o;for(g=0;g<n;g++){m=l+g;for(f=0;f<n;f++)u[t*f+m]+=k}}};this.addPlaneZ=function(a,c){var g,h,f,k,l,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(f=0;f<dist;f++)if(g=f/size,g*=g,k=a/(1.0E-4+g)-c,k>0){l=zd*f;for(h=0;h<size;h++){m=l+h*yd;for(g=0;g<size;g++)field[m+g]+=k}}};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 c,g,h,f,k,l,m,n,o,t=this.size-2;for(f=1;f<t;f++){o=this.size2*f;m=(f-this.halfsize)/this.halfsize;for(h=1;h<t;h++){n=o+this.size*h;l=(h-this.halfsize)/this.halfsize;for(g=1;g<t;g++)k=(g-this.halfsize)/this.halfsize,c=n+g,this.polygonize(k,l,m,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(h){var f,k,l,m,n,o,t,u;for(f=0;f<h.count;f++)t=f*3,n=t+1,u=t+2,k=h.positionArray[t],
-l=h.positionArray[n],m=h.positionArray[u],o=new THREE.Vector3(k,l,m),k=h.normalArray[t],l=h.normalArray[n],m=h.normalArray[u],t=new THREE.Vector3(k,l,m),t.normalize(),n=new THREE.Vertex(o),c.vertices.push(n),g.push(t);nfaces=h.count/3;for(f=0;f<nfaces;f++)t=(a+f)*3,n=t+1,u=t+2,o=g[t],k=g[n],l=g[u],t=new THREE.Face3(t,n,u,[o,k,l]),c.faces.push(t);a+=nfaces;h.count=0});return c};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 c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,h,f){var k=this.size*Math.sqrt(h/f),l=g*this.size,m=c*this.size,o=a*this.size,n=Math.floor(l-k);n<1&&(n=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var u=Math.floor(o-k);u<1&&(u=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-
+1);for(var y,v,p,z,x,w;n<l;n++){o=this.size2*n;v=n/this.size-g;x=v*v;for(v=t;v<m;v++){p=o+this.size*v;y=v/this.size-c;w=y*y;for(y=u;y<k;y++)z=y/this.size-a,z=h/(1.0E-6+z*z+w+x)-f,z>0&&(this.field[p+y]+=z)}}};this.addPlaneX=function(a,c){var g,h,f,k,l,m=this.size,o=this.yd,n=this.zd,t=this.field,u=m*Math.sqrt(a/c);u>m&&(u=m);for(g=0;g<u;g++)if(h=g/m,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<m;h++){l=g+h*o;for(f=0;f<m;f++)t[n*f+l]+=k}};this.addPlaneY=function(a,c){var g,h,f,k,l,m,o=this.size,n=this.yd,t=
+this.zd,u=this.field,y=o*Math.sqrt(a/c);y>o&&(y=o);for(h=0;h<y;h++)if(g=h/o,g*=g,k=a/(1.0E-4+g)-c,k>0){l=h*n;for(g=0;g<o;g++){m=l+g;for(f=0;f<o;f++)u[t*f+m]+=k}}};this.addPlaneZ=function(a,c){var g,h,f,k,l,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(f=0;f<dist;f++)if(g=f/size,g*=g,k=a/(1.0E-4+g)-c,k>0){l=zd*f;for(h=0;h<size;h++){m=l+h*yd;for(g=0;g<size;g++)field[m+g]+=k}}};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 c,g,h,f,k,l,m,o,n,t=this.size-2;for(f=1;f<t;f++){n=this.size2*f;m=(f-this.halfsize)/this.halfsize;for(h=1;h<t;h++){o=n+this.size*h;l=(h-this.halfsize)/this.halfsize;for(g=1;g<t;g++)k=(g-this.halfsize)/this.halfsize,c=o+g,this.polygonize(k,l,m,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(h){var f,k,l,m,o,n,t,u;for(f=0;f<h.count;f++)t=f*3,o=t+1,u=t+2,k=h.positionArray[t],
+l=h.positionArray[o],m=h.positionArray[u],n=new THREE.Vector3(k,l,m),k=h.normalArray[t],l=h.normalArray[o],m=h.normalArray[u],t=new THREE.Vector3(k,l,m),t.normalize(),o=new THREE.Vertex(n),c.vertices.push(o),g.push(t);nfaces=h.count/3;for(f=0;f<nfaces;f++)t=(a+f)*3,o=t+1,u=t+2,n=g[t],k=g[o],l=g[u],t=new THREE.Face3(t,o,u,[n,k,l]),c.faces.push(t);a+=nfaces;h.count=0});return c};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]);
@@ -339,8 +339,8 @@ THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.
 THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,e,g,h=0;c=0;for(b=this.colliders.length;c<b;c++)if(g=this.colliders[c],e=this.rayCast(a,g),e<Number.MAX_VALUE)g.distance=e,e>h?this.hits.push(g):this.hits.unshift(g),h=e;return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,c[b]);if(e.dist<Number.MAX_VALUE){c[b].distance=e.dist;c[b].faceIndex=e.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
 THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,g,h=0;h<c.numFaces;h++){var f=c.mesh.geometry.faces[h],k=c.mesh.geometry.vertices[f.a].position,l=c.mesh.geometry.vertices[f.b].position,m=c.mesh.geometry.vertices[f.c].position,n=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,k,l,m,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-f instanceof THREE.Face4&&(f=this.rayTriangle(b,k,l,n,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,l,m,n,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:g}};
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,g,h=0;h<c.numFaces;h++){var f=c.mesh.geometry.faces[h],k=c.mesh.geometry.vertices[f.a].position,l=c.mesh.geometry.vertices[f.b].position,m=c.mesh.geometry.vertices[f.c].position,o=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,k,l,m,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+f instanceof THREE.Face4&&(f=this.rayTriangle(b,k,l,o,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,l,m,o,e,this.collisionNormal,c.mesh),f<e&&(e=f,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:g}};
 THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,e,g,h,f){var k=THREE.CollisionSystem.__v1,l=THREE.CollisionSystem.__v2;h.set(0,0,0);k.sub(b,c);l.sub(e,b);h.cross(k,l);k=h.dot(a.direction);if(!(k<0))if(f.doubleSided||f.flipSided)h.multiplyScalar(-1),k*=-1;else return Number.MAX_VALUE;f=h.dot(c)-h.dot(a.origin);if(!(f<=0))return Number.MAX_VALUE;if(!(f>=k*g))return Number.MAX_VALUE;f/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(f);k.addSelf(a.origin);Math.abs(h.x)>
 Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=k.y-c.y,h=b.y-c.y,g=e.y-c.y,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,h=b.x-c.x,g=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(a=k.x-c.x,h=b.x-c.x,g=e.x-c.x,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,h=b.x-c.x,g=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y);c=h*e-b*g;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-k*g)*c;if(!(e>=0))return Number.MAX_VALUE;c*=h*k-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return f};
 THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,b);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);b.multiplyVector3(e.origin);b.rotateAxis(e.direction);e.direction.normalize();return e};
@@ -350,9 +350,9 @@ e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case
 THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);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 c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 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 c=this,b=this.setSize,e=this.render,g=new THREE.Camera,h=new THREE.Camera,f=new THREE.Matrix4,k=new THREE.Matrix4,l,m,n;g.useTarget=h.useTarget=!1;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.WebGLRenderTarget(512,512,a),u=new THREE.Camera(53,1,1,1E4);u.position.z=
-2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:t}},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 y=new THREE.Scene;y.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){b.call(c,a,e);o.width=a;o.height=e;t.width=a;t.height=e};this.render=function(a,b){b.update(null,!0);if(l!==b.aspect||m!==b.near||n!==b.fov){l=b.aspect;m=b.near;n=b.fov;var z=b.projectionMatrix.clone(),w=125/30*0.5,x=w*m/125,A=m*Math.tan(n*Math.PI/360),D;f.n14=w;k.n14=-w;w=-A*l+x;D=A*l+x;z.n11=2*m/(D-w);z.n13=(D+w)/(D-w);g.projectionMatrix=z.clone();w=-A*l-x;D=A*l-x;z.n11=2*m/(D-w);z.n13=
-(D+w)/(D-w);h.projectionMatrix=z.clone()}g.matrix=b.matrixWorld.clone().multiplySelf(k);g.update(null,!0);g.position.copy(b.position);g.near=m;g.far=b.far;e.call(c,a,g,o,!0);h.matrix=b.matrixWorld.clone().multiplySelf(f);h.update(null,!0);h.position.copy(b.position);h.near=m;h.far=b.far;e.call(c,a,h,t,!0);e.call(c,y,u)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var c=this,b=this.setSize,e=this.render,g=new THREE.Camera,h=new THREE.Camera,f=new THREE.Matrix4,k=new THREE.Matrix4,l,m,o;g.useTarget=h.useTarget=!1;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.WebGLRenderTarget(512,512,a),u=new THREE.Camera(53,1,1,1E4);u.position.z=
+2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:n},mapRight:{type:"t",value:1,texture:t}},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 y=new THREE.Scene;y.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){b.call(c,a,e);n.width=a;n.height=e;t.width=a;t.height=e};this.render=function(a,b){b.update(null,!0);if(l!==b.aspect||m!==b.near||o!==b.fov){l=b.aspect;m=b.near;o=b.fov;var z=b.projectionMatrix.clone(),x=125/30*0.5,w=x*m/125,A=m*Math.tan(o*Math.PI/360),D;f.n14=x;k.n14=-x;x=-A*l+w;D=A*l+w;z.n11=2*m/(D-x);z.n13=(D+x)/(D-x);g.projectionMatrix=z.clone();x=-A*l-w;D=A*l-w;z.n11=2*m/(D-x);z.n13=
+(D+x)/(D-x);h.projectionMatrix=z.clone()}g.matrix=b.matrixWorld.clone().multiplySelf(k);g.update(null,!0);g.position.copy(b.position);g.near=m;g.far=b.far;e.call(c,a,g,n,!0);h.matrix=b.matrixWorld.clone().multiplySelf(f);h.update(null,!0);h.position.copy(b.position);h.near=m;h.far=b.far;e.call(c,a,h,t,!0);e.call(c,y,u)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,g,h,f=new THREE.Camera;f.useTarget=!0;var k=new THREE.Camera;k.useTarget=!0;c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);g=a/2;h=e};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=b.far;f.updateProjectionMatrix();f.position.copy(b.position);
 f.target.position.copy(b.target.position);f.translateX(c.separation);k.projectionMatrix=f.projectionMatrix;k.position.copy(b.position);k.target.position.copy(b.target.position);k.translateX(-c.separation);this.setViewport(0,0,g,h);e.call(c,a,f);this.setViewport(g,0,g,h);e.call(c,a,k,!1)}};

+ 19 - 5
examples/misc_camera_path.html

@@ -39,12 +39,15 @@
 
 		<script src="../build/Three.js"></script>
 
+		<script src="js/Detector.js"></script>
 		<script src="js/RequestAnimationFrame.js"></script>
 		<script src="js/Stats.js"></script>
 
 
 		<script>
 
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
 			var container, stats;
 
 			var camera, controls, scene, renderer;
@@ -61,21 +64,23 @@
 
 				camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 1000 );
 
-				/*
 				controls = new THREE.PathControls( camera );
+
 				controls.waypoints = [ [ -500, 0, 0 ], [ 0, 200, 0 ], [ 500, 0, 0 ] ];
 				controls.duration = 28
 				controls.useConstantSpeed = true;
-				controls.resamplingCoef = 1;
-				controls.createDebugPath = true;
-				controls.createDebugDummy = true;
+				//controls.createDebugPath = true;
+				//controls.createDebugDummy = true;
 				controls.lookSpeed = 0.0006;
 				controls.lookVertical = true;
 				controls.lookHorizontal = true;
 				controls.verticalAngleMap = { srcRange: [ 0, 2 * Math.PI ], dstRange: [ 1.1, 3.8 ] };
 				controls.horizontalAngleMap = { srcRange: [ 0, 2 * Math.PI ], dstRange: [ 0.3, Math.PI - 0.3 ] };
 				controls.lon = 180;
-				*/
+
+				controls.init();
+
+				scene.add( controls.animationParent );
 
 				// world
 
@@ -126,12 +131,18 @@
 				container = document.getElementById( 'container' );
 				container.appendChild( renderer.domElement );
 
+				// stats
+
 				stats = new Stats();
 				stats.domElement.style.position = 'absolute';
 				stats.domElement.style.top = '0px';
 				stats.domElement.style.zIndex = 100;
 				container.appendChild( stats.domElement );
 
+				// start animation
+
+				controls.animation.play( true, 0 );
+
 			}
 
 			function animate() {
@@ -145,6 +156,9 @@
 
 			function render() {
 
+				THREE.AnimationHandler.update( 1/60 );
+
+				controls.update();
 				renderer.render( scene, camera );
 
 			}

+ 0 - 115
examples/misc_camera_trackball.html

@@ -39,121 +39,6 @@
 
 		<script src="../build/Three.js"></script>
 
-		<script type="text/javascript" src="../src/Three.js"></script>
-		<script type="text/javascript" src="../src/core/Color.js"></script>
-		<script type="text/javascript" src="../src/core/Vector2.js"></script>
-		<script type="text/javascript" src="../src/core/Vector3.js"></script>
-		<script type="text/javascript" src="../src/core/Vector4.js"></script>
-		<script type="text/javascript" src="../src/core/Ray.js"></script>
-		<script type="text/javascript" src="../src/core/Rectangle.js"></script>
-		<script type="text/javascript" src="../src/core/Matrix3.js"></script>
-		<script type="text/javascript" src="../src/core/Matrix4.js"></script>
-		<script type="text/javascript" src="../src/core/Object3D.js"></script>
-		<script type="text/javascript" src="../src/core/Projector.js"></script>
-		<script type="text/javascript" src="../src/core/Quaternion.js"></script>
-		<script type="text/javascript" src="../src/core/Vertex.js"></script>
-		<script type="text/javascript" src="../src/core/Face3.js"></script>
-		<script type="text/javascript" src="../src/core/Face4.js"></script>
-		<script type="text/javascript" src="../src/core/UV.js"></script>
-		<script type="text/javascript" src="../src/core/Geometry.js"></script>
-		<script type="text/javascript" src="../src/core/Spline.js"></script>
-		<script type="text/javascript" src="../src/core/Edge.js"></script>
-		<script type="text/javascript" src="../src/cameras/Camera.js"></script>
-		<script type="text/javascript" src="../src/cameras/OrthographicCamera.js"></script>
-		<script type="text/javascript" src="../src/cameras/PerspectiveCamera.js"></script>
-		<script type="text/javascript" src="../src/lights/Light.js"></script>
-		<script type="text/javascript" src="../src/lights/AmbientLight.js"></script>
-		<script type="text/javascript" src="../src/lights/DirectionalLight.js"></script>
-		<script type="text/javascript" src="../src/lights/PointLight.js"></script>
-		<script type="text/javascript" src="../src/lights/SpotLight.js"></script>
-		<script type="text/javascript" src="../src/materials/Material.js"></script>
-		<script type="text/javascript" src="../src/materials/LineBasicMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshBasicMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshLambertMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshPhongMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshDepthMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshNormalMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshFaceMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshShaderMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/ParticleBasicMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/ParticleCanvasMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/ParticleDOMMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/ShaderMaterial.js"></script>
-		<script type="text/javascript" src="../src/textures/Texture.js"></script>
-		<script type="text/javascript" src="../src/textures/DataTexture.js"></script>
-		<script type="text/javascript" src="../src/objects/Particle.js"></script>
-		<script type="text/javascript" src="../src/objects/ParticleSystem.js"></script>
-		<script type="text/javascript" src="../src/objects/Line.js"></script>
-		<script type="text/javascript" src="../src/objects/Mesh.js"></script>
-		<script type="text/javascript" src="../src/objects/Bone.js"></script>
-		<script type="text/javascript" src="../src/objects/SkinnedMesh.js"></script>
-		<script type="text/javascript" src="../src/objects/Ribbon.js"></script>
-		<script type="text/javascript" src="../src/objects/LOD.js"></script>
-		<script type="text/javascript" src="../src/objects/Sprite.js"></script>
-		<script type="text/javascript" src="../src/scenes/Scene.js"></script>
-		<script type="text/javascript" src="../src/scenes/Fog.js"></script>
-		<script type="text/javascript" src="../src/scenes/FogExp2.js"></script>
-		<script type="text/javascript" src="../src/renderers/DOMRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/CanvasRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/SVGRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/WebGLShaders.js"></script>
-		<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/WebGLRenderTarget.js"></script>
-		<script type="text/javascript" src="../src/renderers/WebGLRenderTargetCube.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableVertex.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace4.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableObject.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableParticle.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableLine.js"></script>
-		<script type="text/javascript" src="../src/extras/ColorUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/GeometryUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/ImageUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/SceneUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/ShaderUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/core/Curve.js"></script>
-		<script type="text/javascript" src="../src/extras/core/CurvePath.js"></script>
-		<script type="text/javascript" src="../src/extras/core/Path.js"></script>
-		<script type="text/javascript" src="../src/extras/core/Shape.js"></script>
-		<script type="text/javascript" src="../src/extras/core/TextPath.js"></script>
-		<script type="text/javascript" src="../src/extras/animation/AnimationHandler.js"></script>
-		<script type="text/javascript" src="../src/extras/animation/Animation.js"></script>
-		<script type="text/javascript" src="../src/extras/cameras/CubeCamera.js"></script>
-		<script type="text/javascript" src="../src/extras/cameras/FirstPersonCamera.js"></script>
-		<script type="text/javascript" src="../src/extras/cameras/PathCamera.js"></script>
-		<script type="text/javascript" src="../src/extras/cameras/FlyCamera.js"></script>
-		<script type="text/javascript" src="../src/extras/cameras/RollCamera.js"></script>
-		<script type="text/javascript" src="../src/extras/cameras/TrackballCamera.js"></script>
-		<script type="text/javascript" src="../src/extras/controls/FirstPersonControls.js"></script>
-		<script type="text/javascript" src="../src/extras/controls/PathControls.js"></script>
-		<script type="text/javascript" src="../src/extras/controls/FlyControls.js"></script>
-		<script type="text/javascript" src="../src/extras/controls/RollControls.js"></script>
-		<script type="text/javascript" src="../src/extras/controls/TrackballControls.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/CubeGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/CylinderGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/ExtrudeGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/IcosahedronGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/LatheGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/OctahedronGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/PlaneGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/SphereGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/TextGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/TorusGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/TorusKnotGeometry.js"></script>
-		<script type="text/javascript" src="../src/extras/modifiers/SubdivisionModifier.js"></script>
-		<script type="text/javascript" src="../src/extras/loaders/Loader.js"></script>
-		<script type="text/javascript" src="../src/extras/loaders/BinaryLoader.js"></script>
-		<script type="text/javascript" src="../src/extras/loaders/ColladaLoader.js"></script>
-		<script type="text/javascript" src="../src/extras/loaders/JSONLoader.js"></script>
-		<script type="text/javascript" src="../src/extras/loaders/SceneLoader.js"></script>
-		<script type="text/javascript" src="../src/extras/loaders/UTF8Loader.js"></script>
-		<script type="text/javascript" src="../src/extras/objects/Axes.js"></script>
-		<script type="text/javascript" src="../src/extras/objects/MarchingCubes.js"></script>
-		<script type="text/javascript" src="../src/extras/physics/Collisions.js"></script>
-		<script type="text/javascript" src="../src/extras/physics/CollisionUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/renderers/AnaglyphWebGLRenderer.js"></script>
-		<script type="text/javascript" src="../src/extras/renderers/CrosseyedWebGLRenderer.js"></script>
-
 		<script src="js/Detector.js"></script>
 		<script src="js/RequestAnimationFrame.js"></script>
 		<script src="js/Stats.js"></script>

+ 63 - 50
src/extras/controls/PathControls.js

@@ -2,11 +2,14 @@
  * @author alteredq / http://alteredqualia.com/
  */
 
-THREE.PathControls = function ( object ) {
+THREE.PathControls = function ( object, domElement ) {
 
 	this.object = object;
+	this.domElement = ( domElement !== undefined ) ? domElement : document;
 
-	this.id = "PathCamera" + THREE.PathCameraIdCounter ++;
+	this.id = "PathControls" + THREE.PathControlsIdCounter ++;
+
+	// API
 
 	this.duration = 10 * 1000; // milliseconds
 	this.waypoints = [];
@@ -25,7 +28,9 @@ THREE.PathControls = function ( object ) {
 	this.verticalAngleMap   = { srcRange: [ 0, 2 * Math.PI ], dstRange: [ 0, 2 * Math.PI ] };
 	this.horizontalAngleMap = { srcRange: [ 0, 2 * Math.PI ], dstRange: [ 0, 2 * Math.PI ] };
 
-	this.domElement = document;
+	// internals
+
+	this.target = new THREE.Object3D();
 
 	this.mouseX = 0;
 	this.mouseY = 0;
@@ -37,12 +42,16 @@ THREE.PathControls = function ( object ) {
 	this.theta = 0;
 
 	if ( this.domElement === document ) {
+
 		this.viewHalfX = window.innerWidth / 2;
 		this.viewHalfY = window.innerHeight / 2;
+
 	} else {
+
 		this.viewHalfX = this.domElement.offsetWidth / 2;
 		this.viewHalfY = this.domElement.offsetHeight / 2;
 		this.domElement.setAttribute( 'tabindex', -1 );
+
 	}
 
 	var PI2 = Math.PI * 2,
@@ -50,7 +59,7 @@ THREE.PathControls = function ( object ) {
 
 	// methods
 
-	this.update = function ( parentMatrixWorld, forceUpdate, camera ) {
+	this.update = function () {
 
 		var srcRange, dstRange;
 
@@ -70,52 +79,46 @@ THREE.PathControls = function ( object ) {
 		srcRange = this.verticalAngleMap.srcRange;
 		dstRange = this.verticalAngleMap.dstRange;
 
-		//this.phi = map_linear( this.phi, srcRange[ 0 ], srcRange[ 1 ], dstRange[ 0 ], dstRange[ 1 ] );
-
 		var tmpPhi = map_linear( this.phi, srcRange[ 0 ], srcRange[ 1 ], dstRange[ 0 ], dstRange[ 1 ] );
 		var tmpPhiFullRange = dstRange[ 1 ] - dstRange[ 0 ];
 		var tmpPhiNormalized = ( tmpPhi - dstRange[ 0 ] ) / tmpPhiFullRange;
 
-		this.phi = TWEEN.Easing.Quadratic.EaseInOut( tmpPhiNormalized ) * tmpPhiFullRange + dstRange[ 0 ];
+		this.phi = QuadraticEaseInOut( tmpPhiNormalized ) * tmpPhiFullRange + dstRange[ 0 ];
 
 		// constrain horizontal look angle
 
 		srcRange = this.horizontalAngleMap.srcRange;
 		dstRange = this.horizontalAngleMap.dstRange;
 
-		//this.theta = map_linear( this.theta, srcRange[ 0 ], srcRange[ 1 ], dstRange[ 0 ], dstRange[ 1 ] );
-
 		var tmpTheta = map_linear( this.theta, srcRange[ 0 ], srcRange[ 1 ], dstRange[ 0 ], dstRange[ 1 ] );
 		var tmpThetaFullRange = dstRange[ 1 ] - dstRange[ 0 ];
 		var tmpThetaNormalized = ( tmpTheta - dstRange[ 0 ] ) / tmpThetaFullRange;
 
-		this.theta = TWEEN.Easing.Quadratic.EaseInOut( tmpThetaNormalized ) * tmpThetaFullRange + dstRange[ 0 ];
+		this.theta = QuadraticEaseInOut( tmpThetaNormalized ) * tmpThetaFullRange + dstRange[ 0 ];
 
 		var targetPosition = this.target.position,
-			position = this.position;
-
-		/*
-		targetPosition.x = position.x + 100 * Math.sin( this.phi ) * Math.cos( this.theta );
-		targetPosition.y = position.y + 100 * Math.cos( this.phi );
-		targetPosition.z = position.z + 100 * Math.sin( this.phi ) * Math.sin( this.theta );
-		*/
+			position = this.object.position;
 
 		targetPosition.x = 100 * Math.sin( this.phi ) * Math.cos( this.theta );
 		targetPosition.y = 100 * Math.cos( this.phi );
 		targetPosition.z = 100 * Math.sin( this.phi ) * Math.sin( this.theta );
 
-		this.supr.update.call( this, parentMatrixWorld, forceUpdate, camera );
+		this.object.lookAt( this.target.position );
 
 	};
 
 	this.onMouseMove = function ( event ) {
 
 		if ( this.domElement === document ) {
+
 			this.mouseX = event.pageX - this.viewHalfX;
 			this.mouseY = event.pageY - this.viewHalfY;
+
 		} else {
+
 			this.mouseX = event.pageX - this.domElement.offsetLeft - this.viewHalfX;
 			this.mouseY = event.pageY - this.domElement.offsetTop - this.viewHalfY;
+
 		}
 
 	};
@@ -151,6 +154,13 @@ THREE.PathControls = function ( object ) {
 
 	};
 
+	function QuadraticEaseInOut ( k ) {
+
+		if ( ( k *= 2 ) < 1 ) return 0.5 * k * k;
+		return - 0.5 * ( --k * ( k - 2 ) - 1 );
+
+	};
+
 	function bind( scope, fn ) {
 
 		return function () {
@@ -240,10 +250,10 @@ THREE.PathControls = function ( object ) {
 			particleObj = new THREE.ParticleSystem( particleGeo, new THREE.ParticleBasicMaterial( { color: 0xffaa00, size: 3 } ) );
 
 		lineObj.scale.set( 1, 1, 1 );
-		parent.addChild( lineObj );
+		parent.add( lineObj );
 
 		particleObj.scale.set( 1, 1, 1 );
-		parent.addChild( particleObj );
+		parent.add( particleObj );
 
 		var waypoint,
 			geo = new THREE.SphereGeometry( 1, 16, 8 ),
@@ -253,58 +263,61 @@ THREE.PathControls = function ( object ) {
 
 			waypoint = new THREE.Mesh( geo, mat );
 			waypoint.position.copy( spline.points[ i ] );
-			waypoint.updateMatrix();
-			parent.addChild( waypoint );
+			parent.add( waypoint );
 
 		}
 
 	};
 
-	// constructor
+	this.init = function ( ) {
 
-	this.spline = new THREE.Spline();
-	this.spline.initFromArray( this.waypoints );
+		// constructor
 
-	if ( this.useConstantSpeed ) {
+		this.spline = new THREE.Spline();
+		this.spline.initFromArray( this.waypoints );
 
-		this.spline.reparametrizeByArcLength( this.resamplingCoef );
+		if ( this.useConstantSpeed ) {
 
-	}
+			this.spline.reparametrizeByArcLength( this.resamplingCoef );
 
-	if ( this.createDebugDummy ) {
+		}
 
-		var dummyParentMaterial = new THREE.MeshLambertMaterial( { color: 0x0077ff } ),
-		dummyChildMaterial  = new THREE.MeshLambertMaterial( { color: 0x00ff00 } ),
-		dummyParentGeo = new THREE.CubeGeometry( 10, 10, 20 ),
-		dummyChildGeo  = new THREE.CubeGeometry( 2, 2, 10 );
+		if ( this.createDebugDummy ) {
 
-		this.animationParent = new THREE.Mesh( dummyParentGeo, dummyParentMaterial );
+			var dummyParentMaterial = new THREE.MeshLambertMaterial( { color: 0x0077ff } ),
+			dummyChildMaterial  = new THREE.MeshLambertMaterial( { color: 0x00ff00 } ),
+			dummyParentGeo = new THREE.CubeGeometry( 10, 10, 20 ),
+			dummyChildGeo  = new THREE.CubeGeometry( 2, 2, 10 );
 
-		var dummyChild = new THREE.Mesh( dummyChildGeo, dummyChildMaterial );
-		dummyChild.position.set( 0, 10, 0 );
+			this.animationParent = new THREE.Mesh( dummyParentGeo, dummyParentMaterial );
 
-		this.animation = initAnimationPath( this.animationParent, this.spline, this.id, this.duration );
+			var dummyChild = new THREE.Mesh( dummyChildGeo, dummyChildMaterial );
+			dummyChild.position.set( 0, 10, 0 );
 
-		this.animationParent.addChild( this );
-		this.animationParent.addChild( this.target );
-		this.animationParent.addChild( dummyChild );
+			this.animation = initAnimationPath( this.animationParent, this.spline, this.id, this.duration );
 
-	} else {
+			this.animationParent.add( this.object );
+			this.animationParent.add( this.target );
+			this.animationParent.add( dummyChild );
+
+		} else {
 
-		this.animation = initAnimationPath( this.animationParent, this.spline, this.id, this.duration );
-		this.animationParent.addChild( this.target );
-		this.animationParent.addChild( this );
+			this.animation = initAnimationPath( this.animationParent, this.spline, this.id, this.duration );
+			this.animationParent.add( this.target );
+			this.animationParent.add( this.object );
 
-	}
+		}
 
-	if ( this.createDebugPath ) {
+		if ( this.createDebugPath ) {
 
-		createPath( this.debugPath, this.spline );
+			createPath( this.debugPath, this.spline );
 
-	}
+		}
+
+		this.domElement.addEventListener( 'mousemove', bind( this, this.onMouseMove ), false );
 
-	this.domElement.addEventListener( 'mousemove', bind( this, this.onMouseMove ), false );
+	};
 
 };
 
-THREE.PathCameraIdCounter = 0;
+THREE.PathControlsIdCounter = 0;