Procházet zdrojové kódy

Merge remote-tracking branch 'remotes/mrdoob/dev' into dev

alteredq před 13 roky
rodič
revize
5253c6490e

+ 175 - 175
build/Three.js

@@ -1,6 +1,6 @@
 // Three.js r46dev - http://github.com/mrdoob/three.js
 // Three.js r46dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Clock=function(a){this.autoStart=a!==void 0?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.elapsedTime+=this.getDelta();return this.elapsedTime};
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Clock=function(a){this.autoStart=a!==void 0?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.elapsedTime+=this.getDelta();return this.elapsedTime};
-THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var c=Date.now(),a=0.0010*(c-this.oldTime);this.oldTime=c;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
+THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var c=Date.now(),a=0.001*(c-this.oldTime);this.oldTime=c;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
 THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;return this},setHSV:function(a,c,b){var d,g,e;if(b===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),g=a*6-d,a=b*(1-c),e=b*(1-
 THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;return this},setHSV:function(a,c,b){var d,g,e;if(b===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),g=a*6-d,a=b*(1-c),e=b*(1-
 c*g),c=b*(1-c*(1-g)),d){case 1:this.r=e;this.g=b;this.b=a;break;case 2:this.r=a;this.g=b;this.b=c;break;case 3:this.r=a;this.g=e;this.b=b;break;case 4:this.r=c;this.g=a;this.b=b;break;case 5:this.r=b;this.g=a;this.b=e;break;case 6:case 0:this.r=b,this.g=c,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 c*g),c=b*(1-c*(1-g)),d){case 1:this.r=e;this.g=b;this.b=a;break;case 2:this.r=a;this.g=b;this.b=c;break;case 3:this.r=a;this.g=e;this.b=b;break;case 4:this.r=c;this.g=a;this.b=b;break;case 5:this.r=b;this.g=a;this.b=e;break;case 6:case 0:this.r=b,this.g=c,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0};
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0};
@@ -28,7 +28,7 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,c=
 THREE.Matrix4=function(a,c,b,d,g,e,f,h,i,l,k,p,q,m,t,n){this.set(a!==void 0?a:1,c||0,b||0,d||0,g||0,e!==void 0?e:1,f||0,h||0,i||0,l||0,k!==void 0?k:1,p||0,q||0,m||0,t||0,n!==void 0?n:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
 THREE.Matrix4=function(a,c,b,d,g,e,f,h,i,l,k,p,q,m,t,n){this.set(a!==void 0?a:1,c||0,b||0,d||0,g||0,e!==void 0?e:1,f||0,h||0,i||0,l||0,k!==void 0?k:1,p||0,q||0,m||0,t||0,n!==void 0?n:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,d,g,e,f,h,i,l,k,p,q,m,t,n){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=g;this.n22=e;this.n23=f;this.n24=h;this.n31=i;this.n32=l;this.n33=k;this.n34=p;this.n41=q;this.n42=m;this.n43=t;this.n44=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,d,g,e,f,h,i,l,k,p,q,m,t,n){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=g;this.n22=e;this.n23=f;this.n24=h;this.n31=i;this.n32=l;this.n33=k;this.n34=p;this.n41=q;this.n42=m;this.n43=t;this.n44=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
 c,b){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,c).normalize();if(e.length()===0)e.z=1;d.cross(b,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(b,e).normalize());g.cross(e,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=e.x;this.n21=d.y;this.n22=g.y;this.n23=e.y;this.n31=d.z;this.n32=g.z;this.n33=e.z;return this},multiply:function(a,c){var b=a.n11,d=a.n12,g=a.n13,e=a.n14,f=a.n21,h=a.n22,i=a.n23,l=a.n24,k=a.n31,p=a.n32,q=a.n33,m=a.n34,t=a.n41,n=a.n42,o=a.n43,
 c,b){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,c).normalize();if(e.length()===0)e.z=1;d.cross(b,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(b,e).normalize());g.cross(e,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=e.x;this.n21=d.y;this.n22=g.y;this.n23=e.y;this.n31=d.z;this.n32=g.z;this.n33=e.z;return this},multiply:function(a,c){var b=a.n11,d=a.n12,g=a.n13,e=a.n14,f=a.n21,h=a.n22,i=a.n23,l=a.n24,k=a.n31,p=a.n32,q=a.n33,m=a.n34,t=a.n41,n=a.n42,o=a.n43,
-s=a.n44,u=c.n11,r=c.n12,z=c.n13,E=c.n14,G=c.n21,v=c.n22,w=c.n23,C=c.n24,F=c.n31,B=c.n32,L=c.n33,J=c.n34,W=c.n41,X=c.n42,T=c.n43,ea=c.n44;this.n11=b*u+d*G+g*F+e*W;this.n12=b*r+d*v+g*B+e*X;this.n13=b*z+d*w+g*L+e*T;this.n14=b*E+d*C+g*J+e*ea;this.n21=f*u+h*G+i*F+l*W;this.n22=f*r+h*v+i*B+l*X;this.n23=f*z+h*w+i*L+l*T;this.n24=f*E+h*C+i*J+l*ea;this.n31=k*u+p*G+q*F+m*W;this.n32=k*r+p*v+q*B+m*X;this.n33=k*z+p*w+q*L+m*T;this.n34=k*E+p*C+q*J+m*ea;this.n41=t*u+n*G+o*F+s*W;this.n42=t*r+n*v+o*B+s*X;this.n43=t*
+s=a.n44,u=c.n11,r=c.n12,z=c.n13,E=c.n14,G=c.n21,v=c.n22,w=c.n23,C=c.n24,F=c.n31,B=c.n32,L=c.n33,J=c.n34,X=c.n41,Y=c.n42,T=c.n43,ea=c.n44;this.n11=b*u+d*G+g*F+e*X;this.n12=b*r+d*v+g*B+e*Y;this.n13=b*z+d*w+g*L+e*T;this.n14=b*E+d*C+g*J+e*ea;this.n21=f*u+h*G+i*F+l*X;this.n22=f*r+h*v+i*B+l*Y;this.n23=f*z+h*w+i*L+l*T;this.n24=f*E+h*C+i*J+l*ea;this.n31=k*u+p*G+q*F+m*X;this.n32=k*r+p*v+q*B+m*Y;this.n33=k*z+p*w+q*L+m*T;this.n34=k*E+p*C+q*J+m*ea;this.n41=t*u+n*G+o*F+s*X;this.n42=t*r+n*v+o*B+s*Y;this.n43=t*
 z+n*w+o*L+s*T;this.n44=t*E+n*C+o*J+s*ea;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;
 z+n*w+o*L+s*T;this.n44=t*E+n*C+o*J+s*ea;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;
 this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,g=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*g;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*g;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,g=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*g;a.y=this.n21*
 this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,g=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*g;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*g;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,g=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*g;a.y=this.n21*
 c+this.n22*b+this.n23*d+this.n24*g;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*g;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*g;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*
 c+this.n22*b+this.n23*d+this.n24*g;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*g;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*g;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*
@@ -60,20 +60,20 @@ k,p,q=[],m,t=[],n,o,s=[],u,r,z=[],E={objects:[],sprites:[],lights:[],elements:[]
 a.n23,a.n44+a.n24);F[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);F[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);F[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=F[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);w.multiply(b.projectionMatrix,b.matrixWorldInverse);w.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
 a.n23,a.n44+a.n24);F[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);F[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);F[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=F[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);w.multiply(b.projectionMatrix,b.matrixWorldInverse);w.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
 w.multiply(b.matrixWorld,b.projectionMatrixInverse);w.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,d){e=0;E.objects.length=0;E.sprites.length=0;E.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
 w.multiply(b.matrixWorld,b.projectionMatrixInverse);w.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,d){e=0;E.objects.length=0;E.sprites.length=0;E.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
 e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=F[h].x*d.n14+F[h].y*d.n24+F[h].z*d.n34+F[h].w,c<=e){c=!1;break a}c=!0}c?(w.multiplyVector3(G.copy(b.position)),g=a(),g.object=b,g.z=G.z,E.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(w.multiplyVector3(G.copy(b.position)),g=a(),g.object=b,g.z=G.z,E.sprites.push(g)):b instanceof THREE.Light&&E.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
 e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=F[h].x*d.n14+F[h].y*d.n24+F[h].z*d.n34+F[h].w,c<=e){c=!1;break a}c=!0}c?(w.multiplyVector3(G.copy(b.position)),g=a(),g.object=b,g.z=G.z,E.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(w.multiplyVector3(G.copy(b.position)),g=a(),g.object=b,g.z=G.z,E.sprites.push(g)):b instanceof THREE.Light&&E.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
-E.objects.sort(b);return E};this.projectScene=function(a,e,g){var f=e.near,F=e.far,G,x,I,O,M,j,P,ha,V,Q,K,fa,U,ia,pa,na;r=o=m=p=0;E.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);w.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(w);E=this.projectGraph(a,!1);a=0;for(G=E.objects.length;a<G;a++)if(V=E.objects[a].object,Q=V.matrixWorld,
-fa=V.material,i=0,V instanceof THREE.Mesh){K=V.geometry;U=V.geometry.materials;O=K.vertices;ia=K.faces;pa=K.faceVertexUvs;K=V.matrixRotationWorld.extractRotation(Q);x=0;for(I=O.length;x<I;x++)h=c(),h.positionWorld.copy(O[x].position),Q.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),w.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<F;O=0;for(x=ia.length;O<x;O++){I=
-ia[O];if(I instanceof THREE.Face3)if(M=l[I.a],j=l[I.b],P=l[I.c],M.visible&&j.visible&&P.visible&&(V.doubleSided||V.flipSided!=(P.positionScreen.x-M.positionScreen.x)*(j.positionScreen.y-M.positionScreen.y)-(P.positionScreen.y-M.positionScreen.y)*(j.positionScreen.x-M.positionScreen.x)<0))ha=q[p]=q[p]||new THREE.RenderableFace3,p++,k=ha,k.v1.copy(M),k.v2.copy(j),k.v3.copy(P);else continue;else if(I instanceof THREE.Face4)if(M=l[I.a],j=l[I.b],P=l[I.c],ha=l[I.d],M.visible&&j.visible&&P.visible&&ha.visible&&
-(V.doubleSided||V.flipSided!=((ha.positionScreen.x-M.positionScreen.x)*(j.positionScreen.y-M.positionScreen.y)-(ha.positionScreen.y-M.positionScreen.y)*(j.positionScreen.x-M.positionScreen.x)<0||(j.positionScreen.x-P.positionScreen.x)*(ha.positionScreen.y-P.positionScreen.y)-(j.positionScreen.y-P.positionScreen.y)*(ha.positionScreen.x-P.positionScreen.x)<0)))na=t[m]=t[m]||new THREE.RenderableFace4,m++,k=na,k.v1.copy(M),k.v2.copy(j),k.v3.copy(P),k.v4.copy(ha);else continue;k.normalWorld.copy(I.normal);
-K.multiplyVector3(k.normalWorld);k.centroidWorld.copy(I.centroid);Q.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);w.multiplyVector3(k.centroidScreen);P=I.vertexNormals;M=0;for(j=P.length;M<j;M++)ha=k.vertexNormalsWorld[M],ha.copy(P[M]),K.multiplyVector3(ha);M=0;for(j=pa.length;M<j;M++)if(na=pa[M][O]){P=0;for(ha=na.length;P<ha;P++)k.uvs[M][P]=na[P]}k.material=fa;k.faceMaterial=I.materialIndex!==null?U[I.materialIndex]:null;k.z=k.centroidScreen.z;E.elements.push(k)}}else if(V instanceof
-THREE.Line){C.multiply(w,Q);O=V.geometry.vertices;M=c();M.positionScreen.copy(O[0].position);C.multiplyVector4(M.positionScreen);x=1;for(I=O.length;x<I;x++)if(M=c(),M.positionScreen.copy(O[x].position),C.multiplyVector4(M.positionScreen),j=l[i-2],B.copy(M.positionScreen),L.copy(j.positionScreen),d(B,L))B.multiplyScalar(1/B.w),L.multiplyScalar(1/L.w),V=s[o]=s[o]||new THREE.RenderableLine,o++,n=V,n.v1.positionScreen.copy(B),n.v2.positionScreen.copy(L),n.z=Math.max(B.z,L.z),n.material=fa,E.elements.push(n)}a=
-0;for(G=E.sprites.length;a<G;a++)if(V=E.sprites[a].object,Q=V.matrixWorld,V instanceof THREE.Particle&&(v.set(Q.n14,Q.n24,Q.n34,1),w.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))f=z[r]=z[r]||new THREE.RenderableParticle,r++,u=f,u.x=v.x/v.w,u.y=v.y/v.w,u.z=v.z,u.rotation=V.rotation.z,u.scale.x=V.scale.x*Math.abs(u.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),u.scale.y=V.scale.y*Math.abs(u.y-(v.y+e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),u.material=V.material,E.elements.push(u);
+E.objects.sort(b);return E};this.projectScene=function(a,e,g){var f=e.near,F=e.far,G,x,I,O,M,j,P,ha,W,Q,K,fa,U,ia,pa,na;r=o=m=p=0;E.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);w.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(w);E=this.projectGraph(a,!1);a=0;for(G=E.objects.length;a<G;a++)if(W=E.objects[a].object,Q=W.matrixWorld,
+fa=W.material,i=0,W instanceof THREE.Mesh){K=W.geometry;U=W.geometry.materials;O=K.vertices;ia=K.faces;pa=K.faceVertexUvs;K=W.matrixRotationWorld.extractRotation(Q);x=0;for(I=O.length;x<I;x++)h=c(),h.positionWorld.copy(O[x].position),Q.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),w.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<F;O=0;for(x=ia.length;O<x;O++){I=
+ia[O];if(I instanceof THREE.Face3)if(M=l[I.a],j=l[I.b],P=l[I.c],M.visible&&j.visible&&P.visible&&(W.doubleSided||W.flipSided!=(P.positionScreen.x-M.positionScreen.x)*(j.positionScreen.y-M.positionScreen.y)-(P.positionScreen.y-M.positionScreen.y)*(j.positionScreen.x-M.positionScreen.x)<0))ha=q[p]=q[p]||new THREE.RenderableFace3,p++,k=ha,k.v1.copy(M),k.v2.copy(j),k.v3.copy(P);else continue;else if(I instanceof THREE.Face4)if(M=l[I.a],j=l[I.b],P=l[I.c],ha=l[I.d],M.visible&&j.visible&&P.visible&&ha.visible&&
+(W.doubleSided||W.flipSided!=((ha.positionScreen.x-M.positionScreen.x)*(j.positionScreen.y-M.positionScreen.y)-(ha.positionScreen.y-M.positionScreen.y)*(j.positionScreen.x-M.positionScreen.x)<0||(j.positionScreen.x-P.positionScreen.x)*(ha.positionScreen.y-P.positionScreen.y)-(j.positionScreen.y-P.positionScreen.y)*(ha.positionScreen.x-P.positionScreen.x)<0)))na=t[m]=t[m]||new THREE.RenderableFace4,m++,k=na,k.v1.copy(M),k.v2.copy(j),k.v3.copy(P),k.v4.copy(ha);else continue;k.normalWorld.copy(I.normal);
+K.multiplyVector3(k.normalWorld);k.centroidWorld.copy(I.centroid);Q.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);w.multiplyVector3(k.centroidScreen);P=I.vertexNormals;M=0;for(j=P.length;M<j;M++)ha=k.vertexNormalsWorld[M],ha.copy(P[M]),K.multiplyVector3(ha);M=0;for(j=pa.length;M<j;M++)if(na=pa[M][O]){P=0;for(ha=na.length;P<ha;P++)k.uvs[M][P]=na[P]}k.material=fa;k.faceMaterial=I.materialIndex!==null?U[I.materialIndex]:null;k.z=k.centroidScreen.z;E.elements.push(k)}}else if(W instanceof
+THREE.Line){C.multiply(w,Q);O=W.geometry.vertices;M=c();M.positionScreen.copy(O[0].position);C.multiplyVector4(M.positionScreen);x=1;for(I=O.length;x<I;x++)if(M=c(),M.positionScreen.copy(O[x].position),C.multiplyVector4(M.positionScreen),j=l[i-2],B.copy(M.positionScreen),L.copy(j.positionScreen),d(B,L))B.multiplyScalar(1/B.w),L.multiplyScalar(1/L.w),W=s[o]=s[o]||new THREE.RenderableLine,o++,n=W,n.v1.positionScreen.copy(B),n.v2.positionScreen.copy(L),n.z=Math.max(B.z,L.z),n.material=fa,E.elements.push(n)}a=
+0;for(G=E.sprites.length;a<G;a++)if(W=E.sprites[a].object,Q=W.matrixWorld,W instanceof THREE.Particle&&(v.set(Q.n14,Q.n24,Q.n34,1),w.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))f=z[r]=z[r]||new THREE.RenderableParticle,r++,u=f,u.x=v.x/v.w,u.y=v.y/v.w,u.z=v.z,u.rotation=W.rotation.z,u.scale.x=W.scale.x*Math.abs(u.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),u.scale.y=W.scale.y*Math.abs(u.y-(v.y+e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),u.material=W.material,E.elements.push(u);
 g&&E.elements.sort(b);return E}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)};
 g&&E.elements.sort(b);return E}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,d=a.y*c,g=a.z*c,a=Math.cos(d),d=Math.sin(d),c=Math.cos(-g),g=Math.sin(-g),e=Math.cos(b),b=Math.sin(b),f=a*c,h=d*g;this.w=f*e-h*b;this.x=f*b+h*e;this.y=d*c*e+a*g*b;this.z=a*g*e-d*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,d=Math.sin(b);
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,d=a.y*c,g=a.z*c,a=Math.cos(d),d=Math.sin(d),c=Math.cos(-g),g=Math.sin(-g),e=Math.cos(b),b=Math.sin(b),f=a*c,h=d*g;this.w=f*e-h*b;this.x=f*b+h*e;this.y=d*c*e+a*g*b;this.z=a*g*e-d*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,d=Math.sin(b);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var c=
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var c=
 this.x,b=this.y,d=this.z,g=this.w,e=a.x,f=a.y,h=a.z,a=a.w;this.x=c*a+g*e+b*h-d*f;this.y=b*a+g*f+d*e-c*h;this.z=d*a+g*h+c*f-b*e;this.w=g*a-c*e-b*f-d*h;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,g=a.z,e=this.x,f=this.y,h=this.z,i=this.w,l=i*b+f*g-h*d,k=i*d+h*b-e*g,p=i*g+e*d-f*b,b=-e*
 this.x,b=this.y,d=this.z,g=this.w,e=a.x,f=a.y,h=a.z,a=a.w;this.x=c*a+g*e+b*h-d*f;this.y=b*a+g*f+d*e-c*h;this.z=d*a+g*h+c*f-b*e;this.w=g*a-c*e-b*f-d*h;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,g=a.z,e=this.x,f=this.y,h=this.z,i=this.w,l=i*b+f*g-h*d,k=i*d+h*b-e*g,p=i*g+e*d-f*b,b=-e*
 b-f*d-h*g;c.x=l*i+b*-e+k*-h-p*-f;c.y=k*i+b*-f+p*-e-l*-h;c.z=p*i+b*-h+l*-f-k*-e;return c}};
 b-f*d-h*g;c.x=l*i+b*-e+k*-h-p*-f;c.y=k*i+b*-f+p*-e-l*-h;c.z=p*i+b*-h+l*-f-k*-e;return c}};
-THREE.Quaternion.slerp=function(a,c,b,d){var g=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;g<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,g=-g):b.copy(c);if(Math.abs(g)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var e=Math.acos(g),g=Math.sqrt(1-g*g);if(Math.abs(g)<0.0010)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;b.w=a.w*c+b.w*d;b.x=a.x*c+b.x*d;b.y=a.y*c+b.y*d;b.z=a.z*c+b.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,c,b,d){var g=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;g<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,g=-g):b.copy(c);if(Math.abs(g)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var e=Math.acos(g),g=Math.sqrt(1-g*g);if(Math.abs(g)<0.001)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;b.w=a.w*c+b.w*d;b.x=a.x*c+b.x*d;b.y=a.y*c+b.y*d;b.z=a.z*c+b.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,c,b,d,g,e){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face3=function(a,c,b,d,g,e){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,c,b,d,g,e,f){this.a=a;this.b=c;this.c=b;this.d=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
 THREE.Face4=function(a,c,b,d,g,e,f){this.a=a;this.b=c;this.c=b;this.d=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
@@ -84,8 +84,8 @@ b,d,g,e,f,h=new THREE.Vector3,i=new THREE.Vector3;d=0;for(g=this.faces.length;d<
 Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
 Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
 THREE.Face3?(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal),d[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(d[b.a]),b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(d[b.a]),
 THREE.Face3?(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal),d[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(d[b.a]),b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(d[b.a]),
 b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c]),b.vertexNormals[3].copy(d[b.d]))},computeTangents:function(){function a(a,b,c,d,e,g,j){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=f[e];p=f[g];q=f[j];m=i.x-h.x;t=l.x-h.x;n=i.y-h.y;o=l.y-h.y;s=i.z-h.z;u=l.z-h.z;r=p.u-k.u;z=q.u-k.u;E=p.v-k.v;G=q.v-k.v;v=1/(r*G-z*E);B.set((G*m-E*t)*v,(G*n-E*o)*v,(G*s-E*u)*v);L.set((r*t-z*m)*v,(r*o-z*n)*v,(r*u-z*s)*v);C[b].addSelf(B);C[c].addSelf(B);C[d].addSelf(B);F[b].addSelf(L);
 b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c]),b.vertexNormals[3].copy(d[b.d]))},computeTangents:function(){function a(a,b,c,d,e,g,j){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=f[e];p=f[g];q=f[j];m=i.x-h.x;t=l.x-h.x;n=i.y-h.y;o=l.y-h.y;s=i.z-h.z;u=l.z-h.z;r=p.u-k.u;z=q.u-k.u;E=p.v-k.v;G=q.v-k.v;v=1/(r*G-z*E);B.set((G*m-E*t)*v,(G*n-E*o)*v,(G*s-E*u)*v);L.set((r*t-z*m)*v,(r*o-z*n)*v,(r*u-z*s)*v);C[b].addSelf(B);C[c].addSelf(B);C[d].addSelf(B);F[b].addSelf(L);
-F[c].addSelf(L);F[d].addSelf(L)}var c,b,d,g,e,f,h,i,l,k,p,q,m,t,n,o,s,u,r,z,E,G,v,w,C=[],F=[],B=new THREE.Vector3,L=new THREE.Vector3,J=new THREE.Vector3,W=new THREE.Vector3,X=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)C[c]=new THREE.Vector3,F[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)e=this.faces[c],f=this.faceVertexUvs[0][c],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var T=["a","b",
-"c","d"];c=0;for(b=this.faces.length;c<b;c++){e=this.faces[c];for(d=0;d<e.vertexNormals.length;d++)X.copy(e.vertexNormals[d]),g=e[T[d]],w=C[g],J.copy(w),J.subSelf(X.multiplyScalar(X.dot(w))).normalize(),W.cross(e.vertexNormals[d],w),g=W.dot(F[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(J.x,J.y,J.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
+F[c].addSelf(L);F[d].addSelf(L)}var c,b,d,g,e,f,h,i,l,k,p,q,m,t,n,o,s,u,r,z,E,G,v,w,C=[],F=[],B=new THREE.Vector3,L=new THREE.Vector3,J=new THREE.Vector3,X=new THREE.Vector3,Y=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)C[c]=new THREE.Vector3,F[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)e=this.faces[c],f=this.faceVertexUvs[0][c],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var T=["a","b",
+"c","d"];c=0;for(b=this.faces.length;c<b;c++){e=this.faces[c];for(d=0;d<e.vertexNormals.length;d++)Y.copy(e.vertexNormals[d]),g=e[T[d]],w=C[g],J.copy(w),J.subSelf(Y.multiplyScalar(Y.dot(w))).normalize(),X.cross(e.vertexNormals[d],w),g=X.dot(F[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(J.x,J.y,J.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],d,g=Math.pow(10,4),e,f;e=0;for(f=this.vertices.length;e<f;e++)d=this.vertices[e].position,d=[Math.round(d.x*g),Math.round(d.y*g),Math.round(d.z*g)].join("_"),a[d]===void 0?(a[d]=e,c.push(this.vertices[e]),
 a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],d,g=Math.pow(10,4),e,f;e=0;for(f=this.vertices.length;e<f;e++)d=this.vertices[e].position,d=[Math.round(d.x*g),Math.round(d.y*g),Math.round(d.z*g)].join("_"),a[d]===void 0?(a[d]=e,c.push(this.vertices[e]),
 b[e]=c.length-1):b[e]=b[a[d]];e=0;for(f=this.faces.length;e<f;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
 b[e]=c.length-1):b[e]=b[a[d]];e=0;for(f=this.faces.length;e<f;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
@@ -150,38 +150,38 @@ THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var
 THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
 THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,g,e;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;d=c;g=b/2;e=d/2};this.render=function(b,d){var i,l,k,p,q,m,t,n;a=c.projectScene(b,d);i=0;for(l=a.length;i<l;i++)if(q=a[i],q instanceof THREE.RenderableParticle){t=q.x*g+g;n=q.y*e+e;k=0;for(p=q.material.length;k<p;k++)if(m=q.material[k],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=t+"px",m.style.top=n+"px"}}};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,g,e;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;d=c;g=b/2;e=d/2};this.render=function(b,d){var i,l,k,p,q,m,t,n;a=c.projectScene(b,d);i=0;for(l=a.length;i<l;i++)if(q=a[i],q instanceof THREE.RenderableParticle){t=q.x*g+g;n=q.y*e+e;k=0;for(p=q.material.length;k<p;k++)if(m=q.material[k],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=t+"px",m.style.top=n+"px"}}};
 THREE.CanvasRenderer=function(a){function c(a){if(u!=a)n.globalAlpha=u=a}function b(a){if(r!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}r=a}}function d(a){if(z!=a)n.strokeStyle=z=a}function g(a){if(E!=a)n.fillStyle=E=a}var e=this,f,h,i,l=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
 THREE.CanvasRenderer=function(a){function c(a){if(u!=a)n.globalAlpha=u=a}function b(a){if(r!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}r=a}}function d(a){if(z!=a)n.strokeStyle=z=a}function g(a){if(E!=a)n.fillStyle=E=a}var e=this,f,h,i,l=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-p,q,m,t,n=k.getContext("2d"),o=new THREE.Color(0),s=0,u=1,r=0,z=null,E=null,G=null,v=null,w=null,C,F,B,L,J=new THREE.RenderableVertex,W=new THREE.RenderableVertex,X,T,ea,ba,x,I,O,M,j,P,ha,V,Q=new THREE.Color,K=new THREE.Color,fa=new THREE.Color,U=new THREE.Color,ia=new THREE.Color,pa=[],na=[],ka,oa,la,ma,ya,ra,sa,xa,R,A,Z=new THREE.Rectangle,H=new THREE.Rectangle,$=new THREE.Rectangle,ca=!1,aa=new THREE.Color,S=new THREE.Color,ga=new THREE.Color,Y=new THREE.Vector3,va,N,ua,ta,da,Fa,a=16;va=document.createElement("canvas");
-va.width=va.height=2;N=va.getContext("2d");N.fillStyle="rgba(0,0,0,1)";N.fillRect(0,0,2,2);ua=N.getImageData(0,0,2,2);ta=ua.data;da=document.createElement("canvas");da.width=da.height=a;Fa=da.getContext("2d");Fa.translate(-a/2,-a/2);Fa.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;q=b;m=Math.floor(p/2);t=Math.floor(q/2);k.width=p;k.height=q;Z.set(-m,-t,m,t);H.set(-m,-t,m,t);u=1;r=0;w=v=G=
-E=z=null};this.setClearColor=function(a,b){o.copy(a);s=b;H.set(-m,-t,m,t)};this.setClearColorHex=function(a,b){o.setHex(a);s=b;H.set(-m,-t,m,t)};this.clear=function(){n.setTransform(1,0,0,-1,m,t);H.isEmpty()||(H.minSelf(Z),H.inflate(2),s<1&&n.clearRect(Math.floor(H.getX()),Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight())),s>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+s+")"),n.fillRect(Math.floor(H.getX()),
+p,q,m,t,n=k.getContext("2d"),o=new THREE.Color(0),s=0,u=1,r=0,z=null,E=null,G=null,v=null,w=null,C,F,B,L,J=new THREE.RenderableVertex,X=new THREE.RenderableVertex,Y,T,ea,ba,x,I,O,M,j,P,ha,W,Q=new THREE.Color,K=new THREE.Color,fa=new THREE.Color,U=new THREE.Color,ia=new THREE.Color,pa=[],na=[],ka,oa,la,ma,ya,ra,sa,xa,R,A,V=new THREE.Rectangle,H=new THREE.Rectangle,$=new THREE.Rectangle,ca=!1,aa=new THREE.Color,S=new THREE.Color,ga=new THREE.Color,Z=new THREE.Vector3,va,N,ua,ta,da,Fa,a=16;va=document.createElement("canvas");
+va.width=va.height=2;N=va.getContext("2d");N.fillStyle="rgba(0,0,0,1)";N.fillRect(0,0,2,2);ua=N.getImageData(0,0,2,2);ta=ua.data;da=document.createElement("canvas");da.width=da.height=a;Fa=da.getContext("2d");Fa.translate(-a/2,-a/2);Fa.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;q=b;m=Math.floor(p/2);t=Math.floor(q/2);k.width=p;k.height=q;V.set(-m,-t,m,t);H.set(-m,-t,m,t);u=1;r=0;w=v=G=
+E=z=null};this.setClearColor=function(a,b){o.copy(a);s=b;H.set(-m,-t,m,t)};this.setClearColorHex=function(a,b){o.setHex(a);s=b;H.set(-m,-t,m,t)};this.clear=function(){n.setTransform(1,0,0,-1,m,t);H.isEmpty()||(H.minSelf(V),H.inflate(2),s<1&&n.clearRect(Math.floor(H.getX()),Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight())),s>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+s+")"),n.fillRect(Math.floor(H.getX()),
 Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight()))),H.empty())};this.render=function(a,k){function q(a){var b,c,d,e;aa.setRGB(0,0,0);S.setRGB(0,0,0);ga.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(aa.r+=e.r,aa.g+=e.g,aa.b+=e.b):d instanceof THREE.DirectionalLight?(S.r+=e.r,S.g+=e.g,S.b+=e.b):d instanceof THREE.PointLight&&(ga.r+=e.r,ga.g+=e.g,ga.b+=e.b)}function p(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,
 Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight()))),H.empty())};this.render=function(a,k){function q(a){var b,c,d,e;aa.setRGB(0,0,0);S.setRGB(0,0,0);ga.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(aa.r+=e.r,aa.g+=e.g,aa.b+=e.b):d instanceof THREE.DirectionalLight?(S.r+=e.r,S.g+=e.g,S.b+=e.b):d instanceof THREE.PointLight&&(ga.r+=e.r,ga.g+=e.g,ga.b+=e.b)}function p(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,
-f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(Y.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function o(a,e,f){c(f.opacity);b(f.blending);var j,h,i,k,l,da;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,l=k.width>>1,da=k.height>>
-1,f=e.scale.x*m,i=e.scale.y*t,j=f*l,h=i*da,$.set(a.x-j,a.y-h,a.x+j,a.y+h),Z.intersects($)&&(n.save(),n.translate(a.x,a.y),n.rotate(-e.rotation),n.scale(f,-i),n.translate(-l,-da),n.drawImage(k,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*m,h=e.scale.y*t,$.set(a.x-j,a.y-h,a.x+j,a.y+h),Z.intersects($)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-e.rotation),n.scale(j,h),f.program(n),n.restore()))}function s(a,e,
-f,g){c(g.opacity);b(g.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(G!=a)n.lineWidth=G=a;a=g.linecap;if(v!=a)n.lineCap=v=a;a=g.linejoin;if(w!=a)n.lineJoin=w=a;d(g.color.getContextStyle());n.stroke();$.inflate(g.linewidth*2)}}function u(a,d,g,f,j,h,m,l){e.info.render.vertices+=3;e.info.render.faces++;c(l.opacity);b(l.blending);X=a.positionScreen.x;T=a.positionScreen.y;
-ea=d.positionScreen.x;ba=d.positionScreen.y;x=g.positionScreen.x;I=g.positionScreen.y;Ea(X,T,ea,ba,x,I);if(l instanceof THREE.MeshBasicMaterial)if(l.map)l.map.mapping instanceof THREE.UVMapping&&(ma=m.uvs[0],E(X,T,ea,ba,x,I,ma[f].u,ma[f].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,l.map));else if(l.envMap){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,Y.copy(m.vertexNormalsWorld[f]),ya=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,ra=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,
-Y.copy(m.vertexNormalsWorld[j]),sa=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,xa=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,Y.copy(m.vertexNormalsWorld[h]),R=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,A=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,E(X,T,ea,ba,x,I,ya,ra,sa,xa,R,A,l.envMap)}else l.wireframe?z(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(l.color);else if(l instanceof THREE.MeshLambertMaterial)l.map&&!l.wireframe&&(l.map.mapping instanceof THREE.UVMapping&&(ma=m.uvs[0],
-E(X,T,ea,ba,x,I,ma[f].u,ma[f].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,l.map)),b(THREE.SubtractiveBlending)),ca?!l.wireframe&&l.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(K.r=fa.r=U.r=aa.r,K.g=fa.g=U.g=aa.g,K.b=fa.b=U.b=aa.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],K),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],fa),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],U),K.r=Math.max(0,Math.min(l.color.r*K.r,1)),K.g=Math.max(0,Math.min(l.color.g*K.g,1)),K.b=Math.max(0,Math.min(l.color.b*
-K.b,1)),fa.r=Math.max(0,Math.min(l.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(l.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(l.color.b*fa.b,1)),U.r=Math.max(0,Math.min(l.color.r*U.r,1)),U.g=Math.max(0,Math.min(l.color.g*U.g,1)),U.b=Math.max(0,Math.min(l.color.b*U.b,1)),ia.r=(fa.r+U.r)*0.5,ia.g=(fa.g+U.g)*0.5,ia.b=(fa.b+U.b)*0.5,la=Ga(K,fa,U,ia),Ca(X,T,ea,ba,x,I,0,0,1,0,0,1,la)):(Q.r=aa.r,Q.g=aa.g,Q.b=aa.b,p(i,m.centroidWorld,m.normalWorld,Q),Q.r=Math.max(0,Math.min(l.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(l.color.g*
-Q.g,1)),Q.b=Math.max(0,Math.min(l.color.b*Q.b,1)),l.wireframe?z(Q,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(Q)):l.wireframe?z(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(l.color);else if(l instanceof THREE.MeshDepthMaterial)ka=k.near,oa=k.far,K.r=K.g=K.b=1-Ba(a.positionScreen.z,ka,oa),fa.r=fa.g=fa.b=1-Ba(d.positionScreen.z,ka,oa),U.r=U.g=U.b=1-Ba(g.positionScreen.z,ka,oa),ia.r=(fa.r+U.r)*0.5,ia.g=(fa.g+U.g)*0.5,ia.b=(fa.b+U.b)*0.5,la=Ga(K,fa,U,ia),
-Ca(X,T,ea,ba,x,I,0,0,1,0,0,1,la);else if(l instanceof THREE.MeshNormalMaterial)Q.r=Da(m.normalWorld.x),Q.g=Da(m.normalWorld.y),Q.b=Da(m.normalWorld.z),l.wireframe?z(Q,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(Q)}function r(a,d,g,f,h,l,m,n,da){e.info.render.vertices+=4;e.info.render.faces++;c(n.opacity);b(n.blending);if(n.map||n.envMap)u(a,d,f,0,1,3,m,n,da),u(h,g,l,1,2,3,m,n,da);else if(X=a.positionScreen.x,T=a.positionScreen.y,ea=d.positionScreen.x,ba=d.positionScreen.y,x=g.positionScreen.x,
-I=g.positionScreen.y,O=f.positionScreen.x,M=f.positionScreen.y,j=h.positionScreen.x,P=h.positionScreen.y,ha=l.positionScreen.x,V=l.positionScreen.y,n instanceof THREE.MeshBasicMaterial)Ha(X,T,ea,ba,x,I,O,M),n.wireframe?z(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(n.color);else if(n instanceof THREE.MeshLambertMaterial)ca?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==4?(K.r=fa.r=U.r=ia.r=aa.r,K.g=fa.g=U.g=ia.g=aa.g,K.b=fa.b=U.b=ia.b=aa.b,p(i,
+f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(Z.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function o(a,e,f){c(f.opacity);b(f.blending);var j,h,i,k,l,da;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,l=k.width>>1,da=k.height>>
+1,f=e.scale.x*m,i=e.scale.y*t,j=f*l,h=i*da,$.set(a.x-j,a.y-h,a.x+j,a.y+h),V.intersects($)&&(n.save(),n.translate(a.x,a.y),n.rotate(-e.rotation),n.scale(f,-i),n.translate(-l,-da),n.drawImage(k,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*m,h=e.scale.y*t,$.set(a.x-j,a.y-h,a.x+j,a.y+h),V.intersects($)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-e.rotation),n.scale(j,h),f.program(n),n.restore()))}function s(a,e,
+g,f){c(f.opacity);b(f.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(G!=a)n.lineWidth=G=a;a=f.linecap;if(v!=a)n.lineCap=v=a;a=f.linejoin;if(w!=a)n.lineJoin=w=a;d(f.color.getContextStyle());n.stroke();$.inflate(f.linewidth*2)}}function u(a,d,f,g,j,h,m,l){e.info.render.vertices+=3;e.info.render.faces++;c(l.opacity);b(l.blending);Y=a.positionScreen.x;T=a.positionScreen.y;
+ea=d.positionScreen.x;ba=d.positionScreen.y;x=f.positionScreen.x;I=f.positionScreen.y;Ea(Y,T,ea,ba,x,I);if(l instanceof THREE.MeshBasicMaterial)if(l.map)l.map.mapping instanceof THREE.UVMapping&&(ma=m.uvs[0],E(Y,T,ea,ba,x,I,ma[g].u,ma[g].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,l.map));else if(l.envMap){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,Z.copy(m.vertexNormalsWorld[g]),ya=(Z.x*a.n11+Z.y*a.n12+Z.z*a.n13)*0.5+0.5,ra=-(Z.x*a.n21+Z.y*a.n22+Z.z*a.n23)*0.5+0.5,
+Z.copy(m.vertexNormalsWorld[j]),sa=(Z.x*a.n11+Z.y*a.n12+Z.z*a.n13)*0.5+0.5,xa=-(Z.x*a.n21+Z.y*a.n22+Z.z*a.n23)*0.5+0.5,Z.copy(m.vertexNormalsWorld[h]),R=(Z.x*a.n11+Z.y*a.n12+Z.z*a.n13)*0.5+0.5,A=-(Z.x*a.n21+Z.y*a.n22+Z.z*a.n23)*0.5+0.5,E(Y,T,ea,ba,x,I,ya,ra,sa,xa,R,A,l.envMap)}else l.wireframe?z(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(l.color);else if(l instanceof THREE.MeshLambertMaterial)l.map&&!l.wireframe&&(l.map.mapping instanceof THREE.UVMapping&&(ma=m.uvs[0],
+E(Y,T,ea,ba,x,I,ma[g].u,ma[g].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,l.map)),b(THREE.SubtractiveBlending)),ca?!l.wireframe&&l.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(K.r=fa.r=U.r=aa.r,K.g=fa.g=U.g=aa.g,K.b=fa.b=U.b=aa.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],K),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],fa),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],U),K.r=Math.max(0,Math.min(l.color.r*K.r,1)),K.g=Math.max(0,Math.min(l.color.g*K.g,1)),K.b=Math.max(0,Math.min(l.color.b*
+K.b,1)),fa.r=Math.max(0,Math.min(l.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(l.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(l.color.b*fa.b,1)),U.r=Math.max(0,Math.min(l.color.r*U.r,1)),U.g=Math.max(0,Math.min(l.color.g*U.g,1)),U.b=Math.max(0,Math.min(l.color.b*U.b,1)),ia.r=(fa.r+U.r)*0.5,ia.g=(fa.g+U.g)*0.5,ia.b=(fa.b+U.b)*0.5,la=Ga(K,fa,U,ia),Ca(Y,T,ea,ba,x,I,0,0,1,0,0,1,la)):(Q.r=aa.r,Q.g=aa.g,Q.b=aa.b,p(i,m.centroidWorld,m.normalWorld,Q),Q.r=Math.max(0,Math.min(l.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(l.color.g*
+Q.g,1)),Q.b=Math.max(0,Math.min(l.color.b*Q.b,1)),l.wireframe?z(Q,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(Q)):l.wireframe?z(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(l.color);else if(l instanceof THREE.MeshDepthMaterial)ka=k.near,oa=k.far,K.r=K.g=K.b=1-Ba(a.positionScreen.z,ka,oa),fa.r=fa.g=fa.b=1-Ba(d.positionScreen.z,ka,oa),U.r=U.g=U.b=1-Ba(f.positionScreen.z,ka,oa),ia.r=(fa.r+U.r)*0.5,ia.g=(fa.g+U.g)*0.5,ia.b=(fa.b+U.b)*0.5,la=Ga(K,fa,U,ia),
+Ca(Y,T,ea,ba,x,I,0,0,1,0,0,1,la);else if(l instanceof THREE.MeshNormalMaterial)Q.r=Da(m.normalWorld.x),Q.g=Da(m.normalWorld.y),Q.b=Da(m.normalWorld.z),l.wireframe?z(Q,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(Q)}function r(a,d,f,g,h,l,m,n,da){e.info.render.vertices+=4;e.info.render.faces++;c(n.opacity);b(n.blending);if(n.map||n.envMap)u(a,d,g,0,1,3,m,n,da),u(h,f,l,1,2,3,m,n,da);else if(Y=a.positionScreen.x,T=a.positionScreen.y,ea=d.positionScreen.x,ba=d.positionScreen.y,x=f.positionScreen.x,
+I=f.positionScreen.y,O=g.positionScreen.x,M=g.positionScreen.y,j=h.positionScreen.x,P=h.positionScreen.y,ha=l.positionScreen.x,W=l.positionScreen.y,n instanceof THREE.MeshBasicMaterial)Ha(Y,T,ea,ba,x,I,O,M),n.wireframe?z(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(n.color);else if(n instanceof THREE.MeshLambertMaterial)ca?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==4?(K.r=fa.r=U.r=ia.r=aa.r,K.g=fa.g=U.g=ia.g=aa.g,K.b=fa.b=U.b=ia.b=aa.b,p(i,
 m.v1.positionWorld,m.vertexNormalsWorld[0],K),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],fa),p(i,m.v4.positionWorld,m.vertexNormalsWorld[3],U),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ia),K.r=Math.max(0,Math.min(n.color.r*K.r,1)),K.g=Math.max(0,Math.min(n.color.g*K.g,1)),K.b=Math.max(0,Math.min(n.color.b*K.b,1)),fa.r=Math.max(0,Math.min(n.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(n.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(n.color.b*fa.b,1)),U.r=Math.max(0,Math.min(n.color.r*U.r,1)),U.g=
 m.v1.positionWorld,m.vertexNormalsWorld[0],K),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],fa),p(i,m.v4.positionWorld,m.vertexNormalsWorld[3],U),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ia),K.r=Math.max(0,Math.min(n.color.r*K.r,1)),K.g=Math.max(0,Math.min(n.color.g*K.g,1)),K.b=Math.max(0,Math.min(n.color.b*K.b,1)),fa.r=Math.max(0,Math.min(n.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(n.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(n.color.b*fa.b,1)),U.r=Math.max(0,Math.min(n.color.r*U.r,1)),U.g=
-Math.max(0,Math.min(n.color.g*U.g,1)),U.b=Math.max(0,Math.min(n.color.b*U.b,1)),ia.r=Math.max(0,Math.min(n.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(n.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(n.color.b*ia.b,1)),la=Ga(K,fa,U,ia),Ea(X,T,ea,ba,O,M),Ca(X,T,ea,ba,O,M,0,0,1,0,0,1,la),Ea(j,P,x,I,ha,V),Ca(j,P,x,I,ha,V,1,0,1,1,0,1,la)):(Q.r=aa.r,Q.g=aa.g,Q.b=aa.b,p(i,m.centroidWorld,m.normalWorld,Q),Q.r=Math.max(0,Math.min(n.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(n.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(n.color.b*
-Q.b,1)),Ha(X,T,ea,ba,x,I,O,M),n.wireframe?z(Q,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(Q)):(Ha(X,T,ea,ba,x,I,O,M),n.wireframe?z(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(n.color));else if(n instanceof THREE.MeshNormalMaterial)Q.r=Da(m.normalWorld.x),Q.g=Da(m.normalWorld.y),Q.b=Da(m.normalWorld.z),Ha(X,T,ea,ba,x,I,O,M),n.wireframe?z(Q,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(Q);else if(n instanceof THREE.MeshDepthMaterial)ka=
-k.near,oa=k.far,K.r=K.g=K.b=1-Ba(a.positionScreen.z,ka,oa),fa.r=fa.g=fa.b=1-Ba(d.positionScreen.z,ka,oa),U.r=U.g=U.b=1-Ba(f.positionScreen.z,ka,oa),ia.r=ia.g=ia.b=1-Ba(g.positionScreen.z,ka,oa),la=Ga(K,fa,U,ia),Ea(X,T,ea,ba,O,M),Ca(X,T,ea,ba,O,M,0,0,1,0,0,1,la),Ea(j,P,x,I,ha,V),Ca(j,P,x,I,ha,V,1,0,1,1,0,1,la)}function Ea(a,b,c,d,e,g){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(a,b);n.closePath()}function Ha(a,b,c,d,e,g,f,j){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,
-g);n.lineTo(f,j);n.lineTo(a,b);n.closePath()}function z(a,b,c,e){if(G!=b)n.lineWidth=G=b;if(v!=c)n.lineCap=v=c;if(w!=e)n.lineJoin=w=e;d(a.getContextStyle());n.stroke();$.inflate(b*2)}function za(a){g(a.getContextStyle());n.fill()}function E(a,b,c,d,e,f,j,h,i,m,l,k,da){if(da.image.width!=0){if(da.needsUpdate==!0||pa[da.id]==void 0){var p=da.wrapS==THREE.RepeatWrapping,q=da.wrapT==THREE.RepeatWrapping;pa[da.id]=n.createPattern(da.image,p&&q?"repeat":p&&!q?"repeat-x":!p&&q?"repeat-y":"no-repeat");da.needsUpdate=
-!1}g(pa[da.id]);var p=da.offset.x/da.repeat.x,q=da.offset.y/da.repeat.y,R=da.image.width*da.repeat.x,t=da.image.height*da.repeat.y,j=(j+p)*R,h=(h+q)*t,i=(i+p)*R,m=(m+q)*t,l=(l+p)*R,k=(k+q)*t;c-=a;d-=b;e-=a;f-=b;i-=j;m-=h;l-=j;k-=h;p=i*k-l*m;if(p==0){if(na[da.id]==void 0)b=document.createElement("canvas"),b.width=da.image.width,b.height=da.image.height,a=b.getContext("2d"),a.drawImage(da.image,0,0),na[da.id]=a.getImageData(0,0,da.image.width,da.image.height).data,delete b;b=na[da.id];j=(Math.floor(j)+
-Math.floor(h)*da.image.width)*4;Q.setRGB(b[j]/255,b[j+1]/255,b[j+2]/255);za(Q)}else p=1/p,da=(k*c-m*e)*p,m=(k*d-m*f)*p,c=(i*e-l*c)*p,d=(i*f-l*d)*p,a=a-da*j-c*h,j=b-m*j-d*h,n.save(),n.transform(da,m,c,d,a,j),n.fill(),n.restore()}}function Ca(a,b,c,d,e,g,f,j,h,i,m,l,k){var da,p;da=k.width-1;p=k.height-1;f*=da;j*=p;h*=da;i*=p;m*=da;l*=p;c-=a;d-=b;e-=a;g-=b;h-=f;i-=j;m-=f;l-=j;p=1/(h*l-m*i);da=(l*c-i*e)*p;i=(l*d-i*g)*p;c=(h*e-m*c)*p;d=(h*g-m*d)*p;a=a-da*f-c*j;b=b-i*f-d*j;n.save();n.transform(da,i,c,d,
+Math.max(0,Math.min(n.color.g*U.g,1)),U.b=Math.max(0,Math.min(n.color.b*U.b,1)),ia.r=Math.max(0,Math.min(n.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(n.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(n.color.b*ia.b,1)),la=Ga(K,fa,U,ia),Ea(Y,T,ea,ba,O,M),Ca(Y,T,ea,ba,O,M,0,0,1,0,0,1,la),Ea(j,P,x,I,ha,W),Ca(j,P,x,I,ha,W,1,0,1,1,0,1,la)):(Q.r=aa.r,Q.g=aa.g,Q.b=aa.b,p(i,m.centroidWorld,m.normalWorld,Q),Q.r=Math.max(0,Math.min(n.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(n.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(n.color.b*
+Q.b,1)),Ha(Y,T,ea,ba,x,I,O,M),n.wireframe?z(Q,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(Q)):(Ha(Y,T,ea,ba,x,I,O,M),n.wireframe?z(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(n.color));else if(n instanceof THREE.MeshNormalMaterial)Q.r=Da(m.normalWorld.x),Q.g=Da(m.normalWorld.y),Q.b=Da(m.normalWorld.z),Ha(Y,T,ea,ba,x,I,O,M),n.wireframe?z(Q,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(Q);else if(n instanceof THREE.MeshDepthMaterial)ka=
+k.near,oa=k.far,K.r=K.g=K.b=1-Ba(a.positionScreen.z,ka,oa),fa.r=fa.g=fa.b=1-Ba(d.positionScreen.z,ka,oa),U.r=U.g=U.b=1-Ba(g.positionScreen.z,ka,oa),ia.r=ia.g=ia.b=1-Ba(f.positionScreen.z,ka,oa),la=Ga(K,fa,U,ia),Ea(Y,T,ea,ba,O,M),Ca(Y,T,ea,ba,O,M,0,0,1,0,0,1,la),Ea(j,P,x,I,ha,W),Ca(j,P,x,I,ha,W,1,0,1,1,0,1,la)}function Ea(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(a,b);n.closePath()}function Ha(a,b,c,d,e,f,g,j){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,
+f);n.lineTo(g,j);n.lineTo(a,b);n.closePath()}function z(a,b,c,e){if(G!=b)n.lineWidth=G=b;if(v!=c)n.lineCap=v=c;if(w!=e)n.lineJoin=w=e;d(a.getContextStyle());n.stroke();$.inflate(b*2)}function za(a){g(a.getContextStyle());n.fill()}function E(a,b,c,d,e,f,j,h,i,m,l,k,da){if(da.image.width!=0){if(da.needsUpdate==!0||pa[da.id]==void 0){var p=da.wrapS==THREE.RepeatWrapping,q=da.wrapT==THREE.RepeatWrapping;pa[da.id]=n.createPattern(da.image,p&&q?"repeat":p&&!q?"repeat-x":!p&&q?"repeat-y":"no-repeat");da.needsUpdate=
+!1}g(pa[da.id]);var p=da.offset.x/da.repeat.x,q=da.offset.y/da.repeat.y,R=da.image.width*da.repeat.x,o=da.image.height*da.repeat.y,j=(j+p)*R,h=(h+q)*o,i=(i+p)*R,m=(m+q)*o,l=(l+p)*R,k=(k+q)*o;c-=a;d-=b;e-=a;f-=b;i-=j;m-=h;l-=j;k-=h;p=i*k-l*m;if(p==0){if(na[da.id]==void 0)b=document.createElement("canvas"),b.width=da.image.width,b.height=da.image.height,a=b.getContext("2d"),a.drawImage(da.image,0,0),na[da.id]=a.getImageData(0,0,da.image.width,da.image.height).data,delete b;b=na[da.id];j=(Math.floor(j)+
+Math.floor(h)*da.image.width)*4;Q.setRGB(b[j]/255,b[j+1]/255,b[j+2]/255);za(Q)}else p=1/p,da=(k*c-m*e)*p,m=(k*d-m*f)*p,c=(i*e-l*c)*p,d=(i*f-l*d)*p,a=a-da*j-c*h,j=b-m*j-d*h,n.save(),n.transform(da,m,c,d,a,j),n.fill(),n.restore()}}function Ca(a,b,c,d,e,f,g,j,h,i,m,l,k){var da,p;da=k.width-1;p=k.height-1;g*=da;j*=p;h*=da;i*=p;m*=da;l*=p;c-=a;d-=b;e-=a;f-=b;h-=g;i-=j;m-=g;l-=j;p=1/(h*l-m*i);da=(l*c-i*e)*p;i=(l*d-i*f)*p;c=(h*e-m*c)*p;d=(h*f-m*d)*p;a=a-da*g-c*j;b=b-i*g-d*j;n.save();n.transform(da,i,c,d,
 a,b);n.clip();n.drawImage(k,0,0);n.restore()}function Ga(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),m=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ta[0]=e<0?0:e>255?255:e;ta[1]=f<0?0:f>255?255:f;ta[2]=a<0?0:a>255?255:a;ta[4]=g<0?0:g>255?255:g;ta[5]=j<0?0:j>255?255:j;ta[6]=b<0?0:b>255?255:b;ta[8]=h<0?0:h>255?255:h;ta[9]=i<0?0:i>255?255:i;ta[10]=c<0?0:c>255?255:c;ta[12]=m<0?0:m>255?255:m;ta[13]=l<0?0:l>255?255:
 a,b);n.clip();n.drawImage(k,0,0);n.restore()}function Ga(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),m=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ta[0]=e<0?0:e>255?255:e;ta[1]=f<0?0:f>255?255:f;ta[2]=a<0?0:a>255?255:a;ta[4]=g<0?0:g>255?255:g;ta[5]=j<0?0:j>255?255:j;ta[6]=b<0?0:b>255?255:b;ta[8]=h<0?0:h>255?255:h;ta[9]=i<0?0:i>255?255:i;ta[10]=c<0?0:c>255?255:c;ta[12]=m<0?0:m>255?255:m;ta[13]=l<0?0:l>255?255:
 l;ta[14]=d<0?0:d>255?255:d;N.putImageData(ua,0,0);Fa.drawImage(va,0,0);return da}function Ba(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Da(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Aa(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ia,Ja,qa,wa;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,t);e.info.render.vertices=0;e.info.render.faces=0;f=l.projectScene(a,k,this.sortElements);h=f.elements;i=f.lights;(ca=i.length>0)&&q(i);
 l;ta[14]=d<0?0:d>255?255:d;N.putImageData(ua,0,0);Fa.drawImage(va,0,0);return da}function Ba(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Da(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Aa(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ia,Ja,qa,wa;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,t);e.info.render.vertices=0;e.info.render.faces=0;f=l.projectScene(a,k,this.sortElements);h=f.elements;i=f.lights;(ca=i.length>0)&&q(i);
-Ia=0;for(Ja=h.length;Ia<Ja;Ia++)if(qa=h[Ia],wa=qa.material,wa=wa instanceof THREE.MeshFaceMaterial?qa.faceMaterial:wa,!(wa==null||wa.opacity==0)){$.empty();if(qa instanceof THREE.RenderableParticle)C=qa,C.x*=m,C.y*=t,o(C,qa,wa,a);else if(qa instanceof THREE.RenderableLine)C=qa.v1,F=qa.v2,C.positionScreen.x*=m,C.positionScreen.y*=t,F.positionScreen.x*=m,F.positionScreen.y*=t,$.addPoint(C.positionScreen.x,C.positionScreen.y),$.addPoint(F.positionScreen.x,F.positionScreen.y),Z.intersects($)&&s(C,F,qa,
-wa,a);else if(qa instanceof THREE.RenderableFace3)C=qa.v1,F=qa.v2,B=qa.v3,C.positionScreen.x*=m,C.positionScreen.y*=t,F.positionScreen.x*=m,F.positionScreen.y*=t,B.positionScreen.x*=m,B.positionScreen.y*=t,wa.overdraw&&(Aa(C.positionScreen,F.positionScreen),Aa(F.positionScreen,B.positionScreen),Aa(B.positionScreen,C.positionScreen)),$.add3Points(C.positionScreen.x,C.positionScreen.y,F.positionScreen.x,F.positionScreen.y,B.positionScreen.x,B.positionScreen.y),Z.intersects($)&&u(C,F,B,0,1,2,qa,wa,a);
-else if(qa instanceof THREE.RenderableFace4)C=qa.v1,F=qa.v2,B=qa.v3,L=qa.v4,C.positionScreen.x*=m,C.positionScreen.y*=t,F.positionScreen.x*=m,F.positionScreen.y*=t,B.positionScreen.x*=m,B.positionScreen.y*=t,L.positionScreen.x*=m,L.positionScreen.y*=t,J.positionScreen.copy(F.positionScreen),W.positionScreen.copy(L.positionScreen),wa.overdraw&&(Aa(C.positionScreen,F.positionScreen),Aa(F.positionScreen,L.positionScreen),Aa(L.positionScreen,C.positionScreen),Aa(B.positionScreen,J.positionScreen),Aa(B.positionScreen,
-W.positionScreen)),$.addPoint(C.positionScreen.x,C.positionScreen.y),$.addPoint(F.positionScreen.x,F.positionScreen.y),$.addPoint(B.positionScreen.x,B.positionScreen.y),$.addPoint(L.positionScreen.x,L.positionScreen.y),Z.intersects($)&&r(C,F,B,L,J,W,qa,wa,a);H.addRectangle($)}n.setTransform(1,0,0,1,0,0)}};
+Ia=0;for(Ja=h.length;Ia<Ja;Ia++)if(qa=h[Ia],wa=qa.material,wa=wa instanceof THREE.MeshFaceMaterial?qa.faceMaterial:wa,!(wa==null||wa.opacity==0)){$.empty();if(qa instanceof THREE.RenderableParticle)C=qa,C.x*=m,C.y*=t,o(C,qa,wa,a);else if(qa instanceof THREE.RenderableLine)C=qa.v1,F=qa.v2,C.positionScreen.x*=m,C.positionScreen.y*=t,F.positionScreen.x*=m,F.positionScreen.y*=t,$.addPoint(C.positionScreen.x,C.positionScreen.y),$.addPoint(F.positionScreen.x,F.positionScreen.y),V.intersects($)&&s(C,F,qa,
+wa,a);else if(qa instanceof THREE.RenderableFace3)C=qa.v1,F=qa.v2,B=qa.v3,C.positionScreen.x*=m,C.positionScreen.y*=t,F.positionScreen.x*=m,F.positionScreen.y*=t,B.positionScreen.x*=m,B.positionScreen.y*=t,wa.overdraw&&(Aa(C.positionScreen,F.positionScreen),Aa(F.positionScreen,B.positionScreen),Aa(B.positionScreen,C.positionScreen)),$.add3Points(C.positionScreen.x,C.positionScreen.y,F.positionScreen.x,F.positionScreen.y,B.positionScreen.x,B.positionScreen.y),V.intersects($)&&u(C,F,B,0,1,2,qa,wa,a);
+else if(qa instanceof THREE.RenderableFace4)C=qa.v1,F=qa.v2,B=qa.v3,L=qa.v4,C.positionScreen.x*=m,C.positionScreen.y*=t,F.positionScreen.x*=m,F.positionScreen.y*=t,B.positionScreen.x*=m,B.positionScreen.y*=t,L.positionScreen.x*=m,L.positionScreen.y*=t,J.positionScreen.copy(F.positionScreen),X.positionScreen.copy(L.positionScreen),wa.overdraw&&(Aa(C.positionScreen,F.positionScreen),Aa(F.positionScreen,L.positionScreen),Aa(L.positionScreen,C.positionScreen),Aa(B.positionScreen,J.positionScreen),Aa(B.positionScreen,
+X.positionScreen)),$.addPoint(C.positionScreen.x,C.positionScreen.y),$.addPoint(F.positionScreen.x,F.positionScreen.y),$.addPoint(B.positionScreen.x,B.positionScreen.y),$.addPoint(L.positionScreen.x,L.positionScreen.y),V.intersects($)&&r(C,F,B,L,J,X,qa,wa,a);H.addRectangle($)}n.setTransform(1,0,0,1,0,0)}};
 THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,j,h,i;e=0;for(f=a.length;e<f;e++)g=a[e],j=g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),i=c.dot(C.sub(h,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(h)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function c(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg",
 THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,j,h,i;e=0;for(f=a.length;e<f;e++)g=a[e],j=g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),i=c.dot(C.sub(h,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(h)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function c(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),X==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,p,q,m,t,n,o,s=new THREE.Rectangle,u=new THREE.Rectangle,r=!1,z=new THREE.Color,E=new THREE.Color,G=new THREE.Color,v=new THREE.Color,w,C=new THREE.Vector3,F=[],B=[],L,J,W,X=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
-faces:0}};this.setQuality=function(a){switch(a){case "high":X=1;break;case "low":X=0}};this.setSize=function(a,b){l=a;k=b;p=l/2;q=k/2;i.setAttribute("viewBox",-p+" "+-q+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);s.set(-p,-q,p,q)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(l,k){var F,x,I,O;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(l,k,this.sortElements);e=g.elements;
-f=g.lights;W=J=0;if(r=f.length>0){E.setRGB(0,0,0);G.setRGB(0,0,0);v.setRGB(0,0,0);F=0;for(x=f.length;F<x;F++)O=f[F],I=O.color,O instanceof THREE.AmbientLight?(E.r+=I.r,E.g+=I.g,E.b+=I.b):O instanceof THREE.DirectionalLight?(G.r+=I.r,G.g+=I.g,G.b+=I.b):O instanceof THREE.PointLight&&(v.r+=I.r,v.g+=I.g,v.b+=I.b)}F=0;for(x=e.length;F<x;F++)if(I=e[F],O=I.material,O=O instanceof THREE.MeshFaceMaterial?I.faceMaterial:O,!(O==null||O.opacity==0))if(u.empty(),I instanceof THREE.RenderableParticle)m=I,m.x*=
-p,m.y*=-q;else if(I instanceof THREE.RenderableLine){if(m=I.v1,t=I.v2,m.positionScreen.x*=p,m.positionScreen.y*=-q,t.positionScreen.x*=p,t.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(t.positionScreen.x,t.positionScreen.y),s.intersects(u)){I=m;var M=t,j=W++;B[j]==null&&(B[j]=document.createElementNS("http://www.w3.org/2000/svg","line"),X==0&&B[j].setAttribute("shape-rendering","crispEdges"));L=B[j];L.setAttribute("x1",I.positionScreen.x);L.setAttribute("y1",I.positionScreen.y);
+"path"),Y==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,p,q,m,t,n,o,s=new THREE.Rectangle,u=new THREE.Rectangle,r=!1,z=new THREE.Color,E=new THREE.Color,G=new THREE.Color,v=new THREE.Color,w,C=new THREE.Vector3,F=[],B=[],L,J,X,Y=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
+faces:0}};this.setQuality=function(a){switch(a){case "high":Y=1;break;case "low":Y=0}};this.setSize=function(a,b){l=a;k=b;p=l/2;q=k/2;i.setAttribute("viewBox",-p+" "+-q+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);s.set(-p,-q,p,q)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(l,k){var F,x,I,O;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(l,k,this.sortElements);e=g.elements;
+f=g.lights;X=J=0;if(r=f.length>0){E.setRGB(0,0,0);G.setRGB(0,0,0);v.setRGB(0,0,0);F=0;for(x=f.length;F<x;F++)O=f[F],I=O.color,O instanceof THREE.AmbientLight?(E.r+=I.r,E.g+=I.g,E.b+=I.b):O instanceof THREE.DirectionalLight?(G.r+=I.r,G.g+=I.g,G.b+=I.b):O instanceof THREE.PointLight&&(v.r+=I.r,v.g+=I.g,v.b+=I.b)}F=0;for(x=e.length;F<x;F++)if(I=e[F],O=I.material,O=O instanceof THREE.MeshFaceMaterial?I.faceMaterial:O,!(O==null||O.opacity==0))if(u.empty(),I instanceof THREE.RenderableParticle)m=I,m.x*=
+p,m.y*=-q;else if(I instanceof THREE.RenderableLine){if(m=I.v1,t=I.v2,m.positionScreen.x*=p,m.positionScreen.y*=-q,t.positionScreen.x*=p,t.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(t.positionScreen.x,t.positionScreen.y),s.intersects(u)){I=m;var M=t,j=X++;B[j]==null&&(B[j]=document.createElementNS("http://www.w3.org/2000/svg","line"),Y==0&&B[j].setAttribute("shape-rendering","crispEdges"));L=B[j];L.setAttribute("x1",I.positionScreen.x);L.setAttribute("y1",I.positionScreen.y);
 L.setAttribute("x2",M.positionScreen.x);L.setAttribute("y2",M.positionScreen.y);O instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+O.color.getContextStyle()+"; stroke-width: "+O.linewidth+"; stroke-opacity: "+O.opacity+"; stroke-linecap: "+O.linecap+"; stroke-linejoin: "+O.linejoin),i.appendChild(L))}}else if(I instanceof THREE.RenderableFace3){if(m=I.v1,t=I.v2,n=I.v3,m.positionScreen.x*=p,m.positionScreen.y*=-q,t.positionScreen.x*=p,t.positionScreen.y*=-q,n.positionScreen.x*=
 L.setAttribute("x2",M.positionScreen.x);L.setAttribute("y2",M.positionScreen.y);O instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+O.color.getContextStyle()+"; stroke-width: "+O.linewidth+"; stroke-opacity: "+O.opacity+"; stroke-linecap: "+O.linecap+"; stroke-linejoin: "+O.linejoin),i.appendChild(L))}}else if(I instanceof THREE.RenderableFace3){if(m=I.v1,t=I.v2,n=I.v3,m.positionScreen.x*=p,m.positionScreen.y*=-q,t.positionScreen.x*=p,t.positionScreen.y*=-q,n.positionScreen.x*=
 p,n.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(t.positionScreen.x,t.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),s.intersects(u)){var M=m,j=t,C=n;d.info.render.vertices+=3;d.info.render.faces++;L=c(J++);L.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+C.positionScreen.x+","+C.positionScreen.y+"z");O instanceof THREE.MeshBasicMaterial?z.copy(O.color):O instanceof THREE.MeshLambertMaterial?
 p,n.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(t.positionScreen.x,t.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),s.intersects(u)){var M=m,j=t,C=n;d.info.render.vertices+=3;d.info.render.faces++;L=c(J++);L.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+C.positionScreen.x+","+C.positionScreen.y+"z");O instanceof THREE.MeshBasicMaterial?z.copy(O.color):O instanceof THREE.MeshLambertMaterial?
 r?(z.r=E.r,z.g=E.g,z.b=E.b,a(f,I.centroidWorld,I.normalWorld,z),z.r=Math.max(0,Math.min(O.color.r*z.r,1)),z.g=Math.max(0,Math.min(O.color.g*z.g,1)),z.b=Math.max(0,Math.min(O.color.b*z.b,1))):z.copy(O.color):O instanceof THREE.MeshDepthMaterial?(w=1-O.__2near/(O.__farPlusNear-I.z*O.__farMinusNear),z.setRGB(w,w,w)):O instanceof THREE.MeshNormalMaterial&&z.setRGB(b(I.normalWorld.x),b(I.normalWorld.y),b(I.normalWorld.z));O.wireframe?L.setAttribute("style","fill: none; stroke: "+z.getContextStyle()+"; stroke-width: "+
 r?(z.r=E.r,z.g=E.g,z.b=E.b,a(f,I.centroidWorld,I.normalWorld,z),z.r=Math.max(0,Math.min(O.color.r*z.r,1)),z.g=Math.max(0,Math.min(O.color.g*z.g,1)),z.b=Math.max(0,Math.min(O.color.b*z.b,1))):z.copy(O.color):O instanceof THREE.MeshDepthMaterial?(w=1-O.__2near/(O.__farPlusNear-I.z*O.__farMinusNear),z.setRGB(w,w,w)):O instanceof THREE.MeshNormalMaterial&&z.setRGB(b(I.normalWorld.x),b(I.normalWorld.y),b(I.normalWorld.z));O.wireframe?L.setAttribute("style","fill: none; stroke: "+z.getContextStyle()+"; stroke-width: "+
@@ -222,40 +222,40 @@ THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THR
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
 THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var g=d.attributes[e];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=!0;var f=1;g.type==="v2"?f=2:g.type==="v3"?f=3:g.type==="v4"?f=4:g.type==="c"&&(f=3);g.size=f;g.array=new Float32Array(c*f);g.buffer=j.createBuffer();g.buffer.belongsToAttribute=e;g.needsUpdate=!0}a.__webglCustomAttributesList.push(g)}}}
-function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a,b,c){var d,e,g,f,h=a.vertices;f=h.length;var i=a.colors,m=i.length,l=a.__vertexArray,k=a.__colorArray,n=a.__sortArray,p=a.__dirtyVertices,q=a.__dirtyColors,R=a.__webglCustomAttributesList;if(c.sortParticles){Z.multiplySelf(c.matrixWorld);for(d=0;d<f;d++)e=h[d].position,ca.copy(e),Z.multiplyVector3(ca),n[d]=[ca.z,d];n.sort(function(a,
-b){return b[0]-a[0]});for(d=0;d<f;d++)e=h[n[d][1]].position,g=d*3,l[g]=e.x,l[g+1]=e.y,l[g+2]=e.z;for(d=0;d<m;d++)g=d*3,e=i[n[d][1]],k[g]=e.r,k[g+1]=e.g,k[g+2]=e.b;if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.boundTo===void 0||h.boundTo==="vertices")if(g=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)f=n[d][1],h.array[d]=h.value[f];else if(h.size===2)for(d=0;d<e;d++)f=n[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=n[d][1],f=h.value[f],
-h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=n[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=n[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,g+=4}}else{if(p)for(d=0;d<f;d++)e=h[d].position,g=d*3,l[g]=e.x,l[g+1]=e.y,l[g+2]=e.z;if(q)for(d=0;d<m;d++)e=i[d],g=d*3,k[g]=e.r,k[g+1]=e.g,k[g+2]=e.b;if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.needsUpdate&&(h.boundTo===void 0||
-h.boundTo==="vertices"))if(e=h.value.length,g=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,
-g+=4}}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(q||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function g(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
-a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,g,f,h,i,m,l,k,n,p=a.count*3;for(n=0;n<p;n+=9)c=a.normalArray,d=c[n],e=c[n+1],g=c[n+2],f=c[n+3],i=c[n+4],l=c[n+5],h=c[n+6],m=c[n+7],k=c[n+8],d=(d+f+h)/3,e=(e+i+m)/3,g=
-(g+l+k)/3,c[n]=d,c[n+1]=e,c[n+2]=g,c[n+3]=d,c[n+4]=e,c[n+5]=g,c[n+6]=d,c[n+7]=e,c[n+8]=g}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function e(a,b,c,d,e,g){if(d.opacity!==0){var f,h,c=o(a,b,c,d,g),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==K&&(K=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,
-e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;g.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){f=0;var i=g.morphTargetForcedOrder;for(h=g.morphTargetInfluences;f<d.numSupportedMorphTargets&&
-f<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[f]=h[i[f]],f++}else{var i=[],m=-1,l=0;h=g.morphTargetInfluences;var n,k=h.length;f=0;for(g.morphTargetBase!==-1&&(i[g.morphTargetBase]=!0);f<d.numSupportedMorphTargets;){for(n=0;n<k;n++)!i[n]&&h[n]>m&&(l=n,m=h[l]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[f]=
-m;i[l]=1;m=-1;f++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){f=0;for(h=e.__webglCustomAttributesList.length;f<h;f++)c=e.__webglCustomAttributesList[f],b[c.buffer.belongsToAttribute]>=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,
+THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
+function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;var i=a.colors,m=i.length,l=a.__vertexArray,k=a.__colorArray,n=a.__sortArray,p=a.__dirtyVertices,q=a.__dirtyColors,R=a.__webglCustomAttributesList;if(c.sortParticles){V.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,ca.copy(e),V.multiplyVector3(ca),n[d]=[ca.z,d];n.sort(function(a,
+b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[n[d][1]].position,f=d*3,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;for(d=0;d<m;d++)f=d*3,e=i[n[d][1]],k[f]=e.r,k[f+1]=e.g,k[f+2]=e.b;if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.boundTo===void 0||h.boundTo==="vertices")if(f=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)g=n[d][1],h.array[d]=h.value[g];else if(h.size===2)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=n[d][1],g=h.value[g],
+h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(h.size===4)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}else{if(p)for(d=0;d<g;d++)e=h[d].position,f=d*3,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;if(q)for(d=0;d<m;d++)e=i[d],f=d*3,k[f]=e.r,k[f+1]=e.g,k[f+2]=e.b;if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.needsUpdate&&(h.boundTo===void 0||
+h.boundTo==="vertices"))if(e=h.value.length,f=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(h.size===4)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,
+f+=4}}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(q||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function g(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
+a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,m,l,k,n,p=a.count*3;for(n=0;n<p;n+=9)c=a.normalArray,d=c[n],e=c[n+1],f=c[n+2],g=c[n+3],i=c[n+4],l=c[n+5],h=c[n+6],m=c[n+7],k=c[n+8],d=(d+g+h)/3,e=(e+i+m)/3,f=
+(f+l+k)/3,c[n]=d,c[n+1]=e,c[n+2]=f,c[n+3]=d,c[n+4]=e,c[n+5]=f,c[n+6]=d,c[n+7]=e,c[n+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function e(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=o(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==K&&(K=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,
+e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&
+g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],m=-1,l=0;h=f.morphTargetInfluences;var n,k=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(n=0;n<k;n++)!i[n]&&h[n]>m&&(l=n,m=h[l]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=
+m;i[l]=1;m=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],b[c.buffer.belongsToAttribute]>=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,
 3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),
 3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),
 j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,
 j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,
-4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ya&&(j.lineWidth(d),ya=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=
-e.__webglFaceCount,M.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ya&&(j.lineWidth(d),ya=d),j.drawArrays(g,0,e.__webglLineCount),M.info.render.calls++):g instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),M.info.render.calls++):g instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),M.info.render.calls++)}}function f(a){A[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
+4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ya&&(j.lineWidth(d),ya=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=
+e.__webglFaceCount,M.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ya&&(j.lineWidth(d),ya=d),j.drawArrays(f,0,e.__webglLineCount),M.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),M.info.render.calls++):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),M.info.render.calls++)}}function f(a){A[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
 a.n13,a.n44-a.n14);A[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);A[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);A[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);A[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);A[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=A[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
 a.n13,a.n44-a.n14);A[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);A[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);A[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);A[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);A[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=A[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
 a.scale.z)),d=0;d<6;d++)if(a=A[d].x*b.n14+A[d].y*b.n24+A[d].z*b.n34+A[d].w,a<=c)return!1;return!0}function i(a,b){return b.z-a.z}function l(a){var b,c,d,i,m,l,n,k,p=0,q=a.lights;S||(S=new THREE.PerspectiveCamera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));b=0;for(c=q.length;b<c;b++)if(k=q[b],k.castShadow&&k instanceof THREE.SpotLight){Q=-1;M.shadowMap[p]||(M.shadowMap[p]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,{minFilter:THREE.LinearFilter,
 a.scale.z)),d=0;d<6;d++)if(a=A[d].x*b.n14+A[d].y*b.n24+A[d].z*b.n34+A[d].w,a<=c)return!1;return!0}function i(a,b){return b.z-a.z}function l(a){var b,c,d,i,m,l,n,k,p=0,q=a.lights;S||(S=new THREE.PerspectiveCamera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));b=0;for(c=q.length;b<c;b++)if(k=q[b],k.castShadow&&k instanceof THREE.SpotLight){Q=-1;M.shadowMap[p]||(M.shadowMap[p]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,{minFilter:THREE.LinearFilter,
 magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),ga[p]=new THREE.Matrix4);d=M.shadowMap[p];i=ga[p];S.position.copy(k.position);S.lookAt(k.target.position);S.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(S));this.autoUpdateScene&&a.updateMatrixWorld();S.matrixWorldInverse.getInverse(S.matrixWorld);i.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);i.multiplySelf(S.projectionMatrix);i.multiplySelf(S.matrixWorldInverse);S.matrixWorldInverse.flattenToArray($);S.projectionMatrix.flattenToArray(H);
 magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),ga[p]=new THREE.Matrix4);d=M.shadowMap[p];i=ga[p];S.position.copy(k.position);S.lookAt(k.target.position);S.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(S));this.autoUpdateScene&&a.updateMatrixWorld();S.matrixWorldInverse.getInverse(S.matrixWorld);i.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);i.multiplySelf(S.projectionMatrix);i.multiplySelf(S.matrixWorldInverse);S.matrixWorldInverse.flattenToArray($);S.projectionMatrix.flattenToArray(H);
-Z.multiply(S.projectionMatrix,S.matrixWorldInverse);f(Z);B(d);j.clearColor(1,1,1,1);M.clear();j.clearColor(x.r,x.g,x.b,I);i=a.__webglObjects.length;for(d=0;d<i;d++)if(l=a.__webglObjects[d],k=l.object,l.render=!1,k.visible&&k.castShadow&&(!(k instanceof THREE.Mesh)||!k.frustumCulled||h(k)))k.matrixWorld.flattenToArray(k._objectMatrixArray),s(k,S,!1),l.render=!0;r(!0);G(THREE.NormalBlending);for(d=0;d<i;d++)if(l=a.__webglObjects[d],l.render)k=l.object,l=l.buffer,u(k),n=k.customDepthMaterial?k.customDepthMaterial:
-k.geometry.morphTargets.length?va:Y,e(S,q,null,n,l,k);i=a.__webglObjectsImmediate.length;for(d=0;d<i;d++)l=a.__webglObjectsImmediate[d],k=l.object,k.visible&&k.castShadow&&(k.matrixAutoUpdate&&k.matrixWorld.flattenToArray(k._objectMatrixArray),K=-1,s(k,S,!1),u(k),m=o(S,q,null,Y,k),k.immediateRenderCallback?k.immediateRenderCallback(m,j,A):k.render(function(a){g(a,m,Y.shading)}));p++}}function k(a,b,c,d,g,f,h,j){var i,l,k,m;b?(l=a.length-1,m=b=-1):(l=0,b=a.length,m=1);for(var n=l;n!==b;n+=m)if(i=a[n],
-i.render){l=i.object;k=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;h&&G(i.blending);r(i.depthTest);z(i.depthWrite);E(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}u(l);e(d,g,f,i,k,l)}}function p(a,b,c,d,e,f,h){for(var i,l,k,m,n=0,p=a.length;n<p;n++)if(i=a[n],l=i.object,l.visible){K=-1;if(h)k=h;else{k=i[b];if(!k)continue;f&&G(k.blending);r(k.depthTest);z(k.depthWrite);E(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}u(l);m=o(c,d,e,k,l);l.immediateRenderCallback?l.immediateRenderCallback(m,
-j,A):l.render(function(a){g(a,m,k.shading)})}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function o(a,b,c,d,e){d.program||M.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);
-for(var g=0,f=M.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==ha&&(j.useProgram(g),ha=g,h=!0);if(d.id!==Q)Q=d.id,h=!0;if(h){j.uniformMatrix4fv(f.projectionMatrix,!1,H);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var l,
-k,m=0,n=0,p=0,q,R,t,o=aa,Z=o.directional.colors,s=o.directional.positions,A=o.point.colors,u=o.point.positions,B=o.point.distances,r=0,F=0,c=l=t=0,h=b.length;c<h;c++)if(l=b[c],k=l.color,q=l.position,R=l.intensity,t=l.distance,l instanceof THREE.AmbientLight)M.gammaInput?(m+=k.r*k.r,n+=k.g*k.g,p+=k.b*k.b):(m+=k.r,n+=k.g,p+=k.b);else if(l instanceof THREE.DirectionalLight)t=r*3,M.gammaInput?(Z[t]=k.r*k.r*R*R,Z[t+1]=k.g*k.g*R*R,Z[t+2]=k.b*k.b*R*R):(Z[t]=k.r*R,Z[t+1]=k.g*R,Z[t+2]=k.b*R),s[t]=q.x,s[t+
-1]=q.y,s[t+2]=q.z,r+=1;else if(l instanceof THREE.SpotLight)t=r*3,M.gammaInput?(Z[t]=k.r*k.r*R*R,Z[t+1]=k.g*k.g*R*R,Z[t+2]=k.b*k.b*R*R):(Z[t]=k.r*R,Z[t+1]=k.g*R,Z[t+2]=k.b*R),k=1/q.length(),s[t]=q.x*k,s[t+1]=q.y*k,s[t+2]=q.z*k,r+=1;else if(l instanceof THREE.PointLight)l=F*3,M.gammaInput?(A[l]=k.r*k.r*R*R,A[l+1]=k.g*k.g*R*R,A[l+2]=k.b*k.b*R*R):(A[l]=k.r*R,A[l+1]=k.g*R,A[l+2]=k.b*R),u[l]=q.x,u[l+1]=q.y,u[l+2]=q.z,B[F]=t,F+=1;c=r*3;for(h=Z.length;c<h;c++)Z[c]=0;c=F*3;for(h=A.length;c<h;c++)A[c]=0;o.point.length=
-F;o.directional.length=r;o.ambient[0]=m;o.ambient[1]=n;o.ambient[2]=p;b=aa;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,M.gammaInput?
+V.multiply(S.projectionMatrix,S.matrixWorldInverse);f(V);B(d);j.clearColor(1,1,1,1);M.clear();j.clearColor(x.r,x.g,x.b,I);i=a.__webglObjects.length;for(d=0;d<i;d++)if(l=a.__webglObjects[d],k=l.object,l.render=!1,k.visible&&k.castShadow&&(!(k instanceof THREE.Mesh)||!k.frustumCulled||h(k)))k.matrixWorld.flattenToArray(k._objectMatrixArray),s(k,S,!1),l.render=!0;r(!0);G(THREE.NormalBlending);for(d=0;d<i;d++)if(l=a.__webglObjects[d],l.render)k=l.object,l=l.buffer,u(k),n=k.customDepthMaterial?k.customDepthMaterial:
+k.geometry.morphTargets.length?va:Z,e(S,q,null,n,l,k);i=a.__webglObjectsImmediate.length;for(d=0;d<i;d++)l=a.__webglObjectsImmediate[d],k=l.object,k.visible&&k.castShadow&&(k.matrixAutoUpdate&&k.matrixWorld.flattenToArray(k._objectMatrixArray),K=-1,s(k,S,!1),u(k),m=o(S,q,null,Z,k),k.immediateRenderCallback?k.immediateRenderCallback(m,j,A):k.render(function(a){g(a,m,Z.shading)}));p++}}function k(a,b,c,d,f,g,h,j){var i,k,l,m;b?(k=a.length-1,m=b=-1):(k=0,b=a.length,m=1);for(var n=k;n!==b;n+=m)if(i=a[n],
+i.render){k=i.object;l=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;h&&G(i.blending);r(i.depthTest);z(i.depthWrite);E(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}u(k);e(d,f,g,i,l,k)}}function p(a,b,c,d,e,f,h){for(var i,k,l,m,n=0,p=a.length;n<p;n++)if(i=a[n],k=i.object,k.visible){K=-1;if(h)l=h;else{l=i[b];if(!l)continue;f&&G(l.blending);r(l.depthTest);z(l.depthWrite);E(l.polygonOffset,l.polygonOffsetFactor,l.polygonOffsetUnits)}u(k);m=o(c,d,e,l,k);k.immediateRenderCallback?k.immediateRenderCallback(m,
+j,A):k.render(function(a){g(a,m,l.shading)})}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function o(a,b,c,d,e){d.program||M.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);
+for(var f=0,g=M.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==ha&&(j.useProgram(f),ha=f,h=!0);if(d.id!==Q)Q=d.id,h=!0;if(h){j.uniformMatrix4fv(g.projectionMatrix,!1,H);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var k,
+l,m=0,n=0,p=0,q,R,o,t=aa,s=t.directional.colors,V=t.directional.positions,A=t.point.colors,u=t.point.positions,B=t.point.distances,r=0,F=0,c=k=o=0,h=b.length;c<h;c++)if(k=b[c],l=k.color,q=k.position,R=k.intensity,o=k.distance,k instanceof THREE.AmbientLight)M.gammaInput?(m+=l.r*l.r,n+=l.g*l.g,p+=l.b*l.b):(m+=l.r,n+=l.g,p+=l.b);else if(k instanceof THREE.DirectionalLight)o=r*3,M.gammaInput?(s[o]=l.r*l.r*R*R,s[o+1]=l.g*l.g*R*R,s[o+2]=l.b*l.b*R*R):(s[o]=l.r*R,s[o+1]=l.g*R,s[o+2]=l.b*R),V[o]=q.x,V[o+
+1]=q.y,V[o+2]=q.z,r+=1;else if(k instanceof THREE.SpotLight)o=r*3,M.gammaInput?(s[o]=l.r*l.r*R*R,s[o+1]=l.g*l.g*R*R,s[o+2]=l.b*l.b*R*R):(s[o]=l.r*R,s[o+1]=l.g*R,s[o+2]=l.b*R),l=1/q.length(),V[o]=q.x*l,V[o+1]=q.y*l,V[o+2]=q.z*l,r+=1;else if(k instanceof THREE.PointLight)k=F*3,M.gammaInput?(A[k]=l.r*l.r*R*R,A[k+1]=l.g*l.g*R*R,A[k+2]=l.b*l.b*R*R):(A[k]=l.r*R,A[k+1]=l.g*R,A[k+2]=l.b*R),u[k]=q.x,u[k+1]=q.y,u[k+2]=q.z,B[F]=o,F+=1;c=r*3;for(h=s.length;c<h;c++)s[c]=0;c=F*3;for(h=A.length;c<h;c++)A[c]=0;t.point.length=
+F;t.directional.length=r;t.ambient[0]=m;t.ambient[1]=n;t.ambient[2]=p;b=aa;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,M.gammaInput?
 i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof
 i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof
-THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=W.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,M.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof THREE.MeshLambertMaterial)M.gammaInput?
+THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=X.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,M.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof THREE.MeshLambertMaterial)M.gammaInput?
 i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<ga.length;b++)i.shadowMatrix.value[b]=ga[b],i.shadowMap.texture[b]=M.shadowMap[b];i.shadowDarkness.value=M.shadowMapDarkness;i.shadowBias.value=M.shadowMapBias}b=d.uniformsList;i=0;for(c=
 i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<ga.length;b++)i.shadowMatrix.value[b]=ga[b],i.shadowMap.texture[b]=M.shadowMap[b];i.shadowDarkness.value=M.shadowMapDarkness;i.shadowBias.value=M.shadowMapBias}b=d.uniformsList;i=0;for(c=
-b.length;i<c;i++)if(n=g.uniforms[b[i][1]])if(m=b[i][0],p=m.type,h=m.value,p==="i")j.uniform1i(n,h);else if(p==="f")j.uniform1f(n,h);else if(p==="v2")j.uniform2f(n,h.x,h.y);else if(p==="v3")j.uniform3f(n,h.x,h.y,h.z);else if(p==="v4")j.uniform4f(n,h.x,h.y,h.z,h.w);else if(p==="c")j.uniform3f(n,h.r,h.g,h.b);else if(p==="fv1")j.uniform1fv(n,h);else if(p==="fv")j.uniform3fv(n,h);else if(p==="v3v"){if(!m._array)m._array=new Float32Array(3*h.length);p=0;for(q=h.length;p<q;p++)o=p*3,m._array[o]=h[p].x,m._array[o+
-1]=h[p].y,m._array[o+2]=h[p].z;j.uniform3fv(n,m._array)}else if(p==="m4"){if(!m._array)m._array=new Float32Array(16);h.flattenToArray(m._array);j.uniformMatrix4fv(n,!1,m._array)}else if(p==="m4v"){if(!m._array)m._array=new Float32Array(16*h.length);p=0;for(q=h.length;p<q;p++)h[p].flattenToArrayOffset(m._array,p*16);j.uniformMatrix4fv(n,!1,m._array)}else if(p==="t"){if(j.uniform1i(n,h),n=m.texture)if(n.image instanceof Array&&n.image.length===6){if(m=n,m.image.length===6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=
+b.length;i<c;i++)if(n=f.uniforms[b[i][1]])if(m=b[i][0],p=m.type,h=m.value,p==="i")j.uniform1i(n,h);else if(p==="f")j.uniform1f(n,h);else if(p==="v2")j.uniform2f(n,h.x,h.y);else if(p==="v3")j.uniform3f(n,h.x,h.y,h.z);else if(p==="v4")j.uniform4f(n,h.x,h.y,h.z,h.w);else if(p==="c")j.uniform3f(n,h.r,h.g,h.b);else if(p==="fv1")j.uniform1fv(n,h);else if(p==="fv")j.uniform3fv(n,h);else if(p==="v3v"){if(!m._array)m._array=new Float32Array(3*h.length);p=0;for(q=h.length;p<q;p++)t=p*3,m._array[t]=h[p].x,m._array[t+
+1]=h[p].y,m._array[t+2]=h[p].z;j.uniform3fv(n,m._array)}else if(p==="m4"){if(!m._array)m._array=new Float32Array(16);h.flattenToArray(m._array);j.uniformMatrix4fv(n,!1,m._array)}else if(p==="m4v"){if(!m._array)m._array=new Float32Array(16*h.length);p=0;for(q=h.length;p<q;p++)h[p].flattenToArrayOffset(m._array,p*16);j.uniformMatrix4fv(n,!1,m._array)}else if(p==="t"){if(j.uniform1i(n,h),n=m.texture)if(n.image instanceof Array&&n.image.length===6){if(m=n,m.image.length===6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=
 j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);h=w(j.TEXTURE_CUBE_MAP,m,m.image[0]);for(n=0;n<6;n++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,m.image[n]);h&&j.generateMipmap(j.TEXTURE_CUBE_MAP);m.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(m=n,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,
 j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);h=w(j.TEXTURE_CUBE_MAP,m,m.image[0]);for(n=0;n<6;n++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,m.image[n]);h&&j.generateMipmap(j.TEXTURE_CUBE_MAP);m.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(m=n,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,
-m.__webglTexture)):C(n,h)}else if(p==="tv"){if(!m._array){m._array=[];p=0;for(q=m.texture.length;p<q;p++)m._array[p]=h+p}j.uniform1iv(n,m._array);p=0;for(q=m.texture.length;p<q;p++)(n=m.texture[p])&&C(n,m._array[p])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&f.cameraPosition!==null&&j.uniform3f(f.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||
-d.skinning)&&f.viewMatrix!==null&&j.uniformMatrix4fv(f.viewMatrix,!1,$);d.skinning&&(j.uniformMatrix4fv(f.cameraInverseMatrix,!1,$),j.uniformMatrix4fv(f.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(f.modelViewMatrix,!1,e._modelViewMatrixArray);f.normalMatrix&&j.uniformMatrix3fv(f.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&f.objectMatrix!==null&&j.uniformMatrix4fv(f.objectMatrix,!1,e._objectMatrixArray);return g}function s(a,
+m.__webglTexture)):C(n,h)}else if(p==="tv"){if(!m._array){m._array=[];p=0;for(q=m.texture.length;p<q;p++)m._array[p]=h+p}j.uniform1iv(n,m._array);p=0;for(q=m.texture.length;p<q;p++)(n=m.texture[p])&&C(n,m._array[p])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null&&j.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||
+d.skinning)&&g.viewMatrix!==null&&j.uniformMatrix4fv(g.viewMatrix,!1,$);d.skinning&&(j.uniformMatrix4fv(g.cameraInverseMatrix,!1,$),j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&g.objectMatrix!==null&&j.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function s(a,
 b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function u(a){if(U!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),U=a.doubleSided;if(ia!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ia=a.flipSided}function r(a){na!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),na=a)}function z(a){ka!==a&&(j.depthMask(a),
 b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function u(a){if(U!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),U=a.doubleSided;if(ia!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ia=a.flipSided}function r(a){na!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),na=a)}function z(a){ka!==a&&(j.depthMask(a),
 ka=a)}function E(a,b,c){oa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),oa=a);if(a&&(la!==b||ma!==c))j.polygonOffset(b,c),la=b,ma=c}function G(a){if(a!==pa){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,
 ka=a)}function E(a,b,c){oa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),oa=a);if(a&&(la!==b||ma!==c))j.polygonOffset(b,c),la=b,ma=c}function G(a){if(a!==pa){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,
 j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}pa=a}}function v(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(b),null;return c}function w(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,J(b.wrapS)),
 j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}pa=a}}function v(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(b),null;return c}function w(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,J(b.wrapS)),
@@ -264,83 +264,83 @@ j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);var c
 a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function B(a){var b=a instanceof THREE.WebGLRenderTargetCube;
 a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function B(a){var b=a instanceof THREE.WebGLRenderTargetCube;
 if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);w(j.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,J(a.format),a.width,a.height,0,J(a.format),J(a.type),
 if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);w(j.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,J(a.format),a.width,a.height,0,J(a.format),J(a.type),
 null);var d=a,e=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,e,d.__webglTexture,0);F(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),w(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,J(a.format),a.width,a.height,0,J(a.format),J(a.type),null),c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,
 null);var d=a,e=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,e,d.__webglTexture,0);F(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),w(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,J(a.format),a.width,a.height,0,J(a.format),J(a.type),null),c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,
-a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,c,a.__webglTexture,0),j.bindRenderbuffer(j.RENDERBUFFER,a.__webglRenderbuffer),F(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=xa,a=R,d=ra,e=sa);b!==V&&(j.bindFramebuffer(j.FRAMEBUFFER,b),
-j.viewport(d,e,c,a),V=b)}function L(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function J(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;
+a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,c,a.__webglTexture,0),j.bindRenderbuffer(j.RENDERBUFFER,a.__webglRenderbuffer),F(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=xa,a=R,d=ra,e=sa);b!==W&&(j.bindFramebuffer(j.FRAMEBUFFER,b),
+j.viewport(d,e,c,a),W=b)}function L(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function J(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;
 case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;
 case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;
-case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},W=a.canvas!==void 0?a.canvas:document.createElement("canvas"),X=a.precision!==void 0?a.precision:"highp",T=a.antialias!==void 0?a.antialias:!1,ea=a.stencil!==void 0?a.stencil:!0,ba=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,x=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),
-I=a.clearAlpha!==void 0?a.clearAlpha:0,O=a.maxLights!==void 0?a.maxLights:4;this.domElement=W;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=
-[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var M=this,j,P=[],ha=null,V=null,Q=-1,K=null,fa=0,U=null,ia=null,pa=null,na=null,ka=null,oa=null,la=null,ma=null,ya=null,ra=0,sa=0,xa=0,R=0,A=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Z=new THREE.Matrix4,H=new Float32Array(16),$=new Float32Array(16),
-ca=new THREE.Vector4,aa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},S,ga=[],Y,va,N={},ua=!1;j=function(){var a;try{if(!(a=W.getContext("experimental-webgl",{antialias:T,stencil:ea,preserveDrawingBuffer:ba})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();
+case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},X=a.canvas!==void 0?a.canvas:document.createElement("canvas"),Y=a.precision!==void 0?a.precision:"highp",T=a.antialias!==void 0?a.antialias:!1,ea=a.stencil!==void 0?a.stencil:!0,ba=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,x=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),
+I=a.clearAlpha!==void 0?a.clearAlpha:0,O=a.maxLights!==void 0?a.maxLights:4;this.domElement=X;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=
+[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var M=this,j,P=[],ha=null,W=null,Q=-1,K=null,fa=0,U=null,ia=null,pa=null,na=null,ka=null,oa=null,la=null,ma=null,ya=null,ra=0,sa=0,xa=0,R=0,A=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],V=new THREE.Matrix4,H=new Float32Array(16),$=new Float32Array(16),
+ca=new THREE.Vector4,aa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},S,ga=[],Z,va,N={},ua=!1;j=function(){var a;try{if(!(a=X.getContext("experimental-webgl",{antialias:T,stencil:ea,preserveDrawingBuffer:ba})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();
 j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(x.r,x.g,x.b,I);(function(){N.vertices=new Float32Array(16);N.faces=new Uint16Array(6);var a=0;N.vertices[a++]=-1;N.vertices[a++]=-1;N.vertices[a++]=0;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=-1;N.vertices[a++]=1;N.vertices[a++]=
 j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(x.r,x.g,x.b,I);(function(){N.vertices=new Float32Array(16);N.faces=new Uint16Array(6);var a=0;N.vertices[a++]=-1;N.vertices[a++]=-1;N.vertices[a++]=0;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=-1;N.vertices[a++]=1;N.vertices[a++]=
 1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=0;N.vertices[a++]=-1;N.vertices[a++]=1;N.vertices[a++]=0;a=N.vertices[a++]=0;N.faces[a++]=0;N.faces[a++]=1;N.faces[a++]=2;N.faces[a++]=0;N.faces[a++]=2;N.faces[a++]=3;N.vertexBuffer=j.createBuffer();N.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,N.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,N.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,N.faces,j.STATIC_DRAW);
 1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=0;N.vertices[a++]=-1;N.vertices[a++]=1;N.vertices[a++]=0;a=N.vertices[a++]=0;N.faces[a++]=0;N.faces[a++]=1;N.faces[a++]=2;N.faces[a++]=0;N.faces[a++]=2;N.faces[a++]=3;N.vertexBuffer=j.createBuffer();N.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,N.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,N.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,N.faces,j.STATIC_DRAW);
 N.program=j.createProgram();j.attachShader(N.program,v("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(N.program,v("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.position=j.getAttribLocation(N.program,"position");N.attributes.uv=j.getAttribLocation(N.program,"uv");N.uniforms.uvOffset=j.getUniformLocation(N.program,"uvOffset");N.uniforms.uvScale=j.getUniformLocation(N.program,"uvScale");N.uniforms.rotation=j.getUniformLocation(N.program,
 N.program=j.createProgram();j.attachShader(N.program,v("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(N.program,v("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.position=j.getAttribLocation(N.program,"position");N.attributes.uv=j.getAttribLocation(N.program,"uv");N.uniforms.uvOffset=j.getUniformLocation(N.program,"uvOffset");N.uniforms.uvScale=j.getUniformLocation(N.program,"uvScale");N.uniforms.rotation=j.getUniformLocation(N.program,
 "rotation");N.uniforms.scale=j.getUniformLocation(N.program,"scale");N.uniforms.alignment=j.getUniformLocation(N.program,"alignment");N.uniforms.color=j.getUniformLocation(N.program,"color");N.uniforms.map=j.getUniformLocation(N.program,"map");N.uniforms.opacity=j.getUniformLocation(N.program,"opacity");N.uniforms.useScreenCoordinates=j.getUniformLocation(N.program,"useScreenCoordinates");N.uniforms.affectedByDistance=j.getUniformLocation(N.program,"affectedByDistance");N.uniforms.screenPosition=
 "rotation");N.uniforms.scale=j.getUniformLocation(N.program,"scale");N.uniforms.alignment=j.getUniformLocation(N.program,"alignment");N.uniforms.color=j.getUniformLocation(N.program,"color");N.uniforms.map=j.getUniformLocation(N.program,"map");N.uniforms.opacity=j.getUniformLocation(N.program,"opacity");N.uniforms.useScreenCoordinates=j.getUniformLocation(N.program,"useScreenCoordinates");N.uniforms.affectedByDistance=j.getUniformLocation(N.program,"affectedByDistance");N.uniforms.screenPosition=
-j.getUniformLocation(N.program,"screenPosition");N.uniforms.modelViewMatrix=j.getUniformLocation(N.program,"modelViewMatrix");N.uniforms.projectionMatrix=j.getUniformLocation(N.program,"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);Y=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});
-Y._shadowPass=!0;va._shadowPass=!0})();this.context=j;var ta=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=function(){return ta};this.setSize=function(a,b){W.width=a;W.height=b;this.setViewport(0,0,W.width,W.height)};this.setViewport=function(a,b,c,d){ra=a;sa=b;xa=c;R=d;j.viewport(ra,sa,xa,R)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};
+j.getUniformLocation(N.program,"screenPosition");N.uniforms.modelViewMatrix=j.getUniformLocation(N.program,"modelViewMatrix");N.uniforms.projectionMatrix=j.getUniformLocation(N.program,"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);Z=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});
+Z._shadowPass=!0;va._shadowPass=!0})();this.context=j;var ta=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=function(){return ta};this.setSize=function(a,b){X.width=a;X.height=b;this.setViewport(0,0,X.width,X.height)};this.setViewport=function(a,b,c,d){ra=a;sa=b;xa=c;R=d;j.viewport(ra,sa,xa,R)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};
 this.setClearColorHex=function(a,b){x.setHex(a);I=b;j.clearColor(x.r,x.g,x.b,I)};this.setClearColor=function(a,b){x.copy(a);I=b;j.clearColor(x.r,x.g,x.b,I)};this.getClearColor=function(){return x};this.getClearAlpha=function(){return I};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){B(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=
 this.setClearColorHex=function(a,b){x.setHex(a);I=b;j.clearColor(x.r,x.g,x.b,I)};this.setClearColor=function(a,b){x.copy(a);I=b;j.clearColor(x.r,x.g,x.b,I)};this.getClearColor=function(){return x};this.getClearAlpha=function(){return I};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){B(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=
 !1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);
 !1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);
 j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);M.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),
 j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);M.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),
 j.deleteBuffer(a.__webglColorBuffer),M.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),M.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),M.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),M.info.memory.textures--};this.updateShadowMap=
 j.deleteBuffer(a.__webglColorBuffer),M.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),M.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),M.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),M.info.memory.textures--};this.updateShadowMap=
-function(a,b){l(a,b)};this.render=function(a,b,c,d){var e,g,m,n,q=a.lights,t=a.fog;Q=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&l(a,b);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray($);b.projectionMatrix.flattenToArray(H);
-Z.multiply(b.projectionMatrix,b.matrixWorldInverse);f(Z);B(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;d=0;for(e=n.length;d<e;d++)if(g=n[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||h(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);s(m,b,!0);var o=g,A=o.object,u=o.buffer,F=void 0,F=F=void 0,F=A.material;if(F instanceof THREE.MeshFaceMaterial){if(F=u.materialIndex,F>=0)F=A.geometry.materials[F],
-F.transparent?(o.transparent=F,o.opaque=null):(o.opaque=F,o.transparent=null)}else if(F)F.transparent?(o.transparent=F,o.opaque=null):(o.opaque=F,o.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?g.z=m.renderDepth:(ca.copy(m.position),Z.multiplyVector3(ca),g.z=ca.z)}this.sortObjects&&n.sort(i);n=a.__webglObjectsImmediate;d=0;for(e=n.length;d<e;d++)if(g=n[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),s(m,b,!0),m=g.object.material,m.transparent?
-(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?(G(a.overrideMaterial.blending),r(a.overrideMaterial.depthTest),z(a.overrideMaterial.depthWrite),E(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,q,t,!0,a.overrideMaterial),p(a.__webglObjectsImmediate,"",b,q,t,!1,a.overrideMaterial)):(G(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",b,q,t,!1),p(a.__webglObjectsImmediate,
-"opaque",b,q,t,!1),k(a.__webglObjects,!1,"transparent",b,q,t,!0),p(a.__webglObjectsImmediate,"transparent",b,q,t,!0));if(a.__webglSprites.length){m=N.attributes;q=N.uniforms;t=R/xa;d=[];e=xa*0.5;n=R*0.5;g=!0;j.useProgram(N.program);ha=N.program;K=na=pa=-1;ua||(j.enableVertexAttribArray(N.attributes.position),j.enableVertexAttribArray(N.attributes.uv),ua=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.vertexAttribPointer(m.position,2,j.FLOAT,
-!1,16,0);j.vertexAttribPointer(m.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,N.elementBuffer);j.uniformMatrix4fv(q.projectionMatrix,!1,H);j.activeTexture(j.TEXTURE0);j.uniform1i(q.map,0);m=0;for(o=a.__webglSprites.length;m<o;m++)if(A=a.__webglSprites[m],A.visible&&A.opacity!==0)A.useScreenCoordinates?A.z=-A.position.z:(A._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,A.matrixWorld,A._modelViewMatrixArray),A.z=-A._modelViewMatrix.n34);a.__webglSprites.sort(i);m=0;for(o=a.__webglSprites.length;m<
-o;m++)A=a.__webglSprites[m],A.visible&&A.opacity!==0&&A.map&&A.map.image&&A.map.image.width&&(A.useScreenCoordinates?(j.uniform1i(q.useScreenCoordinates,1),j.uniform3f(q.screenPosition,(A.position.x-e)/e,(n-A.position.y)/n,Math.max(0,Math.min(1,A.position.z)))):(j.uniform1i(q.useScreenCoordinates,0),j.uniform1i(q.affectedByDistance,A.affectedByDistance?1:0),j.uniformMatrix4fv(q.modelViewMatrix,!1,A._modelViewMatrixArray)),b=A.map.image.width/(A.scaleByViewport?R:1),d[0]=b*t*A.scale.x,d[1]=b*A.scale.y,
+function(a,b){l(a,b)};this.render=function(a,b,c,d){var e,g,m,n,q=a.lights,o=a.fog;Q=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&l(a,b);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray($);b.projectionMatrix.flattenToArray(H);
+V.multiply(b.projectionMatrix,b.matrixWorldInverse);f(V);B(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;d=0;for(e=n.length;d<e;d++)if(g=n[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||h(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);s(m,b,!0);var t=g,A=t.object,u=t.buffer,F=void 0,F=F=void 0,F=A.material;if(F instanceof THREE.MeshFaceMaterial){if(F=u.materialIndex,F>=0)F=A.geometry.materials[F],
+F.transparent?(t.transparent=F,t.opaque=null):(t.opaque=F,t.transparent=null)}else if(F)F.transparent?(t.transparent=F,t.opaque=null):(t.opaque=F,t.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?g.z=m.renderDepth:(ca.copy(m.position),V.multiplyVector3(ca),g.z=ca.z)}this.sortObjects&&n.sort(i);n=a.__webglObjectsImmediate;d=0;for(e=n.length;d<e;d++)if(g=n[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),s(m,b,!0),m=g.object.material,m.transparent?
+(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?(G(a.overrideMaterial.blending),r(a.overrideMaterial.depthTest),z(a.overrideMaterial.depthWrite),E(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,q,o,!0,a.overrideMaterial),p(a.__webglObjectsImmediate,"",b,q,o,!1,a.overrideMaterial)):(G(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",b,q,o,!1),p(a.__webglObjectsImmediate,
+"opaque",b,q,o,!1),k(a.__webglObjects,!1,"transparent",b,q,o,!0),p(a.__webglObjectsImmediate,"transparent",b,q,o,!0));if(a.__webglSprites.length){m=N.attributes;q=N.uniforms;o=R/xa;d=[];e=xa*0.5;n=R*0.5;g=!0;j.useProgram(N.program);ha=N.program;K=na=pa=-1;ua||(j.enableVertexAttribArray(N.attributes.position),j.enableVertexAttribArray(N.attributes.uv),ua=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.vertexAttribPointer(m.position,2,j.FLOAT,
+!1,16,0);j.vertexAttribPointer(m.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,N.elementBuffer);j.uniformMatrix4fv(q.projectionMatrix,!1,H);j.activeTexture(j.TEXTURE0);j.uniform1i(q.map,0);m=0;for(t=a.__webglSprites.length;m<t;m++)if(A=a.__webglSprites[m],A.visible&&A.opacity!==0)A.useScreenCoordinates?A.z=-A.position.z:(A._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,A.matrixWorld,A._modelViewMatrixArray),A.z=-A._modelViewMatrix.n34);a.__webglSprites.sort(i);m=0;for(t=a.__webglSprites.length;m<
+t;m++)A=a.__webglSprites[m],A.visible&&A.opacity!==0&&A.map&&A.map.image&&A.map.image.width&&(A.useScreenCoordinates?(j.uniform1i(q.useScreenCoordinates,1),j.uniform3f(q.screenPosition,(A.position.x-e)/e,(n-A.position.y)/n,Math.max(0,Math.min(1,A.position.z)))):(j.uniform1i(q.useScreenCoordinates,0),j.uniform1i(q.affectedByDistance,A.affectedByDistance?1:0),j.uniformMatrix4fv(q.modelViewMatrix,!1,A._modelViewMatrixArray)),b=A.map.image.width/(A.scaleByViewport?R:1),d[0]=b*o*A.scale.x,d[1]=b*A.scale.y,
 j.uniform2f(q.uvScale,A.uvScale.x,A.uvScale.y),j.uniform2f(q.uvOffset,A.uvOffset.x,A.uvOffset.y),j.uniform2f(q.alignment,A.alignment.x,A.alignment.y),j.uniform1f(q.opacity,A.opacity),j.uniform3f(q.color,A.color.r,A.color.g,A.color.b),j.uniform1f(q.rotation,A.rotation),j.uniform2fv(q.scale,d),A.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!A.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),G(A.blending),C(A.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);
 j.uniform2f(q.uvScale,A.uvScale.x,A.uvScale.y),j.uniform2f(q.uvOffset,A.uvOffset.x,A.uvOffset.y),j.uniform2f(q.alignment,A.alignment.x,A.alignment.y),j.uniform1f(q.opacity,A.opacity),j.uniform3f(q.color,A.color.r,A.color.g,A.color.b),j.uniform1f(q.rotation,A.rotation),j.uniform2fv(q.scale,d),A.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!A.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),G(A.blending),C(A.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);
 j.depthMask(ka)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=
 j.depthMask(ka)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=
-a.__objectsAdded[0],g=a,f=void 0,h=void 0,i=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups===void 0){var i=h,k=void 0,l=void 0,p=void 0,R=void 0,o=void 0,A=void 0,Z=void 0,s={},u=i.morphTargets.length;i.geometryGroups={};k=0;for(l=
-i.faces.length;k<l;k++)p=i.faces[k],R=p.materialIndex,A=R!==void 0?R:-1,s[A]===void 0&&(s[A]={hash:A,counter:0}),Z=s[A].hash+"_"+s[A].counter,i.geometryGroups[Z]===void 0&&(i.geometryGroups[Z]={faces3:[],faces4:[],materialIndex:R,vertices:0,numMorphTargets:u}),o=p instanceof THREE.Face3?3:4,i.geometryGroups[Z].vertices+o>65535&&(s[A].counter+=1,Z=s[A].hash+"_"+s[A].counter,i.geometryGroups[Z]===void 0&&(i.geometryGroups[Z]={faces3:[],faces4:[],materialIndex:R,vertices:0,numMorphTargets:u})),p instanceof
-THREE.Face3?i.geometryGroups[Z].faces3.push(k):i.geometryGroups[Z].faces4.push(k),i.geometryGroups[Z].vertices+=o;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=fa++,i.geometryGroupsList.push(i.geometryGroups[k])}for(f in h.geometryGroups)if(i=h.geometryGroups[f],!i.__webglVertexBuffer){k=i;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=
-j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){p=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(p=k.numMorphTargets;l<p;l++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}M.info.memory.geometries++;R=e;o=R.geometry;l=
-i.faces3;A=i.faces4;k=l.length*3+A.length*4;p=l.length*1+A.length*2;A=l.length*3+A.length*4;l=b(R,i);Z=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;s=l instanceof THREE.MeshBasicMaterial&&!l.envMap||l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;u=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(k*3);if(s)i.__normalArray=new Float32Array(k*3);if(o.hasTangents)i.__tangentArray=new Float32Array(k*
-4);if(u)i.__colorArray=new Float32Array(k*3);if(Z){if(o.faceUvs.length>0||o.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(o.faceUvs.length>1||o.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(R.geometry.skinWeights.length&&R.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(p*3);i.__lineArray=new Uint16Array(A*
-2);if(i.numMorphTargets){i.__morphTargetsArrays=[];R=0;for(o=i.numMorphTargets;R<o;R++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=s===THREE.SmoothShading;i.__uvType=Z;i.__vertexColorType=u;i.__normalType=s;i.__webglFaceCount=p*3;i.__webglLineCount=A*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];p=void 0;for(p in l.attributes){var R=l.attributes[p],o={},B;for(B in R)o[B]=R[B];if(!o.__webglInitialized||o.createUniqueBuffers)o.__webglInitialized=
-!0,A=1,o.type==="v2"?A=2:o.type==="v3"?A=3:o.type==="v4"?A=4:o.type==="c"&&(A=3),o.size=A,o.array=new Float32Array(k*A),o.buffer=j.createBuffer(),o.buffer.belongsToAttribute=p,R.needsUpdate=!0,o.__original=R;i.__webglCustomAttributesList.push(o)}}i.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=
-j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),M.info.memory.geometries++,i=h,k=i.vertices.length,i.__vertexArray=new Float32Array(k*3),i.__colorArray=new Float32Array(k*3),i.__webglVertexCount=k,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),M.info.memory.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=
-new Float32Array(l*3),i.__webglLineCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer))i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),M.info.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__sortArray=[],i.__webglParticleCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!e.__webglActive){if(e instanceof THREE.Mesh)for(f in h=
+a.__objectsAdded[0],g=a,f=void 0,h=void 0,i=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups===void 0){var i=h,l=void 0,k=void 0,p=void 0,R=void 0,o=void 0,A=void 0,s=void 0,V={},u=i.morphTargets.length;i.geometryGroups={};l=0;for(k=
+i.faces.length;l<k;l++)p=i.faces[l],R=p.materialIndex,A=R!==void 0?R:-1,V[A]===void 0&&(V[A]={hash:A,counter:0}),s=V[A].hash+"_"+V[A].counter,i.geometryGroups[s]===void 0&&(i.geometryGroups[s]={faces3:[],faces4:[],materialIndex:R,vertices:0,numMorphTargets:u}),o=p instanceof THREE.Face3?3:4,i.geometryGroups[s].vertices+o>65535&&(V[A].counter+=1,s=V[A].hash+"_"+V[A].counter,i.geometryGroups[s]===void 0&&(i.geometryGroups[s]={faces3:[],faces4:[],materialIndex:R,vertices:0,numMorphTargets:u})),p instanceof
+THREE.Face3?i.geometryGroups[s].faces3.push(l):i.geometryGroups[s].faces4.push(l),i.geometryGroups[s].vertices+=o;i.geometryGroupsList=[];l=void 0;for(l in i.geometryGroups)i.geometryGroups[l].id=fa++,i.geometryGroupsList.push(i.geometryGroups[l])}for(f in h.geometryGroups)if(i=h.geometryGroups[f],!i.__webglVertexBuffer){l=i;l.__webglVertexBuffer=j.createBuffer();l.__webglNormalBuffer=j.createBuffer();l.__webglTangentBuffer=j.createBuffer();l.__webglColorBuffer=j.createBuffer();l.__webglUVBuffer=
+j.createBuffer();l.__webglUV2Buffer=j.createBuffer();l.__webglSkinVertexABuffer=j.createBuffer();l.__webglSkinVertexBBuffer=j.createBuffer();l.__webglSkinIndicesBuffer=j.createBuffer();l.__webglSkinWeightsBuffer=j.createBuffer();l.__webglFaceBuffer=j.createBuffer();l.__webglLineBuffer=j.createBuffer();if(l.numMorphTargets){p=k=void 0;l.__webglMorphTargetsBuffers=[];k=0;for(p=l.numMorphTargets;k<p;k++)l.__webglMorphTargetsBuffers.push(j.createBuffer())}M.info.memory.geometries++;R=e;o=R.geometry;k=
+i.faces3;A=i.faces4;l=k.length*3+A.length*4;p=k.length*1+A.length*2;A=k.length*3+A.length*4;k=b(R,i);s=k.map||k.lightMap||k instanceof THREE.ShaderMaterial?!0:!1;V=k instanceof THREE.MeshBasicMaterial&&!k.envMap||k instanceof THREE.MeshDepthMaterial?!1:k&&k.shading!==void 0&&k.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;u=k.vertexColors?k.vertexColors:!1;i.__vertexArray=new Float32Array(l*3);if(V)i.__normalArray=new Float32Array(l*3);if(o.hasTangents)i.__tangentArray=new Float32Array(l*
+4);if(u)i.__colorArray=new Float32Array(l*3);if(s){if(o.faceUvs.length>0||o.faceVertexUvs.length>0)i.__uvArray=new Float32Array(l*2);if(o.faceUvs.length>1||o.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(l*2)}if(R.geometry.skinWeights.length&&R.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(l*4),i.__skinVertexBArray=new Float32Array(l*4),i.__skinIndexArray=new Float32Array(l*4),i.__skinWeightArray=new Float32Array(l*4);i.__faceArray=new Uint16Array(p*3);i.__lineArray=new Uint16Array(A*
+2);if(i.numMorphTargets){i.__morphTargetsArrays=[];R=0;for(o=i.numMorphTargets;R<o;R++)i.__morphTargetsArrays.push(new Float32Array(l*3))}i.__needsSmoothNormals=V===THREE.SmoothShading;i.__uvType=s;i.__vertexColorType=u;i.__normalType=V;i.__webglFaceCount=p*3;i.__webglLineCount=A*2;if(k.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];p=void 0;for(p in k.attributes){var R=k.attributes[p],o={},B;for(B in R)o[B]=R[B];if(!o.__webglInitialized||o.createUniqueBuffers)o.__webglInitialized=
+!0,A=1,o.type==="v2"?A=2:o.type==="v3"?A=3:o.type==="v4"?A=4:o.type==="c"&&(A=3),o.size=A,o.array=new Float32Array(l*A),o.buffer=j.createBuffer(),o.buffer.belongsToAttribute=p,R.needsUpdate=!0,o.__original=R;i.__webglCustomAttributesList.push(o)}}i.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=
+j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),M.info.memory.geometries++,i=h,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__webglVertexCount=l,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),M.info.memory.geometries++,i=h,l=e,k=i.vertices.length,i.__vertexArray=new Float32Array(k*3),i.__colorArray=
+new Float32Array(k*3),i.__webglLineCount=k,c(i,l),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer))i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),M.info.geometries++,i=h,l=e,k=i.vertices.length,i.__vertexArray=new Float32Array(k*3),i.__colorArray=new Float32Array(k*3),i.__sortArray=[],i.__webglParticleCount=k,c(i,l),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!e.__webglActive){if(e instanceof THREE.Mesh)for(f in h=
 e.geometry,h.geometryGroups)i=h.geometryGroups[f],q(g.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(h=e.geometry,q(g.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?g.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&g.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=
 e.geometry,h.geometryGroups)i=h.geometryGroups[f],q(g.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(h=e.geometry,q(g.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?g.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&g.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=
 a.__objectsRemoved[0];g=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)n(g.__webglObjects,e);else if(e instanceof THREE.Sprite){g=g.__webglSprites;f=e;for(h=g.length-1;h>=0;h--)g[h]===f&&g.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&n(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e<g;e++)if(B=a.__webglObjects[e].object,f=B.geometry,
 a.__objectsRemoved[0];g=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)n(g.__webglObjects,e);else if(e instanceof THREE.Sprite){g=g.__webglSprites;f=e;for(h=g.length-1;h>=0;h--)g[h]===f&&g.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&n(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e<g;e++)if(B=a.__webglObjects[e].object,f=B.geometry,
-h=p=l=void 0,B instanceof THREE.Mesh){i=0;for(k=f.geometryGroupsList.length;i<k;i++)if(l=f.geometryGroupsList[i],h=b(B,l),p=h.attributes&&m(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||p)if(p=j.DYNAMIC_DRAW,R=!f.dynamic,l.__inittedArrays){var F=A=o=void 0,r=void 0,L=void 0,z=void 0,H=void 0,J=void 0,I=void 0,O=void 0,G=void 0,C=F=z=void 0,x=void 0,w=void 0,v=void 0,E=r=void 0,$=void 0,ca=r=I=G=void 0,N=void 0,T=
-v=w=x=H=void 0,S=r=v=w=x=T=v=w=x=T=v=w=x=void 0,aa=void 0,W=z=void 0,X=void 0,Q=void 0,ea=void 0,V=void 0,K=C=Q=aa=0,ba=0,U=S=F=0,P=H=E=0,D=0,ga=void 0,P=l.__vertexArray,X=l.__uvArray,D=l.__uv2Array,W=l.__normalArray,L=l.__tangentArray,$=l.__colorArray,ca=l.__skinVertexAArray,N=l.__skinVertexBArray,J=l.__skinIndexArray,Y=l.__skinWeightArray,T=l.__morphTargetsArrays,Z=l.__webglCustomAttributesList,y=void 0,y=l.__faceArray,ga=l.__lineArray,ha=l.__needsSmoothNormals,G=l.__vertexColorType,O=l.__uvType,
-z=l.__normalType,I=B.geometry,ia=I.__dirtyElements,va=I.__dirtyUvs,pa=I.__dirtyNormals,ta=I.__dirtyTangents,na=I.__dirtyColors,ea=I.__dirtyMorphTargets,V=I.vertices,s=l.faces3,u=l.faces4,ja=I.faces,ka=I.faceVertexUvs[0],ma=I.faceVertexUvs[1],la=I.skinVerticesA,oa=I.skinVerticesB,ua=I.skinIndices,ra=I.skinWeights,sa=I.morphTargets;if(I.__dirtyVertices){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=V[r.a].position,w=V[r.b].position,v=V[r.c].position,P[Q]=x.x,P[Q+1]=x.y,P[Q+2]=x.z,P[Q+3]=w.x,P[Q+4]=w.y,P[Q+
-5]=w.z,P[Q+6]=v.x,P[Q+7]=v.y,P[Q+8]=v.z,Q+=9;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=V[r.a].position,w=V[r.b].position,v=V[r.c].position,r=V[r.d].position,P[Q]=x.x,P[Q+1]=x.y,P[Q+2]=x.z,P[Q+3]=w.x,P[Q+4]=w.y,P[Q+5]=w.z,P[Q+6]=v.x,P[Q+7]=v.y,P[Q+8]=v.z,P[Q+9]=r.x,P[Q+10]=r.y,P[Q+11]=r.z,Q+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,P,p)}if(ea){Q=0;for(ea=sa.length;Q<ea;Q++){o=P=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=sa[Q].vertices[r.a].position,w=sa[Q].vertices[r.b].position,
-v=sa[Q].vertices[r.c].position,V=T[Q],V[P]=x.x,V[P+1]=x.y,V[P+2]=x.z,V[P+3]=w.x,V[P+4]=w.y,V[P+5]=w.z,V[P+6]=v.x,V[P+7]=v.y,V[P+8]=v.z,P+=9;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=sa[Q].vertices[r.a].position,w=sa[Q].vertices[r.b].position,v=sa[Q].vertices[r.c].position,r=sa[Q].vertices[r.d].position,V=T[Q],V[P]=x.x,V[P+1]=x.y,V[P+2]=x.z,V[P+3]=w.x,V[P+4]=w.y,V[P+5]=w.z,V[P+6]=v.x,V[P+7]=v.y,V[P+8]=v.z,V[P+9]=r.x,V[P+10]=r.y,V[P+11]=r.z,P+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[Q]);
-j.bufferData(j.ARRAY_BUFFER,T[Q],p)}}if(ra.length){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=ra[r.a],w=ra[r.b],v=ra[r.c],Y[H]=x.x,Y[H+1]=x.y,Y[H+2]=x.z,Y[H+3]=x.w,Y[H+4]=w.x,Y[H+5]=w.y,Y[H+6]=w.z,Y[H+7]=w.w,Y[H+8]=v.x,Y[H+9]=v.y,Y[H+10]=v.z,Y[H+11]=v.w,x=ua[r.a],w=ua[r.b],v=ua[r.c],J[H]=x.x,J[H+1]=x.y,J[H+2]=x.z,J[H+3]=x.w,J[H+4]=w.x,J[H+5]=w.y,J[H+6]=w.z,J[H+7]=w.w,J[H+8]=v.x,J[H+9]=v.y,J[H+10]=v.z,J[H+11]=v.w,x=la[r.a],w=la[r.b],v=la[r.c],ca[H]=x.x,ca[H+1]=x.y,ca[H+2]=x.z,ca[H+3]=1,ca[H+4]=w.x,ca[H+
-5]=w.y,ca[H+6]=w.z,ca[H+7]=1,ca[H+8]=v.x,ca[H+9]=v.y,ca[H+10]=v.z,ca[H+11]=1,x=oa[r.a],w=oa[r.b],v=oa[r.c],N[H]=x.x,N[H+1]=x.y,N[H+2]=x.z,N[H+3]=1,N[H+4]=w.x,N[H+5]=w.y,N[H+6]=w.z,N[H+7]=1,N[H+8]=v.x,N[H+9]=v.y,N[H+10]=v.z,N[H+11]=1,H+=12;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=ra[r.a],w=ra[r.b],v=ra[r.c],T=ra[r.d],Y[H]=x.x,Y[H+1]=x.y,Y[H+2]=x.z,Y[H+3]=x.w,Y[H+4]=w.x,Y[H+5]=w.y,Y[H+6]=w.z,Y[H+7]=w.w,Y[H+8]=v.x,Y[H+9]=v.y,Y[H+10]=v.z,Y[H+11]=v.w,Y[H+12]=T.x,Y[H+13]=T.y,Y[H+14]=T.z,Y[H+15]=T.w,x=ua[r.a],
+h=p=k=void 0,B instanceof THREE.Mesh){i=0;for(l=f.geometryGroupsList.length;i<l;i++)if(k=f.geometryGroupsList[i],h=b(B,k),p=h.attributes&&m(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||p)if(p=j.DYNAMIC_DRAW,R=!f.dynamic,k.__inittedArrays){var F=A=o=void 0,r=void 0,L=void 0,z=void 0,H=void 0,J=void 0,I=void 0,O=void 0,G=void 0,C=F=z=void 0,x=void 0,w=void 0,v=void 0,E=r=void 0,$=void 0,ca=r=I=G=void 0,N=void 0,T=
+v=w=x=H=void 0,S=r=v=w=x=T=v=w=x=T=v=w=x=void 0,aa=void 0,X=z=void 0,Y=void 0,Q=void 0,ea=void 0,W=void 0,K=C=Q=aa=0,ba=0,U=S=F=0,P=H=E=0,D=0,ga=void 0,P=k.__vertexArray,Y=k.__uvArray,D=k.__uv2Array,X=k.__normalArray,L=k.__tangentArray,$=k.__colorArray,ca=k.__skinVertexAArray,N=k.__skinVertexBArray,J=k.__skinIndexArray,Z=k.__skinWeightArray,T=k.__morphTargetsArrays,s=k.__webglCustomAttributesList,y=void 0,y=k.__faceArray,ga=k.__lineArray,ha=k.__needsSmoothNormals,G=k.__vertexColorType,O=k.__uvType,
+z=k.__normalType,I=B.geometry,ia=I.__dirtyElements,va=I.__dirtyUvs,pa=I.__dirtyNormals,ta=I.__dirtyTangents,na=I.__dirtyColors,ea=I.__dirtyMorphTargets,W=I.vertices,V=k.faces3,u=k.faces4,ja=I.faces,ka=I.faceVertexUvs[0],ma=I.faceVertexUvs[1],la=I.skinVerticesA,oa=I.skinVerticesB,ua=I.skinIndices,ra=I.skinWeights,sa=I.morphTargets;if(I.__dirtyVertices){o=0;for(A=V.length;o<A;o++)r=ja[V[o]],x=W[r.a].position,w=W[r.b].position,v=W[r.c].position,P[Q]=x.x,P[Q+1]=x.y,P[Q+2]=x.z,P[Q+3]=w.x,P[Q+4]=w.y,P[Q+
+5]=w.z,P[Q+6]=v.x,P[Q+7]=v.y,P[Q+8]=v.z,Q+=9;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=W[r.a].position,w=W[r.b].position,v=W[r.c].position,r=W[r.d].position,P[Q]=x.x,P[Q+1]=x.y,P[Q+2]=x.z,P[Q+3]=w.x,P[Q+4]=w.y,P[Q+5]=w.z,P[Q+6]=v.x,P[Q+7]=v.y,P[Q+8]=v.z,P[Q+9]=r.x,P[Q+10]=r.y,P[Q+11]=r.z,Q+=12;j.bindBuffer(j.ARRAY_BUFFER,k.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,P,p)}if(ea){Q=0;for(ea=sa.length;Q<ea;Q++){o=P=0;for(A=V.length;o<A;o++)r=ja[V[o]],x=sa[Q].vertices[r.a].position,w=sa[Q].vertices[r.b].position,
+v=sa[Q].vertices[r.c].position,W=T[Q],W[P]=x.x,W[P+1]=x.y,W[P+2]=x.z,W[P+3]=w.x,W[P+4]=w.y,W[P+5]=w.z,W[P+6]=v.x,W[P+7]=v.y,W[P+8]=v.z,P+=9;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=sa[Q].vertices[r.a].position,w=sa[Q].vertices[r.b].position,v=sa[Q].vertices[r.c].position,r=sa[Q].vertices[r.d].position,W=T[Q],W[P]=x.x,W[P+1]=x.y,W[P+2]=x.z,W[P+3]=w.x,W[P+4]=w.y,W[P+5]=w.z,W[P+6]=v.x,W[P+7]=v.y,W[P+8]=v.z,W[P+9]=r.x,W[P+10]=r.y,W[P+11]=r.z,P+=12;j.bindBuffer(j.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[Q]);
+j.bufferData(j.ARRAY_BUFFER,T[Q],p)}}if(ra.length){o=0;for(A=V.length;o<A;o++)r=ja[V[o]],x=ra[r.a],w=ra[r.b],v=ra[r.c],Z[H]=x.x,Z[H+1]=x.y,Z[H+2]=x.z,Z[H+3]=x.w,Z[H+4]=w.x,Z[H+5]=w.y,Z[H+6]=w.z,Z[H+7]=w.w,Z[H+8]=v.x,Z[H+9]=v.y,Z[H+10]=v.z,Z[H+11]=v.w,x=ua[r.a],w=ua[r.b],v=ua[r.c],J[H]=x.x,J[H+1]=x.y,J[H+2]=x.z,J[H+3]=x.w,J[H+4]=w.x,J[H+5]=w.y,J[H+6]=w.z,J[H+7]=w.w,J[H+8]=v.x,J[H+9]=v.y,J[H+10]=v.z,J[H+11]=v.w,x=la[r.a],w=la[r.b],v=la[r.c],ca[H]=x.x,ca[H+1]=x.y,ca[H+2]=x.z,ca[H+3]=1,ca[H+4]=w.x,ca[H+
+5]=w.y,ca[H+6]=w.z,ca[H+7]=1,ca[H+8]=v.x,ca[H+9]=v.y,ca[H+10]=v.z,ca[H+11]=1,x=oa[r.a],w=oa[r.b],v=oa[r.c],N[H]=x.x,N[H+1]=x.y,N[H+2]=x.z,N[H+3]=1,N[H+4]=w.x,N[H+5]=w.y,N[H+6]=w.z,N[H+7]=1,N[H+8]=v.x,N[H+9]=v.y,N[H+10]=v.z,N[H+11]=1,H+=12;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=ra[r.a],w=ra[r.b],v=ra[r.c],T=ra[r.d],Z[H]=x.x,Z[H+1]=x.y,Z[H+2]=x.z,Z[H+3]=x.w,Z[H+4]=w.x,Z[H+5]=w.y,Z[H+6]=w.z,Z[H+7]=w.w,Z[H+8]=v.x,Z[H+9]=v.y,Z[H+10]=v.z,Z[H+11]=v.w,Z[H+12]=T.x,Z[H+13]=T.y,Z[H+14]=T.z,Z[H+15]=T.w,x=ua[r.a],
 w=ua[r.b],v=ua[r.c],T=ua[r.d],J[H]=x.x,J[H+1]=x.y,J[H+2]=x.z,J[H+3]=x.w,J[H+4]=w.x,J[H+5]=w.y,J[H+6]=w.z,J[H+7]=w.w,J[H+8]=v.x,J[H+9]=v.y,J[H+10]=v.z,J[H+11]=v.w,J[H+12]=T.x,J[H+13]=T.y,J[H+14]=T.z,J[H+15]=T.w,x=la[r.a],w=la[r.b],v=la[r.c],T=la[r.d],ca[H]=x.x,ca[H+1]=x.y,ca[H+2]=x.z,ca[H+3]=1,ca[H+4]=w.x,ca[H+5]=w.y,ca[H+6]=w.z,ca[H+7]=1,ca[H+8]=v.x,ca[H+9]=v.y,ca[H+10]=v.z,ca[H+11]=1,ca[H+12]=T.x,ca[H+13]=T.y,ca[H+14]=T.z,ca[H+15]=1,x=oa[r.a],w=oa[r.b],v=oa[r.c],r=oa[r.d],N[H]=x.x,N[H+1]=x.y,N[H+
 w=ua[r.b],v=ua[r.c],T=ua[r.d],J[H]=x.x,J[H+1]=x.y,J[H+2]=x.z,J[H+3]=x.w,J[H+4]=w.x,J[H+5]=w.y,J[H+6]=w.z,J[H+7]=w.w,J[H+8]=v.x,J[H+9]=v.y,J[H+10]=v.z,J[H+11]=v.w,J[H+12]=T.x,J[H+13]=T.y,J[H+14]=T.z,J[H+15]=T.w,x=la[r.a],w=la[r.b],v=la[r.c],T=la[r.d],ca[H]=x.x,ca[H+1]=x.y,ca[H+2]=x.z,ca[H+3]=1,ca[H+4]=w.x,ca[H+5]=w.y,ca[H+6]=w.z,ca[H+7]=1,ca[H+8]=v.x,ca[H+9]=v.y,ca[H+10]=v.z,ca[H+11]=1,ca[H+12]=T.x,ca[H+13]=T.y,ca[H+14]=T.z,ca[H+15]=1,x=oa[r.a],w=oa[r.b],v=oa[r.c],r=oa[r.d],N[H]=x.x,N[H+1]=x.y,N[H+
-2]=x.z,N[H+3]=1,N[H+4]=w.x,N[H+5]=w.y,N[H+6]=w.z,N[H+7]=1,N[H+8]=v.x,N[H+9]=v.y,N[H+10]=v.z,N[H+11]=1,N[H+12]=r.x,N[H+13]=r.y,N[H+14]=r.z,N[H+15]=1,H+=16;H>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,ca,p),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,N,p),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,J,p),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,
-Y,p))}if(na&&G){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],H=r.vertexColors,J=r.color,H.length===3&&G===THREE.VertexColors?(r=H[0],ca=H[1],N=H[2]):N=ca=r=J,$[E]=r.r,$[E+1]=r.g,$[E+2]=r.b,$[E+3]=ca.r,$[E+4]=ca.g,$[E+5]=ca.b,$[E+6]=N.r,$[E+7]=N.g,$[E+8]=N.b,E+=9;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],H=r.vertexColors,J=r.color,H.length===4&&G===THREE.VertexColors?(r=H[0],ca=H[1],N=H[2],H=H[3]):H=N=ca=r=J,$[E]=r.r,$[E+1]=r.g,$[E+2]=r.b,$[E+3]=ca.r,$[E+4]=ca.g,$[E+5]=ca.b,$[E+6]=N.r,$[E+7]=N.g,$[E+8]=N.b,$[E+
-9]=H.r,$[E+10]=H.g,$[E+11]=H.b,E+=12;E>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,$,p))}if(ta&&I.hasTangents){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],I=r.vertexTangents,E=I[0],$=I[1],G=I[2],L[S]=E.x,L[S+1]=E.y,L[S+2]=E.z,L[S+3]=E.w,L[S+4]=$.x,L[S+5]=$.y,L[S+6]=$.z,L[S+7]=$.w,L[S+8]=G.x,L[S+9]=G.y,L[S+10]=G.z,L[S+11]=G.w,S+=12;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],I=r.vertexTangents,E=I[0],$=I[1],G=I[2],I=I[3],L[S]=E.x,L[S+1]=E.y,L[S+2]=E.z,L[S+3]=E.w,L[S+4]=$.x,
-L[S+5]=$.y,L[S+6]=$.z,L[S+7]=$.w,L[S+8]=G.x,L[S+9]=G.y,L[S+10]=G.z,L[S+11]=G.w,L[S+12]=I.x,L[S+13]=I.y,L[S+14]=I.z,L[S+15]=I.w,S+=16;j.bindBuffer(j.ARRAY_BUFFER,l.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,L,p)}if(pa&&z){o=0;for(A=s.length;o<A;o++)if(r=ja[s[o]],L=r.vertexNormals,z=r.normal,L.length===3&&ha)for(S=0;S<3;S++)z=L[S],W[F]=z.x,W[F+1]=z.y,W[F+2]=z.z,F+=3;else for(S=0;S<3;S++)W[F]=z.x,W[F+1]=z.y,W[F+2]=z.z,F+=3;o=0;for(A=u.length;o<A;o++)if(r=ja[u[o]],L=r.vertexNormals,z=r.normal,
-L.length===4&&ha)for(S=0;S<4;S++)z=L[S],W[F]=z.x,W[F+1]=z.y,W[F+2]=z.z,F+=3;else for(S=0;S<4;S++)W[F]=z.x,W[F+1]=z.y,W[F+2]=z.z,F+=3;j.bindBuffer(j.ARRAY_BUFFER,l.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,W,p)}if(va&&ka&&O){o=0;for(A=s.length;o<A;o++)if(F=s[o],F=ka[F],F!==void 0)for(S=0;S<3;S++)W=F[S],X[C]=W.u,X[C+1]=W.v,C+=2;o=0;for(A=u.length;o<A;o++)if(F=u[o],F=ka[F],F!==void 0)for(S=0;S<4;S++)W=F[S],X[C]=W.u,X[C+1]=W.v,C+=2;C>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,
-X,p))}if(va&&ma&&O){o=0;for(A=s.length;o<A;o++)if(F=s[o],C=ma[F],C!==void 0)for(S=0;S<3;S++)X=C[S],D[K]=X.u,D[K+1]=X.v,K+=2;o=0;for(A=u.length;o<A;o++)if(F=u[o],C=ma[F],C!==void 0)for(S=0;S<4;S++)X=C[S],D[K]=X.u,D[K+1]=X.v,K+=2;K>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,D,p))}if(ia){o=0;for(A=s.length;o<A;o++)y[ba]=aa,y[ba+1]=aa+1,y[ba+2]=aa+2,ba+=3,ga[U]=aa,ga[U+1]=aa+1,ga[U+2]=aa,ga[U+3]=aa+2,ga[U+4]=aa+1,ga[U+5]=aa+2,U+=6,aa+=3;o=0;for(A=u.length;o<A;o++)y[ba]=
-aa,y[ba+1]=aa+1,y[ba+2]=aa+3,y[ba+3]=aa+1,y[ba+4]=aa+2,y[ba+5]=aa+3,ba+=6,ga[U]=aa,ga[U+1]=aa+1,ga[U+2]=aa,ga[U+3]=aa+3,ga[U+4]=aa+1,ga[U+5]=aa+2,ga[U+6]=aa+2,ga[U+7]=aa+3,U+=8,aa+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,y,p);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,ga,p)}if(Z){S=0;for(aa=Z.length;S<aa;S++)if(y=Z[S],y.__original.needsUpdate){D=0;if(y.size===1)if(y.boundTo===void 0||y.boundTo===
-"vertices"){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],y.array[D]=y.value[r.a],y.array[D+1]=y.value[r.b],y.array[D+2]=y.value[r.c],D+=3;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],y.array[D]=y.value[r.a],y.array[D+1]=y.value[r.b],y.array[D+2]=y.value[r.c],y.array[D+3]=y.value[r.d],D+=4}else{if(y.boundTo==="faces"){o=0;for(A=s.length;o<A;o++)ga=y.value[s[o]],y.array[D]=ga,y.array[D+1]=ga,y.array[D+2]=ga,D+=3;o=0;for(A=u.length;o<A;o++)ga=y.value[u[o]],y.array[D]=ga,y.array[D+1]=ga,y.array[D+2]=ga,y.array[D+3]=
-ga,D+=4}}else if(y.size===2)if(y.boundTo===void 0||y.boundTo==="vertices"){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=w.x,y.array[D+3]=w.y,y.array[D+4]=v.x,y.array[D+5]=v.y,D+=6;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],r=y.value[r.d],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=w.x,y.array[D+3]=w.y,y.array[D+4]=v.x,y.array[D+5]=v.y,y.array[D+6]=r.x,y.array[D+7]=r.y,D+=8}else{if(y.boundTo===
-"faces"){o=0;for(A=s.length;o<A;o++)v=w=x=ga=y.value[s[o]],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=w.x,y.array[D+3]=w.y,y.array[D+4]=v.x,y.array[D+5]=v.y,D+=6;o=0;for(A=u.length;o<A;o++)r=v=w=x=ga=y.value[u[o]],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=w.x,y.array[D+3]=w.y,y.array[D+4]=v.x,y.array[D+5]=v.y,y.array[D+6]=r.x,y.array[D+7]=r.y,D+=8}}else if(y.size===3)if(K=y.type==="c"?["r","g","b"]:["x","y","z"],y.boundTo===void 0||y.boundTo==="vertices"){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],
+2]=x.z,N[H+3]=1,N[H+4]=w.x,N[H+5]=w.y,N[H+6]=w.z,N[H+7]=1,N[H+8]=v.x,N[H+9]=v.y,N[H+10]=v.z,N[H+11]=1,N[H+12]=r.x,N[H+13]=r.y,N[H+14]=r.z,N[H+15]=1,H+=16;H>0&&(j.bindBuffer(j.ARRAY_BUFFER,k.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,ca,p),j.bindBuffer(j.ARRAY_BUFFER,k.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,N,p),j.bindBuffer(j.ARRAY_BUFFER,k.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,J,p),j.bindBuffer(j.ARRAY_BUFFER,k.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,
+Z,p))}if(na&&G){o=0;for(A=V.length;o<A;o++)r=ja[V[o]],H=r.vertexColors,J=r.color,H.length===3&&G===THREE.VertexColors?(r=H[0],ca=H[1],N=H[2]):N=ca=r=J,$[E]=r.r,$[E+1]=r.g,$[E+2]=r.b,$[E+3]=ca.r,$[E+4]=ca.g,$[E+5]=ca.b,$[E+6]=N.r,$[E+7]=N.g,$[E+8]=N.b,E+=9;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],H=r.vertexColors,J=r.color,H.length===4&&G===THREE.VertexColors?(r=H[0],ca=H[1],N=H[2],H=H[3]):H=N=ca=r=J,$[E]=r.r,$[E+1]=r.g,$[E+2]=r.b,$[E+3]=ca.r,$[E+4]=ca.g,$[E+5]=ca.b,$[E+6]=N.r,$[E+7]=N.g,$[E+8]=N.b,$[E+
+9]=H.r,$[E+10]=H.g,$[E+11]=H.b,E+=12;E>0&&(j.bindBuffer(j.ARRAY_BUFFER,k.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,$,p))}if(ta&&I.hasTangents){o=0;for(A=V.length;o<A;o++)r=ja[V[o]],I=r.vertexTangents,E=I[0],$=I[1],G=I[2],L[S]=E.x,L[S+1]=E.y,L[S+2]=E.z,L[S+3]=E.w,L[S+4]=$.x,L[S+5]=$.y,L[S+6]=$.z,L[S+7]=$.w,L[S+8]=G.x,L[S+9]=G.y,L[S+10]=G.z,L[S+11]=G.w,S+=12;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],I=r.vertexTangents,E=I[0],$=I[1],G=I[2],I=I[3],L[S]=E.x,L[S+1]=E.y,L[S+2]=E.z,L[S+3]=E.w,L[S+4]=$.x,
+L[S+5]=$.y,L[S+6]=$.z,L[S+7]=$.w,L[S+8]=G.x,L[S+9]=G.y,L[S+10]=G.z,L[S+11]=G.w,L[S+12]=I.x,L[S+13]=I.y,L[S+14]=I.z,L[S+15]=I.w,S+=16;j.bindBuffer(j.ARRAY_BUFFER,k.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,L,p)}if(pa&&z){o=0;for(A=V.length;o<A;o++)if(r=ja[V[o]],L=r.vertexNormals,z=r.normal,L.length===3&&ha)for(S=0;S<3;S++)z=L[S],X[F]=z.x,X[F+1]=z.y,X[F+2]=z.z,F+=3;else for(S=0;S<3;S++)X[F]=z.x,X[F+1]=z.y,X[F+2]=z.z,F+=3;o=0;for(A=u.length;o<A;o++)if(r=ja[u[o]],L=r.vertexNormals,z=r.normal,
+L.length===4&&ha)for(S=0;S<4;S++)z=L[S],X[F]=z.x,X[F+1]=z.y,X[F+2]=z.z,F+=3;else for(S=0;S<4;S++)X[F]=z.x,X[F+1]=z.y,X[F+2]=z.z,F+=3;j.bindBuffer(j.ARRAY_BUFFER,k.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,X,p)}if(va&&ka&&O){o=0;for(A=V.length;o<A;o++)if(F=V[o],F=ka[F],F!==void 0)for(S=0;S<3;S++)X=F[S],Y[C]=X.u,Y[C+1]=X.v,C+=2;o=0;for(A=u.length;o<A;o++)if(F=u[o],F=ka[F],F!==void 0)for(S=0;S<4;S++)X=F[S],Y[C]=X.u,Y[C+1]=X.v,C+=2;C>0&&(j.bindBuffer(j.ARRAY_BUFFER,k.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,
+Y,p))}if(va&&ma&&O){o=0;for(A=V.length;o<A;o++)if(F=V[o],C=ma[F],C!==void 0)for(S=0;S<3;S++)Y=C[S],D[K]=Y.u,D[K+1]=Y.v,K+=2;o=0;for(A=u.length;o<A;o++)if(F=u[o],C=ma[F],C!==void 0)for(S=0;S<4;S++)Y=C[S],D[K]=Y.u,D[K+1]=Y.v,K+=2;K>0&&(j.bindBuffer(j.ARRAY_BUFFER,k.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,D,p))}if(ia){o=0;for(A=V.length;o<A;o++)y[ba]=aa,y[ba+1]=aa+1,y[ba+2]=aa+2,ba+=3,ga[U]=aa,ga[U+1]=aa+1,ga[U+2]=aa,ga[U+3]=aa+2,ga[U+4]=aa+1,ga[U+5]=aa+2,U+=6,aa+=3;o=0;for(A=u.length;o<A;o++)y[ba]=
+aa,y[ba+1]=aa+1,y[ba+2]=aa+3,y[ba+3]=aa+1,y[ba+4]=aa+2,y[ba+5]=aa+3,ba+=6,ga[U]=aa,ga[U+1]=aa+1,ga[U+2]=aa,ga[U+3]=aa+3,ga[U+4]=aa+1,ga[U+5]=aa+2,ga[U+6]=aa+2,ga[U+7]=aa+3,U+=8,aa+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,y,p);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,ga,p)}if(s){S=0;for(aa=s.length;S<aa;S++)if(y=s[S],y.__original.needsUpdate){D=0;if(y.size===1)if(y.boundTo===void 0||y.boundTo===
+"vertices"){o=0;for(A=V.length;o<A;o++)r=ja[V[o]],y.array[D]=y.value[r.a],y.array[D+1]=y.value[r.b],y.array[D+2]=y.value[r.c],D+=3;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],y.array[D]=y.value[r.a],y.array[D+1]=y.value[r.b],y.array[D+2]=y.value[r.c],y.array[D+3]=y.value[r.d],D+=4}else{if(y.boundTo==="faces"){o=0;for(A=V.length;o<A;o++)ga=y.value[V[o]],y.array[D]=ga,y.array[D+1]=ga,y.array[D+2]=ga,D+=3;o=0;for(A=u.length;o<A;o++)ga=y.value[u[o]],y.array[D]=ga,y.array[D+1]=ga,y.array[D+2]=ga,y.array[D+3]=
+ga,D+=4}}else if(y.size===2)if(y.boundTo===void 0||y.boundTo==="vertices"){o=0;for(A=V.length;o<A;o++)r=ja[V[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=w.x,y.array[D+3]=w.y,y.array[D+4]=v.x,y.array[D+5]=v.y,D+=6;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],r=y.value[r.d],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=w.x,y.array[D+3]=w.y,y.array[D+4]=v.x,y.array[D+5]=v.y,y.array[D+6]=r.x,y.array[D+7]=r.y,D+=8}else{if(y.boundTo===
+"faces"){o=0;for(A=V.length;o<A;o++)v=w=x=ga=y.value[V[o]],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=w.x,y.array[D+3]=w.y,y.array[D+4]=v.x,y.array[D+5]=v.y,D+=6;o=0;for(A=u.length;o<A;o++)r=v=w=x=ga=y.value[u[o]],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=w.x,y.array[D+3]=w.y,y.array[D+4]=v.x,y.array[D+5]=v.y,y.array[D+6]=r.x,y.array[D+7]=r.y,D+=8}}else if(y.size===3)if(K=y.type==="c"?["r","g","b"]:["x","y","z"],y.boundTo===void 0||y.boundTo==="vertices"){o=0;for(A=V.length;o<A;o++)r=ja[V[o]],
 x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],y.array[D]=x[K[0]],y.array[D+1]=x[K[1]],y.array[D+2]=x[K[2]],y.array[D+3]=w[K[0]],y.array[D+4]=w[K[1]],y.array[D+5]=w[K[2]],y.array[D+6]=v[K[0]],y.array[D+7]=v[K[1]],y.array[D+8]=v[K[2]],D+=9;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],r=y.value[r.d],y.array[D]=x[K[0]],y.array[D+1]=x[K[1]],y.array[D+2]=x[K[2]],y.array[D+3]=w[K[0]],y.array[D+4]=w[K[1]],y.array[D+5]=w[K[2]],y.array[D+6]=v[K[0]],y.array[D+7]=v[K[1]],
 x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],y.array[D]=x[K[0]],y.array[D+1]=x[K[1]],y.array[D+2]=x[K[2]],y.array[D+3]=w[K[0]],y.array[D+4]=w[K[1]],y.array[D+5]=w[K[2]],y.array[D+6]=v[K[0]],y.array[D+7]=v[K[1]],y.array[D+8]=v[K[2]],D+=9;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],r=y.value[r.d],y.array[D]=x[K[0]],y.array[D+1]=x[K[1]],y.array[D+2]=x[K[2]],y.array[D+3]=w[K[0]],y.array[D+4]=w[K[1]],y.array[D+5]=w[K[2]],y.array[D+6]=v[K[0]],y.array[D+7]=v[K[1]],
-y.array[D+8]=v[K[2]],y.array[D+9]=r[K[0]],y.array[D+10]=r[K[1]],y.array[D+11]=r[K[2]],D+=12}else{if(y.boundTo==="faces"){o=0;for(A=s.length;o<A;o++)v=w=x=ga=y.value[s[o]],y.array[D]=x[K[0]],y.array[D+1]=x[K[1]],y.array[D+2]=x[K[2]],y.array[D+3]=w[K[0]],y.array[D+4]=w[K[1]],y.array[D+5]=w[K[2]],y.array[D+6]=v[K[0]],y.array[D+7]=v[K[1]],y.array[D+8]=v[K[2]],D+=9;o=0;for(A=u.length;o<A;o++)r=v=w=x=ga=y.value[u[o]],y.array[D]=x[K[0]],y.array[D+1]=x[K[1]],y.array[D+2]=x[K[2]],y.array[D+3]=w[K[0]],y.array[D+
-4]=w[K[1]],y.array[D+5]=w[K[2]],y.array[D+6]=v[K[0]],y.array[D+7]=v[K[1]],y.array[D+8]=v[K[2]],y.array[D+9]=r[K[0]],y.array[D+10]=r[K[1]],y.array[D+11]=r[K[2]],D+=12}}else if(y.size===4)if(y.boundTo===void 0||y.boundTo==="vertices"){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=x.z,y.array[D+3]=x.w,y.array[D+4]=w.x,y.array[D+5]=w.y,y.array[D+6]=w.z,y.array[D+7]=w.w,y.array[D+8]=v.x,y.array[D+9]=v.y,y.array[D+10]=v.z,
-y.array[D+11]=v.w,D+=12;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],r=y.value[r.d],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=x.z,y.array[D+3]=x.w,y.array[D+4]=w.x,y.array[D+5]=w.y,y.array[D+6]=w.z,y.array[D+7]=w.w,y.array[D+8]=v.x,y.array[D+9]=v.y,y.array[D+10]=v.z,y.array[D+11]=v.w,y.array[D+12]=r.x,y.array[D+13]=r.y,y.array[D+14]=r.z,y.array[D+15]=r.w,D+=16}else if(y.boundTo==="faces"){o=0;for(A=s.length;o<A;o++)v=w=x=ga=y.value[s[o]],y.array[D]=x.x,y.array[D+
+y.array[D+8]=v[K[2]],y.array[D+9]=r[K[0]],y.array[D+10]=r[K[1]],y.array[D+11]=r[K[2]],D+=12}else{if(y.boundTo==="faces"){o=0;for(A=V.length;o<A;o++)v=w=x=ga=y.value[V[o]],y.array[D]=x[K[0]],y.array[D+1]=x[K[1]],y.array[D+2]=x[K[2]],y.array[D+3]=w[K[0]],y.array[D+4]=w[K[1]],y.array[D+5]=w[K[2]],y.array[D+6]=v[K[0]],y.array[D+7]=v[K[1]],y.array[D+8]=v[K[2]],D+=9;o=0;for(A=u.length;o<A;o++)r=v=w=x=ga=y.value[u[o]],y.array[D]=x[K[0]],y.array[D+1]=x[K[1]],y.array[D+2]=x[K[2]],y.array[D+3]=w[K[0]],y.array[D+
+4]=w[K[1]],y.array[D+5]=w[K[2]],y.array[D+6]=v[K[0]],y.array[D+7]=v[K[1]],y.array[D+8]=v[K[2]],y.array[D+9]=r[K[0]],y.array[D+10]=r[K[1]],y.array[D+11]=r[K[2]],D+=12}}else if(y.size===4)if(y.boundTo===void 0||y.boundTo==="vertices"){o=0;for(A=V.length;o<A;o++)r=ja[V[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=x.z,y.array[D+3]=x.w,y.array[D+4]=w.x,y.array[D+5]=w.y,y.array[D+6]=w.z,y.array[D+7]=w.w,y.array[D+8]=v.x,y.array[D+9]=v.y,y.array[D+10]=v.z,
+y.array[D+11]=v.w,D+=12;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],r=y.value[r.d],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=x.z,y.array[D+3]=x.w,y.array[D+4]=w.x,y.array[D+5]=w.y,y.array[D+6]=w.z,y.array[D+7]=w.w,y.array[D+8]=v.x,y.array[D+9]=v.y,y.array[D+10]=v.z,y.array[D+11]=v.w,y.array[D+12]=r.x,y.array[D+13]=r.y,y.array[D+14]=r.z,y.array[D+15]=r.w,D+=16}else if(y.boundTo==="faces"){o=0;for(A=V.length;o<A;o++)v=w=x=ga=y.value[V[o]],y.array[D]=x.x,y.array[D+
 1]=x.y,y.array[D+2]=x.z,y.array[D+3]=x.w,y.array[D+4]=w.x,y.array[D+5]=w.y,y.array[D+6]=w.z,y.array[D+7]=w.w,y.array[D+8]=v.x,y.array[D+9]=v.y,y.array[D+10]=v.z,y.array[D+11]=v.w,D+=12;o=0;for(A=u.length;o<A;o++)r=v=w=x=ga=y.value[u[o]],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=x.z,y.array[D+3]=x.w,y.array[D+4]=w.x,y.array[D+5]=w.y,y.array[D+6]=w.z,y.array[D+7]=w.w,y.array[D+8]=v.x,y.array[D+9]=v.y,y.array[D+10]=v.z,y.array[D+11]=v.w,y.array[D+12]=r.x,y.array[D+13]=r.y,y.array[D+14]=r.z,y.array[D+
 1]=x.y,y.array[D+2]=x.z,y.array[D+3]=x.w,y.array[D+4]=w.x,y.array[D+5]=w.y,y.array[D+6]=w.z,y.array[D+7]=w.w,y.array[D+8]=v.x,y.array[D+9]=v.y,y.array[D+10]=v.z,y.array[D+11]=v.w,D+=12;o=0;for(A=u.length;o<A;o++)r=v=w=x=ga=y.value[u[o]],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=x.z,y.array[D+3]=x.w,y.array[D+4]=w.x,y.array[D+5]=w.y,y.array[D+6]=w.z,y.array[D+7]=w.w,y.array[D+8]=v.x,y.array[D+9]=v.y,y.array[D+10]=v.z,y.array[D+11]=v.w,y.array[D+12]=r.x,y.array[D+13]=r.y,y.array[D+14]=r.z,y.array[D+
-15]=r.w,D+=16}j.bindBuffer(j.ARRAY_BUFFER,y.buffer);j.bufferData(j.ARRAY_BUFFER,y.array,p)}}R&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=
-!1;f.__dirtyColors=!1;f.__dirtyTangents=!1;h.attributes&&t(h)}else if(B instanceof THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;B=j.DYNAMIC_DRAW;o=i=o=R=R=void 0;A=h.vertices;k=h.colors;Z=A.length;l=k.length;s=h.__vertexArray;p=h.__colorArray;u=h.__dirtyColors;if(h.__dirtyVertices){for(R=0;R<Z;R++)o=A[R].position,i=R*3,s[i]=o.x,s[i+1]=o.y,s[i+2]=o.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,s,B)}if(u){for(R=0;R<l;R++)o=k[R],i=R*3,p[i]=o.r,p[i+1]=o.g,
-p[i+2]=o.b;j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,p,B)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(B instanceof THREE.Line){h=b(B,l);p=h.attributes&&m(h);if(f.__dirtyVertices||f.__dirtyColors||p){B=f;i=j.DYNAMIC_DRAW;Z=k=aa=A=ja=void 0;A=B.vertices;l=B.colors;Z=A.length;p=l.length;s=B.__vertexArray;R=B.__colorArray;u=B.__dirtyColors;o=B.__webglCustomAttributesList;C=U=ba=K=aa=ja=void 0;if(B.__dirtyVertices){for(ja=0;ja<Z;ja++)aa=A[ja].position,k=ja*3,s[k]=
-aa.x,s[k+1]=aa.y,s[k+2]=aa.z;j.bindBuffer(j.ARRAY_BUFFER,B.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,s,i)}if(u){for(A=0;A<p;A++)Z=l[A],k=A*3,R[k]=Z.r,R[k+1]=Z.g,R[k+2]=Z.b;j.bindBuffer(j.ARRAY_BUFFER,B.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,R,i)}if(o){ja=0;for(aa=o.length;ja<aa;ja++)if(C=o[ja],C.needsUpdate&&(C.boundTo===void 0||C.boundTo==="vertices")){k=0;ba=C.value.length;if(C.size===1)for(K=0;K<ba;K++)C.array[K]=C.value[K];else if(C.size===2)for(K=0;K<ba;K++)U=C.value[K],C.array[k]=
-U.x,C.array[k+1]=U.y,k+=2;else if(C.size===3)if(C.type==="c")for(K=0;K<ba;K++)U=C.value[K],C.array[k]=U.r,C.array[k+1]=U.g,C.array[k+2]=U.b,k+=3;else for(K=0;K<ba;K++)U=C.value[K],C.array[k]=U.x,C.array[k+1]=U.y,C.array[k+2]=U.z,k+=3;else if(C.size===4)for(K=0;K<ba;K++)U=C.value[K],C.array[k]=U.x,C.array[k+1]=U.y,C.array[k+2]=U.z,C.array[k+3]=U.w,k+=4;j.bindBuffer(j.ARRAY_BUFFER,C.buffer);j.bufferData(j.ARRAY_BUFFER,C.array,i)}}}f.__dirtyVertices=!1;f.__dirtyColors=!1;h.attributes&&t(h)}else if(B instanceof
-THREE.ParticleSystem)h=b(B,l),p=h.attributes&&m(h),(f.__dirtyVertices||f.__dirtyColors||B.sortParticles||p)&&d(f,j.DYNAMIC_DRAW,B),f.__dirtyVertices=!1,f.__dirtyColors=!1,h.attributes&&t(h)};this.initMaterial=function(a,b,c,d){var e,g,f,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?
-h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var k,l,m;k=m=i=0;for(l=b.length;k<l;k++)f=b[k],f instanceof THREE.SpotLight&&m++,f instanceof THREE.DirectionalLight&&m++,f instanceof THREE.PointLight&&i++;i+m<=O?k=m:(k=Math.ceil(O*m/(i+m)),i=O-k);f={directional:k,point:i};i=m=0;for(k=b.length;i<k;i++)l=b[i],l instanceof THREE.SpotLight&&
-l.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{k=a.fragmentShader;l=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:f.directional,maxPointLights:f.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,
-shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(k),d.push(l));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;for(d=P.length;p<d;p++)if(P[p].code===h){o=P[p].program;break a}p=j.createProgram();d=[ta?"#define VERTEX_TEXTURES":"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
+15]=r.w,D+=16}j.bindBuffer(j.ARRAY_BUFFER,y.buffer);j.bufferData(j.ARRAY_BUFFER,y.array,p)}}R&&(delete k.__inittedArrays,delete k.__colorArray,delete k.__normalArray,delete k.__tangentArray,delete k.__uvArray,delete k.__uv2Array,delete k.__faceArray,delete k.__vertexArray,delete k.__lineArray,delete k.__skinVertexAArray,delete k.__skinVertexBArray,delete k.__skinIndexArray,delete k.__skinWeightArray)}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=
+!1;f.__dirtyColors=!1;f.__dirtyTangents=!1;h.attributes&&t(h)}else if(B instanceof THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;B=j.DYNAMIC_DRAW;o=i=o=R=R=void 0;A=h.vertices;l=h.colors;s=A.length;k=l.length;V=h.__vertexArray;p=h.__colorArray;u=h.__dirtyColors;if(h.__dirtyVertices){for(R=0;R<s;R++)o=A[R].position,i=R*3,V[i]=o.x,V[i+1]=o.y,V[i+2]=o.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,V,B)}if(u){for(R=0;R<k;R++)o=l[R],i=R*3,p[i]=o.r,p[i+1]=o.g,
+p[i+2]=o.b;j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,p,B)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(B instanceof THREE.Line){h=b(B,k);p=h.attributes&&m(h);if(f.__dirtyVertices||f.__dirtyColors||p){B=f;i=j.DYNAMIC_DRAW;s=l=aa=A=ja=void 0;A=B.vertices;k=B.colors;s=A.length;p=k.length;V=B.__vertexArray;R=B.__colorArray;u=B.__dirtyColors;o=B.__webglCustomAttributesList;C=U=ba=K=aa=ja=void 0;if(B.__dirtyVertices){for(ja=0;ja<s;ja++)aa=A[ja].position,l=ja*3,V[l]=
+aa.x,V[l+1]=aa.y,V[l+2]=aa.z;j.bindBuffer(j.ARRAY_BUFFER,B.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,V,i)}if(u){for(A=0;A<p;A++)s=k[A],l=A*3,R[l]=s.r,R[l+1]=s.g,R[l+2]=s.b;j.bindBuffer(j.ARRAY_BUFFER,B.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,R,i)}if(o){ja=0;for(aa=o.length;ja<aa;ja++)if(C=o[ja],C.needsUpdate&&(C.boundTo===void 0||C.boundTo==="vertices")){l=0;ba=C.value.length;if(C.size===1)for(K=0;K<ba;K++)C.array[K]=C.value[K];else if(C.size===2)for(K=0;K<ba;K++)U=C.value[K],C.array[l]=
+U.x,C.array[l+1]=U.y,l+=2;else if(C.size===3)if(C.type==="c")for(K=0;K<ba;K++)U=C.value[K],C.array[l]=U.r,C.array[l+1]=U.g,C.array[l+2]=U.b,l+=3;else for(K=0;K<ba;K++)U=C.value[K],C.array[l]=U.x,C.array[l+1]=U.y,C.array[l+2]=U.z,l+=3;else if(C.size===4)for(K=0;K<ba;K++)U=C.value[K],C.array[l]=U.x,C.array[l+1]=U.y,C.array[l+2]=U.z,C.array[l+3]=U.w,l+=4;j.bindBuffer(j.ARRAY_BUFFER,C.buffer);j.bufferData(j.ARRAY_BUFFER,C.array,i)}}}f.__dirtyVertices=!1;f.__dirtyColors=!1;h.attributes&&t(h)}else if(B instanceof
+THREE.ParticleSystem)h=b(B,k),p=h.attributes&&m(h),(f.__dirtyVertices||f.__dirtyColors||B.sortParticles||p)&&d(f,j.DYNAMIC_DRAW,B),f.__dirtyVertices=!1,f.__dirtyColors=!1,h.attributes&&t(h)};this.initMaterial=function(a,b,c,d){var e,f,g,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?
+h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var l,k,m;l=m=i=0;for(k=b.length;l<k;l++)g=b[l],g instanceof THREE.SpotLight&&m++,g instanceof THREE.DirectionalLight&&m++,g instanceof THREE.PointLight&&i++;i+m<=O?l=m:(l=Math.ceil(O*m/(i+m)),i=O-l);g={directional:l,point:i};i=m=0;for(l=b.length;i<l;i++)k=b[i],k instanceof THREE.SpotLight&&
+k.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{l=a.fragmentShader;k=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,
+shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(l),d.push(k));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;for(d=P.length;p<d;p++)if(P[p].code===h){o=P[p].program;break a}p=j.createProgram();d=[ta?"#define VERTEX_TEXTURES":"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
 "","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":
 "","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":
 "",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 "",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-f=["#ifdef GL_ES","precision "+X+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
-"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(p,v("fragment",f+k));j.attachShader(p,
-v("vertex",d+l));j.linkProgram(p);j.getProgramParameter(p,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(p,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");p.uniforms={};p.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in i)d.push(q);q=d;d=0;for(i=q.length;d<i;d++)k=q[d],p.uniforms[k]=j.getUniformLocation(p,
-k);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(o in b)d.push(o);o=d;q=0;for(b=o.length;q<b;q++)c=o[q],p.attributes[c]=j.getAttribLocation(p,c);p.id=P.length;P.push({program:p,code:h});M.info.memory.programs=P.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal);
-o.tangent>=0&&j.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(j.enableVertexAttribArray(o.skinVertexA),j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(g in a.attributes)o[g]!==void 0&&o[g]>=0&&j.enableVertexAttribArray(o[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)q="morphTarget"+g,o[q]>=0&&(j.enableVertexAttribArray(o[q]),
+g=["#ifdef GL_ES","precision "+Y+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
+"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(p,v("fragment",g+l));j.attachShader(p,
+v("vertex",d+k));j.linkProgram(p);j.getProgramParameter(p,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(p,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");p.uniforms={};p.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in i)d.push(q);q=d;d=0;for(i=q.length;d<i;d++)l=q[d],p.uniforms[l]=j.getUniformLocation(p,
+l);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(o in b)d.push(o);o=d;q=0;for(b=o.length;q<b;q++)c=o[q],p.attributes[c]=j.getAttribLocation(p,c);p.id=P.length;P.push({program:p,code:h});M.info.memory.programs=P.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal);
+o.tangent>=0&&j.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(j.enableVertexAttribArray(o.skinVertexA),j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(f in a.attributes)o[f]!==void 0&&o[f]>=0&&j.enableVertexAttribArray(o[f]);if(a.morphTargets)for(f=a.numSupportedMorphTargets=0;f<this.maxMorphTargets;f++)q="morphTarget"+f,o[q]>=0&&(j.enableVertexAttribArray(o[q]),
 a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),a==="back"?j.cullFace(j.BACK):a==="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)}};
 a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),a==="back"?j.cullFace(j.BACK):a==="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)}};
 THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
 THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
 THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0};
 THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0};
@@ -446,7 +446,7 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
 THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
-THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
+THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
@@ -456,14 +456,14 @@ this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&
 Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
 Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
 THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),o=g.length,s=0;f=o-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<o-1;f++)s=d*h.chunks[f]/h.total,b.keys[f]={time:s,pos:g[f]};e.hierarchy[0]=
 THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),o=g.length,s=0;f=o-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<o-1;f++)s=d*h.chunks[f]/h.total,b.keys[f]={time:s,pos:g[f]};e.hierarchy[0]=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
-new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
+new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,h=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%f;this.phi=a>=0?a:a+f;c=this.verticalAngleMap.srcRange;
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,h=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%f;this.phi=a>=0?a:a+f;c=this.verticalAngleMap.srcRange;
 a=this.verticalAngleMap.dstRange;c=THREE.Math.mapLinear(this.phi,c[0],c[1],a[0],a[1]);var d=a[1]-a[0];this.phi=b((c-a[0])/d)*d+a[0];c=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;c=THREE.Math.mapLinear(this.theta,c[0],c[1],a[0],a[1]);d=a[1]-a[0];this.theta=b((c-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 a=this.verticalAngleMap.dstRange;c=THREE.Math.mapLinear(this.phi,c[0],c[1],a[0],a[1]);var d=a[1]-a[0];this.phi=b((c-a[0])/d)*d+a[0];c=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;c=THREE.Math.mapLinear(this.theta,c[0],c[1],a[0],a[1]);d=a[1]-a[0];this.theta=b((c-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 this.debugPath,b=this.spline,f=e(b,10),c=e(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),m=0;m<b.points.length;m++)c=new THREE.Mesh(f,h),c.position.copy(b.points[m]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 this.debugPath,b=this.spline,f=e(b,10),c=e(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),m=0;m<b.points.length;m++)c=new THREE.Mesh(f,h),c.position.copy(b.points[m]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 !1)}};THREE.PathControlsIdCounter=0;
 !1)}};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
+THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
@@ -487,8 +487,8 @@ b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?p=q:p.addSelf(a.
 b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),l=k=b.getMouseOnScreen(a.clientX,a.clientY),p=q=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),e!==d.NONE&&(e===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?k=b.getMouseOnScreen(a.clientX,
 b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),l=k=b.getMouseOnScreen(a.clientX,a.clientY),p=q=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),e!==d.NONE&&(e===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?k=b.getMouseOnScreen(a.clientX,
 a.clientY):e===d.PAN&&!b.noPan&&(q=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),e===d.NONE))e=a.button,e===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?l=k=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=q=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
 a.clientY):e===d.PAN&&!b.noPan&&(q=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),e===d.NONE))e=a.button,e===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?l=k=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=q=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
 e=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&e===d.NONE){if(a.keyCode===b.keys[d.ROTATE])e=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)e=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)e=d.PAN;e!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&e!==d.NONE)e=d.NONE},!1)};
 e=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&e===d.NONE){if(a.keyCode===b.keys[d.ROTATE])e=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)e=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)e=d.PAN;e!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&e!==d.NONE)e=d.NONE},!1)};
-THREE.CubeGeometry=function(a,c,b,d,g,e,f,h){function i(a,b,c,f,h,i,k,m){var n,o=d||1,p=g||1,q=h/2,s=i/2,t=l.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",p=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=e||1;var r=o+1,u=p+1,I=h/o,O=i/p,M=new THREE.Vector3;M[n]=k>0?1:-1;for(h=0;h<u;h++)for(i=0;i<r;i++){var j=new THREE.Vector3;j[a]=(i*I-q)*c;j[b]=(h*O-s)*f;j[n]=k;l.vertices.push(new THREE.Vertex(j))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
-new THREE.Face4(i+r*h+t,i+r*(h+1)+t,i+1+r*(h+1)+t,i+1+r*h+t),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=m,l.faces.push(a),l.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var l=this,k=a/2,p=c/2,q=b/2,m,t,n,o,s,u;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;o=1;t=2;s=
+THREE.CubeGeometry=function(a,c,b,d,g,e,f,h){function i(a,b,c,f,h,i,k,m){var n,o=d||1,p=g||1,q=h/2,s=i/2,r=l.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",p=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=e||1;var t=o+1,u=p+1,I=h/o,O=i/p,M=new THREE.Vector3;M[n]=k>0?1:-1;for(h=0;h<u;h++)for(i=0;i<t;i++){var j=new THREE.Vector3;j[a]=(i*I-q)*c;j[b]=(h*O-s)*f;j[n]=k;l.vertices.push(new THREE.Vertex(j))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
+new THREE.Face4(i+t*h+r,i+t*(h+1)+r,i+1+t*(h+1)+r,i+1+t*h+r),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=m,l.faces.push(a),l.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var l=this,k=a/2,p=c/2,q=b/2,m,t,n,o,s,u;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;o=1;t=2;s=
 3;n=4;u=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var r in h)this.sides[r]!=void 0&&(this.sides[r]=h[r]);this.sides.px&&i("z","y",-1,-1,b,c,k,m);this.sides.nx&&i("z","y",1,-1,b,c,-k,o);this.sides.py&&i("x","z",1,1,a,b,p,t);this.sides.ny&&i("x","z",1,-1,a,b,-p,s);this.sides.pz&&i("x","y",1,-1,a,c,q,n);this.sides.nz&&i("x","y",-1,-1,a,c,-q,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 3;n=4;u=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var r in h)this.sides[r]!=void 0&&(this.sides[r]=h[r]);this.sides.px&&i("z","y",-1,-1,b,c,k,m);this.sides.nx&&i("z","y",1,-1,b,c,-k,o);this.sides.py&&i("x","z",1,1,a,b,p,t);this.sides.ny&&i("x","z",1,-1,a,b,-p,s);this.sides.pz&&i("x","y",1,-1,a,c,q,n);this.sides.nz&&i("x","y",-1,-1,a,c,-q,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CylinderGeometry=function(a,c,b,d,g,e){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,d=d||8,g=g||1,h,i,l=[],k=[];for(i=0;i<=g;i++){var p=[],q=[],m=i/g,t=m*(c-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(t*Math.sin(n*Math.PI*2),-m*b+f,t*Math.cos(n*Math.PI*2))));p.push(this.vertices.length-1);q.push(new THREE.UV(n,m))}l.push(p);k.push(q)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=l[i][h],p=l[i+1][h],q=l[i+1][h+1],m=l[i][h+1],t=
 THREE.CylinderGeometry=function(a,c,b,d,g,e){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,d=d||8,g=g||1,h,i,l=[],k=[];for(i=0;i<=g;i++){var p=[],q=[],m=i/g,t=m*(c-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(t*Math.sin(n*Math.PI*2),-m*b+f,t*Math.cos(n*Math.PI*2))));p.push(this.vertices.length-1);q.push(new THREE.UV(n,m))}l.push(p);k.push(q)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=l[i][h],p=l[i+1][h],q=l[i+1][h+1],m=l[i][h+1],t=
@@ -501,14 +501,15 @@ h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0
 0,c=m+k*2,b=0;b<c;b++){var d=ea*b,e=ea*(b+1),f=ha+j+d,g=ha+j+e,l=f,d=ha+P+d,e=ha+P+e,n=g;l+=F;d+=F;e+=F;n+=F;C.faces.push(new THREE.Face4(l,d,e,n,null,null,z));z&&(l=b/c,d=(b+1)/c,e=h+i*2,f=(C.vertices[f].position.z+i)/e,g=(C.vertices[g].position.z+i)/e,C.faceVertexUvs[0].push([new THREE.UV(f,l),new THREE.UV(g,l),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function e(a,b,c){C.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=F;b+=F;c+=F;C.faces.push(new THREE.Face3(a,b,c,
 0,c=m+k*2,b=0;b<c;b++){var d=ea*b,e=ea*(b+1),f=ha+j+d,g=ha+j+e,l=f,d=ha+P+d,e=ha+P+e,n=g;l+=F;d+=F;e+=F;n+=F;C.faces.push(new THREE.Face4(l,d,e,n,null,null,z));z&&(l=b/c,d=(b+1)/c,e=h+i*2,f=(C.vertices[f].position.z+i)/e,g=(C.vertices[g].position.z+i)/e,C.faceVertexUvs[0].push([new THREE.UV(f,l),new THREE.UV(g,l),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function e(a,b,c){C.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=F;b+=F;c+=F;C.faces.push(new THREE.Face3(a,b,c,
 null,null,r));if(r){var d=E.maxY,e=E.maxX,f=C.vertices[b].position.x,b=C.vertices[b].position.y,g=C.vertices[c].position.x,c=C.vertices[c].position.y;C.faceVertexUvs[0].push([new THREE.UV(C.vertices[a].position.x/e,C.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,l=c.bevelSize!==void 0?c.bevelSize:i-2,k=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,
 null,null,r));if(r){var d=E.maxY,e=E.maxX,f=C.vertices[b].position.x,b=C.vertices[b].position.y,g=C.vertices[c].position.x,c=C.vertices[c].position.y;C.faceVertexUvs[0].push([new THREE.UV(C.vertices[a].position.x/e,C.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,l=c.bevelSize!==void 0?c.bevelSize:i-2,k=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,
 q=c.curveSegments!==void 0?c.curveSegments:12,m=c.steps!==void 0?c.steps:1,t=c.bendPath,n=c.extrudePath,o,s=!1,u=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,r=c.material,z=c.extrudeMaterial,E=this.shapebb;if(n)o=n.getPoints(q),m=o.length,s=!0,p=!1;p||(l=i=k=0);var G,v,w,C=this,F=this.vertices.length;t&&a.addWrapPath(t);q=u?a.extractAllSpacedPoints(q):a.extractAllPoints(q);t=q.shape;q=q.holes;if(n=!THREE.Shape.Utils.isClockWise(t)){t=t.reverse();v=0;for(w=q.length;v<w;v++)G=q[v],THREE.Shape.Utils.isClockWise(G)&&
 q=c.curveSegments!==void 0?c.curveSegments:12,m=c.steps!==void 0?c.steps:1,t=c.bendPath,n=c.extrudePath,o,s=!1,u=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,r=c.material,z=c.extrudeMaterial,E=this.shapebb;if(n)o=n.getPoints(q),m=o.length,s=!0,p=!1;p||(l=i=k=0);var G,v,w,C=this,F=this.vertices.length;t&&a.addWrapPath(t);q=u?a.extractAllSpacedPoints(q):a.extractAllPoints(q);t=q.shape;q=q.holes;if(n=!THREE.Shape.Utils.isClockWise(t)){t=t.reverse();v=0;for(w=q.length;v<w;v++)G=q[v],THREE.Shape.Utils.isClockWise(G)&&
-(q[v]=G.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(t,q);u=t;v=0;for(w=q.length;v<w;v++)G=q[v],t=t.concat(G);var B,L,J,W,X,T,ea=t.length,ba=n.length,x=[];B=0;L=u.length;j=L-1;for(P=B+1;B<L;B++,j++,P++)j===L&&(j=0),P===L&&(P=0),x[B]=d(u[B],u[j],u[P]);var I=[],O,M=x.concat();v=0;for(w=q.length;v<w;v++){G=q[v];O=[];B=0;L=G.length;j=L-1;for(P=B+1;B<L;B++,j++,P++)j===L&&(j=0),P===L&&(P=0),O[B]=d(G[B],G[j],G[P]);I.push(O);M=M.concat(O)}for(J=0;J<k;J++){W=J/k;X=i*(1-W);W=l*Math.sin(W*Math.PI/2);
-B=0;for(L=u.length;B<L;B++)T=b(u[B],x[B],W),e(T.x,T.y,-X);v=0;for(w=q.length;v<w;v++){G=q[v];O=I[v];B=0;for(L=G.length;B<L;B++)T=b(G[B],O[B],W),e(T.x,T.y,-X)}}W=l;for(B=0;B<ea;B++)T=p?b(t[B],M[B],W):t[B],s?e(T.x,T.y+o[0].y,o[0].x):e(T.x,T.y,0);for(J=1;J<=m;J++)for(B=0;B<ea;B++)T=p?b(t[B],M[B],W):t[B],s?e(T.x,T.y+o[J-1].y,o[J-1].x):e(T.x,T.y,h/m*J);for(J=k-1;J>=0;J--){W=J/k;X=i*(1-W);W=l*Math.sin(W*Math.PI/2);B=0;for(L=u.length;B<L;B++)T=b(u[B],x[B],W),e(T.x,T.y,h+X);v=0;for(w=q.length;v<w;v++){G=
-q[v];O=I[v];B=0;for(L=G.length;B<L;B++)T=b(G[B],O[B],W),s?e(T.x,T.y+o[m-1].y,o[m-1].x+X):e(T.x,T.y,h+X)}}if(p){p=ea*0;for(B=0;B<ba;B++)l=n[B],f(l[2]+p,l[1]+p,l[0]+p);p=ea*(m+k*2);for(B=0;B<ba;B++)l=n[B],f(l[0]+p,l[1]+p,l[2]+p)}else{for(B=0;B<ba;B++)l=n[B],f(l[2],l[1],l[0]);for(B=0;B<ba;B++)l=n[B],f(l[0]+ea*m,l[1]+ea*m,l[2]+ea*m)}var j,P,ha=0;g(u);ha+=u.length;v=0;for(w=q.length;v<w;v++)G=q[v],g(G),ha+=G.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+(q[v]=G.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(t,q);u=t;v=0;for(w=q.length;v<w;v++)G=q[v],t=t.concat(G);var B,L,J,X,Y,T,ea=t.length,ba=n.length,x=[];B=0;L=u.length;j=L-1;for(P=B+1;B<L;B++,j++,P++)j===L&&(j=0),P===L&&(P=0),x[B]=d(u[B],u[j],u[P]);var I=[],O,M=x.concat();v=0;for(w=q.length;v<w;v++){G=q[v];O=[];B=0;L=G.length;j=L-1;for(P=B+1;B<L;B++,j++,P++)j===L&&(j=0),P===L&&(P=0),O[B]=d(G[B],G[j],G[P]);I.push(O);M=M.concat(O)}for(J=0;J<k;J++){X=J/k;Y=i*(1-X);X=l*Math.sin(X*Math.PI/2);
+B=0;for(L=u.length;B<L;B++)T=b(u[B],x[B],X),e(T.x,T.y,-Y);v=0;for(w=q.length;v<w;v++){G=q[v];O=I[v];B=0;for(L=G.length;B<L;B++)T=b(G[B],O[B],X),e(T.x,T.y,-Y)}}X=l;for(B=0;B<ea;B++)T=p?b(t[B],M[B],X):t[B],s?e(T.x,T.y+o[0].y,o[0].x):e(T.x,T.y,0);for(J=1;J<=m;J++)for(B=0;B<ea;B++)T=p?b(t[B],M[B],X):t[B],s?e(T.x,T.y+o[J-1].y,o[J-1].x):e(T.x,T.y,h/m*J);for(J=k-1;J>=0;J--){X=J/k;Y=i*(1-X);X=l*Math.sin(X*Math.PI/2);B=0;for(L=u.length;B<L;B++)T=b(u[B],x[B],X),e(T.x,T.y,h+Y);v=0;for(w=q.length;v<w;v++){G=
+q[v];O=I[v];B=0;for(L=G.length;B<L;B++)T=b(G[B],O[B],X),s?e(T.x,T.y+o[m-1].y,o[m-1].x+Y):e(T.x,T.y,h+Y)}}if(p){p=ea*0;for(B=0;B<ba;B++)l=n[B],f(l[2]+p,l[1]+p,l[0]+p);p=ea*(m+k*2);for(B=0;B<ba;B++)l=n[B],f(l[0]+p,l[1]+p,l[2]+p)}else{for(B=0;B<ba;B++)l=n[B],f(l[2],l[1],l[0]);for(B=0;B<ba;B++)l=n[B],f(l[0]+ea*m,l[1]+ea*m,l[2]+ea*m)}var j,P,ha=0;g(u);ha+=u.length;v=0;for(w=q.length;v<w;v++)G=q[v],g(G),ha+=G.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.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
-THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=g.vertices[a].position,e=g.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var g=this,e=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
--a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,e);b(0,5,1,e);b(0,1,7,e);b(0,7,10,e);b(0,10,11,e);b(1,5,9,e);b(5,11,4,e);b(11,10,2,e);b(10,7,6,e);b(7,1,8,e);b(3,9,4,e);b(3,4,2,e);b(3,2,6,e);b(3,6,8,e);b(3,8,9,e);b(4,9,5,e);b(2,4,11,e);b(6,2,10,e);b(8,6,7,e);b(9,8,1,e);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in e.faces){var i=d(e.faces[h].a,e.faces[h].b),l=d(e.faces[h].b,e.faces[h].c),k=d(e.faces[h].c,e.faces[h].a);b(e.faces[h].a,i,k,a);b(e.faces[h].b,l,
-i,a);b(e.faces[h].c,k,l,a);b(i,l,k,a)}e.faces=a.faces}g.faces=e.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],g=[],e=[],f=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=f.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),g[h]=this.vertices.length-1):g=e;i==0&&(e=d);
+THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){var e=g.vertices[a].position,f=g.vertices[b].position,h=g.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(e.clone().normalize(),f.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(e.z,e.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-e.y/2),new THREE.UV(1-
+(Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,b){var d=g.vertices[a].position,e=g.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var g=this,e=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,e);b(0,5,1,e);b(0,
+1,7,e);b(0,7,10,e);b(0,10,11,e);b(1,5,9,e);b(5,11,4,e);b(11,10,2,e);b(10,7,6,e);b(7,1,8,e);b(3,9,4,e);b(3,4,2,e);b(3,2,6,e);b(3,6,8,e);b(3,8,9,e);b(4,9,5,e);b(2,4,11,e);b(6,2,10,e);b(8,6,7,e);b(9,8,1,e);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in e.faces){var i=d(e.faces[h].a,e.faces[h].b),l=d(e.faces[h].b,e.faces[h].c),k=d(e.faces[h].c,e.faces[h].a);b(e.faces[h].a,i,k,a);b(e.faces[h].b,l,i,a);b(e.faces[h].c,k,l,a);b(i,l,k,a)}e.faces=a.faces;e.faceVertexUvs[0]=a.faceVertexUvs[0]}g.faces=
+e.faces;g.faceVertexUvs[0]=e.faceVertexUvs[0];this.computeCentroids();this.computeFaceNormals(!0)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],g=[],e=[],f=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.001;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=f.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),g[h]=this.vertices.length-1):g=e;i==0&&(e=d);
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(g[h],g[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(g[h],g[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
 f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push([e(a.uv,a.position,h),e(b.uv,b.position,h),e(c.uv,c.position,h)])):(h-=1,d(a,g(a,b),g(a,c),h),d(g(a,b),b,g(b,c),h),d(g(a,c),g(b,c),c,h),d(g(a,b),g(b,c),g(a,c),h))}function g(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function e(a,b,c){c<0&&a.u===
 f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push([e(a.uv,a.position,h),e(b.uv,b.position,h),e(c.uv,c.position,h)])):(h-=1,d(a,g(a,b),g(a,c),h),d(g(a,b),b,g(b,c),h),d(g(a,c),g(b,c),c,h),d(g(a,b),g(b,c),g(a,c),h))}function g(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function e(a,b,c){c<0&&a.u===
@@ -516,10 +517,9 @@ f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);for(var g=a/2,e=c/2,b=b||1,d=d||1,f=b+1,h=d+1,i=a/b,l=c/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(c=0;c<f;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*i-g,-(a*l-e),0)));for(a=0;a<d;a++)for(c=0;c<b;c++)g=new THREE.Face4(c+f*a,c+f*(a+1),c+1+f*(a+1),c+1+f*a),g.normal.copy(k),g.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(g),this.faceVertexUvs[0].push([new THREE.UV(c/b,a/d),new THREE.UV(c/
 THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);for(var g=a/2,e=c/2,b=b||1,d=d||1,f=b+1,h=d+1,i=a/b,l=c/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(c=0;c<f;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*i-g,-(a*l-e),0)));for(a=0;a<d;a++)for(c=0;c<b;c++)g=new THREE.Face4(c+f*a,c+f*(a+1),c+1+f*(a+1),c+1+f*a),g.normal.copy(k),g.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(g),this.faceVertexUvs[0].push([new THREE.UV(c/b,a/d),new THREE.UV(c/
 b,(a+1)/d),new THREE.UV((c+1)/b,(a+1)/d),new THREE.UV((c+1)/b,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
 b,(a+1)/d),new THREE.UV((c+1)/b,(a+1)/d),new THREE.UV((c+1)/b,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,g=Math.PI,e=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){d=b/f;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),l=[],k=0;for(d=0;d<e;d++){var p=2*d/e,q=i*Math.sin(p*g),p=i*Math.cos(p*g);(b==0||b==f)&&d>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,h,q)))-1);l.push(k)}c.push(l)}for(var m,t,n,g=c.length,b=0;b<g;b++)if(e=c[b].length,b>0)for(d=0;d<e;d++){l=d==e-1;f=c[b][l?0:d+1];h=c[b][l?e-1:d];i=c[b-1][l?
-e-1:d];l=c[b-1][l?0:d+1];q=b/(g-1);m=(b-1)/(g-1);t=(d+1)/e;var p=d/e,k=new THREE.UV(1-t,q),q=new THREE.UV(1-p,q),p=new THREE.UV(1-p,m),o=new THREE.UV(1-t,m);b<c.length-1&&(m=this.vertices[f].position.clone(),t=this.vertices[h].position.clone(),n=this.vertices[i].position.clone(),m.normalize(),t.normalize(),n.normalize(),this.faces.push(new THREE.Face3(f,h,i,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(n.x,n.y,n.z)])),this.faceVertexUvs[0].push([k,q,p]));b>1&&(m=
-this.vertices[f].position.clone(),t=this.vertices[i].position.clone(),n=this.vertices[l].position.clone(),m.normalize(),t.normalize(),n.normalize(),this.faces.push(new THREE.Face3(f,i,l,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(n.x,n.y,n.z)])),this.faceVertexUvs[0].push([k,p,o]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
-THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
+THREE.SphereGeometry=function(a,c,b,d,g,e,f){THREE.Geometry.call(this);var a=a||50,c=Math.max(3,Math.floor(c)||8),b=Math.max(2,Math.floor(b)||6),d=d!=void 0?d:0,g=g!=void 0?g:Math.PI*2,e=e!=void 0?e:0,f=f!=void 0?f:Math.PI,h,i,l=[],k=[];for(i=0;i<=b;i++){var p=[],q=[];for(h=0;h<=c;h++){var m=h/c,t=i/b;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+m*g)*Math.sin(e+t*f),a*Math.cos(e+t*f),a*Math.sin(d+m*g)*Math.sin(e+t*f))));p.push(this.vertices.length-1);q.push(new THREE.UV(m,t))}l.push(p);
+k.push(q)}for(i=0;i<b;i++)for(h=0;h<c;h++){var d=l[i][h+1],g=l[i][h],e=l[i+1][h],f=l[i+1][h+1],p=this.vertices[d].position.clone().normalize(),q=this.vertices[g].position.clone().normalize(),m=this.vertices[e].position.clone().normalize(),t=this.vertices[f].position.clone().normalize(),n=k[i][h+1].clone(),o=k[i][h].clone(),s=k[i+1][h].clone(),u=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,e,f,[p,m,t])),this.faceVertexUvs[0].push([n,s,u])):Math.abs(this.vertices[e].position.y)==
+a?(this.faces.push(new THREE.Face3(d,g,e,[p,q,m])),this.faceVertexUvs[0].push([n,o,s])):(this.faces.push(new THREE.Face4(d,g,e,f,[p,q,m,t])),this.faceVertexUvs[0].push([n,o,s,u]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var d=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var d=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 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]},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=this.getFace(),b=this.size/c.resolution,d=
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=this.getFace(),b=this.size/c.resolution,d=
@@ -527,7 +527,7 @@ THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:
 k));g.lineTo(i,k);break;case "q":i=c[a++]*b+d;k=c[a++]*b;m=c[a++]*b+d;t=c[a++]*b;g.quadraticCurveTo(m,t,i,k);if(f=e[e.length-1]){p=f.x;q=f.y;f=1;for(h=this.divisions;f<=h;f++){var u=f/h,r=THREE.Shape.Utils.b2(u,p,m,i),u=THREE.Shape.Utils.b2(u,q,t,k);e.push(new THREE.Vector2(r,u))}}break;case "b":if(i=c[a++]*b+d,k=c[a++]*b,m=c[a++]*b+d,t=c[a++]*-b,n=c[a++]*b+d,o=c[a++]*-b,g.bezierCurveTo(i,k,m,t,n,o),f=e[e.length-1]){p=f.x;q=f.y;f=1;for(h=this.divisions;f<=h;f++)u=f/h,r=THREE.Shape.Utils.b3(u,p,m,
 k));g.lineTo(i,k);break;case "q":i=c[a++]*b+d;k=c[a++]*b;m=c[a++]*b+d;t=c[a++]*b;g.quadraticCurveTo(m,t,i,k);if(f=e[e.length-1]){p=f.x;q=f.y;f=1;for(h=this.divisions;f<=h;f++){var u=f/h,r=THREE.Shape.Utils.b2(u,p,m,i),u=THREE.Shape.Utils.b2(u,q,t,k);e.push(new THREE.Vector2(r,u))}}break;case "b":if(i=c[a++]*b+d,k=c[a++]*b,m=c[a++]*b+d,t=c[a++]*-b,n=c[a++]*b+d,o=c[a++]*-b,g.bezierCurveTo(i,k,m,t,n,o),f=e[e.length-1]){p=f.x;q=f.y;f=1;for(h=this.divisions;f<=h;f++)u=f/h,r=THREE.Shape.Utils.b3(u,p,m,
 n,i),u=THREE.Shape.Utils.b3(u,q,t,o,k),e.push(new THREE.Vector2(r,u))}}}return{offset:s.ha*b,points:e,path:g}}}};
 n,i),u=THREE.Shape.Utils.b3(u,q,t,o,k),e.push(new THREE.Vector2(r,u))}}}return{offset:s.ha*b,points:e,path:g}}}};
 (function(a){var c=function(a){for(var c=a.length,g=0,e=c-1,f=0;f<c;e=f++)g+=a[e].x*a[f].y-a[f].x*a[e].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var e=[],f=[],h=[],i,l,k;if(c(a)>0)for(l=0;l<g;l++)f[l]=l;else for(l=0;l<g;l++)f[l]=g-1-l;var p=2*g;for(l=g-1;g>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=l;g<=i&&(i=0);l=i+1;g<=l&&(l=0);k=l+1;g<=k&&(k=0);var q;a:{q=a;var m=i,t=l,n=k,o=g,s=f,u=void 0,r=void 0,z=void 0,
 (function(a){var c=function(a){for(var c=a.length,g=0,e=c-1,f=0;f<c;e=f++)g+=a[e].x*a[f].y-a[f].x*a[e].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var e=[],f=[],h=[],i,l,k;if(c(a)>0)for(l=0;l<g;l++)f[l]=l;else for(l=0;l<g;l++)f[l]=g-1-l;var p=2*g;for(l=g-1;g>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=l;g<=i&&(i=0);l=i+1;g<=l&&(l=0);k=l+1;g<=k&&(k=0);var q;a:{q=a;var m=i,t=l,n=k,o=g,s=f,u=void 0,r=void 0,z=void 0,
-E=void 0,G=void 0,v=void 0,w=void 0,C=void 0,F=void 0,r=q[s[m]].x,z=q[s[m]].y,E=q[s[t]].x,G=q[s[t]].y,v=q[s[n]].x,w=q[s[n]].y;if(1.0E-10>(E-r)*(w-z)-(G-z)*(v-r))q=!1;else{for(u=0;u<o;u++)if(!(u==m||u==t||u==n)){var C=q[s[u]].x,F=q[s[u]].y,B=void 0,L=void 0,J=void 0,W=void 0,X=void 0,T=void 0,ea=void 0,ba=void 0,x=void 0,I=void 0,O=void 0,M=void 0,B=J=X=void 0,B=v-E,L=w-G,J=r-v,W=z-w,X=E-r,T=G-z,ea=C-r,ba=F-z,x=C-E,I=F-G,O=C-v,M=F-w,B=B*I-L*x,X=X*ba-T*ea,J=J*M-W*O;if(B>=0&&J>=0&&X>=0){q=!1;break a}}q=
+E=void 0,G=void 0,v=void 0,w=void 0,C=void 0,F=void 0,r=q[s[m]].x,z=q[s[m]].y,E=q[s[t]].x,G=q[s[t]].y,v=q[s[n]].x,w=q[s[n]].y;if(1.0E-10>(E-r)*(w-z)-(G-z)*(v-r))q=!1;else{for(u=0;u<o;u++)if(!(u==m||u==t||u==n)){var C=q[s[u]].x,F=q[s[u]].y,B=void 0,L=void 0,J=void 0,X=void 0,Y=void 0,T=void 0,ea=void 0,ba=void 0,x=void 0,I=void 0,O=void 0,M=void 0,B=J=Y=void 0,B=v-E,L=w-G,J=r-v,X=z-w,Y=E-r,T=G-z,ea=C-r,ba=F-z,x=C-E,I=F-G,O=C-v,M=F-w,B=B*I-L*x,Y=Y*ba-T*ea,J=J*M-X*O;if(B>=0&&J>=0&&Y>=0){q=!1;break a}}q=
 !0}}if(q){e.push([a[f[i]],a[f[l]],a[f[k]]]);h.push([f[i],f[l],f[k]]);i=l;for(k=l+1;k<g;i++,k++)f[i]=f[k];g--;p=2*g}}if(d)return h;return e};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 !0}}if(q){e.push([a[f[i]],a[f[l]],a[f[k]]]);h.push([f[i],f[l],f[k]]);i=l;for(k=l+1;k<g;i++,k++)f[i]=f[k];g--;p=2*g}}if(d)return h;return e};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,c,b,d,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var e=d/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(e);g.y=this.radius*Math.sin(e);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(e);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(e);h.z=
 THREE.TorusGeometry=function(a,c,b,d,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var e=d/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(e);g.y=this.radius*Math.sin(e);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(e);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(e);h.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var g=(this.segmentsT+1)*b+d-1,e=(this.segmentsT+1)*(b-1)+d-1,f=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,e,f,h,[c[g],c[e],c[f],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[e]);i.normal.addSelf(c[f]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var g=(this.segmentsT+1)*b+d-1,e=(this.segmentsT+1)*(b-1)+d-1,f=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,e,f,h,[c[g],c[e],c[f],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[e]);i.normal.addSelf(c[f]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
@@ -536,12 +536,12 @@ THREE.TorusKnotGeometry=function(a,c,b,d,g,e,f){function h(a,b,c,d,e,f){b=c/d*a;
 this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,g=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=i.x-g.x;b.y=i.y-g.y;b.z=i.z-g.z;d.x=i.x+g.x;d.y=i.y+g.y;d.z=i.z+g.z;e.cross(b,d);d.cross(e,b);e.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=i*d.x+f*e.x;g.y+=i*d.y+f*e.y;g.z+=i*d.z+f*e.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
 this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,g=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=i.x-g.x;b.y=i.y-g.y;b.z=i.z-g.z;d.x=i.x+g.x;d.y=i.y+g.y;d.z=i.z+g.z;e.cross(b,d);d.cross(e,b);e.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=i*d.x+f*e.x;g.y+=i*d.y+f*e.y;g.z+=i*d.z+f*e.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
 g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,e=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][e],e=this.grid[a][e],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,e));this.faceVertexUvs[0].push([f,i,l,k])}this.computeCentroids();
 g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,e=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][e],e=this.grid[a][e],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,e));this.faceVertexUvs[0].push([f,i,l,k])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){k.vertexColors=[];for(var j,l,m,n=0;n<4;n++){m=i[n];j=new THREE.Color;j.setRGB(0,0,0);for(var o=0;o<m.length;o++)l=h.vertexColors[m[o]-1],j.r+=l.r,j.g+=l.g,j.b+=l.b;j.r/=m.length;j.g/=m.length;j.b/=m.length;k.vertexColors[n]=j}}g.push(k);(!f.supportUVs||q.length!=0)&&e.push([q[a],q[b],q[c],q[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var l=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){l.vertexColors=[];for(var j,k,m,n=0;n<4;n++){m=i[n];j=new THREE.Color;j.setRGB(0,0,0);for(var o=0;o<m.length;o++)k=h.vertexColors[m[o]-1],j.r+=k.r,j.g+=k.g,j.b+=k.b;j.r/=m.length;j.g/=m.length;j.b/=m.length;l.vertexColors[n]=j}}g.push(l);(!f.supportUVs||q.length!=0)&&e.push([q[a],q[b],q[c],q[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
 b)}var d=[],g=[],e=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],k={},p={},q=[],m,t,n,o,s,u=a.faceVertexUvs[0];m=0;for(t=u.length;m<t;m++){n=0;for(o=u[m].length;n<o;n++)s=d[m]["abcd".charAt(n)],q[s]||(q[s]=u[m][n])}var r;m=0;for(t=d.length;m<t;m++)if(s=d[m],l.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),f.supportUVs&&q.length!=0){r=new THREE.UV;if(s instanceof THREE.Face3)r.u=q[s.a].u+q[s.b].u+q[s.c].u,r.v=q[s.a].v+q[s.b].v+q[s.c].v,r.u/=3,r.v/=3;else if(s instanceof THREE.Face4)r.u=
 b)}var d=[],g=[],e=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],k={},p={},q=[],m,t,n,o,s,u=a.faceVertexUvs[0];m=0;for(t=u.length;m<t;m++){n=0;for(o=u[m].length;n<o;n++)s=d[m]["abcd".charAt(n)],q[s]||(q[s]=u[m][n])}var r;m=0;for(t=d.length;m<t;m++)if(s=d[m],l.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),f.supportUVs&&q.length!=0){r=new THREE.UV;if(s instanceof THREE.Face3)r.u=q[s.a].u+q[s.b].u+q[s.c].u,r.v=q[s.a].v+q[s.b].v+q[s.c].v,r.u/=3,r.v/=3;else if(s instanceof THREE.Face4)r.u=
 q[s.a].u+q[s.b].u+q[s.c].u+q[s.d].u,r.v=q[s.a].v+q[s.b].v+q[s.c].v+q[s.d].v,r.u/=4,r.v/=4;q.push(r)}t=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var z=0,u=h.length,E,G,v={},w={},C=function(a,
 q[s.a].u+q[s.b].u+q[s.c].u+q[s.d].u,r.v=q[s.a].v+q[s.b].v+q[s.c].v+q[s.d].v,r.u/=4,r.v/=4;q.push(r)}t=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var z=0,u=h.length,E,G,v={},w={},C=function(a,
 b){v[a]===void 0&&(v[a]=[]);v[a].push(b)},F=function(a,b){w[a]===void 0&&(w[a]={});w[a][b]=null};for(m in t){r=t[m];E=m.split("_");G=E[0];E=E[1];C(G,[G,E]);C(E,[G,E]);n=0;for(o=r.length;n<o;n++)s=r[n],F(G,s,m),F(E,s,m);r.length<2&&(p[m]=!0)}for(m in t)if(r=t[m],s=r[0],r=r[1],E=m.split("_"),G=E[0],E=E[1],o=new THREE.Vector3,p[m]?(o.addSelf(h[G].position),o.addSelf(h[E].position),o.multiplyScalar(0.5)):(o.addSelf(l[s]),o.addSelf(l[r]),o.addSelf(h[G].position),o.addSelf(h[E].position),o.multiplyScalar(0.25)),
 b){v[a]===void 0&&(v[a]=[]);v[a].push(b)},F=function(a,b){w[a]===void 0&&(w[a]={});w[a][b]=null};for(m in t){r=t[m];E=m.split("_");G=E[0];E=E[1];C(G,[G,E]);C(E,[G,E]);n=0;for(o=r.length;n<o;n++)s=r[n],F(G,s,m),F(E,s,m);r.length<2&&(p[m]=!0)}for(m in t)if(r=t[m],s=r[0],r=r[1],E=m.split("_"),G=E[0],E=E[1],o=new THREE.Vector3,p[m]?(o.addSelf(h[G].position),o.addSelf(h[E].position),o.multiplyScalar(0.5)):(o.addSelf(l[s]),o.addSelf(l[r]),o.addSelf(h[G].position),o.addSelf(h[E].position),o.multiplyScalar(0.25)),
-k[m]=u+d.length+z,i.push(new THREE.Vertex(o)),z++,f.supportUVs&&q.length!=0)r=new THREE.UV,r.u=q[G].u+q[E].u,r.v=q[G].v+q[E].v,r.u/=2,r.v/=2,q.push(r);var B,L;E=["123","12","2","23"];o=["123","23","3","31"];var C=["123","31","1","12"],F=["1234","12","2","23"],J=["1234","23","3","34"],W=["1234","34","4","41"],X=["1234","41","1","12"];m=0;for(t=l.length;m<t;m++)s=d[m],r=u+m,s instanceof THREE.Face3?(z=b(s.a,s.b),G=b(s.b,s.c),B=b(s.c,s.a),c(r,k[z],s.b,k[G],s,E),c(r,k[G],s.c,k[B],s,o),c(r,k[B],s.a,k[z],
-s,C)):s instanceof THREE.Face4?(z=b(s.a,s.b),G=b(s.b,s.c),B=b(s.c,s.d),L=b(s.d,s.a),c(r,k[z],s.b,k[G],s,F),c(r,k[G],s.c,k[B],s,J),c(r,k[B],s.d,k[L],s,W),c(r,k[L],s.a,k[z],s,X)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;k=new THREE.Vector3;m=0;for(t=h.length;m<t;m++)if(v[m]!==void 0){i.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);r=0;for(n in w[m])i.addSelf(l[n]),r++;z=0;u=v[m].length;for(n=0;n<u;n++)p[b(v[m][n][0],v[m][n][1])]&&z++;if(z!=2){i.divideScalar(r);for(n=0;n<
+k[m]=u+d.length+z,i.push(new THREE.Vertex(o)),z++,f.supportUVs&&q.length!=0)r=new THREE.UV,r.u=q[G].u+q[E].u,r.v=q[G].v+q[E].v,r.u/=2,r.v/=2,q.push(r);var B,L;E=["123","12","2","23"];o=["123","23","3","31"];var C=["123","31","1","12"],F=["1234","12","2","23"],J=["1234","23","3","34"],X=["1234","34","4","41"],Y=["1234","41","1","12"];m=0;for(t=l.length;m<t;m++)s=d[m],r=u+m,s instanceof THREE.Face3?(z=b(s.a,s.b),G=b(s.b,s.c),B=b(s.c,s.a),c(r,k[z],s.b,k[G],s,E),c(r,k[G],s.c,k[B],s,o),c(r,k[B],s.a,k[z],
+s,C)):s instanceof THREE.Face4?(z=b(s.a,s.b),G=b(s.b,s.c),B=b(s.c,s.d),L=b(s.d,s.a),c(r,k[z],s.b,k[G],s,F),c(r,k[G],s.c,k[B],s,J),c(r,k[B],s.d,k[L],s,X),c(r,k[L],s.a,k[z],s,Y)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;k=new THREE.Vector3;m=0;for(t=h.length;m<t;m++)if(v[m]!==void 0){i.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);r=0;for(n in w[m])i.addSelf(l[n]),r++;z=0;u=v[m].length;for(n=0;n<u;n++)p[b(v[m][n][0],v[m][n][1])]&&z++;if(z!=2){i.divideScalar(r);for(n=0;n<
 u;n++)r=v[m][n],r=h[r[0]].position.clone().addSelf(h[r[1]].position).divideScalar(2),k.addSelf(r);k.divideScalar(u);s.addSelf(h[m].position);s.multiplyScalar(u-3);s.addSelf(i);s.addSelf(k.multiplyScalar(2));s.divideScalar(u);d[m].position=s}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 u;n++)r=v[m][n],r=h[r[0]].position.clone().addSelf(h[r[1]].position).divideScalar(2),k.addSelf(r);k.divideScalar(u);s.addSelf(h[m].position);s.multiplyScalar(u-3);s.addSelf(i);s.addSelf(k.multiplyScalar(2));s.divideScalar(u);d[m].position=s}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
@@ -557,66 +557,66 @@ THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,c,b,d,g,e){var f=new XMLHtt
 f.status+"]")};f.open("GET",c,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 f.status+"]")};f.open("GET",c,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g){var e=new XMLHttpRequest,f=b+"/"+a.buffers,h=0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.response,c,d,a.materials):console.error("Couldn't load ["+f+"] ["+e.status+"]"):e.readyState==3?g&&(h==0&&(h=e.getResponseHeader("Content-Length")),g({total:h,loaded:e.responseText.length})):e.readyState==2&&(h=e.getResponseHeader("Content-Length"))};e.open("GET",f,!0);
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g){var e=new XMLHttpRequest,f=b+"/"+a.buffers,h=0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.response,c,d,a.materials):console.error("Couldn't load ["+f+"] ["+e.status+"]"):e.readyState==3?g&&(h==0&&(h=e.getResponseHeader("Content-Length")),g({total:h,loaded:e.responseText.length})):e.readyState==2&&(h=e.getResponseHeader("Content-Length"))};e.open("GET",f,!0);
 e.responseType="arraybuffer";e.send(null)};
 e.responseType="arraybuffer";e.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a){return a%4?4-a%4:0}function g(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function l(b,c){var d,e,f,g,h,i,k,l,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];g=m[d*3+2];h=r[e*2];e=r[e*2+1];i=r[f*2];k=r[f*2+1];f=r[g*2];l=r[g*2+1];g=n.faceVertexUvs[0];var o=[];o.push(new THREE.UV(h,e));o.push(new THREE.UV(i,k));o.push(new THREE.UV(f,l));g.push(o)}}
-function k(b,c){var d,e,f,g,h,i,k,l,m,o,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=r[e*2];e=r[e*2+1];k=r[f*2];m=r[f*2+1];l=r[g*2];o=r[g*2+1];g=r[h*2];f=r[h*2+1];h=n.faceVertexUvs[0];var j=[];j.push(new THREE.UV(i,e));j.push(new THREE.UV(k,m));j.push(new THREE.UV(l,o));j.push(new THREE.UV(g,f));h.push(j)}}function p(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(e,
-f,g,null,null,h))}function q(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=k[d],n.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function m(b,c,d,e){for(var f,g,h,i,k,l,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];k=d[e*3];l=d[e*3+1];m=d[e*3+2];i=o[e];var p=u[l*3],j=u[l*3+1];l=u[l*3+2];var q=u[m*3],s=u[m*3+1];m=u[m*3+2];n.faces.push(new THREE.Face3(f,
-g,h,[new THREE.Vector3(u[k*3],u[k*3+1],u[k*3+2]),new THREE.Vector3(p,j,l),new THREE.Vector3(q,s,m)],null,i))}}function t(b,c,d,e){for(var f,g,h,i,k,l,m,o,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),j=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];l=d[e*4];m=d[e*4+1];o=d[e*4+2];p=d[e*4+3];k=j[e];var q=u[m*3],s=u[m*3+1];m=u[m*3+2];var r=u[o*3],t=u[o*3+1];o=u[o*3+2];var v=u[p*3],w=u[p*3+1];p=u[p*3+2];n.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(u[l*
-3],u[l*3+1],u[l*3+2]),new THREE.Vector3(q,s,m),new THREE.Vector3(r,t,o),new THREE.Vector3(v,w,p)],null,k))}}var n=this,o=0,s,u=[],r=[],z,E,G,v,w,C;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);s={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,o,12),header_bytes:g(a,o+12),vertex_coordinate_bytes:g(a,o+13),normal_coordinate_bytes:g(a,o+14),uv_coordinate_bytes:g(a,o+15),vertex_index_bytes:g(a,o+16),normal_index_bytes:g(a,
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a){return a%4?4-a%4:0}function g(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function l(b,c){var d,e,f,g,h,i,l,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];g=m[d*3+2];h=r[e*2];e=r[e*2+1];i=r[f*2];l=r[f*2+1];f=r[g*2];k=r[g*2+1];g=n.faceVertexUvs[0];var o=[];o.push(new THREE.UV(h,e));o.push(new THREE.UV(i,l));o.push(new THREE.UV(f,k));g.push(o)}}
+function k(b,c){var d,e,f,g,h,i,l,k,m,o,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=r[e*2];e=r[e*2+1];l=r[f*2];m=r[f*2+1];k=r[g*2];o=r[g*2+1];g=r[h*2];f=r[h*2+1];h=n.faceVertexUvs[0];var j=[];j.push(new THREE.UV(i,e));j.push(new THREE.UV(l,m));j.push(new THREE.UV(k,o));j.push(new THREE.UV(g,f));h.push(j)}}function p(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(e,
+f,g,null,null,h))}function q(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),l=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=l[d],n.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function m(b,c,d,e){for(var f,g,h,i,l,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];l=d[e*3];k=d[e*3+1];m=d[e*3+2];i=o[e];var p=u[k*3],j=u[k*3+1];k=u[k*3+2];var q=u[m*3],r=u[m*3+1];m=u[m*3+2];n.faces.push(new THREE.Face3(f,
+g,h,[new THREE.Vector3(u[l*3],u[l*3+1],u[l*3+2]),new THREE.Vector3(p,j,k),new THREE.Vector3(q,r,m)],null,i))}}function t(b,c,d,e){for(var f,g,h,i,l,k,m,o,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),j=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];m=d[e*4+1];o=d[e*4+2];p=d[e*4+3];l=j[e];var q=u[m*3],r=u[m*3+1];m=u[m*3+2];var s=u[o*3],t=u[o*3+1];o=u[o*3+2];var v=u[p*3],w=u[p*3+1];p=u[p*3+2];n.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(u[k*
+3],u[k*3+1],u[k*3+2]),new THREE.Vector3(q,r,m),new THREE.Vector3(s,t,o),new THREE.Vector3(v,w,p)],null,l))}}var n=this,o=0,s,u=[],r=[],z,E,G,v,w,C;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);s={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,o,12),header_bytes:g(a,o+12),vertex_coordinate_bytes:g(a,o+13),normal_coordinate_bytes:g(a,o+14),uv_coordinate_bytes:g(a,o+15),vertex_index_bytes:g(a,o+16),normal_index_bytes:g(a,
 o+17),uv_index_bytes:g(a,o+18),material_index_bytes:g(a,o+19),nvertices:i(a,o+20),nnormals:i(a,o+20+4),nuvs:i(a,o+20+8),ntri_flat:i(a,o+20+12),ntri_smooth:i(a,o+20+16),ntri_flat_uv:i(a,o+20+20),ntri_smooth_uv:i(a,o+20+24),nquad_flat:i(a,o+20+28),nquad_smooth:i(a,o+20+32),nquad_flat_uv:i(a,o+20+36),nquad_smooth_uv:i(a,o+20+40)};s.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");o+=s.header_bytes;b=s.vertex_index_bytes*3+s.material_index_bytes;C=s.vertex_index_bytes*
 o+17),uv_index_bytes:g(a,o+18),material_index_bytes:g(a,o+19),nvertices:i(a,o+20),nnormals:i(a,o+20+4),nuvs:i(a,o+20+8),ntri_flat:i(a,o+20+12),ntri_smooth:i(a,o+20+16),ntri_flat_uv:i(a,o+20+20),ntri_smooth_uv:i(a,o+20+24),nquad_flat:i(a,o+20+28),nquad_smooth:i(a,o+20+32),nquad_flat_uv:i(a,o+20+36),nquad_smooth_uv:i(a,o+20+40)};s.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");o+=s.header_bytes;b=s.vertex_index_bytes*3+s.material_index_bytes;C=s.vertex_index_bytes*
 4+s.material_index_bytes;z=s.ntri_flat*b;E=s.ntri_smooth*(b+s.normal_index_bytes*3);G=s.ntri_flat_uv*(b+s.uv_index_bytes*3);v=s.ntri_smooth_uv*(b+s.normal_index_bytes*3+s.uv_index_bytes*3);w=s.nquad_flat*C;b=s.nquad_smooth*(C+s.normal_index_bytes*4);C=s.nquad_flat_uv*(C+s.uv_index_bytes*4);o+=function(b){var c=s.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(o);
 4+s.material_index_bytes;z=s.ntri_flat*b;E=s.ntri_smooth*(b+s.normal_index_bytes*3);G=s.ntri_flat_uv*(b+s.uv_index_bytes*3);v=s.ntri_smooth_uv*(b+s.normal_index_bytes*3+s.uv_index_bytes*3);w=s.nquad_flat*C;b=s.nquad_smooth*(C+s.normal_index_bytes*4);C=s.nquad_flat_uv*(C+s.uv_index_bytes*4);o+=function(b){var c=s.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(o);
 o+=function(b){var c=s.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],u.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(o);o+=c(s.nnormals*3);o+=function(b){var c=s.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],r.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(o);z=o+z+c(s.ntri_flat*2);E=z+E+c(s.ntri_smooth*2);G=E+G+c(s.ntri_flat_uv*2);v=G+v+c(s.ntri_smooth_uv*2);w=v+w+c(s.nquad_flat*2);
 o+=function(b){var c=s.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],u.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(o);o+=c(s.nnormals*3);o+=function(b){var c=s.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],r.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(o);z=o+z+c(s.ntri_flat*2);E=z+E+c(s.ntri_smooth*2);G=E+G+c(s.ntri_flat_uv*2);v=G+v+c(s.ntri_smooth_uv*2);w=v+w+c(s.nquad_flat*2);
 b=w+b+c(s.nquad_smooth*2);C=b+C+c(s.nquad_flat_uv*2);(function(a){var b=s.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,c)}})(E);(function(a){var b=s.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,d)}})(G);(function(a){var b=s.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,
 b=w+b+c(s.nquad_smooth*2);C=b+C+c(s.nquad_flat_uv*2);(function(a){var b=s.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,c)}})(E);(function(a){var b=s.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,d)}})(G);(function(a){var b=s.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,
 c)}})(b);(function(a){var b=s.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;t(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,d)}})(C);(function(a){var b=s.ntri_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(o);(function(a){var b=s.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(z);(function(a){var b=s.nquad_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(v);(function(a){var b=
 c)}})(b);(function(a){var b=s.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;t(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,d)}})(C);(function(a){var b=s.ntri_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(o);(function(a){var b=s.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(z);(function(a){var b=s.nquad_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(v);(function(a){var b=
 s.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;t(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(w);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
 s.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;t(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(w);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
-THREE.ColladaLoader=function(){function a(a,d,g){V=a;d=d||fa;g!==void 0&&(a=g.split("/"),a.pop(),ya=a.length<1?"":a.join("/")+"/");ia=c("//dae:library_images/dae:image",f,"image");oa=c("//dae:library_materials/dae:material",w,"material");la=c("//dae:library_effects/dae:effect",J,"effect");ka=c("//dae:library_geometries/dae:geometry",o,"geometry");na=c("//dae:library_controllers/dae:controller",h,"controller");pa=c("//dae:library_animations/dae:animation",X,"animation");ma=c(".//dae:library_visual_scenes/dae:visual_scene",
-k,"visual_scene");ra=[];sa=[];(a=V.evaluate(".//dae:scene/dae:instance_visual_scene",V,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),K=ma[a]):K=null;Q=new THREE.Object3D;for(a=0;a<K.nodes.length;a++)Q.add(e(K.nodes[a]));b();for(var i in pa);i={scene:Q,morphs:ra,skins:sa,dae:{images:ia,materials:oa,effects:la,geometries:ka,controllers:na,animations:pa,visualScenes:ma,scene:K}};d&&d(i);return i}function c(a,b,c){for(var a=V.evaluate(a,V,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+THREE.ColladaLoader=function(){function a(a,d,g){W=a;d=d||fa;g!==void 0&&(a=g.split("/"),a.pop(),ya=a.length<1?"":a.join("/")+"/");ia=c("//dae:library_images/dae:image",f,"image");oa=c("//dae:library_materials/dae:material",w,"material");la=c("//dae:library_effects/dae:effect",J,"effect");ka=c("//dae:library_geometries/dae:geometry",o,"geometry");na=c("//dae:library_controllers/dae:controller",h,"controller");pa=c("//dae:library_animations/dae:animation",Y,"animation");ma=c(".//dae:library_visual_scenes/dae:visual_scene",
+k,"visual_scene");ra=[];sa=[];(a=W.evaluate(".//dae:scene/dae:instance_visual_scene",W,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),K=ma[a]):K=null;Q=new THREE.Object3D;for(a=0;a<K.nodes.length;a++)Q.add(e(K.nodes[a]));b();for(var i in pa);i={scene:Q,morphs:ra,skins:sa,dae:{images:ia,materials:oa,effects:la,geometries:ka,controllers:na,animations:pa,visualScenes:ma,scene:K}};d&&d(i);return i}function c(a,b,c){for(var a=W.evaluate(a,W,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in pa)for(var e=pa[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];
 null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in pa)for(var e=pa[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];
-f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=na[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=K.getChildById(c.skeleton[0],!0)||K.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
-for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var s=i.weights[p][q];s.joint==m&&j.weights.push(s)}}else throw"ColladaLoader: Could not find joint '"+
-j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function e(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=na[a.controllers[f].url];switch(i.type){case "skin":if(ka[i.skin.source]){var j=
+f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=na[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=K.getChildById(c.skeleton[0],!0)||K.getChildBySid(c.skeleton[0],!0),h,i,j,l,k=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
+for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=f.skin;for(l=0;l<h.length;l++)if(j=h[l],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var r=i.weights[p][q];r.joint==m&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
+j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],l=j.index,j=j.weight,m=a.vertices[l],l=o[l],k.x=m.position.x,k.y=m.position.y,k.z=m.position.z,n[h].skinningMatrix.multiplyVector3(k),l.position.x+=k.x*j,l.position.y+=k.y*j,l.position.z+=k.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function e(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=na[a.controllers[f].url];switch(i.type){case "skin":if(ka[i.skin.source]){var j=
 new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(na[i.skin.source]&&(d=i=na[i.skin.source],i.morph&&ka[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(ka[i.morph.source])j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
 new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(na[i.skin.source]&&(d=i=na[i.skin.source],i.morph&&ka[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(ka[i.morph.source])j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
-0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=ka[i.url],k={},l=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=la[oa[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=k[o.symbol]=p.material;l++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=
-i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=na[c.url],j.skinInstanceController=c,j.name="skin_"+sa.length,sa.push(j);else if(d!==void 0){h=i;k=d instanceof m?na[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(p=ka[k.targets[l]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
+0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=ka[i.url],l={},k=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=la[oa[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=l[o.symbol]=p.material;k++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(k>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)k=
+i.faces[h],k.materials=[l[k.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=na[c.url],j.skinInstanceController=c,j.name="skin_"+sa.length,sa.push(j);else if(d!==void 0){h=i;l=d instanceof m?na[d.url]:d;if(!l||!l.morph)console.log("could not find morph controller!");else{l=l.morph;for(k=0;k<l.targets.length;k++)if(p=ka[l.targets[k]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
 h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+ra.length;ra.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f<a.nodes.length;f++)b.add(e(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
 h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+ra.length;ra.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f<a.nodes.length;f++)b.add(e(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
 null}function i(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function q(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url=
 null}function i(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function q(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url=
 "";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function o(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){}function r(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function z(){this.source="";this.stride=this.count=0;this.params=[]}function E(){this.input={}}function G(){this.semantic=
 "";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function o(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){}function r(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function z(){this.source="";this.stride=this.count=0;this.params=[]}function E(){this.input={}}function G(){this.semantic=
 "";this.offset=0;this.source="";this.set=0}function v(a){this.id=a;this.type=null}function w(){this.name=this.id="";this.instance_effect=null}function C(){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 F(a,b){this.type=a;this.effect=b;this.material=null}function B(a){this.effect=a;this.format=this.init_from=null}function L(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
 "";this.offset=0;this.source="";this.set=0}function v(a){this.id=a;this.type=null}function w(){this.name=this.id="";this.instance_effect=null}function C(){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 F(a,b){this.type=a;this.effect=b;this.material=null}function B(a){this.effect=a;this.format=this.init_from=null}function L(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
-this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function W(){this.url=""}function X(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function T(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function ea(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ba(a){var b=a.getAttribute("id");
+this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function X(){this.url=""}function Y(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function T(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function ea(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ba(a){var b=a.getAttribute("id");
 if(U[b]!=void 0)return U[b];U[b]=(new v(b)).parse(a);return U[b]}function x(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function I(a){for(var a=M(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function O(a){for(var a=M(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function j(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function P(a,b){if(a===
 if(U[b]!=void 0)return U[b];U[b]=(new v(b)).parse(a);return U[b]}function x(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function I(a){for(var a=M(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function O(a){for(var a=M(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function j(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function P(a,b){if(a===
-void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function ha(a,b){var c="";c+=P(a.x,b)+",";c+=P(a.y,b)+",";c+=P(a.z,b);return c}var V=null,Q=null,K,fa=null,U={},ia={},pa={},na={},ka={},oa={},la={},ma,ya,ra,sa,xa=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
+void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function ha(a,b){var c="";c+=P(a.x,b)+",";c+=P(a.y,b)+",";c+=P(a.z,b);return c}var W=null,Q=null,K,fa=null,U={},ia={},pa={},na={},ka={},oa={},la={},ma,ya,ra,sa,xa=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
 c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new l).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
 c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new l).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
 0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new v).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new G).parse(d))}}return b};
 0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new v).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new G).parse(d))}}return b};
 l.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=I(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new v).parse(f);b[f.id]=f;break;case "joints":c=
 l.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=I(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new v).parse(f);b[f.id]=f;break;case "joints":c=
 f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new G).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};l.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
 f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new G).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};l.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
-a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new G).parse(g));break;case "v":c=O(g.textContent);break;case "vcount":d=O(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=
+a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new G).parse(g));break;case "v":c=O(g.textContent);break;case "vcount":d=O(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var l={},k=0;k<e.length;k++){var m=e[k],n=c[g+m.offset];switch(m.semantic){case "JOINT":l.joint=n;break;case "WEIGHT":l.weight=b[m.source].data[n]}}i.push(l);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=
 0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=
 0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=
 function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
 function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
 b);if(d)return d}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
 b);if(d)return d}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
 this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=
 this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=
-b.getAttribute("url").replace(/^#/,"");(b=V.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",V,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new q).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in pa)for(var e=pa[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
+b.getAttribute("url").replace(/^#/,"");(b=W.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",W,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new q).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in pa)for(var e=pa[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
 if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
 if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
-this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
+this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,l,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){l=j.output[i];break}g=l!==void 0?l instanceof THREE.Matrix4?g.multiply(g,l):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
 this.transforms[a].matrix)};q.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=I(a.textContent);this.updateMatrix();return this};q.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
 this.transforms[a].matrix)};q.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=I(a.textContent);this.updateMatrix();return this};q.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
 case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
 case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=V.evaluate(".//dae:instance_material",c,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new t).parse(d)),d=c.iterateNext()}}return this};t.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.prototype.parse=function(a){this.url=
-a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=V.evaluate(".//dae:instance_material",c,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new t).parse(b)),b=a.iterateNext();break}}return this};o.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
+if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=W.evaluate(".//dae:instance_material",c,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new t).parse(d)),d=c.iterateNext()}}return this};t.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.prototype.parse=function(a){this.url=
+a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=W.evaluate(".//dae:instance_material",c,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new t).parse(b)),b=a.iterateNext();break}}return this};o.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
 (new s(this)).parse(c)}}return this};s.prototype.parse=function(a){function b(a,c){var d=ha(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":ba(d);break;case "vertices":this.vertices=(new E).parse(d);break;case "triangles":this.primitives.push((new r).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new u).parse(d))}}var e=
 (new s(this)).parse(c)}}return this};s.prototype.parse=function(a){function b(a,c){var d=ha(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":ba(d);break;case "vertices":this.vertices=(new E).parse(d);break;case "triangles":this.primitives.push((new r).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new u).parse(d))}}var e=
 {};this.geometry3js=new THREE.Geometry;d=U[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
 {};this.geometry3js=new THREE.Geometry;d=U[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
-return this};s.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],q=[],s={},r=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=U[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=ha(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],
-l.data[k+1],l.data[k+2]));break;case "TEXCOORD":s[i.set]===void 0&&(s[i.set]=[]);s[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;n==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],r.length?r:new THREE.Color):n==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],r.length?r:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=s[o[f]],b.faceVertexUvs[f].push([e[0],
+return this};s.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,l,k,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],q=[],r={},s=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],k=U[i.source],j=g[d+e*h.length+i.offset],l=k.accessor.params.length,l*=j,i.semantic){case "VERTEX":i=ha(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(k.data[l],
+k.data[l+1],k.data[l+2]));break;case "TEXCOORD":r[i.set]===void 0&&(r[i.set]=[]);r[i.set].push(new THREE.UV(k.data[l],k.data[l+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(k.data[l],k.data[l+1],k.data[l+2]))}var t;n==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],s.length?s:new THREE.Color):n==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],s.length?s:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=r[o[f]],b.faceVertexUvs[f].push([e[0],
 e[1],e[2]]);d+=h.length*n}};u.prototype=new r;u.prototype.constructor=u;r.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};r.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=j(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new G).parse(a.childNodes[b]));break;case "vcount":this.vcount=
 e[1],e[2]]);d+=h.length*n}};u.prototype=new r;u.prototype.constructor=u;r.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};r.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=j(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new G).parse(a.childNodes[b]));break;case "vcount":this.vcount=
 O(c.textContent);break;case "p":this.p=O(c.textContent)}}return this};z.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=j(a,"count",0);this.stride=j(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
 O(c.textContent);break;case "p":this.p=O(c.textContent)}}return this};z.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=j(a,"count",0);this.stride=j(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
 "input"){var c=(new G).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};G.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=j(a,"set",-1);this.offset=j(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=M(c.textContent),
 "input"){var c=(new G).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};G.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=j(a,"set",-1);this.offset=j(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=M(c.textContent),
 e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=I(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=O(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=M(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new z).parse(c.childNodes[d]);break}}}return this};
 e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=I(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=O(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=M(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new z).parse(c.childNodes[d]);break}}}return this};
 v.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};w.prototype.parse=function(a){this.id=a.getAttribute("id");
 v.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};w.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new W).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return this.texture==null};C.prototype.isTexture=function(){return this.texture!=null};C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=I(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
-c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=V.evaluate(".//dae:float",c,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new X).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return this.texture==null};C.prototype.isTexture=function(){return this.texture!=null};C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=I(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
+c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=W.evaluate(".//dae:float",c,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};F.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=ia[this.effect.surface.init_from]))a.map=
 null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};F.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=ia[this.effect.surface.init_from]))a.map=
 THREE.ImageUtils.loadTexture(ya+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=xa;return this.material=new THREE.MeshLambertMaterial(a)};B.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
 THREE.ImageUtils.loadTexture(ya+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=xa;return this.material=new THREE.MeshLambertMaterial(a)};B.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
 if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
 if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
 c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};J.prototype.create=function(){if(this.shader==null)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
 c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};J.prototype.create=function(){if(this.shader==null)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
 J.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new B(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new L(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
 J.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new B(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new L(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
-break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};J.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new F(c.nodeName,this)).parse(c)}}};W.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};X.prototype.parse=function(a){this.id=a.getAttribute("id");
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};J.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new F(c.nodeName,this)).parse(c)}}};X.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};Y.prototype.parse=function(a){this.id=a.getAttribute("id");
 this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new v).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new ea(this)).parse(c));break;case "channel":this.channel.push((new T(this)).parse(c))}}return this};T.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
 this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new v).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new ea(this)).parse(c));break;case "channel":this.channel.push((new T(this)).parse(c))}}return this};T.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
 b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};ea.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new G).parse(c))}}return this};
 b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};ea.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new G).parse(c))}}return this};
 ea.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
 ea.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
@@ -636,21 +636,21 @@ d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.se
 THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function g(){var a;for(q in J.objects)if(!x.objects[q])if(s=J.objects[q],s.geometry!==void 0){if(C=x.geometries[s.geometry]){a=!1;for(O=0;O<s.materials.length;O++)L=x.materials[s.materials[O]],a=L instanceof THREE.ShaderMaterial;a&&C.computeTangents();z=s.position;E=s.rotation;G=s.quaternion;v=s.scale;G=0;L.length==0&&(L=new THREE.MeshFaceMaterial);L.length>1&&(L=new THREE.MeshFaceMaterial);
 THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function g(){var a;for(q in J.objects)if(!x.objects[q])if(s=J.objects[q],s.geometry!==void 0){if(C=x.geometries[s.geometry]){a=!1;for(O=0;O<s.materials.length;O++)L=x.materials[s.materials[O]],a=L instanceof THREE.ShaderMaterial;a&&C.computeTangents();z=s.position;E=s.rotation;G=s.quaternion;v=s.scale;G=0;L.length==0&&(L=new THREE.MeshFaceMaterial);L.length>1&&(L=new THREE.MeshFaceMaterial);
 a=new THREE.Mesh(C,L);a.name=q;a.position.set(z[0],z[1],z[2]);G?(a.quaternion.set(G[0],G[1],G[2],G[3]),a.useQuaternion=!0):a.rotation.set(E[0],E[1],E[2]);a.scale.set(v[0],v[1],v[2]);a.visible=s.visible;x.scene.add(a);x.objects[q]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);x.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(C),x.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&s.trigger.toLowerCase()!="none"&&(b=
 a=new THREE.Mesh(C,L);a.name=q;a.position.set(z[0],z[1],z[2]);G?(a.quaternion.set(G[0],G[1],G[2],G[3]),a.useQuaternion=!0):a.rotation.set(E[0],E[1],E[2]);a.scale.set(v[0],v[1],v[2]);a.visible=s.visible;x.scene.add(a);x.objects[q]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);x.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(C),x.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&s.trigger.toLowerCase()!="none"&&(b=
 {type:s.trigger,object:s},x.triggers[a.name]=b)}}else z=s.position,E=s.rotation,G=s.quaternion,v=s.scale,G=0,a=new THREE.Object3D,a.name=q,a.position.set(z[0],z[1],z[2]),G?(a.quaternion.set(G[0],G[1],G[2],G[3]),a.useQuaternion=!0):a.rotation.set(E[0],E[1],E[2]),a.scale.set(v[0],v[1],v[2]),a.visible=s.visible!==void 0?s.visible:!1,x.scene.add(a),x.objects[q]=a,x.empties[q]=a,s.trigger&&s.trigger.toLowerCase()!="none"&&(b={type:s.trigger,object:s},x.triggers[a.name]=b)}function e(a){return function(b){x.geometries[a]=
 {type:s.trigger,object:s},x.triggers[a.name]=b)}}else z=s.position,E=s.rotation,G=s.quaternion,v=s.scale,G=0,a=new THREE.Object3D,a.name=q,a.position.set(z[0],z[1],z[2]),G?(a.quaternion.set(G[0],G[1],G[2],G[3]),a.useQuaternion=!0):a.rotation.set(E[0],E[1],E[2]),a.scale.set(v[0],v[1],v[2]),a.visible=s.visible!==void 0?s.visible:!1,x.scene.add(a),x.objects[q]=a,x.empties[q]=a,s.trigger&&s.trigger.toLowerCase()!="none"&&(b={type:s.trigger,object:s},x.triggers[a.name]=b)}function e(a){return function(b){x.geometries[a]=
-b;g();X-=1;i.onLoadComplete();h()}}function f(a){return function(b){x.geometries[a]=b}}function h(){i.callbackProgress({totalModels:ea,totalTextures:ba,loadedModels:ea-X,loadedTextures:ba-T},x);i.onLoadProgress();X==0&&T==0&&c(x)}var i=this,l=THREE.Loader.prototype.extractUrlbase(b),k,p,q,m,t,n,o,s,u,r,z,E,G,v,w,C,F,B,L,J,W,X,T,ea,ba,x;J=a;b=new THREE.BinaryLoader;W=new THREE.JSONLoader;T=X=0;x={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+b;g();Y-=1;i.onLoadComplete();h()}}function f(a){return function(b){x.geometries[a]=b}}function h(){i.callbackProgress({totalModels:ea,totalTextures:ba,loadedModels:ea-Y,loadedTextures:ba-T},x);i.onLoadProgress();Y==0&&T==0&&c(x)}var i=this,l=THREE.Loader.prototype.extractUrlbase(b),k,p,q,m,t,n,o,s,u,r,z,E,G,v,w,C,F,B,L,J,X,Y,T,ea,ba,x;J=a;b=new THREE.BinaryLoader;X=new THREE.JSONLoader;T=Y=0;x={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
 empties:{}};a=!1;for(q in J.objects)if(s=J.objects[q],s.meshCollider){a=!0;break}if(a)x.scene.collisions=new THREE.CollisionSystem;if(J.transform){a=J.transform.position;u=J.transform.rotation;var I=J.transform.scale;a&&x.scene.position.set(a[0],a[1],a[2]);u&&x.scene.rotation.set(u[0],u[1],u[2]);I&&x.scene.scale.set(I[0],I[1],I[2]);(a||u||I)&&x.scene.updateMatrix()}a=function(){T-=1;h();i.onLoadComplete()};for(t in J.cameras)u=J.cameras[t],u.type=="perspective"?F=new THREE.PerspectiveCamera(u.fov,
 empties:{}};a=!1;for(q in J.objects)if(s=J.objects[q],s.meshCollider){a=!0;break}if(a)x.scene.collisions=new THREE.CollisionSystem;if(J.transform){a=J.transform.position;u=J.transform.rotation;var I=J.transform.scale;a&&x.scene.position.set(a[0],a[1],a[2]);u&&x.scene.rotation.set(u[0],u[1],u[2]);I&&x.scene.scale.set(I[0],I[1],I[2]);(a||u||I)&&x.scene.updateMatrix()}a=function(){T-=1;h();i.onLoadComplete()};for(t in J.cameras)u=J.cameras[t],u.type=="perspective"?F=new THREE.PerspectiveCamera(u.fov,
 u.aspect,u.near,u.far):u.type=="ortho"&&(F=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far)),z=u.position,u=u.target,F.position.set(z[0],z[1],z[2]),F.target=new THREE.Vector3(u[0],u[1],u[2]),x.cameras[t]=F;for(m in J.lights)u=J.lights[m],t=u.color!==void 0?u.color:16777215,F=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(z=u.direction,r=new THREE.DirectionalLight(t,F),r.position.set(z[0],z[1],z[2]),r.position.normalize()):u.type=="point"?(z=u.position,r=u.distance,
 u.aspect,u.near,u.far):u.type=="ortho"&&(F=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far)),z=u.position,u=u.target,F.position.set(z[0],z[1],z[2]),F.target=new THREE.Vector3(u[0],u[1],u[2]),x.cameras[t]=F;for(m in J.lights)u=J.lights[m],t=u.color!==void 0?u.color:16777215,F=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(z=u.direction,r=new THREE.DirectionalLight(t,F),r.position.set(z[0],z[1],z[2]),r.position.normalize()):u.type=="point"?(z=u.position,r=u.distance,
 r=new THREE.PointLight(t,F,r),r.position.set(z[0],z[1],z[2])):u.type=="ambient"&&(r=new THREE.AmbientLight(t)),x.scene.add(r),x.lights[m]=r;for(n in J.fogs)m=J.fogs[n],m.type=="linear"?B=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(B=new THREE.FogExp2(0,m.density)),u=m.color,B.color.setRGB(u[0],u[1],u[2]),x.fogs[n]=B;if(x.cameras&&J.defaults.camera)x.currentCamera=x.cameras[J.defaults.camera];if(x.fogs&&J.defaults.fog)x.scene.fog=x.fogs[J.defaults.fog];u=J.defaults.bgcolor;x.bgColor=new THREE.Color;
 r=new THREE.PointLight(t,F,r),r.position.set(z[0],z[1],z[2])):u.type=="ambient"&&(r=new THREE.AmbientLight(t)),x.scene.add(r),x.lights[m]=r;for(n in J.fogs)m=J.fogs[n],m.type=="linear"?B=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(B=new THREE.FogExp2(0,m.density)),u=m.color,B.color.setRGB(u[0],u[1],u[2]),x.fogs[n]=B;if(x.cameras&&J.defaults.camera)x.currentCamera=x.cameras[J.defaults.camera];if(x.fogs&&J.defaults.fog)x.scene.fog=x.fogs[J.defaults.fog];u=J.defaults.bgcolor;x.bgColor=new THREE.Color;
-x.bgColor.setRGB(u[0],u[1],u[2]);x.bgColorAlpha=J.defaults.bgalpha;for(k in J.geometries)if(n=J.geometries[k],n.type=="bin_mesh"||n.type=="ascii_mesh")X+=1,i.onLoadStart();ea=X;for(k in J.geometries)n=J.geometries[k],n.type=="cube"?(C=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),x.geometries[k]=C):n.type=="plane"?(C=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),x.geometries[k]=C):n.type=="sphere"?
-(C=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),x.geometries[k]=C):n.type=="cylinder"?(C=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),x.geometries[k]=C):n.type=="torus"?(C=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),x.geometries[k]=C):n.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(n.subdivisions),x.geometries[k]=C):n.type=="bin_mesh"?b.load(d(n.url,J.urlBaseType),e(k)):n.type=="ascii_mesh"?W.load(d(n.url,J.urlBaseType),
-e(k)):n.type=="embedded_mesh"&&(n=J.embeds[n.id])&&W.createModel(n,f(k),"");for(o in J.textures)if(k=J.textures[o],k.url instanceof Array){T+=k.url.length;for(n=0;n<k.url.length;n++)i.onLoadStart()}else T+=1,i.onLoadStart();ba=T;for(o in J.textures){k=J.textures[o];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){n=[];for(var O=0;O<k.url.length;O++)n[O]=d(k.url[O],J.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,
+x.bgColor.setRGB(u[0],u[1],u[2]);x.bgColorAlpha=J.defaults.bgalpha;for(k in J.geometries)if(n=J.geometries[k],n.type=="bin_mesh"||n.type=="ascii_mesh")Y+=1,i.onLoadStart();ea=Y;for(k in J.geometries)n=J.geometries[k],n.type=="cube"?(C=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),x.geometries[k]=C):n.type=="plane"?(C=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),x.geometries[k]=C):n.type=="sphere"?
+(C=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),x.geometries[k]=C):n.type=="cylinder"?(C=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),x.geometries[k]=C):n.type=="torus"?(C=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),x.geometries[k]=C):n.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(n.subdivisions),x.geometries[k]=C):n.type=="bin_mesh"?b.load(d(n.url,J.urlBaseType),e(k)):n.type=="ascii_mesh"?X.load(d(n.url,J.urlBaseType),
+e(k)):n.type=="embedded_mesh"&&(n=J.embeds[n.id])&&X.createModel(n,f(k),"");for(o in J.textures)if(k=J.textures[o],k.url instanceof Array){T+=k.url.length;for(n=0;n<k.url.length;n++)i.onLoadStart()}else T+=1,i.onLoadStart();ba=T;for(o in J.textures){k=J.textures[o];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){n=[];for(var O=0;O<k.url.length;O++)n[O]=d(k.url[O],J.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,
 J.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)n.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)n.magFilter=THREE[k.magFilter];if(k.repeat){n.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}k.offset&&n.offset.set(k.offset[0],k.offset[1]);if(k.wrap){B={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(B[k.wrap[0]]!==void 0)n.wrapS=B[k.wrap[0]];if(B[k.wrap[1]]!==void 0)n.wrapT=
 J.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)n.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)n.magFilter=THREE[k.magFilter];if(k.repeat){n.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}k.offset&&n.offset.set(k.offset[0],k.offset[1]);if(k.wrap){B={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(B[k.wrap[0]]!==void 0)n.wrapS=B[k.wrap[0]];if(B[k.wrap[1]]!==void 0)n.wrapT=
 B[k.wrap[1]]}}x.textures[o]=n}for(p in J.materials){o=J.materials[p];for(w in o.parameters)if(w=="envMap"||w=="map"||w=="lightMap")o.parameters[w]=x.textures[o.parameters[w]];else if(w=="shading")o.parameters[w]=o.parameters[w]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(w=="blending")o.parameters[w]=THREE[o.parameters[w]]?THREE[o.parameters[w]]:THREE.NormalBlending;else if(w=="combine")o.parameters[w]=o.parameters[w]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(w==
 B[k.wrap[1]]}}x.textures[o]=n}for(p in J.materials){o=J.materials[p];for(w in o.parameters)if(w=="envMap"||w=="map"||w=="lightMap")o.parameters[w]=x.textures[o.parameters[w]];else if(w=="shading")o.parameters[w]=o.parameters[w]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(w=="blending")o.parameters[w]=THREE[o.parameters[w]]?THREE[o.parameters[w]]:THREE.NormalBlending;else if(w=="combine")o.parameters[w]=o.parameters[w]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(w==
-"vertexColors")if(o.parameters[w]=="face")o.parameters[w]=THREE.FaceColors;else if(o.parameters[w])o.parameters[w]=THREE.VertexColors;if(o.parameters.opacity!==void 0&&o.parameters.opacity<1)o.parameters.transparent=!0;if(o.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);n=o.parameters.color;B=o.parameters.specular;b=o.parameters.ambient;W=o.parameters.shininess;a.tNormal.texture=x.textures[o.parameters.normalMap];if(o.parameters.normalMapFactor)a.uNormalScale.value=
-o.parameters.normalMapFactor;if(o.parameters.map)a.tDiffuse.texture=o.parameters.map,a.enableDiffuse.value=!0;if(o.parameters.lightMap)a.tAO.texture=o.parameters.lightMap,a.enableAO.value=!0;if(o.parameters.specularMap)a.tSpecular.texture=x.textures[o.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(B);a.uAmbientColor.value.setHex(b);a.uShininess.value=W;if(o.parameters.opacity)a.uOpacity.value=o.parameters.opacity;o=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
+"vertexColors")if(o.parameters[w]=="face")o.parameters[w]=THREE.FaceColors;else if(o.parameters[w])o.parameters[w]=THREE.VertexColors;if(o.parameters.opacity!==void 0&&o.parameters.opacity<1)o.parameters.transparent=!0;if(o.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);n=o.parameters.color;B=o.parameters.specular;b=o.parameters.ambient;X=o.parameters.shininess;a.tNormal.texture=x.textures[o.parameters.normalMap];if(o.parameters.normalMapFactor)a.uNormalScale.value=
+o.parameters.normalMapFactor;if(o.parameters.map)a.tDiffuse.texture=o.parameters.map,a.enableDiffuse.value=!0;if(o.parameters.lightMap)a.tAO.texture=o.parameters.lightMap,a.enableAO.value=!0;if(o.parameters.specularMap)a.tSpecular.texture=x.textures[o.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(B);a.uAmbientColor.value.setHex(b);a.uShininess.value=X;if(o.parameters.opacity)a.uOpacity.value=o.parameters.opacity;o=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
 vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else o=new THREE[o.type](o.parameters);x.materials[p]=o}g();i.callbackSync(x);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else o=new THREE[o.type](o.parameters);x.materials[p]=o}g();i.callbackSync(x);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var d=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,e=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var d=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,e=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 c,g,e,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,g=0;g<8;g++){for(var e=0,f=0;f<c;++f){var h=a.charCodeAt(f+d);e+=h>>1^-(h&1);b[8*f+g]=e}d+=c}c=a.length-d;e=new Uint16Array(c);for(g=f=0;g<c;g++)h=a.charCodeAt(g+d),e[g]=f-h,h==0&&f++;return[b,e]};
 c,g,e,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,g=0;g<8;g++){for(var e=0,f=0;f<c;++f){var h=a.charCodeAt(f+d);e+=h>>1^-(h&1);b[8*f+g]=e}d+=c}c=a.length-d;e=new Uint16Array(c);for(g=f=0;g<c;g++)h=a.charCodeAt(g+d),e[g]=f-h,h==0&&f++;return[b,e]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,e){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],k=[];(function(a,f,i){for(var k,l,o,s=a.length;i<s;i+=f)k=a[i],l=a[i+1],o=a[i+2],k=k/16383*b,l=l/16383*b,o=o/16383*b,k+=d,l+=g,o+=e,c.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,o)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(f[0],8,3);(function(a,
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,e){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],k=[];(function(a,f,i){for(var l,k,o,s=a.length;i<s;i+=f)l=a[i],k=a[i+1],o=a[i+2],l=l/16383*b,k=k/16383*b,o=o/16383*b,l+=d,k+=g,o+=e,c.vertices.push(new THREE.Vertex(new THREE.Vector3(l,k,o)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(f[0],8,3);(function(a,
 b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,l.push(d,e,f)})(f[0],8,5);(function(a){var b,d,e,f,g,i,u,r,z,E=a.length;for(b=0;b<E;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;r=d;z=e;i=f;u=d;var G=e,v=f,w=g.materials[0],C=l[G*3],F=l[G*3+1],G=l[G*3+2],B=l[v*3],L=l[v*3+1],v=l[v*3+2];u=new THREE.Vector3(l[u*3],l[u*3+1],l[u*3+2]);G=new THREE.Vector3(C,F,G);v=new THREE.Vector3(B,L,v);g.faces.push(new THREE.Face3(r,z,i,[u,G,v],null,w));g=k[d*2];d=k[d*2+
 b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,l.push(d,e,f)})(f[0],8,5);(function(a){var b,d,e,f,g,i,u,r,z,E=a.length;for(b=0;b<E;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;r=d;z=e;i=f;u=d;var G=e,v=f,w=g.materials[0],C=l[G*3],F=l[G*3+1],G=l[G*3+2],B=l[v*3],L=l[v*3+1],v=l[v*3+2];u=new THREE.Vector3(l[u*3],l[u*3+1],l[u*3+2]);G=new THREE.Vector3(C,F,G);v=new THREE.Vector3(B,L,v);g.faces.push(new THREE.Face3(r,z,i,[u,G,v],null,w));g=k[d*2];d=k[d*2+
 1];i=k[e*2];u=k[e*2+1];r=k[f*2];z=k[f*2+1];f=c.faceVertexUvs[0];e=i;i=u;u=[];u.push(new THREE.UV(g,d));u.push(new THREE.UV(e,i));u.push(new THREE.UV(r,z));f.push(u)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
 1];i=k[e*2];u=k[e*2+1];r=k[f*2];z=k[f*2+1];f=c.faceVertexUvs[0];e=i;i=u;u=[];u.push(new THREE.UV(g,d));u.push(new THREE.UV(e,i));u.push(new THREE.UV(r,z));f.push(u)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -72,7 +72,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,m=this.w,l=m*c+g*f-h*d,j=m*d+h*c-e*f,i=m*f+e*d-g*c,c=-e*
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,m=this.w,l=m*c+g*f-h*d,j=m*d+h*c-e*f,i=m*f+e*d-g*c,c=-e*
 c-g*d-h*f;b.x=l*m+c*-e+j*-h-i*-g;b.y=j*m+c*-g+i*-e-l*-h;b.z=i*m+c*-h+l*-g-j*-e;return b}};
 c-g*d-h*f;b.x=l*m+c*-e+j*-h-i*-g;b.y=j*m+c*-g+i*-e-l*-h;b.z=i*m+c*-h+l*-g-j*-e;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};

+ 1 - 1
build/custom/ThreeDOM.js

@@ -72,7 +72,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,k=this.w,m=k*c+g*e-h*d,j=k*d+h*c-f*e,i=k*e+f*d-g*c,c=-f*
 this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,k=this.w,m=k*c+g*e-h*d,j=k*d+h*c-f*e,i=k*e+f*d-g*c,c=-f*
 c-g*d-h*e;b.x=m*k+c*-f+j*-h-i*-g;b.y=j*k+c*-g+i*-f-m*-h;b.z=i*k+c*-h+m*-g-j*-f;return b}};
 c-g*d-h*e;b.x=m*k+c*-f+j*-h-i*-g;b.y=j*k+c*-g+i*-f-m*-h;b.z=i*k+c*-h+m*-g-j*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};

+ 100 - 100
build/custom/ThreeExtras.js

@@ -1,19 +1,19 @@
 // ThreeExtras.js r46dev - http://github.com/mrdoob/three.js
 // ThreeExtras.js r46dev - http://github.com/mrdoob/three.js
 THREE.ColorUtils={adjustHSV:function(a,c,b,d){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.Math.clamp(g.h+c,0,1);g.s=THREE.Math.clamp(g.s+b,0,1);g.v=THREE.Math.clamp(g.v+d,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,g=a.b,f=Math.max(Math.max(b,d),g),e=Math.min(Math.min(b,d),g);if(e===f)e=b=0;else{var h=f-e,e=h/f,b=b===f?(d-g)/h:d===f?2+(g-b)/h:4+(b-d)/h;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=e;c.v=f;return c}};
 THREE.ColorUtils={adjustHSV:function(a,c,b,d){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.Math.clamp(g.h+c,0,1);g.s=THREE.Math.clamp(g.s+b,0,1);g.v=THREE.Math.clamp(g.v+d,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,g=a.b,f=Math.max(Math.max(b,d),g),e=Math.min(Math.min(b,d),g);if(e===f)e=b=0;else{var h=f-e,e=h/f,b=b===f?(d-g)/h:d===f?2+(g-b)/h:4+(b-d)/h;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=e;c.v=f;return c}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,e=a.vertices,h=f.vertices,i=a.faces,k=f.faces,j=a.faceVertexUvs[0],q=f.faceVertexUvs[0],o={},l=0;l<a.materials.length;l++)o[a.materials[l].id]=l;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var l=0,s=h.length;l<s;l++){var m=new THREE.Vertex(h[l].position.clone());b&&b.multiplyVector3(m.position);e.push(m)}l=
-0;for(s=k.length;l<s;l++){var e=k[l],p,n,r=e.vertexNormals,t=e.vertexColors;e instanceof THREE.Face3?p=new THREE.Face3(e.a+g,e.b+g,e.c+g):e instanceof THREE.Face4&&(p=new THREE.Face4(e.a+g,e.b+g,e.c+g,e.d+g));p.normal.copy(e.normal);d&&d.multiplyVector3(p.normal);h=0;for(m=r.length;h<m;h++)n=r[h].clone(),d&&d.multiplyVector3(n),p.vertexNormals.push(n);p.color.copy(e.color);h=0;for(m=t.length;h<m;h++)n=t[h],p.vertexColors.push(n.clone());if(e.materialIndex!==void 0){h=f.materials[e.materialIndex];
-m=o[h.id];if(m===void 0)m=a.materials.length,a.materials.push(h);p.materialIndex=m}p.centroid.copy(e.centroid);b&&b.multiplyVector3(p.centroid);i.push(p)}l=0;for(s=q.length;l<s;l++){b=q[l];d=[];h=0;for(m=b.length;h<m;h++)d.push(new THREE.UV(b[h].u,b[h].v));j.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var e=new THREE.Vertex(d[a].position.clone());c.vertices.push(e)}a=0;
+THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,e=a.vertices,h=f.vertices,i=a.faces,k=f.faces,j=a.faceVertexUvs[0],q=f.faceVertexUvs[0],o={},n=0;n<a.materials.length;n++)o[a.materials[n].id]=n;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var n=0,s=h.length;n<s;n++){var m=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(m.position);e.push(m)}n=
+0;for(s=k.length;n<s;n++){var e=k[n],p,l,r=e.vertexNormals,t=e.vertexColors;e instanceof THREE.Face3?p=new THREE.Face3(e.a+g,e.b+g,e.c+g):e instanceof THREE.Face4&&(p=new THREE.Face4(e.a+g,e.b+g,e.c+g,e.d+g));p.normal.copy(e.normal);d&&d.multiplyVector3(p.normal);h=0;for(m=r.length;h<m;h++)l=r[h].clone(),d&&d.multiplyVector3(l),p.vertexNormals.push(l);p.color.copy(e.color);h=0;for(m=t.length;h<m;h++)l=t[h],p.vertexColors.push(l.clone());if(e.materialIndex!==void 0){h=f.materials[e.materialIndex];
+m=o[h.id];if(m===void 0)m=a.materials.length,a.materials.push(h);p.materialIndex=m}p.centroid.copy(e.centroid);b&&b.multiplyVector3(p.centroid);i.push(p)}n=0;for(s=q.length;n<s;n++){b=q[n];d=[];h=0;for(m=b.length;h<m;h++)d.push(new THREE.UV(b[h].u,b[h].v));j.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var e=new THREE.Vertex(d[a].position.clone());c.vertices.push(e)}a=0;
 for(b=g.length;a<b;a++){var h=g[a],i,k,j=h.vertexNormals,q=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(e=j.length;d<e;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(e=q.length;d<e;d++)k=q[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=f.length;a<b;a++){g=f[a];i=[];d=0;for(e=g.length;d<
 for(b=g.length;a<b;a++){var h=g[a],i,k,j=h.vertexNormals,q=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(e=j.length;d<e;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(e=q.length;d<e;d++)k=q[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=f.length;a<b;a++){g=f[a];i=[];d=0;for(e=g.length;d<
 e;d++)i.push(new THREE.UV(g[d].u,g[d].v));c.faceVertexUvs[0].push(i)}return c},randomPointInTriangle:function(a,c,b){var d,g,f,e=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();d+g>1&&(d=1-d,g=1-g);f=1-d-g;e.copy(a);e.multiplyScalar(d);h.copy(c);h.multiplyScalar(g);e.addSelf(h);h.copy(b);h.multiplyScalar(f);e.addSelf(h);return e},randomPointInFace:function(a,c,b){var d,g,f;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,g=c.vertices[a.b].position,
 e;d++)i.push(new THREE.UV(g[d].u,g[d].v));c.faceVertexUvs[0].push(i)}return c},randomPointInTriangle:function(a,c,b){var d,g,f,e=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();d+g>1&&(d=1-d,g=1-g);f=1-d-g;e.copy(a);e.multiplyScalar(d);h.copy(c);h.multiplyScalar(g);e.addSelf(h);h.copy(b);h.multiplyScalar(f);e.addSelf(h);return e},randomPointInFace:function(a,c,b){var d,g,f;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,g=c.vertices[a.b].position,
 f=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,g,f);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;g=c.vertices[a.b].position;f=c.vertices[a.c].position;var c=c.vertices[a.d].position,e;b?a._area1&&a._area2?(b=a._area1,e=a._area2):(b=THREE.GeometryUtils.triangleArea(d,g,c),e=THREE.GeometryUtils.triangleArea(g,f,c),a._area1=b,a._area2=e):(b=THREE.GeometryUtils.triangleArea(d,g,c),e=THREE.GeometryUtils.triangleArea(g,f,c));return THREE.GeometryUtils.random()*(b+
 f=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,g,f);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;g=c.vertices[a.b].position;f=c.vertices[a.c].position;var c=c.vertices[a.d].position,e;b?a._area1&&a._area2?(b=a._area1,e=a._area2):(b=THREE.GeometryUtils.triangleArea(d,g,c),e=THREE.GeometryUtils.triangleArea(g,f,c),a._area1=b,a._area2=e):(b=THREE.GeometryUtils.triangleArea(d,g,c),e=THREE.GeometryUtils.triangleArea(g,f,c));return THREE.GeometryUtils.random()*(b+
-e)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,f,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(d,c){if(c<d)return d;var e=d+Math.floor((c-d)/2);return k[e]>a?b(d,e-1):k[e]<a?b(e+1,c):e}return b(0,k.length-1)}var d,g,f=a.faces,e=a.vertices,h=f.length,i=0,k=[],j,q,o,l;for(g=0;g<h;g++){d=f[g];if(d instanceof THREE.Face3)j=e[d.a].position,q=e[d.b].position,o=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,q,o);else if(d instanceof
-THREE.Face4)j=e[d.a].position,q=e[d.b].position,o=e[d.c].position,l=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,q,l),d._area2=THREE.GeometryUtils.triangleArea(q,o,l),d._area=d._area1+d._area2;i+=d._area;k[g]=i}d=[];e={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(f[h],a,!0),e[h]?e[h]+=1:e[h]=1;return d},triangleArea:function(a,c,b){var d,g=THREE.GeometryUtils.__v1;g.sub(a,c);d=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
+e)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,f,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(d,c){if(c<d)return d;var e=d+Math.floor((c-d)/2);return k[e]>a?b(d,e-1):k[e]<a?b(e+1,c):e}return b(0,k.length-1)}var d,g,f=a.faces,e=a.vertices,h=f.length,i=0,k=[],j,q,o,n;for(g=0;g<h;g++){d=f[g];if(d instanceof THREE.Face3)j=e[d.a].position,q=e[d.b].position,o=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,q,o);else if(d instanceof
+THREE.Face4)j=e[d.a].position,q=e[d.b].position,o=e[d.c].position,n=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,q,n),d._area2=THREE.GeometryUtils.triangleArea(q,o,n),d._area=d._area1+d._area2;i+=d._area;k[g]=i}d=[];e={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(f[h],a,!0),e[h]?e[h]+=1:e[h]=1;return d},triangleArea:function(a,c,b){var d,g=THREE.GeometryUtils.__v1;g.sub(a,c);d=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
 c=0.5*(d+a+b);return Math.sqrt(c*(c-d)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 c=0.5*(d+a+b);return Math.sqrt(c*(c-d)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,c,b){var d=new Image,g=new THREE.Texture(d,c);d.onload=function(){g.needsUpdate=!0;b&&b(this)};d.crossOrigin="";d.src=a;return g},loadTextureCube:function(a,c,b){var d,g=[],f=new THREE.Texture(g,c),c=g.loadCount=0;for(d=a.length;c<d;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount===6)f.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return f},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
 THREE.ImageUtils={loadTexture:function(a,c,b){var d=new Image,g=new THREE.Texture(d,c);d.onload=function(){g.needsUpdate=!0;b&&b(this)};d.crossOrigin="";d.src=a;return g},loadTextureCube:function(a,c,b){var d,g=[],f=new THREE.Texture(g,c),c=g.loadCount=0;for(d=a.length;c<d;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount===6)f.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return f},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,g=a.height,f=document.createElement("canvas");f.width=d;f.height=g;var e=f.getContext("2d");e.drawImage(a,0,0);for(var h=e.getImageData(0,0,d,g).data,i=e.createImageData(d,g),k=i.data,j=0;j<d;j++)for(var q=1;q<g;q++){var o=q-1<0?g-1:q-1,l=(q+1)%g,s=j-1<0?d-1:j-1,m=(j+1)%d,p=[],n=[0,0,h[(q*d+j)*4]/255*c];p.push([-1,0,h[(q*d+s)*4]/255*c]);p.push([-1,-1,h[(o*d+s)*4]/255*c]);p.push([0,-1,h[(o*d+j)*4]/255*c]);p.push([1,-1,h[(o*d+m)*4]/255*c]);
-p.push([1,0,h[(q*d+m)*4]/255*c]);p.push([1,1,h[(l*d+m)*4]/255*c]);p.push([0,1,h[(l*d+j)*4]/255*c]);p.push([-1,1,h[(l*d+s)*4]/255*c]);o=[];s=p.length;for(l=0;l<s;l++){var m=p[l],r=p[(l+1)%s],m=[m[0]-n[0],m[1]-n[1],m[2]-n[2]],r=[r[0]-n[0],r[1]-n[1],r[2]-n[2]];o.push(b([m[1]*r[2]-m[2]*r[1],m[2]*r[0]-m[0]*r[2],m[0]*r[1]-m[1]*r[0]]))}p=[0,0,0];for(l=0;l<o.length;l++)p[0]+=o[l][0],p[1]+=o[l][1],p[2]+=o[l][2];p[0]/=o.length;p[1]/=o.length;p[2]/=o.length;n=(q*d+j)*4;k[n]=(p[0]+1)/2*255|0;k[n+1]=(p[1]+0.5)*
-255|0;k[n+2]=p[2]*255|0;k[n+3]=255}e.putImageData(i,0,0);return f}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var f=new THREE.Mesh(a,c[b]);g.add(f)}return g}};
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,g=a.height,f=document.createElement("canvas");f.width=d;f.height=g;var e=f.getContext("2d");e.drawImage(a,0,0);for(var h=e.getImageData(0,0,d,g).data,i=e.createImageData(d,g),k=i.data,j=0;j<d;j++)for(var q=1;q<g;q++){var o=q-1<0?g-1:q-1,n=(q+1)%g,s=j-1<0?d-1:j-1,m=(j+1)%d,p=[],l=[0,0,h[(q*d+j)*4]/255*c];p.push([-1,0,h[(q*d+s)*4]/255*c]);p.push([-1,-1,h[(o*d+s)*4]/255*c]);p.push([0,-1,h[(o*d+j)*4]/255*c]);p.push([1,-1,h[(o*d+m)*4]/255*c]);
+p.push([1,0,h[(q*d+m)*4]/255*c]);p.push([1,1,h[(n*d+m)*4]/255*c]);p.push([0,1,h[(n*d+j)*4]/255*c]);p.push([-1,1,h[(n*d+s)*4]/255*c]);o=[];s=p.length;for(n=0;n<s;n++){var m=p[n],r=p[(n+1)%s],m=[m[0]-l[0],m[1]-l[1],m[2]-l[2]],r=[r[0]-l[0],r[1]-l[1],r[2]-l[2]];o.push(b([m[1]*r[2]-m[2]*r[1],m[2]*r[0]-m[0]*r[2],m[0]*r[1]-m[1]*r[0]]))}p=[0,0,0];for(n=0;n<o.length;n++)p[0]+=o[n][0],p[1]+=o[n][1],p[2]+=o[n][2];p[0]/=o.length;p[1]/=o.length;p[2]/=o.length;l=(q*d+j)*4;k[l]=(p[0]+1)/2*255|0;k[l+1]=(p[1]+0.5)*
+255|0;k[l+2]=p[2]*255|0;k[l+3]=255}e.putImageData(i,0,0);return f}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var f=new THREE.Mesh(a,c[b]);g.add(f)}return g}};
 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}",
 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}"},
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
@@ -52,9 +52,9 @@ THREE.Path.prototype.quadraticCurveTo=function(a,c,b,d){var g=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,c,b,d,g,f){var e=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d),new THREE.Vector2(g,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e})};
 THREE.Path.prototype.bezierCurveTo=function(a,c,b,d,g,f){var e=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d),new THREE.Vector2(g,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e})};
 THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
 THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
 THREE.Path.prototype.arc=function(a,c,b,d,g,f){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,d,g,f));this.actions.push({action:THREE.PathActions.ARC,args:e})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
 THREE.Path.prototype.arc=function(a,c,b,d,g,f){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,d,g,f));this.actions.push({action:THREE.PathActions.ARC,args:e})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,f,e,h,i,k,j,q,o,l,s,m;d=0;for(g=this.actions.length;d<g;d++)switch(f=this.actions[d],e=f.action,f=f.args,e){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];q=f[0];o=f[1];b.length>0?(e=b[b.length-1],l=e.x,s=e.y):(e=this.actions[d-1].args,l=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,f=THREE.Shape.Utils.b2(m,l,q,h),m=THREE.Shape.Utils.b2(m,s,o,
-i),b.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];q=f[0];o=f[1];k=f[2];j=f[3];b.length>0?(e=b[b.length-1],l=e.x,s=e.y):(e=this.actions[d-1].args,l=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,f=THREE.Shape.Utils.b3(m,l,q,k,h),m=THREE.Shape.Utils.b3(m,s,o,j,i),b.push(new THREE.Vector2(f,m));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];m=a*f[0].length;e=e.concat(f[0]);f=new THREE.SplineCurve(e);
-for(e=1;e<=m;e++)b.push(f.getPointAt(e/m));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=f[0];i=f[1];k=f[2];q=f[3];m=f[4];o=!!f[5];j=e[e.length-2];l=e[e.length-1];e.length==0&&(j=l=0);s=m-q;var p=a*2;for(e=1;e<=p;e++)m=e/p,o||(m=1-m),m=q+m*s,f=j+h+k*Math.cos(m),m=l+i+k*Math.sin(m),b.push(new THREE.Vector2(f,m))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,f,e,h,i,k,j,q,o,n,s,m;d=0;for(g=this.actions.length;d<g;d++)switch(f=this.actions[d],e=f.action,f=f.args,e){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];q=f[0];o=f[1];b.length>0?(e=b[b.length-1],n=e.x,s=e.y):(e=this.actions[d-1].args,n=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,f=THREE.Shape.Utils.b2(m,n,q,h),m=THREE.Shape.Utils.b2(m,s,o,
+i),b.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];q=f[0];o=f[1];k=f[2];j=f[3];b.length>0?(e=b[b.length-1],n=e.x,s=e.y):(e=this.actions[d-1].args,n=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,f=THREE.Shape.Utils.b3(m,n,q,k,h),m=THREE.Shape.Utils.b3(m,s,o,j,i),b.push(new THREE.Vector2(f,m));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];m=a*f[0].length;e=e.concat(f[0]);f=new THREE.SplineCurve(e);
+for(e=1;e<=m;e++)b.push(f.getPointAt(e/m));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=f[0];i=f[1];k=f[2];q=f[3];m=f[4];o=!!f[5];j=e[e.length-2];n=e[e.length-1];e.length==0&&(j=n=0);s=m-q;var p=a*2;for(e=1;e<=p;e++)m=e/p,o||(m=1-m),m=q+m*s,f=j+h+k*Math.cos(m),m=n+i+k*Math.sin(m),b.push(new THREE.Vector2(f,m))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
 THREE.Path.prototype.nltransform=function(a,c,b,d,g,f){var e=this.getPoints(),h,i,k,j,q;h=0;for(i=e.length;h<i;h++)k=e[h],j=k.x,q=k.y,k.x=a*j+c*q+b,k.y=d*q+g*j+f;return e};
 THREE.Path.prototype.nltransform=function(a,c,b,d,g,f){var e=this.getPoints(),h,i,k,j,q;h=0;for(i=e.length;h<i;h++)k=e[h],j=k.x,q=k.y,k.x=a*j+c*q+b,k.y=d*q+g*j+f;return e};
 THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,d,g,a=0;for(b=this.actions.length;a<b;a++)d=this.actions[a],g=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&c[d].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";d=
 THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,d,g,a=0;for(b=this.actions.length;a<b;a++)d=this.actions[a],g=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&c[d].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";d=
 this.getPoints();a=0;for(b=d.length;a<b;a++)g=d[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
 this.getPoints();a=0;for(b=d.length;a<b;a++)g=d[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
@@ -62,8 +62,8 @@ THREE.Path.prototype.toShapes=function(){var a,c,b,d,g=[],f=new THREE.Path;a=0;f
 d.curves):e.holes.push(d);f.push(e)}else{e=new THREE.Shape;a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e.actions=d.actions,e.curves=d.curves,f.push(e),e=new THREE.Shape):e.holes.push(d)}return f};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 d.curves):e.holes.push(d);f.push(e)}else{e=new THREE.Shape;a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e.actions=d.actions,e.curves=d.curves,f.push(e),e=new THREE.Shape):e.holes.push(d)}return f};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,f,e,h,i,k,j,q,o,l,s=[];for(i=0;i<c.length;i++){k=c[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(g=0;g<k.length;g++){o=k[g];l=[];for(q=0;q<b.length;q++)j=b[q],j=o.distanceToSquared(j),l.push(j),j<f&&(f=j,e=g,h=q)}g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;var m=[k[e],b[h],b[g]];q=THREE.FontUtils.Triangulate.area(m);var p=[k[e],k[f],b[h]];o=THREE.FontUtils.Triangulate.area(p);l=h;j=e;h+=1;e+=-1;h<
-0&&(h+=b.length);h%=b.length;e<0&&(e+=k.length);e%=k.length;g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;m=[k[e],b[h],b[g]];m=THREE.FontUtils.Triangulate.area(m);p=[k[e],k[f],b[h]];p=THREE.FontUtils.Triangulate.area(p);q+o>m+p&&(h=l,e=j,h<0&&(h+=b.length),h%=b.length,e<0&&(e+=k.length),e%=k.length,g=h-1>=0?h-1:b.length-1,f=e-1>=0?e-1:k.length-1);q=b.slice(0,h);o=b.slice(h);l=k.slice(e);j=k.slice(0,e);f=[k[e],k[f],b[h]];s.push([k[e],b[h],b[g]]);s.push(f);b=q.concat(l).concat(j).concat(o)}return{shape:b,
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,f,e,h,i,k,j,q,o,n,s=[];for(i=0;i<c.length;i++){k=c[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(g=0;g<k.length;g++){o=k[g];n=[];for(q=0;q<b.length;q++)j=b[q],j=o.distanceToSquared(j),n.push(j),j<f&&(f=j,e=g,h=q)}g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;var m=[k[e],b[h],b[g]];q=THREE.FontUtils.Triangulate.area(m);var p=[k[e],k[f],b[h]];o=THREE.FontUtils.Triangulate.area(p);n=h;j=e;h+=1;e+=-1;h<
+0&&(h+=b.length);h%=b.length;e<0&&(e+=k.length);e%=k.length;g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;m=[k[e],b[h],b[g]];m=THREE.FontUtils.Triangulate.area(m);p=[k[e],k[f],b[h]];p=THREE.FontUtils.Triangulate.area(p);q+o>m+p&&(h=n,e=j,h<0&&(h+=b.length),h%=b.length,e<0&&(e+=k.length),e%=k.length,g=h-1>=0?h-1:b.length-1,f=e-1>=0?e-1:k.length-1);q=b.slice(0,h);o=b.slice(h);n=k.slice(e);j=k.slice(0,e);f=[k[e],k[f],b[h]];s.push([k[e],b[h],b[g]]);s.push(f);b=q.concat(n).concat(j).concat(o)}return{shape:b,
 isolatedPts:s,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,e,h,i,k={};f=0;for(e=d.length;f<e;f++)i=d[f].x+":"+d[f].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=f;f=0;for(e=b.length;f<e;f++){h=b[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}f=0;for(e=g.length;f<e;f++){h=g[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}return b.concat(g)},
 isolatedPts:s,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,e,h,i,k={};f=0;for(e=d.length;f<e;f++)i=d[f].x+":"+d[f].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=f;f=0;for(e=b.length;f<e;f++){h=b[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}f=0;for(e=g.length;f<e;f++){h=g[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}return b.concat(g)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,d){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,d)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,d,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,d)+
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,d){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,d)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,d,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,d)+
 this.b3p3(a,g)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,d=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",f=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=d;THREE.FontUtils.weight=g;THREE.FontUtils.style=f};
 this.b3p3(a,g)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,d=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",f=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=d;THREE.FontUtils.weight=g;THREE.FontUtils.style=f};
@@ -77,11 +77,11 @@ THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=
 THREE.Bone?g.skinMatrix:g.matrix;var f=g.animationCache.prevKey;g=g.animationCache.nextKey;f.pos=this.data.hierarchy[b].keys[0];f.rot=this.data.hierarchy[b].keys[0];f.scl=this.data.hierarchy[b].keys[0];g.pos=this.getNextKeyWith("pos",b,1);g.rot=this.getNextKeyWith("rot",b,1);g.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Bone?g.skinMatrix:g.matrix;var f=g.animationCache.prevKey;g=g.animationCache.nextKey;f.pos=this.data.hierarchy[b].keys[0];f.rot=this.data.hierarchy[b].keys[0];f.scl=this.data.hierarchy[b].keys[0];g.pos=this.getNextKeyWith("pos",b,1);g.rot=this.getNextKeyWith("rot",b,1);g.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,g,f,e,h,i,k,j=this.data.JIT.hierarchy,q,o;this.currentTime+=a*this.timeScale;o=this.currentTime;q=this.currentTime%=this.data.length;k=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var l=0,s=this.hierarchy.length;l<s;l++)if(a=this.hierarchy[l],i=a.animationCache,this.JITCompile&&j[l][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[l][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=j[l][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;m<3;m++){b=c[m];e=i.prevKey[b];h=i.nextKey[b];if(h.time<=o){if(q<o)if(this.loop){e=this.data.hierarchy[l].keys[0];for(h=this.getNextKeyWith(b,l,1);h.time<q;)e=h,h=this.getNextKeyWith(b,l,h.index+1)}else{this.stop();return}else{do e=h,h=this.getNextKeyWith(b,l,h.index+1);while(h.time<
-q)}i.prevKey[b]=e;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(q-e.time)/(h.time-e.time);g=e[b];f=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+l),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",l,e.index-1).pos,this.points[1]=g,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",l,h.index+1).pos,d=d*0.33+0.33,g=this.interpolateCatmullRom(this.points,d),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(b===
-"rot")THREE.Quaternion.slerp(g,f,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d}}if(this.JITCompile&&j[0][k]===void 0){this.hierarchy[0].update(null,!0);for(l=0;l<this.hierarchy.length;l++)j[l][k]=this.hierarchy[l]instanceof THREE.Bone?this.hierarchy[l].skinMatrix.clone():this.hierarchy[l].matrix.clone()}}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,g,f,e,h,i,k,j=this.data.JIT.hierarchy,q,o;this.currentTime+=a*this.timeScale;o=this.currentTime;q=this.currentTime%=this.data.length;k=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,s=this.hierarchy.length;n<s;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&j[n][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=j[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;m<3;m++){b=c[m];e=i.prevKey[b];h=i.nextKey[b];if(h.time<=o){if(q<o)if(this.loop){e=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<q;)e=h,h=this.getNextKeyWith(b,n,h.index+1)}else{this.stop();return}else{do e=h,h=this.getNextKeyWith(b,n,h.index+1);while(h.time<
+q)}i.prevKey[b]=e;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(q-e.time)/(h.time-e.time);g=e[b];f=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",n,e.index-1).pos,this.points[1]=g,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=d*0.33+0.33,g=this.interpolateCatmullRom(this.points,d),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(b===
+"rot")THREE.Quaternion.slerp(g,f,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d}}if(this.JITCompile&&j[0][k]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)j[n][k]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,f,e,h,i,k;g=(a.length-1)*c;f=Math.floor(g);g-=f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];h=a[b[1]];i=a[b[2]];k=a[b[3]];b=g*g;e=g*b;d[0]=this.interpolate(f[0],h[0],i[0],k[0],g,b,e);d[1]=this.interpolate(f[1],h[1],i[1],k[1],g,b,e);d[2]=this.interpolate(f[2],h[2],i[2],k[2],g,b,e);return d};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,f,e,h,i,k;g=(a.length-1)*c;f=Math.floor(g);g-=f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];h=a[b[1]];i=a[b[2]];k=a[b[3]];b=g*g;e=g*b;d[0]=this.interpolate(f[0],h[0],i[0],k[0],g,b,e);d[1]=this.interpolate(f[1],h[1],i[1],k[1],g,b,e);d[2]=this.interpolate(f[2],h[2],i[2],k[2],g,b,e);return d};
 THREE.Animation.prototype.interpolate=function(a,c,b,d,g,f,e){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*e+(-3*(c-b)-2*a-d)*f+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<d.length-1?b:d.length-1:b%=d.length;b<d.length;b++)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.interpolate=function(a,c,b,d,g,f,e){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*e+(-3*(c-b)-2*a-d)*f+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<d.length-1?b:d.length-1:b%=d.length;b<d.length;b++)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var d=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var d=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
@@ -96,7 +96,7 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
 THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
-THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
+THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
@@ -104,16 +104,16 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);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;a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=
 this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);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;a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=
 1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*
 1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*
 Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
 Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),p=g.length,n=0;f=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:c,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<p-1;f++)n=c*h.chunks[f]/h.total,b.keys[f]={time:n,pos:g[f]};e.hierarchy[0]=
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),p=g.length,l=0;f=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:c,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<p-1;f++)l=c*h.chunks[f]/h.total,b.keys[f]={time:l,pos:g[f]};e.hierarchy[0]=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var d,c,e=new THREE.Geometry;for(d=0;d<a.points.length*b;d++)c=d/(a.points.length*b),c=a.getPoint(c),e.vertices[d]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var d,c,e=new THREE.Geometry;for(d=0;d<a.points.length*b;d++)c=d/(a.points.length*b),c=a.getPoint(c),e.vertices[d]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
-new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
+new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var e=Math.PI*2,h=Math.PI/180;this.update=function(a){var d;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%e;this.phi=a>=0?a:a+e;d=this.verticalAngleMap.srcRange;
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var e=Math.PI*2,h=Math.PI/180;this.update=function(a){var d;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%e;this.phi=a>=0?a:a+e;d=this.verticalAngleMap.srcRange;
 a=this.verticalAngleMap.dstRange;d=THREE.Math.mapLinear(this.phi,d[0],d[1],a[0],a[1]);var c=a[1]-a[0];this.phi=b((d-a[0])/c)*c+a[0];d=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;d=THREE.Math.mapLinear(this.theta,d[0],d[1],a[0],a[1]);c=a[1]-a[0];this.theta=b((d-a[0])/c)*c+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 a=this.verticalAngleMap.dstRange;d=THREE.Math.mapLinear(this.phi,d[0],d[1],a[0],a[1]);var c=a[1]-a[0];this.phi=b((d-a[0])/c)*c+a[0];d=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;d=THREE.Math.mapLinear(this.theta,d[0],d[1],a[0],a[1]);c=a[1]-a[0];this.theta=b((d-a[0])/c)*c+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),e=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(e,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 c=new THREE.CubeGeometry(10,10,20),e=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(e,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
-this.debugPath,b=this.spline,e=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));e.scale.set(1,1,1);a.add(e);c.scale.set(1,1,1);a.add(c);for(var e=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),l=0;l<b.points.length;l++)c=new THREE.Mesh(e,h),c.position.copy(b.points[l]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
+this.debugPath,b=this.spline,e=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));e.scale.set(1,1,1);a.add(e);c.scale.set(1,1,1);a.add(c);for(var e=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n<b.points.length;n++)c=new THREE.Mesh(e,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 !1)}};THREE.PathControlsIdCounter=0;
 !1)}};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
+THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
@@ -122,12 +122,12 @@ THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,argu
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
 this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Matrix4,e=!1,h=1,i=0,k=0,j=0,q=0,o=0,l=window.innerWidth/2,s=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Matrix4,e=!1,h=1,i=0,k=0,j=0,q=0,o=0,n=window.innerWidth/2,s=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
 this.rotateHorizontally(c*q);this.rotateVertically(c*o)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*k);this.object.translateY(c*j);e&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);d.set(0,1,0);b.cross(d,
 this.rotateHorizontally(c*q);this.rotateVertically(c*o)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*k);this.object.translateY(c*j);e&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);d.set(0,1,0);b.cross(d,
 g).normalize();d.cross(g,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=d.x;this.object.matrix.n13=g.x;this.object.matrix.n21=b.y;this.object.matrix.n22=d.y;this.object.matrix.n23=g.y;this.object.matrix.n31=b.z;this.object.matrix.n32=d.z;this.object.matrix.n33=g.z;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 g).normalize();d.cross(g,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=d.x;this.object.matrix.n13=g.x;this.object.matrix.n21=b.y;this.object.matrix.n22=d.y;this.object.matrix.n23=g.y;this.object.matrix.n31=b.z;this.object.matrix.n32=d.z;this.object.matrix.n33=g.z;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){q=(a.clientX-l)/window.innerWidth;o=(a.clientY-s)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){q=(a.clientX-n)/window.innerWidth;o=(a.clientY-s)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
 function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:e=!0;h=1;break;case 69:e=!0;h=-1;break;case 82:j=1;break;case 70:j=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:e=!1;break;case 69:e=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
 function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:e=!0;h=1;break;case 69:e=!0;h=-1;break;case 82:j=1;break;case 70:j=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:e=!1;break;case 69:e=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
 THREE.TrackballControls=function(a,c){var b=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
 THREE.TrackballControls=function(a,c){var b=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
 new THREE.Vector3(0,0,0);var g=!1,f=d.NONE,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,q=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
 new THREE.Vector3(0,0,0);var g=!1,f=d.NONE,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,q=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
@@ -137,28 +137,29 @@ b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?q=o:q.addSelf(a.
 b.panCamera();b.object.position.add(b.target,e);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=b.getMouseOnScreen(a.clientX,a.clientY),q=o=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),f!==d.NONE&&(f===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?j=b.getMouseOnScreen(a.clientX,
 b.panCamera();b.object.position.add(b.target,e);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=b.getMouseOnScreen(a.clientX,a.clientY),q=o=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),f!==d.NONE&&(f===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?j=b.getMouseOnScreen(a.clientX,
 a.clientY):f===d.PAN&&!b.noPan&&(o=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),f===d.NONE))f=a.button,f===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?k=j=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(q=o=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
 a.clientY):f===d.PAN&&!b.noPan&&(o=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),f===d.NONE))f=a.button,f===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?k=j=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(q=o=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
 f=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&f===d.NONE){if(a.keyCode===b.keys[d.ROTATE])f=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)f=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)f=d.PAN;f!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&f!==d.NONE)f=d.NONE},!1)};
 f=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&f===d.NONE){if(a.keyCode===b.keys[d.ROTATE])f=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)f=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)f=d.PAN;f!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&f!==d.NONE)f=d.NONE},!1)};
-THREE.CubeGeometry=function(a,c,b,d,g,f,e,h){function i(a,b,c,e,h,i,j,l){var m,o=d||1,n=g||1,q=h/2,p=i/2,s=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")m="y",n=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")m="x",o=f||1;var r=o+1,t=n+1,L=h/o,H=i/n,M=new THREE.Vector3;M[m]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<r;i++){var J=new THREE.Vector3;J[a]=(i*L-q)*c;J[b]=(h*H-p)*e;J[m]=j;k.vertices.push(new THREE.Vertex(J))}for(h=0;h<n;h++)for(i=0;i<o;i++)a=
-new THREE.Face4(i+r*h+s,i+r*(h+1)+s,i+1+r*(h+1)+s,i+1+r*h+s),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=l,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/o,h/n),new THREE.UV(i/o,(h+1)/n),new THREE.UV((i+1)/o,(h+1)/n),new THREE.UV((i+1)/o,h/n)])}THREE.Geometry.call(this);var k=this,j=a/2,q=c/2,o=b/2,l,s,m,p,n,r;if(e!==void 0){if(e instanceof Array)this.materials=e;else{this.materials=[];for(l=0;l<6;l++)this.materials.push(e)}l=0;p=1;s=2;n=
-3;m=4;r=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var t in h)this.sides[t]!=void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,b,c,j,l);this.sides.nx&&i("z","y",1,-1,b,c,-j,p);this.sides.py&&i("x","z",1,1,a,b,q,s);this.sides.ny&&i("x","z",1,-1,a,b,-q,n);this.sides.pz&&i("x","y",1,-1,a,c,o,m);this.sides.nz&&i("x","y",-1,-1,a,c,-o,r);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,c,b,d,g,f,e,h){function i(a,b,c,e,h,i,j,n){var m,o=d||1,l=g||1,p=h/2,q=i/2,s=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")m="y",l=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")m="x",o=f||1;var r=o+1,t=l+1,L=h/o,H=i/l,M=new THREE.Vector3;M[m]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<r;i++){var J=new THREE.Vector3;J[a]=(i*L-p)*c;J[b]=(h*H-q)*e;J[m]=j;k.vertices.push(new THREE.Vertex(J))}for(h=0;h<l;h++)for(i=0;i<o;i++)a=
+new THREE.Face4(i+r*h+s,i+r*(h+1)+s,i+1+r*(h+1)+s,i+1+r*h+s),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=n,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/o,h/l),new THREE.UV(i/o,(h+1)/l),new THREE.UV((i+1)/o,(h+1)/l),new THREE.UV((i+1)/o,h/l)])}THREE.Geometry.call(this);var k=this,j=a/2,q=c/2,o=b/2,n,s,m,p,l,r;if(e!==void 0){if(e instanceof Array)this.materials=e;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(e)}n=0;p=1;s=2;l=
+3;m=4;r=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var t in h)this.sides[t]!=void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,b,c,j,n);this.sides.nx&&i("z","y",1,-1,b,c,-j,p);this.sides.py&&i("x","z",1,1,a,b,q,s);this.sides.ny&&i("x","z",1,-1,a,b,-q,l);this.sides.pz&&i("x","y",1,-1,a,c,o,m);this.sides.nz&&i("x","y",-1,-1,a,c,-o,r);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,c,b,d,g,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,e=b/2,d=d||8,g=g||1,h,i,k=[],j=[];for(i=0;i<=g;i++){var q=[],o=[],l=i/g,s=l*(c-a)+a;for(h=0;h<=d;h++){var m=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(s*Math.sin(m*Math.PI*2),-l*b+e,s*Math.cos(m*Math.PI*2))));q.push(this.vertices.length-1);o.push(new THREE.UV(m,l))}k.push(q);j.push(o)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=k[i][h],q=k[i+1][h],o=k[i+1][h+1],l=k[i][h+1],s=
-this.vertices[b].position.clone().setY(0).normalize(),m=this.vertices[q].position.clone().setY(0).normalize(),p=this.vertices[o].position.clone().setY(0).normalize(),n=this.vertices[l].position.clone().setY(0).normalize(),r=j[i][h].clone(),t=j[i+1][h].clone(),w=j[i+1][h+1].clone(),z=j[i][h+1].clone();this.faces.push(new THREE.Face4(b,q,o,l,[s,m,p,n]));this.faceVertexUvs[0].push([r,t,w,z])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=0;h<d;h++)b=k[0][h],q=k[0][h+
+THREE.CylinderGeometry=function(a,c,b,d,g,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,e=b/2,d=d||8,g=g||1,h,i,k=[],j=[];for(i=0;i<=g;i++){var q=[],o=[],n=i/g,s=n*(c-a)+a;for(h=0;h<=d;h++){var m=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(s*Math.sin(m*Math.PI*2),-n*b+e,s*Math.cos(m*Math.PI*2))));q.push(this.vertices.length-1);o.push(new THREE.UV(m,n))}k.push(q);j.push(o)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=k[i][h],q=k[i+1][h],o=k[i+1][h+1],n=k[i][h+1],s=
+this.vertices[b].position.clone().setY(0).normalize(),m=this.vertices[q].position.clone().setY(0).normalize(),p=this.vertices[o].position.clone().setY(0).normalize(),l=this.vertices[n].position.clone().setY(0).normalize(),r=j[i][h].clone(),t=j[i+1][h].clone(),w=j[i+1][h+1].clone(),z=j[i][h+1].clone();this.faces.push(new THREE.Face4(b,q,o,n,[s,m,p,l]));this.faceVertexUvs[0].push([r,t,w,z])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=0;h<d;h++)b=k[0][h],q=k[0][h+
 1],o=this.vertices.length-1,s=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),r=j[0][h].clone(),t=j[0][h+1].clone(),w=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(b,q,o,[s,m,p])),this.faceVertexUvs[0].push([r,t,w])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)b=k[i][h+1],q=k[i][h],o=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),r=j[i][h+1].clone(),t=j[i][h].clone(),
 1],o=this.vertices.length-1,s=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),r=j[0][h].clone(),t=j[0][h+1].clone(),w=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(b,q,o,[s,m,p])),this.faceVertexUvs[0].push([r,t,w])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)b=k[i][h+1],q=k[i][h],o=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),r=j[i][h+1].clone(),t=j[i][h].clone(),
 w=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(b,q,o,[s,m,p])),this.faceVertexUvs[0].push([r,t,w])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 w=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(b,q,o,[s,m,p])),this.faceVertexUvs[0].push([r,t,w])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,d=a.length,g;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;b++)g=a[b],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,d=a.length,g;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;b++)g=a[b],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
 THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
 h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(u=a.length;--u>=0;){J=u;N=u-1;N<0&&(N=a.length-1);for(var b=
 h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(u=a.length;--u>=0;){J=u;N=u-1;N<0&&(N=a.length-1);for(var b=
-0,c=l+j*2,b=0;b<c;b++){var d=K*b,e=K*(b+1),f=Q+J+d,g=Q+J+e,k=f,d=Q+N+d,e=Q+N+e,m=g;k+=F;d+=F;e+=F;m+=F;A.faces.push(new THREE.Face4(k,d,e,m,null,null,w));w&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(A.vertices[f].position.z+i)/e,g=(A.vertices[g].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,b,c,null,
+0,c=n+j*2,b=0;b<c;b++){var d=K*b,e=K*(b+1),f=Q+J+d,g=Q+J+e,k=f,d=Q+N+d,e=Q+N+e,m=g;k+=F;d+=F;e+=F;m+=F;A.faces.push(new THREE.Face4(k,d,e,m,null,null,w));w&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(A.vertices[f].position.z+i)/e,g=(A.vertices[g].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,b,c,null,
 null,t));if(t){var d=z.maxY,e=z.maxX,f=A.vertices[b].position.x,b=A.vertices[b].position.y,g=A.vertices[c].position.x,c=A.vertices[c].position.y;A.faceVertexUvs[0].push([new THREE.UV(A.vertices[a].position.x/e,A.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,k=c.bevelSize!==void 0?c.bevelSize:i-2,j=c.bevelSegments!==void 0?c.bevelSegments:3,q=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.curveSegments!==
 null,t));if(t){var d=z.maxY,e=z.maxX,f=A.vertices[b].position.x,b=A.vertices[b].position.y,g=A.vertices[c].position.x,c=A.vertices[c].position.y;A.faceVertexUvs[0].push([new THREE.UV(A.vertices[a].position.x/e,A.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,k=c.bevelSize!==void 0?c.bevelSize:i-2,j=c.bevelSegments!==void 0?c.bevelSegments:3,q=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.curveSegments!==
-void 0?c.curveSegments:12,l=c.steps!==void 0?c.steps:1,s=c.bendPath,m=c.extrudePath,p,n=!1,r=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,t=c.material,w=c.extrudeMaterial,z=this.shapebb;if(m)p=m.getPoints(o),l=p.length,n=!0,q=!1;q||(k=i=j=0);var v,x,y,A=this,F=this.vertices.length;s&&a.addWrapPath(s);o=r?a.extractAllSpacedPoints(o):a.extractAllPoints(o);s=o.shape;o=o.holes;if(m=!THREE.Shape.Utils.isClockWise(s)){s=s.reverse();x=0;for(y=o.length;x<y;x++)v=o[x],THREE.Shape.Utils.isClockWise(v)&&
+void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,s=c.bendPath,m=c.extrudePath,p,l=!1,r=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,t=c.material,w=c.extrudeMaterial,z=this.shapebb;if(m)p=m.getPoints(o),n=p.length,l=!0,q=!1;q||(k=i=j=0);var v,x,y,A=this,F=this.vertices.length;s&&a.addWrapPath(s);o=r?a.extractAllSpacedPoints(o):a.extractAllPoints(o);s=o.shape;o=o.holes;if(m=!THREE.Shape.Utils.isClockWise(s)){s=s.reverse();x=0;for(y=o.length;x<y;x++)v=o[x],THREE.Shape.Utils.isClockWise(v)&&
 (o[x]=v.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(s,o);r=s;x=0;for(y=o.length;x<y;x++)v=o[x],s=s.concat(v);var u,D,B,G,I,E,K=s.length,O=m.length,C=[];u=0;D=r.length;J=D-1;for(N=u+1;u<D;u++,J++,N++)J===D&&(J=0),N===D&&(N=0),C[u]=d(r[u],r[J],r[N]);var L=[],H,M=C.concat();x=0;for(y=o.length;x<y;x++){v=o[x];H=[];u=0;D=v.length;J=D-1;for(N=u+1;u<D;u++,J++,N++)J===D&&(J=0),N===D&&(N=0),H[u]=d(v[u],v[J],v[N]);L.push(H);M=M.concat(H)}for(B=0;B<j;B++){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);u=
 (o[x]=v.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(s,o);r=s;x=0;for(y=o.length;x<y;x++)v=o[x],s=s.concat(v);var u,D,B,G,I,E,K=s.length,O=m.length,C=[];u=0;D=r.length;J=D-1;for(N=u+1;u<D;u++,J++,N++)J===D&&(J=0),N===D&&(N=0),C[u]=d(r[u],r[J],r[N]);var L=[],H,M=C.concat();x=0;for(y=o.length;x<y;x++){v=o[x];H=[];u=0;D=v.length;J=D-1;for(N=u+1;u<D;u++,J++,N++)J===D&&(J=0),N===D&&(N=0),H[u]=d(v[u],v[J],v[N]);L.push(H);M=M.concat(H)}for(B=0;B<j;B++){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);u=
-0;for(D=r.length;u<D;u++)E=b(r[u],C[u],G),f(E.x,E.y,-I);x=0;for(y=o.length;x<y;x++){v=o[x];H=L[x];u=0;for(D=v.length;u<D;u++)E=b(v[u],H[u],G),f(E.x,E.y,-I)}}G=k;for(u=0;u<K;u++)E=q?b(s[u],M[u],G):s[u],n?f(E.x,E.y+p[0].y,p[0].x):f(E.x,E.y,0);for(B=1;B<=l;B++)for(u=0;u<K;u++)E=q?b(s[u],M[u],G):s[u],n?f(E.x,E.y+p[B-1].y,p[B-1].x):f(E.x,E.y,h/l*B);for(B=j-1;B>=0;B--){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);u=0;for(D=r.length;u<D;u++)E=b(r[u],C[u],G),f(E.x,E.y,h+I);x=0;for(y=o.length;x<y;x++){v=o[x];
-H=L[x];u=0;for(D=v.length;u<D;u++)E=b(v[u],H[u],G),n?f(E.x,E.y+p[l-1].y,p[l-1].x+I):f(E.x,E.y,h+I)}}if(q){q=K*0;for(u=0;u<O;u++)k=m[u],e(k[2]+q,k[1]+q,k[0]+q);q=K*(l+j*2);for(u=0;u<O;u++)k=m[u],e(k[0]+q,k[1]+q,k[2]+q)}else{for(u=0;u<O;u++)k=m[u],e(k[2],k[1],k[0]);for(u=0;u<O;u++)k=m[u],e(k[0]+K*l,k[1]+K*l,k[2]+K*l)}var J,N,Q=0;g(r);Q+=r.length;x=0;for(y=o.length;x<y;x++)v=o[x],g(v),Q+=v.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+0;for(D=r.length;u<D;u++)E=b(r[u],C[u],G),f(E.x,E.y,-I);x=0;for(y=o.length;x<y;x++){v=o[x];H=L[x];u=0;for(D=v.length;u<D;u++)E=b(v[u],H[u],G),f(E.x,E.y,-I)}}G=k;for(u=0;u<K;u++)E=q?b(s[u],M[u],G):s[u],l?f(E.x,E.y+p[0].y,p[0].x):f(E.x,E.y,0);for(B=1;B<=n;B++)for(u=0;u<K;u++)E=q?b(s[u],M[u],G):s[u],l?f(E.x,E.y+p[B-1].y,p[B-1].x):f(E.x,E.y,h/n*B);for(B=j-1;B>=0;B--){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);u=0;for(D=r.length;u<D;u++)E=b(r[u],C[u],G),f(E.x,E.y,h+I);x=0;for(y=o.length;x<y;x++){v=o[x];
+H=L[x];u=0;for(D=v.length;u<D;u++)E=b(v[u],H[u],G),l?f(E.x,E.y+p[n-1].y,p[n-1].x+I):f(E.x,E.y,h+I)}}if(q){q=K*0;for(u=0;u<O;u++)k=m[u],e(k[2]+q,k[1]+q,k[0]+q);q=K*(n+j*2);for(u=0;u<O;u++)k=m[u],e(k[0]+q,k[1]+q,k[2]+q)}else{for(u=0;u<O;u++)k=m[u],e(k[2],k[1],k[0]);for(u=0;u<O;u++)k=m[u],e(k[0]+K*n,k[1]+K*n,k[2]+K*n)}var J,N,Q=0;g(r);Q+=r.length;x=0;for(y=o.length;x<y;x++)v=o[x],g(v),Q+=v.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.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
-THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=g.vertices[a].position,e=g.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var g=this,f=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
--a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var e=0;e<this.subdivisions;e++){var a=new THREE.Geometry,h;for(h in f.faces){var i=d(f.faces[h].a,f.faces[h].b),k=d(f.faces[h].b,f.faces[h].c),j=d(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,i,j,a);b(f.faces[h].b,k,
-i,a);b(f.faces[h].c,j,k,a);b(i,k,j,a)}f.faces=a.faces}g.faces=f.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],g=[],f=[],e=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=e.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),g[h]=this.vertices.length-1):g=f;i==0&&(f=d);
+THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){var e=g.vertices[a].position,f=g.vertices[b].position,h=g.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(e.clone().normalize(),f.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(e.z,e.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-e.y/2),new THREE.UV(1-
+(Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,b){var d=g.vertices[a].position,e=g.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var g=this,f=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,
+1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var e=0;e<this.subdivisions;e++){var a=new THREE.Geometry,h;for(h in f.faces){var i=d(f.faces[h].a,f.faces[h].b),k=d(f.faces[h].b,f.faces[h].c),j=d(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,i,j,a);b(f.faces[h].b,k,i,a);b(f.faces[h].c,j,k,a);b(i,k,j,a)}f.faces=a.faces;f.faceVertexUvs[0]=a.faceVertexUvs[0]}g.faces=
+f.faces;g.faceVertexUvs[0]=f.faceVertexUvs[0];this.computeCentroids();this.computeFaceNormals(!0)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],g=[],f=[],e=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.001;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=e.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),g[h]=this.vertices.length-1):g=f;i==0&&(f=d);
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(g[h],g[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(g[h],g[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=e.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=e.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
 e.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),e.faceVertexUvs[0].push([f(a.uv,a.position,h),f(b.uv,b.position,h),f(c.uv,c.position,h)])):(h-=1,d(a,g(a,b),g(a,c),h),d(g(a,b),b,g(b,c),h),d(g(a,c),g(b,c),c,h),d(g(a,b),g(b,c),g(a,c),h))}function g(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function f(a,b,c){c<0&&a.u===
 e.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),e.faceVertexUvs[0].push([f(a.uv,a.position,h),f(b.uv,b.position,h),f(c.uv,c.position,h)])):(h-=1,d(a,g(a,b),g(a,c),h),d(g(a,b),b,g(b,c),h),d(g(a,c),g(b,c),c,h),d(g(a,b),g(b,c),g(a,c),h))}function g(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function f(a,b,c){c<0&&a.u===
@@ -166,18 +167,17 @@ e.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),e.faceVertexUvs[0].push
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);for(var g=a/2,f=c/2,b=b||1,d=d||1,e=b+1,h=d+1,i=a/b,k=c/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(c=0;c<e;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*i-g,-(a*k-f),0)));for(a=0;a<d;a++)for(c=0;c<b;c++)g=new THREE.Face4(c+e*a,c+e*(a+1),c+1+e*(a+1),c+1+e*a),g.normal.copy(j),g.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.clone()),this.faces.push(g),this.faceVertexUvs[0].push([new THREE.UV(c/b,a/d),new THREE.UV(c/
 THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);for(var g=a/2,f=c/2,b=b||1,d=d||1,e=b+1,h=d+1,i=a/b,k=c/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(c=0;c<e;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*i-g,-(a*k-f),0)));for(a=0;a<d;a++)for(c=0;c<b;c++)g=new THREE.Face4(c+e*a,c+e*(a+1),c+1+e*(a+1),c+1+e*a),g.normal.copy(j),g.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.clone()),this.faces.push(g),this.faceVertexUvs[0].push([new THREE.UV(c/b,a/d),new THREE.UV(c/
 b,(a+1)/d),new THREE.UV((c+1)/b,(a+1)/d),new THREE.UV((c+1)/b,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
 b,(a+1)/d),new THREE.UV((c+1)/b,(a+1)/d),new THREE.UV((c+1)/b,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,g=Math.PI,f=Math.max(3,c||8),e=Math.max(2,b||6),c=[],b=0;b<e+1;b++){d=b/e;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),k=[],j=0;for(d=0;d<f;d++){var q=2*d/f,o=i*Math.sin(q*g),q=i*Math.cos(q*g);(b==0||b==e)&&d>0||(j=this.vertices.push(new THREE.Vertex(new THREE.Vector3(q,h,o)))-1);k.push(j)}c.push(k)}for(var l,s,m,g=c.length,b=0;b<g;b++)if(f=c[b].length,b>0)for(d=0;d<f;d++){k=d==f-1;e=c[b][k?0:d+1];h=c[b][k?f-1:d];i=c[b-1][k?
-f-1:d];k=c[b-1][k?0:d+1];o=b/(g-1);l=(b-1)/(g-1);s=(d+1)/f;var q=d/f,j=new THREE.UV(1-s,o),o=new THREE.UV(1-q,o),q=new THREE.UV(1-q,l),p=new THREE.UV(1-s,l);b<c.length-1&&(l=this.vertices[e].position.clone(),s=this.vertices[h].position.clone(),m=this.vertices[i].position.clone(),l.normalize(),s.normalize(),m.normalize(),this.faces.push(new THREE.Face3(e,h,i,[new THREE.Vector3(l.x,l.y,l.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(m.x,m.y,m.z)])),this.faceVertexUvs[0].push([j,o,q]));b>1&&(l=
-this.vertices[e].position.clone(),s=this.vertices[i].position.clone(),m=this.vertices[k].position.clone(),l.normalize(),s.normalize(),m.normalize(),this.faces.push(new THREE.Face3(e,i,k,[new THREE.Vector3(l.x,l.y,l.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(m.x,m.y,m.z)])),this.faceVertexUvs[0].push([j,q,p]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
-THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
+THREE.SphereGeometry=function(a,c,b,d,g,f,e){THREE.Geometry.call(this);var a=a||50,c=Math.max(3,Math.floor(c)||8),b=Math.max(2,Math.floor(b)||6),d=d!=void 0?d:0,g=g!=void 0?g:Math.PI*2,f=f!=void 0?f:0,e=e!=void 0?e:Math.PI,h,i,k=[],j=[];for(i=0;i<=b;i++){var q=[],o=[];for(h=0;h<=c;h++){var n=h/c,s=i/b;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+n*g)*Math.sin(f+s*e),a*Math.cos(f+s*e),a*Math.sin(d+n*g)*Math.sin(f+s*e))));q.push(this.vertices.length-1);o.push(new THREE.UV(n,s))}k.push(q);
+j.push(o)}for(i=0;i<b;i++)for(h=0;h<c;h++){var d=k[i][h+1],g=k[i][h],f=k[i+1][h],e=k[i+1][h+1],q=this.vertices[d].position.clone().normalize(),o=this.vertices[g].position.clone().normalize(),n=this.vertices[f].position.clone().normalize(),s=this.vertices[e].position.clone().normalize(),m=j[i][h+1].clone(),p=j[i][h].clone(),l=j[i+1][h].clone(),r=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,f,e,[q,n,s])),this.faceVertexUvs[0].push([m,l,r])):Math.abs(this.vertices[f].position.y)==
+a?(this.faces.push(new THREE.Face3(d,g,f,[q,o,n])),this.faceVertexUvs[0].push([m,p,l])):(this.faces.push(new THREE.Face4(d,g,f,e,[q,o,n,s])),this.faceVertexUvs[0].push([m,p,l,r]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var d=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var d=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 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]},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=this.getFace(),b=this.size/c.resolution,d=
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=this.getFace(),b=this.size/c.resolution,d=
-0,g=String(a).split(""),f=g.length,e=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;e.push(h.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var f=[],e,h,i,k,j,q,o,l,s,m,p,n=c.glyphs[a]||c.glyphs["?"];if(n){if(n.o){c=n._cachedOutline||(n._cachedOutline=n.o.split(" "));k=c.length;for(a=0;a<k;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;j=c[a++]*b;f.push(new THREE.Vector2(i,j));g.moveTo(i,j);break;case "l":i=c[a++]*b+d;j=c[a++]*b;f.push(new THREE.Vector2(i,
-j));g.lineTo(i,j);break;case "q":i=c[a++]*b+d;j=c[a++]*b;l=c[a++]*b+d;s=c[a++]*b;g.quadraticCurveTo(l,s,i,j);if(e=f[f.length-1]){q=e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++){var r=e/h,t=THREE.Shape.Utils.b2(r,q,l,i),r=THREE.Shape.Utils.b2(r,o,s,j);f.push(new THREE.Vector2(t,r))}}break;case "b":if(i=c[a++]*b+d,j=c[a++]*b,l=c[a++]*b+d,s=c[a++]*-b,m=c[a++]*b+d,p=c[a++]*-b,g.bezierCurveTo(i,j,l,s,m,p),e=f[f.length-1]){q=e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++)r=e/h,t=THREE.Shape.Utils.b3(r,q,l,
-m,i),r=THREE.Shape.Utils.b3(r,o,s,p,j),f.push(new THREE.Vector2(t,r))}}}return{offset:n.ha*b,points:f,path:g}}}};
-(function(a){var c=function(a){for(var c=a.length,g=0,f=c-1,e=0;e<c;f=e++)g+=a[f].x*a[e].y-a[e].x*a[f].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var f=[],e=[],h=[],i,k,j;if(c(a)>0)for(k=0;k<g;k++)e[k]=k;else for(k=0;k<g;k++)e[k]=g-1-k;var q=2*g;for(k=g-1;g>2;){if(q--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return f}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);j=k+1;g<=j&&(j=0);var o;a:{o=a;var l=i,s=k,m=j,p=g,n=e,r=void 0,t=void 0,w=void 0,
-z=void 0,v=void 0,x=void 0,y=void 0,A=void 0,F=void 0,t=o[n[l]].x,w=o[n[l]].y,z=o[n[s]].x,v=o[n[s]].y,x=o[n[m]].x,y=o[n[m]].y;if(1.0E-10>(z-t)*(y-w)-(v-w)*(x-t))o=!1;else{for(r=0;r<p;r++)if(!(r==l||r==s||r==m)){var A=o[n[r]].x,F=o[n[r]].y,u=void 0,D=void 0,B=void 0,G=void 0,I=void 0,E=void 0,K=void 0,O=void 0,C=void 0,L=void 0,H=void 0,M=void 0,u=B=I=void 0,u=x-z,D=y-v,B=t-x,G=w-y,I=z-t,E=v-w,K=A-t,O=F-w,C=A-z,L=F-v,H=A-x,M=F-y,u=u*L-D*C,I=I*O-E*K,B=B*M-G*H;if(u>=0&&B>=0&&I>=0){o=!1;break a}}o=!0}}if(o){f.push([a[e[i]],
+0,g=String(a).split(""),f=g.length,e=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;e.push(h.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var f=[],e,h,i,k,j,q,o,n,s,m,p,l=c.glyphs[a]||c.glyphs["?"];if(l){if(l.o){c=l._cachedOutline||(l._cachedOutline=l.o.split(" "));k=c.length;for(a=0;a<k;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;j=c[a++]*b;f.push(new THREE.Vector2(i,j));g.moveTo(i,j);break;case "l":i=c[a++]*b+d;j=c[a++]*b;f.push(new THREE.Vector2(i,
+j));g.lineTo(i,j);break;case "q":i=c[a++]*b+d;j=c[a++]*b;n=c[a++]*b+d;s=c[a++]*b;g.quadraticCurveTo(n,s,i,j);if(e=f[f.length-1]){q=e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++){var r=e/h,t=THREE.Shape.Utils.b2(r,q,n,i),r=THREE.Shape.Utils.b2(r,o,s,j);f.push(new THREE.Vector2(t,r))}}break;case "b":if(i=c[a++]*b+d,j=c[a++]*b,n=c[a++]*b+d,s=c[a++]*-b,m=c[a++]*b+d,p=c[a++]*-b,g.bezierCurveTo(i,j,n,s,m,p),e=f[f.length-1]){q=e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++)r=e/h,t=THREE.Shape.Utils.b3(r,q,n,
+m,i),r=THREE.Shape.Utils.b3(r,o,s,p,j),f.push(new THREE.Vector2(t,r))}}}return{offset:l.ha*b,points:f,path:g}}}};
+(function(a){var c=function(a){for(var c=a.length,g=0,f=c-1,e=0;e<c;f=e++)g+=a[f].x*a[e].y-a[e].x*a[f].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var f=[],e=[],h=[],i,k,j;if(c(a)>0)for(k=0;k<g;k++)e[k]=k;else for(k=0;k<g;k++)e[k]=g-1-k;var q=2*g;for(k=g-1;g>2;){if(q--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return f}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);j=k+1;g<=j&&(j=0);var o;a:{o=a;var n=i,s=k,m=j,p=g,l=e,r=void 0,t=void 0,w=void 0,
+z=void 0,v=void 0,x=void 0,y=void 0,A=void 0,F=void 0,t=o[l[n]].x,w=o[l[n]].y,z=o[l[s]].x,v=o[l[s]].y,x=o[l[m]].x,y=o[l[m]].y;if(1.0E-10>(z-t)*(y-w)-(v-w)*(x-t))o=!1;else{for(r=0;r<p;r++)if(!(r==n||r==s||r==m)){var A=o[l[r]].x,F=o[l[r]].y,u=void 0,D=void 0,B=void 0,G=void 0,I=void 0,E=void 0,K=void 0,O=void 0,C=void 0,L=void 0,H=void 0,M=void 0,u=B=I=void 0,u=x-z,D=y-v,B=t-x,G=w-y,I=z-t,E=v-w,K=A-t,O=F-w,C=A-z,L=F-v,H=A-x,M=F-y,u=u*L-D*C,I=I*O-E*K,B=B*M-G*H;if(u>=0&&B>=0&&I>=0){o=!1;break a}}o=!0}}if(o){f.push([a[e[i]],
 a[e[k]],a[e[j]]]);h.push([e[i],e[k],e[j]]);i=k;for(j=k+1;j<g;i++,j++)e[i]=e[j];g--;q=2*g}}if(d)return h;return f};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 a[e[k]],a[e[j]]]);h.push([e[i],e[k],e[j]]);i=k;for(j=k+1;j<g;i++,j++)e[i]=e[j];g--;q=2*g}}if(d)return h;return f};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,c,b,d,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,e=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(f);g.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(e))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(e))*Math.sin(f);h.z=
 THREE.TorusGeometry=function(a,c,b,d,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,e=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(f);g.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(e))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(e))*Math.sin(f);h.z=
 this.tube*Math.sin(e);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var g=(this.segmentsT+1)*b+d-1,f=(this.segmentsT+1)*(b-1)+d-1,e=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,f,e,h,[c[g],c[f],c[e],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[f]);i.normal.addSelf(c[e]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
 this.tube*Math.sin(e);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var g=(this.segmentsT+1)*b+d-1,f=(this.segmentsT+1)*(b-1)+d-1,e=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,f,e,h,[c[g],c[f],c[e],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[f]);i.normal.addSelf(c[e]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
@@ -186,13 +186,13 @@ THREE.TorusKnotGeometry=function(a,c,b,d,g,f,e){function h(a,b,c,d,e,f){b=c/d*a;
 this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,e=c/this.segmentsT*2*Math.PI,g=h(i,e,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,e,this.q,this.p,this.radius,this.heightScale);b.x=i.x-g.x;b.y=i.y-g.y;b.z=i.z-g.z;d.x=i.x+g.x;d.y=i.y+g.y;d.z=i.z+g.z;f.cross(b,d);d.cross(f,b);f.normalize();d.normalize();i=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);g.x+=i*d.x+e*f.x;g.y+=i*d.y+e*f.y;g.z+=i*d.z+e*f.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
 this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,e=c/this.segmentsT*2*Math.PI,g=h(i,e,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,e,this.q,this.p,this.radius,this.heightScale);b.x=i.x-g.x;b.y=i.y-g.y;b.z=i.z-g.z;d.x=i.x+g.x;d.y=i.y+g.y;d.z=i.z+g.z;f.cross(b,d);d.cross(f,b);f.normalize();d.normalize();i=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);g.x+=i*d.x+e*f.x;g.y+=i*d.y+e*f.y;g.z+=i*d.z+e*f.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
 g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][f],f=this.grid[a][f],e=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,f));this.faceVertexUvs[0].push([e,i,k,j])}this.computeCentroids();
 g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][f],f=this.grid[a][f],e=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,f));this.faceVertexUvs[0].push([e,i,k,j])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){j.vertexColors=[];for(var k,l,m,n=0;n<4;n++){m=i[n];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<m.length;p++)l=h.vertexColors[m[p]-1],k.r+=l.r,k.g+=l.g,k.b+=l.b;k.r/=m.length;k.g/=m.length;k.b/=m.length;j.vertexColors[n]=k}}g.push(j);(!e.supportUVs||o.length!=0)&&f.push([o[a],o[b],o[c],o[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],g=[],f=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},q={},o=[],l,s,m,p,n,r=a.faceVertexUvs[0];l=0;for(s=r.length;l<s;l++){m=0;for(p=r[l].length;m<p;m++)n=d[l]["abcd".charAt(m)],o[n]||(o[n]=r[l][m])}var t;l=0;for(s=d.length;l<s;l++)if(n=d[l],k.push(n.centroid),i.push(new THREE.Vertex(n.centroid)),e.supportUVs&&o.length!=0){t=new THREE.UV;if(n instanceof THREE.Face3)t.u=o[n.a].u+o[n.b].u+o[n.c].u,t.v=o[n.a].v+o[n.b].v+o[n.c].v,t.u/=3,t.v/=3;else if(n instanceof THREE.Face4)t.u=
-o[n.a].u+o[n.b].u+o[n.c].u+o[n.d].u,t.v=o[n.a].v+o[n.b].v+o[n.c].v+o[n.d].v,t.u/=4,t.v/=4;o.push(t)}s=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var w=0,r=h.length,z,v,x={},y={},A=function(a,
-b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},F=function(a,b){y[a]===void 0&&(y[a]={});y[a][b]=null};for(l in s){t=s[l];z=l.split("_");v=z[0];z=z[1];A(v,[v,z]);A(z,[v,z]);m=0;for(p=t.length;m<p;m++)n=t[m],F(v,n,l),F(z,n,l);t.length<2&&(q[l]=!0)}for(l in s)if(t=s[l],n=t[0],t=t[1],z=l.split("_"),v=z[0],z=z[1],p=new THREE.Vector3,q[l]?(p.addSelf(h[v].position),p.addSelf(h[z].position),p.multiplyScalar(0.5)):(p.addSelf(k[n]),p.addSelf(k[t]),p.addSelf(h[v].position),p.addSelf(h[z].position),p.multiplyScalar(0.25)),
-j[l]=r+d.length+w,i.push(new THREE.Vertex(p)),w++,e.supportUVs&&o.length!=0)t=new THREE.UV,t.u=o[v].u+o[z].u,t.v=o[v].v+o[z].v,t.u/=2,t.v/=2,o.push(t);var u,D;z=["123","12","2","23"];p=["123","23","3","31"];var A=["123","31","1","12"],F=["1234","12","2","23"],B=["1234","23","3","34"],G=["1234","34","4","41"],I=["1234","41","1","12"];l=0;for(s=k.length;l<s;l++)n=d[l],t=r+l,n instanceof THREE.Face3?(w=b(n.a,n.b),v=b(n.b,n.c),u=b(n.c,n.a),c(t,j[w],n.b,j[v],n,z),c(t,j[v],n.c,j[u],n,p),c(t,j[u],n.a,j[w],
-n,A)):n instanceof THREE.Face4?(w=b(n.a,n.b),v=b(n.b,n.c),u=b(n.c,n.d),D=b(n.d,n.a),c(t,j[w],n.b,j[v],n,F),c(t,j[v],n.c,j[u],n,B),c(t,j[u],n.d,j[D],n,G),c(t,j[D],n.a,j[w],n,I)):console.log("face should be a face!",n);d=i;i=new THREE.Vector3;j=new THREE.Vector3;l=0;for(s=h.length;l<s;l++)if(x[l]!==void 0){i.set(0,0,0);j.set(0,0,0);n=new THREE.Vector3(0,0,0);t=0;for(m in y[l])i.addSelf(k[m]),t++;w=0;r=x[l].length;for(m=0;m<r;m++)q[b(x[l][m][0],x[l][m][1])]&&w++;if(w!=2){i.divideScalar(t);for(m=0;m<
-r;m++)t=x[l][m],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(r);n.addSelf(h[l].position);n.multiplyScalar(r-3);n.addSelf(i);n.addSelf(j.multiplyScalar(2));n.divideScalar(r);d[l].position=n}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){j.vertexColors=[];for(var k,n,m,l=0;l<4;l++){m=i[l];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<m.length;p++)n=h.vertexColors[m[p]-1],k.r+=n.r,k.g+=n.g,k.b+=n.b;k.r/=m.length;k.g/=m.length;k.b/=m.length;j.vertexColors[l]=k}}g.push(j);(!e.supportUVs||o.length!=0)&&f.push([o[a],o[b],o[c],o[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],g=[],f=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},q={},o=[],n,s,m,p,l,r=a.faceVertexUvs[0];n=0;for(s=r.length;n<s;n++){m=0;for(p=r[n].length;m<p;m++)l=d[n]["abcd".charAt(m)],o[l]||(o[l]=r[n][m])}var t;n=0;for(s=d.length;n<s;n++)if(l=d[n],k.push(l.centroid),i.push(new THREE.Vertex(l.centroid)),e.supportUVs&&o.length!=0){t=new THREE.UV;if(l instanceof THREE.Face3)t.u=o[l.a].u+o[l.b].u+o[l.c].u,t.v=o[l.a].v+o[l.b].v+o[l.c].v,t.u/=3,t.v/=3;else if(l instanceof THREE.Face4)t.u=
+o[l.a].u+o[l.b].u+o[l.c].u+o[l.d].u,t.v=o[l.a].v+o[l.b].v+o[l.c].v+o[l.d].v,t.u/=4,t.v/=4;o.push(t)}s=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var w=0,r=h.length,z,v,x={},y={},A=function(a,
+b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},F=function(a,b){y[a]===void 0&&(y[a]={});y[a][b]=null};for(n in s){t=s[n];z=n.split("_");v=z[0];z=z[1];A(v,[v,z]);A(z,[v,z]);m=0;for(p=t.length;m<p;m++)l=t[m],F(v,l,n),F(z,l,n);t.length<2&&(q[n]=!0)}for(n in s)if(t=s[n],l=t[0],t=t[1],z=n.split("_"),v=z[0],z=z[1],p=new THREE.Vector3,q[n]?(p.addSelf(h[v].position),p.addSelf(h[z].position),p.multiplyScalar(0.5)):(p.addSelf(k[l]),p.addSelf(k[t]),p.addSelf(h[v].position),p.addSelf(h[z].position),p.multiplyScalar(0.25)),
+j[n]=r+d.length+w,i.push(new THREE.Vertex(p)),w++,e.supportUVs&&o.length!=0)t=new THREE.UV,t.u=o[v].u+o[z].u,t.v=o[v].v+o[z].v,t.u/=2,t.v/=2,o.push(t);var u,D;z=["123","12","2","23"];p=["123","23","3","31"];var A=["123","31","1","12"],F=["1234","12","2","23"],B=["1234","23","3","34"],G=["1234","34","4","41"],I=["1234","41","1","12"];n=0;for(s=k.length;n<s;n++)l=d[n],t=r+n,l instanceof THREE.Face3?(w=b(l.a,l.b),v=b(l.b,l.c),u=b(l.c,l.a),c(t,j[w],l.b,j[v],l,z),c(t,j[v],l.c,j[u],l,p),c(t,j[u],l.a,j[w],
+l,A)):l instanceof THREE.Face4?(w=b(l.a,l.b),v=b(l.b,l.c),u=b(l.c,l.d),D=b(l.d,l.a),c(t,j[w],l.b,j[v],l,F),c(t,j[v],l.c,j[u],l,B),c(t,j[u],l.d,j[D],l,G),c(t,j[D],l.a,j[w],l,I)):console.log("face should be a face!",l);d=i;i=new THREE.Vector3;j=new THREE.Vector3;n=0;for(s=h.length;n<s;n++)if(x[n]!==void 0){i.set(0,0,0);j.set(0,0,0);l=new THREE.Vector3(0,0,0);t=0;for(m in y[n])i.addSelf(k[m]),t++;w=0;r=x[n].length;for(m=0;m<r;m++)q[b(x[n][m][0],x[n][m][1])]&&w++;if(w!=2){i.divideScalar(t);for(m=0;m<
+r;m++)t=x[n][m],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(r);l.addSelf(h[n].position);l.multiplyScalar(r-3);l.addSelf(i);l.addSelf(j.multiplyScalar(2));l.divideScalar(r);d[n].position=l}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
@@ -209,27 +209,27 @@ THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g){var f=new XMLHt
 f.responseType="arraybuffer";f.send(null)};
 f.responseType="arraybuffer";f.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a){return a%4?4-a%4:0}function g(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function k(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=t[e*2];e=t[e*2+1];i=t[f*2];j=t[f*2+1];f=t[g*2];k=t[g*2+1];g=m.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,j));n.push(new THREE.UV(f,k));g.push(n)}}
 THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a){return a%4?4-a%4:0}function g(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function k(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=t[e*2];e=t[e*2+1];i=t[f*2];j=t[f*2+1];f=t[g*2];k=t[g*2+1];g=m.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,j));n.push(new THREE.UV(f,k));g.push(n)}}
 function j(b,c){var d,e,f,g,h,i,j,k,l,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[d*4];f=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=t[e*2];e=t[e*2+1];j=t[f*2];l=t[f*2+1];k=t[g*2];n=t[g*2+1];g=t[h*2];f=t[h*2+1];h=m.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(j,l));p.push(new THREE.UV(k,n));p.push(new THREE.UV(g,f));h.push(p)}}function q(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],m.faces.push(new THREE.Face3(e,
 function j(b,c){var d,e,f,g,h,i,j,k,l,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[d*4];f=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=t[e*2];e=t[e*2+1];j=t[f*2];l=t[f*2+1];k=t[g*2];n=t[g*2+1];g=t[h*2];f=t[h*2+1];h=m.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(j,l));p.push(new THREE.UV(k,n));p.push(new THREE.UV(g,f));h.push(p)}}function q(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],m.faces.push(new THREE.Face3(e,
-f,g,null,null,h))}function o(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],m.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function l(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=n[e];var o=r[k*3],p=r[k*3+1];k=r[k*3+2];var q=r[l*3],s=r[l*3+1];l=r[l*3+2];m.faces.push(new THREE.Face3(f,
+f,g,null,null,h))}function o(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],m.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function n(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=n[e];var o=r[k*3],p=r[k*3+1];k=r[k*3+2];var q=r[l*3],s=r[l*3+1];l=r[l*3+2];m.faces.push(new THREE.Face3(f,
 g,h,[new THREE.Vector3(r[j*3],r[j*3+1],r[j*3+2]),new THREE.Vector3(o,p,k),new THREE.Vector3(q,s,l)],null,i))}}function s(b,c,d,e){for(var f,g,h,i,j,k,l,n,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];n=d[e*4+2];o=d[e*4+3];j=p[e];var q=r[l*3],s=r[l*3+1];l=r[l*3+2];var t=r[n*3],v=r[n*3+1];n=r[n*3+2];var w=r[o*3],x=r[o*3+1];o=r[o*3+2];m.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(r[k*
 g,h,[new THREE.Vector3(r[j*3],r[j*3+1],r[j*3+2]),new THREE.Vector3(o,p,k),new THREE.Vector3(q,s,l)],null,i))}}function s(b,c,d,e){for(var f,g,h,i,j,k,l,n,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];n=d[e*4+2];o=d[e*4+3];j=p[e];var q=r[l*3],s=r[l*3+1];l=r[l*3+2];var t=r[n*3],v=r[n*3+1];n=r[n*3+2];var w=r[o*3],x=r[o*3+1];o=r[o*3+2];m.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(r[k*
-3],r[k*3+1],r[k*3+2]),new THREE.Vector3(q,s,l),new THREE.Vector3(t,v,n),new THREE.Vector3(w,x,o)],null,j))}}var m=this,p=0,n,r=[],t=[],w,z,v,x,y,A;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(m,d,b);n={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,p,12),header_bytes:g(a,p+12),vertex_coordinate_bytes:g(a,p+13),normal_coordinate_bytes:g(a,p+14),uv_coordinate_bytes:g(a,p+15),vertex_index_bytes:g(a,p+16),normal_index_bytes:g(a,
-p+17),uv_index_bytes:g(a,p+18),material_index_bytes:g(a,p+19),nvertices:i(a,p+20),nnormals:i(a,p+20+4),nuvs:i(a,p+20+8),ntri_flat:i(a,p+20+12),ntri_smooth:i(a,p+20+16),ntri_flat_uv:i(a,p+20+20),ntri_smooth_uv:i(a,p+20+24),nquad_flat:i(a,p+20+28),nquad_smooth:i(a,p+20+32),nquad_flat_uv:i(a,p+20+36),nquad_smooth_uv:i(a,p+20+40)};n.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");p+=n.header_bytes;b=n.vertex_index_bytes*3+n.material_index_bytes;A=n.vertex_index_bytes*
-4+n.material_index_bytes;w=n.ntri_flat*b;z=n.ntri_smooth*(b+n.normal_index_bytes*3);v=n.ntri_flat_uv*(b+n.uv_index_bytes*3);x=n.ntri_smooth_uv*(b+n.normal_index_bytes*3+n.uv_index_bytes*3);y=n.nquad_flat*A;b=n.nquad_smooth*(A+n.normal_index_bytes*4);A=n.nquad_flat_uv*(A+n.uv_index_bytes*4);p+=function(b){var c=n.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],m.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(p);
-p+=function(b){var c=n.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],r.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(p);p+=c(n.nnormals*3);p+=function(b){var c=n.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],t.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(p);w=p+w+c(n.ntri_flat*2);z=w+z+c(n.ntri_smooth*2);v=z+v+c(n.ntri_flat_uv*2);x=v+x+c(n.ntri_smooth_uv*2);y=x+y+c(n.nquad_flat*2);
-b=y+b+c(n.nquad_smooth*2);A=b+A+c(n.nquad_flat_uv*2);(function(a){var b=n.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;q(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,c)}})(z);(function(a){var b=n.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;l(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,d)}})(v);(function(a){var b=n.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
-c)}})(b);(function(a){var b=n.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(A);(function(a){var b=n.ntri_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(p);(function(a){var b=n.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;l(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(w);(function(a){var b=n.nquad_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(x);(function(a){var b=
-n.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(y);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
+3],r[k*3+1],r[k*3+2]),new THREE.Vector3(q,s,l),new THREE.Vector3(t,v,n),new THREE.Vector3(w,x,o)],null,j))}}var m=this,p=0,l,r=[],t=[],w,z,v,x,y,A;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(m,d,b);l={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,p,12),header_bytes:g(a,p+12),vertex_coordinate_bytes:g(a,p+13),normal_coordinate_bytes:g(a,p+14),uv_coordinate_bytes:g(a,p+15),vertex_index_bytes:g(a,p+16),normal_index_bytes:g(a,
+p+17),uv_index_bytes:g(a,p+18),material_index_bytes:g(a,p+19),nvertices:i(a,p+20),nnormals:i(a,p+20+4),nuvs:i(a,p+20+8),ntri_flat:i(a,p+20+12),ntri_smooth:i(a,p+20+16),ntri_flat_uv:i(a,p+20+20),ntri_smooth_uv:i(a,p+20+24),nquad_flat:i(a,p+20+28),nquad_smooth:i(a,p+20+32),nquad_flat_uv:i(a,p+20+36),nquad_smooth_uv:i(a,p+20+40)};l.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");p+=l.header_bytes;b=l.vertex_index_bytes*3+l.material_index_bytes;A=l.vertex_index_bytes*
+4+l.material_index_bytes;w=l.ntri_flat*b;z=l.ntri_smooth*(b+l.normal_index_bytes*3);v=l.ntri_flat_uv*(b+l.uv_index_bytes*3);x=l.ntri_smooth_uv*(b+l.normal_index_bytes*3+l.uv_index_bytes*3);y=l.nquad_flat*A;b=l.nquad_smooth*(A+l.normal_index_bytes*4);A=l.nquad_flat_uv*(A+l.uv_index_bytes*4);p+=function(b){var c=l.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],m.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(p);
+p+=function(b){var c=l.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],r.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(p);p+=c(l.nnormals*3);p+=function(b){var c=l.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],t.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(p);w=p+w+c(l.ntri_flat*2);z=w+z+c(l.ntri_smooth*2);v=z+v+c(l.ntri_flat_uv*2);x=v+x+c(l.ntri_smooth_uv*2);y=x+y+c(l.nquad_flat*2);
+b=y+b+c(l.nquad_smooth*2);A=b+A+c(l.nquad_flat_uv*2);(function(a){var b=l.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;q(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,c)}})(z);(function(a){var b=l.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;n(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,d)}})(v);(function(a){var b=l.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
+c)}})(b);(function(a){var b=l.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(A);(function(a){var b=l.ntri_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(p);(function(a){var b=l.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;n(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(w);(function(a){var b=l.nquad_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(x);(function(a){var b=
+l.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(y);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
 THREE.ColladaLoader=function(){function a(a,d,g){P=a;d=d||ca;g!==void 0&&(a=g.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");Z=c("//dae:library_images/dae:image",e,"image");$=c("//dae:library_materials/dae:material",y,"material");aa=c("//dae:library_effects/dae:effect",B,"effect");S=c("//dae:library_geometries/dae:geometry",p,"geometry");R=c("//dae:library_controllers/dae:controller",h,"controller");U=c("//dae:library_animations/dae:animation",I,"animation");ba=c(".//dae:library_visual_scenes/dae:visual_scene",
 THREE.ColladaLoader=function(){function a(a,d,g){P=a;d=d||ca;g!==void 0&&(a=g.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");Z=c("//dae:library_images/dae:image",e,"image");$=c("//dae:library_materials/dae:material",y,"material");aa=c("//dae:library_effects/dae:effect",B,"effect");S=c("//dae:library_geometries/dae:geometry",p,"geometry");R=c("//dae:library_controllers/dae:controller",h,"controller");U=c("//dae:library_animations/dae:animation",I,"animation");ba=c(".//dae:library_visual_scenes/dae:visual_scene",
 j,"visual_scene");W=[];X=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),T=ba[a]):T=null;Y=new THREE.Object3D;for(a=0;a<T.nodes.length;a++)Y.add(f(T.nodes[a]));b();for(var i in U);i={scene:Y,morphs:W,skins:X,dae:{images:Z,materials:$,effects:aa,geometries:S,controllers:R,animations:U,visualScenes:ba,scene:T}};d&&d(i);return i}function c(a,b,c){for(var a=P.evaluate(a,P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 j,"visual_scene");W=[];X=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),T=ba[a]):T=null;Y=new THREE.Object3D;for(a=0;a<T.nodes.length;a++)Y.add(f(T.nodes[a]));b();for(var i in U);i={scene:Y,morphs:W,skins:X,dae:{images:Z,materials:$,effects:aa,geometries:S,controllers:R,animations:U,visualScenes:ba,scene:T}};d&&d(i);return i}function c(a,b,c){for(var a=P.evaluate(a,P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in U)for(var e=U[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof
 null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in U)for(var e=U[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof
-THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=R[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=T.getChildById(c.skeleton[0],!0)||T.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
-for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var s=i.weights[p][q];s.joint==m&&j.weights.push(s)}}else throw"ColladaLoader: Could not find joint '"+
-j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function f(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=R[a.controllers[e].url];switch(i.type){case "skin":if(S[i.skin.source]){var j=
+THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=R[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=T.getChildById(c.skeleton[0],!0)||T.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,n;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
+for(e=0;e<g.frames;e++){var m=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,m,e);h=m;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],n=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){n=p;break}if(n>=0){p=i.invBindMatrices[n];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var r=i.weights[p][q];r.joint==n&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
+j.sid+"'.";}for(h=0;h<m.length;h++)if(m[h].type=="JOINT")for(i=0;i<m[h].weights.length;i++)j=m[h].weights[i],k=j.index,j=j.weight,n=a.vertices[k],k=o[k],l.x=n.position.x,l.y=n.position.y,l.z=n.position.z,m[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function f(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=R[a.controllers[e].url];switch(i.type){case "skin":if(S[i.skin.source]){var j=
 new m;j.url=i.skin.source;j.instance_material=a.controllers[e].instance_material;a.geometries.push(j);c=a.controllers[e]}else if(R[i.skin.source]&&(d=i=R[i.skin.source],i.morph&&S[i.morph.source]))j=new m,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j);break;case "morph":if(S[i.morph.source])j=new m,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j),d=a.controllers[e];console.log("ColladaLoader: Morph-controller partially supported.")}}for(e=
 new m;j.url=i.skin.source;j.instance_material=a.controllers[e].instance_material;a.geometries.push(j);c=a.controllers[e]}else if(R[i.skin.source]&&(d=i=R[i.skin.source],i.morph&&S[i.morph.source]))j=new m,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j);break;case "morph":if(S[i.morph.source])j=new m,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j),d=a.controllers[e];console.log("ColladaLoader: Morph-controller partially supported.")}}for(e=
-0;e<a.geometries.length;e++){var i=a.geometries[e],j=i.instance_material,i=S[i.url],k={},n=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=aa[$[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=k[o.symbol]=p.material;n++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(n>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)n=
-i.faces[h],n.materials=[k[n.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=R[c.url],j.skinInstanceController=c,j.name="skin_"+X.length,X.push(j);else if(d!==void 0){h=i;k=d instanceof l?R[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(n=0;n<k.targets.length;n++)if(p=S[k.targets[n]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
+0;e<a.geometries.length;e++){var i=a.geometries[e],j=i.instance_material,i=S[i.url],k={},l=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=aa[$[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=k[o.symbol]=p.material;l++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=
+i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=R[c.url],j.skinInstanceController=c,j.name="skin_"+X.length,X.push(j);else if(d!==void 0){h=i;k=d instanceof n?R[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(p=S[k.targets[l]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
 h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+W.length;W.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(e=0;e<a.nodes.length;e++)b.add(f(a.nodes[e],a));return b}function e(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
 h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+W.length;W.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(e=0;e<a.nodes.length;e++)b.add(f(a.nodes[e],a));return b}function e(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
-null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function q(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function l(){this.url=
-"";this.skeleton=[];this.instance_material=[]}function s(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function n(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function r(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";this.stride=this.count=0;this.params=[]}function z(){this.input={}}function v(){this.semantic=
+null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function q(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function s(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function l(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function r(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";this.stride=this.count=0;this.params=[]}function z(){this.input={}}function v(){this.semantic=
 "";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function y(){this.name=this.id="";this.instance_effect=null}function A(){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 F(a,b){this.type=a;this.effect=b;this.material=null}function u(a){this.effect=a;this.format=this.init_from=null}function D(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
 "";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function y(){this.name=this.id="";this.instance_effect=null}function A(){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 F(a,b){this.type=a;this.effect=b;this.material=null}function u(a){this.effect=a;this.format=this.init_from=null}function D(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
 this.source=null}function B(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function G(){this.url=""}function I(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function E(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function K(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function O(a){var b=a.getAttribute("id");
 this.source=null}function B(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function G(){this.url=""}function I(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function E(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function K(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function O(a){var b=a.getAttribute("id");
 if(V[b]!=void 0)return V[b];V[b]=(new x(b)).parse(a);return V[b]}function C(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=M(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=M(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function J(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function N(a,
 if(V[b]!=void 0)return V[b];V[b]=(new x(b)).parse(a);return V[b]}function C(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=M(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=M(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function J(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function N(a,
@@ -242,18 +242,18 @@ a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new v).
 0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new q).parse(c))}}return this};q.prototype.getChannelForTransform=
 0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new q).parse(c))}}return this};q.prototype.getChannelForTransform=
 function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};q.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
 function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};q.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
 b);if(d)return d}return null};q.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};q.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};q.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
 b);if(d)return d}return null};q.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};q.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};q.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
-this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new q).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new l).parse(b));break;case "instance_geometry":this.geometries.push((new m).parse(b));break;case "instance_light":break;case "instance_node":b=
+this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new q).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new m).parse(b));break;case "instance_light":break;case "instance_node":b=
 b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new q).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in U)for(var e=U[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
 b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new q).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in U)for(var e=U[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
 if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
 if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
 this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};q.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
 this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};q.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
 this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=L(a.textContent);this.updateMatrix();return this};o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
 this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=L(a.textContent);this.updateMatrix();return this};o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
-case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};l.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
 if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new s).parse(d)),d=c.iterateNext()}}return this};s.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};m.prototype.parse=function(a){this.url=
 if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new s).parse(d)),d=c.iterateNext()}}return this};s.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};m.prototype.parse=function(a){this.url=
 a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=P.evaluate(".//dae:instance_material",c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new s).parse(b)),b=a.iterateNext();break}}return this};p.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
 a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=P.evaluate(".//dae:instance_material",c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new s).parse(b)),b=a.iterateNext();break}}return this};p.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
-(new n(this)).parse(c)}}return this};n.prototype.parse=function(a){function b(a,c){var d=Q(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":O(d);break;case "vertices":this.vertices=(new z).parse(d);break;case "triangles":this.primitives.push((new t).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new r).parse(d))}}var e=
+(new l(this)).parse(c)}}return this};l.prototype.parse=function(a){function b(a,c){var d=Q(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":O(d);break;case "vertices":this.vertices=(new z).parse(d);break;case "triangles":this.primitives.push((new t).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new r).parse(d))}}var e=
 {};this.geometry3js=new THREE.Geometry;d=V[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
 {};this.geometry3js=new THREE.Geometry;d=V[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
-return this};n.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,n=0,m=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],q=[],s={},r=[];a.vcount&&(m=a.vcount[n++]);for(e=0;e<m;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=V[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=Q(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],
-l.data[k+1],l.data[k+2]));break;case "TEXCOORD":s[i.set]===void 0&&(s[i.set]=[]);s[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;m==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],r.length?r:new THREE.Color):m==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],r.length?r:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=s[o[f]],b.faceVertexUvs[f].push([e[0],
+return this};l.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,n=0,m=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],q=[],r={},s=[];a.vcount&&(m=a.vcount[n++]);for(e=0;e<m;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=V[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=Q(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],
+l.data[k+1],l.data[k+2]));break;case "TEXCOORD":r[i.set]===void 0&&(r[i.set]=[]);r[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;m==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],s.length?s:new THREE.Color):m==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],s.length?s:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=r[o[f]],b.faceVertexUvs[f].push([e[0],
 e[1],e[2]]);d+=h.length*m}};r.prototype=new t;r.prototype.constructor=r;t.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=J(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new v).parse(a.childNodes[b]));break;case "vcount":this.vcount=
 e[1],e[2]]);d+=h.length*m}};r.prototype=new t;r.prototype.constructor=r;t.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=J(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new v).parse(a.childNodes[b]));break;case "vcount":this.vcount=
 H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=J(a,"count",0);this.stride=J(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};z.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
 H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=J(a,"count",0);this.stride=J(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};z.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
 "input"){var c=(new v).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};v.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=J(a,"set",-1);this.offset=J(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};x.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=M(c.textContent).split(/\s+/),
 "input"){var c=(new v).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};v.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=J(a,"set",-1);this.offset=J(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};x.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=M(c.textContent).split(/\s+/),
@@ -275,21 +275,21 @@ Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.i
 THREE.JSONLoader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,c=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,c,b)};
 THREE.JSONLoader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,c=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,c,b)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,c,b,d,g){var f=new XMLHttpRequest,e=0;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);a.createModel(h,b,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+f.status+"]");else f.readyState==3?g&&(e==0&&(e=f.getResponseHeader("Content-Length")),g({total:e,loaded:f.responseText.length})):
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,c,b,d,g){var f=new XMLHttpRequest,e=0;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);a.createModel(h,b,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+f.status+"]");else f.readyState==3?g&&(e==0&&(e=f.getResponseHeader("Content-Length")),g({total:e,loaded:f.responseText.length})):
 f.readyState==2&&(e=f.getResponseHeader("Content-Length"))};f.open("GET",c,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 f.readyState==2&&(e=f.getResponseHeader("Content-Length"))};f.open("GET",c,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,k,j,q,o,l,s,m,p,n,r,t,w=a.faces;q=a.vertices;var z=a.normals,v=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=q.length;k<
-j;)o=new THREE.Vertex,o.position.x=q[k++]*b,o.position.y=q[k++]*b,o.position.z=q[k++]*b,d.vertices.push(o);k=0;for(j=w.length;k<j;){b=w[k++];q=b&1;i=b&2;c=b&4;g=b&8;l=b&16;o=b&32;m=b&64;b&=128;q?(p=new THREE.Face4,p.a=w[k++],p.b=w[k++],p.c=w[k++],p.d=w[k++],q=4):(p=new THREE.Face3,p.a=w[k++],p.b=w[k++],p.c=w[k++],q=3);if(i)i=w[k++],p.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)n=a.uvs[c],s=w[k++],t=n[s*2],s=n[s*2+1],d.faceUvs[c][i]=new THREE.UV(t,s);if(g)for(c=0;c<x;c++){n=a.uvs[c];r=[];
-for(g=0;g<q;g++)s=w[k++],t=n[s*2],s=n[s*2+1],r[g]=new THREE.UV(t,s);d.faceVertexUvs[c][i]=r}if(l)l=w[k++]*3,g=new THREE.Vector3,g.x=z[l++],g.y=z[l++],g.z=z[l],p.normal=g;if(o)for(c=0;c<q;c++)l=w[k++]*3,g=new THREE.Vector3,g.x=z[l++],g.y=z[l++],g.z=z[l],p.vertexNormals.push(g);if(m)o=w[k++],o=new THREE.Color(v[o]),p.color=o;if(b)for(c=0;c<q;c++)o=w[k++],o=new THREE.Color(v[o]),p.vertexColors.push(o);d.faces.push(p)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
-2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,k,j,q,o,l,s;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=d.morphTargets[c].vertices;
-s=a.morphTargets[c].vertices;i=0;for(k=s.length;i<k;i+=3)j=s[i]*b,q=s[i+1]*b,o=s[i+2]*b,l.push(new THREE.Vertex(new THREE.Vector3(j,q,o)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;j=a.morphColors[c].colors;b=0;for(i=j.length;b<i;b+=3)q=new THREE.Color(16755200),q.setRGB(j[b],j[b+1],j[b+2]),k.push(q)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,k,j,q,o,n,s,m,p,l,r,t,w=a.faces;q=a.vertices;var z=a.normals,v=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=q.length;k<
+j;)o=new THREE.Vertex,o.position.x=q[k++]*b,o.position.y=q[k++]*b,o.position.z=q[k++]*b,d.vertices.push(o);k=0;for(j=w.length;k<j;){b=w[k++];q=b&1;i=b&2;c=b&4;g=b&8;n=b&16;o=b&32;m=b&64;b&=128;q?(p=new THREE.Face4,p.a=w[k++],p.b=w[k++],p.c=w[k++],p.d=w[k++],q=4):(p=new THREE.Face3,p.a=w[k++],p.b=w[k++],p.c=w[k++],q=3);if(i)i=w[k++],p.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)l=a.uvs[c],s=w[k++],t=l[s*2],s=l[s*2+1],d.faceUvs[c][i]=new THREE.UV(t,s);if(g)for(c=0;c<x;c++){l=a.uvs[c];r=[];
+for(g=0;g<q;g++)s=w[k++],t=l[s*2],s=l[s*2+1],r[g]=new THREE.UV(t,s);d.faceVertexUvs[c][i]=r}if(n)n=w[k++]*3,g=new THREE.Vector3,g.x=z[n++],g.y=z[n++],g.z=z[n],p.normal=g;if(o)for(c=0;c<q;c++)n=w[k++]*3,g=new THREE.Vector3,g.x=z[n++],g.y=z[n++],g.z=z[n],p.vertexNormals.push(g);if(m)o=w[k++],o=new THREE.Color(v[o]),p.color=o;if(b)for(c=0;c<q;c++)o=w[k++],o=new THREE.Color(v[o]),p.vertexColors.push(o);d.faces.push(p)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
+2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,k,j,q,o,n,s;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;
+s=a.morphTargets[c].vertices;i=0;for(k=s.length;i<k;i+=3)j=s[i]*b,q=s[i+1]*b,o=s[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(j,q,o)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;j=a.morphColors[c].colors;b=0;for(i=j.length;b<i;b+=3)q=new THREE.Color(16755200),q.setRGB(j[b],j[b+1],j[b+2]),k.push(q)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
 d.computeTangents();c(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 d.computeTangents();c(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,c){var b=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var g=JSON.parse(d.responseText);g.metadata===void 0||g.metadata.formatVersion===void 0||g.metadata.formatVersion!==3?console.error("Deprecated file format."):b.createScene(g,c,a)}catch(f){console.error(f),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
 THREE.SceneLoader.prototype.load=function(a,c){var b=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var g=JSON.parse(d.responseText);g.metadata===void 0||g.metadata.formatVersion===void 0||g.metadata.formatVersion!==3?console.error("Deprecated file format."):b.createScene(g,c,a)}catch(f){console.error(f),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
 d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
 d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function g(){var a;for(o in B.objects)if(!C.objects[o])if(n=B.objects[o],n.geometry!==void 0){if(A=C.geometries[n.geometry]){a=!1;for(H=0;H<n.materials.length;H++)D=C.materials[n.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&A.computeTangents();w=n.position;z=n.rotation;v=n.quaternion;x=n.scale;v=0;D.length==0&&(D=new THREE.MeshFaceMaterial);D.length>1&&(D=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(A,D);a.name=o;a.position.set(w[0],w[1],w[2]);v?(a.quaternion.set(v[0],v[1],v[2],v[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]);a.scale.set(x[0],x[1],x[2]);a.visible=n.visible;C.scene.add(a);C.objects[o]=a;if(n.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(n.castsShadow)b=new THREE.ShadowVolume(A),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;n.trigger&&n.trigger.toLowerCase()!="none"&&(b=
-{type:n.trigger,object:n},C.triggers[a.name]=b)}}else w=n.position,z=n.rotation,v=n.quaternion,x=n.scale,v=0,a=new THREE.Object3D,a.name=o,a.position.set(w[0],w[1],w[2]),v?(a.quaternion.set(v[0],v[1],v[2],v[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]),a.scale.set(x[0],x[1],x[2]),a.visible=n.visible!==void 0?n.visible:!1,C.scene.add(a),C.objects[o]=a,C.empties[o]=a,n.trigger&&n.trigger.toLowerCase()!="none"&&(b={type:n.trigger,object:n},C.triggers[a.name]=b)}function f(a){return function(b){C.geometries[a]=
-b;g();I-=1;i.onLoadComplete();h()}}function e(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:K,totalTextures:O,loadedModels:K-I,loadedTextures:O-E},C);i.onLoadProgress();I==0&&E==0&&c(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(b),j,q,o,l,s,m,p,n,r,t,w,z,v,x,y,A,F,u,D,B,G,I,E,K,O,C;B=a;b=new THREE.BinaryLoader;G=new THREE.JSONLoader;E=I=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
-empties:{}};a=!1;for(o in B.objects)if(n=B.objects[o],n.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;r=B.transform.rotation;var L=B.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);r&&C.scene.rotation.set(r[0],r[1],r[2]);L&&C.scene.scale.set(L[0],L[1],L[2]);(a||r||L)&&C.scene.updateMatrix()}a=function(){E-=1;h();i.onLoadComplete()};for(s in B.cameras)r=B.cameras[s],r.type=="perspective"?F=new THREE.PerspectiveCamera(r.fov,
-r.aspect,r.near,r.far):r.type=="ortho"&&(F=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),w=r.position,r=r.target,F.position.set(w[0],w[1],w[2]),F.target=new THREE.Vector3(r[0],r[1],r[2]),C.cameras[s]=F;for(l in B.lights)r=B.lights[l],s=r.color!==void 0?r.color:16777215,F=r.intensity!==void 0?r.intensity:1,r.type=="directional"?(w=r.direction,t=new THREE.DirectionalLight(s,F),t.position.set(w[0],w[1],w[2]),t.position.normalize()):r.type=="point"?(w=r.position,t=r.distance,
-t=new THREE.PointLight(s,F,t),t.position.set(w[0],w[1],w[2])):r.type=="ambient"&&(t=new THREE.AmbientLight(s)),C.scene.add(t),C.lights[l]=t;for(m in B.fogs)l=B.fogs[m],l.type=="linear"?u=new THREE.Fog(0,l.near,l.far):l.type=="exp2"&&(u=new THREE.FogExp2(0,l.density)),r=l.color,u.color.setRGB(r[0],r[1],r[2]),C.fogs[m]=u;if(C.cameras&&B.defaults.camera)C.currentCamera=C.cameras[B.defaults.camera];if(C.fogs&&B.defaults.fog)C.scene.fog=C.fogs[B.defaults.fog];r=B.defaults.bgcolor;C.bgColor=new THREE.Color;
+THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function g(){var a;for(o in B.objects)if(!C.objects[o])if(l=B.objects[o],l.geometry!==void 0){if(A=C.geometries[l.geometry]){a=!1;for(H=0;H<l.materials.length;H++)D=C.materials[l.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&A.computeTangents();w=l.position;z=l.rotation;v=l.quaternion;x=l.scale;v=0;D.length==0&&(D=new THREE.MeshFaceMaterial);D.length>1&&(D=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(A,D);a.name=o;a.position.set(w[0],w[1],w[2]);v?(a.quaternion.set(v[0],v[1],v[2],v[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]);a.scale.set(x[0],x[1],x[2]);a.visible=l.visible;C.scene.add(a);C.objects[o]=a;if(l.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(l.castsShadow)b=new THREE.ShadowVolume(A),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;l.trigger&&l.trigger.toLowerCase()!="none"&&(b=
+{type:l.trigger,object:l},C.triggers[a.name]=b)}}else w=l.position,z=l.rotation,v=l.quaternion,x=l.scale,v=0,a=new THREE.Object3D,a.name=o,a.position.set(w[0],w[1],w[2]),v?(a.quaternion.set(v[0],v[1],v[2],v[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]),a.scale.set(x[0],x[1],x[2]),a.visible=l.visible!==void 0?l.visible:!1,C.scene.add(a),C.objects[o]=a,C.empties[o]=a,l.trigger&&l.trigger.toLowerCase()!="none"&&(b={type:l.trigger,object:l},C.triggers[a.name]=b)}function f(a){return function(b){C.geometries[a]=
+b;g();I-=1;i.onLoadComplete();h()}}function e(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:K,totalTextures:O,loadedModels:K-I,loadedTextures:O-E},C);i.onLoadProgress();I==0&&E==0&&c(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(b),j,q,o,n,s,m,p,l,r,t,w,z,v,x,y,A,F,u,D,B,G,I,E,K,O,C;B=a;b=new THREE.BinaryLoader;G=new THREE.JSONLoader;E=I=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+empties:{}};a=!1;for(o in B.objects)if(l=B.objects[o],l.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;r=B.transform.rotation;var L=B.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);r&&C.scene.rotation.set(r[0],r[1],r[2]);L&&C.scene.scale.set(L[0],L[1],L[2]);(a||r||L)&&C.scene.updateMatrix()}a=function(){E-=1;h();i.onLoadComplete()};for(s in B.cameras)r=B.cameras[s],r.type=="perspective"?F=new THREE.PerspectiveCamera(r.fov,
+r.aspect,r.near,r.far):r.type=="ortho"&&(F=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),w=r.position,r=r.target,F.position.set(w[0],w[1],w[2]),F.target=new THREE.Vector3(r[0],r[1],r[2]),C.cameras[s]=F;for(n in B.lights)r=B.lights[n],s=r.color!==void 0?r.color:16777215,F=r.intensity!==void 0?r.intensity:1,r.type=="directional"?(w=r.direction,t=new THREE.DirectionalLight(s,F),t.position.set(w[0],w[1],w[2]),t.position.normalize()):r.type=="point"?(w=r.position,t=r.distance,
+t=new THREE.PointLight(s,F,t),t.position.set(w[0],w[1],w[2])):r.type=="ambient"&&(t=new THREE.AmbientLight(s)),C.scene.add(t),C.lights[n]=t;for(m in B.fogs)n=B.fogs[m],n.type=="linear"?u=new THREE.Fog(0,n.near,n.far):n.type=="exp2"&&(u=new THREE.FogExp2(0,n.density)),r=n.color,u.color.setRGB(r[0],r[1],r[2]),C.fogs[m]=u;if(C.cameras&&B.defaults.camera)C.currentCamera=C.cameras[B.defaults.camera];if(C.fogs&&B.defaults.fog)C.scene.fog=C.fogs[B.defaults.fog];r=B.defaults.bgcolor;C.bgColor=new THREE.Color;
 C.bgColor.setRGB(r[0],r[1],r[2]);C.bgColorAlpha=B.defaults.bgalpha;for(j in B.geometries)if(m=B.geometries[j],m.type=="bin_mesh"||m.type=="ascii_mesh")I+=1,i.onLoadStart();K=I;for(j in B.geometries)m=B.geometries[j],m.type=="cube"?(A=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),C.geometries[j]=A):m.type=="plane"?(A=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=A):m.type=="sphere"?
 C.bgColor.setRGB(r[0],r[1],r[2]);C.bgColorAlpha=B.defaults.bgalpha;for(j in B.geometries)if(m=B.geometries[j],m.type=="bin_mesh"||m.type=="ascii_mesh")I+=1,i.onLoadStart();K=I;for(j in B.geometries)m=B.geometries[j],m.type=="cube"?(A=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),C.geometries[j]=A):m.type=="plane"?(A=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=A):m.type=="sphere"?
 (A=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=A):m.type=="cylinder"?(A=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),C.geometries[j]=A):m.type=="torus"?(A=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),C.geometries[j]=A):m.type=="icosahedron"?(A=new THREE.IcosahedronGeometry(m.subdivisions),C.geometries[j]=A):m.type=="bin_mesh"?b.load(d(m.url,B.urlBaseType),f(j)):m.type=="ascii_mesh"?G.load(d(m.url,B.urlBaseType),
 (A=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=A):m.type=="cylinder"?(A=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),C.geometries[j]=A):m.type=="torus"?(A=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),C.geometries[j]=A):m.type=="icosahedron"?(A=new THREE.IcosahedronGeometry(m.subdivisions),C.geometries[j]=A):m.type=="bin_mesh"?b.load(d(m.url,B.urlBaseType),f(j)):m.type=="ascii_mesh"?G.load(d(m.url,B.urlBaseType),
 f(j)):m.type=="embedded_mesh"&&(m=B.embeds[m.id])&&G.createModel(m,e(j),"");for(p in B.textures)if(j=B.textures[p],j.url instanceof Array){E+=j.url.length;for(m=0;m<j.url.length;m++)i.onLoadStart()}else E+=1,i.onLoadStart();O=E;for(p in B.textures){j=B.textures[p];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){m=[];for(var H=0;H<j.url.length;H++)m[H]=d(j.url[H],B.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,j.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(j.url,
 f(j)):m.type=="embedded_mesh"&&(m=B.embeds[m.id])&&G.createModel(m,e(j),"");for(p in B.textures)if(j=B.textures[p],j.url instanceof Array){E+=j.url.length;for(m=0;m<j.url.length;m++)i.onLoadStart()}else E+=1,i.onLoadStart();O=E;for(p in B.textures){j=B.textures[p];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){m=[];for(var H=0;H<j.url.length;H++)m[H]=d(j.url[H],B.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,j.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(j.url,
@@ -300,7 +300,7 @@ p.parameters.normalMapFactor;if(p.parameters.map)a.tDiffuse.texture=p.parameters
 vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else p=new THREE[p.type](p.parameters);C.materials[q]=p}g();i.callbackSync(C);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else p=new THREE[p.type](p.parameters);C.materials[q]=p}g();i.callbackSync(C);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var d=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,f=b.offsetX!==void 0?b.offsetX:0,e=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var d=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,f=b.offsetX!==void 0?b.offsetX:0,e=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 c,g,f,e,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,g=0;g<8;g++){for(var f=0,e=0;e<c;++e){var h=a.charCodeAt(e+d);f+=h>>1^-(h&1);b[8*e+g]=f}d+=c}c=a.length-d;f=new Uint16Array(c);for(g=e=0;g<c;g++)h=a.charCodeAt(g+d),f[g]=e-h,h==0&&e++;return[b,f]};
 c,g,f,e,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,g=0;g<8;g++){for(var f=0,e=0;e<c;++e){var h=a.charCodeAt(e+d);f+=h>>1^-(h&1);b[8*e+g]=f}d+=c}c=a.length-d;f=new Uint16Array(c);for(g=e=0;g<c;g++)h=a.charCodeAt(g+d),f[g]=e-h,h==0&&e++;return[b,f]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,f){var e=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var e=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,e,i){for(var j,k,p,n=a.length;i<n;i+=e)j=a[i],k=a[i+1],p=a[i+2],j=j/16383*b,k=k/16383*b,p=p/16383*b,j+=d,k+=g,p+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,p)))})(e[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,j.push(d,1-e)})(e[0],8,3);(function(a,
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,f){var e=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var e=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,e,i){for(var j,k,p,l=a.length;i<l;i+=e)j=a[i],k=a[i+1],p=a[i+2],j=j/16383*b,k=k/16383*b,p=p/16383*b,j+=d,k+=g,p+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,p)))})(e[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,j.push(d,1-e)})(e[0],8,3);(function(a,
 b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(e[0],8,5);(function(a){var b,d,e,f,g,i,r,t,w,z=a.length;for(b=0;b<z;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;t=d;w=e;i=f;r=d;var v=e,x=f,y=g.materials[0],A=k[v*3],F=k[v*3+1],v=k[v*3+2],u=k[x*3],D=k[x*3+1],x=k[x*3+2];r=new THREE.Vector3(k[r*3],k[r*3+1],k[r*3+2]);v=new THREE.Vector3(A,F,v);x=new THREE.Vector3(u,D,x);g.faces.push(new THREE.Face3(t,w,i,[r,v,x],null,y));g=j[d*2];d=j[d*2+
 b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(e[0],8,5);(function(a){var b,d,e,f,g,i,r,t,w,z=a.length;for(b=0;b<z;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;t=d;w=e;i=f;r=d;var v=e,x=f,y=g.materials[0],A=k[v*3],F=k[v*3+1],v=k[v*3+2],u=k[x*3],D=k[x*3+1],x=k[x*3+2];r=new THREE.Vector3(k[r*3],k[r*3+1],k[r*3+2]);v=new THREE.Vector3(A,F,v);x=new THREE.Vector3(u,D,x);g.faces.push(new THREE.Face3(t,w,i,[r,v,x],null,y));g=j[d*2];d=j[d*2+
 1];i=j[e*2];r=j[e*2+1];t=j[f*2];w=j[f*2+1];f=c.faceVertexUvs[0];e=i;i=r;r=[];r.push(new THREE.UV(g,d));r.push(new THREE.UV(e,i));r.push(new THREE.UV(t,w));f.push(r)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e)};
 1];i=j[e*2];r=j[e*2+1];t=j[f*2];w=j[f*2+1];f=c.faceVertexUvs[0];e=i;i=r;r=[];r.push(new THREE.UV(g,d));r.push(new THREE.UV(e,i));r.push(new THREE.UV(t,w));f.push(r)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
@@ -308,16 +308,16 @@ b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,g){return a+(c-a)*g};this.VIntX=function(a,c,g,f,e,h,i,k,j,q){e=(e-j)/(q-j);j=this.normal_cache;c[f]=h+e*this.delta;c[f+1]=i;c[f+2]=k;g[f]=this.lerp(j[a],j[a+3],e);g[f+1]=this.lerp(j[a+1],j[a+4],e);g[f+2]=this.lerp(j[a+2],j[a+5],e)};this.VIntY=function(a,c,g,f,e,h,i,k,j,q){e=(e-j)/(q-j);j=this.normal_cache;c[f]=h;c[f+1]=i+e*this.delta;c[f+
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,g){return a+(c-a)*g};this.VIntX=function(a,c,g,f,e,h,i,k,j,q){e=(e-j)/(q-j);j=this.normal_cache;c[f]=h+e*this.delta;c[f+1]=i;c[f+2]=k;g[f]=this.lerp(j[a],j[a+3],e);g[f+1]=this.lerp(j[a+1],j[a+4],e);g[f+2]=this.lerp(j[a+2],j[a+5],e)};this.VIntY=function(a,c,g,f,e,h,i,k,j,q){e=(e-j)/(q-j);j=this.normal_cache;c[f]=h;c[f+1]=i+e*this.delta;c[f+
 2]=k;c=a+this.yd*3;g[f]=this.lerp(j[a],j[c],e);g[f+1]=this.lerp(j[a+1],j[c+1],e);g[f+2]=this.lerp(j[a+2],j[c+2],e)};this.VIntZ=function(a,c,g,f,e,h,i,k,j,q){e=(e-j)/(q-j);j=this.normal_cache;c[f]=h;c[f+1]=i;c[f+2]=k+e*this.delta;c=a+this.zd*3;g[f]=this.lerp(j[a],j[c],e);g[f+1]=this.lerp(j[a+1],j[c+1],e);g[f+2]=this.lerp(j[a+2],j[c+2],e)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
 2]=k;c=a+this.yd*3;g[f]=this.lerp(j[a],j[c],e);g[f+1]=this.lerp(j[a+1],j[c+1],e);g[f+2]=this.lerp(j[a+2],j[c+2],e)};this.VIntZ=function(a,c,g,f,e,h,i,k,j,q){e=(e-j)/(q-j);j=this.normal_cache;c[f]=h;c[f+1]=i;c[f+2]=k+e*this.delta;c=a+this.zd*3;g[f]=this.lerp(j[a],j[c],e);g[f+1]=this.lerp(j[a+1],j[c+1],e);g[f+2]=this.lerp(j[a+2],j[c+2],e)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
-this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,f,e,h){var i=f+1,k=f+this.yd,j=f+this.zd,q=i+this.yd,o=i+this.zd,l=f+this.yd+this.zd,s=i+this.yd+this.zd,m=0,p=this.field[f],n=this.field[i],r=this.field[k],t=this.field[q],w=this.field[j],z=this.field[o],v=this.field[l],x=this.field[s];p<e&&(m|=1);n<e&&(m|=2);r<e&&(m|=8);t<e&&(m|=4);w<e&&(m|=16);z<e&&(m|=32);v<e&&(m|=128);x<e&&(m|=64);var y=THREE.edgeTable[m];if(y===0)return 0;
-var A=this.delta,F=a+A,u=c+A,A=g+A;y&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(f*3,this.vlist,this.nlist,0,e,a,c,g,p,n));y&2&&(this.compNorm(i),this.compNorm(q),this.VIntY(i*3,this.vlist,this.nlist,3,e,F,c,g,n,t));y&4&&(this.compNorm(k),this.compNorm(q),this.VIntX(k*3,this.vlist,this.nlist,6,e,a,u,g,r,t));y&8&&(this.compNorm(f),this.compNorm(k),this.VIntY(f*3,this.vlist,this.nlist,9,e,a,c,g,p,r));y&16&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,12,e,a,c,A,w,z));
-y&32&&(this.compNorm(o),this.compNorm(s),this.VIntY(o*3,this.vlist,this.nlist,15,e,F,c,A,z,x));y&64&&(this.compNorm(l),this.compNorm(s),this.VIntX(l*3,this.vlist,this.nlist,18,e,a,u,A,v,x));y&128&&(this.compNorm(j),this.compNorm(l),this.VIntY(j*3,this.vlist,this.nlist,21,e,a,c,A,w,v));y&256&&(this.compNorm(f),this.compNorm(j),this.VIntZ(f*3,this.vlist,this.nlist,24,e,a,c,g,p,w));y&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,e,F,c,g,n,z));y&1024&&(this.compNorm(q),
-this.compNorm(s),this.VIntZ(q*3,this.vlist,this.nlist,30,e,F,u,g,t,x));y&2048&&(this.compNorm(k),this.compNorm(l),this.VIntZ(k*3,this.vlist,this.nlist,33,e,a,u,g,r,v));m<<=4;for(e=f=0;THREE.triTable[m+e]!=-1;)a=m+e,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),e+=3,f++;return f};this.posnormtriv=function(a,c,g,f,e,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
+this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,f,e,h){var i=f+1,k=f+this.yd,j=f+this.zd,q=i+this.yd,o=i+this.zd,n=f+this.yd+this.zd,s=i+this.yd+this.zd,m=0,p=this.field[f],l=this.field[i],r=this.field[k],t=this.field[q],w=this.field[j],z=this.field[o],v=this.field[n],x=this.field[s];p<e&&(m|=1);l<e&&(m|=2);r<e&&(m|=8);t<e&&(m|=4);w<e&&(m|=16);z<e&&(m|=32);v<e&&(m|=128);x<e&&(m|=64);var y=THREE.edgeTable[m];if(y===0)return 0;
+var A=this.delta,F=a+A,u=c+A,A=g+A;y&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(f*3,this.vlist,this.nlist,0,e,a,c,g,p,l));y&2&&(this.compNorm(i),this.compNorm(q),this.VIntY(i*3,this.vlist,this.nlist,3,e,F,c,g,l,t));y&4&&(this.compNorm(k),this.compNorm(q),this.VIntX(k*3,this.vlist,this.nlist,6,e,a,u,g,r,t));y&8&&(this.compNorm(f),this.compNorm(k),this.VIntY(f*3,this.vlist,this.nlist,9,e,a,c,g,p,r));y&16&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,12,e,a,c,A,w,z));
+y&32&&(this.compNorm(o),this.compNorm(s),this.VIntY(o*3,this.vlist,this.nlist,15,e,F,c,A,z,x));y&64&&(this.compNorm(n),this.compNorm(s),this.VIntX(n*3,this.vlist,this.nlist,18,e,a,u,A,v,x));y&128&&(this.compNorm(j),this.compNorm(n),this.VIntY(j*3,this.vlist,this.nlist,21,e,a,c,A,w,v));y&256&&(this.compNorm(f),this.compNorm(j),this.VIntZ(f*3,this.vlist,this.nlist,24,e,a,c,g,p,w));y&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,e,F,c,g,l,z));y&1024&&(this.compNorm(q),
+this.compNorm(s),this.VIntZ(q*3,this.vlist,this.nlist,30,e,F,u,g,t,x));y&2048&&(this.compNorm(k),this.compNorm(n),this.VIntZ(k*3,this.vlist,this.nlist,33,e,a,u,g,r,v));m<<=4;for(e=f=0;THREE.triTable[m+e]!=-1;)a=m+e,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),e+=3,f++;return f};this.posnormtriv=function(a,c,g,f,e,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
 3]=a[f];this.positionArray[i+4]=a[f+1];this.positionArray[i+5]=a[f+2];this.positionArray[i+6]=a[e];this.positionArray[i+7]=a[e+1];this.positionArray[i+8]=a[e+2];this.normalArray[i]=c[g];this.normalArray[i+1]=c[g+1];this.normalArray[i+2]=c[g+2];this.normalArray[i+3]=c[f];this.normalArray[i+4]=c[f+1];this.normalArray[i+5]=c[f+2];this.normalArray[i+6]=c[e];this.normalArray[i+7]=c[e+1];this.normalArray[i+8]=c[e+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
 3]=a[f];this.positionArray[i+4]=a[f+1];this.positionArray[i+5]=a[f+2];this.positionArray[i+6]=a[e];this.positionArray[i+7]=a[e+1];this.positionArray[i+8]=a[e+2];this.normalArray[i]=c[g];this.normalArray[i+1]=c[g+1];this.normalArray[i+2]=c[g+2];this.normalArray[i+3]=c[f];this.normalArray[i+4]=c[f+1];this.normalArray[i+5]=c[f+2];this.normalArray[i+6]=c[e];this.normalArray[i+7]=c[e+1];this.normalArray[i+8]=c[e+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
-function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,f,e){var h=this.size*Math.sqrt(f/e),i=g*this.size,k=c*this.size,j=a*this.size,q=Math.floor(i-h);q<1&&(q=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var l=Math.floor(j-h);l<1&&(l=1);h=Math.floor(j+h);
-h>this.size-1&&(h=this.size-1);for(var s,m,p,n,r,t;q<i;q++){j=this.size2*q;m=q/this.size-g;r=m*m;for(m=o;m<k;m++){p=j+this.size*m;s=m/this.size-c;t=s*s;for(s=l;s<h;s++)n=s/this.size-a,n=f/(1.0E-6+n*n+t+r)-e,n>0&&(this.field[p+s]+=n)}}};this.addPlaneX=function(a,c){var g,f,e,h,i,k=this.size,j=this.yd,q=this.zd,o=this.field,l=k*Math.sqrt(a/c);l>k&&(l=k);for(g=0;g<l;g++)if(f=g/k,f*=f,h=a/(1.0E-4+f)-c,h>0)for(f=0;f<k;f++){i=g+f*j;for(e=0;e<k;e++)o[q*e+i]+=h}};this.addPlaneY=function(a,c){var g,f,e,h,
-i,k,j=this.size,q=this.yd,o=this.zd,l=this.field,s=j*Math.sqrt(a/c);s>j&&(s=j);for(f=0;f<s;f++)if(g=f/j,g*=g,h=a/(1.0E-4+g)-c,h>0){i=f*q;for(g=0;g<j;g++){k=i+g;for(e=0;e<j;e++)l[o*e+k]+=h}}};this.addPlaneZ=function(a,c){var g,f,e,h,i,k,j=this.size,q=this.yd,o=this.zd,l=this.field,s=j*Math.sqrt(a/c);s>j&&(s=j);for(e=0;e<s;e++)if(g=e/j,g*=g,h=a/(1.0E-4+g)-c,h>0){i=o*e;for(f=0;f<j;f++){k=i+f*q;for(g=0;g<j;g++)l[k+g]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,
-this.field[a]=0};this.render=function(a){this.begin();var c,g,f,e,h,i,k,j,q,o=this.size-2;for(e=1;e<o;e++){q=this.size2*e;k=(e-this.halfsize)/this.halfsize;for(f=1;f<o;f++){j=q+this.size*f;i=(f-this.halfsize)/this.halfsize;for(g=1;g<o;g++)h=(g-this.halfsize)/this.halfsize,c=j+g,this.polygonize(h,i,k,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(f){var e,h,i,k,j,q,o,l;for(e=0;e<f.count;e++)o=e*3,j=o+1,l=o+2,h=f.positionArray[o],
-i=f.positionArray[j],k=f.positionArray[l],q=new THREE.Vector3(h,i,k),h=f.normalArray[o],i=f.normalArray[j],k=f.normalArray[l],o=new THREE.Vector3(h,i,k),o.normalize(),j=new THREE.Vertex(q),c.vertices.push(j),g.push(o);q=f.count/3;for(e=0;e<q;e++)o=(a+e)*3,j=o+1,l=o+2,h=g[o],i=g[j],k=g[l],o=new THREE.Face3(o,j,l,[h,i,k]),c.faces.push(o);a+=q;f.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,f,e){var h=this.size*Math.sqrt(f/e),i=g*this.size,k=c*this.size,j=a*this.size,q=Math.floor(i-h);q<1&&(q=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var n=Math.floor(j-h);n<1&&(n=1);h=Math.floor(j+h);
+h>this.size-1&&(h=this.size-1);for(var s,m,p,l,r,t;q<i;q++){j=this.size2*q;m=q/this.size-g;r=m*m;for(m=o;m<k;m++){p=j+this.size*m;s=m/this.size-c;t=s*s;for(s=n;s<h;s++)l=s/this.size-a,l=f/(1.0E-6+l*l+t+r)-e,l>0&&(this.field[p+s]+=l)}}};this.addPlaneX=function(a,c){var g,f,e,h,i,k=this.size,j=this.yd,q=this.zd,o=this.field,n=k*Math.sqrt(a/c);n>k&&(n=k);for(g=0;g<n;g++)if(f=g/k,f*=f,h=a/(1.0E-4+f)-c,h>0)for(f=0;f<k;f++){i=g+f*j;for(e=0;e<k;e++)o[q*e+i]+=h}};this.addPlaneY=function(a,c){var g,f,e,h,
+i,k,j=this.size,q=this.yd,o=this.zd,n=this.field,s=j*Math.sqrt(a/c);s>j&&(s=j);for(f=0;f<s;f++)if(g=f/j,g*=g,h=a/(1.0E-4+g)-c,h>0){i=f*q;for(g=0;g<j;g++){k=i+g;for(e=0;e<j;e++)n[o*e+k]+=h}}};this.addPlaneZ=function(a,c){var g,f,e,h,i,k,j=this.size,q=this.yd,o=this.zd,n=this.field,s=j*Math.sqrt(a/c);s>j&&(s=j);for(e=0;e<s;e++)if(g=e/j,g*=g,h=a/(1.0E-4+g)-c,h>0){i=o*e;for(f=0;f<j;f++){k=i+f*q;for(g=0;g<j;g++)n[k+g]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,
+this.field[a]=0};this.render=function(a){this.begin();var c,g,f,e,h,i,k,j,q,o=this.size-2;for(e=1;e<o;e++){q=this.size2*e;k=(e-this.halfsize)/this.halfsize;for(f=1;f<o;f++){j=q+this.size*f;i=(f-this.halfsize)/this.halfsize;for(g=1;g<o;g++)h=(g-this.halfsize)/this.halfsize,c=j+g,this.polygonize(h,i,k,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(f){var e,h,i,k,j,q,o,n;for(e=0;e<f.count;e++)o=e*3,j=o+1,n=o+2,h=f.positionArray[o],
+i=f.positionArray[j],k=f.positionArray[n],q=new THREE.Vector3(h,i,k),h=f.normalArray[o],i=f.normalArray[j],k=f.normalArray[n],o=new THREE.Vector3(h,i,k),o.normalize(),j=new THREE.Vertex(q),c.vertices.push(j),g.push(o);q=f.count/3;for(e=0;e<q;e++)o=(a+e)*3,j=o+1,n=o+2,h=g[o],i=g[j],k=g[n],o=new THREE.Face3(o,j,n,[h,i,k]),c.faces.push(o);a+=q;f.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -357,9 +357,9 @@ d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case
 THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var d=b.dot(a.direction.clone());if(d<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-d*d);if(b>=0)return Math.abs(d)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var d=b.dot(a.direction.clone());if(d<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-d*d);if(b>=0)return Math.abs(d)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,q;g.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),l=new THREE.WebGLRenderTarget(512,512,a),s=new THREE.PerspectiveCamera(53,
-1,1,1E4);s.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:l}},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}"}),
-m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(s);this.setSize=function(a,d){b.call(c,a,d);o.width=a;o.height=d;l.width=a;l.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||j!==b.far||q!==b.fov){i=b.aspect;k=b.near;j=b.far;q=b.fov;var r=b.projectionMatrix.clone(),t=125/30*0.5,w=t*k/125,z=k*Math.tan(q*Math.PI/360),v;e.n14=t;h.n14=-t;t=-z*i+w;v=z*i+w;r.n11=2*k/(v-t);r.n13=(v+t)/(v-t);g.projectionMatrix.copy(r);t=-z*i-w;v=z*i-w;r.n11=
-2*k/(v-t);r.n13=(v+t)/(v-t);f.projectionMatrix.copy(r)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,o,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(e);f.position.copy(b.position);f.near=b.near;f.far=b.far;d.call(c,a,f,l,!0);m.updateMatrixWorld();d.call(c,m,s)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,q;g.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),s=new THREE.PerspectiveCamera(53,
+1,1,1E4);s.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:n}},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}"}),
+m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(s);this.setSize=function(a,d){b.call(c,a,d);o.width=a;o.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||j!==b.far||q!==b.fov){i=b.aspect;k=b.near;j=b.far;q=b.fov;var r=b.projectionMatrix.clone(),t=125/30*0.5,w=t*k/125,z=k*Math.tan(q*Math.PI/360),v;e.n14=t;h.n14=-t;t=-z*i+w;v=z*i+w;r.n11=2*k/(v-t);r.n13=(v+t)/(v-t);g.projectionMatrix.copy(r);t=-z*i-w;v=z*i-w;r.n11=
+2*k/(v-t);r.n13=(v+t)/(v-t);f.projectionMatrix.copy(r)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,o,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(e);f.position.copy(b.position);f.near=b.near;f.far=b.far;d.call(c,a,f,n,!0);m.updateMatrixWorld();d.call(c,m,s)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,g,f,e=new THREE.PerspectiveCamera;e.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);g=a/2;f=d};this.render=function(a,b){this.clear();e.fov=b.fov;e.aspect=0.5*b.aspect;e.near=b.near;e.far=
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,g,f,e=new THREE.PerspectiveCamera;e.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);g=a/2;f=d};this.render=function(a,b){this.clear();e.fov=b.fov;e.aspect=0.5*b.aspect;e.near=b.near;e.far=
 b.far;e.updateProjectionMatrix();e.position.copy(b.position);e.target.copy(b.target);e.translateX(c.separation);e.lookAt(e.target);h.projectionMatrix=e.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,g,f);d.call(c,a,e);this.setViewport(g,0,g,f);d.call(c,a,h,!1)}};
 b.far;e.updateProjectionMatrix();e.position.copy(b.position);e.target.copy(b.target);e.translateX(c.separation);e.lookAt(e.target);h.projectionMatrix=e.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,g,f);d.call(c,a,e);this.setViewport(g,0,g,f);d.call(c,a,h,!1)}};

+ 1 - 1
build/custom/ThreeSVG.js

@@ -72,7 +72,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,m=l*c+g*f-h*d,i=l*d+h*c-e*f,j=l*f+e*d-g*c,c=-e*
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,m=l*c+g*f-h*d,i=l*d+h*c-e*f,j=l*f+e*d-g*c,c=-e*
 c-g*d-h*f;b.x=m*l+c*-e+i*-h-j*-g;b.y=i*l+c*-g+j*-e-m*-h;b.z=j*l+c*-h+m*-g-i*-e;return b}};
 c-g*d-h*f;b.x=m*l+c*-e+i*-h-j*-g;b.y=i*l+c*-g+j*-e-m*-h;b.z=j*l+c*-h+m*-g-i*-e;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};

+ 1 - 1
build/custom/ThreeWebGL.js

@@ -72,7 +72,7 @@ this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,e=this.z,f=this.w,g=a.x,i=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-e*i;this.y=c*a+f*i+e*g-b*h;this.z=e*a+f*h+b*i-c*g;this.w=f*a-b*g-c*i-e*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,g=this.x,i=this.y,h=this.z,r=this.w,p=r*c+i*f-h*e,j=r*e+h*c-g*f,n=r*f+g*e-i*c,c=-g*
 this.x,c=this.y,e=this.z,f=this.w,g=a.x,i=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-e*i;this.y=c*a+f*i+e*g-b*h;this.z=e*a+f*h+b*i-c*g;this.w=f*a-b*g-c*i-e*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,g=this.x,i=this.y,h=this.z,r=this.w,p=r*c+i*f-h*e,j=r*e+h*c-g*f,n=r*f+g*e-i*c,c=-g*
 c-i*e-h*f;b.x=p*r+c*-g+j*-h-n*-i;b.y=j*r+c*-i+n*-g-p*-h;b.z=n*r+c*-h+p*-i-j*-g;return b}};
 c-i*e-h*f;b.x=p*r+c*-g+j*-h-n*-i;b.y=j*r+c*-i+n*-g-p*-h;b.z=n*r+c*-h+p*-i-j*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*b+c.w*e;c.x=a.x*b+c.x*e;c.y=a.y*b+c.y*e;c.z=a.z*b+c.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*b+c.w*e;c.x=a.x*b+c.x*e;c.y=a.y*b+c.y*e;c.z=a.z*b+c.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,f,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,f,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,f,g,i){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=i;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.Face4=function(a,b,c,e,f,g,i){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=i;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};

+ 2 - 4
examples/misc_lights_test.html

@@ -89,7 +89,7 @@
 				// Spheres
 				// Spheres
 
 
 				var geometry = new THREE.SphereGeometry( 100, 16, 8 );
 				var geometry = new THREE.SphereGeometry( 100, 16, 8 );
-				var material = new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading } );
+				var material = new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, overdraw: true } );
 
 
 				for ( var i = 0; i < 30; i ++ ) {
 				for ( var i = 0; i < 30; i ++ ) {
 
 
@@ -98,15 +98,13 @@
 					mesh.position.y = 500 * ( Math.random() - 0.5 );
 					mesh.position.y = 500 * ( Math.random() - 0.5 );
 					mesh.position.z = 500 * ( Math.random() - 0.5 );
 					mesh.position.z = 500 * ( Math.random() - 0.5 );
 					mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.25 * ( Math.random() + 0.5 );
 					mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.25 * ( Math.random() + 0.5 );
-					mesh.overdraw = true;
 					scene.add( mesh );
 					scene.add( mesh );
 
 
 				}
 				}
 
 
 				// Torus
 				// Torus
 
 
-				mesh = new THREE.Mesh( new THREE.TorusGeometry( 100, 25, 15, 30 ), new THREE.MeshLambertMaterial( { color: 0xffffff } ) );
-				mesh.overdraw = true;
+				mesh = new THREE.Mesh( new THREE.TorusGeometry( 100, 25, 15, 30 ), new THREE.MeshLambertMaterial( { color: 0xffffff, overdraw: true } ) );
 				scene.add( mesh );
 				scene.add( mesh );
 
 
 				// Lights
 				// Lights

binární
examples/textures/UV.jpg


binární
examples/textures/ash_uvgrid01.jpg


+ 1 - 0
examples/textures/ash_uvgrid01.nfo

@@ -0,0 +1 @@
+http://www.pixelcg.com/blog/?p=146

+ 1 - 1
examples/webgl_geometries.html

@@ -51,7 +51,7 @@
 				scene.add( light );
 				scene.add( light );
 
 
 				materials = [
 				materials = [
-					new THREE.MeshLambertMaterial( { ambient: 0xbbbbbb, map: THREE.ImageUtils.loadTexture( 'textures/UV.jpg' ) } ),
+					new THREE.MeshLambertMaterial( { ambient: 0xbbbbbb, map: THREE.ImageUtils.loadTexture( 'textures/ash_uvgrid01.jpg' ) } ),
 					new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true, transparent: true, opacity: 0.1 } )
 					new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true, transparent: true, opacity: 0.1 } )
 				];
 				];
 
 

+ 1 - 1
examples/webgl_utf8loader.html

@@ -123,7 +123,7 @@
 
 
 			function callbackModel( geometry, s, color, x, y, z ) {
 			function callbackModel( geometry, s, color, x, y, z ) {
 
 
-				var material = new THREE.MeshLambertMaterial( { color: color, map: THREE.ImageUtils.loadTexture( "textures/UV.jpg" ), envMap: reflectionCube, combine: THREE.MixOperation, reflectivity: 0.3 } );
+				var material = new THREE.MeshLambertMaterial( { color: color, map: THREE.ImageUtils.loadTexture( "textures/ash_uvgrid01.jpg" ), envMap: reflectionCube, combine: THREE.MixOperation, reflectivity: 0.3 } );
 				//material.shading =  THREE.FlatShading;
 				//material.shading =  THREE.FlatShading;
 
 
 				var mesh = new THREE.Mesh( geometry, material );
 				var mesh = new THREE.Mesh( geometry, material );

+ 1 - 8
gui/index.html

@@ -133,13 +133,8 @@
 
 
 						case 'js':
 						case 'js':
 
 
-							var blob = new BlobBuilder();
-							blob.append( contents );
-
-							var url = URL.createObjectURL( blob.getBlob() );
-
 							var loader = new THREE.JSONLoader();
 							var loader = new THREE.JSONLoader();
-							loader.load( url, function ( geometry ) {
+							loader.createModel( JSON.parse( contents ), function ( geometry ) {
 
 
 								geometry.gui = {
 								geometry.gui = {
 									paremeters: {
 									paremeters: {
@@ -168,8 +163,6 @@
 							var loader = new THREE.ColladaLoader();
 							var loader = new THREE.ColladaLoader();
 							loader.parse( xml, function ( collada ) {
 							loader.parse( xml, function ( collada ) {
 
 
-								// console.log( collada );
-
 								signals.added.dispatch( collada.scene );
 								signals.added.dispatch( collada.scene );
 
 
 							} );
 							} );

+ 19 - 61
src/extras/geometries/IcosahedronGeometry.js

@@ -78,34 +78,40 @@ THREE.IcosahedronGeometry = function ( subdivisions ) {
 			f3(a, b, c, tempFaces);
 			f3(a, b, c, tempFaces);
 		}
 		}
 		tempScope.faces = tempFaces.faces;
 		tempScope.faces = tempFaces.faces;
-		//tempScope.uvs = tempFaces.uvs;
+		tempScope.faceVertexUvs[ 0 ] = tempFaces.faceVertexUvs[ 0 ];
 	}
 	}
 
 
 	scope.faces = tempScope.faces;
 	scope.faces = tempScope.faces;
-	//scope.uvs = tempScope.uvs;
+	scope.faceVertexUvs[ 0 ] = tempScope.faceVertexUvs[ 0 ];
 
 
 	this.computeCentroids();
 	this.computeCentroids();
-	this.computeFaceNormals();
-	this.computeVertexNormals();
+	this.computeFaceNormals( true );
 
 
 	function v( x, y, z ) {
 	function v( x, y, z ) {
+
 		var length = Math.sqrt(x * x + y * y + z * z);
 		var length = Math.sqrt(x * x + y * y + z * z);
 		var i = scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x/length, y/length, z/length ) ) );
 		var i = scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x/length, y/length, z/length ) ) );
 
 
-		//var uv = getUv(x, y, z);
-		//temp_uv.push(uv);
-
 		return i-1;
 		return i-1;
 	}
 	}
 
 
 	function f3( a, b, c, inscope ) {
 	function f3( a, b, c, inscope ) {
-		inscope.faces.push( new THREE.Face3( a, b, c ) );
 
 
-		/*inscope.uvs.push( [new THREE.UV( temp_uv[a].u, temp_uv[a].v ),
-						   new THREE.UV( temp_uv[b].u, temp_uv[b].v ),
-						   new THREE.UV( temp_uv[c].u, temp_uv[c].v )
-						  ] );
-		*/
+		var v1 = scope.vertices[ a ].position;
+		var v2 = scope.vertices[ b ].position;
+		var v3 = scope.vertices[ c ].position;
+
+		var face = new THREE.Face3( a, b, c );
+		face.vertexNormals.push( v1.clone().normalize(), v2.clone().normalize(), v3.clone().normalize() );
+
+		inscope.faces.push( face );
+
+		inscope.faceVertexUvs[ 0 ].push( [
+			new THREE.UV( 1 - ( ( ( Math.atan2( v1.z, v1.x ) + Math.PI ) % Math.PI ) / Math.PI * 0.5 ), 0.5 - v1.y / 2 ),
+			new THREE.UV( 1 - ( ( ( Math.atan2( v2.z, v2.x ) + Math.PI ) % Math.PI ) / Math.PI * 0.5 ), 0.5 - v2.y / 2 ),
+			new THREE.UV( 1 - ( ( ( Math.atan2( v3.z, v3.x ) + Math.PI ) % Math.PI ) / Math.PI * 0.5 ), 0.5 - v3.y / 2 )
+		] );
+
 	}
 	}
 
 
 	function getMiddlePoint(p1,p2) {
 	function getMiddlePoint(p1,p2) {
@@ -120,54 +126,6 @@ THREE.IcosahedronGeometry = function ( subdivisions ) {
 		return i;
 		return i;
 	}
 	}
 
 
-	/*function getUv(x,y,z) {
-
-		var u,v;
-		var px,py,pz,d;
-
-		d = Math.sqrt( x*x+y*y+z*z );
-
-		px = x/d;
-		py = y/d;
-		pz = z/d;
-
-		var normalisedX = 0;
-		var normalisedZ = -1;
-
-		if (((px * px) + (pz * pz)) > 0) {
-			normalisedX = Math.sqrt((px * px) / ((px * px) + (pz * pz)));
-
-			if (px < 0) {
-				normalisedX = -normalisedX;
-			}
-
-			normalisedZ = Math.sqrt((pz * pz) / ((px * px) + (pz * pz)));
-
-			if (pz < 0)	{
-				normalisedZ = -normalisedZ;
-			}
-		}
-
-		if (normalisedZ == 0) {
-			u = ((normalisedX * Math.PI) / 2);
-		} else {
-			u = Math.atan(normalisedX / normalisedZ);
-
-			if (normalisedZ < 0) {
-				u += Math.PI;
-			}
-		}
-
-		if (u < 0) {
-			u += 2 * Math.PI;
-		}
-
-		u /= 2 * Math.PI;
-		v = (-py + 1) / 2;
-
-		return {u:u,v:v};
-	}*/
-
 }
 }
 
 
 THREE.IcosahedronGeometry.prototype = new THREE.Geometry();
 THREE.IcosahedronGeometry.prototype = new THREE.Geometry();

+ 49 - 70
src/extras/geometries/SphereGeometry.js

@@ -1,112 +1,91 @@
 /**
 /**
  * @author mr.doob / http://mrdoob.com/
  * @author mr.doob / http://mrdoob.com/
- * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Sphere.as
  */
  */
 
 
-THREE.SphereGeometry = function ( radius, segmentsWidth, segmentsHeight ) {
+THREE.SphereGeometry = function ( radius, segmentsWidth, segmentsHeight, phiStart, phiLength, thetaStart, thetaLength ) {
 
 
 	THREE.Geometry.call( this );
 	THREE.Geometry.call( this );
 
 
-	var radius = radius || 50,
-	gridX = segmentsWidth || 8,
-	gridY = segmentsHeight || 6;
+	var radius = radius || 50;
+	var segmentsX = Math.max( 3, Math.floor( segmentsWidth ) || 8 );
+	var segmentsY = Math.max( 2, Math.floor( segmentsHeight ) || 6 );
 
 
-	var i, j, pi = Math.PI;
-	var iHor = Math.max( 3, gridX );
-	var iVer = Math.max( 2, gridY );
-	var aVtc = [];
+	var phiStart = phiStart != undefined ? phiStart : 0;
+	var phiLength = phiLength != undefined ? phiLength : Math.PI * 2;
 
 
-	for ( j = 0; j < ( iVer + 1 ) ; j++ ) {
+	var thetaStart = thetaStart != undefined ? thetaStart : 0;
+	var thetaLength = thetaLength != undefined ? thetaLength : Math.PI;
 
 
-		var fRad1 = j / iVer;
-		var fZ = radius * Math.cos( fRad1 * pi );
-		var fRds = radius * Math.sin( fRad1 * pi );
-		var aRow = [];
-		var oVtx = 0;
+	var x, y, vertices = [], uvs = [];
 
 
-		for ( i = 0; i < iHor; i++ ) {
+	for ( y = 0; y <= segmentsY; y ++ ) {
 
 
-			var fRad2 = 2 * i / iHor;
-			var fX = fRds * Math.sin( fRad2 * pi );
-			var fY = fRds * Math.cos( fRad2 * pi );
+		var verticesRow = [];
+		var uvsRow = [];
 
 
-			if ( !( ( j == 0 || j == iVer ) && i > 0 ) ) {
+		for ( x = 0; x <= segmentsX; x ++ ) {
 
 
-				oVtx = this.vertices.push( new THREE.Vertex( new THREE.Vector3( fY, fZ, fX ) ) ) - 1;
+			var u = x / segmentsX;
+			var v = y / segmentsY;
 
 
-			}
+			var xpos = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
+			var ypos = radius * Math.cos( thetaStart + v * thetaLength );
+			var zpos = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
+
+			this.vertices.push( new THREE.Vertex( new THREE.Vector3( xpos, ypos, zpos ) ) );
 
 
-			aRow.push( oVtx );
+			verticesRow.push( this.vertices.length - 1 );
+			uvsRow.push( new THREE.UV( u, v ) );
 
 
 		}
 		}
 
 
-		aVtc.push( aRow );
+		vertices.push( verticesRow );
+		uvs.push( uvsRow );
 
 
 	}
 	}
 
 
-	var n1, n2, n3, iVerNum = aVtc.length;
-
-	for ( j = 0; j < iVerNum; j++ ) {
-
-		var iHorNum = aVtc[ j ].length;
-
-		if ( j > 0 ) {
-
-			for ( i = 0; i < iHorNum; i++ ) {
+	for ( y = 0; y < segmentsY; y ++ ) {
 
 
-				var bEnd = i == ( iHorNum - 1 );
-				var aP1 = aVtc[ j ][ bEnd ? 0 : i + 1 ];
-				var aP2 = aVtc[ j ][ ( bEnd ? iHorNum - 1 : i ) ];
-				var aP3 = aVtc[ j - 1 ][ ( bEnd ? iHorNum - 1 : i ) ];
-				var aP4 = aVtc[ j - 1 ][ bEnd ? 0 : i + 1 ];
+		for ( x = 0; x < segmentsX; x ++ ) {
 
 
-				var fJ0 = j / ( iVerNum - 1 );
-				var fJ1 = ( j - 1 ) / ( iVerNum - 1 );
-				var fI0 = ( i + 1 ) / iHorNum;
-				var fI1 = i / iHorNum;
+			var v1 = vertices[ y ][ x + 1 ];
+			var v2 = vertices[ y ][ x ];
+			var v3 = vertices[ y + 1 ][ x ];
+			var v4 = vertices[ y + 1 ][ x + 1 ];
 
 
-				var aP1uv = new THREE.UV( 1 - fI0, fJ0 );
-				var aP2uv = new THREE.UV( 1 - fI1, fJ0 );
-				var aP3uv = new THREE.UV( 1 - fI1, fJ1 );
-				var aP4uv = new THREE.UV( 1 - fI0, fJ1 );
+			var n1 = this.vertices[ v1 ].position.clone().normalize();
+			var n2 = this.vertices[ v2 ].position.clone().normalize();
+			var n3 = this.vertices[ v3 ].position.clone().normalize();
+			var n4 = this.vertices[ v4 ].position.clone().normalize();
 
 
-				if ( j < ( aVtc.length - 1 ) ) {
+			var uv1 = uvs[ y ][ x + 1 ].clone();
+			var uv2 = uvs[ y ][ x ].clone();
+			var uv3 = uvs[ y + 1 ][ x ].clone();
+			var uv4 = uvs[ y + 1 ][ x + 1 ].clone();
 
 
-					n1 = this.vertices[ aP1 ].position.clone();
-					n2 = this.vertices[ aP2 ].position.clone();
-					n3 = this.vertices[ aP3 ].position.clone();
-					n1.normalize();
-					n2.normalize();
-					n3.normalize();
+			if ( Math.abs( this.vertices[ v1 ].position.y ) == radius ) {
 
 
-					this.faces.push( new THREE.Face3( aP1, aP2, aP3, [ new THREE.Vector3( n1.x, n1.y, n1.z ), new THREE.Vector3( n2.x, n2.y, n2.z ), new THREE.Vector3( n3.x, n3.y, n3.z ) ] ) );
+				this.faces.push( new THREE.Face3( v1, v3, v4, [ n1, n3, n4 ] ) );
+				this.faceVertexUvs[ 0 ].push( [ uv1, uv3, uv4 ] );
 
 
-					this.faceVertexUvs[ 0 ].push( [ aP1uv, aP2uv, aP3uv ] );
+			} else if ( Math.abs( this.vertices[ v3 ].position.y ) ==  radius ) {
 
 
-				}
+				this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) );
+				this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] );
 
 
-				if ( j > 1 ) {
+			} else {
 
 
-					n1 = this.vertices[aP1].position.clone();
-					n2 = this.vertices[aP3].position.clone();
-					n3 = this.vertices[aP4].position.clone();
-					n1.normalize();
-					n2.normalize();
-					n3.normalize();
-
-					this.faces.push( new THREE.Face3( aP1, aP3, aP4, [ new THREE.Vector3( n1.x, n1.y, n1.z ), new THREE.Vector3( n2.x, n2.y, n2.z ), new THREE.Vector3( n3.x, n3.y, n3.z ) ] ) );
-
-					this.faceVertexUvs[ 0 ].push( [ aP1uv, aP3uv, aP4uv ] );
-
-				}
+				this.faces.push( new THREE.Face4( v1, v2, v3, v4, [ n1, n2, n3, n4 ] ) );
+				this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3, uv4 ] );
 
 
 			}
 			}
+
 		}
 		}
+
 	}
 	}
 
 
 	this.computeCentroids();
 	this.computeCentroids();
 	this.computeFaceNormals();
 	this.computeFaceNormals();
-	this.computeVertexNormals();
 
 
 	this.boundingSphere = { radius: radius };
 	this.boundingSphere = { radius: radius };