Browse Source

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

alteredq 14 years ago
parent
commit
1f61a03593

+ 145 - 145
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;
 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,y=b.n41,z=b.n42,C=b.n43,A=b.n44,F=c.n11,D=c.n12,
-I=c.n13,P=c.n14,S=c.n21,K=c.n22,H=c.n23,G=c.n24,Y=c.n31,E=c.n32,Q=c.n33,R=c.n34,W=c.n41,X=c.n42,o=c.n43,ea=c.n44;this.n11=e*F+f*S+h*Y+m*W;this.n12=e*D+f*K+h*E+m*X;this.n13=e*I+f*H+h*Q+m*o;this.n14=e*P+f*G+h*R+m*ea;this.n21=k*F+n*S+u*Y+p*W;this.n22=k*D+n*K+u*E+p*X;this.n23=k*I+n*H+u*Q+p*o;this.n24=k*P+n*G+u*R+p*ea;this.n31=v*F+t*S+x*Y+w*W;this.n32=v*D+t*K+x*E+w*X;this.n33=v*I+t*H+x*Q+w*o;this.n34=v*P+t*G+x*R+w*ea;this.n41=y*F+z*S+C*Y+A*W;this.n42=y*D+z*K+C*E+A*X;this.n43=y*I+z*H+C*Q+A*o;this.n44=y*
+J=c.n13,P=c.n14,S=c.n21,I=c.n22,H=c.n23,G=c.n24,Y=c.n31,E=c.n32,Q=c.n33,R=c.n34,W=c.n41,X=c.n42,o=c.n43,ea=c.n44;this.n11=e*F+f*S+h*Y+m*W;this.n12=e*D+f*I+h*E+m*X;this.n13=e*J+f*H+h*Q+m*o;this.n14=e*P+f*G+h*R+m*ea;this.n21=k*F+n*S+u*Y+p*W;this.n22=k*D+n*I+u*E+p*X;this.n23=k*J+n*H+u*Q+p*o;this.n24=k*P+n*G+u*R+p*ea;this.n31=v*F+t*S+x*Y+w*W;this.n32=v*D+t*I+x*E+w*X;this.n33=v*J+t*H+x*Q+w*o;this.n34=v*P+t*G+x*R+w*ea;this.n41=y*F+z*S+C*Y+A*W;this.n42=y*D+z*I+C*E+A*X;this.n43=y*J+z*H+C*Q+A*o;this.n44=y*
 P+z*G+C*R+A*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,y=this.n43,z=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*y-c*n*u*y-f*h*p*y+b*n*p*y+c*h*t*y-b*m*t*y-e*m*u*z+c*k*u*z+e*h*p*z-b*k*p*z-c*h*
 v*z+b*m*v*z},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=
@@ -54,17 +54,17 @@ this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.childr
 c){var e,f,h;e=0;for(f=this.children.length;e<f;e++){h=this.children[e];if(h.name===b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
 this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");
 this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");this.remove(b)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function b(){var b=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=[],y,z,C=[],A,F,D=[],I=[],P=[],S=new THREE.Vector4,K=new THREE.Vector4,
-H=new THREE.Matrix4,G=new THREE.Matrix4,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,Q=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,S.copy(n.position),H.multiplyVector3(S),f.object=n,f.z=S.z,I.push(f)}k&&I.sort(c);return I};this.projectScene=
-function(f,h,m){var o=h.near,I=h.far,V,S,aa,ja,ca,ka,fa,da,U,Z,ga,la,ta,na,ha,qa,ra;F=z=x=v=P.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(V=0;V<6;V++)U=Y[V],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(V=U.length;f<V;f++)if(Z=U[f].object,Z.visible)if(ga=Z.matrixWorld,la=Z.matrixRotationWorld,ta=Z.materials,na=Z.overdraw,n=0,Z instanceof THREE.Mesh){ha=Z.geometry;ja=ha.vertices;qa=ha.faces;ha=ha.faceVertexUvs;S=0;for(aa=ja.length;S<aa;S++)k=b(),k.positionWorld.copy(ja[S].position),ga.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;ja=0;for(S=qa.length;ja<S;ja++){aa=qa[ja];if(aa instanceof THREE.Face3)if(ca=u[aa.a],ka=u[aa.b],fa=u[aa.c],ca.visible&&ka.visible&&fa.visible&&(Z.doubleSided||Z.flipSided!=(fa.positionScreen.x-ca.positionScreen.x)*(ka.positionScreen.y-ca.positionScreen.y)-(fa.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<
-0))da=t[v]=t[v]||new THREE.RenderableFace3,v++,p=da,p.v1.copy(ca),p.v2.copy(ka),p.v3.copy(fa);else continue;else if(aa instanceof THREE.Face4)if(ca=u[aa.a],ka=u[aa.b],fa=u[aa.c],da=u[aa.d],ca.visible&&ka.visible&&fa.visible&&da.visible&&(Z.doubleSided||Z.flipSided!=((da.positionScreen.x-ca.positionScreen.x)*(ka.positionScreen.y-ca.positionScreen.y)-(da.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<0||(ka.positionScreen.x-fa.positionScreen.x)*(da.positionScreen.y-
-fa.positionScreen.y)-(ka.positionScreen.y-fa.positionScreen.y)*(da.positionScreen.x-fa.positionScreen.x)<0)))ra=w[x]=w[x]||new THREE.RenderableFace4,x++,p=ra,p.v1.copy(ca),p.v2.copy(ka),p.v3.copy(fa),p.v4.copy(da);else continue;p.normalWorld.copy(aa.normal);la.multiplyVector3(p.normalWorld);p.centroidWorld.copy(aa.centroid);ga.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);H.multiplyVector3(p.centroidScreen);fa=aa.vertexNormals;ca=0;for(ka=fa.length;ca<ka;ca++)da=p.vertexNormalsWorld[ca],
-da.copy(fa[ca]),la.multiplyVector3(da);ca=0;for(ka=ha.length;ca<ka;ca++)if(ra=ha[ca][ja]){fa=0;for(da=ra.length;fa<da;fa++)p.uvs[ca][fa]=ra[fa]}p.meshMaterials=ta;p.faceMaterials=aa.materials;p.overdraw=na;p.z=p.centroidScreen.z;P.push(p)}}else if(Z instanceof THREE.Line){G.multiply(H,ga);ja=Z.geometry.vertices;ca=b();ca.positionScreen.copy(ja[0].position);G.multiplyVector4(ca.positionScreen);S=1;for(aa=ja.length;S<aa;S++)if(ca=b(),ca.positionScreen.copy(ja[S].position),G.multiplyVector4(ca.positionScreen),
-ka=u[n-2],E.copy(ca.positionScreen),Q.copy(ka.positionScreen),e(E,Q))E.multiplyScalar(1/E.w),Q.multiplyScalar(1/Q.w),ga=C[z]=C[z]||new THREE.RenderableLine,z++,y=ga,y.v1.positionScreen.copy(E),y.v2.positionScreen.copy(Q),y.z=Math.max(E.z,Q.z),y.materials=Z.materials,P.push(y)}else if(Z instanceof THREE.Particle&&(K.set(Z.matrixWorld.n14,Z.matrixWorld.n24,Z.matrixWorld.n34,1),H.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))ga=D[F]=D[F]||new THREE.RenderableParticle,F++,A=ga,A.x=K.x/K.w,A.y=K.y/K.w,A.z=
-K.z,A.rotation=Z.rotation.z,A.scale.x=Z.scale.x*Math.abs(A.x-(K.x+h.projectionMatrix.n11)/(K.w+h.projectionMatrix.n14)),A.scale.y=Z.scale.y*Math.abs(A.y-(K.y+h.projectionMatrix.n22)/(K.w+h.projectionMatrix.n24)),A.materials=Z.materials,P.push(A);m&&P.sort(c);return P}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
+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=[],y,z,C=[],A,F,D=[],J=[],P=[],S=new THREE.Vector4,I=new THREE.Vector4,
+H=new THREE.Matrix4,G=new THREE.Matrix4,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,Q=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=J.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,S.copy(n.position),H.multiplyVector3(S),f.object=n,f.z=S.z,J.push(f)}k&&J.sort(c);return J};this.projectScene=
+function(f,h,m){var o=h.near,J=h.far,V,S,aa,ia,ca,ja,fa,da,U,Z,ga,ka,ta,ma,na,qa,ra;F=z=x=v=P.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(V=0;V<6;V++)U=Y[V],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(V=U.length;f<V;f++)if(Z=U[f].object,Z.visible)if(ga=Z.matrixWorld,ka=Z.matrixRotationWorld,ta=Z.materials,ma=Z.overdraw,n=0,Z instanceof THREE.Mesh){na=Z.geometry;ia=na.vertices;qa=na.faces;na=na.faceVertexUvs;S=0;for(aa=ia.length;S<aa;S++)k=b(),k.positionWorld.copy(ia[S].position),ga.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<J;ia=0;for(S=qa.length;ia<S;ia++){aa=qa[ia];if(aa instanceof THREE.Face3)if(ca=u[aa.a],ja=u[aa.b],fa=u[aa.c],ca.visible&&ja.visible&&fa.visible&&(Z.doubleSided||Z.flipSided!=(fa.positionScreen.x-ca.positionScreen.x)*(ja.positionScreen.y-ca.positionScreen.y)-(fa.positionScreen.y-ca.positionScreen.y)*(ja.positionScreen.x-ca.positionScreen.x)<
+0))da=t[v]=t[v]||new THREE.RenderableFace3,v++,p=da,p.v1.copy(ca),p.v2.copy(ja),p.v3.copy(fa);else continue;else if(aa instanceof THREE.Face4)if(ca=u[aa.a],ja=u[aa.b],fa=u[aa.c],da=u[aa.d],ca.visible&&ja.visible&&fa.visible&&da.visible&&(Z.doubleSided||Z.flipSided!=((da.positionScreen.x-ca.positionScreen.x)*(ja.positionScreen.y-ca.positionScreen.y)-(da.positionScreen.y-ca.positionScreen.y)*(ja.positionScreen.x-ca.positionScreen.x)<0||(ja.positionScreen.x-fa.positionScreen.x)*(da.positionScreen.y-
+fa.positionScreen.y)-(ja.positionScreen.y-fa.positionScreen.y)*(da.positionScreen.x-fa.positionScreen.x)<0)))ra=w[x]=w[x]||new THREE.RenderableFace4,x++,p=ra,p.v1.copy(ca),p.v2.copy(ja),p.v3.copy(fa),p.v4.copy(da);else continue;p.normalWorld.copy(aa.normal);ka.multiplyVector3(p.normalWorld);p.centroidWorld.copy(aa.centroid);ga.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);H.multiplyVector3(p.centroidScreen);fa=aa.vertexNormals;ca=0;for(ja=fa.length;ca<ja;ca++)da=p.vertexNormalsWorld[ca],
+da.copy(fa[ca]),ka.multiplyVector3(da);ca=0;for(ja=na.length;ca<ja;ca++)if(ra=na[ca][ia]){fa=0;for(da=ra.length;fa<da;fa++)p.uvs[ca][fa]=ra[fa]}p.meshMaterials=ta;p.faceMaterials=aa.materials;p.overdraw=ma;p.z=p.centroidScreen.z;P.push(p)}}else if(Z instanceof THREE.Line){G.multiply(H,ga);ia=Z.geometry.vertices;ca=b();ca.positionScreen.copy(ia[0].position);G.multiplyVector4(ca.positionScreen);S=1;for(aa=ia.length;S<aa;S++)if(ca=b(),ca.positionScreen.copy(ia[S].position),G.multiplyVector4(ca.positionScreen),
+ja=u[n-2],E.copy(ca.positionScreen),Q.copy(ja.positionScreen),e(E,Q))E.multiplyScalar(1/E.w),Q.multiplyScalar(1/Q.w),ga=C[z]=C[z]||new THREE.RenderableLine,z++,y=ga,y.v1.positionScreen.copy(E),y.v2.positionScreen.copy(Q),y.z=Math.max(E.z,Q.z),y.materials=Z.materials,P.push(y)}else if(Z instanceof THREE.Particle&&(I.set(Z.matrixWorld.n14,Z.matrixWorld.n24,Z.matrixWorld.n34,1),H.multiplyVector4(I),I.z/=I.w,I.z>0&&I.z<1))ga=D[F]=D[F]||new THREE.RenderableParticle,F++,A=ga,A.x=I.x/I.w,A.y=I.y/I.w,A.z=
+I.z,A.rotation=Z.rotation.z,A.scale.x=Z.scale.x*Math.abs(A.x-(I.x+h.projectionMatrix.n11)/(I.w+h.projectionMatrix.n14)),A.scale.y=Z.scale.y*Math.abs(A.y-(I.y+h.projectionMatrix.n22)/(I.w+h.projectionMatrix.n24)),A.materials=Z.materials,P.push(A);m&&P.sort(c);return P}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),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.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=
@@ -79,8 +79,8 @@ 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=
 Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof
 THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,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;y=p.x-n.x;z=u.y-n.y;C=p.y-n.y;A=u.z-n.z;F=p.z-n.z;D=t.u-v.u;I=x.u-v.u;P=t.v-v.v;S=x.v-v.v;K=1/(D*S-I*P);E.set((S*w-P*y)*K,(S*z-P*C)*K,(S*A-P*F)*K);Q.set((D*y-I*w)*K,(D*C-I*z)*K,(D*F-I*A)*K);G[e].addSelf(E);G[c].addSelf(E);G[f].addSelf(E);Y[e].addSelf(Q);
-Y[c].addSelf(Q);Y[f].addSelf(Q)}var c,e,f,h,m,k,n,u,p,v,t,x,w,y,z,C,A,F,D,I,P,S,K,H,G=[],Y=[],E=new THREE.Vector3,Q=new THREE.Vector3,R=new THREE.Vector3,W=new THREE.Vector3,X=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)G[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",
+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;y=p.x-n.x;z=u.y-n.y;C=p.y-n.y;A=u.z-n.z;F=p.z-n.z;D=t.u-v.u;J=x.u-v.u;P=t.v-v.v;S=x.v-v.v;I=1/(D*S-J*P);E.set((S*w-P*y)*I,(S*z-P*C)*I,(S*A-P*F)*I);Q.set((D*y-J*w)*I,(D*C-J*z)*I,(D*F-J*A)*I);G[e].addSelf(E);G[c].addSelf(E);G[f].addSelf(E);Y[e].addSelf(Q);
+Y[c].addSelf(Q);Y[f].addSelf(Q)}var c,e,f,h,m,k,n,u,p,v,t,x,w,y,z,C,A,F,D,J,P,S,I,H,G=[],Y=[],E=new THREE.Vector3,Q=new THREE.Vector3,R=new THREE.Vector3,W=new THREE.Vector3,X=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)G[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++)X.copy(m.vertexNormals[f]),h=m[o[f]],H=G[h],R.copy(H),R.subSelf(X.multiplyScalar(X.dot(H))).normalize(),W.cross(m.vertexNormals[f],H),h=W.dot(Y[h]),h=h<0?-1:1,m.vertexTangents[f]=new THREE.Vector4(R.x,R.y,R.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},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=
@@ -149,47 +149,47 @@ THREE.Scene.prototype.addChild=function(b){console.warn("DEPRECATED: Scene.addCh
 THREE.Scene.prototype.removeObject=function(b){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(b)};THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,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,y,z;b=c.projectScene(e,f);u=0;for(p=b.length;u<p;u++)if(x=b[u],x instanceof THREE.RenderableParticle){y=x.x*h+h;z=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=y+"px",w.style.top=z+"px"}}};
 THREE.CanvasRenderer=function(b){function c(b){if(C!=b)w.globalAlpha=C=b}function e(b){if(A!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}A=b}}function f(b){if(F!=b)w.strokeStyle=F=b}function h(b){if(D!=b)w.fillStyle=D=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"),y=new THREE.Color(0),z=0,C=1,A=0,F=null,D=null,I=null,P=null,S=null,K,H,G,Y,E=new THREE.RenderableVertex,Q=new THREE.RenderableVertex,R,W,X,o,ea,V,ma,aa,ja,ca,ka,fa,da=new THREE.Color(0),U=new THREE.Color(0),Z=new THREE.Color(0),ga=new THREE.Color(0),la=new THREE.Color(0),ta=[],na,ha,qa,ra,ua,Ca,Ea,za,Ba,Ga,N=new THREE.Rectangle,O=new THREE.Rectangle,M=new THREE.Rectangle,L=!1,ia=new THREE.Color,oa=new THREE.Color,xa=new THREE.Color,va=new THREE.Color,pa=new THREE.Vector3,
+p,v,t,x,w=u.getContext("2d"),y=new THREE.Color(0),z=0,C=1,A=0,F=null,D=null,J=null,P=null,S=null,I,H,G,Y,E=new THREE.RenderableVertex,Q=new THREE.RenderableVertex,R,W,X,o,ea,V,la,aa,ia,ca,ja,fa,da=new THREE.Color(0),U=new THREE.Color(0),Z=new THREE.Color(0),ga=new THREE.Color(0),ka=new THREE.Color(0),ta=[],ma,na,qa,ra,ua,Ca,Ea,za,Ba,Ga,N=new THREE.Rectangle,O=new THREE.Rectangle,M=new THREE.Rectangle,L=!1,ha=new THREE.Color,oa=new THREE.Color,xa=new THREE.Color,va=new THREE.Color,pa=new THREE.Vector3,
 wa,Da,Ka,Aa,Ha,$,b=16;wa=document.createElement("canvas");wa.width=wa.height=2;Da=wa.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Ka=Da.getImageData(0,0,2,2);Aa=Ka.data;Ha=document.createElement("canvas");Ha.width=Ha.height=b;$=Ha.getContext("2d");$.translate(-b/2,-b/2);$.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;N.set(-t,-x,t,x);O.set(-t,-x,t,x);C=1;A=0;S=P=I=D=F=null};this.setClearColor=function(b,e){y.copy(b);z=e;O.set(-t,-x,t,x)};this.setClearColorHex=function(b,e){y.setHex(b);z=e;O.set(-t,-x,t,x)};this.clear=function(){w.setTransform(1,0,0,-1,t,x);O.isEmpty()||(O.minSelf(N),O.inflate(2),z<1&&w.clearRect(Math.floor(O.getX()),Math.floor(O.getY()),Math.floor(O.getWidth()),Math.floor(O.getHeight())),z>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
+u.height=v;N.set(-t,-x,t,x);O.set(-t,-x,t,x);C=1;A=0;S=P=J=D=F=null};this.setClearColor=function(b,e){y.copy(b);z=e;O.set(-t,-x,t,x)};this.setClearColorHex=function(b,e){y.setHex(b);z=e;O.set(-t,-x,t,x)};this.clear=function(){w.setTransform(1,0,0,-1,t,x);O.isEmpty()||(O.minSelf(N),O.inflate(2),z<1&&w.clearRect(Math.floor(O.getX()),Math.floor(O.getY()),Math.floor(O.getWidth()),Math.floor(O.getHeight())),z>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
 255)+","+z+")"),w.fillRect(Math.floor(O.getX()),Math.floor(O.getY()),Math.floor(O.getWidth()),Math.floor(O.getHeight()))),O.empty())};this.render=function(b,u){function p(b){var e,c,f,k=b.lights;oa.setRGB(0,0,0);xa.setRGB(0,0,0);va.setRGB(0,0,0);b=0;for(e=k.length;b<e;b++)c=k[b],f=c.color,c instanceof THREE.AmbientLight?(oa.r+=f.r,oa.g+=f.g,oa.b+=f.b):c instanceof THREE.DirectionalLight?(xa.r+=f.r,xa.g+=f.g,xa.b+=f.b):c instanceof THREE.PointLight&&(va.r+=f.r,va.g+=f.g,va.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 Wa(b,k,m){c(m.opacity);e(m.blending);var o,n,u,p,Fa,v;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)p=
 m.map.image,Fa=p.width>>1,v=p.height>>1,m=k.scale.x*t,u=k.scale.y*x,o=m*Fa,n=u*v,M.set(b.x-o,b.y-n,b.x+o,b.y+n),N.intersects(M)&&(w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(m,-u),w.translate(-Fa,-v),w.drawImage(p,0,0),w.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*t,n=k.scale.y*x,M.set(b.x-o,b.y-n,b.x+o,b.y+n),N.intersects(M)&&(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(P!=b)w.lineCap=P=b;b=m.linejoin;if(S!=b)w.lineJoin=S=b;f(m.color.getContextStyle());w.stroke();M.inflate(m.linewidth*2)}}function z(b,f,k,h,n,t,p,w,x){m.info.render.vertices+=3;m.info.render.faces++;c(w.opacity);e(w.blending);
+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(J!=b)w.lineWidth=J=b;b=m.linecap;if(P!=b)w.lineCap=P=b;b=m.linejoin;if(S!=b)w.lineJoin=S=b;f(m.color.getContextStyle());w.stroke();M.inflate(m.linewidth*2)}}function z(b,f,k,h,n,t,p,w,x){m.info.render.vertices+=3;m.info.render.faces++;c(w.opacity);e(w.blending);
 R=b.positionScreen.x;W=b.positionScreen.y;X=f.positionScreen.x;o=f.positionScreen.y;ea=k.positionScreen.x;V=k.positionScreen.y;A(R,W,X,o,ea,V);if(w instanceof THREE.MeshBasicMaterial)if(w.map)w.map.mapping instanceof THREE.UVMapping&&(ra=p.uvs[0],ab(R,W,X,o,ea,V,ra[h].u,ra[h].v,ra[n].u,ra[n].v,ra[t].u,ra[t].v,w.map));else if(w.envMap){if(w.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,pa.copy(p.vertexNormalsWorld[0]),ua=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,
 Ca=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(p.vertexNormalsWorld[1]),Ea=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,za=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(p.vertexNormalsWorld[2]),Ba=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Ga=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,ab(R,W,X,o,ea,V,ua,Ca,Ea,za,Ba,Ga,w.envMap)}else w.wireframe?F(w.color,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):D(w.color);else if(w instanceof THREE.MeshLambertMaterial)w.map&&!w.wireframe&&
 (w.map.mapping instanceof THREE.UVMapping&&(ra=p.uvs[0],ab(R,W,X,o,ea,V,ra[h].u,ra[h].v,ra[n].u,ra[n].v,ra[t].u,ra[t].v,w.map)),e(THREE.SubtractiveBlending)),L?!w.wireframe&&w.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==3?(U.r=Z.r=ga.r=oa.r,U.g=Z.g=ga.g=oa.g,U.b=Z.b=ga.b=oa.b,v(x,p.v1.positionWorld,p.vertexNormalsWorld[0],U),v(x,p.v2.positionWorld,p.vertexNormalsWorld[1],Z),v(x,p.v3.positionWorld,p.vertexNormalsWorld[2],ga),U.r=Math.max(0,Math.min(w.color.r*U.r,1)),U.g=Math.max(0,Math.min(w.color.g*
-U.g,1)),U.b=Math.max(0,Math.min(w.color.b*U.b,1)),Z.r=Math.max(0,Math.min(w.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(w.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(w.color.b*Z.b,1)),ga.r=Math.max(0,Math.min(w.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(w.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(w.color.b*ga.b,1)),la.r=(Z.r+ga.r)*0.5,la.g=(Z.g+ga.g)*0.5,la.b=(Z.b+ga.b)*0.5,qa=Xa(U,Z,ga,la),Ta(R,W,X,o,ea,V,0,0,1,0,0,1,qa)):(ia.r=oa.r,ia.g=oa.g,ia.b=oa.b,v(x,p.centroidWorld,p.normalWorld,ia),da.r=Math.max(0,
-Math.min(w.color.r*ia.r,1)),da.g=Math.max(0,Math.min(w.color.g*ia.g,1)),da.b=Math.max(0,Math.min(w.color.b*ia.b,1)),w.wireframe?F(da,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):D(da)):w.wireframe?F(w.color,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):D(w.color);else if(w instanceof THREE.MeshDepthMaterial)na=u.near,ha=u.far,U.r=U.g=U.b=1-Pa(b.positionScreen.z,na,ha),Z.r=Z.g=Z.b=1-Pa(f.positionScreen.z,na,ha),ga.r=ga.g=ga.b=1-Pa(k.positionScreen.z,na,ha),la.r=(Z.r+
-ga.r)*0.5,la.g=(Z.g+ga.g)*0.5,la.b=(Z.b+ga.b)*0.5,qa=Xa(U,Z,ga,la),Ta(R,W,X,o,ea,V,0,0,1,0,0,1,qa);else if(w instanceof THREE.MeshNormalMaterial)da.r=Ua(p.normalWorld.x),da.g=Ua(p.normalWorld.y),da.b=Ua(p.normalWorld.z),w.wireframe?F(da,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):D(da)}function C(b,f,k,h,n,w,t,p,x){m.info.render.vertices+=4;m.info.render.faces++;c(p.opacity);e(p.blending);if(p.map||p.envMap)z(b,f,h,0,1,3,t,p,x),z(n,k,w,1,2,3,t,p,x);else if(R=b.positionScreen.x,W=
-b.positionScreen.y,X=f.positionScreen.x,o=f.positionScreen.y,ea=k.positionScreen.x,V=k.positionScreen.y,ma=h.positionScreen.x,aa=h.positionScreen.y,ja=n.positionScreen.x,ca=n.positionScreen.y,ka=w.positionScreen.x,fa=w.positionScreen.y,p instanceof THREE.MeshBasicMaterial)Ya(R,W,X,o,ea,V,ma,aa),p.wireframe?F(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):D(p.color);else if(p instanceof THREE.MeshLambertMaterial)L?!p.wireframe&&p.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==
-4?(U.r=Z.r=ga.r=la.r=oa.r,U.g=Z.g=ga.g=la.g=oa.g,U.b=Z.b=ga.b=la.b=oa.b,v(x,t.v1.positionWorld,t.vertexNormalsWorld[0],U),v(x,t.v2.positionWorld,t.vertexNormalsWorld[1],Z),v(x,t.v4.positionWorld,t.vertexNormalsWorld[3],ga),v(x,t.v3.positionWorld,t.vertexNormalsWorld[2],la),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)),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)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),la.r=Math.max(0,Math.min(p.color.r*la.r,1)),la.g=Math.max(0,Math.min(p.color.g*la.g,1)),la.b=Math.max(0,Math.min(p.color.b*la.b,1)),qa=Xa(U,Z,ga,la),A(R,W,X,o,ma,aa),Ta(R,W,X,o,ma,aa,0,0,1,0,0,1,qa),A(ja,ca,ea,V,ka,fa),Ta(ja,ca,ea,V,ka,fa,1,0,1,1,0,1,qa)):(ia.r=oa.r,ia.g=oa.g,ia.b=oa.b,v(x,t.centroidWorld,t.normalWorld,ia),da.r=Math.max(0,Math.min(p.color.r*ia.r,
-1)),da.g=Math.max(0,Math.min(p.color.g*ia.g,1)),da.b=Math.max(0,Math.min(p.color.b*ia.b,1)),Ya(R,W,X,o,ea,V,ma,aa),p.wireframe?F(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):D(da)):(Ya(R,W,X,o,ea,V,ma,aa),p.wireframe?F(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):D(p.color));else if(p instanceof THREE.MeshNormalMaterial)da.r=Ua(t.normalWorld.x),da.g=Ua(t.normalWorld.y),da.b=Ua(t.normalWorld.z),Ya(R,W,X,o,ea,V,ma,aa),p.wireframe?F(da,p.wireframeLinewidth,
-p.wireframeLinecap,p.wireframeLinejoin):D(da);else if(p instanceof THREE.MeshDepthMaterial)na=u.near,ha=u.far,U.r=U.g=U.b=1-Pa(b.positionScreen.z,na,ha),Z.r=Z.g=Z.b=1-Pa(f.positionScreen.z,na,ha),ga.r=ga.g=ga.b=1-Pa(h.positionScreen.z,na,ha),la.r=la.g=la.b=1-Pa(k.positionScreen.z,na,ha),qa=Xa(U,Z,ga,la),A(R,W,X,o,ma,aa),Ta(R,W,X,o,ma,aa,0,0,1,0,0,1,qa),A(ja,ca,ea,V,ka,fa),Ta(ja,ca,ea,V,ka,fa,1,0,1,1,0,1,qa)}function A(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 Ya(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 F(b,e,c,k){if(I!=e)w.lineWidth=I=e;if(P!=c)w.lineCap=P=c;if(S!=k)w.lineJoin=S=k;f(b.getContextStyle());w.stroke();M.inflate(e*2)}function D(b){h(b.getContextStyle());w.fill()}function ab(b,e,c,f,k,m,o,n,p,t,u,Fa,v){if(v.image.width!=0){if(v.needsUpdate==!0||ta[v.id]==void 0){var x=v.wrapS==THREE.RepeatWrapping,N=v.wrapT==THREE.RepeatWrapping;ta[v.id]=
+U.g,1)),U.b=Math.max(0,Math.min(w.color.b*U.b,1)),Z.r=Math.max(0,Math.min(w.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(w.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(w.color.b*Z.b,1)),ga.r=Math.max(0,Math.min(w.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(w.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(w.color.b*ga.b,1)),ka.r=(Z.r+ga.r)*0.5,ka.g=(Z.g+ga.g)*0.5,ka.b=(Z.b+ga.b)*0.5,qa=Xa(U,Z,ga,ka),Ta(R,W,X,o,ea,V,0,0,1,0,0,1,qa)):(ha.r=oa.r,ha.g=oa.g,ha.b=oa.b,v(x,p.centroidWorld,p.normalWorld,ha),da.r=Math.max(0,
+Math.min(w.color.r*ha.r,1)),da.g=Math.max(0,Math.min(w.color.g*ha.g,1)),da.b=Math.max(0,Math.min(w.color.b*ha.b,1)),w.wireframe?F(da,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):D(da)):w.wireframe?F(w.color,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):D(w.color);else if(w instanceof THREE.MeshDepthMaterial)ma=u.near,na=u.far,U.r=U.g=U.b=1-Pa(b.positionScreen.z,ma,na),Z.r=Z.g=Z.b=1-Pa(f.positionScreen.z,ma,na),ga.r=ga.g=ga.b=1-Pa(k.positionScreen.z,ma,na),ka.r=(Z.r+
+ga.r)*0.5,ka.g=(Z.g+ga.g)*0.5,ka.b=(Z.b+ga.b)*0.5,qa=Xa(U,Z,ga,ka),Ta(R,W,X,o,ea,V,0,0,1,0,0,1,qa);else if(w instanceof THREE.MeshNormalMaterial)da.r=Ua(p.normalWorld.x),da.g=Ua(p.normalWorld.y),da.b=Ua(p.normalWorld.z),w.wireframe?F(da,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):D(da)}function C(b,f,k,h,n,w,t,p,x){m.info.render.vertices+=4;m.info.render.faces++;c(p.opacity);e(p.blending);if(p.map||p.envMap)z(b,f,h,0,1,3,t,p,x),z(n,k,w,1,2,3,t,p,x);else if(R=b.positionScreen.x,W=
+b.positionScreen.y,X=f.positionScreen.x,o=f.positionScreen.y,ea=k.positionScreen.x,V=k.positionScreen.y,la=h.positionScreen.x,aa=h.positionScreen.y,ia=n.positionScreen.x,ca=n.positionScreen.y,ja=w.positionScreen.x,fa=w.positionScreen.y,p instanceof THREE.MeshBasicMaterial)Ya(R,W,X,o,ea,V,la,aa),p.wireframe?F(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):D(p.color);else if(p instanceof THREE.MeshLambertMaterial)L?!p.wireframe&&p.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==
+4?(U.r=Z.r=ga.r=ka.r=oa.r,U.g=Z.g=ga.g=ka.g=oa.g,U.b=Z.b=ga.b=ka.b=oa.b,v(x,t.v1.positionWorld,t.vertexNormalsWorld[0],U),v(x,t.v2.positionWorld,t.vertexNormalsWorld[1],Z),v(x,t.v4.positionWorld,t.vertexNormalsWorld[3],ga),v(x,t.v3.positionWorld,t.vertexNormalsWorld[2],ka),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)),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)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),ka.r=Math.max(0,Math.min(p.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(p.color.g*ka.g,1)),ka.b=Math.max(0,Math.min(p.color.b*ka.b,1)),qa=Xa(U,Z,ga,ka),A(R,W,X,o,la,aa),Ta(R,W,X,o,la,aa,0,0,1,0,0,1,qa),A(ia,ca,ea,V,ja,fa),Ta(ia,ca,ea,V,ja,fa,1,0,1,1,0,1,qa)):(ha.r=oa.r,ha.g=oa.g,ha.b=oa.b,v(x,t.centroidWorld,t.normalWorld,ha),da.r=Math.max(0,Math.min(p.color.r*ha.r,
+1)),da.g=Math.max(0,Math.min(p.color.g*ha.g,1)),da.b=Math.max(0,Math.min(p.color.b*ha.b,1)),Ya(R,W,X,o,ea,V,la,aa),p.wireframe?F(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):D(da)):(Ya(R,W,X,o,ea,V,la,aa),p.wireframe?F(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):D(p.color));else if(p instanceof THREE.MeshNormalMaterial)da.r=Ua(t.normalWorld.x),da.g=Ua(t.normalWorld.y),da.b=Ua(t.normalWorld.z),Ya(R,W,X,o,ea,V,la,aa),p.wireframe?F(da,p.wireframeLinewidth,
+p.wireframeLinecap,p.wireframeLinejoin):D(da);else if(p instanceof THREE.MeshDepthMaterial)ma=u.near,na=u.far,U.r=U.g=U.b=1-Pa(b.positionScreen.z,ma,na),Z.r=Z.g=Z.b=1-Pa(f.positionScreen.z,ma,na),ga.r=ga.g=ga.b=1-Pa(h.positionScreen.z,ma,na),ka.r=ka.g=ka.b=1-Pa(k.positionScreen.z,ma,na),qa=Xa(U,Z,ga,ka),A(R,W,X,o,la,aa),Ta(R,W,X,o,la,aa,0,0,1,0,0,1,qa),A(ia,ca,ea,V,ja,fa),Ta(ia,ca,ea,V,ja,fa,1,0,1,1,0,1,qa)}function A(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 Ya(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 F(b,e,c,k){if(J!=e)w.lineWidth=J=e;if(P!=c)w.lineCap=P=c;if(S!=k)w.lineJoin=S=k;f(b.getContextStyle());w.stroke();M.inflate(e*2)}function D(b){h(b.getContextStyle());w.fill()}function ab(b,e,c,f,k,m,o,n,p,t,u,Fa,v){if(v.image.width!=0){if(v.needsUpdate==!0||ta[v.id]==void 0){var x=v.wrapS==THREE.RepeatWrapping,N=v.wrapT==THREE.RepeatWrapping;ta[v.id]=
 w.createPattern(v.image,x&&N?"repeat":x&&!N?"repeat-x":!x&&N?"repeat-y":"no-repeat");v.needsUpdate=!1}h(ta[v.id]);var x=v.offset.x/v.repeat.x,N=v.offset.y/v.repeat.y,Wa=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,o=(o+x)*Wa,n=(n+N)*v,p=(p+x)*Wa,t=(t+N)*v,u=(u+x)*Wa,Fa=(Fa+N)*v;c-=b;f-=e;k-=b;m-=e;p-=o;t-=n;u-=o;Fa-=n;x=1/(p*Fa-u*t);v=(Fa*c-t*k)*x;t=(Fa*f-t*m)*x;c=(p*k-u*c)*x;f=(p*m-u*f)*x;b=b-v*o-c*n;e=e-t*o-f*n;w.save();w.transform(v,t,c,f,b,e);w.fill();w.restore()}}function Ta(b,
 e,c,f,k,h,m,o,n,p,t,u,Fa){var v,x;v=Fa.width-1;x=Fa.height-1;m*=v;o*=x;n*=v;p*=x;t*=v;u*=x;c-=b;f-=e;k-=b;h-=e;n-=m;p-=o;t-=m;u-=o;x=1/(n*u-t*p);v=(u*c-p*k)*x;p=(u*f-p*h)*x;c=(n*k-t*c)*x;f=(n*h-t*f)*x;b=b-v*m-c*o;e=e-p*m-f*o;w.save();w.transform(v,p,c,f,b,e);w.clip();w.drawImage(Fa,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),p=~~(c.g*255),c=~~(c.b*255),t=~~(f.r*255),w=~~(f.g*255),f=~~(f.b*255);Aa[0]=k<
 0?0:k>255?255:k;Aa[1]=h<0?0:h>255?255:h;Aa[2]=b<0?0:b>255?255:b;Aa[4]=m<0?0:m>255?255:m;Aa[5]=o<0?0:o>255?255:o;Aa[6]=e<0?0:e>255?255:e;Aa[8]=n<0?0:n>255?255:n;Aa[9]=p<0?0:p>255?255:p;Aa[10]=c<0?0:c>255?255:c;Aa[12]=t<0?0:t>255?255:t;Aa[13]=w<0?0:w>255?255:w;Aa[14]=f<0?0:f>255?255:f;Da.putImageData(Ka,0,0);$.drawImage(wa,0,0);return Ha}function Pa(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ua(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Na(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 Za,bb,sa,Ia,Oa,Va,$a,ya;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);(L=b.lights.length>0)&&p(b);Za=0;for(bb=k.length;Za<bb;Za++){sa=k[Za];M.empty();if(sa instanceof THREE.RenderableParticle){K=sa;K.x*=t;K.y*=x;Ia=0;for(Oa=sa.materials.length;Ia<Oa;)ya=sa.materials[Ia++],ya.opacity!=0&&Wa(K,sa,ya,b)}else if(sa instanceof THREE.RenderableLine){if(K=sa.v1,H=sa.v2,
-K.positionScreen.x*=t,K.positionScreen.y*=x,H.positionScreen.x*=t,H.positionScreen.y*=x,M.addPoint(K.positionScreen.x,K.positionScreen.y),M.addPoint(H.positionScreen.x,H.positionScreen.y),N.intersects(M)){Ia=0;for(Oa=sa.materials.length;Ia<Oa;)ya=sa.materials[Ia++],ya.opacity!=0&&y(K,H,sa,ya,b)}}else if(sa instanceof THREE.RenderableFace3){if(K=sa.v1,H=sa.v2,G=sa.v3,K.positionScreen.x*=t,K.positionScreen.y*=x,H.positionScreen.x*=t,H.positionScreen.y*=x,G.positionScreen.x*=t,G.positionScreen.y*=x,
-sa.overdraw&&(Na(K.positionScreen,H.positionScreen),Na(H.positionScreen,G.positionScreen),Na(G.positionScreen,K.positionScreen)),M.add3Points(K.positionScreen.x,K.positionScreen.y,H.positionScreen.x,H.positionScreen.y,G.positionScreen.x,G.positionScreen.y),N.intersects(M)){Ia=0;for(Oa=sa.meshMaterials.length;Ia<Oa;)if(ya=sa.meshMaterials[Ia++],ya instanceof THREE.MeshFaceMaterial){Va=0;for($a=sa.faceMaterials.length;Va<$a;)(ya=sa.faceMaterials[Va++])&&ya.opacity!=0&&z(K,H,G,0,1,2,sa,ya,b)}else ya.opacity!=
-0&&z(K,H,G,0,1,2,sa,ya,b)}}else if(sa instanceof THREE.RenderableFace4&&(K=sa.v1,H=sa.v2,G=sa.v3,Y=sa.v4,K.positionScreen.x*=t,K.positionScreen.y*=x,H.positionScreen.x*=t,H.positionScreen.y*=x,G.positionScreen.x*=t,G.positionScreen.y*=x,Y.positionScreen.x*=t,Y.positionScreen.y*=x,E.positionScreen.copy(H.positionScreen),Q.positionScreen.copy(Y.positionScreen),sa.overdraw&&(Na(K.positionScreen,H.positionScreen),Na(H.positionScreen,Y.positionScreen),Na(Y.positionScreen,K.positionScreen),Na(G.positionScreen,
-E.positionScreen),Na(G.positionScreen,Q.positionScreen)),M.addPoint(K.positionScreen.x,K.positionScreen.y),M.addPoint(H.positionScreen.x,H.positionScreen.y),M.addPoint(G.positionScreen.x,G.positionScreen.y),M.addPoint(Y.positionScreen.x,Y.positionScreen.y),N.intersects(M))){Ia=0;for(Oa=sa.meshMaterials.length;Ia<Oa;)if(ya=sa.meshMaterials[Ia++],ya instanceof THREE.MeshFaceMaterial){Va=0;for($a=sa.faceMaterials.length;Va<$a;)(ya=sa.faceMaterials[Va++])&&ya.opacity!=0&&C(K,H,G,Y,E,Q,sa,ya,b)}else ya.opacity!=
-0&&C(K,H,G,Y,E,Q,sa,ya,b)}O.addRectangle(M)}w.setTransform(1,0,0,1,0,0)}};
+c*=k,f*=k,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Za,bb,sa,Ia,Oa,Va,$a,ya;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);(L=b.lights.length>0)&&p(b);Za=0;for(bb=k.length;Za<bb;Za++){sa=k[Za];M.empty();if(sa instanceof THREE.RenderableParticle){I=sa;I.x*=t;I.y*=x;Ia=0;for(Oa=sa.materials.length;Ia<Oa;)ya=sa.materials[Ia++],ya.opacity!=0&&Wa(I,sa,ya,b)}else if(sa instanceof THREE.RenderableLine){if(I=sa.v1,H=sa.v2,
+I.positionScreen.x*=t,I.positionScreen.y*=x,H.positionScreen.x*=t,H.positionScreen.y*=x,M.addPoint(I.positionScreen.x,I.positionScreen.y),M.addPoint(H.positionScreen.x,H.positionScreen.y),N.intersects(M)){Ia=0;for(Oa=sa.materials.length;Ia<Oa;)ya=sa.materials[Ia++],ya.opacity!=0&&y(I,H,sa,ya,b)}}else if(sa instanceof THREE.RenderableFace3){if(I=sa.v1,H=sa.v2,G=sa.v3,I.positionScreen.x*=t,I.positionScreen.y*=x,H.positionScreen.x*=t,H.positionScreen.y*=x,G.positionScreen.x*=t,G.positionScreen.y*=x,
+sa.overdraw&&(Na(I.positionScreen,H.positionScreen),Na(H.positionScreen,G.positionScreen),Na(G.positionScreen,I.positionScreen)),M.add3Points(I.positionScreen.x,I.positionScreen.y,H.positionScreen.x,H.positionScreen.y,G.positionScreen.x,G.positionScreen.y),N.intersects(M)){Ia=0;for(Oa=sa.meshMaterials.length;Ia<Oa;)if(ya=sa.meshMaterials[Ia++],ya instanceof THREE.MeshFaceMaterial){Va=0;for($a=sa.faceMaterials.length;Va<$a;)(ya=sa.faceMaterials[Va++])&&ya.opacity!=0&&z(I,H,G,0,1,2,sa,ya,b)}else ya.opacity!=
+0&&z(I,H,G,0,1,2,sa,ya,b)}}else if(sa instanceof THREE.RenderableFace4&&(I=sa.v1,H=sa.v2,G=sa.v3,Y=sa.v4,I.positionScreen.x*=t,I.positionScreen.y*=x,H.positionScreen.x*=t,H.positionScreen.y*=x,G.positionScreen.x*=t,G.positionScreen.y*=x,Y.positionScreen.x*=t,Y.positionScreen.y*=x,E.positionScreen.copy(H.positionScreen),Q.positionScreen.copy(Y.positionScreen),sa.overdraw&&(Na(I.positionScreen,H.positionScreen),Na(H.positionScreen,Y.positionScreen),Na(Y.positionScreen,I.positionScreen),Na(G.positionScreen,
+E.positionScreen),Na(G.positionScreen,Q.positionScreen)),M.addPoint(I.positionScreen.x,I.positionScreen.y),M.addPoint(H.positionScreen.x,H.positionScreen.y),M.addPoint(G.positionScreen.x,G.positionScreen.y),M.addPoint(Y.positionScreen.x,Y.positionScreen.y),N.intersects(M))){Ia=0;for(Oa=sa.meshMaterials.length;Ia<Oa;)if(ya=sa.meshMaterials[Ia++],ya instanceof THREE.MeshFaceMaterial){Va=0;for($a=sa.faceMaterials.length;Va<$a;)(ya=sa.faceMaterials[Va++])&&ya.opacity!=0&&C(I,H,G,Y,E,Q,sa,ya,b)}else ya.opacity!=
+0&&C(I,H,G,Y,E,Q,sa,ya,b)}O.addRectangle(M)}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,p){m.info.render.vertices+=3;m.info.render.faces++;R=f(W++);
-R.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?D?(P.r=S.r,P.g=S.g,P.b=S.b,b(p,o,P),I.r=Math.max(0,Math.min(n.color.r*P.r,1)),I.g=Math.max(0,Math.min(n.color.g*P.g,1)),I.b=Math.max(0,Math.min(n.color.b*P.b,1))):I.copy(n.color):n instanceof THREE.MeshDepthMaterial?(G=1-n.__2near/(n.__farPlusNear-
-o.z*n.__farMinusNear),I.setRGB(G,G,G)):n instanceof THREE.MeshNormalMaterial&&I.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?R.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):R.setAttribute("style","fill: "+I.getContextStyle()+"; fill-opacity: "+n.opacity);u.appendChild(R)}function e(e,c,k,o,n,p,t){m.info.render.vertices+=
-4;m.info.render.faces++;R=f(W++);R.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");p instanceof THREE.MeshBasicMaterial?I.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(P.r=S.r,P.g=S.g,P.b=S.b,b(t,n,P),I.r=Math.max(0,Math.min(p.color.r*P.r,1)),I.g=Math.max(0,Math.min(p.color.g*P.g,1)),I.b=Math.max(0,Math.min(p.color.b*P.b,1))):
-I.copy(p.color):p instanceof THREE.MeshDepthMaterial?(G=1-p.__2near/(p.__farPlusNear-n.z*p.__farMinusNear),I.setRGB(G,G,G)):p instanceof THREE.MeshNormalMaterial&&I.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));p.wireframe?R.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):R.setAttribute("style","fill: "+I.getContextStyle()+
-"; fill-opacity: "+p.opacity);u.appendChild(R)}function f(b){E[b]==null&&(E[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&E[b].setAttribute("shape-rendering","crispEdges"));return E[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,y,z,C,A=new THREE.Rectangle,F=new THREE.Rectangle,D=!1,I=new THREE.Color(16777215),P=new THREE.Color(16777215),S=new THREE.Color(0),
-K=new THREE.Color(0),H=new THREE.Color(0),G,Y=new THREE.Vector3,E=[],Q=[],R,W,X,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);A.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,P,E,G,U;this.autoClear&&this.clear();m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,f,this.sortElements);X=W=0;if(D=b.lights.length>0){G=b.lights;S.setRGB(0,0,0);K.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(p=G.length;h<p;h++)v=G[h],I=v.color,v instanceof THREE.AmbientLight?(S.r+=I.r,S.g+=I.g,S.b+=I.b):v instanceof THREE.DirectionalLight?(K.r+=I.r,K.g+=I.g,K.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(G=k[h],F.empty(),G instanceof THREE.RenderableParticle){w=G;w.x*=t;w.y*=-x;v=0;for(I=G.materials.length;v<I;)v++}else if(G instanceof THREE.RenderableLine){if(w=G.v1,y=G.v2,w.positionScreen.x*=t,w.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),A.intersects(F)){v=0;for(I=G.materials.length;v<I;)if((U=G.materials[v++])&&U.opacity!=0){P=w;E=y;var Z=X++;Q[Z]==null&&(Q[Z]=document.createElementNS("http://www.w3.org/2000/svg",
+R.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?J.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(P.r=S.r,P.g=S.g,P.b=S.b,b(p,o,P),J.r=Math.max(0,Math.min(n.color.r*P.r,1)),J.g=Math.max(0,Math.min(n.color.g*P.g,1)),J.b=Math.max(0,Math.min(n.color.b*P.b,1))):J.copy(n.color):n instanceof THREE.MeshDepthMaterial?(G=1-n.__2near/(n.__farPlusNear-
+o.z*n.__farMinusNear),J.setRGB(G,G,G)):n instanceof THREE.MeshNormalMaterial&&J.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?R.setAttribute("style","fill: none; stroke: "+J.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):R.setAttribute("style","fill: "+J.getContextStyle()+"; fill-opacity: "+n.opacity);u.appendChild(R)}function e(e,c,k,o,n,p,t){m.info.render.vertices+=
+4;m.info.render.faces++;R=f(W++);R.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");p instanceof THREE.MeshBasicMaterial?J.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(P.r=S.r,P.g=S.g,P.b=S.b,b(t,n,P),J.r=Math.max(0,Math.min(p.color.r*P.r,1)),J.g=Math.max(0,Math.min(p.color.g*P.g,1)),J.b=Math.max(0,Math.min(p.color.b*P.b,1))):
+J.copy(p.color):p instanceof THREE.MeshDepthMaterial?(G=1-p.__2near/(p.__farPlusNear-n.z*p.__farMinusNear),J.setRGB(G,G,G)):p instanceof THREE.MeshNormalMaterial&&J.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));p.wireframe?R.setAttribute("style","fill: none; stroke: "+J.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):R.setAttribute("style","fill: "+J.getContextStyle()+
+"; fill-opacity: "+p.opacity);u.appendChild(R)}function f(b){E[b]==null&&(E[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&E[b].setAttribute("shape-rendering","crispEdges"));return E[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,y,z,C,A=new THREE.Rectangle,F=new THREE.Rectangle,D=!1,J=new THREE.Color(16777215),P=new THREE.Color(16777215),S=new THREE.Color(0),
+I=new THREE.Color(0),H=new THREE.Color(0),G,Y=new THREE.Vector3,E=[],Q=[],R,W,X,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);A.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,J,P,E,G,U;this.autoClear&&this.clear();m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,f,this.sortElements);X=W=0;if(D=b.lights.length>0){G=b.lights;S.setRGB(0,0,0);I.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(p=G.length;h<p;h++)v=G[h],J=v.color,v instanceof THREE.AmbientLight?(S.r+=J.r,S.g+=J.g,S.b+=J.b):v instanceof THREE.DirectionalLight?(I.r+=J.r,I.g+=J.g,I.b+=J.b):v instanceof THREE.PointLight&&(H.r+=J.r,H.g+=J.g,H.b+=J.b)}h=0;for(p=k.length;h<
+p;h++)if(G=k[h],F.empty(),G instanceof THREE.RenderableParticle){w=G;w.x*=t;w.y*=-x;v=0;for(J=G.materials.length;v<J;)v++}else if(G instanceof THREE.RenderableLine){if(w=G.v1,y=G.v2,w.positionScreen.x*=t,w.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),A.intersects(F)){v=0;for(J=G.materials.length;v<J;)if((U=G.materials[v++])&&U.opacity!=0){P=w;E=y;var Z=X++;Q[Z]==null&&(Q[Z]=document.createElementNS("http://www.w3.org/2000/svg",
 "line"),o==0&&Q[Z].setAttribute("shape-rendering","crispEdges"));R=Q[Z];R.setAttribute("x1",P.positionScreen.x);R.setAttribute("y1",P.positionScreen.y);R.setAttribute("x2",E.positionScreen.x);R.setAttribute("y2",E.positionScreen.y);U instanceof THREE.LineBasicMaterial&&(R.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(R))}}}else if(G instanceof
-THREE.RenderableFace3){if(w=G.v1,y=G.v2,z=G.v3,w.positionScreen.x*=t,w.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),A.intersects(F)){v=0;for(I=G.meshMaterials.length;v<I;)if(U=G.meshMaterials[v++],U instanceof THREE.MeshFaceMaterial){P=0;for(E=G.faceMaterials.length;P<E;)(U=G.faceMaterials[P++])&&
+THREE.RenderableFace3){if(w=G.v1,y=G.v2,z=G.v3,w.positionScreen.x*=t,w.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),A.intersects(F)){v=0;for(J=G.meshMaterials.length;v<J;)if(U=G.meshMaterials[v++],U instanceof THREE.MeshFaceMaterial){P=0;for(E=G.faceMaterials.length;P<E;)(U=G.faceMaterials[P++])&&
 U.opacity!=0&&c(w,y,z,G,U,b)}else U&&U.opacity!=0&&c(w,y,z,G,U,b)}}else if(G instanceof THREE.RenderableFace4&&(w=G.v1,y=G.v2,z=G.v3,C=G.v4,w.positionScreen.x*=t,w.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,C.positionScreen.x*=t,C.positionScreen.y*=-x,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),F.addPoint(C.positionScreen.x,C.positionScreen.y),
-A.intersects(F))){v=0;for(I=G.meshMaterials.length;v<I;)if(U=G.meshMaterials[v++],U instanceof THREE.MeshFaceMaterial){P=0;for(E=G.faceMaterials.length;P<E;)(U=G.faceMaterials[P++])&&U.opacity!=0&&e(w,y,z,C,G,U,b)}else U&&U.opacity!=0&&e(w,y,z,C,G,U,b)}}};
+A.intersects(F))){v=0;for(J=G.meshMaterials.length;v<J;)if(U=G.meshMaterials[v++],U instanceof THREE.MeshFaceMaterial){P=0;for(E=G.faceMaterials.length;P<E;)(U=G.faceMaterials[P++])&&U.opacity!=0&&e(w,y,z,C,G,U,b)}else U&&U.opacity!=0&&e(w,y,z,C,G,U,b)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
@@ -226,8 +226,8 @@ for(f=0;f<t;f++)h=f*3,color=p[v[f][1]],u[h]=color.r,u[h+1]=color.g,u[h+2]=color.
 O.x,f.array[t+1]=O.y,f.array[t+2]=O.z,f.array[t+3]=O.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,w[h]=k.x,w[h+1]=k.y,w[h+2]=k.z;if(N)for(f=0;f<t;f++)color=p[f],h=f*3,u[h]=color.r,u[h+1]=color.g,u[h+2]=color.b;if(y)for(M in y)if(f=y[M],f.__original.needsUpdate){p=f.value.length;for(h=0;h<p;h++){t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")O=f.value[h];f.size===2?(f.array[t]=
 O.x,f.array[t+1]=O.y):f.size===3?f.type==="c"?(f.array[t]=O.r,f.array[t+1]=O.g,f.array[t+2]=O.b):(f.array[t]=O.x,f.array[t+1]=O.y,f.array[t+2]=O.z):(f.array[t]=O.x,f.array[t+1]=O.y,f.array[t+2]=O.z,f.array[t+3]=O.w)}f.offset+=f.size}}}if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,w,e);if(N||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,u,e);if(y)for(M in y)if(f=y[M],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||X.initMaterial(f,e,c,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(X.maxMorphTargets);for(var h=0,m=X.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var n=!1,h=f.program,m=h.uniforms,p=f.uniforms;h!=V&&(o.useProgram(h),V=h,n=!0);if(f.id!=aa)aa=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ea);if(c&&f.fog)if(p.fogColor.value=c.color,c instanceof
-THREE.Fog)p.fogNear.value=c.near,p.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)p.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var t,w,u=0,v=0,x=0,y,O,M,z=Ga,A=z.directional.colors,C=z.directional.positions,F=z.point.colors,D=z.point.positions,I=z.point.distances,na=0,L=0,c=t=M=0,n=e.length;c<n;c++)if(t=e[c],w=t.color,y=t.position,O=t.intensity,M=t.distance,t instanceof THREE.AmbientLight)u+=w.r,v+=w.g,x+=w.b;else if(t instanceof
-THREE.DirectionalLight)M=na*3,A[M]=w.r*O,A[M+1]=w.g*O,A[M+2]=w.b*O,C[M]=y.x,C[M+1]=y.y,C[M+2]=y.z,na+=1;else if(t instanceof THREE.SpotLight)M=na*3,A[M]=w.r*O,A[M+1]=w.g*O,A[M+2]=w.b*O,w=1/y.length(),C[M]=y.x*w,C[M+1]=y.y*w,C[M+2]=y.z*w,na+=1;else if(t instanceof THREE.PointLight)t=L*3,F[t]=w.r*O,F[t+1]=w.g*O,F[t+2]=w.b*O,D[t]=y.x,D[t+1]=y.y,D[t+2]=y.z,I[L]=M,L+=1;c=na*3;for(n=A.length;c<n;c++)A[c]=0;c=L*3;for(n=F.length;c<n;c++)F[c]=0;z.point.length=L;z.directional.length=na;z.ambient[0]=u;z.ambient[1]=
+THREE.Fog)p.fogNear.value=c.near,p.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)p.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var t,w,u=0,v=0,x=0,y,O,M,z=Ga,A=z.directional.colors,C=z.directional.positions,F=z.point.colors,D=z.point.positions,J=z.point.distances,ma=0,L=0,c=t=M=0,n=e.length;c<n;c++)if(t=e[c],w=t.color,y=t.position,O=t.intensity,M=t.distance,t instanceof THREE.AmbientLight)u+=w.r,v+=w.g,x+=w.b;else if(t instanceof
+THREE.DirectionalLight)M=ma*3,A[M]=w.r*O,A[M+1]=w.g*O,A[M+2]=w.b*O,C[M]=y.x,C[M+1]=y.y,C[M+2]=y.z,ma+=1;else if(t instanceof THREE.SpotLight)M=ma*3,A[M]=w.r*O,A[M+1]=w.g*O,A[M+2]=w.b*O,w=1/y.length(),C[M]=y.x*w,C[M+1]=y.y*w,C[M+2]=y.z*w,ma+=1;else if(t instanceof THREE.PointLight)t=L*3,F[t]=w.r*O,F[t+1]=w.g*O,F[t+2]=w.b*O,D[t]=y.x,D[t+1]=y.y,D[t+2]=y.z,J[L]=M,L+=1;c=ma*3;for(n=A.length;c<n;c++)A[c]=0;c=L*3;for(n=F.length;c<n;c++)F[c]=0;z.point.length=L;z.directional.length=ma;z.ambient[0]=u;z.ambient[1]=
 v;z.ambient[2]=x;e=Ga;p.enableLighting.value=e.directional.length+e.point.length;p.ambientLightColor.value=e.ambient;p.directionalLightColor.value=e.directional.colors;p.directionalLightDirection.value=e.directional.positions;p.pointLightColor.value=e.point.colors;p.pointLightPosition.value=e.point.positions;p.pointLightDistance.value=e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)p.diffuse.value=f.color,p.opacity.value=
 f.opacity,(p.map.texture=f.map)&&p.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),p.lightMap.texture=f.lightMap,p.envMap.texture=f.envMap,p.reflectivity.value=f.reflectivity,p.refractionRatio.value=f.refractionRatio,p.combine.value=f.combine,p.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)p.diffuse.value=f.color,p.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)p.psColor.value=
 f.color,p.opacity.value=f.opacity,p.size.value=f.size,p.scale.value=N.height/2,p.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)p.ambient.value=f.ambient,p.specular.value=f.specular,p.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)p.mNear.value=b.near,p.mFar.value=b.far,p.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)p.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&p.shadowMatrix){for(e=0;e<pa.length;e++)p.shadowMatrix.value[e]=
@@ -236,7 +236,7 @@ n);else if(x=="v3v"){if(!u._array)u._array=new Float32Array(3*n.length);x=0;for(
 n),v=u.texture)if(v.image instanceof Array&&v.image.length==6){if(u=v,u.image.length==6)if(u.needsUpdate){if(!u.image.__webglTextureCube)u.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,u.image.__webglTextureCube);for(n=0;n<6;n++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,u.image[n]);H(o.TEXTURE_CUBE_MAP,u,u.image[0]);u.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,u.image.__webglTextureCube)}else v instanceof
 THREE.WebGLRenderTargetCube?(u=v,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,u.__webglTexture)):G(v,n)}else if(x=="tv"){if(!u._array){u._array=[];x=0;for(y=u.texture.length;x<y;x++)u._array[x]=n+x}o.uniform1iv(v,u._array);x=0;for(y=u.texture.length;x<y;x++)(v=u.texture[x])&&G(v,u._array[x])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof
 THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,za);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,za),o.uniformMatrix4fv(m.boneGlobalMatrices,!1,k.boneMatrices))}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&
