Selaa lähdekoodia

Moved createSubdivision() to THREE.GeometryUtils

zz85 14 vuotta sitten
vanhempi
commit
dd6114b7f2
3 muutettua tiedostoa jossa 140 lisäystä ja 106 poistoa
  1. 83 82
      build/Three.js
  2. 40 24
      examples/canvas_geometry_subdivison.html
  3. 17 0
      src/extras/GeometryUtils.js

+ 83 - 82
build/Three.js

@@ -26,8 +26,8 @@ THREE.Matrix4=function(b,c,e,f,h,k,m,n,p,u,w,t,x,v,z,y){this.set(b!==void 0?b:1,
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,m,n,p,u,w,t,x,v,z,y){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=m;this.n24=n;this.n31=p;this.n32=u;this.n33=w;this.n34=t;this.n41=x;this.n42=v;this.n43=z;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
 c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());h.cross(k,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=k.x;this.n21=f.y;this.n22=h.y;this.n23=k.y;this.n31=f.z;this.n32=h.z;this.n33=k.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h;
 b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
-e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,p=b.n23,u=b.n24,w=b.n31,t=b.n32,x=b.n33,v=b.n34,z=b.n41,y=b.n42,B=b.n43,A=b.n44,E=c.n11,D=c.n12,
-F=c.n13,O=c.n14,R=c.n21,L=c.n22,G=c.n23,J=c.n24,Z=c.n31,I=c.n32,Q=c.n33,X=c.n34,V=c.n41,W=c.n42,o=c.n43,fa=c.n44;this.n11=e*E+f*R+h*Z+k*V;this.n12=e*D+f*L+h*I+k*W;this.n13=e*F+f*G+h*Q+k*o;this.n14=e*O+f*J+h*X+k*fa;this.n21=m*E+n*R+p*Z+u*V;this.n22=m*D+n*L+p*I+u*W;this.n23=m*F+n*G+p*Q+u*o;this.n24=m*O+n*J+p*X+u*fa;this.n31=w*E+t*R+x*Z+v*V;this.n32=w*D+t*L+x*I+v*W;this.n33=w*F+t*G+x*Q+v*o;this.n34=w*O+t*J+x*X+v*fa;this.n41=z*E+y*R+B*Z+A*V;this.n42=z*D+y*L+B*I+A*W;this.n43=z*F+y*G+B*Q+A*o;this.n44=z*
+e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,p=b.n23,u=b.n24,w=b.n31,t=b.n32,x=b.n33,v=b.n34,z=b.n41,y=b.n42,B=b.n43,A=b.n44,D=c.n11,E=c.n12,
+F=c.n13,O=c.n14,R=c.n21,L=c.n22,G=c.n23,J=c.n24,Z=c.n31,I=c.n32,Q=c.n33,X=c.n34,V=c.n41,W=c.n42,o=c.n43,fa=c.n44;this.n11=e*D+f*R+h*Z+k*V;this.n12=e*E+f*L+h*I+k*W;this.n13=e*F+f*G+h*Q+k*o;this.n14=e*O+f*J+h*X+k*fa;this.n21=m*D+n*R+p*Z+u*V;this.n22=m*E+n*L+p*I+u*W;this.n23=m*F+n*G+p*Q+u*o;this.n24=m*O+n*J+p*X+u*fa;this.n31=w*D+t*R+x*Z+v*V;this.n32=w*E+t*L+x*I+v*W;this.n33=w*F+t*G+x*Q+v*o;this.n34=w*O+t*J+x*X+v*fa;this.n41=z*D+y*R+B*Z+A*V;this.n42=z*E+y*L+B*I+A*W;this.n43=z*F+y*G+B*Q+A*o;this.n44=z*
 O+y*J+B*X+A*fa;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=
 b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,k=this.n22,m=this.n23,n=this.n24,p=this.n31,u=this.n32,w=this.n33,t=this.n34,x=this.n41,v=this.n42,z=this.n43,y=this.n44;return f*m*u*x-e*n*u*x-f*k*w*x+c*n*w*x+e*k*t*x-c*m*t*x-f*m*p*v+e*n*p*v+f*h*w*v-b*n*w*v-e*h*t*v+b*m*t*v+f*k*p*z-c*n*p*z-f*h*u*z+b*n*u*z+c*h*t*z-b*k*t*z-e*k*p*y+c*m*p*y+e*h*u*y-b*m*u*y-c*h*
 w*y+b*k*w*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=
@@ -54,16 +54,16 @@ this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.childr
 c){var e,f,h;e=0;for(f=this.children.length;e<f;e++){h=this.children[e];if(h.name===b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
 this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");
 this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");this.remove(b)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function b(){var b=p[n]=p[n]||new THREE.RenderableVertex;n++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,k=b.z+b.w,h=e.z+e.w,m=-b.z+b.w,n=-e.z+e.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,k=[],m,n,p=[],u,w,t=[],x,v=[],z,y,B=[],A,E,D=[],F=[],O=[],R=new THREE.Vector4,L=new THREE.Vector4,
+THREE.Projector=function(){function b(){var b=p[n]=p[n]||new THREE.RenderableVertex;n++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,k=b.z+b.w,h=e.z+e.w,m=-b.z+b.w,n=-e.z+e.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,k=[],m,n,p=[],u,w,t=[],x,v=[],z,y,B=[],A,D,E=[],F=[],O=[],R=new THREE.Vector4,L=new THREE.Vector4,
 G=new THREE.Matrix4,J=new THREE.Matrix4,Z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(b,e){G.multiply(e.projectionMatrix,e.matrixWorldInverse);G.multiplyVector3(b);return b};this.unprojectVector=function(b,e){G.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));G.multiplyVector3(b);return b};this.projectObjects=function(b,e,m){var o,n;h=F.length=0;
 o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var t;if(!(t=!n.visible))if(t=n instanceof THREE.Mesh)if(t=n.frustumCulled){a:{t=void 0;for(var v=n.matrixWorld,u=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),p=0;p<6;p++)if(t=Z[p].x*v.n14+Z[p].y*v.n24+Z[p].z*v.n34+Z[p].w,t<=u){t=!1;break a}t=!0}t=!t}if(!t)t=k[h]=k[h]||new THREE.RenderableObject,h++,f=t,R.copy(n.position),G.multiplyVector3(R),f.object=n,f.z=R.z,F.push(f)}m&&F.sort(c);return F};this.projectScene=
-function(f,k,h){var o=k.near,F=k.far,T,R,aa,ja,ca,ka,ga,da,U,$,ha,ma,ua,K,P,na,ra;E=y=x=w=O.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);G.multiply(k.projectionMatrix,k.matrixWorldInverse);Z[0].set(G.n41-G.n11,G.n42-G.n12,G.n43-G.n13,G.n44-G.n14);Z[1].set(G.n41+G.n11,G.n42+G.n12,G.n43+G.n13,G.n44+G.n14);Z[2].set(G.n41+G.n21,G.n42+G.n22,G.n43+G.n23,G.n44+G.n24);Z[3].set(G.n41-G.n21,G.n42-G.n22,G.n43-G.n23,G.n44-G.n24);Z[4].set(G.n41-G.n31,G.n42-G.n32,G.n43-G.n33,G.n44-G.n34);
+function(f,k,h){var o=k.near,F=k.far,T,R,aa,ja,ca,ka,ga,da,U,$,ha,ma,ua,K,P,na,ra;D=y=x=w=O.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);G.multiply(k.projectionMatrix,k.matrixWorldInverse);Z[0].set(G.n41-G.n11,G.n42-G.n12,G.n43-G.n13,G.n44-G.n14);Z[1].set(G.n41+G.n11,G.n42+G.n12,G.n43+G.n13,G.n44+G.n14);Z[2].set(G.n41+G.n21,G.n42+G.n22,G.n43+G.n23,G.n44+G.n24);Z[3].set(G.n41-G.n21,G.n42-G.n22,G.n43-G.n23,G.n44-G.n24);Z[4].set(G.n41-G.n31,G.n42-G.n32,G.n43-G.n33,G.n44-G.n34);
 Z[5].set(G.n41+G.n31,G.n42+G.n32,G.n43+G.n33,G.n44+G.n34);for(T=0;T<6;T++)U=Z[T],U.divideScalar(Math.sqrt(U.x*U.x+U.y*U.y+U.z*U.z));U=this.projectObjects(f,k,!0);f=0;for(T=U.length;f<T;f++)if($=U[f].object,$.visible)if(ha=$.matrixWorld,ma=$.matrixRotationWorld,ua=$.materials,K=$.overdraw,n=0,$ instanceof THREE.Mesh){P=$.geometry;ja=P.vertices;na=P.faces;P=P.faceVertexUvs;R=0;for(aa=ja.length;R<aa;R++)m=b(),m.positionWorld.copy(ja[R].position),ha.multiplyVector3(m.positionWorld),m.positionScreen.copy(m.positionWorld),
 G.multiplyVector4(m.positionScreen),m.positionScreen.x/=m.positionScreen.w,m.positionScreen.y/=m.positionScreen.w,m.visible=m.positionScreen.z>o&&m.positionScreen.z<F;ja=0;for(R=na.length;ja<R;ja++){aa=na[ja];if(aa instanceof THREE.Face3)if(ca=p[aa.a],ka=p[aa.b],ga=p[aa.c],ca.visible&&ka.visible&&ga.visible&&($.doubleSided||$.flipSided!=(ga.positionScreen.x-ca.positionScreen.x)*(ka.positionScreen.y-ca.positionScreen.y)-(ga.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<
 0))da=t[w]=t[w]||new THREE.RenderableFace3,w++,u=da,u.v1.copy(ca),u.v2.copy(ka),u.v3.copy(ga);else continue;else if(aa instanceof THREE.Face4)if(ca=p[aa.a],ka=p[aa.b],ga=p[aa.c],da=p[aa.d],ca.visible&&ka.visible&&ga.visible&&da.visible&&($.doubleSided||$.flipSided!=((da.positionScreen.x-ca.positionScreen.x)*(ka.positionScreen.y-ca.positionScreen.y)-(da.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<0||(ka.positionScreen.x-ga.positionScreen.x)*(da.positionScreen.y-
 ga.positionScreen.y)-(ka.positionScreen.y-ga.positionScreen.y)*(da.positionScreen.x-ga.positionScreen.x)<0)))ra=v[x]=v[x]||new THREE.RenderableFace4,x++,u=ra,u.v1.copy(ca),u.v2.copy(ka),u.v3.copy(ga),u.v4.copy(da);else continue;u.normalWorld.copy(aa.normal);ma.multiplyVector3(u.normalWorld);u.centroidWorld.copy(aa.centroid);ha.multiplyVector3(u.centroidWorld);u.centroidScreen.copy(u.centroidWorld);G.multiplyVector3(u.centroidScreen);ga=aa.vertexNormals;ca=0;for(ka=ga.length;ca<ka;ca++)da=u.vertexNormalsWorld[ca],
 da.copy(ga[ca]),ma.multiplyVector3(da);ca=0;for(ka=P.length;ca<ka;ca++)if(ra=P[ca][ja]){ga=0;for(da=ra.length;ga<da;ga++)u.uvs[ca][ga]=ra[ga]}u.meshMaterials=ua;u.faceMaterials=aa.materials;u.overdraw=K;u.z=u.centroidScreen.z;O.push(u)}}else if($ instanceof THREE.Line){J.multiply(G,ha);ja=$.geometry.vertices;ca=b();ca.positionScreen.copy(ja[0].position);J.multiplyVector4(ca.positionScreen);R=1;for(aa=ja.length;R<aa;R++)if(ca=b(),ca.positionScreen.copy(ja[R].position),J.multiplyVector4(ca.positionScreen),
-ka=p[n-2],I.copy(ca.positionScreen),Q.copy(ka.positionScreen),e(I,Q))I.multiplyScalar(1/I.w),Q.multiplyScalar(1/Q.w),ha=B[y]=B[y]||new THREE.RenderableLine,y++,z=ha,z.v1.positionScreen.copy(I),z.v2.positionScreen.copy(Q),z.z=Math.max(I.z,Q.z),z.materials=$.materials,O.push(z)}else if($ instanceof THREE.Particle&&(L.set($.matrixWorld.n14,$.matrixWorld.n24,$.matrixWorld.n34,1),G.multiplyVector4(L),L.z/=L.w,L.z>0&&L.z<1))ha=D[E]=D[E]||new THREE.RenderableParticle,E++,A=ha,A.x=L.x/L.w,A.y=L.y/L.w,A.z=
+ka=p[n-2],I.copy(ca.positionScreen),Q.copy(ka.positionScreen),e(I,Q))I.multiplyScalar(1/I.w),Q.multiplyScalar(1/Q.w),ha=B[y]=B[y]||new THREE.RenderableLine,y++,z=ha,z.v1.positionScreen.copy(I),z.v2.positionScreen.copy(Q),z.z=Math.max(I.z,Q.z),z.materials=$.materials,O.push(z)}else if($ instanceof THREE.Particle&&(L.set($.matrixWorld.n14,$.matrixWorld.n24,$.matrixWorld.n34,1),G.multiplyVector4(L),L.z/=L.w,L.z>0&&L.z<1))ha=E[D]=E[D]||new THREE.RenderableParticle,D++,A=ha,A.x=L.x/L.w,A.y=L.y/L.w,A.z=
 L.z,A.rotation=$.rotation.z,A.scale.x=$.scale.x*Math.abs(A.x-(L.x+k.projectionMatrix.n11)/(L.w+k.projectionMatrix.n14)),A.scale.y=$.scale.y*Math.abs(A.y-(L.y+k.projectionMatrix.n22)/(L.w+k.projectionMatrix.n24)),A.materials=$.materials,O.push(A);h&&O.sort(c);return O}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),k=Math.cos(e),e=Math.sin(e),m=b*c,n=f*h;this.w=m*k-n*e;this.x=m*e+n*k;this.y=f*c*k+b*h*e;this.z=b*h*k-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
