Browse Source

Some whitespace cleanup in ColladaLoader.

alteredq 14 years ago
parent
commit
5e4b62ac08

+ 202 - 202
build/Three.js

@@ -27,7 +27,7 @@ THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,m,k,n,
 c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(b,c).normalize();if(m.length()===0)m.z=1;f.cross(e,m).normalize();f.length()===0&&(m.x+=1.0E-4,f.cross(e,m).normalize());h.cross(m,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=m.x;this.n21=f.y;this.n22=h.y;this.n23=m.y;this.n31=f.z;this.n32=h.z;this.n33=m.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h;
 c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(b,c).normalize();if(m.length()===0)m.z=1;f.cross(e,m).normalize();f.length()===0&&(m.x+=1.0E-4,f.cross(e,m).normalize());h.cross(m,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=m.x;this.n21=f.y;this.n22=h.y;this.n23=m.y;this.n31=f.z;this.n32=h.z;this.n33=m.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h;
 b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
 b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
 e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,u=b.n23,p=b.n24,v=b.n31,t=b.n32,x=b.n33,w=b.n34,z=b.n41,y=b.n42,A=b.n43,E=b.n44,D=c.n11,G=c.n12,
 e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,u=b.n23,p=b.n24,v=b.n31,t=b.n32,x=b.n33,w=b.n34,z=b.n41,y=b.n42,A=b.n43,E=b.n44,D=c.n11,G=c.n12,
-I=c.n13,N=c.n14,P=c.n21,J=c.n22,H=c.n23,K=c.n24,Y=c.n31,C=c.n32,R=c.n33,O=c.n34,U=c.n41,V=c.n42,o=c.n43,ea=c.n44;this.n11=e*D+f*P+h*Y+m*U;this.n12=e*G+f*J+h*C+m*V;this.n13=e*I+f*H+h*R+m*o;this.n14=e*N+f*K+h*O+m*ea;this.n21=k*D+n*P+u*Y+p*U;this.n22=k*G+n*J+u*C+p*V;this.n23=k*I+n*H+u*R+p*o;this.n24=k*N+n*K+u*O+p*ea;this.n31=v*D+t*P+x*Y+w*U;this.n32=v*G+t*J+x*C+w*V;this.n33=v*I+t*H+x*R+w*o;this.n34=v*N+t*K+x*O+w*ea;this.n41=z*D+y*P+A*Y+E*U;this.n42=z*G+y*J+A*C+E*V;this.n43=z*I+y*H+A*R+E*o;this.n44=z*
+I=c.n13,N=c.n14,P=c.n21,J=c.n22,H=c.n23,K=c.n24,Z=c.n31,C=c.n32,R=c.n33,O=c.n34,V=c.n41,W=c.n42,o=c.n43,ea=c.n44;this.n11=e*D+f*P+h*Z+m*V;this.n12=e*G+f*J+h*C+m*W;this.n13=e*I+f*H+h*R+m*o;this.n14=e*N+f*K+h*O+m*ea;this.n21=k*D+n*P+u*Z+p*V;this.n22=k*G+n*J+u*C+p*W;this.n23=k*I+n*H+u*R+p*o;this.n24=k*N+n*K+u*O+p*ea;this.n31=v*D+t*P+x*Z+w*V;this.n32=v*G+t*J+x*C+w*W;this.n33=v*I+t*H+x*R+w*o;this.n34=v*N+t*K+x*O+w*ea;this.n41=z*D+y*P+A*Z+E*V;this.n42=z*G+y*J+A*C+E*W;this.n43=z*I+y*H+A*R+E*o;this.n44=z*
 N+y*K+A*O+E*ea;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=
 N+y*K+A*O+E*ea;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=
 b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,m=this.n22,k=this.n23,n=this.n24,u=this.n31,p=this.n32,v=this.n33,t=this.n34,x=this.n41,w=this.n42,z=this.n43,y=this.n44;return f*k*p*x-e*n*p*x-f*m*v*x+c*n*v*x+e*m*t*x-c*k*t*x-f*k*u*w+e*n*u*w+f*h*v*w-b*n*v*w-e*h*t*w+b*k*t*w+f*m*u*z-c*n*u*z-f*h*p*z+b*n*p*z+c*h*t*z-b*m*t*z-e*m*u*y+c*k*u*y+e*h*p*y-b*k*p*y-c*h*
 b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,m=this.n22,k=this.n23,n=this.n24,u=this.n31,p=this.n32,v=this.n33,t=this.n34,x=this.n41,w=this.n42,z=this.n43,y=this.n44;return f*k*p*x-e*n*p*x-f*m*v*x+c*n*v*x+e*m*t*x-c*k*t*x-f*k*u*w+e*n*u*w+f*h*v*w-b*n*v*w-e*h*t*w+b*k*t*w+f*m*u*z-c*n*u*z-f*h*p*z+b*n*p*z+c*h*t*z-b*m*t*z-e*m*u*y+c*k*u*y+e*h*p*y-b*k*p*y-c*h*
 v*y+b*m*v*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=
 v*y+b*m*v*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=
@@ -55,21 +55,21 @@ b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:fu
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 this.remove(b)}};THREE.Object3DCount=0;
 this.remove(b)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function b(){var b=u[n]=u[n]||new THREE.RenderableVertex;n++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,k=b.z+b.w,h=e.z+e.w,m=-b.z+b.w,n=-e.z+e.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,m=[],k,n,u=[],p,v,t=[],x,w=[],z,y,A=[],E,D,G=[],I=[],N=[],P=new THREE.Vector4,J=new THREE.Vector4,
 THREE.Projector=function(){function b(){var b=u[n]=u[n]||new THREE.RenderableVertex;n++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,k=b.z+b.w,h=e.z+e.w,m=-b.z+b.w,n=-e.z+e.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,m=[],k,n,u=[],p,v,t=[],x,w=[],z,y,A=[],E,D,G=[],I=[],N=[],P=new THREE.Vector4,J=new THREE.Vector4,
-H=new THREE.Matrix4,K=new THREE.Matrix4,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(b,e){H.multiply(e.projectionMatrix,e.matrixWorldInverse);H.multiplyVector3(b);return b};this.unprojectVector=function(b,e){H.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));H.multiplyVector3(b);return b};this.projectObjects=function(b,e,k){var o,n;h=I.length=0;
-o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var w;if(!(w=!n.visible))if(w=n instanceof THREE.Mesh)if(w=n.frustumCulled){a:{w=void 0;for(var t=n.matrixWorld,p=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(w=Y[u].x*t.n14+Y[u].y*t.n24+Y[u].z*t.n34+Y[u].w,w<=p){w=!1;break a}w=!0}w=!w}if(!w)w=m[h]=m[h]||new THREE.RenderableObject,h++,f=w,P.copy(n.position),H.multiplyVector3(P),f.object=n,f.z=P.z,I.push(f)}k&&I.sort(c);return I};this.projectScene=
-function(f,h,m){var o=h.near,I=h.far,S,P,$,qa,ka,ma,da,fa,T,Z,aa,ga,sa,la,ca,oa,ua;D=y=x=v=N.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);H.multiply(h.projectionMatrix,h.matrixWorldInverse);Y[0].set(H.n41-H.n11,H.n42-H.n12,H.n43-H.n13,H.n44-H.n14);Y[1].set(H.n41+H.n11,H.n42+H.n12,H.n43+H.n13,H.n44+H.n14);Y[2].set(H.n41+H.n21,H.n42+H.n22,H.n43+H.n23,H.n44+H.n24);Y[3].set(H.n41-H.n21,H.n42-H.n22,H.n43-H.n23,H.n44-H.n24);Y[4].set(H.n41-H.n31,H.n42-H.n32,H.n43-H.n33,H.n44-H.n34);
-Y[5].set(H.n41+H.n31,H.n42+H.n32,H.n43+H.n33,H.n44+H.n34);for(S=0;S<6;S++)T=Y[S],T.divideScalar(Math.sqrt(T.x*T.x+T.y*T.y+T.z*T.z));T=this.projectObjects(f,h,!0);f=0;for(S=T.length;f<S;f++)if(Z=T[f].object,Z.visible)if(aa=Z.matrixWorld,ga=Z.matrixRotationWorld,sa=Z.materials,la=Z.overdraw,n=0,Z instanceof THREE.Mesh){ca=Z.geometry;qa=ca.vertices;oa=ca.faces;ca=ca.faceVertexUvs;P=0;for($=qa.length;P<$;P++)k=b(),k.positionWorld.copy(qa[P].position),aa.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),
-H.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>o&&k.positionScreen.z<I;qa=0;for(P=oa.length;qa<P;qa++){$=oa[qa];if($ instanceof THREE.Face3)if(ka=u[$.a],ma=u[$.b],da=u[$.c],ka.visible&&ma.visible&&da.visible&&(Z.doubleSided||Z.flipSided!=(da.positionScreen.x-ka.positionScreen.x)*(ma.positionScreen.y-ka.positionScreen.y)-(da.positionScreen.y-ka.positionScreen.y)*(ma.positionScreen.x-ka.positionScreen.x)<
-0))fa=t[v]=t[v]||new THREE.RenderableFace3,v++,p=fa,p.v1.copy(ka),p.v2.copy(ma),p.v3.copy(da);else continue;else if($ instanceof THREE.Face4)if(ka=u[$.a],ma=u[$.b],da=u[$.c],fa=u[$.d],ka.visible&&ma.visible&&da.visible&&fa.visible&&(Z.doubleSided||Z.flipSided!=((fa.positionScreen.x-ka.positionScreen.x)*(ma.positionScreen.y-ka.positionScreen.y)-(fa.positionScreen.y-ka.positionScreen.y)*(ma.positionScreen.x-ka.positionScreen.x)<0||(ma.positionScreen.x-da.positionScreen.x)*(fa.positionScreen.y-da.positionScreen.y)-
-(ma.positionScreen.y-da.positionScreen.y)*(fa.positionScreen.x-da.positionScreen.x)<0)))ua=w[x]=w[x]||new THREE.RenderableFace4,x++,p=ua,p.v1.copy(ka),p.v2.copy(ma),p.v3.copy(da),p.v4.copy(fa);else continue;p.normalWorld.copy($.normal);ga.multiplyVector3(p.normalWorld);p.centroidWorld.copy($.centroid);aa.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);H.multiplyVector3(p.centroidScreen);da=$.vertexNormals;ka=0;for(ma=da.length;ka<ma;ka++)fa=p.vertexNormalsWorld[ka],fa.copy(da[ka]),
-ga.multiplyVector3(fa);ka=0;for(ma=ca.length;ka<ma;ka++)if(ua=ca[ka][qa]){da=0;for(fa=ua.length;da<fa;da++)p.uvs[ka][da]=ua[da]}p.meshMaterials=sa;p.faceMaterials=$.materials;p.overdraw=la;p.z=p.centroidScreen.z;N.push(p)}}else if(Z instanceof THREE.Line){K.multiply(H,aa);qa=Z.geometry.vertices;ka=b();ka.positionScreen.copy(qa[0].position);K.multiplyVector4(ka.positionScreen);P=1;for($=qa.length;P<$;P++)if(ka=b(),ka.positionScreen.copy(qa[P].position),K.multiplyVector4(ka.positionScreen),ma=u[n-2],
-C.copy(ka.positionScreen),R.copy(ma.positionScreen),e(C,R))C.multiplyScalar(1/C.w),R.multiplyScalar(1/R.w),aa=A[y]=A[y]||new THREE.RenderableLine,y++,z=aa,z.v1.positionScreen.copy(C),z.v2.positionScreen.copy(R),z.z=Math.max(C.z,R.z),z.materials=Z.materials,N.push(z)}else if(Z instanceof THREE.Particle&&(J.set(Z.matrixWorld.n14,Z.matrixWorld.n24,Z.matrixWorld.n34,1),H.multiplyVector4(J),J.z/=J.w,J.z>0&&J.z<1))aa=G[D]=G[D]||new THREE.RenderableParticle,D++,E=aa,E.x=J.x/J.w,E.y=J.y/J.w,E.z=J.z,E.rotation=
-Z.rotation.z,E.scale.x=Z.scale.x*Math.abs(E.x-(J.x+h.projectionMatrix.n11)/(J.w+h.projectionMatrix.n14)),E.scale.y=Z.scale.y*Math.abs(E.y-(J.y+h.projectionMatrix.n22)/(J.w+h.projectionMatrix.n24)),E.materials=Z.materials,N.push(E);m&&N.sort(c);return N}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
+H=new THREE.Matrix4,K=new THREE.Matrix4,Z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(b,e){H.multiply(e.projectionMatrix,e.matrixWorldInverse);H.multiplyVector3(b);return b};this.unprojectVector=function(b,e){H.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));H.multiplyVector3(b);return b};this.projectObjects=function(b,e,k){var o,n;h=I.length=0;
+o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var w;if(!(w=!n.visible))if(w=n instanceof THREE.Mesh)if(w=n.frustumCulled){a:{w=void 0;for(var t=n.matrixWorld,p=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(w=Z[u].x*t.n14+Z[u].y*t.n24+Z[u].z*t.n34+Z[u].w,w<=p){w=!1;break a}w=!0}w=!w}if(!w)w=m[h]=m[h]||new THREE.RenderableObject,h++,f=w,P.copy(n.position),H.multiplyVector3(P),f.object=n,f.z=P.z,I.push(f)}k&&I.sort(c);return I};this.projectScene=
+function(f,h,m){var o=h.near,I=h.far,S,P,aa,ka,ja,ma,da,$,U,T,fa,na,sa,la,ca,qa,ua;D=y=x=v=N.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);H.multiply(h.projectionMatrix,h.matrixWorldInverse);Z[0].set(H.n41-H.n11,H.n42-H.n12,H.n43-H.n13,H.n44-H.n14);Z[1].set(H.n41+H.n11,H.n42+H.n12,H.n43+H.n13,H.n44+H.n14);Z[2].set(H.n41+H.n21,H.n42+H.n22,H.n43+H.n23,H.n44+H.n24);Z[3].set(H.n41-H.n21,H.n42-H.n22,H.n43-H.n23,H.n44-H.n24);Z[4].set(H.n41-H.n31,H.n42-H.n32,H.n43-H.n33,H.n44-H.n34);
+Z[5].set(H.n41+H.n31,H.n42+H.n32,H.n43+H.n33,H.n44+H.n34);for(S=0;S<6;S++)U=Z[S],U.divideScalar(Math.sqrt(U.x*U.x+U.y*U.y+U.z*U.z));U=this.projectObjects(f,h,!0);f=0;for(S=U.length;f<S;f++)if(T=U[f].object,T.visible)if(fa=T.matrixWorld,na=T.matrixRotationWorld,sa=T.materials,la=T.overdraw,n=0,T instanceof THREE.Mesh){ca=T.geometry;ka=ca.vertices;qa=ca.faces;ca=ca.faceVertexUvs;P=0;for(aa=ka.length;P<aa;P++)k=b(),k.positionWorld.copy(ka[P].position),fa.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),
+H.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>o&&k.positionScreen.z<I;ka=0;for(P=qa.length;ka<P;ka++){aa=qa[ka];if(aa instanceof THREE.Face3)if(ja=u[aa.a],ma=u[aa.b],da=u[aa.c],ja.visible&&ma.visible&&da.visible&&(T.doubleSided||T.flipSided!=(da.positionScreen.x-ja.positionScreen.x)*(ma.positionScreen.y-ja.positionScreen.y)-(da.positionScreen.y-ja.positionScreen.y)*(ma.positionScreen.x-ja.positionScreen.x)<
+0))$=t[v]=t[v]||new THREE.RenderableFace3,v++,p=$,p.v1.copy(ja),p.v2.copy(ma),p.v3.copy(da);else continue;else if(aa instanceof THREE.Face4)if(ja=u[aa.a],ma=u[aa.b],da=u[aa.c],$=u[aa.d],ja.visible&&ma.visible&&da.visible&&$.visible&&(T.doubleSided||T.flipSided!=(($.positionScreen.x-ja.positionScreen.x)*(ma.positionScreen.y-ja.positionScreen.y)-($.positionScreen.y-ja.positionScreen.y)*(ma.positionScreen.x-ja.positionScreen.x)<0||(ma.positionScreen.x-da.positionScreen.x)*($.positionScreen.y-da.positionScreen.y)-
+(ma.positionScreen.y-da.positionScreen.y)*($.positionScreen.x-da.positionScreen.x)<0)))ua=w[x]=w[x]||new THREE.RenderableFace4,x++,p=ua,p.v1.copy(ja),p.v2.copy(ma),p.v3.copy(da),p.v4.copy($);else continue;p.normalWorld.copy(aa.normal);na.multiplyVector3(p.normalWorld);p.centroidWorld.copy(aa.centroid);fa.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);H.multiplyVector3(p.centroidScreen);da=aa.vertexNormals;ja=0;for(ma=da.length;ja<ma;ja++)$=p.vertexNormalsWorld[ja],$.copy(da[ja]),
+na.multiplyVector3($);ja=0;for(ma=ca.length;ja<ma;ja++)if(ua=ca[ja][ka]){da=0;for($=ua.length;da<$;da++)p.uvs[ja][da]=ua[da]}p.meshMaterials=sa;p.faceMaterials=aa.materials;p.overdraw=la;p.z=p.centroidScreen.z;N.push(p)}}else if(T instanceof THREE.Line){K.multiply(H,fa);ka=T.geometry.vertices;ja=b();ja.positionScreen.copy(ka[0].position);K.multiplyVector4(ja.positionScreen);P=1;for(aa=ka.length;P<aa;P++)if(ja=b(),ja.positionScreen.copy(ka[P].position),K.multiplyVector4(ja.positionScreen),ma=u[n-2],
+C.copy(ja.positionScreen),R.copy(ma.positionScreen),e(C,R))C.multiplyScalar(1/C.w),R.multiplyScalar(1/R.w),fa=A[y]=A[y]||new THREE.RenderableLine,y++,z=fa,z.v1.positionScreen.copy(C),z.v2.positionScreen.copy(R),z.z=Math.max(C.z,R.z),z.materials=T.materials,N.push(z)}else if(T instanceof THREE.Particle&&(J.set(T.matrixWorld.n14,T.matrixWorld.n24,T.matrixWorld.n34,1),H.multiplyVector4(J),J.z/=J.w,J.z>0&&J.z<1))fa=G[D]=G[D]||new THREE.RenderableParticle,D++,E=fa,E.x=J.x/J.w,E.y=J.y/J.w,E.z=J.z,E.rotation=
+T.rotation.z,E.scale.x=T.scale.x*Math.abs(E.x-(J.x+h.projectionMatrix.n11)/(J.w+h.projectionMatrix.n14)),E.scale.y=T.scale.y*Math.abs(E.y-(J.y+h.projectionMatrix.n22)/(J.w+h.projectionMatrix.n24)),E.materials=T.materials,N.push(E);m&&N.sort(c);return N}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),m=Math.cos(e),e=Math.sin(e),k=b*c,n=f*h;this.w=k*m-n*e;this.x=k*e+n*m;this.y=f*c*m+b*h*e;this.z=b*h*m-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),m=Math.cos(e),e=Math.sin(e),k=b*c,n=f*h;this.w=k*m-n*e;this.x=k*e+n*m;this.y=f*c*m+b*h*e;this.z=b*h*m-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
 this.x,e=this.y,f=this.z,h=this.w,m=b.x,k=b.y,n=b.z,b=b.w;this.x=c*b+h*m+e*n-f*k;this.y=e*b+h*k+f*m-c*n;this.z=f*b+h*n+c*k-e*m;this.w=h*b-c*m-e*k-f*n;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,m=this.x,k=this.y,n=this.z,u=this.w,p=u*e+k*h-n*f,v=u*f+n*e-m*h,t=u*h+m*f-k*e,e=-m*
 this.x,e=this.y,f=this.z,h=this.w,m=b.x,k=b.y,n=b.z,b=b.w;this.x=c*b+h*m+e*n-f*k;this.y=e*b+h*k+f*m-c*n;this.z=f*b+h*n+c*k-e*m;this.w=h*b-c*m-e*k-f*n;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,m=this.x,k=this.y,n=this.z,u=this.w,p=u*e+k*h-n*f,v=u*f+n*e-m*h,t=u*h+m*f-k*e,e=-m*
-e-k*f-n*h;c.x=p*u+e*-m+v*-n-t*-k;c.y=v*u+e*-k+t*-m-p*-n;c.z=t*u+e*-n+p*-k-v*-m;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.001)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*m)/k;f=Math.sin(f*m)/k;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e};
+e-k*f-n*h;c.x=p*u+e*-m+v*-n-t*-k;c.y=v*u+e*-k+t*-m-p*-n;c.z=t*u+e*-n+p*-k-v*-m;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*m)/k;f=Math.sin(f*m)/k;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e};
 THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,h,m){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];this.centroid=new THREE.Vector3};
 THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,h,m){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,e,f,h,m,k){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=m instanceof THREE.Color?m:new THREE.Color;this.vertexColors=m instanceof Array?m:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.Face4=function(b,c,e,f,h,m,k){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=m instanceof THREE.Color?m:new THREE.Color;this.vertexColors=m instanceof Array?m:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
@@ -79,9 +79,9 @@ c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid
 e,f,h,m,k,n=new THREE.Vector3,u=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){m=this.faces[f];if(b&&m.vertexNormals.length){n.set(0,0,0);c=0;for(e=m.vertexNormals.length;c<e;c++)n.addSelf(m.vertexNormals[c]);n.divideScalar(3)}else c=this.vertices[m.a],e=this.vertices[m.b],k=this.vertices[m.c],n.sub(k.position,e.position),u.sub(c.position,e.position),n.crossSelf(u);n.isZero()||n.normalize();m.normal.copy(n)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
 e,f,h,m,k,n=new THREE.Vector3,u=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){m=this.faces[f];if(b&&m.vertexNormals.length){n.set(0,0,0);c=0;for(e=m.vertexNormals.length;c<e;c++)n.addSelf(m.vertexNormals[c]);n.divideScalar(3)}else c=this.vertices[m.a],e=this.vertices[m.b],k=this.vertices[m.c],n.sub(k.position,e.position),u.sub(c.position,e.position),n.crossSelf(u);n.isZero()||n.normalize();m.normal.copy(n)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
 Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof
 Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof
 THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),
 THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,h,m,o){n=b.vertices[e].position;u=b.vertices[c].position;p=b.vertices[f].position;v=k[h];t=k[m];x=k[o];w=u.x-n.x;z=p.x-n.x;y=u.y-n.y;A=p.y-n.y;E=u.z-n.z;D=p.z-n.z;G=t.u-v.u;I=x.u-v.u;N=t.v-v.v;P=x.v-v.v;J=1/(G*P-I*N);C.set((P*w-N*z)*J,(P*y-N*A)*J,(P*E-N*D)*J);R.set((G*z-I*w)*J,(G*A-I*y)*J,(G*D-I*E)*J);K[e].addSelf(C);K[c].addSelf(C);K[f].addSelf(C);Y[e].addSelf(R);
-Y[c].addSelf(R);Y[f].addSelf(R)}var c,e,f,h,m,k,n,u,p,v,t,x,w,z,y,A,E,D,G,I,N,P,J,H,K=[],Y=[],C=new THREE.Vector3,R=new THREE.Vector3,O=new THREE.Vector3,U=new THREE.Vector3,V=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)K[c]=new THREE.Vector3,Y[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)m=this.faces[c],k=this.faceVertexUvs[0][c],m instanceof THREE.Face3?b(this,m.a,m.b,m.c,0,1,2):m instanceof THREE.Face4&&(b(this,m.a,m.b,m.c,0,1,2),b(this,m.a,m.b,m.d,0,1,3));var o=["a","b",
-"c","d"];c=0;for(e=this.faces.length;c<e;c++){m=this.faces[c];for(f=0;f<m.vertexNormals.length;f++)V.copy(m.vertexNormals[f]),h=m[o[f]],H=K[h],O.copy(H),O.subSelf(V.multiplyScalar(V.dot(H))).normalize(),U.cross(m.vertexNormals[f],H),h=U.dot(Y[h]),h=h<0?-1:1,m.vertexTangents[f]=new THREE.Vector4(O.x,O.y,O.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,h,m,o){n=b.vertices[e].position;u=b.vertices[c].position;p=b.vertices[f].position;v=k[h];t=k[m];x=k[o];w=u.x-n.x;z=p.x-n.x;y=u.y-n.y;A=p.y-n.y;E=u.z-n.z;D=p.z-n.z;G=t.u-v.u;I=x.u-v.u;N=t.v-v.v;P=x.v-v.v;J=1/(G*P-I*N);C.set((P*w-N*z)*J,(P*y-N*A)*J,(P*E-N*D)*J);R.set((G*z-I*w)*J,(G*A-I*y)*J,(G*D-I*E)*J);K[e].addSelf(C);K[c].addSelf(C);K[f].addSelf(C);Z[e].addSelf(R);
+Z[c].addSelf(R);Z[f].addSelf(R)}var c,e,f,h,m,k,n,u,p,v,t,x,w,z,y,A,E,D,G,I,N,P,J,H,K=[],Z=[],C=new THREE.Vector3,R=new THREE.Vector3,O=new THREE.Vector3,V=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)K[c]=new THREE.Vector3,Z[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)m=this.faces[c],k=this.faceVertexUvs[0][c],m instanceof THREE.Face3?b(this,m.a,m.b,m.c,0,1,2):m instanceof THREE.Face4&&(b(this,m.a,m.b,m.c,0,1,2),b(this,m.a,m.b,m.d,0,1,3));var o=["a","b",
+"c","d"];c=0;for(e=this.faces.length;c<e;c++){m=this.faces[c];for(f=0;f<m.vertexNormals.length;f++)W.copy(m.vertexNormals[f]),h=m[o[f]],H=K[h],O.copy(H),O.subSelf(W.multiplyScalar(W.dot(H))).normalize(),V.cross(m.vertexNormals[f],H),h=V.dot(Z[h]),h=h<0?-1:1,m.vertexTangents[f]=new THREE.Vector4(O.x,O.y,O.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,h,m,k,n=
 b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,h,m,k,n=
 {};e=0;for(f=this.faces.length;e<f;e++)k=this.faces[e],k instanceof THREE.Face3?(h=b(k.a,k.b),c(n,h,e),h=b(k.b,k.c),c(n,h,e),h=b(k.a,k.c),c(n,h,e)):k instanceof THREE.Face4&&(h=b(k.b,k.d),c(n,h,e),h=b(k.a,k.b),c(n,h,e),h=b(k.a,k.d),c(n,h,e),h=b(k.b,k.c),c(n,h,e),h=b(k.c,k.d),c(n,h,e));e=0;for(f=this.edges.length;e<f;e++){k=this.edges[e];h=k.vertexIndices[0];m=k.vertexIndices[1];k.faceIndices=n[b(h,m)].array;for(h=0;h<k.faceIndices.length;h++)m=k.faceIndices[h],k.faces.push(this.faces[m])}}};
 {};e=0;for(f=this.faces.length;e<f;e++)k=this.faces[e],k instanceof THREE.Face3?(h=b(k.a,k.b),c(n,h,e),h=b(k.b,k.c),c(n,h,e),h=b(k.a,k.c),c(n,h,e)):k instanceof THREE.Face4&&(h=b(k.b,k.d),c(n,h,e),h=b(k.a,k.b),c(n,h,e),h=b(k.a,k.d),c(n,h,e),h=b(k.b,k.c),c(n,h,e),h=b(k.c,k.d),c(n,h,e));e=0;for(f=this.edges.length;e<f;e++){k=this.edges[e];h=k.vertexIndices[0];m=k.vertexIndices[1];k.faceIndices=n[b(h,m)].array;for(h=0;h<k.faceIndices.length;h++)m=k.faceIndices[h],k.faces.push(this.faces[m])}}};
@@ -149,47 +149,47 @@ THREE.Scene.prototype.addObject=function(b){console.warn("DEPRECATED: Scene.addO
 THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
 THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,m;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;m=f/2};this.render=function(e,f){var u,p,v,t,x,w,z,y;b=c.projectScene(e,f);u=0;for(p=b.length;u<p;u++)if(x=b[u],x instanceof THREE.RenderableParticle){z=x.x*h+h;y=x.y*m+m;v=0;for(t=x.material.length;v<t;v++)if(w=x.material[v],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=z+"px",w.style.top=y+"px"}}};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,m;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;m=f/2};this.render=function(e,f){var u,p,v,t,x,w,z,y;b=c.projectScene(e,f);u=0;for(p=b.length;u<p;u++)if(x=b[u],x instanceof THREE.RenderableParticle){z=x.x*h+h;y=x.y*m+m;v=0;for(t=x.material.length;v<t;v++)if(w=x.material[v],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=z+"px",w.style.top=y+"px"}}};
 THREE.CanvasRenderer=function(b){function c(b){if(A!=b)w.globalAlpha=A=b}function e(b){if(E!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}E=b}}function f(b){if(D!=b)w.strokeStyle=D=b}function h(b){if(G!=b)w.fillStyle=G=b}var m=this,k=null,n=new THREE.Projector,b=b||{},u=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
 THREE.CanvasRenderer=function(b){function c(b){if(A!=b)w.globalAlpha=A=b}function e(b){if(E!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}E=b}}function f(b){if(D!=b)w.strokeStyle=D=b}function h(b){if(G!=b)w.fillStyle=G=b}var m=this,k=null,n=new THREE.Projector,b=b||{},u=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-p,v,t,x,w=u.getContext("2d"),z=new THREE.Color(0),y=0,A=1,E=0,D=null,G=null,I=null,N=null,P=null,J,H,K,Y,C=new THREE.RenderableVertex,R=new THREE.RenderableVertex,O,U,V,o,ea,S,na,$,qa,ka,ma,da,fa=new THREE.Color(0),T=new THREE.Color(0),Z=new THREE.Color(0),aa=new THREE.Color(0),ga=new THREE.Color(0),sa=[],la,ca,oa,ua,ta,Ba,Ca,va,Aa,Ea,L=new THREE.Rectangle,ha=new THREE.Rectangle,W=new THREE.Rectangle,M=!1,ra=new THREE.Color,ia=new THREE.Color,ya=new THREE.Color,xa=new THREE.Color,pa=new THREE.Vector3,
-za,X,Fa,ja,Va,Wa,b=16;za=document.createElement("canvas");za.width=za.height=2;X=za.getContext("2d");X.fillStyle="rgba(0,0,0,1)";X.fillRect(0,0,2,2);Fa=X.getImageData(0,0,2,2);ja=Fa.data;Va=document.createElement("canvas");Va.width=Va.height=b;Wa=Va.getContext("2d");Wa.translate(-b/2,-b/2);Wa.scale(b,b);b--;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,e){p=b;v=e;t=Math.floor(p/2);x=Math.floor(v/2);u.width=p;
-u.height=v;L.set(-t,-x,t,x);ha.set(-t,-x,t,x);A=1;E=0;P=N=I=G=D=null};this.setClearColor=function(b,e){z.copy(b);y=e;ha.set(-t,-x,t,x)};this.setClearColorHex=function(b,e){z.setHex(b);y=e;ha.set(-t,-x,t,x)};this.clear=function(){w.setTransform(1,0,0,-1,t,x);ha.isEmpty()||(ha.minSelf(L),ha.inflate(2),y<1&&w.clearRect(Math.floor(ha.getX()),Math.floor(ha.getY()),Math.floor(ha.getWidth()),Math.floor(ha.getHeight())),y>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+
-","+Math.floor(z.b*255)+","+y+")"),w.fillRect(Math.floor(ha.getX()),Math.floor(ha.getY()),Math.floor(ha.getWidth()),Math.floor(ha.getHeight()))),ha.empty())};this.render=function(b,u){function p(b){var e,c,f,k=b.lights;ia.setRGB(0,0,0);ya.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b<e;b++)c=k[b],f=c.color,c instanceof THREE.AmbientLight?(ia.r+=f.r,ia.g+=f.g,ia.b+=f.b):c instanceof THREE.DirectionalLight?(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b):c instanceof THREE.PointLight&&(xa.r+=f.r,xa.g+=f.g,xa.b+=
-f.b)}function v(b,e,c,f){var k,h,m,o,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],m=h.color,h instanceof THREE.DirectionalLight?(o=c.dot(h.position),o<=0||(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)):h instanceof THREE.PointLight&&(o=c.dot(pa.sub(h.position,e).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(e.distanceTo(h.position)/h.distance,1),o!=0&&(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)))}function z(b,k,m){c(m.opacity);e(m.blending);var o,n,u,ja,p,v;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)ja=
-m.map.image,p=ja.width>>1,v=ja.height>>1,m=k.scale.x*t,u=k.scale.y*x,o=m*p,n=u*v,W.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(W)&&(w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(m,-u),w.translate(-p,-v),w.drawImage(ja,0,0),w.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*t,n=k.scale.y*x,W.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(W)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(o,n),m.program(w),
-w.restore()))}function y(b,k,h,m){c(m.opacity);e(m.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(k.positionScreen.x,k.positionScreen.y);w.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(I!=b)w.lineWidth=I=b;b=m.linecap;if(N!=b)w.lineCap=N=b;b=m.linejoin;if(P!=b)w.lineJoin=P=b;f(m.color.getContextStyle());w.stroke();W.inflate(m.linewidth*2)}}function A(b,f,k,h,n,t,ja,p,w){m.info.render.vertices+=3;m.info.render.faces++;c(p.opacity);e(p.blending);
-O=b.positionScreen.x;U=b.positionScreen.y;V=f.positionScreen.x;o=f.positionScreen.y;ea=k.positionScreen.x;S=k.positionScreen.y;D(O,U,V,o,ea,S);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ua=ja.uvs[0],$a(O,U,V,o,ea,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[t].u,ua[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,pa.copy(ja.vertexNormalsWorld[0]),ta=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+
-0.5,Ba=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(ja.vertexNormalsWorld[1]),Ca=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,va=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(ja.vertexNormalsWorld[2]),Aa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Ea=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,$a(O,U,V,o,ea,S,ta,Ba,Ca,va,Aa,Ea,p.envMap)}else p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&
-!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ua=ja.uvs[0],$a(O,U,V,o,ea,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[t].u,ua[t].v,p.map)),e(THREE.SubtractiveBlending)),M?!p.wireframe&&p.shading==THREE.SmoothShading&&ja.vertexNormalsWorld.length==3?(T.r=Z.r=aa.r=ia.r,T.g=Z.g=aa.g=ia.g,T.b=Z.b=aa.b=ia.b,v(w,ja.v1.positionWorld,ja.vertexNormalsWorld[0],T),v(w,ja.v2.positionWorld,ja.vertexNormalsWorld[1],Z),v(w,ja.v3.positionWorld,ja.vertexNormalsWorld[2],aa),T.r=Math.max(0,Math.min(p.color.r*T.r,
-1)),T.g=Math.max(0,Math.min(p.color.g*T.g,1)),T.b=Math.max(0,Math.min(p.color.b*T.b,1)),Z.r=Math.max(0,Math.min(p.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(p.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(p.color.b*Z.b,1)),aa.r=Math.max(0,Math.min(p.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(p.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(p.color.b*aa.b,1)),ga.r=(Z.r+aa.r)*0.5,ga.g=(Z.g+aa.g)*0.5,ga.b=(Z.b+aa.b)*0.5,oa=Xa(T,Z,aa,ga),Sa(O,U,V,o,ea,S,0,0,1,0,0,1,oa)):(ra.r=ia.r,ra.g=ia.g,ra.b=ia.b,v(w,ja.centroidWorld,
-ja.normalWorld,ra),fa.r=Math.max(0,Math.min(p.color.r*ra.r,1)),fa.g=Math.max(0,Math.min(p.color.g*ra.g,1)),fa.b=Math.max(0,Math.min(p.color.b*ra.b,1)),p.wireframe?Ia(fa,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(fa)):p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshDepthMaterial)la=u.near,ca=u.far,T.r=T.g=T.b=1-Na(b.positionScreen.z,la,ca),Z.r=Z.g=Z.b=1-Na(f.positionScreen.z,la,ca),aa.r=aa.g=aa.b=1-
-Na(k.positionScreen.z,la,ca),ga.r=(Z.r+aa.r)*0.5,ga.g=(Z.g+aa.g)*0.5,ga.b=(Z.b+aa.b)*0.5,oa=Xa(T,Z,aa,ga),Sa(O,U,V,o,ea,S,0,0,1,0,0,1,oa);else if(p instanceof THREE.MeshNormalMaterial)fa.r=Ta(ja.normalWorld.x),fa.g=Ta(ja.normalWorld.y),fa.b=Ta(ja.normalWorld.z),p.wireframe?Ia(fa,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(fa)}function E(b,f,k,h,n,p,ja,t,w){m.info.render.vertices+=4;m.info.render.faces++;c(t.opacity);e(t.blending);if(t.map||t.envMap)A(b,f,h,0,1,3,ja,t,w),A(n,k,
-p,1,2,3,ja,t,w);else if(O=b.positionScreen.x,U=b.positionScreen.y,V=f.positionScreen.x,o=f.positionScreen.y,ea=k.positionScreen.x,S=k.positionScreen.y,na=h.positionScreen.x,$=h.positionScreen.y,qa=n.positionScreen.x,ka=n.positionScreen.y,ma=p.positionScreen.x,da=p.positionScreen.y,t instanceof THREE.MeshBasicMaterial)G(O,U,V,o,ea,S,na,$),t.wireframe?Ia(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(t.color);else if(t instanceof THREE.MeshLambertMaterial)M?!t.wireframe&&t.shading==
-THREE.SmoothShading&&ja.vertexNormalsWorld.length==4?(T.r=Z.r=aa.r=ga.r=ia.r,T.g=Z.g=aa.g=ga.g=ia.g,T.b=Z.b=aa.b=ga.b=ia.b,v(w,ja.v1.positionWorld,ja.vertexNormalsWorld[0],T),v(w,ja.v2.positionWorld,ja.vertexNormalsWorld[1],Z),v(w,ja.v4.positionWorld,ja.vertexNormalsWorld[3],aa),v(w,ja.v3.positionWorld,ja.vertexNormalsWorld[2],ga),T.r=Math.max(0,Math.min(t.color.r*T.r,1)),T.g=Math.max(0,Math.min(t.color.g*T.g,1)),T.b=Math.max(0,Math.min(t.color.b*T.b,1)),Z.r=Math.max(0,Math.min(t.color.r*Z.r,1)),
-Z.g=Math.max(0,Math.min(t.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(t.color.b*Z.b,1)),aa.r=Math.max(0,Math.min(t.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(t.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(t.color.b*aa.b,1)),ga.r=Math.max(0,Math.min(t.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(t.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(t.color.b*ga.b,1)),oa=Xa(T,Z,aa,ga),D(O,U,V,o,na,$),Sa(O,U,V,o,na,$,0,0,1,0,0,1,oa),D(qa,ka,ea,S,ma,da),Sa(qa,ka,ea,S,ma,da,1,0,1,1,0,1,oa)):(ra.r=ia.r,ra.g=ia.g,ra.b=ia.b,
-v(w,ja.centroidWorld,ja.normalWorld,ra),fa.r=Math.max(0,Math.min(t.color.r*ra.r,1)),fa.g=Math.max(0,Math.min(t.color.g*ra.g,1)),fa.b=Math.max(0,Math.min(t.color.b*ra.b,1)),G(O,U,V,o,ea,S,na,$),t.wireframe?Ia(fa,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(fa)):(G(O,U,V,o,ea,S,na,$),t.wireframe?Ia(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(t.color));else if(t instanceof THREE.MeshNormalMaterial)fa.r=Ta(ja.normalWorld.x),fa.g=Ta(ja.normalWorld.y),fa.b=
-Ta(ja.normalWorld.z),G(O,U,V,o,ea,S,na,$),t.wireframe?Ia(fa,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(fa);else if(t instanceof THREE.MeshDepthMaterial)la=u.near,ca=u.far,T.r=T.g=T.b=1-Na(b.positionScreen.z,la,ca),Z.r=Z.g=Z.b=1-Na(f.positionScreen.z,la,ca),aa.r=aa.g=aa.b=1-Na(h.positionScreen.z,la,ca),ga.r=ga.g=ga.b=1-Na(k.positionScreen.z,la,ca),oa=Xa(T,Z,aa,ga),D(O,U,V,o,na,$),Sa(O,U,V,o,na,$,0,0,1,0,0,1,oa),D(qa,ka,ea,S,ma,da),Sa(qa,ka,ea,S,ma,da,1,0,1,1,0,1,oa)}function D(b,
-e,c,f,k,h){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,h);w.lineTo(b,e);w.closePath()}function G(b,e,c,f,k,h,m,o){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,h);w.lineTo(m,o);w.lineTo(b,e);w.closePath()}function Ia(b,e,c,k){if(I!=e)w.lineWidth=I=e;if(N!=c)w.lineCap=N=c;if(P!=k)w.lineJoin=P=k;f(b.getContextStyle());w.stroke();W.inflate(e*2)}function Ja(b){h(b.getContextStyle());w.fill()}function $a(b,e,c,f,k,m,o,n,t,p,ja,u,v){if(v.image.width!=0){if(v.needsUpdate==!0||sa[v.id]==void 0){var x=
-v.wrapS==THREE.RepeatWrapping,Ma=v.wrapT==THREE.RepeatWrapping;sa[v.id]=w.createPattern(v.image,x&&Ma?"repeat":x&&!Ma?"repeat-x":!x&&Ma?"repeat-y":"no-repeat");v.needsUpdate=!1}h(sa[v.id]);var x=v.offset.x/v.repeat.x,Ma=v.offset.y/v.repeat.y,L=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,o=(o+x)*L,n=(n+Ma)*v,t=(t+x)*L,p=(p+Ma)*v,ja=(ja+x)*L,u=(u+Ma)*v;c-=b;f-=e;k-=b;m-=e;t-=o;p-=n;ja-=o;u-=n;x=1/(t*u-ja*p);v=(u*c-p*k)*x;p=(u*f-p*m)*x;c=(t*k-ja*c)*x;f=(t*m-ja*f)*x;b=b-v*o-c*n;e=e-p*
-o-f*n;w.save();w.transform(v,p,c,f,b,e);w.fill();w.restore()}}function Sa(b,e,c,f,k,h,m,o,n,t,p,ja,u){var v,x;v=u.width-1;x=u.height-1;m*=v;o*=x;n*=v;t*=x;p*=v;ja*=x;c-=b;f-=e;k-=b;h-=e;n-=m;t-=o;p-=m;ja-=o;x=1/(n*ja-p*t);v=(ja*c-t*k)*x;t=(ja*f-t*h)*x;c=(n*k-p*c)*x;f=(n*h-p*f)*x;b=b-v*m-c*o;e=e-t*m-f*o;w.save();w.transform(v,t,c,f,b,e);w.clip();w.drawImage(u,0,0);w.restore()}function Xa(b,e,c,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),n=~~(c.r*255),
-t=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);ja[0]=k<0?0:k>255?255:k;ja[1]=h<0?0:h>255?255:h;ja[2]=b<0?0:b>255?255:b;ja[4]=m<0?0:m>255?255:m;ja[5]=o<0?0:o>255?255:o;ja[6]=e<0?0:e>255?255:e;ja[8]=n<0?0:n>255?255:n;ja[9]=t<0?0:t>255?255:t;ja[10]=c<0?0:c>255?255:c;ja[12]=p<0?0:p>255?255:p;ja[13]=u<0?0:u>255?255:u;ja[14]=f<0?0:f>255?255:f;X.putImageData(Fa,0,0);Wa.drawImage(za,0,0);return Va}function Na(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ta(b){b=(b+1)*0.5;return b<
-0?0:b>1?1:b}function Ka(b,e){var c=e.x-b.x,f=e.y-b.y,k=c*c+f*f;k!=0&&(k=1/Math.sqrt(k),c*=k,f*=k,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ya,db,wa,Da,La,Ua,Za,F;this.autoClear?this.clear():w.setTransform(1,0,0,-1,t,x);m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,u,this.sortElements);(M=b.lights.length>0)&&p(b);Ya=0;for(db=k.length;Ya<db;Ya++){wa=k[Ya];W.empty();if(wa instanceof THREE.RenderableParticle){J=wa;J.x*=t;J.y*=x;Da=0;for(La=wa.materials.length;Da<La;)F=wa.materials[Da++],F.opacity!=
-0&&z(J,wa,F,b)}else if(wa instanceof THREE.RenderableLine){if(J=wa.v1,H=wa.v2,J.positionScreen.x*=t,J.positionScreen.y*=x,H.positionScreen.x*=t,H.positionScreen.y*=x,W.addPoint(J.positionScreen.x,J.positionScreen.y),W.addPoint(H.positionScreen.x,H.positionScreen.y),L.intersects(W)){Da=0;for(La=wa.materials.length;Da<La;)F=wa.materials[Da++],F.opacity!=0&&y(J,H,wa,F,b)}}else if(wa instanceof THREE.RenderableFace3){if(J=wa.v1,H=wa.v2,K=wa.v3,J.positionScreen.x*=t,J.positionScreen.y*=x,H.positionScreen.x*=
-t,H.positionScreen.y*=x,K.positionScreen.x*=t,K.positionScreen.y*=x,wa.overdraw&&(Ka(J.positionScreen,H.positionScreen),Ka(H.positionScreen,K.positionScreen),Ka(K.positionScreen,J.positionScreen)),W.add3Points(J.positionScreen.x,J.positionScreen.y,H.positionScreen.x,H.positionScreen.y,K.positionScreen.x,K.positionScreen.y),L.intersects(W)){Da=0;for(La=wa.meshMaterials.length;Da<La;)if(F=wa.meshMaterials[Da++],F instanceof THREE.MeshFaceMaterial){Ua=0;for(Za=wa.faceMaterials.length;Ua<Za;)(F=wa.faceMaterials[Ua++])&&
-F.opacity!=0&&A(J,H,K,0,1,2,wa,F,b)}else F.opacity!=0&&A(J,H,K,0,1,2,wa,F,b)}}else if(wa instanceof THREE.RenderableFace4&&(J=wa.v1,H=wa.v2,K=wa.v3,Y=wa.v4,J.positionScreen.x*=t,J.positionScreen.y*=x,H.positionScreen.x*=t,H.positionScreen.y*=x,K.positionScreen.x*=t,K.positionScreen.y*=x,Y.positionScreen.x*=t,Y.positionScreen.y*=x,C.positionScreen.copy(H.positionScreen),R.positionScreen.copy(Y.positionScreen),wa.overdraw&&(Ka(J.positionScreen,H.positionScreen),Ka(H.positionScreen,Y.positionScreen),
-Ka(Y.positionScreen,J.positionScreen),Ka(K.positionScreen,C.positionScreen),Ka(K.positionScreen,R.positionScreen)),W.addPoint(J.positionScreen.x,J.positionScreen.y),W.addPoint(H.positionScreen.x,H.positionScreen.y),W.addPoint(K.positionScreen.x,K.positionScreen.y),W.addPoint(Y.positionScreen.x,Y.positionScreen.y),L.intersects(W))){Da=0;for(La=wa.meshMaterials.length;Da<La;)if(F=wa.meshMaterials[Da++],F instanceof THREE.MeshFaceMaterial){Ua=0;for(Za=wa.faceMaterials.length;Ua<Za;)(F=wa.faceMaterials[Ua++])&&
-F.opacity!=0&&E(J,H,K,Y,C,R,wa,F,b)}else F.opacity!=0&&E(J,H,K,Y,C,R,wa,F,b)}ha.addRectangle(W)}w.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(b,e,c){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=e.normalWorld.dot(h.position)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(Y.sub(h.position,e.centroidWorld),Y.normalize(),m=e.normalWorld.dot(Y)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,k,o,n,t){m.info.render.vertices+=3;m.info.render.faces++;O=f(U++);
+p,v,t,x,w=u.getContext("2d"),z=new THREE.Color(0),y=0,A=1,E=0,D=null,G=null,I=null,N=null,P=null,J,H,K,Z,C=new THREE.RenderableVertex,R=new THREE.RenderableVertex,O,V,W,o,ea,S,ta,aa,ka,ja,ma,da,$=new THREE.Color(0),U=new THREE.Color(0),T=new THREE.Color(0),fa=new THREE.Color(0),na=new THREE.Color(0),sa=[],la,ca,qa,ua,ra,ya,Ca,va,Ba,Ea,L=new THREE.Rectangle,ga=new THREE.Rectangle,X=new THREE.Rectangle,M=!1,pa=new THREE.Color,ha=new THREE.Color,za=new THREE.Color,xa=new THREE.Color,oa=new THREE.Vector3,
+Aa,Y,Fa,ia,Va,Wa,b=16;Aa=document.createElement("canvas");Aa.width=Aa.height=2;Y=Aa.getContext("2d");Y.fillStyle="rgba(0,0,0,1)";Y.fillRect(0,0,2,2);Fa=Y.getImageData(0,0,2,2);ia=Fa.data;Va=document.createElement("canvas");Va.width=Va.height=b;Wa=Va.getContext("2d");Wa.translate(-b/2,-b/2);Wa.scale(b,b);b--;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,e){p=b;v=e;t=Math.floor(p/2);x=Math.floor(v/2);u.width=p;
+u.height=v;L.set(-t,-x,t,x);ga.set(-t,-x,t,x);A=1;E=0;P=N=I=G=D=null};this.setClearColor=function(b,e){z.copy(b);y=e;ga.set(-t,-x,t,x)};this.setClearColorHex=function(b,e){z.setHex(b);y=e;ga.set(-t,-x,t,x)};this.clear=function(){w.setTransform(1,0,0,-1,t,x);ga.isEmpty()||(ga.minSelf(L),ga.inflate(2),y<1&&w.clearRect(Math.floor(ga.getX()),Math.floor(ga.getY()),Math.floor(ga.getWidth()),Math.floor(ga.getHeight())),y>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+
+","+Math.floor(z.b*255)+","+y+")"),w.fillRect(Math.floor(ga.getX()),Math.floor(ga.getY()),Math.floor(ga.getWidth()),Math.floor(ga.getHeight()))),ga.empty())};this.render=function(b,u){function p(b){var e,c,f,k=b.lights;ha.setRGB(0,0,0);za.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b<e;b++)c=k[b],f=c.color,c instanceof THREE.AmbientLight?(ha.r+=f.r,ha.g+=f.g,ha.b+=f.b):c instanceof THREE.DirectionalLight?(za.r+=f.r,za.g+=f.g,za.b+=f.b):c instanceof THREE.PointLight&&(xa.r+=f.r,xa.g+=f.g,xa.b+=
+f.b)}function v(b,e,c,f){var k,h,m,o,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],m=h.color,h instanceof THREE.DirectionalLight?(o=c.dot(h.position),o<=0||(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)):h instanceof THREE.PointLight&&(o=c.dot(oa.sub(h.position,e).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(e.distanceTo(h.position)/h.distance,1),o!=0&&(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)))}function z(b,k,m){c(m.opacity);e(m.blending);var o,n,u,ia,p,v;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)ia=
+m.map.image,p=ia.width>>1,v=ia.height>>1,m=k.scale.x*t,u=k.scale.y*x,o=m*p,n=u*v,X.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(X)&&(w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(m,-u),w.translate(-p,-v),w.drawImage(ia,0,0),w.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*t,n=k.scale.y*x,X.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(X)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(o,n),m.program(w),
+w.restore()))}function y(b,k,h,m){c(m.opacity);e(m.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(k.positionScreen.x,k.positionScreen.y);w.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(I!=b)w.lineWidth=I=b;b=m.linecap;if(N!=b)w.lineCap=N=b;b=m.linejoin;if(P!=b)w.lineJoin=P=b;f(m.color.getContextStyle());w.stroke();X.inflate(m.linewidth*2)}}function A(b,f,k,h,n,t,ia,p,w){m.info.render.vertices+=3;m.info.render.faces++;c(p.opacity);e(p.blending);
+O=b.positionScreen.x;V=b.positionScreen.y;W=f.positionScreen.x;o=f.positionScreen.y;ea=k.positionScreen.x;S=k.positionScreen.y;D(O,V,W,o,ea,S);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ua=ia.uvs[0],$a(O,V,W,o,ea,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[t].u,ua[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,oa.copy(ia.vertexNormalsWorld[0]),ra=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+
+0.5,ya=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(ia.vertexNormalsWorld[1]),Ca=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,va=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(ia.vertexNormalsWorld[2]),Ba=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Ea=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,$a(O,V,W,o,ea,S,ra,ya,Ca,va,Ba,Ea,p.envMap)}else p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&
+!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ua=ia.uvs[0],$a(O,V,W,o,ea,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[t].u,ua[t].v,p.map)),e(THREE.SubtractiveBlending)),M?!p.wireframe&&p.shading==THREE.SmoothShading&&ia.vertexNormalsWorld.length==3?(U.r=T.r=fa.r=ha.r,U.g=T.g=fa.g=ha.g,U.b=T.b=fa.b=ha.b,v(w,ia.v1.positionWorld,ia.vertexNormalsWorld[0],U),v(w,ia.v2.positionWorld,ia.vertexNormalsWorld[1],T),v(w,ia.v3.positionWorld,ia.vertexNormalsWorld[2],fa),U.r=Math.max(0,Math.min(p.color.r*U.r,
+1)),U.g=Math.max(0,Math.min(p.color.g*U.g,1)),U.b=Math.max(0,Math.min(p.color.b*U.b,1)),T.r=Math.max(0,Math.min(p.color.r*T.r,1)),T.g=Math.max(0,Math.min(p.color.g*T.g,1)),T.b=Math.max(0,Math.min(p.color.b*T.b,1)),fa.r=Math.max(0,Math.min(p.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(p.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(p.color.b*fa.b,1)),na.r=(T.r+fa.r)*0.5,na.g=(T.g+fa.g)*0.5,na.b=(T.b+fa.b)*0.5,qa=Xa(U,T,fa,na),Sa(O,V,W,o,ea,S,0,0,1,0,0,1,qa)):(pa.r=ha.r,pa.g=ha.g,pa.b=ha.b,v(w,ia.centroidWorld,
+ia.normalWorld,pa),$.r=Math.max(0,Math.min(p.color.r*pa.r,1)),$.g=Math.max(0,Math.min(p.color.g*pa.g,1)),$.b=Math.max(0,Math.min(p.color.b*pa.b,1)),p.wireframe?Ia($,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja($)):p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshDepthMaterial)la=u.near,ca=u.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,la,ca),T.r=T.g=T.b=1-Na(f.positionScreen.z,la,ca),fa.r=fa.g=fa.b=1-Na(k.positionScreen.z,
+la,ca),na.r=(T.r+fa.r)*0.5,na.g=(T.g+fa.g)*0.5,na.b=(T.b+fa.b)*0.5,qa=Xa(U,T,fa,na),Sa(O,V,W,o,ea,S,0,0,1,0,0,1,qa);else if(p instanceof THREE.MeshNormalMaterial)$.r=Ta(ia.normalWorld.x),$.g=Ta(ia.normalWorld.y),$.b=Ta(ia.normalWorld.z),p.wireframe?Ia($,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja($)}function E(b,f,k,h,n,p,ia,t,w){m.info.render.vertices+=4;m.info.render.faces++;c(t.opacity);e(t.blending);if(t.map||t.envMap)A(b,f,h,0,1,3,ia,t,w),A(n,k,p,1,2,3,ia,t,w);else if(O=b.positionScreen.x,
+V=b.positionScreen.y,W=f.positionScreen.x,o=f.positionScreen.y,ea=k.positionScreen.x,S=k.positionScreen.y,ta=h.positionScreen.x,aa=h.positionScreen.y,ka=n.positionScreen.x,ja=n.positionScreen.y,ma=p.positionScreen.x,da=p.positionScreen.y,t instanceof THREE.MeshBasicMaterial)G(O,V,W,o,ea,S,ta,aa),t.wireframe?Ia(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(t.color);else if(t instanceof THREE.MeshLambertMaterial)M?!t.wireframe&&t.shading==THREE.SmoothShading&&ia.vertexNormalsWorld.length==
+4?(U.r=T.r=fa.r=na.r=ha.r,U.g=T.g=fa.g=na.g=ha.g,U.b=T.b=fa.b=na.b=ha.b,v(w,ia.v1.positionWorld,ia.vertexNormalsWorld[0],U),v(w,ia.v2.positionWorld,ia.vertexNormalsWorld[1],T),v(w,ia.v4.positionWorld,ia.vertexNormalsWorld[3],fa),v(w,ia.v3.positionWorld,ia.vertexNormalsWorld[2],na),U.r=Math.max(0,Math.min(t.color.r*U.r,1)),U.g=Math.max(0,Math.min(t.color.g*U.g,1)),U.b=Math.max(0,Math.min(t.color.b*U.b,1)),T.r=Math.max(0,Math.min(t.color.r*T.r,1)),T.g=Math.max(0,Math.min(t.color.g*T.g,1)),T.b=Math.max(0,
+Math.min(t.color.b*T.b,1)),fa.r=Math.max(0,Math.min(t.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(t.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(t.color.b*fa.b,1)),na.r=Math.max(0,Math.min(t.color.r*na.r,1)),na.g=Math.max(0,Math.min(t.color.g*na.g,1)),na.b=Math.max(0,Math.min(t.color.b*na.b,1)),qa=Xa(U,T,fa,na),D(O,V,W,o,ta,aa),Sa(O,V,W,o,ta,aa,0,0,1,0,0,1,qa),D(ka,ja,ea,S,ma,da),Sa(ka,ja,ea,S,ma,da,1,0,1,1,0,1,qa)):(pa.r=ha.r,pa.g=ha.g,pa.b=ha.b,v(w,ia.centroidWorld,ia.normalWorld,pa),$.r=Math.max(0,
+Math.min(t.color.r*pa.r,1)),$.g=Math.max(0,Math.min(t.color.g*pa.g,1)),$.b=Math.max(0,Math.min(t.color.b*pa.b,1)),G(O,V,W,o,ea,S,ta,aa),t.wireframe?Ia($,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja($)):(G(O,V,W,o,ea,S,ta,aa),t.wireframe?Ia(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(t.color));else if(t instanceof THREE.MeshNormalMaterial)$.r=Ta(ia.normalWorld.x),$.g=Ta(ia.normalWorld.y),$.b=Ta(ia.normalWorld.z),G(O,V,W,o,ea,S,ta,aa),t.wireframe?Ia($,
+t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja($);else if(t instanceof THREE.MeshDepthMaterial)la=u.near,ca=u.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,la,ca),T.r=T.g=T.b=1-Na(f.positionScreen.z,la,ca),fa.r=fa.g=fa.b=1-Na(h.positionScreen.z,la,ca),na.r=na.g=na.b=1-Na(k.positionScreen.z,la,ca),qa=Xa(U,T,fa,na),D(O,V,W,o,ta,aa),Sa(O,V,W,o,ta,aa,0,0,1,0,0,1,qa),D(ka,ja,ea,S,ma,da),Sa(ka,ja,ea,S,ma,da,1,0,1,1,0,1,qa)}function D(b,e,c,f,k,h){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,
+h);w.lineTo(b,e);w.closePath()}function G(b,e,c,f,k,h,m,o){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,h);w.lineTo(m,o);w.lineTo(b,e);w.closePath()}function Ia(b,e,c,k){if(I!=e)w.lineWidth=I=e;if(N!=c)w.lineCap=N=c;if(P!=k)w.lineJoin=P=k;f(b.getContextStyle());w.stroke();X.inflate(e*2)}function Ja(b){h(b.getContextStyle());w.fill()}function $a(b,e,c,f,k,m,o,n,t,p,ia,u,v){if(v.image.width!=0){if(v.needsUpdate==!0||sa[v.id]==void 0){var x=v.wrapS==THREE.RepeatWrapping,Ma=v.wrapT==THREE.RepeatWrapping;
+sa[v.id]=w.createPattern(v.image,x&&Ma?"repeat":x&&!Ma?"repeat-x":!x&&Ma?"repeat-y":"no-repeat");v.needsUpdate=!1}h(sa[v.id]);var x=v.offset.x/v.repeat.x,Ma=v.offset.y/v.repeat.y,L=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,o=(o+x)*L,n=(n+Ma)*v,t=(t+x)*L,p=(p+Ma)*v,ia=(ia+x)*L,u=(u+Ma)*v;c-=b;f-=e;k-=b;m-=e;t-=o;p-=n;ia-=o;u-=n;x=1/(t*u-ia*p);v=(u*c-p*k)*x;p=(u*f-p*m)*x;c=(t*k-ia*c)*x;f=(t*m-ia*f)*x;b=b-v*o-c*n;e=e-p*o-f*n;w.save();w.transform(v,p,c,f,b,e);w.fill();w.restore()}}
+function Sa(b,e,c,f,k,h,m,o,n,t,p,ia,u){var v,x;v=u.width-1;x=u.height-1;m*=v;o*=x;n*=v;t*=x;p*=v;ia*=x;c-=b;f-=e;k-=b;h-=e;n-=m;t-=o;p-=m;ia-=o;x=1/(n*ia-p*t);v=(ia*c-t*k)*x;t=(ia*f-t*h)*x;c=(n*k-p*c)*x;f=(n*h-p*f)*x;b=b-v*m-c*o;e=e-t*m-f*o;w.save();w.transform(v,t,c,f,b,e);w.clip();w.drawImage(u,0,0);w.restore()}function Xa(b,e,c,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),n=~~(c.r*255),t=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*
+255);ia[0]=k<0?0:k>255?255:k;ia[1]=h<0?0:h>255?255:h;ia[2]=b<0?0:b>255?255:b;ia[4]=m<0?0:m>255?255:m;ia[5]=o<0?0:o>255?255:o;ia[6]=e<0?0:e>255?255:e;ia[8]=n<0?0:n>255?255:n;ia[9]=t<0?0:t>255?255:t;ia[10]=c<0?0:c>255?255:c;ia[12]=p<0?0:p>255?255:p;ia[13]=u<0?0:u>255?255:u;ia[14]=f<0?0:f>255?255:f;Y.putImageData(Fa,0,0);Wa.drawImage(Aa,0,0);return Va}function Na(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ta(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ka(b,e){var c=e.x-b.x,f=e.y-b.y,k=c*c+f*f;
+k!=0&&(k=1/Math.sqrt(k),c*=k,f*=k,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ya,db,wa,Da,La,Ua,Za,F;this.autoClear?this.clear():w.setTransform(1,0,0,-1,t,x);m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,u,this.sortElements);(M=b.lights.length>0)&&p(b);Ya=0;for(db=k.length;Ya<db;Ya++){wa=k[Ya];X.empty();if(wa instanceof THREE.RenderableParticle){J=wa;J.x*=t;J.y*=x;Da=0;for(La=wa.materials.length;Da<La;)F=wa.materials[Da++],F.opacity!=0&&z(J,wa,F,b)}else if(wa instanceof THREE.RenderableLine){if(J=
+wa.v1,H=wa.v2,J.positionScreen.x*=t,J.positionScreen.y*=x,H.positionScreen.x*=t,H.positionScreen.y*=x,X.addPoint(J.positionScreen.x,J.positionScreen.y),X.addPoint(H.positionScreen.x,H.positionScreen.y),L.intersects(X)){Da=0;for(La=wa.materials.length;Da<La;)F=wa.materials[Da++],F.opacity!=0&&y(J,H,wa,F,b)}}else if(wa instanceof THREE.RenderableFace3){if(J=wa.v1,H=wa.v2,K=wa.v3,J.positionScreen.x*=t,J.positionScreen.y*=x,H.positionScreen.x*=t,H.positionScreen.y*=x,K.positionScreen.x*=t,K.positionScreen.y*=
+x,wa.overdraw&&(Ka(J.positionScreen,H.positionScreen),Ka(H.positionScreen,K.positionScreen),Ka(K.positionScreen,J.positionScreen)),X.add3Points(J.positionScreen.x,J.positionScreen.y,H.positionScreen.x,H.positionScreen.y,K.positionScreen.x,K.positionScreen.y),L.intersects(X)){Da=0;for(La=wa.meshMaterials.length;Da<La;)if(F=wa.meshMaterials[Da++],F instanceof THREE.MeshFaceMaterial){Ua=0;for(Za=wa.faceMaterials.length;Ua<Za;)(F=wa.faceMaterials[Ua++])&&F.opacity!=0&&A(J,H,K,0,1,2,wa,F,b)}else F.opacity!=
+0&&A(J,H,K,0,1,2,wa,F,b)}}else if(wa instanceof THREE.RenderableFace4&&(J=wa.v1,H=wa.v2,K=wa.v3,Z=wa.v4,J.positionScreen.x*=t,J.positionScreen.y*=x,H.positionScreen.x*=t,H.positionScreen.y*=x,K.positionScreen.x*=t,K.positionScreen.y*=x,Z.positionScreen.x*=t,Z.positionScreen.y*=x,C.positionScreen.copy(H.positionScreen),R.positionScreen.copy(Z.positionScreen),wa.overdraw&&(Ka(J.positionScreen,H.positionScreen),Ka(H.positionScreen,Z.positionScreen),Ka(Z.positionScreen,J.positionScreen),Ka(K.positionScreen,
+C.positionScreen),Ka(K.positionScreen,R.positionScreen)),X.addPoint(J.positionScreen.x,J.positionScreen.y),X.addPoint(H.positionScreen.x,H.positionScreen.y),X.addPoint(K.positionScreen.x,K.positionScreen.y),X.addPoint(Z.positionScreen.x,Z.positionScreen.y),L.intersects(X))){Da=0;for(La=wa.meshMaterials.length;Da<La;)if(F=wa.meshMaterials[Da++],F instanceof THREE.MeshFaceMaterial){Ua=0;for(Za=wa.faceMaterials.length;Ua<Za;)(F=wa.faceMaterials[Ua++])&&F.opacity!=0&&E(J,H,K,Z,C,R,wa,F,b)}else F.opacity!=
+0&&E(J,H,K,Z,C,R,wa,F,b)}ga.addRectangle(X)}w.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(b,e,c){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=e.normalWorld.dot(h.position)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(Z.sub(h.position,e.centroidWorld),Z.normalize(),m=e.normalWorld.dot(Z)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,k,o,n,t){m.info.render.vertices+=3;m.info.render.faces++;O=f(V++);
 O.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?I.copy(n.color):n instanceof THREE.MeshLambertMaterial?G?(N.r=P.r,N.g=P.g,N.b=P.b,b(t,o,N),I.r=Math.max(0,Math.min(n.color.r*N.r,1)),I.g=Math.max(0,Math.min(n.color.g*N.g,1)),I.b=Math.max(0,Math.min(n.color.b*N.b,1))):I.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-
 O.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?I.copy(n.color):n instanceof THREE.MeshLambertMaterial?G?(N.r=P.r,N.g=P.g,N.b=P.b,b(t,o,N),I.r=Math.max(0,Math.min(n.color.r*N.r,1)),I.g=Math.max(0,Math.min(n.color.g*N.g,1)),I.b=Math.max(0,Math.min(n.color.b*N.b,1))):I.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-
 o.z*n.__farMinusNear),I.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&I.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?O.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):O.setAttribute("style","fill: "+I.getContextStyle()+"; fill-opacity: "+n.opacity);u.appendChild(O)}function e(e,c,k,o,n,t,p){m.info.render.vertices+=
 o.z*n.__farMinusNear),I.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&I.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?O.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):O.setAttribute("style","fill: "+I.getContextStyle()+"; fill-opacity: "+n.opacity);u.appendChild(O)}function e(e,c,k,o,n,t,p){m.info.render.vertices+=
-4;m.info.render.faces++;O=f(U++);O.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?I.copy(t.color):t instanceof THREE.MeshLambertMaterial?G?(N.r=P.r,N.g=P.g,N.b=P.b,b(p,n,N),I.r=Math.max(0,Math.min(t.color.r*N.r,1)),I.g=Math.max(0,Math.min(t.color.g*N.g,1)),I.b=Math.max(0,Math.min(t.color.b*N.b,1))):
+4;m.info.render.faces++;O=f(V++);O.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?I.copy(t.color):t instanceof THREE.MeshLambertMaterial?G?(N.r=P.r,N.g=P.g,N.b=P.b,b(p,n,N),I.r=Math.max(0,Math.min(t.color.r*N.r,1)),I.g=Math.max(0,Math.min(t.color.g*N.g,1)),I.b=Math.max(0,Math.min(t.color.b*N.b,1))):
 I.copy(t.color):t instanceof THREE.MeshDepthMaterial?(K=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),I.setRGB(K,K,K)):t instanceof THREE.MeshNormalMaterial&&I.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));t.wireframe?O.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):O.setAttribute("style","fill: "+I.getContextStyle()+
 I.copy(t.color):t instanceof THREE.MeshDepthMaterial?(K=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),I.setRGB(K,K,K)):t instanceof THREE.MeshNormalMaterial&&I.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));t.wireframe?O.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):O.setAttribute("style","fill: "+I.getContextStyle()+
 "; fill-opacity: "+t.opacity);u.appendChild(O)}function f(b){C[b]==null&&(C[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&C[b].setAttribute("shape-rendering","crispEdges"));return C[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var m=this,k=null,n=new THREE.Projector,u=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,v,t,x,w,z,y,A,E=new THREE.Rectangle,D=new THREE.Rectangle,G=!1,I=new THREE.Color(16777215),N=new THREE.Color(16777215),P=new THREE.Color(0),
 "; fill-opacity: "+t.opacity);u.appendChild(O)}function f(b){C[b]==null&&(C[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&C[b].setAttribute("shape-rendering","crispEdges"));return C[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var m=this,k=null,n=new THREE.Projector,u=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,v,t,x,w,z,y,A,E=new THREE.Rectangle,D=new THREE.Rectangle,G=!1,I=new THREE.Color(16777215),N=new THREE.Color(16777215),P=new THREE.Color(0),
-J=new THREE.Color(0),H=new THREE.Color(0),K,Y=new THREE.Vector3,C=[],R=[],O,U,V,o=1;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){p=b;v=e;t=p/2;x=v/2;u.setAttribute("viewBox",-t+" "+-x+" "+p+" "+v);u.setAttribute("width",p);u.setAttribute("height",v);E.set(-t,-x,t,x)};this.clear=function(){for(;u.childNodes.length>0;)u.removeChild(u.childNodes[0])};
-this.render=function(b,f){var h,p,v,I,N,C,K,T;this.autoClear&&this.clear();m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,f,this.sortElements);V=U=0;if(G=b.lights.length>0){K=b.lights;P.setRGB(0,0,0);J.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(p=K.length;h<p;h++)v=K[h],I=v.color,v instanceof THREE.AmbientLight?(P.r+=I.r,P.g+=I.g,P.b+=I.b):v instanceof THREE.DirectionalLight?(J.r+=I.r,J.g+=I.g,J.b+=I.b):v instanceof THREE.PointLight&&(H.r+=I.r,H.g+=I.g,H.b+=I.b)}h=0;for(p=k.length;h<
-p;h++)if(K=k[h],D.empty(),K instanceof THREE.RenderableParticle){w=K;w.x*=t;w.y*=-x;v=0;for(I=K.materials.length;v<I;)v++}else if(K instanceof THREE.RenderableLine){if(w=K.v1,z=K.v2,w.positionScreen.x*=t,w.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,D.addPoint(w.positionScreen.x,w.positionScreen.y),D.addPoint(z.positionScreen.x,z.positionScreen.y),E.intersects(D)){v=0;for(I=K.materials.length;v<I;)if((T=K.materials[v++])&&T.opacity!=0){N=w;C=z;var Z=V++;R[Z]==null&&(R[Z]=document.createElementNS("http://www.w3.org/2000/svg",
-"line"),o==0&&R[Z].setAttribute("shape-rendering","crispEdges"));O=R[Z];O.setAttribute("x1",N.positionScreen.x);O.setAttribute("y1",N.positionScreen.y);O.setAttribute("x2",C.positionScreen.x);O.setAttribute("y2",C.positionScreen.y);T instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: "+T.color.getContextStyle()+"; stroke-width: "+T.linewidth+"; stroke-opacity: "+T.opacity+"; stroke-linecap: "+T.linecap+"; stroke-linejoin: "+T.linejoin),u.appendChild(O))}}}else if(K instanceof
-THREE.RenderableFace3){if(w=K.v1,z=K.v2,y=K.v3,w.positionScreen.x*=t,w.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,D.addPoint(w.positionScreen.x,w.positionScreen.y),D.addPoint(z.positionScreen.x,z.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),E.intersects(D)){v=0;for(I=K.meshMaterials.length;v<I;)if(T=K.meshMaterials[v++],T instanceof THREE.MeshFaceMaterial){N=0;for(C=K.faceMaterials.length;N<C;)(T=K.faceMaterials[N++])&&
-T.opacity!=0&&c(w,z,y,K,T,b)}else T&&T.opacity!=0&&c(w,z,y,K,T,b)}}else if(K instanceof THREE.RenderableFace4&&(w=K.v1,z=K.v2,y=K.v3,A=K.v4,w.positionScreen.x*=t,w.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,A.positionScreen.x*=t,A.positionScreen.y*=-x,D.addPoint(w.positionScreen.x,w.positionScreen.y),D.addPoint(z.positionScreen.x,z.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),D.addPoint(A.positionScreen.x,A.positionScreen.y),
-E.intersects(D))){v=0;for(I=K.meshMaterials.length;v<I;)if(T=K.meshMaterials[v++],T instanceof THREE.MeshFaceMaterial){N=0;for(C=K.faceMaterials.length;N<C;)(T=K.faceMaterials[N++])&&T.opacity!=0&&e(w,z,y,A,K,T,b)}else T&&T.opacity!=0&&e(w,z,y,A,K,T,b)}}};
+J=new THREE.Color(0),H=new THREE.Color(0),K,Z=new THREE.Vector3,C=[],R=[],O,V,W,o=1;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){p=b;v=e;t=p/2;x=v/2;u.setAttribute("viewBox",-t+" "+-x+" "+p+" "+v);u.setAttribute("width",p);u.setAttribute("height",v);E.set(-t,-x,t,x)};this.clear=function(){for(;u.childNodes.length>0;)u.removeChild(u.childNodes[0])};
+this.render=function(b,f){var h,p,v,I,N,C,K,U;this.autoClear&&this.clear();m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,f,this.sortElements);W=V=0;if(G=b.lights.length>0){K=b.lights;P.setRGB(0,0,0);J.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(p=K.length;h<p;h++)v=K[h],I=v.color,v instanceof THREE.AmbientLight?(P.r+=I.r,P.g+=I.g,P.b+=I.b):v instanceof THREE.DirectionalLight?(J.r+=I.r,J.g+=I.g,J.b+=I.b):v instanceof THREE.PointLight&&(H.r+=I.r,H.g+=I.g,H.b+=I.b)}h=0;for(p=k.length;h<
+p;h++)if(K=k[h],D.empty(),K instanceof THREE.RenderableParticle){w=K;w.x*=t;w.y*=-x;v=0;for(I=K.materials.length;v<I;)v++}else if(K instanceof THREE.RenderableLine){if(w=K.v1,z=K.v2,w.positionScreen.x*=t,w.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,D.addPoint(w.positionScreen.x,w.positionScreen.y),D.addPoint(z.positionScreen.x,z.positionScreen.y),E.intersects(D)){v=0;for(I=K.materials.length;v<I;)if((U=K.materials[v++])&&U.opacity!=0){N=w;C=z;var T=W++;R[T]==null&&(R[T]=document.createElementNS("http://www.w3.org/2000/svg",
+"line"),o==0&&R[T].setAttribute("shape-rendering","crispEdges"));O=R[T];O.setAttribute("x1",N.positionScreen.x);O.setAttribute("y1",N.positionScreen.y);O.setAttribute("x2",C.positionScreen.x);O.setAttribute("y2",C.positionScreen.y);U instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: "+U.color.getContextStyle()+"; stroke-width: "+U.linewidth+"; stroke-opacity: "+U.opacity+"; stroke-linecap: "+U.linecap+"; stroke-linejoin: "+U.linejoin),u.appendChild(O))}}}else if(K instanceof
+THREE.RenderableFace3){if(w=K.v1,z=K.v2,y=K.v3,w.positionScreen.x*=t,w.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,D.addPoint(w.positionScreen.x,w.positionScreen.y),D.addPoint(z.positionScreen.x,z.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),E.intersects(D)){v=0;for(I=K.meshMaterials.length;v<I;)if(U=K.meshMaterials[v++],U instanceof THREE.MeshFaceMaterial){N=0;for(C=K.faceMaterials.length;N<C;)(U=K.faceMaterials[N++])&&
+U.opacity!=0&&c(w,z,y,K,U,b)}else U&&U.opacity!=0&&c(w,z,y,K,U,b)}}else if(K instanceof THREE.RenderableFace4&&(w=K.v1,z=K.v2,y=K.v3,A=K.v4,w.positionScreen.x*=t,w.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,A.positionScreen.x*=t,A.positionScreen.y*=-x,D.addPoint(w.positionScreen.x,w.positionScreen.y),D.addPoint(z.positionScreen.x,z.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),D.addPoint(A.positionScreen.x,A.positionScreen.y),
+E.intersects(D))){v=0;for(I=K.meshMaterials.length;v<I;)if(U=K.meshMaterials[v++],U instanceof THREE.MeshFaceMaterial){N=0;for(C=K.faceMaterials.length;N<C;)(U=K.faceMaterials[N++])&&U.opacity!=0&&e(w,z,y,A,K,U,b)}else U&&U.opacity!=0&&e(w,z,y,A,K,U,b)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
@@ -225,120 +225,120 @@ THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderCh
 "void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 "void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}};
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function c(b,e,c){var f,k,h,m=b.vertices,n=m.length,t=b.colors,p=t.length,u=b.__vertexArray,w=b.__colorArray,v=b.__sortArray,x=b.__dirtyVertices,L=b.__dirtyColors,z=b.__webglCustomAttributes,W,y;if(z)for(W in z)z[W].offset=0;if(c.sortParticles){oa.multiplySelf(c.matrixWorld);for(f=0;f<n;f++)k=m[f].position,Ba.copy(k),oa.multiplyVector3(Ba),v[f]=[Ba.z,f];v.sort(function(b,e){return e[0]-b[0]});for(f=0;f<n;f++)k=m[v[f][1]].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;
-for(f=0;f<p;f++)h=f*3,color=t[v[f][1]],w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if(z)for(W in z){f=z[W];t=f.value.length;for(h=0;h<t;h++){index=v[h][1];p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[index];f.size===2?(f.array[p]=y.x,f.array[p+1]=y.y):f.size===3?f.type==="c"?(f.array[p]=y.r,f.array[p+1]=y.g,f.array[p+2]=y.b):(f.array[p]=y.x,f.array[p+1]=y.y,f.array[p+2]=y.z):(f.array[p]=
-y.x,f.array[p+1]=y.y,f.array[p+2]=y.z,f.array[p+3]=y.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;if(L)for(f=0;f<p;f++)color=t[f],h=f*3,w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if(z)for(W in z)if(f=z[W],f.__original.needsUpdate){t=f.value.length;for(h=0;h<t;h++){p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[h];f.size===2?(f.array[p]=
-y.x,f.array[p+1]=y.y):f.size===3?f.type==="c"?(f.array[p]=y.r,f.array[p+1]=y.g,f.array[p+2]=y.b):(f.array[p]=y.x,f.array[p+1]=y.y,f.array[p+2]=y.z):(f.array[p]=y.x,f.array[p+1]=y.y,f.array[p+2]=y.z,f.array[p+3]=y.w)}f.offset+=f.size}}}if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,u,e);if(L||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,w,e);if(z)for(W in z)if(f=z[W],f.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
-f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,k){f.program||V.initMaterial(f,e,c,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(V.maxMorphTargets);for(var h=0,m=V.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var h=f.program,m=h.uniforms,n=f.uniforms;h!=S&&(o.useProgram(h),S=h);o.uniformMatrix4fv(m.projectionMatrix,!1,ua);if(c&&f.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,
-n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var t,p,u,w=0,v=0,x=0,L,z,W,y=Ca,A=y.directional.colors,ha=y.directional.positions,E=y.point.colors,D=y.point.positions,G=y.point.distances,I=0,M=0,c=p=W=0;for(t=e.length;c<t;c++)if(p=e[c],u=p.color,L=p.position,z=p.intensity,W=p.distance,p instanceof THREE.AmbientLight)w+=u.r,v+=u.g,x+=u.b;else if(p instanceof THREE.DirectionalLight)W=
-I*3,A[W]=u.r*z,A[W+1]=u.g*z,A[W+2]=u.b*z,ha[W]=L.x,ha[W+1]=L.y,ha[W+2]=L.z,I+=1;else if(p instanceof THREE.SpotLight)W=I*3,A[W]=u.r*z,A[W+1]=u.g*z,A[W+2]=u.b*z,u=1/L.length(),ha[W]=L.x*u,ha[W+1]=L.y*u,ha[W+2]=L.z*u,I+=1;else if(p instanceof THREE.PointLight)p=M*3,E[p]=u.r*z,E[p+1]=u.g*z,E[p+2]=u.b*z,D[p]=L.x,D[p+1]=L.y,D[p+2]=L.z,G[M]=W,M+=1;for(c=I*3;c<A.length;c++)A[c]=0;for(c=M*3;c<E.length;c++)E[c]=0;y.point.length=M;y.directional.length=I;y.ambient[0]=w;y.ambient[1]=v;y.ambient[2]=x;e=Ca;n.enableLighting.value=
+THREE.WebGLRenderer=function(b){function c(b,e,c){var f,k,h,m=b.vertices,n=m.length,t=b.colors,p=t.length,u=b.__vertexArray,w=b.__colorArray,v=b.__sortArray,x=b.__dirtyVertices,L=b.__dirtyColors,z=b.__webglCustomAttributes,X,y;if(z)for(X in z)z[X].offset=0;if(c.sortParticles){qa.multiplySelf(c.matrixWorld);for(f=0;f<n;f++)k=m[f].position,ya.copy(k),qa.multiplyVector3(ya),v[f]=[ya.z,f];v.sort(function(b,e){return e[0]-b[0]});for(f=0;f<n;f++)k=m[v[f][1]].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;
+for(f=0;f<p;f++)h=f*3,color=t[v[f][1]],w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if(z)for(X in z){f=z[X];t=f.value.length;for(h=0;h<t;h++){index=v[h][1];p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[index];f.size===2?(f.array[p]=y.x,f.array[p+1]=y.y):f.size===3?f.type==="c"?(f.array[p]=y.r,f.array[p+1]=y.g,f.array[p+2]=y.b):(f.array[p]=y.x,f.array[p+1]=y.y,f.array[p+2]=y.z):(f.array[p]=
+y.x,f.array[p+1]=y.y,f.array[p+2]=y.z,f.array[p+3]=y.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;if(L)for(f=0;f<p;f++)color=t[f],h=f*3,w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if(z)for(X in z)if(f=z[X],f.__original.needsUpdate){t=f.value.length;for(h=0;h<t;h++){p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[h];f.size===2?(f.array[p]=
+y.x,f.array[p+1]=y.y):f.size===3?f.type==="c"?(f.array[p]=y.r,f.array[p+1]=y.g,f.array[p+2]=y.b):(f.array[p]=y.x,f.array[p+1]=y.y,f.array[p+2]=y.z):(f.array[p]=y.x,f.array[p+1]=y.y,f.array[p+2]=y.z,f.array[p+3]=y.w)}f.offset+=f.size}}}if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,u,e);if(L||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,w,e);if(z)for(X in z)if(f=z[X],f.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
+f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,k){f.program||W.initMaterial(f,e,c,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(W.maxMorphTargets);for(var h=0,m=W.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var h=f.program,m=h.uniforms,n=f.uniforms;h!=S&&(o.useProgram(h),S=h);o.uniformMatrix4fv(m.projectionMatrix,!1,ua);if(c&&f.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,
+n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var t,p,u,w=0,v=0,x=0,L,z,X,y=Ca,A=y.directional.colors,ga=y.directional.positions,E=y.point.colors,D=y.point.positions,G=y.point.distances,I=0,M=0,c=p=X=0;for(t=e.length;c<t;c++)if(p=e[c],u=p.color,L=p.position,z=p.intensity,X=p.distance,p instanceof THREE.AmbientLight)w+=u.r,v+=u.g,x+=u.b;else if(p instanceof THREE.DirectionalLight)X=
+I*3,A[X]=u.r*z,A[X+1]=u.g*z,A[X+2]=u.b*z,ga[X]=L.x,ga[X+1]=L.y,ga[X+2]=L.z,I+=1;else if(p instanceof THREE.SpotLight)X=I*3,A[X]=u.r*z,A[X+1]=u.g*z,A[X+2]=u.b*z,u=1/L.length(),ga[X]=L.x*u,ga[X+1]=L.y*u,ga[X+2]=L.z*u,I+=1;else if(p instanceof THREE.PointLight)p=M*3,E[p]=u.r*z,E[p+1]=u.g*z,E[p+2]=u.b*z,D[p]=L.x,D[p+1]=L.y,D[p+2]=L.z,G[M]=X,M+=1;for(c=I*3;c<A.length;c++)A[c]=0;for(c=M*3;c<E.length;c++)E[c]=0;y.point.length=M;y.directional.length=I;y.ambient[0]=w;y.ambient[1]=v;y.ambient[2]=x;e=Ca;n.enableLighting.value=
 e.directional.length+e.point.length;n.ambientLightColor.value=e.ambient;n.directionalLightColor.value=e.directional.colors;n.directionalLightDirection.value=e.directional.positions;n.pointLightColor.value=e.point.colors;n.pointLightPosition.value=e.point.positions;n.pointLightDistance.value=e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)n.diffuse.value=f.color,n.opacity.value=f.opacity,(n.map.texture=f.map)&&
 e.directional.length+e.point.length;n.ambientLightColor.value=e.ambient;n.directionalLightColor.value=e.directional.colors;n.directionalLightDirection.value=e.directional.positions;n.pointLightColor.value=e.point.colors;n.pointLightPosition.value=e.point.positions;n.pointLightDistance.value=e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)n.diffuse.value=f.color,n.opacity.value=f.opacity,(n.map.texture=f.map)&&
 n.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),n.lightMap.texture=f.lightMap,n.envMap.texture=f.envMap,n.reflectivity.value=f.reflectivity,n.refractionRatio.value=f.refractionRatio,n.combine.value=f.combine,n.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)n.diffuse.value=f.color,n.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)n.psColor.value=f.color,n.opacity.value=
 n.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),n.lightMap.texture=f.lightMap,n.envMap.texture=f.envMap,n.reflectivity.value=f.reflectivity,n.refractionRatio.value=f.refractionRatio,n.combine.value=f.combine,n.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)n.diffuse.value=f.color,n.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)n.psColor.value=f.color,n.opacity.value=
-f.opacity,n.size.value=f.size,n.scale.value=va.height/2,n.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)n.ambient.value=f.ambient,n.specular.value=f.specular,n.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)n.mNear.value=b.near,n.mFar.value=b.far,n.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)n.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&n.shadowMatrix){for(e=0;e<ra.length;e++)n.shadowMatrix.value[e]=ra[e],n.shadowMap.texture[e]=
-V.shadowMap[e];n.shadowDarkness.value=V.shadowMapDarkness;n.shadowBias.value=V.shadowMapBias}for(var la in n)if(t=h.uniforms[la])if(c=n[la],w=c.type,e=c.value,w=="i")o.uniform1i(t,e);else if(w=="f")o.uniform1f(t,e);else if(w=="v2")o.uniform2f(t,e.x,e.y);else if(w=="v3")o.uniform3f(t,e.x,e.y,e.z);else if(w=="v4")o.uniform4f(t,e.x,e.y,e.z,e.w);else if(w=="c")o.uniform3f(t,e.r,e.g,e.b);else if(w=="fv1")o.uniform1fv(t,e);else if(w=="fv")o.uniform3fv(t,e);else if(w=="v3v"){if(!c._array)c._array=new Float32Array(3*
+f.opacity,n.size.value=f.size,n.scale.value=va.height/2,n.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)n.ambient.value=f.ambient,n.specular.value=f.specular,n.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)n.mNear.value=b.near,n.mFar.value=b.far,n.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)n.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&n.shadowMatrix){for(e=0;e<pa.length;e++)n.shadowMatrix.value[e]=pa[e],n.shadowMap.texture[e]=
+W.shadowMap[e];n.shadowDarkness.value=W.shadowMapDarkness;n.shadowBias.value=W.shadowMapBias}for(var la in n)if(t=h.uniforms[la])if(c=n[la],w=c.type,e=c.value,w=="i")o.uniform1i(t,e);else if(w=="f")o.uniform1f(t,e);else if(w=="v2")o.uniform2f(t,e.x,e.y);else if(w=="v3")o.uniform3f(t,e.x,e.y,e.z);else if(w=="v4")o.uniform4f(t,e.x,e.y,e.z,e.w);else if(w=="c")o.uniform3f(t,e.r,e.g,e.b);else if(w=="fv1")o.uniform1fv(t,e);else if(w=="fv")o.uniform3fv(t,e);else if(w=="v3v"){if(!c._array)c._array=new Float32Array(3*
 e.length);w=0;for(v=e.length;w<v;w++)x=w*3,c._array[x]=e[w].x,c._array[x+1]=e[w].y,c._array[x+2]=e[w].z;o.uniform3fv(t,c._array)}else if(w=="m4"){if(!c._array)c._array=new Float32Array(16);e.flattenToArray(c._array);o.uniformMatrix4fv(t,!1,c._array)}else if(w=="m4v"){if(!c._array)c._array=new Float32Array(16*e.length);w=0;for(v=e.length;w<v;w++)e[w].flattenToArrayOffset(c._array,w*16);o.uniformMatrix4fv(t,!1,c._array)}else if(w=="t"){if(o.uniform1i(t,e),t=c.texture)if(t.image instanceof Array&&t.image.length==
 e.length);w=0;for(v=e.length;w<v;w++)x=w*3,c._array[x]=e[w].x,c._array[x+1]=e[w].y,c._array[x+2]=e[w].z;o.uniform3fv(t,c._array)}else if(w=="m4"){if(!c._array)c._array=new Float32Array(16);e.flattenToArray(c._array);o.uniformMatrix4fv(t,!1,c._array)}else if(w=="m4v"){if(!c._array)c._array=new Float32Array(16*e.length);w=0;for(v=e.length;w<v;w++)e[w].flattenToArrayOffset(c._array,w*16);o.uniformMatrix4fv(t,!1,c._array)}else if(w=="t"){if(o.uniform1i(t,e),t=c.texture)if(t.image instanceof Array&&t.image.length==
 6){if(c=t,c.image.length==6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);for(e=0;e<6;e++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,c.image[e]);H(o.TEXTURE_CUBE_MAP,c,c.image[0]);c.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?
 6){if(c=t,c.image.length==6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);for(e=0;e<6;e++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,c.image[e]);H(o.TEXTURE_CUBE_MAP,c,c.image[0]);c.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?
 (c=t,o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_CUBE_MAP,c.__webglTexture)):K(t,e)}else if(w=="tv"){if(!c._array){c._array=[];w=0;for(v=c.texture.length;w<v;w++)c._array[w]=e+w}o.uniform1iv(t,c._array);w=0;for(v=c.texture.length;w<v;w++)(t=c.texture[w])&&K(t,c._array[w])}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&
 (c=t,o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_CUBE_MAP,c.__webglTexture)):K(t,e)}else if(w=="tv"){if(!c._array){c._array=[];w=0;for(v=c.texture.length;w<v;w++)c._array[w]=e+w}o.uniform1iv(t,c._array);w=0;for(v=c.texture.length;w<v;w++)(t=c.texture[w])&&K(t,c._array[w])}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&
-m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,ta);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,ta),o.uniformMatrix4fv(m.boneGlobalMatrices,
+m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,ra);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,ra),o.uniformMatrix4fv(m.boneGlobalMatrices,
 !1,k.boneMatrices));return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,b=e(b,c,f,k,m).attributes;if(!k.morphTargets&&b.position>=0)o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0);else if(m.morphTargetBase){c=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),
 !1,k.boneMatrices));return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,b=e(b,c,f,k,m).attributes;if(!k.morphTargets&&b.position>=0)o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0);else if(m.morphTargetBase){c=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),
 o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var f=0,t=m.morphTargetForcedOrder,p=m.morphTargetInfluences;f<k.numSupportedMorphTargets&&f<t.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[t[f]]),o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[f]=p[t[f]],f++;else{var t=[],w=-1,u=0,p=m.morphTargetInfluences,v,x=p.length,f=0;for(m.morphTargetBase!==-1&&(t[m.morphTargetBase]=!0);f<k.numSupportedMorphTargets;){for(v=
 o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var f=0,t=m.morphTargetForcedOrder,p=m.morphTargetInfluences;f<k.numSupportedMorphTargets&&f<t.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[t[f]]),o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[f]=p[t[f]],f++;else{var t=[],w=-1,u=0,p=m.morphTargetInfluences,v,x=p.length,f=0;for(m.morphTargetBase!==-1&&(t[m.morphTargetBase]=!0);f<k.numSupportedMorphTargets;){for(v=
 0;v<x;v++)!t[v]&&p[v]>w&&(u=v,w=p[u]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[u]);o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[f]=w;t[u]=1;w=-1;f++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=0&&(c=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(b[n],
 0;v<x;v++)!t[v]&&p[v]>w&&(u=v,w=p[u]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[u]);o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[f]=w;t[u]=1;w=-1;f++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=0&&(c=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(b[n],
 c.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):
 c.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):
 o.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));k.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,
 o.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));k.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,
 4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0));m instanceof THREE.Mesh?(k.wireframe?(o.lineWidth(k.wireframeLinewidth),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,o.UNSIGNED_SHORT,0)):(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,
 4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0));m instanceof THREE.Mesh?(k.wireframe?(o.lineWidth(k.wireframeLinewidth),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,o.UNSIGNED_SHORT,0)):(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,
-h.__webglFaceCount,o.UNSIGNED_SHORT,0)),V.info.render.calls++,V.info.render.vertices+=h.__webglFaceCount,V.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),V.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),V.info.render.calls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),V.info.render.calls++)}}
+h.__webglFaceCount,o.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=h.__webglFaceCount,W.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),W.info.render.calls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),W.info.render.calls++)}}
 function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,k,m,n,t,p,w,u,v,x=b.count*
 function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,k,m,n,t,p,w,u,v,x=b.count*
-3;for(v=0;v<x;v+=9)c=b.normalArray,f=c[v],h=c[v+1],k=c[v+2],m=c[v+3],t=c[v+4],w=c[v+5],n=c[v+6],p=c[v+7],u=c[v+8],f=(f+m+n)/3,h=(h+t+p)/3,k=(k+w+u)/3,c[v]=f,c[v+1]=h,c[v+2]=k,c[v+3]=f,c[v+4]=h,c[v+5]=k,c[v+6]=f,c[v+7]=h,c[v+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(e.attributes.normal);o.vertexAttribPointer(e.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,b.count);b.count=0}function m(b){if($!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):
-o.enable(o.CULL_FACE),$=b.doubleSided;if(qa!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),qa=b.flipSided}function k(b){ma!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),ma=b)}function n(b){da!=b&&(o.depthMask(b),da=b)}function u(b,e,c){fa!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),fa=b);if(b&&(T!=e||Z!=c))o.polygonOffset(e,c),T=e,Z=c}function p(b){ca[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ca[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+
-b.n13,b.n44+b.n14);ca[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ca[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ca[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ca[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=ca[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function v(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=ca[f].x*e.n14+ca[f].y*e.n24+
-ca[f].z*e.n34+ca[f].w,b<=c)return!1;return!0}function t(b,e){b.list[b.count]=e;b.count+=1}function x(b){var e,c,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?t(k,c):t(h,c)}function w(b){var e,c,f,h,k=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=k.materials.length;b<f;b++)if(e=k.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=m.materials.length;e<c;e++)(h=m.materials[e])&&(h.transparent?
-t(o,h):t(n,h))}else(h=e)&&(h.transparent?t(o,h):t(n,h))}function z(b,e){return e.z-b.z}function y(b){var c,n,t,w=0,u,x,L,z,y=b.lights;M||(M=new THREE.Camera(V.shadowCameraFov,V.shadowMapWidth/V.shadowMapHeight,V.shadowCameraNear,V.shadowCameraFar));c=0;for(n=y.length;c<n;c++)if(t=y[c],t instanceof THREE.SpotLight&&t.castShadow){V.shadowMap[w]||(V.shadowMap[w]=new THREE.WebGLRenderTarget(V.shadowMapWidth,V.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
-ra[w]||(ra[w]=new THREE.Matrix4);u=V.shadowMap[w];x=ra[w];M.position.copy(t.position);M.target.position.copy(t.target.position);M.update(void 0,!0);b.update(void 0,!1,M);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(M.projectionMatrix);x.multiplySelf(M.matrixWorldInverse);M.matrixWorldInverse.flattenToArray(ta);M.projectionMatrix.flattenToArray(ua);oa.multiply(M.projectionMatrix,M.matrixWorldInverse);p(oa);V.initWebGLObjects(b);Y(u);o.clearColor(1,1,1,1);V.clear();o.clearColor(ha.r,
-ha.g,ha.b,W);x=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(u=0;u<x;u++)L=b.__webglObjects[u],z=L.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||v(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,M,!1),L.render=!0):L.render=!1:L.render=!1;k(!0);J(THREE.NormalBlending);for(u=0;u<x;u++)if(L=b.__webglObjects[u],L.render)z=L.object,buffer=L.buffer,m(z),L=z.customDepthMaterial?z.customDepthMaterial:z.geometry.morphTargets.length?xa:ya,f(M,y,null,
-L,buffer,z);for(u=0;u<t;u++)L=b.__webglObjectsImmediate[u],z=L.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,M,!1),m(z),program=e(M,y,null,ya,z),z.render(function(b){h(b,program,ya.shading)}));w++}}function A(b,e){var c,f,h;c=X.attributes;var k=X.uniforms,m=la/sa,n,t=[],p=sa*0.5,u=la*0.5,w=!0;o.useProgram(X.program);S=X.program;ma=ka=-1;Fa||(o.enableVertexAttribArray(X.attributes.position),o.enableVertexAttribArray(X.attributes.uv),Fa=
-!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,ua);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,
+3;for(v=0;v<x;v+=9)c=b.normalArray,f=c[v],h=c[v+1],k=c[v+2],m=c[v+3],t=c[v+4],w=c[v+5],n=c[v+6],p=c[v+7],u=c[v+8],f=(f+m+n)/3,h=(h+t+p)/3,k=(k+w+u)/3,c[v]=f,c[v+1]=h,c[v+2]=k,c[v+3]=f,c[v+4]=h,c[v+5]=k,c[v+6]=f,c[v+7]=h,c[v+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(e.attributes.normal);o.vertexAttribPointer(e.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,b.count);b.count=0}function m(b){if(aa!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):
+o.enable(o.CULL_FACE),aa=b.doubleSided;if(ka!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),ka=b.flipSided}function k(b){ma!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),ma=b)}function n(b){da!=b&&(o.depthMask(b),da=b)}function u(b,e,c){$!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),$=b);if(b&&(U!=e||T!=c))o.polygonOffset(e,c),U=e,T=c}function p(b){ca[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ca[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,
+b.n44+b.n14);ca[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ca[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ca[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ca[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=ca[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function v(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=ca[f].x*e.n14+ca[f].y*e.n24+ca[f].z*
+e.n34+ca[f].w,b<=c)return!1;return!0}function t(b,e){b.list[b.count]=e;b.count+=1}function x(b){var e,c,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?t(k,c):t(h,c)}function w(b){var e,c,f,h,k=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=k.materials.length;b<f;b++)if(e=k.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=m.materials.length;e<c;e++)(h=m.materials[e])&&(h.transparent?
+t(o,h):t(n,h))}else(h=e)&&(h.transparent?t(o,h):t(n,h))}function z(b,e){return e.z-b.z}function y(b){var c,n,t,w=0,u,x,L,z,y=b.lights;M||(M=new THREE.Camera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar));c=0;for(n=y.length;c<n;c++)if(t=y[c],t instanceof THREE.SpotLight&&t.castShadow){W.shadowMap[w]||(W.shadowMap[w]=new THREE.WebGLRenderTarget(W.shadowMapWidth,W.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
+pa[w]||(pa[w]=new THREE.Matrix4);u=W.shadowMap[w];x=pa[w];M.position.copy(t.position);M.target.position.copy(t.target.position);M.update(void 0,!0);b.update(void 0,!1,M);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(M.projectionMatrix);x.multiplySelf(M.matrixWorldInverse);M.matrixWorldInverse.flattenToArray(ra);M.projectionMatrix.flattenToArray(ua);qa.multiply(M.projectionMatrix,M.matrixWorldInverse);p(qa);W.initWebGLObjects(b);Z(u);o.clearColor(1,1,1,1);W.clear();o.clearColor(ga.r,
+ga.g,ga.b,X);x=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(u=0;u<x;u++)L=b.__webglObjects[u],z=L.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||v(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,M,!1),L.render=!0):L.render=!1:L.render=!1;k(!0);J(THREE.NormalBlending);for(u=0;u<x;u++)if(L=b.__webglObjects[u],L.render)z=L.object,buffer=L.buffer,m(z),L=z.customDepthMaterial?z.customDepthMaterial:z.geometry.morphTargets.length?xa:za,f(M,y,null,
+L,buffer,z);for(u=0;u<t;u++)L=b.__webglObjectsImmediate[u],z=L.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,M,!1),m(z),program=e(M,y,null,za,z),z.render(function(b){h(b,program,za.shading)}));w++}}function A(b,e){var c,f,h;c=Y.attributes;var k=Y.uniforms,m=la/sa,n,t=[],p=sa*0.5,u=la*0.5,w=!0;o.useProgram(Y.program);S=Y.program;ma=ja=-1;Fa||(o.enableVertexAttribArray(Y.attributes.position),o.enableVertexAttribArray(Y.attributes.uv),Fa=
+!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,Y.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,ua);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,
 h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(z);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-p)/p,(u-h.position.y)/u,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,
 h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(z);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-p)/p,(u-h.position.y)/u,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,
 h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?la:1),t[0]=n*m*h.scale.x,t[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),o.uniform1f(k.opacity,h.opacity),o.uniform3f(k.color,h.color.r,h.color.g,h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,t),h.mergeWith3D&&!w?(o.enable(o.DEPTH_TEST),w=!0):!h.mergeWith3D&&w&&(o.disable(o.DEPTH_TEST),w=!1),J(h.blending),
 h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?la:1),t[0]=n*m*h.scale.x,t[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),o.uniform1f(k.opacity,h.opacity),o.uniform3f(k.color,h.color.r,h.color.g,h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,t),h.mergeWith3D&&!w?(o.enable(o.DEPTH_TEST),w=!0):!h.mergeWith3D&&w&&(o.disable(o.DEPTH_TEST),w=!1),J(h.blending),
 K(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(da)}function E(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function D(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function G(b){var e,
 K(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(da)}function E(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function D(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function G(b){var e,
 c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function I(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function N(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,k,m,n,o,t,p={},w=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h<k;h++)m=b.faces[h],n=m.materials,o=e(n),p[o]==
 c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function I(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function N(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,k,m,n,o,t,p={},w=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h<k;h++)m=b.faces[h],n=m.materials,o=e(n),p[o]==
 void 0&&(p[o]={hash:o,counter:0}),t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:w}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[t].vertices+m>65535&&(p[o].counter+=1,t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:w})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[u])}
 void 0&&(p[o]={hash:o,counter:0}),t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:w}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[t].vertices+m>65535&&(p[o].counter+=1,t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:w})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[u])}
-function P(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=ka){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,
-o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}ka=b}}function H(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,U(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,U(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,U(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,U(e.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,O(e.magFilter)),
-o.texParameteri(b,o.TEXTURE_MIN_FILTER,O(e.minFilter)))}function K(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),V.info.memory.textures++;o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,U(b.format),b.image.width,b.image.height,0,U(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);H(o.TEXTURE_2D,b,b.image);b.needsUpdate=
-!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function Y(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(e){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);H(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(),
-o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,U(b.format),b.width,b.height,0,U(b.format),U(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),H(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,U(b.format),b.width,b.height,0,U(b.format),U(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+
+function P(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=ja){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,
+o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}ja=b}}function H(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,V(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,V(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,V(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,V(e.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,O(e.magFilter)),
+o.texParameteri(b,o.TEXTURE_MIN_FILTER,O(e.minFilter)))}function K(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.info.memory.textures++;o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,V(b.format),b.image.width,b.image.height,0,V(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);H(o.TEXTURE_2D,b,b.image);b.needsUpdate=
+!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function Z(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(e){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);H(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(),
+o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),H(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+
 c,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,
 c,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,
-o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);e?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=sa,b=la,f=aa,h=ga);e!=na&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),na=e)}function C(b){b instanceof
+o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);e?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=sa,b=la,f=fa,h=na);e!=ta&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),ta=e)}function C(b){b instanceof
 THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function R(b,e){var c;b=="fragment"?c=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,e);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),
 THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function R(b,e){var c;b=="fragment"?c=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,e);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),
-console.error(e),null;return c}function O(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function U(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;
+console.error(e),null;return c}function O(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function V(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;
 case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;
 case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;
-case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var V=this,o,ea=[],S=null,na=null,$=null,qa=null,ka=null,ma=null,da=null,fa=null,T=null,Z=null,aa=0,ga=0,sa=0,la=0,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],oa=new THREE.Matrix4,ua=new Float32Array(16),ta=new Float32Array(16),Ba=new THREE.Vector4,Ca=
-{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Aa=b.stencil!==void 0?b.stencil:!0,Ea=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,L=b.antialias!==void 0?b.antialias:!1,ha=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),W=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,
-geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=va;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var M,ra=[],b=THREE.ShaderLib.depthRGBA,ia=THREE.UniformsUtils.clone(b.uniforms),ya=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,
-vertexShader:b.vertexShader,uniforms:ia}),xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ia,morphTargets:!0});ya._shadowPass=!0;xa._shadowPass=!0;try{if(!(o=va.getContext("experimental-webgl",{antialias:L,stencil:Aa,preserveDrawingBuffer:Ea})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(pa){console.error(pa)}o.clearColor(0,
-0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(ha.r,ha.g,ha.b,W);this.context=o;var za=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,X={};X.vertices=new Float32Array(16);X.faces=new Uint16Array(6);i=0;X.vertices[i++]=-1;X.vertices[i++]=-1;X.vertices[i++]=0;X.vertices[i++]=1;X.vertices[i++]=
-1;X.vertices[i++]=-1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=0;X.vertices[i++]=-1;X.vertices[i++]=1;X.vertices[i++]=0;i=X.vertices[i++]=0;X.faces[i++]=0;X.faces[i++]=1;X.faces[i++]=2;X.faces[i++]=0;X.faces[i++]=2;X.faces[i++]=3;X.vertexBuffer=o.createBuffer();X.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,X.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);
-o.bufferData(o.ELEMENT_ARRAY_BUFFER,X.faces,o.STATIC_DRAW);X.program=o.createProgram();o.attachShader(X.program,R("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(X.program,R("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(X.program);X.attributes={};X.uniforms={};X.attributes.position=o.getAttribLocation(X.program,"position");X.attributes.uv=o.getAttribLocation(X.program,"uv");X.uniforms.uvOffset=o.getUniformLocation(X.program,"uvOffset");X.uniforms.uvScale=o.getUniformLocation(X.program,
-"uvScale");X.uniforms.rotation=o.getUniformLocation(X.program,"rotation");X.uniforms.scale=o.getUniformLocation(X.program,"scale");X.uniforms.alignment=o.getUniformLocation(X.program,"alignment");X.uniforms.color=o.getUniformLocation(X.program,"color");X.uniforms.map=o.getUniformLocation(X.program,"map");X.uniforms.opacity=o.getUniformLocation(X.program,"opacity");X.uniforms.useScreenCoordinates=o.getUniformLocation(X.program,"useScreenCoordinates");X.uniforms.affectedByDistance=o.getUniformLocation(X.program,
-"affectedByDistance");X.uniforms.screenPosition=o.getUniformLocation(X.program,"screenPosition");X.uniforms.modelViewMatrix=o.getUniformLocation(X.program,"modelViewMatrix");X.uniforms.projectionMatrix=o.getUniformLocation(X.program,"projectionMatrix");var Fa=!1;this.setSize=function(b,e){va.width=b;va.height=e;this.setViewport(0,0,va.width,va.height)};this.setViewport=function(b,e,c,f){aa=b;ga=e;sa=c;la=f;o.viewport(aa,ga,sa,la)};this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest=
-function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(b,e){ha.setHex(b);W=e;o.clearColor(ha.r,ha.g,ha.b,W)};this.setClearColor=function(b,e){ha.copy(b);W=e;o.clearColor(ha.r,ha.g,ha.b,W)};this.getClearColor=function(){return ha};this.getClearAlpha=function(){return W};this.clear=function(){o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT|o.STENCIL_BUFFER_BIT)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=
+case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var W=this,o,ea=[],S=null,ta=null,aa=null,ka=null,ja=null,ma=null,da=null,$=null,U=null,T=null,fa=0,na=0,sa=0,la=0,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Matrix4,ua=new Float32Array(16),ra=new Float32Array(16),ya=new THREE.Vector4,Ca=
+{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Ba=b.stencil!==void 0?b.stencil:!0,Ea=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,L=b.antialias!==void 0?b.antialias:!1,ga=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),X=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,
+geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=va;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var M,pa=[],b=THREE.ShaderLib.depthRGBA,ha=THREE.UniformsUtils.clone(b.uniforms),za=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,
+vertexShader:b.vertexShader,uniforms:ha}),xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ha,morphTargets:!0});za._shadowPass=!0;xa._shadowPass=!0;try{if(!(o=va.getContext("experimental-webgl",{antialias:L,stencil:Ba,preserveDrawingBuffer:Ea})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(oa){console.error(oa)}o.clearColor(0,
+0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(ga.r,ga.g,ga.b,X);this.context=o;var Aa=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,Y={};Y.vertices=new Float32Array(16);Y.faces=new Uint16Array(6);i=0;Y.vertices[i++]=-1;Y.vertices[i++]=-1;Y.vertices[i++]=0;Y.vertices[i++]=1;Y.vertices[i++]=
+1;Y.vertices[i++]=-1;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=0;Y.vertices[i++]=-1;Y.vertices[i++]=1;Y.vertices[i++]=0;i=Y.vertices[i++]=0;Y.faces[i++]=0;Y.faces[i++]=1;Y.faces[i++]=2;Y.faces[i++]=0;Y.faces[i++]=2;Y.faces[i++]=3;Y.vertexBuffer=o.createBuffer();Y.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,Y.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,Y.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);
+o.bufferData(o.ELEMENT_ARRAY_BUFFER,Y.faces,o.STATIC_DRAW);Y.program=o.createProgram();o.attachShader(Y.program,R("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(Y.program,R("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(Y.program);Y.attributes={};Y.uniforms={};Y.attributes.position=o.getAttribLocation(Y.program,"position");Y.attributes.uv=o.getAttribLocation(Y.program,"uv");Y.uniforms.uvOffset=o.getUniformLocation(Y.program,"uvOffset");Y.uniforms.uvScale=o.getUniformLocation(Y.program,
+"uvScale");Y.uniforms.rotation=o.getUniformLocation(Y.program,"rotation");Y.uniforms.scale=o.getUniformLocation(Y.program,"scale");Y.uniforms.alignment=o.getUniformLocation(Y.program,"alignment");Y.uniforms.color=o.getUniformLocation(Y.program,"color");Y.uniforms.map=o.getUniformLocation(Y.program,"map");Y.uniforms.opacity=o.getUniformLocation(Y.program,"opacity");Y.uniforms.useScreenCoordinates=o.getUniformLocation(Y.program,"useScreenCoordinates");Y.uniforms.affectedByDistance=o.getUniformLocation(Y.program,
+"affectedByDistance");Y.uniforms.screenPosition=o.getUniformLocation(Y.program,"screenPosition");Y.uniforms.modelViewMatrix=o.getUniformLocation(Y.program,"modelViewMatrix");Y.uniforms.projectionMatrix=o.getUniformLocation(Y.program,"projectionMatrix");var Fa=!1;this.setSize=function(b,e){va.width=b;va.height=e;this.setViewport(0,0,va.width,va.height)};this.setViewport=function(b,e,c,f){fa=b;na=e;sa=c;la=f;o.viewport(fa,na,sa,la)};this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest=
+function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(b,e){ga.setHex(b);X=e;o.clearColor(ga.r,ga.g,ga.b,X)};this.setClearColor=function(b,e){ga.copy(b);X=e;o.clearColor(ga.r,ga.g,ga.b,X)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return X};this.clear=function(){o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT|o.STENCIL_BUFFER_BIT)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=
 !1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];o.deleteBuffer(e.__webglVertexBuffer);o.deleteBuffer(e.__webglNormalBuffer);o.deleteBuffer(e.__webglTangentBuffer);o.deleteBuffer(e.__webglColorBuffer);o.deleteBuffer(e.__webglUVBuffer);o.deleteBuffer(e.__webglUV2Buffer);o.deleteBuffer(e.__webglSkinVertexABuffer);o.deleteBuffer(e.__webglSkinVertexBBuffer);
 !1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];o.deleteBuffer(e.__webglVertexBuffer);o.deleteBuffer(e.__webglNormalBuffer);o.deleteBuffer(e.__webglTangentBuffer);o.deleteBuffer(e.__webglColorBuffer);o.deleteBuffer(e.__webglUVBuffer);o.deleteBuffer(e.__webglUV2Buffer);o.deleteBuffer(e.__webglSkinVertexABuffer);o.deleteBuffer(e.__webglSkinVertexBBuffer);
-o.deleteBuffer(e.__webglSkinIndicesBuffer);o.deleteBuffer(e.__webglSkinWeightsBuffer);o.deleteBuffer(e.__webglFaceBuffer);o.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c<f;c++)o.deleteBuffer(e.__webglMorphTargetsBuffers[c]);V.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),V.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),
-o.deleteBuffer(b.__webglColorBuffer),V.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),V.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),V.info.memory.textures--};this.initMaterial=function(b,e,c,f){var h,k,m;b instanceof THREE.MeshDepthMaterial?m="depth":b instanceof THREE.MeshNormalMaterial?m="normal":b instanceof
+o.deleteBuffer(e.__webglSkinIndicesBuffer);o.deleteBuffer(e.__webglSkinWeightsBuffer);o.deleteBuffer(e.__webglFaceBuffer);o.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c<f;c++)o.deleteBuffer(e.__webglMorphTargetsBuffers[c]);W.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),
+o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),W.info.memory.textures--};this.initMaterial=function(b,e,c,f){var h,k,m;b instanceof THREE.MeshDepthMaterial?m="depth":b instanceof THREE.MeshNormalMaterial?m="normal":b instanceof
 THREE.MeshBasicMaterial?m="basic":b instanceof THREE.MeshLambertMaterial?m="lambert":b instanceof THREE.MeshPhongMaterial?m="phong":b instanceof THREE.LineBasicMaterial?m="basic":b instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var n=THREE.ShaderLib[m];b.uniforms=THREE.UniformsUtils.clone(n.uniforms);b.vertexShader=n.vertexShader;b.fragmentShader=n.fragmentShader}var t,p,w;t=w=n=0;for(p=e.length;t<p;t++)k=e[t],k instanceof THREE.SpotLight&&w++,k instanceof THREE.DirectionalLight&&
 THREE.MeshBasicMaterial?m="basic":b instanceof THREE.MeshLambertMaterial?m="lambert":b instanceof THREE.MeshPhongMaterial?m="phong":b instanceof THREE.LineBasicMaterial?m="basic":b instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var n=THREE.ShaderLib[m];b.uniforms=THREE.UniformsUtils.clone(n.uniforms);b.vertexShader=n.vertexShader;b.fragmentShader=n.fragmentShader}var t,p,w;t=w=n=0;for(p=e.length;t<p;t++)k=e[t],k instanceof THREE.SpotLight&&w++,k instanceof THREE.DirectionalLight&&
 w++,k instanceof THREE.PointLight&&n++;n+w<=_maxLights?t=w:(t=Math.ceil(_maxLights*w/(n+w)),n=_maxLights-t);k={directional:t,point:n};n=w=0;for(t=e.length;n<t;n++)p=e[n],p instanceof THREE.SpotLight&&p.castShadow&&w++;var u=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)u=f.bones.length;var v;a:{t=b.fragmentShader;p=b.vertexShader;var n=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,
 w++,k instanceof THREE.PointLight&&n++;n+w<=_maxLights?t=w:(t=Math.ceil(_maxLights*w/(n+w)),n=_maxLights-t);k={directional:t,point:n};n=w=0;for(t=e.length;n<t;n++)p=e[n],p instanceof THREE.SpotLight&&p.castShadow&&w++;var u=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)u=f.bones.length;var v;a:{t=b.fragmentShader;p=b.vertexShader;var n=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,
 skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:k.directional,maxPointLights:k.point,maxBones:u,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:w,alphaTest:b.alphaTest},x,f=[];m?f.push(m):(f.push(t),f.push(p));for(x in c)f.push(x),f.push(c[x]);m=f.join();x=0;for(f=ea.length;x<f;x++)if(ea[x].code==m){v=ea[x].program;break a}x=
 skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:k.directional,maxPointLights:k.point,maxBones:u,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:w,alphaTest:b.alphaTest},x,f=[];m?f.push(m):(f.push(t),f.push(p));for(x in c)f.push(x),f.push(c[x]);m=f.join();x=0;for(f=ea.length;x<f;x++)if(ea[x].code==m){v=ea[x].program;break a}x=
-o.createProgram();f=[za?"#define VERTEX_TEXTURES":"","#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.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":
+o.createProgram();f=[Aa?"#define VERTEX_TEXTURES":"","#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.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");
 k=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",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.shadowMapEnabled?"#define USE_SHADOWMAP":"",
 k=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",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.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");o.attachShader(x,R("fragment",k+t));o.attachShader(x,R("vertex",f+p));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+
 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");o.attachShader(x,R("fragment",k+t));o.attachShader(x,R("vertex",f+p));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+
 o.getError()+"]");x.uniforms={};x.attributes={};var L,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(L in n)f.push(L);L=f;f=0;for(n=L.length;f<n;f++)t=L[f],x.uniforms[t]=o.getUniformLocation(x,t);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(L=0;L<c.maxMorphTargets;L++)f.push("morphTarget"+L);for(v in e)f.push(v);
 o.getError()+"]");x.uniforms={};x.attributes={};var L,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(L in n)f.push(L);L=f;f=0;for(n=L.length;f<n;f++)t=L[f],x.uniforms[t]=o.getUniformLocation(x,t);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(L=0;L<c.maxMorphTargets;L++)f.push("morphTarget"+L);for(v in e)f.push(v);
-v=f;L=0;for(e=v.length;L<e;L++)c=v[L],x.attributes[c]=o.getAttribLocation(x,c);ea.push({program:x,code:m});V.info.memory.programs=ea.length;v=x}b.program=v;v=b.program.attributes;v.position>=0&&o.enableVertexAttribArray(v.position);v.color>=0&&o.enableVertexAttribArray(v.color);v.normal>=0&&o.enableVertexAttribArray(v.normal);v.tangent>=0&&o.enableVertexAttribArray(v.tangent);b.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(o.enableVertexAttribArray(v.skinVertexA),
-o.enableVertexAttribArray(v.skinVertexB),o.enableVertexAttribArray(v.skinIndex),o.enableVertexAttribArray(v.skinWeight));if(b.attributes)for(h in b.attributes)v[h]!==void 0&&v[h]>=0&&o.enableVertexAttribArray(v[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)L="morphTarget"+h,v[L]>=0&&(o.enableVertexAttribArray(v[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){Y(b);b=0;e&&(b|=o.COLOR_BUFFER_BIT);c&&(b|=o.DEPTH_BUFFER_BIT);f&&(b|=o.STENCIL_BUFFER_BIT);
-o.clear(b)};this.render=function(b,c,o,t){var L,W,ha,D,G,I,M,la,H=b.lights,K=b.fog;this.shadowMapEnabled&&y(b,c);V.info.render.calls=0;V.info.render.vertices=0;V.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ta);c.projectionMatrix.flattenToArray(ua);oa.multiply(c.projectionMatrix,c.matrixWorldInverse);p(oa);this.initWebGLObjects(b);Y(o);(this.autoClear||t)&&this.clear();G=b.__webglObjects.length;for(t=0;t<G;t++)if(L=b.__webglObjects[t],
-M=L.object,M.visible)if(!(M instanceof THREE.Mesh)||!M.frustumCulled||v(M)){if(M.matrixWorld.flattenToArray(M._objectMatrixArray),E(M,c,!0),w(L),L.render=!0,this.sortObjects)L.object.renderDepth?L.z=L.object.renderDepth:(Ba.copy(M.position),oa.multiplyVector3(Ba),L.z=Ba.z)}else L.render=!1;else L.render=!1;this.sortObjects&&b.__webglObjects.sort(z);I=b.__webglObjectsImmediate.length;for(t=0;t<I;t++)L=b.__webglObjectsImmediate[t],M=L.object,M.visible&&(M.matrixAutoUpdate&&M.matrixWorld.flattenToArray(M._objectMatrixArray),
-E(M,c,!0),x(L));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);J(b.overrideMaterial.blending);for(t=0;t<G;t++)if(L=b.__webglObjects[t],L.render)M=L.object,la=L.buffer,m(M),f(c,H,K,b.overrideMaterial,la,M);for(t=0;t<I;t++)L=b.__webglObjectsImmediate[t],M=L.object,M.visible&&(m(M),W=e(c,H,K,b.overrideMaterial,M),M.render(function(c){h(c,W,b.overrideMaterial.shading)}))}else{J(THREE.NormalBlending);for(t=G-1;t>=0;t--)if(L=b.__webglObjects[t],L.render){M=L.object;la=L.buffer;ha=L.opaque;m(M);
-for(L=0;L<ha.count;L++)D=ha.list[L],k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,H,K,D,la,M)}for(t=0;t<I;t++)if(L=b.__webglObjectsImmediate[t],M=L.object,M.visible){ha=L.opaque;m(M);for(L=0;L<ha.count;L++)D=ha.list[L],k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),W=e(c,H,K,D,M),M.render(function(b){h(b,W,D.shading)})}for(t=0;t<G;t++)if(L=b.__webglObjects[t],L.render){M=L.object;la=L.buffer;ha=L.transparent;
-m(M);for(L=0;L<ha.count;L++)D=ha.list[L],J(D.blending),k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,H,K,D,la,M)}for(t=0;t<I;t++)if(L=b.__webglObjectsImmediate[t],M=L.object,M.visible){ha=L.transparent;m(M);for(L=0;L<ha.count;L++)D=ha.list[L],J(D.blending),k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),W=e(c,H,K,D,M),M.render(function(b){h(b,W,D.shading)})}}b.__webglSprites.length&&A(b,c);o&&o.minFilter!==
+v=f;L=0;for(e=v.length;L<e;L++)c=v[L],x.attributes[c]=o.getAttribLocation(x,c);ea.push({program:x,code:m});W.info.memory.programs=ea.length;v=x}b.program=v;v=b.program.attributes;v.position>=0&&o.enableVertexAttribArray(v.position);v.color>=0&&o.enableVertexAttribArray(v.color);v.normal>=0&&o.enableVertexAttribArray(v.normal);v.tangent>=0&&o.enableVertexAttribArray(v.tangent);b.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(o.enableVertexAttribArray(v.skinVertexA),
+o.enableVertexAttribArray(v.skinVertexB),o.enableVertexAttribArray(v.skinIndex),o.enableVertexAttribArray(v.skinWeight));if(b.attributes)for(h in b.attributes)v[h]!==void 0&&v[h]>=0&&o.enableVertexAttribArray(v[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)L="morphTarget"+h,v[L]>=0&&(o.enableVertexAttribArray(v[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){Z(b);b=0;e&&(b|=o.COLOR_BUFFER_BIT);c&&(b|=o.DEPTH_BUFFER_BIT);f&&(b|=o.STENCIL_BUFFER_BIT);
+o.clear(b)};this.render=function(b,c,o,t){var L,X,ga,D,G,I,M,la,H=b.lights,K=b.fog;this.shadowMapEnabled&&y(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ra);c.projectionMatrix.flattenToArray(ua);qa.multiply(c.projectionMatrix,c.matrixWorldInverse);p(qa);this.initWebGLObjects(b);Z(o);(this.autoClear||t)&&this.clear();G=b.__webglObjects.length;for(t=0;t<G;t++)if(L=b.__webglObjects[t],
+M=L.object,M.visible)if(!(M instanceof THREE.Mesh)||!M.frustumCulled||v(M)){if(M.matrixWorld.flattenToArray(M._objectMatrixArray),E(M,c,!0),w(L),L.render=!0,this.sortObjects)L.object.renderDepth?L.z=L.object.renderDepth:(ya.copy(M.position),qa.multiplyVector3(ya),L.z=ya.z)}else L.render=!1;else L.render=!1;this.sortObjects&&b.__webglObjects.sort(z);I=b.__webglObjectsImmediate.length;for(t=0;t<I;t++)L=b.__webglObjectsImmediate[t],M=L.object,M.visible&&(M.matrixAutoUpdate&&M.matrixWorld.flattenToArray(M._objectMatrixArray),
+E(M,c,!0),x(L));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);J(b.overrideMaterial.blending);for(t=0;t<G;t++)if(L=b.__webglObjects[t],L.render)M=L.object,la=L.buffer,m(M),f(c,H,K,b.overrideMaterial,la,M);for(t=0;t<I;t++)L=b.__webglObjectsImmediate[t],M=L.object,M.visible&&(m(M),X=e(c,H,K,b.overrideMaterial,M),M.render(function(c){h(c,X,b.overrideMaterial.shading)}))}else{J(THREE.NormalBlending);for(t=G-1;t>=0;t--)if(L=b.__webglObjects[t],L.render){M=L.object;la=L.buffer;ga=L.opaque;m(M);
+for(L=0;L<ga.count;L++)D=ga.list[L],k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,H,K,D,la,M)}for(t=0;t<I;t++)if(L=b.__webglObjectsImmediate[t],M=L.object,M.visible){ga=L.opaque;m(M);for(L=0;L<ga.count;L++)D=ga.list[L],k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),X=e(c,H,K,D,M),M.render(function(b){h(b,X,D.shading)})}for(t=0;t<G;t++)if(L=b.__webglObjects[t],L.render){M=L.object;la=L.buffer;ga=L.transparent;
+m(M);for(L=0;L<ga.count;L++)D=ga.list[L],J(D.blending),k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,H,K,D,la,M)}for(t=0;t<I;t++)if(L=b.__webglObjectsImmediate[t],M=L.object,M.visible){ga=L.transparent;m(M);for(L=0;L<ga.count;L++)D=ga.list[L],J(D.blending),k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),X=e(c,H,K,D,M),M.render(function(b){h(b,X,D.shading)})}}b.__webglSprites.length&&A(b,c);o&&o.minFilter!==
 THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&C(o)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],f=b,h=void 0,k=void 0,m=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),
 THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&C(o)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],f=b,h=void 0,k=void 0,m=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),
 e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups==void 0&&N(k),k.geometryGroups){if(m=k.geometryGroups[h],!m.__webglVertexBuffer){var n=m;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();
 e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups==void 0&&N(k),k.geometryGroups){if(m=k.geometryGroups[h],!m.__webglVertexBuffer){var n=m;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();
-n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var t=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];t=0;for(p=n.numMorphTargets;t<p;t++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}V.info.memory.geometries++;for(var n=e,w=void 0,u=void 0,v=void 0,x=v=void 0,L=void 0,z=void 0,W=z=t=0,y=v=u=void 0,v=p=y=u=w=void 0,x=n.geometry,L=x.faces,y=m.faces,w=0,u=y.length;w<u;w++)v=y[w],v=L[v],v instanceof THREE.Face3?
-(t+=3,z+=1,W+=3):v instanceof THREE.Face4&&(t+=4,z+=2,W+=4);for(var w=m,u=n,ha=y=L=void 0,A=void 0,ha=void 0,v=[],L=0,y=u.materials.length;L<y;L++)if(ha=u.materials[L],ha instanceof THREE.MeshFaceMaterial){ha=0;for(l=w.materials.length;ha<l;ha++)(A=w.materials[ha])&&v.push(A)}else(A=ha)&&v.push(A);w=v;m.__materials=w;a:{L=u=void 0;y=w.length;for(u=0;u<y;u++)if(L=w[u],L.map||L.lightMap||L instanceof THREE.ShaderMaterial){u=!0;break a}u=!1}a:{y=L=void 0;v=w.length;for(L=0;L<v;L++)if(y=w[L],!(y instanceof
-THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{v=L=void 0;ha=w.length;for(L=0;L<ha;L++)if(v=w[L],v.vertexColors){v=v.vertexColors;break a}v=!1}m.__vertexArray=new Float32Array(t*3);if(y)m.__normalArray=new Float32Array(t*3);if(x.hasTangents)m.__tangentArray=new Float32Array(t*4);if(v)m.__colorArray=new Float32Array(t*3);if(u){if(x.faceUvs.length>0||x.faceVertexUvs.length>
-0)m.__uvArray=new Float32Array(t*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(t*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(t*4),m.__skinVertexBArray=new Float32Array(t*4),m.__skinIndexArray=new Float32Array(t*4),m.__skinWeightArray=new Float32Array(t*4);m.__faceArray=new Uint16Array(z*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(W*2);if(m.numMorphTargets){m.__morphTargetsArrays=
-[];x=0;for(L=m.numMorphTargets;x<L;x++)m.__morphTargetsArrays.push(new Float32Array(t*3))}m.__needsSmoothNormals=y==THREE.SmoothShading;m.__uvType=u;m.__vertexColorType=v;m.__normalType=y;m.__webglFaceCount=z*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0);m.__webglLineCount=W*2;x=0;for(L=w.length;x<L;x++)if(u=w[x],u.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in u.attributes){v=u.attributes[a];y={};for(p in v)y[p]=v[p];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=
+n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var t=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];t=0;for(p=n.numMorphTargets;t<p;t++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=e,w=void 0,u=void 0,v=void 0,x=v=void 0,L=void 0,z=void 0,X=z=t=0,y=v=u=void 0,v=p=y=u=w=void 0,x=n.geometry,L=x.faces,y=m.faces,w=0,u=y.length;w<u;w++)v=y[w],v=L[v],v instanceof THREE.Face3?
+(t+=3,z+=1,X+=3):v instanceof THREE.Face4&&(t+=4,z+=2,X+=4);for(var w=m,u=n,ga=y=L=void 0,A=void 0,ga=void 0,v=[],L=0,y=u.materials.length;L<y;L++)if(ga=u.materials[L],ga instanceof THREE.MeshFaceMaterial){ga=0;for(l=w.materials.length;ga<l;ga++)(A=w.materials[ga])&&v.push(A)}else(A=ga)&&v.push(A);w=v;m.__materials=w;a:{L=u=void 0;y=w.length;for(u=0;u<y;u++)if(L=w[u],L.map||L.lightMap||L instanceof THREE.ShaderMaterial){u=!0;break a}u=!1}a:{y=L=void 0;v=w.length;for(L=0;L<v;L++)if(y=w[L],!(y instanceof
+THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{v=L=void 0;ga=w.length;for(L=0;L<ga;L++)if(v=w[L],v.vertexColors){v=v.vertexColors;break a}v=!1}m.__vertexArray=new Float32Array(t*3);if(y)m.__normalArray=new Float32Array(t*3);if(x.hasTangents)m.__tangentArray=new Float32Array(t*4);if(v)m.__colorArray=new Float32Array(t*3);if(u){if(x.faceUvs.length>0||x.faceVertexUvs.length>
+0)m.__uvArray=new Float32Array(t*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(t*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(t*4),m.__skinVertexBArray=new Float32Array(t*4),m.__skinIndexArray=new Float32Array(t*4),m.__skinWeightArray=new Float32Array(t*4);m.__faceArray=new Uint16Array(z*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(X*2);if(m.numMorphTargets){m.__morphTargetsArrays=
+[];x=0;for(L=m.numMorphTargets;x<L;x++)m.__morphTargetsArrays.push(new Float32Array(t*3))}m.__needsSmoothNormals=y==THREE.SmoothShading;m.__uvType=u;m.__vertexColorType=v;m.__normalType=y;m.__webglFaceCount=z*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0);m.__webglLineCount=X*2;x=0;for(L=w.length;x<L;x++)if(u=w[x],u.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in u.attributes){v=u.attributes[a];y={};for(p in v)y[p]=v[p];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=
 !0,z=1,y.type==="v2"?z=2:y.type==="v3"?z=3:y.type==="v4"?z=4:y.type==="c"&&(z=3),y.size=z,y.array=new Float32Array(t*z),y.buffer=o.createBuffer(),y.buffer.belongsToAttribute=a,v.needsUpdate=!0,y.__original=v;m.__webglCustomAttributes[a]=y}}m.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=
 !0,z=1,y.type==="v2"?z=2:y.type==="v3"?z=3:y.type==="v4"?z=4:y.type==="c"&&(z=3),y.size=z,y.array=new Float32Array(t*z),y.buffer=o.createBuffer(),y.buffer.belongsToAttribute=a,v.needsUpdate=!0,y.__original=v;m.__webglCustomAttributes[a]=y}}m.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=
-o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),V.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.Line){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),V.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=
-new Float32Array(n*3),m.__webglLineCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(k=e.geometry,!k.__webglVertexBuffer)){m=k;m.__webglVertexBuffer=o.createBuffer();m.__webglColorBuffer=o.createBuffer();V.info.geometries++;m=k;n=e;t=m.vertices.length;m.__vertexArray=new Float32Array(t*3);m.__colorArray=new Float32Array(t*3);m.__sortArray=[];m.__webglParticleCount=t;m.__materials=n.materials;W=z=p=void 0;p=0;for(z=n.materials.length;p<z;p++)if(W=n.materials[p],
-W.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in W.attributes){originalAttribute=W.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(t*
+o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.Line){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=
+new Float32Array(n*3),m.__webglLineCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(k=e.geometry,!k.__webglVertexBuffer)){m=k;m.__webglVertexBuffer=o.createBuffer();m.__webglColorBuffer=o.createBuffer();W.info.geometries++;m=k;n=e;t=m.vertices.length;m.__vertexArray=new Float32Array(t*3);m.__colorArray=new Float32Array(t*3);m.__sortArray=[];m.__webglParticleCount=t;m.__materials=n.materials;X=z=p=void 0;p=0;for(z=n.materials.length;p<z;p++)if(X=n.materials[p],
+X.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in X.attributes){originalAttribute=X.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(t*
 size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=!0;k.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups)m=k.geometryGroups[h],P(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(k=e.geometry,P(f.__webglObjects,k,e)):THREE.MarchingCubes!==
 size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=!0;k.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups)m=k.geometryGroups[h],P(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(k=e.geometry,P(f.__webglObjects,k,e)):THREE.MarchingCubes!==
 void 0&&e instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];f=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)I(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;k=void 0;
 void 0&&e instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];f=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)I(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;k=void 0;
 for(k=f.length-1;k>=0;k--)f[k]==h&&f.splice(k,1)}else e instanceof THREE.MarchingCubes&&I(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,p=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(t=h.geometryGroupsList.length;n<t;n++)if(m=h.geometryGroupsList[n],p=D(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||
 for(k=f.length-1;k>=0;k--)f[k]==h&&f.splice(k,1)}else e instanceof THREE.MarchingCubes&&I(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,p=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(t=h.geometryGroupsList.length;n<t;n++)if(m=h.geometryGroupsList[n],p=D(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||
-p)if(p=m,z=o.DYNAMIC_DRAW,W=!h.dynamic,p.__inittedArrays){var E=w=x=void 0,M=void 0,la=E=void 0,H=void 0,K=void 0,ca=void 0,ia=A=ha=v=y=L=u=void 0,J=void 0,ra=void 0,F=M=ca=M=K=H=void 0,B=void 0,C=B=F=H=void 0,X=void 0,Z=C=B=F=E=E=la=ca=M=C=B=F=X=C=B=F=X=C=B=F=void 0,T=0,oa=0,R=0,ua=0,S=0,ya=0,O=0,Y=0,aa=0,Q=0,pa=0,C=F=0,C=void 0,U=p.__vertexArray,ka=p.__uvArray,qa=p.__uv2Array,fa=p.__normalArray,ga=p.__tangentArray,xa=p.__colorArray,$=p.__skinVertexAArray,ta=p.__skinVertexBArray,da=p.__skinIndexArray,
-ea=p.__skinWeightArray,ma=p.__morphTargetsArrays,sa=p.__webglCustomAttributes,B=void 0,za=p.__faceArray,na=p.__lineArray,Ba=p.__needsSmoothNormals,L=p.__vertexColorType,u=p.__uvType,y=p.__normalType,va=k.geometry,Ca=va.__dirtyVertices,Fa=va.__dirtyElements,Aa=va.__dirtyUvs,Ea=va.__dirtyNormals,ab=va.__dirtyTangents,bb=va.__dirtyColors,cb=va.__dirtyMorphTargets,Oa=va.vertices,eb=p.faces,hb=va.faces,fb=va.faceVertexUvs[0],gb=va.faceVertexUvs[1],Pa=va.skinVerticesA,Qa=va.skinVerticesB,Ra=va.skinIndices,
-Ha=va.skinWeights,Ga=va.morphTargets;if(sa)for(Z in sa)sa[Z].offset=0,sa[Z].offsetSrc=0;x=0;for(w=eb.length;x<w;x++)if(E=eb[x],M=hb[E],fb&&(v=fb[E]),gb&&(ha=gb[E]),E=M.vertexNormals,la=M.normal,H=M.vertexColors,K=M.color,ca=M.vertexTangents,M instanceof THREE.Face3){if(Ca)A=Oa[M.a].position,ia=Oa[M.b].position,J=Oa[M.c].position,U[oa]=A.x,U[oa+1]=A.y,U[oa+2]=A.z,U[oa+3]=ia.x,U[oa+4]=ia.y,U[oa+5]=ia.z,U[oa+6]=J.x,U[oa+7]=J.y,U[oa+8]=J.z,oa+=9;if(sa)for(Z in sa)if(B=sa[Z],B.__original.needsUpdate)F=
-B.offset,C=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[F]=B.value[M.a],B.array[F+1]=B.value[M.b],B.array[F+2]=B.value[M.c]):B.boundTo==="faces"?(C=B.value[C],B.array[F]=C,B.array[F+1]=C,B.array[F+2]=C,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[F]=B.value[C],B.array[F+1]=B.value[C+1],B.array[F+2]=B.value[C+2],B.offsetSrc+=3),B.offset+=3):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[M.a],ia=B.value[M.b],J=B.value[M.c]):B.boundTo==="faces"?(J=ia=A=C=
-B.value[C],B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[C],ia=B.value[C+1],J=B.value[C+2],B.offsetSrc+=3),B.size===2?(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=ia.x,B.array[F+3]=ia.y,B.array[F+4]=J.x,B.array[F+5]=J.y,B.offset+=6):B.size===3?(B.type==="c"?(B.array[F]=A.r,B.array[F+1]=A.g,B.array[F+2]=A.b,B.array[F+3]=ia.r,B.array[F+4]=ia.g,B.array[F+5]=ia.b,B.array[F+6]=J.r,B.array[F+7]=J.g,B.array[F+8]=J.b):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=ia.x,B.array[F+
-4]=ia.y,B.array[F+5]=ia.z,B.array[F+6]=J.x,B.array[F+7]=J.y,B.array[F+8]=J.z),B.offset+=9):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=A.w,B.array[F+4]=ia.x,B.array[F+5]=ia.y,B.array[F+6]=ia.z,B.array[F+7]=ia.w,B.array[F+8]=J.x,B.array[F+9]=J.y,B.array[F+10]=J.z,B.array[F+11]=J.w,B.offset+=12));if(cb){F=0;for(B=Ga.length;F<B;F++)A=Ga[F].vertices[M.a].position,ia=Ga[F].vertices[M.b].position,J=Ga[F].vertices[M.c].position,C=ma[F],C[pa]=A.x,C[pa+1]=A.y,C[pa+2]=A.z,C[pa+3]=ia.x,C[pa+
-4]=ia.y,C[pa+5]=ia.z,C[pa+6]=J.x,C[pa+7]=J.y,C[pa+8]=J.z;pa+=9}if(Ha.length)F=Ha[M.a],B=Ha[M.b],C=Ha[M.c],ea[Q]=F.x,ea[Q+1]=F.y,ea[Q+2]=F.z,ea[Q+3]=F.w,ea[Q+4]=B.x,ea[Q+5]=B.y,ea[Q+6]=B.z,ea[Q+7]=B.w,ea[Q+8]=C.x,ea[Q+9]=C.y,ea[Q+10]=C.z,ea[Q+11]=C.w,F=Ra[M.a],B=Ra[M.b],C=Ra[M.c],da[Q]=F.x,da[Q+1]=F.y,da[Q+2]=F.z,da[Q+3]=F.w,da[Q+4]=B.x,da[Q+5]=B.y,da[Q+6]=B.z,da[Q+7]=B.w,da[Q+8]=C.x,da[Q+9]=C.y,da[Q+10]=C.z,da[Q+11]=C.w,F=Pa[M.a],B=Pa[M.b],C=Pa[M.c],$[Q]=F.x,$[Q+1]=F.y,$[Q+2]=F.z,$[Q+3]=1,$[Q+4]=
-B.x,$[Q+5]=B.y,$[Q+6]=B.z,$[Q+7]=1,$[Q+8]=C.x,$[Q+9]=C.y,$[Q+10]=C.z,$[Q+11]=1,F=Qa[M.a],B=Qa[M.b],C=Qa[M.c],ta[Q]=F.x,ta[Q+1]=F.y,ta[Q+2]=F.z,ta[Q+3]=1,ta[Q+4]=B.x,ta[Q+5]=B.y,ta[Q+6]=B.z,ta[Q+7]=1,ta[Q+8]=C.x,ta[Q+9]=C.y,ta[Q+10]=C.z,ta[Q+11]=1,Q+=12;if(bb&&L)H.length==3&&L==THREE.VertexColors?(M=H[0],F=H[1],B=H[2]):B=F=M=K,xa[aa]=M.r,xa[aa+1]=M.g,xa[aa+2]=M.b,xa[aa+3]=F.r,xa[aa+4]=F.g,xa[aa+5]=F.b,xa[aa+6]=B.r,xa[aa+7]=B.g,xa[aa+8]=B.b,aa+=9;if(ab&&va.hasTangents)H=ca[0],K=ca[1],M=ca[2],ga[O]=
-H.x,ga[O+1]=H.y,ga[O+2]=H.z,ga[O+3]=H.w,ga[O+4]=K.x,ga[O+5]=K.y,ga[O+6]=K.z,ga[O+7]=K.w,ga[O+8]=M.x,ga[O+9]=M.y,ga[O+10]=M.z,ga[O+11]=M.w,O+=12;if(Ea&&y)if(E.length==3&&Ba)for(ca=0;ca<3;ca++)la=E[ca],fa[ya]=la.x,fa[ya+1]=la.y,fa[ya+2]=la.z,ya+=3;else for(ca=0;ca<3;ca++)fa[ya]=la.x,fa[ya+1]=la.y,fa[ya+2]=la.z,ya+=3;if(Aa&&v!==void 0&&u)for(ca=0;ca<3;ca++)E=v[ca],ka[R]=E.u,ka[R+1]=E.v,R+=2;if(Aa&&ha!==void 0&&u)for(ca=0;ca<3;ca++)E=ha[ca],qa[ua]=E.u,qa[ua+1]=E.v,ua+=2;Fa&&(za[S]=T,za[S+1]=T+1,za[S+
-2]=T+2,S+=3,na[Y]=T,na[Y+1]=T+1,na[Y+2]=T,na[Y+3]=T+2,na[Y+4]=T+1,na[Y+5]=T+2,Y+=6,T+=3)}else if(M instanceof THREE.Face4){if(Ca)A=Oa[M.a].position,ia=Oa[M.b].position,J=Oa[M.c].position,ra=Oa[M.d].position,U[oa]=A.x,U[oa+1]=A.y,U[oa+2]=A.z,U[oa+3]=ia.x,U[oa+4]=ia.y,U[oa+5]=ia.z,U[oa+6]=J.x,U[oa+7]=J.y,U[oa+8]=J.z,U[oa+9]=ra.x,U[oa+10]=ra.y,U[oa+11]=ra.z,oa+=12;if(sa)for(Z in sa)if(B=sa[Z],B.__original.needsUpdate)F=B.offset,C=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[F]=
-B.value[M.a],B.array[F+1]=B.value[M.b],B.array[F+2]=B.value[M.c],B.array[F+3]=B.value[M.d]):B.boundTo==="faces"?(C=B.value[C],B.array[F]=C,B.array[F+1]=C,B.array[F+2]=C,B.array[F+3]=C,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[F]=B.value[C],B.array[F+1]=B.value[C+1],B.array[F+2]=B.value[C+2],B.array[F+3]=B.value[C+3],B.offsetSrc+=4),B.offset+=4):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[M.a],ia=B.value[M.b],J=B.value[M.c],ra=B.value[M.d]):B.boundTo==="faces"?(ra=J=ia=A=C=B.value[C],
-B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[C],ia=B.value[C+1],J=B.value[C+2],ra=B.value[C+3],B.offsetSrc+=4),B.size===2?(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=ia.x,B.array[F+3]=ia.y,B.array[F+4]=J.x,B.array[F+5]=J.y,B.array[F+6]=ra.x,B.array[F+7]=ra.y,B.offset+=8):B.size===3?(B.type==="c"?(B.array[F]=A.r,B.array[F+1]=A.g,B.array[F+2]=A.b,B.array[F+3]=ia.r,B.array[F+4]=ia.g,B.array[F+5]=ia.b,B.array[F+6]=J.r,B.array[F+7]=J.g,B.array[F+8]=J.b,B.array[F+9]=ra.r,B.array[F+10]=ra.g,B.array[F+
-11]=ra.b):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=ia.x,B.array[F+4]=ia.y,B.array[F+5]=ia.z,B.array[F+6]=J.x,B.array[F+7]=J.y,B.array[F+8]=J.z,B.array[F+9]=ra.x,B.array[F+10]=ra.y,B.array[F+11]=ra.z),B.offset+=12):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=A.w,B.array[F+4]=ia.x,B.array[F+5]=ia.y,B.array[F+6]=ia.z,B.array[F+7]=ia.w,B.array[F+8]=J.x,B.array[F+9]=J.y,B.array[F+10]=J.z,B.array[F+11]=J.w,B.array[F+12]=ra.x,B.array[F+13]=ra.y,B.array[F+14]=ra.z,
-B.array[F+15]=ra.w,B.offset+=16));if(cb){F=0;for(B=Ga.length;F<B;F++)A=Ga[F].vertices[M.a].position,ia=Ga[F].vertices[M.b].position,J=Ga[F].vertices[M.c].position,ra=Ga[F].vertices[M.d].position,C=ma[F],C[pa]=A.x,C[pa+1]=A.y,C[pa+2]=A.z,C[pa+3]=ia.x,C[pa+4]=ia.y,C[pa+5]=ia.z,C[pa+6]=J.x,C[pa+7]=J.y,C[pa+8]=J.z,C[pa+9]=ra.x,C[pa+10]=ra.y,C[pa+11]=ra.z;pa+=12}if(Ha.length)F=Ha[M.a],B=Ha[M.b],C=Ha[M.c],X=Ha[M.d],ea[Q]=F.x,ea[Q+1]=F.y,ea[Q+2]=F.z,ea[Q+3]=F.w,ea[Q+4]=B.x,ea[Q+5]=B.y,ea[Q+6]=B.z,ea[Q+7]=
-B.w,ea[Q+8]=C.x,ea[Q+9]=C.y,ea[Q+10]=C.z,ea[Q+11]=C.w,ea[Q+12]=X.x,ea[Q+13]=X.y,ea[Q+14]=X.z,ea[Q+15]=X.w,F=Ra[M.a],B=Ra[M.b],C=Ra[M.c],X=Ra[M.d],da[Q]=F.x,da[Q+1]=F.y,da[Q+2]=F.z,da[Q+3]=F.w,da[Q+4]=B.x,da[Q+5]=B.y,da[Q+6]=B.z,da[Q+7]=B.w,da[Q+8]=C.x,da[Q+9]=C.y,da[Q+10]=C.z,da[Q+11]=C.w,da[Q+12]=X.x,da[Q+13]=X.y,da[Q+14]=X.z,da[Q+15]=X.w,F=Pa[M.a],B=Pa[M.b],C=Pa[M.c],X=Pa[M.d],$[Q]=F.x,$[Q+1]=F.y,$[Q+2]=F.z,$[Q+3]=1,$[Q+4]=B.x,$[Q+5]=B.y,$[Q+6]=B.z,$[Q+7]=1,$[Q+8]=C.x,$[Q+9]=C.y,$[Q+10]=C.z,$[Q+
-11]=1,$[Q+12]=X.x,$[Q+13]=X.y,$[Q+14]=X.z,$[Q+15]=1,F=Qa[M.a],B=Qa[M.b],C=Qa[M.c],M=Qa[M.d],ta[Q]=F.x,ta[Q+1]=F.y,ta[Q+2]=F.z,ta[Q+3]=1,ta[Q+4]=B.x,ta[Q+5]=B.y,ta[Q+6]=B.z,ta[Q+7]=1,ta[Q+8]=C.x,ta[Q+9]=C.y,ta[Q+10]=C.z,ta[Q+11]=1,ta[Q+12]=M.x,ta[Q+13]=M.y,ta[Q+14]=M.z,ta[Q+15]=1,Q+=16;if(bb&&L)H.length==4&&L==THREE.VertexColors?(M=H[0],F=H[1],B=H[2],H=H[3]):H=B=F=M=K,xa[aa]=M.r,xa[aa+1]=M.g,xa[aa+2]=M.b,xa[aa+3]=F.r,xa[aa+4]=F.g,xa[aa+5]=F.b,xa[aa+6]=B.r,xa[aa+7]=B.g,xa[aa+8]=B.b,xa[aa+9]=H.r,xa[aa+
-10]=H.g,xa[aa+11]=H.b,aa+=12;if(ab&&va.hasTangents)H=ca[0],K=ca[1],M=ca[2],ca=ca[3],ga[O]=H.x,ga[O+1]=H.y,ga[O+2]=H.z,ga[O+3]=H.w,ga[O+4]=K.x,ga[O+5]=K.y,ga[O+6]=K.z,ga[O+7]=K.w,ga[O+8]=M.x,ga[O+9]=M.y,ga[O+10]=M.z,ga[O+11]=M.w,ga[O+12]=ca.x,ga[O+13]=ca.y,ga[O+14]=ca.z,ga[O+15]=ca.w,O+=16;if(Ea&&y)if(E.length==4&&Ba)for(ca=0;ca<4;ca++)la=E[ca],fa[ya]=la.x,fa[ya+1]=la.y,fa[ya+2]=la.z,ya+=3;else for(ca=0;ca<4;ca++)fa[ya]=la.x,fa[ya+1]=la.y,fa[ya+2]=la.z,ya+=3;if(Aa&&v!==void 0&&u)for(ca=0;ca<4;ca++)E=
-v[ca],ka[R]=E.u,ka[R+1]=E.v,R+=2;if(Aa&&ha!==void 0&&u)for(ca=0;ca<4;ca++)E=ha[ca],qa[ua]=E.u,qa[ua+1]=E.v,ua+=2;Fa&&(za[S]=T,za[S+1]=T+1,za[S+2]=T+3,za[S+3]=T+1,za[S+4]=T+2,za[S+5]=T+3,S+=6,na[Y]=T,na[Y+1]=T+1,na[Y+2]=T,na[Y+3]=T+3,na[Y+4]=T+1,na[Y+5]=T+2,na[Y+6]=T+2,na[Y+7]=T+3,Y+=8,T+=4)}Ca&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,U,z));if(sa)for(Z in sa)B=sa[Z],B.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,B.buffer),o.bufferData(o.ARRAY_BUFFER,
-B.array,z));if(cb){F=0;for(B=Ga.length;F<B;F++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[F]),o.bufferData(o.ARRAY_BUFFER,ma[F],z)}bb&&aa>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,xa,z));Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,fa,z));ab&&va.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ga,z));Aa&&R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,
-ka,z));Aa&&ua>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,qa,z));Fa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,za,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,na,z));Q>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,$,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ta,z),o.bindBuffer(o.ARRAY_BUFFER,
-p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,da,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ea,z));W&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=
-!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;G(m)}else if(k instanceof THREE.Ribbon){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=W=W=void 0;w=k.vertices;t=k.colors;u=w.length;p=t.length;L=k.__vertexArray;z=k.__colorArray;y=k.__dirtyColors;if(k.__dirtyVertices){for(W=0;W<u;W++)x=w[W].position,n=W*3,L[n]=x.x,L[n+1]=x.y,L[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,L,m)}if(y){for(W=
-0;W<p;W++)color=t[W],n=W*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=W=W=void 0;w=k.vertices;t=k.colors;u=w.length;p=t.length;L=k.__vertexArray;z=k.__colorArray;y=k.__dirtyColors;if(k.__dirtyVertices){for(W=0;W<u;W++)x=w[W].position,n=W*3,L[n]=x.x,L[n+1]=x.y,L[n+2]=
-x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,L,m)}if(y){for(W=0;W<p;W++)color=t[W],n=W*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem)h=k.geometry,p=D(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||p)&&c(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,G(h)};this.setFaceCulling=
-function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return za}};
+p)if(p=m,z=o.DYNAMIC_DRAW,X=!h.dynamic,p.__inittedArrays){var E=w=x=void 0,M=void 0,la=E=void 0,H=void 0,K=void 0,ca=void 0,ha=A=ga=v=y=L=u=void 0,J=void 0,pa=void 0,F=M=ca=M=K=H=void 0,B=void 0,C=B=F=H=void 0,Y=void 0,qa=C=B=F=E=E=la=ca=M=C=B=F=Y=C=B=F=Y=C=B=F=void 0,T=0,U=0,R=0,ua=0,S=0,za=0,O=0,Z=0,oa=0,Q=0,V=0,C=F=0,C=void 0,fa=p.__vertexArray,na=p.__uvArray,ja=p.__uv2Array,ka=p.__normalArray,$=p.__tangentArray,xa=p.__colorArray,aa=p.__skinVertexAArray,ra=p.__skinVertexBArray,da=p.__skinIndexArray,
+ea=p.__skinWeightArray,ma=p.__morphTargetsArrays,sa=p.__webglCustomAttributes,B=void 0,Aa=p.__faceArray,ya=p.__lineArray,ta=p.__needsSmoothNormals,L=p.__vertexColorType,u=p.__uvType,y=p.__normalType,va=k.geometry,Ca=va.__dirtyVertices,Fa=va.__dirtyElements,Ba=va.__dirtyUvs,Ea=va.__dirtyNormals,ab=va.__dirtyTangents,bb=va.__dirtyColors,cb=va.__dirtyMorphTargets,Oa=va.vertices,eb=p.faces,hb=va.faces,fb=va.faceVertexUvs[0],gb=va.faceVertexUvs[1],Pa=va.skinVerticesA,Qa=va.skinVerticesB,Ra=va.skinIndices,
+Ha=va.skinWeights,Ga=va.morphTargets;if(sa)for(qa in sa)sa[qa].offset=0,sa[qa].offsetSrc=0;x=0;for(w=eb.length;x<w;x++)if(E=eb[x],M=hb[E],fb&&(v=fb[E]),gb&&(ga=gb[E]),E=M.vertexNormals,la=M.normal,H=M.vertexColors,K=M.color,ca=M.vertexTangents,M instanceof THREE.Face3){if(Ca)A=Oa[M.a].position,ha=Oa[M.b].position,J=Oa[M.c].position,fa[U]=A.x,fa[U+1]=A.y,fa[U+2]=A.z,fa[U+3]=ha.x,fa[U+4]=ha.y,fa[U+5]=ha.z,fa[U+6]=J.x,fa[U+7]=J.y,fa[U+8]=J.z,U+=9;if(sa)for(qa in sa)if(B=sa[qa],B.__original.needsUpdate)F=
+B.offset,C=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[F]=B.value[M.a],B.array[F+1]=B.value[M.b],B.array[F+2]=B.value[M.c]):B.boundTo==="faces"?(C=B.value[C],B.array[F]=C,B.array[F+1]=C,B.array[F+2]=C,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[F]=B.value[C],B.array[F+1]=B.value[C+1],B.array[F+2]=B.value[C+2],B.offsetSrc+=3),B.offset+=3):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[M.a],ha=B.value[M.b],J=B.value[M.c]):B.boundTo==="faces"?(J=ha=A=C=
+B.value[C],B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[C],ha=B.value[C+1],J=B.value[C+2],B.offsetSrc+=3),B.size===2?(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=ha.x,B.array[F+3]=ha.y,B.array[F+4]=J.x,B.array[F+5]=J.y,B.offset+=6):B.size===3?(B.type==="c"?(B.array[F]=A.r,B.array[F+1]=A.g,B.array[F+2]=A.b,B.array[F+3]=ha.r,B.array[F+4]=ha.g,B.array[F+5]=ha.b,B.array[F+6]=J.r,B.array[F+7]=J.g,B.array[F+8]=J.b):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=ha.x,B.array[F+
+4]=ha.y,B.array[F+5]=ha.z,B.array[F+6]=J.x,B.array[F+7]=J.y,B.array[F+8]=J.z),B.offset+=9):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=A.w,B.array[F+4]=ha.x,B.array[F+5]=ha.y,B.array[F+6]=ha.z,B.array[F+7]=ha.w,B.array[F+8]=J.x,B.array[F+9]=J.y,B.array[F+10]=J.z,B.array[F+11]=J.w,B.offset+=12));if(cb){F=0;for(B=Ga.length;F<B;F++)A=Ga[F].vertices[M.a].position,ha=Ga[F].vertices[M.b].position,J=Ga[F].vertices[M.c].position,C=ma[F],C[V]=A.x,C[V+1]=A.y,C[V+2]=A.z,C[V+3]=ha.x,C[V+4]=
+ha.y,C[V+5]=ha.z,C[V+6]=J.x,C[V+7]=J.y,C[V+8]=J.z;V+=9}if(Ha.length)F=Ha[M.a],B=Ha[M.b],C=Ha[M.c],ea[Q]=F.x,ea[Q+1]=F.y,ea[Q+2]=F.z,ea[Q+3]=F.w,ea[Q+4]=B.x,ea[Q+5]=B.y,ea[Q+6]=B.z,ea[Q+7]=B.w,ea[Q+8]=C.x,ea[Q+9]=C.y,ea[Q+10]=C.z,ea[Q+11]=C.w,F=Ra[M.a],B=Ra[M.b],C=Ra[M.c],da[Q]=F.x,da[Q+1]=F.y,da[Q+2]=F.z,da[Q+3]=F.w,da[Q+4]=B.x,da[Q+5]=B.y,da[Q+6]=B.z,da[Q+7]=B.w,da[Q+8]=C.x,da[Q+9]=C.y,da[Q+10]=C.z,da[Q+11]=C.w,F=Pa[M.a],B=Pa[M.b],C=Pa[M.c],aa[Q]=F.x,aa[Q+1]=F.y,aa[Q+2]=F.z,aa[Q+3]=1,aa[Q+4]=B.x,
+aa[Q+5]=B.y,aa[Q+6]=B.z,aa[Q+7]=1,aa[Q+8]=C.x,aa[Q+9]=C.y,aa[Q+10]=C.z,aa[Q+11]=1,F=Qa[M.a],B=Qa[M.b],C=Qa[M.c],ra[Q]=F.x,ra[Q+1]=F.y,ra[Q+2]=F.z,ra[Q+3]=1,ra[Q+4]=B.x,ra[Q+5]=B.y,ra[Q+6]=B.z,ra[Q+7]=1,ra[Q+8]=C.x,ra[Q+9]=C.y,ra[Q+10]=C.z,ra[Q+11]=1,Q+=12;if(bb&&L)H.length==3&&L==THREE.VertexColors?(M=H[0],F=H[1],B=H[2]):B=F=M=K,xa[oa]=M.r,xa[oa+1]=M.g,xa[oa+2]=M.b,xa[oa+3]=F.r,xa[oa+4]=F.g,xa[oa+5]=F.b,xa[oa+6]=B.r,xa[oa+7]=B.g,xa[oa+8]=B.b,oa+=9;if(ab&&va.hasTangents)H=ca[0],K=ca[1],M=ca[2],$[O]=
+H.x,$[O+1]=H.y,$[O+2]=H.z,$[O+3]=H.w,$[O+4]=K.x,$[O+5]=K.y,$[O+6]=K.z,$[O+7]=K.w,$[O+8]=M.x,$[O+9]=M.y,$[O+10]=M.z,$[O+11]=M.w,O+=12;if(Ea&&y)if(E.length==3&&ta)for(ca=0;ca<3;ca++)la=E[ca],ka[za]=la.x,ka[za+1]=la.y,ka[za+2]=la.z,za+=3;else for(ca=0;ca<3;ca++)ka[za]=la.x,ka[za+1]=la.y,ka[za+2]=la.z,za+=3;if(Ba&&v!==void 0&&u)for(ca=0;ca<3;ca++)E=v[ca],na[R]=E.u,na[R+1]=E.v,R+=2;if(Ba&&ga!==void 0&&u)for(ca=0;ca<3;ca++)E=ga[ca],ja[ua]=E.u,ja[ua+1]=E.v,ua+=2;Fa&&(Aa[S]=T,Aa[S+1]=T+1,Aa[S+2]=T+2,S+=3,
+ya[Z]=T,ya[Z+1]=T+1,ya[Z+2]=T,ya[Z+3]=T+2,ya[Z+4]=T+1,ya[Z+5]=T+2,Z+=6,T+=3)}else if(M instanceof THREE.Face4){if(Ca)A=Oa[M.a].position,ha=Oa[M.b].position,J=Oa[M.c].position,pa=Oa[M.d].position,fa[U]=A.x,fa[U+1]=A.y,fa[U+2]=A.z,fa[U+3]=ha.x,fa[U+4]=ha.y,fa[U+5]=ha.z,fa[U+6]=J.x,fa[U+7]=J.y,fa[U+8]=J.z,fa[U+9]=pa.x,fa[U+10]=pa.y,fa[U+11]=pa.z,U+=12;if(sa)for(qa in sa)if(B=sa[qa],B.__original.needsUpdate)F=B.offset,C=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[F]=B.value[M.a],
+B.array[F+1]=B.value[M.b],B.array[F+2]=B.value[M.c],B.array[F+3]=B.value[M.d]):B.boundTo==="faces"?(C=B.value[C],B.array[F]=C,B.array[F+1]=C,B.array[F+2]=C,B.array[F+3]=C,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[F]=B.value[C],B.array[F+1]=B.value[C+1],B.array[F+2]=B.value[C+2],B.array[F+3]=B.value[C+3],B.offsetSrc+=4),B.offset+=4):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[M.a],ha=B.value[M.b],J=B.value[M.c],pa=B.value[M.d]):B.boundTo==="faces"?(pa=J=ha=A=C=B.value[C],B.offsetSrc++):
+B.boundTo==="faceVertices"&&(A=B.value[C],ha=B.value[C+1],J=B.value[C+2],pa=B.value[C+3],B.offsetSrc+=4),B.size===2?(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=ha.x,B.array[F+3]=ha.y,B.array[F+4]=J.x,B.array[F+5]=J.y,B.array[F+6]=pa.x,B.array[F+7]=pa.y,B.offset+=8):B.size===3?(B.type==="c"?(B.array[F]=A.r,B.array[F+1]=A.g,B.array[F+2]=A.b,B.array[F+3]=ha.r,B.array[F+4]=ha.g,B.array[F+5]=ha.b,B.array[F+6]=J.r,B.array[F+7]=J.g,B.array[F+8]=J.b,B.array[F+9]=pa.r,B.array[F+10]=pa.g,B.array[F+11]=pa.b):
+(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=ha.x,B.array[F+4]=ha.y,B.array[F+5]=ha.z,B.array[F+6]=J.x,B.array[F+7]=J.y,B.array[F+8]=J.z,B.array[F+9]=pa.x,B.array[F+10]=pa.y,B.array[F+11]=pa.z),B.offset+=12):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=A.w,B.array[F+4]=ha.x,B.array[F+5]=ha.y,B.array[F+6]=ha.z,B.array[F+7]=ha.w,B.array[F+8]=J.x,B.array[F+9]=J.y,B.array[F+10]=J.z,B.array[F+11]=J.w,B.array[F+12]=pa.x,B.array[F+13]=pa.y,B.array[F+14]=pa.z,B.array[F+
+15]=pa.w,B.offset+=16));if(cb){F=0;for(B=Ga.length;F<B;F++)A=Ga[F].vertices[M.a].position,ha=Ga[F].vertices[M.b].position,J=Ga[F].vertices[M.c].position,pa=Ga[F].vertices[M.d].position,C=ma[F],C[V]=A.x,C[V+1]=A.y,C[V+2]=A.z,C[V+3]=ha.x,C[V+4]=ha.y,C[V+5]=ha.z,C[V+6]=J.x,C[V+7]=J.y,C[V+8]=J.z,C[V+9]=pa.x,C[V+10]=pa.y,C[V+11]=pa.z;V+=12}if(Ha.length)F=Ha[M.a],B=Ha[M.b],C=Ha[M.c],Y=Ha[M.d],ea[Q]=F.x,ea[Q+1]=F.y,ea[Q+2]=F.z,ea[Q+3]=F.w,ea[Q+4]=B.x,ea[Q+5]=B.y,ea[Q+6]=B.z,ea[Q+7]=B.w,ea[Q+8]=C.x,ea[Q+
+9]=C.y,ea[Q+10]=C.z,ea[Q+11]=C.w,ea[Q+12]=Y.x,ea[Q+13]=Y.y,ea[Q+14]=Y.z,ea[Q+15]=Y.w,F=Ra[M.a],B=Ra[M.b],C=Ra[M.c],Y=Ra[M.d],da[Q]=F.x,da[Q+1]=F.y,da[Q+2]=F.z,da[Q+3]=F.w,da[Q+4]=B.x,da[Q+5]=B.y,da[Q+6]=B.z,da[Q+7]=B.w,da[Q+8]=C.x,da[Q+9]=C.y,da[Q+10]=C.z,da[Q+11]=C.w,da[Q+12]=Y.x,da[Q+13]=Y.y,da[Q+14]=Y.z,da[Q+15]=Y.w,F=Pa[M.a],B=Pa[M.b],C=Pa[M.c],Y=Pa[M.d],aa[Q]=F.x,aa[Q+1]=F.y,aa[Q+2]=F.z,aa[Q+3]=1,aa[Q+4]=B.x,aa[Q+5]=B.y,aa[Q+6]=B.z,aa[Q+7]=1,aa[Q+8]=C.x,aa[Q+9]=C.y,aa[Q+10]=C.z,aa[Q+11]=1,aa[Q+
+12]=Y.x,aa[Q+13]=Y.y,aa[Q+14]=Y.z,aa[Q+15]=1,F=Qa[M.a],B=Qa[M.b],C=Qa[M.c],M=Qa[M.d],ra[Q]=F.x,ra[Q+1]=F.y,ra[Q+2]=F.z,ra[Q+3]=1,ra[Q+4]=B.x,ra[Q+5]=B.y,ra[Q+6]=B.z,ra[Q+7]=1,ra[Q+8]=C.x,ra[Q+9]=C.y,ra[Q+10]=C.z,ra[Q+11]=1,ra[Q+12]=M.x,ra[Q+13]=M.y,ra[Q+14]=M.z,ra[Q+15]=1,Q+=16;if(bb&&L)H.length==4&&L==THREE.VertexColors?(M=H[0],F=H[1],B=H[2],H=H[3]):H=B=F=M=K,xa[oa]=M.r,xa[oa+1]=M.g,xa[oa+2]=M.b,xa[oa+3]=F.r,xa[oa+4]=F.g,xa[oa+5]=F.b,xa[oa+6]=B.r,xa[oa+7]=B.g,xa[oa+8]=B.b,xa[oa+9]=H.r,xa[oa+10]=
+H.g,xa[oa+11]=H.b,oa+=12;if(ab&&va.hasTangents)H=ca[0],K=ca[1],M=ca[2],ca=ca[3],$[O]=H.x,$[O+1]=H.y,$[O+2]=H.z,$[O+3]=H.w,$[O+4]=K.x,$[O+5]=K.y,$[O+6]=K.z,$[O+7]=K.w,$[O+8]=M.x,$[O+9]=M.y,$[O+10]=M.z,$[O+11]=M.w,$[O+12]=ca.x,$[O+13]=ca.y,$[O+14]=ca.z,$[O+15]=ca.w,O+=16;if(Ea&&y)if(E.length==4&&ta)for(ca=0;ca<4;ca++)la=E[ca],ka[za]=la.x,ka[za+1]=la.y,ka[za+2]=la.z,za+=3;else for(ca=0;ca<4;ca++)ka[za]=la.x,ka[za+1]=la.y,ka[za+2]=la.z,za+=3;if(Ba&&v!==void 0&&u)for(ca=0;ca<4;ca++)E=v[ca],na[R]=E.u,na[R+
+1]=E.v,R+=2;if(Ba&&ga!==void 0&&u)for(ca=0;ca<4;ca++)E=ga[ca],ja[ua]=E.u,ja[ua+1]=E.v,ua+=2;Fa&&(Aa[S]=T,Aa[S+1]=T+1,Aa[S+2]=T+3,Aa[S+3]=T+1,Aa[S+4]=T+2,Aa[S+5]=T+3,S+=6,ya[Z]=T,ya[Z+1]=T+1,ya[Z+2]=T,ya[Z+3]=T+3,ya[Z+4]=T+1,ya[Z+5]=T+2,ya[Z+6]=T+2,ya[Z+7]=T+3,Z+=8,T+=4)}Ca&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,fa,z));if(sa)for(qa in sa)B=sa[qa],B.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,B.buffer),o.bufferData(o.ARRAY_BUFFER,B.array,z));if(cb){F=
+0;for(B=Ga.length;F<B;F++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[F]),o.bufferData(o.ARRAY_BUFFER,ma[F],z)}bb&&oa>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,xa,z));Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ka,z));ab&&va.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,$,z));Ba&&R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,
+na,z));Ba&&ua>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ja,z));Fa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,Aa,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ya,z));Q>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ra,z),o.bindBuffer(o.ARRAY_BUFFER,
+p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,da,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ea,z));X&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=
+!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;G(m)}else if(k instanceof THREE.Ribbon){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=X=X=void 0;w=k.vertices;t=k.colors;u=w.length;p=t.length;L=k.__vertexArray;z=k.__colorArray;y=k.__dirtyColors;if(k.__dirtyVertices){for(X=0;X<u;X++)x=w[X].position,n=X*3,L[n]=x.x,L[n+1]=x.y,L[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,L,m)}if(y){for(X=
+0;X<p;X++)color=t[X],n=X*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=X=X=void 0;w=k.vertices;t=k.colors;u=w.length;p=t.length;L=k.__vertexArray;z=k.__colorArray;y=k.__dirtyColors;if(k.__dirtyVertices){for(X=0;X<u;X++)x=w[X].position,n=X*3,L[n]=x.x,L[n+1]=x.y,L[n+2]=
+x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,L,m)}if(y){for(X=0;X<p;X++)color=t[X],n=X*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem)h=k.geometry,p=D(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||p)&&c(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,G(h)};this.setFaceCulling=
+function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Aa}};
 THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,e){THREE.WebGLRenderTarget.call(this,b,c,e);this.activeCubeFace=0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,e){THREE.WebGLRenderTarget.call(this,b,c,e);this.activeCubeFace=0};
@@ -428,7 +428,7 @@ this.getPrevKeyWith("pos",w,k.index-1).pos,this.points[1]=h,this.points[2]=m,thi
 THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],h,m,k,n,u,p;h=(b.length-1)*c;m=Math.floor(h);h-=m;e[0]=m==0?m:m-1;e[1]=m;e[2]=m>b.length-2?m:m+1;e[3]=m>b.length-3?m:m+2;m=b[e[0]];n=b[e[1]];u=b[e[2]];p=b[e[3]];e=h*h;k=h*e;f[0]=this.interpolate(m[0],n[0],u[0],p[0],h,e,k);f[1]=this.interpolate(m[1],n[1],u[1],p[1],h,e,k);f[2]=this.interpolate(m[2],n[2],u[2],p[2],h,e,k);return f};
 THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],h,m,k,n,u,p;h=(b.length-1)*c;m=Math.floor(h);h-=m;e[0]=m==0?m:m-1;e[1]=m;e[2]=m>b.length-2?m:m+1;e[3]=m>b.length-3?m:m+2;m=b[e[0]];n=b[e[1]];u=b[e[2]];p=b[e[3]];e=h*h;k=h*e;f[0]=this.interpolate(m[0],n[0],u[0],p[0],h,e,k);f[1]=this.interpolate(m[1],n[1],u[1],p[1],h,e,k);f[2]=this.interpolate(m[2],n[2],u[2],p[2],h,e,k);return f};
 THREE.Animation.prototype.interpolate=function(b,c,e,f,h,m,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*m+b*h+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.interpolate=function(b,c,e,f,h,m,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*m+b*h+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
-THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
+THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
 b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
 b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
 void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this.verticalMin=b.verticalMin;if(b.verticalMax!==void 0)this.verticalMax=b.verticalMax;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this.verticalMin=b.verticalMin;if(b.verticalMax!==void 0)this.verticalMax=b.verticalMax;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.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(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=
@@ -441,7 +441,7 @@ c*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI
 THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
 THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
 THREE.PathCamera=function(b){function c(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),u=m.length,D=0;k=u-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<u-1;k++)D=f*n.chunks[k]/n.total,e.keys[k]={time:D,pos:m[k]};h.hierarchy[0]=e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
 THREE.PathCamera=function(b){function c(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),u=m.length,D=0;k=u-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<u-1;k++)D=f*n.chunks[k]/n.total,e.keys[k]={time:D,pos:m[k]};h.hierarchy[0]=e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
 f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,k);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);h=new THREE.SphereGeometry(1,
 f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,k);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);h=new THREE.SphereGeometry(1,
-16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,k),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=
+16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,k),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
 this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
 this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
 void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===
 void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===
 document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var h=Math.PI*2,m=Math.PI/180;this.update=function(b,e,c){var f,k;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=
 document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var h=Math.PI*2,m=Math.PI/180;this.update=function(b,e,c){var f,k;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=
@@ -449,7 +449,7 @@ document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2
 f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);
 f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);
 if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),k=new THREE.MeshLambertMaterial({color:65280}),n=new THREE.CubeGeometry(10,10,20),u=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(n,b);b=new THREE.Mesh(u,k);b.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,
 if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),k=new THREE.MeshLambertMaterial({color:65280}),n=new THREE.CubeGeometry(10,10,20),u=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(n,b);b=new THREE.Mesh(u,k);b.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,
 this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,e){return function(){e.apply(b,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
 this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,e){return function(){e.apply(b,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
+THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
 b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};
 b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};
 this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=
 this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=
 1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=
 1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=
@@ -477,8 +477,8 @@ c(this,function(b){e&&(m=k=this.getMouseProjectionOnBall(b.clientX,b.clientY),n=
 b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?m=k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=u=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(p=v=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
 b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?m=k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=u=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(p=v=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
 this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
 this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;
 THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;
-THREE.CubeGeometry=function(b,c,e,f,h,m,k,n,u){function p(b,c,e,k,n,p,t,u){var w,x,z=f||1,y=h||1,R=n/2,O=p/2,U=v.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")w="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")w="y",y=m||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")w="x",z=m||1;var V=z+1,o=y+1;n/=z;var ea=p/y;for(x=0;x<o;x++)for(p=0;p<V;p++){var S=new THREE.Vector3;S[b]=(p*n-R)*e;S[c]=(x*ea-O)*k;S[w]=t;v.vertices.push(new THREE.Vertex(S))}for(x=0;x<y;x++)for(p=0;p<z;p++)v.faces.push(new THREE.Face4(p+V*
-x+U,p+V*(x+1)+U,p+1+V*(x+1)+U,p+1+V*x+U,null,null,u)),v.faceVertexUvs[0].push([new THREE.UV(p/z,x/y),new THREE.UV(p/z,(x+1)/y),new THREE.UV((p+1)/z,(x+1)/y),new THREE.UV((p+1)/z,x/y)])}THREE.Geometry.call(this);var v=this,t=b/2,x=c/2,w=e/2,n=n?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var z=0;z<6;z++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(u!=void 0)for(var y in u)this.sides[y]!=void 0&&(this.sides[y]=
+THREE.CubeGeometry=function(b,c,e,f,h,m,k,n,u){function p(b,c,e,k,n,p,t,u){var w,x,z=f||1,y=h||1,R=n/2,O=p/2,V=v.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")w="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")w="y",y=m||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")w="x",z=m||1;var W=z+1,o=y+1;n/=z;var ea=p/y;for(x=0;x<o;x++)for(p=0;p<W;p++){var S=new THREE.Vector3;S[b]=(p*n-R)*e;S[c]=(x*ea-O)*k;S[w]=t;v.vertices.push(new THREE.Vertex(S))}for(x=0;x<y;x++)for(p=0;p<z;p++)v.faces.push(new THREE.Face4(p+W*
+x+V,p+W*(x+1)+V,p+1+W*(x+1)+V,p+1+W*x+V,null,null,u)),v.faceVertexUvs[0].push([new THREE.UV(p/z,x/y),new THREE.UV(p/z,(x+1)/y),new THREE.UV((p+1)/z,(x+1)/y),new THREE.UV((p+1)/z,x/y)])}THREE.Geometry.call(this);var v=this,t=b/2,x=c/2,w=e/2,n=n?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var z=0;z<6;z++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(u!=void 0)for(var y in u)this.sides[y]!=void 0&&(this.sides[y]=
 u[y]);this.sides.px&&p("z","y",1*n,-1,e,c,-t,this.materials[0]);this.sides.nx&&p("z","y",-1*n,-1,e,c,t,this.materials[1]);this.sides.py&&p("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&p("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&p("x","y",1*n,-1,b,c,w,this.materials[4]);this.sides.nz&&p("x","y",-1*n,-1,b,c,-w,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=v.vertices.length;e<f;e++){for(var k=v.vertices[e],h=!1,m=0,n=b.length;m<n;m++){var p=b[m];if(k.position.x==p.position.x&&
 u[y]);this.sides.px&&p("z","y",1*n,-1,e,c,-t,this.materials[0]);this.sides.nx&&p("z","y",-1*n,-1,e,c,t,this.materials[1]);this.sides.py&&p("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&p("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&p("x","y",1*n,-1,b,c,w,this.materials[4]);this.sides.nz&&p("x","y",-1*n,-1,b,c,-w,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=v.vertices.length;e<f;e++){for(var k=v.vertices[e],h=!1,m=0,n=b.length;m<n;m++){var p=b[m];if(k.position.x==p.position.x&&
 k.position.y==p.position.y&&k.position.z==p.position.z){c[e]=m;h=!0;break}}if(!h)c[e]=b.length,b.push(new THREE.Vertex(k.position.clone()))}e=0;for(f=v.faces.length;e<f;e++)k=v.faces[e],k.a=c[k.a],k.b=c[k.b],k.c=c[k.c],k.d=c[k.d];v.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 k.position.y==p.position.y&&k.position.z==p.position.z){c[e]=m;h=!0;break}}if(!h)c[e]=b.length,b.push(new THREE.Vertex(k.position.clone()))}e=0;for(f=v.faces.length;e<f;e++)k=v.faces[e],k.a=c[k.a],k.b=c[k.b],k.c=c[k.c],k.d=c[k.d];v.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CylinderGeometry=function(b,c,e,f,h,m){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,k=e/2,f=f||8,h=h||1,n,u,p=[],v=[];for(u=0;u<=h;u++){var t=[],x=[],w=u/h,z=w*(c-b)+b;for(n=0;n<=f;n++){var y=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(y*Math.PI*2),-w*e+k,z*Math.cos(y*Math.PI*2))));t.push(this.vertices.length-1);x.push(new THREE.UV(y,w))}p.push(t);v.push(x)}for(u=0;u<h;u++)for(n=0;n<f;n++){var e=p[u][n],t=p[u+1][n],x=p[u+1][n+1],w=p[u][n+1],z=
 THREE.CylinderGeometry=function(b,c,e,f,h,m){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,k=e/2,f=f||8,h=h||1,n,u,p=[],v=[];for(u=0;u<=h;u++){var t=[],x=[],w=u/h,z=w*(c-b)+b;for(n=0;n<=f;n++){var y=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(y*Math.PI*2),-w*e+k,z*Math.cos(y*Math.PI*2))));t.push(this.vertices.length-1);x.push(new THREE.UV(y,w))}p.push(t);v.push(x)}for(u=0;u<h;u++)for(n=0;n<f;n++){var e=p[u][n],t=p[u+1][n],x=p[u+1][n+1],w=p[u][n+1],z=
@@ -488,17 +488,17 @@ I=new THREE.UV(G.u,1),this.faces.push(new THREE.Face3(e,t,x,[z,y,A])),this.faceV
 THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,h;this.shapebb=b[f-1].getBoundingBox();for(e=0;e<f;e++)h=b[e],this.addShape(h,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,h;this.shapebb=b[f-1].getBoundingBox();for(e=0;e<f;e++)h=b[e],this.addShape(h,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,k=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);k.set(b.x-e.x,b.y-e.y);f=f.normalize();k=k.normalize();h.set(-f.y,f.x);m.set(k.y,-k.x);n.copy(b).addSelf(h);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
 THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,k=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);k.set(b.x-e.x,b.y-e.y);f=f.normalize();k=k.normalize();h.set(-f.y,f.x);m.set(k.y,-k.x);n.copy(b).addSelf(h);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
 n.copy(c).addSelf(h);o.copy(e).addSelf(m);h=f.dot(m);m=o.subSelf(n).dot(m);h==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=h;if(m<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(C=b.length;--C>=0;){ma=C;da=C-1;da<0&&(da=b.length-
 n.copy(c).addSelf(h);o.copy(e).addSelf(m);h=f.dot(m);m=o.subSelf(n).dot(m);h==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=h;if(m<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(C=b.length;--C>=0;){ma=C;da=C-1;da<0&&(da=b.length-
-1);for(var c=0,e=w+v*2,c=0;c<e;c++){var f=ea*c,k=ea*(c+1),h=fa+ma+f,m=fa+ma+k,o=h,f=fa+da+f,k=fa+da+k,p=m;o+=Y;f+=Y;k+=Y;p+=Y;K.faces.push(new THREE.Face4(o,f,k,p,null,null,I));I&&(o=c/e,f=(c+1)/e,k=n+u*2,h=(K.vertices[h].position.z+u)/k,m=(K.vertices[m].position.z+u)/k,K.faceVertexUvs[0].push([new THREE.UV(h,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(h,f)]))}}}function m(b,c,e){K.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function k(b,c,e){b+=Y;c+=Y;e+=Y;K.faces.push(new THREE.Face3(b,
+1);for(var c=0,e=w+v*2,c=0;c<e;c++){var f=ea*c,k=ea*(c+1),h=$+ma+f,m=$+ma+k,o=h,f=$+da+f,k=$+da+k,p=m;o+=Z;f+=Z;k+=Z;p+=Z;K.faces.push(new THREE.Face4(o,f,k,p,null,null,I));I&&(o=c/e,f=(c+1)/e,k=n+u*2,h=(K.vertices[h].position.z+u)/k,m=(K.vertices[m].position.z+u)/k,K.faceVertexUvs[0].push([new THREE.UV(h,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(h,f)]))}}}function m(b,c,e){K.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function k(b,c,e){b+=Z;c+=Z;e+=Z;K.faces.push(new THREE.Face3(b,
 c,e,null,null,G));if(G){var f=N.maxY,k=N.maxX,h=K.vertices[c].position.x,c=K.vertices[c].position.y,m=K.vertices[e].position.x,e=K.vertices[e].position.y;K.faceVertexUvs[0].push([new THREE.UV(K.vertices[b].position.x/k,K.vertices[b].position.y/f),new THREE.UV(h/k,c/f),new THREE.UV(m/k,e/f)])}}var n=c.amount!==void 0?c.amount:100,u=c.bevelThickness!==void 0?c.bevelThickness:6,p=c.bevelSize!==void 0?c.bevelSize:u-2,v=c.bevelSegments!==void 0?c.bevelSegments:3,t=c.bevelEnabled!==void 0?c.bevelEnabled:
 c,e,null,null,G));if(G){var f=N.maxY,k=N.maxX,h=K.vertices[c].position.x,c=K.vertices[c].position.y,m=K.vertices[e].position.x,e=K.vertices[e].position.y;K.faceVertexUvs[0].push([new THREE.UV(K.vertices[b].position.x/k,K.vertices[b].position.y/f),new THREE.UV(h/k,c/f),new THREE.UV(m/k,e/f)])}}var n=c.amount!==void 0?c.amount:100,u=c.bevelThickness!==void 0?c.bevelThickness:6,p=c.bevelSize!==void 0?c.bevelSize:u-2,v=c.bevelSegments!==void 0?c.bevelSegments:3,t=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,x=c.curveSegments!==void 0?c.curveSegments:12,w=c.steps!==void 0?c.steps:1,z=c.bendPath,y=c.extrudePath,A,E=!1,D=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,G=c.material,I=c.extrudeMaterial,N=this.shapebb;if(y)A=y.getPoints(x),w=A.length,E=!0,t=!1;t||(p=u=v=0);var P,J,H,K=this,Y=this.vertices.length;z&&b.addWrapPath(z);x=D?b.extractAllSpacedPoints(x):b.extractAllPoints(x);z=x.shape;x=x.holes;if(y=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();J=0;for(H=x.length;J<H;J++)P=x[J],THREE.Shape.Utils.isClockWise(P)&&
-(x[J]=P.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(z,x);D=z;J=0;for(H=x.length;J<H;J++)P=x[J],z=z.concat(P);var C,R,O,U,V,o,ea=z.length,S=y.length,na=[];C=0;R=D.length;ma=R-1;for(da=C+1;C<R;C++,ma++,da++)ma==R&&(ma=0),da==R&&(da=0),na[C]=f(D[C],D[ma],D[da]);var $=[],qa,ka=na.concat();J=0;for(H=x.length;J<H;J++){P=x[J];qa=[];C=0;R=P.length;ma=R-1;for(da=C+1;C<R;C++,ma++,da++)ma==R&&(ma=0),da==R&&(da=0),qa[C]=f(P[C],P[ma],P[da]);$.push(qa);ka=ka.concat(qa)}for(O=0;O<v;O++){U=O/v;V=u*(1-U);
-U=p*Math.sin(U*Math.PI/2);C=0;for(R=D.length;C<R;C++)o=e(D[C],na[C],U),m(o.x,o.y,-V);J=0;for(H=x.length;J<H;J++){P=x[J];qa=$[J];C=0;for(R=P.length;C<R;C++)o=e(P[C],qa[C],U),m(o.x,o.y,-V)}}U=p;for(C=0;C<ea;C++)o=t?e(z[C],ka[C],U):z[C],E?m(o.x,o.y+A[0].y,A[0].x):m(o.x,o.y,0);for(O=1;O<=w;O++)for(C=0;C<ea;C++)o=t?e(z[C],ka[C],U):z[C],E?m(o.x,o.y+A[O-1].y,A[O-1].x):m(o.x,o.y,n/w*O);for(O=v-1;O>=0;O--){U=O/v;V=u*(1-U);U=p*Math.sin(U*Math.PI/2);C=0;for(R=D.length;C<R;C++)o=e(D[C],na[C],U),m(o.x,o.y,n+V);
-J=0;for(H=x.length;J<H;J++){P=x[J];qa=$[J];C=0;for(R=P.length;C<R;C++)o=e(P[C],qa[C],U),E?m(o.x,o.y+A[w-1].y,A[w-1].x+V):m(o.x,o.y,n+V)}}if(t){t=ea*0;for(C=0;C<S;C++)p=y[C],k(p[2]+t,p[1]+t,p[0]+t);t=ea*(w+v*2);for(C=0;C<S;C++)p=y[C],k(p[0]+t,p[1]+t,p[2]+t)}else{for(C=0;C<S;C++)p=y[C],k(p[2],p[1],p[0]);for(C=0;C<S;C++)p=y[C],k(p[0]+ea*w,p[1]+ea*w,p[2]+ea*w)}var ma,da,fa=0;h(D);fa+=D.length;J=0;for(H=x.length;J<H;J++)P=x[J],h(P),fa+=P.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,w=c.steps!==void 0?c.steps:1,z=c.bendPath,y=c.extrudePath,A,E=!1,D=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,G=c.material,I=c.extrudeMaterial,N=this.shapebb;if(y)A=y.getPoints(x),w=A.length,E=!0,t=!1;t||(p=u=v=0);var P,J,H,K=this,Z=this.vertices.length;z&&b.addWrapPath(z);x=D?b.extractAllSpacedPoints(x):b.extractAllPoints(x);z=x.shape;x=x.holes;if(y=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();J=0;for(H=x.length;J<H;J++)P=x[J],THREE.Shape.Utils.isClockWise(P)&&
+(x[J]=P.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(z,x);D=z;J=0;for(H=x.length;J<H;J++)P=x[J],z=z.concat(P);var C,R,O,V,W,o,ea=z.length,S=y.length,ta=[];C=0;R=D.length;ma=R-1;for(da=C+1;C<R;C++,ma++,da++)ma==R&&(ma=0),da==R&&(da=0),ta[C]=f(D[C],D[ma],D[da]);var aa=[],ka,ja=ta.concat();J=0;for(H=x.length;J<H;J++){P=x[J];ka=[];C=0;R=P.length;ma=R-1;for(da=C+1;C<R;C++,ma++,da++)ma==R&&(ma=0),da==R&&(da=0),ka[C]=f(P[C],P[ma],P[da]);aa.push(ka);ja=ja.concat(ka)}for(O=0;O<v;O++){V=O/v;W=u*(1-
+V);V=p*Math.sin(V*Math.PI/2);C=0;for(R=D.length;C<R;C++)o=e(D[C],ta[C],V),m(o.x,o.y,-W);J=0;for(H=x.length;J<H;J++){P=x[J];ka=aa[J];C=0;for(R=P.length;C<R;C++)o=e(P[C],ka[C],V),m(o.x,o.y,-W)}}V=p;for(C=0;C<ea;C++)o=t?e(z[C],ja[C],V):z[C],E?m(o.x,o.y+A[0].y,A[0].x):m(o.x,o.y,0);for(O=1;O<=w;O++)for(C=0;C<ea;C++)o=t?e(z[C],ja[C],V):z[C],E?m(o.x,o.y+A[O-1].y,A[O-1].x):m(o.x,o.y,n/w*O);for(O=v-1;O>=0;O--){V=O/v;W=u*(1-V);V=p*Math.sin(V*Math.PI/2);C=0;for(R=D.length;C<R;C++)o=e(D[C],ta[C],V),m(o.x,o.y,
+n+W);J=0;for(H=x.length;J<H;J++){P=x[J];ka=aa[J];C=0;for(R=P.length;C<R;C++)o=e(P[C],ka[C],V),E?m(o.x,o.y+A[w-1].y,A[w-1].x+W):m(o.x,o.y,n+W)}}if(t){t=ea*0;for(C=0;C<S;C++)p=y[C],k(p[2]+t,p[1]+t,p[0]+t);t=ea*(w+v*2);for(C=0;C<S;C++)p=y[C],k(p[0]+t,p[1]+t,p[2]+t)}else{for(C=0;C<S;C++)p=y[C],k(p[2],p[1],p[0]);for(C=0;C<S;C++)p=y[C],k(p[0]+ea*w,p[1]+ea*w,p[2]+ea*w)}var ma,da,$=0;h(D);$+=D.length;J=0;for(H=x.length;J<H;J++)P=x[J],h(P),$+=P.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.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=h.vertices[b].position,k=h.vertices[e].position;return c((f.x+k.x)/2,(f.y+k.y)/2,(f.z+k.z)/2)}var h=this,m=new THREE.Geometry;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
 THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=h.vertices[b].position,k=h.vertices[e].position;return c((f.x+k.x)/2,(f.y+k.y)/2,(f.z+k.z)/2)}var h=this,m=new THREE.Geometry;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
 -b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,m);e(0,5,1,m);e(0,1,7,m);e(0,7,10,m);e(0,10,11,m);e(1,5,9,m);e(5,11,4,m);e(11,10,2,m);e(10,7,6,m);e(7,1,8,m);e(3,9,4,m);e(3,4,2,m);e(3,2,6,m);e(3,6,8,m);e(3,8,9,m);e(4,9,5,m);e(2,4,11,m);e(6,2,10,m);e(8,6,7,m);e(9,8,1,m);for(var k=0;k<this.subdivisions;k++){var b=new THREE.Geometry,n;for(n in m.faces){var u=f(m.faces[n].a,m.faces[n].b),p=f(m.faces[n].b,m.faces[n].c),v=f(m.faces[n].c,m.faces[n].a);e(m.faces[n].a,u,v,b);e(m.faces[n].b,p,
 -b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,m);e(0,5,1,m);e(0,1,7,m);e(0,7,10,m);e(0,10,11,m);e(1,5,9,m);e(5,11,4,m);e(11,10,2,m);e(10,7,6,m);e(7,1,8,m);e(3,9,4,m);e(3,4,2,m);e(3,2,6,m);e(3,6,8,m);e(3,8,9,m);e(4,9,5,m);e(2,4,11,m);e(6,2,10,m);e(8,6,7,m);e(9,8,1,m);for(var k=0;k<this.subdivisions;k++){var b=new THREE.Geometry,n;for(n in m.faces){var u=f(m.faces[n].a,m.faces[n].b),p=f(m.faces[n].b,m.faces[n].c),v=f(m.faces[n].c,m.faces[n].a);e(m.faces[n].a,u,v,b);e(m.faces[n].b,p,
 u,b);e(m.faces[n].c,v,p,b);e(u,p,v,b)}m.faces=b.faces}h.faces=m.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 u,b);e(m.faces[n].c,v,p,b);e(u,p,v,b)}m.faces=b.faces}h.faces=m.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],h=[],m=[],k=(new THREE.Matrix4).setRotationZ(c),n=0;n<b.length;n++)this.vertices.push(new THREE.Vertex(b[n])),e[n]=b[n].clone(),f[n]=this.vertices.length-1;for(var u=0;u<=this.angle+0.001;u+=c){for(n=0;n<e.length;n++)u<this.angle?(e[n]=k.multiplyVector3(e[n].clone()),this.vertices.push(new THREE.Vertex(e[n])),h[n]=this.vertices.length-1):h=m;u==0&&(m=f);
+THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],h=[],m=[],k=(new THREE.Matrix4).setRotationZ(c),n=0;n<b.length;n++)this.vertices.push(new THREE.Vertex(b[n])),e[n]=b[n].clone(),f[n]=this.vertices.length-1;for(var u=0;u<=this.angle+0.0010;u+=c){for(n=0;n<e.length;n++)u<this.angle?(e[n]=k.multiplyVector3(e[n].clone()),this.vertices.push(new THREE.Vertex(e[n])),h[n]=this.vertices.length-1):h=m;u==0&&(m=f);
 for(n=0;n<f.length-1;n++)this.faces.push(new THREE.Face4(h[n],h[n+1],f[n+1],f[n])),this.faceVertexUvs[0].push([new THREE.UV(1-u/this.angle,n/b.length),new THREE.UV(1-u/this.angle,(n+1)/b.length),new THREE.UV(1-(u-c)/this.angle,(n+1)/b.length),new THREE.UV(1-(u-c)/this.angle,n/b.length)]);f=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 for(n=0;n<f.length-1;n++)this.faces.push(new THREE.Face4(h[n],h[n+1],f[n+1],f[n])),this.faceVertexUvs[0].push([new THREE.UV(1-u/this.angle,n/b.length),new THREE.UV(1-u/this.angle,(n+1)/b.length),new THREE.UV(1-(u-c)/this.angle,(n+1)/b.length),new THREE.UV(1-(u-c)/this.angle,n/b.length)]);f=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var h,m=b/2,k=c/2,e=e||1,f=f||1,n=e+1,u=f+1;b/=e;var p=c/f;for(h=0;h<u;h++)for(c=0;c<n;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-m,-(h*p-k),0)));for(h=0;h<f;h++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+n*h,c+n*(h+1),c+1+n*(h+1),c+1+n*h)),this.faceVertexUvs[0].push([new THREE.UV(c/e,h/f),new THREE.UV(c/e,(h+1)/f),new THREE.UV((c+1)/e,(h+1)/f),new THREE.UV((c+1)/e,h/f)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var h,m=b/2,k=c/2,e=e||1,f=f||1,n=e+1,u=f+1;b/=e;var p=c/f;for(h=0;h<u;h++)for(c=0;c<n;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-m,-(h*p-k),0)));for(h=0;h<f;h++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+n*h,c+n*(h+1),c+1+n*(h+1),c+1+n*h)),this.faceVertexUvs[0].push([new THREE.UV(c/e,h/f),new THREE.UV(c/e,(h+1)/f),new THREE.UV((c+1)/e,(h+1)/f),new THREE.UV((c+1)/e,h/f)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
@@ -513,8 +513,8 @@ this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),m=h.length,k=[
 p));h.moveTo(n,p);break;case "l":n=c[b++]*e+f;p=c[b++]*e;m.push(new THREE.Vector2(n,p));h.lineTo(n,p);break;case "q":n=c[b++]*e+f;p=c[b++]*e;x=c[b++]*e+f;w=c[b++]*e;h.quadraticCurveTo(x,w,n,p);if(k=m[m.length-1]){v=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var E=k/divisions,D=THREE.Shape.Utils.b2(E,v,x,n),E=THREE.Shape.Utils.b2(E,t,w,p);m.push(new THREE.Vector2(D,E))}}break;case "b":if(n=c[b++]*e+f,p=c[b++]*e,x=c[b++]*e+f,w=c[b++]*-e,z=c[b++]*e+f,y=c[b++]*-e,h.bezierCurveTo(n,p,
 p));h.moveTo(n,p);break;case "l":n=c[b++]*e+f;p=c[b++]*e;m.push(new THREE.Vector2(n,p));h.lineTo(n,p);break;case "q":n=c[b++]*e+f;p=c[b++]*e;x=c[b++]*e+f;w=c[b++]*e;h.quadraticCurveTo(x,w,n,p);if(k=m[m.length-1]){v=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var E=k/divisions,D=THREE.Shape.Utils.b2(E,v,x,n),E=THREE.Shape.Utils.b2(E,t,w,p);m.push(new THREE.Vector2(D,E))}}break;case "b":if(n=c[b++]*e+f,p=c[b++]*e,x=c[b++]*e+f,w=c[b++]*-e,z=c[b++]*e+f,y=c[b++]*-e,h.bezierCurveTo(n,p,
 x,w,z,y),k=m[m.length-1]){v=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)E=k/divisions,D=THREE.Shape.Utils.b3(E,v,x,z,n),E=THREE.Shape.Utils.b3(E,t,w,y,p),m.push(new THREE.Vector2(D,E))}}}return{offset:A.ha*e,points:m,path:h}}}};
 x,w,z,y),k=m[m.length-1]){v=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)E=k/divisions,D=THREE.Shape.Utils.b3(E,v,x,z,n),E=THREE.Shape.Utils.b3(E,t,w,y,p),m.push(new THREE.Vector2(D,E))}}}return{offset:A.ha*e,points:m,path:h}}}};
 (function(b){var c=function(b){for(var c=b.length,h=0,m=c-1,k=0;k<c;m=k++)h+=b[m].x*b[k].y-b[k].x*b[m].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var m=[],k=[],n=[],u,p,v;if(c(b)>0)for(p=0;p<h;p++)k[p]=p;else for(p=0;p<h;p++)k[p]=h-1-p;var t=2*h;for(p=h-1;h>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}u=p;h<=u&&(u=0);p=u+1;h<=p&&(p=0);v=p+1;h<=v&&(v=0);var x;a:{x=b;var w=u,z=p,y=v,A=h,E=k,D=void 0,G=void 0,I=void 0,
 (function(b){var c=function(b){for(var c=b.length,h=0,m=c-1,k=0;k<c;m=k++)h+=b[m].x*b[k].y-b[k].x*b[m].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var m=[],k=[],n=[],u,p,v;if(c(b)>0)for(p=0;p<h;p++)k[p]=p;else for(p=0;p<h;p++)k[p]=h-1-p;var t=2*h;for(p=h-1;h>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}u=p;h<=u&&(u=0);p=u+1;h<=p&&(p=0);v=p+1;h<=v&&(v=0);var x;a:{x=b;var w=u,z=p,y=v,A=h,E=k,D=void 0,G=void 0,I=void 0,
-N=void 0,P=void 0,J=void 0,H=void 0,K=void 0,Y=void 0,G=x[E[w]].x,I=x[E[w]].y,N=x[E[z]].x,P=x[E[z]].y,J=x[E[y]].x,H=x[E[y]].y;if(1.0E-10>(N-G)*(H-I)-(P-I)*(J-G))x=!1;else{for(D=0;D<A;D++)if(!(D==w||D==z||D==y)){var K=x[E[D]].x,Y=x[E[D]].y,C=void 0,R=void 0,O=void 0,U=void 0,V=void 0,o=void 0,ea=void 0,S=void 0,na=void 0,$=void 0,qa=void 0,ka=void 0,C=O=V=void 0,C=J-N,R=H-P,O=G-J,U=I-H,V=N-G,o=P-I,ea=K-G,S=Y-I,na=K-N,$=Y-P,qa=K-J,ka=Y-H,C=C*$-R*na,V=V*S-o*ea,O=O*ka-U*qa;if(C>=0&&O>=0&&V>=0){x=!1;break a}}x=
-!0}}if(x){m.push([b[k[u]],b[k[p]],b[k[v]]]);n.push([k[u],k[p],k[v]]);u=p;for(v=p+1;v<h;u++,v++)k[u]=k[v];h--;t=2*h}}if(f)return n;return m};b.Triangulate.area=c;return b})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+N=void 0,P=void 0,J=void 0,H=void 0,K=void 0,Z=void 0,G=x[E[w]].x,I=x[E[w]].y,N=x[E[z]].x,P=x[E[z]].y,J=x[E[y]].x,H=x[E[y]].y;if(1.0E-10>(N-G)*(H-I)-(P-I)*(J-G))x=!1;else{for(D=0;D<A;D++)if(!(D==w||D==z||D==y)){var K=x[E[D]].x,Z=x[E[D]].y,C=void 0,R=void 0,O=void 0,V=void 0,W=void 0,o=void 0,ea=void 0,S=void 0,ta=void 0,aa=void 0,ka=void 0,ja=void 0,C=O=W=void 0,C=J-N,R=H-P,O=G-J,V=I-H,W=N-G,o=P-I,ea=K-G,S=Z-I,ta=K-N,aa=Z-P,ka=K-J,ja=Z-H,C=C*aa-R*ta,W=W*S-o*ea,O=O*ja-V*ka;if(C>=0&&O>=0&&W>=0){x=!1;
+break a}}x=!0}}if(x){m.push([b[k[u]],b[k[p]],b[k[v]]]);n.push([k[u],k[p],k[v]]);u=p;for(v=p+1;v<h;u++,v++)k[u]=k[v];h--;t=2*h}}if(f)return n;return m};b.Triangulate.area=c;return b})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(b,c,e,f,h){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=h||Math.PI*2;h=new THREE.Vector3;b=[];c=[];for(e=0;e<=this.segmentsR;e++)for(f=0;f<=this.segmentsT;f++){var m=f/this.segmentsT*this.arc,k=e/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(m);h.y=this.radius*Math.sin(m);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(k))*Math.cos(m);n.y=(this.radius+this.tube*Math.cos(k))*Math.sin(m);n.z=
 THREE.TorusGeometry=function(b,c,e,f,h){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=h||Math.PI*2;h=new THREE.Vector3;b=[];c=[];for(e=0;e<=this.segmentsR;e++)for(f=0;f<=this.segmentsT;f++){var m=f/this.segmentsT*this.arc,k=e/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(m);h.y=this.radius*Math.sin(m);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(k))*Math.cos(m);n.y=(this.radius+this.tube*Math.cos(k))*Math.sin(m);n.z=
 this.tube*Math.sin(k);this.vertices.push(new THREE.Vertex(n));b.push(new THREE.UV(f/this.segmentsT,1-e/this.segmentsR));c.push(n.clone().subSelf(h).normalize())}for(e=1;e<=this.segmentsR;e++)for(f=1;f<=this.segmentsT;f++){var h=(this.segmentsT+1)*e+f-1,m=(this.segmentsT+1)*(e-1)+f-1,k=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,u=new THREE.Face4(h,m,k,n,[c[h],c[m],c[k],c[n]]);u.normal.addSelf(c[h]);u.normal.addSelf(c[m]);u.normal.addSelf(c[k]);u.normal.addSelf(c[n]);u.normal.normalize();this.faces.push(u);
 this.tube*Math.sin(k);this.vertices.push(new THREE.Vertex(n));b.push(new THREE.UV(f/this.segmentsT,1-e/this.segmentsR));c.push(n.clone().subSelf(h).normalize())}for(e=1;e<=this.segmentsR;e++)for(f=1;f<=this.segmentsT;f++){var h=(this.segmentsT+1)*e+f-1,m=(this.segmentsT+1)*(e-1)+f-1,k=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,u=new THREE.Face4(h,m,k,n,[c[h],c[m],c[k],c[n]]);u.normal.addSelf(c[h]);u.normal.addSelf(c[m]);u.normal.addSelf(c[k]);u.normal.addSelf(c[n]);u.normal.normalize();this.faces.push(u);
 this.faceVertexUvs[0].push([b[h].clone(),b[m].clone(),b[k].clone(),b[n].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 this.faceVertexUvs[0].push([b[h].clone(),b[m].clone(),b[k].clone(),b[n].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
@@ -536,71 +536,71 @@ c.postMessage(b)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,m){var k=new XMLHttpRequest,n=f+"/"+b,u=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,e,h,c):alert("Couldn't load ["+n+"] ["+k.status+"]"):k.readyState==3?m&&(u==0&&(u=k.getResponseHeader("Content-Length")),m({total:u,loaded:k.responseText.length})):k.readyState==2&&(u=k.getResponseHeader("Content-Length"))};k.open("GET",n,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,m){var k=new XMLHttpRequest,n=f+"/"+b,u=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,e,h,c):alert("Couldn't load ["+n+"] ["+k.status+"]"):k.readyState==3?m&&(u==0&&(u=k.getResponseHeader("Content-Length")),m({total:u,loaded:k.responseText.length})):k.readyState==2&&(u=k.getResponseHeader("Content-Length"))};k.open("GET",n,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
 k.setRequestHeader("Content-Type","text/plain");k.send(null)};
 k.setRequestHeader("Content-Type","text/plain");k.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(c){function e(b,c){var f=v(b,c),h=v(b,c+1),k=v(b,c+2),m=v(b,c+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,c){var e=v(b,c),f=v(b,c+1),k=v(b,c+2);return(v(b,c+3)<<24)+(k<<16)+(f<<8)+e}function u(b,c){var e=v(b,c);return(v(b,c+1)<<8)+e}function p(b,c){var e=v(b,c);return e>127?e-256:e}function v(b,c){return b.charCodeAt(c)&255}function t(c){var e,
 THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(c){function e(b,c){var f=v(b,c),h=v(b,c+1),k=v(b,c+2),m=v(b,c+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,c){var e=v(b,c),f=v(b,c+1),k=v(b,c+2);return(v(b,c+3)<<24)+(k<<16)+(f<<8)+e}function u(b,c){var e=v(b,c);return(v(b,c+1)<<8)+e}function p(b,c){var e=v(b,c);return e>127?e-256:e}function v(b,c){return b.charCodeAt(c)&255}function t(c){var e,
-f,k;e=h(b,c);f=h(b,c+P);k=h(b,c+J);c=u(b,c+H);E.faces.push(new THREE.Face3(e,f,k,null,null,E.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+P);k=h(b,c+J);m=u(b,c+H);o=h(b,c+K);p=h(b,c+Y);c=h(b,c+C);m=E.materials[m];var t=I[p*3],v=I[p*3+1];p=I[p*3+2];var w=I[c*3],L=I[c*3+1],c=I[c*3+2];E.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(I[o*3],I[o*3+1],I[o*3+2]),new THREE.Vector3(t,v,p),new THREE.Vector3(w,L,c)],null,m))}function w(c){var e,f,k,m;e=h(b,c);f=h(b,c+R);k=h(b,c+O);m=h(b,
-c+U);c=u(b,c+V);E.faces.push(new THREE.Face4(e,f,k,m,null,null,E.materials[c]))}function z(c){var e,f,k,m,p,t,v,w;e=h(b,c);f=h(b,c+R);k=h(b,c+O);m=h(b,c+U);p=u(b,c+V);t=h(b,c+o);v=h(b,c+ea);w=h(b,c+S);c=h(b,c+na);p=E.materials[p];var x=I[v*3],L=I[v*3+1];v=I[v*3+2];var y=I[w*3],W=I[w*3+1];w=I[w*3+2];var z=I[c*3],A=I[c*3+1],c=I[c*3+2];E.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(I[t*3],I[t*3+1],I[t*3+2]),new THREE.Vector3(x,L,v),new THREE.Vector3(y,W,w),new THREE.Vector3(z,A,c)],null,p))}
-function y(c){var e,f,k,m;e=h(b,c);f=h(b,c+$);k=h(b,c+qa);c=N[e*2];m=N[e*2+1];e=N[f*2];var o=E.faceVertexUvs[0];f=N[f*2+1];var p=N[k*2];k=N[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function A(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ka);k=h(b,c+ma);m=h(b,c+da);c=N[e*2];o=N[e*2+1];e=N[f*2];p=N[f*2+1];f=N[k*2];var t=E.faceVertexUvs[0];k=N[k*2+1];var u=N[m*2];m=N[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f,
-k));v.push(new THREE.UV(u,m));t.push(v)}var E=this,D=0,G,I=[],N=[],P,J,H,K,Y,C,R,O,U,V,o,ea,S,na,$,qa,ka,ma,da,fa,T,Z,aa,ga,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,c);G={signature:b.substr(D,8),header_bytes:v(b,D+8),vertex_coordinate_bytes:v(b,D+9),normal_coordinate_bytes:v(b,D+10),uv_coordinate_bytes:v(b,D+11),vertex_index_bytes:v(b,D+12),normal_index_bytes:v(b,D+13),uv_index_bytes:v(b,D+14),material_index_bytes:v(b,D+15),nvertices:h(b,D+16),nnormals:h(b,D+16+4),nuvs:h(b,
-D+16+8),ntri_flat:h(b,D+16+12),ntri_smooth:h(b,D+16+16),ntri_flat_uv:h(b,D+16+20),ntri_smooth_uv:h(b,D+16+24),nquad_flat:h(b,D+16+28),nquad_smooth:h(b,D+16+32),nquad_flat_uv:h(b,D+16+36),nquad_smooth_uv:h(b,D+16+40)};D+=G.header_bytes;P=G.vertex_index_bytes;J=G.vertex_index_bytes*2;H=G.vertex_index_bytes*3;K=G.vertex_index_bytes*3+G.material_index_bytes;Y=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes;C=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*2;R=G.vertex_index_bytes;
-O=G.vertex_index_bytes*2;U=G.vertex_index_bytes*3;V=G.vertex_index_bytes*4;o=G.vertex_index_bytes*4+G.material_index_bytes;ea=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes;S=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*2;na=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*3;$=G.uv_index_bytes;qa=G.uv_index_bytes*2;ka=G.uv_index_bytes;ma=G.uv_index_bytes*2;da=G.uv_index_bytes*3;c=G.vertex_index_bytes*3+G.material_index_bytes;sa=G.vertex_index_bytes*
-4+G.material_index_bytes;fa=G.ntri_flat*c;T=G.ntri_smooth*(c+G.normal_index_bytes*3);Z=G.ntri_flat_uv*(c+G.uv_index_bytes*3);aa=G.ntri_smooth_uv*(c+G.normal_index_bytes*3+G.uv_index_bytes*3);ga=G.nquad_flat*sa;c=G.nquad_smooth*(sa+G.normal_index_bytes*4);sa=G.nquad_flat_uv*(sa+G.uv_index_bytes*4);D+=function(c){for(var f,h,m,n=G.vertex_coordinate_bytes*3,o=c+G.nvertices*n;c<o;c+=n)f=e(b,c),h=e(b,c+G.vertex_coordinate_bytes),m=e(b,c+G.vertex_coordinate_bytes*2),E.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
-h,m)));return G.nvertices*n}(D);D+=function(c){for(var e,f,h,k=G.normal_coordinate_bytes*3,m=c+G.nnormals*k;c<m;c+=k)e=p(b,c),f=p(b,c+G.normal_coordinate_bytes),h=p(b,c+G.normal_coordinate_bytes*2),I.push(e/127,f/127,h/127);return G.nnormals*k}(D);D+=function(c){for(var f,h,m=G.uv_coordinate_bytes*2,n=c+G.nuvs*m;c<n;c+=m)f=e(b,c),h=e(b,c+G.uv_coordinate_bytes),N.push(f,h);return G.nuvs*m}(D);fa=D+fa;T=fa+T;Z=T+Z;aa=Z+aa;ga=aa+ga;c=ga+c;sa=c+sa;(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes,
-f=e+G.uv_index_bytes*3,h=b+G.ntri_flat_uv*f;for(c=b;c<h;c+=f)t(c),y(c+e);return h-b})(T);(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*3,f=e+G.uv_index_bytes*3,h=b+G.ntri_smooth_uv*f;for(c=b;c<h;c+=f)x(c),y(c+e);return h-b})(Z);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes,f=e+G.uv_index_bytes*4,h=b+G.nquad_flat_uv*f;for(c=b;c<h;c+=f)w(c),A(c+e);return h-b})(c);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*
-4,f=e+G.uv_index_bytes*4,h=b+G.nquad_smooth_uv*f;for(c=b;c<h;c+=f)z(c),A(c+e);return h-b})(sa);(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes,f=b+G.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(D);(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*3,f=b+G.ntri_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(fa);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes,f=b+G.nquad_flat*e;for(c=b;c<f;c+=e)w(c);return f-b})(aa);(function(b){var c,
-e=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*4,f=b+G.nquad_smooth*e;for(c=b;c<f;c+=e)z(c);return f-b})(ga);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
-THREE.ColladaLoader=function(){function b(b,c,e){for(var b=fa.evaluate(b,fa,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new c).parse(h);if(h.id.length==0)h.id=e+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,c=-b,e=0,f;for(f in sa)for(var h=sa[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);c=Math.max(c,m.endTime);e=Math.max(e,m.input.length)}return{start:b,end:c,frames:e}}function e(b,c,f,h){b.world=b.world||
-new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=b.channels[0].sampler.output[f];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);c.push(b);for(h=0;h<b.nodes.length;h++)e(b.nodes[h],c,f,b.world)}function f(b,f,h){var k=la[f.url];if(!k||!k.skin)console.log("could not find skin controller!");else if(!f.skeleton||!f.skeleton.length)console.log("could not find the skeleton for the skin!");else{var m=c(),f=Z.getChildById(f.skeleton[0],!0)||Z.getChildBySid(f.skeleton[0],
+f,k;e=h(b,c);f=h(b,c+P);k=h(b,c+J);c=u(b,c+H);E.faces.push(new THREE.Face3(e,f,k,null,null,E.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+P);k=h(b,c+J);m=u(b,c+H);o=h(b,c+K);p=h(b,c+Z);c=h(b,c+C);m=E.materials[m];var t=I[p*3],v=I[p*3+1];p=I[p*3+2];var w=I[c*3],L=I[c*3+1],c=I[c*3+2];E.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(I[o*3],I[o*3+1],I[o*3+2]),new THREE.Vector3(t,v,p),new THREE.Vector3(w,L,c)],null,m))}function w(c){var e,f,k,m;e=h(b,c);f=h(b,c+R);k=h(b,c+O);m=h(b,
+c+V);c=u(b,c+W);E.faces.push(new THREE.Face4(e,f,k,m,null,null,E.materials[c]))}function z(c){var e,f,k,m,p,t,v,w;e=h(b,c);f=h(b,c+R);k=h(b,c+O);m=h(b,c+V);p=u(b,c+W);t=h(b,c+o);v=h(b,c+ea);w=h(b,c+S);c=h(b,c+ta);p=E.materials[p];var x=I[v*3],L=I[v*3+1];v=I[v*3+2];var y=I[w*3],X=I[w*3+1];w=I[w*3+2];var z=I[c*3],A=I[c*3+1],c=I[c*3+2];E.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(I[t*3],I[t*3+1],I[t*3+2]),new THREE.Vector3(x,L,v),new THREE.Vector3(y,X,w),new THREE.Vector3(z,A,c)],null,p))}
+function y(c){var e,f,k,m;e=h(b,c);f=h(b,c+aa);k=h(b,c+ka);c=N[e*2];m=N[e*2+1];e=N[f*2];var o=E.faceVertexUvs[0];f=N[f*2+1];var p=N[k*2];k=N[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function A(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ja);k=h(b,c+ma);m=h(b,c+da);c=N[e*2];o=N[e*2+1];e=N[f*2];p=N[f*2+1];f=N[k*2];var t=E.faceVertexUvs[0];k=N[k*2+1];var u=N[m*2];m=N[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f,
+k));v.push(new THREE.UV(u,m));t.push(v)}var E=this,D=0,G,I=[],N=[],P,J,H,K,Z,C,R,O,V,W,o,ea,S,ta,aa,ka,ja,ma,da,$,U,T,fa,na,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,c);G={signature:b.substr(D,8),header_bytes:v(b,D+8),vertex_coordinate_bytes:v(b,D+9),normal_coordinate_bytes:v(b,D+10),uv_coordinate_bytes:v(b,D+11),vertex_index_bytes:v(b,D+12),normal_index_bytes:v(b,D+13),uv_index_bytes:v(b,D+14),material_index_bytes:v(b,D+15),nvertices:h(b,D+16),nnormals:h(b,D+16+4),nuvs:h(b,
+D+16+8),ntri_flat:h(b,D+16+12),ntri_smooth:h(b,D+16+16),ntri_flat_uv:h(b,D+16+20),ntri_smooth_uv:h(b,D+16+24),nquad_flat:h(b,D+16+28),nquad_smooth:h(b,D+16+32),nquad_flat_uv:h(b,D+16+36),nquad_smooth_uv:h(b,D+16+40)};D+=G.header_bytes;P=G.vertex_index_bytes;J=G.vertex_index_bytes*2;H=G.vertex_index_bytes*3;K=G.vertex_index_bytes*3+G.material_index_bytes;Z=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes;C=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*2;R=G.vertex_index_bytes;
+O=G.vertex_index_bytes*2;V=G.vertex_index_bytes*3;W=G.vertex_index_bytes*4;o=G.vertex_index_bytes*4+G.material_index_bytes;ea=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes;S=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*2;ta=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*3;aa=G.uv_index_bytes;ka=G.uv_index_bytes*2;ja=G.uv_index_bytes;ma=G.uv_index_bytes*2;da=G.uv_index_bytes*3;c=G.vertex_index_bytes*3+G.material_index_bytes;sa=G.vertex_index_bytes*
+4+G.material_index_bytes;$=G.ntri_flat*c;U=G.ntri_smooth*(c+G.normal_index_bytes*3);T=G.ntri_flat_uv*(c+G.uv_index_bytes*3);fa=G.ntri_smooth_uv*(c+G.normal_index_bytes*3+G.uv_index_bytes*3);na=G.nquad_flat*sa;c=G.nquad_smooth*(sa+G.normal_index_bytes*4);sa=G.nquad_flat_uv*(sa+G.uv_index_bytes*4);D+=function(c){for(var f,h,m,n=G.vertex_coordinate_bytes*3,o=c+G.nvertices*n;c<o;c+=n)f=e(b,c),h=e(b,c+G.vertex_coordinate_bytes),m=e(b,c+G.vertex_coordinate_bytes*2),E.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
+h,m)));return G.nvertices*n}(D);D+=function(c){for(var e,f,h,k=G.normal_coordinate_bytes*3,m=c+G.nnormals*k;c<m;c+=k)e=p(b,c),f=p(b,c+G.normal_coordinate_bytes),h=p(b,c+G.normal_coordinate_bytes*2),I.push(e/127,f/127,h/127);return G.nnormals*k}(D);D+=function(c){for(var f,h,m=G.uv_coordinate_bytes*2,n=c+G.nuvs*m;c<n;c+=m)f=e(b,c),h=e(b,c+G.uv_coordinate_bytes),N.push(f,h);return G.nuvs*m}(D);$=D+$;U=$+U;T=U+T;fa=T+fa;na=fa+na;c=na+c;sa=c+sa;(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes,
+f=e+G.uv_index_bytes*3,h=b+G.ntri_flat_uv*f;for(c=b;c<h;c+=f)t(c),y(c+e);return h-b})(U);(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*3,f=e+G.uv_index_bytes*3,h=b+G.ntri_smooth_uv*f;for(c=b;c<h;c+=f)x(c),y(c+e);return h-b})(T);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes,f=e+G.uv_index_bytes*4,h=b+G.nquad_flat_uv*f;for(c=b;c<h;c+=f)w(c),A(c+e);return h-b})(c);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*
+4,f=e+G.uv_index_bytes*4,h=b+G.nquad_smooth_uv*f;for(c=b;c<h;c+=f)z(c),A(c+e);return h-b})(sa);(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes,f=b+G.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(D);(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*3,f=b+G.ntri_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})($);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes,f=b+G.nquad_flat*e;for(c=b;c<f;c+=e)w(c);return f-b})(fa);(function(b){var c,
+e=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*4,f=b+G.nquad_smooth*e;for(c=b;c<f;c+=e)z(c);return f-b})(na);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
+THREE.ColladaLoader=function(){function b(b,c,e){for(var b=$.evaluate(b,$,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new c).parse(h);if(h.id.length==0)h.id=e+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,c=-b,e=0,f;for(f in la)for(var h=la[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);c=Math.max(c,m.endTime);e=Math.max(e,m.input.length)}return{start:b,end:c,frames:e}}function e(b,c,f,h){b.world=b.world||
+new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=b.channels[0].sampler.output[f];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);c.push(b);for(h=0;h<b.nodes.length;h++)e(b.nodes[h],c,f,b.world)}function f(b,f,h){var k=ca[f.url];if(!k||!k.skin)console.log("could not find skin controller!");else if(!f.skeleton||!f.skeleton.length)console.log("could not find the skeleton for the skin!");else{var m=c(),f=T.getChildById(f.skeleton[0],!0)||T.getChildBySid(f.skeleton[0],
 !0),n,o,p,t,u=new THREE.Vector3,v;for(n=0;n<b.vertices.length;n++)k.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(h=0;h<m.frames;h++){var w=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));e(f,w,h);n=w;o=k.skin;for(t=0;t<n.length;t++){p=n[t];v=-1;for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];
 !0),n,o,p,t,u=new THREE.Vector3,v;for(n=0;n<b.vertices.length;n++)k.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(h=0;h<m.frames;h++){var w=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));e(f,w,h);n=w;o=k.skin;for(t=0;t<n.length;t++){p=n[t];v=-1;for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];
 for(y=0;y<o.weights.length;y++)for(var z=0;z<o.weights[y].length;z++){var A=o.weights[y][z];A.joint==v&&p.weights.push(A)}}else throw"could not find joint!";}for(n=0;n<w.length;n++)for(o=0;o<w[n].weights.length;o++)p=w[n].weights[o],t=p.index,p=p.weight,v=b.vertices[t],t=x[t],u.x=v.position.x,u.y=v.position.y,u.z=v.position.z,w[n].skinningMatrix.multiplyVector3(u),t.position.x+=u.x*p,t.position.y+=u.y*p,t.position.z+=u.z*p;b.morphTargets.push({name:"target_"+h,vertices:x})}}}function h(b){var c=new THREE.Object3D,
 for(y=0;y<o.weights.length;y++)for(var z=0;z<o.weights[y].length;z++){var A=o.weights[y][z];A.joint==v&&p.weights.push(A)}}else throw"could not find joint!";}for(n=0;n<w.length;n++)for(o=0;o<w[n].weights.length;o++)p=w[n].weights[o],t=p.index,p=p.weight,v=b.vertices[t],t=x[t],u.x=v.position.x,u.y=v.position.y,u.z=v.position.z,w[n].skinningMatrix.multiplyVector3(u),t.position.x+=u.x*p,t.position.y+=u.y*p,t.position.z+=u.z*p;b.morphTargets.push({name:"target_"+h,vertices:x})}}}function h(b){var c=new THREE.Object3D,
-e,k,m;c.name=b.id||"";c.matrixAutoUpdate=!1;c.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=la[b.controllers[m].url];switch(n.type){case "skin":if(ca[n.skin.source]){var o=new z;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);e=b.controllers[m]}else if(la[n.skin.source]&&(k=n=la[n.skin.source],n.morph&&ca[n.morph.source]))o=new z,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(ca[n.morph.source])o=
-new z,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),k=b.controllers[m];console.log("DAE: morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=ca[n.url],p={},t=0,u;if(n&&n.mesh&&n.mesh.primitives){if(c.name.length==0)c.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=ua[oa[u.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;u=p[u.symbol]=
-v.material;t++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(t>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)t=n.faces[j],t.materials=[p[t.daeMaterial]]}if(e!==void 0)f(n,e),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=e.skeleton,o.skinController=la[e.url],o.skinInstanceController=e,o.name="skin_"+Aa.length,Aa.push(o);else if(k!==void 0){p=n;t=k instanceof x?la[k.url]:k;if(!t||!t.morph)console.log("could not find morph controller!");
-else{t=t.morph;for(v=0;v<t.targets.length;v++){var w=ca[t.targets[v]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:w.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+va.length;va.push(o)}else o=new THREE.Mesh(n,o);c.addChild(o)}}for(m=0;m<b.nodes.length;m++)c.addChild(h(b.nodes[m],b));return c}function m(){this.init_from=
+e,k,m;c.name=b.id||"";c.matrixAutoUpdate=!1;c.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=ca[b.controllers[m].url];switch(n.type){case "skin":if(qa[n.skin.source]){var o=new z;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);e=b.controllers[m]}else if(ca[n.skin.source]&&(k=n=ca[n.skin.source],n.morph&&qa[n.morph.source]))o=new z,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(qa[n.morph.source])o=
+new z,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),k=b.controllers[m];console.log("DAE: morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=qa[n.url],p={},t=0,u;if(n&&n.mesh&&n.mesh.primitives){if(c.name.length==0)c.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=ra[ua[u.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;u=p[u.symbol]=
+v.material;t++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(t>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)t=n.faces[j],t.materials=[p[t.daeMaterial]]}if(e!==void 0)f(n,e),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=e.skeleton,o.skinController=ca[e.url],o.skinInstanceController=e,o.name="skin_"+Ba.length,Ba.push(o);else if(k!==void 0){p=n;t=k instanceof x?ca[k.url]:k;if(!t||!t.morph)console.log("could not find morph controller!");
+else{t=t.morph;for(v=0;v<t.targets.length;v++){var w=qa[t.targets[v]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:w.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+va.length;va.push(o)}else o=new THREE.Mesh(n,o);c.addChild(o)}}for(m=0;m<b.nodes.length;m++)c.addChild(h(b.nodes[m],b));return c}function m(){this.init_from=
 this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function u(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function p(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function v(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function t(){this.type=
 this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function u(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function p(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function v(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function t(){this.type=
 this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function w(){this.target=this.symbol=""}function z(){this.url="";this.instance_material=[]}function y(){this.id="";this.mesh=null}function A(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function E(){}function D(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function G(){this.source="";
 this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function w(){this.target=this.symbol=""}function z(){this.url="";this.instance_material=[]}function y(){this.id="";this.mesh=null}function A(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function E(){}function D(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function G(){this.source="";
-this.stride=this.count=0;this.params=[]}function I(){this.input={}}function N(){this.semantic="";this.offset=0;this.source="";this.set=0}function P(b){this.id=b;this.type=null}function J(){this.name=this.id="";this.instance_effect=null}function H(){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 K(b,c){this.type=b;this.effect=c;this.material=null}function Y(b){this.effect=b;this.format=this.init_from=
-null}function C(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function R(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function O(){this.url=""}function U(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function V(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
-this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ea(b){var c=b.getAttribute("id");if(aa[c]!=void 0)return aa[c];aa[c]=(new P(c)).parse(b);return aa[c]}function S(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function na(b){for(var b=qa(b),c=[],e=0;e<b.length;e++)c.push(parseFloat(b[e]));return c}function $(b){for(var b=qa(b),c=[],e=0;e<b.length;e++)c.push(parseInt(b[e],10));return c}function qa(b){return b.replace(/^\s+/,"").replace(/\s+$/,
-"").split(/\s+/)}function ka(b,c,e){return b.hasAttribute(c)?parseInt(b.getAttribute(c),10):e}function ma(b,c){if(b===void 0){for(var e="0.";e.length<c+2;)e+="0";return e}c=c||2;e=b.toString().split(".");for(e[1]=e.length>1?e[1].substr(0,c):"0";e[1].length<c;)e[1]+="0";return e.join(".")}function da(b,c){var e="";e+=ma(b.x,c)+",";e+=ma(b.y,c)+",";e+=ma(b.z,c);return e}var fa=null,T=null,Z,aa={},ga={},sa={},la={},ca={},oa={},ua={},ta,Ba=null,Ca,va,Aa,Ea=THREE.SmoothShading;m.prototype.parse=function(b){this.id=
+this.stride=this.count=0;this.params=[]}function I(){this.input={}}function N(){this.semantic="";this.offset=0;this.source="";this.set=0}function P(b){this.id=b;this.type=null}function J(){this.name=this.id="";this.instance_effect=null}function H(){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 K(b,c){this.type=b;this.effect=c;this.material=null}function Z(b){this.effect=b;this.format=this.init_from=
+null}function C(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function R(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function O(){this.url=""}function V(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function W(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
+this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ea(b){var c=b.getAttribute("id");if(na[c]!=void 0)return na[c];na[c]=(new P(c)).parse(b);return na[c]}function S(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function ta(b){for(var b=ka(b),c=[],e=0;e<b.length;e++)c.push(parseFloat(b[e]));return c}function aa(b){for(var b=ka(b),c=[],e=0;e<b.length;e++)c.push(parseInt(b[e],10));return c}function ka(b){return b.replace(/^\s+/,"").replace(/\s+$/,
+"").split(/\s+/)}function ja(b,c,e){return b.hasAttribute(c)?parseInt(b.getAttribute(c),10):e}function ma(b,c){if(b===void 0){for(var e="0.";e.length<c+2;)e+="0";return e}c=c||2;e=b.toString().split(".");for(e[1]=e.length>1?e[1].substr(0,c):"0";e[1].length<c;)e[1]+="0";return e.join(".")}function da(b,c){var e="";e+=ma(b.x,c)+",";e+=ma(b.y,c)+",";e+=ma(b.z,c);return e}var $=null,U=null,T,fa=null,na={},sa={},la={},ca={},qa={},ua={},ra={},ya,Ca,va,Ba,Ea=THREE.SmoothShading;m.prototype.parse=function(b){this.id=
 b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName=="init_from")this.init_from=e.textContent}return this};k.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "skin":this.skin=(new u).parse(e);this.type=e.nodeName;break;case "morph":this.morph=(new n).parse(e),this.type=e.nodeName}}return this};n.prototype.parse=function(b){var c=
 b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName=="init_from")this.init_from=e.textContent}return this};k.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "skin":this.skin=(new u).parse(e);this.type=e.nodeName;break;case "morph":this.morph=(new n).parse(e),this.type=e.nodeName}}return this};n.prototype.parse=function(b){var c=
 {},e=[],f;this.method=b.getAttribute("method");this.source=b.getAttribute("source").replace(/^#/,"");for(f=0;f<b.childNodes.length;f++){var h=b.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new P).parse(h);c[h.id]=h;break;case "targets":e=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<e.length;f++)switch(b=e[f],h=c[b.source],b.semantic){case "MORPH_TARGET":this.targets=h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};n.prototype.parseInputs=
 {},e=[],f;this.method=b.getAttribute("method");this.source=b.getAttribute("source").replace(/^#/,"");for(f=0;f<b.childNodes.length;f++){var h=b.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new P).parse(h);c[h.id]=h;break;case "targets":e=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<e.length;f++)switch(b=e[f],h=c[b.source],b.semantic){case "MORPH_TARGET":this.targets=h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};n.prototype.parseInputs=
-function(b){for(var c=[],e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "input":c.push((new N).parse(f))}}return c};u.prototype.parse=function(b){var c={},e,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=na(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],
+function(b){for(var c=[],e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "input":c.push((new N).parse(f))}}return c};u.prototype.parse=function(b){var c={},e,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=ta(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],
 k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15]);break;case "source":k=(new P).parse(k);c[k.id]=k;break;case "joints":e=k;break;case "vertex_weights":f=k;break;default:console.log(k.nodeName)}}this.parseJoints(e,c);this.parseWeights(f,c);return this};u.prototype.parseJoints=function(b,c){for(var e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "input":var f=(new N).parse(f),h=c[f.source];if(f.semantic=="JOINT")this.joints=
 k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15]);break;case "source":k=(new P).parse(k);c[k.id]=k;break;case "joints":e=k;break;case "vertex_weights":f=k;break;default:console.log(k.nodeName)}}this.parseJoints(e,c);this.parseWeights(f,c);return this};u.prototype.parseJoints=function(b,c){for(var e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "input":var f=(new N).parse(f),h=c[f.source];if(f.semantic=="JOINT")this.joints=
-h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};u.prototype.parseWeights=function(b,c){for(var e,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new N).parse(m));break;case "v":e=$(m.textContent);break;case "vcount":f=$(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],p=0;p<n;p++){for(var t={},u=0;u<h.length;u++){var v=h[u],w=e[m+v.offset];switch(v.semantic){case "JOINT":t.joint=w;break;
+h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};u.prototype.parseWeights=function(b,c){for(var e,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new N).parse(m));break;case "v":e=aa(m.textContent);break;case "vcount":f=aa(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],p=0;p<n;p++){for(var t={},u=0;u<h.length;u++){var v=h[u],w=e[m+v.offset];switch(v.semantic){case "JOINT":t.joint=w;break;
 case "WEIGHT":t.weight=c[v.source].data[w]}}o.push(t);m+=h.length}for(p=0;p<o.length;p++)o[p].index=k;this.weights.push(o)}};p.prototype.getChildById=function(b,c){for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildById(b,c);if(f)return f}return null};p.prototype.getChildBySid=function(b,c){for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildBySid(b,c);if(f)return f}return null};p.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");
 case "WEIGHT":t.weight=c[v.source].data[w]}}o.push(t);m+=h.length}for(p=0;p<o.length;p++)o[p].index=k;this.weights.push(o)}};p.prototype.getChildById=function(b,c){for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildById(b,c);if(f)return f}return null};p.prototype.getChildBySid=function(b,c){for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildBySid(b,c);if(f)return f}return null};p.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");
 this.nodes=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new v).parse(e))}}return this};v.prototype.getChannelForTransform=function(b){for(var c=0;c<this.channels.length;c++){var e=this.channels[c],f=e.target.split("/");f.shift();var h=f.shift(),k=h.indexOf(".")>=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,
 this.nodes=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new v).parse(e))}}return this};v.prototype.getChannelForTransform=function(b){for(var c=0;c<this.channels.length;c++){var e=this.channels[c],f=e.target.split("/");f.shift();var h=f.shift(),k=h.indexOf(".")>=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,
 ""))}if(h==b)return e.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},e}return null};v.prototype.getChildById=function(b,c){if(this.id==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildById(b,c);if(f)return f}return null};v.prototype.getChildBySid=function(b,c){if(this.sid==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildBySid(b,c);if(f)return f}return null};v.prototype.getTransformBySid=function(b){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==
 ""))}if(h==b)return e.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},e}return null};v.prototype.getChildById=function(b,c){if(this.id==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildById(b,c);if(f)return f}return null};v.prototype.getChildBySid=function(b,c){if(this.sid==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildBySid(b,c);if(f)return f}return null};v.prototype.getTransformBySid=function(b){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==
 b)return this.transforms[c];return null};v.prototype.parse=function(b){var c;this.id=b.getAttribute("id");this.sid=b.getAttribute("sid");this.name=b.getAttribute("name");this.type=b.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var e=0;e<b.childNodes.length;e++)if(c=b.childNodes[e],c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new v).parse(c));break;case "instance_camera":break;
 b)return this.transforms[c];return null};v.prototype.parse=function(b){var c;this.id=b.getAttribute("id");this.sid=b.getAttribute("sid");this.name=b.getAttribute("name");this.type=b.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var e=0;e<b.childNodes.length;e++)if(c=b.childNodes[e],c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new v).parse(c));break;case "instance_camera":break;
-case "instance_controller":this.controllers.push((new x).parse(c));break;case "instance_geometry":this.geometries.push((new z).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=fa.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",fa,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new v).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new t).parse(c));
-break;case "extra":break;default:console.log(c.nodeName)}b=[];e=1E6;c=-1E6;for(var f in sa)for(var h=sa[f],k=0;k<h.channel.length;k++){var m=h.channel[k],n=h.sampler[k];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,e=Math.min(e,n.startTime),c=Math.max(c,n.endTime),b.push(m)}if(b.length)this.startTime=e,this.endTime=c;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(e=0;e<b.input.length-1;e++)f=Math.min(f,b.input[e+
+case "instance_controller":this.controllers.push((new x).parse(c));break;case "instance_geometry":this.geometries.push((new z).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=$.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",$,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new v).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new t).parse(c));
+break;case "extra":break;default:console.log(c.nodeName)}b=[];e=1E6;c=-1E6;for(var f in la)for(var h=la[f],k=0;k<h.channel.length;k++){var m=h.channel[k],n=h.sampler[k];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,e=Math.min(e,n.startTime),c=Math.max(c,n.endTime),b.push(m)}if(b.length)this.startTime=e,this.endTime=c;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(e=0;e<b.input.length-1;e++)f=Math.min(f,b.input[e+
 1]-b.input[e])}e=[];for(b=this.startTime;b<this.endTime;b+=f){c=b;for(var h={},o=k=void 0,k=0;k<this.channels.length;k++)o=this.channels[k],h[o.sid]=o;m=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(n=this.transforms[k],o=h[n.sid],o!==void 0){for(var p=o.sampler,u,o=0;o<p.input.length-1;o++)if(p.input[o+1]>c){u=p.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14,
 1]-b.input[e])}e=[];for(b=this.startTime;b<this.endTime;b+=f){c=b;for(var h={},o=k=void 0,k=0;k<this.channels.length;k++)o=this.channels[k],h[o.sid]=o;m=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(n=this.transforms[k],o=h[n.sid],o!==void 0){for(var p=o.sampler,u,o=0;o<p.input.length-1;o++)if(p.input[o+1]>c){u=p.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14,
-c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};v.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};t.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=na(b.textContent);this.updateMatrix();return this};t.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
+c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};v.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};t.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=ta(b.textContent);this.updateMatrix();return this};t.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
 this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":b=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),b);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
 this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":b=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),b);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
-x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "skeleton":this.skeleton.push(e.textContent.replace(/^#/,""));break;case "bind_material":if(e=fa.evaluate(".//dae:instance_material",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=e.iterateNext();f;)this.instance_material.push((new w).parse(f)),f=e.iterateNext()}}return this};
-w.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};z.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1&&e.nodeName=="bind_material"){if(b=fa.evaluate(".//dae:instance_material",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=b.iterateNext();c;)this.instance_material.push((new w).parse(c)),
+x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "skeleton":this.skeleton.push(e.textContent.replace(/^#/,""));break;case "bind_material":if(e=$.evaluate(".//dae:instance_material",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=e.iterateNext();f;)this.instance_material.push((new w).parse(f)),f=e.iterateNext()}}return this};
+w.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};z.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1&&e.nodeName=="bind_material"){if(b=$.evaluate(".//dae:instance_material",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=b.iterateNext();c;)this.instance_material.push((new w).parse(c)),
 c=b.iterateNext();break}}return this};y.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "mesh":this.mesh=(new A(this)).parse(e)}}return this};A.prototype.parse=function(b){function c(b,e){var f=da(b.position);h[f]===void 0&&(h[f]={v:b,index:e});return h[f]}this.primitives=[];var e;for(e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];switch(f.nodeName){case "source":ea(f);break;case "vertices":this.vertices=
 c=b.iterateNext();break}}return this};y.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "mesh":this.mesh=(new A(this)).parse(e)}}return this};A.prototype.parse=function(b){function c(b,e){var f=da(b.position);h[f]===void 0&&(h[f]={v:b,index:e});return h[f]}this.primitives=[];var e;for(e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];switch(f.nodeName){case "source":ea(f);break;case "vertices":this.vertices=
-(new I).parse(f);break;case "triangles":this.primitives.push((new D).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new E).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=aa[this.vertices.input.POSITION.source].data;for(b=e=0;e<f.length;e+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[e],f[e+1],f[e+2]));c(k,b);this.geometry3js.vertices.push(k)}for(e=0;e<this.primitives.length;e++)primitive=this.primitives[e],primitive.setVertices(this.vertices),
+(new I).parse(f);break;case "triangles":this.primitives.push((new D).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new E).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=na[this.vertices.input.POSITION.source].data;for(b=e=0;e<f.length;e+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[e],f[e+1],f[e+2]));c(k,b);this.geometry3js.vertices.push(k)}for(e=0;e<this.primitives.length;e++)primitive=this.primitives[e],primitive.setVertices(this.vertices),
 this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};A.prototype.handlePrimitive=function(b,c,e){var f=0,h,k,m=b.p,n=b.inputs,o,p,t,u=0,v=3,w=[];for(h=0;h<n.length;h++)switch(o=n[h],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(v=b.vcount[u++]);for(h=0;h<v;h++)for(k=0;k<n.length;k++)switch(o=
 this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};A.prototype.handlePrimitive=function(b,c,e){var f=0,h,k,m=b.p,n=b.inputs,o,p,t,u=0,v=3,w=[];for(h=0;h<n.length;h++)switch(o=n[h],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(v=b.vcount[u++]);for(h=0;h<v;h++)for(k=0;k<n.length;k++)switch(o=
-n[k],source=aa[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=da(c.vertices[p].position);x.push(e[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t+0],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[t+0],source.data[t+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[t+0],source.data[t+1],source.data[t+2]))}var E;
-v==3?E=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]]):v==4&&(E=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]]));E.daeMaterial=b.material;c.faces.push(E);for(k=0;k<w.length;k++)h=z[w[k]],c.faceVertexUvs[k].push([h[0],h[1],h[2]]);f+=n.length*v}};E.prototype=new D;E.prototype.constructor=E;D.prototype.setVertices=function(b){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==b.id)this.inputs[c].source=b.input.POSITION.source};D.prototype.parse=function(b){this.inputs=[];this.material=
-b.getAttribute("material");this.count=ka(b,"count",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "input":this.inputs.push((new N).parse(b.childNodes[c]));break;case "vcount":this.vcount=$(e.textContent);break;case "p":this.p=$(e.textContent)}}return this};G.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=ka(b,"count",0);this.stride=ka(b,"stride",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName==
-"param"){var f={};f.name=e.getAttribute("name");f.type=e.getAttribute("type");this.params.push(f)}}return this};I.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++)b.childNodes[c].nodeName=="input"&&(input=(new N).parse(b.childNodes[c]),this.input[input.semantic]=input);return this};N.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,"");this.set=ka(b,"set",-1);this.offset=ka(b,"offset",
-0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};P.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "bool_array":for(var f=qa(e.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=e.nodeName;break;case "float_array":this.data=na(e.textContent);this.type=e.nodeName;break;case "int_array":this.data=$(e.textContent);this.type=e.nodeName;break;case "IDREF_array":case "Name_array":this.data=
-qa(e.textContent);this.type=e.nodeName;break;case "technique_common":for(f=0;f<e.childNodes.length;f++)if(e.childNodes[f].nodeName=="accessor"){this.accessor=(new G).parse(e.childNodes[f]);break}}}return this};P.prototype.read=function(){var b=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var e=this.data.slice(c,c+16),f=new THREE.Matrix4;f.set(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],
+n[k],source=na[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=da(c.vertices[p].position);x.push(e[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[t],source.data[t+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var E;v==
+3?E=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]]):v==4&&(E=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]]));E.daeMaterial=b.material;c.faces.push(E);for(k=0;k<w.length;k++)h=z[w[k]],c.faceVertexUvs[k].push([h[0],h[1],h[2]]);f+=n.length*v}};E.prototype=new D;E.prototype.constructor=E;D.prototype.setVertices=function(b){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==b.id)this.inputs[c].source=b.input.POSITION.source};D.prototype.parse=function(b){this.inputs=[];this.material=
+b.getAttribute("material");this.count=ja(b,"count",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "input":this.inputs.push((new N).parse(b.childNodes[c]));break;case "vcount":this.vcount=aa(e.textContent);break;case "p":this.p=aa(e.textContent)}}return this};G.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=ja(b,"count",0);this.stride=ja(b,"stride",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName==
+"param"){var f={};f.name=e.getAttribute("name");f.type=e.getAttribute("type");this.params.push(f)}}return this};I.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++)b.childNodes[c].nodeName=="input"&&(input=(new N).parse(b.childNodes[c]),this.input[input.semantic]=input);return this};N.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,"");this.set=ja(b,"set",-1);this.offset=ja(b,"offset",
+0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};P.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "bool_array":for(var f=ka(e.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=e.nodeName;break;case "float_array":this.data=ta(e.textContent);this.type=e.nodeName;break;case "int_array":this.data=aa(e.textContent);this.type=e.nodeName;break;case "IDREF_array":case "Name_array":this.data=
+ka(e.textContent);this.type=e.nodeName;break;case "technique_common":for(f=0;f<e.childNodes.length;f++)if(e.childNodes[f].nodeName=="accessor"){this.accessor=(new G).parse(e.childNodes[f]);break}}}return this};P.prototype.read=function(){var b=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var e=this.data.slice(c,c+16),f=new THREE.Matrix4;f.set(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],
 e[11],e[12],e[13],e[14],e[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+c.type)}return b};J.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var c=0;c<b.childNodes.length;c++)if(b.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new O).parse(b.childNodes[c]);break}return this};H.prototype.isColor=function(){return this.texture==null};H.prototype.isTexture=function(){return this.texture!=null};H.prototype.parse=
 e[11],e[12],e[13],e[14],e[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+c.type)}return b};J.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var c=0;c<b.childNodes.length;c++)if(b.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new O).parse(b.childNodes[c]);break}return this};H.prototype.isColor=function(){return this.texture==null};H.prototype.isTexture=function(){return this.texture!=null};H.prototype.parse=
-function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "color":e=na(e.textContent);this.color=new THREE.Color(0);this.color.setRGB(e[0],e[1],e[2]);this.color.a=e[3];break;case "texture":this.texture=e.getAttribute("texture"),this.texcoord=e.getAttribute("texcoord")}}return this};K.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[e.nodeName]=
-(new H).parse(e);break;case "shininess":case "reflectivity":case "transparency":var f;f=fa.evaluate(".//dae:float",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};K.prototype.create=function(){var b={},c=this.transparency!==void 0&&this.transparency<1,e;for(e in this)switch(e){case "ambient":case "emission":case "diffuse":case "specular":var f=
-this[e];if(f instanceof H)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ga[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ca+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else e=="diffuse"?b.color=f.color.getHex():c||(b[e]=f.color.getHex());break;case "shininess":case "reflectivity":b[e]=this[e];break;case "transparency":if(c)b.transparent=
-!0,b.opacity=this[e],c=!0}b.shading=Ea;return this.material=new THREE.MeshLambertMaterial(b)};Y.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "init_from":this.init_from=e.textContent;break;case "format":this.format=e.textContent;break;default:console.log("unhandled Surface prop: "+e.nodeName)}}return this};C.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":this.source=
+function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "color":e=ta(e.textContent);this.color=new THREE.Color(0);this.color.setRGB(e[0],e[1],e[2]);this.color.a=e[3];break;case "texture":this.texture=e.getAttribute("texture"),this.texcoord=e.getAttribute("texcoord")}}return this};K.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[e.nodeName]=
+(new H).parse(e);break;case "shininess":case "reflectivity":case "transparency":var f;f=$.evaluate(".//dae:float",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};K.prototype.create=function(){var b={},c=this.transparency!==void 0&&this.transparency<1,e;for(e in this)switch(e){case "ambient":case "emission":case "diffuse":case "specular":var f=this[e];
+if(f instanceof H)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=sa[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ca+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else e=="diffuse"?b.color=f.color.getHex():c||(b[e]=f.color.getHex());break;case "shininess":case "reflectivity":b[e]=this[e];break;case "transparency":if(c)b.transparent=!0,b.opacity=
+this[e],c=!0}b.shading=Ea;return this.material=new THREE.MeshLambertMaterial(b)};Z.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "init_from":this.init_from=e.textContent;break;case "format":this.format=e.textContent;break;default:console.log("unhandled Surface prop: "+e.nodeName)}}return this};C.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":this.source=
 e.textContent;break;case "minfilter":this.minfilter=e.textContent;break;case "magfilter":this.magfilter=e.textContent;break;case "mipfilter":this.mipfilter=e.textContent;break;case "wrap_s":this.wrap_s=e.textContent;break;case "wrap_t":this.wrap_t=e.textContent;break;default:console.log("unhandled Sampler2D prop: "+e.nodeName)}}return this};R.prototype.create=function(){if(this.shader==null)return null};R.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=
 e.textContent;break;case "minfilter":this.minfilter=e.textContent;break;case "magfilter":this.magfilter=e.textContent;break;case "mipfilter":this.mipfilter=e.textContent;break;case "wrap_s":this.wrap_s=e.textContent;break;case "wrap_t":this.wrap_t=e.textContent;break;default:console.log("unhandled Sampler2D prop: "+e.nodeName)}}return this};R.prototype.create=function(){if(this.shader==null)return null};R.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=
-null;for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(e))}}return this};R.prototype.parseNewparam=function(b){for(var c=b.getAttribute("sid"),e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=(new Y(this)).parse(f);this.surface.sid=c;break;case "sampler2D":this.sampler=(new C(this)).parse(f);this.sampler.sid=c;break;case "extra":break;
+null;for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(e))}}return this};R.prototype.parseNewparam=function(b){for(var c=b.getAttribute("sid"),e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=(new Z(this)).parse(f);this.surface.sid=c;break;case "sampler2D":this.sampler=(new C(this)).parse(f);this.sampler.sid=c;break;case "extra":break;
 default:console.log(f.nodeName)}}};R.prototype.parseProfileCOMMON=function(b){for(var c,e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":c=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return c};R.prototype.parseTechnique=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "lambert":case "blinn":case "phong":this.shader=
 default:console.log(f.nodeName)}}};R.prototype.parseProfileCOMMON=function(b){for(var c,e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":c=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return c};R.prototype.parseTechnique=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "lambert":case "blinn":case "phong":this.shader=
-(new K(e.nodeName,this)).parse(e)}}};O.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};U.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new P).parse(e);this.source[e.id]=e;break;case "sampler":this.sampler.push((new o(this)).parse(e));break;case "channel":this.channel.push((new V(this)).parse(e))}}return this};
-V.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var c=this.target.split("/");c.shift();var b=c.shift(),e=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(e)c=b.split("."),b=c.shift(),k=c.shift();else if(f){h=b.split("(");b=h.shift();for(c=0;c<h.length;c++)h[c]=parseInt(h[c].replace(/\)/,""))}this.sid=b;this.dotSyntax=e;this.arrSyntax=f;this.arrIndices=h;this.member=k;return this};o.prototype.parse=function(b){this.id=b.getAttribute("id");
+(new K(e.nodeName,this)).parse(e)}}};O.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};V.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new P).parse(e);this.source[e.id]=e;break;case "sampler":this.sampler.push((new o(this)).parse(e));break;case "channel":this.channel.push((new W(this)).parse(e))}}return this};
+W.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var c=this.target.split("/");c.shift();var b=c.shift(),e=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(e)c=b.split("."),b=c.shift(),k=c.shift();else if(f){h=b.split("(");b=h.shift();for(c=0;c<h.length;c++)h[c]=parseInt(h[c].replace(/\)/,""))}this.sid=b;this.dotSyntax=e;this.arrSyntax=f;this.arrIndices=h;this.member=k;return this};o.prototype.parse=function(b){this.id=b.getAttribute("id");
 this.inputs=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":this.inputs.push((new N).parse(e))}}return this};o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var c=this.inputs[b],e=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=e.read();break;case "OUTPUT":this.output=e.read();break;case "INTERPOLATION":this.interpolation=e.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.semantic)}}this.duration=
 this.inputs=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":this.inputs.push((new N).parse(e))}}return this};o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var c=this.inputs[b],e=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=e.read();break;case "OUTPUT":this.output=e.read();break;case "INTERPOLATION":this.interpolation=e.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.semantic)}}this.duration=
 this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(b=0;b<this.input.length;b++)this.startTime=Math.min(this.startTime,this.input[b]),this.endTime=Math.max(this.endTime,this.input[b]);this.duration=this.endTime-this.startTime}};return{load:function(e,f){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var n=new XMLHttpRequest;
 this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(b=0;b<this.input.length;b++)this.startTime=Math.min(this.startTime,this.input[b]),this.endTime=Math.max(this.endTime,this.input[b]);this.duration=this.endTime-this.startTime}};return{load:function(e,f){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var n=new XMLHttpRequest;
-n.overrideMimeType&&n.overrideMimeType("text/xml");n.onreadystatechange=function(){if(n.readyState==4&&(n.status==0||n.status==200)){Ba=f;var o,t=e;fa=n.responseXML;o=Ba;t!==void 0&&(t=t.split("/"),t.pop(),Ca=t.join("/")+"/");ga=b("//dae:library_images/dae:image",m,"image");oa=b("//dae:library_materials/dae:material",J,"material");ua=b("//dae:library_effects/dae:effect",R,"effect");ca=b("//dae:library_geometries/dae:geometry",y,"geometry");la=b("//dae:library_controllers/dae:controller",k,"controller");
-sa=b("//dae:library_animations/dae:animation",U,"animation");ta=b(".//dae:library_visual_scenes/dae:visual_scene",p,"visual_scene");va=[];Aa=[];(t=fa.evaluate(".//dae:scene/dae:instance_visual_scene",fa,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(t=t.getAttribute("url").replace(/^#/,""),Z=ta[t]):Z=null;T=new THREE.Object3D;for(t=0;t<Z.nodes.length;t++)T.addChild(h(Z.nodes[t]));c();for(var u in sa);u={scene:T,morphs:va,skins:Aa,dae:{images:ga,materials:oa,effects:ua,geometries:ca,
-controllers:la,animations:sa,visualScenes:ta,scene:Z}};o&&o(u)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Ea=b},applySkin:f,geometries:ca}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+n.overrideMimeType&&n.overrideMimeType("text/xml");n.onreadystatechange=function(){if(n.readyState==4&&(n.status==0||n.status==200)){fa=f;var o,t=e;$=n.responseXML;o=fa;t!==void 0&&(t=t.split("/"),t.pop(),Ca=t.join("/")+"/");sa=b("//dae:library_images/dae:image",m,"image");ua=b("//dae:library_materials/dae:material",J,"material");ra=b("//dae:library_effects/dae:effect",R,"effect");qa=b("//dae:library_geometries/dae:geometry",y,"geometry");ca=b("//dae:library_controllers/dae:controller",k,"controller");
+la=b("//dae:library_animations/dae:animation",V,"animation");ya=b(".//dae:library_visual_scenes/dae:visual_scene",p,"visual_scene");va=[];Ba=[];(t=$.evaluate(".//dae:scene/dae:instance_visual_scene",$,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(t=t.getAttribute("url").replace(/^#/,""),T=ya[t]):T=null;U=new THREE.Object3D;for(t=0;t<T.nodes.length;t++)U.addChild(h(T.nodes[t]));c();for(var u in la);u={scene:U,morphs:va,skins:Ba,dae:{images:sa,materials:ua,effects:ra,geometries:qa,
+controllers:ca,animations:la,visualScenes:ya,scene:T}};o&&o(u)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Ea=b},applySkin:f,geometries:qa}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,h=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,h);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
 THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,h=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,h);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
 THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,h,u,p,v,t,x,w,z,y,A,E,D,G,I=b.faces;t=b.vertices;var N=b.normals,P=b.colors,J=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&J++;for(e=0;e<J;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];p=0;for(v=t.length;p<v;)x=new THREE.Vertex,x.position.x=t[p++]*c,x.position.y=
 THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,h,u,p,v,t,x,w,z,y,A,E,D,G,I=b.faces;t=b.vertices;var N=b.normals,P=b.colors,J=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&J++;for(e=0;e<J;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];p=0;for(v=t.length;p<v;)x=new THREE.Vertex,x.position.x=t[p++]*c,x.position.y=
 t[p++]*c,x.position.z=t[p++]*c,f.vertices.push(x);p=0;for(v=I.length;p<v;){c=I[p++];t=c&1;u=c&2;e=c&4;h=c&8;w=c&16;x=c&32;y=c&64;c&=128;t?(A=new THREE.Face4,A.a=I[p++],A.b=I[p++],A.c=I[p++],A.d=I[p++],t=4):(A=new THREE.Face3,A.a=I[p++],A.b=I[p++],A.c=I[p++],t=3);if(u)u=I[p++],A.materials=f.materials[u];u=f.faces.length;if(e)for(e=0;e<J;e++)E=b.uvs[e],z=I[p++],G=E[z*2],z=E[z*2+1],f.faceUvs[e][u]=new THREE.UV(G,z);if(h)for(e=0;e<J;e++){E=b.uvs[e];D=[];for(h=0;h<t;h++)z=I[p++],G=E[z*2],z=E[z*2+1],D[h]=
 t[p++]*c,x.position.z=t[p++]*c,f.vertices.push(x);p=0;for(v=I.length;p<v;){c=I[p++];t=c&1;u=c&2;e=c&4;h=c&8;w=c&16;x=c&32;y=c&64;c&=128;t?(A=new THREE.Face4,A.a=I[p++],A.b=I[p++],A.c=I[p++],A.d=I[p++],t=4):(A=new THREE.Face3,A.a=I[p++],A.b=I[p++],A.c=I[p++],t=3);if(u)u=I[p++],A.materials=f.materials[u];u=f.faces.length;if(e)for(e=0;e<J;e++)E=b.uvs[e],z=I[p++],G=E[z*2],z=E[z*2+1],f.faceUvs[e][u]=new THREE.UV(G,z);if(h)for(e=0;e<J;e++){E=b.uvs[e];D=[];for(h=0;h<t;h++)z=I[p++],G=E[z*2],z=E[z*2+1],D[h]=
@@ -608,17 +608,17 @@ new THREE.UV(G,z);f.faceVertexUvs[e][u]=D}if(w)w=I[p++]*3,h=new THREE.Vector3,h.
 u,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],u=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,u,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,u,p,v,t,x,w,z;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];w=f.morphTargets[e].vertices;z=b.morphTargets[e].vertices;u=0;for(p=z.length;u<p;u+=3)v=z[u]*c,t=z[u+1]*
 u,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],u=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,u,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,u,p,v,t,x,w,z;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];w=f.morphTargets[e].vertices;z=b.morphTargets[e].vertices;u=0;for(p=z.length;u<p;u+=3)v=z[u]*c,t=z[u+1]*
 c,x=z[u+2]*c,w.push(new THREE.Vertex(new THREE.Vector3(v,t,x)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;v=b.morphColors[e].colors;c=0;for(u=v.length;c<u;c+=3)t=new THREE.Color(16755200),t.setRGB(v[c],v[c+1],v[c+2]),p.push(t)}}})(h);(function(){if(b.edges!==void 0){var c,e,h;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],h=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
 c,x=z[u+2]*c,w.push(new THREE.Vertex(new THREE.Vector3(v,t,x)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;v=b.morphColors[e].colors;c=0;for(u=v.length;c<u;c+=3)t=new THREE.Color(16755200),t.setRGB(v[c],v[c+1],v[c+2]),p.push(t)}}})(h);(function(){if(b.edges!==void 0){var c,e,h;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],h=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
 f.vertices[h],e,h))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
 f.vertices[h],e,h))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:h+"/"+b}function n(){for(w in R.objects)if(!S.objects[w])if(D=R.objects[w],D.geometry!==void 0){if(P=S.geometries[D.geometry]){var b=!1;Y=[];for($=0;$<D.materials.length;$++)Y[$]=S.materials[D.materials[$]],b=Y[$]instanceof THREE.ShaderMaterial;b&&P.computeTangents();G=D.position;r=D.rotation;
-q=D.quaternion;s=D.scale;q=0;Y.length==0&&(Y[0]=new THREE.MeshFaceMaterial);Y.length>1&&(Y=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(P,Y);object.name=w;object.position.set(G[0],G[1],G[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;S.scene.addObject(object);S.objects[w]=object;D.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),S.scene.collisions.colliders.push(b));
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:h+"/"+b}function n(){for(w in R.objects)if(!S.objects[w])if(D=R.objects[w],D.geometry!==void 0){if(P=S.geometries[D.geometry]){var b=!1;Z=[];for(aa=0;aa<D.materials.length;aa++)Z[aa]=S.materials[D.materials[aa]],b=Z[aa]instanceof THREE.ShaderMaterial;b&&P.computeTangents();G=D.position;r=D.rotation;
+q=D.quaternion;s=D.scale;q=0;Z.length==0&&(Z[0]=new THREE.MeshFaceMaterial);Z.length>1&&(Z=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(P,Z);object.name=w;object.position.set(G[0],G[1],G[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;S.scene.addObject(object);S.objects[w]=object;D.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),S.scene.collisions.colliders.push(b));
 if(D.castsShadow)b=new THREE.ShadowVolume(P),S.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},S.triggers[object.name]=b)}}else G=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(G[0],G[1],G[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
 if(D.castsShadow)b=new THREE.ShadowVolume(P),S.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},S.triggers[object.name]=b)}}else G=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(G[0],G[1],G[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=D.visible!==void 0?D.visible:!1,S.scene.addObject(object),S.objects[w]=object,S.empties[w]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},S.triggers[object.name]=b)}function u(b){return function(c){S.geometries[b]=c;n();U-=1;e.onLoadComplete();v()}}function p(b){return function(c){S.geometries[b]=c}}function v(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-U,loadedTextures:ea-V},S);e.onLoadProgress();U==0&&V==0&&c(S)}
-var t,x,w,z,y,A,E,D,G,I,N,P,J,H,K,Y,C,R,O,U,V,o,ea,S;R=b.data;K=new THREE.BinaryLoader;O=new THREE.JSONLoader;V=U=0;S={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in R.objects)if(D=R.objects[w],D.meshCollider){b=!0;break}if(b)S.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;I=R.transform.rotation;var na=R.transform.scale;b&&S.scene.position.set(b[0],b[1],b[2]);I&&S.scene.rotation.set(I[0],
-I[1],I[2]);na&&S.scene.scale.set(na[0],na[1],na[2]);(b||I||na)&&S.scene.updateMatrix()}b=function(){V-=1;v();e.onLoadComplete()};for(y in R.cameras){I=R.cameras[y];if(I.type=="perspective")J=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")J=new THREE.Camera,J.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);G=I.position;I=I.target;J.position.set(G[0],G[1],G[2]);J.target.position.set(I[0],I[1],I[2]);S.cameras[y]=J}for(z in R.lights)y=R.lights[z],
+s[1],s[2]),object.visible=D.visible!==void 0?D.visible:!1,S.scene.addObject(object),S.objects[w]=object,S.empties[w]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},S.triggers[object.name]=b)}function u(b){return function(c){S.geometries[b]=c;n();V-=1;e.onLoadComplete();v()}}function p(b){return function(c){S.geometries[b]=c}}function v(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-V,loadedTextures:ea-W},S);e.onLoadProgress();V==0&&W==0&&c(S)}
+var t,x,w,z,y,A,E,D,G,I,N,P,J,H,K,Z,C,R,O,V,W,o,ea,S;R=b.data;K=new THREE.BinaryLoader;O=new THREE.JSONLoader;W=V=0;S={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in R.objects)if(D=R.objects[w],D.meshCollider){b=!0;break}if(b)S.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;I=R.transform.rotation;var ta=R.transform.scale;b&&S.scene.position.set(b[0],b[1],b[2]);I&&S.scene.rotation.set(I[0],
+I[1],I[2]);ta&&S.scene.scale.set(ta[0],ta[1],ta[2]);(b||I||ta)&&S.scene.updateMatrix()}b=function(){W-=1;v();e.onLoadComplete()};for(y in R.cameras){I=R.cameras[y];if(I.type=="perspective")J=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")J=new THREE.Camera,J.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);G=I.position;I=I.target;J.position.set(G[0],G[1],G[2]);J.target.position.set(I[0],I[1],I[2]);S.cameras[y]=J}for(z in R.lights)y=R.lights[z],
 J=y.color!==void 0?y.color:16777215,I=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(G=y.direction,C=new THREE.DirectionalLight(J,I),C.position.set(G[0],G[1],G[2]),C.position.normalize()):y.type=="point"?(G=y.position,d=y.distance,C=new THREE.PointLight(J,I,d),C.position.set(G[0],G[1],G[2])):y.type=="ambient"&&(C=new THREE.AmbientLight(J)),S.scene.addLight(C),S.lights[z]=C;for(A in R.fogs)z=R.fogs[A],z.type=="linear"?H=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(H=new THREE.FogExp2(0,
 J=y.color!==void 0?y.color:16777215,I=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(G=y.direction,C=new THREE.DirectionalLight(J,I),C.position.set(G[0],G[1],G[2]),C.position.normalize()):y.type=="point"?(G=y.position,d=y.distance,C=new THREE.PointLight(J,I,d),C.position.set(G[0],G[1],G[2])):y.type=="ambient"&&(C=new THREE.AmbientLight(J)),S.scene.addLight(C),S.lights[z]=C;for(A in R.fogs)z=R.fogs[A],z.type=="linear"?H=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(H=new THREE.FogExp2(0,
-z.density)),I=z.color,H.color.setRGB(I[0],I[1],I[2]),S.fogs[A]=H;if(S.cameras&&R.defaults.camera)S.currentCamera=S.cameras[R.defaults.camera];if(S.fogs&&R.defaults.fog)S.scene.fog=S.fogs[R.defaults.fog];I=R.defaults.bgcolor;S.bgColor=new THREE.Color;S.bgColor.setRGB(I[0],I[1],I[2]);S.bgColorAlpha=R.defaults.bgalpha;for(t in R.geometries)if(A=R.geometries[t],A.type=="bin_mesh"||A.type=="ascii_mesh")U+=1,e.onLoadStart();o=U;for(t in R.geometries)A=R.geometries[t],A.type=="cube"?(P=new THREE.CubeGeometry(A.width,
+z.density)),I=z.color,H.color.setRGB(I[0],I[1],I[2]),S.fogs[A]=H;if(S.cameras&&R.defaults.camera)S.currentCamera=S.cameras[R.defaults.camera];if(S.fogs&&R.defaults.fog)S.scene.fog=S.fogs[R.defaults.fog];I=R.defaults.bgcolor;S.bgColor=new THREE.Color;S.bgColor.setRGB(I[0],I[1],I[2]);S.bgColorAlpha=R.defaults.bgalpha;for(t in R.geometries)if(A=R.geometries[t],A.type=="bin_mesh"||A.type=="ascii_mesh")V+=1,e.onLoadStart();o=V;for(t in R.geometries)A=R.geometries[t],A.type=="cube"?(P=new THREE.CubeGeometry(A.width,
 A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),S.geometries[t]=P):A.type=="plane"?(P=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),S.geometries[t]=P):A.type=="sphere"?(P=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),S.geometries[t]=P):A.type=="cylinder"?(P=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),S.geometries[t]=P):A.type=="torus"?(P=new THREE.TorusGeometry(A.radius,A.tube,
 A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),S.geometries[t]=P):A.type=="plane"?(P=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),S.geometries[t]=P):A.type=="sphere"?(P=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),S.geometries[t]=P):A.type=="cylinder"?(P=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),S.geometries[t]=P):A.type=="torus"?(P=new THREE.TorusGeometry(A.radius,A.tube,
-A.segmentsR,A.segmentsT),S.geometries[t]=P):A.type=="icosahedron"?(P=new THREE.IcosahedronGeometry(A.subdivisions),S.geometries[t]=P):A.type=="bin_mesh"?K.load({model:f(A.url,R.urlBaseType),callback:u(t)}):A.type=="ascii_mesh"?O.load({model:f(A.url,R.urlBaseType),callback:u(t)}):A.type=="embedded_mesh"&&(A=R.embeds[A.id])&&O.createModel(A,p(t),"");for(E in R.textures)if(t=R.textures[E],t.url instanceof Array){V+=t.url.length;for(K=0;K<t.url.length;K++)e.onLoadStart()}else V+=1,e.onLoadStart();ea=
-V;for(E in R.textures){t=R.textures[E];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){K=[];for(var $=0;$<t.url.length;$++)K[$]=f(t.url[$],R.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,t.mapping,b)}else{K=THREE.ImageUtils.loadTexture(f(t.url,R.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)K.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)K.magFilter=THREE[t.magFilter];if(t.repeat){K.repeat.set(t.repeat[0],t.repeat[1]);
+A.segmentsR,A.segmentsT),S.geometries[t]=P):A.type=="icosahedron"?(P=new THREE.IcosahedronGeometry(A.subdivisions),S.geometries[t]=P):A.type=="bin_mesh"?K.load({model:f(A.url,R.urlBaseType),callback:u(t)}):A.type=="ascii_mesh"?O.load({model:f(A.url,R.urlBaseType),callback:u(t)}):A.type=="embedded_mesh"&&(A=R.embeds[A.id])&&O.createModel(A,p(t),"");for(E in R.textures)if(t=R.textures[E],t.url instanceof Array){W+=t.url.length;for(K=0;K<t.url.length;K++)e.onLoadStart()}else W+=1,e.onLoadStart();ea=
+W;for(E in R.textures){t=R.textures[E];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){K=[];for(var aa=0;aa<t.url.length;aa++)K[aa]=f(t.url[aa],R.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,t.mapping,b)}else{K=THREE.ImageUtils.loadTexture(f(t.url,R.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)K.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)K.magFilter=THREE[t.magFilter];if(t.repeat){K.repeat.set(t.repeat[0],t.repeat[1]);
 if(t.repeat[0]!=1)K.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}t.offset&&K.offset.set(t.offset[0],t.offset[1]);if(t.wrap){O={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(O[t.wrap[0]]!==void 0)K.wrapS=O[t.wrap[0]];if(O[t.wrap[1]]!==void 0)K.wrapT=O[t.wrap[1]]}}S.textures[E]=K}for(x in R.materials){E=R.materials[x];for(N in E.parameters)if(N=="envMap"||N=="map"||N=="lightMap")E.parameters[N]=S.textures[E.parameters[N]];else if(N=="shading")E.parameters[N]=
 if(t.repeat[0]!=1)K.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}t.offset&&K.offset.set(t.offset[0],t.offset[1]);if(t.wrap){O={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(O[t.wrap[0]]!==void 0)K.wrapS=O[t.wrap[0]];if(O[t.wrap[1]]!==void 0)K.wrapT=O[t.wrap[1]]}}S.textures[E]=K}for(x in R.materials){E=R.materials[x];for(N in E.parameters)if(N=="envMap"||N=="map"||N=="lightMap")E.parameters[N]=S.textures[E.parameters[N]];else if(N=="shading")E.parameters[N]=
 E.parameters[N]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(N=="blending")E.parameters[N]=THREE[E.parameters[N]]?THREE[E.parameters[N]]:THREE.NormalBlending;else if(N=="combine")E.parameters[N]=E.parameters[N]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(N=="vertexColors")if(E.parameters[N]=="face")E.parameters[N]=THREE.FaceColors;else if(E.parameters[N])E.parameters[N]=THREE.VertexColors;if(E.parameters.opacity!==void 0&&E.parameters.opacity<1)E.parameters.transparent=
 E.parameters[N]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(N=="blending")E.parameters[N]=THREE[E.parameters[N]]?THREE[E.parameters[N]]:THREE.NormalBlending;else if(N=="combine")E.parameters[N]=E.parameters[N]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(N=="vertexColors")if(E.parameters[N]=="face")E.parameters[N]=THREE.FaceColors;else if(E.parameters[N])E.parameters[N]=THREE.VertexColors;if(E.parameters.opacity!==void 0&&E.parameters.opacity<1)E.parameters.transparent=
 !0;if(E.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);K=E.parameters.color;O=E.parameters.specular;A=E.parameters.ambient;H=E.parameters.shininess;b.tNormal.texture=S.textures[E.parameters.normalMap];if(E.parameters.normalMapFactor)b.uNormalScale.value=E.parameters.normalMapFactor;if(E.parameters.map)b.tDiffuse.texture=E.parameters.map,b.enableDiffuse.value=!0;if(E.parameters.lightMap)b.tAO.texture=E.parameters.lightMap,b.enableAO.value=!0;if(E.parameters.specularMap)b.tSpecular.texture=
 !0;if(E.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);K=E.parameters.color;O=E.parameters.specular;A=E.parameters.ambient;H=E.parameters.shininess;b.tNormal.texture=S.textures[E.parameters.normalMap];if(E.parameters.normalMapFactor)b.uNormalScale.value=E.parameters.normalMapFactor;if(E.parameters.map)b.tDiffuse.texture=E.parameters.map,b.enableDiffuse.value=!0;if(E.parameters.lightMap)b.tAO.texture=E.parameters.lightMap,b.enableAO.value=!0;if(E.parameters.specularMap)b.tSpecular.texture=
@@ -627,15 +627,15 @@ THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.const
 THREE.UTF8Loader.prototype.load=function(b){var c=new XMLHttpRequest,e=b.model,f=b.callback,h=b.scale!==void 0?b.scale:1,m=b.offsetX!==void 0?b.offsetX:0,k=b.offsetY!==void 0?b.offsetY:0,n=b.offsetZ!==void 0?b.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,f,h,m,k,n):alert("Couldn't load ["+e+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",e,!0);c.send(null)};
 THREE.UTF8Loader.prototype.load=function(b){var c=new XMLHttpRequest,e=b.model,f=b.callback,h=b.scale!==void 0?b.scale:1,m=b.offsetX!==void 0?b.offsetX:0,k=b.offsetY!==void 0?b.offsetY:0,n=b.offsetZ!==void 0?b.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,f,h,m,k,n):alert("Couldn't load ["+e+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",e,!0);c.send(null)};
 THREE.UTF8Loader.prototype.decompressMesh=function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var m=0,k=0;k<c;++k){var n=b.charCodeAt(k+f);m+=n>>1^-(n&1);e[8*k+h]=m}f+=c}c=b.length-f;m=new Uint16Array(c);for(h=k=0;h<c;h++)n=b.charCodeAt(h+f),m[h]=k-n,n==0&&k++;return[e,m]};
 THREE.UTF8Loader.prototype.decompressMesh=function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var m=0,k=0;k<c;++k){var n=b.charCodeAt(k+f);m+=n>>1^-(n&1);e[8*k+h]=m}f+=c}c=b.length-f;m=new Uint16Array(c);for(h=k=0;h<c;h++)n=b.charCodeAt(h+f),m[h]=k-n,n==0&&k++;return[e,m]};
 THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,m){var k=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var k=THREE.UTF8Loader.prototype.decompressMesh(b),p=[],v=[];(function(b,k,p){for(var u,v,A,E=b.length;p<E;p+=k)u=b[p],v=b[p+1],A=b[p+2],u=u/16383*e,v=v/16383*e,A=A/16383*e,u+=f,v+=h,A+=m,c.vertices.push(new THREE.Vertex(new THREE.Vector3(u,v,A)))})(k[0],8,0);(function(b,c,e){for(var f,h,k=b.length;e<k;e+=c)f=b[e],h=b[e+1],f/=1023,h/=1023,v.push(f,1-h)})(k[0],8,3);(function(b,
 THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,m){var k=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var k=THREE.UTF8Loader.prototype.decompressMesh(b),p=[],v=[];(function(b,k,p){for(var u,v,A,E=b.length;p<E;p+=k)u=b[p],v=b[p+1],A=b[p+2],u=u/16383*e,v=v/16383*e,A=A/16383*e,u+=f,v+=h,A+=m,c.vertices.push(new THREE.Vertex(new THREE.Vector3(u,v,A)))})(k[0],8,0);(function(b,c,e){for(var f,h,k=b.length;e<k;e+=c)f=b[e],h=b[e+1],f/=1023,h/=1023,v.push(f,1-h)})(k[0],8,3);(function(b,
-c,e){for(var f,h,k,m=b.length;e<m;e+=c)f=b[e],h=b[e+1],k=b[e+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,p.push(f,h,k)})(k[0],8,5);(function(b){var e,f,h,k,m,u,D,G,I,N=b.length;for(e=0;e<N;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;G=f;I=h;u=k;D=f;var P=h,J=k,H=m.materials[0],K=p[P*3],Y=p[P*3+1],P=p[P*3+2],C=p[J*3],R=p[J*3+1],J=p[J*3+2];D=new THREE.Vector3(p[D*3],p[D*3+1],p[D*3+2]);P=new THREE.Vector3(K,Y,P);J=new THREE.Vector3(C,R,J);m.faces.push(new THREE.Face3(G,I,u,[D,P,J],null,H));m=v[f*2];f=v[f*2+
+c,e){for(var f,h,k,m=b.length;e<m;e+=c)f=b[e],h=b[e+1],k=b[e+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,p.push(f,h,k)})(k[0],8,5);(function(b){var e,f,h,k,m,u,D,G,I,N=b.length;for(e=0;e<N;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;G=f;I=h;u=k;D=f;var P=h,J=k,H=m.materials[0],K=p[P*3],Z=p[P*3+1],P=p[P*3+2],C=p[J*3],R=p[J*3+1],J=p[J*3+2];D=new THREE.Vector3(p[D*3],p[D*3+1],p[D*3+2]);P=new THREE.Vector3(K,Z,P);J=new THREE.Vector3(C,R,J);m.faces.push(new THREE.Face3(G,I,u,[D,P,J],null,H));m=v[f*2];f=v[f*2+
 1];u=v[h*2];D=v[h*2+1];G=v[k*2];I=v[k*2+1];k=c.faceVertexUvs[0];h=u;u=D;D=[];D.push(new THREE.UV(m,f));D.push(new THREE.UV(h,u));D.push(new THREE.UV(G,I));k.push(D)}})(k[1]);this.computeCentroids();this.computeFaceNormals()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;c(new k)};
 1];u=v[h*2];D=v[h*2+1];G=v[k*2];I=v[k*2+1];k=c.faceVertexUvs[0];h=u;u=D;D=[];D.push(new THREE.UV(m,f));D.push(new THREE.UV(h,u));D.push(new THREE.UV(G,I));k.push(D)}})(k[1]);this.computeCentroids();this.computeFaceNormals()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;c(new k)};
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,h){return b+(c-b)*h};this.VIntX=function(b,c,h,m,k,n,u,p,v,t){k=(k-v)/(t-v);v=this.normal_cache;c[m]=n+k*this.delta;c[m+1]=u;c[m+2]=p;h[m]=this.lerp(v[b],v[b+3],k);h[m+1]=this.lerp(v[b+1],v[b+4],k);h[m+2]=this.lerp(v[b+2],v[b+5],k)};this.VIntY=function(b,c,h,m,k,n,u,p,v,t){k=(k-v)/(t-v);v=this.normal_cache;c[m]=n;c[m+1]=u+k*this.delta;c[m+
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,h){return b+(c-b)*h};this.VIntX=function(b,c,h,m,k,n,u,p,v,t){k=(k-v)/(t-v);v=this.normal_cache;c[m]=n+k*this.delta;c[m+1]=u;c[m+2]=p;h[m]=this.lerp(v[b],v[b+3],k);h[m+1]=this.lerp(v[b+1],v[b+4],k);h[m+2]=this.lerp(v[b+2],v[b+5],k)};this.VIntY=function(b,c,h,m,k,n,u,p,v,t){k=(k-v)/(t-v);v=this.normal_cache;c[m]=n;c[m+1]=u+k*this.delta;c[m+
 2]=p;c=b+this.yd*3;h[m]=this.lerp(v[b],v[c],k);h[m+1]=this.lerp(v[b+1],v[c+1],k);h[m+2]=this.lerp(v[b+2],v[c+2],k)};this.VIntZ=function(b,c,h,m,k,n,u,p,v,t){k=(k-v)/(t-v);v=this.normal_cache;c[m]=n;c[m+1]=u;c[m+2]=p+k*this.delta;c=b+this.zd*3;h[m]=this.lerp(v[b],v[c],k);h[m+1]=this.lerp(v[b+1],v[c+1],k);h[m+2]=this.lerp(v[b+2],v[c+2],k)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
 2]=p;c=b+this.yd*3;h[m]=this.lerp(v[b],v[c],k);h[m+1]=this.lerp(v[b+1],v[c+1],k);h[m+2]=this.lerp(v[b+2],v[c+2],k)};this.VIntZ=function(b,c,h,m,k,n,u,p,v,t){k=(k-v)/(t-v);v=this.normal_cache;c[m]=n;c[m+1]=u;c[m+2]=p+k*this.delta;c=b+this.zd*3;h[m]=this.lerp(v[b],v[c],k);h[m+1]=this.lerp(v[b+1],v[c+1],k);h[m+2]=this.lerp(v[b+2],v[c+2],k)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
 this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,m,k,n){var u=m+1,p=m+this.yd,v=m+this.zd,t=u+this.yd,x=u+this.zd,w=m+this.yd+this.zd,z=u+this.yd+this.zd,y=0,A=this.field[m],E=this.field[u],D=this.field[p],G=this.field[t],I=this.field[v],N=this.field[x],P=this.field[w],J=this.field[z];A<k&&(y|=1);E<k&&(y|=2);D<k&&(y|=8);G<k&&(y|=4);I<k&&(y|=16);N<k&&(y|=32);P<k&&(y|=128);J<k&&(y|=64);var H=THREE.edgeTable[y];if(H==0)return 0;var K=this.delta,
 this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,m,k,n){var u=m+1,p=m+this.yd,v=m+this.zd,t=u+this.yd,x=u+this.zd,w=m+this.yd+this.zd,z=u+this.yd+this.zd,y=0,A=this.field[m],E=this.field[u],D=this.field[p],G=this.field[t],I=this.field[v],N=this.field[x],P=this.field[w],J=this.field[z];A<k&&(y|=1);E<k&&(y|=2);D<k&&(y|=8);G<k&&(y|=4);I<k&&(y|=16);N<k&&(y|=32);P<k&&(y|=128);J<k&&(y|=64);var H=THREE.edgeTable[y];if(H==0)return 0;var K=this.delta,
-Y=b+K,C=c+K,K=h+K;H&1&&(this.compNorm(m),this.compNorm(u),this.VIntX(m*3,this.vlist,this.nlist,0,k,b,c,h,A,E));H&2&&(this.compNorm(u),this.compNorm(t),this.VIntY(u*3,this.vlist,this.nlist,3,k,Y,c,h,E,G));H&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,k,b,C,h,D,G));H&8&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,9,k,b,c,h,A,D));H&16&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,12,k,b,c,K,I,N));H&32&&(this.compNorm(x),
-this.compNorm(z),this.VIntY(x*3,this.vlist,this.nlist,15,k,Y,c,K,N,J));H&64&&(this.compNorm(w),this.compNorm(z),this.VIntX(w*3,this.vlist,this.nlist,18,k,b,C,K,P,J));H&128&&(this.compNorm(v),this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,21,k,b,c,K,I,P));H&256&&(this.compNorm(m),this.compNorm(v),this.VIntZ(m*3,this.vlist,this.nlist,24,k,b,c,h,A,I));H&512&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*3,this.vlist,this.nlist,27,k,Y,c,h,E,N));H&1024&&(this.compNorm(t),this.compNorm(z),this.VIntZ(t*
-3,this.vlist,this.nlist,30,k,Y,C,h,G,J));H&2048&&(this.compNorm(p),this.compNorm(w),this.VIntZ(p*3,this.vlist,this.nlist,33,k,b,C,h,D,P));y<<=4;for(k=m=0;THREE.triTable[y+k]!=-1;)b=y+k,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),k+=3,m++;return m};this.posnormtriv=function(b,c,h,m,k,n){var u=this.count*3;this.positionArray[u]=b[h];this.positionArray[u+1]=b[h+1];this.positionArray[u+2]=b[h+2];this.positionArray[u+3]=b[m];this.positionArray[u+
+Z=b+K,C=c+K,K=h+K;H&1&&(this.compNorm(m),this.compNorm(u),this.VIntX(m*3,this.vlist,this.nlist,0,k,b,c,h,A,E));H&2&&(this.compNorm(u),this.compNorm(t),this.VIntY(u*3,this.vlist,this.nlist,3,k,Z,c,h,E,G));H&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,k,b,C,h,D,G));H&8&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,9,k,b,c,h,A,D));H&16&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,12,k,b,c,K,I,N));H&32&&(this.compNorm(x),
+this.compNorm(z),this.VIntY(x*3,this.vlist,this.nlist,15,k,Z,c,K,N,J));H&64&&(this.compNorm(w),this.compNorm(z),this.VIntX(w*3,this.vlist,this.nlist,18,k,b,C,K,P,J));H&128&&(this.compNorm(v),this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,21,k,b,c,K,I,P));H&256&&(this.compNorm(m),this.compNorm(v),this.VIntZ(m*3,this.vlist,this.nlist,24,k,b,c,h,A,I));H&512&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*3,this.vlist,this.nlist,27,k,Z,c,h,E,N));H&1024&&(this.compNorm(t),this.compNorm(z),this.VIntZ(t*
+3,this.vlist,this.nlist,30,k,Z,C,h,G,J));H&2048&&(this.compNorm(p),this.compNorm(w),this.VIntZ(p*3,this.vlist,this.nlist,33,k,b,C,h,D,P));y<<=4;for(k=m=0;THREE.triTable[y+k]!=-1;)b=y+k,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),k+=3,m++;return m};this.posnormtriv=function(b,c,h,m,k,n){var u=this.count*3;this.positionArray[u]=b[h];this.positionArray[u+1]=b[h+1];this.positionArray[u+2]=b[h+2];this.positionArray[u+3]=b[m];this.positionArray[u+
 4]=b[m+1];this.positionArray[u+5]=b[m+2];this.positionArray[u+6]=b[k];this.positionArray[u+7]=b[k+1];this.positionArray[u+8]=b[k+2];this.normalArray[u]=c[h];this.normalArray[u+1]=c[h+1];this.normalArray[u+2]=c[h+2];this.normalArray[u+3]=c[m];this.normalArray[u+4]=c[m+1];this.normalArray[u+5]=c[m+2];this.normalArray[u+6]=c[k];this.normalArray[u+7]=c[k+1];this.normalArray[u+8]=c[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&n(this)};this.begin=function(){this.count=0;
 4]=b[m+1];this.positionArray[u+5]=b[m+2];this.positionArray[u+6]=b[k];this.positionArray[u+7]=b[k+1];this.positionArray[u+8]=b[k+2];this.normalArray[u]=c[h];this.normalArray[u+1]=c[h+1];this.normalArray[u+2]=c[h+2];this.normalArray[u+3]=c[m];this.normalArray[u+4]=c[m+1];this.normalArray[u+5]=c[m+2];this.normalArray[u+6]=c[k];this.normalArray[u+7]=c[k+1];this.normalArray[u+8]=c[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&n(this)};this.begin=function(){this.count=0;
 this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,h,m,k){var n=this.size*Math.sqrt(m/k),u=h*this.size,p=c*this.size,v=b*this.size,t=Math.floor(u-n);t<1&&(t=1);u=Math.floor(u+n);u>this.size-1&&(u=this.size-1);var x=Math.floor(p-n);x<1&&(x=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var w=Math.floor(v-n);w<1&&(w=1);n=Math.floor(v+n);n>this.size-1&&(n=this.size-
 this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,h,m,k){var n=this.size*Math.sqrt(m/k),u=h*this.size,p=c*this.size,v=b*this.size,t=Math.floor(u-n);t<1&&(t=1);u=Math.floor(u+n);u>this.size-1&&(u=this.size-1);var x=Math.floor(p-n);x<1&&(x=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var w=Math.floor(v-n);w<1&&(w=1);n=Math.floor(v+n);n>this.size-1&&(n=this.size-
 1);for(var z,y,A,E,D,G;t<u;t++){v=this.size2*t;y=t/this.size-h;D=y*y;for(y=x;y<p;y++){A=v+this.size*y;z=y/this.size-c;G=z*z;for(z=w;z<n;z++)E=z/this.size-b,E=m/(1.0E-6+E*E+G+D)-k,E>0&&(this.field[A+z]+=E)}}};this.addPlaneX=function(b,c){var h,m,k,n,u,p=this.size,v=this.yd,t=this.zd,x=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(h=0;h<w;h++)if(m=h/p,m*=m,n=b/(1.0E-4+m)-c,n>0)for(m=0;m<p;m++){u=h+m*v;for(k=0;k<p;k++)x[t*k+u]+=n}};this.addPlaneY=function(b,c){var h,m,k,n,u,p,v=this.size,t=this.yd,x=
 1);for(var z,y,A,E,D,G;t<u;t++){v=this.size2*t;y=t/this.size-h;D=y*y;for(y=x;y<p;y++){A=v+this.size*y;z=y/this.size-c;G=z*z;for(z=w;z<n;z++)E=z/this.size-b,E=m/(1.0E-6+E*E+G+D)-k,E>0&&(this.field[A+z]+=E)}}};this.addPlaneX=function(b,c){var h,m,k,n,u,p=this.size,v=this.yd,t=this.zd,x=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(h=0;h<w;h++)if(m=h/p,m*=m,n=b/(1.0E-4+m)-c,n>0)for(m=0;m<p;m++){u=h+m*v;for(k=0;k<p;k++)x[t*k+u]+=n}};this.addPlaneY=function(b,c){var h,m,k,n,u,p,v=this.size,t=this.yd,x=

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -69,7 +69,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){t
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-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(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-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 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,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,l=this.w,j=l*c+f*e-h*d,n=l*d+h*c-g*e,i=l*e+g*d-f*c,c=-g*
 this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,l=this.w,j=l*c+f*e-h*d,n=l*d+h*c-g*e,i=l*e+g*d-f*c,c=-g*
-c-f*d-h*e;b.x=j*l+c*-g+n*-h-i*-f;b.y=n*l+c*-f+i*-g-j*-h;b.z=i*l+c*-h+j*-f-n*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+c-f*d-h*e;b.x=j*l+c*-g+n*-h-i*-f;b.y=n*l+c*-f+i*-g-j*-h;b.z=i*l+c*-h+j*-f-n*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.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

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

+ 35 - 35
build/custom/ThreeExtras.js

@@ -81,7 +81,7 @@ this.getPrevKeyWith("pos",p,f.index-1).pos,this.points[1]=g,this.points[2]=h,thi
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],g,h,f,k,l,m;g=(a.length-1)*b;h=Math.floor(g);g-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];k=a[c[1]];l=a[c[2]];m=a[c[3]];c=g*g;f=g*c;e[0]=this.interpolate(h[0],k[0],l[0],m[0],g,c,f);e[1]=this.interpolate(h[1],k[1],l[1],m[1],g,c,f);e[2]=this.interpolate(h[2],k[2],l[2],m[2],g,c,f);return e};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],g,h,f,k,l,m;g=(a.length-1)*b;h=Math.floor(g);g-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];k=a[c[1]];l=a[c[2]];m=a[c[3]];c=g*g;f=g*c;e[0]=this.interpolate(h[0],k[0],l[0],m[0],g,c,f);e[1]=this.interpolate(h[1],k[1],l[1],m[1],g,c,f);e[2]=this.interpolate(h[2],k[2],l[2],m[2],g,c,f);return e};
 THREE.Animation.prototype.interpolate=function(a,b,c,e,g,h,f){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*f+(-3*(b-c)-2*a-e)*h+a*g+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<e.length-1?c:e.length-1:c%=e.length;c<e.length;c++)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.interpolate=function(a,b,c,e,g,h,f){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*f+(-3*(b-c)-2*a-e)*h+a*g+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<e.length-1?c:e.length-1:c%=e.length;c<e.length;c++)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var e=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var e=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
-THREE.FirstPersonCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
+THREE.FirstPersonCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
 a.movementSpeed;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.noFly!==void 0)this.noFly=a.noFly;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.autoForward!==void 0)this.autoForward=a.autoForward;if(a.activeLook!==void 0)this.activeLook=a.activeLook;if(a.heightSpeed!==void 0)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==void 0)this.heightCoef=a.heightCoef;if(a.heightMin!==void 0)this.heightMin=a.heightMin;if(a.heightMax!==void 0)this.heightMax=a.heightMax;if(a.constrainVertical!==
 a.movementSpeed;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.noFly!==void 0)this.noFly=a.noFly;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.autoForward!==void 0)this.autoForward=a.autoForward;if(a.activeLook!==void 0)this.activeLook=a.activeLook;if(a.heightSpeed!==void 0)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==void 0)this.heightCoef=a.heightCoef;if(a.heightMin!==void 0)this.heightMin=a.heightMin;if(a.heightMax!==void 0)this.heightMax=a.heightMax;if(a.constrainVertical!==
 void 0)this.constrainVertical=a.constrainVertical;if(a.verticalMin!==void 0)this.verticalMin=a.verticalMin;if(a.verticalMax!==void 0)this.verticalMax=a.verticalMax;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 void 0)this.constrainVertical=a.constrainVertical;if(a.verticalMin!==void 0)this.verticalMin=a.verticalMin;if(a.verticalMax!==void 0)this.verticalMax=a.verticalMax;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.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=
 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=
@@ -94,7 +94,7 @@ b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI
 THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);if(this.noFly)b.y=0;this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};
 THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);if(this.noFly)b.y=0;this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};
 THREE.PathCamera=function(a){function b(a,c,b,e){var f={name:b,fps:0.6,length:e,hierarchy:[]},h,g=c.getControlPointsArray(),k=c.getLength(),l=g.length,y=0;h=l-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<l-1;h++)y=e*k.chunks[h]/k.total,c.keys[h]={time:y,pos:g[h]};f.hierarchy[0]=c;THREE.AnimationHandler.add(f);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var b,
 THREE.PathCamera=function(a){function b(a,c,b,e){var f={name:b,fps:0.6,length:e,hierarchy:[]},h,g=c.getControlPointsArray(),k=c.getLength(),l=g.length,y=0;h=l-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<l-1;h++)y=e*k.chunks[h]/k.total,c.keys[h]={time:y,pos:g[h]};f.hierarchy[0]=c;THREE.AnimationHandler.add(f);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var b,
 e,f=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),f.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}function e(a,b){var e=c(b,10),f=c(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,h);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.addChild(lineObj);particleObj.scale.set(1,1,1);a.addChild(particleObj);f=new THREE.SphereGeometry(1,
 e,f=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),f.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}function e(a,b){var e=c(b,10),f=c(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,h);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.addChild(lineObj);particleObj.scale.set(1,1,1);a.addChild(particleObj);f=new THREE.SphereGeometry(1,
-16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)e=new THREE.Mesh(f,h),e.position.copy(b.points[i]),e.updateMatrix(),a.addChild(e)}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=
+16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)e=new THREE.Mesh(f,h),e.position.copy(b.points[i]),e.updateMatrix(),a.addChild(e)}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
 this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==void 0)this.duration=a.duration*1E3;if(a.waypoints!==void 0)this.waypoints=a.waypoints;if(a.useConstantSpeed!==void 0)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==void 0)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==void 0)this.createDebugPath=a.createDebugPath;if(a.createDebugDummy!==
 this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==void 0)this.duration=a.duration*1E3;if(a.waypoints!==void 0)this.waypoints=a.waypoints;if(a.useConstantSpeed!==void 0)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==void 0)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==void 0)this.createDebugPath=a.createDebugPath;if(a.createDebugDummy!==
 void 0)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==void 0)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==void 0)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==void 0)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===
 void 0)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==void 0)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==void 0)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==void 0)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===
 document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var g=Math.PI*2,h=Math.PI/180;this.update=function(a,c,b){var e,f;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=
 document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var g=Math.PI*2,h=Math.PI/180;this.update=function(a,c,b){var e,f;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=
@@ -102,7 +102,7 @@ document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2
 e.y=100*Math.cos(this.phi);e.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,a,c,b)};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);
 e.y=100*Math.cos(this.phi);e.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,a,c,b)};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);
 if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),f=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.CubeGeometry(10,10,20),l=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(k,a);a=new THREE.Mesh(l,f);a.position.set(0,10,0);this.animation=b(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=b(this.animationParent,
 if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),f=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.CubeGeometry(10,10,20),l=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(k,a);a=new THREE.Mesh(l,f);a.position.set(0,10,0);this.animation=b(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=b(this.animationParent,
 this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(a,c){return function(){c.apply(a,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
 this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(a,c){return function(){c.apply(a,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-THREE.FlyCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward=
+THREE.FlyCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward=
 a.autoForward;if(a.domElement!==void 0)this.domElement=a.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};
 a.autoForward;if(a.domElement!==void 0)this.domElement=a.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);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=
 this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=
 1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=
 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=
@@ -144,14 +144,14 @@ k.copy(c).addSelf(h);l.copy(b).addSelf(g);h=e.dot(g);g=l.subSelf(k).dot(g);h==0&
 1);for(var c=0,b=p+n*2,c=0;c<b;c++){var e=P*c,f=P*(c+1),h=Q+T+e,g=Q+T+f,m=h,e=Q+R+e,f=Q+R+f,o=g;m+=M;e+=M;f+=M;o+=M;H.faces.push(new THREE.Face4(m,e,f,o,null,null,A));A&&(m=c/b,e=(c+1)/b,f=k+l*2,h=(H.vertices[h].position.z+l)/f,g=(H.vertices[g].position.z+l)/f,H.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(g,m),new THREE.UV(g,e),new THREE.UV(h,e)]))}}}function h(a,c,b){H.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function f(a,c,b){a+=M;c+=M;b+=M;H.faces.push(new THREE.Face3(a,
 1);for(var c=0,b=p+n*2,c=0;c<b;c++){var e=P*c,f=P*(c+1),h=Q+T+e,g=Q+T+f,m=h,e=Q+R+e,f=Q+R+f,o=g;m+=M;e+=M;f+=M;o+=M;H.faces.push(new THREE.Face4(m,e,f,o,null,null,A));A&&(m=c/b,e=(c+1)/b,f=k+l*2,h=(H.vertices[h].position.z+l)/f,g=(H.vertices[g].position.z+l)/f,H.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(g,m),new THREE.UV(g,e),new THREE.UV(h,e)]))}}}function h(a,c,b){H.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function f(a,c,b){a+=M;c+=M;b+=M;H.faces.push(new THREE.Face3(a,
 c,b,null,null,w));if(w){var e=C.maxY,f=C.maxX,h=H.vertices[c].position.x,c=H.vertices[c].position.y,g=H.vertices[b].position.x,b=H.vertices[b].position.y;H.faceVertexUvs[0].push([new THREE.UV(H.vertices[a].position.x/f,H.vertices[a].position.y/e),new THREE.UV(h/f,c/e),new THREE.UV(g/f,b/e)])}}var k=b.amount!==void 0?b.amount:100,l=b.bevelThickness!==void 0?b.bevelThickness:6,m=b.bevelSize!==void 0?b.bevelSize:l-2,n=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:
 c,b,null,null,w));if(w){var e=C.maxY,f=C.maxX,h=H.vertices[c].position.x,c=H.vertices[c].position.y,g=H.vertices[b].position.x,b=H.vertices[b].position.y;H.faceVertexUvs[0].push([new THREE.UV(H.vertices[a].position.x/f,H.vertices[a].position.y/e),new THREE.UV(h/f,c/e),new THREE.UV(g/f,b/e)])}}var k=b.amount!==void 0?b.amount:100,l=b.bevelThickness!==void 0?b.bevelThickness:6,m=b.bevelSize!==void 0?b.bevelSize:l-2,n=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:
 !0,t=b.curveSegments!==void 0?b.curveSegments:12,p=b.steps!==void 0?b.steps:1,x=b.bendPath,v=b.extrudePath,u,z=!1,y=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,w=b.material,A=b.extrudeMaterial,C=this.shapebb;if(v)u=v.getPoints(t),p=u.length,z=!0,o=!1;o||(m=l=n=0);var F,G,I,H=this,M=this.vertices.length;x&&a.addWrapPath(x);t=y?a.extractAllSpacedPoints(t):a.extractAllPoints(t);x=t.shape;t=t.holes;if(v=!THREE.Shape.Utils.isClockWise(x)){x=x.reverse();G=0;for(I=t.length;G<I;G++)F=t[G],THREE.Shape.Utils.isClockWise(F)&&
 !0,t=b.curveSegments!==void 0?b.curveSegments:12,p=b.steps!==void 0?b.steps:1,x=b.bendPath,v=b.extrudePath,u,z=!1,y=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,w=b.material,A=b.extrudeMaterial,C=this.shapebb;if(v)u=v.getPoints(t),p=u.length,z=!0,o=!1;o||(m=l=n=0);var F,G,I,H=this,M=this.vertices.length;x&&a.addWrapPath(x);t=y?a.extractAllSpacedPoints(t):a.extractAllPoints(t);x=t.shape;t=t.holes;if(v=!THREE.Shape.Utils.isClockWise(x)){x=x.reverse();G=0;for(I=t.length;G<I;G++)F=t[G],THREE.Shape.Utils.isClockWise(F)&&
-(t[G]=F.reverse());v=!1}v=THREE.Shape.Utils.triangulateShape(x,t);y=x;G=0;for(I=t.length;G<I;G++)F=t[G],x=x.concat(F);var B,D,J,L,N,K,P=x.length,E=v.length,S=[];B=0;D=y.length;T=D-1;for(R=B+1;B<D;B++,T++,R++)T==D&&(T=0),R==D&&(R=0),S[B]=e(y[B],y[T],y[R]);var O=[],U,W=S.concat();G=0;for(I=t.length;G<I;G++){F=t[G];U=[];B=0;D=F.length;T=D-1;for(R=B+1;B<D;B++,T++,R++)T==D&&(T=0),R==D&&(R=0),U[B]=e(F[B],F[T],F[R]);O.push(U);W=W.concat(U)}for(J=0;J<n;J++){L=J/n;N=l*(1-L);L=m*Math.sin(L*Math.PI/2);B=0;for(D=
-y.length;B<D;B++)K=c(y[B],S[B],L),h(K.x,K.y,-N);G=0;for(I=t.length;G<I;G++){F=t[G];U=O[G];B=0;for(D=F.length;B<D;B++)K=c(F[B],U[B],L),h(K.x,K.y,-N)}}L=m;for(B=0;B<P;B++)K=o?c(x[B],W[B],L):x[B],z?h(K.x,K.y+u[0].y,u[0].x):h(K.x,K.y,0);for(J=1;J<=p;J++)for(B=0;B<P;B++)K=o?c(x[B],W[B],L):x[B],z?h(K.x,K.y+u[J-1].y,u[J-1].x):h(K.x,K.y,k/p*J);for(J=n-1;J>=0;J--){L=J/n;N=l*(1-L);L=m*Math.sin(L*Math.PI/2);B=0;for(D=y.length;B<D;B++)K=c(y[B],S[B],L),h(K.x,K.y,k+N);G=0;for(I=t.length;G<I;G++){F=t[G];U=O[G];
+(t[G]=F.reverse());v=!1}v=THREE.Shape.Utils.triangulateShape(x,t);y=x;G=0;for(I=t.length;G<I;G++)F=t[G],x=x.concat(F);var B,D,J,L,N,K,P=x.length,E=v.length,S=[];B=0;D=y.length;T=D-1;for(R=B+1;B<D;B++,T++,R++)T==D&&(T=0),R==D&&(R=0),S[B]=e(y[B],y[T],y[R]);var O=[],U,V=S.concat();G=0;for(I=t.length;G<I;G++){F=t[G];U=[];B=0;D=F.length;T=D-1;for(R=B+1;B<D;B++,T++,R++)T==D&&(T=0),R==D&&(R=0),U[B]=e(F[B],F[T],F[R]);O.push(U);V=V.concat(U)}for(J=0;J<n;J++){L=J/n;N=l*(1-L);L=m*Math.sin(L*Math.PI/2);B=0;for(D=
+y.length;B<D;B++)K=c(y[B],S[B],L),h(K.x,K.y,-N);G=0;for(I=t.length;G<I;G++){F=t[G];U=O[G];B=0;for(D=F.length;B<D;B++)K=c(F[B],U[B],L),h(K.x,K.y,-N)}}L=m;for(B=0;B<P;B++)K=o?c(x[B],V[B],L):x[B],z?h(K.x,K.y+u[0].y,u[0].x):h(K.x,K.y,0);for(J=1;J<=p;J++)for(B=0;B<P;B++)K=o?c(x[B],V[B],L):x[B],z?h(K.x,K.y+u[J-1].y,u[J-1].x):h(K.x,K.y,k/p*J);for(J=n-1;J>=0;J--){L=J/n;N=l*(1-L);L=m*Math.sin(L*Math.PI/2);B=0;for(D=y.length;B<D;B++)K=c(y[B],S[B],L),h(K.x,K.y,k+N);G=0;for(I=t.length;G<I;G++){F=t[G];U=O[G];
 B=0;for(D=F.length;B<D;B++)K=c(F[B],U[B],L),z?h(K.x,K.y+u[p-1].y,u[p-1].x+N):h(K.x,K.y,k+N)}}if(o){o=P*0;for(B=0;B<E;B++)m=v[B],f(m[2]+o,m[1]+o,m[0]+o);o=P*(p+n*2);for(B=0;B<E;B++)m=v[B],f(m[0]+o,m[1]+o,m[2]+o)}else{for(B=0;B<E;B++)m=v[B],f(m[2],m[1],m[0]);for(B=0;B<E;B++)m=v[B],f(m[0]+P*p,m[1]+P*p,m[2]+P*p)}var T,R,Q=0;g(y);Q+=y.length;G=0;for(I=t.length;G<I;G++)F=t[G],g(F),Q+=F.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 B=0;for(D=F.length;B<D;B++)K=c(F[B],U[B],L),z?h(K.x,K.y+u[p-1].y,u[p-1].x+N):h(K.x,K.y,k+N)}}if(o){o=P*0;for(B=0;B<E;B++)m=v[B],f(m[2]+o,m[1]+o,m[0]+o);o=P*(p+n*2);for(B=0;B<E;B++)m=v[B],f(m[0]+o,m[1]+o,m[2]+o)}else{for(B=0;B<E;B++)m=v[B],f(m[2],m[1],m[0]);for(B=0;B<E;B++)m=v[B],f(m[0]+P*p,m[1]+P*p,m[2]+P*p)}var T,R,Q=0;g(y);Q+=y.length;G=0;for(I=t.length;G<I;G++)F=t[G],g(F),Q+=F.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 b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function e(a,c){var e=g.vertices[a].position,f=g.vertices[c].position;return b((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,
 THREE.IcosahedronGeometry=function(a){function b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function e(a,c){var e=g.vertices[a].position,f=g.vertices[c].position;return b((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,
 -a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,l,n,a);c(h.faces[k].b,m,
 -a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,l,n,a);c(h.faces[k].b,m,
 l,a);c(h.faces[k].c,n,m,a);c(l,m,n,a)}h.faces=a.faces}g.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 l,a);c(h.faces[k].c,n,m,a);c(l,m,n,a)}h.faces=a.faces}g.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],e=[],g=[],h=[],f=(new THREE.Matrix4).setRotationZ(b),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),c[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var l=0;l<=this.angle+0.001;l+=b){for(k=0;k<c.length;k++)l<this.angle?(c[k]=f.multiplyVector3(c[k].clone()),this.vertices.push(new THREE.Vertex(c[k])),g[k]=this.vertices.length-1):g=h;l==0&&(h=e);
+THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],e=[],g=[],h=[],f=(new THREE.Matrix4).setRotationZ(b),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),c[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var l=0;l<=this.angle+0.0010;l+=b){for(k=0;k<c.length;k++)l<this.angle?(c[k]=f.multiplyVector3(c[k].clone()),this.vertices.push(new THREE.Vertex(c[k])),g[k]=this.vertices.length-1):g=h;l==0&&(h=e);
 for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(g[k],g[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-l/this.angle,k/a.length),new THREE.UV(1-l/this.angle,(k+1)/a.length),new THREE.UV(1-(l-b)/this.angle,(k+1)/a.length),new THREE.UV(1-(l-b)/this.angle,k/a.length)]);e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(g[k],g[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-l/this.angle,k/a.length),new THREE.UV(1-l/this.angle,(k+1)/a.length),new THREE.UV(1-(l-b)/this.angle,(k+1)/a.length),new THREE.UV(1-(l-b)/this.angle,k/a.length)]);e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.PlaneGeometry=function(a,b,c,e){THREE.Geometry.call(this);var g,h=a/2,f=b/2,c=c||1,e=e||1,k=c+1,l=e+1;a/=c;var m=b/e;for(g=0;g<l;g++)for(b=0;b<k;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-h,-(g*m-f),0)));for(g=0;g<e;g++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+k*g,b+k*(g+1),b+1+k*(g+1),b+1+k*g)),this.faceVertexUvs[0].push([new THREE.UV(b/c,g/e),new THREE.UV(b/c,(g+1)/e),new THREE.UV((b+1)/c,(g+1)/e),new THREE.UV((b+1)/c,g/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry=function(a,b,c,e){THREE.Geometry.call(this);var g,h=a/2,f=b/2,c=c||1,e=e||1,k=c+1,l=e+1;a/=c;var m=b/e;for(g=0;g<l;g++)for(b=0;b<k;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-h,-(g*m-f),0)));for(g=0;g<e;g++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+k*g,b+k*(g+1),b+1+k*(g+1),b+1+k*g)),this.faceVertexUvs[0].push([new THREE.UV(b/c,g/e),new THREE.UV(b/c,(g+1)/e),new THREE.UV((b+1)/c,(g+1)/e),new THREE.UV((b+1)/c,g/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
@@ -166,7 +166,7 @@ this.getFace(),c=this.size/b.resolution,e=0,g=String(a).split(""),h=g.length,f=[
 m));g.moveTo(k,m);break;case "l":k=b[a++]*c+e;m=b[a++]*c;h.push(new THREE.Vector2(k,m));g.lineTo(k,m);break;case "q":k=b[a++]*c+e;m=b[a++]*c;t=b[a++]*c+e;p=b[a++]*c;g.quadraticCurveTo(t,p,k,m);if(f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var z=f/divisions,y=THREE.Shape.Utils.b2(z,n,t,k),z=THREE.Shape.Utils.b2(z,o,p,m);h.push(new THREE.Vector2(y,z))}}break;case "b":if(k=b[a++]*c+e,m=b[a++]*c,t=b[a++]*c+e,p=b[a++]*-c,x=b[a++]*c+e,v=b[a++]*-c,g.bezierCurveTo(k,m,
 m));g.moveTo(k,m);break;case "l":k=b[a++]*c+e;m=b[a++]*c;h.push(new THREE.Vector2(k,m));g.lineTo(k,m);break;case "q":k=b[a++]*c+e;m=b[a++]*c;t=b[a++]*c+e;p=b[a++]*c;g.quadraticCurveTo(t,p,k,m);if(f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var z=f/divisions,y=THREE.Shape.Utils.b2(z,n,t,k),z=THREE.Shape.Utils.b2(z,o,p,m);h.push(new THREE.Vector2(y,z))}}break;case "b":if(k=b[a++]*c+e,m=b[a++]*c,t=b[a++]*c+e,p=b[a++]*-c,x=b[a++]*c+e,v=b[a++]*-c,g.bezierCurveTo(k,m,
 t,p,x,v),f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)z=f/divisions,y=THREE.Shape.Utils.b3(z,n,t,x,k),z=THREE.Shape.Utils.b3(z,o,p,v,m),h.push(new THREE.Vector2(y,z))}}}return{offset:u.ha*c,points:h,path:g}}}};
 t,p,x,v),f=h[h.length-1]){n=f.x;o=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)z=f/divisions,y=THREE.Shape.Utils.b3(z,n,t,x,k),z=THREE.Shape.Utils.b3(z,o,p,v,m),h.push(new THREE.Vector2(y,z))}}}return{offset:u.ha*c,points:h,path:g}}}};
 (function(a){var b=function(a){for(var b=a.length,g=0,h=b-1,f=0;f<b;h=f++)g+=a[h].x*a[f].y-a[f].x*a[h].y;return g*0.5};a.Triangulate=function(a,e){var g=a.length;if(g<3)return null;var h=[],f=[],k=[],l,m,n;if(b(a)>0)for(m=0;m<g;m++)f[m]=m;else for(m=0;m<g;m++)f[m]=g-1-m;var o=2*g;for(m=g-1;g>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;g<=l&&(l=0);m=l+1;g<=m&&(m=0);n=m+1;g<=n&&(n=0);var t;a:{t=a;var p=l,x=m,v=n,u=g,z=f,y=void 0,w=void 0,A=void 0,
 (function(a){var b=function(a){for(var b=a.length,g=0,h=b-1,f=0;f<b;h=f++)g+=a[h].x*a[f].y-a[f].x*a[h].y;return g*0.5};a.Triangulate=function(a,e){var g=a.length;if(g<3)return null;var h=[],f=[],k=[],l,m,n;if(b(a)>0)for(m=0;m<g;m++)f[m]=m;else for(m=0;m<g;m++)f[m]=g-1-m;var o=2*g;for(m=g-1;g>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}l=m;g<=l&&(l=0);m=l+1;g<=m&&(m=0);n=m+1;g<=n&&(n=0);var t;a:{t=a;var p=l,x=m,v=n,u=g,z=f,y=void 0,w=void 0,A=void 0,
-C=void 0,F=void 0,G=void 0,I=void 0,H=void 0,M=void 0,w=t[z[p]].x,A=t[z[p]].y,C=t[z[x]].x,F=t[z[x]].y,G=t[z[v]].x,I=t[z[v]].y;if(1.0E-10>(C-w)*(I-A)-(F-A)*(G-w))t=!1;else{for(y=0;y<u;y++)if(!(y==p||y==x||y==v)){var H=t[z[y]].x,M=t[z[y]].y,B=void 0,D=void 0,J=void 0,L=void 0,N=void 0,K=void 0,P=void 0,E=void 0,S=void 0,O=void 0,U=void 0,W=void 0,B=J=N=void 0,B=G-C,D=I-F,J=w-G,L=A-I,N=C-w,K=F-A,P=H-w,E=M-A,S=H-C,O=M-F,U=H-G,W=M-I,B=B*O-D*S,N=N*E-K*P,J=J*W-L*U;if(B>=0&&J>=0&&N>=0){t=!1;break a}}t=!0}}if(t){h.push([a[f[l]],
+C=void 0,F=void 0,G=void 0,I=void 0,H=void 0,M=void 0,w=t[z[p]].x,A=t[z[p]].y,C=t[z[x]].x,F=t[z[x]].y,G=t[z[v]].x,I=t[z[v]].y;if(1.0E-10>(C-w)*(I-A)-(F-A)*(G-w))t=!1;else{for(y=0;y<u;y++)if(!(y==p||y==x||y==v)){var H=t[z[y]].x,M=t[z[y]].y,B=void 0,D=void 0,J=void 0,L=void 0,N=void 0,K=void 0,P=void 0,E=void 0,S=void 0,O=void 0,U=void 0,V=void 0,B=J=N=void 0,B=G-C,D=I-F,J=w-G,L=A-I,N=C-w,K=F-A,P=H-w,E=M-A,S=H-C,O=M-F,U=H-G,V=M-I,B=B*O-D*S,N=N*E-K*P,J=J*V-L*U;if(B>=0&&J>=0&&N>=0){t=!1;break a}}t=!0}}if(t){h.push([a[f[l]],
 a[f[m]],a[f[n]]]);k.push([f[l],f[m],f[n]]);l=m;for(n=m+1;n<g;l++,n++)f[l]=f[n];g--;o=2*g}}if(e)return k;return h};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 a[f[m]],a[f[n]]]);k.push([f[l],f[m],f[n]]);l=m;for(n=m+1;n<g;l++,n++)f[l]=f[n];g--;o=2*g}}if(e)return k;return h};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,e,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,f=c/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(h);g.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(f))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(f))*Math.sin(h);k.z=
 THREE.TorusGeometry=function(a,b,c,e,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,f=c/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(h);g.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(f))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(f))*Math.sin(h);k.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-c/this.segmentsR));b.push(k.clone().subSelf(g).normalize())}for(c=1;c<=this.segmentsR;c++)for(e=1;e<=this.segmentsT;e++){var g=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,f=(this.segmentsT+1)*(c-1)+e,k=(this.segmentsT+1)*c+e,l=new THREE.Face4(g,h,f,k,[b[g],b[h],b[f],b[k]]);l.normal.addSelf(b[g]);l.normal.addSelf(b[h]);l.normal.addSelf(b[f]);l.normal.addSelf(b[k]);l.normal.normalize();this.faces.push(l);
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-c/this.segmentsR));b.push(k.clone().subSelf(g).normalize())}for(c=1;c<=this.segmentsR;c++)for(e=1;e<=this.segmentsT;e++){var g=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,f=(this.segmentsT+1)*(c-1)+e,k=(this.segmentsT+1)*c+e,l=new THREE.Face4(g,h,f,k,[b[g],b[h],b[f],b[k]]);l.normal.addSelf(b[g]);l.normal.addSelf(b[h]);l.normal.addSelf(b[f]);l.normal.addSelf(b[k]);l.normal.normalize();this.faces.push(l);
@@ -189,31 +189,31 @@ b.postMessage(a)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,e,g,h){var f=new XMLHttpRequest,k=e+"/"+a,l=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,c,g,b):alert("Couldn't load ["+k+"] ["+f.status+"]"):f.readyState==3?h&&(l==0&&(l=f.getResponseHeader("Content-Length")),h({total:l,loaded:f.responseText.length})):f.readyState==2&&(l=f.getResponseHeader("Content-Length"))};f.open("GET",k,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,e,g,h){var f=new XMLHttpRequest,k=e+"/"+a,l=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,c,g,b):alert("Couldn't load ["+k+"] ["+f.status+"]"):f.readyState==3?h&&(l==0&&(l=f.getResponseHeader("Content-Length")),h({total:l,loaded:f.responseText.length})):f.readyState==2&&(l=f.getResponseHeader("Content-Length"))};f.open("GET",k,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
 f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,e){var g=function(c){function b(a,c){var e=n(a,c),f=n(a,c+1),g=n(a,c+2),h=n(a,c+3),k=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&k==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function g(a,c){var b=n(a,c),e=n(a,c+1),f=n(a,c+2);return(n(a,c+3)<<24)+(f<<16)+(e<<8)+b}function l(a,c){var b=n(a,c);return(n(a,c+1)<<8)+b}function m(a,c){var b=n(a,c);return b>127?b-256:b}function n(a,c){return a.charCodeAt(c)&255}function o(c){var b,
 THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,e){var g=function(c){function b(a,c){var e=n(a,c),f=n(a,c+1),g=n(a,c+2),h=n(a,c+3),k=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&k==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,k)}function g(a,c){var b=n(a,c),e=n(a,c+1),f=n(a,c+2);return(n(a,c+3)<<24)+(f<<16)+(e<<8)+b}function l(a,c){var b=n(a,c);return(n(a,c+1)<<8)+b}function m(a,c){var b=n(a,c);return b>127?b-256:b}function n(a,c){return a.charCodeAt(c)&255}function o(c){var b,
-e,f;b=g(a,c);e=g(a,c+F);f=g(a,c+G);c=l(a,c+I);z.faces.push(new THREE.Face3(b,e,f,null,null,z.materials[c]))}function t(c){var b,e,f,h,m,n;b=g(a,c);e=g(a,c+F);f=g(a,c+G);h=l(a,c+I);m=g(a,c+H);n=g(a,c+M);c=g(a,c+B);h=z.materials[h];var o=A[n*3],p=A[n*3+1];n=A[n*3+2];var t=A[c*3],ha=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(o,p,n),new THREE.Vector3(t,ha,c)],null,h))}function p(c){var b,e,f,h;b=g(a,c);e=g(a,c+D);f=g(a,c+J);h=
-g(a,c+L);c=l(a,c+N);z.faces.push(new THREE.Face4(b,e,f,h,null,null,z.materials[c]))}function x(c){var b,e,f,h,m,n,o,p;b=g(a,c);e=g(a,c+D);f=g(a,c+J);h=g(a,c+L);m=l(a,c+N);n=g(a,c+K);o=g(a,c+P);p=g(a,c+E);c=g(a,c+S);m=z.materials[m];var t=A[o*3],ha=A[o*3+1];o=A[o*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var v=A[c*3],u=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face4(b,e,f,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(t,ha,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(v,u,c)],
-null,m))}function v(c){var b,e,f,h;b=g(a,c);e=g(a,c+O);f=g(a,c+U);c=C[b*2];h=C[b*2+1];b=C[e*2];var l=z.faceVertexUvs[0];e=C[e*2+1];var m=C[f*2];f=C[f*2+1];var n=[];n.push(new THREE.UV(c,h));n.push(new THREE.UV(b,e));n.push(new THREE.UV(m,f));l.push(n)}function u(c){var b,e,f,h,l,m;b=g(a,c);e=g(a,c+W);f=g(a,c+T);h=g(a,c+R);c=C[b*2];l=C[b*2+1];b=C[e*2];m=C[e*2+1];e=C[f*2];var n=z.faceVertexUvs[0];f=C[f*2+1];var o=C[h*2];h=C[h*2+1];var p=[];p.push(new THREE.UV(c,l));p.push(new THREE.UV(b,m));p.push(new THREE.UV(e,
-f));p.push(new THREE.UV(o,h));n.push(p)}var z=this,y=0,w,A=[],C=[],F,G,I,H,M,B,D,J,L,N,K,P,E,S,O,U,W,T,R,Q,Z,X,Y,$,V;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,c);w={signature:a.substr(y,8),header_bytes:n(a,y+8),vertex_coordinate_bytes:n(a,y+9),normal_coordinate_bytes:n(a,y+10),uv_coordinate_bytes:n(a,y+11),vertex_index_bytes:n(a,y+12),normal_index_bytes:n(a,y+13),uv_index_bytes:n(a,y+14),material_index_bytes:n(a,y+15),nvertices:g(a,y+16),nnormals:g(a,y+16+4),nuvs:g(a,y+16+
+e,f;b=g(a,c);e=g(a,c+F);f=g(a,c+G);c=l(a,c+I);z.faces.push(new THREE.Face3(b,e,f,null,null,z.materials[c]))}function t(c){var b,e,f,h,m,n;b=g(a,c);e=g(a,c+F);f=g(a,c+G);h=l(a,c+I);m=g(a,c+H);n=g(a,c+M);c=g(a,c+B);h=z.materials[h];var o=A[n*3],p=A[n*3+1];n=A[n*3+2];var t=A[c*3],ia=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(A[m*3],A[m*3+1],A[m*3+2]),new THREE.Vector3(o,p,n),new THREE.Vector3(t,ia,c)],null,h))}function p(c){var b,e,f,h;b=g(a,c);e=g(a,c+D);f=g(a,c+J);h=
+g(a,c+L);c=l(a,c+N);z.faces.push(new THREE.Face4(b,e,f,h,null,null,z.materials[c]))}function x(c){var b,e,f,h,m,n,o,p;b=g(a,c);e=g(a,c+D);f=g(a,c+J);h=g(a,c+L);m=l(a,c+N);n=g(a,c+K);o=g(a,c+P);p=g(a,c+E);c=g(a,c+S);m=z.materials[m];var t=A[o*3],ia=A[o*3+1];o=A[o*3+2];var la=A[p*3],ma=A[p*3+1];p=A[p*3+2];var v=A[c*3],u=A[c*3+1],c=A[c*3+2];z.faces.push(new THREE.Face4(b,e,f,h,[new THREE.Vector3(A[n*3],A[n*3+1],A[n*3+2]),new THREE.Vector3(t,ia,o),new THREE.Vector3(la,ma,p),new THREE.Vector3(v,u,c)],
+null,m))}function v(c){var b,e,f,h;b=g(a,c);e=g(a,c+O);f=g(a,c+U);c=C[b*2];h=C[b*2+1];b=C[e*2];var l=z.faceVertexUvs[0];e=C[e*2+1];var m=C[f*2];f=C[f*2+1];var n=[];n.push(new THREE.UV(c,h));n.push(new THREE.UV(b,e));n.push(new THREE.UV(m,f));l.push(n)}function u(c){var b,e,f,h,l,m;b=g(a,c);e=g(a,c+V);f=g(a,c+T);h=g(a,c+R);c=C[b*2];l=C[b*2+1];b=C[e*2];m=C[e*2+1];e=C[f*2];var n=z.faceVertexUvs[0];f=C[f*2+1];var o=C[h*2];h=C[h*2+1];var p=[];p.push(new THREE.UV(c,l));p.push(new THREE.UV(b,m));p.push(new THREE.UV(e,
+f));p.push(new THREE.UV(o,h));n.push(p)}var z=this,y=0,w,A=[],C=[],F,G,I,H,M,B,D,J,L,N,K,P,E,S,O,U,V,T,R,Q,Z,W,$,X,Y;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,e,c);w={signature:a.substr(y,8),header_bytes:n(a,y+8),vertex_coordinate_bytes:n(a,y+9),normal_coordinate_bytes:n(a,y+10),uv_coordinate_bytes:n(a,y+11),vertex_index_bytes:n(a,y+12),normal_index_bytes:n(a,y+13),uv_index_bytes:n(a,y+14),material_index_bytes:n(a,y+15),nvertices:g(a,y+16),nnormals:g(a,y+16+4),nuvs:g(a,y+16+
 8),ntri_flat:g(a,y+16+12),ntri_smooth:g(a,y+16+16),ntri_flat_uv:g(a,y+16+20),ntri_smooth_uv:g(a,y+16+24),nquad_flat:g(a,y+16+28),nquad_smooth:g(a,y+16+32),nquad_flat_uv:g(a,y+16+36),nquad_smooth_uv:g(a,y+16+40)};y+=w.header_bytes;F=w.vertex_index_bytes;G=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;H=w.vertex_index_bytes*3+w.material_index_bytes;M=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;B=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;D=w.vertex_index_bytes;
 8),ntri_flat:g(a,y+16+12),ntri_smooth:g(a,y+16+16),ntri_flat_uv:g(a,y+16+20),ntri_smooth_uv:g(a,y+16+24),nquad_flat:g(a,y+16+28),nquad_smooth:g(a,y+16+32),nquad_flat_uv:g(a,y+16+36),nquad_smooth_uv:g(a,y+16+40)};y+=w.header_bytes;F=w.vertex_index_bytes;G=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;H=w.vertex_index_bytes*3+w.material_index_bytes;M=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;B=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;D=w.vertex_index_bytes;
-J=w.vertex_index_bytes*2;L=w.vertex_index_bytes*3;N=w.vertex_index_bytes*4;K=w.vertex_index_bytes*4+w.material_index_bytes;P=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;E=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;S=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;O=w.uv_index_bytes;U=w.uv_index_bytes*2;W=w.uv_index_bytes;T=w.uv_index_bytes*2;R=w.uv_index_bytes*3;c=w.vertex_index_bytes*3+w.material_index_bytes;V=w.vertex_index_bytes*
-4+w.material_index_bytes;Q=w.ntri_flat*c;Z=w.ntri_smooth*(c+w.normal_index_bytes*3);X=w.ntri_flat_uv*(c+w.uv_index_bytes*3);Y=w.ntri_smooth_uv*(c+w.normal_index_bytes*3+w.uv_index_bytes*3);$=w.nquad_flat*V;c=w.nquad_smooth*(V+w.normal_index_bytes*4);V=w.nquad_flat_uv*(V+w.uv_index_bytes*4);y+=function(c){for(var e,h,g,k=w.vertex_coordinate_bytes*3,l=c+w.nvertices*k;c<l;c+=k)e=b(a,c),h=b(a,c+w.vertex_coordinate_bytes),g=b(a,c+w.vertex_coordinate_bytes*2),z.vertices.push(new THREE.Vertex(new THREE.Vector3(e,
-h,g)));return w.nvertices*k}(y);y+=function(c){for(var b,e,f,h=w.normal_coordinate_bytes*3,g=c+w.nnormals*h;c<g;c+=h)b=m(a,c),e=m(a,c+w.normal_coordinate_bytes),f=m(a,c+w.normal_coordinate_bytes*2),A.push(b/127,e/127,f/127);return w.nnormals*h}(y);y+=function(c){for(var e,h,g=w.uv_coordinate_bytes*2,k=c+w.nuvs*g;c<k;c+=g)e=b(a,c),h=b(a,c+w.uv_coordinate_bytes),C.push(e,h);return w.nuvs*g}(y);Q=y+Q;Z=Q+Z;X=Z+X;Y=X+Y;$=Y+$;c=$+c;V=c+V;(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes,
-e=b+w.uv_index_bytes*3,f=a+w.ntri_flat_uv*e;for(c=a;c<f;c+=e)o(c),v(c+b);return f-a})(Z);(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=b+w.uv_index_bytes*3,f=a+w.ntri_smooth_uv*e;for(c=a;c<f;c+=e)t(c),v(c+b);return f-a})(X);(function(a){var c,b=w.vertex_index_bytes*4+w.material_index_bytes,e=b+w.uv_index_bytes*4,f=a+w.nquad_flat_uv*e;for(c=a;c<f;c+=e)p(c),u(c+b);return f-a})(c);(function(a){var c,b=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*
-4,e=b+w.uv_index_bytes*4,f=a+w.nquad_smooth_uv*e;for(c=a;c<f;c+=e)x(c),u(c+b);return f-a})(V);(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes,e=a+w.ntri_flat*b;for(c=a;c<e;c+=b)o(c);return e-a})(y);(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=a+w.ntri_smooth*b;for(c=a;c<e;c+=b)t(c);return e-a})(Q);(function(a){var c,b=w.vertex_index_bytes*4+w.material_index_bytes,e=a+w.nquad_flat*b;for(c=a;c<e;c+=b)p(c);return e-a})(Y);(function(a){var c,
-b=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,e=a+w.nquad_smooth*b;for(c=a;c<e;c+=b)x(c);return e-a})($);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g(c))};
-THREE.ColladaLoader=function(){function a(a,c,b){for(var a=Q.evaluate(a,Q,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},f=a.iterateNext(),h=0;f;){f=(new c).parse(f);if(f.id.length==0)f.id=b+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,c=-a,b=0,e;for(e in V)for(var f=V[e],h=0;h<f.sampler.length;h++){var g=f.sampler[h];g.create();a=Math.min(a,g.startTime);c=Math.max(c,g.endTime);b=Math.max(b,g.input.length)}return{start:a,end:c,frames:b}}function c(a,b,e,f){a.world=a.world||
-new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=a.channels[0].sampler.output[e];h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)c(a.nodes[f],b,e,a.world)}function e(a,e,f){var h=aa[e.url];if(!h||!h.skin)console.log("could not find skin controller!");else if(!e.skeleton||!e.skeleton.length)console.log("could not find the skeleton for the skin!");else{var g=b(),e=X.getChildById(e.skeleton[0],!0)||X.getChildBySid(e.skeleton[0],
+J=w.vertex_index_bytes*2;L=w.vertex_index_bytes*3;N=w.vertex_index_bytes*4;K=w.vertex_index_bytes*4+w.material_index_bytes;P=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;E=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;S=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;O=w.uv_index_bytes;U=w.uv_index_bytes*2;V=w.uv_index_bytes;T=w.uv_index_bytes*2;R=w.uv_index_bytes*3;c=w.vertex_index_bytes*3+w.material_index_bytes;Y=w.vertex_index_bytes*
+4+w.material_index_bytes;Q=w.ntri_flat*c;Z=w.ntri_smooth*(c+w.normal_index_bytes*3);W=w.ntri_flat_uv*(c+w.uv_index_bytes*3);$=w.ntri_smooth_uv*(c+w.normal_index_bytes*3+w.uv_index_bytes*3);X=w.nquad_flat*Y;c=w.nquad_smooth*(Y+w.normal_index_bytes*4);Y=w.nquad_flat_uv*(Y+w.uv_index_bytes*4);y+=function(c){for(var e,h,g,k=w.vertex_coordinate_bytes*3,l=c+w.nvertices*k;c<l;c+=k)e=b(a,c),h=b(a,c+w.vertex_coordinate_bytes),g=b(a,c+w.vertex_coordinate_bytes*2),z.vertices.push(new THREE.Vertex(new THREE.Vector3(e,
+h,g)));return w.nvertices*k}(y);y+=function(c){for(var b,e,f,h=w.normal_coordinate_bytes*3,g=c+w.nnormals*h;c<g;c+=h)b=m(a,c),e=m(a,c+w.normal_coordinate_bytes),f=m(a,c+w.normal_coordinate_bytes*2),A.push(b/127,e/127,f/127);return w.nnormals*h}(y);y+=function(c){for(var e,h,g=w.uv_coordinate_bytes*2,k=c+w.nuvs*g;c<k;c+=g)e=b(a,c),h=b(a,c+w.uv_coordinate_bytes),C.push(e,h);return w.nuvs*g}(y);Q=y+Q;Z=Q+Z;W=Z+W;$=W+$;X=$+X;c=X+c;Y=c+Y;(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes,
+e=b+w.uv_index_bytes*3,f=a+w.ntri_flat_uv*e;for(c=a;c<f;c+=e)o(c),v(c+b);return f-a})(Z);(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=b+w.uv_index_bytes*3,f=a+w.ntri_smooth_uv*e;for(c=a;c<f;c+=e)t(c),v(c+b);return f-a})(W);(function(a){var c,b=w.vertex_index_bytes*4+w.material_index_bytes,e=b+w.uv_index_bytes*4,f=a+w.nquad_flat_uv*e;for(c=a;c<f;c+=e)p(c),u(c+b);return f-a})(c);(function(a){var c,b=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*
+4,e=b+w.uv_index_bytes*4,f=a+w.nquad_smooth_uv*e;for(c=a;c<f;c+=e)x(c),u(c+b);return f-a})(Y);(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes,e=a+w.ntri_flat*b;for(c=a;c<e;c+=b)o(c);return e-a})(y);(function(a){var c,b=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,e=a+w.ntri_smooth*b;for(c=a;c<e;c+=b)t(c);return e-a})(Q);(function(a){var c,b=w.vertex_index_bytes*4+w.material_index_bytes,e=a+w.nquad_flat*b;for(c=a;c<e;c+=b)p(c);return e-a})($);(function(a){var c,
+b=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,e=a+w.nquad_smooth*b;for(c=a;c<e;c+=b)x(c);return e-a})(X);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g(c))};
+THREE.ColladaLoader=function(){function a(a,c,b){for(var a=Q.evaluate(a,Q,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},f=a.iterateNext(),h=0;f;){f=(new c).parse(f);if(f.id.length==0)f.id=b+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,c=-a,b=0,e;for(e in ca)for(var f=ca[e],h=0;h<f.sampler.length;h++){var g=f.sampler[h];g.create();a=Math.min(a,g.startTime);c=Math.max(c,g.endTime);b=Math.max(b,g.input.length)}return{start:a,end:c,frames:b}}function c(a,b,e,f){a.world=a.world||
+new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=a.channels[0].sampler.output[e];h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)c(a.nodes[f],b,e,a.world)}function e(a,e,f){var h=aa[e.url];if(!h||!h.skin)console.log("could not find skin controller!");else if(!e.skeleton||!e.skeleton.length)console.log("could not find the skeleton for the skin!");else{var g=b(),e=W.getChildById(e.skeleton[0],!0)||W.getChildBySid(e.skeleton[0],
 !0),k,l,m,n,o=new THREE.Vector3,p;for(k=0;k<a.vertices.length;k++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);for(f=0;f<g.frames;f++){var t=[],v=[];for(k=0;k<a.vertices.length;k++)v.push(new THREE.Vertex(new THREE.Vector3));c(e,t,f);k=t;l=h.skin;for(n=0;n<k.length;n++){m=k[n];p=-1;for(var u=0;u<l.joints.length;u++)if(m.sid==l.joints[u]){p=u;break}if(p>=0){u=l.invBindMatrices[p];m.invBindMatrix=u;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,u);m.weights=[];
 !0),k,l,m,n,o=new THREE.Vector3,p;for(k=0;k<a.vertices.length;k++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);for(f=0;f<g.frames;f++){var t=[],v=[];for(k=0;k<a.vertices.length;k++)v.push(new THREE.Vertex(new THREE.Vector3));c(e,t,f);k=t;l=h.skin;for(n=0;n<k.length;n++){m=k[n];p=-1;for(var u=0;u<l.joints.length;u++)if(m.sid==l.joints[u]){p=u;break}if(p>=0){u=l.invBindMatrices[p];m.invBindMatrix=u;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,u);m.weights=[];
 for(u=0;u<l.weights.length;u++)for(var x=0;x<l.weights[u].length;x++){var w=l.weights[u][x];w.joint==p&&m.weights.push(w)}}else throw"could not find joint!";}for(k=0;k<t.length;k++)for(l=0;l<t[k].weights.length;l++)m=t[k].weights[l],n=m.index,m=m.weight,p=a.vertices[n],n=v[n],o.x=p.position.x,o.y=p.position.y,o.z=p.position.z,t[k].skinningMatrix.multiplyVector3(o),n.position.x+=o.x*m,n.position.y+=o.y*m,n.position.z+=o.z*m;a.morphTargets.push({name:"target_"+f,vertices:v})}}}function g(a){var c=new THREE.Object3D,
 for(u=0;u<l.weights.length;u++)for(var x=0;x<l.weights[u].length;x++){var w=l.weights[u][x];w.joint==p&&m.weights.push(w)}}else throw"could not find joint!";}for(k=0;k<t.length;k++)for(l=0;l<t[k].weights.length;l++)m=t[k].weights[l],n=m.index,m=m.weight,p=a.vertices[n],n=v[n],o.x=p.position.x,o.y=p.position.y,o.z=p.position.z,t[k].skinningMatrix.multiplyVector3(o),n.position.x+=o.x*m,n.position.y+=o.y*m,n.position.z+=o.z*m;a.morphTargets.push({name:"target_"+f,vertices:v})}}}function g(a){var c=new THREE.Object3D,
 b,f,h;c.name=a.id||"";c.matrixAutoUpdate=!1;c.matrix=a.matrix;for(h=0;h<a.controllers.length;h++){var k=aa[a.controllers[h].url];switch(k.type){case "skin":if(ba[k.skin.source]){var l=new x;l.url=k.skin.source;l.instance_material=a.controllers[h].instance_material;a.geometries.push(l);b=a.controllers[h]}else if(aa[k.skin.source]&&(f=k=aa[k.skin.source],k.morph&&ba[k.morph.source]))l=new x,l.url=k.morph.source,l.instance_material=a.controllers[h].instance_material,a.geometries.push(l);break;case "morph":if(ba[k.morph.source])l=
 b,f,h;c.name=a.id||"";c.matrixAutoUpdate=!1;c.matrix=a.matrix;for(h=0;h<a.controllers.length;h++){var k=aa[a.controllers[h].url];switch(k.type){case "skin":if(ba[k.skin.source]){var l=new x;l.url=k.skin.source;l.instance_material=a.controllers[h].instance_material;a.geometries.push(l);b=a.controllers[h]}else if(aa[k.skin.source]&&(f=k=aa[k.skin.source],k.morph&&ba[k.morph.source]))l=new x,l.url=k.morph.source,l.instance_material=a.controllers[h].instance_material,a.geometries.push(l);break;case "morph":if(ba[k.morph.source])l=
-new x,l.url=k.morph.source,l.instance_material=a.controllers[h].instance_material,a.geometries.push(l),f=a.controllers[h];console.log("DAE: morph-controller partially supported.")}}for(h=0;h<a.geometries.length;h++){var k=a.geometries[h],l=k.instance_material,k=ba[k.url],m={},n=0,o;if(k&&k.mesh&&k.mesh.primitives){if(c.name.length==0)c.name=k.id;if(l)for(j=0;j<l.length;j++){o=l[j];var p=fa[ea[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=m[o.symbol]=
-p.material;n++}l=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(n>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)n=k.faces[j],n.materials=[m[n.daeMaterial]]}if(b!==void 0)e(k,b),l.morphTargets=!0,l=new THREE.SkinnedMesh(k,l),l.skeleton=b.skeleton,l.skinController=aa[b.url],l.skinInstanceController=b,l.name="skin_"+da.length,da.push(l);else if(f!==void 0){m=k;n=f instanceof t?aa[f.url]:f;if(!n||!n.morph)console.log("could not find morph controller!");
-else{n=n.morph;for(p=0;p<n.targets.length;p++){var u=ba[n.targets[p]];if(u.mesh&&u.mesh.primitives&&u.mesh.primitives.length)u=u.mesh.primitives[0].geometry,u.vertices.length===m.vertices.length&&m.morphTargets.push({name:"target_1",vertices:u.vertices})}m.morphTargets.push({name:"target_Z",vertices:m.vertices})}l.morphTargets=!0;l=new THREE.Mesh(k,l);l.name="morph_"+ca.length;ca.push(l)}else l=new THREE.Mesh(k,l);c.addChild(l)}}for(h=0;h<a.nodes.length;h++)c.addChild(g(a.nodes[h],a));return c}function h(){this.init_from=
+new x,l.url=k.morph.source,l.instance_material=a.controllers[h].instance_material,a.geometries.push(l),f=a.controllers[h];console.log("DAE: morph-controller partially supported.")}}for(h=0;h<a.geometries.length;h++){var k=a.geometries[h],l=k.instance_material,k=ba[k.url],m={},n=0,o;if(k&&k.mesh&&k.mesh.primitives){if(c.name.length==0)c.name=k.id;if(l)for(j=0;j<l.length;j++){o=l[j];var p=ga[fa[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=m[o.symbol]=
+p.material;n++}l=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(n>1){l=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)n=k.faces[j],n.materials=[m[n.daeMaterial]]}if(b!==void 0)e(k,b),l.morphTargets=!0,l=new THREE.SkinnedMesh(k,l),l.skeleton=b.skeleton,l.skinController=aa[b.url],l.skinInstanceController=b,l.name="skin_"+ea.length,ea.push(l);else if(f!==void 0){m=k;n=f instanceof t?aa[f.url]:f;if(!n||!n.morph)console.log("could not find morph controller!");
+else{n=n.morph;for(p=0;p<n.targets.length;p++){var u=ba[n.targets[p]];if(u.mesh&&u.mesh.primitives&&u.mesh.primitives.length)u=u.mesh.primitives[0].geometry,u.vertices.length===m.vertices.length&&m.morphTargets.push({name:"target_1",vertices:u.vertices})}m.morphTargets.push({name:"target_Z",vertices:m.vertices})}l.morphTargets=!0;l=new THREE.Mesh(k,l);l.name="morph_"+da.length;da.push(l)}else l=new THREE.Mesh(k,l);c.addChild(l)}}for(h=0;h<a.nodes.length;h++)c.addChild(g(a.nodes[h],a));return c}function h(){this.init_from=
 this.id=""}function f(){this.type=this.name=this.id="";this.morph=this.skin=null}function k(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function m(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function n(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=
 this.id=""}function f(){this.type=this.name=this.id="";this.morph=this.skin=null}function k(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function m(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function n(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=
 this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function t(){this.url="";this.skeleton=[];this.instance_material=[]}function p(){this.target=this.symbol=""}function x(){this.url="";this.instance_material=[]}function v(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function z(){}function y(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";
 this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function t(){this.url="";this.skeleton=[];this.instance_material=[]}function p(){this.target=this.symbol=""}function x(){this.url="";this.instance_material=[]}function v(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function z(){}function y(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";
 this.stride=this.count=0;this.params=[]}function A(){this.input={}}function C(){this.semantic="";this.offset=0;this.source="";this.set=0}function F(a){this.id=a;this.type=null}function G(){this.name=this.id="";this.instance_effect=null}function I(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function H(a,c){this.type=a;this.effect=c;this.material=null}function M(a){this.effect=a;this.format=this.init_from=
 this.stride=this.count=0;this.params=[]}function A(){this.input={}}function C(){this.semantic="";this.offset=0;this.source="";this.set=0}function F(a){this.id=a;this.type=null}function G(){this.name=this.id="";this.instance_effect=null}function I(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function H(a,c){this.type=a;this.effect=c;this.material=null}function M(a){this.effect=a;this.format=this.init_from=
 null}function B(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function D(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function J(){this.url=""}function L(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function N(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function K(a){this.id="";this.animation=a;this.inputs=[];this.endTime=
 null}function B(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function D(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function J(){this.url=""}function L(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function N(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function K(a){this.id="";this.animation=a;this.inputs=[];this.endTime=
-this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function P(a){var c=a.getAttribute("id");if(Y[c]!=void 0)return Y[c];Y[c]=(new F(c)).parse(a);return Y[c]}function E(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function S(a){for(var a=U(a).split(/\s+/),c=[],b=0;b<a.length;b++)c.push(parseFloat(a[b]));return c}function O(a){for(var a=U(a).split(/\s+/),c=[],b=0;b<a.length;b++)c.push(parseInt(a[b],10));return c}function U(a){return a.replace(/^\s+/,
-"").replace(/\s+$/,"")}function W(a,c,b){return a.hasAttribute(c)?parseInt(a.getAttribute(c),10):b}function T(a,c){if(a===void 0){for(var b="0.";b.length<c+2;)b+="0";return b}c=c||2;b=a.toString().split(".");for(b[1]=b.length>1?b[1].substr(0,c):"0";b[1].length<c;)b[1]+="0";return b.join(".")}function R(a,c){var b="";b+=T(a.x,c)+",";b+=T(a.y,c)+",";b+=T(a.z,c);return b}var Q=null,Z=null,X,Y={},$={},V={},aa={},ba={},ea={},fa={},ga,ia=null,ja,ca,da,ka=THREE.SmoothShading;h.prototype.parse=function(a){this.id=
+this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function P(a){var c=a.getAttribute("id");if(X[c]!=void 0)return X[c];X[c]=(new F(c)).parse(a);return X[c]}function E(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function S(a){for(var a=U(a).split(/\s+/),c=[],b=0;b<a.length;b++)c.push(parseFloat(a[b]));return c}function O(a){for(var a=U(a).split(/\s+/),c=[],b=0;b<a.length;b++)c.push(parseInt(a[b],10));return c}function U(a){return a.replace(/^\s+/,
+"").replace(/\s+$/,"")}function V(a,c,b){return a.hasAttribute(c)?parseInt(a.getAttribute(c),10):b}function T(a,c){if(a===void 0){for(var b="0.";b.length<c+2;)b+="0";return b}c=c||2;b=a.toString().split(".");for(b[1]=b.length>1?b[1].substr(0,c):"0";b[1].length<c;)b[1]+="0";return b.join(".")}function R(a,c){var b="";b+=T(a.x,c)+",";b+=T(a.y,c)+",";b+=T(a.z,c);return b}var Q=null,Z=null,W,$=null,X={},Y={},ca={},aa={},ba={},fa={},ga={},ha,ja,da,ea,ka=THREE.SmoothShading;h.prototype.parse=function(a){this.id=
 a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName=="init_from")this.init_from=b.textContent}return this};f.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "skin":this.skin=(new l).parse(b);this.type=b.nodeName;break;case "morph":this.morph=(new k).parse(b),this.type=b.nodeName}}return this};k.prototype.parse=function(a){var c=
 a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName=="init_from")this.init_from=b.textContent}return this};f.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "skin":this.skin=(new l).parse(b);this.type=b.nodeName;break;case "morph":this.morph=(new k).parse(b),this.type=b.nodeName}}return this};k.prototype.parse=function(a){var c=
 {},b=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new F).parse(f);c[f.id]=f;break;case "targets":b=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<b.length;e++)switch(a=b[e],f=c[a.source],a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};k.prototype.parseInputs=
 {},b=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new F).parse(f);c[f.id]=f;break;case "targets":b=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<b.length;e++)switch(a=b[e],f=c[a.source],a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};k.prototype.parseInputs=
 function(a){for(var c=[],b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":c.push((new C).parse(e))}}return c};l.prototype.parse=function(a){var c={},b,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=S(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],
 function(a){for(var c=[],b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":c.push((new C).parse(e))}}return c};l.prototype.parse=function(a){var c={},b,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=S(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],
@@ -224,25 +224,25 @@ this.nodes=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.
 ""))}if(f==a)return b.info={sid:f,dotSyntax:h,arrSyntax:g,arrIndices:k},b}return null};n.prototype.getChildById=function(a,c){if(this.id==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};n.prototype.getChildBySid=function(a,c){if(this.sid==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildBySid(a,c);if(e)return e}return null};n.prototype.getTransformBySid=function(a){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==
 ""))}if(f==a)return b.info={sid:f,dotSyntax:h,arrSyntax:g,arrIndices:k},b}return null};n.prototype.getChildById=function(a,c){if(this.id==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};n.prototype.getChildBySid=function(a,c){if(this.sid==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildBySid(a,c);if(e)return e}return null};n.prototype.getTransformBySid=function(a){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==
 a)return this.transforms[c];return null};n.prototype.parse=function(a){var c;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 b=0;b<a.childNodes.length;b++)if(c=a.childNodes[b],c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new n).parse(c));break;case "instance_camera":break;
 a)return this.transforms[c];return null};n.prototype.parse=function(a){var c;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 b=0;b<a.childNodes.length;b++)if(c=a.childNodes[b],c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new n).parse(c));break;case "instance_camera":break;
 case "instance_controller":this.controllers.push((new t).parse(c));break;case "instance_geometry":this.geometries.push((new x).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=Q.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",Q,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new n).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(c));
 case "instance_controller":this.controllers.push((new t).parse(c));break;case "instance_geometry":this.geometries.push((new x).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=Q.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",Q,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new n).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(c));
-break;case "extra":break;default:console.log(c.nodeName)}a=[];b=1E6;c=-1E6;for(var e in V)for(var f=V[e],h=0;h<f.channel.length;h++){var g=f.channel[h],k=f.sampler[h];e=g.target.split("/")[0];if(e==this.id)k.create(),g.sampler=k,b=Math.min(b,k.startTime),c=Math.max(c,k.endTime),a.push(g)}if(a.length)this.startTime=b,this.endTime=c;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(b=0;b<a.input.length-1;b++)e=Math.min(e,a.input[b+1]-
-a.input[b])}b=[];for(a=this.startTime;a<this.endTime;a+=e){c=a;for(var f={},l=h=void 0,h=0;h<this.channels.length;h++)l=this.channels[h],f[l.sid]=l;g=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(k=this.transforms[h],l=f[k.sid],l!==void 0){for(var m=l.sampler,p,l=0;l<m.input.length-1;l++)if(m.input[l+1]>c){p=m.output[l];break}g=p!==void 0?p instanceof THREE.Matrix4?g.multiply(g,p):g.multiply(g,k.matrix):g.multiply(g,k.matrix)}else g=g.multiply(g,k.matrix);c=g;b.push({time:a,pos:[c.n14,
+break;case "extra":break;default:console.log(c.nodeName)}a=[];b=1E6;c=-1E6;for(var e in ca)for(var f=ca[e],h=0;h<f.channel.length;h++){var g=f.channel[h],k=f.sampler[h];e=g.target.split("/")[0];if(e==this.id)k.create(),g.sampler=k,b=Math.min(b,k.startTime),c=Math.max(c,k.endTime),a.push(g)}if(a.length)this.startTime=b,this.endTime=c;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(b=0;b<a.input.length-1;b++)e=Math.min(e,a.input[b+
+1]-a.input[b])}b=[];for(a=this.startTime;a<this.endTime;a+=e){c=a;for(var f={},l=h=void 0,h=0;h<this.channels.length;h++)l=this.channels[h],f[l.sid]=l;g=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(k=this.transforms[h],l=f[k.sid],l!==void 0){for(var m=l.sampler,p,l=0;l<m.input.length-1;l++)if(m.input[l+1]>c){p=m.output[l];break}g=p!==void 0?p instanceof THREE.Matrix4?g.multiply(g,p):g.multiply(g,k.matrix):g.multiply(g,k.matrix)}else g=g.multiply(g,k.matrix);c=g;b.push({time:a,pos:[c.n14,
 c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=b}this.updateMatrix();return this};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=S(a.textContent);this.updateMatrix();return this};o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
 c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=b}this.updateMatrix();return this};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=S(a.textContent);this.updateMatrix();return this};o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
 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};
 this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
 t.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "skeleton":this.skeleton.push(b.textContent.replace(/^#/,""));break;case "bind_material":if(b=Q.evaluate(".//dae:instance_material",b,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=b.iterateNext();e;)this.instance_material.push((new p).parse(e)),e=b.iterateNext()}}return this};
 t.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "skeleton":this.skeleton.push(b.textContent.replace(/^#/,""));break;case "bind_material":if(b=Q.evaluate(".//dae:instance_material",b,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=b.iterateNext();e;)this.instance_material.push((new p).parse(e)),e=b.iterateNext()}}return this};
 p.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};x.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1&&b.nodeName=="bind_material"){if(a=Q.evaluate(".//dae:instance_material",b,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=a.iterateNext();c;)this.instance_material.push((new p).parse(c)),
 p.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};x.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1&&b.nodeName=="bind_material"){if(a=Q.evaluate(".//dae:instance_material",b,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=a.iterateNext();c;)this.instance_material.push((new p).parse(c)),
 c=a.iterateNext();break}}return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "mesh":this.mesh=(new u(this)).parse(b)}}return this};u.prototype.parse=function(a){function c(a,b){var e=R(a.position);f[e]===void 0&&(f[e]={v:a,index:b});return f[e]}this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];switch(e.nodeName){case "source":P(e);break;case "vertices":this.vertices=
 c=a.iterateNext();break}}return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "mesh":this.mesh=(new u(this)).parse(b)}}return this};u.prototype.parse=function(a){function c(a,b){var e=R(a.position);f[e]===void 0&&(f[e]={v:a,index:b});return f[e]}this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];switch(e.nodeName){case "source":P(e);break;case "vertices":this.vertices=
-(new A).parse(e);break;case "triangles":this.primitives.push((new y).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new z).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=Y[this.vertices.input.POSITION.source].data;for(a=b=0;b<e.length;b+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[b],e[b+1],e[b+2]));c(h,a);this.geometry3js.vertices.push(h)}for(b=0;b<this.primitives.length;b++)primitive=this.primitives[b],primitive.setVertices(this.vertices),
+(new A).parse(e);break;case "triangles":this.primitives.push((new y).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new z).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=X[this.vertices.input.POSITION.source].data;for(a=b=0;b<e.length;b+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[b],e[b+1],e[b+2]));c(h,a);this.geometry3js.vertices.push(h)}for(b=0;b<this.primitives.length;b++)primitive=this.primitives[b],primitive.setVertices(this.vertices),
 this.handlePrimitive(primitive,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};u.prototype.handlePrimitive=function(a,c,b){var e=0,f,h,g=a.p,k=a.inputs,l,m,n,o=0,p=3,t=[];for(f=0;f<k.length;f++)switch(l=k[f],l.semantic){case "TEXCOORD":t.push(l.set)}for(;e<g.length;){var u=[],v=[],x={},w=[];a.vcount&&(p=a.vcount[o++]);for(f=0;f<p;f++)for(h=0;h<k.length;h++)switch(l=
 this.handlePrimitive(primitive,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};u.prototype.handlePrimitive=function(a,c,b){var e=0,f,h,g=a.p,k=a.inputs,l,m,n,o=0,p=3,t=[];for(f=0;f<k.length;f++)switch(l=k[f],l.semantic){case "TEXCOORD":t.push(l.set)}for(;e<g.length;){var u=[],v=[],x={},w=[];a.vcount&&(p=a.vcount[o++]);for(f=0;f<p;f++)for(h=0;h<k.length;h++)switch(l=
-k[h],source=Y[l.source],m=g[e+f*k.length+l.offset],numParams=source.accessor.params.length,n=m*numParams,l.semantic){case "VERTEX":l=R(c.vertices[m].position);u.push(b[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[n+0],source.data[n+1],source.data[n+2]));break;case "TEXCOORD":x[l.set]===void 0&&(x[l.set]=[]);x[l.set].push(new THREE.UV(source.data[n+0],source.data[n+1]));break;case "COLOR":w.push((new THREE.Color).setRGB(source.data[n+0],source.data[n+1],source.data[n+2]))}var y;
-p==3?y=new THREE.Face3(u[0],u[1],u[2],[v[0],v[1],v[2]]):p==4&&(y=new THREE.Face4(u[0],u[1],u[2],u[3],[v[0],v[1],v[2],v[3]]));y.daeMaterial=a.material;c.faces.push(y);for(h=0;h<t.length;h++)f=x[t[h]],c.faceVertexUvs[h].push([f[0],f[1],f[2]]);e+=k.length*p}};z.prototype=new y;z.prototype.constructor=z;y.prototype.setVertices=function(a){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==a.id)this.inputs[c].source=a.input.POSITION.source};y.prototype.parse=function(a){this.inputs=[];this.material=
-a.getAttribute("material");this.count=W(a,"count",0);for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "input":this.inputs.push((new C).parse(a.childNodes[c]));break;case "vcount":this.vcount=O(b.textContent);break;case "p":this.p=O(b.textContent)}}return this};w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=W(a,"count",0);this.stride=W(a,"stride",0);for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName==
-"param"){var e={};e.name=b.getAttribute("name");e.type=b.getAttribute("type");this.params.push(e)}}return this};A.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++)a.childNodes[c].nodeName=="input"&&(input=(new C).parse(a.childNodes[c]),this.input[input.semantic]=input);return this};C.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=W(a,"set",-1);this.offset=W(a,"offset",
+k[h],source=X[l.source],m=g[e+f*k.length+l.offset],numParams=source.accessor.params.length,n=m*numParams,l.semantic){case "VERTEX":l=R(c.vertices[m].position);u.push(b[l].index);break;case "NORMAL":v.push(new THREE.Vector3(source.data[n],source.data[n+1],source.data[n+2]));break;case "TEXCOORD":x[l.set]===void 0&&(x[l.set]=[]);x[l.set].push(new THREE.UV(source.data[n],source.data[n+1]));break;case "COLOR":w.push((new THREE.Color).setRGB(source.data[n],source.data[n+1],source.data[n+2]))}var y;p==
+3?y=new THREE.Face3(u[0],u[1],u[2],[v[0],v[1],v[2]]):p==4&&(y=new THREE.Face4(u[0],u[1],u[2],u[3],[v[0],v[1],v[2],v[3]]));y.daeMaterial=a.material;c.faces.push(y);for(h=0;h<t.length;h++)f=x[t[h]],c.faceVertexUvs[h].push([f[0],f[1],f[2]]);e+=k.length*p}};z.prototype=new y;z.prototype.constructor=z;y.prototype.setVertices=function(a){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==a.id)this.inputs[c].source=a.input.POSITION.source};y.prototype.parse=function(a){this.inputs=[];this.material=
+a.getAttribute("material");this.count=V(a,"count",0);for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "input":this.inputs.push((new C).parse(a.childNodes[c]));break;case "vcount":this.vcount=O(b.textContent);break;case "p":this.p=O(b.textContent)}}return this};w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=V(a,"count",0);this.stride=V(a,"stride",0);for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName==
+"param"){var e={};e.name=b.getAttribute("name");e.type=b.getAttribute("type");this.params.push(e)}}return this};A.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++)a.childNodes[c].nodeName=="input"&&(input=(new C).parse(a.childNodes[c]),this.input[input.semantic]=input);return this};C.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=V(a,"set",-1);this.offset=V(a,"offset",
 0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};F.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "bool_array":for(var e=U(b.textContent).split(/\s+/),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?!0:!1);this.data=f;this.type=b.nodeName;break;case "float_array":this.data=S(b.textContent);this.type=b.nodeName;break;case "int_array":this.data=O(b.textContent);this.type=b.nodeName;
 0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};F.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "bool_array":for(var e=U(b.textContent).split(/\s+/),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?!0:!1);this.data=f;this.type=b.nodeName;break;case "float_array":this.data=S(b.textContent);this.type=b.nodeName;break;case "int_array":this.data=O(b.textContent);this.type=b.nodeName;
 break;case "IDREF_array":case "Name_array":this.data=U(b.textContent).split(/\s+/);this.type=b.nodeName;break;case "technique_common":for(e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="accessor"){this.accessor=(new w).parse(b.childNodes[e]);break}}}return this};F.prototype.read=function(){var a=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var b=this.data.slice(c,c+16),e=new THREE.Matrix4;
 break;case "IDREF_array":case "Name_array":this.data=U(b.textContent).split(/\s+/);this.type=b.nodeName;break;case "technique_common":for(e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="accessor"){this.accessor=(new w).parse(b.childNodes[e]);break}}}return this};F.prototype.read=function(){var a=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var b=this.data.slice(c,c+16),e=new THREE.Matrix4;
 e.set(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]);a.push(e)}break;default:console.log("Dae::Source:read dont know how to read "+c.type)}return a};G.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var c=0;c<a.childNodes.length;c++)if(a.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new J).parse(a.childNodes[c]);break}return this};I.prototype.isColor=function(){return this.texture==null};I.prototype.isTexture=
 e.set(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]);a.push(e)}break;default:console.log("Dae::Source:read dont know how to read "+c.type)}return a};G.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var c=0;c<a.childNodes.length;c++)if(a.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new J).parse(a.childNodes[c]);break}return this};I.prototype.isColor=function(){return this.texture==null};I.prototype.isTexture=
 function(){return this.texture!=null};I.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "color":b=S(b.textContent);this.color=new THREE.Color(0);this.color.setRGB(b[0],b[1],b[2]);this.color.a=b[3];break;case "texture":this.texture=b.getAttribute("texture"),this.texcoord=b.getAttribute("texcoord")}}return this};H.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[b.nodeName]=
 function(){return this.texture!=null};I.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "color":b=S(b.textContent);this.color=new THREE.Color(0);this.color.setRGB(b[0],b[1],b[2]);this.color.a=b[3];break;case "texture":this.texture=b.getAttribute("texture"),this.texcoord=b.getAttribute("texcoord")}}return this};H.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[b.nodeName]=
 (new I).parse(b);break;case "shininess":case "reflectivity":case "transparency":var e;e=Q.evaluate(".//dae:float",b,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};H.prototype.create=function(){var a={},c=this.transparency!==void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];
 (new I).parse(b);break;case "shininess":case "reflectivity":case "transparency":var e;e=Q.evaluate(".//dae:float",b,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};H.prototype.create=function(){var a={},c=this.transparency!==void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];
-if(e instanceof I)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=$[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=
+if(e instanceof I)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=Y[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=
 this[b],c=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};M.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "init_from":this.init_from=b.textContent;break;case "format":this.format=b.textContent;break;default:console.log("unhandled Surface prop: "+b.nodeName)}}return this};B.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":this.source=
 this[b],c=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};M.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "init_from":this.init_from=b.textContent;break;case "format":this.format=b.textContent;break;default:console.log("unhandled Surface prop: "+b.nodeName)}}return this};B.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":this.source=
 b.textContent;break;case "minfilter":this.minfilter=b.textContent;break;case "magfilter":this.magfilter=b.textContent;break;case "mipfilter":this.mipfilter=b.textContent;break;case "wrap_s":this.wrap_s=b.textContent;break;case "wrap_t":this.wrap_t=b.textContent;break;default:console.log("unhandled Sampler2D prop: "+b.nodeName)}}return this};D.prototype.create=function(){if(this.shader==null)return null};D.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=
 b.textContent;break;case "minfilter":this.minfilter=b.textContent;break;case "magfilter":this.magfilter=b.textContent;break;case "mipfilter":this.mipfilter=b.textContent;break;case "wrap_s":this.wrap_s=b.textContent;break;case "wrap_t":this.wrap_t=b.textContent;break;default:console.log("unhandled Sampler2D prop: "+b.nodeName)}}return this};D.prototype.create=function(){if(this.shader==null)return null};D.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=
 null;for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(b))}}return this};D.prototype.parseNewparam=function(a){for(var c=a.getAttribute("sid"),b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new M(this)).parse(e);this.surface.sid=c;break;case "sampler2D":this.sampler=(new B(this)).parse(e);this.sampler.sid=c;break;case "extra":break;
 null;for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(b))}}return this};D.prototype.parseNewparam=function(a){for(var c=a.getAttribute("sid"),b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new M(this)).parse(e);this.surface.sid=c;break;case "sampler2D":this.sampler=(new B(this)).parse(e);this.sampler.sid=c;break;case "extra":break;
@@ -251,9 +251,9 @@ default:console.log(e.nodeName)}}};D.prototype.parseProfileCOMMON=function(a){fo
 N.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var c=this.target.split("/");c.shift();var a=c.shift(),b=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(b)c=a.split("."),a=c.shift(),h=c.shift();else if(e){f=a.split("(");a=f.shift();for(c=0;c<f.length;c++)f[c]=parseInt(f[c].replace(/\)/,""))}this.sid=a;this.dotSyntax=b;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};K.prototype.parse=function(a){this.id=a.getAttribute("id");
 N.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var c=this.target.split("/");c.shift();var a=c.shift(),b=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(b)c=a.split("."),a=c.shift(),h=c.shift();else if(e){f=a.split("(");a=f.shift();for(c=0;c<f.length;c++)f[c]=parseInt(f[c].replace(/\)/,""))}this.sid=a;this.dotSyntax=b;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};K.prototype.parse=function(a){this.id=a.getAttribute("id");
 this.inputs=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "input":this.inputs.push((new C).parse(b))}}return this};K.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var c=this.inputs[a],b=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=b.read();break;case "OUTPUT":this.output=b.read();break;case "INTERPOLATION":this.interpolation=b.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.semantic)}}this.duration=
 this.inputs=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "input":this.inputs.push((new C).parse(b))}}return this};K.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var c=this.inputs[a],b=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=b.read();break;case "OUTPUT":this.output=b.read();break;case "INTERPOLATION":this.interpolation=b.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.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=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(c,e){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);c+="?rnd="+Math.random();var k=new XMLHttpRequest;
 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=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(c,e){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);c+="?rnd="+Math.random();var k=new XMLHttpRequest;
-k.overrideMimeType&&k.overrideMimeType("text/xml");k.onreadystatechange=function(){if(k.readyState==4&&(k.status==0||k.status==200)){ia=e;var l,n=c;Q=k.responseXML;l=ia;n!==void 0&&(n=n.split("/"),n.pop(),ja=n.join("/")+"/");$=a("//dae:library_images/dae:image",h,"image");ea=a("//dae:library_materials/dae:material",G,"material");fa=a("//dae:library_effects/dae:effect",D,"effect");ba=a("//dae:library_geometries/dae:geometry",v,"geometry");aa=a("//dae:library_controllers/dae:controller",f,"controller");
-V=a("//dae:library_animations/dae:animation",L,"animation");ga=a(".//dae:library_visual_scenes/dae:visual_scene",m,"visual_scene");ca=[];da=[];(n=Q.evaluate(".//dae:scene/dae:instance_visual_scene",Q,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(n=n.getAttribute("url").replace(/^#/,""),X=ga[n]):X=null;Z=new THREE.Object3D;for(n=0;n<X.nodes.length;n++)Z.addChild(g(X.nodes[n]));b();for(var o in V);o={scene:Z,morphs:ca,skins:da,dae:{images:$,materials:ea,effects:fa,geometries:ba,controllers:aa,
-animations:V,visualScenes:ga,scene:X}};l&&l(o)}};k.open("GET",c,!0);k.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(a){ka=a},applySkin:e,geometries:ba}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+k.overrideMimeType&&k.overrideMimeType("text/xml");k.onreadystatechange=function(){if(k.readyState==4&&(k.status==0||k.status==200)){$=e;var l,n=c;Q=k.responseXML;l=$;n!==void 0&&(n=n.split("/"),n.pop(),ja=n.join("/")+"/");Y=a("//dae:library_images/dae:image",h,"image");fa=a("//dae:library_materials/dae:material",G,"material");ga=a("//dae:library_effects/dae:effect",D,"effect");ba=a("//dae:library_geometries/dae:geometry",v,"geometry");aa=a("//dae:library_controllers/dae:controller",f,"controller");
+ca=a("//dae:library_animations/dae:animation",L,"animation");ha=a(".//dae:library_visual_scenes/dae:visual_scene",m,"visual_scene");da=[];ea=[];(n=Q.evaluate(".//dae:scene/dae:instance_visual_scene",Q,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(n=n.getAttribute("url").replace(/^#/,""),W=ha[n]):W=null;Z=new THREE.Object3D;for(n=0;n<W.nodes.length;n++)Z.addChild(g(W.nodes[n]));b();for(var o in ca);o={scene:Z,morphs:da,skins:ea,dae:{images:Y,materials:fa,effects:ga,geometries:ba,controllers:aa,
+animations:ca,visualScenes:ha,scene:W}};l&&l(o)}};k.open("GET",c,!0);k.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(a){ka=a},applySkin:e,geometries:ba}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a){var b=this,c=a.model,e=a.callback,g=a.texture_path?a.texture_path:this.extractUrlbase(c),a=new Worker(c);a.onmessage=function(a){b.createModel(a.data,e,g);b.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
 THREE.JSONLoader.prototype.load=function(a){var b=this,c=a.model,e=a.callback,g=a.texture_path?a.texture_path:this.extractUrlbase(c),a=new Worker(c);a.onmessage=function(a){b.createModel(a.data,e,g);b.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
 THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,g,l,m,n,o,t,p,x,v,u,z,y,w,A=a.faces;o=a.vertices;var C=a.normals,F=a.colors,G=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&G++;for(b=0;b<G;b++)e.faceUvs[b]=[],e.faceVertexUvs[b]=[];m=0;for(n=o.length;m<n;)t=new THREE.Vertex,t.position.x=o[m++]*c,t.position.y=
 THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,g,l,m,n,o,t,p,x,v,u,z,y,w,A=a.faces;o=a.vertices;var C=a.normals,F=a.colors,G=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&G++;for(b=0;b<G;b++)e.faceUvs[b]=[],e.faceVertexUvs[b]=[];m=0;for(n=o.length;m<n;)t=new THREE.Vertex,t.position.x=o[m++]*c,t.position.y=
 o[m++]*c,t.position.z=o[m++]*c,e.vertices.push(t);m=0;for(n=A.length;m<n;){c=A[m++];o=c&1;l=c&2;b=c&4;g=c&8;p=c&16;t=c&32;v=c&64;c&=128;o?(u=new THREE.Face4,u.a=A[m++],u.b=A[m++],u.c=A[m++],u.d=A[m++],o=4):(u=new THREE.Face3,u.a=A[m++],u.b=A[m++],u.c=A[m++],o=3);if(l)l=A[m++],u.materials=e.materials[l];l=e.faces.length;if(b)for(b=0;b<G;b++)z=a.uvs[b],x=A[m++],w=z[x*2],x=z[x*2+1],e.faceUvs[b][l]=new THREE.UV(w,x);if(g)for(b=0;b<G;b++){z=a.uvs[b];y=[];for(g=0;g<o;g++)x=A[m++],w=z[x*2],x=z[x*2+1],y[g]=
 o[m++]*c,t.position.z=o[m++]*c,e.vertices.push(t);m=0;for(n=A.length;m<n;){c=A[m++];o=c&1;l=c&2;b=c&4;g=c&8;p=c&16;t=c&32;v=c&64;c&=128;o?(u=new THREE.Face4,u.a=A[m++],u.b=A[m++],u.c=A[m++],u.d=A[m++],o=4):(u=new THREE.Face3,u.a=A[m++],u.b=A[m++],u.c=A[m++],o=3);if(l)l=A[m++],u.materials=e.materials[l];l=e.faces.length;if(b)for(b=0;b<G;b++)z=a.uvs[b],x=A[m++],w=z[x*2],x=z[x*2+1],e.faceUvs[b][l]=new THREE.UV(w,x);if(g)for(b=0;b<G;b++){z=a.uvs[b];y=[];for(g=0;g<o;g++)x=A[m++],w=z[x*2],x=z[x*2+1],y[g]=

+ 1 - 1
build/custom/ThreeSVG.js

@@ -69,7 +69,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){t
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-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(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-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 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,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,k=this.w,i=k*c+f*e-h*d,l=k*d+h*c-g*e,j=k*e+g*d-f*c,c=-g*
 this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,k=this.w,i=k*c+f*e-h*d,l=k*d+h*c-g*e,j=k*e+g*d-f*c,c=-g*
-c-f*d-h*e;b.x=i*k+c*-g+l*-h-j*-f;b.y=l*k+c*-f+j*-g-i*-h;b.z=j*k+c*-h+i*-f-l*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+c-f*d-h*e;b.x=i*k+c*-g+l*-h-j*-f;b.y=l*k+c*-f+j*-g-i*-h;b.z=j*k+c*-h+i*-f-l*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.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

@@ -69,7 +69,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,f){t
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(d);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(d);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
 this.x,d=this.y,f=this.z,j=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+j*h+d*m-f*k;this.y=d*b+j*k+f*h-c*m;this.z=f*b+j*m+c*k-d*h;this.w=j*b-c*h-d*k-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,j=b.z,h=this.x,k=this.y,m=this.z,q=this.w,o=q*d+k*j-m*f,u=q*f+m*d-h*j,r=q*j+h*f-k*d,d=-h*
 this.x,d=this.y,f=this.z,j=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+j*h+d*m-f*k;this.y=d*b+j*k+f*h-c*m;this.z=f*b+j*m+c*k-d*h;this.w=j*b-c*h-d*k-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,j=b.z,h=this.x,k=this.y,m=this.z,q=this.w,o=q*d+k*j-m*f,u=q*f+m*d-h*j,r=q*j+h*f-k*d,d=-h*
-d-k*f-m*j;c.x=o*q+d*-h+u*-m-r*-k;c.y=u*q+d*-k+r*-h-o*-m;c.z=r*q+d*-m+o*-k-u*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var j=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(j)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(j),k=Math.sqrt(1-j*j);if(Math.abs(k)<0.001)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;j=Math.sin((1-f)*h)/k;f=Math.sin(f*h)/k;d.w=b.w*j+c.w*f;d.x=b.x*j+c.x*f;d.y=b.y*j+c.y*f;d.z=b.z*j+c.z*f;return d};
+d-k*f-m*j;c.x=o*q+d*-h+u*-m-r*-k;c.y=u*q+d*-k+r*-h-o*-m;c.z=r*q+d*-m+o*-k-u*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var j=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(j)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(j),k=Math.sqrt(1-j*j);if(Math.abs(k)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;j=Math.sin((1-f)*h)/k;f=Math.sin(f*h)/k;d.w=b.w*j+c.w*f;d.x=b.x*j+c.x*f;d.y=b.y*j+c.y*f;d.z=b.z*j+c.z*f;return d};
 THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,f,j,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,f,j,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,d,f,j,h,k){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.Face4=function(b,c,d,f,j,h,k){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};

+ 163 - 123
src/extras/loaders/ColladaLoader.js

@@ -7,6 +7,9 @@ THREE.ColladaLoader = function () {
 	var COLLADA = null;
 	var COLLADA = null;
 	var scene = null;
 	var scene = null;
 	var daeScene;
 	var daeScene;
+
+	var readyCallbackFunc = null;
+
  	var sources = {};
  	var sources = {};
 	var images = {};
 	var images = {};
 	var animations = {};
 	var animations = {};
@@ -14,12 +17,13 @@ THREE.ColladaLoader = function () {
 	var geometries = {};
 	var geometries = {};
 	var materials = {};
 	var materials = {};
 	var effects = {};
 	var effects = {};
+
 	var visualScenes;
 	var visualScenes;
-	var flip_uv = true;
-	var readyCallbackFunc = null;
 	var baseUrl;
 	var baseUrl;
 	var morphs;
 	var morphs;
 	var skins;
 	var skins;
+
+	var flip_uv = true;
 	var preferredShading = THREE.SmoothShading;
 	var preferredShading = THREE.SmoothShading;
 
 
 	function load ( url, readyCallback ) {
 	function load ( url, readyCallback ) {
@@ -29,8 +33,12 @@ THREE.ColladaLoader = function () {
 			var namespaceURL = "http://www.collada.org/2005/11/COLLADASchema";
 			var namespaceURL = "http://www.collada.org/2005/11/COLLADASchema";
 			var rootTagName = "COLLADA";
 			var rootTagName = "COLLADA";
 
 
-			var xmldoc = document.implementation.createDocument(namespaceURL, rootTagName, null);
+			var xmldoc = document.implementation.createDocument( namespaceURL, rootTagName, null );
 			var me = this;
 			var me = this;
+
+			// force reloading
+			// (should be configurable? sometimes caching is desirable)
+
 			url += "?rnd=" + Math.random();
 			url += "?rnd=" + Math.random();
 
 
 			var req = new XMLHttpRequest();
 			var req = new XMLHttpRequest();
@@ -38,7 +46,8 @@ THREE.ColladaLoader = function () {
 			if( req.overrideMimeType ) {
 			if( req.overrideMimeType ) {
 
 
 				// need this? yes... if extension is other then *.xml :-S
 				// need this? yes... if extension is other then *.xml :-S
-				req.overrideMimeType("text/xml");
+
+				req.overrideMimeType( "text/xml" );
 
 
 			}
 			}
 
 
@@ -62,7 +71,7 @@ THREE.ColladaLoader = function () {
 
 
 		} else {
 		} else {
 
 
-			alert("Don't know how to parse XML!");
+			alert( "Don't know how to parse XML!" );
 
 
 		}
 		}
 
 
@@ -75,9 +84,9 @@ THREE.ColladaLoader = function () {
 
 
 		if ( url !== undefined ) {
 		if ( url !== undefined ) {
 
 
-			var parts = url.split('/');
+			var parts = url.split( '/' );
 			parts.pop();
 			parts.pop();
-			baseUrl = parts.join('/') + '/';
+			baseUrl = parts.join( '/' ) + '/';
 
 
 		}
 		}
 
 
@@ -95,7 +104,7 @@ THREE.ColladaLoader = function () {
 		daeScene = parseScene();
 		daeScene = parseScene();
 		scene = new THREE.Object3D();
 		scene = new THREE.Object3D();
 
 
-		for ( var i = 0; i < daeScene.nodes.length; i++ ) {
+		for ( var i = 0; i < daeScene.nodes.length; i ++ ) {
 
 
 			scene.addChild( createSceneGraph( daeScene.nodes[ i ] ) );
 			scene.addChild( createSceneGraph( daeScene.nodes[ i ] ) );
 
 
@@ -246,7 +255,7 @@ THREE.ColladaLoader = function () {
 
 
 			if ( !daeGeometry.mesh ||
 			if ( !daeGeometry.mesh ||
 				 !daeGeometry.mesh.primitives ||
 				 !daeGeometry.mesh.primitives ||
-				 !daeGeometry.mesh.primitives.length) {
+				 !daeGeometry.mesh.primitives.length ) {
 				 continue;
 				 continue;
 			}
 			}
 
 
@@ -257,6 +266,7 @@ THREE.ColladaLoader = function () {
 				geometry.morphTargets.push( { name: "target_1", vertices: target.vertices } );
 				geometry.morphTargets.push( { name: "target_1", vertices: target.vertices } );
 
 
 			}
 			}
+
 		}
 		}
 
 
 		geometry.morphTargets.push( { name: "target_Z", vertices: geometry.vertices } );
 		geometry.morphTargets.push( { name: "target_Z", vertices: geometry.vertices } );
@@ -269,14 +279,14 @@ THREE.ColladaLoader = function () {
 
 
 		if ( !skinCtrl || !skinCtrl.skin ) {
 		if ( !skinCtrl || !skinCtrl.skin ) {
 
 
-			console.log("could not find skin controller!");
+			console.log( "could not find skin controller!" );
 			return;
 			return;
 
 
 		}
 		}
 
 
 		if ( !ctrl.skeleton || !ctrl.skeleton.length ) {
 		if ( !ctrl.skeleton || !ctrl.skeleton.length ) {
 
 
-			console.log("could not find the skeleton for the skin!");
+			console.log( "could not find the skeleton for the skin!" );
 			return;
 			return;
 
 
 		}
 		}
@@ -328,7 +338,7 @@ THREE.ColladaLoader = function () {
 
 
 			if ( m instanceof THREE.Matrix4 ) {
 			if ( m instanceof THREE.Matrix4 ) {
 
 
-				node.world.copy(m);
+				node.world.copy( m );
 
 
 			}
 			}
 
 
@@ -370,7 +380,7 @@ THREE.ColladaLoader = function () {
 
 
 			}
 			}
 
 
-			if ( found >= 0 ){
+			if ( found >= 0 ) {
 
 
 				var inv = skin.invBindMatrices[ found ];
 				var inv = skin.invBindMatrices[ found ];
 
 
@@ -509,49 +519,60 @@ THREE.ColladaLoader = function () {
 
 
 		// FIXME: controllers
 		// FIXME: controllers
 
 
-		for ( i =0; i < node.controllers.length; i ++ ) {
+		for ( i = 0; i < node.controllers.length; i ++ ) {
 
 
-			var controller = controllers[node.controllers[i].url];
+			var controller = controllers[ node.controllers[ i ].url ];
 
 
 			switch ( controller.type ) {
 			switch ( controller.type ) {
 
 
 				case 'skin':
 				case 'skin':
 
 
-					if ( geometries[controller.skin.source] ) {
+					if ( geometries[ controller.skin.source ] ) {
 
 
 						var inst_geom = new InstanceGeometry();
 						var inst_geom = new InstanceGeometry();
+
 						inst_geom.url = controller.skin.source;
 						inst_geom.url = controller.skin.source;
-						inst_geom.instance_material = node.controllers[i].instance_material;
-						node.geometries.push(inst_geom);
+						inst_geom.instance_material = node.controllers[ i ].instance_material;
+
+						node.geometries.push( inst_geom );
 						skinned = true;
 						skinned = true;
-						skinController = node.controllers[i];
+						skinController = node.controllers[ i ];
 
 
-					} else if (controllers[controller.skin.source]) {
+					} else if ( controllers[ controller.skin.source ] ) {
 
 
 						// urgh: controller can be chained
 						// urgh: controller can be chained
 						// handle the most basic case...
 						// handle the most basic case...
-						var second = controllers[controller.skin.source];
+
+						var second = controllers[ controller.skin.source ];
 						morphController = second;
 						morphController = second;
 					//	skinController = node.controllers[i];
 					//	skinController = node.controllers[i];
-						if (second.morph && geometries[second.morph.source]) {
+
+						if ( second.morph && geometries[ second.morph.source ] ) {
+
 							var inst_geom = new InstanceGeometry();
 							var inst_geom = new InstanceGeometry();
+
 							inst_geom.url = second.morph.source;
 							inst_geom.url = second.morph.source;
-							inst_geom.instance_material = node.controllers[i].instance_material;
-							node.geometries.push(inst_geom);
+							inst_geom.instance_material = node.controllers[ i ].instance_material;
+
+							node.geometries.push( inst_geom );
+
 						}
 						}
+
 					}
 					}
 
 
 					break;
 					break;
 
 
 				case 'morph':
 				case 'morph':
 
 
-					if ( geometries[controller.morph.source] ) {
+					if ( geometries[ controller.morph.source ] ) {
 
 
 						var inst_geom = new InstanceGeometry();
 						var inst_geom = new InstanceGeometry();
+
 						inst_geom.url = controller.morph.source;
 						inst_geom.url = controller.morph.source;
-						inst_geom.instance_material = node.controllers[i].instance_material;
-						node.geometries.push(inst_geom);
-						morphController = node.controllers[i];
+						inst_geom.instance_material = node.controllers[ i ].instance_material;
+
+						node.geometries.push( inst_geom );
+						morphController = node.controllers[ i ];
 
 
 					}
 					}
 
 
@@ -559,7 +580,9 @@ THREE.ColladaLoader = function () {
 
 
 				default:
 				default:
 					break;
 					break;
+
 			}
 			}
+
 		}
 		}
 
 
 		// FIXME: multi-material mesh?
 		// FIXME: multi-material mesh?
@@ -576,10 +599,10 @@ THREE.ColladaLoader = function () {
 
 
 			if ( geometry ) {
 			if ( geometry ) {
 
 
-				if (!geometry.mesh || !geometry.mesh.primitives)
+				if ( !geometry.mesh || !geometry.mesh.primitives )
 					continue;
 					continue;
 
 
-				if (obj.name.length == 0) {
+				if ( obj.name.length == 0 ) {
 
 
 					obj.name = geometry.id;
 					obj.name = geometry.id;
 
 
@@ -902,11 +925,13 @@ THREE.ColladaLoader = function () {
 			switch ( child.nodeName ) {
 			switch ( child.nodeName ) {
 
 
 				case 'skin':
 				case 'skin':
+
 					this.skin = (new Skin()).parse(child);
 					this.skin = (new Skin()).parse(child);
 					this.type = child.nodeName;
 					this.type = child.nodeName;
 					break;
 					break;
 
 
 				case 'morph':
 				case 'morph':
+
 					this.morph = (new Morph()).parse(child);
 					this.morph = (new Morph()).parse(child);
 					this.type = child.nodeName;
 					this.type = child.nodeName;
 					break;
 					break;
@@ -1135,17 +1160,17 @@ THREE.ColladaLoader = function () {
 
 
 				case 'input':
 				case 'input':
 
 
-					inputs.push((new Input()).parse(child));
+					inputs.push( ( new Input() ).parse( child ) );
 					break;
 					break;
 
 
 				case 'v':
 				case 'v':
 
 
-					v = _ints(child.textContent);
+					v = _ints( child.textContent );
 					break;
 					break;
 
 
 				case 'vcount':
 				case 'vcount':
 
 
-					vcount = _ints(child.textContent);
+					vcount = _ints( child.textContent );
 					break;
 					break;
 
 
 				default:
 				default:
@@ -1326,9 +1351,9 @@ THREE.ColladaLoader = function () {
 
 
 			}
 			}
 
 
-			if (sid == transformSid) {
+			if ( sid == transformSid ) {
 
 
-				channel.info = {sid:sid, dotSyntax:dotSyntax, arrSyntax:arrSyntax, arrIndices:arrIndices};
+				channel.info = { sid: sid, dotSyntax: dotSyntax, arrSyntax: arrSyntax, arrIndices: arrIndices };
 				return channel;
 				return channel;
 
 
 			}
 			}
@@ -1356,6 +1381,7 @@ THREE.ColladaLoader = function () {
 				if ( n ) {
 				if ( n ) {
 
 
 					return n;
 					return n;
+
 				}
 				}
 
 
 			}
 			}
@@ -1383,6 +1409,7 @@ THREE.ColladaLoader = function () {
 				if ( n ) {
 				if ( n ) {
 
 
 					return n;
 					return n;
+
 				}
 				}
 
 
 			}
 			}
@@ -1424,7 +1451,7 @@ THREE.ColladaLoader = function () {
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 
 
 			var child = element.childNodes[ i ];
 			var child = element.childNodes[ i ];
-			if (child.nodeType != 1) continue;
+			if ( child.nodeType != 1 ) continue;
 
 
 			switch ( child.nodeName ) {
 			switch ( child.nodeName ) {
 
 
@@ -1615,6 +1642,7 @@ THREE.ColladaLoader = function () {
 							instance = instances.iterateNext();
 							instance = instances.iterateNext();
 
 
 						}
 						}
+
 					}
 					}
 
 
 					break;
 					break;
@@ -1654,7 +1682,7 @@ THREE.ColladaLoader = function () {
 
 
 	};
 	};
 
 
-	InstanceGeometry.prototype.parse = function( element ) {
+	InstanceGeometry.prototype.parse = function ( element ) {
 
 
 		this.url = element.getAttribute('url').replace(/^#/, '');
 		this.url = element.getAttribute('url').replace(/^#/, '');
 		this.instance_material = [];
 		this.instance_material = [];
@@ -1662,7 +1690,7 @@ THREE.ColladaLoader = function () {
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 
 
 			var child = element.childNodes[i];
 			var child = element.childNodes[i];
-			if (child.nodeType != 1) continue;
+			if ( child.nodeType != 1 ) continue;
 
 
 			if ( child.nodeName == 'bind_material' ) {
 			if ( child.nodeName == 'bind_material' ) {
 
 
@@ -1672,7 +1700,7 @@ THREE.ColladaLoader = function () {
 					XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 					XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 					null);
 					null);
 
 
-				if (instances) {
+				if ( instances ) {
 
 
 					var instance = instances.iterateNext();
 					var instance = instances.iterateNext();
 
 
@@ -1718,7 +1746,7 @@ THREE.ColladaLoader = function () {
 					break;
 					break;
 
 
 				case 'extra':
 				case 'extra':
-					
+
 					// console.log( child );
 					// console.log( child );
 					break;
 					break;
 
 
@@ -1748,32 +1776,32 @@ THREE.ColladaLoader = function () {
 
 
 		for ( i = 0; i < element.childNodes.length; i ++ ) {
 		for ( i = 0; i < element.childNodes.length; i ++ ) {
 
 
-			var child = element.childNodes[i];
+			var child = element.childNodes[ i ];
 
 
-			switch (child.nodeName) {
+			switch ( child.nodeName ) {
 
 
 				case 'source':
 				case 'source':
 
 
-					_source(child);
+					_source( child );
 					break;
 					break;
 
 
 				case 'vertices':
 				case 'vertices':
 
 
-					this.vertices = (new Vertices()).parse(child);
+					this.vertices = ( new Vertices() ).parse( child );
 					break;
 					break;
 
 
 				case 'triangles':
 				case 'triangles':
 
 
-					this.primitives.push((new Triangles().parse(child)));
+					this.primitives.push( ( new Triangles().parse( child ) ) );
 					break;
 					break;
 
 
 				case 'polygons':
 				case 'polygons':
 
 
-					console.warn('polygon holes not yet supported!');
+					console.warn( 'polygon holes not yet supported!' );
 
 
 				case 'polylist':
 				case 'polylist':
 
 
-					this.primitives.push((new Polylist().parse(child)));
+					this.primitives.push( ( new Polylist().parse( child ) ) );
 					break;
 					break;
 
 
 				default:
 				default:
@@ -1791,7 +1819,7 @@ THREE.ColladaLoader = function () {
 
 
 			if ( vertex_store[ hash ] === undefined ) {
 			if ( vertex_store[ hash ] === undefined ) {
 
 
-				vertex_store[ hash ] = { v:v, index:index };
+				vertex_store[ hash ] = { v: v, index: index };
 
 
 			}
 			}
 
 
@@ -1805,16 +1833,16 @@ THREE.ColladaLoader = function () {
 
 
 		for ( i = 0, j = 0; i < vertexData.length; i += 3, j ++ ) {
 		for ( i = 0, j = 0; i < vertexData.length; i += 3, j ++ ) {
 
 
-			var v = new THREE.Vertex( new THREE.Vector3( vertexData[i], vertexData[i+1], vertexData[i+2] ) );
-			get_vertex(v, j);
-			this.geometry3js.vertices.push(v);
+			var v = new THREE.Vertex( new THREE.Vector3( vertexData[ i ], vertexData[ i + 1 ], vertexData[ i + 2 ] ) );
+			get_vertex( v, j );
+			this.geometry3js.vertices.push( v );
 
 
 		}
 		}
 
 
 		for ( i = 0; i < this.primitives.length; i ++ ) {
 		for ( i = 0; i < this.primitives.length; i ++ ) {
 
 
-			primitive = this.primitives[i];
-			primitive.setVertices(this.vertices);
+			primitive = this.primitives[ i ];
+			primitive.setVertices( this.vertices );
 			this.handlePrimitive( primitive, this.geometry3js, vertex_store );
 			this.handlePrimitive( primitive, this.geometry3js, vertex_store );
 
 
 		}
 		}
@@ -1837,7 +1865,7 @@ THREE.ColladaLoader = function () {
 
 
 		for ( j = 0; j < inputs.length; j ++ ) {
 		for ( j = 0; j < inputs.length; j ++ ) {
 
 
-			input = inputs[j];
+			input = inputs[ j ];
 
 
 			switch ( input.semantic ) {
 			switch ( input.semantic ) {
 
 
@@ -1866,9 +1894,10 @@ THREE.ColladaLoader = function () {
 
 
 				for ( k = 0; k < inputs.length; k ++ ) {
 				for ( k = 0; k < inputs.length; k ++ ) {
 
 
-					input = inputs[k];
-					source = sources[input.source];
-					index = p[i + (j*inputs.length) + input.offset];
+					input = inputs[ k ];
+					source = sources[ input.source ];
+
+					index = p[ i + ( j * inputs.length ) + input.offset ];
 					numParams = source.accessor.params.length;
 					numParams = source.accessor.params.length;
 					idx32 = index * numParams;
 					idx32 = index * numParams;
 
 
@@ -1876,24 +1905,27 @@ THREE.ColladaLoader = function () {
 
 
 						case 'VERTEX':
 						case 'VERTEX':
 
 
-							var hash = _hash_vector3( geom.vertices[index].position );
-							vs.push(vertex_store[hash].index);
+							var hash = _hash_vector3( geom.vertices[ index ].position );
+							vs.push( vertex_store[ hash ].index );
+
 							break;
 							break;
 
 
 						case 'NORMAL':
 						case 'NORMAL':
 
 
-							ns.push( new THREE.Vector3( source.data[idx32+0], source.data[idx32+1], source.data[idx32+2] ) );
+							ns.push( new THREE.Vector3( source.data[ idx32 ], source.data[ idx32 + 1 ], source.data[ idx32 + 2 ] ) );
+
 							break;
 							break;
 
 
 						case 'TEXCOORD':
 						case 'TEXCOORD':
 
 
-							if (ts[input.set] === undefined) ts[input.set] = [];
-							ts[input.set].push( new THREE.UV( source.data[idx32+0], source.data[idx32+1] ) );
+							if ( ts[ input.set ] === undefined ) ts[ input.set ] = [];
+							ts[ input.set ].push( new THREE.UV( source.data[ idx32 ], source.data[ idx32 + 1 ] ) );
+
 							break;
 							break;
 
 
 						case 'COLOR':
 						case 'COLOR':
-							
-							cs.push( new THREE.Color().setRGB(  source.data[idx32+0], source.data[idx32+1], source.data[idx32+2] ) );
+
+							cs.push( new THREE.Color().setRGB( source.data[ idx32 ], source.data[ idx32 + 1 ], source.data[ idx32 + 2 ] ) );
 
 
 							break;
 							break;
 
 
@@ -1914,7 +1946,7 @@ THREE.ColladaLoader = function () {
 				face = new THREE.Face3( vs[0], vs[1], vs[2], [ ns[0], ns[1], ns[2] ] );
 				face = new THREE.Face3( vs[0], vs[1], vs[2], [ ns[0], ns[1], ns[2] ] );
 
 
 			} else if ( vcount == 4 ) {
 			} else if ( vcount == 4 ) {
-			
+
 				face = new THREE.Face4( vs[0], vs[1], vs[2], vs[3], [ ns[0], ns[1], ns[2], ns[3] ] );
 				face = new THREE.Face4( vs[0], vs[1], vs[2], vs[3], [ ns[0], ns[1], ns[2], ns[3] ] );
 
 
 			}
 			}
@@ -1990,11 +2022,11 @@ THREE.ColladaLoader = function () {
 
 
 	};
 	};
 
 
-	Triangles.prototype.parse = function(element) {
+	Triangles.prototype.parse = function ( element ) {
 
 
 		this.inputs = [];
 		this.inputs = [];
-		this.material = element.getAttribute('material');
-		this.count = _attr_as_int(element, 'count', 0);
+		this.material = element.getAttribute( 'material' );
+		this.count = _attr_as_int( element, 'count', 0 );
 
 
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 
 
@@ -2004,17 +2036,17 @@ THREE.ColladaLoader = function () {
 
 
 				case 'input':
 				case 'input':
 
 
-					this.inputs.push((new Input()).parse(element.childNodes[i]));
+					this.inputs.push( ( new Input() ).parse( element.childNodes[ i ] ) );
 					break;
 					break;
 
 
 				case 'vcount':
 				case 'vcount':
 
 
-					this.vcount = _ints(child.textContent);
+					this.vcount = _ints( child.textContent );
 					break;
 					break;
 
 
 				case 'p':
 				case 'p':
 
 
-					this.p = _ints(child.textContent);
+					this.p = _ints( child.textContent );
 					break;
 					break;
 
 
 				default:
 				default:
@@ -2037,23 +2069,23 @@ THREE.ColladaLoader = function () {
 
 
 	};
 	};
 
 
-	Accessor.prototype.parse = function( element ) {
+	Accessor.prototype.parse = function ( element ) {
 
 
 		this.params = [];
 		this.params = [];
-		this.source = element.getAttribute('source');
-		this.count = _attr_as_int(element, 'count', 0);
-		this.stride = _attr_as_int(element, 'stride', 0);
+		this.source = element.getAttribute( 'source' );
+		this.count = _attr_as_int( element, 'count', 0 );
+		this.stride = _attr_as_int( element, 'stride', 0 );
 
 
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 
 
-			var child = element.childNodes[i];
+			var child = element.childNodes[ i ];
 
 
 			if ( child.nodeName == 'param' ) {
 			if ( child.nodeName == 'param' ) {
 
 
 				var param = {};
 				var param = {};
-				param['name'] = child.getAttribute('name');
-				param['type'] = child.getAttribute('type');
-				this.params.push(param);
+				param[ 'name' ] = child.getAttribute( 'name' );
+				param[ 'type' ] = child.getAttribute( 'type' );
+				this.params.push( param );
 
 
 			}
 			}
 
 
@@ -2133,26 +2165,26 @@ THREE.ColladaLoader = function () {
 
 
 				case 'bool_array':
 				case 'bool_array':
 
 
-					this.data = _bools(child.textContent);
+					this.data = _bools( child.textContent );
 					this.type = child.nodeName;
 					this.type = child.nodeName;
 					break;
 					break;
 
 
 				case 'float_array':
 				case 'float_array':
 
 
-					this.data = _floats(child.textContent);
+					this.data = _floats( child.textContent );
 					this.type = child.nodeName;
 					this.type = child.nodeName;
 					break;
 					break;
 
 
 				case 'int_array':
 				case 'int_array':
 
 
-					this.data = _ints(child.textContent);
+					this.data = _ints( child.textContent );
 					this.type = child.nodeName;
 					this.type = child.nodeName;
 					break;
 					break;
 
 
 				case 'IDREF_array':
 				case 'IDREF_array':
 				case 'Name_array':
 				case 'Name_array':
 
 
-					this.data = _strings(child.textContent);
+					this.data = _strings( child.textContent );
 					this.type = child.nodeName;
 					this.type = child.nodeName;
 					break;
 					break;
 
 
@@ -2160,9 +2192,9 @@ THREE.ColladaLoader = function () {
 
 
 					for ( var j = 0; j < child.childNodes.length; j ++ ) {
 					for ( var j = 0; j < child.childNodes.length; j ++ ) {
 
 
-						if ( child.childNodes[j].nodeName == 'accessor' ) {
+						if ( child.childNodes[ j ].nodeName == 'accessor' ) {
 
 
-							this.accessor = (new Accessor()).parse(child.childNodes[j]);
+							this.accessor = ( new Accessor() ).parse( child.childNodes[ j ] );
 							break;
 							break;
 
 
 						}
 						}
@@ -2187,11 +2219,11 @@ THREE.ColladaLoader = function () {
 
 
 		//for (var i = 0; i < this.accessor.params.length; i++) {
 		//for (var i = 0; i < this.accessor.params.length; i++) {
 
 
-			var param = this.accessor.params[0];
+			var param = this.accessor.params[ 0 ];
 
 
 			//console.log(param.name + " " + param.type);
 			//console.log(param.name + " " + param.type);
 
 
-			switch (param.type) {
+			switch ( param.type ) {
 
 
 				case 'IDREF':
 				case 'IDREF':
 				case 'Name':
 				case 'Name':
@@ -2203,7 +2235,7 @@ THREE.ColladaLoader = function () {
 
 
 					for ( var j = 0; j < this.data.length; j += 16 ) {
 					for ( var j = 0; j < this.data.length; j += 16 ) {
 
 
-						var s = this.data.slice(j, j+16);
+						var s = this.data.slice( j, j + 16 );
 						var m = new THREE.Matrix4();
 						var m = new THREE.Matrix4();
 						m.set(
 						m.set(
 							s[0], s[1], s[2], s[3],
 							s[0], s[1], s[2], s[3],
@@ -2211,7 +2243,7 @@ THREE.ColladaLoader = function () {
 							s[8], s[9], s[10], s[11],
 							s[8], s[9], s[10], s[11],
 							s[12], s[13], s[14], s[15]
 							s[12], s[13], s[14], s[15]
 							);
 							);
-						result.push(m);
+						result.push( m );
 					}
 					}
 
 
 					break;
 					break;
@@ -2239,14 +2271,16 @@ THREE.ColladaLoader = function () {
 
 
 	Material.prototype.parse = function ( element ) {
 	Material.prototype.parse = function ( element ) {
 
 
-		this.id = element.getAttribute('id');
-		this.name = element.getAttribute('name');
+		this.id = element.getAttribute( 'id' );
+		this.name = element.getAttribute( 'name' );
 
 
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 
 
-			if (element.childNodes[i].nodeName == 'instance_effect') {
-				this.instance_effect = (new InstanceEffect()).parse(element.childNodes[i]);
+			if ( element.childNodes[ i ].nodeName == 'instance_effect' ) {
+
+				this.instance_effect = ( new InstanceEffect() ).parse( element.childNodes[ i ] );
 				break;
 				break;
+
 			}
 			}
 
 
 		}
 		}
@@ -2257,8 +2291,8 @@ THREE.ColladaLoader = function () {
 
 
 	function ColorOrTexture () {
 	function ColorOrTexture () {
 
 
-		this.color = new THREE.Color(0);
-		this.color.setRGB(Math.random(), Math.random(), Math.random());
+		this.color = new THREE.Color( 0 );
+		this.color.setRGB( Math.random(), Math.random(), Math.random() );
 		this.color.a = 1.0;
 		this.color.a = 1.0;
 
 
 		this.texture = null;
 		this.texture = null;
@@ -2268,13 +2302,13 @@ THREE.ColladaLoader = function () {
 
 
 	ColorOrTexture.prototype.isColor = function () {
 	ColorOrTexture.prototype.isColor = function () {
 
 
-		return (this.texture == null);
+		return ( this.texture == null );
 
 
 	};
 	};
 
 
 	ColorOrTexture.prototype.isTexture = function () {
 	ColorOrTexture.prototype.isTexture = function () {
 
 
-		return (this.texture != null);
+		return ( this.texture != null );
 
 
 	};
 	};
 
 
@@ -2282,16 +2316,16 @@ THREE.ColladaLoader = function () {
 
 
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 
 
-			var child = element.childNodes[i];
-			if (child.nodeType != 1) continue;
+			var child = element.childNodes[ i ];
+			if ( child.nodeType != 1 ) continue;
 
 
 			switch ( child.nodeName ) {
 			switch ( child.nodeName ) {
 
 
 				case 'color':
 				case 'color':
 
 
-					var rgba = _floats(child.textContent);
+					var rgba = _floats( child.textContent );
 					this.color = new THREE.Color(0);
 					this.color = new THREE.Color(0);
-					this.color.setRGB(rgba[0], rgba[1], rgba[2]);
+					this.color.setRGB( rgba[0], rgba[1], rgba[2] );
 					this.color.a = rgba[3];
 					this.color.a = rgba[3];
 					break;
 					break;
 
 
@@ -2324,10 +2358,10 @@ THREE.ColladaLoader = function () {
 
 
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 
 
-			var child = element.childNodes[i];
-			if (child.nodeType != 1) continue;
+			var child = element.childNodes[ i ];
+			if ( child.nodeType != 1 ) continue;
 
 
-			switch (child.nodeName) {
+			switch ( child.nodeName ) {
 
 
 				case 'ambient':
 				case 'ambient':
 				case 'emission':
 				case 'emission':
@@ -2335,16 +2369,18 @@ THREE.ColladaLoader = function () {
 				case 'specular':
 				case 'specular':
 				case 'transparent':
 				case 'transparent':
 
 
-					this[child.nodeName] = (new ColorOrTexture()).parse(child);
+					this[ child.nodeName ] = ( new ColorOrTexture() ).parse( child );
 					break;
 					break;
 
 
 				case 'shininess':
 				case 'shininess':
 				case 'reflectivity':
 				case 'reflectivity':
 				case 'transparency':
 				case 'transparency':
 
 
-					var f = evaluateXPath(child, ".//dae:float");
-					if (f.length > 0)
-						this[child.nodeName] = parseFloat(f[0].textContent);
+					var f = evaluateXPath( child, ".//dae:float" );
+
+					if ( f.length > 0 )
+						this[ child.nodeName ] = parseFloat( f[ 0 ].textContent );
+
 					break;
 					break;
 
 
 				default:
 				default:
@@ -2381,7 +2417,7 @@ THREE.ColladaLoader = function () {
 
 
 							if ( this.effect.sampler && this.effect.surface ) {
 							if ( this.effect.sampler && this.effect.surface ) {
 
 
-								if (this.effect.sampler.source == this.effect.surface.sid) {
+								if ( this.effect.sampler.source == this.effect.surface.sid ) {
 
 
 									var image = images[this.effect.surface.init_from];
 									var image = images[this.effect.surface.init_from];
 
 
@@ -2394,19 +2430,20 @@ THREE.ColladaLoader = function () {
 										props['map'].repeat.y = -1;
 										props['map'].repeat.y = -1;
 
 
 									}
 									}
+
 								}
 								}
 
 
 							}
 							}
 
 
 						} else {
 						} else {
 
 
-							if (prop == 'diffuse') {
+							if ( prop == 'diffuse' ) {
 
 
-								props['color'] = cot.color.getHex();
+								props[ 'color' ] = cot.color.getHex();
 
 
-							} else if (!transparent) {
+							} else if ( !transparent ) {
 
 
-								props[prop] = cot.color.getHex();
+								props[ prop ] = cot.color.getHex();
 
 
 							}
 							}
 
 
@@ -2419,18 +2456,19 @@ THREE.ColladaLoader = function () {
 				case 'shininess':
 				case 'shininess':
 				case 'reflectivity':
 				case 'reflectivity':
 
 
-					props[prop] = this[prop];
+					props[ prop ] = this[ prop ];
 					break;
 					break;
 
 
 				case 'transparency':
 				case 'transparency':
 
 
 					if ( transparent ) {
 					if ( transparent ) {
 
 
-						props['transparent'] = true;
-						props['opacity'] = this[prop];
+						props[ 'transparent' ] = true;
+						props[ 'opacity' ] = this[ prop ];
 						transparent = true;
 						transparent = true;
 
 
 					}
 					}
+
 					break;
 					break;
 
 
 				default:
 				default:
@@ -2482,8 +2520,8 @@ THREE.ColladaLoader = function () {
 
 
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 
 
-			var child = element.childNodes[i];
-			if (child.nodeType != 1) continue;
+			var child = element.childNodes[ i ];
+			if ( child.nodeType != 1 ) continue;
 
 
 			switch ( child.nodeName ) {
 			switch ( child.nodeName ) {
 
 
@@ -2499,7 +2537,7 @@ THREE.ColladaLoader = function () {
 
 
 				default:
 				default:
 
 
-					console.log("unhandled Surface prop: " + child.nodeName);
+					console.log( "unhandled Surface prop: " + child.nodeName );
 					break;
 					break;
 
 
 			}
 			}
@@ -2529,7 +2567,7 @@ THREE.ColladaLoader = function () {
 			var child = element.childNodes[ i ];
 			var child = element.childNodes[ i ];
 			if ( child.nodeType != 1 ) continue;
 			if ( child.nodeType != 1 ) continue;
 
 
-			switch ( child.nodeName) {
+			switch ( child.nodeName ) {
 
 
 				case 'source':
 				case 'source':
 
 
@@ -2563,7 +2601,7 @@ THREE.ColladaLoader = function () {
 
 
 				default:
 				default:
 
 
-					console.log("unhandled Sampler2D prop: " + child.nodeName);
+					console.log( "unhandled Sampler2D prop: " + child.nodeName );
 					break;
 					break;
 
 
 			}
 			}
@@ -2709,7 +2747,7 @@ THREE.ColladaLoader = function () {
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 
 
 			var child = element.childNodes[i];
 			var child = element.childNodes[i];
-			if (child.nodeType != 1) continue;
+			if ( child.nodeType != 1 ) continue;
 
 
 			switch ( child.nodeName ) {
 			switch ( child.nodeName ) {
 
 
@@ -2976,6 +3014,7 @@ THREE.ColladaLoader = function () {
 		if ( nsPrefix == "dae" ) {
 		if ( nsPrefix == "dae" ) {
 
 
 			return "http://www.collada.org/2005/11/COLLADASchema";
 			return "http://www.collada.org/2005/11/COLLADASchema";
+
 		}
 		}
 
 
 		return null;
 		return null;
@@ -2987,9 +3026,10 @@ THREE.ColladaLoader = function () {
 		var raw = _strings( str );
 		var raw = _strings( str );
 		var data = [];
 		var data = [];
 
 
-		for (var i = 0; i < raw.length; i ++ ) {
+		for ( var i = 0; i < raw.length; i ++ ) {
 
 
 			data.push( (raw[i] == 'true' || raw[i] == '1') ? true : false );
 			data.push( (raw[i] == 'true' || raw[i] == '1') ? true : false );
+
 		}
 		}
 
 
 		return data;
 		return data;