-m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,f=e(b,c,f,k,m),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=ja&&(ja=f,c=!0);if(!k.morphTargets&&b.position>=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),
+m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,f=e(b,c,f,k,m),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=ia&&(ia=f,c=!0);if(!k.morphTargets&&b.position>=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),
 o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var p=0,t=m.morphTargetForcedOrder,w=m.morphTargetInfluences;p<k.numSupportedMorphTargets&&p<t.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[t[p]]),o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[p]=w[t[p]],p++;else{var t=[],u=-1,
 v=0,w=m.morphTargetInfluences,x,N=w.length,p=0;for(m.morphTargetBase!==-1&&(t[m.morphTargetBase]=!0);p<k.numSupportedMorphTargets;){for(x=0;x<N;x++)!t[x]&&w[x]>u&&(v=x,u=w[v]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[v]);o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[p]=u;t[v]=1;u=-1;p++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=
 0&&(f=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,f.buffer),o.vertexAttribPointer(b[n],f.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,
@@ -245,40 +245,40 @@ o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),o.vertex
 o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),X.info.render.calls++,X.info.render.vertices+=h.__webglFaceCount,X.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),X.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),X.info.render.calls++):
 m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),X.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,p,t,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],p=c[v+4],w=c[v+5],n=c[v+6],t=c[v+7],u=c[v+8],f=(f+m+n)/3,h=(h+p+t)/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(ka!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ka=b.doubleSided;if(fa!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),fa=b.flipSided}function k(b){U!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),U=b)}function n(b){Z!=b&&(o.depthMask(b),Z=b)}function u(b,e,c){ga!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ga=b);if(b&&(la!=e||ta!=c))o.polygonOffset(e,c),la=e,ta=c}function p(b){ua[0].set(b.n41-
+0,b.count);b.count=0}function m(b){if(ja!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ja=b.doubleSided;if(fa!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),fa=b.flipSided}function k(b){U!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),U=b)}function n(b){Z!=b&&(o.depthMask(b),Z=b)}function u(b,e,c){ga!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ga=b);if(b&&(ka!=e||ta!=c))o.polygonOffset(e,c),ka=e,ta=c}function p(b){ua[0].set(b.n41-
 b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ua[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ua[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ua[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ua[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ua[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=ua[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=ua[f].x*e.n14+ua[f].y*e.n24+ua[f].z*e.n34+ua[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 y(b,e){return e.z-b.z}function z(b){var c,n,t,w=0,u,x,N,y,M=b.lights;va||(va=new THREE.Camera(X.shadowCameraFov,X.shadowMapWidth/X.shadowMapHeight,X.shadowCameraNear,X.shadowCameraFar));c=0;for(n=M.length;c<n;c++)if(t=M[c],t instanceof THREE.SpotLight&&t.castShadow){aa=-1;X.shadowMap[w]||(X.shadowMap[w]=new THREE.WebGLRenderTarget(X.shadowMapWidth,X.shadowMapHeight,
-{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[w]||(pa[w]=new THREE.Matrix4);u=X.shadowMap[w];x=pa[w];va.position.copy(t.position);va.target.position.copy(t.target.position);va.update(void 0,!0);b.update(void 0,!1,va);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(va.projectionMatrix);x.multiplySelf(va.matrixWorldInverse);va.matrixWorldInverse.flattenToArray(za);va.projectionMatrix.flattenToArray(Ea);Ca.multiply(va.projectionMatrix,va.matrixWorldInverse);
-p(Ca);X.initWebGLObjects(b);Y(u);o.clearColor(1,1,1,1);X.clear();o.clearColor(ia.r,ia.g,ia.b,oa);x=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(u=0;u<x;u++)N=b.__webglObjects[u],y=N.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||!y.frustumCulled||v(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),A(y,va,!1),N.render=!0):N.render=!1:N.render=!1;k(!0);K(THREE.NormalBlending);for(u=0;u<x;u++)if(N=b.__webglObjects[u],N.render)y=N.object,buffer=N.buffer,m(y),N=y.customDepthMaterial?
-y.customDepthMaterial:y.geometry.morphTargets.length?Ka:Da,f(va,M,null,N,buffer,y);for(u=0;u<t;u++)N=b.__webglObjectsImmediate[u],y=N.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),A(y,va,!1),m(y),program=e(va,M,null,Da,y),y.immediateRenderCallback?y.immediateRenderCallback(program,o,ua):y.render(function(b){h(b,program,Da.shading)}));w++}}function C(b,e){var c,f,h;c=$.attributes;var k=$.uniforms,m=ra/qa,n,p=[],t=qa*0.5,w=ra*0.5,u=!0;o.useProgram($.program);
-V=$.program;ja=U=da=-1;Ja||(o.enableVertexAttribArray($.attributes.position),o.enableVertexAttribArray($.attributes.uv),Ja=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,$.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,$.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Ea);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);c=0;for(f=b.__webglSprites.length;c<
-f;c++)if(h=b.__webglSprites[c],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(y);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-t)/t,(w-h.position.y)/
-w,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?ra:1),p[0]=n*m*h.scale.x,p[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,p),h.mergeWith3D&&!u?(o.enable(o.DEPTH_TEST),u=!0):!h.mergeWith3D&&u&&(o.disable(o.DEPTH_TEST),u=!1),K(h.blending),G(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(Z)}function A(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
-function F(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 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)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 P(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("_")}
+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 y(b,e){return e.z-b.z}function z(b){var c,n,t,w=0,u,x,N,y,M=b.lights;if(!va)va=new THREE.Camera(X.shadowCameraFov,X.shadowMapWidth/X.shadowMapHeight,X.shadowCameraNear,X.shadowCameraFar),va.useTarget=!0;c=0;for(n=M.length;c<n;c++)if(t=M[c],t instanceof THREE.SpotLight&&t.castShadow){aa=-1;X.shadowMap[w]||(X.shadowMap[w]=new THREE.WebGLRenderTarget(X.shadowMapWidth,
+X.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[w]||(pa[w]=new THREE.Matrix4);u=X.shadowMap[w];x=pa[w];va.position.copy(t.position);va.target.position.copy(t.target.position);va.update(void 0,!0);b.update(void 0,!1,va);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(va.projectionMatrix);x.multiplySelf(va.matrixWorldInverse);va.matrixWorldInverse.flattenToArray(za);va.projectionMatrix.flattenToArray(Ea);Ca.multiply(va.projectionMatrix,
+va.matrixWorldInverse);p(Ca);X.initWebGLObjects(b);Y(u);o.clearColor(1,1,1,1);X.clear();o.clearColor(ha.r,ha.g,ha.b,oa);x=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(u=0;u<x;u++)N=b.__webglObjects[u],y=N.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||!y.frustumCulled||v(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),A(y,va,!1),N.render=!0):N.render=!1:N.render=!1;k(!0);I(THREE.NormalBlending);for(u=0;u<x;u++)if(N=b.__webglObjects[u],N.render)y=N.object,buffer=
+N.buffer,m(y),N=y.customDepthMaterial?y.customDepthMaterial:y.geometry.morphTargets.length?Ka:Da,f(va,M,null,N,buffer,y);for(u=0;u<t;u++)N=b.__webglObjectsImmediate[u],y=N.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),A(y,va,!1),m(y),program=e(va,M,null,Da,y),y.immediateRenderCallback?y.immediateRenderCallback(program,o,ua):y.render(function(b){h(b,program,Da.shading)}));w++}}function C(b,e){var c,f,h;c=$.attributes;var k=$.uniforms,m=ra/qa,
+n,p=[],t=qa*0.5,w=ra*0.5,u=!0;o.useProgram($.program);V=$.program;ia=U=da=-1;Ja||(o.enableVertexAttribArray($.attributes.position),o.enableVertexAttribArray($.attributes.uv),Ja=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,$.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,$.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Ea);o.activeTexture(o.TEXTURE0);
+o.uniform1i(k.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)if(h=b.__webglSprites[c],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(y);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,
+(h.position.x-t)/t,(w-h.position.y)/w,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?ra:1),p[0]=n*m*h.scale.x,p[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,p),h.mergeWith3D&&!u?(o.enable(o.DEPTH_TEST),u=!0):!h.mergeWith3D&&u&&(o.disable(o.DEPTH_TEST),u=!1),I(h.blending),G(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(Z)}function A(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function F(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 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)f.attributes[e].needsUpdate=!1}function J(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function P(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,p,t={},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),t[o]==void 0&&(t[o]={hash:o,counter:0}),p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:w}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+m>65535&&(t[o].counter+=1,p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],
-materials:n,vertices:0,numMorphTargets:w})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroups[u].id=ca++,b.geometryGroupsList.push(b.geometryGroups[u])}function S(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=da){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);
+materials:n,vertices:0,numMorphTargets:w})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroups[u].id=ca++,b.geometryGroupsList.push(b.geometryGroups[u])}function S(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function I(b){if(b!=da){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);
 o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}da=b}}function H(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,W(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,W(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,W(e.magFilter)),
 o.texParameteri(b,o.TEXTURE_MIN_FILTER,W(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,R(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,R(e.minFilter)))}function G(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),X.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,W(b.format),b.image.width,b.image.height,0,W(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,W(b.format),b.width,b.height,0,W(b.format),W(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,W(b.format),
 b.width,b.height,0,W(b.format),W(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,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=qa,b=ra,f=na,h=ha);e!=ma&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),ma=e)}function E(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),
+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=qa,b=ra,f=ma,h=na);e!=la&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),la=e)}function E(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 Q(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 R(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function W(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.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 X=this,o,ea=[],V=null,
-ma=null,aa=-1,ja=null,ca=0,ka=null,fa=null,da=null,U=null,Z=null,ga=null,la=null,ta=null,na=0,ha=0,qa=0,ra=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Ea=new Float32Array(16),za=new Float32Array(16),Ba=new THREE.Vector4,Ga={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},N=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-O=b.stencil!==void 0?b.stencil:!0,M=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,L=b.antialias!==void 0?b.antialias:!1,ia=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),oa=b.clearAlpha!==void 0?b.clearAlpha:0,xa=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=N;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=
+la=null,aa=-1,ia=null,ca=0,ja=null,fa=null,da=null,U=null,Z=null,ga=null,ka=null,ta=null,ma=0,na=0,qa=0,ra=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Ea=new Float32Array(16),za=new Float32Array(16),Ba=new THREE.Vector4,Ga={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},N=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
+O=b.stencil!==void 0?b.stencil:!0,M=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),oa=b.clearAlpha!==void 0?b.clearAlpha:0,xa=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=N;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=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 va,pa=[],b=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa}),Ka=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
 uniforms:wa,morphTargets:!0});Da._shadowPass=!0;Ka._shadowPass=!0;try{if(!(o=N.getContext("experimental-webgl",{antialias:L,stencil:O,preserveDrawingBuffer:M})))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(Aa){console.error(Aa)}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(ia.r,ia.g,ia.b,oa);this.context=o;var Ha=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,$={};$.vertices=new Float32Array(16);$.faces=new Uint16Array(6);O=0;$.vertices[O++]=-1;$.vertices[O++]=-1;$.vertices[O++]=0;$.vertices[O++]=1;$.vertices[O++]=1;$.vertices[O++]=-1;$.vertices[O++]=1;$.vertices[O++]=1;$.vertices[O++]=1;$.vertices[O++]=
+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,oa);this.context=o;var Ha=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,$={};$.vertices=new Float32Array(16);$.faces=new Uint16Array(6);O=0;$.vertices[O++]=-1;$.vertices[O++]=-1;$.vertices[O++]=0;$.vertices[O++]=1;$.vertices[O++]=1;$.vertices[O++]=-1;$.vertices[O++]=1;$.vertices[O++]=1;$.vertices[O++]=1;$.vertices[O++]=
 1;$.vertices[O++]=1;$.vertices[O++]=0;$.vertices[O++]=-1;$.vertices[O++]=1;$.vertices[O++]=0;O=$.vertices[O++]=0;$.faces[O++]=0;$.faces[O++]=1;$.faces[O++]=2;$.faces[O++]=0;$.faces[O++]=2;$.faces[O++]=3;$.vertexBuffer=o.createBuffer();$.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,$.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,$.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,$.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,$.faces,o.STATIC_DRAW);$.program=o.createProgram();
 o.attachShader($.program,Q("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader($.program,Q("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram($.program);$.attributes={};$.uniforms={};$.attributes.position=o.getAttribLocation($.program,"position");$.attributes.uv=o.getAttribLocation($.program,"uv");$.uniforms.uvOffset=o.getUniformLocation($.program,"uvOffset");$.uniforms.uvScale=o.getUniformLocation($.program,"uvScale");$.uniforms.rotation=o.getUniformLocation($.program,"rotation");
 $.uniforms.scale=o.getUniformLocation($.program,"scale");$.uniforms.alignment=o.getUniformLocation($.program,"alignment");$.uniforms.color=o.getUniformLocation($.program,"color");$.uniforms.map=o.getUniformLocation($.program,"map");$.uniforms.opacity=o.getUniformLocation($.program,"opacity");$.uniforms.useScreenCoordinates=o.getUniformLocation($.program,"useScreenCoordinates");$.uniforms.affectedByDistance=o.getUniformLocation($.program,"affectedByDistance");$.uniforms.screenPosition=o.getUniformLocation($.program,
-"screenPosition");$.uniforms.modelViewMatrix=o.getUniformLocation($.program,"modelViewMatrix");$.uniforms.projectionMatrix=o.getUniformLocation($.program,"projectionMatrix");var Ja=!1;this.setSize=function(b,e){N.width=b;N.height=e;this.setViewport(0,0,N.width,N.height)};this.setViewport=function(b,e,c,f){na=b;ha=e;qa=c;ra=f;o.viewport(na,ha,qa,ra)};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){ia.setHex(b);oa=e;o.clearColor(ia.r,ia.g,ia.b,oa)};this.setClearColor=function(b,e){ia.copy(b);oa=e;o.clearColor(ia.r,ia.g,ia.b,oa)};this.getClearColor=function(){return ia};this.getClearAlpha=function(){return oa};this.clear=function(b,e,c){var f=0;if(b==void 0||b)f|=o.COLOR_BUFFER_BIT;if(e==void 0||e)f|=o.DEPTH_BUFFER_BIT;if(c==void 0||c)f|=o.STENCIL_BUFFER_BIT;o.clear(f)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,
+"screenPosition");$.uniforms.modelViewMatrix=o.getUniformLocation($.program,"modelViewMatrix");$.uniforms.projectionMatrix=o.getUniformLocation($.program,"projectionMatrix");var Ja=!1;this.setSize=function(b,e){N.width=b;N.height=e;this.setViewport(0,0,N.width,N.height)};this.setViewport=function(b,e,c,f){ma=b;na=e;qa=c;ra=f;o.viewport(ma,na,qa,ra)};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);oa=e;o.clearColor(ha.r,ha.g,ha.b,oa)};this.setClearColor=function(b,e){ha.copy(b);oa=e;o.clearColor(ha.r,ha.g,ha.b,oa)};this.getClearColor=function(){return ha};this.getClearAlpha=function(){return oa};this.clear=function(b,e,c){var f=0;if(b==void 0||b)f|=o.COLOR_BUFFER_BIT;if(e==void 0||e)f|=o.DEPTH_BUFFER_BIT;if(c==void 0||c)f|=o.STENCIL_BUFFER_BIT;o.clear(f)};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);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]);X.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),X.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),
 X.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),X.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),X.info.memory.textures--};this.initMaterial=function(b,e,c,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":
@@ -291,11 +291,11 @@ c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_W
 o.getError()+"]");y.uniforms={};y.attributes={};var N,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(N in p)f.push(N);N=f;f=0;for(p=N.length;f<p;f++)t=N[f],y.uniforms[t]=o.getUniformLocation(y,t);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(N=0;N<c.maxMorphTargets;N++)f.push("morphTarget"+N);for(x in e)f.push(x);
 x=f;N=0;for(e=x.length;N<e;N++)c=x[N],y.attributes[c]=o.getAttribLocation(y,c);y.id=ea.length;ea.push({program:y,code:n});X.info.memory.programs=ea.length;x=y}b.program=x;x=b.program.attributes;x.position>=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);x.tangent>=0&&o.enableVertexAttribArray(x.tangent);b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA),
 o.enableVertexAttribArray(x.skinVertexB),o.enableVertexAttribArray(x.skinIndex),o.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(k in b.attributes)x[k]!==void 0&&x[k]>=0&&o.enableVertexAttribArray(x[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)N="morphTarget"+k,x[N]>=0&&(o.enableVertexAttribArray(x[N]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,e,c,f){Y(b);
-this.clear(e,c,f)};this.render=function(b,c,t,N){var M,O,F,D,I,na,L,H,oa=b.lights,G=b.fog;aa=-1;this.shadowMapEnabled&&z(b,c);X.info.render.calls=0;X.info.render.vertices=0;X.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(za);c.projectionMatrix.flattenToArray(Ea);Ca.multiply(c.projectionMatrix,c.matrixWorldInverse);p(Ca);this.initWebGLObjects(b);Y(t);(this.autoClear||N)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
-I=b.__webglObjects.length;for(N=0;N<I;N++)if(M=b.__webglObjects[N],L=M.object,L.visible)if(!(L instanceof THREE.Mesh)||!L.frustumCulled||v(L)){if(L.matrixWorld.flattenToArray(L._objectMatrixArray),A(L,c,!0),w(M),M.render=!0,this.sortObjects)M.object.renderDepth?M.z=M.object.renderDepth:(Ba.copy(L.position),Ca.multiplyVector3(Ba),M.z=Ba.z)}else M.render=!1;else M.render=!1;this.sortObjects&&b.__webglObjects.sort(y);na=b.__webglObjectsImmediate.length;for(N=0;N<na;N++)M=b.__webglObjectsImmediate[N],
-L=M.object,L.visible&&(L.matrixAutoUpdate&&L.matrixWorld.flattenToArray(L._objectMatrixArray),A(L,c,!0),x(M));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(N=0;N<I;N++)if(M=b.__webglObjects[N],M.render)L=M.object,H=M.buffer,m(L),f(c,oa,G,b.overrideMaterial,H,L);for(N=0;N<na;N++)M=b.__webglObjectsImmediate[N],L=M.object,L.visible&&(m(L),O=e(c,oa,G,b.overrideMaterial,L),L.immediateRenderCallback?L.immediateRenderCallback(O,o,ua):L.render(function(b){h(b,O,
-Da.shading)}))}else{K(THREE.NormalBlending);for(N=I-1;N>=0;N--)if(M=b.__webglObjects[N],M.render){L=M.object;H=M.buffer;F=M.opaque;m(L);for(M=0;M<F.count;M++)D=F.list[M],k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,oa,G,D,H,L)}for(N=0;N<na;N++)if(M=b.__webglObjectsImmediate[N],L=M.object,L.visible){F=M.opaque;m(L);for(M=0;M<F.count;M++)D=F.list[M],k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),O=e(c,
-oa,G,D,L),L.immediateRenderCallback?L.immediateRenderCallback(O,o,ua):L.render(function(b){h(b,O,Da.shading)})}for(N=0;N<I;N++)if(M=b.__webglObjects[N],M.render){L=M.object;H=M.buffer;F=M.transparent;m(L);for(M=0;M<F.count;M++)D=F.list[M],K(D.blending),k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,oa,G,D,H,L)}for(N=0;N<na;N++)if(M=b.__webglObjectsImmediate[N],L=M.object,L.visible){F=M.transparent;m(L);for(M=0;M<F.count;M++)D=F.list[M],K(D.blending),
+this.clear(e,c,f)};this.render=function(b,c,t,N){var M,O,F,D,J,ma,L,H,oa=b.lights,G=b.fog;aa=-1;this.shadowMapEnabled&&z(b,c);X.info.render.calls=0;X.info.render.vertices=0;X.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(za);c.projectionMatrix.flattenToArray(Ea);Ca.multiply(c.projectionMatrix,c.matrixWorldInverse);p(Ca);this.initWebGLObjects(b);Y(t);(this.autoClear||N)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
+J=b.__webglObjects.length;for(N=0;N<J;N++)if(M=b.__webglObjects[N],L=M.object,L.visible)if(!(L instanceof THREE.Mesh)||!L.frustumCulled||v(L)){if(L.matrixWorld.flattenToArray(L._objectMatrixArray),A(L,c,!0),w(M),M.render=!0,this.sortObjects)M.object.renderDepth?M.z=M.object.renderDepth:(Ba.copy(L.position),Ca.multiplyVector3(Ba),M.z=Ba.z)}else M.render=!1;else M.render=!1;this.sortObjects&&b.__webglObjects.sort(y);ma=b.__webglObjectsImmediate.length;for(N=0;N<ma;N++)M=b.__webglObjectsImmediate[N],
+L=M.object,L.visible&&(L.matrixAutoUpdate&&L.matrixWorld.flattenToArray(L._objectMatrixArray),A(L,c,!0),x(M));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);I(b.overrideMaterial.blending);for(N=0;N<J;N++)if(M=b.__webglObjects[N],M.render)L=M.object,H=M.buffer,m(L),f(c,oa,G,b.overrideMaterial,H,L);for(N=0;N<ma;N++)M=b.__webglObjectsImmediate[N],L=M.object,L.visible&&(m(L),O=e(c,oa,G,b.overrideMaterial,L),L.immediateRenderCallback?L.immediateRenderCallback(O,o,ua):L.render(function(b){h(b,O,
+Da.shading)}))}else{I(THREE.NormalBlending);for(N=J-1;N>=0;N--)if(M=b.__webglObjects[N],M.render){L=M.object;H=M.buffer;F=M.opaque;m(L);for(M=0;M<F.count;M++)D=F.list[M],k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,oa,G,D,H,L)}for(N=0;N<ma;N++)if(M=b.__webglObjectsImmediate[N],L=M.object,L.visible){F=M.opaque;m(L);for(M=0;M<F.count;M++)D=F.list[M],k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),O=e(c,
+oa,G,D,L),L.immediateRenderCallback?L.immediateRenderCallback(O,o,ua):L.render(function(b){h(b,O,Da.shading)})}for(N=0;N<J;N++)if(M=b.__webglObjects[N],M.render){L=M.object;H=M.buffer;F=M.transparent;m(L);for(M=0;M<F.count;M++)D=F.list[M],I(D.blending),k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,oa,G,D,H,L)}for(N=0;N<ma;N++)if(M=b.__webglObjectsImmediate[N],L=M.object,L.visible){F=M.transparent;m(L);for(M=0;M<F.count;M++)D=F.list[M],I(D.blending),
 k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),O=e(c,oa,G,D,L),L.immediateRenderCallback?L.immediateRenderCallback(O,o,ua):L.render(function(b){h(b,O,Da.shading)})}}b.__webglSprites.length&&C(b,c);t&&t.minFilter!==THREE.NearestFilter&&t.minFilter!==THREE.LinearFilter&&E(t)};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&&P(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 p=void 0,t=void 0;n.__webglMorphTargetsBuffers=[];p=0;for(t=n.numMorphTargets;p<
@@ -309,27 +309,27 @@ n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.Line){if(k=
 m.__webglColorBuffer=o.createBuffer();X.info.geometries++;m=k;n=e;p=m.vertices.length;m.__vertexArray=new Float32Array(p*3);m.__colorArray=new Float32Array(p*3);m.__sortArray=[];m.__webglParticleCount=p;m.__materials=n.materials;M=y=t=void 0;t=0;for(y=n.materials.length;t<y;t++)if(M=n.materials[t],M.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in M.attributes){originalAttribute=M.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(p*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],S(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(k=e.geometry,S(f.__webglObjects,k,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);
-e.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];f=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)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||e.immediateRenderCallback)&&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,t=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(p=h.geometryGroupsList.length;n<p;n++)if(m=h.geometryGroupsList[n],t=F(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||t)if(t=m,y=o.DYNAMIC_DRAW,M=!h.dynamic,t.__inittedArrays){var C=u=x=void 0,L=void 0,na=C=void 0,H=void 0,oa=void 0,G=void 0,ia=A=z=v=O=N=w=void 0,ha=void 0,K=void 0,
-J=L=G=L=oa=H=void 0,B=void 0,E=B=J=H=void 0,Z=void 0,qa=E=B=J=C=C=na=G=L=E=B=J=Z=E=B=J=Z=E=B=J=void 0,U=0,Q=0,ra=0,V=0,xa=0,$=0,R=0,pa=0,Y=0,T=0,W=0,E=J=0,E=void 0,ga=t.__vertexArray,va=t.__uvArray,ua=t.__uv2Array,la=t.__normalArray,ja=t.__tangentArray,da=t.__colorArray,ca=t.__skinVertexAArray,aa=t.__skinVertexBArray,ea=t.__skinIndexArray,fa=t.__skinWeightArray,Da=t.__morphTargetsArrays,ka=t.__webglCustomAttributes,B=void 0,ta=t.__faceArray,wa=t.__lineArray,Ca=t.__needsSmoothNormals,N=t.__vertexColorType,
-w=t.__uvType,O=t.__normalType,ma=k.geometry,Ea=ma.__dirtyVertices,Aa=ma.__dirtyElements,za=ma.__dirtyUvs,Ha=ma.__dirtyNormals,Ka=ma.__dirtyTangents,Ba=ma.__dirtyColors,Ga=ma.__dirtyMorphTargets,Ja=ma.vertices,cb=t.faces,fb=ma.faces,db=ma.faceVertexUvs[0],eb=ma.faceVertexUvs[1],Qa=ma.skinVerticesA,Ra=ma.skinVerticesB,Sa=ma.skinIndices,Ma=ma.skinWeights,La=ma.morphTargets;if(ka)for(qa in ka)ka[qa].offset=0,ka[qa].offsetSrc=0;x=0;for(u=cb.length;x<u;x++)if(C=cb[x],L=fb[C],db&&(v=db[C]),eb&&(z=eb[C]),
-C=L.vertexNormals,na=L.normal,H=L.vertexColors,oa=L.color,G=L.vertexTangents,L instanceof THREE.Face3){if(Ea)A=Ja[L.a].position,ia=Ja[L.b].position,ha=Ja[L.c].position,ga[Q]=A.x,ga[Q+1]=A.y,ga[Q+2]=A.z,ga[Q+3]=ia.x,ga[Q+4]=ia.y,ga[Q+5]=ia.z,ga[Q+6]=ha.x,ga[Q+7]=ha.y,ga[Q+8]=ha.z,Q+=9;if(ka)for(qa in ka)if(B=ka[qa],B.__original.needsUpdate)J=B.offset,E=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[J]=B.value[L.a],B.array[J+1]=B.value[L.b],B.array[J+2]=B.value[L.c]):B.boundTo===
-"faces"?(E=B.value[E],B.array[J]=E,B.array[J+1]=E,B.array[J+2]=E,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[J]=B.value[E],B.array[J+1]=B.value[E+1],B.array[J+2]=B.value[E+2],B.offsetSrc+=3),B.offset+=3):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[L.a],ia=B.value[L.b],ha=B.value[L.c]):B.boundTo==="faces"?(ha=ia=A=E=B.value[E],B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[E],ia=B.value[E+1],ha=B.value[E+2],B.offsetSrc+=3),B.size===2?(B.array[J]=A.x,B.array[J+1]=A.y,B.array[J+
-2]=ia.x,B.array[J+3]=ia.y,B.array[J+4]=ha.x,B.array[J+5]=ha.y,B.offset+=6):B.size===3?(B.type==="c"?(B.array[J]=A.r,B.array[J+1]=A.g,B.array[J+2]=A.b,B.array[J+3]=ia.r,B.array[J+4]=ia.g,B.array[J+5]=ia.b,B.array[J+6]=ha.r,B.array[J+7]=ha.g,B.array[J+8]=ha.b):(B.array[J]=A.x,B.array[J+1]=A.y,B.array[J+2]=A.z,B.array[J+3]=ia.x,B.array[J+4]=ia.y,B.array[J+5]=ia.z,B.array[J+6]=ha.x,B.array[J+7]=ha.y,B.array[J+8]=ha.z),B.offset+=9):(B.array[J]=A.x,B.array[J+1]=A.y,B.array[J+2]=A.z,B.array[J+3]=A.w,B.array[J+
-4]=ia.x,B.array[J+5]=ia.y,B.array[J+6]=ia.z,B.array[J+7]=ia.w,B.array[J+8]=ha.x,B.array[J+9]=ha.y,B.array[J+10]=ha.z,B.array[J+11]=ha.w,B.offset+=12));if(Ga){J=0;for(B=La.length;J<B;J++)A=La[J].vertices[L.a].position,ia=La[J].vertices[L.b].position,ha=La[J].vertices[L.c].position,E=Da[J],E[W]=A.x,E[W+1]=A.y,E[W+2]=A.z,E[W+3]=ia.x,E[W+4]=ia.y,E[W+5]=ia.z,E[W+6]=ha.x,E[W+7]=ha.y,E[W+8]=ha.z;W+=9}if(Ma.length)J=Ma[L.a],B=Ma[L.b],E=Ma[L.c],fa[T]=J.x,fa[T+1]=J.y,fa[T+2]=J.z,fa[T+3]=J.w,fa[T+4]=B.x,fa[T+
-5]=B.y,fa[T+6]=B.z,fa[T+7]=B.w,fa[T+8]=E.x,fa[T+9]=E.y,fa[T+10]=E.z,fa[T+11]=E.w,J=Sa[L.a],B=Sa[L.b],E=Sa[L.c],ea[T]=J.x,ea[T+1]=J.y,ea[T+2]=J.z,ea[T+3]=J.w,ea[T+4]=B.x,ea[T+5]=B.y,ea[T+6]=B.z,ea[T+7]=B.w,ea[T+8]=E.x,ea[T+9]=E.y,ea[T+10]=E.z,ea[T+11]=E.w,J=Qa[L.a],B=Qa[L.b],E=Qa[L.c],ca[T]=J.x,ca[T+1]=J.y,ca[T+2]=J.z,ca[T+3]=1,ca[T+4]=B.x,ca[T+5]=B.y,ca[T+6]=B.z,ca[T+7]=1,ca[T+8]=E.x,ca[T+9]=E.y,ca[T+10]=E.z,ca[T+11]=1,J=Ra[L.a],B=Ra[L.b],E=Ra[L.c],aa[T]=J.x,aa[T+1]=J.y,aa[T+2]=J.z,aa[T+3]=1,aa[T+
-4]=B.x,aa[T+5]=B.y,aa[T+6]=B.z,aa[T+7]=1,aa[T+8]=E.x,aa[T+9]=E.y,aa[T+10]=E.z,aa[T+11]=1,T+=12;if(Ba&&N)H.length==3&&N==THREE.VertexColors?(L=H[0],J=H[1],B=H[2]):B=J=L=oa,da[Y]=L.r,da[Y+1]=L.g,da[Y+2]=L.b,da[Y+3]=J.r,da[Y+4]=J.g,da[Y+5]=J.b,da[Y+6]=B.r,da[Y+7]=B.g,da[Y+8]=B.b,Y+=9;if(Ka&&ma.hasTangents)H=G[0],oa=G[1],L=G[2],ja[R]=H.x,ja[R+1]=H.y,ja[R+2]=H.z,ja[R+3]=H.w,ja[R+4]=oa.x,ja[R+5]=oa.y,ja[R+6]=oa.z,ja[R+7]=oa.w,ja[R+8]=L.x,ja[R+9]=L.y,ja[R+10]=L.z,ja[R+11]=L.w,R+=12;if(Ha&&O)if(C.length==
-3&&Ca)for(G=0;G<3;G++)na=C[G],la[$]=na.x,la[$+1]=na.y,la[$+2]=na.z,$+=3;else for(G=0;G<3;G++)la[$]=na.x,la[$+1]=na.y,la[$+2]=na.z,$+=3;if(za&&v!==void 0&&w)for(G=0;G<3;G++)C=v[G],va[ra]=C.u,va[ra+1]=C.v,ra+=2;if(za&&z!==void 0&&w)for(G=0;G<3;G++)C=z[G],ua[V]=C.u,ua[V+1]=C.v,V+=2;Aa&&(ta[xa]=U,ta[xa+1]=U+1,ta[xa+2]=U+2,xa+=3,wa[pa]=U,wa[pa+1]=U+1,wa[pa+2]=U,wa[pa+3]=U+2,wa[pa+4]=U+1,wa[pa+5]=U+2,pa+=6,U+=3)}else if(L instanceof THREE.Face4){if(Ea)A=Ja[L.a].position,ia=Ja[L.b].position,ha=Ja[L.c].position,
-K=Ja[L.d].position,ga[Q]=A.x,ga[Q+1]=A.y,ga[Q+2]=A.z,ga[Q+3]=ia.x,ga[Q+4]=ia.y,ga[Q+5]=ia.z,ga[Q+6]=ha.x,ga[Q+7]=ha.y,ga[Q+8]=ha.z,ga[Q+9]=K.x,ga[Q+10]=K.y,ga[Q+11]=K.z,Q+=12;if(ka)for(qa in ka)if(B=ka[qa],B.__original.needsUpdate)J=B.offset,E=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[J]=B.value[L.a],B.array[J+1]=B.value[L.b],B.array[J+2]=B.value[L.c],B.array[J+3]=B.value[L.d]):B.boundTo==="faces"?(E=B.value[E],B.array[J]=E,B.array[J+1]=E,B.array[J+2]=E,B.array[J+
-3]=E,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[J]=B.value[E],B.array[J+1]=B.value[E+1],B.array[J+2]=B.value[E+2],B.array[J+3]=B.value[E+3],B.offsetSrc+=4),B.offset+=4):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[L.a],ia=B.value[L.b],ha=B.value[L.c],K=B.value[L.d]):B.boundTo==="faces"?(K=ha=ia=A=E=B.value[E],B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[E],ia=B.value[E+1],ha=B.value[E+2],K=B.value[E+3],B.offsetSrc+=4),B.size===2?(B.array[J]=A.x,B.array[J+1]=A.y,B.array[J+
-2]=ia.x,B.array[J+3]=ia.y,B.array[J+4]=ha.x,B.array[J+5]=ha.y,B.array[J+6]=K.x,B.array[J+7]=K.y,B.offset+=8):B.size===3?(B.type==="c"?(B.array[J]=A.r,B.array[J+1]=A.g,B.array[J+2]=A.b,B.array[J+3]=ia.r,B.array[J+4]=ia.g,B.array[J+5]=ia.b,B.array[J+6]=ha.r,B.array[J+7]=ha.g,B.array[J+8]=ha.b,B.array[J+9]=K.r,B.array[J+10]=K.g,B.array[J+11]=K.b):(B.array[J]=A.x,B.array[J+1]=A.y,B.array[J+2]=A.z,B.array[J+3]=ia.x,B.array[J+4]=ia.y,B.array[J+5]=ia.z,B.array[J+6]=ha.x,B.array[J+7]=ha.y,B.array[J+8]=ha.z,
-B.array[J+9]=K.x,B.array[J+10]=K.y,B.array[J+11]=K.z),B.offset+=12):(B.array[J]=A.x,B.array[J+1]=A.y,B.array[J+2]=A.z,B.array[J+3]=A.w,B.array[J+4]=ia.x,B.array[J+5]=ia.y,B.array[J+6]=ia.z,B.array[J+7]=ia.w,B.array[J+8]=ha.x,B.array[J+9]=ha.y,B.array[J+10]=ha.z,B.array[J+11]=ha.w,B.array[J+12]=K.x,B.array[J+13]=K.y,B.array[J+14]=K.z,B.array[J+15]=K.w,B.offset+=16));if(Ga){J=0;for(B=La.length;J<B;J++)A=La[J].vertices[L.a].position,ia=La[J].vertices[L.b].position,ha=La[J].vertices[L.c].position,K=La[J].vertices[L.d].position,
-E=Da[J],E[W]=A.x,E[W+1]=A.y,E[W+2]=A.z,E[W+3]=ia.x,E[W+4]=ia.y,E[W+5]=ia.z,E[W+6]=ha.x,E[W+7]=ha.y,E[W+8]=ha.z,E[W+9]=K.x,E[W+10]=K.y,E[W+11]=K.z;W+=12}if(Ma.length)J=Ma[L.a],B=Ma[L.b],E=Ma[L.c],Z=Ma[L.d],fa[T]=J.x,fa[T+1]=J.y,fa[T+2]=J.z,fa[T+3]=J.w,fa[T+4]=B.x,fa[T+5]=B.y,fa[T+6]=B.z,fa[T+7]=B.w,fa[T+8]=E.x,fa[T+9]=E.y,fa[T+10]=E.z,fa[T+11]=E.w,fa[T+12]=Z.x,fa[T+13]=Z.y,fa[T+14]=Z.z,fa[T+15]=Z.w,J=Sa[L.a],B=Sa[L.b],E=Sa[L.c],Z=Sa[L.d],ea[T]=J.x,ea[T+1]=J.y,ea[T+2]=J.z,ea[T+3]=J.w,ea[T+4]=B.x,ea[T+
-5]=B.y,ea[T+6]=B.z,ea[T+7]=B.w,ea[T+8]=E.x,ea[T+9]=E.y,ea[T+10]=E.z,ea[T+11]=E.w,ea[T+12]=Z.x,ea[T+13]=Z.y,ea[T+14]=Z.z,ea[T+15]=Z.w,J=Qa[L.a],B=Qa[L.b],E=Qa[L.c],Z=Qa[L.d],ca[T]=J.x,ca[T+1]=J.y,ca[T+2]=J.z,ca[T+3]=1,ca[T+4]=B.x,ca[T+5]=B.y,ca[T+6]=B.z,ca[T+7]=1,ca[T+8]=E.x,ca[T+9]=E.y,ca[T+10]=E.z,ca[T+11]=1,ca[T+12]=Z.x,ca[T+13]=Z.y,ca[T+14]=Z.z,ca[T+15]=1,J=Ra[L.a],B=Ra[L.b],E=Ra[L.c],L=Ra[L.d],aa[T]=J.x,aa[T+1]=J.y,aa[T+2]=J.z,aa[T+3]=1,aa[T+4]=B.x,aa[T+5]=B.y,aa[T+6]=B.z,aa[T+7]=1,aa[T+8]=E.x,
-aa[T+9]=E.y,aa[T+10]=E.z,aa[T+11]=1,aa[T+12]=L.x,aa[T+13]=L.y,aa[T+14]=L.z,aa[T+15]=1,T+=16;if(Ba&&N)H.length==4&&N==THREE.VertexColors?(L=H[0],J=H[1],B=H[2],H=H[3]):H=B=J=L=oa,da[Y]=L.r,da[Y+1]=L.g,da[Y+2]=L.b,da[Y+3]=J.r,da[Y+4]=J.g,da[Y+5]=J.b,da[Y+6]=B.r,da[Y+7]=B.g,da[Y+8]=B.b,da[Y+9]=H.r,da[Y+10]=H.g,da[Y+11]=H.b,Y+=12;if(Ka&&ma.hasTangents)H=G[0],oa=G[1],L=G[2],G=G[3],ja[R]=H.x,ja[R+1]=H.y,ja[R+2]=H.z,ja[R+3]=H.w,ja[R+4]=oa.x,ja[R+5]=oa.y,ja[R+6]=oa.z,ja[R+7]=oa.w,ja[R+8]=L.x,ja[R+9]=L.y,ja[R+
-10]=L.z,ja[R+11]=L.w,ja[R+12]=G.x,ja[R+13]=G.y,ja[R+14]=G.z,ja[R+15]=G.w,R+=16;if(Ha&&O)if(C.length==4&&Ca)for(G=0;G<4;G++)na=C[G],la[$]=na.x,la[$+1]=na.y,la[$+2]=na.z,$+=3;else for(G=0;G<4;G++)la[$]=na.x,la[$+1]=na.y,la[$+2]=na.z,$+=3;if(za&&v!==void 0&&w)for(G=0;G<4;G++)C=v[G],va[ra]=C.u,va[ra+1]=C.v,ra+=2;if(za&&z!==void 0&&w)for(G=0;G<4;G++)C=z[G],ua[V]=C.u,ua[V+1]=C.v,V+=2;Aa&&(ta[xa]=U,ta[xa+1]=U+1,ta[xa+2]=U+3,ta[xa+3]=U+1,ta[xa+4]=U+2,ta[xa+5]=U+3,xa+=6,wa[pa]=U,wa[pa+1]=U+1,wa[pa+2]=U,wa[pa+
-3]=U+3,wa[pa+4]=U+1,wa[pa+5]=U+2,wa[pa+6]=U+2,wa[pa+7]=U+3,pa+=8,U+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,ga,y));if(ka)for(qa in ka)B=ka[qa],B.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,B.buffer),o.bufferData(o.ARRAY_BUFFER,B.array,y));if(Ga){J=0;for(B=La.length;J<B;J++)o.bindBuffer(o.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[J]),o.bufferData(o.ARRAY_BUFFER,Da[J],y)}Ba&&Y>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,
-da,y));Ha&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,la,y));Ka&&ma.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ja,y));za&&ra>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,va,y));za&&V>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ua,y));Aa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ta,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,
+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)J(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;k=void 0;for(k=f.length-1;k>=0;k--)f[k]==h&&f.splice(k,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&J(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,t=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(p=h.geometryGroupsList.length;n<p;n++)if(m=h.geometryGroupsList[n],t=F(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||t)if(t=m,y=o.DYNAMIC_DRAW,M=!h.dynamic,t.__inittedArrays){var C=u=x=void 0,L=void 0,ma=C=void 0,H=void 0,oa=void 0,G=void 0,ha=A=z=v=O=N=w=void 0,I=void 0,na=void 0,
+K=L=G=L=oa=H=void 0,B=void 0,E=B=K=H=void 0,Z=void 0,qa=E=B=K=C=C=ma=G=L=E=B=K=Z=E=B=K=Z=E=B=K=void 0,U=0,Q=0,ra=0,V=0,xa=0,$=0,R=0,pa=0,Y=0,T=0,W=0,E=K=0,E=void 0,ga=t.__vertexArray,va=t.__uvArray,ua=t.__uv2Array,ka=t.__normalArray,ia=t.__tangentArray,da=t.__colorArray,ca=t.__skinVertexAArray,aa=t.__skinVertexBArray,ea=t.__skinIndexArray,fa=t.__skinWeightArray,Da=t.__morphTargetsArrays,ja=t.__webglCustomAttributes,B=void 0,ta=t.__faceArray,wa=t.__lineArray,Ca=t.__needsSmoothNormals,N=t.__vertexColorType,
+w=t.__uvType,O=t.__normalType,la=k.geometry,Ea=la.__dirtyVertices,Aa=la.__dirtyElements,za=la.__dirtyUvs,Ha=la.__dirtyNormals,Ka=la.__dirtyTangents,Ba=la.__dirtyColors,Ga=la.__dirtyMorphTargets,Ja=la.vertices,cb=t.faces,fb=la.faces,db=la.faceVertexUvs[0],eb=la.faceVertexUvs[1],Qa=la.skinVerticesA,Ra=la.skinVerticesB,Sa=la.skinIndices,Ma=la.skinWeights,La=la.morphTargets;if(ja)for(qa in ja)ja[qa].offset=0,ja[qa].offsetSrc=0;x=0;for(u=cb.length;x<u;x++)if(C=cb[x],L=fb[C],db&&(v=db[C]),eb&&(z=eb[C]),
+C=L.vertexNormals,ma=L.normal,H=L.vertexColors,oa=L.color,G=L.vertexTangents,L instanceof THREE.Face3){if(Ea)A=Ja[L.a].position,ha=Ja[L.b].position,I=Ja[L.c].position,ga[Q]=A.x,ga[Q+1]=A.y,ga[Q+2]=A.z,ga[Q+3]=ha.x,ga[Q+4]=ha.y,ga[Q+5]=ha.z,ga[Q+6]=I.x,ga[Q+7]=I.y,ga[Q+8]=I.z,Q+=9;if(ja)for(qa in ja)if(B=ja[qa],B.__original.needsUpdate)K=B.offset,E=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[K]=B.value[L.a],B.array[K+1]=B.value[L.b],B.array[K+2]=B.value[L.c]):B.boundTo===
+"faces"?(E=B.value[E],B.array[K]=E,B.array[K+1]=E,B.array[K+2]=E,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[K]=B.value[E],B.array[K+1]=B.value[E+1],B.array[K+2]=B.value[E+2],B.offsetSrc+=3),B.offset+=3):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[L.a],ha=B.value[L.b],I=B.value[L.c]):B.boundTo==="faces"?(I=ha=A=E=B.value[E],B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[E],ha=B.value[E+1],I=B.value[E+2],B.offsetSrc+=3),B.size===2?(B.array[K]=A.x,B.array[K+1]=A.y,B.array[K+
+2]=ha.x,B.array[K+3]=ha.y,B.array[K+4]=I.x,B.array[K+5]=I.y,B.offset+=6):B.size===3?(B.type==="c"?(B.array[K]=A.r,B.array[K+1]=A.g,B.array[K+2]=A.b,B.array[K+3]=ha.r,B.array[K+4]=ha.g,B.array[K+5]=ha.b,B.array[K+6]=I.r,B.array[K+7]=I.g,B.array[K+8]=I.b):(B.array[K]=A.x,B.array[K+1]=A.y,B.array[K+2]=A.z,B.array[K+3]=ha.x,B.array[K+4]=ha.y,B.array[K+5]=ha.z,B.array[K+6]=I.x,B.array[K+7]=I.y,B.array[K+8]=I.z),B.offset+=9):(B.array[K]=A.x,B.array[K+1]=A.y,B.array[K+2]=A.z,B.array[K+3]=A.w,B.array[K+4]=
+ha.x,B.array[K+5]=ha.y,B.array[K+6]=ha.z,B.array[K+7]=ha.w,B.array[K+8]=I.x,B.array[K+9]=I.y,B.array[K+10]=I.z,B.array[K+11]=I.w,B.offset+=12));if(Ga){K=0;for(B=La.length;K<B;K++)A=La[K].vertices[L.a].position,ha=La[K].vertices[L.b].position,I=La[K].vertices[L.c].position,E=Da[K],E[W]=A.x,E[W+1]=A.y,E[W+2]=A.z,E[W+3]=ha.x,E[W+4]=ha.y,E[W+5]=ha.z,E[W+6]=I.x,E[W+7]=I.y,E[W+8]=I.z;W+=9}if(Ma.length)K=Ma[L.a],B=Ma[L.b],E=Ma[L.c],fa[T]=K.x,fa[T+1]=K.y,fa[T+2]=K.z,fa[T+3]=K.w,fa[T+4]=B.x,fa[T+5]=B.y,fa[T+
+6]=B.z,fa[T+7]=B.w,fa[T+8]=E.x,fa[T+9]=E.y,fa[T+10]=E.z,fa[T+11]=E.w,K=Sa[L.a],B=Sa[L.b],E=Sa[L.c],ea[T]=K.x,ea[T+1]=K.y,ea[T+2]=K.z,ea[T+3]=K.w,ea[T+4]=B.x,ea[T+5]=B.y,ea[T+6]=B.z,ea[T+7]=B.w,ea[T+8]=E.x,ea[T+9]=E.y,ea[T+10]=E.z,ea[T+11]=E.w,K=Qa[L.a],B=Qa[L.b],E=Qa[L.c],ca[T]=K.x,ca[T+1]=K.y,ca[T+2]=K.z,ca[T+3]=1,ca[T+4]=B.x,ca[T+5]=B.y,ca[T+6]=B.z,ca[T+7]=1,ca[T+8]=E.x,ca[T+9]=E.y,ca[T+10]=E.z,ca[T+11]=1,K=Ra[L.a],B=Ra[L.b],E=Ra[L.c],aa[T]=K.x,aa[T+1]=K.y,aa[T+2]=K.z,aa[T+3]=1,aa[T+4]=B.x,aa[T+
+5]=B.y,aa[T+6]=B.z,aa[T+7]=1,aa[T+8]=E.x,aa[T+9]=E.y,aa[T+10]=E.z,aa[T+11]=1,T+=12;if(Ba&&N)H.length==3&&N==THREE.VertexColors?(L=H[0],K=H[1],B=H[2]):B=K=L=oa,da[Y]=L.r,da[Y+1]=L.g,da[Y+2]=L.b,da[Y+3]=K.r,da[Y+4]=K.g,da[Y+5]=K.b,da[Y+6]=B.r,da[Y+7]=B.g,da[Y+8]=B.b,Y+=9;if(Ka&&la.hasTangents)H=G[0],oa=G[1],L=G[2],ia[R]=H.x,ia[R+1]=H.y,ia[R+2]=H.z,ia[R+3]=H.w,ia[R+4]=oa.x,ia[R+5]=oa.y,ia[R+6]=oa.z,ia[R+7]=oa.w,ia[R+8]=L.x,ia[R+9]=L.y,ia[R+10]=L.z,ia[R+11]=L.w,R+=12;if(Ha&&O)if(C.length==3&&Ca)for(G=
+0;G<3;G++)ma=C[G],ka[$]=ma.x,ka[$+1]=ma.y,ka[$+2]=ma.z,$+=3;else for(G=0;G<3;G++)ka[$]=ma.x,ka[$+1]=ma.y,ka[$+2]=ma.z,$+=3;if(za&&v!==void 0&&w)for(G=0;G<3;G++)C=v[G],va[ra]=C.u,va[ra+1]=C.v,ra+=2;if(za&&z!==void 0&&w)for(G=0;G<3;G++)C=z[G],ua[V]=C.u,ua[V+1]=C.v,V+=2;Aa&&(ta[xa]=U,ta[xa+1]=U+1,ta[xa+2]=U+2,xa+=3,wa[pa]=U,wa[pa+1]=U+1,wa[pa+2]=U,wa[pa+3]=U+2,wa[pa+4]=U+1,wa[pa+5]=U+2,pa+=6,U+=3)}else if(L instanceof THREE.Face4){if(Ea)A=Ja[L.a].position,ha=Ja[L.b].position,I=Ja[L.c].position,na=Ja[L.d].position,
+ga[Q]=A.x,ga[Q+1]=A.y,ga[Q+2]=A.z,ga[Q+3]=ha.x,ga[Q+4]=ha.y,ga[Q+5]=ha.z,ga[Q+6]=I.x,ga[Q+7]=I.y,ga[Q+8]=I.z,ga[Q+9]=na.x,ga[Q+10]=na.y,ga[Q+11]=na.z,Q+=12;if(ja)for(qa in ja)if(B=ja[qa],B.__original.needsUpdate)K=B.offset,E=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[K]=B.value[L.a],B.array[K+1]=B.value[L.b],B.array[K+2]=B.value[L.c],B.array[K+3]=B.value[L.d]):B.boundTo==="faces"?(E=B.value[E],B.array[K]=E,B.array[K+1]=E,B.array[K+2]=E,B.array[K+3]=E,B.offsetSrc++):
+B.boundTo==="faceVertices"&&(B.array[K]=B.value[E],B.array[K+1]=B.value[E+1],B.array[K+2]=B.value[E+2],B.array[K+3]=B.value[E+3],B.offsetSrc+=4),B.offset+=4):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[L.a],ha=B.value[L.b],I=B.value[L.c],na=B.value[L.d]):B.boundTo==="faces"?(na=I=ha=A=E=B.value[E],B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[E],ha=B.value[E+1],I=B.value[E+2],na=B.value[E+3],B.offsetSrc+=4),B.size===2?(B.array[K]=A.x,B.array[K+1]=A.y,B.array[K+2]=ha.x,B.array[K+
+3]=ha.y,B.array[K+4]=I.x,B.array[K+5]=I.y,B.array[K+6]=na.x,B.array[K+7]=na.y,B.offset+=8):B.size===3?(B.type==="c"?(B.array[K]=A.r,B.array[K+1]=A.g,B.array[K+2]=A.b,B.array[K+3]=ha.r,B.array[K+4]=ha.g,B.array[K+5]=ha.b,B.array[K+6]=I.r,B.array[K+7]=I.g,B.array[K+8]=I.b,B.array[K+9]=na.r,B.array[K+10]=na.g,B.array[K+11]=na.b):(B.array[K]=A.x,B.array[K+1]=A.y,B.array[K+2]=A.z,B.array[K+3]=ha.x,B.array[K+4]=ha.y,B.array[K+5]=ha.z,B.array[K+6]=I.x,B.array[K+7]=I.y,B.array[K+8]=I.z,B.array[K+9]=na.x,
+B.array[K+10]=na.y,B.array[K+11]=na.z),B.offset+=12):(B.array[K]=A.x,B.array[K+1]=A.y,B.array[K+2]=A.z,B.array[K+3]=A.w,B.array[K+4]=ha.x,B.array[K+5]=ha.y,B.array[K+6]=ha.z,B.array[K+7]=ha.w,B.array[K+8]=I.x,B.array[K+9]=I.y,B.array[K+10]=I.z,B.array[K+11]=I.w,B.array[K+12]=na.x,B.array[K+13]=na.y,B.array[K+14]=na.z,B.array[K+15]=na.w,B.offset+=16));if(Ga){K=0;for(B=La.length;K<B;K++)A=La[K].vertices[L.a].position,ha=La[K].vertices[L.b].position,I=La[K].vertices[L.c].position,na=La[K].vertices[L.d].position,
+E=Da[K],E[W]=A.x,E[W+1]=A.y,E[W+2]=A.z,E[W+3]=ha.x,E[W+4]=ha.y,E[W+5]=ha.z,E[W+6]=I.x,E[W+7]=I.y,E[W+8]=I.z,E[W+9]=na.x,E[W+10]=na.y,E[W+11]=na.z;W+=12}if(Ma.length)K=Ma[L.a],B=Ma[L.b],E=Ma[L.c],Z=Ma[L.d],fa[T]=K.x,fa[T+1]=K.y,fa[T+2]=K.z,fa[T+3]=K.w,fa[T+4]=B.x,fa[T+5]=B.y,fa[T+6]=B.z,fa[T+7]=B.w,fa[T+8]=E.x,fa[T+9]=E.y,fa[T+10]=E.z,fa[T+11]=E.w,fa[T+12]=Z.x,fa[T+13]=Z.y,fa[T+14]=Z.z,fa[T+15]=Z.w,K=Sa[L.a],B=Sa[L.b],E=Sa[L.c],Z=Sa[L.d],ea[T]=K.x,ea[T+1]=K.y,ea[T+2]=K.z,ea[T+3]=K.w,ea[T+4]=B.x,ea[T+
+5]=B.y,ea[T+6]=B.z,ea[T+7]=B.w,ea[T+8]=E.x,ea[T+9]=E.y,ea[T+10]=E.z,ea[T+11]=E.w,ea[T+12]=Z.x,ea[T+13]=Z.y,ea[T+14]=Z.z,ea[T+15]=Z.w,K=Qa[L.a],B=Qa[L.b],E=Qa[L.c],Z=Qa[L.d],ca[T]=K.x,ca[T+1]=K.y,ca[T+2]=K.z,ca[T+3]=1,ca[T+4]=B.x,ca[T+5]=B.y,ca[T+6]=B.z,ca[T+7]=1,ca[T+8]=E.x,ca[T+9]=E.y,ca[T+10]=E.z,ca[T+11]=1,ca[T+12]=Z.x,ca[T+13]=Z.y,ca[T+14]=Z.z,ca[T+15]=1,K=Ra[L.a],B=Ra[L.b],E=Ra[L.c],L=Ra[L.d],aa[T]=K.x,aa[T+1]=K.y,aa[T+2]=K.z,aa[T+3]=1,aa[T+4]=B.x,aa[T+5]=B.y,aa[T+6]=B.z,aa[T+7]=1,aa[T+8]=E.x,
+aa[T+9]=E.y,aa[T+10]=E.z,aa[T+11]=1,aa[T+12]=L.x,aa[T+13]=L.y,aa[T+14]=L.z,aa[T+15]=1,T+=16;if(Ba&&N)H.length==4&&N==THREE.VertexColors?(L=H[0],K=H[1],B=H[2],H=H[3]):H=B=K=L=oa,da[Y]=L.r,da[Y+1]=L.g,da[Y+2]=L.b,da[Y+3]=K.r,da[Y+4]=K.g,da[Y+5]=K.b,da[Y+6]=B.r,da[Y+7]=B.g,da[Y+8]=B.b,da[Y+9]=H.r,da[Y+10]=H.g,da[Y+11]=H.b,Y+=12;if(Ka&&la.hasTangents)H=G[0],oa=G[1],L=G[2],G=G[3],ia[R]=H.x,ia[R+1]=H.y,ia[R+2]=H.z,ia[R+3]=H.w,ia[R+4]=oa.x,ia[R+5]=oa.y,ia[R+6]=oa.z,ia[R+7]=oa.w,ia[R+8]=L.x,ia[R+9]=L.y,ia[R+
+10]=L.z,ia[R+11]=L.w,ia[R+12]=G.x,ia[R+13]=G.y,ia[R+14]=G.z,ia[R+15]=G.w,R+=16;if(Ha&&O)if(C.length==4&&Ca)for(G=0;G<4;G++)ma=C[G],ka[$]=ma.x,ka[$+1]=ma.y,ka[$+2]=ma.z,$+=3;else for(G=0;G<4;G++)ka[$]=ma.x,ka[$+1]=ma.y,ka[$+2]=ma.z,$+=3;if(za&&v!==void 0&&w)for(G=0;G<4;G++)C=v[G],va[ra]=C.u,va[ra+1]=C.v,ra+=2;if(za&&z!==void 0&&w)for(G=0;G<4;G++)C=z[G],ua[V]=C.u,ua[V+1]=C.v,V+=2;Aa&&(ta[xa]=U,ta[xa+1]=U+1,ta[xa+2]=U+3,ta[xa+3]=U+1,ta[xa+4]=U+2,ta[xa+5]=U+3,xa+=6,wa[pa]=U,wa[pa+1]=U+1,wa[pa+2]=U,wa[pa+
+3]=U+3,wa[pa+4]=U+1,wa[pa+5]=U+2,wa[pa+6]=U+2,wa[pa+7]=U+3,pa+=8,U+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,ga,y));if(ja)for(qa in ja)B=ja[qa],B.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,B.buffer),o.bufferData(o.ARRAY_BUFFER,B.array,y));if(Ga){K=0;for(B=La.length;K<B;K++)o.bindBuffer(o.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[K]),o.bufferData(o.ARRAY_BUFFER,Da[K],y)}Ba&&Y>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,
+da,y));Ha&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ka,y));Ka&&la.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ia,y));za&&ra>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,va,y));za&&V>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ua,y));Aa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ta,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,
 t.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,wa,y));T>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,ca,y),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,aa,y),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ea,y),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,fa,y));M&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,
 delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinVertexAArray,delete t.__skinVertexBArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(m)}else if(k instanceof THREE.Ribbon){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=M=M=
 void 0;u=k.vertices;p=k.colors;w=u.length;t=p.length;N=k.__vertexArray;y=k.__colorArray;O=k.__dirtyColors;if(k.__dirtyVertices){for(M=0;M<w;M++)x=u[M].position,n=M*3,N[n]=x.x,N[n+1]=x.y,N[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,N,m)}if(O){for(M=0;M<t;M++)color=p[M],n=M*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof
@@ -483,18 +483,18 @@ x+W,p+X*(x+1)+W,p+1+X*(x+1)+W,p+1+X*x+W,null,null,u)),v.faceVertexUvs[0].push([n
 u[z]);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;
 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,y=w*(c-b)+b;for(n=0;n<=f;n++){var z=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(z*Math.PI*2),-w*e+k,y*Math.cos(z*Math.PI*2))));t.push(this.vertices.length-1);x.push(new THREE.UV(z,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],y=
-this.vertices[e].position.clone().setY(0).normalize(),z=this.vertices[t].position.clone().setY(0).normalize(),C=this.vertices[x].position.clone().setY(0).normalize(),A=this.vertices[w].position.clone().setY(0).normalize(),F=v[u][n].clone(),D=v[u+1][n].clone(),I=v[u+1][n+1].clone(),P=v[u][n+1].clone();this.faces.push(new THREE.Face4(e,t,x,w,[y,z,C,A]));this.faceVertexUvs[0].push([F,D,I,P])}if(!m&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(n=0;n<f;n++)e=p[0][n],t=p[0][n+
-1],x=this.vertices.length-1,y=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),C=new THREE.Vector3(0,1,0),F=v[0][n].clone(),D=v[0][n+1].clone(),I=new THREE.UV(D.u,0),this.faces.push(new THREE.Face3(e,t,x,[y,z,C])),this.faceVertexUvs[0].push([F,D,I])}if(!m&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(n=0;n<f;n++)e=p[u][n+1],t=p[u][n],x=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),C=new THREE.Vector3(0,-1,0),F=v[u][n+1].clone(),D=v[u][n].clone(),
-I=new THREE.UV(D.u,1),this.faces.push(new THREE.Face3(e,t,x,[y,z,C])),this.faceVertexUvs[0].push([F,D,I])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+this.vertices[e].position.clone().setY(0).normalize(),z=this.vertices[t].position.clone().setY(0).normalize(),C=this.vertices[x].position.clone().setY(0).normalize(),A=this.vertices[w].position.clone().setY(0).normalize(),F=v[u][n].clone(),D=v[u+1][n].clone(),J=v[u+1][n+1].clone(),P=v[u][n+1].clone();this.faces.push(new THREE.Face4(e,t,x,w,[y,z,C,A]));this.faceVertexUvs[0].push([F,D,J,P])}if(!m&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(n=0;n<f;n++)e=p[0][n],t=p[0][n+
+1],x=this.vertices.length-1,y=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),C=new THREE.Vector3(0,1,0),F=v[0][n].clone(),D=v[0][n+1].clone(),J=new THREE.UV(D.u,0),this.faces.push(new THREE.Face3(e,t,x,[y,z,C])),this.faceVertexUvs[0].push([F,D,J])}if(!m&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(n=0;n<f;n++)e=p[u][n+1],t=p[u][n],x=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),C=new THREE.Vector3(0,-1,0),F=v[u][n+1].clone(),D=v[u][n].clone(),
+J=new THREE.UV(D.u,1),this.faces.push(new THREE.Face3(e,t,x,[y,z,C])),this.faceVertexUvs[0].push([F,D,J])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,h;this.shapebb=b[f-1].getBoundingBox();for(e=0;e<f;e++)h=b[e],this.addShape(h,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,k=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);k.set(b.x-e.x,b.y-e.y);f=f.normalize();k=k.normalize();h.set(-f.y,f.x);m.set(k.y,-k.x);n.copy(b).addSelf(h);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
-n.copy(c).addSelf(h);o.copy(e).addSelf(m);h=f.dot(m);m=o.subSelf(n).dot(m);h==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=h;if(m<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(E=b.length;--E>=0;){ka=E;fa=E-1;fa<0&&(fa=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=da+ka+f,m=da+ka+k,o=h,f=da+fa+f,k=da+fa+k,p=m;o+=Y;f+=Y;k+=Y;p+=Y;G.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=(G.vertices[h].position.z+u)/k,m=(G.vertices[m].position.z+u)/k,G.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){G.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function k(b,c,e){b+=Y;c+=Y;e+=Y;G.faces.push(new THREE.Face3(b,
+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(E=b.length;--E>=0;){ja=E;fa=E-1;fa<0&&(fa=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=da+ja+f,m=da+ja+k,o=h,f=da+fa+f,k=da+fa+k,p=m;o+=Y;f+=Y;k+=Y;p+=Y;G.faces.push(new THREE.Face4(o,f,k,p,null,null,J));J&&(o=c/e,f=(c+1)/e,k=n+u*2,h=(G.vertices[h].position.z+u)/k,m=(G.vertices[m].position.z+u)/k,G.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){G.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function k(b,c,e){b+=Y;c+=Y;e+=Y;G.faces.push(new THREE.Face3(b,
 c,e,null,null,D));if(D){var f=P.maxY,k=P.maxX,h=G.vertices[c].position.x,c=G.vertices[c].position.y,m=G.vertices[e].position.x,e=G.vertices[e].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[b].position.x/k,G.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,y=c.bendPath,z=c.extrudePath,C,A=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,I=c.extrudeMaterial,P=this.shapebb;if(z)C=z.getPoints(x),w=C.length,A=!0,t=!1;t||(p=u=v=0);var S,K,H,G=this,Y=this.vertices.length;y&&b.addWrapPath(y);x=F?b.extractAllSpacedPoints(x):b.extractAllPoints(x);y=x.shape;x=x.holes;if(z=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();K=0;for(H=x.length;K<H;K++)S=x[K],THREE.Shape.Utils.isClockWise(S)&&
-(x[K]=S.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(y,x);F=y;K=0;for(H=x.length;K<H;K++)S=x[K],y=y.concat(S);var E,Q,R,W,X,o,ea=y.length,V=z.length,ma=[];E=0;Q=F.length;ka=Q-1;for(fa=E+1;E<Q;E++,ka++,fa++)ka==Q&&(ka=0),fa==Q&&(fa=0),ma[E]=f(F[E],F[ka],F[fa]);var aa=[],ja,ca=ma.concat();K=0;for(H=x.length;K<H;K++){S=x[K];ja=[];E=0;Q=S.length;ka=Q-1;for(fa=E+1;E<Q;E++,ka++,fa++)ka==Q&&(ka=0),fa==Q&&(fa=0),ja[E]=f(S[E],S[ka],S[fa]);aa.push(ja);ca=ca.concat(ja)}for(R=0;R<v;R++){W=R/v;X=u*(1-
-W);W=p*Math.sin(W*Math.PI/2);E=0;for(Q=F.length;E<Q;E++)o=e(F[E],ma[E],W),m(o.x,o.y,-X);K=0;for(H=x.length;K<H;K++){S=x[K];ja=aa[K];E=0;for(Q=S.length;E<Q;E++)o=e(S[E],ja[E],W),m(o.x,o.y,-X)}}W=p;for(E=0;E<ea;E++)o=t?e(y[E],ca[E],W):y[E],A?m(o.x,o.y+C[0].y,C[0].x):m(o.x,o.y,0);for(R=1;R<=w;R++)for(E=0;E<ea;E++)o=t?e(y[E],ca[E],W):y[E],A?m(o.x,o.y+C[R-1].y,C[R-1].x):m(o.x,o.y,n/w*R);for(R=v-1;R>=0;R--){W=R/v;X=u*(1-W);W=p*Math.sin(W*Math.PI/2);E=0;for(Q=F.length;E<Q;E++)o=e(F[E],ma[E],W),m(o.x,o.y,
-n+X);K=0;for(H=x.length;K<H;K++){S=x[K];ja=aa[K];E=0;for(Q=S.length;E<Q;E++)o=e(S[E],ja[E],W),A?m(o.x,o.y+C[w-1].y,C[w-1].x+X):m(o.x,o.y,n+X)}}if(t){t=ea*0;for(E=0;E<V;E++)p=z[E],k(p[2]+t,p[1]+t,p[0]+t);t=ea*(w+v*2);for(E=0;E<V;E++)p=z[E],k(p[0]+t,p[1]+t,p[2]+t)}else{for(E=0;E<V;E++)p=z[E],k(p[2],p[1],p[0]);for(E=0;E<V;E++)p=z[E],k(p[0]+ea*w,p[1]+ea*w,p[2]+ea*w)}var ka,fa,da=0;h(F);da+=F.length;K=0;for(H=x.length;K<H;K++)S=x[K],h(S),da+=S.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,w=c.steps!==void 0?c.steps:1,y=c.bendPath,z=c.extrudePath,C,A=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,J=c.extrudeMaterial,P=this.shapebb;if(z)C=z.getPoints(x),w=C.length,A=!0,t=!1;t||(p=u=v=0);var S,I,H,G=this,Y=this.vertices.length;y&&b.addWrapPath(y);x=F?b.extractAllSpacedPoints(x):b.extractAllPoints(x);y=x.shape;x=x.holes;if(z=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();I=0;for(H=x.length;I<H;I++)S=x[I],THREE.Shape.Utils.isClockWise(S)&&
+(x[I]=S.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(y,x);F=y;I=0;for(H=x.length;I<H;I++)S=x[I],y=y.concat(S);var E,Q,R,W,X,o,ea=y.length,V=z.length,la=[];E=0;Q=F.length;ja=Q-1;for(fa=E+1;E<Q;E++,ja++,fa++)ja==Q&&(ja=0),fa==Q&&(fa=0),la[E]=f(F[E],F[ja],F[fa]);var aa=[],ia,ca=la.concat();I=0;for(H=x.length;I<H;I++){S=x[I];ia=[];E=0;Q=S.length;ja=Q-1;for(fa=E+1;E<Q;E++,ja++,fa++)ja==Q&&(ja=0),fa==Q&&(fa=0),ia[E]=f(S[E],S[ja],S[fa]);aa.push(ia);ca=ca.concat(ia)}for(R=0;R<v;R++){W=R/v;X=u*(1-
+W);W=p*Math.sin(W*Math.PI/2);E=0;for(Q=F.length;E<Q;E++)o=e(F[E],la[E],W),m(o.x,o.y,-X);I=0;for(H=x.length;I<H;I++){S=x[I];ia=aa[I];E=0;for(Q=S.length;E<Q;E++)o=e(S[E],ia[E],W),m(o.x,o.y,-X)}}W=p;for(E=0;E<ea;E++)o=t?e(y[E],ca[E],W):y[E],A?m(o.x,o.y+C[0].y,C[0].x):m(o.x,o.y,0);for(R=1;R<=w;R++)for(E=0;E<ea;E++)o=t?e(y[E],ca[E],W):y[E],A?m(o.x,o.y+C[R-1].y,C[R-1].x):m(o.x,o.y,n/w*R);for(R=v-1;R>=0;R--){W=R/v;X=u*(1-W);W=p*Math.sin(W*Math.PI/2);E=0;for(Q=F.length;E<Q;E++)o=e(F[E],la[E],W),m(o.x,o.y,
+n+X);I=0;for(H=x.length;I<H;I++){S=x[I];ia=aa[I];E=0;for(Q=S.length;E<Q;E++)o=e(S[E],ia[E],W),A?m(o.x,o.y+C[w-1].y,C[w-1].x+X):m(o.x,o.y,n+X)}}if(t){t=ea*0;for(E=0;E<V;E++)p=z[E],k(p[2]+t,p[1]+t,p[0]+t);t=ea*(w+v*2);for(E=0;E<V;E++)p=z[E],k(p[0]+t,p[1]+t,p[2]+t)}else{for(E=0;E<V;E++)p=z[E],k(p[2],p[1],p[0]);for(E=0;E<V;E++)p=z[E],k(p[0]+ea*w,p[1]+ea*w,p[2]+ea*w)}var ja,fa,da=0;h(F);da+=F.length;I=0;for(H=x.length;I<H;I++)S=x[I],h(S),da+=S.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(b){function c(b,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,
@@ -513,8 +513,8 @@ THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:
 this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),m=h.length,k=[],b=0;b<m;b++){var n=new THREE.Path,n=this.extractGlyphPoints(h[b],c,e,f,n);f+=n.offset;k.push(n.path)}return{paths:k,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var m=[],k,n,u,p,v,t,x,w,y,z,C=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(C){if(C.o){c=C._cachedOutline||(C._cachedOutline=C.o.split(" "));u=c.length;for(b=0;b<u;)switch(n=c[b++],n){case "m":n=c[b++]*e+f;p=c[b++]*e;m.push(new THREE.Vector2(n,
 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 A=k/divisions,F=THREE.Shape.Utils.b2(A,v,x,n),A=THREE.Shape.Utils.b2(A,t,w,p);m.push(new THREE.Vector2(F,A))}}break;case "b":if(n=c[b++]*e+f,p=c[b++]*e,x=c[b++]*e+f,w=c[b++]*-e,y=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(n,p,
 x,w,y,z),k=m[m.length-1]){v=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)A=k/divisions,F=THREE.Shape.Utils.b3(A,v,x,y,n),A=THREE.Shape.Utils.b3(A,t,w,z,p),m.push(new THREE.Vector2(F,A))}}}return{offset:C.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,y=p,z=v,C=h,A=k,F=void 0,D=void 0,I=void 0,
-P=void 0,S=void 0,K=void 0,H=void 0,G=void 0,Y=void 0,D=x[A[w]].x,I=x[A[w]].y,P=x[A[y]].x,S=x[A[y]].y,K=x[A[z]].x,H=x[A[z]].y;if(1.0E-10>(P-D)*(H-I)-(S-I)*(K-D))x=!1;else{for(F=0;F<C;F++)if(!(F==w||F==y||F==z)){var G=x[A[F]].x,Y=x[A[F]].y,E=void 0,Q=void 0,R=void 0,W=void 0,X=void 0,o=void 0,ea=void 0,V=void 0,ma=void 0,aa=void 0,ja=void 0,ca=void 0,E=R=X=void 0,E=K-P,Q=H-S,R=D-K,W=I-H,X=P-D,o=S-I,ea=G-D,V=Y-I,ma=G-P,aa=Y-S,ja=G-K,ca=Y-H,E=E*aa-Q*ma,X=X*V-o*ea,R=R*ca-W*ja;if(E>=0&&R>=0&&X>=0){x=!1;
+(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,y=p,z=v,C=h,A=k,F=void 0,D=void 0,J=void 0,
+P=void 0,S=void 0,I=void 0,H=void 0,G=void 0,Y=void 0,D=x[A[w]].x,J=x[A[w]].y,P=x[A[y]].x,S=x[A[y]].y,I=x[A[z]].x,H=x[A[z]].y;if(1.0E-10>(P-D)*(H-J)-(S-J)*(I-D))x=!1;else{for(F=0;F<C;F++)if(!(F==w||F==y||F==z)){var G=x[A[F]].x,Y=x[A[F]].y,E=void 0,Q=void 0,R=void 0,W=void 0,X=void 0,o=void 0,ea=void 0,V=void 0,la=void 0,aa=void 0,ia=void 0,ca=void 0,E=R=X=void 0,E=I-P,Q=H-S,R=D-I,W=J-H,X=P-D,o=S-J,ea=G-D,V=Y-J,la=G-P,aa=Y-S,ia=G-I,ca=Y-H,E=E*aa-Q*la,X=X*V-o*ea,R=R*ca-W*ia;if(E>=0&&R>=0&&X>=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=
 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);
@@ -537,34 +537,34 @@ 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");
 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,
-f,k;e=h(b,c);f=h(b,c+S);k=h(b,c+K);c=u(b,c+H);A.faces.push(new THREE.Face3(e,f,k,null,null,A.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+S);k=h(b,c+K);m=u(b,c+H);o=h(b,c+G);p=h(b,c+Y);c=h(b,c+E);m=A.materials[m];var t=I[p*3],v=I[p*3+1];p=I[p*3+2];var w=I[c*3],x=I[c*3+1],c=I[c*3+2];A.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,x,c)],null,m))}function w(c){var e,f,k,m;e=h(b,c);f=h(b,c+Q);k=h(b,c+R);m=h(b,
-c+W);c=u(b,c+X);A.faces.push(new THREE.Face4(e,f,k,m,null,null,A.materials[c]))}function y(c){var e,f,k,m,p,t,v,w;e=h(b,c);f=h(b,c+Q);k=h(b,c+R);m=h(b,c+W);p=u(b,c+X);t=h(b,c+o);v=h(b,c+ea);w=h(b,c+V);c=h(b,c+ma);p=A.materials[p];var x=I[v*3],N=I[v*3+1];v=I[v*3+2];var y=I[w*3],M=I[w*3+1];w=I[w*3+2];var L=I[c*3],z=I[c*3+1],c=I[c*3+2];A.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,N,v),new THREE.Vector3(y,M,w),new THREE.Vector3(L,z,c)],null,p))}
-function z(c){var e,f,k,m;e=h(b,c);f=h(b,c+aa);k=h(b,c+ja);c=P[e*2];m=P[e*2+1];e=P[f*2];var o=A.faceVertexUvs[0];f=P[f*2+1];var p=P[k*2];k=P[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 C(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ca);k=h(b,c+ka);m=h(b,c+fa);c=P[e*2];o=P[e*2+1];e=P[f*2];p=P[f*2+1];f=P[k*2];var t=A.faceVertexUvs[0];k=P[k*2+1];var u=P[m*2];m=P[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f,
-k));v.push(new THREE.UV(u,m));t.push(v)}var A=this,F=0,D,I=[],P=[],S,K,H,G,Y,E,Q,R,W,X,o,ea,V,ma,aa,ja,ca,ka,fa,da,U,Z,ga,la,ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,f,c);D={signature:b.substr(F,8),header_bytes:v(b,F+8),vertex_coordinate_bytes:v(b,F+9),normal_coordinate_bytes:v(b,F+10),uv_coordinate_bytes:v(b,F+11),vertex_index_bytes:v(b,F+12),normal_index_bytes:v(b,F+13),uv_index_bytes:v(b,F+14),material_index_bytes:v(b,F+15),nvertices:h(b,F+16),nnormals:h(b,F+16+4),nuvs:h(b,
-F+16+8),ntri_flat:h(b,F+16+12),ntri_smooth:h(b,F+16+16),ntri_flat_uv:h(b,F+16+20),ntri_smooth_uv:h(b,F+16+24),nquad_flat:h(b,F+16+28),nquad_smooth:h(b,F+16+32),nquad_flat_uv:h(b,F+16+36),nquad_smooth_uv:h(b,F+16+40)};F+=D.header_bytes;S=D.vertex_index_bytes;K=D.vertex_index_bytes*2;H=D.vertex_index_bytes*3;G=D.vertex_index_bytes*3+D.material_index_bytes;Y=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;E=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;Q=D.vertex_index_bytes;
-R=D.vertex_index_bytes*2;W=D.vertex_index_bytes*3;X=D.vertex_index_bytes*4;o=D.vertex_index_bytes*4+D.material_index_bytes;ea=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;V=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;ma=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;aa=D.uv_index_bytes;ja=D.uv_index_bytes*2;ca=D.uv_index_bytes;ka=D.uv_index_bytes*2;fa=D.uv_index_bytes*3;c=D.vertex_index_bytes*3+D.material_index_bytes;ta=D.vertex_index_bytes*
-4+D.material_index_bytes;da=D.ntri_flat*c;U=D.ntri_smooth*(c+D.normal_index_bytes*3);Z=D.ntri_flat_uv*(c+D.uv_index_bytes*3);ga=D.ntri_smooth_uv*(c+D.normal_index_bytes*3+D.uv_index_bytes*3);la=D.nquad_flat*ta;c=D.nquad_smooth*(ta+D.normal_index_bytes*4);ta=D.nquad_flat_uv*(ta+D.uv_index_bytes*4);F+=function(c){for(var f,h,m,n=D.vertex_coordinate_bytes*3,o=c+D.nvertices*n;c<o;c+=n)f=e(b,c),h=e(b,c+D.vertex_coordinate_bytes),m=e(b,c+D.vertex_coordinate_bytes*2),A.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
-h,m)));return D.nvertices*n}(F);F+=function(c){for(var e,f,h,k=D.normal_coordinate_bytes*3,m=c+D.nnormals*k;c<m;c+=k)e=p(b,c),f=p(b,c+D.normal_coordinate_bytes),h=p(b,c+D.normal_coordinate_bytes*2),I.push(e/127,f/127,h/127);return D.nnormals*k}(F);F+=function(c){for(var f,h,m=D.uv_coordinate_bytes*2,n=c+D.nuvs*m;c<n;c+=m)f=e(b,c),h=e(b,c+D.uv_coordinate_bytes),P.push(f,h);return D.nuvs*m}(F);da=F+da;U=da+U;Z=U+Z;ga=Z+ga;la=ga+la;c=la+c;ta=c+ta;(function(b){var c,e=D.vertex_index_bytes*3+D.material_index_bytes,
+f,k;e=h(b,c);f=h(b,c+S);k=h(b,c+I);c=u(b,c+H);A.faces.push(new THREE.Face3(e,f,k,null,null,A.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+S);k=h(b,c+I);m=u(b,c+H);o=h(b,c+G);p=h(b,c+Y);c=h(b,c+E);m=A.materials[m];var t=J[p*3],v=J[p*3+1];p=J[p*3+2];var w=J[c*3],x=J[c*3+1],c=J[c*3+2];A.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(J[o*3],J[o*3+1],J[o*3+2]),new THREE.Vector3(t,v,p),new THREE.Vector3(w,x,c)],null,m))}function w(c){var e,f,k,m;e=h(b,c);f=h(b,c+Q);k=h(b,c+R);m=h(b,
+c+W);c=u(b,c+X);A.faces.push(new THREE.Face4(e,f,k,m,null,null,A.materials[c]))}function y(c){var e,f,k,m,p,t,v,w;e=h(b,c);f=h(b,c+Q);k=h(b,c+R);m=h(b,c+W);p=u(b,c+X);t=h(b,c+o);v=h(b,c+ea);w=h(b,c+V);c=h(b,c+la);p=A.materials[p];var x=J[v*3],N=J[v*3+1];v=J[v*3+2];var y=J[w*3],M=J[w*3+1];w=J[w*3+2];var L=J[c*3],z=J[c*3+1],c=J[c*3+2];A.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(J[t*3],J[t*3+1],J[t*3+2]),new THREE.Vector3(x,N,v),new THREE.Vector3(y,M,w),new THREE.Vector3(L,z,c)],null,p))}
+function z(c){var e,f,k,m;e=h(b,c);f=h(b,c+aa);k=h(b,c+ia);c=P[e*2];m=P[e*2+1];e=P[f*2];var o=A.faceVertexUvs[0];f=P[f*2+1];var p=P[k*2];k=P[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 C(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ca);k=h(b,c+ja);m=h(b,c+fa);c=P[e*2];o=P[e*2+1];e=P[f*2];p=P[f*2+1];f=P[k*2];var t=A.faceVertexUvs[0];k=P[k*2+1];var u=P[m*2];m=P[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f,
+k));v.push(new THREE.UV(u,m));t.push(v)}var A=this,F=0,D,J=[],P=[],S,I,H,G,Y,E,Q,R,W,X,o,ea,V,la,aa,ia,ca,ja,fa,da,U,Z,ga,ka,ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,f,c);D={signature:b.substr(F,8),header_bytes:v(b,F+8),vertex_coordinate_bytes:v(b,F+9),normal_coordinate_bytes:v(b,F+10),uv_coordinate_bytes:v(b,F+11),vertex_index_bytes:v(b,F+12),normal_index_bytes:v(b,F+13),uv_index_bytes:v(b,F+14),material_index_bytes:v(b,F+15),nvertices:h(b,F+16),nnormals:h(b,F+16+4),nuvs:h(b,
+F+16+8),ntri_flat:h(b,F+16+12),ntri_smooth:h(b,F+16+16),ntri_flat_uv:h(b,F+16+20),ntri_smooth_uv:h(b,F+16+24),nquad_flat:h(b,F+16+28),nquad_smooth:h(b,F+16+32),nquad_flat_uv:h(b,F+16+36),nquad_smooth_uv:h(b,F+16+40)};F+=D.header_bytes;S=D.vertex_index_bytes;I=D.vertex_index_bytes*2;H=D.vertex_index_bytes*3;G=D.vertex_index_bytes*3+D.material_index_bytes;Y=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;E=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;Q=D.vertex_index_bytes;
+R=D.vertex_index_bytes*2;W=D.vertex_index_bytes*3;X=D.vertex_index_bytes*4;o=D.vertex_index_bytes*4+D.material_index_bytes;ea=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;V=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;la=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;aa=D.uv_index_bytes;ia=D.uv_index_bytes*2;ca=D.uv_index_bytes;ja=D.uv_index_bytes*2;fa=D.uv_index_bytes*3;c=D.vertex_index_bytes*3+D.material_index_bytes;ta=D.vertex_index_bytes*
+4+D.material_index_bytes;da=D.ntri_flat*c;U=D.ntri_smooth*(c+D.normal_index_bytes*3);Z=D.ntri_flat_uv*(c+D.uv_index_bytes*3);ga=D.ntri_smooth_uv*(c+D.normal_index_bytes*3+D.uv_index_bytes*3);ka=D.nquad_flat*ta;c=D.nquad_smooth*(ta+D.normal_index_bytes*4);ta=D.nquad_flat_uv*(ta+D.uv_index_bytes*4);F+=function(c){for(var f,h,m,n=D.vertex_coordinate_bytes*3,o=c+D.nvertices*n;c<o;c+=n)f=e(b,c),h=e(b,c+D.vertex_coordinate_bytes),m=e(b,c+D.vertex_coordinate_bytes*2),A.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
+h,m)));return D.nvertices*n}(F);F+=function(c){for(var e,f,h,k=D.normal_coordinate_bytes*3,m=c+D.nnormals*k;c<m;c+=k)e=p(b,c),f=p(b,c+D.normal_coordinate_bytes),h=p(b,c+D.normal_coordinate_bytes*2),J.push(e/127,f/127,h/127);return D.nnormals*k}(F);F+=function(c){for(var f,h,m=D.uv_coordinate_bytes*2,n=c+D.nuvs*m;c<n;c+=m)f=e(b,c),h=e(b,c+D.uv_coordinate_bytes),P.push(f,h);return D.nuvs*m}(F);da=F+da;U=da+U;Z=U+Z;ga=Z+ga;ka=ga+ka;c=ka+c;ta=c+ta;(function(b){var c,e=D.vertex_index_bytes*3+D.material_index_bytes,
 f=e+D.uv_index_bytes*3,h=b+D.ntri_flat_uv*f;for(c=b;c<h;c+=f)t(c),z(c+e);return h-b})(U);(function(b){var c,e=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=e+D.uv_index_bytes*3,h=b+D.ntri_smooth_uv*f;for(c=b;c<h;c+=f)x(c),z(c+e);return h-b})(Z);(function(b){var c,e=D.vertex_index_bytes*4+D.material_index_bytes,f=e+D.uv_index_bytes*4,h=b+D.nquad_flat_uv*f;for(c=b;c<h;c+=f)w(c),C(c+e);return h-b})(c);(function(b){var c,e=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*
 4,f=e+D.uv_index_bytes*4,h=b+D.nquad_smooth_uv*f;for(c=b;c<h;c+=f)y(c),C(c+e);return h-b})(ta);(function(b){var c,e=D.vertex_index_bytes*3+D.material_index_bytes,f=b+D.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(F);(function(b){var c,e=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=b+D.ntri_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(da);(function(b){var c,e=D.vertex_index_bytes*4+D.material_index_bytes,f=b+D.nquad_flat*e;for(c=b;c<f;c+=e)w(c);return f-b})(ga);(function(b){var c,
-e=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,f=b+D.nquad_smooth*e;for(c=b;c<f;c+=e)y(c);return f-b})(la);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
-THREE.ColladaLoader=function(){function b(b,c,e){for(var b=da.evaluate(b,da,V,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 na)for(var h=na[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);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=ha[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],
+e=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,f=b+D.nquad_smooth*e;for(c=b;c<f;c+=e)y(c);return f-b})(ka);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
+THREE.ColladaLoader=function(){function b(b,c,e){for(var b=da.evaluate(b,da,V,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 ma)for(var h=ma[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=na[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],
 !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 C=o.weights[y][z];C.joint==v&&p.weights.push(C)}}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=ha[b.controllers[m].url];switch(n.type){case "skin":if(qa[n.skin.source]){var o=new y;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);e=b.controllers[m]}else if(ha[n.skin.source]&&(k=n=ha[n.skin.source],n.morph&&qa[n.morph.source]))o=new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(qa[n.morph.source])o=
+e,k,m;c.name=b.id||"";c.matrixAutoUpdate=!1;c.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=na[b.controllers[m].url];switch(n.type){case "skin":if(qa[n.skin.source]){var o=new y;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);e=b.controllers[m]}else if(na[n.skin.source]&&(k=n=na[n.skin.source],n.morph&&qa[n.morph.source]))o=new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(qa[n.morph.source])o=
 new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),k=b.controllers[m];console.log("DAE: morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=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=ua[ra[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=ha[e.url],o.skinInstanceController=e,o.name="skin_"+Ba.length,Ba.push(o);else if(k!==void 0){p=n;t=k instanceof x?ha[k.url]:k;if(!t||!t.morph)console.log("could not find morph controller!");
+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=na[e.url],o.skinInstanceController=e,o.name="skin_"+Ba.length,Ba.push(o);else if(k!==void 0){p=n;t=k instanceof x?na[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_"+za.length;za.push(o)}else o=new THREE.Mesh(n,o);c.add(o)}}for(m=0;m<b.nodes.length;m++)c.add(h(b.nodes[m],b));return c}function 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.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function w(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function C(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function A(){}function F(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){this.source="";
-this.stride=this.count=0;this.params=[]}function I(){this.input={}}function P(){this.semantic="";this.offset=0;this.source="";this.set=0}function S(b){this.id=b;this.type=null}function K(){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 G(b,c){this.type=b;this.effect=c;this.material=null}function Y(b){this.effect=b;this.format=this.init_from=
+this.stride=this.count=0;this.params=[]}function J(){this.input={}}function P(){this.semantic="";this.offset=0;this.source="";this.set=0}function S(b){this.id=b;this.type=null}function I(){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 G(b,c){this.type=b;this.effect=c;this.material=null}function Y(b){this.effect=b;this.format=this.init_from=
 null}function E(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Q(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function R(){this.url=""}function W(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function X(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(la[c]!=void 0)return la[c];la[c]=(new S(c)).parse(b);return la[c]}function V(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function ma(b){for(var b=ja(b),c=[],e=0;e<b.length;e++)c.push(parseFloat(b[e]));return c}function aa(b){for(var b=ja(b),c=[],e=0;e<b.length;e++)c.push(parseInt(b[e],10));return c}function ja(b){return b.replace(/^\s+/,"").replace(/\s+$/,
-"").split(/\s+/)}function ca(b,c,e){return b.hasAttribute(c)?parseInt(b.getAttribute(c),10):e}function ka(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 fa(b,c){var e="";e+=ka(b.x,c)+",";e+=ka(b.y,c)+",";e+=ka(b.z,c);return e}var da=null,U=null,Z,ga=null,la={},ta={},na={},ha={},qa={},ra={},ua={},Ca,Ea,za,Ba,Ga=THREE.SmoothShading;m.prototype.parse=function(b){this.id=
+this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ea(b){var c=b.getAttribute("id");if(ka[c]!=void 0)return ka[c];ka[c]=(new S(c)).parse(b);return ka[c]}function V(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function la(b){for(var b=ia(b),c=[],e=0;e<b.length;e++)c.push(parseFloat(b[e]));return c}function aa(b){for(var b=ia(b),c=[],e=0;e<b.length;e++)c.push(parseInt(b[e],10));return c}function ia(b){return b.replace(/^\s+/,"").replace(/\s+$/,
+"").split(/\s+/)}function ca(b,c,e){return b.hasAttribute(c)?parseInt(b.getAttribute(c),10):e}function ja(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 fa(b,c){var e="";e+=ja(b.x,c)+",";e+=ja(b.y,c)+",";e+=ja(b.z,c);return e}var da=null,U=null,Z,ga=null,ka={},ta={},ma={},na={},qa={},ra={},ua={},Ca,Ea,za,Ba,Ga=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=
 {},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 S).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 P).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=ma(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 P).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=la(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 S).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 P).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 P).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");
@@ -572,23 +572,23 @@ this.nodes=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.
 ""))}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;
 case "instance_controller":this.controllers.push((new x).parse(c));break;case "instance_geometry":this.geometries.push((new y).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=da.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",da,V,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 na)for(var h=na[f],k=0;k<h.channel.length;k++){var m=h.channel[k],n=h.sampler[k];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,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+
+break;case "extra":break;default:console.log(c.nodeName)}b=[];e=1E6;c=-1E6;for(var f in ma)for(var h=ma[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,
-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=ma(b.textContent);this.updateMatrix();return this};t.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
+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=la(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};
 x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "skeleton":this.skeleton.push(e.textContent.replace(/^#/,""));break;case "bind_material":if(e=da.evaluate(".//dae:instance_material",e,V,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};y.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1&&e.nodeName=="bind_material"){if(b=da.evaluate(".//dae:instance_material",e,V,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};z.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 C(this)).parse(e)}}return this};C.prototype.parse=function(b){function c(b,e){var f=fa(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 F).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new A).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=la[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 J).parse(f);break;case "triangles":this.primitives.push((new F).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new A).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=ka[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};C.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={},C=[];b.vcount&&(v=b.vcount[u++]);for(h=0;h<v;h++)for(k=0;k<n.length;k++)switch(o=
-n[k],source=la[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=fa(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":C.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var A;v==
+n[k],source=ka[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=fa(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":C.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var A;v==
 3?A=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],C.length?C:new THREE.Color):v==4&&(A=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],C.length?C:new THREE.Color));A.daeMaterial=b.material;c.faces.push(A);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}};A.prototype=new F;A.prototype.constructor=A;F.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};
 F.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=ca(b,"count",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "input":this.inputs.push((new P).parse(b.childNodes[c]));break;case "vcount":this.vcount=aa(e.textContent);break;case "p":this.p=aa(e.textContent)}}return this};D.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=ca(b,"count",0);this.stride=ca(b,"stride",0);for(var c=
-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 P).parse(b.childNodes[c]),this.input[input.semantic]=input);return this};P.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,
-"");this.set=ca(b,"set",-1);this.offset=ca(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};S.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "bool_array":for(var f=ja(e.textContent),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=ma(e.textContent);this.type=e.nodeName;break;case "int_array":this.data=
-aa(e.textContent);this.type=e.nodeName;break;case "IDREF_array":case "Name_array":this.data=ja(e.textContent);this.type=e.nodeName;break;case "technique_common":for(f=0;f<e.childNodes.length;f++)if(e.childNodes[f].nodeName=="accessor"){this.accessor=(new D).parse(e.childNodes[f]);break}}}return this};S.prototype.read=function(){var b=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var e=
-this.data.slice(c,c+16),f=new THREE.Matrix4;f.set(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+c.type)}return b};K.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 R).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=ma(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};G.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=
+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};J.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 P).parse(b.childNodes[c]),this.input[input.semantic]=input);return this};P.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,
+"");this.set=ca(b,"set",-1);this.offset=ca(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};S.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=ia(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=la(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=ia(e.textContent);this.type=e.nodeName;break;case "technique_common":for(f=0;f<e.childNodes.length;f++)if(e.childNodes[f].nodeName=="accessor"){this.accessor=(new D).parse(e.childNodes[f]);break}}}return this};S.prototype.read=function(){var b=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var e=
+this.data.slice(c,c+16),f=new THREE.Matrix4;f.set(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+c.type)}return b};I.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 R).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=la(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};G.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=
 b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "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=da.evaluate(".//dae:float",e,V,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};G.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=ta[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+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=Ga;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: "+
