Browse Source

Reverted Cylinder top/bottom auto cap and offset features.

Mr.doob 14 years ago
parent
commit
d5f0ce79d4
3 changed files with 126 additions and 117 deletions
  1. 108 108
      build/Three.js
  2. 2 2
      build/custom/ThreeExtras.js
  3. 16 7
      src/extras/geometries/Cylinder.js

+ 108 - 108
build/Three.js

@@ -12,21 +12,21 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,d){this.set(a||0,c||0,b||0,d||1)};
 THREE.Vector4.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(b)))}e.sort(function(g,h){return g.distance-h.distance});return e},intersectObject:function(a){function c(E,w,G,x){x=x.clone().subSelf(w);G=G.clone().subSelf(w);var L=E.clone().subSelf(w);E=x.dot(x);w=x.dot(G);x=x.dot(L);var J=G.dot(G);G=G.dot(L);L=1/(E*J-w*w);J=(J*x-w*G)*L;E=(E*G-w*x)*L;return J>0&&E>0&&J+E<1}var b,d,e,g,h,j,k,m,q,y,
-u,o=a.geometry,v=o.vertices,A=[];b=0;for(d=o.faces.length;b<d;b++){e=o.faces[b];y=this.origin.clone();u=this.direction.clone();k=a.matrixWorld;g=k.multiplyVector3(v[e.a].position.clone());h=k.multiplyVector3(v[e.b].position.clone());j=k.multiplyVector3(v[e.c].position.clone());k=e instanceof THREE.Face4?k.multiplyVector3(v[e.d].position.clone()):null;m=a.matrixRotationWorld.multiplyVector3(e.normal.clone());q=u.dot(m);if(q<0){m=m.dot((new THREE.Vector3).sub(g,y))/q;y=y.addSelf(u.multiplyScalar(m));
-if(e instanceof THREE.Face3){if(c(y,g,h,j)){e={distance:this.origin.distanceTo(y),point:y,face:e,object:a};A.push(e)}}else if(e instanceof THREE.Face4&&(c(y,g,h,k)||c(y,h,j,k))){e={distance:this.origin.distanceTo(y),point:y,face:e,object:a};A.push(e)}}}return A}};
-THREE.Rectangle=function(){function a(){g=d-c;h=e-b}var c,b,d,e,g,h,j=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(k,m,q,y){j=!1;c=k;b=m;d=q;e=y;a()};this.addPoint=function(k,m){if(j){j=!1;c=k;b=m;d=k;e=m}else{c=c<k?c:k;b=b<m?b:m;d=d>k?d:k;e=e>m?e:m}a()};
-this.add3Points=function(k,m,q,y,u,o){if(j){j=!1;c=k<q?k<u?k:u:q<u?q:u;b=m<y?m<o?m:o:y<o?y:o;d=k>q?k>u?k:u:q>u?q:u;e=m>y?m>o?m:o:y>o?y:o}else{c=k<q?k<u?k<c?k:c:u<c?u:c:q<u?q<c?q:c:u<c?u:c;b=m<y?m<o?m<b?m:b:o<b?o:b:y<o?y<b?y:b:o<b?o:b;d=k>q?k>u?k>d?k:d:u>d?u:d:q>u?q>d?q:d:u>d?u:d;e=m>y?m>o?m>e?m:e:o>e?o:e:y>o?y>e?y:e:o>e?o:e}a()};this.addRectangle=function(k){if(j){j=!1;c=k.getLeft();b=k.getTop();d=k.getRight();e=k.getBottom()}else{c=c<k.getLeft()?c:k.getLeft();b=b<k.getTop()?b:k.getTop();d=d>k.getRight()?
+THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(b)))}e.sort(function(g,h){return g.distance-h.distance});return e},intersectObject:function(a){function c(E,x,G,y){y=y.clone().subSelf(x);G=G.clone().subSelf(x);var L=E.clone().subSelf(x);E=y.dot(y);x=y.dot(G);y=y.dot(L);var J=G.dot(G);G=G.dot(L);L=1/(E*J-x*x);J=(J*y-x*G)*L;E=(E*G-x*y)*L;return J>0&&E>0&&J+E<1}var b,d,e,g,h,j,k,m,q,w,
+u,o=a.geometry,v=o.vertices,A=[];b=0;for(d=o.faces.length;b<d;b++){e=o.faces[b];w=this.origin.clone();u=this.direction.clone();k=a.matrixWorld;g=k.multiplyVector3(v[e.a].position.clone());h=k.multiplyVector3(v[e.b].position.clone());j=k.multiplyVector3(v[e.c].position.clone());k=e instanceof THREE.Face4?k.multiplyVector3(v[e.d].position.clone()):null;m=a.matrixRotationWorld.multiplyVector3(e.normal.clone());q=u.dot(m);if(q<0){m=m.dot((new THREE.Vector3).sub(g,w))/q;w=w.addSelf(u.multiplyScalar(m));
+if(e instanceof THREE.Face3){if(c(w,g,h,j)){e={distance:this.origin.distanceTo(w),point:w,face:e,object:a};A.push(e)}}else if(e instanceof THREE.Face4&&(c(w,g,h,k)||c(w,h,j,k))){e={distance:this.origin.distanceTo(w),point:w,face:e,object:a};A.push(e)}}}return A}};
+THREE.Rectangle=function(){function a(){g=d-c;h=e-b}var c,b,d,e,g,h,j=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(k,m,q,w){j=!1;c=k;b=m;d=q;e=w;a()};this.addPoint=function(k,m){if(j){j=!1;c=k;b=m;d=k;e=m}else{c=c<k?c:k;b=b<m?b:m;d=d>k?d:k;e=e>m?e:m}a()};
+this.add3Points=function(k,m,q,w,u,o){if(j){j=!1;c=k<q?k<u?k:u:q<u?q:u;b=m<w?m<o?m:o:w<o?w:o;d=k>q?k>u?k:u:q>u?q:u;e=m>w?m>o?m:o:w>o?w:o}else{c=k<q?k<u?k<c?k:c:u<c?u:c:q<u?q<c?q:c:u<c?u:c;b=m<w?m<o?m<b?m:b:o<b?o:b:w<o?w<b?w:b:o<b?o:b;d=k>q?k>u?k>d?k:d:u>d?u:d:q>u?q>d?q:d:u>d?u:d;e=m>w?m>o?m>e?m:e:o>e?o:e:w>o?w>e?w:e:o>e?o:e}a()};this.addRectangle=function(k){if(j){j=!1;c=k.getLeft();b=k.getTop();d=k.getRight();e=k.getBottom()}else{c=c<k.getLeft()?c:k.getLeft();b=b<k.getTop()?b:k.getTop();d=d>k.getRight()?
 d:k.getRight();e=e>k.getBottom()?e:k.getBottom()}a()};this.inflate=function(k){c-=k;b-=k;d+=k;e+=k;a()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();b=b>k.getTop()?b:k.getTop();d=d<k.getRight()?d:k.getRight();e=e<k.getBottom()?e:k.getBottom();a()};this.instersects=function(k){return Math.min(d,k.getRight())-Math.max(c,k.getLeft())>=0&&Math.min(e,k.getBottom())-Math.max(b,k.getTop())>=0};this.empty=function(){j=!0;e=d=b=c=0;a()};this.isEmpty=function(){return j}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
-THREE.Matrix4=function(a,c,b,d,e,g,h,j,k,m,q,y,u,o,v,A){this.set(a||1,c||0,b||0,d||0,e||0,g||1,h||0,j||0,k||0,m||0,q||1,y||0,u||0,o||0,v||0,A||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,c,b,d,e,g,h,j,k,m,q,y,u,o,v,A){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=m;this.n33=q;this.n34=y;this.n41=u;this.n42=o;this.n43=v;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,c,b,d,e,g,h,j,k,m,q,w,u,o,v,A){this.set(a||1,c||0,b||0,d||0,e||0,g||1,h||0,j||0,k||0,m||0,q||1,w||0,u||0,o||0,v||0,A||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,c,b,d,e,g,h,j,k,m,q,w,u,o,v,A){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=m;this.n33=q;this.n34=w;this.n41=u;this.n42=o;this.n43=v;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1,
 e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;d.cross(b,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(b,g).normalize()}e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,e=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*e;a.y=(this.n21*c+this.n22*b+this.n23*
 d+this.n24)*e;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,e=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*e;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*e;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*e;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();
-return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,q=a.n31,y=a.n32,u=a.n33,o=a.n34,v=a.n41,A=a.n42,E=a.n43,w=a.n44,G=c.n11,x=c.n12,L=c.n13,J=c.n14,Y=c.n21,N=c.n22,
-f=c.n23,W=c.n24,R=c.n31,da=c.n32,ga=c.n33,I=c.n34;this.n11=b*G+d*Y+e*R;this.n12=b*x+d*N+e*da;this.n13=b*L+d*f+e*ga;this.n14=b*J+d*W+e*I+g;this.n21=h*G+j*Y+k*R;this.n22=h*x+j*N+k*da;this.n23=h*L+j*f+k*ga;this.n24=h*J+j*W+k*I+m;this.n31=q*G+y*Y+u*R;this.n32=q*x+y*N+u*da;this.n33=q*L+y*f+u*ga;this.n34=q*J+y*W+u*I+o;this.n41=v*G+A*Y+E*R;this.n42=v*x+A*N+E*da;this.n43=v*L+A*f+E*ga;this.n44=v*J+A*W+E*I+w;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;
+return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,q=a.n31,w=a.n32,u=a.n33,o=a.n34,v=a.n41,A=a.n42,E=a.n43,x=a.n44,G=c.n11,y=c.n12,L=c.n13,J=c.n14,Y=c.n21,N=c.n22,
+f=c.n23,W=c.n24,R=c.n31,da=c.n32,ga=c.n33,I=c.n34;this.n11=b*G+d*Y+e*R;this.n12=b*y+d*N+e*da;this.n13=b*L+d*f+e*ga;this.n14=b*J+d*W+e*I+g;this.n21=h*G+j*Y+k*R;this.n22=h*y+j*N+k*da;this.n23=h*L+j*f+k*ga;this.n24=h*J+j*W+k*I+m;this.n31=q*G+w*Y+u*R;this.n32=q*y+w*N+u*da;this.n33=q*L+w*f+u*ga;this.n34=q*J+w*W+u*I+o;this.n41=v*G+A*Y+E*R;this.n42=v*y+A*N+E*da;this.n43=v*L+A*f+E*ga;this.n44=v*J+A*W+E*I+x;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);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 this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,c=this.n12,b=this.n13,d=this.n14,e=this.n21,g=this.n22,h=this.n23,j=this.n24,k=this.n31,m=this.n32,q=this.n33,y=this.n34,u=this.n41,o=this.n42,v=this.n43,A=this.n44;return d*h*m*u-b*j*m*u-d*g*q*u+c*j*q*u+b*g*y*u-c*h*y*u-d*h*k*o+b*j*k*o+d*e*q*o-a*j*q*o-b*e*y*o+a*h*y*o+d*g*k*v-c*j*k*v-d*e*m*v+a*j*m*v+c*e*y*v-a*g*y*v-b*g*k*A+c*h*k*A+b*e*m*A-a*h*m*A-c*e*q*A+a*g*q*A},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
+this.n11,c=this.n12,b=this.n13,d=this.n14,e=this.n21,g=this.n22,h=this.n23,j=this.n24,k=this.n31,m=this.n32,q=this.n33,w=this.n34,u=this.n41,o=this.n42,v=this.n43,A=this.n44;return d*h*m*u-b*j*m*u-d*g*q*u+c*j*q*u+b*g*w*u-c*h*w*u-d*h*k*o+b*j*k*o+d*e*q*o-a*j*q*o-b*e*w*o+a*h*w*o+d*g*k*v-c*j*k*v-d*e*m*v+a*j*m*v+c*e*w*v-a*g*w*v-b*g*k*A+c*h*k*A+b*e*m*A-a*h*m*A-c*e*q*A+a*g*q*A},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,
@@ -34,9 +34,9 @@ c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:functio
 g+b,k*h-d*j,k*j+d*h,0,k*h+d*j,m*h+b,m*j-d*g,0,k*j-d*h,m*j+d*g,e*j*j+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var e=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var h=a*b,j=c*b;this.n11=e*g;this.n12=-e*d;this.n13=b;this.n21=j*g+a*d;this.n22=-j*d+a*g;this.n23=-c*e;this.n31=-h*g+c*d;this.n32=h*d+c*g;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var c=
 a.x,b=a.y,d=a.z,e=a.w,g=c+c,h=b+b,j=d+d;a=c*g;var k=c*h;c*=j;var m=b*h;b*=j;d*=j;g*=e;h*=e;e*=j;this.n11=1-(m+d);this.n12=k-e;this.n13=c+h;this.n21=k+e;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+m);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
 a.n34},extractRotation:function(a,c){var b=1/c.x,d=1/c.y,e=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
-THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,q=a.n31,y=a.n32,u=a.n33,o=a.n34,v=a.n41,A=a.n42,E=a.n43,w=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=k*o*A-m*u*A+m*y*E-j*o*E-k*y*w+j*u*w;c.n12=g*u*A-e*o*A-g*y*E+d*o*E+e*y*w-d*u*w;c.n13=e*m*A-g*k*A+g*j*E-d*m*E-e*j*w+d*k*w;c.n14=g*k*y-e*m*y-g*j*u+d*m*u+e*j*o-d*k*o;c.n21=m*u*v-k*o*v-m*q*E+h*o*E+k*q*w-h*u*w;c.n22=e*o*v-g*u*v+g*q*E-b*o*E-e*q*w+b*u*w;c.n23=g*k*v-e*m*v-g*h*E+b*m*E+e*h*w-b*k*w;
-c.n24=e*m*q-g*k*q+g*h*u-b*m*u-e*h*o+b*k*o;c.n31=j*o*v-m*y*v+m*q*A-h*o*A-j*q*w+h*y*w;c.n32=g*y*v-d*o*v-g*q*A+b*o*A+d*q*w-b*y*w;c.n33=e*m*v-g*j*v+g*h*A-b*m*A-d*h*w+b*j*w;c.n34=g*j*q-d*m*q-g*h*y+b*m*y+d*h*o-b*j*o;c.n41=k*y*v-j*u*v-k*q*A+h*u*A+j*q*E-h*y*E;c.n42=d*u*v-e*y*v+e*q*A-b*u*A-d*q*E+b*y*E;c.n43=e*j*v-d*k*v-e*h*A+b*k*A+d*h*E-b*j*E;c.n44=d*k*q-e*j*q+e*h*y-b*k*y-d*h*u+b*j*u;c.multiplyScalar(1/a.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,q=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*e;b[2]=a*g;b[3]=a*h;b[4]=a*j;b[5]=a*k;b[6]=a*m;b[7]=a*q;b[8]=a*y;return c};
+THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,q=a.n31,w=a.n32,u=a.n33,o=a.n34,v=a.n41,A=a.n42,E=a.n43,x=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=k*o*A-m*u*A+m*w*E-j*o*E-k*w*x+j*u*x;c.n12=g*u*A-e*o*A-g*w*E+d*o*E+e*w*x-d*u*x;c.n13=e*m*A-g*k*A+g*j*E-d*m*E-e*j*x+d*k*x;c.n14=g*k*w-e*m*w-g*j*u+d*m*u+e*j*o-d*k*o;c.n21=m*u*v-k*o*v-m*q*E+h*o*E+k*q*x-h*u*x;c.n22=e*o*v-g*u*v+g*q*E-b*o*E-e*q*x+b*u*x;c.n23=g*k*v-e*m*v-g*h*E+b*m*E+e*h*x-b*k*x;
+c.n24=e*m*q-g*k*q+g*h*u-b*m*u-e*h*o+b*k*o;c.n31=j*o*v-m*w*v+m*q*A-h*o*A-j*q*x+h*w*x;c.n32=g*w*v-d*o*v-g*q*A+b*o*A+d*q*x-b*w*x;c.n33=e*m*v-g*j*v+g*h*A-b*m*A-d*h*x+b*j*x;c.n34=g*j*q-d*m*q-g*h*w+b*m*w+d*h*o-b*j*o;c.n41=k*w*v-j*u*v-k*q*A+h*u*A+j*q*E-h*w*E;c.n42=d*u*v-e*w*v+e*q*A-b*u*A-d*q*E+b*w*E;c.n43=e*j*v-d*k*v-e*h*A+b*k*A+d*h*E-b*j*E;c.n44=d*k*q-e*j*q+e*h*w-b*k*w-d*h*u+b*j*u;c.multiplyScalar(1/a.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,q=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*e;b[2]=a*g;b[3]=a*h;b[4]=a*j;b[5]=a*k;b[6]=a*m;b[7]=a*q;b[8]=a*w;return c};
 THREE.Matrix4.makeFrustum=function(a,c,b,d,e,g){var h;h=new THREE.Matrix4;h.n11=2*e/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*e/(d-b);h.n23=(d+b)/(d-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+e)/(g-e);h.n34=-2*g*e/(g-e);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,d){var e;a=b*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*c,a*c,e,a,b,d)};
 THREE.Matrix4.makeOrtho=function(a,c,b,d,e,g){var h,j,k,m;h=new THREE.Matrix4;j=c-a;k=b-d;m=g-e;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((c+a)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((b+d)/k);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+e)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
@@ -47,7 +47,7 @@ undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c
 d;a++)this.children[a].update(this.matrixWorld,c,b)}}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined?d:1)};
 THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,e=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-e);e=Math.sin(-e);var g=Math.cos(b);b=Math.sin(b);var h=a*c,j=d*e;this.w=h*g-j*b;this.x=h*b+j*g;this.y=d*c*g+a*e*b;this.z=a*e*g-d*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,d=this.z,e=this.w,g=a.x,h=a.y,j=a.z;a=a.w;this.x=c*a+e*g+b*j-d*h;this.y=b*a+e*h+d*g-c*j;this.z=d*a+e*j+c*h-b*g;this.w=e*a-c*g-b*h-d*j;return this},
-multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,g=this.x,h=this.y,j=this.z,k=this.w,m=k*b+h*e-j*d,q=k*d+j*b-g*e,y=k*e+g*d-h*b;b=-g*b-h*d-j*e;c.x=m*k+b*-g+q*-j-y*-h;c.y=q*k+b*-h+y*-g-m*-j;c.z=y*k+b*-j+m*-h-q*-g;return c}};
+multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,g=this.x,h=this.y,j=this.z,k=this.w,m=k*b+h*e-j*d,q=k*d+j*b-g*e,w=k*e+g*d-h*b;b=-g*b-h*d-j*e;c.x=m*k+b*-g+q*-j-w*-h;c.y=q*k+b*-h+w*-g-m*-j;c.z=w*k+b*-j+m*-h-q*-g;return c}};
 THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.001){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};
 THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,c,b,d,e){this.a=a;this.b=c;this.c=b;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,c,b,d,e,g){this.a=a;this.b=c;this.c=b;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};
