Browse Source

Fixed bugs in immediate rendering.

alteredq 14 years ago
parent
commit
f485330ae6

+ 168 - 167
build/Three.js

@@ -27,8 +27,8 @@ THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,m,n,
 c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());h.cross(k,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=k.x;this.n21=f.y;this.n22=h.y;this.n23=k.y;this.n31=f.z;this.n32=h.z;this.n33=k.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h;
 c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());h.cross(k,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=k.x;this.n21=f.y;this.n22=h.y;this.n23=k.y;this.n31=f.z;this.n32=h.z;this.n33=k.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h;
 b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
 b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
 e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,p=b.n23,t=b.n24,w=b.n31,u=b.n32,x=b.n33,v=b.n34,y=b.n41,z=b.n42,A=b.n43,F=b.n44,E=c.n11,D=c.n12,
 e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,p=b.n23,t=b.n24,w=b.n31,u=b.n32,x=b.n33,v=b.n34,y=b.n41,z=b.n42,A=b.n43,F=b.n44,E=c.n11,D=c.n12,
-G=c.n13,L=c.n14,M=c.n21,J=c.n22,B=c.n23,K=c.n24,ca=c.n31,I=c.n32,P=c.n33,Q=c.n34,S=c.n41,W=c.n42,o=c.n43,da=c.n44;this.n11=e*E+f*M+h*ca+k*S;this.n12=e*D+f*J+h*I+k*W;this.n13=e*G+f*B+h*P+k*o;this.n14=e*L+f*K+h*Q+k*da;this.n21=m*E+n*M+p*ca+t*S;this.n22=m*D+n*J+p*I+t*W;this.n23=m*G+n*B+p*P+t*o;this.n24=m*L+n*K+p*Q+t*da;this.n31=w*E+u*M+x*ca+v*S;this.n32=w*D+u*J+x*I+v*W;this.n33=w*G+u*B+x*P+v*o;this.n34=w*L+u*K+x*Q+v*da;this.n41=y*E+z*M+A*ca+F*S;this.n42=y*D+z*J+A*I+F*W;this.n43=y*G+z*B+A*P+F*o;this.n44=
-y*L+z*K+A*Q+F*da;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*=
+G=c.n13,L=c.n14,M=c.n21,J=c.n22,B=c.n23,K=c.n24,da=c.n31,I=c.n32,P=c.n33,Q=c.n34,S=c.n41,W=c.n42,o=c.n43,ea=c.n44;this.n11=e*E+f*M+h*da+k*S;this.n12=e*D+f*J+h*I+k*W;this.n13=e*G+f*B+h*P+k*o;this.n14=e*L+f*K+h*Q+k*ea;this.n21=m*E+n*M+p*da+t*S;this.n22=m*D+n*J+p*I+t*W;this.n23=m*G+n*B+p*P+t*o;this.n24=m*L+n*K+p*Q+t*ea;this.n31=w*E+u*M+x*da+v*S;this.n32=w*D+u*J+x*I+v*W;this.n33=w*G+u*B+x*P+v*o;this.n34=w*L+u*K+x*Q+v*ea;this.n41=y*E+z*M+A*da+F*S;this.n42=y*D+z*J+A*I+F*W;this.n43=y*G+z*B+A*P+F*o;this.n44=
+y*L+z*K+A*Q+F*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,k=this.n22,m=this.n23,n=this.n24,p=this.n31,t=this.n32,w=this.n33,u=this.n34,x=this.n41,v=this.n42,y=this.n43,z=this.n44;return f*m*t*x-e*n*t*x-f*k*w*x+c*n*w*x+e*k*u*x-c*m*u*x-f*m*p*v+e*n*p*v+f*h*w*v-b*n*w*v-e*h*u*v+b*m*u*v+f*k*p*y-c*n*p*y-f*h*t*y+b*n*t*y+c*h*u*y-b*k*u*y-e*k*p*z+c*m*p*z+e*h*t*z-b*m*t*z-c*h*
 b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,k=this.n22,m=this.n23,n=this.n24,p=this.n31,t=this.n32,w=this.n33,u=this.n34,x=this.n41,v=this.n42,y=this.n43,z=this.n44;return f*m*t*x-e*n*t*x-f*k*w*x+c*n*w*x+e*k*u*x-c*m*u*x-f*m*p*v+e*n*p*v+f*h*w*v-b*n*w*v-e*h*u*v+b*m*u*v+f*k*p*y-c*n*p*y-f*h*t*y+b*n*t*y+c*h*u*y-b*k*u*y-e*k*p*z+c*m*p*z+e*h*t*z-b*m*t*z-c*h*
 w*z+b*k*w*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=
 w*z+b*k*w*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=
 this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=
 this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=
@@ -55,21 +55,21 @@ b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:fu
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 this.remove(b)}};THREE.Object3DCount=0;
 this.remove(b)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function b(){var b=p[n]=p[n]||new THREE.RenderableVertex;n++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,k=b.z+b.w,h=c.z+c.w,m=-b.z+b.w,n=-c.z+c.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?e=Math.max(e,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?e=Math.max(e,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,h,k=[],m,n,p=[],t,w,u=[],x,v=[],y,z,A=[],F,E,D=[],G=[],L=[],M=new THREE.Vector4,J=new THREE.Vector4,
 THREE.Projector=function(){function b(){var b=p[n]=p[n]||new THREE.RenderableVertex;n++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,k=b.z+b.w,h=c.z+c.w,m=-b.z+b.w,n=-c.z+c.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?e=Math.max(e,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?e=Math.max(e,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,h,k=[],m,n,p=[],t,w,u=[],x,v=[],y,z,A=[],F,E,D=[],G=[],L=[],M=new THREE.Vector4,J=new THREE.Vector4,
-B=new THREE.Matrix4,K=new THREE.Matrix4,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(b,c){B.multiply(c.projectionMatrix,c.matrixWorldInverse);B.multiplyVector3(b);return b};this.unprojectVector=function(b,c){B.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));B.multiplyVector3(b);return b};this.projectObjects=function(b,e,m){var o,n;h=G.length=
-0;o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var p;if(!(p=!n.visible))if(p=n instanceof THREE.Mesh)if(p=n.frustumCulled){a:{p=void 0;for(var t=n.matrixWorld,v=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(p=ca[u].x*t.n14+ca[u].y*t.n24+ca[u].z*t.n34+ca[u].w,p<=v){p=!1;break a}p=!0}p=!p}if(!p)p=k[h]=k[h]||new THREE.RenderableObject,h++,f=p,M.copy(n.position),B.multiplyVector3(M),f.object=n,f.z=M.z,G.push(f)}m&&G.sort(c);return G};this.projectScene=
-function(f,k,h){var o=k.near,G=k.far,M,la,ha,ka,aa,ma,ea,Z,$,Y,fa,ia,ra,na,O,oa,qa;E=z=x=w=L.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);B.multiply(k.projectionMatrix,k.matrixWorldInverse);ca[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);ca[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);ca[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);ca[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);ca[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-
-B.n34);ca[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(M=0;M<6;M++)$=ca[M],$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z));$=this.projectObjects(f,k,!0);f=0;for(M=$.length;f<M;f++)if(Y=$[f].object,Y.visible)if(fa=Y.matrixWorld,ia=Y.matrixRotationWorld,ra=Y.materials,na=Y.overdraw,n=0,Y instanceof THREE.Mesh){O=Y.geometry;ka=O.vertices;oa=O.faces;O=O.faceVertexUvs;la=0;for(ha=ka.length;la<ha;la++)m=b(),m.positionWorld.copy(ka[la].position),fa.multiplyVector3(m.positionWorld),m.positionScreen.copy(m.positionWorld),
-B.multiplyVector4(m.positionScreen),m.positionScreen.x/=m.positionScreen.w,m.positionScreen.y/=m.positionScreen.w,m.visible=m.positionScreen.z>o&&m.positionScreen.z<G;ka=0;for(la=oa.length;ka<la;ka++){ha=oa[ka];if(ha instanceof THREE.Face3)if(aa=p[ha.a],ma=p[ha.b],ea=p[ha.c],aa.visible&&ma.visible&&ea.visible&&(Y.doubleSided||Y.flipSided!=(ea.positionScreen.x-aa.positionScreen.x)*(ma.positionScreen.y-aa.positionScreen.y)-(ea.positionScreen.y-aa.positionScreen.y)*(ma.positionScreen.x-aa.positionScreen.x)<
-0))Z=u[w]=u[w]||new THREE.RenderableFace3,w++,t=Z,t.v1.copy(aa),t.v2.copy(ma),t.v3.copy(ea);else continue;else if(ha instanceof THREE.Face4)if(aa=p[ha.a],ma=p[ha.b],ea=p[ha.c],Z=p[ha.d],aa.visible&&ma.visible&&ea.visible&&Z.visible&&(Y.doubleSided||Y.flipSided!=((Z.positionScreen.x-aa.positionScreen.x)*(ma.positionScreen.y-aa.positionScreen.y)-(Z.positionScreen.y-aa.positionScreen.y)*(ma.positionScreen.x-aa.positionScreen.x)<0||(ma.positionScreen.x-ea.positionScreen.x)*(Z.positionScreen.y-ea.positionScreen.y)-
-(ma.positionScreen.y-ea.positionScreen.y)*(Z.positionScreen.x-ea.positionScreen.x)<0)))qa=v[x]=v[x]||new THREE.RenderableFace4,x++,t=qa,t.v1.copy(aa),t.v2.copy(ma),t.v3.copy(ea),t.v4.copy(Z);else continue;t.normalWorld.copy(ha.normal);ia.multiplyVector3(t.normalWorld);t.centroidWorld.copy(ha.centroid);fa.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);B.multiplyVector3(t.centroidScreen);ea=ha.vertexNormals;aa=0;for(ma=ea.length;aa<ma;aa++)Z=t.vertexNormalsWorld[aa],Z.copy(ea[aa]),
-ia.multiplyVector3(Z);aa=0;for(ma=O.length;aa<ma;aa++)if(qa=O[aa][ka]){ea=0;for(Z=qa.length;ea<Z;ea++)t.uvs[aa][ea]=qa[ea]}t.meshMaterials=ra;t.faceMaterials=ha.materials;t.overdraw=na;t.z=t.centroidScreen.z;L.push(t)}}else if(Y instanceof THREE.Line){K.multiply(B,fa);ka=Y.geometry.vertices;aa=b();aa.positionScreen.copy(ka[0].position);K.multiplyVector4(aa.positionScreen);la=1;for(ha=ka.length;la<ha;la++)if(aa=b(),aa.positionScreen.copy(ka[la].position),K.multiplyVector4(aa.positionScreen),ma=p[n-
-2],I.copy(aa.positionScreen),P.copy(ma.positionScreen),e(I,P))I.multiplyScalar(1/I.w),P.multiplyScalar(1/P.w),fa=A[z]=A[z]||new THREE.RenderableLine,z++,y=fa,y.v1.positionScreen.copy(I),y.v2.positionScreen.copy(P),y.z=Math.max(I.z,P.z),y.materials=Y.materials,L.push(y)}else if(Y instanceof THREE.Particle&&(J.set(Y.matrixWorld.n14,Y.matrixWorld.n24,Y.matrixWorld.n34,1),B.multiplyVector4(J),J.z/=J.w,J.z>0&&J.z<1))fa=D[E]=D[E]||new THREE.RenderableParticle,E++,F=fa,F.x=J.x/J.w,F.y=J.y/J.w,F.z=J.z,F.rotation=
-Y.rotation.z,F.scale.x=Y.scale.x*Math.abs(F.x-(J.x+k.projectionMatrix.n11)/(J.w+k.projectionMatrix.n14)),F.scale.y=Y.scale.y*Math.abs(F.y-(J.y+k.projectionMatrix.n22)/(J.w+k.projectionMatrix.n24)),F.materials=Y.materials,L.push(F);h&&L.sort(c);return L}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
+B=new THREE.Matrix4,K=new THREE.Matrix4,da=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(b,c){B.multiply(c.projectionMatrix,c.matrixWorldInverse);B.multiplyVector3(b);return b};this.unprojectVector=function(b,c){B.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));B.multiplyVector3(b);return b};this.projectObjects=function(b,e,m){var o,n;h=G.length=
+0;o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var p;if(!(p=!n.visible))if(p=n instanceof THREE.Mesh)if(p=n.frustumCulled){a:{p=void 0;for(var t=n.matrixWorld,v=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(p=da[u].x*t.n14+da[u].y*t.n24+da[u].z*t.n34+da[u].w,p<=v){p=!1;break a}p=!0}p=!p}if(!p)p=k[h]=k[h]||new THREE.RenderableObject,h++,f=p,M.copy(n.position),B.multiplyVector3(M),f.object=n,f.z=M.z,G.push(f)}m&&G.sort(c);return G};this.projectScene=
+function(f,k,h){var o=k.near,G=k.far,M,pa,$,la,ca,ka,fa,Z,aa,Y,ga,ja,ra,ma,O,na,qa;E=z=x=w=L.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);B.multiply(k.projectionMatrix,k.matrixWorldInverse);da[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);da[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);da[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);da[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);da[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-
+B.n34);da[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(M=0;M<6;M++)aa=da[M],aa.divideScalar(Math.sqrt(aa.x*aa.x+aa.y*aa.y+aa.z*aa.z));aa=this.projectObjects(f,k,!0);f=0;for(M=aa.length;f<M;f++)if(Y=aa[f].object,Y.visible)if(ga=Y.matrixWorld,ja=Y.matrixRotationWorld,ra=Y.materials,ma=Y.overdraw,n=0,Y instanceof THREE.Mesh){O=Y.geometry;la=O.vertices;na=O.faces;O=O.faceVertexUvs;pa=0;for($=la.length;pa<$;pa++)m=b(),m.positionWorld.copy(la[pa].position),ga.multiplyVector3(m.positionWorld),
+m.positionScreen.copy(m.positionWorld),B.multiplyVector4(m.positionScreen),m.positionScreen.x/=m.positionScreen.w,m.positionScreen.y/=m.positionScreen.w,m.visible=m.positionScreen.z>o&&m.positionScreen.z<G;la=0;for(pa=na.length;la<pa;la++){$=na[la];if($ instanceof THREE.Face3)if(ca=p[$.a],ka=p[$.b],fa=p[$.c],ca.visible&&ka.visible&&fa.visible&&(Y.doubleSided||Y.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))Z=u[w]=u[w]||new THREE.RenderableFace3,w++,t=Z,t.v1.copy(ca),t.v2.copy(ka),t.v3.copy(fa);else continue;else if($ instanceof THREE.Face4)if(ca=p[$.a],ka=p[$.b],fa=p[$.c],Z=p[$.d],ca.visible&&ka.visible&&fa.visible&&Z.visible&&(Y.doubleSided||Y.flipSided!=((Z.positionScreen.x-ca.positionScreen.x)*(ka.positionScreen.y-ca.positionScreen.y)-(Z.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<0||(ka.positionScreen.x-fa.positionScreen.x)*
+(Z.positionScreen.y-fa.positionScreen.y)-(ka.positionScreen.y-fa.positionScreen.y)*(Z.positionScreen.x-fa.positionScreen.x)<0)))qa=v[x]=v[x]||new THREE.RenderableFace4,x++,t=qa,t.v1.copy(ca),t.v2.copy(ka),t.v3.copy(fa),t.v4.copy(Z);else continue;t.normalWorld.copy($.normal);ja.multiplyVector3(t.normalWorld);t.centroidWorld.copy($.centroid);ga.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);B.multiplyVector3(t.centroidScreen);fa=$.vertexNormals;ca=0;for(ka=fa.length;ca<ka;ca++)Z=
+t.vertexNormalsWorld[ca],Z.copy(fa[ca]),ja.multiplyVector3(Z);ca=0;for(ka=O.length;ca<ka;ca++)if(qa=O[ca][la]){fa=0;for(Z=qa.length;fa<Z;fa++)t.uvs[ca][fa]=qa[fa]}t.meshMaterials=ra;t.faceMaterials=$.materials;t.overdraw=ma;t.z=t.centroidScreen.z;L.push(t)}}else if(Y instanceof THREE.Line){K.multiply(B,ga);la=Y.geometry.vertices;ca=b();ca.positionScreen.copy(la[0].position);K.multiplyVector4(ca.positionScreen);pa=1;for($=la.length;pa<$;pa++)if(ca=b(),ca.positionScreen.copy(la[pa].position),K.multiplyVector4(ca.positionScreen),
+ka=p[n-2],I.copy(ca.positionScreen),P.copy(ka.positionScreen),e(I,P))I.multiplyScalar(1/I.w),P.multiplyScalar(1/P.w),ga=A[z]=A[z]||new THREE.RenderableLine,z++,y=ga,y.v1.positionScreen.copy(I),y.v2.positionScreen.copy(P),y.z=Math.max(I.z,P.z),y.materials=Y.materials,L.push(y)}else if(Y instanceof THREE.Particle&&(J.set(Y.matrixWorld.n14,Y.matrixWorld.n24,Y.matrixWorld.n34,1),B.multiplyVector4(J),J.z/=J.w,J.z>0&&J.z<1))ga=D[E]=D[E]||new THREE.RenderableParticle,E++,F=ga,F.x=J.x/J.w,F.y=J.y/J.w,F.z=
+J.z,F.rotation=Y.rotation.z,F.scale.x=Y.scale.x*Math.abs(F.x-(J.x+k.projectionMatrix.n11)/(J.w+k.projectionMatrix.n14)),F.scale.y=Y.scale.y*Math.abs(F.y-(J.y+k.projectionMatrix.n22)/(J.w+k.projectionMatrix.n24)),F.materials=Y.materials,L.push(F);h&&L.sort(c);return L}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),k=Math.cos(e),e=Math.sin(e),m=b*c,n=f*h;this.w=m*k-n*e;this.x=m*e+n*k;this.y=f*c*k+b*h*e;this.z=b*h*k-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),k=Math.cos(e),e=Math.sin(e),m=b*c,n=f*h;this.w=m*k-n*e;this.x=m*e+n*k;this.y=f*c*k+b*h*e;this.z=b*h*k-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
 this.x,e=this.y,f=this.z,h=this.w,k=b.x,m=b.y,n=b.z,b=b.w;this.x=c*b+h*k+e*n-f*m;this.y=e*b+h*m+f*k-c*n;this.z=f*b+h*n+c*m-e*k;this.w=h*b-c*k-e*m-f*n;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,k=this.x,m=this.y,n=this.z,p=this.w,t=p*e+m*h-n*f,w=p*f+n*e-k*h,u=p*h+k*f-m*e,e=-k*
 this.x,e=this.y,f=this.z,h=this.w,k=b.x,m=b.y,n=b.z,b=b.w;this.x=c*b+h*k+e*n-f*m;this.y=e*b+h*m+f*k-c*n;this.z=f*b+h*n+c*m-e*k;this.w=h*b-c*k-e*m-f*n;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,k=this.x,m=this.y,n=this.z,p=this.w,t=p*e+m*h-n*f,w=p*f+n*e-k*h,u=p*h+k*f-m*e,e=-k*
-e-m*f-n*h;c.x=t*p+e*-k+w*-n-u*-m;c.y=w*p+e*-m+u*-k-t*-n;c.z=u*p+e*-n+t*-m-w*-k;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var k=Math.acos(h),m=Math.sqrt(1-h*h);if(Math.abs(m)<0.001)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*k)/m;f=Math.sin(f*k)/m;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e};
+e-m*f-n*h;c.x=t*p+e*-k+w*-n-u*-m;c.y=w*p+e*-m+u*-k-t*-n;c.z=u*p+e*-n+t*-m-w*-k;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var k=Math.acos(h),m=Math.sqrt(1-h*h);if(Math.abs(m)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*k)/m;f=Math.sin(f*k)/m;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e};
 THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,h,k){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};
 THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,h,k){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,e,f,h,k,m){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.Face4=function(b,c,e,f,h,k,m){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
@@ -78,9 +78,9 @@ c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid
 e,f,h,k,m,n=new THREE.Vector3,p=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){k=this.faces[f];if(b&&k.vertexNormals.length){n.set(0,0,0);c=0;for(e=k.vertexNormals.length;c<e;c++)n.addSelf(k.vertexNormals[c]);n.divideScalar(3)}else c=this.vertices[k.a],e=this.vertices[k.b],m=this.vertices[k.c],n.sub(m.position,e.position),p.sub(c.position,e.position),n.crossSelf(p);n.isZero()||n.normalize();k.normal.copy(n)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
 e,f,h,k,m,n=new THREE.Vector3,p=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){k=this.faces[f];if(b&&k.vertexNormals.length){n.set(0,0,0);c=0;for(e=k.vertexNormals.length;c<e;c++)n.addSelf(k.vertexNormals[c]);n.divideScalar(3)}else c=this.vertices[k.a],e=this.vertices[k.b],m=this.vertices[k.c],n.sub(m.position,e.position),p.sub(c.position,e.position),n.crossSelf(p);n.isZero()||n.normalize();k.normal.copy(n)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
 Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof
 Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof
 THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),
 THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,c,e,f,k,h,o){n=b.vertices[c].position;p=b.vertices[e].position;t=b.vertices[f].position;w=m[k];u=m[h];x=m[o];v=p.x-n.x;y=t.x-n.x;z=p.y-n.y;A=t.y-n.y;F=p.z-n.z;E=t.z-n.z;D=u.u-w.u;G=x.u-w.u;L=u.v-w.v;M=x.v-w.v;J=1/(D*M-G*L);I.set((M*v-L*y)*J,(M*z-L*A)*J,(M*F-L*E)*J);P.set((D*y-G*v)*J,(D*A-G*z)*J,(D*E-G*F)*J);K[c].addSelf(I);K[e].addSelf(I);K[f].addSelf(I);ca[c].addSelf(P);
-ca[e].addSelf(P);ca[f].addSelf(P)}var c,e,f,h,k,m,n,p,t,w,u,x,v,y,z,A,F,E,D,G,L,M,J,B,K=[],ca=[],I=new THREE.Vector3,P=new THREE.Vector3,Q=new THREE.Vector3,S=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)K[c]=new THREE.Vector3,ca[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],m=this.faceVertexUvs[0][c],k instanceof THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var o=["a",
-"b","c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)W.copy(k.vertexNormals[f]),h=k[o[f]],B=K[h],Q.copy(B),Q.subSelf(W.multiplyScalar(W.dot(B))).normalize(),S.cross(k.vertexNormals[f],B),h=S.dot(ca[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(Q.x,Q.y,Q.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,c,e,f,k,h,o){n=b.vertices[c].position;p=b.vertices[e].position;t=b.vertices[f].position;w=m[k];u=m[h];x=m[o];v=p.x-n.x;y=t.x-n.x;z=p.y-n.y;A=t.y-n.y;F=p.z-n.z;E=t.z-n.z;D=u.u-w.u;G=x.u-w.u;L=u.v-w.v;M=x.v-w.v;J=1/(D*M-G*L);I.set((M*v-L*y)*J,(M*z-L*A)*J,(M*F-L*E)*J);P.set((D*y-G*v)*J,(D*A-G*z)*J,(D*E-G*F)*J);K[c].addSelf(I);K[e].addSelf(I);K[f].addSelf(I);da[c].addSelf(P);
+da[e].addSelf(P);da[f].addSelf(P)}var c,e,f,h,k,m,n,p,t,w,u,x,v,y,z,A,F,E,D,G,L,M,J,B,K=[],da=[],I=new THREE.Vector3,P=new THREE.Vector3,Q=new THREE.Vector3,S=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)K[c]=new THREE.Vector3,da[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],m=this.faceVertexUvs[0][c],k instanceof THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var o=["a",
+"b","c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)W.copy(k.vertexNormals[f]),h=k[o[f]],B=K[h],Q.copy(B),Q.subSelf(W.multiplyScalar(W.dot(B))).normalize(),S.cross(k.vertexNormals[f],B),h=S.dot(da[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(Q.x,Q.y,Q.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},mergeVertices:function(){var b={},c=[],e=[],f,h=Math.pow(10,4),k,m;k=0;for(m=this.vertices.length;k<m;k++)f=this.vertices[k].position,f=[Math.round(f.x*h),Math.round(f.y*h),Math.round(f.z*h)].join("_"),b[f]===void 0?(b[f]=k,c.push(this.vertices[k]),
 b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},mergeVertices:function(){var b={},c=[],e=[],f,h=Math.pow(10,4),k,m;k=0;for(m=this.vertices.length;k<m;k++)f=this.vertices[k].position,f=[Math.round(f.x*h),Math.round(f.y*h),Math.round(f.z*h)].join("_"),b[f]===void 0?(b[f]=k,c.push(this.vertices[k]),
 e[k]=c.length-1):e[k]=e[b[f]];k=0;for(m=this.faces.length;k<m;k++){b=this.faces[k];if(b instanceof THREE.Face3)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c];if(b instanceof THREE.Face4)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c],b.d=e[b.d]}this.vertices=c}};THREE.GeometryCount=0;
 e[k]=c.length-1):e[k]=e[b[f]];k=0;for(m=this.faces.length;k<m;k++){b=this.faces[k];if(b instanceof THREE.Face3)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c];if(b instanceof THREE.Face4)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c],b.d=e[b.d]}this.vertices=c}};THREE.GeometryCount=0;
@@ -148,46 +148,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.Scene.prototype.removeObject=function(b){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(b)};THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;k=f/2};this.render=function(e,f){var p,t,w,u,x,v,y,z;b=c.projectScene(e,f);p=0;for(t=b.length;p<t;p++)if(x=b[p],x instanceof THREE.RenderableParticle){y=x.x*h+h;z=x.y*k+k;w=0;for(u=x.material.length;w<u;w++)if(v=x.material[w],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=y+"px",v.style.top=z+"px"}}};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;k=f/2};this.render=function(e,f){var p,t,w,u,x,v,y,z;b=c.projectScene(e,f);p=0;for(t=b.length;p<t;p++)if(x=b[p],x instanceof THREE.RenderableParticle){y=x.x*h+h;z=x.y*k+k;w=0;for(u=x.material.length;w<u;w++)if(v=x.material[w],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=y+"px",v.style.top=z+"px"}}};
 THREE.CanvasRenderer=function(b){function c(b){if(A!=b)v.globalAlpha=A=b}function e(b){if(F!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}F=b}}function f(b){if(E!=b)v.strokeStyle=E=b}function h(b){if(D!=b)v.fillStyle=D=b}var k=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
 THREE.CanvasRenderer=function(b){function c(b){if(A!=b)v.globalAlpha=A=b}function e(b){if(F!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}F=b}}function f(b){if(E!=b)v.strokeStyle=E=b}function h(b){if(D!=b)v.fillStyle=D=b}var k=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-t,w,u,x,v=p.getContext("2d"),y=new THREE.Color(0),z=0,A=1,F=0,E=null,D=null,G=null,L=null,M=null,J,B,K,ca,I=new THREE.RenderableVertex,P=new THREE.RenderableVertex,Q,S,W,o,da,T,la,ha,ka,aa,ma,ea,Z=new THREE.Color(0),$=new THREE.Color(0),Y=new THREE.Color(0),fa=new THREE.Color(0),ia=new THREE.Color(0),ra=[],na,O,oa,qa,ua,ta,Ea,Aa,Ca,Fa,X=new THREE.Rectangle,U=new THREE.Rectangle,N=new THREE.Rectangle,va=!1,ga=new THREE.Color,ja=new THREE.Color,ya=new THREE.Color,wa=new THREE.Color,pa=new THREE.Vector3,
-Ia,Da,Ka,Ba,Ga,V,b=16;Ia=document.createElement("canvas");Ia.width=Ia.height=2;Da=Ia.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Ka=Da.getImageData(0,0,2,2);Ba=Ka.data;Ga=document.createElement("canvas");Ga.width=Ga.height=b;V=Ga.getContext("2d");V.translate(-b/2,-b/2);V.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,c){t=b;w=c;u=Math.floor(t/2);x=Math.floor(w/2);p.width=t;
+t,w,u,x,v=p.getContext("2d"),y=new THREE.Color(0),z=0,A=1,F=0,E=null,D=null,G=null,L=null,M=null,J,B,K,da,I=new THREE.RenderableVertex,P=new THREE.RenderableVertex,Q,S,W,o,ea,T,pa,$,la,ca,ka,fa,Z=new THREE.Color(0),aa=new THREE.Color(0),Y=new THREE.Color(0),ga=new THREE.Color(0),ja=new THREE.Color(0),ra=[],ma,O,na,qa,ua,ta,Ea,Ba,Da,Fa,X=new THREE.Rectangle,U=new THREE.Rectangle,N=new THREE.Rectangle,va=!1,ha=new THREE.Color,ia=new THREE.Color,ya=new THREE.Color,wa=new THREE.Color,oa=new THREE.Vector3,
+Ia,za,Ka,Ca,Ga,V,b=16;Ia=document.createElement("canvas");Ia.width=Ia.height=2;za=Ia.getContext("2d");za.fillStyle="rgba(0,0,0,1)";za.fillRect(0,0,2,2);Ka=za.getImageData(0,0,2,2);Ca=Ka.data;Ga=document.createElement("canvas");Ga.width=Ga.height=b;V=Ga.getContext("2d");V.translate(-b/2,-b/2);V.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,c){t=b;w=c;u=Math.floor(t/2);x=Math.floor(w/2);p.width=t;
 p.height=w;X.set(-u,-x,u,x);U.set(-u,-x,u,x);A=1;F=0;M=L=G=D=E=null};this.setClearColor=function(b,c){y.copy(b);z=c;U.set(-u,-x,u,x)};this.setClearColorHex=function(b,c){y.setHex(b);z=c;U.set(-u,-x,u,x)};this.clear=function(){v.setTransform(1,0,0,-1,u,x);U.isEmpty()||(U.minSelf(X),U.inflate(2),z<1&&v.clearRect(Math.floor(U.getX()),Math.floor(U.getY()),Math.floor(U.getWidth()),Math.floor(U.getHeight())),z>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
 p.height=w;X.set(-u,-x,u,x);U.set(-u,-x,u,x);A=1;F=0;M=L=G=D=E=null};this.setClearColor=function(b,c){y.copy(b);z=c;U.set(-u,-x,u,x)};this.setClearColorHex=function(b,c){y.setHex(b);z=c;U.set(-u,-x,u,x)};this.clear=function(){v.setTransform(1,0,0,-1,u,x);U.isEmpty()||(U.minSelf(X),U.inflate(2),z<1&&v.clearRect(Math.floor(U.getX()),Math.floor(U.getY()),Math.floor(U.getWidth()),Math.floor(U.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+")"),v.fillRect(Math.floor(U.getX()),Math.floor(U.getY()),Math.floor(U.getWidth()),Math.floor(U.getHeight()))),U.empty())};this.render=function(b,p){function t(b){var c,e,f,k=b.lights;ja.copy(b.ambientColor);ya.setRGB(0,0,0);wa.setRGB(0,0,0);b=0;for(c=k.length;b<c;b++)e=k[b],f=e.color,e instanceof THREE.DirectionalLight?(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b):e instanceof THREE.PointLight&&(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b)}function w(b,c,e,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=e.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=e.dot(pa.sub(h.position,c).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(c.distanceTo(h.position)/h.distance,1),o!=0&&(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)))}function z(b,k,m){c(m.opacity);e(m.blending);var o,n,p,t,w,xa;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)t=m.map.image,w=t.width>>1,xa=t.height>>1,m=k.scale.x*
+255)+","+z+")"),v.fillRect(Math.floor(U.getX()),Math.floor(U.getY()),Math.floor(U.getWidth()),Math.floor(U.getHeight()))),U.empty())};this.render=function(b,p){function t(b){var c,e,f,k=b.lights;ia.copy(b.ambientColor);ya.setRGB(0,0,0);wa.setRGB(0,0,0);b=0;for(c=k.length;b<c;b++)e=k[b],f=e.color,e instanceof THREE.DirectionalLight?(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b):e instanceof THREE.PointLight&&(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b)}function w(b,c,e,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=e.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=e.dot(oa.sub(h.position,c).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(c.distanceTo(h.position)/h.distance,1),o!=0&&(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)))}function z(b,k,m){c(m.opacity);e(m.blending);var o,n,p,t,w,xa;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)t=m.map.image,w=t.width>>1,xa=t.height>>1,m=k.scale.x*
 u,p=k.scale.y*x,o=m*w,n=p*xa,N.set(b.x-o,b.y-n,b.x+o,b.y+n),X.intersects(N)&&(v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(m,-p),v.translate(-w,-xa),v.drawImage(t,0,0),v.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*u,n=k.scale.y*x,N.set(b.x-o,b.y-n,b.x+o,b.y+n),X.intersects(N)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(o,n),m.program(v),v.restore()))}function A(b,k,h,m){c(m.opacity);
 u,p=k.scale.y*x,o=m*w,n=p*xa,N.set(b.x-o,b.y-n,b.x+o,b.y+n),X.intersects(N)&&(v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(m,-p),v.translate(-w,-xa),v.drawImage(t,0,0),v.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*u,n=k.scale.y*x,N.set(b.x-o,b.y-n,b.x+o,b.y+n),X.intersects(N)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(o,n),m.program(v),v.restore()))}function A(b,k,h,m){c(m.opacity);
 e(m.blending);v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(k.positionScreen.x,k.positionScreen.y);v.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(G!=b)v.lineWidth=G=b;b=m.linecap;if(L!=b)v.lineCap=L=b;b=m.linejoin;if(M!=b)v.lineJoin=M=b;f(m.color.getContextStyle());v.stroke();N.inflate(m.linewidth*2)}}function y(b,f,h,m,n,t,u,v,x){k.info.render.vertices+=3;k.info.render.faces++;c(v.opacity);e(v.blending);Q=b.positionScreen.x;S=b.positionScreen.y;W=
 e(m.blending);v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(k.positionScreen.x,k.positionScreen.y);v.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(G!=b)v.lineWidth=G=b;b=m.linecap;if(L!=b)v.lineCap=L=b;b=m.linejoin;if(M!=b)v.lineJoin=M=b;f(m.color.getContextStyle());v.stroke();N.inflate(m.linewidth*2)}}function y(b,f,h,m,n,t,u,v,x){k.info.render.vertices+=3;k.info.render.faces++;c(v.opacity);e(v.blending);Q=b.positionScreen.x;S=b.positionScreen.y;W=
-f.positionScreen.x;o=f.positionScreen.y;da=h.positionScreen.x;T=h.positionScreen.y;E(Q,S,W,o,da,T);if(v instanceof THREE.MeshBasicMaterial)if(v.map)v.map.mapping instanceof THREE.UVMapping&&(qa=u.uvs[0],ab(Q,S,W,o,da,T,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[t].u,qa[t].v,v.map));else if(v.envMap){if(v.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=p.matrixWorldInverse,pa.copy(u.vertexNormalsWorld[0]),ua=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,ta=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+
-0.5,pa.copy(u.vertexNormalsWorld[1]),Ea=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Aa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(u.vertexNormalsWorld[2]),Ca=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Fa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,ab(Q,S,W,o,da,T,ua,ta,Ea,Aa,Ca,Fa,v.envMap)}else v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshLambertMaterial)v.map&&!v.wireframe&&(v.map.mapping instanceof THREE.UVMapping&&
-(qa=u.uvs[0],ab(Q,S,W,o,da,T,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[t].u,qa[t].v,v.map)),e(THREE.SubtractiveBlending)),va?!v.wireframe&&v.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?($.r=Y.r=fa.r=ja.r,$.g=Y.g=fa.g=ja.g,$.b=Y.b=fa.b=ja.b,w(x,u.v1.positionWorld,u.vertexNormalsWorld[0],$),w(x,u.v2.positionWorld,u.vertexNormalsWorld[1],Y),w(x,u.v3.positionWorld,u.vertexNormalsWorld[2],fa),$.r=Math.max(0,Math.min(v.color.r*$.r,1)),$.g=Math.max(0,Math.min(v.color.g*$.g,1)),$.b=Math.max(0,Math.min(v.color.b*
-$.b,1)),Y.r=Math.max(0,Math.min(v.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(v.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(v.color.b*Y.b,1)),fa.r=Math.max(0,Math.min(v.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(v.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(v.color.b*fa.b,1)),ia.r=(Y.r+fa.r)*0.5,ia.g=(Y.g+fa.g)*0.5,ia.b=(Y.b+fa.b)*0.5,oa=Ya($,Y,fa,ia),Va(Q,S,W,o,da,T,0,0,1,0,0,1,oa)):(ga.r=ja.r,ga.g=ja.g,ga.b=ja.b,w(x,u.centroidWorld,u.normalWorld,ga),Z.r=Math.max(0,Math.min(v.color.r*ga.r,1)),Z.g=Math.max(0,
-Math.min(v.color.g*ga.g,1)),Z.b=Math.max(0,Math.min(v.color.b*ga.b,1)),v.wireframe?Na(Z,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(Z)):v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshDepthMaterial)na=p.near,O=p.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,O),Y.r=Y.g=Y.b=1-Ra(f.positionScreen.z,na,O),fa.r=fa.g=fa.b=1-Ra(h.positionScreen.z,na,O),ia.r=(Y.r+fa.r)*0.5,ia.g=(Y.g+fa.g)*0.5,ia.b=(Y.b+fa.b)*0.5,
-oa=Ya($,Y,fa,ia),Va(Q,S,W,o,da,T,0,0,1,0,0,1,oa);else if(v instanceof THREE.MeshNormalMaterial)Z.r=Wa(u.normalWorld.x),Z.g=Wa(u.normalWorld.y),Z.b=Wa(u.normalWorld.z),v.wireframe?Na(Z,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(Z)}function F(b,f,h,m,n,t,v,u,x){k.info.render.vertices+=4;k.info.render.faces++;c(u.opacity);e(u.blending);if(u.map||u.envMap)y(b,f,m,0,1,3,v,u,x),y(n,h,t,1,2,3,v,u,x);else if(Q=b.positionScreen.x,S=b.positionScreen.y,W=f.positionScreen.x,o=f.positionScreen.y,
-da=h.positionScreen.x,T=h.positionScreen.y,la=m.positionScreen.x,ha=m.positionScreen.y,ka=n.positionScreen.x,aa=n.positionScreen.y,ma=t.positionScreen.x,ea=t.positionScreen.y,u instanceof THREE.MeshBasicMaterial)D(Q,S,W,o,da,T,la,ha),u.wireframe?Na(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color);else if(u instanceof THREE.MeshLambertMaterial)va?!u.wireframe&&u.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==4?($.r=Y.r=fa.r=ia.r=ja.r,$.g=Y.g=fa.g=ia.g=ja.g,
-$.b=Y.b=fa.b=ia.b=ja.b,w(x,v.v1.positionWorld,v.vertexNormalsWorld[0],$),w(x,v.v2.positionWorld,v.vertexNormalsWorld[1],Y),w(x,v.v4.positionWorld,v.vertexNormalsWorld[3],fa),w(x,v.v3.positionWorld,v.vertexNormalsWorld[2],ia),$.r=Math.max(0,Math.min(u.color.r*$.r,1)),$.g=Math.max(0,Math.min(u.color.g*$.g,1)),$.b=Math.max(0,Math.min(u.color.b*$.b,1)),Y.r=Math.max(0,Math.min(u.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(u.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(u.color.b*Y.b,1)),fa.r=Math.max(0,Math.min(u.color.r*
-fa.r,1)),fa.g=Math.max(0,Math.min(u.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(u.color.b*fa.b,1)),ia.r=Math.max(0,Math.min(u.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(u.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(u.color.b*ia.b,1)),oa=Ya($,Y,fa,ia),E(Q,S,W,o,la,ha),Va(Q,S,W,o,la,ha,0,0,1,0,0,1,oa),E(ka,aa,da,T,ma,ea),Va(ka,aa,da,T,ma,ea,1,0,1,1,0,1,oa)):(ga.r=ja.r,ga.g=ja.g,ga.b=ja.b,w(x,v.centroidWorld,v.normalWorld,ga),Z.r=Math.max(0,Math.min(u.color.r*ga.r,1)),Z.g=Math.max(0,Math.min(u.color.g*ga.g,
-1)),Z.b=Math.max(0,Math.min(u.color.b*ga.b,1)),D(Q,S,W,o,da,T,la,ha),u.wireframe?Na(Z,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(Z)):(D(Q,S,W,o,da,T,la,ha),u.wireframe?Na(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color));else if(u instanceof THREE.MeshNormalMaterial)Z.r=Wa(v.normalWorld.x),Z.g=Wa(v.normalWorld.y),Z.b=Wa(v.normalWorld.z),D(Q,S,W,o,da,T,la,ha),u.wireframe?Na(Z,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(Z);else if(u instanceof
-THREE.MeshDepthMaterial)na=p.near,O=p.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,O),Y.r=Y.g=Y.b=1-Ra(f.positionScreen.z,na,O),fa.r=fa.g=fa.b=1-Ra(m.positionScreen.z,na,O),ia.r=ia.g=ia.b=1-Ra(h.positionScreen.z,na,O),oa=Ya($,Y,fa,ia),E(Q,S,W,o,la,ha),Va(Q,S,W,o,la,ha,0,0,1,0,0,1,oa),E(ka,aa,da,T,ma,ea),Va(ka,aa,da,T,ma,ea,1,0,1,1,0,1,oa)}function E(b,c,e,f,k,h){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(b,c);v.closePath()}function D(b,c,e,f,k,h,m,o){v.beginPath();v.moveTo(b,c);
-v.lineTo(e,f);v.lineTo(k,h);v.lineTo(m,o);v.lineTo(b,c);v.closePath()}function Na(b,c,e,k){if(G!=c)v.lineWidth=G=c;if(L!=e)v.lineCap=L=e;if(M!=k)v.lineJoin=M=k;f(b.getContextStyle());v.stroke();N.inflate(c*2)}function Oa(b){h(b.getContextStyle());v.fill()}function ab(b,c,e,f,k,m,o,n,p,t,u,x,w){if(w.image.width!=0){if(w.needsUpdate==!0||ra[w.id]==void 0){var xa=w.wrapS==THREE.RepeatWrapping,z=w.wrapT==THREE.RepeatWrapping;ra[w.id]=v.createPattern(w.image,xa&&z?"repeat":xa&&!z?"repeat-x":!xa&&z?"repeat-y":
-"no-repeat");w.needsUpdate=!1}h(ra[w.id]);var xa=w.offset.x/w.repeat.x,z=w.offset.y/w.repeat.y,X=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+xa)*X,n=(n+z)*w,p=(p+xa)*X,t=(t+z)*w,u=(u+xa)*X,x=(x+z)*w;e-=b;f-=c;k-=b;m-=c;p-=o;t-=n;u-=o;x-=n;xa=1/(p*x-u*t);w=(x*e-t*k)*xa;t=(x*f-t*m)*xa;e=(p*k-u*e)*xa;f=(p*m-u*f)*xa;b=b-w*o-e*n;c=c-t*o-f*n;v.save();v.transform(w,t,e,f,b,c);v.fill();v.restore()}}function Va(b,c,e,f,k,h,m,o,n,p,t,u,w){var x,xa;x=w.width-1;xa=w.height-1;m*=x;o*=xa;
-n*=x;p*=xa;t*=x;u*=xa;e-=b;f-=c;k-=b;h-=c;n-=m;p-=o;t-=m;u-=o;xa=1/(n*u-t*p);x=(u*e-p*k)*xa;p=(u*f-p*h)*xa;e=(n*k-t*e)*xa;f=(n*h-t*f)*xa;b=b-x*m-e*o;c=c-p*m-f*o;v.save();v.transform(x,p,e,f,b,c);v.clip();v.drawImage(w,0,0);v.restore()}function Ya(b,c,e,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255),t=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Ba[0]=k<0?0:k>255?255:k;Ba[1]=h<0?0:h>255?255:h;Ba[2]=b<0?0:b>255?255:b;Ba[4]=
-m<0?0:m>255?255:m;Ba[5]=o<0?0:o>255?255:o;Ba[6]=c<0?0:c>255?255:c;Ba[8]=n<0?0:n>255?255:n;Ba[9]=p<0?0:p>255?255:p;Ba[10]=e<0?0:e>255?255:e;Ba[12]=t<0?0:t>255?255:t;Ba[13]=u<0?0:u>255?255:u;Ba[14]=f<0?0:f>255?255:f;Da.putImageData(Ka,0,0);V.drawImage(Ia,0,0);return Ga}function Ra(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Wa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(b,c){var e=c.x-b.x,f=c.y-b.y,k=e*e+f*f;k!=0&&(k=1/Math.sqrt(k),e*=k,f*=k,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Za,bb,sa,Ha,Qa,
-Xa,$a,za;this.autoClear?this.clear():v.setTransform(1,0,0,-1,u,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,p,this.sortElements);(va=b.lights.length>0)&&t(b);Za=0;for(bb=m.length;Za<bb;Za++){sa=m[Za];N.empty();if(sa instanceof THREE.RenderableParticle){J=sa;J.x*=u;J.y*=x;Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&z(J,sa,za,b)}else if(sa instanceof THREE.RenderableLine){if(J=sa.v1,B=sa.v2,J.positionScreen.x*=u,J.positionScreen.y*=x,B.positionScreen.x*=
-u,B.positionScreen.y*=x,N.addPoint(J.positionScreen.x,J.positionScreen.y),N.addPoint(B.positionScreen.x,B.positionScreen.y),X.intersects(N)){Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&A(J,B,sa,za,b)}}else if(sa instanceof THREE.RenderableFace3){if(J=sa.v1,B=sa.v2,K=sa.v3,J.positionScreen.x*=u,J.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,K.positionScreen.x*=u,K.positionScreen.y*=x,sa.overdraw&&(Pa(J.positionScreen,B.positionScreen),Pa(B.positionScreen,
-K.positionScreen),Pa(K.positionScreen,J.positionScreen)),N.add3Points(J.positionScreen.x,J.positionScreen.y,B.positionScreen.x,B.positionScreen.y,K.positionScreen.x,K.positionScreen.y),X.intersects(N)){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&y(J,B,K,0,1,2,sa,za,b)}else za.opacity!=0&&y(J,B,K,0,1,2,sa,za,b)}}else if(sa instanceof THREE.RenderableFace4&&
-(J=sa.v1,B=sa.v2,K=sa.v3,ca=sa.v4,J.positionScreen.x*=u,J.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,K.positionScreen.x*=u,K.positionScreen.y*=x,ca.positionScreen.x*=u,ca.positionScreen.y*=x,I.positionScreen.copy(B.positionScreen),P.positionScreen.copy(ca.positionScreen),sa.overdraw&&(Pa(J.positionScreen,B.positionScreen),Pa(B.positionScreen,ca.positionScreen),Pa(ca.positionScreen,J.positionScreen),Pa(K.positionScreen,I.positionScreen),Pa(K.positionScreen,P.positionScreen)),N.addPoint(J.positionScreen.x,
-J.positionScreen.y),N.addPoint(B.positionScreen.x,B.positionScreen.y),N.addPoint(K.positionScreen.x,K.positionScreen.y),N.addPoint(ca.positionScreen.x,ca.positionScreen.y),X.intersects(N))){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&F(J,B,K,ca,I,P,sa,za,b)}else za.opacity!=0&&F(J,B,K,ca,I,P,sa,za,b)}U.addRectangle(N)}v.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(b,c,e){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=c.normalWorld.dot(h.position)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m)):h instanceof THREE.PointLight&&(ca.sub(h.position,c.centroidWorld),ca.normalize(),m=c.normalWorld.dot(ca)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m))}function c(c,e,m,o,n,t){k.info.render.vertices+=3;k.info.render.faces++;Q=f(S++);
+f.positionScreen.x;o=f.positionScreen.y;ea=h.positionScreen.x;T=h.positionScreen.y;E(Q,S,W,o,ea,T);if(v instanceof THREE.MeshBasicMaterial)if(v.map)v.map.mapping instanceof THREE.UVMapping&&(qa=u.uvs[0],ab(Q,S,W,o,ea,T,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[t].u,qa[t].v,v.map));else if(v.envMap){if(v.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=p.matrixWorldInverse,oa.copy(u.vertexNormalsWorld[0]),ua=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,ta=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+
+0.5,oa.copy(u.vertexNormalsWorld[1]),Ea=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Ba=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(u.vertexNormalsWorld[2]),Da=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Fa=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,ab(Q,S,W,o,ea,T,ua,ta,Ea,Ba,Da,Fa,v.envMap)}else v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshLambertMaterial)v.map&&!v.wireframe&&(v.map.mapping instanceof THREE.UVMapping&&
+(qa=u.uvs[0],ab(Q,S,W,o,ea,T,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[t].u,qa[t].v,v.map)),e(THREE.SubtractiveBlending)),va?!v.wireframe&&v.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?(aa.r=Y.r=ga.r=ia.r,aa.g=Y.g=ga.g=ia.g,aa.b=Y.b=ga.b=ia.b,w(x,u.v1.positionWorld,u.vertexNormalsWorld[0],aa),w(x,u.v2.positionWorld,u.vertexNormalsWorld[1],Y),w(x,u.v3.positionWorld,u.vertexNormalsWorld[2],ga),aa.r=Math.max(0,Math.min(v.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(v.color.g*aa.g,1)),aa.b=Math.max(0,
+Math.min(v.color.b*aa.b,1)),Y.r=Math.max(0,Math.min(v.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(v.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(v.color.b*Y.b,1)),ga.r=Math.max(0,Math.min(v.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(v.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(v.color.b*ga.b,1)),ja.r=(Y.r+ga.r)*0.5,ja.g=(Y.g+ga.g)*0.5,ja.b=(Y.b+ga.b)*0.5,na=Ya(aa,Y,ga,ja),Va(Q,S,W,o,ea,T,0,0,1,0,0,1,na)):(ha.r=ia.r,ha.g=ia.g,ha.b=ia.b,w(x,u.centroidWorld,u.normalWorld,ha),Z.r=Math.max(0,Math.min(v.color.r*ha.r,
+1)),Z.g=Math.max(0,Math.min(v.color.g*ha.g,1)),Z.b=Math.max(0,Math.min(v.color.b*ha.b,1)),v.wireframe?Na(Z,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(Z)):v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshDepthMaterial)ma=p.near,O=p.far,aa.r=aa.g=aa.b=1-Ra(b.positionScreen.z,ma,O),Y.r=Y.g=Y.b=1-Ra(f.positionScreen.z,ma,O),ga.r=ga.g=ga.b=1-Ra(h.positionScreen.z,ma,O),ja.r=(Y.r+ga.r)*0.5,ja.g=(Y.g+ga.g)*
+0.5,ja.b=(Y.b+ga.b)*0.5,na=Ya(aa,Y,ga,ja),Va(Q,S,W,o,ea,T,0,0,1,0,0,1,na);else if(v instanceof THREE.MeshNormalMaterial)Z.r=Wa(u.normalWorld.x),Z.g=Wa(u.normalWorld.y),Z.b=Wa(u.normalWorld.z),v.wireframe?Na(Z,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(Z)}function F(b,f,h,m,n,t,v,u,x){k.info.render.vertices+=4;k.info.render.faces++;c(u.opacity);e(u.blending);if(u.map||u.envMap)y(b,f,m,0,1,3,v,u,x),y(n,h,t,1,2,3,v,u,x);else if(Q=b.positionScreen.x,S=b.positionScreen.y,W=f.positionScreen.x,
+o=f.positionScreen.y,ea=h.positionScreen.x,T=h.positionScreen.y,pa=m.positionScreen.x,$=m.positionScreen.y,la=n.positionScreen.x,ca=n.positionScreen.y,ka=t.positionScreen.x,fa=t.positionScreen.y,u instanceof THREE.MeshBasicMaterial)D(Q,S,W,o,ea,T,pa,$),u.wireframe?Na(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color);else if(u instanceof THREE.MeshLambertMaterial)va?!u.wireframe&&u.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==4?(aa.r=Y.r=ga.r=ja.r=ia.r,
+aa.g=Y.g=ga.g=ja.g=ia.g,aa.b=Y.b=ga.b=ja.b=ia.b,w(x,v.v1.positionWorld,v.vertexNormalsWorld[0],aa),w(x,v.v2.positionWorld,v.vertexNormalsWorld[1],Y),w(x,v.v4.positionWorld,v.vertexNormalsWorld[3],ga),w(x,v.v3.positionWorld,v.vertexNormalsWorld[2],ja),aa.r=Math.max(0,Math.min(u.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(u.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(u.color.b*aa.b,1)),Y.r=Math.max(0,Math.min(u.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(u.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(u.color.b*
+Y.b,1)),ga.r=Math.max(0,Math.min(u.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(u.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(u.color.b*ga.b,1)),ja.r=Math.max(0,Math.min(u.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(u.color.g*ja.g,1)),ja.b=Math.max(0,Math.min(u.color.b*ja.b,1)),na=Ya(aa,Y,ga,ja),E(Q,S,W,o,pa,$),Va(Q,S,W,o,pa,$,0,0,1,0,0,1,na),E(la,ca,ea,T,ka,fa),Va(la,ca,ea,T,ka,fa,1,0,1,1,0,1,na)):(ha.r=ia.r,ha.g=ia.g,ha.b=ia.b,w(x,v.centroidWorld,v.normalWorld,ha),Z.r=Math.max(0,Math.min(u.color.r*ha.r,
+1)),Z.g=Math.max(0,Math.min(u.color.g*ha.g,1)),Z.b=Math.max(0,Math.min(u.color.b*ha.b,1)),D(Q,S,W,o,ea,T,pa,$),u.wireframe?Na(Z,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(Z)):(D(Q,S,W,o,ea,T,pa,$),u.wireframe?Na(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color));else if(u instanceof THREE.MeshNormalMaterial)Z.r=Wa(v.normalWorld.x),Z.g=Wa(v.normalWorld.y),Z.b=Wa(v.normalWorld.z),D(Q,S,W,o,ea,T,pa,$),u.wireframe?Na(Z,u.wireframeLinewidth,u.wireframeLinecap,
+u.wireframeLinejoin):Oa(Z);else if(u instanceof THREE.MeshDepthMaterial)ma=p.near,O=p.far,aa.r=aa.g=aa.b=1-Ra(b.positionScreen.z,ma,O),Y.r=Y.g=Y.b=1-Ra(f.positionScreen.z,ma,O),ga.r=ga.g=ga.b=1-Ra(m.positionScreen.z,ma,O),ja.r=ja.g=ja.b=1-Ra(h.positionScreen.z,ma,O),na=Ya(aa,Y,ga,ja),E(Q,S,W,o,pa,$),Va(Q,S,W,o,pa,$,0,0,1,0,0,1,na),E(la,ca,ea,T,ka,fa),Va(la,ca,ea,T,ka,fa,1,0,1,1,0,1,na)}function E(b,c,e,f,k,h){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(b,c);v.closePath()}function D(b,
+c,e,f,k,h,m,o){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(m,o);v.lineTo(b,c);v.closePath()}function Na(b,c,e,k){if(G!=c)v.lineWidth=G=c;if(L!=e)v.lineCap=L=e;if(M!=k)v.lineJoin=M=k;f(b.getContextStyle());v.stroke();N.inflate(c*2)}function Oa(b){h(b.getContextStyle());v.fill()}function ab(b,c,e,f,k,m,o,n,p,t,u,x,w){if(w.image.width!=0){if(w.needsUpdate==!0||ra[w.id]==void 0){var xa=w.wrapS==THREE.RepeatWrapping,z=w.wrapT==THREE.RepeatWrapping;ra[w.id]=v.createPattern(w.image,
+xa&&z?"repeat":xa&&!z?"repeat-x":!xa&&z?"repeat-y":"no-repeat");w.needsUpdate=!1}h(ra[w.id]);var xa=w.offset.x/w.repeat.x,z=w.offset.y/w.repeat.y,X=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+xa)*X,n=(n+z)*w,p=(p+xa)*X,t=(t+z)*w,u=(u+xa)*X,x=(x+z)*w;e-=b;f-=c;k-=b;m-=c;p-=o;t-=n;u-=o;x-=n;xa=1/(p*x-u*t);w=(x*e-t*k)*xa;t=(x*f-t*m)*xa;e=(p*k-u*e)*xa;f=(p*m-u*f)*xa;b=b-w*o-e*n;c=c-t*o-f*n;v.save();v.transform(w,t,e,f,b,c);v.fill();v.restore()}}function Va(b,c,e,f,k,h,m,o,n,p,t,
+u,w){var x,xa;x=w.width-1;xa=w.height-1;m*=x;o*=xa;n*=x;p*=xa;t*=x;u*=xa;e-=b;f-=c;k-=b;h-=c;n-=m;p-=o;t-=m;u-=o;xa=1/(n*u-t*p);x=(u*e-p*k)*xa;p=(u*f-p*h)*xa;e=(n*k-t*e)*xa;f=(n*h-t*f)*xa;b=b-x*m-e*o;c=c-p*m-f*o;v.save();v.transform(x,p,e,f,b,c);v.clip();v.drawImage(w,0,0);v.restore()}function Ya(b,c,e,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255),t=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Ca[0]=k<0?0:k>255?255:
+k;Ca[1]=h<0?0:h>255?255:h;Ca[2]=b<0?0:b>255?255:b;Ca[4]=m<0?0:m>255?255:m;Ca[5]=o<0?0:o>255?255:o;Ca[6]=c<0?0:c>255?255:c;Ca[8]=n<0?0:n>255?255:n;Ca[9]=p<0?0:p>255?255:p;Ca[10]=e<0?0:e>255?255:e;Ca[12]=t<0?0:t>255?255:t;Ca[13]=u<0?0:u>255?255:u;Ca[14]=f<0?0:f>255?255:f;za.putImageData(Ka,0,0);V.drawImage(Ia,0,0);return Ga}function Ra(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Wa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(b,c){var e=c.x-b.x,f=c.y-b.y,k=e*e+f*f;k!=0&&(k=1/Math.sqrt(k),e*=
+k,f*=k,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Za,bb,sa,Ha,Qa,Xa,$a,Aa;this.autoClear?this.clear():v.setTransform(1,0,0,-1,u,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,p,this.sortElements);(va=b.lights.length>0)&&t(b);Za=0;for(bb=m.length;Za<bb;Za++){sa=m[Za];N.empty();if(sa instanceof THREE.RenderableParticle){J=sa;J.x*=u;J.y*=x;Ha=0;for(Qa=sa.materials.length;Ha<Qa;)Aa=sa.materials[Ha++],Aa.opacity!=0&&z(J,sa,Aa,b)}else if(sa instanceof THREE.RenderableLine){if(J=sa.v1,B=sa.v2,
+J.positionScreen.x*=u,J.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,N.addPoint(J.positionScreen.x,J.positionScreen.y),N.addPoint(B.positionScreen.x,B.positionScreen.y),X.intersects(N)){Ha=0;for(Qa=sa.materials.length;Ha<Qa;)Aa=sa.materials[Ha++],Aa.opacity!=0&&A(J,B,sa,Aa,b)}}else if(sa instanceof THREE.RenderableFace3){if(J=sa.v1,B=sa.v2,K=sa.v3,J.positionScreen.x*=u,J.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,K.positionScreen.x*=u,K.positionScreen.y*=x,
+sa.overdraw&&(Pa(J.positionScreen,B.positionScreen),Pa(B.positionScreen,K.positionScreen),Pa(K.positionScreen,J.positionScreen)),N.add3Points(J.positionScreen.x,J.positionScreen.y,B.positionScreen.x,B.positionScreen.y,K.positionScreen.x,K.positionScreen.y),X.intersects(N)){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(Aa=sa.meshMaterials[Ha++],Aa instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(Aa=sa.faceMaterials[Xa++])&&Aa.opacity!=0&&y(J,B,K,0,1,2,sa,Aa,b)}else Aa.opacity!=
+0&&y(J,B,K,0,1,2,sa,Aa,b)}}else if(sa instanceof THREE.RenderableFace4&&(J=sa.v1,B=sa.v2,K=sa.v3,da=sa.v4,J.positionScreen.x*=u,J.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,K.positionScreen.x*=u,K.positionScreen.y*=x,da.positionScreen.x*=u,da.positionScreen.y*=x,I.positionScreen.copy(B.positionScreen),P.positionScreen.copy(da.positionScreen),sa.overdraw&&(Pa(J.positionScreen,B.positionScreen),Pa(B.positionScreen,da.positionScreen),Pa(da.positionScreen,J.positionScreen),Pa(K.positionScreen,
+I.positionScreen),Pa(K.positionScreen,P.positionScreen)),N.addPoint(J.positionScreen.x,J.positionScreen.y),N.addPoint(B.positionScreen.x,B.positionScreen.y),N.addPoint(K.positionScreen.x,K.positionScreen.y),N.addPoint(da.positionScreen.x,da.positionScreen.y),X.intersects(N))){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(Aa=sa.meshMaterials[Ha++],Aa instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(Aa=sa.faceMaterials[Xa++])&&Aa.opacity!=0&&F(J,B,K,da,I,P,sa,Aa,b)}else Aa.opacity!=
+0&&F(J,B,K,da,I,P,sa,Aa,b)}U.addRectangle(N)}v.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(b,c,e){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=c.normalWorld.dot(h.position)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m)):h instanceof THREE.PointLight&&(da.sub(h.position,c.centroidWorld),da.normalize(),m=c.normalWorld.dot(da)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m))}function c(c,e,m,o,n,t){k.info.render.vertices+=3;k.info.render.faces++;Q=f(S++);
 Q.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(L.r=M.r,L.g=M.g,L.b=M.b,b(t,o,L),G.r=Math.max(0,Math.min(n.color.r*L.r,1)),G.g=Math.max(0,Math.min(n.color.g*L.g,1)),G.b=Math.max(0,Math.min(n.color.b*L.b,1))):G.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-
 Q.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(L.r=M.r,L.g=M.g,L.b=M.b,b(t,o,L),G.r=Math.max(0,Math.min(n.color.r*L.r,1)),G.g=Math.max(0,Math.min(n.color.g*L.g,1)),G.b=Math.max(0,Math.min(n.color.b*L.b,1))):G.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-
 o.z*n.__farMinusNear),G.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+n.opacity);p.appendChild(Q)}function e(c,e,m,o,n,t,u){k.info.render.vertices+=
 o.z*n.__farMinusNear),G.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+n.opacity);p.appendChild(Q)}function e(c,e,m,o,n,t,u){k.info.render.vertices+=
 4;k.info.render.faces++;Q=f(S++);Q.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?G.copy(t.color):t instanceof THREE.MeshLambertMaterial?D?(L.r=M.r,L.g=M.g,L.b=M.b,b(u,n,L),G.r=Math.max(0,Math.min(t.color.r*L.r,1)),G.g=Math.max(0,Math.min(t.color.g*L.g,1)),G.b=Math.max(0,Math.min(t.color.b*L.b,1))):
 4;k.info.render.faces++;Q=f(S++);Q.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?G.copy(t.color):t instanceof THREE.MeshLambertMaterial?D?(L.r=M.r,L.g=M.g,L.b=M.b,b(u,n,L),G.r=Math.max(0,Math.min(t.color.r*L.r,1)),G.g=Math.max(0,Math.min(t.color.g*L.g,1)),G.b=Math.max(0,Math.min(t.color.b*L.b,1))):
 G.copy(t.color):t instanceof THREE.MeshDepthMaterial?(K=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),G.setRGB(K,K,K)):t instanceof THREE.MeshNormalMaterial&&G.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));t.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+
 G.copy(t.color):t instanceof THREE.MeshDepthMaterial?(K=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),G.setRGB(K,K,K)):t instanceof THREE.MeshNormalMaterial&&G.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));t.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+
 "; fill-opacity: "+t.opacity);p.appendChild(Q)}function f(b){I[b]==null&&(I[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&I[b].setAttribute("shape-rendering","crispEdges"));return I[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,w,u,x,v,y,z,A,F=new THREE.Rectangle,E=new THREE.Rectangle,D=!1,G=new THREE.Color(16777215),L=new THREE.Color(16777215),M=new THREE.Color(0),
 "; fill-opacity: "+t.opacity);p.appendChild(Q)}function f(b){I[b]==null&&(I[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&I[b].setAttribute("shape-rendering","crispEdges"));return I[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,w,u,x,v,y,z,A,F=new THREE.Rectangle,E=new THREE.Rectangle,D=!1,G=new THREE.Color(16777215),L=new THREE.Color(16777215),M=new THREE.Color(0),
-J=new THREE.Color(0),B=new THREE.Color(0),K,ca=new THREE.Vector3,I=[],P=[],Q,S,W,o=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,c){t=b;w=c;u=t/2;x=w/2;p.setAttribute("viewBox",-u+" "+-x+" "+t+" "+w);p.setAttribute("width",t);p.setAttribute("height",w);F.set(-u,-x,u,x)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};
-this.render=function(b,f){var h,t,w,G,L,I,K,$;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);W=S=0;if(D=b.lights.length>0){K=b.lights;M.copy(b.ambientColor);J.setRGB(0,0,0);B.setRGB(0,0,0);h=0;for(t=K.length;h<t;h++)w=K[h],G=w.color,w instanceof THREE.DirectionalLight?(J.r+=G.r,J.g+=G.g,J.b+=G.b):w instanceof THREE.PointLight&&(B.r+=G.r,B.g+=G.g,B.b+=G.b)}h=0;for(t=m.length;h<t;h++)if(K=m[h],E.empty(),K instanceof THREE.RenderableParticle){v=
-K;v.x*=u;v.y*=-x;w=0;for(G=K.materials.length;w<G;)w++}else if(K instanceof THREE.RenderableLine){if(v=K.v1,y=K.v2,v.positionScreen.x*=u,v.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,E.addPoint(v.positionScreen.x,v.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),F.intersects(E)){w=0;for(G=K.materials.length;w<G;)if(($=K.materials[w++])&&$.opacity!=0){L=v;I=y;var Y=W++;P[Y]==null&&(P[Y]=document.createElementNS("http://www.w3.org/2000/svg","line"),o==0&&P[Y].setAttribute("shape-rendering",
-"crispEdges"));Q=P[Y];Q.setAttribute("x1",L.positionScreen.x);Q.setAttribute("y1",L.positionScreen.y);Q.setAttribute("x2",I.positionScreen.x);Q.setAttribute("y2",I.positionScreen.y);$ instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: "+$.color.getContextStyle()+"; stroke-width: "+$.linewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.linecap+"; stroke-linejoin: "+$.linejoin),p.appendChild(Q))}}}else if(K instanceof THREE.RenderableFace3){if(v=K.v1,y=K.v2,
-z=K.v3,v.positionScreen.x*=u,v.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,E.addPoint(v.positionScreen.x,v.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),F.intersects(E)){w=0;for(G=K.meshMaterials.length;w<G;)if($=K.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){L=0;for(I=K.faceMaterials.length;L<I;)($=K.faceMaterials[L++])&&$.opacity!=0&&c(v,y,z,K,$,b)}else $&&
-$.opacity!=0&&c(v,y,z,K,$,b)}}else if(K instanceof THREE.RenderableFace4&&(v=K.v1,y=K.v2,z=K.v3,A=K.v4,v.positionScreen.x*=u,v.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,E.addPoint(v.positionScreen.x,v.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(A.positionScreen.x,A.positionScreen.y),F.intersects(E))){w=
-0;for(G=K.meshMaterials.length;w<G;)if($=K.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){L=0;for(I=K.faceMaterials.length;L<I;)($=K.faceMaterials[L++])&&$.opacity!=0&&e(v,y,z,A,K,$,b)}else $&&$.opacity!=0&&e(v,y,z,A,K,$,b)}}};
+J=new THREE.Color(0),B=new THREE.Color(0),K,da=new THREE.Vector3,I=[],P=[],Q,S,W,o=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,c){t=b;w=c;u=t/2;x=w/2;p.setAttribute("viewBox",-u+" "+-x+" "+t+" "+w);p.setAttribute("width",t);p.setAttribute("height",w);F.set(-u,-x,u,x)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};
+this.render=function(b,f){var h,t,w,G,L,I,K,aa;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);W=S=0;if(D=b.lights.length>0){K=b.lights;M.copy(b.ambientColor);J.setRGB(0,0,0);B.setRGB(0,0,0);h=0;for(t=K.length;h<t;h++)w=K[h],G=w.color,w instanceof THREE.DirectionalLight?(J.r+=G.r,J.g+=G.g,J.b+=G.b):w instanceof THREE.PointLight&&(B.r+=G.r,B.g+=G.g,B.b+=G.b)}h=0;for(t=m.length;h<t;h++)if(K=m[h],E.empty(),K instanceof THREE.RenderableParticle){v=
+K;v.x*=u;v.y*=-x;w=0;for(G=K.materials.length;w<G;)w++}else if(K instanceof THREE.RenderableLine){if(v=K.v1,y=K.v2,v.positionScreen.x*=u,v.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,E.addPoint(v.positionScreen.x,v.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),F.intersects(E)){w=0;for(G=K.materials.length;w<G;)if((aa=K.materials[w++])&&aa.opacity!=0){L=v;I=y;var Y=W++;P[Y]==null&&(P[Y]=document.createElementNS("http://www.w3.org/2000/svg","line"),o==0&&
+P[Y].setAttribute("shape-rendering","crispEdges"));Q=P[Y];Q.setAttribute("x1",L.positionScreen.x);Q.setAttribute("y1",L.positionScreen.y);Q.setAttribute("x2",I.positionScreen.x);Q.setAttribute("y2",I.positionScreen.y);aa instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: "+aa.color.getContextStyle()+"; stroke-width: "+aa.linewidth+"; stroke-opacity: "+aa.opacity+"; stroke-linecap: "+aa.linecap+"; stroke-linejoin: "+aa.linejoin),p.appendChild(Q))}}}else if(K instanceof
+THREE.RenderableFace3){if(v=K.v1,y=K.v2,z=K.v3,v.positionScreen.x*=u,v.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,E.addPoint(v.positionScreen.x,v.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),F.intersects(E)){w=0;for(G=K.meshMaterials.length;w<G;)if(aa=K.meshMaterials[w++],aa instanceof THREE.MeshFaceMaterial){L=0;for(I=K.faceMaterials.length;L<I;)(aa=K.faceMaterials[L++])&&
+aa.opacity!=0&&c(v,y,z,K,aa,b)}else aa&&aa.opacity!=0&&c(v,y,z,K,aa,b)}}else if(K instanceof THREE.RenderableFace4&&(v=K.v1,y=K.v2,z=K.v3,A=K.v4,v.positionScreen.x*=u,v.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,E.addPoint(v.positionScreen.x,v.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(A.positionScreen.x,
+A.positionScreen.y),F.intersects(E))){w=0;for(G=K.meshMaterials.length;w<G;)if(aa=K.meshMaterials[w++],aa instanceof THREE.MeshFaceMaterial){L=0;for(I=K.faceMaterials.length;L<I;)(aa=K.faceMaterials[L++])&&aa.opacity!=0&&e(v,y,z,A,K,aa,b)}else aa&&aa.opacity!=0&&e(v,y,z,A,K,aa,b)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
@@ -219,22 +220,22 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
 "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(b){function c(b,c,e){var f,k,h,m=b.vertices,n=m.length,p=b.colors,t=p.length,u=b.__vertexArray,v=b.__colorArray,w=b.__sortArray,x=b.__dirtyVertices,z=b.__dirtyColors,X=b.__webglCustomAttributes,A,y;if(X)for(A in X)X[A].offset=0;if(e.sortParticles){ta.multiplySelf(e.matrixWorld);for(f=0;f<n;f++)k=m[f].position,Ca.copy(k),ta.multiplyVector3(Ca),w[f]=[Ca.z,f];w.sort(function(b,c){return c[0]-b[0]});for(f=0;f<n;f++)k=m[w[f][1]].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;
+THREE.WebGLRenderer=function(b){function c(b,c,e){var f,k,h,m=b.vertices,n=m.length,p=b.colors,t=p.length,u=b.__vertexArray,v=b.__colorArray,w=b.__sortArray,x=b.__dirtyVertices,z=b.__dirtyColors,X=b.__webglCustomAttributes,A,y;if(X)for(A in X)X[A].offset=0;if(e.sortParticles){ta.multiplySelf(e.matrixWorld);for(f=0;f<n;f++)k=m[f].position,Da.copy(k),ta.multiplyVector3(Da),w[f]=[Da.z,f];w.sort(function(b,c){return c[0]-b[0]});for(f=0;f<n;f++)k=m[w[f][1]].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;
 for(f=0;f<t;f++)h=f*3,color=p[w[f][1]],v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(X)for(A in X){f=X[A];p=f.value.length;for(h=0;h<p;h++){index=w[h][1];t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[index];f.size===2?(f.array[t]=y.x,f.array[t+1]=y.y):f.size===3?f.type==="c"?(f.array[t]=y.r,f.array[t+1]=y.g,f.array[t+2]=y.b):(f.array[t]=y.x,f.array[t+1]=y.y,f.array[t+2]=y.z):(f.array[t]=
 for(f=0;f<t;f++)h=f*3,color=p[w[f][1]],v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(X)for(A in X){f=X[A];p=f.value.length;for(h=0;h<p;h++){index=w[h][1];t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[index];f.size===2?(f.array[t]=y.x,f.array[t+1]=y.y):f.size===3?f.type==="c"?(f.array[t]=y.r,f.array[t+1]=y.g,f.array[t+2]=y.b):(f.array[t]=y.x,f.array[t+1]=y.y,f.array[t+2]=y.z):(f.array[t]=
 y.x,f.array[t+1]=y.y,f.array[t+2]=y.z,f.array[t+3]=y.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;if(z)for(f=0;f<t;f++)color=p[f],h=f*3,v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(X)for(A in X)if(f=X[A],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")y=f.value[h];f.size===2?(f.array[t]=
 y.x,f.array[t+1]=y.y,f.array[t+2]=y.z,f.array[t+3]=y.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;if(z)for(f=0;f<t;f++)color=p[f],h=f*3,v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(X)for(A in X)if(f=X[A],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")y=f.value[h];f.size===2?(f.array[t]=
 y.x,f.array[t+1]=y.y):f.size===3?f.type==="c"?(f.array[t]=y.r,f.array[t+1]=y.g,f.array[t+2]=y.b):(f.array[t]=y.x,f.array[t+1]=y.y,f.array[t+2]=y.z):(f.array[t]=y.x,f.array[t+1]=y.y,f.array[t+2]=y.z,f.array[t+3]=y.w)}f.offset+=f.size}}}if(x||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,u,c);if(z||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,v,c);if(X)for(A in X)if(f=X[A],f.__original.needsUpdate||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
 y.x,f.array[t+1]=y.y):f.size===3?f.type==="c"?(f.array[t]=y.r,f.array[t+1]=y.g,f.array[t+2]=y.b):(f.array[t]=y.x,f.array[t+1]=y.y,f.array[t+2]=y.z):(f.array[t]=y.x,f.array[t+1]=y.y,f.array[t+2]=y.z,f.array[t+3]=y.w)}f.offset+=f.size}}}if(x||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,u,c);if(z||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,v,c);if(X)for(A in X)if(f=X[A],f.__original.needsUpdate||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
-f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,k){f.program||W.initMaterial(f,c,e,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(W.maxMorphTargets);for(var h=0,m=W.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var n=!1,h=f.program,m=h.uniforms,t=f.uniforms;h!=T&&(o.useProgram(h),T=h,n=!0);if(f.id!=ha)ha=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ea);if(e&&f.fog)if(t.fogColor.value=e.color,e instanceof
+f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,k){f.program||W.initMaterial(f,c,e,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(W.maxMorphTargets);for(var h=0,m=W.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var n=!1,h=f.program,m=h.uniforms,t=f.uniforms;h!=T&&(o.useProgram(h),T=h,n=!0);if(f.id!=$)$=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ea);if(e&&f.fog)if(t.fogColor.value=e.color,e instanceof
 THREE.Fog)t.fogNear.value=e.near,t.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)t.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var p,u,v,w,x,z=Fa,y=z.directional.colors,A=z.directional.positions,N=z.point.colors,U=z.point.positions,F=z.point.distances,E=0,D=0,e=p=x=0,n=c.length;e<n;e++)if(p=c[e],u=p.color,v=p.position,w=p.intensity,x=p.distance,p instanceof THREE.DirectionalLight)x=E*3,y[x]=u.r*w,y[x+1]=u.g*w,y[x+
 THREE.Fog)t.fogNear.value=e.near,t.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)t.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var p,u,v,w,x,z=Fa,y=z.directional.colors,A=z.directional.positions,N=z.point.colors,U=z.point.positions,F=z.point.distances,E=0,D=0,e=p=x=0,n=c.length;e<n;e++)if(p=c[e],u=p.color,v=p.position,w=p.intensity,x=p.distance,p instanceof THREE.DirectionalLight)x=E*3,y[x]=u.r*w,y[x+1]=u.g*w,y[x+
 2]=u.b*w,A[x]=v.x,A[x+1]=v.y,A[x+2]=v.z,E+=1;else if(p instanceof THREE.SpotLight)x=E*3,y[x]=u.r*w,y[x+1]=u.g*w,y[x+2]=u.b*w,u=1/v.length(),A[x]=v.x*u,A[x+1]=v.y*u,A[x+2]=v.z*u,E+=1;else if(p instanceof THREE.PointLight)p=D*3,N[p]=u.r*w,N[p+1]=u.g*w,N[p+2]=u.b*w,U[p]=v.x,U[p+1]=v.y,U[p+2]=v.z,F[D]=x,D+=1;e=E*3;for(n=y.length;e<n;e++)y[e]=0;e=D*3;for(n=N.length;e<n;e++)N[e]=0;z.point.length=D;z.directional.length=E;z.ambient[0]=0;z.ambient[1]=0;z.ambient[2]=0;c=Fa;t.enableLighting.value=c.directional.length+
 2]=u.b*w,A[x]=v.x,A[x+1]=v.y,A[x+2]=v.z,E+=1;else if(p instanceof THREE.SpotLight)x=E*3,y[x]=u.r*w,y[x+1]=u.g*w,y[x+2]=u.b*w,u=1/v.length(),A[x]=v.x*u,A[x+1]=v.y*u,A[x+2]=v.z*u,E+=1;else if(p instanceof THREE.PointLight)p=D*3,N[p]=u.r*w,N[p+1]=u.g*w,N[p+2]=u.b*w,U[p]=v.x,U[p+1]=v.y,U[p+2]=v.z,F[D]=x,D+=1;e=E*3;for(n=y.length;e<n;e++)y[e]=0;e=D*3;for(n=N.length;e<n;e++)N[e]=0;z.point.length=D;z.directional.length=E;z.ambient[0]=0;z.ambient[1]=0;z.ambient[2]=0;c=Fa;t.enableLighting.value=c.directional.length+
 c.point.length;t.ambientLightColor.value=c.ambient;t.directionalLightColor.value=c.directional.colors;t.directionalLightDirection.value=c.directional.positions;t.pointLightColor.value=c.point.colors;t.pointLightPosition.value=c.point.positions;t.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)t.diffuse.value=f.color,t.opacity.value=f.opacity,(t.map.texture=f.map)&&t.offsetRepeat.value.set(f.map.offset.x,
 c.point.length;t.ambientLightColor.value=c.ambient;t.directionalLightColor.value=c.directional.colors;t.directionalLightDirection.value=c.directional.positions;t.pointLightColor.value=c.point.colors;t.pointLightPosition.value=c.point.positions;t.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)t.diffuse.value=f.color,t.opacity.value=f.opacity,(t.map.texture=f.map)&&t.offsetRepeat.value.set(f.map.offset.x,
 f.map.offset.y,f.map.repeat.x,f.map.repeat.y),t.lightMap.texture=f.lightMap,t.envMap.texture=f.envMap,t.reflectivity.value=f.reflectivity,t.refractionRatio.value=f.refractionRatio,t.combine.value=f.combine,t.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)t.diffuse.value=f.color,t.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)t.psColor.value=f.color,t.opacity.value=f.opacity,t.size.value=f.size,t.scale.value=
 f.map.offset.y,f.map.repeat.x,f.map.repeat.y),t.lightMap.texture=f.lightMap,t.envMap.texture=f.envMap,t.reflectivity.value=f.reflectivity,t.refractionRatio.value=f.refractionRatio,t.combine.value=f.combine,t.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)t.diffuse.value=f.color,t.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)t.psColor.value=f.color,t.opacity.value=f.opacity,t.size.value=f.size,t.scale.value=
-X.height/2,t.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)t.ambient.value=f.ambient,t.specular.value=f.specular,t.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)t.mNear.value=b.near,t.mFar.value=b.far,t.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)t.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&t.shadowMatrix){for(c=0;c<pa.length;c++)t.shadowMatrix.value[c]=pa[c],t.shadowMap.texture[c]=W.shadowMap[c];t.shadowDarkness.value=
+X.height/2,t.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)t.ambient.value=f.ambient,t.specular.value=f.specular,t.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)t.mNear.value=b.near,t.mFar.value=b.far,t.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)t.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&t.shadowMatrix){for(c=0;c<oa.length;c++)t.shadowMatrix.value[c]=oa[c],t.shadowMap.texture[c]=W.shadowMap[c];t.shadowDarkness.value=
 W.shadowMapDarkness;t.shadowBias.value=W.shadowMapBias}c=f.uniformsList;t=0;for(e=c.length;t<e;t++)if(z=h.uniforms[c[t][1]])if(v=c[t][0],y=v.type,n=v.value,y=="i")o.uniform1i(z,n);else if(y=="f")o.uniform1f(z,n);else if(y=="v2")o.uniform2f(z,n.x,n.y);else if(y=="v3")o.uniform3f(z,n.x,n.y,n.z);else if(y=="v4")o.uniform4f(z,n.x,n.y,n.z,n.w);else if(y=="c")o.uniform3f(z,n.r,n.g,n.b);else if(y=="fv1")o.uniform1fv(z,n);else if(y=="fv")o.uniform3fv(z,n);else if(y=="v3v"){if(!v._array)v._array=new Float32Array(3*
 W.shadowMapDarkness;t.shadowBias.value=W.shadowMapBias}c=f.uniformsList;t=0;for(e=c.length;t<e;t++)if(z=h.uniforms[c[t][1]])if(v=c[t][0],y=v.type,n=v.value,y=="i")o.uniform1i(z,n);else if(y=="f")o.uniform1f(z,n);else if(y=="v2")o.uniform2f(z,n.x,n.y);else if(y=="v3")o.uniform3f(z,n.x,n.y,n.z);else if(y=="v4")o.uniform4f(z,n.x,n.y,n.z,n.w);else if(y=="c")o.uniform3f(z,n.r,n.g,n.b);else if(y=="fv1")o.uniform1fv(z,n);else if(y=="fv")o.uniform3fv(z,n);else if(y=="v3v"){if(!v._array)v._array=new Float32Array(3*
 n.length);y=0;for(A=n.length;y<A;y++)N=y*3,v._array[N]=n[y].x,v._array[N+1]=n[y].y,v._array[N+2]=n[y].z;o.uniform3fv(z,v._array)}else if(y=="m4"){if(!v._array)v._array=new Float32Array(16);n.flattenToArray(v._array);o.uniformMatrix4fv(z,!1,v._array)}else if(y=="m4v"){if(!v._array)v._array=new Float32Array(16*n.length);y=0;for(A=n.length;y<A;y++)n[y].flattenToArrayOffset(v._array,y*16);o.uniformMatrix4fv(z,!1,v._array)}else if(y=="t"){if(o.uniform1i(z,n),z=v.texture)if(z.image instanceof Array&&z.image.length==
 n.length);y=0;for(A=n.length;y<A;y++)N=y*3,v._array[N]=n[y].x,v._array[N+1]=n[y].y,v._array[N+2]=n[y].z;o.uniform3fv(z,v._array)}else if(y=="m4"){if(!v._array)v._array=new Float32Array(16);n.flattenToArray(v._array);o.uniformMatrix4fv(z,!1,v._array)}else if(y=="m4v"){if(!v._array)v._array=new Float32Array(16*n.length);y=0;for(A=n.length;y<A;y++)n[y].flattenToArrayOffset(v._array,y*16);o.uniformMatrix4fv(z,!1,v._array)}else if(y=="t"){if(o.uniform1i(z,n),z=v.texture)if(z.image instanceof Array&&z.image.length==
 6){if(v=z,v.image.length==6)if(v.needsUpdate){if(!v.image.__webglTextureCube)v.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,v.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,v.image[n]);B(o.TEXTURE_CUBE_MAP,v,v.image[0]);v.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube)}else z instanceof THREE.WebGLRenderTargetCube?
 6){if(v=z,v.image.length==6)if(v.needsUpdate){if(!v.image.__webglTextureCube)v.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,v.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,v.image[n]);B(o.TEXTURE_CUBE_MAP,v,v.image[0]);v.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube)}else z instanceof THREE.WebGLRenderTargetCube?
 (v=z,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.__webglTexture)):K(z,n)}else if(y=="tv"){if(!v._array){v._array=[];y=0;for(A=v.texture.length;y<A;y++)v._array[y]=n+y}o.uniform1iv(z,v._array);y=0;for(A=v.texture.length;y<A;y++)(z=v.texture[y])&&K(z,v._array[y])}(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||
 (v=z,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.__webglTexture)):K(z,n)}else if(y=="tv"){if(!v._array){v._array=[];y=0;for(A=v.texture.length;y<A;y++)v._array[y]=n+y}o.uniform1iv(z,v._array);y=0;for(A=v.texture.length;y<A;y++)(z=v.texture[y])&&K(z,v._array[y])}(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,Aa);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,Aa),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!=ka&&(ka=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,
+f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,Ba);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,Ba),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!=la&&(la=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 t=0,p=m.morphTargetForcedOrder,u=m.morphTargetInfluences;t<k.numSupportedMorphTargets&&t<p.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p[t]]),o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[t]=u[p[t]],t++;else{var p=[],v=-1,w=0,u=m.morphTargetInfluences,x,y=
 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 t=0,p=m.morphTargetForcedOrder,u=m.morphTargetInfluences;t<k.numSupportedMorphTargets&&t<p.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p[t]]),o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[t]=u[p[t]],t++;else{var p=[],v=-1,w=0,u=m.morphTargetInfluences,x,y=
 u.length,t=0;for(m.morphTargetBase!==-1&&(p[m.morphTargetBase]=!0);t<k.numSupportedMorphTargets;){for(x=0;x<y;x++)!p[x]&&u[x]>v&&(w=x,v=u[w]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[t]=v;p[w]=1;v=-1;t++}}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]>=
 u.length,t=0;for(m.morphTargetBase!==-1&&(p[m.morphTargetBase]=!0);t<k.numSupportedMorphTargets;){for(x=0;x<y;x++)!p[x]&&u[x]>v&&(w=x,v=u[w]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[t]=v;p[w]=1;v=-1;t++}}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,
 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,
@@ -243,58 +244,58 @@ 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)),W.info.render.calls++,W.info.render.vertices+=h.__webglFaceCount,W.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),W.info.render.calls++):
 o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=h.__webglFaceCount,W.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),W.info.render.calls++):
 m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),W.info.render.calls++)}}function h(b,c,e){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(c.attributes.position),o.vertexAttribPointer(c.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,
 m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),W.info.render.calls++)}}function h(b,c,e){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(c.attributes.position),o.vertexAttribPointer(c.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,
 b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,k,m,n,t,p,u,v,w,x=b.count*3;for(w=0;w<x;w+=9)e=b.normalArray,f=e[w],h=e[w+1],k=e[w+2],m=e[w+3],t=e[w+4],u=e[w+5],n=e[w+6],p=e[w+7],v=e[w+8],f=(f+m+n)/3,h=(h+t+p)/3,k=(k+u+v)/3,e[w]=f,e[w+1]=h,e[w+2]=k,e[w+3]=f,e[w+4]=h,e[w+5]=k,e[w+6]=f,e[w+7]=h,e[w+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(c.attributes.normal);o.vertexAttribPointer(c.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,
 b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,k,m,n,t,p,u,v,w,x=b.count*3;for(w=0;w<x;w+=9)e=b.normalArray,f=e[w],h=e[w+1],k=e[w+2],m=e[w+3],t=e[w+4],u=e[w+5],n=e[w+6],p=e[w+7],v=e[w+8],f=(f+m+n)/3,h=(h+t+p)/3,k=(k+u+v)/3,e[w]=f,e[w+1]=h,e[w+2]=k,e[w+3]=f,e[w+4]=h,e[w+5]=k,e[w+6]=f,e[w+7]=h,e[w+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(c.attributes.normal);o.vertexAttribPointer(c.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,
-0,b.count);b.count=0}function k(b){if(ma!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ma=b.doubleSided;if(ea!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),ea=b.flipSided}function m(b){$!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),$=b)}function n(b){Y!=b&&(o.depthMask(b),Y=b)}function p(b,c,e){fa!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),fa=b);if(b&&(ia!=c||ra!=e))o.polygonOffset(c,e),ia=c,ra=e}function t(b){ua[0].set(b.n41-
+0,b.count);b.count=0}function k(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 m(b){aa!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),aa=b)}function n(b){Y!=b&&(o.depthMask(b),Y=b)}function p(b,c,e){ga!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ga=b);if(b&&(ja!=c||ra!=e))o.polygonOffset(c,e),ja=c,ra=e}function t(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 c,b=0;b<6;b++)c=ua[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function w(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,
 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 c,b=0;b<6;b++)c=ua[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function w(b){for(var c=b.matrixWorld,e=-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*c.n14+ua[f].y*c.n24+ua[f].z*c.n34+ua[f].w,b<=e)return!1;return!0}function u(b,c){b.list[b.count]=c;b.count+=1}function x(b){var c,e,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?u(k,e):u(h,e)}function v(b){var c,e,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(c=k.materials[b],c instanceof THREE.MeshFaceMaterial){c=
 Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=ua[f].x*c.n14+ua[f].y*c.n24+ua[f].z*c.n34+ua[f].w,b<=e)return!1;return!0}function u(b,c){b.list[b.count]=c;b.count+=1}function x(b){var c,e,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?u(k,e):u(h,e)}function v(b){var c,e,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(c=k.materials[b],c instanceof THREE.MeshFaceMaterial){c=
-0;for(e=m.materials.length;c<e;c++)(h=m.materials[c])&&(h.transparent?u(o,h):u(n,h))}else(h=c)&&(h.transparent?u(o,h):u(n,h))}function y(b,c){return c.z-b.z}function z(b){var c,n,p,u=0,v,x,y,z,A=b.lights;wa||(wa=new THREE.PerspectiveCamera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar));c=0;for(n=A.length;c<n;c++)if(p=A[c],p instanceof THREE.SpotLight&&p.castShadow){ha=-1;W.shadowMap[u]||(W.shadowMap[u]=new THREE.WebGLRenderTarget(W.shadowMapWidth,W.shadowMapHeight,
-{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[u]||(pa[u]=new THREE.Matrix4);v=W.shadowMap[u];x=pa[u];wa.position.copy(p.position);wa.lookAt(p.target.position);wa.update(void 0,!0);b.update(void 0,!1,wa);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(wa.projectionMatrix);x.multiplySelf(wa.matrixWorldInverse);wa.matrixWorldInverse.flattenToArray(Aa);wa.projectionMatrix.flattenToArray(Ea);ta.multiply(wa.projectionMatrix,wa.matrixWorldInverse);
-t(ta);W.initWebGLObjects(b);ca(v);o.clearColor(1,1,1,1);W.clear();o.clearColor(ga.r,ga.g,ga.b,ja);x=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)y=b.__webglObjects[v],z=y.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||w(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),F(z,wa,!1),y.render=!0):y.render=!1:y.render=!1;m(!0);J(THREE.NormalBlending);for(v=0;v<x;v++)if(y=b.__webglObjects[v],y.render)z=y.object,buffer=y.buffer,k(z),y=z.customDepthMaterial?
-z.customDepthMaterial:z.geometry.morphTargets.length?Ka:Da,f(wa,A,null,y,buffer,z);for(v=0;v<p;v++)y=b.__webglObjectsImmediate[v],z=y.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),F(z,wa,!1),k(z),program=e(wa,A,null,Da,z),z.immediateRenderCallback?z.immediateRenderCallback(program,o,ua):z.render(function(b){h(b,program,Da.shading)}));u++}}function A(b,c){var e,f,h;e=V.attributes;var k=V.uniforms,m=qa/oa,n,t=[],p=oa*0.5,u=qa*0.5,v=!0;o.useProgram(V.program);
-T=V.program;ka=$=Z=-1;Ja||(o.enableVertexAttribArray(V.attributes.position),o.enableVertexAttribArray(V.attributes.uv),Ja=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.vertexAttribPointer(e.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(e.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Ea);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);e=0;for(f=b.__webglSprites.length;e<
-f;e++)if(h=b.__webglSprites[e],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(y);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],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-p)/p,(u-h.position.y)/
-u,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?qa:1),t[0]=n*m*h.scale.x,t[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),o.uniform1f(k.opacity,h.opacity),o.uniform3f(k.color,h.color.r,h.color.g,
-h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,t),h.mergeWith3D&&!v?(o.enable(o.DEPTH_TEST),v=!0):!h.mergeWith3D&&v&&(o.disable(o.DEPTH_TEST),v=!1),J(h.blending),K(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(Y)}function F(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+0;for(e=m.materials.length;c<e;c++)(h=m.materials[c])&&(h.transparent?u(o,h):u(n,h))}else(h=c)&&(h.transparent?u(o,h):u(n,h))}function y(b,c){return c.z-b.z}function z(b){var c,n,p,u=0,v,x,y,z,A=b.lights;wa||(wa=new THREE.PerspectiveCamera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar));c=0;for(n=A.length;c<n;c++)if(p=A[c],p instanceof THREE.SpotLight&&p.castShadow){$=-1;W.shadowMap[u]||(W.shadowMap[u]=new THREE.WebGLRenderTarget(W.shadowMapWidth,W.shadowMapHeight,
+{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));oa[u]||(oa[u]=new THREE.Matrix4);v=W.shadowMap[u];x=oa[u];wa.position.copy(p.position);wa.lookAt(p.target.position);wa.update(void 0,!0);b.update(void 0,!1,wa);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(wa.projectionMatrix);x.multiplySelf(wa.matrixWorldInverse);wa.matrixWorldInverse.flattenToArray(Ba);wa.projectionMatrix.flattenToArray(Ea);ta.multiply(wa.projectionMatrix,wa.matrixWorldInverse);
+t(ta);W.initWebGLObjects(b);da(v);o.clearColor(1,1,1,1);W.clear();o.clearColor(ha.r,ha.g,ha.b,ia);x=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)y=b.__webglObjects[v],z=y.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||w(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),F(z,wa,!1),y.render=!0):y.render=!1:y.render=!1;m(!0);J(THREE.NormalBlending);for(v=0;v<x;v++)if(y=b.__webglObjects[v],y.render)z=y.object,buffer=y.buffer,k(z),y=z.customDepthMaterial?
+z.customDepthMaterial:z.geometry.morphTargets.length?Ka:za,f(wa,A,null,y,buffer,z);for(v=0;v<p;v++)y=b.__webglObjectsImmediate[v],z=y.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),la=-1,F(z,wa,!1),k(z),program=e(wa,A,null,za,z),z.immediateRenderCallback?z.immediateRenderCallback(program,o,ua):z.render(function(b){h(b,program,za.shading)}));u++}}function A(b,c){var e,f,h;e=V.attributes;var k=V.uniforms,m=qa/na,n,t=[],p=na*0.5,u=qa*0.5,v=!0;
+o.useProgram(V.program);T=V.program;la=aa=Z=-1;Ja||(o.enableVertexAttribArray(V.attributes.position),o.enableVertexAttribArray(V.attributes.uv),Ja=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.vertexAttribPointer(e.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(e.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Ea);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);e=0;
+for(f=b.__webglSprites.length;e<f;e++)if(h=b.__webglSprites[e],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(y);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],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-
+p)/p,(u-h.position.y)/u,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?qa:1),t[0]=n*m*h.scale.x,t[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),o.uniform1f(k.opacity,h.opacity),o.uniform3f(k.color,
+h.color.r,h.color.g,h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,t),h.mergeWith3D&&!v?(o.enable(o.DEPTH_TEST),v=!0):!h.mergeWith3D&&v&&(o.disable(o.DEPTH_TEST),v=!1),J(h.blending),K(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(Y)}function F(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
 function E(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function D(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function G(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function L(b){function c(b){var h=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?h.push("undefined"):h.push(b[e].id);return h.join("_")}
 function E(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function D(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function G(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function L(b){function c(b){var h=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?h.push("undefined"):h.push(b[e].id);return h.join("_")}
 var e,f,h,k,m,n,o,t,p={},v=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=c(n),p[o]==void 0&&(p[o]={hash:o,counter:0}),t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:v}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[t].vertices+m>65535&&(p[o].counter+=1,t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],
 var e,f,h,k,m,n,o,t,p={},v=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=c(n),p[o]==void 0&&(p[o]={hash:o,counter:0}),t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:v}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[t].vertices+m>65535&&(p[o].counter+=1,t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],
-materials:n,vertices:0,numMorphTargets:v})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroups[u].id=aa++,b.geometryGroupsList.push(b.geometryGroups[u])}function M(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=Z){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:v})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroups[u].id=ca++,b.geometryGroupsList.push(b.geometryGroups[u])}function M(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=Z){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)}Z=b}}function B(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,S(c.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,S(c.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,S(c.magFilter)),
 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)}Z=b}}function B(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,S(c.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,S(c.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,S(c.magFilter)),
 o.texParameteri(b,o.TEXTURE_MIN_FILTER,S(c.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,Q(c.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,Q(c.minFilter)))}function K(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.info.memory.textures++;o.activeTexture(o.TEXTURE0+c);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof
 o.texParameteri(b,o.TEXTURE_MIN_FILTER,S(c.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,Q(c.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,Q(c.minFilter)))}function K(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.info.memory.textures++;o.activeTexture(o.TEXTURE0+c);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof
-THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);B(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+c),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function ca(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;
+THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);B(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+c),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function da(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;
 b.__webglRenderbuffer=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(c){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);B(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var e=0;e<6;e++)b.__webglFramebuffer[e]=o.createFramebuffer(),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),B(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,S(b.format),
 b.__webglRenderbuffer=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(c){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);B(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var e=0;e<6;e++)b.__webglFramebuffer[e]=o.createFramebuffer(),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),B(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,S(b.format),
 b.width,b.height,0,S(b.format),S(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(e=0;e<6;++e)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[e]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+e,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,
 b.width,b.height,0,S(b.format),S(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(e=0;e<6;++e)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[e]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+e,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);c?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(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);c?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?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,e=b.width,b=b.height,h=f=0):(c=null,e=oa,b=qa,f=na,h=O);c!=la&&(o.bindFramebuffer(o.FRAMEBUFFER,c),o.viewport(f,h,e,b),la=c)}function I(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?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,e=b.width,b=b.height,h=f=0):(c=null,e=na,b=qa,f=ma,h=O);c!=pa&&(o.bindFramebuffer(o.FRAMEBUFFER,c),o.viewport(f,h,e,b),pa=c)}function I(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 P(b,c){var e;b=="fragment"?e=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(e=o.createShader(o.VERTEX_SHADER));o.shaderSource(e,c);o.compileShader(e);if(!o.getShaderParameter(e,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(e)),console.error(c),null;return e}function Q(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;
 o.bindTexture(o.TEXTURE_2D,null))}function P(b,c){var e;b=="fragment"?e=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(e=o.createShader(o.VERTEX_SHADER));o.shaderSource(e,c);o.compileShader(e);if(!o.getShaderParameter(e,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(e)),console.error(c),null;return e}function Q(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function S(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.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 W=this,o,da=[],T=null,
-la=null,ha=-1,ka=null,aa=0,ma=null,ea=null,Z=null,$=null,Y=null,fa=null,ia=null,ra=null,na=0,O=0,oa=0,qa=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Matrix4,Ea=new Float32Array(16),Aa=new Float32Array(16),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},X=b.canvas!==void 0?b.canvas:document.createElement("canvas"),U=
-b.stencil!==void 0?b.stencil:!0,N=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,va=b.antialias!==void 0?b.antialias:!1,ga=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ja=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=X;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 wa,pa=[],b=THREE.ShaderLib.depthRGBA,Ia=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ia}),Ka=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
-uniforms:Ia,morphTargets:!0});Da._shadowPass=!0;Ka._shadowPass=!0;try{if(!(o=X.getContext("experimental-webgl",{antialias:va,stencil:U,preserveDrawingBuffer:N})))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(Ba){console.error(Ba)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);
-o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(ga.r,ga.g,ga.b,ja);this.context=o;var Ga=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,V={};V.vertices=new Float32Array(16);V.faces=new Uint16Array(6);U=0;V.vertices[U++]=-1;V.vertices[U++]=-1;V.vertices[U++]=0;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=-1;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=
+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 W=this,o,ea=[],T=null,
+pa=null,$=-1,la=null,ca=0,ka=null,fa=null,Z=null,aa=null,Y=null,ga=null,ja=null,ra=null,ma=0,O=0,na=0,qa=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Matrix4,Ea=new Float32Array(16),Ba=new Float32Array(16),Da=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},X=b.canvas!==void 0?b.canvas:document.createElement("canvas"),U=
+b.stencil!==void 0?b.stencil:!0,N=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,va=b.antialias!==void 0?b.antialias:!1,ha=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ia=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=X;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 wa,oa=[],b=THREE.ShaderLib.depthRGBA,Ia=THREE.UniformsUtils.clone(b.uniforms),za=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ia}),Ka=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
+uniforms:Ia,morphTargets:!0});za._shadowPass=!0;Ka._shadowPass=!0;try{if(!(o=X.getContext("experimental-webgl",{antialias:va,stencil:U,preserveDrawingBuffer:N})))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(Ca){console.error(Ca)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);
+o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(ha.r,ha.g,ha.b,ia);this.context=o;var Ga=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,V={};V.vertices=new Float32Array(16);V.faces=new Uint16Array(6);U=0;V.vertices[U++]=-1;V.vertices[U++]=-1;V.vertices[U++]=0;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=-1;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=
 1;V.vertices[U++]=1;V.vertices[U++]=0;V.vertices[U++]=-1;V.vertices[U++]=1;V.vertices[U++]=0;U=V.vertices[U++]=0;V.faces[U++]=0;V.faces[U++]=1;V.faces[U++]=2;V.faces[U++]=0;V.faces[U++]=2;V.faces[U++]=3;V.vertexBuffer=o.createBuffer();V.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,V.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,V.faces,o.STATIC_DRAW);V.program=o.createProgram();
 1;V.vertices[U++]=1;V.vertices[U++]=0;V.vertices[U++]=-1;V.vertices[U++]=1;V.vertices[U++]=0;U=V.vertices[U++]=0;V.faces[U++]=0;V.faces[U++]=1;V.faces[U++]=2;V.faces[U++]=0;V.faces[U++]=2;V.faces[U++]=3;V.vertexBuffer=o.createBuffer();V.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,V.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,V.faces,o.STATIC_DRAW);V.program=o.createProgram();
 o.attachShader(V.program,P("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(V.program,P("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(V.program);V.attributes={};V.uniforms={};V.attributes.position=o.getAttribLocation(V.program,"position");V.attributes.uv=o.getAttribLocation(V.program,"uv");V.uniforms.uvOffset=o.getUniformLocation(V.program,"uvOffset");V.uniforms.uvScale=o.getUniformLocation(V.program,"uvScale");V.uniforms.rotation=o.getUniformLocation(V.program,"rotation");
 o.attachShader(V.program,P("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(V.program,P("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(V.program);V.attributes={};V.uniforms={};V.attributes.position=o.getAttribLocation(V.program,"position");V.attributes.uv=o.getAttribLocation(V.program,"uv");V.uniforms.uvOffset=o.getUniformLocation(V.program,"uvOffset");V.uniforms.uvScale=o.getUniformLocation(V.program,"uvScale");V.uniforms.rotation=o.getUniformLocation(V.program,"rotation");
 V.uniforms.scale=o.getUniformLocation(V.program,"scale");V.uniforms.alignment=o.getUniformLocation(V.program,"alignment");V.uniforms.color=o.getUniformLocation(V.program,"color");V.uniforms.map=o.getUniformLocation(V.program,"map");V.uniforms.opacity=o.getUniformLocation(V.program,"opacity");V.uniforms.useScreenCoordinates=o.getUniformLocation(V.program,"useScreenCoordinates");V.uniforms.affectedByDistance=o.getUniformLocation(V.program,"affectedByDistance");V.uniforms.screenPosition=o.getUniformLocation(V.program,
 V.uniforms.scale=o.getUniformLocation(V.program,"scale");V.uniforms.alignment=o.getUniformLocation(V.program,"alignment");V.uniforms.color=o.getUniformLocation(V.program,"color");V.uniforms.map=o.getUniformLocation(V.program,"map");V.uniforms.opacity=o.getUniformLocation(V.program,"opacity");V.uniforms.useScreenCoordinates=o.getUniformLocation(V.program,"useScreenCoordinates");V.uniforms.affectedByDistance=o.getUniformLocation(V.program,"affectedByDistance");V.uniforms.screenPosition=o.getUniformLocation(V.program,
-"screenPosition");V.uniforms.modelViewMatrix=o.getUniformLocation(V.program,"modelViewMatrix");V.uniforms.projectionMatrix=o.getUniformLocation(V.program,"projectionMatrix");var Ja=!1;this.setSize=function(b,c){X.width=b;X.height=c;this.setViewport(0,0,X.width,X.height)};this.setViewport=function(b,c,e,f){na=b;O=c;oa=e;qa=f;o.viewport(na,O,oa,qa)};this.setScissor=function(b,c,e,f){o.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=
-function(b,c){ga.setHex(b);ja=c;o.clearColor(ga.r,ga.g,ga.b,ja)};this.setClearColor=function(b,c){ga.copy(b);ja=c;o.clearColor(ga.r,ga.g,ga.b,ja)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return ja};this.clear=function(b,c,e){var f=0;if(b==void 0||b)f|=o.COLOR_BUFFER_BIT;if(c==void 0||c)f|=o.DEPTH_BUFFER_BIT;if(e==void 0||e)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");V.uniforms.modelViewMatrix=o.getUniformLocation(V.program,"modelViewMatrix");V.uniforms.projectionMatrix=o.getUniformLocation(V.program,"projectionMatrix");var Ja=!1;this.setSize=function(b,c){X.width=b;X.height=c;this.setViewport(0,0,X.width,X.height)};this.setViewport=function(b,c,e,f){ma=b;O=c;na=e;qa=f;o.viewport(ma,O,na,qa)};this.setScissor=function(b,c,e,f){o.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=
+function(b,c){ha.setHex(b);ia=c;o.clearColor(ha.r,ha.g,ha.b,ia)};this.setClearColor=function(b,c){ha.copy(b);ia=c;o.clearColor(ha.r,ha.g,ha.b,ia)};this.getClearColor=function(){return ha};this.getClearAlpha=function(){return ia};this.clear=function(b,c,e){var f=0;if(b==void 0||b)f|=o.COLOR_BUFFER_BIT;if(c==void 0||c)f|=o.DEPTH_BUFFER_BIT;if(e==void 0||e)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 c=b.geometry.geometryGroups[g];o.deleteBuffer(c.__webglVertexBuffer);o.deleteBuffer(c.__webglNormalBuffer);o.deleteBuffer(c.__webglTangentBuffer);o.deleteBuffer(c.__webglColorBuffer);o.deleteBuffer(c.__webglUVBuffer);o.deleteBuffer(c.__webglUV2Buffer);o.deleteBuffer(c.__webglSkinVertexABuffer);o.deleteBuffer(c.__webglSkinVertexBBuffer);o.deleteBuffer(c.__webglSkinIndicesBuffer);
 delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];o.deleteBuffer(c.__webglVertexBuffer);o.deleteBuffer(c.__webglNormalBuffer);o.deleteBuffer(c.__webglTangentBuffer);o.deleteBuffer(c.__webglColorBuffer);o.deleteBuffer(c.__webglUVBuffer);o.deleteBuffer(c.__webglUV2Buffer);o.deleteBuffer(c.__webglSkinVertexABuffer);o.deleteBuffer(c.__webglSkinVertexBBuffer);o.deleteBuffer(c.__webglSkinIndicesBuffer);
 o.deleteBuffer(c.__webglSkinWeightsBuffer);o.deleteBuffer(c.__webglFaceBuffer);o.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)o.deleteBuffer(c.__webglMorphTargetsBuffers[e]);W.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),
 o.deleteBuffer(c.__webglSkinWeightsBuffer);o.deleteBuffer(c.__webglFaceBuffer);o.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)o.deleteBuffer(c.__webglMorphTargetsBuffers[e]);W.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),
 W.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),W.info.memory.textures--};this.initMaterial=function(b,c,e,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":
 W.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),W.info.memory.textures--};this.initMaterial=function(b,c,e,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":
 b instanceof THREE.MeshLambertMaterial?n="lambert":b instanceof THREE.MeshPhongMaterial?n="phong":b instanceof THREE.LineBasicMaterial?n="basic":b instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var t=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(t.uniforms);b.vertexShader=t.vertexShader;b.fragmentShader=t.fragmentShader}var p,v,u;p=u=t=0;for(v=c.length;p<v;p++)m=c[p],m instanceof THREE.SpotLight&&u++,m instanceof THREE.DirectionalLight&&u++,m instanceof THREE.PointLight&&
 b instanceof THREE.MeshLambertMaterial?n="lambert":b instanceof THREE.MeshPhongMaterial?n="phong":b instanceof THREE.LineBasicMaterial?n="basic":b instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var t=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(t.uniforms);b.vertexShader=t.vertexShader;b.fragmentShader=t.fragmentShader}var p,v,u;p=u=t=0;for(v=c.length;p<v;p++)m=c[p],m instanceof THREE.SpotLight&&u++,m instanceof THREE.DirectionalLight&&u++,m instanceof THREE.PointLight&&
 t++;t+u<=ya?p=u:(p=Math.ceil(ya*u/(t+u)),t=ya-p);m={directional:p,point:t};t=u=0;for(p=c.length;t<p;t++)v=c[t],v instanceof THREE.SpotLight&&v.castShadow&&u++;var w=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)w=f.bones.length;var x;a:{p=b.fragmentShader;v=b.vertexShader;var t=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
 t++;t+u<=ya?p=u:(p=Math.ceil(ya*u/(t+u)),t=ya-p);m={directional:p,point:t};t=u=0;for(p=c.length;t<p;t++)v=c[t],v instanceof THREE.SpotLight&&v.castShadow&&u++;var w=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)w=f.bones.length;var x;a:{p=b.fragmentShader;v=b.vertexShader;var t=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
-maxDirLights:m.directional,maxPointLights:m.point,maxBones:w,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},z,f=[];n?f.push(n):(f.push(p),f.push(v));for(z in e)f.push(z),f.push(e[z]);n=f.join();z=0;for(f=da.length;z<f;z++)if(da[z].code==n){x=da[z].program;break a}z=o.createProgram();f=[Ga?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,
+maxDirLights:m.directional,maxPointLights:m.point,maxBones:w,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},z,f=[];n?f.push(n):(f.push(p),f.push(v));for(z in e)f.push(z),f.push(e[z]);n=f.join();z=0;for(f=ea.length;z<f;z++)if(ea[z].code==n){x=ea[z].program;break a}z=o.createProgram();f=[Ga?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,
 "#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 "#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 m=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",
 m=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",
 e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(z,P("fragment",m+p));o.attachShader(z,P("vertex",f+v));o.linkProgram(z);o.getProgramParameter(z,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(z,o.VALIDATE_STATUS)+", gl error ["+
 e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(z,P("fragment",m+p));o.attachShader(z,P("vertex",f+v));o.linkProgram(z);o.getProgramParameter(z,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(z,o.VALIDATE_STATUS)+", gl error ["+
 o.getError()+"]");z.uniforms={};z.attributes={};var y,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in t)f.push(y);y=f;f=0;for(t=y.length;f<t;f++)p=y[f],z.uniforms[p]=o.getUniformLocation(z,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(y=0;y<e.maxMorphTargets;y++)f.push("morphTarget"+y);for(x in c)f.push(x);
 o.getError()+"]");z.uniforms={};z.attributes={};var y,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in t)f.push(y);y=f;f=0;for(t=y.length;f<t;f++)p=y[f],z.uniforms[p]=o.getUniformLocation(z,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(y=0;y<e.maxMorphTargets;y++)f.push("morphTarget"+y);for(x in c)f.push(x);
-x=f;y=0;for(c=x.length;y<c;y++)e=x[y],z.attributes[e]=o.getAttribLocation(z,e);z.id=da.length;da.push({program:z,code:n});W.info.memory.programs=da.length;x=z}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++)y="morphTarget"+k,x[y]>=0&&(o.enableVertexAttribArray(x[y]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,e,f){ca(b);
-this.clear(c,e,f)};this.render=function(b,c,u,X){var N,U,E,D,G,K,B,na,va=b.lights,L=b.fog;ha=-1;this.shadowMapEnabled&&z(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Aa);c.projectionMatrix.flattenToArray(Ea);ta.multiply(c.projectionMatrix,c.matrixWorldInverse);t(ta);this.initWebGLObjects(b);ca(u);(this.autoClear||X)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
-G=b.__webglObjects.length;for(X=0;X<G;X++)if(N=b.__webglObjects[X],B=N.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||w(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),F(B,c,!0),v(N),N.render=!0,this.sortObjects)N.object.renderDepth?N.z=N.object.renderDepth:(Ca.copy(B.position),ta.multiplyVector3(Ca),N.z=Ca.z)}else N.render=!1;else N.render=!1;this.sortObjects&&b.__webglObjects.sort(y);K=b.__webglObjectsImmediate.length;for(X=0;X<K;X++)N=b.__webglObjectsImmediate[X],B=
-N.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),F(B,c,!0),x(N));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);J(b.overrideMaterial.blending);for(X=0;X<G;X++)if(N=b.__webglObjects[X],N.render)B=N.object,na=N.buffer,k(B),f(c,va,L,b.overrideMaterial,na,B);for(X=0;X<K;X++)N=b.__webglObjectsImmediate[X],B=N.object,B.visible&&(k(B),U=e(c,va,L,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,ua):B.render(function(b){h(b,U,
-Da.shading)}))}else{J(THREE.NormalBlending);for(X=G-1;X>=0;X--)if(N=b.__webglObjects[X],N.render){B=N.object;na=N.buffer;E=N.opaque;k(B);for(N=0;N<E.count;N++)D=E.list[N],m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,va,L,D,na,B)}for(X=0;X<K;X++)if(N=b.__webglObjectsImmediate[X],B=N.object,B.visible){E=N.opaque;k(B);for(N=0;N<E.count;N++)D=E.list[N],m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),U=e(c,
-va,L,D,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,ua):B.render(function(b){h(b,U,Da.shading)})}for(X=0;X<G;X++)if(N=b.__webglObjects[X],N.render){B=N.object;na=N.buffer;E=N.transparent;k(B);for(N=0;N<E.count;N++)D=E.list[N],J(D.blending),m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,va,L,D,na,B)}for(X=0;X<K;X++)if(N=b.__webglObjectsImmediate[X],B=N.object,B.visible){E=N.transparent;k(B);for(N=0;N<E.count;N++)D=E.list[N],J(D.blending),
-m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),U=e(c,va,L,D,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,ua):B.render(function(b){h(b,U,Da.shading)})}}b.__webglSprites.length&&A(b,c);u&&u.minFilter!==THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter&&I(u)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
+x=f;y=0;for(c=x.length;y<c;y++)e=x[y],z.attributes[e]=o.getAttribLocation(z,e);z.id=ea.length;ea.push({program:z,code:n});W.info.memory.programs=ea.length;x=z}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++)y="morphTarget"+k,x[y]>=0&&(o.enableVertexAttribArray(x[y]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,e,f){da(b);
+this.clear(c,e,f)};this.render=function(b,c,u,X){var N,U,E,D,G,K,B,ma,va=b.lights,L=b.fog;$=-1;this.shadowMapEnabled&&z(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ba);c.projectionMatrix.flattenToArray(Ea);ta.multiply(c.projectionMatrix,c.matrixWorldInverse);t(ta);this.initWebGLObjects(b);da(u);(this.autoClear||X)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
+G=b.__webglObjects.length;for(X=0;X<G;X++)if(N=b.__webglObjects[X],B=N.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||w(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),F(B,c,!0),v(N),N.render=!0,this.sortObjects)N.object.renderDepth?N.z=N.object.renderDepth:(Da.copy(B.position),ta.multiplyVector3(Da),N.z=Da.z)}else N.render=!1;else N.render=!1;this.sortObjects&&b.__webglObjects.sort(y);K=b.__webglObjectsImmediate.length;for(X=0;X<K;X++)N=b.__webglObjectsImmediate[X],B=
+N.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),F(B,c,!0),x(N));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);J(b.overrideMaterial.blending);for(X=0;X<G;X++)if(N=b.__webglObjects[X],N.render)B=N.object,ma=N.buffer,k(B),f(c,va,L,b.overrideMaterial,ma,B);for(X=0;X<K;X++)N=b.__webglObjectsImmediate[X],B=N.object,B.visible&&(la=-1,k(B),U=e(c,va,L,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,ua):B.render(function(c){h(c,
+U,b.overrideMaterial.shading)}))}else{J(THREE.NormalBlending);for(X=G-1;X>=0;X--)if(N=b.__webglObjects[X],N.render){B=N.object;ma=N.buffer;E=N.opaque;k(B);for(N=0;N<E.count;N++)D=E.list[N],m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,va,L,D,ma,B)}for(X=0;X<K;X++)if(N=b.__webglObjectsImmediate[X],B=N.object,B.visible){la=-1;E=N.opaque;k(B);for(N=0;N<E.count;N++)D=E.list[N],m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),
+U=e(c,va,L,D,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,ua):B.render(function(b){h(b,U,D.shading)})}for(X=0;X<G;X++)if(N=b.__webglObjects[X],N.render){B=N.object;ma=N.buffer;E=N.transparent;k(B);for(N=0;N<E.count;N++)D=E.list[N],J(D.blending),m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,va,L,D,ma,B)}for(X=0;X<K;X++)if(N=b.__webglObjectsImmediate[X],B=N.object,B.visible){la=-1;E=N.transparent;k(B);for(N=0;N<E.count;N++)D=E.list[N],
+J(D.blending),m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),U=e(c,va,L,D,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,ua):B.render(function(b){h(b,U,D.shading)})}}b.__webglSprites.length&&A(b,c);u&&u.minFilter!==THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter&&I(u)};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&&L(k),k.geometryGroups){if(m=k.geometryGroups[h],!m.__webglVertexBuffer){var n=m;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();
 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&&L(k),k.geometryGroups){if(m=k.geometryGroups[h],!m.__webglVertexBuffer){var n=m;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();
 n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var t=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];t=0;for(p=n.numMorphTargets;t<
 n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var t=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];t=0;for(p=n.numMorphTargets;t<
 p;t++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=e,u=void 0,v=void 0,w=void 0,x=w=void 0,z=void 0,y=void 0,X=y=t=0,N=w=v=void 0,w=p=N=v=u=void 0,x=n.geometry,z=x.faces,N=m.faces,u=0,v=N.length;u<v;u++)w=N[u],w=z[w],w instanceof THREE.Face3?(t+=3,y+=1,X+=3):w instanceof THREE.Face4&&(t+=4,y+=2,X+=4);for(var u=m,v=n,A=N=z=void 0,U=void 0,A=void 0,w=[],z=0,N=v.materials.length;z<N;z++)if(A=v.materials[z],A instanceof THREE.MeshFaceMaterial){A=0;for(l=u.materials.length;A<
 p;t++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=e,u=void 0,v=void 0,w=void 0,x=w=void 0,z=void 0,y=void 0,X=y=t=0,N=w=v=void 0,w=p=N=v=u=void 0,x=n.geometry,z=x.faces,N=m.faces,u=0,v=N.length;u<v;u++)w=N[u],w=z[w],w instanceof THREE.Face3?(t+=3,y+=1,X+=3):w instanceof THREE.Face4&&(t+=4,y+=2,X+=4);for(var u=m,v=n,A=N=z=void 0,U=void 0,A=void 0,w=[],z=0,N=v.materials.length;z<N;z++)if(A=v.materials[z],A instanceof THREE.MeshFaceMaterial){A=0;for(l=u.materials.length;A<
@@ -308,32 +309,32 @@ m.__webglColorBuffer=o.createBuffer();W.info.geometries++;m=k;n=e;t=m.vertices.l
 originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(t*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=
 originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(t*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=
 !0;k.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups)m=k.geometryGroups[h],M(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(k=e.geometry,M(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);
 !0;k.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups)m=k.geometryGroups[h],M(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(k=e.geometry,M(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)G(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)&&G(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,
 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)G(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)&&G(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,
-1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,p=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(t=h.geometryGroupsList.length;n<t;n++)if(m=h.geometryGroupsList[n],p=E(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||p)if(p=m,y=o.DYNAMIC_DRAW,X=!h.dynamic,p.__inittedArrays){var F=u=x=void 0,B=void 0,K=F=void 0,na=void 0,va=void 0,ja=void 0,I=U=A=w=N=z=v=void 0,ga=void 0,J=void 0,
-H=B=ja=B=va=na=void 0,C=void 0,O=C=H=na=void 0,Y=void 0,P=O=C=H=F=F=K=ja=B=O=C=H=Y=O=C=H=Y=O=C=H=void 0,Q=0,oa=0,$=0,ca=0,qa=0,T=0,S=0,ya=0,V=0,R=0,pa=0,O=H=0,O=void 0,fa=p.__vertexArray,wa=p.__uvArray,ua=p.__uv2Array,ha=p.__normalArray,ia=p.__tangentArray,ka=p.__colorArray,Z=p.__skinVertexAArray,aa=p.__skinVertexBArray,da=p.__skinIndexArray,ea=p.__skinWeightArray,Da=p.__morphTargetsArrays,la=p.__webglCustomAttributes,C=void 0,ma=p.__faceArray,ra=p.__lineArray,Ia=p.__needsSmoothNormals,z=p.__vertexColorType,
-v=p.__uvType,N=p.__normalType,ta=k.geometry,Ea=ta.__dirtyVertices,Ba=ta.__dirtyElements,Aa=ta.__dirtyUvs,Ga=ta.__dirtyNormals,Ka=ta.__dirtyTangents,Ca=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ja=ta.vertices,cb=p.faces,fb=ta.faces,db=ta.faceVertexUvs[0],eb=ta.faceVertexUvs[1],Sa=ta.skinVerticesA,Ta=ta.skinVerticesB,Ua=ta.skinIndices,Ma=ta.skinWeights,La=ta.morphTargets;if(la)for(P in la)la[P].offset=0,la[P].offsetSrc=0;x=0;for(u=cb.length;x<u;x++)if(F=cb[x],B=fb[F],db&&(w=db[F]),eb&&(A=eb[F]),F=
-B.vertexNormals,K=B.normal,na=B.vertexColors,va=B.color,ja=B.vertexTangents,B instanceof THREE.Face3){if(Ea)U=Ja[B.a].position,I=Ja[B.b].position,ga=Ja[B.c].position,fa[oa]=U.x,fa[oa+1]=U.y,fa[oa+2]=U.z,fa[oa+3]=I.x,fa[oa+4]=I.y,fa[oa+5]=I.z,fa[oa+6]=ga.x,fa[oa+7]=ga.y,fa[oa+8]=ga.z,oa+=9;if(la)for(P in la)if(C=la[P],C.__original.needsUpdate)H=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[H]=C.value[B.a],C.array[H+1]=C.value[B.b],C.array[H+2]=C.value[B.c]):
-C.boundTo==="faces"?(O=C.value[O],C.array[H]=O,C.array[H+1]=O,C.array[H+2]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[H]=C.value[O],C.array[H+1]=C.value[O+1],C.array[H+2]=C.value[O+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(U=C.value[B.a],I=C.value[B.b],ga=C.value[B.c]):C.boundTo==="faces"?(ga=I=U=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(U=C.value[O],I=C.value[O+1],ga=C.value[O+2],C.offsetSrc+=3),C.size===2?(C.array[H]=U.x,C.array[H+1]=
-U.y,C.array[H+2]=I.x,C.array[H+3]=I.y,C.array[H+4]=ga.x,C.array[H+5]=ga.y,C.offset+=6):C.size===3?(C.type==="c"?(C.array[H]=U.r,C.array[H+1]=U.g,C.array[H+2]=U.b,C.array[H+3]=I.r,C.array[H+4]=I.g,C.array[H+5]=I.b,C.array[H+6]=ga.r,C.array[H+7]=ga.g,C.array[H+8]=ga.b):(C.array[H]=U.x,C.array[H+1]=U.y,C.array[H+2]=U.z,C.array[H+3]=I.x,C.array[H+4]=I.y,C.array[H+5]=I.z,C.array[H+6]=ga.x,C.array[H+7]=ga.y,C.array[H+8]=ga.z),C.offset+=9):(C.array[H]=U.x,C.array[H+1]=U.y,C.array[H+2]=U.z,C.array[H+3]=U.w,
-C.array[H+4]=I.x,C.array[H+5]=I.y,C.array[H+6]=I.z,C.array[H+7]=I.w,C.array[H+8]=ga.x,C.array[H+9]=ga.y,C.array[H+10]=ga.z,C.array[H+11]=ga.w,C.offset+=12));if(Fa){H=0;for(C=La.length;H<C;H++)U=La[H].vertices[B.a].position,I=La[H].vertices[B.b].position,ga=La[H].vertices[B.c].position,O=Da[H],O[pa]=U.x,O[pa+1]=U.y,O[pa+2]=U.z,O[pa+3]=I.x,O[pa+4]=I.y,O[pa+5]=I.z,O[pa+6]=ga.x,O[pa+7]=ga.y,O[pa+8]=ga.z;pa+=9}if(Ma.length)H=Ma[B.a],C=Ma[B.b],O=Ma[B.c],ea[R]=H.x,ea[R+1]=H.y,ea[R+2]=H.z,ea[R+3]=H.w,ea[R+
-4]=C.x,ea[R+5]=C.y,ea[R+6]=C.z,ea[R+7]=C.w,ea[R+8]=O.x,ea[R+9]=O.y,ea[R+10]=O.z,ea[R+11]=O.w,H=Ua[B.a],C=Ua[B.b],O=Ua[B.c],da[R]=H.x,da[R+1]=H.y,da[R+2]=H.z,da[R+3]=H.w,da[R+4]=C.x,da[R+5]=C.y,da[R+6]=C.z,da[R+7]=C.w,da[R+8]=O.x,da[R+9]=O.y,da[R+10]=O.z,da[R+11]=O.w,H=Sa[B.a],C=Sa[B.b],O=Sa[B.c],Z[R]=H.x,Z[R+1]=H.y,Z[R+2]=H.z,Z[R+3]=1,Z[R+4]=C.x,Z[R+5]=C.y,Z[R+6]=C.z,Z[R+7]=1,Z[R+8]=O.x,Z[R+9]=O.y,Z[R+10]=O.z,Z[R+11]=1,H=Ta[B.a],C=Ta[B.b],O=Ta[B.c],aa[R]=H.x,aa[R+1]=H.y,aa[R+2]=H.z,aa[R+3]=1,aa[R+
-4]=C.x,aa[R+5]=C.y,aa[R+6]=C.z,aa[R+7]=1,aa[R+8]=O.x,aa[R+9]=O.y,aa[R+10]=O.z,aa[R+11]=1,R+=12;if(Ca&&z)na.length==3&&z==THREE.VertexColors?(B=na[0],H=na[1],C=na[2]):C=H=B=va,ka[V]=B.r,ka[V+1]=B.g,ka[V+2]=B.b,ka[V+3]=H.r,ka[V+4]=H.g,ka[V+5]=H.b,ka[V+6]=C.r,ka[V+7]=C.g,ka[V+8]=C.b,V+=9;if(Ka&&ta.hasTangents)na=ja[0],va=ja[1],B=ja[2],ia[S]=na.x,ia[S+1]=na.y,ia[S+2]=na.z,ia[S+3]=na.w,ia[S+4]=va.x,ia[S+5]=va.y,ia[S+6]=va.z,ia[S+7]=va.w,ia[S+8]=B.x,ia[S+9]=B.y,ia[S+10]=B.z,ia[S+11]=B.w,S+=12;if(Ga&&N)if(F.length==
-3&&Ia)for(ja=0;ja<3;ja++)K=F[ja],ha[T]=K.x,ha[T+1]=K.y,ha[T+2]=K.z,T+=3;else for(ja=0;ja<3;ja++)ha[T]=K.x,ha[T+1]=K.y,ha[T+2]=K.z,T+=3;if(Aa&&w!==void 0&&v)for(ja=0;ja<3;ja++)F=w[ja],wa[$]=F.u,wa[$+1]=F.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<3;ja++)F=A[ja],ua[ca]=F.u,ua[ca+1]=F.v,ca+=2;Ba&&(ma[qa]=Q,ma[qa+1]=Q+1,ma[qa+2]=Q+2,qa+=3,ra[ya]=Q,ra[ya+1]=Q+1,ra[ya+2]=Q,ra[ya+3]=Q+2,ra[ya+4]=Q+1,ra[ya+5]=Q+2,ya+=6,Q+=3)}else if(B instanceof THREE.Face4){if(Ea)U=Ja[B.a].position,I=Ja[B.b].position,ga=Ja[B.c].position,
-J=Ja[B.d].position,fa[oa]=U.x,fa[oa+1]=U.y,fa[oa+2]=U.z,fa[oa+3]=I.x,fa[oa+4]=I.y,fa[oa+5]=I.z,fa[oa+6]=ga.x,fa[oa+7]=ga.y,fa[oa+8]=ga.z,fa[oa+9]=J.x,fa[oa+10]=J.y,fa[oa+11]=J.z,oa+=12;if(la)for(P in la)if(C=la[P],C.__original.needsUpdate)H=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[H]=C.value[B.a],C.array[H+1]=C.value[B.b],C.array[H+2]=C.value[B.c],C.array[H+3]=C.value[B.d]):C.boundTo==="faces"?(O=C.value[O],C.array[H]=O,C.array[H+1]=O,C.array[H+2]=O,C.array[H+
-3]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[H]=C.value[O],C.array[H+1]=C.value[O+1],C.array[H+2]=C.value[O+2],C.array[H+3]=C.value[O+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo==="vertices"?(U=C.value[B.a],I=C.value[B.b],ga=C.value[B.c],J=C.value[B.d]):C.boundTo==="faces"?(J=ga=I=U=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(U=C.value[O],I=C.value[O+1],ga=C.value[O+2],J=C.value[O+3],C.offsetSrc+=4),C.size===2?(C.array[H]=U.x,C.array[H+1]=U.y,C.array[H+
-2]=I.x,C.array[H+3]=I.y,C.array[H+4]=ga.x,C.array[H+5]=ga.y,C.array[H+6]=J.x,C.array[H+7]=J.y,C.offset+=8):C.size===3?(C.type==="c"?(C.array[H]=U.r,C.array[H+1]=U.g,C.array[H+2]=U.b,C.array[H+3]=I.r,C.array[H+4]=I.g,C.array[H+5]=I.b,C.array[H+6]=ga.r,C.array[H+7]=ga.g,C.array[H+8]=ga.b,C.array[H+9]=J.r,C.array[H+10]=J.g,C.array[H+11]=J.b):(C.array[H]=U.x,C.array[H+1]=U.y,C.array[H+2]=U.z,C.array[H+3]=I.x,C.array[H+4]=I.y,C.array[H+5]=I.z,C.array[H+6]=ga.x,C.array[H+7]=ga.y,C.array[H+8]=ga.z,C.array[H+
-9]=J.x,C.array[H+10]=J.y,C.array[H+11]=J.z),C.offset+=12):(C.array[H]=U.x,C.array[H+1]=U.y,C.array[H+2]=U.z,C.array[H+3]=U.w,C.array[H+4]=I.x,C.array[H+5]=I.y,C.array[H+6]=I.z,C.array[H+7]=I.w,C.array[H+8]=ga.x,C.array[H+9]=ga.y,C.array[H+10]=ga.z,C.array[H+11]=ga.w,C.array[H+12]=J.x,C.array[H+13]=J.y,C.array[H+14]=J.z,C.array[H+15]=J.w,C.offset+=16));if(Fa){H=0;for(C=La.length;H<C;H++)U=La[H].vertices[B.a].position,I=La[H].vertices[B.b].position,ga=La[H].vertices[B.c].position,J=La[H].vertices[B.d].position,
-O=Da[H],O[pa]=U.x,O[pa+1]=U.y,O[pa+2]=U.z,O[pa+3]=I.x,O[pa+4]=I.y,O[pa+5]=I.z,O[pa+6]=ga.x,O[pa+7]=ga.y,O[pa+8]=ga.z,O[pa+9]=J.x,O[pa+10]=J.y,O[pa+11]=J.z;pa+=12}if(Ma.length)H=Ma[B.a],C=Ma[B.b],O=Ma[B.c],Y=Ma[B.d],ea[R]=H.x,ea[R+1]=H.y,ea[R+2]=H.z,ea[R+3]=H.w,ea[R+4]=C.x,ea[R+5]=C.y,ea[R+6]=C.z,ea[R+7]=C.w,ea[R+8]=O.x,ea[R+9]=O.y,ea[R+10]=O.z,ea[R+11]=O.w,ea[R+12]=Y.x,ea[R+13]=Y.y,ea[R+14]=Y.z,ea[R+15]=Y.w,H=Ua[B.a],C=Ua[B.b],O=Ua[B.c],Y=Ua[B.d],da[R]=H.x,da[R+1]=H.y,da[R+2]=H.z,da[R+3]=H.w,da[R+
-4]=C.x,da[R+5]=C.y,da[R+6]=C.z,da[R+7]=C.w,da[R+8]=O.x,da[R+9]=O.y,da[R+10]=O.z,da[R+11]=O.w,da[R+12]=Y.x,da[R+13]=Y.y,da[R+14]=Y.z,da[R+15]=Y.w,H=Sa[B.a],C=Sa[B.b],O=Sa[B.c],Y=Sa[B.d],Z[R]=H.x,Z[R+1]=H.y,Z[R+2]=H.z,Z[R+3]=1,Z[R+4]=C.x,Z[R+5]=C.y,Z[R+6]=C.z,Z[R+7]=1,Z[R+8]=O.x,Z[R+9]=O.y,Z[R+10]=O.z,Z[R+11]=1,Z[R+12]=Y.x,Z[R+13]=Y.y,Z[R+14]=Y.z,Z[R+15]=1,H=Ta[B.a],C=Ta[B.b],O=Ta[B.c],B=Ta[B.d],aa[R]=H.x,aa[R+1]=H.y,aa[R+2]=H.z,aa[R+3]=1,aa[R+4]=C.x,aa[R+5]=C.y,aa[R+6]=C.z,aa[R+7]=1,aa[R+8]=O.x,aa[R+
-9]=O.y,aa[R+10]=O.z,aa[R+11]=1,aa[R+12]=B.x,aa[R+13]=B.y,aa[R+14]=B.z,aa[R+15]=1,R+=16;if(Ca&&z)na.length==4&&z==THREE.VertexColors?(B=na[0],H=na[1],C=na[2],na=na[3]):na=C=H=B=va,ka[V]=B.r,ka[V+1]=B.g,ka[V+2]=B.b,ka[V+3]=H.r,ka[V+4]=H.g,ka[V+5]=H.b,ka[V+6]=C.r,ka[V+7]=C.g,ka[V+8]=C.b,ka[V+9]=na.r,ka[V+10]=na.g,ka[V+11]=na.b,V+=12;if(Ka&&ta.hasTangents)na=ja[0],va=ja[1],B=ja[2],ja=ja[3],ia[S]=na.x,ia[S+1]=na.y,ia[S+2]=na.z,ia[S+3]=na.w,ia[S+4]=va.x,ia[S+5]=va.y,ia[S+6]=va.z,ia[S+7]=va.w,ia[S+8]=B.x,
-ia[S+9]=B.y,ia[S+10]=B.z,ia[S+11]=B.w,ia[S+12]=ja.x,ia[S+13]=ja.y,ia[S+14]=ja.z,ia[S+15]=ja.w,S+=16;if(Ga&&N)if(F.length==4&&Ia)for(ja=0;ja<4;ja++)K=F[ja],ha[T]=K.x,ha[T+1]=K.y,ha[T+2]=K.z,T+=3;else for(ja=0;ja<4;ja++)ha[T]=K.x,ha[T+1]=K.y,ha[T+2]=K.z,T+=3;if(Aa&&w!==void 0&&v)for(ja=0;ja<4;ja++)F=w[ja],wa[$]=F.u,wa[$+1]=F.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<4;ja++)F=A[ja],ua[ca]=F.u,ua[ca+1]=F.v,ca+=2;Ba&&(ma[qa]=Q,ma[qa+1]=Q+1,ma[qa+2]=Q+3,ma[qa+3]=Q+1,ma[qa+4]=Q+2,ma[qa+5]=Q+3,qa+=6,ra[ya]=
-Q,ra[ya+1]=Q+1,ra[ya+2]=Q,ra[ya+3]=Q+3,ra[ya+4]=Q+1,ra[ya+5]=Q+2,ra[ya+6]=Q+2,ra[ya+7]=Q+3,ya+=8,Q+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,fa,y));if(la)for(P in la)C=la[P],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,y));if(Fa){H=0;for(C=La.length;H<C;H++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[H]),o.bufferData(o.ARRAY_BUFFER,Da[H],y)}Ca&&V>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),
-o.bufferData(o.ARRAY_BUFFER,ka,y));Ga&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ha,y));Ka&&ta.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ia,y));Aa&&$>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Aa&&ca>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ua,y));Ba&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,
-ma,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,y));R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,Z,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,aa,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,da,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ea,y));X&&(delete p.__inittedArrays,
-delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(m)}else if(k instanceof THREE.Ribbon){h=k.geometry;if(h.__dirtyVertices||
-h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=X=X=void 0;u=k.vertices;t=k.colors;v=u.length;p=t.length;z=k.__vertexArray;y=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(X=0;X<v;X++)x=u[X].position,n=X*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}if(N){for(X=0;X<p;X++)color=t[X],n=X*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 THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=X=X=void 0;u=k.vertices;t=k.colors;v=u.length;p=t.length;z=k.__vertexArray;y=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(X=0;X<v;X++)x=u[X].position,n=X*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}if(N){for(X=0;X<p;X++)color=t[X],n=X*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 THREE.ParticleSystem)h=k.geometry,p=E(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||p)&&c(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,D(h)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};
-this.supportsVertexTextures=function(){return Ga}};
+1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,p=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(t=h.geometryGroupsList.length;n<t;n++)if(m=h.geometryGroupsList[n],p=E(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||p)if(p=m,y=o.DYNAMIC_DRAW,X=!h.dynamic,p.__inittedArrays){var F=u=x=void 0,B=void 0,K=F=void 0,ma=void 0,va=void 0,ia=void 0,I=U=A=w=N=z=v=void 0,ha=void 0,J=void 0,
+H=B=ia=B=va=ma=void 0,C=void 0,O=C=H=ma=void 0,Y=void 0,P=O=C=H=F=F=K=ia=B=O=C=H=Y=O=C=H=Y=O=C=H=void 0,Q=0,na=0,aa=0,da=0,qa=0,T=0,S=0,ya=0,V=0,R=0,oa=0,O=H=0,O=void 0,ga=p.__vertexArray,wa=p.__uvArray,ua=p.__uv2Array,la=p.__normalArray,$=p.__tangentArray,ja=p.__colorArray,Z=p.__skinVertexAArray,ca=p.__skinVertexBArray,ea=p.__skinIndexArray,fa=p.__skinWeightArray,pa=p.__morphTargetsArrays,ka=p.__webglCustomAttributes,C=void 0,za=p.__faceArray,ra=p.__lineArray,Ia=p.__needsSmoothNormals,z=p.__vertexColorType,
+v=p.__uvType,N=p.__normalType,ta=k.geometry,Ea=ta.__dirtyVertices,Ca=ta.__dirtyElements,Ba=ta.__dirtyUvs,Ga=ta.__dirtyNormals,Ka=ta.__dirtyTangents,Da=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ja=ta.vertices,cb=p.faces,fb=ta.faces,db=ta.faceVertexUvs[0],eb=ta.faceVertexUvs[1],Sa=ta.skinVerticesA,Ta=ta.skinVerticesB,Ua=ta.skinIndices,Ma=ta.skinWeights,La=ta.morphTargets;if(ka)for(P in ka)ka[P].offset=0,ka[P].offsetSrc=0;x=0;for(u=cb.length;x<u;x++)if(F=cb[x],B=fb[F],db&&(w=db[F]),eb&&(A=eb[F]),F=
+B.vertexNormals,K=B.normal,ma=B.vertexColors,va=B.color,ia=B.vertexTangents,B instanceof THREE.Face3){if(Ea)U=Ja[B.a].position,I=Ja[B.b].position,ha=Ja[B.c].position,ga[na]=U.x,ga[na+1]=U.y,ga[na+2]=U.z,ga[na+3]=I.x,ga[na+4]=I.y,ga[na+5]=I.z,ga[na+6]=ha.x,ga[na+7]=ha.y,ga[na+8]=ha.z,na+=9;if(ka)for(P in ka)if(C=ka[P],C.__original.needsUpdate)H=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[H]=C.value[B.a],C.array[H+1]=C.value[B.b],C.array[H+2]=C.value[B.c]):
+C.boundTo==="faces"?(O=C.value[O],C.array[H]=O,C.array[H+1]=O,C.array[H+2]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[H]=C.value[O],C.array[H+1]=C.value[O+1],C.array[H+2]=C.value[O+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(U=C.value[B.a],I=C.value[B.b],ha=C.value[B.c]):C.boundTo==="faces"?(ha=I=U=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(U=C.value[O],I=C.value[O+1],ha=C.value[O+2],C.offsetSrc+=3),C.size===2?(C.array[H]=U.x,C.array[H+1]=
+U.y,C.array[H+2]=I.x,C.array[H+3]=I.y,C.array[H+4]=ha.x,C.array[H+5]=ha.y,C.offset+=6):C.size===3?(C.type==="c"?(C.array[H]=U.r,C.array[H+1]=U.g,C.array[H+2]=U.b,C.array[H+3]=I.r,C.array[H+4]=I.g,C.array[H+5]=I.b,C.array[H+6]=ha.r,C.array[H+7]=ha.g,C.array[H+8]=ha.b):(C.array[H]=U.x,C.array[H+1]=U.y,C.array[H+2]=U.z,C.array[H+3]=I.x,C.array[H+4]=I.y,C.array[H+5]=I.z,C.array[H+6]=ha.x,C.array[H+7]=ha.y,C.array[H+8]=ha.z),C.offset+=9):(C.array[H]=U.x,C.array[H+1]=U.y,C.array[H+2]=U.z,C.array[H+3]=U.w,
+C.array[H+4]=I.x,C.array[H+5]=I.y,C.array[H+6]=I.z,C.array[H+7]=I.w,C.array[H+8]=ha.x,C.array[H+9]=ha.y,C.array[H+10]=ha.z,C.array[H+11]=ha.w,C.offset+=12));if(Fa){H=0;for(C=La.length;H<C;H++)U=La[H].vertices[B.a].position,I=La[H].vertices[B.b].position,ha=La[H].vertices[B.c].position,O=pa[H],O[oa]=U.x,O[oa+1]=U.y,O[oa+2]=U.z,O[oa+3]=I.x,O[oa+4]=I.y,O[oa+5]=I.z,O[oa+6]=ha.x,O[oa+7]=ha.y,O[oa+8]=ha.z;oa+=9}if(Ma.length)H=Ma[B.a],C=Ma[B.b],O=Ma[B.c],fa[R]=H.x,fa[R+1]=H.y,fa[R+2]=H.z,fa[R+3]=H.w,fa[R+
+4]=C.x,fa[R+5]=C.y,fa[R+6]=C.z,fa[R+7]=C.w,fa[R+8]=O.x,fa[R+9]=O.y,fa[R+10]=O.z,fa[R+11]=O.w,H=Ua[B.a],C=Ua[B.b],O=Ua[B.c],ea[R]=H.x,ea[R+1]=H.y,ea[R+2]=H.z,ea[R+3]=H.w,ea[R+4]=C.x,ea[R+5]=C.y,ea[R+6]=C.z,ea[R+7]=C.w,ea[R+8]=O.x,ea[R+9]=O.y,ea[R+10]=O.z,ea[R+11]=O.w,H=Sa[B.a],C=Sa[B.b],O=Sa[B.c],Z[R]=H.x,Z[R+1]=H.y,Z[R+2]=H.z,Z[R+3]=1,Z[R+4]=C.x,Z[R+5]=C.y,Z[R+6]=C.z,Z[R+7]=1,Z[R+8]=O.x,Z[R+9]=O.y,Z[R+10]=O.z,Z[R+11]=1,H=Ta[B.a],C=Ta[B.b],O=Ta[B.c],ca[R]=H.x,ca[R+1]=H.y,ca[R+2]=H.z,ca[R+3]=1,ca[R+
+4]=C.x,ca[R+5]=C.y,ca[R+6]=C.z,ca[R+7]=1,ca[R+8]=O.x,ca[R+9]=O.y,ca[R+10]=O.z,ca[R+11]=1,R+=12;if(Da&&z)ma.length==3&&z==THREE.VertexColors?(B=ma[0],H=ma[1],C=ma[2]):C=H=B=va,ja[V]=B.r,ja[V+1]=B.g,ja[V+2]=B.b,ja[V+3]=H.r,ja[V+4]=H.g,ja[V+5]=H.b,ja[V+6]=C.r,ja[V+7]=C.g,ja[V+8]=C.b,V+=9;if(Ka&&ta.hasTangents)ma=ia[0],va=ia[1],B=ia[2],$[S]=ma.x,$[S+1]=ma.y,$[S+2]=ma.z,$[S+3]=ma.w,$[S+4]=va.x,$[S+5]=va.y,$[S+6]=va.z,$[S+7]=va.w,$[S+8]=B.x,$[S+9]=B.y,$[S+10]=B.z,$[S+11]=B.w,S+=12;if(Ga&&N)if(F.length==
+3&&Ia)for(ia=0;ia<3;ia++)K=F[ia],la[T]=K.x,la[T+1]=K.y,la[T+2]=K.z,T+=3;else for(ia=0;ia<3;ia++)la[T]=K.x,la[T+1]=K.y,la[T+2]=K.z,T+=3;if(Ba&&w!==void 0&&v)for(ia=0;ia<3;ia++)F=w[ia],wa[aa]=F.u,wa[aa+1]=F.v,aa+=2;if(Ba&&A!==void 0&&v)for(ia=0;ia<3;ia++)F=A[ia],ua[da]=F.u,ua[da+1]=F.v,da+=2;Ca&&(za[qa]=Q,za[qa+1]=Q+1,za[qa+2]=Q+2,qa+=3,ra[ya]=Q,ra[ya+1]=Q+1,ra[ya+2]=Q,ra[ya+3]=Q+2,ra[ya+4]=Q+1,ra[ya+5]=Q+2,ya+=6,Q+=3)}else if(B instanceof THREE.Face4){if(Ea)U=Ja[B.a].position,I=Ja[B.b].position,ha=
+Ja[B.c].position,J=Ja[B.d].position,ga[na]=U.x,ga[na+1]=U.y,ga[na+2]=U.z,ga[na+3]=I.x,ga[na+4]=I.y,ga[na+5]=I.z,ga[na+6]=ha.x,ga[na+7]=ha.y,ga[na+8]=ha.z,ga[na+9]=J.x,ga[na+10]=J.y,ga[na+11]=J.z,na+=12;if(ka)for(P in ka)if(C=ka[P],C.__original.needsUpdate)H=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[H]=C.value[B.a],C.array[H+1]=C.value[B.b],C.array[H+2]=C.value[B.c],C.array[H+3]=C.value[B.d]):C.boundTo==="faces"?(O=C.value[O],C.array[H]=O,C.array[H+1]=O,
+C.array[H+2]=O,C.array[H+3]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[H]=C.value[O],C.array[H+1]=C.value[O+1],C.array[H+2]=C.value[O+2],C.array[H+3]=C.value[O+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo==="vertices"?(U=C.value[B.a],I=C.value[B.b],ha=C.value[B.c],J=C.value[B.d]):C.boundTo==="faces"?(J=ha=I=U=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(U=C.value[O],I=C.value[O+1],ha=C.value[O+2],J=C.value[O+3],C.offsetSrc+=4),C.size===2?(C.array[H]=U.x,C.array[H+
+1]=U.y,C.array[H+2]=I.x,C.array[H+3]=I.y,C.array[H+4]=ha.x,C.array[H+5]=ha.y,C.array[H+6]=J.x,C.array[H+7]=J.y,C.offset+=8):C.size===3?(C.type==="c"?(C.array[H]=U.r,C.array[H+1]=U.g,C.array[H+2]=U.b,C.array[H+3]=I.r,C.array[H+4]=I.g,C.array[H+5]=I.b,C.array[H+6]=ha.r,C.array[H+7]=ha.g,C.array[H+8]=ha.b,C.array[H+9]=J.r,C.array[H+10]=J.g,C.array[H+11]=J.b):(C.array[H]=U.x,C.array[H+1]=U.y,C.array[H+2]=U.z,C.array[H+3]=I.x,C.array[H+4]=I.y,C.array[H+5]=I.z,C.array[H+6]=ha.x,C.array[H+7]=ha.y,C.array[H+
+8]=ha.z,C.array[H+9]=J.x,C.array[H+10]=J.y,C.array[H+11]=J.z),C.offset+=12):(C.array[H]=U.x,C.array[H+1]=U.y,C.array[H+2]=U.z,C.array[H+3]=U.w,C.array[H+4]=I.x,C.array[H+5]=I.y,C.array[H+6]=I.z,C.array[H+7]=I.w,C.array[H+8]=ha.x,C.array[H+9]=ha.y,C.array[H+10]=ha.z,C.array[H+11]=ha.w,C.array[H+12]=J.x,C.array[H+13]=J.y,C.array[H+14]=J.z,C.array[H+15]=J.w,C.offset+=16));if(Fa){H=0;for(C=La.length;H<C;H++)U=La[H].vertices[B.a].position,I=La[H].vertices[B.b].position,ha=La[H].vertices[B.c].position,
+J=La[H].vertices[B.d].position,O=pa[H],O[oa]=U.x,O[oa+1]=U.y,O[oa+2]=U.z,O[oa+3]=I.x,O[oa+4]=I.y,O[oa+5]=I.z,O[oa+6]=ha.x,O[oa+7]=ha.y,O[oa+8]=ha.z,O[oa+9]=J.x,O[oa+10]=J.y,O[oa+11]=J.z;oa+=12}if(Ma.length)H=Ma[B.a],C=Ma[B.b],O=Ma[B.c],Y=Ma[B.d],fa[R]=H.x,fa[R+1]=H.y,fa[R+2]=H.z,fa[R+3]=H.w,fa[R+4]=C.x,fa[R+5]=C.y,fa[R+6]=C.z,fa[R+7]=C.w,fa[R+8]=O.x,fa[R+9]=O.y,fa[R+10]=O.z,fa[R+11]=O.w,fa[R+12]=Y.x,fa[R+13]=Y.y,fa[R+14]=Y.z,fa[R+15]=Y.w,H=Ua[B.a],C=Ua[B.b],O=Ua[B.c],Y=Ua[B.d],ea[R]=H.x,ea[R+1]=H.y,
+ea[R+2]=H.z,ea[R+3]=H.w,ea[R+4]=C.x,ea[R+5]=C.y,ea[R+6]=C.z,ea[R+7]=C.w,ea[R+8]=O.x,ea[R+9]=O.y,ea[R+10]=O.z,ea[R+11]=O.w,ea[R+12]=Y.x,ea[R+13]=Y.y,ea[R+14]=Y.z,ea[R+15]=Y.w,H=Sa[B.a],C=Sa[B.b],O=Sa[B.c],Y=Sa[B.d],Z[R]=H.x,Z[R+1]=H.y,Z[R+2]=H.z,Z[R+3]=1,Z[R+4]=C.x,Z[R+5]=C.y,Z[R+6]=C.z,Z[R+7]=1,Z[R+8]=O.x,Z[R+9]=O.y,Z[R+10]=O.z,Z[R+11]=1,Z[R+12]=Y.x,Z[R+13]=Y.y,Z[R+14]=Y.z,Z[R+15]=1,H=Ta[B.a],C=Ta[B.b],O=Ta[B.c],B=Ta[B.d],ca[R]=H.x,ca[R+1]=H.y,ca[R+2]=H.z,ca[R+3]=1,ca[R+4]=C.x,ca[R+5]=C.y,ca[R+6]=
+C.z,ca[R+7]=1,ca[R+8]=O.x,ca[R+9]=O.y,ca[R+10]=O.z,ca[R+11]=1,ca[R+12]=B.x,ca[R+13]=B.y,ca[R+14]=B.z,ca[R+15]=1,R+=16;if(Da&&z)ma.length==4&&z==THREE.VertexColors?(B=ma[0],H=ma[1],C=ma[2],ma=ma[3]):ma=C=H=B=va,ja[V]=B.r,ja[V+1]=B.g,ja[V+2]=B.b,ja[V+3]=H.r,ja[V+4]=H.g,ja[V+5]=H.b,ja[V+6]=C.r,ja[V+7]=C.g,ja[V+8]=C.b,ja[V+9]=ma.r,ja[V+10]=ma.g,ja[V+11]=ma.b,V+=12;if(Ka&&ta.hasTangents)ma=ia[0],va=ia[1],B=ia[2],ia=ia[3],$[S]=ma.x,$[S+1]=ma.y,$[S+2]=ma.z,$[S+3]=ma.w,$[S+4]=va.x,$[S+5]=va.y,$[S+6]=va.z,
+$[S+7]=va.w,$[S+8]=B.x,$[S+9]=B.y,$[S+10]=B.z,$[S+11]=B.w,$[S+12]=ia.x,$[S+13]=ia.y,$[S+14]=ia.z,$[S+15]=ia.w,S+=16;if(Ga&&N)if(F.length==4&&Ia)for(ia=0;ia<4;ia++)K=F[ia],la[T]=K.x,la[T+1]=K.y,la[T+2]=K.z,T+=3;else for(ia=0;ia<4;ia++)la[T]=K.x,la[T+1]=K.y,la[T+2]=K.z,T+=3;if(Ba&&w!==void 0&&v)for(ia=0;ia<4;ia++)F=w[ia],wa[aa]=F.u,wa[aa+1]=F.v,aa+=2;if(Ba&&A!==void 0&&v)for(ia=0;ia<4;ia++)F=A[ia],ua[da]=F.u,ua[da+1]=F.v,da+=2;Ca&&(za[qa]=Q,za[qa+1]=Q+1,za[qa+2]=Q+3,za[qa+3]=Q+1,za[qa+4]=Q+2,za[qa+
+5]=Q+3,qa+=6,ra[ya]=Q,ra[ya+1]=Q+1,ra[ya+2]=Q,ra[ya+3]=Q+3,ra[ya+4]=Q+1,ra[ya+5]=Q+2,ra[ya+6]=Q+2,ra[ya+7]=Q+3,ya+=8,Q+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,ga,y));if(ka)for(P in ka)C=ka[P],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,y));if(Fa){H=0;for(C=La.length;H<C;H++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[H]),o.bufferData(o.ARRAY_BUFFER,pa[H],y)}Da&&V>0&&(o.bindBuffer(o.ARRAY_BUFFER,
+p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ja,y));Ga&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,la,y));Ka&&ta.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,$,y));Ba&&aa>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Ba&&da>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ua,y));Ca&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),
+o.bufferData(o.ELEMENT_ARRAY_BUFFER,za,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,y));R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,Z,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ca,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ea,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
+fa,y));X&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(m)}else if(k instanceof THREE.Ribbon){h=
+k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=X=X=void 0;u=k.vertices;t=k.colors;v=u.length;p=t.length;z=k.__vertexArray;y=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(X=0;X<v;X++)x=u[X].position,n=X*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}if(N){for(X=0;X<p;X++)color=t[X],n=X*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 THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=X=X=void 0;u=k.vertices;t=k.colors;v=u.length;p=t.length;z=k.__vertexArray;y=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(X=0;X<v;X++)x=u[X].position,n=X*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}if(N){for(X=0;X<p;X++)color=t[X],n=X*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 THREE.ParticleSystem)h=k.geometry,p=E(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||p)&&c(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,D(h)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),
+o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Ga}};
 THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,e){THREE.WebGLRenderTarget.call(this,b,c,e);this.activeCubeFace=0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,e){THREE.WebGLRenderTarget.call(this,b,c,e);this.activeCubeFace=0};
@@ -432,7 +433,7 @@ f,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFil
 new THREE.Vector3(0,0,-1));this.cameraPX.lookAt(this.cameraPXTarget);this.cameraNX.lookAt(this.cameraNXTarget);this.cameraPY.lookAt(this.cameraPYTarget);this.cameraNY.lookAt(this.cameraNYTarget);this.cameraPZ.lookAt(this.cameraPZTarget);this.cameraNZ.lookAt(this.cameraNZTarget)};this.updateCubeMap=function(b,e){var c=this.renderTarget;b.setFaceCulling("back","cw");e.scale.y=-1;e.position.y=2*this.height;e.updateMatrix();c.activeCubeFace=0;b.render(e,this.cameraPX,c);c.activeCubeFace=1;b.render(e,
 new THREE.Vector3(0,0,-1));this.cameraPX.lookAt(this.cameraPXTarget);this.cameraNX.lookAt(this.cameraNXTarget);this.cameraPY.lookAt(this.cameraPYTarget);this.cameraNY.lookAt(this.cameraNYTarget);this.cameraPZ.lookAt(this.cameraPZTarget);this.cameraNZ.lookAt(this.cameraNZTarget)};this.updateCubeMap=function(b,e){var c=this.renderTarget;b.setFaceCulling("back","cw");e.scale.y=-1;e.position.y=2*this.height;e.updateMatrix();c.activeCubeFace=0;b.render(e,this.cameraPX,c);c.activeCubeFace=1;b.render(e,
 this.cameraNX,c);e.scale.y=1;e.position.y=0;e.updateMatrix();e.scale.x=-1;e.updateMatrix();c.activeCubeFace=2;b.render(e,this.cameraPY,c);e.scale.x=1;e.updateMatrix();b.setFaceCulling("back","ccw");c.activeCubeFace=3;b.render(e,this.cameraNY,c);e.scale.x=-1;e.updateMatrix();b.setFaceCulling("back","cw");c.activeCubeFace=4;b.render(e,this.cameraPZ,c);c.activeCubeFace=5;b.render(e,this.cameraNZ,c);e.scale.x=1;e.updateMatrix();b.setFaceCulling("back","ccw")}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};
 this.cameraNX,c);e.scale.y=1;e.position.y=0;e.updateMatrix();e.scale.x=-1;e.updateMatrix();c.activeCubeFace=2;b.render(e,this.cameraPY,c);e.scale.x=1;e.updateMatrix();b.setFaceCulling("back","ccw");c.activeCubeFace=3;b.render(e,this.cameraNY,c);e.scale.x=-1;e.updateMatrix();b.setFaceCulling("back","cw");c.activeCubeFace=4;b.render(e,this.cameraPZ,c);c.activeCubeFace=5;b.render(e,this.cameraNZ,c);e.scale.x=1;e.updateMatrix();b.setFaceCulling("back","ccw")}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};
 THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};
 THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};
-THREE.FirstPersonControls=function(b,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.lastUpdate=(new Date).getTime();this.theta=this.phi=this.lon=this.lat=
+THREE.FirstPersonControls=function(b,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.lastUpdate=(new Date).getTime();this.theta=this.phi=this.lon=this.lat=
 this.mouseY=this.mouseX=this.autoSpeedFactor=this.tdiff=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();
 this.mouseY=this.mouseX=this.autoSpeedFactor=this.tdiff=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();
 if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=
 if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=
 b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
 b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
@@ -443,14 +444,14 @@ this.verticalMin)/(Math.PI-0)+this.verticalMin;b=this.target;c=this.object.posit
 e(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",e(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",e(this,this.onKeyUp),!1)};
 e(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",e(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",e(this,this.onKeyUp),!1)};
 THREE.PathControls=function(b,c){function e(b){if((b*=2)<1)return 0.5*b*b;return-0.5*(--b*(b-2)-1)}function f(b,e){return function(){e.apply(b,arguments)}}function h(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),A=m.length,F=0;k=A-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<A-1;k++)F=f*n.chunks[k]/n.total,e.keys[k]={time:F,pos:m[k]};h.hierarchy[0]=
 THREE.PathControls=function(b,c){function e(b){if((b*=2)<1)return 0.5*b*b;return-0.5*(--b*(b-2)-1)}function f(b,e){return function(){e.apply(b,arguments)}}function h(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),A=m.length,F=0;k=A-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<A-1;k++)F=f*n.chunks[k]/n.total,e.keys[k]={time:F,pos:m[k]};h.hierarchy[0]=
 e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function k(b,e){var c,f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}this.object=b;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function k(b,e){var c,f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}this.object=b;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
-new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
+new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var m=Math.PI*2,n=Math.PI/180;this.update=function(){var b,c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*n;this.theta=this.lon*n;b=this.phi%m;this.phi=b>=0?b:b+m;b=this.verticalAngleMap.srcRange;
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var m=Math.PI*2,n=Math.PI/180;this.update=function(){var b,c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*n;this.theta=this.lon*n;b=this.phi%m;this.phi=b>=0?b:b+m;b=this.verticalAngleMap.srcRange;
 c=this.verticalAngleMap.dstRange;var f=c[1]-c[0];this.phi=e(((this.phi-b[0])*(c[1]-c[0])/(b[1]-b[0])+c[0]-c[0])/f)*f+c[0];b=this.horizontalAngleMap.srcRange;c=this.horizontalAngleMap.dstRange;f=c[1]-c[0];this.theta=e(((this.theta-b[0])*(c[1]-c[0])/(b[1]-b[0])+c[0]-c[0])/f)*f+c[0];b=this.target.position;b.x=100*Math.sin(this.phi)*Math.cos(this.theta);b.y=100*Math.cos(this.phi);b.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(b){this.domElement===
 c=this.verticalAngleMap.dstRange;var f=c[1]-c[0];this.phi=e(((this.phi-b[0])*(c[1]-c[0])/(b[1]-b[0])+c[0]-c[0])/f)*f+c[0];b=this.horizontalAngleMap.srcRange;c=this.horizontalAngleMap.dstRange;f=c[1]-c[0];this.theta=e(((this.theta-b[0])*(c[1]-c[0])/(b[1]-b[0])+c[0]-c[0])/f)*f+c[0];b=this.target.position;b.x=100*Math.sin(this.phi)*Math.cos(this.theta);b.y=100*Math.cos(this.phi);b.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(b){this.domElement===
 document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),e=new THREE.MeshLambertMaterial({color:65280}),
 document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),e=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),m=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,b);b=new THREE.Mesh(m,e);b.position.set(0,10,0);this.animation=h(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(b)}else this.animation=h(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var b=
 c=new THREE.CubeGeometry(10,10,20),m=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,b);b=new THREE.Mesh(m,e);b.position.set(0,10,0);this.animation=h(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(b)}else this.animation=h(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var b=
 this.debugPath,e=this.spline,c=k(e,10),m=k(e,10),n=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,n);particleObj=new THREE.ParticleSystem(m,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.add(lineObj);particleObj.scale.set(1,1,1);b.add(particleObj);m=new THREE.SphereGeometry(1,16,8);n=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<e.points.length;i++)c=new THREE.Mesh(m,n),c.position.copy(e.points[i]),b.add(c)}this.domElement.addEventListener("mousemove",
 this.debugPath,e=this.spline,c=k(e,10),m=k(e,10),n=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,n);particleObj=new THREE.ParticleSystem(m,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.add(lineObj);particleObj.scale.set(1,1,1);b.add(particleObj);m=new THREE.SphereGeometry(1,16,8);n=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<e.points.length;i++)c=new THREE.Mesh(m,n),c.position.copy(e.points[i]),b.add(c)}this.domElement.addEventListener("mousemove",
 f(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
 f(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(b,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
+THREE.FlyControls=function(b,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=
 1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=
 1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=
 0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.object.moveForward=
 0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.object.moveForward=
@@ -476,7 +477,7 @@ this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();
 (h===this.STATE.ROTATE?n=this.getMouseProjectionOnBall(b.clientX,b.clientY):h===this.STATE.ZOOM&&!this.noZoom?t=this.getMouseOnScreen(b.clientX,b.clientY):h===this.STATE.PAN&&!this.noPan&&(u=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",e(this,function(b){b.preventDefault();b.stopPropagation();if(h===this.STATE.NONE)h=b.button,h===this.STATE.ROTATE?m=n=this.getMouseProjectionOnBall(b.clientX,b.clientY):h===this.STATE.ZOOM&&!this.noZoom?p=t=this.getMouseOnScreen(b.clientX,
 (h===this.STATE.ROTATE?n=this.getMouseProjectionOnBall(b.clientX,b.clientY):h===this.STATE.ZOOM&&!this.noZoom?t=this.getMouseOnScreen(b.clientX,b.clientY):h===this.STATE.PAN&&!this.noPan&&(u=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",e(this,function(b){b.preventDefault();b.stopPropagation();if(h===this.STATE.NONE)h=b.button,h===this.STATE.ROTATE?m=n=this.getMouseProjectionOnBall(b.clientX,b.clientY):h===this.STATE.ZOOM&&!this.noZoom?p=t=this.getMouseOnScreen(b.clientX,
 b.clientY):this.noPan||(w=u=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",e(this,function(b){b.preventDefault();b.stopPropagation();h=this.STATE.NONE}),!1);window.addEventListener("keydown",e(this,function(b){if(h===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])h=this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)h=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)h=this.STATE.PAN;h!==
 b.clientY):this.noPan||(w=u=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",e(this,function(b){b.preventDefault();b.stopPropagation();h=this.STATE.NONE}),!1);window.addEventListener("keydown",e(this,function(b){if(h===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])h=this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)h=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)h=this.STATE.PAN;h!==
 this.STATE.NONE&&(f=!0)}}),!1);window.addEventListener("keyup",e(this,function(){if(h!==this.STATE.NONE)h=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
 this.STATE.NONE&&(f=!0)}}),!1);window.addEventListener("keyup",e(this,function(){if(h!==this.STATE.NONE)h=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.CubeGeometry=function(b,c,e,f,h,k,m,n,p){function t(b,e,c,m,n,t,p,u){var v,x,y=f||1,z=h||1,P=n/2,Q=t/2,S=w.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")v="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")v="y",z=k||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",y=k||1;var W=y+1,o=z+1;n/=y;var da=t/z;for(x=0;x<o;x++)for(t=0;t<W;t++){var T=new THREE.Vector3;T[b]=(t*n-P)*c;T[e]=(x*da-Q)*m;T[v]=p;w.vertices.push(new THREE.Vertex(T))}for(x=0;x<z;x++)for(t=0;t<y;t++)w.faces.push(new THREE.Face4(t+W*
+THREE.CubeGeometry=function(b,c,e,f,h,k,m,n,p){function t(b,e,c,m,n,t,p,u){var v,x,y=f||1,z=h||1,P=n/2,Q=t/2,S=w.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")v="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")v="y",z=k||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",y=k||1;var W=y+1,o=z+1;n/=y;var ea=t/z;for(x=0;x<o;x++)for(t=0;t<W;t++){var T=new THREE.Vector3;T[b]=(t*n-P)*c;T[e]=(x*ea-Q)*m;T[v]=p;w.vertices.push(new THREE.Vertex(T))}for(x=0;x<z;x++)for(t=0;t<y;t++)w.faces.push(new THREE.Face4(t+W*
 x+S,t+W*(x+1)+S,t+1+W*(x+1)+S,t+1+W*x+S,null,null,u)),w.faceVertexUvs[0].push([new THREE.UV(t/y,x/z),new THREE.UV(t/y,(x+1)/z),new THREE.UV((t+1)/y,(x+1)/z),new THREE.UV((t+1)/y,x/z)])}THREE.Geometry.call(this);var w=this,u=b/2,x=c/2,v=e/2,n=n?-1:1;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var z in p)this.sides[z]!=void 0&&(this.sides[z]=
 x+S,t+W*(x+1)+S,t+1+W*(x+1)+S,t+1+W*x+S,null,null,u)),w.faceVertexUvs[0].push([new THREE.UV(t/y,x/z),new THREE.UV(t/y,(x+1)/z),new THREE.UV((t+1)/y,(x+1)/z),new THREE.UV((t+1)/y,x/z)])}THREE.Geometry.call(this);var w=this,u=b/2,x=c/2,v=e/2,n=n?-1:1;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var z in p)this.sides[z]!=void 0&&(this.sides[z]=
 p[z]);this.sides.px&&t("z","y",1*n,-1,e,c,-u,this.materials[0]);this.sides.nx&&t("z","y",-1*n,-1,e,c,u,this.materials[1]);this.sides.py&&t("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&t("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&t("x","y",1*n,-1,b,c,v,this.materials[4]);this.sides.nz&&t("x","y",-1*n,-1,b,c,-v,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 p[z]);this.sides.px&&t("z","y",1*n,-1,e,c,-u,this.materials[0]);this.sides.nx&&t("z","y",-1*n,-1,e,c,u,this.materials[1]);this.sides.py&&t("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&t("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&t("x","y",1*n,-1,b,c,v,this.materials[4]);this.sides.nz&&t("x","y",-1*n,-1,b,c,-v,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
@@ -486,18 +487,18 @@ this.vertices[e].position.clone().setY(0).normalize(),z=this.vertices[u].positio
 G=new THREE.UV(D.u,1),this.faces.push(new THREE.Face3(e,u,x,[y,z,A])),this.faceVertexUvs[0].push([E,D,G])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 G=new THREE.UV(D.u,1),this.faces.push(new THREE.Face3(e,u,x,[y,z,A])),this.faceVertexUvs[0].push([E,D,G])}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=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,e,c){e||console.log("die");return e.clone().multiplyScalar(c).addSelf(b)}function f(b,e,c){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,k=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-e.x,b.y-e.y);h.set(b.x-c.x,b.y-c.y);f=f.normalize();h=h.normalize();k.set(-f.y,f.x);m.set(h.y,-h.x);n.copy(b).addSelf(k);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
 THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,e,c){e||console.log("die");return e.clone().multiplyScalar(c).addSelf(b)}function f(b,e,c){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,k=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-e.x,b.y-e.y);h.set(b.x-c.x,b.y-c.y);f=f.normalize();h=h.normalize();k.set(-f.y,f.x);m.set(h.y,-h.x);n.copy(b).addSelf(k);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
-n.copy(e).addSelf(k);o.copy(c).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<0)return e=Math.atan2(e.y-b.y,e.x-b.x),b=Math.atan2(c.y-b.y,c.x-b.x),e>b&&(b+=Math.PI*2),anglec=(e+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(I=b.length;--I>=0;){ma=I;ea=I-1;ea<0&&(ea=b.length-
-1);for(var e=0,c=v+w*2,e=0;e<c;e++){var f=da*e,h=da*(e+1),k=Z+ma+f,m=Z+ma+h,o=k,f=Z+ea+f,h=Z+ea+h,t=m;o+=ca;f+=ca;h+=ca;t+=ca;K.faces.push(new THREE.Face4(o,f,h,t,null,null,G));G&&(o=e/c,f=(e+1)/c,h=n+p*2,k=(K.vertices[k].position.z+p)/h,m=(K.vertices[m].position.z+p)/h,K.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function k(b,e,c){K.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function m(b,e,c){b+=ca;e+=ca;c+=ca;K.faces.push(new THREE.Face3(b,
+n.copy(e).addSelf(k);o.copy(c).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<0)return e=Math.atan2(e.y-b.y,e.x-b.x),b=Math.atan2(c.y-b.y,c.x-b.x),e>b&&(b+=Math.PI*2),anglec=(e+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(I=b.length;--I>=0;){ka=I;fa=I-1;fa<0&&(fa=b.length-
+1);for(var e=0,c=v+w*2,e=0;e<c;e++){var f=ea*e,h=ea*(e+1),k=Z+ka+f,m=Z+ka+h,o=k,f=Z+fa+f,h=Z+fa+h,t=m;o+=da;f+=da;h+=da;t+=da;K.faces.push(new THREE.Face4(o,f,h,t,null,null,G));G&&(o=e/c,f=(e+1)/c,h=n+p*2,k=(K.vertices[k].position.z+p)/h,m=(K.vertices[m].position.z+p)/h,K.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function k(b,e,c){K.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function m(b,e,c){b+=da;e+=da;c+=da;K.faces.push(new THREE.Face3(b,
 e,c,null,null,D));if(D){var f=L.maxY,h=L.maxX,k=K.vertices[e].position.x,e=K.vertices[e].position.y,m=K.vertices[c].position.x,c=K.vertices[c].position.y;K.faceVertexUvs[0].push([new THREE.UV(K.vertices[b].position.x/h,K.vertices[b].position.y/f),new THREE.UV(k/h,e/f),new THREE.UV(m/h,c/f)])}}var n=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:p-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
 e,c,null,null,D));if(D){var f=L.maxY,h=L.maxX,k=K.vertices[e].position.x,e=K.vertices[e].position.y,m=K.vertices[c].position.x,c=K.vertices[c].position.y;K.faceVertexUvs[0].push([new THREE.UV(K.vertices[b].position.x/h,K.vertices[b].position.y/f),new THREE.UV(k/h,e/f),new THREE.UV(m/h,c/f)])}}var n=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:p-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,x=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,y=c.bendPath,z=c.extrudePath,A,F=!1,E=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,G=c.extrudeMaterial,L=this.shapebb;if(z)A=z.getPoints(x),v=A.length,F=!0,u=!1;u||(t=p=w=0);var M,J,B,K=this,ca=this.vertices.length;y&&b.addWrapPath(y);x=E?b.extractAllSpacedPoints(x):b.extractAllPoints(x);y=x.shape;x=x.holes;if(z=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();J=0;for(B=x.length;J<B;J++)M=x[J],THREE.Shape.Utils.isClockWise(M)&&
-(x[J]=M.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(y,x);E=y;J=0;for(B=x.length;J<B;J++)M=x[J],y=y.concat(M);var I,P,Q,S,W,o,da=y.length,T=z.length,la=[];I=0;P=E.length;ma=P-1;for(ea=I+1;I<P;I++,ma++,ea++)ma==P&&(ma=0),ea==P&&(ea=0),la[I]=f(E[I],E[ma],E[ea]);var ha=[],ka,aa=la.concat();J=0;for(B=x.length;J<B;J++){M=x[J];ka=[];I=0;P=M.length;ma=P-1;for(ea=I+1;I<P;I++,ma++,ea++)ma==P&&(ma=0),ea==P&&(ea=0),ka[I]=f(M[I],M[ma],M[ea]);ha.push(ka);aa=aa.concat(ka)}for(Q=0;Q<w;Q++){S=Q/w;W=p*(1-
-S);S=t*Math.sin(S*Math.PI/2);I=0;for(P=E.length;I<P;I++)o=e(E[I],la[I],S),k(o.x,o.y,-W);J=0;for(B=x.length;J<B;J++){M=x[J];ka=ha[J];I=0;for(P=M.length;I<P;I++)o=e(M[I],ka[I],S),k(o.x,o.y,-W)}}S=t;for(I=0;I<da;I++)o=u?e(y[I],aa[I],S):y[I],F?k(o.x,o.y+A[0].y,A[0].x):k(o.x,o.y,0);for(Q=1;Q<=v;Q++)for(I=0;I<da;I++)o=u?e(y[I],aa[I],S):y[I],F?k(o.x,o.y+A[Q-1].y,A[Q-1].x):k(o.x,o.y,n/v*Q);for(Q=w-1;Q>=0;Q--){S=Q/w;W=p*(1-S);S=t*Math.sin(S*Math.PI/2);I=0;for(P=E.length;I<P;I++)o=e(E[I],la[I],S),k(o.x,o.y,
-n+W);J=0;for(B=x.length;J<B;J++){M=x[J];ka=ha[J];I=0;for(P=M.length;I<P;I++)o=e(M[I],ka[I],S),F?k(o.x,o.y+A[v-1].y,A[v-1].x+W):k(o.x,o.y,n+W)}}if(u){u=da*0;for(I=0;I<T;I++)t=z[I],m(t[2]+u,t[1]+u,t[0]+u);u=da*(v+w*2);for(I=0;I<T;I++)t=z[I],m(t[0]+u,t[1]+u,t[2]+u)}else{for(I=0;I<T;I++)t=z[I],m(t[2],t[1],t[0]);for(I=0;I<T;I++)t=z[I],m(t[0]+da*v,t[1]+da*v,t[2]+da*v)}var ma,ea,Z=0;h(E);Z+=E.length;J=0;for(B=x.length;J<B;J++)M=x[J],h(M),Z+=M.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,y=c.bendPath,z=c.extrudePath,A,F=!1,E=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,G=c.extrudeMaterial,L=this.shapebb;if(z)A=z.getPoints(x),v=A.length,F=!0,u=!1;u||(t=p=w=0);var M,J,B,K=this,da=this.vertices.length;y&&b.addWrapPath(y);x=E?b.extractAllSpacedPoints(x):b.extractAllPoints(x);y=x.shape;x=x.holes;if(z=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();J=0;for(B=x.length;J<B;J++)M=x[J],THREE.Shape.Utils.isClockWise(M)&&
+(x[J]=M.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(y,x);E=y;J=0;for(B=x.length;J<B;J++)M=x[J],y=y.concat(M);var I,P,Q,S,W,o,ea=y.length,T=z.length,pa=[];I=0;P=E.length;ka=P-1;for(fa=I+1;I<P;I++,ka++,fa++)ka==P&&(ka=0),fa==P&&(fa=0),pa[I]=f(E[I],E[ka],E[fa]);var $=[],la,ca=pa.concat();J=0;for(B=x.length;J<B;J++){M=x[J];la=[];I=0;P=M.length;ka=P-1;for(fa=I+1;I<P;I++,ka++,fa++)ka==P&&(ka=0),fa==P&&(fa=0),la[I]=f(M[I],M[ka],M[fa]);$.push(la);ca=ca.concat(la)}for(Q=0;Q<w;Q++){S=Q/w;W=p*(1-S);
+S=t*Math.sin(S*Math.PI/2);I=0;for(P=E.length;I<P;I++)o=e(E[I],pa[I],S),k(o.x,o.y,-W);J=0;for(B=x.length;J<B;J++){M=x[J];la=$[J];I=0;for(P=M.length;I<P;I++)o=e(M[I],la[I],S),k(o.x,o.y,-W)}}S=t;for(I=0;I<ea;I++)o=u?e(y[I],ca[I],S):y[I],F?k(o.x,o.y+A[0].y,A[0].x):k(o.x,o.y,0);for(Q=1;Q<=v;Q++)for(I=0;I<ea;I++)o=u?e(y[I],ca[I],S):y[I],F?k(o.x,o.y+A[Q-1].y,A[Q-1].x):k(o.x,o.y,n/v*Q);for(Q=w-1;Q>=0;Q--){S=Q/w;W=p*(1-S);S=t*Math.sin(S*Math.PI/2);I=0;for(P=E.length;I<P;I++)o=e(E[I],pa[I],S),k(o.x,o.y,n+W);
+J=0;for(B=x.length;J<B;J++){M=x[J];la=$[J];I=0;for(P=M.length;I<P;I++)o=e(M[I],la[I],S),F?k(o.x,o.y+A[v-1].y,A[v-1].x+W):k(o.x,o.y,n+W)}}if(u){u=ea*0;for(I=0;I<T;I++)t=z[I],m(t[2]+u,t[1]+u,t[0]+u);u=ea*(v+w*2);for(I=0;I<T;I++)t=z[I],m(t[0]+u,t[1]+u,t[2]+u)}else{for(I=0;I<T;I++)t=z[I],m(t[2],t[1],t[0]);for(I=0;I<T;I++)t=z[I],m(t[0]+ea*v,t[1]+ea*v,t[2]+ea*v)}var ka,fa,Z=0;h(E);Z+=E.length;J=0;for(B=x.length;J<B;J++)M=x[J],h(M),Z+=M.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(b){function c(b,e,c){var f=Math.sqrt(b*b+e*e+c*c);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,e/f,c/f)))-1}function e(b,e,c,f){f.faces.push(new THREE.Face3(b,e,c))}function f(b,e){var f=h.vertices[b].position,k=h.vertices[e].position;return c((f.x+k.x)/2,(f.y+k.y)/2,(f.z+k.z)/2)}var h=this,k=new THREE.Geometry;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
 THREE.IcosahedronGeometry=function(b){function c(b,e,c){var f=Math.sqrt(b*b+e*e+c*c);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,e/f,c/f)))-1}function e(b,e,c,f){f.faces.push(new THREE.Face3(b,e,c))}function f(b,e){var f=h.vertices[b].position,k=h.vertices[e].position;return c((f.x+k.x)/2,(f.y+k.y)/2,(f.z+k.z)/2)}var h=this,k=new THREE.Geometry;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
 -b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,k);e(0,5,1,k);e(0,1,7,k);e(0,7,10,k);e(0,10,11,k);e(1,5,9,k);e(5,11,4,k);e(11,10,2,k);e(10,7,6,k);e(7,1,8,k);e(3,9,4,k);e(3,4,2,k);e(3,2,6,k);e(3,6,8,k);e(3,8,9,k);e(4,9,5,k);e(2,4,11,k);e(6,2,10,k);e(8,6,7,k);e(9,8,1,k);for(var m=0;m<this.subdivisions;m++){var b=new THREE.Geometry,n;for(n in k.faces){var p=f(k.faces[n].a,k.faces[n].b),t=f(k.faces[n].b,k.faces[n].c),w=f(k.faces[n].c,k.faces[n].a);e(k.faces[n].a,p,w,b);e(k.faces[n].b,t,
 -b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,k);e(0,5,1,k);e(0,1,7,k);e(0,7,10,k);e(0,10,11,k);e(1,5,9,k);e(5,11,4,k);e(11,10,2,k);e(10,7,6,k);e(7,1,8,k);e(3,9,4,k);e(3,4,2,k);e(3,2,6,k);e(3,6,8,k);e(3,8,9,k);e(4,9,5,k);e(2,4,11,k);e(6,2,10,k);e(8,6,7,k);e(9,8,1,k);for(var m=0;m<this.subdivisions;m++){var b=new THREE.Geometry,n;for(n in k.faces){var p=f(k.faces[n].a,k.faces[n].b),t=f(k.faces[n].b,k.faces[n].c),w=f(k.faces[n].c,k.faces[n].a);e(k.faces[n].a,p,w,b);e(k.faces[n].b,t,
 p,b);e(k.faces[n].c,w,t,b);e(p,t,w,b)}k.faces=b.faces}h.faces=k.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 p,b);e(k.faces[n].c,w,t,b);e(p,t,w,b)}k.faces=b.faces}h.faces=k.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],h=[],k=[],m=(new THREE.Matrix4).setRotationZ(c),n=0;n<b.length;n++)this.vertices.push(new THREE.Vertex(b[n])),e[n]=b[n].clone(),f[n]=this.vertices.length-1;for(var p=0;p<=this.angle+0.001;p+=c){for(n=0;n<e.length;n++)p<this.angle?(e[n]=m.multiplyVector3(e[n].clone()),this.vertices.push(new THREE.Vertex(e[n])),h[n]=this.vertices.length-1):h=k;p==0&&(k=f);
+THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],h=[],k=[],m=(new THREE.Matrix4).setRotationZ(c),n=0;n<b.length;n++)this.vertices.push(new THREE.Vertex(b[n])),e[n]=b[n].clone(),f[n]=this.vertices.length-1;for(var p=0;p<=this.angle+0.0010;p+=c){for(n=0;n<e.length;n++)p<this.angle?(e[n]=m.multiplyVector3(e[n].clone()),this.vertices.push(new THREE.Vertex(e[n])),h[n]=this.vertices.length-1):h=k;p==0&&(k=f);
 for(n=0;n<f.length-1;n++)this.faces.push(new THREE.Face4(h[n],h[n+1],f[n+1],f[n])),this.faceVertexUvs[0].push([new THREE.UV(1-p/this.angle,n/b.length),new THREE.UV(1-p/this.angle,(n+1)/b.length),new THREE.UV(1-(p-c)/this.angle,(n+1)/b.length),new THREE.UV(1-(p-c)/this.angle,n/b.length)]);f=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 for(n=0;n<f.length-1;n++)this.faces.push(new THREE.Face4(h[n],h[n+1],f[n+1],f[n])),this.faceVertexUvs[0].push([new THREE.UV(1-p/this.angle,n/b.length),new THREE.UV(1-p/this.angle,(n+1)/b.length),new THREE.UV(1-(p-c)/this.angle,(n+1)/b.length),new THREE.UV(1-(p-c)/this.angle,n/b.length)]);f=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(b,c){function e(e){var c=e.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(b));c.index=m.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(e.z,-e.x)/2/Math.PI+0.5,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+0.5);return c}function f(b,e,c,n){n<1?(n=new THREE.Face3(b.index,e.index,c.index,[b.position,e.position,c.position]),n.centroid.addSelf(b.position).addSelf(e.position).addSelf(c.position).divideScalar(3),n.normal=n.centroid.clone().normalize(),
 THREE.OctahedronGeometry=function(b,c){function e(e){var c=e.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(b));c.index=m.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(e.z,-e.x)/2/Math.PI+0.5,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+0.5);return c}function f(b,e,c,n){n<1?(n=new THREE.Face3(b.index,e.index,c.index,[b.position,e.position,c.position]),n.centroid.addSelf(b.position).addSelf(e.position).addSelf(c.position).divideScalar(3),n.normal=n.centroid.clone().normalize(),
 m.faces.push(n),n=Math.atan2(n.centroid.z,-n.centroid.x),m.faceVertexUvs[0].push([k(b.uv,b.position,n),k(e.uv,e.position,n),k(c.uv,c.position,n)])):(n-=1,f(b,h(b,e),h(b,c),n),f(h(b,e),e,h(e,c),n),f(h(b,c),h(e,c),c,n),f(h(b,e),h(e,c),h(b,c),n))}function h(b,c){n[b.index]||(n[b.index]=[]);n[c.index]||(n[c.index]=[]);var f=n[b.index][c.index];f===void 0&&(n[b.index][c.index]=n[c.index][b.index]=f=e((new THREE.Vector3).add(b.position,c.position).divideScalar(2)));return f}function k(b,e,c){c<0&&b.u===
 m.faces.push(n),n=Math.atan2(n.centroid.z,-n.centroid.x),m.faceVertexUvs[0].push([k(b.uv,b.position,n),k(e.uv,e.position,n),k(c.uv,c.position,n)])):(n-=1,f(b,h(b,e),h(b,c),n),f(h(b,e),e,h(e,c),n),f(h(b,c),h(e,c),c,n),f(h(b,e),h(e,c),h(b,c),n))}function h(b,c){n[b.index]||(n[b.index]=[]);n[c.index]||(n[c.index]=[]);var f=n[b.index][c.index];f===void 0&&(n[b.index][c.index]=n[c.index][b.index]=f=e((new THREE.Vector3).add(b.position,c.position).divideScalar(2)));return f}function k(b,e,c){c<0&&b.u===
@@ -516,7 +517,7 @@ this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),k=h.length,m=[
 t));h.moveTo(n,t);break;case "l":n=c[b++]*e+f;t=c[b++]*e;k.push(new THREE.Vector2(n,t));h.lineTo(n,t);break;case "q":n=c[b++]*e+f;t=c[b++]*e;x=c[b++]*e+f;v=c[b++]*e;h.quadraticCurveTo(x,v,n,t);if(m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++){var F=m/divisions,E=THREE.Shape.Utils.b2(F,w,x,n),F=THREE.Shape.Utils.b2(F,u,v,t);k.push(new THREE.Vector2(E,F))}}break;case "b":if(n=c[b++]*e+f,t=c[b++]*e,x=c[b++]*e+f,v=c[b++]*-e,y=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(n,t,
 t));h.moveTo(n,t);break;case "l":n=c[b++]*e+f;t=c[b++]*e;k.push(new THREE.Vector2(n,t));h.lineTo(n,t);break;case "q":n=c[b++]*e+f;t=c[b++]*e;x=c[b++]*e+f;v=c[b++]*e;h.quadraticCurveTo(x,v,n,t);if(m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++){var F=m/divisions,E=THREE.Shape.Utils.b2(F,w,x,n),F=THREE.Shape.Utils.b2(F,u,v,t);k.push(new THREE.Vector2(E,F))}}break;case "b":if(n=c[b++]*e+f,t=c[b++]*e,x=c[b++]*e+f,v=c[b++]*-e,y=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(n,t,
 x,v,y,z),m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)F=m/divisions,E=THREE.Shape.Utils.b3(F,w,x,y,n),F=THREE.Shape.Utils.b3(F,u,v,z,t),k.push(new THREE.Vector2(E,F))}}}return{offset:A.ha*e,points:k,path:h}}}};
 x,v,y,z),m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)F=m/divisions,E=THREE.Shape.Utils.b3(F,w,x,y,n),F=THREE.Shape.Utils.b3(F,u,v,z,t),k.push(new THREE.Vector2(E,F))}}}return{offset:A.ha*e,points:k,path:h}}}};
 (function(b){var c=function(b){for(var c=b.length,h=0,k=c-1,m=0;m<c;k=m++)h+=b[k].x*b[m].y-b[m].x*b[k].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var k=[],m=[],n=[],p,t,w;if(c(b)>0)for(t=0;t<h;t++)m[t]=t;else for(t=0;t<h;t++)m[t]=h-1-t;var u=2*h;for(t=h-1;h>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}p=t;h<=p&&(p=0);t=p+1;h<=t&&(t=0);w=t+1;h<=w&&(w=0);var x;a:{x=b;var v=p,y=t,z=w,A=h,F=m,E=void 0,D=void 0,G=void 0,
 (function(b){var c=function(b){for(var c=b.length,h=0,k=c-1,m=0;m<c;k=m++)h+=b[k].x*b[m].y-b[m].x*b[k].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var k=[],m=[],n=[],p,t,w;if(c(b)>0)for(t=0;t<h;t++)m[t]=t;else for(t=0;t<h;t++)m[t]=h-1-t;var u=2*h;for(t=h-1;h>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}p=t;h<=p&&(p=0);t=p+1;h<=t&&(t=0);w=t+1;h<=w&&(w=0);var x;a:{x=b;var v=p,y=t,z=w,A=h,F=m,E=void 0,D=void 0,G=void 0,
-L=void 0,M=void 0,J=void 0,B=void 0,K=void 0,ca=void 0,D=x[F[v]].x,G=x[F[v]].y,L=x[F[y]].x,M=x[F[y]].y,J=x[F[z]].x,B=x[F[z]].y;if(1.0E-10>(L-D)*(B-G)-(M-G)*(J-D))x=!1;else{for(E=0;E<A;E++)if(!(E==v||E==y||E==z)){var K=x[F[E]].x,ca=x[F[E]].y,I=void 0,P=void 0,Q=void 0,S=void 0,W=void 0,o=void 0,da=void 0,T=void 0,la=void 0,ha=void 0,ka=void 0,aa=void 0,I=Q=W=void 0,I=J-L,P=B-M,Q=D-J,S=G-B,W=L-D,o=M-G,da=K-D,T=ca-G,la=K-L,ha=ca-M,ka=K-J,aa=ca-B,I=I*ha-P*la,W=W*T-o*da,Q=Q*aa-S*ka;if(I>=0&&Q>=0&&W>=0){x=
+L=void 0,M=void 0,J=void 0,B=void 0,K=void 0,da=void 0,D=x[F[v]].x,G=x[F[v]].y,L=x[F[y]].x,M=x[F[y]].y,J=x[F[z]].x,B=x[F[z]].y;if(1.0E-10>(L-D)*(B-G)-(M-G)*(J-D))x=!1;else{for(E=0;E<A;E++)if(!(E==v||E==y||E==z)){var K=x[F[E]].x,da=x[F[E]].y,I=void 0,P=void 0,Q=void 0,S=void 0,W=void 0,o=void 0,ea=void 0,T=void 0,pa=void 0,$=void 0,la=void 0,ca=void 0,I=Q=W=void 0,I=J-L,P=B-M,Q=D-J,S=G-B,W=L-D,o=M-G,ea=K-D,T=da-G,pa=K-L,$=da-M,la=K-J,ca=da-B,I=I*$-P*pa,W=W*T-o*ea,Q=Q*ca-S*la;if(I>=0&&Q>=0&&W>=0){x=
 !1;break a}}x=!0}}if(x){k.push([b[m[p]],b[m[t]],b[m[w]]]);n.push([m[p],m[t],m[w]]);p=t;for(w=t+1;w<h;p++,w++)m[p]=m[w];h--;u=2*h}}if(f)return n;return k};b.Triangulate.area=c;return b})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 !1;break a}}x=!0}}if(x){k.push([b[m[p]],b[m[t]],b[m[w]]]);n.push([m[p],m[t],m[w]]);p=t;for(w=t+1;w<h;p++,w++)m[p]=m[w];h--;u=2*h}}if(f)return n;return k};b.Triangulate.area=c;return b})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(b,c,e,f,h){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=h||Math.PI*2;h=new THREE.Vector3;b=[];c=[];for(e=0;e<=this.segmentsR;e++)for(f=0;f<=this.segmentsT;f++){var k=f/this.segmentsT*this.arc,m=e/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(k);h.y=this.radius*Math.sin(k);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(m))*Math.cos(k);n.y=(this.radius+this.tube*Math.cos(m))*Math.sin(k);n.z=
 THREE.TorusGeometry=function(b,c,e,f,h){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=h||Math.PI*2;h=new THREE.Vector3;b=[];c=[];for(e=0;e<=this.segmentsR;e++)for(f=0;f<=this.segmentsT;f++){var k=f/this.segmentsT*this.arc,m=e/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(k);h.y=this.radius*Math.sin(k);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(m))*Math.cos(k);n.y=(this.radius+this.tube*Math.cos(m))*Math.sin(k);n.z=
 this.tube*Math.sin(m);this.vertices.push(new THREE.Vertex(n));b.push(new THREE.UV(f/this.segmentsT,1-e/this.segmentsR));c.push(n.clone().subSelf(h).normalize())}for(e=1;e<=this.segmentsR;e++)for(f=1;f<=this.segmentsT;f++){var h=(this.segmentsT+1)*e+f-1,k=(this.segmentsT+1)*(e-1)+f-1,m=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,p=new THREE.Face4(h,k,m,n,[c[h],c[k],c[m],c[n]]);p.normal.addSelf(c[h]);p.normal.addSelf(c[k]);p.normal.addSelf(c[m]);p.normal.addSelf(c[n]);p.normal.normalize();this.faces.push(p);
 this.tube*Math.sin(m);this.vertices.push(new THREE.Vertex(n));b.push(new THREE.UV(f/this.segmentsT,1-e/this.segmentsR));c.push(n.clone().subSelf(h).normalize())}for(e=1;e<=this.segmentsR;e++)for(f=1;f<=this.segmentsT;f++){var h=(this.segmentsT+1)*e+f-1,k=(this.segmentsT+1)*(e-1)+f-1,m=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,p=new THREE.Face4(h,k,m,n,[c[h],c[k],c[m],c[n]]);p.normal.addSelf(c[h]);p.normal.addSelf(c[k]);p.normal.addSelf(c[m]);p.normal.addSelf(c[n]);p.normal.normalize();this.faces.push(p);
@@ -546,71 +547,71 @@ c.postMessage(b)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,k){var m=new XMLHttpRequest,n=f+"/"+b,p=0;m.onreadystatechange=function(){m.readyState==4?m.status==200||m.status==0?THREE.BinaryLoader.prototype.createBinModel(m.responseText,e,h,c):alert("Couldn't load ["+n+"] ["+m.status+"]"):m.readyState==3?k&&(p==0&&(p=m.getResponseHeader("Content-Length")),k({total:p,loaded:m.responseText.length})):m.readyState==2&&(p=m.getResponseHeader("Content-Length"))};m.open("GET",n,!0);m.overrideMimeType("text/plain; charset=x-user-defined");
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,k){var m=new XMLHttpRequest,n=f+"/"+b,p=0;m.onreadystatechange=function(){m.readyState==4?m.status==200||m.status==0?THREE.BinaryLoader.prototype.createBinModel(m.responseText,e,h,c):alert("Couldn't load ["+n+"] ["+m.status+"]"):m.readyState==3?k&&(p==0&&(p=m.getResponseHeader("Content-Length")),k({total:p,loaded:m.responseText.length})):m.readyState==2&&(p=m.getResponseHeader("Content-Length"))};m.open("GET",n,!0);m.overrideMimeType("text/plain; charset=x-user-defined");
 m.setRequestHeader("Content-Type","text/plain");m.send(null)};
 m.setRequestHeader("Content-Type","text/plain");m.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(e){function c(b,e){var f=w(b,e),h=w(b,e+1),k=w(b,e+2),m=w(b,e+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,e){var c=w(b,e),f=w(b,e+1),k=w(b,e+2);return(w(b,e+3)<<24)+(k<<16)+(f<<8)+c}function p(b,e){var c=w(b,e);return(w(b,e+1)<<8)+c}function t(b,e){var c=w(b,e);return c>127?c-256:c}function w(b,e){return b.charCodeAt(e)&255}function u(e){var c,
 THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(e){function c(b,e){var f=w(b,e),h=w(b,e+1),k=w(b,e+2),m=w(b,e+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,e){var c=w(b,e),f=w(b,e+1),k=w(b,e+2);return(w(b,e+3)<<24)+(k<<16)+(f<<8)+c}function p(b,e){var c=w(b,e);return(w(b,e+1)<<8)+c}function t(b,e){var c=w(b,e);return c>127?c-256:c}function w(b,e){return b.charCodeAt(e)&255}function u(e){var c,
-f,k;c=h(b,e);f=h(b,e+M);k=h(b,e+J);e=p(b,e+B);F.faces.push(new THREE.Face3(c,f,k,null,null,F.materials[e]))}function x(e){var c,f,k,m,o,t;c=h(b,e);f=h(b,e+M);k=h(b,e+J);m=p(b,e+B);o=h(b,e+K);t=h(b,e+ca);e=h(b,e+I);m=F.materials[m];var u=G[t*3],v=G[t*3+1];t=G[t*3+2];var w=G[e*3],x=G[e*3+1],e=G[e*3+2];F.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(G[o*3],G[o*3+1],G[o*3+2]),new THREE.Vector3(u,v,t),new THREE.Vector3(w,x,e)],null,m))}function v(e){var c,f,k,m;c=h(b,e);f=h(b,e+P);k=h(b,e+Q);m=h(b,
-e+S);e=p(b,e+W);F.faces.push(new THREE.Face4(c,f,k,m,null,null,F.materials[e]))}function y(e){var c,f,k,m,t,u,v,w;c=h(b,e);f=h(b,e+P);k=h(b,e+Q);m=h(b,e+S);t=p(b,e+W);u=h(b,e+o);v=h(b,e+da);w=h(b,e+T);e=h(b,e+la);t=F.materials[t];var x=G[v*3],y=G[v*3+1];v=G[v*3+2];var z=G[w*3],N=G[w*3+1];w=G[w*3+2];var A=G[e*3],B=G[e*3+1],e=G[e*3+2];F.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(G[u*3],G[u*3+1],G[u*3+2]),new THREE.Vector3(x,y,v),new THREE.Vector3(z,N,w),new THREE.Vector3(A,B,e)],null,t))}
-function z(e){var c,f,k,m;c=h(b,e);f=h(b,e+ha);k=h(b,e+ka);e=L[c*2];m=L[c*2+1];c=L[f*2];var o=F.faceVertexUvs[0];f=L[f*2+1];var t=L[k*2];k=L[k*2+1];var p=[];p.push(new THREE.UV(e,m));p.push(new THREE.UV(c,f));p.push(new THREE.UV(t,k));o.push(p)}function A(e){var c,f,k,m,o,t;c=h(b,e);f=h(b,e+aa);k=h(b,e+ma);m=h(b,e+ea);e=L[c*2];o=L[c*2+1];c=L[f*2];t=L[f*2+1];f=L[k*2];var p=F.faceVertexUvs[0];k=L[k*2+1];var u=L[m*2];m=L[m*2+1];var v=[];v.push(new THREE.UV(e,o));v.push(new THREE.UV(c,t));v.push(new THREE.UV(f,
-k));v.push(new THREE.UV(u,m));p.push(v)}var F=this,E=0,D,G=[],L=[],M,J,B,K,ca,I,P,Q,S,W,o,da,T,la,ha,ka,aa,ma,ea,Z,$,Y,fa,ia,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(F,f,e);D={signature:b.substr(E,8),header_bytes:w(b,E+8),vertex_coordinate_bytes:w(b,E+9),normal_coordinate_bytes:w(b,E+10),uv_coordinate_bytes:w(b,E+11),vertex_index_bytes:w(b,E+12),normal_index_bytes:w(b,E+13),uv_index_bytes:w(b,E+14),material_index_bytes:w(b,E+15),nvertices:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b,
-E+16+8),ntri_flat:h(b,E+16+12),ntri_smooth:h(b,E+16+16),ntri_flat_uv:h(b,E+16+20),ntri_smooth_uv:h(b,E+16+24),nquad_flat:h(b,E+16+28),nquad_smooth:h(b,E+16+32),nquad_flat_uv:h(b,E+16+36),nquad_smooth_uv:h(b,E+16+40)};E+=D.header_bytes;M=D.vertex_index_bytes;J=D.vertex_index_bytes*2;B=D.vertex_index_bytes*3;K=D.vertex_index_bytes*3+D.material_index_bytes;ca=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;I=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;P=D.vertex_index_bytes;
-Q=D.vertex_index_bytes*2;S=D.vertex_index_bytes*3;W=D.vertex_index_bytes*4;o=D.vertex_index_bytes*4+D.material_index_bytes;da=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;T=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;la=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;ha=D.uv_index_bytes;ka=D.uv_index_bytes*2;aa=D.uv_index_bytes;ma=D.uv_index_bytes*2;ea=D.uv_index_bytes*3;e=D.vertex_index_bytes*3+D.material_index_bytes;ra=D.vertex_index_bytes*
-4+D.material_index_bytes;Z=D.ntri_flat*e;$=D.ntri_smooth*(e+D.normal_index_bytes*3);Y=D.ntri_flat_uv*(e+D.uv_index_bytes*3);fa=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);ia=D.nquad_flat*ra;e=D.nquad_smooth*(ra+D.normal_index_bytes*4);ra=D.nquad_flat_uv*(ra+D.uv_index_bytes*4);E+=function(e){for(var f,h,k,n=D.vertex_coordinate_bytes*3,o=e+D.nvertices*n;e<o;e+=n)f=c(b,e),h=c(b,e+D.vertex_coordinate_bytes),k=c(b,e+D.vertex_coordinate_bytes*2),F.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
-h,k)));return D.nvertices*n}(E);E+=function(e){for(var c,f,h,k=D.normal_coordinate_bytes*3,m=e+D.nnormals*k;e<m;e+=k)c=t(b,e),f=t(b,e+D.normal_coordinate_bytes),h=t(b,e+D.normal_coordinate_bytes*2),G.push(c/127,f/127,h/127);return D.nnormals*k}(E);E+=function(e){for(var f,h,k=D.uv_coordinate_bytes*2,n=e+D.nuvs*k;e<n;e+=k)f=c(b,e),h=c(b,e+D.uv_coordinate_bytes),L.push(f,h);return D.nuvs*k}(E);Z=E+Z;$=Z+$;Y=$+Y;fa=Y+fa;ia=fa+ia;e=ia+e;ra=e+ra;(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,
-f=c+D.uv_index_bytes*3,h=b+D.ntri_flat_uv*f;for(e=b;e<h;e+=f)u(e),z(e+c);return h-b})($);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=c+D.uv_index_bytes*3,h=b+D.ntri_smooth_uv*f;for(e=b;e<h;e+=f)x(e),z(e+c);return h-b})(Y);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=c+D.uv_index_bytes*4,h=b+D.nquad_flat_uv*f;for(e=b;e<h;e+=f)v(e),A(e+c);return h-b})(e);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*
-4,f=c+D.uv_index_bytes*4,h=b+D.nquad_smooth_uv*f;for(e=b;e<h;e+=f)y(e),A(e+c);return h-b})(ra);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,f=b+D.ntri_flat*c;for(e=b;e<f;e+=c)u(e);return f-b})(E);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=b+D.ntri_smooth*c;for(e=b;e<f;e+=c)x(e);return f-b})(Z);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=b+D.nquad_flat*c;for(e=b;e<f;e+=c)v(e);return f-b})(fa);(function(b){var e,
-c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,f=b+D.nquad_smooth*c;for(e=b;e<f;e+=c)y(e);return f-b})(ia);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,e,c){for(var b=Z.evaluate(b,Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new e).parse(h);if(h.id.length==0)h.id=c+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,e=-b,c=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);e=Math.max(e,m.endTime);c=Math.max(c,m.input.length)}return{start:b,end:e,frames:c}}function e(b,c,f,h){b.world=b.world||
+f,k;c=h(b,e);f=h(b,e+M);k=h(b,e+J);e=p(b,e+B);F.faces.push(new THREE.Face3(c,f,k,null,null,F.materials[e]))}function x(e){var c,f,k,m,o,t;c=h(b,e);f=h(b,e+M);k=h(b,e+J);m=p(b,e+B);o=h(b,e+K);t=h(b,e+da);e=h(b,e+I);m=F.materials[m];var u=G[t*3],v=G[t*3+1];t=G[t*3+2];var w=G[e*3],x=G[e*3+1],e=G[e*3+2];F.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(G[o*3],G[o*3+1],G[o*3+2]),new THREE.Vector3(u,v,t),new THREE.Vector3(w,x,e)],null,m))}function v(e){var c,f,k,m;c=h(b,e);f=h(b,e+P);k=h(b,e+Q);m=h(b,
+e+S);e=p(b,e+W);F.faces.push(new THREE.Face4(c,f,k,m,null,null,F.materials[e]))}function y(e){var c,f,k,m,t,u,v,w;c=h(b,e);f=h(b,e+P);k=h(b,e+Q);m=h(b,e+S);t=p(b,e+W);u=h(b,e+o);v=h(b,e+ea);w=h(b,e+T);e=h(b,e+pa);t=F.materials[t];var x=G[v*3],y=G[v*3+1];v=G[v*3+2];var z=G[w*3],N=G[w*3+1];w=G[w*3+2];var A=G[e*3],B=G[e*3+1],e=G[e*3+2];F.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(G[u*3],G[u*3+1],G[u*3+2]),new THREE.Vector3(x,y,v),new THREE.Vector3(z,N,w),new THREE.Vector3(A,B,e)],null,t))}
+function z(e){var c,f,k,m;c=h(b,e);f=h(b,e+$);k=h(b,e+la);e=L[c*2];m=L[c*2+1];c=L[f*2];var o=F.faceVertexUvs[0];f=L[f*2+1];var t=L[k*2];k=L[k*2+1];var p=[];p.push(new THREE.UV(e,m));p.push(new THREE.UV(c,f));p.push(new THREE.UV(t,k));o.push(p)}function A(e){var c,f,k,m,o,t;c=h(b,e);f=h(b,e+ca);k=h(b,e+ka);m=h(b,e+fa);e=L[c*2];o=L[c*2+1];c=L[f*2];t=L[f*2+1];f=L[k*2];var p=F.faceVertexUvs[0];k=L[k*2+1];var u=L[m*2];m=L[m*2+1];var v=[];v.push(new THREE.UV(e,o));v.push(new THREE.UV(c,t));v.push(new THREE.UV(f,
+k));v.push(new THREE.UV(u,m));p.push(v)}var F=this,E=0,D,G=[],L=[],M,J,B,K,da,I,P,Q,S,W,o,ea,T,pa,$,la,ca,ka,fa,Z,aa,Y,ga,ja,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(F,f,e);D={signature:b.substr(E,8),header_bytes:w(b,E+8),vertex_coordinate_bytes:w(b,E+9),normal_coordinate_bytes:w(b,E+10),uv_coordinate_bytes:w(b,E+11),vertex_index_bytes:w(b,E+12),normal_index_bytes:w(b,E+13),uv_index_bytes:w(b,E+14),material_index_bytes:w(b,E+15),nvertices:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b,
+E+16+8),ntri_flat:h(b,E+16+12),ntri_smooth:h(b,E+16+16),ntri_flat_uv:h(b,E+16+20),ntri_smooth_uv:h(b,E+16+24),nquad_flat:h(b,E+16+28),nquad_smooth:h(b,E+16+32),nquad_flat_uv:h(b,E+16+36),nquad_smooth_uv:h(b,E+16+40)};E+=D.header_bytes;M=D.vertex_index_bytes;J=D.vertex_index_bytes*2;B=D.vertex_index_bytes*3;K=D.vertex_index_bytes*3+D.material_index_bytes;da=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;I=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;P=D.vertex_index_bytes;
+Q=D.vertex_index_bytes*2;S=D.vertex_index_bytes*3;W=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;T=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;pa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;$=D.uv_index_bytes;la=D.uv_index_bytes*2;ca=D.uv_index_bytes;ka=D.uv_index_bytes*2;fa=D.uv_index_bytes*3;e=D.vertex_index_bytes*3+D.material_index_bytes;ra=D.vertex_index_bytes*
+4+D.material_index_bytes;Z=D.ntri_flat*e;aa=D.ntri_smooth*(e+D.normal_index_bytes*3);Y=D.ntri_flat_uv*(e+D.uv_index_bytes*3);ga=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);ja=D.nquad_flat*ra;e=D.nquad_smooth*(ra+D.normal_index_bytes*4);ra=D.nquad_flat_uv*(ra+D.uv_index_bytes*4);E+=function(e){for(var f,h,k,n=D.vertex_coordinate_bytes*3,o=e+D.nvertices*n;e<o;e+=n)f=c(b,e),h=c(b,e+D.vertex_coordinate_bytes),k=c(b,e+D.vertex_coordinate_bytes*2),F.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
+h,k)));return D.nvertices*n}(E);E+=function(e){for(var c,f,h,k=D.normal_coordinate_bytes*3,m=e+D.nnormals*k;e<m;e+=k)c=t(b,e),f=t(b,e+D.normal_coordinate_bytes),h=t(b,e+D.normal_coordinate_bytes*2),G.push(c/127,f/127,h/127);return D.nnormals*k}(E);E+=function(e){for(var f,h,k=D.uv_coordinate_bytes*2,n=e+D.nuvs*k;e<n;e+=k)f=c(b,e),h=c(b,e+D.uv_coordinate_bytes),L.push(f,h);return D.nuvs*k}(E);Z=E+Z;aa=Z+aa;Y=aa+Y;ga=Y+ga;ja=ga+ja;e=ja+e;ra=e+ra;(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,
+f=c+D.uv_index_bytes*3,h=b+D.ntri_flat_uv*f;for(e=b;e<h;e+=f)u(e),z(e+c);return h-b})(aa);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=c+D.uv_index_bytes*3,h=b+D.ntri_smooth_uv*f;for(e=b;e<h;e+=f)x(e),z(e+c);return h-b})(Y);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=c+D.uv_index_bytes*4,h=b+D.nquad_flat_uv*f;for(e=b;e<h;e+=f)v(e),A(e+c);return h-b})(e);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*
+4,f=c+D.uv_index_bytes*4,h=b+D.nquad_smooth_uv*f;for(e=b;e<h;e+=f)y(e),A(e+c);return h-b})(ra);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,f=b+D.ntri_flat*c;for(e=b;e<f;e+=c)u(e);return f-b})(E);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=b+D.ntri_smooth*c;for(e=b;e<f;e+=c)x(e);return f-b})(Z);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=b+D.nquad_flat*c;for(e=b;e<f;e+=c)v(e);return f-b})(ga);(function(b){var e,
+c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,f=b+D.nquad_smooth*c;for(e=b;e<f;e+=c)y(e);return f-b})(ja);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,e,c){for(var b=Z.evaluate(b,Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new e).parse(h);if(h.id.length==0)h.id=c+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,e=-b,c=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);e=Math.max(e,m.endTime);c=Math.max(c,m.input.length)}return{start:b,end:e,frames:c}}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=O[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=Y.getChildById(f.skeleton[0],!0)||Y.getChildBySid(f.skeleton[0],
 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=O[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=Y.getChildById(f.skeleton[0],!0)||Y.getChildBySid(f.skeleton[0],
 !0),n,o,t,p,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(p=0;p<n.length;p++){t=n[p];v=-1;for(var y=0;y<o.joints.length;y++)if(t.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];t.invBindMatrix=y;t.skinningMatrix=new THREE.Matrix4;t.skinningMatrix.multiply(t.world,y);t.weights=[];
 !0),n,o,t,p,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(p=0;p<n.length;p++){t=n[p];v=-1;for(var y=0;y<o.joints.length;y++)if(t.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];t.invBindMatrix=y;t.skinningMatrix=new THREE.Matrix4;t.skinningMatrix.multiply(t.world,y);t.weights=[];
 for(y=0;y<o.weights.length;y++)for(var z=0;z<o.weights[y].length;z++){var A=o.weights[y][z];A.joint==v&&t.weights.push(A)}}else throw"could not find joint!";}for(n=0;n<w.length;n++)for(o=0;o<w[n].weights.length;o++)t=w[n].weights[o],p=t.index,t=t.weight,v=b.vertices[p],p=x[p],u.x=v.position.x,u.y=v.position.y,u.z=v.position.z,w[n].skinningMatrix.multiplyVector3(u),p.position.x+=u.x*t,p.position.y+=u.y*t,p.position.z+=u.z*t;b.morphTargets.push({name:"target_"+h,vertices:x})}}}function h(b){var e=new THREE.Object3D,
 for(y=0;y<o.weights.length;y++)for(var z=0;z<o.weights[y].length;z++){var A=o.weights[y][z];A.joint==v&&t.weights.push(A)}}else throw"could not find joint!";}for(n=0;n<w.length;n++)for(o=0;o<w[n].weights.length;o++)t=w[n].weights[o],p=t.index,t=t.weight,v=b.vertices[p],p=x[p],u.x=v.position.x,u.y=v.position.y,u.z=v.position.z,w[n].skinningMatrix.multiplyVector3(u),p.position.x+=u.x*t,p.position.y+=u.y*t,p.position.z+=u.z*t;b.morphTargets.push({name:"target_"+h,vertices:x})}}}function h(b){var e=new THREE.Object3D,
-c,k,m;e.name=b.id||"";e.matrixAutoUpdate=!1;e.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=O[b.controllers[m].url];switch(n.type){case "skin":if(oa[n.skin.source]){var o=new y;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);c=b.controllers[m]}else if(O[n.skin.source]&&(k=n=O[n.skin.source],n.morph&&oa[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(oa[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=oa[n.url],t={},p=0,u;if(n&&n.mesh&&n.mesh.primitives){if(e.name.length==0)e.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=ua[qa[u.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;u=t[u.symbol]=
-v.material;p++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(p>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)p=n.faces[j],p.materials=[t[p.daeMaterial]]}if(c!==void 0)f(n,c),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=c.skeleton,o.skinController=O[c.url],o.skinInstanceController=c,o.name="skin_"+Ca.length,Ca.push(o);else if(k!==void 0){t=n;p=k instanceof x?O[k.url]:k;if(!p||!p.morph)console.log("could not find morph controller!");
-else{p=p.morph;for(v=0;v<p.targets.length;v++){var w=oa[p.targets[v]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===t.vertices.length&&t.morphTargets.push({name:"target_1",vertices:w.vertices})}t.morphTargets.push({name:"target_Z",vertices:t.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+Aa.length;Aa.push(o)}else o=new THREE.Mesh(n,o);e.add(o)}}for(m=0;m<b.nodes.length;m++)e.add(h(b.nodes[m],b));return e}function k(){this.init_from=
+c,k,m;e.name=b.id||"";e.matrixAutoUpdate=!1;e.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=O[b.controllers[m].url];switch(n.type){case "skin":if(na[n.skin.source]){var o=new y;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);c=b.controllers[m]}else if(O[n.skin.source]&&(k=n=O[n.skin.source],n.morph&&na[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(na[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=na[n.url],t={},p=0,u;if(n&&n.mesh&&n.mesh.primitives){if(e.name.length==0)e.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=ua[qa[u.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;u=t[u.symbol]=
+v.material;p++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(p>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)p=n.faces[j],p.materials=[t[p.daeMaterial]]}if(c!==void 0)f(n,c),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=c.skeleton,o.skinController=O[c.url],o.skinInstanceController=c,o.name="skin_"+Da.length,Da.push(o);else if(k!==void 0){t=n;p=k instanceof x?O[k.url]:k;if(!p||!p.morph)console.log("could not find morph controller!");
+else{p=p.morph;for(v=0;v<p.targets.length;v++){var w=na[p.targets[v]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===t.vertices.length&&t.morphTargets.push({name:"target_1",vertices:w.vertices})}t.morphTargets.push({name:"target_Z",vertices:t.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+Ba.length;Ba.push(o)}else o=new THREE.Mesh(n,o);e.add(o)}}for(m=0;m<b.nodes.length;m++)e.add(h(b.nodes[m],b));return e}function k(){this.init_from=
 this.id=""}function m(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function p(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function t(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function w(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function u(){this.type=
 this.id=""}function m(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function p(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function t(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function w(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function u(){this.type=
 this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function v(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function A(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function F(){}function E(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){this.source="";
 this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function v(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function A(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function F(){}function E(){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 G(){this.input={}}function L(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(b){this.id=b;this.type=null}function J(){this.name=this.id="";this.instance_effect=null}function B(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(b,e){this.type=b;this.effect=e;this.material=null}function ca(b){this.effect=b;this.format=this.init_from=
+this.stride=this.count=0;this.params=[]}function G(){this.input={}}function L(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(b){this.id=b;this.type=null}function J(){this.name=this.id="";this.instance_effect=null}function B(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(b,e){this.type=b;this.effect=e;this.material=null}function da(b){this.effect=b;this.format=this.init_from=
 null}function I(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function P(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Q(){this.url=""}function S(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function W(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
 null}function I(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function P(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Q(){this.url=""}function S(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function W(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
-this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function da(b){var e=b.getAttribute("id");if(ia[e]!=void 0)return ia[e];ia[e]=(new M(e)).parse(b);return ia[e]}function T(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function la(b){for(var b=ka(b),e=[],c=0;c<b.length;c++)e.push(parseFloat(b[c]));return e}function ha(b){for(var b=ka(b),e=[],c=0;c<b.length;c++)e.push(parseInt(b[c],10));return e}function ka(b){return b.replace(/^\s+/,"").replace(/\s+$/,
-"").split(/\s+/)}function aa(b,e,c){return b.hasAttribute(e)?parseInt(b.getAttribute(e),10):c}function ma(b,e){if(b===void 0){for(var c="0.";c.length<e+2;)c+="0";return c}e=e||2;c=b.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,e):"0";c[1].length<e;)c[1]+="0";return c.join(".")}function ea(b,e){var c="";c+=ma(b.x,e)+",";c+=ma(b.y,e)+",";c+=ma(b.z,e);return c}var Z=null,$=null,Y,fa=null,ia={},ra={},na={},O={},oa={},qa={},ua={},ta,Ea,Aa,Ca,Fa=THREE.SmoothShading;k.prototype.parse=function(b){this.id=
+this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ea(b){var e=b.getAttribute("id");if(ja[e]!=void 0)return ja[e];ja[e]=(new M(e)).parse(b);return ja[e]}function T(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function pa(b){for(var b=la(b),e=[],c=0;c<b.length;c++)e.push(parseFloat(b[c]));return e}function $(b){for(var b=la(b),e=[],c=0;c<b.length;c++)e.push(parseInt(b[c],10));return e}function la(b){return b.replace(/^\s+/,"").replace(/\s+$/,
+"").split(/\s+/)}function ca(b,e,c){return b.hasAttribute(e)?parseInt(b.getAttribute(e),10):c}function ka(b,e){if(b===void 0){for(var c="0.";c.length<e+2;)c+="0";return c}e=e||2;c=b.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,e):"0";c[1].length<e;)c[1]+="0";return c.join(".")}function fa(b,e){var c="";c+=ka(b.x,e)+",";c+=ka(b.y,e)+",";c+=ka(b.z,e);return c}var Z=null,aa=null,Y,ga=null,ja={},ra={},ma={},O={},na={},qa={},ua={},ta,Ea,Ba,Da,Fa=THREE.SmoothShading;k.prototype.parse=function(b){this.id=
 b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};m.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "skin":this.skin=(new p).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(b){var e=
 b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};m.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "skin":this.skin=(new p).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(b){var e=
 {},c=[],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 M).parse(h);e[h.id]=h;break;case "targets":c=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<c.length;f++)switch(b=c[f],h=e[b.source],b.semantic){case "MORPH_TARGET":this.targets=h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};n.prototype.parseInputs=
 {},c=[],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 M).parse(h);e[h.id]=h;break;case "targets":c=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<c.length;f++)switch(b=c[f],h=e[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 e=[],c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":e.push((new L).parse(f))}}return e};p.prototype.parse=function(b){var e={},c,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],
+function(b){for(var e=[],c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":e.push((new L).parse(f))}}return e};p.prototype.parse=function(b){var e={},c,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=pa(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 M).parse(k);e[k.id]=k;break;case "joints":c=k;break;case "vertex_weights":f=k;break;default:console.log(k.nodeName)}}this.parseJoints(c,e);this.parseWeights(f,e);return this};p.prototype.parseJoints=function(b,e){for(var c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":var f=(new L).parse(f),h=e[f.source];if(f.semantic=="JOINT")this.joints=
 k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15]);break;case "source":k=(new M).parse(k);e[k.id]=k;break;case "joints":c=k;break;case "vertex_weights":f=k;break;default:console.log(k.nodeName)}}this.parseJoints(c,e);this.parseWeights(f,e);return this};p.prototype.parseJoints=function(b,e){for(var c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":var f=(new L).parse(f),h=e[f.source];if(f.semantic=="JOINT")this.joints=
-h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};p.prototype.parseWeights=function(b,e){for(var c,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 L).parse(m));break;case "v":c=ha(m.textContent);break;case "vcount":f=ha(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],t=0;t<n;t++){for(var p={},v=0;v<h.length;v++){var u=h[v],w=c[m+u.offset];switch(u.semantic){case "JOINT":p.joint=w;break;
+h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};p.prototype.parseWeights=function(b,e){for(var c,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 L).parse(m));break;case "v":c=$(m.textContent);break;case "vcount":f=$(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],t=0;t<n;t++){for(var p={},v=0;v<h.length;v++){var u=h[v],w=c[m+u.offset];switch(u.semantic){case "JOINT":p.joint=w;break;
 case "WEIGHT":p.weight=e[u.source].data[w]}}o.push(p);m+=h.length}for(t=0;t<o.length;t++)o[t].index=k;this.weights.push(o)}};t.prototype.getChildById=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};t.prototype.getChildBySid=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};t.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");
 case "WEIGHT":p.weight=e[u.source].data[w]}}o.push(p);m+=h.length}for(t=0;t<o.length;t++)o[t].index=k;this.weights.push(o)}};t.prototype.getChildById=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};t.prototype.getChildBySid=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};t.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");
 this.nodes=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new w).parse(c))}}return this};w.prototype.getChannelForTransform=function(b){for(var e=0;e<this.channels.length;e++){var c=this.channels[e],f=c.target.split("/");f.shift();var h=f.shift(),k=h.indexOf(".")>=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,
 this.nodes=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new w).parse(c))}}return this};w.prototype.getChannelForTransform=function(b){for(var e=0;e<this.channels.length;e++){var c=this.channels[e],f=c.target.split("/");f.shift();var h=f.shift(),k=h.indexOf(".")>=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,
 ""))}if(h==b)return c.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},c}return null};w.prototype.getChildById=function(b,e){if(this.id==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};w.prototype.getChildBySid=function(b,e){if(this.sid==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};w.prototype.getTransformBySid=function(b){for(var e=0;e<this.transforms.length;e++)if(this.transforms[e].sid==
 ""))}if(h==b)return c.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},c}return null};w.prototype.getChildById=function(b,e){if(this.id==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};w.prototype.getChildBySid=function(b,e){if(this.sid==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};w.prototype.getTransformBySid=function(b){for(var e=0;e<this.transforms.length;e++)if(this.transforms[e].sid==
 b)return this.transforms[e];return null};w.prototype.parse=function(b){var e;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 c=0;c<b.childNodes.length;c++)if(e=b.childNodes[c],e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new w).parse(e));break;case "instance_camera":break;
 b)return this.transforms[e];return null};w.prototype.parse=function(b){var e;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 c=0;c<b.childNodes.length;c++)if(e=b.childNodes[c],e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new w).parse(e));break;case "instance_camera":break;
 case "instance_controller":this.controllers.push((new x).parse(e));break;case "instance_geometry":this.geometries.push((new y).parse(e));break;case "instance_light":break;case "instance_node":e=e.getAttribute("url").replace(/^#/,"");(e=Z.evaluate(".//dae:library_nodes//dae:node[@id='"+e+"']",Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new w).parse(e));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new u).parse(e));
 case "instance_controller":this.controllers.push((new x).parse(e));break;case "instance_geometry":this.geometries.push((new y).parse(e));break;case "instance_light":break;case "instance_node":e=e.getAttribute("url").replace(/^#/,"");(e=Z.evaluate(".//dae:library_nodes//dae:node[@id='"+e+"']",Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new w).parse(e));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new u).parse(e));
-break;case "extra":break;default:console.log(e.nodeName)}b=[];c=1E6;e=-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,c=Math.min(c,n.startTime),e=Math.max(e,n.endTime),b.push(m)}if(b.length)this.startTime=c,this.endTime=e;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(c=0;c<b.input.length-1;c++)f=Math.min(f,b.input[c+
+break;case "extra":break;default:console.log(e.nodeName)}b=[];c=1E6;e=-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,c=Math.min(c,n.startTime),e=Math.max(e,n.endTime),b.push(m)}if(b.length)this.startTime=c,this.endTime=e;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(c=0;c<b.input.length-1;c++)f=Math.min(f,b.input[c+
 1]-b.input[c])}c=[];for(b=this.startTime;b<this.endTime;b+=f){e=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 t=o.sampler,p,o=0;o<t.input.length-1;o++)if(t.input[o+1]>e){p=t.output[o];break}m=p!==void 0?p instanceof THREE.Matrix4?m.multiply(m,p):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);e=m;c.push({time:b,pos:[e.n14,
 1]-b.input[c])}c=[];for(b=this.startTime;b<this.endTime;b+=f){e=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 t=o.sampler,p,o=0;o<t.input.length-1;o++)if(t.input[o+1]>e){p=t.output[o];break}m=p!==void 0?p instanceof THREE.Matrix4?m.multiply(m,p):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);e=m;c.push({time:b,pos:[e.n14,
-e.n24,e.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};u.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=la(b.textContent);this.updateMatrix();return this};u.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
+e.n24,e.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};u.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=pa(b.textContent);this.updateMatrix();return this};u.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
 this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":b=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),b);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
 this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":b=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),b);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
 x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Z.evaluate(".//dae:instance_material",c,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=c.iterateNext();f;)this.instance_material.push((new v).parse(f)),f=c.iterateNext()}}return this};
 x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Z.evaluate(".//dae:instance_material",c,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=c.iterateNext();f;)this.instance_material.push((new v).parse(f)),f=c.iterateNext()}}return this};
 v.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 e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1&&c.nodeName=="bind_material"){if(b=Z.evaluate(".//dae:instance_material",c,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new v).parse(e)),
 v.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 e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1&&c.nodeName=="bind_material"){if(b=Z.evaluate(".//dae:instance_material",c,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new v).parse(e)),
-e=b.iterateNext();break}}return this};z.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "mesh":this.mesh=(new A(this)).parse(c)}}return this};A.prototype.parse=function(b){function e(b,c){var f=ea(b.position);h[f]===void 0&&(h[f]={v:b,index:c});return h[f]}this.primitives=[];var c;for(c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];switch(f.nodeName){case "source":da(f);break;case "vertices":this.vertices=
-(new G).parse(f);break;case "triangles":this.primitives.push((new E).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new F).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=ia[this.vertices.input.POSITION.source].data;for(b=c=0;c<f.length;c+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[c],f[c+1],f[c+2]));e(k,b);this.geometry3js.vertices.push(k)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),
+e=b.iterateNext();break}}return this};z.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "mesh":this.mesh=(new A(this)).parse(c)}}return this};A.prototype.parse=function(b){function e(b,c){var f=fa(b.position);h[f]===void 0&&(h[f]={v:b,index:c});return h[f]}this.primitives=[];var c;for(c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];switch(f.nodeName){case "source":ea(f);break;case "vertices":this.vertices=
+(new G).parse(f);break;case "triangles":this.primitives.push((new E).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new F).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=ja[this.vertices.input.POSITION.source].data;for(b=c=0;c<f.length;c+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[c],f[c+1],f[c+2]));e(k,b);this.geometry3js.vertices.push(k)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),
 this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};A.prototype.handlePrimitive=function(b,e,c){var f=0,h,k,m=b.p,n=b.inputs,o,t,p,v=0,u=3,w=[];for(h=0;h<n.length;h++)switch(o=n[h],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(u=b.vcount[v++]);for(h=0;h<u;h++)for(k=0;k<n.length;k++)switch(o=
 this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};A.prototype.handlePrimitive=function(b,e,c){var f=0,h,k,m=b.p,n=b.inputs,o,t,p,v=0,u=3,w=[];for(h=0;h<n.length;h++)switch(o=n[h],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(u=b.vcount[v++]);for(h=0;h<u;h++)for(k=0;k<n.length;k++)switch(o=
-n[k],source=ia[o.source],t=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,p=t*numParams,o.semantic){case "VERTEX":o=ea(e.vertices[t].position);x.push(c[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[p],source.data[p+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var B;u==
+n[k],source=ja[o.source],t=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,p=t*numParams,o.semantic){case "VERTEX":o=fa(e.vertices[t].position);x.push(c[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[p],source.data[p+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var B;u==
 3?B=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],A.length?A:new THREE.Color):u==4&&(B=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],A.length?A:new THREE.Color));B.daeMaterial=b.material;e.faces.push(B);for(k=0;k<w.length;k++)h=z[w[k]],e.faceVertexUvs[k].push([h[0],h[1],h[2]]);f+=n.length*u}};F.prototype=new E;F.prototype.constructor=F;E.prototype.setVertices=function(b){for(var e=0;e<this.inputs.length;e++)if(this.inputs[e].source==b.id)this.inputs[e].source=b.input.POSITION.source};
 3?B=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],A.length?A:new THREE.Color):u==4&&(B=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],A.length?A:new THREE.Color));B.daeMaterial=b.material;e.faces.push(B);for(k=0;k<w.length;k++)h=z[w[k]],e.faceVertexUvs[k].push([h[0],h[1],h[2]]);f+=n.length*u}};F.prototype=new E;F.prototype.constructor=F;E.prototype.setVertices=function(b){for(var e=0;e<this.inputs.length;e++)if(this.inputs[e].source==b.id)this.inputs[e].source=b.input.POSITION.source};
-E.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=aa(b,"count",0);for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "input":this.inputs.push((new L).parse(b.childNodes[e]));break;case "vcount":this.vcount=ha(c.textContent);break;case "p":this.p=ha(c.textContent)}}return this};D.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=aa(b,"count",0);this.stride=aa(b,"stride",0);for(var e=
+E.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=ca(b,"count",0);for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "input":this.inputs.push((new L).parse(b.childNodes[e]));break;case "vcount":this.vcount=$(c.textContent);break;case "p":this.p=$(c.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 e=
 0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="param"){var f={};f.name=c.getAttribute("name");f.type=c.getAttribute("type");this.params.push(f)}}return this};G.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++)b.childNodes[e].nodeName=="input"&&(input=(new L).parse(b.childNodes[e]),this.input[input.semantic]=input);return this};L.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,
 0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="param"){var f={};f.name=c.getAttribute("name");f.type=c.getAttribute("type");this.params.push(f)}}return this};G.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++)b.childNodes[e].nodeName=="input"&&(input=(new L).parse(b.childNodes[e]),this.input[input.semantic]=input);return this};L.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,
-"");this.set=aa(b,"set",-1);this.offset=aa(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};M.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "bool_array":for(var f=ka(c.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=c.nodeName;break;case "float_array":this.data=la(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
-ha(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ka(c.textContent);this.type=c.nodeName;break;case "technique_common":for(f=0;f<c.childNodes.length;f++)if(c.childNodes[f].nodeName=="accessor"){this.accessor=(new D).parse(c.childNodes[f]);break}}}return this};M.prototype.read=function(){var b=[],e=this.accessor.params[0];switch(e.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(e=0;e<this.data.length;e+=16){var c=
+"");this.set=ca(b,"set",-1);this.offset=ca(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};M.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "bool_array":for(var f=la(c.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=c.nodeName;break;case "float_array":this.data=pa(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
+$(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=la(c.textContent);this.type=c.nodeName;break;case "technique_common":for(f=0;f<c.childNodes.length;f++)if(c.childNodes[f].nodeName=="accessor"){this.accessor=(new D).parse(c.childNodes[f]);break}}}return this};M.prototype.read=function(){var b=[],e=this.accessor.params[0];switch(e.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(e=0;e<this.data.length;e+=16){var c=
 this.data.slice(e,e+16),f=new THREE.Matrix4;f.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+e.type)}return b};J.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="instance_effect"){this.instance_effect=(new Q).parse(b.childNodes[e]);break}return this};B.prototype.isColor=
 this.data.slice(e,e+16),f=new THREE.Matrix4;f.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+e.type)}return b};J.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="instance_effect"){this.instance_effect=(new Q).parse(b.childNodes[e]);break}return this};B.prototype.isColor=
-function(){return this.texture==null};B.prototype.isTexture=function(){return this.texture!=null};B.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "color":c=la(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};K.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=
+function(){return this.texture==null};B.prototype.isTexture=function(){return this.texture!=null};B.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "color":c=pa(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};K.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=
 b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new B).parse(c);break;case "shininess":case "reflectivity":case "transparency":var f;f=Z.evaluate(".//dae:float",c,T,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[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};K.prototype.create=function(){var b=
 b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new B).parse(c);break;case "shininess":case "reflectivity":case "transparency":var f;f=Z.evaluate(".//dae:float",c,T,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[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};K.prototype.create=function(){var b=
 {},e=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var f=this[c];if(f instanceof B)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ra[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 c=="diffuse"?b.color=
 {},e=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var f=this[c];if(f instanceof B)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ra[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 c=="diffuse"?b.color=
-f.color.getHex():e||(b[c]=f.color.getHex());break;case "shininess":case "reflectivity":b[c]=this[c];break;case "transparency":if(e)b.transparent=!0,b.opacity=this[c],e=!0}b.shading=Fa;return this.material=new THREE.MeshLambertMaterial(b)};ca.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+
+f.color.getHex():e||(b[c]=f.color.getHex());break;case "shininess":case "reflectivity":b[c]=this[c];break;case "transparency":if(e)b.transparent=!0,b.opacity=this[c],e=!0}b.shading=Fa;return this.material=new THREE.MeshLambertMaterial(b)};da.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+
 c.nodeName)}}return this};I.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};
 c.nodeName)}}return this};I.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};
 P.prototype.create=function(){if(this.shader==null)return null};P.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=null;for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};P.prototype.parseNewparam=function(b){for(var e=b.getAttribute("sid"),c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=
 P.prototype.create=function(){if(this.shader==null)return null};P.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=null;for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};P.prototype.parseNewparam=function(b){for(var e=b.getAttribute("sid"),c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=
-(new ca(this)).parse(f);this.surface.sid=e;break;case "sampler2D":this.sampler=(new I(this)).parse(f);this.sampler.sid=e;break;case "extra":break;default:console.log(f.nodeName)}}};P.prototype.parseProfileCOMMON=function(b){for(var e,c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":e=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return e};
+(new da(this)).parse(f);this.surface.sid=e;break;case "sampler2D":this.sampler=(new I(this)).parse(f);this.sampler.sid=e;break;case "extra":break;default:console.log(f.nodeName)}}};P.prototype.parseProfileCOMMON=function(b){for(var e,c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":e=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return e};
 P.prototype.parseTechnique=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new K(c.nodeName,this)).parse(c)}}};Q.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};S.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "source":c=
 P.prototype.parseTechnique=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new K(c.nodeName,this)).parse(c)}}};Q.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};S.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "source":c=
 (new M).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new o(this)).parse(c));break;case "channel":this.channel.push((new W(this)).parse(c))}}return this};W.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var e=this.target.split("/");e.shift();var b=e.shift(),c=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(c)e=b.split("."),b=e.shift(),k=e.shift();else if(f){h=b.split("(");b=h.shift();for(e=0;e<h.length;e++)h[e]=
 (new M).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new o(this)).parse(c));break;case "channel":this.channel.push((new W(this)).parse(c))}}return this};W.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var e=this.target.split("/");e.shift();var b=e.shift(),c=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(c)e=b.split("."),b=e.shift(),k=e.shift();else if(f){h=b.split("(");b=h.shift();for(e=0;e<h.length;e++)h[e]=
 parseInt(h[e].replace(/\)/,""))}this.sid=b;this.dotSyntax=c;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 e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new L).parse(c))}}return this};o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var e=this.inputs[b],c=this.animation.source[e.source];switch(e.semantic){case "INPUT":this.input=
 parseInt(h[e].replace(/\)/,""))}this.sid=b;this.dotSyntax=c;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 e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new L).parse(c))}}return this};o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var e=this.inputs[b],c=this.animation.source[e.source];switch(e.semantic){case "INPUT":this.input=
 c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(e.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&&
 c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(e.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)){fa=f;var o,p=e;Z=n.responseXML;o=fa;p!==void 0&&(p=p.split("/"),p.pop(),Ea=p.join("/")+"/");ra=b("//dae:library_images/dae:image",k,"image");qa=b("//dae:library_materials/dae:material",
-J,"material");ua=b("//dae:library_effects/dae:effect",P,"effect");oa=b("//dae:library_geometries/dae:geometry",z,"geometry");O=b("//dae:library_controllers/dae:controller",m,"controller");na=b("//dae:library_animations/dae:animation",S,"animation");ta=b(".//dae:library_visual_scenes/dae:visual_scene",t,"visual_scene");Aa=[];Ca=[];(p=Z.evaluate(".//dae:scene/dae:instance_visual_scene",Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),Y=ta[p]):
-Y=null;$=new THREE.Object3D;for(p=0;p<Y.nodes.length;p++)$.add(h(Y.nodes[p]));c();for(var u in na);u={scene:$,morphs:Aa,skins:Ca,dae:{images:ra,materials:qa,effects:ua,geometries:oa,controllers:O,animations:na,visualScenes:ta,scene:Y}};o&&o(u)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Fa=b},applySkin:f,geometries:oa}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
+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,p=e;Z=n.responseXML;o=ga;p!==void 0&&(p=p.split("/"),p.pop(),Ea=p.join("/")+"/");ra=b("//dae:library_images/dae:image",k,"image");qa=b("//dae:library_materials/dae:material",
+J,"material");ua=b("//dae:library_effects/dae:effect",P,"effect");na=b("//dae:library_geometries/dae:geometry",z,"geometry");O=b("//dae:library_controllers/dae:controller",m,"controller");ma=b("//dae:library_animations/dae:animation",S,"animation");ta=b(".//dae:library_visual_scenes/dae:visual_scene",t,"visual_scene");Ba=[];Da=[];(p=Z.evaluate(".//dae:scene/dae:instance_visual_scene",Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),Y=ta[p]):
+Y=null;aa=new THREE.Object3D;for(p=0;p<Y.nodes.length;p++)aa.add(h(Y.nodes[p]));c();for(var u in ma);u={scene:aa,morphs:Ba,skins:Da,dae:{images:ra,materials:qa,effects:ua,geometries:na,controllers:O,animations:ma,visualScenes:ta,scene:Y}};o&&o(u)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Fa=b},applySkin:f,geometries:na}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
 THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,h=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,h);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
 THREE.JSONLoader.prototype.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(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,h,p,t,w,u,x,v,y,z,A,F,E,D,G=b.faces;u=b.vertices;var L=b.normals,M=b.colors,J=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&J++;for(c=0;c<J;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];t=0;for(w=u.length;t<w;)x=new THREE.Vertex,x.position.x=u[t++]*e,x.position.y=
 THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,h,p,t,w,u,x,v,y,z,A,F,E,D,G=b.faces;u=b.vertices;var L=b.normals,M=b.colors,J=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&J++;for(c=0;c<J;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];t=0;for(w=u.length;t<w;)x=new THREE.Vertex,x.position.x=u[t++]*e,x.position.y=
 u[t++]*e,x.position.z=u[t++]*e,f.vertices.push(x);t=0;for(w=G.length;t<w;){e=G[t++];u=e&1;p=e&2;c=e&4;h=e&8;v=e&16;x=e&32;z=e&64;e&=128;u?(A=new THREE.Face4,A.a=G[t++],A.b=G[t++],A.c=G[t++],A.d=G[t++],u=4):(A=new THREE.Face3,A.a=G[t++],A.b=G[t++],A.c=G[t++],u=3);if(p)p=G[t++],A.materials=f.materials[p];p=f.faces.length;if(c)for(c=0;c<J;c++)F=b.uvs[c],y=G[t++],D=F[y*2],y=F[y*2+1],f.faceUvs[c][p]=new THREE.UV(D,y);if(h)for(c=0;c<J;c++){F=b.uvs[c];E=[];for(h=0;h<u;h++)y=G[t++],D=F[y*2],y=F[y*2+1],E[h]=
 u[t++]*e,x.position.z=u[t++]*e,f.vertices.push(x);t=0;for(w=G.length;t<w;){e=G[t++];u=e&1;p=e&2;c=e&4;h=e&8;v=e&16;x=e&32;z=e&64;e&=128;u?(A=new THREE.Face4,A.a=G[t++],A.b=G[t++],A.c=G[t++],A.d=G[t++],u=4):(A=new THREE.Face3,A.a=G[t++],A.b=G[t++],A.c=G[t++],u=3);if(p)p=G[t++],A.materials=f.materials[p];p=f.faces.length;if(c)for(c=0;c<J;c++)F=b.uvs[c],y=G[t++],D=F[y*2],y=F[y*2+1],f.faceUvs[c][p]=new THREE.UV(D,y);if(h)for(c=0;c<J;c++){F=b.uvs[c];E=[];for(h=0;h<u;h++)y=G[t++],D=F[y*2],y=F[y*2+1],E[h]=
@@ -618,18 +619,18 @@ new THREE.UV(D,y);f.faceVertexUvs[c][p]=E}if(v)v=G[t++]*3,h=new THREE.Vector3,h.
 p,0,0))}if(b.skinIndices){e=0;for(c=b.skinIndices.length;e<c;e+=2)h=b.skinIndices[e],p=b.skinIndices[e+1],f.skinIndices.push(new THREE.Vector4(h,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(e){if(b.morphTargets!==void 0){var c,h,p,t,w,u,x,v,y;c=0;for(h=b.morphTargets.length;c<h;c++){f.morphTargets[c]={};f.morphTargets[c].name=b.morphTargets[c].name;f.morphTargets[c].vertices=[];v=f.morphTargets[c].vertices;y=b.morphTargets[c].vertices;p=0;for(t=y.length;p<t;p+=3)w=y[p]*e,u=y[p+1]*
 p,0,0))}if(b.skinIndices){e=0;for(c=b.skinIndices.length;e<c;e+=2)h=b.skinIndices[e],p=b.skinIndices[e+1],f.skinIndices.push(new THREE.Vector4(h,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(e){if(b.morphTargets!==void 0){var c,h,p,t,w,u,x,v,y;c=0;for(h=b.morphTargets.length;c<h;c++){f.morphTargets[c]={};f.morphTargets[c].name=b.morphTargets[c].name;f.morphTargets[c].vertices=[];v=f.morphTargets[c].vertices;y=b.morphTargets[c].vertices;p=0;for(t=y.length;p<t;p+=3)w=y[p]*e,u=y[p+1]*
 e,x=y[p+2]*e,v.push(new THREE.Vertex(new THREE.Vector3(w,u,x)))}}if(b.morphColors!==void 0){c=0;for(h=b.morphColors.length;c<h;c++){f.morphColors[c]={};f.morphColors[c].name=b.morphColors[c].name;f.morphColors[c].colors=[];t=f.morphColors[c].colors;w=b.morphColors[c].colors;e=0;for(p=w.length;e<p;e+=3)u=new THREE.Color(16755200),u.setRGB(w[e],w[e+1],w[e+2]),t.push(u)}}})(h);f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};
 e,x=y[p+2]*e,v.push(new THREE.Vertex(new THREE.Vector3(w,u,x)))}}if(b.morphColors!==void 0){c=0;for(h=b.morphColors.length;c<h;c++){f.morphColors[c]={};f.morphColors[c].name=b.morphColors[c].name;f.morphColors[c].colors=[];t=f.morphColors[c].colors;w=b.morphColors[c].colors;e=0;for(p=w.length;e<p;e+=3)u=new THREE.Color(16755200),u.setRGB(w[e],w[e+1],w[e+2]),t.push(u)}}})(h);f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,e){return e=="relativeToHTML"?b:h+"/"+b}function n(){for(v in P.objects)if(!T.objects[v])if(E=P.objects[v],E.geometry!==void 0){if(M=T.geometries[E.geometry]){var b=!1;ca=[];for(ha=0;ha<E.materials.length;ha++)ca[ha]=T.materials[E.materials[ha]],b=ca[ha]instanceof THREE.ShaderMaterial;b&&M.computeTangents();D=E.position;r=E.rotation;
-q=E.quaternion;s=E.scale;q=0;ca.length==0&&(ca[0]=new THREE.MeshFaceMaterial);ca.length>1&&(ca=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,ca);object.name=v;object.position.set(D[0],D[1],D[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=E.visible;T.scene.add(object);T.objects[v]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),T.scene.collisions.colliders.push(b));
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,e){return e=="relativeToHTML"?b:h+"/"+b}function n(){for(v in P.objects)if(!T.objects[v])if(E=P.objects[v],E.geometry!==void 0){if(M=T.geometries[E.geometry]){var b=!1;da=[];for($=0;$<E.materials.length;$++)da[$]=T.materials[E.materials[$]],b=da[$]instanceof THREE.ShaderMaterial;b&&M.computeTangents();D=E.position;r=E.rotation;
+q=E.quaternion;s=E.scale;q=0;da.length==0&&(da[0]=new THREE.MeshFaceMaterial);da.length>1&&(da=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,da);object.name=v;object.position.set(D[0],D[1],D[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=E.visible;T.scene.add(object);T.objects[v]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),T.scene.collisions.colliders.push(b));
 if(E.castsShadow)b=new THREE.ShadowVolume(M),T.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}}else D=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(D[0],D[1],D[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
 if(E.castsShadow)b=new THREE.ShadowVolume(M),T.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}}else D=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(D[0],D[1],D[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=E.visible!==void 0?E.visible:!1,T.scene.add(object),T.objects[v]=object,T.empties[v]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}function p(b){return function(c){T.geometries[b]=c;n();S-=1;e.onLoadComplete();w()}}function t(b){return function(e){T.geometries[b]=e}}function w(){e.callbackProgress({totalModels:o,totalTextures:da,loadedModels:o-S,loadedTextures:da-W},T);e.onLoadProgress();S==0&&W==0&&c(T)}var u,
-x,v,y,z,A,F,E,D,G,L,M,J,B,K,ca,I,P,Q,S,W,o,da,T;P=b.data;K=new THREE.BinaryLoader;Q=new THREE.JSONLoader;W=S=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in P.objects)if(E=P.objects[v],E.meshCollider){b=!0;break}if(b)T.scene.collisions=new THREE.CollisionSystem;if(P.transform){b=P.transform.position;G=P.transform.rotation;var la=P.transform.scale;b&&T.scene.position.set(b[0],b[1],b[2]);G&&T.scene.rotation.set(G[0],
-G[1],G[2]);la&&T.scene.scale.set(la[0],la[1],la[2]);(b||G||la)&&T.scene.updateMatrix()}b=function(){W-=1;w();e.onLoadComplete()};for(z in P.cameras)G=P.cameras[z],G.type=="perspective"?J=new THREE.PerspectiveCamera(G.fov,G.aspect,G.near,G.far):G.type=="ortho"&&(J=new THREE.OrthographicCamera(G.left,G.right,G.top,G.bottom,G.near,G.far)),D=G.position,G=G.target,J.position.set(D[0],D[1],D[2]),J.target=new THREE.Vector3(G[0],G[1],G[2]),T.cameras[z]=J;for(y in P.lights)z=P.lights[y],J=z.color!==void 0?
+s[1],s[2]),object.visible=E.visible!==void 0?E.visible:!1,T.scene.add(object),T.objects[v]=object,T.empties[v]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}function p(b){return function(c){T.geometries[b]=c;n();S-=1;e.onLoadComplete();w()}}function t(b){return function(e){T.geometries[b]=e}}function w(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-S,loadedTextures:ea-W},T);e.onLoadProgress();S==0&&W==0&&c(T)}var u,
+x,v,y,z,A,F,E,D,G,L,M,J,B,K,da,I,P,Q,S,W,o,ea,T;P=b.data;K=new THREE.BinaryLoader;Q=new THREE.JSONLoader;W=S=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in P.objects)if(E=P.objects[v],E.meshCollider){b=!0;break}if(b)T.scene.collisions=new THREE.CollisionSystem;if(P.transform){b=P.transform.position;G=P.transform.rotation;var pa=P.transform.scale;b&&T.scene.position.set(b[0],b[1],b[2]);G&&T.scene.rotation.set(G[0],
+G[1],G[2]);pa&&T.scene.scale.set(pa[0],pa[1],pa[2]);(b||G||pa)&&T.scene.updateMatrix()}b=function(){W-=1;w();e.onLoadComplete()};for(z in P.cameras)G=P.cameras[z],G.type=="perspective"?J=new THREE.PerspectiveCamera(G.fov,G.aspect,G.near,G.far):G.type=="ortho"&&(J=new THREE.OrthographicCamera(G.left,G.right,G.top,G.bottom,G.near,G.far)),D=G.position,G=G.target,J.position.set(D[0],D[1],D[2]),J.target=new THREE.Vector3(G[0],G[1],G[2]),T.cameras[z]=J;for(y in P.lights)z=P.lights[y],J=z.color!==void 0?
 z.color:16777215,G=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(D=z.direction,I=new THREE.DirectionalLight(J,G),I.position.set(D[0],D[1],D[2]),I.position.normalize()):z.type=="point"?(D=z.position,d=z.distance,I=new THREE.PointLight(J,G,d),I.position.set(D[0],D[1],D[2])):z.type=="ambient"&&(I=new THREE.AmbientLight(J)),T.scene.add(I),T.lights[y]=I;for(A in P.fogs)y=P.fogs[A],y.type=="linear"?B=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(B=new THREE.FogExp2(0,y.density)),G=y.color,
 z.color:16777215,G=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(D=z.direction,I=new THREE.DirectionalLight(J,G),I.position.set(D[0],D[1],D[2]),I.position.normalize()):z.type=="point"?(D=z.position,d=z.distance,I=new THREE.PointLight(J,G,d),I.position.set(D[0],D[1],D[2])):z.type=="ambient"&&(I=new THREE.AmbientLight(J)),T.scene.add(I),T.lights[y]=I;for(A in P.fogs)y=P.fogs[A],y.type=="linear"?B=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(B=new THREE.FogExp2(0,y.density)),G=y.color,
 B.color.setRGB(G[0],G[1],G[2]),T.fogs[A]=B;if(T.cameras&&P.defaults.camera)T.currentCamera=T.cameras[P.defaults.camera];if(T.fogs&&P.defaults.fog)T.scene.fog=T.fogs[P.defaults.fog];G=P.defaults.bgcolor;T.bgColor=new THREE.Color;T.bgColor.setRGB(G[0],G[1],G[2]);T.bgColorAlpha=P.defaults.bgalpha;for(u in P.geometries)if(A=P.geometries[u],A.type=="bin_mesh"||A.type=="ascii_mesh")S+=1,e.onLoadStart();o=S;for(u in P.geometries)A=P.geometries[u],A.type=="cube"?(M=new THREE.CubeGeometry(A.width,A.height,
 B.color.setRGB(G[0],G[1],G[2]),T.fogs[A]=B;if(T.cameras&&P.defaults.camera)T.currentCamera=T.cameras[P.defaults.camera];if(T.fogs&&P.defaults.fog)T.scene.fog=T.fogs[P.defaults.fog];G=P.defaults.bgcolor;T.bgColor=new THREE.Color;T.bgColor.setRGB(G[0],G[1],G[2]);T.bgColorAlpha=P.defaults.bgalpha;for(u in P.geometries)if(A=P.geometries[u],A.type=="bin_mesh"||A.type=="ascii_mesh")S+=1,e.onLoadStart();o=S;for(u in P.geometries)A=P.geometries[u],A.type=="cube"?(M=new THREE.CubeGeometry(A.width,A.height,
 A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),T.geometries[u]=M):A.type=="plane"?(M=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),T.geometries[u]=M):A.type=="sphere"?(M=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),T.geometries[u]=M):A.type=="cylinder"?(M=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),T.geometries[u]=M):A.type=="torus"?(M=new THREE.TorusGeometry(A.radius,A.tube,A.segmentsR,
 A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),T.geometries[u]=M):A.type=="plane"?(M=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),T.geometries[u]=M):A.type=="sphere"?(M=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),T.geometries[u]=M):A.type=="cylinder"?(M=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),T.geometries[u]=M):A.type=="torus"?(M=new THREE.TorusGeometry(A.radius,A.tube,A.segmentsR,
-A.segmentsT),T.geometries[u]=M):A.type=="icosahedron"?(M=new THREE.IcosahedronGeometry(A.subdivisions),T.geometries[u]=M):A.type=="bin_mesh"?K.load({model:f(A.url,P.urlBaseType),callback:p(u)}):A.type=="ascii_mesh"?Q.load({model:f(A.url,P.urlBaseType),callback:p(u)}):A.type=="embedded_mesh"&&(A=P.embeds[A.id])&&Q.createModel(A,t(u),"");for(F in P.textures)if(u=P.textures[F],u.url instanceof Array){W+=u.url.length;for(K=0;K<u.url.length;K++)e.onLoadStart()}else W+=1,e.onLoadStart();da=W;for(F in P.textures){u=
-P.textures[F];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){K=[];for(var ha=0;ha<u.url.length;ha++)K[ha]=f(u.url[ha],P.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,u.mapping,b)}else{K=THREE.ImageUtils.loadTexture(f(u.url,P.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)K.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)K.magFilter=THREE[u.magFilter];if(u.repeat){K.repeat.set(u.repeat[0],u.repeat[1]);if(u.repeat[0]!=
-1)K.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}u.offset&&K.offset.set(u.offset[0],u.offset[1]);if(u.wrap){Q={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Q[u.wrap[0]]!==void 0)K.wrapS=Q[u.wrap[0]];if(Q[u.wrap[1]]!==void 0)K.wrapT=Q[u.wrap[1]]}}T.textures[F]=K}for(x in P.materials){F=P.materials[x];for(L in F.parameters)if(L=="envMap"||L=="map"||L=="lightMap")F.parameters[L]=T.textures[F.parameters[L]];else if(L=="shading")F.parameters[L]=F.parameters[L]==
+A.segmentsT),T.geometries[u]=M):A.type=="icosahedron"?(M=new THREE.IcosahedronGeometry(A.subdivisions),T.geometries[u]=M):A.type=="bin_mesh"?K.load({model:f(A.url,P.urlBaseType),callback:p(u)}):A.type=="ascii_mesh"?Q.load({model:f(A.url,P.urlBaseType),callback:p(u)}):A.type=="embedded_mesh"&&(A=P.embeds[A.id])&&Q.createModel(A,t(u),"");for(F in P.textures)if(u=P.textures[F],u.url instanceof Array){W+=u.url.length;for(K=0;K<u.url.length;K++)e.onLoadStart()}else W+=1,e.onLoadStart();ea=W;for(F in P.textures){u=
+P.textures[F];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){K=[];for(var $=0;$<u.url.length;$++)K[$]=f(u.url[$],P.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,u.mapping,b)}else{K=THREE.ImageUtils.loadTexture(f(u.url,P.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)K.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)K.magFilter=THREE[u.magFilter];if(u.repeat){K.repeat.set(u.repeat[0],u.repeat[1]);if(u.repeat[0]!=1)K.wrapS=
+THREE.RepeatWrapping;if(u.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}u.offset&&K.offset.set(u.offset[0],u.offset[1]);if(u.wrap){Q={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Q[u.wrap[0]]!==void 0)K.wrapS=Q[u.wrap[0]];if(Q[u.wrap[1]]!==void 0)K.wrapT=Q[u.wrap[1]]}}T.textures[F]=K}for(x in P.materials){F=P.materials[x];for(L in F.parameters)if(L=="envMap"||L=="map"||L=="lightMap")F.parameters[L]=T.textures[F.parameters[L]];else if(L=="shading")F.parameters[L]=F.parameters[L]==
 "flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")F.parameters[L]=THREE[F.parameters[L]]?THREE[F.parameters[L]]:THREE.NormalBlending;else if(L=="combine")F.parameters[L]=F.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(F.parameters[L]=="face")F.parameters[L]=THREE.FaceColors;else if(F.parameters[L])F.parameters[L]=THREE.VertexColors;if(F.parameters.opacity!==void 0&&F.parameters.opacity<1)F.parameters.transparent=!0;if(F.parameters.normalMap){u=
 "flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")F.parameters[L]=THREE[F.parameters[L]]?THREE[F.parameters[L]]:THREE.NormalBlending;else if(L=="combine")F.parameters[L]=F.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(F.parameters[L]=="face")F.parameters[L]=THREE.FaceColors;else if(F.parameters[L])F.parameters[L]=THREE.VertexColors;if(F.parameters.opacity!==void 0&&F.parameters.opacity<1)F.parameters.transparent=!0;if(F.parameters.normalMap){u=
 THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);K=F.parameters.color;Q=F.parameters.specular;A=F.parameters.ambient;B=F.parameters.shininess;b.tNormal.texture=T.textures[F.parameters.normalMap];if(F.parameters.normalMapFactor)b.uNormalScale.value=F.parameters.normalMapFactor;if(F.parameters.map)b.tDiffuse.texture=F.parameters.map,b.enableDiffuse.value=!0;if(F.parameters.lightMap)b.tAO.texture=F.parameters.lightMap,b.enableAO.value=!0;if(F.parameters.specularMap)b.tSpecular.texture=
 THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);K=F.parameters.color;Q=F.parameters.specular;A=F.parameters.ambient;B=F.parameters.shininess;b.tNormal.texture=T.textures[F.parameters.normalMap];if(F.parameters.normalMapFactor)b.uNormalScale.value=F.parameters.normalMapFactor;if(F.parameters.map)b.tDiffuse.texture=F.parameters.map,b.enableDiffuse.value=!0;if(F.parameters.lightMap)b.tAO.texture=F.parameters.lightMap,b.enableAO.value=!0;if(F.parameters.specularMap)b.tSpecular.texture=
 T.textures[F.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(K);b.uSpecularColor.value.setHex(Q);b.uAmbientColor.value.setHex(A);b.uShininess.value=B;if(F.parameters.opacity)b.uOpacity.value=F.parameters.opacity;F=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else F=new THREE[F.type](F.parameters);T.materials[x]=F}n();e.callbackSync(T)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
 T.textures[F.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(K);b.uSpecularColor.value.setHex(Q);b.uAmbientColor.value.setHex(A);b.uShininess.value=B;if(F.parameters.opacity)b.uOpacity.value=F.parameters.opacity;F=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else F=new THREE[F.type](F.parameters);T.materials[x]=F}n();e.callbackSync(T)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
@@ -637,7 +638,7 @@ THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.const
 THREE.UTF8Loader.prototype.load=function(b){var c=new XMLHttpRequest,e=b.model,f=b.callback,h=b.scale!==void 0?b.scale:1,k=b.offsetX!==void 0?b.offsetX:0,m=b.offsetY!==void 0?b.offsetY:0,n=b.offsetZ!==void 0?b.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,f,h,k,m,n):alert("Couldn't load ["+e+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",e,!0);c.send(null)};
 THREE.UTF8Loader.prototype.load=function(b){var c=new XMLHttpRequest,e=b.model,f=b.callback,h=b.scale!==void 0?b.scale:1,k=b.offsetX!==void 0?b.offsetX:0,m=b.offsetY!==void 0?b.offsetY:0,n=b.offsetZ!==void 0?b.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,f,h,k,m,n):alert("Couldn't load ["+e+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",e,!0);c.send(null)};
 THREE.UTF8Loader.prototype.decompressMesh=function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var k=0,m=0;m<c;++m){var n=b.charCodeAt(m+f);k+=n>>1^-(n&1);e[8*m+h]=k}f+=c}c=b.length-f;k=new Uint16Array(c);for(h=m=0;h<c;h++)n=b.charCodeAt(h+f),k[h]=m-n,n==0&&m++;return[e,k]};
 THREE.UTF8Loader.prototype.decompressMesh=function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var k=0,m=0;m<c;++m){var n=b.charCodeAt(m+f);k+=n>>1^-(n&1);e[8*m+h]=k}f+=c}c=b.length-f;k=new Uint16Array(c);for(h=m=0;h<c;h++)n=b.charCodeAt(h+f),k[h]=m-n,n==0&&m++;return[e,k]};
 THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,k){var m=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var m=THREE.UTF8Loader.prototype.decompressMesh(b),t=[],w=[];(function(b,m,t){for(var p,w,A,F=b.length;t<F;t+=m)p=b[t],w=b[t+1],A=b[t+2],p=p/16383*e,w=w/16383*e,A=A/16383*e,p+=f,w+=h,A+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(p,w,A)))})(m[0],8,0);(function(b,e,c){for(var f,h,k=b.length;c<k;c+=e)f=b[c],h=b[c+1],f/=1023,h/=1023,w.push(f,1-h)})(m[0],8,3);(function(b,
 THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,k){var m=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var m=THREE.UTF8Loader.prototype.decompressMesh(b),t=[],w=[];(function(b,m,t){for(var p,w,A,F=b.length;t<F;t+=m)p=b[t],w=b[t+1],A=b[t+2],p=p/16383*e,w=w/16383*e,A=A/16383*e,p+=f,w+=h,A+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(p,w,A)))})(m[0],8,0);(function(b,e,c){for(var f,h,k=b.length;c<k;c+=e)f=b[c],h=b[c+1],f/=1023,h/=1023,w.push(f,1-h)})(m[0],8,3);(function(b,
-e,c){for(var f,h,k,m=b.length;c<m;c+=e)f=b[c],h=b[c+1],k=b[c+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,t.push(f,h,k)})(m[0],8,5);(function(b){var e,f,h,k,m,p,E,D,G,L=b.length;for(e=0;e<L;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;D=f;G=h;p=k;E=f;var M=h,J=k,B=m.materials[0],K=t[M*3],ca=t[M*3+1],M=t[M*3+2],I=t[J*3],P=t[J*3+1],J=t[J*3+2];E=new THREE.Vector3(t[E*3],t[E*3+1],t[E*3+2]);M=new THREE.Vector3(K,ca,M);J=new THREE.Vector3(I,P,J);m.faces.push(new THREE.Face3(D,G,p,[E,M,J],null,B));m=w[f*2];f=w[f*
+e,c){for(var f,h,k,m=b.length;c<m;c+=e)f=b[c],h=b[c+1],k=b[c+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,t.push(f,h,k)})(m[0],8,5);(function(b){var e,f,h,k,m,p,E,D,G,L=b.length;for(e=0;e<L;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;D=f;G=h;p=k;E=f;var M=h,J=k,B=m.materials[0],K=t[M*3],da=t[M*3+1],M=t[M*3+2],I=t[J*3],P=t[J*3+1],J=t[J*3+2];E=new THREE.Vector3(t[E*3],t[E*3+1],t[E*3+2]);M=new THREE.Vector3(K,da,M);J=new THREE.Vector3(I,P,J);m.faces.push(new THREE.Face3(D,G,p,[E,M,J],null,B));m=w[f*2];f=w[f*
 2+1];p=w[h*2];E=w[h*2+1];D=w[k*2];G=w[k*2+1];k=c.faceVertexUvs[0];h=p;p=E;E=[];E.push(new THREE.UV(m,f));E.push(new THREE.UV(h,p));E.push(new THREE.UV(D,G));k.push(E)}})(m[1]);this.computeCentroids();this.computeFaceNormals()};m.prototype=new THREE.Geometry;m.prototype.constructor=m;c(new m)};
 2+1];p=w[h*2];E=w[h*2+1];D=w[k*2];G=w[k*2+1];k=c.faceVertexUvs[0];h=p;p=E;E=[];E.push(new THREE.UV(m,f));E.push(new THREE.UV(h,p));E.push(new THREE.UV(D,G));k.push(E)}})(m[1]);this.computeCentroids();this.computeFaceNormals()};m.prototype=new THREE.Geometry;m.prototype.constructor=m;c(new m)};
 THREE.Axes=function(){THREE.Object3D.call(this);var b=new THREE.Geometry;b.vertices.push(new THREE.Vertex);b.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),e=new THREE.Line(b,new THREE.LineBasicMaterial({color:16711680}));e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));e.position.x=100;e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:65280}));this.add(e);
 THREE.Axes=function(){THREE.Object3D.call(this);var b=new THREE.Geometry;b.vertices.push(new THREE.Vertex);b.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),e=new THREE.Line(b,new THREE.LineBasicMaterial({color:16711680}));e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));e.position.x=100;e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:65280}));this.add(e);
 e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));e.position.y=100;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:255}));e.rotation.x=Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));e.position.z=100;e.rotation.x=Math.PI/2;this.add(e)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));e.position.y=100;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:255}));e.rotation.x=Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));e.position.z=100;e.rotation.x=Math.PI/2;this.add(e)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
@@ -645,9 +646,9 @@ THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c ins
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,h){return b+(c-b)*h};this.VIntX=function(b,c,h,k,m,n,p,t,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n+m*this.delta;c[k+1]=p;c[k+2]=t;h[k]=this.lerp(w[b],w[b+3],m);h[k+1]=this.lerp(w[b+1],w[b+4],m);h[k+2]=this.lerp(w[b+2],w[b+5],m)};this.VIntY=function(b,c,h,k,m,n,p,t,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n;c[k+1]=p+m*this.delta;c[k+
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,h){return b+(c-b)*h};this.VIntX=function(b,c,h,k,m,n,p,t,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n+m*this.delta;c[k+1]=p;c[k+2]=t;h[k]=this.lerp(w[b],w[b+3],m);h[k+1]=this.lerp(w[b+1],w[b+4],m);h[k+2]=this.lerp(w[b+2],w[b+5],m)};this.VIntY=function(b,c,h,k,m,n,p,t,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n;c[k+1]=p+m*this.delta;c[k+
 2]=t;c=b+this.yd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};this.VIntZ=function(b,c,h,k,m,n,p,t,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n;c[k+1]=p;c[k+2]=t+m*this.delta;c=b+this.zd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
 2]=t;c=b+this.yd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};this.VIntZ=function(b,c,h,k,m,n,p,t,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n;c[k+1]=p;c[k+2]=t+m*this.delta;c=b+this.zd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
 this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,k,m,n){var p=k+1,t=k+this.yd,w=k+this.zd,u=p+this.yd,x=p+this.zd,v=k+this.yd+this.zd,y=p+this.yd+this.zd,z=0,A=this.field[k],F=this.field[p],E=this.field[t],D=this.field[u],G=this.field[w],L=this.field[x],M=this.field[v],J=this.field[y];A<m&&(z|=1);F<m&&(z|=2);E<m&&(z|=8);D<m&&(z|=4);G<m&&(z|=16);L<m&&(z|=32);M<m&&(z|=128);J<m&&(z|=64);var B=THREE.edgeTable[z];if(B==0)return 0;var K=this.delta,
 this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,k,m,n){var p=k+1,t=k+this.yd,w=k+this.zd,u=p+this.yd,x=p+this.zd,v=k+this.yd+this.zd,y=p+this.yd+this.zd,z=0,A=this.field[k],F=this.field[p],E=this.field[t],D=this.field[u],G=this.field[w],L=this.field[x],M=this.field[v],J=this.field[y];A<m&&(z|=1);F<m&&(z|=2);E<m&&(z|=8);D<m&&(z|=4);G<m&&(z|=16);L<m&&(z|=32);M<m&&(z|=128);J<m&&(z|=64);var B=THREE.edgeTable[z];if(B==0)return 0;var K=this.delta,
-ca=b+K,I=c+K,K=h+K;B&1&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,A,F));B&2&&(this.compNorm(p),this.compNorm(u),this.VIntY(p*3,this.vlist,this.nlist,3,m,ca,c,h,F,D));B&4&&(this.compNorm(t),this.compNorm(u),this.VIntX(t*3,this.vlist,this.nlist,6,m,b,I,h,E,D));B&8&&(this.compNorm(k),this.compNorm(t),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,A,E));B&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,K,G,L));B&32&&(this.compNorm(x),
-this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,m,ca,c,K,L,J));B&64&&(this.compNorm(v),this.compNorm(y),this.VIntX(v*3,this.vlist,this.nlist,18,m,b,I,K,M,J));B&128&&(this.compNorm(w),this.compNorm(v),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,K,G,M));B&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,A,G));B&512&&(this.compNorm(p),this.compNorm(x),this.VIntZ(p*3,this.vlist,this.nlist,27,m,ca,c,h,F,L));B&1024&&(this.compNorm(u),this.compNorm(y),this.VIntZ(u*
-3,this.vlist,this.nlist,30,m,ca,I,h,D,J));B&2048&&(this.compNorm(t),this.compNorm(v),this.VIntZ(t*3,this.vlist,this.nlist,33,m,b,I,h,E,M));z<<=4;for(m=k=0;THREE.triTable[z+m]!=-1;)b=z+m,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),m+=3,k++;return k};this.posnormtriv=function(b,c,h,k,m,n){var p=this.count*3;this.positionArray[p]=b[h];this.positionArray[p+1]=b[h+1];this.positionArray[p+2]=b[h+2];this.positionArray[p+3]=b[k];this.positionArray[p+
+da=b+K,I=c+K,K=h+K;B&1&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,A,F));B&2&&(this.compNorm(p),this.compNorm(u),this.VIntY(p*3,this.vlist,this.nlist,3,m,da,c,h,F,D));B&4&&(this.compNorm(t),this.compNorm(u),this.VIntX(t*3,this.vlist,this.nlist,6,m,b,I,h,E,D));B&8&&(this.compNorm(k),this.compNorm(t),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,A,E));B&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,K,G,L));B&32&&(this.compNorm(x),
+this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,m,da,c,K,L,J));B&64&&(this.compNorm(v),this.compNorm(y),this.VIntX(v*3,this.vlist,this.nlist,18,m,b,I,K,M,J));B&128&&(this.compNorm(w),this.compNorm(v),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,K,G,M));B&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,A,G));B&512&&(this.compNorm(p),this.compNorm(x),this.VIntZ(p*3,this.vlist,this.nlist,27,m,da,c,h,F,L));B&1024&&(this.compNorm(u),this.compNorm(y),this.VIntZ(u*
+3,this.vlist,this.nlist,30,m,da,I,h,D,J));B&2048&&(this.compNorm(t),this.compNorm(v),this.VIntZ(t*3,this.vlist,this.nlist,33,m,b,I,h,E,M));z<<=4;for(m=k=0;THREE.triTable[z+m]!=-1;)b=z+m,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),m+=3,k++;return k};this.posnormtriv=function(b,c,h,k,m,n){var p=this.count*3;this.positionArray[p]=b[h];this.positionArray[p+1]=b[h+1];this.positionArray[p+2]=b[h+2];this.positionArray[p+3]=b[k];this.positionArray[p+
 4]=b[k+1];this.positionArray[p+5]=b[k+2];this.positionArray[p+6]=b[m];this.positionArray[p+7]=b[m+1];this.positionArray[p+8]=b[m+2];this.normalArray[p]=c[h];this.normalArray[p+1]=c[h+1];this.normalArray[p+2]=c[h+2];this.normalArray[p+3]=c[k];this.normalArray[p+4]=c[k+1];this.normalArray[p+5]=c[k+2];this.normalArray[p+6]=c[m];this.normalArray[p+7]=c[m+1];this.normalArray[p+8]=c[m+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&n(this)};this.begin=function(){this.count=0;
 4]=b[k+1];this.positionArray[p+5]=b[k+2];this.positionArray[p+6]=b[m];this.positionArray[p+7]=b[m+1];this.positionArray[p+8]=b[m+2];this.normalArray[p]=c[h];this.normalArray[p+1]=c[h+1];this.normalArray[p+2]=c[h+2];this.normalArray[p+3]=c[k];this.normalArray[p+4]=c[k+1];this.normalArray[p+5]=c[k+2];this.normalArray[p+6]=c[m];this.normalArray[p+7]=c[m+1];this.normalArray[p+8]=c[m+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&n(this)};this.begin=function(){this.count=0;
 this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,h,k,m){var n=this.size*Math.sqrt(k/m),p=h*this.size,t=c*this.size,w=b*this.size,u=Math.floor(p-n);u<1&&(u=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var x=Math.floor(t-n);x<1&&(x=1);t=Math.floor(t+n);t>this.size-1&&(t=this.size-1);var v=Math.floor(w-n);v<1&&(v=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size-
 this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,h,k,m){var n=this.size*Math.sqrt(k/m),p=h*this.size,t=c*this.size,w=b*this.size,u=Math.floor(p-n);u<1&&(u=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var x=Math.floor(t-n);x<1&&(x=1);t=Math.floor(t+n);t>this.size-1&&(t=this.size-1);var v=Math.floor(w-n);v<1&&(v=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size-
 1);for(var y,z,A,F,E,D;u<p;u++){w=this.size2*u;z=u/this.size-h;E=z*z;for(z=x;z<t;z++){A=w+this.size*z;y=z/this.size-c;D=y*y;for(y=v;y<n;y++)F=y/this.size-b,F=k/(1.0E-6+F*F+D+E)-m,F>0&&(this.field[A+y]+=F)}}};this.addPlaneX=function(b,c){var h,k,m,n,p,t=this.size,w=this.yd,u=this.zd,x=this.field,v=t*Math.sqrt(b/c);v>t&&(v=t);for(h=0;h<v;h++)if(k=h/t,k*=k,n=b/(1.0E-4+k)-c,n>0)for(k=0;k<t;k++){p=h+k*w;for(m=0;m<t;m++)x[u*m+p]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,p,t,w=this.size,u=this.yd,x=
 1);for(var y,z,A,F,E,D;u<p;u++){w=this.size2*u;z=u/this.size-h;E=z*z;for(z=x;z<t;z++){A=w+this.size*z;y=z/this.size-c;D=y*y;for(y=v;y<n;y++)F=y/this.size-b,F=k/(1.0E-6+F*F+D+E)-m,F>0&&(this.field[A+y]+=F)}}};this.addPlaneX=function(b,c){var h,k,m,n,p,t=this.size,w=this.yd,u=this.zd,x=this.field,v=t*Math.sqrt(b/c);v>t&&(v=t);for(h=0;h<v;h++)if(k=h/t,k*=k,n=b/(1.0E-4+k)-c,n>0)for(k=0;k<t;k++){p=h+k*w;for(m=0;m<t;m++)x[u*m+p]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,p,t,w=this.size,u=this.yd,x=

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -69,7 +69,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){t
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,k=l*c+g*f-h*d,o=l*d+h*c-e*f,i=l*f+e*d-g*c,c=-e*
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,k=l*c+g*f-h*d,o=l*d+h*c-e*f,i=l*f+e*d-g*c,c=-e*
-c-g*d-h*f;b.x=k*l+c*-e+o*-h-i*-g;b.y=o*l+c*-g+i*-e-k*-h;b.z=i*l+c*-h+k*-g-o*-e;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
+c-g*d-h*f;b.x=k*l+c*-e+o*-h-i*-g;b.y=o*l+c*-g+i*-e-k*-h;b.z=i*l+c*-h+k*-g-o*-e;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};

+ 1 - 1
build/custom/ThreeDOM.js

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

+ 4 - 4
build/custom/ThreeExtras.js

@@ -90,7 +90,7 @@ e,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFil
 new THREE.Vector3(0,0,-1));this.cameraPX.lookAt(this.cameraPXTarget);this.cameraNX.lookAt(this.cameraNXTarget);this.cameraPY.lookAt(this.cameraPYTarget);this.cameraNY.lookAt(this.cameraNYTarget);this.cameraPZ.lookAt(this.cameraPZTarget);this.cameraNZ.lookAt(this.cameraNZTarget)};this.updateCubeMap=function(a,b){var e=this.renderTarget;a.setFaceCulling("back","cw");b.scale.y=-1;b.position.y=2*this.height;b.updateMatrix();e.activeCubeFace=0;a.render(b,this.cameraPX,e);e.activeCubeFace=1;a.render(b,
 new THREE.Vector3(0,0,-1));this.cameraPX.lookAt(this.cameraPXTarget);this.cameraNX.lookAt(this.cameraNXTarget);this.cameraPY.lookAt(this.cameraPYTarget);this.cameraNY.lookAt(this.cameraNYTarget);this.cameraPZ.lookAt(this.cameraPZTarget);this.cameraNZ.lookAt(this.cameraNZTarget)};this.updateCubeMap=function(a,b){var e=this.renderTarget;a.setFaceCulling("back","cw");b.scale.y=-1;b.position.y=2*this.height;b.updateMatrix();e.activeCubeFace=0;a.render(b,this.cameraPX,e);e.activeCubeFace=1;a.render(b,
 this.cameraNX,e);b.scale.y=1;b.position.y=0;b.updateMatrix();b.scale.x=-1;b.updateMatrix();e.activeCubeFace=2;a.render(b,this.cameraPY,e);b.scale.x=1;b.updateMatrix();a.setFaceCulling("back","ccw");e.activeCubeFace=3;a.render(b,this.cameraNY,e);b.scale.x=-1;b.updateMatrix();a.setFaceCulling("back","cw");e.activeCubeFace=4;a.render(b,this.cameraPZ,e);e.activeCubeFace=5;a.render(b,this.cameraNZ,e);b.scale.x=1;b.updateMatrix();a.setFaceCulling("back","ccw")}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};
 this.cameraNX,e);b.scale.y=1;b.position.y=0;b.updateMatrix();b.scale.x=-1;b.updateMatrix();e.activeCubeFace=2;a.render(b,this.cameraPY,e);b.scale.x=1;b.updateMatrix();a.setFaceCulling("back","ccw");e.activeCubeFace=3;a.render(b,this.cameraNY,e);b.scale.x=-1;b.updateMatrix();a.setFaceCulling("back","cw");e.activeCubeFace=4;a.render(b,this.cameraPZ,e);e.activeCubeFace=5;a.render(b,this.cameraNZ,e);b.scale.x=1;b.updateMatrix();a.setFaceCulling("back","ccw")}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};
 THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};
 THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};
-THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.lastUpdate=(new Date).getTime();this.theta=this.phi=this.lon=this.lat=
+THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.lastUpdate=(new Date).getTime();this.theta=this.phi=this.lon=this.lat=
 this.mouseY=this.mouseX=this.autoSpeedFactor=this.tdiff=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();
 this.mouseY=this.mouseX=this.autoSpeedFactor=this.tdiff=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();
 if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=
 if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=
 a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
 a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
@@ -101,14 +101,14 @@ this.verticalMin)/(Math.PI-0)+this.verticalMin;a=this.target;c=this.object.posit
 b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
 b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
 THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,g=b.getControlPointsArray(),k=b.getLength(),p=g.length,z=0;h=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<p-1;h++)z=e*k.chunks[h]/k.total,b.keys[h]={time:z,pos:g[h]};f.hierarchy[0]=
 THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,g=b.getControlPointsArray(),k=b.getLength(),p=g.length,z=0;h=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<p-1;h++)z=e*k.chunks[h]/k.total,b.keys[h]={time:z,pos:g[h]};f.hierarchy[0]=
 b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var c,e,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var c,e,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
-new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
+new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,k=Math.PI/180;this.update=function(){var a,c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;a=this.phi%f;this.phi=a>=0?a:a+f;a=this.verticalAngleMap.srcRange;
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,k=Math.PI/180;this.update=function(){var a,c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;a=this.phi%f;this.phi=a>=0?a:a+f;a=this.verticalAngleMap.srcRange;
 c=this.verticalAngleMap.dstRange;var e=c[1]-c[0];this.phi=b(((this.phi-a[0])*(c[1]-c[0])/(a[1]-a[0])+c[0]-c[0])/e)*e+c[0];a=this.horizontalAngleMap.srcRange;c=this.horizontalAngleMap.dstRange;e=c[1]-c[0];this.theta=b(((this.theta-a[0])*(c[1]-c[0])/(a[1]-a[0])+c[0]-c[0])/e)*e+c[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(a){this.domElement===
 c=this.verticalAngleMap.dstRange;var e=c[1]-c[0];this.phi=b(((this.phi-a[0])*(c[1]-c[0])/(a[1]-a[0])+c[0]-c[0])/e)*e+c[0];a=this.horizontalAngleMap.srcRange;c=this.horizontalAngleMap.dstRange;e=c[1]-c[0];this.theta=b(((this.theta-a[0])*(c[1]-c[0])/(a[1]-a[0])+c[0]-c[0])/e)*e+c[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(a){this.domElement===
 document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 this.debugPath,b=this.spline,c=h(b,10),f=h(b,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,k);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);f=new THREE.SphereGeometry(1,16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)c=new THREE.Mesh(f,k),c.position.copy(b.points[i]),a.add(c)}this.domElement.addEventListener("mousemove",
 this.debugPath,b=this.spline,c=h(b,10),f=h(b,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,k);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);f=new THREE.SphereGeometry(1,16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)c=new THREE.Mesh(f,k),c.position.copy(b.points[i]),a.add(c)}this.domElement.addEventListener("mousemove",
 e(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
 e(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
+THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=
 1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=
 1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=
 0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
 0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
@@ -155,7 +155,7 @@ THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THRE
 THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=g.vertices[a].position,f=g.vertices[b].position;return c((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;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
 THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=g.vertices[a].position,f=g.vertices[b].position;return c((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;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
 -a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(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);b(h.faces[k].a,l,n,a);b(h.faces[k].b,m,
 -a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(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);b(h.faces[k].a,l,n,a);b(h.faces[k].b,m,
 l,a);b(h.faces[k].c,n,m,a);b(l,m,n,a)}h.faces=a.faces}g.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 l,a);b(h.faces[k].c,n,m,a);b(l,m,n,a)}h.faces=a.faces}g.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],g=[],h=[],f=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var l=0;l<=this.angle+0.001;l+=c){for(k=0;k<b.length;k++)l<this.angle?(b[k]=f.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),g[k]=this.vertices.length-1):g=h;l==0&&(h=e);
+THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],g=[],h=[],f=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var l=0;l<=this.angle+0.0010;l+=c){for(k=0;k<b.length;k++)l<this.angle?(b[k]=f.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),g[k]=this.vertices.length-1):g=h;l==0&&(h=e);
 for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(g[k],g[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-l/this.angle,k/a.length),new THREE.UV(1-l/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,k/a.length)]);e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(g[k],g[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-l/this.angle,k/a.length),new THREE.UV(1-l/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,k/a.length)]);e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,k){k<1?(k=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),k.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),k.normal=k.centroid.clone().normalize(),
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,k){k<1?(k=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),k.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),k.normal=k.centroid.clone().normalize(),
 f.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),f.faceVertexUvs[0].push([h(a.uv,a.position,k),h(b.uv,b.position,k),h(c.uv,c.position,k)])):(k-=1,e(a,g(a,b),g(a,c),k),e(g(a,b),b,g(b,c),k),e(g(a,c),g(b,c),c,k),e(g(a,b),g(b,c),g(a,c),k))}function g(a,c){k[a.index]||(k[a.index]=[]);k[c.index]||(k[c.index]=[]);var e=k[a.index][c.index];e===void 0&&(k[a.index][c.index]=k[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function h(a,b,c){c<0&&a.u===
 f.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),f.faceVertexUvs[0].push([h(a.uv,a.position,k),h(b.uv,b.position,k),h(c.uv,c.position,k)])):(k-=1,e(a,g(a,b),g(a,c),k),e(g(a,b),b,g(b,c),k),e(g(a,c),g(b,c),c,k),e(g(a,b),g(b,c),g(a,c),k))}function g(a,c){k[a.index]||(k[a.index]=[]);k[c.index]||(k[c.index]=[]);var e=k[a.index][c.index];e===void 0&&(k[a.index][c.index]=k[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function h(a,b,c){c<0&&a.u===

+ 1 - 1
build/custom/ThreeSVG.js

@@ -69,7 +69,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){t
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,i=a.z,a=a.w;this.x=b*a+f*e+c*i-d*g;this.y=c*a+f*g+d*e-b*i;this.z=d*a+f*i+b*g-c*e;this.w=f*a-b*e-c*g-d*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,i=this.z,k=this.w,h=k*c+g*f-i*d,l=k*d+i*c-e*f,j=k*f+e*d-g*c,c=-e*
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,i=a.z,a=a.w;this.x=b*a+f*e+c*i-d*g;this.y=c*a+f*g+d*e-b*i;this.z=d*a+f*i+b*g-c*e;this.w=f*a-b*e-c*g-d*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,i=this.z,k=this.w,h=k*c+g*f-i*d,l=k*d+i*c-e*f,j=k*f+e*d-g*c,c=-e*
-c-g*d-i*f;b.x=h*k+c*-e+l*-i-j*-g;b.y=l*k+c*-g+j*-e-h*-i;b.z=j*k+c*-i+h*-g-l*-e;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
+c-g*d-i*f;b.x=h*k+c*-e+l*-i-j*-g;b.y=l*k+c*-g+j*-e-h*-i;b.z=j*k+c*-i+h*-g-l*-e;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};

+ 57 - 57
build/custom/ThreeWebGL.js

@@ -27,11 +27,11 @@ THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,f,i,h,j,k,
 c,d){var f=THREE.Matrix4.__v1,i=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(d,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(d,h).normalize());i.cross(h,f).normalize();this.n11=f.x;this.n12=i.x;this.n13=h.x;this.n21=f.y;this.n22=i.y;this.n23=h.y;this.n31=f.z;this.n32=i.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,f=b.z,i=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*i;
 c,d){var f=THREE.Matrix4.__v1,i=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(d,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(d,h).normalize());i.cross(h,f).normalize();this.n11=f.x;this.n12=i.x;this.n13=h.x;this.n21=f.y;this.n22=i.y;this.n23=h.y;this.n31=f.z;this.n32=i.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,f=b.z,i=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*i;
 b.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*i;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*i;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,i=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*i;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*i;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*i;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*i;return b},rotateAxis:function(b){var c=b.x,d=b.y,f=b.z;b.x=c*this.n11+d*this.n12+f*this.n13;b.y=c*this.n21+d*this.n22+f*this.n23;b.z=c*this.n31+
 b.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*i;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*i;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,i=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*i;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*i;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*i;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*i;return b},rotateAxis:function(b){var c=b.x,d=b.y,f=b.z;b.x=c*this.n11+d*this.n12+f*this.n13;b.y=c*this.n21+d*this.n22+f*this.n23;b.z=c*this.n31+
 d*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 d=b.n11,f=b.n12,i=b.n13,h=b.n14,j=b.n21,k=b.n22,q=b.n23,o=b.n24,p=b.n31,m=b.n32,t=b.n33,v=b.n34,y=b.n41,D=b.n42,F=b.n43,E=b.n44,xa=c.n11,ya=
 d*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 d=b.n11,f=b.n12,i=b.n13,h=b.n14,j=b.n21,k=b.n22,q=b.n23,o=b.n24,p=b.n31,m=b.n32,t=b.n33,v=b.n34,y=b.n41,D=b.n42,F=b.n43,E=b.n44,xa=c.n11,ya=
-c.n12,ra=c.n13,ta=c.n14,ka=c.n21,K=c.n22,u=c.n23,U=c.n24,S=c.n31,la=c.n32,aa=c.n33,za=c.n34,T=c.n41,M=c.n42,e=c.n43,va=c.n44;this.n11=d*xa+f*ka+i*S+h*T;this.n12=d*ya+f*K+i*la+h*M;this.n13=d*ra+f*u+i*aa+h*e;this.n14=d*ta+f*U+i*za+h*va;this.n21=j*xa+k*ka+q*S+o*T;this.n22=j*ya+k*K+q*la+o*M;this.n23=j*ra+k*u+q*aa+o*e;this.n24=j*ta+k*U+q*za+o*va;this.n31=p*xa+m*ka+t*S+v*T;this.n32=p*ya+m*K+t*la+v*M;this.n33=p*ra+m*u+t*aa+v*e;this.n34=p*ta+m*U+t*za+v*va;this.n41=y*xa+D*ka+F*S+E*T;this.n42=y*ya+D*K+F*la+
-E*M;this.n43=y*ra+D*u+F*aa+E*e;this.n44=y*ta+D*U+F*za+E*va;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[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,d=this.n13,f=this.n14,i=this.n21,h=this.n22,j=this.n23,k=this.n24,q=this.n31,o=this.n32,p=this.n33,m=this.n34,t=this.n41,v=this.n42,y=this.n43,D=this.n44;return f*j*o*t-d*k*o*t-f*h*p*t+c*k*p*t+d*h*m*t-c*j*m*t-f*j*q*v+d*k*q*v+f*i*p*v-b*k*p*v-d*i*m*v+b*j*m*v+f*h*q*y-c*k*q*y-f*i*o*y+b*k*o*y+c*i*m*
-y-b*h*m*y-d*h*q*D+c*j*q*D+d*i*o*D-b*j*o*D-c*i*p*D+b*h*p*D},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=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;
+c.n12,ra=c.n13,ta=c.n14,ka=c.n21,K=c.n22,u=c.n23,la=c.n24,S=c.n31,ma=c.n32,aa=c.n33,za=c.n34,T=c.n41,M=c.n42,e=c.n43,va=c.n44;this.n11=d*xa+f*ka+i*S+h*T;this.n12=d*ya+f*K+i*ma+h*M;this.n13=d*ra+f*u+i*aa+h*e;this.n14=d*ta+f*la+i*za+h*va;this.n21=j*xa+k*ka+q*S+o*T;this.n22=j*ya+k*K+q*ma+o*M;this.n23=j*ra+k*u+q*aa+o*e;this.n24=j*ta+k*la+q*za+o*va;this.n31=p*xa+m*ka+t*S+v*T;this.n32=p*ya+m*K+t*ma+v*M;this.n33=p*ra+m*u+t*aa+v*e;this.n34=p*ta+m*la+t*za+v*va;this.n41=y*xa+D*ka+F*S+E*T;this.n42=y*ya+D*K+
+F*ma+E*M;this.n43=y*ra+D*u+F*aa+E*e;this.n44=y*ta+D*la+F*za+E*va;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[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,d=this.n13,f=this.n14,i=this.n21,h=this.n22,j=this.n23,k=this.n24,q=this.n31,o=this.n32,p=this.n33,m=this.n34,t=this.n41,v=this.n42,y=this.n43,D=this.n44;return f*j*o*t-d*k*o*t-f*h*p*t+c*k*p*t+d*h*m*t-c*j*m*t-f*j*q*v+d*k*q*v+f*i*p*v-b*k*p*v-d*i*m*v+b*j*m*v+f*h*q*y-c*k*q*y-f*i*o*y+b*k*o*y+c*i*
+m*y-b*h*m*y-d*h*q*D+c*j*q*D+d*i*o*D-b*j*o*D-c*i*p*D+b*h*p*D},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=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;
 return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=
 return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=
 this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=
 this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=
 Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),f=Math.sin(c),i=1-d,h=b.x,j=b.y,k=b.z,q=i*h,o=i*j;this.set(q*h+d,q*j-f*k,q*k+f*j,0,q*j+f*k,o*j+d,o*k-f*h,0,q*k-f*j,o*k+f*h,i*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},
 Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),f=Math.sin(c),i=1-d,h=b.x,j=b.y,k=b.z,q=i*h,o=i*j;this.set(q*h+d,q*j-f*k,q*k+f*j,0,q*j+f*k,o*j+d,o*k-f*h,0,q*k-f*j,o*k+f*h,i*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},
@@ -55,21 +55,21 @@ b)return i;if(c&&(i=i.getChildByName(b,c),i!==void 0))return i}},updateMatrix:fu
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,d)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,d)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 this.remove(b)}};THREE.Object3DCount=0;
 this.remove(b)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function b(){var b=q[k]=q[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,h=c.z+c.w,i=-b.z+b.w,j=-c.z+c.w;return f>=0&&h>=0&&i>=0&&j>=0?!0:f<0&&h<0||i<0&&j<0?!1:(f<0?d=Math.max(d,f/(f-h)):h<0&&(e=Math.min(e,f/(f-h))),i<0?d=Math.max(d,i/(i-j)):j<0&&(e=Math.min(e,i/(i-j))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,i,h=[],j,k,q=[],o,p,m=[],t,v=[],y,D,F=[],E,xa,ya=[],ra=[],ta=[],ka=new THREE.Vector4,
 THREE.Projector=function(){function b(){var b=q[k]=q[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,h=c.z+c.w,i=-b.z+b.w,j=-c.z+c.w;return f>=0&&h>=0&&i>=0&&j>=0?!0:f<0&&h<0||i<0&&j<0?!1:(f<0?d=Math.max(d,f/(f-h)):h<0&&(e=Math.min(e,f/(f-h))),i<0?d=Math.max(d,i/(i-j)):j<0&&(e=Math.min(e,i/(i-j))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,i,h=[],j,k,q=[],o,p,m=[],t,v=[],y,D,F=[],E,xa,ya=[],ra=[],ta=[],ka=new THREE.Vector4,
-K=new THREE.Vector4,u=new THREE.Matrix4,U=new THREE.Matrix4,S=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],la=new THREE.Vector4,aa=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=ra.length=0;e=b.objects;b=0;for(d=e.length;b<d;b++){k=e[b];var o;if(!(o=!k.visible))if(o=k instanceof THREE.Mesh)if(o=k.frustumCulled){a:{o=void 0;for(var q=k.matrixWorld,m=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),p=0;p<6;p++)if(o=S[p].x*q.n14+S[p].y*q.n24+S[p].z*q.n34+S[p].w,o<=m){o=!1;break a}o=!0}o=!o}if(!o)o=h[i]=h[i]||new THREE.RenderableObject,i++,f=o,ka.copy(k.position),u.multiplyVector3(ka),f.object=k,f.z=ka.z,ra.push(f)}j&&ra.sort(c);return ra};
-this.projectScene=function(f,h,i){var e=h.near,ra=h.far,ka,wa,N,Z,I,W,X,ma,ca,J,Ba,Ja,Ta,Ka,Ca,Ea,Aa;xa=D=t=p=ta.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);u.multiply(h.projectionMatrix,h.matrixWorldInverse);S[0].set(u.n41-u.n11,u.n42-u.n12,u.n43-u.n13,u.n44-u.n14);S[1].set(u.n41+u.n11,u.n42+u.n12,u.n43+u.n13,u.n44+u.n14);S[2].set(u.n41+u.n21,u.n42+u.n22,u.n43+u.n23,u.n44+u.n24);S[3].set(u.n41-u.n21,u.n42-u.n22,u.n43-u.n23,u.n44-u.n24);S[4].set(u.n41-u.n31,u.n42-u.n32,
-u.n43-u.n33,u.n44-u.n34);S[5].set(u.n41+u.n31,u.n42+u.n32,u.n43+u.n33,u.n44+u.n34);for(ka=0;ka<6;ka++)ca=S[ka],ca.divideScalar(Math.sqrt(ca.x*ca.x+ca.y*ca.y+ca.z*ca.z));ca=this.projectObjects(f,h,!0);f=0;for(ka=ca.length;f<ka;f++)if(J=ca[f].object,J.visible)if(Ba=J.matrixWorld,Ja=J.matrixRotationWorld,Ta=J.materials,Ka=J.overdraw,k=0,J instanceof THREE.Mesh){Ca=J.geometry;Z=Ca.vertices;Ea=Ca.faces;Ca=Ca.faceVertexUvs;wa=0;for(N=Z.length;wa<N;wa++)j=b(),j.positionWorld.copy(Z[wa].position),Ba.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<ra;Z=0;for(wa=Ea.length;Z<wa;Z++){N=Ea[Z];if(N instanceof THREE.Face3)if(I=q[N.a],W=q[N.b],X=q[N.c],I.visible&&W.visible&&X.visible&&(J.doubleSided||J.flipSided!=(X.positionScreen.x-I.positionScreen.x)*(W.positionScreen.y-I.positionScreen.y)-(X.positionScreen.y-I.positionScreen.y)*(W.positionScreen.x-
-I.positionScreen.x)<0))ma=m[p]=m[p]||new THREE.RenderableFace3,p++,o=ma,o.v1.copy(I),o.v2.copy(W),o.v3.copy(X);else continue;else if(N instanceof THREE.Face4)if(I=q[N.a],W=q[N.b],X=q[N.c],ma=q[N.d],I.visible&&W.visible&&X.visible&&ma.visible&&(J.doubleSided||J.flipSided!=((ma.positionScreen.x-I.positionScreen.x)*(W.positionScreen.y-I.positionScreen.y)-(ma.positionScreen.y-I.positionScreen.y)*(W.positionScreen.x-I.positionScreen.x)<0||(W.positionScreen.x-X.positionScreen.x)*(ma.positionScreen.y-X.positionScreen.y)-
-(W.positionScreen.y-X.positionScreen.y)*(ma.positionScreen.x-X.positionScreen.x)<0)))Aa=v[t]=v[t]||new THREE.RenderableFace4,t++,o=Aa,o.v1.copy(I),o.v2.copy(W),o.v3.copy(X),o.v4.copy(ma);else continue;o.normalWorld.copy(N.normal);Ja.multiplyVector3(o.normalWorld);o.centroidWorld.copy(N.centroid);Ba.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);u.multiplyVector3(o.centroidScreen);X=N.vertexNormals;I=0;for(W=X.length;I<W;I++)ma=o.vertexNormalsWorld[I],ma.copy(X[I]),Ja.multiplyVector3(ma);
-I=0;for(W=Ca.length;I<W;I++)if(Aa=Ca[I][Z]){X=0;for(ma=Aa.length;X<ma;X++)o.uvs[I][X]=Aa[X]}o.meshMaterials=Ta;o.faceMaterials=N.materials;o.overdraw=Ka;o.z=o.centroidScreen.z;ta.push(o)}}else if(J instanceof THREE.Line){U.multiply(u,Ba);Z=J.geometry.vertices;I=b();I.positionScreen.copy(Z[0].position);U.multiplyVector4(I.positionScreen);wa=1;for(N=Z.length;wa<N;wa++)if(I=b(),I.positionScreen.copy(Z[wa].position),U.multiplyVector4(I.positionScreen),W=q[k-2],la.copy(I.positionScreen),aa.copy(W.positionScreen),
-d(la,aa))la.multiplyScalar(1/la.w),aa.multiplyScalar(1/aa.w),Ba=F[D]=F[D]||new THREE.RenderableLine,D++,y=Ba,y.v1.positionScreen.copy(la),y.v2.positionScreen.copy(aa),y.z=Math.max(la.z,aa.z),y.materials=J.materials,ta.push(y)}else if(J instanceof THREE.Particle&&(K.set(J.matrixWorld.n14,J.matrixWorld.n24,J.matrixWorld.n34,1),u.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))Ba=ya[xa]=ya[xa]||new THREE.RenderableParticle,xa++,E=Ba,E.x=K.x/K.w,E.y=K.y/K.w,E.z=K.z,E.rotation=J.rotation.z,E.scale.x=J.scale.x*
+K=new THREE.Vector4,u=new THREE.Matrix4,la=new THREE.Matrix4,S=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ma=new THREE.Vector4,aa=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=ra.length=0;e=b.objects;b=0;for(d=e.length;b<d;b++){k=e[b];var o;if(!(o=!k.visible))if(o=k instanceof THREE.Mesh)if(o=k.frustumCulled){a:{o=void 0;for(var q=k.matrixWorld,m=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),p=0;p<6;p++)if(o=S[p].x*q.n14+S[p].y*q.n24+S[p].z*q.n34+S[p].w,o<=m){o=!1;break a}o=!0}o=!o}if(!o)o=h[i]=h[i]||new THREE.RenderableObject,i++,f=o,ka.copy(k.position),u.multiplyVector3(ka),f.object=k,f.z=ka.z,ra.push(f)}j&&ra.sort(c);
+return ra};this.projectScene=function(f,h,i){var e=h.near,ra=h.far,ka,wa,N,U,I,W,Y,X,ca,J,Ba,Na,Sa,Ja,Ca,Ea,Aa;xa=D=t=p=ta.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);u.multiply(h.projectionMatrix,h.matrixWorldInverse);S[0].set(u.n41-u.n11,u.n42-u.n12,u.n43-u.n13,u.n44-u.n14);S[1].set(u.n41+u.n11,u.n42+u.n12,u.n43+u.n13,u.n44+u.n14);S[2].set(u.n41+u.n21,u.n42+u.n22,u.n43+u.n23,u.n44+u.n24);S[3].set(u.n41-u.n21,u.n42-u.n22,u.n43-u.n23,u.n44-u.n24);S[4].set(u.n41-u.n31,u.n42-
+u.n32,u.n43-u.n33,u.n44-u.n34);S[5].set(u.n41+u.n31,u.n42+u.n32,u.n43+u.n33,u.n44+u.n34);for(ka=0;ka<6;ka++)ca=S[ka],ca.divideScalar(Math.sqrt(ca.x*ca.x+ca.y*ca.y+ca.z*ca.z));ca=this.projectObjects(f,h,!0);f=0;for(ka=ca.length;f<ka;f++)if(J=ca[f].object,J.visible)if(Ba=J.matrixWorld,Na=J.matrixRotationWorld,Sa=J.materials,Ja=J.overdraw,k=0,J instanceof THREE.Mesh){Ca=J.geometry;U=Ca.vertices;Ea=Ca.faces;Ca=Ca.faceVertexUvs;wa=0;for(N=U.length;wa<N;wa++)j=b(),j.positionWorld.copy(U[wa].position),Ba.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<ra;U=0;for(wa=Ea.length;U<wa;U++){N=Ea[U];if(N instanceof THREE.Face3)if(I=q[N.a],W=q[N.b],Y=q[N.c],I.visible&&W.visible&&Y.visible&&(J.doubleSided||J.flipSided!=(Y.positionScreen.x-I.positionScreen.x)*(W.positionScreen.y-I.positionScreen.y)-(Y.positionScreen.y-I.positionScreen.y)*(W.positionScreen.x-
+I.positionScreen.x)<0))X=m[p]=m[p]||new THREE.RenderableFace3,p++,o=X,o.v1.copy(I),o.v2.copy(W),o.v3.copy(Y);else continue;else if(N instanceof THREE.Face4)if(I=q[N.a],W=q[N.b],Y=q[N.c],X=q[N.d],I.visible&&W.visible&&Y.visible&&X.visible&&(J.doubleSided||J.flipSided!=((X.positionScreen.x-I.positionScreen.x)*(W.positionScreen.y-I.positionScreen.y)-(X.positionScreen.y-I.positionScreen.y)*(W.positionScreen.x-I.positionScreen.x)<0||(W.positionScreen.x-Y.positionScreen.x)*(X.positionScreen.y-Y.positionScreen.y)-
+(W.positionScreen.y-Y.positionScreen.y)*(X.positionScreen.x-Y.positionScreen.x)<0)))Aa=v[t]=v[t]||new THREE.RenderableFace4,t++,o=Aa,o.v1.copy(I),o.v2.copy(W),o.v3.copy(Y),o.v4.copy(X);else continue;o.normalWorld.copy(N.normal);Na.multiplyVector3(o.normalWorld);o.centroidWorld.copy(N.centroid);Ba.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);u.multiplyVector3(o.centroidScreen);Y=N.vertexNormals;I=0;for(W=Y.length;I<W;I++)X=o.vertexNormalsWorld[I],X.copy(Y[I]),Na.multiplyVector3(X);
+I=0;for(W=Ca.length;I<W;I++)if(Aa=Ca[I][U]){Y=0;for(X=Aa.length;Y<X;Y++)o.uvs[I][Y]=Aa[Y]}o.meshMaterials=Sa;o.faceMaterials=N.materials;o.overdraw=Ja;o.z=o.centroidScreen.z;ta.push(o)}}else if(J instanceof THREE.Line){la.multiply(u,Ba);U=J.geometry.vertices;I=b();I.positionScreen.copy(U[0].position);la.multiplyVector4(I.positionScreen);wa=1;for(N=U.length;wa<N;wa++)if(I=b(),I.positionScreen.copy(U[wa].position),la.multiplyVector4(I.positionScreen),W=q[k-2],ma.copy(I.positionScreen),aa.copy(W.positionScreen),
+d(ma,aa))ma.multiplyScalar(1/ma.w),aa.multiplyScalar(1/aa.w),Ba=F[D]=F[D]||new THREE.RenderableLine,D++,y=Ba,y.v1.positionScreen.copy(ma),y.v2.positionScreen.copy(aa),y.z=Math.max(ma.z,aa.z),y.materials=J.materials,ta.push(y)}else if(J instanceof THREE.Particle&&(K.set(J.matrixWorld.n14,J.matrixWorld.n24,J.matrixWorld.n34,1),u.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))Ba=ya[xa]=ya[xa]||new THREE.RenderableParticle,xa++,E=Ba,E.x=K.x/K.w,E.y=K.y/K.w,E.z=K.z,E.rotation=J.rotation.z,E.scale.x=J.scale.x*
 Math.abs(E.x-(K.x+h.projectionMatrix.n11)/(K.w+h.projectionMatrix.n14)),E.scale.y=J.scale.y*Math.abs(E.y-(K.y+h.projectionMatrix.n22)/(K.w+h.projectionMatrix.n24)),E.materials=J.materials,ta.push(E);i&&ta.sort(c);return ta}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==void 0?f:1)};
 Math.abs(E.x-(K.x+h.projectionMatrix.n11)/(K.w+h.projectionMatrix.n14)),E.scale.y=J.scale.y*Math.abs(E.y-(K.y+h.projectionMatrix.n22)/(K.w+h.projectionMatrix.n24)),E.materials=J.materials,ta.push(E);i&&ta.sort(c);return ta}};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);
 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);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(d);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(d);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
 this.x,d=this.y,f=this.z,i=this.w,h=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+i*h+d*k-f*j;this.y=d*b+i*j+f*h-c*k;this.z=f*b+i*k+c*j-d*h;this.w=i*b-c*h-d*j-f*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,i=b.z,h=this.x,j=this.y,k=this.z,q=this.w,o=q*d+j*i-k*f,p=q*f+k*d-h*i,m=q*i+h*f-j*d,d=-h*
 this.x,d=this.y,f=this.z,i=this.w,h=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+i*h+d*k-f*j;this.y=d*b+i*j+f*h-c*k;this.z=f*b+i*k+c*j-d*h;this.w=i*b-c*h-d*j-f*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,i=b.z,h=this.x,j=this.y,k=this.z,q=this.w,o=q*d+j*i-k*f,p=q*f+k*d-h*i,m=q*i+h*f-j*d,d=-h*
-d-j*f-k*i;c.x=o*q+d*-h+p*-k-m*-j;c.y=p*q+d*-j+m*-h-o*-k;c.z=m*q+d*-k+o*-j-p*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var i=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(i)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(i),j=Math.sqrt(1-i*i);if(Math.abs(j)<0.001)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;i=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;d.w=b.w*i+c.w*f;d.x=b.x*i+c.x*f;d.y=b.y*i+c.y*f;d.z=b.z*i+c.z*f;return d};
+d-j*f-k*i;c.x=o*q+d*-h+p*-k-m*-j;c.y=p*q+d*-j+m*-h-o*-k;c.z=m*q+d*-k+o*-j-p*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var i=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(i)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(i),j=Math.sqrt(1-i*i);if(Math.abs(j)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;i=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;d.w=b.w*i+c.w*f;d.x=b.x*i+c.x*f;d.y=b.y*i+c.y*f;d.z=b.z*i+c.z*f;return d};
 THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,f,i,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,f,i,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,d,f,i,h,j){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.Face4=function(b,c,d,f,i,h,j){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
@@ -78,9 +78,9 @@ c;b++)d=this.faces[b],d.centroid.set(0,0,0),d instanceof THREE.Face3?(d.centroid
 d,f,i,h,j,k=new THREE.Vector3,q=new THREE.Vector3;f=0;for(i=this.faces.length;f<i;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[h.a],d=this.vertices[h.b],j=this.vertices[h.c],k.sub(j.position,d.position),q.sub(c.position,d.position),k.crossSelf(q);k.isZero()||k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
 d,f,i,h,j,k=new THREE.Vector3,q=new THREE.Vector3;f=0;for(i=this.faces.length;f<i;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[h.a],d=this.vertices[h.b],j=this.vertices[h.c],k.sub(j.position,d.position),q.sub(c.position,d.position),k.crossSelf(q);k.isZero()||k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,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(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.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++)d=this.faces[b],d instanceof
 Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.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++)d=this.faces[b],d instanceof
 THREE.Face3?(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal),f[d.d].addSelf(d.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(f[d.a]),d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(f[d.a]),
 THREE.Face3?(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal),f[d.d].addSelf(d.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(f[d.a]),d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(f[d.a]),
-d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c]),d.vertexNormals[3].copy(f[d.d]))},computeTangents:function(){function b(b,e,c,d,f,h,i){k=b.vertices[e].position;q=b.vertices[c].position;o=b.vertices[d].position;p=j[f];m=j[h];t=j[i];v=q.x-k.x;y=o.x-k.x;D=q.y-k.y;F=o.y-k.y;E=q.z-k.z;xa=o.z-k.z;ya=m.u-p.u;ra=t.u-p.u;ta=m.v-p.v;ka=t.v-p.v;K=1/(ya*ka-ra*ta);la.set((ka*v-ta*y)*K,(ka*D-ta*F)*K,(ka*E-ta*xa)*K);aa.set((ya*y-ra*v)*K,(ya*F-ra*D)*K,(ya*xa-ra*E)*K);U[e].addSelf(la);U[c].addSelf(la);
-U[d].addSelf(la);S[e].addSelf(aa);S[c].addSelf(aa);S[d].addSelf(aa)}var c,d,f,i,h,j,k,q,o,p,m,t,v,y,D,F,E,xa,ya,ra,ta,ka,K,u,U=[],S=[],la=new THREE.Vector3,aa=new THREE.Vector3,za=new THREE.Vector3,T=new THREE.Vector3,M=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)U[c]=new THREE.Vector3,S[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],j=this.faceVertexUvs[0][c],h instanceof THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,
-1,2),b(this,h.a,h.b,h.d,0,1,3));var e=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)M.copy(h.vertexNormals[f]),i=h[e[f]],u=U[i],za.copy(u),za.subSelf(M.multiplyScalar(M.dot(u))).normalize(),T.cross(h.vertexNormals[f],u),i=T.dot(S[i]),i=i<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(za.x,za.y,za.z,i)}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],
+d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c]),d.vertexNormals[3].copy(f[d.d]))},computeTangents:function(){function b(b,e,c,d,f,h,i){k=b.vertices[e].position;q=b.vertices[c].position;o=b.vertices[d].position;p=j[f];m=j[h];t=j[i];v=q.x-k.x;y=o.x-k.x;D=q.y-k.y;F=o.y-k.y;E=q.z-k.z;xa=o.z-k.z;ya=m.u-p.u;ra=t.u-p.u;ta=m.v-p.v;ka=t.v-p.v;K=1/(ya*ka-ra*ta);ma.set((ka*v-ta*y)*K,(ka*D-ta*F)*K,(ka*E-ta*xa)*K);aa.set((ya*y-ra*v)*K,(ya*F-ra*D)*K,(ya*xa-ra*E)*K);la[e].addSelf(ma);la[c].addSelf(ma);
+la[d].addSelf(ma);S[e].addSelf(aa);S[c].addSelf(aa);S[d].addSelf(aa)}var c,d,f,i,h,j,k,q,o,p,m,t,v,y,D,F,E,xa,ya,ra,ta,ka,K,u,la=[],S=[],ma=new THREE.Vector3,aa=new THREE.Vector3,za=new THREE.Vector3,T=new THREE.Vector3,M=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)la[c]=new THREE.Vector3,S[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],j=this.faceVertexUvs[0][c],h instanceof THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,
+0,1,2),b(this,h.a,h.b,h.d,0,1,3));var e=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)M.copy(h.vertexNormals[f]),i=h[e[f]],u=la[i],za.copy(u),za.subSelf(M.multiplyScalar(M.dot(u))).normalize(),T.cross(h.vertexNormals[f],u),i=T.dot(S[i]),i=i<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(za.x,za.y,za.z,i)}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,d=this.vertices.length;c<d;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<
 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,d=this.vertices.length;c<d;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,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},mergeVertices:function(){var b={},c=[],d=[],f,i=Math.pow(10,4),h,j;h=0;for(j=this.vertices.length;h<j;h++)f=this.vertices[h].position,f=[Math.round(f.x*i),Math.round(f.y*i),Math.round(f.z*i)].join("_"),
 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,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},mergeVertices:function(){var b={},c=[],d=[],f,i=Math.pow(10,4),h,j;h=0;for(j=this.vertices.length;h<j;h++)f=this.vertices[h].position,f=[Math.round(f.x*i),Math.round(f.y*i),Math.round(f.z*i)].join("_"),
 b[f]===void 0?(b[f]=h,c.push(this.vertices[h]),d[h]=c.length-1):d[h]=d[b[f]];h=0;for(j=this.faces.length;h<j;h++){b=this.faces[h];if(b instanceof THREE.Face3)b.a=d[b.a],b.b=d[b.b],b.c=d[b.c];if(b instanceof THREE.Face4)b.a=d[b.a],b.b=d[b.b],b.c=d[b.c],b.d=d[b.d]}this.vertices=c}};THREE.GeometryCount=0;
 b[f]===void 0?(b[f]=h,c.push(this.vertices[h]),d[h]=c.length-1):d[h]=d[b[f]];h=0;for(j=this.faces.length;h<j;h++){b=this.faces[h];if(b instanceof THREE.Face3)b.a=d[b.a],b.b=d[b.b],b.c=d[b.c];if(b instanceof THREE.Face4)b.a=d[b.a],b.b=d[b.b],b.c=d[b.c],b.d=d[b.d]}this.vertices=c}};THREE.GeometryCount=0;
@@ -177,22 +177,22 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
 "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(b){function c(b,c,d){var f,h,i,j=b.vertices,L=j.length,z=b.colors,k=z.length,o=b.__vertexArray,G=b.__colorArray,q=b.__sortArray,Fa=b.__dirtyVertices,A=b.__dirtyColors,x=b.__webglCustomAttributes,p,m;if(x)for(p in x)x[p].offset=0;if(d.sortParticles){Ga.multiplySelf(d.matrixWorld);for(f=0;f<L;f++)h=j[f].position,Sa.copy(h),Ga.multiplyVector3(Sa),q[f]=[Sa.z,f];q.sort(function(b,e){return e[0]-b[0]});for(f=0;f<L;f++)h=j[q[f][1]].position,i=f*3,o[i]=h.x,o[i+1]=h.y,o[i+2]=h.z;
+THREE.WebGLRenderer=function(b){function c(b,c,d){var f,h,i,j=b.vertices,L=j.length,z=b.colors,k=z.length,o=b.__vertexArray,G=b.__colorArray,q=b.__sortArray,Fa=b.__dirtyVertices,A=b.__dirtyColors,x=b.__webglCustomAttributes,p,m;if(x)for(p in x)x[p].offset=0;if(d.sortParticles){Ga.multiplySelf(d.matrixWorld);for(f=0;f<L;f++)h=j[f].position,La.copy(h),Ga.multiplyVector3(La),q[f]=[La.z,f];q.sort(function(b,e){return e[0]-b[0]});for(f=0;f<L;f++)h=j[q[f][1]].position,i=f*3,o[i]=h.x,o[i+1]=h.y,o[i+2]=h.z;
 for(f=0;f<k;f++)i=f*3,color=z[q[f][1]],G[i]=color.r,G[i+1]=color.g,G[i+2]=color.b;if(x)for(p in x){f=x[p];z=f.value.length;for(i=0;i<z;i++){index=q[i][1];k=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[k]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")m=f.value[index];f.size===2?(f.array[k]=m.x,f.array[k+1]=m.y):f.size===3?f.type==="c"?(f.array[k]=m.r,f.array[k+1]=m.g,f.array[k+2]=m.b):(f.array[k]=m.x,f.array[k+1]=m.y,f.array[k+2]=m.z):(f.array[k]=
 for(f=0;f<k;f++)i=f*3,color=z[q[f][1]],G[i]=color.r,G[i+1]=color.g,G[i+2]=color.b;if(x)for(p in x){f=x[p];z=f.value.length;for(i=0;i<z;i++){index=q[i][1];k=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[k]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")m=f.value[index];f.size===2?(f.array[k]=m.x,f.array[k+1]=m.y):f.size===3?f.type==="c"?(f.array[k]=m.r,f.array[k+1]=m.g,f.array[k+2]=m.b):(f.array[k]=m.x,f.array[k+1]=m.y,f.array[k+2]=m.z):(f.array[k]=
 m.x,f.array[k+1]=m.y,f.array[k+2]=m.z,f.array[k+3]=m.w)}f.offset+=f.size}}}else{if(Fa)for(f=0;f<L;f++)h=j[f].position,i=f*3,o[i]=h.x,o[i+1]=h.y,o[i+2]=h.z;if(A)for(f=0;f<k;f++)color=z[f],i=f*3,G[i]=color.r,G[i+1]=color.g,G[i+2]=color.b;if(x)for(p in x)if(f=x[p],f.__original.needsUpdate){z=f.value.length;for(i=0;i<z;i++){k=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[k]=f.value[i]}else{if(f.boundTo===void 0||f.boundTo==="vertices")m=f.value[i];f.size===2?(f.array[k]=
 m.x,f.array[k+1]=m.y,f.array[k+2]=m.z,f.array[k+3]=m.w)}f.offset+=f.size}}}else{if(Fa)for(f=0;f<L;f++)h=j[f].position,i=f*3,o[i]=h.x,o[i+1]=h.y,o[i+2]=h.z;if(A)for(f=0;f<k;f++)color=z[f],i=f*3,G[i]=color.r,G[i+1]=color.g,G[i+2]=color.b;if(x)for(p in x)if(f=x[p],f.__original.needsUpdate){z=f.value.length;for(i=0;i<z;i++){k=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[k]=f.value[i]}else{if(f.boundTo===void 0||f.boundTo==="vertices")m=f.value[i];f.size===2?(f.array[k]=
 m.x,f.array[k+1]=m.y):f.size===3?f.type==="c"?(f.array[k]=m.r,f.array[k+1]=m.g,f.array[k+2]=m.b):(f.array[k]=m.x,f.array[k+1]=m.y,f.array[k+2]=m.z):(f.array[k]=m.x,f.array[k+1]=m.y,f.array[k+2]=m.z,f.array[k+3]=m.w)}f.offset+=f.size}}}if(Fa||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,o,c);if(A||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,G,c);if(x)for(p in x)if(f=x[p],f.__original.needsUpdate||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
 m.x,f.array[k+1]=m.y):f.size===3?f.type==="c"?(f.array[k]=m.r,f.array[k+1]=m.g,f.array[k+2]=m.b):(f.array[k]=m.x,f.array[k+1]=m.y,f.array[k+2]=m.z):(f.array[k]=m.x,f.array[k+1]=m.y,f.array[k+2]=m.z,f.array[k+3]=m.w)}f.offset+=f.size}}}if(Fa||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,o,c);if(A||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,G,c);if(x)for(p in x)if(f=x[p],f.__original.needsUpdate||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
-f.buffer),e.bufferData(e.ARRAY_BUFFER,f.array,c)}function d(b,c,d,f,h){f.program||M.initMaterial(f,c,d,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);for(var i=0,j=M.maxMorphTargets;i<j;i++)h.__webglMorphTargetInfluences[i]=0}var k=!1,i=f.program,j=i.uniforms,z=f.uniforms;i!=Xa&&(e.useProgram(i),Xa=i,k=!0);if(f.id!=N)N=f.id,k=!0;if(k){e.uniformMatrix4fv(j.projectionMatrix,!1,Va);if(d&&f.fog)if(z.fogColor.value=d.color,d instanceof
+f.buffer),e.bufferData(e.ARRAY_BUFFER,f.array,c)}function d(b,c,d,f,h){f.program||M.initMaterial(f,c,d,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);for(var i=0,j=M.maxMorphTargets;i<j;i++)h.__webglMorphTargetInfluences[i]=0}var k=!1,i=f.program,j=i.uniforms,z=f.uniforms;i!=Xa&&(e.useProgram(i),Xa=i,k=!0);if(f.id!=N)N=f.id,k=!0;if(k){e.uniformMatrix4fv(j.projectionMatrix,!1,Ua);if(d&&f.fog)if(z.fogColor.value=d.color,d instanceof
 THREE.Fog)z.fogNear.value=d.near,z.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)z.fogDensity.value=d.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var o,m,G,q,p,A=Za,x=A.directional.colors,t=A.directional.positions,r=A.point.colors,v=A.point.positions,y=A.point.distances,B=0,D=0,d=o=p=0,k=c.length;d<k;d++)if(o=c[d],m=o.color,G=o.position,q=o.intensity,p=o.distance,o instanceof THREE.DirectionalLight)p=B*3,x[p]=m.r*q,x[p+1]=m.g*q,x[p+
 THREE.Fog)z.fogNear.value=d.near,z.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)z.fogDensity.value=d.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var o,m,G,q,p,A=Za,x=A.directional.colors,t=A.directional.positions,r=A.point.colors,v=A.point.positions,y=A.point.distances,B=0,D=0,d=o=p=0,k=c.length;d<k;d++)if(o=c[d],m=o.color,G=o.position,q=o.intensity,p=o.distance,o instanceof THREE.DirectionalLight)p=B*3,x[p]=m.r*q,x[p+1]=m.g*q,x[p+
 2]=m.b*q,t[p]=G.x,t[p+1]=G.y,t[p+2]=G.z,B+=1;else if(o instanceof THREE.SpotLight)p=B*3,x[p]=m.r*q,x[p+1]=m.g*q,x[p+2]=m.b*q,m=1/G.length(),t[p]=G.x*m,t[p+1]=G.y*m,t[p+2]=G.z*m,B+=1;else if(o instanceof THREE.PointLight)o=D*3,r[o]=m.r*q,r[o+1]=m.g*q,r[o+2]=m.b*q,v[o]=G.x,v[o+1]=G.y,v[o+2]=G.z,y[D]=p,D+=1;d=B*3;for(k=x.length;d<k;d++)x[d]=0;d=D*3;for(k=r.length;d<k;d++)r[d]=0;A.point.length=D;A.directional.length=B;A.ambient[0]=0;A.ambient[1]=0;A.ambient[2]=0;c=Za;z.enableLighting.value=c.directional.length+
 2]=m.b*q,t[p]=G.x,t[p+1]=G.y,t[p+2]=G.z,B+=1;else if(o instanceof THREE.SpotLight)p=B*3,x[p]=m.r*q,x[p+1]=m.g*q,x[p+2]=m.b*q,m=1/G.length(),t[p]=G.x*m,t[p+1]=G.y*m,t[p+2]=G.z*m,B+=1;else if(o instanceof THREE.PointLight)o=D*3,r[o]=m.r*q,r[o+1]=m.g*q,r[o+2]=m.b*q,v[o]=G.x,v[o+1]=G.y,v[o+2]=G.z,y[D]=p,D+=1;d=B*3;for(k=x.length;d<k;d++)x[d]=0;d=D*3;for(k=r.length;d<k;d++)r[d]=0;A.point.length=D;A.directional.length=B;A.ambient[0]=0;A.ambient[1]=0;A.ambient[2]=0;c=Za;z.enableLighting.value=c.directional.length+
 c.point.length;z.ambientLightColor.value=c.ambient;z.directionalLightColor.value=c.directional.colors;z.directionalLightDirection.value=c.directional.positions;z.pointLightColor.value=c.point.colors;z.pointLightPosition.value=c.point.positions;z.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)z.diffuse.value=f.color,z.opacity.value=f.opacity,(z.map.texture=f.map)&&z.offsetRepeat.value.set(f.map.offset.x,
 c.point.length;z.ambientLightColor.value=c.ambient;z.directionalLightColor.value=c.directional.colors;z.directionalLightDirection.value=c.directional.positions;z.pointLightColor.value=c.point.colors;z.pointLightPosition.value=c.point.positions;z.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)z.diffuse.value=f.color,z.opacity.value=f.opacity,(z.map.texture=f.map)&&z.offsetRepeat.value.set(f.map.offset.x,
 f.map.offset.y,f.map.repeat.x,f.map.repeat.y),z.lightMap.texture=f.lightMap,z.envMap.texture=f.envMap,z.reflectivity.value=f.reflectivity,z.refractionRatio.value=f.refractionRatio,z.combine.value=f.combine,z.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)z.diffuse.value=f.color,z.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)z.psColor.value=f.color,z.opacity.value=f.opacity,z.size.value=f.size,z.scale.value=
 f.map.offset.y,f.map.repeat.x,f.map.repeat.y),z.lightMap.texture=f.lightMap,z.envMap.texture=f.envMap,z.reflectivity.value=f.reflectivity,z.refractionRatio.value=f.refractionRatio,z.combine.value=f.combine,z.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)z.diffuse.value=f.color,z.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)z.psColor.value=f.color,z.opacity.value=f.opacity,z.size.value=f.size,z.scale.value=
-Da.height/2,z.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)z.ambient.value=f.ambient,z.specular.value=f.specular,z.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)z.mNear.value=b.near,z.mFar.value=b.far,z.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)z.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&z.shadowMatrix){for(c=0;c<Ua.length;c++)z.shadowMatrix.value[c]=Ua[c],z.shadowMap.texture[c]=M.shadowMap[c];z.shadowDarkness.value=
+Da.height/2,z.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)z.ambient.value=f.ambient,z.specular.value=f.specular,z.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)z.mNear.value=b.near,z.mFar.value=b.far,z.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)z.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&z.shadowMatrix){for(c=0;c<Ta.length;c++)z.shadowMatrix.value[c]=Ta[c],z.shadowMap.texture[c]=M.shadowMap[c];z.shadowDarkness.value=
 M.shadowMapDarkness;z.shadowBias.value=M.shadowMapBias}c=f.uniformsList;z=0;for(d=c.length;z<d;z++)if(A=i.uniforms[c[z][1]])if(G=c[z][0],x=G.type,k=G.value,x=="i")e.uniform1i(A,k);else if(x=="f")e.uniform1f(A,k);else if(x=="v2")e.uniform2f(A,k.x,k.y);else if(x=="v3")e.uniform3f(A,k.x,k.y,k.z);else if(x=="v4")e.uniform4f(A,k.x,k.y,k.z,k.w);else if(x=="c")e.uniform3f(A,k.r,k.g,k.b);else if(x=="fv1")e.uniform1fv(A,k);else if(x=="fv")e.uniform3fv(A,k);else if(x=="v3v"){if(!G._array)G._array=new Float32Array(3*
 M.shadowMapDarkness;z.shadowBias.value=M.shadowMapBias}c=f.uniformsList;z=0;for(d=c.length;z<d;z++)if(A=i.uniforms[c[z][1]])if(G=c[z][0],x=G.type,k=G.value,x=="i")e.uniform1i(A,k);else if(x=="f")e.uniform1f(A,k);else if(x=="v2")e.uniform2f(A,k.x,k.y);else if(x=="v3")e.uniform3f(A,k.x,k.y,k.z);else if(x=="v4")e.uniform4f(A,k.x,k.y,k.z,k.w);else if(x=="c")e.uniform3f(A,k.r,k.g,k.b);else if(x=="fv1")e.uniform1fv(A,k);else if(x=="fv")e.uniform3fv(A,k);else if(x=="v3v"){if(!G._array)G._array=new Float32Array(3*
 k.length);x=0;for(t=k.length;x<t;x++)r=x*3,G._array[r]=k[x].x,G._array[r+1]=k[x].y,G._array[r+2]=k[x].z;e.uniform3fv(A,G._array)}else if(x=="m4"){if(!G._array)G._array=new Float32Array(16);k.flattenToArray(G._array);e.uniformMatrix4fv(A,!1,G._array)}else if(x=="m4v"){if(!G._array)G._array=new Float32Array(16*k.length);x=0;for(t=k.length;x<t;x++)k[x].flattenToArrayOffset(G._array,x*16);e.uniformMatrix4fv(A,!1,G._array)}else if(x=="t"){if(e.uniform1i(A,k),A=G.texture)if(A.image instanceof Array&&A.image.length==
 k.length);x=0;for(t=k.length;x<t;x++)r=x*3,G._array[r]=k[x].x,G._array[r+1]=k[x].y,G._array[r+2]=k[x].z;e.uniform3fv(A,G._array)}else if(x=="m4"){if(!G._array)G._array=new Float32Array(16);k.flattenToArray(G._array);e.uniformMatrix4fv(A,!1,G._array)}else if(x=="m4v"){if(!G._array)G._array=new Float32Array(16*k.length);x=0;for(t=k.length;x<t;x++)k[x].flattenToArrayOffset(G._array,x*16);e.uniformMatrix4fv(A,!1,G._array)}else if(x=="t"){if(e.uniform1i(A,k),A=G.texture)if(A.image instanceof Array&&A.image.length==
 6){if(G=A,G.image.length==6)if(G.needsUpdate){if(!G.image.__webglTextureCube)G.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+k);e.bindTexture(e.TEXTURE_CUBE_MAP,G.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,G.image[k]);u(e.TEXTURE_CUBE_MAP,G,G.image[0]);G.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,G.image.__webglTextureCube)}else A instanceof THREE.WebGLRenderTargetCube?
 6){if(G=A,G.image.length==6)if(G.needsUpdate){if(!G.image.__webglTextureCube)G.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+k);e.bindTexture(e.TEXTURE_CUBE_MAP,G.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,G.image[k]);u(e.TEXTURE_CUBE_MAP,G,G.image[0]);G.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,G.image.__webglTextureCube)}else A instanceof THREE.WebGLRenderTargetCube?
-(G=A,e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,G.__webglTexture)):U(A,k)}else if(x=="tv"){if(!G._array){G._array=[];x=0;for(t=G.texture.length;x<t;x++)G._array[x]=k+x}e.uniform1iv(A,G._array);x=0;for(t=G.texture.length;x<t;x++)(A=G.texture[x])&&U(A,G._array[x])}(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,h.boneMatrices))}e.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray);j.normalMatrix&&e.uniformMatrix3fv(j.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&j.objectMatrix!==
-null&&e.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray);return i}function f(b,c,f,h,i,j){if(h.opacity!=0){var k,f=d(b,c,f,h,j),b=f.attributes,c=!1,f=i.id*16777215+f.id;f!=Z&&(Z=f,c=!0);if(!h.morphTargets&&b.position>=0)c&&(e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(j.morphTargetBase){f=h.program.attributes;j.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,i.__webglMorphTargetsBuffers[j.morphTargetBase]),e.vertexAttribPointer(f.position,
+(G=A,e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,G.__webglTexture)):la(A,k)}else if(x=="tv"){if(!G._array){G._array=[];x=0;for(t=G.texture.length;x<t;x++)G._array[x]=k+x}e.uniform1iv(A,G._array);x=0;for(t=G.texture.length;x<t;x++)(A=G.texture[x])&&la(A,G._array[x])}(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,Va);f.skinning&&(e.uniformMatrix4fv(j.cameraInverseMatrix,!1,Va),e.uniformMatrix4fv(j.boneGlobalMatrices,!1,h.boneMatrices))}e.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray);j.normalMatrix&&e.uniformMatrix3fv(j.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&j.objectMatrix!==
+null&&e.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray);return i}function f(b,c,f,h,i,j){if(h.opacity!=0){var k,f=d(b,c,f,h,j),b=f.attributes,c=!1,f=i.id*16777215+f.id;f!=U&&(U=f,c=!0);if(!h.morphTargets&&b.position>=0)c&&(e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(j.morphTargetBase){f=h.program.attributes;j.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,i.__webglMorphTargetsBuffers[j.morphTargetBase]),e.vertexAttribPointer(f.position,
 3,e.FLOAT,!1,0,0)):f.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer),e.vertexAttribPointer(f.position,3,e.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var o=0,z=j.morphTargetForcedOrder,m=j.morphTargetInfluences;o<h.numSupportedMorphTargets&&o<z.length;)e.bindBuffer(e.ARRAY_BUFFER,i.__webglMorphTargetsBuffers[z[o]]),e.vertexAttribPointer(f["morphTarget"+o],3,e.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[o]=m[z[o]],o++;else{var z=[],q=-1,p=0,m=j.morphTargetInfluences,t,Fa=
 3,e.FLOAT,!1,0,0)):f.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer),e.vertexAttribPointer(f.position,3,e.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var o=0,z=j.morphTargetForcedOrder,m=j.morphTargetInfluences;o<h.numSupportedMorphTargets&&o<z.length;)e.bindBuffer(e.ARRAY_BUFFER,i.__webglMorphTargetsBuffers[z[o]]),e.vertexAttribPointer(f["morphTarget"+o],3,e.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[o]=m[z[o]],o++;else{var z=[],q=-1,p=0,m=j.morphTargetInfluences,t,Fa=
 m.length,o=0;for(j.morphTargetBase!==-1&&(z[j.morphTargetBase]=!0);o<h.numSupportedMorphTargets;){for(t=0;t<Fa;t++)!z[t]&&m[t]>q&&(p=t,q=m[p]);e.bindBuffer(e.ARRAY_BUFFER,i.__webglMorphTargetsBuffers[p]);e.vertexAttribPointer(f["morphTarget"+o],3,e.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[o]=q;z[p]=1;q=-1;o++}}h.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(h.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(c){if(i.__webglCustomAttributes)for(k in i.__webglCustomAttributes)b[k]>=
 m.length,o=0;for(j.morphTargetBase!==-1&&(z[j.morphTargetBase]=!0);o<h.numSupportedMorphTargets;){for(t=0;t<Fa;t++)!z[t]&&m[t]>q&&(p=t,q=m[p]);e.bindBuffer(e.ARRAY_BUFFER,i.__webglMorphTargetsBuffers[p]);e.vertexAttribPointer(f["morphTarget"+o],3,e.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[o]=q;z[p]=1;q=-1;o++}}h.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(h.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(c){if(i.__webglCustomAttributes)for(k in i.__webglCustomAttributes)b[k]>=
 0&&(f=i.__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,i.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,i.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,i.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(i.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,
 0&&(f=i.__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,i.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,i.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,i.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(i.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,
@@ -201,40 +201,40 @@ e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,i.__webglSkinVertexBBuffer),e.vertex
 e.UNSIGNED_SHORT,0)):(c&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),e.drawElements(e.TRIANGLES,i.__webglFaceCount,e.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=i.__webglFaceCount,M.info.render.faces+=i.__webglFaceCount/3):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?e.LINE_STRIP:e.LINES,e.lineWidth(h.linewidth),e.drawArrays(j,0,i.__webglLineCount),M.info.render.calls++):j instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,i.__webglParticleCount),M.info.render.calls++):
 e.UNSIGNED_SHORT,0)):(c&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),e.drawElements(e.TRIANGLES,i.__webglFaceCount,e.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=i.__webglFaceCount,M.info.render.faces+=i.__webglFaceCount/3):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?e.LINE_STRIP:e.LINES,e.lineWidth(h.linewidth),e.drawArrays(j,0,i.__webglLineCount),M.info.render.calls++):j instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,i.__webglParticleCount),M.info.render.calls++):
 j instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,i.__webglVertexCount),M.info.render.calls++)}}function i(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=e.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=e.createBuffer();b.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,b.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(c.attributes.position),e.vertexAttribPointer(c.attributes.position,3,e.FLOAT,!1,0,0));if(b.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,
 j instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,i.__webglVertexCount),M.info.render.calls++)}}function i(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=e.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=e.createBuffer();b.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,b.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(c.attributes.position),e.vertexAttribPointer(c.attributes.position,3,e.FLOAT,!1,0,0));if(b.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,
 b.__webglNormalBuffer);if(d==THREE.FlatShading){var f,h,i,j,k,z,o,m,q,p,t=b.count*3;for(p=0;p<t;p+=9)d=b.normalArray,f=d[p],h=d[p+1],i=d[p+2],j=d[p+3],z=d[p+4],m=d[p+5],k=d[p+6],o=d[p+7],q=d[p+8],f=(f+j+k)/3,h=(h+z+o)/3,i=(i+m+q)/3,d[p]=f,d[p+1]=h,d[p+2]=i,d[p+3]=f,d[p+4]=h,d[p+5]=i,d[p+6]=f,d[p+7]=h,d[p+8]=i}e.bufferData(e.ARRAY_BUFFER,b.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(c.attributes.normal);e.vertexAttribPointer(c.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,
 b.__webglNormalBuffer);if(d==THREE.FlatShading){var f,h,i,j,k,z,o,m,q,p,t=b.count*3;for(p=0;p<t;p+=9)d=b.normalArray,f=d[p],h=d[p+1],i=d[p+2],j=d[p+3],z=d[p+4],m=d[p+5],k=d[p+6],o=d[p+7],q=d[p+8],f=(f+j+k)/3,h=(h+z+o)/3,i=(i+m+q)/3,d[p]=f,d[p+1]=h,d[p+2]=i,d[p+3]=f,d[p+4]=h,d[p+5]=i,d[p+6]=f,d[p+7]=h,d[p+8]=i}e.bufferData(e.ARRAY_BUFFER,b.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(c.attributes.normal);e.vertexAttribPointer(c.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,
-0,b.count);b.count=0}function h(b){if(W!=b.doubleSided)b.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),W=b.doubleSided;if(X!=b.flipSided)b.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),X=b.flipSided}function j(b){ca!=b&&(b?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),ca=b)}function k(b){J!=b&&(e.depthMask(b),J=b)}function q(b,c,d){Ba!=b&&(b?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),Ba=b);if(b&&(Ja!=c||Ta!=d))e.polygonOffset(c,d),Ja=c,Ta=d}function o(b){ia[0].set(b.n41-
+0,b.count);b.count=0}function h(b){if(W!=b.doubleSided)b.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),W=b.doubleSided;if(Y!=b.flipSided)b.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),Y=b.flipSided}function j(b){ca!=b&&(b?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),ca=b)}function k(b){J!=b&&(e.depthMask(b),J=b)}function q(b,c,d){Ba!=b&&(b?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),Ba=b);if(b&&(Na!=c||Sa!=d))e.polygonOffset(c,d),Na=c,Sa=d}function o(b){ia[0].set(b.n41-
 b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ia[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ia[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ia[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ia[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ia[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=ia[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function p(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,
 b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ia[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ia[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ia[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ia[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ia[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=ia[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function p(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=ia[d].x*c.n14+ia[d].y*c.n24+ia[d].z*c.n34+ia[d].w,b<=e)return!1;return!0}function m(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?m(h,e):m(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=
 Math.max(b.scale.y,b.scale.z)),d=0;d<6;d++)if(b=ia[d].x*c.n14+ia[d].y*c.n24+ia[d].z*c.n34+ia[d].w,b<=e)return!1;return!0}function m(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?m(h,e):m(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?m(k,f):m(j,f))}else(f=c)&&(f.transparent?m(k,f):m(j,f))}function y(b,c){return c.z-b.z}function D(b){var c,k,m,H=0,q,t,L,z,r=b.lights;sa||(sa=new THREE.PerspectiveCamera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));c=0;for(k=r.length;c<k;c++)if(m=r[c],m instanceof THREE.SpotLight&&m.castShadow){N=-1;M.shadowMap[H]||(M.shadowMap[H]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,
 0;for(e=i.materials.length;c<e;c++)(f=i.materials[c])&&(f.transparent?m(k,f):m(j,f))}else(f=c)&&(f.transparent?m(k,f):m(j,f))}function y(b,c){return c.z-b.z}function D(b){var c,k,m,H=0,q,t,L,z,r=b.lights;sa||(sa=new THREE.PerspectiveCamera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));c=0;for(k=r.length;c<k;c++)if(m=r[c],m instanceof THREE.SpotLight&&m.castShadow){N=-1;M.shadowMap[H]||(M.shadowMap[H]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,
-{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Ua[H]||(Ua[H]=new THREE.Matrix4);q=M.shadowMap[H];t=Ua[H];sa.position.copy(m.position);sa.lookAt(m.target.position);sa.update(void 0,!0);b.update(void 0,!1,sa);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(sa.projectionMatrix);t.multiplySelf(sa.matrixWorldInverse);sa.matrixWorldInverse.flattenToArray(Wa);sa.projectionMatrix.flattenToArray(Va);Ga.multiply(sa.projectionMatrix,sa.matrixWorldInverse);
-o(Ga);M.initWebGLObjects(b);S(q);e.clearColor(1,1,1,1);M.clear();e.clearColor(Y.r,Y.g,Y.b,Ha);t=b.__webglObjects.length;m=b.__webglObjectsImmediate.length;for(q=0;q<t;q++)L=b.__webglObjects[q],z=L.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||p(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,sa,!1),L.render=!0):L.render=!1:L.render=!1;j(!0);K(THREE.NormalBlending);for(q=0;q<t;q++)if(L=b.__webglObjects[q],L.render)z=L.object,buffer=L.buffer,h(z),L=z.customDepthMaterial?
-z.customDepthMaterial:z.geometry.morphTargets.length?$a:Ma,f(sa,r,null,L,buffer,z);for(q=0;q<m;q++)L=b.__webglObjectsImmediate[q],z=L.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,sa,!1),h(z),program=d(sa,r,null,Ma,z),z.immediateRenderCallback?z.immediateRenderCallback(program,e,ia):z.render(function(b){i(b,program,Ma.shading)}));H++}}function F(b,c){var d,f,h;d=r.attributes;var i=r.uniforms,j=Aa/Ea,k,z=[],o=Ea*0.5,m=Aa*0.5,p=!0;e.useProgram(r.program);
-Xa=r.program;Z=ca=ma=-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<
+{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Ta[H]||(Ta[H]=new THREE.Matrix4);q=M.shadowMap[H];t=Ta[H];sa.position.copy(m.position);sa.lookAt(m.target.position);sa.update(void 0,!0);b.update(void 0,!1,sa);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(sa.projectionMatrix);t.multiplySelf(sa.matrixWorldInverse);sa.matrixWorldInverse.flattenToArray(Va);sa.projectionMatrix.flattenToArray(Ua);Ga.multiply(sa.projectionMatrix,sa.matrixWorldInverse);
+o(Ga);M.initWebGLObjects(b);S(q);e.clearColor(1,1,1,1);M.clear();e.clearColor(Z.r,Z.g,Z.b,Ha);t=b.__webglObjects.length;m=b.__webglObjectsImmediate.length;for(q=0;q<t;q++)L=b.__webglObjects[q],z=L.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||p(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,sa,!1),L.render=!0):L.render=!1:L.render=!1;j(!0);K(THREE.NormalBlending);for(q=0;q<t;q++)if(L=b.__webglObjects[q],L.render)z=L.object,buffer=L.buffer,h(z),L=z.customDepthMaterial?
+z.customDepthMaterial:z.geometry.morphTargets.length?$a:Wa,f(sa,r,null,L,buffer,z);for(q=0;q<m;q++)L=b.__webglObjectsImmediate[q],z=L.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),U=-1,E(z,sa,!1),h(z),program=d(sa,r,null,Wa,z),z.immediateRenderCallback?z.immediateRenderCallback(program,e,ia):z.render(function(b){i(b,program,Wa.shading)}));H++}}function F(b,c){var d,f,h;d=r.attributes;var i=r.uniforms,j=Aa/Ea,k,z=[],o=Ea*0.5,m=Aa*0.5,p=!0;e.useProgram(r.program);
+Xa=r.program;U=ca=X=-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,Ua);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(y);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-o)/o,(m-h.position.y)/
 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(y);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-o)/o,(m-h.position.y)/
 m,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?Aa:1),z[0]=k*j*h.scale.x,z[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,
 m,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?Aa:1),z[0]=k*j*h.scale.x,z[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,z),h.mergeWith3D&&!p?(e.enable(e.DEPTH_TEST),p=!0):!h.mergeWith3D&&p&&(e.disable(e.DEPTH_TEST),p=!1),K(h.blending),U(h.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(J)}function E(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+h.color.b),e.uniform1f(i.rotation,h.rotation),e.uniform2fv(i.scale,z),h.mergeWith3D&&!p?(e.enable(e.DEPTH_TEST),p=!0):!h.mergeWith3D&&p&&(e.disable(e.DEPTH_TEST),p=!1),K(h.blending),la(h.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(J)}function E(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
 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)if(d.attributes[c].needsUpdate)return!0;return!1}function ya(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 ra(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function ta(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);
 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)if(d.attributes[c].needsUpdate)return!0;return!1}function ya(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 ra(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function ta(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,o,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}),o=m[k].hash+"_"+m[k].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:j,vertices:0,numMorphTargets:p}),i=i instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+i>65535&&(m[k].counter+=1,o=m[k].hash+"_"+m[k].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]=
 return f.join("_")}var e,d,f,h,i,j,k,o,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}),o=m[k].hash+"_"+m[k].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:j,vertices:0,numMorphTargets:p}),i=i instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+i>65535&&(m[k].counter+=1,o=m[k].hash+"_"+m[k].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]=
-{faces:[],materials:j,vertices:0,numMorphTargets:p})),b.geometryGroups[o].faces.push(f),b.geometryGroups[o].vertices+=i;b.geometryGroupsList=[];for(var q in b.geometryGroups)b.geometryGroups[q].id=I++,b.geometryGroupsList.push(b.geometryGroups[q])}function ka(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=ma){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)}ma=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,T(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,T(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,T(c.magFilter)),
-e.texParameteri(b,e.TEXTURE_MIN_FILTER,T(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,za(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,za(c.minFilter)))}function U(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
+{faces:[],materials:j,vertices:0,numMorphTargets:p})),b.geometryGroups[o].faces.push(f),b.geometryGroups[o].vertices+=i;b.geometryGroupsList=[];for(var q in b.geometryGroups)b.geometryGroups[q].id=I++,b.geometryGroupsList.push(b.geometryGroups[q])}function ka(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=X){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)}X=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,T(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,T(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,T(c.magFilter)),
+e.texParameteri(b,e.TEXTURE_MIN_FILTER,T(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,za(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,za(c.minFilter)))}function la(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,T(b.format),b.image.width,b.image.height,0,T(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 S(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;
 THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,T(b.format),b.image.width,b.image.height,0,T(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 S(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;
 b.__webglRenderbuffer=e.createRenderbuffer();b.__webglTexture=e.createTexture();if(c){e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture);u(e.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=e.createFramebuffer(),e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,T(b.format),b.width,b.height,0,T(b.format),T(b.type),null)}else b.__webglFramebuffer=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),u(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,T(b.format),
 b.__webglRenderbuffer=e.createRenderbuffer();b.__webglTexture=e.createTexture();if(c){e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture);u(e.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=e.createFramebuffer(),e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,T(b.format),b.width,b.height,0,T(b.format),T(b.type),null)}else b.__webglFramebuffer=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),u(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,T(b.format),
 b.width,b.height,0,T(b.format),T(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,0);else e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,
 b.width,b.height,0,T(b.format),T(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,0);else e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,
 e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height);c?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,
 e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height);c?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,
-null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=f=0):(c=null,d=Ea,b=Aa,f=Ka,h=Ca);c!=wa&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),wa=c)}function la(b){b instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,b.__webglTexture),e.generateMipmap(e.TEXTURE_2D),
+null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=f=0):(c=null,d=Ea,b=Aa,f=Ja,h=Ca);c!=wa&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),wa=c)}function ma(b){b instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,b.__webglTexture),e.generateMipmap(e.TEXTURE_2D),
 e.bindTexture(e.TEXTURE_2D,null))}function aa(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 za(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function T(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;
 e.bindTexture(e.TEXTURE_2D,null))}function aa(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 za(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function T(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.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,va=[],Xa=
 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,va=[],Xa=
-null,wa=null,N=-1,Z=null,I=0,W=null,X=null,ma=null,ca=null,J=null,Ba=null,Ja=null,Ta=null,Ka=0,Ca=0,Ea=0,Aa=0,ia=[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||{},Da=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-V=b.stencil!==void 0?b.stencil:!0,db=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,eb=b.antialias!==void 0?b.antialias:!1,Y=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=Da;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 sa,Ua=[],b=THREE.ShaderLib.depthRGBA,bb=THREE.UniformsUtils.clone(b.uniforms),Ma=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});Ma._shadowPass=!0;$a._shadowPass=!0;try{if(!(e=Da.getContext("experimental-webgl",{antialias:eb,stencil:V,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(Y.r,Y.g,Y.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);V=0;r.vertices[V++]=-1;r.vertices[V++]=-1;r.vertices[V++]=0;r.vertices[V++]=1;r.vertices[V++]=1;r.vertices[V++]=-1;r.vertices[V++]=1;r.vertices[V++]=1;r.vertices[V++]=1;r.vertices[V++]=
+null,wa=null,N=-1,U=null,I=0,W=null,Y=null,X=null,ca=null,J=null,Ba=null,Na=null,Sa=null,Ja=0,Ca=0,Ea=0,Aa=0,ia=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ga=new THREE.Matrix4,Ua=new Float32Array(16),Va=new Float32Array(16),La=new THREE.Vector4,Za={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Da=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
+V=b.stencil!==void 0?b.stencil:!0,db=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,eb=b.antialias!==void 0?b.antialias:!1,Z=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=Da;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 sa,Ta=[],b=THREE.ShaderLib.depthRGBA,bb=THREE.UniformsUtils.clone(b.uniforms),Wa=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});Wa._shadowPass=!0;$a._shadowPass=!0;try{if(!(e=Da.getContext("experimental-webgl",{antialias:eb,stencil:V,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(Z.r,Z.g,Z.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);V=0;r.vertices[V++]=-1;r.vertices[V++]=-1;r.vertices[V++]=0;r.vertices[V++]=1;r.vertices[V++]=1;r.vertices[V++]=-1;r.vertices[V++]=1;r.vertices[V++]=1;r.vertices[V++]=1;r.vertices[V++]=
 1;r.vertices[V++]=1;r.vertices[V++]=0;r.vertices[V++]=-1;r.vertices[V++]=1;r.vertices[V++]=0;V=r.vertices[V++]=0;r.faces[V++]=0;r.faces[V++]=1;r.faces[V++]=2;r.faces[V++]=0;r.faces[V++]=2;r.faces[V++]=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();
 1;r.vertices[V++]=1;r.vertices[V++]=0;r.vertices[V++]=-1;r.vertices[V++]=1;r.vertices[V++]=0;V=r.vertices[V++]=0;r.faces[V++]=0;r.faces[V++]=1;r.faces[V++]=2;r.faces[V++]=0;r.faces[V++]=2;r.faces[V++]=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();
 e.attachShader(r.program,aa("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(r.program,aa("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(r.program);r.attributes={};r.uniforms={};r.attributes.position=e.getAttribLocation(r.program,"position");r.attributes.uv=e.getAttribLocation(r.program,"uv");r.uniforms.uvOffset=e.getUniformLocation(r.program,"uvOffset");r.uniforms.uvScale=e.getUniformLocation(r.program,"uvScale");r.uniforms.rotation=e.getUniformLocation(r.program,"rotation");
 e.attachShader(r.program,aa("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(r.program,aa("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(r.program);r.attributes={};r.uniforms={};r.attributes.position=e.getAttribLocation(r.program,"position");r.attributes.uv=e.getAttribLocation(r.program,"uv");r.uniforms.uvOffset=e.getUniformLocation(r.program,"uvOffset");r.uniforms.uvScale=e.getUniformLocation(r.program,"uvScale");r.uniforms.rotation=e.getUniformLocation(r.program,"rotation");
 r.uniforms.scale=e.getUniformLocation(r.program,"scale");r.uniforms.alignment=e.getUniformLocation(r.program,"alignment");r.uniforms.color=e.getUniformLocation(r.program,"color");r.uniforms.map=e.getUniformLocation(r.program,"map");r.uniforms.opacity=e.getUniformLocation(r.program,"opacity");r.uniforms.useScreenCoordinates=e.getUniformLocation(r.program,"useScreenCoordinates");r.uniforms.affectedByDistance=e.getUniformLocation(r.program,"affectedByDistance");r.uniforms.screenPosition=e.getUniformLocation(r.program,
 r.uniforms.scale=e.getUniformLocation(r.program,"scale");r.uniforms.alignment=e.getUniformLocation(r.program,"alignment");r.uniforms.color=e.getUniformLocation(r.program,"color");r.uniforms.map=e.getUniformLocation(r.program,"map");r.uniforms.opacity=e.getUniformLocation(r.program,"opacity");r.uniforms.useScreenCoordinates=e.getUniformLocation(r.program,"useScreenCoordinates");r.uniforms.affectedByDistance=e.getUniformLocation(r.program,"affectedByDistance");r.uniforms.screenPosition=e.getUniformLocation(r.program,
-"screenPosition");r.uniforms.modelViewMatrix=e.getUniformLocation(r.program,"modelViewMatrix");r.uniforms.projectionMatrix=e.getUniformLocation(r.program,"projectionMatrix");var ab=!1;this.setSize=function(b,c){Da.width=b;Da.height=c;this.setViewport(0,0,Da.width,Da.height)};this.setViewport=function(b,c,d,f){Ka=b;Ca=c;Ea=d;Aa=f;e.viewport(Ka,Ca,Ea,Aa)};this.setScissor=function(b,c,d,f){e.scissor(b,c,d,f)};this.enableScissorTest=function(b){b?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=
-function(b,c){Y.setHex(b);Ha=c;e.clearColor(Y.r,Y.g,Y.b,Ha)};this.setClearColor=function(b,c){Y.copy(b);Ha=c;e.clearColor(Y.r,Y.g,Y.b,Ha)};this.getClearColor=function(){return Y};this.getClearAlpha=function(){return Ha};this.clear=function(b,c,d){var f=0;if(b==void 0||b)f|=e.COLOR_BUFFER_BIT;if(c==void 0||c)f|=e.DEPTH_BUFFER_BIT;if(d==void 0||d)f|=e.STENCIL_BUFFER_BIT;e.clear(f)};this.getContext=function(){return e};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,
+"screenPosition");r.uniforms.modelViewMatrix=e.getUniformLocation(r.program,"modelViewMatrix");r.uniforms.projectionMatrix=e.getUniformLocation(r.program,"projectionMatrix");var ab=!1;this.setSize=function(b,c){Da.width=b;Da.height=c;this.setViewport(0,0,Da.width,Da.height)};this.setViewport=function(b,c,d,f){Ja=b;Ca=c;Ea=d;Aa=f;e.viewport(Ja,Ca,Ea,Aa)};this.setScissor=function(b,c,d,f){e.scissor(b,c,d,f)};this.enableScissorTest=function(b){b?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=
+function(b,c){Z.setHex(b);Ha=c;e.clearColor(Z.r,Z.g,Z.b,Ha)};this.setClearColor=function(b,c){Z.copy(b);Ha=c;e.clearColor(Z.r,Z.g,Z.b,Ha)};this.getClearColor=function(){return Z};this.getClearAlpha=function(){return Ha};this.clear=function(b,c,d){var f=0;if(b==void 0||b)f|=e.COLOR_BUFFER_BIT;if(c==void 0||c)f|=e.DEPTH_BUFFER_BIT;if(d==void 0||d)f|=e.STENCIL_BUFFER_BIT;e.clear(f)};this.getContext=function(){return e};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 c=b.geometry.geometryGroups[g];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer);
 delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer);
 e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);M.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),
 e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);M.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),
 M.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,e.deleteTexture(b.__webglTexture),M.info.memory.textures--};this.initMaterial=function(b,c,d,f){var h,i,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":
 M.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,e.deleteTexture(b.__webglTexture),M.info.memory.textures--};this.initMaterial=function(b,c,d,f){var h,i,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":
@@ -247,12 +247,12 @@ d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_W
 e.getError()+"]");A.uniforms={};A.attributes={};var x,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in o)f.push(x);x=f;f=0;for(o=x.length;f<o;f++)m=x[f],A.uniforms[m]=e.getUniformLocation(A,m);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<d.maxMorphTargets;x++)f.push("morphTarget"+x);for(r in c)f.push(r);
 e.getError()+"]");A.uniforms={};A.attributes={};var x,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in o)f.push(x);x=f;f=0;for(o=x.length;f<o;f++)m=x[f],A.uniforms[m]=e.getUniformLocation(A,m);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<d.maxMorphTargets;x++)f.push("morphTarget"+x);for(r in c)f.push(r);
 r=f;x=0;for(c=r.length;x<c;x++)d=r[x],A.attributes[d]=e.getAttribLocation(A,d);A.id=va.length;va.push({program:A,code:k});M.info.memory.programs=va.length;r=A}b.program=r;r=b.program.attributes;r.position>=0&&e.enableVertexAttribArray(r.position);r.color>=0&&e.enableVertexAttribArray(r.color);r.normal>=0&&e.enableVertexAttribArray(r.normal);r.tangent>=0&&e.enableVertexAttribArray(r.tangent);b.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0&&(e.enableVertexAttribArray(r.skinVertexA),
 r=f;x=0;for(c=r.length;x<c;x++)d=r[x],A.attributes[d]=e.getAttribLocation(A,d);A.id=va.length;va.push({program:A,code:k});M.info.memory.programs=va.length;r=A}b.program=r;r=b.program.attributes;r.position>=0&&e.enableVertexAttribArray(r.position);r.color>=0&&e.enableVertexAttribArray(r.color);r.normal>=0&&e.enableVertexAttribArray(r.normal);r.tangent>=0&&e.enableVertexAttribArray(r.tangent);b.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0&&(e.enableVertexAttribArray(r.skinVertexA),
 e.enableVertexAttribArray(r.skinVertexB),e.enableVertexAttribArray(r.skinIndex),e.enableVertexAttribArray(r.skinWeight));if(b.attributes)for(i in b.attributes)r[i]!==void 0&&r[i]>=0&&e.enableVertexAttribArray(r[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)x="morphTarget"+i,r[x]>=0&&(e.enableVertexAttribArray(r[x]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,e){S(b);
 e.enableVertexAttribArray(r.skinVertexB),e.enableVertexAttribArray(r.skinIndex),e.enableVertexAttribArray(r.skinWeight));if(b.attributes)for(i in b.attributes)r[i]!==void 0&&r[i]>=0&&e.enableVertexAttribArray(r[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)x="morphTarget"+i,r[x]>=0&&(e.enableVertexAttribArray(r[x]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,e){S(b);
-this.clear(c,d,e)};this.render=function(b,c,m,r){var H,La,u,L,z,I,Q,G,Ra=b.lights,Fa=b.fog;N=-1;this.shadowMapEnabled&&D(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);o(Ga);this.initWebGLObjects(b);S(m);(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
-z=b.__webglObjects.length;for(r=0;r<z;r++)if(H=b.__webglObjects[r],Q=H.object,Q.visible)if(!(Q instanceof THREE.Mesh)||!Q.frustumCulled||p(Q)){if(Q.matrixWorld.flattenToArray(Q._objectMatrixArray),E(Q,c,!0),v(H),H.render=!0,this.sortObjects)H.object.renderDepth?H.z=H.object.renderDepth:(Sa.copy(Q.position),Ga.multiplyVector3(Sa),H.z=Sa.z)}else H.render=!1;else H.render=!1;this.sortObjects&&b.__webglObjects.sort(y);I=b.__webglObjectsImmediate.length;for(r=0;r<I;r++)H=b.__webglObjectsImmediate[r],Q=
-H.object,Q.visible&&(Q.matrixAutoUpdate&&Q.matrixWorld.flattenToArray(Q._objectMatrixArray),E(Q,c,!0),t(H));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(r=0;r<z;r++)if(H=b.__webglObjects[r],H.render)Q=H.object,G=H.buffer,h(Q),f(c,Ra,Fa,b.overrideMaterial,G,Q);for(r=0;r<I;r++)H=b.__webglObjectsImmediate[r],Q=H.object,Q.visible&&(h(Q),La=d(c,Ra,Fa,b.overrideMaterial,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(La,e,ia):Q.render(function(b){i(b,
-La,Ma.shading)}))}else{K(THREE.NormalBlending);for(r=z-1;r>=0;r--)if(H=b.__webglObjects[r],H.render){Q=H.object;G=H.buffer;u=H.opaque;h(Q);for(H=0;H<u.count;H++)L=u.list[H],j(L.depthTest),k(L.depthWrite),q(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),f(c,Ra,Fa,L,G,Q)}for(r=0;r<I;r++)if(H=b.__webglObjectsImmediate[r],Q=H.object,Q.visible){u=H.opaque;h(Q);for(H=0;H<u.count;H++)L=u.list[H],j(L.depthTest),k(L.depthWrite),q(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),La=
-d(c,Ra,Fa,L,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(La,e,ia):Q.render(function(b){i(b,La,Ma.shading)})}for(r=0;r<z;r++)if(H=b.__webglObjects[r],H.render){Q=H.object;G=H.buffer;u=H.transparent;h(Q);for(H=0;H<u.count;H++)L=u.list[H],K(L.blending),j(L.depthTest),k(L.depthWrite),q(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),f(c,Ra,Fa,L,G,Q)}for(r=0;r<I;r++)if(H=b.__webglObjectsImmediate[r],Q=H.object,Q.visible){u=H.transparent;h(Q);for(H=0;H<u.count;H++)L=u.list[H],K(L.blending),
-j(L.depthTest),k(L.depthWrite),q(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),La=d(c,Ra,Fa,L,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(La,e,ia):Q.render(function(b){i(b,La,Ma.shading)})}}b.__webglSprites.length&&F(b,c);m&&m.minFilter!==THREE.NearestFilter&&m.minFilter!==THREE.LinearFilter&&la(m)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],
+this.clear(c,d,e)};this.render=function(b,c,m,r){var H,Ka,u,L,z,I,Q,G,Ra=b.lights,Fa=b.fog;N=-1;this.shadowMapEnabled&&D(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(Va);c.projectionMatrix.flattenToArray(Ua);Ga.multiply(c.projectionMatrix,c.matrixWorldInverse);o(Ga);this.initWebGLObjects(b);S(m);(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
+z=b.__webglObjects.length;for(r=0;r<z;r++)if(H=b.__webglObjects[r],Q=H.object,Q.visible)if(!(Q instanceof THREE.Mesh)||!Q.frustumCulled||p(Q)){if(Q.matrixWorld.flattenToArray(Q._objectMatrixArray),E(Q,c,!0),v(H),H.render=!0,this.sortObjects)H.object.renderDepth?H.z=H.object.renderDepth:(La.copy(Q.position),Ga.multiplyVector3(La),H.z=La.z)}else H.render=!1;else H.render=!1;this.sortObjects&&b.__webglObjects.sort(y);I=b.__webglObjectsImmediate.length;for(r=0;r<I;r++)H=b.__webglObjectsImmediate[r],Q=
+H.object,Q.visible&&(Q.matrixAutoUpdate&&Q.matrixWorld.flattenToArray(Q._objectMatrixArray),E(Q,c,!0),t(H));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(r=0;r<z;r++)if(H=b.__webglObjects[r],H.render)Q=H.object,G=H.buffer,h(Q),f(c,Ra,Fa,b.overrideMaterial,G,Q);for(r=0;r<I;r++)H=b.__webglObjectsImmediate[r],Q=H.object,Q.visible&&(U=-1,h(Q),Ka=d(c,Ra,Fa,b.overrideMaterial,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(Ka,e,ia):Q.render(function(c){i(c,
+Ka,b.overrideMaterial.shading)}))}else{K(THREE.NormalBlending);for(r=z-1;r>=0;r--)if(H=b.__webglObjects[r],H.render){Q=H.object;G=H.buffer;u=H.opaque;h(Q);for(H=0;H<u.count;H++)L=u.list[H],j(L.depthTest),k(L.depthWrite),q(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),f(c,Ra,Fa,L,G,Q)}for(r=0;r<I;r++)if(H=b.__webglObjectsImmediate[r],Q=H.object,Q.visible){U=-1;u=H.opaque;h(Q);for(H=0;H<u.count;H++)L=u.list[H],j(L.depthTest),k(L.depthWrite),q(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),
+Ka=d(c,Ra,Fa,L,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(Ka,e,ia):Q.render(function(b){i(b,Ka,L.shading)})}for(r=0;r<z;r++)if(H=b.__webglObjects[r],H.render){Q=H.object;G=H.buffer;u=H.transparent;h(Q);for(H=0;H<u.count;H++)L=u.list[H],K(L.blending),j(L.depthTest),k(L.depthWrite),q(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),f(c,Ra,Fa,L,G,Q)}for(r=0;r<I;r++)if(H=b.__webglObjectsImmediate[r],Q=H.object,Q.visible){U=-1;u=H.transparent;h(Q);for(H=0;H<u.count;H++)L=u.list[H],
+K(L.blending),j(L.depthTest),k(L.depthWrite),q(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),Ka=d(c,Ra,Fa,L,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(Ka,e,ia):Q.render(function(b){i(b,Ka,L.shading)})}}b.__webglSprites.length&&F(b,c);m&&m.minFilter!==THREE.NearestFilter&&m.minFilter!==THREE.LinearFilter&&ma(m)};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&&ta(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=e.createBuffer();k.__webglNormalBuffer=e.createBuffer();
 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&&ta(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 o=void 0,m=void 0;k.__webglMorphTargetsBuffers=[];o=0;for(m=k.numMorphTargets;o<
 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 o=void 0,m=void 0;k.__webglMorphTargetsBuffers=[];o=0;for(m=k.numMorphTargets;o<
 m;o++)k.__webglMorphTargetsBuffers.push(e.createBuffer())}M.info.memory.geometries++;for(var k=d,p=void 0,q=void 0,r=void 0,t=r=void 0,u=void 0,A=void 0,x=A=o=0,v=r=q=void 0,r=m=v=q=p=void 0,t=k.geometry,u=t.faces,v=j.faces,p=0,q=v.length;p<q;p++)r=v[p],r=u[r],r instanceof THREE.Face3?(o+=3,A+=1,x+=3):r instanceof THREE.Face4&&(o+=4,A+=2,x+=4);for(var p=j,q=k,D=v=u=void 0,y=void 0,D=void 0,r=[],u=0,v=q.materials.length;u<v;u++)if(D=q.materials[u],D instanceof THREE.MeshFaceMaterial){D=0;for(l=p.materials.length;D<
 m;o++)k.__webglMorphTargetsBuffers.push(e.createBuffer())}M.info.memory.geometries++;for(var k=d,p=void 0,q=void 0,r=void 0,t=r=void 0,u=void 0,A=void 0,x=A=o=0,v=r=q=void 0,r=m=v=q=p=void 0,t=k.geometry,u=t.faces,v=j.faces,p=0,q=v.length;p<q;p++)r=v[p],r=u[r],r instanceof THREE.Face3?(o+=3,A+=1,x+=3):r instanceof THREE.Face4&&(o+=4,A+=2,x+=4);for(var p=j,q=k,D=v=u=void 0,y=void 0,D=void 0,r=[],u=0,v=q.materials.length;u<v;u++)if(D=q.materials[u],D instanceof THREE.MeshFaceMaterial){D=0;for(l=p.materials.length;D<
@@ -267,26 +267,26 @@ 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],ka(f.__webglObjects,j,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,ka(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&&
 !0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ka(f.__webglObjects,j,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,ka(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)ra(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)&&ra(f.__webglObjectsImmediate,d);d.__webglActive=
 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)ra(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)&&ra(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(o=h.geometryGroupsList.length;k<o;k++)if(j=h.geometryGroupsList[k],m=xa(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||m)if(m=j,A=e.DYNAMIC_DRAW,x=!h.dynamic,m.__inittedArrays){var E=p=t=void 0,B=void 0,I=E=void 0,F=void 0,K=void 0,R=void 0,O=y=D=r=
 !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(o=h.geometryGroupsList.length;k<o;k++)if(j=h.geometryGroupsList[k],m=xa(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||m)if(m=j,A=e.DYNAMIC_DRAW,x=!h.dynamic,m.__inittedArrays){var E=p=t=void 0,B=void 0,I=E=void 0,F=void 0,K=void 0,R=void 0,O=y=D=r=
-v=u=q=void 0,P=void 0,J=void 0,s=B=R=B=K=F=void 0,n=void 0,C=n=s=F=void 0,S=void 0,V=C=n=s=E=E=I=R=B=C=n=s=S=C=n=s=S=C=n=s=void 0,ja=0,N=0,X=0,aa=0,W=0,T=0,$=0,U=0,na=0,w=0,oa=0,C=s=0,C=void 0,pa=m.__vertexArray,la=m.__uvArray,ma=m.__uv2Array,Z=m.__normalArray,da=m.__tangentArray,qa=m.__colorArray,ea=m.__skinVertexAArray,fa=m.__skinVertexBArray,ga=m.__skinIndexArray,ha=m.__skinWeightArray,sa=m.__morphTargetsArrays,ca=m.__webglCustomAttributes,n=void 0,ia=m.__faceArray,Y=m.__lineArray,za=m.__needsSmoothNormals,
-u=m.__vertexColorType,q=m.__uvType,v=m.__normalType,ua=i.geometry,wa=ua.__dirtyVertices,Aa=ua.__dirtyElements,va=ua.__dirtyUvs,Ba=ua.__dirtyNormals,Ca=ua.__dirtyTangents,Ea=ua.__dirtyColors,Ga=ua.__dirtyMorphTargets,Da=ua.vertices,Ha=m.faces,Ma=ua.faces,Ja=ua.faceVertexUvs[0],Ka=ua.faceVertexUvs[1],Oa=ua.skinVerticesA,Pa=ua.skinVerticesB,Qa=ua.skinIndices,Na=ua.skinWeights,Ia=ua.morphTargets;if(ca)for(V in ca)ca[V].offset=0,ca[V].offsetSrc=0;t=0;for(p=Ha.length;t<p;t++)if(E=Ha[t],B=Ma[E],Ja&&(r=Ja[E]),
-Ka&&(D=Ka[E]),E=B.vertexNormals,I=B.normal,F=B.vertexColors,K=B.color,R=B.vertexTangents,B instanceof THREE.Face3){if(wa)y=Da[B.a].position,O=Da[B.b].position,P=Da[B.c].position,pa[N]=y.x,pa[N+1]=y.y,pa[N+2]=y.z,pa[N+3]=O.x,pa[N+4]=O.y,pa[N+5]=O.z,pa[N+6]=P.x,pa[N+7]=P.y,pa[N+8]=P.z,N+=9;if(ca)for(V in ca)if(n=ca[V],n.__original.needsUpdate)s=n.offset,C=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[s]=n.value[B.a],n.array[s+1]=n.value[B.b],n.array[s+2]=n.value[B.c]):
+v=u=q=void 0,P=void 0,J=void 0,s=B=R=B=K=F=void 0,n=void 0,C=n=s=F=void 0,S=void 0,V=C=n=s=E=E=I=R=B=C=n=s=S=C=n=s=S=C=n=s=void 0,ja=0,N=0,Y=0,aa=0,W=0,T=0,$=0,U=0,na=0,w=0,oa=0,C=s=0,C=void 0,pa=m.__vertexArray,la=m.__uvArray,ma=m.__uv2Array,X=m.__normalArray,da=m.__tangentArray,qa=m.__colorArray,ea=m.__skinVertexAArray,fa=m.__skinVertexBArray,ga=m.__skinIndexArray,ha=m.__skinWeightArray,sa=m.__morphTargetsArrays,ca=m.__webglCustomAttributes,n=void 0,ia=m.__faceArray,Z=m.__lineArray,za=m.__needsSmoothNormals,
+u=m.__vertexColorType,q=m.__uvType,v=m.__normalType,ua=i.geometry,wa=ua.__dirtyVertices,Aa=ua.__dirtyElements,va=ua.__dirtyUvs,Ba=ua.__dirtyNormals,Ca=ua.__dirtyTangents,Ea=ua.__dirtyColors,Ga=ua.__dirtyMorphTargets,Da=ua.vertices,Ha=m.faces,Na=ua.faces,Ja=ua.faceVertexUvs[0],La=ua.faceVertexUvs[1],Oa=ua.skinVerticesA,Pa=ua.skinVerticesB,Qa=ua.skinIndices,Ma=ua.skinWeights,Ia=ua.morphTargets;if(ca)for(V in ca)ca[V].offset=0,ca[V].offsetSrc=0;t=0;for(p=Ha.length;t<p;t++)if(E=Ha[t],B=Na[E],Ja&&(r=Ja[E]),
+La&&(D=La[E]),E=B.vertexNormals,I=B.normal,F=B.vertexColors,K=B.color,R=B.vertexTangents,B instanceof THREE.Face3){if(wa)y=Da[B.a].position,O=Da[B.b].position,P=Da[B.c].position,pa[N]=y.x,pa[N+1]=y.y,pa[N+2]=y.z,pa[N+3]=O.x,pa[N+4]=O.y,pa[N+5]=O.z,pa[N+6]=P.x,pa[N+7]=P.y,pa[N+8]=P.z,N+=9;if(ca)for(V in ca)if(n=ca[V],n.__original.needsUpdate)s=n.offset,C=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[s]=n.value[B.a],n.array[s+1]=n.value[B.b],n.array[s+2]=n.value[B.c]):
 n.boundTo==="faces"?(C=n.value[C],n.array[s]=C,n.array[s+1]=C,n.array[s+2]=C,n.offsetSrc++):n.boundTo==="faceVertices"&&(n.array[s]=n.value[C],n.array[s+1]=n.value[C+1],n.array[s+2]=n.value[C+2],n.offsetSrc+=3),n.offset+=3):(n.boundTo===void 0||n.boundTo==="vertices"?(y=n.value[B.a],O=n.value[B.b],P=n.value[B.c]):n.boundTo==="faces"?(P=O=y=C=n.value[C],n.offsetSrc++):n.boundTo==="faceVertices"&&(y=n.value[C],O=n.value[C+1],P=n.value[C+2],n.offsetSrc+=3),n.size===2?(n.array[s]=y.x,n.array[s+1]=y.y,
 n.boundTo==="faces"?(C=n.value[C],n.array[s]=C,n.array[s+1]=C,n.array[s+2]=C,n.offsetSrc++):n.boundTo==="faceVertices"&&(n.array[s]=n.value[C],n.array[s+1]=n.value[C+1],n.array[s+2]=n.value[C+2],n.offsetSrc+=3),n.offset+=3):(n.boundTo===void 0||n.boundTo==="vertices"?(y=n.value[B.a],O=n.value[B.b],P=n.value[B.c]):n.boundTo==="faces"?(P=O=y=C=n.value[C],n.offsetSrc++):n.boundTo==="faceVertices"&&(y=n.value[C],O=n.value[C+1],P=n.value[C+2],n.offsetSrc+=3),n.size===2?(n.array[s]=y.x,n.array[s+1]=y.y,
 n.array[s+2]=O.x,n.array[s+3]=O.y,n.array[s+4]=P.x,n.array[s+5]=P.y,n.offset+=6):n.size===3?(n.type==="c"?(n.array[s]=y.r,n.array[s+1]=y.g,n.array[s+2]=y.b,n.array[s+3]=O.r,n.array[s+4]=O.g,n.array[s+5]=O.b,n.array[s+6]=P.r,n.array[s+7]=P.g,n.array[s+8]=P.b):(n.array[s]=y.x,n.array[s+1]=y.y,n.array[s+2]=y.z,n.array[s+3]=O.x,n.array[s+4]=O.y,n.array[s+5]=O.z,n.array[s+6]=P.x,n.array[s+7]=P.y,n.array[s+8]=P.z),n.offset+=9):(n.array[s]=y.x,n.array[s+1]=y.y,n.array[s+2]=y.z,n.array[s+3]=y.w,n.array[s+
 n.array[s+2]=O.x,n.array[s+3]=O.y,n.array[s+4]=P.x,n.array[s+5]=P.y,n.offset+=6):n.size===3?(n.type==="c"?(n.array[s]=y.r,n.array[s+1]=y.g,n.array[s+2]=y.b,n.array[s+3]=O.r,n.array[s+4]=O.g,n.array[s+5]=O.b,n.array[s+6]=P.r,n.array[s+7]=P.g,n.array[s+8]=P.b):(n.array[s]=y.x,n.array[s+1]=y.y,n.array[s+2]=y.z,n.array[s+3]=O.x,n.array[s+4]=O.y,n.array[s+5]=O.z,n.array[s+6]=P.x,n.array[s+7]=P.y,n.array[s+8]=P.z),n.offset+=9):(n.array[s]=y.x,n.array[s+1]=y.y,n.array[s+2]=y.z,n.array[s+3]=y.w,n.array[s+
-4]=O.x,n.array[s+5]=O.y,n.array[s+6]=O.z,n.array[s+7]=O.w,n.array[s+8]=P.x,n.array[s+9]=P.y,n.array[s+10]=P.z,n.array[s+11]=P.w,n.offset+=12));if(Ga){s=0;for(n=Ia.length;s<n;s++)y=Ia[s].vertices[B.a].position,O=Ia[s].vertices[B.b].position,P=Ia[s].vertices[B.c].position,C=sa[s],C[oa]=y.x,C[oa+1]=y.y,C[oa+2]=y.z,C[oa+3]=O.x,C[oa+4]=O.y,C[oa+5]=O.z,C[oa+6]=P.x,C[oa+7]=P.y,C[oa+8]=P.z;oa+=9}if(Na.length)s=Na[B.a],n=Na[B.b],C=Na[B.c],ha[w]=s.x,ha[w+1]=s.y,ha[w+2]=s.z,ha[w+3]=s.w,ha[w+4]=n.x,ha[w+5]=n.y,
+4]=O.x,n.array[s+5]=O.y,n.array[s+6]=O.z,n.array[s+7]=O.w,n.array[s+8]=P.x,n.array[s+9]=P.y,n.array[s+10]=P.z,n.array[s+11]=P.w,n.offset+=12));if(Ga){s=0;for(n=Ia.length;s<n;s++)y=Ia[s].vertices[B.a].position,O=Ia[s].vertices[B.b].position,P=Ia[s].vertices[B.c].position,C=sa[s],C[oa]=y.x,C[oa+1]=y.y,C[oa+2]=y.z,C[oa+3]=O.x,C[oa+4]=O.y,C[oa+5]=O.z,C[oa+6]=P.x,C[oa+7]=P.y,C[oa+8]=P.z;oa+=9}if(Ma.length)s=Ma[B.a],n=Ma[B.b],C=Ma[B.c],ha[w]=s.x,ha[w+1]=s.y,ha[w+2]=s.z,ha[w+3]=s.w,ha[w+4]=n.x,ha[w+5]=n.y,
 ha[w+6]=n.z,ha[w+7]=n.w,ha[w+8]=C.x,ha[w+9]=C.y,ha[w+10]=C.z,ha[w+11]=C.w,s=Qa[B.a],n=Qa[B.b],C=Qa[B.c],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=n.x,ga[w+5]=n.y,ga[w+6]=n.z,ga[w+7]=n.w,ga[w+8]=C.x,ga[w+9]=C.y,ga[w+10]=C.z,ga[w+11]=C.w,s=Oa[B.a],n=Oa[B.b],C=Oa[B.c],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=n.x,ea[w+5]=n.y,ea[w+6]=n.z,ea[w+7]=1,ea[w+8]=C.x,ea[w+9]=C.y,ea[w+10]=C.z,ea[w+11]=1,s=Pa[B.a],n=Pa[B.b],C=Pa[B.c],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=1,fa[w+4]=n.x,
 ha[w+6]=n.z,ha[w+7]=n.w,ha[w+8]=C.x,ha[w+9]=C.y,ha[w+10]=C.z,ha[w+11]=C.w,s=Qa[B.a],n=Qa[B.b],C=Qa[B.c],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=n.x,ga[w+5]=n.y,ga[w+6]=n.z,ga[w+7]=n.w,ga[w+8]=C.x,ga[w+9]=C.y,ga[w+10]=C.z,ga[w+11]=C.w,s=Oa[B.a],n=Oa[B.b],C=Oa[B.c],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=n.x,ea[w+5]=n.y,ea[w+6]=n.z,ea[w+7]=1,ea[w+8]=C.x,ea[w+9]=C.y,ea[w+10]=C.z,ea[w+11]=1,s=Pa[B.a],n=Pa[B.b],C=Pa[B.c],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=1,fa[w+4]=n.x,
 fa[w+5]=n.y,fa[w+6]=n.z,fa[w+7]=1,fa[w+8]=C.x,fa[w+9]=C.y,fa[w+10]=C.z,fa[w+11]=1,w+=12;if(Ea&&u)F.length==3&&u==THREE.VertexColors?(B=F[0],s=F[1],n=F[2]):n=s=B=K,qa[na]=B.r,qa[na+1]=B.g,qa[na+2]=B.b,qa[na+3]=s.r,qa[na+4]=s.g,qa[na+5]=s.b,qa[na+6]=n.r,qa[na+7]=n.g,qa[na+8]=n.b,na+=9;if(Ca&&ua.hasTangents)F=R[0],K=R[1],B=R[2],da[$]=F.x,da[$+1]=F.y,da[$+2]=F.z,da[$+3]=F.w,da[$+4]=K.x,da[$+5]=K.y,da[$+6]=K.z,da[$+7]=K.w,da[$+8]=B.x,da[$+9]=B.y,da[$+10]=B.z,da[$+11]=B.w,$+=12;if(Ba&&v)if(E.length==3&&
 fa[w+5]=n.y,fa[w+6]=n.z,fa[w+7]=1,fa[w+8]=C.x,fa[w+9]=C.y,fa[w+10]=C.z,fa[w+11]=1,w+=12;if(Ea&&u)F.length==3&&u==THREE.VertexColors?(B=F[0],s=F[1],n=F[2]):n=s=B=K,qa[na]=B.r,qa[na+1]=B.g,qa[na+2]=B.b,qa[na+3]=s.r,qa[na+4]=s.g,qa[na+5]=s.b,qa[na+6]=n.r,qa[na+7]=n.g,qa[na+8]=n.b,na+=9;if(Ca&&ua.hasTangents)F=R[0],K=R[1],B=R[2],da[$]=F.x,da[$+1]=F.y,da[$+2]=F.z,da[$+3]=F.w,da[$+4]=K.x,da[$+5]=K.y,da[$+6]=K.z,da[$+7]=K.w,da[$+8]=B.x,da[$+9]=B.y,da[$+10]=B.z,da[$+11]=B.w,$+=12;if(Ba&&v)if(E.length==3&&
-za)for(R=0;R<3;R++)I=E[R],Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,T+=3;else for(R=0;R<3;R++)Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,T+=3;if(va&&r!==void 0&&q)for(R=0;R<3;R++)E=r[R],la[X]=E.u,la[X+1]=E.v,X+=2;if(va&&D!==void 0&&q)for(R=0;R<3;R++)E=D[R],ma[aa]=E.u,ma[aa+1]=E.v,aa+=2;Aa&&(ia[W]=ja,ia[W+1]=ja+1,ia[W+2]=ja+2,W+=3,Y[U]=ja,Y[U+1]=ja+1,Y[U+2]=ja,Y[U+3]=ja+2,Y[U+4]=ja+1,Y[U+5]=ja+2,U+=6,ja+=3)}else if(B instanceof THREE.Face4){if(wa)y=Da[B.a].position,O=Da[B.b].position,P=Da[B.c].position,J=Da[B.d].position,
+za)for(R=0;R<3;R++)I=E[R],X[T]=I.x,X[T+1]=I.y,X[T+2]=I.z,T+=3;else for(R=0;R<3;R++)X[T]=I.x,X[T+1]=I.y,X[T+2]=I.z,T+=3;if(va&&r!==void 0&&q)for(R=0;R<3;R++)E=r[R],la[Y]=E.u,la[Y+1]=E.v,Y+=2;if(va&&D!==void 0&&q)for(R=0;R<3;R++)E=D[R],ma[aa]=E.u,ma[aa+1]=E.v,aa+=2;Aa&&(ia[W]=ja,ia[W+1]=ja+1,ia[W+2]=ja+2,W+=3,Z[U]=ja,Z[U+1]=ja+1,Z[U+2]=ja,Z[U+3]=ja+2,Z[U+4]=ja+1,Z[U+5]=ja+2,U+=6,ja+=3)}else if(B instanceof THREE.Face4){if(wa)y=Da[B.a].position,O=Da[B.b].position,P=Da[B.c].position,J=Da[B.d].position,
 pa[N]=y.x,pa[N+1]=y.y,pa[N+2]=y.z,pa[N+3]=O.x,pa[N+4]=O.y,pa[N+5]=O.z,pa[N+6]=P.x,pa[N+7]=P.y,pa[N+8]=P.z,pa[N+9]=J.x,pa[N+10]=J.y,pa[N+11]=J.z,N+=12;if(ca)for(V in ca)if(n=ca[V],n.__original.needsUpdate)s=n.offset,C=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[s]=n.value[B.a],n.array[s+1]=n.value[B.b],n.array[s+2]=n.value[B.c],n.array[s+3]=n.value[B.d]):n.boundTo==="faces"?(C=n.value[C],n.array[s]=C,n.array[s+1]=C,n.array[s+2]=C,n.array[s+3]=C,n.offsetSrc++):n.boundTo===
 pa[N]=y.x,pa[N+1]=y.y,pa[N+2]=y.z,pa[N+3]=O.x,pa[N+4]=O.y,pa[N+5]=O.z,pa[N+6]=P.x,pa[N+7]=P.y,pa[N+8]=P.z,pa[N+9]=J.x,pa[N+10]=J.y,pa[N+11]=J.z,N+=12;if(ca)for(V in ca)if(n=ca[V],n.__original.needsUpdate)s=n.offset,C=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[s]=n.value[B.a],n.array[s+1]=n.value[B.b],n.array[s+2]=n.value[B.c],n.array[s+3]=n.value[B.d]):n.boundTo==="faces"?(C=n.value[C],n.array[s]=C,n.array[s+1]=C,n.array[s+2]=C,n.array[s+3]=C,n.offsetSrc++):n.boundTo===
 "faceVertices"&&(n.array[s]=n.value[C],n.array[s+1]=n.value[C+1],n.array[s+2]=n.value[C+2],n.array[s+3]=n.value[C+3],n.offsetSrc+=4),n.offset+=4):(n.boundTo===void 0||n.boundTo==="vertices"?(y=n.value[B.a],O=n.value[B.b],P=n.value[B.c],J=n.value[B.d]):n.boundTo==="faces"?(J=P=O=y=C=n.value[C],n.offsetSrc++):n.boundTo==="faceVertices"&&(y=n.value[C],O=n.value[C+1],P=n.value[C+2],J=n.value[C+3],n.offsetSrc+=4),n.size===2?(n.array[s]=y.x,n.array[s+1]=y.y,n.array[s+2]=O.x,n.array[s+3]=O.y,n.array[s+4]=
 "faceVertices"&&(n.array[s]=n.value[C],n.array[s+1]=n.value[C+1],n.array[s+2]=n.value[C+2],n.array[s+3]=n.value[C+3],n.offsetSrc+=4),n.offset+=4):(n.boundTo===void 0||n.boundTo==="vertices"?(y=n.value[B.a],O=n.value[B.b],P=n.value[B.c],J=n.value[B.d]):n.boundTo==="faces"?(J=P=O=y=C=n.value[C],n.offsetSrc++):n.boundTo==="faceVertices"&&(y=n.value[C],O=n.value[C+1],P=n.value[C+2],J=n.value[C+3],n.offsetSrc+=4),n.size===2?(n.array[s]=y.x,n.array[s+1]=y.y,n.array[s+2]=O.x,n.array[s+3]=O.y,n.array[s+4]=
 P.x,n.array[s+5]=P.y,n.array[s+6]=J.x,n.array[s+7]=J.y,n.offset+=8):n.size===3?(n.type==="c"?(n.array[s]=y.r,n.array[s+1]=y.g,n.array[s+2]=y.b,n.array[s+3]=O.r,n.array[s+4]=O.g,n.array[s+5]=O.b,n.array[s+6]=P.r,n.array[s+7]=P.g,n.array[s+8]=P.b,n.array[s+9]=J.r,n.array[s+10]=J.g,n.array[s+11]=J.b):(n.array[s]=y.x,n.array[s+1]=y.y,n.array[s+2]=y.z,n.array[s+3]=O.x,n.array[s+4]=O.y,n.array[s+5]=O.z,n.array[s+6]=P.x,n.array[s+7]=P.y,n.array[s+8]=P.z,n.array[s+9]=J.x,n.array[s+10]=J.y,n.array[s+11]=J.z),
 P.x,n.array[s+5]=P.y,n.array[s+6]=J.x,n.array[s+7]=J.y,n.offset+=8):n.size===3?(n.type==="c"?(n.array[s]=y.r,n.array[s+1]=y.g,n.array[s+2]=y.b,n.array[s+3]=O.r,n.array[s+4]=O.g,n.array[s+5]=O.b,n.array[s+6]=P.r,n.array[s+7]=P.g,n.array[s+8]=P.b,n.array[s+9]=J.r,n.array[s+10]=J.g,n.array[s+11]=J.b):(n.array[s]=y.x,n.array[s+1]=y.y,n.array[s+2]=y.z,n.array[s+3]=O.x,n.array[s+4]=O.y,n.array[s+5]=O.z,n.array[s+6]=P.x,n.array[s+7]=P.y,n.array[s+8]=P.z,n.array[s+9]=J.x,n.array[s+10]=J.y,n.array[s+11]=J.z),
 n.offset+=12):(n.array[s]=y.x,n.array[s+1]=y.y,n.array[s+2]=y.z,n.array[s+3]=y.w,n.array[s+4]=O.x,n.array[s+5]=O.y,n.array[s+6]=O.z,n.array[s+7]=O.w,n.array[s+8]=P.x,n.array[s+9]=P.y,n.array[s+10]=P.z,n.array[s+11]=P.w,n.array[s+12]=J.x,n.array[s+13]=J.y,n.array[s+14]=J.z,n.array[s+15]=J.w,n.offset+=16));if(Ga){s=0;for(n=Ia.length;s<n;s++)y=Ia[s].vertices[B.a].position,O=Ia[s].vertices[B.b].position,P=Ia[s].vertices[B.c].position,J=Ia[s].vertices[B.d].position,C=sa[s],C[oa]=y.x,C[oa+1]=y.y,C[oa+2]=
 n.offset+=12):(n.array[s]=y.x,n.array[s+1]=y.y,n.array[s+2]=y.z,n.array[s+3]=y.w,n.array[s+4]=O.x,n.array[s+5]=O.y,n.array[s+6]=O.z,n.array[s+7]=O.w,n.array[s+8]=P.x,n.array[s+9]=P.y,n.array[s+10]=P.z,n.array[s+11]=P.w,n.array[s+12]=J.x,n.array[s+13]=J.y,n.array[s+14]=J.z,n.array[s+15]=J.w,n.offset+=16));if(Ga){s=0;for(n=Ia.length;s<n;s++)y=Ia[s].vertices[B.a].position,O=Ia[s].vertices[B.b].position,P=Ia[s].vertices[B.c].position,J=Ia[s].vertices[B.d].position,C=sa[s],C[oa]=y.x,C[oa+1]=y.y,C[oa+2]=
-y.z,C[oa+3]=O.x,C[oa+4]=O.y,C[oa+5]=O.z,C[oa+6]=P.x,C[oa+7]=P.y,C[oa+8]=P.z,C[oa+9]=J.x,C[oa+10]=J.y,C[oa+11]=J.z;oa+=12}if(Na.length)s=Na[B.a],n=Na[B.b],C=Na[B.c],S=Na[B.d],ha[w]=s.x,ha[w+1]=s.y,ha[w+2]=s.z,ha[w+3]=s.w,ha[w+4]=n.x,ha[w+5]=n.y,ha[w+6]=n.z,ha[w+7]=n.w,ha[w+8]=C.x,ha[w+9]=C.y,ha[w+10]=C.z,ha[w+11]=C.w,ha[w+12]=S.x,ha[w+13]=S.y,ha[w+14]=S.z,ha[w+15]=S.w,s=Qa[B.a],n=Qa[B.b],C=Qa[B.c],S=Qa[B.d],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=n.x,ga[w+5]=n.y,ga[w+6]=n.z,ga[w+7]=n.w,
+y.z,C[oa+3]=O.x,C[oa+4]=O.y,C[oa+5]=O.z,C[oa+6]=P.x,C[oa+7]=P.y,C[oa+8]=P.z,C[oa+9]=J.x,C[oa+10]=J.y,C[oa+11]=J.z;oa+=12}if(Ma.length)s=Ma[B.a],n=Ma[B.b],C=Ma[B.c],S=Ma[B.d],ha[w]=s.x,ha[w+1]=s.y,ha[w+2]=s.z,ha[w+3]=s.w,ha[w+4]=n.x,ha[w+5]=n.y,ha[w+6]=n.z,ha[w+7]=n.w,ha[w+8]=C.x,ha[w+9]=C.y,ha[w+10]=C.z,ha[w+11]=C.w,ha[w+12]=S.x,ha[w+13]=S.y,ha[w+14]=S.z,ha[w+15]=S.w,s=Qa[B.a],n=Qa[B.b],C=Qa[B.c],S=Qa[B.d],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=n.x,ga[w+5]=n.y,ga[w+6]=n.z,ga[w+7]=n.w,
 ga[w+8]=C.x,ga[w+9]=C.y,ga[w+10]=C.z,ga[w+11]=C.w,ga[w+12]=S.x,ga[w+13]=S.y,ga[w+14]=S.z,ga[w+15]=S.w,s=Oa[B.a],n=Oa[B.b],C=Oa[B.c],S=Oa[B.d],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=n.x,ea[w+5]=n.y,ea[w+6]=n.z,ea[w+7]=1,ea[w+8]=C.x,ea[w+9]=C.y,ea[w+10]=C.z,ea[w+11]=1,ea[w+12]=S.x,ea[w+13]=S.y,ea[w+14]=S.z,ea[w+15]=1,s=Pa[B.a],n=Pa[B.b],C=Pa[B.c],B=Pa[B.d],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=1,fa[w+4]=n.x,fa[w+5]=n.y,fa[w+6]=n.z,fa[w+7]=1,fa[w+8]=C.x,fa[w+9]=C.y,fa[w+10]=C.z,fa[w+
 ga[w+8]=C.x,ga[w+9]=C.y,ga[w+10]=C.z,ga[w+11]=C.w,ga[w+12]=S.x,ga[w+13]=S.y,ga[w+14]=S.z,ga[w+15]=S.w,s=Oa[B.a],n=Oa[B.b],C=Oa[B.c],S=Oa[B.d],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=n.x,ea[w+5]=n.y,ea[w+6]=n.z,ea[w+7]=1,ea[w+8]=C.x,ea[w+9]=C.y,ea[w+10]=C.z,ea[w+11]=1,ea[w+12]=S.x,ea[w+13]=S.y,ea[w+14]=S.z,ea[w+15]=1,s=Pa[B.a],n=Pa[B.b],C=Pa[B.c],B=Pa[B.d],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=1,fa[w+4]=n.x,fa[w+5]=n.y,fa[w+6]=n.z,fa[w+7]=1,fa[w+8]=C.x,fa[w+9]=C.y,fa[w+10]=C.z,fa[w+
 11]=1,fa[w+12]=B.x,fa[w+13]=B.y,fa[w+14]=B.z,fa[w+15]=1,w+=16;if(Ea&&u)F.length==4&&u==THREE.VertexColors?(B=F[0],s=F[1],n=F[2],F=F[3]):F=n=s=B=K,qa[na]=B.r,qa[na+1]=B.g,qa[na+2]=B.b,qa[na+3]=s.r,qa[na+4]=s.g,qa[na+5]=s.b,qa[na+6]=n.r,qa[na+7]=n.g,qa[na+8]=n.b,qa[na+9]=F.r,qa[na+10]=F.g,qa[na+11]=F.b,na+=12;if(Ca&&ua.hasTangents)F=R[0],K=R[1],B=R[2],R=R[3],da[$]=F.x,da[$+1]=F.y,da[$+2]=F.z,da[$+3]=F.w,da[$+4]=K.x,da[$+5]=K.y,da[$+6]=K.z,da[$+7]=K.w,da[$+8]=B.x,da[$+9]=B.y,da[$+10]=B.z,da[$+11]=B.w,
 11]=1,fa[w+12]=B.x,fa[w+13]=B.y,fa[w+14]=B.z,fa[w+15]=1,w+=16;if(Ea&&u)F.length==4&&u==THREE.VertexColors?(B=F[0],s=F[1],n=F[2],F=F[3]):F=n=s=B=K,qa[na]=B.r,qa[na+1]=B.g,qa[na+2]=B.b,qa[na+3]=s.r,qa[na+4]=s.g,qa[na+5]=s.b,qa[na+6]=n.r,qa[na+7]=n.g,qa[na+8]=n.b,qa[na+9]=F.r,qa[na+10]=F.g,qa[na+11]=F.b,na+=12;if(Ca&&ua.hasTangents)F=R[0],K=R[1],B=R[2],R=R[3],da[$]=F.x,da[$+1]=F.y,da[$+2]=F.z,da[$+3]=F.w,da[$+4]=K.x,da[$+5]=K.y,da[$+6]=K.z,da[$+7]=K.w,da[$+8]=B.x,da[$+9]=B.y,da[$+10]=B.z,da[$+11]=B.w,
-da[$+12]=R.x,da[$+13]=R.y,da[$+14]=R.z,da[$+15]=R.w,$+=16;if(Ba&&v)if(E.length==4&&za)for(R=0;R<4;R++)I=E[R],Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,T+=3;else for(R=0;R<4;R++)Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,T+=3;if(va&&r!==void 0&&q)for(R=0;R<4;R++)E=r[R],la[X]=E.u,la[X+1]=E.v,X+=2;if(va&&D!==void 0&&q)for(R=0;R<4;R++)E=D[R],ma[aa]=E.u,ma[aa+1]=E.v,aa+=2;Aa&&(ia[W]=ja,ia[W+1]=ja+1,ia[W+2]=ja+3,ia[W+3]=ja+1,ia[W+4]=ja+2,ia[W+5]=ja+3,W+=6,Y[U]=ja,Y[U+1]=ja+1,Y[U+2]=ja,Y[U+3]=ja+3,Y[U+4]=ja+1,Y[U+5]=ja+2,Y[U+
-6]=ja+2,Y[U+7]=ja+3,U+=8,ja+=4)}wa&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,pa,A));if(ca)for(V in ca)n=ca[V],n.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,n.buffer),e.bufferData(e.ARRAY_BUFFER,n.array,A));if(Ga){s=0;for(n=Ia.length;s<n;s++)e.bindBuffer(e.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[s]),e.bufferData(e.ARRAY_BUFFER,sa[s],A)}Ea&&na>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,qa,A));Ba&&(e.bindBuffer(e.ARRAY_BUFFER,
-m.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,Z,A));Ca&&ua.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,da,A));va&&X>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,la,A));va&&aa>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,ma,A));Aa&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia,A),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer),
-e.bufferData(e.ELEMENT_ARRAY_BUFFER,Y,A));w>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,ea,A),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,fa,A),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,ga,A),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ha,A));x&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,delete m.__tangentArray,
+da[$+12]=R.x,da[$+13]=R.y,da[$+14]=R.z,da[$+15]=R.w,$+=16;if(Ba&&v)if(E.length==4&&za)for(R=0;R<4;R++)I=E[R],X[T]=I.x,X[T+1]=I.y,X[T+2]=I.z,T+=3;else for(R=0;R<4;R++)X[T]=I.x,X[T+1]=I.y,X[T+2]=I.z,T+=3;if(va&&r!==void 0&&q)for(R=0;R<4;R++)E=r[R],la[Y]=E.u,la[Y+1]=E.v,Y+=2;if(va&&D!==void 0&&q)for(R=0;R<4;R++)E=D[R],ma[aa]=E.u,ma[aa+1]=E.v,aa+=2;Aa&&(ia[W]=ja,ia[W+1]=ja+1,ia[W+2]=ja+3,ia[W+3]=ja+1,ia[W+4]=ja+2,ia[W+5]=ja+3,W+=6,Z[U]=ja,Z[U+1]=ja+1,Z[U+2]=ja,Z[U+3]=ja+3,Z[U+4]=ja+1,Z[U+5]=ja+2,Z[U+
+6]=ja+2,Z[U+7]=ja+3,U+=8,ja+=4)}wa&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,pa,A));if(ca)for(V in ca)n=ca[V],n.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,n.buffer),e.bufferData(e.ARRAY_BUFFER,n.array,A));if(Ga){s=0;for(n=Ia.length;s<n;s++)e.bindBuffer(e.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[s]),e.bufferData(e.ARRAY_BUFFER,sa[s],A)}Ea&&na>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,qa,A));Ba&&(e.bindBuffer(e.ARRAY_BUFFER,
+m.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,X,A));Ca&&ua.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,da,A));va&&Y>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,la,A));va&&aa>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,ma,A));Aa&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia,A),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer),
+e.bufferData(e.ELEMENT_ARRAY_BUFFER,Z,A));w>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,ea,A),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,fa,A),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,ga,A),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ha,A));x&&(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;ya(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=t=x=x=void 0;p=i.vertices;o=
 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;ya(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=t=x=x=void 0;p=i.vertices;o=
 i.colors;q=p.length;m=o.length;u=i.__vertexArray;A=i.__colorArray;v=i.__dirtyColors;if(i.__dirtyVertices){for(x=0;x<q;x++)t=p[x].position,k=x*3,u[k]=t.x,u[k+1]=t.y,u[k+2]=t.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,u,j)}if(v){for(x=0;x<m;x++)color=o[x],k=x*3,A[k]=color.r,A[k+1]=color.g,A[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,A,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;
 i.colors;q=p.length;m=o.length;u=i.__vertexArray;A=i.__colorArray;v=i.__dirtyColors;if(i.__dirtyVertices){for(x=0;x<q;x++)t=p[x].position,k=x*3,u[k]=t.x,u[k+1]=t.y,u[k+2]=t.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,u,j)}if(v){for(x=0;x<m;x++)color=o[x],k=x*3,A[k]=color.r,A[k+1]=color.g,A[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,A,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;
 if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=t=x=x=void 0;p=i.vertices;o=i.colors;q=p.length;m=o.length;u=i.__vertexArray;A=i.__colorArray;v=i.__dirtyColors;if(i.__dirtyVertices){for(x=0;x<q;x++)t=p[x].position,k=x*3,u[k]=t.x,u[k+1]=t.y,u[k+2]=t.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,u,j)}if(v){for(x=0;x<m;x++)color=o[x],k=x*3,A[k]=color.r,A[k+1]=color.g,A[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,
 if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=t=x=x=void 0;p=i.vertices;o=i.colors;q=p.length;m=o.length;u=i.__vertexArray;A=i.__colorArray;v=i.__dirtyColors;if(i.__dirtyVertices){for(x=0;x<q;x++)t=p[x].position,k=x*3,u[k]=t.x,u[k+1]=t.y,u[k+2]=t.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,u,j)}if(v){for(x=0;x<m;x++)color=o[x],k=x*3,A[k]=color.r,A[k+1]=color.g,A[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,

+ 37 - 13
src/renderers/WebGLRenderer.js

@@ -3639,16 +3639,22 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 						}
 						}
 
 
+						_currentGeometryGroupHash = -1;
+
 						setupMatrices( object, _cameraLight, false );
 						setupMatrices( object, _cameraLight, false );
 
 
 						setObjectFaces( object );
 						setObjectFaces( object );
 
 
 						program = setProgram( _cameraLight, lights, fog, _depthMaterial, object );
 						program = setProgram( _cameraLight, lights, fog, _depthMaterial, object );
+
 						if ( object.immediateRenderCallback ) {
 						if ( object.immediateRenderCallback ) {
+
 							object.immediateRenderCallback( program, _gl, _frustum );
 							object.immediateRenderCallback( program, _gl, _frustum );
-						}
-						else {
+
+						} else {
+
 							object.render( function( object ) { renderBufferImmediate( object, program, _depthMaterial.shading ); } );
 							object.render( function( object ) { renderBufferImmediate( object, program, _depthMaterial.shading ); } );
+
 						}
 						}
 
 
 					}
 					}
@@ -3817,15 +3823,21 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				if ( object.visible ) {
 				if ( object.visible ) {
 
 
+					_currentGeometryGroupHash = -1;
+
 					setObjectFaces( object );
 					setObjectFaces( object );
 
 
 					program = setProgram( camera, lights, fog, scene.overrideMaterial, object );
 					program = setProgram( camera, lights, fog, scene.overrideMaterial, object );
+
 					if ( object.immediateRenderCallback ) {
 					if ( object.immediateRenderCallback ) {
-							object.immediateRenderCallback( program, _gl, _frustum );
-						}
-						else {
-							object.render( function( object ) { renderBufferImmediate( object, program, _depthMaterial.shading ); } );
-						}
+
+						object.immediateRenderCallback( program, _gl, _frustum );
+
+					} else {
+
+						object.render( function( object ) { renderBufferImmediate( object, program, scene.overrideMaterial.shading ); } );
+
+					}
 
 
 				}
 				}
 
 
@@ -3874,6 +3886,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				if ( object.visible ) {
 				if ( object.visible ) {
 
 
+					_currentGeometryGroupHash = -1;
+
 					opaque = webglObject.opaque;
 					opaque = webglObject.opaque;
 
 
 					setObjectFaces( object );
 					setObjectFaces( object );
@@ -3887,11 +3901,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 						setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );
 						setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );
 
 
 						program = setProgram( camera, lights, fog, material, object );
 						program = setProgram( camera, lights, fog, material, object );
+
 						if ( object.immediateRenderCallback ) {
 						if ( object.immediateRenderCallback ) {
+
 							object.immediateRenderCallback( program, _gl, _frustum );
 							object.immediateRenderCallback( program, _gl, _frustum );
-						}
-						else {
-							object.render( function( object ) { renderBufferImmediate( object, program, _depthMaterial.shading ); } );
+
+						} else {
+
+							object.render( function( object ) { renderBufferImmediate( object, program, material.shading ); } );
+
 						}
 						}
 
 
 					}
 					}
@@ -3941,6 +3959,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				if ( object.visible ) {
 				if ( object.visible ) {
 
 
+					_currentGeometryGroupHash = -1;
+
 					transparent = webglObject.transparent;
 					transparent = webglObject.transparent;
 
 
 					setObjectFaces( object );
 					setObjectFaces( object );
@@ -3955,11 +3975,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 						setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );
 						setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );
 
 
 						program = setProgram( camera, lights, fog, material, object );
 						program = setProgram( camera, lights, fog, material, object );
+
 						if ( object.immediateRenderCallback ) {
 						if ( object.immediateRenderCallback ) {
+
 							object.immediateRenderCallback( program, _gl, _frustum );
 							object.immediateRenderCallback( program, _gl, _frustum );
-						}
-						else {
-							object.render( function( object ) { renderBufferImmediate( object, program, _depthMaterial.shading ); } );
+
+						} else {
+
+							object.render( function( object ) { renderBufferImmediate( object, program, material.shading ); } );
+
 						}
 						}
 
 
 					}
 					}