@@ -600,12 +600,12 @@ Q.prototype.parseTechnique=function(b){for(var c=0;c<b.childNodes.length;c++){va
 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 P).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;n.overrideMimeType&&n.overrideMimeType("text/xml");n.onreadystatechange=function(){if(n.readyState==4&&(n.status==0||n.status==200)){ga=f;var o,t=e;da=n.responseXML;o=ga;t!==void 0&&(t=t.split("/"),t.pop(),Ea=t.join("/")+"/");ta=b("//dae:library_images/dae:image",m,"image");ra=b("//dae:library_materials/dae:material",
-K,"material");ua=b("//dae:library_effects/dae:effect",Q,"effect");qa=b("//dae:library_geometries/dae:geometry",z,"geometry");ha=b("//dae:library_controllers/dae:controller",k,"controller");na=b("//dae:library_animations/dae:animation",W,"animation");Ca=b(".//dae:library_visual_scenes/dae:visual_scene",p,"visual_scene");za=[];Ba=[];(t=da.evaluate(".//dae:scene/dae:instance_visual_scene",da,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(t=t.getAttribute("url").replace(/^#/,""),Z=Ca[t]):
-Z=null;U=new THREE.Object3D;for(t=0;t<Z.nodes.length;t++)U.add(h(Z.nodes[t]));c();for(var u in na);u={scene:U,morphs:za,skins:Ba,dae:{images:ta,materials:ra,effects:ua,geometries:qa,controllers:ha,animations:na,visualScenes:Ca,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){Ga=b},applySkin:f,geometries:qa}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
+I,"material");ua=b("//dae:library_effects/dae:effect",Q,"effect");qa=b("//dae:library_geometries/dae:geometry",z,"geometry");na=b("//dae:library_controllers/dae:controller",k,"controller");ma=b("//dae:library_animations/dae:animation",W,"animation");Ca=b(".//dae:library_visual_scenes/dae:visual_scene",p,"visual_scene");za=[];Ba=[];(t=da.evaluate(".//dae:scene/dae:instance_visual_scene",da,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(t=t.getAttribute("url").replace(/^#/,""),Z=Ca[t]):
+Z=null;U=new THREE.Object3D;for(t=0;t<Z.nodes.length;t++)U.add(h(Z.nodes[t]));c();for(var u in ma);u={scene:U,morphs:za,skins:Ba,dae:{images:ta,materials:ra,effects:ua,geometries:qa,controllers:na,animations:ma,visualScenes:Ca,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){Ga=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.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,y,z,C,A,F,D,I=b.faces;t=b.vertices;var P=b.normals,S=b.colors,K=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&K++;for(e=0;e<K;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;z=c&64;c&=128;t?(C=new THREE.Face4,C.a=I[p++],C.b=I[p++],C.c=I[p++],C.d=I[p++],t=4):(C=new THREE.Face3,C.a=I[p++],C.b=I[p++],C.c=I[p++],t=3);if(u)u=I[p++],C.materials=f.materials[u];u=f.faces.length;if(e)for(e=0;e<K;e++)A=b.uvs[e],y=I[p++],D=A[y*2],y=A[y*2+1],f.faceUvs[e][u]=new THREE.UV(D,y);if(h)for(e=0;e<K;e++){A=b.uvs[e];F=[];for(h=0;h<t;h++)y=I[p++],D=A[y*2],y=A[y*2+1],F[h]=
-new THREE.UV(D,y);f.faceVertexUvs[e][u]=F}if(w)w=I[p++]*3,h=new THREE.Vector3,h.x=P[w++],h.y=P[w++],h.z=P[w],C.normal=h;if(x)for(e=0;e<t;e++)w=I[p++]*3,h=new THREE.Vector3,h.x=P[w++],h.y=P[w++],h.z=P[w],C.vertexNormals.push(h);if(z)x=I[p++],x=new THREE.Color(S[x]),C.color=x;if(c)for(e=0;e<t;e++)x=I[p++],x=new THREE.Color(S[x]),C.vertexColors.push(x);f.faces.push(C)}}})(h);(function(){var c,e,h,u;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],u=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,h,u,p,v,t,x,w,y,z,C,A,F,D,J=b.faces;t=b.vertices;var P=b.normals,S=b.colors,I=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&I++;for(e=0;e<I;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=J.length;p<v;){c=J[p++];t=c&1;u=c&2;e=c&4;h=c&8;w=c&16;x=c&32;z=c&64;c&=128;t?(C=new THREE.Face4,C.a=J[p++],C.b=J[p++],C.c=J[p++],C.d=J[p++],t=4):(C=new THREE.Face3,C.a=J[p++],C.b=J[p++],C.c=J[p++],t=3);if(u)u=J[p++],C.materials=f.materials[u];u=f.faces.length;if(e)for(e=0;e<I;e++)A=b.uvs[e],y=J[p++],D=A[y*2],y=A[y*2+1],f.faceUvs[e][u]=new THREE.UV(D,y);if(h)for(e=0;e<I;e++){A=b.uvs[e];F=[];for(h=0;h<t;h++)y=J[p++],D=A[y*2],y=A[y*2+1],F[h]=
+new THREE.UV(D,y);f.faceVertexUvs[e][u]=F}if(w)w=J[p++]*3,h=new THREE.Vector3,h.x=P[w++],h.y=P[w++],h.z=P[w],C.normal=h;if(x)for(e=0;e<t;e++)w=J[p++]*3,h=new THREE.Vector3,h.x=P[w++],h.y=P[w++],h.z=P[w],C.vertexNormals.push(h);if(z)x=J[p++],x=new THREE.Color(S[x]),C.color=x;if(c)for(e=0;e<t;e++)x=J[p++],x=new THREE.Color(S[x]),C.vertexColors.push(x);f.faces.push(C)}}})(h);(function(){var c,e,h,u;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],u=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(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,y;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;y=b.morphTargets[e].vertices;u=0;for(p=y.length;u<p;u+=3)v=y[u]*c,t=y[u+1]*
 c,x=y[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(){}};
@@ -613,14 +613,14 @@ THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.pos
 q=F.quaternion;s=F.scale;q=0;Y.length==0&&(Y[0]=new THREE.MeshFaceMaterial);Y.length>1&&(Y=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(S,Y);object.name=w;object.position.set(D[0],D[1],D[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=F.visible;V.scene.add(object);V.objects[w]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),V.scene.collisions.colliders.push(b));
 if(F.castsShadow)b=new THREE.ShadowVolume(S),V.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},V.triggers[object.name]=b)}}else D=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(D[0],D[1],D[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
 s[1],s[2]),object.visible=F.visible!==void 0?F.visible:!1,V.scene.add(object),V.objects[w]=object,V.empties[w]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},V.triggers[object.name]=b)}function u(b){return function(c){V.geometries[b]=c;n();W-=1;e.onLoadComplete();v()}}function p(b){return function(c){V.geometries[b]=c}}function v(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-W,loadedTextures:ea-X},V);e.onLoadProgress();W==0&&X==0&&c(V)}var t,
-x,w,y,z,C,A,F,D,I,P,S,K,H,G,Y,E,Q,R,W,X,o,ea,V;Q=b.data;G=new THREE.BinaryLoader;R=new THREE.JSONLoader;X=W=0;V={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in Q.objects)if(F=Q.objects[w],F.meshCollider){b=!0;break}if(b)V.scene.collisions=new THREE.CollisionSystem;if(Q.transform){b=Q.transform.position;I=Q.transform.rotation;var ma=Q.transform.scale;b&&V.scene.position.set(b[0],b[1],b[2]);I&&V.scene.rotation.set(I[0],
-I[1],I[2]);ma&&V.scene.scale.set(ma[0],ma[1],ma[2]);(b||I||ma)&&V.scene.updateMatrix()}b=function(){X-=1;v();e.onLoadComplete()};for(z in Q.cameras){I=Q.cameras[z];if(I.type=="perspective")K=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")K=new THREE.Camera,K.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);D=I.position;I=I.target;K.position.set(D[0],D[1],D[2]);K.target.position.set(I[0],I[1],I[2]);V.cameras[z]=K}for(y in Q.lights)z=Q.lights[y],
-K=z.color!==void 0?z.color:16777215,I=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(D=z.direction,E=new THREE.DirectionalLight(K,I),E.position.set(D[0],D[1],D[2]),E.position.normalize()):z.type=="point"?(D=z.position,d=z.distance,E=new THREE.PointLight(K,I,d),E.position.set(D[0],D[1],D[2])):z.type=="ambient"&&(E=new THREE.AmbientLight(K)),V.scene.add(E),V.lights[y]=E;for(C in Q.fogs)y=Q.fogs[C],y.type=="linear"?H=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(H=new THREE.FogExp2(0,y.density)),
-I=y.color,H.color.setRGB(I[0],I[1],I[2]),V.fogs[C]=H;if(V.cameras&&Q.defaults.camera)V.currentCamera=V.cameras[Q.defaults.camera];if(V.fogs&&Q.defaults.fog)V.scene.fog=V.fogs[Q.defaults.fog];I=Q.defaults.bgcolor;V.bgColor=new THREE.Color;V.bgColor.setRGB(I[0],I[1],I[2]);V.bgColorAlpha=Q.defaults.bgalpha;for(t in Q.geometries)if(C=Q.geometries[t],C.type=="bin_mesh"||C.type=="ascii_mesh")W+=1,e.onLoadStart();o=W;for(t in Q.geometries)C=Q.geometries[t],C.type=="cube"?(S=new THREE.CubeGeometry(C.width,
-C.height,C.depth,C.segmentsWidth,C.segmentsHeight,C.segmentsDepth,null,C.flipped,C.sides),V.geometries[t]=S):C.type=="plane"?(S=new THREE.PlaneGeometry(C.width,C.height,C.segmentsWidth,C.segmentsHeight),V.geometries[t]=S):C.type=="sphere"?(S=new THREE.SphereGeometry(C.radius,C.segmentsWidth,C.segmentsHeight),V.geometries[t]=S):C.type=="cylinder"?(S=new THREE.CylinderGeometry(C.topRad,C.botRad,C.height,C.radSegs,C.heightSegs),V.geometries[t]=S):C.type=="torus"?(S=new THREE.TorusGeometry(C.radius,C.tube,
-C.segmentsR,C.segmentsT),V.geometries[t]=S):C.type=="icosahedron"?(S=new THREE.IcosahedronGeometry(C.subdivisions),V.geometries[t]=S):C.type=="bin_mesh"?G.load({model:f(C.url,Q.urlBaseType),callback:u(t)}):C.type=="ascii_mesh"?R.load({model:f(C.url,Q.urlBaseType),callback:u(t)}):C.type=="embedded_mesh"&&(C=Q.embeds[C.id])&&R.createModel(C,p(t),"");for(A in Q.textures)if(t=Q.textures[A],t.url instanceof Array){X+=t.url.length;for(G=0;G<t.url.length;G++)e.onLoadStart()}else X+=1,e.onLoadStart();ea=
-X;for(A in Q.textures){t=Q.textures[A];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){G=[];for(var aa=0;aa<t.url.length;aa++)G[aa]=f(t.url[aa],Q.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,t.mapping,b)}else{G=THREE.ImageUtils.loadTexture(f(t.url,Q.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)G.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)G.magFilter=THREE[t.magFilter];if(t.repeat){G.repeat.set(t.repeat[0],t.repeat[1]);
-if(t.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}t.offset&&G.offset.set(t.offset[0],t.offset[1]);if(t.wrap){R={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(R[t.wrap[0]]!==void 0)G.wrapS=R[t.wrap[0]];if(R[t.wrap[1]]!==void 0)G.wrapT=R[t.wrap[1]]}}V.textures[A]=G}for(x in Q.materials){A=Q.materials[x];for(P in A.parameters)if(P=="envMap"||P=="map"||P=="lightMap")A.parameters[P]=V.textures[A.parameters[P]];else if(P=="shading")A.parameters[P]=
+x,w,y,z,C,A,F,D,J,P,S,I,H,G,Y,E,Q,R,W,X,o,ea,V;Q=b.data;G=new THREE.BinaryLoader;R=new THREE.JSONLoader;X=W=0;V={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in Q.objects)if(F=Q.objects[w],F.meshCollider){b=!0;break}if(b)V.scene.collisions=new THREE.CollisionSystem;if(Q.transform){b=Q.transform.position;J=Q.transform.rotation;var la=Q.transform.scale;b&&V.scene.position.set(b[0],b[1],b[2]);J&&V.scene.rotation.set(J[0],
+J[1],J[2]);la&&V.scene.scale.set(la[0],la[1],la[2]);(b||J||la)&&V.scene.updateMatrix()}b=function(){X-=1;v();e.onLoadComplete()};for(z in Q.cameras){J=Q.cameras[z];if(J.type=="perspective")I=new THREE.Camera(J.fov,J.aspect,J.near,J.far),I.useTarget=!0;else if(J.type=="ortho")I=new THREE.Camera,I.useTarget=!0,I.projectionMatrix=THREE.Matrix4.makeOrtho(J.left,J.right,J.top,J.bottom,J.near,J.far);D=J.position;J=J.target;I.position.set(D[0],D[1],D[2]);I.target.position.set(J[0],J[1],J[2]);V.cameras[z]=
+I}for(y in Q.lights)z=Q.lights[y],I=z.color!==void 0?z.color:16777215,J=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(D=z.direction,E=new THREE.DirectionalLight(I,J),E.position.set(D[0],D[1],D[2]),E.position.normalize()):z.type=="point"?(D=z.position,d=z.distance,E=new THREE.PointLight(I,J,d),E.position.set(D[0],D[1],D[2])):z.type=="ambient"&&(E=new THREE.AmbientLight(I)),V.scene.add(E),V.lights[y]=E;for(C in Q.fogs)y=Q.fogs[C],y.type=="linear"?H=new THREE.Fog(0,y.near,y.far):y.type==
+"exp2"&&(H=new THREE.FogExp2(0,y.density)),J=y.color,H.color.setRGB(J[0],J[1],J[2]),V.fogs[C]=H;if(V.cameras&&Q.defaults.camera)V.currentCamera=V.cameras[Q.defaults.camera];if(V.fogs&&Q.defaults.fog)V.scene.fog=V.fogs[Q.defaults.fog];J=Q.defaults.bgcolor;V.bgColor=new THREE.Color;V.bgColor.setRGB(J[0],J[1],J[2]);V.bgColorAlpha=Q.defaults.bgalpha;for(t in Q.geometries)if(C=Q.geometries[t],C.type=="bin_mesh"||C.type=="ascii_mesh")W+=1,e.onLoadStart();o=W;for(t in Q.geometries)C=Q.geometries[t],C.type==
+"cube"?(S=new THREE.CubeGeometry(C.width,C.height,C.depth,C.segmentsWidth,C.segmentsHeight,C.segmentsDepth,null,C.flipped,C.sides),V.geometries[t]=S):C.type=="plane"?(S=new THREE.PlaneGeometry(C.width,C.height,C.segmentsWidth,C.segmentsHeight),V.geometries[t]=S):C.type=="sphere"?(S=new THREE.SphereGeometry(C.radius,C.segmentsWidth,C.segmentsHeight),V.geometries[t]=S):C.type=="cylinder"?(S=new THREE.CylinderGeometry(C.topRad,C.botRad,C.height,C.radSegs,C.heightSegs),V.geometries[t]=S):C.type=="torus"?
+(S=new THREE.TorusGeometry(C.radius,C.tube,C.segmentsR,C.segmentsT),V.geometries[t]=S):C.type=="icosahedron"?(S=new THREE.IcosahedronGeometry(C.subdivisions),V.geometries[t]=S):C.type=="bin_mesh"?G.load({model:f(C.url,Q.urlBaseType),callback:u(t)}):C.type=="ascii_mesh"?R.load({model:f(C.url,Q.urlBaseType),callback:u(t)}):C.type=="embedded_mesh"&&(C=Q.embeds[C.id])&&R.createModel(C,p(t),"");for(A in Q.textures)if(t=Q.textures[A],t.url instanceof Array){X+=t.url.length;for(G=0;G<t.url.length;G++)e.onLoadStart()}else X+=
+1,e.onLoadStart();ea=X;for(A in Q.textures){t=Q.textures[A];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){G=[];for(var aa=0;aa<t.url.length;aa++)G[aa]=f(t.url[aa],Q.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,t.mapping,b)}else{G=THREE.ImageUtils.loadTexture(f(t.url,Q.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)G.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)G.magFilter=THREE[t.magFilter];if(t.repeat){G.repeat.set(t.repeat[0],
+t.repeat[1]);if(t.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}t.offset&&G.offset.set(t.offset[0],t.offset[1]);if(t.wrap){R={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(R[t.wrap[0]]!==void 0)G.wrapS=R[t.wrap[0]];if(R[t.wrap[1]]!==void 0)G.wrapT=R[t.wrap[1]]}}V.textures[A]=G}for(x in Q.materials){A=Q.materials[x];for(P in A.parameters)if(P=="envMap"||P=="map"||P=="lightMap")A.parameters[P]=V.textures[A.parameters[P]];else if(P=="shading")A.parameters[P]=
 A.parameters[P]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(P=="blending")A.parameters[P]=THREE[A.parameters[P]]?THREE[A.parameters[P]]:THREE.NormalBlending;else if(P=="combine")A.parameters[P]=A.parameters[P]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(P=="vertexColors")if(A.parameters[P]=="face")A.parameters[P]=THREE.FaceColors;else if(A.parameters[P])A.parameters[P]=THREE.VertexColors;if(A.parameters.opacity!==void 0&&A.parameters.opacity<1)A.parameters.transparent=
 !0;if(A.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);G=A.parameters.color;R=A.parameters.specular;C=A.parameters.ambient;H=A.parameters.shininess;b.tNormal.texture=V.textures[A.parameters.normalMap];if(A.parameters.normalMapFactor)b.uNormalScale.value=A.parameters.normalMapFactor;if(A.parameters.map)b.tDiffuse.texture=A.parameters.map,b.enableDiffuse.value=!0;if(A.parameters.lightMap)b.tAO.texture=A.parameters.lightMap,b.enableAO.value=!0;if(A.parameters.specularMap)b.tSpecular.texture=
 V.textures[A.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(G);b.uSpecularColor.value.setHex(R);b.uAmbientColor.value.setHex(C);b.uShininess.value=H;if(A.parameters.opacity)b.uOpacity.value=A.parameters.opacity;A=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else A=new THREE[A.type](A.parameters);V.materials[x]=A}n();e.callbackSync(V)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
@@ -628,15 +628,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.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,C,A=b.length;p<A;p+=k)u=b[p],v=b[p+1],C=b[p+2],u=u/16383*e,v=v/16383*e,C=C/16383*e,u+=f,v+=h,C+=m,c.vertices.push(new THREE.Vertex(new THREE.Vector3(u,v,C)))})(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,F,D,I,P=b.length;for(e=0;e<P;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;D=f;I=h;u=k;F=f;var S=h,K=k,H=m.materials[0],G=p[S*3],Y=p[S*3+1],S=p[S*3+2],E=p[K*3],Q=p[K*3+1],K=p[K*3+2];F=new THREE.Vector3(p[F*3],p[F*3+1],p[F*3+2]);S=new THREE.Vector3(G,Y,S);K=new THREE.Vector3(E,Q,K);m.faces.push(new THREE.Face3(D,I,u,[F,S,K],null,H));m=v[f*2];f=v[f*2+
-1];u=v[h*2];F=v[h*2+1];D=v[k*2];I=v[k*2+1];k=c.faceVertexUvs[0];h=u;u=F;F=[];F.push(new THREE.UV(m,f));F.push(new THREE.UV(h,u));F.push(new THREE.UV(D,I));k.push(F)}})(k[1]);this.computeCentroids();this.computeFaceNormals()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;c(new k)};
+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,F,D,J,P=b.length;for(e=0;e<P;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;D=f;J=h;u=k;F=f;var S=h,I=k,H=m.materials[0],G=p[S*3],Y=p[S*3+1],S=p[S*3+2],E=p[I*3],Q=p[I*3+1],I=p[I*3+2];F=new THREE.Vector3(p[F*3],p[F*3+1],p[F*3+2]);S=new THREE.Vector3(G,Y,S);I=new THREE.Vector3(E,Q,I);m.faces.push(new THREE.Face3(D,J,u,[F,S,I],null,H));m=v[f*2];f=v[f*2+
+1];u=v[h*2];F=v[h*2+1];D=v[k*2];J=v[k*2+1];k=c.faceVertexUvs[0];h=u;u=F;F=[];F.push(new THREE.UV(m,f));F.push(new THREE.UV(h,u));F.push(new THREE.UV(D,J));k.push(F)}})(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=
 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+
-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,y=u+this.yd+this.zd,z=0,C=this.field[m],A=this.field[u],F=this.field[p],D=this.field[t],I=this.field[v],P=this.field[x],S=this.field[w],K=this.field[y];C<k&&(z|=1);A<k&&(z|=2);F<k&&(z|=8);D<k&&(z|=4);I<k&&(z|=16);P<k&&(z|=32);S<k&&(z|=128);K<k&&(z|=64);var H=THREE.edgeTable[z];if(H==0)return 0;var G=this.delta,
-Y=b+G,E=c+G,G=h+G;H&1&&(this.compNorm(m),this.compNorm(u),this.VIntX(m*3,this.vlist,this.nlist,0,k,b,c,h,C,A));H&2&&(this.compNorm(u),this.compNorm(t),this.VIntY(u*3,this.vlist,this.nlist,3,k,Y,c,h,A,D));H&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,k,b,E,h,F,D));H&8&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,9,k,b,c,h,C,F));H&16&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,12,k,b,c,G,I,P));H&32&&(this.compNorm(x),
-this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,k,Y,c,G,P,K));H&64&&(this.compNorm(w),this.compNorm(y),this.VIntX(w*3,this.vlist,this.nlist,18,k,b,E,G,S,K));H&128&&(this.compNorm(v),this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,21,k,b,c,G,I,S));H&256&&(this.compNorm(m),this.compNorm(v),this.VIntZ(m*3,this.vlist,this.nlist,24,k,b,c,h,C,I));H&512&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*3,this.vlist,this.nlist,27,k,Y,c,h,A,P));H&1024&&(this.compNorm(t),this.compNorm(y),this.VIntZ(t*
-3,this.vlist,this.nlist,30,k,Y,E,h,D,K));H&2048&&(this.compNorm(p),this.compNorm(w),this.VIntZ(p*3,this.vlist,this.nlist,33,k,b,E,h,F,S));z<<=4;for(k=m=0;THREE.triTable[z+k]!=-1;)b=z+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+
+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,y=u+this.yd+this.zd,z=0,C=this.field[m],A=this.field[u],F=this.field[p],D=this.field[t],J=this.field[v],P=this.field[x],S=this.field[w],I=this.field[y];C<k&&(z|=1);A<k&&(z|=2);F<k&&(z|=8);D<k&&(z|=4);J<k&&(z|=16);P<k&&(z|=32);S<k&&(z|=128);I<k&&(z|=64);var H=THREE.edgeTable[z];if(H==0)return 0;var G=this.delta,
+Y=b+G,E=c+G,G=h+G;H&1&&(this.compNorm(m),this.compNorm(u),this.VIntX(m*3,this.vlist,this.nlist,0,k,b,c,h,C,A));H&2&&(this.compNorm(u),this.compNorm(t),this.VIntY(u*3,this.vlist,this.nlist,3,k,Y,c,h,A,D));H&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,k,b,E,h,F,D));H&8&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,9,k,b,c,h,C,F));H&16&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,12,k,b,c,G,J,P));H&32&&(this.compNorm(x),
+this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,k,Y,c,G,P,I));H&64&&(this.compNorm(w),this.compNorm(y),this.VIntX(w*3,this.vlist,this.nlist,18,k,b,E,G,S,I));H&128&&(this.compNorm(v),this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,21,k,b,c,G,J,S));H&256&&(this.compNorm(m),this.compNorm(v),this.VIntZ(m*3,this.vlist,this.nlist,24,k,b,c,h,C,J));H&512&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*3,this.vlist,this.nlist,27,k,Y,c,h,A,P));H&1024&&(this.compNorm(t),this.compNorm(y),this.VIntZ(t*
+3,this.vlist,this.nlist,30,k,Y,E,h,D,I));H&2048&&(this.compNorm(p),this.compNorm(w),this.VIntZ(p*3,this.vlist,this.nlist,33,k,b,E,h,F,S));z<<=4;for(k=m=0;THREE.triTable[z+k]!=-1;)b=z+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;
 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 y,z,C,A,F,D;t<u;t++){v=this.size2*t;z=t/this.size-h;F=z*z;for(z=x;z<p;z++){C=v+this.size*z;y=z/this.size-c;D=y*y;for(y=w;y<n;y++)A=y/this.size-b,A=m/(1.0E-6+A*A+D+F)-k,A>0&&(this.field[C+y]+=A)}}};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=