@@ -78,8 +78,8 @@ c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid
 e,f,h,k,m,n=new THREE.Vector3,p=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){k=this.faces[f];if(b&&k.vertexNormals.length){n.set(0,0,0);c=0;for(e=k.vertexNormals.length;c<e;c++)n.addSelf(k.vertexNormals[c]);n.divideScalar(3)}else c=this.vertices[k.a],e=this.vertices[k.b],m=this.vertices[k.c],n.sub(m.position,e.position),p.sub(c.position,e.position),n.crossSelf(p);n.isZero()||n.normalize();k.normal.copy(n)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
 Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof
 THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,k,h,o){n=b.vertices[e].position;p=b.vertices[c].position;u=b.vertices[f].position;w=m[k];t=m[h];x=m[o];v=p.x-n.x;z=u.x-n.x;y=p.y-n.y;B=u.y-n.y;A=p.z-n.z;E=u.z-n.z;D=t.u-w.u;F=x.u-w.u;O=t.v-w.v;R=x.v-w.v;L=1/(D*R-F*O);I.set((R*v-O*z)*L,(R*y-O*B)*L,(R*A-O*E)*L);Q.set((D*z-F*v)*L,(D*B-F*y)*L,(D*E-F*A)*L);J[e].addSelf(I);J[c].addSelf(I);J[f].addSelf(I);Z[e].addSelf(Q);
-Z[c].addSelf(Q);Z[f].addSelf(Q)}var c,e,f,h,k,m,n,p,u,w,t,x,v,z,y,B,A,E,D,F,O,R,L,G,J=[],Z=[],I=new THREE.Vector3,Q=new THREE.Vector3,X=new THREE.Vector3,V=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)J[c]=new THREE.Vector3,Z[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],m=this.faceVertexUvs[0][c],k instanceof THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var o=["a","b",
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,k,h,o){n=b.vertices[e].position;p=b.vertices[c].position;u=b.vertices[f].position;w=m[k];t=m[h];x=m[o];v=p.x-n.x;z=u.x-n.x;y=p.y-n.y;B=u.y-n.y;A=p.z-n.z;D=u.z-n.z;E=t.u-w.u;F=x.u-w.u;O=t.v-w.v;R=x.v-w.v;L=1/(E*R-F*O);I.set((R*v-O*z)*L,(R*y-O*B)*L,(R*A-O*D)*L);Q.set((E*z-F*v)*L,(E*B-F*y)*L,(E*D-F*A)*L);J[e].addSelf(I);J[c].addSelf(I);J[f].addSelf(I);Z[e].addSelf(Q);
+Z[c].addSelf(Q);Z[f].addSelf(Q)}var c,e,f,h,k,m,n,p,u,w,t,x,v,z,y,B,A,D,E,F,O,R,L,G,J=[],Z=[],I=new THREE.Vector3,Q=new THREE.Vector3,X=new THREE.Vector3,V=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)J[c]=new THREE.Vector3,Z[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],m=this.faceVertexUvs[0][c],k instanceof THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var o=["a","b",
 "c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)W.copy(k.vertexNormals[f]),h=k[o[f]],G=J[h],X.copy(G),X.subSelf(W.multiplyScalar(W.dot(G))).normalize(),V.cross(k.vertexNormals[f],G),h=V.dot(Z[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(X.x,X.y,X.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},mergeVertices:function(){var b={},c=[],e=[],f,h=Math.pow(10,4),k,m;k=0;for(m=this.vertices.length;k<m;k++)f=this.vertices[k].position,f=[Math.round(f.x*h),Math.round(f.y*h),Math.round(f.z*h)].join("_"),b[f]===void 0?(b[f]=k,c.push(this.vertices[k]),
@@ -146,10 +146,10 @@ THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light
 THREE.Scene.prototype.addChild=function(b){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addObject=function(b){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addLight=function(b){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(b)};THREE.Scene.prototype.removeChild=function(b){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(b)};
 THREE.Scene.prototype.removeObject=function(b){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(b)};THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;k=f/2};this.render=function(e,f){var p,u,w,t,x,v,z,y;b=c.projectScene(e,f);p=0;for(u=b.length;p<u;p++)if(x=b[p],x instanceof THREE.RenderableParticle){z=x.x*h+h;y=x.y*k+k;w=0;for(t=x.material.length;w<t;w++)if(v=x.material[w],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=z+"px",v.style.top=y+"px"}}};
-THREE.CanvasRenderer=function(b){function c(b){if(B!=b)v.globalAlpha=B=b}function e(b){if(A!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}A=b}}function f(b){if(E!=b)v.strokeStyle=E=b}function h(b){if(D!=b)v.fillStyle=D=b}var k=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-u,w,t,x,v=p.getContext("2d"),z=new THREE.Color(0),y=0,B=1,A=0,E=null,D=null,F=null,O=null,R=null,L,G,J,Z,I=new THREE.RenderableVertex,Q=new THREE.RenderableVertex,X,V,W,o,fa,T,oa,aa,ja,ca,ka,ga,da=new THREE.Color(0),U=new THREE.Color(0),$=new THREE.Color(0),ha=new THREE.Color(0),ma=new THREE.Color(0),ua=[],K,P,na,ra,va,Ca,Ea,za,Ba,Ga,M=new THREE.Rectangle,ea=new THREE.Rectangle,N=new THREE.Rectangle,la=!1,pa=new THREE.Color,ia=new THREE.Color,sa=new THREE.Color,wa=new THREE.Color,qa=new THREE.Vector3,
+THREE.CanvasRenderer=function(b){function c(b){if(B!=b)v.globalAlpha=B=b}function e(b){if(A!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}A=b}}function f(b){if(D!=b)v.strokeStyle=D=b}function h(b){if(E!=b)v.fillStyle=E=b}var k=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
+u,w,t,x,v=p.getContext("2d"),z=new THREE.Color(0),y=0,B=1,A=0,D=null,E=null,F=null,O=null,R=null,L,G,J,Z,I=new THREE.RenderableVertex,Q=new THREE.RenderableVertex,X,V,W,o,fa,T,oa,aa,ja,ca,ka,ga,da=new THREE.Color(0),U=new THREE.Color(0),$=new THREE.Color(0),ha=new THREE.Color(0),ma=new THREE.Color(0),ua=[],K,P,na,ra,va,Ca,Ea,za,Ba,Ga,M=new THREE.Rectangle,ea=new THREE.Rectangle,N=new THREE.Rectangle,la=!1,pa=new THREE.Color,ia=new THREE.Color,sa=new THREE.Color,wa=new THREE.Color,qa=new THREE.Vector3,
 xa,Da,Ka,Aa,Ha,Y,b=16;xa=document.createElement("canvas");xa.width=xa.height=2;Da=xa.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Ka=Da.getImageData(0,0,2,2);Aa=Ka.data;Ha=document.createElement("canvas");Ha.width=Ha.height=b;Y=Ha.getContext("2d");Y.translate(-b/2,-b/2);Y.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,e){u=b;w=e;t=Math.floor(u/2);x=Math.floor(w/2);p.width=u;
-p.height=w;M.set(-t,-x,t,x);ea.set(-t,-x,t,x);B=1;A=0;R=O=F=D=E=null};this.setClearColor=function(b,e){z.copy(b);y=e;ea.set(-t,-x,t,x)};this.setClearColorHex=function(b,e){z.setHex(b);y=e;ea.set(-t,-x,t,x)};this.clear=function(){v.setTransform(1,0,0,-1,t,x);ea.isEmpty()||(ea.minSelf(M),ea.inflate(2),y<1&&v.clearRect(Math.floor(ea.getX()),Math.floor(ea.getY()),Math.floor(ea.getWidth()),Math.floor(ea.getHeight())),y>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+
+p.height=w;M.set(-t,-x,t,x);ea.set(-t,-x,t,x);B=1;A=0;R=O=F=E=D=null};this.setClearColor=function(b,e){z.copy(b);y=e;ea.set(-t,-x,t,x)};this.setClearColorHex=function(b,e){z.setHex(b);y=e;ea.set(-t,-x,t,x)};this.clear=function(){v.setTransform(1,0,0,-1,t,x);ea.isEmpty()||(ea.minSelf(M),ea.inflate(2),y<1&&v.clearRect(Math.floor(ea.getX()),Math.floor(ea.getY()),Math.floor(ea.getWidth()),Math.floor(ea.getHeight())),y>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+
 ","+Math.floor(z.b*255)+","+y+")"),v.fillRect(Math.floor(ea.getX()),Math.floor(ea.getY()),Math.floor(ea.getWidth()),Math.floor(ea.getHeight()))),ea.empty())};this.render=function(b,u){function p(b){var e,c,f,k=b.lights;ia.setRGB(0,0,0);sa.setRGB(0,0,0);wa.setRGB(0,0,0);b=0;for(e=k.length;b<e;b++)c=k[b],f=c.color,c instanceof THREE.AmbientLight?(ia.r+=f.r,ia.g+=f.g,ia.b+=f.b):c instanceof THREE.DirectionalLight?(sa.r+=f.r,sa.g+=f.g,sa.b+=f.b):c instanceof THREE.PointLight&&(wa.r+=f.r,wa.g+=f.g,wa.b+=
 f.b)}function w(b,e,c,f){var k,h,m,o,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],m=h.color,h instanceof THREE.DirectionalLight?(o=c.dot(h.position),o<=0||(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)):h instanceof THREE.PointLight&&(o=c.dot(qa.sub(h.position,e).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(e.distanceTo(h.position)/h.distance,1),o!=0&&(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)))}function y(b,k,m){c(m.opacity);e(m.blending);var o,n,u,p,Fa,w;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)p=
 m.map.image,Fa=p.width>>1,w=p.height>>1,m=k.scale.x*t,u=k.scale.y*x,o=m*Fa,n=u*w,N.set(b.x-o,b.y-n,b.x+o,b.y+n),M.intersects(N)&&(v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(m,-u),v.translate(-Fa,-w),v.drawImage(p,0,0),v.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*t,n=k.scale.y*x,N.set(b.x-o,b.y-n,b.x+o,b.y+n),M.intersects(N)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(o,n),m.program(v),
@@ -176,18 +176,18 @@ THREE.RenderableFace4&&(L=ta.v1,G=ta.v2,J=ta.v3,Z=ta.v4,L.positionScreen.x*=t,L.
 N.addPoint(L.positionScreen.x,L.positionScreen.y),N.addPoint(G.positionScreen.x,G.positionScreen.y),N.addPoint(J.positionScreen.x,J.positionScreen.y),N.addPoint(Z.positionScreen.x,Z.positionScreen.y),M.intersects(N))){Ia=0;for(Qa=ta.meshMaterials.length;Ia<Qa;)if(ya=ta.meshMaterials[Ia++],ya instanceof THREE.MeshFaceMaterial){Xa=0;for($a=ta.faceMaterials.length;Xa<$a;)(ya=ta.faceMaterials[Xa++])&&ya.opacity!=0&&A(L,G,J,Z,I,Q,ta,ya,b)}else ya.opacity!=0&&A(L,G,J,Z,I,Q,ta,ya,b)}ea.addRectangle(N)}v.setTransform(1,
 0,0,1,0,0)}};
 THREE.SVGRenderer=function(){function b(b,e,c){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=e.normalWorld.dot(h.position)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(Z.sub(h.position,e.centroidWorld),Z.normalize(),m=e.normalWorld.dot(Z)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,m,o,n,t){k.info.render.vertices+=3;k.info.render.faces++;X=f(V++);
-X.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?F.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(O.r=R.r,O.g=R.g,O.b=R.b,b(t,o,O),F.r=Math.max(0,Math.min(n.color.r*O.r,1)),F.g=Math.max(0,Math.min(n.color.g*O.g,1)),F.b=Math.max(0,Math.min(n.color.b*O.b,1))):F.copy(n.color):n instanceof THREE.MeshDepthMaterial?(J=1-n.__2near/(n.__farPlusNear-
+X.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?F.copy(n.color):n instanceof THREE.MeshLambertMaterial?E?(O.r=R.r,O.g=R.g,O.b=R.b,b(t,o,O),F.r=Math.max(0,Math.min(n.color.r*O.r,1)),F.g=Math.max(0,Math.min(n.color.g*O.g,1)),F.b=Math.max(0,Math.min(n.color.b*O.b,1))):F.copy(n.color):n instanceof THREE.MeshDepthMaterial?(J=1-n.__2near/(n.__farPlusNear-
 o.z*n.__farMinusNear),F.setRGB(J,J,J)):n instanceof THREE.MeshNormalMaterial&&F.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?X.setAttribute("style","fill: none; stroke: "+F.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):X.setAttribute("style","fill: "+F.getContextStyle()+"; fill-opacity: "+n.opacity);p.appendChild(X)}function e(e,c,m,o,n,t,v){k.info.render.vertices+=
-4;k.info.render.faces++;X=f(V++);X.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?F.copy(t.color):t instanceof THREE.MeshLambertMaterial?D?(O.r=R.r,O.g=R.g,O.b=R.b,b(v,n,O),F.r=Math.max(0,Math.min(t.color.r*O.r,1)),F.g=Math.max(0,Math.min(t.color.g*O.g,1)),F.b=Math.max(0,Math.min(t.color.b*O.b,1))):
+4;k.info.render.faces++;X=f(V++);X.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?F.copy(t.color):t instanceof THREE.MeshLambertMaterial?E?(O.r=R.r,O.g=R.g,O.b=R.b,b(v,n,O),F.r=Math.max(0,Math.min(t.color.r*O.r,1)),F.g=Math.max(0,Math.min(t.color.g*O.g,1)),F.b=Math.max(0,Math.min(t.color.b*O.b,1))):
 F.copy(t.color):t instanceof THREE.MeshDepthMaterial?(J=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),F.setRGB(J,J,J)):t instanceof THREE.MeshNormalMaterial&&F.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));t.wireframe?X.setAttribute("style","fill: none; stroke: "+F.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):X.setAttribute("style","fill: "+F.getContextStyle()+
-"; fill-opacity: "+t.opacity);p.appendChild(X)}function f(b){I[b]==null&&(I[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&I[b].setAttribute("shape-rendering","crispEdges"));return I[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,w,t,x,v,z,y,B,A=new THREE.Rectangle,E=new THREE.Rectangle,D=!1,F=new THREE.Color(16777215),O=new THREE.Color(16777215),R=new THREE.Color(0),
+"; fill-opacity: "+t.opacity);p.appendChild(X)}function f(b){I[b]==null&&(I[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&I[b].setAttribute("shape-rendering","crispEdges"));return I[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,w,t,x,v,z,y,B,A=new THREE.Rectangle,D=new THREE.Rectangle,E=!1,F=new THREE.Color(16777215),O=new THREE.Color(16777215),R=new THREE.Color(0),
 L=new THREE.Color(0),G=new THREE.Color(0),J,Z=new THREE.Vector3,I=[],Q=[],X,V,W,o=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){u=b;w=e;t=u/2;x=w/2;p.setAttribute("viewBox",-t+" "+-x+" "+u+" "+w);p.setAttribute("width",u);p.setAttribute("height",w);A.set(-t,-x,t,x)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};
-this.render=function(b,f){var h,u,w,F,I,O,J,U;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);W=V=0;if(D=b.lights.length>0){J=b.lights;R.setRGB(0,0,0);L.setRGB(0,0,0);G.setRGB(0,0,0);h=0;for(u=J.length;h<u;h++)w=J[h],F=w.color,w instanceof THREE.AmbientLight?(R.r+=F.r,R.g+=F.g,R.b+=F.b):w instanceof THREE.DirectionalLight?(L.r+=F.r,L.g+=F.g,L.b+=F.b):w instanceof THREE.PointLight&&(G.r+=F.r,G.g+=F.g,G.b+=F.b)}h=0;for(u=m.length;h<
-u;h++)if(J=m[h],E.empty(),J instanceof THREE.RenderableParticle){v=J;v.x*=t;v.y*=-x;w=0;for(F=J.materials.length;w<F;)w++}else if(J instanceof THREE.RenderableLine){if(v=J.v1,z=J.v2,v.positionScreen.x*=t,v.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,E.addPoint(v.positionScreen.x,v.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),A.intersects(E)){w=0;for(F=J.materials.length;w<F;)if((U=J.materials[w++])&&U.opacity!=0){I=v;O=z;var $=W++;Q[$]==null&&(Q[$]=document.createElementNS("http://www.w3.org/2000/svg",
+this.render=function(b,f){var h,u,w,F,I,O,J,U;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);W=V=0;if(E=b.lights.length>0){J=b.lights;R.setRGB(0,0,0);L.setRGB(0,0,0);G.setRGB(0,0,0);h=0;for(u=J.length;h<u;h++)w=J[h],F=w.color,w instanceof THREE.AmbientLight?(R.r+=F.r,R.g+=F.g,R.b+=F.b):w instanceof THREE.DirectionalLight?(L.r+=F.r,L.g+=F.g,L.b+=F.b):w instanceof THREE.PointLight&&(G.r+=F.r,G.g+=F.g,G.b+=F.b)}h=0;for(u=m.length;h<
+u;h++)if(J=m[h],D.empty(),J instanceof THREE.RenderableParticle){v=J;v.x*=t;v.y*=-x;w=0;for(F=J.materials.length;w<F;)w++}else if(J instanceof THREE.RenderableLine){if(v=J.v1,z=J.v2,v.positionScreen.x*=t,v.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,D.addPoint(v.positionScreen.x,v.positionScreen.y),D.addPoint(z.positionScreen.x,z.positionScreen.y),A.intersects(D)){w=0;for(F=J.materials.length;w<F;)if((U=J.materials[w++])&&U.opacity!=0){I=v;O=z;var $=W++;Q[$]==null&&(Q[$]=document.createElementNS("http://www.w3.org/2000/svg",
 "line"),o==0&&Q[$].setAttribute("shape-rendering","crispEdges"));X=Q[$];X.setAttribute("x1",I.positionScreen.x);X.setAttribute("y1",I.positionScreen.y);X.setAttribute("x2",O.positionScreen.x);X.setAttribute("y2",O.positionScreen.y);U instanceof THREE.LineBasicMaterial&&(X.setAttribute("style","fill: none; stroke: "+U.color.getContextStyle()+"; stroke-width: "+U.linewidth+"; stroke-opacity: "+U.opacity+"; stroke-linecap: "+U.linecap+"; stroke-linejoin: "+U.linejoin),p.appendChild(X))}}}else if(J instanceof
-THREE.RenderableFace3){if(v=J.v1,z=J.v2,y=J.v3,v.positionScreen.x*=t,v.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,E.addPoint(v.positionScreen.x,v.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),A.intersects(E)){w=0;for(F=J.meshMaterials.length;w<F;)if(U=J.meshMaterials[w++],U instanceof THREE.MeshFaceMaterial){I=0;for(O=J.faceMaterials.length;I<O;)(U=J.faceMaterials[I++])&&
-U.opacity!=0&&c(v,z,y,J,U,b)}else U&&U.opacity!=0&&c(v,z,y,J,U,b)}}else if(J instanceof THREE.RenderableFace4&&(v=J.v1,z=J.v2,y=J.v3,B=J.v4,v.positionScreen.x*=t,v.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,B.positionScreen.x*=t,B.positionScreen.y*=-x,E.addPoint(v.positionScreen.x,v.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(B.positionScreen.x,B.positionScreen.y),
-A.intersects(E))){w=0;for(F=J.meshMaterials.length;w<F;)if(U=J.meshMaterials[w++],U instanceof THREE.MeshFaceMaterial){I=0;for(O=J.faceMaterials.length;I<O;)(U=J.faceMaterials[I++])&&U.opacity!=0&&e(v,z,y,B,J,U,b)}else U&&U.opacity!=0&&e(v,z,y,B,J,U,b)}}};
+THREE.RenderableFace3){if(v=J.v1,z=J.v2,y=J.v3,v.positionScreen.x*=t,v.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,D.addPoint(v.positionScreen.x,v.positionScreen.y),D.addPoint(z.positionScreen.x,z.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),A.intersects(D)){w=0;for(F=J.meshMaterials.length;w<F;)if(U=J.meshMaterials[w++],U instanceof THREE.MeshFaceMaterial){I=0;for(O=J.faceMaterials.length;I<O;)(U=J.faceMaterials[I++])&&
+U.opacity!=0&&c(v,z,y,J,U,b)}else U&&U.opacity!=0&&c(v,z,y,J,U,b)}}else if(J instanceof THREE.RenderableFace4&&(v=J.v1,z=J.v2,y=J.v3,B=J.v4,v.positionScreen.x*=t,v.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,B.positionScreen.x*=t,B.positionScreen.y*=-x,D.addPoint(v.positionScreen.x,v.positionScreen.y),D.addPoint(z.positionScreen.x,z.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),D.addPoint(B.positionScreen.x,B.positionScreen.y),
+A.intersects(D))){w=0;for(F=J.meshMaterials.length;w<F;)if(U=J.meshMaterials[w++],U instanceof THREE.MeshFaceMaterial){I=0;for(O=J.faceMaterials.length;I<O;)(U=J.faceMaterials[I++])&&U.opacity!=0&&e(v,z,y,B,J,U,b)}else U&&U.opacity!=0&&e(v,z,y,B,J,U,b)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
@@ -254,7 +254,7 @@ n,t=[],p=na*0.5,v=ra*0.5,u=!0;o.useProgram(Y.program);T=Y.program;ja=U=da=-1;Ja|
 o.uniform1i(h.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)if(k=b.__webglSprites[c],k.visible&&k.opacity!=0)k.useScreenCoordinates?k.z=-k.position.z:(k._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray),k.z=-k._modelViewMatrix.n34);b.__webglSprites.sort(z);c=0;for(f=b.__webglSprites.length;c<f;c++)k=b.__webglSprites[c],k.visible&&k.opacity!=0&&k.map&&k.map.image&&k.map.image.width&&(k.useScreenCoordinates?(o.uniform1i(h.useScreenCoordinates,1),o.uniform3f(h.screenPosition,
 (k.position.x-p)/p,(v-k.position.y)/v,Math.max(0,Math.min(1,k.position.z)))):(o.uniform1i(h.useScreenCoordinates,0),o.uniform1i(h.affectedByDistance,k.affectedByDistance?1:0),o.uniformMatrix4fv(h.modelViewMatrix,!1,k._modelViewMatrixArray)),n=k.map.image.width/(k.scaleByViewport?ra:1),t[0]=n*m*k.scale.x,t[1]=n*k.scale.y,o.uniform2f(h.uvScale,k.uvScale.x,k.uvScale.y),o.uniform2f(h.uvOffset,k.uvOffset.x,k.uvOffset.y),o.uniform2f(h.alignment,k.alignment.x,k.alignment.y),o.uniform1f(h.opacity,k.opacity),
 o.uniform3f(h.color,k.color.r,k.color.g,k.color.b),o.uniform1f(h.rotation,k.rotation),o.uniform2fv(h.scale,t),k.mergeWith3D&&!u?(o.enable(o.DEPTH_TEST),u=!0):!k.mergeWith3D&&u&&(o.disable(o.DEPTH_TEST),u=!1),L(k.blending),J(k.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask($)}function A(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
-function E(b){var e,c,f,k;k=b.__materials;b=0;for(c=k.length;b<c;b++)if(f=k[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function D(b){var e,c,f,k;k=b.__materials;b=0;for(c=k.length;b<c;b++)if(f=k[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function F(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function O(b){function e(b){var k=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?k.push("undefined"):k.push(b[c].id);return k.join("_")}
+function D(b){var e,c,f,k;k=b.__materials;b=0;for(c=k.length;b<c;b++)if(f=k[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function E(b){var e,c,f,k;k=b.__materials;b=0;for(c=k.length;b<c;b++)if(f=k[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function F(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function O(b){function e(b){var k=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?k.push("undefined"):k.push(b[c].id);return k.join("_")}
 var c,f,k,h,m,n,o,t,p={},v=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};k=0;for(h=b.faces.length;k<h;k++)m=b.faces[k],n=m.materials,o=e(n),p[o]==void 0&&(p[o]={hash:o,counter:0}),t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:v}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[t].vertices+m>65535&&(p[o].counter+=1,t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],
 materials:n,vertices:0,numMorphTargets:v})),b.geometryGroups[t].faces.push(k),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroups[u].id=ca++,b.geometryGroupsList.push(b.geometryGroups[u])}function R(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(b){if(b!=da){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);
 o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}da=b}}function G(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,V(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,V(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,V(e.magFilter)),
@@ -309,7 +309,7 @@ m.__webglColorBuffer=o.createBuffer();W.info.geometries++;m=h;n=e;t=m.vertices.l
 originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(t*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=
 !0;h.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(k in h=e.geometry,h.geometryGroups)m=h.geometryGroups[k],R(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(h=e.geometry,R(f.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);
 e.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];f=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)F(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;k=e;h=void 0;for(h=f.length-1;h>=0;h--)f[h]==k&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&F(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,
-1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(h=b.__webglObjects[e].object,p=m=k=void 0,h instanceof THREE.Mesh){k=h.geometry;n=0;for(t=k.geometryGroupsList.length;n<t;n++)if(m=k.geometryGroupsList[n],p=E(m),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||p)if(p=m,y=o.DYNAMIC_DRAW,N=!k.dynamic,p.__inittedArrays){var ea=v=w=void 0,K=void 0,G=ea=void 0,J=void 0,L=void 0,la=void 0,ia=A=B=x=z=M=u=void 0,I=void 0,pa=void 0,
+1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(h=b.__webglObjects[e].object,p=m=k=void 0,h instanceof THREE.Mesh){k=h.geometry;n=0;for(t=k.geometryGroupsList.length;n<t;n++)if(m=k.geometryGroupsList[n],p=D(m),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||p)if(p=m,y=o.DYNAMIC_DRAW,N=!k.dynamic,p.__inittedArrays){var ea=v=w=void 0,K=void 0,G=ea=void 0,J=void 0,L=void 0,la=void 0,ia=A=B=x=z=M=u=void 0,I=void 0,pa=void 0,
 H=K=la=K=L=J=void 0,C=void 0,P=C=H=J=void 0,Q=void 0,$=P=C=H=ea=ea=G=la=K=P=C=H=Q=P=C=H=Q=P=C=H=void 0,na=0,U=0,X=0,ra=0,T=0,Z=0,sa=0,Y=0,qa=0,S=0,V=0,P=H=0,P=void 0,ha=p.__vertexArray,wa=p.__uvArray,va=p.__uv2Array,ma=p.__normalArray,ja=p.__tangentArray,da=p.__colorArray,ca=p.__skinVertexAArray,aa=p.__skinVertexBArray,fa=p.__skinIndexArray,ga=p.__skinWeightArray,Da=p.__morphTargetsArrays,ka=p.__webglCustomAttributes,C=void 0,ua=p.__faceArray,xa=p.__lineArray,Ca=p.__needsSmoothNormals,M=p.__vertexColorType,
 u=p.__uvType,z=p.__normalType,oa=h.geometry,Ea=oa.__dirtyVertices,Aa=oa.__dirtyElements,za=oa.__dirtyUvs,Ha=oa.__dirtyNormals,Ka=oa.__dirtyTangents,Ba=oa.__dirtyColors,Ga=oa.__dirtyMorphTargets,Ja=oa.vertices,cb=p.faces,fb=oa.faces,db=oa.faceVertexUvs[0],eb=oa.faceVertexUvs[1],Sa=oa.skinVerticesA,Ta=oa.skinVerticesB,Ua=oa.skinIndices,Ma=oa.skinWeights,La=oa.morphTargets;if(ka)for($ in ka)ka[$].offset=0,ka[$].offsetSrc=0;w=0;for(v=cb.length;w<v;w++)if(ea=cb[w],K=fb[ea],db&&(x=db[ea]),eb&&(B=eb[ea]),
 ea=K.vertexNormals,G=K.normal,J=K.vertexColors,L=K.color,la=K.vertexTangents,K instanceof THREE.Face3){if(Ea)A=Ja[K.a].position,ia=Ja[K.b].position,I=Ja[K.c].position,ha[U]=A.x,ha[U+1]=A.y,ha[U+2]=A.z,ha[U+3]=ia.x,ha[U+4]=ia.y,ha[U+5]=ia.z,ha[U+6]=I.x,ha[U+7]=I.y,ha[U+8]=I.z,U+=9;if(ka)for($ in ka)if(C=ka[$],C.__original.needsUpdate)H=C.offset,P=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[H]=C.value[K.a],C.array[H+1]=C.value[K.b],C.array[H+2]=C.value[K.c]):C.boundTo===
@@ -330,10 +330,10 @@ ja[sa+6]=L.z,ja[sa+7]=L.w,ja[sa+8]=K.x,ja[sa+9]=K.y,ja[sa+10]=K.z,ja[sa+11]=K.w,
 3,ua[T+3]=na+1,ua[T+4]=na+2,ua[T+5]=na+3,T+=6,xa[Y]=na,xa[Y+1]=na+1,xa[Y+2]=na,xa[Y+3]=na+3,xa[Y+4]=na+1,xa[Y+5]=na+2,xa[Y+6]=na+2,xa[Y+7]=na+3,Y+=8,na+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,ha,y));if(ka)for($ in ka)C=ka[$],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,y));if(Ga){H=0;for(C=La.length;H<C;H++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[H]),o.bufferData(o.ARRAY_BUFFER,
 Da[H],y)}Ba&&qa>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,da,y));Ha&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ma,y));Ka&&oa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ja,y));za&&X>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,y));za&&ra>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,va,y));Aa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,
 p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ua,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,xa,y));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,ca,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,aa,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,fa,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
-ga,y));N&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;D(m)}else if(h instanceof THREE.Ribbon){k=
+ga,y));N&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;E(m)}else if(h instanceof THREE.Ribbon){k=
 h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=w=N=N=void 0;v=h.vertices;t=h.colors;u=v.length;p=t.length;M=h.__vertexArray;y=h.__colorArray;z=h.__dirtyColors;if(h.__dirtyVertices){for(N=0;N<u;N++)w=v[N].position,n=N*3,M[n]=w.x,M[n+1]=w.y,M[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,M,m)}if(z){for(N=0;N<p;N++)color=t[N],n=N*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,
 y,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=w=N=N=void 0;v=h.vertices;t=h.colors;u=v.length;p=t.length;M=h.__vertexArray;y=h.__colorArray;z=h.__dirtyColors;if(h.__dirtyVertices){for(N=0;N<u;N++)w=v[N].position,n=N*3,M[n]=w.x,M[n+1]=w.y,M[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,M,m)}if(z){for(N=0;N<p;N++)color=t[N],n=N*3,y[n]=color.r,y[n+1]=color.g,
-y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)k=h.geometry,p=E(k),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||p)&&c(k,o.DYNAMIC_DRAW,h),k.__dirtyVertices=!1,k.__dirtyColors=!1,D(k)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),
+y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)k=h.geometry,p=D(k),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||p)&&c(k,o.DYNAMIC_DRAW,h),k.__dirtyVertices=!1,k.__dirtyColors=!1,E(k)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),
 o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Ha}};
 THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
@@ -344,18 +344,18 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
 THREE.ColorUtils={adjustHSV:function(b,c,e,f){var h=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,h);h.h=THREE.ColorUtils.clamp(h.h+c,0,1);h.s=THREE.ColorUtils.clamp(h.s+e,0,1);h.v=THREE.ColorUtils.clamp(h.v+f,0,1);b.setHSV(h.h,h.s,h.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,h=b.b,k=Math.max(Math.max(e,f),h),m=Math.min(Math.min(e,f),h);if(m==k)m=e=0;else{var n=k-m,m=n/k,e=e==k?(f-h)/n:f==k?2+(h-e)/n:4+(e-f)/n;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=m;c.v=k;return c},
 clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(b,c){var e,f,h=b.vertices.length,k=c instanceof THREE.Mesh?c.geometry:c,m=b.vertices,n=k.vertices,p=b.faces,u=k.faces,w=b.faceVertexUvs[0],k=k.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),e=c.matrix,f=new THREE.Matrix4,f.extractRotation(e,c.scale);for(var t=0,x=n.length;t<x;t++){var v=new THREE.Vertex(n[t].position.clone());e&&e.multiplyVector3(v.position);m.push(v)}t=0;for(x=u.length;t<x;t++){var v=u[t],z,y,B=v.vertexNormals,
-A=v.vertexColors;v instanceof THREE.Face3?z=new THREE.Face3(v.a+h,v.b+h,v.c+h):v instanceof THREE.Face4&&(z=new THREE.Face4(v.a+h,v.b+h,v.c+h,v.d+h));z.normal.copy(v.normal);f&&f.multiplyVector3(z.normal);m=0;for(n=B.length;m<n;m++)y=B[m].clone(),f&&f.multiplyVector3(y),z.vertexNormals.push(y);z.color.copy(v.color);m=0;for(n=A.length;m<n;m++)y=A[m],z.vertexColors.push(y.clone());z.materials=v.materials.slice();z.centroid.copy(v.centroid);e&&e.multiplyVector3(z.centroid);p.push(z)}t=0;for(x=k.length;t<
-x;t++){e=k[t];f=[];m=0;for(n=e.length;m<n;m++)f.push(new THREE.UV(e[m].u,e[m].v));w.push(f)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,k=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var m=new THREE.Vertex(f[b].position.clone());c.vertices.push(m)}b=0;for(e=h.length;b<e;b++){var n=h[b],p,u,w=n.vertexNormals,t=n.vertexColors;n instanceof THREE.Face3?p=new THREE.Face3(n.a,n.b,n.c):n instanceof THREE.Face4&&(p=new THREE.Face4(n.a,n.b,n.c,n.d));p.normal.copy(n.normal);f=0;
-for(m=w.length;f<m;f++)u=w[f],p.vertexNormals.push(u.clone());p.color.copy(n.color);f=0;for(m=t.length;f<m;f++)u=t[f],p.vertexColors.push(u.clone());p.materials=n.materials.slice();p.centroid.copy(n.centroid);c.faces.push(p)}b=0;for(e=k.length;b<e;b++){h=k[b];p=[];f=0;for(m=h.length;f<m;f++)p.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(p)}return c},randomPointInTriangle:function(b,c,e){var f,h,k,m=new THREE.Vector3,n=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();h=THREE.GeometryUtils.random();
-f+h>1&&(f=1-f,h=1-h);k=1-f-h;m.copy(b);m.multiplyScalar(f);n.copy(c);n.multiplyScalar(h);m.addSelf(n);n.copy(e);n.multiplyScalar(k);m.addSelf(n);return m},randomPointInFace:function(b,c,e){var f,h,k;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,k=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,k);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;k=c.vertices[b.c].position;var c=c.vertices[b.d].position,
-m;e?b._area1&&b._area2?(e=b._area1,m=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c),b._area1=e,b._area2=m):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c));return THREE.GeometryUtils.random()*(e+m)<e?THREE.GeometryUtils.randomPointInTriangle(f,h,c):THREE.GeometryUtils.randomPointInTriangle(h,k,c)}},randomPointsInGeometry:function(b,c){function e(b){function e(c,f){if(f<c)return c;var k=c+Math.floor((f-c)/2);return u[k]>
-b?e(c,k-1):u[k]<b?e(k+1,f):k}return e(0,u.length-1)}var f,h,k=b.faces,m=b.vertices,n=k.length,p=0,u=[],w,t,x,v;for(h=0;h<n;h++){f=k[h];if(f instanceof THREE.Face3)w=m[f.a].position,t=m[f.b].position,x=m[f.c].position,f._area=THREE.GeometryUtils.triangleArea(w,t,x);else if(f instanceof THREE.Face4)w=m[f.a].position,t=m[f.b].position,x=m[f.c].position,v=m[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(w,t,v),f._area2=THREE.GeometryUtils.triangleArea(t,x,v),f._area=f._area1+f._area2;p+=f._area;
-u[h]=p}f=[];m={};for(h=0;h<c;h++)n=THREE.GeometryUtils.random()*p,n=e(n),f[h]=THREE.GeometryUtils.randomPointInFace(k[n],b,!0),m[n]?m[n]+=1:m[n]=1;return f},triangleArea:function(b,c,e){var f,h=THREE.GeometryUtils.__v1;h.sub(b,c);f=h.length();h.sub(b,e);b=h.length();h.sub(c,e);e=h.length();c=0.5*(f+b+e);return Math.sqrt(c*(c-f)*(c-b)*(c-e))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},center:function(b){b.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*
-(b.boundingBox.x[1]+b.boundingBox.x[0]),-0.5*(b.boundingBox.y[1]+b.boundingBox.y[0]),-0.5*(b.boundingBox.z[1]+b.boundingBox.z[0]));b.applyMatrix(c);b.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+THREE.GeometryUtils={createSubdivision:function(b,c){for(var c=c===void 0?1:c,e=b;c--;)e=new THREE.SubdivisionGeometry(e);return e},merge:function(b,c){var e,f,h=b.vertices.length,k=c instanceof THREE.Mesh?c.geometry:c,m=b.vertices,n=k.vertices,p=b.faces,u=k.faces,w=b.faceVertexUvs[0],k=k.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),e=c.matrix,f=new THREE.Matrix4,f.extractRotation(e,c.scale);for(var t=0,x=n.length;t<x;t++){var v=new THREE.Vertex(n[t].position.clone());
+e&&e.multiplyVector3(v.position);m.push(v)}t=0;for(x=u.length;t<x;t++){var v=u[t],z,y,B=v.vertexNormals,A=v.vertexColors;v instanceof THREE.Face3?z=new THREE.Face3(v.a+h,v.b+h,v.c+h):v instanceof THREE.Face4&&(z=new THREE.Face4(v.a+h,v.b+h,v.c+h,v.d+h));z.normal.copy(v.normal);f&&f.multiplyVector3(z.normal);m=0;for(n=B.length;m<n;m++)y=B[m].clone(),f&&f.multiplyVector3(y),z.vertexNormals.push(y);z.color.copy(v.color);m=0;for(n=A.length;m<n;m++)y=A[m],z.vertexColors.push(y.clone());z.materials=v.materials.slice();
+z.centroid.copy(v.centroid);e&&e.multiplyVector3(z.centroid);p.push(z)}t=0;for(x=k.length;t<x;t++){e=k[t];f=[];m=0;for(n=e.length;m<n;m++)f.push(new THREE.UV(e[m].u,e[m].v));w.push(f)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,k=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var m=new THREE.Vertex(f[b].position.clone());c.vertices.push(m)}b=0;for(e=h.length;b<e;b++){var n=h[b],p,u,w=n.vertexNormals,t=n.vertexColors;n instanceof THREE.Face3?p=new THREE.Face3(n.a,n.b,n.c):
+n instanceof THREE.Face4&&(p=new THREE.Face4(n.a,n.b,n.c,n.d));p.normal.copy(n.normal);f=0;for(m=w.length;f<m;f++)u=w[f],p.vertexNormals.push(u.clone());p.color.copy(n.color);f=0;for(m=t.length;f<m;f++)u=t[f],p.vertexColors.push(u.clone());p.materials=n.materials.slice();p.centroid.copy(n.centroid);c.faces.push(p)}b=0;for(e=k.length;b<e;b++){h=k[b];p=[];f=0;for(m=h.length;f<m;f++)p.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(p)}return c},randomPointInTriangle:function(b,c,e){var f,h,
+k,m=new THREE.Vector3,n=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();h=THREE.GeometryUtils.random();f+h>1&&(f=1-f,h=1-h);k=1-f-h;m.copy(b);m.multiplyScalar(f);n.copy(c);n.multiplyScalar(h);m.addSelf(n);n.copy(e);n.multiplyScalar(k);m.addSelf(n);return m},randomPointInFace:function(b,c,e){var f,h,k;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,k=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,k);else if(b instanceof THREE.Face4){f=
+c.vertices[b.a].position;h=c.vertices[b.b].position;k=c.vertices[b.c].position;var c=c.vertices[b.d].position,m;e?b._area1&&b._area2?(e=b._area1,m=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c),b._area1=e,b._area2=m):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c));return THREE.GeometryUtils.random()*(e+m)<e?THREE.GeometryUtils.randomPointInTriangle(f,h,c):THREE.GeometryUtils.randomPointInTriangle(h,k,c)}},randomPointsInGeometry:function(b,
+c){function e(b){function e(c,f){if(f<c)return c;var k=c+Math.floor((f-c)/2);return u[k]>b?e(c,k-1):u[k]<b?e(k+1,f):k}return e(0,u.length-1)}var f,h,k=b.faces,m=b.vertices,n=k.length,p=0,u=[],w,t,x,v;for(h=0;h<n;h++){f=k[h];if(f instanceof THREE.Face3)w=m[f.a].position,t=m[f.b].position,x=m[f.c].position,f._area=THREE.GeometryUtils.triangleArea(w,t,x);else if(f instanceof THREE.Face4)w=m[f.a].position,t=m[f.b].position,x=m[f.c].position,v=m[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(w,
+t,v),f._area2=THREE.GeometryUtils.triangleArea(t,x,v),f._area=f._area1+f._area2;p+=f._area;u[h]=p}f=[];m={};for(h=0;h<c;h++)n=THREE.GeometryUtils.random()*p,n=e(n),f[h]=THREE.GeometryUtils.randomPointInFace(k[n],b,!0),m[n]?m[n]+=1:m[n]=1;return f},triangleArea:function(b,c,e){var f,h=THREE.GeometryUtils.__v1;h.sub(b,c);f=h.length();h.sub(b,e);b=h.length();h.sub(c,e);e=h.length();c=0.5*(f+b+e);return Math.sqrt(c*(c-f)*(c-b)*(c-e))},random16:function(){return(65280*Math.random()+255*Math.random())/
+65535},center:function(b){b.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(b.boundingBox.x[1]+b.boundingBox.x[0]),-0.5*(b.boundingBox.y[1]+b.boundingBox.y[0]),-0.5*(b.boundingBox.z[1]+b.boundingBox.z[0]));b.applyMatrix(c);b.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,h=new THREE.Texture(f,c);f.onload=function(){h.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return h},loadTextureCube:function(b,c,e){var f,h=[],k=new THREE.Texture(h,c),c=h.loadCount=0;for(f=b.length;c<f;++c)h[c]=new Image,h[c].onload=function(){h.loadCount+=1;if(h.loadCount==6)k.needsUpdate=!0;e&&e(this)},h[c].crossOrigin="",h[c].src=b[c];return k},getNormalMap:function(b,c){var e=function(b){var e=Math.sqrt(b[0]*b[0]+b[1]*b[1]+
 b[2]*b[2]);return[b[0]/e,b[1]/e,b[2]/e]};c|=1;var f=b.width,h=b.height,k=document.createElement("canvas");k.width=f;k.height=h;var m=k.getContext("2d");m.drawImage(b,0,0);for(var n=m.getImageData(0,0,f,h).data,p=m.createImageData(f,h),u=p.data,w=0;w<f;w++)for(var t=1;t<h;t++){var x=t-1<0?h-1:t-1,v=(t+1)%h,z=w-1<0?f-1:w-1,y=(w+1)%f,B=[],A=[0,0,n[(t*f+w)*4]/255*c];B.push([-1,0,n[(t*f+z)*4]/255*c]);B.push([-1,-1,n[(x*f+z)*4]/255*c]);B.push([0,-1,n[(x*f+w)*4]/255*c]);B.push([1,-1,n[(x*f+y)*4]/255*c]);
-B.push([1,0,n[(t*f+y)*4]/255*c]);B.push([1,1,n[(v*f+y)*4]/255*c]);B.push([0,1,n[(v*f+w)*4]/255*c]);B.push([-1,1,n[(v*f+z)*4]/255*c]);x=[];z=B.length;for(v=0;v<z;v++){var y=B[v],E=B[(v+1)%z],y=[y[0]-A[0],y[1]-A[1],y[2]-A[2]],E=[E[0]-A[0],E[1]-A[1],E[2]-A[2]];x.push(e([y[1]*E[2]-y[2]*E[1],y[2]*E[0]-y[0]*E[2],y[0]*E[1]-y[1]*E[0]]))}B=[0,0,0];for(v=0;v<x.length;v++)B[0]+=x[v][0],B[1]+=x[v][1],B[2]+=x[v][2];B[0]/=x.length;B[1]/=x.length;B[2]/=x.length;A=(t*f+w)*4;u[A]=(B[0]+1)/2*255|0;u[A+1]=(B[1]+0.5)*
+B.push([1,0,n[(t*f+y)*4]/255*c]);B.push([1,1,n[(v*f+y)*4]/255*c]);B.push([0,1,n[(v*f+w)*4]/255*c]);B.push([-1,1,n[(v*f+z)*4]/255*c]);x=[];z=B.length;for(v=0;v<z;v++){var y=B[v],D=B[(v+1)%z],y=[y[0]-A[0],y[1]-A[1],y[2]-A[2]],D=[D[0]-A[0],D[1]-A[1],D[2]-A[2]];x.push(e([y[1]*D[2]-y[2]*D[1],y[2]*D[0]-y[0]*D[2],y[0]*D[1]-y[1]*D[0]]))}B=[0,0,0];for(v=0;v<x.length;v++)B[0]+=x[v][0],B[1]+=x[v][1],B[2]+=x[v][2];B[0]/=x.length;B[1]/=x.length;B[2]/=x.length;A=(t*f+w)*4;u[A]=(B[0]+1)/2*255|0;u[A+1]=(B[1]+0.5)*
 255|0;u[A+2]=B[2]*255|0;u[A+3]=255}m.putImageData(p,0,0);return k}};THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,h=b.children.length;for(f=0;f<h;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
@@ -443,7 +443,7 @@ this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=thi
 (this.lat-=this.mouseY*c*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/(Math.PI-0)+this.verticalMin;b=this.target.position;h=this.position;b.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",
 function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;
 THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
-THREE.PathCamera=function(b){function c(b,e,c,f){var k={name:c,fps:0.6,length:f,hierarchy:[]},h,m=e.getControlPointsArray(),n=e.getLength(),p=m.length,E=0;h=p-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[h]={time:f,pos:m[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<p-1;h++)E=f*n.chunks[h]/n.total,e.keys[h]={time:E,pos:m[h]};k.hierarchy[0]=e;THREE.AnimationHandler.add(k);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
+THREE.PathCamera=function(b){function c(b,e,c,f){var k={name:c,fps:0.6,length:f,hierarchy:[]},h,m=e.getControlPointsArray(),n=e.getLength(),p=m.length,D=0;h=p-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[h]={time:f,pos:m[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<p-1;h++)D=f*n.chunks[h]/n.total,e.keys[h]={time:D,pos:m[h]};k.hierarchy[0]=e;THREE.AnimationHandler.add(k);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
 f,k=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),k.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return k}function f(b,c){var f=e(c,10),k=e(c,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,h);particleObj=new THREE.ParticleSystem(k,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);k=new THREE.SphereGeometry(1,
 16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(k,h),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.useTarget=!0;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;
 this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=
@@ -486,25 +486,26 @@ x+V,p+W*(x+1)+V,p+1+W*(x+1)+V,p+1+W*x+V,null,null,u)),w.faceVertexUvs[0].push([n
 p[y]);this.sides.px&&u("z","y",1*n,-1,e,c,-t,this.materials[0]);this.sides.nx&&u("z","y",-1*n,-1,e,c,t,this.materials[1]);this.sides.py&&u("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&u("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&u("x","y",1*n,-1,b,c,v,this.materials[4]);this.sides.nz&&u("x","y",-1*n,-1,b,c,-v,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CylinderGeometry=function(b,c,e,f,h,k){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,m=e/2,f=f||8,h=h||1,n,p,u=[],w=[];for(p=0;p<=h;p++){var t=[],x=[],v=p/h,z=v*(c-b)+b;for(n=0;n<=f;n++){var y=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(y*Math.PI*2),-v*e+m,z*Math.cos(y*Math.PI*2))));t.push(this.vertices.length-1);x.push(new THREE.UV(y,v))}u.push(t);w.push(x)}for(p=0;p<h;p++)for(n=0;n<f;n++){var e=u[p][n],t=u[p+1][n],x=u[p+1][n+1],v=u[p][n+1],z=
-this.vertices[e].position.clone().setY(0).normalize(),y=this.vertices[t].position.clone().setY(0).normalize(),B=this.vertices[x].position.clone().setY(0).normalize(),A=this.vertices[v].position.clone().setY(0).normalize(),E=w[p][n].clone(),D=w[p+1][n].clone(),F=w[p+1][n+1].clone(),O=w[p][n+1].clone();this.faces.push(new THREE.Face4(e,t,x,v,[z,y,B,A]));this.faceVertexUvs[0].push([E,D,F,O])}if(!k&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n<f;n++)e=u[0][n],t=u[0][n+
-1],x=this.vertices.length-1,z=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),B=new THREE.Vector3(0,1,0),E=w[0][n].clone(),D=w[0][n+1].clone(),F=new THREE.UV(D.u,0),this.faces.push(new THREE.Face3(e,t,x,[z,y,B])),this.faceVertexUvs[0].push([E,D,F])}if(!k&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;n<f;n++)e=u[p][n+1],t=u[p][n],x=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),B=new THREE.Vector3(0,-1,0),E=w[p][n+1].clone(),D=w[p][n].clone(),
-F=new THREE.UV(D.u,1),this.faces.push(new THREE.Face3(e,t,x,[z,y,B])),this.faceVertexUvs[0].push([E,D,F])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+this.vertices[e].position.clone().setY(0).normalize(),y=this.vertices[t].position.clone().setY(0).normalize(),B=this.vertices[x].position.clone().setY(0).normalize(),A=this.vertices[v].position.clone().setY(0).normalize(),D=w[p][n].clone(),E=w[p+1][n].clone(),F=w[p+1][n+1].clone(),O=w[p][n+1].clone();this.faces.push(new THREE.Face4(e,t,x,v,[z,y,B,A]));this.faceVertexUvs[0].push([D,E,F,O])}if(!k&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n<f;n++)e=u[0][n],t=u[0][n+
+1],x=this.vertices.length-1,z=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),B=new THREE.Vector3(0,1,0),D=w[0][n].clone(),E=w[0][n+1].clone(),F=new THREE.UV(E.u,0),this.faces.push(new THREE.Face3(e,t,x,[z,y,B])),this.faceVertexUvs[0].push([D,E,F])}if(!k&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;n<f;n++)e=u[p][n+1],t=u[p][n],x=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),B=new THREE.Vector3(0,-1,0),D=w[p][n+1].clone(),E=w[p][n].clone(),
+F=new THREE.UV(E.u,1),this.faces.push(new THREE.Face3(e,t,x,[z,y,B])),this.faceVertexUvs[0].push([D,E,F])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,h;this.shapebb=b[f-1].getBoundingBox();for(e=0;e<f;e++)h=b[e],this.addShape(h,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,k=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);k.set(b.x-e.x,b.y-e.y);f=f.normalize();k=k.normalize();h.set(-f.y,f.x);m.set(k.y,-k.x);n.copy(b).addSelf(h);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
 n.copy(c).addSelf(h);o.copy(e).addSelf(m);h=f.dot(m);m=o.subSelf(n).dot(m);h==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=h;if(m<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(I=b.length;--I>=0;){ka=I;ga=I-1;ga<0&&(ga=b.length-
 1);for(var c=0,e=v+w*2,c=0;c<e;c++){var f=fa*c,k=fa*(c+1),h=da+ka+f,m=da+ka+k,o=h,f=da+ga+f,k=da+ga+k,t=m;o+=Z;f+=Z;k+=Z;t+=Z;J.faces.push(new THREE.Face4(o,f,k,t,null,null,F));F&&(o=c/e,f=(c+1)/e,k=n+p*2,h=(J.vertices[h].position.z+p)/k,m=(J.vertices[m].position.z+p)/k,J.faceVertexUvs[0].push([new THREE.UV(h,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(h,f)]))}}}function k(b,c,e){J.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function m(b,c,e){b+=Z;c+=Z;e+=Z;J.faces.push(new THREE.Face3(b,
-c,e,null,null,D));if(D){var f=O.maxY,k=O.maxX,h=J.vertices[c].position.x,c=J.vertices[c].position.y,m=J.vertices[e].position.x,e=J.vertices[e].position.y;J.faceVertexUvs[0].push([new THREE.UV(J.vertices[b].position.x/k,J.vertices[b].position.y/f),new THREE.UV(h/k,c/f),new THREE.UV(m/k,e/f)])}}var n=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,u=c.bevelSize!==void 0?c.bevelSize:p-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,t=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,x=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,z=c.bendPath,y=c.extrudePath,B,A=!1,E=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,F=c.extrudeMaterial,O=this.shapebb;if(y)B=y.getPoints(x),v=B.length,A=!0,t=!1;t||(u=p=w=0);var R,L,G,J=this,Z=this.vertices.length;z&&b.addWrapPath(z);x=E?b.extractAllSpacedPoints(x):b.extractAllPoints(x);z=x.shape;x=x.holes;if(y=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();L=0;for(G=x.length;L<G;L++)R=x[L],THREE.Shape.Utils.isClockWise(R)&&
-(x[L]=R.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(z,x);E=z;L=0;for(G=x.length;L<G;L++)R=x[L],z=z.concat(R);var I,Q,X,V,W,o,fa=z.length,T=y.length,oa=[];I=0;Q=E.length;ka=Q-1;for(ga=I+1;I<Q;I++,ka++,ga++)ka==Q&&(ka=0),ga==Q&&(ga=0),oa[I]=f(E[I],E[ka],E[ga]);var aa=[],ja,ca=oa.concat();L=0;for(G=x.length;L<G;L++){R=x[L];ja=[];I=0;Q=R.length;ka=Q-1;for(ga=I+1;I<Q;I++,ka++,ga++)ka==Q&&(ka=0),ga==Q&&(ga=0),ja[I]=f(R[I],R[ka],R[ga]);aa.push(ja);ca=ca.concat(ja)}for(X=0;X<w;X++){V=X/w;W=p*(1-
-V);V=u*Math.sin(V*Math.PI/2);I=0;for(Q=E.length;I<Q;I++)o=e(E[I],oa[I],V),k(o.x,o.y,-W);L=0;for(G=x.length;L<G;L++){R=x[L];ja=aa[L];I=0;for(Q=R.length;I<Q;I++)o=e(R[I],ja[I],V),k(o.x,o.y,-W)}}V=u;for(I=0;I<fa;I++)o=t?e(z[I],ca[I],V):z[I],A?k(o.x,o.y+B[0].y,B[0].x):k(o.x,o.y,0);for(X=1;X<=v;X++)for(I=0;I<fa;I++)o=t?e(z[I],ca[I],V):z[I],A?k(o.x,o.y+B[X-1].y,B[X-1].x):k(o.x,o.y,n/v*X);for(X=w-1;X>=0;X--){V=X/w;W=p*(1-V);V=u*Math.sin(V*Math.PI/2);I=0;for(Q=E.length;I<Q;I++)o=e(E[I],oa[I],V),k(o.x,o.y,
-n+W);L=0;for(G=x.length;L<G;L++){R=x[L];ja=aa[L];I=0;for(Q=R.length;I<Q;I++)o=e(R[I],ja[I],V),A?k(o.x,o.y+B[v-1].y,B[v-1].x+W):k(o.x,o.y,n+W)}}if(t){t=fa*0;for(I=0;I<T;I++)u=y[I],m(u[2]+t,u[1]+t,u[0]+t);t=fa*(v+w*2);for(I=0;I<T;I++)u=y[I],m(u[0]+t,u[1]+t,u[2]+t)}else{for(I=0;I<T;I++)u=y[I],m(u[2],u[1],u[0]);for(I=0;I<T;I++)u=y[I],m(u[0]+fa*v,u[1]+fa*v,u[2]+fa*v)}var ka,ga,da=0;h(E);da+=E.length;L=0;for(G=x.length;L<G;L++)R=x[L],h(R),da+=R.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+c,e,null,null,E));if(E){var f=O.maxY,k=O.maxX,h=J.vertices[c].position.x,c=J.vertices[c].position.y,m=J.vertices[e].position.x,e=J.vertices[e].position.y;J.faceVertexUvs[0].push([new THREE.UV(J.vertices[b].position.x/k,J.vertices[b].position.y/f),new THREE.UV(h/k,c/f),new THREE.UV(m/k,e/f)])}}var n=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,u=c.bevelSize!==void 0?c.bevelSize:p-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,t=c.bevelEnabled!==void 0?c.bevelEnabled:
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,z=c.bendPath,y=c.extrudePath,B,A=!1,D=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,E=c.material,F=c.extrudeMaterial,O=this.shapebb;if(y)B=y.getPoints(x),v=B.length,A=!0,t=!1;t||(u=p=w=0);var R,L,G,J=this,Z=this.vertices.length;z&&b.addWrapPath(z);x=D?b.extractAllSpacedPoints(x):b.extractAllPoints(x);z=x.shape;x=x.holes;if(y=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();L=0;for(G=x.length;L<G;L++)R=x[L],THREE.Shape.Utils.isClockWise(R)&&
+(x[L]=R.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(z,x);D=z;L=0;for(G=x.length;L<G;L++)R=x[L],z=z.concat(R);var I,Q,X,V,W,o,fa=z.length,T=y.length,oa=[];I=0;Q=D.length;ka=Q-1;for(ga=I+1;I<Q;I++,ka++,ga++)ka==Q&&(ka=0),ga==Q&&(ga=0),oa[I]=f(D[I],D[ka],D[ga]);var aa=[],ja,ca=oa.concat();L=0;for(G=x.length;L<G;L++){R=x[L];ja=[];I=0;Q=R.length;ka=Q-1;for(ga=I+1;I<Q;I++,ka++,ga++)ka==Q&&(ka=0),ga==Q&&(ga=0),ja[I]=f(R[I],R[ka],R[ga]);aa.push(ja);ca=ca.concat(ja)}for(X=0;X<w;X++){V=X/w;W=p*(1-
+V);V=u*Math.sin(V*Math.PI/2);I=0;for(Q=D.length;I<Q;I++)o=e(D[I],oa[I],V),k(o.x,o.y,-W);L=0;for(G=x.length;L<G;L++){R=x[L];ja=aa[L];I=0;for(Q=R.length;I<Q;I++)o=e(R[I],ja[I],V),k(o.x,o.y,-W)}}V=u;for(I=0;I<fa;I++)o=t?e(z[I],ca[I],V):z[I],A?k(o.x,o.y+B[0].y,B[0].x):k(o.x,o.y,0);for(X=1;X<=v;X++)for(I=0;I<fa;I++)o=t?e(z[I],ca[I],V):z[I],A?k(o.x,o.y+B[X-1].y,B[X-1].x):k(o.x,o.y,n/v*X);for(X=w-1;X>=0;X--){V=X/w;W=p*(1-V);V=u*Math.sin(V*Math.PI/2);I=0;for(Q=D.length;I<Q;I++)o=e(D[I],oa[I],V),k(o.x,o.y,
+n+W);L=0;for(G=x.length;L<G;L++){R=x[L];ja=aa[L];I=0;for(Q=R.length;I<Q;I++)o=e(R[I],ja[I],V),A?k(o.x,o.y+B[v-1].y,B[v-1].x+W):k(o.x,o.y,n+W)}}if(t){t=fa*0;for(I=0;I<T;I++)u=y[I],m(u[2]+t,u[1]+t,u[0]+t);t=fa*(v+w*2);for(I=0;I<T;I++)u=y[I],m(u[0]+t,u[1]+t,u[2]+t)}else{for(I=0;I<T;I++)u=y[I],m(u[2],u[1],u[0]);for(I=0;I<T;I++)u=y[I],m(u[0]+fa*v,u[1]+fa*v,u[2]+fa*v)}var ka,ga,da=0;h(D);da+=D.length;L=0;for(G=x.length;L<G;L++)R=x[L],h(R),da+=R.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
-THREE.SubdivisionGeometry=function(b){function c(b,c,e,k){f.faces.push(new THREE.Face4(b,c,e,k,null,null,null));(!w||u.length!=0)&&f.faceVertexUvs[0].push([u[b],u[c],u[e],u[k]])}function e(b,c){return Math.min(b,c)+"_"+Math.max(b,c)}THREE.Geometry.call(this);var f=this,h=b.vertices,k=b.faces,m=h.concat(),n=[],p={},u=[],w=!1,t,x,v,z,y;y=b.faceVertexUvs[0];var B;t=0;for(x=y.length;t<x;t++){v=0;for(z=y[t].length;v<z;v++)B=k[t]["abcd".charAt(v)],u[B]||(u[B]=y[t][v])}this.materials=b.materials;var A;t=
-0;for(x=k.length;t<x;t++)if(y=k[t],n.push(y.centroid),m.push(new THREE.Vertex(y.centroid)),w&&u.length!=0){A=new THREE.UV;if(y instanceof THREE.Face3)A.u=u[y.a].u+u[y.b].u+u[y.c].u,A.v=u[y.a].v+u[y.b].v+u[y.c].v,A.u/=3,A.v/=3;else if(y instanceof THREE.Face4)A.u=u[y.a].u+u[y.b].u+u[y.c].u+u[y.d].u,A.v=u[y.a].v+u[y.b].v+u[y.c].v+u[y.d].v,A.u/=4,A.v/=4;u.push(A)}var b=function(b){function c(b,e,f){b[e]===void 0&&(b[e]={set:{},array:[]});b[e].set[f]=1;b[e].array.push(f)}var f,k,h,m,n={};f=0;for(k=b.faces.length;f<
-k;f++)h=b.faces[f],h instanceof THREE.Face3?(m=e(h.a,h.b),c(n,m,f),m=e(h.b,h.c),c(n,m,f),m=e(h.c,h.a),c(n,m,f)):h instanceof THREE.Face4&&(m=e(h.a,h.b),c(n,m,f),m=e(h.b,h.c),c(n,m,f),m=e(h.c,h.d),c(n,m,f),m=e(h.d,h.a),c(n,m,f));b.vfMap=n;b.edges=[];h=0;for(f in n)h++,k=n[f],b.edges.push(k.array);return n}(b),E,D=0;z=h.length;for(t in b)if(y=b[t],y=y.array,A=y[0],y=y[1],E=new THREE.Vector3,E.addSelf(n[A]),E.addSelf(n[y]),B=t.split("_"),x=B[0],B=B[1],E.addSelf(h[x].position),E.addSelf(h[B].position),
-E.multiplyScalar(0.25),p[t]=z+k.length+D,m.push(new THREE.Vertex(E)),D++,w&&u.length!=0)A=new THREE.UV,A.u=u[x].u+u[B].u,A.v=u[x].v+u[B].v,A.u/=2,A.v/=2,u.push(A);var F;t=0;for(x=n.length;t<x;t++)y=k[t],B=z+t,y instanceof THREE.Face3?(D=e(y.a,y.b),A=e(y.b,y.c),E=e(y.c,y.a),c(B,p[D],y.b,p[A]),c(B,p[A],y.c,p[E]),c(B,p[E],y.a,p[D])):y instanceof THREE.Face4?(D=e(y.a,y.b),A=e(y.b,y.c),E=e(y.c,y.d),F=e(y.d,y.a),c(B,p[D],y.b,p[A]),c(B,p[A],y.c,p[E]),c(B,p[E],y.d,p[F]),c(B,p[F],y.a,p[D])):console.log("face should be a face!",
-y);f.vertices=m;var O={},R={},k=function(b,c){O[b]===void 0&&(O[b]=[]);O[b].push(c)},m=function(b,c){R[b]===void 0&&(R[b]={});R[b][c]=null};for(t in b)y=b[t],B=t.split("_"),x=B[0],B=B[1],k(x,[x,B]),k(B,[x,B]),y=y.array,A=y[0],y=y[1],m(x,A),m(x,y),m(B,A),m(B,y);k=new THREE.Vector3;m=new THREE.Vector3;t=0;for(x=h.length;t<x;t++)if(O[t]!==void 0){k.set(0,0,0);m.set(0,0,0);p=new THREE.Vector3(0,0,0);b=0;for(v in R[t])k.addSelf(n[v]),b++;k.divideScalar(b);b=O[t].length;for(v=0;v<b;v++)y=O[t][v],z=h[y[0]].position.clone().addSelf(h[y[1]].position).divideScalar(2),
-m.addSelf(z);m.divideScalar(b);p.addSelf(h[t].position);p.multiplyScalar(b-3);p.addSelf(k);p.addSelf(m.multiplyScalar(2));p.divideScalar(b);this.vertices[t].position=p}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.SubdivisionGeometry.prototype=new THREE.Geometry;THREE.SubdivisionGeometry.prototype.constructor=THREE.SubdivisionGeometry;
+THREE.SubdivisionGeometry=function(b){function c(b,c,e,k,h,m){f.faces.push(new THREE.Face4(b,c,e,k,null,h,m));(!w||u.length!=0)&&f.faceVertexUvs[0].push([u[b],u[c],u[e],u[k]])}function e(b,c){return Math.min(b,c)+"_"+Math.max(b,c)}THREE.Geometry.call(this);var f=this,h=b.vertices,k=b.faces,m=h.concat(),n=[],p={},u=[],w=!0,t,x,v,z,y;y=b.faceVertexUvs[0];var B;t=0;for(x=y.length;t<x;t++){v=0;for(z=y[t].length;v<z;v++)B=k[t]["abcd".charAt(v)],u[B]||(u[B]=y[t][v])}this.materials=b.materials;var A;t=0;
+for(x=k.length;t<x;t++)if(y=k[t],n.push(y.centroid),m.push(new THREE.Vertex(y.centroid)),w&&u.length!=0){A=new THREE.UV;if(y instanceof THREE.Face3)A.u=u[y.a].u+u[y.b].u+u[y.c].u,A.v=u[y.a].v+u[y.b].v+u[y.c].v,A.u/=3,A.v/=3;else if(y instanceof THREE.Face4)A.u=u[y.a].u+u[y.b].u+u[y.c].u+u[y.d].u,A.v=u[y.a].v+u[y.b].v+u[y.c].v+u[y.d].v,A.u/=4,A.v/=4;u.push(A)}var b=function(b){function c(b,e,f){b[e]===void 0&&(b[e]={set:{},array:[]});b[e].set[f]=1;b[e].array.push(f)}var f,k,h,m,n={};f=0;for(k=b.faces.length;f<
+k;f++)h=b.faces[f],h instanceof THREE.Face3?(m=e(h.a,h.b),c(n,m,f),m=e(h.b,h.c),c(n,m,f),m=e(h.c,h.a),c(n,m,f)):h instanceof THREE.Face4&&(m=e(h.a,h.b),c(n,m,f),m=e(h.b,h.c),c(n,m,f),m=e(h.c,h.d),c(n,m,f),m=e(h.d,h.a),c(n,m,f));b.vfMap=n;b.edges=[];h=0;for(f in n)h++,k=n[f],b.edges.push(k.array);return n}(b),D,E,F=0;z=h.length;for(t in b)if(y=b[t],y=y.array,A=y[0],D=y[1],E=new THREE.Vector3,y.length!=2)console.log("warning, edge fail",y);else if(E.addSelf(n[A]),E.addSelf(n[D]),B=t.split("_"),x=B[0],
+B=B[1],E.addSelf(h[x].position),E.addSelf(h[B].position),E.multiplyScalar(0.25),p[t]=z+k.length+F,m.push(new THREE.Vertex(E)),F++,w&&u.length!=0)A=new THREE.UV,A.u=u[x].u+u[B].u,A.v=u[x].v+u[B].v,A.u/=2,A.v/=2,u.push(A);t=0;for(x=n.length;t<x;t++)y=k[t],B=z+t,y instanceof THREE.Face3?(F=e(y.a,y.b),A=e(y.b,y.c),D=e(y.c,y.a),c(B,p[F],y.b,p[A],y.color,y.material),c(B,p[A],y.c,p[D],y.color,y.material),c(B,p[D],y.a,p[F],y.color,y.material)):y instanceof THREE.Face4?(F=e(y.a,y.b),A=e(y.b,y.c),D=e(y.c,y.d),
+E=e(y.d,y.a),c(B,p[F],y.b,p[A],y.color,y.material),c(B,p[A],y.c,p[D],y.color,y.material),c(B,p[D],y.d,p[E],y.color,y.material),c(B,p[E],y.a,p[F],y.color,y.material)):console.log("face should be a face!",y);f.vertices=m;var O={},R={},k=function(b,c){O[b]===void 0&&(O[b]=[]);O[b].push(c)},m=function(b,c){R[b]===void 0&&(R[b]={});R[b][c]=null};for(t in b)y=b[t],B=t.split("_"),x=B[0],B=B[1],k(x,[x,B]),k(B,[x,B]),y=y.array,A=y[0],D=y[1],m(x,A),m(x,D),m(B,A),m(B,D);k=new THREE.Vector3;m=new THREE.Vector3;
+t=0;for(x=h.length;t<x;t++)if(O[t]!==void 0){k.set(0,0,0);m.set(0,0,0);p=new THREE.Vector3(0,0,0);b=0;for(v in R[t])k.addSelf(n[v]),b++;k.divideScalar(b);b=O[t].length;for(v=0;v<b;v++)y=O[t][v],z=h[y[0]].position.clone().addSelf(h[y[1]].position).divideScalar(2),m.addSelf(z);m.divideScalar(b);p.addSelf(h[t].position);p.multiplyScalar(b-3);p.addSelf(k);p.addSelf(m.multiplyScalar(2));p.divideScalar(b);this.vertices[t].position=p}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
+THREE.SubdivisionGeometry.prototype=new THREE.Geometry;THREE.SubdivisionGeometry.prototype.constructor=THREE.SubdivisionGeometry;
 THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=h.vertices[b].position,k=h.vertices[e].position;return c((f.x+k.x)/2,(f.y+k.y)/2,(f.z+k.z)/2)}var h=this,k=new THREE.Geometry;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
 -b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,k);e(0,5,1,k);e(0,1,7,k);e(0,7,10,k);e(0,10,11,k);e(1,5,9,k);e(5,11,4,k);e(11,10,2,k);e(10,7,6,k);e(7,1,8,k);e(3,9,4,k);e(3,4,2,k);e(3,2,6,k);e(3,6,8,k);e(3,8,9,k);e(4,9,5,k);e(2,4,11,k);e(6,2,10,k);e(8,6,7,k);e(9,8,1,k);for(var m=0;m<this.subdivisions;m++){var b=new THREE.Geometry,n;for(n in k.faces){var p=f(k.faces[n].a,k.faces[n].b),u=f(k.faces[n].b,k.faces[n].c),w=f(k.faces[n].c,k.faces[n].a);e(k.faces[n].a,p,w,b);e(k.faces[n].b,u,
 p,b);e(k.faces[n].c,w,u,b);e(p,u,w,b)}k.faces=b.faces}h.faces=k.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
@@ -520,10 +521,10 @@ THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.am
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c=
 this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),k=h.length,m=[],b=0;b<k;b++){var n=new THREE.Path,n=this.extractGlyphPoints(h[b],c,e,f,n);f+=n.offset;m.push(n.path)}return{paths:m,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var k=[],m,n,p,u,w,t,x,v,z,y,B=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(B){if(B.o){c=B._cachedOutline||(B._cachedOutline=B.o.split(" "));p=c.length;for(b=0;b<p;)switch(n=c[b++],n){case "m":n=c[b++]*e+f;u=c[b++]*e;k.push(new THREE.Vector2(n,
-u));h.moveTo(n,u);break;case "l":n=c[b++]*e+f;u=c[b++]*e;k.push(new THREE.Vector2(n,u));h.lineTo(n,u);break;case "q":n=c[b++]*e+f;u=c[b++]*e;x=c[b++]*e+f;v=c[b++]*e;h.quadraticCurveTo(x,v,n,u);if(m=k[k.length-1]){w=m.x;t=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++){var A=m/divisions,E=THREE.Shape.Utils.b2(A,w,x,n),A=THREE.Shape.Utils.b2(A,t,v,u);k.push(new THREE.Vector2(E,A))}}break;case "b":if(n=c[b++]*e+f,u=c[b++]*e,x=c[b++]*e+f,v=c[b++]*-e,z=c[b++]*e+f,y=c[b++]*-e,h.bezierCurveTo(n,u,
-x,v,z,y),m=k[k.length-1]){w=m.x;t=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)A=m/divisions,E=THREE.Shape.Utils.b3(A,w,x,z,n),A=THREE.Shape.Utils.b3(A,t,v,y,u),k.push(new THREE.Vector2(E,A))}}}return{offset:B.ha*e,points:k,path:h}}}};
-(function(b){var c=function(b){for(var c=b.length,h=0,k=c-1,m=0;m<c;k=m++)h+=b[k].x*b[m].y-b[m].x*b[k].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var k=[],m=[],n=[],p,u,w;if(c(b)>0)for(u=0;u<h;u++)m[u]=u;else for(u=0;u<h;u++)m[u]=h-1-u;var t=2*h;for(u=h-1;h>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}p=u;h<=p&&(p=0);u=p+1;h<=u&&(u=0);w=u+1;h<=w&&(w=0);var x;a:{x=b;var v=p,z=u,y=w,B=h,A=m,E=void 0,D=void 0,F=void 0,
-O=void 0,R=void 0,L=void 0,G=void 0,J=void 0,Z=void 0,D=x[A[v]].x,F=x[A[v]].y,O=x[A[z]].x,R=x[A[z]].y,L=x[A[y]].x,G=x[A[y]].y;if(1.0E-10>(O-D)*(G-F)-(R-F)*(L-D))x=!1;else{for(E=0;E<B;E++)if(!(E==v||E==z||E==y)){var J=x[A[E]].x,Z=x[A[E]].y,I=void 0,Q=void 0,X=void 0,V=void 0,W=void 0,o=void 0,fa=void 0,T=void 0,oa=void 0,aa=void 0,ja=void 0,ca=void 0,I=X=W=void 0,I=L-O,Q=G-R,X=D-L,V=F-G,W=O-D,o=R-F,fa=J-D,T=Z-F,oa=J-O,aa=Z-R,ja=J-L,ca=Z-G,I=I*aa-Q*oa,W=W*T-o*fa,X=X*ca-V*ja;if(I>=0&&X>=0&&W>=0){x=!1;
+u));h.moveTo(n,u);break;case "l":n=c[b++]*e+f;u=c[b++]*e;k.push(new THREE.Vector2(n,u));h.lineTo(n,u);break;case "q":n=c[b++]*e+f;u=c[b++]*e;x=c[b++]*e+f;v=c[b++]*e;h.quadraticCurveTo(x,v,n,u);if(m=k[k.length-1]){w=m.x;t=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++){var A=m/divisions,D=THREE.Shape.Utils.b2(A,w,x,n),A=THREE.Shape.Utils.b2(A,t,v,u);k.push(new THREE.Vector2(D,A))}}break;case "b":if(n=c[b++]*e+f,u=c[b++]*e,x=c[b++]*e+f,v=c[b++]*-e,z=c[b++]*e+f,y=c[b++]*-e,h.bezierCurveTo(n,u,
+x,v,z,y),m=k[k.length-1]){w=m.x;t=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)A=m/divisions,D=THREE.Shape.Utils.b3(A,w,x,z,n),A=THREE.Shape.Utils.b3(A,t,v,y,u),k.push(new THREE.Vector2(D,A))}}}return{offset:B.ha*e,points:k,path:h}}}};
+(function(b){var c=function(b){for(var c=b.length,h=0,k=c-1,m=0;m<c;k=m++)h+=b[k].x*b[m].y-b[m].x*b[k].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var k=[],m=[],n=[],p,u,w;if(c(b)>0)for(u=0;u<h;u++)m[u]=u;else for(u=0;u<h;u++)m[u]=h-1-u;var t=2*h;for(u=h-1;h>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}p=u;h<=p&&(p=0);u=p+1;h<=u&&(u=0);w=u+1;h<=w&&(w=0);var x;a:{x=b;var v=p,z=u,y=w,B=h,A=m,D=void 0,E=void 0,F=void 0,
+O=void 0,R=void 0,L=void 0,G=void 0,J=void 0,Z=void 0,E=x[A[v]].x,F=x[A[v]].y,O=x[A[z]].x,R=x[A[z]].y,L=x[A[y]].x,G=x[A[y]].y;if(1.0E-10>(O-E)*(G-F)-(R-F)*(L-E))x=!1;else{for(D=0;D<B;D++)if(!(D==v||D==z||D==y)){var J=x[A[D]].x,Z=x[A[D]].y,I=void 0,Q=void 0,X=void 0,V=void 0,W=void 0,o=void 0,fa=void 0,T=void 0,oa=void 0,aa=void 0,ja=void 0,ca=void 0,I=X=W=void 0,I=L-O,Q=G-R,X=E-L,V=F-G,W=O-E,o=R-F,fa=J-E,T=Z-F,oa=J-O,aa=Z-R,ja=J-L,ca=Z-G,I=I*aa-Q*oa,W=W*T-o*fa,X=X*ca-V*ja;if(I>=0&&X>=0&&W>=0){x=!1;
 break a}}x=!0}}if(x){k.push([b[m[p]],b[m[u]],b[m[w]]]);n.push([m[p],m[u],m[w]]);p=u;for(w=u+1;w<h;p++,w++)m[p]=m[w];h--;t=2*h}}if(f)return n;return k};b.Triangulate.area=c;return b})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(b,c,e,f,h){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=h||Math.PI*2;h=new THREE.Vector3;b=[];c=[];for(e=0;e<=this.segmentsR;e++)for(f=0;f<=this.segmentsT;f++){var k=f/this.segmentsT*this.arc,m=e/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(k);h.y=this.radius*Math.sin(k);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(m))*Math.cos(k);n.y=(this.radius+this.tube*Math.cos(m))*Math.sin(k);n.z=
 this.tube*Math.sin(m);this.vertices.push(new THREE.Vertex(n));b.push(new THREE.UV(f/this.segmentsT,1-e/this.segmentsR));c.push(n.clone().subSelf(h).normalize())}for(e=1;e<=this.segmentsR;e++)for(f=1;f<=this.segmentsT;f++){var h=(this.segmentsT+1)*e+f-1,k=(this.segmentsT+1)*(e-1)+f-1,m=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,p=new THREE.Face4(h,k,m,n,[c[h],c[k],c[m],c[n]]);p.normal.addSelf(c[h]);p.normal.addSelf(c[k]);p.normal.addSelf(c[m]);p.normal.addSelf(c[n]);p.normal.normalize();this.faces.push(p);
@@ -549,14 +550,14 @@ THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(c){
 f,k;e=h(b,c);f=h(b,c+R);k=h(b,c+L);c=p(b,c+G);A.faces.push(new THREE.Face3(e,f,k,null,null,A.materials[c]))}function x(c){var e,f,k,m,o,t;e=h(b,c);f=h(b,c+R);k=h(b,c+L);m=p(b,c+G);o=h(b,c+J);t=h(b,c+Z);c=h(b,c+I);m=A.materials[m];var u=F[t*3],v=F[t*3+1];t=F[t*3+2];var w=F[c*3],x=F[c*3+1],c=F[c*3+2];A.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(F[o*3],F[o*3+1],F[o*3+2]),new THREE.Vector3(u,v,t),new THREE.Vector3(w,x,c)],null,m))}function v(c){var e,f,k,m;e=h(b,c);f=h(b,c+Q);k=h(b,c+X);m=h(b,
 c+V);c=p(b,c+W);A.faces.push(new THREE.Face4(e,f,k,m,null,null,A.materials[c]))}function z(c){var e,f,k,m,t,u,v,w;e=h(b,c);f=h(b,c+Q);k=h(b,c+X);m=h(b,c+V);t=p(b,c+W);u=h(b,c+o);v=h(b,c+fa);w=h(b,c+T);c=h(b,c+oa);t=A.materials[t];var x=F[v*3],M=F[v*3+1];v=F[v*3+2];var y=F[w*3],N=F[w*3+1];w=F[w*3+2];var z=F[c*3],B=F[c*3+1],c=F[c*3+2];A.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(F[u*3],F[u*3+1],F[u*3+2]),new THREE.Vector3(x,M,v),new THREE.Vector3(y,N,w),new THREE.Vector3(z,B,c)],null,t))}
 function y(c){var e,f,k,m;e=h(b,c);f=h(b,c+aa);k=h(b,c+ja);c=O[e*2];m=O[e*2+1];e=O[f*2];var o=A.faceVertexUvs[0];f=O[f*2+1];var p=O[k*2];k=O[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function B(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ca);k=h(b,c+ka);m=h(b,c+ga);c=O[e*2];o=O[e*2+1];e=O[f*2];p=O[f*2+1];f=O[k*2];var t=A.faceVertexUvs[0];k=O[k*2+1];var u=O[m*2];m=O[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f,
-k));v.push(new THREE.UV(u,m));t.push(v)}var A=this,E=0,D,F=[],O=[],R,L,G,J,Z,I,Q,X,V,W,o,fa,T,oa,aa,ja,ca,ka,ga,da,U,$,ha,ma,ua;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,f,c);D={signature:b.substr(E,8),header_bytes:w(b,E+8),vertex_coordinate_bytes:w(b,E+9),normal_coordinate_bytes:w(b,E+10),uv_coordinate_bytes:w(b,E+11),vertex_index_bytes:w(b,E+12),normal_index_bytes:w(b,E+13),uv_index_bytes:w(b,E+14),material_index_bytes:w(b,E+15),nvertices:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b,
-E+16+8),ntri_flat:h(b,E+16+12),ntri_smooth:h(b,E+16+16),ntri_flat_uv:h(b,E+16+20),ntri_smooth_uv:h(b,E+16+24),nquad_flat:h(b,E+16+28),nquad_smooth:h(b,E+16+32),nquad_flat_uv:h(b,E+16+36),nquad_smooth_uv:h(b,E+16+40)};E+=D.header_bytes;R=D.vertex_index_bytes;L=D.vertex_index_bytes*2;G=D.vertex_index_bytes*3;J=D.vertex_index_bytes*3+D.material_index_bytes;Z=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;I=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;Q=D.vertex_index_bytes;
-X=D.vertex_index_bytes*2;V=D.vertex_index_bytes*3;W=D.vertex_index_bytes*4;o=D.vertex_index_bytes*4+D.material_index_bytes;fa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;T=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;oa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;aa=D.uv_index_bytes;ja=D.uv_index_bytes*2;ca=D.uv_index_bytes;ka=D.uv_index_bytes*2;ga=D.uv_index_bytes*3;c=D.vertex_index_bytes*3+D.material_index_bytes;ua=D.vertex_index_bytes*
-4+D.material_index_bytes;da=D.ntri_flat*c;U=D.ntri_smooth*(c+D.normal_index_bytes*3);$=D.ntri_flat_uv*(c+D.uv_index_bytes*3);ha=D.ntri_smooth_uv*(c+D.normal_index_bytes*3+D.uv_index_bytes*3);ma=D.nquad_flat*ua;c=D.nquad_smooth*(ua+D.normal_index_bytes*4);ua=D.nquad_flat_uv*(ua+D.uv_index_bytes*4);E+=function(c){for(var f,k,h,n=D.vertex_coordinate_bytes*3,o=c+D.nvertices*n;c<o;c+=n)f=e(b,c),k=e(b,c+D.vertex_coordinate_bytes),h=e(b,c+D.vertex_coordinate_bytes*2),A.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
-k,h)));return D.nvertices*n}(E);E+=function(c){for(var e,f,k,h=D.normal_coordinate_bytes*3,m=c+D.nnormals*h;c<m;c+=h)e=u(b,c),f=u(b,c+D.normal_coordinate_bytes),k=u(b,c+D.normal_coordinate_bytes*2),F.push(e/127,f/127,k/127);return D.nnormals*h}(E);E+=function(c){for(var f,k,h=D.uv_coordinate_bytes*2,n=c+D.nuvs*h;c<n;c+=h)f=e(b,c),k=e(b,c+D.uv_coordinate_bytes),O.push(f,k);return D.nuvs*h}(E);da=E+da;U=da+U;$=U+$;ha=$+ha;ma=ha+ma;c=ma+c;ua=c+ua;(function(b){var c,e=D.vertex_index_bytes*3+D.material_index_bytes,
-f=e+D.uv_index_bytes*3,k=b+D.ntri_flat_uv*f;for(c=b;c<k;c+=f)t(c),y(c+e);return k-b})(U);(function(b){var c,e=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=e+D.uv_index_bytes*3,k=b+D.ntri_smooth_uv*f;for(c=b;c<k;c+=f)x(c),y(c+e);return k-b})($);(function(b){var c,e=D.vertex_index_bytes*4+D.material_index_bytes,f=e+D.uv_index_bytes*4,k=b+D.nquad_flat_uv*f;for(c=b;c<k;c+=f)v(c),B(c+e);return k-b})(c);(function(b){var c,e=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*
-4,f=e+D.uv_index_bytes*4,k=b+D.nquad_smooth_uv*f;for(c=b;c<k;c+=f)z(c),B(c+e);return k-b})(ua);(function(b){var c,e=D.vertex_index_bytes*3+D.material_index_bytes,f=b+D.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(E);(function(b){var c,e=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=b+D.ntri_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(da);(function(b){var c,e=D.vertex_index_bytes*4+D.material_index_bytes,f=b+D.nquad_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})(ha);(function(b){var c,
-e=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,f=b+D.nquad_smooth*e;for(c=b;c<f;c+=e)z(c);return f-b})(ma);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
+k));v.push(new THREE.UV(u,m));t.push(v)}var A=this,D=0,E,F=[],O=[],R,L,G,J,Z,I,Q,X,V,W,o,fa,T,oa,aa,ja,ca,ka,ga,da,U,$,ha,ma,ua;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,f,c);E={signature:b.substr(D,8),header_bytes:w(b,D+8),vertex_coordinate_bytes:w(b,D+9),normal_coordinate_bytes:w(b,D+10),uv_coordinate_bytes:w(b,D+11),vertex_index_bytes:w(b,D+12),normal_index_bytes:w(b,D+13),uv_index_bytes:w(b,D+14),material_index_bytes:w(b,D+15),nvertices:h(b,D+16),nnormals:h(b,D+16+4),nuvs:h(b,
+D+16+8),ntri_flat:h(b,D+16+12),ntri_smooth:h(b,D+16+16),ntri_flat_uv:h(b,D+16+20),ntri_smooth_uv:h(b,D+16+24),nquad_flat:h(b,D+16+28),nquad_smooth:h(b,D+16+32),nquad_flat_uv:h(b,D+16+36),nquad_smooth_uv:h(b,D+16+40)};D+=E.header_bytes;R=E.vertex_index_bytes;L=E.vertex_index_bytes*2;G=E.vertex_index_bytes*3;J=E.vertex_index_bytes*3+E.material_index_bytes;Z=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes;I=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*2;Q=E.vertex_index_bytes;
+X=E.vertex_index_bytes*2;V=E.vertex_index_bytes*3;W=E.vertex_index_bytes*4;o=E.vertex_index_bytes*4+E.material_index_bytes;fa=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes;T=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*2;oa=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*3;aa=E.uv_index_bytes;ja=E.uv_index_bytes*2;ca=E.uv_index_bytes;ka=E.uv_index_bytes*2;ga=E.uv_index_bytes*3;c=E.vertex_index_bytes*3+E.material_index_bytes;ua=E.vertex_index_bytes*
+4+E.material_index_bytes;da=E.ntri_flat*c;U=E.ntri_smooth*(c+E.normal_index_bytes*3);$=E.ntri_flat_uv*(c+E.uv_index_bytes*3);ha=E.ntri_smooth_uv*(c+E.normal_index_bytes*3+E.uv_index_bytes*3);ma=E.nquad_flat*ua;c=E.nquad_smooth*(ua+E.normal_index_bytes*4);ua=E.nquad_flat_uv*(ua+E.uv_index_bytes*4);D+=function(c){for(var f,k,h,n=E.vertex_coordinate_bytes*3,o=c+E.nvertices*n;c<o;c+=n)f=e(b,c),k=e(b,c+E.vertex_coordinate_bytes),h=e(b,c+E.vertex_coordinate_bytes*2),A.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
+k,h)));return E.nvertices*n}(D);D+=function(c){for(var e,f,k,h=E.normal_coordinate_bytes*3,m=c+E.nnormals*h;c<m;c+=h)e=u(b,c),f=u(b,c+E.normal_coordinate_bytes),k=u(b,c+E.normal_coordinate_bytes*2),F.push(e/127,f/127,k/127);return E.nnormals*h}(D);D+=function(c){for(var f,k,h=E.uv_coordinate_bytes*2,n=c+E.nuvs*h;c<n;c+=h)f=e(b,c),k=e(b,c+E.uv_coordinate_bytes),O.push(f,k);return E.nuvs*h}(D);da=D+da;U=da+U;$=U+$;ha=$+ha;ma=ha+ma;c=ma+c;ua=c+ua;(function(b){var c,e=E.vertex_index_bytes*3+E.material_index_bytes,
+f=e+E.uv_index_bytes*3,k=b+E.ntri_flat_uv*f;for(c=b;c<k;c+=f)t(c),y(c+e);return k-b})(U);(function(b){var c,e=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*3,f=e+E.uv_index_bytes*3,k=b+E.ntri_smooth_uv*f;for(c=b;c<k;c+=f)x(c),y(c+e);return k-b})($);(function(b){var c,e=E.vertex_index_bytes*4+E.material_index_bytes,f=e+E.uv_index_bytes*4,k=b+E.nquad_flat_uv*f;for(c=b;c<k;c+=f)v(c),B(c+e);return k-b})(c);(function(b){var c,e=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*
+4,f=e+E.uv_index_bytes*4,k=b+E.nquad_smooth_uv*f;for(c=b;c<k;c+=f)z(c),B(c+e);return k-b})(ua);(function(b){var c,e=E.vertex_index_bytes*3+E.material_index_bytes,f=b+E.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(D);(function(b){var c,e=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*3,f=b+E.ntri_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(da);(function(b){var c,e=E.vertex_index_bytes*4+E.material_index_bytes,f=b+E.nquad_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})(ha);(function(b){var c,
+e=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*4,f=b+E.nquad_smooth*e;for(c=b;c<f;c+=e)z(c);return f-b})(ma);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
 THREE.ColladaLoader=function(){function b(b,c,e){for(var b=da.evaluate(b,da,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},k=b.iterateNext(),h=0;k;){k=(new c).parse(k);if(k.id.length==0)k.id=e+h++;f[k.id]=k;k=b.iterateNext()}return f}function c(){var b=1E6,c=-b,e=0,f;for(f in K)for(var k=K[f],h=0;h<k.sampler.length;h++){var m=k.sampler[h];m.create();b=Math.min(b,m.startTime);c=Math.max(c,m.endTime);e=Math.max(e,m.input.length)}return{start:b,end:c,frames:e}}function e(b,c,f,k){b.world=b.world||
 new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var h=b.channels[0].sampler.output[f];h instanceof THREE.Matrix4&&b.world.copy(h)}k&&b.world.multiply(k,b.world);c.push(b);for(k=0;k<b.nodes.length;k++)e(b.nodes[k],c,f,b.world)}function f(b,f,k){var h=P[f.url];if(!h||!h.skin)console.log("could not find skin controller!");else if(!f.skeleton||!f.skeleton.length)console.log("could not find the skeleton for the skin!");else{var m=c(),f=$.getChildById(f.skeleton[0],!0)||$.getChildBySid(f.skeleton[0],
 !0),n,o,p,t,u=new THREE.Vector3,v;for(n=0;n<b.vertices.length;n++)h.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(k=0;k<m.frames;k++){var w=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));e(f,w,k);n=w;o=h.skin;for(t=0;t<n.length;t++){p=n[t];v=-1;for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];
@@ -566,7 +567,7 @@ new z,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_materia
 v.material;t++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(t>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)t=n.faces[j],t.materials=[p[t.daeMaterial]]}if(e!==void 0)f(n,e),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=e.skeleton,o.skinController=P[e.url],o.skinInstanceController=e,o.name="skin_"+Ba.length,Ba.push(o);else if(k!==void 0){p=n;t=k instanceof x?P[k.url]:k;if(!t||!t.morph)console.log("could not find morph controller!");
 else{t=t.morph;for(v=0;v<t.targets.length;v++){var w=na[t.targets[v]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:w.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+za.length;za.push(o)}else o=new THREE.Mesh(n,o);c.add(o)}}for(m=0;m<b.nodes.length;m++)c.add(h(b.nodes[m],b));return c}function k(){this.init_from=
 this.id=""}function m(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function p(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function u(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function w(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function t(){this.type=
-this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function v(){this.target=this.symbol=""}function z(){this.url="";this.instance_material=[]}function y(){this.id="";this.mesh=null}function B(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function A(){}function E(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){this.source="";
+this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function v(){this.target=this.symbol=""}function z(){this.url="";this.instance_material=[]}function y(){this.id="";this.mesh=null}function B(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function A(){}function D(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function E(){this.source="";
 this.stride=this.count=0;this.params=[]}function F(){this.input={}}function O(){this.semantic="";this.offset=0;this.source="";this.set=0}function R(b){this.id=b;this.type=null}function L(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function J(b,c){this.type=b;this.effect=c;this.material=null}function Z(b){this.effect=b;this.format=this.init_from=
 null}function I(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Q(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function X(){this.url=""}function V(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function W(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
 this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function fa(b){var c=b.getAttribute("id");if(ma[c]!=void 0)return ma[c];ma[c]=(new R(c)).parse(b);return ma[c]}function T(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function oa(b){for(var b=ja(b),c=[],e=0;e<b.length;e++)c.push(parseFloat(b[e]));return c}function aa(b){for(var b=ja(b),c=[],e=0;e<b.length;e++)c.push(parseInt(b[e],10));return c}function ja(b){return b.replace(/^\s+/,"").replace(/\s+$/,
@@ -588,14 +589,14 @@ this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],th
 x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "skeleton":this.skeleton.push(e.textContent.replace(/^#/,""));break;case "bind_material":if(e=da.evaluate(".//dae:instance_material",e,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=e.iterateNext();f;)this.instance_material.push((new v).parse(f)),f=e.iterateNext()}}return this};
 v.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};z.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1&&e.nodeName=="bind_material"){if(b=da.evaluate(".//dae:instance_material",e,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=b.iterateNext();c;)this.instance_material.push((new v).parse(c)),
 c=b.iterateNext();break}}return this};y.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "mesh":this.mesh=(new B(this)).parse(e)}}return this};B.prototype.parse=function(b){function c(b,e){var f=ga(b.position);k[f]===void 0&&(k[f]={v:b,index:e});return k[f]}this.primitives=[];var e;for(e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];switch(f.nodeName){case "source":fa(f);break;case "vertices":this.vertices=
-(new F).parse(f);break;case "triangles":this.primitives.push((new E).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new A).parse(f))}}var k={};this.geometry3js=new THREE.Geometry;f=ma[this.vertices.input.POSITION.source].data;for(b=e=0;e<f.length;e+=3,b++){var h=new THREE.Vertex(new THREE.Vector3(f[e],f[e+1],f[e+2]));c(h,b);this.geometry3js.vertices.push(h)}for(e=0;e<this.primitives.length;e++)primitive=this.primitives[e],primitive.setVertices(this.vertices),
+(new F).parse(f);break;case "triangles":this.primitives.push((new D).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new A).parse(f))}}var k={};this.geometry3js=new THREE.Geometry;f=ma[this.vertices.input.POSITION.source].data;for(b=e=0;e<f.length;e+=3,b++){var h=new THREE.Vertex(new THREE.Vector3(f[e],f[e+1],f[e+2]));c(h,b);this.geometry3js.vertices.push(h)}for(e=0;e<this.primitives.length;e++)primitive=this.primitives[e],primitive.setVertices(this.vertices),
 this.handlePrimitive(primitive,this.geometry3js,k);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};B.prototype.handlePrimitive=function(b,c,e){var f=0,k,h,m=b.p,n=b.inputs,o,p,t,u=0,v=3,w=[];for(k=0;k<n.length;k++)switch(o=n[k],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},B=[];b.vcount&&(v=b.vcount[u++]);for(k=0;k<v;k++)for(h=0;h<n.length;h++)switch(o=
 n[h],source=ma[o.source],p=m[f+k*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=ga(c.vertices[p].position);x.push(e[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[t],source.data[t+1]));break;case "COLOR":B.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var A;v==
-3?A=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],B.length?B:new THREE.Color):v==4&&(A=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],B.length?B:new THREE.Color));A.daeMaterial=b.material;c.faces.push(A);for(h=0;h<w.length;h++)k=z[w[h]],c.faceVertexUvs[h].push([k[0],k[1],k[2]]);f+=n.length*v}};A.prototype=new E;A.prototype.constructor=A;E.prototype.setVertices=function(b){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==b.id)this.inputs[c].source=b.input.POSITION.source};
-E.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=ca(b,"count",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "input":this.inputs.push((new O).parse(b.childNodes[c]));break;case "vcount":this.vcount=aa(e.textContent);break;case "p":this.p=aa(e.textContent)}}return this};D.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=ca(b,"count",0);this.stride=ca(b,"stride",0);for(var c=
+3?A=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],B.length?B:new THREE.Color):v==4&&(A=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],B.length?B:new THREE.Color));A.daeMaterial=b.material;c.faces.push(A);for(h=0;h<w.length;h++)k=z[w[h]],c.faceVertexUvs[h].push([k[0],k[1],k[2]]);f+=n.length*v}};A.prototype=new D;A.prototype.constructor=A;D.prototype.setVertices=function(b){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==b.id)this.inputs[c].source=b.input.POSITION.source};
+D.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=ca(b,"count",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "input":this.inputs.push((new O).parse(b.childNodes[c]));break;case "vcount":this.vcount=aa(e.textContent);break;case "p":this.p=aa(e.textContent)}}return this};E.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=ca(b,"count",0);this.stride=ca(b,"stride",0);for(var c=
 0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName=="param"){var f={};f.name=e.getAttribute("name");f.type=e.getAttribute("type");this.params.push(f)}}return this};F.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++)b.childNodes[c].nodeName=="input"&&(input=(new O).parse(b.childNodes[c]),this.input[input.semantic]=input);return this};O.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,
 "");this.set=ca(b,"set",-1);this.offset=ca(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};R.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "bool_array":for(var f=ja(e.textContent),k=[],h=0;h<f.length;h++)k.push(f[h]=="true"||f[h]=="1"?!0:!1);this.data=k;this.type=e.nodeName;break;case "float_array":this.data=oa(e.textContent);this.type=e.nodeName;break;case "int_array":this.data=
