Browse Source

Fixed couple of runaway globals in WebGLRenderer.

alteredq 14 years ago
parent
commit
58e272f66f
3 changed files with 433 additions and 432 deletions
  1. 249 249
      build/Three.js
  2. 181 181
      build/custom/ThreeWebGL.js
  3. 3 2
      src/renderers/WebGLRenderer.js

+ 249 - 249
build/Three.js

@@ -26,9 +26,9 @@ THREE.Matrix4=function(b,c,e,f,h,m,k,n,u,p,v,t,x,w,z,y){this.set(b!==void 0?b:1,
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,m,k,n,u,p,v,t,x,w,z,y){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=m;this.n23=k;this.n24=n;this.n31=u;this.n32=p;this.n33=v;this.n34=t;this.n41=x;this.n42=w;this.n43=z;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,m,k,n,u,p,v,t,x,w,z,y){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=m;this.n23=k;this.n24=n;this.n31=u;this.n32=p;this.n33=v;this.n34=t;this.n41=x;this.n42=w;this.n43=z;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
 c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(b,c).normalize();if(m.length()===0)m.z=1;f.cross(e,m).normalize();f.length()===0&&(m.x+=1.0E-4,f.cross(e,m).normalize());h.cross(m,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=m.x;this.n21=f.y;this.n22=h.y;this.n23=m.y;this.n31=f.z;this.n32=h.z;this.n33=m.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h;
 c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(b,c).normalize();if(m.length()===0)m.z=1;f.cross(e,m).normalize();f.length()===0&&(m.x+=1.0E-4,f.cross(e,m).normalize());h.cross(m,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=m.x;this.n21=f.y;this.n22=h.y;this.n23=m.y;this.n31=f.z;this.n32=h.z;this.n33=m.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h;
 b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
 b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
-e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,u=b.n23,p=b.n24,v=b.n31,t=b.n32,x=b.n33,w=b.n34,z=b.n41,y=b.n42,A=b.n43,E=b.n44,D=c.n11,G=c.n12,
-I=c.n13,N=c.n14,P=c.n21,J=c.n22,H=c.n23,K=c.n24,Z=c.n31,C=c.n32,R=c.n33,O=c.n34,V=c.n41,W=c.n42,o=c.n43,ea=c.n44;this.n11=e*D+f*P+h*Z+m*V;this.n12=e*G+f*J+h*C+m*W;this.n13=e*I+f*H+h*R+m*o;this.n14=e*N+f*K+h*O+m*ea;this.n21=k*D+n*P+u*Z+p*V;this.n22=k*G+n*J+u*C+p*W;this.n23=k*I+n*H+u*R+p*o;this.n24=k*N+n*K+u*O+p*ea;this.n31=v*D+t*P+x*Z+w*V;this.n32=v*G+t*J+x*C+w*W;this.n33=v*I+t*H+x*R+w*o;this.n34=v*N+t*K+x*O+w*ea;this.n41=z*D+y*P+A*Z+E*V;this.n42=z*G+y*J+A*C+E*W;this.n43=z*I+y*H+A*R+E*o;this.n44=z*
-N+y*K+A*O+E*ea;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=
+e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,u=b.n23,p=b.n24,v=b.n31,t=b.n32,x=b.n33,w=b.n34,z=b.n41,y=b.n42,A=b.n43,E=b.n44,D=c.n11,F=c.n12,
+G=c.n13,N=c.n14,Q=c.n21,K=c.n22,H=c.n23,M=c.n24,X=c.n31,C=c.n32,O=c.n33,P=c.n34,U=c.n41,V=c.n42,o=c.n43,fa=c.n44;this.n11=e*D+f*Q+h*X+m*U;this.n12=e*F+f*K+h*C+m*V;this.n13=e*G+f*H+h*O+m*o;this.n14=e*N+f*M+h*P+m*fa;this.n21=k*D+n*Q+u*X+p*U;this.n22=k*F+n*K+u*C+p*V;this.n23=k*G+n*H+u*O+p*o;this.n24=k*N+n*M+u*P+p*fa;this.n31=v*D+t*Q+x*X+w*U;this.n32=v*F+t*K+x*C+w*V;this.n33=v*G+t*H+x*O+w*o;this.n34=v*N+t*M+x*P+w*fa;this.n41=z*D+y*Q+A*X+E*U;this.n42=z*F+y*K+A*C+E*V;this.n43=z*G+y*H+A*O+E*o;this.n44=z*
+N+y*M+A*P+E*fa;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=
 b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,m=this.n22,k=this.n23,n=this.n24,u=this.n31,p=this.n32,v=this.n33,t=this.n34,x=this.n41,w=this.n42,z=this.n43,y=this.n44;return f*k*p*x-e*n*p*x-f*m*v*x+c*n*v*x+e*m*t*x-c*k*t*x-f*k*u*w+e*n*u*w+f*h*v*w-b*n*v*w-e*h*t*w+b*k*t*w+f*m*u*z-c*n*u*z-f*h*p*z+b*n*p*z+c*h*t*z-b*m*t*z-e*m*u*y+c*k*u*y+e*h*p*y-b*k*p*y-c*h*
 b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,m=this.n22,k=this.n23,n=this.n24,u=this.n31,p=this.n32,v=this.n33,t=this.n34,x=this.n41,w=this.n42,z=this.n43,y=this.n44;return f*k*p*x-e*n*p*x-f*m*v*x+c*n*v*x+e*m*t*x-c*k*t*x-f*k*u*w+e*n*u*w+f*h*v*w-b*n*v*w-e*h*t*w+b*k*t*w+f*m*u*z-c*n*u*z-f*h*p*z+b*n*p*z+c*h*t*z-b*m*t*z-e*m*u*y+c*k*u*y+e*h*p*y-b*k*p*y-c*h*
 v*y+b*m*v*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=
 v*y+b*m*v*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=
 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]=
@@ -54,17 +54,17 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){thi
 b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&
 b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 this.remove(b)}};THREE.Object3DCount=0;
 this.remove(b)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function b(){var b=u[n]=u[n]||new THREE.RenderableVertex;n++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,k=b.z+b.w,h=e.z+e.w,m=-b.z+b.w,n=-e.z+e.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,m=[],k,n,u=[],p,v,t=[],x,w=[],z,y,A=[],E,D,G=[],I=[],N=[],P=new THREE.Vector4,J=new THREE.Vector4,
-H=new THREE.Matrix4,K=new THREE.Matrix4,Z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(b,e){H.multiply(e.projectionMatrix,e.matrixWorldInverse);H.multiplyVector3(b);return b};this.unprojectVector=function(b,e){H.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));H.multiplyVector3(b);return b};this.projectObjects=function(b,e,k){var o,n;h=I.length=0;
-o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var w;if(!(w=!n.visible))if(w=n instanceof THREE.Mesh)if(w=n.frustumCulled){a:{w=void 0;for(var t=n.matrixWorld,p=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(w=Z[u].x*t.n14+Z[u].y*t.n24+Z[u].z*t.n34+Z[u].w,w<=p){w=!1;break a}w=!0}w=!w}if(!w)w=m[h]=m[h]||new THREE.RenderableObject,h++,f=w,P.copy(n.position),H.multiplyVector3(P),f.object=n,f.z=P.z,I.push(f)}k&&I.sort(c);return I};this.projectScene=
-function(f,h,m){var o=h.near,I=h.far,S,P,aa,ka,ja,ma,da,$,U,T,fa,na,sa,la,ca,qa,ua;D=y=x=v=N.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);H.multiply(h.projectionMatrix,h.matrixWorldInverse);Z[0].set(H.n41-H.n11,H.n42-H.n12,H.n43-H.n13,H.n44-H.n14);Z[1].set(H.n41+H.n11,H.n42+H.n12,H.n43+H.n13,H.n44+H.n14);Z[2].set(H.n41+H.n21,H.n42+H.n22,H.n43+H.n23,H.n44+H.n24);Z[3].set(H.n41-H.n21,H.n42-H.n22,H.n43-H.n23,H.n44-H.n24);Z[4].set(H.n41-H.n31,H.n42-H.n32,H.n43-H.n33,H.n44-H.n34);
-Z[5].set(H.n41+H.n31,H.n42+H.n32,H.n43+H.n33,H.n44+H.n34);for(S=0;S<6;S++)U=Z[S],U.divideScalar(Math.sqrt(U.x*U.x+U.y*U.y+U.z*U.z));U=this.projectObjects(f,h,!0);f=0;for(S=U.length;f<S;f++)if(T=U[f].object,T.visible)if(fa=T.matrixWorld,na=T.matrixRotationWorld,sa=T.materials,la=T.overdraw,n=0,T instanceof THREE.Mesh){ca=T.geometry;ka=ca.vertices;qa=ca.faces;ca=ca.faceVertexUvs;P=0;for(aa=ka.length;P<aa;P++)k=b(),k.positionWorld.copy(ka[P].position),fa.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),
-H.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>o&&k.positionScreen.z<I;ka=0;for(P=qa.length;ka<P;ka++){aa=qa[ka];if(aa instanceof THREE.Face3)if(ja=u[aa.a],ma=u[aa.b],da=u[aa.c],ja.visible&&ma.visible&&da.visible&&(T.doubleSided||T.flipSided!=(da.positionScreen.x-ja.positionScreen.x)*(ma.positionScreen.y-ja.positionScreen.y)-(da.positionScreen.y-ja.positionScreen.y)*(ma.positionScreen.x-ja.positionScreen.x)<
-0))$=t[v]=t[v]||new THREE.RenderableFace3,v++,p=$,p.v1.copy(ja),p.v2.copy(ma),p.v3.copy(da);else continue;else if(aa instanceof THREE.Face4)if(ja=u[aa.a],ma=u[aa.b],da=u[aa.c],$=u[aa.d],ja.visible&&ma.visible&&da.visible&&$.visible&&(T.doubleSided||T.flipSided!=(($.positionScreen.x-ja.positionScreen.x)*(ma.positionScreen.y-ja.positionScreen.y)-($.positionScreen.y-ja.positionScreen.y)*(ma.positionScreen.x-ja.positionScreen.x)<0||(ma.positionScreen.x-da.positionScreen.x)*($.positionScreen.y-da.positionScreen.y)-
-(ma.positionScreen.y-da.positionScreen.y)*($.positionScreen.x-da.positionScreen.x)<0)))ua=w[x]=w[x]||new THREE.RenderableFace4,x++,p=ua,p.v1.copy(ja),p.v2.copy(ma),p.v3.copy(da),p.v4.copy($);else continue;p.normalWorld.copy(aa.normal);na.multiplyVector3(p.normalWorld);p.centroidWorld.copy(aa.centroid);fa.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);H.multiplyVector3(p.centroidScreen);da=aa.vertexNormals;ja=0;for(ma=da.length;ja<ma;ja++)$=p.vertexNormalsWorld[ja],$.copy(da[ja]),
-na.multiplyVector3($);ja=0;for(ma=ca.length;ja<ma;ja++)if(ua=ca[ja][ka]){da=0;for($=ua.length;da<$;da++)p.uvs[ja][da]=ua[da]}p.meshMaterials=sa;p.faceMaterials=aa.materials;p.overdraw=la;p.z=p.centroidScreen.z;N.push(p)}}else if(T instanceof THREE.Line){K.multiply(H,fa);ka=T.geometry.vertices;ja=b();ja.positionScreen.copy(ka[0].position);K.multiplyVector4(ja.positionScreen);P=1;for(aa=ka.length;P<aa;P++)if(ja=b(),ja.positionScreen.copy(ka[P].position),K.multiplyVector4(ja.positionScreen),ma=u[n-2],
-C.copy(ja.positionScreen),R.copy(ma.positionScreen),e(C,R))C.multiplyScalar(1/C.w),R.multiplyScalar(1/R.w),fa=A[y]=A[y]||new THREE.RenderableLine,y++,z=fa,z.v1.positionScreen.copy(C),z.v2.positionScreen.copy(R),z.z=Math.max(C.z,R.z),z.materials=T.materials,N.push(z)}else if(T instanceof THREE.Particle&&(J.set(T.matrixWorld.n14,T.matrixWorld.n24,T.matrixWorld.n34,1),H.multiplyVector4(J),J.z/=J.w,J.z>0&&J.z<1))fa=G[D]=G[D]||new THREE.RenderableParticle,D++,E=fa,E.x=J.x/J.w,E.y=J.y/J.w,E.z=J.z,E.rotation=
-T.rotation.z,E.scale.x=T.scale.x*Math.abs(E.x-(J.x+h.projectionMatrix.n11)/(J.w+h.projectionMatrix.n14)),E.scale.y=T.scale.y*Math.abs(E.y-(J.y+h.projectionMatrix.n22)/(J.w+h.projectionMatrix.n24)),E.materials=T.materials,N.push(E);m&&N.sort(c);return N}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
+THREE.Projector=function(){function b(){var b=u[n]=u[n]||new THREE.RenderableVertex;n++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,k=b.z+b.w,h=e.z+e.w,m=-b.z+b.w,n=-e.z+e.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,m=[],k,n,u=[],p,v,t=[],x,w=[],z,y,A=[],E,D,F=[],G=[],N=[],Q=new THREE.Vector4,K=new THREE.Vector4,
+H=new THREE.Matrix4,M=new THREE.Matrix4,X=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(b,e){H.multiply(e.projectionMatrix,e.matrixWorldInverse);H.multiplyVector3(b);return b};this.unprojectVector=function(b,e){H.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));H.multiplyVector3(b);return b};this.projectObjects=function(b,e,k){var o,n;h=G.length=0;
+o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var w;if(!(w=!n.visible))if(w=n instanceof THREE.Mesh)if(w=n.frustumCulled){a:{w=void 0;for(var t=n.matrixWorld,p=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(w=X[u].x*t.n14+X[u].y*t.n24+X[u].z*t.n34+X[u].w,w<=p){w=!1;break a}w=!0}w=!w}if(!w)w=m[h]=m[h]||new THREE.RenderableObject,h++,f=w,Q.copy(n.position),H.multiplyVector3(Q),f.object=n,f.z=Q.z,G.push(f)}k&&G.sort(c);return G};this.projectScene=
+function(f,h,m){var o=h.near,G=h.far,S,Q,aa,la,ka,ma,ea,Y,T,Z,ga,na,va,J,da,qa,ua;D=y=x=v=N.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);H.multiply(h.projectionMatrix,h.matrixWorldInverse);X[0].set(H.n41-H.n11,H.n42-H.n12,H.n43-H.n13,H.n44-H.n14);X[1].set(H.n41+H.n11,H.n42+H.n12,H.n43+H.n13,H.n44+H.n14);X[2].set(H.n41+H.n21,H.n42+H.n22,H.n43+H.n23,H.n44+H.n24);X[3].set(H.n41-H.n21,H.n42-H.n22,H.n43-H.n23,H.n44-H.n24);X[4].set(H.n41-H.n31,H.n42-H.n32,H.n43-H.n33,H.n44-H.n34);
+X[5].set(H.n41+H.n31,H.n42+H.n32,H.n43+H.n33,H.n44+H.n34);for(S=0;S<6;S++)T=X[S],T.divideScalar(Math.sqrt(T.x*T.x+T.y*T.y+T.z*T.z));T=this.projectObjects(f,h,!0);f=0;for(S=T.length;f<S;f++)if(Z=T[f].object,Z.visible)if(ga=Z.matrixWorld,na=Z.matrixRotationWorld,va=Z.materials,J=Z.overdraw,n=0,Z instanceof THREE.Mesh){da=Z.geometry;la=da.vertices;qa=da.faces;da=da.faceVertexUvs;Q=0;for(aa=la.length;Q<aa;Q++)k=b(),k.positionWorld.copy(la[Q].position),ga.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),
+H.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>o&&k.positionScreen.z<G;la=0;for(Q=qa.length;la<Q;la++){aa=qa[la];if(aa instanceof THREE.Face3)if(ka=u[aa.a],ma=u[aa.b],ea=u[aa.c],ka.visible&&ma.visible&&ea.visible&&(Z.doubleSided||Z.flipSided!=(ea.positionScreen.x-ka.positionScreen.x)*(ma.positionScreen.y-ka.positionScreen.y)-(ea.positionScreen.y-ka.positionScreen.y)*(ma.positionScreen.x-ka.positionScreen.x)<
+0))Y=t[v]=t[v]||new THREE.RenderableFace3,v++,p=Y,p.v1.copy(ka),p.v2.copy(ma),p.v3.copy(ea);else continue;else if(aa instanceof THREE.Face4)if(ka=u[aa.a],ma=u[aa.b],ea=u[aa.c],Y=u[aa.d],ka.visible&&ma.visible&&ea.visible&&Y.visible&&(Z.doubleSided||Z.flipSided!=((Y.positionScreen.x-ka.positionScreen.x)*(ma.positionScreen.y-ka.positionScreen.y)-(Y.positionScreen.y-ka.positionScreen.y)*(ma.positionScreen.x-ka.positionScreen.x)<0||(ma.positionScreen.x-ea.positionScreen.x)*(Y.positionScreen.y-ea.positionScreen.y)-
+(ma.positionScreen.y-ea.positionScreen.y)*(Y.positionScreen.x-ea.positionScreen.x)<0)))ua=w[x]=w[x]||new THREE.RenderableFace4,x++,p=ua,p.v1.copy(ka),p.v2.copy(ma),p.v3.copy(ea),p.v4.copy(Y);else continue;p.normalWorld.copy(aa.normal);na.multiplyVector3(p.normalWorld);p.centroidWorld.copy(aa.centroid);ga.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);H.multiplyVector3(p.centroidScreen);ea=aa.vertexNormals;ka=0;for(ma=ea.length;ka<ma;ka++)Y=p.vertexNormalsWorld[ka],Y.copy(ea[ka]),
+na.multiplyVector3(Y);ka=0;for(ma=da.length;ka<ma;ka++)if(ua=da[ka][la]){ea=0;for(Y=ua.length;ea<Y;ea++)p.uvs[ka][ea]=ua[ea]}p.meshMaterials=va;p.faceMaterials=aa.materials;p.overdraw=J;p.z=p.centroidScreen.z;N.push(p)}}else if(Z instanceof THREE.Line){M.multiply(H,ga);la=Z.geometry.vertices;ka=b();ka.positionScreen.copy(la[0].position);M.multiplyVector4(ka.positionScreen);Q=1;for(aa=la.length;Q<aa;Q++)if(ka=b(),ka.positionScreen.copy(la[Q].position),M.multiplyVector4(ka.positionScreen),ma=u[n-2],
+C.copy(ka.positionScreen),O.copy(ma.positionScreen),e(C,O))C.multiplyScalar(1/C.w),O.multiplyScalar(1/O.w),ga=A[y]=A[y]||new THREE.RenderableLine,y++,z=ga,z.v1.positionScreen.copy(C),z.v2.positionScreen.copy(O),z.z=Math.max(C.z,O.z),z.materials=Z.materials,N.push(z)}else if(Z instanceof THREE.Particle&&(K.set(Z.matrixWorld.n14,Z.matrixWorld.n24,Z.matrixWorld.n34,1),H.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))ga=F[D]=F[D]||new THREE.RenderableParticle,D++,E=ga,E.x=K.x/K.w,E.y=K.y/K.w,E.z=K.z,E.rotation=
+Z.rotation.z,E.scale.x=Z.scale.x*Math.abs(E.x-(K.x+h.projectionMatrix.n11)/(K.w+h.projectionMatrix.n14)),E.scale.y=Z.scale.y*Math.abs(E.y-(K.y+h.projectionMatrix.n22)/(K.w+h.projectionMatrix.n24)),E.materials=Z.materials,N.push(E);m&&N.sort(c);return N}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),m=Math.cos(e),e=Math.sin(e),k=b*c,n=f*h;this.w=k*m-n*e;this.x=k*e+n*m;this.y=f*c*m+b*h*e;this.z=b*h*m-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),m=Math.cos(e),e=Math.sin(e),k=b*c,n=f*h;this.w=k*m-n*e;this.x=k*e+n*m;this.y=f*c*m+b*h*e;this.z=b*h*m-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
@@ -79,9 +79,9 @@ c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid
 e,f,h,m,k,n=new THREE.Vector3,u=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){m=this.faces[f];if(b&&m.vertexNormals.length){n.set(0,0,0);c=0;for(e=m.vertexNormals.length;c<e;c++)n.addSelf(m.vertexNormals[c]);n.divideScalar(3)}else c=this.vertices[m.a],e=this.vertices[m.b],k=this.vertices[m.c],n.sub(k.position,e.position),u.sub(c.position,e.position),n.crossSelf(u);n.isZero()||n.normalize();m.normal.copy(n)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
 e,f,h,m,k,n=new THREE.Vector3,u=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){m=this.faces[f];if(b&&m.vertexNormals.length){n.set(0,0,0);c=0;for(e=m.vertexNormals.length;c<e;c++)n.addSelf(m.vertexNormals[c]);n.divideScalar(3)}else c=this.vertices[m.a],e=this.vertices[m.b],k=this.vertices[m.c],n.sub(k.position,e.position),u.sub(c.position,e.position),n.crossSelf(u);n.isZero()||n.normalize();m.normal.copy(n)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
 Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof
 Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof
 THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),
 THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,h,m,o){n=b.vertices[e].position;u=b.vertices[c].position;p=b.vertices[f].position;v=k[h];t=k[m];x=k[o];w=u.x-n.x;z=p.x-n.x;y=u.y-n.y;A=p.y-n.y;E=u.z-n.z;D=p.z-n.z;G=t.u-v.u;I=x.u-v.u;N=t.v-v.v;P=x.v-v.v;J=1/(G*P-I*N);C.set((P*w-N*z)*J,(P*y-N*A)*J,(P*E-N*D)*J);R.set((G*z-I*w)*J,(G*A-I*y)*J,(G*D-I*E)*J);K[e].addSelf(C);K[c].addSelf(C);K[f].addSelf(C);Z[e].addSelf(R);
-Z[c].addSelf(R);Z[f].addSelf(R)}var c,e,f,h,m,k,n,u,p,v,t,x,w,z,y,A,E,D,G,I,N,P,J,H,K=[],Z=[],C=new THREE.Vector3,R=new THREE.Vector3,O=new THREE.Vector3,V=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)K[c]=new THREE.Vector3,Z[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)m=this.faces[c],k=this.faceVertexUvs[0][c],m instanceof THREE.Face3?b(this,m.a,m.b,m.c,0,1,2):m instanceof THREE.Face4&&(b(this,m.a,m.b,m.c,0,1,2),b(this,m.a,m.b,m.d,0,1,3));var o=["a","b",
-"c","d"];c=0;for(e=this.faces.length;c<e;c++){m=this.faces[c];for(f=0;f<m.vertexNormals.length;f++)W.copy(m.vertexNormals[f]),h=m[o[f]],H=K[h],O.copy(H),O.subSelf(W.multiplyScalar(W.dot(H))).normalize(),V.cross(m.vertexNormals[f],H),h=V.dot(Z[h]),h=h<0?-1:1,m.vertexTangents[f]=new THREE.Vector4(O.x,O.y,O.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,h,m,o){n=b.vertices[e].position;u=b.vertices[c].position;p=b.vertices[f].position;v=k[h];t=k[m];x=k[o];w=u.x-n.x;z=p.x-n.x;y=u.y-n.y;A=p.y-n.y;E=u.z-n.z;D=p.z-n.z;F=t.u-v.u;G=x.u-v.u;N=t.v-v.v;Q=x.v-v.v;K=1/(F*Q-G*N);C.set((Q*w-N*z)*K,(Q*y-N*A)*K,(Q*E-N*D)*K);O.set((F*z-G*w)*K,(F*A-G*y)*K,(F*D-G*E)*K);M[e].addSelf(C);M[c].addSelf(C);M[f].addSelf(C);X[e].addSelf(O);
+X[c].addSelf(O);X[f].addSelf(O)}var c,e,f,h,m,k,n,u,p,v,t,x,w,z,y,A,E,D,F,G,N,Q,K,H,M=[],X=[],C=new THREE.Vector3,O=new THREE.Vector3,P=new THREE.Vector3,U=new THREE.Vector3,V=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)M[c]=new THREE.Vector3,X[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)m=this.faces[c],k=this.faceVertexUvs[0][c],m instanceof THREE.Face3?b(this,m.a,m.b,m.c,0,1,2):m instanceof THREE.Face4&&(b(this,m.a,m.b,m.c,0,1,2),b(this,m.a,m.b,m.d,0,1,3));var o=["a","b",
+"c","d"];c=0;for(e=this.faces.length;c<e;c++){m=this.faces[c];for(f=0;f<m.vertexNormals.length;f++)V.copy(m.vertexNormals[f]),h=m[o[f]],H=M[h],P.copy(H),P.subSelf(V.multiplyScalar(V.dot(H))).normalize(),U.cross(m.vertexNormals[f],H),h=U.dot(X[h]),h=h<0?-1:1,m.vertexTangents[f]=new THREE.Vector4(P.x,P.y,P.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,h,m,k,n=
 b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,h,m,k,n=
 {};e=0;for(f=this.faces.length;e<f;e++)k=this.faces[e],k instanceof THREE.Face3?(h=b(k.a,k.b),c(n,h,e),h=b(k.b,k.c),c(n,h,e),h=b(k.a,k.c),c(n,h,e)):k instanceof THREE.Face4&&(h=b(k.b,k.d),c(n,h,e),h=b(k.a,k.b),c(n,h,e),h=b(k.a,k.d),c(n,h,e),h=b(k.b,k.c),c(n,h,e),h=b(k.c,k.d),c(n,h,e));e=0;for(f=this.edges.length;e<f;e++){k=this.edges[e];h=k.vertexIndices[0];m=k.vertexIndices[1];k.faceIndices=n[b(h,m)].array;for(h=0;h<k.faceIndices.length;h++)m=k.faceIndices[h],k.faces.push(this.faces[m])}}};
 {};e=0;for(f=this.faces.length;e<f;e++)k=this.faces[e],k instanceof THREE.Face3?(h=b(k.a,k.b),c(n,h,e),h=b(k.b,k.c),c(n,h,e),h=b(k.a,k.c),c(n,h,e)):k instanceof THREE.Face4&&(h=b(k.b,k.d),c(n,h,e),h=b(k.a,k.b),c(n,h,e),h=b(k.a,k.d),c(n,h,e),h=b(k.b,k.c),c(n,h,e),h=b(k.c,k.d),c(n,h,e));e=0;for(f=this.edges.length;e<f;e++){k=this.edges[e];h=k.vertexIndices[0];m=k.vertexIndices[1];k.faceIndices=n[b(h,m)].array;for(h=0;h<k.faceIndices.length;h++)m=k.faceIndices[h],k.faces.push(this.faces[m])}}};
@@ -148,48 +148,48 @@ THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light
 THREE.Scene.prototype.addObject=function(b){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addLight=function(b){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(b)};THREE.Scene.prototype.removeChild=function(b){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(b)};THREE.Scene.prototype.removeObject=function(b){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(b)};
 THREE.Scene.prototype.addObject=function(b){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addLight=function(b){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(b)};THREE.Scene.prototype.removeChild=function(b){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(b)};THREE.Scene.prototype.removeObject=function(b){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(b)};
 THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
 THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,m;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;m=f/2};this.render=function(e,f){var u,p,v,t,x,w,z,y;b=c.projectScene(e,f);u=0;for(p=b.length;u<p;u++)if(x=b[u],x instanceof THREE.RenderableParticle){z=x.x*h+h;y=x.y*m+m;v=0;for(t=x.material.length;v<t;v++)if(w=x.material[v],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=z+"px",w.style.top=y+"px"}}};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,m;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;m=f/2};this.render=function(e,f){var u,p,v,t,x,w,z,y;b=c.projectScene(e,f);u=0;for(p=b.length;u<p;u++)if(x=b[u],x instanceof THREE.RenderableParticle){z=x.x*h+h;y=x.y*m+m;v=0;for(t=x.material.length;v<t;v++)if(w=x.material[v],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=z+"px",w.style.top=y+"px"}}};
-THREE.CanvasRenderer=function(b){function c(b){if(A!=b)w.globalAlpha=A=b}function e(b){if(E!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}E=b}}function f(b){if(D!=b)w.strokeStyle=D=b}function h(b){if(G!=b)w.fillStyle=G=b}var m=this,k=null,n=new THREE.Projector,b=b||{},u=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-p,v,t,x,w=u.getContext("2d"),z=new THREE.Color(0),y=0,A=1,E=0,D=null,G=null,I=null,N=null,P=null,J,H,K,Z,C=new THREE.RenderableVertex,R=new THREE.RenderableVertex,O,V,W,o,ea,S,ta,aa,ka,ja,ma,da,$=new THREE.Color(0),U=new THREE.Color(0),T=new THREE.Color(0),fa=new THREE.Color(0),na=new THREE.Color(0),sa=[],la,ca,qa,ua,ra,ya,Ca,va,Ba,Ea,L=new THREE.Rectangle,ga=new THREE.Rectangle,X=new THREE.Rectangle,M=!1,pa=new THREE.Color,ha=new THREE.Color,za=new THREE.Color,xa=new THREE.Color,oa=new THREE.Vector3,
-Aa,Y,Fa,ia,Va,Wa,b=16;Aa=document.createElement("canvas");Aa.width=Aa.height=2;Y=Aa.getContext("2d");Y.fillStyle="rgba(0,0,0,1)";Y.fillRect(0,0,2,2);Fa=Y.getImageData(0,0,2,2);ia=Fa.data;Va=document.createElement("canvas");Va.width=Va.height=b;Wa=Va.getContext("2d");Wa.translate(-b/2,-b/2);Wa.scale(b,b);b--;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,e){p=b;v=e;t=Math.floor(p/2);x=Math.floor(v/2);u.width=p;
-u.height=v;L.set(-t,-x,t,x);ga.set(-t,-x,t,x);A=1;E=0;P=N=I=G=D=null};this.setClearColor=function(b,e){z.copy(b);y=e;ga.set(-t,-x,t,x)};this.setClearColorHex=function(b,e){z.setHex(b);y=e;ga.set(-t,-x,t,x)};this.clear=function(){w.setTransform(1,0,0,-1,t,x);ga.isEmpty()||(ga.minSelf(L),ga.inflate(2),y<1&&w.clearRect(Math.floor(ga.getX()),Math.floor(ga.getY()),Math.floor(ga.getWidth()),Math.floor(ga.getHeight())),y>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+
-","+Math.floor(z.b*255)+","+y+")"),w.fillRect(Math.floor(ga.getX()),Math.floor(ga.getY()),Math.floor(ga.getWidth()),Math.floor(ga.getHeight()))),ga.empty())};this.render=function(b,u){function p(b){var e,c,f,k=b.lights;ha.setRGB(0,0,0);za.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b<e;b++)c=k[b],f=c.color,c instanceof THREE.AmbientLight?(ha.r+=f.r,ha.g+=f.g,ha.b+=f.b):c instanceof THREE.DirectionalLight?(za.r+=f.r,za.g+=f.g,za.b+=f.b):c instanceof THREE.PointLight&&(xa.r+=f.r,xa.g+=f.g,xa.b+=
-f.b)}function v(b,e,c,f){var k,h,m,o,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],m=h.color,h instanceof THREE.DirectionalLight?(o=c.dot(h.position),o<=0||(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)):h instanceof THREE.PointLight&&(o=c.dot(oa.sub(h.position,e).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(e.distanceTo(h.position)/h.distance,1),o!=0&&(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)))}function z(b,k,m){c(m.opacity);e(m.blending);var o,n,u,ia,p,v;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)ia=
-m.map.image,p=ia.width>>1,v=ia.height>>1,m=k.scale.x*t,u=k.scale.y*x,o=m*p,n=u*v,X.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(X)&&(w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(m,-u),w.translate(-p,-v),w.drawImage(ia,0,0),w.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*t,n=k.scale.y*x,X.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(X)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(o,n),m.program(w),
-w.restore()))}function y(b,k,h,m){c(m.opacity);e(m.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(k.positionScreen.x,k.positionScreen.y);w.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(I!=b)w.lineWidth=I=b;b=m.linecap;if(N!=b)w.lineCap=N=b;b=m.linejoin;if(P!=b)w.lineJoin=P=b;f(m.color.getContextStyle());w.stroke();X.inflate(m.linewidth*2)}}function A(b,f,k,h,n,t,ia,p,w){m.info.render.vertices+=3;m.info.render.faces++;c(p.opacity);e(p.blending);
-O=b.positionScreen.x;V=b.positionScreen.y;W=f.positionScreen.x;o=f.positionScreen.y;ea=k.positionScreen.x;S=k.positionScreen.y;D(O,V,W,o,ea,S);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ua=ia.uvs[0],$a(O,V,W,o,ea,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[t].u,ua[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,oa.copy(ia.vertexNormalsWorld[0]),ra=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+
-0.5,ya=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(ia.vertexNormalsWorld[1]),Ca=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,va=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(ia.vertexNormalsWorld[2]),Ba=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Ea=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,$a(O,V,W,o,ea,S,ra,ya,Ca,va,Ba,Ea,p.envMap)}else p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&
-!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ua=ia.uvs[0],$a(O,V,W,o,ea,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[t].u,ua[t].v,p.map)),e(THREE.SubtractiveBlending)),M?!p.wireframe&&p.shading==THREE.SmoothShading&&ia.vertexNormalsWorld.length==3?(U.r=T.r=fa.r=ha.r,U.g=T.g=fa.g=ha.g,U.b=T.b=fa.b=ha.b,v(w,ia.v1.positionWorld,ia.vertexNormalsWorld[0],U),v(w,ia.v2.positionWorld,ia.vertexNormalsWorld[1],T),v(w,ia.v3.positionWorld,ia.vertexNormalsWorld[2],fa),U.r=Math.max(0,Math.min(p.color.r*U.r,
-1)),U.g=Math.max(0,Math.min(p.color.g*U.g,1)),U.b=Math.max(0,Math.min(p.color.b*U.b,1)),T.r=Math.max(0,Math.min(p.color.r*T.r,1)),T.g=Math.max(0,Math.min(p.color.g*T.g,1)),T.b=Math.max(0,Math.min(p.color.b*T.b,1)),fa.r=Math.max(0,Math.min(p.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(p.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(p.color.b*fa.b,1)),na.r=(T.r+fa.r)*0.5,na.g=(T.g+fa.g)*0.5,na.b=(T.b+fa.b)*0.5,qa=Xa(U,T,fa,na),Sa(O,V,W,o,ea,S,0,0,1,0,0,1,qa)):(pa.r=ha.r,pa.g=ha.g,pa.b=ha.b,v(w,ia.centroidWorld,
-ia.normalWorld,pa),$.r=Math.max(0,Math.min(p.color.r*pa.r,1)),$.g=Math.max(0,Math.min(p.color.g*pa.g,1)),$.b=Math.max(0,Math.min(p.color.b*pa.b,1)),p.wireframe?Ia($,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja($)):p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshDepthMaterial)la=u.near,ca=u.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,la,ca),T.r=T.g=T.b=1-Na(f.positionScreen.z,la,ca),fa.r=fa.g=fa.b=1-Na(k.positionScreen.z,
-la,ca),na.r=(T.r+fa.r)*0.5,na.g=(T.g+fa.g)*0.5,na.b=(T.b+fa.b)*0.5,qa=Xa(U,T,fa,na),Sa(O,V,W,o,ea,S,0,0,1,0,0,1,qa);else if(p instanceof THREE.MeshNormalMaterial)$.r=Ta(ia.normalWorld.x),$.g=Ta(ia.normalWorld.y),$.b=Ta(ia.normalWorld.z),p.wireframe?Ia($,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja($)}function E(b,f,k,h,n,p,ia,t,w){m.info.render.vertices+=4;m.info.render.faces++;c(t.opacity);e(t.blending);if(t.map||t.envMap)A(b,f,h,0,1,3,ia,t,w),A(n,k,p,1,2,3,ia,t,w);else if(O=b.positionScreen.x,
-V=b.positionScreen.y,W=f.positionScreen.x,o=f.positionScreen.y,ea=k.positionScreen.x,S=k.positionScreen.y,ta=h.positionScreen.x,aa=h.positionScreen.y,ka=n.positionScreen.x,ja=n.positionScreen.y,ma=p.positionScreen.x,da=p.positionScreen.y,t instanceof THREE.MeshBasicMaterial)G(O,V,W,o,ea,S,ta,aa),t.wireframe?Ia(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(t.color);else if(t instanceof THREE.MeshLambertMaterial)M?!t.wireframe&&t.shading==THREE.SmoothShading&&ia.vertexNormalsWorld.length==
-4?(U.r=T.r=fa.r=na.r=ha.r,U.g=T.g=fa.g=na.g=ha.g,U.b=T.b=fa.b=na.b=ha.b,v(w,ia.v1.positionWorld,ia.vertexNormalsWorld[0],U),v(w,ia.v2.positionWorld,ia.vertexNormalsWorld[1],T),v(w,ia.v4.positionWorld,ia.vertexNormalsWorld[3],fa),v(w,ia.v3.positionWorld,ia.vertexNormalsWorld[2],na),U.r=Math.max(0,Math.min(t.color.r*U.r,1)),U.g=Math.max(0,Math.min(t.color.g*U.g,1)),U.b=Math.max(0,Math.min(t.color.b*U.b,1)),T.r=Math.max(0,Math.min(t.color.r*T.r,1)),T.g=Math.max(0,Math.min(t.color.g*T.g,1)),T.b=Math.max(0,
-Math.min(t.color.b*T.b,1)),fa.r=Math.max(0,Math.min(t.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(t.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(t.color.b*fa.b,1)),na.r=Math.max(0,Math.min(t.color.r*na.r,1)),na.g=Math.max(0,Math.min(t.color.g*na.g,1)),na.b=Math.max(0,Math.min(t.color.b*na.b,1)),qa=Xa(U,T,fa,na),D(O,V,W,o,ta,aa),Sa(O,V,W,o,ta,aa,0,0,1,0,0,1,qa),D(ka,ja,ea,S,ma,da),Sa(ka,ja,ea,S,ma,da,1,0,1,1,0,1,qa)):(pa.r=ha.r,pa.g=ha.g,pa.b=ha.b,v(w,ia.centroidWorld,ia.normalWorld,pa),$.r=Math.max(0,
-Math.min(t.color.r*pa.r,1)),$.g=Math.max(0,Math.min(t.color.g*pa.g,1)),$.b=Math.max(0,Math.min(t.color.b*pa.b,1)),G(O,V,W,o,ea,S,ta,aa),t.wireframe?Ia($,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja($)):(G(O,V,W,o,ea,S,ta,aa),t.wireframe?Ia(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(t.color));else if(t instanceof THREE.MeshNormalMaterial)$.r=Ta(ia.normalWorld.x),$.g=Ta(ia.normalWorld.y),$.b=Ta(ia.normalWorld.z),G(O,V,W,o,ea,S,ta,aa),t.wireframe?Ia($,
-t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja($);else if(t instanceof THREE.MeshDepthMaterial)la=u.near,ca=u.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,la,ca),T.r=T.g=T.b=1-Na(f.positionScreen.z,la,ca),fa.r=fa.g=fa.b=1-Na(h.positionScreen.z,la,ca),na.r=na.g=na.b=1-Na(k.positionScreen.z,la,ca),qa=Xa(U,T,fa,na),D(O,V,W,o,ta,aa),Sa(O,V,W,o,ta,aa,0,0,1,0,0,1,qa),D(ka,ja,ea,S,ma,da),Sa(ka,ja,ea,S,ma,da,1,0,1,1,0,1,qa)}function D(b,e,c,f,k,h){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,
-h);w.lineTo(b,e);w.closePath()}function G(b,e,c,f,k,h,m,o){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,h);w.lineTo(m,o);w.lineTo(b,e);w.closePath()}function Ia(b,e,c,k){if(I!=e)w.lineWidth=I=e;if(N!=c)w.lineCap=N=c;if(P!=k)w.lineJoin=P=k;f(b.getContextStyle());w.stroke();X.inflate(e*2)}function Ja(b){h(b.getContextStyle());w.fill()}function $a(b,e,c,f,k,m,o,n,t,p,ia,u,v){if(v.image.width!=0){if(v.needsUpdate==!0||sa[v.id]==void 0){var x=v.wrapS==THREE.RepeatWrapping,Ma=v.wrapT==THREE.RepeatWrapping;
-sa[v.id]=w.createPattern(v.image,x&&Ma?"repeat":x&&!Ma?"repeat-x":!x&&Ma?"repeat-y":"no-repeat");v.needsUpdate=!1}h(sa[v.id]);var x=v.offset.x/v.repeat.x,Ma=v.offset.y/v.repeat.y,L=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,o=(o+x)*L,n=(n+Ma)*v,t=(t+x)*L,p=(p+Ma)*v,ia=(ia+x)*L,u=(u+Ma)*v;c-=b;f-=e;k-=b;m-=e;t-=o;p-=n;ia-=o;u-=n;x=1/(t*u-ia*p);v=(u*c-p*k)*x;p=(u*f-p*m)*x;c=(t*k-ia*c)*x;f=(t*m-ia*f)*x;b=b-v*o-c*n;e=e-p*o-f*n;w.save();w.transform(v,p,c,f,b,e);w.fill();w.restore()}}
-function Sa(b,e,c,f,k,h,m,o,n,t,p,ia,u){var v,x;v=u.width-1;x=u.height-1;m*=v;o*=x;n*=v;t*=x;p*=v;ia*=x;c-=b;f-=e;k-=b;h-=e;n-=m;t-=o;p-=m;ia-=o;x=1/(n*ia-p*t);v=(ia*c-t*k)*x;t=(ia*f-t*h)*x;c=(n*k-p*c)*x;f=(n*h-p*f)*x;b=b-v*m-c*o;e=e-t*m-f*o;w.save();w.transform(v,t,c,f,b,e);w.clip();w.drawImage(u,0,0);w.restore()}function Xa(b,e,c,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),n=~~(c.r*255),t=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*
-255);ia[0]=k<0?0:k>255?255:k;ia[1]=h<0?0:h>255?255:h;ia[2]=b<0?0:b>255?255:b;ia[4]=m<0?0:m>255?255:m;ia[5]=o<0?0:o>255?255:o;ia[6]=e<0?0:e>255?255:e;ia[8]=n<0?0:n>255?255:n;ia[9]=t<0?0:t>255?255:t;ia[10]=c<0?0:c>255?255:c;ia[12]=p<0?0:p>255?255:p;ia[13]=u<0?0:u>255?255:u;ia[14]=f<0?0:f>255?255:f;Y.putImageData(Fa,0,0);Wa.drawImage(Aa,0,0);return Va}function Na(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ta(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ka(b,e){var c=e.x-b.x,f=e.y-b.y,k=c*c+f*f;
-k!=0&&(k=1/Math.sqrt(k),c*=k,f*=k,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ya,db,wa,Da,La,Ua,Za,F;this.autoClear?this.clear():w.setTransform(1,0,0,-1,t,x);m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,u,this.sortElements);(M=b.lights.length>0)&&p(b);Ya=0;for(db=k.length;Ya<db;Ya++){wa=k[Ya];X.empty();if(wa instanceof THREE.RenderableParticle){J=wa;J.x*=t;J.y*=x;Da=0;for(La=wa.materials.length;Da<La;)F=wa.materials[Da++],F.opacity!=0&&z(J,wa,F,b)}else if(wa instanceof THREE.RenderableLine){if(J=
-wa.v1,H=wa.v2,J.positionScreen.x*=t,J.positionScreen.y*=x,H.positionScreen.x*=t,H.positionScreen.y*=x,X.addPoint(J.positionScreen.x,J.positionScreen.y),X.addPoint(H.positionScreen.x,H.positionScreen.y),L.intersects(X)){Da=0;for(La=wa.materials.length;Da<La;)F=wa.materials[Da++],F.opacity!=0&&y(J,H,wa,F,b)}}else if(wa instanceof THREE.RenderableFace3){if(J=wa.v1,H=wa.v2,K=wa.v3,J.positionScreen.x*=t,J.positionScreen.y*=x,H.positionScreen.x*=t,H.positionScreen.y*=x,K.positionScreen.x*=t,K.positionScreen.y*=
-x,wa.overdraw&&(Ka(J.positionScreen,H.positionScreen),Ka(H.positionScreen,K.positionScreen),Ka(K.positionScreen,J.positionScreen)),X.add3Points(J.positionScreen.x,J.positionScreen.y,H.positionScreen.x,H.positionScreen.y,K.positionScreen.x,K.positionScreen.y),L.intersects(X)){Da=0;for(La=wa.meshMaterials.length;Da<La;)if(F=wa.meshMaterials[Da++],F instanceof THREE.MeshFaceMaterial){Ua=0;for(Za=wa.faceMaterials.length;Ua<Za;)(F=wa.faceMaterials[Ua++])&&F.opacity!=0&&A(J,H,K,0,1,2,wa,F,b)}else F.opacity!=
-0&&A(J,H,K,0,1,2,wa,F,b)}}else if(wa instanceof THREE.RenderableFace4&&(J=wa.v1,H=wa.v2,K=wa.v3,Z=wa.v4,J.positionScreen.x*=t,J.positionScreen.y*=x,H.positionScreen.x*=t,H.positionScreen.y*=x,K.positionScreen.x*=t,K.positionScreen.y*=x,Z.positionScreen.x*=t,Z.positionScreen.y*=x,C.positionScreen.copy(H.positionScreen),R.positionScreen.copy(Z.positionScreen),wa.overdraw&&(Ka(J.positionScreen,H.positionScreen),Ka(H.positionScreen,Z.positionScreen),Ka(Z.positionScreen,J.positionScreen),Ka(K.positionScreen,
-C.positionScreen),Ka(K.positionScreen,R.positionScreen)),X.addPoint(J.positionScreen.x,J.positionScreen.y),X.addPoint(H.positionScreen.x,H.positionScreen.y),X.addPoint(K.positionScreen.x,K.positionScreen.y),X.addPoint(Z.positionScreen.x,Z.positionScreen.y),L.intersects(X))){Da=0;for(La=wa.meshMaterials.length;Da<La;)if(F=wa.meshMaterials[Da++],F instanceof THREE.MeshFaceMaterial){Ua=0;for(Za=wa.faceMaterials.length;Ua<Za;)(F=wa.faceMaterials[Ua++])&&F.opacity!=0&&E(J,H,K,Z,C,R,wa,F,b)}else F.opacity!=
-0&&E(J,H,K,Z,C,R,wa,F,b)}ga.addRectangle(X)}w.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(b,e,c){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=e.normalWorld.dot(h.position)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(Z.sub(h.position,e.centroidWorld),Z.normalize(),m=e.normalWorld.dot(Z)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,k,o,n,t){m.info.render.vertices+=3;m.info.render.faces++;O=f(V++);
-O.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?I.copy(n.color):n instanceof THREE.MeshLambertMaterial?G?(N.r=P.r,N.g=P.g,N.b=P.b,b(t,o,N),I.r=Math.max(0,Math.min(n.color.r*N.r,1)),I.g=Math.max(0,Math.min(n.color.g*N.g,1)),I.b=Math.max(0,Math.min(n.color.b*N.b,1))):I.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-
-o.z*n.__farMinusNear),I.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&I.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?O.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):O.setAttribute("style","fill: "+I.getContextStyle()+"; fill-opacity: "+n.opacity);u.appendChild(O)}function e(e,c,k,o,n,t,p){m.info.render.vertices+=
-4;m.info.render.faces++;O=f(V++);O.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?I.copy(t.color):t instanceof THREE.MeshLambertMaterial?G?(N.r=P.r,N.g=P.g,N.b=P.b,b(p,n,N),I.r=Math.max(0,Math.min(t.color.r*N.r,1)),I.g=Math.max(0,Math.min(t.color.g*N.g,1)),I.b=Math.max(0,Math.min(t.color.b*N.b,1))):
-I.copy(t.color):t instanceof THREE.MeshDepthMaterial?(K=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),I.setRGB(K,K,K)):t instanceof THREE.MeshNormalMaterial&&I.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));t.wireframe?O.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):O.setAttribute("style","fill: "+I.getContextStyle()+
-"; fill-opacity: "+t.opacity);u.appendChild(O)}function f(b){C[b]==null&&(C[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&C[b].setAttribute("shape-rendering","crispEdges"));return C[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var m=this,k=null,n=new THREE.Projector,u=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,v,t,x,w,z,y,A,E=new THREE.Rectangle,D=new THREE.Rectangle,G=!1,I=new THREE.Color(16777215),N=new THREE.Color(16777215),P=new THREE.Color(0),
-J=new THREE.Color(0),H=new THREE.Color(0),K,Z=new THREE.Vector3,C=[],R=[],O,V,W,o=1;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){p=b;v=e;t=p/2;x=v/2;u.setAttribute("viewBox",-t+" "+-x+" "+p+" "+v);u.setAttribute("width",p);u.setAttribute("height",v);E.set(-t,-x,t,x)};this.clear=function(){for(;u.childNodes.length>0;)u.removeChild(u.childNodes[0])};
-this.render=function(b,f){var h,p,v,I,N,C,K,U;this.autoClear&&this.clear();m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,f,this.sortElements);W=V=0;if(G=b.lights.length>0){K=b.lights;P.setRGB(0,0,0);J.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(p=K.length;h<p;h++)v=K[h],I=v.color,v instanceof THREE.AmbientLight?(P.r+=I.r,P.g+=I.g,P.b+=I.b):v instanceof THREE.DirectionalLight?(J.r+=I.r,J.g+=I.g,J.b+=I.b):v instanceof THREE.PointLight&&(H.r+=I.r,H.g+=I.g,H.b+=I.b)}h=0;for(p=k.length;h<
-p;h++)if(K=k[h],D.empty(),K instanceof THREE.RenderableParticle){w=K;w.x*=t;w.y*=-x;v=0;for(I=K.materials.length;v<I;)v++}else if(K instanceof THREE.RenderableLine){if(w=K.v1,z=K.v2,w.positionScreen.x*=t,w.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,D.addPoint(w.positionScreen.x,w.positionScreen.y),D.addPoint(z.positionScreen.x,z.positionScreen.y),E.intersects(D)){v=0;for(I=K.materials.length;v<I;)if((U=K.materials[v++])&&U.opacity!=0){N=w;C=z;var T=W++;R[T]==null&&(R[T]=document.createElementNS("http://www.w3.org/2000/svg",
-"line"),o==0&&R[T].setAttribute("shape-rendering","crispEdges"));O=R[T];O.setAttribute("x1",N.positionScreen.x);O.setAttribute("y1",N.positionScreen.y);O.setAttribute("x2",C.positionScreen.x);O.setAttribute("y2",C.positionScreen.y);U instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: "+U.color.getContextStyle()+"; stroke-width: "+U.linewidth+"; stroke-opacity: "+U.opacity+"; stroke-linecap: "+U.linecap+"; stroke-linejoin: "+U.linejoin),u.appendChild(O))}}}else if(K instanceof
-THREE.RenderableFace3){if(w=K.v1,z=K.v2,y=K.v3,w.positionScreen.x*=t,w.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,D.addPoint(w.positionScreen.x,w.positionScreen.y),D.addPoint(z.positionScreen.x,z.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),E.intersects(D)){v=0;for(I=K.meshMaterials.length;v<I;)if(U=K.meshMaterials[v++],U instanceof THREE.MeshFaceMaterial){N=0;for(C=K.faceMaterials.length;N<C;)(U=K.faceMaterials[N++])&&
-U.opacity!=0&&c(w,z,y,K,U,b)}else U&&U.opacity!=0&&c(w,z,y,K,U,b)}}else if(K instanceof THREE.RenderableFace4&&(w=K.v1,z=K.v2,y=K.v3,A=K.v4,w.positionScreen.x*=t,w.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,A.positionScreen.x*=t,A.positionScreen.y*=-x,D.addPoint(w.positionScreen.x,w.positionScreen.y),D.addPoint(z.positionScreen.x,z.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),D.addPoint(A.positionScreen.x,A.positionScreen.y),
-E.intersects(D))){v=0;for(I=K.meshMaterials.length;v<I;)if(U=K.meshMaterials[v++],U instanceof THREE.MeshFaceMaterial){N=0;for(C=K.faceMaterials.length;N<C;)(U=K.faceMaterials[N++])&&U.opacity!=0&&e(w,z,y,A,K,U,b)}else U&&U.opacity!=0&&e(w,z,y,A,K,U,b)}}};
+THREE.CanvasRenderer=function(b){function c(b){if(A!=b)w.globalAlpha=A=b}function e(b){if(E!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}E=b}}function f(b){if(D!=b)w.strokeStyle=D=b}function h(b){if(F!=b)w.fillStyle=F=b}var m=this,k=null,n=new THREE.Projector,b=b||{},u=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
+p,v,t,x,w=u.getContext("2d"),z=new THREE.Color(0),y=0,A=1,E=0,D=null,F=null,G=null,N=null,Q=null,K,H,M,X,C=new THREE.RenderableVertex,O=new THREE.RenderableVertex,P,U,V,o,fa,S,ta,aa,la,ka,ma,ea,Y=new THREE.Color(0),T=new THREE.Color(0),Z=new THREE.Color(0),ga=new THREE.Color(0),na=new THREE.Color(0),va=[],J,da,qa,ua,sa,xa,Ea,Da,pa,Ga,L=new THREE.Rectangle,ia=new THREE.Rectangle,W=new THREE.Rectangle,ra=!1,ha=new THREE.Color,ja=new THREE.Color,za=new THREE.Color,ya=new THREE.Color,oa=new THREE.Vector3,
+Ha,Ba,ca,Aa,$,Wa,b=16;Ha=document.createElement("canvas");Ha.width=Ha.height=2;Ba=Ha.getContext("2d");Ba.fillStyle="rgba(0,0,0,1)";Ba.fillRect(0,0,2,2);ca=Ba.getImageData(0,0,2,2);Aa=ca.data;$=document.createElement("canvas");$.width=$.height=b;Wa=$.getContext("2d");Wa.translate(-b/2,-b/2);Wa.scale(b,b);b--;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,e){p=b;v=e;t=Math.floor(p/2);x=Math.floor(v/2);u.width=p;
+u.height=v;L.set(-t,-x,t,x);ia.set(-t,-x,t,x);A=1;E=0;Q=N=G=F=D=null};this.setClearColor=function(b,e){z.copy(b);y=e;ia.set(-t,-x,t,x)};this.setClearColorHex=function(b,e){z.setHex(b);y=e;ia.set(-t,-x,t,x)};this.clear=function(){w.setTransform(1,0,0,-1,t,x);ia.isEmpty()||(ia.minSelf(L),ia.inflate(2),y<1&&w.clearRect(Math.floor(ia.getX()),Math.floor(ia.getY()),Math.floor(ia.getWidth()),Math.floor(ia.getHeight())),y>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+
+","+Math.floor(z.b*255)+","+y+")"),w.fillRect(Math.floor(ia.getX()),Math.floor(ia.getY()),Math.floor(ia.getWidth()),Math.floor(ia.getHeight()))),ia.empty())};this.render=function(b,u){function p(b){var e,c,f,k=b.lights;ja.setRGB(0,0,0);za.setRGB(0,0,0);ya.setRGB(0,0,0);b=0;for(e=k.length;b<e;b++)c=k[b],f=c.color,c instanceof THREE.AmbientLight?(ja.r+=f.r,ja.g+=f.g,ja.b+=f.b):c instanceof THREE.DirectionalLight?(za.r+=f.r,za.g+=f.g,za.b+=f.b):c instanceof THREE.PointLight&&(ya.r+=f.r,ya.g+=f.g,ya.b+=
+f.b)}function v(b,e,c,f){var k,h,m,o,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],m=h.color,h instanceof THREE.DirectionalLight?(o=c.dot(h.position),o<=0||(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)):h instanceof THREE.PointLight&&(o=c.dot(oa.sub(h.position,e).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(e.distanceTo(h.position)/h.distance,1),o!=0&&(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)))}function z(b,k,m){c(m.opacity);e(m.blending);var o,n,u,$,p,v;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)$=
+m.map.image,p=$.width>>1,v=$.height>>1,m=k.scale.x*t,u=k.scale.y*x,o=m*p,n=u*v,W.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(W)&&(w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(m,-u),w.translate(-p,-v),w.drawImage($,0,0),w.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*t,n=k.scale.y*x,W.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(W)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(o,n),m.program(w),
+w.restore()))}function y(b,k,h,m){c(m.opacity);e(m.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(k.positionScreen.x,k.positionScreen.y);w.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(G!=b)w.lineWidth=G=b;b=m.linecap;if(N!=b)w.lineCap=N=b;b=m.linejoin;if(Q!=b)w.lineJoin=Q=b;f(m.color.getContextStyle());w.stroke();W.inflate(m.linewidth*2)}}function A(b,f,k,h,n,t,$,p,w){m.info.render.vertices+=3;m.info.render.faces++;c(p.opacity);e(p.blending);
+P=b.positionScreen.x;U=b.positionScreen.y;V=f.positionScreen.x;o=f.positionScreen.y;fa=k.positionScreen.x;S=k.positionScreen.y;D(P,U,V,o,fa,S);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ua=$.uvs[0],ab(P,U,V,o,fa,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[t].u,ua[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,oa.copy($.vertexNormalsWorld[0]),sa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,
+xa=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy($.vertexNormalsWorld[1]),Ea=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Da=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy($.vertexNormalsWorld[2]),pa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Ga=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,ab(P,U,V,o,fa,S,sa,xa,Ea,Da,pa,Ga,p.envMap)}else p.wireframe?Ka(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):La(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&
+(p.map.mapping instanceof THREE.UVMapping&&(ua=$.uvs[0],ab(P,U,V,o,fa,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[t].u,ua[t].v,p.map)),e(THREE.SubtractiveBlending)),ra?!p.wireframe&&p.shading==THREE.SmoothShading&&$.vertexNormalsWorld.length==3?(T.r=Z.r=ga.r=ja.r,T.g=Z.g=ga.g=ja.g,T.b=Z.b=ga.b=ja.b,v(w,$.v1.positionWorld,$.vertexNormalsWorld[0],T),v(w,$.v2.positionWorld,$.vertexNormalsWorld[1],Z),v(w,$.v3.positionWorld,$.vertexNormalsWorld[2],ga),T.r=Math.max(0,Math.min(p.color.r*T.r,1)),T.g=Math.max(0,
+Math.min(p.color.g*T.g,1)),T.b=Math.max(0,Math.min(p.color.b*T.b,1)),Z.r=Math.max(0,Math.min(p.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(p.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(p.color.b*Z.b,1)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),na.r=(Z.r+ga.r)*0.5,na.g=(Z.g+ga.g)*0.5,na.b=(Z.b+ga.b)*0.5,qa=Xa(T,Z,ga,na),Ta(P,U,V,o,fa,S,0,0,1,0,0,1,qa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,v(w,$.centroidWorld,$.normalWorld,
+ha),Y.r=Math.max(0,Math.min(p.color.r*ha.r,1)),Y.g=Math.max(0,Math.min(p.color.g*ha.g,1)),Y.b=Math.max(0,Math.min(p.color.b*ha.b,1)),p.wireframe?Ka(Y,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):La(Y)):p.wireframe?Ka(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):La(p.color);else if(p instanceof THREE.MeshDepthMaterial)J=u.near,da=u.far,T.r=T.g=T.b=1-Oa(b.positionScreen.z,J,da),Z.r=Z.g=Z.b=1-Oa(f.positionScreen.z,J,da),ga.r=ga.g=ga.b=1-Oa(k.positionScreen.z,J,
+da),na.r=(Z.r+ga.r)*0.5,na.g=(Z.g+ga.g)*0.5,na.b=(Z.b+ga.b)*0.5,qa=Xa(T,Z,ga,na),Ta(P,U,V,o,fa,S,0,0,1,0,0,1,qa);else if(p instanceof THREE.MeshNormalMaterial)Y.r=Ua($.normalWorld.x),Y.g=Ua($.normalWorld.y),Y.b=Ua($.normalWorld.z),p.wireframe?Ka(Y,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):La(Y)}function E(b,f,k,h,n,p,t,$,w){m.info.render.vertices+=4;m.info.render.faces++;c($.opacity);e($.blending);if($.map||$.envMap)A(b,f,h,0,1,3,t,$,w),A(n,k,p,1,2,3,t,$,w);else if(P=b.positionScreen.x,
+U=b.positionScreen.y,V=f.positionScreen.x,o=f.positionScreen.y,fa=k.positionScreen.x,S=k.positionScreen.y,ta=h.positionScreen.x,aa=h.positionScreen.y,la=n.positionScreen.x,ka=n.positionScreen.y,ma=p.positionScreen.x,ea=p.positionScreen.y,$ instanceof THREE.MeshBasicMaterial)F(P,U,V,o,fa,S,ta,aa),$.wireframe?Ka($.color,$.wireframeLinewidth,$.wireframeLinecap,$.wireframeLinejoin):La($.color);else if($ instanceof THREE.MeshLambertMaterial)ra?!$.wireframe&&$.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==
+4?(T.r=Z.r=ga.r=na.r=ja.r,T.g=Z.g=ga.g=na.g=ja.g,T.b=Z.b=ga.b=na.b=ja.b,v(w,t.v1.positionWorld,t.vertexNormalsWorld[0],T),v(w,t.v2.positionWorld,t.vertexNormalsWorld[1],Z),v(w,t.v4.positionWorld,t.vertexNormalsWorld[3],ga),v(w,t.v3.positionWorld,t.vertexNormalsWorld[2],na),T.r=Math.max(0,Math.min($.color.r*T.r,1)),T.g=Math.max(0,Math.min($.color.g*T.g,1)),T.b=Math.max(0,Math.min($.color.b*T.b,1)),Z.r=Math.max(0,Math.min($.color.r*Z.r,1)),Z.g=Math.max(0,Math.min($.color.g*Z.g,1)),Z.b=Math.max(0,Math.min($.color.b*
+Z.b,1)),ga.r=Math.max(0,Math.min($.color.r*ga.r,1)),ga.g=Math.max(0,Math.min($.color.g*ga.g,1)),ga.b=Math.max(0,Math.min($.color.b*ga.b,1)),na.r=Math.max(0,Math.min($.color.r*na.r,1)),na.g=Math.max(0,Math.min($.color.g*na.g,1)),na.b=Math.max(0,Math.min($.color.b*na.b,1)),qa=Xa(T,Z,ga,na),D(P,U,V,o,ta,aa),Ta(P,U,V,o,ta,aa,0,0,1,0,0,1,qa),D(la,ka,fa,S,ma,ea),Ta(la,ka,fa,S,ma,ea,1,0,1,1,0,1,qa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,v(w,t.centroidWorld,t.normalWorld,ha),Y.r=Math.max(0,Math.min($.color.r*ha.r,
+1)),Y.g=Math.max(0,Math.min($.color.g*ha.g,1)),Y.b=Math.max(0,Math.min($.color.b*ha.b,1)),F(P,U,V,o,fa,S,ta,aa),$.wireframe?Ka(Y,$.wireframeLinewidth,$.wireframeLinecap,$.wireframeLinejoin):La(Y)):(F(P,U,V,o,fa,S,ta,aa),$.wireframe?Ka($.color,$.wireframeLinewidth,$.wireframeLinecap,$.wireframeLinejoin):La($.color));else if($ instanceof THREE.MeshNormalMaterial)Y.r=Ua(t.normalWorld.x),Y.g=Ua(t.normalWorld.y),Y.b=Ua(t.normalWorld.z),F(P,U,V,o,fa,S,ta,aa),$.wireframe?Ka(Y,$.wireframeLinewidth,$.wireframeLinecap,
+$.wireframeLinejoin):La(Y);else if($ instanceof THREE.MeshDepthMaterial)J=u.near,da=u.far,T.r=T.g=T.b=1-Oa(b.positionScreen.z,J,da),Z.r=Z.g=Z.b=1-Oa(f.positionScreen.z,J,da),ga.r=ga.g=ga.b=1-Oa(h.positionScreen.z,J,da),na.r=na.g=na.b=1-Oa(k.positionScreen.z,J,da),qa=Xa(T,Z,ga,na),D(P,U,V,o,ta,aa),Ta(P,U,V,o,ta,aa,0,0,1,0,0,1,qa),D(la,ka,fa,S,ma,ea),Ta(la,ka,fa,S,ma,ea,1,0,1,1,0,1,qa)}function D(b,e,c,f,k,h){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,h);w.lineTo(b,e);w.closePath()}function F(b,
+e,c,f,k,h,m,o){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,h);w.lineTo(m,o);w.lineTo(b,e);w.closePath()}function Ka(b,e,c,k){if(G!=e)w.lineWidth=G=e;if(N!=c)w.lineCap=N=c;if(Q!=k)w.lineJoin=Q=k;f(b.getContextStyle());w.stroke();W.inflate(e*2)}function La(b){h(b.getContextStyle());w.fill()}function ab(b,e,c,f,k,m,o,n,$,p,t,u,v){if(v.image.width!=0){if(v.needsUpdate==!0||va[v.id]==void 0){var x=v.wrapS==THREE.RepeatWrapping,L=v.wrapT==THREE.RepeatWrapping;va[v.id]=w.createPattern(v.image,x&&
+L?"repeat":x&&!L?"repeat-x":!x&&L?"repeat-y":"no-repeat");v.needsUpdate=!1}h(va[v.id]);var x=v.offset.x/v.repeat.x,L=v.offset.y/v.repeat.y,$a=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,o=(o+x)*$a,n=(n+L)*v,$=($+x)*$a,p=(p+L)*v,t=(t+x)*$a,u=(u+L)*v;c-=b;f-=e;k-=b;m-=e;$-=o;p-=n;t-=o;u-=n;x=1/($*u-t*p);v=(u*c-p*k)*x;p=(u*f-p*m)*x;c=($*k-t*c)*x;f=($*m-t*f)*x;b=b-v*o-c*n;e=e-p*o-f*n;w.save();w.transform(v,p,c,f,b,e);w.fill();w.restore()}}function Ta(b,e,c,f,k,h,m,o,n,$,p,t,u){var v,
+x;v=u.width-1;x=u.height-1;m*=v;o*=x;n*=v;$*=x;p*=v;t*=x;c-=b;f-=e;k-=b;h-=e;n-=m;$-=o;p-=m;t-=o;x=1/(n*t-p*$);v=(t*c-$*k)*x;$=(t*f-$*h)*x;c=(n*k-p*c)*x;f=(n*h-p*f)*x;b=b-v*m-c*o;e=e-$*m-f*o;w.save();w.transform(v,$,c,f,b,e);w.clip();w.drawImage(u,0,0);w.restore()}function Xa(b,e,c,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),n=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),t=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Aa[0]=k<0?0:k>255?255:k;Aa[1]=h<0?0:h>255?255:
+h;Aa[2]=b<0?0:b>255?255:b;Aa[4]=m<0?0:m>255?255:m;Aa[5]=o<0?0:o>255?255:o;Aa[6]=e<0?0:e>255?255:e;Aa[8]=n<0?0:n>255?255:n;Aa[9]=p<0?0:p>255?255:p;Aa[10]=c<0?0:c>255?255:c;Aa[12]=t<0?0:t>255?255:t;Aa[13]=u<0?0:u>255?255:u;Aa[14]=f<0?0:f>255?255:f;Ba.putImageData(ca,0,0);Wa.drawImage(Ha,0,0);return $}function Oa(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ua(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ma(b,e){var c=e.x-b.x,f=e.y-b.y,k=c*c+f*f;k!=0&&(k=1/Math.sqrt(k),c*=k,f*=k,e.x+=c,e.y+=f,b.x-=
+c,b.y-=f)}var Ya,db,wa,Fa,Na,Va,Za,Ca;this.autoClear?this.clear():w.setTransform(1,0,0,-1,t,x);m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,u,this.sortElements);(ra=b.lights.length>0)&&p(b);Ya=0;for(db=k.length;Ya<db;Ya++){wa=k[Ya];W.empty();if(wa instanceof THREE.RenderableParticle){K=wa;K.x*=t;K.y*=x;Fa=0;for(Na=wa.materials.length;Fa<Na;)Ca=wa.materials[Fa++],Ca.opacity!=0&&z(K,wa,Ca,b)}else if(wa instanceof THREE.RenderableLine){if(K=wa.v1,H=wa.v2,K.positionScreen.x*=t,K.positionScreen.y*=
+x,H.positionScreen.x*=t,H.positionScreen.y*=x,W.addPoint(K.positionScreen.x,K.positionScreen.y),W.addPoint(H.positionScreen.x,H.positionScreen.y),L.intersects(W)){Fa=0;for(Na=wa.materials.length;Fa<Na;)Ca=wa.materials[Fa++],Ca.opacity!=0&&y(K,H,wa,Ca,b)}}else if(wa instanceof THREE.RenderableFace3){if(K=wa.v1,H=wa.v2,M=wa.v3,K.positionScreen.x*=t,K.positionScreen.y*=x,H.positionScreen.x*=t,H.positionScreen.y*=x,M.positionScreen.x*=t,M.positionScreen.y*=x,wa.overdraw&&(Ma(K.positionScreen,H.positionScreen),
+Ma(H.positionScreen,M.positionScreen),Ma(M.positionScreen,K.positionScreen)),W.add3Points(K.positionScreen.x,K.positionScreen.y,H.positionScreen.x,H.positionScreen.y,M.positionScreen.x,M.positionScreen.y),L.intersects(W)){Fa=0;for(Na=wa.meshMaterials.length;Fa<Na;)if(Ca=wa.meshMaterials[Fa++],Ca instanceof THREE.MeshFaceMaterial){Va=0;for(Za=wa.faceMaterials.length;Va<Za;)(Ca=wa.faceMaterials[Va++])&&Ca.opacity!=0&&A(K,H,M,0,1,2,wa,Ca,b)}else Ca.opacity!=0&&A(K,H,M,0,1,2,wa,Ca,b)}}else if(wa instanceof
+THREE.RenderableFace4&&(K=wa.v1,H=wa.v2,M=wa.v3,X=wa.v4,K.positionScreen.x*=t,K.positionScreen.y*=x,H.positionScreen.x*=t,H.positionScreen.y*=x,M.positionScreen.x*=t,M.positionScreen.y*=x,X.positionScreen.x*=t,X.positionScreen.y*=x,C.positionScreen.copy(H.positionScreen),O.positionScreen.copy(X.positionScreen),wa.overdraw&&(Ma(K.positionScreen,H.positionScreen),Ma(H.positionScreen,X.positionScreen),Ma(X.positionScreen,K.positionScreen),Ma(M.positionScreen,C.positionScreen),Ma(M.positionScreen,O.positionScreen)),
+W.addPoint(K.positionScreen.x,K.positionScreen.y),W.addPoint(H.positionScreen.x,H.positionScreen.y),W.addPoint(M.positionScreen.x,M.positionScreen.y),W.addPoint(X.positionScreen.x,X.positionScreen.y),L.intersects(W))){Fa=0;for(Na=wa.meshMaterials.length;Fa<Na;)if(Ca=wa.meshMaterials[Fa++],Ca instanceof THREE.MeshFaceMaterial){Va=0;for(Za=wa.faceMaterials.length;Va<Za;)(Ca=wa.faceMaterials[Va++])&&Ca.opacity!=0&&E(K,H,M,X,C,O,wa,Ca,b)}else Ca.opacity!=0&&E(K,H,M,X,C,O,wa,Ca,b)}ia.addRectangle(W)}w.setTransform(1,
+0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(b,e,c){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=e.normalWorld.dot(h.position)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(X.sub(h.position,e.centroidWorld),X.normalize(),m=e.normalWorld.dot(X)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,k,o,n,p){m.info.render.vertices+=3;m.info.render.faces++;P=f(U++);
+P.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.copy(n.color):n instanceof THREE.MeshLambertMaterial?F?(N.r=Q.r,N.g=Q.g,N.b=Q.b,b(p,o,N),G.r=Math.max(0,Math.min(n.color.r*N.r,1)),G.g=Math.max(0,Math.min(n.color.g*N.g,1)),G.b=Math.max(0,Math.min(n.color.b*N.b,1))):G.copy(n.color):n instanceof THREE.MeshDepthMaterial?(M=1-n.__2near/(n.__farPlusNear-
+o.z*n.__farMinusNear),G.setRGB(M,M,M)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?P.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):P.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+n.opacity);u.appendChild(P)}function e(e,c,k,o,n,p,t){m.info.render.vertices+=
+4;m.info.render.faces++;P=f(U++);P.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?G.copy(p.color):p instanceof THREE.MeshLambertMaterial?F?(N.r=Q.r,N.g=Q.g,N.b=Q.b,b(t,n,N),G.r=Math.max(0,Math.min(p.color.r*N.r,1)),G.g=Math.max(0,Math.min(p.color.g*N.g,1)),G.b=Math.max(0,Math.min(p.color.b*N.b,1))):
+G.copy(p.color):p instanceof THREE.MeshDepthMaterial?(M=1-p.__2near/(p.__farPlusNear-n.z*p.__farMinusNear),G.setRGB(M,M,M)):p instanceof THREE.MeshNormalMaterial&&G.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));p.wireframe?P.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):P.setAttribute("style","fill: "+G.getContextStyle()+
+"; fill-opacity: "+p.opacity);u.appendChild(P)}function f(b){C[b]==null&&(C[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&C[b].setAttribute("shape-rendering","crispEdges"));return C[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var m=this,k=null,n=new THREE.Projector,u=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,v,t,x,w,z,y,A,E=new THREE.Rectangle,D=new THREE.Rectangle,F=!1,G=new THREE.Color(16777215),N=new THREE.Color(16777215),Q=new THREE.Color(0),
+K=new THREE.Color(0),H=new THREE.Color(0),M,X=new THREE.Vector3,C=[],O=[],P,U,V,o=1;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){p=b;v=e;t=p/2;x=v/2;u.setAttribute("viewBox",-t+" "+-x+" "+p+" "+v);u.setAttribute("width",p);u.setAttribute("height",v);E.set(-t,-x,t,x)};this.clear=function(){for(;u.childNodes.length>0;)u.removeChild(u.childNodes[0])};
+this.render=function(b,f){var h,p,v,G,N,C,M,T;this.autoClear&&this.clear();m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,f,this.sortElements);V=U=0;if(F=b.lights.length>0){M=b.lights;Q.setRGB(0,0,0);K.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(p=M.length;h<p;h++)v=M[h],G=v.color,v instanceof THREE.AmbientLight?(Q.r+=G.r,Q.g+=G.g,Q.b+=G.b):v instanceof THREE.DirectionalLight?(K.r+=G.r,K.g+=G.g,K.b+=G.b):v instanceof THREE.PointLight&&(H.r+=G.r,H.g+=G.g,H.b+=G.b)}h=0;for(p=k.length;h<
+p;h++)if(M=k[h],D.empty(),M instanceof THREE.RenderableParticle){w=M;w.x*=t;w.y*=-x;v=0;for(G=M.materials.length;v<G;)v++}else if(M instanceof THREE.RenderableLine){if(w=M.v1,z=M.v2,w.positionScreen.x*=t,w.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,D.addPoint(w.positionScreen.x,w.positionScreen.y),D.addPoint(z.positionScreen.x,z.positionScreen.y),E.intersects(D)){v=0;for(G=M.materials.length;v<G;)if((T=M.materials[v++])&&T.opacity!=0){N=w;C=z;var Z=V++;O[Z]==null&&(O[Z]=document.createElementNS("http://www.w3.org/2000/svg",
+"line"),o==0&&O[Z].setAttribute("shape-rendering","crispEdges"));P=O[Z];P.setAttribute("x1",N.positionScreen.x);P.setAttribute("y1",N.positionScreen.y);P.setAttribute("x2",C.positionScreen.x);P.setAttribute("y2",C.positionScreen.y);T instanceof THREE.LineBasicMaterial&&(P.setAttribute("style","fill: none; stroke: "+T.color.getContextStyle()+"; stroke-width: "+T.linewidth+"; stroke-opacity: "+T.opacity+"; stroke-linecap: "+T.linecap+"; stroke-linejoin: "+T.linejoin),u.appendChild(P))}}}else if(M instanceof
+THREE.RenderableFace3){if(w=M.v1,z=M.v2,y=M.v3,w.positionScreen.x*=t,w.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,D.addPoint(w.positionScreen.x,w.positionScreen.y),D.addPoint(z.positionScreen.x,z.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),E.intersects(D)){v=0;for(G=M.meshMaterials.length;v<G;)if(T=M.meshMaterials[v++],T instanceof THREE.MeshFaceMaterial){N=0;for(C=M.faceMaterials.length;N<C;)(T=M.faceMaterials[N++])&&
+T.opacity!=0&&c(w,z,y,M,T,b)}else T&&T.opacity!=0&&c(w,z,y,M,T,b)}}else if(M instanceof THREE.RenderableFace4&&(w=M.v1,z=M.v2,y=M.v3,A=M.v4,w.positionScreen.x*=t,w.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,A.positionScreen.x*=t,A.positionScreen.y*=-x,D.addPoint(w.positionScreen.x,w.positionScreen.y),D.addPoint(z.positionScreen.x,z.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),D.addPoint(A.positionScreen.x,A.positionScreen.y),
+E.intersects(D))){v=0;for(G=M.meshMaterials.length;v<G;)if(T=M.meshMaterials[v++],T instanceof THREE.MeshFaceMaterial){N=0;for(C=M.faceMaterials.length;N<C;)(T=M.faceMaterials[N++])&&T.opacity!=0&&e(w,z,y,A,M,T,b)}else T&&T.opacity!=0&&e(w,z,y,A,M,T,b)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
@@ -225,120 +225,120 @@ THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderCh
 "void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 "void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}};
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function c(b,e,c){var f,k,h,m=b.vertices,n=m.length,t=b.colors,p=t.length,u=b.__vertexArray,w=b.__colorArray,v=b.__sortArray,x=b.__dirtyVertices,L=b.__dirtyColors,z=b.__webglCustomAttributes,X,y;if(z)for(X in z)z[X].offset=0;if(c.sortParticles){qa.multiplySelf(c.matrixWorld);for(f=0;f<n;f++)k=m[f].position,ya.copy(k),qa.multiplyVector3(ya),v[f]=[ya.z,f];v.sort(function(b,e){return e[0]-b[0]});for(f=0;f<n;f++)k=m[v[f][1]].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;
-for(f=0;f<p;f++)h=f*3,color=t[v[f][1]],w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if(z)for(X in z){f=z[X];t=f.value.length;for(h=0;h<t;h++){index=v[h][1];p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[index];f.size===2?(f.array[p]=y.x,f.array[p+1]=y.y):f.size===3?f.type==="c"?(f.array[p]=y.r,f.array[p+1]=y.g,f.array[p+2]=y.b):(f.array[p]=y.x,f.array[p+1]=y.y,f.array[p+2]=y.z):(f.array[p]=
-y.x,f.array[p+1]=y.y,f.array[p+2]=y.z,f.array[p+3]=y.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;if(L)for(f=0;f<p;f++)color=t[f],h=f*3,w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if(z)for(X in z)if(f=z[X],f.__original.needsUpdate){t=f.value.length;for(h=0;h<t;h++){p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[h];f.size===2?(f.array[p]=
-y.x,f.array[p+1]=y.y):f.size===3?f.type==="c"?(f.array[p]=y.r,f.array[p+1]=y.g,f.array[p+2]=y.b):(f.array[p]=y.x,f.array[p+1]=y.y,f.array[p+2]=y.z):(f.array[p]=y.x,f.array[p+1]=y.y,f.array[p+2]=y.z,f.array[p+3]=y.w)}f.offset+=f.size}}}if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,u,e);if(L||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,w,e);if(z)for(X in z)if(f=z[X],f.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
-f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,k){f.program||W.initMaterial(f,e,c,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(W.maxMorphTargets);for(var h=0,m=W.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var h=f.program,m=h.uniforms,n=f.uniforms;h!=S&&(o.useProgram(h),S=h);o.uniformMatrix4fv(m.projectionMatrix,!1,ua);if(c&&f.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,
-n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var t,p,u,w=0,v=0,x=0,L,z,X,y=Ca,A=y.directional.colors,ga=y.directional.positions,E=y.point.colors,D=y.point.positions,G=y.point.distances,I=0,M=0,c=p=X=0;for(t=e.length;c<t;c++)if(p=e[c],u=p.color,L=p.position,z=p.intensity,X=p.distance,p instanceof THREE.AmbientLight)w+=u.r,v+=u.g,x+=u.b;else if(p instanceof THREE.DirectionalLight)X=
-I*3,A[X]=u.r*z,A[X+1]=u.g*z,A[X+2]=u.b*z,ga[X]=L.x,ga[X+1]=L.y,ga[X+2]=L.z,I+=1;else if(p instanceof THREE.SpotLight)X=I*3,A[X]=u.r*z,A[X+1]=u.g*z,A[X+2]=u.b*z,u=1/L.length(),ga[X]=L.x*u,ga[X+1]=L.y*u,ga[X+2]=L.z*u,I+=1;else if(p instanceof THREE.PointLight)p=M*3,E[p]=u.r*z,E[p+1]=u.g*z,E[p+2]=u.b*z,D[p]=L.x,D[p+1]=L.y,D[p+2]=L.z,G[M]=X,M+=1;for(c=I*3;c<A.length;c++)A[c]=0;for(c=M*3;c<E.length;c++)E[c]=0;y.point.length=M;y.directional.length=I;y.ambient[0]=w;y.ambient[1]=v;y.ambient[2]=x;e=Ca;n.enableLighting.value=
+THREE.WebGLRenderer=function(b){function c(b,e,c){var f,k,h,m=b.vertices,n=m.length,p=b.colors,t=p.length,u=b.__vertexArray,w=b.__colorArray,v=b.__sortArray,x=b.__dirtyVertices,L=b.__dirtyColors,z=b.__webglCustomAttributes,W,y;if(z)for(W in z)z[W].offset=0;if(c.sortParticles){qa.multiplySelf(c.matrixWorld);for(f=0;f<n;f++)k=m[f].position,xa.copy(k),qa.multiplyVector3(xa),v[f]=[xa.z,f];v.sort(function(b,e){return e[0]-b[0]});for(f=0;f<n;f++)k=m[v[f][1]].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;
+for(f=0;f<t;f++)h=f*3,color=p[v[f][1]],w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if(z)for(W in z){f=z[W];p=f.value.length;for(h=0;h<p;h++){index=v[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(L)for(f=0;f<t;f++)color=p[f],h=f*3,w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if(z)for(W in z)if(f=z[W],f.__original.needsUpdate){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||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,u,e);if(L||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,w,e);if(z)for(W in z)if(f=z[W],f.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
+f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,k){f.program||V.initMaterial(f,e,c,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(V.maxMorphTargets);for(var h=0,m=V.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var h=f.program,m=h.uniforms,n=f.uniforms;h!=S&&(o.useProgram(h),S=h);o.uniformMatrix4fv(m.projectionMatrix,!1,ua);if(c&&f.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,
+n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var p,t,u,w=0,v=0,x=0,L,z,W,y=Ea,A=y.directional.colors,ia=y.directional.positions,E=y.point.colors,D=y.point.positions,F=y.point.distances,G=0,J=0,c=t=W=0;for(p=e.length;c<p;c++)if(t=e[c],u=t.color,L=t.position,z=t.intensity,W=t.distance,t instanceof THREE.AmbientLight)w+=u.r,v+=u.g,x+=u.b;else if(t instanceof THREE.DirectionalLight)W=
+G*3,A[W]=u.r*z,A[W+1]=u.g*z,A[W+2]=u.b*z,ia[W]=L.x,ia[W+1]=L.y,ia[W+2]=L.z,G+=1;else if(t instanceof THREE.SpotLight)W=G*3,A[W]=u.r*z,A[W+1]=u.g*z,A[W+2]=u.b*z,u=1/L.length(),ia[W]=L.x*u,ia[W+1]=L.y*u,ia[W+2]=L.z*u,G+=1;else if(t instanceof THREE.PointLight)t=J*3,E[t]=u.r*z,E[t+1]=u.g*z,E[t+2]=u.b*z,D[t]=L.x,D[t+1]=L.y,D[t+2]=L.z,F[J]=W,J+=1;for(c=G*3;c<A.length;c++)A[c]=0;for(c=J*3;c<E.length;c++)E[c]=0;y.point.length=J;y.directional.length=G;y.ambient[0]=w;y.ambient[1]=v;y.ambient[2]=x;e=Ea;n.enableLighting.value=
 e.directional.length+e.point.length;n.ambientLightColor.value=e.ambient;n.directionalLightColor.value=e.directional.colors;n.directionalLightDirection.value=e.directional.positions;n.pointLightColor.value=e.point.colors;n.pointLightPosition.value=e.point.positions;n.pointLightDistance.value=e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)n.diffuse.value=f.color,n.opacity.value=f.opacity,(n.map.texture=f.map)&&
 e.directional.length+e.point.length;n.ambientLightColor.value=e.ambient;n.directionalLightColor.value=e.directional.colors;n.directionalLightDirection.value=e.directional.positions;n.pointLightColor.value=e.point.colors;n.pointLightPosition.value=e.point.positions;n.pointLightDistance.value=e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)n.diffuse.value=f.color,n.opacity.value=f.opacity,(n.map.texture=f.map)&&
 n.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),n.lightMap.texture=f.lightMap,n.envMap.texture=f.envMap,n.reflectivity.value=f.reflectivity,n.refractionRatio.value=f.refractionRatio,n.combine.value=f.combine,n.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)n.diffuse.value=f.color,n.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)n.psColor.value=f.color,n.opacity.value=
 n.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),n.lightMap.texture=f.lightMap,n.envMap.texture=f.envMap,n.reflectivity.value=f.reflectivity,n.refractionRatio.value=f.refractionRatio,n.combine.value=f.combine,n.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)n.diffuse.value=f.color,n.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)n.psColor.value=f.color,n.opacity.value=
-f.opacity,n.size.value=f.size,n.scale.value=va.height/2,n.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)n.ambient.value=f.ambient,n.specular.value=f.specular,n.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)n.mNear.value=b.near,n.mFar.value=b.far,n.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)n.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&n.shadowMatrix){for(e=0;e<pa.length;e++)n.shadowMatrix.value[e]=pa[e],n.shadowMap.texture[e]=
-W.shadowMap[e];n.shadowDarkness.value=W.shadowMapDarkness;n.shadowBias.value=W.shadowMapBias}for(var la in n)if(t=h.uniforms[la])if(c=n[la],w=c.type,e=c.value,w=="i")o.uniform1i(t,e);else if(w=="f")o.uniform1f(t,e);else if(w=="v2")o.uniform2f(t,e.x,e.y);else if(w=="v3")o.uniform3f(t,e.x,e.y,e.z);else if(w=="v4")o.uniform4f(t,e.x,e.y,e.z,e.w);else if(w=="c")o.uniform3f(t,e.r,e.g,e.b);else if(w=="fv1")o.uniform1fv(t,e);else if(w=="fv")o.uniform3fv(t,e);else if(w=="v3v"){if(!c._array)c._array=new Float32Array(3*
-e.length);w=0;for(v=e.length;w<v;w++)x=w*3,c._array[x]=e[w].x,c._array[x+1]=e[w].y,c._array[x+2]=e[w].z;o.uniform3fv(t,c._array)}else if(w=="m4"){if(!c._array)c._array=new Float32Array(16);e.flattenToArray(c._array);o.uniformMatrix4fv(t,!1,c._array)}else if(w=="m4v"){if(!c._array)c._array=new Float32Array(16*e.length);w=0;for(v=e.length;w<v;w++)e[w].flattenToArrayOffset(c._array,w*16);o.uniformMatrix4fv(t,!1,c._array)}else if(w=="t"){if(o.uniform1i(t,e),t=c.texture)if(t.image instanceof Array&&t.image.length==
-6){if(c=t,c.image.length==6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);for(e=0;e<6;e++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,c.image[e]);H(o.TEXTURE_CUBE_MAP,c,c.image[0]);c.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?
-(c=t,o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_CUBE_MAP,c.__webglTexture)):K(t,e)}else if(w=="tv"){if(!c._array){c._array=[];w=0;for(v=c.texture.length;w<v;w++)c._array[w]=e+w}o.uniform1iv(t,c._array);w=0;for(v=c.texture.length;w<v;w++)(t=c.texture[w])&&K(t,c._array[w])}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&
-m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,ra);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,ra),o.uniformMatrix4fv(m.boneGlobalMatrices,
+f.opacity,n.size.value=f.size,n.scale.value=Da.height/2,n.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)n.ambient.value=f.ambient,n.specular.value=f.specular,n.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)n.mNear.value=b.near,n.mFar.value=b.far,n.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)n.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&n.shadowMatrix){for(e=0;e<ja.length;e++)n.shadowMatrix.value[e]=ja[e],n.shadowMap.texture[e]=
+V.shadowMap[e];n.shadowDarkness.value=V.shadowMapDarkness;n.shadowBias.value=V.shadowMapBias}for(var ra in n)if(p=h.uniforms[ra])if(c=n[ra],w=c.type,e=c.value,w=="i")o.uniform1i(p,e);else if(w=="f")o.uniform1f(p,e);else if(w=="v2")o.uniform2f(p,e.x,e.y);else if(w=="v3")o.uniform3f(p,e.x,e.y,e.z);else if(w=="v4")o.uniform4f(p,e.x,e.y,e.z,e.w);else if(w=="c")o.uniform3f(p,e.r,e.g,e.b);else if(w=="fv1")o.uniform1fv(p,e);else if(w=="fv")o.uniform3fv(p,e);else if(w=="v3v"){if(!c._array)c._array=new Float32Array(3*
+e.length);w=0;for(v=e.length;w<v;w++)x=w*3,c._array[x]=e[w].x,c._array[x+1]=e[w].y,c._array[x+2]=e[w].z;o.uniform3fv(p,c._array)}else if(w=="m4"){if(!c._array)c._array=new Float32Array(16);e.flattenToArray(c._array);o.uniformMatrix4fv(p,!1,c._array)}else if(w=="m4v"){if(!c._array)c._array=new Float32Array(16*e.length);w=0;for(v=e.length;w<v;w++)e[w].flattenToArrayOffset(c._array,w*16);o.uniformMatrix4fv(p,!1,c._array)}else if(w=="t"){if(o.uniform1i(p,e),p=c.texture)if(p.image instanceof Array&&p.image.length==
+6){if(c=p,c.image.length==6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);for(e=0;e<6;e++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,c.image[e]);H(o.TEXTURE_CUBE_MAP,c,c.image[0]);c.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else p instanceof THREE.WebGLRenderTargetCube?
+(c=p,o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_CUBE_MAP,c.__webglTexture)):M(p,e)}else if(w=="tv"){if(!c._array){c._array=[];w=0;for(v=c.texture.length;w<v;w++)c._array[w]=e+w}o.uniform1iv(p,c._array);w=0;for(v=c.texture.length;w<v;w++)(p=c.texture[w])&&M(p,c._array[w])}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&
+m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,sa);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,sa),o.uniformMatrix4fv(m.boneGlobalMatrices,
 !1,k.boneMatrices));return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,b=e(b,c,f,k,m).attributes;if(!k.morphTargets&&b.position>=0)o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0);else if(m.morphTargetBase){c=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),
 !1,k.boneMatrices));return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,b=e(b,c,f,k,m).attributes;if(!k.morphTargets&&b.position>=0)o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0);else if(m.morphTargetBase){c=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),
-o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var f=0,t=m.morphTargetForcedOrder,p=m.morphTargetInfluences;f<k.numSupportedMorphTargets&&f<t.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[t[f]]),o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[f]=p[t[f]],f++;else{var t=[],w=-1,u=0,p=m.morphTargetInfluences,v,x=p.length,f=0;for(m.morphTargetBase!==-1&&(t[m.morphTargetBase]=!0);f<k.numSupportedMorphTargets;){for(v=
-0;v<x;v++)!t[v]&&p[v]>w&&(u=v,w=p[u]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[u]);o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[f]=w;t[u]=1;w=-1;f++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=0&&(c=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(b[n],
+o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var f=0,p=m.morphTargetForcedOrder,t=m.morphTargetInfluences;f<k.numSupportedMorphTargets&&f<p.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p[f]]),o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[f]=t[p[f]],f++;else{var p=[],w=-1,u=0,t=m.morphTargetInfluences,v,x=t.length,f=0;for(m.morphTargetBase!==-1&&(p[m.morphTargetBase]=!0);f<k.numSupportedMorphTargets;){for(v=
+0;v<x;v++)!p[v]&&t[v]>w&&(u=v,w=t[u]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[u]);o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[f]=w;p[u]=1;w=-1;f++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=0&&(c=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(b[n],
 c.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):
 c.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):
 o.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));k.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,
 o.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));k.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,
 4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0));m instanceof THREE.Mesh?(k.wireframe?(o.lineWidth(k.wireframeLinewidth),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,o.UNSIGNED_SHORT,0)):(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,
 4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0));m instanceof THREE.Mesh?(k.wireframe?(o.lineWidth(k.wireframeLinewidth),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,o.UNSIGNED_SHORT,0)):(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,
-h.__webglFaceCount,o.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=h.__webglFaceCount,W.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),W.info.render.calls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),W.info.render.calls++)}}
-function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,k,m,n,t,p,w,u,v,x=b.count*
-3;for(v=0;v<x;v+=9)c=b.normalArray,f=c[v],h=c[v+1],k=c[v+2],m=c[v+3],t=c[v+4],w=c[v+5],n=c[v+6],p=c[v+7],u=c[v+8],f=(f+m+n)/3,h=(h+t+p)/3,k=(k+w+u)/3,c[v]=f,c[v+1]=h,c[v+2]=k,c[v+3]=f,c[v+4]=h,c[v+5]=k,c[v+6]=f,c[v+7]=h,c[v+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(e.attributes.normal);o.vertexAttribPointer(e.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,b.count);b.count=0}function m(b){if(aa!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):
-o.enable(o.CULL_FACE),aa=b.doubleSided;if(ka!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),ka=b.flipSided}function k(b){ma!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),ma=b)}function n(b){da!=b&&(o.depthMask(b),da=b)}function u(b,e,c){$!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),$=b);if(b&&(U!=e||T!=c))o.polygonOffset(e,c),U=e,T=c}function p(b){ca[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ca[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,
-b.n44+b.n14);ca[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ca[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ca[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ca[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=ca[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function v(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=ca[f].x*e.n14+ca[f].y*e.n24+ca[f].z*
-e.n34+ca[f].w,b<=c)return!1;return!0}function t(b,e){b.list[b.count]=e;b.count+=1}function x(b){var e,c,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?t(k,c):t(h,c)}function w(b){var e,c,f,h,k=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=k.materials.length;b<f;b++)if(e=k.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=m.materials.length;e<c;e++)(h=m.materials[e])&&(h.transparent?
-t(o,h):t(n,h))}else(h=e)&&(h.transparent?t(o,h):t(n,h))}function z(b,e){return e.z-b.z}function y(b){var c,n,t,w=0,u,x,L,z,y=b.lights;M||(M=new THREE.Camera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar));c=0;for(n=y.length;c<n;c++)if(t=y[c],t instanceof THREE.SpotLight&&t.castShadow){W.shadowMap[w]||(W.shadowMap[w]=new THREE.WebGLRenderTarget(W.shadowMapWidth,W.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
-pa[w]||(pa[w]=new THREE.Matrix4);u=W.shadowMap[w];x=pa[w];M.position.copy(t.position);M.target.position.copy(t.target.position);M.update(void 0,!0);b.update(void 0,!1,M);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(M.projectionMatrix);x.multiplySelf(M.matrixWorldInverse);M.matrixWorldInverse.flattenToArray(ra);M.projectionMatrix.flattenToArray(ua);qa.multiply(M.projectionMatrix,M.matrixWorldInverse);p(qa);W.initWebGLObjects(b);Z(u);o.clearColor(1,1,1,1);W.clear();o.clearColor(ga.r,
-ga.g,ga.b,X);x=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(u=0;u<x;u++)L=b.__webglObjects[u],z=L.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||v(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,M,!1),L.render=!0):L.render=!1:L.render=!1;k(!0);J(THREE.NormalBlending);for(u=0;u<x;u++)if(L=b.__webglObjects[u],L.render)z=L.object,buffer=L.buffer,m(z),L=z.customDepthMaterial?z.customDepthMaterial:z.geometry.morphTargets.length?xa:za,f(M,y,null,
-L,buffer,z);for(u=0;u<t;u++)L=b.__webglObjectsImmediate[u],z=L.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,M,!1),m(z),program=e(M,y,null,za,z),z.render(function(b){h(b,program,za.shading)}));w++}}function A(b,e){var c,f,h;c=Y.attributes;var k=Y.uniforms,m=la/sa,n,t=[],p=sa*0.5,u=la*0.5,w=!0;o.useProgram(Y.program);S=Y.program;ma=ja=-1;Fa||(o.enableVertexAttribArray(Y.attributes.position),o.enableVertexAttribArray(Y.attributes.uv),Fa=
-!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,Y.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,ua);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,
-h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(z);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-p)/p,(u-h.position.y)/u,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,
-h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?la:1),t[0]=n*m*h.scale.x,t[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),o.uniform1f(k.opacity,h.opacity),o.uniform3f(k.color,h.color.r,h.color.g,h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,t),h.mergeWith3D&&!w?(o.enable(o.DEPTH_TEST),w=!0):!h.mergeWith3D&&w&&(o.disable(o.DEPTH_TEST),w=!1),J(h.blending),
-K(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(da)}function E(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function D(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function G(b){var e,
-c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function I(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function N(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,k,m,n,o,t,p={},w=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h<k;h++)m=b.faces[h],n=m.materials,o=e(n),p[o]==
-void 0&&(p[o]={hash:o,counter:0}),t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:w}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[t].vertices+m>65535&&(p[o].counter+=1,t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:w})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[u])}
-function P(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=ja){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,
-o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}ja=b}}function H(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,V(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,V(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,V(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,V(e.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,O(e.magFilter)),
-o.texParameteri(b,o.TEXTURE_MIN_FILTER,O(e.minFilter)))}function K(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.info.memory.textures++;o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,V(b.format),b.image.width,b.image.height,0,V(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);H(o.TEXTURE_2D,b,b.image);b.needsUpdate=
-!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function Z(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(e){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);H(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(),
-o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),H(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+
+h.__webglFaceCount,o.UNSIGNED_SHORT,0)),V.info.render.calls++,V.info.render.vertices+=h.__webglFaceCount,V.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),V.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),V.info.render.calls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),V.info.render.calls++)}}
+function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,k,m,n,p,t,w,u,v,x=b.count*
+3;for(v=0;v<x;v+=9)c=b.normalArray,f=c[v],h=c[v+1],k=c[v+2],m=c[v+3],p=c[v+4],w=c[v+5],n=c[v+6],t=c[v+7],u=c[v+8],f=(f+m+n)/3,h=(h+p+t)/3,k=(k+w+u)/3,c[v]=f,c[v+1]=h,c[v+2]=k,c[v+3]=f,c[v+4]=h,c[v+5]=k,c[v+6]=f,c[v+7]=h,c[v+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(e.attributes.normal);o.vertexAttribPointer(e.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,b.count);b.count=0}function m(b){if(aa!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):
+o.enable(o.CULL_FACE),aa=b.doubleSided;if(la!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),la=b.flipSided}function k(b){ma!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),ma=b)}function n(b){ea!=b&&(o.depthMask(b),ea=b)}function u(b,e,c){Y!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),Y=b);if(b&&(T!=e||Z!=c))o.polygonOffset(e,c),T=e,Z=c}function p(b){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(var e,b=0;b<6;b++)e=da[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function v(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=da[f].x*e.n14+da[f].y*e.n24+da[f].z*
+e.n34+da[f].w,b<=c)return!1;return!0}function t(b,e){b.list[b.count]=e;b.count+=1}function x(b){var e,c,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?t(k,c):t(h,c)}function w(b){var e,c,f,h,k=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=k.materials.length;b<f;b++)if(e=k.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=m.materials.length;e<c;e++)(h=m.materials[e])&&(h.transparent?
+t(o,h):t(n,h))}else(h=e)&&(h.transparent?t(o,h):t(n,h))}function z(b,e){return e.z-b.z}function y(b){var c,n,t,w=0,u,x,L,z,y=b.lights;ha||(ha=new THREE.Camera(V.shadowCameraFov,V.shadowMapWidth/V.shadowMapHeight,V.shadowCameraNear,V.shadowCameraFar));c=0;for(n=y.length;c<n;c++)if(t=y[c],t instanceof THREE.SpotLight&&t.castShadow){V.shadowMap[w]||(V.shadowMap[w]=new THREE.WebGLRenderTarget(V.shadowMapWidth,V.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
+ja[w]||(ja[w]=new THREE.Matrix4);u=V.shadowMap[w];x=ja[w];ha.position.copy(t.position);ha.target.position.copy(t.target.position);ha.update(void 0,!0);b.update(void 0,!1,ha);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(ha.projectionMatrix);x.multiplySelf(ha.matrixWorldInverse);ha.matrixWorldInverse.flattenToArray(sa);ha.projectionMatrix.flattenToArray(ua);qa.multiply(ha.projectionMatrix,ha.matrixWorldInverse);p(qa);V.initWebGLObjects(b);X(u);o.clearColor(1,1,1,1);V.clear();o.clearColor(ia.r,
+ia.g,ia.b,W);x=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(u=0;u<x;u++)L=b.__webglObjects[u],z=L.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||v(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,ha,!1),L.render=!0):L.render=!1:L.render=!1;k(!0);K(THREE.NormalBlending);for(u=0;u<x;u++)if(L=b.__webglObjects[u],L.render)z=L.object,buffer=L.buffer,m(z),L=z.customDepthMaterial?z.customDepthMaterial:z.geometry.morphTargets.length?oa:ya,f(ha,y,null,
+L,buffer,z);for(u=0;u<t;u++)L=b.__webglObjectsImmediate[u],z=L.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,ha,!1),m(z),program=e(ha,y,null,ya,z),z.render(function(b){h(b,program,ya.shading)}));w++}}function A(b,e){var c,f,h;c=ca.attributes;var k=ca.uniforms,m=J/va,n,p=[],t=va*0.5,u=J*0.5,w=!0;o.useProgram(ca.program);S=ca.program;ma=ka=-1;Aa||(o.enableVertexAttribArray(ca.attributes.position),o.enableVertexAttribArray(ca.attributes.uv),
+Aa=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,ca.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,ca.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,ua);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,
+h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(z);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-t)/t,(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?J:1),p[0]=n*m*h.scale.x,p[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),o.uniform1f(k.opacity,h.opacity),o.uniform3f(k.color,h.color.r,h.color.g,h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,p),h.mergeWith3D&&!w?(o.enable(o.DEPTH_TEST),w=!0):!h.mergeWith3D&&w&&(o.disable(o.DEPTH_TEST),w=!1),K(h.blending),
+M(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(ea)}function E(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function D(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function F(b){var e,
+c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function G(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function N(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,k,m,n,o,p,t={},w=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h<k;h++)m=b.faces[h],n=m.materials,o=e(n),t[o]==
+void 0&&(t[o]={hash:o,counter:0}),p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:w}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+m>65535&&(t[o].counter+=1,p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:w})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[u])}
+function Q(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=ka){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,
+o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}ka=b}}function H(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,U(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,U(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,U(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,U(e.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,P(e.magFilter)),
+o.texParameteri(b,o.TEXTURE_MIN_FILTER,P(e.minFilter)))}function M(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),V.info.memory.textures++;o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,U(b.format),b.image.width,b.image.height,0,U(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);H(o.TEXTURE_2D,b,b.image);b.needsUpdate=
+!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function X(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(e){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);H(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(),
+o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,U(b.format),b.width,b.height,0,U(b.format),U(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),H(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,U(b.format),b.width,b.height,0,U(b.format),U(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+
 c,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,
 c,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,
-o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);e?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=sa,b=la,f=fa,h=na);e!=ta&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),ta=e)}function C(b){b instanceof
-THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function R(b,e){var c;b=="fragment"?c=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,e);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),
-console.error(e),null;return c}function O(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function V(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;
+o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);e?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=va,b=J,f=ga,h=na);e!=ta&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),ta=e)}function C(b){b instanceof
+THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function O(b,e){var c;b=="fragment"?c=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,e);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),
+console.error(e),null;return c}function P(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function U(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;
 case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;
 case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;
-case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var W=this,o,ea=[],S=null,ta=null,aa=null,ka=null,ja=null,ma=null,da=null,$=null,U=null,T=null,fa=0,na=0,sa=0,la=0,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Matrix4,ua=new Float32Array(16),ra=new Float32Array(16),ya=new THREE.Vector4,Ca=
-{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Ba=b.stencil!==void 0?b.stencil:!0,Ea=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,L=b.antialias!==void 0?b.antialias:!1,ga=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),X=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,
-geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=va;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var M,pa=[],b=THREE.ShaderLib.depthRGBA,ha=THREE.UniformsUtils.clone(b.uniforms),za=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,
-vertexShader:b.vertexShader,uniforms:ha}),xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ha,morphTargets:!0});za._shadowPass=!0;xa._shadowPass=!0;try{if(!(o=va.getContext("experimental-webgl",{antialias:L,stencil:Ba,preserveDrawingBuffer:Ea})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(oa){console.error(oa)}o.clearColor(0,
-0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(ga.r,ga.g,ga.b,X);this.context=o;var Aa=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,Y={};Y.vertices=new Float32Array(16);Y.faces=new Uint16Array(6);i=0;Y.vertices[i++]=-1;Y.vertices[i++]=-1;Y.vertices[i++]=0;Y.vertices[i++]=1;Y.vertices[i++]=
-1;Y.vertices[i++]=-1;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=0;Y.vertices[i++]=-1;Y.vertices[i++]=1;Y.vertices[i++]=0;i=Y.vertices[i++]=0;Y.faces[i++]=0;Y.faces[i++]=1;Y.faces[i++]=2;Y.faces[i++]=0;Y.faces[i++]=2;Y.faces[i++]=3;Y.vertexBuffer=o.createBuffer();Y.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,Y.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,Y.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);
-o.bufferData(o.ELEMENT_ARRAY_BUFFER,Y.faces,o.STATIC_DRAW);Y.program=o.createProgram();o.attachShader(Y.program,R("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(Y.program,R("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(Y.program);Y.attributes={};Y.uniforms={};Y.attributes.position=o.getAttribLocation(Y.program,"position");Y.attributes.uv=o.getAttribLocation(Y.program,"uv");Y.uniforms.uvOffset=o.getUniformLocation(Y.program,"uvOffset");Y.uniforms.uvScale=o.getUniformLocation(Y.program,
-"uvScale");Y.uniforms.rotation=o.getUniformLocation(Y.program,"rotation");Y.uniforms.scale=o.getUniformLocation(Y.program,"scale");Y.uniforms.alignment=o.getUniformLocation(Y.program,"alignment");Y.uniforms.color=o.getUniformLocation(Y.program,"color");Y.uniforms.map=o.getUniformLocation(Y.program,"map");Y.uniforms.opacity=o.getUniformLocation(Y.program,"opacity");Y.uniforms.useScreenCoordinates=o.getUniformLocation(Y.program,"useScreenCoordinates");Y.uniforms.affectedByDistance=o.getUniformLocation(Y.program,
-"affectedByDistance");Y.uniforms.screenPosition=o.getUniformLocation(Y.program,"screenPosition");Y.uniforms.modelViewMatrix=o.getUniformLocation(Y.program,"modelViewMatrix");Y.uniforms.projectionMatrix=o.getUniformLocation(Y.program,"projectionMatrix");var Fa=!1;this.setSize=function(b,e){va.width=b;va.height=e;this.setViewport(0,0,va.width,va.height)};this.setViewport=function(b,e,c,f){fa=b;na=e;sa=c;la=f;o.viewport(fa,na,sa,la)};this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest=
-function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(b,e){ga.setHex(b);X=e;o.clearColor(ga.r,ga.g,ga.b,X)};this.setClearColor=function(b,e){ga.copy(b);X=e;o.clearColor(ga.r,ga.g,ga.b,X)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return X};this.clear=function(){o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT|o.STENCIL_BUFFER_BIT)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=
-!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];o.deleteBuffer(e.__webglVertexBuffer);o.deleteBuffer(e.__webglNormalBuffer);o.deleteBuffer(e.__webglTangentBuffer);o.deleteBuffer(e.__webglColorBuffer);o.deleteBuffer(e.__webglUVBuffer);o.deleteBuffer(e.__webglUV2Buffer);o.deleteBuffer(e.__webglSkinVertexABuffer);o.deleteBuffer(e.__webglSkinVertexBBuffer);
-o.deleteBuffer(e.__webglSkinIndicesBuffer);o.deleteBuffer(e.__webglSkinWeightsBuffer);o.deleteBuffer(e.__webglFaceBuffer);o.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c<f;c++)o.deleteBuffer(e.__webglMorphTargetsBuffers[c]);W.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),
-o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),W.info.memory.textures--};this.initMaterial=function(b,e,c,f){var h,k,m;b instanceof THREE.MeshDepthMaterial?m="depth":b instanceof THREE.MeshNormalMaterial?m="normal":b instanceof
-THREE.MeshBasicMaterial?m="basic":b instanceof THREE.MeshLambertMaterial?m="lambert":b instanceof THREE.MeshPhongMaterial?m="phong":b instanceof THREE.LineBasicMaterial?m="basic":b instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var n=THREE.ShaderLib[m];b.uniforms=THREE.UniformsUtils.clone(n.uniforms);b.vertexShader=n.vertexShader;b.fragmentShader=n.fragmentShader}var t,p,w;t=w=n=0;for(p=e.length;t<p;t++)k=e[t],k instanceof THREE.SpotLight&&w++,k instanceof THREE.DirectionalLight&&
-w++,k instanceof THREE.PointLight&&n++;n+w<=_maxLights?t=w:(t=Math.ceil(_maxLights*w/(n+w)),n=_maxLights-t);k={directional:t,point:n};n=w=0;for(t=e.length;n<t;n++)p=e[n],p instanceof THREE.SpotLight&&p.castShadow&&w++;var u=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)u=f.bones.length;var v;a:{t=b.fragmentShader;p=b.vertexShader;var n=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,
-skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:k.directional,maxPointLights:k.point,maxBones:u,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:w,alphaTest:b.alphaTest},x,f=[];m?f.push(m):(f.push(t),f.push(p));for(x in c)f.push(x),f.push(c[x]);m=f.join();x=0;for(f=ea.length;x<f;x++)if(ea[x].code==m){v=ea[x].program;break a}x=
-o.createProgram();f=[Aa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":
-"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var V=this,o,fa=[],S=null,ta=null,aa=null,la=null,ka=null,ma=null,ea=null,Y=null,T=null,Z=null,ga=0,na=0,va=0,J=0,da=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Matrix4,ua=new Float32Array(16),sa=new Float32Array(16),xa=new THREE.Vector4,Ea=
+{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"),pa=b.stencil!==void 0?b.stencil:!0,Ga=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,L=b.antialias!==void 0?b.antialias:!1,ia=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),W=b.clearAlpha!==void 0?b.clearAlpha:0,ra=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.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 ha,ja=[],b=THREE.ShaderLib.depthRGBA,za=THREE.UniformsUtils.clone(b.uniforms),ya=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,
+vertexShader:b.vertexShader,uniforms:za}),oa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:za,morphTargets:!0});ya._shadowPass=!0;oa._shadowPass=!0;try{if(!(o=Da.getContext("experimental-webgl",{antialias:L,stencil:pa,preserveDrawingBuffer:Ga})))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(Ha){console.error(Ha)}o.clearColor(0,
+0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(ia.r,ia.g,ia.b,W);this.context=o;var Ba=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,ca={};ca.vertices=new Float32Array(16);ca.faces=new Uint16Array(6);pa=0;ca.vertices[pa++]=-1;ca.vertices[pa++]=-1;ca.vertices[pa++]=0;ca.vertices[pa++]=1;ca.vertices[pa++]=
+1;ca.vertices[pa++]=-1;ca.vertices[pa++]=1;ca.vertices[pa++]=1;ca.vertices[pa++]=1;ca.vertices[pa++]=1;ca.vertices[pa++]=1;ca.vertices[pa++]=0;ca.vertices[pa++]=-1;ca.vertices[pa++]=1;ca.vertices[pa++]=0;pa=ca.vertices[pa++]=0;ca.faces[pa++]=0;ca.faces[pa++]=1;ca.faces[pa++]=2;ca.faces[pa++]=0;ca.faces[pa++]=2;ca.faces[pa++]=3;ca.vertexBuffer=o.createBuffer();ca.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,ca.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,ca.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,
+ca.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,ca.faces,o.STATIC_DRAW);ca.program=o.createProgram();o.attachShader(ca.program,O("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(ca.program,O("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(ca.program);ca.attributes={};ca.uniforms={};ca.attributes.position=o.getAttribLocation(ca.program,"position");ca.attributes.uv=o.getAttribLocation(ca.program,"uv");ca.uniforms.uvOffset=o.getUniformLocation(ca.program,"uvOffset");
+ca.uniforms.uvScale=o.getUniformLocation(ca.program,"uvScale");ca.uniforms.rotation=o.getUniformLocation(ca.program,"rotation");ca.uniforms.scale=o.getUniformLocation(ca.program,"scale");ca.uniforms.alignment=o.getUniformLocation(ca.program,"alignment");ca.uniforms.color=o.getUniformLocation(ca.program,"color");ca.uniforms.map=o.getUniformLocation(ca.program,"map");ca.uniforms.opacity=o.getUniformLocation(ca.program,"opacity");ca.uniforms.useScreenCoordinates=o.getUniformLocation(ca.program,"useScreenCoordinates");
+ca.uniforms.affectedByDistance=o.getUniformLocation(ca.program,"affectedByDistance");ca.uniforms.screenPosition=o.getUniformLocation(ca.program,"screenPosition");ca.uniforms.modelViewMatrix=o.getUniformLocation(ca.program,"modelViewMatrix");ca.uniforms.projectionMatrix=o.getUniformLocation(ca.program,"projectionMatrix");var Aa=!1;this.setSize=function(b,e){Da.width=b;Da.height=e;this.setViewport(0,0,Da.width,Da.height)};this.setViewport=function(b,e,c,f){ga=b;na=e;va=c;J=f;o.viewport(ga,na,va,J)};
+this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(b,e){ia.setHex(b);W=e;o.clearColor(ia.r,ia.g,ia.b,W)};this.setClearColor=function(b,e){ia.copy(b);W=e;o.clearColor(ia.r,ia.g,ia.b,W)};this.getClearColor=function(){return ia};this.getClearAlpha=function(){return W};this.clear=function(){o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT|o.STENCIL_BUFFER_BIT)};this.getContext=function(){return o};
+this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];o.deleteBuffer(e.__webglVertexBuffer);o.deleteBuffer(e.__webglNormalBuffer);o.deleteBuffer(e.__webglTangentBuffer);o.deleteBuffer(e.__webglColorBuffer);o.deleteBuffer(e.__webglUVBuffer);o.deleteBuffer(e.__webglUV2Buffer);o.deleteBuffer(e.__webglSkinVertexABuffer);
+o.deleteBuffer(e.__webglSkinVertexBBuffer);o.deleteBuffer(e.__webglSkinIndicesBuffer);o.deleteBuffer(e.__webglSkinWeightsBuffer);o.deleteBuffer(e.__webglFaceBuffer);o.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c<f;c++)o.deleteBuffer(e.__webglMorphTargetsBuffers[c]);V.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),V.info.memory.geometries--;else if(b instanceof
+THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),V.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),V.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),V.info.memory.textures--};this.initMaterial=function(b,e,c,f){var h,k,m;b instanceof THREE.MeshDepthMaterial?m="depth":
+b instanceof THREE.MeshNormalMaterial?m="normal":b instanceof THREE.MeshBasicMaterial?m="basic":b instanceof THREE.MeshLambertMaterial?m="lambert":b instanceof THREE.MeshPhongMaterial?m="phong":b instanceof THREE.LineBasicMaterial?m="basic":b instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var n=THREE.ShaderLib[m];b.uniforms=THREE.UniformsUtils.clone(n.uniforms);b.vertexShader=n.vertexShader;b.fragmentShader=n.fragmentShader}var p,t,w;p=w=n=0;for(t=e.length;p<t;p++)k=e[p],k instanceof
+THREE.SpotLight&&w++,k instanceof THREE.DirectionalLight&&w++,k instanceof THREE.PointLight&&n++;n+w<=ra?p=w:(p=Math.ceil(ra*w/(n+w)),n=ra-p);k={directional:p,point:n};n=w=0;for(p=e.length;n<p;n++)t=e[n],t instanceof THREE.SpotLight&&t.castShadow&&w++;var u=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)u=f.bones.length;var v;a:{p=b.fragmentShader;t=b.vertexShader;var n=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,useFog:b.fog,
+sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:k.directional,maxPointLights:k.point,maxBones:u,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:w,alphaTest:b.alphaTest},x,f=[];m?f.push(m):(f.push(p),f.push(t));for(x in c)f.push(x),f.push(c[x]);m=f.join();x=0;for(f=fa.length;x<f;x++)if(fa[x].code==
+m){v=fa[x].program;break a}x=o.createProgram();f=[Ba?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?
+"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 k=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",
 k=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",
-c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(x,R("fragment",k+t));o.attachShader(x,R("vertex",f+p));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+
-o.getError()+"]");x.uniforms={};x.attributes={};var L,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(L in n)f.push(L);L=f;f=0;for(n=L.length;f<n;f++)t=L[f],x.uniforms[t]=o.getUniformLocation(x,t);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(L=0;L<c.maxMorphTargets;L++)f.push("morphTarget"+L);for(v in e)f.push(v);
-v=f;L=0;for(e=v.length;L<e;L++)c=v[L],x.attributes[c]=o.getAttribLocation(x,c);ea.push({program:x,code:m});W.info.memory.programs=ea.length;v=x}b.program=v;v=b.program.attributes;v.position>=0&&o.enableVertexAttribArray(v.position);v.color>=0&&o.enableVertexAttribArray(v.color);v.normal>=0&&o.enableVertexAttribArray(v.normal);v.tangent>=0&&o.enableVertexAttribArray(v.tangent);b.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(o.enableVertexAttribArray(v.skinVertexA),
-o.enableVertexAttribArray(v.skinVertexB),o.enableVertexAttribArray(v.skinIndex),o.enableVertexAttribArray(v.skinWeight));if(b.attributes)for(h in b.attributes)v[h]!==void 0&&v[h]>=0&&o.enableVertexAttribArray(v[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)L="morphTarget"+h,v[L]>=0&&(o.enableVertexAttribArray(v[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){Z(b);b=0;e&&(b|=o.COLOR_BUFFER_BIT);c&&(b|=o.DEPTH_BUFFER_BIT);f&&(b|=o.STENCIL_BUFFER_BIT);
-o.clear(b)};this.render=function(b,c,o,t){var L,X,ga,D,G,I,M,la,H=b.lights,K=b.fog;this.shadowMapEnabled&&y(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ra);c.projectionMatrix.flattenToArray(ua);qa.multiply(c.projectionMatrix,c.matrixWorldInverse);p(qa);this.initWebGLObjects(b);Z(o);(this.autoClear||t)&&this.clear();G=b.__webglObjects.length;for(t=0;t<G;t++)if(L=b.__webglObjects[t],
-M=L.object,M.visible)if(!(M instanceof THREE.Mesh)||!M.frustumCulled||v(M)){if(M.matrixWorld.flattenToArray(M._objectMatrixArray),E(M,c,!0),w(L),L.render=!0,this.sortObjects)L.object.renderDepth?L.z=L.object.renderDepth:(ya.copy(M.position),qa.multiplyVector3(ya),L.z=ya.z)}else L.render=!1;else L.render=!1;this.sortObjects&&b.__webglObjects.sort(z);I=b.__webglObjectsImmediate.length;for(t=0;t<I;t++)L=b.__webglObjectsImmediate[t],M=L.object,M.visible&&(M.matrixAutoUpdate&&M.matrixWorld.flattenToArray(M._objectMatrixArray),
-E(M,c,!0),x(L));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);J(b.overrideMaterial.blending);for(t=0;t<G;t++)if(L=b.__webglObjects[t],L.render)M=L.object,la=L.buffer,m(M),f(c,H,K,b.overrideMaterial,la,M);for(t=0;t<I;t++)L=b.__webglObjectsImmediate[t],M=L.object,M.visible&&(m(M),X=e(c,H,K,b.overrideMaterial,M),M.render(function(c){h(c,X,b.overrideMaterial.shading)}))}else{J(THREE.NormalBlending);for(t=G-1;t>=0;t--)if(L=b.__webglObjects[t],L.render){M=L.object;la=L.buffer;ga=L.opaque;m(M);
-for(L=0;L<ga.count;L++)D=ga.list[L],k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,H,K,D,la,M)}for(t=0;t<I;t++)if(L=b.__webglObjectsImmediate[t],M=L.object,M.visible){ga=L.opaque;m(M);for(L=0;L<ga.count;L++)D=ga.list[L],k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),X=e(c,H,K,D,M),M.render(function(b){h(b,X,D.shading)})}for(t=0;t<G;t++)if(L=b.__webglObjects[t],L.render){M=L.object;la=L.buffer;ga=L.transparent;
-m(M);for(L=0;L<ga.count;L++)D=ga.list[L],J(D.blending),k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,H,K,D,la,M)}for(t=0;t<I;t++)if(L=b.__webglObjectsImmediate[t],M=L.object,M.visible){ga=L.transparent;m(M);for(L=0;L<ga.count;L++)D=ga.list[L],J(D.blending),k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),X=e(c,H,K,D,M),M.render(function(b){h(b,X,D.shading)})}}b.__webglSprites.length&&A(b,c);o&&o.minFilter!==
+c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(x,O("fragment",k+p));o.attachShader(x,O("vertex",f+t));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+
+o.getError()+"]");x.uniforms={};x.attributes={};var L,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(L in n)f.push(L);L=f;f=0;for(n=L.length;f<n;f++)p=L[f],x.uniforms[p]=o.getUniformLocation(x,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(L=0;L<c.maxMorphTargets;L++)f.push("morphTarget"+L);for(v in e)f.push(v);
+v=f;L=0;for(e=v.length;L<e;L++)c=v[L],x.attributes[c]=o.getAttribLocation(x,c);fa.push({program:x,code:m});V.info.memory.programs=fa.length;v=x}b.program=v;v=b.program.attributes;v.position>=0&&o.enableVertexAttribArray(v.position);v.color>=0&&o.enableVertexAttribArray(v.color);v.normal>=0&&o.enableVertexAttribArray(v.normal);v.tangent>=0&&o.enableVertexAttribArray(v.tangent);b.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(o.enableVertexAttribArray(v.skinVertexA),
+o.enableVertexAttribArray(v.skinVertexB),o.enableVertexAttribArray(v.skinIndex),o.enableVertexAttribArray(v.skinWeight));if(b.attributes)for(h in b.attributes)v[h]!==void 0&&v[h]>=0&&o.enableVertexAttribArray(v[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)L="morphTarget"+h,v[L]>=0&&(o.enableVertexAttribArray(v[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){X(b);b=0;e&&(b|=o.COLOR_BUFFER_BIT);c&&(b|=o.DEPTH_BUFFER_BIT);f&&(b|=o.STENCIL_BUFFER_BIT);
+o.clear(b)};this.render=function(b,c,o,t){var L,W,ia,D,F,G,J,H,ra=b.lights,M=b.fog;this.shadowMapEnabled&&y(b,c);V.info.render.calls=0;V.info.render.vertices=0;V.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(sa);c.projectionMatrix.flattenToArray(ua);qa.multiply(c.projectionMatrix,c.matrixWorldInverse);p(qa);this.initWebGLObjects(b);X(o);(this.autoClear||t)&&this.clear();F=b.__webglObjects.length;for(t=0;t<F;t++)if(L=b.__webglObjects[t],
+J=L.object,J.visible)if(!(J instanceof THREE.Mesh)||!J.frustumCulled||v(J)){if(J.matrixWorld.flattenToArray(J._objectMatrixArray),E(J,c,!0),w(L),L.render=!0,this.sortObjects)L.object.renderDepth?L.z=L.object.renderDepth:(xa.copy(J.position),qa.multiplyVector3(xa),L.z=xa.z)}else L.render=!1;else L.render=!1;this.sortObjects&&b.__webglObjects.sort(z);G=b.__webglObjectsImmediate.length;for(t=0;t<G;t++)L=b.__webglObjectsImmediate[t],J=L.object,J.visible&&(J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray),
+E(J,c,!0),x(L));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(t=0;t<F;t++)if(L=b.__webglObjects[t],L.render)J=L.object,H=L.buffer,m(J),f(c,ra,M,b.overrideMaterial,H,J);for(t=0;t<G;t++)L=b.__webglObjectsImmediate[t],J=L.object,J.visible&&(m(J),W=e(c,ra,M,b.overrideMaterial,J),J.render(function(c){h(c,W,b.overrideMaterial.shading)}))}else{K(THREE.NormalBlending);for(t=F-1;t>=0;t--)if(L=b.__webglObjects[t],L.render){J=L.object;H=L.buffer;ia=L.opaque;m(J);for(L=
+0;L<ia.count;L++)D=ia.list[L],k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ra,M,D,H,J)}for(t=0;t<G;t++)if(L=b.__webglObjectsImmediate[t],J=L.object,J.visible){ia=L.opaque;m(J);for(L=0;L<ia.count;L++)D=ia.list[L],k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),W=e(c,ra,M,D,J),J.render(function(b){h(b,W,D.shading)})}for(t=0;t<F;t++)if(L=b.__webglObjects[t],L.render){J=L.object;H=L.buffer;ia=L.transparent;
+m(J);for(L=0;L<ia.count;L++)D=ia.list[L],K(D.blending),k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ra,M,D,H,J)}for(t=0;t<G;t++)if(L=b.__webglObjectsImmediate[t],J=L.object,J.visible){ia=L.transparent;m(J);for(L=0;L<ia.count;L++)D=ia.list[L],K(D.blending),k(D.depthTest),n(D.depthWrite),u(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),W=e(c,ra,M,D,J),J.render(function(b){h(b,W,D.shading)})}}b.__webglSprites.length&&A(b,c);o&&o.minFilter!==
 THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&C(o)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],f=b,h=void 0,k=void 0,m=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),
 THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&C(o)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],f=b,h=void 0,k=void 0,m=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),
 e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups==void 0&&N(k),k.geometryGroups){if(m=k.geometryGroups[h],!m.__webglVertexBuffer){var n=m;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();
 e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups==void 0&&N(k),k.geometryGroups){if(m=k.geometryGroups[h],!m.__webglVertexBuffer){var n=m;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();
-n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var t=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];t=0;for(p=n.numMorphTargets;t<p;t++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=e,w=void 0,u=void 0,v=void 0,x=v=void 0,L=void 0,z=void 0,X=z=t=0,y=v=u=void 0,v=p=y=u=w=void 0,x=n.geometry,L=x.faces,y=m.faces,w=0,u=y.length;w<u;w++)v=y[w],v=L[v],v instanceof THREE.Face3?
-(t+=3,z+=1,X+=3):v instanceof THREE.Face4&&(t+=4,z+=2,X+=4);for(var w=m,u=n,ga=y=L=void 0,A=void 0,ga=void 0,v=[],L=0,y=u.materials.length;L<y;L++)if(ga=u.materials[L],ga instanceof THREE.MeshFaceMaterial){ga=0;for(l=w.materials.length;ga<l;ga++)(A=w.materials[ga])&&v.push(A)}else(A=ga)&&v.push(A);w=v;m.__materials=w;a:{L=u=void 0;y=w.length;for(u=0;u<y;u++)if(L=w[u],L.map||L.lightMap||L instanceof THREE.ShaderMaterial){u=!0;break a}u=!1}a:{y=L=void 0;v=w.length;for(L=0;L<v;L++)if(y=w[L],!(y instanceof
-THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{v=L=void 0;ga=w.length;for(L=0;L<ga;L++)if(v=w[L],v.vertexColors){v=v.vertexColors;break a}v=!1}m.__vertexArray=new Float32Array(t*3);if(y)m.__normalArray=new Float32Array(t*3);if(x.hasTangents)m.__tangentArray=new Float32Array(t*4);if(v)m.__colorArray=new Float32Array(t*3);if(u){if(x.faceUvs.length>0||x.faceVertexUvs.length>
-0)m.__uvArray=new Float32Array(t*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(t*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(t*4),m.__skinVertexBArray=new Float32Array(t*4),m.__skinIndexArray=new Float32Array(t*4),m.__skinWeightArray=new Float32Array(t*4);m.__faceArray=new Uint16Array(z*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(X*2);if(m.numMorphTargets){m.__morphTargetsArrays=
-[];x=0;for(L=m.numMorphTargets;x<L;x++)m.__morphTargetsArrays.push(new Float32Array(t*3))}m.__needsSmoothNormals=y==THREE.SmoothShading;m.__uvType=u;m.__vertexColorType=v;m.__normalType=y;m.__webglFaceCount=z*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0);m.__webglLineCount=X*2;x=0;for(L=w.length;x<L;x++)if(u=w[x],u.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in u.attributes){v=u.attributes[a];y={};for(p in v)y[p]=v[p];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=
+n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var t=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];t=0;for(p=n.numMorphTargets;t<p;t++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}V.info.memory.geometries++;for(var n=e,w=void 0,u=void 0,v=void 0,x=v=void 0,L=void 0,z=void 0,W=z=t=0,y=v=u=void 0,v=p=y=u=w=void 0,x=n.geometry,L=x.faces,y=m.faces,w=0,u=y.length;w<u;w++)v=y[w],v=L[v],v instanceof THREE.Face3?
+(t+=3,z+=1,W+=3):v instanceof THREE.Face4&&(t+=4,z+=2,W+=4);for(var w=m,u=n,ia=y=L=void 0,A=void 0,ia=void 0,v=[],L=0,y=u.materials.length;L<y;L++)if(ia=u.materials[L],ia instanceof THREE.MeshFaceMaterial){ia=0;for(l=w.materials.length;ia<l;ia++)(A=w.materials[ia])&&v.push(A)}else(A=ia)&&v.push(A);w=v;m.__materials=w;a:{L=u=void 0;y=w.length;for(u=0;u<y;u++)if(L=w[u],L.map||L.lightMap||L instanceof THREE.ShaderMaterial){u=!0;break a}u=!1}a:{y=L=void 0;v=w.length;for(L=0;L<v;L++)if(y=w[L],!(y instanceof
+THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{v=L=void 0;ia=w.length;for(L=0;L<ia;L++)if(v=w[L],v.vertexColors){v=v.vertexColors;break a}v=!1}m.__vertexArray=new Float32Array(t*3);if(y)m.__normalArray=new Float32Array(t*3);if(x.hasTangents)m.__tangentArray=new Float32Array(t*4);if(v)m.__colorArray=new Float32Array(t*3);if(u){if(x.faceUvs.length>0||x.faceVertexUvs.length>
+0)m.__uvArray=new Float32Array(t*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(t*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(t*4),m.__skinVertexBArray=new Float32Array(t*4),m.__skinIndexArray=new Float32Array(t*4),m.__skinWeightArray=new Float32Array(t*4);m.__faceArray=new Uint16Array(z*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(W*2);if(m.numMorphTargets){m.__morphTargetsArrays=
+[];x=0;for(L=m.numMorphTargets;x<L;x++)m.__morphTargetsArrays.push(new Float32Array(t*3))}m.__needsSmoothNormals=y==THREE.SmoothShading;m.__uvType=u;m.__vertexColorType=v;m.__normalType=y;m.__webglFaceCount=z*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0);m.__webglLineCount=W*2;x=0;for(L=w.length;x<L;x++)if(u=w[x],u.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in u.attributes){v=u.attributes[a];y={};for(p in v)y[p]=v[p];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=
 !0,z=1,y.type==="v2"?z=2:y.type==="v3"?z=3:y.type==="v4"?z=4:y.type==="c"&&(z=3),y.size=z,y.array=new Float32Array(t*z),y.buffer=o.createBuffer(),y.buffer.belongsToAttribute=a,v.needsUpdate=!0,y.__original=v;m.__webglCustomAttributes[a]=y}}m.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=
 !0,z=1,y.type==="v2"?z=2:y.type==="v3"?z=3:y.type==="v4"?z=4:y.type==="c"&&(z=3),y.size=z,y.array=new Float32Array(t*z),y.buffer=o.createBuffer(),y.buffer.belongsToAttribute=a,v.needsUpdate=!0,y.__original=v;m.__webglCustomAttributes[a]=y}}m.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=
-o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.Line){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=
-new Float32Array(n*3),m.__webglLineCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(k=e.geometry,!k.__webglVertexBuffer)){m=k;m.__webglVertexBuffer=o.createBuffer();m.__webglColorBuffer=o.createBuffer();W.info.geometries++;m=k;n=e;t=m.vertices.length;m.__vertexArray=new Float32Array(t*3);m.__colorArray=new Float32Array(t*3);m.__sortArray=[];m.__webglParticleCount=t;m.__materials=n.materials;X=z=p=void 0;p=0;for(z=n.materials.length;p<z;p++)if(X=n.materials[p],
-X.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in X.attributes){originalAttribute=X.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(t*
-size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=!0;k.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups)m=k.geometryGroups[h],P(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(k=e.geometry,P(f.__webglObjects,k,e)):THREE.MarchingCubes!==
-void 0&&e instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];f=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)I(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;k=void 0;
-for(k=f.length-1;k>=0;k--)f[k]==h&&f.splice(k,1)}else e instanceof THREE.MarchingCubes&&I(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,p=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(t=h.geometryGroupsList.length;n<t;n++)if(m=h.geometryGroupsList[n],p=D(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||
-p)if(p=m,z=o.DYNAMIC_DRAW,X=!h.dynamic,p.__inittedArrays){var E=w=x=void 0,M=void 0,la=E=void 0,H=void 0,K=void 0,ca=void 0,ha=A=ga=v=y=L=u=void 0,J=void 0,pa=void 0,F=M=ca=M=K=H=void 0,B=void 0,C=B=F=H=void 0,Y=void 0,qa=C=B=F=E=E=la=ca=M=C=B=F=Y=C=B=F=Y=C=B=F=void 0,T=0,U=0,R=0,ua=0,S=0,za=0,O=0,Z=0,oa=0,Q=0,V=0,C=F=0,C=void 0,fa=p.__vertexArray,na=p.__uvArray,ja=p.__uv2Array,ka=p.__normalArray,$=p.__tangentArray,xa=p.__colorArray,aa=p.__skinVertexAArray,ra=p.__skinVertexBArray,da=p.__skinIndexArray,
-ea=p.__skinWeightArray,ma=p.__morphTargetsArrays,sa=p.__webglCustomAttributes,B=void 0,Aa=p.__faceArray,ya=p.__lineArray,ta=p.__needsSmoothNormals,L=p.__vertexColorType,u=p.__uvType,y=p.__normalType,va=k.geometry,Ca=va.__dirtyVertices,Fa=va.__dirtyElements,Ba=va.__dirtyUvs,Ea=va.__dirtyNormals,ab=va.__dirtyTangents,bb=va.__dirtyColors,cb=va.__dirtyMorphTargets,Oa=va.vertices,eb=p.faces,hb=va.faces,fb=va.faceVertexUvs[0],gb=va.faceVertexUvs[1],Pa=va.skinVerticesA,Qa=va.skinVerticesB,Ra=va.skinIndices,
-Ha=va.skinWeights,Ga=va.morphTargets;if(sa)for(qa in sa)sa[qa].offset=0,sa[qa].offsetSrc=0;x=0;for(w=eb.length;x<w;x++)if(E=eb[x],M=hb[E],fb&&(v=fb[E]),gb&&(ga=gb[E]),E=M.vertexNormals,la=M.normal,H=M.vertexColors,K=M.color,ca=M.vertexTangents,M instanceof THREE.Face3){if(Ca)A=Oa[M.a].position,ha=Oa[M.b].position,J=Oa[M.c].position,fa[U]=A.x,fa[U+1]=A.y,fa[U+2]=A.z,fa[U+3]=ha.x,fa[U+4]=ha.y,fa[U+5]=ha.z,fa[U+6]=J.x,fa[U+7]=J.y,fa[U+8]=J.z,U+=9;if(sa)for(qa in sa)if(B=sa[qa],B.__original.needsUpdate)F=
-B.offset,C=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[F]=B.value[M.a],B.array[F+1]=B.value[M.b],B.array[F+2]=B.value[M.c]):B.boundTo==="faces"?(C=B.value[C],B.array[F]=C,B.array[F+1]=C,B.array[F+2]=C,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[F]=B.value[C],B.array[F+1]=B.value[C+1],B.array[F+2]=B.value[C+2],B.offsetSrc+=3),B.offset+=3):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[M.a],ha=B.value[M.b],J=B.value[M.c]):B.boundTo==="faces"?(J=ha=A=C=
-B.value[C],B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[C],ha=B.value[C+1],J=B.value[C+2],B.offsetSrc+=3),B.size===2?(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=ha.x,B.array[F+3]=ha.y,B.array[F+4]=J.x,B.array[F+5]=J.y,B.offset+=6):B.size===3?(B.type==="c"?(B.array[F]=A.r,B.array[F+1]=A.g,B.array[F+2]=A.b,B.array[F+3]=ha.r,B.array[F+4]=ha.g,B.array[F+5]=ha.b,B.array[F+6]=J.r,B.array[F+7]=J.g,B.array[F+8]=J.b):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=ha.x,B.array[F+
-4]=ha.y,B.array[F+5]=ha.z,B.array[F+6]=J.x,B.array[F+7]=J.y,B.array[F+8]=J.z),B.offset+=9):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=A.w,B.array[F+4]=ha.x,B.array[F+5]=ha.y,B.array[F+6]=ha.z,B.array[F+7]=ha.w,B.array[F+8]=J.x,B.array[F+9]=J.y,B.array[F+10]=J.z,B.array[F+11]=J.w,B.offset+=12));if(cb){F=0;for(B=Ga.length;F<B;F++)A=Ga[F].vertices[M.a].position,ha=Ga[F].vertices[M.b].position,J=Ga[F].vertices[M.c].position,C=ma[F],C[V]=A.x,C[V+1]=A.y,C[V+2]=A.z,C[V+3]=ha.x,C[V+4]=
-ha.y,C[V+5]=ha.z,C[V+6]=J.x,C[V+7]=J.y,C[V+8]=J.z;V+=9}if(Ha.length)F=Ha[M.a],B=Ha[M.b],C=Ha[M.c],ea[Q]=F.x,ea[Q+1]=F.y,ea[Q+2]=F.z,ea[Q+3]=F.w,ea[Q+4]=B.x,ea[Q+5]=B.y,ea[Q+6]=B.z,ea[Q+7]=B.w,ea[Q+8]=C.x,ea[Q+9]=C.y,ea[Q+10]=C.z,ea[Q+11]=C.w,F=Ra[M.a],B=Ra[M.b],C=Ra[M.c],da[Q]=F.x,da[Q+1]=F.y,da[Q+2]=F.z,da[Q+3]=F.w,da[Q+4]=B.x,da[Q+5]=B.y,da[Q+6]=B.z,da[Q+7]=B.w,da[Q+8]=C.x,da[Q+9]=C.y,da[Q+10]=C.z,da[Q+11]=C.w,F=Pa[M.a],B=Pa[M.b],C=Pa[M.c],aa[Q]=F.x,aa[Q+1]=F.y,aa[Q+2]=F.z,aa[Q+3]=1,aa[Q+4]=B.x,
-aa[Q+5]=B.y,aa[Q+6]=B.z,aa[Q+7]=1,aa[Q+8]=C.x,aa[Q+9]=C.y,aa[Q+10]=C.z,aa[Q+11]=1,F=Qa[M.a],B=Qa[M.b],C=Qa[M.c],ra[Q]=F.x,ra[Q+1]=F.y,ra[Q+2]=F.z,ra[Q+3]=1,ra[Q+4]=B.x,ra[Q+5]=B.y,ra[Q+6]=B.z,ra[Q+7]=1,ra[Q+8]=C.x,ra[Q+9]=C.y,ra[Q+10]=C.z,ra[Q+11]=1,Q+=12;if(bb&&L)H.length==3&&L==THREE.VertexColors?(M=H[0],F=H[1],B=H[2]):B=F=M=K,xa[oa]=M.r,xa[oa+1]=M.g,xa[oa+2]=M.b,xa[oa+3]=F.r,xa[oa+4]=F.g,xa[oa+5]=F.b,xa[oa+6]=B.r,xa[oa+7]=B.g,xa[oa+8]=B.b,oa+=9;if(ab&&va.hasTangents)H=ca[0],K=ca[1],M=ca[2],$[O]=
-H.x,$[O+1]=H.y,$[O+2]=H.z,$[O+3]=H.w,$[O+4]=K.x,$[O+5]=K.y,$[O+6]=K.z,$[O+7]=K.w,$[O+8]=M.x,$[O+9]=M.y,$[O+10]=M.z,$[O+11]=M.w,O+=12;if(Ea&&y)if(E.length==3&&ta)for(ca=0;ca<3;ca++)la=E[ca],ka[za]=la.x,ka[za+1]=la.y,ka[za+2]=la.z,za+=3;else for(ca=0;ca<3;ca++)ka[za]=la.x,ka[za+1]=la.y,ka[za+2]=la.z,za+=3;if(Ba&&v!==void 0&&u)for(ca=0;ca<3;ca++)E=v[ca],na[R]=E.u,na[R+1]=E.v,R+=2;if(Ba&&ga!==void 0&&u)for(ca=0;ca<3;ca++)E=ga[ca],ja[ua]=E.u,ja[ua+1]=E.v,ua+=2;Fa&&(Aa[S]=T,Aa[S+1]=T+1,Aa[S+2]=T+2,S+=3,
-ya[Z]=T,ya[Z+1]=T+1,ya[Z+2]=T,ya[Z+3]=T+2,ya[Z+4]=T+1,ya[Z+5]=T+2,Z+=6,T+=3)}else if(M instanceof THREE.Face4){if(Ca)A=Oa[M.a].position,ha=Oa[M.b].position,J=Oa[M.c].position,pa=Oa[M.d].position,fa[U]=A.x,fa[U+1]=A.y,fa[U+2]=A.z,fa[U+3]=ha.x,fa[U+4]=ha.y,fa[U+5]=ha.z,fa[U+6]=J.x,fa[U+7]=J.y,fa[U+8]=J.z,fa[U+9]=pa.x,fa[U+10]=pa.y,fa[U+11]=pa.z,U+=12;if(sa)for(qa in sa)if(B=sa[qa],B.__original.needsUpdate)F=B.offset,C=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[F]=B.value[M.a],
-B.array[F+1]=B.value[M.b],B.array[F+2]=B.value[M.c],B.array[F+3]=B.value[M.d]):B.boundTo==="faces"?(C=B.value[C],B.array[F]=C,B.array[F+1]=C,B.array[F+2]=C,B.array[F+3]=C,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[F]=B.value[C],B.array[F+1]=B.value[C+1],B.array[F+2]=B.value[C+2],B.array[F+3]=B.value[C+3],B.offsetSrc+=4),B.offset+=4):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[M.a],ha=B.value[M.b],J=B.value[M.c],pa=B.value[M.d]):B.boundTo==="faces"?(pa=J=ha=A=C=B.value[C],B.offsetSrc++):
-B.boundTo==="faceVertices"&&(A=B.value[C],ha=B.value[C+1],J=B.value[C+2],pa=B.value[C+3],B.offsetSrc+=4),B.size===2?(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=ha.x,B.array[F+3]=ha.y,B.array[F+4]=J.x,B.array[F+5]=J.y,B.array[F+6]=pa.x,B.array[F+7]=pa.y,B.offset+=8):B.size===3?(B.type==="c"?(B.array[F]=A.r,B.array[F+1]=A.g,B.array[F+2]=A.b,B.array[F+3]=ha.r,B.array[F+4]=ha.g,B.array[F+5]=ha.b,B.array[F+6]=J.r,B.array[F+7]=J.g,B.array[F+8]=J.b,B.array[F+9]=pa.r,B.array[F+10]=pa.g,B.array[F+11]=pa.b):
-(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=ha.x,B.array[F+4]=ha.y,B.array[F+5]=ha.z,B.array[F+6]=J.x,B.array[F+7]=J.y,B.array[F+8]=J.z,B.array[F+9]=pa.x,B.array[F+10]=pa.y,B.array[F+11]=pa.z),B.offset+=12):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=A.w,B.array[F+4]=ha.x,B.array[F+5]=ha.y,B.array[F+6]=ha.z,B.array[F+7]=ha.w,B.array[F+8]=J.x,B.array[F+9]=J.y,B.array[F+10]=J.z,B.array[F+11]=J.w,B.array[F+12]=pa.x,B.array[F+13]=pa.y,B.array[F+14]=pa.z,B.array[F+
-15]=pa.w,B.offset+=16));if(cb){F=0;for(B=Ga.length;F<B;F++)A=Ga[F].vertices[M.a].position,ha=Ga[F].vertices[M.b].position,J=Ga[F].vertices[M.c].position,pa=Ga[F].vertices[M.d].position,C=ma[F],C[V]=A.x,C[V+1]=A.y,C[V+2]=A.z,C[V+3]=ha.x,C[V+4]=ha.y,C[V+5]=ha.z,C[V+6]=J.x,C[V+7]=J.y,C[V+8]=J.z,C[V+9]=pa.x,C[V+10]=pa.y,C[V+11]=pa.z;V+=12}if(Ha.length)F=Ha[M.a],B=Ha[M.b],C=Ha[M.c],Y=Ha[M.d],ea[Q]=F.x,ea[Q+1]=F.y,ea[Q+2]=F.z,ea[Q+3]=F.w,ea[Q+4]=B.x,ea[Q+5]=B.y,ea[Q+6]=B.z,ea[Q+7]=B.w,ea[Q+8]=C.x,ea[Q+
-9]=C.y,ea[Q+10]=C.z,ea[Q+11]=C.w,ea[Q+12]=Y.x,ea[Q+13]=Y.y,ea[Q+14]=Y.z,ea[Q+15]=Y.w,F=Ra[M.a],B=Ra[M.b],C=Ra[M.c],Y=Ra[M.d],da[Q]=F.x,da[Q+1]=F.y,da[Q+2]=F.z,da[Q+3]=F.w,da[Q+4]=B.x,da[Q+5]=B.y,da[Q+6]=B.z,da[Q+7]=B.w,da[Q+8]=C.x,da[Q+9]=C.y,da[Q+10]=C.z,da[Q+11]=C.w,da[Q+12]=Y.x,da[Q+13]=Y.y,da[Q+14]=Y.z,da[Q+15]=Y.w,F=Pa[M.a],B=Pa[M.b],C=Pa[M.c],Y=Pa[M.d],aa[Q]=F.x,aa[Q+1]=F.y,aa[Q+2]=F.z,aa[Q+3]=1,aa[Q+4]=B.x,aa[Q+5]=B.y,aa[Q+6]=B.z,aa[Q+7]=1,aa[Q+8]=C.x,aa[Q+9]=C.y,aa[Q+10]=C.z,aa[Q+11]=1,aa[Q+
-12]=Y.x,aa[Q+13]=Y.y,aa[Q+14]=Y.z,aa[Q+15]=1,F=Qa[M.a],B=Qa[M.b],C=Qa[M.c],M=Qa[M.d],ra[Q]=F.x,ra[Q+1]=F.y,ra[Q+2]=F.z,ra[Q+3]=1,ra[Q+4]=B.x,ra[Q+5]=B.y,ra[Q+6]=B.z,ra[Q+7]=1,ra[Q+8]=C.x,ra[Q+9]=C.y,ra[Q+10]=C.z,ra[Q+11]=1,ra[Q+12]=M.x,ra[Q+13]=M.y,ra[Q+14]=M.z,ra[Q+15]=1,Q+=16;if(bb&&L)H.length==4&&L==THREE.VertexColors?(M=H[0],F=H[1],B=H[2],H=H[3]):H=B=F=M=K,xa[oa]=M.r,xa[oa+1]=M.g,xa[oa+2]=M.b,xa[oa+3]=F.r,xa[oa+4]=F.g,xa[oa+5]=F.b,xa[oa+6]=B.r,xa[oa+7]=B.g,xa[oa+8]=B.b,xa[oa+9]=H.r,xa[oa+10]=
-H.g,xa[oa+11]=H.b,oa+=12;if(ab&&va.hasTangents)H=ca[0],K=ca[1],M=ca[2],ca=ca[3],$[O]=H.x,$[O+1]=H.y,$[O+2]=H.z,$[O+3]=H.w,$[O+4]=K.x,$[O+5]=K.y,$[O+6]=K.z,$[O+7]=K.w,$[O+8]=M.x,$[O+9]=M.y,$[O+10]=M.z,$[O+11]=M.w,$[O+12]=ca.x,$[O+13]=ca.y,$[O+14]=ca.z,$[O+15]=ca.w,O+=16;if(Ea&&y)if(E.length==4&&ta)for(ca=0;ca<4;ca++)la=E[ca],ka[za]=la.x,ka[za+1]=la.y,ka[za+2]=la.z,za+=3;else for(ca=0;ca<4;ca++)ka[za]=la.x,ka[za+1]=la.y,ka[za+2]=la.z,za+=3;if(Ba&&v!==void 0&&u)for(ca=0;ca<4;ca++)E=v[ca],na[R]=E.u,na[R+
-1]=E.v,R+=2;if(Ba&&ga!==void 0&&u)for(ca=0;ca<4;ca++)E=ga[ca],ja[ua]=E.u,ja[ua+1]=E.v,ua+=2;Fa&&(Aa[S]=T,Aa[S+1]=T+1,Aa[S+2]=T+3,Aa[S+3]=T+1,Aa[S+4]=T+2,Aa[S+5]=T+3,S+=6,ya[Z]=T,ya[Z+1]=T+1,ya[Z+2]=T,ya[Z+3]=T+3,ya[Z+4]=T+1,ya[Z+5]=T+2,ya[Z+6]=T+2,ya[Z+7]=T+3,Z+=8,T+=4)}Ca&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,fa,z));if(sa)for(qa in sa)B=sa[qa],B.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,B.buffer),o.bufferData(o.ARRAY_BUFFER,B.array,z));if(cb){F=
-0;for(B=Ga.length;F<B;F++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[F]),o.bufferData(o.ARRAY_BUFFER,ma[F],z)}bb&&oa>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,xa,z));Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ka,z));ab&&va.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,$,z));Ba&&R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,
-na,z));Ba&&ua>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ja,z));Fa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,Aa,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ya,z));Q>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ra,z),o.bindBuffer(o.ARRAY_BUFFER,
-p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,da,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ea,z));X&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=
-!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;G(m)}else if(k instanceof THREE.Ribbon){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=X=X=void 0;w=k.vertices;t=k.colors;u=w.length;p=t.length;L=k.__vertexArray;z=k.__colorArray;y=k.__dirtyColors;if(k.__dirtyVertices){for(X=0;X<u;X++)x=w[X].position,n=X*3,L[n]=x.x,L[n+1]=x.y,L[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,L,m)}if(y){for(X=
-0;X<p;X++)color=t[X],n=X*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=X=X=void 0;w=k.vertices;t=k.colors;u=w.length;p=t.length;L=k.__vertexArray;z=k.__colorArray;y=k.__dirtyColors;if(k.__dirtyVertices){for(X=0;X<u;X++)x=w[X].position,n=X*3,L[n]=x.x,L[n+1]=x.y,L[n+2]=
-x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,L,m)}if(y){for(X=0;X<p;X++)color=t[X],n=X*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem)h=k.geometry,p=D(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||p)&&c(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,G(h)};this.setFaceCulling=
-function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Aa}};
+o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),V.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.Line){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),V.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=
+new Float32Array(n*3),m.__webglLineCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(k=e.geometry,!k.__webglVertexBuffer)){m=k;m.__webglVertexBuffer=o.createBuffer();m.__webglColorBuffer=o.createBuffer();V.info.geometries++;m=k;n=e;t=m.vertices.length;m.__vertexArray=new Float32Array(t*3);m.__colorArray=new Float32Array(t*3);m.__sortArray=[];m.__webglParticleCount=t;m.__materials=n.materials;W=z=p=void 0;p=0;for(z=n.materials.length;p<z;p++)if(W=n.materials[p],
+W.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in W.attributes){originalAttribute=W.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(t*
+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],Q(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(k=e.geometry,Q(f.__webglObjects,k,e)):THREE.MarchingCubes!==
+void 0&&e instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];f=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)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&&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=D(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||
+p)if(p=m,z=o.DYNAMIC_DRAW,W=!h.dynamic,p.__inittedArrays){var E=w=x=void 0,J=void 0,H=E=void 0,ra=void 0,M=void 0,ja=void 0,ha=A=ia=v=y=L=u=void 0,da=void 0,K=void 0,I=J=ja=J=M=ra=void 0,B=void 0,C=B=I=ra=void 0,qa=void 0,Z=C=B=I=E=E=H=ja=J=C=B=I=qa=C=B=I=qa=C=B=I=void 0,T=0,O=0,ua=0,ca=0,S=0,za=0,P=0,X=0,oa=0,R=0,U=0,C=I=0,C=void 0,ga=p.__vertexArray,na=p.__uvArray,ka=p.__uv2Array,la=p.__normalArray,Y=p.__tangentArray,ya=p.__colorArray,aa=p.__skinVertexAArray,sa=p.__skinVertexBArray,ea=p.__skinIndexArray,
+fa=p.__skinWeightArray,ma=p.__morphTargetsArrays,Ba=p.__webglCustomAttributes,B=void 0,va=p.__faceArray,pa=p.__lineArray,Ha=p.__needsSmoothNormals,L=p.__vertexColorType,u=p.__uvType,y=p.__normalType,xa=k.geometry,ta=xa.__dirtyVertices,Da=xa.__dirtyElements,Aa=xa.__dirtyUvs,Ea=xa.__dirtyNormals,Ga=xa.__dirtyTangents,bb=xa.__dirtyColors,cb=xa.__dirtyMorphTargets,Pa=xa.vertices,eb=p.faces,hb=xa.faces,fb=xa.faceVertexUvs[0],gb=xa.faceVertexUvs[1],Qa=xa.skinVerticesA,Ra=xa.skinVerticesB,Sa=xa.skinIndices,
+Ja=xa.skinWeights,Ia=xa.morphTargets;if(Ba)for(Z in Ba)Ba[Z].offset=0,Ba[Z].offsetSrc=0;x=0;for(w=eb.length;x<w;x++)if(E=eb[x],J=hb[E],fb&&(v=fb[E]),gb&&(ia=gb[E]),E=J.vertexNormals,H=J.normal,ra=J.vertexColors,M=J.color,ja=J.vertexTangents,J instanceof THREE.Face3){if(ta)A=Pa[J.a].position,ha=Pa[J.b].position,da=Pa[J.c].position,ga[O]=A.x,ga[O+1]=A.y,ga[O+2]=A.z,ga[O+3]=ha.x,ga[O+4]=ha.y,ga[O+5]=ha.z,ga[O+6]=da.x,ga[O+7]=da.y,ga[O+8]=da.z,O+=9;if(Ba)for(Z in Ba)if(B=Ba[Z],B.__original.needsUpdate)I=
+B.offset,C=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[I]=B.value[J.a],B.array[I+1]=B.value[J.b],B.array[I+2]=B.value[J.c]):B.boundTo==="faces"?(C=B.value[C],B.array[I]=C,B.array[I+1]=C,B.array[I+2]=C,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[I]=B.value[C],B.array[I+1]=B.value[C+1],B.array[I+2]=B.value[C+2],B.offsetSrc+=3),B.offset+=3):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[J.a],ha=B.value[J.b],da=B.value[J.c]):B.boundTo==="faces"?(da=ha=A=
+C=B.value[C],B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[C],ha=B.value[C+1],da=B.value[C+2],B.offsetSrc+=3),B.size===2?(B.array[I]=A.x,B.array[I+1]=A.y,B.array[I+2]=ha.x,B.array[I+3]=ha.y,B.array[I+4]=da.x,B.array[I+5]=da.y,B.offset+=6):B.size===3?(B.type==="c"?(B.array[I]=A.r,B.array[I+1]=A.g,B.array[I+2]=A.b,B.array[I+3]=ha.r,B.array[I+4]=ha.g,B.array[I+5]=ha.b,B.array[I+6]=da.r,B.array[I+7]=da.g,B.array[I+8]=da.b):(B.array[I]=A.x,B.array[I+1]=A.y,B.array[I+2]=A.z,B.array[I+3]=ha.x,B.array[I+
+4]=ha.y,B.array[I+5]=ha.z,B.array[I+6]=da.x,B.array[I+7]=da.y,B.array[I+8]=da.z),B.offset+=9):(B.array[I]=A.x,B.array[I+1]=A.y,B.array[I+2]=A.z,B.array[I+3]=A.w,B.array[I+4]=ha.x,B.array[I+5]=ha.y,B.array[I+6]=ha.z,B.array[I+7]=ha.w,B.array[I+8]=da.x,B.array[I+9]=da.y,B.array[I+10]=da.z,B.array[I+11]=da.w,B.offset+=12));if(cb){I=0;for(B=Ia.length;I<B;I++)A=Ia[I].vertices[J.a].position,ha=Ia[I].vertices[J.b].position,da=Ia[I].vertices[J.c].position,C=ma[I],C[U]=A.x,C[U+1]=A.y,C[U+2]=A.z,C[U+3]=ha.x,
+C[U+4]=ha.y,C[U+5]=ha.z,C[U+6]=da.x,C[U+7]=da.y,C[U+8]=da.z;U+=9}if(Ja.length)I=Ja[J.a],B=Ja[J.b],C=Ja[J.c],fa[R]=I.x,fa[R+1]=I.y,fa[R+2]=I.z,fa[R+3]=I.w,fa[R+4]=B.x,fa[R+5]=B.y,fa[R+6]=B.z,fa[R+7]=B.w,fa[R+8]=C.x,fa[R+9]=C.y,fa[R+10]=C.z,fa[R+11]=C.w,I=Sa[J.a],B=Sa[J.b],C=Sa[J.c],ea[R]=I.x,ea[R+1]=I.y,ea[R+2]=I.z,ea[R+3]=I.w,ea[R+4]=B.x,ea[R+5]=B.y,ea[R+6]=B.z,ea[R+7]=B.w,ea[R+8]=C.x,ea[R+9]=C.y,ea[R+10]=C.z,ea[R+11]=C.w,I=Qa[J.a],B=Qa[J.b],C=Qa[J.c],aa[R]=I.x,aa[R+1]=I.y,aa[R+2]=I.z,aa[R+3]=1,aa[R+
+4]=B.x,aa[R+5]=B.y,aa[R+6]=B.z,aa[R+7]=1,aa[R+8]=C.x,aa[R+9]=C.y,aa[R+10]=C.z,aa[R+11]=1,I=Ra[J.a],B=Ra[J.b],C=Ra[J.c],sa[R]=I.x,sa[R+1]=I.y,sa[R+2]=I.z,sa[R+3]=1,sa[R+4]=B.x,sa[R+5]=B.y,sa[R+6]=B.z,sa[R+7]=1,sa[R+8]=C.x,sa[R+9]=C.y,sa[R+10]=C.z,sa[R+11]=1,R+=12;if(bb&&L)ra.length==3&&L==THREE.VertexColors?(J=ra[0],I=ra[1],B=ra[2]):B=I=J=M,ya[oa]=J.r,ya[oa+1]=J.g,ya[oa+2]=J.b,ya[oa+3]=I.r,ya[oa+4]=I.g,ya[oa+5]=I.b,ya[oa+6]=B.r,ya[oa+7]=B.g,ya[oa+8]=B.b,oa+=9;if(Ga&&xa.hasTangents)ra=ja[0],M=ja[1],
+J=ja[2],Y[P]=ra.x,Y[P+1]=ra.y,Y[P+2]=ra.z,Y[P+3]=ra.w,Y[P+4]=M.x,Y[P+5]=M.y,Y[P+6]=M.z,Y[P+7]=M.w,Y[P+8]=J.x,Y[P+9]=J.y,Y[P+10]=J.z,Y[P+11]=J.w,P+=12;if(Ea&&y)if(E.length==3&&Ha)for(ja=0;ja<3;ja++)H=E[ja],la[za]=H.x,la[za+1]=H.y,la[za+2]=H.z,za+=3;else for(ja=0;ja<3;ja++)la[za]=H.x,la[za+1]=H.y,la[za+2]=H.z,za+=3;if(Aa&&v!==void 0&&u)for(ja=0;ja<3;ja++)E=v[ja],na[ua]=E.u,na[ua+1]=E.v,ua+=2;if(Aa&&ia!==void 0&&u)for(ja=0;ja<3;ja++)E=ia[ja],ka[ca]=E.u,ka[ca+1]=E.v,ca+=2;Da&&(va[S]=T,va[S+1]=T+1,va[S+
+2]=T+2,S+=3,pa[X]=T,pa[X+1]=T+1,pa[X+2]=T,pa[X+3]=T+2,pa[X+4]=T+1,pa[X+5]=T+2,X+=6,T+=3)}else if(J instanceof THREE.Face4){if(ta)A=Pa[J.a].position,ha=Pa[J.b].position,da=Pa[J.c].position,K=Pa[J.d].position,ga[O]=A.x,ga[O+1]=A.y,ga[O+2]=A.z,ga[O+3]=ha.x,ga[O+4]=ha.y,ga[O+5]=ha.z,ga[O+6]=da.x,ga[O+7]=da.y,ga[O+8]=da.z,ga[O+9]=K.x,ga[O+10]=K.y,ga[O+11]=K.z,O+=12;if(Ba)for(Z in Ba)if(B=Ba[Z],B.__original.needsUpdate)I=B.offset,C=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[I]=
+B.value[J.a],B.array[I+1]=B.value[J.b],B.array[I+2]=B.value[J.c],B.array[I+3]=B.value[J.d]):B.boundTo==="faces"?(C=B.value[C],B.array[I]=C,B.array[I+1]=C,B.array[I+2]=C,B.array[I+3]=C,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[I]=B.value[C],B.array[I+1]=B.value[C+1],B.array[I+2]=B.value[C+2],B.array[I+3]=B.value[C+3],B.offsetSrc+=4),B.offset+=4):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[J.a],ha=B.value[J.b],da=B.value[J.c],K=B.value[J.d]):B.boundTo==="faces"?(K=da=ha=A=C=B.value[C],
+B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[C],ha=B.value[C+1],da=B.value[C+2],K=B.value[C+3],B.offsetSrc+=4),B.size===2?(B.array[I]=A.x,B.array[I+1]=A.y,B.array[I+2]=ha.x,B.array[I+3]=ha.y,B.array[I+4]=da.x,B.array[I+5]=da.y,B.array[I+6]=K.x,B.array[I+7]=K.y,B.offset+=8):B.size===3?(B.type==="c"?(B.array[I]=A.r,B.array[I+1]=A.g,B.array[I+2]=A.b,B.array[I+3]=ha.r,B.array[I+4]=ha.g,B.array[I+5]=ha.b,B.array[I+6]=da.r,B.array[I+7]=da.g,B.array[I+8]=da.b,B.array[I+9]=K.r,B.array[I+10]=K.g,
+B.array[I+11]=K.b):(B.array[I]=A.x,B.array[I+1]=A.y,B.array[I+2]=A.z,B.array[I+3]=ha.x,B.array[I+4]=ha.y,B.array[I+5]=ha.z,B.array[I+6]=da.x,B.array[I+7]=da.y,B.array[I+8]=da.z,B.array[I+9]=K.x,B.array[I+10]=K.y,B.array[I+11]=K.z),B.offset+=12):(B.array[I]=A.x,B.array[I+1]=A.y,B.array[I+2]=A.z,B.array[I+3]=A.w,B.array[I+4]=ha.x,B.array[I+5]=ha.y,B.array[I+6]=ha.z,B.array[I+7]=ha.w,B.array[I+8]=da.x,B.array[I+9]=da.y,B.array[I+10]=da.z,B.array[I+11]=da.w,B.array[I+12]=K.x,B.array[I+13]=K.y,B.array[I+
+14]=K.z,B.array[I+15]=K.w,B.offset+=16));if(cb){I=0;for(B=Ia.length;I<B;I++)A=Ia[I].vertices[J.a].position,ha=Ia[I].vertices[J.b].position,da=Ia[I].vertices[J.c].position,K=Ia[I].vertices[J.d].position,C=ma[I],C[U]=A.x,C[U+1]=A.y,C[U+2]=A.z,C[U+3]=ha.x,C[U+4]=ha.y,C[U+5]=ha.z,C[U+6]=da.x,C[U+7]=da.y,C[U+8]=da.z,C[U+9]=K.x,C[U+10]=K.y,C[U+11]=K.z;U+=12}if(Ja.length)I=Ja[J.a],B=Ja[J.b],C=Ja[J.c],qa=Ja[J.d],fa[R]=I.x,fa[R+1]=I.y,fa[R+2]=I.z,fa[R+3]=I.w,fa[R+4]=B.x,fa[R+5]=B.y,fa[R+6]=B.z,fa[R+7]=B.w,
+fa[R+8]=C.x,fa[R+9]=C.y,fa[R+10]=C.z,fa[R+11]=C.w,fa[R+12]=qa.x,fa[R+13]=qa.y,fa[R+14]=qa.z,fa[R+15]=qa.w,I=Sa[J.a],B=Sa[J.b],C=Sa[J.c],qa=Sa[J.d],ea[R]=I.x,ea[R+1]=I.y,ea[R+2]=I.z,ea[R+3]=I.w,ea[R+4]=B.x,ea[R+5]=B.y,ea[R+6]=B.z,ea[R+7]=B.w,ea[R+8]=C.x,ea[R+9]=C.y,ea[R+10]=C.z,ea[R+11]=C.w,ea[R+12]=qa.x,ea[R+13]=qa.y,ea[R+14]=qa.z,ea[R+15]=qa.w,I=Qa[J.a],B=Qa[J.b],C=Qa[J.c],qa=Qa[J.d],aa[R]=I.x,aa[R+1]=I.y,aa[R+2]=I.z,aa[R+3]=1,aa[R+4]=B.x,aa[R+5]=B.y,aa[R+6]=B.z,aa[R+7]=1,aa[R+8]=C.x,aa[R+9]=C.y,
+aa[R+10]=C.z,aa[R+11]=1,aa[R+12]=qa.x,aa[R+13]=qa.y,aa[R+14]=qa.z,aa[R+15]=1,I=Ra[J.a],B=Ra[J.b],C=Ra[J.c],J=Ra[J.d],sa[R]=I.x,sa[R+1]=I.y,sa[R+2]=I.z,sa[R+3]=1,sa[R+4]=B.x,sa[R+5]=B.y,sa[R+6]=B.z,sa[R+7]=1,sa[R+8]=C.x,sa[R+9]=C.y,sa[R+10]=C.z,sa[R+11]=1,sa[R+12]=J.x,sa[R+13]=J.y,sa[R+14]=J.z,sa[R+15]=1,R+=16;if(bb&&L)ra.length==4&&L==THREE.VertexColors?(J=ra[0],I=ra[1],B=ra[2],ra=ra[3]):ra=B=I=J=M,ya[oa]=J.r,ya[oa+1]=J.g,ya[oa+2]=J.b,ya[oa+3]=I.r,ya[oa+4]=I.g,ya[oa+5]=I.b,ya[oa+6]=B.r,ya[oa+7]=B.g,
+ya[oa+8]=B.b,ya[oa+9]=ra.r,ya[oa+10]=ra.g,ya[oa+11]=ra.b,oa+=12;if(Ga&&xa.hasTangents)ra=ja[0],M=ja[1],J=ja[2],ja=ja[3],Y[P]=ra.x,Y[P+1]=ra.y,Y[P+2]=ra.z,Y[P+3]=ra.w,Y[P+4]=M.x,Y[P+5]=M.y,Y[P+6]=M.z,Y[P+7]=M.w,Y[P+8]=J.x,Y[P+9]=J.y,Y[P+10]=J.z,Y[P+11]=J.w,Y[P+12]=ja.x,Y[P+13]=ja.y,Y[P+14]=ja.z,Y[P+15]=ja.w,P+=16;if(Ea&&y)if(E.length==4&&Ha)for(ja=0;ja<4;ja++)H=E[ja],la[za]=H.x,la[za+1]=H.y,la[za+2]=H.z,za+=3;else for(ja=0;ja<4;ja++)la[za]=H.x,la[za+1]=H.y,la[za+2]=H.z,za+=3;if(Aa&&v!==void 0&&u)for(ja=
+0;ja<4;ja++)E=v[ja],na[ua]=E.u,na[ua+1]=E.v,ua+=2;if(Aa&&ia!==void 0&&u)for(ja=0;ja<4;ja++)E=ia[ja],ka[ca]=E.u,ka[ca+1]=E.v,ca+=2;Da&&(va[S]=T,va[S+1]=T+1,va[S+2]=T+3,va[S+3]=T+1,va[S+4]=T+2,va[S+5]=T+3,S+=6,pa[X]=T,pa[X+1]=T+1,pa[X+2]=T,pa[X+3]=T+3,pa[X+4]=T+1,pa[X+5]=T+2,pa[X+6]=T+2,pa[X+7]=T+3,X+=8,T+=4)}ta&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,ga,z));if(Ba)for(Z in Ba)B=Ba[Z],B.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,B.buffer),o.bufferData(o.ARRAY_BUFFER,
+B.array,z));if(cb){I=0;for(B=Ia.length;I<B;I++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[I]),o.bufferData(o.ARRAY_BUFFER,ma[I],z)}bb&&oa>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ya,z));Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,la,z));Ga&&xa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,Y,z));Aa&&ua>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,
+na,z));Aa&&ca>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ka,z));Da&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,va,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,pa,z));R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,sa,z),o.bindBuffer(o.ARRAY_BUFFER,
+p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ea,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,fa,z));W&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=
+!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;F(m)}else if(k instanceof THREE.Ribbon){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=W=W=void 0;w=k.vertices;t=k.colors;u=w.length;p=t.length;L=k.__vertexArray;z=k.__colorArray;y=k.__dirtyColors;if(k.__dirtyVertices){for(W=0;W<u;W++)x=w[W].position,n=W*3,L[n]=x.x,L[n+1]=x.y,L[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,L,m)}if(y){for(W=
+0;W<p;W++)color=t[W],n=W*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=W=W=void 0;w=k.vertices;t=k.colors;u=w.length;p=t.length;L=k.__vertexArray;z=k.__colorArray;y=k.__dirtyColors;if(k.__dirtyVertices){for(W=0;W<u;W++)x=w[W].position,n=W*3,L[n]=x.x,L[n+1]=x.y,L[n+2]=
+x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,L,m)}if(y){for(W=0;W<p;W++)color=t[W],n=W*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem)h=k.geometry,p=D(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||p)&&c(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,F(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 Ba}};
 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};
@@ -477,23 +477,23 @@ c(this,function(b){e&&(m=k=this.getMouseProjectionOnBall(b.clientX,b.clientY),n=
 b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?m=k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=u=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(p=v=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
 b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?m=k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=u=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(p=v=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
 this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
 this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;
 THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;
-THREE.CubeGeometry=function(b,c,e,f,h,m,k,n,u){function p(b,c,e,k,n,p,t,u){var w,x,z=f||1,y=h||1,R=n/2,O=p/2,V=v.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")w="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")w="y",y=m||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")w="x",z=m||1;var W=z+1,o=y+1;n/=z;var ea=p/y;for(x=0;x<o;x++)for(p=0;p<W;p++){var S=new THREE.Vector3;S[b]=(p*n-R)*e;S[c]=(x*ea-O)*k;S[w]=t;v.vertices.push(new THREE.Vertex(S))}for(x=0;x<y;x++)for(p=0;p<z;p++)v.faces.push(new THREE.Face4(p+W*
-x+V,p+W*(x+1)+V,p+1+W*(x+1)+V,p+1+W*x+V,null,null,u)),v.faceVertexUvs[0].push([new THREE.UV(p/z,x/y),new THREE.UV(p/z,(x+1)/y),new THREE.UV((p+1)/z,(x+1)/y),new THREE.UV((p+1)/z,x/y)])}THREE.Geometry.call(this);var v=this,t=b/2,x=c/2,w=e/2,n=n?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var z=0;z<6;z++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(u!=void 0)for(var y in u)this.sides[y]!=void 0&&(this.sides[y]=
+THREE.CubeGeometry=function(b,c,e,f,h,m,k,n,u){function p(b,c,e,k,n,p,t,u){var w,x,z=f||1,y=h||1,O=n/2,P=p/2,U=v.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")w="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")w="y",y=m||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")w="x",z=m||1;var V=z+1,o=y+1;n/=z;var fa=p/y;for(x=0;x<o;x++)for(p=0;p<V;p++){var S=new THREE.Vector3;S[b]=(p*n-O)*e;S[c]=(x*fa-P)*k;S[w]=t;v.vertices.push(new THREE.Vertex(S))}for(x=0;x<y;x++)for(p=0;p<z;p++)v.faces.push(new THREE.Face4(p+V*
+x+U,p+V*(x+1)+U,p+1+V*(x+1)+U,p+1+V*x+U,null,null,u)),v.faceVertexUvs[0].push([new THREE.UV(p/z,x/y),new THREE.UV(p/z,(x+1)/y),new THREE.UV((p+1)/z,(x+1)/y),new THREE.UV((p+1)/z,x/y)])}THREE.Geometry.call(this);var v=this,t=b/2,x=c/2,w=e/2,n=n?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var z=0;z<6;z++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(u!=void 0)for(var y in u)this.sides[y]!=void 0&&(this.sides[y]=
 u[y]);this.sides.px&&p("z","y",1*n,-1,e,c,-t,this.materials[0]);this.sides.nx&&p("z","y",-1*n,-1,e,c,t,this.materials[1]);this.sides.py&&p("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&p("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&p("x","y",1*n,-1,b,c,w,this.materials[4]);this.sides.nz&&p("x","y",-1*n,-1,b,c,-w,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=v.vertices.length;e<f;e++){for(var k=v.vertices[e],h=!1,m=0,n=b.length;m<n;m++){var p=b[m];if(k.position.x==p.position.x&&
 u[y]);this.sides.px&&p("z","y",1*n,-1,e,c,-t,this.materials[0]);this.sides.nx&&p("z","y",-1*n,-1,e,c,t,this.materials[1]);this.sides.py&&p("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&p("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&p("x","y",1*n,-1,b,c,w,this.materials[4]);this.sides.nz&&p("x","y",-1*n,-1,b,c,-w,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=v.vertices.length;e<f;e++){for(var k=v.vertices[e],h=!1,m=0,n=b.length;m<n;m++){var p=b[m];if(k.position.x==p.position.x&&
 k.position.y==p.position.y&&k.position.z==p.position.z){c[e]=m;h=!0;break}}if(!h)c[e]=b.length,b.push(new THREE.Vertex(k.position.clone()))}e=0;for(f=v.faces.length;e<f;e++)k=v.faces[e],k.a=c[k.a],k.b=c[k.b],k.c=c[k.c],k.d=c[k.d];v.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 k.position.y==p.position.y&&k.position.z==p.position.z){c[e]=m;h=!0;break}}if(!h)c[e]=b.length,b.push(new THREE.Vertex(k.position.clone()))}e=0;for(f=v.faces.length;e<f;e++)k=v.faces[e],k.a=c[k.a],k.b=c[k.b],k.c=c[k.c],k.d=c[k.d];v.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CylinderGeometry=function(b,c,e,f,h,m){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,k=e/2,f=f||8,h=h||1,n,u,p=[],v=[];for(u=0;u<=h;u++){var t=[],x=[],w=u/h,z=w*(c-b)+b;for(n=0;n<=f;n++){var y=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(y*Math.PI*2),-w*e+k,z*Math.cos(y*Math.PI*2))));t.push(this.vertices.length-1);x.push(new THREE.UV(y,w))}p.push(t);v.push(x)}for(u=0;u<h;u++)for(n=0;n<f;n++){var e=p[u][n],t=p[u+1][n],x=p[u+1][n+1],w=p[u][n+1],z=
 THREE.CylinderGeometry=function(b,c,e,f,h,m){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,k=e/2,f=f||8,h=h||1,n,u,p=[],v=[];for(u=0;u<=h;u++){var t=[],x=[],w=u/h,z=w*(c-b)+b;for(n=0;n<=f;n++){var y=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(y*Math.PI*2),-w*e+k,z*Math.cos(y*Math.PI*2))));t.push(this.vertices.length-1);x.push(new THREE.UV(y,w))}p.push(t);v.push(x)}for(u=0;u<h;u++)for(n=0;n<f;n++){var e=p[u][n],t=p[u+1][n],x=p[u+1][n+1],w=p[u][n+1],z=
-this.vertices[e].position.clone().setY(0).normalize(),y=this.vertices[t].position.clone().setY(0).normalize(),A=this.vertices[x].position.clone().setY(0).normalize(),E=this.vertices[w].position.clone().setY(0).normalize(),D=v[u][n].clone(),G=v[u+1][n].clone(),I=v[u+1][n+1].clone(),N=v[u][n+1].clone();this.faces.push(new THREE.Face4(e,t,x,w,[z,y,A,E]));this.faceVertexUvs[0].push([D,G,I,N])}if(!m&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(n=0;n<f;n++)e=p[0][n],t=p[0][n+
-1],x=this.vertices.length-1,z=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),D=v[0][n].clone(),G=v[0][n+1].clone(),I=new THREE.UV(G.u,0),this.faces.push(new THREE.Face3(e,t,x,[z,y,A])),this.faceVertexUvs[0].push([D,G,I])}if(!m&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(n=0;n<f;n++)e=p[u][n+1],t=p[u][n],x=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),D=v[u][n+1].clone(),G=v[u][n].clone(),
-I=new THREE.UV(G.u,1),this.faces.push(new THREE.Face3(e,t,x,[z,y,A])),this.faceVertexUvs[0].push([D,G,I])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+this.vertices[e].position.clone().setY(0).normalize(),y=this.vertices[t].position.clone().setY(0).normalize(),A=this.vertices[x].position.clone().setY(0).normalize(),E=this.vertices[w].position.clone().setY(0).normalize(),D=v[u][n].clone(),F=v[u+1][n].clone(),G=v[u+1][n+1].clone(),N=v[u][n+1].clone();this.faces.push(new THREE.Face4(e,t,x,w,[z,y,A,E]));this.faceVertexUvs[0].push([D,F,G,N])}if(!m&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(n=0;n<f;n++)e=p[0][n],t=p[0][n+
+1],x=this.vertices.length-1,z=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),D=v[0][n].clone(),F=v[0][n+1].clone(),G=new THREE.UV(F.u,0),this.faces.push(new THREE.Face3(e,t,x,[z,y,A])),this.faceVertexUvs[0].push([D,F,G])}if(!m&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(n=0;n<f;n++)e=p[u][n+1],t=p[u][n],x=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),D=v[u][n+1].clone(),F=v[u][n].clone(),
+G=new THREE.UV(F.u,1),this.faces.push(new THREE.Face3(e,t,x,[z,y,A])),this.faceVertexUvs[0].push([D,F,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,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,k=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);k.set(b.x-e.x,b.y-e.y);f=f.normalize();k=k.normalize();h.set(-f.y,f.x);m.set(k.y,-k.x);n.copy(b).addSelf(h);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
 THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,k=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);k.set(b.x-e.x,b.y-e.y);f=f.normalize();k=k.normalize();h.set(-f.y,f.x);m.set(k.y,-k.x);n.copy(b).addSelf(h);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
-n.copy(c).addSelf(h);o.copy(e).addSelf(m);h=f.dot(m);m=o.subSelf(n).dot(m);h==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=h;if(m<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(C=b.length;--C>=0;){ma=C;da=C-1;da<0&&(da=b.length-
-1);for(var c=0,e=w+v*2,c=0;c<e;c++){var f=ea*c,k=ea*(c+1),h=$+ma+f,m=$+ma+k,o=h,f=$+da+f,k=$+da+k,p=m;o+=Z;f+=Z;k+=Z;p+=Z;K.faces.push(new THREE.Face4(o,f,k,p,null,null,I));I&&(o=c/e,f=(c+1)/e,k=n+u*2,h=(K.vertices[h].position.z+u)/k,m=(K.vertices[m].position.z+u)/k,K.faceVertexUvs[0].push([new THREE.UV(h,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(h,f)]))}}}function m(b,c,e){K.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function k(b,c,e){b+=Z;c+=Z;e+=Z;K.faces.push(new THREE.Face3(b,
-c,e,null,null,G));if(G){var f=N.maxY,k=N.maxX,h=K.vertices[c].position.x,c=K.vertices[c].position.y,m=K.vertices[e].position.x,e=K.vertices[e].position.y;K.faceVertexUvs[0].push([new THREE.UV(K.vertices[b].position.x/k,K.vertices[b].position.y/f),new THREE.UV(h/k,c/f),new THREE.UV(m/k,e/f)])}}var n=c.amount!==void 0?c.amount:100,u=c.bevelThickness!==void 0?c.bevelThickness:6,p=c.bevelSize!==void 0?c.bevelSize:u-2,v=c.bevelSegments!==void 0?c.bevelSegments:3,t=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,x=c.curveSegments!==void 0?c.curveSegments:12,w=c.steps!==void 0?c.steps:1,z=c.bendPath,y=c.extrudePath,A,E=!1,D=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,G=c.material,I=c.extrudeMaterial,N=this.shapebb;if(y)A=y.getPoints(x),w=A.length,E=!0,t=!1;t||(p=u=v=0);var P,J,H,K=this,Z=this.vertices.length;z&&b.addWrapPath(z);x=D?b.extractAllSpacedPoints(x):b.extractAllPoints(x);z=x.shape;x=x.holes;if(y=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();J=0;for(H=x.length;J<H;J++)P=x[J],THREE.Shape.Utils.isClockWise(P)&&
-(x[J]=P.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(z,x);D=z;J=0;for(H=x.length;J<H;J++)P=x[J],z=z.concat(P);var C,R,O,V,W,o,ea=z.length,S=y.length,ta=[];C=0;R=D.length;ma=R-1;for(da=C+1;C<R;C++,ma++,da++)ma==R&&(ma=0),da==R&&(da=0),ta[C]=f(D[C],D[ma],D[da]);var aa=[],ka,ja=ta.concat();J=0;for(H=x.length;J<H;J++){P=x[J];ka=[];C=0;R=P.length;ma=R-1;for(da=C+1;C<R;C++,ma++,da++)ma==R&&(ma=0),da==R&&(da=0),ka[C]=f(P[C],P[ma],P[da]);aa.push(ka);ja=ja.concat(ka)}for(O=0;O<v;O++){V=O/v;W=u*(1-
-V);V=p*Math.sin(V*Math.PI/2);C=0;for(R=D.length;C<R;C++)o=e(D[C],ta[C],V),m(o.x,o.y,-W);J=0;for(H=x.length;J<H;J++){P=x[J];ka=aa[J];C=0;for(R=P.length;C<R;C++)o=e(P[C],ka[C],V),m(o.x,o.y,-W)}}V=p;for(C=0;C<ea;C++)o=t?e(z[C],ja[C],V):z[C],E?m(o.x,o.y+A[0].y,A[0].x):m(o.x,o.y,0);for(O=1;O<=w;O++)for(C=0;C<ea;C++)o=t?e(z[C],ja[C],V):z[C],E?m(o.x,o.y+A[O-1].y,A[O-1].x):m(o.x,o.y,n/w*O);for(O=v-1;O>=0;O--){V=O/v;W=u*(1-V);V=p*Math.sin(V*Math.PI/2);C=0;for(R=D.length;C<R;C++)o=e(D[C],ta[C],V),m(o.x,o.y,
-n+W);J=0;for(H=x.length;J<H;J++){P=x[J];ka=aa[J];C=0;for(R=P.length;C<R;C++)o=e(P[C],ka[C],V),E?m(o.x,o.y+A[w-1].y,A[w-1].x+W):m(o.x,o.y,n+W)}}if(t){t=ea*0;for(C=0;C<S;C++)p=y[C],k(p[2]+t,p[1]+t,p[0]+t);t=ea*(w+v*2);for(C=0;C<S;C++)p=y[C],k(p[0]+t,p[1]+t,p[2]+t)}else{for(C=0;C<S;C++)p=y[C],k(p[2],p[1],p[0]);for(C=0;C<S;C++)p=y[C],k(p[0]+ea*w,p[1]+ea*w,p[2]+ea*w)}var ma,da,$=0;h(D);$+=D.length;J=0;for(H=x.length;J<H;J++)P=x[J],h(P),$+=P.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+n.copy(c).addSelf(h);o.copy(e).addSelf(m);h=f.dot(m);m=o.subSelf(n).dot(m);h==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=h;if(m<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(C=b.length;--C>=0;){ma=C;ea=C-1;ea<0&&(ea=b.length-
+1);for(var c=0,e=w+v*2,c=0;c<e;c++){var f=fa*c,k=fa*(c+1),h=Y+ma+f,m=Y+ma+k,o=h,f=Y+ea+f,k=Y+ea+k,p=m;o+=X;f+=X;k+=X;p+=X;M.faces.push(new THREE.Face4(o,f,k,p,null,null,G));G&&(o=c/e,f=(c+1)/e,k=n+u*2,h=(M.vertices[h].position.z+u)/k,m=(M.vertices[m].position.z+u)/k,M.faceVertexUvs[0].push([new THREE.UV(h,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(h,f)]))}}}function m(b,c,e){M.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function k(b,c,e){b+=X;c+=X;e+=X;M.faces.push(new THREE.Face3(b,
+c,e,null,null,F));if(F){var f=N.maxY,k=N.maxX,h=M.vertices[c].position.x,c=M.vertices[c].position.y,m=M.vertices[e].position.x,e=M.vertices[e].position.y;M.faceVertexUvs[0].push([new THREE.UV(M.vertices[b].position.x/k,M.vertices[b].position.y/f),new THREE.UV(h/k,c/f),new THREE.UV(m/k,e/f)])}}var n=c.amount!==void 0?c.amount:100,u=c.bevelThickness!==void 0?c.bevelThickness:6,p=c.bevelSize!==void 0?c.bevelSize:u-2,v=c.bevelSegments!==void 0?c.bevelSegments:3,t=c.bevelEnabled!==void 0?c.bevelEnabled:
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,w=c.steps!==void 0?c.steps:1,z=c.bendPath,y=c.extrudePath,A,E=!1,D=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,F=c.material,G=c.extrudeMaterial,N=this.shapebb;if(y)A=y.getPoints(x),w=A.length,E=!0,t=!1;t||(p=u=v=0);var Q,K,H,M=this,X=this.vertices.length;z&&b.addWrapPath(z);x=D?b.extractAllSpacedPoints(x):b.extractAllPoints(x);z=x.shape;x=x.holes;if(y=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();K=0;for(H=x.length;K<H;K++)Q=x[K],THREE.Shape.Utils.isClockWise(Q)&&
+(x[K]=Q.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(z,x);D=z;K=0;for(H=x.length;K<H;K++)Q=x[K],z=z.concat(Q);var C,O,P,U,V,o,fa=z.length,S=y.length,ta=[];C=0;O=D.length;ma=O-1;for(ea=C+1;C<O;C++,ma++,ea++)ma==O&&(ma=0),ea==O&&(ea=0),ta[C]=f(D[C],D[ma],D[ea]);var aa=[],la,ka=ta.concat();K=0;for(H=x.length;K<H;K++){Q=x[K];la=[];C=0;O=Q.length;ma=O-1;for(ea=C+1;C<O;C++,ma++,ea++)ma==O&&(ma=0),ea==O&&(ea=0),la[C]=f(Q[C],Q[ma],Q[ea]);aa.push(la);ka=ka.concat(la)}for(P=0;P<v;P++){U=P/v;V=u*(1-
+U);U=p*Math.sin(U*Math.PI/2);C=0;for(O=D.length;C<O;C++)o=e(D[C],ta[C],U),m(o.x,o.y,-V);K=0;for(H=x.length;K<H;K++){Q=x[K];la=aa[K];C=0;for(O=Q.length;C<O;C++)o=e(Q[C],la[C],U),m(o.x,o.y,-V)}}U=p;for(C=0;C<fa;C++)o=t?e(z[C],ka[C],U):z[C],E?m(o.x,o.y+A[0].y,A[0].x):m(o.x,o.y,0);for(P=1;P<=w;P++)for(C=0;C<fa;C++)o=t?e(z[C],ka[C],U):z[C],E?m(o.x,o.y+A[P-1].y,A[P-1].x):m(o.x,o.y,n/w*P);for(P=v-1;P>=0;P--){U=P/v;V=u*(1-U);U=p*Math.sin(U*Math.PI/2);C=0;for(O=D.length;C<O;C++)o=e(D[C],ta[C],U),m(o.x,o.y,
+n+V);K=0;for(H=x.length;K<H;K++){Q=x[K];la=aa[K];C=0;for(O=Q.length;C<O;C++)o=e(Q[C],la[C],U),E?m(o.x,o.y+A[w-1].y,A[w-1].x+V):m(o.x,o.y,n+V)}}if(t){t=fa*0;for(C=0;C<S;C++)p=y[C],k(p[2]+t,p[1]+t,p[0]+t);t=fa*(w+v*2);for(C=0;C<S;C++)p=y[C],k(p[0]+t,p[1]+t,p[2]+t)}else{for(C=0;C<S;C++)p=y[C],k(p[2],p[1],p[0]);for(C=0;C<S;C++)p=y[C],k(p[0]+fa*w,p[1]+fa*w,p[2]+fa*w)}var ma,ea,Y=0;h(D);Y+=D.length;K=0;for(H=x.length;K<H;K++)Q=x[K],h(Q),Y+=Q.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=h.vertices[b].position,k=h.vertices[e].position;return c((f.x+k.x)/2,(f.y+k.y)/2,(f.z+k.z)/2)}var h=this,m=new THREE.Geometry;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
 THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=h.vertices[b].position,k=h.vertices[e].position;return c((f.x+k.x)/2,(f.y+k.y)/2,(f.z+k.z)/2)}var h=this,m=new THREE.Geometry;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
 -b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,m);e(0,5,1,m);e(0,1,7,m);e(0,7,10,m);e(0,10,11,m);e(1,5,9,m);e(5,11,4,m);e(11,10,2,m);e(10,7,6,m);e(7,1,8,m);e(3,9,4,m);e(3,4,2,m);e(3,2,6,m);e(3,6,8,m);e(3,8,9,m);e(4,9,5,m);e(2,4,11,m);e(6,2,10,m);e(8,6,7,m);e(9,8,1,m);for(var k=0;k<this.subdivisions;k++){var b=new THREE.Geometry,n;for(n in m.faces){var u=f(m.faces[n].a,m.faces[n].b),p=f(m.faces[n].b,m.faces[n].c),v=f(m.faces[n].c,m.faces[n].a);e(m.faces[n].a,u,v,b);e(m.faces[n].b,p,
 -b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,m);e(0,5,1,m);e(0,1,7,m);e(0,7,10,m);e(0,10,11,m);e(1,5,9,m);e(5,11,4,m);e(11,10,2,m);e(10,7,6,m);e(7,1,8,m);e(3,9,4,m);e(3,4,2,m);e(3,2,6,m);e(3,6,8,m);e(3,8,9,m);e(4,9,5,m);e(2,4,11,m);e(6,2,10,m);e(8,6,7,m);e(9,8,1,m);for(var k=0;k<this.subdivisions;k++){var b=new THREE.Geometry,n;for(n in m.faces){var u=f(m.faces[n].a,m.faces[n].b),p=f(m.faces[n].b,m.faces[n].c),v=f(m.faces[n].c,m.faces[n].a);e(m.faces[n].a,u,v,b);e(m.faces[n].b,p,
@@ -512,8 +512,8 @@ THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:
 this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),m=h.length,k=[],b=0;b<m;b++){var n=new THREE.Path,n=this.extractGlyphPoints(h[b],c,e,f,n);f+=n.offset;k.push(n.path)}return{paths:k,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var m=[],k,n,u,p,v,t,x,w,z,y,A=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));u=c.length;for(b=0;b<u;)switch(n=c[b++],n){case "m":n=c[b++]*e+f;p=c[b++]*e;m.push(new THREE.Vector2(n,
 this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),m=h.length,k=[],b=0;b<m;b++){var n=new THREE.Path,n=this.extractGlyphPoints(h[b],c,e,f,n);f+=n.offset;k.push(n.path)}return{paths:k,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var m=[],k,n,u,p,v,t,x,w,z,y,A=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));u=c.length;for(b=0;b<u;)switch(n=c[b++],n){case "m":n=c[b++]*e+f;p=c[b++]*e;m.push(new THREE.Vector2(n,
 p));h.moveTo(n,p);break;case "l":n=c[b++]*e+f;p=c[b++]*e;m.push(new THREE.Vector2(n,p));h.lineTo(n,p);break;case "q":n=c[b++]*e+f;p=c[b++]*e;x=c[b++]*e+f;w=c[b++]*e;h.quadraticCurveTo(x,w,n,p);if(k=m[m.length-1]){v=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var E=k/divisions,D=THREE.Shape.Utils.b2(E,v,x,n),E=THREE.Shape.Utils.b2(E,t,w,p);m.push(new THREE.Vector2(D,E))}}break;case "b":if(n=c[b++]*e+f,p=c[b++]*e,x=c[b++]*e+f,w=c[b++]*-e,z=c[b++]*e+f,y=c[b++]*-e,h.bezierCurveTo(n,p,
 p));h.moveTo(n,p);break;case "l":n=c[b++]*e+f;p=c[b++]*e;m.push(new THREE.Vector2(n,p));h.lineTo(n,p);break;case "q":n=c[b++]*e+f;p=c[b++]*e;x=c[b++]*e+f;w=c[b++]*e;h.quadraticCurveTo(x,w,n,p);if(k=m[m.length-1]){v=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var E=k/divisions,D=THREE.Shape.Utils.b2(E,v,x,n),E=THREE.Shape.Utils.b2(E,t,w,p);m.push(new THREE.Vector2(D,E))}}break;case "b":if(n=c[b++]*e+f,p=c[b++]*e,x=c[b++]*e+f,w=c[b++]*-e,z=c[b++]*e+f,y=c[b++]*-e,h.bezierCurveTo(n,p,
 x,w,z,y),k=m[m.length-1]){v=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)E=k/divisions,D=THREE.Shape.Utils.b3(E,v,x,z,n),E=THREE.Shape.Utils.b3(E,t,w,y,p),m.push(new THREE.Vector2(D,E))}}}return{offset:A.ha*e,points:m,path:h}}}};
 x,w,z,y),k=m[m.length-1]){v=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)E=k/divisions,D=THREE.Shape.Utils.b3(E,v,x,z,n),E=THREE.Shape.Utils.b3(E,t,w,y,p),m.push(new THREE.Vector2(D,E))}}}return{offset:A.ha*e,points:m,path:h}}}};
-(function(b){var c=function(b){for(var c=b.length,h=0,m=c-1,k=0;k<c;m=k++)h+=b[m].x*b[k].y-b[k].x*b[m].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var m=[],k=[],n=[],u,p,v;if(c(b)>0)for(p=0;p<h;p++)k[p]=p;else for(p=0;p<h;p++)k[p]=h-1-p;var t=2*h;for(p=h-1;h>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}u=p;h<=u&&(u=0);p=u+1;h<=p&&(p=0);v=p+1;h<=v&&(v=0);var x;a:{x=b;var w=u,z=p,y=v,A=h,E=k,D=void 0,G=void 0,I=void 0,
-N=void 0,P=void 0,J=void 0,H=void 0,K=void 0,Z=void 0,G=x[E[w]].x,I=x[E[w]].y,N=x[E[z]].x,P=x[E[z]].y,J=x[E[y]].x,H=x[E[y]].y;if(1.0E-10>(N-G)*(H-I)-(P-I)*(J-G))x=!1;else{for(D=0;D<A;D++)if(!(D==w||D==z||D==y)){var K=x[E[D]].x,Z=x[E[D]].y,C=void 0,R=void 0,O=void 0,V=void 0,W=void 0,o=void 0,ea=void 0,S=void 0,ta=void 0,aa=void 0,ka=void 0,ja=void 0,C=O=W=void 0,C=J-N,R=H-P,O=G-J,V=I-H,W=N-G,o=P-I,ea=K-G,S=Z-I,ta=K-N,aa=Z-P,ka=K-J,ja=Z-H,C=C*aa-R*ta,W=W*S-o*ea,O=O*ja-V*ka;if(C>=0&&O>=0&&W>=0){x=!1;
+(function(b){var c=function(b){for(var c=b.length,h=0,m=c-1,k=0;k<c;m=k++)h+=b[m].x*b[k].y-b[k].x*b[m].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var m=[],k=[],n=[],u,p,v;if(c(b)>0)for(p=0;p<h;p++)k[p]=p;else for(p=0;p<h;p++)k[p]=h-1-p;var t=2*h;for(p=h-1;h>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}u=p;h<=u&&(u=0);p=u+1;h<=p&&(p=0);v=p+1;h<=v&&(v=0);var x;a:{x=b;var w=u,z=p,y=v,A=h,E=k,D=void 0,F=void 0,G=void 0,
+N=void 0,Q=void 0,K=void 0,H=void 0,M=void 0,X=void 0,F=x[E[w]].x,G=x[E[w]].y,N=x[E[z]].x,Q=x[E[z]].y,K=x[E[y]].x,H=x[E[y]].y;if(1.0E-10>(N-F)*(H-G)-(Q-G)*(K-F))x=!1;else{for(D=0;D<A;D++)if(!(D==w||D==z||D==y)){var M=x[E[D]].x,X=x[E[D]].y,C=void 0,O=void 0,P=void 0,U=void 0,V=void 0,o=void 0,fa=void 0,S=void 0,ta=void 0,aa=void 0,la=void 0,ka=void 0,C=P=V=void 0,C=K-N,O=H-Q,P=F-K,U=G-H,V=N-F,o=Q-G,fa=M-F,S=X-G,ta=M-N,aa=X-Q,la=M-K,ka=X-H,C=C*aa-O*ta,V=V*S-o*fa,P=P*ka-U*la;if(C>=0&&P>=0&&V>=0){x=!1;
 break a}}x=!0}}if(x){m.push([b[k[u]],b[k[p]],b[k[v]]]);n.push([k[u],k[p],k[v]]);u=p;for(v=p+1;v<h;u++,v++)k[u]=k[v];h--;t=2*h}}if(f)return n;return m};b.Triangulate.area=c;return b})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 break a}}x=!0}}if(x){m.push([b[k[u]],b[k[p]],b[k[v]]]);n.push([k[u],k[p],k[v]]);u=p;for(v=p+1;v<h;u++,v++)k[u]=k[v];h--;t=2*h}}if(f)return n;return m};b.Triangulate.area=c;return b})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(b,c,e,f,h){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=h||Math.PI*2;h=new THREE.Vector3;b=[];c=[];for(e=0;e<=this.segmentsR;e++)for(f=0;f<=this.segmentsT;f++){var m=f/this.segmentsT*this.arc,k=e/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(m);h.y=this.radius*Math.sin(m);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(k))*Math.cos(m);n.y=(this.radius+this.tube*Math.cos(k))*Math.sin(m);n.z=
 THREE.TorusGeometry=function(b,c,e,f,h){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=h||Math.PI*2;h=new THREE.Vector3;b=[];c=[];for(e=0;e<=this.segmentsR;e++)for(f=0;f<=this.segmentsT;f++){var m=f/this.segmentsT*this.arc,k=e/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(m);h.y=this.radius*Math.sin(m);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(k))*Math.cos(m);n.y=(this.radius+this.tube*Math.cos(k))*Math.sin(m);n.z=
 this.tube*Math.sin(k);this.vertices.push(new THREE.Vertex(n));b.push(new THREE.UV(f/this.segmentsT,1-e/this.segmentsR));c.push(n.clone().subSelf(h).normalize())}for(e=1;e<=this.segmentsR;e++)for(f=1;f<=this.segmentsT;f++){var h=(this.segmentsT+1)*e+f-1,m=(this.segmentsT+1)*(e-1)+f-1,k=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,u=new THREE.Face4(h,m,k,n,[c[h],c[m],c[k],c[n]]);u.normal.addSelf(c[h]);u.normal.addSelf(c[m]);u.normal.addSelf(c[k]);u.normal.addSelf(c[n]);u.normal.normalize();this.faces.push(u);
 this.tube*Math.sin(k);this.vertices.push(new THREE.Vertex(n));b.push(new THREE.UV(f/this.segmentsT,1-e/this.segmentsR));c.push(n.clone().subSelf(h).normalize())}for(e=1;e<=this.segmentsR;e++)for(f=1;f<=this.segmentsT;f++){var h=(this.segmentsT+1)*e+f-1,m=(this.segmentsT+1)*(e-1)+f-1,k=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,u=new THREE.Face4(h,m,k,n,[c[h],c[m],c[k],c[n]]);u.normal.addSelf(c[h]);u.normal.addSelf(c[m]);u.normal.addSelf(c[k]);u.normal.addSelf(c[n]);u.normal.normalize();this.faces.push(u);
@@ -536,109 +536,109 @@ c.postMessage(b)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,m){var k=new XMLHttpRequest,n=f+"/"+b,u=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,e,h,c):alert("Couldn't load ["+n+"] ["+k.status+"]"):k.readyState==3?m&&(u==0&&(u=k.getResponseHeader("Content-Length")),m({total:u,loaded:k.responseText.length})):k.readyState==2&&(u=k.getResponseHeader("Content-Length"))};k.open("GET",n,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,m){var k=new XMLHttpRequest,n=f+"/"+b,u=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,e,h,c):alert("Couldn't load ["+n+"] ["+k.status+"]"):k.readyState==3?m&&(u==0&&(u=k.getResponseHeader("Content-Length")),m({total:u,loaded:k.responseText.length})):k.readyState==2&&(u=k.getResponseHeader("Content-Length"))};k.open("GET",n,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
 k.setRequestHeader("Content-Type","text/plain");k.send(null)};
 k.setRequestHeader("Content-Type","text/plain");k.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(c){function e(b,c){var f=v(b,c),h=v(b,c+1),k=v(b,c+2),m=v(b,c+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,c){var e=v(b,c),f=v(b,c+1),k=v(b,c+2);return(v(b,c+3)<<24)+(k<<16)+(f<<8)+e}function u(b,c){var e=v(b,c);return(v(b,c+1)<<8)+e}function p(b,c){var e=v(b,c);return e>127?e-256:e}function v(b,c){return b.charCodeAt(c)&255}function t(c){var e,
 THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(c){function e(b,c){var f=v(b,c),h=v(b,c+1),k=v(b,c+2),m=v(b,c+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,c){var e=v(b,c),f=v(b,c+1),k=v(b,c+2);return(v(b,c+3)<<24)+(k<<16)+(f<<8)+e}function u(b,c){var e=v(b,c);return(v(b,c+1)<<8)+e}function p(b,c){var e=v(b,c);return e>127?e-256:e}function v(b,c){return b.charCodeAt(c)&255}function t(c){var e,
-f,k;e=h(b,c);f=h(b,c+P);k=h(b,c+J);c=u(b,c+H);E.faces.push(new THREE.Face3(e,f,k,null,null,E.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+P);k=h(b,c+J);m=u(b,c+H);o=h(b,c+K);p=h(b,c+Z);c=h(b,c+C);m=E.materials[m];var t=I[p*3],v=I[p*3+1];p=I[p*3+2];var w=I[c*3],L=I[c*3+1],c=I[c*3+2];E.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(I[o*3],I[o*3+1],I[o*3+2]),new THREE.Vector3(t,v,p),new THREE.Vector3(w,L,c)],null,m))}function w(c){var e,f,k,m;e=h(b,c);f=h(b,c+R);k=h(b,c+O);m=h(b,
-c+V);c=u(b,c+W);E.faces.push(new THREE.Face4(e,f,k,m,null,null,E.materials[c]))}function z(c){var e,f,k,m,p,t,v,w;e=h(b,c);f=h(b,c+R);k=h(b,c+O);m=h(b,c+V);p=u(b,c+W);t=h(b,c+o);v=h(b,c+ea);w=h(b,c+S);c=h(b,c+ta);p=E.materials[p];var x=I[v*3],L=I[v*3+1];v=I[v*3+2];var y=I[w*3],X=I[w*3+1];w=I[w*3+2];var z=I[c*3],A=I[c*3+1],c=I[c*3+2];E.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(I[t*3],I[t*3+1],I[t*3+2]),new THREE.Vector3(x,L,v),new THREE.Vector3(y,X,w),new THREE.Vector3(z,A,c)],null,p))}
-function y(c){var e,f,k,m;e=h(b,c);f=h(b,c+aa);k=h(b,c+ka);c=N[e*2];m=N[e*2+1];e=N[f*2];var o=E.faceVertexUvs[0];f=N[f*2+1];var p=N[k*2];k=N[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function A(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ja);k=h(b,c+ma);m=h(b,c+da);c=N[e*2];o=N[e*2+1];e=N[f*2];p=N[f*2+1];f=N[k*2];var t=E.faceVertexUvs[0];k=N[k*2+1];var u=N[m*2];m=N[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f,
-k));v.push(new THREE.UV(u,m));t.push(v)}var E=this,D=0,G,I=[],N=[],P,J,H,K,Z,C,R,O,V,W,o,ea,S,ta,aa,ka,ja,ma,da,$,U,T,fa,na,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,c);G={signature:b.substr(D,8),header_bytes:v(b,D+8),vertex_coordinate_bytes:v(b,D+9),normal_coordinate_bytes:v(b,D+10),uv_coordinate_bytes:v(b,D+11),vertex_index_bytes:v(b,D+12),normal_index_bytes:v(b,D+13),uv_index_bytes:v(b,D+14),material_index_bytes:v(b,D+15),nvertices:h(b,D+16),nnormals:h(b,D+16+4),nuvs:h(b,
-D+16+8),ntri_flat:h(b,D+16+12),ntri_smooth:h(b,D+16+16),ntri_flat_uv:h(b,D+16+20),ntri_smooth_uv:h(b,D+16+24),nquad_flat:h(b,D+16+28),nquad_smooth:h(b,D+16+32),nquad_flat_uv:h(b,D+16+36),nquad_smooth_uv:h(b,D+16+40)};D+=G.header_bytes;P=G.vertex_index_bytes;J=G.vertex_index_bytes*2;H=G.vertex_index_bytes*3;K=G.vertex_index_bytes*3+G.material_index_bytes;Z=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes;C=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*2;R=G.vertex_index_bytes;
-O=G.vertex_index_bytes*2;V=G.vertex_index_bytes*3;W=G.vertex_index_bytes*4;o=G.vertex_index_bytes*4+G.material_index_bytes;ea=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes;S=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*2;ta=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*3;aa=G.uv_index_bytes;ka=G.uv_index_bytes*2;ja=G.uv_index_bytes;ma=G.uv_index_bytes*2;da=G.uv_index_bytes*3;c=G.vertex_index_bytes*3+G.material_index_bytes;sa=G.vertex_index_bytes*
-4+G.material_index_bytes;$=G.ntri_flat*c;U=G.ntri_smooth*(c+G.normal_index_bytes*3);T=G.ntri_flat_uv*(c+G.uv_index_bytes*3);fa=G.ntri_smooth_uv*(c+G.normal_index_bytes*3+G.uv_index_bytes*3);na=G.nquad_flat*sa;c=G.nquad_smooth*(sa+G.normal_index_bytes*4);sa=G.nquad_flat_uv*(sa+G.uv_index_bytes*4);D+=function(c){for(var f,h,m,n=G.vertex_coordinate_bytes*3,o=c+G.nvertices*n;c<o;c+=n)f=e(b,c),h=e(b,c+G.vertex_coordinate_bytes),m=e(b,c+G.vertex_coordinate_bytes*2),E.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
-h,m)));return G.nvertices*n}(D);D+=function(c){for(var e,f,h,k=G.normal_coordinate_bytes*3,m=c+G.nnormals*k;c<m;c+=k)e=p(b,c),f=p(b,c+G.normal_coordinate_bytes),h=p(b,c+G.normal_coordinate_bytes*2),I.push(e/127,f/127,h/127);return G.nnormals*k}(D);D+=function(c){for(var f,h,m=G.uv_coordinate_bytes*2,n=c+G.nuvs*m;c<n;c+=m)f=e(b,c),h=e(b,c+G.uv_coordinate_bytes),N.push(f,h);return G.nuvs*m}(D);$=D+$;U=$+U;T=U+T;fa=T+fa;na=fa+na;c=na+c;sa=c+sa;(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes,
-f=e+G.uv_index_bytes*3,h=b+G.ntri_flat_uv*f;for(c=b;c<h;c+=f)t(c),y(c+e);return h-b})(U);(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*3,f=e+G.uv_index_bytes*3,h=b+G.ntri_smooth_uv*f;for(c=b;c<h;c+=f)x(c),y(c+e);return h-b})(T);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes,f=e+G.uv_index_bytes*4,h=b+G.nquad_flat_uv*f;for(c=b;c<h;c+=f)w(c),A(c+e);return h-b})(c);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*
-4,f=e+G.uv_index_bytes*4,h=b+G.nquad_smooth_uv*f;for(c=b;c<h;c+=f)z(c),A(c+e);return h-b})(sa);(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes,f=b+G.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(D);(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*3,f=b+G.ntri_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})($);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes,f=b+G.nquad_flat*e;for(c=b;c<f;c+=e)w(c);return f-b})(fa);(function(b){var c,
-e=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*4,f=b+G.nquad_smooth*e;for(c=b;c<f;c+=e)z(c);return f-b})(na);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
-THREE.ColladaLoader=function(){function b(b,c,e){for(var b=$.evaluate(b,$,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new c).parse(h);if(h.id.length==0)h.id=e+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,c=-b,e=0,f;for(f in la)for(var h=la[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);c=Math.max(c,m.endTime);e=Math.max(e,m.input.length)}return{start:b,end:c,frames:e}}function e(b,c,f,h){b.world=b.world||
-new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=b.channels[0].sampler.output[f];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);c.push(b);for(h=0;h<b.nodes.length;h++)e(b.nodes[h],c,f,b.world)}function f(b,f,h){var k=ca[f.url];if(!k||!k.skin)console.log("could not find skin controller!");else if(!f.skeleton||!f.skeleton.length)console.log("could not find the skeleton for the skin!");else{var m=c(),f=T.getChildById(f.skeleton[0],!0)||T.getChildBySid(f.skeleton[0],
+f,k;e=h(b,c);f=h(b,c+Q);k=h(b,c+K);c=u(b,c+H);E.faces.push(new THREE.Face3(e,f,k,null,null,E.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+Q);k=h(b,c+K);m=u(b,c+H);o=h(b,c+M);p=h(b,c+X);c=h(b,c+C);m=E.materials[m];var t=G[p*3],v=G[p*3+1];p=G[p*3+2];var w=G[c*3],L=G[c*3+1],c=G[c*3+2];E.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(G[o*3],G[o*3+1],G[o*3+2]),new THREE.Vector3(t,v,p),new THREE.Vector3(w,L,c)],null,m))}function w(c){var e,f,k,m;e=h(b,c);f=h(b,c+O);k=h(b,c+P);m=h(b,
+c+U);c=u(b,c+V);E.faces.push(new THREE.Face4(e,f,k,m,null,null,E.materials[c]))}function z(c){var e,f,k,m,p,t,v,w;e=h(b,c);f=h(b,c+O);k=h(b,c+P);m=h(b,c+U);p=u(b,c+V);t=h(b,c+o);v=h(b,c+fa);w=h(b,c+S);c=h(b,c+ta);p=E.materials[p];var x=G[v*3],L=G[v*3+1];v=G[v*3+2];var y=G[w*3],W=G[w*3+1];w=G[w*3+2];var z=G[c*3],A=G[c*3+1],c=G[c*3+2];E.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(G[t*3],G[t*3+1],G[t*3+2]),new THREE.Vector3(x,L,v),new THREE.Vector3(y,W,w),new THREE.Vector3(z,A,c)],null,p))}
+function y(c){var e,f,k,m;e=h(b,c);f=h(b,c+aa);k=h(b,c+la);c=N[e*2];m=N[e*2+1];e=N[f*2];var o=E.faceVertexUvs[0];f=N[f*2+1];var p=N[k*2];k=N[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function A(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ka);k=h(b,c+ma);m=h(b,c+ea);c=N[e*2];o=N[e*2+1];e=N[f*2];p=N[f*2+1];f=N[k*2];var t=E.faceVertexUvs[0];k=N[k*2+1];var u=N[m*2];m=N[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f,
+k));v.push(new THREE.UV(u,m));t.push(v)}var E=this,D=0,F,G=[],N=[],Q,K,H,M,X,C,O,P,U,V,o,fa,S,ta,aa,la,ka,ma,ea,Y,T,Z,ga,na,va;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,c);F={signature:b.substr(D,8),header_bytes:v(b,D+8),vertex_coordinate_bytes:v(b,D+9),normal_coordinate_bytes:v(b,D+10),uv_coordinate_bytes:v(b,D+11),vertex_index_bytes:v(b,D+12),normal_index_bytes:v(b,D+13),uv_index_bytes:v(b,D+14),material_index_bytes:v(b,D+15),nvertices:h(b,D+16),nnormals:h(b,D+16+4),nuvs:h(b,
+D+16+8),ntri_flat:h(b,D+16+12),ntri_smooth:h(b,D+16+16),ntri_flat_uv:h(b,D+16+20),ntri_smooth_uv:h(b,D+16+24),nquad_flat:h(b,D+16+28),nquad_smooth:h(b,D+16+32),nquad_flat_uv:h(b,D+16+36),nquad_smooth_uv:h(b,D+16+40)};D+=F.header_bytes;Q=F.vertex_index_bytes;K=F.vertex_index_bytes*2;H=F.vertex_index_bytes*3;M=F.vertex_index_bytes*3+F.material_index_bytes;X=F.vertex_index_bytes*3+F.material_index_bytes+F.normal_index_bytes;C=F.vertex_index_bytes*3+F.material_index_bytes+F.normal_index_bytes*2;O=F.vertex_index_bytes;
+P=F.vertex_index_bytes*2;U=F.vertex_index_bytes*3;V=F.vertex_index_bytes*4;o=F.vertex_index_bytes*4+F.material_index_bytes;fa=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes;S=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes*2;ta=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes*3;aa=F.uv_index_bytes;la=F.uv_index_bytes*2;ka=F.uv_index_bytes;ma=F.uv_index_bytes*2;ea=F.uv_index_bytes*3;c=F.vertex_index_bytes*3+F.material_index_bytes;va=F.vertex_index_bytes*
+4+F.material_index_bytes;Y=F.ntri_flat*c;T=F.ntri_smooth*(c+F.normal_index_bytes*3);Z=F.ntri_flat_uv*(c+F.uv_index_bytes*3);ga=F.ntri_smooth_uv*(c+F.normal_index_bytes*3+F.uv_index_bytes*3);na=F.nquad_flat*va;c=F.nquad_smooth*(va+F.normal_index_bytes*4);va=F.nquad_flat_uv*(va+F.uv_index_bytes*4);D+=function(c){for(var f,h,m,n=F.vertex_coordinate_bytes*3,o=c+F.nvertices*n;c<o;c+=n)f=e(b,c),h=e(b,c+F.vertex_coordinate_bytes),m=e(b,c+F.vertex_coordinate_bytes*2),E.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
+h,m)));return F.nvertices*n}(D);D+=function(c){for(var e,f,h,k=F.normal_coordinate_bytes*3,m=c+F.nnormals*k;c<m;c+=k)e=p(b,c),f=p(b,c+F.normal_coordinate_bytes),h=p(b,c+F.normal_coordinate_bytes*2),G.push(e/127,f/127,h/127);return F.nnormals*k}(D);D+=function(c){for(var f,h,m=F.uv_coordinate_bytes*2,n=c+F.nuvs*m;c<n;c+=m)f=e(b,c),h=e(b,c+F.uv_coordinate_bytes),N.push(f,h);return F.nuvs*m}(D);Y=D+Y;T=Y+T;Z=T+Z;ga=Z+ga;na=ga+na;c=na+c;va=c+va;(function(b){var c,e=F.vertex_index_bytes*3+F.material_index_bytes,
+f=e+F.uv_index_bytes*3,h=b+F.ntri_flat_uv*f;for(c=b;c<h;c+=f)t(c),y(c+e);return h-b})(T);(function(b){var c,e=F.vertex_index_bytes*3+F.material_index_bytes+F.normal_index_bytes*3,f=e+F.uv_index_bytes*3,h=b+F.ntri_smooth_uv*f;for(c=b;c<h;c+=f)x(c),y(c+e);return h-b})(Z);(function(b){var c,e=F.vertex_index_bytes*4+F.material_index_bytes,f=e+F.uv_index_bytes*4,h=b+F.nquad_flat_uv*f;for(c=b;c<h;c+=f)w(c),A(c+e);return h-b})(c);(function(b){var c,e=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes*
+4,f=e+F.uv_index_bytes*4,h=b+F.nquad_smooth_uv*f;for(c=b;c<h;c+=f)z(c),A(c+e);return h-b})(va);(function(b){var c,e=F.vertex_index_bytes*3+F.material_index_bytes,f=b+F.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(D);(function(b){var c,e=F.vertex_index_bytes*3+F.material_index_bytes+F.normal_index_bytes*3,f=b+F.ntri_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(Y);(function(b){var c,e=F.vertex_index_bytes*4+F.material_index_bytes,f=b+F.nquad_flat*e;for(c=b;c<f;c+=e)w(c);return f-b})(ga);(function(b){var c,
+e=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes*4,f=b+F.nquad_smooth*e;for(c=b;c<f;c+=e)z(c);return f-b})(na);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
+THREE.ColladaLoader=function(){function b(b,c,e){for(var b=Y.evaluate(b,Y,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new c).parse(h);if(h.id.length==0)h.id=e+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,c=-b,e=0,f;for(f in J)for(var h=J[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);c=Math.max(c,m.endTime);e=Math.max(e,m.input.length)}return{start:b,end:c,frames:e}}function e(b,c,f,h){b.world=b.world||
+new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=b.channels[0].sampler.output[f];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);c.push(b);for(h=0;h<b.nodes.length;h++)e(b.nodes[h],c,f,b.world)}function f(b,f,h){var k=da[f.url];if(!k||!k.skin)console.log("could not find skin controller!");else if(!f.skeleton||!f.skeleton.length)console.log("could not find the skeleton for the skin!");else{var m=c(),f=Z.getChildById(f.skeleton[0],!0)||Z.getChildBySid(f.skeleton[0],
 !0),n,o,p,t,u=new THREE.Vector3,v;for(n=0;n<b.vertices.length;n++)k.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(h=0;h<m.frames;h++){var w=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));e(f,w,h);n=w;o=k.skin;for(t=0;t<n.length;t++){p=n[t];v=-1;for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];
 !0),n,o,p,t,u=new THREE.Vector3,v;for(n=0;n<b.vertices.length;n++)k.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(h=0;h<m.frames;h++){var w=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));e(f,w,h);n=w;o=k.skin;for(t=0;t<n.length;t++){p=n[t];v=-1;for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];
 for(y=0;y<o.weights.length;y++)for(var z=0;z<o.weights[y].length;z++){var A=o.weights[y][z];A.joint==v&&p.weights.push(A)}}else throw"could not find joint!";}for(n=0;n<w.length;n++)for(o=0;o<w[n].weights.length;o++)p=w[n].weights[o],t=p.index,p=p.weight,v=b.vertices[t],t=x[t],u.x=v.position.x,u.y=v.position.y,u.z=v.position.z,w[n].skinningMatrix.multiplyVector3(u),t.position.x+=u.x*p,t.position.y+=u.y*p,t.position.z+=u.z*p;b.morphTargets.push({name:"target_"+h,vertices:x})}}}function h(b){var c=new THREE.Object3D,
 for(y=0;y<o.weights.length;y++)for(var z=0;z<o.weights[y].length;z++){var A=o.weights[y][z];A.joint==v&&p.weights.push(A)}}else throw"could not find joint!";}for(n=0;n<w.length;n++)for(o=0;o<w[n].weights.length;o++)p=w[n].weights[o],t=p.index,p=p.weight,v=b.vertices[t],t=x[t],u.x=v.position.x,u.y=v.position.y,u.z=v.position.z,w[n].skinningMatrix.multiplyVector3(u),t.position.x+=u.x*p,t.position.y+=u.y*p,t.position.z+=u.z*p;b.morphTargets.push({name:"target_"+h,vertices:x})}}}function h(b){var c=new THREE.Object3D,
-e,k,m;c.name=b.id||"";c.matrixAutoUpdate=!1;c.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=ca[b.controllers[m].url];switch(n.type){case "skin":if(qa[n.skin.source]){var o=new z;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);e=b.controllers[m]}else if(ca[n.skin.source]&&(k=n=ca[n.skin.source],n.morph&&qa[n.morph.source]))o=new z,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(qa[n.morph.source])o=
-new z,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),k=b.controllers[m];console.log("DAE: morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=qa[n.url],p={},t=0,u;if(n&&n.mesh&&n.mesh.primitives){if(c.name.length==0)c.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=ra[ua[u.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;u=p[u.symbol]=
-v.material;t++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(t>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)t=n.faces[j],t.materials=[p[t.daeMaterial]]}if(e!==void 0)f(n,e),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=e.skeleton,o.skinController=ca[e.url],o.skinInstanceController=e,o.name="skin_"+Ba.length,Ba.push(o);else if(k!==void 0){p=n;t=k instanceof x?ca[k.url]:k;if(!t||!t.morph)console.log("could not find morph controller!");
-else{t=t.morph;for(v=0;v<t.targets.length;v++){var w=qa[t.targets[v]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:w.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+va.length;va.push(o)}else o=new THREE.Mesh(n,o);c.addChild(o)}}for(m=0;m<b.nodes.length;m++)c.addChild(h(b.nodes[m],b));return c}function m(){this.init_from=
+e,k,m;c.name=b.id||"";c.matrixAutoUpdate=!1;c.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=da[b.controllers[m].url];switch(n.type){case "skin":if(qa[n.skin.source]){var o=new z;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);e=b.controllers[m]}else if(da[n.skin.source]&&(k=n=da[n.skin.source],n.morph&&qa[n.morph.source]))o=new z,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(qa[n.morph.source])o=
+new z,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),k=b.controllers[m];console.log("DAE: morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=qa[n.url],p={},t=0,u;if(n&&n.mesh&&n.mesh.primitives){if(c.name.length==0)c.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=sa[ua[u.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;u=p[u.symbol]=
+v.material;t++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(t>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)t=n.faces[j],t.materials=[p[t.daeMaterial]]}if(e!==void 0)f(n,e),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=e.skeleton,o.skinController=da[e.url],o.skinInstanceController=e,o.name="skin_"+pa.length,pa.push(o);else if(k!==void 0){p=n;t=k instanceof x?da[k.url]:k;if(!t||!t.morph)console.log("could not find morph controller!");
+else{t=t.morph;for(v=0;v<t.targets.length;v++){var w=qa[t.targets[v]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:w.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+Da.length;Da.push(o)}else o=new THREE.Mesh(n,o);c.addChild(o)}}for(m=0;m<b.nodes.length;m++)c.addChild(h(b.nodes[m],b));return c}function m(){this.init_from=
 this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function u(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function p(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function v(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function t(){this.type=
 this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function u(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function p(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function v(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function t(){this.type=
-this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function w(){this.target=this.symbol=""}function z(){this.url="";this.instance_material=[]}function y(){this.id="";this.mesh=null}function A(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function E(){}function D(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function G(){this.source="";
-this.stride=this.count=0;this.params=[]}function I(){this.input={}}function N(){this.semantic="";this.offset=0;this.source="";this.set=0}function P(b){this.id=b;this.type=null}function J(){this.name=this.id="";this.instance_effect=null}function H(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(b,c){this.type=b;this.effect=c;this.material=null}function Z(b){this.effect=b;this.format=this.init_from=
-null}function C(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function R(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function O(){this.url=""}function V(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function W(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
-this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ea(b){var c=b.getAttribute("id");if(na[c]!=void 0)return na[c];na[c]=(new P(c)).parse(b);return na[c]}function S(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function ta(b){for(var b=ka(b),c=[],e=0;e<b.length;e++)c.push(parseFloat(b[e]));return c}function aa(b){for(var b=ka(b),c=[],e=0;e<b.length;e++)c.push(parseInt(b[e],10));return c}function ka(b){return b.replace(/^\s+/,"").replace(/\s+$/,
-"").split(/\s+/)}function ja(b,c,e){return b.hasAttribute(c)?parseInt(b.getAttribute(c),10):e}function ma(b,c){if(b===void 0){for(var e="0.";e.length<c+2;)e+="0";return e}c=c||2;e=b.toString().split(".");for(e[1]=e.length>1?e[1].substr(0,c):"0";e[1].length<c;)e[1]+="0";return e.join(".")}function da(b,c){var e="";e+=ma(b.x,c)+",";e+=ma(b.y,c)+",";e+=ma(b.z,c);return e}var $=null,U=null,T,fa=null,na={},sa={},la={},ca={},qa={},ua={},ra={},ya,Ca,va,Ba,Ea=THREE.SmoothShading;m.prototype.parse=function(b){this.id=
+this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function w(){this.target=this.symbol=""}function z(){this.url="";this.instance_material=[]}function y(){this.id="";this.mesh=null}function A(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function E(){}function D(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function F(){this.source="";
+this.stride=this.count=0;this.params=[]}function G(){this.input={}}function N(){this.semantic="";this.offset=0;this.source="";this.set=0}function Q(b){this.id=b;this.type=null}function K(){this.name=this.id="";this.instance_effect=null}function H(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function M(b,c){this.type=b;this.effect=c;this.material=null}function X(b){this.effect=b;this.format=this.init_from=
+null}function C(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function O(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function P(){this.url=""}function U(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function V(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
+this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function fa(b){var c=b.getAttribute("id");if(na[c]!=void 0)return na[c];na[c]=(new Q(c)).parse(b);return na[c]}function S(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function ta(b){for(var b=la(b),c=[],e=0;e<b.length;e++)c.push(parseFloat(b[e]));return c}function aa(b){for(var b=la(b),c=[],e=0;e<b.length;e++)c.push(parseInt(b[e],10));return c}function la(b){return b.replace(/^\s+/,"").replace(/\s+$/,
+"").split(/\s+/)}function ka(b,c,e){return b.hasAttribute(c)?parseInt(b.getAttribute(c),10):e}function ma(b,c){if(b===void 0){for(var e="0.";e.length<c+2;)e+="0";return e}c=c||2;e=b.toString().split(".");for(e[1]=e.length>1?e[1].substr(0,c):"0";e[1].length<c;)e[1]+="0";return e.join(".")}function ea(b,c){var e="";e+=ma(b.x,c)+",";e+=ma(b.y,c)+",";e+=ma(b.z,c);return e}var Y=null,T=null,Z,ga=null,na={},va={},J={},da={},qa={},ua={},sa={},xa,Ea,Da,pa,Ga=THREE.SmoothShading;m.prototype.parse=function(b){this.id=
 b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName=="init_from")this.init_from=e.textContent}return this};k.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "skin":this.skin=(new u).parse(e);this.type=e.nodeName;break;case "morph":this.morph=(new n).parse(e),this.type=e.nodeName}}return this};n.prototype.parse=function(b){var c=
 b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName=="init_from")this.init_from=e.textContent}return this};k.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "skin":this.skin=(new u).parse(e);this.type=e.nodeName;break;case "morph":this.morph=(new n).parse(e),this.type=e.nodeName}}return this};n.prototype.parse=function(b){var c=
-{},e=[],f;this.method=b.getAttribute("method");this.source=b.getAttribute("source").replace(/^#/,"");for(f=0;f<b.childNodes.length;f++){var h=b.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new P).parse(h);c[h.id]=h;break;case "targets":e=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<e.length;f++)switch(b=e[f],h=c[b.source],b.semantic){case "MORPH_TARGET":this.targets=h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};n.prototype.parseInputs=
+{},e=[],f;this.method=b.getAttribute("method");this.source=b.getAttribute("source").replace(/^#/,"");for(f=0;f<b.childNodes.length;f++){var h=b.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new Q).parse(h);c[h.id]=h;break;case "targets":e=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<e.length;f++)switch(b=e[f],h=c[b.source],b.semantic){case "MORPH_TARGET":this.targets=h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};n.prototype.parseInputs=
 function(b){for(var c=[],e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "input":c.push((new N).parse(f))}}return c};u.prototype.parse=function(b){var c={},e,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=ta(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],
 function(b){for(var c=[],e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "input":c.push((new N).parse(f))}}return c};u.prototype.parse=function(b){var c={},e,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=ta(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],
-k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15]);break;case "source":k=(new P).parse(k);c[k.id]=k;break;case "joints":e=k;break;case "vertex_weights":f=k;break;default:console.log(k.nodeName)}}this.parseJoints(e,c);this.parseWeights(f,c);return this};u.prototype.parseJoints=function(b,c){for(var e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "input":var f=(new N).parse(f),h=c[f.source];if(f.semantic=="JOINT")this.joints=
+k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15]);break;case "source":k=(new Q).parse(k);c[k.id]=k;break;case "joints":e=k;break;case "vertex_weights":f=k;break;default:console.log(k.nodeName)}}this.parseJoints(e,c);this.parseWeights(f,c);return this};u.prototype.parseJoints=function(b,c){for(var e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "input":var f=(new N).parse(f),h=c[f.source];if(f.semantic=="JOINT")this.joints=
 h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};u.prototype.parseWeights=function(b,c){for(var e,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new N).parse(m));break;case "v":e=aa(m.textContent);break;case "vcount":f=aa(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],p=0;p<n;p++){for(var t={},u=0;u<h.length;u++){var v=h[u],w=e[m+v.offset];switch(v.semantic){case "JOINT":t.joint=w;break;
 h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};u.prototype.parseWeights=function(b,c){for(var e,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new N).parse(m));break;case "v":e=aa(m.textContent);break;case "vcount":f=aa(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],p=0;p<n;p++){for(var t={},u=0;u<h.length;u++){var v=h[u],w=e[m+v.offset];switch(v.semantic){case "JOINT":t.joint=w;break;
 case "WEIGHT":t.weight=c[v.source].data[w]}}o.push(t);m+=h.length}for(p=0;p<o.length;p++)o[p].index=k;this.weights.push(o)}};p.prototype.getChildById=function(b,c){for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildById(b,c);if(f)return f}return null};p.prototype.getChildBySid=function(b,c){for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildBySid(b,c);if(f)return f}return null};p.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");
 case "WEIGHT":t.weight=c[v.source].data[w]}}o.push(t);m+=h.length}for(p=0;p<o.length;p++)o[p].index=k;this.weights.push(o)}};p.prototype.getChildById=function(b,c){for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildById(b,c);if(f)return f}return null};p.prototype.getChildBySid=function(b,c){for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildBySid(b,c);if(f)return f}return null};p.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");
 this.nodes=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new v).parse(e))}}return this};v.prototype.getChannelForTransform=function(b){for(var c=0;c<this.channels.length;c++){var e=this.channels[c],f=e.target.split("/");f.shift();var h=f.shift(),k=h.indexOf(".")>=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,
 this.nodes=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new v).parse(e))}}return this};v.prototype.getChannelForTransform=function(b){for(var c=0;c<this.channels.length;c++){var e=this.channels[c],f=e.target.split("/");f.shift();var h=f.shift(),k=h.indexOf(".")>=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,
 ""))}if(h==b)return e.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},e}return null};v.prototype.getChildById=function(b,c){if(this.id==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildById(b,c);if(f)return f}return null};v.prototype.getChildBySid=function(b,c){if(this.sid==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildBySid(b,c);if(f)return f}return null};v.prototype.getTransformBySid=function(b){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==
 ""))}if(h==b)return e.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},e}return null};v.prototype.getChildById=function(b,c){if(this.id==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildById(b,c);if(f)return f}return null};v.prototype.getChildBySid=function(b,c){if(this.sid==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildBySid(b,c);if(f)return f}return null};v.prototype.getTransformBySid=function(b){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==
 b)return this.transforms[c];return null};v.prototype.parse=function(b){var c;this.id=b.getAttribute("id");this.sid=b.getAttribute("sid");this.name=b.getAttribute("name");this.type=b.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var e=0;e<b.childNodes.length;e++)if(c=b.childNodes[e],c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new v).parse(c));break;case "instance_camera":break;
 b)return this.transforms[c];return null};v.prototype.parse=function(b){var c;this.id=b.getAttribute("id");this.sid=b.getAttribute("sid");this.name=b.getAttribute("name");this.type=b.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var e=0;e<b.childNodes.length;e++)if(c=b.childNodes[e],c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new v).parse(c));break;case "instance_camera":break;
-case "instance_controller":this.controllers.push((new x).parse(c));break;case "instance_geometry":this.geometries.push((new z).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=$.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",$,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new v).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new t).parse(c));
-break;case "extra":break;default:console.log(c.nodeName)}b=[];e=1E6;c=-1E6;for(var f in la)for(var h=la[f],k=0;k<h.channel.length;k++){var m=h.channel[k],n=h.sampler[k];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,e=Math.min(e,n.startTime),c=Math.max(c,n.endTime),b.push(m)}if(b.length)this.startTime=e,this.endTime=c;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(e=0;e<b.input.length-1;e++)f=Math.min(f,b.input[e+
-1]-b.input[e])}e=[];for(b=this.startTime;b<this.endTime;b+=f){c=b;for(var h={},o=k=void 0,k=0;k<this.channels.length;k++)o=this.channels[k],h[o.sid]=o;m=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(n=this.transforms[k],o=h[n.sid],o!==void 0){for(var p=o.sampler,u,o=0;o<p.input.length-1;o++)if(p.input[o+1]>c){u=p.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14,
+case "instance_controller":this.controllers.push((new x).parse(c));break;case "instance_geometry":this.geometries.push((new z).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=Y.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",Y,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new v).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new t).parse(c));
+break;case "extra":break;default:console.log(c.nodeName)}b=[];e=1E6;c=-1E6;for(var f in J)for(var h=J[f],k=0;k<h.channel.length;k++){var m=h.channel[k],n=h.sampler[k];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,e=Math.min(e,n.startTime),c=Math.max(c,n.endTime),b.push(m)}if(b.length)this.startTime=e,this.endTime=c;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(e=0;e<b.input.length-1;e++)f=Math.min(f,b.input[e+1]-
+b.input[e])}e=[];for(b=this.startTime;b<this.endTime;b+=f){c=b;for(var h={},o=k=void 0,k=0;k<this.channels.length;k++)o=this.channels[k],h[o.sid]=o;m=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(n=this.transforms[k],o=h[n.sid],o!==void 0){for(var p=o.sampler,u,o=0;o<p.input.length-1;o++)if(p.input[o+1]>c){u=p.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14,
 c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};v.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};t.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=ta(b.textContent);this.updateMatrix();return this};t.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
 c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};v.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};t.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=ta(b.textContent);this.updateMatrix();return this};t.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
 this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":b=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),b);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
 this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":b=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),b);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
-x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "skeleton":this.skeleton.push(e.textContent.replace(/^#/,""));break;case "bind_material":if(e=$.evaluate(".//dae:instance_material",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=e.iterateNext();f;)this.instance_material.push((new w).parse(f)),f=e.iterateNext()}}return this};
-w.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};z.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1&&e.nodeName=="bind_material"){if(b=$.evaluate(".//dae:instance_material",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=b.iterateNext();c;)this.instance_material.push((new w).parse(c)),
-c=b.iterateNext();break}}return this};y.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "mesh":this.mesh=(new A(this)).parse(e)}}return this};A.prototype.parse=function(b){function c(b,e){var f=da(b.position);h[f]===void 0&&(h[f]={v:b,index:e});return h[f]}this.primitives=[];var e;for(e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];switch(f.nodeName){case "source":ea(f);break;case "vertices":this.vertices=
-(new I).parse(f);break;case "triangles":this.primitives.push((new D).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new E).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=na[this.vertices.input.POSITION.source].data;for(b=e=0;e<f.length;e+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[e],f[e+1],f[e+2]));c(k,b);this.geometry3js.vertices.push(k)}for(e=0;e<this.primitives.length;e++)primitive=this.primitives[e],primitive.setVertices(this.vertices),
+x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "skeleton":this.skeleton.push(e.textContent.replace(/^#/,""));break;case "bind_material":if(e=Y.evaluate(".//dae:instance_material",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=e.iterateNext();f;)this.instance_material.push((new w).parse(f)),f=e.iterateNext()}}return this};
+w.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};z.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1&&e.nodeName=="bind_material"){if(b=Y.evaluate(".//dae:instance_material",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=b.iterateNext();c;)this.instance_material.push((new w).parse(c)),
+c=b.iterateNext();break}}return this};y.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "mesh":this.mesh=(new A(this)).parse(e)}}return this};A.prototype.parse=function(b){function c(b,e){var f=ea(b.position);h[f]===void 0&&(h[f]={v:b,index:e});return h[f]}this.primitives=[];var e;for(e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];switch(f.nodeName){case "source":fa(f);break;case "vertices":this.vertices=
+(new G).parse(f);break;case "triangles":this.primitives.push((new D).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new E).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=na[this.vertices.input.POSITION.source].data;for(b=e=0;e<f.length;e+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[e],f[e+1],f[e+2]));c(k,b);this.geometry3js.vertices.push(k)}for(e=0;e<this.primitives.length;e++)primitive=this.primitives[e],primitive.setVertices(this.vertices),
 this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};A.prototype.handlePrimitive=function(b,c,e){var f=0,h,k,m=b.p,n=b.inputs,o,p,t,u=0,v=3,w=[];for(h=0;h<n.length;h++)switch(o=n[h],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(v=b.vcount[u++]);for(h=0;h<v;h++)for(k=0;k<n.length;k++)switch(o=
 this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};A.prototype.handlePrimitive=function(b,c,e){var f=0,h,k,m=b.p,n=b.inputs,o,p,t,u=0,v=3,w=[];for(h=0;h<n.length;h++)switch(o=n[h],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(v=b.vcount[u++]);for(h=0;h<v;h++)for(k=0;k<n.length;k++)switch(o=
-n[k],source=na[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=da(c.vertices[p].position);x.push(e[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[t],source.data[t+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var E;v==
+n[k],source=na[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=ea(c.vertices[p].position);x.push(e[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[t],source.data[t+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var E;v==
 3?E=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]]):v==4&&(E=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]]));E.daeMaterial=b.material;c.faces.push(E);for(k=0;k<w.length;k++)h=z[w[k]],c.faceVertexUvs[k].push([h[0],h[1],h[2]]);f+=n.length*v}};E.prototype=new D;E.prototype.constructor=E;D.prototype.setVertices=function(b){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==b.id)this.inputs[c].source=b.input.POSITION.source};D.prototype.parse=function(b){this.inputs=[];this.material=
 3?E=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]]):v==4&&(E=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]]));E.daeMaterial=b.material;c.faces.push(E);for(k=0;k<w.length;k++)h=z[w[k]],c.faceVertexUvs[k].push([h[0],h[1],h[2]]);f+=n.length*v}};E.prototype=new D;E.prototype.constructor=E;D.prototype.setVertices=function(b){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==b.id)this.inputs[c].source=b.input.POSITION.source};D.prototype.parse=function(b){this.inputs=[];this.material=
-b.getAttribute("material");this.count=ja(b,"count",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "input":this.inputs.push((new N).parse(b.childNodes[c]));break;case "vcount":this.vcount=aa(e.textContent);break;case "p":this.p=aa(e.textContent)}}return this};G.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=ja(b,"count",0);this.stride=ja(b,"stride",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName==
-"param"){var f={};f.name=e.getAttribute("name");f.type=e.getAttribute("type");this.params.push(f)}}return this};I.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++)b.childNodes[c].nodeName=="input"&&(input=(new N).parse(b.childNodes[c]),this.input[input.semantic]=input);return this};N.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,"");this.set=ja(b,"set",-1);this.offset=ja(b,"offset",
-0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};P.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "bool_array":for(var f=ka(e.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=e.nodeName;break;case "float_array":this.data=ta(e.textContent);this.type=e.nodeName;break;case "int_array":this.data=aa(e.textContent);this.type=e.nodeName;break;case "IDREF_array":case "Name_array":this.data=
-ka(e.textContent);this.type=e.nodeName;break;case "technique_common":for(f=0;f<e.childNodes.length;f++)if(e.childNodes[f].nodeName=="accessor"){this.accessor=(new G).parse(e.childNodes[f]);break}}}return this};P.prototype.read=function(){var b=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var e=this.data.slice(c,c+16),f=new THREE.Matrix4;f.set(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],
-e[11],e[12],e[13],e[14],e[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+c.type)}return b};J.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var c=0;c<b.childNodes.length;c++)if(b.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new O).parse(b.childNodes[c]);break}return this};H.prototype.isColor=function(){return this.texture==null};H.prototype.isTexture=function(){return this.texture!=null};H.prototype.parse=
-function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "color":e=ta(e.textContent);this.color=new THREE.Color(0);this.color.setRGB(e[0],e[1],e[2]);this.color.a=e[3];break;case "texture":this.texture=e.getAttribute("texture"),this.texcoord=e.getAttribute("texcoord")}}return this};K.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[e.nodeName]=
-(new H).parse(e);break;case "shininess":case "reflectivity":case "transparency":var f;f=$.evaluate(".//dae:float",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};K.prototype.create=function(){var b={},c=this.transparency!==void 0&&this.transparency<1,e;for(e in this)switch(e){case "ambient":case "emission":case "diffuse":case "specular":var f=this[e];
-if(f instanceof H)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=sa[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ca+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else e=="diffuse"?b.color=f.color.getHex():c||(b[e]=f.color.getHex());break;case "shininess":case "reflectivity":b[e]=this[e];break;case "transparency":if(c)b.transparent=!0,b.opacity=
-this[e],c=!0}b.shading=Ea;return this.material=new THREE.MeshLambertMaterial(b)};Z.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "init_from":this.init_from=e.textContent;break;case "format":this.format=e.textContent;break;default:console.log("unhandled Surface prop: "+e.nodeName)}}return this};C.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":this.source=
-e.textContent;break;case "minfilter":this.minfilter=e.textContent;break;case "magfilter":this.magfilter=e.textContent;break;case "mipfilter":this.mipfilter=e.textContent;break;case "wrap_s":this.wrap_s=e.textContent;break;case "wrap_t":this.wrap_t=e.textContent;break;default:console.log("unhandled Sampler2D prop: "+e.nodeName)}}return this};R.prototype.create=function(){if(this.shader==null)return null};R.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=
-null;for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(e))}}return this};R.prototype.parseNewparam=function(b){for(var c=b.getAttribute("sid"),e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=(new Z(this)).parse(f);this.surface.sid=c;break;case "sampler2D":this.sampler=(new C(this)).parse(f);this.sampler.sid=c;break;case "extra":break;
-default:console.log(f.nodeName)}}};R.prototype.parseProfileCOMMON=function(b){for(var c,e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":c=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return c};R.prototype.parseTechnique=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "lambert":case "blinn":case "phong":this.shader=
-(new K(e.nodeName,this)).parse(e)}}};O.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};V.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new P).parse(e);this.source[e.id]=e;break;case "sampler":this.sampler.push((new o(this)).parse(e));break;case "channel":this.channel.push((new W(this)).parse(e))}}return this};
-W.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var c=this.target.split("/");c.shift();var b=c.shift(),e=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(e)c=b.split("."),b=c.shift(),k=c.shift();else if(f){h=b.split("(");b=h.shift();for(c=0;c<h.length;c++)h[c]=parseInt(h[c].replace(/\)/,""))}this.sid=b;this.dotSyntax=e;this.arrSyntax=f;this.arrIndices=h;this.member=k;return this};o.prototype.parse=function(b){this.id=b.getAttribute("id");
+b.getAttribute("material");this.count=ka(b,"count",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "input":this.inputs.push((new N).parse(b.childNodes[c]));break;case "vcount":this.vcount=aa(e.textContent);break;case "p":this.p=aa(e.textContent)}}return this};F.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=ka(b,"count",0);this.stride=ka(b,"stride",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName==
+"param"){var f={};f.name=e.getAttribute("name");f.type=e.getAttribute("type");this.params.push(f)}}return this};G.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++)b.childNodes[c].nodeName=="input"&&(input=(new N).parse(b.childNodes[c]),this.input[input.semantic]=input);return this};N.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,"");this.set=ka(b,"set",-1);this.offset=ka(b,"offset",
+0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};Q.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "bool_array":for(var f=la(e.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=e.nodeName;break;case "float_array":this.data=ta(e.textContent);this.type=e.nodeName;break;case "int_array":this.data=aa(e.textContent);this.type=e.nodeName;break;case "IDREF_array":case "Name_array":this.data=
+la(e.textContent);this.type=e.nodeName;break;case "technique_common":for(f=0;f<e.childNodes.length;f++)if(e.childNodes[f].nodeName=="accessor"){this.accessor=(new F).parse(e.childNodes[f]);break}}}return this};Q.prototype.read=function(){var b=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var e=this.data.slice(c,c+16),f=new THREE.Matrix4;f.set(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],
+e[11],e[12],e[13],e[14],e[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+c.type)}return b};K.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var c=0;c<b.childNodes.length;c++)if(b.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new P).parse(b.childNodes[c]);break}return this};H.prototype.isColor=function(){return this.texture==null};H.prototype.isTexture=function(){return this.texture!=null};H.prototype.parse=
+function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "color":e=ta(e.textContent);this.color=new THREE.Color(0);this.color.setRGB(e[0],e[1],e[2]);this.color.a=e[3];break;case "texture":this.texture=e.getAttribute("texture"),this.texcoord=e.getAttribute("texcoord")}}return this};M.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[e.nodeName]=
+(new H).parse(e);break;case "shininess":case "reflectivity":case "transparency":var f;f=Y.evaluate(".//dae:float",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};M.prototype.create=function(){var b={},c=this.transparency!==void 0&&this.transparency<1,e;for(e in this)switch(e){case "ambient":case "emission":case "diffuse":case "specular":var f=this[e];
+if(f instanceof H)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=va[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else e=="diffuse"?b.color=f.color.getHex():c||(b[e]=f.color.getHex());break;case "shininess":case "reflectivity":b[e]=this[e];break;case "transparency":if(c)b.transparent=!0,b.opacity=
+this[e],c=!0}b.shading=Ga;return this.material=new THREE.MeshLambertMaterial(b)};X.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "init_from":this.init_from=e.textContent;break;case "format":this.format=e.textContent;break;default:console.log("unhandled Surface prop: "+e.nodeName)}}return this};C.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":this.source=
+e.textContent;break;case "minfilter":this.minfilter=e.textContent;break;case "magfilter":this.magfilter=e.textContent;break;case "mipfilter":this.mipfilter=e.textContent;break;case "wrap_s":this.wrap_s=e.textContent;break;case "wrap_t":this.wrap_t=e.textContent;break;default:console.log("unhandled Sampler2D prop: "+e.nodeName)}}return this};O.prototype.create=function(){if(this.shader==null)return null};O.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=
+null;for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(e))}}return this};O.prototype.parseNewparam=function(b){for(var c=b.getAttribute("sid"),e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=(new X(this)).parse(f);this.surface.sid=c;break;case "sampler2D":this.sampler=(new C(this)).parse(f);this.sampler.sid=c;break;case "extra":break;
+default:console.log(f.nodeName)}}};O.prototype.parseProfileCOMMON=function(b){for(var c,e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":c=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return c};O.prototype.parseTechnique=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "lambert":case "blinn":case "phong":this.shader=
+(new M(e.nodeName,this)).parse(e)}}};P.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};U.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new Q).parse(e);this.source[e.id]=e;break;case "sampler":this.sampler.push((new o(this)).parse(e));break;case "channel":this.channel.push((new V(this)).parse(e))}}return this};
+V.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var c=this.target.split("/");c.shift();var b=c.shift(),e=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(e)c=b.split("."),b=c.shift(),k=c.shift();else if(f){h=b.split("(");b=h.shift();for(c=0;c<h.length;c++)h[c]=parseInt(h[c].replace(/\)/,""))}this.sid=b;this.dotSyntax=e;this.arrSyntax=f;this.arrIndices=h;this.member=k;return this};o.prototype.parse=function(b){this.id=b.getAttribute("id");
 this.inputs=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":this.inputs.push((new N).parse(e))}}return this};o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var c=this.inputs[b],e=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=e.read();break;case "OUTPUT":this.output=e.read();break;case "INTERPOLATION":this.interpolation=e.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.semantic)}}this.duration=
 this.inputs=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":this.inputs.push((new N).parse(e))}}return this};o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var c=this.inputs[b],e=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=e.read();break;case "OUTPUT":this.output=e.read();break;case "INTERPOLATION":this.interpolation=e.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.semantic)}}this.duration=
 this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(b=0;b<this.input.length;b++)this.startTime=Math.min(this.startTime,this.input[b]),this.endTime=Math.max(this.endTime,this.input[b]);this.duration=this.endTime-this.startTime}};return{load:function(e,f){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var n=new XMLHttpRequest;
 this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(b=0;b<this.input.length;b++)this.startTime=Math.min(this.startTime,this.input[b]),this.endTime=Math.max(this.endTime,this.input[b]);this.duration=this.endTime-this.startTime}};return{load:function(e,f){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var n=new XMLHttpRequest;
-n.overrideMimeType&&n.overrideMimeType("text/xml");n.onreadystatechange=function(){if(n.readyState==4&&(n.status==0||n.status==200)){fa=f;var o,t=e;$=n.responseXML;o=fa;t!==void 0&&(t=t.split("/"),t.pop(),Ca=t.join("/")+"/");sa=b("//dae:library_images/dae:image",m,"image");ua=b("//dae:library_materials/dae:material",J,"material");ra=b("//dae:library_effects/dae:effect",R,"effect");qa=b("//dae:library_geometries/dae:geometry",y,"geometry");ca=b("//dae:library_controllers/dae:controller",k,"controller");
-la=b("//dae:library_animations/dae:animation",V,"animation");ya=b(".//dae:library_visual_scenes/dae:visual_scene",p,"visual_scene");va=[];Ba=[];(t=$.evaluate(".//dae:scene/dae:instance_visual_scene",$,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(t=t.getAttribute("url").replace(/^#/,""),T=ya[t]):T=null;U=new THREE.Object3D;for(t=0;t<T.nodes.length;t++)U.addChild(h(T.nodes[t]));c();for(var u in la);u={scene:U,morphs:va,skins:Ba,dae:{images:sa,materials:ua,effects:ra,geometries:qa,
-controllers:ca,animations:la,visualScenes:ya,scene:T}};o&&o(u)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Ea=b},applySkin:f,geometries:qa}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+n.overrideMimeType&&n.overrideMimeType("text/xml");n.onreadystatechange=function(){if(n.readyState==4&&(n.status==0||n.status==200)){ga=f;var o,t=e;Y=n.responseXML;o=ga;t!==void 0&&(t=t.split("/"),t.pop(),Ea=t.join("/")+"/");va=b("//dae:library_images/dae:image",m,"image");ua=b("//dae:library_materials/dae:material",K,"material");sa=b("//dae:library_effects/dae:effect",O,"effect");qa=b("//dae:library_geometries/dae:geometry",y,"geometry");da=b("//dae:library_controllers/dae:controller",k,"controller");
+J=b("//dae:library_animations/dae:animation",U,"animation");xa=b(".//dae:library_visual_scenes/dae:visual_scene",p,"visual_scene");Da=[];pa=[];(t=Y.evaluate(".//dae:scene/dae:instance_visual_scene",Y,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(t=t.getAttribute("url").replace(/^#/,""),Z=xa[t]):Z=null;T=new THREE.Object3D;for(t=0;t<Z.nodes.length;t++)T.addChild(h(Z.nodes[t]));c();for(var u in J);u={scene:T,morphs:Da,skins:pa,dae:{images:va,materials:ua,effects:sa,geometries:qa,controllers:da,
+animations:J,visualScenes:xa,scene:Z}};o&&o(u)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Ga=b},applySkin:f,geometries:qa}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,h=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,h);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
 THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,h=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,h);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,h,u,p,v,t,x,w,z,y,A,E,D,G,I=b.faces;t=b.vertices;var N=b.normals,P=b.colors,J=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&J++;for(e=0;e<J;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];p=0;for(v=t.length;p<v;)x=new THREE.Vertex,x.position.x=t[p++]*c,x.position.y=
-t[p++]*c,x.position.z=t[p++]*c,f.vertices.push(x);p=0;for(v=I.length;p<v;){c=I[p++];t=c&1;u=c&2;e=c&4;h=c&8;w=c&16;x=c&32;y=c&64;c&=128;t?(A=new THREE.Face4,A.a=I[p++],A.b=I[p++],A.c=I[p++],A.d=I[p++],t=4):(A=new THREE.Face3,A.a=I[p++],A.b=I[p++],A.c=I[p++],t=3);if(u)u=I[p++],A.materials=f.materials[u];u=f.faces.length;if(e)for(e=0;e<J;e++)E=b.uvs[e],z=I[p++],G=E[z*2],z=E[z*2+1],f.faceUvs[e][u]=new THREE.UV(G,z);if(h)for(e=0;e<J;e++){E=b.uvs[e];D=[];for(h=0;h<t;h++)z=I[p++],G=E[z*2],z=E[z*2+1],D[h]=
-new THREE.UV(G,z);f.faceVertexUvs[e][u]=D}if(w)w=I[p++]*3,h=new THREE.Vector3,h.x=N[w++],h.y=N[w++],h.z=N[w],A.normal=h;if(x)for(e=0;e<t;e++)w=I[p++]*3,h=new THREE.Vector3,h.x=N[w++],h.y=N[w++],h.z=N[w],A.vertexNormals.push(h);if(y)x=I[p++],x=new THREE.Color(P[x]),A.color=x;if(c)for(e=0;e<t;e++)x=I[p++],x=new THREE.Color(P[x]),A.vertexColors.push(x);f.faces.push(A)}}})(h);(function(){var c,e,h,u;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],u=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,h,u,p,v,t,x,w,z,y,A,E,D,F,G=b.faces;t=b.vertices;var N=b.normals,Q=b.colors,K=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&K++;for(e=0;e<K;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];p=0;for(v=t.length;p<v;)x=new THREE.Vertex,x.position.x=t[p++]*c,x.position.y=
+t[p++]*c,x.position.z=t[p++]*c,f.vertices.push(x);p=0;for(v=G.length;p<v;){c=G[p++];t=c&1;u=c&2;e=c&4;h=c&8;w=c&16;x=c&32;y=c&64;c&=128;t?(A=new THREE.Face4,A.a=G[p++],A.b=G[p++],A.c=G[p++],A.d=G[p++],t=4):(A=new THREE.Face3,A.a=G[p++],A.b=G[p++],A.c=G[p++],t=3);if(u)u=G[p++],A.materials=f.materials[u];u=f.faces.length;if(e)for(e=0;e<K;e++)E=b.uvs[e],z=G[p++],F=E[z*2],z=E[z*2+1],f.faceUvs[e][u]=new THREE.UV(F,z);if(h)for(e=0;e<K;e++){E=b.uvs[e];D=[];for(h=0;h<t;h++)z=G[p++],F=E[z*2],z=E[z*2+1],D[h]=
+new THREE.UV(F,z);f.faceVertexUvs[e][u]=D}if(w)w=G[p++]*3,h=new THREE.Vector3,h.x=N[w++],h.y=N[w++],h.z=N[w],A.normal=h;if(x)for(e=0;e<t;e++)w=G[p++]*3,h=new THREE.Vector3,h.x=N[w++],h.y=N[w++],h.z=N[w],A.vertexNormals.push(h);if(y)x=G[p++],x=new THREE.Color(Q[x]),A.color=x;if(c)for(e=0;e<t;e++)x=G[p++],x=new THREE.Color(Q[x]),A.vertexColors.push(x);f.faces.push(A)}}})(h);(function(){var c,e,h,u;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],u=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
 u,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],u=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,u,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,u,p,v,t,x,w,z;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];w=f.morphTargets[e].vertices;z=b.morphTargets[e].vertices;u=0;for(p=z.length;u<p;u+=3)v=z[u]*c,t=z[u+1]*
 u,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],u=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,u,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,u,p,v,t,x,w,z;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];w=f.morphTargets[e].vertices;z=b.morphTargets[e].vertices;u=0;for(p=z.length;u<p;u+=3)v=z[u]*c,t=z[u+1]*
 c,x=z[u+2]*c,w.push(new THREE.Vertex(new THREE.Vector3(v,t,x)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;v=b.morphColors[e].colors;c=0;for(u=v.length;c<u;c+=3)t=new THREE.Color(16755200),t.setRGB(v[c],v[c+1],v[c+2]),p.push(t)}}})(h);(function(){if(b.edges!==void 0){var c,e,h;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],h=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
 c,x=z[u+2]*c,w.push(new THREE.Vertex(new THREE.Vector3(v,t,x)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;v=b.morphColors[e].colors;c=0;for(u=v.length;c<u;c+=3)t=new THREE.Color(16755200),t.setRGB(v[c],v[c+1],v[c+2]),p.push(t)}}})(h);(function(){if(b.edges!==void 0){var c,e,h;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],h=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
 f.vertices[h],e,h))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
 f.vertices[h],e,h))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:h+"/"+b}function n(){for(w in R.objects)if(!S.objects[w])if(D=R.objects[w],D.geometry!==void 0){if(P=S.geometries[D.geometry]){var b=!1;Z=[];for(aa=0;aa<D.materials.length;aa++)Z[aa]=S.materials[D.materials[aa]],b=Z[aa]instanceof THREE.ShaderMaterial;b&&P.computeTangents();G=D.position;r=D.rotation;
-q=D.quaternion;s=D.scale;q=0;Z.length==0&&(Z[0]=new THREE.MeshFaceMaterial);Z.length>1&&(Z=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(P,Z);object.name=w;object.position.set(G[0],G[1],G[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;S.scene.addObject(object);S.objects[w]=object;D.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),S.scene.collisions.colliders.push(b));
-if(D.castsShadow)b=new THREE.ShadowVolume(P),S.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},S.triggers[object.name]=b)}}else G=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(G[0],G[1],G[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=D.visible!==void 0?D.visible:!1,S.scene.addObject(object),S.objects[w]=object,S.empties[w]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},S.triggers[object.name]=b)}function u(b){return function(c){S.geometries[b]=c;n();V-=1;e.onLoadComplete();v()}}function p(b){return function(c){S.geometries[b]=c}}function v(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-V,loadedTextures:ea-W},S);e.onLoadProgress();V==0&&W==0&&c(S)}
-var t,x,w,z,y,A,E,D,G,I,N,P,J,H,K,Z,C,R,O,V,W,o,ea,S;R=b.data;K=new THREE.BinaryLoader;O=new THREE.JSONLoader;W=V=0;S={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in R.objects)if(D=R.objects[w],D.meshCollider){b=!0;break}if(b)S.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;I=R.transform.rotation;var ta=R.transform.scale;b&&S.scene.position.set(b[0],b[1],b[2]);I&&S.scene.rotation.set(I[0],
-I[1],I[2]);ta&&S.scene.scale.set(ta[0],ta[1],ta[2]);(b||I||ta)&&S.scene.updateMatrix()}b=function(){W-=1;v();e.onLoadComplete()};for(y in R.cameras){I=R.cameras[y];if(I.type=="perspective")J=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")J=new THREE.Camera,J.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);G=I.position;I=I.target;J.position.set(G[0],G[1],G[2]);J.target.position.set(I[0],I[1],I[2]);S.cameras[y]=J}for(z in R.lights)y=R.lights[z],
-J=y.color!==void 0?y.color:16777215,I=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(G=y.direction,C=new THREE.DirectionalLight(J,I),C.position.set(G[0],G[1],G[2]),C.position.normalize()):y.type=="point"?(G=y.position,d=y.distance,C=new THREE.PointLight(J,I,d),C.position.set(G[0],G[1],G[2])):y.type=="ambient"&&(C=new THREE.AmbientLight(J)),S.scene.addLight(C),S.lights[z]=C;for(A in R.fogs)z=R.fogs[A],z.type=="linear"?H=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(H=new THREE.FogExp2(0,
-z.density)),I=z.color,H.color.setRGB(I[0],I[1],I[2]),S.fogs[A]=H;if(S.cameras&&R.defaults.camera)S.currentCamera=S.cameras[R.defaults.camera];if(S.fogs&&R.defaults.fog)S.scene.fog=S.fogs[R.defaults.fog];I=R.defaults.bgcolor;S.bgColor=new THREE.Color;S.bgColor.setRGB(I[0],I[1],I[2]);S.bgColorAlpha=R.defaults.bgalpha;for(t in R.geometries)if(A=R.geometries[t],A.type=="bin_mesh"||A.type=="ascii_mesh")V+=1,e.onLoadStart();o=V;for(t in R.geometries)A=R.geometries[t],A.type=="cube"?(P=new THREE.CubeGeometry(A.width,
-A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),S.geometries[t]=P):A.type=="plane"?(P=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),S.geometries[t]=P):A.type=="sphere"?(P=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),S.geometries[t]=P):A.type=="cylinder"?(P=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),S.geometries[t]=P):A.type=="torus"?(P=new THREE.TorusGeometry(A.radius,A.tube,
-A.segmentsR,A.segmentsT),S.geometries[t]=P):A.type=="icosahedron"?(P=new THREE.IcosahedronGeometry(A.subdivisions),S.geometries[t]=P):A.type=="bin_mesh"?K.load({model:f(A.url,R.urlBaseType),callback:u(t)}):A.type=="ascii_mesh"?O.load({model:f(A.url,R.urlBaseType),callback:u(t)}):A.type=="embedded_mesh"&&(A=R.embeds[A.id])&&O.createModel(A,p(t),"");for(E in R.textures)if(t=R.textures[E],t.url instanceof Array){W+=t.url.length;for(K=0;K<t.url.length;K++)e.onLoadStart()}else W+=1,e.onLoadStart();ea=
-W;for(E in R.textures){t=R.textures[E];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){K=[];for(var aa=0;aa<t.url.length;aa++)K[aa]=f(t.url[aa],R.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,t.mapping,b)}else{K=THREE.ImageUtils.loadTexture(f(t.url,R.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)K.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)K.magFilter=THREE[t.magFilter];if(t.repeat){K.repeat.set(t.repeat[0],t.repeat[1]);
-if(t.repeat[0]!=1)K.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}t.offset&&K.offset.set(t.offset[0],t.offset[1]);if(t.wrap){O={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(O[t.wrap[0]]!==void 0)K.wrapS=O[t.wrap[0]];if(O[t.wrap[1]]!==void 0)K.wrapT=O[t.wrap[1]]}}S.textures[E]=K}for(x in R.materials){E=R.materials[x];for(N in E.parameters)if(N=="envMap"||N=="map"||N=="lightMap")E.parameters[N]=S.textures[E.parameters[N]];else if(N=="shading")E.parameters[N]=
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:h+"/"+b}function n(){for(w in O.objects)if(!S.objects[w])if(D=O.objects[w],D.geometry!==void 0){if(Q=S.geometries[D.geometry]){var b=!1;X=[];for(aa=0;aa<D.materials.length;aa++)X[aa]=S.materials[D.materials[aa]],b=X[aa]instanceof THREE.ShaderMaterial;b&&Q.computeTangents();F=D.position;r=D.rotation;
+q=D.quaternion;s=D.scale;q=0;X.length==0&&(X[0]=new THREE.MeshFaceMaterial);X.length>1&&(X=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(Q,X);object.name=w;object.position.set(F[0],F[1],F[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;S.scene.addObject(object);S.objects[w]=object;D.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),S.scene.collisions.colliders.push(b));
+if(D.castsShadow)b=new THREE.ShadowVolume(Q),S.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},S.triggers[object.name]=b)}}else F=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(F[0],F[1],F[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
+s[1],s[2]),object.visible=D.visible!==void 0?D.visible:!1,S.scene.addObject(object),S.objects[w]=object,S.empties[w]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},S.triggers[object.name]=b)}function u(b){return function(c){S.geometries[b]=c;n();U-=1;e.onLoadComplete();v()}}function p(b){return function(c){S.geometries[b]=c}}function v(){e.callbackProgress({totalModels:o,totalTextures:fa,loadedModels:o-U,loadedTextures:fa-V},S);e.onLoadProgress();U==0&&V==0&&c(S)}
+var t,x,w,z,y,A,E,D,F,G,N,Q,K,H,M,X,C,O,P,U,V,o,fa,S;O=b.data;M=new THREE.BinaryLoader;P=new THREE.JSONLoader;V=U=0;S={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in O.objects)if(D=O.objects[w],D.meshCollider){b=!0;break}if(b)S.scene.collisions=new THREE.CollisionSystem;if(O.transform){b=O.transform.position;G=O.transform.rotation;var ta=O.transform.scale;b&&S.scene.position.set(b[0],b[1],b[2]);G&&S.scene.rotation.set(G[0],
+G[1],G[2]);ta&&S.scene.scale.set(ta[0],ta[1],ta[2]);(b||G||ta)&&S.scene.updateMatrix()}b=function(){V-=1;v();e.onLoadComplete()};for(y in O.cameras){G=O.cameras[y];if(G.type=="perspective")K=new THREE.Camera(G.fov,G.aspect,G.near,G.far);else if(G.type=="ortho")K=new THREE.Camera,K.projectionMatrix=THREE.Matrix4.makeOrtho(G.left,G.right,G.top,G.bottom,G.near,G.far);F=G.position;G=G.target;K.position.set(F[0],F[1],F[2]);K.target.position.set(G[0],G[1],G[2]);S.cameras[y]=K}for(z in O.lights)y=O.lights[z],
+K=y.color!==void 0?y.color:16777215,G=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(F=y.direction,C=new THREE.DirectionalLight(K,G),C.position.set(F[0],F[1],F[2]),C.position.normalize()):y.type=="point"?(F=y.position,d=y.distance,C=new THREE.PointLight(K,G,d),C.position.set(F[0],F[1],F[2])):y.type=="ambient"&&(C=new THREE.AmbientLight(K)),S.scene.addLight(C),S.lights[z]=C;for(A in O.fogs)z=O.fogs[A],z.type=="linear"?H=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(H=new THREE.FogExp2(0,
+z.density)),G=z.color,H.color.setRGB(G[0],G[1],G[2]),S.fogs[A]=H;if(S.cameras&&O.defaults.camera)S.currentCamera=S.cameras[O.defaults.camera];if(S.fogs&&O.defaults.fog)S.scene.fog=S.fogs[O.defaults.fog];G=O.defaults.bgcolor;S.bgColor=new THREE.Color;S.bgColor.setRGB(G[0],G[1],G[2]);S.bgColorAlpha=O.defaults.bgalpha;for(t in O.geometries)if(A=O.geometries[t],A.type=="bin_mesh"||A.type=="ascii_mesh")U+=1,e.onLoadStart();o=U;for(t in O.geometries)A=O.geometries[t],A.type=="cube"?(Q=new THREE.CubeGeometry(A.width,
+A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),S.geometries[t]=Q):A.type=="plane"?(Q=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),S.geometries[t]=Q):A.type=="sphere"?(Q=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),S.geometries[t]=Q):A.type=="cylinder"?(Q=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),S.geometries[t]=Q):A.type=="torus"?(Q=new THREE.TorusGeometry(A.radius,A.tube,
+A.segmentsR,A.segmentsT),S.geometries[t]=Q):A.type=="icosahedron"?(Q=new THREE.IcosahedronGeometry(A.subdivisions),S.geometries[t]=Q):A.type=="bin_mesh"?M.load({model:f(A.url,O.urlBaseType),callback:u(t)}):A.type=="ascii_mesh"?P.load({model:f(A.url,O.urlBaseType),callback:u(t)}):A.type=="embedded_mesh"&&(A=O.embeds[A.id])&&P.createModel(A,p(t),"");for(E in O.textures)if(t=O.textures[E],t.url instanceof Array){V+=t.url.length;for(M=0;M<t.url.length;M++)e.onLoadStart()}else V+=1,e.onLoadStart();fa=
+V;for(E in O.textures){t=O.textures[E];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){M=[];for(var aa=0;aa<t.url.length;aa++)M[aa]=f(t.url[aa],O.urlBaseType);M=THREE.ImageUtils.loadTextureCube(M,t.mapping,b)}else{M=THREE.ImageUtils.loadTexture(f(t.url,O.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)M.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)M.magFilter=THREE[t.magFilter];if(t.repeat){M.repeat.set(t.repeat[0],t.repeat[1]);
+if(t.repeat[0]!=1)M.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)M.wrapT=THREE.RepeatWrapping}t.offset&&M.offset.set(t.offset[0],t.offset[1]);if(t.wrap){P={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(P[t.wrap[0]]!==void 0)M.wrapS=P[t.wrap[0]];if(P[t.wrap[1]]!==void 0)M.wrapT=P[t.wrap[1]]}}S.textures[E]=M}for(x in O.materials){E=O.materials[x];for(N in E.parameters)if(N=="envMap"||N=="map"||N=="lightMap")E.parameters[N]=S.textures[E.parameters[N]];else if(N=="shading")E.parameters[N]=
 E.parameters[N]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(N=="blending")E.parameters[N]=THREE[E.parameters[N]]?THREE[E.parameters[N]]:THREE.NormalBlending;else if(N=="combine")E.parameters[N]=E.parameters[N]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(N=="vertexColors")if(E.parameters[N]=="face")E.parameters[N]=THREE.FaceColors;else if(E.parameters[N])E.parameters[N]=THREE.VertexColors;if(E.parameters.opacity!==void 0&&E.parameters.opacity<1)E.parameters.transparent=
 E.parameters[N]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(N=="blending")E.parameters[N]=THREE[E.parameters[N]]?THREE[E.parameters[N]]:THREE.NormalBlending;else if(N=="combine")E.parameters[N]=E.parameters[N]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(N=="vertexColors")if(E.parameters[N]=="face")E.parameters[N]=THREE.FaceColors;else if(E.parameters[N])E.parameters[N]=THREE.VertexColors;if(E.parameters.opacity!==void 0&&E.parameters.opacity<1)E.parameters.transparent=
-!0;if(E.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);K=E.parameters.color;O=E.parameters.specular;A=E.parameters.ambient;H=E.parameters.shininess;b.tNormal.texture=S.textures[E.parameters.normalMap];if(E.parameters.normalMapFactor)b.uNormalScale.value=E.parameters.normalMapFactor;if(E.parameters.map)b.tDiffuse.texture=E.parameters.map,b.enableDiffuse.value=!0;if(E.parameters.lightMap)b.tAO.texture=E.parameters.lightMap,b.enableAO.value=!0;if(E.parameters.specularMap)b.tSpecular.texture=
-S.textures[E.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(K);b.uSpecularColor.value.setHex(O);b.uAmbientColor.value.setHex(A);b.uShininess.value=H;if(E.parameters.opacity)b.uOpacity.value=E.parameters.opacity;E=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else E=new THREE[E.type](E.parameters);S.materials[x]=E}n();e.callbackSync(S)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
+!0;if(E.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);M=E.parameters.color;P=E.parameters.specular;A=E.parameters.ambient;H=E.parameters.shininess;b.tNormal.texture=S.textures[E.parameters.normalMap];if(E.parameters.normalMapFactor)b.uNormalScale.value=E.parameters.normalMapFactor;if(E.parameters.map)b.tDiffuse.texture=E.parameters.map,b.enableDiffuse.value=!0;if(E.parameters.lightMap)b.tAO.texture=E.parameters.lightMap,b.enableAO.value=!0;if(E.parameters.specularMap)b.tSpecular.texture=
+S.textures[E.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(M);b.uSpecularColor.value.setHex(P);b.uAmbientColor.value.setHex(A);b.uShininess.value=H;if(E.parameters.opacity)b.uOpacity.value=E.parameters.opacity;E=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else E=new THREE[E.type](E.parameters);S.materials[x]=E}n();e.callbackSync(S)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
 THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(b){var c=new XMLHttpRequest,e=b.model,f=b.callback,h=b.scale!==void 0?b.scale:1,m=b.offsetX!==void 0?b.offsetX:0,k=b.offsetY!==void 0?b.offsetY:0,n=b.offsetZ!==void 0?b.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,f,h,m,k,n):alert("Couldn't load ["+e+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",e,!0);c.send(null)};
 THREE.UTF8Loader.prototype.load=function(b){var c=new XMLHttpRequest,e=b.model,f=b.callback,h=b.scale!==void 0?b.scale:1,m=b.offsetX!==void 0?b.offsetX:0,k=b.offsetY!==void 0?b.offsetY:0,n=b.offsetZ!==void 0?b.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,f,h,m,k,n):alert("Couldn't load ["+e+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",e,!0);c.send(null)};
 THREE.UTF8Loader.prototype.decompressMesh=function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var m=0,k=0;k<c;++k){var n=b.charCodeAt(k+f);m+=n>>1^-(n&1);e[8*k+h]=m}f+=c}c=b.length-f;m=new Uint16Array(c);for(h=k=0;h<c;h++)n=b.charCodeAt(h+f),m[h]=k-n,n==0&&k++;return[e,m]};
 THREE.UTF8Loader.prototype.decompressMesh=function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var m=0,k=0;k<c;++k){var n=b.charCodeAt(k+f);m+=n>>1^-(n&1);e[8*k+h]=m}f+=c}c=b.length-f;m=new Uint16Array(c);for(h=k=0;h<c;h++)n=b.charCodeAt(h+f),m[h]=k-n,n==0&&k++;return[e,m]};
 THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,m){var k=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var k=THREE.UTF8Loader.prototype.decompressMesh(b),p=[],v=[];(function(b,k,p){for(var u,v,A,E=b.length;p<E;p+=k)u=b[p],v=b[p+1],A=b[p+2],u=u/16383*e,v=v/16383*e,A=A/16383*e,u+=f,v+=h,A+=m,c.vertices.push(new THREE.Vertex(new THREE.Vector3(u,v,A)))})(k[0],8,0);(function(b,c,e){for(var f,h,k=b.length;e<k;e+=c)f=b[e],h=b[e+1],f/=1023,h/=1023,v.push(f,1-h)})(k[0],8,3);(function(b,
 THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,m){var k=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var k=THREE.UTF8Loader.prototype.decompressMesh(b),p=[],v=[];(function(b,k,p){for(var u,v,A,E=b.length;p<E;p+=k)u=b[p],v=b[p+1],A=b[p+2],u=u/16383*e,v=v/16383*e,A=A/16383*e,u+=f,v+=h,A+=m,c.vertices.push(new THREE.Vertex(new THREE.Vector3(u,v,A)))})(k[0],8,0);(function(b,c,e){for(var f,h,k=b.length;e<k;e+=c)f=b[e],h=b[e+1],f/=1023,h/=1023,v.push(f,1-h)})(k[0],8,3);(function(b,
-c,e){for(var f,h,k,m=b.length;e<m;e+=c)f=b[e],h=b[e+1],k=b[e+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,p.push(f,h,k)})(k[0],8,5);(function(b){var e,f,h,k,m,u,D,G,I,N=b.length;for(e=0;e<N;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;G=f;I=h;u=k;D=f;var P=h,J=k,H=m.materials[0],K=p[P*3],Z=p[P*3+1],P=p[P*3+2],C=p[J*3],R=p[J*3+1],J=p[J*3+2];D=new THREE.Vector3(p[D*3],p[D*3+1],p[D*3+2]);P=new THREE.Vector3(K,Z,P);J=new THREE.Vector3(C,R,J);m.faces.push(new THREE.Face3(G,I,u,[D,P,J],null,H));m=v[f*2];f=v[f*2+
-1];u=v[h*2];D=v[h*2+1];G=v[k*2];I=v[k*2+1];k=c.faceVertexUvs[0];h=u;u=D;D=[];D.push(new THREE.UV(m,f));D.push(new THREE.UV(h,u));D.push(new THREE.UV(G,I));k.push(D)}})(k[1]);this.computeCentroids();this.computeFaceNormals()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;c(new k)};
+c,e){for(var f,h,k,m=b.length;e<m;e+=c)f=b[e],h=b[e+1],k=b[e+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,p.push(f,h,k)})(k[0],8,5);(function(b){var e,f,h,k,m,u,D,F,G,N=b.length;for(e=0;e<N;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;F=f;G=h;u=k;D=f;var Q=h,K=k,H=m.materials[0],M=p[Q*3],X=p[Q*3+1],Q=p[Q*3+2],C=p[K*3],O=p[K*3+1],K=p[K*3+2];D=new THREE.Vector3(p[D*3],p[D*3+1],p[D*3+2]);Q=new THREE.Vector3(M,X,Q);K=new THREE.Vector3(C,O,K);m.faces.push(new THREE.Face3(F,G,u,[D,Q,K],null,H));m=v[f*2];f=v[f*2+
+1];u=v[h*2];D=v[h*2+1];F=v[k*2];G=v[k*2+1];k=c.faceVertexUvs[0];h=u;u=D;D=[];D.push(new THREE.UV(m,f));D.push(new THREE.UV(h,u));D.push(new THREE.UV(F,G));k.push(D)}})(k[1]);this.computeCentroids();this.computeFaceNormals()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;c(new k)};
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,h){return b+(c-b)*h};this.VIntX=function(b,c,h,m,k,n,u,p,v,t){k=(k-v)/(t-v);v=this.normal_cache;c[m]=n+k*this.delta;c[m+1]=u;c[m+2]=p;h[m]=this.lerp(v[b],v[b+3],k);h[m+1]=this.lerp(v[b+1],v[b+4],k);h[m+2]=this.lerp(v[b+2],v[b+5],k)};this.VIntY=function(b,c,h,m,k,n,u,p,v,t){k=(k-v)/(t-v);v=this.normal_cache;c[m]=n;c[m+1]=u+k*this.delta;c[m+
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,h){return b+(c-b)*h};this.VIntX=function(b,c,h,m,k,n,u,p,v,t){k=(k-v)/(t-v);v=this.normal_cache;c[m]=n+k*this.delta;c[m+1]=u;c[m+2]=p;h[m]=this.lerp(v[b],v[b+3],k);h[m+1]=this.lerp(v[b+1],v[b+4],k);h[m+2]=this.lerp(v[b+2],v[b+5],k)};this.VIntY=function(b,c,h,m,k,n,u,p,v,t){k=(k-v)/(t-v);v=this.normal_cache;c[m]=n;c[m+1]=u+k*this.delta;c[m+
 2]=p;c=b+this.yd*3;h[m]=this.lerp(v[b],v[c],k);h[m+1]=this.lerp(v[b+1],v[c+1],k);h[m+2]=this.lerp(v[b+2],v[c+2],k)};this.VIntZ=function(b,c,h,m,k,n,u,p,v,t){k=(k-v)/(t-v);v=this.normal_cache;c[m]=n;c[m+1]=u;c[m+2]=p+k*this.delta;c=b+this.zd*3;h[m]=this.lerp(v[b],v[c],k);h[m+1]=this.lerp(v[b+1],v[c+1],k);h[m+2]=this.lerp(v[b+2],v[c+2],k)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
 2]=p;c=b+this.yd*3;h[m]=this.lerp(v[b],v[c],k);h[m+1]=this.lerp(v[b+1],v[c+1],k);h[m+2]=this.lerp(v[b+2],v[c+2],k)};this.VIntZ=function(b,c,h,m,k,n,u,p,v,t){k=(k-v)/(t-v);v=this.normal_cache;c[m]=n;c[m+1]=u;c[m+2]=p+k*this.delta;c=b+this.zd*3;h[m]=this.lerp(v[b],v[c],k);h[m+1]=this.lerp(v[b+1],v[c+1],k);h[m+2]=this.lerp(v[b+2],v[c+2],k)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
-this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,m,k,n){var u=m+1,p=m+this.yd,v=m+this.zd,t=u+this.yd,x=u+this.zd,w=m+this.yd+this.zd,z=u+this.yd+this.zd,y=0,A=this.field[m],E=this.field[u],D=this.field[p],G=this.field[t],I=this.field[v],N=this.field[x],P=this.field[w],J=this.field[z];A<k&&(y|=1);E<k&&(y|=2);D<k&&(y|=8);G<k&&(y|=4);I<k&&(y|=16);N<k&&(y|=32);P<k&&(y|=128);J<k&&(y|=64);var H=THREE.edgeTable[y];if(H==0)return 0;var K=this.delta,
-Z=b+K,C=c+K,K=h+K;H&1&&(this.compNorm(m),this.compNorm(u),this.VIntX(m*3,this.vlist,this.nlist,0,k,b,c,h,A,E));H&2&&(this.compNorm(u),this.compNorm(t),this.VIntY(u*3,this.vlist,this.nlist,3,k,Z,c,h,E,G));H&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,k,b,C,h,D,G));H&8&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,9,k,b,c,h,A,D));H&16&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,12,k,b,c,K,I,N));H&32&&(this.compNorm(x),
-this.compNorm(z),this.VIntY(x*3,this.vlist,this.nlist,15,k,Z,c,K,N,J));H&64&&(this.compNorm(w),this.compNorm(z),this.VIntX(w*3,this.vlist,this.nlist,18,k,b,C,K,P,J));H&128&&(this.compNorm(v),this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,21,k,b,c,K,I,P));H&256&&(this.compNorm(m),this.compNorm(v),this.VIntZ(m*3,this.vlist,this.nlist,24,k,b,c,h,A,I));H&512&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*3,this.vlist,this.nlist,27,k,Z,c,h,E,N));H&1024&&(this.compNorm(t),this.compNorm(z),this.VIntZ(t*
-3,this.vlist,this.nlist,30,k,Z,C,h,G,J));H&2048&&(this.compNorm(p),this.compNorm(w),this.VIntZ(p*3,this.vlist,this.nlist,33,k,b,C,h,D,P));y<<=4;for(k=m=0;THREE.triTable[y+k]!=-1;)b=y+k,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),k+=3,m++;return m};this.posnormtriv=function(b,c,h,m,k,n){var u=this.count*3;this.positionArray[u]=b[h];this.positionArray[u+1]=b[h+1];this.positionArray[u+2]=b[h+2];this.positionArray[u+3]=b[m];this.positionArray[u+
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,m,k,n){var u=m+1,p=m+this.yd,v=m+this.zd,t=u+this.yd,x=u+this.zd,w=m+this.yd+this.zd,z=u+this.yd+this.zd,y=0,A=this.field[m],E=this.field[u],D=this.field[p],F=this.field[t],G=this.field[v],N=this.field[x],Q=this.field[w],K=this.field[z];A<k&&(y|=1);E<k&&(y|=2);D<k&&(y|=8);F<k&&(y|=4);G<k&&(y|=16);N<k&&(y|=32);Q<k&&(y|=128);K<k&&(y|=64);var H=THREE.edgeTable[y];if(H==0)return 0;var M=this.delta,
+X=b+M,C=c+M,M=h+M;H&1&&(this.compNorm(m),this.compNorm(u),this.VIntX(m*3,this.vlist,this.nlist,0,k,b,c,h,A,E));H&2&&(this.compNorm(u),this.compNorm(t),this.VIntY(u*3,this.vlist,this.nlist,3,k,X,c,h,E,F));H&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,k,b,C,h,D,F));H&8&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,9,k,b,c,h,A,D));H&16&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,12,k,b,c,M,G,N));H&32&&(this.compNorm(x),
+this.compNorm(z),this.VIntY(x*3,this.vlist,this.nlist,15,k,X,c,M,N,K));H&64&&(this.compNorm(w),this.compNorm(z),this.VIntX(w*3,this.vlist,this.nlist,18,k,b,C,M,Q,K));H&128&&(this.compNorm(v),this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,21,k,b,c,M,G,Q));H&256&&(this.compNorm(m),this.compNorm(v),this.VIntZ(m*3,this.vlist,this.nlist,24,k,b,c,h,A,G));H&512&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*3,this.vlist,this.nlist,27,k,X,c,h,E,N));H&1024&&(this.compNorm(t),this.compNorm(z),this.VIntZ(t*
+3,this.vlist,this.nlist,30,k,X,C,h,F,K));H&2048&&(this.compNorm(p),this.compNorm(w),this.VIntZ(p*3,this.vlist,this.nlist,33,k,b,C,h,D,Q));y<<=4;for(k=m=0;THREE.triTable[y+k]!=-1;)b=y+k,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),k+=3,m++;return m};this.posnormtriv=function(b,c,h,m,k,n){var u=this.count*3;this.positionArray[u]=b[h];this.positionArray[u+1]=b[h+1];this.positionArray[u+2]=b[h+2];this.positionArray[u+3]=b[m];this.positionArray[u+
 4]=b[m+1];this.positionArray[u+5]=b[m+2];this.positionArray[u+6]=b[k];this.positionArray[u+7]=b[k+1];this.positionArray[u+8]=b[k+2];this.normalArray[u]=c[h];this.normalArray[u+1]=c[h+1];this.normalArray[u+2]=c[h+2];this.normalArray[u+3]=c[m];this.normalArray[u+4]=c[m+1];this.normalArray[u+5]=c[m+2];this.normalArray[u+6]=c[k];this.normalArray[u+7]=c[k+1];this.normalArray[u+8]=c[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&n(this)};this.begin=function(){this.count=0;
 4]=b[m+1];this.positionArray[u+5]=b[m+2];this.positionArray[u+6]=b[k];this.positionArray[u+7]=b[k+1];this.positionArray[u+8]=b[k+2];this.normalArray[u]=c[h];this.normalArray[u+1]=c[h+1];this.normalArray[u+2]=c[h+2];this.normalArray[u+3]=c[m];this.normalArray[u+4]=c[m+1];this.normalArray[u+5]=c[m+2];this.normalArray[u+6]=c[k];this.normalArray[u+7]=c[k+1];this.normalArray[u+8]=c[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&n(this)};this.begin=function(){this.count=0;
 this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,h,m,k){var n=this.size*Math.sqrt(m/k),u=h*this.size,p=c*this.size,v=b*this.size,t=Math.floor(u-n);t<1&&(t=1);u=Math.floor(u+n);u>this.size-1&&(u=this.size-1);var x=Math.floor(p-n);x<1&&(x=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var w=Math.floor(v-n);w<1&&(w=1);n=Math.floor(v+n);n>this.size-1&&(n=this.size-
 this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,h,m,k){var n=this.size*Math.sqrt(m/k),u=h*this.size,p=c*this.size,v=b*this.size,t=Math.floor(u-n);t<1&&(t=1);u=Math.floor(u+n);u>this.size-1&&(u=this.size-1);var x=Math.floor(p-n);x<1&&(x=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var w=Math.floor(v-n);w<1&&(w=1);n=Math.floor(v+n);n>this.size-1&&(n=this.size-
-1);for(var z,y,A,E,D,G;t<u;t++){v=this.size2*t;y=t/this.size-h;D=y*y;for(y=x;y<p;y++){A=v+this.size*y;z=y/this.size-c;G=z*z;for(z=w;z<n;z++)E=z/this.size-b,E=m/(1.0E-6+E*E+G+D)-k,E>0&&(this.field[A+z]+=E)}}};this.addPlaneX=function(b,c){var h,m,k,n,u,p=this.size,v=this.yd,t=this.zd,x=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(h=0;h<w;h++)if(m=h/p,m*=m,n=b/(1.0E-4+m)-c,n>0)for(m=0;m<p;m++){u=h+m*v;for(k=0;k<p;k++)x[t*k+u]+=n}};this.addPlaneY=function(b,c){var h,m,k,n,u,p,v=this.size,t=this.yd,x=
+1);for(var z,y,A,E,D,F;t<u;t++){v=this.size2*t;y=t/this.size-h;D=y*y;for(y=x;y<p;y++){A=v+this.size*y;z=y/this.size-c;F=z*z;for(z=w;z<n;z++)E=z/this.size-b,E=m/(1.0E-6+E*E+F+D)-k,E>0&&(this.field[A+z]+=E)}}};this.addPlaneX=function(b,c){var h,m,k,n,u,p=this.size,v=this.yd,t=this.zd,x=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(h=0;h<w;h++)if(m=h/p,m*=m,n=b/(1.0E-4+m)-c,n>0)for(m=0;m<p;m++){u=h+m*v;for(k=0;k<p;k++)x[t*k+u]+=n}};this.addPlaneY=function(b,c){var h,m,k,n,u,p,v=this.size,t=this.yd,x=
 this.zd,w=this.field,z=v*Math.sqrt(b/c);z>v&&(z=v);for(m=0;m<z;m++)if(h=m/v,h*=h,n=b/(1.0E-4+h)-c,n>0){u=m*t;for(h=0;h<v;h++){p=u+h;for(k=0;k<v;k++)w[x*k+p]+=n}}};this.addPlaneZ=function(b,c){var h,m,k,n,u,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(k=0;k<dist;k++)if(h=k/size,h*=h,n=b/(1.0E-4+h)-c,n>0){u=zd*k;for(m=0;m<size;m++){p=u+m*yd;for(h=0;h<size;h++)field[p+h]+=n}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
 this.zd,w=this.field,z=v*Math.sqrt(b/c);z>v&&(z=v);for(m=0;m<z;m++)if(h=m/v,h*=h,n=b/(1.0E-4+h)-c,n>0){u=m*t;for(h=0;h<v;h++){p=u+h;for(k=0;k<v;k++)w[x*k+p]+=n}}};this.addPlaneZ=function(b,c){var h,m,k,n,u,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(k=0;k<dist;k++)if(h=k/size,h*=h,n=b/(1.0E-4+h)-c,n>0){u=zd*k;for(m=0;m<size;m++){p=u+m*yd;for(h=0;h<size;h++)field[p+h]+=n}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
 3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,h,m,k,n,u,p,v,t,x=this.size-2;for(k=1;k<x;k++){t=this.size2*k;p=(k-this.halfsize)/this.halfsize;for(m=1;m<x;m++){v=t+this.size*m;u=(m-this.halfsize)/this.halfsize;for(h=1;h<x;h++)n=(h-this.halfsize)/this.halfsize,c=v+h,this.polygonize(n,u,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(m){var k,n,u,p,v,t,x,w;for(k=0;k<m.count;k++)x=k*3,v=x+1,w=x+2,n=m.positionArray[x],
 3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,h,m,k,n,u,p,v,t,x=this.size-2;for(k=1;k<x;k++){t=this.size2*k;p=(k-this.halfsize)/this.halfsize;for(m=1;m<x;m++){v=t+this.size*m;u=(m-this.halfsize)/this.halfsize;for(h=1;h<x;h++)n=(h-this.halfsize)/this.halfsize,c=v+h,this.polygonize(n,u,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(m){var k,n,u,p,v,t,x,w;for(k=0;k<m.count;k++)x=k*3,v=x+1,w=x+2,n=m.positionArray[x],
 u=m.positionArray[v],p=m.positionArray[w],t=new THREE.Vector3(n,u,p),n=m.normalArray[x],u=m.normalArray[v],p=m.normalArray[w],x=new THREE.Vector3(n,u,p),x.normalize(),v=new THREE.Vertex(t),c.vertices.push(v),h.push(x);nfaces=m.count/3;for(k=0;k<nfaces;k++)x=(b+k)*3,v=x+1,w=x+2,t=h[x],n=h[v],u=h[w],x=new THREE.Face3(x,v,w,[t,n,u]),c.faces.push(x);b+=nfaces;m.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 u=m.positionArray[v],p=m.positionArray[w],t=new THREE.Vector3(n,u,p),n=m.normalArray[x],u=m.normalArray[v],p=m.normalArray[w],x=new THREE.Vector3(n,u,p),x.normalize(),v=new THREE.Vertex(t),c.vertices.push(v),h.push(x);nfaces=m.count/3;for(k=0;k<nfaces;k++)x=(b+k)*3,v=x+1,w=x+2,t=h[x],n=h[v],u=h[w],x=new THREE.Face3(x,v,w,[t,n,u]),c.faces.push(x);b+=nfaces;m.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
@@ -685,7 +685,7 @@ THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionU
 THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
 THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
 if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,m=new THREE.Camera,k=new THREE.Matrix4,n=new THREE.Matrix4,u,p,v;h.useTarget=m.useTarget=!1;h.matrixAutoUpdate=m.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.Camera(53,1,1,1E4);w.position.z=
 if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,m=new THREE.Camera,k=new THREE.Matrix4,n=new THREE.Matrix4,u,p,v;h.useTarget=m.useTarget=!1;h.matrixAutoUpdate=m.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.Camera(53,1,1,1E4);w.position.z=
 2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:x}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
 2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:x}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var z=new THREE.Scene;z.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(u!==e.aspect||p!==e.near||v!==e.fov){u=e.aspect;p=e.near;v=e.fov;var E=e.projectionMatrix.clone(),D=125/30*0.5,G=D*p/125,I=p*Math.tan(v*Math.PI/360),N;k.n14=D;n.n14=-D;D=-I*u+G;N=I*u+G;E.n11=2*p/(N-D);E.n13=(N+D)/(N-D);h.projectionMatrix=E.clone();D=-I*u-G;N=I*u-G;E.n11=2*p/(N-D);
+var z=new THREE.Scene;z.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(u!==e.aspect||p!==e.near||v!==e.fov){u=e.aspect;p=e.near;v=e.fov;var E=e.projectionMatrix.clone(),D=125/30*0.5,F=D*p/125,G=p*Math.tan(v*Math.PI/360),N;k.n14=D;n.n14=-D;D=-G*u+F;N=G*u+F;E.n11=2*p/(N-D);E.n13=(N+D)/(N-D);h.projectionMatrix=E.clone();D=-G*u-F;N=G*u-F;E.n11=2*p/(N-D);
 E.n13=(N+D)/(N-D);m.projectionMatrix=E.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=p;h.far=e.far;f.call(c,b,h,t,!0);m.matrix=e.matrixWorld.clone().multiplySelf(k);m.update(null,!0);m.position.copy(e.position);m.near=p;m.far=e.far;f.call(c,b,m,x,!0);f.call(c,z,w)}};
 E.n13=(N+D)/(N-D);m.projectionMatrix=E.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=p;h.far=e.far;f.call(c,b,h,t,!0);m.matrix=e.matrixWorld.clone().multiplySelf(k);m.update(null,!0);m.position.copy(e.position);m.near=p;m.far=e.far;f.call(c,b,m,x,!0);f.call(c,z,w)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,m,k=new THREE.Camera,n=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);h=b/2;m=f};this.render=function(b,e){this.clear();k.fov=e.fov;k.aspect=0.5*e.aspect;k.near=e.near;k.far=e.far;
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,m,k=new THREE.Camera,n=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);h=b/2;m=f};this.render=function(b,e){this.clear();k.fov=e.fov;k.aspect=0.5*e.aspect;k.near=e.near;k.far=e.far;
 k.updateProjectionMatrix();k.position.copy(e.position);k.target.position.copy(e.target.position);k.translateX(c.separation);n.projectionMatrix=k.projectionMatrix;n.position.copy(e.position);n.target.position.copy(e.target.position);n.translateX(-c.separation);this.setViewport(0,0,h,m);f.call(c,b,k);this.setViewport(h,0,h,m);f.call(c,b,n,!1)}};
 k.updateProjectionMatrix();k.position.copy(e.position);k.target.position.copy(e.target.position);k.translateX(c.separation);n.projectionMatrix=k.projectionMatrix;n.position.copy(e.position);n.target.position.copy(e.target.position);n.translateX(-c.separation);this.setViewport(0,0,h,m);f.call(c,b,k);this.setViewport(h,0,h,m);f.call(c,b,n,!1)}};

+ 181 - 181
build/custom/ThreeWebGL.js

@@ -1,6 +1,6 @@
 // ThreeWebGL.js r45dev - http://github.com/mrdoob/three.js
 // ThreeWebGL.js r45dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(b){b!==void 0&&this.setHex(b);return this};
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(b){b!==void 0&&this.setHex(b);return this};
-THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,d){this.r=b;this.g=c;this.b=d;return this},setHSV:function(b,c,d){var f,j,h;if(d==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),j=b*6-f,b=d*(1-c),h=d*(1-c*j),c=d*(1-c*(1-j)),f){case 1:this.r=h;this.g=d;this.b=b;break;case 2:this.r=b;this.g=d;this.b=c;break;case 3:this.r=b;this.g=h;this.b=d;break;case 4:this.r=c;this.g=b;this.b=d;break;case 5:this.r=
+THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,d){this.r=b;this.g=c;this.b=d;return this},setHSV:function(b,c,d){var f,i,h;if(d==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),i=b*6-f,b=d*(1-c),h=d*(1-c*i),c=d*(1-c*(1-i)),f){case 1:this.r=h;this.g=d;this.b=b;break;case 2:this.r=b;this.g=d;this.b=c;break;case 3:this.r=b;this.g=h;this.b=d;break;case 4:this.r=c;this.g=b;this.b=d;break;case 5:this.r=
 d;this.g=b;this.b=h;break;case 6:case 0:this.r=d,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
 d;this.g=b;this.b=h;break;case 6:case 0:this.r=d,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
 THREE.Vector2=function(b,c){this.x=b||0;this.y=c||0};
 THREE.Vector2=function(b,c){this.x=b||0;this.y=c||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},
@@ -15,86 +15,86 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(b,c,d,f){this.x=
 c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,f=[];c=0;for(d=b.length;c<d;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,c){return b.distance-c.distance});return f},intersectObject:function(b){function c(b,c,d){var f;f=d.clone().subSelf(b).dot(c);if(f<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(f));return d.distanceTo(b)}function d(b,c,d,f){var f=f.clone().subSelf(c),
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,f=[];c=0;for(d=b.length;c<d;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,c){return b.distance-c.distance});return f},intersectObject:function(b){function c(b,c,d){var f;f=d.clone().subSelf(b).dot(c);if(f<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(f));return d.distanceTo(b)}function d(b,c,d,f){var f=f.clone().subSelf(c),
-d=d.clone().subSelf(c),j=b.clone().subSelf(c),b=f.dot(f),c=f.dot(d),f=f.dot(j),h=d.dot(d),d=d.dot(j),j=1/(b*h-c*c),h=(h*f-c*d)*j,b=(b*d-c*f)*j;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,
-Math.max(b.scale.y,b.scale.z)))return[];var j,h,k,m,q,o,u,r,v,s,z=b.geometry,y=z.vertices,E=[],f=0;for(j=z.faces.length;f<j;f++)if(h=z.faces[f],v=this.origin.clone(),s=this.direction.clone(),o=b.matrixWorld,k=o.multiplyVector3(h.centroid.clone()).subSelf(v),r=k.dot(s),!(r<=0)&&(k=o.multiplyVector3(y[h.a].position.clone()),m=o.multiplyVector3(y[h.b].position.clone()),q=o.multiplyVector3(y[h.c].position.clone()),o=h instanceof THREE.Face4?o.multiplyVector3(y[h.d].position.clone()):null,u=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),
-r=s.dot(u),b.doubleSided||(b.flipSided?r>0:r<0)))if(r=u.dot((new THREE.Vector3).sub(k,v))/r,v=v.addSelf(s.multiplyScalar(r)),h instanceof THREE.Face3)d(v,k,m,q)&&(h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},E.push(h));else if(h instanceof THREE.Face4&&(d(v,k,m,o)||d(v,m,q,o)))h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},E.push(h);E.sort(function(b,c){return b.distance-c.distance});return E}else return[]}};
-THREE.Rectangle=function(){function b(){h=f-c;k=j-d}var c,d,f,j,h,k,m=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return j};this.set=function(h,k,u,r){m=!1;c=h;d=k;f=u;j=r;b()};this.addPoint=function(h,k){m?(m=!1,c=h,d=k,f=h,j=k):(c=c<h?c:h,d=d<k?d:k,f=f>h?f:h,j=j>k?j:k);b()};this.add3Points=
-function(h,k,u,r,v,s){m?(m=!1,c=h<u?h<v?h:v:u<v?u:v,d=k<r?k<s?k:s:r<s?r:s,f=h>u?h>v?h:v:u>v?u:v,j=k>r?k>s?k:s:r>s?r:s):(c=h<u?h<v?h<c?h:c:v<c?v:c:u<v?u<c?u:c:v<c?v:c,d=k<r?k<s?k<d?k:d:s<d?s:d:r<s?r<d?r:d:s<d?s:d,f=h>u?h>v?h>f?h:f:v>f?v:f:u>v?u>f?u:f:v>f?v:f,j=k>r?k>s?k>j?k:j:s>j?s:j:r>s?r>j?r:j:s>j?s:j);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),d=h.getTop(),f=h.getRight(),j=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),d=d<h.getTop()?d:h.getTop(),f=f>h.getRight()?f:h.getRight(),j=j>
-h.getBottom()?j:h.getBottom());b()};this.inflate=function(h){c-=h;d-=h;f+=h;j+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();f=f<h.getRight()?f:h.getRight();j=j<h.getBottom()?j:h.getBottom();b()};this.intersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(j,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){m=!0;j=f=d=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
+d=d.clone().subSelf(c),i=b.clone().subSelf(c),b=f.dot(f),c=f.dot(d),f=f.dot(i),h=d.dot(d),d=d.dot(i),i=1/(b*h-c*c),h=(h*f-c*d)*i,b=(b*d-c*f)*i;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,
+Math.max(b.scale.y,b.scale.z)))return[];var i,h,j,k,p,n,t,q,u,r,y=b.geometry,x=y.vertices,D=[],f=0;for(i=y.faces.length;f<i;f++)if(h=y.faces[f],u=this.origin.clone(),r=this.direction.clone(),n=b.matrixWorld,j=n.multiplyVector3(h.centroid.clone()).subSelf(u),q=j.dot(r),!(q<=0)&&(j=n.multiplyVector3(x[h.a].position.clone()),k=n.multiplyVector3(x[h.b].position.clone()),p=n.multiplyVector3(x[h.c].position.clone()),n=h instanceof THREE.Face4?n.multiplyVector3(x[h.d].position.clone()):null,t=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),
+q=r.dot(t),b.doubleSided||(b.flipSided?q>0:q<0)))if(q=t.dot((new THREE.Vector3).sub(j,u))/q,u=u.addSelf(r.multiplyScalar(q)),h instanceof THREE.Face3)d(u,j,k,p)&&(h={distance:this.origin.distanceTo(u),point:u,face:h,object:b},D.push(h));else if(h instanceof THREE.Face4&&(d(u,j,k,n)||d(u,k,p,n)))h={distance:this.origin.distanceTo(u),point:u,face:h,object:b},D.push(h);D.sort(function(b,c){return b.distance-c.distance});return D}else return[]}};
+THREE.Rectangle=function(){function b(){h=f-c;j=i-d}var c,d,f,i,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return i};this.set=function(h,j,t,q){k=!1;c=h;d=j;f=t;i=q;b()};this.addPoint=function(h,j){k?(k=!1,c=h,d=j,f=h,i=j):(c=c<h?c:h,d=d<j?d:j,f=f>h?f:h,i=i>j?i:j);b()};this.add3Points=
+function(h,j,t,q,u,r){k?(k=!1,c=h<t?h<u?h:u:t<u?t:u,d=j<q?j<r?j:r:q<r?q:r,f=h>t?h>u?h:u:t>u?t:u,i=j>q?j>r?j:r:q>r?q:r):(c=h<t?h<u?h<c?h:c:u<c?u:c:t<u?t<c?t:c:u<c?u:c,d=j<q?j<r?j<d?j:d:r<d?r:d:q<r?q<d?q:d:r<d?r:d,f=h>t?h>u?h>f?h:f:u>f?u:f:t>u?t>f?t:f:u>f?u:f,i=j>q?j>r?j>i?j:i:r>i?r:i:q>r?q>i?q:i:r>i?r:i);b()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),d=h.getTop(),f=h.getRight(),i=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),d=d<h.getTop()?d:h.getTop(),f=f>h.getRight()?f:h.getRight(),i=i>
+h.getBottom()?i:h.getBottom());b()};this.inflate=function(h){c-=h;d-=h;f+=h;i+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();f=f<h.getRight()?f:h.getRight();i=i<h.getBottom()?i:h.getBottom();b()};this.intersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(i,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){k=!0;i=f=d=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};
-THREE.Matrix4=function(b,c,d,f,j,h,k,m,q,o,u,r,v,s,z,y){this.set(b!==void 0?b:1,c||0,d||0,f||0,j||0,h!==void 0?h:1,k||0,m||0,q||0,o||0,u!==void 0?u:1,r||0,v||0,s||0,z||0,y!==void 0?y:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,f,j,h,k,m,q,o,u,r,v,s,z,y){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=j;this.n22=h;this.n23=k;this.n24=m;this.n31=q;this.n32=o;this.n33=u;this.n34=r;this.n41=v;this.n42=s;this.n43=z;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
-c,d){var f=THREE.Matrix4.__v1,j=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());j.cross(h,f).normalize();this.n11=f.x;this.n12=j.x;this.n13=h.x;this.n21=f.y;this.n22=j.y;this.n23=h.y;this.n31=f.z;this.n32=j.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,f=b.z,j=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)*j;
-b.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*j;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*j;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,j=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*j;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*j;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*j;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*j;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,j=b.n13,h=b.n14,k=b.n21,m=b.n22,q=b.n23,o=b.n24,u=b.n31,r=b.n32,v=b.n33,s=b.n34,z=b.n41,y=b.n42,E=b.n43,G=b.n44,va=c.n11,wa=
-c.n12,pa=c.n13,qa=c.n14,ha=c.n21,F=c.n22,w=c.n23,R=c.n24,O=c.n31,ia=c.n32,X=c.n33,xa=c.n34,S=c.n41,M=c.n42,e=c.n43,Ba=c.n44;this.n11=d*va+f*ha+j*O+h*S;this.n12=d*wa+f*F+j*ia+h*M;this.n13=d*pa+f*w+j*X+h*e;this.n14=d*qa+f*R+j*xa+h*Ba;this.n21=k*va+m*ha+q*O+o*S;this.n22=k*wa+m*F+q*ia+o*M;this.n23=k*pa+m*w+q*X+o*e;this.n24=k*qa+m*R+q*xa+o*Ba;this.n31=u*va+r*ha+v*O+s*S;this.n32=u*wa+r*F+v*ia+s*M;this.n33=u*pa+r*w+v*X+s*e;this.n34=u*qa+r*R+v*xa+s*Ba;this.n41=z*va+y*ha+E*O+G*S;this.n42=z*wa+y*F+E*ia+G*M;
-this.n43=z*pa+y*w+E*X+G*e;this.n44=z*qa+y*R+E*xa+G*Ba;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,j=this.n21,h=this.n22,k=this.n23,m=this.n24,q=this.n31,o=this.n32,u=this.n33,r=this.n34,v=this.n41,s=this.n42,z=this.n43,y=this.n44;return f*k*o*v-d*m*o*v-f*h*u*v+c*m*u*v+d*h*r*v-c*k*r*v-f*k*q*s+d*m*q*s+f*j*u*s-b*m*u*s-d*j*r*s+b*k*r*s+f*h*q*z-c*m*q*z-f*j*o*z+b*m*o*z+c*j*r*z-b*h*r*z-
-d*h*q*y+c*k*q*y+d*j*o*y-b*k*o*y-c*j*u*y+b*h*u*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;
-b.n32=this.n32;b.n33=this.n33;b.n34=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]=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),j=1-d,h=b.x,k=b.y,m=b.z,q=j*h,o=j*k;this.set(q*h+d,q*k-f*m,q*m+f*k,0,q*k+f*m,o*k+d,o*m-f*h,0,q*m-f*k,o*m+f*h,j*m*m+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},getColumnX:function(){if(!this.columnX)this.columnX=
-new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,f=b.y,j=b.z,h=Math.cos(d),d=Math.sin(d),k=Math.cos(f),f=Math.sin(f),m=Math.cos(j),j=Math.sin(j);switch(c){case "YXZ":var q=
-k*m,o=k*j,u=f*m,r=f*j;this.n11=q+r*d;this.n12=u*d-o;this.n13=h*f;this.n21=h*j;this.n22=h*m;this.n23=-d;this.n31=o*d-u;this.n32=r+q*d;this.n33=h*k;break;case "ZXY":q=k*m;o=k*j;u=f*m;r=f*j;this.n11=q-r*d;this.n12=-h*j;this.n13=u+o*d;this.n21=o+u*d;this.n22=h*m;this.n23=r-q*d;this.n31=-h*f;this.n32=d;this.n33=h*k;break;case "ZYX":q=h*m;o=h*j;u=d*m;r=d*j;this.n11=k*m;this.n12=u*f-o;this.n13=q*f+r;this.n21=k*j;this.n22=r*f+q;this.n23=o*f-u;this.n31=-f;this.n32=d*k;this.n33=h*k;break;case "YZX":q=h*k;o=
-h*f;u=d*k;r=d*f;this.n11=k*m;this.n12=r-q*j;this.n13=u*j+o;this.n21=j;this.n22=h*m;this.n23=-d*m;this.n31=-f*m;this.n32=o*j+u;this.n33=q-r*j;break;case "XZY":q=h*k;o=h*f;u=d*k;r=d*f;this.n11=k*m;this.n12=-j;this.n13=f*m;this.n21=q*j+r;this.n22=h*m;this.n23=o*j-u;this.n31=u*j-o;this.n32=d*m;this.n33=r*j+q;break;default:q=h*m,o=h*j,u=d*m,r=d*j,this.n11=k*m,this.n12=-k*j,this.n13=f,this.n21=o+u*f,this.n22=q-r*f,this.n23=-d*k,this.n31=r-q*f,this.n32=u+o*f,this.n33=h*k}return this},setRotationFromQuaternion:function(b){var c=
-b.x,d=b.y,f=b.z,j=b.w,h=c+c,k=d+d,m=f+f,b=c*h,q=c*k;c*=m;var o=d*k;d*=m;f*=m;h*=j;k*=j;j*=m;this.n11=1-(o+f);this.n12=q-j;this.n13=c+k;this.n21=q+j;this.n22=1-(b+f);this.n23=d-h;this.n31=c-k;this.n32=d+h;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var f=THREE.Matrix4.__m1,j=THREE.Matrix4.__m2;
-f.identity();f.setRotationFromQuaternion(c);j.setScale(d.x,d.y,d.z);this.multiply(f,j);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var f=THREE.Matrix4.__v1,j=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);j.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=f.length();
-d.y=j.length();d.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=d.x;f.n21/=d.x;f.n31/=d.x;f.n12/=d.y;f.n22/=d.y;f.n32/=d.y;f.n13/=d.z;f.n23/=d.z;f.n33/=d.z;c.setFromRotationMatrix(f);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,f=1/c.y,j=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*j;this.n23=
-b.n23*j;this.n33=b.n33*j}};
-THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,q=b.n23,o=b.n24,u=b.n31,r=b.n32,v=b.n33,s=b.n34,z=b.n41,y=b.n42,E=b.n43,G=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=q*s*y-o*v*y+o*r*E-m*s*E-q*r*G+m*v*G;c.n12=h*v*y-j*s*y-h*r*E+f*s*E+j*r*G-f*v*G;c.n13=j*o*y-h*q*y+h*m*E-f*o*E-j*m*G+f*q*G;c.n14=h*q*r-j*o*r-h*m*v+f*o*v+j*m*s-f*q*s;c.n21=o*v*z-q*s*z-o*u*E+k*s*E+q*u*G-k*v*G;c.n22=j*s*z-h*v*z+h*u*E-d*s*E-j*u*G+d*v*G;c.n23=h*q*z-j*o*z-h*k*E+d*o*E+j*k*G-d*q*G;c.n24=
-j*o*u-h*q*u+h*k*v-d*o*v-j*k*s+d*q*s;c.n31=m*s*z-o*r*z+o*u*y-k*s*y-m*u*G+k*r*G;c.n32=h*r*z-f*s*z-h*u*y+d*s*y+f*u*G-d*r*G;c.n33=j*o*z-h*m*z+h*k*y-d*o*y-f*k*G+d*m*G;c.n34=h*m*u-f*o*u-h*k*r+d*o*r+f*k*s-d*m*s;c.n41=q*r*z-m*v*z-q*u*y+k*v*y+m*u*E-k*r*E;c.n42=f*v*z-j*r*z+j*u*y-d*v*y-f*u*E+d*r*E;c.n43=j*m*z-f*q*z-j*k*y+d*q*y+f*k*E-d*m*E;c.n44=f*q*u-j*m*u+j*k*r-d*q*r-f*k*v+d*m*v;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,j=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,q=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,u=-b.n23*b.n11+b.n21*b.n13,r=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*f;d[1]=b*j;d[2]=b*h;d[3]=b*k;d[4]=b*m;d[5]=b*q;d[6]=b*o;d[7]=b*u;d[8]=b*r;return c};
-THREE.Matrix4.makeFrustum=function(b,c,d,f,j,h){var k;k=new THREE.Matrix4;k.n11=2*j/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*j/(f-d);k.n23=(f+d)/(f-d);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+j)/(h-j);k.n34=-2*h*j/(h-j);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,d,f){var j,b=d*Math.tan(b*Math.PI/360);j=-b;return THREE.Matrix4.makeFrustum(j*c,b*c,j,b,d,f)};
-THREE.Matrix4.makeOrtho=function(b,c,d,f,j,h){var k,m,q,o;k=new THREE.Matrix4;m=c-b;q=d-f;o=h-j;k.n11=2/m;k.n12=0;k.n13=0;k.n14=-((c+b)/m);k.n21=0;k.n22=2/q;k.n23=0;k.n24=-((d+f)/q);k.n31=0;k.n32=0;k.n33=-2/o;k.n34=-((h+j)/o);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4=function(b,c,d,f,i,h,j,k,p,n,t,q,u,r,y,x){this.set(b!==void 0?b:1,c||0,d||0,f||0,i||0,h!==void 0?h:1,j||0,k||0,p||0,n||0,t!==void 0?t:1,q||0,u||0,r||0,y||0,x!==void 0?x:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,f,i,h,j,k,p,n,t,q,u,r,y,x){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=i;this.n22=h;this.n23=j;this.n24=k;this.n31=p;this.n32=n;this.n33=t;this.n34=q;this.n41=u;this.n42=r;this.n43=y;this.n44=x;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
+c,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+
+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,p=b.n23,n=b.n24,t=b.n31,q=b.n32,u=b.n33,r=b.n34,y=b.n41,x=b.n42,D=b.n43,F=b.n44,wa=c.n11,xa=
+c.n12,oa=c.n13,qa=c.n14,ga=c.n21,E=c.n22,v=c.n23,ha=c.n24,O=c.n31,ia=c.n32,X=c.n33,ta=c.n34,P=c.n41,L=c.n42,e=c.n43,Ba=c.n44;this.n11=d*wa+f*ga+i*O+h*P;this.n12=d*xa+f*E+i*ia+h*L;this.n13=d*oa+f*v+i*X+h*e;this.n14=d*qa+f*ha+i*ta+h*Ba;this.n21=j*wa+k*ga+p*O+n*P;this.n22=j*xa+k*E+p*ia+n*L;this.n23=j*oa+k*v+p*X+n*e;this.n24=j*qa+k*ha+p*ta+n*Ba;this.n31=t*wa+q*ga+u*O+r*P;this.n32=t*xa+q*E+u*ia+r*L;this.n33=t*oa+q*v+u*X+r*e;this.n34=t*qa+q*ha+u*ta+r*Ba;this.n41=y*wa+x*ga+D*O+F*P;this.n42=y*xa+x*E+D*ia+
+F*L;this.n43=y*oa+x*v+D*X+F*e;this.n44=y*qa+x*ha+D*ta+F*Ba;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,p=this.n31,n=this.n32,t=this.n33,q=this.n34,u=this.n41,r=this.n42,y=this.n43,x=this.n44;return f*j*n*u-d*k*n*u-f*h*t*u+c*k*t*u+d*h*q*u-c*j*q*u-f*j*p*r+d*k*p*r+f*i*t*r-b*k*t*r-d*i*q*r+b*j*q*r+f*h*p*y-c*k*p*y-f*i*n*y+b*k*n*y+c*i*q*
+y-b*h*q*y-d*h*p*x+c*j*p*x+d*i*n*x-b*j*n*x-c*i*t*x+b*h*t*x},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]=
+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,p=i*h,n=i*j;this.set(p*h+d,p*j-f*k,p*k+f*j,0,p*j+f*k,n*j+d,n*k-f*h,0,p*k-f*j,n*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},
+getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,f=b.y,i=b.z,h=Math.cos(d),d=Math.sin(d),j=Math.cos(f),
+f=Math.sin(f),k=Math.cos(i),i=Math.sin(i);switch(c){case "YXZ":var p=j*k,n=j*i,t=f*k,q=f*i;this.n11=p+q*d;this.n12=t*d-n;this.n13=h*f;this.n21=h*i;this.n22=h*k;this.n23=-d;this.n31=n*d-t;this.n32=q+p*d;this.n33=h*j;break;case "ZXY":p=j*k;n=j*i;t=f*k;q=f*i;this.n11=p-q*d;this.n12=-h*i;this.n13=t+n*d;this.n21=n+t*d;this.n22=h*k;this.n23=q-p*d;this.n31=-h*f;this.n32=d;this.n33=h*j;break;case "ZYX":p=h*k;n=h*i;t=d*k;q=d*i;this.n11=j*k;this.n12=t*f-n;this.n13=p*f+q;this.n21=j*i;this.n22=q*f+p;this.n23=
+n*f-t;this.n31=-f;this.n32=d*j;this.n33=h*j;break;case "YZX":p=h*j;n=h*f;t=d*j;q=d*f;this.n11=j*k;this.n12=q-p*i;this.n13=t*i+n;this.n21=i;this.n22=h*k;this.n23=-d*k;this.n31=-f*k;this.n32=n*i+t;this.n33=p-q*i;break;case "XZY":p=h*j;n=h*f;t=d*j;q=d*f;this.n11=j*k;this.n12=-i;this.n13=f*k;this.n21=p*i+q;this.n22=h*k;this.n23=n*i-t;this.n31=t*i-n;this.n32=d*k;this.n33=q*i+p;break;default:p=h*k,n=h*i,t=d*k,q=d*i,this.n11=j*k,this.n12=-j*i,this.n13=f,this.n21=n+t*f,this.n22=p-q*f,this.n23=-d*j,this.n31=
+q-p*f,this.n32=t+n*f,this.n33=h*j}return this},setRotationFromQuaternion:function(b){var c=b.x,d=b.y,f=b.z,i=b.w,h=c+c,j=d+d,k=f+f,b=c*h,p=c*j;c*=k;var n=d*j;d*=k;f*=k;h*=i;j*=i;i*=k;this.n11=1-(n+f);this.n12=p-i;this.n13=c+j;this.n21=p+i;this.n22=1-(b+f);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+n);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=
+b;return this},compose:function(b,c,d){var f=THREE.Matrix4.__m1,i=THREE.Matrix4.__m2;f.identity();f.setRotationFromQuaternion(c);i.setScale(d.x,d.y,d.z);this.multiply(f,i);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var f=THREE.Matrix4.__v1,i=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);i.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:
+new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=f.length();d.y=i.length();d.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=d.x;f.n21/=d.x;f.n31/=d.x;f.n12/=d.y;f.n22/=d.y;f.n32/=d.y;f.n13/=d.z;f.n23/=d.z;f.n33/=d.z;c.setFromRotationMatrix(f);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,f=1/c.y,i=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=
+b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*i;this.n23=b.n23*i;this.n33=b.n33*i}};
+THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,i=b.n13,h=b.n14,j=b.n21,k=b.n22,p=b.n23,n=b.n24,t=b.n31,q=b.n32,u=b.n33,r=b.n34,y=b.n41,x=b.n42,D=b.n43,F=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*r*x-n*u*x+n*q*D-k*r*D-p*q*F+k*u*F;c.n12=h*u*x-i*r*x-h*q*D+f*r*D+i*q*F-f*u*F;c.n13=i*n*x-h*p*x+h*k*D-f*n*D-i*k*F+f*p*F;c.n14=h*p*q-i*n*q-h*k*u+f*n*u+i*k*r-f*p*r;c.n21=n*u*y-p*r*y-n*t*D+j*r*D+p*t*F-j*u*F;c.n22=i*r*y-h*u*y+h*t*D-d*r*D-i*t*F+d*u*F;c.n23=h*p*y-i*n*y-h*j*D+d*n*D+i*j*F-d*p*F;c.n24=
+i*n*t-h*p*t+h*j*u-d*n*u-i*j*r+d*p*r;c.n31=k*r*y-n*q*y+n*t*x-j*r*x-k*t*F+j*q*F;c.n32=h*q*y-f*r*y-h*t*x+d*r*x+f*t*F-d*q*F;c.n33=i*n*y-h*k*y+h*j*x-d*n*x-f*j*F+d*k*F;c.n34=h*k*t-f*n*t-h*j*q+d*n*q+f*j*r-d*k*r;c.n41=p*q*y-k*u*y-p*t*x+j*u*x+k*t*D-j*q*D;c.n42=f*u*y-i*q*y+i*t*x-d*u*x-f*t*D+d*q*D;c.n43=i*k*y-f*p*y-i*j*x+d*p*x+f*j*D-d*k*D;c.n44=f*p*t-i*k*t+i*j*q-d*p*q-f*j*u+d*k*u;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,i=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,n=b.n23*b.n12-b.n22*b.n13,t=-b.n23*b.n11+b.n21*b.n13,q=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*j+b.n31*n;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*f;d[1]=b*i;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*p;d[6]=b*n;d[7]=b*t;d[8]=b*q;return c};
+THREE.Matrix4.makeFrustum=function(b,c,d,f,i,h){var j;j=new THREE.Matrix4;j.n11=2*i/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*i/(f-d);j.n23=(f+d)/(f-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+i)/(h-i);j.n34=-2*h*i/(h-i);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,f){var i,b=d*Math.tan(b*Math.PI/360);i=-b;return THREE.Matrix4.makeFrustum(i*c,b*c,i,b,d,f)};
+THREE.Matrix4.makeOrtho=function(b,c,d,f,i,h){var j,k,p,n;j=new THREE.Matrix4;k=c-b;p=d-f;n=h-i;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((d+f)/p);j.n31=0;j.n32=0;j.n33=-2/n;j.n34=-((h+i)/n);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.children.indexOf(b)===
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.children.indexOf(b)===
--1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},remove:function(b){var c=this,d=this.children.indexOf(b);if(d!==-1){b.parent=void 0;for(this.children.splice(d,1);c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeChildRecurse(b)}},getChildByName:function(b,c){var d,f,j;d=0;for(f=this.children.length;d<f;d++){j=this.children[d];if(j.name===
-b)return j;if(c&&(j=j.getChildByName(b,c),j!==void 0))return j}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,d){this.matrixAutoUpdate&&
+-1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},remove:function(b){var c=this,d=this.children.indexOf(b);if(d!==-1){b.parent=void 0;for(this.children.splice(d,1);c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeChildRecurse(b)}},getChildByName:function(b,c){var d,f,i;d=0;for(f=this.children.length;d<f;d++){i=this.children[d];if(i.name===
+b)return i;if(c&&(i=i.getChildByName(b,c),i!==void 0))return i}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,d){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,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[m]=q[m]||new THREE.RenderableVertex;m++;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,j=c.z+c.w,h=-b.z+b.w,k=-c.z+c.w;return f>=0&&j>=0&&h>=0&&k>=0?!0:f<0&&j<0||h<0&&k<0?!1:(f<0?d=Math.max(d,f/(f-j)):j<0&&(e=Math.min(e,f/(f-j))),h<0?d=Math.max(d,h/(h-k)):k<0&&(e=Math.min(e,h/(h-k))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,j,h=[],k,m,q=[],o,u,r=[],v,s=[],z,y,E=[],G,va,wa=[],pa=[],qa=[],ha=new THREE.Vector4,
-F=new THREE.Vector4,w=new THREE.Matrix4,R=new THREE.Matrix4,O=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ia=new THREE.Vector4,X=new THREE.Vector4;this.projectVector=function(b,c){w.multiply(c.projectionMatrix,c.matrixWorldInverse);w.multiplyVector3(b);return b};this.unprojectVector=function(b,c){w.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));w.multiplyVector3(b);return b};this.projectObjects=function(b,d,k){var e,
-m;j=pa.length=0;e=b.objects;b=0;for(d=e.length;b<d;b++){m=e[b];var o;if(!(o=!m.visible))if(o=m instanceof THREE.Mesh)if(o=m.frustumCulled){a:{o=void 0;for(var q=m.matrixWorld,u=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),r=0;r<6;r++)if(o=O[r].x*q.n14+O[r].y*q.n24+O[r].z*q.n34+O[r].w,o<=u){o=!1;break a}o=!0}o=!o}if(!o)o=h[j]=h[j]||new THREE.RenderableObject,j++,f=o,ha.copy(m.position),w.multiplyVector3(ha),f.object=m,f.z=ha.z,pa.push(f)}k&&pa.sort(c);return pa};
-this.projectScene=function(f,j,h){var e=j.near,pa=j.far,ha,ua,Y,ra,I,T,P,ka,fa,K,ya,za,Ea,Da,Q,ta,Ca;va=y=v=u=qa.length=0;j.matrixAutoUpdate&&j.update(void 0,!0);f.update(void 0,!1,j);w.multiply(j.projectionMatrix,j.matrixWorldInverse);O[0].set(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);O[1].set(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,w.n44+w.n14);O[2].set(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);O[3].set(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);O[4].set(w.n41-w.n31,w.n42-w.n32,
-w.n43-w.n33,w.n44-w.n34);O[5].set(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);for(ha=0;ha<6;ha++)fa=O[ha],fa.divideScalar(Math.sqrt(fa.x*fa.x+fa.y*fa.y+fa.z*fa.z));fa=this.projectObjects(f,j,!0);f=0;for(ha=fa.length;f<ha;f++)if(K=fa[f].object,K.visible)if(ya=K.matrixWorld,za=K.matrixRotationWorld,Ea=K.materials,Da=K.overdraw,m=0,K instanceof THREE.Mesh){Q=K.geometry;ra=Q.vertices;ta=Q.faces;Q=Q.faceVertexUvs;ua=0;for(Y=ra.length;ua<Y;ua++)k=b(),k.positionWorld.copy(ra[ua].position),ya.multiplyVector3(k.positionWorld),
-k.positionScreen.copy(k.positionWorld),w.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>e&&k.positionScreen.z<pa;ra=0;for(ua=ta.length;ra<ua;ra++){Y=ta[ra];if(Y instanceof THREE.Face3)if(I=q[Y.a],T=q[Y.b],P=q[Y.c],I.visible&&T.visible&&P.visible&&(K.doubleSided||K.flipSided!=(P.positionScreen.x-I.positionScreen.x)*(T.positionScreen.y-I.positionScreen.y)-(P.positionScreen.y-I.positionScreen.y)*(T.positionScreen.x-
-I.positionScreen.x)<0))ka=r[u]=r[u]||new THREE.RenderableFace3,u++,o=ka,o.v1.copy(I),o.v2.copy(T),o.v3.copy(P);else continue;else if(Y instanceof THREE.Face4)if(I=q[Y.a],T=q[Y.b],P=q[Y.c],ka=q[Y.d],I.visible&&T.visible&&P.visible&&ka.visible&&(K.doubleSided||K.flipSided!=((ka.positionScreen.x-I.positionScreen.x)*(T.positionScreen.y-I.positionScreen.y)-(ka.positionScreen.y-I.positionScreen.y)*(T.positionScreen.x-I.positionScreen.x)<0||(T.positionScreen.x-P.positionScreen.x)*(ka.positionScreen.y-P.positionScreen.y)-
-(T.positionScreen.y-P.positionScreen.y)*(ka.positionScreen.x-P.positionScreen.x)<0)))Ca=s[v]=s[v]||new THREE.RenderableFace4,v++,o=Ca,o.v1.copy(I),o.v2.copy(T),o.v3.copy(P),o.v4.copy(ka);else continue;o.normalWorld.copy(Y.normal);za.multiplyVector3(o.normalWorld);o.centroidWorld.copy(Y.centroid);ya.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);w.multiplyVector3(o.centroidScreen);P=Y.vertexNormals;I=0;for(T=P.length;I<T;I++)ka=o.vertexNormalsWorld[I],ka.copy(P[I]),za.multiplyVector3(ka);
-I=0;for(T=Q.length;I<T;I++)if(Ca=Q[I][ra]){P=0;for(ka=Ca.length;P<ka;P++)o.uvs[I][P]=Ca[P]}o.meshMaterials=Ea;o.faceMaterials=Y.materials;o.overdraw=Da;o.z=o.centroidScreen.z;qa.push(o)}}else if(K instanceof THREE.Line){R.multiply(w,ya);ra=K.geometry.vertices;I=b();I.positionScreen.copy(ra[0].position);R.multiplyVector4(I.positionScreen);ua=1;for(Y=ra.length;ua<Y;ua++)if(I=b(),I.positionScreen.copy(ra[ua].position),R.multiplyVector4(I.positionScreen),T=q[m-2],ia.copy(I.positionScreen),X.copy(T.positionScreen),
-d(ia,X))ia.multiplyScalar(1/ia.w),X.multiplyScalar(1/X.w),ya=E[y]=E[y]||new THREE.RenderableLine,y++,z=ya,z.v1.positionScreen.copy(ia),z.v2.positionScreen.copy(X),z.z=Math.max(ia.z,X.z),z.materials=K.materials,qa.push(z)}else if(K instanceof THREE.Particle&&(F.set(K.matrixWorld.n14,K.matrixWorld.n24,K.matrixWorld.n34,1),w.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))ya=wa[va]=wa[va]||new THREE.RenderableParticle,va++,G=ya,G.x=F.x/F.w,G.y=F.y/F.w,G.z=F.z,G.rotation=K.rotation.z,G.scale.x=K.scale.x*Math.abs(G.x-
-(F.x+j.projectionMatrix.n11)/(F.w+j.projectionMatrix.n14)),G.scale.y=K.scale.y*Math.abs(G.y-(F.y+j.projectionMatrix.n22)/(F.w+j.projectionMatrix.n24)),G.materials=K.materials,qa.push(G);h&&qa.sort(c);return qa}};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=0.5*Math.PI/360,d=b.x*c,f=b.y*c,j=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-j),j=Math.sin(-j),h=Math.cos(d),d=Math.sin(d),k=b*c,m=f*j;this.w=k*h-m*d;this.x=k*d+m*h;this.y=f*c*h+b*j*d;this.z=b*j*h-f*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,f=Math.sin(d);
+THREE.Projector=function(){function b(){var b=p[k]=p[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,e=1,f=b.z+b.w,i=c.z+c.w,h=-b.z+b.w,j=-c.z+c.w;return f>=0&&i>=0&&h>=0&&j>=0?!0:f<0&&i<0||h<0&&j<0?!1:(f<0?d=Math.max(d,f/(f-i)):i<0&&(e=Math.min(e,f/(f-i))),h<0?d=Math.max(d,h/(h-j)):j<0&&(e=Math.min(e,h/(h-j))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,i,h=[],j,k,p=[],n,t,q=[],u,r=[],y,x,D=[],F,wa,xa=[],oa=[],qa=[],ga=new THREE.Vector4,
+E=new THREE.Vector4,v=new THREE.Matrix4,ha=new THREE.Matrix4,O=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ia=new THREE.Vector4,X=new THREE.Vector4;this.projectVector=function(b,c){v.multiply(c.projectionMatrix,c.matrixWorldInverse);v.multiplyVector3(b);return b};this.unprojectVector=function(b,c){v.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));v.multiplyVector3(b);return b};this.projectObjects=function(b,d,j){var e,
+k;i=oa.length=0;e=b.objects;b=0;for(d=e.length;b<d;b++){k=e[b];var n;if(!(n=!k.visible))if(n=k instanceof THREE.Mesh)if(n=k.frustumCulled){a:{n=void 0;for(var p=k.matrixWorld,t=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),q=0;q<6;q++)if(n=O[q].x*p.n14+O[q].y*p.n24+O[q].z*p.n34+O[q].w,n<=t){n=!1;break a}n=!0}n=!n}if(!n)n=h[i]=h[i]||new THREE.RenderableObject,i++,f=n,ga.copy(k.position),v.multiplyVector3(ga),f.object=k,f.z=ga.z,oa.push(f)}j&&oa.sort(c);return oa};
+this.projectScene=function(f,i,h){var e=i.near,oa=i.far,ga,ua,S,Y,H,V,R,U,va,J,ra,Fa,ya,Da,Q,za,Ca;wa=x=u=t=qa.length=0;i.matrixAutoUpdate&&i.update(void 0,!0);f.update(void 0,!1,i);v.multiply(i.projectionMatrix,i.matrixWorldInverse);O[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);O[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);O[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);O[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);O[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-
+v.n33,v.n44-v.n34);O[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(ga=0;ga<6;ga++)va=O[ga],va.divideScalar(Math.sqrt(va.x*va.x+va.y*va.y+va.z*va.z));va=this.projectObjects(f,i,!0);f=0;for(ga=va.length;f<ga;f++)if(J=va[f].object,J.visible)if(ra=J.matrixWorld,Fa=J.matrixRotationWorld,ya=J.materials,Da=J.overdraw,k=0,J instanceof THREE.Mesh){Q=J.geometry;Y=Q.vertices;za=Q.faces;Q=Q.faceVertexUvs;ua=0;for(S=Y.length;ua<S;ua++)j=b(),j.positionWorld.copy(Y[ua].position),ra.multiplyVector3(j.positionWorld),
+j.positionScreen.copy(j.positionWorld),v.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>e&&j.positionScreen.z<oa;Y=0;for(ua=za.length;Y<ua;Y++){S=za[Y];if(S instanceof THREE.Face3)if(H=p[S.a],V=p[S.b],R=p[S.c],H.visible&&V.visible&&R.visible&&(J.doubleSided||J.flipSided!=(R.positionScreen.x-H.positionScreen.x)*(V.positionScreen.y-H.positionScreen.y)-(R.positionScreen.y-H.positionScreen.y)*(V.positionScreen.x-
+H.positionScreen.x)<0))U=q[t]=q[t]||new THREE.RenderableFace3,t++,n=U,n.v1.copy(H),n.v2.copy(V),n.v3.copy(R);else continue;else if(S instanceof THREE.Face4)if(H=p[S.a],V=p[S.b],R=p[S.c],U=p[S.d],H.visible&&V.visible&&R.visible&&U.visible&&(J.doubleSided||J.flipSided!=((U.positionScreen.x-H.positionScreen.x)*(V.positionScreen.y-H.positionScreen.y)-(U.positionScreen.y-H.positionScreen.y)*(V.positionScreen.x-H.positionScreen.x)<0||(V.positionScreen.x-R.positionScreen.x)*(U.positionScreen.y-R.positionScreen.y)-
+(V.positionScreen.y-R.positionScreen.y)*(U.positionScreen.x-R.positionScreen.x)<0)))Ca=r[u]=r[u]||new THREE.RenderableFace4,u++,n=Ca,n.v1.copy(H),n.v2.copy(V),n.v3.copy(R),n.v4.copy(U);else continue;n.normalWorld.copy(S.normal);Fa.multiplyVector3(n.normalWorld);n.centroidWorld.copy(S.centroid);ra.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);v.multiplyVector3(n.centroidScreen);R=S.vertexNormals;H=0;for(V=R.length;H<V;H++)U=n.vertexNormalsWorld[H],U.copy(R[H]),Fa.multiplyVector3(U);
+H=0;for(V=Q.length;H<V;H++)if(Ca=Q[H][Y]){R=0;for(U=Ca.length;R<U;R++)n.uvs[H][R]=Ca[R]}n.meshMaterials=ya;n.faceMaterials=S.materials;n.overdraw=Da;n.z=n.centroidScreen.z;qa.push(n)}}else if(J instanceof THREE.Line){ha.multiply(v,ra);Y=J.geometry.vertices;H=b();H.positionScreen.copy(Y[0].position);ha.multiplyVector4(H.positionScreen);ua=1;for(S=Y.length;ua<S;ua++)if(H=b(),H.positionScreen.copy(Y[ua].position),ha.multiplyVector4(H.positionScreen),V=p[k-2],ia.copy(H.positionScreen),X.copy(V.positionScreen),
+d(ia,X))ia.multiplyScalar(1/ia.w),X.multiplyScalar(1/X.w),ra=D[x]=D[x]||new THREE.RenderableLine,x++,y=ra,y.v1.positionScreen.copy(ia),y.v2.positionScreen.copy(X),y.z=Math.max(ia.z,X.z),y.materials=J.materials,qa.push(y)}else if(J instanceof THREE.Particle&&(E.set(J.matrixWorld.n14,J.matrixWorld.n24,J.matrixWorld.n34,1),v.multiplyVector4(E),E.z/=E.w,E.z>0&&E.z<1))ra=xa[wa]=xa[wa]||new THREE.RenderableParticle,wa++,F=ra,F.x=E.x/E.w,F.y=E.y/E.w,F.z=E.z,F.rotation=J.rotation.z,F.scale.x=J.scale.x*Math.abs(F.x-
+(E.x+i.projectionMatrix.n11)/(E.w+i.projectionMatrix.n14)),F.scale.y=J.scale.y*Math.abs(F.y-(E.y+i.projectionMatrix.n22)/(E.w+i.projectionMatrix.n24)),F.materials=J.materials,qa.push(F);h&&qa.sort(c);return qa}};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=0.5*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,j=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+j*h+d*m-f*k;this.y=d*b+j*k+f*h-c*m;this.z=f*b+j*m+c*k-d*h;this.w=j*b-c*h-d*k-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,j=b.z,h=this.x,k=this.y,m=this.z,q=this.w,o=q*d+k*j-m*f,u=q*f+m*d-h*j,r=q*j+h*f-k*d,d=-h*
-d-k*f-m*j;c.x=o*q+d*-h+u*-m-r*-k;c.y=u*q+d*-k+r*-h-o*-m;c.z=r*q+d*-m+o*-k-u*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var j=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(j)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(j),k=Math.sqrt(1-j*j);if(Math.abs(k)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;j=Math.sin((1-f)*h)/k;f=Math.sin(f*h)/k;d.w=b.w*j+c.w*f;d.x=b.x*j+c.x*f;d.y=b.y*j+c.y*f;d.z=b.z*j+c.z*f;return d};
-THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,f,j,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
-THREE.Face4=function(b,c,d,f,j,h,k){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
+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,p=this.w,n=p*d+j*i-k*f,t=p*f+k*d-h*i,q=p*i+h*f-j*d,d=-h*
+d-j*f-k*i;c.x=n*p+d*-h+t*-k-q*-j;c.y=t*p+d*-j+q*-h-n*-k;c.z=q*p+d*-k+n*-j-t*-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.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.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.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
-THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(b){var c=new THREE.Matrix4;c.extractRotation(b,new THREE.Vector3(1,1,1));for(var d=0,f=this.vertices.length;d<f;d++)b.multiplyVector3(this.vertices[d].position);d=0;for(f=this.faces.length;d<f;d++){var j=this.faces[d];c.multiplyVector3(j.normal);for(var h=0,k=j.vertexNormals.length;h<k;h++)c.multiplyVector3(j.vertexNormals[h]);b.multiplyVector3(j.centroid)}},computeCentroids:function(){var b,c,d;b=0;for(c=this.faces.length;b<
+THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(b){var c=new THREE.Matrix4;c.extractRotation(b,new THREE.Vector3(1,1,1));for(var d=0,f=this.vertices.length;d<f;d++)b.multiplyVector3(this.vertices[d].position);d=0;for(f=this.faces.length;d<f;d++){var i=this.faces[d];c.multiplyVector3(i.normal);for(var h=0,j=i.vertexNormals.length;h<j;h++)c.multiplyVector3(i.vertexNormals[h]);b.multiplyVector3(i.centroid)}},computeCentroids:function(){var b,c,d;b=0;for(c=this.faces.length;b<
 c;b++)d=this.faces[b],d.centroid.set(0,0,0),d instanceof THREE.Face3?(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.divideScalar(3)):d instanceof THREE.Face4&&(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,
 c;b++)d=this.faces[b],d.centroid.set(0,0,0),d instanceof THREE.Face3?(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.divideScalar(3)):d instanceof THREE.Face4&&(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,
-d,f,j,h,k,m=new THREE.Vector3,q=new THREE.Vector3;f=0;for(j=this.faces.length;f<j;f++){h=this.faces[f];if(b&&h.vertexNormals.length){m.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)m.addSelf(h.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[h.a],d=this.vertices[h.b],k=this.vertices[h.c],m.sub(k.position,d.position),q.sub(c.position,d.position),m.crossSelf(q);m.isZero()||m.normalize();h.normal.copy(m)}},computeVertexNormals:function(){var b,c,d,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
+d,f,i,h,j,k=new THREE.Vector3,p=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),p.sub(c.position,d.position),k.crossSelf(p);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,j,h){m=b.vertices[e].position;q=b.vertices[c].position;o=b.vertices[d].position;u=k[f];r=k[j];v=k[h];s=q.x-m.x;z=o.x-m.x;y=q.y-m.y;E=o.y-m.y;G=q.z-m.z;va=o.z-m.z;wa=r.u-u.u;pa=v.u-u.u;qa=r.v-u.v;ha=v.v-u.v;F=1/(wa*ha-pa*qa);ia.set((ha*s-qa*z)*F,(ha*y-qa*E)*F,(ha*G-qa*va)*F);X.set((wa*z-pa*s)*F,(wa*E-pa*y)*F,(wa*va-pa*G)*F);R[e].addSelf(ia);R[c].addSelf(ia);
-R[d].addSelf(ia);O[e].addSelf(X);O[c].addSelf(X);O[d].addSelf(X)}var c,d,f,j,h,k,m,q,o,u,r,v,s,z,y,E,G,va,wa,pa,qa,ha,F,w,R=[],O=[],ia=new THREE.Vector3,X=new THREE.Vector3,xa=new THREE.Vector3,S=new THREE.Vector3,M=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)R[c]=new THREE.Vector3,O[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],k=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]),j=h[e[f]],w=R[j],xa.copy(w),xa.subSelf(M.multiplyScalar(M.dot(w))).normalize(),S.cross(h.vertexNormals[f],w),j=S.dot(O[j]),j=j<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(xa.x,xa.y,xa.z,j)}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,i,h){k=b.vertices[e].position;p=b.vertices[c].position;n=b.vertices[d].position;t=j[f];q=j[i];u=j[h];r=p.x-k.x;y=n.x-k.x;x=p.y-k.y;D=n.y-k.y;F=p.z-k.z;wa=n.z-k.z;xa=q.u-t.u;oa=u.u-t.u;qa=q.v-t.v;ga=u.v-t.v;E=1/(xa*ga-oa*qa);ia.set((ga*r-qa*y)*E,(ga*x-qa*D)*E,(ga*F-qa*wa)*E);X.set((xa*y-oa*r)*E,(xa*D-oa*x)*E,(xa*wa-oa*F)*E);ha[e].addSelf(ia);ha[c].addSelf(ia);
+ha[d].addSelf(ia);O[e].addSelf(X);O[c].addSelf(X);O[d].addSelf(X)}var c,d,f,i,h,j,k,p,n,t,q,u,r,y,x,D,F,wa,xa,oa,qa,ga,E,v,ha=[],O=[],ia=new THREE.Vector3,X=new THREE.Vector3,ta=new THREE.Vector3,P=new THREE.Vector3,L=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)ha[c]=new THREE.Vector3,O[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++)L.copy(h.vertexNormals[f]),i=h[e[f]],v=ha[i],ta.copy(v),ta.subSelf(L.multiplyScalar(L.dot(v))).normalize(),P.cross(h.vertexNormals[f],v),i=P.dot(O[i]),i=i<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(ta.x,ta.y,ta.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}},computeEdgeFaces:function(){function b(b,c){return Math.min(b,c)+"_"+Math.max(b,c)}function c(b,c,d){b[c]===void 0?(b[c]={set:{},array:[]},b[c].set[d]=1,b[c].array.push(d)):b[c].set[d]===void 0&&(b[c].set[d]=
 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}},computeEdgeFaces:function(){function b(b,c){return Math.min(b,c)+"_"+Math.max(b,c)}function c(b,c,d){b[c]===void 0?(b[c]={set:{},array:[]},b[c].set[d]=1,b[c].array.push(d)):b[c].set[d]===void 0&&(b[c].set[d]=
-1,b[c].array.push(d))}var d,f,j,h,k,m={};d=0;for(f=this.faces.length;d<f;d++)k=this.faces[d],k instanceof THREE.Face3?(j=b(k.a,k.b),c(m,j,d),j=b(k.b,k.c),c(m,j,d),j=b(k.a,k.c),c(m,j,d)):k instanceof THREE.Face4&&(j=b(k.b,k.d),c(m,j,d),j=b(k.a,k.b),c(m,j,d),j=b(k.a,k.d),c(m,j,d),j=b(k.b,k.c),c(m,j,d),j=b(k.c,k.d),c(m,j,d));d=0;for(f=this.edges.length;d<f;d++){k=this.edges[d];j=k.vertexIndices[0];h=k.vertexIndices[1];k.faceIndices=m[b(j,h)].array;for(j=0;j<k.faceIndices.length;j++)h=k.faceIndices[j],
-k.faces.push(this.faces[h])}}};THREE.GeometryCount=0;
-THREE.Spline=function(b){function c(b,c,d,f,j,h,k){b=(d-b)*0.5;f=(f-c)*0.5;return(2*(c-d)+b+f)*k+(-3*(c-d)-2*b-f)*h+b*j+c}this.points=b;var d=[],f={x:0,y:0,z:0},j,h,k,m,q,o,u,r,v;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){j=(this.points.length-1)*b;h=Math.floor(j);k=j-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;o=this.points[d[0]];u=this.points[d[1]];
-r=this.points[d[2]];v=this.points[d[3]];m=k*k;q=k*m;f.x=c(o.x,u.x,r.x,v.x,k,m,q);f.y=c(o.y,u.y,r.y,v.y,k,m,q);f.z=c(o.z,u.z,r.z,v.z,k,m,q);return f};this.getControlPointsArray=function(){var b,c,d=this.points.length,f=[];for(b=0;b<d;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,d,f=c=c=0,j=new THREE.Vector3,h=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);d=this.points.length*b;j.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),h.copy(position),
-m+=h.distanceTo(j),j.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(k[c]=m,f=c);k[k.length]=m;return{chunks:k,total:m}};this.reparametrizeByArcLength=function(b){var c,d,f,j,h,k,m=[],o=new THREE.Vector3,q=this.getLength();m.push(o.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=q.chunks[c]-q.chunks[c-1];k=Math.ceil(b*d/q.total);j=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(d=1;d<k-1;d++)f=j+d*(1/k)*(h-j),position=this.getPoint(f),m.push(o.copy(position).clone());
-m.push(o.copy(this.points[c]).clone())}this.points=m}};THREE.Edge=function(b,c,d,f){this.vertices=[b,c];this.vertexIndices=[d,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,d,f,j){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d!==void 0?d:0.1;this.far=f!==void 0?f:2E3;this.target=j||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
+1,b[c].array.push(d))}var d,f,i,h,j,k={};d=0;for(f=this.faces.length;d<f;d++)j=this.faces[d],j instanceof THREE.Face3?(i=b(j.a,j.b),c(k,i,d),i=b(j.b,j.c),c(k,i,d),i=b(j.a,j.c),c(k,i,d)):j instanceof THREE.Face4&&(i=b(j.b,j.d),c(k,i,d),i=b(j.a,j.b),c(k,i,d),i=b(j.a,j.d),c(k,i,d),i=b(j.b,j.c),c(k,i,d),i=b(j.c,j.d),c(k,i,d));d=0;for(f=this.edges.length;d<f;d++){j=this.edges[d];i=j.vertexIndices[0];h=j.vertexIndices[1];j.faceIndices=k[b(i,h)].array;for(i=0;i<j.faceIndices.length;i++)h=j.faceIndices[i],
+j.faces.push(this.faces[h])}}};THREE.GeometryCount=0;
+THREE.Spline=function(b){function c(b,c,d,f,i,h,j){b=(d-b)*0.5;f=(f-c)*0.5;return(2*(c-d)+b+f)*j+(-3*(c-d)-2*b-f)*h+b*i+c}this.points=b;var d=[],f={x:0,y:0,z:0},i,h,j,k,p,n,t,q,u;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){i=(this.points.length-1)*b;h=Math.floor(i);j=i-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;n=this.points[d[0]];t=this.points[d[1]];
+q=this.points[d[2]];u=this.points[d[3]];k=j*j;p=j*k;f.x=c(n.x,t.x,q.x,u.x,j,k,p);f.y=c(n.y,t.y,q.y,u.y,j,k,p);f.z=c(n.z,t.z,q.z,u.z,j,k,p);return f};this.getControlPointsArray=function(){var b,c,d=this.points.length,f=[];for(b=0;b<d;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,d,f=c=c=0,i=new THREE.Vector3,h=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);d=this.points.length*b;i.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),h.copy(position),
+k+=h.distanceTo(i),i.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(j[c]=k,f=c);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var c,d,f,i,h,j,k=[],n=new THREE.Vector3,p=this.getLength();k.push(n.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=p.chunks[c]-p.chunks[c-1];j=Math.ceil(b*d/p.total);i=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(d=1;d<j-1;d++)f=i+d*(1/j)*(h-i),position=this.getPoint(f),k.push(n.copy(position).clone());
+k.push(n.copy(this.points[c]).clone())}this.points=k}};THREE.Edge=function(b,c,d,f){this.vertices=[b,c];this.vertexIndices=[d,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,d,f,i){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d!==void 0?d:0.1;this.far=f!==void 0?f:2E3;this.target=i||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
 THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
 THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,d=-c,f=b*d,b=Math.abs(b*c-f),d=Math.abs(c-d);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*d/this.fullHeight,c-this.y*d/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,d=-c,f=b*d,b=Math.abs(b*c-f),d=Math.abs(c-d);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*d/this.fullHeight,c-this.y*d/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
-THREE.Camera.prototype.setViewOffset=function(b,c,d,f,j,h){this.fullWidth=b;this.fullHeight=c;this.x=d;this.y=f;this.width=j;this.height=h;this.updateProjectionMatrix()};
+THREE.Camera.prototype.setViewOffset=function(b,c,d,f,i,h){this.fullWidth=b;this.fullHeight=c;this.x=d;this.y=f;this.width=i;this.height=h;this.updateProjectionMatrix()};
 THREE.Camera.prototype.update=function(b,c,d){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),c=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
 THREE.Camera.prototype.update=function(b,c,d){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),c=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
-!1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};THREE.OrthoCamera=function(b,c,d,f,j,h,k){THREE.Camera.call(this,45,1,j,h,k);this.left=b;this.right=c;this.top=d;this.bottom=f;this.updateProjectionMatrix()};THREE.OrthoCamera.prototype=new THREE.Camera;THREE.OrthoCamera.prototype.constructor=THREE.OrthoCamera;
+!1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};THREE.OrthoCamera=function(b,c,d,f,i,h,j){THREE.Camera.call(this,45,1,i,h,j);this.left=b;this.right=c;this.top=d;this.bottom=f;this.updateProjectionMatrix()};THREE.OrthoCamera.prototype=new THREE.Camera;THREE.OrthoCamera.prototype.constructor=THREE.OrthoCamera;
 THREE.OrthoCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.OrthoCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,0,0);this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0};
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,0,0);this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0};
 THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(b,c,d,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0;this.castShadow=f!==void 0?f:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
 THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(b,c,d,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0;this.castShadow=f!==void 0?f:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
@@ -116,24 +116,24 @@ THREE.MeshShaderMaterial=function(b){console.warn("DEPRECATED: MeshShaderMateria
 THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.fog=b.fog!==void 0?b.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.fog=b.fog!==void 0?b.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ShaderMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.fragmentShader=b.fragmentShader!==void 0?b.fragmentShader:"void main() {}";this.vertexShader=b.vertexShader!==void 0?b.vertexShader:"void main() {}";this.uniforms=b.uniforms!==void 0?b.uniforms:{};this.attributes=b.attributes;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.fog=b.fog!==
 THREE.ShaderMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.fragmentShader=b.fragmentShader!==void 0?b.fragmentShader:"void main() {}";this.vertexShader=b.vertexShader!==void 0?b.vertexShader:"void main() {}";this.uniforms=b.uniforms!==void 0?b.uniforms:{};this.attributes=b.attributes;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.fog=b.fog!==
 void 0?b.fog:!1;this.lights=b.lights!==void 0?b.lights:!1;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
 void 0?b.fog:!1;this.lights=b.lights!==void 0?b.lights:!1;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
-THREE.Texture=function(b,c,d,f,j,h){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=d!==void 0?d:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=j!==void 0?j:THREE.LinearFilter;this.minFilter=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
+THREE.Texture=function(b,c,d,f,i,h){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=d!==void 0?d:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=i!==void 0?i:THREE.LinearFilter;this.minFilter=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
 THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var b=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var b=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
-THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(b,c,d,f,j,h,k,m,q){THREE.Texture.call(this,null,j,h,k,m,q);this.image={data:b,width:c,height:d};this.format=f!==void 0?f:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(b,c,d,f,i,h,j,k,p){THREE.Texture.call(this,null,i,h,j,k,p);this.image={data:b,width:c,height:d};this.format=f!==void 0?f:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var b=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b};THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.DataTexture.prototype.clone=function(){var b=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b};THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,d){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=d!=void 0?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
 THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,d){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=d!=void 0?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
 THREE.Line.prototype.constructor=THREE.Line;
 THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var d=0;d<this.geometry.morphTargets.length;d++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[d].name]=
 THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var d=0;d<this.geometry.morphTargets.length;d++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[d].name]=
 d}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
 d}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,j=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<j;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,d):b.update(this.matrixWorld,!0,d)}else for(f=0;f<j;f++)this.children[f].update(this.skinMatrix,
+THREE.Bone.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,i=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<i;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,d):b.update(this.matrixWorld,!0,d)}else for(f=0;f<i;f++)this.children[f].update(this.skinMatrix,
 c,d)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
 c,d)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
-THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,f,j,h,k,m;if(this.geometry.bones!==void 0){for(d=0;d<this.geometry.bones.length;d++)j=this.geometry.bones[d],h=j.pos,k=j.rotq,m=j.scl,f=this.addBone(),f.name=j.name,f.position.set(h[0],h[1],h[2]),f.quaternion.set(k[0],k[1],k[2],k[3]),f.useQuaternion=!0,m!==void 0?f.scale.set(m[0],m[1],m[2]):f.scale.set(1,1,1);for(d=0;d<this.bones.length;d++)j=this.geometry.bones[d],
-f=this.bones[d],j.parent===-1?this.addChild(f):this.bones[j.parent].addChild(f);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
-THREE.SkinnedMesh.prototype.update=function(b,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,j=this.children.length;for(f=0;f<j;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,d):b.update(this.matrixWorld,c,d);d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<d;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
+THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,f,i,h,j,k;if(this.geometry.bones!==void 0){for(d=0;d<this.geometry.bones.length;d++)i=this.geometry.bones[d],h=i.pos,j=i.rotq,k=i.scl,f=this.addBone(),f.name=i.name,f.position.set(h[0],h[1],h[2]),f.quaternion.set(j[0],j[1],j[2],j[3]),f.useQuaternion=!0,k!==void 0?f.scale.set(k[0],k[1],k[2]):f.scale.set(1,1,1);for(d=0;d<this.bones.length;d++)i=this.geometry.bones[d],
+f=this.bones[d],i.parent===-1?this.addChild(f):this.bones[i.parent].addChild(f);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
+THREE.SkinnedMesh.prototype.update=function(b,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,i=this.children.length;for(f=0;f<i;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,d):b.update(this.matrixWorld,c,d);d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<d;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
 c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
 c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
-THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],d=0;d<this.bones.length;d++)b=this.bones[d],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var d=this.geometry.vertices[b].position,j=this.geometry.skinIndices[b].x,h=this.geometry.skinIndices[b].y;f=new THREE.Vector3(d.x,
-d.y,d.z);this.geometry.skinVerticesA.push(c[j].multiplyVector3(f));f=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(c[h].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(d=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=d,this.geometry.skinWeights[b].y+=d)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],d=0;d<this.bones.length;d++)b=this.bones[d],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var d=this.geometry.vertices[b].position,i=this.geometry.skinIndices[b].x,h=this.geometry.skinIndices[b].y;f=new THREE.Vector3(d.x,
+d.y,d.z);this.geometry.skinVerticesA.push(c[i].multiplyVector3(f));f=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(c[h].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(d=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=d,this.geometry.skinWeights[b].y+=d)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
 THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),d=0;d<this.LODs.length;d++)if(c<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:c,object3D:b});this.add(b)};
 THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),d=0;d<this.LODs.length;d++)if(c<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:c,object3D:b});this.add(b)};
 THREE.LOD.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
 THREE.LOD.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
 this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};
 this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};
@@ -158,7 +158,7 @@ morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInflu
 default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
 default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
 shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec4 shadowColor = vec4( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nshadowCoord.z += shadowBias;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec4( vec3( ( 1.0 - shadowDarkness * shadow ) ), 1.0 );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec4( vec3( shadowDarkness ), 1.0 );\n#endif\n}\n}\ngl_FragColor = gl_FragColor * shadowColor;\n#endif",
 shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec4 shadowColor = vec4( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nshadowCoord.z += shadowBias;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec4( vec3( ( 1.0 - shadowDarkness * shadow ) ), 1.0 );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec4( vec3( shadowDarkness ), 1.0 );\n#endif\n}\n}\ngl_FragColor = gl_FragColor * shadowColor;\n#endif",
 shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif"};
 shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif"};
-THREE.UniformsUtils={merge:function(b){var c,d,f,j={};for(c=0;c<b.length;c++)for(d in f=this.clone(b[c]),f)j[d]=f[d];return j},clone:function(b){var c,d,f,j={};for(c in b)for(d in j[c]={},b[c])f=b[c][d],j[c][d]=f instanceof THREE.Color||f instanceof THREE.Vector2||f instanceof THREE.Vector3||f instanceof THREE.Vector4||f instanceof THREE.Matrix4||f instanceof THREE.Texture?f.clone():f instanceof Array?f.slice():f;return j}};
+THREE.UniformsUtils={merge:function(b){var c,d,f,i={};for(c=0;c<b.length;c++)for(d in f=this.clone(b[c]),f)i[d]=f[d];return i},clone:function(b){var c,d,f,i={};for(c in b)for(d in i[c]={},b[c])f=b[c][d],i[c][d]=f instanceof THREE.Color||f instanceof THREE.Vector2||f instanceof THREE.Vector3||f instanceof THREE.Vector4||f instanceof THREE.Matrix4||f instanceof THREE.Texture?f.clone():f instanceof Array?f.slice():f;return i}};
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",
 value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",
 value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",
 value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:3,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
 value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:3,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
@@ -182,120 +182,120 @@ THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderCh
 "void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 "void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}};
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function c(b,c,d){var f,j,h,k=b.vertices,m=k.length,C=b.colors,o=C.length,D=b.__vertexArray,q=b.__colorArray,r=b.__sortArray,u=b.__dirtyVertices,v=b.__dirtyColors,n=b.__webglCustomAttributes,w,s;if(n)for(w in n)n[w].offset=0;if(d.sortParticles){ta.multiplySelf(d.matrixWorld);for(f=0;f<m;f++)j=k[f].position,Ia.copy(j),ta.multiplyVector3(Ia),r[f]=[Ia.z,f];r.sort(function(b,c){return c[0]-b[0]});for(f=0;f<m;f++)j=k[r[f][1]].position,h=f*3,D[h]=j.x,D[h+1]=j.y,D[h+2]=j.z;
-for(f=0;f<o;f++)h=f*3,color=C[r[f][1]],q[h]=color.r,q[h+1]=color.g,q[h+2]=color.b;if(n)for(w in n){f=n[w];C=f.value.length;for(h=0;h<C;h++){index=r[h][1];o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")s=f.value[index];f.size===2?(f.array[o]=s.x,f.array[o+1]=s.y):f.size===3?f.type==="c"?(f.array[o]=s.r,f.array[o+1]=s.g,f.array[o+2]=s.b):(f.array[o]=s.x,f.array[o+1]=s.y,f.array[o+2]=s.z):(f.array[o]=
-s.x,f.array[o+1]=s.y,f.array[o+2]=s.z,f.array[o+3]=s.w)}f.offset+=f.size}}}else{if(u)for(f=0;f<m;f++)j=k[f].position,h=f*3,D[h]=j.x,D[h+1]=j.y,D[h+2]=j.z;if(v)for(f=0;f<o;f++)color=C[f],h=f*3,q[h]=color.r,q[h+1]=color.g,q[h+2]=color.b;if(n)for(w in n)if(f=n[w],f.__original.needsUpdate){C=f.value.length;for(h=0;h<C;h++){o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")s=f.value[h];f.size===2?(f.array[o]=
-s.x,f.array[o+1]=s.y):f.size===3?f.type==="c"?(f.array[o]=s.r,f.array[o+1]=s.g,f.array[o+2]=s.b):(f.array[o]=s.x,f.array[o+1]=s.y,f.array[o+2]=s.z):(f.array[o]=s.x,f.array[o+1]=s.y,f.array[o+2]=s.z,f.array[o+3]=s.w)}f.offset+=f.size}}}if(u||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,D,c);if(v||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,q,c);if(n)for(w in n)if(f=n[w],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,j){f.program||M.initMaterial(f,c,d,j);if(f.morphTargets&&!j.__webglMorphTargetInfluences){j.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);for(var h=0,k=M.maxMorphTargets;h<k;h++)j.__webglMorphTargetInfluences[h]=0}var h=f.program,k=h.uniforms,m=f.uniforms;h!=Va&&(e.useProgram(h),Va=h);e.uniformMatrix4fv(k.projectionMatrix,!1,Ca);if(d&&f.fog)if(m.fogColor.value=d.color,d instanceof THREE.Fog)m.fogNear.value=d.near,
-m.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)m.fogDensity.value=d.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var C,o,D,q=0,r=0,u=0,s,v,n,z=Wa,H=z.directional.colors,y=z.directional.positions,A=z.point.colors,G=z.point.positions,E=z.point.distances,F=0,J=0,d=o=n=0;for(C=c.length;d<C;d++)if(o=c[d],D=o.color,s=o.position,v=o.intensity,n=o.distance,o instanceof THREE.AmbientLight)q+=D.r,r+=D.g,u+=D.b;else if(o instanceof THREE.DirectionalLight)n=
-F*3,H[n]=D.r*v,H[n+1]=D.g*v,H[n+2]=D.b*v,y[n]=s.x,y[n+1]=s.y,y[n+2]=s.z,F+=1;else if(o instanceof THREE.SpotLight)n=F*3,H[n]=D.r*v,H[n+1]=D.g*v,H[n+2]=D.b*v,D=1/s.length(),y[n]=s.x*D,y[n+1]=s.y*D,y[n+2]=s.z*D,F+=1;else if(o instanceof THREE.PointLight)o=J*3,A[o]=D.r*v,A[o+1]=D.g*v,A[o+2]=D.b*v,G[o]=s.x,G[o+1]=s.y,G[o+2]=s.z,E[J]=n,J+=1;for(d=F*3;d<H.length;d++)H[d]=0;for(d=J*3;d<A.length;d++)A[d]=0;z.point.length=J;z.directional.length=F;z.ambient[0]=q;z.ambient[1]=r;z.ambient[2]=u;c=Wa;m.enableLighting.value=
-c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&
-m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=
-f.opacity,m.size.value=f.size,m.scale.value=Ga.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;if(j.receiveShadow&&!f._shadowPass&&m.shadowMatrix){for(c=0;c<La.length;c++)m.shadowMatrix.value[c]=La[c],m.shadowMap.texture[c]=
-M.shadowMap[c];m.shadowDarkness.value=M.shadowMapDarkness;m.shadowBias.value=M.shadowMapBias}for(var L in m)if(C=h.uniforms[L])if(d=m[L],q=d.type,c=d.value,q=="i")e.uniform1i(C,c);else if(q=="f")e.uniform1f(C,c);else if(q=="v2")e.uniform2f(C,c.x,c.y);else if(q=="v3")e.uniform3f(C,c.x,c.y,c.z);else if(q=="v4")e.uniform4f(C,c.x,c.y,c.z,c.w);else if(q=="c")e.uniform3f(C,c.r,c.g,c.b);else if(q=="fv1")e.uniform1fv(C,c);else if(q=="fv")e.uniform3fv(C,c);else if(q=="v3v"){if(!d._array)d._array=new Float32Array(3*
-c.length);q=0;for(r=c.length;q<r;q++)u=q*3,d._array[u]=c[q].x,d._array[u+1]=c[q].y,d._array[u+2]=c[q].z;e.uniform3fv(C,d._array)}else if(q=="m4"){if(!d._array)d._array=new Float32Array(16);c.flattenToArray(d._array);e.uniformMatrix4fv(C,!1,d._array)}else if(q=="m4v"){if(!d._array)d._array=new Float32Array(16*c.length);q=0;for(r=c.length;q<r;q++)c[q].flattenToArrayOffset(d._array,q*16);e.uniformMatrix4fv(C,!1,d._array)}else if(q=="t"){if(e.uniform1i(C,c),C=d.texture)if(C.image instanceof Array&&C.image.length==
-6){if(d=C,d.image.length==6)if(d.needsUpdate){if(!d.image.__webglTextureCube)d.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_CUBE_MAP,d.image.__webglTextureCube);for(c=0;c<6;c++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,d.image[c]);w(e.TEXTURE_CUBE_MAP,d,d.image[0]);d.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_CUBE_MAP,d.image.__webglTextureCube)}else C instanceof THREE.WebGLRenderTargetCube?
-(d=C,e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_CUBE_MAP,d.__webglTexture)):R(C,c)}else if(q=="tv"){if(!d._array){d._array=[];q=0;for(r=d.texture.length;q<r;q++)d._array[q]=c+q}e.uniform1iv(C,d._array);q=0;for(r=d.texture.length;q<r;q++)(C=d.texture[q])&&R(C,d._array[q])}e.uniformMatrix4fv(k.modelViewMatrix,!1,j._modelViewMatrixArray);k.normalMatrix&&e.uniformMatrix3fv(k.normalMatrix,!1,j._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&
-k.cameraPosition!==null&&e.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||j.receiveShadow)&&k.objectMatrix!==null&&e.uniformMatrix4fv(k.objectMatrix,!1,j._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&k.viewMatrix!==null&&e.uniformMatrix4fv(k.viewMatrix,!1,Ta);f.skinning&&(e.uniformMatrix4fv(k.cameraInverseMatrix,!1,Ta),e.uniformMatrix4fv(k.boneGlobalMatrices,
-!1,j.boneMatrices));return h}function f(b,c,f,j,h,k){if(j.opacity!=0){var m,b=d(b,c,f,j,k).attributes;if(!j.morphTargets&&b.position>=0)e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0);else if(k.morphTargetBase){c=j.program.attributes;k.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0)):c.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),
-e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,o=k.morphTargetForcedOrder,C=k.morphTargetInfluences;f<j.numSupportedMorphTargets&&f<o.length;)e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[o[f]]),e.vertexAttribPointer(c["morphTarget"+f],3,e.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=C[o[f]],f++;else{var o=[],q=-1,D=0,C=k.morphTargetInfluences,r,u=C.length,f=0;for(k.morphTargetBase!==-1&&(o[k.morphTargetBase]=!0);f<j.numSupportedMorphTargets;){for(r=
-0;r<u;r++)!o[r]&&C[r]>q&&(D=r,q=C[D]);e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[D]);e.vertexAttribPointer(c["morphTarget"+f],3,e.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=q;o[D]=1;q=-1;f++}}j.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(j.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],e.bindBuffer(e.ARRAY_BUFFER,c.buffer),e.vertexAttribPointer(b[m],
+THREE.WebGLRenderer=function(b){function c(b,c,d){var f,i,h,j=b.vertices,k=j.length,B=b.colors,n=B.length,C=b.__vertexArray,p=b.__colorArray,q=b.__sortArray,t=b.__dirtyVertices,u=b.__dirtyColors,m=b.__webglCustomAttributes,v,r;if(m)for(v in m)m[v].offset=0;if(d.sortParticles){za.multiplySelf(d.matrixWorld);for(f=0;f<k;f++)i=j[f].position,Ia.copy(i),za.multiplyVector3(Ia),q[f]=[Ia.z,f];q.sort(function(b,c){return c[0]-b[0]});for(f=0;f<k;f++)i=j[q[f][1]].position,h=f*3,C[h]=i.x,C[h+1]=i.y,C[h+2]=i.z;
+for(f=0;f<n;f++)h=f*3,color=B[q[f][1]],p[h]=color.r,p[h+1]=color.g,p[h+2]=color.b;if(m)for(v in m){f=m[v];B=f.value.length;for(h=0;h<B;h++){index=q[h][1];n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")r=f.value[index];f.size===2?(f.array[n]=r.x,f.array[n+1]=r.y):f.size===3?f.type==="c"?(f.array[n]=r.r,f.array[n+1]=r.g,f.array[n+2]=r.b):(f.array[n]=r.x,f.array[n+1]=r.y,f.array[n+2]=r.z):(f.array[n]=
+r.x,f.array[n+1]=r.y,f.array[n+2]=r.z,f.array[n+3]=r.w)}f.offset+=f.size}}}else{if(t)for(f=0;f<k;f++)i=j[f].position,h=f*3,C[h]=i.x,C[h+1]=i.y,C[h+2]=i.z;if(u)for(f=0;f<n;f++)color=B[f],h=f*3,p[h]=color.r,p[h+1]=color.g,p[h+2]=color.b;if(m)for(v in m)if(f=m[v],f.__original.needsUpdate){B=f.value.length;for(h=0;h<B;h++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")r=f.value[h];f.size===2?(f.array[n]=
+r.x,f.array[n+1]=r.y):f.size===3?f.type==="c"?(f.array[n]=r.r,f.array[n+1]=r.g,f.array[n+2]=r.b):(f.array[n]=r.x,f.array[n+1]=r.y,f.array[n+2]=r.z):(f.array[n]=r.x,f.array[n+1]=r.y,f.array[n+2]=r.z,f.array[n+3]=r.w)}f.offset+=f.size}}}if(t||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,C,c);if(u||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,p,c);if(m)for(v in m)if(f=m[v],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,i){f.program||L.initMaterial(f,c,d,i);if(f.morphTargets&&!i.__webglMorphTargetInfluences){i.__webglMorphTargetInfluences=new Float32Array(L.maxMorphTargets);for(var h=0,j=L.maxMorphTargets;h<j;h++)i.__webglMorphTargetInfluences[h]=0}var h=f.program,j=h.uniforms,k=f.uniforms;h!=Va&&(e.useProgram(h),Va=h);e.uniformMatrix4fv(j.projectionMatrix,!1,Ca);if(d&&f.fog)if(k.fogColor.value=d.color,d instanceof THREE.Fog)k.fogNear.value=d.near,
+k.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)k.fogDensity.value=d.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var B,n,C,p=0,q=0,t=0,r,u,m,y=Xa,G=y.directional.colors,x=y.directional.positions,z=y.point.colors,F=y.point.positions,D=y.point.distances,E=0,I=0,d=n=m=0;for(B=c.length;d<B;d++)if(n=c[d],C=n.color,r=n.position,u=n.intensity,m=n.distance,n instanceof THREE.AmbientLight)p+=C.r,q+=C.g,t+=C.b;else if(n instanceof THREE.DirectionalLight)m=
+E*3,G[m]=C.r*u,G[m+1]=C.g*u,G[m+2]=C.b*u,x[m]=r.x,x[m+1]=r.y,x[m+2]=r.z,E+=1;else if(n instanceof THREE.SpotLight)m=E*3,G[m]=C.r*u,G[m+1]=C.g*u,G[m+2]=C.b*u,C=1/r.length(),x[m]=r.x*C,x[m+1]=r.y*C,x[m+2]=r.z*C,E+=1;else if(n instanceof THREE.PointLight)n=I*3,z[n]=C.r*u,z[n+1]=C.g*u,z[n+2]=C.b*u,F[n]=r.x,F[n+1]=r.y,F[n+2]=r.z,D[I]=m,I+=1;for(d=E*3;d<G.length;d++)G[d]=0;for(d=I*3;d<z.length;d++)z[d]=0;y.point.length=I;y.directional.length=E;y.ambient[0]=p;y.ambient[1]=q;y.ambient[2]=t;c=Xa;k.enableLighting.value=
+c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)k.diffuse.value=f.color,k.opacity.value=f.opacity,(k.map.texture=f.map)&&
+k.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),k.lightMap.texture=f.lightMap,k.envMap.texture=f.envMap,k.reflectivity.value=f.reflectivity,k.refractionRatio.value=f.refractionRatio,k.combine.value=f.combine,k.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)k.diffuse.value=f.color,k.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)k.psColor.value=f.color,k.opacity.value=
+f.opacity,k.size.value=f.size,k.scale.value=Ja.height/2,k.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)k.ambient.value=f.ambient,k.specular.value=f.specular,k.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)k.mNear.value=b.near,k.mFar.value=b.far,k.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)k.opacity.value=f.opacity;if(i.receiveShadow&&!f._shadowPass&&k.shadowMatrix){for(c=0;c<Sa.length;c++)k.shadowMatrix.value[c]=Sa[c],k.shadowMap.texture[c]=
+L.shadowMap[c];k.shadowDarkness.value=L.shadowMapDarkness;k.shadowBias.value=L.shadowMapBias}for(var K in k)if(B=h.uniforms[K])if(d=k[K],p=d.type,c=d.value,p=="i")e.uniform1i(B,c);else if(p=="f")e.uniform1f(B,c);else if(p=="v2")e.uniform2f(B,c.x,c.y);else if(p=="v3")e.uniform3f(B,c.x,c.y,c.z);else if(p=="v4")e.uniform4f(B,c.x,c.y,c.z,c.w);else if(p=="c")e.uniform3f(B,c.r,c.g,c.b);else if(p=="fv1")e.uniform1fv(B,c);else if(p=="fv")e.uniform3fv(B,c);else if(p=="v3v"){if(!d._array)d._array=new Float32Array(3*
+c.length);p=0;for(q=c.length;p<q;p++)t=p*3,d._array[t]=c[p].x,d._array[t+1]=c[p].y,d._array[t+2]=c[p].z;e.uniform3fv(B,d._array)}else if(p=="m4"){if(!d._array)d._array=new Float32Array(16);c.flattenToArray(d._array);e.uniformMatrix4fv(B,!1,d._array)}else if(p=="m4v"){if(!d._array)d._array=new Float32Array(16*c.length);p=0;for(q=c.length;p<q;p++)c[p].flattenToArrayOffset(d._array,p*16);e.uniformMatrix4fv(B,!1,d._array)}else if(p=="t"){if(e.uniform1i(B,c),B=d.texture)if(B.image instanceof Array&&B.image.length==
+6){if(d=B,d.image.length==6)if(d.needsUpdate){if(!d.image.__webglTextureCube)d.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_CUBE_MAP,d.image.__webglTextureCube);for(c=0;c<6;c++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,d.image[c]);v(e.TEXTURE_CUBE_MAP,d,d.image[0]);d.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_CUBE_MAP,d.image.__webglTextureCube)}else B instanceof THREE.WebGLRenderTargetCube?
+(d=B,e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_CUBE_MAP,d.__webglTexture)):ha(B,c)}else if(p=="tv"){if(!d._array){d._array=[];p=0;for(q=d.texture.length;p<q;p++)d._array[p]=c+p}e.uniform1iv(B,d._array);p=0;for(q=d.texture.length;p<q;p++)(B=d.texture[p])&&ha(B,d._array[p])}e.uniformMatrix4fv(j.modelViewMatrix,!1,i._modelViewMatrixArray);j.normalMatrix&&e.uniformMatrix3fv(j.normalMatrix,!1,i._normalMatrixArray);(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.ShaderMaterial||f.envMap||f.skinning||i.receiveShadow)&&j.objectMatrix!==null&&e.uniformMatrix4fv(j.objectMatrix,!1,i._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&j.viewMatrix!==null&&e.uniformMatrix4fv(j.viewMatrix,!1,Ta);f.skinning&&(e.uniformMatrix4fv(j.cameraInverseMatrix,!1,Ta),e.uniformMatrix4fv(j.boneGlobalMatrices,
+!1,i.boneMatrices));return h}function f(b,c,f,i,h,j){if(i.opacity!=0){var k,b=d(b,c,f,i,j).attributes;if(!i.morphTargets&&b.position>=0)e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0);else if(j.morphTargetBase){c=i.program.attributes;j.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0)):c.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),
+e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,n=j.morphTargetForcedOrder,B=j.morphTargetInfluences;f<i.numSupportedMorphTargets&&f<n.length;)e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[n[f]]),e.vertexAttribPointer(c["morphTarget"+f],3,e.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[f]=B[n[f]],f++;else{var n=[],p=-1,C=0,B=j.morphTargetInfluences,q,t=B.length,f=0;for(j.morphTargetBase!==-1&&(n[j.morphTargetBase]=!0);f<i.numSupportedMorphTargets;){for(q=
+0;q<t;q++)!n[q]&&B[q]>p&&(C=q,p=B[C]);e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[C]);e.vertexAttribPointer(c["morphTarget"+f],3,e.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[f]=p;n[C]=1;p=-1;f++}}i.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(i.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(k in h.__webglCustomAttributes)b[k]>=0&&(c=h.__webglCustomAttributes[k],e.bindBuffer(e.ARRAY_BUFFER,c.buffer),e.vertexAttribPointer(b[k],
 c.size,e.FLOAT,!1,0,0));b.color>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)):
 c.size,e.FLOAT,!1,0,0));b.color>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)):
-e.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));j.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB,
-4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0));k instanceof THREE.Mesh?(j.wireframe?(e.lineWidth(j.wireframeLinewidth),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),e.drawElements(e.LINES,h.__webglLineCount,e.UNSIGNED_SHORT,0)):(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),e.drawElements(e.TRIANGLES,
-h.__webglFaceCount,e.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=h.__webglFaceCount,M.info.render.faces+=h.__webglFaceCount/3):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?e.LINE_STRIP:e.LINES,e.lineWidth(j.linewidth),e.drawArrays(k,0,h.__webglLineCount),M.info.render.calls++):k instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,h.__webglParticleCount),M.info.render.calls++):k instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,h.__webglVertexCount),M.info.render.calls++)}}
-function j(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,j,k,m,o,q,r,u,s,n=b.count*
-3;for(s=0;s<n;s+=9)d=b.normalArray,f=d[s],h=d[s+1],j=d[s+2],k=d[s+3],o=d[s+4],r=d[s+5],m=d[s+6],q=d[s+7],u=d[s+8],f=(f+k+m)/3,h=(h+o+q)/3,j=(j+r+u)/3,d[s]=f,d[s+1]=h,d[s+2]=j,d[s+3]=f,d[s+4]=h,d[s+5]=j,d[s+6]=f,d[s+7]=h,d[s+8]=j}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(Y!=b.doubleSided)b.doubleSided?e.disable(e.CULL_FACE):
-e.enable(e.CULL_FACE),Y=b.doubleSided;if(ra!=b.flipSided)b.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),ra=b.flipSided}function k(b){T!=b&&(b?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),T=b)}function m(b){P!=b&&(e.depthMask(b),P=b)}function q(b,c,d){ka!=b&&(b?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),ka=b);if(b&&(fa!=c||K!=d))e.polygonOffset(c,d),fa=c,K=d}function o(b){Q[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);Q[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,
-b.n44+b.n14);Q[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);Q[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);Q[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);Q[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=Q[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function u(b){for(var c=b.matrixWorld,d=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=Q[e].x*c.n14+Q[e].y*c.n24+Q[e].z*c.n34+
-Q[e].w,b<=d)return!1;return!0}function r(b,c){b.list[b.count]=c;b.count+=1}function v(b){var c,d,e=b.object,f=b.opaque,h=b.transparent;h.count=0;b=f.count=0;for(c=e.materials.length;b<c;b++)d=e.materials[b],d.transparent?r(h,d):r(f,d)}function s(b){var c,d,e,f,h=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(e=h.materials.length;b<e;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=j.materials.length;c<d;c++)(f=j.materials[c])&&(f.transparent?r(m,f):
-r(k,f))}else(f=c)&&(f.transparent?r(m,f):r(k,f))}function z(b,c){return c.z-b.z}function y(b){var c,m,q,Ma=0,r,s,n,C,v=b.lights;V||(V=new THREE.Camera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));c=0;for(m=v.length;c<m;c++)if(q=v[c],q instanceof THREE.SpotLight&&q.castShadow){M.shadowMap[Ma]||(M.shadowMap[Ma]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
-La[Ma]||(La[Ma]=new THREE.Matrix4);r=M.shadowMap[Ma];s=La[Ma];V.position.copy(q.position);V.target.position.copy(q.target.position);V.update(void 0,!0);b.update(void 0,!1,V);s.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);s.multiplySelf(V.projectionMatrix);s.multiplySelf(V.matrixWorldInverse);V.matrixWorldInverse.flattenToArray(Ta);V.projectionMatrix.flattenToArray(Ca);ta.multiply(V.projectionMatrix,V.matrixWorldInverse);o(ta);M.initWebGLObjects(b);O(r);e.clearColor(1,1,1,1);M.clear();e.clearColor(Z.r,
-Z.g,Z.b,Ja);s=b.__webglObjects.length;q=b.__webglObjectsImmediate.length;for(r=0;r<s;r++)n=b.__webglObjects[r],C=n.object,C.visible&&C.castShadow?!(C instanceof THREE.Mesh)||!C.frustumCulled||u(C)?(C.matrixWorld.flattenToArray(C._objectMatrixArray),G(C,V,!1),n.render=!0):n.render=!1:n.render=!1;k(!0);F(THREE.NormalBlending);for(r=0;r<s;r++)if(n=b.__webglObjects[r],n.render)C=n.object,buffer=n.buffer,h(C),n=C.customDepthMaterial?C.customDepthMaterial:C.geometry.morphTargets.length?Xa:Ua,f(V,v,null,
-n,buffer,C);for(r=0;r<q;r++)n=b.__webglObjectsImmediate[r],C=n.object,C.visible&&C.castShadow&&(C.matrixAutoUpdate&&C.matrixWorld.flattenToArray(C._objectMatrixArray),G(C,V,!1),h(C),program=d(V,v,null,Ua,C),C.render(function(b){j(b,program,Ua.shading)}));Ma++}}function E(b,c){var d,f,h;d=n.attributes;var j=n.uniforms,k=Da/Ea,m,o=[],q=Ea*0.5,r=Da*0.5,s=!0;e.useProgram(n.program);Va=n.program;T=I=-1;Ya||(e.enableVertexAttribArray(n.attributes.position),e.enableVertexAttribArray(n.attributes.uv),Ya=
-!0);e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,n.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,n.elementBuffer);e.uniformMatrix4fv(j.projectionMatrix,!1,Ca);e.activeTexture(e.TEXTURE0);e.uniform1i(j.map,0);d=0;for(f=b.__webglSprites.length;d<f;d++)h=b.__webglSprites[d],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
-h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(z);d=0;for(f=b.__webglSprites.length;d<f;d++)h=b.__webglSprites[d],h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(e.uniform1i(j.useScreenCoordinates,1),e.uniform3f(j.screenPosition,(h.position.x-q)/q,(r-h.position.y)/r,Math.max(0,Math.min(1,h.position.z)))):(e.uniform1i(j.useScreenCoordinates,0),e.uniform1i(j.affectedByDistance,h.affectedByDistance?1:0),e.uniformMatrix4fv(j.modelViewMatrix,!1,
-h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?Da:1),o[0]=m*k*h.scale.x,o[1]=m*h.scale.y,e.uniform2f(j.uvScale,h.uvScale.x,h.uvScale.y),e.uniform2f(j.uvOffset,h.uvOffset.x,h.uvOffset.y),e.uniform2f(j.alignment,h.alignment.x,h.alignment.y),e.uniform1f(j.opacity,h.opacity),e.uniform3f(j.color,h.color.r,h.color.g,h.color.b),e.uniform1f(j.rotation,h.rotation),e.uniform2fv(j.scale,o),h.mergeWith3D&&!s?(e.enable(e.DEPTH_TEST),s=!0):!h.mergeWith3D&&s&&(e.disable(e.DEPTH_TEST),s=!1),F(h.blending),
-R(h.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(P)}function G(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function va(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)if(e.attributes[c].needsUpdate)return!0;return!1}function wa(b){var c,
-d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)e.attributes[c].needsUpdate=!1}function pa(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function qa(b){function c(b){var f=[];d=0;for(e=b.length;d<e;d++)b[d]==void 0?f.push("undefined"):f.push(b[d].id);return f.join("_")}var d,e,f,h,j,k,m,o,q={},r=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(h=b.faces.length;f<h;f++)j=b.faces[f],k=j.materials,m=c(k),q[m]==
-void 0&&(q[m]={hash:m,counter:0}),o=q[m].hash+"_"+q[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:k,vertices:0,numMorphTargets:r}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+j>65535&&(q[m].counter+=1,o=q[m].hash+"_"+q[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:k,vertices:0,numMorphTargets:r})),b.geometryGroups[o].faces.push(f),b.geometryGroups[o].vertices+=j;b.geometryGroupsList=[];for(var s in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[s])}
-function ha(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function F(b){if(b!=I){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)}I=b}}function w(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,S(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,S(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,S(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,S(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,xa(c.magFilter)),
-e.texParameteri(b,e.TEXTURE_MIN_FILTER,xa(c.minFilter)))}function R(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,S(b.format),b.image.width,b.image.height,0,S(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);w(e.TEXTURE_2D,b,b.image);b.needsUpdate=
-!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function O(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);w(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,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null)}else b.__webglFramebuffer=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),w(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(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+
+e.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));i.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB,
+4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0));j instanceof THREE.Mesh?(i.wireframe?(e.lineWidth(i.wireframeLinewidth),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),e.drawElements(e.LINES,h.__webglLineCount,e.UNSIGNED_SHORT,0)):(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),e.drawElements(e.TRIANGLES,
+h.__webglFaceCount,e.UNSIGNED_SHORT,0)),L.info.render.calls++,L.info.render.vertices+=h.__webglFaceCount,L.info.render.faces+=h.__webglFaceCount/3):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?e.LINE_STRIP:e.LINES,e.lineWidth(i.linewidth),e.drawArrays(j,0,h.__webglLineCount),L.info.render.calls++):j instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,h.__webglParticleCount),L.info.render.calls++):j instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,h.__webglVertexCount),L.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,n,p,q,t,r,m=b.count*
+3;for(r=0;r<m;r+=9)d=b.normalArray,f=d[r],h=d[r+1],i=d[r+2],j=d[r+3],n=d[r+4],q=d[r+5],k=d[r+6],p=d[r+7],t=d[r+8],f=(f+j+k)/3,h=(h+n+p)/3,i=(i+q+t)/3,d[r]=f,d[r+1]=h,d[r+2]=i,d[r+3]=f,d[r+4]=h,d[r+5]=i,d[r+6]=f,d[r+7]=h,d[r+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(S!=b.doubleSided)b.doubleSided?e.disable(e.CULL_FACE):
+e.enable(e.CULL_FACE),S=b.doubleSided;if(Y!=b.flipSided)b.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),Y=b.flipSided}function j(b){V!=b&&(b?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),V=b)}function k(b){R!=b&&(e.depthMask(b),R=b)}function p(b,c,d){U!=b&&(b?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),U=b);if(b&&(va!=c||J!=d))e.polygonOffset(c,d),va=c,J=d}function n(b){Q[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);Q[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+
+b.n14);Q[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);Q[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);Q[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);Q[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=Q[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function t(b){for(var c=b.matrixWorld,d=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=Q[e].x*c.n14+Q[e].y*c.n24+Q[e].z*c.n34+Q[e].w,
+b<=d)return!1;return!0}function q(b,c){b.list[b.count]=c;b.count+=1}function u(b){var c,d,e=b.object,f=b.opaque,h=b.transparent;h.count=0;b=f.count=0;for(c=e.materials.length;b<c;b++)d=e.materials[b],d.transparent?q(h,d):q(f,d)}function r(b){var c,d,e,f,h=b.object,i=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(e=h.materials.length;b<e;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=i.materials.length;c<d;c++)(f=i.materials[c])&&(f.transparent?q(k,f):q(j,f))}else(f=
+c)&&(f.transparent?q(k,f):q(j,f))}function y(b,c){return c.z-b.z}function x(b){var c,k,p,La=0,q,r,m,B,u=b.lights;pa||(pa=new THREE.Camera(L.shadowCameraFov,L.shadowMapWidth/L.shadowMapHeight,L.shadowCameraNear,L.shadowCameraFar));c=0;for(k=u.length;c<k;c++)if(p=u[c],p instanceof THREE.SpotLight&&p.castShadow){L.shadowMap[La]||(L.shadowMap[La]=new THREE.WebGLRenderTarget(L.shadowMapWidth,L.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Sa[La]||
+(Sa[La]=new THREE.Matrix4);q=L.shadowMap[La];r=Sa[La];pa.position.copy(p.position);pa.target.position.copy(p.target.position);pa.update(void 0,!0);b.update(void 0,!1,pa);r.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);r.multiplySelf(pa.projectionMatrix);r.multiplySelf(pa.matrixWorldInverse);pa.matrixWorldInverse.flattenToArray(Ta);pa.projectionMatrix.flattenToArray(Ca);za.multiply(pa.projectionMatrix,pa.matrixWorldInverse);n(za);L.initWebGLObjects(b);O(q);e.clearColor(1,1,1,1);L.clear();e.clearColor(ea.r,
+ea.g,ea.b,Ga);r=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(q=0;q<r;q++)m=b.__webglObjects[q],B=m.object,B.visible&&B.castShadow?!(B instanceof THREE.Mesh)||!B.frustumCulled||t(B)?(B.matrixWorld.flattenToArray(B._objectMatrixArray),F(B,pa,!1),m.render=!0):m.render=!1:m.render=!1;j(!0);E(THREE.NormalBlending);for(q=0;q<r;q++)if(m=b.__webglObjects[q],m.render)B=m.object,buffer=m.buffer,h(B),m=B.customDepthMaterial?B.customDepthMaterial:B.geometry.morphTargets.length?Ya:Ua,f(pa,u,
+null,m,buffer,B);for(q=0;q<p;q++)m=b.__webglObjectsImmediate[q],B=m.object,B.visible&&B.castShadow&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),F(B,pa,!1),h(B),program=d(pa,u,null,Ua,B),B.render(function(b){i(b,program,Ua.shading)}));La++}}function D(b,c){var d,f,h;d=m.attributes;var i=m.uniforms,j=Da/ya,k,n=[],p=ya*0.5,q=Da*0.5,r=!0;e.useProgram(m.program);Va=m.program;V=H=-1;Za||(e.enableVertexAttribArray(m.attributes.position),e.enableVertexAttribArray(m.attributes.uv),
+Za=!0);e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,m.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,m.elementBuffer);e.uniformMatrix4fv(i.projectionMatrix,!1,Ca);e.activeTexture(e.TEXTURE0);e.uniform1i(i.map,0);d=0;for(f=b.__webglSprites.length;d<f;d++)h=b.__webglSprites[d],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.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(e.uniform1i(i.useScreenCoordinates,1),e.uniform3f(i.screenPosition,(h.position.x-p)/p,(q-h.position.y)/q,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?Da:1),n[0]=k*j*h.scale.x,n[1]=k*h.scale.y,e.uniform2f(i.uvScale,h.uvScale.x,h.uvScale.y),e.uniform2f(i.uvOffset,h.uvOffset.x,h.uvOffset.y),e.uniform2f(i.alignment,h.alignment.x,h.alignment.y),e.uniform1f(i.opacity,h.opacity),e.uniform3f(i.color,h.color.r,h.color.g,h.color.b),e.uniform1f(i.rotation,h.rotation),e.uniform2fv(i.scale,n),h.mergeWith3D&&!r?(e.enable(e.DEPTH_TEST),r=!0):!h.mergeWith3D&&r&&(e.disable(e.DEPTH_TEST),r=!1),E(h.blending),
+ha(h.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(R)}function F(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function wa(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)if(e.attributes[c].needsUpdate)return!0;return!1}function xa(b){var c,
+d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)e.attributes[c].needsUpdate=!1}function oa(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function qa(b){function c(b){var f=[];d=0;for(e=b.length;d<e;d++)b[d]==void 0?f.push("undefined"):f.push(b[d].id);return f.join("_")}var d,e,f,h,i,j,k,n,p={},q=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),p[k]==
+void 0&&(p[k]={hash:k,counter:0}),n=p[k].hash+"_"+p[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:j,vertices:0,numMorphTargets:q}),i=i instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+i>65535&&(p[k].counter+=1,n=p[k].hash+"_"+p[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:j,vertices:0,numMorphTargets:q})),b.geometryGroups[n].faces.push(f),b.geometryGroups[n].vertices+=i;b.geometryGroupsList=[];for(var r in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[r])}
+function ga(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function E(b){if(b!=H){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)}H=b}}function v(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,P(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,P(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,P(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,P(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,ta(c.magFilter)),
+e.texParameteri(b,e.TEXTURE_MIN_FILTER,ta(c.minFilter)))}function ha(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=e.createTexture(),L.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,P(b.format),b.image.width,b.image.height,0,P(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);v(e.TEXTURE_2D,b,b.image);b.needsUpdate=
+!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function O(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);v(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,P(b.format),b.width,b.height,0,P(b.format),P(b.type),null)}else b.__webglFramebuffer=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),v(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,P(b.format),b.width,b.height,0,P(b.format),P(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,
 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,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=Da,f=ya,h=za);c!=ua&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),ua=c)}function ia(b){b instanceof
+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=ya,b=Da,f=ra,h=Fa);c!=ua&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),ua=c)}function ia(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 X(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)),
 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 X(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 xa(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function S(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;
+console.error(c),null;return d}function ta(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function P(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;
 case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;
 case THREE.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,Ba=[],Va=null,ua=null,Y=null,ra=null,I=null,T=null,P=null,ka=null,fa=null,K=null,ya=0,za=0,Ea=0,Da=0,Q=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Matrix4,Ca=new Float32Array(16),Ta=new Float32Array(16),Ia=new THREE.Vector4,Wa=
-{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ga=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ab=b.stencil!==void 0?b.stencil:!0,bb=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,cb=b.antialias!==void 0?b.antialias:!1,Z=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ja=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,
-geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ga;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var V,La=[],b=THREE.ShaderLib.depthRGBA,Za=THREE.UniformsUtils.clone(b.uniforms),Ua=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,
-vertexShader:b.vertexShader,uniforms:Za}),Xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Za,morphTargets:!0});Ua._shadowPass=!0;Xa._shadowPass=!0;try{if(!(e=Ga.getContext("experimental-webgl",{antialias:cb,stencil:ab,preserveDrawingBuffer:bb})))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(db){console.error(db)}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,Ja);this.context=e;var $a=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,n={};n.vertices=new Float32Array(16);n.faces=new Uint16Array(6);i=0;n.vertices[i++]=-1;n.vertices[i++]=-1;n.vertices[i++]=0;n.vertices[i++]=1;n.vertices[i++]=1;
-n.vertices[i++]=-1;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]=0;n.vertices[i++]=-1;n.vertices[i++]=1;n.vertices[i++]=0;i=n.vertices[i++]=0;n.faces[i++]=0;n.faces[i++]=1;n.faces[i++]=2;n.faces[i++]=0;n.faces[i++]=2;n.faces[i++]=3;n.vertexBuffer=e.createBuffer();n.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.elementBuffer);
-e.bufferData(e.ELEMENT_ARRAY_BUFFER,n.faces,e.STATIC_DRAW);n.program=e.createProgram();e.attachShader(n.program,X("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(n.program,X("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(n.program);n.attributes={};n.uniforms={};n.attributes.position=e.getAttribLocation(n.program,"position");n.attributes.uv=e.getAttribLocation(n.program,"uv");n.uniforms.uvOffset=e.getUniformLocation(n.program,"uvOffset");n.uniforms.uvScale=e.getUniformLocation(n.program,
-"uvScale");n.uniforms.rotation=e.getUniformLocation(n.program,"rotation");n.uniforms.scale=e.getUniformLocation(n.program,"scale");n.uniforms.alignment=e.getUniformLocation(n.program,"alignment");n.uniforms.color=e.getUniformLocation(n.program,"color");n.uniforms.map=e.getUniformLocation(n.program,"map");n.uniforms.opacity=e.getUniformLocation(n.program,"opacity");n.uniforms.useScreenCoordinates=e.getUniformLocation(n.program,"useScreenCoordinates");n.uniforms.affectedByDistance=e.getUniformLocation(n.program,
-"affectedByDistance");n.uniforms.screenPosition=e.getUniformLocation(n.program,"screenPosition");n.uniforms.modelViewMatrix=e.getUniformLocation(n.program,"modelViewMatrix");n.uniforms.projectionMatrix=e.getUniformLocation(n.program,"projectionMatrix");var Ya=!1;this.setSize=function(b,c){Ga.width=b;Ga.height=c;this.setViewport(0,0,Ga.width,Ga.height)};this.setViewport=function(b,c,d,f){ya=b;za=c;Ea=d;Da=f;e.viewport(ya,za,Ea,Da)};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);Ja=c;e.clearColor(Z.r,Z.g,Z.b,Ja)};this.setClearColor=function(b,c){Z.copy(b);Ja=c;e.clearColor(Z.r,Z.g,Z.b,Ja)};this.getClearColor=function(){return Z};this.getClearAlpha=function(){return Ja};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.getContext=function(){return e};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=
+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 L=this,e,Ba=[],Va=null,ua=null,S=null,Y=null,H=null,V=null,R=null,U=null,va=null,J=null,ra=0,Fa=0,ya=0,Da=0,Q=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],za=new THREE.Matrix4,Ca=new Float32Array(16),Ta=new Float32Array(16),Ia=new THREE.Vector4,Xa={ambient:[0,
+0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ja=b.canvas!==void 0?b.canvas:document.createElement("canvas"),N=b.stencil!==void 0?b.stencil:!0,bb=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,cb=b.antialias!==void 0?b.antialias:!1,ea=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ga=b.clearAlpha!==void 0?b.clearAlpha:0,Wa=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=Ja;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var pa,Sa=[],b=THREE.ShaderLib.depthRGBA,$a=THREE.UniformsUtils.clone(b.uniforms),Ua=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,
+vertexShader:b.vertexShader,uniforms:$a}),Ya=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:$a,morphTargets:!0});Ua._shadowPass=!0;Ya._shadowPass=!0;try{if(!(e=Ja.getContext("experimental-webgl",{antialias:cb,stencil:N,preserveDrawingBuffer:bb})))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(db){console.error(db)}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(ea.r,ea.g,ea.b,Ga);this.context=e;var ab=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,m={};m.vertices=new Float32Array(16);m.faces=new Uint16Array(6);N=0;m.vertices[N++]=-1;m.vertices[N++]=-1;m.vertices[N++]=0;m.vertices[N++]=1;m.vertices[N++]=
+1;m.vertices[N++]=-1;m.vertices[N++]=1;m.vertices[N++]=1;m.vertices[N++]=1;m.vertices[N++]=1;m.vertices[N++]=1;m.vertices[N++]=0;m.vertices[N++]=-1;m.vertices[N++]=1;m.vertices[N++]=0;N=m.vertices[N++]=0;m.faces[N++]=0;m.faces[N++]=1;m.faces[N++]=2;m.faces[N++]=0;m.faces[N++]=2;m.faces[N++]=3;m.vertexBuffer=e.createBuffer();m.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,m.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,m.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.elementBuffer);
+e.bufferData(e.ELEMENT_ARRAY_BUFFER,m.faces,e.STATIC_DRAW);m.program=e.createProgram();e.attachShader(m.program,X("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(m.program,X("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(m.program);m.attributes={};m.uniforms={};m.attributes.position=e.getAttribLocation(m.program,"position");m.attributes.uv=e.getAttribLocation(m.program,"uv");m.uniforms.uvOffset=e.getUniformLocation(m.program,"uvOffset");m.uniforms.uvScale=e.getUniformLocation(m.program,
+"uvScale");m.uniforms.rotation=e.getUniformLocation(m.program,"rotation");m.uniforms.scale=e.getUniformLocation(m.program,"scale");m.uniforms.alignment=e.getUniformLocation(m.program,"alignment");m.uniforms.color=e.getUniformLocation(m.program,"color");m.uniforms.map=e.getUniformLocation(m.program,"map");m.uniforms.opacity=e.getUniformLocation(m.program,"opacity");m.uniforms.useScreenCoordinates=e.getUniformLocation(m.program,"useScreenCoordinates");m.uniforms.affectedByDistance=e.getUniformLocation(m.program,
+"affectedByDistance");m.uniforms.screenPosition=e.getUniformLocation(m.program,"screenPosition");m.uniforms.modelViewMatrix=e.getUniformLocation(m.program,"modelViewMatrix");m.uniforms.projectionMatrix=e.getUniformLocation(m.program,"projectionMatrix");var Za=!1;this.setSize=function(b,c){Ja.width=b;Ja.height=c;this.setViewport(0,0,Ja.width,Ja.height)};this.setViewport=function(b,c,d,f){ra=b;Fa=c;ya=d;Da=f;e.viewport(ra,Fa,ya,Da)};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){ea.setHex(b);Ga=c;e.clearColor(ea.r,ea.g,ea.b,Ga)};this.setClearColor=function(b,c){ea.copy(b);Ga=c;e.clearColor(ea.r,ea.g,ea.b,Ga)};this.getClearColor=function(){return ea};this.getClearAlpha=function(){return Ga};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};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);
 !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);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,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof
-THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var o,q,r;o=r=m=0;for(q=c.length;o<q;o++)j=c[o],j instanceof THREE.SpotLight&&r++,j instanceof THREE.DirectionalLight&&
-r++,j instanceof THREE.PointLight&&m++;m+r<=_maxLights?o=r:(o=Math.ceil(_maxLights*r/(m+r)),m=_maxLights-o);j={directional:o,point:m};m=r=0;for(o=c.length;m<o;m++)q=c[m],q instanceof THREE.SpotLight&&q.castShadow&&r++;var s=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)s=f.bones.length;var n;a:{o=b.fragmentShader;q=b.vertexShader;var m=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,
-skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:s,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:r,alphaTest:b.alphaTest},u,f=[];k?f.push(k):(f.push(o),f.push(q));for(u in d)f.push(u),f.push(d[u]);k=f.join();u=0;for(f=Ba.length;u<f;u++)if(Ba[u].code==k){n=Ba[u].program;break a}u=
-e.createProgram();f=[$a?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":
-"",d.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");
-j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"",d.useFog&&d.fog?"#define USE_FOG":"",d.useFog&&d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",
-d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e.attachShader(u,X("fragment",j+o));e.attachShader(u,X("vertex",f+q));e.linkProgram(u);e.getProgramParameter(u,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(u,e.VALIDATE_STATUS)+", gl error ["+
-e.getError()+"]");u.uniforms={};u.attributes={};var v,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in m)f.push(v);v=f;f=0;for(m=v.length;f<m;f++)o=v[f],u.uniforms[o]=e.getUniformLocation(u,o);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<d.maxMorphTargets;v++)f.push("morphTarget"+v);for(n in c)f.push(n);
-n=f;v=0;for(c=n.length;v<c;v++)d=n[v],u.attributes[d]=e.getAttribLocation(u,d);Ba.push({program:u,code:k});M.info.memory.programs=Ba.length;n=u}b.program=n;n=b.program.attributes;n.position>=0&&e.enableVertexAttribArray(n.position);n.color>=0&&e.enableVertexAttribArray(n.color);n.normal>=0&&e.enableVertexAttribArray(n.normal);n.tangent>=0&&e.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(e.enableVertexAttribArray(n.skinVertexA),
-e.enableVertexAttribArray(n.skinVertexB),e.enableVertexAttribArray(n.skinIndex),e.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(h in b.attributes)n[h]!==void 0&&n[h]>=0&&e.enableVertexAttribArray(n[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)v="morphTarget"+h,n[v]>=0&&(e.enableVertexAttribArray(n[v]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,d,f){O(b);b=0;c&&(b|=e.COLOR_BUFFER_BIT);d&&(b|=e.DEPTH_BUFFER_BIT);f&&(b|=e.STENCIL_BUFFER_BIT);
-e.clear(b)};this.render=function(b,c,e,r){var n,w,Fa,U,C,I,D,Qa,Ra=b.lights,Sa=b.fog;this.shadowMapEnabled&&y(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(Ta);c.projectionMatrix.flattenToArray(Ca);ta.multiply(c.projectionMatrix,c.matrixWorldInverse);o(ta);this.initWebGLObjects(b);O(e);(this.autoClear||r)&&this.clear();C=b.__webglObjects.length;for(r=0;r<C;r++)if(n=b.__webglObjects[r],
-D=n.object,D.visible)if(!(D instanceof THREE.Mesh)||!D.frustumCulled||u(D)){if(D.matrixWorld.flattenToArray(D._objectMatrixArray),G(D,c,!0),s(n),n.render=!0,this.sortObjects)n.object.renderDepth?n.z=n.object.renderDepth:(Ia.copy(D.position),ta.multiplyVector3(Ia),n.z=Ia.z)}else n.render=!1;else n.render=!1;this.sortObjects&&b.__webglObjects.sort(z);I=b.__webglObjectsImmediate.length;for(r=0;r<I;r++)n=b.__webglObjectsImmediate[r],D=n.object,D.visible&&(D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray),
-G(D,c,!0),v(n));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);F(b.overrideMaterial.blending);for(r=0;r<C;r++)if(n=b.__webglObjects[r],n.render)D=n.object,Qa=n.buffer,h(D),f(c,Ra,Sa,b.overrideMaterial,Qa,D);for(r=0;r<I;r++)n=b.__webglObjectsImmediate[r],D=n.object,D.visible&&(h(D),w=d(c,Ra,Sa,b.overrideMaterial,D),D.render(function(c){j(c,w,b.overrideMaterial.shading)}))}else{F(THREE.NormalBlending);for(r=C-1;r>=0;r--)if(n=b.__webglObjects[r],n.render){D=n.object;Qa=n.buffer;Fa=n.opaque;h(D);
-for(n=0;n<Fa.count;n++)U=Fa.list[n],k(U.depthTest),m(U.depthWrite),q(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),f(c,Ra,Sa,U,Qa,D)}for(r=0;r<I;r++)if(n=b.__webglObjectsImmediate[r],D=n.object,D.visible){Fa=n.opaque;h(D);for(n=0;n<Fa.count;n++)U=Fa.list[n],k(U.depthTest),m(U.depthWrite),q(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),w=d(c,Ra,Sa,U,D),D.render(function(b){j(b,w,U.shading)})}for(r=0;r<C;r++)if(n=b.__webglObjects[r],n.render){D=n.object;Qa=n.buffer;Fa=n.transparent;
-h(D);for(n=0;n<Fa.count;n++)U=Fa.list[n],F(U.blending),k(U.depthTest),m(U.depthWrite),q(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),f(c,Ra,Sa,U,Qa,D)}for(r=0;r<I;r++)if(n=b.__webglObjectsImmediate[r],D=n.object,D.visible){Fa=n.transparent;h(D);for(n=0;n<Fa.count;n++)U=Fa.list[n],F(U.blending),k(U.depthTest),m(U.depthWrite),q(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),w=d(c,Ra,Sa,U,D),D.render(function(b){j(b,w,U.shading)})}}b.__webglSprites.length&&E(b,c);e&&e.minFilter!==
-THREE.NearestFilter&&e.minFilter!==THREE.LinearFilter&&ia(e)};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,j=void 0,k=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 j=d.geometry,j.geometryGroups==void 0&&qa(j),j.geometryGroups){if(k=j.geometryGroups[h],!k.__webglVertexBuffer){var m=k;m.__webglVertexBuffer=e.createBuffer();m.__webglNormalBuffer=e.createBuffer();m.__webglTangentBuffer=e.createBuffer();m.__webglColorBuffer=e.createBuffer();m.__webglUVBuffer=e.createBuffer();m.__webglUV2Buffer=e.createBuffer();m.__webglSkinVertexABuffer=e.createBuffer();m.__webglSkinVertexBBuffer=e.createBuffer();m.__webglSkinIndicesBuffer=e.createBuffer();
-m.__webglSkinWeightsBuffer=e.createBuffer();m.__webglFaceBuffer=e.createBuffer();m.__webglLineBuffer=e.createBuffer();if(m.numMorphTargets){var o=void 0,n=void 0;m.__webglMorphTargetsBuffers=[];o=0;for(n=m.numMorphTargets;o<n;o++)m.__webglMorphTargetsBuffers.push(e.createBuffer())}M.info.memory.geometries++;for(var m=d,r=void 0,q=void 0,s=void 0,u=s=void 0,v=void 0,w=void 0,z=w=o=0,y=s=q=void 0,s=n=y=q=r=void 0,u=m.geometry,v=u.faces,y=k.faces,r=0,q=y.length;r<q;r++)s=y[r],s=v[s],s instanceof THREE.Face3?
-(o+=3,w+=1,z+=3):s instanceof THREE.Face4&&(o+=4,w+=2,z+=4);for(var r=k,q=m,G=y=v=void 0,H=void 0,G=void 0,s=[],v=0,y=q.materials.length;v<y;v++)if(G=q.materials[v],G instanceof THREE.MeshFaceMaterial){G=0;for(l=r.materials.length;G<l;G++)(H=r.materials[G])&&s.push(H)}else(H=G)&&s.push(H);r=s;k.__materials=r;a:{v=q=void 0;y=r.length;for(q=0;q<y;q++)if(v=r[q],v.map||v.lightMap||v instanceof THREE.ShaderMaterial){q=!0;break a}q=!1}a:{y=v=void 0;s=r.length;for(v=0;v<s;v++)if(y=r[v],!(y instanceof THREE.MeshBasicMaterial&&
-!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{s=v=void 0;G=r.length;for(v=0;v<G;v++)if(s=r[v],s.vertexColors){s=s.vertexColors;break a}s=!1}k.__vertexArray=new Float32Array(o*3);if(y)k.__normalArray=new Float32Array(o*3);if(u.hasTangents)k.__tangentArray=new Float32Array(o*4);if(s)k.__colorArray=new Float32Array(o*3);if(q){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o*
-2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(o*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(o*4),k.__skinVertexBArray=new Float32Array(o*4),k.__skinIndexArray=new Float32Array(o*4),k.__skinWeightArray=new Float32Array(o*4);k.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(z*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=
-k.numMorphTargets;u<v;u++)k.__morphTargetsArrays.push(new Float32Array(o*3))}k.__needsSmoothNormals=y==THREE.SmoothShading;k.__uvType=q;k.__vertexColorType=s;k.__normalType=y;k.__webglFaceCount=w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=z*2;u=0;for(v=r.length;u<v;u++)if(q=r[u],q.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in q.attributes){s=q.attributes[a];y={};for(n in s)y[n]=s[n];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=
-!0,w=1,y.type==="v2"?w=2:y.type==="v3"?w=3:y.type==="v4"?w=4:y.type==="c"&&(w=3),y.size=w,y.array=new Float32Array(o*w),y.buffer=e.createBuffer(),y.buffer.belongsToAttribute=a,s.needsUpdate=!0,y.__original=s;k.__webglCustomAttributes[a]=y}}k.__inittedArrays=!0;j.__dirtyVertices=!0;j.__dirtyMorphTargets=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}}else if(d instanceof THREE.Ribbon){if(j=d.geometry,!j.__webglVertexBuffer)k=j,k.__webglVertexBuffer=
-e.createBuffer(),k.__webglColorBuffer=e.createBuffer(),M.info.memory.geometries++,k=j,m=k.vertices.length,k.__vertexArray=new Float32Array(m*3),k.__colorArray=new Float32Array(m*3),k.__webglVertexCount=m,j.__dirtyVertices=!0,j.__dirtyColors=!0}else if(d instanceof THREE.Line){if(j=d.geometry,!j.__webglVertexBuffer)k=j,k.__webglVertexBuffer=e.createBuffer(),k.__webglColorBuffer=e.createBuffer(),M.info.memory.geometries++,k=j,m=k.vertices.length,k.__vertexArray=new Float32Array(m*3),k.__colorArray=
-new Float32Array(m*3),k.__webglLineCount=m,j.__dirtyVertices=!0,j.__dirtyColors=!0}else if(d instanceof THREE.ParticleSystem&&(j=d.geometry,!j.__webglVertexBuffer)){k=j;k.__webglVertexBuffer=e.createBuffer();k.__webglColorBuffer=e.createBuffer();M.info.geometries++;k=j;m=d;o=k.vertices.length;k.__vertexArray=new Float32Array(o*3);k.__colorArray=new Float32Array(o*3);k.__sortArray=[];k.__webglParticleCount=o;k.__materials=m.materials;z=w=n=void 0;n=0;for(w=m.materials.length;n<w;n++)if(z=m.materials[n],
-z.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in z.attributes){originalAttribute=z.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(o*
-size),attribute.buffer=e.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;k.__webglCustomAttributes[a]=attribute}}j.__dirtyVertices=!0;j.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in j=d.geometry,j.geometryGroups)k=j.geometryGroups[h],ha(f.__webglObjects,k,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(j=d.geometry,ha(f.__webglObjects,j,d)):THREE.MarchingCubes!==
-void 0&&d instanceof THREE.MarchingCubes?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)pa(f.__webglObjects,d);else if(d instanceof THREE.Sprite){f=f.__webglSprites;h=d;j=void 0;
-for(j=f.length-1;j>=0;j--)f[j]==h&&f.splice(j,1)}else d instanceof THREE.MarchingCubes&&pa(f.__webglObjectsImmediate,d);d.__webglActive=!1;b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<f;d++)if(j=b.__webglObjects[d].object,n=k=h=void 0,j instanceof THREE.Mesh){h=j.geometry;m=0;for(o=h.geometryGroupsList.length;m<o;m++)if(k=h.geometryGroupsList[m],n=va(k),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||
-n)if(n=k,w=e.DYNAMIC_DRAW,z=!h.dynamic,n.__inittedArrays){var F=r=u=void 0,A=void 0,I=F=void 0,E=void 0,O=void 0,J=void 0,L=H=G=s=y=v=q=void 0,N=void 0,K=void 0,t=A=J=A=O=E=void 0,p=void 0,B=p=t=E=void 0,P=void 0,T=B=p=t=F=F=I=J=A=B=p=t=P=B=p=t=P=B=p=t=void 0,ga=0,la=0,X=0,Y=0,S=0,Q=0,W=0,R=0,ja=0,x=0,ma=0,B=t=0,B=void 0,na=n.__vertexArray,ia=n.__uvArray,ka=n.__uv2Array,V=n.__normalArray,$=n.__tangentArray,oa=n.__colorArray,aa=n.__skinVertexAArray,ca=n.__skinVertexBArray,da=n.__skinIndexArray,ea=
-n.__skinWeightArray,ra=n.__morphTargetsArrays,Z=n.__webglCustomAttributes,p=void 0,fa=n.__faceArray,Aa=n.__lineArray,xa=n.__needsSmoothNormals,v=n.__vertexColorType,q=n.__uvType,y=n.__normalType,sa=j.geometry,ua=sa.__dirtyVertices,ya=sa.__dirtyElements,ta=sa.__dirtyUvs,Ba=sa.__dirtyNormals,Ca=sa.__dirtyTangents,Da=sa.__dirtyColors,Ea=sa.__dirtyMorphTargets,za=sa.vertices,Ga=n.faces,Ja=sa.faces,Ia=sa.faceVertexUvs[0],La=sa.faceVertexUvs[1],Na=sa.skinVerticesA,Oa=sa.skinVerticesB,Pa=sa.skinIndices,
-Ka=sa.skinWeights,Ha=sa.morphTargets;if(Z)for(T in Z)Z[T].offset=0,Z[T].offsetSrc=0;u=0;for(r=Ga.length;u<r;u++)if(F=Ga[u],A=Ja[F],Ia&&(s=Ia[F]),La&&(G=La[F]),F=A.vertexNormals,I=A.normal,E=A.vertexColors,O=A.color,J=A.vertexTangents,A instanceof THREE.Face3){if(ua)H=za[A.a].position,L=za[A.b].position,N=za[A.c].position,na[la]=H.x,na[la+1]=H.y,na[la+2]=H.z,na[la+3]=L.x,na[la+4]=L.y,na[la+5]=L.z,na[la+6]=N.x,na[la+7]=N.y,na[la+8]=N.z,la+=9;if(Z)for(T in Z)if(p=Z[T],p.__original.needsUpdate)t=p.offset,
-B=p.offsetSrc,p.size===1?(p.boundTo===void 0||p.boundTo==="vertices"?(p.array[t]=p.value[A.a],p.array[t+1]=p.value[A.b],p.array[t+2]=p.value[A.c]):p.boundTo==="faces"?(B=p.value[B],p.array[t]=B,p.array[t+1]=B,p.array[t+2]=B,p.offsetSrc++):p.boundTo==="faceVertices"&&(p.array[t]=p.value[B],p.array[t+1]=p.value[B+1],p.array[t+2]=p.value[B+2],p.offsetSrc+=3),p.offset+=3):(p.boundTo===void 0||p.boundTo==="vertices"?(H=p.value[A.a],L=p.value[A.b],N=p.value[A.c]):p.boundTo==="faces"?(N=L=H=B=p.value[B],
-p.offsetSrc++):p.boundTo==="faceVertices"&&(H=p.value[B],L=p.value[B+1],N=p.value[B+2],p.offsetSrc+=3),p.size===2?(p.array[t]=H.x,p.array[t+1]=H.y,p.array[t+2]=L.x,p.array[t+3]=L.y,p.array[t+4]=N.x,p.array[t+5]=N.y,p.offset+=6):p.size===3?(p.type==="c"?(p.array[t]=H.r,p.array[t+1]=H.g,p.array[t+2]=H.b,p.array[t+3]=L.r,p.array[t+4]=L.g,p.array[t+5]=L.b,p.array[t+6]=N.r,p.array[t+7]=N.g,p.array[t+8]=N.b):(p.array[t]=H.x,p.array[t+1]=H.y,p.array[t+2]=H.z,p.array[t+3]=L.x,p.array[t+4]=L.y,p.array[t+5]=
-L.z,p.array[t+6]=N.x,p.array[t+7]=N.y,p.array[t+8]=N.z),p.offset+=9):(p.array[t]=H.x,p.array[t+1]=H.y,p.array[t+2]=H.z,p.array[t+3]=H.w,p.array[t+4]=L.x,p.array[t+5]=L.y,p.array[t+6]=L.z,p.array[t+7]=L.w,p.array[t+8]=N.x,p.array[t+9]=N.y,p.array[t+10]=N.z,p.array[t+11]=N.w,p.offset+=12));if(Ea){t=0;for(p=Ha.length;t<p;t++)H=Ha[t].vertices[A.a].position,L=Ha[t].vertices[A.b].position,N=Ha[t].vertices[A.c].position,B=ra[t],B[ma]=H.x,B[ma+1]=H.y,B[ma+2]=H.z,B[ma+3]=L.x,B[ma+4]=L.y,B[ma+5]=L.z,B[ma+6]=
-N.x,B[ma+7]=N.y,B[ma+8]=N.z;ma+=9}if(Ka.length)t=Ka[A.a],p=Ka[A.b],B=Ka[A.c],ea[x]=t.x,ea[x+1]=t.y,ea[x+2]=t.z,ea[x+3]=t.w,ea[x+4]=p.x,ea[x+5]=p.y,ea[x+6]=p.z,ea[x+7]=p.w,ea[x+8]=B.x,ea[x+9]=B.y,ea[x+10]=B.z,ea[x+11]=B.w,t=Pa[A.a],p=Pa[A.b],B=Pa[A.c],da[x]=t.x,da[x+1]=t.y,da[x+2]=t.z,da[x+3]=t.w,da[x+4]=p.x,da[x+5]=p.y,da[x+6]=p.z,da[x+7]=p.w,da[x+8]=B.x,da[x+9]=B.y,da[x+10]=B.z,da[x+11]=B.w,t=Na[A.a],p=Na[A.b],B=Na[A.c],aa[x]=t.x,aa[x+1]=t.y,aa[x+2]=t.z,aa[x+3]=1,aa[x+4]=p.x,aa[x+5]=p.y,aa[x+6]=
-p.z,aa[x+7]=1,aa[x+8]=B.x,aa[x+9]=B.y,aa[x+10]=B.z,aa[x+11]=1,t=Oa[A.a],p=Oa[A.b],B=Oa[A.c],ca[x]=t.x,ca[x+1]=t.y,ca[x+2]=t.z,ca[x+3]=1,ca[x+4]=p.x,ca[x+5]=p.y,ca[x+6]=p.z,ca[x+7]=1,ca[x+8]=B.x,ca[x+9]=B.y,ca[x+10]=B.z,ca[x+11]=1,x+=12;if(Da&&v)E.length==3&&v==THREE.VertexColors?(A=E[0],t=E[1],p=E[2]):p=t=A=O,oa[ja]=A.r,oa[ja+1]=A.g,oa[ja+2]=A.b,oa[ja+3]=t.r,oa[ja+4]=t.g,oa[ja+5]=t.b,oa[ja+6]=p.r,oa[ja+7]=p.g,oa[ja+8]=p.b,ja+=9;if(Ca&&sa.hasTangents)E=J[0],O=J[1],A=J[2],$[W]=E.x,$[W+1]=E.y,$[W+2]=
-E.z,$[W+3]=E.w,$[W+4]=O.x,$[W+5]=O.y,$[W+6]=O.z,$[W+7]=O.w,$[W+8]=A.x,$[W+9]=A.y,$[W+10]=A.z,$[W+11]=A.w,W+=12;if(Ba&&y)if(F.length==3&&xa)for(J=0;J<3;J++)I=F[J],V[Q]=I.x,V[Q+1]=I.y,V[Q+2]=I.z,Q+=3;else for(J=0;J<3;J++)V[Q]=I.x,V[Q+1]=I.y,V[Q+2]=I.z,Q+=3;if(ta&&s!==void 0&&q)for(J=0;J<3;J++)F=s[J],ia[X]=F.u,ia[X+1]=F.v,X+=2;if(ta&&G!==void 0&&q)for(J=0;J<3;J++)F=G[J],ka[Y]=F.u,ka[Y+1]=F.v,Y+=2;ya&&(fa[S]=ga,fa[S+1]=ga+1,fa[S+2]=ga+2,S+=3,Aa[R]=ga,Aa[R+1]=ga+1,Aa[R+2]=ga,Aa[R+3]=ga+2,Aa[R+4]=ga+1,
-Aa[R+5]=ga+2,R+=6,ga+=3)}else if(A instanceof THREE.Face4){if(ua)H=za[A.a].position,L=za[A.b].position,N=za[A.c].position,K=za[A.d].position,na[la]=H.x,na[la+1]=H.y,na[la+2]=H.z,na[la+3]=L.x,na[la+4]=L.y,na[la+5]=L.z,na[la+6]=N.x,na[la+7]=N.y,na[la+8]=N.z,na[la+9]=K.x,na[la+10]=K.y,na[la+11]=K.z,la+=12;if(Z)for(T in Z)if(p=Z[T],p.__original.needsUpdate)t=p.offset,B=p.offsetSrc,p.size===1?(p.boundTo===void 0||p.boundTo==="vertices"?(p.array[t]=p.value[A.a],p.array[t+1]=p.value[A.b],p.array[t+2]=p.value[A.c],
-p.array[t+3]=p.value[A.d]):p.boundTo==="faces"?(B=p.value[B],p.array[t]=B,p.array[t+1]=B,p.array[t+2]=B,p.array[t+3]=B,p.offsetSrc++):p.boundTo==="faceVertices"&&(p.array[t]=p.value[B],p.array[t+1]=p.value[B+1],p.array[t+2]=p.value[B+2],p.array[t+3]=p.value[B+3],p.offsetSrc+=4),p.offset+=4):(p.boundTo===void 0||p.boundTo==="vertices"?(H=p.value[A.a],L=p.value[A.b],N=p.value[A.c],K=p.value[A.d]):p.boundTo==="faces"?(K=N=L=H=B=p.value[B],p.offsetSrc++):p.boundTo==="faceVertices"&&(H=p.value[B],L=p.value[B+
-1],N=p.value[B+2],K=p.value[B+3],p.offsetSrc+=4),p.size===2?(p.array[t]=H.x,p.array[t+1]=H.y,p.array[t+2]=L.x,p.array[t+3]=L.y,p.array[t+4]=N.x,p.array[t+5]=N.y,p.array[t+6]=K.x,p.array[t+7]=K.y,p.offset+=8):p.size===3?(p.type==="c"?(p.array[t]=H.r,p.array[t+1]=H.g,p.array[t+2]=H.b,p.array[t+3]=L.r,p.array[t+4]=L.g,p.array[t+5]=L.b,p.array[t+6]=N.r,p.array[t+7]=N.g,p.array[t+8]=N.b,p.array[t+9]=K.r,p.array[t+10]=K.g,p.array[t+11]=K.b):(p.array[t]=H.x,p.array[t+1]=H.y,p.array[t+2]=H.z,p.array[t+3]=
-L.x,p.array[t+4]=L.y,p.array[t+5]=L.z,p.array[t+6]=N.x,p.array[t+7]=N.y,p.array[t+8]=N.z,p.array[t+9]=K.x,p.array[t+10]=K.y,p.array[t+11]=K.z),p.offset+=12):(p.array[t]=H.x,p.array[t+1]=H.y,p.array[t+2]=H.z,p.array[t+3]=H.w,p.array[t+4]=L.x,p.array[t+5]=L.y,p.array[t+6]=L.z,p.array[t+7]=L.w,p.array[t+8]=N.x,p.array[t+9]=N.y,p.array[t+10]=N.z,p.array[t+11]=N.w,p.array[t+12]=K.x,p.array[t+13]=K.y,p.array[t+14]=K.z,p.array[t+15]=K.w,p.offset+=16));if(Ea){t=0;for(p=Ha.length;t<p;t++)H=Ha[t].vertices[A.a].position,
-L=Ha[t].vertices[A.b].position,N=Ha[t].vertices[A.c].position,K=Ha[t].vertices[A.d].position,B=ra[t],B[ma]=H.x,B[ma+1]=H.y,B[ma+2]=H.z,B[ma+3]=L.x,B[ma+4]=L.y,B[ma+5]=L.z,B[ma+6]=N.x,B[ma+7]=N.y,B[ma+8]=N.z,B[ma+9]=K.x,B[ma+10]=K.y,B[ma+11]=K.z;ma+=12}if(Ka.length)t=Ka[A.a],p=Ka[A.b],B=Ka[A.c],P=Ka[A.d],ea[x]=t.x,ea[x+1]=t.y,ea[x+2]=t.z,ea[x+3]=t.w,ea[x+4]=p.x,ea[x+5]=p.y,ea[x+6]=p.z,ea[x+7]=p.w,ea[x+8]=B.x,ea[x+9]=B.y,ea[x+10]=B.z,ea[x+11]=B.w,ea[x+12]=P.x,ea[x+13]=P.y,ea[x+14]=P.z,ea[x+15]=P.w,
-t=Pa[A.a],p=Pa[A.b],B=Pa[A.c],P=Pa[A.d],da[x]=t.x,da[x+1]=t.y,da[x+2]=t.z,da[x+3]=t.w,da[x+4]=p.x,da[x+5]=p.y,da[x+6]=p.z,da[x+7]=p.w,da[x+8]=B.x,da[x+9]=B.y,da[x+10]=B.z,da[x+11]=B.w,da[x+12]=P.x,da[x+13]=P.y,da[x+14]=P.z,da[x+15]=P.w,t=Na[A.a],p=Na[A.b],B=Na[A.c],P=Na[A.d],aa[x]=t.x,aa[x+1]=t.y,aa[x+2]=t.z,aa[x+3]=1,aa[x+4]=p.x,aa[x+5]=p.y,aa[x+6]=p.z,aa[x+7]=1,aa[x+8]=B.x,aa[x+9]=B.y,aa[x+10]=B.z,aa[x+11]=1,aa[x+12]=P.x,aa[x+13]=P.y,aa[x+14]=P.z,aa[x+15]=1,t=Oa[A.a],p=Oa[A.b],B=Oa[A.c],A=Oa[A.d],
-ca[x]=t.x,ca[x+1]=t.y,ca[x+2]=t.z,ca[x+3]=1,ca[x+4]=p.x,ca[x+5]=p.y,ca[x+6]=p.z,ca[x+7]=1,ca[x+8]=B.x,ca[x+9]=B.y,ca[x+10]=B.z,ca[x+11]=1,ca[x+12]=A.x,ca[x+13]=A.y,ca[x+14]=A.z,ca[x+15]=1,x+=16;if(Da&&v)E.length==4&&v==THREE.VertexColors?(A=E[0],t=E[1],p=E[2],E=E[3]):E=p=t=A=O,oa[ja]=A.r,oa[ja+1]=A.g,oa[ja+2]=A.b,oa[ja+3]=t.r,oa[ja+4]=t.g,oa[ja+5]=t.b,oa[ja+6]=p.r,oa[ja+7]=p.g,oa[ja+8]=p.b,oa[ja+9]=E.r,oa[ja+10]=E.g,oa[ja+11]=E.b,ja+=12;if(Ca&&sa.hasTangents)E=J[0],O=J[1],A=J[2],J=J[3],$[W]=E.x,$[W+
-1]=E.y,$[W+2]=E.z,$[W+3]=E.w,$[W+4]=O.x,$[W+5]=O.y,$[W+6]=O.z,$[W+7]=O.w,$[W+8]=A.x,$[W+9]=A.y,$[W+10]=A.z,$[W+11]=A.w,$[W+12]=J.x,$[W+13]=J.y,$[W+14]=J.z,$[W+15]=J.w,W+=16;if(Ba&&y)if(F.length==4&&xa)for(J=0;J<4;J++)I=F[J],V[Q]=I.x,V[Q+1]=I.y,V[Q+2]=I.z,Q+=3;else for(J=0;J<4;J++)V[Q]=I.x,V[Q+1]=I.y,V[Q+2]=I.z,Q+=3;if(ta&&s!==void 0&&q)for(J=0;J<4;J++)F=s[J],ia[X]=F.u,ia[X+1]=F.v,X+=2;if(ta&&G!==void 0&&q)for(J=0;J<4;J++)F=G[J],ka[Y]=F.u,ka[Y+1]=F.v,Y+=2;ya&&(fa[S]=ga,fa[S+1]=ga+1,fa[S+2]=ga+3,fa[S+
-3]=ga+1,fa[S+4]=ga+2,fa[S+5]=ga+3,S+=6,Aa[R]=ga,Aa[R+1]=ga+1,Aa[R+2]=ga,Aa[R+3]=ga+3,Aa[R+4]=ga+1,Aa[R+5]=ga+2,Aa[R+6]=ga+2,Aa[R+7]=ga+3,R+=8,ga+=4)}ua&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,na,w));if(Z)for(T in Z)p=Z[T],p.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,p.buffer),e.bufferData(e.ARRAY_BUFFER,p.array,w));if(Ea){t=0;for(p=Ha.length;t<p;t++)e.bindBuffer(e.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[t]),e.bufferData(e.ARRAY_BUFFER,ra[t],w)}Da&&
-ja>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,oa,w));Ba&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,V,w));Ca&&sa.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,$,w));ta&&X>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ia,w));ta&&Y>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,ka,w));ya&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
-n.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,fa,w),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Aa,w));x>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,aa,w),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,ca,w),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,da,w),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,
-ea,w));z&&(delete n.__inittedArrays,delete n.__colorArray,delete n.__normalArray,delete n.__tangentArray,delete n.__uvArray,delete n.__uv2Array,delete n.__faceArray,delete n.__vertexArray,delete n.__lineArray,delete n.__skinVertexAArray,delete n.__skinVertexBArray,delete n.__skinIndexArray,delete n.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;wa(k)}else if(j instanceof THREE.Ribbon){h=
-j.geometry;if(h.__dirtyVertices||h.__dirtyColors){j=h;k=e.DYNAMIC_DRAW;m=u=z=z=void 0;r=j.vertices;o=j.colors;q=r.length;n=o.length;v=j.__vertexArray;w=j.__colorArray;y=j.__dirtyColors;if(j.__dirtyVertices){for(z=0;z<q;z++)u=r[z].position,m=z*3,v[m]=u.x,v[m+1]=u.y,v[m+2]=u.z;e.bindBuffer(e.ARRAY_BUFFER,j.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,v,k)}if(y){for(z=0;z<n;z++)color=o[z],m=z*3,w[m]=color.r,w[m+1]=color.g,w[m+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,j.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,
-w,k)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(j instanceof THREE.Line){h=j.geometry;if(h.__dirtyVertices||h.__dirtyColors){j=h;k=e.DYNAMIC_DRAW;m=u=z=z=void 0;r=j.vertices;o=j.colors;q=r.length;n=o.length;v=j.__vertexArray;w=j.__colorArray;y=j.__dirtyColors;if(j.__dirtyVertices){for(z=0;z<q;z++)u=r[z].position,m=z*3,v[m]=u.x,v[m+1]=u.y,v[m+2]=u.z;e.bindBuffer(e.ARRAY_BUFFER,j.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,v,k)}if(y){for(z=0;z<n;z++)color=o[z],m=z*3,w[m]=color.r,w[m+1]=color.g,
-w[m+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,j.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,w,k)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(j instanceof THREE.ParticleSystem)h=j.geometry,n=va(h),(h.__dirtyVertices||h.__dirtyColors||j.sortParticles||n)&&c(h,e.DYNAMIC_DRAW,j),h.__dirtyVertices=!1,h.__dirtyColors=!1,wa(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),b=="back"?e.cullFace(e.BACK):b=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),
-e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return $a}};
+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]);L.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),L.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),
+e.deleteBuffer(b.__webglColorBuffer),L.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),L.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,e.deleteTexture(b.__webglTexture),L.info.memory.textures--};this.initMaterial=function(b,c,d,f){var h,i,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof
+THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=k.fragmentShader}var n,p,q;n=q=k=0;for(p=c.length;n<p;n++)i=c[n],i instanceof THREE.SpotLight&&q++,i instanceof THREE.DirectionalLight&&
+q++,i instanceof THREE.PointLight&&k++;k+q<=Wa?n=q:(n=Math.ceil(Wa*q/(k+q)),k=Wa-n);i={directional:n,point:k};k=q=0;for(n=c.length;k<n;k++)p=c[k],p instanceof THREE.SpotLight&&p.castShadow&&q++;var r=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)r=f.bones.length;var m;a:{n=b.fragmentShader;p=b.vertexShader;var k=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,
+maxMorphTargets:this.maxMorphTargets,maxDirLights:i.directional,maxPointLights:i.point,maxBones:r,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:b.alphaTest},t,f=[];j?f.push(j):(f.push(n),f.push(p));for(t in d)f.push(t),f.push(d[t]);j=f.join();t=0;for(f=Ba.length;t<f;t++)if(Ba[t].code==j){m=Ba[t].program;break a}t=e.createProgram();f=[ab?"#define VERTEX_TEXTURES":
+"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.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");
+i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"",d.useFog&&d.fog?"#define USE_FOG":"",d.useFog&&d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",
+d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e.attachShader(t,X("fragment",i+n));e.attachShader(t,X("vertex",f+p));e.linkProgram(t);e.getProgramParameter(t,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(t,e.VALIDATE_STATUS)+", gl error ["+
+e.getError()+"]");t.uniforms={};t.attributes={};var u,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in k)f.push(u);u=f;f=0;for(k=u.length;f<k;f++)n=u[f],t.uniforms[n]=e.getUniformLocation(t,n);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<d.maxMorphTargets;u++)f.push("morphTarget"+u);for(m in c)f.push(m);
+m=f;u=0;for(c=m.length;u<c;u++)d=m[u],t.attributes[d]=e.getAttribLocation(t,d);Ba.push({program:t,code:j});L.info.memory.programs=Ba.length;m=t}b.program=m;m=b.program.attributes;m.position>=0&&e.enableVertexAttribArray(m.position);m.color>=0&&e.enableVertexAttribArray(m.color);m.normal>=0&&e.enableVertexAttribArray(m.normal);m.tangent>=0&&e.enableVertexAttribArray(m.tangent);b.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0&&(e.enableVertexAttribArray(m.skinVertexA),
+e.enableVertexAttribArray(m.skinVertexB),e.enableVertexAttribArray(m.skinIndex),e.enableVertexAttribArray(m.skinWeight));if(b.attributes)for(h in b.attributes)m[h]!==void 0&&m[h]>=0&&e.enableVertexAttribArray(m[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)u="morphTarget"+h,m[u]>=0&&(e.enableVertexAttribArray(m[u]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,d,f){O(b);b=0;c&&(b|=e.COLOR_BUFFER_BIT);d&&(b|=e.DEPTH_BUFFER_BIT);f&&(b|=e.STENCIL_BUFFER_BIT);
+e.clear(b)};this.render=function(b,c,e,q){var m,v,Ea,T,B,H,C,Pa,Qa=b.lights,Ra=b.fog;this.shadowMapEnabled&&x(b,c);L.info.render.calls=0;L.info.render.vertices=0;L.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ta);c.projectionMatrix.flattenToArray(Ca);za.multiply(c.projectionMatrix,c.matrixWorldInverse);n(za);this.initWebGLObjects(b);O(e);(this.autoClear||q)&&this.clear();B=b.__webglObjects.length;for(q=0;q<B;q++)if(m=b.__webglObjects[q],
+C=m.object,C.visible)if(!(C instanceof THREE.Mesh)||!C.frustumCulled||t(C)){if(C.matrixWorld.flattenToArray(C._objectMatrixArray),F(C,c,!0),r(m),m.render=!0,this.sortObjects)m.object.renderDepth?m.z=m.object.renderDepth:(Ia.copy(C.position),za.multiplyVector3(Ia),m.z=Ia.z)}else m.render=!1;else m.render=!1;this.sortObjects&&b.__webglObjects.sort(y);H=b.__webglObjectsImmediate.length;for(q=0;q<H;q++)m=b.__webglObjectsImmediate[q],C=m.object,C.visible&&(C.matrixAutoUpdate&&C.matrixWorld.flattenToArray(C._objectMatrixArray),
+F(C,c,!0),u(m));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);E(b.overrideMaterial.blending);for(q=0;q<B;q++)if(m=b.__webglObjects[q],m.render)C=m.object,Pa=m.buffer,h(C),f(c,Qa,Ra,b.overrideMaterial,Pa,C);for(q=0;q<H;q++)m=b.__webglObjectsImmediate[q],C=m.object,C.visible&&(h(C),v=d(c,Qa,Ra,b.overrideMaterial,C),C.render(function(c){i(c,v,b.overrideMaterial.shading)}))}else{E(THREE.NormalBlending);for(q=B-1;q>=0;q--)if(m=b.__webglObjects[q],m.render){C=m.object;Pa=m.buffer;Ea=m.opaque;h(C);
+for(m=0;m<Ea.count;m++)T=Ea.list[m],j(T.depthTest),k(T.depthWrite),p(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),f(c,Qa,Ra,T,Pa,C)}for(q=0;q<H;q++)if(m=b.__webglObjectsImmediate[q],C=m.object,C.visible){Ea=m.opaque;h(C);for(m=0;m<Ea.count;m++)T=Ea.list[m],j(T.depthTest),k(T.depthWrite),p(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),v=d(c,Qa,Ra,T,C),C.render(function(b){i(b,v,T.shading)})}for(q=0;q<B;q++)if(m=b.__webglObjects[q],m.render){C=m.object;Pa=m.buffer;Ea=m.transparent;
+h(C);for(m=0;m<Ea.count;m++)T=Ea.list[m],E(T.blending),j(T.depthTest),k(T.depthWrite),p(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),f(c,Qa,Ra,T,Pa,C)}for(q=0;q<H;q++)if(m=b.__webglObjectsImmediate[q],C=m.object,C.visible){Ea=m.transparent;h(C);for(m=0;m<Ea.count;m++)T=Ea.list[m],E(T.blending),j(T.depthTest),k(T.depthWrite),p(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),v=d(c,Qa,Ra,T,C),C.render(function(b){i(b,v,T.shading)})}}b.__webglSprites.length&&D(b,c);e&&e.minFilter!==
+THREE.NearestFilter&&e.minFilter!==THREE.LinearFilter&&ia(e)};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&&qa(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=e.createBuffer();k.__webglNormalBuffer=e.createBuffer();k.__webglTangentBuffer=e.createBuffer();k.__webglColorBuffer=e.createBuffer();k.__webglUVBuffer=e.createBuffer();k.__webglUV2Buffer=e.createBuffer();k.__webglSkinVertexABuffer=e.createBuffer();k.__webglSkinVertexBBuffer=e.createBuffer();k.__webglSkinIndicesBuffer=e.createBuffer();
+k.__webglSkinWeightsBuffer=e.createBuffer();k.__webglFaceBuffer=e.createBuffer();k.__webglLineBuffer=e.createBuffer();if(k.numMorphTargets){var n=void 0,m=void 0;k.__webglMorphTargetsBuffers=[];n=0;for(m=k.numMorphTargets;n<m;n++)k.__webglMorphTargetsBuffers.push(e.createBuffer())}L.info.memory.geometries++;for(var k=d,q=void 0,p=void 0,r=void 0,t=r=void 0,u=void 0,v=void 0,y=v=n=0,x=r=p=void 0,r=m=x=p=q=void 0,t=k.geometry,u=t.faces,x=j.faces,q=0,p=x.length;q<p;q++)r=x[q],r=u[r],r instanceof THREE.Face3?
+(n+=3,v+=1,y+=3):r instanceof THREE.Face4&&(n+=4,v+=2,y+=4);for(var q=j,p=k,F=x=u=void 0,G=void 0,F=void 0,r=[],u=0,x=p.materials.length;u<x;u++)if(F=p.materials[u],F instanceof THREE.MeshFaceMaterial){F=0;for(l=q.materials.length;F<l;F++)(G=q.materials[F])&&r.push(G)}else(G=F)&&r.push(G);q=r;j.__materials=q;a:{u=p=void 0;x=q.length;for(p=0;p<x;p++)if(u=q[p],u.map||u.lightMap||u instanceof THREE.ShaderMaterial){p=!0;break a}p=!1}a:{x=u=void 0;r=q.length;for(u=0;u<r;u++)if(x=q[u],!(x instanceof THREE.MeshBasicMaterial&&
+!x.envMap||x instanceof THREE.MeshDepthMaterial)){x=x&&x.shading!=void 0&&x.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}x=!1}a:{r=u=void 0;F=q.length;for(u=0;u<F;u++)if(r=q[u],r.vertexColors){r=r.vertexColors;break a}r=!1}j.__vertexArray=new Float32Array(n*3);if(x)j.__normalArray=new Float32Array(n*3);if(t.hasTangents)j.__tangentArray=new Float32Array(n*4);if(r)j.__colorArray=new Float32Array(n*3);if(p){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(n*
+2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(n*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(n*4),j.__skinVertexBArray=new Float32Array(n*4),j.__skinIndexArray=new Float32Array(n*4),j.__skinWeightArray=new Float32Array(n*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(y*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(u=
+j.numMorphTargets;t<u;t++)j.__morphTargetsArrays.push(new Float32Array(n*3))}j.__needsSmoothNormals=x==THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=r;j.__normalType=x;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=y*2;t=0;for(u=q.length;t<u;t++)if(p=q[t],p.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in p.attributes){r=p.attributes[a];x={};for(m in r)x[m]=r[m];if(!x.__webglInitialized||x.createUniqueBuffers)x.__webglInitialized=
+!0,v=1,x.type==="v2"?v=2:x.type==="v3"?v=3:x.type==="v4"?v=4:x.type==="c"&&(v=3),x.size=v,x.array=new Float32Array(n*v),x.buffer=e.createBuffer(),x.buffer.belongsToAttribute=a,r.needsUpdate=!0,x.__original=r;j.__webglCustomAttributes[a]=x}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(d instanceof THREE.Ribbon){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=
+e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),L.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.Line){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),L.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=
+new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.ParticleSystem&&(i=d.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=e.createBuffer();j.__webglColorBuffer=e.createBuffer();L.info.geometries++;j=i;k=d;n=j.vertices.length;j.__vertexArray=new Float32Array(n*3);j.__colorArray=new Float32Array(n*3);j.__sortArray=[];j.__webglParticleCount=n;j.__materials=k.materials;y=v=m=void 0;m=0;for(v=k.materials.length;m<v;m++)if(y=k.materials[m],
+y.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in y.attributes){originalAttribute=y.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(n*
+size),attribute.buffer=e.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributes[a]=attribute}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ga(f.__webglObjects,j,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,ga(f.__webglObjects,i,d)):THREE.MarchingCubes!==
+void 0&&d instanceof THREE.MarchingCubes?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)oa(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&&oa(f.__webglObjectsImmediate,d);d.__webglActive=!1;b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<f;d++)if(i=b.__webglObjects[d].object,m=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(n=h.geometryGroupsList.length;k<n;k++)if(j=h.geometryGroupsList[k],m=wa(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||
+m)if(m=j,v=e.DYNAMIC_DRAW,y=!h.dynamic,m.__inittedArrays){var E=q=t=void 0,z=void 0,H=E=void 0,D=void 0,O=void 0,I=void 0,K=G=F=r=x=u=p=void 0,M=void 0,J=void 0,s=z=I=z=O=D=void 0,o=void 0,A=o=s=D=void 0,N=void 0,R=A=o=s=E=E=H=I=z=A=o=s=N=A=o=s=N=A=o=s=void 0,fa=0,ka=0,V=0,X=0,S=0,P=0,W=0,Q=0,ja=0,w=0,la=0,A=s=0,A=void 0,ma=m.__vertexArray,ha=m.__uvArray,ia=m.__uv2Array,U=m.__normalArray,Z=m.__tangentArray,na=m.__colorArray,$=m.__skinVertexAArray,aa=m.__skinVertexBArray,ca=m.__skinIndexArray,da=m.__skinWeightArray,
+pa=m.__morphTargetsArrays,Y=m.__webglCustomAttributes,o=void 0,ea=m.__faceArray,Aa=m.__lineArray,va=m.__needsSmoothNormals,u=m.__vertexColorType,p=m.__uvType,x=m.__normalType,sa=i.geometry,ta=sa.__dirtyVertices,ua=sa.__dirtyElements,ra=sa.__dirtyUvs,za=sa.__dirtyNormals,Ba=sa.__dirtyTangents,Ca=sa.__dirtyColors,Da=sa.__dirtyMorphTargets,ya=sa.vertices,Fa=m.faces,Ja=sa.faces,Ga=sa.faceVertexUvs[0],Ia=sa.faceVertexUvs[1],Ma=sa.skinVerticesA,Na=sa.skinVerticesB,Oa=sa.skinIndices,Ka=sa.skinWeights,Ha=
+sa.morphTargets;if(Y)for(R in Y)Y[R].offset=0,Y[R].offsetSrc=0;t=0;for(q=Fa.length;t<q;t++)if(E=Fa[t],z=Ja[E],Ga&&(r=Ga[E]),Ia&&(F=Ia[E]),E=z.vertexNormals,H=z.normal,D=z.vertexColors,O=z.color,I=z.vertexTangents,z instanceof THREE.Face3){if(ta)G=ya[z.a].position,K=ya[z.b].position,M=ya[z.c].position,ma[ka]=G.x,ma[ka+1]=G.y,ma[ka+2]=G.z,ma[ka+3]=K.x,ma[ka+4]=K.y,ma[ka+5]=K.z,ma[ka+6]=M.x,ma[ka+7]=M.y,ma[ka+8]=M.z,ka+=9;if(Y)for(R in Y)if(o=Y[R],o.__original.needsUpdate)s=o.offset,A=o.offsetSrc,o.size===
+1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[s]=o.value[z.a],o.array[s+1]=o.value[z.b],o.array[s+2]=o.value[z.c]):o.boundTo==="faces"?(A=o.value[A],o.array[s]=A,o.array[s+1]=A,o.array[s+2]=A,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[s]=o.value[A],o.array[s+1]=o.value[A+1],o.array[s+2]=o.value[A+2],o.offsetSrc+=3),o.offset+=3):(o.boundTo===void 0||o.boundTo==="vertices"?(G=o.value[z.a],K=o.value[z.b],M=o.value[z.c]):o.boundTo==="faces"?(M=K=G=A=o.value[A],o.offsetSrc++):o.boundTo===
+"faceVertices"&&(G=o.value[A],K=o.value[A+1],M=o.value[A+2],o.offsetSrc+=3),o.size===2?(o.array[s]=G.x,o.array[s+1]=G.y,o.array[s+2]=K.x,o.array[s+3]=K.y,o.array[s+4]=M.x,o.array[s+5]=M.y,o.offset+=6):o.size===3?(o.type==="c"?(o.array[s]=G.r,o.array[s+1]=G.g,o.array[s+2]=G.b,o.array[s+3]=K.r,o.array[s+4]=K.g,o.array[s+5]=K.b,o.array[s+6]=M.r,o.array[s+7]=M.g,o.array[s+8]=M.b):(o.array[s]=G.x,o.array[s+1]=G.y,o.array[s+2]=G.z,o.array[s+3]=K.x,o.array[s+4]=K.y,o.array[s+5]=K.z,o.array[s+6]=M.x,o.array[s+
+7]=M.y,o.array[s+8]=M.z),o.offset+=9):(o.array[s]=G.x,o.array[s+1]=G.y,o.array[s+2]=G.z,o.array[s+3]=G.w,o.array[s+4]=K.x,o.array[s+5]=K.y,o.array[s+6]=K.z,o.array[s+7]=K.w,o.array[s+8]=M.x,o.array[s+9]=M.y,o.array[s+10]=M.z,o.array[s+11]=M.w,o.offset+=12));if(Da){s=0;for(o=Ha.length;s<o;s++)G=Ha[s].vertices[z.a].position,K=Ha[s].vertices[z.b].position,M=Ha[s].vertices[z.c].position,A=pa[s],A[la]=G.x,A[la+1]=G.y,A[la+2]=G.z,A[la+3]=K.x,A[la+4]=K.y,A[la+5]=K.z,A[la+6]=M.x,A[la+7]=M.y,A[la+8]=M.z;la+=
+9}if(Ka.length)s=Ka[z.a],o=Ka[z.b],A=Ka[z.c],da[w]=s.x,da[w+1]=s.y,da[w+2]=s.z,da[w+3]=s.w,da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=o.w,da[w+8]=A.x,da[w+9]=A.y,da[w+10]=A.z,da[w+11]=A.w,s=Oa[z.a],o=Oa[z.b],A=Oa[z.c],ca[w]=s.x,ca[w+1]=s.y,ca[w+2]=s.z,ca[w+3]=s.w,ca[w+4]=o.x,ca[w+5]=o.y,ca[w+6]=o.z,ca[w+7]=o.w,ca[w+8]=A.x,ca[w+9]=A.y,ca[w+10]=A.z,ca[w+11]=A.w,s=Ma[z.a],o=Ma[z.b],A=Ma[z.c],$[w]=s.x,$[w+1]=s.y,$[w+2]=s.z,$[w+3]=1,$[w+4]=o.x,$[w+5]=o.y,$[w+6]=o.z,$[w+7]=1,$[w+8]=A.x,$[w+9]=A.y,$[w+
+10]=A.z,$[w+11]=1,s=Na[z.a],o=Na[z.b],A=Na[z.c],aa[w]=s.x,aa[w+1]=s.y,aa[w+2]=s.z,aa[w+3]=1,aa[w+4]=o.x,aa[w+5]=o.y,aa[w+6]=o.z,aa[w+7]=1,aa[w+8]=A.x,aa[w+9]=A.y,aa[w+10]=A.z,aa[w+11]=1,w+=12;if(Ca&&u)D.length==3&&u==THREE.VertexColors?(z=D[0],s=D[1],o=D[2]):o=s=z=O,na[ja]=z.r,na[ja+1]=z.g,na[ja+2]=z.b,na[ja+3]=s.r,na[ja+4]=s.g,na[ja+5]=s.b,na[ja+6]=o.r,na[ja+7]=o.g,na[ja+8]=o.b,ja+=9;if(Ba&&sa.hasTangents)D=I[0],O=I[1],z=I[2],Z[W]=D.x,Z[W+1]=D.y,Z[W+2]=D.z,Z[W+3]=D.w,Z[W+4]=O.x,Z[W+5]=O.y,Z[W+6]=
+O.z,Z[W+7]=O.w,Z[W+8]=z.x,Z[W+9]=z.y,Z[W+10]=z.z,Z[W+11]=z.w,W+=12;if(za&&x)if(E.length==3&&va)for(I=0;I<3;I++)H=E[I],U[P]=H.x,U[P+1]=H.y,U[P+2]=H.z,P+=3;else for(I=0;I<3;I++)U[P]=H.x,U[P+1]=H.y,U[P+2]=H.z,P+=3;if(ra&&r!==void 0&&p)for(I=0;I<3;I++)E=r[I],ha[V]=E.u,ha[V+1]=E.v,V+=2;if(ra&&F!==void 0&&p)for(I=0;I<3;I++)E=F[I],ia[X]=E.u,ia[X+1]=E.v,X+=2;ua&&(ea[S]=fa,ea[S+1]=fa+1,ea[S+2]=fa+2,S+=3,Aa[Q]=fa,Aa[Q+1]=fa+1,Aa[Q+2]=fa,Aa[Q+3]=fa+2,Aa[Q+4]=fa+1,Aa[Q+5]=fa+2,Q+=6,fa+=3)}else if(z instanceof
+THREE.Face4){if(ta)G=ya[z.a].position,K=ya[z.b].position,M=ya[z.c].position,J=ya[z.d].position,ma[ka]=G.x,ma[ka+1]=G.y,ma[ka+2]=G.z,ma[ka+3]=K.x,ma[ka+4]=K.y,ma[ka+5]=K.z,ma[ka+6]=M.x,ma[ka+7]=M.y,ma[ka+8]=M.z,ma[ka+9]=J.x,ma[ka+10]=J.y,ma[ka+11]=J.z,ka+=12;if(Y)for(R in Y)if(o=Y[R],o.__original.needsUpdate)s=o.offset,A=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[s]=o.value[z.a],o.array[s+1]=o.value[z.b],o.array[s+2]=o.value[z.c],o.array[s+3]=o.value[z.d]):o.boundTo===
+"faces"?(A=o.value[A],o.array[s]=A,o.array[s+1]=A,o.array[s+2]=A,o.array[s+3]=A,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[s]=o.value[A],o.array[s+1]=o.value[A+1],o.array[s+2]=o.value[A+2],o.array[s+3]=o.value[A+3],o.offsetSrc+=4),o.offset+=4):(o.boundTo===void 0||o.boundTo==="vertices"?(G=o.value[z.a],K=o.value[z.b],M=o.value[z.c],J=o.value[z.d]):o.boundTo==="faces"?(J=M=K=G=A=o.value[A],o.offsetSrc++):o.boundTo==="faceVertices"&&(G=o.value[A],K=o.value[A+1],M=o.value[A+2],J=o.value[A+3],
+o.offsetSrc+=4),o.size===2?(o.array[s]=G.x,o.array[s+1]=G.y,o.array[s+2]=K.x,o.array[s+3]=K.y,o.array[s+4]=M.x,o.array[s+5]=M.y,o.array[s+6]=J.x,o.array[s+7]=J.y,o.offset+=8):o.size===3?(o.type==="c"?(o.array[s]=G.r,o.array[s+1]=G.g,o.array[s+2]=G.b,o.array[s+3]=K.r,o.array[s+4]=K.g,o.array[s+5]=K.b,o.array[s+6]=M.r,o.array[s+7]=M.g,o.array[s+8]=M.b,o.array[s+9]=J.r,o.array[s+10]=J.g,o.array[s+11]=J.b):(o.array[s]=G.x,o.array[s+1]=G.y,o.array[s+2]=G.z,o.array[s+3]=K.x,o.array[s+4]=K.y,o.array[s+5]=
+K.z,o.array[s+6]=M.x,o.array[s+7]=M.y,o.array[s+8]=M.z,o.array[s+9]=J.x,o.array[s+10]=J.y,o.array[s+11]=J.z),o.offset+=12):(o.array[s]=G.x,o.array[s+1]=G.y,o.array[s+2]=G.z,o.array[s+3]=G.w,o.array[s+4]=K.x,o.array[s+5]=K.y,o.array[s+6]=K.z,o.array[s+7]=K.w,o.array[s+8]=M.x,o.array[s+9]=M.y,o.array[s+10]=M.z,o.array[s+11]=M.w,o.array[s+12]=J.x,o.array[s+13]=J.y,o.array[s+14]=J.z,o.array[s+15]=J.w,o.offset+=16));if(Da){s=0;for(o=Ha.length;s<o;s++)G=Ha[s].vertices[z.a].position,K=Ha[s].vertices[z.b].position,
+M=Ha[s].vertices[z.c].position,J=Ha[s].vertices[z.d].position,A=pa[s],A[la]=G.x,A[la+1]=G.y,A[la+2]=G.z,A[la+3]=K.x,A[la+4]=K.y,A[la+5]=K.z,A[la+6]=M.x,A[la+7]=M.y,A[la+8]=M.z,A[la+9]=J.x,A[la+10]=J.y,A[la+11]=J.z;la+=12}if(Ka.length)s=Ka[z.a],o=Ka[z.b],A=Ka[z.c],N=Ka[z.d],da[w]=s.x,da[w+1]=s.y,da[w+2]=s.z,da[w+3]=s.w,da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=o.w,da[w+8]=A.x,da[w+9]=A.y,da[w+10]=A.z,da[w+11]=A.w,da[w+12]=N.x,da[w+13]=N.y,da[w+14]=N.z,da[w+15]=N.w,s=Oa[z.a],o=Oa[z.b],A=Oa[z.c],N=
+Oa[z.d],ca[w]=s.x,ca[w+1]=s.y,ca[w+2]=s.z,ca[w+3]=s.w,ca[w+4]=o.x,ca[w+5]=o.y,ca[w+6]=o.z,ca[w+7]=o.w,ca[w+8]=A.x,ca[w+9]=A.y,ca[w+10]=A.z,ca[w+11]=A.w,ca[w+12]=N.x,ca[w+13]=N.y,ca[w+14]=N.z,ca[w+15]=N.w,s=Ma[z.a],o=Ma[z.b],A=Ma[z.c],N=Ma[z.d],$[w]=s.x,$[w+1]=s.y,$[w+2]=s.z,$[w+3]=1,$[w+4]=o.x,$[w+5]=o.y,$[w+6]=o.z,$[w+7]=1,$[w+8]=A.x,$[w+9]=A.y,$[w+10]=A.z,$[w+11]=1,$[w+12]=N.x,$[w+13]=N.y,$[w+14]=N.z,$[w+15]=1,s=Na[z.a],o=Na[z.b],A=Na[z.c],z=Na[z.d],aa[w]=s.x,aa[w+1]=s.y,aa[w+2]=s.z,aa[w+3]=1,aa[w+
+4]=o.x,aa[w+5]=o.y,aa[w+6]=o.z,aa[w+7]=1,aa[w+8]=A.x,aa[w+9]=A.y,aa[w+10]=A.z,aa[w+11]=1,aa[w+12]=z.x,aa[w+13]=z.y,aa[w+14]=z.z,aa[w+15]=1,w+=16;if(Ca&&u)D.length==4&&u==THREE.VertexColors?(z=D[0],s=D[1],o=D[2],D=D[3]):D=o=s=z=O,na[ja]=z.r,na[ja+1]=z.g,na[ja+2]=z.b,na[ja+3]=s.r,na[ja+4]=s.g,na[ja+5]=s.b,na[ja+6]=o.r,na[ja+7]=o.g,na[ja+8]=o.b,na[ja+9]=D.r,na[ja+10]=D.g,na[ja+11]=D.b,ja+=12;if(Ba&&sa.hasTangents)D=I[0],O=I[1],z=I[2],I=I[3],Z[W]=D.x,Z[W+1]=D.y,Z[W+2]=D.z,Z[W+3]=D.w,Z[W+4]=O.x,Z[W+5]=
+O.y,Z[W+6]=O.z,Z[W+7]=O.w,Z[W+8]=z.x,Z[W+9]=z.y,Z[W+10]=z.z,Z[W+11]=z.w,Z[W+12]=I.x,Z[W+13]=I.y,Z[W+14]=I.z,Z[W+15]=I.w,W+=16;if(za&&x)if(E.length==4&&va)for(I=0;I<4;I++)H=E[I],U[P]=H.x,U[P+1]=H.y,U[P+2]=H.z,P+=3;else for(I=0;I<4;I++)U[P]=H.x,U[P+1]=H.y,U[P+2]=H.z,P+=3;if(ra&&r!==void 0&&p)for(I=0;I<4;I++)E=r[I],ha[V]=E.u,ha[V+1]=E.v,V+=2;if(ra&&F!==void 0&&p)for(I=0;I<4;I++)E=F[I],ia[X]=E.u,ia[X+1]=E.v,X+=2;ua&&(ea[S]=fa,ea[S+1]=fa+1,ea[S+2]=fa+3,ea[S+3]=fa+1,ea[S+4]=fa+2,ea[S+5]=fa+3,S+=6,Aa[Q]=
+fa,Aa[Q+1]=fa+1,Aa[Q+2]=fa,Aa[Q+3]=fa+3,Aa[Q+4]=fa+1,Aa[Q+5]=fa+2,Aa[Q+6]=fa+2,Aa[Q+7]=fa+3,Q+=8,fa+=4)}ta&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,ma,v));if(Y)for(R in Y)o=Y[R],o.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,o.buffer),e.bufferData(e.ARRAY_BUFFER,o.array,v));if(Da){s=0;for(o=Ha.length;s<o;s++)e.bindBuffer(e.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[s]),e.bufferData(e.ARRAY_BUFFER,pa[s],v)}Ca&&ja>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer),
+e.bufferData(e.ARRAY_BUFFER,na,v));za&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,U,v));Ba&&sa.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,Z,v));ra&&V>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ha,v));ra&&X>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,ia,v));ua&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,
+ea,v),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Aa,v));w>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,$,v),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,aa,v),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,ca,v),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,da,v));y&&(delete m.__inittedArrays,
+delete m.__colorArray,delete m.__normalArray,delete m.__tangentArray,delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;xa(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||
+h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=t=y=y=void 0;q=i.vertices;n=i.colors;p=q.length;m=n.length;u=i.__vertexArray;v=i.__colorArray;x=i.__dirtyColors;if(i.__dirtyVertices){for(y=0;y<p;y++)t=q[y].position,k=y*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(x){for(y=0;y<m;y++)color=n[y],k=y*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,v,j)}}h.__dirtyVertices=
+!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=t=y=y=void 0;q=i.vertices;n=i.colors;p=q.length;m=n.length;u=i.__vertexArray;v=i.__colorArray;x=i.__dirtyColors;if(i.__dirtyVertices){for(y=0;y<p;y++)t=q[y].position,k=y*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(x){for(y=0;y<m;y++)color=n[y],k=y*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,
+i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,m=wa(h),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||m)&&c(h,e.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,xa(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),b=="back"?e.cullFace(e.BACK):b=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};
+this.supportsVertexTextures=function(){return ab}};
 THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
 THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
 THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:!0};
 THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.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,d){THREE.WebGLRenderTarget.call(this,b,c,d);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,d){THREE.WebGLRenderTarget.call(this,b,c,d);this.activeCubeFace=0};

+ 3 - 2
src/renderers/WebGLRenderer.js

@@ -69,7 +69,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	_preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false,
 	_preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false,
 	_antialias = parameters.antialias !== undefined ? parameters.antialias : false,
 	_antialias = parameters.antialias !== undefined ? parameters.antialias : false,
 	_clearColor = parameters.clearColor !== undefined ? new THREE.Color( parameters.clearColor ) : new THREE.Color( 0x000000 ),
 	_clearColor = parameters.clearColor !== undefined ? new THREE.Color( parameters.clearColor ) : new THREE.Color( 0x000000 ),
-	_clearAlpha = parameters.clearAlpha !== undefined ? parameters.clearAlpha : 0;
+	_clearAlpha = parameters.clearAlpha !== undefined ? parameters.clearAlpha : 0,
 	_maxLights = parameters.maxLights !== undefined ? parameters.maxLights : 4;
 	_maxLights = parameters.maxLights !== undefined ? parameters.maxLights : 4;
 
 
 	this.info = {
 	this.info = {
@@ -180,7 +180,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	_sprite.vertices = new Float32Array( 8 + 8 );
 	_sprite.vertices = new Float32Array( 8 + 8 );
 	_sprite.faces    = new Uint16Array( 6 );
 	_sprite.faces    = new Uint16Array( 6 );
 
 
-	i = 0;
+	var i = 0;
 
 
 	_sprite.vertices[ i++ ] = -1; _sprite.vertices[ i++ ] = -1;	// vertex 0
 	_sprite.vertices[ i++ ] = -1; _sprite.vertices[ i++ ] = -1;	// vertex 0
 	_sprite.vertices[ i++ ] = 0;  _sprite.vertices[ i++ ] = 1;	// uv 0
 	_sprite.vertices[ i++ ] = 0;  _sprite.vertices[ i++ ] = 1;	// uv 0
@@ -195,6 +195,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	_sprite.vertices[ i++ ] = 0;  _sprite.vertices[ i++ ] = 0;	// uv 3
 	_sprite.vertices[ i++ ] = 0;  _sprite.vertices[ i++ ] = 0;	// uv 3
 
 
 	i = 0;
 	i = 0;
+
 	_sprite.faces[ i++ ] = 0; _sprite.faces[ i++ ] = 1; _sprite.faces[ i++ ] = 2;
 	_sprite.faces[ i++ ] = 0; _sprite.faces[ i++ ] = 1; _sprite.faces[ i++ ] = 2;
 	_sprite.faces[ i++ ] = 0; _sprite.faces[ i++ ] = 2; _sprite.faces[ i++ ] = 3;
 	_sprite.faces[ i++ ] = 0; _sprite.faces[ i++ ] = 2; _sprite.faces[ i++ ] = 3;