@@ -686,7 +686,7 @@ THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionU
 THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
 if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,m=new THREE.Camera,k=new THREE.Matrix4,n=new THREE.Matrix4,u,p,v;h.useTarget=m.useTarget=!1;h.matrixAutoUpdate=m.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.Camera(53,1,1,1E4);w.position.z=
 2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:x}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var y=new THREE.Scene;y.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(u!==e.aspect||p!==e.near||v!==e.fov){u=e.aspect;p=e.near;v=e.fov;var A=e.projectionMatrix.clone(),F=125/30*0.5,D=F*p/125,I=p*Math.tan(v*Math.PI/360),P;k.n14=F;n.n14=-F;F=-I*u+D;P=I*u+D;A.n11=2*p/(P-F);A.n13=(P+F)/(P-F);h.projectionMatrix=A.clone();F=-I*u-D;P=I*u-D;A.n11=2*p/(P-F);A.n13=
+var y=new THREE.Scene;y.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(u!==e.aspect||p!==e.near||v!==e.fov){u=e.aspect;p=e.near;v=e.fov;var A=e.projectionMatrix.clone(),F=125/30*0.5,D=F*p/125,J=p*Math.tan(v*Math.PI/360),P;k.n14=F;n.n14=-F;F=-J*u+D;P=J*u+D;A.n11=2*p/(P-F);A.n13=(P+F)/(P-F);h.projectionMatrix=A.clone();F=-J*u-D;P=J*u-D;A.n11=2*p/(P-F);A.n13=
 (P+F)/(P-F);m.projectionMatrix=A.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=p;h.far=e.far;f.call(c,b,h,t,!0);m.matrix=e.matrixWorld.clone().multiplySelf(k);m.update(null,!0);m.position.copy(e.position);m.near=p;m.far=e.far;f.call(c,b,m,x,!0);f.call(c,y,w)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,m,k=new THREE.Camera,n=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);h=b/2;m=f};this.render=function(b,e){this.clear();k.fov=e.fov;k.aspect=0.5*e.aspect;k.near=e.near;k.far=e.far;
 k.updateProjectionMatrix();k.position.copy(e.position);k.target.position.copy(e.target.position);k.translateX(c.separation);n.projectionMatrix=k.projectionMatrix;n.position.copy(e.position);n.target.position.copy(e.target.position);n.translateX(-c.separation);this.setViewport(0,0,h,m);f.call(c,b,k);this.setViewport(h,0,h,m);f.call(c,b,n,!1)}};