-aa(e.textContent);this.type=e.nodeName;break;case "IDREF_array":case "Name_array":this.data=ja(e.textContent);this.type=e.nodeName;break;case "technique_common":for(f=0;f<e.childNodes.length;f++)if(e.childNodes[f].nodeName=="accessor"){this.accessor=(new D).parse(e.childNodes[f]);break}}}return this};R.prototype.read=function(){var b=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var e=
+aa(e.textContent);this.type=e.nodeName;break;case "IDREF_array":case "Name_array":this.data=ja(e.textContent);this.type=e.nodeName;break;case "technique_common":for(f=0;f<e.childNodes.length;f++)if(e.childNodes[f].nodeName=="accessor"){this.accessor=(new E).parse(e.childNodes[f]);break}}}return this};R.prototype.read=function(){var b=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var e=
 this.data.slice(c,c+16),f=new THREE.Matrix4;f.set(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+c.type)}return b};L.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var c=0;c<b.childNodes.length;c++)if(b.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new X).parse(b.childNodes[c]);break}return this};G.prototype.isColor=
 function(){return this.texture==null};G.prototype.isTexture=function(){return this.texture!=null};G.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "color":e=oa(e.textContent);this.color=new THREE.Color(0);this.color.setRGB(e[0],e[1],e[2]);this.color.a=e[3];break;case "texture":this.texture=e.getAttribute("texture"),this.texcoord=e.getAttribute("texcoord")}}return this};J.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=
 b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[e.nodeName]=(new G).parse(e);break;case "shininess":case "reflectivity":case "transparency":var f;f=da.evaluate(".//dae:float",e,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var k=f.iterateNext(),h=[];k;)h.push(k),k=f.iterateNext();f=h;f.length>0&&(this[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};J.prototype.create=function(){var b=
@@ -612,19 +613,19 @@ document.implementation.createDocument){document.implementation.createDocument("
 L,"material");va=b("//dae:library_effects/dae:effect",Q,"effect");na=b("//dae:library_geometries/dae:geometry",y,"geometry");P=b("//dae:library_controllers/dae:controller",m,"controller");K=b("//dae:library_animations/dae:animation",V,"animation");Ca=b(".//dae:library_visual_scenes/dae:visual_scene",u,"visual_scene");za=[];Ba=[];(p=da.evaluate(".//dae:scene/dae:instance_visual_scene",da,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),$=Ca[p]):
 $=null;U=new THREE.Object3D;for(p=0;p<$.nodes.length;p++)U.add(h($.nodes[p]));c();for(var t in K);t={scene:U,morphs:za,skins:Ba,dae:{images:ua,materials:ra,effects:va,geometries:na,controllers:P,animations:K,visualScenes:Ca,scene:$}};o&&o(t)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Ga=b},applySkin:f,geometries:na}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
 THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,h=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,h);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,h,p,u,w,t,x,v,z,y,B,A,E,D,F=b.faces;t=b.vertices;var O=b.normals,R=b.colors,L=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&L++;for(e=0;e<L;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];u=0;for(w=t.length;u<w;)x=new THREE.Vertex,x.position.x=t[u++]*c,x.position.y=