@@ -56,15 +56,15 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,c,b;a=0;for(c=this.f
 b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,d,e,g,h,j=new THREE.Vector3,k=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){g=this.faces[d];if(a&&g.vertexNormals.length){j.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)j.addSelf(g.vertexNormals[c]);j.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];j.sub(h.position,
 b.position);k.sub(c.position,b.position);j.crossSelf(k)}j.isZero()||j.normalize();g.normal.copy(j)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal);d[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<
-c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a(I,ca,za,ea,xa,ja,ha){g=I.vertices[ca].position;h=I.vertices[za].position;j=I.vertices[ea].position;k=e[xa];m=e[ja];q=e[ha];y=h.x-g.x;u=j.x-g.x;o=h.y-g.y;
-v=j.y-g.y;A=h.z-g.z;E=j.z-g.z;w=m.u-k.u;G=q.u-k.u;x=m.v-k.v;L=q.v-k.v;J=1/(w*L-G*x);f.set((L*y-x*u)*J,(L*o-x*v)*J,(L*A-x*E)*J);W.set((w*u-G*y)*J,(w*v-G*o)*J,(w*E-G*A)*J);Y[ca].addSelf(f);Y[za].addSelf(f);Y[ea].addSelf(f);N[ca].addSelf(W);N[za].addSelf(W);N[ea].addSelf(W)}var c,b,d,e,g,h,j,k,m,q,y,u,o,v,A,E,w,G,x,L,J,Y=[],N=[],f=new THREE.Vector3,W=new THREE.Vector3,R=new THREE.Vector3,da=new THREE.Vector3,ga=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){Y[c]=new THREE.Vector3;N[c]=new THREE.Vector3}c=
+c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a(I,ca,za,ea,xa,ja,ha){g=I.vertices[ca].position;h=I.vertices[za].position;j=I.vertices[ea].position;k=e[xa];m=e[ja];q=e[ha];w=h.x-g.x;u=j.x-g.x;o=h.y-g.y;
+v=j.y-g.y;A=h.z-g.z;E=j.z-g.z;x=m.u-k.u;G=q.u-k.u;y=m.v-k.v;L=q.v-k.v;J=1/(x*L-G*y);f.set((L*w-y*u)*J,(L*o-y*v)*J,(L*A-y*E)*J);W.set((x*u-G*w)*J,(x*v-G*o)*J,(x*E-G*A)*J);Y[ca].addSelf(f);Y[za].addSelf(f);Y[ea].addSelf(f);N[ca].addSelf(W);N[za].addSelf(W);N[ea].addSelf(W)}var c,b,d,e,g,h,j,k,m,q,w,u,o,v,A,E,x,G,y,L,J,Y=[],N=[],f=new THREE.Vector3,W=new THREE.Vector3,R=new THREE.Vector3,da=new THREE.Vector3,ga=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){Y[c]=new THREE.Vector3;N[c]=new THREE.Vector3}c=
 0;for(b=this.faces.length;c<b;c++){d=this.faces[c];e=this.uvs[c];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
 this.vertices[d.d].normal.copy(d.vertexNormals[3])}}c=0;for(b=this.vertices.length;c<b;c++){ga.copy(this.vertices[c].normal);d=Y[c];R.copy(d);R.subSelf(ga.multiplyScalar(ga.dot(d))).normalize();da.cross(this.vertices[c].normal,d);d=da.dot(N[c]);d=d<0?-1:1;this.vertices[c].tangent.set(R.x,R.y,R.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(a){function c(o,v,A,E,w,G,x){o=(A-o)*0.5;E=(E-v)*0.5;return(2*(v-A)+o+E)*x+(-3*(v-A)-2*o-E)*G+o*w+v}this.points=a;var b=[],d={x:0,y:0,z:0},e,g,h,j,k,m,q,y,u;this.initFromArray=function(o){this.points=[];for(var v=0;v<o.length;v++)this.points[v]={x:o[v][0],y:o[v][1],z:o[v][2]}};this.getPoint=function(o){e=(this.points.length-1)*o;g=Math.floor(e);h=e-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;m=this.points[b[0]];q=this.points[b[1]];
-y=this.points[b[2]];u=this.points[b[3]];j=h*h;k=h*j;d.x=c(m.x,q.x,y.x,u.x,h,j,k);d.y=c(m.y,q.y,y.y,u.y,h,j,k);d.z=c(m.z,q.z,y.z,u.z,h,j,k);return d};this.getControlPointsArray=function(){var o,v,A=this.points.length,E=[];for(o=0;o<A;o++){v=this.points[o];E[o]=[v.x,v.y,v.z]}return E};this.getLength=function(o){var v,A,E=v=v=0,w=new THREE.Vector3,G=new THREE.Vector3,x=[],L=0;x[0]=0;o||(o=100);A=this.points.length*o;w.copy(this.points[0]);for(o=1;o<A;o++){v=o/A;position=this.getPoint(v);G.copy(position);
-L+=G.distanceTo(w);w.copy(position);v*=this.points.length-1;v=Math.floor(v);if(v!=E){x[v]=L;E=v}}x[x.length]=L;return{chunks:x,total:L}};this.reparametrizeByArcLength=function(o){var v,A,E,w,G,x,L=[],J=new THREE.Vector3,Y=this.getLength();L.push(J.copy(this.points[0]).clone());for(v=1;v<this.points.length;v++){A=Y.chunks[v]-Y.chunks[v-1];x=Math.ceil(o*A/Y.total);w=(v-1)/(this.points.length-1);G=v/(this.points.length-1);for(A=1;A<x-1;A++){E=w+A*(1/x)*(G-w);position=this.getPoint(E);L.push(J.copy(position).clone())}L.push(J.copy(this.points[v]).clone())}this.points=
+THREE.Spline=function(a){function c(o,v,A,E,x,G,y){o=(A-o)*0.5;E=(E-v)*0.5;return(2*(v-A)+o+E)*y+(-3*(v-A)-2*o-E)*G+o*x+v}this.points=a;var b=[],d={x:0,y:0,z:0},e,g,h,j,k,m,q,w,u;this.initFromArray=function(o){this.points=[];for(var v=0;v<o.length;v++)this.points[v]={x:o[v][0],y:o[v][1],z:o[v][2]}};this.getPoint=function(o){e=(this.points.length-1)*o;g=Math.floor(e);h=e-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;m=this.points[b[0]];q=this.points[b[1]];
+w=this.points[b[2]];u=this.points[b[3]];j=h*h;k=h*j;d.x=c(m.x,q.x,w.x,u.x,h,j,k);d.y=c(m.y,q.y,w.y,u.y,h,j,k);d.z=c(m.z,q.z,w.z,u.z,h,j,k);return d};this.getControlPointsArray=function(){var o,v,A=this.points.length,E=[];for(o=0;o<A;o++){v=this.points[o];E[o]=[v.x,v.y,v.z]}return E};this.getLength=function(o){var v,A,E=v=v=0,x=new THREE.Vector3,G=new THREE.Vector3,y=[],L=0;y[0]=0;o||(o=100);A=this.points.length*o;x.copy(this.points[0]);for(o=1;o<A;o++){v=o/A;position=this.getPoint(v);G.copy(position);
+L+=G.distanceTo(x);x.copy(position);v*=this.points.length-1;v=Math.floor(v);if(v!=E){y[v]=L;E=v}}y[y.length]=L;return{chunks:y,total:L}};this.reparametrizeByArcLength=function(o){var v,A,E,x,G,y,L=[],J=new THREE.Vector3,Y=this.getLength();L.push(J.copy(this.points[0]).clone());for(v=1;v<this.points.length;v++){A=Y.chunks[v]-Y.chunks[v-1];y=Math.ceil(o*A/Y.total);x=(v-1)/(this.points.length-1);G=v/(this.points.length-1);for(A=1;A<y-1;A++){E=x+A*(1/y)*(G-x);position=this.getPoint(E);L.push(J.copy(position).clone())}L.push(J.copy(this.points[v]).clone())}this.points=
 L}};
 THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(e){for(var g=0;g<a.length;g++)a[g].update(e)};b.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};b.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};b.add=function(e){c[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");c[e.name]=e;if(e.initialized!==!0){for(var g=0;g<e.hierarchy.length;g++){for(var h=0;h<e.hierarchy[g].keys.length;h++){if(e.hierarchy[g].keys[h].time<0)e.hierarchy[g].keys[h].time=
 0;if(e.hierarchy[g].keys[h].rot!==undefined&&!(e.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var j=e.hierarchy[g].keys[h].rot;e.hierarchy[g].keys[h].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}if(e.hierarchy[g].keys[0].morphTargets!==undefined){j={};for(h=0;h<e.hierarchy[g].keys.length;h++)for(var k=0;k<e.hierarchy[g].keys[h].morphTargets.length;k++){var m=e.hierarchy[g].keys[h].morphTargets[k];j[m]=-1}e.hierarchy[g].usedMorphTargets=j;for(h=0;h<e.hierarchy[g].keys.length;h++){var q=
@@ -75,9 +75,9 @@ THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=
 e instanceof THREE.Bone?e.skinMatrix:e.matrix}var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];e.pos=this.getNextKeyWith("pos",b,1);e.rot=this.getNextKeyWith("rot",b,1);e.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.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,e,g,h,j,k,m,q=this.data.JIT.hierarchy,y,u;this.currentTime+=a*this.timeScale;u=this.currentTime;y=this.currentTime%=this.data.length;m=parseInt(Math.min(y*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,v=this.hierarchy.length;o<v;o++){a=this.hierarchy[o];k=a.animationCache;if(this.JITCompile&&q[o][m]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=q[o][m];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=q[o][m];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var A=0;A<3;A++){b=c[A];h=k.prevKey[b];j=k.nextKey[b];if(j.time<=u){if(y<u)if(this.loop){h=this.data.hierarchy[o].keys[0];for(j=this.getNextKeyWith(b,o,1);j.time<y;){h=j;j=this.getNextKeyWith(b,o,j.index+1)}}else{this.stop();return}else{do{h=j;j=this.getNextKeyWith(b,o,j.index+1)}while(j.time<
-y)}k.prevKey[b]=h;k.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(y-h.time)/(j.time-h.time);e=h[b];g=j[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,e,g,h,j,k,m,q=this.data.JIT.hierarchy,w,u;this.currentTime+=a*this.timeScale;u=this.currentTime;w=this.currentTime%=this.data.length;m=parseInt(Math.min(w*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,v=this.hierarchy.length;o<v;o++){a=this.hierarchy[o];k=a.animationCache;if(this.JITCompile&&q[o][m]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=q[o][m];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=q[o][m];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var A=0;A<3;A++){b=c[A];h=k.prevKey[b];j=k.nextKey[b];if(j.time<=u){if(w<u)if(this.loop){h=this.data.hierarchy[o].keys[0];for(j=this.getNextKeyWith(b,o,1);j.time<w;){h=j;j=this.getNextKeyWith(b,o,j.index+1)}}else{this.stop();return}else{do{h=j;j=this.getNextKeyWith(b,o,j.index+1)}while(j.time<
+w)}k.prevKey[b]=h;k.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(w-h.time)/(j.time-h.time);e=h[b];g=j[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
 this.getPrevKeyWith("pos",o,h.index-1).pos;this.points[1]=e;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",o,j.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);b.x=e[0];b.y=e[1];b.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(b===
 "rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}}}}if(this.JITCompile&&q[0][m]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)q[o][m]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],e,g,h,j,k,m;e=(a.length-1)*c;g=Math.floor(e);e-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];j=a[b[1]];k=a[b[2]];m=a[b[3]];b=e*e;h=e*b;d[0]=this.interpolate(g[0],j[0],k[0],m[0],e,b,h);d[1]=this.interpolate(g[1],j[1],k[1],m[1],e,b,h);d[2]=this.interpolate(g[2],j[2],k[2],m[2],e,b,h);return d};
@@ -142,25 +142,25 @@ THREE.LOD.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updat
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
-THREE.Projector=function(){function a(N,f){return f.z-N.z}function c(N,f){var W=0,R=1,da=N.z+N.w,ga=f.z+f.w,I=-N.z+N.w,ca=-f.z+f.w;if(da>=0&&ga>=0&&I>=0&&ca>=0)return!0;else if(da<0&&ga<0||I<0&&ca<0)return!1;else{if(da<0)W=Math.max(W,da/(da-ga));else ga<0&&(R=Math.min(R,da/(da-ga)));if(I<0)W=Math.max(W,I/(I-ca));else ca<0&&(R=Math.min(R,I/(I-ca)));if(R<W)return!1;else{N.lerpSelf(f,W);f.lerpSelf(N,1-R);return!0}}}var b,d,e=[],g,h,j,k=[],m,q,y=[],u,o,v=[],A=new THREE.Vector4,E=new THREE.Vector4,w=new THREE.Matrix4,
-G=new THREE.Matrix4,x=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],L=new THREE.Vector4,J=new THREE.Vector4,Y;this.projectObjects=function(N,f,W){f=[];var R,da,ga;d=0;da=N.objects;N=0;for(R=da.length;N<R;N++){ga=da[N];var I;if(!(I=!ga.visible))if(I=ga instanceof THREE.Mesh){a:{I=void 0;for(var ca=ga.matrixWorld,za=-ga.geometry.boundingSphere.radius*Math.max(ga.scale.x,Math.max(ga.scale.y,ga.scale.z)),ea=0;ea<6;ea++){I=x[ea].x*ca.n14+
-x[ea].y*ca.n24+x[ea].z*ca.n34+x[ea].w;if(I<=za){I=!1;break a}}I=!0}I=!I}if(!I){b=e[d]=e[d]||new THREE.RenderableObject;A.copy(ga.position);w.multiplyVector3(A);b.object=ga;b.z=A.z;f.push(b);d++}}W&&f.sort(a);return f};this.projectScene=function(N,f,W){var R=[],da=f.near,ga=f.far,I,ca,za,ea,xa,ja,ha,va,Aa,ia,$,qa,ra,Q,ma,ta;j=q=o=0;f.matrixAutoUpdate&&f.updateMatrix();N.update(undefined,!1,f);w.multiply(f.projectionMatrix,f.matrixWorldInverse);x[0].set(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);
-x[1].set(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,w.n44+w.n14);x[2].set(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);x[3].set(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);x[4].set(w.n41-w.n31,w.n42-w.n32,w.n43-w.n33,w.n44-w.n34);x[5].set(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);for(I=0;I<6;I++){ja=x[I];ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z))}ja=this.projectObjects(N,f,!0);N=0;for(I=ja.length;N<I;N++){ha=ja[N].object;if(ha.visible){va=ha.matrixWorld;$=ha.matrixRotationWorld;
-Aa=ha.materials;ia=ha.overdraw;if(ha instanceof THREE.Mesh){qa=ha.geometry;ra=qa.vertices;ca=0;for(za=ra.length;ca<za;ca++){Q=ra[ca];Q.positionWorld.copy(Q.position);va.multiplyVector3(Q.positionWorld);ea=Q.positionScreen;ea.copy(Q.positionWorld);w.multiplyVector4(ea);ea.x/=ea.w;ea.y/=ea.w;Q.__visible=ea.z>da&&ea.z<ga}qa=qa.faces;ca=0;for(za=qa.length;ca<za;ca++){Q=qa[ca];if(Q instanceof THREE.Face3){ea=ra[Q.a];xa=ra[Q.b];ma=ra[Q.c];if(ea.__visible&&xa.__visible&&ma.__visible&&(ha.doubleSided||ha.flipSided!=
+THREE.Projector=function(){function a(N,f){return f.z-N.z}function c(N,f){var W=0,R=1,da=N.z+N.w,ga=f.z+f.w,I=-N.z+N.w,ca=-f.z+f.w;if(da>=0&&ga>=0&&I>=0&&ca>=0)return!0;else if(da<0&&ga<0||I<0&&ca<0)return!1;else{if(da<0)W=Math.max(W,da/(da-ga));else ga<0&&(R=Math.min(R,da/(da-ga)));if(I<0)W=Math.max(W,I/(I-ca));else ca<0&&(R=Math.min(R,I/(I-ca)));if(R<W)return!1;else{N.lerpSelf(f,W);f.lerpSelf(N,1-R);return!0}}}var b,d,e=[],g,h,j,k=[],m,q,w=[],u,o,v=[],A=new THREE.Vector4,E=new THREE.Vector4,x=new THREE.Matrix4,
+G=new THREE.Matrix4,y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],L=new THREE.Vector4,J=new THREE.Vector4,Y;this.projectObjects=function(N,f,W){f=[];var R,da,ga;d=0;da=N.objects;N=0;for(R=da.length;N<R;N++){ga=da[N];var I;if(!(I=!ga.visible))if(I=ga instanceof THREE.Mesh){a:{I=void 0;for(var ca=ga.matrixWorld,za=-ga.geometry.boundingSphere.radius*Math.max(ga.scale.x,Math.max(ga.scale.y,ga.scale.z)),ea=0;ea<6;ea++){I=y[ea].x*ca.n14+
+y[ea].y*ca.n24+y[ea].z*ca.n34+y[ea].w;if(I<=za){I=!1;break a}}I=!0}I=!I}if(!I){b=e[d]=e[d]||new THREE.RenderableObject;A.copy(ga.position);x.multiplyVector3(A);b.object=ga;b.z=A.z;f.push(b);d++}}W&&f.sort(a);return f};this.projectScene=function(N,f,W){var R=[],da=f.near,ga=f.far,I,ca,za,ea,xa,ja,ha,va,Aa,ia,$,qa,ra,Q,ma,ta;j=q=o=0;f.matrixAutoUpdate&&f.updateMatrix();N.update(undefined,!1,f);x.multiply(f.projectionMatrix,f.matrixWorldInverse);y[0].set(x.n41-x.n11,x.n42-x.n12,x.n43-x.n13,x.n44-x.n14);
+y[1].set(x.n41+x.n11,x.n42+x.n12,x.n43+x.n13,x.n44+x.n14);y[2].set(x.n41+x.n21,x.n42+x.n22,x.n43+x.n23,x.n44+x.n24);y[3].set(x.n41-x.n21,x.n42-x.n22,x.n43-x.n23,x.n44-x.n24);y[4].set(x.n41-x.n31,x.n42-x.n32,x.n43-x.n33,x.n44-x.n34);y[5].set(x.n41+x.n31,x.n42+x.n32,x.n43+x.n33,x.n44+x.n34);for(I=0;I<6;I++){ja=y[I];ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z))}ja=this.projectObjects(N,f,!0);N=0;for(I=ja.length;N<I;N++){ha=ja[N].object;if(ha.visible){va=ha.matrixWorld;$=ha.matrixRotationWorld;
+Aa=ha.materials;ia=ha.overdraw;if(ha instanceof THREE.Mesh){qa=ha.geometry;ra=qa.vertices;ca=0;for(za=ra.length;ca<za;ca++){Q=ra[ca];Q.positionWorld.copy(Q.position);va.multiplyVector3(Q.positionWorld);ea=Q.positionScreen;ea.copy(Q.positionWorld);x.multiplyVector4(ea);ea.x/=ea.w;ea.y/=ea.w;Q.__visible=ea.z>da&&ea.z<ga}qa=qa.faces;ca=0;for(za=qa.length;ca<za;ca++){Q=qa[ca];if(Q instanceof THREE.Face3){ea=ra[Q.a];xa=ra[Q.b];ma=ra[Q.c];if(ea.__visible&&xa.__visible&&ma.__visible&&(ha.doubleSided||ha.flipSided!=
 (ma.positionScreen.x-ea.positionScreen.x)*(xa.positionScreen.y-ea.positionScreen.y)-(ma.positionScreen.y-ea.positionScreen.y)*(xa.positionScreen.x-ea.positionScreen.x)<0)){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ea.positionWorld);g.v2.positionWorld.copy(xa.positionWorld);g.v3.positionWorld.copy(ma.positionWorld);g.v1.positionScreen.copy(ea.positionScreen);g.v2.positionScreen.copy(xa.positionScreen);g.v3.positionScreen.copy(ma.positionScreen);g.normalWorld.copy(Q.normal);$.multiplyVector3(g.normalWorld);
-g.centroidWorld.copy(Q.centroid);va.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);w.multiplyVector3(g.centroidScreen);ma=Q.vertexNormals;Y=g.vertexNormalsWorld;ea=0;for(xa=ma.length;ea<xa;ea++){ta=Y[ea]=Y[ea]||new THREE.Vector3;ta.copy(ma[ea]);$.multiplyVector3(ta)}g.z=g.centroidScreen.z;g.meshMaterials=Aa;g.faceMaterials=Q.materials;g.overdraw=ia;if(ha.geometry.uvs[ca]){g.uvs[0]=ha.geometry.uvs[ca][0];g.uvs[1]=ha.geometry.uvs[ca][1];g.uvs[2]=ha.geometry.uvs[ca][2]}R.push(g);
+g.centroidWorld.copy(Q.centroid);va.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);x.multiplyVector3(g.centroidScreen);ma=Q.vertexNormals;Y=g.vertexNormalsWorld;ea=0;for(xa=ma.length;ea<xa;ea++){ta=Y[ea]=Y[ea]||new THREE.Vector3;ta.copy(ma[ea]);$.multiplyVector3(ta)}g.z=g.centroidScreen.z;g.meshMaterials=Aa;g.faceMaterials=Q.materials;g.overdraw=ia;if(ha.geometry.uvs[ca]){g.uvs[0]=ha.geometry.uvs[ca][0];g.uvs[1]=ha.geometry.uvs[ca][1];g.uvs[2]=ha.geometry.uvs[ca][2]}R.push(g);
 j++}}else if(Q instanceof THREE.Face4){ea=ra[Q.a];xa=ra[Q.b];ma=ra[Q.c];ta=ra[Q.d];if(ea.__visible&&xa.__visible&&ma.__visible&&ta.__visible&&(ha.doubleSided||ha.flipSided!=((ta.positionScreen.x-ea.positionScreen.x)*(xa.positionScreen.y-ea.positionScreen.y)-(ta.positionScreen.y-ea.positionScreen.y)*(xa.positionScreen.x-ea.positionScreen.x)<0||(xa.positionScreen.x-ma.positionScreen.x)*(ta.positionScreen.y-ma.positionScreen.y)-(xa.positionScreen.y-ma.positionScreen.y)*(ta.positionScreen.x-ma.positionScreen.x)<
-0))){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ea.positionWorld);g.v2.positionWorld.copy(xa.positionWorld);g.v3.positionWorld.copy(ta.positionWorld);g.v1.positionScreen.copy(ea.positionScreen);g.v2.positionScreen.copy(xa.positionScreen);g.v3.positionScreen.copy(ta.positionScreen);g.normalWorld.copy(Q.normal);$.multiplyVector3(g.normalWorld);g.centroidWorld.copy(Q.centroid);va.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);w.multiplyVector3(g.centroidScreen);
+0))){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ea.positionWorld);g.v2.positionWorld.copy(xa.positionWorld);g.v3.positionWorld.copy(ta.positionWorld);g.v1.positionScreen.copy(ea.positionScreen);g.v2.positionScreen.copy(xa.positionScreen);g.v3.positionScreen.copy(ta.positionScreen);g.normalWorld.copy(Q.normal);$.multiplyVector3(g.normalWorld);g.centroidWorld.copy(Q.centroid);va.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);x.multiplyVector3(g.centroidScreen);
 g.z=g.centroidScreen.z;g.meshMaterials=Aa;g.faceMaterials=Q.materials;g.overdraw=ia;if(ha.geometry.uvs[ca]){g.uvs[0]=ha.geometry.uvs[ca][0];g.uvs[1]=ha.geometry.uvs[ca][1];g.uvs[2]=ha.geometry.uvs[ca][3]}R.push(g);j++;h=k[j]=k[j]||new THREE.RenderableFace3;h.v1.positionWorld.copy(xa.positionWorld);h.v2.positionWorld.copy(ma.positionWorld);h.v3.positionWorld.copy(ta.positionWorld);h.v1.positionScreen.copy(xa.positionScreen);h.v2.positionScreen.copy(ma.positionScreen);h.v3.positionScreen.copy(ta.positionScreen);
-h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=Aa;h.faceMaterials=Q.materials;h.overdraw=ia;if(ha.geometry.uvs[ca]){h.uvs[0]=ha.geometry.uvs[ca][1];h.uvs[1]=ha.geometry.uvs[ca][2];h.uvs[2]=ha.geometry.uvs[ca][3]}R.push(h);j++}}}}else if(ha instanceof THREE.Line){G.multiply(w,va);ra=ha.geometry.vertices;Q=ra[0];Q.positionScreen.copy(Q.position);G.multiplyVector4(Q.positionScreen);ca=1;for(za=ra.length;ca<
-za;ca++){ea=ra[ca];ea.positionScreen.copy(ea.position);G.multiplyVector4(ea.positionScreen);xa=ra[ca-1];L.copy(ea.positionScreen);J.copy(xa.positionScreen);if(c(L,J)){L.multiplyScalar(1/L.w);J.multiplyScalar(1/J.w);m=y[q]=y[q]||new THREE.RenderableLine;m.v1.positionScreen.copy(L);m.v2.positionScreen.copy(J);m.z=Math.max(L.z,J.z);m.materials=ha.materials;R.push(m);q++}}}else if(ha instanceof THREE.Particle){E.set(ha.position.x,ha.position.y,ha.position.z,1);w.multiplyVector4(E);E.z/=E.w;if(E.z>0&&
+h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=Aa;h.faceMaterials=Q.materials;h.overdraw=ia;if(ha.geometry.uvs[ca]){h.uvs[0]=ha.geometry.uvs[ca][1];h.uvs[1]=ha.geometry.uvs[ca][2];h.uvs[2]=ha.geometry.uvs[ca][3]}R.push(h);j++}}}}else if(ha instanceof THREE.Line){G.multiply(x,va);ra=ha.geometry.vertices;Q=ra[0];Q.positionScreen.copy(Q.position);G.multiplyVector4(Q.positionScreen);ca=1;for(za=ra.length;ca<
+za;ca++){ea=ra[ca];ea.positionScreen.copy(ea.position);G.multiplyVector4(ea.positionScreen);xa=ra[ca-1];L.copy(ea.positionScreen);J.copy(xa.positionScreen);if(c(L,J)){L.multiplyScalar(1/L.w);J.multiplyScalar(1/J.w);m=w[q]=w[q]||new THREE.RenderableLine;m.v1.positionScreen.copy(L);m.v2.positionScreen.copy(J);m.z=Math.max(L.z,J.z);m.materials=ha.materials;R.push(m);q++}}}else if(ha instanceof THREE.Particle){E.set(ha.position.x,ha.position.y,ha.position.z,1);x.multiplyVector4(E);E.z/=E.w;if(E.z>0&&
 E.z<1){u=v[o]=v[o]||new THREE.RenderableParticle;u.x=E.x/E.w;u.y=E.y/E.w;u.z=E.z;u.rotation=ha.rotation.z;u.scale.x=ha.scale.x*Math.abs(u.x-(E.x+f.projectionMatrix.n11)/(E.w+f.projectionMatrix.n14));u.scale.y=ha.scale.y*Math.abs(u.y-(E.y+f.projectionMatrix.n22)/(E.w+f.projectionMatrix.n24));u.materials=ha.materials;R.push(u);o++}}}}W&&R.sort(a);return R};this.unprojectVector=function(N,f){var W=f.matrixWorld.clone();W.multiplySelf(THREE.Matrix4.makeInvert(f.projectionMatrix));W.multiplyVector3(N);
 return N}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,e,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;d=j;e=b/2;g=d/2};this.render=function(h,j){var k,m,q,y,u,o,v,A;a=c.projectScene(h,j);k=0;for(m=a.length;k<m;k++){u=a[k];if(u instanceof THREE.RenderableParticle){v=u.x*e+e;A=u.y*g+g;q=0;for(y=u.material.length;q<y;q++){o=u.material[q];if(o instanceof THREE.ParticleDOMMaterial){o=o.domElement;o.style.left=v+"px";o.style.top=A+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(ka){if(u!=ka)m.globalAlpha=u=ka}function c(ka){if(o!=ka){switch(ka){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}o=ka}}var b=null,d=new THREE.Projector,e=document.createElement("canvas"),g,h,j,k,m=e.getContext("2d"),q=new THREE.Color(0),y=0,u=1,o=0,v=null,A=null,E=1,w,G,x,L,J,Y,N,f,W,R=new THREE.Color,
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,e,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;d=j;e=b/2;g=d/2};this.render=function(h,j){var k,m,q,w,u,o,v,A;a=c.projectScene(h,j);k=0;for(m=a.length;k<m;k++){u=a[k];if(u instanceof THREE.RenderableParticle){v=u.x*e+e;A=u.y*g+g;q=0;for(w=u.material.length;q<w;q++){o=u.material[q];if(o instanceof THREE.ParticleDOMMaterial){o=o.domElement;o.style.left=v+"px";o.style.top=A+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(ka){if(u!=ka)m.globalAlpha=u=ka}function c(ka){if(o!=ka){switch(ka){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}o=ka}}var b=null,d=new THREE.Projector,e=document.createElement("canvas"),g,h,j,k,m=e.getContext("2d"),q=new THREE.Color(0),w=0,u=1,o=0,v=null,A=null,E=1,x,G,y,L,J,Y,N,f,W,R=new THREE.Color,
 da=new THREE.Color,ga=new THREE.Color,I=new THREE.Color,ca=new THREE.Color,za,ea,xa,ja,ha,va,Aa,ia,$,qa=new THREE.Rectangle,ra=new THREE.Rectangle,Q=new THREE.Rectangle,ma=!1,ta=new THREE.Color,l=new THREE.Color,z=new THREE.Color,t=new THREE.Color,n=Math.PI*2,p=new THREE.Vector3,C,B,D,O,X,F,aa=16;C=document.createElement("canvas");C.width=C.height=2;B=C.getContext("2d");B.fillStyle="rgba(0,0,0,1)";B.fillRect(0,0,2,2);D=B.getImageData(0,0,2,2);O=D.data;X=document.createElement("canvas");X.width=X.height=
-aa;F=X.getContext("2d");F.translate(-aa/2,-aa/2);F.scale(aa,aa);aa--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ka,na){g=ka;h=na;j=g/2;k=h/2;e.width=g;e.height=h;qa.set(-j,-k,j,k);u=1;o=0;A=v=null;E=1};this.setClearColor=function(ka,na){q=ka;y=na};this.setClearColorHex=function(ka,na){q.setHex(ka);y=na};this.clear=function(){m.setTransform(1,0,0,-1,j,k);if(!ra.isEmpty()){ra.inflate(1);ra.minSelf(qa);if(q.hex==0&&y==0)m.clearRect(ra.getX(),ra.getY(),
-ra.getWidth(),ra.getHeight());else{c(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+y+")";m.fillRect(ra.getX(),ra.getY(),ra.getWidth(),ra.getHeight())}ra.empty()}};this.render=function(ka,na){function wa(P){var oa,Z,K,T=P.lights;l.setRGB(0,0,0);z.setRGB(0,0,0);t.setRGB(0,0,0);P=0;for(oa=T.length;P<oa;P++){Z=T[P];K=Z.color;if(Z instanceof THREE.AmbientLight){l.r+=K.r;l.g+=K.g;l.b+=K.b}else if(Z instanceof THREE.DirectionalLight){z.r+=
+aa;F=X.getContext("2d");F.translate(-aa/2,-aa/2);F.scale(aa,aa);aa--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ka,na){g=ka;h=na;j=g/2;k=h/2;e.width=g;e.height=h;qa.set(-j,-k,j,k);u=1;o=0;A=v=null;E=1};this.setClearColor=function(ka,na){q=ka;w=na};this.setClearColorHex=function(ka,na){q.setHex(ka);w=na};this.clear=function(){m.setTransform(1,0,0,-1,j,k);if(!ra.isEmpty()){ra.inflate(1);ra.minSelf(qa);if(q.hex==0&&w==0)m.clearRect(ra.getX(),ra.getY(),
+ra.getWidth(),ra.getHeight());else{c(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+w+")";m.fillRect(ra.getX(),ra.getY(),ra.getWidth(),ra.getHeight())}ra.empty()}};this.render=function(ka,na){function wa(P){var oa,Z,K,T=P.lights;l.setRGB(0,0,0);z.setRGB(0,0,0);t.setRGB(0,0,0);P=0;for(oa=T.length;P<oa;P++){Z=T[P];K=Z.color;if(Z instanceof THREE.AmbientLight){l.r+=K.r;l.g+=K.g;l.b+=K.b}else if(Z instanceof THREE.DirectionalLight){z.r+=
 K.r;z.g+=K.g;z.b+=K.b}else if(Z instanceof THREE.PointLight){t.r+=K.r;t.g+=K.g;t.b+=K.b}}}function la(P,oa,Z,K){var T,fa,pa,sa,ua=P.lights;P=0;for(T=ua.length;P<T;P++){fa=ua[P];pa=fa.color;sa=fa.intensity;if(fa instanceof THREE.DirectionalLight){fa=Z.dot(fa.position)*sa;if(fa>0){K.r+=pa.r*fa;K.g+=pa.g*fa;K.b+=pa.b*fa}}else if(fa instanceof THREE.PointLight){p.sub(fa.position,oa);p.normalize();fa=Z.dot(p)*sa;if(fa>0){K.r+=pa.r*fa;K.g+=pa.g*fa;K.b+=pa.b*fa}}}}function Ca(P,oa,Z){if(Z.opacity!=0){a(Z.opacity);
 c(Z.blending);var K,T,fa,pa,sa,ua;if(Z instanceof THREE.ParticleBasicMaterial){if(Z.map){pa=Z.map.image;sa=pa.width>>1;ua=pa.height>>1;T=oa.scale.x*j;fa=oa.scale.y*k;Z=T*sa;K=fa*ua;Q.set(P.x-Z,P.y-K,P.x+Z,P.y+K);if(qa.instersects(Q)){m.save();m.translate(P.x,P.y);m.rotate(-oa.rotation);m.scale(T,-fa);m.translate(-sa,-ua);m.drawImage(pa,0,0);m.restore()}}}else if(Z instanceof THREE.ParticleCircleMaterial){if(ma){ta.r=l.r+z.r+t.r;ta.g=l.g+z.g+t.g;ta.b=l.b+z.b+t.b;R.r=Z.color.r*ta.r;R.g=Z.color.g*ta.g;
 R.b=Z.color.b*ta.b;R.updateStyleString()}else R.__styleString=Z.color.__styleString;Z=oa.scale.x*j;K=oa.scale.y*k;Q.set(P.x-Z,P.y-K,P.x+Z,P.y+K);if(qa.instersects(Q)){T=R.__styleString;if(A!=T)m.fillStyle=A=T;m.save();m.translate(P.x,P.y);m.rotate(-oa.rotation);m.scale(Z,K);m.beginPath();m.arc(0,0,1,0,n,!0);m.closePath();m.fill();m.restore()}}}}function Da(P,oa,Z,K){if(K.opacity!=0){a(K.opacity);c(K.blending);m.beginPath();m.moveTo(P.positionScreen.x,P.positionScreen.y);m.lineTo(oa.positionScreen.x,
@@ -172,23 +172,23 @@ ta);R.r=T.color.r*ta.r;R.g=T.color.g*ta.g;R.b=T.color.b*ta.b;R.updateStyleString
 xa=Oa(da,ga,I,ca);Ia(L,J,Y,N,f,W,xa,0,0,1,0,0,1)}else if(T instanceof THREE.MeshNormalMaterial){R.r=U(K.normalWorld.x);R.g=U(K.normalWorld.y);R.b=U(K.normalWorld.z);R.updateStyleString();T.wireframe?M(R.__styleString,T.wireframeLinewidth):Na(R.__styleString)}}}function M(P,oa){if(v!=P)m.strokeStyle=v=P;if(E!=oa)m.lineWidth=E=oa;m.stroke();Q.inflate(oa*2)}function Na(P){if(A!=P)m.fillStyle=A=P;m.fill()}function Ia(P,oa,Z,K,T,fa,pa,sa,ua,Ra,La,Ka,Wa){var Ea,Sa;Ea=pa.width-1;Sa=pa.height-1;sa*=Ea;ua*=
 Sa;Ra*=Ea;La*=Sa;Ka*=Ea;Wa*=Sa;Z-=P;K-=oa;T-=P;fa-=oa;Ra-=sa;La-=ua;Ka-=sa;Wa-=ua;Ea=Ra*Wa-Ka*La;if(Ea!=0){Sa=1/Ea;Ea=(Wa*Z-La*T)*Sa;La=(Wa*K-La*fa)*Sa;Z=(Ra*T-Ka*Z)*Sa;K=(Ra*fa-Ka*K)*Sa;P=P-Ea*sa-Z*ua;oa=oa-La*sa-K*ua;m.save();m.transform(Ea,La,Z,K,P,oa);m.clip();m.drawImage(pa,0,0);m.restore()}}function Oa(P,oa,Z,K){var T=~~(P.r*255),fa=~~(P.g*255);P=~~(P.b*255);var pa=~~(oa.r*255),sa=~~(oa.g*255);oa=~~(oa.b*255);var ua=~~(Z.r*255),Ra=~~(Z.g*255);Z=~~(Z.b*255);var La=~~(K.r*255),Ka=~~(K.g*255);
 K=~~(K.b*255);O[0]=T<0?0:T>255?255:T;O[1]=fa<0?0:fa>255?255:fa;O[2]=P<0?0:P>255?255:P;O[4]=pa<0?0:pa>255?255:pa;O[5]=sa<0?0:sa>255?255:sa;O[6]=oa<0?0:oa>255?255:oa;O[8]=ua<0?0:ua>255?255:ua;O[9]=Ra<0?0:Ra>255?255:Ra;O[10]=Z<0?0:Z>255?255:Z;O[12]=La<0?0:La>255?255:La;O[13]=Ka<0?0:Ka>255?255:Ka;O[14]=K<0?0:K>255?255:K;B.putImageData(D,0,0);F.drawImage(C,0,0);return X}function S(P,oa,Z){P=(P-oa)/(Z-oa);return P*P*(3-2*P)}function U(P){P=(P+1)*0.5;return P<0?0:P>1?1:P}function V(P,oa){var Z=oa.x-P.x,
-K=oa.y-P.y,T=1/Math.sqrt(Z*Z+K*K);Z*=T;K*=T;oa.x+=Z;oa.y+=K;P.x-=Z;P.y-=K}var ya,Ma,Fa,Ba,Ga,H,Ja,Ha;this.autoClear?this.clear():m.setTransform(1,0,0,-1,j,k);b=d.projectScene(ka,na,this.sortElements);(ma=ka.lights.length>0)&&wa(ka);ya=0;for(Ma=b.length;ya<Ma;ya++){Fa=b[ya];Q.empty();if(Fa instanceof THREE.RenderableParticle){w=Fa;w.x*=j;w.y*=k;Ba=0;for(Ga=Fa.materials.length;Ba<Ga;Ba++)Ca(w,Fa,Fa.materials[Ba],ka)}else if(Fa instanceof THREE.RenderableLine){w=Fa.v1;G=Fa.v2;w.positionScreen.x*=j;w.positionScreen.y*=
-k;G.positionScreen.x*=j;G.positionScreen.y*=k;Q.addPoint(w.positionScreen.x,w.positionScreen.y);Q.addPoint(G.positionScreen.x,G.positionScreen.y);if(qa.instersects(Q)){Ba=0;for(Ga=Fa.materials.length;Ba<Ga;)Da(w,G,Fa,Fa.materials[Ba++],ka)}}else if(Fa instanceof THREE.RenderableFace3){w=Fa.v1;G=Fa.v2;x=Fa.v3;w.positionScreen.x*=j;w.positionScreen.y*=k;G.positionScreen.x*=j;G.positionScreen.y*=k;x.positionScreen.x*=j;x.positionScreen.y*=k;if(Fa.overdraw){V(w.positionScreen,G.positionScreen);V(G.positionScreen,
-x.positionScreen);V(x.positionScreen,w.positionScreen)}Q.add3Points(w.positionScreen.x,w.positionScreen.y,G.positionScreen.x,G.positionScreen.y,x.positionScreen.x,x.positionScreen.y);if(qa.instersects(Q)){Ba=0;for(Ga=Fa.meshMaterials.length;Ba<Ga;){Ha=Fa.meshMaterials[Ba++];if(Ha instanceof THREE.MeshFaceMaterial){H=0;for(Ja=Fa.faceMaterials.length;H<Ja;)(Ha=Fa.faceMaterials[H++])&&Pa(w,G,x,Fa,Ha,ka)}else Pa(w,G,x,Fa,Ha,ka)}}}ra.addRectangle(Q)}m.setTransform(1,0,0,1,0,0)}};
+K=oa.y-P.y,T=1/Math.sqrt(Z*Z+K*K);Z*=T;K*=T;oa.x+=Z;oa.y+=K;P.x-=Z;P.y-=K}var ya,Ma,Fa,Ba,Ga,H,Ja,Ha;this.autoClear?this.clear():m.setTransform(1,0,0,-1,j,k);b=d.projectScene(ka,na,this.sortElements);(ma=ka.lights.length>0)&&wa(ka);ya=0;for(Ma=b.length;ya<Ma;ya++){Fa=b[ya];Q.empty();if(Fa instanceof THREE.RenderableParticle){x=Fa;x.x*=j;x.y*=k;Ba=0;for(Ga=Fa.materials.length;Ba<Ga;Ba++)Ca(x,Fa,Fa.materials[Ba],ka)}else if(Fa instanceof THREE.RenderableLine){x=Fa.v1;G=Fa.v2;x.positionScreen.x*=j;x.positionScreen.y*=
+k;G.positionScreen.x*=j;G.positionScreen.y*=k;Q.addPoint(x.positionScreen.x,x.positionScreen.y);Q.addPoint(G.positionScreen.x,G.positionScreen.y);if(qa.instersects(Q)){Ba=0;for(Ga=Fa.materials.length;Ba<Ga;)Da(x,G,Fa,Fa.materials[Ba++],ka)}}else if(Fa instanceof THREE.RenderableFace3){x=Fa.v1;G=Fa.v2;y=Fa.v3;x.positionScreen.x*=j;x.positionScreen.y*=k;G.positionScreen.x*=j;G.positionScreen.y*=k;y.positionScreen.x*=j;y.positionScreen.y*=k;if(Fa.overdraw){V(x.positionScreen,G.positionScreen);V(G.positionScreen,
+y.positionScreen);V(y.positionScreen,x.positionScreen)}Q.add3Points(x.positionScreen.x,x.positionScreen.y,G.positionScreen.x,G.positionScreen.y,y.positionScreen.x,y.positionScreen.y);if(qa.instersects(Q)){Ba=0;for(Ga=Fa.meshMaterials.length;Ba<Ga;){Ha=Fa.meshMaterials[Ba++];if(Ha instanceof THREE.MeshFaceMaterial){H=0;for(Ja=Fa.faceMaterials.length;H<Ja;)(Ha=Fa.faceMaterials[H++])&&Pa(x,G,y,Fa,Ha,ka)}else Pa(x,G,y,Fa,Ha,ka)}}}ra.addRectangle(Q)}m.setTransform(1,0,0,1,0,0)}};
 THREE.SVGRenderer=function(){function a(ja,ha,va){var Aa,ia,$,qa;Aa=0;for(ia=ja.lights.length;Aa<ia;Aa++){$=ja.lights[Aa];if($ instanceof THREE.DirectionalLight){qa=ha.normalWorld.dot($.position)*$.intensity;if(qa>0){va.r+=$.color.r*qa;va.g+=$.color.g*qa;va.b+=$.color.b*qa}}else if($ instanceof THREE.PointLight){W.sub($.position,ha.centroidWorld);W.normalize();qa=ha.normalWorld.dot(W)*$.intensity;if(qa>0){va.r+=$.color.r*qa;va.g+=$.color.g*qa;va.b+=$.color.b*qa}}}}function c(ja,ha,va,Aa,ia,$){I=d(ca++);
-I.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+"z");if(ia instanceof THREE.MeshBasicMaterial)x.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshLambertMaterial)if(G){L.r=J.r;L.g=J.g;L.b=J.b;a($,Aa,L);x.r=ia.color.r*L.r;x.g=ia.color.g*L.g;x.b=ia.color.b*L.b;x.updateStyleString()}else x.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshDepthMaterial){f=
-1-ia.__2near/(ia.__farPlusNear-Aa.z*ia.__farMinusNear);x.setRGB(f,f,f)}else ia instanceof THREE.MeshNormalMaterial&&x.setRGB(e(Aa.normalWorld.x),e(Aa.normalWorld.y),e(Aa.normalWorld.z));ia.wireframe?I.setAttribute("style","fill: none; stroke: "+x.__styleString+"; stroke-width: "+ia.wireframeLinewidth+"; stroke-opacity: "+ia.opacity+"; stroke-linecap: "+ia.wireframeLinecap+"; stroke-linejoin: "+ia.wireframeLinejoin):I.setAttribute("style","fill: "+x.__styleString+"; fill-opacity: "+ia.opacity);j.appendChild(I)}
-function b(ja,ha,va,Aa,ia,$,qa){I=d(ca++);I.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+" L "+Aa.positionScreen.x+","+Aa.positionScreen.y+"z");if($ instanceof THREE.MeshBasicMaterial)x.__styleString=$.color.__styleString;else if($ instanceof THREE.MeshLambertMaterial)if(G){L.r=J.r;L.g=J.g;L.b=J.b;a(qa,ia,L);x.r=$.color.r*L.r;x.g=$.color.g*L.g;x.b=$.color.b*L.b;x.updateStyleString()}else x.__styleString=
-$.color.__styleString;else if($ instanceof THREE.MeshDepthMaterial){f=1-$.__2near/($.__farPlusNear-ia.z*$.__farMinusNear);x.setRGB(f,f,f)}else $ instanceof THREE.MeshNormalMaterial&&x.setRGB(e(ia.normalWorld.x),e(ia.normalWorld.y),e(ia.normalWorld.z));$.wireframe?I.setAttribute("style","fill: none; stroke: "+x.__styleString+"; stroke-width: "+$.wireframeLinewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.wireframeLinecap+"; stroke-linejoin: "+$.wireframeLinejoin):I.setAttribute("style",
-"fill: "+x.__styleString+"; fill-opacity: "+$.opacity);j.appendChild(I)}function d(ja){if(R[ja]==null){R[ja]=document.createElementNS("http://www.w3.org/2000/svg","path");xa==0&&R[ja].setAttribute("shape-rendering","crispEdges")}return R[ja]}function e(ja){return ja<0?Math.min((1+ja)*0.5,0.5):0.5+Math.min(ja*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,q,y,u,o,v,A,E=new THREE.Rectangle,w=new THREE.Rectangle,G=!1,x=new THREE.Color(16777215),
-L=new THREE.Color(16777215),J=new THREE.Color(0),Y=new THREE.Color(0),N=new THREE.Color(0),f,W=new THREE.Vector3,R=[],da=[],ga=[],I,ca,za,ea,xa=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ja){switch(ja){case "high":xa=1;break;case "low":xa=0}};this.setSize=function(ja,ha){k=ja;m=ha;q=k/2;y=m/2;j.setAttribute("viewBox",-q+" "+-y+" "+k+" "+m);j.setAttribute("width",k);j.setAttribute("height",m);E.set(-q,-y,q,y)};this.clear=function(){for(;j.childNodes.length>
+I.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+"z");if(ia instanceof THREE.MeshBasicMaterial)y.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshLambertMaterial)if(G){L.r=J.r;L.g=J.g;L.b=J.b;a($,Aa,L);y.r=ia.color.r*L.r;y.g=ia.color.g*L.g;y.b=ia.color.b*L.b;y.updateStyleString()}else y.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshDepthMaterial){f=
+1-ia.__2near/(ia.__farPlusNear-Aa.z*ia.__farMinusNear);y.setRGB(f,f,f)}else ia instanceof THREE.MeshNormalMaterial&&y.setRGB(e(Aa.normalWorld.x),e(Aa.normalWorld.y),e(Aa.normalWorld.z));ia.wireframe?I.setAttribute("style","fill: none; stroke: "+y.__styleString+"; stroke-width: "+ia.wireframeLinewidth+"; stroke-opacity: "+ia.opacity+"; stroke-linecap: "+ia.wireframeLinecap+"; stroke-linejoin: "+ia.wireframeLinejoin):I.setAttribute("style","fill: "+y.__styleString+"; fill-opacity: "+ia.opacity);j.appendChild(I)}
+function b(ja,ha,va,Aa,ia,$,qa){I=d(ca++);I.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+" L "+Aa.positionScreen.x+","+Aa.positionScreen.y+"z");if($ instanceof THREE.MeshBasicMaterial)y.__styleString=$.color.__styleString;else if($ instanceof THREE.MeshLambertMaterial)if(G){L.r=J.r;L.g=J.g;L.b=J.b;a(qa,ia,L);y.r=$.color.r*L.r;y.g=$.color.g*L.g;y.b=$.color.b*L.b;y.updateStyleString()}else y.__styleString=
+$.color.__styleString;else if($ instanceof THREE.MeshDepthMaterial){f=1-$.__2near/($.__farPlusNear-ia.z*$.__farMinusNear);y.setRGB(f,f,f)}else $ instanceof THREE.MeshNormalMaterial&&y.setRGB(e(ia.normalWorld.x),e(ia.normalWorld.y),e(ia.normalWorld.z));$.wireframe?I.setAttribute("style","fill: none; stroke: "+y.__styleString+"; stroke-width: "+$.wireframeLinewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.wireframeLinecap+"; stroke-linejoin: "+$.wireframeLinejoin):I.setAttribute("style",
+"fill: "+y.__styleString+"; fill-opacity: "+$.opacity);j.appendChild(I)}function d(ja){if(R[ja]==null){R[ja]=document.createElementNS("http://www.w3.org/2000/svg","path");xa==0&&R[ja].setAttribute("shape-rendering","crispEdges")}return R[ja]}function e(ja){return ja<0?Math.min((1+ja)*0.5,0.5):0.5+Math.min(ja*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,q,w,u,o,v,A,E=new THREE.Rectangle,x=new THREE.Rectangle,G=!1,y=new THREE.Color(16777215),
+L=new THREE.Color(16777215),J=new THREE.Color(0),Y=new THREE.Color(0),N=new THREE.Color(0),f,W=new THREE.Vector3,R=[],da=[],ga=[],I,ca,za,ea,xa=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ja){switch(ja){case "high":xa=1;break;case "low":xa=0}};this.setSize=function(ja,ha){k=ja;m=ha;q=k/2;w=m/2;j.setAttribute("viewBox",-q+" "+-w+" "+k+" "+m);j.setAttribute("width",k);j.setAttribute("height",m);E.set(-q,-w,q,w)};this.clear=function(){for(;j.childNodes.length>
 0;)j.removeChild(j.childNodes[0])};this.render=function(ja,ha){var va,Aa,ia,$,qa,ra,Q,ma;this.autoClear&&this.clear();g=h.projectScene(ja,ha,this.sortElements);ea=za=ca=0;if(G=ja.lights.length>0){Q=ja.lights;J.setRGB(0,0,0);Y.setRGB(0,0,0);N.setRGB(0,0,0);va=0;for(Aa=Q.length;va<Aa;va++){ia=Q[va];$=ia.color;if(ia instanceof THREE.AmbientLight){J.r+=$.r;J.g+=$.g;J.b+=$.b}else if(ia instanceof THREE.DirectionalLight){Y.r+=$.r;Y.g+=$.g;Y.b+=$.b}else if(ia instanceof THREE.PointLight){N.r+=$.r;N.g+=$.g;
-N.b+=$.b}}}va=0;for(Aa=g.length;va<Aa;va++){Q=g[va];w.empty();if(Q instanceof THREE.RenderableParticle){u=Q;u.x*=q;u.y*=-y;ia=0;for($=Q.materials.length;ia<$;ia++)if(ma=Q.materials[ia]){qa=u;ra=Q;var ta=za++;if(da[ta]==null){da[ta]=document.createElementNS("http://www.w3.org/2000/svg","circle");xa==0&&da[ta].setAttribute("shape-rendering","crispEdges")}I=da[ta];I.setAttribute("cx",qa.x);I.setAttribute("cy",qa.y);I.setAttribute("r",ra.scale.x*q);if(ma instanceof THREE.ParticleCircleMaterial){if(G){L.r=
-J.r+Y.r+N.r;L.g=J.g+Y.g+N.g;L.b=J.b+Y.b+N.b;x.r=ma.color.r*L.r;x.g=ma.color.g*L.g;x.b=ma.color.b*L.b;x.updateStyleString()}else x=ma.color;I.setAttribute("style","fill: "+x.__styleString)}j.appendChild(I)}}else if(Q instanceof THREE.RenderableLine){u=Q.v1;o=Q.v2;u.positionScreen.x*=q;u.positionScreen.y*=-y;o.positionScreen.x*=q;o.positionScreen.y*=-y;w.addPoint(u.positionScreen.x,u.positionScreen.y);w.addPoint(o.positionScreen.x,o.positionScreen.y);if(E.instersects(w)){ia=0;for($=Q.materials.length;ia<
-$;)if(ma=Q.materials[ia++]){qa=u;ra=o;ta=ea++;if(ga[ta]==null){ga[ta]=document.createElementNS("http://www.w3.org/2000/svg","line");xa==0&&ga[ta].setAttribute("shape-rendering","crispEdges")}I=ga[ta];I.setAttribute("x1",qa.positionScreen.x);I.setAttribute("y1",qa.positionScreen.y);I.setAttribute("x2",ra.positionScreen.x);I.setAttribute("y2",ra.positionScreen.y);if(ma instanceof THREE.LineBasicMaterial){x.__styleString=ma.color.__styleString;I.setAttribute("style","fill: none; stroke: "+x.__styleString+
-"; stroke-width: "+ma.linewidth+"; stroke-opacity: "+ma.opacity+"; stroke-linecap: "+ma.linecap+"; stroke-linejoin: "+ma.linejoin);j.appendChild(I)}}}}else if(Q instanceof THREE.RenderableFace3){u=Q.v1;o=Q.v2;v=Q.v3;u.positionScreen.x*=q;u.positionScreen.y*=-y;o.positionScreen.x*=q;o.positionScreen.y*=-y;v.positionScreen.x*=q;v.positionScreen.y*=-y;w.addPoint(u.positionScreen.x,u.positionScreen.y);w.addPoint(o.positionScreen.x,o.positionScreen.y);w.addPoint(v.positionScreen.x,v.positionScreen.y);
-if(E.instersects(w)){ia=0;for($=Q.meshMaterials.length;ia<$;){ma=Q.meshMaterials[ia++];if(ma instanceof THREE.MeshFaceMaterial){qa=0;for(ra=Q.faceMaterials.length;qa<ra;)(ma=Q.faceMaterials[qa++])&&c(u,o,v,Q,ma,ja)}else ma&&c(u,o,v,Q,ma,ja)}}}else if(Q instanceof THREE.RenderableFace4){u=Q.v1;o=Q.v2;v=Q.v3;A=Q.v4;u.positionScreen.x*=q;u.positionScreen.y*=-y;o.positionScreen.x*=q;o.positionScreen.y*=-y;v.positionScreen.x*=q;v.positionScreen.y*=-y;A.positionScreen.x*=q;A.positionScreen.y*=-y;w.addPoint(u.positionScreen.x,
-u.positionScreen.y);w.addPoint(o.positionScreen.x,o.positionScreen.y);w.addPoint(v.positionScreen.x,v.positionScreen.y);w.addPoint(A.positionScreen.x,A.positionScreen.y);if(E.instersects(w)){ia=0;for($=Q.meshMaterials.length;ia<$;){ma=Q.meshMaterials[ia++];if(ma instanceof THREE.MeshFaceMaterial){qa=0;for(ra=Q.faceMaterials.length;qa<ra;)(ma=Q.faceMaterials[qa++])&&b(u,o,v,A,Q,ma,ja)}else ma&&b(u,o,v,A,Q,ma,ja)}}}}}};
+N.b+=$.b}}}va=0;for(Aa=g.length;va<Aa;va++){Q=g[va];x.empty();if(Q instanceof THREE.RenderableParticle){u=Q;u.x*=q;u.y*=-w;ia=0;for($=Q.materials.length;ia<$;ia++)if(ma=Q.materials[ia]){qa=u;ra=Q;var ta=za++;if(da[ta]==null){da[ta]=document.createElementNS("http://www.w3.org/2000/svg","circle");xa==0&&da[ta].setAttribute("shape-rendering","crispEdges")}I=da[ta];I.setAttribute("cx",qa.x);I.setAttribute("cy",qa.y);I.setAttribute("r",ra.scale.x*q);if(ma instanceof THREE.ParticleCircleMaterial){if(G){L.r=
+J.r+Y.r+N.r;L.g=J.g+Y.g+N.g;L.b=J.b+Y.b+N.b;y.r=ma.color.r*L.r;y.g=ma.color.g*L.g;y.b=ma.color.b*L.b;y.updateStyleString()}else y=ma.color;I.setAttribute("style","fill: "+y.__styleString)}j.appendChild(I)}}else if(Q instanceof THREE.RenderableLine){u=Q.v1;o=Q.v2;u.positionScreen.x*=q;u.positionScreen.y*=-w;o.positionScreen.x*=q;o.positionScreen.y*=-w;x.addPoint(u.positionScreen.x,u.positionScreen.y);x.addPoint(o.positionScreen.x,o.positionScreen.y);if(E.instersects(x)){ia=0;for($=Q.materials.length;ia<
+$;)if(ma=Q.materials[ia++]){qa=u;ra=o;ta=ea++;if(ga[ta]==null){ga[ta]=document.createElementNS("http://www.w3.org/2000/svg","line");xa==0&&ga[ta].setAttribute("shape-rendering","crispEdges")}I=ga[ta];I.setAttribute("x1",qa.positionScreen.x);I.setAttribute("y1",qa.positionScreen.y);I.setAttribute("x2",ra.positionScreen.x);I.setAttribute("y2",ra.positionScreen.y);if(ma instanceof THREE.LineBasicMaterial){y.__styleString=ma.color.__styleString;I.setAttribute("style","fill: none; stroke: "+y.__styleString+
+"; stroke-width: "+ma.linewidth+"; stroke-opacity: "+ma.opacity+"; stroke-linecap: "+ma.linecap+"; stroke-linejoin: "+ma.linejoin);j.appendChild(I)}}}}else if(Q instanceof THREE.RenderableFace3){u=Q.v1;o=Q.v2;v=Q.v3;u.positionScreen.x*=q;u.positionScreen.y*=-w;o.positionScreen.x*=q;o.positionScreen.y*=-w;v.positionScreen.x*=q;v.positionScreen.y*=-w;x.addPoint(u.positionScreen.x,u.positionScreen.y);x.addPoint(o.positionScreen.x,o.positionScreen.y);x.addPoint(v.positionScreen.x,v.positionScreen.y);
+if(E.instersects(x)){ia=0;for($=Q.meshMaterials.length;ia<$;){ma=Q.meshMaterials[ia++];if(ma instanceof THREE.MeshFaceMaterial){qa=0;for(ra=Q.faceMaterials.length;qa<ra;)(ma=Q.faceMaterials[qa++])&&c(u,o,v,Q,ma,ja)}else ma&&c(u,o,v,Q,ma,ja)}}}else if(Q instanceof THREE.RenderableFace4){u=Q.v1;o=Q.v2;v=Q.v3;A=Q.v4;u.positionScreen.x*=q;u.positionScreen.y*=-w;o.positionScreen.x*=q;o.positionScreen.y*=-w;v.positionScreen.x*=q;v.positionScreen.y*=-w;A.positionScreen.x*=q;A.positionScreen.y*=-w;x.addPoint(u.positionScreen.x,
+u.positionScreen.y);x.addPoint(o.positionScreen.x,o.positionScreen.y);x.addPoint(v.positionScreen.x,v.positionScreen.y);x.addPoint(A.positionScreen.x,A.positionScreen.y);if(E.instersects(x)){ia=0;for($=Q.meshMaterials.length;ia<$;){ma=Q.meshMaterials[ia++];if(ma instanceof THREE.MeshFaceMaterial){qa=0;for(ra=Q.faceMaterials.length;qa<ra;)(ma=Q.faceMaterials[qa++])&&b(u,o,v,A,Q,ma,ja)}else ma&&b(u,o,v,A,Q,ma,ja)}}}}}};
 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",
@@ -233,13 +233,13 @@ p.__webGLUV2Buffer);f.vertexAttribPointer(l.uv2,2,f.FLOAT,!1,0,0);f.enableVertex
 f.LINE_STRIP:f.LINES;f.lineWidth(n.linewidth);f.drawArrays(C,0,p.__webGLLineCount)}else if(C instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS,0,p.__webGLParticleCount);else C instanceof THREE.Ribbon&&f.drawArrays(f.TRIANGLE_STRIP,0,p.__webGLVertexCount)}}function g(l,z){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=f.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=f.createBuffer();if(l.hasPos){f.bindBuffer(f.ARRAY_BUFFER,l.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,l.positionArray,
 f.DYNAMIC_DRAW);f.enableVertexAttribArray(z.attributes.position);f.vertexAttribPointer(z.attributes.position,3,f.FLOAT,!1,0,0)}if(l.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,l.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,l.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(z.attributes.normal);f.vertexAttribPointer(z.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,l.count);l.count=0}function h(l){if(ga!=l.doubleSided){l.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);ga=
 l.doubleSided}if(I!=l.flipSided){l.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);I=l.flipSided}}function j(l){if(za!=l){l?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST);za=l}}function k(l){va[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);va[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);va[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);va[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);va[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);va[5].set(l.n41+
-l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var z;for(l=0;l<6;l++){z=va[l];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}}function m(l){for(var z=l.matrixWorld,t=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),n=0;n<6;n++){l=va[n].x*z.n14+va[n].y*z.n24+va[n].z*z.n34+va[n].w;if(l<=t)return!1}return!0}function q(l,z){l.list[l.count]=z;l.count+=1}function y(l){var z,t,n=l.object,p=l.opaque,C=l.transparent;C.count=0;l=p.count=0;for(z=n.materials.length;l<z;l++){t=
+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var z;for(l=0;l<6;l++){z=va[l];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}}function m(l){for(var z=l.matrixWorld,t=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),n=0;n<6;n++){l=va[n].x*z.n14+va[n].y*z.n24+va[n].z*z.n34+va[n].w;if(l<=t)return!1}return!0}function q(l,z){l.list[l.count]=z;l.count+=1}function w(l){var z,t,n=l.object,p=l.opaque,C=l.transparent;C.count=0;l=p.count=0;for(z=n.materials.length;l<z;l++){t=
 n.materials[l];t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?q(C,t):q(p,t)}}function u(l){var z,t,n,p,C=l.object,B=l.buffer,D=l.opaque,O=l.transparent;O.count=0;l=D.count=0;for(n=C.materials.length;l<n;l++){z=C.materials[l];if(z instanceof THREE.MeshFaceMaterial){z=0;for(t=B.materials.length;z<t;z++)(p=B.materials[z])&&(p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?q(O,p):q(D,p))}else{p=z;p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?q(O,p):q(D,p)}}}function o(l,z){return z.z-
 l.z}function v(l,z){l._modelViewMatrix.multiplyToArray(z.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}function A(l){function z(ka){var na=[];t=0;for(n=ka.length;t<n;t++)ka[t]==undefined?na.push("undefined"):na.push(ka[t].id);return na.join("_")}var t,n,p,C,B,D,O,X,F={},aa=l.morphTargets!==undefined?l.morphTargets.length:0;l.geometryGroups={};p=0;for(C=l.faces.length;p<C;p++){B=l.faces[p];D=B.materials;
 O=z(D);F[O]==undefined&&(F[O]={hash:O,counter:0});X=F[O].hash+"_"+F[O].counter;l.geometryGroups[X]==undefined&&(l.geometryGroups[X]={faces:[],materials:D,vertices:0,numMorphTargets:aa});B=B instanceof THREE.Face3?3:4;if(l.geometryGroups[X].vertices+B>65535){F[O].counter+=1;X=F[O].hash+"_"+F[O].counter;l.geometryGroups[X]==undefined&&(l.geometryGroups[X]={faces:[],materials:D,vertices:0,numMorphTargets:aa})}l.geometryGroups[X].faces.push(p);l.geometryGroups[X].vertices+=B}}function E(l,z,t){l.push({buffer:z,
-object:t,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function w(l){if(l!=ca){switch(l){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR,f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);
+object:t,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function x(l){if(l!=ca){switch(l){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR,f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);
 f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}ca=l}}function G(l,z,t){if((t.width&t.width-1)==0&&(t.height&t.height-1)==0){f.texParameteri(l,f.TEXTURE_WRAP_S,Y(z.wrapS));f.texParameteri(l,f.TEXTURE_WRAP_T,Y(z.wrapT));f.texParameteri(l,f.TEXTURE_MAG_FILTER,Y(z.magFilter));f.texParameteri(l,f.TEXTURE_MIN_FILTER,Y(z.minFilter));f.generateMipmap(l)}else{f.texParameteri(l,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(l,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(l,f.TEXTURE_MAG_FILTER,J(z.magFilter));
-f.texParameteri(l,f.TEXTURE_MIN_FILTER,J(z.minFilter))}}function x(l){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=f.createFramebuffer();l.__webGLRenderbuffer=f.createRenderbuffer();l.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER,l.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,l.width,l.height);f.bindTexture(f.TEXTURE_2D,l.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,Y(l.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,
+f.texParameteri(l,f.TEXTURE_MIN_FILTER,J(z.minFilter))}}function y(l){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=f.createFramebuffer();l.__webGLRenderbuffer=f.createRenderbuffer();l.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER,l.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,l.width,l.height);f.bindTexture(f.TEXTURE_2D,l.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,Y(l.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,
 Y(l.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,Y(l.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,Y(l.minFilter));f.texImage2D(f.TEXTURE_2D,0,Y(l.format),l.width,l.height,0,Y(l.format),Y(l.type),null);f.bindFramebuffer(f.FRAMEBUFFER,l.__webGLFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,l.__webGLTexture,0);f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,l.__webGLRenderbuffer);f.bindTexture(f.TEXTURE_2D,null);
 f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var z,t;if(l){z=l.__webGLFramebuffer;t=l.width;l=l.height}else{z=null;t=ja;l=ha}if(z!=R){f.bindFramebuffer(f.FRAMEBUFFER,z);f.viewport(ea,xa,t,l);R=z}}function L(l,z){var t;if(l=="fragment")t=f.createShader(f.FRAGMENT_SHADER);else l=="vertex"&&(t=f.createShader(f.VERTEX_SHADER));f.shaderSource(t,z);f.compileShader(t);if(!f.getShaderParameter(t,f.COMPILE_STATUS)){alert(f.getShaderInfoLog(t));return null}return t}function J(l){switch(l){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;
 case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return f.LINEAR}}function Y(l){switch(l){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;
@@ -257,9 +257,9 @@ l.program;F=0;for(z=t.length;F<z;F++){B=t[F];p.uniforms[B]=f.getUniformLocation(
 C.tangent>=0&&f.enableVertexAttribArray(C.tangent);if(l.skinning&&C.skinVertexA>=0&&C.skinVertexB>=0&&C.skinIndex>=0&&C.skinWeight>=0){f.enableVertexAttribArray(C.skinVertexA);f.enableVertexAttribArray(C.skinVertexB);f.enableVertexAttribArray(C.skinIndex);f.enableVertexAttribArray(C.skinWeight)}if(l.morphTargets){l.numSupportedMorphTargets=0;if(C.morphTarget0>=0){f.enableVertexAttribArray(C.morphTarget0);l.numSupportedMorphTargets++}if(C.morphTarget1>=0){f.enableVertexAttribArray(C.morphTarget1);
 l.numSupportedMorphTargets++}if(C.morphTarget2>=0){f.enableVertexAttribArray(C.morphTarget2);l.numSupportedMorphTargets++}if(C.morphTarget3>=0){f.enableVertexAttribArray(C.morphTarget3);l.numSupportedMorphTargets++}if(C.morphTarget4>=0){f.enableVertexAttribArray(C.morphTarget4);l.numSupportedMorphTargets++}if(C.morphTarget5>=0){f.enableVertexAttribArray(C.morphTarget5);l.numSupportedMorphTargets++}if(C.morphTarget6>=0){f.enableVertexAttribArray(C.morphTarget6);l.numSupportedMorphTargets++}if(C.morphTarget7>=
 0){f.enableVertexAttribArray(C.morphTarget7);l.numSupportedMorphTargets++}n.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(p=0;p<this.maxMorphTargets;p++)n.__webGLMorphTargetInfluences[p]=0}};this.render=function(l,z,t,n){var p,C,B,D,O,X,F,aa,ka=l.lights,na=l.fog;z.matrixAutoUpdate&&z.updateMatrix();l.update(undefined,!1,z);z.matrixWorldInverse.flattenToArray($);z.projectionMatrix.flattenToArray(ia);Aa.multiply(z.projectionMatrix,z.matrixWorldInverse);k(Aa);this.initWebGLObjects(l);
-x(t);(this.autoClear||n)&&this.clear();O=l.__webglObjects.length;for(n=0;n<O;n++){p=l.__webglObjects[n];F=p.object;if(F.visible)if(!(F instanceof THREE.Mesh)||m(F)){F.matrixWorld.flattenToArray(F._objectMatrixArray);v(F,z);u(p);p.render=!0;if(this.sortObjects){qa.copy(F.position);Aa.multiplyVector3(qa);p.z=qa.z}}else p.render=!1;else p.render=!1}this.sortObjects&&l.__webglObjects.sort(o);X=l.__webglObjectsImmediate.length;for(n=0;n<X;n++){p=l.__webglObjectsImmediate[n];F=p.object;if(F.visible){F.matrixAutoUpdate&&
-F.matrixWorld.flattenToArray(F._objectMatrixArray);v(F,z);y(p)}}w(THREE.NormalBlending);for(n=0;n<O;n++){p=l.__webglObjects[n];if(p.render){F=p.object;aa=p.buffer;B=p.opaque;h(F);for(p=0;p<B.count;p++){D=B.list[p];j(D.depthTest);e(z,ka,na,D,aa,F)}}}for(n=0;n<X;n++){p=l.__webglObjectsImmediate[n];F=p.object;if(F.visible){B=p.opaque;h(F);for(p=0;p<B.count;p++){D=B.list[p];j(D.depthTest);C=d(z,ka,na,D,F);F.render(function(wa){g(wa,C)})}}}for(n=0;n<O;n++){p=l.__webglObjects[n];if(p.render){F=p.object;
-aa=p.buffer;B=p.transparent;h(F);for(p=0;p<B.count;p++){D=B.list[p];w(D.blending);j(D.depthTest);e(z,ka,na,D,aa,F)}}}for(n=0;n<X;n++){p=l.__webglObjectsImmediate[n];F=p.object;if(F.visible){B=p.transparent;h(F);for(p=0;p<B.count;p++){D=B.list[p];w(D.blending);j(D.depthTest);C=d(z,ka,na,D,F);F.render(function(wa){g(wa,C)})}}}if(t&&t.minFilter!==THREE.NearestFilter&&t.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,t.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,
+y(t);(this.autoClear||n)&&this.clear();O=l.__webglObjects.length;for(n=0;n<O;n++){p=l.__webglObjects[n];F=p.object;if(F.visible)if(!(F instanceof THREE.Mesh)||m(F)){F.matrixWorld.flattenToArray(F._objectMatrixArray);v(F,z);u(p);p.render=!0;if(this.sortObjects){qa.copy(F.position);Aa.multiplyVector3(qa);p.z=qa.z}}else p.render=!1;else p.render=!1}this.sortObjects&&l.__webglObjects.sort(o);X=l.__webglObjectsImmediate.length;for(n=0;n<X;n++){p=l.__webglObjectsImmediate[n];F=p.object;if(F.visible){F.matrixAutoUpdate&&
+F.matrixWorld.flattenToArray(F._objectMatrixArray);v(F,z);w(p)}}x(THREE.NormalBlending);for(n=0;n<O;n++){p=l.__webglObjects[n];if(p.render){F=p.object;aa=p.buffer;B=p.opaque;h(F);for(p=0;p<B.count;p++){D=B.list[p];j(D.depthTest);e(z,ka,na,D,aa,F)}}}for(n=0;n<X;n++){p=l.__webglObjectsImmediate[n];F=p.object;if(F.visible){B=p.opaque;h(F);for(p=0;p<B.count;p++){D=B.list[p];j(D.depthTest);C=d(z,ka,na,D,F);F.render(function(wa){g(wa,C)})}}}for(n=0;n<O;n++){p=l.__webglObjects[n];if(p.render){F=p.object;
+aa=p.buffer;B=p.transparent;h(F);for(p=0;p<B.count;p++){D=B.list[p];x(D.blending);j(D.depthTest);e(z,ka,na,D,aa,F)}}}for(n=0;n<X;n++){p=l.__webglObjectsImmediate[n];F=p.object;if(F.visible){B=p.transparent;h(F);for(p=0;p<B.count;p++){D=B.list[p];x(D.blending);j(D.depthTest);C=d(z,ka,na,D,F);F.render(function(wa){g(wa,C)})}}}if(t&&t.minFilter!==THREE.NearestFilter&&t.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,t.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,
 null)}};this.initWebGLObjects=function(l){if(!l.__webglObjects){l.__webglObjects=[];l.__webglObjectsImmediate=[]}for(;l.__objectsAdded.length;){var z=l.__objectsAdded[0],t=l,n=void 0,p=void 0,C=void 0;if(z._modelViewMatrix==undefined){z._modelViewMatrix=new THREE.Matrix4;z._normalMatrixArray=new Float32Array(9);z._modelViewMatrixArray=new Float32Array(16);z._objectMatrixArray=new Float32Array(16);z.matrixWorld.flattenToArray(z._objectMatrixArray)}if(z instanceof THREE.Mesh){p=z.geometry;p.geometryGroups==
 undefined&&A(p);for(n in p.geometryGroups){C=p.geometryGroups[n];if(!C.__webGLVertexBuffer){var B=C;B.__webGLVertexBuffer=f.createBuffer();B.__webGLNormalBuffer=f.createBuffer();B.__webGLTangentBuffer=f.createBuffer();B.__webGLColorBuffer=f.createBuffer();B.__webGLUVBuffer=f.createBuffer();B.__webGLUV2Buffer=f.createBuffer();B.__webGLSkinVertexABuffer=f.createBuffer();B.__webGLSkinVertexBBuffer=f.createBuffer();B.__webGLSkinIndicesBuffer=f.createBuffer();B.__webGLSkinWeightsBuffer=f.createBuffer();
 B.__webGLFaceBuffer=f.createBuffer();B.__webGLLineBuffer=f.createBuffer();if(B.numMorphTargets){var D=void 0,O=void 0;B.__webGLMorphTargetsBuffers=[];D=0;for(O=B.numMorphTargets;D<O;D++)B.__webGLMorphTargetsBuffers.push(f.createBuffer())}B=C;var X=z,F=void 0,aa=void 0,ka=O=D=0,na=X.geometry.faces,wa=B.faces;F=0;for(aa=wa.length;F<aa;F++){fi=wa[F];face=na[fi];if(face instanceof THREE.Face3){D+=3;O+=1;ka+=3}else if(face instanceof THREE.Face4){D+=4;O+=2;ka+=4}}B.__vertexArray=new Float32Array(D*3);
@@ -290,14 +290,14 @@ B=F*3;wa[B]=aa.x;wa[B+1]=aa.y;wa[B+2]=aa.z}f.bindBuffer(f.ARRAY_BUFFER,n.__webGL
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,e=b.length;for(d=0;d<e;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
-var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,g=a.vertices,h=e.vertices,j=a.faces,k=e.faces,m=a.uvs;e=e.uvs;b&&c.matrixAutoUpdate&&c.updateMatrix();for(var q=0,y=h.length;q<y;q++){var u=new THREE.Vertex(h[q].position.clone());b&&c.matrix.multiplyVector3(u.position);g.push(u)}q=0;for(y=k.length;q<y;q++){h=k[q];var o,v=h.vertexNormals;if(h instanceof THREE.Face3)o=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(o=new THREE.Face4(h.a+
-d,h.b+d,h.c+d,h.d+d));o.centroid.copy(h.centroid);o.normal.copy(h.normal);b=0;for(g=v.length;b<g;b++){u=v[b];o.vertexNormals.push(u.clone())}o.materials=h.materials.slice();j.push(o)}q=0;for(y=e.length;q<y;q++){d=e[q];j=[];b=0;for(g=d.length;b<g;b++)j.push(new THREE.UV(d[b].u,d[b].v));m.push(j)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,e=new THREE.Texture(d,c);d.onload=function(){e.needsUpdate=!0;b&&b(this)};d.src=a;return e},loadTextureCube:function(a,c,b){var d,e=[],g=new THREE.Texture(e,
-c);c=e.loadCount=0;for(d=a.length;c<d;++c){e[c]=new Image;e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)g.needsUpdate=!0;b&&b(this)};e[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(e){function g(){for(q in N.objects)if(!I.objects[q]){A=N.objects[q];if(x=I.geometries[A.geometry]){Y=[];for(i=0;i<A.materials.length;i++)Y[i]=I.materials[A.materials[i]];E=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(x,Y);object.position.set(E[0],
-E[1],E[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;I.scene.addObject(object);I.objects[q]=object}}}function h(ca){return function(za){I.geometries[ca]=za;g();W-=1;j()}}function j(){d({total_models:da,total_textures:ga,loaded_models:da-W,loaded_textures:ga-R},I);W==0&&R==0&&b(I)}var k,m,q,y,u,o,v,A,E,w,G,x,L,J,Y,N,f,W,R,da,ga,I;N=e.data;f=new THREE.Loader;R=W=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
-lights:{},fogs:{}};e=function(){R-=1;j()};for(u in N.cameras){w=N.cameras[u];if(w.type=="perspective")L=new THREE.Camera(w.fov,w.aspect,w.near,w.far);else if(w.type=="ortho"){L=new THREE.Camera;L.projectionMatrix=THREE.Matrix4.makeOrtho(w.left,w.right,w.top,w.bottom,w.near,w.far)}E=w.position;w=w.target;L.position.set(E[0],E[1],E[2]);L.target.position.set(w[0],w[1],w[2]);I.cameras[u]=L}for(y in N.lights){u=N.lights[y];if(u.type=="directional"){E=u.direction;light=new THREE.DirectionalLight;light.position.set(E[0],
-E[1],E[2]);light.position.normalize()}else if(u.type=="point"){E=u.position;light=new THREE.PointLight;light.position.set(E[0],E[1],E[2])}w=u.color;i=u.intensity||1;light.color.setRGB(w[0]*i,w[1]*i,w[2]*i);I.scene.addLight(light);I.lights[y]=light}for(o in N.fogs){y=N.fogs[o];if(y.type=="linear")J=new THREE.Fog(0,y.near,y.far);else y.type=="exp2"&&(J=new THREE.FogExp2(0,y.density));w=y.color;J.color.setRGB(w[0],w[1],w[2]);I.fogs[o]=J}if(I.cameras&&N.defaults.camera)I.currentCamera=I.cameras[N.defaults.camera];
-if(I.fogs&&N.defaults.fog)I.scene.fog=I.fogs[N.defaults.fog];w=N.defaults.bgcolor;I.bgColor=new THREE.Color;I.bgColor.setRGB(w[0],w[1],w[2]);I.bgColorAlpha=N.defaults.bgalpha;for(k in N.geometries){o=N.geometries[k];if(o.type=="bin_mesh"||o.type=="ascii_mesh")W+=1}da=W;for(k in N.geometries){o=N.geometries[k];if(o.type=="cube"){x=new Cube(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides);I.geometries[k]=x}else if(o.type=="plane"){x=new Plane(o.width,
-o.height,o.segmentsWidth,o.segmentsHeight);I.geometries[k]=x}else if(o.type=="sphere"){x=new Sphere(o.radius,o.segmentsWidth,o.segmentsHeight);I.geometries[k]=x}else if(o.type=="cylinder"){x=new Cylinder(o.numSegs,o.topRad,o.botRad,o.height,o.topOffset,o.botOffset);I.geometries[k]=x}else if(o.type=="torus"){x=new Torus(o.radius,o.tube,o.segmentsR,o.segmentsT);I.geometries[k]=x}else if(o.type=="icosahedron"){x=new Icosahedron(o.subdivisions);I.geometries[k]=x}else if(o.type=="bin_mesh")f.loadBinary({model:o.url,
+var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,g=a.vertices,h=e.vertices,j=a.faces,k=e.faces,m=a.uvs;e=e.uvs;b&&c.matrixAutoUpdate&&c.updateMatrix();for(var q=0,w=h.length;q<w;q++){var u=new THREE.Vertex(h[q].position.clone());b&&c.matrix.multiplyVector3(u.position);g.push(u)}q=0;for(w=k.length;q<w;q++){h=k[q];var o,v=h.vertexNormals;if(h instanceof THREE.Face3)o=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(o=new THREE.Face4(h.a+
+d,h.b+d,h.c+d,h.d+d));o.centroid.copy(h.centroid);o.normal.copy(h.normal);b=0;for(g=v.length;b<g;b++){u=v[b];o.vertexNormals.push(u.clone())}o.materials=h.materials.slice();j.push(o)}q=0;for(w=e.length;q<w;q++){d=e[q];j=[];b=0;for(g=d.length;b<g;b++)j.push(new THREE.UV(d[b].u,d[b].v));m.push(j)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,e=new THREE.Texture(d,c);d.onload=function(){e.needsUpdate=!0;b&&b(this)};d.src=a;return e},loadTextureCube:function(a,c,b){var d,e=[],g=new THREE.Texture(e,
+c);c=e.loadCount=0;for(d=a.length;c<d;++c){e[c]=new Image;e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)g.needsUpdate=!0;b&&b(this)};e[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(e){function g(){for(q in N.objects)if(!I.objects[q]){A=N.objects[q];if(y=I.geometries[A.geometry]){Y=[];for(i=0;i<A.materials.length;i++)Y[i]=I.materials[A.materials[i]];E=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(y,Y);object.position.set(E[0],
+E[1],E[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;I.scene.addObject(object);I.objects[q]=object}}}function h(ca){return function(za){I.geometries[ca]=za;g();W-=1;j()}}function j(){d({total_models:da,total_textures:ga,loaded_models:da-W,loaded_textures:ga-R},I);W==0&&R==0&&b(I)}var k,m,q,w,u,o,v,A,E,x,G,y,L,J,Y,N,f,W,R,da,ga,I;N=e.data;f=new THREE.Loader;R=W=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
+lights:{},fogs:{}};e=function(){R-=1;j()};for(u in N.cameras){x=N.cameras[u];if(x.type=="perspective")L=new THREE.Camera(x.fov,x.aspect,x.near,x.far);else if(x.type=="ortho"){L=new THREE.Camera;L.projectionMatrix=THREE.Matrix4.makeOrtho(x.left,x.right,x.top,x.bottom,x.near,x.far)}E=x.position;x=x.target;L.position.set(E[0],E[1],E[2]);L.target.position.set(x[0],x[1],x[2]);I.cameras[u]=L}for(w in N.lights){u=N.lights[w];if(u.type=="directional"){E=u.direction;light=new THREE.DirectionalLight;light.position.set(E[0],
+E[1],E[2]);light.position.normalize()}else if(u.type=="point"){E=u.position;light=new THREE.PointLight;light.position.set(E[0],E[1],E[2])}x=u.color;i=u.intensity||1;light.color.setRGB(x[0]*i,x[1]*i,x[2]*i);I.scene.addLight(light);I.lights[w]=light}for(o in N.fogs){w=N.fogs[o];if(w.type=="linear")J=new THREE.Fog(0,w.near,w.far);else w.type=="exp2"&&(J=new THREE.FogExp2(0,w.density));x=w.color;J.color.setRGB(x[0],x[1],x[2]);I.fogs[o]=J}if(I.cameras&&N.defaults.camera)I.currentCamera=I.cameras[N.defaults.camera];
+if(I.fogs&&N.defaults.fog)I.scene.fog=I.fogs[N.defaults.fog];x=N.defaults.bgcolor;I.bgColor=new THREE.Color;I.bgColor.setRGB(x[0],x[1],x[2]);I.bgColorAlpha=N.defaults.bgalpha;for(k in N.geometries){o=N.geometries[k];if(o.type=="bin_mesh"||o.type=="ascii_mesh")W+=1}da=W;for(k in N.geometries){o=N.geometries[k];if(o.type=="cube"){y=new Cube(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides);I.geometries[k]=y}else if(o.type=="plane"){y=new Plane(o.width,
+o.height,o.segmentsWidth,o.segmentsHeight);I.geometries[k]=y}else if(o.type=="sphere"){y=new Sphere(o.radius,o.segmentsWidth,o.segmentsHeight);I.geometries[k]=y}else if(o.type=="cylinder"){y=new Cylinder(o.numSegs,o.topRad,o.botRad,o.height,o.topOffset,o.botOffset);I.geometries[k]=y}else if(o.type=="torus"){y=new Torus(o.radius,o.tube,o.segmentsR,o.segmentsT);I.geometries[k]=y}else if(o.type=="icosahedron"){y=new Icosahedron(o.subdivisions);I.geometries[k]=y}else if(o.type=="bin_mesh")f.loadBinary({model:o.url,
 callback:h(k)});else o.type=="ascii_mesh"&&f.loadAscii({model:o.url,callback:h(k)})}for(v in N.textures){k=N.textures[v];R+=k.url instanceof Array?k.url.length:1}ga=R;for(v in N.textures){k=N.textures[v];if(k.mapping!=undefined&&THREE[k.mapping]!=undefined)k.mapping=new THREE[k.mapping];if(k.url instanceof Array)o=ImageUtils.loadTextureCube(k.url,k.mapping,e);else{o=ImageUtils.loadTexture(k.url,k.mapping,e);if(THREE[k.minFilter]!=undefined)o.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=undefined)o.magFilter=
 THREE[k.magFilter]}I.textures[v]=o}for(m in N.materials){v=N.materials[m];for(G in v.parameters)if(G=="envMap"||G=="map"||G=="lightMap")v.parameters[G]=I.textures[v.parameters[G]];else if(G=="shading")v.parameters[G]=v.parameters[G]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(G=="blending")v.parameters[G]=THREE[v.parameters[G]]?THREE[v.parameters[G]]:THREE.NormalBlending;else G=="combine"&&(v.parameters[G]=v.parameters[G]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);v=new THREE[v.type](v.parameters);
 I.materials[m]=v}g();c(I)}},addMesh:function(a,c,b,d,e,g,h,j,k,m){c=new THREE.Mesh(c,m);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=e;c.position.z=g;c.rotation.x=h;c.rotation.y=j;c.rotation.z=k;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);
@@ -321,34 +321,34 @@ this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBack
 var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*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;b=this.target.position;var d=this.position;b.x=d.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=d.y+100*Math.cos(this.phi);b.z=d.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
 !1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
 THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
-THREE.PathCamera=function(a){function c(m,q,y,u){var o={name:y,fps:0.6,length:u,hierarchy:[]},v,A=q.getControlPointsArray(),E=q.getLength(),w=A.length,G=0;v=w-1;q={parent:-1,keys:[]};q.keys[0]={time:0,pos:A[0],rot:[0,0,0,1],scl:[1,1,1]};q.keys[v]={time:u,pos:A[v],rot:[0,0,0,1],scl:[1,1,1]};for(v=1;v<w-1;v++){G=u*E.chunks[v]/E.total;q.keys[v]={time:G,pos:A[v]}}o.hierarchy[0]=q;THREE.AnimationHandler.add(o);return new THREE.Animation(m,y,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(m,q){var y,
-u,o=new THREE.Geometry;for(y=0;y<m.points.length*q;y++){u=y/(m.points.length*q);u=m.getPoint(u);o.vertices[y]=new THREE.Vertex(new THREE.Vector3(u.x,u.y,u.z))}return o}function d(m,q){var y=b(q,10),u=b(q,10),o=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(y,o);particleObj=new THREE.ParticleSystem(u,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);m.addChild(lineObj);particleObj.scale.set(1,1,1);m.addChild(particleObj);u=new Sphere(1,
-16,8);o=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<q.points.length;i++){y=new THREE.Mesh(u,o);y.position.copy(q.points[i]);y.updateMatrix();m.addChild(y)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=
+THREE.PathCamera=function(a){function c(m,q,w,u){var o={name:w,fps:0.6,length:u,hierarchy:[]},v,A=q.getControlPointsArray(),E=q.getLength(),x=A.length,G=0;v=x-1;q={parent:-1,keys:[]};q.keys[0]={time:0,pos:A[0],rot:[0,0,0,1],scl:[1,1,1]};q.keys[v]={time:u,pos:A[v],rot:[0,0,0,1],scl:[1,1,1]};for(v=1;v<x-1;v++){G=u*E.chunks[v]/E.total;q.keys[v]={time:G,pos:A[v]}}o.hierarchy[0]=q;THREE.AnimationHandler.add(o);return new THREE.Animation(m,w,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(m,q){var w,
+u,o=new THREE.Geometry;for(w=0;w<m.points.length*q;w++){u=w/(m.points.length*q);u=m.getPoint(u);o.vertices[w]=new THREE.Vertex(new THREE.Vector3(u.x,u.y,u.z))}return o}function d(m,q){var w=b(q,10),u=b(q,10),o=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(w,o);particleObj=new THREE.ParticleSystem(u,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);m.addChild(lineObj);particleObj.scale.set(1,1,1);m.addChild(particleObj);u=new Sphere(1,
+16,8);o=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<q.points.length;i++){w=new THREE.Mesh(u,o);w.position.copy(q.points[i]);w.updateMatrix();m.addChild(w)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=
 !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
-this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,g=Math.PI/180;this.update=function(m,q,y){var u,o;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)*g;this.theta=this.lon*g;u=this.phi%e;this.phi=u>=0?u:u+e;u=this.verticalAngleMap.srcRange;o=this.verticalAngleMap.dstRange;
-this.phi=(this.phi-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.target.position;u.x=100*Math.sin(this.phi)*Math.cos(this.theta);u.y=100*Math.cos(this.phi);u.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,m,q,y)};this.onMouseMove=function(m){this.mouseX=m.clientX-this.windowHalfX;this.mouseY=m.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
+this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,g=Math.PI/180;this.update=function(m,q,w){var u,o;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)*g;this.theta=this.lon*g;u=this.phi%e;this.phi=u>=0?u:u+e;u=this.verticalAngleMap.srcRange;o=this.verticalAngleMap.dstRange;
+this.phi=(this.phi-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.target.position;u.x=100*Math.sin(this.phi)*Math.cos(this.theta);u.y=100*Math.cos(this.phi);u.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,m,q,w)};this.onMouseMove=function(m){this.mouseX=m.clientX-this.windowHalfX;this.mouseY=m.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
 this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),j=new Cube(10,10,20),k=new Cube(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(k,h);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&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(m,q){return function(){q.apply(m,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-var Cube=function(a,c,b,d,e,g,h,j,k){function m(E,w,G,x,L,J,Y,N){var f,W,R=d||1,da=e||1,ga=L/2,I=J/2,ca=q.vertices.length;if(E=="x"&&w=="y"||E=="y"&&w=="x")f="z";else if(E=="x"&&w=="z"||E=="z"&&w=="x"){f="y";da=g||1}else if(E=="z"&&w=="y"||E=="y"&&w=="z"){f="x";R=g||1}var za=R+1,ea=da+1;L/=R;var xa=J/da;for(W=0;W<ea;W++)for(J=0;J<za;J++){var ja=new THREE.Vector3;ja[E]=(J*L-ga)*G;ja[w]=(W*xa-I)*x;ja[f]=Y;q.vertices.push(new THREE.Vertex(ja))}for(W=0;W<da;W++)for(J=0;J<R;J++){q.faces.push(new THREE.Face4(J+
-za*W+ca,J+za*(W+1)+ca,J+1+za*(W+1)+ca,J+1+za*W+ca,null,N));q.uvs.push([new THREE.UV(J/R,W/da),new THREE.UV(J/R,(W+1)/da),new THREE.UV((J+1)/R,(W+1)/da),new THREE.UV((J+1)/R,W/da)])}}THREE.Geometry.call(this);var q=this,y=a/2,u=c/2,o=b/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var A in k)this.sides[A]!=undefined&&(this.sides[A]=
-k[A]);this.sides.px&&m("z","y",1*j,-1,b,c,-y,this.materials[0]);this.sides.nx&&m("z","y",-1*j,-1,b,c,y,this.materials[1]);this.sides.py&&m("x","z",1*j,1,a,b,u,this.materials[2]);this.sides.ny&&m("x","z",1*j,-1,a,b,-u,this.materials[3]);this.sides.pz&&m("x","y",1*j,-1,a,c,o,this.materials[4]);this.sides.nz&&m("x","y",-1*j,-1,a,c,-o,this.materials[5]);(function(){for(var E=[],w=[],G=0,x=q.vertices.length;G<x;G++){for(var L=q.vertices[G],J=!1,Y=0,N=E.length;Y<N;Y++){var f=E[Y];if(L.position.x==f.position.x&&
-L.position.y==f.position.y&&L.position.z==f.position.z){w[G]=Y;J=!0;break}}if(!J){w[G]=E.length;E.push(new THREE.Vertex(L.position.clone()))}}G=0;for(x=q.faces.length;G<x;G++){L=q.faces[G];L.a=w[L.a];L.b=w[L.b];L.c=w[L.c];L.d=w[L.d]}q.vertices=E})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(a,c,b,d){function e(k,m,q){g.vertices.push(new THREE.Vertex(new THREE.Vector3(k,m,q)))}THREE.Geometry.call(this);var g=this,h=Math.PI,j=d/2;for(d=0;d<a;d++)e(Math.sin(2*h*d/a)*c,Math.cos(2*h*d/a)*c,-j);for(d=0;d<a;d++)e(Math.sin(2*h*d/a)*b,Math.cos(2*h*d/a)*b,j);for(d=0;d<a;d++)g.faces.push(new THREE.Face4(d,d+a,a+(d+1)%a,(d+1)%a));e(0,0,-j);for(d=a;d<a+a/2;d++)g.faces.push(new THREE.Face4(2*a,(2*d-2*a)%a,(2*d-2*a+1)%a,(2*d-2*a+2)%a));e(0,0,j);for(d=a+a/2;d<2*a;d++)g.faces.push(new THREE.Face4((2*
-d-2*a+2)%a+a,(2*d-2*a+1)%a+a,(2*d-2*a)%a+a,2*a+1));this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
-var Icosahedron=function(a){function c(y,u,o){var v=Math.sqrt(y*y+u*u+o*o);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(y/v,u/v,o/v)))-1}function b(y,u,o,v){v.faces.push(new THREE.Face3(y,u,o))}function d(y,u){var o=e.vertices[y].position,v=e.vertices[u].position;return c((o.x+v.x)/2,(o.y+v.y)/2,(o.z+v.z)/2)}var e=this,g=new THREE.Geometry,h;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,
+var Cube=function(a,c,b,d,e,g,h,j,k){function m(E,x,G,y,L,J,Y,N){var f,W,R=d||1,da=e||1,ga=L/2,I=J/2,ca=q.vertices.length;if(E=="x"&&x=="y"||E=="y"&&x=="x")f="z";else if(E=="x"&&x=="z"||E=="z"&&x=="x"){f="y";da=g||1}else if(E=="z"&&x=="y"||E=="y"&&x=="z"){f="x";R=g||1}var za=R+1,ea=da+1;L/=R;var xa=J/da;for(W=0;W<ea;W++)for(J=0;J<za;J++){var ja=new THREE.Vector3;ja[E]=(J*L-ga)*G;ja[x]=(W*xa-I)*y;ja[f]=Y;q.vertices.push(new THREE.Vertex(ja))}for(W=0;W<da;W++)for(J=0;J<R;J++){q.faces.push(new THREE.Face4(J+
+za*W+ca,J+za*(W+1)+ca,J+1+za*(W+1)+ca,J+1+za*W+ca,null,N));q.uvs.push([new THREE.UV(J/R,W/da),new THREE.UV(J/R,(W+1)/da),new THREE.UV((J+1)/R,(W+1)/da),new THREE.UV((J+1)/R,W/da)])}}THREE.Geometry.call(this);var q=this,w=a/2,u=c/2,o=b/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var A in k)this.sides[A]!=undefined&&(this.sides[A]=
+k[A]);this.sides.px&&m("z","y",1*j,-1,b,c,-w,this.materials[0]);this.sides.nx&&m("z","y",-1*j,-1,b,c,w,this.materials[1]);this.sides.py&&m("x","z",1*j,1,a,b,u,this.materials[2]);this.sides.ny&&m("x","z",1*j,-1,a,b,-u,this.materials[3]);this.sides.pz&&m("x","y",1*j,-1,a,c,o,this.materials[4]);this.sides.nz&&m("x","y",-1*j,-1,a,c,-o,this.materials[5]);(function(){for(var E=[],x=[],G=0,y=q.vertices.length;G<y;G++){for(var L=q.vertices[G],J=!1,Y=0,N=E.length;Y<N;Y++){var f=E[Y];if(L.position.x==f.position.x&&
+L.position.y==f.position.y&&L.position.z==f.position.z){x[G]=Y;J=!0;break}}if(!J){x[G]=E.length;E.push(new THREE.Vertex(L.position.clone()))}}G=0;for(y=q.faces.length;G<y;G++){L=q.faces[G];L.a=x[L.a];L.b=x[L.b];L.c=x[L.c];L.d=x[L.d]}q.vertices=E})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cylinder=function(a,c,b,d,e,g){function h(q,w,u){j.vertices.push(new THREE.Vertex(new THREE.Vector3(q,w,u)))}THREE.Geometry.call(this);var j=this,k=Math.PI,m=d/2;for(d=0;d<a;d++)h(Math.sin(2*k*d/a)*c,Math.cos(2*k*d/a)*c,-m);for(d=0;d<a;d++)h(Math.sin(2*k*d/a)*b,Math.cos(2*k*d/a)*b,m);for(d=0;d<a;d++)j.faces.push(new THREE.Face4(d,d+a,a+(d+1)%a,(d+1)%a));if(b>0){h(0,0,-m-(g||0));for(d=a;d<a+a/2;d++)j.faces.push(new THREE.Face4(2*a,(2*d-2*a)%a,(2*d-2*a+1)%a,(2*d-2*a+2)%a))}if(c>0){h(0,0,m+(e||0));
+for(d=a+a/2;d<2*a;d++)j.faces.push(new THREE.Face4((2*d-2*a+2)%a+a,(2*d-2*a+1)%a+a,(2*d-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
+var Icosahedron=function(a){function c(w,u,o){var v=Math.sqrt(w*w+u*u+o*o);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(w/v,u/v,o/v)))-1}function b(w,u,o,v){v.faces.push(new THREE.Face3(w,u,o))}function d(w,u){var o=e.vertices[w].position,v=e.vertices[u].position;return c((o.x+v.x)/2,(o.y+v.y)/2,(o.z+v.z)/2)}var e=this,g=new THREE.Geometry,h;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,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var k=d(g.faces[j].a,g.faces[j].b),m=d(g.faces[j].b,g.faces[j].c),q=d(g.faces[j].c,g.faces[j].a);b(g.faces[j].a,k,q,h);b(g.faces[j].b,m,k,h);b(g.faces[j].c,
 q,m,h);b(k,m,q,h)}g.faces=h.faces}e.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
 function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var d=[],e=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));d[j]=a[j].clone();e[j]=this.vertices.length-1}for(var k=(new THREE.Matrix4).setRotationZ(c),m=0;m<=this.angle+0.001;m+=c){for(j=0;j<d.length;j++)if(m<this.angle){d[j]=k.multiplyVector3(d[j].clone());this.vertices.push(new THREE.Vertex(d[j]));g[j]=this.vertices.length-1}else g=h;m==0&&(h=e);for(j=
 0;j<e.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],e[j+1],e[j]));this.uvs.push([new THREE.UV(m/b,j/a.length),new THREE.UV(m/b,(j+1)/a.length),new THREE.UV((m-c)/b,(j+1)/a.length),new THREE.UV((m-c)/b,j/a.length)])}e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
 var Plane=function(a,c,b,d){THREE.Geometry.call(this);var e,g=a/2,h=c/2;b=b||1;d=d||1;var j=b+1,k=d+1;a/=b;var m=c/d;for(e=0;e<k;e++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(e*m-h),0)));for(e=0;e<d;e++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+j*e,c+j*(e+1),c+1+j*(e+1),c+1+j*e));this.uvs.push([new THREE.UV(c/b,e/d),new THREE.UV(c/b,(e+1)/d),new THREE.UV((c+1)/b,(e+1)/d),new THREE.UV((c+1)/b,e/d)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,e=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){d=b/h;var j=a*Math.cos(d*e),k=a*Math.sin(d*e),m=[],q=0;for(d=0;d<g;d++){var y=2*d/g,u=k*Math.sin(y*e);y=k*Math.cos(y*e);(b==0||b==h)&&d>0||(q=this.vertices.push(new THREE.Vertex(new THREE.Vector3(y,j,u)))-1);m.push(q)}c.push(m)}var o,v,A;e=c.length;for(b=0;b<e;b++){g=c[b].length;if(b>0)for(d=0;d<g;d++){m=d==g-1;h=c[b][m?0:d+1];j=c[b][m?g-1:d];k=c[b-1][m?g-1:d];m=c[b-1][m?
-0:d+1];u=b/(e-1);o=(b-1)/(e-1);v=(d+1)/g;y=d/g;q=new THREE.UV(1-v,u);u=new THREE.UV(1-y,u);y=new THREE.UV(1-y,o);var E=new THREE.UV(1-v,o);if(b<c.length-1){o=this.vertices[h].position.clone();v=this.vertices[j].position.clone();A=this.vertices[k].position.clone();o.normalize();v.normalize();A.normalize();this.faces.push(new THREE.Face3(h,j,k,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([q,u,y])}if(b>1){o=this.vertices[h].position.clone();
-v=this.vertices[k].position.clone();A=this.vertices[m].position.clone();o.normalize();v.normalize();A.normalize();this.faces.push(new THREE.Face3(h,k,m,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([q,y,E])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
+var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,e=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){d=b/h;var j=a*Math.cos(d*e),k=a*Math.sin(d*e),m=[],q=0;for(d=0;d<g;d++){var w=2*d/g,u=k*Math.sin(w*e);w=k*Math.cos(w*e);(b==0||b==h)&&d>0||(q=this.vertices.push(new THREE.Vertex(new THREE.Vector3(w,j,u)))-1);m.push(q)}c.push(m)}var o,v,A;e=c.length;for(b=0;b<e;b++){g=c[b].length;if(b>0)for(d=0;d<g;d++){m=d==g-1;h=c[b][m?0:d+1];j=c[b][m?g-1:d];k=c[b-1][m?g-1:d];m=c[b-1][m?
+0:d+1];u=b/(e-1);o=(b-1)/(e-1);v=(d+1)/g;w=d/g;q=new THREE.UV(1-v,u);u=new THREE.UV(1-w,u);w=new THREE.UV(1-w,o);var E=new THREE.UV(1-v,o);if(b<c.length-1){o=this.vertices[h].position.clone();v=this.vertices[j].position.clone();A=this.vertices[k].position.clone();o.normalize();v.normalize();A.normalize();this.faces.push(new THREE.Face3(h,j,k,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([q,u,w])}if(b>1){o=this.vertices[h].position.clone();
+v=this.vertices[k].position.clone();A=this.vertices[m].position.clone();o.normalize();v.normalize();A.normalize();this.faces.push(new THREE.Face3(h,k,m,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([q,w,E])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
 var Torus=function(a,c,b,d){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){d=b/this.segmentsT*2*Math.PI;var e=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(d),(this.radius+this.tube*Math.cos(e))*Math.sin(d),this.tube*Math.sin(e))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
 1;b<=this.segmentsT;++b){d=(this.segmentsT+1)*c+b;e=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,e,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
-var TorusKnot=function(a,c,b,d,e,g,h){function j(y,u,o,v,A,E){u=o/v*y;o=Math.cos(u);return new THREE.Vector3(A*(2+o)*0.5*Math.cos(y),A*(2+o)*Math.sin(y)*0.5,E*A*Math.sin(u)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var k=
+var TorusKnot=function(a,c,b,d,e,g,h){function j(w,u,o,v,A,E){u=o/v*w;o=Math.cos(u);return new THREE.Vector3(A*(2+o)*0.5*Math.cos(w),A*(2+o)*Math.sin(w)*0.5,E*A*Math.sin(u)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var k=
 a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;e=j(k,h,this.q,this.p,this.radius,this.heightScale);k=j(k+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=k.x-e.x;b.y=k.y-e.y;b.z=k.z-e.z;d.x=k.x+e.x;d.y=k.y+e.y;d.z=k.z+e.z;g.cross(b,d);d.cross(g,b);g.normalize();d.normalize();k=this.tube*Math.cos(h);h=this.tube*Math.sin(h);e.x+=k*d.x+h*g.x;e.y+=k*d.y+h*g.y;e.z+=k*d.z+h*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
 0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;h=(c+1)%this.segmentsT;e=this.grid[a][c];b=this.grid[g][c];d=this.grid[a][h];g=this.grid[g][h];h=new THREE.UV(a/this.segmentsR,c/this.segmentsT);k=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var m=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),q=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(e,b,d));this.uvs.push([h,k,m]);this.faces.push(new THREE.Face3(g,d,b));this.uvs.push([q,m,k])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?this.addStatusElement():null};
@@ -356,41 +356,41 @@ THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement
 c},loadAsciiOld:function(a,c){var b=document.createElement("script");b.type="text/javascript";b.onload=c;b.src=a;document.getElementsByTagName("head")[0].appendChild(b)},loadAscii:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(e){THREE.Loader.prototype.createModel(e.data,b,d)};c.postMessage(a)},loadBinary:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:
 THREE.Loader.prototype.extractUrlbase(c),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,e,d,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,e,g){var h=new XMLHttpRequest,j=d+"/"+a,k=0;
 h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,b,e,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(g){k==0&&(k=h.getResponseHeader("Content-Length"));g({total:k,loaded:h.responseText.length})}}else h.readyState==2&&(k=h.getResponseHeader("Content-Length"))};h.open("GET",j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
-createBinModel:function(a,c,b,d){var e=function(g){function h(t,n){var p=q(t,n),C=q(t,n+1),B=q(t,n+2),D=q(t,n+3),O=(D<<1&255|B>>7)-127;p|=(B&127)<<16|C<<8;if(p==0&&O==-127)return 0;return(1-2*(D>>7))*(1+p*Math.pow(2,-23))*Math.pow(2,O)}function j(t,n){var p=q(t,n),C=q(t,n+1),B=q(t,n+2);return(q(t,n+3)<<24)+(B<<16)+(C<<8)+p}function k(t,n){var p=q(t,n);return(q(t,n+1)<<8)+p}function m(t,n){var p=q(t,n);return p>127?p-256:p}function q(t,n){return t.charCodeAt(n)&255}function y(t){var n,p,C;n=j(a,t);
-p=j(a,t+Y);C=j(a,t+N);t=k(a,t+f);THREE.Loader.prototype.f3(w,n,p,C,t)}function u(t){var n,p,C,B,D,O;n=j(a,t);p=j(a,t+Y);C=j(a,t+N);B=k(a,t+f);D=j(a,t+W);O=j(a,t+R);t=j(a,t+da);THREE.Loader.prototype.f3n(w,L,n,p,C,B,D,O,t)}function o(t){var n,p,C,B;n=j(a,t);p=j(a,t+ga);C=j(a,t+I);B=j(a,t+ca);t=k(a,t+za);THREE.Loader.prototype.f4(w,n,p,C,B,t)}function v(t){var n,p,C,B,D,O,X,F;n=j(a,t);p=j(a,t+ga);C=j(a,t+I);B=j(a,t+ca);D=k(a,t+za);O=j(a,t+ea);X=j(a,t+xa);F=j(a,t+ja);t=j(a,t+ha);THREE.Loader.prototype.f4n(w,
-L,n,p,C,B,D,O,X,F,t)}function A(t){var n,p;n=j(a,t);p=j(a,t+va);t=j(a,t+Aa);THREE.Loader.prototype.uv3(w.uvs,J[n*2],J[n*2+1],J[p*2],J[p*2+1],J[t*2],J[t*2+1])}function E(t){var n,p,C;n=j(a,t);p=j(a,t+ia);C=j(a,t+$);t=j(a,t+qa);THREE.Loader.prototype.uv4(w.uvs,J[n*2],J[n*2+1],J[p*2],J[p*2+1],J[C*2],J[C*2+1],J[t*2],J[t*2+1])}var w=this,G=0,x,L=[],J=[],Y,N,f,W,R,da,ga,I,ca,za,ea,xa,ja,ha,va,Aa,ia,$,qa,ra,Q,ma,ta,l,z;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,d,g);x={signature:a.substr(G,
+createBinModel:function(a,c,b,d){var e=function(g){function h(t,n){var p=q(t,n),C=q(t,n+1),B=q(t,n+2),D=q(t,n+3),O=(D<<1&255|B>>7)-127;p|=(B&127)<<16|C<<8;if(p==0&&O==-127)return 0;return(1-2*(D>>7))*(1+p*Math.pow(2,-23))*Math.pow(2,O)}function j(t,n){var p=q(t,n),C=q(t,n+1),B=q(t,n+2);return(q(t,n+3)<<24)+(B<<16)+(C<<8)+p}function k(t,n){var p=q(t,n);return(q(t,n+1)<<8)+p}function m(t,n){var p=q(t,n);return p>127?p-256:p}function q(t,n){return t.charCodeAt(n)&255}function w(t){var n,p,C;n=j(a,t);
+p=j(a,t+Y);C=j(a,t+N);t=k(a,t+f);THREE.Loader.prototype.f3(x,n,p,C,t)}function u(t){var n,p,C,B,D,O;n=j(a,t);p=j(a,t+Y);C=j(a,t+N);B=k(a,t+f);D=j(a,t+W);O=j(a,t+R);t=j(a,t+da);THREE.Loader.prototype.f3n(x,L,n,p,C,B,D,O,t)}function o(t){var n,p,C,B;n=j(a,t);p=j(a,t+ga);C=j(a,t+I);B=j(a,t+ca);t=k(a,t+za);THREE.Loader.prototype.f4(x,n,p,C,B,t)}function v(t){var n,p,C,B,D,O,X,F;n=j(a,t);p=j(a,t+ga);C=j(a,t+I);B=j(a,t+ca);D=k(a,t+za);O=j(a,t+ea);X=j(a,t+xa);F=j(a,t+ja);t=j(a,t+ha);THREE.Loader.prototype.f4n(x,
+L,n,p,C,B,D,O,X,F,t)}function A(t){var n,p;n=j(a,t);p=j(a,t+va);t=j(a,t+Aa);THREE.Loader.prototype.uv3(x.uvs,J[n*2],J[n*2+1],J[p*2],J[p*2+1],J[t*2],J[t*2+1])}function E(t){var n,p,C;n=j(a,t);p=j(a,t+ia);C=j(a,t+$);t=j(a,t+qa);THREE.Loader.prototype.uv4(x.uvs,J[n*2],J[n*2+1],J[p*2],J[p*2+1],J[C*2],J[C*2+1],J[t*2],J[t*2+1])}var x=this,G=0,y,L=[],J=[],Y,N,f,W,R,da,ga,I,ca,za,ea,xa,ja,ha,va,Aa,ia,$,qa,ra,Q,ma,ta,l,z;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,d,g);y={signature:a.substr(G,
 8),header_bytes:q(a,G+8),vertex_coordinate_bytes:q(a,G+9),normal_coordinate_bytes:q(a,G+10),uv_coordinate_bytes:q(a,G+11),vertex_index_bytes:q(a,G+12),normal_index_bytes:q(a,G+13),uv_index_bytes:q(a,G+14),material_index_bytes:q(a,G+15),nvertices:j(a,G+16),nnormals:j(a,G+16+4),nuvs:j(a,G+16+8),ntri_flat:j(a,G+16+12),ntri_smooth:j(a,G+16+16),ntri_flat_uv:j(a,G+16+20),ntri_smooth_uv:j(a,G+16+24),nquad_flat:j(a,G+16+28),nquad_smooth:j(a,G+16+32),nquad_flat_uv:j(a,G+16+36),nquad_smooth_uv:j(a,G+16+40)};
-G+=x.header_bytes;Y=x.vertex_index_bytes;N=x.vertex_index_bytes*2;f=x.vertex_index_bytes*3;W=x.vertex_index_bytes*3+x.material_index_bytes;R=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes;da=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*2;ga=x.vertex_index_bytes;I=x.vertex_index_bytes*2;ca=x.vertex_index_bytes*3;za=x.vertex_index_bytes*4;ea=x.vertex_index_bytes*4+x.material_index_bytes;xa=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes;ja=
-x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*2;ha=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*3;va=x.uv_index_bytes;Aa=x.uv_index_bytes*2;ia=x.uv_index_bytes;$=x.uv_index_bytes*2;qa=x.uv_index_bytes*3;g=x.vertex_index_bytes*3+x.material_index_bytes;z=x.vertex_index_bytes*4+x.material_index_bytes;ra=x.ntri_flat*g;Q=x.ntri_smooth*(g+x.normal_index_bytes*3);ma=x.ntri_flat_uv*(g+x.uv_index_bytes*3);ta=x.ntri_smooth_uv*(g+x.normal_index_bytes*3+x.uv_index_bytes*
-3);l=x.nquad_flat*z;g=x.nquad_smooth*(z+x.normal_index_bytes*4);z=x.nquad_flat_uv*(z+x.uv_index_bytes*4);G+=function(t){for(var n,p,C,B=x.vertex_coordinate_bytes*3,D=t+x.nvertices*B;t<D;t+=B){n=h(a,t);p=h(a,t+x.vertex_coordinate_bytes);C=h(a,t+x.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(w,n,p,C)}return x.nvertices*B}(G);G+=function(t){for(var n,p,C,B=x.normal_coordinate_bytes*3,D=t+x.nnormals*B;t<D;t+=B){n=m(a,t);p=m(a,t+x.normal_coordinate_bytes);C=m(a,t+x.normal_coordinate_bytes*2);L.push(n/
-127,p/127,C/127)}return x.nnormals*B}(G);G+=function(t){for(var n,p,C=x.uv_coordinate_bytes*2,B=t+x.nuvs*C;t<B;t+=C){n=h(a,t);p=h(a,t+x.uv_coordinate_bytes);J.push(n,p)}return x.nuvs*C}(G);ra=G+ra;Q=ra+Q;ma=Q+ma;ta=ma+ta;l=ta+l;g=l+g;z=g+z;(function(t){var n,p=x.vertex_index_bytes*3+x.material_index_bytes,C=p+x.uv_index_bytes*3,B=t+x.ntri_flat_uv*C;for(n=t;n<B;n+=C){y(n);A(n+p)}return B-t})(Q);(function(t){var n,p=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*3,C=p+x.uv_index_bytes*
-3,B=t+x.ntri_smooth_uv*C;for(n=t;n<B;n+=C){u(n);A(n+p)}return B-t})(ma);(function(t){var n,p=x.vertex_index_bytes*4+x.material_index_bytes,C=p+x.uv_index_bytes*4,B=t+x.nquad_flat_uv*C;for(n=t;n<B;n+=C){o(n);E(n+p)}return B-t})(g);(function(t){var n,p=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*4,C=p+x.uv_index_bytes*4,B=t+x.nquad_smooth_uv*C;for(n=t;n<B;n+=C){v(n);E(n+p)}return B-t})(z);(function(t){var n,p=x.vertex_index_bytes*3+x.material_index_bytes,C=t+x.ntri_flat*p;for(n=
-t;n<C;n+=p)y(n);return C-t})(G);(function(t){var n,p=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*3,C=t+x.ntri_smooth*p;for(n=t;n<C;n+=p)u(n);return C-t})(ra);(function(t){var n,p=x.vertex_index_bytes*4+x.material_index_bytes,C=t+x.nquad_flat*p;for(n=t;n<C;n+=p)o(n);return C-t})(ta);(function(t){var n,p=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*4,C=t+x.nquad_smooth*p;for(n=t;n<C;n+=p)v(n);return C-t})(l);this.computeCentroids();this.computeFaceNormals()};
-e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},createModel:function(a,c,b){var d=function(e){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,e);(function(){var h,j,k,m,q,y;h=0;for(j=a.vertices.length;h<j;h+=3){k=a.vertices[h];m=a.vertices[h+1];q=a.vertices[h+2];THREE.Loader.prototype.v(g,k,m,q)}if(a.morphTargets!==undefined){h=0;for(j=a.morphTargets.length;h<j;h++){g.morphTargets[h]={};g.morphTargets[h].name=a.morphTargets[h].name;g.morphTargets[h].vertices=
-[];y=g.morphTargets[h].vertices;q=a.morphTargets[h].vertices;k=0;for(m=q.length;k<m;k+=3)y.push(new THREE.Vertex(new THREE.Vector3(q[k],q[k+1],q[k+2])))}}if(a.colors){h=0;for(j=a.colors.length;h<j;h+=3){k=a.colors[h];m=a.colors[h+1];q=a.colors[h+2];THREE.Loader.prototype.vc(g,k,m,q)}}})();(function(){function h(v,A){THREE.Loader.prototype.f3(g,v[A],v[A+1],v[A+2],v[A+3])}function j(v,A){THREE.Loader.prototype.f3n(g,a.normals,v[A],v[A+1],v[A+2],v[A+3],v[A+4],v[A+5],v[A+6])}function k(v,A){THREE.Loader.prototype.f4(g,
-v[A],v[A+1],v[A+2],v[A+3],v[A+4])}function m(v,A){THREE.Loader.prototype.f4n(g,a.normals,v[A],v[A+1],v[A+2],v[A+3],v[A+4],v[A+5],v[A+6],v[A+7],v[A+8])}function q(v,A){var E,w,G,x,L,J,Y,N,f;E=v[A];w=v[A+1];G=v[A+2];x=a.uvs[E*2];Y=a.uvs[E*2+1];L=a.uvs[w*2];N=a.uvs[w*2+1];J=a.uvs[G*2];f=a.uvs[G*2+1];THREE.Loader.prototype.uv3(g.uvs,x,Y,L,N,J,f);if(a.uvs2&&a.uvs2.length){x=a.uvs2[E*2];Y=a.uvs2[E*2+1];L=a.uvs2[w*2];N=a.uvs2[w*2+1];J=a.uvs2[G*2];f=a.uvs2[G*2+1];THREE.Loader.prototype.uv3(g.uvs2,x,1-Y,L,
-1-N,J,1-f)}}function y(v,A){var E,w,G,x,L,J,Y,N,f,W,R,da;E=v[A];w=v[A+1];G=v[A+2];x=v[A+3];L=a.uvs[E*2];f=a.uvs[E*2+1];J=a.uvs[w*2];W=a.uvs[w*2+1];Y=a.uvs[G*2];R=a.uvs[G*2+1];N=a.uvs[x*2];da=a.uvs[x*2+1];THREE.Loader.prototype.uv4(g.uvs,L,f,J,W,Y,R,N,da);if(a.uvs2){L=a.uvs2[E*2];f=a.uvs2[E*2+1];J=a.uvs2[w*2];W=a.uvs2[w*2+1];Y=a.uvs2[G*2];R=a.uvs2[G*2+1];N=a.uvs2[x*2];da=a.uvs2[x*2+1];THREE.Loader.prototype.uv4(g.uvs2,L,1-f,J,1-W,Y,1-R,N,1-da)}}var u,o;u=0;for(o=a.trianglesUvs.length;u<o;u+=7){h(a.trianglesUvs,
-u);q(a.trianglesUvs,u+4)}u=0;for(o=a.trianglesNormalsUvs.length;u<o;u+=10){j(a.trianglesNormalsUvs,u);q(a.trianglesNormalsUvs,u+7)}u=0;for(o=a.quadsUvs.length;u<o;u+=9){k(a.quadsUvs,u);y(a.quadsUvs,u+5)}u=0;for(o=a.quadsNormalsUvs.length;u<o;u+=13){m(a.quadsNormalsUvs,u);y(a.quadsNormalsUvs,u+9)}u=0;for(o=a.triangles.length;u<o;u+=4)h(a.triangles,u);u=0;for(o=a.trianglesNormals.length;u<o;u+=7)j(a.trianglesNormals,u);u=0;for(o=a.quads.length;u<o;u+=5)k(a.quads,u);u=0;for(o=a.quadsNormals.length;u<
+G+=y.header_bytes;Y=y.vertex_index_bytes;N=y.vertex_index_bytes*2;f=y.vertex_index_bytes*3;W=y.vertex_index_bytes*3+y.material_index_bytes;R=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes;da=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*2;ga=y.vertex_index_bytes;I=y.vertex_index_bytes*2;ca=y.vertex_index_bytes*3;za=y.vertex_index_bytes*4;ea=y.vertex_index_bytes*4+y.material_index_bytes;xa=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes;ja=
+y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*2;ha=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*3;va=y.uv_index_bytes;Aa=y.uv_index_bytes*2;ia=y.uv_index_bytes;$=y.uv_index_bytes*2;qa=y.uv_index_bytes*3;g=y.vertex_index_bytes*3+y.material_index_bytes;z=y.vertex_index_bytes*4+y.material_index_bytes;ra=y.ntri_flat*g;Q=y.ntri_smooth*(g+y.normal_index_bytes*3);ma=y.ntri_flat_uv*(g+y.uv_index_bytes*3);ta=y.ntri_smooth_uv*(g+y.normal_index_bytes*3+y.uv_index_bytes*
+3);l=y.nquad_flat*z;g=y.nquad_smooth*(z+y.normal_index_bytes*4);z=y.nquad_flat_uv*(z+y.uv_index_bytes*4);G+=function(t){for(var n,p,C,B=y.vertex_coordinate_bytes*3,D=t+y.nvertices*B;t<D;t+=B){n=h(a,t);p=h(a,t+y.vertex_coordinate_bytes);C=h(a,t+y.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(x,n,p,C)}return y.nvertices*B}(G);G+=function(t){for(var n,p,C,B=y.normal_coordinate_bytes*3,D=t+y.nnormals*B;t<D;t+=B){n=m(a,t);p=m(a,t+y.normal_coordinate_bytes);C=m(a,t+y.normal_coordinate_bytes*2);L.push(n/
+127,p/127,C/127)}return y.nnormals*B}(G);G+=function(t){for(var n,p,C=y.uv_coordinate_bytes*2,B=t+y.nuvs*C;t<B;t+=C){n=h(a,t);p=h(a,t+y.uv_coordinate_bytes);J.push(n,p)}return y.nuvs*C}(G);ra=G+ra;Q=ra+Q;ma=Q+ma;ta=ma+ta;l=ta+l;g=l+g;z=g+z;(function(t){var n,p=y.vertex_index_bytes*3+y.material_index_bytes,C=p+y.uv_index_bytes*3,B=t+y.ntri_flat_uv*C;for(n=t;n<B;n+=C){w(n);A(n+p)}return B-t})(Q);(function(t){var n,p=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*3,C=p+y.uv_index_bytes*
+3,B=t+y.ntri_smooth_uv*C;for(n=t;n<B;n+=C){u(n);A(n+p)}return B-t})(ma);(function(t){var n,p=y.vertex_index_bytes*4+y.material_index_bytes,C=p+y.uv_index_bytes*4,B=t+y.nquad_flat_uv*C;for(n=t;n<B;n+=C){o(n);E(n+p)}return B-t})(g);(function(t){var n,p=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*4,C=p+y.uv_index_bytes*4,B=t+y.nquad_smooth_uv*C;for(n=t;n<B;n+=C){v(n);E(n+p)}return B-t})(z);(function(t){var n,p=y.vertex_index_bytes*3+y.material_index_bytes,C=t+y.ntri_flat*p;for(n=
+t;n<C;n+=p)w(n);return C-t})(G);(function(t){var n,p=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*3,C=t+y.ntri_smooth*p;for(n=t;n<C;n+=p)u(n);return C-t})(ra);(function(t){var n,p=y.vertex_index_bytes*4+y.material_index_bytes,C=t+y.nquad_flat*p;for(n=t;n<C;n+=p)o(n);return C-t})(ta);(function(t){var n,p=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*4,C=t+y.nquad_smooth*p;for(n=t;n<C;n+=p)v(n);return C-t})(l);this.computeCentroids();this.computeFaceNormals()};
+e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},createModel:function(a,c,b){var d=function(e){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,e);(function(){var h,j,k,m,q,w;h=0;for(j=a.vertices.length;h<j;h+=3){k=a.vertices[h];m=a.vertices[h+1];q=a.vertices[h+2];THREE.Loader.prototype.v(g,k,m,q)}if(a.morphTargets!==undefined){h=0;for(j=a.morphTargets.length;h<j;h++){g.morphTargets[h]={};g.morphTargets[h].name=a.morphTargets[h].name;g.morphTargets[h].vertices=
+[];w=g.morphTargets[h].vertices;q=a.morphTargets[h].vertices;k=0;for(m=q.length;k<m;k+=3)w.push(new THREE.Vertex(new THREE.Vector3(q[k],q[k+1],q[k+2])))}}if(a.colors){h=0;for(j=a.colors.length;h<j;h+=3){k=a.colors[h];m=a.colors[h+1];q=a.colors[h+2];THREE.Loader.prototype.vc(g,k,m,q)}}})();(function(){function h(v,A){THREE.Loader.prototype.f3(g,v[A],v[A+1],v[A+2],v[A+3])}function j(v,A){THREE.Loader.prototype.f3n(g,a.normals,v[A],v[A+1],v[A+2],v[A+3],v[A+4],v[A+5],v[A+6])}function k(v,A){THREE.Loader.prototype.f4(g,
+v[A],v[A+1],v[A+2],v[A+3],v[A+4])}function m(v,A){THREE.Loader.prototype.f4n(g,a.normals,v[A],v[A+1],v[A+2],v[A+3],v[A+4],v[A+5],v[A+6],v[A+7],v[A+8])}function q(v,A){var E,x,G,y,L,J,Y,N,f;E=v[A];x=v[A+1];G=v[A+2];y=a.uvs[E*2];Y=a.uvs[E*2+1];L=a.uvs[x*2];N=a.uvs[x*2+1];J=a.uvs[G*2];f=a.uvs[G*2+1];THREE.Loader.prototype.uv3(g.uvs,y,Y,L,N,J,f);if(a.uvs2&&a.uvs2.length){y=a.uvs2[E*2];Y=a.uvs2[E*2+1];L=a.uvs2[x*2];N=a.uvs2[x*2+1];J=a.uvs2[G*2];f=a.uvs2[G*2+1];THREE.Loader.prototype.uv3(g.uvs2,y,1-Y,L,
+1-N,J,1-f)}}function w(v,A){var E,x,G,y,L,J,Y,N,f,W,R,da;E=v[A];x=v[A+1];G=v[A+2];y=v[A+3];L=a.uvs[E*2];f=a.uvs[E*2+1];J=a.uvs[x*2];W=a.uvs[x*2+1];Y=a.uvs[G*2];R=a.uvs[G*2+1];N=a.uvs[y*2];da=a.uvs[y*2+1];THREE.Loader.prototype.uv4(g.uvs,L,f,J,W,Y,R,N,da);if(a.uvs2){L=a.uvs2[E*2];f=a.uvs2[E*2+1];J=a.uvs2[x*2];W=a.uvs2[x*2+1];Y=a.uvs2[G*2];R=a.uvs2[G*2+1];N=a.uvs2[y*2];da=a.uvs2[y*2+1];THREE.Loader.prototype.uv4(g.uvs2,L,1-f,J,1-W,Y,1-R,N,1-da)}}var u,o;u=0;for(o=a.trianglesUvs.length;u<o;u+=7){h(a.trianglesUvs,
+u);q(a.trianglesUvs,u+4)}u=0;for(o=a.trianglesNormalsUvs.length;u<o;u+=10){j(a.trianglesNormalsUvs,u);q(a.trianglesNormalsUvs,u+7)}u=0;for(o=a.quadsUvs.length;u<o;u+=9){k(a.quadsUvs,u);w(a.quadsUvs,u+5)}u=0;for(o=a.quadsNormalsUvs.length;u<o;u+=13){m(a.quadsNormalsUvs,u);w(a.quadsNormalsUvs,u+9)}u=0;for(o=a.triangles.length;u<o;u+=4)h(a.triangles,u);u=0;for(o=a.trianglesNormals.length;u<o;u+=7)j(a.trianglesNormals,u);u=0;for(o=a.quads.length;u<o;u+=5)k(a.quads,u);u=0;for(o=a.quadsNormals.length;u<
 o;u+=9)m(a.quadsNormals,u)})();(function(){var h,j,k,m;if(a.skinWeights){h=0;for(j=a.skinWeights.length;h<j;h+=2){k=a.skinWeights[h];m=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,k,m,0,0)}}if(a.skinIndices){h=0;for(j=a.skinIndices.length;h<j;h+=2){k=a.skinIndices[h];m=a.skinIndices[h+1];THREE.Loader.prototype.si(g,k,m,0,0)}}THREE.Loader.prototype.bones(g,a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;
 d.prototype.constructor=d;c(new d(b))},bones:function(a,c){a.bones=c},animation:function(a,c){a.animation=c},si:function(a,c,b,d,e){a.skinIndices.push(new THREE.Vector4(c,b,d,e))},sw:function(a,c,b,d,e){a.skinWeights.push(new THREE.Vector4(c,b,d,e))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,d)))},vc:function(a,c,b,d){var e=new THREE.Color(16777215);e.setRGB(c,b,d);a.colors.push(e)},f3:function(a,c,b,d,e){a.faces.push(new THREE.Face3(c,b,d,null,a.materials[e]))},f4:function(a,
-c,b,d,e,g){a.faces.push(new THREE.Face4(c,b,d,e,null,a.materials[g]))},f3n:function(a,c,b,d,e,g,h,j,k){g=a.materials[g];var m=c[j*3],q=c[j*3+1];j=c[j*3+2];var y=c[k*3],u=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face3(b,d,e,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(m,q,j),new THREE.Vector3(y,u,k)],g))},f4n:function(a,c,b,d,e,g,h,j,k,m,q){h=a.materials[h];var y=c[k*3],u=c[k*3+1];k=c[k*3+2];var o=c[m*3],v=c[m*3+1];m=c[m*3+2];var A=c[q*3],E=c[q*3+1];q=c[q*3+2];a.faces.push(new THREE.Face4(b,
-d,e,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(y,u,k),new THREE.Vector3(o,v,m),new THREE.Vector3(A,E,q)],h))},uv3:function(a,c,b,d,e,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(d,e));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,d,e,g,h,j,k){var m=[];m.push(new THREE.UV(c,b));m.push(new THREE.UV(d,e));m.push(new THREE.UV(g,h));m.push(new THREE.UV(j,k));a.push(m)},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=
-[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(j){j=Math.log(j)/Math.LN2;return Math.floor(j)==j}function d(j,k){var m=new Image;m.onload=function(){if(!b(this.width)||!b(this.height)){var q=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),y=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));j.image.width=q;j.image.height=y;j.image.getContext("2d").drawImage(this,0,0,q,y)}else j.image=this;j.needsUpdate=!0};m.src=k}var e,g,h;e="MeshLambertMaterial";
+c,b,d,e,g){a.faces.push(new THREE.Face4(c,b,d,e,null,a.materials[g]))},f3n:function(a,c,b,d,e,g,h,j,k){g=a.materials[g];var m=c[j*3],q=c[j*3+1];j=c[j*3+2];var w=c[k*3],u=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face3(b,d,e,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(m,q,j),new THREE.Vector3(w,u,k)],g))},f4n:function(a,c,b,d,e,g,h,j,k,m,q){h=a.materials[h];var w=c[k*3],u=c[k*3+1];k=c[k*3+2];var o=c[m*3],v=c[m*3+1];m=c[m*3+2];var A=c[q*3],E=c[q*3+1];q=c[q*3+2];a.faces.push(new THREE.Face4(b,
+d,e,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(w,u,k),new THREE.Vector3(o,v,m),new THREE.Vector3(A,E,q)],h))},uv3:function(a,c,b,d,e,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(d,e));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,d,e,g,h,j,k){var m=[];m.push(new THREE.UV(c,b));m.push(new THREE.UV(d,e));m.push(new THREE.UV(g,h));m.push(new THREE.UV(j,k));a.push(m)},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=
+[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(j){j=Math.log(j)/Math.LN2;return Math.floor(j)==j}function d(j,k){var m=new Image;m.onload=function(){if(!b(this.width)||!b(this.height)){var q=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),w=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));j.image.width=q;j.image.height=w;j.image.getContext("2d").drawImage(this,0,0,q,w)}else j.image=this;j.needsUpdate=!0};m.src=k}var e,g,h;e="MeshLambertMaterial";
 g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(e="MeshPhongMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");
 g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;d(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[e](g)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(a,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.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,e){return b+(d-b)*e};this.VIntX=function(b,d,e,g,h,j,k,m,q,y){h=(h-q)/(y-q);q=this.normal_cache;d[g]=j+h*this.delta;d[g+1]=k;d[g+2]=m;e[g]=this.lerp(q[b],q[b+3],h);e[g+1]=this.lerp(q[b+1],q[b+4],h);e[g+2]=this.lerp(q[b+2],q[b+5],h)};this.VIntY=function(b,d,e,g,h,j,k,m,q,y){h=(h-q)/(y-q);q=this.normal_cache;d[g]=j;d[g+1]=k+h*this.delta;d[g+
-2]=m;d=b+this.yd*3;e[g]=this.lerp(q[b],q[d],h);e[g+1]=this.lerp(q[b+1],q[d+1],h);e[g+2]=this.lerp(q[b+2],q[d+2],h)};this.VIntZ=function(b,d,e,g,h,j,k,m,q,y){h=(h-q)/(y-q);q=this.normal_cache;d[g]=j;d[g+1]=k;d[g+2]=m+h*this.delta;d=b+this.zd*3;e[g]=this.lerp(q[b],q[d],h);e[g+1]=this.lerp(q[b+1],q[d+1],h);e[g+2]=this.lerp(q[b+2],q[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
-this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,e,g,h,j){var k=g+1,m=g+this.yd,q=g+this.zd,y=k+this.yd,u=k+this.zd,o=g+this.yd+this.zd,v=k+this.yd+this.zd,A=0,E=this.field[g],w=this.field[k],G=this.field[m],x=this.field[y],L=this.field[q],J=this.field[u],Y=this.field[o],N=this.field[v];E<h&&(A|=1);w<h&&(A|=2);G<h&&(A|=8);x<h&&(A|=4);L<h&&(A|=16);J<h&&(A|=32);Y<h&&(A|=128);N<h&&(A|=64);var f=THREE.edgeTable[A];if(f==0)return 0;
-var W=this.delta,R=b+W,da=d+W;W=e+W;if(f&1){this.compNorm(g);this.compNorm(k);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,e,E,w)}if(f&2){this.compNorm(k);this.compNorm(y);this.VIntY(k*3,this.vlist,this.nlist,3,h,R,d,e,w,x)}if(f&4){this.compNorm(m);this.compNorm(y);this.VIntX(m*3,this.vlist,this.nlist,6,h,b,da,e,G,x)}if(f&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,e,E,G)}if(f&16){this.compNorm(q);this.compNorm(u);this.VIntX(q*3,this.vlist,this.nlist,12,h,b,d,
-W,L,J)}if(f&32){this.compNorm(u);this.compNorm(v);this.VIntY(u*3,this.vlist,this.nlist,15,h,R,d,W,J,N)}if(f&64){this.compNorm(o);this.compNorm(v);this.VIntX(o*3,this.vlist,this.nlist,18,h,b,da,W,Y,N)}if(f&128){this.compNorm(q);this.compNorm(o);this.VIntY(q*3,this.vlist,this.nlist,21,h,b,d,W,L,Y)}if(f&256){this.compNorm(g);this.compNorm(q);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,e,E,L)}if(f&512){this.compNorm(k);this.compNorm(u);this.VIntZ(k*3,this.vlist,this.nlist,27,h,R,d,e,w,J)}if(f&1024){this.compNorm(y);
-this.compNorm(v);this.VIntZ(y*3,this.vlist,this.nlist,30,h,R,da,e,x,N)}if(f&2048){this.compNorm(m);this.compNorm(o);this.VIntZ(m*3,this.vlist,this.nlist,33,h,b,da,e,G,Y)}A<<=4;for(h=g=0;THREE.triTable[A+h]!=-1;){b=A+h;d=b+1;e=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[e],j);h+=3;g++}return g};this.posnormtriv=function(b,d,e,g,h,j){var k=this.count*3;this.positionArray[k]=b[e];this.positionArray[k+1]=b[e+1];this.positionArray[k+2]=b[e+2];this.positionArray[k+
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,e){return b+(d-b)*e};this.VIntX=function(b,d,e,g,h,j,k,m,q,w){h=(h-q)/(w-q);q=this.normal_cache;d[g]=j+h*this.delta;d[g+1]=k;d[g+2]=m;e[g]=this.lerp(q[b],q[b+3],h);e[g+1]=this.lerp(q[b+1],q[b+4],h);e[g+2]=this.lerp(q[b+2],q[b+5],h)};this.VIntY=function(b,d,e,g,h,j,k,m,q,w){h=(h-q)/(w-q);q=this.normal_cache;d[g]=j;d[g+1]=k+h*this.delta;d[g+
+2]=m;d=b+this.yd*3;e[g]=this.lerp(q[b],q[d],h);e[g+1]=this.lerp(q[b+1],q[d+1],h);e[g+2]=this.lerp(q[b+2],q[d+2],h)};this.VIntZ=function(b,d,e,g,h,j,k,m,q,w){h=(h-q)/(w-q);q=this.normal_cache;d[g]=j;d[g+1]=k;d[g+2]=m+h*this.delta;d=b+this.zd*3;e[g]=this.lerp(q[b],q[d],h);e[g+1]=this.lerp(q[b+1],q[d+1],h);e[g+2]=this.lerp(q[b+2],q[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
+this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,e,g,h,j){var k=g+1,m=g+this.yd,q=g+this.zd,w=k+this.yd,u=k+this.zd,o=g+this.yd+this.zd,v=k+this.yd+this.zd,A=0,E=this.field[g],x=this.field[k],G=this.field[m],y=this.field[w],L=this.field[q],J=this.field[u],Y=this.field[o],N=this.field[v];E<h&&(A|=1);x<h&&(A|=2);G<h&&(A|=8);y<h&&(A|=4);L<h&&(A|=16);J<h&&(A|=32);Y<h&&(A|=128);N<h&&(A|=64);var f=THREE.edgeTable[A];if(f==0)return 0;
+var W=this.delta,R=b+W,da=d+W;W=e+W;if(f&1){this.compNorm(g);this.compNorm(k);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,e,E,x)}if(f&2){this.compNorm(k);this.compNorm(w);this.VIntY(k*3,this.vlist,this.nlist,3,h,R,d,e,x,y)}if(f&4){this.compNorm(m);this.compNorm(w);this.VIntX(m*3,this.vlist,this.nlist,6,h,b,da,e,G,y)}if(f&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,e,E,G)}if(f&16){this.compNorm(q);this.compNorm(u);this.VIntX(q*3,this.vlist,this.nlist,12,h,b,d,
+W,L,J)}if(f&32){this.compNorm(u);this.compNorm(v);this.VIntY(u*3,this.vlist,this.nlist,15,h,R,d,W,J,N)}if(f&64){this.compNorm(o);this.compNorm(v);this.VIntX(o*3,this.vlist,this.nlist,18,h,b,da,W,Y,N)}if(f&128){this.compNorm(q);this.compNorm(o);this.VIntY(q*3,this.vlist,this.nlist,21,h,b,d,W,L,Y)}if(f&256){this.compNorm(g);this.compNorm(q);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,e,E,L)}if(f&512){this.compNorm(k);this.compNorm(u);this.VIntZ(k*3,this.vlist,this.nlist,27,h,R,d,e,x,J)}if(f&1024){this.compNorm(w);
+this.compNorm(v);this.VIntZ(w*3,this.vlist,this.nlist,30,h,R,da,e,y,N)}if(f&2048){this.compNorm(m);this.compNorm(o);this.VIntZ(m*3,this.vlist,this.nlist,33,h,b,da,e,G,Y)}A<<=4;for(h=g=0;THREE.triTable[A+h]!=-1;){b=A+h;d=b+1;e=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[e],j);h+=3;g++}return g};this.posnormtriv=function(b,d,e,g,h,j){var k=this.count*3;this.positionArray[k]=b[e];this.positionArray[k+1]=b[e+1];this.positionArray[k+2]=b[e+2];this.positionArray[k+
 3]=b[g];this.positionArray[k+4]=b[g+1];this.positionArray[k+5]=b[g+2];this.positionArray[k+6]=b[h];this.positionArray[k+7]=b[h+1];this.positionArray[k+8]=b[h+2];this.normalArray[k]=d[e];this.normalArray[k+1]=d[e+1];this.normalArray[k+2]=d[e+2];this.normalArray[k+3]=d[g];this.normalArray[k+4]=d[g+1];this.normalArray[k+5]=d[g+2];this.normalArray[k+6]=d[h];this.normalArray[k+7]=d[h+1];this.normalArray[k+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=
-function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,e,g,h){var j=this.size*Math.sqrt(g/h),k=e*this.size,m=d*this.size,q=b*this.size,y=Math.floor(k-j);y<1&&(y=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var u=Math.floor(m-j);u<1&&(u=1);m=Math.floor(m+j);m>this.size-1&&(m=this.size-1);var o=Math.floor(q-j);o<1&&(o=1);j=Math.floor(q+j);
-j>this.size-1&&(j=this.size-1);for(var v,A,E,w,G,x;y<k;y++){q=this.size2*y;A=y/this.size-e;G=A*A;for(A=u;A<m;A++){E=q+this.size*A;v=A/this.size-d;x=v*v;for(v=o;v<j;v++){w=v/this.size-b;w=g/(1.0E-6+w*w+x+G)-h;w>0&&(this.field[E+v]+=w)}}}};this.addPlaneX=function(b,d){var e,g,h,j,k,m=this.size,q=this.yd,y=this.zd,u=this.field,o=m*Math.sqrt(b/d);o>m&&(o=m);for(e=0;e<o;e++){g=e/m;g*=g;j=b/(1.0E-4+g)-d;if(j>0)for(g=0;g<m;g++){k=e+g*q;for(h=0;h<m;h++)u[y*h+k]+=j}}};this.addPlaneY=function(b,d){var e,g,
-h,j,k,m,q=this.size,y=this.yd,u=this.zd,o=this.field,v=q*Math.sqrt(b/d);v>q&&(v=q);for(g=0;g<v;g++){e=g/q;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=g*y;for(e=0;e<q;e++){m=k+e;for(h=0;h<q;h++)o[u*h+m]+=j}}}};this.addPlaneZ=function(b,d){var e,g,h,j,k,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(h=0;h<dist;h++){e=h/size;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=zd*h;for(g=0;g<size;g++){m=k+g*yd;for(e=0;e<size;e++)field[m+e]+=j}}}};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 d,e,g,h,j,k,m,q,y,u=this.size-2;for(h=1;h<u;h++){y=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++){q=y+this.size*g;k=(g-this.halfsize)/this.halfsize;for(e=1;e<u;e++){j=(e-this.halfsize)/this.halfsize;d=q+e;this.polygonize(j,k,m,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(e){var g,h,j,k,m,q,y,u;for(g=
-0;g<e.count;g++){m=g*3;y=m+1;u=m+2;h=e.positionArray[m];j=e.positionArray[y];k=e.positionArray[u];q=new THREE.Vector3(h,j,k);h=e.normalArray[m];j=e.normalArray[y];k=e.normalArray[u];m=new THREE.Vector3(h,j,k);m.normalize();m=new THREE.Vertex(q,m);d.vertices.push(m)}nfaces=e.count/3;for(g=0;g<nfaces;g++){m=(b+g)*3;y=m+1;u=m+2;q=d.vertices[m].normal;h=d.vertices[y].normal;j=d.vertices[u].normal;m=new THREE.Face3(m,y,u,[q,h,j]);d.faces.push(m)}b+=nfaces;e.count=0});return d};this.init(a)};
+function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,e,g,h){var j=this.size*Math.sqrt(g/h),k=e*this.size,m=d*this.size,q=b*this.size,w=Math.floor(k-j);w<1&&(w=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var u=Math.floor(m-j);u<1&&(u=1);m=Math.floor(m+j);m>this.size-1&&(m=this.size-1);var o=Math.floor(q-j);o<1&&(o=1);j=Math.floor(q+j);
+j>this.size-1&&(j=this.size-1);for(var v,A,E,x,G,y;w<k;w++){q=this.size2*w;A=w/this.size-e;G=A*A;for(A=u;A<m;A++){E=q+this.size*A;v=A/this.size-d;y=v*v;for(v=o;v<j;v++){x=v/this.size-b;x=g/(1.0E-6+x*x+y+G)-h;x>0&&(this.field[E+v]+=x)}}}};this.addPlaneX=function(b,d){var e,g,h,j,k,m=this.size,q=this.yd,w=this.zd,u=this.field,o=m*Math.sqrt(b/d);o>m&&(o=m);for(e=0;e<o;e++){g=e/m;g*=g;j=b/(1.0E-4+g)-d;if(j>0)for(g=0;g<m;g++){k=e+g*q;for(h=0;h<m;h++)u[w*h+k]+=j}}};this.addPlaneY=function(b,d){var e,g,
+h,j,k,m,q=this.size,w=this.yd,u=this.zd,o=this.field,v=q*Math.sqrt(b/d);v>q&&(v=q);for(g=0;g<v;g++){e=g/q;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=g*w;for(e=0;e<q;e++){m=k+e;for(h=0;h<q;h++)o[u*h+m]+=j}}}};this.addPlaneZ=function(b,d){var e,g,h,j,k,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(h=0;h<dist;h++){e=h/size;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=zd*h;for(g=0;g<size;g++){m=k+g*yd;for(e=0;e<size;e++)field[m+e]+=j}}}};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 d,e,g,h,j,k,m,q,w,u=this.size-2;for(h=1;h<u;h++){w=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++){q=w+this.size*g;k=(g-this.halfsize)/this.halfsize;for(e=1;e<u;e++){j=(e-this.halfsize)/this.halfsize;d=q+e;this.polygonize(j,k,m,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(e){var g,h,j,k,m,q,w,u;for(g=
+0;g<e.count;g++){m=g*3;w=m+1;u=m+2;h=e.positionArray[m];j=e.positionArray[w];k=e.positionArray[u];q=new THREE.Vector3(h,j,k);h=e.normalArray[m];j=e.normalArray[w];k=e.normalArray[u];m=new THREE.Vector3(h,j,k);m.normalize();m=new THREE.Vertex(q,m);d.vertices.push(m)}nfaces=e.count/3;for(g=0;g<nfaces;g++){m=(b+g)*3;w=m+1;u=m+2;q=d.vertices[m].normal;h=d.vertices[w].normal;j=d.vertices[u].normal;m=new THREE.Face3(m,w,u,[q,h,j]);d.faces.push(m)}b+=nfaces;e.count=0});return d};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,

+ 2 - 2
build/custom/ThreeExtras.js

@@ -43,8 +43,8 @@ var Cube=function(a,d,b,c,g,e,f,h,j){function l(z,w,x,o,D,A,I,C){var E,F,J=c||1,
 (F+1)+N,A+1+M*(F+1)+N,A+1+M*F+N,null,C));k.uvs.push([new THREE.UV(A/J,F/K),new THREE.UV(A/J,(F+1)/K),new THREE.UV((A+1)/J,(F+1)/K),new THREE.UV((A+1)/J,F/K)])}}THREE.Geometry.call(this);var k=this,t=a/2,n=d/2,m=b/2;h=h?-1:1;if(f!==undefined)if(f instanceof Array)this.materials=f;else{this.materials=[];for(var p=0;p<6;p++)this.materials.push([f])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var u in j)this.sides[u]!=undefined&&(this.sides[u]=j[u]);this.sides.px&&
 l("z","y",1*h,-1,b,d,-t,this.materials[0]);this.sides.nx&&l("z","y",-1*h,-1,b,d,t,this.materials[1]);this.sides.py&&l("x","z",1*h,1,a,b,n,this.materials[2]);this.sides.ny&&l("x","z",1*h,-1,a,b,-n,this.materials[3]);this.sides.pz&&l("x","y",1*h,-1,a,d,m,this.materials[4]);this.sides.nz&&l("x","y",-1*h,-1,a,d,-m,this.materials[5]);(function(){for(var z=[],w=[],x=0,o=k.vertices.length;x<o;x++){for(var D=k.vertices[x],A=!1,I=0,C=z.length;I<C;I++){var E=z[I];if(D.position.x==E.position.x&&D.position.y==
 E.position.y&&D.position.z==E.position.z){w[x]=I;A=!0;break}}if(!A){w[x]=z.length;z.push(new THREE.Vertex(D.position.clone()))}}x=0;for(o=k.faces.length;x<o;x++){D=k.faces[x];D.a=w[D.a];D.b=w[D.b];D.c=w[D.c];D.d=w[D.d]}k.vertices=z})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(a,d,b,c){function g(j,l,k){e.vertices.push(new THREE.Vertex(new THREE.Vector3(j,l,k)))}THREE.Geometry.call(this);var e=this,f=Math.PI,h=c/2;for(c=0;c<a;c++)g(Math.sin(2*f*c/a)*d,Math.cos(2*f*c/a)*d,-h);for(c=0;c<a;c++)g(Math.sin(2*f*c/a)*b,Math.cos(2*f*c/a)*b,h);for(c=0;c<a;c++)e.faces.push(new THREE.Face4(c,c+a,a+(c+1)%a,(c+1)%a));g(0,0,-h);for(c=a;c<a+a/2;c++)e.faces.push(new THREE.Face4(2*a,(2*c-2*a)%a,(2*c-2*a+1)%a,(2*c-2*a+2)%a));g(0,0,h);for(c=a+a/2;c<2*a;c++)e.faces.push(new THREE.Face4((2*
-c-2*a+2)%a+a,(2*c-2*a+1)%a+a,(2*c-2*a)%a+a,2*a+1));this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
+var Cylinder=function(a,d,b,c,g,e){function f(k,t,n){h.vertices.push(new THREE.Vertex(new THREE.Vector3(k,t,n)))}THREE.Geometry.call(this);var h=this,j=Math.PI,l=c/2;for(c=0;c<a;c++)f(Math.sin(2*j*c/a)*d,Math.cos(2*j*c/a)*d,-l);for(c=0;c<a;c++)f(Math.sin(2*j*c/a)*b,Math.cos(2*j*c/a)*b,l);for(c=0;c<a;c++)h.faces.push(new THREE.Face4(c,c+a,a+(c+1)%a,(c+1)%a));if(b>0){f(0,0,-l-(e||0));for(c=a;c<a+a/2;c++)h.faces.push(new THREE.Face4(2*a,(2*c-2*a)%a,(2*c-2*a+1)%a,(2*c-2*a+2)%a))}if(d>0){f(0,0,l+(g||0));
+for(c=a+a/2;c<2*a;c++)h.faces.push(new THREE.Face4((2*c-2*a+2)%a+a,(2*c-2*a+1)%a+a,(2*c-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
 var Icosahedron=function(a){function d(t,n,m){var p=Math.sqrt(t*t+n*n+m*m);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(t/p,n/p,m/p)))-1}function b(t,n,m,p){p.faces.push(new THREE.Face3(t,n,m))}function c(t,n){var m=g.vertices[t].position,p=g.vertices[n].position;return d((m.x+p.x)/2,(m.y+p.y)/2,(m.z+p.z)/2)}var g=this,e=new THREE.Geometry,f;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0,
 1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,e);b(0,5,1,e);b(0,1,7,e);b(0,7,10,e);b(0,10,11,e);b(1,5,9,e);b(5,11,4,e);b(11,10,2,e);b(10,7,6,e);b(7,1,8,e);b(3,9,4,e);b(3,4,2,e);b(3,2,6,e);b(3,6,8,e);b(3,8,9,e);b(4,9,5,e);b(2,4,11,e);b(6,2,10,e);b(8,6,7,e);b(9,8,1,e);for(a=0;a<this.subdivisions;a++){f=new THREE.Geometry;for(var h in e.faces){var j=c(e.faces[h].a,e.faces[h].b),l=c(e.faces[h].b,e.faces[h].c),k=c(e.faces[h].c,e.faces[h].a);b(e.faces[h].a,j,k,f);b(e.faces[h].b,l,j,f);b(e.faces[h].c,
 k,l,f);b(j,l,k,f)}e.faces=f.faces}g.faces=e.faces;delete e;delete f;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;

+ 16 - 7
src/extras/geometries/Cylinder.js

@@ -3,7 +3,7 @@
  * @author mr.doob / http://mrdoob.com/ 
  */
 
-var Cylinder = function ( numSegs, topRad, botRad, height ) {
+var Cylinder = function ( numSegs, topRad, botRad, height, topOffset, botOffset ) {
 
 	THREE.Geometry.call( this );
 
@@ -35,26 +35,35 @@ var Cylinder = function ( numSegs, topRad, botRad, height ) {
 
 	// Bottom circle faces
 
-	v( 0, 0, - halfHeight );
+	if ( botRad > 0 ) {
 
-	for ( i = numSegs; i < numSegs + ( numSegs / 2 ); i++ ) {
+		v( 0, 0, - halfHeight - ( botOffset || 0 ) );
 
-		f4( 2 * numSegs, ( 2 * i - 2 * numSegs ) % numSegs, ( 2 * i - 2 * numSegs + 1 ) % numSegs, ( 2 * i - 2 * numSegs + 2 ) % numSegs );
+		for ( i = numSegs; i < numSegs + ( numSegs / 2 ); i++ ) {
+
+			f4( 2 * numSegs, ( 2 * i - 2 * numSegs ) % numSegs, ( 2 * i - 2 * numSegs + 1 ) % numSegs, ( 2 * i - 2 * numSegs + 2 ) % numSegs );
+
+		}
 
 	}
 
 	// Top circle faces
 
-	v( 0, 0, halfHeight );
+	if ( topRad > 0 ) {
+
+		v( 0, 0, halfHeight + ( topOffset || 0 ) );
+
+		for ( i = numSegs + ( numSegs / 2 ); i < 2 * numSegs; i ++ ) {
 
-	for ( i = numSegs + ( numSegs / 2 ); i < 2 * numSegs; i ++ ) {
+			f4( ( 2 * i - 2 * numSegs + 2 ) % numSegs + numSegs, ( 2 * i - 2 * numSegs + 1 ) % numSegs + numSegs, ( 2 * i - 2 * numSegs ) % numSegs+numSegs, 2 * numSegs + 1 );
 
-		f4( ( 2 * i - 2 * numSegs + 2 ) % numSegs + numSegs, ( 2 * i - 2 * numSegs + 1 ) % numSegs + numSegs, ( 2 * i - 2 * numSegs ) % numSegs+numSegs, 2 * numSegs + 1 );
+		}
 
 	}
 
 	this.computeCentroids();
 	this.computeFaceNormals();
+	// this.computeVertexNormals();
 
 	function v( x, y, z ) {