+ 45 - 45
build/custom/ThreeExtras.js

@@ -134,7 +134,7 @@ b(this,function(a){c&&(h=f=this.getMouseProjectionOnBall(a.clientX,a.clientY),k=
 a.stopPropagation();if(e===this.STATE.NONE)e=a.button,e===this.STATE.ROTATE?h=f=this.getMouseProjectionOnBall(a.clientX,a.clientY):e===this.STATE.ZOOM&&!this.noZoom?k=l=this.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(m=n=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",b(this,function(a){a.preventDefault();a.stopPropagation();e=this.STATE.NONE}),!1);window.addEventListener("keydown",b(this,function(a){if(e===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])e=
 this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)e=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)e=this.STATE.PAN;e!==this.STATE.NONE&&(c=!0)}}),!1);window.addEventListener("keyup",b(this,function(){if(e!==this.STATE.NONE)e=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.CubeGeometry=function(a,b,c,e,g,h,f,k,l){function m(a,c,b,f,k,l,m,o){var p,t,x=e||1,v=g||1,D=k/2,J=l/2,L=n.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")p="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")p="y",v=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")p="x",x=h||1;var N=x+1,K=v+1;k/=x;var P=l/v;for(t=0;t<K;t++)for(l=0;l<N;l++){var E=new THREE.Vector3;E[a]=(l*k-D)*b;E[c]=(t*P-J)*f;E[p]=m;n.vertices.push(new THREE.Vertex(E))}for(t=0;t<v;t++)for(l=0;l<x;l++)n.faces.push(new THREE.Face4(l+N*t+
+THREE.CubeGeometry=function(a,b,c,e,g,h,f,k,l){function m(a,c,b,f,k,l,m,o){var p,t,x=e||1,v=g||1,D=k/2,J=l/2,L=n.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")p="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")p="y",v=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")p="x",x=h||1;var N=x+1,K=v+1;k/=x;var P=l/v;for(t=0;t<K;t++)for(l=0;l<N;l++){var F=new THREE.Vector3;F[a]=(l*k-D)*b;F[c]=(t*P-J)*f;F[p]=m;n.vertices.push(new THREE.Vertex(F))}for(t=0;t<v;t++)for(l=0;l<x;l++)n.faces.push(new THREE.Face4(l+N*t+
 L,l+N*(t+1)+L,l+1+N*(t+1)+L,l+1+N*t+L,null,null,o)),n.faceVertexUvs[0].push([new THREE.UV(l/x,t/v),new THREE.UV(l/x,(t+1)/v),new THREE.UV((l+1)/x,(t+1)/v),new THREE.UV((l+1)/x,t/v)])}THREE.Geometry.call(this);var n=this,o=a/2,t=b/2,p=c/2,k=k?-1:1;if(f!==void 0)if(f instanceof Array)this.materials=f;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([f])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=void 0)for(var v in l)this.sides[v]!=void 0&&(this.sides[v]=
 l[v]);this.sides.px&&m("z","y",1*k,-1,c,b,-o,this.materials[0]);this.sides.nx&&m("z","y",-1*k,-1,c,b,o,this.materials[1]);this.sides.py&&m("x","z",1*k,1,a,c,t,this.materials[2]);this.sides.ny&&m("x","z",1*k,-1,a,c,-t,this.materials[3]);this.sides.pz&&m("x","y",1*k,-1,a,b,p,this.materials[4]);this.sides.nz&&m("x","y",-1*k,-1,a,b,-p,this.materials[5]);(function(){for(var a=[],c=[],b=0,e=n.vertices.length;b<e;b++){for(var f=n.vertices[b],h=!1,g=0,k=a.length;g<k;g++){var l=a[g];if(f.position.x==l.position.x&&
 f.position.y==l.position.y&&f.position.z==l.position.z){c[b]=g;h=!0;break}}if(!h)c[b]=a.length,a.push(new THREE.Vertex(f.position.clone()))}b=0;for(e=n.faces.length;b<e;b++)f=n.faces[b],f.a=c[f.a],f.b=c[f.b],f.c=c[f.c],f.d=c[f.d];n.vertices=a})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
@@ -147,10 +147,10 @@ THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,c,b){c||cons
 k.copy(c).addSelf(h);l.copy(b).addSelf(g);h=e.dot(g);g=l.subSelf(k).dot(g);h==0&&(console.log("Either infinite or no solutions!"),g==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=h;if(g<0)return c=Math.atan2(c.y-a.y,c.x-a.x),a=Math.atan2(b.y-a.y,b.x-a.x),c>a&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(g).addSelf(k).subSelf(a).clone()}function g(a){for(B=a.length;--B>=0;){T=B;R=B-1;R<0&&(R=a.length-
 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:
-!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,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;
+!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 G,E,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();E=0;for(I=t.length;E<I;E++)G=t[E],THREE.Shape.Utils.isClockWise(G)&&
+(t[E]=G.reverse());v=!1}v=THREE.Shape.Utils.triangulateShape(x,t);y=x;E=0;for(I=t.length;E<I;E++)G=t[E],x=x.concat(G);var B,D,J,L,N,K,P=x.length,F=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();E=0;for(I=t.length;E<I;E++){G=t[E];U=[];B=0;D=G.length;T=D-1;for(R=B+1;B<D;B++,T++,R++)T==D&&(T=0),R==D&&(R=0),U[B]=e(G[B],G[T],G[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);E=0;for(I=t.length;E<I;E++){G=t[E];U=O[E];B=0;for(D=G.length;B<D;B++)K=c(G[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);E=0;for(I=t.length;E<I;E++){G=t[E];U=O[E];
+B=0;for(D=G.length;B<D;B++)K=c(G[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<F;B++)m=v[B],f(m[2]+o,m[1]+o,m[0]+o);o=P*(p+n*2);for(B=0;B<F;B++)m=v[B],f(m[0]+o,m[1]+o,m[2]+o)}else{for(B=0;B<F;B++)m=v[B],f(m[2],m[1],m[0]);for(B=0;B<F;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;E=0;for(I=t.length;E<I;E++)G=t[E],g(G),Q+=G.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.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,
@@ -170,7 +170,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,
 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,
-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]],
+C=void 0,G=void 0,E=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,G=t[z[x]].y,E=t[z[v]].x,I=t[z[v]].y;if(1.0E-10>(C-w)*(I-A)-(G-A)*(E-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,F=void 0,S=void 0,O=void 0,U=void 0,V=void 0,B=J=N=void 0,B=E-C,D=I-G,J=w-E,L=A-I,N=C-w,K=G-A,P=H-w,F=M-A,S=H-C,O=M-G,U=H-E,V=M-I,B=B*O-D*S,N=N*F-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};
 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);
@@ -193,18 +193,18 @@ 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");
 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,
-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)],
+e,f;b=g(a,c);e=g(a,c+G);f=g(a,c+E);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+G);f=g(a,c+E);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+F);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;
-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*
+f));p.push(new THREE.UV(o,h));n.push(p)}var z=this,y=0,w,A=[],C=[],G,E,I,H,M,B,D,J,L,N,K,P,F,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;G=w.vertex_index_bytes;E=w.vertex_index_bytes*2;I=w.vertex_index_bytes*3;H=w.vertex_index_bytes*3+w.material_index_bytes;M=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;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;F=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||
+THREE.ColladaLoader=function(){function a(a,c,b){for(var a=Q.evaluate(a,Q,F,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=[];
 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,
@@ -214,26 +214,26 @@ p.material;n++}l=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.
 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.add(l)}}for(h=0;h<a.nodes.length;h++)c.add(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.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 G(a){this.id=a;this.type=null}function E(){this.name=this.id="";this.instance_effect=null}function I(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function H(a,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=
-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+/,
+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 G(c)).parse(a);return X[c]}function F(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=
-{},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 G).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],
-h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new F).parse(h);c[h.id]=h;break;case "joints":b=h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(b,c);this.parseWeights(e,c);return this};l.prototype.parseJoints=function(a,c){for(var b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new C).parse(e),f=c[e.source];if(e.semantic=="JOINT")this.joints=
+h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new G).parse(h);c[h.id]=h;break;case "joints":b=h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(b,c);this.parseWeights(e,c);return this};l.prototype.parseJoints=function(a,c){for(var b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new C).parse(e),f=c[e.source];if(e.semantic=="JOINT")this.joints=
 f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};l.prototype.parseWeights=function(a,c){for(var b,e,f=[],h=0;h<a.childNodes.length;h++){var g=a.childNodes[h];if(g.nodeType==1)switch(g.nodeName){case "input":f.push((new C).parse(g));break;case "v":b=O(g.textContent);break;case "vcount":e=O(g.textContent)}}for(h=g=0;h<e.length;h++){for(var k=e[h],l=[],m=0;m<k;m++){for(var n={},o=0;o<f.length;o++){var p=f[o],t=b[g+p.offset];switch(p.semantic){case "JOINT":n.joint=t;break;
 case "WEIGHT":n.weight=c[p.source].data[t]}}l.push(n);g+=f.length}for(m=0;m<l.length;m++)l[m].index=h;this.weights.push(l)}};m.prototype.getChildById=function(a,c){for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};m.prototype.getChildBySid=function(a,c){for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildBySid(a,c);if(e)return e}return null};m.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");
 this.nodes=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new n).parse(b))}}return this};n.prototype.getChannelForTransform=function(a){for(var c=0;c<this.channels.length;c++){var b=this.channels[c],e=b.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,g=f.indexOf("(")>=0,k;if(h)e=f.split("."),f=e.shift(),e.shift();else if(g){k=f.split("(");f=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,
 ""))}if(f==a)return 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;