-t[u++]*c,x.position.z=t[u++]*c,f.vertices.push(x);u=0;for(w=F.length;u<w;){c=F[u++];t=c&1;p=c&2;e=c&4;h=c&8;v=c&16;x=c&32;y=c&64;c&=128;t?(B=new THREE.Face4,B.a=F[u++],B.b=F[u++],B.c=F[u++],B.d=F[u++],t=4):(B=new THREE.Face3,B.a=F[u++],B.b=F[u++],B.c=F[u++],t=3);if(p)p=F[u++],B.materials=f.materials[p];p=f.faces.length;if(e)for(e=0;e<L;e++)A=b.uvs[e],z=F[u++],D=A[z*2],z=A[z*2+1],f.faceUvs[e][p]=new THREE.UV(D,z);if(h)for(e=0;e<L;e++){A=b.uvs[e];E=[];for(h=0;h<t;h++)z=F[u++],D=A[z*2],z=A[z*2+1],E[h]=
-new THREE.UV(D,z);f.faceVertexUvs[e][p]=E}if(v)v=F[u++]*3,h=new THREE.Vector3,h.x=O[v++],h.y=O[v++],h.z=O[v],B.normal=h;if(x)for(e=0;e<t;e++)v=F[u++]*3,h=new THREE.Vector3,h.x=O[v++],h.y=O[v++],h.z=O[v],B.vertexNormals.push(h);if(y)x=F[u++],x=new THREE.Color(R[x]),B.color=x;if(c)for(e=0;e<t;e++)x=F[u++],x=new THREE.Color(R[x]),B.vertexColors.push(x);f.faces.push(B)}}})(h);(function(){var c,e,h,p;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],p=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,h,p,u,w,t,x,v,z,y,B,A,D,E,F=b.faces;t=b.vertices;var O=b.normals,R=b.colors,L=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&L++;for(e=0;e<L;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];u=0;for(w=t.length;u<w;)x=new THREE.Vertex,x.position.x=t[u++]*c,x.position.y=
+t[u++]*c,x.position.z=t[u++]*c,f.vertices.push(x);u=0;for(w=F.length;u<w;){c=F[u++];t=c&1;p=c&2;e=c&4;h=c&8;v=c&16;x=c&32;y=c&64;c&=128;t?(B=new THREE.Face4,B.a=F[u++],B.b=F[u++],B.c=F[u++],B.d=F[u++],t=4):(B=new THREE.Face3,B.a=F[u++],B.b=F[u++],B.c=F[u++],t=3);if(p)p=F[u++],B.materials=f.materials[p];p=f.faces.length;if(e)for(e=0;e<L;e++)A=b.uvs[e],z=F[u++],E=A[z*2],z=A[z*2+1],f.faceUvs[e][p]=new THREE.UV(E,z);if(h)for(e=0;e<L;e++){A=b.uvs[e];D=[];for(h=0;h<t;h++)z=F[u++],E=A[z*2],z=A[z*2+1],D[h]=
+new THREE.UV(E,z);f.faceVertexUvs[e][p]=D}if(v)v=F[u++]*3,h=new THREE.Vector3,h.x=O[v++],h.y=O[v++],h.z=O[v],B.normal=h;if(x)for(e=0;e<t;e++)v=F[u++]*3,h=new THREE.Vector3,h.x=O[v++],h.y=O[v++],h.z=O[v],B.vertexNormals.push(h);if(y)x=F[u++],x=new THREE.Color(R[x]),B.color=x;if(c)for(e=0;e<t;e++)x=F[u++],x=new THREE.Color(R[x]),B.vertexColors.push(x);f.faces.push(B)}}})(h);(function(){var c,e,h,p;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],p=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
 p,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],p=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,p,u,w,t,x,v,z;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];v=f.morphTargets[e].vertices;z=b.morphTargets[e].vertices;p=0;for(u=z.length;p<u;p+=3)w=z[p]*c,t=z[p+1]*
 c,x=z[p+2]*c,v.push(new THREE.Vertex(new THREE.Vector3(w,t,x)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];u=f.morphColors[e].colors;w=b.morphColors[e].colors;c=0;for(p=w.length;c<p;c+=3)t=new THREE.Color(16755200),t.setRGB(w[c],w[c+1],w[c+2]),u.push(t)}}})(h);f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:h+"/"+b}function n(){for(v in Q.objects)if(!T.objects[v])if(E=Q.objects[v],E.geometry!==void 0){if(R=T.geometries[E.geometry]){var b=!1;Z=[];for(aa=0;aa<E.materials.length;aa++)Z[aa]=T.materials[E.materials[aa]],b=Z[aa]instanceof THREE.ShaderMaterial;b&&R.computeTangents();D=E.position;r=E.rotation;
-q=E.quaternion;s=E.scale;q=0;Z.length==0&&(Z[0]=new THREE.MeshFaceMaterial);Z.length>1&&(Z=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(R,Z);object.name=v;object.position.set(D[0],D[1],D[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=E.visible;T.scene.add(object);T.objects[v]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),T.scene.collisions.colliders.push(b));
-if(E.castsShadow)b=new THREE.ShadowVolume(R),T.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}}else D=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(D[0],D[1],D[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=E.visible!==void 0?E.visible:!1,T.scene.add(object),T.objects[v]=object,T.empties[v]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}function p(b){return function(c){T.geometries[b]=c;n();V-=1;e.onLoadComplete();w()}}function u(b){return function(c){T.geometries[b]=c}}function w(){e.callbackProgress({totalModels:o,totalTextures:fa,loadedModels:o-V,loadedTextures:fa-W},T);e.onLoadProgress();V==0&&W==0&&c(T)}var t,
-x,v,z,y,B,A,E,D,F,O,R,L,G,J,Z,I,Q,X,V,W,o,fa,T;Q=b.data;J=new THREE.BinaryLoader;X=new THREE.JSONLoader;W=V=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in Q.objects)if(E=Q.objects[v],E.meshCollider){b=!0;break}if(b)T.scene.collisions=new THREE.CollisionSystem;if(Q.transform){b=Q.transform.position;F=Q.transform.rotation;var oa=Q.transform.scale;b&&T.scene.position.set(b[0],b[1],b[2]);F&&T.scene.rotation.set(F[0],
-F[1],F[2]);oa&&T.scene.scale.set(oa[0],oa[1],oa[2]);(b||F||oa)&&T.scene.updateMatrix()}b=function(){W-=1;w();e.onLoadComplete()};for(y in Q.cameras){F=Q.cameras[y];if(F.type=="perspective")L=new THREE.Camera(F.fov,F.aspect,F.near,F.far),L.useTarget=!0;else if(F.type=="ortho")L=new THREE.Camera,L.useTarget=!0,L.projectionMatrix=THREE.Matrix4.makeOrtho(F.left,F.right,F.top,F.bottom,F.near,F.far);D=F.position;F=F.target;L.position.set(D[0],D[1],D[2]);L.target.position.set(F[0],F[1],F[2]);T.cameras[y]=
-L}for(z in Q.lights)y=Q.lights[z],L=y.color!==void 0?y.color:16777215,F=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(D=y.direction,I=new THREE.DirectionalLight(L,F),I.position.set(D[0],D[1],D[2]),I.position.normalize()):y.type=="point"?(D=y.position,d=y.distance,I=new THREE.PointLight(L,F,d),I.position.set(D[0],D[1],D[2])):y.type=="ambient"&&(I=new THREE.AmbientLight(L)),T.scene.add(I),T.lights[z]=I;for(B in Q.fogs)z=Q.fogs[B],z.type=="linear"?G=new THREE.Fog(0,z.near,z.far):z.type==
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:h+"/"+b}function n(){for(v in Q.objects)if(!T.objects[v])if(D=Q.objects[v],D.geometry!==void 0){if(R=T.geometries[D.geometry]){var b=!1;Z=[];for(aa=0;aa<D.materials.length;aa++)Z[aa]=T.materials[D.materials[aa]],b=Z[aa]instanceof THREE.ShaderMaterial;b&&R.computeTangents();E=D.position;r=D.rotation;
+q=D.quaternion;s=D.scale;q=0;Z.length==0&&(Z[0]=new THREE.MeshFaceMaterial);Z.length>1&&(Z=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(R,Z);object.name=v;object.position.set(E[0],E[1],E[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;T.scene.add(object);T.objects[v]=object;D.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),T.scene.collisions.colliders.push(b));
+if(D.castsShadow)b=new THREE.ShadowVolume(R),T.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},T.triggers[object.name]=b)}}else E=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(E[0],E[1],E[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
+s[1],s[2]),object.visible=D.visible!==void 0?D.visible:!1,T.scene.add(object),T.objects[v]=object,T.empties[v]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},T.triggers[object.name]=b)}function p(b){return function(c){T.geometries[b]=c;n();V-=1;e.onLoadComplete();w()}}function u(b){return function(c){T.geometries[b]=c}}function w(){e.callbackProgress({totalModels:o,totalTextures:fa,loadedModels:o-V,loadedTextures:fa-W},T);e.onLoadProgress();V==0&&W==0&&c(T)}var t,
+x,v,z,y,B,A,D,E,F,O,R,L,G,J,Z,I,Q,X,V,W,o,fa,T;Q=b.data;J=new THREE.BinaryLoader;X=new THREE.JSONLoader;W=V=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in Q.objects)if(D=Q.objects[v],D.meshCollider){b=!0;break}if(b)T.scene.collisions=new THREE.CollisionSystem;if(Q.transform){b=Q.transform.position;F=Q.transform.rotation;var oa=Q.transform.scale;b&&T.scene.position.set(b[0],b[1],b[2]);F&&T.scene.rotation.set(F[0],
+F[1],F[2]);oa&&T.scene.scale.set(oa[0],oa[1],oa[2]);(b||F||oa)&&T.scene.updateMatrix()}b=function(){W-=1;w();e.onLoadComplete()};for(y in Q.cameras){F=Q.cameras[y];if(F.type=="perspective")L=new THREE.Camera(F.fov,F.aspect,F.near,F.far),L.useTarget=!0;else if(F.type=="ortho")L=new THREE.Camera,L.useTarget=!0,L.projectionMatrix=THREE.Matrix4.makeOrtho(F.left,F.right,F.top,F.bottom,F.near,F.far);E=F.position;F=F.target;L.position.set(E[0],E[1],E[2]);L.target.position.set(F[0],F[1],F[2]);T.cameras[y]=
+L}for(z in Q.lights)y=Q.lights[z],L=y.color!==void 0?y.color:16777215,F=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(E=y.direction,I=new THREE.DirectionalLight(L,F),I.position.set(E[0],E[1],E[2]),I.position.normalize()):y.type=="point"?(E=y.position,d=y.distance,I=new THREE.PointLight(L,F,d),I.position.set(E[0],E[1],E[2])):y.type=="ambient"&&(I=new THREE.AmbientLight(L)),T.scene.add(I),T.lights[z]=I;for(B in Q.fogs)z=Q.fogs[B],z.type=="linear"?G=new THREE.Fog(0,z.near,z.far):z.type==
 "exp2"&&(G=new THREE.FogExp2(0,z.density)),F=z.color,G.color.setRGB(F[0],F[1],F[2]),T.fogs[B]=G;if(T.cameras&&Q.defaults.camera)T.currentCamera=T.cameras[Q.defaults.camera];if(T.fogs&&Q.defaults.fog)T.scene.fog=T.fogs[Q.defaults.fog];F=Q.defaults.bgcolor;T.bgColor=new THREE.Color;T.bgColor.setRGB(F[0],F[1],F[2]);T.bgColorAlpha=Q.defaults.bgalpha;for(t in Q.geometries)if(B=Q.geometries[t],B.type=="bin_mesh"||B.type=="ascii_mesh")V+=1,e.onLoadStart();o=V;for(t in Q.geometries)B=Q.geometries[t],B.type==
 "cube"?(R=new THREE.CubeGeometry(B.width,B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),T.geometries[t]=R):B.type=="plane"?(R=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),T.geometries[t]=R):B.type=="sphere"?(R=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),T.geometries[t]=R):B.type=="cylinder"?(R=new THREE.CylinderGeometry(B.topRad,B.botRad,B.height,B.radSegs,B.heightSegs),T.geometries[t]=R):B.type=="torus"?
 (R=new THREE.TorusGeometry(B.radius,B.tube,B.segmentsR,B.segmentsT),T.geometries[t]=R):B.type=="icosahedron"?(R=new THREE.IcosahedronGeometry(B.subdivisions),T.geometries[t]=R):B.type=="bin_mesh"?J.load({model:f(B.url,Q.urlBaseType),callback:p(t)}):B.type=="ascii_mesh"?X.load({model:f(B.url,Q.urlBaseType),callback:p(t)}):B.type=="embedded_mesh"&&(B=Q.embeds[B.id])&&X.createModel(B,u(t),"");for(A in Q.textures)if(t=Q.textures[A],t.url instanceof Array){W+=t.url.length;for(J=0;J<t.url.length;J++)e.onLoadStart()}else W+=
@@ -637,18 +638,18 @@ THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.const
 THREE.UTF8Loader.prototype.load=function(b){var c=new XMLHttpRequest,e=b.model,f=b.callback,h=b.scale!==void 0?b.scale:1,k=b.offsetX!==void 0?b.offsetX:0,m=b.offsetY!==void 0?b.offsetY:0,n=b.offsetZ!==void 0?b.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,f,h,k,m,n):alert("Couldn't load ["+e+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",e,!0);c.send(null)};
 THREE.UTF8Loader.prototype.decompressMesh=function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var k=0,m=0;m<c;++m){var n=b.charCodeAt(m+f);k+=n>>1^-(n&1);e[8*m+h]=k}f+=c}c=b.length-f;k=new Uint16Array(c);for(h=m=0;h<c;h++)n=b.charCodeAt(h+f),k[h]=m-n,n==0&&m++;return[e,k]};
 THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,k){var m=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var m=THREE.UTF8Loader.prototype.decompressMesh(b),u=[],w=[];(function(b,m,p){for(var u,w,B,A=b.length;p<A;p+=m)u=b[p],w=b[p+1],B=b[p+2],u=u/16383*e,w=w/16383*e,B=B/16383*e,u+=f,w+=h,B+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(u,w,B)))})(m[0],8,0);(function(b,c,e){for(var f,h,k=b.length;e<k;e+=c)f=b[e],h=b[e+1],f/=1023,h/=1023,w.push(f,1-h)})(m[0],8,3);(function(b,
-c,e){for(var f,h,k,m=b.length;e<m;e+=c)f=b[e],h=b[e+1],k=b[e+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,u.push(f,h,k)})(m[0],8,5);(function(b){var e,f,h,k,m,p,E,D,F,O=b.length;for(e=0;e<O;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;D=f;F=h;p=k;E=f;var R=h,L=k,G=m.materials[0],J=u[R*3],Z=u[R*3+1],R=u[R*3+2],I=u[L*3],Q=u[L*3+1],L=u[L*3+2];E=new THREE.Vector3(u[E*3],u[E*3+1],u[E*3+2]);R=new THREE.Vector3(J,Z,R);L=new THREE.Vector3(I,Q,L);m.faces.push(new THREE.Face3(D,F,p,[E,R,L],null,G));m=w[f*2];f=w[f*2+
-1];p=w[h*2];E=w[h*2+1];D=w[k*2];F=w[k*2+1];k=c.faceVertexUvs[0];h=p;p=E;E=[];E.push(new THREE.UV(m,f));E.push(new THREE.UV(h,p));E.push(new THREE.UV(D,F));k.push(E)}})(m[1]);this.computeCentroids();this.computeFaceNormals()};m.prototype=new THREE.Geometry;m.prototype.constructor=m;c(new m)};
+c,e){for(var f,h,k,m=b.length;e<m;e+=c)f=b[e],h=b[e+1],k=b[e+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,u.push(f,h,k)})(m[0],8,5);(function(b){var e,f,h,k,m,p,D,E,F,O=b.length;for(e=0;e<O;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;E=f;F=h;p=k;D=f;var R=h,L=k,G=m.materials[0],J=u[R*3],Z=u[R*3+1],R=u[R*3+2],I=u[L*3],Q=u[L*3+1],L=u[L*3+2];D=new THREE.Vector3(u[D*3],u[D*3+1],u[D*3+2]);R=new THREE.Vector3(J,Z,R);L=new THREE.Vector3(I,Q,L);m.faces.push(new THREE.Face3(E,F,p,[D,R,L],null,G));m=w[f*2];f=w[f*2+
+1];p=w[h*2];D=w[h*2+1];E=w[k*2];F=w[k*2+1];k=c.faceVertexUvs[0];h=p;p=D;D=[];D.push(new THREE.UV(m,f));D.push(new THREE.UV(h,p));D.push(new THREE.UV(E,F));k.push(D)}})(m[1]);this.computeCentroids();this.computeFaceNormals()};m.prototype=new THREE.Geometry;m.prototype.constructor=m;c(new m)};
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,h){return b+(c-b)*h};this.VIntX=function(b,c,h,k,m,n,p,u,w,t){m=(m-w)/(t-w);w=this.normal_cache;c[k]=n+m*this.delta;c[k+1]=p;c[k+2]=u;h[k]=this.lerp(w[b],w[b+3],m);h[k+1]=this.lerp(w[b+1],w[b+4],m);h[k+2]=this.lerp(w[b+2],w[b+5],m)};this.VIntY=function(b,c,h,k,m,n,p,u,w,t){m=(m-w)/(t-w);w=this.normal_cache;c[k]=n;c[k+1]=p+m*this.delta;c[k+
 2]=u;c=b+this.yd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};this.VIntZ=function(b,c,h,k,m,n,p,u,w,t){m=(m-w)/(t-w);w=this.normal_cache;c[k]=n;c[k+1]=p;c[k+2]=u+m*this.delta;c=b+this.zd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
-this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,k,m,n){var p=k+1,u=k+this.yd,w=k+this.zd,t=p+this.yd,x=p+this.zd,v=k+this.yd+this.zd,z=p+this.yd+this.zd,y=0,B=this.field[k],A=this.field[p],E=this.field[u],D=this.field[t],F=this.field[w],O=this.field[x],R=this.field[v],L=this.field[z];B<m&&(y|=1);A<m&&(y|=2);E<m&&(y|=8);D<m&&(y|=4);F<m&&(y|=16);O<m&&(y|=32);R<m&&(y|=128);L<m&&(y|=64);var G=THREE.edgeTable[y];if(G==0)return 0;var J=this.delta,
-Z=b+J,I=c+J,J=h+J;G&1&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,B,A));G&2&&(this.compNorm(p),this.compNorm(t),this.VIntY(p*3,this.vlist,this.nlist,3,m,Z,c,h,A,D));G&4&&(this.compNorm(u),this.compNorm(t),this.VIntX(u*3,this.vlist,this.nlist,6,m,b,I,h,E,D));G&8&&(this.compNorm(k),this.compNorm(u),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,B,E));G&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,J,F,O));G&32&&(this.compNorm(x),
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,k,m,n){var p=k+1,u=k+this.yd,w=k+this.zd,t=p+this.yd,x=p+this.zd,v=k+this.yd+this.zd,z=p+this.yd+this.zd,y=0,B=this.field[k],A=this.field[p],D=this.field[u],E=this.field[t],F=this.field[w],O=this.field[x],R=this.field[v],L=this.field[z];B<m&&(y|=1);A<m&&(y|=2);D<m&&(y|=8);E<m&&(y|=4);F<m&&(y|=16);O<m&&(y|=32);R<m&&(y|=128);L<m&&(y|=64);var G=THREE.edgeTable[y];if(G==0)return 0;var J=this.delta,
+Z=b+J,I=c+J,J=h+J;G&1&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,B,A));G&2&&(this.compNorm(p),this.compNorm(t),this.VIntY(p*3,this.vlist,this.nlist,3,m,Z,c,h,A,E));G&4&&(this.compNorm(u),this.compNorm(t),this.VIntX(u*3,this.vlist,this.nlist,6,m,b,I,h,D,E));G&8&&(this.compNorm(k),this.compNorm(u),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,B,D));G&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,J,F,O));G&32&&(this.compNorm(x),
 this.compNorm(z),this.VIntY(x*3,this.vlist,this.nlist,15,m,Z,c,J,O,L));G&64&&(this.compNorm(v),this.compNorm(z),this.VIntX(v*3,this.vlist,this.nlist,18,m,b,I,J,R,L));G&128&&(this.compNorm(w),this.compNorm(v),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,J,F,R));G&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,B,F));G&512&&(this.compNorm(p),this.compNorm(x),this.VIntZ(p*3,this.vlist,this.nlist,27,m,Z,c,h,A,O));G&1024&&(this.compNorm(t),this.compNorm(z),this.VIntZ(t*
-3,this.vlist,this.nlist,30,m,Z,I,h,D,L));G&2048&&(this.compNorm(u),this.compNorm(v),this.VIntZ(u*3,this.vlist,this.nlist,33,m,b,I,h,E,R));y<<=4;for(m=k=0;THREE.triTable[y+m]!=-1;)b=y+m,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),m+=3,k++;return k};this.posnormtriv=function(b,c,h,k,m,n){var p=this.count*3;this.positionArray[p]=b[h];this.positionArray[p+1]=b[h+1];this.positionArray[p+2]=b[h+2];this.positionArray[p+3]=b[k];this.positionArray[p+
+3,this.vlist,this.nlist,30,m,Z,I,h,E,L));G&2048&&(this.compNorm(u),this.compNorm(v),this.VIntZ(u*3,this.vlist,this.nlist,33,m,b,I,h,D,R));y<<=4;for(m=k=0;THREE.triTable[y+m]!=-1;)b=y+m,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),m+=3,k++;return k};this.posnormtriv=function(b,c,h,k,m,n){var p=this.count*3;this.positionArray[p]=b[h];this.positionArray[p+1]=b[h+1];this.positionArray[p+2]=b[h+2];this.positionArray[p+3]=b[k];this.positionArray[p+
 4]=b[k+1];this.positionArray[p+5]=b[k+2];this.positionArray[p+6]=b[m];this.positionArray[p+7]=b[m+1];this.positionArray[p+8]=b[m+2];this.normalArray[p]=c[h];this.normalArray[p+1]=c[h+1];this.normalArray[p+2]=c[h+2];this.normalArray[p+3]=c[k];this.normalArray[p+4]=c[k+1];this.normalArray[p+5]=c[k+2];this.normalArray[p+6]=c[m];this.normalArray[p+7]=c[m+1];this.normalArray[p+8]=c[m+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&n(this)};this.begin=function(){this.count=0;
 this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,h,k,m){var n=this.size*Math.sqrt(k/m),p=h*this.size,u=c*this.size,w=b*this.size,t=Math.floor(p-n);t<1&&(t=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var x=Math.floor(u-n);x<1&&(x=1);u=Math.floor(u+n);u>this.size-1&&(u=this.size-1);var v=Math.floor(w-n);v<1&&(v=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size-
-1);for(var z,y,B,A,E,D;t<p;t++){w=this.size2*t;y=t/this.size-h;E=y*y;for(y=x;y<u;y++){B=w+this.size*y;z=y/this.size-c;D=z*z;for(z=v;z<n;z++)A=z/this.size-b,A=k/(1.0E-6+A*A+D+E)-m,A>0&&(this.field[B+z]+=A)}}};this.addPlaneX=function(b,c){var h,k,m,n,p,u=this.size,w=this.yd,t=this.zd,x=this.field,v=u*Math.sqrt(b/c);v>u&&(v=u);for(h=0;h<v;h++)if(k=h/u,k*=k,n=b/(1.0E-4+k)-c,n>0)for(k=0;k<u;k++){p=h+k*w;for(m=0;m<u;m++)x[t*m+p]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,p,u,w=this.size,t=this.yd,x=
+1);for(var z,y,B,A,D,E;t<p;t++){w=this.size2*t;y=t/this.size-h;D=y*y;for(y=x;y<u;y++){B=w+this.size*y;z=y/this.size-c;E=z*z;for(z=v;z<n;z++)A=z/this.size-b,A=k/(1.0E-6+A*A+E+D)-m,A>0&&(this.field[B+z]+=A)}}};this.addPlaneX=function(b,c){var h,k,m,n,p,u=this.size,w=this.yd,t=this.zd,x=this.field,v=u*Math.sqrt(b/c);v>u&&(v=u);for(h=0;h<v;h++)if(k=h/u,k*=k,n=b/(1.0E-4+k)-c,n>0)for(k=0;k<u;k++){p=h+k*w;for(m=0;m<u;m++)x[t*m+p]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,p,u,w=this.size,t=this.yd,x=
 this.zd,v=this.field,z=w*Math.sqrt(b/c);z>w&&(z=w);for(k=0;k<z;k++)if(h=k/w,h*=h,n=b/(1.0E-4+h)-c,n>0){p=k*t;for(h=0;h<w;h++){u=p+h;for(m=0;m<w;m++)v[x*m+u]+=n}}};this.addPlaneZ=function(b,c){var h,k,m,n,p,u;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(m=0;m<dist;m++)if(h=m/size,h*=h,n=b/(1.0E-4+h)-c,n>0){p=zd*m;for(k=0;k<size;k++){u=p+k*yd;for(h=0;h<size;h++)field[u+h]+=n}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
 3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,h,k,m,n,p,u,w,t,x=this.size-2;for(m=1;m<x;m++){t=this.size2*m;u=(m-this.halfsize)/this.halfsize;for(k=1;k<x;k++){w=t+this.size*k;p=(k-this.halfsize)/this.halfsize;for(h=1;h<x;h++)n=(h-this.halfsize)/this.halfsize,c=w+h,this.polygonize(n,p,u,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(k){var m,n,p,u,w,t,x,v;for(m=0;m<k.count;m++)x=m*3,w=x+1,v=x+2,n=k.positionArray[x],
 p=k.positionArray[w],u=k.positionArray[v],t=new THREE.Vector3(n,p,u),n=k.normalArray[x],p=k.normalArray[w],u=k.normalArray[v],x=new THREE.Vector3(n,p,u),x.normalize(),w=new THREE.Vertex(t),c.vertices.push(w),h.push(x);nfaces=k.count/3;for(m=0;m<nfaces;m++)x=(b+m)*3,w=x+1,v=x+2,t=h[x],n=h[w],p=h[v],x=new THREE.Face3(x,w,v,[t,n,p]),c.faces.push(x);b+=nfaces;k.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
@@ -695,7 +696,7 @@ THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionU
 THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
 if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,k=new THREE.Camera,m=new THREE.Matrix4,n=new THREE.Matrix4,p,u,w;h.useTarget=k.useTarget=!1;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.Camera(53,1,1,1E4);v.position.z=
 2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:x}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var z=new THREE.Scene;z.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||u!==e.near||w!==e.fov){p=e.aspect;u=e.near;w=e.fov;var A=e.projectionMatrix.clone(),E=125/30*0.5,D=E*u/125,F=u*Math.tan(w*Math.PI/360),O;m.n14=E;n.n14=-E;E=-F*p+D;O=F*p+D;A.n11=2*u/(O-E);A.n13=(O+E)/(O-E);h.projectionMatrix=A.clone();E=-F*p-D;O=F*p-D;A.n11=2*u/(O-E);A.n13=
-(O+E)/(O-E);k.projectionMatrix=A.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=u;h.far=e.far;f.call(c,b,h,t,!0);k.matrix=e.matrixWorld.clone().multiplySelf(m);k.update(null,!0);k.position.copy(e.position);k.near=u;k.far=e.far;f.call(c,b,k,x,!0);f.call(c,z,v)}};
+var z=new THREE.Scene;z.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||u!==e.near||w!==e.fov){p=e.aspect;u=e.near;w=e.fov;var A=e.projectionMatrix.clone(),D=125/30*0.5,E=D*u/125,F=u*Math.tan(w*Math.PI/360),O;m.n14=D;n.n14=-D;D=-F*p+E;O=F*p+E;A.n11=2*u/(O-D);A.n13=(O+D)/(O-D);h.projectionMatrix=A.clone();D=-F*p-E;O=F*p-E;A.n11=2*u/(O-D);A.n13=
+(O+D)/(O-D);k.projectionMatrix=A.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=u;h.far=e.far;f.call(c,b,h,t,!0);k.matrix=e.matrixWorld.clone().multiplySelf(m);k.update(null,!0);k.position.copy(e.position);k.near=u;k.far=e.far;f.call(c,b,k,x,!0);f.call(c,z,v)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,k,m=new THREE.Camera;m.useTarget=!0;var n=new THREE.Camera;n.useTarget=!0;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;this.setSize=function(b,f){e.call(c,b,f);h=b/2;k=f};this.render=function(b,e){this.clear();m.fov=e.fov;m.aspect=0.5*e.aspect;m.near=e.near;m.far=e.far;m.updateProjectionMatrix();m.position.copy(e.position);
 m.target.position.copy(e.target.position);m.translateX(c.separation);n.projectionMatrix=m.projectionMatrix;n.position.copy(e.position);n.target.position.copy(e.target.position);n.translateX(-c.separation);this.setViewport(0,0,h,k);f.call(c,b,m);this.setViewport(h,0,h,k);f.call(c,b,n,!1)}};

+ 40 - 24
examples/canvas_geometry_subdivison.html

@@ -27,6 +27,9 @@
 		<script src="../src/extras/geometries/SubdivisionGeometry.js"></script>
 		
 		<script src="fonts/helvetiker_regular.typeface.js"></script>
+		<!--
+		<script src="obj/WaltHead.js"></script>
+		-->
 		
 		<script>
 
@@ -39,23 +42,13 @@
 			var targetRotation = 0;
 			var targetRotationOnMouseDown = 0;
 
-			var mouseX = 0;
+			var mouseX = 0, mouseY = 0;
 			var mouseXOnMouseDown = 0;
 
 			var windowHalfX = window.innerWidth / 2;
 			var windowHalfY = window.innerHeight / 2;
 
 		
-			// Create subdivision geometry  
-			function createSubdivision(geometry, repeats) {
-				repeats = (repeats === undefined ) ? 1 : repeats;
-				var smooth = geometry;
-				while (repeats--) {
-					smooth = new THREE.SubdivisionGeometry(smooth);
-				}
-				return smooth;
-			}
-			
 			// Create new object by parameters
 			var createSomething = function(klass, args) {
 				var F = function(klass, args) {
@@ -113,11 +106,12 @@
 					geometry = createSomething(THREE[params.type], params.args);
 					
 					geometry.mergeVertices();
-					smooth = createSubdivision(geometry, subdivisions);
+					smooth = THREE.GeometryUtils.createSubdivision(geometry, subdivisions);
 					return smooth;
 				};
 				
 				
+				
 				var geometriesParams = [
 				
 					{type: 'CubeGeometry', args: [ 200, 200, 200, 2, 2, 2, materials ] }, 
@@ -130,18 +124,41 @@
 											curveSegments: 1,
 											font: "helvetiker"
 
-										}]}, 
+										}]}
 				
 				];
 				