-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,F,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 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],
 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};
-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)),
+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,F,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,F,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=
 (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=
@@ -241,58 +241,58 @@ k[h],source=X[l.source],m=g[e+f*k.length+l.offset],numParams=source.accessor.par
 3?y=new THREE.Face3(u[0],u[1],u[2],[v[0],v[1],v[2]],w.length?w:new THREE.Color):p==4&&(y=new THREE.Face4(u[0],u[1],u[2],u[3],[v[0],v[1],v[2],v[3]],w.length?w:new THREE.Color));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;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 "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=
+"");this.set=V(a,"set",-1);this.offset=V(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};G.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};G.prototype.read=function(){var a=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=
+16){var 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};E.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]=(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=
+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,F,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=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=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;default:console.log(e.nodeName)}}};D.prototype.parseProfileCOMMON=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 "profile_COMMON":this.parseProfileCOMMON(e);break;case "technique":c=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return c};
 D.prototype.parseTechnique=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new H(b.nodeName,this)).parse(b)}}};J.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};L.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":b=
-(new F).parse(b);this.source[b.id]=b;break;case "sampler":this.sampler.push((new K(this)).parse(b));break;case "channel":this.channel.push((new N(this)).parse(b))}}return this};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]=
+(new G).parse(b);this.source[b.id]=b;break;case "sampler":this.sampler.push((new K(this)).parse(b));break;case "channel":this.channel.push((new N(this)).parse(b))}}return this};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.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)){$=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]):
+E,"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,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(n=n.getAttribute("url").replace(/^#/,""),W=ha[n]):
 W=null;Z=new THREE.Object3D;for(n=0;n<W.nodes.length;n++)Z.add(g(W.nodes[n]));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.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]=
-new THREE.UV(w,x);e.faceVertexUvs[b][l]=y}if(p)p=A[m++]*3,g=new THREE.Vector3,g.x=C[p++],g.y=C[p++],g.z=C[p],u.normal=g;if(t)for(b=0;b<o;b++)p=A[m++]*3,g=new THREE.Vector3,g.x=C[p++],g.y=C[p++],g.z=C[p],u.vertexNormals.push(g);if(v)t=A[m++],t=new THREE.Color(F[t]),u.color=t;if(c)for(b=0;b<o;b++)t=A[m++],t=new THREE.Color(F[t]),u.vertexColors.push(t);e.faces.push(u)}}})(g);(function(){var c,b,g,l;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)g=a.skinWeights[c],l=a.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(g,
+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,G=a.colors,E=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&E++;for(b=0;b<E;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<E;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<E;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]=
+new THREE.UV(w,x);e.faceVertexUvs[b][l]=y}if(p)p=A[m++]*3,g=new THREE.Vector3,g.x=C[p++],g.y=C[p++],g.z=C[p],u.normal=g;if(t)for(b=0;b<o;b++)p=A[m++]*3,g=new THREE.Vector3,g.x=C[p++],g.y=C[p++],g.z=C[p],u.vertexNormals.push(g);if(v)t=A[m++],t=new THREE.Color(G[t]),u.color=t;if(c)for(b=0;b<o;b++)t=A[m++],t=new THREE.Color(G[t]),u.vertexColors.push(t);e.faces.push(u)}}})(g);(function(){var c,b,g,l;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)g=a.skinWeights[c],l=a.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(g,
 l,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)g=a.skinIndices[c],l=a.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(g,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,g,l,m,n,o,t,p,x;b=0;for(g=a.morphTargets.length;b<g;b++){e.morphTargets[b]={};e.morphTargets[b].name=a.morphTargets[b].name;e.morphTargets[b].vertices=[];p=e.morphTargets[b].vertices;x=a.morphTargets[b].vertices;l=0;for(m=x.length;l<m;l+=3)n=x[l]*c,o=x[l+1]*
 c,t=x[l+2]*c,p.push(new THREE.Vertex(new THREE.Vector3(n,o,t)))}}if(a.morphColors!==void 0){b=0;for(g=a.morphColors.length;b<g;b++){e.morphColors[b]={};e.morphColors[b].name=a.morphColors[b].name;e.morphColors[b].colors=[];m=e.morphColors[b].colors;n=a.morphColors[b].colors;c=0;for(l=n.length;c<l;c+=3)o=new THREE.Color(16755200),o.setRGB(n[c],n[c+1],n[c+2]),m.push(o)}}})(g);(function(){if(a.edges!==void 0){var c,b,g;for(c=0;c<a.edges.length;c+=2)b=a.edges[c],g=a.edges[c+1],e.edges.push(new THREE.Edge(e.vertices[b],
 e.vertices[g],b,g))}})();e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();b(e)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,c){return c=="relativeToHTML"?a:g+"/"+a}function k(){for(p in D.objects)if(!E.objects[p])if(y=D.objects[p],y.geometry!==void 0){if(F=E.geometries[y.geometry]){var a=!1;M=[];for(O=0;O<y.materials.length;O++)M[O]=E.materials[y.materials[O]],a=M[O]instanceof THREE.ShaderMaterial;a&&F.computeTangents();w=y.position;r=y.rotation;
-q=y.quaternion;s=y.scale;q=0;M.length==0&&(M[0]=new THREE.MeshFaceMaterial);M.length>1&&(M=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(F,M);object.name=p;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=y.visible;E.scene.add(object);E.objects[p]=object;y.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),E.scene.collisions.colliders.push(a));
-if(y.castsShadow)a=new THREE.ShadowVolume(F),E.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},E.triggers[object.name]=a)}}else w=y.position,r=y.rotation,q=y.quaternion,s=y.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=y.visible!==void 0?y.visible:!1,E.scene.add(object),E.objects[p]=object,E.empties[p]=object,y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},E.triggers[object.name]=a)}function l(a){return function(b){E.geometries[a]=b;k();L-=1;c.onLoadComplete();n()}}function m(a){return function(c){E.geometries[a]=c}}function n(){c.callbackProgress({totalModels:K,totalTextures:P,loadedModels:K-L,loadedTextures:P-N},E);c.onLoadProgress();L==0&&N==0&&b(E)}var o,t,
-p,x,v,u,z,y,w,A,C,F,G,I,H,M,B,D,J,L,N,K,P,E;D=a.data;H=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=L=0;E={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(p in D.objects)if(y=D.objects[p],y.meshCollider){a=!0;break}if(a)E.scene.collisions=new THREE.CollisionSystem;if(D.transform){a=D.transform.position;A=D.transform.rotation;var S=D.transform.scale;a&&E.scene.position.set(a[0],a[1],a[2]);A&&E.scene.rotation.set(A[0],
-A[1],A[2]);S&&E.scene.scale.set(S[0],S[1],S[2]);(a||A||S)&&E.scene.updateMatrix()}a=function(){N-=1;n();c.onLoadComplete()};for(v in D.cameras){A=D.cameras[v];if(A.type=="perspective")G=new THREE.Camera(A.fov,A.aspect,A.near,A.far);else if(A.type=="ortho")G=new THREE.Camera,G.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far);w=A.position;A=A.target;G.position.set(w[0],w[1],w[2]);G.target.position.set(A[0],A[1],A[2]);E.cameras[v]=G}for(x in D.lights)v=D.lights[x],
-G=v.color!==void 0?v.color:16777215,A=v.intensity!==void 0?v.intensity:1,v.type=="directional"?(w=v.direction,B=new THREE.DirectionalLight(G,A),B.position.set(w[0],w[1],w[2]),B.position.normalize()):v.type=="point"?(w=v.position,d=v.distance,B=new THREE.PointLight(G,A,d),B.position.set(w[0],w[1],w[2])):v.type=="ambient"&&(B=new THREE.AmbientLight(G)),E.scene.add(B),E.lights[x]=B;for(u in D.fogs)x=D.fogs[u],x.type=="linear"?I=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(I=new THREE.FogExp2(0,x.density)),
-A=x.color,I.color.setRGB(A[0],A[1],A[2]),E.fogs[u]=I;if(E.cameras&&D.defaults.camera)E.currentCamera=E.cameras[D.defaults.camera];if(E.fogs&&D.defaults.fog)E.scene.fog=E.fogs[D.defaults.fog];A=D.defaults.bgcolor;E.bgColor=new THREE.Color;E.bgColor.setRGB(A[0],A[1],A[2]);E.bgColorAlpha=D.defaults.bgalpha;for(o in D.geometries)if(u=D.geometries[o],u.type=="bin_mesh"||u.type=="ascii_mesh")L+=1,c.onLoadStart();K=L;for(o in D.geometries)u=D.geometries[o],u.type=="cube"?(F=new THREE.CubeGeometry(u.width,
-u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides),E.geometries[o]=F):u.type=="plane"?(F=new THREE.PlaneGeometry(u.width,u.height,u.segmentsWidth,u.segmentsHeight),E.geometries[o]=F):u.type=="sphere"?(F=new THREE.SphereGeometry(u.radius,u.segmentsWidth,u.segmentsHeight),E.geometries[o]=F):u.type=="cylinder"?(F=new THREE.CylinderGeometry(u.topRad,u.botRad,u.height,u.radSegs,u.heightSegs),E.geometries[o]=F):u.type=="torus"?(F=new THREE.TorusGeometry(u.radius,u.tube,
-u.segmentsR,u.segmentsT),E.geometries[o]=F):u.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(u.subdivisions),E.geometries[o]=F):u.type=="bin_mesh"?H.load({model:e(u.url,D.urlBaseType),callback:l(o)}):u.type=="ascii_mesh"?J.load({model:e(u.url,D.urlBaseType),callback:l(o)}):u.type=="embedded_mesh"&&(u=D.embeds[u.id])&&J.createModel(u,m(o),"");for(z in D.textures)if(o=D.textures[z],o.url instanceof Array){N+=o.url.length;for(H=0;H<o.url.length;H++)c.onLoadStart()}else N+=1,c.onLoadStart();P=N;
+THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,c){return c=="relativeToHTML"?a:g+"/"+a}function k(){for(p in D.objects)if(!F.objects[p])if(y=D.objects[p],y.geometry!==void 0){if(G=F.geometries[y.geometry]){var a=!1;M=[];for(O=0;O<y.materials.length;O++)M[O]=F.materials[y.materials[O]],a=M[O]instanceof THREE.ShaderMaterial;a&&G.computeTangents();w=y.position;r=y.rotation;
+q=y.quaternion;s=y.scale;q=0;M.length==0&&(M[0]=new THREE.MeshFaceMaterial);M.length>1&&(M=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(G,M);object.name=p;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=y.visible;F.scene.add(object);F.objects[p]=object;y.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),F.scene.collisions.colliders.push(a));
+if(y.castsShadow)a=new THREE.ShadowVolume(G),F.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},F.triggers[object.name]=a)}}else w=y.position,r=y.rotation,q=y.quaternion,s=y.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
+s[1],s[2]),object.visible=y.visible!==void 0?y.visible:!1,F.scene.add(object),F.objects[p]=object,F.empties[p]=object,y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},F.triggers[object.name]=a)}function l(a){return function(b){F.geometries[a]=b;k();L-=1;c.onLoadComplete();n()}}function m(a){return function(c){F.geometries[a]=c}}function n(){c.callbackProgress({totalModels:K,totalTextures:P,loadedModels:K-L,loadedTextures:P-N},F);c.onLoadProgress();L==0&&N==0&&b(F)}var o,t,
+p,x,v,u,z,y,w,A,C,G,E,I,H,M,B,D,J,L,N,K,P,F;D=a.data;H=new THREE.BinaryLoader;J=new THREE.JSONLoader;N=L=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(p in D.objects)if(y=D.objects[p],y.meshCollider){a=!0;break}if(a)F.scene.collisions=new THREE.CollisionSystem;if(D.transform){a=D.transform.position;A=D.transform.rotation;var S=D.transform.scale;a&&F.scene.position.set(a[0],a[1],a[2]);A&&F.scene.rotation.set(A[0],
+A[1],A[2]);S&&F.scene.scale.set(S[0],S[1],S[2]);(a||A||S)&&F.scene.updateMatrix()}a=function(){N-=1;n();c.onLoadComplete()};for(v in D.cameras){A=D.cameras[v];if(A.type=="perspective")E=new THREE.Camera(A.fov,A.aspect,A.near,A.far),E.useTarget=!0;else if(A.type=="ortho")E=new THREE.Camera,E.useTarget=!0,E.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far);w=A.position;A=A.target;E.position.set(w[0],w[1],w[2]);E.target.position.set(A[0],A[1],A[2]);F.cameras[v]=E}for(x in D.lights)v=
+D.lights[x],E=v.color!==void 0?v.color:16777215,A=v.intensity!==void 0?v.intensity:1,v.type=="directional"?(w=v.direction,B=new THREE.DirectionalLight(E,A),B.position.set(w[0],w[1],w[2]),B.position.normalize()):v.type=="point"?(w=v.position,d=v.distance,B=new THREE.PointLight(E,A,d),B.position.set(w[0],w[1],w[2])):v.type=="ambient"&&(B=new THREE.AmbientLight(E)),F.scene.add(B),F.lights[x]=B;for(u in D.fogs)x=D.fogs[u],x.type=="linear"?I=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(I=new THREE.FogExp2(0,
+x.density)),A=x.color,I.color.setRGB(A[0],A[1],A[2]),F.fogs[u]=I;if(F.cameras&&D.defaults.camera)F.currentCamera=F.cameras[D.defaults.camera];if(F.fogs&&D.defaults.fog)F.scene.fog=F.fogs[D.defaults.fog];A=D.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(A[0],A[1],A[2]);F.bgColorAlpha=D.defaults.bgalpha;for(o in D.geometries)if(u=D.geometries[o],u.type=="bin_mesh"||u.type=="ascii_mesh")L+=1,c.onLoadStart();K=L;for(o in D.geometries)u=D.geometries[o],u.type=="cube"?(G=new THREE.CubeGeometry(u.width,
+u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides),F.geometries[o]=G):u.type=="plane"?(G=new THREE.PlaneGeometry(u.width,u.height,u.segmentsWidth,u.segmentsHeight),F.geometries[o]=G):u.type=="sphere"?(G=new THREE.SphereGeometry(u.radius,u.segmentsWidth,u.segmentsHeight),F.geometries[o]=G):u.type=="cylinder"?(G=new THREE.CylinderGeometry(u.topRad,u.botRad,u.height,u.radSegs,u.heightSegs),F.geometries[o]=G):u.type=="torus"?(G=new THREE.TorusGeometry(u.radius,u.tube,
+u.segmentsR,u.segmentsT),F.geometries[o]=G):u.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(u.subdivisions),F.geometries[o]=G):u.type=="bin_mesh"?H.load({model:e(u.url,D.urlBaseType),callback:l(o)}):u.type=="ascii_mesh"?J.load({model:e(u.url,D.urlBaseType),callback:l(o)}):u.type=="embedded_mesh"&&(u=D.embeds[u.id])&&J.createModel(u,m(o),"");for(z in D.textures)if(o=D.textures[z],o.url instanceof Array){N+=o.url.length;for(H=0;H<o.url.length;H++)c.onLoadStart()}else N+=1,c.onLoadStart();P=N;
 for(z in D.textures){o=D.textures[z];if(o.mapping!=void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];if(o.url instanceof Array){H=[];for(var O=0;O<o.url.length;O++)H[O]=e(o.url[O],D.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,o.mapping,a)}else{H=THREE.ImageUtils.loadTexture(e(o.url,D.urlBaseType),o.mapping,a);if(THREE[o.minFilter]!=void 0)H.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)H.magFilter=THREE[o.magFilter];if(o.repeat){H.repeat.set(o.repeat[0],o.repeat[1]);
-if(o.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=1)H.wrapT=THREE.RepeatWrapping}o.offset&&H.offset.set(o.offset[0],o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)H.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)H.wrapT=J[o.wrap[1]]}}E.textures[z]=H}for(t in D.materials){z=D.materials[t];for(C in z.parameters)if(C=="envMap"||C=="map"||C=="lightMap")z.parameters[C]=E.textures[z.parameters[C]];else if(C=="shading")z.parameters[C]=
+if(o.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=1)H.wrapT=THREE.RepeatWrapping}o.offset&&H.offset.set(o.offset[0],o.offset[1]);if(o.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[o.wrap[0]]!==void 0)H.wrapS=J[o.wrap[0]];if(J[o.wrap[1]]!==void 0)H.wrapT=J[o.wrap[1]]}}F.textures[z]=H}for(t in D.materials){z=D.materials[t];for(C in z.parameters)if(C=="envMap"||C=="map"||C=="lightMap")z.parameters[C]=F.textures[z.parameters[C]];else if(C=="shading")z.parameters[C]=
 z.parameters[C]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(C=="blending")z.parameters[C]=THREE[z.parameters[C]]?THREE[z.parameters[C]]:THREE.NormalBlending;else if(C=="combine")z.parameters[C]=z.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(C=="vertexColors")if(z.parameters[C]=="face")z.parameters[C]=THREE.FaceColors;else if(z.parameters[C])z.parameters[C]=THREE.VertexColors;if(z.parameters.opacity!==void 0&&z.parameters.opacity<1)z.parameters.transparent=
-!0;if(z.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(o.uniforms);H=z.parameters.color;J=z.parameters.specular;u=z.parameters.ambient;I=z.parameters.shininess;a.tNormal.texture=E.textures[z.parameters.normalMap];if(z.parameters.normalMapFactor)a.uNormalScale.value=z.parameters.normalMapFactor;if(z.parameters.map)a.tDiffuse.texture=z.parameters.map,a.enableDiffuse.value=!0;if(z.parameters.lightMap)a.tAO.texture=z.parameters.lightMap,a.enableAO.value=!0;if(z.parameters.specularMap)a.tSpecular.texture=
-E.textures[z.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(H);a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(u);a.uShininess.value=I;if(z.parameters.opacity)a.uOpacity.value=z.parameters.opacity;z=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else z=new THREE[z.type](z.parameters);E.materials[t]=z}k();c.callbackSync(E)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
+!0;if(z.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(o.uniforms);H=z.parameters.color;J=z.parameters.specular;u=z.parameters.ambient;I=z.parameters.shininess;a.tNormal.texture=F.textures[z.parameters.normalMap];if(z.parameters.normalMapFactor)a.uNormalScale.value=z.parameters.normalMapFactor;if(z.parameters.map)a.tDiffuse.texture=z.parameters.map,a.enableDiffuse.value=!0;if(z.parameters.lightMap)a.tAO.texture=z.parameters.lightMap,a.enableAO.value=!0;if(z.parameters.specularMap)a.tSpecular.texture=
+F.textures[z.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(H);a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(u);a.uShininess.value=I;if(z.parameters.opacity)a.uOpacity.value=z.parameters.opacity;z=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else z=new THREE[z.type](z.parameters);F.materials[t]=z}k();c.callbackSync(F)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
 THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a){var b=new XMLHttpRequest,c=a.model,e=a.callback,g=a.scale!==void 0?a.scale:1,h=a.offsetX!==void 0?a.offsetX:0,f=a.offsetY!==void 0?a.offsetY:0,k=a.offsetZ!==void 0?a.offsetZ:0;b.onreadystatechange=function(){b.readyState==4?b.status==200||b.status==0?THREE.UTF8Loader.prototype.createModel(b.responseText,e,g,h,f,k):alert("Couldn't load ["+c+"] ["+b.status+"]"):b.readyState!=3&&b.readyState==2&&b.getResponseHeader("Content-Length")};b.open("GET",c,!0);b.send(null)};
 THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),e=1,g=0;g<8;g++){for(var h=0,f=0;f<b;++f){var k=a.charCodeAt(f+e);h+=k>>1^-(k&1);c[8*f+g]=h}e+=b}b=a.length-e;h=new Uint16Array(b);for(g=f=0;g<b;g++)k=a.charCodeAt(g+e),h[g]=f-k,k==0&&f++;return[c,h]};
 THREE.UTF8Loader.prototype.createModel=function(a,b,c,e,g,h){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],n=[];(function(a,f,l){for(var m,n,u,z=a.length;l<z;l+=f)m=a[l],n=a[l+1],u=a[l+2],m=m/16383*c,n=n/16383*c,u=u/16383*c,m+=e,n+=g,u+=h,b.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,u)))})(f[0],8,0);(function(a,c,b){for(var e,f,g=a.length;b<g;b+=c)e=a[b],f=a[b+1],e/=1023,f/=1023,n.push(e,1-f)})(f[0],8,3);(function(a,
-c,b){for(var e,f,g,h=a.length;b<h;b+=c)e=a[b],f=a[b+1],g=a[b+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,m.push(e,f,g)})(f[0],8,5);(function(a){var c,e,f,g,h,l,y,w,A,C=a.length;for(c=0;c<C;c+=3){e=a[c];f=a[c+1];g=a[c+2];h=b;w=e;A=f;l=g;y=e;var F=f,G=g,I=h.materials[0],H=m[F*3],M=m[F*3+1],F=m[F*3+2],B=m[G*3],D=m[G*3+1],G=m[G*3+2];y=new THREE.Vector3(m[y*3],m[y*3+1],m[y*3+2]);F=new THREE.Vector3(H,M,F);G=new THREE.Vector3(B,D,G);h.faces.push(new THREE.Face3(w,A,l,[y,F,G],null,I));h=n[e*2];e=n[e*2+
+c,b){for(var e,f,g,h=a.length;b<h;b+=c)e=a[b],f=a[b+1],g=a[b+2],e=(e-512)/511,f=(f-512)/511,g=(g-512)/511,m.push(e,f,g)})(f[0],8,5);(function(a){var c,e,f,g,h,l,y,w,A,C=a.length;for(c=0;c<C;c+=3){e=a[c];f=a[c+1];g=a[c+2];h=b;w=e;A=f;l=g;y=e;var G=f,E=g,I=h.materials[0],H=m[G*3],M=m[G*3+1],G=m[G*3+2],B=m[E*3],D=m[E*3+1],E=m[E*3+2];y=new THREE.Vector3(m[y*3],m[y*3+1],m[y*3+2]);G=new THREE.Vector3(H,M,G);E=new THREE.Vector3(B,D,E);h.faces.push(new THREE.Face3(w,A,l,[y,G,E],null,I));h=n[e*2];e=n[e*2+
 1];l=n[f*2];y=n[f*2+1];w=n[g*2];A=n[g*2+1];g=b.faceVertexUvs[0];f=l;l=y;y=[];y.push(new THREE.UV(h,e));y.push(new THREE.UV(f,l));y.push(new THREE.UV(w,A));g.push(y)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,g){return a+(b-a)*g};this.VIntX=function(a,b,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;b[h]=k+f*this.delta;b[h+1]=l;b[h+2]=m;g[h]=this.lerp(n[a],n[a+3],f);g[h+1]=this.lerp(n[a+1],n[a+4],f);g[h+2]=this.lerp(n[a+2],n[a+5],f)};this.VIntY=function(a,b,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;b[h]=k;b[h+1]=l+f*this.delta;b[h+
 2]=m;b=a+this.yd*3;g[h]=this.lerp(n[a],n[b],f);g[h+1]=this.lerp(n[a+1],n[b+1],f);g[h+2]=this.lerp(n[a+2],n[b+2],f)};this.VIntZ=function(a,b,g,h,f,k,l,m,n,o){f=(f-n)/(o-n);n=this.normal_cache;b[h]=k;b[h+1]=l;b[h+2]=m+f*this.delta;b=a+this.zd*3;g[h]=this.lerp(n[a],n[b],f);g[h+1]=this.lerp(n[a+1],n[b+1],f);g[h+2]=this.lerp(n[a+2],n[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]==0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+
-this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,g,h,f,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,t=l+this.zd,p=h+this.yd+this.zd,x=l+this.yd+this.zd,v=0,u=this.field[h],z=this.field[l],y=this.field[m],w=this.field[o],A=this.field[n],C=this.field[t],F=this.field[p],G=this.field[x];u<f&&(v|=1);z<f&&(v|=2);y<f&&(v|=8);w<f&&(v|=4);A<f&&(v|=16);C<f&&(v|=32);F<f&&(v|=128);G<f&&(v|=64);var I=THREE.edgeTable[v];if(I==0)return 0;var H=this.delta,
+this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,g,h,f,k){var l=h+1,m=h+this.yd,n=h+this.zd,o=l+this.yd,t=l+this.zd,p=h+this.yd+this.zd,x=l+this.yd+this.zd,v=0,u=this.field[h],z=this.field[l],y=this.field[m],w=this.field[o],A=this.field[n],C=this.field[t],G=this.field[p],E=this.field[x];u<f&&(v|=1);z<f&&(v|=2);y<f&&(v|=8);w<f&&(v|=4);A<f&&(v|=16);C<f&&(v|=32);G<f&&(v|=128);E<f&&(v|=64);var I=THREE.edgeTable[v];if(I==0)return 0;var H=this.delta,
 M=a+H,B=b+H,H=g+H;I&1&&(this.compNorm(h),this.compNorm(l),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,b,g,u,z));I&2&&(this.compNorm(l),this.compNorm(o),this.VIntY(l*3,this.vlist,this.nlist,3,f,M,b,g,z,w));I&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,f,a,B,g,y,w));I&8&&(this.compNorm(h),this.compNorm(m),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,b,g,u,y));I&16&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,12,f,a,b,H,A,C));I&32&&(this.compNorm(t),
-this.compNorm(x),this.VIntY(t*3,this.vlist,this.nlist,15,f,M,b,H,C,G));I&64&&(this.compNorm(p),this.compNorm(x),this.VIntX(p*3,this.vlist,this.nlist,18,f,a,B,H,F,G));I&128&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,21,f,a,b,H,A,F));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,b,g,u,A));I&512&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,27,f,M,b,g,z,C));I&1024&&(this.compNorm(o),this.compNorm(x),this.VIntZ(o*
-3,this.vlist,this.nlist,30,f,M,B,g,w,G));I&2048&&(this.compNorm(m),this.compNorm(p),this.VIntZ(m*3,this.vlist,this.nlist,33,f,a,B,g,y,F));v<<=4;for(f=h=0;THREE.triTable[v+f]!=-1;)a=v+f,b=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[g],k),f+=3,h++;return h};this.posnormtriv=function(a,b,g,h,f,k){var l=this.count*3;this.positionArray[l]=a[g];this.positionArray[l+1]=a[g+1];this.positionArray[l+2]=a[g+2];this.positionArray[l+3]=a[h];this.positionArray[l+
+this.compNorm(x),this.VIntY(t*3,this.vlist,this.nlist,15,f,M,b,H,C,E));I&64&&(this.compNorm(p),this.compNorm(x),this.VIntX(p*3,this.vlist,this.nlist,18,f,a,B,H,G,E));I&128&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,21,f,a,b,H,A,G));I&256&&(this.compNorm(h),this.compNorm(n),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,b,g,u,A));I&512&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,27,f,M,b,g,z,C));I&1024&&(this.compNorm(o),this.compNorm(x),this.VIntZ(o*
+3,this.vlist,this.nlist,30,f,M,B,g,w,E));I&2048&&(this.compNorm(m),this.compNorm(p),this.VIntZ(m*3,this.vlist,this.nlist,33,f,a,B,g,y,G));v<<=4;for(f=h=0;THREE.triTable[v+f]!=-1;)a=v+f,b=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[g],k),f+=3,h++;return h};this.posnormtriv=function(a,b,g,h,f,k){var l=this.count*3;this.positionArray[l]=a[g];this.positionArray[l+1]=a[g+1];this.positionArray[l+2]=a[g+2];this.positionArray[l+3]=a[h];this.positionArray[l+
 4]=a[h+1];this.positionArray[l+5]=a[h+2];this.positionArray[l+6]=a[f];this.positionArray[l+7]=a[f+1];this.positionArray[l+8]=a[f+2];this.normalArray[l]=b[g];this.normalArray[l+1]=b[g+1];this.normalArray[l+2]=b[g+2];this.normalArray[l+3]=b[h];this.normalArray[l+4]=b[h+1];this.normalArray[l+5]=b[h+2];this.normalArray[l+6]=b[f];this.normalArray[l+7]=b[f+1];this.normalArray[l+8]=b[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;
 this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,g,h,f){var k=this.size*Math.sqrt(h/f),l=g*this.size,m=b*this.size,n=a*this.size,o=Math.floor(l-k);o<1&&(o=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var p=Math.floor(n-k);p<1&&(p=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size-
 1);for(var x,v,u,z,y,w;o<l;o++){n=this.size2*o;v=o/this.size-g;y=v*v;for(v=t;v<m;v++){u=n+this.size*v;x=v/this.size-b;w=x*x;for(x=p;x<k;x++)z=x/this.size-a,z=h/(1.0E-6+z*z+w+y)-f,z>0&&(this.field[u+x]+=z)}}};this.addPlaneX=function(a,b){var g,h,f,k,l,m=this.size,n=this.yd,o=this.zd,t=this.field,p=m*Math.sqrt(a/b);p>m&&(p=m);for(g=0;g<p;g++)if(h=g/m,h*=h,k=a/(1.0E-4+h)-b,k>0)for(h=0;h<m;h++){l=g+h*n;for(f=0;f<m;f++)t[o*f+l]+=k}};this.addPlaneY=function(a,b){var g,h,f,k,l,m,n=this.size,o=this.yd,t=

+ 29 - 29
build/custom/ThreeWebGL.js

@@ -57,12 +57,12 @@ this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeCh
 THREE.Projector=function(){function b(){var b=m[k]=m[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,e=1,f=b.z+b.w,i=c.z+c.w,h=-b.z+b.w,j=-c.z+c.w;return f>=0&&i>=0&&h>=0&&j>=0?!0:f<0&&i<0||h<0&&j<0?!1:(f<0?d=Math.max(d,f/(f-i)):i<0&&(e=Math.min(e,f/(f-i))),h<0?d=Math.max(d,h/(h-j)):j<0&&(e=Math.min(e,h/(h-j))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,i,h=[],j,k,m=[],n,q,p=[],t,v=[],B,x,E=[],F,wa,xa=[],qa=[],ra=[],ja=new THREE.Vector4,
 G=new THREE.Vector4,u=new THREE.Matrix4,S=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],T=new THREE.Vector4,Z=new THREE.Vector4;this.projectVector=function(b,c){u.multiply(c.projectionMatrix,c.matrixWorldInverse);u.multiplyVector3(b);return b};this.unprojectVector=function(b,c){u.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));u.multiplyVector3(b);return b};this.projectObjects=function(b,d,j){var e,
 k;i=qa.length=0;e=b.objects;b=0;for(d=e.length;b<d;b++){k=e[b];var n;if(!(n=!k.visible))if(n=k instanceof THREE.Mesh)if(n=k.frustumCulled){a:{n=void 0;for(var m=k.matrixWorld,q=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),p=0;p<6;p++)if(n=L[p].x*m.n14+L[p].y*m.n24+L[p].z*m.n34+L[p].w,n<=q){n=!1;break a}n=!0}n=!n}if(!n)n=h[i]=h[i]||new THREE.RenderableObject,i++,f=n,ja.copy(k.position),u.multiplyVector3(ja),f.object=k,f.z=ja.z,qa.push(f)}j&&qa.sort(c);return qa};
-this.projectScene=function(f,i,h){var e=i.near,qa=i.far,ja,va,U,na,J,$,N,ka,sa,Q,Aa,Ja,Ta,Ka,Ba,Ea,za;wa=x=t=q=ra.length=0;i.matrixAutoUpdate&&i.update(void 0,!0);f.update(void 0,!1,i);u.multiply(i.projectionMatrix,i.matrixWorldInverse);L[0].set(u.n41-u.n11,u.n42-u.n12,u.n43-u.n13,u.n44-u.n14);L[1].set(u.n41+u.n11,u.n42+u.n12,u.n43+u.n13,u.n44+u.n14);L[2].set(u.n41+u.n21,u.n42+u.n22,u.n43+u.n23,u.n44+u.n24);L[3].set(u.n41-u.n21,u.n42-u.n22,u.n43-u.n23,u.n44-u.n24);L[4].set(u.n41-u.n31,u.n42-u.n32,
-u.n43-u.n33,u.n44-u.n34);L[5].set(u.n41+u.n31,u.n42+u.n32,u.n43+u.n33,u.n44+u.n34);for(ja=0;ja<6;ja++)sa=L[ja],sa.divideScalar(Math.sqrt(sa.x*sa.x+sa.y*sa.y+sa.z*sa.z));sa=this.projectObjects(f,i,!0);f=0;for(ja=sa.length;f<ja;f++)if(Q=sa[f].object,Q.visible)if(Aa=Q.matrixWorld,Ja=Q.matrixRotationWorld,Ta=Q.materials,Ka=Q.overdraw,k=0,Q instanceof THREE.Mesh){Ba=Q.geometry;na=Ba.vertices;Ea=Ba.faces;Ba=Ba.faceVertexUvs;va=0;for(U=na.length;va<U;va++)j=b(),j.positionWorld.copy(na[va].position),Aa.multiplyVector3(j.positionWorld),
-j.positionScreen.copy(j.positionWorld),u.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>e&&j.positionScreen.z<qa;na=0;for(va=Ea.length;na<va;na++){U=Ea[na];if(U instanceof THREE.Face3)if(J=m[U.a],$=m[U.b],N=m[U.c],J.visible&&$.visible&&N.visible&&(Q.doubleSided||Q.flipSided!=(N.positionScreen.x-J.positionScreen.x)*($.positionScreen.y-J.positionScreen.y)-(N.positionScreen.y-J.positionScreen.y)*($.positionScreen.x-
+this.projectScene=function(f,i,h){var e=i.near,qa=i.far,ja,va,U,W,J,$,N,ka,sa,Q,Aa,Ja,Ta,Ka,Ba,Ea,za;wa=x=t=q=ra.length=0;i.matrixAutoUpdate&&i.update(void 0,!0);f.update(void 0,!1,i);u.multiply(i.projectionMatrix,i.matrixWorldInverse);L[0].set(u.n41-u.n11,u.n42-u.n12,u.n43-u.n13,u.n44-u.n14);L[1].set(u.n41+u.n11,u.n42+u.n12,u.n43+u.n13,u.n44+u.n14);L[2].set(u.n41+u.n21,u.n42+u.n22,u.n43+u.n23,u.n44+u.n24);L[3].set(u.n41-u.n21,u.n42-u.n22,u.n43-u.n23,u.n44-u.n24);L[4].set(u.n41-u.n31,u.n42-u.n32,
+u.n43-u.n33,u.n44-u.n34);L[5].set(u.n41+u.n31,u.n42+u.n32,u.n43+u.n33,u.n44+u.n34);for(ja=0;ja<6;ja++)sa=L[ja],sa.divideScalar(Math.sqrt(sa.x*sa.x+sa.y*sa.y+sa.z*sa.z));sa=this.projectObjects(f,i,!0);f=0;for(ja=sa.length;f<ja;f++)if(Q=sa[f].object,Q.visible)if(Aa=Q.matrixWorld,Ja=Q.matrixRotationWorld,Ta=Q.materials,Ka=Q.overdraw,k=0,Q instanceof THREE.Mesh){Ba=Q.geometry;W=Ba.vertices;Ea=Ba.faces;Ba=Ba.faceVertexUvs;va=0;for(U=W.length;va<U;va++)j=b(),j.positionWorld.copy(W[va].position),Aa.multiplyVector3(j.positionWorld),
+j.positionScreen.copy(j.positionWorld),u.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>e&&j.positionScreen.z<qa;W=0;for(va=Ea.length;W<va;W++){U=Ea[W];if(U instanceof THREE.Face3)if(J=m[U.a],$=m[U.b],N=m[U.c],J.visible&&$.visible&&N.visible&&(Q.doubleSided||Q.flipSided!=(N.positionScreen.x-J.positionScreen.x)*($.positionScreen.y-J.positionScreen.y)-(N.positionScreen.y-J.positionScreen.y)*($.positionScreen.x-
 J.positionScreen.x)<0))ka=p[q]=p[q]||new THREE.RenderableFace3,q++,n=ka,n.v1.copy(J),n.v2.copy($),n.v3.copy(N);else continue;else if(U instanceof THREE.Face4)if(J=m[U.a],$=m[U.b],N=m[U.c],ka=m[U.d],J.visible&&$.visible&&N.visible&&ka.visible&&(Q.doubleSided||Q.flipSided!=((ka.positionScreen.x-J.positionScreen.x)*($.positionScreen.y-J.positionScreen.y)-(ka.positionScreen.y-J.positionScreen.y)*($.positionScreen.x-J.positionScreen.x)<0||($.positionScreen.x-N.positionScreen.x)*(ka.positionScreen.y-N.positionScreen.y)-
 ($.positionScreen.y-N.positionScreen.y)*(ka.positionScreen.x-N.positionScreen.x)<0)))za=v[t]=v[t]||new THREE.RenderableFace4,t++,n=za,n.v1.copy(J),n.v2.copy($),n.v3.copy(N),n.v4.copy(ka);else continue;n.normalWorld.copy(U.normal);Ja.multiplyVector3(n.normalWorld);n.centroidWorld.copy(U.centroid);Aa.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);u.multiplyVector3(n.centroidScreen);N=U.vertexNormals;J=0;for($=N.length;J<$;J++)ka=n.vertexNormalsWorld[J],ka.copy(N[J]),Ja.multiplyVector3(ka);
-J=0;for($=Ba.length;J<$;J++)if(za=Ba[J][na]){N=0;for(ka=za.length;N<ka;N++)n.uvs[J][N]=za[N]}n.meshMaterials=Ta;n.faceMaterials=U.materials;n.overdraw=Ka;n.z=n.centroidScreen.z;ra.push(n)}}else if(Q instanceof THREE.Line){S.multiply(u,Aa);na=Q.geometry.vertices;J=b();J.positionScreen.copy(na[0].position);S.multiplyVector4(J.positionScreen);va=1;for(U=na.length;va<U;va++)if(J=b(),J.positionScreen.copy(na[va].position),S.multiplyVector4(J.positionScreen),$=m[k-2],T.copy(J.positionScreen),Z.copy($.positionScreen),
+J=0;for($=Ba.length;J<$;J++)if(za=Ba[J][W]){N=0;for(ka=za.length;N<ka;N++)n.uvs[J][N]=za[N]}n.meshMaterials=Ta;n.faceMaterials=U.materials;n.overdraw=Ka;n.z=n.centroidScreen.z;ra.push(n)}}else if(Q instanceof THREE.Line){S.multiply(u,Aa);W=Q.geometry.vertices;J=b();J.positionScreen.copy(W[0].position);S.multiplyVector4(J.positionScreen);va=1;for(U=W.length;va<U;va++)if(J=b(),J.positionScreen.copy(W[va].position),S.multiplyVector4(J.positionScreen),$=m[k-2],T.copy(J.positionScreen),Z.copy($.positionScreen),
 d(T,Z))T.multiplyScalar(1/T.w),Z.multiplyScalar(1/Z.w),Aa=E[x]=E[x]||new THREE.RenderableLine,x++,B=Aa,B.v1.positionScreen.copy(T),B.v2.positionScreen.copy(Z),B.z=Math.max(T.z,Z.z),B.materials=Q.materials,ra.push(B)}else if(Q instanceof THREE.Particle&&(G.set(Q.matrixWorld.n14,Q.matrixWorld.n24,Q.matrixWorld.n34,1),u.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))Aa=xa[wa]=xa[wa]||new THREE.RenderableParticle,wa++,F=Aa,F.x=G.x/G.w,F.y=G.y/G.w,F.z=G.z,F.rotation=Q.rotation.z,F.scale.x=Q.scale.x*Math.abs(F.x-
 (G.x+i.projectionMatrix.n11)/(G.w+i.projectionMatrix.n14)),F.scale.y=Q.scale.y*Math.abs(F.y-(G.y+i.projectionMatrix.n22)/(G.w+i.projectionMatrix.n24)),F.materials=Q.materials,ra.push(F);h&&ra.sort(c);return ra}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==void 0?f:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=Math.PI/360,d=b.x*c,f=b.y*c,i=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-i),i=Math.sin(-i),h=Math.cos(d),d=Math.sin(d),j=b*c,k=f*i;this.w=j*h-k*d;this.x=j*d+k*h;this.y=f*c*h+b*i*d;this.z=b*i*h-f*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,f=Math.sin(d);
@@ -193,7 +193,7 @@ k);else if(C=="v3v"){if(!m._array)m._array=new Float32Array(3*k.length);C=0;for(
 k),p=m.texture)if(p.image instanceof Array&&p.image.length==6){if(m=p,m.image.length==6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+k);e.bindTexture(e.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(k=0;k<6;k++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,m.image[k]);u(e.TEXTURE_CUBE_MAP,m,m.image[0]);m.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else p instanceof
 THREE.WebGLRenderTargetCube?(m=p,e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,m.__webglTexture)):S(p,k)}else if(C=="tv"){if(!m._array){m._array=[];C=0;for(q=m.texture.length;C<q;C++)m._array[C]=k+C}e.uniform1iv(p,m._array);C=0;for(q=m.texture.length;C<q;C++)(p=m.texture[C])&&S(p,m._array[C])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&e.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof
 THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&j.viewMatrix!==null&&e.uniformMatrix4fv(j.viewMatrix,!1,Wa);f.skinning&&(e.uniformMatrix4fv(j.cameraInverseMatrix,!1,Wa),e.uniformMatrix4fv(j.boneGlobalMatrices,!1,i.boneMatrices))}e.uniformMatrix4fv(j.modelViewMatrix,!1,i._modelViewMatrixArray);j.normalMatrix&&e.uniformMatrix3fv(j.normalMatrix,!1,i._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||i.receiveShadow)&&
-j.objectMatrix!==null&&e.uniformMatrix4fv(j.objectMatrix,!1,i._objectMatrixArray);return h}function f(b,c,f,i,h,j){if(i.opacity!=0){var k,f=d(b,c,f,i,j),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=na&&(na=f,c=!0);if(!i.morphTargets&&b.position>=0)c&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(j.morphTargetBase){f=i.program.attributes;j.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),
+j.objectMatrix!==null&&e.uniformMatrix4fv(j.objectMatrix,!1,i._objectMatrixArray);return h}function f(b,c,f,i,h,j){if(i.opacity!=0){var k,f=d(b,c,f,i,j),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=W&&(W=f,c=!0);if(!i.morphTargets&&b.position>=0)c&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(j.morphTargetBase){f=i.program.attributes;j.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),
 e.vertexAttribPointer(f.position,3,e.FLOAT,!1,0,0)):f.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(f.position,3,e.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var n=0,y=j.morphTargetForcedOrder,m=j.morphTargetInfluences;n<i.numSupportedMorphTargets&&n<y.length;)e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[y[n]]),e.vertexAttribPointer(f["morphTarget"+n],3,e.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[n]=m[y[n]],n++;else{var y=[],p=-1,
 q=0,m=j.morphTargetInfluences,t,C=m.length,n=0;for(j.morphTargetBase!==-1&&(y[j.morphTargetBase]=!0);n<i.numSupportedMorphTargets;){for(t=0;t<C;t++)!y[t]&&m[t]>p&&(q=t,p=m[q]);e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[q]);e.vertexAttribPointer(f["morphTarget"+n],3,e.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[n]=p;y[q]=1;p=-1;n++}}i.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(i.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(k in h.__webglCustomAttributes)b[k]>=
 0&&(f=h.__webglCustomAttributes[k],e.bindBuffer(e.ARRAY_BUFFER,f.buffer),e.vertexAttribPointer(b[k],f.size,e.FLOAT,!1,0,0));b.color>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,
@@ -205,17 +205,17 @@ b.__webglNormalBuffer);if(d==THREE.FlatShading){var f,h,i,j,k,y,n,m,p,q,C=b.coun
 0,b.count);b.count=0}function h(b){if($!=b.doubleSided)b.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),$=b.doubleSided;if(N!=b.flipSided)b.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),N=b.flipSided}function j(b){sa!=b&&(b?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),sa=b)}function k(b){Q!=b&&(e.depthMask(b),Q=b)}function m(b,c,d){Aa!=b&&(b?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),Aa=b);if(b&&(Ja!=c||Ta!=d))e.polygonOffset(c,d),Ja=c,Ta=d}function n(b){aa[0].set(b.n41-
 b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);aa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);aa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);aa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);aa[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);aa[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=aa[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function q(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,
 Math.max(b.scale.y,b.scale.z)),d=0;d<6;d++)if(b=aa[d].x*c.n14+aa[d].y*c.n24+aa[d].z*c.n34+aa[d].w,b<=e)return!1;return!0}function p(b,c){b.list[b.count]=c;b.count+=1}function t(b){var c,e,d=b.object,f=b.opaque,h=b.transparent;h.count=0;b=f.count=0;for(c=d.materials.length;b<c;b++)e=d.materials[b],e.transparent?p(h,e):p(f,e)}function v(b){var c,e,d,f,h=b.object,i=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(d=h.materials.length;b<d;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=
-0;for(e=i.materials.length;c<e;c++)(f=i.materials[c])&&(f.transparent?p(k,f):p(j,f))}else(f=c)&&(f.transparent?p(k,f):p(j,f))}function B(b,c){return c.z-b.z}function x(b){var c,k,m,I=0,p,t,r,y,u=b.lights;X||(X=new THREE.Camera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));c=0;for(k=u.length;c<k;c++)if(m=u[c],m instanceof THREE.SpotLight&&m.castShadow){U=-1;M.shadowMap[I]||(M.shadowMap[I]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,{minFilter:THREE.LinearFilter,
-magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Ua[I]||(Ua[I]=new THREE.Matrix4);p=M.shadowMap[I];t=Ua[I];X.position.copy(m.position);X.target.position.copy(m.target.position);X.update(void 0,!0);b.update(void 0,!1,X);t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiplySelf(X.projectionMatrix);t.multiplySelf(X.matrixWorldInverse);X.matrixWorldInverse.flattenToArray(Wa);X.projectionMatrix.flattenToArray(Va);Ga.multiply(X.projectionMatrix,X.matrixWorldInverse);n(Ga);M.initWebGLObjects(b);
-L(p);e.clearColor(1,1,1,1);M.clear();e.clearColor(ha.r,ha.g,ha.b,Ha);t=b.__webglObjects.length;m=b.__webglObjectsImmediate.length;for(p=0;p<t;p++)r=b.__webglObjects[p],y=r.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||!y.frustumCulled||q(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),F(y,X,!1),r.render=!0):r.render=!1:r.render=!1;j(!0);G(THREE.NormalBlending);for(p=0;p<t;p++)if(r=b.__webglObjects[p],r.render)y=r.object,buffer=r.buffer,h(y),r=y.customDepthMaterial?y.customDepthMaterial:
-y.geometry.morphTargets.length?$a:La,f(X,u,null,r,buffer,y);for(p=0;p<m;p++)r=b.__webglObjectsImmediate[p],y=r.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),F(y,X,!1),h(y),program=d(X,u,null,La,y),y.immediateRenderCallback?y.immediateRenderCallback(program,e,aa):y.render(function(b){i(b,program,La.shading)}));I++}}function E(b,c){var d,f,h;d=r.attributes;var i=r.uniforms,j=za/Ea,k,n=[],m=Ea*0.5,p=za*0.5,q=!0;e.useProgram(r.program);Xa=r.program;
-na=sa=ka=-1;ab||(e.enableVertexAttribArray(r.attributes.position),e.enableVertexAttribArray(r.attributes.uv),ab=!0);e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,r.vertexBuffer);e.vertexAttribPointer(d.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(d.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.elementBuffer);e.uniformMatrix4fv(i.projectionMatrix,!1,Va);e.activeTexture(e.TEXTURE0);e.uniform1i(i.map,0);d=0;for(f=b.__webglSprites.length;d<f;d++)if(h=
-b.__webglSprites[d],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(B);d=0;for(f=b.__webglSprites.length;d<f;d++)h=b.__webglSprites[d],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(e.uniform1i(i.useScreenCoordinates,1),e.uniform3f(i.screenPosition,(h.position.x-m)/m,(p-h.position.y)/p,Math.max(0,
-Math.min(1,h.position.z)))):(e.uniform1i(i.useScreenCoordinates,0),e.uniform1i(i.affectedByDistance,h.affectedByDistance?1:0),e.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray)),k=h.map.image.width/(h.scaleByViewport?za:1),n[0]=k*j*h.scale.x,n[1]=k*h.scale.y,e.uniform2f(i.uvScale,h.uvScale.x,h.uvScale.y),e.uniform2f(i.uvOffset,h.uvOffset.x,h.uvOffset.y),e.uniform2f(i.alignment,h.alignment.x,h.alignment.y),e.uniform1f(i.opacity,h.opacity),e.uniform3f(i.color,h.color.r,h.color.g,h.color.b),
-e.uniform1f(i.rotation,h.rotation),e.uniform2fv(i.scale,n),h.mergeWith3D&&!q?(e.enable(e.DEPTH_TEST),q=!0):!h.mergeWith3D&&q&&(e.disable(e.DEPTH_TEST),q=!1),G(h.blending),S(h.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Q)}function F(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function wa(b){var c,
-e,d,f;f=b.__materials;b=0;for(e=f.length;b<e;b++)if(d=f[b],d.attributes)for(c in d.attributes)if(d.attributes[c].needsUpdate)return!0;return!1}function xa(b){var c,e,d,f;f=b.__materials;b=0;for(e=f.length;b<e;b++)if(d=f[b],d.attributes)for(c in d.attributes)d.attributes[c].needsUpdate=!1}function qa(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function ra(b){function c(b){var f=[];e=0;for(d=b.length;e<d;e++)b[e]==void 0?f.push("undefined"):f.push(b[e].id);return f.join("_")}
-var e,d,f,h,i,j,k,n,m={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(h=b.faces.length;f<h;f++)i=b.faces[f],j=i.materials,k=c(j),m[k]==void 0&&(m[k]={hash:k,counter:0}),n=m[k].hash+"_"+m[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:j,vertices:0,numMorphTargets:p}),i=i instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+i>65535&&(m[k].counter+=1,n=m[k].hash+"_"+m[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],
-materials:j,vertices:0,numMorphTargets:p})),b.geometryGroups[n].faces.push(f),b.geometryGroups[n].vertices+=i;b.geometryGroupsList=[];for(var q in b.geometryGroups)b.geometryGroups[q].id=J++,b.geometryGroupsList.push(b.geometryGroups[q])}function ja(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function G(b){if(b!=ka){switch(b){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);
+0;for(e=i.materials.length;c<e;c++)(f=i.materials[c])&&(f.transparent?p(k,f):p(j,f))}else(f=c)&&(f.transparent?p(k,f):p(j,f))}function B(b,c){return c.z-b.z}function x(b){var c,k,m,I=0,p,t,r,y,u=b.lights;if(!ma)ma=new THREE.Camera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar),ma.useTarget=!0;c=0;for(k=u.length;c<k;c++)if(m=u[c],m instanceof THREE.SpotLight&&m.castShadow){U=-1;M.shadowMap[I]||(M.shadowMap[I]=new THREE.WebGLRenderTarget(M.shadowMapWidth,
+M.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Ua[I]||(Ua[I]=new THREE.Matrix4);p=M.shadowMap[I];t=Ua[I];ma.position.copy(m.position);ma.target.position.copy(m.target.position);ma.update(void 0,!0);b.update(void 0,!1,ma);t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiplySelf(ma.projectionMatrix);t.multiplySelf(ma.matrixWorldInverse);ma.matrixWorldInverse.flattenToArray(Wa);ma.projectionMatrix.flattenToArray(Va);Ga.multiply(ma.projectionMatrix,
+ma.matrixWorldInverse);n(Ga);M.initWebGLObjects(b);L(p);e.clearColor(1,1,1,1);M.clear();e.clearColor(ha.r,ha.g,ha.b,Ha);t=b.__webglObjects.length;m=b.__webglObjectsImmediate.length;for(p=0;p<t;p++)r=b.__webglObjects[p],y=r.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||!y.frustumCulled||q(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),F(y,ma,!1),r.render=!0):r.render=!1:r.render=!1;j(!0);G(THREE.NormalBlending);for(p=0;p<t;p++)if(r=b.__webglObjects[p],r.render)y=r.object,buffer=
+r.buffer,h(y),r=y.customDepthMaterial?y.customDepthMaterial:y.geometry.morphTargets.length?$a:La,f(ma,u,null,r,buffer,y);for(p=0;p<m;p++)r=b.__webglObjectsImmediate[p],y=r.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),F(y,ma,!1),h(y),program=d(ma,u,null,La,y),y.immediateRenderCallback?y.immediateRenderCallback(program,e,aa):y.render(function(b){i(b,program,La.shading)}));I++}}function E(b,c){var d,f,h;d=r.attributes;var i=r.uniforms,j=za/Ea,
+k,n=[],m=Ea*0.5,p=za*0.5,q=!0;e.useProgram(r.program);Xa=r.program;W=sa=ka=-1;ab||(e.enableVertexAttribArray(r.attributes.position),e.enableVertexAttribArray(r.attributes.uv),ab=!0);e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,r.vertexBuffer);e.vertexAttribPointer(d.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(d.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.elementBuffer);e.uniformMatrix4fv(i.projectionMatrix,!1,Va);e.activeTexture(e.TEXTURE0);
+e.uniform1i(i.map,0);d=0;for(f=b.__webglSprites.length;d<f;d++)if(h=b.__webglSprites[d],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(B);d=0;for(f=b.__webglSprites.length;d<f;d++)h=b.__webglSprites[d],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(e.uniform1i(i.useScreenCoordinates,1),e.uniform3f(i.screenPosition,
+(h.position.x-m)/m,(p-h.position.y)/p,Math.max(0,Math.min(1,h.position.z)))):(e.uniform1i(i.useScreenCoordinates,0),e.uniform1i(i.affectedByDistance,h.affectedByDistance?1:0),e.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray)),k=h.map.image.width/(h.scaleByViewport?za:1),n[0]=k*j*h.scale.x,n[1]=k*h.scale.y,e.uniform2f(i.uvScale,h.uvScale.x,h.uvScale.y),e.uniform2f(i.uvOffset,h.uvOffset.x,h.uvOffset.y),e.uniform2f(i.alignment,h.alignment.x,h.alignment.y),e.uniform1f(i.opacity,h.opacity),
+e.uniform3f(i.color,h.color.r,h.color.g,h.color.b),e.uniform1f(i.rotation,h.rotation),e.uniform2fv(i.scale,n),h.mergeWith3D&&!q?(e.enable(e.DEPTH_TEST),q=!0):!h.mergeWith3D&&q&&(e.disable(e.DEPTH_TEST),q=!1),G(h.blending),S(h.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Q)}function F(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function wa(b){var c,e,d,f;f=b.__materials;b=0;for(e=f.length;b<e;b++)if(d=f[b],d.attributes)for(c in d.attributes)if(d.attributes[c].needsUpdate)return!0;return!1}function xa(b){var c,e,d,f;f=b.__materials;b=0;for(e=f.length;b<e;b++)if(d=f[b],d.attributes)for(c in d.attributes)d.attributes[c].needsUpdate=!1}function qa(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function ra(b){function c(b){var f=[];e=0;for(d=b.length;e<d;e++)b[e]==void 0?f.push("undefined"):f.push(b[e].id);
+return f.join("_")}var e,d,f,h,i,j,k,n,m={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(h=b.faces.length;f<h;f++)i=b.faces[f],j=i.materials,k=c(j),m[k]==void 0&&(m[k]={hash:k,counter:0}),n=m[k].hash+"_"+m[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:j,vertices:0,numMorphTargets:p}),i=i instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+i>65535&&(m[k].counter+=1,n=m[k].hash+"_"+m[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]=
+{faces:[],materials:j,vertices:0,numMorphTargets:p})),b.geometryGroups[n].faces.push(f),b.geometryGroups[n].vertices+=i;b.geometryGroupsList=[];for(var q in b.geometryGroups)b.geometryGroups[q].id=J++,b.geometryGroupsList.push(b.geometryGroups[q])}function ja(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function G(b){if(b!=ka){switch(b){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);
 e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}ka=b}}function u(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,V(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,V(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,V(c.magFilter)),
 e.texParameteri(b,e.TEXTURE_MIN_FILTER,V(c.minFilter)),e.generateMipmap(b)):(e.texParameteri(b,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_MAG_FILTER,ya(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,ya(c.minFilter)))}function S(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=e.createTexture(),M.info.memory.textures++;e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_2D,b.__webglTexture);b instanceof
 THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,V(b.format),b.image.width,b.image.height,0,V(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);u(e.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function L(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;
@@ -226,9 +226,9 @@ null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[
 e.bindTexture(e.TEXTURE_2D,null))}function Z(b,c){var d;b=="fragment"?d=e.createShader(e.FRAGMENT_SHADER):b=="vertex"&&(d=e.createShader(e.VERTEX_SHADER));e.shaderSource(d,c);e.compileShader(d);if(!e.getShaderParameter(d,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(d)),console.error(c),null;return d}function ya(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function V(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;
 case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;
 case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=this,e,ua=[],Xa=
-null,va=null,U=-1,na=null,J=0,$=null,N=null,ka=null,sa=null,Q=null,Aa=null,Ja=null,Ta=null,Ka=0,Ba=0,Ea=0,za=0,aa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ga=new THREE.Matrix4,Va=new Float32Array(16),Wa=new Float32Array(16),Sa=new THREE.Vector4,Za={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ca=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
+null,va=null,U=-1,W=null,J=0,$=null,N=null,ka=null,sa=null,Q=null,Aa=null,Ja=null,Ta=null,Ka=0,Ba=0,Ea=0,za=0,aa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ga=new THREE.Matrix4,Va=new Float32Array(16),Wa=new Float32Array(16),Sa=new THREE.Vector4,Za={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ca=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
 R=b.stencil!==void 0?b.stencil:!0,db=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,eb=b.antialias!==void 0?b.antialias:!1,ha=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ha=b.clearAlpha!==void 0?b.clearAlpha:0,Ya=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=Ca;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=
-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 X,Ua=[],b=THREE.ShaderLib.depthRGBA,bb=THREE.UniformsUtils.clone(b.uniforms),La=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:bb}),$a=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
+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 ma,Ua=[],b=THREE.ShaderLib.depthRGBA,bb=THREE.UniformsUtils.clone(b.uniforms),La=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:bb}),$a=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
 uniforms:bb,morphTargets:!0});La._shadowPass=!0;$a._shadowPass=!0;try{if(!(e=Ca.getContext("experimental-webgl",{antialias:eb,stencil:R,preserveDrawingBuffer:db})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION))}catch(fb){console.error(fb)}e.clearColor(0,0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);
 e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(ha.r,ha.g,ha.b,Ha);this.context=e;var cb=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,r={};r.vertices=new Float32Array(16);r.faces=new Uint16Array(6);R=0;r.vertices[R++]=-1;r.vertices[R++]=-1;r.vertices[R++]=0;r.vertices[R++]=1;r.vertices[R++]=1;r.vertices[R++]=-1;r.vertices[R++]=1;r.vertices[R++]=1;r.vertices[R++]=1;r.vertices[R++]=
 1;r.vertices[R++]=1;r.vertices[R++]=0;r.vertices[R++]=-1;r.vertices[R++]=1;r.vertices[R++]=0;R=r.vertices[R++]=0;r.faces[R++]=0;r.faces[R++]=1;r.faces[R++]=2;r.faces[R++]=0;r.faces[R++]=2;r.faces[R++]=3;r.vertexBuffer=e.createBuffer();r.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,r.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,r.faces,e.STATIC_DRAW);r.program=e.createProgram();
@@ -248,12 +248,12 @@ d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_W
 e.getError()+"]");r.uniforms={};r.attributes={};var u,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in n)f.push(u);u=f;f=0;for(n=u.length;f<n;f++)m=u[f],r.uniforms[m]=e.getUniformLocation(r,m);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<d.maxMorphTargets;u++)f.push("morphTarget"+u);for(C in c)f.push(C);
 C=f;u=0;for(c=C.length;u<c;u++)d=C[u],r.attributes[d]=e.getAttribLocation(r,d);r.id=ua.length;ua.push({program:r,code:k});M.info.memory.programs=ua.length;C=r}b.program=C;C=b.program.attributes;C.position>=0&&e.enableVertexAttribArray(C.position);C.color>=0&&e.enableVertexAttribArray(C.color);C.normal>=0&&e.enableVertexAttribArray(C.normal);C.tangent>=0&&e.enableVertexAttribArray(C.tangent);b.skinning&&C.skinVertexA>=0&&C.skinVertexB>=0&&C.skinIndex>=0&&C.skinWeight>=0&&(e.enableVertexAttribArray(C.skinVertexA),
 e.enableVertexAttribArray(C.skinVertexB),e.enableVertexAttribArray(C.skinIndex),e.enableVertexAttribArray(C.skinWeight));if(b.attributes)for(i in b.attributes)C[i]!==void 0&&C[i]>=0&&e.enableVertexAttribArray(C[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)u="morphTarget"+i,C[u]>=0&&(e.enableVertexAttribArray(C[u]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,e){L(b);
-this.clear(c,d,e)};this.render=function(b,c,p,r){var I,u,Fa,W,y,J,D,Qa,Ra=b.lights,C=b.fog;U=-1;this.shadowMapEnabled&&x(b,c);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Wa);c.projectionMatrix.flattenToArray(Va);Ga.multiply(c.projectionMatrix,c.matrixWorldInverse);n(Ga);this.initWebGLObjects(b);L(p);(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
+this.clear(c,d,e)};this.render=function(b,c,p,r){var I,u,Fa,X,y,J,D,Qa,Ra=b.lights,C=b.fog;U=-1;this.shadowMapEnabled&&x(b,c);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Wa);c.projectionMatrix.flattenToArray(Va);Ga.multiply(c.projectionMatrix,c.matrixWorldInverse);n(Ga);this.initWebGLObjects(b);L(p);(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
 y=b.__webglObjects.length;for(r=0;r<y;r++)if(I=b.__webglObjects[r],D=I.object,D.visible)if(!(D instanceof THREE.Mesh)||!D.frustumCulled||q(D)){if(D.matrixWorld.flattenToArray(D._objectMatrixArray),F(D,c,!0),v(I),I.render=!0,this.sortObjects)I.object.renderDepth?I.z=I.object.renderDepth:(Sa.copy(D.position),Ga.multiplyVector3(Sa),I.z=Sa.z)}else I.render=!1;else I.render=!1;this.sortObjects&&b.__webglObjects.sort(B);J=b.__webglObjectsImmediate.length;for(r=0;r<J;r++)I=b.__webglObjectsImmediate[r],D=
 I.object,D.visible&&(D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray),F(D,c,!0),t(I));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);G(b.overrideMaterial.blending);for(r=0;r<y;r++)if(I=b.__webglObjects[r],I.render)D=I.object,Qa=I.buffer,h(D),f(c,Ra,C,b.overrideMaterial,Qa,D);for(r=0;r<J;r++)I=b.__webglObjectsImmediate[r],D=I.object,D.visible&&(h(D),u=d(c,Ra,C,b.overrideMaterial,D),D.immediateRenderCallback?D.immediateRenderCallback(u,e,aa):D.render(function(b){i(b,u,
-La.shading)}))}else{G(THREE.NormalBlending);for(r=y-1;r>=0;r--)if(I=b.__webglObjects[r],I.render){D=I.object;Qa=I.buffer;Fa=I.opaque;h(D);for(I=0;I<Fa.count;I++)W=Fa.list[I],j(W.depthTest),k(W.depthWrite),m(W.polygonOffset,W.polygonOffsetFactor,W.polygonOffsetUnits),f(c,Ra,C,W,Qa,D)}for(r=0;r<J;r++)if(I=b.__webglObjectsImmediate[r],D=I.object,D.visible){Fa=I.opaque;h(D);for(I=0;I<Fa.count;I++)W=Fa.list[I],j(W.depthTest),k(W.depthWrite),m(W.polygonOffset,W.polygonOffsetFactor,W.polygonOffsetUnits),
-u=d(c,Ra,C,W,D),D.immediateRenderCallback?D.immediateRenderCallback(u,e,aa):D.render(function(b){i(b,u,La.shading)})}for(r=0;r<y;r++)if(I=b.__webglObjects[r],I.render){D=I.object;Qa=I.buffer;Fa=I.transparent;h(D);for(I=0;I<Fa.count;I++)W=Fa.list[I],G(W.blending),j(W.depthTest),k(W.depthWrite),m(W.polygonOffset,W.polygonOffsetFactor,W.polygonOffsetUnits),f(c,Ra,C,W,Qa,D)}for(r=0;r<J;r++)if(I=b.__webglObjectsImmediate[r],D=I.object,D.visible){Fa=I.transparent;h(D);for(I=0;I<Fa.count;I++)W=Fa.list[I],
-G(W.blending),j(W.depthTest),k(W.depthWrite),m(W.polygonOffset,W.polygonOffsetFactor,W.polygonOffsetUnits),u=d(c,Ra,C,W,D),D.immediateRenderCallback?D.immediateRenderCallback(u,e,aa):D.render(function(b){i(b,u,La.shading)})}}b.__webglSprites.length&&E(b,c);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&T(p)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],
+La.shading)}))}else{G(THREE.NormalBlending);for(r=y-1;r>=0;r--)if(I=b.__webglObjects[r],I.render){D=I.object;Qa=I.buffer;Fa=I.opaque;h(D);for(I=0;I<Fa.count;I++)X=Fa.list[I],j(X.depthTest),k(X.depthWrite),m(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),f(c,Ra,C,X,Qa,D)}for(r=0;r<J;r++)if(I=b.__webglObjectsImmediate[r],D=I.object,D.visible){Fa=I.opaque;h(D);for(I=0;I<Fa.count;I++)X=Fa.list[I],j(X.depthTest),k(X.depthWrite),m(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),
+u=d(c,Ra,C,X,D),D.immediateRenderCallback?D.immediateRenderCallback(u,e,aa):D.render(function(b){i(b,u,La.shading)})}for(r=0;r<y;r++)if(I=b.__webglObjects[r],I.render){D=I.object;Qa=I.buffer;Fa=I.transparent;h(D);for(I=0;I<Fa.count;I++)X=Fa.list[I],G(X.blending),j(X.depthTest),k(X.depthWrite),m(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),f(c,Ra,C,X,Qa,D)}for(r=0;r<J;r++)if(I=b.__webglObjectsImmediate[r],D=I.object,D.visible){Fa=I.transparent;h(D);for(I=0;I<Fa.count;I++)X=Fa.list[I],
+G(X.blending),j(X.depthTest),k(X.depthWrite),m(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),u=d(c,Ra,C,X,D),D.immediateRenderCallback?D.immediateRenderCallback(u,e,aa):D.render(function(b){i(b,u,La.shading)})}}b.__webglSprites.length&&E(b,c);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&T(p)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],
 f=b,h=void 0,i=void 0,j=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray),d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups==void 0&&ra(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=e.createBuffer();k.__webglNormalBuffer=e.createBuffer();
 k.__webglTangentBuffer=e.createBuffer();k.__webglColorBuffer=e.createBuffer();k.__webglUVBuffer=e.createBuffer();k.__webglUV2Buffer=e.createBuffer();k.__webglSkinVertexABuffer=e.createBuffer();k.__webglSkinVertexBBuffer=e.createBuffer();k.__webglSkinIndicesBuffer=e.createBuffer();k.__webglSkinWeightsBuffer=e.createBuffer();k.__webglFaceBuffer=e.createBuffer();k.__webglLineBuffer=e.createBuffer();if(k.numMorphTargets){var n=void 0,m=void 0;k.__webglMorphTargetsBuffers=[];n=0;for(m=k.numMorphTargets;n<
 m;n++)k.__webglMorphTargetsBuffers.push(e.createBuffer())}M.info.memory.geometries++;for(var k=d,p=void 0,r=void 0,q=void 0,u=q=void 0,t=void 0,v=void 0,B=v=n=0,x=q=r=void 0,q=m=x=r=p=void 0,u=k.geometry,t=u.faces,x=j.faces,p=0,r=x.length;p<r;p++)q=x[p],q=t[q],q instanceof THREE.Face3?(n+=3,v+=1,B+=3):q instanceof THREE.Face4&&(n+=4,v+=2,B+=4);for(var p=j,r=k,F=x=t=void 0,H=void 0,F=void 0,q=[],t=0,x=r.materials.length;t<x;t++)if(F=r.materials[t],F instanceof THREE.MeshFaceMaterial){F=0;for(l=p.materials.length;F<
@@ -268,25 +268,25 @@ originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUn
 !0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ja(f.__webglObjects,j,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,ja(f.__webglObjects,i,d)):THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes||d.immediateRenderCallback?f.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&
 f.__webglSprites.push(d);d.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];f=b;if(d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line)qa(f.__webglObjects,d);else if(d instanceof THREE.Sprite){f=f.__webglSprites;h=d;i=void 0;for(i=f.length-1;i>=0;i--)f[i]==h&&f.splice(i,1)}else(d instanceof THREE.MarchingCubes||d.immediateRenderCallback)&&qa(f.__webglObjectsImmediate,d);d.__webglActive=
 !1;b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<f;d++)if(i=b.__webglObjects[d].object,m=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(n=h.geometryGroupsList.length;k<n;k++)if(j=h.geometryGroupsList[k],m=wa(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||m)if(m=j,v=e.DYNAMIC_DRAW,B=!h.dynamic,m.__inittedArrays){var E=p=u=void 0,z=void 0,J=E=void 0,G=void 0,Q=void 0,K=void 0,O=H=F=q=
-x=t=r=void 0,P=void 0,L=void 0,s=z=K=z=Q=G=void 0,o=void 0,A=o=s=G=void 0,R=void 0,U=A=o=s=E=E=J=K=z=A=o=s=R=A=o=s=R=A=o=s=void 0,ia=0,N=0,Z=0,$=0,V=0,S=0,Y=0,T=0,la=0,w=0,ma=0,A=s=0,A=void 0,oa=m.__vertexArray,ka=m.__uvArray,na=m.__uv2Array,X=m.__normalArray,ca=m.__tangentArray,pa=m.__colorArray,da=m.__skinVertexAArray,ea=m.__skinVertexBArray,fa=m.__skinIndexArray,ga=m.__skinWeightArray,sa=m.__morphTargetsArrays,aa=m.__webglCustomAttributes,o=void 0,ha=m.__faceArray,Da=m.__lineArray,ya=m.__needsSmoothNormals,
+x=t=r=void 0,P=void 0,L=void 0,s=z=K=z=Q=G=void 0,o=void 0,A=o=s=G=void 0,R=void 0,U=A=o=s=E=E=J=K=z=A=o=s=R=A=o=s=R=A=o=s=void 0,ia=0,N=0,Z=0,$=0,V=0,S=0,Y=0,T=0,la=0,w=0,na=0,A=s=0,A=void 0,oa=m.__vertexArray,ka=m.__uvArray,ma=m.__uv2Array,W=m.__normalArray,ca=m.__tangentArray,pa=m.__colorArray,da=m.__skinVertexAArray,ea=m.__skinVertexBArray,fa=m.__skinIndexArray,ga=m.__skinWeightArray,sa=m.__morphTargetsArrays,aa=m.__webglCustomAttributes,o=void 0,ha=m.__faceArray,Da=m.__lineArray,ya=m.__needsSmoothNormals,
 t=m.__vertexColorType,r=m.__uvType,x=m.__normalType,ta=i.geometry,va=ta.__dirtyVertices,za=ta.__dirtyElements,ua=ta.__dirtyUvs,Aa=ta.__dirtyNormals,Ba=ta.__dirtyTangents,Ea=ta.__dirtyColors,Ga=ta.__dirtyMorphTargets,Ca=ta.vertices,Ha=m.faces,La=ta.faces,Ja=ta.faceVertexUvs[0],Ka=ta.faceVertexUvs[1],Na=ta.skinVerticesA,Oa=ta.skinVerticesB,Pa=ta.skinIndices,Ma=ta.skinWeights,Ia=ta.morphTargets;if(aa)for(U in aa)aa[U].offset=0,aa[U].offsetSrc=0;u=0;for(p=Ha.length;u<p;u++)if(E=Ha[u],z=La[E],Ja&&(q=Ja[E]),
 Ka&&(F=Ka[E]),E=z.vertexNormals,J=z.normal,G=z.vertexColors,Q=z.color,K=z.vertexTangents,z instanceof THREE.Face3){if(va)H=Ca[z.a].position,O=Ca[z.b].position,P=Ca[z.c].position,oa[N]=H.x,oa[N+1]=H.y,oa[N+2]=H.z,oa[N+3]=O.x,oa[N+4]=O.y,oa[N+5]=O.z,oa[N+6]=P.x,oa[N+7]=P.y,oa[N+8]=P.z,N+=9;if(aa)for(U in aa)if(o=aa[U],o.__original.needsUpdate)s=o.offset,A=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[s]=o.value[z.a],o.array[s+1]=o.value[z.b],o.array[s+2]=o.value[z.c]):
 o.boundTo==="faces"?(A=o.value[A],o.array[s]=A,o.array[s+1]=A,o.array[s+2]=A,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[s]=o.value[A],o.array[s+1]=o.value[A+1],o.array[s+2]=o.value[A+2],o.offsetSrc+=3),o.offset+=3):(o.boundTo===void 0||o.boundTo==="vertices"?(H=o.value[z.a],O=o.value[z.b],P=o.value[z.c]):o.boundTo==="faces"?(P=O=H=A=o.value[A],o.offsetSrc++):o.boundTo==="faceVertices"&&(H=o.value[A],O=o.value[A+1],P=o.value[A+2],o.offsetSrc+=3),o.size===2?(o.array[s]=H.x,o.array[s+1]=H.y,
 o.array[s+2]=O.x,o.array[s+3]=O.y,o.array[s+4]=P.x,o.array[s+5]=P.y,o.offset+=6):o.size===3?(o.type==="c"?(o.array[s]=H.r,o.array[s+1]=H.g,o.array[s+2]=H.b,o.array[s+3]=O.r,o.array[s+4]=O.g,o.array[s+5]=O.b,o.array[s+6]=P.r,o.array[s+7]=P.g,o.array[s+8]=P.b):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=O.x,o.array[s+4]=O.y,o.array[s+5]=O.z,o.array[s+6]=P.x,o.array[s+7]=P.y,o.array[s+8]=P.z),o.offset+=9):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=H.w,o.array[s+
-4]=O.x,o.array[s+5]=O.y,o.array[s+6]=O.z,o.array[s+7]=O.w,o.array[s+8]=P.x,o.array[s+9]=P.y,o.array[s+10]=P.z,o.array[s+11]=P.w,o.offset+=12));if(Ga){s=0;for(o=Ia.length;s<o;s++)H=Ia[s].vertices[z.a].position,O=Ia[s].vertices[z.b].position,P=Ia[s].vertices[z.c].position,A=sa[s],A[ma]=H.x,A[ma+1]=H.y,A[ma+2]=H.z,A[ma+3]=O.x,A[ma+4]=O.y,A[ma+5]=O.z,A[ma+6]=P.x,A[ma+7]=P.y,A[ma+8]=P.z;ma+=9}if(Ma.length)s=Ma[z.a],o=Ma[z.b],A=Ma[z.c],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=o.x,ga[w+5]=o.y,
+4]=O.x,o.array[s+5]=O.y,o.array[s+6]=O.z,o.array[s+7]=O.w,o.array[s+8]=P.x,o.array[s+9]=P.y,o.array[s+10]=P.z,o.array[s+11]=P.w,o.offset+=12));if(Ga){s=0;for(o=Ia.length;s<o;s++)H=Ia[s].vertices[z.a].position,O=Ia[s].vertices[z.b].position,P=Ia[s].vertices[z.c].position,A=sa[s],A[na]=H.x,A[na+1]=H.y,A[na+2]=H.z,A[na+3]=O.x,A[na+4]=O.y,A[na+5]=O.z,A[na+6]=P.x,A[na+7]=P.y,A[na+8]=P.z;na+=9}if(Ma.length)s=Ma[z.a],o=Ma[z.b],A=Ma[z.c],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=o.x,ga[w+5]=o.y,
 ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=A.x,ga[w+9]=A.y,ga[w+10]=A.z,ga[w+11]=A.w,s=Pa[z.a],o=Pa[z.b],A=Pa[z.c],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=s.w,fa[w+4]=o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+7]=o.w,fa[w+8]=A.x,fa[w+9]=A.y,fa[w+10]=A.z,fa[w+11]=A.w,s=Na[z.a],o=Na[z.b],A=Na[z.c],da[w]=s.x,da[w+1]=s.y,da[w+2]=s.z,da[w+3]=1,da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=1,da[w+8]=A.x,da[w+9]=A.y,da[w+10]=A.z,da[w+11]=1,s=Oa[z.a],o=Oa[z.b],A=Oa[z.c],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=o.x,
 ea[w+5]=o.y,ea[w+6]=o.z,ea[w+7]=1,ea[w+8]=A.x,ea[w+9]=A.y,ea[w+10]=A.z,ea[w+11]=1,w+=12;if(Ea&&t)G.length==3&&t==THREE.VertexColors?(z=G[0],s=G[1],o=G[2]):o=s=z=Q,pa[la]=z.r,pa[la+1]=z.g,pa[la+2]=z.b,pa[la+3]=s.r,pa[la+4]=s.g,pa[la+5]=s.b,pa[la+6]=o.r,pa[la+7]=o.g,pa[la+8]=o.b,la+=9;if(Ba&&ta.hasTangents)G=K[0],Q=K[1],z=K[2],ca[Y]=G.x,ca[Y+1]=G.y,ca[Y+2]=G.z,ca[Y+3]=G.w,ca[Y+4]=Q.x,ca[Y+5]=Q.y,ca[Y+6]=Q.z,ca[Y+7]=Q.w,ca[Y+8]=z.x,ca[Y+9]=z.y,ca[Y+10]=z.z,ca[Y+11]=z.w,Y+=12;if(Aa&&x)if(E.length==3&&
-ya)for(K=0;K<3;K++)J=E[K],X[S]=J.x,X[S+1]=J.y,X[S+2]=J.z,S+=3;else for(K=0;K<3;K++)X[S]=J.x,X[S+1]=J.y,X[S+2]=J.z,S+=3;if(ua&&q!==void 0&&r)for(K=0;K<3;K++)E=q[K],ka[Z]=E.u,ka[Z+1]=E.v,Z+=2;if(ua&&F!==void 0&&r)for(K=0;K<3;K++)E=F[K],na[$]=E.u,na[$+1]=E.v,$+=2;za&&(ha[V]=ia,ha[V+1]=ia+1,ha[V+2]=ia+2,V+=3,Da[T]=ia,Da[T+1]=ia+1,Da[T+2]=ia,Da[T+3]=ia+2,Da[T+4]=ia+1,Da[T+5]=ia+2,T+=6,ia+=3)}else if(z instanceof THREE.Face4){if(va)H=Ca[z.a].position,O=Ca[z.b].position,P=Ca[z.c].position,L=Ca[z.d].position,
+ya)for(K=0;K<3;K++)J=E[K],W[S]=J.x,W[S+1]=J.y,W[S+2]=J.z,S+=3;else for(K=0;K<3;K++)W[S]=J.x,W[S+1]=J.y,W[S+2]=J.z,S+=3;if(ua&&q!==void 0&&r)for(K=0;K<3;K++)E=q[K],ka[Z]=E.u,ka[Z+1]=E.v,Z+=2;if(ua&&F!==void 0&&r)for(K=0;K<3;K++)E=F[K],ma[$]=E.u,ma[$+1]=E.v,$+=2;za&&(ha[V]=ia,ha[V+1]=ia+1,ha[V+2]=ia+2,V+=3,Da[T]=ia,Da[T+1]=ia+1,Da[T+2]=ia,Da[T+3]=ia+2,Da[T+4]=ia+1,Da[T+5]=ia+2,T+=6,ia+=3)}else if(z instanceof THREE.Face4){if(va)H=Ca[z.a].position,O=Ca[z.b].position,P=Ca[z.c].position,L=Ca[z.d].position,
 oa[N]=H.x,oa[N+1]=H.y,oa[N+2]=H.z,oa[N+3]=O.x,oa[N+4]=O.y,oa[N+5]=O.z,oa[N+6]=P.x,oa[N+7]=P.y,oa[N+8]=P.z,oa[N+9]=L.x,oa[N+10]=L.y,oa[N+11]=L.z,N+=12;if(aa)for(U in aa)if(o=aa[U],o.__original.needsUpdate)s=o.offset,A=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[s]=o.value[z.a],o.array[s+1]=o.value[z.b],o.array[s+2]=o.value[z.c],o.array[s+3]=o.value[z.d]):o.boundTo==="faces"?(A=o.value[A],o.array[s]=A,o.array[s+1]=A,o.array[s+2]=A,o.array[s+3]=A,o.offsetSrc++):o.boundTo===
 "faceVertices"&&(o.array[s]=o.value[A],o.array[s+1]=o.value[A+1],o.array[s+2]=o.value[A+2],o.array[s+3]=o.value[A+3],o.offsetSrc+=4),o.offset+=4):(o.boundTo===void 0||o.boundTo==="vertices"?(H=o.value[z.a],O=o.value[z.b],P=o.value[z.c],L=o.value[z.d]):o.boundTo==="faces"?(L=P=O=H=A=o.value[A],o.offsetSrc++):o.boundTo==="faceVertices"&&(H=o.value[A],O=o.value[A+1],P=o.value[A+2],L=o.value[A+3],o.offsetSrc+=4),o.size===2?(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=O.x,o.array[s+3]=O.y,o.array[s+4]=
 P.x,o.array[s+5]=P.y,o.array[s+6]=L.x,o.array[s+7]=L.y,o.offset+=8):o.size===3?(o.type==="c"?(o.array[s]=H.r,o.array[s+1]=H.g,o.array[s+2]=H.b,o.array[s+3]=O.r,o.array[s+4]=O.g,o.array[s+5]=O.b,o.array[s+6]=P.r,o.array[s+7]=P.g,o.array[s+8]=P.b,o.array[s+9]=L.r,o.array[s+10]=L.g,o.array[s+11]=L.b):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=O.x,o.array[s+4]=O.y,o.array[s+5]=O.z,o.array[s+6]=P.x,o.array[s+7]=P.y,o.array[s+8]=P.z,o.array[s+9]=L.x,o.array[s+10]=L.y,o.array[s+11]=L.z),
-o.offset+=12):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=H.w,o.array[s+4]=O.x,o.array[s+5]=O.y,o.array[s+6]=O.z,o.array[s+7]=O.w,o.array[s+8]=P.x,o.array[s+9]=P.y,o.array[s+10]=P.z,o.array[s+11]=P.w,o.array[s+12]=L.x,o.array[s+13]=L.y,o.array[s+14]=L.z,o.array[s+15]=L.w,o.offset+=16));if(Ga){s=0;for(o=Ia.length;s<o;s++)H=Ia[s].vertices[z.a].position,O=Ia[s].vertices[z.b].position,P=Ia[s].vertices[z.c].position,L=Ia[s].vertices[z.d].position,A=sa[s],A[ma]=H.x,A[ma+1]=H.y,A[ma+2]=
-H.z,A[ma+3]=O.x,A[ma+4]=O.y,A[ma+5]=O.z,A[ma+6]=P.x,A[ma+7]=P.y,A[ma+8]=P.z,A[ma+9]=L.x,A[ma+10]=L.y,A[ma+11]=L.z;ma+=12}if(Ma.length)s=Ma[z.a],o=Ma[z.b],A=Ma[z.c],R=Ma[z.d],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=o.x,ga[w+5]=o.y,ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=A.x,ga[w+9]=A.y,ga[w+10]=A.z,ga[w+11]=A.w,ga[w+12]=R.x,ga[w+13]=R.y,ga[w+14]=R.z,ga[w+15]=R.w,s=Pa[z.a],o=Pa[z.b],A=Pa[z.c],R=Pa[z.d],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=s.w,fa[w+4]=o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+7]=o.w,
+o.offset+=12):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=H.w,o.array[s+4]=O.x,o.array[s+5]=O.y,o.array[s+6]=O.z,o.array[s+7]=O.w,o.array[s+8]=P.x,o.array[s+9]=P.y,o.array[s+10]=P.z,o.array[s+11]=P.w,o.array[s+12]=L.x,o.array[s+13]=L.y,o.array[s+14]=L.z,o.array[s+15]=L.w,o.offset+=16));if(Ga){s=0;for(o=Ia.length;s<o;s++)H=Ia[s].vertices[z.a].position,O=Ia[s].vertices[z.b].position,P=Ia[s].vertices[z.c].position,L=Ia[s].vertices[z.d].position,A=sa[s],A[na]=H.x,A[na+1]=H.y,A[na+2]=
+H.z,A[na+3]=O.x,A[na+4]=O.y,A[na+5]=O.z,A[na+6]=P.x,A[na+7]=P.y,A[na+8]=P.z,A[na+9]=L.x,A[na+10]=L.y,A[na+11]=L.z;na+=12}if(Ma.length)s=Ma[z.a],o=Ma[z.b],A=Ma[z.c],R=Ma[z.d],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=o.x,ga[w+5]=o.y,ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=A.x,ga[w+9]=A.y,ga[w+10]=A.z,ga[w+11]=A.w,ga[w+12]=R.x,ga[w+13]=R.y,ga[w+14]=R.z,ga[w+15]=R.w,s=Pa[z.a],o=Pa[z.b],A=Pa[z.c],R=Pa[z.d],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=s.w,fa[w+4]=o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+7]=o.w,
 fa[w+8]=A.x,fa[w+9]=A.y,fa[w+10]=A.z,fa[w+11]=A.w,fa[w+12]=R.x,fa[w+13]=R.y,fa[w+14]=R.z,fa[w+15]=R.w,s=Na[z.a],o=Na[z.b],A=Na[z.c],R=Na[z.d],da[w]=s.x,da[w+1]=s.y,da[w+2]=s.z,da[w+3]=1,da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=1,da[w+8]=A.x,da[w+9]=A.y,da[w+10]=A.z,da[w+11]=1,da[w+12]=R.x,da[w+13]=R.y,da[w+14]=R.z,da[w+15]=1,s=Oa[z.a],o=Oa[z.b],A=Oa[z.c],z=Oa[z.d],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=o.x,ea[w+5]=o.y,ea[w+6]=o.z,ea[w+7]=1,ea[w+8]=A.x,ea[w+9]=A.y,ea[w+10]=A.z,ea[w+
 11]=1,ea[w+12]=z.x,ea[w+13]=z.y,ea[w+14]=z.z,ea[w+15]=1,w+=16;if(Ea&&t)G.length==4&&t==THREE.VertexColors?(z=G[0],s=G[1],o=G[2],G=G[3]):G=o=s=z=Q,pa[la]=z.r,pa[la+1]=z.g,pa[la+2]=z.b,pa[la+3]=s.r,pa[la+4]=s.g,pa[la+5]=s.b,pa[la+6]=o.r,pa[la+7]=o.g,pa[la+8]=o.b,pa[la+9]=G.r,pa[la+10]=G.g,pa[la+11]=G.b,la+=12;if(Ba&&ta.hasTangents)G=K[0],Q=K[1],z=K[2],K=K[3],ca[Y]=G.x,ca[Y+1]=G.y,ca[Y+2]=G.z,ca[Y+3]=G.w,ca[Y+4]=Q.x,ca[Y+5]=Q.y,ca[Y+6]=Q.z,ca[Y+7]=Q.w,ca[Y+8]=z.x,ca[Y+9]=z.y,ca[Y+10]=z.z,ca[Y+11]=z.w,