-				smooth = createGeometry(3, 2);
+				smooth = createGeometry(0, 3);
 				
 				//geometry = new THREE.CubeGeometry( 200, 200, 200, 2, 2, 2, materials );
 				// make sure mergeVertices(); is run to fix quick duplicated vertices
 				// geometry.mergeVertices();
 				// smooth = createSubdivision(geometry, 2);
 				
+				var faceABCD = "abcd";
+				var color, f, p, n, vertexIndex;
+				for (i = 0; i < smooth.faces.length; i++ ) {
+				
+					f  = smooth.faces[ i ];
+				
+				
+					n = ( f instanceof THREE.Face3 ) ? 3 : 4;
+				
+					for( var j = 0; j < n; j++ ) {
+				
+						vertexIndex = f[ faceABCD.charAt( j ) ];
+				
+						p = smooth.vertices[ vertexIndex ].position;
 				
+						color = new THREE.Color( 0xffffff );
+						color.setHSV( ( p.y ) / 200 + 0.5, 1.0, 1.0 );
+						
+						f.vertexColors[ j ] = color;
+				
+				
+					}
+				
+				}
 
 
 
@@ -195,6 +212,7 @@
 				
 
 				var meshmaterials = [
+				 new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors } ),
 					new THREE.MeshBasicMaterial( { color: 0x405040, wireframe:true,  opacity:0.8 } )
 				];
 