-ca[Y+12]=K.x,ca[Y+13]=K.y,ca[Y+14]=K.z,ca[Y+15]=K.w,Y+=16;if(Aa&&x)if(E.length==4&&ya)for(K=0;K<4;K++)J=E[K],X[S]=J.x,X[S+1]=J.y,X[S+2]=J.z,S+=3;else for(K=0;K<4;K++)X[S]=J.x,X[S+1]=J.y,X[S+2]=J.z,S+=3;if(ua&&q!==void 0&&r)for(K=0;K<4;K++)E=q[K],ka[Z]=E.u,ka[Z+1]=E.v,Z+=2;if(ua&&F!==void 0&&r)for(K=0;K<4;K++)E=F[K],na[$]=E.u,na[$+1]=E.v,$+=2;za&&(ha[V]=ia,ha[V+1]=ia+1,ha[V+2]=ia+3,ha[V+3]=ia+1,ha[V+4]=ia+2,ha[V+5]=ia+3,V+=6,Da[T]=ia,Da[T+1]=ia+1,Da[T+2]=ia,Da[T+3]=ia+3,Da[T+4]=ia+1,Da[T+5]=ia+2,Da[T+
+ca[Y+12]=K.x,ca[Y+13]=K.y,ca[Y+14]=K.z,ca[Y+15]=K.w,Y+=16;if(Aa&&x)if(E.length==4&&ya)for(K=0;K<4;K++)J=E[K],W[S]=J.x,W[S+1]=J.y,W[S+2]=J.z,S+=3;else for(K=0;K<4;K++)W[S]=J.x,W[S+1]=J.y,W[S+2]=J.z,S+=3;if(ua&&q!==void 0&&r)for(K=0;K<4;K++)E=q[K],ka[Z]=E.u,ka[Z+1]=E.v,Z+=2;if(ua&&F!==void 0&&r)for(K=0;K<4;K++)E=F[K],ma[$]=E.u,ma[$+1]=E.v,$+=2;za&&(ha[V]=ia,ha[V+1]=ia+1,ha[V+2]=ia+3,ha[V+3]=ia+1,ha[V+4]=ia+2,ha[V+5]=ia+3,V+=6,Da[T]=ia,Da[T+1]=ia+1,Da[T+2]=ia,Da[T+3]=ia+3,Da[T+4]=ia+1,Da[T+5]=ia+2,Da[T+
 6]=ia+2,Da[T+7]=ia+3,T+=8,ia+=4)}va&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,oa,v));if(aa)for(U in aa)o=aa[U],o.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,o.buffer),e.bufferData(e.ARRAY_BUFFER,o.array,v));if(Ga){s=0;for(o=Ia.length;s<o;s++)e.bindBuffer(e.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[s]),e.bufferData(e.ARRAY_BUFFER,sa[s],v)}Ea&&la>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,pa,v));Aa&&(e.bindBuffer(e.ARRAY_BUFFER,
-m.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,X,v));Ba&&ta.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,ca,v));ua&&Z>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ka,v));ua&&$>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,na,v));za&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ha,v),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer),
+m.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,W,v));Ba&&ta.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,ca,v));ua&&Z>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ka,v));ua&&$>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,ma,v));za&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ha,v),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer),
 e.bufferData(e.ELEMENT_ARRAY_BUFFER,Da,v));w>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,da,v),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,ea,v),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,fa,v),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ga,v));B&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,delete m.__tangentArray,
 delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;xa(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=u=B=B=void 0;p=i.vertices;n=
 i.colors;r=p.length;m=n.length;t=i.__vertexArray;v=i.__colorArray;x=i.__dirtyColors;if(i.__dirtyVertices){for(B=0;B<r;B++)u=p[B].position,k=B*3,t[k]=u.x,t[k+1]=u.y,t[k+2]=u.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,t,j)}if(x){for(B=0;B<m;B++)color=n[B],k=B*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;

+ 1 - 0
examples/webgl_particles_random.html

@@ -62,6 +62,7 @@
 				document.body.appendChild( container );
 
 				camera = new THREE.Camera( 75, window.innerWidth / window.innerHeight, 1, 3000 );
+				camera.useTarget = true;
 				camera.position.z = 1000;
 
 				scene = new THREE.Scene();

+ 1 - 0
examples/webgl_particles_sprites.html

@@ -63,6 +63,7 @@
 				document.body.appendChild( container );
 
 				camera = new THREE.Camera( 75, window.innerWidth / window.innerHeight, 1, 3000 );
+				camera.useTarget = true;
 				camera.position.z = 1000;
 
 				scene = new THREE.Scene();

+ 1 - 0
examples/webgl_postprocessing_dof.html

@@ -76,6 +76,7 @@
 				document.body.appendChild( container );
 
 				camera = new THREE.Camera( 70, window.innerWidth / height, 1, 3000 );
+				camera.useTarget = true;
 				camera.position.z = 200;
 
 				scene = new THREE.Scene();

+ 2 - 1
examples/webgl_ribbons.html

@@ -77,6 +77,7 @@
 				document.body.appendChild( container );
 
 				camera = new THREE.Camera( 70, window.innerWidth / window.innerHeight, 1, 3000 );
+				camera.useTarget = true;
 				camera.position.z = 1200;
 
 				scene = new THREE.Scene();
@@ -262,7 +263,7 @@
 				var time = new Date().getTime() * 0.00005;
 
 				camera.position.x += ( mouseX - camera.position.x ) * 0.036;
-				camera.position.y += ( - (mouseY) - camera.position.y ) * 0.036;
+				camera.position.y += ( - mouseY - camera.position.y ) * 0.036;
 
 				for ( i = -n; i < n; i ++ ) {
 

+ 1 - 1
examples/webgl_rtt.html

@@ -112,8 +112,8 @@
 				cameraRTT.position.z = 100;
 
 				camera = new THREE.Camera( 30, window.innerWidth / window.innerHeight, 1, 10000 );
+				camera.useTarget = true;
 				camera.position.z = 100;
-				camera.updateMatrix();
 
 				scene = new THREE.Scene();
 				sceneRTT = new THREE.Scene();

+ 2 - 107
examples/webgl_sandbox.html

@@ -34,113 +34,7 @@
 	<body>
 		<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl cube Fresnel shader demo.</div>
 
-		<!-- <script src="../build/Three.js"></script> -->
-
-		<script src="../src/Three.js"></script>
-		<script src="../src/core/Color.js"></script>
-		<script src="../src/core/Vector2.js"></script>
-		<script src="../src/core/Vector3.js"></script>
-		<script src="../src/core/Vector4.js"></script>
-		<script src="../src/core/Ray.js"></script>
-		<script src="../src/core/Rectangle.js"></script>
-		<script src="../src/core/Matrix3.js"></script>
-		<script src="../src/core/Matrix4.js"></script>
-		<script src="../src/core/Object3D.js"></script>
-		<script src="../src/core/Projector.js"></script>
-		<script src="../src/core/Quaternion.js"></script>
-		<script src="../src/core/Vertex.js"></script>
-		<script src="../src/core/Face3.js"></script>
-		<script src="../src/core/Face4.js"></script>
-		<script src="../src/core/UV.js"></script>
-		<script src="../src/core/Geometry.js"></script>
-		<script src="../src/core/Spline.js"></script>
-		<script src="../src/core/Edge.js"></script>
-		<script src="../src/cameras/Camera.js"></script>
-		<script src="../src/cameras/OrthoCamera.js"></script>
-		<script src="../src/lights/Light.js"></script>
-		<script src="../src/lights/AmbientLight.js"></script>
-		<script src="../src/lights/DirectionalLight.js"></script>
-		<script src="../src/lights/PointLight.js"></script>
-		<script src="../src/lights/SpotLight.js"></script>
-		<script src="../src/materials/Material.js"></script>
-		<script src="../src/materials/LineBasicMaterial.js"></script>
-		<script src="../src/materials/MeshBasicMaterial.js"></script>
-		<script src="../src/materials/MeshLambertMaterial.js"></script>
-		<script src="../src/materials/MeshPhongMaterial.js"></script>
-		<script src="../src/materials/MeshDepthMaterial.js"></script>
-		<script src="../src/materials/MeshNormalMaterial.js"></script>
-		<script src="../src/materials/MeshFaceMaterial.js"></script>
-		<script src="../src/materials/ShaderMaterial.js"></script>
-		<script src="../src/materials/ParticleBasicMaterial.js"></script>
-		<script src="../src/materials/ParticleCanvasMaterial.js"></script>
-		<script src="../src/materials/ParticleDOMMaterial.js"></script>
-		<script src="../src/textures/Texture.js"></script>
-		<script src="../src/textures/DataTexture.js"></script>
-		<script src="../src/objects/Particle.js"></script>
-		<script src="../src/objects/ParticleSystem.js"></script>
-		<script src="../src/objects/Line.js"></script>
-		<script src="../src/objects/Mesh.js"></script>
-		<script src="../src/objects/Bone.js"></script>
-		<script src="../src/objects/SkinnedMesh.js"></script>
-		<script src="../src/objects/Ribbon.js"></script>
-		<script src="../src/objects/LOD.js"></script>
-		<script src="../src/objects/Sprite.js"></script>
-		<script src="../src/scenes/Scene.js"></script>
-		<script src="../src/scenes/Fog.js"></script>
-		<script src="../src/scenes/FogExp2.js"></script>
-		<script src="../src/renderers/DOMRenderer.js"></script>
-		<script src="../src/renderers/CanvasRenderer.js"></script>
-		<script src="../src/renderers/SVGRenderer.js"></script>
-		<script src="../src/renderers/WebGLShaders.js"></script>
-		<script src="../src/renderers/WebGLRenderer.js"></script>
-		<script src="../src/renderers/WebGLRenderTarget.js"></script>
-		<script src="../src/renderers/WebGLRenderTargetCube.js"></script>
-		<script src="../src/renderers/renderables/RenderableVertex.js"></script>
-		<script src="../src/renderers/renderables/RenderableFace3.js"></script>
-		<script src="../src/renderers/renderables/RenderableFace4.js"></script>
-		<script src="../src/renderers/renderables/RenderableObject.js"></script>
-		<script src="../src/renderers/renderables/RenderableParticle.js"></script>
-		<script src="../src/renderers/renderables/RenderableLine.js"></script>
-		<script src="../src/extras/ColorUtils.js"></script>
-		<script src="../src/extras/GeometryUtils.js"></script>
-		<script src="../src/extras/ImageUtils.js"></script>
-		<script src="../src/extras/SceneUtils.js"></script>
-		<script src="../src/extras/ShaderUtils.js"></script>
-		<script src="../src/extras/core/Curve.js"></script>
-		<script src="../src/extras/core/CurvePath.js"></script>
-		<script src="../src/extras/core/Path.js"></script>
-		<script src="../src/extras/core/Shape.js"></script>
-		<script src="../src/extras/core/TextPath.js"></script>
-		<script src="../src/extras/animation/AnimationHandler.js"></script>
-		<script src="../src/extras/animation/Animation.js"></script>
-		<script src="../src/extras/cameras/FirstPersonCamera.js"></script>
-		<script src="../src/extras/cameras/PathCamera.js"></script>
-		<script src="../src/extras/cameras/FlyCamera.js"></script>
-		<script src="../src/extras/cameras/RollCamera.js"></script>
-		<script src="../src/extras/cameras/TrackballCamera.js"></script>
-		<script src="../src/extras/cameras/QuakeCamera.js"></script>
-		<script src="../src/extras/geometries/CubeGeometry.js"></script>
-		<script src="../src/extras/geometries/CylinderGeometry.js"></script>
-		<script src="../src/extras/geometries/ExtrudeGeometry.js"></script>
-		<script src="../src/extras/geometries/IcosahedronGeometry.js"></script>
-		<script src="../src/extras/geometries/LatheGeometry.js"></script>
-		<script src="../src/extras/geometries/PlaneGeometry.js"></script>
-		<script src="../src/extras/geometries/SphereGeometry.js"></script>
-		<script src="../src/extras/geometries/TextGeometry.js"></script>
-		<script src="../src/extras/geometries/TorusGeometry.js"></script>
-		<script src="../src/extras/geometries/TorusKnotGeometry.js"></script>
-		<script src="../src/extras/loaders/Loader.js"></script>
-		<script src="../src/extras/loaders/BinaryLoader.js"></script>
-		<script src="../src/extras/loaders/ColladaLoader.js"></script>
-		<script src="../src/extras/loaders/JSONLoader.js"></script>
-		<script src="../src/extras/loaders/SceneLoader.js"></script>
-		<script src="../src/extras/loaders/UTF8Loader.js"></script>
-		<script src="../src/extras/objects/MarchingCubes.js"></script>
-		<script src="../src/extras/objects/Trident.js"></script>
-		<script src="../src/extras/physics/Collisions.js"></script>
-		<script src="../src/extras/physics/CollisionUtils.js"></script>
-		<script src="../src/extras/renderers/AnaglyphWebGLRenderer.js"></script>
-		<script src="../src/extras/renderers/CrosseyedWebGLRenderer.js"></script>
+		<script src="../build/Three.js"></script>
 
 		<script src="js/ShaderExtras.js"></script>
 
@@ -171,6 +65,7 @@
 				document.body.appendChild( container );
 
 				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 10000 );
+				camera.useTarget = true;
 				camera.position.z = 3200;
 
 				scene = new THREE.Scene();

+ 5 - 5
examples/webgl_utf8loader.html

@@ -71,8 +71,8 @@
 				document.body.appendChild( container );
 
 				camera = new THREE.Camera( 20, SCREEN_WIDTH / SCREEN_HEIGHT, NEAR, FAR );
+				camera.useTarget = true;
 				camera.position.z = 800;
-				camera.updateMatrix();
 
 				scene = new THREE.Scene();
 				scene.fog = new THREE.Fog( 0x000000, 800, FAR );
@@ -81,10 +81,10 @@
 				var path = "textures/cube/SwedishRoyalCastle/";
 				var format = '.jpg';
 				var urls = [
-						path + 'px' + format, path + 'nx' + format,
-						path + 'py' + format, path + 'ny' + format,
-						path + 'pz' + format, path + 'nz' + format
-					];
+					path + 'px' + format, path + 'nx' + format,
+					path + 'py' + format, path + 'ny' + format,
+					path + 'pz' + format, path + 'nz' + format
+				];
 
 				reflectionCube = THREE.ImageUtils.loadTextureCube( urls );
 

+ 2 - 0
src/extras/loaders/SceneLoader.js

@@ -360,10 +360,12 @@ THREE.SceneLoader.prototype = {
 				if ( c.type == "perspective" ) {
 
 					camera = new THREE.Camera( c.fov, c.aspect, c.near, c.far );
+					camera.useTarget = true;
 
 				} else if ( c.type == "ortho" ) {
 
 					camera = new THREE.Camera();
+					camera.useTarget = true;
 					camera.projectionMatrix = THREE.Matrix4.makeOrtho( c.left, c.right, c.top, c.bottom, c.near, c.far );
 
 				}

+ 1 - 0
src/renderers/WebGLRenderer.js

@@ -3488,6 +3488,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		if ( ! _cameraLight ) {
 
 			_cameraLight = new THREE.Camera( _this.shadowCameraFov, _this.shadowMapWidth / _this.shadowMapHeight, _this.shadowCameraNear, _this.shadowCameraFar );
+			_cameraLight.useTarget = true;
 
 		}