@@ -216,14 +234,7 @@
 				cube.overdraw = true;
 				scene.add( cube );
 
-				// Plane
-
-				plane = new THREE.Mesh( new THREE.PlaneGeometry( 200, 200 ), new THREE.MeshBasicMaterial( { color: 0xe0e0e0 } ) );
-				plane.rotation.x = - 90 * ( Math.PI / 180 );
-				plane.overdraw = true;
-				scene.add( plane );
-
-				renderer = new THREE.CanvasRenderer(); // WebGLRenderer CanvasRenderer
+				renderer = new THREE.WebGLRenderer(); // WebGLRenderer CanvasRenderer
 				renderer.setSize( window.innerWidth, window.innerHeight );
 
 				container.appendChild( renderer.domElement );
@@ -255,8 +266,10 @@
 			function onDocumentMouseMove( event ) {
 
 				mouseX = event.clientX - windowHalfX;
-
+				mouseY = event.clientY - windowHalfY;
+				
 				targetRotation = targetRotationOnMouseDown + ( mouseX - mouseXOnMouseDown ) * 0.02;
+
 			}
 
 			function onDocumentMouseUp( event ) {
@@ -310,9 +323,12 @@
 
 			function render() {
 
-				group.rotation.y = plane.rotation.z = cube.rotation.y += ( targetRotation - cube.rotation.y ) * 0.05;
+				group.rotation.y = cube.rotation.y += ( targetRotation - cube.rotation.y ) * 0.05;
 				renderer.render( scene, camera );
 
+				cube.rotation.x = (mouseY/windowHalfY) * Math.PI;
+				//console.log(cube.rotation.x);
+
 			}
 
 		</script>

+ 17 - 0
src/extras/GeometryUtils.js

@@ -1,9 +1,26 @@
 /**
  * @author mrdoob / http://mrdoob.com/
  * @author alteredq / http://alteredqualia.com/
+ * @author zz85 / http://www.lab4games.net/zz85/blog/
  */
 
 THREE.GeometryUtils = {
+	
+	// Convience method for creating subdivision geometry  
+	
+	createSubdivision: function( geometry, repeats ) {
+		
+		repeats = (repeats === undefined ) ? 1 : repeats;
+		
+		var smooth = geometry;
+		
+		while (repeats--) {
+			smooth = new THREE.SubdivisionGeometry(smooth);
+		}
+		
+		return smooth;
+	},
+	
 
 	merge: function ( geometry1, object2 /* mesh | geometry */ ) {